diff --git a/code/aliens.cpp b/code/aliens.cpp index 6c9b780..337bcc8 100644 --- a/code/aliens.cpp +++ b/code/aliens.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "aliens.h" -signed char placeAlien(object *theEnemy) +bool placeAlien(object *theEnemy) { if (rand() % 2 == 0) theEnemy->x = Math::rrand(800, 1600); @@ -43,11 +43,11 @@ signed char placeAlien(object *theEnemy) if ((enemy[i].owner != theEnemy) && (enemy[i].shield > 0)) { if (Collision::collision(theEnemy->x, theEnemy->y, theEnemy->image[0]->w, theEnemy->image[0]->h, enemy[i].x, enemy[i].y, enemy[i].image[0]->w, enemy[i].image[0]->h)) - return 0; + return false; } } - return 1; + return true; } /* @@ -131,7 +131,7 @@ void addSmallAsteroid(object *host) enemy[index].active = true; } -signed char addAlien() +bool addAlien() { int index = getAlien(); @@ -257,7 +257,7 @@ signed char addAlien() break; enemy[index].active = false; - return 0; + return false; } if (enemy[index].classDef == CD_CARGOSHIP) @@ -277,7 +277,7 @@ signed char addAlien() if (currentGame.area == 18) enemy[index].flags += FL_HASMINIMUMSPEED; - return 1; + return true; } void getPreDefinedAliens() @@ -776,15 +776,15 @@ int traceView(object *theEnemy) void moveAndSeparate(object *theEnemy) { - signed char checkCollisions = 1; - signed char hasCollided = 0; + bool checkCollisions = true; + bool hasCollided = false; // don't worry about bumping into other craft if ((theEnemy->flags & FL_LEAVESECTOR) || (theEnemy->classDef == CD_DRONE) || (currentGame.area == 18)) - checkCollisions = 0; + checkCollisions = false; if (theEnemy->shield < 1) - checkCollisions = 0; + checkCollisions = false; if (theEnemy->owner == theEnemy) { @@ -835,7 +835,7 @@ void moveAndSeparate(object *theEnemy) } if (anEnemy->owner == anEnemy) - hasCollided = 1; + hasCollided = true; } anEnemy++; @@ -847,7 +847,7 @@ void moveAndSeparate(object *theEnemy) { if (Collision::collision(theEnemy, &player)) { - hasCollided = 1; + hasCollided = true; if (theEnemy->classDef == CD_ASTEROID) { @@ -943,7 +943,7 @@ void doAliens() // A global variable for checking if all the aliens are dead engine.allAliensDead = 1; - signed char canFire; + bool canFire; int shapeToUse; object *theEnemy = enemy; @@ -984,7 +984,7 @@ void doAliens() } } - canFire = 1; // The alien is allowed to fire + canFire = true; // The alien is allowed to fire Math::limitInt(&--theEnemy->thinktime, 0, 250); @@ -1118,10 +1118,10 @@ void doAliens() } else { - canFire = 0; + canFire = false; } - if ((canFire == 1) && (dev.fireAliens)) + if ((canFire) && (dev.fireAliens)) { if ((theEnemy->reload[0] == 0) && ((rand() % 1000 < theEnemy->chance[0]) || (theEnemy->flags & FL_CONTINUOUS_FIRE))) { diff --git a/code/aliens.h b/code/aliens.h index dbf94d4..73c3e2a 100644 --- a/code/aliens.h +++ b/code/aliens.h @@ -38,7 +38,7 @@ extern void addEngine(object *craft); extern void fireRay(object *attacker); extern void addDebris(int x, int y, int amount); extern void playSound(int sid); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern object *addCargo(object *owner, int cargoType); extern void addCollectable(float x, float y, int type, int value, int life); extern void updateMissionRequirements(int type, int id, int value); diff --git a/code/bullets.cpp b/code/bullets.cpp index c5b40ad..9b71ff2 100644 --- a/code/bullets.cpp +++ b/code/bullets.cpp @@ -510,7 +510,7 @@ void doBullets() object *theEnemy, *theCargo; - signed char okayToHit = 0; + bool okayToHit = false; float homingMissileSpeed = 0; while (bullet->next != NULL) @@ -588,17 +588,17 @@ void doBullets() if ((theEnemy->shield < 1) || (!theEnemy->active)) continue; - okayToHit = 0; + okayToHit = false; if ((bullet->flags & WF_FRIEND) && (theEnemy->flags & FL_WEAPCO)) - okayToHit = 1; + okayToHit = true; if ((bullet->flags & WF_WEAPCO) && (theEnemy->flags & FL_FRIEND)) - okayToHit = 1; + okayToHit = true; if ((bullet->id == WT_ROCKET) || (bullet->id == WT_LASER) || (bullet->id == WT_CHARGER)) - okayToHit = 1; + okayToHit = true; if (bullet->owner == theEnemy->owner) - okayToHit = 0; + okayToHit = false; if (okayToHit) { diff --git a/code/comms.h b/code/comms.h index 93a1347..1499204 100644 --- a/code/comms.h +++ b/code/comms.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "structs.h" #include "classes.h" -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern int getFace(const char *face); extern globalEngineVariables engine; diff --git a/code/events.cpp b/code/events.cpp index 18af7c8..1892c7b 100644 --- a/code/events.cpp +++ b/code/events.cpp @@ -25,7 +25,7 @@ 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 */ -signed char checkPauseRequest() +bool checkPauseRequest() { getPlayerInput(); @@ -34,7 +34,7 @@ signed char checkPauseRequest() engine.paused = false; engine.done = 1; player.shield = 0; - return 1; + return true; } if (engine.keyState[SDLK_p]) @@ -43,7 +43,7 @@ signed char checkPauseRequest() engine.keyState[SDLK_p] = 0; } - return 0; + return false; } void compareLastKeyInputs() diff --git a/code/intermission.cpp b/code/intermission.cpp index 37a6d95..6dfacd9 100644 --- a/code/intermission.cpp +++ b/code/intermission.cpp @@ -239,12 +239,12 @@ Spins the planets around the sun, spaced according to their Y value as defined in setSystemPlanets(). Moving the cursor over the planet will show their name and their current status */ -signed char showSystem(float x, float y) +bool showSystem(float x, float y) { SDL_Rect r; signed char planet = 0; int planetSpace = systemPlanet[planet].y; - signed char rtn = 0; + bool rtn = false; // Blit the sun graphics.blit(graphics.shape[30], 370, 220); @@ -283,7 +283,7 @@ signed char showSystem(float x, float y) strcpy(currentGame.destinationName, systemPlanet[currentGame.destinationPlanet].name); } - rtn = 1; + rtn = true; engine.keyState[SDLK_LCTRL] = engine.keyState[SDLK_RCTRL] = 0; } } @@ -544,7 +544,7 @@ int galaxyMap() float sinX = 300; float cosY = 300; - signed char movePlanets = 1; + bool movePlanets = true; signed char saveSlot = -1; if (currentGame.system > 0) @@ -585,7 +585,7 @@ int galaxyMap() iconInfo[11].image = graphics.textSurface("Go to Destination Planet", FONT_WHITE); - signed char redrawBackGround = 1; + bool redrawBackGround = true; player.maxShield = (25 * currentGame.shieldUnits); @@ -605,7 +605,7 @@ int galaxyMap() if (redrawBackGround) { graphics.drawBackGround(); - redrawBackGround = 0; + redrawBackGround = false; } else { @@ -763,7 +763,7 @@ int galaxyMap() iconInfo[9].image = graphics.textSurface(string, FONT_WHITE); updateCommsSurface(commsSurface); section = 1; - redrawBackGround = 1; + redrawBackGround = true; } if (interceptionChance > 0) @@ -817,7 +817,7 @@ int galaxyMap() if ((engine.keyState[SDLK_LCTRL]) || (engine.keyState[SDLK_RCTRL])) { - redrawBackGround = 1; + redrawBackGround = true; section = i; engine.keyState[SDLK_LCTRL] = engine.keyState[SDLK_RCTRL] = 0; } diff --git a/code/intermission.h b/code/intermission.h index 4b4c47f..0e0a41a 100644 --- a/code/intermission.h +++ b/code/intermission.h @@ -45,7 +45,7 @@ extern void updateCommsSurface(SDL_Surface *comms); extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot); extern void checkForBossMission(); extern void doComms(SDL_Surface *comms); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern int getFace(const char *face); extern void flushInput(); diff --git a/code/loadSave.cpp b/code/loadSave.cpp index f5bc867..d20c8b1 100644 --- a/code/loadSave.cpp +++ b/code/loadSave.cpp @@ -79,7 +79,7 @@ int initSaveSlots() /* Fill in later... */ -signed char loadGame(int slot) +bool loadGame(int slot) { char filename[PATH_MAX]; FILE *fp; @@ -88,13 +88,13 @@ signed char loadGame(int slot) fp = fopen(filename, "rb"); if (fp == NULL) - return 0; + return false; if (fread(¤tGame, sizeof(Game), 1, fp) != 1) { printf("Save game error. The file was not of the expected format.\n"); fclose(fp); - return 0; + return false; } fclose(fp); @@ -110,7 +110,7 @@ signed char loadGame(int slot) for (int i = 0 ; i < 10 ; i++) systemPlanet[i].missionCompleted = currentGame.missionCompleted[i]; - return 1; + return true; } void saveGame(int slot) diff --git a/code/messages.cpp b/code/messages.cpp index da11fe1..fd2badd 100644 --- a/code/messages.cpp +++ b/code/messages.cpp @@ -75,7 +75,7 @@ void getKillMessage(object *ally) { char in[50], name[30], otherName[30]; int kills, difference; - signed char firstPlace = 0; + bool firstPlace = false; int faceToUse = FACE_PHOEBE; if (ally == &enemy[FR_PHOEBE]) @@ -85,7 +85,7 @@ void getKillMessage(object *ally) kills = currentGame.wingMate1Kills; difference = currentGame.wingMate1Kills - currentGame.wingMate2Kills; if ((currentGame.wingMate1Kills > currentGame.wingMate2Kills) && (currentGame.wingMate1Kills > currentGame.totalKills)) - firstPlace = 1; + firstPlace = true; faceToUse = FACE_PHOEBE; } else @@ -95,7 +95,7 @@ void getKillMessage(object *ally) kills = currentGame.wingMate2Kills; difference = currentGame.wingMate2Kills - currentGame.wingMate1Kills; if ((currentGame.wingMate2Kills > currentGame.wingMate1Kills) && (currentGame.wingMate2Kills > currentGame.totalKills)) - firstPlace = 1; + firstPlace = true; faceToUse = FACE_URSULA; } @@ -132,7 +132,7 @@ void getKillMessage(object *ally) break; case 9: - if (firstPlace == 1) + if (firstPlace) { sprintf(in, killMessage[9]); } diff --git a/code/missions.cpp b/code/missions.cpp index a4b0f7c..fc93b04 100644 --- a/code/missions.cpp +++ b/code/missions.cpp @@ -510,7 +510,7 @@ char revealHiddenObjectives() return allDone; } -signed char allMissionsCompleted() +bool allMissionsCompleted() { for (int i = 0 ; i < 3 ; i++) { @@ -605,9 +605,9 @@ signed char allMissionsCompleted() } } - signed char remaining = 0; - signed char add = 0; - signed char allDone = 1; + bool remaining = false; + bool add = false; + bool allDone = true; // Zero objective list for a recount currentMission.remainingObjectives1 = currentMission.remainingObjectives2 = 0; @@ -620,12 +620,12 @@ signed char allMissionsCompleted() { currentMission.remainingObjectives1++; if (currentMission.primaryType[i] == M_DESTROY_ALL_TARGETS) - add = 1; - allDone = 0; + add = true; + allDone = false; } if (currentMission.completed1[i] < 0) - return 0; + return false; } if (currentMission.secondaryType[i] != NONE) { @@ -633,8 +633,8 @@ signed char allMissionsCompleted() { currentMission.remainingObjectives2++; if (currentMission.secondaryType[i] == M_DESTROY_ALL_TARGETS) - add = 1; - allDone = 0; + add = true; + allDone = false; } } } @@ -646,23 +646,23 @@ signed char allMissionsCompleted() // We've only got one objective left and it's destroy all targets, // so stop adding aliens (otherwise it might be impossible to finish!) - if ((add == 1) && (remaining == 1)) + if ((add) && (remaining)) engine.addAliens = -1; return allDone; } -signed char missionFailed() +bool missionFailed() { for (int i = 0 ; i < 3 ; i++) { if (currentMission.completed1[i] < 0) { - return 1; + return true; } } - return 0; + return false; } void drawBriefScreen() diff --git a/code/missions.h b/code/missions.h index 6c64422..c196e8d 100644 --- a/code/missions.h +++ b/code/missions.h @@ -35,7 +35,7 @@ extern void getPlayerInput(); extern void setInfoLine(const char *in, int color); extern void loadGameGraphics(); extern void killAllAliens(); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern void setRadioMessage(signed char face, const char *in, int priority); extern void syncScriptEvents(); extern void loadMusic(const char *filename); diff --git a/code/resources.h b/code/resources.h index 15f693f..1cd965a 100644 --- a/code/resources.h +++ b/code/resources.h @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern void unpack(const char *file, signed char fileType); extern SDL_Surface *loadImage(const char *filename); extern Mix_Chunk *loadSound(const char *filename); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern void setAlienShapes(); extern void setWeaponShapes(); extern void loadGameGraphics(); diff --git a/code/script.cpp b/code/script.cpp index 2895db2..9717ecc 100644 --- a/code/script.cpp +++ b/code/script.cpp @@ -236,7 +236,7 @@ void doCutscene(int scene) enemy[i].engineY = (enemy[i].image[0]->h / 2); } - signed char showMessage = 0; + bool showMessage = false; signed char currentMessage = -1; int timer = 60 * 4; @@ -273,7 +273,7 @@ void doCutscene(int scene) timer--; if (timer == 0) { - showMessage = 1 - showMessage; + showMessage = !showMessage; timer = 120; if (showMessage) { diff --git a/code/script.h b/code/script.h index 7ffc1c9..3ee1ef7 100644 --- a/code/script.h +++ b/code/script.h @@ -39,7 +39,7 @@ extern void addEngine(object *craft); extern void doExplosions(); extern void resetLists(); extern int getFace(const char *face); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern void flushInput(); extern Game currentGame; diff --git a/code/shop.h b/code/shop.h index d8f4b58..1c29183 100644 --- a/code/shop.h +++ b/code/shop.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "structs.h" #include "classes.h" -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern object player; extern globalEngineVariables engine; diff --git a/code/title.cpp b/code/title.cpp index ac985d5..e2dd817 100644 --- a/code/title.cpp +++ b/code/title.cpp @@ -228,7 +228,7 @@ int doTitle() if (continueSaveSlot > 0) {selectedOption = 3; optionRec.y += 40;} - signed char skip = 0; + bool skip = false; signed char listLength = 5; // menu list length signed char menuType = 0; @@ -335,7 +335,7 @@ int doTitle() graphics.drawString("Copyright Parallel Realities 2003", 5, 580, FONT_WHITE, graphics.background); graphics.drawString(buildVersion, 695, 580, FONT_WHITE, graphics.background); graphics.addBuffer(0, 580, 800, 20); - skip = 1; + skip = true; } } } @@ -356,7 +356,7 @@ int doTitle() graphics.drawString("Copyright Parallel Realities 2003", 5, 580, FONT_WHITE, graphics.background); graphics.drawString(buildVersion, 695, 580, FONT_WHITE, graphics.background); graphics.addBuffer(0, 580, 800, 20); - skip = 1; + skip = true; } else { diff --git a/code/title.h b/code/title.h index 3dfd272..045b8a9 100644 --- a/code/title.h +++ b/code/title.h @@ -43,7 +43,7 @@ extern void newGame(); extern void loadGameGraphics(); extern void loadBackground(const char *filename); extern void doCredits(); -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern void flushInput(); extern globalEngineVariables engine; diff --git a/code/unpack.cpp b/code/unpack.cpp index 8802b4f..fd1593a 100644 --- a/code/unpack.cpp +++ b/code/unpack.cpp @@ -103,7 +103,7 @@ void unpack(const char *file, signed char fileType) Search the data package for the required file. When it is found, return the location. */ -int locateDataInPak(const char *file, signed char required) +int locateDataInPak(const char *file, bool required) { char packFilename[60]; int packFSize; diff --git a/code/weapons.h b/code/weapons.h index 283756d..cccc96e 100644 --- a/code/weapons.h +++ b/code/weapons.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "structs.h" #include "classes.h" -extern int locateDataInPak(const char *file, signed char required); +extern int locateDataInPak(const char *file, bool required); extern Graphics graphics; extern object weapon[MAX_WEAPONS];