Commit 7e838d2f authored by Evan Ramos's avatar Evan Ramos
Browse files

Duke3D: Fix `define` token when parsing defs on the game side

parent 0ef42ff1
...@@ -9275,6 +9275,8 @@ static int32_t parsegroupfiles(scriptfile *script) ...@@ -9275,6 +9275,8 @@ static int32_t parsegroupfiles(scriptfile *script)
{ "#include", T_INCLUDE }, { "#include", T_INCLUDE },
{ "includedefault", T_INCLUDEDEFAULT }, { "includedefault", T_INCLUDEDEFAULT },
{ "#includedefault", T_INCLUDEDEFAULT }, { "#includedefault", T_INCLUDEDEFAULT },
{ "define", T_DEFINE },
{ "#define", T_DEFINE },
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
{ "cachesize", T_CACHESIZE }, { "cachesize", T_CACHESIZE },
{ "noautoload", T_NOAUTOLOAD }, { "noautoload", T_NOAUTOLOAD },
...@@ -9335,6 +9337,19 @@ static int32_t parsegroupfiles(scriptfile *script) ...@@ -9335,6 +9337,19 @@ static int32_t parsegroupfiles(scriptfile *script)
break; break;
} }
break; break;
case T_DEFINE:
{
char *name;
int32_t number;
if (scriptfile_getstring(script, &name)) break;
if (scriptfile_getsymbol(script, &number)) break;
if (EDUKE32_PREDICT_FALSE(scriptfile_addsymbolvalue(name, number) < 0))
initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n",
name, number, script->filename, scriptfile_getlinum(script, cmdtokptr));
break;
}
case T_NOAUTOLOAD: case T_NOAUTOLOAD:
NoAutoLoad = 1; NoAutoLoad = 1;
break; break;
......
...@@ -154,6 +154,7 @@ enum gametokens ...@@ -154,6 +154,7 @@ enum gametokens
T_MODE = 1, T_MODE = 1,
T_CACHESIZE = 2, T_CACHESIZE = 2,
T_ALLOW = 2, T_ALLOW = 2,
T_DEFINE,
T_NOAUTOLOAD, T_NOAUTOLOAD,
T_INCLUDEDEFAULT, T_INCLUDEDEFAULT,
T_MUSIC, T_MUSIC,
...@@ -5279,6 +5280,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) ...@@ -5279,6 +5280,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
{ "#include", T_INCLUDE }, { "#include", T_INCLUDE },
{ "includedefault", T_INCLUDEDEFAULT }, { "includedefault", T_INCLUDEDEFAULT },
{ "#includedefault", T_INCLUDEDEFAULT }, { "#includedefault", T_INCLUDEDEFAULT },
{ "define", T_DEFINE },
{ "#define", T_DEFINE },
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
{ "cachesize", T_CACHESIZE }, { "cachesize", T_CACHESIZE },
{ "noautoload", T_NOAUTOLOAD }, { "noautoload", T_NOAUTOLOAD },
...@@ -5385,6 +5388,19 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) ...@@ -5385,6 +5388,19 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
parsedefinitions_game_include(G_DefaultDefFile(), pScript, pToken, firstPass); parsedefinitions_game_include(G_DefaultDefFile(), pScript, pToken, firstPass);
break; break;
} }
case T_DEFINE:
{
char *name;
int32_t number;
if (scriptfile_getstring(pScript, &name)) break;
if (scriptfile_getsymbol(pScript, &number)) break;
if (EDUKE32_PREDICT_FALSE(scriptfile_addsymbolvalue(name, number) < 0))
initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n",
name, number, pScript->filename, scriptfile_getlinum(pScript, pToken));
break;
}
case T_NOAUTOLOAD: case T_NOAUTOLOAD:
if (firstPass) if (firstPass)
g_noAutoLoad = 1; g_noAutoLoad = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment