File: 43-autorun.patch

package info (click to toggle)
wolf4sdl 1.7%2Bsvn262%2Bdfsg1-4
  • links: PTS, VCS
  • area: contrib
  • in suites: stretch
  • size: 4,120 kB
  • ctags: 10,066
  • sloc: cpp: 34,696; ansic: 1,257; objc: 246; makefile: 161; sh: 44
file content (55 lines) | stat: -rw-r--r-- 1,350 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Subject: Toggle autorun when both Shift keys are pressed.
Author: Fabian Greffrath <fabian+debian@greffrath.com>

--- a/id_in.cpp
+++ b/id_in.cpp
@@ -238,6 +238,7 @@ boolean IN_JoyPresent()
 }
 
 boolean mw_dn = false, mw_up = false;
+boolean autorun = false;
 
 static void processEvent(SDL_Event *event)
 {
@@ -259,6 +260,19 @@ static void processEvent(SDL_Event *even
 
             LastScan = event->key.keysym.sym;
             SDLMod mod = SDL_GetModState();
+            if ((mod & KMOD_LSHIFT) && (mod & KMOD_RSHIFT))
+            {
+                autorun = !autorun;
+
+                if (autorun)
+                    Message ("Always Run: On");
+                else
+                    Message ("Always Run: Off");
+
+                IN_ClearKeysDown ();
+                IN_Ack ();
+            }
+
             if(Keyboard[sc_Alt])
             {
                 if(LastScan==SDLK_F4)
--- a/wl_play.cpp
+++ b/wl_play.cpp
@@ -255,10 +255,19 @@ int songs[] = {
 void PollKeyboardButtons (void)
 {
     int i;
+    extern boolean autorun;
 
     for (i = 0; i < NUMBUTTONS; i++)
         if (Keyboard[buttonscan[i]])
             buttonstate[i] = true;
+
+    if (autorun)
+    {
+        if (Keyboard[buttonscan[bt_run]])
+            buttonstate[bt_run] = false;
+        else
+            buttonstate[bt_run] = true;
+    }
 }