Add additional script types

- POSITION: Runs when POSITION period ends. Has no activator.
- OVERTIME: Runs when the time limit runs out. Has no activator.
- EMERALD: Runs when the Special Stage UFO's Chaos Emerald is grabbed. The activator object is set to the player that grabbed it.
This commit is contained in:
Sally Coolatta 2023-03-10 02:42:54 -05:00
parent 0b622639e0
commit c8ccb13614
5 changed files with 113 additions and 12 deletions

View file

@ -249,6 +249,61 @@ void ACS_RunLapScript(mobj_t *mo, line_t *line)
map->scriptStartTypeForced(ACS_ST_LAP, scriptInfo); map->scriptStartTypeForced(ACS_ST_LAP, scriptInfo);
} }
/*--------------------------------------------------
void ACS_RunPositionScript(void)
See header file for description.
--------------------------------------------------*/
void ACS_RunPositionScript(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_POSITION, {});
}
/*--------------------------------------------------
void ACS_RunOvertimeScript(void)
See header file for description.
--------------------------------------------------*/
void ACS_RunOvertimeScript(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_OVERTIME, {});
}
/*--------------------------------------------------
void ACS_RunEmeraldScript(mobj_t *mo)
See header file for description.
--------------------------------------------------*/
void ACS_RunEmeraldScript(mobj_t *mo)
{
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, mo);
scriptInfo.info = &info;
map->scriptStartTypeForced(ACS_ST_EMERALD, scriptInfo);
}
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_Tick(void) void ACS_Tick(void)

View file

@ -59,6 +59,17 @@ void ACS_Shutdown(void);
void ACS_LoadLevelScripts(size_t mapID); void ACS_LoadLevelScripts(size_t mapID);
/*--------------------------------------------------
void ACS_RunLevelStartScripts(void);
Runs the map's special scripts for opening
the level, and for all players to enter
the game.
--------------------------------------------------*/
void ACS_RunLevelStartScripts(void);
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_RunPlayerRespawnScript(player_t *player); void ACS_RunPlayerRespawnScript(player_t *player);
@ -107,17 +118,6 @@ void ACS_RunPlayerDeathScript(player_t *player);
void ACS_RunPlayerEnterScript(player_t *player); void ACS_RunPlayerEnterScript(player_t *player);
/*--------------------------------------------------
void ACS_RunLevelStartScripts(void);
Runs the map's special scripts for opening
the level, and for all players to enter
the game.
--------------------------------------------------*/
void ACS_RunLevelStartScripts(void);
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_RunLapScript(mobj_t *mo, line_t *line); void ACS_RunLapScript(mobj_t *mo, line_t *line);
@ -135,6 +135,36 @@ void ACS_RunLevelStartScripts(void);
void ACS_RunLapScript(mobj_t *mo, line_t *line); void ACS_RunLapScript(mobj_t *mo, line_t *line);
/*--------------------------------------------------
void ACS_RunPositionScript(void);
Runs the map's special script for when the level
goes past the POSITION period.
--------------------------------------------------*/
void ACS_RunPositionScript(void);
/*--------------------------------------------------
void ACS_RunOvertimeScript(void);
Runs the map's special script for when the time
limit runs out and overtime begins.
--------------------------------------------------*/
void ACS_RunOvertimeScript(void);
/*--------------------------------------------------
void ACS_RunEmeraldScript(mobj_t *mo);
Runs the map's special script for when the
Special Stage Chaos Emerald is collected.
--------------------------------------------------*/
void ACS_RunEmeraldScript(mobj_t *mo);
/*-------------------------------------------------- /*--------------------------------------------------
void ACS_Tick(void); void ACS_Tick(void);

View file

@ -48,6 +48,9 @@ enum acs_scriptType_e
ACS_ST_DEATH = 3, // DEATH: Runs when a player dies. ACS_ST_DEATH = 3, // DEATH: Runs when a player dies.
ACS_ST_ENTER = 4, // ENTER: Runs when a player enters the game; both on start of the level, and when un-spectating. ACS_ST_ENTER = 4, // ENTER: Runs when a player enters the game; both on start of the level, and when un-spectating.
ACS_ST_LAP = 5, // LAP: Runs when a player's lap increases from crossing the finish line. ACS_ST_LAP = 5, // LAP: Runs when a player's lap increases from crossing the finish line.
ACS_ST_POSITION = 6, // POSITION: Runs when the POSITION period ends.
ACS_ST_OVERTIME = 7, // OVERTIME: Runs when Overtime starts in timed game modes.
ACS_ST_EMERALD = 8, // EMERALD: Runs when the Chaos Emerald is collected in a Special Stage.
}; };
// //

View file

@ -24,6 +24,7 @@
#include "../k_waypoint.h" #include "../k_waypoint.h"
#include "../k_specialstage.h" #include "../k_specialstage.h"
#include "../r_skins.h" #include "../r_skins.h"
#include "../acs/interface.h"
#define UFO_BASE_SPEED (42 * FRACUNIT) // UFO's slowest speed. #define UFO_BASE_SPEED (42 * FRACUNIT) // UFO's slowest speed.
#define UFO_SPEEDUP (FRACUNIT >> 1) // Acceleration #define UFO_SPEEDUP (FRACUNIT >> 1) // Acceleration
@ -697,7 +698,7 @@ boolean Obj_SpecialUFODamage(mobj_t *ufo, mobj_t *inflictor, mobj_t *source, UIN
ufo->flags = (ufo->flags & ~MF_SHOOTABLE) | (MF_SPECIAL|MF_PICKUPFROMBELOW); ufo->flags = (ufo->flags & ~MF_SHOOTABLE) | (MF_SPECIAL|MF_PICKUPFROMBELOW);
ufo->shadowscale = FRACUNIT/3; ufo->shadowscale = FRACUNIT/3;
P_LinedefExecute(LE_PINCHPHASE, ufo, NULL); ACS_RunEmeraldScript(source);
S_StopSound(ufo); S_StopSound(ufo);
S_StartSound(ufo, sfx_clawk2); S_StartSound(ufo, sfx_clawk2);

View file

@ -695,8 +695,20 @@ void P_Ticker(boolean run)
P_PrecipitationEffects(); P_PrecipitationEffects();
if (run) if (run)
{
leveltime++; leveltime++;
if (starttime > introtime && leveltime == starttime)
{
ACS_RunPositionScript();
}
if (timelimitintics > 0 && leveltime == (timelimitintics + starttime + 1))
{
ACS_RunOvertimeScript();
}
}
timeinmap++; timeinmap++;
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())