New ACS functions (resolves #697)

- For Tutorials specifically
    - void Dialogue_AutoDismiss(void)
        - Dismisses the current dialogue (including from other threads).
    - str CheckTutorialChallenge(void)
        - Returns special values depending on state relevant to the Tutorial Challenge.
            - Returns a blank string in netgames, or if none of the following are true.
            - Returns "Active" if the skip is in progress.
            - Returns "Failed" if the skip was just failed.
            - Returns "Locked" if not available with this gamedata.
- Other tiny check functions
    - bool PositionStart(void)
        - Returns true if leveltime < starttime.
    - bool FreePlay(void)
        - Returns true if in Free Play.
This commit is contained in:
toaster 2023-12-10 18:23:57 +00:00
parent cdb2b44aa6
commit 75205e3f79
3 changed files with 97 additions and 1 deletions

View file

@ -1301,7 +1301,9 @@ bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:
&& (info->mo != NULL && P_MobjWasRemoved(info->mo) == false)
&& (info->mo->player != NULL))
{
rings = info->mo->player->rings;
rings = (gametyperules & GTR_SPHERES)
? info->mo->player->spheres
: info->mo->player->rings;
}
thread->dataStk.push(rings);
@ -1771,6 +1773,20 @@ bool CallFunc_TimeAttack(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::
return false;
}
/*--------------------------------------------------
bool CallFunc_FreePlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns if the map is in Free Play.
--------------------------------------------------*/
bool CallFunc_FreePlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argV;
(void)argC;
thread->dataStk.push((M_NotFreePlay() == false));
return false;
}
/*--------------------------------------------------
bool CallFunc_GrandPrix(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
@ -1785,6 +1801,20 @@ bool CallFunc_GrandPrix(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
return false;
}
/*--------------------------------------------------
bool CallFunc_PositionStart(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns if the map is in POSITION!!
--------------------------------------------------*/
bool CallFunc_PositionStart(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argV;
(void)argC;
thread->dataStk.push((starttime != 0 && leveltime < starttime));
return false;
}
/*--------------------------------------------------
bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
@ -1822,6 +1852,45 @@ bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV,
return false;
}
/*--------------------------------------------------
bool CallFunc_CheckTutorialChallenge(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Returns the Tutorial Challenge status, if possible.
--------------------------------------------------*/
bool CallFunc_CheckTutorialChallenge(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
Environment *env = &ACSEnv;
(void)argV;
(void)argC;
if (netgame == false) // behaviour is not particularly sync-friendly
{
if (tutorialchallenge == TUTORIALSKIP_INPROGRESS)
{
thread->dataStk.push(~env->getString( "Active" )->idx);
return false;
}
if (tutorialchallenge == TUTORIALSKIP_FAILED)
{
thread->dataStk.push(~env->getString( "Failed" )->idx);
return false;
}
if (gamedata != nullptr
&& gamedata->enteredtutorialchallenge == true
&& M_GameTrulyStarted() == false)
{
thread->dataStk.push(~env->getString( "Locked" )->idx);
return false;
}
}
thread->dataStk.push(0);
return false;
}
/*--------------------------------------------------
bool CallFunc_PodiumPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
@ -2196,6 +2265,25 @@ bool CallFunc_DialogueNewText(ACSVM::Thread *thread, const ACSVM::Word *argV, AC
return false;
}
/*--------------------------------------------------
bool CallFunc_DialogueAutoDismiss(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Dismiss the current dialogue text.
--------------------------------------------------*/
bool CallFunc_DialogueAutoDismiss(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argV;
(void)argC;
if (Dialogue_ValidCheck(thread) == false)
{
return false;
}
g_dialogue.Dismiss();
return false;
}
/*--------------------------------------------------
bool CallFunc_MusicPlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)

View file

@ -83,8 +83,11 @@ bool CallFunc_LowestLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
bool CallFunc_EncoreMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PrisonBreak(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_FreePlay(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_PositionStart(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_CheckTutorialChallenge(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);
@ -102,6 +105,7 @@ bool CallFunc_MusicRemap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::
bool CallFunc_DialogueSetSpeaker(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_DialogueSetCustomSpeaker(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_DialogueNewText(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_DialogueAutoDismiss(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Freeze(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);

View file

@ -169,6 +169,9 @@ Environment::Environment()
addFuncDataACS0( 313, addCallFunc(CallFunc_GrandPrix));
addFuncDataACS0( 314, addCallFunc(CallFunc_GetGrabbedSprayCan));
addFuncDataACS0( 315, addCallFunc(CallFunc_PlayerBot));
addFuncDataACS0( 316, addCallFunc(CallFunc_PositionStart));
addFuncDataACS0( 317, addCallFunc(CallFunc_FreePlay));
addFuncDataACS0( 318, addCallFunc(CallFunc_CheckTutorialChallenge));
addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait));
addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition));
@ -188,6 +191,7 @@ Environment::Environment()
addFuncDataACS0( 602, addCallFunc(CallFunc_DialogueNewText));
addFuncDataACS0( 603, addCallFunc(CallFunc_DialogueWaitDismiss));
addFuncDataACS0( 604, addCallFunc(CallFunc_DialogueWaitText));
addFuncDataACS0( 605, addCallFunc(CallFunc_DialogueAutoDismiss));
}
ACSVM::Thread *Environment::allocThread()