More cleanup.

This commit is contained in:
onpon4 2016-11-25 18:21:31 -05:00
parent 60ed5cbd65
commit d336bb2c83
49 changed files with 156 additions and 11 deletions

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h" #include "CoreFoundation/CoreFoundation.h"
#endif #endif

View File

@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
@ -32,9 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL_image.h" #include "SDL_image.h"
#include "SDL_mixer.h" #include "SDL_mixer.h"
#include "defs.h"
#include "structs.h"
#include "alien.h" #include "alien.h"
#include "audio.h" #include "audio.h"
#include "bullet.h" #include "bullet.h"

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef ALIEN_H #ifndef ALIEN_H
#define ALIEN_H #define ALIEN_H
#include "defs.h"
#include "structs.h"
extern Object alien_defs[CD_MAX]; extern Object alien_defs[CD_MAX];
extern Object aliens[ALIEN_MAX]; extern Object aliens[ALIEN_MAX];

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef AUDIO_H #ifndef AUDIO_H
#define AUDIO_H #define AUDIO_H
#include "defs.h"
#include "structs.h"
void audio_loadSounds(); void audio_loadSounds();
void audio_playSound(int sid, float x, float y); void audio_playSound(int sid, float x, float y);
void audio_haltMusic(); void audio_haltMusic();

View File

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

View File

@ -18,6 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
#include "radio.h" #include "radio.h"
Object cargo[MAX_CARGO]; Object cargo[MAX_CARGO];

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _CARGO_H_ #ifndef _CARGO_H_
#define _CARGO_H_ #define _CARGO_H_
#include "defs.h"
#include "structs.h"
extern Object cargo[MAX_CARGO]; extern Object cargo[MAX_CARGO];
void cargo_init(); void cargo_init();

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
/* /*
Create a new collectable item based on supplied arguments. Create a new collectable item based on supplied arguments.
*/ */

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef COLLECTABLE_H #ifndef COLLECTABLE_H
#define COLLECTABLE_H #define COLLECTABLE_H
#include "defs.h"
#include "structs.h"
void collectable_add(float x, float y, int type, int value, int life); void collectable_add(float x, float y, int type, int value, int life);
int collectable_collision(Collectable *collectable, Object *ship); int collectable_collision(Collectable *collectable, Object *ship);
void collectable_explode(Collectable *collectable); void collectable_explode(Collectable *collectable);

View File

@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
Uint32 red; Uint32 red;
Uint32 darkRed; Uint32 darkRed;
Uint32 yellow; Uint32 yellow;

View File

@ -20,6 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef COLORS_H #ifndef COLORS_H
#define COLORS_H #define COLORS_H
#include "SDL.h"
#include "defs.h"
#include "structs.h"
extern Uint32 red; extern Uint32 red;
extern Uint32 darkRed; extern Uint32 darkRed;
extern Uint32 yellow; extern Uint32 yellow;

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
typedef struct Message_ { typedef struct Message_ {
int face; int face;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CUTSCENE_H #ifndef CUTSCENE_H
#define CUTSCENE_H #define CUTSCENE_H
#include "defs.h"
#include "structs.h"
void cutscene_init(int scene); void cutscene_init(int scene);
#endif #endif

View File

@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DEFS_H #ifndef DEFS_H
#define DEFS_H #define DEFS_H
#include <stdlib.h>
// Macros // Macros
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))

View File

@ -19,11 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include "defs.h"
#include "structs.h"
Engine engine; Engine engine;
void engine_init() void engine_init()

View File

