mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
Added weapon config parser function for hyperspanner.
This commit is contained in:
parent
28013fc6ca
commit
8a2870cac2
4 changed files with 94 additions and 1 deletions
|
@ -107,6 +107,7 @@ typedef enum {
|
|||
LSYM_WCONF_TIME,
|
||||
LSYM_WCONF_VELOCITY,
|
||||
LSYM_WCONF_SPLASH,
|
||||
LSYM_WCONF_RATE,
|
||||
LSYM_POINT,
|
||||
|
||||
LSYM_UNKNOWN
|
||||
|
|
|
@ -1136,6 +1136,10 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_SPLASH;
|
||||
}
|
||||
|
||||
if(strcmp("rate", text) == 0) {
|
||||
return LSYM_WCONF_RATE;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -3546,6 +3546,10 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_SPLASH;
|
||||
}
|
||||
|
||||
if(strcmp("rate", text) == 0) {
|
||||
return LSYM_WCONF_RATE;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -663,8 +663,92 @@ static qboolean G_Weapon_ParseConfigDisruptor(bgLex* lexer) {
|
|||
}
|
||||
|
||||
static qboolean G_Weapon_ParseConfigHyperspanner(bgLex* lexer) {
|
||||
G_LogFuncBegin();
|
||||
|
||||
G_Assert(lexer, qfalse);
|
||||
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_SYMBOL && lexer->morphem.data.symbol == LSYM_POINT) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_SYMBOL) {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_PRIMARY) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Expected '.' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
switch (lexer->morphem.data.symbol) {
|
||||
case LSYM_WCONF_RATE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.hyperspanner.primary.rate = lexer->morphem.data.numInteger;
|
||||
G_LogFuncEnd();
|
||||
return qtrue;
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected integer value at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_SECONDARY) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Expected '.' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
switch (lexer->morphem.data.symbol) {
|
||||
case LSYM_WCONF_RATE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.hyperspanner.secondary.rate = lexer->morphem.data.numInteger;
|
||||
G_LogFuncEnd();
|
||||
return qtrue;
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected integer value at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected '.' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
static qboolean G_Weapon_ParseConfigTR116(bgLex* lexer) {
|
||||
return qfalse;
|
||||
|
|
Loading…
Reference in a new issue