diff --git a/src/Starfighter.cpp b/src/Starfighter.cpp index a125f62..1f01c7d 100644 --- a/src/Starfighter.cpp +++ b/src/Starfighter.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . int main(int argc, char **argv) { - bool cheatAttempt; + int cheatAttempt; int cheatCount; int section; @@ -52,7 +52,7 @@ int main(int argc, char **argv) engine_init(); // Must do this first! - cheatAttempt = false; + cheatAttempt = 0; cheatCount = 0; if (argc > 1) @@ -74,16 +74,16 @@ int main(int argc, char **argv) for (int i = 1 ; i < argc ; i++) { if (strcmp(argv[i], "-cheat") == 0) - cheatAttempt = true; + cheatAttempt = 1; if (strcmp(argv[i], "-noaudio") == 0) { printf("No Audio\n"); - engine.useAudio = false; + engine.useAudio = 0; } if (strcmp(argv[i], "-mono") == 0) { printf("Mono sound output\n"); - engine.useAudio = true; + engine.useAudio = 1; } if ((strcmp(argv[i], "humans") == 0) && (cheatCount == 0)) cheatCount = 1; @@ -95,7 +95,7 @@ int main(int argc, char **argv) (strcmp(argv[i], "humansdoitbetter") == 0)) { printf("Humans do it better! Cheats enabled.\n"); - engine.cheat = true; + engine.cheat = 1; } } @@ -140,7 +140,7 @@ int main(int argc, char **argv) game.difficulty = DIFFICULTY_NORMAL; game_init(); - while (true) + while (1) { switch (section) { diff --git a/src/alien.cpp b/src/alien.cpp index bec1cb2..279f1ff 100644 --- a/src/alien.cpp +++ b/src/alien.cpp @@ -744,7 +744,7 @@ void aliens_init() for (int i = 0 ; i < ALIEN_MAX ; i++) { - aliens[i].active = false; + aliens[i].active = 0; aliens[i].shield = -1; aliens[i].flags = 0; } @@ -908,7 +908,7 @@ void aliens_init() aliens[i].owner = &aliens[i]; aliens[i].target = &aliens[i]; aliens[i].face = rand() % 2; - aliens[i].active = true; + aliens[i].active = 1; /* we make 1000 attempts to place this enemy since it is required. If after @@ -916,7 +916,7 @@ void aliens_init() simply isn't going to happen and we will just exit the game. The chances of this happening are very very low! */ - while (true) + while (1) { placeAttempt++; @@ -939,7 +939,7 @@ void aliens_init() if (aliens[i].classDef == CD_CLOAKFIGHTER) { - aliens[i].active = false; + aliens[i].active = 0; aliens[i].maxShield = aliens[i].shield = 400; aliens[i].flags &= ~FL_RUNSAWAY; aliens[i].speed = 3; @@ -947,12 +947,12 @@ void aliens_init() if ((aliens[i].classDef == CD_MOBILE_RAY) && (i >= ALIEN_BOSS_PART3)) { - aliens[i].active = false; + aliens[i].active = 0; } if (aliens[i].classDef == CD_FIREFLY) { - aliens[i].active = false; + aliens[i].active = 0; } if (aliens[i].classDef == CD_BARRIER) @@ -1042,7 +1042,7 @@ void aliens_init() } } -bool alien_add() +int alien_add() { int index = alien_getFreeIndex(); @@ -1175,7 +1175,7 @@ bool alien_add() delete[] alienArray; aliens[index] = alien_defs[randEnemy]; - aliens[index].active = true; + aliens[index].active = 1; aliens[index].face = rand() % 2; aliens[index].owner = &aliens[index]; // Most enemies will own themselves aliens[index].target = &aliens[index]; @@ -1191,9 +1191,9 @@ bool alien_add() { if (alien_place(&aliens[index])) break; - aliens[index].active = false; + aliens[index].active = 0; - return false; + return 0; } if (aliens[index].classDef == CD_CARGOSHIP) @@ -1213,7 +1213,7 @@ bool alien_add() if (game.area == MISN_ELLESH) aliens[index].flags |= FL_HASMINIMUMSPEED; - return true; + return 1; } void alien_addDrone(object *hostAlien) @@ -1224,7 +1224,7 @@ void alien_addDrone(object *hostAlien) return; aliens[index] = alien_defs[CD_DRONE]; - aliens[index].active = true; + aliens[index].active = 1; aliens[index].face = rand() % 2; aliens[index].owner = &aliens[index]; // Most enemies will own themselves aliens[index].target = &aliens[index]; @@ -1277,7 +1277,7 @@ void alien_addSmallAsteroid(object *hostAlien) aliens[index].x = hostAlien->x; aliens[index].y = hostAlien->y; - aliens[index].active = true; + aliens[index].active = 1; } void alien_addFriendly(int type) @@ -1289,7 +1289,7 @@ void alien_addFriendly(int type) aliens[type].owner = &aliens[type]; aliens[type].target = &aliens[type]; - aliens[type].active = true; + aliens[type].active = 1; aliens[type].x = RANDRANGE((screen->w / 2) - 150, (screen->w / 2) + 150); aliens[type].y = RANDRANGE((screen->h / 2) - 150, (screen->h / 2) + 150); @@ -1304,7 +1304,7 @@ void alien_addFriendly(int type) aliens[type].flags |= FL_IMMORTAL; } -bool alien_place(object *alien) +int alien_place(object *alien) { if (rand() % 2 == 0) alien->x = RANDRANGE(screen->w, screen->w * 2); @@ -1327,11 +1327,11 @@ bool alien_place(object *alien) if ((aliens[i].owner != alien) && (aliens[i].shield > 0)) { if (ship_collision(alien, &aliens[i])) - return false; + return 0; } } - return true; + return 1; } void alien_setAI(object *alien) @@ -1640,12 +1640,12 @@ int alien_enemiesInFront(object *alien) void alien_move(object *alien) { - bool checkCollisions; + int checkCollisions; if ((alien->flags & FL_LEAVESECTOR) || (alien->shield < 1)) - checkCollisions = false; + checkCollisions = 0; else - checkCollisions = true; + checkCollisions = 1; if (alien->owner == alien) { @@ -1835,7 +1835,7 @@ void alien_destroy(object *alien, object *attacker) } } -void alien_hurt(object *alien, object *attacker, int damage, bool ion) +void alien_hurt(object *alien, object *attacker, int damage, int ion) { double run_chance; diff --git a/src/alien.h b/src/alien.h index f9da27c..b93f7d0 100644 --- a/src/alien.h +++ b/src/alien.h @@ -25,11 +25,11 @@ extern object aliens[ALIEN_MAX]; void alien_defs_init(); void aliens_init(); -bool alien_add(); +int alien_add(); void alien_addDrone(object *hostAlien); void alien_addSmallAsteroid(object *hostAlien); void alien_addFriendly(int type); -bool alien_place(object *alien); +int alien_place(object *alien); void alien_setAI(object *alien); void alien_setKlineAttackMethod(object *alien); void alien_setKlineAI(object *alien); @@ -38,6 +38,6 @@ int alien_checkTarget(object *alien); int alien_enemiesInFront(object *alien); void alien_move(object *alien); void alien_destroy(object *alien, object *attacker); -void alien_hurt(object *alien, object *attacker, int damage, bool ion); +void alien_hurt(object *alien, object *attacker, int damage, int ion); #endif diff --git a/src/bullet.cpp b/src/bullet.cpp index 21847c7..6e5d9d9 100644 --- a/src/bullet.cpp +++ b/src/bullet.cpp @@ -31,7 +31,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy) game.shots++; bullet->next = NULL; - bullet->active = true; + bullet->active = 1; bullet->x = attacker->x + (attacker->image[0]->w / 2) - (theWeapon->image[0]->w * attacker->face); bullet->y = attacker->y + y; @@ -182,7 +182,7 @@ object *bullet_getTarget(object *bullet) return &aliens[i]; } -bool bullet_collision(object *bullet, object *ship) +int bullet_collision(object *bullet, object *ship) { float x0 = bullet->x; float y0 = bullet->y; diff --git a/src/bullet.h b/src/bullet.h index 195eae0..2afdbc0 100644 --- a/src/bullet.h +++ b/src/bullet.h @@ -22,6 +22,6 @@ along with this program. If not, see . void bullet_add(object *theWeapon, object *attacker, int y, int dy); object *bullet_getTarget(object *bullet); -bool bullet_collision(object *bullet, object *ship); +int bullet_collision(object *bullet, object *ship); #endif diff --git a/src/cargo.cpp b/src/cargo.cpp index cec8a67..ad10d80 100644 --- a/src/cargo.cpp +++ b/src/cargo.cpp @@ -25,7 +25,7 @@ void cargo_init() { for (int i = 0 ; i < MAX_CARGO ; i++) { - cargo[i].active = false; + cargo[i].active = 0; cargo[i].owner = NULL; } } @@ -51,7 +51,7 @@ object *cargo_add(object *owner, int cargoType) if (index == -1) return NULL; - cargo[index].active = true; + cargo[index].active = 1; cargo[index].owner = owner; cargo[index].x = owner->x; cargo[index].y = owner->y; @@ -73,11 +73,11 @@ void cargo_becomeCollectable(int i) } else { - aliens[ALIEN_PHOEBE].active = true; + aliens[ALIEN_PHOEBE].active = 1; aliens[ALIEN_PHOEBE].x = cargo[i].x; aliens[ALIEN_PHOEBE].y = cargo[i].y; setRadioMessage(FS_PHOEBE, "Thanks! Watch out, WEAPCO! Phoebe's loose and she's ANGRY!", 1); } - cargo[i].active = false; + cargo[i].active = 0; } diff --git a/src/collectable.cpp b/src/collectable.cpp index 6be040f..c4dc2d5 100644 --- a/src/collectable.cpp +++ b/src/collectable.cpp @@ -134,7 +134,7 @@ void collectable_add(float x, float y, int type, int value, int life) collectables *collectable = new collectables; collectable->next = NULL; - collectable->active = true; + collectable->active = 1; collectable->x = x; collectable->y = y; @@ -206,7 +206,7 @@ void collectable_add(float x, float y, int type, int value, int life) engine.collectableTail = collectable; } -bool collectable_collision(collectables *collectable, object *ship) +int collectable_collision(collectables *collectable, object *ship) { float x0 = collectable->x; float y0 = collectable->y; diff --git a/src/collectable.h b/src/collectable.h index e2451d8..5dc0f32 100644 --- a/src/collectable.h +++ b/src/collectable.h @@ -21,7 +21,7 @@ along with this program. If not, see . #define COLLECTABLE_H void collectable_add(float x, float y, int type, int value, int life); -bool collectable_collision(collectables *collectable, object *ship); +int collectable_collision(collectables *collectable, object *ship); void collectable_explode(collectables *collectable); #endif diff --git a/src/cutscene.cpp b/src/cutscene.cpp index c128c93..e9d23e0 100644 --- a/src/cutscene.cpp +++ b/src/cutscene.cpp @@ -54,7 +54,7 @@ void cutscene_init(int scene) // particular reason for choosing this alien def. aliens[i] = alien_defs[0]; aliens[i].face = 0; - aliens[i].active = false; + aliens[i].active = 0; } for (int i = 0 ; i < MAX_EVENTS ; i++) @@ -74,7 +74,7 @@ void cutscene_init(int scene) aliens[0].x = screen->w * 3 / 5; aliens[0].y = screen->h / 2; aliens[0].dx = 3.1; - aliens[0].active = true; + aliens[0].active = 1; for (int i = 1 ; i < 7 ; i++) { @@ -82,7 +82,7 @@ void cutscene_init(int scene) aliens[i].x = RANDRANGE(0, screen->w / 8); aliens[i].y = RANDRANGE(50, screen->h - 50); aliens[i].dx = 3; - aliens[i].active = true; + aliens[i].active = 1; } messages[0].face = -1; @@ -108,7 +108,7 @@ void cutscene_init(int scene) aliens[0].x = screen->w / 2; aliens[0].y = screen->h / 2; aliens[0].dx = 0.5; - aliens[0].active = true; + aliens[0].active = 1; for (int i = 1 ; i < 15 ; i++) { @@ -116,7 +116,7 @@ void cutscene_init(int scene) aliens[i].x = RANDRANGE(0, screen->w); aliens[i].y = RANDRANGE(50, screen->h - 50); aliens[i].dx = RANDRANGE(1, 3); - aliens[i].active = true; + aliens[i].active = 1; } messages[0].face = -1; @@ -145,13 +145,13 @@ void cutscene_init(int scene) aliens[0].x = screen->w / 4; aliens[0].y = screen->h / 2; aliens[0].dx = 1.5; - aliens[0].active = true; + aliens[0].active = 1; aliens[1].image[0] = gfx_shipSprites[SS_SID]; aliens[1].x = screen->w / 4 - 50; aliens[1].y = screen->h / 2 - 40; aliens[1].dx = 1.5; - aliens[1].active = true; + aliens[1].active = 1; messages[0].face = FS_SID; strcpy(messages[0].message, "We're nearly ready to make the jump to Eyananth."); @@ -179,19 +179,19 @@ void cutscene_init(int scene) aliens[0].x = screen->w * 3 / 8; aliens[0].y = screen->h / 2; aliens[0].dx = 0.5; - aliens[0].active = true; + aliens[0].active = 1; aliens[1].image[0] = gfx_shipSprites[SS_SID]; aliens[1].x = screen->w * 3 / 8 - 50; aliens[1].y = screen->h / 2 - 40; aliens[1].dx = 0.5; - aliens[1].active = true; + aliens[1].active = 1; aliens[2].image[0] = gfx_shipSprites[SS_FRIEND]; aliens[2].x = screen->w * 3 / 8 - 50; aliens[2].y = screen->h / 2 + 40; aliens[2].dx = 0.5; - aliens[2].active = true; + aliens[2].active = 1; messages[0].face = FS_PHOEBE; strcpy(messages[0].message, "Nice head gear! You shop at the same place as me, huh?"); @@ -225,19 +225,19 @@ void cutscene_init(int scene) aliens[0].x = screen->w / 4; aliens[0].y = screen->h / 2; aliens[0].dx = 1.5; - aliens[0].active = true; + aliens[0].active = 1; aliens[1].image[0] = gfx_shipSprites[SS_SID]; aliens[1].x = screen->w / 4 - 50; aliens[1].y = screen->h / 2 - 40; aliens[1].dx = 1.5; - aliens[1].active = true; + aliens[1].active = 1; aliens[2].image[0] = gfx_shipSprites[SS_FRIEND]; aliens[2].x = screen->w / 4 - 50; aliens[2].y = screen->h / 2 + 40; aliens[2].dx = 1.5; - aliens[2].active = true; + aliens[2].active = 1; messages[0].face = FS_SID; strcpy(messages[0].message, "What happened back there, Chris? The video feed was jammed."); @@ -277,19 +277,19 @@ void cutscene_init(int scene) aliens[0].x = screen->w * 3 / 8; aliens[0].y = screen->h / 2; aliens[0].dx = 0.5; - aliens[0].active = true; + aliens[0].active = 1; aliens[1].image[0] = gfx_shipSprites[SS_SID]; aliens[1].x = screen->w * 3 / 8 - 50; aliens[1].y = screen->h / 2 - 40; aliens[1].dx = 0.5; - aliens[1].active = true; + aliens[1].active = 1; aliens[2].image[0] = gfx_shipSprites[SS_FRIEND]; aliens[2].x = screen->w * 3 / 8 - 50; aliens[2].y = screen->h / 2 + 40; aliens[2].dx = 0.5; - aliens[2].active = true; + aliens[2].active = 1; messages[0].face = FS_PHOEBE; strcpy(messages[0].message, "Will she be okay?"); @@ -317,25 +317,25 @@ void cutscene_init(int scene) aliens[0].x = screen->w / 4; aliens[0].y = screen->h / 2; aliens[0].dx = 1.5; - aliens[0].active = true; + aliens[0].active = 1; aliens[1].image[0] = gfx_shipSprites[SS_SID]; aliens[1].x = screen->w / 4 - 50; aliens[1].y = screen->h / 2 - 40; aliens[1].dx = 1.5; - aliens[1].active = true; + aliens[1].active = 1; aliens[2].image[0] = gfx_shipSprites[SS_FRIEND]; aliens[2].x = screen->w / 4 - 50; aliens[2].y = screen->h / 2 + 40; aliens[2].dx = 1.5; - aliens[2].active = true; + aliens[2].active = 1; aliens[3].image[0] = gfx_shipSprites[SS_FRIEND]; aliens[3].x = screen->w / 4 - 90; aliens[3].y = screen->h / 2; aliens[3].dx = 1.5; - aliens[3].active = true; + aliens[3].active = 1; messages[0].face = FS_CHRIS; strcpy(messages[0].message, "Sorry folks, we just lost our bargaining chip."); @@ -365,7 +365,7 @@ void cutscene_init(int scene) aliens[i].engineY = (aliens[i].image[0]->h / 2); } - bool showMessage = false; + int showMessage = 0; int currentMessage = -1; int timer = 60 * 4; @@ -375,7 +375,7 @@ void cutscene_init(int scene) flushInput(); - while (true) + while (1) { renderer_update(); screen_unBuffer(); diff --git a/src/engine.cpp b/src/engine.cpp index d7cbc26..7253445 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -29,7 +29,7 @@ Engine engine; void engine_init() { engine.musicVolume = 100; - engine.useAudio = true; + engine.useAudio = 1; engine.maxAliens = 9; @@ -66,13 +66,13 @@ void engine_init() engine.counter = 0; engine.seconds = 0; engine.minutes = 0; - engine.paused = false; + engine.paused = 0; engine.gameSection = SECTION_TITLE; - engine.cheat = false; - engine.cheatShield = false; - engine.cheatAmmo = false; - engine.cheatCash = false; + engine.cheat = 0; + engine.cheatShield = 0; + engine.cheatAmmo = 0; + engine.cheatCash = 0; } /* @@ -237,7 +237,7 @@ void engine_setMode() { printf("Warning: Couldn't set 44100 Hz 16-bit stereo audio - Reason:\n%s\n", Mix_GetError()); printf("Sound and Music will be disabled\n"); - engine.useAudio = false; + engine.useAudio = 0; } } diff --git a/src/engine.h b/src/engine.h index 5dc1b6d..30fc8b7 100644 --- a/src/engine.h +++ b/src/engine.h @@ -80,25 +80,25 @@ typedef struct Engine_ { int allAliensDead; int addAliens; - bool paused; + int paused; int gameSection; - bool useAudio; - bool useSound; - bool useMusic; - bool fullScreen; - bool autoPause; + int useAudio; + int useSound; + int useMusic; + int fullScreen; + int autoPause; char configDirectory[1024]; char keyState[KEY_LAST]; - bool cheat; // overall cheat - bool cheatShield; - bool cheatCash; - bool cheatAmmo; - bool cheatTime; - bool cheatCredits; + int cheat; // overall cheat + int cheatShield; + int cheatCash; + int cheatAmmo; + int cheatTime; + int cheatCredits; } Engine; diff --git a/src/event.cpp b/src/event.cpp index 035cc96..940c181 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -349,7 +349,7 @@ void events_check() } else { - aliens[events[i].entity].active = true; + aliens[events[i].entity].active = 1; aliens[events[i].entity].x = ((int)player.x + RANDRANGE(400, 800)); aliens[events[i].entity].y = ((int)player.y + diff --git a/src/explosion.cpp b/src/explosion.cpp index 07b66ca..847f307 100644 --- a/src/explosion.cpp +++ b/src/explosion.cpp @@ -30,7 +30,7 @@ void explosion_add(float x, float y, int type) object *explosion = new object; explosion->next = NULL; - explosion->active = true; + explosion->active = 1; explosion->x = x; explosion->y = y; explosion->thinktime = 28; diff --git a/src/game.cpp b/src/game.cpp index d22194f..21a05c3 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -75,8 +75,8 @@ void game_init() if (!engine.useAudio) { - engine.useSound = false; - engine.useMusic = false; + engine.useSound = 0; + engine.useMusic = 0; } game.cash = 0; @@ -486,7 +486,7 @@ static void game_doCollectables() updateMissionRequirements(M_COLLECT, collectable->type, collectable->value); - collectable->active = false; + collectable->active = 0; if (collectable->type != P_MINE) { setInfoLine(temp, FONT_WHITE); @@ -508,7 +508,7 @@ static void game_doCollectables() if (collectable->life < 1) { - collectable->active = false; + collectable->active = 0; if ((collectable->type == P_CARGO) || (collectable->type == P_ESCAPEPOD) || (collectable->type == P_SLAVES)) @@ -551,7 +551,7 @@ static void game_doBullets() collectables *collectable; collectables *prevCollectable; - bool okayToHit = false; + int okayToHit = 0; int old_shield; float homingMissileSpeed = 0; int charger_num; @@ -642,18 +642,18 @@ static void game_doBullets() if ((aliens[i].shield < 1) || (!aliens[i].active)) continue; - okayToHit = false; + okayToHit = 0; if ((bullet->flags & WF_FRIEND) && (aliens[i].flags & FL_WEAPCO)) - okayToHit = true; + okayToHit = 1; if ((bullet->flags & WF_WEAPCO) && (aliens[i].flags & FL_FRIEND)) - okayToHit = true; + okayToHit = 1; if ((bullet->id == WT_ROCKET) || (bullet->id == WT_LASER) || (bullet->id == WT_CHARGER)) - okayToHit = true; + okayToHit = 1; if (bullet->owner == aliens[i].owner) - okayToHit = false; + okayToHit = 0; if (okayToHit) { @@ -690,7 +690,7 @@ static void game_doBullets() bullet->damage -= old_shield; if (bullet->damage <= 0) { - bullet->active = false; + bullet->active = 0; bullet->shield = 0; audio_playSound(SFX_EXPLOSION, bullet->x, bullet->y); for (int i = 0 ; i < 10 ; i++) @@ -701,7 +701,7 @@ static void game_doBullets() } else { - bullet->active = false; + bullet->active = 0; bullet->shield = 0; } @@ -750,7 +750,7 @@ static void game_doBullets() bullet->damage -= old_shield; if (bullet->damage <= 0) { - bullet->active = false; + bullet->active = 0; bullet->shield = 0; audio_playSound(SFX_EXPLOSION, bullet->x, bullet->y); for (int i = 0 ; i < 10 ; i++) @@ -760,7 +760,7 @@ static void game_doBullets() } else { - bullet->active = false; + bullet->active = 0; bullet->shield = 0; } @@ -783,12 +783,12 @@ static void game_doBullets() { if (bullet_collision(bullet, &cargo[j])) { - bullet->active = false; + bullet->active = 0; explosion_add(bullet->x, bullet->y, SP_SMALL_EXPLOSION); audio_playSound(SFX_HIT, cargo[j].x, cargo[j].y); if (cargo[j].collectType != P_PHOEBE) { - cargo[j].active = false; + cargo[j].active = 0; audio_playSound(SFX_EXPLOSION, cargo[j].x, cargo[j].y); for (int i = 0 ; i < 10 ; i++) explosion_add(cargo[j].x + RANDRANGE(-15, 15), @@ -814,17 +814,17 @@ static void game_doBullets() { if (collectable_collision(collectable, bullet)) { - collectable->active = false; + collectable->active = 0; if (bullet->id != WT_CHARGER) { - bullet->active = false; + bullet->active = 0; } else { bullet->shield--; if (bullet->shield < 0) - bullet->active = false; + bullet->active = 0; } if (bullet->owner == &player) @@ -862,7 +862,7 @@ static void game_doBullets() player_checkShockDamage(bullet->x, bullet->y); } - bullet->active = false; + bullet->active = 0; } if (bullet->active) @@ -884,7 +884,7 @@ static void game_doAliens() static float barrierLoop = 0; int shapeToUse; - bool canFire; + int canFire; int n; barrierLoop += 0.2; @@ -929,7 +929,7 @@ static void game_doAliens() } } - canFire = true; // The alien is allowed to fire + canFire = 1; // The alien is allowed to fire LIMIT_ADD(aliens[i].thinktime, -1, 0, 250); @@ -1009,7 +1009,7 @@ static void game_doAliens() { aliens[i].flags -= FL_LEAVESECTOR; aliens[i].flags += FL_ESCAPED; - aliens[i].active = false; + aliens[i].active = 0; if (aliens[i].classDef == CD_CLOAKFIGHTER) { @@ -1069,7 +1069,7 @@ static void game_doAliens() } else { - canFire = false; + canFire = 0; } if (canFire) @@ -1164,7 +1164,7 @@ static void game_doAliens() } if ((game.area == MISN_MARS) && (aliens[i].x < -60)) - aliens[i].active = false; + aliens[i].active = 0; } else { @@ -1180,7 +1180,7 @@ static void game_doAliens() } if (aliens[i].shield < aliens[i].deathCounter) { - aliens[i].active = false; + aliens[i].active = 0; if ((aliens[i].classDef == CD_BOSS) || (aliens[i].owner == &aliens[ALIEN_BOSS]) || (aliens[i].flags & FL_FRIEND) || @@ -1286,7 +1286,7 @@ static void game_doPlayer() { ship_fireBullet(&player, 1); player.ammo[1] = 0; - player_chargerFired = true; + player_chargerFired = 1; } } } @@ -1296,7 +1296,7 @@ static void game_doPlayer() if (player.ammo[1] > 0) ship_fireBullet(&player, 1); player.ammo[1] = 0; - player_chargerFired = false; + player_chargerFired = 0; } } @@ -1366,7 +1366,7 @@ static void game_doPlayer() if (engine.keyState[KEY_PAUSE]) { - engine.paused = true; + engine.paused = 1; engine.keyState[KEY_PAUSE] = 0; } @@ -1469,7 +1469,7 @@ static void game_doPlayer() } else { - player.active = false; + player.active = 0; player.shield--; if (player.shield == -1) { @@ -1624,7 +1624,7 @@ void game_doExplosions() if(explosion->thinktime < 1) { - explosion->active = false; + explosion->active = 0; } else { @@ -2035,28 +2035,28 @@ Checked during the main game loop. When the game is paused it goes into a constant loop checking this routine. If escape is pressed, the game automatically ends and goes back to the title screen */ -static bool game_checkPauseRequest() +static int game_checkPauseRequest() { getPlayerInput(); if (engine.keyState[KEY_ESCAPE]) { - engine.paused = false; + engine.paused = 0; engine.done = 1; player.shield = 0; - return true; + return 1; } if (engine.keyState[KEY_PAUSE]) { - engine.paused = false; + engine.paused = 0; engine.keyState[KEY_PAUSE] = 0; } - return false; + return 0; } -bool game_collision(float x0, float y0, int w0, int h0, float x2, float y2, int w1, int h1) +int game_collision(float x0, float y0, int w0, int h0, float x2, float y2, int w1, int h1) { float x1 = x0 + w0; float y1 = y0 + h0; @@ -2083,7 +2083,7 @@ int game_mainLoop() game.hasWingMate1 = 1; if (game.area == MISN_ELAMALE) - aliens[ALIEN_KLINE].active = false; + aliens[ALIEN_KLINE].active = 0; for (int i = 0 ; i < engine.maxAliens ; i++) alien_add(); @@ -2110,8 +2110,8 @@ int game_mainLoop() case MISN_ELLESH: case MISN_MARS: case MISN_VENUS: - aliens[ALIEN_PHOEBE].active = false; - aliens[ALIEN_URSULA].active = false; + aliens[ALIEN_PHOEBE].active = 0; + aliens[ALIEN_URSULA].active = 0; break; } @@ -2129,7 +2129,7 @@ int game_mainLoop() aliens[ALIEN_KLINE] = alien_defs[CD_KLINE]; aliens[ALIEN_KLINE].owner = &aliens[ALIEN_KLINE]; aliens[ALIEN_KLINE].target = &player; - aliens[ALIEN_KLINE].active = true; + aliens[ALIEN_KLINE].active = 1; aliens[ALIEN_KLINE].x = player.x + 1000; aliens[ALIEN_KLINE].y = player.y; player_setTarget(ALIEN_KLINE); @@ -2143,7 +2143,7 @@ int game_mainLoop() aliens[ALIEN_BOSS].owner = &aliens[ALIEN_BOSS]; aliens[ALIEN_BOSS].target = &aliens[ALIEN_BOSS]; aliens[ALIEN_BOSS].shield = 1000; - aliens[ALIEN_BOSS].active = true; + aliens[ALIEN_BOSS].active = 1; aliens[ALIEN_BOSS].x = player.x - 1000; aliens[ALIEN_BOSS].y = player.y; player_setTarget(ALIEN_BOSS); diff --git a/src/game.h b/src/game.h index bee586d..28ac774 100644 --- a/src/game.h +++ b/src/game.h @@ -26,7 +26,7 @@ void game_init(); void game_doStars(); void game_doExplosions(); void game_delayFrame(); -bool game_collision(float x0, float y0, int w0, int h0, float x2, float y2, int w1, int h1); +int game_collision(float x0, float y0, int w0, int h0, float x2, float y2, int w1, int h1); int game_mainLoop(); #endif diff --git a/src/intermission.cpp b/src/intermission.cpp index c554cec..18cc0b5 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -403,12 +403,12 @@ Spins the planets around the sun, spaced according to their Y value as defined in intermission_setSystemPlanets(). Moving the cursor over the planet will show their name and their current status */ -static bool intermission_showSystem(float x, float y, bool selectable) +static int intermission_showSystem(float x, float y, int selectable) { SDL_Rect r; int planet = 0; int planetSpace = systemPlanet[planet].y; - bool rtn = false; + int rtn = 0; // Blit the sun screen_blit(gfx_sprites[SP_SUN], 370, 220); @@ -439,7 +439,7 @@ static bool intermission_showSystem(float x, float y, bool selectable) { game.destinationPlanet = planet; strcpy(game.destinationName, systemPlanet[game.destinationPlanet].name); - rtn = true; + rtn = 1; engine.keyState[KEY_FIRE] = 0; } } @@ -1030,21 +1030,21 @@ static void intermission_doOptions(SDL_Surface *optionsSurface) if ((engine.keyState[KEY_FIRE])) { if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 172, 45, 22)) - engine.useSound = true; + engine.useSound = 1; if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 172, 45, 22)) - engine.useSound = false; + engine.useSound = 0; if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 222, 45, 22)) { - engine.useMusic = true; + engine.useMusic = 1; audio_playMusic("music/through_space.ogg", -1); } if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 222, 45, 22)) { - engine.useMusic = false; + engine.useMusic = 0; audio_haltMusic(); } @@ -1053,7 +1053,7 @@ static void intermission_doOptions(SDL_Surface *optionsSurface) if (!engine.fullScreen) { SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); - engine.fullScreen = true; + engine.fullScreen = 1; } } @@ -1062,7 +1062,7 @@ static void intermission_doOptions(SDL_Surface *optionsSurface) if (engine.fullScreen) { SDL_SetWindowFullscreen(window, 0); - engine.fullScreen = false; + engine.fullScreen = 0; } } @@ -1091,12 +1091,12 @@ int intermission() float sinX = 300; float cosY = 300; - bool movePlanets = true; + int movePlanets = 1; int saveSlot = -1; int rtn = 0; - bool redrawBackground = true; + int redrawBackground = 1; gfx_free(); @@ -1264,7 +1264,7 @@ int intermission() if (redrawBackground) { screen_drawBackground(); - redrawBackground = false; + redrawBackground = 0; } else { @@ -1352,7 +1352,7 @@ int intermission() cosY += 0.01; } - if (intermission_showSystem(sinX, cosY, true)) + if (intermission_showSystem(sinX, cosY, 1)) { sprintf(string, "Destination: %s", systemPlanet[game.destinationPlanet].name); gfx_createTextObject(TS_DEST_PLANET, string, 550, 450, FONT_WHITE); @@ -1392,7 +1392,7 @@ int intermission() break; case 8: - intermission_showSystem(sinX, cosY, false); + intermission_showSystem(sinX, cosY, 0); screen_blit(systemPlanet[game.stationedPlanet].image, 150, 450); screen_blitText(TS_CURRENT_PLANET); @@ -1414,7 +1414,7 @@ int intermission() gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 450, FONT_WHITE); intermission_updateCommsSurface(commsSurface); section = 1; - redrawBackground = true; + redrawBackground = 1; save(0); } else if (interceptionChance > 0) @@ -1460,7 +1460,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 0; engine.keyState[KEY_FIRE] = 0; } @@ -1471,7 +1471,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 1; engine.keyState[KEY_FIRE] = 0; } @@ -1482,7 +1482,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 2; engine.keyState[KEY_FIRE] = 0; } @@ -1493,7 +1493,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 3; engine.keyState[KEY_FIRE] = 0; } @@ -1504,7 +1504,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 4; engine.keyState[KEY_FIRE] = 0; } @@ -1515,7 +1515,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 5; engine.keyState[KEY_FIRE] = 0; } @@ -1526,7 +1526,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 6; engine.keyState[KEY_FIRE] = 0; } @@ -1537,7 +1537,7 @@ int intermission() if ((engine.keyState[KEY_FIRE])) { - redrawBackground = true; + redrawBackground = 1; section = 7; engine.keyState[KEY_FIRE] = 0; } diff --git a/src/missions.cpp b/src/missions.cpp index db73bb6..bbadbc2 100644 --- a/src/missions.cpp +++ b/src/missions.cpp @@ -530,7 +530,7 @@ static int revealHiddenObjectives() { mission_killAllEnemies(); events_sync(); - aliens[ALIEN_KLINE].active = true; + aliens[ALIEN_KLINE].active = 1; aliens[ALIEN_KLINE].x = player.x + 1000; aliens[ALIEN_KLINE].y = player.y; aliens[ALIEN_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE; @@ -542,7 +542,7 @@ static int revealHiddenObjectives() return allDone; } -bool allMissionsCompleted() +int allMissionsCompleted() { for (int i = 0 ; i < 3 ; i++) { @@ -647,8 +647,8 @@ bool allMissionsCompleted() } int remaining; - bool add = false; - bool allDone = true; + int add = 0; + int allDone = 1; // Zero objective list for a recount currentMission.remainingObjectives1 = currentMission.remainingObjectives2 = 0; @@ -661,12 +661,12 @@ bool allMissionsCompleted() { currentMission.remainingObjectives1++; if (currentMission.primaryType[i] == M_DESTROY_ALL_TARGETS) - add = true; - allDone = false; + add = 1; + allDone = 0; } if (currentMission.completed1[i] < OB_INCOMPLETE) - return false; + return 0; } if (currentMission.secondaryType[i] != M_NONE) { @@ -674,8 +674,8 @@ bool allMissionsCompleted() { currentMission.remainingObjectives2++; if (currentMission.secondaryType[i] == M_DESTROY_ALL_TARGETS) - add = true; - allDone = false; + add = 1; + allDone = 0; } } } @@ -693,17 +693,17 @@ bool allMissionsCompleted() return allDone; } -bool missionFailed() +int missionFailed() { for (int i = 0 ; i < 3 ; i++) { if (currentMission.completed1[i] < OB_INCOMPLETE) { - return true; + return 1; } } - return false; + return 0; } static void drawBriefScreen() @@ -834,7 +834,7 @@ void missionBriefScreen() engine.keyState[KEY_ALTFIRE] = 0; engine.keyState[KEY_ESCAPE] = 0; - while (true) + while (1) { game_delayFrame(); getPlayerInput(); @@ -940,7 +940,7 @@ void missionFinishedScreen() engine.done = 0; engine.keyState[KEY_FIRE] = 0; - while (true) + while (1) { game_delayFrame(); getPlayerInput(); diff --git a/src/missions.h b/src/missions.h index 602cf2f..c806232 100644 --- a/src/missions.h +++ b/src/missions.h @@ -29,8 +29,8 @@ extern void updateSystemStatus(); extern void setMission(int mission); extern void checkTimer(); extern void updateMissionRequirements(int type, int id, int value); -extern bool allMissionsCompleted(); -extern bool missionFailed(); +extern int allMissionsCompleted(); +extern int missionFailed(); extern void missionBriefScreen(); extern void missionFinishedScreen(); extern void initMissions(); diff --git a/src/player.cpp b/src/player.cpp index 62d1148..72082dd 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -20,14 +20,14 @@ along with this program. If not, see . #include "Starfighter.h" object player; -bool player_chargerFired = false; +int player_chargerFired = 0; /* Initialises the player for a new game. */ void initPlayer() { - player.active = true; + player.active = 1; player.x = screen->w / 2; player.y = screen->h / 2; player.speed = 2; @@ -95,7 +95,7 @@ void player_checkShockDamage(float x, float y) void exitPlayer() { - player_chargerFired = false; + player_chargerFired = 0; if ((player.weaponType[1] == W_CHARGER) || (player.weaponType[1] == W_LASER)) player.ammo[1] = 0; @@ -188,7 +188,7 @@ void getPlayerInput() engine.keyState[mapkey(engine.event.key.keysym.sym)] = 1; if (engine.gameSection != SECTION_GAME) - engine.paused = false; + engine.paused = 0; break; @@ -233,17 +233,17 @@ void getPlayerInput() break; case SDL_JOYAXISMOTION: - static bool prevjoyup, prevjoydown, prevjoyleft, prevjoyright; + static int prevjoyup, prevjoydown, prevjoyleft, prevjoyright; if (engine.event.jaxis.axis & 1) { - bool joyup = engine.event.jaxis.value < -16384; - bool joydown = engine.event.jaxis.value >= 16384; + int joyup = engine.event.jaxis.value < -16384; + int joydown = engine.event.jaxis.value >= 16384; if(joyup != prevjoyup) engine.keyState[KEY_UP] = prevjoyup = joyup; if(joydown != prevjoydown) engine.keyState[KEY_DOWN] = prevjoydown = joydown; } else { - bool joyleft = engine.event.jaxis.value < -16384; - bool joyright = engine.event.jaxis.value >= 16384; + int joyleft = engine.event.jaxis.value < -16384; + int joyright = engine.event.jaxis.value >= 16384; if(joyleft != prevjoyleft) engine.keyState[KEY_LEFT] = prevjoyleft = joyleft; if(joyright != prevjoyright) @@ -254,7 +254,7 @@ void getPlayerInput() case SDL_WINDOWEVENT: if (engine.autoPause && (engine.event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)) - engine.paused = true; + engine.paused = 1; break; } diff --git a/src/player.h b/src/player.h index dd9e66c..bd40c1d 100644 --- a/src/player.h +++ b/src/player.h @@ -21,7 +21,7 @@ along with this program. If not, see . #define PLAYER_H extern object player; -extern bool player_chargerFired; +extern int player_chargerFired; extern void initPlayer(); void player_setTarget(int index); diff --git a/src/ship.cpp b/src/ship.cpp index fb9d8fd..76f4eec 100644 --- a/src/ship.cpp +++ b/src/ship.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . #include "Starfighter.h" -bool ship_collision(object *ship, object *otherShip) +int ship_collision(object *ship, object *otherShip) { float x0 = ship->x; float y0 = ship->y; @@ -198,7 +198,7 @@ void ship_fireRay(object *ship) 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)) { - alien_hurt(&aliens[i], ship->owner, 1, false); + alien_hurt(&aliens[i], ship->owner, 1, 0); } } } diff --git a/src/ship.h b/src/ship.h index 568cb52..f6371c2 100644 --- a/src/ship.h +++ b/src/ship.h @@ -18,7 +18,7 @@ along with this program. If not, see . #ifndef SHIP_H #define SHIP_H -bool ship_collision(object *ship, object *otherShip); +int ship_collision(object *ship, object *otherShip); void ship_fireBullet(object *ship, int weaponType); void ship_fireRay(object *ship); diff --git a/src/structs.h b/src/structs.h index 2eded19..e34c55b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -22,7 +22,7 @@ along with this program. If not, see . typedef struct object_ { - bool active; + int active; int classDef; // Used by aliens to determine what they are int AIType; // Type of articifial intelligence @@ -99,7 +99,7 @@ typedef struct Star_ { typedef struct collectables_ { - bool active; + int active; float x, y, dx, dy; SDL_Surface *image; int type; // What kind of collectable is it? diff --git a/src/title.cpp b/src/title.cpp index 1d9baa9..b5b1b6f 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -205,7 +205,7 @@ int doTitle() char buildVersion[25]; int selectedOption = 1; - bool skip = false; + int skip = 0; int listLength = 5; // menu list length int menuType = MENU_MAIN; @@ -411,7 +411,7 @@ int doTitle() gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9, screen->h - 20, FONT_WHITE, 0, gfx_background); screen_addBuffer(0, 0, screen->w, screen->h); - skip = true; + skip = 1; } } } @@ -422,7 +422,7 @@ int doTitle() if (engine.cheatCredits) { doCredits(); - engine.cheatCredits = false; + engine.cheatCredits = 0; } if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE])) @@ -438,7 +438,7 @@ int doTitle() gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9, screen->h - 20, FONT_WHITE, 0, gfx_background); screen_addBuffer(0, 560, 800, 40); - skip = true; + skip = 1; } else { @@ -631,7 +631,7 @@ void gameover() flushInput(); engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0; - while (true) + while (1) { getPlayerInput(); @@ -701,7 +701,7 @@ void doCredits() engine.keyState[KEY_ALTFIRE] = 0; flushInput(); - while (true) + while (1) { renderer_update(); screen_unBuffer();