Removed several unnecessary (int)s and changed around operations to prevent problems with integer division.
Signed-off-by: onpon4 <onpon4@yahoo.com>
This commit is contained in:
parent
0d189c858c
commit
38f44d9387
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue