shithub: choc

Download patch

ref: 16447cf340d51ef54d6780a28ebe6192cf2d1537
parent: 2f38d73f55a8927ceca131e74874d1d544d11fac
author: Simon Howard <fraggle@gmail.com>
date: Wed Feb 7 07:58:53 EST 2007

Don't throw away keypress state when passing between levels - allows
shift to be held down for run when moving between levels. Thanks to Zack
Friedrich <zack18@comcast.net> for pointing this out.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 831

--- a/NEWS
+++ b/NEWS
@@ -107,6 +107,9 @@
        is possible to disable sound, as with Vanilla.
      * Repeat key presses when the key is held down (this is the Vanilla 
        behavior)  - thanks to Mad_Mac for pointing this out.
+     * Don't throw away key press state when starting a new level - allows
+       shift to be held down for run when moving between levels (thanks
+       to Zack Friedrich <zack18@comcast.net>.
      * Don't print a list of all arguments read from response files - Vanilla
        doesn't do this.
      * Autorun only when joyb_speed >= 10, not >= 4.  Thanks to Janizdreg 
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -195,41 +195,42 @@
  
 #define TURBOTHRESHOLD	0x32
 
-fixed_t		forwardmove[2] = {0x19, 0x32}; 
-fixed_t		sidemove[2] = {0x18, 0x28}; 
-fixed_t		angleturn[3] = {640, 1280, 320};	// + slow turn 
+fixed_t         forwardmove[2] = {0x19, 0x32}; 
+fixed_t         sidemove[2] = {0x18, 0x28}; 
+fixed_t         angleturn[3] = {640, 1280, 320};    // + slow turn 
 
 #define SLOWTURNTICS	6 
  
 #define NUMKEYS		256 
 
-boolean         gamekeydown[NUMKEYS]; 
-int             turnheld;				// for accelerative turning 
+static boolean  gamekeydown_initialised = false;
+static boolean  gamekeydown[NUMKEYS]; 
+static int      turnheld;		// for accelerative turning 
  
-boolean		mousearray[4]; 
-boolean*	mousebuttons = &mousearray[1];		// allow [-1]
+static boolean  mousearray[4]; 
+static boolean *mousebuttons = &mousearray[1];  // allow [-1]
 
 // mouse values are used once 
 int             mousex;
-int		mousey;         
+int             mousey;         
 
-int             dclicktime;
-boolean	        dclickstate;
-int		dclicks; 
-int             dclicktime2;
-boolean		dclickstate2;
-int		dclicks2;
+static int      dclicktime;
+static boolean  dclickstate;
+static int      dclicks; 
+static int      dclicktime2;
+static boolean  dclickstate2;
+static int      dclicks2;
 
 // joystick values are repeated 
-int             joyxmove;
-int		joyymove;
-boolean         joyarray[5]; 
-boolean*	joybuttons = &joyarray[1];		// allow [-1] 
+static int      joyxmove;
+static int      joyymove;
+static boolean  joyarray[5]; 
+static boolean *joybuttons = &joyarray[1];		// allow [-1] 
  
-int		savegameslot; 
-char		savedescription[32]; 
+static int      savegameslot; 
+static char     savedescription[32]; 
  
-int             testcontrols_mousespeed;
+static int      testcontrols_mousespeed;
  
 #define	BODYQUESIZE	32
 
@@ -643,7 +644,15 @@
     Z_CheckHeap ();
     
     // clear cmd building stuff
-    memset (gamekeydown, 0, sizeof(gamekeydown)); 
+
+    // Initialise gamekeydown when the first level is loaded
+  
+    if (!gamekeydown_initialised)
+    {
+        memset (gamekeydown, 0, sizeof(gamekeydown)); 
+        gamekeydown_initialised = true;
+    }
+
     joyxmove = joyymove = 0; 
     mousex = mousey = 0; 
     sendpause = sendsave = paused = false;