From cf5c0a7a6a6ffb2e533c086cc0cc40ee640a2369 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 27 Sep 2018 16:55:21 -0400 Subject: [PATCH] New bindable keys You can now remap Change Viewpoint, Screenshot, and Toggle GIF Recording to other keys, mainly for gamepads They also pushed me to my breaking point and I couldn't tolerate the control menu anymore, thanks to toaster for the scrolling backport --- src/g_game.c | 11 +- src/g_input.c | 10 +- src/g_input.h | 3 + src/hu_stuff.c | 8 +- src/m_menu.c | 413 ++++++++++++++++++++++++++----------------------- src/m_misc.c | 5 +- src/st_stuff.c | 9 +- 7 files changed, 251 insertions(+), 208 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7edd7725..42baee93 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -428,10 +428,10 @@ consvar_t cv_chatbacktint = {"chatbacktint", "Off", CV_SAVE, CV_OnOff, NULL, 0, static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair3 = {"crosshair3", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair4 = {"crosshair4", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair3 = {"crosshair3", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair4 = {"crosshair4", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook = {"alwaysmlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -1812,7 +1812,8 @@ static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0; boolean G_Responder(event_t *ev) { // allow spy mode changes even during the demo - if (gamestate == GS_LEVEL && ev->type == ev_keydown && ev->data1 == KEY_F12) + if (gamestate == GS_LEVEL && ev->type == ev_keydown + && (ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { if (splitscreen || !netgame) displayplayer = consoleplayer; diff --git a/src/g_input.c b/src/g_input.c index 279ee56b..101fa8e4 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1209,6 +1209,9 @@ static const char *gamecontrolname[num_gamecontrols] = "console", "pause", "systemmenu", + "screenshot", + "recordgif", + "viewpoint", "custom1", "custom2", "custom3", @@ -1293,6 +1296,9 @@ void G_Controldefault(void) // Extra controls gamecontrol[gc_pause ][0] = KEY_PAUSE; gamecontrol[gc_console ][0] = KEY_CONSOLE; + gamecontrol[gc_screenshot ][0] = KEY_F8; + gamecontrol[gc_recordgif ][0] = KEY_F9; + gamecontrol[gc_viewpoint ][0] = KEY_F12; gamecontrol[gc_talkkey ][0] = 't'; //gamecontrol[gc_teamkey ][0] = 'y'; gamecontrol[gc_scores ][0] = KEY_TAB; @@ -1303,11 +1309,11 @@ void G_Controldefault(void) gamecontrol[gc_camreset ][0] = KEY_HOME; gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; - //gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y + gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up - //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down + gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right diff --git a/src/g_input.h b/src/g_input.h index 6bbadf3e..3bdd9799 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -115,6 +115,9 @@ typedef enum gc_console, gc_pause, gc_systemmenu, + gc_screenshot, + gc_recordgif, + gc_viewpoint, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ab427b48..60b4e07f 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1695,7 +1695,7 @@ static void HU_DrawChat_Old(void) // // Crosshairs are pre-cached at HU_Init -static inline void HU_DrawCrosshair(void) +/*static inline void HU_DrawCrosshair(void) { INT32 i, x, y; @@ -1847,7 +1847,7 @@ static inline void HU_DrawCrosshair4(void) V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); } -} +}*/ static void HU_DrawCEcho(void) { @@ -2018,7 +2018,7 @@ void HU_Drawer(void) return; // draw the crosshair, not when viewing demos nor with chasecam - if (!automapactive && !demoplayback) + /*if (!automapactive && !demoplayback) { if (cv_crosshair.value && !camera.chase && !players[displayplayer].spectator) HU_DrawCrosshair(); @@ -2031,7 +2031,7 @@ void HU_Drawer(void) if (cv_crosshair4.value && !camera4.chase && !players[fourthdisplayplayer].spectator) HU_DrawCrosshair4(); - } + }*/ // draw desynch text if (hu_resynching) diff --git a/src/m_menu.c b/src/m_menu.c index 72773580..61d1fba9 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -288,8 +288,7 @@ static void M_SetupMultiPlayer4(INT32 choice); // Options // Split into multiple parts due to size // Controls -menu_t OP_ControlsDef, /*OP_ControlListDef,*/ OP_MoveControlsDef; -menu_t /*OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef,*/ OP_CustomControlsDef, OP_SpectateControlsDef; +menu_t OP_ControlsDef, OP_AllControlsDef; menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def; #ifndef NOFOURPLAYER @@ -1112,88 +1111,47 @@ static menuitem_t OP_ControlsMenu[] = #endif }; -static menuitem_t OP_MoveControlsMenu[] = +static menuitem_t OP_AllControlsMenu[] = { - {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, - {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, - {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, - {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, - {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, - {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, - {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, - {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, - {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, - - {IT_SPACE, NULL, "", NULL, 76}, - {IT_CONTROL, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - //{IT_CONTROL, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CONTROL, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu}, - {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CONTROL, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_SUBMENU | IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 120}, - {IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...", &OP_SpectateControlsDef, 128}, - {IT_SUBMENU | IT_STRING, NULL, "Custom Lua Actions...", &OP_CustomControlsDef, 136}, + {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, + //{IT_SPACE, NULL, NULL, NULL, 0}, + {IT_HEADER, NULL, "Gameplay Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, + {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, + {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, + {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, + {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, + {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, + {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, + {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, + {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, + {IT_HEADER, NULL, "Miscelleanous Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Chat", M_ChangeControl, gc_talkkey }, + //{IT_CONTROL, NULL, "Team Chat", M_ChangeControl, gc_teamkey }, + {IT_CONTROL, NULL, "Show Rankings", M_ChangeControl, gc_scores }, + {IT_CONTROL, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint }, + {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, + {IT_CONTROL, NULL, "Toggle First-Person", M_ChangeControl, gc_camtoggle }, + {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, + {IT_CONTROL, NULL, "Screenshot", M_ChangeControl, gc_screenshot }, + {IT_CONTROL, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, + {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, + {IT_CONTROL, NULL, "Developer Console", M_ChangeControl, gc_console }, + {IT_HEADER, NULL, "Spectator Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, + {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, + {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, + {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview }, + {IT_HEADER, NULL, "Custom Lua Actions", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, + {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, + {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, }; -static menuitem_t OP_SpectateControlsMenu[] = -{ - {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, - {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, - {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, - {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview}, - {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, - {IT_CONTROL, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle }, - - {IT_STRING | IT_CVAR, NULL, "Chasecam" , &cv_chasecam , 52}, - {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 60}, -}; - -static menuitem_t OP_CustomControlsMenu[] = -{ - {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1}, - {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2}, - {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3}, -}; - -// Obsolete thanks to Kart -/*static menuitem_t OP_MPControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Next Weapon", M_ChangeControl, gc_driftleft }, -// {IT_CALL | IT_STRING2, NULL, "Prev Weapon", M_ChangeControl, gc_driftright }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 1", M_ChangeControl, gc_wepslot1 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 2", M_ChangeControl, gc_wepslot2 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 3", M_ChangeControl, gc_wepslot3 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 4", M_ChangeControl, gc_wepslot4 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 5", M_ChangeControl, gc_wepslot5 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 6", M_ChangeControl, gc_wepslot6 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 7", M_ChangeControl, gc_wepslot7 }, -}; - -static menuitem_t OP_CameraControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup }, -// {IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown }, -// {IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview }, -// {IT_CALL | IT_STRING2, NULL, "Mouselook", M_ChangeControl, gc_mouseaiming }, -}; - -static menuitem_t OP_MiscControlsMenu[] = -{ - {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, - - {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CALL | IT_STRING2, NULL, "Spectate", M_ChangeControl, gc_spectate }, -};*/ - static menuitem_t OP_Joystick1Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10}, @@ -1950,28 +1908,12 @@ menu_t OP_MainDef = }; menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); -//menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); -menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDef); -//menu_t OP_MPControlsDef = CONTROLMENUSTYLE(OP_MPControlsMenu, &OP_ControlListDef); -//menu_t OP_CameraControlsDef = CONTROLMENUSTYLE(OP_CameraControlsMenu, &OP_ControlListDef); -//menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef); -menu_t OP_CustomControlsDef = CONTROLMENUSTYLE(OP_CustomControlsMenu, &OP_MoveControlsDef); -menu_t OP_SpectateControlsDef = CONTROLMENUSTYLE(OP_SpectateControlsMenu, &OP_MoveControlsDef); -/* -menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30); +menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); +menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); #ifndef NOFOURPLAYER -menu_t OP_P3ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P3ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P4ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P4ControlsMenu, &OP_ControlsDef, 60, 30); -#endif -menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 60, 30); -menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 60, 30); -*/ -menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_MoveControlsDef, 60, 30); -#ifndef NOFOURPLAYER -menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_MoveControlsDef, 60, 30); +menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 30); #endif menu_t OP_JoystickSetDef = { @@ -8468,19 +8410,28 @@ static void M_Setup1PControlsMenu(INT32 choice) setupcontrols = gamecontrol; // was called from main Options (for console player, then) currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick1Def; + // Unhide P1-only controls - OP_MoveControlsMenu[10].status = IT_CONTROL; // Talk - //OP_MoveControlsMenu[11].status = IT_CONTROL; // Team-talk - OP_MoveControlsMenu[11].status = IT_CONTROL; // Rankings - OP_MoveControlsMenu[12].status = IT_CONTROL; // Pause - OP_MoveControlsMenu[13].status = IT_CONTROL; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick1Def; // Gamepad + OP_AllControlsMenu[14].status = IT_CONTROL; // Chat + //OP_AllControlsMenu[15].status = IT_CONTROL; // Team-chat + OP_AllControlsMenu[15].status = IT_CONTROL; // Rankings + OP_AllControlsMenu[16].status = IT_CONTROL; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_CONTROL; // Pause + OP_AllControlsMenu[20].status = IT_CONTROL; // Screenshot + OP_AllControlsMenu[21].status = IT_CONTROL; // GIF + OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu + OP_AllControlsMenu[23].status = IT_CONTROL; // Console + OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate + OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up + OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down + OP_AllControlsMenu[29].status = IT_CONTROL; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup2PControlsMenu(INT32 choice) @@ -8491,19 +8442,28 @@ static void M_Setup2PControlsMenu(INT32 choice) setupcontrols = gamecontrolbis; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick2Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick2Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam2; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair2; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #ifndef NOFOURPLAYER @@ -8515,19 +8475,28 @@ static void M_Setup3PControlsMenu(INT32 choice) setupcontrols = gamecontrol3; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick3Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick3Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam3; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair3; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup4PControlsMenu(INT32 choice) @@ -8538,80 +8507,144 @@ static void M_Setup4PControlsMenu(INT32 choice) setupcontrols = gamecontrol4; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick4Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick4Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam4; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair4; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #endif +#define controlheight 18 + // Draws the Customise Controls menu static void M_DrawControl(void) { - char tmp[50]; - INT32 i, y; - INT32 keys[2]; - const char *ctrl; + char tmp[50]; + INT32 x, y, i, max, cursory = 0, iter; + INT32 keys[2]; - // draw title, strings and submenu - M_DrawGenericMenu(); + x = currentMenu->x; + y = currentMenu->y; - if (setupcontrols_secondaryplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""SECONDARY PLAYER"; - else if (setupcontrols_thirdplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""THIRD PLAYER"; - else if (setupcontrols_fourthplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""FOURTH PLAYER"; - else - ctrl = "\x86""PRESS ""\x82""ENTER""\x86"" TO CHANGE, ""\x82""BACKSPACE""\x86"" TO CLEAR"; + /*i = itemOn - (controlheight/2); + if (i < 0) + i = 0; + */ - M_CentreText(28, ctrl); + iter = (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + i--; - y = currentMenu->y; + iter += (controlheight/2); + for (max = itemOn; (iter && max < currentMenu->numitems); max++) + { + if (currentMenu->menuitems[max].status != IT_GRAYEDOUT2) + iter--; + } - for (i = 0; i < currentMenu->numitems;i++) - { - if (currentMenu->menuitems[i].status != IT_CONTROL) - { - y = currentMenu->y+currentMenu->menuitems[i].alphaKey; - continue; - } - if (currentMenu->menuitems[i].status != IT_CONTROL) - continue; + if (iter) + { + iter += (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) + { + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + } - keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; - keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + /*max = i + controlheight; + if (max > currentMenu->numitems) + { + max = currentMenu->numitems; + if (max < controlheight) + i = 0; + else + i = max - controlheight; + }*/ - tmp[0] ='\0'; - if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) - { - strcpy(tmp, "---"); - } - else - { - if (keys[0] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[0])); + // draw title (or big pic) + M_DrawMenuTitle(); - if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) - strcat(tmp," or "); + M_CentreText(30, + (setupcontrols_fourthplayer ? "Set controls for Player 4" : + (setupcontrols_thirdplayer ? "Set controls for Player 3" : + (setupcontrols_secondaryplayer ? "Set controls for Player 2" : + "Press ENTER to change, BACKSPACE to clear")))); - if (keys[1] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[1])); + if (i) + V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow + if (max != currentMenu->numitems) + V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow + + for (; i < max; i++) + { + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + continue; + + if (i == itemOn) + cursory = y; + + if (currentMenu->menuitems[i].status == IT_CONTROL) + { + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; + keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + + tmp[0] ='\0'; + if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) + { + strcpy(tmp, "---"); + } + else + { + if (keys[0] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[0])); + + if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) + strcat(tmp,", "); + + if (keys[1] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[1])); - } - V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); - y += SMALLLINEHEIGHT; - } + } + V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); + } + /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ + else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) + V_DrawString(19, y+6, highlightflags, currentMenu->menuitems[i].text); + else if (currentMenu->menuitems[i].status & IT_STRING) + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + + y += SMALLLINEHEIGHT; + } + + V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, + W_CachePatchName("M_CURSOR", PU_CACHE)); } static INT32 controltochange; diff --git a/src/m_misc.c b/src/m_misc.c index 766db72d..7b176fd9 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1480,9 +1480,10 @@ boolean M_ScreenshotResponder(event_t *ev) return false; ch = ev->data1; - if (ch == KEY_F8) + + if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 M_ScreenShot(); - else if (ch == KEY_F9) + else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 ((moviemode) ? M_StopMovie : M_StartMovie)(); else return false; diff --git a/src/st_stuff.c b/src/st_stuff.c index 72266ba2..45e0deb5 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1952,14 +1952,13 @@ static void ST_overlayDrawer(void) ) { // SRB2kart: changed positions & text - V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); if (stplyr->pflags & PF_WANTSTOJOIN) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); /*else if (G_GametypeHasTeams()) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ else - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Game")); - V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Game")); V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float")); V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink")); }