Bring sanity to the header files.
Most .h files were not used to declare the externally visible variables and functions of the .cpp files, but only to #include things and declare things that were needed by that .cpp file itself. This resulted in a lot of duplication. Now the .h files only declare what is externally visible from the corresponding .cpp files. Starfighter.h includes all the other .h files, and all .cpp files only #include "Starfighter.h". Functions and variables that were not used outside the .cpp file that contained them were marked static. Variables defined in .h files were moved to the appropriate .cpp files.
This commit is contained in:
parent
8b34e90bcf
commit
6ea4744832
|
@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "version.h"
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
@ -18,8 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __STARFIGHTER_H__
|
||||||
|
#define __STARFIGHTER_H__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL/SDL_image.h>
|
#include <SDL/SDL_image.h>
|
||||||
|
@ -29,42 +37,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
|
|
||||||
extern void initSystem();
|
#include "ai.h"
|
||||||
extern void loadGameGraphics();
|
#include "aliens.h"
|
||||||
extern void loadSound();
|
#include "audio.h"
|
||||||
extern void initWeapons();
|
#include "bullets.h"
|
||||||
extern void initMissions();
|
#include "cargo.h"
|
||||||
extern void initVars();
|
#include "collectable.h"
|
||||||
extern void showStory();
|
#include "comms.h"
|
||||||
extern int doTitle();
|
#include "debris.h"
|
||||||
extern void defineAliens();
|
#include "events.h"
|
||||||
extern void loadFont();
|
#include "explosions.h"
|
||||||
extern int galaxyMap();
|
#include "game.h"
|
||||||
extern void defineGlobals();
|
#include "globals.h"
|
||||||
extern void cleanUp();
|
#include "graphics.h"
|
||||||
extern int mainGameLoop();
|
#include "init.h"
|
||||||
extern void setAllyMessages();
|
#include "intermission.h"
|
||||||
extern void newGame();
|
#include "loadSave.h"
|
||||||
extern void doCredits();
|
#include "messages.h"
|
||||||
extern void getPlayerInput();
|
#include "misc.h"
|
||||||
extern void initPlanetMissions(signed char system);
|
#include "missions.h"
|
||||||
extern void updateSystemStatus();
|
#include "player.h"
|
||||||
extern void doCutscene(int scene);
|
#include "resources.h"
|
||||||
|
#include "script.h"
|
||||||
|
#include "shop.h"
|
||||||
|
#include "title.h"
|
||||||
|
#include "unpack.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "weapons.h"
|
||||||
|
|
||||||
globalEngineVariables engine;
|
#endif
|
||||||
devVariables dev;
|
|
||||||
Game currentGame;
|
|
||||||
object player;
|
|
||||||
mission currentMission;
|
|
||||||
Graphics graphics;
|
|
||||||
|
|
||||||
object enemy[MAX_ALIENS];
|
|
||||||
Star star[200];
|
|
||||||
Planet systemPlanet[10];
|
|
||||||
mission missions[MAX_MISSIONS];
|
|
||||||
ShopItem shopItems[MAX_SHOPITEMS];
|
|
||||||
Mix_Chunk *sound[MAX_SOUNDS];
|
|
||||||
object weapon[MAX_WEAPONS];
|
|
||||||
object cargo[MAX_CARGO];
|
|
||||||
event gameEvent[10];
|
|
||||||
cutMsg cutMessage[10];
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ai.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some very simple artificial intelligence routines for the aliens.
|
Some very simple artificial intelligence routines for the aliens.
|
||||||
|
|
20
code/ai.h
20
code/ai.h
|
@ -18,20 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void setEnemyAI(object *theEnemy);
|
||||||
#include <string.h>
|
extern void setKlineAttackMethod(object *theEnemy);
|
||||||
#include <math.h>
|
extern void setKlineAI(object *theEnemy);
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern object player;
|
|
||||||
extern Game currentGame;
|
|
||||||
|
|
|
@ -18,9 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "aliens.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
bool placeAlien(object *theEnemy)
|
object defEnemy[MAX_DEFALIENS];
|
||||||
|
object enemy[MAX_ALIENS];
|
||||||
|
|
||||||
|
static bool placeAlien(object *theEnemy)
|
||||||
{
|
{
|
||||||
if (rand() % 2 == 0)
|
if (rand() % 2 == 0)
|
||||||
theEnemy->x = Math::rrand(800, 1600);
|
theEnemy->x = Math::rrand(800, 1600);
|
||||||
|
@ -55,7 +58,7 @@ This simply pulls back an alien from the array that is
|
||||||
"dead" (no shield) and returns the index number so we can have
|
"dead" (no shield) and returns the index number so we can have
|
||||||
a new one.
|
a new one.
|
||||||
*/
|
*/
|
||||||
int getAlien()
|
static int getAlien()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < engine.maxAliens ; i++)
|
for (int i = 0 ; i < engine.maxAliens ; i++)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +71,7 @@ int getAlien()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDrone(object *host)
|
static void addDrone(object *host)
|
||||||
{
|
{
|
||||||
int index = getAlien();
|
int index = getAlien();
|
||||||
|
|
||||||
|
@ -89,7 +92,7 @@ void addDrone(object *host)
|
||||||
enemy[index].y = host->y + rand() % 50;
|
enemy[index].y = host->y + rand() % 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSmallAsteroid(object *host)
|
static void addSmallAsteroid(object *host)
|
||||||
{
|
{
|
||||||
if (engine.missionCompleteTimer != 0)
|
if (engine.missionCompleteTimer != 0)
|
||||||
return;
|
return;
|
||||||
|
@ -280,7 +283,7 @@ bool addAlien()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getPreDefinedAliens()
|
static void getPreDefinedAliens()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char string[255];
|
char string[255];
|
||||||
|
@ -460,7 +463,7 @@ void getPreDefinedAliens()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addFriendly(int type)
|
static void addFriendly(int type)
|
||||||
{
|
{
|
||||||
if (type != FR_SID)
|
if (type != FR_SID)
|
||||||
enemy[type] = defEnemy[CD_FRIEND];
|
enemy[type] = defEnemy[CD_FRIEND];
|
||||||
|
@ -649,7 +652,7 @@ void initAliens()
|
||||||
"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 searchForTarget(object *theEnemy)
|
static void searchForTarget(object *theEnemy)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -708,7 +711,7 @@ void searchForTarget(object *theEnemy)
|
||||||
theEnemy->target = targetEnemy;
|
theEnemy->target = targetEnemy;
|
||||||
}
|
}
|
||||||
|
|
||||||
int traceTarget(object *theEnemy)
|
static int traceTarget(object *theEnemy)
|
||||||
{
|
{
|
||||||
// Do various checks to see if the alien can fire at
|
// Do various checks to see if the alien can fire at
|
||||||
// the target. Start with the most obvious checks.
|
// the target. Start with the most obvious checks.
|
||||||
|
@ -751,7 +754,7 @@ int traceTarget(object *theEnemy)
|
||||||
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 traceView(object *theEnemy)
|
static int traceView(object *theEnemy)
|
||||||
{
|
{
|
||||||
object *anEnemy = enemy;
|
object *anEnemy = enemy;
|
||||||
|
|
||||||
|
@ -774,7 +777,7 @@ int traceView(object *theEnemy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveAndSeparate(object *theEnemy)
|
static void moveAndSeparate(object *theEnemy)
|
||||||
{
|
{
|
||||||
bool checkCollisions = true;
|
bool checkCollisions = true;
|
||||||
bool hasCollided = false;
|
bool hasCollided = false;
|
||||||
|
@ -1258,7 +1261,7 @@ void setAlienShapes()
|
||||||
|
|
||||||
#if USEPACK
|
#if USEPACK
|
||||||
|
|
||||||
void loadAliens()
|
static void loadAliens()
|
||||||
{
|
{
|
||||||
int dataLocation = locateDataInPak("data/aliens.dat", 1);
|
int dataLocation = locateDataInPak("data/aliens.dat", 1);
|
||||||
int def, ai, speed, shield, max, image1, image2, weapon1, weapon2, chance1, chance2, score;
|
int def, ai, speed, shield, max, image1, image2, weapon1, weapon2, chance1, chance2, score;
|
||||||
|
@ -1313,7 +1316,7 @@ void defineAliens(){loadAliens();}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void saveAliens()
|
static void saveAliens()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
|
|
@ -18,41 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern object defEnemy[MAX_DEFALIENS];
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void setEnemyAI(object *theEnemy);
|
|
||||||
extern void setKlineAI(object *theEnemy);
|
|
||||||
extern void fireBullet(object *attacker, int weaponType);
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
|
||||||
extern void addEngine(object *craft);
|
|
||||||
extern void fireRay(object *attacker);
|
|
||||||
extern void addDebris(int x, int y, int amount);
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern object *addCargo(object *owner, int cargoType);
|
|
||||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
|
||||||
extern void updateMissionRequirements(int type, int id, int value);
|
|
||||||
extern void setInfoLine(const char *in, int color);
|
|
||||||
extern void addBullet(object *theWeapon, object *attacker, int y, int dy);
|
|
||||||
extern void showErrorAndExit(int errorId, const char *name);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern object player;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
extern object enemy[MAX_ALIENS];
|
||||||
extern Graphics graphics;
|
|
||||||
extern mission currentMission;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
|
|
||||||
object defEnemy[MAX_DEFALIENS]; // A predefined enemy
|
extern bool addAlien();
|
||||||
|
extern void setTarget(int index);
|
||||||
|
extern void initAliens();
|
||||||
|
extern void killAllAliens();
|
||||||
|
extern void doAliens();
|
||||||
|
extern void setAlienShapes();
|
||||||
|
extern void defineAliens();
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "audio.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
Mix_Chunk *sound[MAX_SOUNDS];
|
||||||
|
|
||||||
void playSound(int sid)
|
void playSound(int sid)
|
||||||
{
|
{
|
||||||
|
|
20
code/audio.h
20
code/audio.h
|
@ -18,19 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
extern void unpack(const char *file, signed char fileType);
|
|
||||||
extern void freePackBuffer();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Mix_Chunk *sound[MAX_SOUNDS];
|
extern Mix_Chunk *sound[MAX_SOUNDS];
|
||||||
|
|
||||||
|
extern void playSound(int sid);
|
||||||
|
extern Mix_Chunk *loadSound(const char *filename);
|
||||||
|
extern void loadMusic(const char *filename);
|
||||||
|
extern void playRandomTrack();
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bullets.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void addBullet(object *theWeapon, object *attacker, int y, int dy)
|
void addBullet(object *theWeapon, object *attacker, int y, int dy)
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ one attempt per call (one call per frame) to find a suitable target. If the targ
|
||||||
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 *getRandomEnemy(object *bullet)
|
static object *getRandomEnemy(object *bullet)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ object *getRandomEnemy(object *bullet)
|
||||||
/*
|
/*
|
||||||
Fill in later...
|
Fill in later...
|
||||||
*/
|
*/
|
||||||
void destroyAlien(object *bullet, object *theEnemy)
|
static void destroyAlien(object *bullet, object *theEnemy)
|
||||||
{
|
{
|
||||||
playSound(SFX_EXPLOSION);
|
playSound(SFX_EXPLOSION);
|
||||||
|
|
||||||
|
|
|
@ -18,37 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void addBullet(object *theWeapon, object *attacker, int y, int dy);
|
||||||
#include <string.h>
|
extern void fireBullet(object *attacker, int weaponType);
|
||||||
#include <math.h>
|
extern char checkPlayerShockDamage(float x, float y);
|
||||||
|
extern void fireRay(object *attacker);
|
||||||
#include <SDL/SDL.h>
|
extern void doBullets();
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern void updateMissionRequirements(int type, int id, int value);
|
|
||||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
|
||||||
extern void generateShockWave(object *bullet);
|
|
||||||
extern void setInfoLine(const char *in, int color);
|
|
||||||
extern void getKillMessage(object *ally);
|
|
||||||
extern void getMissFireMessage(object *ally);
|
|
||||||
extern void getPlayerHitMessage(object *ally);
|
|
||||||
extern void checkMineBulletCollisions(object *bullet);
|
|
||||||
extern void setKlineAttackMethod(object *theEnemy);
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
extern object player;
|
|
||||||
extern mission currentMission;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern object cargo[20];
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cargo.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
object cargo[MAX_CARGO];
|
||||||
|
|
||||||
void initCargo()
|
void initCargo()
|
||||||
{
|
{
|
||||||
|
@ -32,7 +34,7 @@ void initCargo()
|
||||||
/*
|
/*
|
||||||
* I think you all know what this does by now! ;)
|
* I think you all know what this does by now! ;)
|
||||||
*/
|
*/
|
||||||
int getCargo()
|
static int getCargo()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < MAX_CARGO ; i++)
|
for (int i = 0 ; i < MAX_CARGO ; i++)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +66,7 @@ object *addCargo(object *owner, int cargoType)
|
||||||
return &cargo[index];
|
return &cargo[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void becomeCollectable(int i)
|
static void becomeCollectable(int i)
|
||||||
{
|
{
|
||||||
if (cargo[i].collectType != P_PHOEBE)
|
if (cargo[i].collectType != P_PHOEBE)
|
||||||
{
|
{
|
||||||
|
|
23
code/cargo.h
23
code/cargo.h
|
@ -18,23 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern object player;
|
|
||||||
extern object cargo[MAX_CARGO];
|
extern object cargo[MAX_CARGO];
|
||||||
|
|
||||||
|
extern void initCargo();
|
||||||
|
extern object *addCargo(object *owner, int cargoType);
|
||||||
|
extern void doCargo();
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "collectable.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a new collectable item based on supplied arguments.
|
Create a new collectable item based on supplied arguments.
|
||||||
|
@ -161,7 +161,7 @@ void addCollectable(float x, float y, int type, int value, int life)
|
||||||
engine.collectableTail = collectable;
|
engine.collectableTail = collectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void explodeMine(collectables *collectable)
|
static void explodeMine(collectables *collectable)
|
||||||
{
|
{
|
||||||
if ((collectable->x >= 0) && (collectable->x <= 800) && (collectable->y >= 0) && (collectable->y <= 600))
|
if ((collectable->x >= 0) && (collectable->x <= 800) && (collectable->y >= 0) && (collectable->y <= 600))
|
||||||
playSound(SFX_EXPLOSION);
|
playSound(SFX_EXPLOSION);
|
||||||
|
|
|
@ -18,26 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void addCollectable(float x, float y, int type, int value, int life);
|
||||||
#include <string.h>
|
extern void checkMineBulletCollisions(object *bullet);
|
||||||
|
extern void doCollectables();
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void updateMissionRequirements(int type, int id, int value);
|
|
||||||
extern void setInfoLine(const char *in, int color);
|
|
||||||
extern object *addCargo(object *owner, int cargoType);
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern char checkPlayerShockDamage(float x, float y);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "comms.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void updateCommsSurface(SDL_Surface *comms)
|
void updateCommsSurface(SDL_Surface *comms)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ void createCommsSurface(SDL_Surface *comms)
|
||||||
updateCommsSurface(comms);
|
updateCommsSurface(comms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createMissionDetailSurface(SDL_Surface *comms, int missionSlot)
|
static void createMissionDetailSurface(SDL_Surface *comms, int missionSlot)
|
||||||
{
|
{
|
||||||
char name[50];
|
char name[50];
|
||||||
char string[2000];
|
char string[2000];
|
||||||
|
|
21
code/comms.h
21
code/comms.h
|
@ -18,21 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void updateCommsSurface(SDL_Surface *comms);
|
||||||
#include <string.h>
|
extern void createCommsSurface(SDL_Surface *comms);
|
||||||
|
extern void doComms(SDL_Surface *comms);
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern int getFace(const char *face);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Planet systemPlanet[10];
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debris.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void addDebris(int x, int y, int amount)
|
void addDebris(int x, int y, int amount)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,19 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void addDebris(int x, int y, int amount);
|
||||||
#include <string.h>
|
extern void doDebris();
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
|
||||||
extern void playSound(int sid);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "events.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
static char lastKeyEvents[] = " ";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Checked during the main game loop. When the game is paused
|
Checked during the main game loop. When the game is paused
|
||||||
|
@ -46,7 +48,7 @@ bool checkPauseRequest()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compareLastKeyInputs()
|
static void compareLastKeyInputs()
|
||||||
{
|
{
|
||||||
if (strstr(lastKeyEvents, "humansdoitbetter") != NULL)
|
if (strstr(lastKeyEvents, "humansdoitbetter") != NULL)
|
||||||
{engine.cheat = true; memset(lastKeyEvents, ' ', 25);}
|
{engine.cheat = true; memset(lastKeyEvents, ' ', 25);}
|
||||||
|
|
|
@ -18,20 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern bool checkPauseRequest();
|
||||||
#include <string.h>
|
extern void addKeyEvent(const char *keyName);
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
extern void getPlayerInput();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern devVariables dev;
|
|
||||||
|
|
||||||
char lastKeyEvents[] = " ";
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "explosions.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a new explosion based on supplied parameters.
|
Create a new explosion based on supplied parameters.
|
||||||
|
|
|
@ -18,20 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void addExplosion(float x, float y, int type);
|
||||||
#include <string.h>
|
extern void addEngine(object *craft);
|
||||||
|
extern void doExplosions();
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern int isOnScreen(int x, int y, int w, int h);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "game.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
Game currentGame;
|
||||||
|
|
||||||
void newGame()
|
void newGame()
|
||||||
{
|
{
|
||||||
|
|
57
code/game.h
57
code/game.h
|
@ -18,58 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void resetLists();
|
|
||||||
extern void setMission(int mission);
|
|
||||||
extern void missionBriefScreen();
|
|
||||||
extern void initPlayer();
|
|
||||||
extern void initAliens();
|
|
||||||
extern signed char allMissionsCompleted();
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void leaveSector();
|
|
||||||
extern void doStarfield();
|
|
||||||
extern void doCollectables();
|
|
||||||
extern void doCargo();
|
|
||||||
extern void doBullets();
|
|
||||||
extern void doAliens();
|
|
||||||
extern void doPlayer();
|
|
||||||
extern void doExplosions();
|
|
||||||
extern void doDebris();
|
|
||||||
extern void doInfo();
|
|
||||||
extern signed char allMissionsCompleted();
|
|
||||||
extern signed char checkPauseRequest();
|
|
||||||
extern signed char addAlien();
|
|
||||||
extern void missionFinishedScreen();
|
|
||||||
extern void gameover();
|
|
||||||
extern void clearInfoLines();
|
|
||||||
extern signed char missionFailed();
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern void loadScriptEvents();
|
|
||||||
extern void doCutscene(int scene);
|
|
||||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
|
||||||
extern void doCredits();
|
|
||||||
extern void updateSystemStatus();
|
|
||||||
extern void saveGame(int slot);
|
|
||||||
extern void flushInput();
|
|
||||||
|
|
||||||
extern void initWeapons();
|
|
||||||
extern void initMissions();
|
|
||||||
extern void initCargo();
|
|
||||||
extern void initPlanetMissions(signed char system);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern mission currentMission;
|
|
||||||
extern Game currentGame;
|
extern Game currentGame;
|
||||||
extern Graphics graphics;
|
|
||||||
|
extern void newGame();
|
||||||
|
extern int mainGameLoop();
|
||||||
|
|
|
@ -18,7 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "globals.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
devVariables dev;
|
||||||
|
globalEngineVariables engine;
|
||||||
|
|
||||||
void defineGlobals()
|
void defineGlobals()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,16 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
extern devVariables dev;
|
||||||
|
extern globalEngineVariables engine;
|
||||||
|
|
||||||
|
extern void defineGlobals();
|
||||||
|
|
|
@ -18,7 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "graphics.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
Graphics graphics;
|
||||||
|
Star star[200];
|
||||||
|
|
||||||
SDL_Surface *loadImage(const char *filename)
|
SDL_Surface *loadImage(const char *filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,20 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void unpack(const char *file, signed char fileType);
|
|
||||||
extern void showErrorAndExit(int errorId, const char *name);
|
|
||||||
|
|
||||||
extern Star star[200];
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Graphics graphics;
|
extern Graphics graphics;
|
||||||
|
extern Star star[200];
|
||||||
|
|
||||||
|
extern SDL_Surface *loadImage(const char *filename);
|
||||||
|
extern void doStarfield();
|
||||||
|
extern int isOnScreen(int x, int y, int w, int h);
|
||||||
|
|
|
@ -18,7 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "init.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
#if LINUX
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Initalises a whole load of variables
|
Initalises a whole load of variables
|
||||||
|
@ -105,7 +112,7 @@ home directory, then creates the .parallelrealities and .parallelrealities/starf
|
||||||
directories so that saves and temporary data files can be written there. Good, eh? :)
|
directories so that saves and temporary data files can be written there. Good, eh? :)
|
||||||
*/
|
*/
|
||||||
#if LINUX
|
#if LINUX
|
||||||
void setupUserHomeDirectory()
|
static void setupUserHomeDirectory()
|
||||||
{
|
{
|
||||||
char *userHome;
|
char *userHome;
|
||||||
|
|
||||||
|
|
33
code/init.h
33
code/init.h
|
@ -18,32 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void initVars();
|
||||||
#include <string.h>
|
extern void showErrorAndExit(int errorId, const char *name);
|
||||||
#include <time.h>
|
extern void initSystem();
|
||||||
|
extern void cleanUp();
|
||||||
#if LINUX
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void freeSound();
|
|
||||||
extern void resetLists();
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void drawString(const char *in, int x, int y, int fontColor);
|
|
||||||
extern SDL_Surface *loadImage(const char *filename);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Star star[200];
|
|
||||||
|
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "intermission.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Drives the cursor. Is used by some other screens too
|
Drives the cursor. Is used by some other screens too
|
||||||
*/
|
*/
|
||||||
void doCursor()
|
static void doCursor()
|
||||||
{
|
{
|
||||||
getPlayerInput();
|
getPlayerInput();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Sets the player's current status information lines. These are the lines
|
||||||
that are scrolled up the screen when the player clicks on Current Status
|
that are scrolled up the screen when the player clicks on Current Status
|
||||||
These are set only once.
|
These are set only once.
|
||||||
*/
|
*/
|
||||||
void setStatusLines()
|
static void setStatusLines()
|
||||||
{
|
{
|
||||||
char string[50];
|
char string[50];
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void setStatusLines()
|
||||||
Sets the names and stats of the planets within the current system.
|
Sets the names and stats of the planets within the current system.
|
||||||
This will later be placed into a data file.
|
This will later be placed into a data file.
|
||||||
*/
|
*/
|
||||||
void setSystemPlanets()
|
static void setSystemPlanets()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ Spins the planets around the sun, spaced according to their Y value
|
||||||
as defined in setSystemPlanets(). Moving the cursor over the planet
|
as defined in setSystemPlanets(). Moving the cursor over the planet
|
||||||
will show their name and their current status
|
will show their name and their current status
|
||||||
*/
|
*/
|
||||||
bool showSystem(float x, float y)
|
static bool showSystem(float x, float y)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
signed char planet = 0;
|
signed char planet = 0;
|
||||||
|
@ -303,7 +303,7 @@ the specified status line reaches a certain Y value, the entire
|
||||||
list is reset and the information lines begin again from the bottom
|
list is reset and the information lines begin again from the bottom
|
||||||
(in other words, they loop around).
|
(in other words, they loop around).
|
||||||
*/
|
*/
|
||||||
void showStatus(SDL_Surface *infoSurface)
|
static void showStatus(SDL_Surface *infoSurface)
|
||||||
{
|
{
|
||||||
graphics.blit(infoSurface, 100, 80);
|
graphics.blit(infoSurface, 100, 80);
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ void showStatus(SDL_Surface *infoSurface)
|
||||||
graphics.blitText(27);
|
graphics.blitText(27);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createOptions(SDL_Surface *optionsSurface)
|
static void createOptions(SDL_Surface *optionsSurface)
|
||||||
{
|
{
|
||||||
SDL_FillRect(optionsSurface, NULL, graphics.black);
|
SDL_FillRect(optionsSurface, NULL, graphics.black);
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ void createOptions(SDL_Surface *optionsSurface)
|
||||||
graphics.drawString("AUTOSAVE SLOT", 30, 200, FONT_WHITE, optionsSurface);
|
graphics.drawString("AUTOSAVE SLOT", 30, 200, FONT_WHITE, optionsSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showOptions(SDL_Surface *optionsSurface)
|
static void showOptions(SDL_Surface *optionsSurface)
|
||||||
{
|
{
|
||||||
if ((engine.keyState[SDLK_LCTRL]) || (engine.keyState[SDLK_RCTRL]))
|
if ((engine.keyState[SDLK_LCTRL]) || (engine.keyState[SDLK_RCTRL]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,39 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern int galaxyMap();
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern SDL_Surface *loadImage(const char *filename);
|
|
||||||
extern void doStarfield();
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void showShop();
|
|
||||||
extern void initShop();
|
|
||||||
extern int initSaveSlots();
|
|
||||||
extern int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot);
|
|
||||||
extern void saveGame(int slot);
|
|
||||||
extern void loadMusic(const char *filename);
|
|
||||||
extern void loadBackground(const char *filename);
|
|
||||||
extern void createCommsSurface(SDL_Surface *comms);
|
|
||||||
extern void updateCommsSurface(SDL_Surface *comms);
|
|
||||||
extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot);
|
|
||||||
extern void checkForBossMission();
|
|
||||||
extern void doComms(SDL_Surface *comms);
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern int getFace(const char *face);
|
|
||||||
extern void flushInput();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Planet systemPlanet[10];
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "loadSave.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
static char saveSlot[10][25];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Reads in each save game that it finds and gives it an appropriate
|
Reads in each save game that it finds and gives it an appropriate
|
||||||
|
|
|
@ -18,27 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern int initSaveSlots();
|
||||||
#include <string.h>
|
extern bool loadGame(int slot);
|
||||||
#include <sys/types.h>
|
extern void saveGame(int slot);
|
||||||
#include <sys/stat.h>
|
extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot);
|
||||||
|
extern int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot);
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
char saveSlot[10][25];
|
|
||||||
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void initPlanetMissions(signed char system);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Planet systemPlanet[10];
|
|
||||||
|
|
|
@ -18,9 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "messages.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void setKillMessages()
|
static char deathMessage[6][50];
|
||||||
|
static char killMessage[10][50];
|
||||||
|
static char missFireMessage[5][50];
|
||||||
|
static char playerHitMessage[3][50];
|
||||||
|
|
||||||
|
static void setKillMessages()
|
||||||
{
|
{
|
||||||
strcpy(killMessage[0], "Chalk another one up for me!");
|
strcpy(killMessage[0], "Chalk another one up for me!");
|
||||||
strcpy(killMessage[1], "That'll teach you!");
|
strcpy(killMessage[1], "That'll teach you!");
|
||||||
|
@ -37,7 +42,7 @@ void setKillMessages()
|
||||||
strcpy(killMessage[9], "Number One, Baby!");
|
strcpy(killMessage[9], "Number One, Baby!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPlayerDeadMessages()
|
static void setPlayerDeadMessages()
|
||||||
{
|
{
|
||||||
strcpy(deathMessage[0], "Oh my God... No!");
|
strcpy(deathMessage[0], "Oh my God... No!");
|
||||||
strcpy(deathMessage[1], "NOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!");
|
strcpy(deathMessage[1], "NOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!");
|
||||||
|
@ -47,7 +52,7 @@ void setPlayerDeadMessages()
|
||||||
strcpy(deathMessage[5], "Chriiiiiiiiiiiiiiiiiiiiiiiiiiis!!!!");
|
strcpy(deathMessage[5], "Chriiiiiiiiiiiiiiiiiiiiiiiiiiis!!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMissFireMessages()
|
static void setMissFireMessages()
|
||||||
{
|
{
|
||||||
strcpy(missFireMessage[0], "I am NOT your enemy!");
|
strcpy(missFireMessage[0], "I am NOT your enemy!");
|
||||||
strcpy(missFireMessage[1], "Hey! Watch it!");
|
strcpy(missFireMessage[1], "Hey! Watch it!");
|
||||||
|
@ -56,7 +61,7 @@ void setMissFireMessages()
|
||||||
strcpy(missFireMessage[4], "Open your eyes!!");
|
strcpy(missFireMessage[4], "Open your eyes!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHitPlayerMessages()
|
static void setHitPlayerMessages()
|
||||||
{
|
{
|
||||||
strcpy(playerHitMessage[0], "Oops! Sorry!");
|
strcpy(playerHitMessage[0], "Oops! Sorry!");
|
||||||
strcpy(playerHitMessage[1], "Get out of the way!");
|
strcpy(playerHitMessage[1], "Get out of the way!");
|
||||||
|
|
|
@ -18,23 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void setAllyMessages();
|
||||||
#include <string.h>
|
extern void getKillMessage(object *ally);
|
||||||
|
extern const char *getKlineInsult();
|
||||||
#include <SDL/SDL.h>
|
extern void getPlayerDeathMessage();
|
||||||
#include <SDL/SDL_image.h>
|
extern void getMissFireMessage(object *ally);
|
||||||
#include <SDL/SDL_mixer.h>
|
extern void getPlayerHitMessage(object *ally);
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
|
|
||||||
char killMessage[10][50];
|
|
||||||
char deathMessage[6][50];
|
|
||||||
char missFireMessage[5][50];
|
|
||||||
char playerHitMessage[3][50];
|
|
||||||
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern Game currentGame;
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "misc.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void clearInfoLines()
|
void clearInfoLines()
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ void clearInfoLines()
|
||||||
}
|
}
|
||||||
|
|
||||||
// from a to b
|
// from a to b
|
||||||
void copyInfoLine(int a, int b)
|
static void copyInfoLine(int a, int b)
|
||||||
{
|
{
|
||||||
graphics.textSurface(b, graphics.textShape[a].text, -1, 0, graphics.textShape[a].fontColor);
|
graphics.textSurface(b, graphics.textShape[a].text, -1, 0, graphics.textShape[a].fontColor);
|
||||||
graphics.textShape[b].life = graphics.textShape[a].life;
|
graphics.textShape[b].life = graphics.textShape[a].life;
|
||||||
|
@ -85,7 +85,7 @@ void setRadioMessage(signed char face, const char *in, int priority)
|
||||||
graphics.createMessageBox(faceShape, in, 1);
|
graphics.createMessageBox(faceShape, in, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doTargetArrow()
|
static void doTargetArrow()
|
||||||
{
|
{
|
||||||
if ((engine.targetArrowTimer == 0) || (enemy[engine.targetIndex].shield < 1))
|
if ((engine.targetArrowTimer == 0) || (enemy[engine.targetIndex].shield < 1))
|
||||||
return;
|
return;
|
||||||
|
|
30
code/misc.h
30
code/misc.h
|
@ -18,27 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void clearInfoLines();
|
||||||
#include <string.h>
|
extern void setInfoLine(const char *in, int color);
|
||||||
|
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||||
#include <SDL/SDL.h>
|
extern void doInfo();
|
||||||
#include <SDL/SDL_image.h>
|
extern int getFace(const char *face);
|
||||||
#include <SDL/SDL_mixer.h>
|
extern void resetLists();
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern signed char allMissionsCompleted();
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern void checkTimer();
|
|
||||||
extern void checkScriptEvents();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern object player;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
extern mission currentMission;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,10 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "missions.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
// God, I hate this file! :((
|
// God, I hate this file! :((
|
||||||
|
|
||||||
|
Planet systemPlanet[10];
|
||||||
|
mission currentMission;
|
||||||
|
static mission missions[MAX_MISSIONS];
|
||||||
|
|
||||||
void initPlanetMissions(signed char system)
|
void initPlanetMissions(signed char system)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
|
@ -202,7 +206,7 @@ Timer Variable:
|
||||||
-1 : Time up
|
-1 : Time up
|
||||||
-2 : No timer
|
-2 : No timer
|
||||||
*/
|
*/
|
||||||
void clearAllMissions()
|
static void clearAllMissions()
|
||||||
{
|
{
|
||||||
for (int m = 0 ; m < MAX_MISSIONS ; m++)
|
for (int m = 0 ; m < MAX_MISSIONS ; m++)
|
||||||
{
|
{
|
||||||
|
@ -303,7 +307,7 @@ void checkTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void evaluteRequirement(int type, int id, int *completed, int *targetValue, int fontColor)
|
static void evaluateRequirement(int type, int id, int *completed, int *targetValue, int fontColor)
|
||||||
{
|
{
|
||||||
char message[25];
|
char message[25];
|
||||||
|
|
||||||
|
@ -417,7 +421,7 @@ void updateMissionRequirements(int type, int id, int value)
|
||||||
{
|
{
|
||||||
matched = 1;
|
matched = 1;
|
||||||
currentMission.targetValue1[i] -= value;
|
currentMission.targetValue1[i] -= value;
|
||||||
evaluteRequirement(type, id, ¤tMission.completed1[i], ¤tMission.targetValue1[i], FONT_CYAN);
|
evaluateRequirement(type, id, ¤tMission.completed1[i], ¤tMission.targetValue1[i], FONT_CYAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,7 +437,7 @@ void updateMissionRequirements(int type, int id, int value)
|
||||||
if ((currentMission.secondaryType[i] == type) && ((currentMission.target2[i] == id) || (currentMission.target2[i] == CD_ANY)))
|
if ((currentMission.secondaryType[i] == type) && ((currentMission.target2[i] == id) || (currentMission.target2[i] == CD_ANY)))
|
||||||
{
|
{
|
||||||
currentMission.targetValue2[i] -= value;
|
currentMission.targetValue2[i] -= value;
|
||||||
evaluteRequirement(type, id, ¤tMission.completed2[i], ¤tMission.targetValue2[i], FONT_YELLOW);
|
evaluateRequirement(type, id, ¤tMission.completed2[i], ¤tMission.targetValue2[i], FONT_YELLOW);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,7 +477,7 @@ void updateMissionRequirements(int type, int id, int value)
|
||||||
This is only used as few times in the game.
|
This is only used as few times in the game.
|
||||||
Missions 11 and 23 to be exact!
|
Missions 11 and 23 to be exact!
|
||||||
*/
|
*/
|
||||||
char revealHiddenObjectives()
|
static char revealHiddenObjectives()
|
||||||
{
|
{
|
||||||
char allDone = 1;
|
char allDone = 1;
|
||||||
char string[255];
|
char string[255];
|
||||||
|
@ -665,7 +669,7 @@ bool missionFailed()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawBriefScreen()
|
static void drawBriefScreen()
|
||||||
{
|
{
|
||||||
SDL_Rect r = {0, 0, 800, 2};
|
SDL_Rect r = {0, 0, 800, 2};
|
||||||
|
|
||||||
|
@ -903,7 +907,7 @@ void missionFinishedScreen()
|
||||||
|
|
||||||
#if USEPACK
|
#if USEPACK
|
||||||
|
|
||||||
void loadMissions()
|
static void loadMissions()
|
||||||
{
|
{
|
||||||
clearAllMissions();
|
clearAllMissions();
|
||||||
|
|
||||||
|
@ -974,7 +978,7 @@ void initMissions(){loadMissions();}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void saveMissions()
|
static void saveMissions()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char filename[65];
|
char filename[65];
|
||||||
|
|
|
@ -18,35 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern SDL_Surface *loadImage(const char *file_name);
|
|
||||||
extern void playRandomTrack();
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void setInfoLine(const char *in, int color);
|
|
||||||
extern void loadGameGraphics();
|
|
||||||
extern void killAllAliens();
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
extern void syncScriptEvents();
|
|
||||||
extern void loadMusic(const char *filename);
|
|
||||||
extern void setTarget(int index);
|
|
||||||
extern void flushInput();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern mission currentMission;
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Planet systemPlanet[10];
|
extern Planet systemPlanet[10];
|
||||||
extern mission missions[MAX_MISSIONS];
|
extern mission currentMission;
|
||||||
|
|
||||||
|
extern void initPlanetMissions(signed char system);
|
||||||
|
extern void checkForBossMission();
|
||||||
|
extern void updateSystemStatus();
|
||||||
|
extern void setMission(int mission);
|
||||||
|
extern void checkTimer();
|
||||||
|
extern void updateMissionRequirements(int type, int id, int value);
|
||||||
|
extern bool allMissionsCompleted();
|
||||||
|
extern bool missionFailed();
|
||||||
|
extern void missionBriefScreen();
|
||||||
|
extern void missionFinishedScreen();
|
||||||
|
extern void initMissions();
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "player.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
object player;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Initialises the player for a new game.
|
Initialises the player for a new game.
|
||||||
|
|
|
@ -18,33 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void fireBullet(object *attacker, int weaponType);
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern void addEngine(object *craft);
|
|
||||||
extern void addKeyEvent(const char *keyName);
|
|
||||||
extern void addDebris(int x, int y, int amount);
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
extern void setInfoLine(const char *in, int color);
|
|
||||||
extern void getPlayerDeathMessage();
|
|
||||||
extern void playSound(int sid);
|
|
||||||
extern void setTarget(int index);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object player;
|
extern object player;
|
||||||
extern mission currentMission;
|
|
||||||
extern Game currentGame;
|
extern void initPlayer();
|
||||||
extern object weapon[MAX_WEAPONS];
|
extern void doPlayer();
|
||||||
extern object enemy[MAX_ALIENS];
|
extern void flushInput();
|
||||||
extern Graphics graphics;
|
extern void getPlayerInput();
|
||||||
|
extern void leaveSector();
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "resources.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void loadBackground(const char *filename)
|
void loadBackground(const char *filename)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ void freeSound()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setFontColor(SDL_Surface *image, int red, int green, int blue)
|
static void setFontColor(SDL_Surface *image, int red, int green, int blue)
|
||||||
{
|
{
|
||||||
SDL_Color colors[256];
|
SDL_Color colors[256];
|
||||||
colors[0].r = 0;
|
colors[0].r = 0;
|
||||||
|
|
|
@ -18,28 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void loadBackground(const char *filename);
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void unpack(const char *file, signed char fileType);
|
|
||||||
extern SDL_Surface *loadImage(const char *filename);
|
|
||||||
extern Mix_Chunk *loadSound(const char *filename);
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern void setAlienShapes();
|
|
||||||
extern void setWeaponShapes();
|
|
||||||
extern void loadGameGraphics();
|
extern void loadGameGraphics();
|
||||||
|
extern void loadSound();
|
||||||
extern globalEngineVariables engine;
|
extern void freeSound();
|
||||||
extern object weapon[MAX_WEAPONS];
|
extern void loadFont();
|
||||||
extern Mix_Chunk *sound[MAX_SOUNDS];
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern Game currentGame;
|
|
||||||
|
|
|
@ -18,9 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void setKlineGreeting()
|
static cutMsg cutMessage[10];
|
||||||
|
static event gameEvent[10];
|
||||||
|
|
||||||
|
static void setKlineGreeting()
|
||||||
{
|
{
|
||||||
char greet[][50] = {
|
char greet[][50] = {
|
||||||
"How nice to see you again, Bainfield!",
|
"How nice to see you again, Bainfield!",
|
||||||
|
@ -133,7 +136,7 @@ void syncScriptEvents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScene(int scene)
|
static void setScene(int scene)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char string[255], face[255];
|
char string[255], face[255];
|
||||||
|
|
|
@ -18,35 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void loadScriptEvents();
|
||||||
#include <string.h>
|
extern void checkScriptEvents();
|
||||||
|
extern void syncScriptEvents();
|
||||||
#include <SDL/SDL.h>
|
extern void doCutscene(int scene);
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern void doStarfield();
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void loadGameGraphics();
|
|
||||||
extern void loadBackground(const char *filename);
|
|
||||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
|
||||||
extern void doExplosions();
|
|
||||||
extern void addEngine(object *craft);
|
|
||||||
extern void doExplosions();
|
|
||||||
extern void resetLists();
|
|
||||||
extern int getFace(const char *face);
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern void flushInput();
|
|
||||||
|
|
||||||
extern Game currentGame;
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern object player;
|
|
||||||
extern object defEnemy[MAX_DEFALIENS];
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern event gameEvent[10];
|
|
||||||
extern cutMsg cutMessage[10];
|
|
||||||
|
|
|
@ -18,9 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shop.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
void drawSecondaryWeaponSurface()
|
static ShopItem shopItems[MAX_SHOPITEMS];
|
||||||
|
static signed char shopSelectedItem;
|
||||||
|
|
||||||
|
static void drawSecondaryWeaponSurface()
|
||||||
{
|
{
|
||||||
char description[50];
|
char description[50];
|
||||||
strcpy(description, "");
|
strcpy(description, "");
|
||||||
|
@ -66,7 +69,7 @@ void drawSecondaryWeaponSurface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustShopPrices()
|
static void adjustShopPrices()
|
||||||
{
|
{
|
||||||
shopItems[0].price = (500 * currentGame.maxPlasmaOutput);
|
shopItems[0].price = (500 * currentGame.maxPlasmaOutput);
|
||||||
shopItems[1].price = (500 * currentGame.maxPlasmaDamage);
|
shopItems[1].price = (500 * currentGame.maxPlasmaDamage);
|
||||||
|
@ -98,7 +101,7 @@ void adjustShopPrices()
|
||||||
shopItems[7].price = 0;
|
shopItems[7].price = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawShop()
|
static void drawShop()
|
||||||
{
|
{
|
||||||
adjustShopPrices();
|
adjustShopPrices();
|
||||||
|
|
||||||
|
@ -260,7 +263,7 @@ void drawShop()
|
||||||
|
|
||||||
#if USEPACK
|
#if USEPACK
|
||||||
|
|
||||||
void loadShop()
|
static void loadShop()
|
||||||
{
|
{
|
||||||
char name[255], description[255];
|
char name[255], description[255];
|
||||||
int price, image, x, y;
|
int price, image, x, y;
|
||||||
|
@ -307,7 +310,7 @@ void initShop(){loadShop();}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void saveShop()
|
static void saveShop()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
@ -475,7 +478,7 @@ void initShop()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void buy(int i)
|
static void buy(int i)
|
||||||
{
|
{
|
||||||
if ((currentGame.cash < shopItems[i].price) && (!engine.cheatCash))
|
if ((currentGame.cash < shopItems[i].price) && (!engine.cheatCash))
|
||||||
{
|
{
|
||||||
|
@ -605,7 +608,7 @@ void buy(int i)
|
||||||
currentGame.cash -= shopItems[i].price;
|
currentGame.cash -= shopItems[i].price;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sell(int i)
|
static void sell(int i)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
|
25
code/shop.h
25
code/shop.h
|
@ -18,26 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void initShop();
|
||||||
#include <string.h>
|
extern void showShop();
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
|
|
||||||
extern object player;
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern ShopItem shopItems[MAX_SHOPITEMS];
|
|
||||||
|
|
||||||
signed char shopSelectedItem;
|
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "version.h"
|
#include "Starfighter.h"
|
||||||
#include "title.h"
|
|
||||||
|
|
||||||
signed char showGameMenu(signed char continueSaveSlot)
|
static signed char showGameMenu(signed char continueSaveSlot)
|
||||||
{
|
{
|
||||||
graphics.blitText(2);
|
graphics.blitText(2);
|
||||||
if (continueSaveSlot != 0)
|
if (continueSaveSlot != 0)
|
||||||
|
@ -47,7 +46,7 @@ signed char showGameMenu(signed char continueSaveSlot)
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
signed char showLoadMenu()
|
static signed char showLoadMenu()
|
||||||
{
|
{
|
||||||
signed char rtn = 1;
|
signed char rtn = 1;
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ signed char showLoadMenu()
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createOptionsMenu()
|
static void createOptionsMenu()
|
||||||
{
|
{
|
||||||
if (currentGame.useSound)
|
if (currentGame.useSound)
|
||||||
graphics.textSurface(8, "SOUND - ON", -1, 350, FONT_WHITE);
|
graphics.textSurface(8, "SOUND - ON", -1, 350, FONT_WHITE);
|
||||||
|
@ -89,7 +88,7 @@ void createOptionsMenu()
|
||||||
graphics.textSurface(11, string, -1, 410, FONT_WHITE);
|
graphics.textSurface(11, string, -1, 410, FONT_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed char showOptionsMenu()
|
static signed char showOptionsMenu()
|
||||||
{
|
{
|
||||||
graphics.textShape[12].y = 450;
|
graphics.textShape[12].y = 450;
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ signed char showOptionsMenu()
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createCheatMenu()
|
static void createCheatMenu()
|
||||||
{
|
{
|
||||||
if (engine.cheatShield)
|
if (engine.cheatShield)
|
||||||
graphics.textSurface(18, "UNLIMITED SHIELD - ON", -1, 350, FONT_WHITE);
|
graphics.textSurface(18, "UNLIMITED SHIELD - ON", -1, 350, FONT_WHITE);
|
||||||
|
@ -125,7 +124,7 @@ void createCheatMenu()
|
||||||
graphics.textSurface(21, "UNLIMITED TIME - OFF", -1, 410, FONT_WHITE);
|
graphics.textSurface(21, "UNLIMITED TIME - OFF", -1, 410, FONT_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed char showCheatMenu()
|
static signed char showCheatMenu()
|
||||||
{
|
{
|
||||||
graphics.textShape[12].y = 450;
|
graphics.textShape[12].y = 450;
|
||||||
|
|
||||||
|
|
36
code/title.h
36
code/title.h
|
@ -18,37 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern int doTitle();
|
||||||
#include <string.h>
|
extern void showStory();
|
||||||
|
extern void gameover();
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern SDL_Surface *loadImage(const char *filename);
|
|
||||||
extern void unpack(const char *file);
|
|
||||||
extern void loadMusic(const char *filename);
|
|
||||||
extern void doStarfield();
|
|
||||||
extern void doExplosions();
|
|
||||||
extern void addEngine(object *craft);
|
|
||||||
extern void getPlayerInput();
|
|
||||||
extern void resetLists();
|
|
||||||
extern signed char loadGame(int slot);
|
|
||||||
extern int initSaveSlots();
|
|
||||||
extern void newGame();
|
|
||||||
extern void loadGameGraphics();
|
|
||||||
extern void loadBackground(const char *filename);
|
|
||||||
extern void doCredits();
|
extern void doCredits();
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
extern void flushInput();
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
extern devVariables dev;
|
|
||||||
extern object defEnemy[MAX_DEFALIENS];
|
|
||||||
extern object enemy[MAX_ALIENS];
|
|
||||||
extern Game currentGame;
|
|
||||||
extern Graphics graphics;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "unpack.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Searches the pak file for the required data. When
|
Searches the pak file for the required data. When
|
||||||
|
|
|
@ -18,18 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
extern void unpack(const char *file, signed char fileType);
|
||||||
#include <stdio.h>
|
extern int locateDataInPak(const char *file, bool required);
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
#include <SDL/SDL_endian.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
extern void showErrorAndExit(int errorId, const char *name);
|
|
||||||
|
|
||||||
extern globalEngineVariables engine;
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "weapons.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
|
object weapon[MAX_WEAPONS];
|
||||||
|
|
||||||
void setWeaponShapes()
|
void setWeaponShapes()
|
||||||
{
|
{
|
||||||
|
@ -31,7 +33,7 @@ void setWeaponShapes()
|
||||||
|
|
||||||
#if USEPACK
|
#if USEPACK
|
||||||
|
|
||||||
void loadWeapons()
|
static void loadWeapons()
|
||||||
{
|
{
|
||||||
int dataLocation = locateDataInPak("data/weapons.dat", 1);
|
int dataLocation = locateDataInPak("data/weapons.dat", 1);
|
||||||
int id, ammo, damage, reload, speed, image1, image2, flags;
|
int id, ammo, damage, reload, speed, image1, image2, flags;
|
||||||
|
@ -69,7 +71,7 @@ void initWeapons() {loadWeapons();}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void saveWeapons()
|
static void saveWeapons()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
#include <SDL/SDL_mixer.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "classes.h"
|
|
||||||
|
|
||||||
extern int locateDataInPak(const char *file, bool required);
|
|
||||||
|
|
||||||
extern Graphics graphics;
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
extern object weapon[MAX_WEAPONS];
|
||||||
|
|
||||||
|
extern void setWeaponShapes();
|
||||||
|
extern void initWeapons();
|
||||||
|
|
Loading…
Reference in New Issue