Add PlayerNumber and ActivatorTID from ZDoom

This commit is contained in:
Sally Coolatta 2023-08-14 04:06:11 -04:00
parent 0bb4e0b0fa
commit ae7325cbc3
3 changed files with 52 additions and 0 deletions

View file

@ -1236,6 +1236,53 @@ bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:
return false;
}
/*--------------------------------------------------
bool CallFunc_PlayerNumber(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns the activating player's ID.
--------------------------------------------------*/
bool CallFunc_PlayerNumber(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
auto info = &static_cast<Thread *>(thread)->info;
INT16 playerID = -1;
(void)argV;
(void)argC;
if ((info != NULL)
&& (info->mo != NULL && P_MobjWasRemoved(info->mo) == false)
&& (info->mo->player != NULL))
{
playerID = (info->mo->player - players);
}
thread->dataStk.push(playerID);
return false;
}
/*--------------------------------------------------
bool CallFunc_ActivatorTID(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns the activating object's TID.
--------------------------------------------------*/
bool CallFunc_ActivatorTID(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
auto info = &static_cast<Thread *>(thread)->info;
INT16 tid = 0;
(void)argV;
(void)argC;
if ((info != NULL)
&& (info->mo != NULL && P_MobjWasRemoved(info->mo) == false))
{
tid = info->mo->tid;
}
thread->dataStk.push(tid);
return false;
}
/*--------------------------------------------------
bool CallFunc_EndLog(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)

View file

@ -60,6 +60,8 @@ bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerNumber(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_ActivatorTID(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_EndLog(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_strcmp(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);

View file

@ -108,6 +108,9 @@ Environment::Environment()
// 225 to 243: Implemented by ACSVM
addCodeDataACS0(247, {"", 0, addCallFunc(CallFunc_PlayerNumber)});
addCodeDataACS0(248, {"", 0, addCallFunc(CallFunc_ActivatorTID)});
// 253: Implemented by ACSVM
// 256 to 257: Implemented by ACSVM