Skip to content

Commit

Permalink
add COMPATF2_NOACSARGCHECK to disable ACS function argument count checks
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and madame-rachelle committed Jun 24, 2024
1 parent 02305f0 commit 35f66c5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ enum : unsigned int
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_FDTELEPORT = 1 << 16, // Emulate Final Doom's teleporter z glitch.
COMPATF2_NOACSARGCHECK = 1 << 17, // Disable arg count checking for ACS

};

Expand Down
1 change: 1 addition & 0 deletions src/gamedata/g_mapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ MapFlagHandlers[] =
{ "compat_stayonlift", MITYPE_COMPATFLAG, 0, COMPATF2_STAYONLIFT },
{ "compat_nombf21", MITYPE_COMPATFLAG, 0, COMPATF2_NOMBF21 },
{ "compat_voodoozombies", MITYPE_COMPATFLAG, 0, COMPATF2_VOODOO_ZOMBIES },
{ "compat_noacsargcheck", MITYPE_COMPATFLAG, 0, COMPATF2_NOACSARGCHECK },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
Expand Down
1 change: 1 addition & 0 deletions src/maploader/compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ static FCompatOption Options[] =
{ "nombf21", COMPATF2_NOMBF21, SLOT_COMPAT2 },
{ "voodoozombies", COMPATF2_VOODOO_ZOMBIES, SLOT_COMPAT2 },
{ "fdteleport", COMPATF2_FDTELEPORT, SLOT_COMPAT2 },
{ "noacsargcheck", COMPATF2_NOACSARGCHECK, SLOT_COMPAT2 },
{ NULL, 0, 0 }
};

Expand Down
8 changes: 7 additions & 1 deletion src/playsim/p_acs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#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)
{
Expand Down

0 comments on commit 35f66c5

Please sign in to comment.