Alias GT_MATCH as GT_BATTLE in compatmode

Fixes some v1 mods such as Achii Titlecards
This commit is contained in:
NepDisk 2026-03-24 23:25:29 -04:00
parent 3755120541
commit b3347d785a
3 changed files with 15 additions and 0 deletions

View file

@ -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);

View file

@ -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",

View file

@ -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[];