From 5926ee952a2526c6d32fc9e0cdaa172136711682 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 17 Sep 2023 21:47:19 +0100 Subject: [PATCH] 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)});