mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-04-19 07:21:12 +00:00
Added parser function for quantum launcher config.
This commit is contained in:
parent
6b6d950d52
commit
12d5453ff9
4 changed files with 280 additions and 1 deletions
|
@ -108,6 +108,9 @@ typedef enum {
|
|||
LSYM_WCONF_VELOCITY,
|
||||
LSYM_WCONF_SPLASH,
|
||||
LSYM_WCONF_RATE,
|
||||
LSYM_WCONF_THINK,
|
||||
LSYM_WCONF_SEARCH,
|
||||
LSYM_WCONF_DISTANCE,
|
||||
LSYM_POINT,
|
||||
|
||||
LSYM_UNKNOWN
|
||||
|
|
|
@ -1140,6 +1140,14 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_RATE;
|
||||
}
|
||||
|
||||
if(strcmp("think", text) == 0) {
|
||||
return LSYM_WCONF_THINK;
|
||||
}
|
||||
|
||||
if(strcmp("distance", text) == 0) {
|
||||
return LSYM_WCONF_DISTANCE;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -3550,6 +3550,14 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_RATE;
|
||||
}
|
||||
|
||||
if(strcmp("think", text) == 0) {
|
||||
return LSYM_WCONF_THINK;
|
||||
}
|
||||
|
||||
if(strcmp("distance", text) == 0) {
|
||||
return LSYM_WCONF_DISTANCE;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -820,7 +820,267 @@ static qboolean G_Weapon_ParseConfigTR116(bgLex* lexer) {
|
|||
}
|
||||
|
||||
static qboolean G_Weapon_ParseConfigQuantum(bgLex* lexer) {
|
||||
return qfalse;
|
||||
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_DAMAGE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.primary.damage = 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;
|
||||
case LSYM_WCONF_SIZE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.primary.size = 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;
|
||||
case LSYM_WCONF_SPLASH:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.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 wepons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_DAMAGE) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.primary.splash.damage = 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;
|
||||
}
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_RADIUS) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.primary.splash.radius = 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;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected 'damage' or 'radius' 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_DAMAGE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.damage = 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;
|
||||
case LSYM_WCONF_SIZE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.size = 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;
|
||||
case LSYM_WCONF_SPLASH:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.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 wepons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_DAMAGE) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.splash.damage = 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;
|
||||
}
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_RADIUS) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.splash.radius = 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;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected 'damage' or 'radius' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
break;
|
||||
case LSYM_WCONF_THINK:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.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 wepons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_TIME) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.think.time = 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;
|
||||
}
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_SEARCH) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type != LMT_SYMBOL || lexer->morphem.data.symbol != LSYM_POINT) {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.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 wepons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_TIME) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.quantum.secondary.think.search.time = 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;
|
||||
}
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_DISTANCE) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_DOUBLE) {
|
||||
weaponConfig.quantum.secondary.think.search.distance = lexer->morphem.data.numDouble;
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Unexpected token at wepons.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;
|
||||
}
|
||||
}
|
||||
|
||||
void G_Weapon_LoadConfig(void) {
|
||||
|
|
Loading…
Reference in a new issue