shithub: choc

Download patch

ref: 3213faa4e68c749a7660661fd4fcc204b13ee5a8
parent: 7bdfcdf0868f60f5b2034076df94625ea18eb8cf
author: Wintermute0110 <wintermute0110@gmail.com>
date: Mon Mar 20 19:44:42 EDT 2017

Simulate Y/N key press with joystick Fire/Use buttons in YES/NO dialogs.

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1396,6 +1396,8 @@
 	
     if (ev->type == ev_joystick && joywait < I_GetTime())
     {
+        // Simulate key presses from joyticks events to interact with the menu.
+
 	if (ev->data3 < 0)
 	{
 	    key = key_menu_up;
@@ -1432,6 +1434,20 @@
         {
             key = key_menu_activate;
 	    joywait = I_GetTime() + 5;
+        }
+
+        // Simulate a 'Y' keypress when Doom show a Y/N dialog with Fire button.
+        if (messageToPrint && messageNeedsInput && joybmenu >= 0 && ev->data1&1)
+        {
+            key = key_menu_confirm;
+            joywait = I_GetTime() + 5;
+        }
+
+        // Simulate a 'N' keypress when Doom show a Y/N dialog with Use button.
+        if (messageToPrint && messageNeedsInput && joybmenu >= 0 && ev->data1&2)
+        {
+            key = key_menu_abort;
+            joywait = I_GetTime() + 5;
         }
     }
     else