From 0093dd13e6d52c1c95f6d109ec9c96f8226b4a68 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 29 Feb 2024 00:24:37 +0000 Subject: [PATCH] M_Responder: "Quick" event polish - Quick Retry (Y in modeattacking) now cannot be fired in demo.playback - Add Quick Spectate (L+R+A+Start) per request - Only fires in Playing() + if gametype has spectator - Should support local splitscreen players, but can't test it by myself - If this input is held down in its full combination by p1, the pause menu itself will not open - Does NOT have any functionality if the player is already a spectator, it's just a quick bail --- src/k_menufunc.c | 64 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 894dcd969..efb78969d 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -385,19 +385,63 @@ boolean M_Responder(event_t *ev) } #endif - // Attack modes quick-restart - if (CON_Ready() == false && modeattacking && G_PlayerInputDown(0, gc_y, splitscreen + 1) == true) + if (CON_Ready() == false) { - M_TryAgain(0); - return true; - } + boolean allowmpause = true; - if (CON_Ready() == false && G_PlayerInputDown(0, gc_start, splitscreen + 1) == true) - { - if (!chat_on) + // Special mid-game input behaviours + if (Playing() && !demo.playback) { - M_StartControlPanel(); - return true; + // Quick Retry (Y in modeattacking) + if (modeattacking && G_PlayerInputDown(0, gc_y, splitscreen + 1) == true) + { + M_TryAgain(0); + return true; + } + + // Quick Spectate (L+R+A+Start online) + if (G_GametypeHasSpectators()) + { + UINT8 workingpid = 0; + for (workingpid = 0; workingpid <= splitscreen; workingpid++) + { + if (players[g_localplayers[workingpid]].spectator == true) + continue; + + if (G_PlayerInputDown(workingpid, gc_l, 0) == false) + continue; + if (G_PlayerInputDown(workingpid, gc_r, 0) == false) + continue; + if (G_PlayerInputDown(workingpid, gc_a, 0) == false) + continue; + if (G_PlayerInputDown(workingpid, gc_start, 0) == false) + continue; + + if (workingpid == 0) + { + allowmpause = false; + COM_ImmedExecute("changeteam spectator"); + continue; + } + + COM_ImmedExecute( + va( + "changeteam%u spectator", + workingpid + 1 + ) + ); + } + } + } + + // Bog-standard Pause + if (allowmpause && G_PlayerInputDown(0, gc_start, splitscreen + 1) == true) + { + if (!chat_on) + { + M_StartControlPanel(); + return true; + } } }