Rev 1658 | Rev 3116 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5 | Plagman | 1 | //------------------------------------------------------------------------- |
2 | /* |
||
3 | Copyright (C) 1996, 2003 - 3D Realms Entertainment |
||
4 | |||
5 | This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition |
||
6 | However, it is either an older version of a file that is, or is |
||
7 | some test code written during the development of Duke Nukem 3D. |
||
8 | This file is provided purely for educational interest. |
||
9 | |||
10 | Duke Nukem 3D is free software; you can redistribute it and/or |
||
11 | modify it under the terms of the GNU General Public License |
||
12 | as published by the Free Software Foundation; either version 2 |
||
13 | of the License, or (at your option) any later version. |
||
14 | |||
15 | This program is distributed in the hope that it will be useful, |
||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
18 | |||
19 | See the GNU General Public License for more details. |
||
20 | |||
21 | You should have received a copy of the GNU General Public License |
||
22 | along with this program; if not, write to the Free Software |
||
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
24 | |||
25 | Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms |
||
26 | */ |
||
27 | //------------------------------------------------------------------------- |
||
28 | |||
29 | //**************************************************************************** |
||
30 | // |
||
31 | // Private header for CONTROL.C |
||
32 | // |
||
33 | //**************************************************************************** |
||
34 | |||
35 | #ifndef _control_private |
||
36 | #define _control_private |
||
37 | #ifdef __cplusplus |
||
38 | extern "C" { |
||
39 | #endif |
||
40 | |||
1346 | terminx | 41 | |
5 | Plagman | 42 | //**************************************************************************** |
43 | // |
||
44 | // DEFINES |
||
45 | // |
||
46 | //**************************************************************************** |
||
47 | |||
48 | #define BUTTON0_SCAN_1 sc_Space |
||
49 | #define BUTTON0_SCAN_2 sc_Enter |
||
50 | #define BUTTON0_SCAN_3 sc_kpad_Enter |
||
51 | #define BUTTON1_SCAN sc_Escape |
||
52 | |||
53 | #define AXISUNDEFINED 0x7f |
||
54 | #define BUTTONUNDEFINED 0x7f |
||
55 | #define KEYUNDEFINED 0x7f |
||
56 | |||
57 | #define SENSITIVE 0x400 |
||
58 | //#define MINSENSITIVE 0x30 |
||
59 | |||
60 | #define THRESHOLD 0x200 |
||
61 | #define MINTHRESHOLD 0x80 |
||
62 | |||
63 | #define USERINPUTDELAY 200 |
||
64 | |||
65 | #define ResetMouse 0 |
||
66 | #define GetMouseButtons 3 |
||
67 | #define GetMouseDelta 11 |
||
68 | |||
69 | #define MouseInt 0x33 |
||
70 | #define JoyMax 0xa00 |
||
71 | #define MaxJoyValue 5000 |
||
72 | |||
1658 | terminx | 73 | #define DEFAULTMOUSESENSITIVITY 7 // 0x7000+MINIMUMMOUSESENSITIVITY |
127 | terminx | 74 | |
5 | Plagman | 75 | #define INSTANT_ONOFF 0 |
76 | #define TOGGLE_ONOFF 1 |
||
77 | |||
78 | #define MAXCONTROLVALUE 0x7fff |
||
79 | |||
80 | // Maximum number of buttons for any controller |
||
81 | #define MAXBUTTONS 32 |
||
82 | |||
83 | // Number of Mouse buttons |
||
84 | |||
1089 | terminx | 85 | #define MAXMOUSEBUTTONS 10 |
5 | Plagman | 86 | |
87 | // Number of Mouse Axes |
||
88 | |||
89 | #define MAXMOUSEAXES 2 |
||
90 | |||
91 | // Number of JOY buttons |
||
92 | |||
93 | #define MAXJOYBUTTONS 32 |
||
94 | |||
95 | // Number of JOY axes |
||
96 | |||
1552 | terminx | 97 | #define MAXJOYAXES 8 |
5 | Plagman | 98 | |
99 | // NORMAL axis scale |
||
100 | |||
101 | #define NORMALAXISSCALE (65536) |
||
102 | |||
1492 | terminx | 103 | #define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x)))) |
104 | #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x)))) |
||
5 | Plagman | 105 | |
1492 | terminx | 106 | #define BUTTONHELDSET(x,value) (CONTROL_ButtonHeldState |= (uint64_t)(value<<((uint64_t)(x)))) |
5 | Plagman | 107 | |
108 | #define LIMITCONTROL(x)\ |
||
109 | {\ |
||
110 | if ((*x)>MAXCONTROLVALUE) \ |
||
111 | {\ |
||
112 | (*x) = MAXCONTROLVALUE;\ |
||
113 | }\ |
||
114 | if ((*x)<-MAXCONTROLVALUE) \ |
||
115 | {\ |
||
116 | (*x) = -MAXCONTROLVALUE;\ |
||
117 | }\ |
||
118 | } |
||
119 | #define SGN(x) \ |
||
120 | ( ( (x) > 0 ) ? 1 : ( (x) < 0 ) ? -1 : 0 ) |
||
121 | |||
122 | //**************************************************************************** |
||
123 | // |
||
124 | // TYPEDEFS |
||
125 | // |
||
126 | //**************************************************************************** |
||
127 | |||
128 | typedef enum |
||
129 | { |
||
130 | motion_Left = -1, |
||
131 | motion_Up = -1, |
||
132 | motion_None = 0, |
||
133 | motion_Right = 1, |
||
134 | motion_Down = 1 |
||
135 | } motion; |
||
136 | |||
137 | |||
138 | typedef struct |
||
139 | { |
||
1346 | terminx | 140 | int32_t joyMinX; |
141 | int32_t joyMinY; |
||
142 | int32_t threshMinX; |
||
143 | int32_t threshMinY; |
||
144 | int32_t threshMaxX; |
||
145 | int32_t threshMaxY; |
||
146 | int32_t joyMaxX; |
||
147 | int32_t joyMaxY; |
||
148 | int32_t joyMultXL; |
||
149 | int32_t joyMultYL; |
||
150 | int32_t joyMultXH; |
||
151 | int32_t joyMultYH; |
||
5 | Plagman | 152 | } JoystickDef; |
153 | |||
1346 | terminx | 154 | // int32_t ThrottleMin; |
155 | // int32_t RudderMin; |
||
156 | // int32_t ThrottlethreshMin; |
||
157 | // int32_t RudderthreshMin; |
||
158 | // int32_t ThrottlethreshMax; |
||
159 | // int32_t RudderthreshMax; |
||
160 | // int32_t ThrottleMax; |
||
161 | // int32_t RudderMax; |
||
162 | // int32_t ThrottleMultL; |
||
163 | // int32_t RudderMultL; |
||
164 | // int32_t ThrottleMultH; |
||
165 | // int32_t RudderMultH; |
||
5 | Plagman | 166 | |
2940 | helixhorne | 167 | |
5 | Plagman | 168 | typedef struct |
169 | { |
||
1346 | terminx | 170 | uint8_t active ; |
171 | uint8_t used ; |
||
172 | uint8_t toggle ; |
||
173 | uint8_t buttonheld ; |
||
174 | int32_t cleared ; |
||
5 | Plagman | 175 | } controlflags; |
176 | |||
177 | typedef struct |
||
178 | { |
||
179 | kb_scancode key1; |
||
180 | kb_scancode key2; |
||
181 | } controlkeymaptype; |
||
182 | |||
183 | typedef struct |
||
184 | { |
||
1346 | terminx | 185 | uint8_t singleclicked; |
186 | uint8_t doubleclicked; |
||
187 | uint16_t extra; |
||
5 | Plagman | 188 | } controlbuttontype; |
189 | |||
190 | typedef struct |
||
191 | { |
||
1346 | terminx | 192 | uint8_t analogmap; |
193 | uint8_t minmap; |
||
194 | uint8_t maxmap; |
||
195 | uint8_t extra; |
||
5 | Plagman | 196 | } controlaxismaptype; |
197 | |||
198 | typedef struct |
||
199 | { |
||
1346 | terminx | 200 | int32_t analog; |
201 | int32_t digital; |
||
5 | Plagman | 202 | } controlaxistype; |
203 | |||
204 | |||
205 | //*************************************************************************** |
||
206 | // |
||
207 | // PROTOTYPES |
||
208 | // |
||
209 | //*************************************************************************** |
||
210 | |||
211 | void CONTROL_GetMouseDelta( void ); |
||
1346 | terminx | 212 | uint8_t CONTROL_GetMouseButtons( void ); |
213 | int32_t CONTROL_StartMouse( void ); |
||
2940 | helixhorne | 214 | //void CONTROL_GetJoyAbs( void ); |
5 | Plagman | 215 | void CONTROL_GetJoyDelta( void ); |
1346 | terminx | 216 | int32_t CONTROL_StartJoy( int32_t joy ); |
217 | void CONTROL_ShutJoy( int32_t joy ); |
||
218 | void CONTROL_SetFlag( int32_t which, int32_t active ); |
||
219 | void CONTROL_ButtonFunctionState( int32_t * state ); |
||
220 | int32_t CONTROL_KeyboardFunctionPressed( int32_t whichfunction ); |
||
221 | static inline int32_t CONTROL_CheckRange( int32_t which ); |
||
2940 | helixhorne | 222 | static int32_t CONTROL_GetTime( void ); |
1346 | terminx | 223 | void CONTROL_AxisFunctionState( int32_t * state ); |
5 | Plagman | 224 | void CONTROL_GetJoyMovement( ControlInfo * info ); |
225 | |||
226 | #ifdef __cplusplus |
||
227 | }; |
||
228 | #endif |
||
229 | #endif |