Add GAMEOVER ACS script type

Triggered when the level ends with a losing condition and
there are no extra lives.
This commit is contained in:
James R 2023-08-15 17:00:03 -07:00
parent 8a72f42818
commit 9b4367773c
4 changed files with 36 additions and 0 deletions

View file

@ -315,6 +315,22 @@ void ACS_RunEmeraldScript(mobj_t *mo)
map->scriptStartType(ACS_ST_EMERALD, scriptInfo);
}
/*--------------------------------------------------
void ACS_RunGameOverScript(void)
See header file for description.
--------------------------------------------------*/
void ACS_RunGameOverScript(void)
{
Environment *env = &ACSEnv;
ACSVM::GlobalScope *const global = env->getGlobalScope(0);
ACSVM::HubScope *const hub = global->getHubScope(0);
ACSVM::MapScope *const map = hub->getMapScope(0);
map->scriptStartType(ACS_ST_GAMEOVER, {});
}
/*--------------------------------------------------
void ACS_Tick(void)

View file

@ -179,6 +179,17 @@ void ACS_RunCatcherScript(mobj_t *mo);
void ACS_RunEmeraldScript(mobj_t *mo);
/*--------------------------------------------------
void ACS_RunGameOverScript(void);
Runs the map's special scripts for exiting
the level, due to a losing condition and
without any extra lives to retry.
--------------------------------------------------*/
void ACS_RunGameOverScript(void);
/*--------------------------------------------------
void ACS_Tick(void);

View file

@ -42,6 +42,7 @@ enum acs_scriptType_e
ACS_ST_OVERTIME = 7, // OVERTIME: Runs when Overtime starts in timed game modes.
ACS_ST_UFO = 8, // UFO: Runs when the UFO Catcher is destroyed in a Special Stage.
ACS_ST_EMERALD = 9, // EMERALD: Runs when the Chaos Emerald is collected in a Special Stage.
ACS_ST_GAMEOVER = 10, // GAMEOVER: Runs when the level ends due to a losing condition and no player has an extra life.
};
//

View file

@ -2998,6 +2998,14 @@ void G_BeginLevelExit(void)
{
exitcountdown = raceexittime+1;
}
if (g_exit.losing)
{
if (!g_exit.retry)
{
ACS_RunGameOverScript();
}
}
}
void G_FinishExitLevel(void)