From 1a49ecfb70fa850d53a175ff958db197b973aefa Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 30 Mar 2024 16:38:53 +0000 Subject: [PATCH] Add PlayerExiting() ACS callfunc --- src/acs/call-funcs.cpp | 24 ++++++++++++++++++++++++ src/acs/call-funcs.hpp | 1 + src/acs/environment.cpp | 1 + 3 files changed, 26 insertions(+) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index e357fa8b9..04697d887 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -1539,6 +1539,30 @@ bool CallFunc_PlayerLosing(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM return false; } +/*-------------------------------------------------- + bool CallFunc_PlayerExiting(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + + Returns the activating player's exiting status. +--------------------------------------------------*/ +bool CallFunc_PlayerExiting(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->exiting != 0)); + 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 342b80259..edb7af8f8 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -82,6 +82,7 @@ bool CallFunc_CountPushables(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS 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_PlayerLosing(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_PlayerExiting(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 ed33a3bcf..e47eb6f7c 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -178,6 +178,7 @@ Environment::Environment() addFuncDataACS0( 316, addCallFunc(CallFunc_PositionStart)); addFuncDataACS0( 317, addCallFunc(CallFunc_FreePlay)); addFuncDataACS0( 319, addCallFunc(CallFunc_PlayerLosing)); + addFuncDataACS0( 320, addCallFunc(CallFunc_PlayerExiting)); addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait)); addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition));