shithub: choc

Download patch

ref: 1901777acea62666bf6007b6ccce6f1f4cdb65dc
parent: a2fe8877266400976ef738e0ffc3d6ecfc8b1535
author: Simon Howard <fraggle@gmail.com>
date: Sun Oct 12 11:41:15 EDT 2008

Fix autorun hack for Hexen.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1355

--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -148,8 +148,10 @@
 int dclicktime, dclickstate, dclicks;
 int dclicktime2, dclickstate2, dclicks2;
 
+#define MAX_JOY_BUTTONS 20
+
 int joyxmove, joyymove;         // joystick values are repeated
-boolean joyarray[5];
+boolean joyarray[MAX_JOY_BUTTONS + 1];
 boolean *joybuttons = &joyarray[1];     // allow [-1]
 
 int savegameslot;
@@ -215,10 +217,17 @@
 
 //printf ("cons: %i\n",cmd->consistancy);
 
-    strafe = gamekeydown[key_strafe] || mousebuttons[mousebstrafe]
-        || joybuttons[joybstrafe];
-    speed = gamekeydown[key_speed] || joybuttons[joybspeed]
+    strafe = gamekeydown[key_strafe]
+          || mousebuttons[mousebstrafe]
+          || joybuttons[joybstrafe];
+
+    // Allow joybspeed hack.
+
+    speed = key_speed >= NUMKEYS
+        || joybspeed >= MAX_JOY_BUTTONS
+        || gamekeydown[key_speed]
         || joybuttons[joybspeed];
+
 #ifdef __WATCOMC__
     if (useexterndriver)
     {