k_director.h: remove directorinfo extern, add K_DirectorIsEnabled

This commit is contained in:
James R 2023-10-03 18:27:22 -07:00
parent c72a2cf94a
commit 17b7a2f16d
3 changed files with 20 additions and 15 deletions

View file

@ -20,7 +20,18 @@
#define WALKBACKDIST 600 // how close should a trailing player be before we switch?
#define PINCHDIST 30000 // how close should the leader be to be considered "end of race"?
struct directorinfo directorinfo;
struct directorinfo
{
boolean active; // is view point switching enabled?
tic_t cooldown; // how long has it been since we last switched?
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
INT32 attacker; // who to switch to when freeze delay elapses
INT32 maxdist; // how far is the closest player from finishing?
INT32 sortedplayers[MAXPLAYERS]; // position-1 goes in, player index comes out.
INT32 gap[MAXPLAYERS]; // gap between a given position and their closest pursuer
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
} directorinfo;
void K_InitDirector(void)
{
@ -324,6 +335,12 @@ void K_ToggleDirector(boolean active)
directorinfo.active = active;
}
boolean K_DirectorIsEnabled(UINT8 viewnum)
{
(void)viewnum;
return directorinfo.active;
}
boolean K_DirectorIsAvailable(UINT8 viewnum)
{
return viewnum <= r_splitscreen && viewnum < G_PartySize(consoleplayer) &&

View file

@ -10,24 +10,12 @@
extern "C" {
#endif
extern struct directorinfo
{
boolean active; // is view point switching enabled?
tic_t cooldown; // how long has it been since we last switched?
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
INT32 attacker; // who to switch to when freeze delay elapses
INT32 maxdist; // how far is the closest player from finishing?
INT32 sortedplayers[MAXPLAYERS]; // position-1 goes in, player index comes out.
INT32 gap[MAXPLAYERS]; // gap between a given position and their closest pursuer
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
} directorinfo;
void K_InitDirector(void);
void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
void K_ToggleDirector(boolean active);
boolean K_DirectorIsEnabled(UINT8 viewnum);
boolean K_DirectorIsAvailable(UINT8 viewnum);
#ifdef __cplusplus

View file

@ -5225,7 +5225,7 @@ static void K_drawDirectorHUD(void)
// TODO: this is too close to the screen bottom
K_DrawDirectorButton(offs + 2, "Director", kp_button_r,
(directorinfo.active ? V_YELLOWMAP : 0));
(K_DirectorIsEnabled(viewnum) ? V_YELLOWMAP : 0));
if (players[p].flashing)
itemtxt = ". . .";