diff --git a/src/console.c b/src/console.c index aac5c2c5f..6571b9f2a 100644 --- a/src/console.c +++ b/src/console.c @@ -913,7 +913,8 @@ boolean CON_Responder(event_t *ev) // let go keyup events, don't eat them if (ev->type != ev_keydown && ev->type != ev_console) { - if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1]) + if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1] + || ev->data1 == gamecontrol[0][gc_console][2] || ev->data1 == gamecontrol[0][gc_console][3]) consdown = false; return false; } @@ -933,7 +934,8 @@ boolean CON_Responder(event_t *ev) INT32 i; for (i = 0; i < num_gamecontrols; i++) { - if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1) + if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1 + || gamecontrol[0][i][2] == ev->data1 || gamecontrol[0][i][3] == ev->data1) break; } @@ -941,7 +943,8 @@ boolean CON_Responder(event_t *ev) return false; } - if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1]) + if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1] + || key == gamecontrol[0][gc_console][2] || key == gamecontrol[0][gc_console][3]) { if (consdown) // ignore repeat return true; diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3b8f4f523..37bb6323b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6757,6 +6757,8 @@ void NetUpdate(void) I_unlock_mutex(k_menu_mutex); #endif CON_Ticker(); + + M_ScreenshotTicker(); } FileSendTicker(); diff --git a/src/d_main.c b/src/d_main.c index eaa58b055..c96ff0dc9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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)) diff --git a/src/g_input.c b/src/g_input.c index 5883cc36d..ecda7b3db 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -750,7 +750,8 @@ static const char *gamecontrolname[num_gamecontrols] = "teamtalk", "rankings", "screenshot", - "recordgif", + "startmovie", + "startlossless", }; #define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t)) @@ -889,20 +890,23 @@ void G_DefineDefaultControls(void) { // These defaults are less bad than they used to be. // Keyboard controls - gamecontroldefault[gc_up ][0] = KEY_UPARROW; - gamecontroldefault[gc_down ][0] = KEY_DOWNARROW; - gamecontroldefault[gc_left ][0] = KEY_LEFTARROW; - gamecontroldefault[gc_right ][0] = KEY_RIGHTARROW; - gamecontroldefault[gc_a ][0] = 'f'; - gamecontroldefault[gc_b ][0] = 'a'; - gamecontroldefault[gc_c ][0] = 'v'; - gamecontroldefault[gc_x ][0] = 's'; - gamecontroldefault[gc_y ][0] = 'x'; - gamecontroldefault[gc_z ][0] = 'c'; - gamecontroldefault[gc_l ][0] = KEY_SPACE; - gamecontroldefault[gc_r ][0] = 'd'; - gamecontroldefault[gc_start ][0] = KEY_ESCAPE; - gamecontroldefault[gc_rankings][0] = KEY_TAB; + gamecontroldefault[gc_up ][0] = KEY_UPARROW; + gamecontroldefault[gc_down ][0] = KEY_DOWNARROW; + gamecontroldefault[gc_left ][0] = KEY_LEFTARROW; + gamecontroldefault[gc_right ][0] = KEY_RIGHTARROW; + gamecontroldefault[gc_a ][0] = 'f'; + gamecontroldefault[gc_b ][0] = 'a'; + gamecontroldefault[gc_c ][0] = 'v'; + gamecontroldefault[gc_x ][0] = 's'; + gamecontroldefault[gc_y ][0] = 'x'; + gamecontroldefault[gc_z ][0] = 'c'; + gamecontroldefault[gc_l ][0] = KEY_SPACE; + gamecontroldefault[gc_r ][0] = 'd'; + gamecontroldefault[gc_start ][0] = KEY_ESCAPE; + gamecontroldefault[gc_rankings ][0] = KEY_TAB; + gamecontroldefault[gc_screenshot ][0] = KEY_F8; + gamecontroldefault[gc_startmovie ][0] = KEY_F9; + gamecontroldefault[gc_startlossless][0] = KEY_F10; // Gamepad controls gamecontroldefault[gc_up ][1] = KEY_HAT1+0; // D-Pad Up diff --git a/src/g_input.h b/src/g_input.h index bd52d6ca4..9441a7ef1 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -84,7 +84,8 @@ typedef enum gc_teamtalk, gc_rankings, gc_screenshot, - gc_recordgif, + gc_startmovie, + gc_startlossless, num_gamecontrols, diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 5a8069414..e5eb0aed9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1215,7 +1215,8 @@ boolean HU_Responder(event_t *ev) if (!chat_on) { // enter chat mode - if ((ev->data1 == gamecontrol[0][gc_talk][0] || ev->data1 == gamecontrol[0][gc_talk][1]) + if ((ev->data1 == gamecontrol[0][gc_talk][0] || ev->data1 == gamecontrol[0][gc_talk][1] + || ev->data1 == gamecontrol[0][gc_talk][2] || ev->data1 == gamecontrol[0][gc_talk][3]) && netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise. { chat_on = true; @@ -1225,7 +1226,8 @@ boolean HU_Responder(event_t *ev) typelines = 1; return true; } - if ((ev->data1 == gamecontrol[0][gc_teamtalk][0] || ev->data1 == gamecontrol[0][gc_teamtalk][1]) + if ((ev->data1 == gamecontrol[0][gc_teamtalk][0] || ev->data1 == gamecontrol[0][gc_teamtalk][1] + || ev->data1 == gamecontrol[0][gc_teamtalk][2] || ev->data1 == gamecontrol[0][gc_teamtalk][3]) && netgame && !OLD_MUTE) { chat_on = true; diff --git a/src/k_menu.h b/src/k_menu.h index fa4b1e8ed..5a343f0f7 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -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 diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 47da75d2e..7c798915a 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -754,10 +754,18 @@ void M_UpdateMenuCMD(UINT8 i) menucmd[i].buttonsHeld = menucmd[i].buttons; menucmd[i].buttons = 0; - if (G_PlayerInputDown(i, gc_up, mp)) { menucmd[i].dpad_ud--; } + if (G_PlayerInputDown(i, gc_screenshot, mp)) { menucmd[i].buttons |= MBT_SCREENSHOT; } + if (G_PlayerInputDown(i, gc_startmovie, mp)) { menucmd[i].buttons |= MBT_STARTMOVIE; } + if (G_PlayerInputDown(i, gc_startlossless, mp)) { menucmd[i].buttons |= MBT_STARTLOSSLESS; } + + // Screenshot et al take priority + if (menucmd[i].buttons != 0) + return; + + if (G_PlayerInputDown(i, gc_up, mp)) { menucmd[i].dpad_ud--; } if (G_PlayerInputDown(i, gc_down, mp)) { menucmd[i].dpad_ud++; } - if (G_PlayerInputDown(i, gc_left, mp)) { menucmd[i].dpad_lr--; } + if (G_PlayerInputDown(i, gc_left, mp)) { menucmd[i].dpad_lr--; } if (G_PlayerInputDown(i, gc_right, mp)) { menucmd[i].dpad_lr++; } if (G_PlayerInputDown(i, gc_a, mp)) { menucmd[i].buttons |= MBT_A; } @@ -768,6 +776,7 @@ void M_UpdateMenuCMD(UINT8 i) if (G_PlayerInputDown(i, gc_z, mp)) { menucmd[i].buttons |= MBT_Z; } if (G_PlayerInputDown(i, gc_l, mp)) { menucmd[i].buttons |= MBT_L; } if (G_PlayerInputDown(i, gc_r, mp)) { menucmd[i].buttons |= MBT_R; } + if (G_PlayerInputDown(i, gc_start, mp)) { menucmd[i].buttons |= MBT_START; } if (menucmd[i].dpad_ud == 0 && menucmd[i].dpad_lr == 0 && menucmd[i].buttons == 0) diff --git a/src/k_profiles.c b/src/k_profiles.c index d43253dfa..853306556 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -425,7 +425,9 @@ void PR_LoadProfiles(void) { #ifdef DEVELOP // Profile update 1-->2: Add gc_rankings. - if (j == gc_rankings && version < 2) + // Profile update 3-->5: Add gc_startlossless. + if ((j == gc_rankings && version < 2) || + (j == gc_startlossless && version < 5)) { for (k = 0; k < MAXINPUTMAPPING; k++) { diff --git a/src/k_profiles.h b/src/k_profiles.h index 06b880c42..2a866868f 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -31,7 +31,7 @@ extern "C" { #define SKINNAMESIZE 16 #define PROFILENAMELEN 6 -#define PROFILEVER 4 +#define PROFILEVER 5 #define MAXPROFILES 16 #define PROFILESFILE "ringprofiles.prf" #define PROFILE_GUEST 0 diff --git a/src/m_misc.cpp b/src/m_misc.cpp index c6f23a056..f5b1594ba 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -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(cv_lossless_recorder.value)); } - break; - - default: - return false; } - - return true; } void M_MinimapGenerate(void) diff --git a/src/m_misc.h b/src/m_misc.h index f11617612..b56f307a3 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -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); diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index f3dd23871..9fded87e0 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -53,11 +53,14 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_HEADER, "OPTIONAL CONTROLS", "Take a screenshot, chat...", NULL, {NULL}, 0, 0}, - {IT_CONTROL, "SCREENSHOT", "Also usable with F8 on Keyboard.", + {IT_CONTROL, "SCREENSHOT", "Take a high resolution screenshot.", NULL, {.routine = M_ProfileSetControl}, gc_screenshot, 0}, - {IT_CONTROL, "GIF CAPTURE", "Also usable with F9 on Keyboard.", - NULL, {.routine = M_ProfileSetControl}, gc_recordgif, 0}, + {IT_CONTROL, "RECORD VIDEO", "Record a video with sound.", + NULL, {.routine = M_ProfileSetControl}, gc_startmovie, 0}, + + {IT_CONTROL, "RECORD LOSSLESS", "Record a pixel perfect GIF.", + NULL, {.routine = M_ProfileSetControl}, gc_startlossless, 0}, {IT_CONTROL, "OPEN CHAT", "Opens chatbox in online games.", NULL, {.routine = M_ProfileSetControl}, gc_talk, 0}, @@ -313,6 +316,10 @@ void M_MapProfileControl(event_t *ev) INT32 controln = currentMenu->menuitems[itemOn].mvar1; // gc_ UINT8 where = n; // By default, we'll save the bind where we're supposed to map. INT32 i; + INT32 *DeviceGameKeyDownArray = G_GetDeviceGameKeyDownArray(ev->device); + + if (!DeviceGameKeyDownArray) + return; //SetDeviceOnPress(); // Update player gamepad assignments @@ -410,6 +417,10 @@ void M_MapProfileControl(event_t *ev) // Set menu delay regardless of what we're doing to avoid stupid stuff. M_SetMenuDelay(0); + // Reset this input so (keyboard keys at least) are not + // buffered and caught by menucmd. + DeviceGameKeyDownArray[c] = 0; + // Check if this particular key (c) is already bound in any slot. // If that's the case, simply do nothing. for (i = 0; i < MAXINPUTMAPPING; i++)