mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-23 12:31:15 +00:00
Added additional parse functionality. #12
This commit is contained in:
parent
cce5308cac
commit
9d3b2face7
4 changed files with 355 additions and 4 deletions
|
@ -104,6 +104,9 @@ typedef enum {
|
|||
LSYM_WCONF_VARIATION,
|
||||
LSYM_WCONF_RADIUS,
|
||||
LSYM_WCONF_SIZE,
|
||||
LSYM_WCONF_TIME,
|
||||
LSYM_WCONF_VELOCITY,
|
||||
LSYM_WCONF_SPLASH,
|
||||
LSYM_POINT,
|
||||
|
||||
LSYM_UNKNOWN
|
||||
|
|
|
@ -1124,6 +1124,18 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_SIZE;
|
||||
}
|
||||
|
||||
if(strcmp("time", text) == 0) {
|
||||
return LSYM_WCONF_TIME;
|
||||
}
|
||||
|
||||
if(strcmp("velocity", text) == 0) {
|
||||
return LSYM_WCONF_VELOCITY;
|
||||
}
|
||||
|
||||
if(strcmp("splash", text) == 0) {
|
||||
return LSYM_WCONF_SPLASH;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -3534,6 +3534,18 @@ bgLexSymbol bgLex_textToSymbol(char* text) {
|
|||
return LSYM_WCONF_SIZE;
|
||||
}
|
||||
|
||||
if(strcmp("time", text) == 0) {
|
||||
return LSYM_WCONF_TIME;
|
||||
}
|
||||
|
||||
if(strcmp("velocity", text) == 0) {
|
||||
return LSYM_WCONF_VELOCITY;
|
||||
}
|
||||
|
||||
if(strcmp("splash", text) == 0) {
|
||||
return LSYM_WCONF_SPLASH;
|
||||
}
|
||||
|
||||
return LSYM_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ static qboolean G_Weapon_ParseWeaponConfig(bgLex* lexer) {
|
|||
return qfalse;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg.%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
|
@ -287,7 +287,7 @@ static qboolean G_Weapon_ParseWeaponConfig(bgLex* lexer) {
|
|||
return qfalse;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
G_Logger(LL_ERROR, "Unexpected token at weapons.cfg.%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
|
@ -301,20 +301,344 @@ static qboolean G_Weapon_ParseWeaponConfig(bgLex* lexer) {
|
|||
}
|
||||
break;
|
||||
case LSYM_WCONF_DISRUPTOR:
|
||||
|
||||
while (bgLex_lex(lexer) != 0) {
|
||||
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;
|
||||
} else {
|
||||
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.disruptor.primary.damage = lexer->morphem.data.numInteger;
|
||||
} 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_RANGE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_DOUBLE) {
|
||||
weaponConfig.disruptor.primary.range = lexer->morphem.data.numDouble;
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected double 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_DAMAGE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.disruptor.secondary.damage = lexer->morphem.data.numInteger;
|
||||
} 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.disruptor.secondary.size = lexer->morphem.data.numInteger;
|
||||
} 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, "Expected 'primary' or 'secondary' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LSYM_WCONF_GRENADE:
|
||||
|
||||
while (bgLex_lex(lexer) != 0) {
|
||||
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;
|
||||
} else {
|
||||
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.grenade.primary.damage = lexer->morphem.data.numInteger;
|
||||
} 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_DOUBLE) {
|
||||
weaponConfig.grenade.primary.size = lexer->morphem.data.numDouble;
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected double value at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
break;
|
||||
case LSYM_WCONF_TIME:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.grenade.primary.time = lexer->morphem.data.numInteger;
|
||||
} 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_VELOCITY:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_DOUBLE) {
|
||||
weaponConfig.grenade.primary.velocity = lexer->morphem.data.numDouble;
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected double 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) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_SYMBOL) {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_DAMAGE) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.grenade.primary.splash.damage = lexer->morphem.data.numInteger;
|
||||
} 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.grenade.primary.splash.radius = lexer->morphem.data.numInteger;
|
||||
} 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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
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.grenade.secondary.damage = lexer->morphem.data.numInteger;
|
||||
} 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_TIME:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.grenade.secondary.time = lexer->morphem.data.numInteger;
|
||||
} 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) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_SYMBOL) {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_DAMAGE) {
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_INT) {
|
||||
weaponConfig.grenade.secondary.splash.damage = lexer->morphem.data.numInteger;
|
||||
} 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.grenade.secondary.splash.radius = lexer->morphem.data.numInteger;
|
||||
} 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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
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, "Expected 'primary' or 'secondary' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LSYM_WCONF_HYPERSPANNER:
|
||||
while (bgLex_lex(lexer) != 0) {
|
||||
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;
|
||||
} else {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_PRIMARY) {
|
||||
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_SECONDARY) {
|
||||
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected 'primary' or 'secondary' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LSYM_WCONF_QUANTUM:
|
||||
while (bgLex_lex(lexer) != 0) {
|
||||
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;
|
||||
} else {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_PRIMARY) {
|
||||
|
||||
} else if (lexer->morphem.data.symbol == LSYM_WCONF_SECONDARY) {
|
||||
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected 'primary' or 'secondary' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LSYM_WCONF_TR116:
|
||||
while (bgLex_lex(lexer) != 0) {
|
||||
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;
|
||||
} else {
|
||||
if (lexer->morphem.data.symbol == LSYM_WCONF_PRIMARY) {
|
||||
|
||||
} else {
|
||||
G_Logger(LL_ERROR, "Expected 'primary' at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
G_LogFuncEnd();
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_LocLogger(LL_ERROR, "Unexpected token at weapons.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column);
|
||||
|
|
Loading…
Reference in a new issue