From 8e190932e7c346aba4e585b97a3ad6fbc6785b41 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 11:21:25 -0500 Subject: [PATCH 1/9] Add gc_systemmenu from Kart --- src/g_input.c | 1 + src/g_input.h | 1 + src/m_menu.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/g_input.c b/src/g_input.c index 1ddfae81..864cee38 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1190,6 +1190,7 @@ void G_Controldefault(void) gamecontrol[gc_jump ][0] = KEY_SPACE; gamecontrol[gc_console ][0] = KEY_CONSOLE; gamecontrol[gc_pause ][0] = 'p'; + gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start #ifdef WMINPUT gamecontrol[gc_forward ][0] = KEY_JOY1+02; //UP gamecontrol[gc_backward ][0] = KEY_JOY1+03; //DOWN diff --git a/src/g_input.h b/src/g_input.h index 6dc99ac5..18fd6ac2 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -118,6 +118,7 @@ typedef enum gc_jump, gc_console, gc_pause, + gc_systemmenu, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/m_menu.c b/src/m_menu.c index 636e804f..8f20c69f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1073,6 +1073,7 @@ static menuitem_t OP_MiscControlsMenu[] = {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, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, }; @@ -2172,6 +2173,8 @@ boolean M_Responder(event_t *ev) if (ch == -1) return false; + else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key + ch = KEY_ESCAPE; // F-Keys if (!menuactive) From 2a87093ecedf210c30adde9d9854b362e5588d32 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 11:31:48 -0500 Subject: [PATCH 2/9] Add gc_screenshot and gc_recordgif from Kart --- src/g_input.c | 2 ++ src/g_input.h | 2 ++ src/m_menu.c | 2 ++ src/m_misc.c | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 864cee38..1884f38b 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1190,6 +1190,8 @@ void G_Controldefault(void) gamecontrol[gc_jump ][0] = KEY_SPACE; gamecontrol[gc_console ][0] = KEY_CONSOLE; gamecontrol[gc_pause ][0] = 'p'; + gamecontrol[gc_screenshot ][0] = KEY_F8; + gamecontrol[gc_recordgif ][0] = KEY_F9; gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start #ifdef WMINPUT gamecontrol[gc_forward ][0] = KEY_JOY1+02; //UP diff --git a/src/g_input.h b/src/g_input.h index 18fd6ac2..d618b0da 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -119,6 +119,8 @@ typedef enum gc_console, gc_pause, gc_systemmenu, + gc_screenshot, + gc_recordgif, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/m_menu.c b/src/m_menu.c index 8f20c69f..2b88f6c5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1073,6 +1073,8 @@ static menuitem_t OP_MiscControlsMenu[] = {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, "Screenshot", M_ChangeControl, gc_screenshot }, + {IT_CALL | IT_STRING2, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, {IT_CALL | IT_STRING2, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, }; diff --git a/src/m_misc.c b/src/m_misc.c index cd87c984..223a652d 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1494,9 +1494,9 @@ 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; From 31f23fda8dee9582617567c37f750f2f3e247334 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 11:50:57 -0500 Subject: [PATCH 3/9] Add gc_viewpoint from Kart --- src/g_game.c | 3 ++- src/g_input.c | 1 + src/g_input.h | 1 + src/m_menu.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index b1a3720e..f313b4d5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1677,7 +1677,8 @@ static INT32 camtoggledelay, camtoggledelay2 = 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 1884f38b..489806d8 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1192,6 +1192,7 @@ void G_Controldefault(void) gamecontrol[gc_pause ][0] = 'p'; gamecontrol[gc_screenshot ][0] = KEY_F8; gamecontrol[gc_recordgif ][0] = KEY_F9; + gamecontrol[gc_viewpoint ][0] = KEY_F12; gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start #ifdef WMINPUT gamecontrol[gc_forward ][0] = KEY_JOY1+02; //UP diff --git a/src/g_input.h b/src/g_input.h index d618b0da..557fb3bf 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -121,6 +121,7 @@ typedef enum gc_systemmenu, gc_screenshot, gc_recordgif, + gc_viewpoint, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/m_menu.c b/src/m_menu.c index 2b88f6c5..381029a0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1076,6 +1076,7 @@ static menuitem_t OP_MiscControlsMenu[] = {IT_CALL | IT_STRING2, NULL, "Screenshot", M_ChangeControl, gc_screenshot }, {IT_CALL | IT_STRING2, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, {IT_CALL | IT_STRING2, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, + {IT_CALL | IT_STRING2, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint }, {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, }; From 60b16289e5be95212c6c4723b0d3a7c15956158d Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 12:11:03 -0500 Subject: [PATCH 4/9] Change spectator string for "Press F12 to watch" --- src/locale/en.po | 2 +- src/locale/srb2.pot | 2 +- src/st_stuff.c | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/locale/en.po b/src/locale/en.po index 2665082a..517ad488 100644 --- a/src/locale/en.po +++ b/src/locale/en.po @@ -3629,7 +3629,7 @@ msgid "another castle!" msgstr "" #: st_stuff.c:2328 st_stuff.c:2334 st_stuff.c:2356 -msgid "Press F12 to watch another player." +msgid "Press Viewpoint to watch another player." msgstr "" #: st_stuff.c:2333 diff --git a/src/locale/srb2.pot b/src/locale/srb2.pot index 37d14f8b..46c13cc2 100644 --- a/src/locale/srb2.pot +++ b/src/locale/srb2.pot @@ -3820,7 +3820,7 @@ msgid "another castle!" msgstr "" #: st_stuff.c:2092 st_stuff.c:2098 st_stuff.c:2120 -msgid "Press F12 to watch another player." +msgid "Press Viewpoint to watch another player." msgstr "" #: st_stuff.c:2097 diff --git a/src/st_stuff.c b/src/st_stuff.c index f2e62fed..15ff8d64 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -28,6 +28,7 @@ #include "m_menu.h" #include "m_cheat.h" #include "p_setup.h" // NiGHTS grading +#include "g_input.h" // Viewpoint string //random index #include "m_random.h" @@ -1870,13 +1871,23 @@ static void ST_overlayDrawer(void) if (!hu_showscores && !splitscreen && netgame && displayplayer == consoleplayer) { + // Build the control string for viewpoint switching + // Longest control string goes to WII's DBLSEC_JOYMINUS_CC, at 18 chars + char secondcontrol[4+20]; + char viewpointprompt[32+20]; + if (gamecontrol[gc_viewpoint][1]) + snprintf(secondcontrol, 3+20, " or %s", G_KeynumToString(gamecontrol[gc_viewpoint][1])); + else + secondcontrol[0] = 0; + snprintf(viewpointprompt, 32+20, "Press %s%s to watch another player.", G_KeynumToString(gamecontrol[gc_viewpoint][0]), secondcontrol); + if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1) - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player.")); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText(viewpointprompt)); else if (gametype == GT_HIDEANDSEEK && (!stplyr->spectator && !(stplyr->pflags & PF_TAGIT)) && (leveltime > hidetime * TICRATE)) { V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(116), 0, M_GetText("You cannot move while hiding.")); - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player.")); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText(viewpointprompt)); } else if (!G_PlatformGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) //Death overrides spectator text. { @@ -1899,7 +1910,7 @@ static void ST_overlayDrawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("You cannot join the game until the stage has ended.")); else V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to enter the game.")); - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText("Press F12 to watch another player.")); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText(viewpointprompt)); V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(164), V_HUDTRANSHALF, M_GetText("Press Jump to float and Spin to sink.")); } } From 5314c0e36b02e8d774b76eb7f874d699380743de Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 12:12:25 -0500 Subject: [PATCH 5/9] Make F12 spectator string constant because of wrapping issues --- src/st_stuff.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 15ff8d64..44b1ebba 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1871,23 +1871,13 @@ static void ST_overlayDrawer(void) if (!hu_showscores && !splitscreen && netgame && displayplayer == consoleplayer) { - // Build the control string for viewpoint switching - // Longest control string goes to WII's DBLSEC_JOYMINUS_CC, at 18 chars - char secondcontrol[4+20]; - char viewpointprompt[32+20]; - if (gamecontrol[gc_viewpoint][1]) - snprintf(secondcontrol, 3+20, " or %s", G_KeynumToString(gamecontrol[gc_viewpoint][1])); - else - secondcontrol[0] = 0; - snprintf(viewpointprompt, 32+20, "Press %s%s to watch another player.", G_KeynumToString(gamecontrol[gc_viewpoint][0]), secondcontrol); - if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1) - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText(viewpointprompt)); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press Viewpoint Key to watch a player.")); else if (gametype == GT_HIDEANDSEEK && (!stplyr->spectator && !(stplyr->pflags & PF_TAGIT)) && (leveltime > hidetime * TICRATE)) { V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(116), 0, M_GetText("You cannot move while hiding.")); - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText(viewpointprompt)); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press Viewpoint Key to watch a player.")); } else if (!G_PlatformGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) //Death overrides spectator text. { @@ -1910,7 +1900,7 @@ static void ST_overlayDrawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("You cannot join the game until the stage has ended.")); else V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to enter the game.")); - V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText(viewpointprompt)); + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText("Press Viewpoint Key to watch a player.")); V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(164), V_HUDTRANSHALF, M_GetText("Press Jump to float and Spin to sink.")); } } From 3d8bc8549497977ad3104b570119c635b4a457f7 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 12:19:41 -0500 Subject: [PATCH 6/9] Forgot config strings for menu keys --- src/g_input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_input.c b/src/g_input.c index 489806d8..44d9f2b2 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -990,6 +990,10 @@ static const char *gamecontrolname[num_gamecontrols] = "jump", "console", "pause", + "systemmenu", + "screenshot", + "recordgif", + "viewpoint", "custom1", "custom2", "custom3", From 6c78af354294948503f3e2f45aa86dd1818953f2 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 12:20:19 -0500 Subject: [PATCH 7/9] Missed (unused?) viewpoint strings --- src/locale/en.po | 2 +- src/locale/srb2.pot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locale/en.po b/src/locale/en.po index 517ad488..ce451080 100644 --- a/src/locale/en.po +++ b/src/locale/en.po @@ -3629,7 +3629,7 @@ msgid "another castle!" msgstr "" #: st_stuff.c:2328 st_stuff.c:2334 st_stuff.c:2356 -msgid "Press Viewpoint to watch another player." +msgid "Press Viewpoint Key to watch a player." msgstr "" #: st_stuff.c:2333 diff --git a/src/locale/srb2.pot b/src/locale/srb2.pot index 46c13cc2..c61cbcc9 100644 --- a/src/locale/srb2.pot +++ b/src/locale/srb2.pot @@ -3820,7 +3820,7 @@ msgid "another castle!" msgstr "" #: st_stuff.c:2092 st_stuff.c:2098 st_stuff.c:2120 -msgid "Press Viewpoint to watch another player." +msgid "Press Viewpoint Key to watch a player." msgstr "" #: st_stuff.c:2097 From 06faf6ffe49d7be296ef9203381e7b342523f570 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 12:36:42 -0500 Subject: [PATCH 8/9] Unneeded input header in st_stuff --- src/st_stuff.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 44b1ebba..1f8dbbf6 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -28,7 +28,6 @@ #include "m_menu.h" #include "m_cheat.h" #include "p_setup.h" // NiGHTS grading -#include "g_input.h" // Viewpoint string //random index #include "m_random.h" From 6ca1130551ab765abaf9566998cc5963e4a24023 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 3 Dec 2018 13:21:16 -0500 Subject: [PATCH 9/9] Hardcode Screenshot, GIF, and Viewpoint to their F keys --- src/g_game.c | 2 +- src/m_misc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index f313b4d5..1c6059f6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1678,7 +1678,7 @@ boolean G_Responder(event_t *ev) { // allow spy mode changes even during the demo if (gamestate == GS_LEVEL && ev->type == ev_keydown - && (ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) + && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { if (splitscreen || !netgame) displayplayer = consoleplayer; diff --git a/src/m_misc.c b/src/m_misc.c index 223a652d..f8014104 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1494,9 +1494,9 @@ boolean M_ScreenshotResponder(event_t *ev) return false; ch = ev->data1; - if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 + if (ch == KEY_F8 || ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 M_ScreenShot(); - else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 + else if (ch == KEY_F9 || ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 ((moviemode) ? M_StopMovie : M_StartMovie)(); else return false;