From 3c1246412e2139b70315e911f510153da48800b3 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 17 Sep 2023 21:57:34 +0100 Subject: [PATCH] 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));