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 94c822680..14c4aec8d 100644 --- a/src/k_acs.c +++ b/src/k_acs.c @@ -710,6 +710,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 227787307..63c4745a3 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 3934e56c9..7ff5eabc3 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -45,6 +45,7 @@ #include "console.h" // CON_LogMessage #include "k_respawn.h" #include "k_terrain.h" +#include "k_acs.h" #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -2083,6 +2084,8 @@ void P_CrossSpecialLine(line_t *line, INT32 side, mobj_t *thing) || (!(line->flags & (ML_NOCLIMB)) && (side == 1))) // crossed from behind to infront { K_HandleLapIncrement(player); + + ACS_RunLapScript(thing, line); } else {