mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fully implement existing script type
Missed in the original merge.
This commit is contained in:
parent
730d9a0a5b
commit
0b622639e0
6 changed files with 115 additions and 34 deletions
|
|
@ -140,6 +140,68 @@ void ACS_LoadLevelScripts(size_t mapID)
|
|||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunLevelStartScripts(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void ACS_RunLevelStartScripts(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_OPEN, {});
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerRespawnScript(player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void ACS_RunPlayerRespawnScript(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_RESPAWN, scriptInfo);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerDeathScript(player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void ACS_RunPlayerDeathScript(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_DEATH, scriptInfo);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerEnterScript(player_t *player)
|
||||
|
||||
|
|
@ -163,40 +225,6 @@ void ACS_RunPlayerEnterScript(player_t *player)
|
|||
map->scriptStartTypeForced(ACS_ST_ENTER, scriptInfo);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunLevelStartScripts(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void ACS_RunLevelStartScripts(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_OPEN, {});
|
||||
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
|
||||
if (playeringame[i] == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player = &players[i];
|
||||
if (player->spectator == true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ACS_RunPlayerEnterScript(player);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunLapScript(mobj_t *mo, line_t *line)
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,38 @@ void ACS_Shutdown(void);
|
|||
void ACS_LoadLevelScripts(size_t mapID);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerRespawnScript(player_t *player);
|
||||
|
||||
Runs the map's special script for a player
|
||||
respawning.
|
||||
|
||||
Input Arguments:-
|
||||
player: The player to run the script for.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void ACS_RunPlayerRespawnScript(player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerDeathScript(player_t *player);
|
||||
|
||||
Runs the map's special script for a player
|
||||
dying.
|
||||
|
||||
Input Arguments:-
|
||||
player: The player to run the script for.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void ACS_RunPlayerDeathScript(player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void ACS_RunPlayerEnterScript(player_t *player);
|
||||
|
||||
|
|
|
|||
|
|
@ -656,6 +656,7 @@ struct player_t
|
|||
|
||||
boolean spectator;
|
||||
tic_t spectatewait; // reimplementable as UINT8 queue - How long have you been waiting as a spectator
|
||||
boolean enteredGame;
|
||||
|
||||
boolean bot;
|
||||
botvars_t botvars;
|
||||
|
|
|
|||
16
src/g_game.c
16
src/g_game.c
|
|
@ -64,6 +64,7 @@
|
|||
#include "k_director.h"
|
||||
#include "k_podium.h"
|
||||
#include "k_rank.h"
|
||||
#include "acs\interface.h"
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
|
|
@ -2431,6 +2432,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
UINT16 nocontrol;
|
||||
INT32 khudfault;
|
||||
INT32 kickstartaccel;
|
||||
boolean enteredGame;
|
||||
|
||||
score = players[player].score;
|
||||
lives = players[player].lives;
|
||||
|
|
@ -2590,6 +2592,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
skyboxviewpoint = skyboxcenterpoint = NULL;
|
||||
}
|
||||
|
||||
enteredGame = players[player].enteredGame;
|
||||
|
||||
p = &players[player];
|
||||
memset(p, 0, sizeof (*p));
|
||||
|
||||
|
|
@ -2697,6 +2701,18 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
}
|
||||
}
|
||||
|
||||
if (p->spectator == false)
|
||||
{
|
||||
if (betweenmaps || enteredGame == true)
|
||||
{
|
||||
ACS_RunPlayerEnterScript(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACS_RunPlayerRespawnScript(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (betweenmaps)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "k_objects.h"
|
||||
#include "k_roulette.h"
|
||||
#include "k_boss.h"
|
||||
#include "acs\interface.h"
|
||||
|
||||
// CTF player names
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
|
|
@ -1171,6 +1172,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
}
|
||||
|
||||
target->player->trickpanel = 0;
|
||||
|
||||
ACS_RunPlayerDeathScript(target->player);
|
||||
}
|
||||
|
||||
if (source && target && target->player && source->player)
|
||||
|
|
|
|||
|
|
@ -3649,6 +3649,7 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
player->spectatewait = 0;
|
||||
player->ctfteam = changeto;
|
||||
player->playerstate = PST_REBORN;
|
||||
player->enteredGame = true;
|
||||
|
||||
// Reset away view (some code referenced from Got_Teamchange)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue