More bools.

This commit is contained in:
Guus Sliepen 2011-08-26 16:55:46 +02:00
parent 277d34dabd
commit 8b34e90bcf
19 changed files with 69 additions and 69 deletions

View File

@ -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)))
{

View File

@ -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);

View File

@ -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)
{

View File

@ -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;

View File

@ -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()

View File

@ -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;
}

View File

@ -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();

View File

@ -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(&currentGame, 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)

View File

@ -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]);
}

View File

@ -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()

View File

@ -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);

View File

@ -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();

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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;

View File

@ -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];