Add FINISH script calling type to ACS

Called at the end of a successful P_DoPlayerExit
This commit is contained in:
toaster 2024-03-30 16:02:35 +00:00
parent 56534a747e
commit a7079d6ea2
4 changed files with 43 additions and 0 deletions

View file

@ -244,6 +244,29 @@ void ACS_RunPlayerEnterScript(player_t *player)
map->scriptStartTypeForced(ACS_ST_ENTER, scriptInfo); map->scriptStartTypeForced(ACS_ST_ENTER, scriptInfo);
} }
/*--------------------------------------------------
void ACS_RunPlayerFinishScript(player_t *player)
See header file for description.
--------------------------------------------------*/
void ACS_RunPlayerFinishScript(player_t *player)
{
Environment *env = &ACSEnv;
ACSVM::GlobalScope *const global = env->getGlobalScope(0);
ACSVM::HubScope *const hub = global->getHubScope(0);
ACSVM::MapScope *const map = hub->getMapScope(0);
ACSVM::MapScope::ScriptStartInfo scriptInfo;
ThreadInfo info;
P_SetTarget(&info.mo, player->mo);
scriptInfo.info = &info;
map->scriptStartTypeForced(ACS_ST_FINISH, scriptInfo);
}
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_RunLapScript(mobj_t *mo, line_t *line) void ACS_RunLapScript(mobj_t *mo, line_t *line)

View file

@ -139,6 +139,22 @@ void ACS_RunPlayerDeathScript(player_t *player);
void ACS_RunPlayerEnterScript(player_t *player); void ACS_RunPlayerEnterScript(player_t *player);
/*--------------------------------------------------
void ACS_RunPlayerFinishScript(player_t *player);
Runs the map's special script for a player
finishing (P_DoPlayerExit).
Input Arguments:-
player: The player to run the script for.
Return:-
None
--------------------------------------------------*/
void ACS_RunPlayerFinishScript(player_t *player);
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_RunLapScript(mobj_t *mo, line_t *line); void ACS_RunLapScript(mobj_t *mo, line_t *line);

View file

@ -43,6 +43,7 @@ enum acs_scriptType_e
ACS_ST_UFO = 8, // UFO: Runs when the UFO Catcher is destroyed in a Special Stage. 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_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. ACS_ST_GAMEOVER = 10, // GAMEOVER: Runs when the level ends due to a losing condition and no player has an extra life.
ACS_ST_FINISH = 11, // FINISH: Runs when a player finishes
}; };
// //

View file

@ -71,6 +71,7 @@
#include "k_credits.h" #include "k_credits.h"
#include "k_hud.h" // K_AddMessage #include "k_hud.h" // K_AddMessage
#include "m_easing.h" #include "m_easing.h"
#include "acs/interface.h"
#ifdef HWRENDER #ifdef HWRENDER
#include "hardware/hw_light.h" #include "hardware/hw_light.h"
@ -1342,6 +1343,8 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
demo.savebutton = leveltime; demo.savebutton = leveltime;
} }
} }
ACS_RunPlayerFinishScript(player);
} }
// //