Skip to content

Commit

Permalink
Started moving wepons configuration from cvars to a configuration file.
Browse files Browse the repository at this point in the history
  • Loading branch information
GSIO01 committed Aug 14, 2014
1 parent a918a50 commit 1415d7a
Show file tree
Hide file tree
Showing 5 changed files with 3,095 additions and 2,584 deletions.
292 changes: 153 additions & 139 deletions code/game/bg_lex.h
Original file line number Diff line number Diff line change
@@ -1,139 +1,153 @@
#ifndef BG_LEX_H
#define BG_LEX_H

#include "q_shared.h"

#define LEX_DEBUG
#ifdef LEX_DEBUG
extern char *yyget_text (void* yyscanner);
#endif

#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
#endif

typedef enum {
LSYM_OBRACE, /* ( */
LSYM_OBRACEC, /* { */
LSYM_OBRACESQ, /* [ */
LSYM_CBRACE, /* ) */
LSYM_CBRACEC, /* } */
LSYM_CBRACESQ, /* ] */
LSYM_TRUE,
LSYM_FALSE,
LSYM_SERVER_CHANGE_CONFIG,
LSYM_SERVER,
LSYM_HOLODECK_DATA,
LSYM_PROGRAM,
LSYM_MAP_CHANGE_CONFIG,
LSYM_MAP,
LSYM_LOCATIONS_LIST,
LSYM_LOCATIONS_LIST_2,
LSYM_MESSAGE,
LSYM_CONSOLE_NAME,
LSYM_FORMAL_NAME,
LSYM_RADAR_COLOR,
LSYM_ICON_COLOR,
LSYM_NULL,
LSYM_MODEL_SKIN,
LSYM_WEAPONS,
LSYM_HAS_RANKS,
LSYM_TEAL,
LSYM_MEDICAL,
LSYM_GOLD,
LSYM_GREEN,
LSYM_MARINE,
LSYM_RED,
LSYM_WP_NULL,
LSYM_WP_NULL_HANDS,
LSYM_WP_TRICORDER,
LSYM_WP_PADD,
LSYM_WP_COFFEE,
LSYM_WP_PHASER,
LSYM_WP_COMPRESSION_RIFLE,
LSYM_WP_TR116,
LSYM_WP_GRENADE_LAUNCHER,
LSYM_WP_QUANTUM_BURST,
LSYM_WP_MEDKIT,
LSYM_WP_DISRUPTOR,
LSYM_WP_VOYAGER_HYPO,
LSYM_WP_DERMAL_REGEN,
LSYM_WP_TOOLKIT,
LSYM_WP_HYPERSPANNER,
LSYM_WP_0,
LSYM_WP_1,
LSYM_WP_2,
LSYM_WP_3,
LSYM_WP_4,
LSYM_WP_5,
LSYM_WP_6,
LSYM_WP_7,
LSYM_WP_8,
LSYM_WP_9,
LSYM_WP_10,
LSYM_WP_11,
LSYM_WP_12,
LSYM_WP_13,
LSYM_WP_14,
LSYM_WP_15,
LSYM_ADMIN,
LSYM_BORG,
LSYM_N00B,
LSYM_NO_SHOW,
LSYM_MENU_TEXTURE_DEF,
LSYM_MENU_TEXTURE_RED,
LSYM_MENU_TEXTURE_TEAL,
LSYM_MENU_TEXTURE_GOLD,
LSYM_MENU_TEXTURE_GREEN,
LSYM_BOLT_MODEL,
LSYM_BOLT_SHADER,
LSYM_ADMIRAL_RANK,
LSYM_SEMICOLON,

LSYM_UNKNOWN
} bgLexSymbol;

typedef enum {
LMT_EOF,
LMT_STRING = 1,
LMT_INT,
LMT_DOUBLE,
LMT_VECTOR3,
LMT_VECTOR4,
LMT_SYMBOL,
LMT_IGNORE
} bgLexMorphemType;

typedef struct bgLexMorphemData_s bgLexMorphemData;
struct bgLexMorphemData_s {
char* str;
bgLexSymbol symbol;
int numInteger;
double numDouble;
vec3_t vector3;
vec4_t vector4;
};

typedef struct bgLexMorphem_s bgLexMorphem;
struct bgLexMorphem_s {
bgLexMorphemType type;
bgLexMorphemData data;
int line;
int column;
};

typedef struct bgLex_s bgLex;
struct bgLex_s {
yyscan_t lex;
bgLexMorphem morphem;
void* buf;
};

bgLex* bgLex_create(char* data);
void bgLex_destroy(/*@only@*/ /*@out@*/ /*@null@*/ bgLex* lex);
int bgLex_lex(bgLex* lex);
bgLexSymbol bgLex_textToSymbol(char* text);
void bgLexFatalError(const char* msg, void* lex);

#endif /* BG_LEX_H */
#ifndef BG_LEX_H
#define BG_LEX_H

#include "q_shared.h"