@ -18,6 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
#include "radio.h" #include "radio.h"
static Event events[MAX_EVENTS]; static Event events[MAX_EVENTS];

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef EVENT_H #ifndef EVENT_H
#define EVENT_H #define EVENT_H
#include "defs.h"
#include "structs.h"
typedef struct Event_ { typedef struct Event_ {
int time; int time;

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
/* /*
Create a new explosion based on supplied parameters. Create a new explosion based on supplied parameters.
The "type" will actually be used as an explosion frame check. The "type" will actually be used as an explosion frame check.

View File

@ -17,8 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef EXPLOSIONS_H #ifndef EXPLOSION_H
#define EXPLOSIONS_H #define EXPLOSION_H
#include "defs.h"
#include "structs.h"
void explosion_add(float x, float y, int type); void explosion_add(float x, float y, int type);
void explosion_addEngine(Object *craft); void explosion_addEngine(Object *craft);

View File

@ -18,6 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
#include "radio.h" #include "radio.h"
Game game; Game game;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GAME_H #ifndef GAME_H
#define GAME_H #define GAME_H
#include "defs.h"
#include "structs.h"
extern Game game; extern Game game;
void game_init(); void game_init();

View File

@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
SDL_Surface *gfx_background; SDL_Surface *gfx_background;
SDL_Surface *gfx_sprites[SP_MAX]; SDL_Surface *gfx_sprites[SP_MAX];
SDL_Surface *gfx_faceSprites[FS_MAX]; SDL_Surface *gfx_faceSprites[FS_MAX];

View File

@ -20,7 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GFX_H #ifndef GFX_H
#define GFX_H #define GFX_H
#include "Starfighter.h" #include "SDL.h"
#include "defs.h"
#include "structs.h"
extern SDL_Surface *gfx_background; extern SDL_Surface *gfx_background;
extern SDL_Surface *gfx_sprites[SP_MAX]; extern SDL_Surface *gfx_sprites[SP_MAX];

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
void info_clearLines() void info_clearLines()
{ {
for (int i = 0 ; i < MAX_INFOLINES ; i++) for (int i = 0 ; i < MAX_INFOLINES ; i++)

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef INFO_H #ifndef INFO_H
#define INFO_H #define INFO_H
#include "defs.h"
#include "structs.h"
void info_clearLines(); void info_clearLines();
void info_copyLine(int a, int b); void info_copyLine(int a, int b);
void info_setLine(const char *in, int color); void info_setLine(const char *in, int color);

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
// XXX: Magic number // XXX: Magic number
Planet intermission_planets[10]; Planet intermission_planets[10];

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef INTERMISSION_H #ifndef INTERMISSION_H
#define INTERMISSION_H #define INTERMISSION_H
#include "defs.h"
#include "structs.h"
extern Planet intermission_planets[10]; extern Planet intermission_planets[10];
void intermission_initPlanets(int system); void intermission_initPlanets(int system);

View File

@ -18,6 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
#include "radio.h" #include "radio.h"
Mission mission; Mission mission;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef MISSION_H #ifndef MISSION_H
#define MISSION_H #define MISSION_H
#include "defs.h"
#include "structs.h"
extern Mission mission; extern Mission mission;
void mission_set(int mission); void mission_set(int mission);

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
Object player; Object player;
int player_chargerFired = 0; int player_chargerFired = 0;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PLAYER_H #ifndef PLAYER_H
#define PLAYER_H #define PLAYER_H
#include "defs.h"
#include "structs.h"
extern Object player; extern Object player;
extern int player_chargerFired; extern int player_chargerFired;

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
/* /*
Sets a radio message that appears at the top of the screen. Used for Sets a radio message that appears at the top of the screen. Used for
script events, etc. We send a message priority too, since we don't want script events, etc. We send a message priority too, since we don't want

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RADIO_H #ifndef RADIO_H
#define RADIO_H #define RADIO_H
#include "defs.h"
#include "structs.h"
void radio_setMessage(int face, const char *in, int priority); void radio_setMessage(int face, const char *in, int priority);
#endif #endif

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL.h" #include "SDL.h"
#include "defs.h"
#include "structs.h"
#include "screen.h" #include "screen.h"
SDL_Renderer *renderer; SDL_Renderer *renderer;

View File

@ -20,6 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RENDERER_H #ifndef RENDERER_H
#define RENDERER_H #define RENDERER_H
#include "SDL.h"
#include "defs.h"
#include "structs.h"
extern SDL_Renderer *renderer; extern SDL_Renderer *renderer;
extern SDL_Texture *renderer_texture; extern SDL_Texture *renderer_texture;

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
static char saveSlot[10][25]; static char saveSlot[10][25];
/* /*

View File

@ -20,6 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SAVE_H #ifndef SAVE_H
#define SAVE_H #define SAVE_H
#include "SDL.h"
#include "defs.h"
#include "structs.h"
int save_initSlots(); int save_initSlots();
int save_load(int slot); int save_load(int slot);
void save(int slot); void save(int slot);

View File

@ -21,9 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL.h" #include "SDL.h"
#include "defs.h"
#include "structs.h"
#include "engine.h" #include "engine.h"
#include "gfx.h" #include "gfx.h"
#include "structs.h"
SDL_Surface *screen; SDL_Surface *screen;
bRect *screen_bufferHead; bRect *screen_bufferHead;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SCREEN_H #ifndef SCREEN_H
#define SCREEN_H #define SCREEN_H
#include "SDL.h"
#include "defs.h"
#include "structs.h" #include "structs.h"
extern SDL_Surface *screen; extern SDL_Surface *screen;

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
int ship_collision(Object *ship, Object *otherShip) int ship_collision(Object *ship, Object *otherShip)
{ {
float x0 = ship->x; float x0 = ship->x;

View File

@ -18,6 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHIP_H #ifndef SHIP_H
#define SHIP_H #define SHIP_H
#include "defs.h"
#include "structs.h"
int ship_collision(Object *ship, Object *otherShip); int ship_collision(Object *ship, Object *otherShip);
void ship_fireBullet(Object *ship, int weaponType); void ship_fireBullet(Object *ship, int weaponType);
void ship_fireRay(Object *ship); void ship_fireRay(Object *ship);

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
static ShopItem shopItems[SHOP_MAX]; static ShopItem shopItems[SHOP_MAX];
static int shopSelectedItem; static int shopSelectedItem;

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHOP_H #ifndef SHOP_H
#define SHOP_H #define SHOP_H
#include "defs.h"
#include "structs.h"
void shop_init(); void shop_init();
void shop_show(); void shop_show();

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
static int showGameMenu(int continueSaveSlot) static int showGameMenu(int continueSaveSlot)
{ {
screen_blitText(TS_START_NEW_GAME); screen_blitText(TS_START_NEW_GAME);

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef TITLE_H #ifndef TITLE_H
#define TITLE_H #define TITLE_H
#include "defs.h"
#include "structs.h"
int title_show(); int title_show();
void title_showCredits(); void title_showCredits();

View File

@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
#include "defs.h"
#include "structs.h"
Object weapons[W_MAX]; Object weapons[W_MAX];
/* /*

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WEAPONS_H #ifndef WEAPONS_H
#define WEAPONS_H #define WEAPONS_H
#include "defs.h"
#include "structs.h"
extern Object weapons[W_MAX]; extern Object weapons[W_MAX];
void weapons_init(); void weapons_init();

View File

@ -20,4 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL.h" #include "SDL.h"
#include "defs.h"
#include "structs.h"
SDL_Window *window; SDL_Window *window;

View File

@ -20,6 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WINDOW_H #ifndef WINDOW_H
#define WINDOW_H #define WINDOW_H
#include "SDL.h"
#include "defs.h"
#include "structs.h"
extern SDL_Window *window; extern SDL_Window *window;
#endif #endif