mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-23 20:41:11 +00:00
Implememted parsing of crifle config. #12
This commit is contained in:
parent
00652c970b
commit
7631a547bd
1 changed files with 128 additions and 1 deletions
|
@ -210,8 +210,135 @@ static qboolean G_Weapon_ParseConfigPhaser(bgLex* lexer) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
weaponConfig.crifle.primary.damage = 75;
|
||||
weaponConfig.crifle.primary.range = 8192;
|
||||
weaponConfig.crifle.secondary.damage = 16;
|
||||
weaponConfig.crifle.secondary.range = 8192;
|
||||
weaponConfig.crifle.secondary.size = 1;
|
||||
*/
|
||||
static qboolean G_Weapon_ParseConfigCRifle(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.crifle.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_RADIUS:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_DOUBLE) {
|
||||
weaponConfig.crifle.primary.range = lexer->morphem.data.numDouble;
|
||||
G_LogFuncEnd();
|
||||
return qtrue;
|
||||
} 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.crifle.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.crifle.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_RANGE:
|
||||
bgLex_lex(lexer);
|
||||
if (lexer->morphem.type == LMT_DOUBLE) {
|
||||
weaponConfig.crifle.secondary.range = lexer->morphem.data.numDouble;
|
||||
G_LogFuncEnd();
|
||||
return qtrue;
|
||||
} 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 {
|
||||
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_ParseConfigGrenade(bgLex* lexer) {
|
||||
|
|
Loading…
Reference in a new issue