Renamed the "object" and "collectables" structs.
This was done with "replace all" actions, but I have checked and the only collatoral damage has been to capitalize some instances of "objective" in comments.
This commit is contained in:
parent
de1cd7c674
commit
dc7209164a
|
@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
object alien_defs[CD_MAX];
|
Object alien_defs[CD_MAX];
|
||||||
object aliens[ALIEN_MAX];
|
Object aliens[ALIEN_MAX];
|
||||||
|
|
||||||
static const int nChrisKillMessage = 15;
|
static const int nChrisKillMessage = 15;
|
||||||
static const char *chrisKillMessage[nChrisKillMessage] = {
|
static const char *chrisKillMessage[nChrisKillMessage] = {
|
||||||
|
@ -1217,7 +1217,7 @@ int alien_add()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_addDrone(object *hostAlien)
|
void alien_addDrone(Object *hostAlien)
|
||||||
{
|
{
|
||||||
int index = alien_getFreeIndex();
|
int index = alien_getFreeIndex();
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ void alien_addDrone(object *hostAlien)
|
||||||
aliens[index].y = hostAlien->y + rand() % 50;
|
aliens[index].y = hostAlien->y + rand() % 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_addSmallAsteroid(object *hostAlien)
|
void alien_addSmallAsteroid(Object *hostAlien)
|
||||||
{
|
{
|
||||||
if (engine.missionCompleteTimer != 0)
|
if (engine.missionCompleteTimer != 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1305,7 +1305,7 @@ void alien_addFriendly(int type)
|
||||||
aliens[type].flags |= FL_IMMORTAL;
|
aliens[type].flags |= FL_IMMORTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int 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);
|
||||||
|
@ -1335,7 +1335,7 @@ int alien_place(object *alien)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_setAI(object *alien)
|
void alien_setAI(Object *alien)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float tx;
|
float tx;
|
||||||
|
@ -1420,7 +1420,7 @@ void alien_setAI(object *alien)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_setKlineAttackMethod(object *alien)
|
void alien_setKlineAttackMethod(Object *alien)
|
||||||
{
|
{
|
||||||
if (alien->shield <= 500)
|
if (alien->shield <= 500)
|
||||||
{
|
{
|
||||||
|
@ -1454,7 +1454,7 @@ void alien_setKlineAttackMethod(object *alien)
|
||||||
/*
|
/*
|
||||||
This AI is exclusively for Kline.
|
This AI is exclusively for Kline.
|
||||||
*/
|
*/
|
||||||
void alien_setKlineAI(object *alien)
|
void alien_setKlineAI(Object *alien)
|
||||||
{
|
{
|
||||||
// Weapon type change
|
// Weapon type change
|
||||||
if (CHANCE(1. / 3.))
|
if (CHANCE(1. / 3.))
|
||||||
|
@ -1514,7 +1514,7 @@ void alien_setKlineAI(object *alien)
|
||||||
"Looks" for an enemy by picking a randomly active enemy and using them
|
"Looks" for an enemy by picking a randomly active enemy and using them
|
||||||
as a target. If the target is too far away, it will be ignored.
|
as a target. If the target is too far away, it will be ignored.
|
||||||
*/
|
*/
|
||||||
void alien_searchForTarget(object *alien)
|
void alien_searchForTarget(Object *alien)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1531,7 +1531,7 @@ void alien_searchForTarget(object *alien)
|
||||||
|
|
||||||
i = rand() % ALIEN_MAX;
|
i = rand() % ALIEN_MAX;
|
||||||
|
|
||||||
object *targetEnemy = &aliens[i];
|
Object *targetEnemy = &aliens[i];
|
||||||
|
|
||||||
// Tell Sid not to attack craft that are already disabled or can
|
// Tell Sid not to attack craft that are already disabled or can
|
||||||
// return fire. This will save him from messing about (unless we're on the last mission)
|
// return fire. This will save him from messing about (unless we're on the last mission)
|
||||||
|
@ -1577,7 +1577,7 @@ void alien_searchForTarget(object *alien)
|
||||||
/*
|
/*
|
||||||
Do various checks to see if the alien can fire at the target.
|
Do various checks to see if the alien can fire at the target.
|
||||||
*/
|
*/
|
||||||
int alien_checkTarget(object *alien)
|
int alien_checkTarget(Object *alien)
|
||||||
{
|
{
|
||||||
// No target
|
// No target
|
||||||
if (alien->target == alien)
|
if (alien->target == alien)
|
||||||
|
@ -1618,7 +1618,7 @@ int alien_checkTarget(object *alien)
|
||||||
Currently only used for the allies. Whilst flying around, the allies will fire on
|
Currently only used for the allies. Whilst flying around, the allies will fire on
|
||||||
any enemy craft that enter their line of sight.
|
any enemy craft that enter their line of sight.
|
||||||
*/
|
*/
|
||||||
int alien_enemiesInFront(object *alien)
|
int alien_enemiesInFront(Object *alien)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
||||||
{
|
{
|
||||||
|
@ -1639,7 +1639,7 @@ int alien_enemiesInFront(object *alien)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_move(object *alien)
|
void alien_move(Object *alien)
|
||||||
{
|
{
|
||||||
int checkCollisions;
|
int checkCollisions;
|
||||||
|
|
||||||
|
@ -1741,7 +1741,7 @@ void alien_move(object *alien)
|
||||||
/*
|
/*
|
||||||
Fill in later...
|
Fill in later...
|
||||||
*/
|
*/
|
||||||
void alien_destroy(object *alien, object *attacker)
|
void alien_destroy(Object *alien, Object *attacker)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -1839,7 +1839,7 @@ void alien_destroy(object *alien, object *attacker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void alien_hurt(object *alien, object *attacker, int damage, int ion)
|
void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
|
||||||
{
|
{
|
||||||
double run_chance;
|
double run_chance;
|
||||||
|
|
||||||
|
|
28
src/alien.h
28
src/alien.h
|
@ -20,24 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef ALIEN_H
|
#ifndef ALIEN_H
|
||||||
#define ALIEN_H
|
#define ALIEN_H
|
||||||
|
|
||||||
extern object alien_defs[CD_MAX];
|
extern Object alien_defs[CD_MAX];
|
||||||
extern object aliens[ALIEN_MAX];
|
extern Object aliens[ALIEN_MAX];
|
||||||
|
|
||||||
void alien_defs_init();
|
void alien_defs_init();
|
||||||
void aliens_init();
|
void aliens_init();
|
||||||
int 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);
|
||||||
int 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);
|
||||||
void alien_searchForTarget(object *alien);
|
void alien_searchForTarget(Object *alien);
|
||||||
int alien_checkTarget(object *alien);
|
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, int ion);
|
void alien_hurt(Object *alien, Object *attacker, int damage, int ion);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,13 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void bullet_add(object *theWeapon, object *attacker, int y, int dy)
|
void bullet_add(Object *theWeapon, Object *attacker, int y, int dy)
|
||||||
{
|
{
|
||||||
object *bullet;
|
Object *bullet;
|
||||||
int imageIndex;
|
int imageIndex;
|
||||||
int tempX, tempY, steps;
|
int tempX, tempY, steps;
|
||||||
|
|
||||||
bullet = new object;
|
bullet = new Object;
|
||||||
|
|
||||||
if (attacker == &player)
|
if (attacker == &player)
|
||||||
game.shots++;
|
game.shots++;
|
||||||
|
@ -145,9 +145,9 @@ already have a target. If the target it is currently chasing is killed, it will
|
||||||
begin to look for a new one (done in doBullets()). The homing missile will make
|
begin to look for a new one (done in doBullets()). The homing missile will make
|
||||||
one attempt per call (one call per frame) to find a suitable target. If the target
|
one attempt per call (one call per frame) to find a suitable target. If the target
|
||||||
it picks is dead or outside the screen range, then it returns NULL. A suitable
|
it picks is dead or outside the screen range, then it returns NULL. A suitable
|
||||||
target will be returned as the object address.
|
target will be returned as the Object address.
|
||||||
*/
|
*/
|
||||||
object *bullet_getTarget(object *bullet)
|
Object *bullet_getTarget(Object *bullet)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ object *bullet_getTarget(object *bullet)
|
||||||
return &aliens[i];
|
return &aliens[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int 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;
|
||||||
|
|
|
@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef BULLETS_H
|
#ifndef BULLETS_H
|
||||||
#define BULLETS_H
|
#define BULLETS_H
|
||||||
|
|
||||||
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);
|
||||||
int bullet_collision(object *bullet, object *ship);
|
int bullet_collision(Object *bullet, Object *ship);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
object cargo[MAX_CARGO];
|
Object cargo[MAX_CARGO];
|
||||||
|
|
||||||
void cargo_init()
|
void cargo_init()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ static int cargo_get()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
object *cargo_add(object *owner, int cargoType)
|
Object *cargo_add(Object *owner, int cargoType)
|
||||||
{
|
{
|
||||||
int index = cargo_get();
|
int index = cargo_get();
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef _CARGO_H_
|
#ifndef _CARGO_H_
|
||||||
#define _CARGO_H_
|
#define _CARGO_H_
|
||||||
|
|
||||||
extern object cargo[MAX_CARGO];
|
extern Object cargo[MAX_CARGO];
|
||||||
|
|
||||||
void cargo_init();
|
void cargo_init();
|
||||||
object *cargo_add(object *owner, int cargoType);
|
Object *cargo_add(Object *owner, int cargoType);
|
||||||
void cargo_becomeCollectable(int i);
|
void cargo_becomeCollectable(int i);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -131,7 +131,7 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
collectables *collectable = new collectables;
|
Collectable *collectable = new Collectable;
|
||||||
|
|
||||||
collectable->next = NULL;
|
collectable->next = NULL;
|
||||||
collectable->active = 1;
|
collectable->active = 1;
|
||||||
|
@ -206,7 +206,7 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
engine.collectableTail = collectable;
|
engine.collectableTail = collectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int collectable_collision(collectables *collectable, object *ship)
|
int collectable_collision(Collectable *collectable, Object *ship)
|
||||||
{
|
{
|
||||||
float x0 = collectable->x;
|
float x0 = collectable->x;
|
||||||
float y0 = collectable->y;
|
float y0 = collectable->y;
|
||||||
|
@ -227,7 +227,7 @@ int collectable_collision(collectables *collectable, object *ship)
|
||||||
return !(x1<x2 || x3<x0 || y1<y2 || y3<y0);
|
return !(x1<x2 || x3<x0 || y1<y2 || y3<y0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void collectable_explode(collectables *collectable)
|
void collectable_explode(Collectable *collectable)
|
||||||
{
|
{
|
||||||
audio_playSound(SFX_EXPLOSION, collectable->x, collectable->y);
|
audio_playSound(SFX_EXPLOSION, collectable->x, 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);
|
||||||
int collectable_collision(collectables *collectable, object *ship);
|
int collectable_collision(Collectable *collectable, Object *ship);
|
||||||
void collectable_explode(collectables *collectable);
|
void collectable_explode(Collectable *collectable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,19 +38,19 @@ void engine_init()
|
||||||
engine.smx = 0;
|
engine.smx = 0;
|
||||||
engine.smy = 0;
|
engine.smy = 0;
|
||||||
|
|
||||||
engine.bulletHead = new object;
|
engine.bulletHead = new Object;
|
||||||
engine.bulletHead->next = NULL;
|
engine.bulletHead->next = NULL;
|
||||||
engine.bulletTail = engine.bulletHead;
|
engine.bulletTail = engine.bulletHead;
|
||||||
|
|
||||||
engine.explosionHead = new object;
|
engine.explosionHead = new Object;
|
||||||
engine.explosionHead->next = NULL;
|
engine.explosionHead->next = NULL;
|
||||||
engine.explosionTail = engine.explosionHead;
|
engine.explosionTail = engine.explosionHead;
|
||||||
|
|
||||||
engine.collectableHead = new collectables;
|
engine.collectableHead = new Collectable;
|
||||||
engine.collectableHead->next = NULL;
|
engine.collectableHead->next = NULL;
|
||||||
engine.collectableTail = engine.collectableHead;
|
engine.collectableTail = engine.collectableHead;
|
||||||
|
|
||||||
engine.debrisHead = new object;
|
engine.debrisHead = new Object;
|
||||||
engine.debrisHead->next = NULL;
|
engine.debrisHead->next = NULL;
|
||||||
engine.debrisTail = engine.debrisHead;
|
engine.debrisTail = engine.debrisHead;
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ void engine_setMode()
|
||||||
|
|
||||||
void engine_resetLists()
|
void engine_resetLists()
|
||||||
{
|
{
|
||||||
object *ob, *ob2;
|
Object *ob, *ob2;
|
||||||
collectables *c1, *c2;
|
Collectable *c1, *c2;
|
||||||
bRect *r1, *r2;
|
bRect *r1, *r2;
|
||||||
|
|
||||||
ob = engine.bulletHead->next;
|
ob = engine.bulletHead->next;
|
||||||
|
|
16
src/engine.h
16
src/engine.h
|
@ -42,14 +42,14 @@ typedef struct Engine_ {
|
||||||
float smx;
|
float smx;
|
||||||
float smy;
|
float smy;
|
||||||
|
|
||||||
object *bulletHead;
|
Object *bulletHead;
|
||||||
object *bulletTail;
|
Object *bulletTail;
|
||||||
object *explosionHead;
|
Object *explosionHead;
|
||||||
object *explosionTail;
|
Object *explosionTail;
|
||||||
collectables *collectableHead;
|
Collectable *collectableHead;
|
||||||
collectables *collectableTail;
|
Collectable *collectableTail;
|
||||||
object *debrisHead;
|
Object *debrisHead;
|
||||||
object *debrisTail;
|
Object *debrisTail;
|
||||||
|
|
||||||
int cursor_x, cursor_y;
|
int cursor_x, cursor_y;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ to change frames on a 21, 14, 7 basis.
|
||||||
*/
|
*/
|
||||||
void explosion_add(float x, float y, int type)
|
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 = 1;
|
explosion->active = 1;
|
||||||
|
@ -45,7 +45,7 @@ void explosion_add(float x, float y, int type)
|
||||||
* This very simply just adds a tiny explosion at the coordinate specified.
|
* This very simply just adds a tiny explosion at the coordinate specified.
|
||||||
* It creates a small engine like effect.
|
* It creates a small engine like effect.
|
||||||
*/
|
*/
|
||||||
void explosion_addEngine(object *craft)
|
void explosion_addEngine(Object *craft)
|
||||||
{
|
{
|
||||||
if (CHANCE(0.5))
|
if (CHANCE(0.5))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,6 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define EXPLOSIONS_H
|
#define EXPLOSIONS_H
|
||||||
|
|
||||||
void explosion_add(float x, float y, int type);
|
void explosion_add(float x, float y, int type);
|
||||||
void explosion_addEngine(object *craft);
|
void explosion_addEngine(Object *craft);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
24
src/game.cpp
24
src/game.cpp
|
@ -189,14 +189,14 @@ static void game_addDebris(int x, int y, int amount)
|
||||||
else
|
else
|
||||||
audio_playSound(SFX_DEBRIS2, x, y);
|
audio_playSound(SFX_DEBRIS2, x, y);
|
||||||
|
|
||||||
object *debris;
|
Object *debris;
|
||||||
|
|
||||||
amount = RANDRANGE(3, amount);
|
amount = RANDRANGE(3, amount);
|
||||||
LIMIT(amount, 3, 8);
|
LIMIT(amount, 3, 8);
|
||||||
|
|
||||||
for (int i = 0 ; i < amount ; i++)
|
for (int i = 0 ; i < amount ; i++)
|
||||||
{
|
{
|
||||||
debris = new object;
|
debris = new Object;
|
||||||
|
|
||||||
debris->next = NULL;
|
debris->next = NULL;
|
||||||
debris->x = x;
|
debris->x = x;
|
||||||
|
@ -273,8 +273,8 @@ will be updated. Information will be displayed and appropriate player variables
|
||||||
*/
|
*/
|
||||||
static void game_doCollectables()
|
static void game_doCollectables()
|
||||||
{
|
{
|
||||||
collectables *collectable = engine.collectableHead;
|
Collectable *collectable = engine.collectableHead;
|
||||||
collectables *prevCollectable = engine.collectableHead;
|
Collectable *prevCollectable = engine.collectableHead;
|
||||||
engine.collectableTail = engine.collectableHead;
|
engine.collectableTail = engine.collectableHead;
|
||||||
char temp[40];
|
char temp[40];
|
||||||
|
|
||||||
|
@ -546,11 +546,11 @@ spawned.
|
||||||
*/
|
*/
|
||||||
static void game_doBullets()
|
static void game_doBullets()
|
||||||
{
|
{
|
||||||
object *bullet = engine.bulletHead;
|
Object *bullet = engine.bulletHead;
|
||||||
object *prevBullet = engine.bulletHead;
|
Object *prevBullet = engine.bulletHead;
|
||||||
|
|
||||||
collectables *collectable;
|
Collectable *collectable;
|
||||||
collectables *prevCollectable;
|
Collectable *prevCollectable;
|
||||||
|
|
||||||
int okayToHit = 0;
|
int okayToHit = 0;
|
||||||
int old_shield;
|
int old_shield;
|
||||||
|
@ -1561,8 +1561,8 @@ static void game_doCargo()
|
||||||
|
|
||||||
static void game_doDebris()
|
static void game_doDebris()
|
||||||
{
|
{
|
||||||
object *prevDebris = engine.debrisHead;
|
Object *prevDebris = engine.debrisHead;
|
||||||
object *debris = engine.debrisHead;
|
Object *debris = engine.debrisHead;
|
||||||
engine.debrisTail = engine.debrisHead;
|
engine.debrisTail = engine.debrisHead;
|
||||||
|
|
||||||
while (debris->next != NULL)
|
while (debris->next != NULL)
|
||||||
|
@ -1604,8 +1604,8 @@ the explosion is killed off.
|
||||||
*/
|
*/
|
||||||
void game_doExplosions()
|
void game_doExplosions()
|
||||||
{
|
{
|
||||||
object *prevExplosion = engine.explosionHead;
|
Object *prevExplosion = engine.explosionHead;
|
||||||
object *explosion = engine.explosionHead;
|
Object *explosion = engine.explosionHead;
|
||||||
engine.explosionTail = engine.explosionHead;
|
engine.explosionTail = engine.explosionHead;
|
||||||
|
|
||||||
while (explosion->next != NULL)
|
while (explosion->next != NULL)
|
||||||
|
|
|
@ -508,7 +508,7 @@ void mission_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Sets the currentMission object to the mission number the player
|
Sets the currentMission Object to the mission number the player
|
||||||
is currently on. Timing is assigned if it is required. The rate
|
is currently on. Timing is assigned if it is required. The rate
|
||||||
at which to add enemies in this mission is also set.
|
at which to add enemies in this mission is also set.
|
||||||
*/
|
*/
|
||||||
|
@ -718,7 +718,7 @@ void mission_updateRequirements(int type, int id, int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't evaluate secondary objectives at the same time!
|
// Don't evaluate secondary Objectives at the same time!
|
||||||
if (matched)
|
if (matched)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ int mission_checkCompleted()
|
||||||
int add = 0;
|
int add = 0;
|
||||||
int allDone = 1;
|
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;
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
|
@ -949,7 +949,7 @@ int mission_checkCompleted()
|
||||||
|
|
||||||
remaining = currentMission.remainingObjectives1 + currentMission.remainingObjectives2;
|
remaining = currentMission.remainingObjectives1 + currentMission.remainingObjectives2;
|
||||||
|
|
||||||
// We've only got one objective left and it's destroy all targets,
|
// We've only got one Objective left and it's destroy all targets,
|
||||||
// so stop adding aliens (otherwise it might be impossible to finish!)
|
// so stop adding aliens (otherwise it might be impossible to finish!)
|
||||||
if ((add) && (remaining == 1))
|
if ((add) && (remaining == 1))
|
||||||
engine.addAliens = -1;
|
engine.addAliens = -1;
|
||||||
|
@ -1017,7 +1017,7 @@ static void mission_drawScreen()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Simply displays a screen with all the mission information on it, pulled
|
Simply displays a screen with all the mission information on it, pulled
|
||||||
back from the data stored in the currentMission object. The music for the
|
back from the data stored in the currentMission Object. The music for the
|
||||||
mission begins playing here.
|
mission begins playing here.
|
||||||
*/
|
*/
|
||||||
void mission_showStartScreen()
|
void mission_showStartScreen()
|
||||||
|
@ -1117,7 +1117,7 @@ void mission_showStartScreen()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Display a screen showing all the information from the mission
|
Display a screen showing all the information from the mission
|
||||||
the player has just done. This includes objectives that have been
|
the player has just done. This includes Objectives that have been
|
||||||
completed and failed. A mission timer is also displayed at the bottom
|
completed and failed. A mission timer is also displayed at the bottom
|
||||||
of the screen.
|
of the screen.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
object player;
|
Object player;
|
||||||
int player_chargerFired = 0;
|
int player_chargerFired = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -74,7 +74,7 @@ void player_checkShockDamage(float x, float y)
|
||||||
float distY = fabsf(y - player.y);
|
float distY = fabsf(y - player.y);
|
||||||
|
|
||||||
// Don't let the player be hurt by an explosion after they have completed
|
// Don't let the player be hurt by an explosion after they have completed
|
||||||
// all the mission objectives. That would be *really* annoying!
|
// all the mission Objectives. That would be *really* annoying!
|
||||||
if ((engine.cheatShield) || (engine.missionCompleteTimer != 0))
|
if ((engine.cheatShield) || (engine.missionCompleteTimer != 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef PLAYER_H
|
#ifndef PLAYER_H
|
||||||
#define PLAYER_H
|
#define PLAYER_H
|
||||||
|
|
||||||
extern object player;
|
extern Object player;
|
||||||
extern int player_chargerFired;
|
extern int player_chargerFired;
|
||||||
|
|
||||||
extern void initPlayer();
|
extern void initPlayer();
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
int 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;
|
||||||
|
@ -43,7 +43,7 @@ int ship_collision(object *ship, object *otherShip)
|
||||||
/*
|
/*
|
||||||
Fill in later...
|
Fill in later...
|
||||||
*/
|
*/
|
||||||
void ship_fireBullet(object *ship, int weaponType)
|
void ship_fireBullet(Object *ship, int weaponType)
|
||||||
{
|
{
|
||||||
if (ship->reload[weaponType] > 0)
|
if (ship->reload[weaponType] > 0)
|
||||||
return;
|
return;
|
||||||
|
@ -54,7 +54,7 @@ void ship_fireBullet(object *ship, int weaponType)
|
||||||
if ((ship == &player) && (weaponType == 1) && (!engine.cheatAmmo))
|
if ((ship == &player) && (weaponType == 1) && (!engine.cheatAmmo))
|
||||||
player.ammo[1]--;
|
player.ammo[1]--;
|
||||||
|
|
||||||
object *theWeapon = &weapon[ship->weaponType[weaponType]];
|
Object *theWeapon = &weapon[ship->weaponType[weaponType]];
|
||||||
|
|
||||||
switch(theWeapon->id)
|
switch(theWeapon->id)
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ void ship_fireBullet(object *ship, int weaponType)
|
||||||
/*
|
/*
|
||||||
Fill in later...
|
Fill in later...
|
||||||
*/
|
*/
|
||||||
void ship_fireRay(object *ship)
|
void ship_fireRay(Object *ship)
|
||||||
{
|
{
|
||||||
SDL_Rect ray;
|
SDL_Rect ray;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef SHIP_H
|
#ifndef SHIP_H
|
||||||
#define SHIP_H
|
#define SHIP_H
|
||||||
|
|
||||||
int 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);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,14 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef STRUCTS_H
|
#ifndef STRUCTS_H
|
||||||
#define STRUCTS_H
|
#define STRUCTS_H
|
||||||
|
|
||||||
typedef struct object_ {
|
typedef struct Object_ {
|
||||||
|
|
||||||
int 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
|
||||||
|
|
||||||
int id; // The "job" of the object
|
int id; // The "job" of the Object
|
||||||
struct object_ *target; // index target in aliens array
|
struct Object_ *target; // index target in aliens array
|
||||||
|
|
||||||
int reload[2];
|
int reload[2];
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ typedef struct object_ {
|
||||||
|
|
||||||
int face; // Either 0 or 1
|
int face; // Either 0 or 1
|
||||||
|
|
||||||
struct object_ *owner; // Who owns this object
|
struct Object_ *owner; // Who owns this Object
|
||||||
|
|
||||||
int chance[2]; // Chance of using the weapons (out of 1000)
|
int chance[2]; // Chance of using the weapons (out of 1000)
|
||||||
|
|
||||||
|
@ -53,20 +53,20 @@ typedef struct object_ {
|
||||||
int engineX; // The place for the engine on the other side of the craft
|
int engineX; // The place for the engine on the other side of the craft
|
||||||
int engineY; // The middle of the engine on the craft
|
int engineY; // The middle of the engine on the craft
|
||||||
|
|
||||||
int thinktime; // When the object will next react
|
int thinktime; // When the Object will next react
|
||||||
int weaponType[2]; // Weapon types
|
int weaponType[2]; // Weapon types
|
||||||
|
|
||||||
int collectChance; // Chance of dropping the object
|
int collectChance; // Chance of dropping the Object
|
||||||
int collectType; // What the object is carrying
|
int collectType; // What the Object is carrying
|
||||||
int collectValue; // What it is worth
|
int collectValue; // What it is worth
|
||||||
|
|
||||||
unsigned long int flags; // Various flags for an object
|
unsigned long int flags; // Various flags for an Object
|
||||||
|
|
||||||
float x, y, dx, dy;
|
float x, y, dx, dy;
|
||||||
|
|
||||||
struct object_ *next;
|
struct Object_ *next;
|
||||||
|
|
||||||
} object;
|
} Object;
|
||||||
|
|
||||||
typedef struct Mission_ {
|
typedef struct Mission_ {
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ typedef struct Star_ {
|
||||||
|
|
||||||
} Star;
|
} Star;
|
||||||
|
|
||||||
typedef struct collectables_ {
|
typedef struct Collectable_ {
|
||||||
|
|
||||||
int active;
|
int active;
|
||||||
float x, y, dx, dy;
|
float x, y, dx, dy;
|
||||||
|
@ -106,9 +106,9 @@ typedef struct collectables_ {
|
||||||
int value; // How much is it worth?
|
int value; // How much is it worth?
|
||||||
int life; // How long it will stay around for
|
int life; // How long it will stay around for
|
||||||
|
|
||||||
struct collectables_ *next;
|
struct Collectable_ *next;
|
||||||
|
|
||||||
} collectables;
|
} Collectable;
|
||||||
|
|
||||||
typedef struct textObject_ {
|
typedef struct textObject_ {
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ typedef struct textObject_ {
|
||||||
} textObject;
|
} textObject;
|
||||||
|
|
||||||
typedef struct Game_ {
|
typedef struct Game_ {
|
||||||
object thePlayer;
|
Object thePlayer;
|
||||||
object playerWeapon;
|
Object playerWeapon;
|
||||||
|
|
||||||
int saveFormat;
|
int saveFormat;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
object weapon[W_MAX];
|
Object weapon[W_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A list of predefined weaponary.
|
A list of predefined weaponary.
|
||||||
|
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef WEAPONS_H
|
#ifndef WEAPONS_H
|
||||||
#define WEAPONS_H
|
#define WEAPONS_H
|
||||||
|
|
||||||
extern object weapon[W_MAX];
|
extern Object weapon[W_MAX];
|
||||||
|
|
||||||
extern void initWeapons();
|
extern void initWeapons();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue