From 69c2fdf6807108155f594b89733231ed797c9ea9 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 1 May 2021 13:32:57 +0100 Subject: [PATCH] Source tidying. --- src/battle/bullets.c | 2 +- src/defs.h | 205 ++++++++++++++++++++-------------------- src/system/transition.c | 6 +- src/system/util.c | 2 +- 4 files changed, 108 insertions(+), 107 deletions(-) diff --git a/src/battle/bullets.c b/src/battle/bullets.c index 122d85c..c6b3bee 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -261,7 +261,7 @@ static void checkCollisions(Bullet *b) } } -void doBulletHitEffect(Bullet *b) +static void doBulletHitEffect(Bullet *b) { switch (b->type) { diff --git a/src/defs.h b/src/defs.h index 67de91b..03ab380 100644 --- a/src/defs.h +++ b/src/defs.h @@ -19,36 +19,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef REVISION -#define REVISION 0 +#define REVISION 0 #endif #ifndef DATA_DIR -#define DATA_DIR "" +#define DATA_DIR "" #endif #ifndef FIXED_RESOLUTION -#define FIXED_RESOLUTION 0 +#define FIXED_RESOLUTION 0 #endif #ifndef AUDIO_FREQUENCY -#define AUDIO_FREQUENCY 44100 +#define AUDIO_FREQUENCY 44100 #endif #ifndef AUDIO_CHANNELS -#define AUDIO_CHANNELS 2 +#define AUDIO_CHANNELS 2 #endif #ifndef AUDIO_CHUNKSIZE -#define AUDIO_CHUNKSIZE 1024 +#define AUDIO_CHUNKSIZE 1024 #endif #ifndef AUDIO_MIX_CHANNELS -#define AUDIO_MIX_CHANNELS 64 +#define AUDIO_MIX_CHANNELS 64 #endif #define _(string) getTranslatedString(string) -#define PI 3.14159265358979323846 +#define PI 3.14159265358979323846 #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define CAROLINE(a,b) MIN(a,b) @@ -56,118 +56,119 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TO_RAIDANS(angleDegrees) (angleDegrees * PI / 180.0) #define TO_DEGREES(angleRadians) (angleRadians * 180.0 / PI) -#define SAVE_FILENAME "game.save" -#define CONFIG_FILENAME "config.json" +#define SAVE_FILENAME "game.save" +#define CONFIG_FILENAME "config.json" -#define SCREEN_WIDTH 1280 -#define SCREEN_HEIGHT 720 +#define SCREEN_WIDTH 1280 +#define SCREEN_HEIGHT 720 -#define UI_WIDTH 1280 -#define UI_HEIGHT 720 +#define UI_WIDTH 1280 +#define UI_HEIGHT 720 -#define MAX_KEYBOARD_KEYS 350 -#define MAX_MOUSE_BUTTONS 6 +#define MAX_KEYBOARD_KEYS 350 +#define MAX_MOUSE_BUTTONS 6 -#define FPS 60 +#define FPS 60 -#define MAX_NAME_LENGTH 32 -#define MAX_DESCRIPTION_LENGTH 512 -#define MAX_LINE_LENGTH 1024 -#define MAX_FILENAME_LENGTH 1024 -#define MAX_PATH_LENGTH 4096 +#define MAX_NAME_LENGTH 32 +#define MAX_DESCRIPTION_LENGTH 512 +#define MAX_LINE_LENGTH 1024 +#define MAX_FILENAME_LENGTH 1024 +#define MAX_PATH_LENGTH 4096 -#define NUM_TEXTURE_BUCKETS 32 -#define NUM_ATLAS_BUCKETS 64 -#define NUM_GLYPH_BUCKETS 128 +#define NUM_TEXTURE_BUCKETS 32 +#define NUM_ATLAS_BUCKETS 64 -#define MAX_STARS 500 +#define MAX_GLYPHS 400 -#define MAX_CHALLENGES 3 +#define MAX_STARS 500 -#define MAX_FIGHTER_GUNS 12 -#define MAX_TARGET_RANGE 65536 -#define MAX_SYSTEM_POWER 100 +#define MAX_CHALLENGES 3 -#define BATTLE_AREA_CELLS 50 -#define BATTLE_AREA_WIDTH (640 * BATTLE_AREA_CELLS) -#define BATTLE_AREA_HEIGHT (360 * BATTLE_AREA_CELLS) -#define BATTLE_AREA_EDGE 250 +#define MAX_FIGHTER_GUNS 12 +#define MAX_TARGET_RANGE 65536 +#define MAX_SYSTEM_POWER 100 -#define BF_NONE 0 -#define BF_ENGINE (2 << 0) -#define BF_SYSTEM_DAMAGE (2 << 1) -#define BF_SHIELD_DAMAGE (2 << 2) -#define BF_EXPLODES (2 << 3) +#define BATTLE_AREA_CELLS 50 +#define BATTLE_AREA_WIDTH (640 * BATTLE_AREA_CELLS) +#define BATTLE_AREA_HEIGHT (360 * BATTLE_AREA_CELLS) +#define BATTLE_AREA_EDGE 250 -#define EF_NONE 0 -#define EF_NO_KILL (2 << 0) -#define EF_DISABLED (2 << 1) -#define EF_IMMORTAL (2 << 2) -#define EF_MISSION_TARGET (2 << 3) -#define EF_NO_MT_BOX (2 << 4) -#define EF_HAS_ROPE (2 << 5) -#define EF_COLLECTS_ITEMS (2 << 6) -#define EF_MUST_DISABLE (2 << 7) -#define EF_RETREATING (2 << 8) -#define EF_NO_EPIC (2 << 9) -#define EF_STATIC (2 << 10) -#define EF_TAKES_DAMAGE (2 << 11) -#define EF_SECONDARY_TARGET (2 << 12) -#define EF_AI_TARGET (2 << 13) -#define EF_AI_LEADER (2 << 14) -#define EF_ROPED_ATTACHED (2 << 15) -#define EF_NO_KILL_INC (2 << 16) -#define EF_SHORT_RADAR_RANGE (2 << 17) -#define EF_NO_PLAYER_TARGET (2 << 18) -#define EF_AI_IGNORE (2 << 19) -#define EF_NON_SOLID (2 << 20) -#define EF_NO_HEALTH_BAR (2 << 21) -#define EF_FRIENDLY_HEALTH_BAR (2 << 22) -#define EF_NO_THREAT (2 << 23) -#define EF_DROPS_ITEMS (2 << 24) -#define EF_COMMON_FIGHTER (2 << 25) +#define BF_NONE 0 +#define BF_ENGINE (2 << 0) +#define BF_SYSTEM_DAMAGE (2 << 1) +#define BF_SHIELD_DAMAGE (2 << 2) +#define BF_EXPLODES (2 << 3) -#define AIF_NONE 0 -#define AIF_FOLLOWS_PLAYER (2 << 0) -#define AIF_MOVES_TO_PLAYER (2 << 1) -#define AIF_UNLIMITED_RANGE (2 << 2) -#define AIF_COLLECTS_ITEMS (2 << 3) -#define AIF_TOWS (2 << 4) -#define AIF_RETREATS (2 << 5) -#define AIF_GOAL_JUMPGATE (2 << 6) -#define AIF_AVOIDS_COMBAT (2 << 7) -#define AIF_DEFENSIVE (2 << 8) -#define AIF_MISSILE_BOAT (2 << 9) -#define AIF_AGGRESSIVE (2 << 10) -#define AIF_LONG_RANGE_FIRE (2 << 11) -#define AIF_MOVES_TO_LEADER (2 << 12) -#define AIF_EVADE (2 << 13) -#define AIF_WANDERS (2 << 14) -#define AIF_COVERS_RETREAT (2 << 15) -#define AIF_TARGET_FOCUS (2 << 16) -#define AIF_DROPS_MINES (2 << 17) -#define AIF_ASSASSIN (2 << 18) -#define AIF_SUSPICIOUS (2 << 19) -#define AIF_ZAK_SUSPICIOUS (2 << 20) -#define AIF_SURRENDERS (2 << 21) -#define AIF_SURRENDERING (2 << 22) -#define AIF_SURRENDERED (2 << 23) +#define EF_NONE 0 +#define EF_NO_KILL (2 << 0) +#define EF_DISABLED (2 << 1) +#define EF_IMMORTAL (2 << 2) +#define EF_MISSION_TARGET (2 << 3) +#define EF_NO_MT_BOX (2 << 4) +#define EF_HAS_ROPE (2 << 5) +#define EF_COLLECTS_ITEMS (2 << 6) +#define EF_MUST_DISABLE (2 << 7) +#define EF_RETREATING (2 << 8) +#define EF_NO_EPIC (2 << 9) +#define EF_STATIC (2 << 10) +#define EF_TAKES_DAMAGE (2 << 11) +#define EF_SECONDARY_TARGET (2 << 12) +#define EF_AI_TARGET (2 << 13) +#define EF_AI_LEADER (2 << 14) +#define EF_ROPED_ATTACHED (2 << 15) +#define EF_NO_KILL_INC (2 << 16) +#define EF_SHORT_RADAR_RANGE (2 << 17) +#define EF_NO_PLAYER_TARGET (2 << 18) +#define EF_AI_IGNORE (2 << 19) +#define EF_NON_SOLID (2 << 20) +#define EF_NO_HEALTH_BAR (2 << 21) +#define EF_FRIENDLY_HEALTH_BAR (2 << 22) +#define EF_NO_THREAT (2 << 23) +#define EF_DROPS_ITEMS (2 << 24) +#define EF_COMMON_FIGHTER (2 << 25) + +#define AIF_NONE 0 +#define AIF_FOLLOWS_PLAYER (2 << 0) +#define AIF_MOVES_TO_PLAYER (2 << 1) +#define AIF_UNLIMITED_RANGE (2 << 2) +#define AIF_COLLECTS_ITEMS (2 << 3) +#define AIF_TOWS (2 << 4) +#define AIF_RETREATS (2 << 5) +#define AIF_GOAL_JUMPGATE (2 << 6) +#define AIF_AVOIDS_COMBAT (2 << 7) +#define AIF_DEFENSIVE (2 << 8) +#define AIF_MISSILE_BOAT (2 << 9) +#define AIF_AGGRESSIVE (2 << 10) +#define AIF_LONG_RANGE_FIRE (2 << 11) +#define AIF_MOVES_TO_LEADER (2 << 12) +#define AIF_EVADE (2 << 13) +#define AIF_WANDERS (2 << 14) +#define AIF_COVERS_RETREAT (2 << 15) +#define AIF_TARGET_FOCUS (2 << 16) +#define AIF_DROPS_MINES (2 << 17) +#define AIF_ASSASSIN (2 << 18) +#define AIF_SUSPICIOUS (2 << 19) +#define AIF_ZAK_SUSPICIOUS (2 << 20) +#define AIF_SURRENDERS (2 << 21) +#define AIF_SURRENDERING (2 << 22) +#define AIF_SURRENDERED (2 << 23) /* player abilities */ -#define BOOST_RECHARGE_TIME (FPS * 7) -#define BOOST_FINISHED_TIME (FPS * 0.75) -#define ECM_RECHARGE_TIME (FPS * 7) +#define BOOST_RECHARGE_TIME (FPS * 7) +#define BOOST_FINISHED_TIME (FPS * 0.75) +#define ECM_RECHARGE_TIME (FPS * 7) -#define MB_NORMAL 0 -#define MB_IMPORTANT 1 -#define MB_PANDORAN 2 +#define MB_NORMAL 0 +#define MB_IMPORTANT 1 +#define MB_PANDORAN 2 -#define SS_NORMAL 0 -#define SS_SOL 1 -#define SS_PANDORAN 2 +#define SS_NORMAL 0 +#define SS_SOL 1 +#define SS_PANDORAN 2 -#define MAX_SUSPICION_LEVEL 1500.0 -#define MAX_ZAK_SUSPICION_LEVEL (FPS * 30) +#define MAX_SUSPICION_LEVEL 1500.0 +#define MAX_ZAK_SUSPICION_LEVEL (FPS * 30) enum { diff --git a/src/system/transition.c b/src/system/transition.c index cc6c095..2483e77 100644 --- a/src/system/transition.c +++ b/src/system/transition.c @@ -35,10 +35,10 @@ void startSectionTransition(void) void endSectionTransition(void) { - long elasped = 250 - (SDL_GetTicks() - transitionStartTime); + long elapsed = 250 - (SDL_GetTicks() - transitionStartTime); - if (elasped > 0) + if (elapsed > 0) { - SDL_Delay(elasped); + SDL_Delay(elapsed); } } diff --git a/src/system/util.c b/src/system/util.c index 6766eef..b69b651 100644 --- a/src/system/util.c +++ b/src/system/util.c @@ -117,7 +117,7 @@ char *timeToDate(long millis) timeinfo = localtime(&time); - strftime(DATE, MAX_NAME_LENGTH, "%d %b %Y, %I:%M%p", timeinfo); + strftime(DATE, MAX_NAME_LENGTH, "%d %b %Y, %H:%M%p", timeinfo); return DATE; }