diff --git a/extras/conf/RingRacers_ACS.cfg b/extras/conf/RingRacers_ACS.cfg index fe2d177d2..9a669635d 100644 --- a/extras/conf/RingRacers_ACS.cfg +++ b/extras/conf/RingRacers_ACS.cfg @@ -4,7 +4,7 @@ // Compiler settings compiler = "ringracers_gdcc"; -parameters = "-I \"%PT\" -I \"%PS\" %FI %FO"; +parameters = "@rroptions -I \"%PT\" -I \"%PS\" %FI %FO"; resultlump = "BEHAVIOR"; // Editor settings diff --git a/extras/conf/gdcc.cfg b/extras/gdcc/gdcc.cfg similarity index 100% rename from extras/conf/gdcc.cfg rename to extras/gdcc/gdcc.cfg diff --git a/extras/gdcc/rrcommon.acs b/extras/gdcc/inc/ACS/rrcommon.acs similarity index 100% rename from extras/gdcc/rrcommon.acs rename to extras/gdcc/inc/ACS/rrcommon.acs diff --git a/extras/gdcc/rrdefs.acs b/extras/gdcc/inc/ACS/rrdefs.acs similarity index 100% rename from extras/gdcc/rrdefs.acs rename to extras/gdcc/inc/ACS/rrdefs.acs diff --git a/extras/gdcc/rrspecial.acs b/extras/gdcc/inc/ACS/rrspecial.acs similarity index 100% rename from extras/gdcc/rrspecial.acs rename to extras/gdcc/inc/ACS/rrspecial.acs diff --git a/extras/gdcc/rroptions b/extras/gdcc/rroptions new file mode 100644 index 000000000..2fa0bcbce --- /dev/null +++ b/extras/gdcc/rroptions @@ -0,0 +1,2 @@ +# Define custom script type names here. +--bc-zdacs-script-type lap 5 diff --git a/src/k_acs.c b/src/k_acs.c index 3e98abc78..883b7bfc9 100644 --- a/src/k_acs.c +++ b/src/k_acs.c @@ -714,6 +714,31 @@ void ACS_RunLevelStartScripts(void) } } +/*-------------------------------------------------- + void ACS_RunLapScript(mobj_t *mo, line_t *line) + + See header file for description. +--------------------------------------------------*/ +void ACS_RunLapScript(mobj_t *mo, line_t *line) +{ + ACSVM_GlobalScope *global = NULL; + ACSVM_HubScope *hub = NULL; + ACSVM_MapScope *map = NULL; + + acs_threadinfo_t *activator = NULL; + + global = ACSVM_Environment_GetGlobalScope(ACSenv, 0); + hub = ACSVM_GlobalScope_GetHubScope(global, 0); + map = ACSVM_HubScope_GetMapScope(hub, 0); + + activator = Z_Calloc(sizeof(acs_threadinfo_t), PU_STATIC, NULL); + + P_SetTarget(&activator->mo, mo); + activator->line = line; + + ACSVM_MapScope_ScriptStartTypeForced(map, ACS_ST_LAP, NULL, 0, ACSVM_AllocThreadInfo(activator), NULL); +} + /*-------------------------------------------------- void ACS_Tick(void) diff --git a/src/k_acs.h b/src/k_acs.h index f90d37126..f8efecdc4 100644 --- a/src/k_acs.h +++ b/src/k_acs.h @@ -38,6 +38,7 @@ typedef enum ACS_ST_RESPAWN = 2, // RESPAWN: Runs when a player respawns. 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_LAP = 5, // LAP: Runs when a player's lap increases from crossing the finish line. } acs_scriptType_e; // @@ -145,6 +146,23 @@ void ACS_RunPlayerEnterScript(player_t *player); void ACS_RunLevelStartScripts(void); +/*-------------------------------------------------- + void ACS_RunLapScript(mobj_t *mo, line_t *line); + + Runs the map's special script for a player + crossing the finish line. + + Input Arguments:- + player: The player to run the script for. + line: The finish line's linedef. + + Return:- + None +--------------------------------------------------*/ + +void ACS_RunLapScript(mobj_t *mo, line_t *line); + + /*-------------------------------------------------- void ACS_Tick(void); diff --git a/src/p_spec.c b/src/p_spec.c index fc9f6df04..4f77a1d4f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -46,6 +46,7 @@ #include "k_kart.h" #include "console.h" // CON_LogMessage #include "k_terrain.h" +#include "k_acs.h" #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4224,6 +4225,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha || (!(args[0] & TMCFF_FLIP) && (side == 1))) // crossed from behind to infront { K_HandleLapIncrement(mo->player,false); + ACS_RunLapScript(mo, line); } else { @@ -5186,6 +5188,7 @@ static void P_EvaluateOldSectorSpecial(player_t *player, sector_t *sector, secto if ((gametyperules & GTR_CIRCUIT) && (player->exiting == 0) && !(player->pflags & PF_HITFINISHLINE)) { K_HandleLapIncrement(player, true); + ACS_RunLapScript(player->mo, line); player->pflags |= PF_HITFINISHLINE; } break;