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:
onpon4 2016-11-25 12:37:26 -05:00
parent de1cd7c674
commit dc7209164a
21 changed files with 109 additions and 109 deletions

View File

@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
#include "radio.h"
object alien_defs[CD_MAX];
object aliens[ALIEN_MAX];
Object alien_defs[CD_MAX];
Object aliens[ALIEN_MAX];
static const int nChrisKillMessage = 15;
static const char *chrisKillMessage[nChrisKillMessage] = {
@ -1217,7 +1217,7 @@ int alien_add()
return 1;
}
void alien_addDrone(object *hostAlien)
void alien_addDrone(Object *hostAlien)
{
int index = alien_getFreeIndex();
@ -1238,7 +1238,7 @@ void alien_addDrone(object *hostAlien)
aliens[index].y = hostAlien->y + rand() % 50;
}
void alien_addSmallAsteroid(object *hostAlien)
void alien_addSmallAsteroid(Object *hostAlien)
{
if (engine.missionCompleteTimer != 0)
return;
@ -1305,7 +1305,7 @@ void alien_addFriendly(int type)
aliens[type].flags |= FL_IMMORTAL;
}
int alien_place(object *alien)
int alien_place(Object *alien)
{
if (rand() % 2 == 0)
alien->x = RANDRANGE(screen->w, screen->w * 2);
@ -1335,7 +1335,7 @@ int alien_place(object *alien)
return 1;
}
void alien_setAI(object *alien)
void alien_setAI(Object *alien)
{
int i;
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)
{
@ -1454,7 +1454,7 @@ void alien_setKlineAttackMethod(object *alien)
/*
This AI is exclusively for Kline.
*/
void alien_setKlineAI(object *alien)
void alien_setKlineAI(Object *alien)
{
// Weapon type change
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
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;
@ -1531,7 +1531,7 @@ void alien_searchForTarget(object *alien)
i = rand() % ALIEN_MAX;
object *targetEnemy = &aliens[i];
Object *targetEnemy = &aliens[i];
// 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)
@ -1577,7 +1577,7 @@ void alien_searchForTarget(object *alien)
/*
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
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
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++)
{
@ -1639,7 +1639,7 @@ int alien_enemiesInFront(object *alien)
return 0;
}
void alien_move(object *alien)
void alien_move(Object *alien)
{
int checkCollisions;
@ -1741,7 +1741,7 @@ void alien_move(object *alien)
/*
Fill in later...
*/
void alien_destroy(object *alien, object *attacker)
void alien_destroy(Object *alien, Object *attacker)
{
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;

View File

@ -20,24 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef ALIEN_H
#define ALIEN_H
extern object alien_defs[CD_MAX];
extern object aliens[ALIEN_MAX];
extern Object alien_defs[CD_MAX];
extern Object aliens[ALIEN_MAX];
void alien_defs_init();
void aliens_init();
int alien_add();
void alien_addDrone(object *hostAlien);
void alien_addSmallAsteroid(object *hostAlien);
void alien_addDrone(Object *hostAlien);
void alien_addSmallAsteroid(Object *hostAlien);
void alien_addFriendly(int type);
int alien_place(object *alien);
void alien_setAI(object *alien);
void alien_setKlineAttackMethod(object *alien);
void alien_setKlineAI(object *alien);
void alien_searchForTarget(object *alien);
int alien_checkTarget(object *alien);
int alien_enemiesInFront(object *alien);
void alien_move(object *alien);
void alien_destroy(object *alien, object *attacker);
void alien_hurt(object *alien, object *attacker, int damage, int ion);
int alien_place(Object *alien);
void alien_setAI(Object *alien);
void alien_setKlineAttackMethod(Object *alien);
void alien_setKlineAI(Object *alien);
void alien_searchForTarget(Object *alien);
int alien_checkTarget(Object *alien);
int alien_enemiesInFront(Object *alien);
void alien_move(Object *alien);
void alien_destroy(Object *alien, Object *attacker);
void alien_hurt(Object *alien, Object *attacker, int damage, int ion);
#endif

View File

@ -19,13 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 tempX, tempY, steps;
bullet = new object;
bullet = new Object;
if (attacker == &player)
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
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
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;
@ -182,7 +182,7 @@ object *bullet_getTarget(object *bullet)
return &aliens[i];
}
int bullet_collision(object *bullet, object *ship)
int bullet_collision(Object *bullet, Object *ship)
{
float x0 = bullet->x;
float y0 = bullet->y;

View File

@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef BULLETS_H
#define BULLETS_H
void bullet_add(object *theWeapon, object *attacker, int y, int dy);
object *bullet_getTarget(object *bullet);
int bullet_collision(object *bullet, object *ship);
void bullet_add(Object *theWeapon, Object *attacker, int y, int dy);
Object *bullet_getTarget(Object *bullet);
int bullet_collision(Object *bullet, Object *ship);
#endif

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
#include "radio.h"
object cargo[MAX_CARGO];
Object cargo[MAX_CARGO];
void cargo_init()
{
@ -45,7 +45,7 @@ static int cargo_get()
return -1;
}
object *cargo_add(object *owner, int cargoType)
Object *cargo_add(Object *owner, int cargoType)
{
int index = cargo_get();

View File

@ -20,10 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _CARGO_H_
#define _CARGO_H_
extern object cargo[MAX_CARGO];
extern Object cargo[MAX_CARGO];
void cargo_init();
object *cargo_add(object *owner, int cargoType);
Object *cargo_add(Object *owner, int cargoType);
void cargo_becomeCollectable(int i);
#endif

View File

@ -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->active = 1;
@ -206,7 +206,7 @@ void collectable_add(float x, float y, int type, int value, int life)
engine.collectableTail = collectable;
}
int collectable_collision(collectables *collectable, object *ship)
int collectable_collision(Collectable *collectable, Object *ship)
{
float x0 = collectable->x;
float y0 = collectable->y;
@ -227,7 +227,7 @@ int collectable_collision(collectables *collectable, object *ship)
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);

View File

@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define COLLECTABLE_H
void collectable_add(float x, float y, int type, int value, int life);
int collectable_collision(collectables *collectable, object *ship);
void collectable_explode(collectables *collectable);
int collectable_collision(Collectable *collectable, Object *ship);
void collectable_explode(Collectable *collectable);
#endif

View File

@ -38,19 +38,19 @@ void engine_init()
engine.smx = 0;
engine.smy = 0;
engine.bulletHead = new object;
engine.bulletHead = new Object;
engine.bulletHead->next = NULL;
engine.bulletTail = engine.bulletHead;
engine.explosionHead = new object;
engine.explosionHead = new Object;
engine.explosionHead->next = NULL;
engine.explosionTail = engine.explosionHead;
engine.collectableHead = new collectables;
engine.collectableHead = new Collectable;
engine.collectableHead->next = NULL;
engine.collectableTail = engine.collectableHead;
engine.debrisHead = new object;
engine.debrisHead = new Object;
engine.debrisHead->next = NULL;
engine.debrisTail = engine.debrisHead;
@ -250,8 +250,8 @@ void engine_setMode()
void engine_resetLists()
{
object *ob, *ob2;
collectables *c1, *c2;
Object *ob, *ob2;
Collectable *c1, *c2;
bRect *r1, *r2;
ob = engine.bulletHead->next;

View File

@ -42,14 +42,14 @@ typedef struct Engine_ {
float smx;
float smy;
object *bulletHead;
object *bulletTail;
object *explosionHead;
object *explosionTail;
collectables *collectableHead;
collectables *collectableTail;
object *debrisHead;
object *debrisTail;
Object *bulletHead;
Object *bulletTail;
Object *explosionHead;
Object *explosionTail;
Collectable *collectableHead;
Collectable *collectableTail;
Object *debrisHead;
Object *debrisTail;
int cursor_x, cursor_y;

View File

@ -27,7 +27,7 @@ to change frames on a 21, 14, 7 basis.
*/
void explosion_add(float x, float y, int type)
{
object *explosion = new object;
Object *explosion = new Object;
explosion->next = NULL;
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.
* It creates a small engine like effect.
*/
void explosion_addEngine(object *craft)
void explosion_addEngine(Object *craft)
{
if (CHANCE(0.5))
return;

View File

@ -21,6 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EXPLOSIONS_H
void explosion_add(float x, float y, int type);
void explosion_addEngine(object *craft);
void explosion_addEngine(Object *craft);
#endif

View File

@ -189,14 +189,14 @@ static void game_addDebris(int x, int y, int amount)
else
audio_playSound(SFX_DEBRIS2, x, y);
object *debris;
Object *debris;
amount = RANDRANGE(3, amount);
LIMIT(amount, 3, 8);
for (int i = 0 ; i < amount ; i++)
{
debris = new object;
debris = new Object;
debris->next = NULL;
debris->x = x;
@ -273,8 +273,8 @@ will be updated. Information will be displayed and appropriate player variables
*/
static void game_doCollectables()
{
collectables *collectable = engine.collectableHead;
collectables *prevCollectable = engine.collectableHead;
Collectable *collectable = engine.collectableHead;
Collectable *prevCollectable = engine.collectableHead;
engine.collectableTail = engine.collectableHead;
char temp[40];
@ -546,11 +546,11 @@ spawned.
*/
static void game_doBullets()
{
object *bullet = engine.bulletHead;
object *prevBullet = engine.bulletHead;
Object *bullet = engine.bulletHead;
Object *prevBullet = engine.bulletHead;
collectables *collectable;
collectables *prevCollectable;
Collectable *collectable;
Collectable *prevCollectable;
int okayToHit = 0;
int old_shield;
@ -1561,8 +1561,8 @@ static void game_doCargo()
static void game_doDebris()
{
object *prevDebris = engine.debrisHead;
object *debris = engine.debrisHead;
Object *prevDebris = engine.debrisHead;
Object *debris = engine.debrisHead;
engine.debrisTail = engine.debrisHead;
while (debris->next != NULL)
@ -1604,8 +1604,8 @@ the explosion is killed off.
*/
void game_doExplosions()
{
object *prevExplosion = engine.explosionHead;
object *explosion = engine.explosionHead;
Object *prevExplosion = engine.explosionHead;
Object *explosion = engine.explosionHead;
engine.explosionTail = engine.explosionHead;
while (explosion->next != NULL)

View File

@ -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
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)
return;
@ -914,7 +914,7 @@ int mission_checkCompleted()
int add = 0;
int allDone = 1;
// Zero objective list for a recount
// Zero Objective list for a recount
currentMission.remainingObjectives1 = currentMission.remainingObjectives2 = 0;
for (int i = 0 ; i < 3 ; i++)
@ -949,7 +949,7 @@ int mission_checkCompleted()
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!)
if ((add) && (remaining == 1))
engine.addAliens = -1;
@ -1017,7 +1017,7 @@ static void mission_drawScreen()
/*
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.
*/
void mission_showStartScreen()
@ -1117,7 +1117,7 @@ void mission_showStartScreen()
/*
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
of the screen.
*/

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
object player;
Object player;
int player_chargerFired = 0;
/*
@ -74,7 +74,7 @@ void player_checkShockDamage(float x, float y)
float distY = fabsf(y - player.y);
// 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))
return;

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PLAYER_H
#define PLAYER_H
extern object player;
extern Object player;
extern int player_chargerFired;
extern void initPlayer();

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
int ship_collision(object *ship, object *otherShip)
int ship_collision(Object *ship, Object *otherShip)
{
float x0 = ship->x;
float y0 = ship->y;
@ -43,7 +43,7 @@ int ship_collision(object *ship, object *otherShip)
/*
Fill in later...
*/
void ship_fireBullet(object *ship, int weaponType)
void ship_fireBullet(Object *ship, int weaponType)
{
if (ship->reload[weaponType] > 0)
return;
@ -54,7 +54,7 @@ void ship_fireBullet(object *ship, int weaponType)
if ((ship == &player) && (weaponType == 1) && (!engine.cheatAmmo))
player.ammo[1]--;
object *theWeapon = &weapon[ship->weaponType[weaponType]];
Object *theWeapon = &weapon[ship->weaponType[weaponType]];
switch(theWeapon->id)
{
@ -139,7 +139,7 @@ void ship_fireBullet(object *ship, int weaponType)
/*
Fill in later...
*/
void ship_fireRay(object *ship)
void ship_fireRay(Object *ship)
{
SDL_Rect ray;

View File

@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHIP_H
#define SHIP_H
int ship_collision(object *ship, object *otherShip);
void ship_fireBullet(object *ship, int weaponType);
void ship_fireRay(object *ship);
int ship_collision(Object *ship, Object *otherShip);
void ship_fireBullet(Object *ship, int weaponType);
void ship_fireRay(Object *ship);
#endif

View File

@ -20,14 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef STRUCTS_H
#define STRUCTS_H
typedef struct object_ {
typedef struct Object_ {
int active;
int classDef; // Used by aliens to determine what they are
int AIType; // Type of articifial intelligence
int id; // The "job" of the object
struct object_ *target; // index target in aliens array
int id; // The "job" of the Object
struct Object_ *target; // index target in aliens array
int reload[2];
@ -42,7 +42,7 @@ typedef struct object_ {
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)
@ -53,20 +53,20 @@ typedef struct object_ {
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 thinktime; // When the object will next react
int thinktime; // When the Object will next react
int weaponType[2]; // Weapon types
int collectChance; // Chance of dropping the object
int collectType; // What the object is carrying
int collectChance; // Chance of dropping the Object
int collectType; // What the Object is carrying
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;
struct object_ *next;
struct Object_ *next;
} object;
} Object;
typedef struct Mission_ {
@ -97,7 +97,7 @@ typedef struct Star_ {
} Star;
typedef struct collectables_ {
typedef struct Collectable_ {
int active;
float x, y, dx, dy;
@ -106,9 +106,9 @@ typedef struct collectables_ {
int value; // How much is it worth?
int life; // How long it will stay around for
struct collectables_ *next;
struct Collectable_ *next;
} collectables;
} Collectable;
typedef struct textObject_ {
@ -121,8 +121,8 @@ typedef struct textObject_ {
} textObject;
typedef struct Game_ {
object thePlayer;
object playerWeapon;
Object thePlayer;
Object playerWeapon;
int saveFormat;

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
object weapon[W_MAX];
Object weapon[W_MAX];
/*
A list of predefined weaponary.

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WEAPONS_H
#define WEAPONS_H
extern object weapon[W_MAX];
extern Object weapon[W_MAX];
extern void initWeapons();