diff --git a/code/aliens.cpp b/code/aliens.cpp index b79f6ba..60c5cb1 100644 --- a/code/aliens.cpp +++ b/code/aliens.cpp @@ -38,7 +38,7 @@ static bool placeAlien(object *theEnemy) if (currentGame.area == 24) { theEnemy->x = screen->w; - theEnemy->y = rrand((int)((1/3) * screen->h), (int)((2/3) * screen->h)); + theEnemy->y = rrand(screen->h / 3, (2 * screen->h) / 3); } for (int i = 0 ; i < MAX_ALIENS ; i++) @@ -396,8 +396,8 @@ static void getPreDefinedAliens() if (currentGame.area == 5) { enemy[WC_BOSS].target = &player; - enemy[WC_BOSS].x = (int)(-screen->w / 2); - enemy[WC_BOSS].y = (int)(screen->h / 2); + enemy[WC_BOSS].x = -screen->w / 2; + enemy[WC_BOSS].y = screen->h / 2; enemy[13].owner = &enemy[WC_BOSS]; enemy[13].target = &player; @@ -412,8 +412,8 @@ static void getPreDefinedAliens() else if ((currentGame.area == 11) || (currentGame.area == 14)) { enemy[WC_BOSS].target = &player; - enemy[WC_BOSS].x = (int)(-screen->w / 2); - enemy[WC_BOSS].y = (int)(screen->h / 2); + enemy[WC_BOSS].x = -screen->w / 2; + enemy[WC_BOSS].y = screen->h / 2; enemy[13].owner = &enemy[WC_BOSS]; enemy[13].target = &player; @@ -596,8 +596,8 @@ void initAliens() { enemy[WC_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE | FL_NOMOVE; - enemy[WC_KLINE].x = (int)(screen->w * (2 / 3)); - enemy[WC_KLINE].y = (int)(screen->h / 2); + enemy[WC_KLINE].x = (screen->w * 2) / 3; + enemy[WC_KLINE].y = screen->h / 2; enemy[WC_KLINE].deathCounter = -250; enemy[WC_KLINE].maxShield = 1500; diff --git a/code/game.cpp b/code/game.cpp index d1c9f2c..45e8548 100644 --- a/code/game.cpp +++ b/code/game.cpp @@ -233,7 +233,7 @@ int mainGameLoop() if (engine.paused) { - textSurface(22, "PAUSED", -1, (int)(screen->h / 2), FONT_WHITE); + textSurface(22, "PAUSED", -1, screen->h / 2, FONT_WHITE); blitText(22); updateScreen(); diff --git a/code/intermission.cpp b/code/intermission.cpp index ade8bff..0a00dd9 100644 --- a/code/intermission.cpp +++ b/code/intermission.cpp @@ -503,8 +503,8 @@ int galaxyMap() char string[25]; - engine.cursor_x = (int)(screen->w / 2); - engine.cursor_y = (int)(screen->h / 2); + engine.cursor_x = screen->w / 2; + engine.cursor_y = screen->h / 2; shape[0] = loadImage("gfx/cursor.png"); // Icons 1 - 29 diff --git a/code/misc.cpp b/code/misc.cpp index f0e4ac5..ed9f1eb 100644 --- a/code/misc.cpp +++ b/code/misc.cpp @@ -110,28 +110,28 @@ static void doTargetArrow() // TODO: This is not very good. It assumes the player is always at (400,300), // which is not always true, resulting in the arrows sometimes not appearing when // the enemy is not visible and sometimes appearing when the enemy is visible. - if (distY < (int)(-screen->h / 2)) + if (distY < -screen->h / 2) engine.targetArrow = 36; - if (distY > (int)(screen->h / 2)) + if (distY > screen->h / 2) engine.targetArrow = 40; - if (distX < (int)(-screen->w / 2)) + if (distX < -screen->w / 2) engine.targetArrow = 42; - if (distX > (int)(screen->w / 2)) + if (distX > screen->w / 2) engine.targetArrow = 38; - if ((distY < (int)(-screen->h / 2)) && (distX > (int)(screen->w / 2))) + if ((distY < -screen->h / 2) && (distX > screen->w / 2)) engine.targetArrow = 37; - if ((distY > (int)(screen->h / 2)) && (distX > (int)(screen->w / 2))) + if ((distY > screen->h / 2) && (distX > screen->w / 2)) engine.targetArrow = 39; - if ((distY > (int)(screen->h / 2)) && (distX < (int)(-screen->w / 2))) + if ((distY > screen->h / 2) && (distX < -screen->w / 2)) engine.targetArrow = 41; - if ((distY < (int)(-screen->h / 2)) && (distX < (int)(-screen->w / 2))) + if ((distY < -screen->h / 2) && (distX < -screen->w / 2)) engine.targetArrow = 43; if (engine.targetArrow != -1) diff --git a/code/player.cpp b/code/player.cpp index 2a390dd..010b65c 100644 --- a/code/player.cpp +++ b/code/player.cpp @@ -28,8 +28,8 @@ Initialises the player for a new game. void initPlayer() { player.active = true; - player.x = (int)(screen->w / 2); - player.y = (int)(screen->h / 2); + player.x = screen->w / 2; + player.y = screen->h / 2; player.speed = 2; player.maxShield = (25 * currentGame.shieldUnits); player.systemPower = player.maxShield;