summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/wolf3d/id_in.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2019-07-07 22:00:20 -0400
committerFranklin Wei <git@fwei.tk>2019-07-09 11:20:55 -0400
commit3f59fc8b771625aca9c3aefe03cf1038d8461963 (patch)
treee0623a323613baa0b0993411b38bcaed144b27ed /apps/plugins/sdl/progs/wolf3d/id_in.h
parent439a0d1d91fa040d261fc39b87278bc9f5391dcc (diff)
downloadrockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.tar.gz
rockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.zip
Wolfenstein 3-D!
This is a port of Wolf4SDL, which is derived from the original id software source release. The port runs on top of the SDL plugin runtime and is loaded as an overlay. Licensing of the game code is not an issue, as discussed below (essentially, the Debian project treats Wolf4SDL as GPLv2, with an email from John Carmack backing it up): http://forums.rockbox.org/index.php?topic=52872 Included is a copy of MAME's Yamaha OPL sound chip emulator (fmopl_gpl.c). This file was not part of the original Wolf4SDL source (which includes a non-GPL'd version), but was rather rebased from from a later MAME source which had been relicensed to GPLv2. Change-Id: I64c2ba035e0be7e2f49252f40640641416613439
Diffstat (limited to 'apps/plugins/sdl/progs/wolf3d/id_in.h')
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_in.h183
1 files changed, 183 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/wolf3d/id_in.h b/apps/plugins/sdl/progs/wolf3d/id_in.h
new file mode 100644
index 0000000000..90e0c05109
--- /dev/null
+++ b/apps/plugins/sdl/progs/wolf3d/id_in.h
@@ -0,0 +1,183 @@
1//
2// ID Engine
3// ID_IN.h - Header file for Input Manager
4// v1.0d1
5// By Jason Blochowiak
6//
7
8#ifndef __ID_IN__
9#define __ID_IN__
10
11#ifdef __DEBUG__
12#define __DEBUG_InputMgr__
13#endif
14
15typedef int ScanCode;
16#define sc_None 0
17#define sc_Bad 0xff
18#define sc_Return SDLK_RETURN
19#define sc_Enter sc_Return
20#define sc_Escape SDLK_ESCAPE
21#define sc_Space SDLK_SPACE
22#define sc_BackSpace SDLK_BACKSPACE
23#define sc_Tab SDLK_TAB
24#define sc_Alt SDLK_LALT
25#define sc_Control SDLK_LCTRL
26#define sc_CapsLock SDLK_CAPSLOCK
27#define sc_LShift SDLK_LSHIFT
28#define sc_RShift SDLK_RSHIFT
29#define sc_UpArrow SDLK_UP
30#define sc_DownArrow SDLK_DOWN
31#define sc_LeftArrow SDLK_LEFT
32#define sc_RightArrow SDLK_RIGHT
33#define sc_Insert SDLK_INSERT
34#define sc_Delete SDLK_DELETE
35#define sc_Home SDLK_HOME
36#define sc_End SDLK_END
37#define sc_PgUp SDLK_PAGEUP
38#define sc_PgDn SDLK_PAGEDOWN
39#define sc_F1 SDLK_F1
40#define sc_F2 SDLK_F2
41#define sc_F3 SDLK_F3
42#define sc_F4 SDLK_F4
43#define sc_F5 SDLK_F5
44#define sc_F6 SDLK_F6
45#define sc_F7 SDLK_F7
46#define sc_F8 SDLK_F8
47#define sc_F9 SDLK_F9
48#define sc_F10 SDLK_F10
49#define sc_F11 SDLK_F11
50#define sc_F12 SDLK_F12
51
52#define sc_ScrollLock SDLK_SCROLLOCK
53#define sc_PrintScreen SDLK_PRINT
54
55#define sc_1 SDLK_1
56#define sc_2 SDLK_2
57#define sc_3 SDLK_3
58#define sc_4 SDLK_4
59#define sc_5 SDLK_5
60#define sc_6 SDLK_6
61#define sc_7 SDLK_7
62#define sc_8 SDLK_8
63#define sc_9 SDLK_9
64#define sc_0 SDLK_0
65
66#define sc_A SDLK_a
67#define sc_B SDLK_b
68#define sc_C SDLK_c
69#define sc_D SDLK_d
70#define sc_E SDLK_e
71#define sc_F SDLK_f
72#define sc_G SDLK_g
73#define sc_H SDLK_h
74#define sc_I SDLK_i
75#define sc_J SDLK_j
76#define sc_K SDLK_k
77#define sc_L SDLK_l
78#define sc_M SDLK_m
79#define sc_N SDLK_n
80#define sc_O SDLK_o
81#define sc_P SDLK_p
82#define sc_Q SDLK_q
83#define sc_R SDLK_r
84#define sc_S SDLK_s
85#define sc_T SDLK_t
86#define sc_U SDLK_u
87#define sc_V SDLK_v
88#define sc_W SDLK_w
89#define sc_X SDLK_x
90#define sc_Y SDLK_y
91#define sc_Z SDLK_z
92
93#define key_None 0
94
95typedef enum {
96 demo_Off,demo_Record,demo_Playback,demo_PlayDone
97 } Demo;
98typedef enum {
99 ctrl_Keyboard,
100 ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
101 ctrl_Joystick,
102 ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
103 ctrl_Mouse
104 } ControlType;
105typedef enum {
106 motion_Left = -1,motion_Up = -1,
107 motion_None = 0,
108 motion_Right = 1,motion_Down = 1
109 } Motion;
110typedef enum {
111 dir_North,dir_NorthEast,
112 dir_East,dir_SouthEast,
113 dir_South,dir_SouthWest,
114 dir_West,dir_NorthWest,
115 dir_None
116 } Direction;
117typedef struct {
118 boolean button0,button1,button2,button3;
119 short x,y;
120 Motion xaxis,yaxis;
121 Direction dir;
122 } CursorInfo;
123typedef CursorInfo ControlInfo;
124typedef struct {
125 ScanCode button0,button1,
126 upleft, up, upright,
127 left, right,
128 downleft, down, downright;
129 } KeyboardDef;
130typedef struct {
131 word joyMinX,joyMinY,
132 threshMinX,threshMinY,
133 threshMaxX,threshMaxY,
134 joyMaxX,joyMaxY,
135 joyMultXL,joyMultYL,
136 joyMultXH,joyMultYH;
137 } JoystickDef;
138// Global variables
139extern volatile boolean Keyboard[];
140extern boolean MousePresent;
141extern volatile boolean Paused;
142extern volatile char LastASCII;
143extern volatile ScanCode LastScan;
144extern int JoyNumButtons;
145extern boolean forcegrabmouse;
146
147
148// Function prototypes
149#define IN_KeyDown(code) (Keyboard[(code)])
150#define IN_ClearKey(code) {Keyboard[code] = false;\
151 if (code == LastScan) LastScan = sc_None;}
152
153// DEBUG - put names in prototypes
154extern void IN_Startup(void),IN_Shutdown(void);
155extern void IN_ClearKeysDown(void);
156extern void IN_ReadControl(int,ControlInfo *);
157extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
158extern void IN_SetupJoy(word joy,word minx,word maxx,
159 word miny,word maxy);
160extern void IN_StopDemo(void),IN_FreeDemoBuffer(void),
161 IN_Ack(void);
162extern boolean IN_UserInput(longword delay);
163extern char IN_WaitForASCII(void);
164extern ScanCode IN_WaitForKey(void);
165extern word IN_GetJoyButtonsDB(word joy);
166extern const char *IN_GetScanName(ScanCode);
167
168void IN_WaitAndProcessEvents();
169void IN_ProcessEvents();
170
171int IN_MouseButtons (void);
172
173boolean IN_JoyPresent();
174void IN_SetJoyCurrent(int joyIndex);
175int IN_JoyButtons (void);
176void IN_GetJoyDelta(int *dx,int *dy);
177void IN_GetJoyFineDelta(int *dx, int *dy);
178
179void IN_StartAck(void);
180boolean IN_CheckAck (void);
181bool IN_IsInputGrabbed();
182void IN_CenterMouse();
183#endif