Converted the rest of trailing &&.

This commit is contained in:
Layla Marchant 2020-11-22 23:33:26 -05:00
parent 1a3e801271
commit 45470bb68c
No known key found for this signature in database
GPG Key ID: 52FB5C20A8336782
10 changed files with 198 additions and 181 deletions

View File

@ -1110,8 +1110,8 @@ void aliens_init()
barrierSpeed++; barrierSpeed++;
} }
if ((game.area == MISN_POSWIC) && if ((game.area == MISN_POSWIC)
(aliens[i].classDef == CD_BOSS)) && (aliens[i].classDef == CD_BOSS))
{ {
aliens[i].flags |= FL_IMMORTAL; aliens[i].flags |= FL_IMMORTAL;
} }
@ -1663,8 +1663,8 @@ void alien_setKlineAI(Object *alien)
switch(RANDRANGE(0, 9)) switch(RANDRANGE(0, 9))
{ {
case 0: case 0:
if ((alien->weaponType[0] != W_DIRSHOCKMISSILE) && if ((alien->weaponType[0] != W_DIRSHOCKMISSILE)
(alien->weaponType[1] != W_MICRO_HOMING_MISSILES)) && (alien->weaponType[1] != W_MICRO_HOMING_MISSILES))
alien->flags |= FL_CONTINUOUS_FIRE; alien->flags |= FL_CONTINUOUS_FIRE;
alien->dx = ((alien->x - alien->target->x) / alien->dx = ((alien->x - alien->target->x) /
((300 / alien->speed) + RANDRANGE(0, 100))); ((300 / alien->speed) + RANDRANGE(0, 100)));
@ -1726,8 +1726,8 @@ void alien_searchForTarget(Object *alien)
} }
else else
{ {
if ((targetEnemy->classDef != CD_CARGOSHIP) && if ((targetEnemy->classDef != CD_CARGOSHIP)
(targetEnemy->classDef != CD_BOSS)) && (targetEnemy->classDef != CD_BOSS))
{ {
badTarget = 1; badTarget = 1;
} }
@ -1830,11 +1830,11 @@ int alien_enemiesInFront(Object *alien)
{ {
for (int i = 0 ; i < ALIEN_MAX ; i++) for (int i = 0 ; i < ALIEN_MAX ; i++)
{ {
if ((alien != &aliens[i]) && (aliens[i].flags & FL_WEAPCO) && if ((alien != &aliens[i]) && (aliens[i].flags & FL_WEAPCO)
(aliens[i].shield > 0)) && (aliens[i].shield > 0))
{ {
if ((alien->y > aliens[i].y - 15) && if ((alien->y > aliens[i].y - 15)
(alien->y < aliens[i].y + aliens[i].image[0]->h + 15)) && (alien->y < aliens[i].y + aliens[i].image[0]->h + 15))
{ {
if ((alien->face == 1) && (aliens[i].x < alien->x)) if ((alien->face == 1) && (aliens[i].x < alien->x))
return 1; return 1;
@ -1886,14 +1886,18 @@ void alien_move(Object *alien)
{ {
for (int i = 0 ; i < ALIEN_MAX ; i++) for (int i = 0 ; i < ALIEN_MAX ; i++)
{ {
if ((aliens[i].owner != alien) && (aliens[i].active) && if ((aliens[i].owner != alien) && (aliens[i].active)
(aliens[i].shield > 0) && (!(aliens[i].flags & FL_LEAVESECTOR)) && && (aliens[i].shield > 0)
(alien->classDef != CD_BARRIER) && && (!(aliens[i].flags & FL_LEAVESECTOR))
ship_collision(alien, &aliens[i])) && (alien->classDef != CD_BARRIER)
&& ship_collision(alien, &aliens[i]))
{ {
if ((game.difficulty == DIFFICULTY_ORIGINAL) && (alien->classDef != CD_DRONE) && if ((game.difficulty == DIFFICULTY_ORIGINAL)
(alien->classDef != CD_ASTEROID) && (alien->classDef != CD_ASTEROID2) && && (alien->classDef != CD_DRONE)
(alien->owner == alien) && (game.area != MISN_ELLESH)) && (alien->classDef != CD_ASTEROID)
&& (alien->classDef != CD_ASTEROID2)
&& (alien->owner == alien)
&& (game.area != MISN_ELLESH))
{ {
collided = 1; collided = 1;
} }
@ -1978,8 +1982,8 @@ void alien_destroy(Object *alien, Object *attacker)
audio_playSound(SFX_EXPLOSION, alien->x, alien->y); audio_playSound(SFX_EXPLOSION, alien->x, alien->y);
// Chain reaction damage if needed (Classic Difficulty version) // Chain reaction damage if needed (Classic Difficulty version)
if ((game.difficulty == DIFFICULTY_ORIGINAL) && if ((game.difficulty == DIFFICULTY_ORIGINAL)
(alien->owner != alien) && (alien->flags & FL_DAMAGEOWNER)) && (alien->owner != alien) && (alien->flags & FL_DAMAGEOWNER))
{ {
alien_hurt(alien->owner, attacker, alien->maxShield, 0); alien_hurt(alien->owner, attacker, alien->maxShield, 0);
} }
@ -2015,8 +2019,8 @@ void alien_destroy(Object *alien, Object *attacker)
} }
} }
if (CHANCE(1 / 16.) && (alien->flags & FL_WEAPCO) && if (CHANCE(1 / 16.) && (alien->flags & FL_WEAPCO)
(!(alien->flags & FL_NOBANTER))) && (!(alien->flags & FL_NOBANTER)))
{ {
radio_getRandomMessage(msg, _( radio_getRandomMessage(msg, _(
/// Chris brag messages /// Chris brag messages
@ -2048,8 +2052,8 @@ void alien_destroy(Object *alien, Object *attacker)
else if (attacker->classDef == CD_PHOEBE) else if (attacker->classDef == CD_PHOEBE)
{ {
game.wingMate1Kills++; game.wingMate1Kills++;
if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO) && if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO)
(!(alien->flags & FL_NOBANTER))) && (!(alien->flags & FL_NOBANTER)))
{ {
radio_getRandomMessage(msg, _( radio_getRandomMessage(msg, _(
/// Phoebe brag messages /// Phoebe brag messages
@ -2077,8 +2081,8 @@ void alien_destroy(Object *alien, Object *attacker)
else if (attacker->classDef == CD_URSULA) else if (attacker->classDef == CD_URSULA)
{ {
game.wingMate2Kills++; game.wingMate2Kills++;
if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO) && if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO)
(!(alien->flags & FL_NOBANTER))) && (!(alien->flags & FL_NOBANTER)))
{ {
radio_getRandomMessage(msg, _( radio_getRandomMessage(msg, _(
/// Ursula brag messages /// Ursula brag messages

View File

@ -109,8 +109,8 @@ void audio_playSound(int sid, float x, float y)
} }
else else
{ {
if (Mix_Playing(channel) && (volume <= MIX_MAX_VOLUME / 4) && if (Mix_Playing(channel) && (volume <= MIX_MAX_VOLUME / 4)
(channelVolume[channel] >= MIX_MAX_VOLUME * 3 / 4)) && (channelVolume[channel] >= MIX_MAX_VOLUME * 3 / 4))
return; return;
else else
channelVolume[channel] = volume; channelVolume[channel] = volume;

View File

@ -48,8 +48,8 @@ void events_init()
switch (game.area) switch (game.area)
{ {
case MISN_INTERCEPTION: case MISN_INTERCEPTION:
if ((aliens[ALIEN_KLINE].classDef == CD_KLINE) && if ((aliens[ALIEN_KLINE].classDef == CD_KLINE)
(aliens[ALIEN_KLINE].active)) && (aliens[ALIEN_KLINE].active))
{ {
events[0].time = 2; events[0].time = 2;
events[0].face = FS_KLINE; events[0].face = FS_KLINE;

View File

@ -294,10 +294,10 @@ static void game_doCollectables()
if (collectable->active) if (collectable->active)
{ {
if ((collectable->x + collectable->image->w > 0) && if ((collectable->x + collectable->image->w > 0)
(collectable->x < screen->w) && && (collectable->x < screen->w)
(collectable->y + collectable->image->h > 0) && && (collectable->y + collectable->image->h > 0)
(collectable->y < screen->h)) && (collectable->y < screen->h))
screen_blit(collectable->image, (int)collectable->x, (int)collectable->y); screen_blit(collectable->image, (int)collectable->x, (int)collectable->y);
collectable->x += engine.ssx + engine.smx; collectable->x += engine.ssx + engine.smx;
@ -580,9 +580,9 @@ static void game_doCollectables()
} }
else else
{ {
if ((collectable->type == P_MINE) && (collectable->x >= 0) && if ((collectable->type == P_MINE) && (collectable->x >= 0)
(collectable->x <= screen->w) && (collectable->y >= 0) && && (collectable->x <= screen->w) && (collectable->y >= 0)
(collectable->y <= screen->h)) && (collectable->y <= screen->h))
collectable_explode(collectable); collectable_explode(collectable);
prevCollectable->next = collectable->next; prevCollectable->next = collectable->next;
free(collectable); free(collectable);
@ -818,8 +818,9 @@ static void game_doBullets()
if ((bullet->flags & WF_WEAPCO) || (bullet->id == WT_ROCKET) if ((bullet->flags & WF_WEAPCO) || (bullet->id == WT_ROCKET)
|| (bullet->id == WT_LASER) || (bullet->id == WT_CHARGER)) || (bullet->id == WT_LASER) || (bullet->id == WT_CHARGER))
{ {
if (bullet->active && (player.shield > 0) && if (bullet->active && (player.shield > 0)
(bullet->owner != &player) && bullet_collision(bullet, &player)) && (bullet->owner != &player)
&& bullet_collision(bullet, &player))
{ {
old_shield = player.shield; old_shield = player.shield;
@ -1024,14 +1025,16 @@ static void game_doAliens()
if (aliens[i].face == 0) if (aliens[i].face == 0)
aliens[i].x = aliens[i].owner->x - aliens[i].dx; aliens[i].x = aliens[i].owner->x - aliens[i].dx;
else else
aliens[i].x = aliens[i].owner->x + aliens[i].owner->image[0]->w + aliens[i].dx - aliens[i].image[0]->w; aliens[i].x = (aliens[i].owner->x + aliens[i].dx
+ aliens[i].owner->image[0]->w
- aliens[i].image[0]->w);
aliens[i].y = (aliens[i].owner->y + aliens[i].dy); aliens[i].y = (aliens[i].owner->y + aliens[i].dy);
if (aliens[i].owner->shield < 1) if (aliens[i].owner->shield < 1)
{ {
if ((aliens[i].classDef != CD_URANUSBOSSWING1) && if ((aliens[i].classDef != CD_URANUSBOSSWING1)
(aliens[i].classDef != CD_URANUSBOSSWING2)) && (aliens[i].classDef != CD_URANUSBOSSWING2))
{ {
aliens[i].shield = 0; aliens[i].shield = 0;
} }
@ -1052,8 +1055,8 @@ static void game_doAliens()
aliens[i].target = &aliens[i]; aliens[i].target = &aliens[i];
// Specific to Sid to stop him pissing about(!) // Specific to Sid to stop him pissing about(!)
if ((aliens[i].classDef == CD_SID) && if ((aliens[i].classDef == CD_SID)
(aliens[i].target->flags & FL_DISABLED)) && (aliens[i].target->flags & FL_DISABLED))
aliens[i].target = &aliens[i]; aliens[i].target = &aliens[i];
if (aliens[i].target == &aliens[i]) if (aliens[i].target == &aliens[i])
@ -1072,9 +1075,9 @@ static void game_doAliens()
} }
} }
if ((!(aliens[i].flags & FL_DISABLED)) && if ((!(aliens[i].flags & FL_DISABLED))
(aliens[i].thinktime == 0) && (aliens[i].target != &aliens[i]) && && (aliens[i].thinktime == 0) && (aliens[i].target != &aliens[i])
(aliens[i].owner == &aliens[i])) && (aliens[i].owner == &aliens[i]))
{ {
if (aliens[i].classDef == CD_KLINE) if (aliens[i].classDef == CD_KLINE)
alien_setKlineAI(&aliens[i]); alien_setKlineAI(&aliens[i]);
@ -1163,9 +1166,9 @@ static void game_doAliens()
aliens[i].dy = 20 + (cosf(barrierLoop + aliens[i].speed) * 40); aliens[i].dy = 20 + (cosf(barrierLoop + aliens[i].speed) * 40);
} }
if ((aliens[i].classDef == CD_MOBILESHIELD) && if ((aliens[i].classDef == CD_MOBILESHIELD)
(aliens[ALIEN_BOSS].active) && && (aliens[ALIEN_BOSS].active)
(aliens[ALIEN_BOSS].shield > 0)) && (aliens[ALIEN_BOSS].shield > 0))
{ {
LIMIT_ADD(aliens[ALIEN_BOSS].shield, 1, 0, LIMIT_ADD(aliens[ALIEN_BOSS].shield, 1, 0,
aliens[ALIEN_BOSS].maxShield); aliens[ALIEN_BOSS].maxShield);
@ -1174,14 +1177,14 @@ static void game_doAliens()
LIMIT_ADD(aliens[i].reload[0], -1, 0, 999); LIMIT_ADD(aliens[i].reload[0], -1, 0, 999);
LIMIT_ADD(aliens[i].reload[1], -1, 0, 999); LIMIT_ADD(aliens[i].reload[1], -1, 0, 999);
if ((!(aliens[i].flags & FL_DISABLED)) && if ((!(aliens[i].flags & FL_DISABLED))
(!(aliens[i].flags & FL_NOFIRE))) && (!(aliens[i].flags & FL_NOFIRE)))
{ {
if ((aliens[i].target->shield > 0)) if ((aliens[i].target->shield > 0))
canFire = alien_checkTarget(&aliens[i]); canFire = alien_checkTarget(&aliens[i]);
if (((aliens[i].thinktime % 2) == 0) && if (((aliens[i].thinktime % 2) == 0)
(aliens[i].flags & FL_FRIEND)) && (aliens[i].flags & FL_FRIEND))
canFire = alien_enemiesInFront(&aliens[i]); canFire = alien_enemiesInFront(&aliens[i]);
} }
else else
@ -1193,12 +1196,12 @@ static void game_doAliens()
{ {
for (int j = 0 ; j < 2 ; j++) for (int j = 0 ; j < 2 ; j++)
{ {
if ((aliens[i].reload[j] == 0) && if ((aliens[i].reload[j] == 0)
((rand() % 1000 < aliens[i].chance[j]) && ((rand() % 1000 < aliens[i].chance[j])
|| (aliens[i].flags & FL_CONTINUOUS_FIRE))) || (aliens[i].flags & FL_CONTINUOUS_FIRE)))
{ {
if ((aliens[i].weaponType[j] != W_ENERGYRAY) && if ((aliens[i].weaponType[j] != W_ENERGYRAY)
(aliens[i].weaponType[j] != W_LASER)) && (aliens[i].weaponType[j] != W_LASER))
{ {
if (aliens[i].weaponType[j] == W_CHARGER) if (aliens[i].weaponType[j] == W_CHARGER)
aliens[i].ammo[j] = 50 + rand() % 150; aliens[i].ammo[j] = 50 + rand() % 150;
@ -1211,8 +1214,8 @@ static void game_doAliens()
// Note: ammo[0] is required whether the ray is primary // Note: ammo[0] is required whether the ray is primary
// or secondary because futher below, ammo[0] increases on // or secondary because futher below, ammo[0] increases on
// any alien that isn't currently firing a ray. // any alien that isn't currently firing a ray.
else if ((aliens[i].weaponType[j] == W_ENERGYRAY) && else if ((aliens[i].weaponType[j] == W_ENERGYRAY)
(aliens[i].ammo[0] >= RAY_INTERVAL)) && (aliens[i].ammo[0] >= RAY_INTERVAL))
{ {
aliens[i].flags += FL_FIRERAY; aliens[i].flags += FL_FIRERAY;
audio_playSound(SFX_ENERGYRAY, aliens[i].x, aliens[i].y); audio_playSound(SFX_ENERGYRAY, aliens[i].x, aliens[i].y);
@ -1259,16 +1262,17 @@ static void game_doAliens()
LIMIT_ADD(aliens[i].hit, -1, 0, 100); LIMIT_ADD(aliens[i].hit, -1, 0, 100);
if ((aliens[i].x + aliens[i].image[0]->w > 0) && if ((aliens[i].x + aliens[i].image[0]->w > 0)
(aliens[i].x < screen->w) && && (aliens[i].x < screen->w)
(aliens[i].y + aliens[i].image[0]->h > 0) && && (aliens[i].y + aliens[i].image[0]->h > 0)
(aliens[i].y < screen->h)) && (aliens[i].y < screen->h))
{ {
if ((!(aliens[i].flags & FL_DISABLED)) && if ((!(aliens[i].flags & FL_DISABLED))
(aliens[i].classDef != CD_ASTEROID) && && (aliens[i].classDef != CD_ASTEROID)
(aliens[i].classDef != CD_ASTEROID2)) && (aliens[i].classDef != CD_ASTEROID2))
explosion_addEngine(&aliens[i]); explosion_addEngine(&aliens[i]);
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0)) if ((!(aliens[i].flags & FL_ISCLOAKED))
|| (aliens[i].hit > 0))
screen_blit(gfx_shipSprites[shapeToUse], (int)aliens[i].x, screen_blit(gfx_shipSprites[shapeToUse], (int)aliens[i].x,
(int)aliens[i].y); (int)aliens[i].y);
if (aliens[i].flags & FL_DISABLED) if (aliens[i].flags & FL_DISABLED)
@ -1320,8 +1324,8 @@ static void game_doAliens()
} }
// Adjust the movement even whilst exploding // Adjust the movement even whilst exploding
if ((!(aliens[i].flags & FL_NOMOVE)) && if ((!(aliens[i].flags & FL_NOMOVE))
(!(aliens[i].flags & FL_DISABLED))) && (!(aliens[i].flags & FL_DISABLED)))
alien_move(&aliens[i]); alien_move(&aliens[i]);
if ((game.area != MISN_ELLESH) || (aliens[i].shield < 0)) if ((game.area != MISN_ELLESH) || (aliens[i].shield < 0))
@ -1360,8 +1364,9 @@ static void game_doPlayer()
if ((engine.keyState[KEY_ALTFIRE]) && (player.weaponType[1] != W_NONE)) if ((engine.keyState[KEY_ALTFIRE]) && (player.weaponType[1] != W_NONE))
{ {
if ((player.weaponType[1] != W_CHARGER) && if ((player.weaponType[1] != W_CHARGER)
(player.weaponType[1] != W_LASER) && (player.ammo[1] > 0)) && (player.weaponType[1] != W_LASER)
&& (player.ammo[1] > 0))
{ {
ship_fireBullet(&player, 1); ship_fireBullet(&player, 1);
} }
@ -1386,8 +1391,8 @@ static void game_doPlayer()
if (player.weaponType[1] == W_CHARGER) if (player.weaponType[1] == W_CHARGER)
{ {
if (engine.keyState[KEY_ALTFIRE] && if (engine.keyState[KEY_ALTFIRE]
((game.difficulty == DIFFICULTY_ORIGINAL) && ((game.difficulty == DIFFICULTY_ORIGINAL)
|| !(engine.keyState[KEY_FIRE]))) || !(engine.keyState[KEY_FIRE])))
{ {
if (!player_chargerFired) if (!player_chargerFired)
@ -1424,8 +1429,8 @@ static void game_doPlayer()
if ((engine.keyState[KEY_SWITCH])) if ((engine.keyState[KEY_SWITCH]))
{ {
if ((weapons[W_PLAYER_WEAPON].ammo[0] >= 3) && if ((weapons[W_PLAYER_WEAPON].ammo[0] >= 3)
(weapons[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput)) && (weapons[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput))
{ {
weapons[W_PLAYER_WEAPON].flags ^= WF_SPREAD; weapons[W_PLAYER_WEAPON].flags ^= WF_SPREAD;
@ -1470,9 +1475,9 @@ static void game_doPlayer()
if (engine.keyState[KEY_ESCAPE]) if (engine.keyState[KEY_ESCAPE])
{ {
if ((engine.done == ENGINE_RUNNING) && if ((engine.done == ENGINE_RUNNING)
(engine.gameSection == SECTION_GAME) && && (engine.gameSection == SECTION_GAME)
(mission.remainingObjectives1 == 0)) && (mission.remainingObjectives1 == 0))
{ {
audio_playSound(SFX_FLY, screen->w / 2, screen->h / 2); audio_playSound(SFX_FLY, screen->w / 2, screen->h / 2);
engine.done = ENGINE_SYSEXIT; engine.done = ENGINE_SYSEXIT;
@ -1575,8 +1580,8 @@ static void game_doPlayer()
LIMIT_ADD(player.hit, -1, 0, 100); LIMIT_ADD(player.hit, -1, 0, 100);
screen_blit(gfx_shipSprites[shapeToUse], (int)player.x, (int)player.y); screen_blit(gfx_shipSprites[shapeToUse], (int)player.x, (int)player.y);
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) && if ((player.maxShield > 1) && (player.shield <= engine.lowShield)
CHANCE(1. / 10)) && CHANCE(1. / 10))
explosion_add(player.x + RANDRANGE(-10, 10), explosion_add(player.x + RANDRANGE(-10, 10),
player.y + RANDRANGE(-10, 20), SP_SMOKE); player.y + RANDRANGE(-10, 20), SP_SMOKE);
} }
@ -1816,40 +1821,40 @@ static void game_doArrow(int i)
if (aliens[i].x + aliens[i].image[0]->w < 0) if (aliens[i].x + aliens[i].image[0]->w < 0)
{ {
if (aliens[i].y + aliens[i].image[0]->h < 0) if (aliens[i].y + aliens[i].image[0]->h < 0)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_NORTHWEST : SP_ARROW_NORTHWEST); SP_ARROW_FRIEND_NORTHWEST : SP_ARROW_NORTHWEST);
else if (aliens[i].y > screen->h) else if (aliens[i].y > screen->h)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_SOUTHWEST : SP_ARROW_SOUTHWEST); SP_ARROW_FRIEND_SOUTHWEST : SP_ARROW_SOUTHWEST);
else else
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_WEST : SP_ARROW_WEST); SP_ARROW_FRIEND_WEST : SP_ARROW_WEST);
} }
else if (aliens[i].x > screen->w) else if (aliens[i].x > screen->w)
{ {
if (aliens[i].y + aliens[i].image[0]->h < 0) if (aliens[i].y + aliens[i].image[0]->h < 0)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_NORTHEAST : SP_ARROW_NORTHEAST); SP_ARROW_FRIEND_NORTHEAST : SP_ARROW_NORTHEAST);
else if (aliens[i].y > screen->h) else if (aliens[i].y > screen->h)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_SOUTHEAST : SP_ARROW_SOUTHEAST); SP_ARROW_FRIEND_SOUTHEAST : SP_ARROW_SOUTHEAST);
else else
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_EAST : SP_ARROW_EAST); SP_ARROW_FRIEND_EAST : SP_ARROW_EAST);
} }
else if (aliens[i].y + aliens[i].image[0]->h < 0) else if (aliens[i].y + aliens[i].image[0]->h < 0)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_NORTH : SP_ARROW_NORTH); SP_ARROW_FRIEND_NORTH : SP_ARROW_NORTH);
else if (aliens[i].y > screen->h) else if (aliens[i].y > screen->h)
arrow = (((game.difficulty != DIFFICULTY_ORIGINAL) && arrow = (((game.difficulty != DIFFICULTY_ORIGINAL)
(aliens[i].flags & FL_FRIEND)) ? && (aliens[i].flags & FL_FRIEND)) ?
SP_ARROW_FRIEND_SOUTH : SP_ARROW_SOUTH); SP_ARROW_FRIEND_SOUTH : SP_ARROW_SOUTH);
if (arrow != -1) if (arrow != -1)
@ -2038,8 +2043,8 @@ static void game_doHud()
events_check(); events_check();
} }
if ((engine.timeMission) && (player.shield > 0) && if ((engine.timeMission) && (player.shield > 0)
((!engine.cheatTime) || (game.area == MISN_MARS))) && ((!engine.cheatTime) || (game.area == MISN_MARS)))
{ {
if (SDL_GetTicks() >= engine.counter) if (SDL_GetTicks() >= engine.counter)
{ {
@ -2113,8 +2118,8 @@ static void game_doHud()
// Do the target's remaining shield (if required) // Do the target's remaining shield (if required)
if (game.area != MISN_DORIM) if (game.area != MISN_DORIM)
{ {
if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0) && if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0)
(engine.targetIndex > engine.maxAliens)) && (engine.targetIndex > engine.maxAliens))
{ {
if (game.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
{ {
@ -2604,8 +2609,8 @@ int game_mainLoop()
for (int i = 0 ; i < 3 ; i++) for (int i = 0 ; i < 3 ; i++)
{ {
if ((mission.primaryType[i] == M_DESTROY_TARGET_TYPE) && if ((mission.primaryType[i] == M_DESTROY_TARGET_TYPE)
(mission.target1[i] == CD_ANY)) && (mission.target1[i] == CD_ANY))
allowableAliens = mission.targetValue1[i]; allowableAliens = mission.targetValue1[i];
if (mission.primaryType[i] == M_DESTROY_ALL_TARGETS) if (mission.primaryType[i] == M_DESTROY_ALL_TARGETS)
@ -2650,8 +2655,8 @@ int game_mainLoop()
engine.gameSection = SECTION_INTERMISSION; engine.gameSection = SECTION_INTERMISSION;
if (player.shield > 0) if (player.shield > 0)
{ {
if ((SDL_GetTicks() >= engine.missionCompleteTimer) && if ((SDL_GetTicks() >= engine.missionCompleteTimer)
((game.difficulty == DIFFICULTY_ORIGINAL) && ((game.difficulty == DIFFICULTY_ORIGINAL)
|| (game.difficulty == DIFFICULTY_NIGHTMARE) || (game.difficulty == DIFFICULTY_NIGHTMARE)
|| (game.area == MISN_INTERCEPTION) || (game.area == MISN_INTERCEPTION)
|| (game.area == MISN_ELLESH) || (game.area == MISN_ELLESH)
@ -2663,20 +2668,20 @@ int game_mainLoop()
if ((!mission_checkFailed()) && (game.area != MISN_VENUS)) if ((!mission_checkFailed()) && (game.area != MISN_VENUS))
{ {
player_leaveSector(); player_leaveSector();
if ((engine.done == ENGINE_SYSEXIT) && if ((engine.done == ENGINE_SYSEXIT)
(game.area != MISN_DORIM) && && (game.area != MISN_DORIM)
(game.area != MISN_SIVEDI)) && (game.area != MISN_SIVEDI))
{ {
if ((aliens[ALIEN_PHOEBE].shield > 0) && if ((aliens[ALIEN_PHOEBE].shield > 0)
(game.area != MISN_EARTH)) && (game.area != MISN_EARTH))
{ {
aliens[ALIEN_PHOEBE].x = player.x - 40; aliens[ALIEN_PHOEBE].x = player.x - 40;
aliens[ALIEN_PHOEBE].y = player.y - 35; aliens[ALIEN_PHOEBE].y = player.y - 35;
aliens[ALIEN_PHOEBE].face = 0; aliens[ALIEN_PHOEBE].face = 0;
} }
if ((aliens[ALIEN_URSULA].shield > 0) && if ((aliens[ALIEN_URSULA].shield > 0)
(game.area != MISN_EARTH)) && (game.area != MISN_EARTH))
{ {
aliens[ALIEN_URSULA].x = player.x - 40; aliens[ALIEN_URSULA].x = player.x - 40;
aliens[ALIEN_URSULA].y = player.y + 45; aliens[ALIEN_URSULA].y = player.y + 45;
@ -2692,8 +2697,8 @@ int game_mainLoop()
} }
} }
} }
else if ((game.area == MISN_VENUS) && else if ((game.area == MISN_VENUS)
(engine.musicVolume > 0)) && (engine.musicVolume > 0))
{ {
engine.keyState[KEY_UP] = 0; engine.keyState[KEY_UP] = 0;
engine.keyState[KEY_DOWN] = 0; engine.keyState[KEY_DOWN] = 0;
@ -2806,8 +2811,8 @@ int game_mainLoop()
engine.missionCompleteTimer = SDL_GetTicks() + 7000; engine.missionCompleteTimer = SDL_GetTicks() + 7000;
// specific to Boss 1 // specific to Boss 1
if ((game.area == MISN_MOEBO) && if ((game.area == MISN_MOEBO)
(aliens[ALIEN_BOSS].flags & FL_ESCAPED)) && (aliens[ALIEN_BOSS].flags & FL_ESCAPED))
{ {
audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x, aliens[ALIEN_BOSS].y); audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x, aliens[ALIEN_BOSS].y);
screen_clear(white); screen_clear(white);

View File

@ -646,9 +646,11 @@ void gfx_createTextObject(int index, const char *inString, int x, int y, int fon
gfx_textSprites[index].life = 0; gfx_textSprites[index].life = 0;
/* Shortcut: if we already rendered the same string in the same color, don't render it again. */ /* Shortcut: if we already rendered the same string in the same color, don't render it again. */
if (gfx_textSprites[index].text && gfx_textSprites[index].image && // TODO: Double-check this, I think it's trying to test if gfx_textSprites[index].image is NULL.
gfx_textSprites[index].fontColor == fontColor && // Also, check what `text` will be when "empty".
!strcmp(gfx_textSprites[index].text, inString)) if (gfx_textSprites[index].text && gfx_textSprites[index].image
&& (gfx_textSprites[index].fontColor == fontColor)
&& (strcmp(gfx_textSprites[index].text, inString) == 0))
{ {
gfx_textSprites[index].x = x; gfx_textSprites[index].x = x;
gfx_textSprites[index].y = y; gfx_textSprites[index].y = y;

View File

@ -693,9 +693,9 @@ static int intermission_showSystem(float pos, int selectable)
r.y -= (intermission_planets[planet].image->h / 2); r.y -= (intermission_planets[planet].image->h / 2);
screen_blit(intermission_planets[planet].image, r.x, r.y); screen_blit(intermission_planets[planet].image, r.x, r.y);
if (selectable && if (selectable
game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, && game_collision(engine.cursor_x + 13, engine.cursor_y + 13,
r.x, r.y, intermission_planets[planet].image->w, 6, 6, r.x, r.y, intermission_planets[planet].image->w,
intermission_planets[planet].image->h)) intermission_planets[planet].image->h))
{ {
if (!printedName) if (!printedName)
@ -1729,8 +1729,8 @@ int intermission()
x = screen->w / 16; x = screen->w / 16;
y = screen->h - 80; y = screen->h - 80;
w = screen->w - 2 * x - 32; w = screen->w - 2 * x - 32;
if ((game.stationedPlanet == game.destinationPlanet) && if ((game.stationedPlanet == game.destinationPlanet)
(!intermission_planets[game.stationedPlanet].missionCompleted)) && (!intermission_planets[game.stationedPlanet].missionCompleted))
screen_blit(gfx_sprites[SP_START_MISSION], x, y); screen_blit(gfx_sprites[SP_START_MISSION], x, y);
else if (game.stationedPlanet != game.destinationPlanet) else if (game.stationedPlanet != game.destinationPlanet)
screen_blit(gfx_sprites[SP_GOTO], x, y); screen_blit(gfx_sprites[SP_GOTO], x, y);

View File

@ -565,8 +565,8 @@ static void mission_killAllEnemies()
{ {
for (int i = 0 ; i < ALIEN_MAX ; i++) for (int i = 0 ; i < ALIEN_MAX ; i++)
{ {
if ((aliens[i].flags & FL_WEAPCO) && (aliens[i].active) && if ((aliens[i].flags & FL_WEAPCO) && (aliens[i].active)
(aliens[i].shield > 0)) && (aliens[i].shield > 0))
aliens[i].shield = 0; aliens[i].shield = 0;
} }
} }
@ -596,13 +596,13 @@ void mission_checkTimer()
} }
// specific to Spirit Boss // specific to Spirit Boss
if ((game.area == MISN_MOEBO) && if ((game.area == MISN_MOEBO)
(mission.completed1[0] < OB_INCOMPLETE)) && (mission.completed1[0] < OB_INCOMPLETE))
engine.timeMission = 1; engine.timeMission = 1;
// specific to the Asteroid belt // specific to the Asteroid belt
if ((game.area == MISN_MARS) && if ((game.area == MISN_MARS)
(mission.completed1[0] < OB_INCOMPLETE)) && (mission.completed1[0] < OB_INCOMPLETE))
{ {
mission.completed1[0] = OB_COMPLETED; mission.completed1[0] = OB_COMPLETED;
mission_killAllEnemies(); mission_killAllEnemies();
@ -616,8 +616,8 @@ static void mission_evaluate(int type, int id, int *completed, int *targetValue,
char message[STRMAX_SHORT]; char message[STRMAX_SHORT];
char fmt[STRMAX_SHORT]; char fmt[STRMAX_SHORT];
if ((*targetValue <= 0) && (type != M_PROTECT_TARGET) && if ((*targetValue <= 0) && (type != M_PROTECT_TARGET)
(type != M_PROTECT_PICKUP)) && (type != M_PROTECT_PICKUP))
{ {
*completed = OB_JUST_COMPLETED; *completed = OB_JUST_COMPLETED;
mission_checkTimer(); mission_checkTimer();
@ -937,7 +937,9 @@ int mission_checkCompleted()
{ {
if (mission.completed1[i] == OB_INCOMPLETE) if (mission.completed1[i] == OB_INCOMPLETE)
{ {
if ((mission.primaryType[i] == M_DESTROY_ALL_TARGETS) && (engine.allAliensDead) && (mission.remainingObjectives1 + mission.remainingObjectives2 == 1)) if ((mission.primaryType[i] == M_DESTROY_ALL_TARGETS)
&& (engine.allAliensDead)
&& (mission.remainingObjectives1 + mission.remainingObjectives2 == 1))
{ {
mission.completed1[i] = OB_JUST_COMPLETED; mission.completed1[i] = OB_JUST_COMPLETED;
mission_checkTimer(); mission_checkTimer();
@ -949,7 +951,9 @@ int mission_checkCompleted()
{ {
if (mission.completed2[i] == OB_INCOMPLETE) if (mission.completed2[i] == OB_INCOMPLETE)
{ {
if ((mission.secondaryType[i] == M_DESTROY_ALL_TARGETS) && (engine.allAliensDead) && (mission.remainingObjectives1 + mission.remainingObjectives2 == 1)) if ((mission.secondaryType[i] == M_DESTROY_ALL_TARGETS)
&& (engine.allAliensDead)
&& (mission.remainingObjectives1 + mission.remainingObjectives2 == 1))
{ {
mission.completed2[i] = OB_JUST_COMPLETED; mission.completed2[i] = OB_JUST_COMPLETED;
mission_checkTimer(); mission_checkTimer();
@ -1017,8 +1021,8 @@ int mission_checkCompleted()
mission.completed2[i] = OB_COMPLETED; mission.completed2[i] = OB_COMPLETED;
// do some area specific things // do some area specific things
if ((game.area == MISN_DORIM) && if ((game.area == MISN_DORIM)
(mission.remainingObjectives1 == 0)) && (mission.remainingObjectives1 == 0))
{ {
mission_killAllEnemies(); mission_killAllEnemies();
engine.addAliens = -1; engine.addAliens = -1;

View File

@ -99,8 +99,8 @@ void player_damage(int amount, int delay)
player_resetDamageDelay = 0; player_resetDamageDelay = 0;
if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0) && if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0)
((!player.hit) && ((!player.hit)
|| (game.difficulty == DIFFICULTY_ORIGINAL) || (game.difficulty == DIFFICULTY_ORIGINAL)
|| ((player.shield != engine.lowShield) || ((player.shield != engine.lowShield)
&& (player.shield != 1)))) && (player.shield != 1))))
@ -115,8 +115,8 @@ void player_damage(int amount, int delay)
audio_playSound(SFX_HIT, player.x, player.y); audio_playSound(SFX_HIT, player.x, player.y);
// Damage tiers (not in Classic mode) // Damage tiers (not in Classic mode)
if ((oldshield > engine.lowShield) && if ((oldshield > engine.lowShield)
(player.shield <= engine.lowShield)) && (player.shield <= engine.lowShield))
{ {
info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED); info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED);
if (game.difficulty != DIFFICULTY_ORIGINAL) if (game.difficulty != DIFFICULTY_ORIGINAL)
@ -460,8 +460,8 @@ void player_getInput()
screen_addBuffer(0, 0, screen->w, screen->h); screen_addBuffer(0, 0, screen->w, screen->h);
} }
if (engine.autoPause && if (engine.autoPause
(engine.event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)) && (engine.event.window.event == SDL_WINDOWEVENT_FOCUS_LOST))
engine.paused = 1; engine.paused = 1;
break; break;
} }

View File

@ -68,8 +68,8 @@ void ship_fireBullet(Object *ship, int weaponIndex)
return; return;
// Remove some ammo from the player // Remove some ammo from the player
if ((ship == &player) && (player.weaponType[weaponIndex] != W_LASER) && if ((ship == &player) && (player.weaponType[weaponIndex] != W_LASER)
(player.ammo[weaponIndex] > 0) && (!engine.cheatAmmo)) && (player.ammo[weaponIndex] > 0) && (!engine.cheatAmmo))
player.ammo[weaponIndex]--; player.ammo[weaponIndex]--;
switch(theWeapon->id) switch(theWeapon->id)
@ -130,8 +130,8 @@ void ship_fireBullet(Object *ship, int weaponIndex)
// Reset the weapon reload time. Double it if it is not friendly or // Reset the weapon reload time. Double it if it is not friendly or
// a boss or Kline // a boss or Kline
ship->reload[weaponIndex] = theWeapon->reload[0]; ship->reload[weaponIndex] = theWeapon->reload[0];
if ((ship->flags & FL_WEAPCO) && (ship != &aliens[ALIEN_BOSS]) && if ((ship->flags & FL_WEAPCO) && (ship != &aliens[ALIEN_BOSS])
(ship != &aliens[ALIEN_KLINE]) && (theWeapon->id != W_LASER)) && (ship != &aliens[ALIEN_KLINE]) && (theWeapon->id != W_LASER))
ship->reload[weaponIndex] *= 2; ship->reload[weaponIndex] *= 2;
if ((ship == &player) && (weaponIndex == 0)) if ((ship == &player) && (weaponIndex == 0))
@ -173,8 +173,9 @@ void ship_fireRay(Object *ship)
if (player.shield > 0) if (player.shield > 0)
{ {
if (game_collision(player.x, player.y, player.image[0]->w, if (game_collision(player.x, player.y, player.image[0]->w,
player.image[0]->h, ray.x, ray.y, ray.w, ray.h) && player.image[0]->h, ray.x, ray.y, ray.w, ray.h)
(!engine.cheatShield) && (engine.missionCompleteTimer == 0)) && (!engine.cheatShield)
&& (engine.missionCompleteTimer == 0))
{ {
player_damage(1, RAY_DAMAGE_DELAY); player_damage(1, RAY_DAMAGE_DELAY);
explosion_add(player.x, player.y, SP_SMALL_EXPLOSION); explosion_add(player.x, player.y, SP_SMALL_EXPLOSION);
@ -187,8 +188,8 @@ void ship_fireRay(Object *ship)
if (aliens[i].flags & FL_IMMORTAL) if (aliens[i].flags & FL_IMMORTAL)
continue; continue;
if ((aliens[i].shield > 0) && (ship != &aliens[i]) && if ((aliens[i].shield > 0) && (ship != &aliens[i])
(ship->classDef != aliens[i].classDef)) && (ship->classDef != aliens[i].classDef))
{ {
if (game_collision(aliens[i].x, aliens[i].y, aliens[i].image[0]->w, if (game_collision(aliens[i].x, aliens[i].y, aliens[i].image[0]->w,
aliens[i].image[0]->h, ray.x, ray.y, ray.w, ray.h)) aliens[i].image[0]->h, ray.x, ray.y, ray.w, ray.h))

View File

@ -97,8 +97,9 @@ static void drawSecondaryWeaponSurface()
} }
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SECONDARY]); gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SECONDARY]);
if ((player.weaponType[1] != W_LASER) && if ((player.weaponType[1] != W_LASER)
(player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_NONE)) && (player.weaponType[1] != W_CHARGER)
&& (player.weaponType[1] != W_NONE))
{ {
/// Retain "%d" as-is. It is replaced with the rocket capacity of the Firefly. /// Retain "%d" as-is. It is replaced with the rocket capacity of the Firefly.
snprintf(description, STRMAX_SHORT, _("Capacity : %d"), game.maxRocketAmmo); snprintf(description, STRMAX_SHORT, _("Capacity : %d"), game.maxRocketAmmo);
@ -656,20 +657,20 @@ static void buy(int i)
shopSelectedItem = SHOP_ERROR_AMMO_LIMIT; shopSelectedItem = SHOP_ERROR_AMMO_LIMIT;
return; return;
} }
if ((player.weaponType[1] == W_HOMING_MISSILE) && if ((player.weaponType[1] == W_HOMING_MISSILE)
(player.ammo[1] >= MAX_HOMING)) && (player.ammo[1] >= MAX_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;
} }
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) && if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES)
(player.ammo[1] >= MAX_DOUBLE_HOMING)) && (player.ammo[1] >= MAX_DOUBLE_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;
} }
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) && if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES)
(player.ammo[1] >= MAX_MICRO_HOMING)) && (player.ammo[1] >= MAX_MICRO_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;
@ -729,20 +730,20 @@ static void buy(int i)
shopSelectedItem = SHOP_ERROR_IS_NOT_ROCKETS; shopSelectedItem = SHOP_ERROR_IS_NOT_ROCKETS;
return; return;
} }
if ((player.weaponType[1] == W_HOMING_MISSILE) && if ((player.weaponType[1] == W_HOMING_MISSILE)
(game.maxRocketAmmo >= MAX_HOMING)) && (game.maxRocketAmmo >= MAX_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;
} }
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) && if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES)
(game.maxRocketAmmo >= MAX_DOUBLE_HOMING)) && (game.maxRocketAmmo >= MAX_DOUBLE_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;
} }
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) && if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES)
(game.maxRocketAmmo >= MAX_MICRO_HOMING)) && (game.maxRocketAmmo >= MAX_MICRO_HOMING))
{ {
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY; shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
return; return;