add COMPATF2_NOACSARGCHECK to disable ACS function argument count checks

This commit is contained in:
Ricardo Luís Vaz Silva 2024-06-10 16:54:38 -03:00 committed by Rachael Alexanderson
parent 02305f02b9
commit 35f66c5cc2
4 changed files with 10 additions and 1 deletions

View file

@ -242,6 +242,7 @@ enum : unsigned int
COMPATF2_NOMBF21 = 1 << 14, // disable MBF21 features that may clash with certain maps COMPATF2_NOMBF21 = 1 << 14, // disable MBF21 features that may clash with certain maps
COMPATF2_VOODOO_ZOMBIES = 1 << 15, // [RL0] allow playerinfo, playerpawn, and voodoo health to all be different, and skip killing the player's mobj if a voodoo doll dies to allow voodoo zombies COMPATF2_VOODOO_ZOMBIES = 1 << 15, // [RL0] allow playerinfo, playerpawn, and voodoo health to all be different, and skip killing the player's mobj if a voodoo doll dies to allow voodoo zombies
COMPATF2_FDTELEPORT = 1 << 16, // Emulate Final Doom's teleporter z glitch. COMPATF2_FDTELEPORT = 1 << 16, // Emulate Final Doom's teleporter z glitch.
COMPATF2_NOACSARGCHECK = 1 << 17, // Disable arg count checking for ACS
}; };

View file

@ -1867,6 +1867,7 @@ MapFlagHandlers[] =
{ "compat_stayonlift", MITYPE_COMPATFLAG, 0, COMPATF2_STAYONLIFT }, { "compat_stayonlift", MITYPE_COMPATFLAG, 0, COMPATF2_STAYONLIFT },
{ "compat_nombf21", MITYPE_COMPATFLAG, 0, COMPATF2_NOMBF21 }, { "compat_nombf21", MITYPE_COMPATFLAG, 0, COMPATF2_NOMBF21 },
{ "compat_voodoozombies", MITYPE_COMPATFLAG, 0, COMPATF2_VOODOO_ZOMBIES }, { "compat_voodoozombies", MITYPE_COMPATFLAG, 0, COMPATF2_VOODOO_ZOMBIES },
{ "compat_noacsargcheck", MITYPE_COMPATFLAG, 0, COMPATF2_NOACSARGCHECK },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 }, { "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end2_track", MITYPE_EATNEXT, 0, 0 },

View file

@ -174,6 +174,7 @@ static FCompatOption Options[] =
{ "nombf21", COMPATF2_NOMBF21, SLOT_COMPAT2 }, { "nombf21", COMPATF2_NOMBF21, SLOT_COMPAT2 },
{ "voodoozombies", COMPATF2_VOODOO_ZOMBIES, SLOT_COMPAT2 }, { "voodoozombies", COMPATF2_VOODOO_ZOMBIES, SLOT_COMPAT2 },
{ "fdteleport", COMPATF2_FDTELEPORT, SLOT_COMPAT2 }, { "fdteleport", COMPATF2_FDTELEPORT, SLOT_COMPAT2 },
{ "noacsargcheck", COMPATF2_NOACSARGCHECK, SLOT_COMPAT2 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };

View file

@ -5323,7 +5323,13 @@ int DLevelScript::SwapActorTeleFog(AActor *activator, int tid)
} }
// Macro for CallFunction. Checks passed number of arguments with minimum required. Sets needCount and returns if not enough. // Macro for CallFunction. Checks passed number of arguments with minimum required. Sets needCount and returns if not enough.
#define MIN_ARG_COUNT(minCount) do { if (argCount < minCount) { needCount = minCount; return 0; } } while(0) #define MIN_ARG_COUNT(minCount) \
do { \
if (argCount < minCount && !(Level->i_compatflags2 & COMPATF2_NOACSARGCHECK)) { \
needCount = minCount; \
return 0; \
} \
} while(0)
int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &needCount) int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &needCount)
{ {