From 5926ee952a2526c6d32fc9e0cdaa172136711682 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 17 Sep 2023 21:47:19 +0100 Subject: [PATCH 1/3] ACS: Add IsNetworkGame - Mimics existing ZDoom(/Hexen?) ACS function for checking Netgame status --- src/acs/call-funcs.cpp | 14 ++++++++++++++ src/acs/call-funcs.hpp | 1 + src/acs/environment.cpp | 1 + 3 files changed, 16 insertions(+) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index 25af308f7..e9c4fb506 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -926,6 +926,20 @@ bool CallFunc_Timer(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word return false; } +/*-------------------------------------------------- + bool CallFunc_IsNetworkGame(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + + Pushes netgame status to ACS. +--------------------------------------------------*/ +bool CallFunc_IsNetworkGame(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) +{ + (void)argV; + (void)argC; + + thread->dataStk.push(netgame); + return false; +} + /*-------------------------------------------------- bool CallFunc_SectorSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) diff --git a/src/acs/call-funcs.hpp b/src/acs/call-funcs.hpp index 86af95f15..a69661fe3 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -53,6 +53,7 @@ bool CallFunc_PlayerCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM: bool CallFunc_GameType(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_GameSpeed(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_Timer(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_IsNetworkGame(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_SectorSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_AmbientSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_SetLineTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 796abeceb..4983a4a5e 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -90,6 +90,7 @@ Environment::Environment() addCodeDataACS0(100, {"", 3, addCallFunc(CallFunc_ThingSound)}); addCodeDataACS0(101, {"", 0, addCallFunc(CallFunc_EndPrintBold)}); + addCodeDataACS0(118, {"", 0, addCallFunc(CallFunc_IsNetworkGame)}); addCodeDataACS0(119, {"", 0, addCallFunc(CallFunc_PlayerTeam)}); addCodeDataACS0(120, {"", 0, addCallFunc(CallFunc_PlayerRings)}); From 3c1246412e2139b70315e911f510153da48800b3 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 17 Sep 2023 21:57:34 +0100 Subject: [PATCH 2/3] ACS: Add PlayerBot Returns bot status of activating player ZDoom had a bot status function that could be mimiced... but it used a passed player number, when all we need to check for is the activator. To this end, has a different name (the ZDoom version was "PlayerIsBot") --- src/acs/call-funcs.cpp | 25 +++++++++++++++++++++++++ src/acs/call-funcs.hpp | 1 + src/acs/environment.cpp | 1 + 3 files changed, 27 insertions(+) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index e9c4fb506..f83c104e6 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -1598,6 +1598,31 @@ bool CallFunc_PlayerSkin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:: return false; } +/*-------------------------------------------------- + bool CallFunc_PlayerBot(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + + Returns the activating player's bot status. +--------------------------------------------------*/ +bool CallFunc_PlayerBot(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) +{ + auto info = &static_cast(thread)->info; + + (void)argV; + (void)argC; + + if ((info != NULL) + && (info->mo != NULL && P_MobjWasRemoved(info->mo) == false) + && (info->mo->player != NULL)) + { + + thread->dataStk.push(info->mo->player->bot); + return false; + } + + thread->dataStk.push(false); + return false; +} + /*-------------------------------------------------- bool CallFunc_GetObjectDye(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) diff --git a/src/acs/call-funcs.hpp b/src/acs/call-funcs.hpp index a69661fe3..4fe7d47e6 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -75,6 +75,7 @@ bool CallFunc_CountPushables(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS bool CallFunc_HaveUnlockableTrigger(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_HaveUnlockable(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_PlayerSkin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_PlayerBot(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_GetObjectDye(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_PlayerEmeralds(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_PlayerLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 4983a4a5e..4e0564687 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -168,6 +168,7 @@ Environment::Environment() addFuncDataACS0( 312, addCallFunc(CallFunc_ThingCount)); addFuncDataACS0( 313, addCallFunc(CallFunc_GrandPrix)); addFuncDataACS0( 314, addCallFunc(CallFunc_GetGrabbedSprayCan)); + addFuncDataACS0( 315, addCallFunc(CallFunc_PlayerBot)); addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait)); addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition)); From 63844b383955f93e0b318ae40f7de864f717cf80 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 17 Sep 2023 21:59:07 +0100 Subject: [PATCH 3/3] ACS: Extra tidy - Rename final BreakTheCapsules material to PrisonBreak - Fix comment for PlayerScore (previously copypaste mistake) --- src/acs/call-funcs.cpp | 8 ++++---- src/acs/call-funcs.hpp | 2 +- src/acs/environment.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index f83c104e6..72f95bfba 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -1291,7 +1291,7 @@ bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM: /*-------------------------------------------------- bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) - Returns the activating player's ring count. + Returns the activating player's roundscore. --------------------------------------------------*/ bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) { @@ -1724,11 +1724,11 @@ bool CallFunc_EncoreMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:: } /*-------------------------------------------------- - bool CallFunc_BreakTheCapsules(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + bool CallFunc_PrisonBreak(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) - Returns if the map is in Break the Capsules. + Returns if the map is in Prison Break mode. --------------------------------------------------*/ -bool CallFunc_BreakTheCapsules(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) +bool CallFunc_PrisonBreak(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) { (void)argV; (void)argC; diff --git a/src/acs/call-funcs.hpp b/src/acs/call-funcs.hpp index 4fe7d47e6..3bfd32548 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -81,7 +81,7 @@ bool CallFunc_PlayerEmeralds(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS bool CallFunc_PlayerLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_LowestLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_EncoreMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); -bool CallFunc_BreakTheCapsules(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_PrisonBreak(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_TimeAttack(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_GrandPrix(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 4e0564687..d178c4873 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -163,7 +163,7 @@ Environment::Environment() addFuncDataACS0( 307, addCallFunc(CallFunc_PlayerLap)); addFuncDataACS0( 308, addCallFunc(CallFunc_LowestLap)); addFuncDataACS0( 309, addCallFunc(CallFunc_EncoreMode)); - addFuncDataACS0( 310, addCallFunc(CallFunc_BreakTheCapsules)); + addFuncDataACS0( 310, addCallFunc(CallFunc_PrisonBreak)); addFuncDataACS0( 311, addCallFunc(CallFunc_TimeAttack)); addFuncDataACS0( 312, addCallFunc(CallFunc_ThingCount)); addFuncDataACS0( 313, addCallFunc(CallFunc_GrandPrix));