shithub: choc

Download patch

ref: a96f19fbc83f1b3d00af5a4b02e39e2830810d24
parent: c714c4156e399e5a11c041f7b5334b334e5ea807
author: Simon Howard <fraggle@soulsphere.org>
date: Fri Mar 29 04:59:00 EDT 2019

setup: Rearrange mouse config dialog.

This previously showed the fire/use/move forward controls, which are
the original controls provided by Doom's setup.exe.

However, the reality is that nowadays most people play with the WASD&mouse
arrangement (or something similar) and are unlikely to be using the mouse
to move forwards. So it makes more sense if we reserve the main mouse
dialog for "action" buttons (fire/use) and move the "move forward" button
into the more buttons dialog. This also makes the more buttons dialog match
the arrangements for keyboard and gamepad controls.

As part of this, also tweak the mouse button minimum width so that it has a
consistent size that can describe high-numbered mouse buttons (eg.
"BUTTON #10").

--- a/src/setup/mouse.c
+++ b/src/setup/mouse.c
@@ -90,23 +90,23 @@
     TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
 
     TXT_AddWidgets(window,
-                   buttons_table = TXT_NewTable(2),
+                   buttons_table = TXT_NewTable(4),
                    NULL);
 
-    TXT_SetColumnWidths(buttons_table, 24, 5);
+    TXT_SetColumnWidths(buttons_table, 16, 11, 14, 10);
 
-    AddMouseControl(buttons_table, "Move backward", &mousebbackward);
-    AddMouseControl(buttons_table, "Use", &mousebuse);
+    AddMouseControl(buttons_table, "Move forward", &mousebforward);
     AddMouseControl(buttons_table, "Strafe left", &mousebstrafeleft);
+    AddMouseControl(buttons_table, "Move backward", &mousebbackward);
     AddMouseControl(buttons_table, "Strafe right", &mousebstraferight);
+    AddMouseControl(buttons_table, "Previous weapon", &mousebprevweapon);
+    AddMouseControl(buttons_table, "Strafe on", &mousebstrafe);
+    AddMouseControl(buttons_table, "Next weapon", &mousebnextweapon);
 
     if (gamemission == hexen || gamemission == strife)
     {
         AddMouseControl(buttons_table, "Jump", &mousebjump);
     }
-
-    AddMouseControl(buttons_table, "Previous weapon", &mousebprevweapon);
-    AddMouseControl(buttons_table, "Next weapon", &mousebnextweapon);
 }
 
 void ConfigMouse(TXT_UNCAST_ARG(widget), void *user_data)
@@ -145,8 +145,7 @@
                    NULL);
 
     AddMouseControl(window, "Fire/Attack", &mousebfire);
-    AddMouseControl(window, "Move forward", &mousebforward);
-    AddMouseControl(window, "Strafe on", &mousebstrafe);
+    AddMouseControl(window, "Use", &mousebuse);
 
     TXT_AddWidget(window,
                   TXT_NewButton2("More controls...", ConfigExtraButtons, NULL));
--- a/src/setup/txt_mouseinput.c
+++ b/src/setup/txt_mouseinput.c
@@ -26,7 +26,8 @@
 #include "txt_utf8.h"
 #include "txt_window.h"
 
-#define MOUSE_INPUT_WIDTH 8
+// eg. "BUTTON #10"
+#define MOUSE_INPUT_WIDTH 10
 
 static int MousePressCallback(txt_window_t *window, 
                               int x, int y, int b,