From 28b3006efd338e1fdad9ddd0c9afb62c89a18f71 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 13:41:25 +0000 Subject: [PATCH 1/4] K_DirectorSwitch: Don't let forced switches cause a G_ResetView update when directorinfo.active is false --- src/k_director.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/k_director.c b/src/k_director.c index b1513672c..dd2f55ad6 100644 --- a/src/k_director.c +++ b/src/k_director.c @@ -110,16 +110,16 @@ static boolean K_CanSwitchDirector(void) return false; } - if (!directorinfo.active) - { - return false; - } - return true; } static void K_DirectorSwitch(INT32 player, boolean force) { + if (!directorinfo.active) + { + return; + } + if (P_IsDisplayPlayer(&players[player])) { return; From 739d81f403c2187ebc07e6785f49f0d21976e8af Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 15:00:35 +0000 Subject: [PATCH 2/4] G_BuildTiccmd: Fix not being able to use item button to toggle PF_WANTSTOJOIN --- src/g_game.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 9dc0b2fc8..be27e7360 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1179,9 +1179,18 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) K_ToggleDirector(false); } - if (M_MenuButtonPressed(forplayer, MBT_R)) + if (player->spectator == true) { - K_ToggleDirector(true); + // duplication of fire + if (G_PlayerInputDown(forplayer, gc_item, 0)) + { + cmd->buttons |= BT_ATTACK; + } + + if (M_MenuButtonPressed(forplayer, MBT_R)) + { + K_ToggleDirector(true); + } } goto aftercmdinput; From 93f151fec92767cd0173204ce5403eba86f73165 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 15:27:48 +0000 Subject: [PATCH 3/4] Director HUD: Do a bit of cleanup - Add "Join" on L button. - "Becomes ". . .", "Cancel join", and has "[i/n]" appended (where n is cap and i is number of players in game) - Add colorisation when Director is active - Make an attempt at fixing splitscreen (I wasn't able to get director to ACTIVATE in splitscreen with two local clients so it's frustratingly untested) --- src/k_hud.c | 63 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index d53a39d95..683040065 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -4639,16 +4639,26 @@ K_drawMiniPing (void) } } -static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2]) +static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2], INT32 textflags) { - const INT32 flags = V_SNAPTORIGHT | V_SLIDEIN; - const INT32 textflags = flags | V_6WIDTHSPACE | V_ALLOWLOWERCASE; + INT32 flags = V_SNAPTORIGHT | V_SLIDEIN | V_SPLITSCREEN; const UINT8 anim_duration = 16; const UINT8 anim = (leveltime % (anim_duration * 2)) < anim_duration; - const INT32 x = BASEVIDWIDTH - 60; - const INT32 y = BASEVIDHEIGHT - 70 + (idx * 16); + INT32 x = (BASEVIDWIDTH/2) - 10; + INT32 y = (idx * 16); + + if (r_splitscreen <= 1) + { + x = BASEVIDWIDTH - 60; + if (r_splitscreen == 0) + { + y += BASEVIDHEIGHT - 78; + } + } + + textflags |= (flags | V_6WIDTHSPACE | V_ALLOWLOWERCASE); V_DrawScaledPatch(x, y - 4, flags, kp[anim]); V_DrawRightAlignedThinString(x - 2, y, textflags, label); @@ -4656,14 +4666,49 @@ static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2]) static void K_drawDirectorHUD(void) { + const INT32 p = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers)[R_GetViewNumber()]; + const char *itemtxt = "Join"; + UINT8 offs = 0; + + UINT8 numingame = 0; + UINT8 i; + if (!LUA_HudEnabled(hud_textspectator)) { return; } - K_DrawDirectorButton(0, "Next Player", kp_button_a[0]); - K_DrawDirectorButton(1, "Prev Player", kp_button_x[0]); - K_DrawDirectorButton(2, "Director", kp_button_r); + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && !players[i].spectator) + numingame++; + + if (numingame > 1 && r_splitscreen == 0) // simplifies things a lot + { + K_DrawDirectorButton(1, "Next Player", kp_button_a[0], 0); + K_DrawDirectorButton(2, "Prev Player", kp_button_x[0], 0); + offs = 2; + } + else + + if (p == -1 || !playeringame[p] || players[p].spectator == false) + { + return; + } + + K_DrawDirectorButton(offs + 1, "Director", kp_button_r, + (directorinfo.active ? V_YELLOWMAP : 0)); + + if (players[p].flashing) + itemtxt = ". . ."; + else if (players[p].pflags & PF_WANTSTOJOIN) + itemtxt = "Cancel Join"; + + if (cv_maxplayers.value) + { + itemtxt = va("%s [%d/%d]", itemtxt, numingame, cv_maxplayers.value); + } + + K_DrawDirectorButton(0, itemtxt, kp_button_l, 0); } static void K_drawDistributionDebugger(void) @@ -4984,7 +5029,7 @@ void K_drawKartHUD(void) K_drawMiniPing(); } - if (displayplayers[viewnum] != g_localplayers[viewnum]) + if (displayplayers[viewnum] != g_localplayers[viewnum] && !demo.playback) { K_drawDirectorHUD(); } From 36afe024c79f759caeb8c72dd571734a39f410fe Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 16:06:12 +0000 Subject: [PATCH 4/4] Spurious else --- src/k_hud.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/k_hud.c b/src/k_hud.c index 683040065..8fd7607ec 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -4688,7 +4688,6 @@ static void K_drawDirectorHUD(void) K_DrawDirectorButton(2, "Prev Player", kp_button_x[0], 0); offs = 2; } - else if (p == -1 || !playeringame[p] || players[p].spectator == false) {