diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index b6e1ce3a8..cf1e87d3a 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -445,6 +445,25 @@ bool CallFunc_PolyWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Wo return true; // Execution interrupted } +/*-------------------------------------------------- + bool CallFunc_CameraWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + + Pauses the thread until the tagged + camera is done moving. +--------------------------------------------------*/ +bool CallFunc_CameraWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) +{ + (void)argC; + + thread->state = { + ACSVM::ThreadState::WaitTag, + argV[0], + ACS_TAGTYPE_CAMERA + }; + + return true; // Execution interrupted +} + /*-------------------------------------------------- bool CallFunc_ChangeFloor(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 4bbe3eaec..c4215b5e0 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -50,6 +50,7 @@ bool CallFunc_Random(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word bool CallFunc_ThingCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_TagWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_PolyWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_CameraWait(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_ChangeFloor(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_ChangeCeiling(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_LineSide(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 9c5c5ca61..ab7a67811 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -36,6 +36,7 @@ extern "C" { #include "../p_spec.h" #include "../w_wad.h" #include "../z_zone.h" +#include "../p_local.h" } #include "environment.hpp" @@ -160,6 +161,8 @@ Environment::Environment() addFuncDataACS0( 307, addCallFunc(CallFunc_PlayerLap)); addFuncDataACS0( 308, addCallFunc(CallFunc_LowestLap)); addFuncDataACS0( 309, addCallFunc(CallFunc_EncoreMode)); + + addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait)); } ACSVM::Thread *Environment::allocThread() @@ -262,6 +265,17 @@ bool Environment::checkTag(ACSVM::Word type, ACSVM::Word tag) const polyobj_t *po = Polyobj_GetForNum(tag); return (po == nullptr || po->thinker == nullptr); } + + case ACS_TAGTYPE_CAMERA: + { + const mobj_t *camera = P_FindObjectTypeFromTag(MT_ALTVIEWMAN, tag); + if (camera == nullptr || camera->spawnpoint == nullptr) + { + return true; + } + + return (camera->tracer == nullptr || P_MobjWasRemoved(camera->tracer) == true); + } } return true; diff --git a/src/acs/thread.hpp b/src/acs/thread.hpp index 4c3c307c2..7e528608a 100644 --- a/src/acs/thread.hpp +++ b/src/acs/thread.hpp @@ -57,6 +57,7 @@ enum acs_tagType_e { ACS_TAGTYPE_POLYOBJ, ACS_TAGTYPE_SECTOR, + ACS_TAGTYPE_CAMERA, }; class ThreadInfo : public ACSVM::ThreadInfo diff --git a/src/p_spec.c b/src/p_spec.c index 267e948cf..0d844cb27 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2405,7 +2405,7 @@ static void P_SwitchSkybox(INT32 args, player_t *player, skybox_t *skybox) } } -static mobj_t* P_FindObjectTypeFromTag(mobjtype_t type, mtag_t tag) +mobj_t* P_FindObjectTypeFromTag(mobjtype_t type, mtag_t tag) { if (udmf) { diff --git a/src/p_spec.h b/src/p_spec.h index b9eed2e4e..d33cdeb3f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -582,6 +582,8 @@ void P_CrossSpecialLine(line_t *line, INT32 side, mobj_t *thing); void P_PushSpecialLine(line_t *line, mobj_t *thing); void P_ActivateThingSpecial(mobj_t *mo, mobj_t *source); +mobj_t* P_FindObjectTypeFromTag(mobjtype_t type, mtag_t tag); + // // Special activation info //