#define LEX_DEBUG
#ifdef LEX_DEBUG
extern char *yyget_text (void* yyscanner);
#endif

#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
#endif

typedef enum {
LSYM_OBRACE, /* ( */
LSYM_OBRACEC, /* { */
LSYM_OBRACESQ, /* [ */
LSYM_CBRACE, /* ) */
LSYM_CBRACEC, /* } */
LSYM_CBRACESQ, /* ] */
LSYM_TRUE,
LSYM_FALSE,
LSYM_SERVER_CHANGE_CONFIG,
LSYM_SERVER,
LSYM_HOLODECK_DATA,
LSYM_PROGRAM,
LSYM_MAP_CHANGE_CONFIG,
LSYM_MAP,
LSYM_LOCATIONS_LIST,
LSYM_LOCATIONS_LIST_2,
LSYM_MESSAGE,
LSYM_CONSOLE_NAME,
LSYM_FORMAL_NAME,
LSYM_RADAR_COLOR,
LSYM_ICON_COLOR,
LSYM_NULL,
LSYM_MODEL_SKIN,
LSYM_WEAPONS,
LSYM_HAS_RANKS,
LSYM_TEAL,
LSYM_MEDICAL,
LSYM_GOLD,
LSYM_GREEN,
LSYM_MARINE,
LSYM_RED,
LSYM_WP_NULL,
LSYM_WP_NULL_HANDS,
LSYM_WP_TRICORDER,
LSYM_WP_PADD,
LSYM_WP_COFFEE,
LSYM_WP_PHASER,
LSYM_WP_COMPRESSION_RIFLE,
LSYM_WP_TR116,
LSYM_WP_GRENADE_LAUNCHER,
LSYM_WP_QUANTUM_BURST,
LSYM_WP_MEDKIT,
LSYM_WP_DISRUPTOR,
LSYM_WP_VOYAGER_HYPO,
LSYM_WP_DERMAL_REGEN,
LSYM_WP_TOOLKIT,
LSYM_WP_HYPERSPANNER,
LSYM_WP_0,
LSYM_WP_1,
LSYM_WP_2,
LSYM_WP_3,
LSYM_WP_4,
LSYM_WP_5,
LSYM_WP_6,
LSYM_WP_7,
LSYM_WP_8,
LSYM_WP_9,
LSYM_WP_10,
LSYM_WP_11,
LSYM_WP_12,
LSYM_WP_13,
LSYM_WP_14,
LSYM_WP_15,
LSYM_ADMIN,
LSYM_BORG,
LSYM_N00B,
LSYM_NO_SHOW,
LSYM_MENU_TEXTURE_DEF,
LSYM_MENU_TEXTURE_RED,
LSYM_MENU_TEXTURE_TEAL,
LSYM_MENU_TEXTURE_GOLD,
LSYM_MENU_TEXTURE_GREEN,
LSYM_BOLT_MODEL,
LSYM_BOLT_SHADER,
LSYM_ADMIRAL_RANK,
LSYM_SEMICOLON,
LSYM_WCONF_PHASER,
LSYM_WCONF_CRIFLE,
LSYM_WCONF_DISRUPTOR,
LSYM_WCONF_GRENADE,
LSYM_WCONF_TR116,
LSYM_WCONF_QUANTUM,
LSYM_WCONF_HYPERSPANNER,
LSYM_WCONF_PRIMARY,
LSYM_WCONF_SECONDARY,
LSYM_WCONF_RANGE,
LSYM_WCONF_DAMAGE,
LSYM_WCONF_VARIATION,
LSYM_WCONF_RADIUS,
LSYM_POINT,

LSYM_UNKNOWN
} bgLexSymbol;

typedef enum {
LMT_EOF,
LMT_STRING = 1,
LMT_INT,
LMT_DOUBLE,
LMT_VECTOR3,
LMT_VECTOR4,
LMT_SYMBOL,
LMT_IGNORE
} bgLexMorphemType;

typedef struct bgLexMorphemData_s bgLexMorphemData;
struct bgLexMorphemData_s {
char* str;
bgLexSymbol symbol;
int numInteger;
double numDouble;
vec3_t vector3;
vec4_t vector4;
};

typedef struct bgLexMorphem_s bgLexMorphem;
struct bgLexMorphem_s {
bgLexMorphemType type;
bgLexMorphemData data;
int line;
int column;
};

typedef struct bgLex_s bgLex;
struct bgLex_s {
yyscan_t lex;
bgLexMorphem morphem;
void* buf;
};

bgLex* bgLex_create(char* data);
void bgLex_destroy(/*@only@*/ /*@out@*/ /*@null@*/ bgLex* lex);
int bgLex_lex(bgLex* lex);
bgLexSymbol bgLex_textToSymbol(char* text);
void bgLexFatalError(const char* msg, void* lex);

#endif /* BG_LEX_H */
Loading

0 comments on commit 1415d7a

Please sign in to comment.