Add LAP script type

GDCC just updated after my feature request for remappable script type names, so there's no more limitations surrounding those.
This commit is contained in:
Sally Coolatta 2022-10-09 21:05:25 -04:00
parent 460e1a67c7
commit 6403df0a0a
9 changed files with 49 additions and 1 deletions

View file

@ -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

2
extras/gdcc/rroptions Normal file
View file

@ -0,0 +1,2 @@
# Define custom script type names here.
--bc-zdacs-script-type lap 5

View file

@ -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)

View file

@ -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);

View file

@ -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
{