Rev 6056 | Rev 7216 | 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 |
||
5768 | hendricks2 | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
5 | Plagman | 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 |
||
4541 | hendricks2 | 23 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
5 | Plagman | 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 | |||
5662 | terminx | 35 | #pragma once |
36 | |||
4747 | terminx | 37 | #ifndef control_private_h_ |
38 | #define control_private_h_ |
||
4766 | hendricks2 | 39 | #ifdef __cplusplus |
40 | extern "C" { |
||
5 | Plagman | 41 | #endif |
42 | |||
1346 | terminx | 43 | |
5 | Plagman | 44 | //**************************************************************************** |
45 | // |
||
46 | // DEFINES |
||
47 | // |
||
48 | //**************************************************************************** |
||
49 | |||
50 | #define AXISUNDEFINED 0x7f |
||
51 | #define BUTTONUNDEFINED 0x7f |
||
52 | #define KEYUNDEFINED 0x7f |
||
53 | |||
54 | #define THRESHOLD 0x200 |
||
55 | #define MINTHRESHOLD 0x80 |
||
56 | |||
7123 | terminx | 57 | #define DEFAULTMOUSESENSITIVITY 4 // 0x7000+MINIMUMMOUSESENSITIVITY |
127 | terminx | 58 | |
5 | Plagman | 59 | #define INSTANT_ONOFF 0 |
60 | #define TOGGLE_ONOFF 1 |
||
61 | |||
62 | #define MAXCONTROLVALUE 0x7fff |
||
63 | |||
64 | // Number of Mouse buttons |
||
65 | |||
3527 | helixhorne | 66 | //#define MAXMOUSEBUTTONS 10 |
5 | Plagman | 67 | |
68 | // Number of Mouse Axes |
||
6056 | hendricks2 | 69 | // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp |
5 | Plagman | 70 | #define MAXMOUSEAXES 2 |
4826 | hendricks2 | 71 | #define MAXMOUSEDIGITAL (MAXMOUSEAXES*2) |
5 | Plagman | 72 | |
73 | // Number of JOY buttons |
||
6056 | hendricks2 | 74 | // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp |
5 | Plagman | 75 | #define MAXJOYBUTTONS 32 |
4826 | hendricks2 | 76 | #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) |
5 | Plagman | 77 | |
78 | // Number of JOY axes |
||
6056 | hendricks2 | 79 | // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp |
4827 | hendricks2 | 80 | #define MAXJOYAXES 9 |
4826 | hendricks2 | 81 | #define MAXJOYDIGITAL (MAXJOYAXES*2) |
5 | Plagman | 82 | |
83 | // NORMAL axis scale |
||
3527 | helixhorne | 84 | #define NORMALAXISSCALE 65536 |
5 | Plagman | 85 | |
4747 | terminx | 86 | #define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x)))) |
87 | #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x)))) |
||
5 | Plagman | 88 | |
4747 | terminx | 89 | #define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x)))) |
5 | Plagman | 90 | |
4747 | terminx | 91 | #define LIMITCONTROL(x) \ |
92 | { \ |
||
93 | if ((*x) > MAXCONTROLVALUE) \ |
||
94 | { \ |
||
95 | (*x) = MAXCONTROLVALUE; \ |
||
96 | } \ |
||
97 | if ((*x) < -MAXCONTROLVALUE) \ |
||
98 | { \ |
||
99 | (*x) = -MAXCONTROLVALUE; \ |
||
100 | } \ |
||
5 | Plagman | 101 | } |
4747 | terminx | 102 | #define SGN(x) (((x) > 0) ? 1 : ((x) < 0) ? -1 : 0) |
5 | Plagman | 103 | |
104 | //**************************************************************************** |
||
105 | // |
||
106 | // TYPEDEFS |
||
107 | // |
||
108 | //**************************************************************************** |
||
109 | |||
110 | typedef enum |
||
4747 | terminx | 111 | { |
112 | motion_Left = -1, |
||
113 | motion_Up = -1, |
||
114 | motion_None = 0, |
||
115 | motion_Right = 1, |
||
116 | motion_Down = 1 |
||
117 | } motion; |
||
5 | Plagman | 118 | |
119 | |||
120 | typedef struct |
||
4747 | terminx | 121 | { |
122 | int32_t joyMinX; |
||
123 | int32_t joyMinY; |
||
124 | int32_t threshMinX; |
||
125 | int32_t threshMinY; |
||
126 | int32_t threshMaxX; |
||
127 | int32_t threshMaxY; |
||
128 | int32_t joyMaxX; |
||
129 | int32_t joyMaxY; |
||
130 | int32_t joyMultXL; |
||
131 | int32_t joyMultYL; |
||
132 | int32_t joyMultXH; |
||
133 | int32_t joyMultYH; |
||
134 | } JoystickDef; |
||
5 | Plagman | 135 | |
1346 | terminx | 136 | // int32_t ThrottleMin; |
137 | // int32_t RudderMin; |
||
138 | // int32_t ThrottlethreshMin; |
||
139 | // int32_t RudderthreshMin; |
||
140 | // int32_t ThrottlethreshMax; |
||
141 | // int32_t RudderthreshMax; |
||
142 | // int32_t ThrottleMax; |
||
143 | // int32_t RudderMax; |
||
144 | // int32_t ThrottleMultL; |
||
145 | // int32_t RudderMultL; |
||
146 | // int32_t ThrottleMultH; |
||
147 | // int32_t RudderMultH; |
||
5 | Plagman | 148 | |
2940 | helixhorne | 149 | |
5 | Plagman | 150 | typedef struct |
4747 | terminx | 151 | { |
152 | uint8_t active; |
||
153 | uint8_t used; |
||
154 | uint8_t toggle; |
||
155 | uint8_t buttonheld; |
||
156 | int32_t cleared; |
||
157 | } controlflags; |
||
5 | Plagman | 158 | |
159 | typedef struct |
||
4747 | terminx | 160 | { |
161 | kb_scancode key1; |
||
162 | kb_scancode key2; |
||
163 | } controlkeymaptype; |
||
5 | Plagman | 164 | |
165 | typedef struct |
||
4747 | terminx | 166 | { |
167 | uint8_t singleclicked; |
||
168 | uint8_t doubleclicked; |
||
169 | uint16_t extra; |
||
170 | } controlbuttontype; |
||
5 | Plagman | 171 | |
172 | typedef struct |
||
4747 | terminx | 173 | { |
174 | uint8_t analogmap; |
||
175 | uint8_t minmap; |
||
176 | uint8_t maxmap; |
||
177 | uint8_t extra; |
||
178 | } controlaxismaptype; |
||
5 | Plagman | 179 | |
180 | typedef struct |
||
4747 | terminx | 181 | { |
182 | int32_t analog; |
||
183 | int32_t digital; |
||
184 | } controlaxistype; |
||
5 | Plagman | 185 | |
186 | |||
187 | //*************************************************************************** |
||
188 | // |
||
189 | // PROTOTYPES |
||
190 | // |
||
191 | //*************************************************************************** |
||
192 | |||
4766 | hendricks2 | 193 | #ifdef __cplusplus |
194 | } |
||
5 | Plagman | 195 | #endif |
196 | #endif |