Added parser function for weapons config of tr116

This commit is contained in:
Walter Julius Hennecke 2014-10-07 21:30:51 +02:00
parent 8a2870cac2
commit 6b6d950d52
1 changed files with 66 additions and 1 deletions

View File

@ -751,7 +751,72 @@ static qboolean G_Weapon_ParseConfigHyperspanner(bgLex* lexer) {
}
static qboolean G_Weapon_ParseConfigTR116(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.tr116.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_RANGE:
bgLex_lex(lexer);
if (lexer->morphem.type == LMT_DOUBLE) {
weaponConfig.tr116.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 {
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_ParseConfigQuantum(bgLex* lexer) {