Replace hardcoded keys for screenshot etc with bindable controls

Renames M_ScreenshotResponder to M_ScreenshotTicker. No
longer eats events. As a side effect, these controls
cannot be used with the console open.
This commit is contained in:
James R 2023-03-23 22:20:24 -07:00 committed by toaster
parent d9faef58cb
commit 80421da5b3
5 changed files with 16 additions and 29 deletions

View file

@ -6755,6 +6755,8 @@ void NetUpdate(void)
I_unlock_mutex(k_menu_mutex);
#endif
CON_Ticker();
M_ScreenshotTicker();
}
FileSendTicker();

View file

@ -248,10 +248,6 @@ void D_ProcessEvents(void)
HandleGamepadDeviceEvents(ev);
// Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev))
continue; // ate the event
if (gameaction == ga_nothing && gamestate == GS_TITLESCREEN)
{
if (cht_Responder(ev))

View file

@ -541,7 +541,10 @@ typedef enum
MBT_Z = 1<<5,
MBT_L = 1<<6,
MBT_R = 1<<7,
MBT_START = 1<<8
MBT_START = 1<<8,
MBT_SCREENSHOT = 1<<9,
MBT_STARTMOVIE = 1<<10,
MBT_STARTLOSSLESS = 1<<11,
} menuButtonCode_t;
struct menucmd_t

View file

@ -1846,24 +1846,16 @@ failure:
#endif
}
boolean M_ScreenshotResponder(event_t *ev)
void M_ScreenshotTicker(void)
{
INT32 ch = -1;
if (dedicated || ev->type != ev_keydown)
return false;
const UINT8 pid = 0; // TODO: should splitscreen players be allowed to use this too?
ch = ev->data1;
if (ch >= NUMKEYS && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
return false;
switch (ch)
if (M_MenuButtonPressed(pid, MBT_SCREENSHOT))
{
case KEY_F8:
M_ScreenShot();
break;
case KEY_F9:
}
else if (M_MenuButtonPressed(pid, MBT_STARTMOVIE))
{
if (moviemode)
{
M_StopMovie();
@ -1872,9 +1864,9 @@ boolean M_ScreenshotResponder(event_t *ev)
{
M_StartMovie(MM_AVRECORDER);
}
break;
case KEY_F10:
}
else if (M_MenuButtonPressed(pid, MBT_STARTLOSSLESS))
{
if (moviemode)
{
M_StopMovie();
@ -1883,13 +1875,7 @@ boolean M_ScreenshotResponder(event_t *ev)
{
M_StartMovie(static_cast<moviemode_t>(cv_lossless_recorder.value));
}
break;
default:
return false;
}
return true;
}
void M_MinimapGenerate(void)

View file

@ -98,7 +98,7 @@ void M_ScreenShot(void);
#ifdef HWRENDER
void M_DoLegacyGLScreenShot(void);
#endif
boolean M_ScreenshotResponder(event_t *ev);
void M_ScreenshotTicker(void);
void M_MinimapGenerate(void);