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
This commit is contained in:
toaster 2024-02-29 00:24:37 +00:00
parent 038016252a
commit 0093dd13e6

View file

@ -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;
}
}
}