Add CameraWait ACS function

Pauses a script until the tagged camera has no more waypoints to follow.
This commit is contained in:
Sally Coolatta 2023-03-02 20:31:12 -05:00
parent 9b18ce7849
commit 9073d5bd17
6 changed files with 38 additions and 1 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -57,6 +57,7 @@ enum acs_tagType_e
{
ACS_TAGTYPE_POLYOBJ,
ACS_TAGTYPE_SECTOR,
ACS_TAGTYPE_CAMERA,
};
class ThreadInfo : public ACSVM::ThreadInfo

View file

@ -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)
{

View file

@ -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
//