From 23a92bb594edabff2af6d85d43df8406d02c9e1b Mon Sep 17 00:00:00 2001 From: onpon4 Date: Sun, 1 Mar 2015 04:30:11 -0500 Subject: [PATCH] Define compile-time options in defs.h, unless already defined. --- Makefile | 2 +- src/defs.h | 101 +++++++++++++++++++++++++++++------------------------ 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 577b9b7..4b488eb 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer` -DLINUX LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer` OBJS = ai.o aliens.o audio.o bullets.o cargo.o collectable.o comms.o debris.o events.o explosions.o game.o globals.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o shop.o Starfighter.o title.o weapons.o -VERSION = 1.3 +VERSION = 1.3-dev PROG = starfighter DOCS = docs/* DATA = data gfx sound diff --git a/src/defs.h b/src/defs.h index f417052..cba3643 100644 --- a/src/defs.h +++ b/src/defs.h @@ -21,15 +21,18 @@ along with this program. If not, see . // ALL #define NONE 0 -//AI Types -enum { +// Compile-time options +#ifndef VERSION +#define VERSION 1.3-dev +#endif - AI_NORMAL = 1, - AI_DEFENSIVE, - AI_OFFENSIVE, - AI_EVASIVE, - AI_WANDER -}; +#ifndef DATADIR +#define DATADIR "." +#endif + +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif // Object Flags #define FL_WEAPCO 1 @@ -56,6 +59,50 @@ enum { #define FL_HASMINIMUMSPEED 2097152 #define FL_FIRELASER 4194304 +// Explosions +#define E_SMALL_EXPLOSION 4 +#define E_BIG_EXPLOSION 8 +#define E_SMOKE 12 +#define E_TINY_EXPLOSION 16 +#define E_ELECTRICAL 20 + +// Weapon flags +#define WF_SPREAD 4 +#define WF_SCATTER 8 +#define WF_VARIABLE_SPEED 16 +#define WF_HOMING 32 +#define WF_SHOCKWAVE 64 +#define WF_WEAPCO 128 +#define WF_FRIEND 256 +#define WF_AIMED 512 +#define WF_DISABLE 1024 +#define WF_TIMEDEXPLOSION 2048 + +#define MAX_WEAPONS 20 +#define MAX_SHAPES 100 +#define MAX_SHIPSHAPES 120 +#define MAX_SOUNDS 17 +#define MAX_ALIENS 25 +#define MAX_TEXTSHAPES 70 +#define MAX_FONTSHAPES 6 +#define MAX_SHOPSHAPES 6 +#define MAX_DEFALIENS 40 +#define MAX_MISSIONS 28 +#define MAX_CARGO 20 +#define MAX_SHOPITEMS 17 + +#define SHIP_HIT_INDEX 60 + +// AI Types +enum { + + AI_NORMAL = 1, + AI_DEFENSIVE, + AI_OFFENSIVE, + AI_EVASIVE, + AI_WANDER +}; + // These are for Alien *indexes* NOT classdefs!! enum { @@ -100,13 +147,6 @@ enum { WT_SPREAD }; -// Explosions -#define E_SMALL_EXPLOSION 4 -#define E_BIG_EXPLOSION 8 -#define E_SMOKE 12 -#define E_TINY_EXPLOSION 16 -#define E_ELECTRICAL 20 - // Weapons enum { @@ -131,18 +171,6 @@ enum { W_DIRSHOCKMISSILE }; -// Weapon flags -#define WF_SPREAD 4 -#define WF_SCATTER 8 -#define WF_VARIABLE_SPEED 16 -#define WF_HOMING 32 -#define WF_SHOCKWAVE 64 -#define WF_WEAPCO 128 -#define WF_FRIEND 256 -#define WF_AIMED 512 -#define WF_DISABLE 1024 -#define WF_TIMEDEXPLOSION 2048 - // Missions enum { @@ -274,25 +302,6 @@ enum { DIFFICULTY_NIGHTMARE }; -#define MAX_WEAPONS 20 -#define MAX_SHAPES 100 -#define MAX_SHIPSHAPES 120 -#define MAX_SOUNDS 17 -#define MAX_ALIENS 25 -#define MAX_TEXTSHAPES 70 -#define MAX_FONTSHAPES 6 -#define MAX_SHOPSHAPES 6 -#define MAX_DEFALIENS 40 -#define MAX_MISSIONS 28 -#define MAX_CARGO 20 -#define MAX_SHOPITEMS 17 - -#define SHIP_HIT_INDEX 60 - -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif - enum { PAK_IMG,