foxygit / doom Log in
commit a96f19fbc83f1b3d00af5a4b02e39e2830810d24
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Fri Mar 29 08:59:00 2019 -1000
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Fri Mar 29 08:59:00 2019 -1000

    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").
---
 src/setup/mouse.c          | 17 ++++++++---------
 src/setup/txt_mouseinput.c |  3 ++-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/setup/mouse.c b/src/setup/mouse.c
index e25cd990..2965bde1 100644
--- a/src/setup/mouse.c
+++ b/src/setup/mouse.c
@@ -90,23 +90,23 @@ static void ConfigExtraButtons(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
     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 @@ void ConfigMouse(TXT_UNCAST_ARG(widget), void *user_data)
                    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));
diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c
index 21f73072..f5a79cd0 100644
--- 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,