2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Routines to configure keyboard, joystick, etc..
75 ubyte ExtGameStatus=1;
77 vms_vector ExtForceVec;
78 vms_matrix ExtApplyForceMatrix;
80 int ExtJoltInfo[3]={0,0,0};
81 int ExtXVibrateInfo[2]={0,0};
82 int ExtYVibrateInfo[2]={0,0};
83 ubyte ExtXVibrateClear=0;
84 ubyte ExtYVibrateClear=0;
86 #define TABLE_CREATION 1
88 // Array used to 'blink' the cursor while waiting for a keypress.
89 sbyte fades[64] = { 1,1,1,2,2,3,4,4,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,28,28,29,30,30,31,31,31,31,31,30,30,29,28,28,27,26,24,23,22,20,19,17,16,15,13,12,10,9,8,6,5,4,4,3,2,2,1,1 };
91 //char * invert_text[2] = { "N", "Y" };
92 //char * joybutton_text[28] = { "BTN 1", "BTN 2", "BTN 3", "BTN 4", "", "TRIG", "LEFT", "HAT \x81", "RIGHT", "", "", "HAT \x80", "MID", "", "", "HAT \x7f", "", "", "", "HAT \x82", "TRIG", "LEFT", "RIGHT", "", "UP","DOWN","LEFT", "RIGHT" };
93 //char * joyaxis_text[4] = { "X1", "Y1", "X2", "Y2" };
94 //char * mouseaxis_text[2] = { "L/R", "F/B" };
95 //char * mousebutton_text[3] = { "Left", "Right", "Mid" };
97 int invert_text[2] = { TNUM_N, TNUM_Y };
101 int joybutton_text[28] =
102 { TNUM_BTN_1, TNUM_BTN_2, TNUM_BTN_3, TNUM_BTN_4,
106 TNUM_HAT_L, TNUM_HAT_R, TNUM_HAT_U, TNUM_HAT_D,
110 int joyaxis_text[7] = { TNUM_X1, TNUM_Y1, TNUM_Z1, TNUM_UN, TNUM_P1,TNUM_R1,TNUM_YA1 };
111 #elif defined(SDL_INPUT)
112 char *joybutton_text[JOY_MAX_BUTTONS];
113 char *joyaxis_text[JOY_MAX_AXES];
115 int joybutton_text[28] =
116 { TNUM_BTN_1, TNUM_BTN_2, TNUM_BTN_3, TNUM_BTN_4,
117 -1, TNUM_TRIG, TNUM_LEFT, TNUM_HAT_L,
118 TNUM_RIGHT, -1, TNUM_HAT2_D, TNUM_HAT_R,
119 TNUM_MID, -1, TNUM_HAT2_R, TNUM_HAT_U,
120 TNUM_HAT2_L, -1, TNUM_HAT2_U, TNUM_HAT_D,
121 TNUM_TRIG, TNUM_LEFT, TNUM_RIGHT, -1,
122 TNUM_UP, TNUM_DOWN, TNUM_LEFT, TNUM_RIGHT };
124 int joyaxis_text[7] = { TNUM_X1, TNUM_Y1, TNUM_Z1, TNUM_UN, TNUM_P1,TNUM_R1,TNUM_YA1 };
125 // int joyaxis_text[4] = { TNUM_X1, TNUM_Y1, TNUM_X2, TNUM_Y2 };
129 int mouseaxis_text[3] = { TNUM_L_R, TNUM_F_B, TNUM_Z1 };
131 int mousebutton_text[3] = { TNUM_LEFT, TNUM_RIGHT, TNUM_MID };
132 char * mousebutton_textra[13] = { "M4", "M5", "M6", "M7", "M8", "M9", "M10","M11","M12","M13","M14","M15","M16" };//text for buttons above 3. -MPM
134 char *mousebutton_text[3] = { "Btn", "", "" }; // only one silly mouse button on the mac
138 char * key_text[256] = {
139 "","S","D","F","H","G","Z","X","C","V","","B","Q", "W", "E", "R",
140 "Y","T","1","2","3","4","6","5","=","9","7","-", "8", "0", "]", "O",
141 "U","[","I","P","RET","L","J","'","K", ";", "\\", ",", "/", "N", "M", ".",
142 "TAB","SPC","`","DEL","","ESC","","APL","SHIFT","CAPSL","OPTN","CTRL","","","","A",
143 "","PAD.","","PAD*","","PAD+","","NMLCK","","","","PAD/","ENTER","","PAD-","",
144 "","PAD=","PAD0","PAD1","PAD2","PAD3","PAD4","PAD5","PAD6","PAD7","","PAD8","PAD9","","","",
145 "F5","F6","F7","","F8","F9","","F11","","F13","","F14","","F10","","F12",
146 "","PAUSE","HELP","HOME","PGUP","DEL","","END","F2","","F1","LARW","RARW","DARW","UARW","",
147 "","","","","","","","","","","","","","","","",
148 "","","","","","","","","","","","","","","","",
149 "","","","","","","","","","","","","","","","",
150 "","","","","","","","","","","","","","","","",
151 "","","","","","","","","","","","","","","","",
152 "","","","","","","","","","","","","","","","",
153 "","","","","","","","","","","","","","","","",
154 "","","","","","","","","","","","","","","",""};
156 #if !defined OGL && !defined SDL_INPUT
157 char * key_text[256] = { \
158 "","ESC","1","2","3","4","5","6","7","8","9","0","-", \
159 "=","BSPC","TAB","Q","W","E","R","T","Y","U","I","O", \
160 "P","[","]","\x83","LCTRL","A","S","D","F", \
161 "G","H","J","K","L",";","'","`", \
162 "LSHFT","\\","Z","X","C","V","B","N","M",",", \
163 ".","/","RSHFT","PAD*","LALT","SPC", \
164 "CPSLK","F1","F2","F3","F4","F5","F6","F7","F8","F9", \
165 "F10","NMLCK","SCLK","PAD7","PAD8","PAD9","PAD-", \
166 "PAD4","PAD5","PAD6","PAD+","PAD1","PAD2","PAD3","PAD0", \
167 "PAD.","","","","F11","F12","","","","","","","","","", \
168 "","","","","","","","","","","","","","","","","","","","", \
169 "","","","","","","","","","","","","","","","","","","","", \
170 "","","","","","","","","","","","","","","","","","", \
171 "PAD\x83","RCTRL","","","","","","","","","","","","","", \
172 "","","","","","","","","","","PAD/","","","RALT","", \
173 "","","","","","","","","","","","","","HOME","\x82","PGUP", \
174 "","\x81","","\x7f","","END","\x80","PGDN","INS", \
175 "DEL","","","","","","","","","","","","","","","","","", \
176 "","","","","","","","","","","","","","","","","","","","", \
177 "","","","","","","" };
182 //added/removed by Victor Rachels for adding rebindable keys for these
183 // KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0
184 ubyte system_keys[] = { KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_MINUS, KEY_EQUAL, KEY_PRINT_SCREEN };
186 ubyte system_keys[] = { KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, KEY_MINUS, KEY_EQUAL, KEY_PRINT_SCREEN };
189 //extern void GameLoop(int, int );
191 extern void transfer_energy_to_shield(fix);
192 extern void CyclePrimary(),CycleSecondary(),InitMarkerInput();
193 extern ubyte DefiningMarkerMessage;
194 extern char CybermouseActive;
197 extern int joydefsw_do_button();
198 extern int joydefsw_do_winjoybutton(int *axis);
199 extern joydefsw_win_joyselect(char *title);
202 control_info Controls;
206 // macros for drawing lo/hi res kconfig screens (see scores.c as well)
208 #define LHX(x) ((x)*(MenuHires?2:1))
209 #define LHY(y) ((y)*(MenuHires?2.4:1))
213 #define BT_MOUSE_BUTTON 1
214 #define BT_MOUSE_AXIS 2
215 #define BT_JOY_BUTTON 3
216 #define BT_JOY_AXIS 4
219 char *btype_text[] = { "BT_KEY", "BT_MOUSE_BUTTON", "BT_MOUSE_AXIS", "BT_JOY_BUTTON", "BT_JOY_AXIS", "BT_INVERT" };
223 typedef struct kc_item {
224 short id; // The id of this item
232 ubyte value; // what key,button,etc
238 ubyte kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS];
240 //added on 2/4/99 by Victor Rachels to add d1x new keys
241 ubyte kconfig_d2x_settings[MAX_D2X_CONTROLS];
242 //end this section addition - VR
244 //----------- WARNING!!!!!!! -------------------------------------------
245 // THESE NEXT FOUR BLOCKS OF DATA ARE GENERATED BY PRESSING DEL+F12 WHEN
246 // IN THE KEYBOARD CONFIG SCREEN. BASICALLY, THAT PROCEDURE MODIFIES THE
247 // U,D,L,R FIELDS OF THE ARRAYS AND DUMPS THE NEW ARRAYS INTO KCONFIG.COD
248 //-------------------------------------------------------------------------
249 /*ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS] = {
250 {0xc8,0x48,0xd0,0x50,0xcb,0x4b,0xcd,0x4d,0x38,0xff,0xff,0x4f,0xff,0x51,0xff,0x4a,0xff,0x4e,0xff,0xff,0x10,0x47,0x12,0x49,0x1d,0x9d,0x39,0xff,0x21,0xff,0x1e,0xff,0x2c,0xff,0x30,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xff,0x1f,0xff,0x33,0xff,0x34,0xff,0x23,0xff,0x14,0xff,0xff,0xff,0x0,0x0},
251 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
252 {0x5,0xc,0xff,0xff,0xff,0xff,0x7,0xf,0x13,0xb,0xff,0x6,0x8,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
253 {0x0,0x1,0xff,0xff,0x2,0xff,0x7,0xf,0x13,0xb,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
254 {0x3,0x0,0x1,0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
255 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
256 {0x0,0x1,0xff,0xff,0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
260 ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS] = {
261 {0xc8,0x48,0xd0,0x50,0xcb,0x4b,0xcd,0x4d,0x38,0xff,0xff,0x4f,0xff,0x51,0xff,0x4a,0xff,0x4e,0xff,0xff,0x10,0x47,0x12,0x49,0x1d,0x9d,0x39,0xff,0x21,0xff,0x1e,0xff,0x2c,0xff,0x30,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xff,0x1f,0xff,0x33,0xff,0x34,0xff,0x23,0xff,0x14,0xff,0xff,0xff,0x0,0x0},
262 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
263 {0x5,0xc,0xff,0xff,0xff,0xff,0x7,0xf,0x13,0xb,0xff,0x6,0x8,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0},
264 {0x0,0x1,0xff,0xff,0x2,0xff,0x7,0xf,0x13,0xb,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
265 {0x3,0x0,0x1,0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
266 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
267 {0x0,0x1,0xff,0xff,0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
269 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
275 kc_item kc_keyboard[NUM_KEY_CONTROLS] = {
276 { 0, 15, 49, 71, 26, 55, 2, 55, 1,"Pitch forward", BT_KEY, 255 },
277 { 1, 15, 49,100, 26, 50, 3, 0, 24,"Pitch forward", BT_KEY, 255 },
278 { 2, 15, 57, 71, 26, 0, 4, 25, 3,"Pitch backward", BT_KEY, 255 },
279 { 3, 15, 57,100, 26, 1, 5, 2, 26,"Pitch backward", BT_KEY, 255 },
280 { 4, 15, 65, 71, 26, 2, 6, 27, 5,"Turn left", BT_KEY, 255 },
281 { 5, 15, 65,100, 26, 3, 7, 4, 28,"Turn left", BT_KEY, 255 },
282 { 6, 15, 73, 71, 26, 4, 8, 29, 7,"Turn right", BT_KEY, 255 },
283 { 7, 15, 73,100, 26, 5, 9, 6, 34,"Turn right", BT_KEY, 255 },
284 { 8, 15, 85, 71, 26, 6, 10, 35, 9,"Slide on", BT_KEY, 255 },
285 { 9, 15, 85,100, 26, 7, 11, 8, 36,"Slide on", BT_KEY, 255 },
286 { 10, 15, 93, 71, 26, 8, 12, 37, 11,"Slide left", BT_KEY, 255 },
287 { 11, 15, 93,100, 26, 9, 13, 10, 44,"Slide left", BT_KEY, 255 },
288 { 12, 15,101, 71, 26, 10, 14, 45, 13,"Slide right", BT_KEY, 255 },
289 { 13, 15,101,100, 26, 11, 15, 12, 30,"Slide right", BT_KEY, 255 },
290 { 14, 15,109, 71, 26, 12, 16, 31, 15,"Slide up", BT_KEY, 255 },
291 { 15, 15,109,100, 26, 13, 17, 14, 32,"Slide up", BT_KEY, 255 },
292 { 16, 15,117, 71, 26, 14, 18, 33, 17,"Slide down", BT_KEY, 255 },
293 { 17, 15,117,100, 26, 15, 19, 16, 46,"Slide down", BT_KEY, 255 },
294 { 18, 15,129, 71, 26, 16, 20, 47, 19,"Bank on", BT_KEY, 255 },
295 { 19, 15,129,100, 26, 17, 21, 18, 38,"Bank on", BT_KEY, 255 },
296 { 20, 15,137, 71, 26, 18, 22, 39, 21,"Bank left", BT_KEY, 255 },
297 { 21, 15,137,100, 26, 19, 23, 20, 40,"Bank left", BT_KEY, 255 },
298 { 22, 15,145, 71, 26, 20, 48, 41, 23,"Bank right", BT_KEY, 255 },
299 { 23, 15,145,100, 26, 21, 49, 22, 42,"Bank right", BT_KEY, 255 },
300 { 24,158, 49, 83, 26, 51, 26, 1, 25,"Fire primary", BT_KEY, 255 },
301 { 25,158, 49,112, 26, 54, 27, 24, 2,"Fire primary", BT_KEY, 255 },
302 { 26,158, 57, 83, 26, 24, 28, 3, 27,"Fire secondary", BT_KEY, 255 },
303 { 27,158, 57,112, 26, 25, 29, 26, 4,"Fire secondary", BT_KEY, 255 },
304 { 28,158, 65, 83, 26, 26, 34, 5, 29,"Fire flare", BT_KEY, 255 },
305 { 29,158, 65,112, 26, 27, 35, 28, 6,"Fire flare", BT_KEY, 255 },
306 { 30,158,105, 83, 26, 44, 32, 13, 31,"Accelerate", BT_KEY, 255 },
307 { 31,158,105,112, 26, 45, 33, 30, 14,"Accelerate", BT_KEY, 255 },
308 { 32,158,113, 83, 26, 30, 46, 15, 33,"reverse", BT_KEY, 255 },
309 { 33,158,113,112, 26, 31, 47, 32, 16,"reverse", BT_KEY, 255 },
310 { 34,158, 73, 83, 26, 28, 36, 7, 35,"Drop Bomb", BT_KEY, 255 },
311 { 35,158, 73,112, 26, 29, 37, 34, 8,"Drop Bomb", BT_KEY, 255 },
312 { 36,158, 85, 83, 26, 34, 44, 9, 37,"REAR VIEW", BT_KEY, 255 },
313 { 37,158, 85,112, 26, 35, 45, 36, 10,"REAR VIEW", BT_KEY, 255 },
314 { 38,158,133, 83, 26, 46, 40, 19, 39,"Cruise Faster", BT_KEY, 255 },
315 { 39,158,133,112, 26, 47, 41, 38, 20,"Cruise Faster", BT_KEY, 255 },
316 { 40,158,141, 83, 26, 38, 42, 21, 41,"Cruise Slower", BT_KEY, 255 },
317 { 41,158,141,112, 26, 39, 43, 40, 22,"Cruise Slower", BT_KEY, 255 },
318 { 42,158,149, 83, 26, 40, 52, 23, 43,"Cruise Off", BT_KEY, 255 },
319 { 43,158,149,112, 26, 41, 53, 42, 48,"Cruise Off", BT_KEY, 255 },
320 { 44,158, 93, 83, 26, 36, 30, 11, 45,"Automap", BT_KEY, 255 },
321 { 45,158, 93,112, 26, 37, 31, 44, 12,"Automap", BT_KEY, 255 },
322 { 46,158,121, 83, 26, 32, 38, 17, 47,"Afterburner", BT_KEY, 255 },
323 { 47,158,121,112, 26, 33, 39, 46, 18,"Afterburner", BT_KEY, 255 },
324 { 48, 15,161, 71, 26, 22, 50, 43, 49,"Cycle Primary", BT_KEY, 255 },
325 { 49, 15,161,100, 26, 23, 51, 48, 52,"Cycle Primary", BT_KEY, 255 },
326 { 50, 15,169, 71, 26, 48, 1, 53, 51,"Cycle Second", BT_KEY, 255 },
327 { 51, 15,169,100, 26, 49, 24, 50, 54,"Cycle Second", BT_KEY, 255 },
328 { 52,158,163, 83, 26, 42, 54, 49, 53,"Headlight", BT_KEY, 255 },
329 { 53,158,163,112, 26, 43, 55, 52, 50,"Headlight", BT_KEY, 255 },
330 { 54,158,171, 83, 26, 52, 56, 51, 55,"Energy->Shield", BT_KEY, 255 },
331 { 55,158,171,112, 26, 53, 0, 54, 0,"Energy->Shield", BT_KEY, 255 },
332 { 56,158,179,83, 26, 54, 0, 0, 0, "Toggle Bomb", BT_KEY,255},
334 kc_item kc_keybindings[NUM_KEY_CONTROLS] = {
335 { 0, 15, 49, 71, 26, 55, 2, 55, 1,"Pitch forward", BT_KEY, 255 },
336 { 1, 15, 49,100, 26, 50, 3, 0, 24,"Pitch forward", BT_KEY, 255 },
337 { 2, 15, 57, 71, 26, 0, 4, 25, 3,"Pitch backward", BT_KEY, 255 },
338 { 3, 15, 57,100, 26, 1, 5, 2, 26,"Pitch backward", BT_KEY, 255 },
339 { 4, 15, 65, 71, 26, 2, 6, 27, 5,"Turn left", BT_KEY, 255 },
340 { 5, 15, 65,100, 26, 3, 7, 4, 28,"Turn left", BT_KEY, 255 },
341 { 6, 15, 73, 71, 26, 4, 8, 29, 7,"Turn right", BT_KEY, 255 },
342 { 7, 15, 73,100, 26, 5, 9, 6, 34,"Turn right", BT_KEY, 255 },
343 { 8, 15, 85, 71, 26, 6, 10, 35, 9,"Slide on", BT_KEY, 255 },
344 { 9, 15, 85,100, 26, 7, 11, 8, 36,"Slide on", BT_KEY, 255 },
345 { 10, 15, 93, 71, 26, 8, 12, 37, 11,"Slide left", BT_KEY, 255 },
346 { 11, 15, 93,100, 26, 9, 13, 10, 44,"Slide left", BT_KEY, 255 },
347 { 12, 15,101, 71, 26, 10, 14, 45, 13,"Slide right", BT_KEY, 255 },
348 { 13, 15,101,100, 26, 11, 15, 12, 30,"Slide right", BT_KEY, 255 },
349 { 14, 15,109, 71, 26, 12, 16, 31, 15,"Slide up", BT_KEY, 255 },
350 { 15, 15,109,100, 26, 13, 17, 14, 32,"Slide up", BT_KEY, 255 },
351 { 16, 15,117, 71, 26, 14, 18, 33, 17,"Slide down", BT_KEY, 255 },
352 { 17, 15,117,100, 26, 15, 19, 16, 46,"Slide down", BT_KEY, 255 },
353 { 18, 15,129, 71, 26, 16, 20, 47, 19,"Bank on", BT_KEY, 255 },
354 { 19, 15,129,100, 26, 17, 21, 18, 38,"Bank on", BT_KEY, 255 },
355 { 20, 15,137, 71, 26, 18, 22, 39, 21,"Bank left", BT_KEY, 255 },
356 { 21, 15,137,100, 26, 19, 23, 20, 40,"Bank left", BT_KEY, 255 },
357 { 22, 15,145, 71, 26, 20, 48, 41, 23,"Bank right", BT_KEY, 255 },
358 { 23, 15,145,100, 26, 21, 49, 22, 42,"Bank right", BT_KEY, 255 },
359 { 24,158, 49, 83, 26, 51, 26, 1, 25,"Fire primary", BT_KEY, 255 },
360 { 25,158, 49,112, 26, 54, 27, 24, 2,"Fire primary", BT_KEY, 255 },
361 { 26,158, 57, 83, 26, 24, 28, 3, 27,"Fire secondary", BT_KEY, 255 },
362 { 27,158, 57,112, 26, 25, 29, 26, 4,"Fire secondary", BT_KEY, 255 },
363 { 28,158, 65, 83, 26, 26, 34, 5, 29,"Fire flare", BT_KEY, 255 },
364 { 29,158, 65,112, 26, 27, 35, 28, 6,"Fire flare", BT_KEY, 255 },
365 { 30,158,105, 83, 26, 44, 32, 13, 31,"Accelerate", BT_KEY, 255 },
366 { 31,158,105,112, 26, 45, 33, 30, 14,"Accelerate", BT_KEY, 255 },
367 { 32,158,113, 83, 26, 30, 46, 15, 33,"reverse", BT_KEY, 255 },
368 { 33,158,113,112, 26, 31, 47, 32, 16,"reverse", BT_KEY, 255 },
369 { 34,158, 73, 83, 26, 28, 36, 7, 35,"Drop Bomb", BT_KEY, 255 },
370 { 35,158, 73,112, 26, 29, 37, 34, 8,"Drop Bomb", BT_KEY, 255 },
371 { 36,158, 85, 83, 26, 34, 44, 9, 37,"REAR VIEW", BT_KEY, 255 },
372 { 37,158, 85,112, 26, 35, 45, 36, 10,"REAR VIEW", BT_KEY, 255 },
373 { 38,158,133, 83, 26, 46, 40, 19, 39,"Cruise Faster", BT_KEY, 255 },
374 { 39,158,133,112, 26, 47, 41, 38, 20,"Cruise Faster", BT_KEY, 255 },
375 { 40,158,141, 83, 26, 38, 42, 21, 41,"Cruise Slower", BT_KEY, 255 },
376 { 41,158,141,112, 26, 39, 43, 40, 22,"Cruise Slower", BT_KEY, 255 },
377 { 42,158,149, 83, 26, 40, 52, 23, 43,"Cruise Off", BT_KEY, 255 },
378 { 43,158,149,112, 26, 41, 53, 42, 48,"Cruise Off", BT_KEY, 255 },
379 { 44,158, 93, 83, 26, 36, 30, 11, 45,"Automap", BT_KEY, 255 },
380 { 45,158, 93,112, 26, 37, 31, 44, 12,"Automap", BT_KEY, 255 },
381 { 46,158,121, 83, 26, 32, 38, 17, 47,"Afterburner", BT_KEY, 255 },
382 { 47,158,121,112, 26, 33, 39, 46, 18,"Afterburner", BT_KEY, 255 },
383 { 48, 15,161, 71, 26, 22, 50, 43, 49,"Cycle Primary", BT_KEY, 255 },
384 { 49, 15,161,100, 26, 23, 51, 48, 52,"Cycle Primary", BT_KEY, 255 },
385 { 50, 15,169, 71, 26, 48, 1, 53, 51,"Cycle Second", BT_KEY, 255 },
386 { 51, 15,169,100, 26, 49, 24, 50, 54,"Cycle Second", BT_KEY, 255 },
387 { 52,158,163, 83, 26, 42, 54, 49, 53,"Headlight", BT_KEY, 255 },
388 { 53,158,163,112, 26, 43, 55, 52, 50,"Headlight", BT_KEY, 255 },
389 { 54,158,171, 83, 26, 52, 56, 51, 55,"Energy->Shield", BT_KEY, 255 },
390 { 55,158,171,112, 26, 53, 0, 54, 0,"Energy->Shield", BT_KEY, 255 },
391 { 56,158,179,83, 26, 54, 0, 0, 0, "Toggle Bomb", BT_KEY,255},
393 char *kc_bind_text[NUM_KEY_CONTROLS] = {
452 kc_item kc_joystick[NUM_OTHER_CONTROLS] = {
453 { 0, 25, 46, 85, 40, 15, 1, 24, 5,"Fire primary", BT_JOY_BUTTON, 255 },
454 { 1, 25, 54, 85, 40, 0, 4, 5, 6,"Fire secondary", BT_JOY_BUTTON, 255 },
455 { 2, 25, 85, 85, 40, 26, 3, 9, 10,"Accelerate", BT_JOY_BUTTON, 255 },
456 { 3, 25, 93, 85, 40, 2, 25, 10, 11,"reverse", BT_JOY_BUTTON, 255 },
457 { 4, 25, 62, 85, 40, 1, 26, 6, 7,"Fire flare", BT_JOY_BUTTON, 255 },
458 { 5,180, 46, 79, 40, 23, 6, 0, 1,"Slide on", BT_JOY_BUTTON, 255 },
459 { 6,180, 54, 79, 40, 5, 7, 1, 4,"Slide left", BT_JOY_BUTTON, 255 },
460 { 7,180, 62, 79, 40, 6, 8, 4, 26,"Slide right", BT_JOY_BUTTON, 255 },
461 { 8,180, 70, 79, 40, 7, 9, 26, 9,"Slide up", BT_JOY_BUTTON, 255 },
462 { 9,180, 78, 79, 40, 8, 10, 8, 2,"Slide down", BT_JOY_BUTTON, 255 },
463 { 10,180, 90, 79, 40, 9, 11, 2, 3,"Bank on", BT_JOY_BUTTON, 255 },
464 { 11,180, 98, 79, 40, 10, 12, 3, 12,"Bank left", BT_JOY_BUTTON, 255 },
465 { 12,180,106, 79, 40, 11, 28, 11, 25,"Bank right", BT_JOY_BUTTON, 255 },
466 { 13, 22,154, 51, 40, 24, 15, 30, 14,"Pitch U/D", BT_JOY_AXIS, 255 },
467 { 14, 22,154, 99, 8, 30, 16, 13, 17,"Pitch U/D", BT_INVERT, 255 },
468 { 15, 22,162, 51, 40, 13, 0, 18, 16,"Turn L/R", BT_JOY_AXIS, 255 },
469 { 16, 22,162, 99, 8, 14, 17, 15, 19,"Turn L/R", BT_INVERT, 255 },
470 { 17,164,154, 58, 40, 16, 19, 14, 18,"Slide L/R", BT_JOY_AXIS, 255 },
471 { 18,164,154,106, 8, 29, 20, 17, 15,"Slide L/R", BT_INVERT, 255 },
472 { 19,164,162, 58, 40, 17, 21, 16, 20,"Slide U/D", BT_JOY_AXIS, 255 },
473 { 20,164,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
474 { 21,164,172, 58, 40, 19, 23, 20, 22,"Bank L/R", BT_JOY_AXIS, 255 },
475 { 22,164,172,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
476 { 23,164,180, 58, 40, 21, 5, 22, 24,"throttle", BT_JOY_AXIS, 255 },
477 { 24,164,180,106, 8, 22, 13, 23, 0,"throttle", BT_INVERT, 255 },
478 { 25, 25,109, 85, 40, 3, 27, 12, 28,"REAR VIEW", BT_JOY_BUTTON, 255 },
479 { 26, 25, 70, 85, 40, 4, 2, 7, 8,"Drop Bomb", BT_JOY_BUTTON, 255 },
480 { 27, 25,117, 85, 40, 25, 30, 28, 29,"Afterburner", BT_JOY_BUTTON, 255 },
481 { 28,180,114, 79, 40, 12, 29, 25, 27,"Cycle Primary", BT_JOY_BUTTON, 255 },
482 { 29,180,122, 79, 40, 28, 18, 27, 30,"Cycle Secondary", BT_JOY_BUTTON, 255 },
483 { 30, 25,125, 85, 40, 27, 14, 29, 13,"Headlight", BT_JOY_BUTTON, 255 },
485 kc_item kc_superjoy[NUM_OTHER_CONTROLS] = {
486 { 0, 25, 46, 85, 26, 15, 1, 24, 5,"Fire primary", BT_JOY_BUTTON, 255 },
487 { 1, 25, 54, 85, 26, 0, 4, 5, 6,"Fire secondary", BT_JOY_BUTTON, 255 },
488 { 2, 25, 85, 85, 26, 26, 3, 9, 10,"Accelerate", BT_JOY_BUTTON, 255 },
489 { 3, 25, 93, 85, 26, 2, 25, 10, 11,"reverse", BT_JOY_BUTTON, 255 },
490 { 4, 25, 62, 85, 26, 1, 26, 6, 7,"Fire flare", BT_JOY_BUTTON, 255 },
491 { 5,180, 46, 79, 26, 23, 6, 0, 1,"Slide on", BT_JOY_BUTTON, 255 },
492 { 6,180, 54, 79, 26, 5, 7, 1, 4,"Slide left", BT_JOY_BUTTON, 255 },
493 { 7,180, 62, 79, 26, 6, 8, 4, 26,"Slide right", BT_JOY_BUTTON, 255 },
494 { 8,180, 70, 79, 26, 7, 9, 26, 9,"Slide up", BT_JOY_BUTTON, 255 },
495 { 9,180, 78, 79, 26, 8, 10, 8, 2,"Slide down", BT_JOY_BUTTON, 255 },
496 { 10,180, 90, 79, 26, 9, 11, 2, 3,"Bank on", BT_JOY_BUTTON, 255 },
497 { 11,180, 98, 79, 26, 10, 12, 3, 12,"Bank left", BT_JOY_BUTTON, 255 },
498 { 12,180,106, 79, 26, 11, 28, 11, 25,"Bank right", BT_JOY_BUTTON, 255 },
499 { 13, 22,154, 51, 26, 24, 15, 30, 14,"Pitch U/D", BT_JOY_AXIS, 255 },
500 { 14, 22,154, 99, 8, 30, 16, 13, 17,"Pitch U/D", BT_INVERT, 255 },
501 { 15, 22,162, 51, 26, 13, 0, 18, 16,"Turn L/R", BT_JOY_AXIS, 255 },
502 { 16, 22,162, 99, 8, 14, 17, 15, 19,"Turn L/R", BT_INVERT, 255 },
503 { 17,164,154, 58, 26, 16, 19, 14, 18,"Slide L/R", BT_JOY_AXIS, 255 },
504 { 18,164,154,106, 8, 29, 20, 17, 15,"Slide L/R", BT_INVERT, 255 },
505 { 19,164,162, 58, 26, 17, 21, 16, 20,"Slide U/D", BT_JOY_AXIS, 255 },
506 { 20,164,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
507 { 21,164,172, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_JOY_AXIS, 255 },
508 { 22,164,172,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
509 { 23,164,180, 58, 26, 21, 5, 22, 24,"throttle", BT_JOY_AXIS, 255 },
510 { 24,164,180,106, 8, 22, 13, 23, 0,"throttle", BT_INVERT, 255 },
511 { 25, 25,109, 85, 26, 3, 27, 12, 28,"REAR VIEW", BT_JOY_BUTTON, 255 },
512 { 26, 25, 70, 85, 26, 4, 2, 7, 8,"Drop Bomb", BT_JOY_BUTTON, 255 },
513 { 27, 25,117, 85, 26, 25, 30, 28, 29,"Afterburner", BT_JOY_BUTTON, 255 },
514 { 28,180,114, 79, 26, 12, 29, 25, 27,"Cycle Primary", BT_JOY_BUTTON, 255 },
515 { 29,180,122, 79, 26, 28, 18, 27, 30,"Cycle Secondary", BT_JOY_BUTTON, 255 },
516 { 30, 25,125, 85, 26, 27, 14, 29, 13,"Headlight", BT_JOY_BUTTON, 255 },
519 kc_item kc_mouse[NUM_OTHER_CONTROLS] = {
520 { 0, 25, 46, 85, 26, 12, 1, 24, 5,"Fire primary", BT_MOUSE_BUTTON, 255 },
521 { 1, 25, 54, 85, 26, 0, 4, 5, 6,"Fire secondary", BT_MOUSE_BUTTON, 255 },
522 { 2, 25, 85, 85, 26, 26, 3, 9, 10,"Accelerate", BT_MOUSE_BUTTON, 255 },
523 { 3, 25, 93, 85, 26, 2, 25, 10, 11,"reverse", BT_MOUSE_BUTTON, 255 },
524 { 4, 25, 62, 85, 26, 1, 26, 6, 7,"Fire flare", BT_MOUSE_BUTTON, 255 },
525 { 5,180, 46, 59, 26, 24, 6, 0, 1,"Slide on", BT_MOUSE_BUTTON, 255 },
526 { 6,180, 54, 59, 26, 5, 7, 1, 4,"Slide left", BT_MOUSE_BUTTON, 255 },
527 { 7,180, 62, 59, 26, 6, 8, 4, 26,"Slide right", BT_MOUSE_BUTTON, 255 },
528 { 8,180, 70, 59, 26, 7, 9, 26, 9,"Slide up", BT_MOUSE_BUTTON, 255 },
529 { 9,180, 78, 59, 26, 8, 10, 8, 2,"Slide down", BT_MOUSE_BUTTON, 255 },
530 { 10,180, 90, 59, 26, 9, 11, 2, 3,"Bank on", BT_MOUSE_BUTTON, 255 },
531 { 11,180, 98, 59, 26, 10, 12, 3, 12,"Bank left", BT_MOUSE_BUTTON, 255 },
532 { 12,180,106, 59, 26, 11, 0, 11, 25,"Bank right", BT_MOUSE_BUTTON, 255 },
533 { 13,103,138, 58, 26, 27, 15, 25, 14,"Pitch U/D", BT_MOUSE_AXIS, 255 },
534 { 14,103,138,106, 8, 23, 16, 13, 15,"Pitch U/D", BT_INVERT, 255 },
535 { 15,103,146, 58, 26, 13, 17, 14, 16,"Turn L/R", BT_MOUSE_AXIS, 255 },
536 { 16,103,146,106, 8, 14, 18, 15, 17,"Turn L/R", BT_INVERT, 255 },
537 { 17,103,154, 58, 26, 15, 19, 16, 18,"Slide L/R", BT_MOUSE_AXIS, 255 },
538 { 18,103,154,106, 8, 16, 20, 17, 19,"Slide L/R", BT_INVERT, 255 },
539 { 19,103,162, 58, 26, 17, 21, 18, 20,"Slide U/D", BT_MOUSE_AXIS, 255 },
540 { 20,103,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
541 { 21,103,170, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_MOUSE_AXIS, 255 },
542 { 22,103,170,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
543 { 23,103,182, 58, 26, 21, 14, 22, 24,"throttle", BT_MOUSE_AXIS, 255 },
544 { 24,103,182,106, 8, 22, 5, 23, 0,"throttle", BT_INVERT, 255 },
545 { 25, 25,109, 85, 26, 3, 27, 12, 13,"REAR VIEW", BT_MOUSE_BUTTON, 255 },
546 { 26, 25, 70, 85, 26, 4, 2, 7, 8,"Drop Bomb", BT_MOUSE_BUTTON, 255 },
547 { 27, 25,117, 85, 26, 25, 13, 25, 13,"Afterburner", BT_MOUSE_BUTTON, 255 },
551 //added on 2/4/99 by Victor Rachels to add d1x new keys
552 kc_item kc_d2x[NUM_D2X_CONTROLS] = {
553 // id,x,y,w1,w2,u,d,l,r,text_num1,type,value
554 { 0, 15, 49, 71, 26, 27, 2, 27, 1, "WEAPON 1", BT_KEY, 255},
555 { 1, 15, 49,100, 26, 26, 3, 0, 2, "WEAPON 1", BT_JOY_BUTTON, 255},
556 { 2, 15, 57, 71, 26, 0, 4, 1, 3, "WEAPON 2", BT_KEY, 255},
557 { 3, 15, 57,100, 26, 1, 5, 2, 4, "WEAPON 2", BT_JOY_BUTTON, 255},
558 { 4, 15, 65, 71, 26, 2, 6, 3, 5, "WEAPON 3", BT_KEY, 255},
559 { 5, 15, 65,100, 26, 3, 7, 4, 6, "WEAPON 3", BT_JOY_BUTTON, 255},
560 { 6, 15, 73, 71, 26, 4, 8, 5, 7, "WEAPON 4", BT_KEY, 255},
561 { 7, 15, 73,100, 26, 5, 9, 6, 8, "WEAPON 4", BT_JOY_BUTTON, 255},
562 { 8, 15, 81, 71, 26, 6, 10, 7, 9, "WEAPON 5", BT_KEY, 255},
563 { 9, 15, 81,100, 26, 7, 11, 8, 10, "WEAPON 5", BT_JOY_BUTTON, 255},
565 { 10, 15, 89, 71, 26, 8, 12, 9, 11, "WEAPON 6", BT_KEY, 255},
566 { 11, 15, 89,100, 26, 9, 13, 10, 12, "WEAPON 6", BT_JOY_BUTTON, 255},
567 { 12, 15, 97, 71, 26, 10, 14, 11, 13, "WEAPON 7", BT_KEY, 255},
568 { 13, 15, 97,100, 26, 11, 15, 12, 14, "WEAPON 7", BT_JOY_BUTTON, 255},
569 { 14, 15,105, 71, 26, 12, 16, 13, 15, "WEAPON 8", BT_KEY, 255},
570 { 15, 15,105,100, 26, 13, 17, 14, 16, "WEAPON 8", BT_JOY_BUTTON, 255},
571 { 16, 15,113, 71, 26, 14, 18, 15, 17, "WEAPON 9", BT_KEY, 255},
572 { 17, 15,113,100, 26, 15, 19, 16, 18, "WEAPON 9", BT_JOY_BUTTON, 255},
573 { 18, 15,121, 71, 26, 16, 20, 17, 19, "WEAPON 0", BT_KEY, 255},
574 { 19, 15,121,100, 26, 17, 21, 18, 20, "WEAPON 0", BT_JOY_BUTTON, 255},
576 //{ 20, 15,131, 71, 26, 18, 22, 19, 21, "CYC PRIMARY", BT_KEY, 255},
577 //{ 21, 15,131,100, 26, 19, 23, 20, 22, "CYC PRIMARY", BT_JOY_BUTTON, 255},
578 //{ 22, 15,139, 71, 26, 20, 24, 21, 23, "CYC SECONDARY", BT_KEY, 255},
579 //{ 23, 15,139,100, 26, 21, 25, 22, 24, "CYC SECONDARY", BT_JOY_BUTTON, 255},
580 //{ 24, 8,147, 78, 26, 22, 26, 23, 25, "TOGGLE_PRIM AUTO", BT_KEY, 255},
581 //{ 25, 8,147,107, 26, 23, 27, 24, 26, "TOGGLE_PRIM_AUTO", BT_JOY_BUTTON, 255},
582 //{ 26, 8,155, 78, 26, 24, 1, 25, 27, "TOGGLE SEC AUTO", BT_KEY, 255},
583 //{ 27, 8,155,107, 26, 25, 0, 26, 0, "TOGGLE SEC AUTO", BT_JOY_BUTTON, 255},
585 //end this section addition - VR
588 #else // ifndef MACINTOSH (following are macintosh controls)
590 ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS] = {
591 {0x5b,0x7e,0x54,0x7d,0x56,0x7b,0x58,0x7c,0x3a,0xff,0xff,0x53,0xff,0x55,0xff,0x4e,0xff,0x45,0xff,0xff,0xc,0x59,0xe,0x5c,0x3b,0x24,0x31,0xff,0x3,0xff,0x3f,0xff,0x6,0xff,0xb,0xff,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x30,0xff,0x1,0xff,0x2b,0xff,0x2f,0xff,0x4,0xff,0x11,0xff,0xff,0xff,0x0,0x0},
592 {0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
593 {0x0,0x3,0xff,0xff,0xff,0xff,0xb,0xc,0x9,0xa,0xff,0x1,0x2,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0},
594 {0x5,0x4,0xff,0xff,0x6,0xff,0x3,0x2,0x0,0x1,0xff,0x8,0xa,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0x3,0x1,0xb,0x7,0xd,0xe,0xf,0xc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
595 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
596 {0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
597 {0x0,0x1,0xff,0xff,0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
600 ubyte default_firebird_settings[MAX_CONTROLS] =
601 {0x0,0x1,0xff,0xff,0x2,0xff,0x4,0x6,0x5,0x7,0xff,0xb,0xc,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0x03,0x0,0xff,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0};
603 ubyte default_mousestick_settings[MAX_CONTROLS] =
604 {0x2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3,0x4,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0};
606 kc_item kc_keyboard[NUM_KEY_CONTROLS] = {
607 { 0, 15, 49, 71, 26, 55, 2, 55, 1,"Pitch forward", BT_KEY, 255 },
608 { 1, 15, 49,100, 26, 50, 3, 0, 24,"Pitch forward", BT_KEY, 255 },
609 { 2, 15, 57, 71, 26, 0, 4, 25, 3,"Pitch backward", BT_KEY, 255 },
610 { 3, 15, 57,100, 26, 1, 5, 2, 26,"Pitch backward", BT_KEY, 255 },
611 { 4, 15, 65, 71, 26, 2, 6, 27, 5,"Turn left", BT_KEY, 255 },
612 { 5, 15, 65,100, 26, 3, 7, 4, 28,"Turn left", BT_KEY, 255 },
613 { 6, 15, 73, 71, 26, 4, 8, 29, 7,"Turn right", BT_KEY, 255 },
614 { 7, 15, 73,100, 26, 5, 9, 6, 34,"Turn right", BT_KEY, 255 },
615 { 8, 15, 85, 71, 26, 6, 10, 35, 9,"Slide on", BT_KEY, 255 },
616 { 9, 15, 85,100, 26, 7, 11, 8, 36,"Slide on", BT_KEY, 255 },
617 { 10, 15, 93, 71, 26, 8, 12, 37, 11,"Slide left", BT_KEY, 255 },
618 { 11, 15, 93,100, 26, 9, 13, 10, 44,"Slide left", BT_KEY, 255 },
619 { 12, 15,101, 71, 26, 10, 14, 45, 13,"Slide right", BT_KEY, 255 },
620 { 13, 15,101,100, 26, 11, 15, 12, 30,"Slide right", BT_KEY, 255 },
621 { 14, 15,109, 71, 26, 12, 16, 31, 15,"Slide up", BT_KEY, 255 },
622 { 15, 15,109,100, 26, 13, 17, 14, 32,"Slide up", BT_KEY, 255 },
623 { 16, 15,117, 71, 26, 14, 18, 33, 17,"Slide down", BT_KEY, 255 },
624 { 17, 15,117,100, 26, 15, 19, 16, 46,"Slide down", BT_KEY, 255 },
625 { 18, 15,129, 71, 26, 16, 20, 47, 19,"Bank on", BT_KEY, 255 },
626 { 19, 15,129,100, 26, 17, 21, 18, 38,"Bank on", BT_KEY, 255 },
627 { 20, 15,137, 71, 26, 18, 22, 39, 21,"Bank left", BT_KEY, 255 },
628 { 21, 15,137,100, 26, 19, 23, 20, 40,"Bank left", BT_KEY, 255 },
629 { 22, 15,145, 71, 26, 20, 48, 41, 23,"Bank right", BT_KEY, 255 },
630 { 23, 15,145,100, 26, 21, 49, 22, 42,"Bank right", BT_KEY, 255 },
631 { 24,158, 49, 83, 26, 51, 26, 1, 25,"Fire primary", BT_KEY, 255 },
632 { 25,158, 49,112, 26, 54, 27, 24, 2,"Fire primary", BT_KEY, 255 },
633 { 26,158, 57, 83, 26, 24, 28, 3, 27,"Fire secondary", BT_KEY, 255 },
634 { 27,158, 57,112, 26, 25, 29, 26, 4,"Fire secondary", BT_KEY, 255 },
635 { 28,158, 65, 83, 26, 26, 34, 5, 29,"Fire flare", BT_KEY, 255 },
636 { 29,158, 65,112, 26, 27, 35, 28, 6,"Fire flare", BT_KEY, 255 },
637 { 30,158,105, 83, 26, 44, 32, 13, 31,"Accelerate", BT_KEY, 255 },
638 { 31,158,105,112, 26, 45, 33, 30, 14,"Accelerate", BT_KEY, 255 },
639 { 32,158,113, 83, 26, 30, 46, 15, 33,"reverse", BT_KEY, 255 },
640 { 33,158,113,112, 26, 31, 47, 32, 16,"reverse", BT_KEY, 255 },
641 { 34,158, 73, 83, 26, 28, 36, 7, 35,"Drop Bomb", BT_KEY, 255 },
642 { 35,158, 73,112, 26, 29, 37, 34, 8,"Drop Bomb", BT_KEY, 255 },
643 { 36,158, 85, 83, 26, 34, 44, 9, 37,"REAR VIEW", BT_KEY, 255 },
644 { 37,158, 85,112, 26, 35, 45, 36, 10,"REAR VIEW", BT_KEY, 255 },
645 { 38,158,133, 83, 26, 46, 40, 19, 39,"Cruise Faster", BT_KEY, 255 },
646 { 39,158,133,112, 26, 47, 41, 38, 20,"Cruise Faster", BT_KEY, 255 },
647 { 40,158,141, 83, 26, 38, 42, 21, 41,"Cruise Slower", BT_KEY, 255 },
648 { 41,158,141,112, 26, 39, 43, 40, 22,"Cruise Slower", BT_KEY, 255 },
649 { 42,158,149, 83, 26, 40, 52, 23, 43,"Cruise Off", BT_KEY, 255 },
650 { 43,158,149,112, 26, 41, 53, 42, 48,"Cruise Off", BT_KEY, 255 },
651 { 44,158, 93, 83, 26, 36, 30, 11, 45,"Automap", BT_KEY, 255 },
652 { 45,158, 93,112, 26, 37, 31, 44, 12,"Automap", BT_KEY, 255 },
653 { 46,158,121, 83, 26, 32, 38, 17, 47,"Afterburner", BT_KEY, 255 },
654 { 47,158,121,112, 26, 33, 39, 46, 18,"Afterburner", BT_KEY, 255 },
655 { 48, 15,161, 71, 26, 22, 50, 43, 49,"Cycle Primary", BT_KEY, 255 },
656 { 49, 15,161,100, 26, 23, 51, 48, 52,"Cycle Primary", BT_KEY, 255 },
657 { 50, 15,169, 71, 26, 48, 1, 53, 51,"Cycle Second", BT_KEY, 255 },
658 { 51, 15,169,100, 26, 49, 24, 50, 54,"Cycle Second", BT_KEY, 255 },
659 { 52,158,163, 83, 26, 42, 54, 49, 53,"Headlight", BT_KEY, 255 },
660 { 53,158,163,112, 26, 43, 55, 52, 50,"Headlight", BT_KEY, 255 },
661 { 54,158,171, 83, 26, 52, 25, 51, 55,"Energy->Shield", BT_KEY, 255 },
662 { 55,158,171,112, 26, 53, 0, 54, 0,"Energy->Shield", BT_KEY, 255 },
664 kc_item kc_joystick[NUM_OTHER_CONTROLS] = {
665 { 0, 25, 46, 85, 28, 15, 1, 24, 5,"Fire primary", BT_JOY_BUTTON, 255 },
666 { 1, 25, 54, 85, 28, 0, 4, 5, 6,"Fire secondary", BT_JOY_BUTTON, 255 },
667 { 2, 25, 85, 85, 28, 26, 3, 9, 10,"Accelerate", BT_JOY_BUTTON, 255 },
668 { 3, 25, 93, 85, 28, 2, 25, 10, 11,"reverse", BT_JOY_BUTTON, 255 },
669 { 4, 25, 62, 85, 28, 1, 26, 6, 7,"Fire flare", BT_JOY_BUTTON, 255 },
670 { 5,180, 46, 79, 28, 23, 6, 0, 1,"Slide on", BT_JOY_BUTTON, 255 },
671 { 6,180, 54, 79, 28, 5, 7, 1, 4,"Slide left", BT_JOY_BUTTON, 255 },
672 { 7,180, 62, 79, 28, 6, 8, 4, 26,"Slide right", BT_JOY_BUTTON, 255 },
673 { 8,180, 70, 79, 28, 7, 9, 26, 9,"Slide up", BT_JOY_BUTTON, 255 },
674 { 9,180, 78, 79, 28, 8, 10, 8, 2,"Slide down", BT_JOY_BUTTON, 255 },
675 { 10,180, 90, 79, 28, 9, 11, 2, 3,"Bank on", BT_JOY_BUTTON, 255 },
676 { 11,180, 98, 79, 28, 10, 12, 3, 12,"Bank left", BT_JOY_BUTTON, 255 },
677 { 12,180,106, 79, 28, 11, 28, 11, 25,"Bank right", BT_JOY_BUTTON, 255 },
678 { 13, 22,154, 51, 26, 24, 15, 30, 14,"Pitch U/D", BT_JOY_AXIS, 255 },
679 { 14, 22,154, 99, 8, 30, 16, 13, 17,"Pitch U/D", BT_INVERT, 255 },
680 { 15, 22,162, 51, 26, 13, 0, 18, 16,"Turn L/R", BT_JOY_AXIS, 255 },
681 { 16, 22,162, 99, 8, 14, 17, 15, 19,"Turn L/R", BT_INVERT, 255 },
682 { 17,164,154, 58, 26, 16, 19, 14, 18,"Slide L/R", BT_JOY_AXIS, 255 },
683 { 18,164,154,106, 8, 29, 20, 17, 15,"Slide L/R", BT_INVERT, 255 },
684 { 19,164,162, 58, 26, 17, 21, 16, 20,"Slide U/D", BT_JOY_AXIS, 255 },
685 { 20,164,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
686 { 21,164,172, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_JOY_AXIS, 255 },
687 { 22,164,172,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
688 { 23,164,180, 58, 26, 21, 5, 22, 24,"throttle", BT_JOY_AXIS, 255 },
689 { 24,164,180,106, 8, 22, 13, 23, 0,"throttle", BT_INVERT, 255 },
690 { 25, 25,109, 85, 28, 3, 27, 12, 28,"REAR VIEW", BT_JOY_BUTTON, 255 },
691 { 26, 25, 70, 85, 28, 4, 2, 7, 8,"Drop Bomb", BT_JOY_BUTTON, 255 },
692 { 27, 25,117, 85, 28, 25, 30, 28, 29,"Afterburner", BT_JOY_BUTTON, 255 },
693 { 28,180,114, 79, 28, 12, 29, 25, 27,"Cycle Primary", BT_JOY_BUTTON, 255 },
694 { 29,180,122, 79, 28, 28, 18, 27, 30,"Cycle Secondary", BT_JOY_BUTTON, 255 },
695 { 30, 25,125, 85, 28, 27, 14, 29, 13,"Headlight", BT_JOY_BUTTON, 255 },
697 kc_item kc_superjoy[NUM_OTHER_CONTROLS] = {
698 { 0, 25, 46, 85, 26, 15, 1, 24, 5,"Fire primary", BT_JOY_BUTTON, 255 },
699 { 1, 25, 54, 85, 26, 0, 4, 5, 6,"Fire secondary", BT_JOY_BUTTON, 255 },
700 { 2, 25, 85, 85, 26, 26, 3, 9, 10,"Accelerate", BT_JOY_BUTTON, 255 },
701 { 3, 25, 93, 85, 26, 2, 25, 10, 11,"reverse", BT_JOY_BUTTON, 255 },
702 { 4, 25, 62, 85, 26, 1, 26, 6, 7,"Fire flare", BT_JOY_BUTTON, 255 },
703 { 5,180, 46, 79, 26, 23, 6, 0, 1,"Slide on", BT_JOY_BUTTON, 255 },
704 { 6,180, 54, 79, 26, 5, 7, 1, 4,"Slide left", BT_JOY_BUTTON, 255 },
705 { 7,180, 62, 79, 26, 6, 8, 4, 26,"Slide right", BT_JOY_BUTTON, 255 },
706 { 8,180, 70, 79, 26, 7, 9, 26, 9,"Slide up", BT_JOY_BUTTON, 255 },
707 { 9,180, 78, 79, 26, 8, 10, 8, 2,"Slide down", BT_JOY_BUTTON, 255 },
708 { 10,180, 90, 79, 26, 9, 11, 2, 3,"Bank on", BT_JOY_BUTTON, 255 },
709 { 11,180, 98, 79, 26, 10, 12, 3, 12,"Bank left", BT_JOY_BUTTON, 255 },
710 { 12,180,106, 79, 26, 11, 28, 11, 25,"Bank right", BT_JOY_BUTTON, 255 },
711 { 13, 22,154, 51, 26, 24, 15, 30, 14,"Pitch U/D", BT_JOY_AXIS, 255 },
712 { 14, 22,154, 99, 8, 30, 16, 13, 17,"Pitch U/D", BT_INVERT, 255 },
713 { 15, 22,162, 51, 26, 13, 0, 18, 16,"Turn L/R", BT_JOY_AXIS, 255 },
714 { 16, 22,162, 99, 8, 14, 17, 15, 19,"Turn L/R", BT_INVERT, 255 },
715 { 17,164,154, 58, 26, 16, 19, 14, 18,"Slide L/R", BT_JOY_AXIS, 255 },
716 { 18,164,154,106, 8, 29, 20, 17, 15,"Slide L/R", BT_INVERT, 255 },
717 { 19,164,162, 58, 26, 17, 21, 16, 20,"Slide U/D", BT_JOY_AXIS, 255 },
718 { 20,164,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
719 { 21,164,172, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_JOY_AXIS, 255 },
720 { 22,164,172,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
721 { 23,164,180, 58, 26, 21, 5, 22, 24,"throttle", BT_JOY_AXIS, 255 },
722 { 24,164,180,106, 8, 22, 13, 23, 0,"throttle", BT_INVERT, 255 },
723 { 25, 25,109, 85, 26, 3, 27, 12, 28,"REAR VIEW", BT_JOY_BUTTON, 255 },
724 { 26, 25, 70, 85, 26, 4, 2, 7, 8,"Drop Bomb", BT_JOY_BUTTON, 255 },
725 { 27, 25,117, 85, 26, 25, 30, 28, 29,"Afterburner", BT_JOY_BUTTON, 255 },
726 { 28,180,114, 79, 26, 12, 29, 25, 27,"Cycle Primary", BT_JOY_BUTTON, 255 },
727 { 29,180,122, 79, 26, 28, 18, 27, 30,"Cycle Secondary", BT_JOY_BUTTON, 255 },
728 { 30, 25,125, 85, 26, 27, 14, 29, 13,"Headlight", BT_JOY_BUTTON, 255 },
731 kc_item kc_mouse[NUM_OTHER_CONTROLS] = {
732 { 0, 25, 46, 85, 26, 28, 1, 28, 5,"Fire primary", BT_MOUSE_BUTTON, 255 },
733 { 1, 25, 54, 85, 26, 0, 4, 5, 6,"Fire secondary", BT_MOUSE_BUTTON, 255 },
734 { 2, 25, 85, 85, 26, 26, 3, 9, 10,"Accelerate", BT_MOUSE_BUTTON, 255 },
735 { 3, 25, 93, 85, 26, 2, 25, 10, 11,"reverse", BT_MOUSE_BUTTON, 255 },
736 { 4, 25, 62, 85, 26, 1, 26, 6, 7,"Fire flare", BT_MOUSE_BUTTON, 255 },
737 { 5,180, 46, 59, 26, 24, 6, 0, 1,"Slide on", BT_MOUSE_BUTTON, 255 },
738 { 6,180, 54, 59, 26, 5, 7, 1, 4,"Slide left", BT_MOUSE_BUTTON, 255 },
739 { 7,180, 62, 59, 26, 6, 8, 4, 26,"Slide right", BT_MOUSE_BUTTON, 255 },
740 { 8,180, 70, 59, 26, 7, 9, 26, 9,"Slide up", BT_MOUSE_BUTTON, 255 },
741 { 9,180, 78, 59, 26, 8, 10, 8, 2,"Slide down", BT_MOUSE_BUTTON, 255 },
742 { 10,180, 90, 59, 26, 9, 11, 2, 3,"Bank on", BT_MOUSE_BUTTON, 255 },
743 { 11,180, 98, 59, 26, 10, 12, 3, 12,"Bank left", BT_MOUSE_BUTTON, 255 },
744 { 12,180,106, 59, 26, 11, 28, 11, 25,"Bank right", BT_MOUSE_BUTTON, 255 },
745 { 13,103,138, 58, 26, 27, 15, 27, 14,"Pitch U/D", BT_MOUSE_AXIS, 255 },
746 { 14,103,138,106, 8, 23, 16, 13, 15,"Pitch U/D", BT_INVERT, 255 },
747 { 15,103,146, 58, 26, 13, 17, 14, 16,"Turn L/R", BT_MOUSE_AXIS, 255 },
748 { 16,103,146,106, 8, 14, 18, 15, 17,"Turn L/R", BT_INVERT, 255 },
749 { 17,103,154, 58, 26, 15, 19, 16, 18,"Slide L/R", BT_MOUSE_AXIS, 255 },
750 { 18,103,154,106, 8, 16, 20, 17, 19,"Slide L/R", BT_INVERT, 255 },
751 { 19,103,162, 58, 26, 17, 21, 18, 20,"Slide U/D", BT_MOUSE_AXIS, 255 },
752 { 20,103,162,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 },
753 { 21,103,170, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_MOUSE_AXIS, 255 },
754 { 22,103,170,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 },
755 { 23,103,182, 58, 26, 21, 14, 22, 24,"throttle", BT_MOUSE_AXIS, 255 },
756 { 24,103,182,106, 8, 22, 5, 23, 28,"throttle", BT_INVERT, 255 },
757 { 25, 25,109, 85, 26, 3, 27, 12, 27,"REAR VIEW", BT_MOUSE_BUTTON, 255 },
758 { 26, 25, 70, 85, 26, 4, 2, 7, 8,"Drop Bomb", BT_MOUSE_BUTTON, 255 },
759 { 27, 25,117, 85, 26, 25, 13, 25, 13,"Afterburner", BT_MOUSE_BUTTON, 255 },
764 //added on 2/4/99 by Victor Rachels to add new keys system
765 ubyte default_kconfig_d2x_settings[MAX_D2X_CONTROLS] = {
766 0x2 ,0xff,0x3 ,0xff,0x4 ,0xff,0x5 ,0xff,0x6 ,0xff,0x7 ,0xff,0x8 ,0xff,0x9 ,
767 0xff,0xa ,0xff,0xb ,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
768 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };
769 //end this section addition - VR
771 void kc_drawitem( kc_item *item, int is_current );
772 void kc_change_key( kc_item * item );
773 void kc_change_joybutton( kc_item * item );
774 void kc_change_mousebutton( kc_item * item );
775 void kc_next_joyaxis(kc_item *item); //added by WraithX on 11/22/00
776 void kc_change_joyaxis( kc_item * item );
777 void kc_change_mouseaxis( kc_item * item );
778 void kc_change_invert( kc_item * item );
779 void kconfig_read_fcs( int raw_axis );
780 void kconfig_set_fcs_button( int btn, int button );
781 void kconfig_read_external_controls( void );
783 // the following methods added by WraithX, 4/17/00
784 int isJoyRotationKey(int test_key)
786 if (test_key == kc_joystick[11].value ||
787 test_key == kc_joystick[12].value)
794 }// method isJoyRotationKey
796 int isMouseRotationKey(int test_key)
798 if (test_key == kc_mouse[11].value ||
799 test_key == kc_mouse[12].value)
806 }// method isMouseRotationKey
808 int isKeyboardRotationKey(int test_key)
810 if (test_key == kc_keyboard[0].value ||
811 test_key == kc_keyboard[1].value ||
812 test_key == kc_keyboard[2].value ||
813 test_key == kc_keyboard[3].value ||
814 test_key == kc_keyboard[4].value ||
815 test_key == kc_keyboard[5].value ||
816 test_key == kc_keyboard[6].value ||
817 test_key == kc_keyboard[7].value ||
818 test_key == kc_keyboard[20].value ||
819 test_key == kc_keyboard[21].value ||
820 test_key == kc_keyboard[22].value ||
821 test_key == kc_keyboard[23].value)
828 }// method isKeyboardRotationKey
829 // end addition - WraithX
831 int kconfig_is_axes_used(int axis)
834 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
835 if (( kc_joystick[i].type == BT_JOY_AXIS ) && (kc_joystick[i].value == axis ))
841 #ifdef TABLE_CREATION
842 int find_item_at( kc_item * items, int nitems, int x, int y )
846 for (i=0; i<nitems; i++ ) {
847 if ( ((items[i].x+items[i].w1)==x) && (items[i].y==y))
853 int find_next_item_up( kc_item * items, int nitems, int citem )
858 x = items[citem].x+items[citem].w1;
863 y = grd_curcanv->cv_bitmap.bm_h-1;
866 x = grd_curcanv->cv_bitmap.bm_w-1;
869 i = find_item_at( items, nitems, x, y );
875 int find_next_item_down( kc_item * items, int nitems, int citem )
880 x = items[citem].x+items[citem].w1;
884 if ( y > grd_curcanv->cv_bitmap.bm_h-1 ) {
887 if ( x > grd_curcanv->cv_bitmap.bm_w-1 ) {
891 i = find_item_at( items, nitems, x, y );
897 int find_next_item_right( kc_item * items, int nitems, int citem )
902 x = items[citem].x+items[citem].w1;
906 if ( x > grd_curcanv->cv_bitmap.bm_w-1 ) {
909 if ( y > grd_curcanv->cv_bitmap.bm_h-1 ) {
913 i = find_item_at( items, nitems, x, y );
919 int find_next_item_left( kc_item * items, int nitems, int citem )
924 x = items[citem].x+items[citem].w1;
929 x = grd_curcanv->cv_bitmap.bm_w-1;
932 y = grd_curcanv->cv_bitmap.bm_h-1;
935 i = find_item_at( items, nitems, x, y );
943 int get_item_height(kc_item *item)
948 if (item->value==255) {
951 switch( item->type ) {
953 strncpy( btext, key_text[item->value], 10 ); break;
954 case BT_MOUSE_BUTTON:
956 strncpy( btext, Text_string[mousebutton_text[item->value]], 10); break;
958 strncpy( btext, mousebutton_text[item->value], 10 ); break;
961 strncpy( btext, Text_string[mouseaxis_text[item->value]], 10 ); break;
964 sprintf(btext, "J%d B%d", j_button[item->value].joydev, j_Get_joydev_button_number(item->value));
965 #elif defined(SDL_INPUT)
966 if (joybutton_text[item->value])
967 strncpy(btext, joybutton_text[item->value], 10);
969 sprintf(btext, "BTN%2d", item->value + 1);
971 if ( joybutton_text[item->value] !=-1 )
972 strncpy( btext, Text_string[ joybutton_text[item->value] ], 10 );
974 sprintf( btext, "BTN%d", item->value );
979 sprintf( btext, "J%d A%d", j_axis[item->value].joydev, j_Get_joydev_axis_number (item->value) );
980 #elif defined(SDL_INPUT)
981 if (joyaxis_text[item->value])
982 strncpy(btext, joyaxis_text[item->value], 10);
984 sprintf(btext, "AXIS%2d", item->value + 1);
986 strncpy(btext, Text_string[joyaxis_text[item->value]], 10);
990 strncpy( btext, Text_string[invert_text[item->value]], 10 ); break;
993 gr_get_string_size(btext, &w, &h, &aw );
999 void kconfig_sub(kc_item * items,int nitems, char * title)
1001 grs_canvas * save_canvas;
1002 grs_font * save_font;
1003 int old_keyd_repeat;
1004 #ifdef NEWMENU_MOUSE
1005 int mouse_state, omouse_state, mx, my, x1, x2, y1, y2;
1006 int close_x, close_y, close_size;
1009 int i,k,ocitem,citem;
1010 int time_stopped = 0;
1015 if (!((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence)) )
1021 // if (Config_control_type == CONTROL_WINJOYSTICK) {
1023 // joydefsw_win_joyselect(title2); title = title2;
1025 // Int3(); // Get Samir...
1029 save_canvas = grd_curcanv;
1032 gr_set_current_canvas(NULL);
1033 save_font = grd_curcanv->cv_font;
1038 game_flush_inputs();
1039 old_keyd_repeat = keyd_repeat;
1042 //gr_clear_canvas( BM_XRGB(0,0,0) );
1044 nm_draw_background(0, 0, grd_curcanv->cv_bitmap.bm_w - 1, grd_curcanv->cv_bitmap.bm_h - 1);
1045 gr_palette_load (gr_palette);
1047 grd_curcanv->cv_font = MEDIUM3_FONT;
1051 p = strchr( title, '\n' );
1053 gr_string( 0x8000, LHY(8), title );
1058 // if ( items == kc_keyboard ) {
1059 // gr_string( 0x8000, 8, "Keyboard" );
1060 // } else if ( items == kc_joystick ) {
1061 // gr_string( 0x8000, 8, "Joysticks" );
1062 // } else if ( items == kc_mouse ) {
1063 // gr_string( 0x8000, 8, "Mouse" );
1066 #ifdef NEWMENU_MOUSE
1067 close_x = close_y = MenuHires?15:7;
1068 close_size = MenuHires?10:5;
1069 gr_setcolor( BM_XRGB(0, 0, 0) );
1070 gr_rect(close_x, close_y, close_x + close_size, close_y + close_size);
1071 gr_setcolor( BM_XRGB(21, 21, 21) );
1072 gr_rect(close_x + LHX(1), close_y + LHX(1), close_x + close_size - LHX(1), close_y + close_size - LHX(1));
1075 grd_curcanv->cv_font = GAME_FONT;
1076 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1079 gr_string( 0x8000, LHY(20), TXT_KCONFIG_STRING_1 );
1081 gr_string( 0x8000, LHY(20), "Enter changes, ctrl-d deletes, ctrl-r resets defaults, ESC exits");
1083 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1084 if ( items == kc_keyboard ) {
1085 gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
1086 gr_setcolor( BM_XRGB(31,27,6) );
1088 gr_scanline( LHX(98), LHX(106), LHY(42) );
1089 gr_scanline( LHX(120), LHX(128), LHY(42) );
1090 gr_pixel( LHX(98), LHY(43) );
1091 gr_pixel( LHX(98), LHY(44) );
1092 gr_pixel( LHX(128), LHY(43) );
1093 gr_pixel( LHX(128), LHY(44) );
1095 gr_string( LHX(109), LHY(40), "OR" );
1097 gr_scanline( LHX(253), LHX(261), LHY(42) );
1098 gr_scanline( LHX(274), LHX(283), LHY(42) );
1099 gr_pixel( LHX(253), LHY(43) );
1100 gr_pixel( LHX(253), LHY(44) );
1101 gr_pixel( LHX(283), LHY(43) );
1102 gr_pixel( LHX(283), LHY(44) );
1104 gr_string( LHX(264), LHY(40), "OR" );
1106 } else if ( items == kc_keybindings ) {
1107 gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
1108 gr_setcolor( BM_XRGB(31,27,6) );
1110 gr_scanline( LHX(98), LHX(106), LHY(42) );
1111 gr_scanline( LHX(120), LHX(128), LHY(42) );
1112 gr_pixel( LHX(98), LHY(43) );
1113 gr_pixel( LHX(98), LHY(44) );
1114 gr_pixel( LHX(128), LHY(43) );
1115 gr_pixel( LHX(128), LHY(44) );
1117 gr_string( LHX(109), LHY(40), "OR" );
1119 gr_scanline( LHX(253), LHX(261), LHY(42) );
1120 gr_scanline( LHX(274), LHX(283), LHY(42) );
1121 gr_pixel( LHX(253), LHY(43) );
1122 gr_pixel( LHX(253), LHY(44) );
1123 gr_pixel( LHX(283), LHY(43) );
1124 gr_pixel( LHX(283), LHY(44) );
1126 gr_string( LHX(264), LHY(40), "OR" );
1128 } if ( items == kc_joystick ) {
1129 gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
1130 gr_setcolor( BM_XRGB(31,27,6) );
1131 gr_scanline( LHX(18), LHX(135), LHY(37) );
1132 gr_scanline( LHX(181), LHX(294), LHY(37) );
1133 gr_scanline( LHX(18), LHX(144), LHY(119+18) );
1134 gr_scanline( LHX(174), LHX(294), LHY(119+18) );
1135 gr_string( 0x8000, LHY(35), TXT_BUTTONS );
1136 gr_string( 0x8000,LHY(117+18), TXT_AXES );
1137 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1138 gr_string( LHX(81), LHY(137+8), TXT_AXIS );
1139 gr_string( LHX(111), LHY(137+8), TXT_INVERT );
1140 gr_string( LHX(230), LHY(137+8), TXT_AXIS );
1141 gr_string( LHX(260), LHY(137+8), TXT_INVERT );
1142 } else if ( items == kc_mouse ) {
1143 gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
1144 gr_setcolor( BM_XRGB(31,27,6) );
1145 gr_scanline( LHX(18), LHX(135), LHY(37) );
1146 gr_scanline( LHX(181), LHX(294), LHY(37) );
1147 gr_scanline( LHX(18), LHX(144), LHY(119+5) );
1148 gr_scanline( LHX(174), LHX(294), LHY(119+5) );
1149 gr_string( 0x8000, LHY(35), TXT_BUTTONS );
1150 gr_string( 0x8000,LHY(117+5), TXT_AXES );
1151 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1152 gr_string( LHX(169), LHY(129), TXT_AXIS );
1153 gr_string( LHX(199), LHY(129), TXT_INVERT );
1156 else if ( items == kc_d2x )
1158 gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
1159 gr_setcolor( BM_XRGB(31,27,6) );
1161 gr_string(LHX( 94), LHY(40), "KB");
1162 gr_string(LHX(121), LHY(40), "JOY");
1166 for (i=0; i<nitems; i++ ) {
1167 kc_drawitem( &items[i], 0 );
1171 kc_drawitem( &items[citem], 1 );
1173 newmenu_show_cursor();
1175 #ifdef NEWMENU_MOUSE
1176 mouse_state = omouse_state = 0;
1180 // Windows addendum to allow for kconfig input.
1183 //see if redbook song needs to be restarted
1184 songs_check_redbook_repeat();
1188 #ifdef NEWMENU_MOUSE
1189 omouse_state = mouse_state;
1190 mouse_state = mouse_button_state(0);
1193 if ( !time_stopped ) {
1195 if (multi_menu_poll() == -1)
1204 case KEY_COMMAND+KEY_SHIFTED+KEY_3:
1205 case KEY_PRINT_SCREEN:
1206 save_screen_shot(0);
1208 case KEY_CTRLED+KEY_D:
1209 items[citem].value = 255;
1210 kc_drawitem( &items[citem], 1 );
1212 case KEY_CTRLED+KEY_R:
1213 if ( items==kc_keyboard ) {
1214 for (i=0; i<NUM_KEY_CONTROLS; i++ ) {
1215 items[i].value=default_kconfig_settings[0][i];
1216 kc_drawitem( &items[i], 0 );
1218 } else if ( items==kc_keybindings ) {
1219 for (i=0; i<NUM_KEY_CONTROLS; i++ )
1221 items[i].value=default_kconfig_settings[0][i];
1222 kc_drawitem( &items[i], 0 );
1225 } else if ( items==kc_d2x ) {
1226 for(i=0;i<NUM_D2X_CONTROLS;i++)
1228 items[i].value=default_kconfig_d2x_settings[i];
1229 kc_drawitem( &items[i], 0 );
1234 // hack for firebire and mousestick default controls since I made
1235 // them the same control type -- dumb dumb dumb
1236 if (joy_have_firebird())
1237 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1238 items[i].value = default_firebird_settings[i];
1239 kc_drawitem( &items[i], 0 );
1241 else if (joy_have_mousestick())
1242 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1243 items[i].value = default_mousestick_settings[i];
1244 kc_drawitem( &items[i], 0 );
1247 #endif // note link to above else
1248 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1249 items[i].value = default_kconfig_settings[Config_control_type][i];
1250 kc_drawitem( &items[i], 0 );
1253 kc_drawitem( &items[citem], 1 );
1256 items[citem].value=255;
1257 kc_drawitem( &items[citem], 1 );
1261 #ifdef TABLE_CREATION
1262 if (items[citem].u==-1) items[citem].u=find_next_item_up( items,nitems, citem);
1264 citem = items[citem].u;
1269 #ifdef TABLE_CREATION
1270 if (items[citem].d==-1) items[citem].d=find_next_item_down( items,nitems, citem);
1272 citem = items[citem].d;
1276 #ifdef TABLE_CREATION
1277 if (items[citem].l==-1) items[citem].l=find_next_item_left( items,nitems, citem);
1279 citem = items[citem].l;
1283 #ifdef TABLE_CREATION
1284 if (items[citem].r==-1) items[citem].r=find_next_item_right( items,nitems, citem);
1286 citem = items[citem].r;
1290 switch( items[citem].type ) {
1291 case BT_KEY: kc_change_key( &items[citem] ); break;
1292 case BT_MOUSE_BUTTON: kc_change_mousebutton( &items[citem] ); break;
1293 case BT_MOUSE_AXIS: kc_change_mouseaxis( &items[citem] ); break;
1294 case BT_JOY_BUTTON: kc_change_joybutton( &items[citem] ); break;
1295 case BT_JOY_AXIS: kc_change_joyaxis( &items[citem] ); break;
1296 case BT_INVERT: kc_change_invert( &items[citem] ); break;
1299 //the following case added by WraithX on 11/22/00 to work around the weird joystick bug...
1301 switch(items[citem].type)
1304 kc_next_joyaxis(&items[citem]);
1308 //end addition by WraithX
1311 grd_curcanv->cv_font = save_font;
1313 gr_set_current_canvas( save_canvas );
1314 keyd_repeat = old_keyd_repeat;
1315 game_flush_inputs();
1316 newmenu_hide_cursor();
1320 #ifdef TABLE_CREATION
1321 case KEY_DEBUGGED+KEY_F12: {
1323 for (i=0; i<NUM_KEY_CONTROLS; i++ ) {
1324 kc_keyboard[i].u = find_next_item_up( kc_keyboard,NUM_KEY_CONTROLS, i);
1325 kc_keyboard[i].d = find_next_item_down( kc_keyboard,NUM_KEY_CONTROLS, i);
1326 kc_keyboard[i].l = find_next_item_left( kc_keyboard,NUM_KEY_CONTROLS, i);
1327 kc_keyboard[i].r = find_next_item_right( kc_keyboard,NUM_KEY_CONTROLS, i);
1329 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1330 kc_joystick[i].u = find_next_item_up( kc_joystick,NUM_OTHER_CONTROLS, i);
1331 kc_joystick[i].d = find_next_item_down( kc_joystick,NUM_OTHER_CONTROLS, i);
1332 kc_joystick[i].l = find_next_item_left( kc_joystick,NUM_OTHER_CONTROLS, i);
1333 kc_joystick[i].r = find_next_item_right( kc_joystick,NUM_OTHER_CONTROLS, i);
1335 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1336 kc_mouse[i].u = find_next_item_up( kc_mouse,NUM_OTHER_CONTROLS, i);
1337 kc_mouse[i].d = find_next_item_down( kc_mouse,NUM_OTHER_CONTROLS, i);
1338 kc_mouse[i].l = find_next_item_left( kc_mouse,NUM_OTHER_CONTROLS, i);
1339 kc_mouse[i].r = find_next_item_right( kc_mouse,NUM_OTHER_CONTROLS, i);
1341 fp = fopen( "kconfig.cod", "wt" );
1343 fprintf( fp, "ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS] = {\n" );
1344 for (i=0; i<CONTROL_MAX_TYPES; i++ ) {
1346 fprintf( fp, "{0x%x", kconfig_settings[i][0] );
1347 for (j=1; j<MAX_CONTROLS; j++ )
1348 fprintf( fp, ",0x%x", kconfig_settings[i][j] );
1349 fprintf( fp, "},\n" );
1351 fprintf( fp, "};\n" );
1353 fprintf( fp, "\nkc_item kc_keyboard[NUM_KEY_CONTROLS] = {\n" );
1354 for (i=0; i<NUM_KEY_CONTROLS; i++ ) {
1355 fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
1356 kc_keyboard[i].id, kc_keyboard[i].x, kc_keyboard[i].y, kc_keyboard[i].w1, kc_keyboard[i].w2,
1357 kc_keyboard[i].u, kc_keyboard[i].d, kc_keyboard[i].l, kc_keyboard[i].r,
1358 34, kc_keyboard[i].text, 34, btype_text[kc_keyboard[i].type] );
1360 fprintf( fp, "};" );
1362 fprintf( fp, "\nkc_item kc_joystick[NUM_OTHER_CONTROLS] = {\n" );
1363 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1364 if (kc_joystick[i].type == BT_JOY_BUTTON)
1365 fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
1366 kc_joystick[i].id, kc_joystick[i].x, kc_joystick[i].y, kc_joystick[i].w1, kc_joystick[i].w2,
1367 kc_joystick[i].u, kc_joystick[i].d, kc_joystick[i].l, kc_joystick[i].r,
1368 34, kc_joystick[i].text, 34, btype_text[kc_joystick[i].type] );
1370 fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
1371 kc_joystick[i].id, kc_joystick[i].x, kc_joystick[i].y, kc_joystick[i].w1, kc_joystick[i].w2,
1372 kc_joystick[i].u, kc_joystick[i].d, kc_joystick[i].l, kc_joystick[i].r,
1373 34, kc_joystick[i].text, 34, btype_text[kc_joystick[i].type] );
1375 fprintf( fp, "};" );
1377 fprintf( fp, "\nkc_item kc_mouse[NUM_OTHER_CONTROLS] = {\n" );
1378 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
1379 fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
1380 kc_mouse[i].id, kc_mouse[i].x, kc_mouse[i].y, kc_mouse[i].w1, kc_mouse[i].w2,
1381 kc_mouse[i].u, kc_mouse[i].d, kc_mouse[i].l, kc_mouse[i].r,
1382 34, kc_mouse[i].text, 34, btype_text[kc_mouse[i].type] );
1384 fprintf( fp, "};" );
1393 #ifdef NEWMENU_MOUSE
1394 if ( (mouse_state && !omouse_state) || (mouse_state && omouse_state) ) {
1397 mouse_get_pos(&mx, &my);
1398 for (i=0; i<nitems; i++ ) {
1399 item_height = get_item_height( &items[i] );
1400 x1 = grd_curcanv->cv_bitmap.bm_x + LHX(items[i].x) + LHX(items[i].w1);
1401 x2 = x1 + LHX(items[i].w2);
1402 y1 = grd_curcanv->cv_bitmap.bm_y + LHY(items[i].y);
1403 y2 = y1 + LHX(item_height);
1404 if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2))) {
1410 else if ( !mouse_state && omouse_state ) {
1413 mouse_get_pos(&mx, &my);
1414 item_height = get_item_height( &items[citem] );
1415 x1 = grd_curcanv->cv_bitmap.bm_x + LHX(items[citem].x) + LHX(items[citem].w1);
1416 x2 = x1 + LHX(items[citem].w2);
1417 y1 = grd_curcanv->cv_bitmap.bm_y + LHY(items[citem].y);
1418 y2 = y1 + LHY(item_height);
1419 if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2))) {
1420 newmenu_hide_cursor();
1421 switch( items[citem].type ) {
1422 case BT_KEY: kc_change_key( &items[citem] ); break;
1423 case BT_MOUSE_BUTTON: kc_change_mousebutton( &items[citem] ); break;
1424 case BT_MOUSE_AXIS: kc_change_mouseaxis( &items[citem] ); break;
1425 case BT_JOY_BUTTON: kc_change_joybutton( &items[citem] ); break;
1426 case BT_JOY_AXIS: kc_change_joyaxis( &items[citem] ); break;
1427 case BT_INVERT: kc_change_invert( &items[citem] ); break;
1429 newmenu_show_cursor();
1431 x1 = grd_curcanv->cv_bitmap.bm_x + close_x + LHX(1);
1432 x2 = x1 + close_size - LHX(1);
1433 y1 = grd_curcanv->cv_bitmap.bm_y + close_y + LHX(1);
1434 y2 = y1 + close_size - LHX(1);
1435 if ( ((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) ) {
1436 grd_curcanv->cv_font = save_font;
1437 gr_set_current_canvas( save_canvas );
1438 keyd_repeat = old_keyd_repeat;
1439 game_flush_inputs();
1440 newmenu_hide_cursor();
1448 #endif // NEWMENU_MOUSE
1450 if (ocitem!=citem) {
1451 newmenu_hide_cursor();
1452 kc_drawitem( &items[ocitem], 0 );
1453 kc_drawitem( &items[citem], 1 );
1454 newmenu_show_cursor();
1460 void kc_drawitem( kc_item *item, int is_current )
1466 gr_set_fontcolor( BM_XRGB(20,20,29), -1 );
1468 gr_set_fontcolor( BM_XRGB(15,15,24), -1 );
1469 gr_string( LHX(item->x), LHY(item->y), item->text );
1471 if (item->value==255) {
1472 strcpy( btext, "" );
1474 switch( item->type ) {
1476 strncpy( btext, key_text[item->value], 10 ); break;
1477 case BT_MOUSE_BUTTON:
1479 //strncpy( btext, Text_string[mousebutton_text[item->value]], 10 ); break;
1480 strncpy( btext, (item->value <= 3)?Text_string[mousebutton_text[item->value]]:mousebutton_textra[item->value-3], 10 ); break;
1482 strncpy( btext, mousebutton_text[item->value], 10 ); break;
1485 strncpy( btext, Text_string[mouseaxis_text[item->value]], 10 ); break;
1487 #ifdef USE_LINUX_JOY
1488 sprintf(btext, "J%d B%d", j_button[item->value].joydev, j_Get_joydev_button_number(item->value));
1489 #elif defined(SDL_INPUT)
1490 if (joybutton_text[item->value])
1491 strncpy(btext, joybutton_text[item->value], 10);
1493 sprintf(btext, "BTN%2d", item->value + 1);
1497 if (joybutton_text[item->value] != -1)
1498 strncpy( btext, Text_string[ joybutton_text[item->value] ], 10 );
1500 sprintf( btext, "BTN%2d", item->value+1 );
1502 if ( joybutton_text[item->value] !=-1 )
1503 strncpy( btext, Text_string[ joybutton_text[item->value] ], 10 );
1505 sprintf( btext, "BTN%d", item->value );
1508 strncpy( btext, joy_btn_name( item->value ), 10);
1510 sprintf( btext, "BTN%d", item->value );
1515 #ifdef USE_LINUX_JOY
1516 sprintf(btext, "J%d A%d", j_axis[item->value].joydev, j_Get_joydev_axis_number(item->value));
1517 #elif defined(SDL_INPUT)
1518 if (joyaxis_text[item->value])
1519 strncpy(btext, joyaxis_text[item->value], 10);
1521 sprintf(btext, "AXIS%2d", item->value + 1);
1523 strncpy(btext, Text_string[joyaxis_text[item->value]], 10);
1527 strncpy( btext, Text_string[invert_text[item->value]], 10 ); break;
1531 gr_get_string_size(btext, &w, &h, &aw );
1534 gr_setcolor( BM_XRGB(21,0,24) );
1536 gr_setcolor( BM_XRGB(16,0,19) );
1537 gr_urect( LHX(item->w1+item->x), LHY(item->y-1), LHX(item->w1+item->x+item->w2), LHY(item->y)+h );
1539 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1541 x = LHX(item->w1+item->x)+((LHX(item->w2)-w)/2);
1543 gr_string( x, LHY(item->y), btext );
1548 static int looper=0;
1550 void kc_drawquestion( kc_item *item )
1554 gr_get_string_size("?", &w, &h, &aw );
1556 c = BM_XRGB(21,0,24);
1558 //@@gr_setcolor( gr_fade_table[fades[looper]*256+c] );
1559 gr_setcolor(BM_XRGB(21*fades[looper]/31,0,24*fades[looper]/31));
1561 if (looper>63) looper=0;
1563 gr_urect( LHX(item->w1+item->x), LHY(item->y-1), LHX(item->w1+item->x+item->w2), LHY(item->y)+h );
1565 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1567 x = LHX(item->w1+item->x)+((LHX(item->w2)-w)/2);
1569 gr_string( x, LHY(item->y), "?" );
1573 void kc_change_key( kc_item * item )
1578 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1580 gr_string( 0x8000, LHY(INFO_Y), TXT_PRESS_NEW_KEY );
1582 game_flush_inputs();
1586 while( (k!=KEY_ESC) && (keycode==255) )
1589 if ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence))
1592 // if ( Game_mode & GM_MULTI )
1593 // GameLoop( 0, 0 ); // Continue
1595 timer_delay(f0_1/10);
1596 kc_drawquestion( item );
1598 for (i=0; i<256; i++ ) {
1599 if (keyd_pressed[i] && (strlen(key_text[i])>0)) {
1601 for (n=0; n<sizeof(system_keys); n++ )
1602 if ( system_keys[n] == i )
1611 for (i=0; i<Num_items; i++ ) {
1612 n = item - All_items;
1613 if ( (i!=n) && (All_items[i].type==BT_KEY) && (All_items[i].value==keycode) ) {
1614 All_items[i].value = 255;
1615 kc_drawitem( &All_items[i], 0 );
1618 item->value = keycode;
1620 kc_drawitem( item, 1 );
1622 gr_set_fontcolor( BM_XRGB(28,28,28), BM_XRGB(0,0,0) );
1624 nm_restore_background( 0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h );
1626 game_flush_inputs();
1630 void kc_change_joybutton( kc_item * item )
1635 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1637 gr_string( 0x8000, LHY(INFO_Y), TXT_PRESS_NEW_JBUTTON );
1639 game_flush_inputs();
1643 while( (k!=KEY_ESC) && (code==255))
1646 if ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence))
1649 // if ( Game_mode & GM_MULTI )
1650 // GameLoop( 0, 0 ); // Continue
1652 timer_delay(f0_1/10);
1654 if (k == KEY_PRINT_SCREEN)
1655 save_screen_shot(0);
1657 kc_drawquestion( item );
1659 WIN(code = joydefsw_do_button());
1662 code = joy_do_buttons();
1665 #if !defined(WINDOWS) && !defined(MACINTOSH)
1666 if (Config_control_type==CONTROL_THRUSTMASTER_FCS) {
1668 joystick_read_raw_axis( JOY_ALL_AXIS, axis );
1669 kconfig_read_fcs( axis[3] );
1670 if ( joy_get_button_state(7) ) code = 7;
1671 if ( joy_get_button_state(11) ) code = 11;
1672 if ( joy_get_button_state(15) ) code = 15;
1673 if ( joy_get_button_state(19) ) code = 19;
1674 for (i=0; i<4; i++ ) {
1675 if ( joy_get_button_state(i) )
1678 } else if (Config_control_type==CONTROL_FLIGHTSTICK_PRO) {
1679 for (i=4; i<20; i++ ) {
1680 if ( joy_get_button_state(i) ) {
1682 mprintf(( 0, "JB: %d\n", code ));
1686 for (i = 0; i < JOY_MAX_BUTTONS; i++)
1688 if ( joy_get_button_state(i) )
1695 for (i=0; i<Num_items; i++ ) {
1696 n = item - All_items;
1697 if ( (i!=n) && (All_items[i].type==BT_JOY_BUTTON) && (All_items[i].value==code) ) {
1698 All_items[i].value = 255;
1699 kc_drawitem( &All_items[i], 0 );
1704 kc_drawitem( item, 1 );
1705 nm_restore_background( 0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h );
1706 game_flush_inputs();
1709 void kc_change_mousebutton( kc_item * item )
1714 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1716 gr_string( 0x8000, LHY(INFO_Y), TXT_PRESS_NEW_MBUTTON );
1718 game_flush_inputs();
1722 while( (k!=KEY_ESC) && (code==255))
1725 if ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence))
1728 // if ( Game_mode & GM_MULTI )
1729 // GameLoop( 0, 0 ); // Continue
1731 timer_delay(f0_1/10);
1733 if (k == KEY_PRINT_SCREEN)
1734 save_screen_shot(0);
1736 kc_drawquestion( item );
1738 b = mouse_get_btns();
1739 for (i = 0; i < 16; i++ ) {
1745 for (i=0; i<Num_items; i++ ) {
1746 n = item - All_items;
1747 if ( (i!=n) && (All_items[i].type==BT_MOUSE_BUTTON) && (All_items[i].value==code) ) {
1748 All_items[i].value = 255;
1749 kc_drawitem( &All_items[i], 0 );
1754 kc_drawitem( item, 1 );
1755 nm_restore_background( 0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h );
1756 game_flush_inputs();
1761 // the following function added by WraithX on 11/22/00 to work around the weird joystick bug... - modified my Matt Mueller to skip already allocated axes
1762 void kc_next_joyaxis(kc_item *item)
1764 int n, i, k, max, tries;
1771 // I modelled this ifdef after the code in the kc_change_joyaxis method.
1772 // So, if somethin's not workin here, it might not be workin there either.
1775 code = (item->value + 1) % max;
1779 for (i = 0; i < Num_items; i++)
1781 n = item - All_items;
1782 if ((i != n) && (All_items[i].type == BT_JOY_AXIS) && (All_items[i].value == code))
1785 return; // all axes allocated already
1786 i = -1; // -1 so the i++ will push back to 0
1787 code = (item->value + ++tries) % max; // try next axis
1794 kc_drawitem(item, 1);
1795 nm_restore_background(0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h);
1796 game_flush_inputs();
1798 }//method kc_next_joyaxis
1799 //end addition by WraithX
1802 void kc_change_joyaxis( kc_item * item )
1804 int axis[JOY_MAX_AXES];
1805 int old_axis[JOY_MAX_AXES];
1806 int numaxis = joy_num_axes;
1810 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1812 gr_string( 0x8000, LHY(INFO_Y), TXT_MOVE_NEW_JOY_AXIS );
1814 game_flush_inputs();
1819 joystick_read_raw_axis( JOY_ALL_AXIS+JOY_EXT_AXIS, old_axis );
1821 joystick_read_raw_axis( JOY_ALL_AXIS, old_axis );
1824 while( (k!=KEY_ESC) && (code==255))
1827 if ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence))
1830 // if ( Game_mode & GM_MULTI )
1831 // GameLoop( 0, 0 ); // Continue
1833 timer_delay(f0_1/10);
1835 if (k == KEY_PRINT_SCREEN)
1836 save_screen_shot(0);
1838 kc_drawquestion( item );
1841 joystick_read_raw_axis( JOY_ALL_AXIS+JOY_EXT_AXIS, axis );
1843 joystick_read_raw_axis( JOY_ALL_AXIS, axis );
1846 for (i=0; i<numaxis; i++ ) {
1847 #if defined (MACINTOSH)
1848 if ( abs(axis[i]-old_axis[i])>100 )
1849 #elif defined(WINDOWS)
1850 if ( abs(axis[i]-old_axis[i])>1024 )
1852 if ( abs(axis[i]-old_axis[i])>200 )
1856 con_printf(CON_DEBUG, "Axis Movement detected: Axis %i\n", i);
1858 //old_axis[i] = axis[i];
1860 for (i=0; i<Num_items; i++ )
1862 n = item - All_items;
1863 if ( (i!=n) && (All_items[i].type==BT_JOY_AXIS) && (All_items[i].value==code) )
1869 for (i=0; i<Num_items; i++ ) {
1870 n = item - All_items;
1871 if ( (i!=n) && (All_items[i].type==BT_JOY_AXIS) && (All_items[i].value==code) ) {
1872 All_items[i].value = 255;
1873 kc_drawitem( &All_items[i], 0 );
1879 kc_drawitem( item, 1 );
1880 nm_restore_background( 0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h );
1881 game_flush_inputs();
1885 void kc_change_mouseaxis( kc_item * item )
1894 gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
1896 gr_string( 0x8000, LHY(INFO_Y), TXT_MOVE_NEW_MSE_AXIS );
1898 game_flush_inputs();
1902 mouse_get_delta( &dx, &dy );
1904 while( (k!=KEY_ESC) && (code==255))
1907 if ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME) && (!Endlevel_sequence))
1910 // if ( Game_mode & GM_MULTI )
1911 // GameLoop( 0, 0 ); // Continue
1913 timer_delay(f0_1/10);
1915 if (k == KEY_PRINT_SCREEN)
1916 save_screen_shot(0);
1918 kc_drawquestion( item );
1921 mouse_get_delta_z( &dx, &dy, &dz );
1923 mouse_get_delta( &dx, &dy );
1925 if ( abs(dx)>20 ) code = 0;
1926 if ( abs(dy)>20 ) code = 1;
1928 if ( abs(dz)>20 ) code = 2;
1932 for (i=0; i<Num_items; i++ ) {
1933 n = item - All_items;
1934 if ( (i!=n) && (All_items[i].type==BT_MOUSE_AXIS) && (All_items[i].value==code) ) {
1935 All_items[i].value = 255;
1936 kc_drawitem( &All_items[i], 0 );
1941 kc_drawitem( item, 1 );
1942 nm_restore_background( 0, LHY(INFO_Y), LHX(310), grd_curcanv->cv_font->ft_h );
1943 game_flush_inputs();
1948 void kc_change_invert( kc_item * item )
1950 game_flush_inputs();
1957 kc_drawitem( item, 1 );
1961 #include "screens.h"
1963 void kconfig(int n, char * title)
1966 grs_bitmap *save_bm;
1968 set_screen_mode( SCREEN_MENU );
1973 save_bm = gr_create_bitmap( grd_curcanv->cv_bitmap.bm_w, grd_curcanv->cv_bitmap.bm_h );
1974 Assert( save_bm != NULL );
1976 gr_bm_bitblt(grd_curcanv->cv_bitmap.bm_w, grd_curcanv->cv_bitmap.bm_w,
1977 0, 0, 0, 0, &grd_curcanv->cv_bitmap, save_bm );
1980 case 0:kconfig_sub( kc_keyboard, NUM_KEY_CONTROLS, title );break;
1981 case 1:kconfig_sub( kc_joystick, NUM_OTHER_CONTROLS, title );break;
1982 case 2:kconfig_sub( kc_mouse, NUM_OTHER_CONTROLS, title ); break;
1983 case 3:kconfig_sub( kc_superjoy, NUM_OTHER_CONTROLS, title); break;
1984 case 4:kconfig_sub( kc_keybindings, NUM_KEY_CONTROLS, title ); break;
1986 //added on 2/4/99 by Victor Rachels for new keys menu
1987 case 4:kconfig_sub( kc_d2x, NUM_D2X_CONTROLS, title ); break;
1988 //end this section addition - VR
1996 gr_bitmap(0, 0, save_bm);
1997 gr_free_bitmap(save_bm);
1999 #if 0 // set_screen_mode always calls this later... right?
2000 reset_cockpit(); //force cockpit redraw next time
2003 // Update save values...
2005 for (i=0; i<NUM_KEY_CONTROLS; i++ )
2006 kconfig_settings[0][i] = kc_keyboard[i].value;
2008 for (j=0; j<256; j++)
2010 for (i=0; i<NUM_KEY_CONTROLS; i++ )
2011 if (!strncmp(key_binding(j), kc_bind_text[i], 13)) {
2012 cmd_appendf("unbind %s", key_text[j]);
2016 for (i=0; i<NUM_KEY_CONTROLS; i++ )
2017 if (kc_keybindings[i].value != 255)
2018 cmd_appendf("bind %s \"%s\"", key_text[kc_keybindings[i].value], kc_bind_text[i]);
2020 while (cmd_queue_process())
2023 if ( (Config_control_type>0) && (Config_control_type<5)) {
2024 for (i=0; i<NUM_OTHER_CONTROLS; i++ )
2025 kconfig_settings[Config_control_type][i] = kc_joystick[i].value;
2026 } else if (Config_control_type>4 && Config_control_type<CONTROL_WINJOYSTICK) {
2027 for (i=0; i<NUM_OTHER_CONTROLS; i++ )
2028 kconfig_settings[Config_control_type][i] = kc_mouse[i].value;
2030 else if (Config_control_type == CONTROL_WINJOYSTICK) {
2031 for (i=0; i<NUM_OTHER_CONTROLS; i++ )
2032 kconfig_settings[Config_control_type][i] = kc_superjoy[i].value;
2036 for (i=0; i<NUM_D2X_CONTROLS; i++)
2037 kconfig_d2x_settings[i] = kc_d2x[i].value;
2042 void kconfig_read_fcs( int raw_axis )
2044 int raw_button, button, axis_min[4], axis_center[4], axis_max[4];
2046 if (Config_control_type!=CONTROL_THRUSTMASTER_FCS) return;
2048 joy_get_cal_vals(axis_min, axis_center, axis_max);
2050 if ( axis_max[3] > 1 )
2051 raw_button = (raw_axis*100)/axis_max[3];
2055 if ( raw_button > 88 )
2057 else if ( raw_button > 63 )
2059 else if ( raw_button > 39 )
2061 else if ( raw_button > 15 )
2066 kconfig_set_fcs_button( 19, button );
2067 kconfig_set_fcs_button( 15, button );
2068 kconfig_set_fcs_button( 11, button );
2069 kconfig_set_fcs_button( 7, button );
2073 void kconfig_set_fcs_button( int btn, int button )
2075 int state,time_down,upcount,downcount;
2076 state = time_down = upcount = downcount = 0;
2078 if ( joy_get_button_state(btn) ) {
2079 if ( btn==button ) {
2081 time_down = FrameTime;
2086 if ( btn==button ) {
2088 time_down = FrameTime;
2095 joy_set_btn_values( btn, state, time_down, downcount, upcount );
2101 fix Last_angles_p = 0;
2102 fix Last_angles_b = 0;
2103 fix Last_angles_h = 0;
2104 ubyte Last_angles_read = 0;
2106 extern int VR_sensitivity;
2108 int VR_sense_range[3] = { 25, 50, 75 };
2110 #if 0 //ndef MACINTOSH
2115 fix yaw, pitch, roll;
2118 //------ read vfx1 helmet --------
2119 if (vfx1_installed) {
2120 vfx_get_data(&yaw,&pitch,&roll,&buttons);
2121 } else if (iglasses_headset_installed) {
2122 iglasses_read_headset( &yaw, &pitch, &roll );
2123 } else if (Victor_headset_installed) {
2124 victor_read_headset_filtered( &yaw, &pitch, &roll );
2129 Use_player_head_angles = 0;
2130 if ( Last_angles_read ) {
2134 if ( (Last_angles_h < (F1_0/4) ) && (yaw > ((F1_0*3)/4) ) )
2136 else if ( (yaw < (F1_0/4) ) && (Last_angles_h > ((F1_0*3)/4) ) )
2139 Controls.pitch_time += fixmul((pitch- Last_angles_p)*VR_sense_range[VR_sensitivity],FrameTime);
2140 Controls.heading_time+= fixmul((yaw1 - Last_angles_h)*VR_sense_range[VR_sensitivity],FrameTime);
2141 Controls.bank_time += fixmul((roll - Last_angles_b)*VR_sense_range[VR_sensitivity],FrameTime);
2143 Last_angles_read = 1;
2144 Last_angles_p = pitch;
2145 Last_angles_h = yaw;
2146 Last_angles_b = roll;
2153 #ifndef __MSDOS__ // WINDOWS
2154 #define JOYSTICK_READ_TIME (F1_0/40) // Read joystick at 40 Hz.
2156 #define JOYSTICK_READ_TIME (F1_0/10) // Read joystick at 10 Hz.
2159 fix LastReadTime = 0;
2161 fix joy_axis[JOY_MAX_AXES];
2163 ubyte kc_use_external_control = 0;
2164 ubyte kc_enable_external_control = 0;
2165 ubyte kc_external_intno = 0;
2166 ext_control_info *kc_external_control = NULL;
2167 char *kc_external_name = NULL;
2168 ubyte kc_external_version = 0;
2169 extern int Automap_active;
2171 void kconfig_init_external_controls(int intno, int address)
2174 kc_external_intno = intno;
2175 kc_external_control = (ext_control_info *)address;
2176 kc_use_external_control = 1;
2177 kc_enable_external_control = 1;
2179 i = FindArg ( "-xname" );
2181 kc_external_name = Args[i+1];
2183 kc_external_name = "External Controller";
2185 for (i=0;i<strlen (kc_external_name);i++)
2186 if (kc_external_name[i]=='_')
2187 kc_external_name[i]=' ';
2189 i = FindArg ( "-xver" );
2191 kc_external_version = atoi(Args[i+1]);
2193 printf( "%s int: 0x%x, data: 0x%p, ver:%d\n", kc_external_name, kc_external_intno, kc_external_control, kc_external_version );
2197 #if !defined(MACINTOSH)
2198 /*void kconfig_read_external_controls()
2202 if ( !kc_enable_external_control && !CybermouseActive)
2205 if ( kc_external_version == 0 )
2206 memset( kc_external_control, 0, sizeof(control_info) );
2207 else if ( kc_external_version > 0 ) {
2208 memset( kc_external_control, 0, sizeof(control_info)+sizeof(vms_angvec) + 64 );
2209 if ( kc_external_version > 1 ) {
2210 // Write ship pos and angles to external controls...
2211 ubyte *temp_ptr = (ubyte *)kc_external_control;
2212 vms_vector *ship_pos;
2213 vms_matrix *ship_orient;
2214 memset( kc_external_control, 0, sizeof(control_info)+sizeof(vms_angvec) + 64 + sizeof(vms_vector)+sizeof(vms_matrix) );
2215 temp_ptr += sizeof(control_info)+sizeof(vms_angvec) + 64;
2216 ship_pos = (vms_vector *)temp_ptr;
2217 temp_ptr += sizeof(vms_vector);
2218 ship_orient = (vms_matrix *)temp_ptr;
2219 // Fill in ship postion...
2220 *ship_pos = Objects[Players[Player_num].objnum].pos;
2221 // Fill in ship orientation...
2222 *ship_orient = Objects[Players[Player_num].objnum].orient;
2226 if ( Automap_active ) // (If in automap...)
2227 kc_external_control->automap_state = 1;
2228 memset(&r,0,sizeof(r));
2232 if (!CybermouseActive)
2233 int386 ( kc_external_intno, &r, &r); // Read external info...
2235 // ReadOWL (kc_external_control);
2239 if ( Player_num > -1 ) {
2240 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_TURNROLL); // Turn off roll when turning
2241 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_LEVELLING); // Turn off leveling to nearest side.
2242 Auto_leveling_on = 0;
2244 if ( kc_external_version > 0 ) {
2245 vms_matrix tempm, ViewMatrix;
2246 vms_angvec * Kconfig_abs_movement;
2249 Kconfig_abs_movement = (vms_angvec *)((uint)kc_external_control + sizeof(control_info));
2251 if ( Kconfig_abs_movement->p || Kconfig_abs_movement->b || Kconfig_abs_movement->h ) {
2252 vm_angles_2_matrix(&tempm,Kconfig_abs_movement);
2253 vm_matrix_x_matrix(&ViewMatrix,&Objects[Players[Player_num].objnum].orient,&tempm);
2254 Objects[Players[Player_num].objnum].orient = ViewMatrix;
2256 oem_message = (char *)((uint)Kconfig_abs_movement + sizeof(vms_angvec));
2257 if (oem_message[0] != '\0' )
2258 HUD_init_message( oem_message );
2262 Controls.pitch_time += fixmul(kc_external_control->pitch_time,FrameTime);
2263 Controls.vertical_thrust_time += fixmul(kc_external_control->vertical_thrust_time,FrameTime);
2264 Controls.heading_time += fixmul(kc_external_control->heading_time,FrameTime);
2265 Controls.sideways_thrust_time += fixmul(kc_external_control->sideways_thrust_time ,FrameTime);
2266 Controls.bank_time += fixmul(kc_external_control->bank_time ,FrameTime);
2267 Controls.forward_thrust_time += fixmul(kc_external_control->forward_thrust_time ,FrameTime);
2268 Controls.rear_view_down_count += kc_external_control->rear_view_down_count;
2269 Controls.rear_view_down_state |= kc_external_control->rear_view_down_state;
2270 Controls.fire_primary_down_count += kc_external_control->fire_primary_down_count;
2271 Controls.fire_primary_state |= kc_external_control->fire_primary_state;
2272 Controls.fire_secondary_state |= kc_external_control->fire_secondary_state;
2273 Controls.fire_secondary_down_count += kc_external_control->fire_secondary_down_count;
2274 Controls.fire_flare_down_count += kc_external_control->fire_flare_down_count;
2275 Controls.drop_bomb_down_count += kc_external_control->drop_bomb_down_count;
2276 Controls.automap_down_count += kc_external_control->automap_down_count;
2277 Controls.automap_state |= kc_external_control->automap_state;
2282 void controls_read_all_win()
2285 int slide_on, bank_on;
2289 int raw_joy_axis[7];
2291 fix k0, k1, k2, k3, kp;
2292 fix k4, k5, k6, k7, kh;
2293 ubyte channel_masks;
2294 int use_mouse, use_joystick;
2297 if (Game_turbo_mode)
2301 fix temp = Controls.heading_time;
2302 fix temp1 = Controls.pitch_time;
2303 memset( &Controls, 0, sizeof(control_info) );
2304 Controls.heading_time = temp;
2305 Controls.pitch_time = temp1;
2310 ctime = timer_get_fixed_seconds();
2312 // DO JOYSTICK (X,Y,Z R,U,V)
2313 // ----------------------------------------------------------------------------
2314 if ( (LastReadTime + JOYSTICK_READ_TIME) > ctime ) {
2315 if ((ctime < 0) && (LastReadTime > 0))
2316 LastReadTime = ctime;
2318 } else if ((Config_control_type==CONTROL_WINJOYSTICK)) {
2319 LastReadTime = ctime;
2320 channel_masks = joystick_read_raw_axis( JOY_ALL_AXIS+JOY_EXT_AXIS, raw_joy_axis );
2322 for (i=0; i<7; i++ ) {
2323 if (channel_masks&(1<<i)) {
2324 int joy_null_value = 28;
2326 // DO POV if joystick has a hat.
2327 // --------------------------------------------------------------------
2329 joydefsw_do_winjoybutton(raw_joy_axis);
2333 // --------------------------------------------------------------------
2334 // mprintf((0, "(%d)=%d,", i, raw_joy_axis[i]));
2335 raw_joy_axis[i] = joy_get_scaled_reading( raw_joy_axis[i], i );
2336 // mprintf((0, "%d ",raw_joy_axis[i]));
2337 // if (i%2) mprintf((0,"\n"));
2340 if (kc_superjoy[23].value==i) // If this is the throttle
2341 joy_null_value = 32; // Then use a larger dead-zone
2343 if (raw_joy_axis[i] > (joy_null_value-2))
2344 raw_joy_axis[i] = ((raw_joy_axis[i]-joy_null_value)*128)/(128-joy_null_value);
2345 else if (raw_joy_axis[i] < -(joy_null_value+2))
2346 raw_joy_axis[i] = ((raw_joy_axis[i]+joy_null_value)*128)/(128-joy_null_value);
2348 raw_joy_axis[i] = 0;
2349 joy_axis[i] = (raw_joy_axis[i]*FrameTime)/128;
2358 for (i=0; i<6; i++ )
2364 // ----------------------------------------------------------------------------
2365 if (Config_control_type==5) {
2366 mouse_get_delta( &dx, &dy );
2367 mouse_axis[0] = (dx*FrameTime)/35;
2368 mouse_axis[1] = (dy*FrameTime)/25;
2369 mouse_buttons = mouse_get_btns();
2370 //mprintf(( 0, "Mouse %d,%d b:%d, 0x%x\n", mouse_axis[0], mouse_axis[1], mouse_buttons, FrameTime ));
2379 //------------- Read slide_on -------------
2382 if ( kc_keyboard[8].value < 255 ) slide_on |= keyd_pressed[ kc_keyboard[8].value ];
2383 if ( kc_keyboard[9].value < 255 ) slide_on |= keyd_pressed[ kc_keyboard[9].value ];
2385 if ((use_joystick)&&(kc_superjoy[5].value<255)) slide_on |= joy_get_button_state( kc_superjoy[5].value );
2387 if ((use_mouse)&&(kc_mouse[5].value<255)) slide_on |= mouse_buttons & (1<<kc_mouse[5].value);
2389 //------------- Read bank_on ---------------
2392 if ( kc_keyboard[18].value < 255 ) bank_on |= keyd_pressed[ kc_keyboard[18].value ];
2393 if ( kc_keyboard[19].value < 255 ) bank_on |= keyd_pressed[ kc_keyboard[19].value ];
2395 if ( (use_joystick)&&(kc_superjoy[10].value < 255 )) bank_on |= joy_get_button_state( kc_superjoy[10].value );
2397 if ( (use_mouse)&&(kc_mouse[10].value < 255 )) bank_on |= mouse_buttons & (1<<kc_mouse[10].value);
2399 //------------ Read pitch_time -----------
2401 // mprintf((0, "pitch: %7.3f %7.3f: %7.3f\n", f2fl(k4), f2fl(k6), f2fl(Controls.heading_time)));
2403 k0 = speed_factor*key_down_time( kc_keyboard[0].value )/2; // Divide by two since we want pitch to go slower
2404 k1 = speed_factor*key_down_time( kc_keyboard[1].value )/2;
2405 k2 = speed_factor*key_down_time( kc_keyboard[2].value )/2;
2406 k3 = speed_factor*key_down_time( kc_keyboard[3].value )/2;
2409 if ( kc_keyboard[0].value < 255 ) kp += k0/PH_SCALE;
2410 if ( kc_keyboard[1].value < 255 ) kp += k1/PH_SCALE;
2411 if ( kc_keyboard[2].value < 255 ) kp -= k2/PH_SCALE;
2412 if ( kc_keyboard[3].value < 255 ) kp -= k3/PH_SCALE;
2415 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2416 kp += mouse_button_down_time(MB_PITCH_FORWARD)/(PH_SCALE*2);
2417 kp -= mouse_button_down_time(MB_PITCH_BACKWARD)/(PH_SCALE*2);
2421 Controls.pitch_time = 0;
2423 if (Controls.pitch_time < 0)
2424 Controls.pitch_time = 0;
2426 if (Controls.pitch_time > 0)
2427 Controls.pitch_time = 0;
2428 Controls.pitch_time += kp;
2431 if ( (use_joystick)&&(kc_superjoy[13].value < 255 )) {
2432 if ( !kc_superjoy[14].value ) // If not inverted...
2433 Controls.pitch_time -= (joy_axis[kc_superjoy[13].value]*Config_joystick_sensitivity)/8;
2435 Controls.pitch_time += (joy_axis[kc_superjoy[13].value]*Config_joystick_sensitivity)/8;
2439 //mprintf(( 0, "UM: %d, PV: %d\n", use_mouse, kc_mouse[13].value ));
2440 if ( (use_mouse)&&(kc_mouse[13].value < 255) ) {
2441 if ( !kc_mouse[14].value ) // If not inverted...
2442 Controls.pitch_time -= (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8;
2444 Controls.pitch_time += (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8;
2447 Controls.pitch_time = 0;
2451 //----------- Read vertical_thrust_time -----------------
2454 k0 = speed_factor*key_down_time( kc_keyboard[0].value );
2455 k1 = speed_factor*key_down_time( kc_keyboard[1].value );
2456 k2 = speed_factor*key_down_time( kc_keyboard[2].value );
2457 k3 = speed_factor*key_down_time( kc_keyboard[3].value );
2460 if ( kc_keyboard[0].value < 255 ) Controls.vertical_thrust_time += k0;
2461 if ( kc_keyboard[1].value < 255 ) Controls.vertical_thrust_time += k1;
2462 if ( kc_keyboard[2].value < 255 ) Controls.vertical_thrust_time -= k2;
2463 if ( kc_keyboard[3].value < 255 ) Controls.vertical_thrust_time -= k3;
2466 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2467 Controls.vertical_thrust_time -= mouse_button_down_time(MB_PITCH_FORWARD);
2468 Controls.vertical_thrust_time += mouse_button_down_time(MB_PITCH_BACKWARD);
2472 if ((use_joystick)&&( kc_superjoy[13].value < 255 )) {
2473 if ( !kc_superjoy[14].value ) // If not inverted...
2474 Controls.vertical_thrust_time += joy_axis[kc_superjoy[13].value];
2476 Controls.vertical_thrust_time -= joy_axis[kc_superjoy[13].value];
2480 if ( (use_mouse)&&(kc_mouse[13].value < 255 )) {
2481 if ( !kc_mouse[14].value ) // If not inverted...
2482 Controls.vertical_thrust_time -= mouse_axis[kc_mouse[13].value];
2484 Controls.vertical_thrust_time += mouse_axis[kc_mouse[13].value];
2489 if ( kc_keyboard[14].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[14].value );
2490 if ( kc_keyboard[15].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[15].value );
2491 if ( kc_keyboard[16].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[16].value );
2492 if ( kc_keyboard[17].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[17].value );
2495 if ((use_joystick)&&( kc_superjoy[19].value < 255 )) {
2496 if ( !kc_superjoy[20].value ) // If not inverted...
2497 Controls.vertical_thrust_time += joy_axis[kc_superjoy[19].value];
2499 Controls.vertical_thrust_time -= joy_axis[kc_superjoy[19].value];
2502 // From joystick buttons
2503 if ( (use_joystick)&&(kc_superjoy[8].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_superjoy[8].value );
2504 if ( (use_joystick)&&(kc_superjoy[9].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_superjoy[9].value );
2506 // From mouse buttons
2507 if ( (use_mouse)&&(kc_mouse[8].value < 255 )) Controls.vertical_thrust_time += mouse_button_down_time( kc_mouse[8].value );
2508 if ( (use_mouse)&&(kc_mouse[9].value < 255 )) Controls.vertical_thrust_time -= mouse_button_down_time( kc_mouse[9].value );
2511 if ( (use_mouse)&&(kc_mouse[19].value < 255 )) {
2512 if ( !kc_mouse[20].value ) // If not inverted...
2513 Controls.vertical_thrust_time += mouse_axis[kc_mouse[19].value];
2515 Controls.vertical_thrust_time -= mouse_axis[kc_mouse[19].value];
2519 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2520 Controls.vertical_thrust_time += mouse_button_down_time(MB_Z_UP)/2;
2521 Controls.vertical_thrust_time -= mouse_button_down_time(MB_Z_DOWN)/2;
2524 //---------- Read heading_time -----------
2526 if (!slide_on && !bank_on) {
2527 //mprintf((0, "heading: %7.3f %7.3f: %7.3f\n", f2fl(k4), f2fl(k6), f2fl(Controls.heading_time)));
2529 k4 = speed_factor*key_down_time( kc_keyboard[4].value );
2530 k5 = speed_factor*key_down_time( kc_keyboard[5].value );
2531 k6 = speed_factor*key_down_time( kc_keyboard[6].value );
2532 k7 = speed_factor*key_down_time( kc_keyboard[7].value );
2535 if ( kc_keyboard[4].value < 255 ) kh -= k4/PH_SCALE;
2536 if ( kc_keyboard[5].value < 255 ) kh -= k5/PH_SCALE;
2537 if ( kc_keyboard[6].value < 255 ) kh += k6/PH_SCALE;
2538 if ( kc_keyboard[7].value < 255 ) kh += k7/PH_SCALE;
2541 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2542 kh -= mouse_button_down_time(MB_HEAD_LEFT)/PH_SCALE;
2543 kh += mouse_button_down_time(MB_HEAD_RIGHT)/PH_SCALE;
2547 Controls.heading_time = 0;
2549 if (Controls.heading_time < 0)
2550 Controls.heading_time = 0;
2552 if (Controls.heading_time > 0)
2553 Controls.heading_time = 0;
2554 Controls.heading_time += kh;
2557 if ( (use_joystick)&&(kc_superjoy[15].value < 255 )) {
2558 if ( !kc_superjoy[16].value ) // If not inverted...
2559 Controls.heading_time += (joy_axis[kc_superjoy[15].value]*Config_joystick_sensitivity)/8;
2561 Controls.heading_time -= (joy_axis[kc_superjoy[15].value]*Config_joystick_sensitivity)/8;
2565 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
2566 if ( !kc_mouse[16].value ) // If not inverted...
2567 Controls.heading_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
2569 Controls.heading_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
2572 Controls.heading_time = 0;
2575 //----------- Read sideways_thrust_time -----------------
2578 k0 = speed_factor*key_down_time( kc_keyboard[4].value );
2579 k1 = speed_factor*key_down_time( kc_keyboard[5].value );
2580 k2 = speed_factor*key_down_time( kc_keyboard[6].value );
2581 k3 = speed_factor*key_down_time( kc_keyboard[7].value );
2584 if ( kc_keyboard[4].value < 255 ) Controls.sideways_thrust_time -= k0;
2585 if ( kc_keyboard[5].value < 255 ) Controls.sideways_thrust_time -= k1;
2586 if ( kc_keyboard[6].value < 255 ) Controls.sideways_thrust_time += k2;
2587 if ( kc_keyboard[7].value < 255 ) Controls.sideways_thrust_time += k3;
2590 if ( (use_joystick)&&(kc_superjoy[15].value < 255 )) {
2591 if ( !kc_superjoy[16].value ) // If not inverted...
2592 Controls.sideways_thrust_time += joy_axis[kc_superjoy[15].value];
2594 Controls.sideways_thrust_time -= joy_axis[kc_superjoy[15].value];
2598 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2599 Controls.sideways_thrust_time -= mouse_button_down_time(MB_HEAD_LEFT);
2600 Controls.sideways_thrust_time += mouse_button_down_time(MB_HEAD_RIGHT);
2604 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
2605 if ( !kc_mouse[16].value ) // If not inverted...
2606 Controls.sideways_thrust_time += mouse_axis[kc_mouse[15].value];
2608 Controls.sideways_thrust_time -= mouse_axis[kc_mouse[15].value];
2613 if ( kc_keyboard[10].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[10].value );
2614 if ( kc_keyboard[11].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[11].value );
2615 if ( kc_keyboard[12].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[12].value );
2616 if ( kc_keyboard[13].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[13].value );
2619 if ( (use_joystick)&&(kc_superjoy[17].value < 255 )) {
2620 if ( !kc_superjoy[18].value ) // If not inverted...
2621 Controls.sideways_thrust_time -= joy_axis[kc_superjoy[17].value];
2623 Controls.sideways_thrust_time += joy_axis[kc_superjoy[17].value];
2626 // From joystick buttons
2627 if ( (use_joystick)&&(kc_superjoy[6].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_superjoy[6].value );
2628 if ( (use_joystick)&&(kc_superjoy[7].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_superjoy[7].value );
2630 // From mouse buttons
2631 if ( (use_mouse)&&(kc_mouse[6].value < 255 )) Controls.sideways_thrust_time -= mouse_button_down_time( kc_mouse[6].value );
2632 if ( (use_mouse)&&(kc_mouse[7].value < 255 )) Controls.sideways_thrust_time += mouse_button_down_time( kc_mouse[7].value );
2635 if ( (use_mouse)&&(kc_mouse[17].value < 255 )) {
2636 if ( !kc_mouse[18].value ) // If not inverted...
2637 Controls.sideways_thrust_time += mouse_axis[kc_mouse[17].value];
2639 Controls.sideways_thrust_time -= mouse_axis[kc_mouse[17].value];
2642 //----------- Read bank_time -----------------
2645 k0 = speed_factor*key_down_time( kc_keyboard[4].value );
2646 k1 = speed_factor*key_down_time( kc_keyboard[5].value );
2647 k2 = speed_factor*key_down_time( kc_keyboard[6].value );
2648 k3 = speed_factor*key_down_time( kc_keyboard[7].value );
2651 if ( kc_keyboard[4].value < 255 ) Controls.bank_time += k0;
2652 if ( kc_keyboard[5].value < 255 ) Controls.bank_time += k1;
2653 if ( kc_keyboard[6].value < 255 ) Controls.bank_time -= k2;
2654 if ( kc_keyboard[7].value < 255 ) Controls.bank_time -= k3;
2657 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2658 Controls.bank_time -= mouse_button_down_time(MB_HEAD_LEFT);
2659 Controls.bank_time += mouse_button_down_time(MB_HEAD_RIGHT);
2663 if ( (use_joystick)&&(kc_superjoy[15].value < 255) ) {
2664 if ( !kc_superjoy[16].value ) // If not inverted...
2665 Controls.bank_time -= (joy_axis[kc_superjoy[15].value]*Config_joystick_sensitivity)/8;
2667 Controls.bank_time += (joy_axis[kc_superjoy[15].value]*Config_joystick_sensitivity)/8;
2671 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
2672 if ( !kc_mouse[16].value ) // If not inverted...
2673 Controls.bank_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
2675 Controls.bank_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
2680 if ( kc_keyboard[20].value < 255 ) Controls.bank_time += speed_factor*key_down_time( kc_keyboard[20].value );
2681 if ( kc_keyboard[21].value < 255 ) Controls.bank_time += speed_factor*key_down_time( kc_keyboard[21].value );
2682 if ( kc_keyboard[22].value < 255 ) Controls.bank_time -= speed_factor*key_down_time( kc_keyboard[22].value );
2683 if ( kc_keyboard[23].value < 255 ) Controls.bank_time -= speed_factor*key_down_time( kc_keyboard[23].value );
2686 if ( (use_joystick)&&(kc_superjoy[21].value < 255) ) {
2687 if ( !kc_superjoy[22].value ) // If not inverted...
2688 Controls.bank_time -= joy_axis[kc_superjoy[21].value];
2690 Controls.bank_time += joy_axis[kc_superjoy[21].value];
2693 // From joystick buttons
2694 if ( (use_joystick)&&(kc_superjoy[11].value < 255 )) Controls.bank_time += joy_get_button_down_time( kc_superjoy[11].value );
2695 if ( (use_joystick)&&(kc_superjoy[12].value < 255 )) Controls.bank_time -= joy_get_button_down_time( kc_superjoy[12].value );
2697 // From mouse buttons
2698 if ( (use_mouse)&&(kc_mouse[11].value < 255 )) Controls.bank_time += mouse_button_down_time( kc_mouse[11].value );
2699 if ( (use_mouse)&&(kc_mouse[12].value < 255 )) Controls.bank_time -= mouse_button_down_time( kc_mouse[12].value );
2702 if ( (use_mouse)&&(kc_mouse[21].value < 255 )) {
2703 if ( !kc_mouse[22].value ) // If not inverted...
2704 Controls.bank_time += mouse_axis[kc_mouse[21].value];
2706 Controls.bank_time -= mouse_axis[kc_mouse[21].value];
2710 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
2711 Controls.bank_time += mouse_button_down_time(MB_BANK_LEFT);
2712 Controls.bank_time -= mouse_button_down_time(MB_BANK_RIGHT);
2715 //----------- Read forward_thrust_time -------------
2718 if ( kc_keyboard[30].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[30].value );
2719 if ( kc_keyboard[31].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[31].value );
2720 if ( kc_keyboard[32].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[32].value );
2721 if ( kc_keyboard[33].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[33].value );
2724 if ( (use_joystick)&&(kc_superjoy[23].value < 255 )) {
2725 if ( !kc_superjoy[24].value ) // If not inverted...
2726 Controls.forward_thrust_time -= joy_axis[kc_superjoy[23].value];
2728 Controls.forward_thrust_time += joy_axis[kc_superjoy[23].value];
2731 // From joystick buttons
2732 if ( (use_joystick)&&(kc_superjoy[2].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_superjoy[2].value );
2733 if ( (use_joystick)&&(kc_superjoy[3].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_superjoy[3].value );
2736 if ( (use_mouse)&&(kc_mouse[23].value < 255 )) {
2737 if ( !kc_mouse[24].value ) // If not inverted...
2738 Controls.forward_thrust_time -= mouse_axis[kc_mouse[23].value];
2740 Controls.forward_thrust_time += mouse_axis[kc_mouse[23].value];
2743 // From mouse buttons
2744 if ( (use_mouse)&&(kc_mouse[2].value < 255 )) Controls.forward_thrust_time += mouse_button_down_time( kc_mouse[2].value );
2745 if ( (use_mouse)&&(kc_mouse[3].value < 255 )) Controls.forward_thrust_time -= mouse_button_down_time( kc_mouse[3].value );
2747 //----------- Read afterburner_state -------------
2750 if ( kc_keyboard[46].value < 255 ) Controls.afterburner_state |= keyd_pressed[kc_keyboard[46].value];
2751 if ( kc_keyboard[47].value < 255 ) Controls.afterburner_state |= keyd_pressed[kc_keyboard[47].value];
2753 if ( (use_mouse)&&(kc_mouse[27].value < 255 )) Controls.afterburner_state |= mouse_button_state(kc_mouse[27].value);
2755 if ( (use_joystick)&&(kc_superjoy[27].value < 255 )) Controls.afterburner_state |= joy_get_button_state(kc_superjoy[27].value);
2757 //-------Read headlight key--------------------------
2758 if (kc_keyboard[52].value < 255 )
2759 Controls.headlight_count=key_down_count(kc_keyboard[52].value);
2760 if (kc_keyboard[53].value < 255 )
2761 Controls.headlight_count=key_down_count(kc_keyboard[53].value);
2762 if ((use_joystick)&&(kc_superjoy[30].value < 255 ))
2763 Controls.headlight_count=joy_get_button_down_cnt(kc_superjoy[30].value);
2765 //--------Read Cycle Primary Key------------------
2767 if (kc_keyboard[48].value<255)
2768 Controls.cycle_primary_count=key_down_count(kc_keyboard[48].value);
2769 if (kc_keyboard[49].value<255)
2770 Controls.cycle_primary_count+=key_down_count(kc_keyboard[49].value);
2771 if ((use_joystick)&&(kc_superjoy[28].value < 255 ))
2772 Controls.cycle_primary_count+=joy_get_button_down_cnt(kc_superjoy[28].value);
2774 //--------Read Cycle Secondary Key------------------
2776 if (kc_keyboard[50].value<255)
2777 Controls.cycle_secondary_count=key_down_count(kc_keyboard[50].value);
2778 if (kc_keyboard[51].value<255)
2779 Controls.cycle_secondary_count+=key_down_count(kc_keyboard[51].value);
2780 if ((use_joystick)&&(kc_superjoy[29].value < 255 ))
2781 Controls.cycle_secondary_count=joy_get_button_down_cnt(kc_superjoy[29].value);
2783 //--------Read Toggle Bomb key----------------------
2785 if (kc_keyboard[56].value<255 && key_down_count(kc_keyboard[56].value))
2787 int bomb = Secondary_last_was_super[PROXIMITY_INDEX]?PROXIMITY_INDEX:SMART_MINE_INDEX;
2789 if (!Players[Player_num].secondary_ammo[PROXIMITY_INDEX] &&
2790 !Players[Player_num].secondary_ammo[SMART_MINE_INDEX])
2792 digi_play_sample_once( SOUND_BAD_SELECTION, F1_0 );
2793 HUD_init_message ("No bombs available!");
2797 if (Players[Player_num].secondary_ammo[bomb]==0)
2799 digi_play_sample_once( SOUND_BAD_SELECTION, F1_0 );
2800 HUD_init_message ("No %s available!",(bomb==SMART_MINE_INDEX)?"Smart mines":"Proximity bombs");
2804 Secondary_last_was_super[PROXIMITY_INDEX]=!Secondary_last_was_super[PROXIMITY_INDEX];
2805 digi_play_sample_once( SOUND_GOOD_SELECTION_SECONDARY, F1_0 );
2810 //---------Read Energy->Shield key----------
2812 if ((Players[Player_num].flags & PLAYER_FLAGS_CONVERTER) && keyd_pressed[kc_keyboard[54].value])
2813 transfer_energy_to_shield(key_down_time(kc_keyboard[54].value));
2814 if ((Players[Player_num].flags & PLAYER_FLAGS_CONVERTER) && keyd_pressed[kc_keyboard[55].value])
2815 transfer_energy_to_shield(key_down_time(kc_keyboard[55].value));
2817 //----------- Read fire_primary_down_count
2818 if (kc_keyboard[24].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[24].value);
2819 if (kc_keyboard[25].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[25].value);
2820 if ((use_joystick)&&(kc_superjoy[0].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_superjoy[0].value);
2821 if ((use_mouse)&&(kc_mouse[0].value < 255 )) Controls.fire_primary_down_count += mouse_button_down_count(kc_mouse[0].value);
2823 //----------- Read fire_primary_state
2824 if (kc_keyboard[24].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[24].value];
2825 if (kc_keyboard[25].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[25].value];
2826 if ((use_joystick)&&(kc_superjoy[0].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_superjoy[0].value);
2827 if ((use_mouse)&&(kc_mouse[0].value < 255) ) Controls.fire_primary_state |= mouse_button_state(kc_mouse[0].value);
2829 //----------- Read fire_secondary_down_count
2830 if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[26].value);
2831 if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[27].value);
2832 if ((use_joystick)&&(kc_superjoy[1].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_superjoy[1].value);
2833 if ((use_mouse)&&(kc_mouse[1].value < 255 )) Controls.fire_secondary_down_count += mouse_button_down_count(kc_mouse[1].value);
2835 //----------- Read fire_secondary_state
2836 if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[26].value];
2837 if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[27].value];
2838 if ((use_joystick)&&(kc_superjoy[1].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_superjoy[1].value);
2839 if ((use_mouse)&&(kc_mouse[1].value < 255) ) Controls.fire_secondary_state |= mouse_button_state(kc_mouse[1].value);
2841 //----------- Read fire_flare_down_count
2842 if (kc_keyboard[28].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[28].value);
2843 if (kc_keyboard[29].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[29].value);
2844 if ((use_joystick)&&(kc_superjoy[4].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_superjoy[4].value);
2845 if ((use_mouse)&&(kc_mouse[4].value < 255 )) Controls.fire_flare_down_count += mouse_button_down_count(kc_mouse[4].value);
2847 //----------- Read drop_bomb_down_count
2848 if (kc_keyboard[34].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[34].value);
2849 if (kc_keyboard[35].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[35].value);
2850 if ((use_joystick)&&(kc_superjoy[26].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_superjoy[26].value);
2851 if ((use_mouse)&&(kc_mouse[26].value < 255 )) Controls.drop_bomb_down_count += mouse_button_down_count(kc_mouse[26].value);
2853 //----------- Read rear_view_down_count
2854 if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[36].value);
2855 if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[37].value);
2856 if ((use_joystick)&&(kc_superjoy[25].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_superjoy[25].value);
2857 if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_count += mouse_button_down_count(kc_mouse[25].value);
2859 //----------- Read rear_view_down_state
2860 if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[36].value];
2861 if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[37].value];
2862 if ((use_joystick)&&(kc_superjoy[25].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_superjoy[25].value);
2863 if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_state |= mouse_button_state(kc_mouse[25].value);
2865 //----------- Read automap_down_count
2866 if (kc_keyboard[44].value < 255 ) Controls.automap_down_count += key_down_count(kc_keyboard[44].value);
2867 if (kc_keyboard[45].value < 255 ) Controls.automap_down_count += key_down_count(kc_keyboard[45].value);
2869 //----------- Read automap_state
2870 if (kc_keyboard[44].value < 255 ) Controls.automap_state |= keyd_pressed[kc_keyboard[44].value];
2871 if (kc_keyboard[45].value < 255 ) Controls.automap_state |= keyd_pressed[kc_keyboard[45].value];
2873 //----------- Read stupid-cruise-control-type of throttle.
2875 if ( kc_keyboard[38].value < 255 ) Cruise_speed += fixdiv(speed_factor*key_down_time(kc_keyboard[38].value)*5,FrameTime);
2876 if ( kc_keyboard[39].value < 255 ) Cruise_speed += fixdiv(speed_factor*key_down_time(kc_keyboard[39].value)*5,FrameTime);
2877 if ( kc_keyboard[40].value < 255 ) Cruise_speed -= fixdiv(speed_factor*key_down_time(kc_keyboard[40].value)*5,FrameTime);
2878 if ( kc_keyboard[41].value < 255 ) Cruise_speed -= fixdiv(speed_factor*key_down_time(kc_keyboard[41].value)*5,FrameTime);
2879 if ( (kc_keyboard[42].value < 255) && (key_down_count(kc_keyboard[42].value)) )
2881 if ( (kc_keyboard[43].value < 255) && (key_down_count(kc_keyboard[43].value)) )
2884 if (Cruise_speed > i2f(100) ) Cruise_speed = i2f(100);
2885 if (Cruise_speed < 0 ) Cruise_speed = 0;
2887 if (Controls.forward_thrust_time==0)
2888 Controls.forward_thrust_time = fixmul(Cruise_speed,FrameTime)/100;
2891 //read_head_tracker();
2893 // Read external controls
2894 if (kc_use_external_control || CybermouseActive)
2895 kconfig_read_external_controls();
2897 //----------- Clamp values between -FrameTime and FrameTime
2898 if (FrameTime > F1_0 )
2899 mprintf( (1, "Bogus frame time of %.2f seconds\n", f2fl(FrameTime) ));
2901 if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2;
2902 if (Controls.vertical_thrust_time > FrameTime ) Controls.vertical_thrust_time = FrameTime;
2903 if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime;
2904 if (Controls.sideways_thrust_time > FrameTime ) Controls.sideways_thrust_time = FrameTime;
2905 if (Controls.bank_time > FrameTime ) Controls.bank_time = FrameTime;
2906 if (Controls.forward_thrust_time > FrameTime ) Controls.forward_thrust_time = FrameTime;
2907 // if (Controls.afterburner_time > FrameTime ) Controls.afterburner_time = FrameTime;
2909 if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2;
2910 if (Controls.vertical_thrust_time < -FrameTime ) Controls.vertical_thrust_time = -FrameTime;
2911 if (Controls.heading_time < -FrameTime ) Controls.heading_time = -FrameTime;
2912 if (Controls.sideways_thrust_time < -FrameTime ) Controls.sideways_thrust_time = -FrameTime;
2913 if (Controls.bank_time < -FrameTime ) Controls.bank_time = -FrameTime;
2914 if (Controls.forward_thrust_time < -FrameTime ) Controls.forward_thrust_time = -FrameTime;
2915 // if (Controls.afterburner_time < -FrameTime ) Controls.afterburner_time = -FrameTime;
2918 //--------- Don't do anything if in debug mode
2920 if ( keyd_pressed[KEY_DELETE] ) {
2921 memset( &Controls, 0, sizeof(control_info) );
2928 fix Next_toggle_time[3]={0,0,0};
2930 int allowed_to_toggle(int i)
2932 //used for keeping tabs of when its ok to toggle headlight,primary,and secondary
2934 if (Next_toggle_time[i] > GameTime)
2935 if (Next_toggle_time[i] < GameTime + (F1_0/8)) // In case time is bogus, never wait > 1 second.
2938 Next_toggle_time[i] = GameTime + (F1_0/8);
2945 //added on 2/7/99 by Victor Rachels for jostick state setting
2946 int d2x_joystick_ostate[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
2947 //end this section adition - VR
2951 void controls_read_all()
2954 int slide_on, bank_on;
2961 fix mouse_axis[3] = {0,0,0};
2962 int raw_joy_axis[JOY_MAX_AXES];
2965 ubyte channel_masks;
2966 int use_mouse, use_joystick;
2972 fix temp = Controls.heading_time;
2973 fix temp1 = Controls.pitch_time;
2974 memset( &Controls, 0, sizeof(control_info) );
2975 Controls.heading_time = temp;
2976 Controls.pitch_time = temp1;
2981 ctime = timer_get_fixed_seconds();
2983 //--------- Read Joystick -----------
2985 if ( (LastReadTime + JOYSTICK_READ_TIME > ctime) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) ) {
2987 if ((ctime < 0) && (LastReadTime >= 0))
2989 if ((ctime < 0) && (LastReadTime > 0))
2991 LastReadTime = ctime;
2993 } else if ((Config_control_type>0) && (Config_control_type<5) ) {
2994 LastReadTime = ctime;
2995 channel_masks = joystick_read_raw_axis( JOY_ALL_AXIS, raw_joy_axis );
2997 for (i = 0; i < joy_num_axes; i++)
3000 if (channel_masks&(1<<i)) {
3002 int joy_null_value = 10;
3004 if ( (i==3) && (Config_control_type==CONTROL_THRUSTMASTER_FCS) ) {
3005 kconfig_read_fcs( raw_joy_axis[i] );
3007 raw_joy_axis[i] = joy_get_scaled_reading( raw_joy_axis[i], i );
3009 if (kc_joystick[23].value==i) // If this is the throttle
3010 joy_null_value = 20; // Then use a larger dead-zone
3012 if (raw_joy_axis[i] > joy_null_value)
3013 raw_joy_axis[i] = ((raw_joy_axis[i]-joy_null_value)*128)/(128-joy_null_value);
3014 else if (raw_joy_axis[i] < -joy_null_value)
3015 raw_joy_axis[i] = ((raw_joy_axis[i]+joy_null_value)*128)/(128-joy_null_value);
3017 raw_joy_axis[i] = 0;
3018 joy_axis[i] = (raw_joy_axis[i]*FrameTime)/128;
3028 for (i = 0; i < joy_num_axes; i++)
3033 //--------- Read Joystick -----------
3034 if ((Config_control_type>0) && (Config_control_type<5) ) {
3035 channel_masks = joystick_read_raw_axis( JOY_ALL_AXIS, raw_joy_axis );
3036 for (i=0; i<4; i++ ) {
3037 if (channel_masks&(1<<i)) {
3038 int joy_null_value = 10;
3040 raw_joy_axis[i] = joy_get_scaled_reading( raw_joy_axis[i], i );
3042 if (kc_joystick[23].value==i) // If this is the throttle
3043 joy_null_value = 20; // Then use a larger dead-zone
3045 if (raw_joy_axis[i] > joy_null_value)
3046 raw_joy_axis[i] = ((raw_joy_axis[i]-joy_null_value)*128)/(128-joy_null_value);
3047 else if (raw_joy_axis[i] < -joy_null_value)
3048 raw_joy_axis[i] = ((raw_joy_axis[i]+joy_null_value)*128)/(128-joy_null_value);
3050 raw_joy_axis[i] = 0;
3051 joy_axis[i] = (raw_joy_axis[i]*FrameTime)/128;
3058 for (i=0; i<4; i++ )
3062 #endif // ifndef MACINTOSH
3064 if (Config_control_type==5 && !CybermouseActive) {
3065 //--------- Read Mouse -----------
3067 mouse_get_delta_z( &dx, &dy, &dz );
3069 mouse_get_delta( &dx, &dy );
3071 mouse_axis[0] = (dx*FrameTime)/35;
3072 mouse_axis[1] = (dy*FrameTime)/25;
3074 mouse_axis[2] = (dz*FrameTime);
3076 mouse_buttons = mouse_get_btns();
3077 //mprintf(( 0, "Mouse %d,%d b:%d, 0x%x\n", mouse_axis[0], mouse_axis[1], mouse_buttons, FrameTime ));
3079 } else if (Config_control_type==6 && !CybermouseActive) {
3080 //--------- Read Cyberman -----------
3081 mouse_get_cyberman_pos(&idx,&idy );
3082 mouse_axis[0] = (idx*FrameTime)/128;
3083 mouse_axis[1] = (idy*FrameTime)/128;
3084 mouse_buttons = mouse_get_btns();
3086 } else if (CybermouseActive) {
3087 // ReadOWL (kc_external_control);
3088 // CybermouseAdjust();
3097 //added on 2/4/99 by Victor Rachels for d1x keys
3098 //--------- Read primary weapon select -------------
3099 //the following "if" added by WraithX to stop deadies from switchin weapons, 4/14/00
3100 if (!Player_is_dead)
3103 int d2x_joystick_state[10];
3106 d2x_joystick_state[i] = joy_get_button_state(kc_d2x[i*2+1].value);
3109 //----------------Weapon 1----------------
3110 if(key_down_count(kc_d2x[0].value) ||
3111 (joy_get_button_state(kc_d2x[1].value) &&
3112 (d2x_joystick_state[0]!=d2x_joystick_ostate[0]) ) )
3115 do_weapon_select(0,0);
3117 for(i=MAX_PRIMARY_WEAPONS;i<MAX_PRIMARY_WEAPONS+NEWPRIMS;i++)
3118 if(primary_order[i]>primary_order[valu]&&player_has_weapon(i,0))
3120 LaserPowSelected = valu;
3123 //----------------Weapon 2----------------
3124 if(key_down_count(kc_d2x[2].value) ||
3125 (joy_get_button_state(kc_d2x[3].value) &&
3126 (d2x_joystick_state[1]!=d2x_joystick_ostate[1]) ) )
3127 do_weapon_select(1,0);
3128 //----------------Weapon 3----------------
3129 if(key_down_count(kc_d2x[4].value) ||
3130 (joy_get_button_state(kc_d2x[5].value) &&
3131 (d2x_joystick_state[2]!=d2x_joystick_ostate[2]) ) )
3132 do_weapon_select(2,0);
3133 //----------------Weapon 4----------------
3134 if(key_down_count(kc_d2x[6].value) ||
3135 (joy_get_button_state(kc_d2x[7].value) &&
3136 (d2x_joystick_state[3]!=d2x_joystick_ostate[3]) ) )
3137 do_weapon_select(3,0);
3138 //----------------Weapon 5----------------
3139 if(key_down_count(kc_d2x[8].value) ||
3140 (joy_get_button_state(kc_d2x[9].value) &&
3141 (d2x_joystick_state[4]!=d2x_joystick_ostate[4]) ) )
3142 do_weapon_select(4,0);
3144 //--------- Read secondary weapon select ----------
3145 //----------------Weapon 6----------------
3146 if(key_down_count(kc_d2x[10].value) ||
3147 (joy_get_button_state(kc_d2x[11].value) &&
3148 (d2x_joystick_state[5]!=d2x_joystick_ostate[5]) ) )
3149 do_weapon_select(0,1);
3150 //----------------Weapon 7----------------
3151 if(key_down_count(kc_d2x[12].value) ||
3152 (joy_get_button_state(kc_d2x[13].value) &&
3153 (d2x_joystick_state[6]!=d2x_joystick_ostate[6]) ) )
3154 do_weapon_select(1,1);
3155 //----------------Weapon 8----------------
3156 if(key_down_count(kc_d2x[14].value) ||
3157 (joy_get_button_state(kc_d2x[15].value) &&
3158 (d2x_joystick_state[7]!=d2x_joystick_ostate[7]) ) )
3159 do_weapon_select(2,1);
3160 //----------------Weapon 9----------------
3161 if(key_down_count(kc_d2x[16].value) ||
3162 (joy_get_button_state(kc_d2x[17].value) &&
3163 (d2x_joystick_state[8]!=d2x_joystick_ostate[8]) ) )
3164 do_weapon_select(3,1);
3165 //----------------Weapon 0----------------
3166 if(key_down_count(kc_d2x[18].value) ||
3167 (joy_get_button_state(kc_d2x[19].value) &&
3168 (d2x_joystick_state[9]!=d2x_joystick_ostate[9]) ) )
3169 do_weapon_select(4,1);
3170 memcpy(d2x_joystick_ostate,d2x_joystick_state,10*sizeof(int));
3172 //end this section addition - VR
3175 }//end "if (!Player_is_dead)" - WraithX
3179 //------------- Read slide_on -------------
3182 slide_on |= console_control_state(CONCNTL_STRAFE);
3185 if ((use_joystick)&&(kc_joystick[5].value<255)) slide_on |= joy_get_button_state( kc_joystick[5].value );
3187 if ((use_mouse)&&(kc_mouse[5].value<255)) slide_on |= mouse_buttons & (1<<kc_mouse[5].value);
3189 //------------- Read bank_on ---------------
3192 bank_on |= console_control_state(CONCNTL_BANK);
3195 if ( (use_joystick)&&(kc_joystick[10].value < 255 )) bank_on |= joy_get_button_state( kc_joystick[10].value );
3197 if ( (use_mouse)&&(kc_mouse[10].value < 255 )) bank_on |= mouse_buttons & (1<<kc_mouse[10].value);
3199 //------------ Read pitch_time -----------
3201 // mprintf((0, "pitch: %7.3f %7.3f: %7.3f\n", f2fl(k4), f2fl(k6), f2fl(Controls.heading_time)));
3205 kp += console_control_down_time(CONCNTL_LOOKDOWN) / (PH_SCALE * 2);
3206 kp -= console_control_down_time(CONCNTL_LOOKUP) / (PH_SCALE * 2);
3209 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3210 kp += mouse_button_down_time(MB_PITCH_FORWARD)/(PH_SCALE*2);
3211 kp -= mouse_button_down_time(MB_PITCH_BACKWARD)/(PH_SCALE*2);
3215 Controls.pitch_time = 0;
3217 if (Controls.pitch_time < 0)
3218 Controls.pitch_time = 0;
3220 if (Controls.pitch_time > 0)
3221 Controls.pitch_time = 0;
3222 Controls.pitch_time += kp;
3225 if ( (use_joystick)&&(kc_joystick[13].value < 255 )) {
3226 if ( !kc_joystick[14].value ) // If not inverted...
3227 Controls.pitch_time -= (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8;
3229 Controls.pitch_time += (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8;
3233 //mprintf(( 0, "UM: %d, PV: %d\n", use_mouse, kc_mouse[13].value ));
3234 if ( (use_mouse)&&(kc_mouse[13].value < 255) ) {
3235 if ( !kc_mouse[14].value ) // If not inverted...
3236 Controls.pitch_time -= (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8;
3238 Controls.pitch_time += (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8;
3241 Controls.pitch_time = 0;
3245 // the following "if" added by WraithX, 4/14/00
3246 // done so that dead players can't move
3247 if (!Player_is_dead)
3249 //----------- Read vertical_thrust_time -----------------
3253 Controls.vertical_thrust_time += console_control_down_time(CONCNTL_LOOKDOWN);
3254 Controls.vertical_thrust_time -= console_control_down_time(CONCNTL_LOOKUP);
3257 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3258 Controls.vertical_thrust_time -= mouse_button_down_time(MB_PITCH_FORWARD);
3259 Controls.vertical_thrust_time += mouse_button_down_time(MB_PITCH_BACKWARD);
3263 if ((use_joystick)&&( kc_joystick[13].value < 255 )) {
3264 if ( !kc_joystick[14].value ) // If not inverted...
3265 Controls.vertical_thrust_time += joy_axis[kc_joystick[13].value];
3267 Controls.vertical_thrust_time -= joy_axis[kc_joystick[13].value];
3271 if ( (use_mouse)&&(kc_mouse[13].value < 255 )) {
3272 if ( !kc_mouse[14].value ) // If not inverted...
3273 Controls.vertical_thrust_time -= mouse_axis[kc_mouse[13].value];
3275 Controls.vertical_thrust_time += mouse_axis[kc_mouse[13].value];
3280 Controls.vertical_thrust_time += console_control_down_time(CONCNTL_MOVEUP);
3281 Controls.vertical_thrust_time -= console_control_down_time(CONCNTL_MOVEDOWN);
3284 if ((use_joystick)&&( kc_joystick[19].value < 255 )) {
3285 if ( !kc_joystick[20].value ) // If not inverted...
3286 Controls.vertical_thrust_time += joy_axis[kc_joystick[19].value];
3288 Controls.vertical_thrust_time -= joy_axis[kc_joystick[19].value];
3291 // From joystick buttons
3292 if ( (use_joystick)&&(kc_joystick[8].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_joystick[8].value );
3293 if ( (use_joystick)&&(kc_joystick[9].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_joystick[9].value );
3295 // From mouse buttons
3296 if ( (use_mouse)&&(kc_mouse[8].value < 255 )) Controls.vertical_thrust_time += mouse_button_down_time( kc_mouse[8].value );
3297 if ( (use_mouse)&&(kc_mouse[9].value < 255 )) Controls.vertical_thrust_time -= mouse_button_down_time( kc_mouse[9].value );
3300 if ( (use_mouse)&&(kc_mouse[19].value < 255 )) {
3301 if ( !kc_mouse[20].value ) // If not inverted...
3302 Controls.vertical_thrust_time += mouse_axis[kc_mouse[19].value];
3304 Controls.vertical_thrust_time -= mouse_axis[kc_mouse[19].value];
3308 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3309 Controls.vertical_thrust_time += mouse_button_down_time(MB_Z_UP)/2;
3310 Controls.vertical_thrust_time -= mouse_button_down_time(MB_Z_DOWN)/2;
3312 }// end "if" added by WraithX
3314 //---------- Read heading_time -----------
3316 if (!slide_on && !bank_on) {
3317 //mprintf((0, "heading: %7.3f %7.3f: %7.3f\n", f2fl(k4), f2fl(k6), f2fl(Controls.heading_time)));
3321 kh -= console_control_down_time(CONCNTL_LEFT) / PH_SCALE;
3322 kh += console_control_down_time(CONCNTL_RIGHT) / PH_SCALE;
3325 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3326 kh -= mouse_button_down_time(MB_HEAD_LEFT)/PH_SCALE;
3327 kh += mouse_button_down_time(MB_HEAD_RIGHT)/PH_SCALE;
3331 Controls.heading_time = 0;
3333 if (Controls.heading_time < 0)
3334 Controls.heading_time = 0;
3336 if (Controls.heading_time > 0)
3337 Controls.heading_time = 0;
3338 Controls.heading_time += kh;
3341 if ( (use_joystick)&&(kc_joystick[15].value < 255 )) {
3342 if ( !kc_joystick[16].value ) // If not inverted...
3343 Controls.heading_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8;
3345 Controls.heading_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8;
3349 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
3350 if ( !kc_mouse[16].value ) // If not inverted...
3351 Controls.heading_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
3353 Controls.heading_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
3356 Controls.heading_time = 0;
3359 // the following "if" added by WraithX, 4/14/00
3360 // done so that dead players can't move
3361 if (!Player_is_dead)
3363 //----------- Read sideways_thrust_time -----------------
3367 Controls.sideways_thrust_time -= console_control_down_time(CONCNTL_LEFT);
3368 Controls.sideways_thrust_time += console_control_down_time(CONCNTL_RIGHT);
3371 if ( (use_joystick)&&(kc_joystick[15].value < 255 )) {
3372 if ( !kc_joystick[16].value ) // If not inverted...
3373 Controls.sideways_thrust_time += joy_axis[kc_joystick[15].value];
3375 Controls.sideways_thrust_time -= joy_axis[kc_joystick[15].value];
3379 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3380 Controls.sideways_thrust_time -= mouse_button_down_time(MB_HEAD_LEFT);
3381 Controls.sideways_thrust_time += mouse_button_down_time(MB_HEAD_RIGHT);
3385 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
3386 if ( !kc_mouse[16].value ) // If not inverted...
3387 Controls.sideways_thrust_time += mouse_axis[kc_mouse[15].value];
3389 Controls.sideways_thrust_time -= mouse_axis[kc_mouse[15].value];
3394 Controls.sideways_thrust_time -= console_control_down_time(CONCNTL_MOVELEFT);
3395 Controls.sideways_thrust_time += console_control_down_time(CONCNTL_MOVERIGHT);
3398 if ( (use_joystick)&&(kc_joystick[17].value < 255 )) {
3399 if ( !kc_joystick[18].value ) // If not inverted...
3400 Controls.sideways_thrust_time -= joy_axis[kc_joystick[17].value];
3402 Controls.sideways_thrust_time += joy_axis[kc_joystick[17].value];
3405 // From joystick buttons
3406 if ( (use_joystick)&&(kc_joystick[6].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_joystick[6].value );
3407 if ( (use_joystick)&&(kc_joystick[7].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_joystick[7].value );
3409 // From mouse buttons
3410 if ( (use_mouse)&&(kc_mouse[6].value < 255 )) Controls.sideways_thrust_time -= mouse_button_down_time( kc_mouse[6].value );
3411 if ( (use_mouse)&&(kc_mouse[7].value < 255 )) Controls.sideways_thrust_time += mouse_button_down_time( kc_mouse[7].value );
3414 if ( (use_mouse)&&(kc_mouse[17].value < 255 )) {
3415 if ( !kc_mouse[18].value ) // If not inverted...
3416 Controls.sideways_thrust_time += mouse_axis[kc_mouse[17].value];
3418 Controls.sideways_thrust_time -= mouse_axis[kc_mouse[17].value];
3420 }// end "if" added by WraithX
3422 //----------- Read bank_time -----------------
3426 Controls.bank_time -= console_control_down_time(CONCNTL_LEFT);
3427 Controls.bank_time += console_control_down_time(CONCNTL_RIGHT);
3430 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3431 Controls.bank_time -= mouse_button_down_time(MB_HEAD_LEFT);
3432 Controls.bank_time += mouse_button_down_time(MB_HEAD_RIGHT);
3436 if ( (use_joystick)&&(kc_joystick[15].value < 255) ) {
3437 if ( !kc_joystick[16].value ) // If not inverted...
3438 Controls.bank_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8;
3440 Controls.bank_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8;
3444 if ( (use_mouse)&&(kc_mouse[15].value < 255 )) {
3445 if ( !kc_mouse[16].value ) // If not inverted...
3446 Controls.bank_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
3448 Controls.bank_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8;
3453 Controls.bank_time += console_control_down_time(CONCNTL_BANKLEFT);
3454 Controls.bank_time -= console_control_down_time(CONCNTL_BANKRIGHT);
3457 if ( (use_joystick)&&(kc_joystick[21].value < 255) ) {
3458 if ( !kc_joystick[22].value ) // If not inverted...
3459 Controls.bank_time -= joy_axis[kc_joystick[21].value];
3461 Controls.bank_time += joy_axis[kc_joystick[21].value];
3464 // From joystick buttons
3465 if ( (use_joystick)&&(kc_joystick[11].value < 255 )) Controls.bank_time += joy_get_button_down_time( kc_joystick[11].value );
3466 if ( (use_joystick)&&(kc_joystick[12].value < 255 )) Controls.bank_time -= joy_get_button_down_time( kc_joystick[12].value );
3468 // From mouse buttons
3469 if ( (use_mouse)&&(kc_mouse[11].value < 255 )) Controls.bank_time += mouse_button_down_time( kc_mouse[11].value );
3470 if ( (use_mouse)&&(kc_mouse[12].value < 255 )) Controls.bank_time -= mouse_button_down_time( kc_mouse[12].value );
3473 if ( (use_mouse)&&(kc_mouse[21].value < 255 )) {
3474 if ( !kc_mouse[22].value ) // If not inverted...
3475 Controls.bank_time += mouse_axis[kc_mouse[21].value];
3477 Controls.bank_time -= mouse_axis[kc_mouse[21].value];
3481 if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) {
3482 Controls.bank_time += mouse_button_down_time(MB_BANK_LEFT);
3483 Controls.bank_time -= mouse_button_down_time(MB_BANK_RIGHT);
3486 // the following "if" added by WraithX, 4/14/00
3487 // done so that dead players can't move
3488 if (!Player_is_dead)
3490 //----------- Read forward_thrust_time -------------
3493 Controls.forward_thrust_time += console_control_down_time(CONCNTL_FORWARD);
3494 Controls.forward_thrust_time -= console_control_down_time(CONCNTL_BACK);
3497 if ( (use_joystick)&&(kc_joystick[23].value < 255 )) {
3498 if ( !kc_joystick[24].value ) // If not inverted...
3499 Controls.forward_thrust_time -= joy_axis[kc_joystick[23].value];
3501 Controls.forward_thrust_time += joy_axis[kc_joystick[23].value];
3504 // From joystick buttons
3505 if ( (use_joystick)&&(kc_joystick[2].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_joystick[2].value );
3506 if ( (use_joystick)&&(kc_joystick[3].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_joystick[3].value );
3509 if ( (use_mouse)&&(kc_mouse[23].value < 255 )) {
3510 if ( !kc_mouse[24].value ) // If not inverted...
3511 Controls.forward_thrust_time -= mouse_axis[kc_mouse[23].value];
3513 Controls.forward_thrust_time += mouse_axis[kc_mouse[23].value];
3516 // From mouse buttons
3517 if ( (use_mouse)&&(kc_mouse[2].value < 255 )) Controls.forward_thrust_time += mouse_button_down_time( kc_mouse[2].value );
3518 if ( (use_mouse)&&(kc_mouse[3].value < 255 )) Controls.forward_thrust_time -= mouse_button_down_time( kc_mouse[3].value );
3520 //----------- Read afterburner_state -------------
3523 Controls.afterburner_state |= console_control_state(CONCNTL_LEFT);
3525 if ( (use_mouse)&&(kc_mouse[27].value < 255 )) Controls.afterburner_state |= mouse_button_state(kc_mouse[27].value);
3527 if ( (use_joystick)&&(kc_joystick[27].value < 255 )) Controls.afterburner_state |= joy_get_button_state(kc_joystick[27].value);
3529 //-------Read headlight key--------------------------
3532 Controls.headlight_count += console_control_down_count(CONCNTL_HEADLIGHT);
3534 if ((use_joystick)&&(kc_joystick[30].value < 255 ))
3535 Controls.headlight_count+=joy_get_button_down_cnt(kc_joystick[30].value);
3537 //--------Read Cycle Primary Key------------------
3540 Controls.cycle_primary_count += console_control_down_count(CONCNTL_CYCLE);
3542 if ((use_joystick)&&(kc_joystick[28].value < 255 ))
3543 Controls.cycle_primary_count+=joy_get_button_down_cnt(kc_joystick[28].value);
3546 //--------Read Cycle Secondary Key------------------
3549 Controls.cycle_secondary_count += console_control_down_count(CONCNTL_CYCLE2);
3551 if ((use_joystick)&&(kc_joystick[29].value < 255 ))
3552 Controls.cycle_secondary_count=joy_get_button_down_cnt(kc_joystick[29].value);
3554 //--------Read Toggle Bomb key----------------------
3557 if (console_control_down_count(CONCNTL_TOGGLEBOMB))
3559 int bomb = Secondary_last_was_super[PROXIMITY_INDEX]?PROXIMITY_INDEX:SMART_MINE_INDEX;
3561 if (!Players[Player_num].secondary_ammo[PROXIMITY_INDEX] &&
3562 !Players[Player_num].secondary_ammo[SMART_MINE_INDEX])
3564 digi_play_sample_once( SOUND_BAD_SELECTION, F1_0 );
3565 HUD_init_message ("No bombs available!");
3569 if (Players[Player_num].secondary_ammo[bomb]==0)
3571 digi_play_sample_once( SOUND_BAD_SELECTION, F1_0 );
3572 HUD_init_message ("No %s available!",(bomb==SMART_MINE_INDEX)?"Smart mines":"Proximity bombs");
3576 Secondary_last_was_super[PROXIMITY_INDEX]=!Secondary_last_was_super[PROXIMITY_INDEX];
3577 digi_play_sample_once( SOUND_GOOD_SELECTION_SECONDARY, F1_0 );
3582 //---------Read Energy->Shield key----------
3585 if ((Players[Player_num].flags & PLAYER_FLAGS_CONVERTER) && console_control_state(CONCNTL_NRGSHIELD))
3586 transfer_energy_to_shield(console_control_down_time(CONCNTL_NRGSHIELD));
3588 //----------- Read fire_primary_down_count
3591 Controls.fire_primary_down_count += console_control_down_count(CONCNTL_ATTACK);
3593 if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_joystick[0].value);
3594 if ((use_mouse)&&(kc_mouse[0].value < 255 )) Controls.fire_primary_down_count += mouse_button_down_count(kc_mouse[0].value);
3596 //----------- Read fire_primary_state
3599 Controls.fire_primary_state |= console_control_state(CONCNTL_ATTACK);
3601 if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_joystick[0].value);
3602 if ((use_mouse)&&(kc_mouse[0].value < 255) ) Controls.fire_primary_state |= mouse_button_state(kc_mouse[0].value);
3604 //----------- Read fire_secondary_down_count
3607 Controls.fire_secondary_down_count += console_control_down_count(CONCNTL_ATTACK2);
3609 if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_joystick[1].value);
3610 if ((use_mouse)&&(kc_mouse[1].value < 255 )) Controls.fire_secondary_down_count += mouse_button_down_count(kc_mouse[1].value);
3612 //----------- Read fire_secondary_state
3615 Controls.fire_secondary_state |= console_control_state(CONCNTL_ATTACK2);
3617 if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_joystick[1].value);
3618 if ((use_mouse)&&(kc_mouse[1].value < 255) ) Controls.fire_secondary_state |= mouse_button_state(kc_mouse[1].value);
3620 //----------- Read fire_flare_down_count
3623 Controls.fire_flare_down_count += console_control_down_count(CONCNTL_FLARE);
3625 if ((use_joystick)&&(kc_joystick[4].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_joystick[4].value);
3626 if ((use_mouse)&&(kc_mouse[4].value < 255 )) Controls.fire_flare_down_count += mouse_button_down_count(kc_mouse[4].value);
3628 //----------- Read drop_bomb_down_count
3631 Controls.drop_bomb_down_count += console_control_down_count(CONCNTL_BOMB);
3633 if ((use_joystick)&&(kc_joystick[26].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_joystick[26].value);
3634 if ((use_mouse)&&(kc_mouse[26].value < 255 )) Controls.drop_bomb_down_count += mouse_button_down_count(kc_mouse[26].value);
3636 //----------- Read rear_view_down_count
3639 Controls.rear_view_down_count += console_control_down_count(CONCNTL_REARVIEW);
3641 if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_joystick[25].value);
3642 if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_count += mouse_button_down_count(kc_mouse[25].value);
3644 //----------- Read rear_view_down_state
3647 Controls.rear_view_down_state |= console_control_state(CONCNTL_REARVIEW);
3649 if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_joystick[25].value);
3650 if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_state |= mouse_button_state(kc_mouse[25].value);
3652 }//end "if" added by WraithX
3654 //----------- Read automap_down_count
3657 Controls.automap_down_count += console_control_down_count(CONCNTL_AUTOMAP);
3659 //----------- Read automap_state
3662 Controls.automap_state |= console_control_state(CONCNTL_AUTOMAP);
3664 //----------- Read stupid-cruise-control-type of throttle.
3667 Cruise_speed += console_control_down_time(CONCNTL_CRUISEUP);
3668 Cruise_speed -= console_control_down_time(CONCNTL_CRUISEDOWN);
3670 if ( (kc_keyboard[42].value < 255) && (key_down_count(kc_keyboard[42].value)) )
3672 if ( (kc_keyboard[43].value < 255) && (key_down_count(kc_keyboard[43].value)) )
3676 if (console_control_down_count(CONCNTL_CRUISEOFF))
3679 if (Cruise_speed > i2f(100) ) Cruise_speed = i2f(100);
3680 if (Cruise_speed < 0 ) Cruise_speed = 0;
3682 if (Controls.forward_thrust_time==0)
3683 Controls.forward_thrust_time = fixmul(Cruise_speed,FrameTime)/100;
3686 #if !defined(MACINTOSH)
3687 //read_head_tracker();
3689 // Read external controls
3690 // if (kc_use_external_control || CybermouseActive)
3691 // kconfig_read_external_controls();
3694 //----------- Clamp values between -FrameTime and FrameTime
3695 if (FrameTime > F1_0 )
3696 mprintf( (1, "Bogus frame time of %.2f seconds\n", f2fl(FrameTime) ));
3698 if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2;
3699 if (Controls.vertical_thrust_time > FrameTime ) Controls.vertical_thrust_time = FrameTime;
3700 if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime;
3701 if (Controls.sideways_thrust_time > FrameTime ) Controls.sideways_thrust_time = FrameTime;
3702 if (Controls.bank_time > FrameTime ) Controls.bank_time = FrameTime;
3703 if (Controls.forward_thrust_time > FrameTime ) Controls.forward_thrust_time = FrameTime;
3704 // if (Controls.afterburner_time > FrameTime ) Controls.afterburner_time = FrameTime;
3706 if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2;
3707 if (Controls.vertical_thrust_time < -FrameTime ) Controls.vertical_thrust_time = -FrameTime;
3708 if (Controls.heading_time < -FrameTime ) Controls.heading_time = -FrameTime;
3709 if (Controls.sideways_thrust_time < -FrameTime ) Controls.sideways_thrust_time = -FrameTime;
3710 if (Controls.bank_time < -FrameTime ) Controls.bank_time = -FrameTime;
3711 if (Controls.forward_thrust_time < -FrameTime ) Controls.forward_thrust_time = -FrameTime;
3712 // if (Controls.afterburner_time < -FrameTime ) Controls.afterburner_time = -FrameTime;
3715 //--------- Don't do anything if in debug mode
3717 if ( keyd_pressed[KEY_DELETE] ) {
3718 memset( &Controls, 0, sizeof(control_info) );
3725 void reset_cruise(void)
3731 void kc_set_controls()
3735 for (i=0; i<NUM_KEY_CONTROLS; i++ )
3736 kc_keyboard[i].value = kconfig_settings[0][i];
3738 for (i=0; i<NUM_KEY_CONTROLS; i++ )
3739 kc_keybindings[i].value = 255;
3741 for (j=0; j<256; j++)
3743 for (i=0; i<NUM_KEY_CONTROLS; i++ )
3744 if (kc_keybindings[i].value == 255
3745 && !strncmp(key_binding(j), kc_bind_text[i], 13)) {
3746 kc_keybindings[i].value = j;
3750 if ( (Config_control_type>0) && (Config_control_type<5)) {
3751 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
3752 kc_joystick[i].value = kconfig_settings[Config_control_type][i];
3753 if (kc_joystick[i].type == BT_INVERT ) {
3754 if (kc_joystick[i].value!=1)
3755 kc_joystick[i].value = 0;
3756 kconfig_settings[Config_control_type][i] = kc_joystick[i].value;
3759 } else if (Config_control_type>4 && Config_control_type<CONTROL_WINJOYSTICK) {
3760 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
3761 kc_mouse[i].value = kconfig_settings[Config_control_type][i];
3762 if (kc_mouse[i].type == BT_INVERT ) {
3763 if (kc_mouse[i].value!=1)
3764 kc_mouse[i].value = 0;
3765 kconfig_settings[Config_control_type][i] = kc_mouse[i].value;
3768 } else if (Config_control_type == CONTROL_WINJOYSTICK) {
3769 for (i=0; i<NUM_OTHER_CONTROLS; i++ ) {
3770 kc_superjoy[i].value = kconfig_settings[Config_control_type][i];
3771 if (kc_superjoy[i].type == BT_INVERT ) {
3772 if (kc_superjoy[i].value!=1)
3773 kc_superjoy[i].value = 0;
3774 kconfig_settings[Config_control_type][i] = kc_superjoy[i].value;
3780 for (i=0; i<NUM_D2X_CONTROLS; i++ )
3781 kc_d2x[i].value = kconfig_d2x_settings[i];
3785 #if 0 //ndef MACINTOSH // no mac support for vr headset
3787 void kconfig_center_headset()
3791 vfx_center_headset();
3793 // } else if (iglasses_headset_installed) {
3794 // } else if (Victor_headset_installed) {
3800 #endif // end of #ifndef MACINTOSH for kconfig_center_headset
3802 void CybermouseAdjust ()
3804 /* if ( Player_num > -1 ) {
3805 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_TURNROLL); // Turn off roll when turning
3806 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_LEVELLING); // Turn off leveling to nearest side.
3807 Auto_leveling_on = 0;
3809 if ( kc_external_version > 0 ) {
3810 vms_matrix tempm, ViewMatrix;
3811 vms_angvec * Kconfig_abs_movement;
3814 Kconfig_abs_movement = (vms_angvec *)((uint)kc_external_control + sizeof(control_info));
3816 if ( Kconfig_abs_movement->p || Kconfig_abs_movement->b || Kconfig_abs_movement->h ) {
3817 vm_angles_2_matrix(&tempm,Kconfig_abs_movement);
3818 vm_matrix_x_matrix(&ViewMatrix,&Objects[Players[Player_num].objnum].orient,&tempm);
3819 Objects[Players[Player_num].objnum].orient = ViewMatrix;
3821 oem_message = (char *)((uint)Kconfig_abs_movement + sizeof(vms_angvec));
3822 if (oem_message[0] != '\0' )
3823 HUD_init_message( oem_message );
3827 Controls.pitch_time += fixmul(kc_external_control->pitch_time,FrameTime);
3828 Controls.vertical_thrust_time += fixmul(kc_external_control->vertical_thrust_time,FrameTime);
3829 Controls.heading_time += fixmul(kc_external_control->heading_time,FrameTime);
3830 Controls.sideways_thrust_time += fixmul(kc_external_control->sideways_thrust_time ,FrameTime);
3831 Controls.bank_time += fixmul(kc_external_control->bank_time ,FrameTime);
3832 Controls.forward_thrust_time += fixmul(kc_external_control->forward_thrust_time ,FrameTime);
3833 // Controls.rear_view_down_count += kc_external_control->rear_view_down_count;
3834 // Controls.rear_view_down_state |= kc_external_control->rear_view_down_state;
3835 Controls.fire_primary_down_count += kc_external_control->fire_primary_down_count;
3836 Controls.fire_primary_state |= kc_external_control->fire_primary_state;
3837 Controls.fire_secondary_state |= kc_external_control->fire_secondary_state;
3838 Controls.fire_secondary_down_count += kc_external_control->fire_secondary_down_count;
3839 Controls.fire_flare_down_count += kc_external_control->fire_flare_down_count;
3840 Controls.drop_bomb_down_count += kc_external_control->drop_bomb_down_count;
3841 // Controls.automap_down_count += kc_external_control->automap_down_count;
3842 // Controls.automap_state |= kc_external_control->automap_state;
3845 char GetKeyValue (char key)
3847 mprintf ((0,"Returning %c!\n",kc_keyboard[(int)key].value));
3848 return (kc_keyboard[(int)key].value);
3851 #if !defined(MACINTOSH)
3854 extern object *obj_find_first_of_type (int);
3855 void kconfig_read_external_controls()
3860 if ( !kc_enable_external_control ) return;
3862 if ( kc_external_version == 0 )
3863 memset( kc_external_control, 0, sizeof(ext_control_info));
3864 else if ( kc_external_version > 0 ) {
3866 if (kc_external_version>=4)
3867 memset( kc_external_control, 0, sizeof(advanced_ext_control_info));
3868 else if (kc_external_version>0)
3869 memset( kc_external_control, 0, sizeof(ext_control_info)+sizeof(vms_angvec) + 64 );
3870 else if (kc_external_version>2)
3871 memset( kc_external_control, 0, sizeof(ext_control_info)+sizeof(vms_angvec) + 64 + sizeof(vms_vector) + sizeof(vms_matrix) +4 );
3873 if ( kc_external_version > 1 ) {
3874 // Write ship pos and angles to external controls...
3875 ubyte *temp_ptr = (ubyte *)kc_external_control;
3876 vms_vector *ship_pos;
3877 vms_matrix *ship_orient;
3878 memset( kc_external_control, 0, sizeof(ext_control_info)+sizeof(vms_angvec) + 64 + sizeof(vms_vector)+sizeof(vms_matrix) );
3879 temp_ptr += sizeof(ext_control_info) + sizeof(vms_angvec) + 64;
3880 ship_pos = (vms_vector *)temp_ptr;
3881 temp_ptr += sizeof(vms_vector);
3882 ship_orient = (vms_matrix *)temp_ptr;
3883 // Fill in ship postion...
3884 *ship_pos = Objects[Players[Player_num].objnum].pos;
3885 // Fill in ship orientation...
3886 *ship_orient = Objects[Players[Player_num].objnum].orient;
3888 if (kc_external_version>=4)
3890 advanced_ext_control_info *temp_ptr=(advanced_ext_control_info *)kc_external_control;
3892 temp_ptr->headlight_state=(Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT_ON);
3893 temp_ptr->primary_weapon_flags=Players[Player_num].primary_weapon_flags;
3894 temp_ptr->secondary_weapon_flags=Players[Player_num].secondary_weapon_flags;
3895 temp_ptr->current_primary_weapon=Primary_weapon;
3896 temp_ptr->current_secondary_weapon=Secondary_weapon;
3898 temp_ptr->current_guidebot_command=Escort_goal_object;
3900 temp_ptr->force_vector=ExtForceVec;
3901 temp_ptr->force_matrix=ExtApplyForceMatrix;
3903 temp_ptr->joltinfo[i]=ExtJoltInfo[i];
3905 temp_ptr->x_vibrate_info[i]=ExtXVibrateInfo[i];
3906 temp_ptr->x_vibrate_clear=ExtXVibrateClear;
3907 temp_ptr->game_status=ExtGameStatus;
3909 memset ((void *)&ExtForceVec,0,sizeof(vms_vector));
3910 memset ((void *)&ExtApplyForceMatrix,0,sizeof(vms_matrix));
3915 ExtXVibrateInfo[i]=0;
3920 if ( Automap_active ) // (If in automap...)
3921 kc_external_control->automap_state = 1;
3922 //memset(&r,0,sizeof(r));
3926 int386 ( kc_external_intno, &r, &r); // Read external info...
3930 if ( Player_num > -1 ) {
3931 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_TURNROLL); // Turn off roll when turning
3932 Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_LEVELLING); // Turn off leveling to nearest side.
3933 Auto_leveling_on = 0;
3935 if ( kc_external_version > 0 ) {
3936 vms_matrix tempm, ViewMatrix;
3937 vms_angvec * Kconfig_abs_movement;
3940 Kconfig_abs_movement = (vms_angvec *)((uint)kc_external_control + sizeof(ext_control_info));
3942 if ( Kconfig_abs_movement->p || Kconfig_abs_movement->b || Kconfig_abs_movement->h ) {
3943 vm_angles_2_matrix(&tempm,Kconfig_abs_movement);
3944 vm_matrix_x_matrix(&ViewMatrix,&Objects[Players[Player_num].objnum].orient,&tempm);
3945 Objects[Players[Player_num].objnum].orient = ViewMatrix;
3947 oem_message = (char *)((uint)Kconfig_abs_movement + sizeof(vms_angvec));
3948 if (oem_message[0] != '\0' )
3949 HUD_init_message( oem_message );
3953 Controls.pitch_time += fixmul(kc_external_control->pitch_time,FrameTime);
3954 Controls.vertical_thrust_time += fixmul(kc_external_control->vertical_thrust_time,FrameTime);
3955 Controls.heading_time += fixmul(kc_external_control->heading_time,FrameTime);
3956 Controls.sideways_thrust_time += fixmul(kc_external_control->sideways_thrust_time ,FrameTime);
3957 Controls.bank_time += fixmul(kc_external_control->bank_time ,FrameTime);
3958 Controls.forward_thrust_time += fixmul(kc_external_control->forward_thrust_time ,FrameTime);
3959 Controls.rear_view_down_count += kc_external_control->rear_view_down_count;
3960 Controls.rear_view_down_state |= kc_external_control->rear_view_down_state;
3961 Controls.fire_primary_down_count += kc_external_control->fire_primary_down_count;
3962 Controls.fire_primary_state |= kc_external_control->fire_primary_state;
3963 Controls.fire_secondary_state |= kc_external_control->fire_secondary_state;
3964 Controls.fire_secondary_down_count += kc_external_control->fire_secondary_down_count;
3965 Controls.fire_flare_down_count += kc_external_control->fire_flare_down_count;
3966 Controls.drop_bomb_down_count += kc_external_control->drop_bomb_down_count;
3967 Controls.automap_down_count += kc_external_control->automap_down_count;
3968 Controls.automap_state |= kc_external_control->automap_state;
3970 if (kc_external_version>=3)
3972 ubyte *temp_ptr = (ubyte *)kc_external_control;
3973 temp_ptr += (sizeof(ext_control_info) + sizeof(vms_angvec) + 64 + sizeof(vms_vector) + sizeof (vms_matrix));
3976 Controls.cycle_primary_count=(*(temp_ptr));
3978 Controls.cycle_secondary_count=(*(temp_ptr+1));
3981 Controls.afterburner_state=(*(temp_ptr+2));
3983 Controls.headlight_count=(*(temp_ptr+3));
3985 if (kc_external_version>=4)
3988 advanced_ext_control_info *temp_ptr=(advanced_ext_control_info *)kc_external_control;
3991 if (temp_ptr->keyboard[i])
3994 if (temp_ptr->Reactor_blown)
3996 if (Game_mode & GM_MULTI)
3997 net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN));
3999 do_controlcen_destroyed_stuff(obj_find_first_of_type (OBJ_CNTRLCEN));