shithub: choc

Download patch

ref: 98e31e07cff79b30ec5631373dc0b16ece02f1cf
parent: c6a63b6286567001f80a5366648ea88265abb2ce
author: Wintermute0110 <wintermute0110@gmail.com>
date: Mon Mar 20 21:01:15 EDT 2017

Create a savegame name by pressing Fire with joystick.

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1454,6 +1454,23 @@
             key = key_menu_activate;
             joywait = I_GetTime() + 5;
         }
+
+        // Fill-in the savegame name if user press Fire on the joystick
+        if (saveStringEnter && joybmenu >= 0 && ev->data1&1)
+        {
+            // Create a savegame string
+            char savestring[SAVESTRINGSIZE];
+
+            memset(savestring, 0, SAVESTRINGSIZE);
+            M_snprintf(savestring, SAVESTRINGSIZE - 1, "JOYSTICK SLOT %i", saveSlot);
+            saveCharIndex = strlen(savestring);
+            memcpy(savegamestrings[saveSlot], savestring, SAVESTRINGSIZE);
+
+            // Simulate a KEY_ENTER press. Wait a log time to generate another
+            // keypress.
+            key = KEY_ENTER;
+            joywait = I_GetTime() + 15;
+        }
     }
     else
     {