diff --git a/code/Starfighter.cpp b/code/Starfighter.cpp index 21acb37..118937a 100644 --- a/code/Starfighter.cpp +++ b/code/Starfighter.cpp @@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "version.h" #include "Starfighter.h" int main(int argc, char *argv[]) diff --git a/code/Starfighter.h b/code/Starfighter.h index 6b6046f..3e70161 100644 --- a/code/Starfighter.h +++ b/code/Starfighter.h @@ -18,8 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __STARFIGHTER_H__ +#define __STARFIGHTER_H__ + #include #include +#include +#include +#include +#include +#include #include #include @@ -29,42 +37,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "structs.h" #include "classes.h" -extern void initSystem(); -extern void loadGameGraphics(); -extern void loadSound(); -extern void initWeapons(); -extern void initMissions(); -extern void initVars(); -extern void showStory(); -extern int doTitle(); -extern void defineAliens(); -extern void loadFont(); -extern int galaxyMap(); -extern void defineGlobals(); -extern void cleanUp(); -extern int mainGameLoop(); -extern void setAllyMessages(); -extern void newGame(); -extern void doCredits(); -extern void getPlayerInput(); -extern void initPlanetMissions(signed char system); -extern void updateSystemStatus(); -extern void doCutscene(int scene); +#include "ai.h" +#include "aliens.h" +#include "audio.h" +#include "bullets.h" +#include "cargo.h" +#include "collectable.h" +#include "comms.h" +#include "debris.h" +#include "events.h" +#include "explosions.h" +#include "game.h" +#include "globals.h" +#include "graphics.h" +#include "init.h" +#include "intermission.h" +#include "loadSave.h" +#include "messages.h" +#include "misc.h" +#include "missions.h" +#include "player.h" +#include "resources.h" +#include "script.h" +#include "shop.h" +#include "title.h" +#include "unpack.h" +#include "version.h" +#include "weapons.h" -globalEngineVariables engine; -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]; +#endif diff --git a/code/ai.cpp b/code/ai.cpp index e339b6d..b4b0eab 100644 --- a/code/ai.cpp +++ b/code/ai.cpp @@ -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. diff --git a/code/ai.h b/code/ai.h index 4baaa68..76662e2 100644 --- a/code/ai.h +++ b/code/ai.h @@ -18,20 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include - -#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; +extern void setEnemyAI(object *theEnemy); +extern void setKlineAttackMethod(object *theEnemy); +extern void setKlineAI(object *theEnemy); diff --git a/code/aliens.cpp b/code/aliens.cpp index 337bcc8..408e099 100644 --- a/code/aliens.cpp +++ b/code/aliens.cpp @@ -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) 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 a new one. */ -int getAlien() +static int getAlien() { for (int i = 0 ; i < engine.maxAliens ; i++) { @@ -68,7 +71,7 @@ int getAlien() return -1; } -void addDrone(object *host) +static void addDrone(object *host) { int index = getAlien(); @@ -89,7 +92,7 @@ void addDrone(object *host) enemy[index].y = host->y + rand() % 50; } -void addSmallAsteroid(object *host) +static void addSmallAsteroid(object *host) { if (engine.missionCompleteTimer != 0) return; @@ -280,7 +283,7 @@ bool addAlien() return true; } -void getPreDefinedAliens() +static void getPreDefinedAliens() { FILE *fp; char string[255]; @@ -460,7 +463,7 @@ void getPreDefinedAliens() } } -void addFriendly(int type) +static void addFriendly(int type) { if (type != FR_SID) enemy[type] = defEnemy[CD_FRIEND]; @@ -649,7 +652,7 @@ void initAliens() "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 searchForTarget(object *theEnemy) +static void searchForTarget(object *theEnemy) { int i; @@ -708,7 +711,7 @@ void searchForTarget(object *theEnemy) theEnemy->target = targetEnemy; } -int traceTarget(object *theEnemy) +static int traceTarget(object *theEnemy) { // Do various checks to see if the alien can fire at // 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 any enemy craft that enter their line of sight. */ -int traceView(object *theEnemy) +static int traceView(object *theEnemy) { object *anEnemy = enemy; @@ -774,7 +777,7 @@ int traceView(object *theEnemy) return 0; } -void moveAndSeparate(object *theEnemy) +static void moveAndSeparate(object *theEnemy) { bool checkCollisions = true; bool hasCollided = false; @@ -1258,7 +1261,7 @@ void setAlienShapes() #if USEPACK -void loadAliens() +static void loadAliens() { int dataLocation = locateDataInPak("data/aliens.dat", 1); int def, ai, speed, shield, max, image1, image2, weapon1, weapon2, chance1, chance2, score; @@ -1313,7 +1316,7 @@ void defineAliens(){loadAliens();} #else -void saveAliens() +static void saveAliens() { FILE *fp; diff --git a/code/aliens.h b/code/aliens.h index 73c3e2a..8d3bcf1 100644 --- a/code/aliens.h +++ b/code/aliens.h @@ -18,41 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include - -#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 defEnemy[MAX_DEFALIENS]; 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(); diff --git a/code/audio.cpp b/code/audio.cpp index ec1c27c..817351d 100644 --- a/code/audio.cpp +++ b/code/audio.cpp @@ -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) { diff --git a/code/audio.h b/code/audio.h index f2a73be..df53d2a 100644 --- a/code/audio.h +++ b/code/audio.h @@ -18,19 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 void playSound(int sid); +extern Mix_Chunk *loadSound(const char *filename); +extern void loadMusic(const char *filename); +extern void playRandomTrack(); diff --git a/code/bullets.cpp b/code/bullets.cpp index 9b71ff2..a92c1f4 100644 --- a/code/bullets.cpp +++ b/code/bullets.cpp @@ -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) { @@ -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 target will be returned as the object address. */ -object *getRandomEnemy(object *bullet) +static object *getRandomEnemy(object *bullet) { int i; @@ -287,7 +287,7 @@ object *getRandomEnemy(object *bullet) /* Fill in later... */ -void destroyAlien(object *bullet, object *theEnemy) +static void destroyAlien(object *bullet, object *theEnemy) { playSound(SFX_EXPLOSION); diff --git a/code/bullets.h b/code/bullets.h index 21b1b04..b127889 100644 --- a/code/bullets.h +++ b/code/bullets.h @@ -18,37 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include - -#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; +extern void addBullet(object *theWeapon, object *attacker, int y, int dy); +extern void fireBullet(object *attacker, int weaponType); +extern char checkPlayerShockDamage(float x, float y); +extern void fireRay(object *attacker); +extern void doBullets(); diff --git a/code/cargo.cpp b/code/cargo.cpp index 5d5a12f..49bbeee 100644 --- a/code/cargo.cpp +++ b/code/cargo.cpp @@ -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() { @@ -32,7 +34,7 @@ void initCargo() /* * I think you all know what this does by now! ;) */ -int getCargo() +static int getCargo() { for (int i = 0 ; i < MAX_CARGO ; i++) { @@ -64,7 +66,7 @@ object *addCargo(object *owner, int cargoType) return &cargo[index]; } -void becomeCollectable(int i) +static void becomeCollectable(int i) { if (cargo[i].collectType != P_PHOEBE) { diff --git a/code/cargo.h b/code/cargo.h index 60012f7..9964789 100644 --- a/code/cargo.h +++ b/code/cargo.h @@ -18,23 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 void initCargo(); +extern object *addCargo(object *owner, int cargoType); +extern void doCargo(); diff --git a/code/collectable.cpp b/code/collectable.cpp index 428b4d1..572e9de 100644 --- a/code/collectable.cpp +++ b/code/collectable.cpp @@ -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. @@ -161,7 +161,7 @@ void addCollectable(float x, float y, int type, int value, int life) 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)) playSound(SFX_EXPLOSION); diff --git a/code/collectable.h b/code/collectable.h index d19ded0..2b1c27a 100644 --- a/code/collectable.h +++ b/code/collectable.h @@ -18,26 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; +extern void addCollectable(float x, float y, int type, int value, int life); +extern void checkMineBulletCollisions(object *bullet); +extern void doCollectables(); diff --git a/code/comms.cpp b/code/comms.cpp index cddc862..d9b9f71 100644 --- a/code/comms.cpp +++ b/code/comms.cpp @@ -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) { @@ -60,7 +60,7 @@ void createCommsSurface(SDL_Surface *comms) updateCommsSurface(comms); } -void createMissionDetailSurface(SDL_Surface *comms, int missionSlot) +static void createMissionDetailSurface(SDL_Surface *comms, int missionSlot) { char name[50]; char string[2000]; diff --git a/code/comms.h b/code/comms.h index 1499204..c92b0c2 100644 --- a/code/comms.h +++ b/code/comms.h @@ -18,21 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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]; +extern void updateCommsSurface(SDL_Surface *comms); +extern void createCommsSurface(SDL_Surface *comms); +extern void doComms(SDL_Surface *comms); diff --git a/code/debris.cpp b/code/debris.cpp index e6033a1..c4cfea8 100644 --- a/code/debris.cpp +++ b/code/debris.cpp @@ -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) { diff --git a/code/debris.h b/code/debris.h index 8cf3bb8..e61ec5e 100644 --- a/code/debris.h +++ b/code/debris.h @@ -18,19 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; +extern void addDebris(int x, int y, int amount); +extern void doDebris(); diff --git a/code/events.cpp b/code/events.cpp index 1892c7b..552557d 100644 --- a/code/events.cpp +++ b/code/events.cpp @@ -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 @@ -46,7 +48,7 @@ bool checkPauseRequest() return false; } -void compareLastKeyInputs() +static void compareLastKeyInputs() { if (strstr(lastKeyEvents, "humansdoitbetter") != NULL) {engine.cheat = true; memset(lastKeyEvents, ' ', 25);} diff --git a/code/events.h b/code/events.h index b55c7ea..e9f21b9 100644 --- a/code/events.h +++ b/code/events.h @@ -18,20 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#include "structs.h" - -extern void getPlayerInput(); - -extern globalEngineVariables engine; -extern object player; -extern Game currentGame; -extern devVariables dev; - -char lastKeyEvents[] = " "; +extern bool checkPauseRequest(); +extern void addKeyEvent(const char *keyName); diff --git a/code/explosions.cpp b/code/explosions.cpp index 0e8020a..e33a793 100644 --- a/code/explosions.cpp +++ b/code/explosions.cpp @@ -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. diff --git a/code/explosions.h b/code/explosions.h index 62adae6..c93fae7 100644 --- a/code/explosions.h +++ b/code/explosions.h @@ -18,20 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; +extern void addExplosion(float x, float y, int type); +extern void addEngine(object *craft); +extern void doExplosions(); diff --git a/code/game.cpp b/code/game.cpp index 701a7e8..41605e9 100644 --- a/code/game.cpp +++ b/code/game.cpp @@ -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() { diff --git a/code/game.h b/code/game.h index f6eecae..c2a404b 100644 --- a/code/game.h +++ b/code/game.h @@ -18,58 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 Graphics graphics; + +extern void newGame(); +extern int mainGameLoop(); diff --git a/code/globals.cpp b/code/globals.cpp index a1abbc6..1b41a06 100644 --- a/code/globals.cpp +++ b/code/globals.cpp @@ -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() { diff --git a/code/globals.h b/code/globals.h index 4ee2f0a..23c862c 100644 --- a/code/globals.h +++ b/code/globals.h @@ -18,16 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include - -#include "defs.h" -#include "structs.h" - -extern globalEngineVariables engine; extern devVariables dev; +extern globalEngineVariables engine; + +extern void defineGlobals(); diff --git a/code/graphics.cpp b/code/graphics.cpp index fa90864..edfd2c8 100644 --- a/code/graphics.cpp +++ b/code/graphics.cpp @@ -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) { diff --git a/code/graphics.h b/code/graphics.h index 390095f..b163c5c 100644 --- a/code/graphics.h +++ b/code/graphics.h @@ -18,20 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 Star star[200]; + +extern SDL_Surface *loadImage(const char *filename); +extern void doStarfield(); +extern int isOnScreen(int x, int y, int w, int h); diff --git a/code/init.cpp b/code/init.cpp index a84ba3c..55ea341 100644 --- a/code/init.cpp +++ b/code/init.cpp @@ -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 +#include +#include +#include +#endif /* 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? :) */ #if LINUX -void setupUserHomeDirectory() +static void setupUserHomeDirectory() { char *userHome; diff --git a/code/init.h b/code/init.h index 96c10d9..99cd33d 100644 --- a/code/init.h +++ b/code/init.h @@ -18,32 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#if LINUX -#include -#include -#include -#include -#endif - -#include -#include -#include - -#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]; +extern void initVars(); +extern void showErrorAndExit(int errorId, const char *name); +extern void initSystem(); +extern void cleanUp(); diff --git a/code/intermission.cpp b/code/intermission.cpp index 6dfacd9..0f323cb 100644 --- a/code/intermission.cpp +++ b/code/intermission.cpp @@ -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 */ -void doCursor() +static void doCursor() { 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 These are set only once. */ -void setStatusLines() +static void setStatusLines() { char string[50]; @@ -167,7 +167,7 @@ void setStatusLines() Sets the names and stats of the planets within the current system. This will later be placed into a data file. */ -void setSystemPlanets() +static void setSystemPlanets() { 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 will show their name and their current status */ -bool showSystem(float x, float y) +static bool showSystem(float x, float y) { SDL_Rect r; 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 (in other words, they loop around). */ -void showStatus(SDL_Surface *infoSurface) +static void showStatus(SDL_Surface *infoSurface) { graphics.blit(infoSurface, 100, 80); @@ -334,7 +334,7 @@ void showStatus(SDL_Surface *infoSurface) graphics.blitText(27); } -void createOptions(SDL_Surface *optionsSurface) +static void createOptions(SDL_Surface *optionsSurface) { SDL_FillRect(optionsSurface, NULL, graphics.black); @@ -391,7 +391,7 @@ void createOptions(SDL_Surface *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])) { diff --git a/code/intermission.h b/code/intermission.h index 0e0a41a..dff21de 100644 --- a/code/intermission.h +++ b/code/intermission.h @@ -18,39 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include - -#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]; +extern int galaxyMap(); diff --git a/code/loadSave.cpp b/code/loadSave.cpp index d20c8b1..94d562b 100644 --- a/code/loadSave.cpp +++ b/code/loadSave.cpp @@ -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 diff --git a/code/loadSave.h b/code/loadSave.h index 6d05690..b73bdb9 100644 --- a/code/loadSave.h +++ b/code/loadSave.h @@ -18,27 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include - -#include -#include -#include - -#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]; +extern int initSaveSlots(); +extern bool loadGame(int slot); +extern void saveGame(int slot); +extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot); +extern int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot); diff --git a/code/messages.cpp b/code/messages.cpp index fd2badd..7ce9539 100644 --- a/code/messages.cpp +++ b/code/messages.cpp @@ -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[1], "That'll teach you!"); @@ -37,7 +42,7 @@ void setKillMessages() strcpy(killMessage[9], "Number One, Baby!"); } -void setPlayerDeadMessages() +static void setPlayerDeadMessages() { strcpy(deathMessage[0], "Oh my God... No!"); strcpy(deathMessage[1], "NOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!"); @@ -47,7 +52,7 @@ void setPlayerDeadMessages() strcpy(deathMessage[5], "Chriiiiiiiiiiiiiiiiiiiiiiiiiiis!!!!"); } -void setMissFireMessages() +static void setMissFireMessages() { strcpy(missFireMessage[0], "I am NOT your enemy!"); strcpy(missFireMessage[1], "Hey! Watch it!"); @@ -56,7 +61,7 @@ void setMissFireMessages() strcpy(missFireMessage[4], "Open your eyes!!"); } -void setHitPlayerMessages() +static void setHitPlayerMessages() { strcpy(playerHitMessage[0], "Oops! Sorry!"); strcpy(playerHitMessage[1], "Get out of the way!"); diff --git a/code/messages.h b/code/messages.h index ed94a58..23fd09b 100644 --- a/code/messages.h +++ b/code/messages.h @@ -18,23 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; - +extern void setAllyMessages(); +extern void getKillMessage(object *ally); +extern const char *getKlineInsult(); +extern void getPlayerDeathMessage(); +extern void getMissFireMessage(object *ally); +extern void getPlayerHitMessage(object *ally); diff --git a/code/misc.cpp b/code/misc.cpp index c907620..710b3f7 100644 --- a/code/misc.cpp +++ b/code/misc.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "misc.h" +#include "Starfighter.h" void clearInfoLines() { @@ -29,7 +29,7 @@ void clearInfoLines() } // 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.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); } -void doTargetArrow() +static void doTargetArrow() { if ((engine.targetArrowTimer == 0) || (enemy[engine.targetIndex].shield < 1)) return; diff --git a/code/misc.h b/code/misc.h index 37d7a69..3b0081e 100644 --- a/code/misc.h +++ b/code/misc.h @@ -18,27 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; +extern void clearInfoLines(); +extern void setInfoLine(const char *in, int color); +extern void setRadioMessage(signed char face, const char *in, int priority); +extern void doInfo(); +extern int getFace(const char *face); +extern void resetLists(); diff --git a/code/missions.cpp b/code/missions.cpp index fc93b04..e9349ac 100644 --- a/code/missions.cpp +++ b/code/missions.cpp @@ -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! :(( +Planet systemPlanet[10]; +mission currentMission; +static mission missions[MAX_MISSIONS]; + void initPlanetMissions(signed char system) { for (int i = 0 ; i < 10 ; i++) @@ -202,7 +206,7 @@ Timer Variable: -1 : Time up -2 : No timer */ -void clearAllMissions() +static void clearAllMissions() { 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]; @@ -417,7 +421,7 @@ void updateMissionRequirements(int type, int id, int value) { matched = 1; 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))) { 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; } } @@ -473,7 +477,7 @@ void updateMissionRequirements(int type, int id, int value) This is only used as few times in the game. Missions 11 and 23 to be exact! */ -char revealHiddenObjectives() +static char revealHiddenObjectives() { char allDone = 1; char string[255]; @@ -665,7 +669,7 @@ bool missionFailed() return false; } -void drawBriefScreen() +static void drawBriefScreen() { SDL_Rect r = {0, 0, 800, 2}; @@ -903,7 +907,7 @@ void missionFinishedScreen() #if USEPACK -void loadMissions() +static void loadMissions() { clearAllMissions(); @@ -974,7 +978,7 @@ void initMissions(){loadMissions();} #else -void saveMissions() +static void saveMissions() { FILE *fp; char filename[65]; diff --git a/code/missions.h b/code/missions.h index c196e8d..fbe672a 100644 --- a/code/missions.h +++ b/code/missions.h @@ -18,35 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 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(); diff --git a/code/player.cpp b/code/player.cpp index 0640c60..133bbfe 100644 --- a/code/player.cpp +++ b/code/player.cpp @@ -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. diff --git a/code/player.h b/code/player.h index 15770c8..76e8310 100644 --- a/code/player.h +++ b/code/player.h @@ -18,33 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 mission currentMission; -extern Game currentGame; -extern object weapon[MAX_WEAPONS]; -extern object enemy[MAX_ALIENS]; -extern Graphics graphics; + +extern void initPlayer(); +extern void doPlayer(); +extern void flushInput(); +extern void getPlayerInput(); +extern void leaveSector(); diff --git a/code/resources.cpp b/code/resources.cpp index 3ffe902..53f2824 100644 --- a/code/resources.cpp +++ b/code/resources.cpp @@ -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) { @@ -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]; colors[0].r = 0; diff --git a/code/resources.h b/code/resources.h index 1cd965a..b9eabd9 100644 --- a/code/resources.h +++ b/code/resources.h @@ -18,28 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 loadBackground(const char *filename); extern void loadGameGraphics(); - -extern globalEngineVariables engine; -extern object weapon[MAX_WEAPONS]; -extern Mix_Chunk *sound[MAX_SOUNDS]; -extern object enemy[MAX_ALIENS]; -extern Graphics graphics; -extern Game currentGame; +extern void loadSound(); +extern void freeSound(); +extern void loadFont(); diff --git a/code/script.cpp b/code/script.cpp index 9717ecc..a5e95a9 100644 --- a/code/script.cpp +++ b/code/script.cpp @@ -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] = { "How nice to see you again, Bainfield!", @@ -133,7 +136,7 @@ void syncScriptEvents() } } -void setScene(int scene) +static void setScene(int scene) { FILE *fp; char string[255], face[255]; diff --git a/code/script.h b/code/script.h index 3ee1ef7..9b4f0f9 100644 --- a/code/script.h +++ b/code/script.h @@ -18,35 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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]; +extern void loadScriptEvents(); +extern void checkScriptEvents(); +extern void syncScriptEvents(); +extern void doCutscene(int scene); diff --git a/code/shop.cpp b/code/shop.cpp index 2717da2..c5941ab 100644 --- a/code/shop.cpp +++ b/code/shop.cpp @@ -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]; strcpy(description, ""); @@ -66,7 +69,7 @@ void drawSecondaryWeaponSurface() } } -void adjustShopPrices() +static void adjustShopPrices() { shopItems[0].price = (500 * currentGame.maxPlasmaOutput); shopItems[1].price = (500 * currentGame.maxPlasmaDamage); @@ -98,7 +101,7 @@ void adjustShopPrices() shopItems[7].price = 0; } -void drawShop() +static void drawShop() { adjustShopPrices(); @@ -260,7 +263,7 @@ void drawShop() #if USEPACK -void loadShop() +static void loadShop() { char name[255], description[255]; int price, image, x, y; @@ -307,7 +310,7 @@ void initShop(){loadShop();} #else -void saveShop() +static void saveShop() { FILE *fp; @@ -475,7 +478,7 @@ void initShop() #endif -void buy(int i) +static void buy(int i) { if ((currentGame.cash < shopItems[i].price) && (!engine.cheatCash)) { @@ -605,7 +608,7 @@ void buy(int i) currentGame.cash -= shopItems[i].price; } -void sell(int i) +static void sell(int i) { switch (i) { diff --git a/code/shop.h b/code/shop.h index 1c29183..6f6ff20 100644 --- a/code/shop.h +++ b/code/shop.h @@ -18,26 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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; - +extern void initShop(); +extern void showShop(); diff --git a/code/title.cpp b/code/title.cpp index e2dd817..b84dee8 100644 --- a/code/title.cpp +++ b/code/title.cpp @@ -18,10 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "version.h" -#include "title.h" +#include "Starfighter.h" -signed char showGameMenu(signed char continueSaveSlot) +static signed char showGameMenu(signed char continueSaveSlot) { graphics.blitText(2); if (continueSaveSlot != 0) @@ -47,7 +46,7 @@ signed char showGameMenu(signed char continueSaveSlot) return 5; } -signed char showLoadMenu() +static signed char showLoadMenu() { signed char rtn = 1; @@ -65,7 +64,7 @@ signed char showLoadMenu() return rtn; } -void createOptionsMenu() +static void createOptionsMenu() { if (currentGame.useSound) graphics.textSurface(8, "SOUND - ON", -1, 350, FONT_WHITE); @@ -89,7 +88,7 @@ void createOptionsMenu() graphics.textSurface(11, string, -1, 410, FONT_WHITE); } -signed char showOptionsMenu() +static signed char showOptionsMenu() { graphics.textShape[12].y = 450; @@ -102,7 +101,7 @@ signed char showOptionsMenu() return 5; } -void createCheatMenu() +static void createCheatMenu() { if (engine.cheatShield) 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); } -signed char showCheatMenu() +static signed char showCheatMenu() { graphics.textShape[12].y = 450; diff --git a/code/title.h b/code/title.h index 045b8a9..628a1a5 100644 --- a/code/title.h +++ b/code/title.h @@ -18,37 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 int doTitle(); +extern void showStory(); +extern void gameover(); 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; diff --git a/code/unpack.cpp b/code/unpack.cpp index fd1593a..acc7f6c 100644 --- a/code/unpack.cpp +++ b/code/unpack.cpp @@ -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 diff --git a/code/unpack.h b/code/unpack.h index a7a24bc..fe3ba50 100644 --- a/code/unpack.h +++ b/code/unpack.h @@ -18,18 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include - -#include -#include -#include -#include - -#include "defs.h" -#include "structs.h" - -extern void showErrorAndExit(int errorId, const char *name); - -extern globalEngineVariables engine; +extern void unpack(const char *file, signed char fileType); +extern int locateDataInPak(const char *file, bool required); diff --git a/code/weapons.cpp b/code/weapons.cpp index 11efa08..26335cb 100644 --- a/code/weapons.cpp +++ b/code/weapons.cpp @@ -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() { @@ -31,7 +33,7 @@ void setWeaponShapes() #if USEPACK -void loadWeapons() +static void loadWeapons() { int dataLocation = locateDataInPak("data/weapons.dat", 1); int id, ammo, damage, reload, speed, image1, image2, flags; @@ -69,7 +71,7 @@ void initWeapons() {loadWeapons();} #else -void saveWeapons() +static void saveWeapons() { FILE *fp; diff --git a/code/weapons.h b/code/weapons.h index cccc96e..f2106bf 100644 --- a/code/weapons.h +++ b/code/weapons.h @@ -18,19 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include - -#include -#include -#include - -#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 void setWeaponShapes(); +extern void initWeapons();