diff --git a/src/deh_lua.c b/src/deh_lua.c index 6a7c08a9c..cfedd5571 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -203,6 +203,7 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) else if (fastncmp("GT_", word, 3)) { p = word; i = 0; + INT32 j = 0; while (gametypes[i] != NULL) { if (fastcmp(p, gametypes[i]->constant)) @@ -210,6 +211,14 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) CacheAndPushConstant(L, word, i); return 1; } + + if (lua_compatmode) + for (j = 0; GAMETYPE_ALIASES[j].n; j++) + if (fastcmp(p, GAMETYPE_ALIASES[j].n)) { + CacheAndPushConstant(L, word, GAMETYPE_ALIASES[j].v); + return 1; + } + i++; } if (mathlib) return luaL_error(L, "gametype '%s' could not be found.\n", word); diff --git a/src/deh_tables.c b/src/deh_tables.c index 3d876dd21..ccd166d03 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -224,6 +224,11 @@ struct int_const_s const MOBJ_ALIASES[] = { { NULL, 0 } }; +struct int_const_s const GAMETYPE_ALIASES[] = { + {"GT_MATCH", GT_BATTLE}, + { NULL, 0 } +}; + const char *const MOBJFLAG_LIST[] = { "SPECIAL", "SOLID", diff --git a/src/deh_tables.h b/src/deh_tables.h index b53e85e88..f0d45a51a 100644 --- a/src/deh_tables.h +++ b/src/deh_tables.h @@ -87,6 +87,7 @@ extern struct flickytypes_s FLICKYTYPES[]; extern actionpointer_t actionpointers[]; // Array mapping action names to action functions. extern struct int_const_s const STATE_ALIASES[]; extern struct int_const_s const MOBJ_ALIASES[]; +extern struct int_const_s const GAMETYPE_ALIASES[]; extern const char *const MOBJFLAG_LIST[]; extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2 extern const char *const MOBJEFLAG_LIST[];