Add "GetGrabbedSprayCan" to ACS

- If netgame or no Spray Can has been grabbed on this map, return 0
- If all Spray Cans have been grabbed in other maps, return "_Completed"
- Otherwise, return the name for the Spray Can color attached to this map
This commit is contained in:
toaster 2023-09-13 18:10:08 +01:00
parent ce86ebbd52
commit e854ce53f5
3 changed files with 38 additions and 0 deletions

View file

@ -1714,6 +1714,42 @@ bool CallFunc_GrandPrix(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
return false;
}
/*--------------------------------------------------
bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns the level's associated Spray Can, if grabbed.
--------------------------------------------------*/
bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
Environment *env = &ACSEnv;
(void)argV;
(void)argC;
if (netgame == false // cans are per-player and completely unsyncable
&& gamemap-1 < basenummapheaders)
{
// See also P_SprayCanInit
UINT16 can_id = mapheaderinfo[gamemap-1]->cache_spraycan;
if (can_id < gamedata->numspraycans)
{
UINT16 col = gamedata->spraycans[can_id].col;
thread->dataStk.push(~env->getString( skincolors[col].name )->idx);
return false;
}
if (gamedata->gotspraycans >= gamedata->numspraycans)
{
thread->dataStk.push(~env->getString( "_Completed" )->idx);
return false;
}
}
thread->dataStk.push(0);
return false;
}
/*--------------------------------------------------
bool CallFunc_PodiumPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)

View file

@ -82,6 +82,7 @@ bool CallFunc_EncoreMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::
bool CallFunc_BreakTheCapsules(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_TimeAttack(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GrandPrix(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PodiumPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PodiumFinish(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);

View file

@ -166,6 +166,7 @@ Environment::Environment()
addFuncDataACS0( 311, addCallFunc(CallFunc_TimeAttack));
addFuncDataACS0( 312, addCallFunc(CallFunc_ThingCount));
addFuncDataACS0( 313, addCallFunc(CallFunc_GrandPrix));
addFuncDataACS0( 314, addCallFunc(CallFunc_GetGrabbedSprayCan));
addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait));
addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition));