Fully implement existing script type
Missed in the original merge.
This commit is contained in:
parent
af277ad1d9
commit
9b950fb5e7
6 changed files with 115 additions and 34 deletions
|
|
@ -144,6 +144,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)
|
||||
|
||||
|
|
@ -167,40 +229,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -550,6 +550,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
|
|
@ -61,6 +61,7 @@
|
|||
#include "k_bot.h"
|
||||
#include "doomstat.h"
|
||||
#include "acs/interface.h"
|
||||
#include "k_director.h"
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
|
|
@ -2248,6 +2249,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
UINT8 griefstrikes;
|
||||
UINT16 nocontrol;
|
||||
INT32 kickstartaccel;
|
||||
boolean enteredGame;
|
||||
|
||||
score = players[player].score;
|
||||
lives = players[player].lives;
|
||||
|
|
@ -2393,6 +2395,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
grieftime = players[player].grieftime;
|
||||
griefstrikes = players[player].griefstrikes;
|
||||
|
||||
enteredGame = players[player].enteredGame;
|
||||
|
||||
p = &players[player];
|
||||
memset(p, 0, sizeof (*p));
|
||||
|
||||
|
|
@ -2504,6 +2508,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "k_boss.h"
|
||||
#include "p_spec.h"
|
||||
#include "k_objects.h"
|
||||
#include "acs/interface.h"
|
||||
|
||||
// CTF player names
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
|
|
@ -1158,6 +1159,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
K_CheckBumpers();
|
||||
|
||||
target->player->pogospring = 0;
|
||||
|
||||
ACS_RunPlayerDeathScript(target->player);
|
||||
}
|
||||
|
||||
if (source && target && target->player && source->player)
|
||||
|
|
|
|||
|
|
@ -3735,6 +3735,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…
Reference in a new issue