Tidy #defines
This commit is contained in:
parent
7e14550cc1
commit
6b89d7e8e7
|
@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define AI_EVADE 0
|
||||
#define AI_FALLBACK 1
|
||||
#define AI_HUNT 2
|
||||
#define TURN_SPEED 4
|
||||
#define TURN_THRESHOLD 2
|
||||
#define AI_EVADE 0
|
||||
#define AI_FALLBACK 1
|
||||
#define AI_HUNT 2
|
||||
#define TURN_SPEED 4
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void applyFighterBrakes(void);
|
||||
|
|
|
@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define SHOW_BATTLE 0
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OBJECTIVES 2
|
||||
#define SHOW_OPTIONS 3
|
||||
#define SHOW_BATTLE 0
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OBJECTIVES 2
|
||||
#define SHOW_OPTIONS 3
|
||||
|
||||
extern void awardTrophy(char *id);
|
||||
extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center);
|
||||
|
|
|
@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define INITIAL_BULLET_DRAW_CAPACITY 32
|
||||
#define MISSILE_LIFE (FPS * 30)
|
||||
#define TURN_SPEED 2
|
||||
#define TURN_THRESHOLD 3
|
||||
#define INITIAL_BULLET_DRAW_CAPACITY 32
|
||||
#define MISSILE_LIFE (FPS * 30)
|
||||
#define TURN_SPEED 2
|
||||
#define TURN_THRESHOLD 3
|
||||
|
||||
extern void addBulletHitEffect(int x, int y, int r, int g, int b);
|
||||
extern void addMissileEngineEffect(Bullet *b);
|
||||
|
|
|
@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define TURN_SPEED 0.1
|
||||
#define TURN_THRESHOLD 2
|
||||
#define TURN_SPEED 0.1
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void addLargeEngineEffect(void);
|
||||
|
|
|
@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define INITIAL_DEBRIS_DRAW_CAPACITY 32
|
||||
#define MAX_DEBRIS_TEXTURES 6
|
||||
#define INITIAL_DEBRIS_DRAW_CAPACITY 32
|
||||
#define MAX_DEBRIS_TEXTURES 6
|
||||
|
||||
extern void addDebrisFire(int x, int y);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define INITIAL_EFFECT_DRAW_CAPACITY 128
|
||||
#define INITIAL_EFFECT_DRAW_CAPACITY 128
|
||||
|
||||
extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
|
|
|
@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define DISABLED_GLOW_MAX 255
|
||||
#define DISABLED_GLOW_MIN 128
|
||||
#define DISABLED_GLOW_SPEED 3
|
||||
#define DISABLED_GLOW_MAX 255
|
||||
#define DISABLED_GLOW_MIN 128
|
||||
#define DISABLED_GLOW_SPEED 3
|
||||
|
||||
extern void addToQuadtree(Entity *e, Quadtree *root);
|
||||
extern void awardTrophy(char *id);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define MAX_HUD_MESSAGES 6
|
||||
#define MAX_HUD_MESSAGES 6
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int center);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define ESCAPE_DISTANCE 256
|
||||
#define ESCAPE_DISTANCE 256
|
||||
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void addSmallExplosion(void);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define MSG_BOX_TEXT_WIDTH 600
|
||||
#define MSG_BOX_TEXT_WIDTH 600
|
||||
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern int getWrappedTextHeight(char *text, int size);
|
||||
|
|
|
@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define DAMAGE_RANGE 250
|
||||
#define SYSTEM_POWER 50
|
||||
#define TRIGGER_RANGE 150
|
||||
#define DAMAGE_RANGE 250
|
||||
#define SYSTEM_POWER 50
|
||||
#define TRIGGER_RANGE 150
|
||||
|
||||
extern void addMineExplosion(void);
|
||||
extern void awardTrophy(char *id);
|
||||
|
|
|
@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define MAX_SELECTABLE_PLAYERS 8
|
||||
#define MAX_SELECTABLE_TARGETS 8
|
||||
#define MAX_SELECTABLE_PLAYERS 8
|
||||
#define MAX_SELECTABLE_TARGETS 8
|
||||
|
||||
extern void addECMEffect(Entity *ent);
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
|
|
|
@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define QT_INITIAL_CAPACITY 8
|
||||
#define QT_MAX_DEPTH 5
|
||||
#define QT_INITIAL_CAPACITY 8
|
||||
#define QT_MAX_DEPTH 5
|
||||
|
||||
extern void *resize(void *array, int oldSize, int newSize);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define ROPE_DISTANCE 128
|
||||
#define ROPE_DISTANCE 128
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
|
|
|
@ -20,13 +20,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define CHALLENGES_PER_PAGE 14
|
||||
#define SHOW_CHALLENGES 0
|
||||
#define SHOW_FIGHTER_DB 5
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 3
|
||||
#define SHOW_TROPHIES 4
|
||||
#define CHALLENGES_PER_PAGE 14
|
||||
#define SHOW_CHALLENGES 0
|
||||
#define SHOW_FIGHTER_DB 5
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 3
|
||||
#define SHOW_TROPHIES 4
|
||||
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
extern void awardChallengeTrophies(void);
|
||||
|
|
|
@ -20,14 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define MAX_LISTED_MISSIONS 9
|
||||
#define SHOW_FIGHTER_DB 6
|
||||
#define SHOW_GALAXY 0
|
||||
#define SHOW_MENU 2
|
||||
#define SHOW_OPTIONS 3
|
||||
#define SHOW_STAR_SYSTEM 1
|
||||
#define SHOW_STATS 4
|
||||
#define SHOW_TROPHIES 5
|
||||
#define MAX_LISTED_MISSIONS 9
|
||||
#define SHOW_FIGHTER_DB 6
|
||||
#define SHOW_GALAXY 0
|
||||
#define SHOW_MENU 2
|
||||
#define SHOW_OPTIONS 3
|
||||
#define SHOW_STAR_SYSTEM 1
|
||||
#define SHOW_STATS 4
|
||||
#define SHOW_TROPHIES 5
|
||||
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
extern void awardCampaignTrophies(void);
|
||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define CREDIT_LINE_LIMIT (UI_WIDTH - 300)
|
||||
#define CREDIT_LINE_LIMIT (UI_WIDTH - 300)
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
|
|
|
@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "SDL2/SDL_mixer.h"
|
||||
|
||||
#define SHOW_CONTROLS 1
|
||||
#define SHOW_MAIN 0
|
||||
#define SHOW_CONTROLS 1
|
||||
#define SHOW_MAIN 0
|
||||
|
||||
extern void drawControls(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define STATS_PER_PAGE 9
|
||||
#define STATS_PER_PAGE 9
|
||||
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
|
|
|
@ -20,12 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define NUM_FIGHTERS 12
|
||||
#define SHOW_FIGHTER_DB 4
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 1
|
||||
#define SHOW_TITLE 0
|
||||
#define SHOW_TROPHIES 3
|
||||
#define NUM_FIGHTERS 12
|
||||
#define SHOW_FIGHTER_DB 4
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 1
|
||||
#define SHOW_TITLE 0
|
||||
#define SHOW_TROPHIES 3
|
||||
|
||||
extern void addEngineEffect(void);
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "time.h"
|
||||
|
||||
#define TROPHIES_PER_PAGE 4
|
||||
#define TROPHIES_PER_PAGE 4
|
||||
|
||||
extern void awardPandoranCraftTrophy(void);
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
|
|
|
@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "SDL2/SDL_mixer.h"
|
||||
|
||||
#define MAX_BATTLE_SOUND_DISTANCE 1500
|
||||
#define MIN_BATTLE_SOUND_DISTANCE 100
|
||||
#define MAX_BATTLE_SOUND_DISTANCE 1500
|
||||
#define MIN_BATTLE_SOUND_DISTANCE 100
|
||||
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
|
|
|
@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define FONT_SIZE 32
|
||||
#define FONT_TEXTURE_SIZE 512
|
||||
#define MAX_WORD_LENGTH 128
|
||||
#define FONT_SIZE 32
|
||||
#define FONT_TEXTURE_SIZE 512
|
||||
#define MAX_WORD_LENGTH 128
|
||||
|
||||
extern char *getFileLocation(char *filename);
|
||||
extern unsigned long hashcode(const char *str);
|
||||
|
|
|
@ -33,9 +33,9 @@ extern char **getFileList(char *dir, int *count);
|
|||
extern long lookup(char *name);
|
||||
extern void playSound(int id);
|
||||
extern char *readFile(char *filename);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern void updateControlButton(char *name);
|
||||
extern void updateControlKey(char *name);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -84,7 +84,7 @@ function cleanHeader($headerFile)
|
|||
{
|
||||
$header = file($headerFile);
|
||||
$body = file_get_contents($bodyFile);
|
||||
$isMain = strpos($body, "int main(int argc, char *argv[])");
|
||||
$isMain = strpos($body, "int main(");
|
||||
$lines = [];
|
||||
$defines = [];
|
||||
$functions = [];
|
||||
|
@ -197,6 +197,8 @@ function cleanHeader($headerFile)
|
|||
$functions = array_unique($functions);
|
||||
$structs = array_unique($structs);
|
||||
|
||||
$defines = alignDefines($defines);
|
||||
|
||||
$header = updateExterns($header, $defines, $functions, $structs);
|
||||
|
||||
if ($UPDATE_FILES)
|
||||
|
@ -206,6 +208,30 @@ function cleanHeader($headerFile)
|
|||
}
|
||||
}
|
||||
|
||||
function alignDefines($defines)
|
||||
{
|
||||
$newAligns = [];
|
||||
$largest = 0;
|
||||
$defineName;
|
||||
$defineValue;
|
||||
|
||||
foreach ($defines as $define)
|
||||
{
|
||||
sscanf($define, "%*s %s", $defineName);
|
||||
|
||||
$largest = max($largest, strlen($defineName) + 4);
|
||||
}
|
||||
|
||||
foreach ($defines as $define)
|
||||
{
|
||||
sscanf($define, "%*s %s %[^\n]", $defineName, $defineValue);
|
||||
|
||||
$newAligns[] = "#define " . str_pad($defineName, $largest, " ") . $defineValue . "\n";
|
||||
}
|
||||
|
||||
return $newAligns;
|
||||
}
|
||||
|
||||
function recurseDir($dir)
|
||||
{
|
||||
if ($dir != "../src/json")
|
||||
|
|
Loading…
Reference in New Issue