diff --git a/src/collectable.h b/src/collectable.h
index 05252a3..2766c14 100644
--- a/src/collectable.h
+++ b/src/collectable.h
@@ -20,9 +20,24 @@ along with this program. If not, see .
#ifndef COLLECTABLE_H
#define COLLECTABLE_H
+#include "SDL.h"
+
#include "defs.h"
#include "structs.h"
+typedef struct Collectable_ {
+
+ int active;
+ float x, y, dx, dy;
+ SDL_Surface *image;
+ int type; // What kind of collectable is it?
+ int value; // How much is it worth?
+ int life; // How long it will stay around for
+
+ struct Collectable_ *next;
+
+} Collectable;
+
void collectable_add(float x, float y, int type, int value, int life);
int collectable_collision(Collectable *collectable, Object *ship);
void collectable_explode(Collectable *collectable);
diff --git a/src/engine.h b/src/engine.h
index 99f4609..422a057 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -25,6 +25,8 @@ along with this program. If not, see .
#include "defs.h"
#include "structs.h"
+#include "collectable.h"
+
typedef struct Engine_ {
diff --git a/src/game.cpp b/src/game.cpp
index 21485ba..81e634f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -24,6 +24,13 @@ along with this program. If not, see .
#include "radio.h"
+typedef struct Star_ {
+
+ float x, y, dx, dy;
+ int speed; // How fast the star moves
+
+} Star;
+
Game game;
static Star stars[STARS_NUM];
diff --git a/src/game.h b/src/game.h
index 9e85855..32c9fa1 100644
--- a/src/game.h
+++ b/src/game.h
@@ -20,9 +20,84 @@ along with this program. If not, see .
#ifndef GAME_H
#define GAME_H
+#include "SDL.h"
+
#include "defs.h"
#include "structs.h"
+typedef struct Game_ {
+ Object thePlayer;
+ Object playerWeapon;
+
+ int saveFormat;
+
+ int difficulty;
+
+ int system;
+ int area;
+ int musicVolume;
+ int sfxVolume;
+
+ int cash;
+ int cashEarned;
+
+ int shots;
+ int hits;
+ int accuracy;
+ int hasWingMate1;
+ int hasWingMate2;
+ int totalKills;
+ int wingMate1Kills;
+ int wingMate2Kills;
+ int wingMate1Ejects;
+ int wingMate2Ejects;
+ int totalOtherKills;
+ int secondaryMissions;
+ int secondaryMissionsCompleted;
+ int shieldPickups;
+ int rocketPickups;
+ int cellPickups;
+ int powerups;
+ int minesKilled;
+ int cargoPickups;
+
+ // slaves for Eyananth
+ int slavesRescued;
+
+ // remaining shield for experimental fighter
+ int experimentalShield;
+
+ Uint32 timeTaken; // In seconds
+ int missionCompleted[10];
+
+ int stationedPlanet;
+ int destinationPlanet;
+
+ char stationedName[20];
+ char destinationName[20];
+ int distanceCovered;
+
+ int minPlasmaRate;
+ int minPlasmaDamage;
+ int minPlasmaOutput;
+ int maxPlasmaRate;
+ int maxPlasmaDamage;
+ int maxPlasmaOutput;
+ int maxPlasmaAmmo;
+ int maxRocketAmmo;
+
+ // Limits on shop upgrades
+ int minPlasmaRateLimit;
+ int minPlasmaDamageLimit;
+ int minPlasmaOutputLimit;
+ int maxPlasmaRateLimit;
+ int maxPlasmaDamageLimit;
+ int maxPlasmaOutputLimit;
+ int maxPlasmaAmmoLimit;
+ int maxRocketAmmoLimit;
+
+} Game;
+
extern Game game;
void game_init();
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 9d4dffb..a246d6a 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -30,7 +30,7 @@ SDL_Surface *gfx_faceSprites[FS_MAX];
SDL_Surface *gfx_shipSprites[SS_MAX];
SDL_Surface *gfx_fontSprites[FONT_MAX];
SDL_Surface *gfx_shopSprites[SHOP_S_MAX];
-textObject gfx_textSprites[TS_MAX];
+TextObject gfx_textSprites[TS_MAX];
SDL_Surface *gfx_messageBox;
void gfx_init()
diff --git a/src/gfx.h b/src/gfx.h
index ff240ac..f064e7e 100644
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -31,7 +31,7 @@ extern SDL_Surface *gfx_faceSprites[FS_MAX];
extern SDL_Surface *gfx_shipSprites[SS_MAX];
extern SDL_Surface *gfx_fontSprites[FONT_MAX];
extern SDL_Surface *gfx_shopSprites[SHOP_S_MAX];
-extern textObject gfx_textSprites[TS_MAX];
+extern TextObject gfx_textSprites[TS_MAX];
extern SDL_Surface *gfx_messageBox;
void gfx_init();
diff --git a/src/mission.h b/src/mission.h
index 2965ea1..62028af 100644
--- a/src/mission.h
+++ b/src/mission.h
@@ -23,6 +23,28 @@ along with this program. If not, see .
#include "defs.h"
#include "structs.h"
+typedef struct Mission_ {
+
+ char primaryObjective[3][50]; // Description
+ int primaryType[3]; // The type of mission this is
+ int target1[3]; // index of target in aliens array
+ int targetValue1[3]; // Number of things to collect (slaves, cash, etc)
+ int timeLimit1[3]; // In minutes
+ int completed1[3];
+
+ char secondaryObjective[3][50]; // Description
+ int secondaryType[3]; // The type of mission this is
+ int target2[3]; // index of target in aliens array
+ int targetValue2[3]; // Number of things to collect (slaves, cash, etc)
+ int timeLimit2[3]; // In minutes
+ int completed2[3];
+
+ int remainingObjectives1;
+ int remainingObjectives2;
+ int addAliens; // How often to add new enemies
+
+} Mission;
+
extern Mission mission;
void mission_set(int mission);
diff --git a/src/shop.cpp b/src/shop.cpp
index b339ca4..f9427d5 100644
--- a/src/shop.cpp
+++ b/src/shop.cpp
@@ -22,6 +22,16 @@ along with this program. If not, see .
#include "defs.h"
#include "structs.h"
+typedef struct ShopItem_ {
+
+ int x, y;
+ int price;
+ char name[50];
+ char description[255];
+ int image;
+
+} ShopItem;
+
static ShopItem shopItems[SHOP_MAX];
static int shopSelectedItem;
diff --git a/src/structs.h b/src/structs.h
index a95669f..b70f439 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -68,49 +68,7 @@ typedef struct Object_ {
} Object;
-typedef struct Mission_ {
-
- char primaryObjective[3][50]; // Description
- int primaryType[3]; // The type of mission this is
- int target1[3]; // index of target in aliens array
- int targetValue1[3]; // Number of things to collect (slaves, cash, etc)
- int timeLimit1[3]; // In minutes
- int completed1[3];
-
- char secondaryObjective[3][50]; // Description
- int secondaryType[3]; // The type of mission this is
- int target2[3]; // index of target in aliens array
- int targetValue2[3]; // Number of things to collect (slaves, cash, etc)
- int timeLimit2[3]; // In minutes
- int completed2[3];
-
- int remainingObjectives1;
- int remainingObjectives2;
- int addAliens; // How often to add new enemies
-
-} Mission;
-
-typedef struct Star_ {
-
- float x, y, dx, dy;
- int speed; // How fast the star moves
-
-} Star;
-
-typedef struct Collectable_ {
-
- int active;
- float x, y, dx, dy;
- SDL_Surface *image;
- int type; // What kind of collectable is it?
- int value; // How much is it worth?
- int life; // How long it will stay around for
-
- struct Collectable_ *next;
-
-} Collectable;
-
-typedef struct textObject_ {
+typedef struct TextObject_ {
SDL_Surface *image;
int life;
@@ -118,90 +76,7 @@ typedef struct textObject_ {
int fontColor;
char text[255];
-} textObject;
-
-typedef struct Game_ {
- Object thePlayer;
- Object playerWeapon;
-
- int saveFormat;
-
- int difficulty;
-
- int system;
- int area;
- int musicVolume;
- int sfxVolume;
-
- int cash;
- int cashEarned;
-
- int shots;
- int hits;
- int accuracy;
- int hasWingMate1;
- int hasWingMate2;
- int totalKills;
- int wingMate1Kills;
- int wingMate2Kills;
- int wingMate1Ejects;
- int wingMate2Ejects;
- int totalOtherKills;
- int secondaryMissions;
- int secondaryMissionsCompleted;
- int shieldPickups;
- int rocketPickups;
- int cellPickups;
- int powerups;
- int minesKilled;
- int cargoPickups;
-
- // slaves for Eyananth
- int slavesRescued;
-
- // remaining shield for experimental fighter
- int experimentalShield;
-
- Uint32 timeTaken; // In seconds
- int missionCompleted[10];
-
- int stationedPlanet;
- int destinationPlanet;
-
- char stationedName[20];
- char destinationName[20];
- int distanceCovered;
-
- int minPlasmaRate;
- int minPlasmaDamage;
- int minPlasmaOutput;
- int maxPlasmaRate;
- int maxPlasmaDamage;
- int maxPlasmaOutput;
- int maxPlasmaAmmo;
- int maxRocketAmmo;
-
- // Limits on shop upgrades
- int minPlasmaRateLimit;
- int minPlasmaDamageLimit;
- int minPlasmaOutputLimit;
- int maxPlasmaRateLimit;
- int maxPlasmaDamageLimit;
- int maxPlasmaOutputLimit;
- int maxPlasmaAmmoLimit;
- int maxRocketAmmoLimit;
-
-} Game;
-
-typedef struct ShopItem_ {
-
- int x, y;
- int price;
- char name[50];
- char description[255];
- int image;
-
-} ShopItem;
+} TextObject;
typedef struct bRect_ {
diff --git a/src/title.cpp b/src/title.cpp
index 7b97668..9c5c5cd 100644
--- a/src/title.cpp
+++ b/src/title.cpp
@@ -625,7 +625,7 @@ void title_showCredits()
char text[255];
int i;
- textObject *credit;
+ TextObject *credit;
screen_clear(black);
renderer_update();
@@ -639,7 +639,7 @@ void title_showCredits()
// FIXME: It would be nice for the size of this array to be determined
// by the number of lines in the text file. I'm not sure how to do
// that at the moment, so just giving it a very large number for now.
- credit = (textObject*) malloc(sizeof(textObject) * 300);
+ credit = (TextObject*) malloc(sizeof(TextObject) * 300);
while (fscanf(fp, "%d %[^\n]%*c", &yPos, text) == 2)
{