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