diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ec5e42c20..5db240b9f 100755 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20070514 +-------- +SConstruct, arch/sdl/init.c, arch/sdl/joydefs.c, arch/sdl/mouse.c, arch/sdl/include/mouse.h, main/game.c, main/inferno.c, main/kconfig.c, main/kconfig.h, main/newmenu.c, main/newmenu.h, main/playsave.c, main/text.h: Added config field to map a Mouse Axis/Wheel to cycle Primary and Secondary weapons; lots of controls-related code cleaning + 20070510 -------- main/inferno.c: read -pilot arg with and without filename extension diff --git a/SConstruct b/SConstruct index 5e53a22f6..89155c913 100755 --- a/SConstruct +++ b/SConstruct @@ -322,7 +322,7 @@ env.ParseConfig('sdl-config --cflags') env.ParseConfig('sdl-config --libs') env.Append(CPPFLAGS = ['-Wall', '-funsigned-char']) env.Append(CPPDEFINES = [('D1XMAJOR', '\\"' + str(D1XMAJOR) + '\\"'), ('D1XMINOR', '\\"' + str(D1XMINOR) + '\\"')]) -env.Append(CPPDEFINES = ['NMONO', 'NETWORK', 'HAVE_NETIPX_IPX_H', 'SUPPORTS_NET_IP', '__SDL__', 'SDL_INPUT', 'SDL_AUDIO', '_REENTRANT']) +env.Append(CPPDEFINES = ['NMONO', 'NETWORK', 'HAVE_NETIPX_IPX_H', 'SUPPORTS_NET_IP', '__SDL__', 'SDL_AUDIO', '_REENTRANT']) env.Append(CPPPATH = ['include', 'main', 'arch/sdl/include']) generic_libs = ['SDL'] sdlmixerlib = ['SDL_mixer'] diff --git a/arch/sdl/include/mouse.h b/arch/sdl/include/mouse.h index 81dd4e10d..ec1b1faec 100755 --- a/arch/sdl/include/mouse.h +++ b/arch/sdl/include/mouse.h @@ -11,55 +11,9 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvsroot/dxx-rebirth/d1x-rebirth/arch/sdl/mouse.h,v $ - * $Revision: 1.1 $ - * $Author: michaelstather $ - * $Date: 2006/03/19 16:03:36 $ * * Header for mouse functions * - * $Log: mouse.h,v $ - * Revision 1.1 2006/03/19 16:03:36 michaelstather - * *** empty log message *** - * - * Revision 1.1.1.1 2006/03/17 19:40:44 zicodxx - * initial import - * - * Revision 1.1.1.1 1999/06/14 22:02:02 donut - * Import of d1x 1.37 source. - * - * Revision 1.10 1995/02/02 10:22:29 john - * Added cyberman init parameter. - * - * Revision 1.9 1994/11/18 23:18:09 john - * Changed some shorts to ints. - * - * Revision 1.8 1994/09/13 12:33:49 john - * Added functions to get down count and state. - * - * Revision 1.7 1994/08/29 20:52:20 john - * Added better cyberman support; also, joystick calibration - * value return funcctiionn, - * - * Revision 1.6 1994/08/24 17:54:35 john - * *** empty log message *** - * - * Revision 1.5 1994/08/24 17:51:43 john - * Added transparent cyberman support - * - * Revision 1.4 1993/07/27 09:32:22 john - * *** empty log message *** - * - * Revision 1.3 1993/07/26 10:46:44 john - * added definition for mouse_set_pos - * - * Revision 1.2 1993/07/22 13:07:59 john - * added header for mousesetlimts - * - * Revision 1.1 1993/07/10 13:10:40 matt - * Initial revision - * - * */ #ifndef MOUSE_H @@ -97,12 +51,11 @@ extern int mouse_set_limits( int x1, int y1, int x2, int y2 ); extern void mouse_flush(); // clears all mice events... //======================================================================== -extern void mouse_get_pos( int *x, int *y); -extern void mouse_get_delta( int *dx, int *dy ); -extern void mouse_get_delta_z( int *dx, int *dy, int *dz ); +extern void mouse_get_pos( int *x, int *y, int *dz); +// extern void mouse_get_delta( int *dx, int *dy ); +extern void mouse_get_delta( int *dx, int *dy, int *dz ); extern int mouse_get_btns(); extern void mouse_set_pos( int x, int y); -extern void mouse_get_cyberman_pos( int *x, int *y ); // Returns how long this button has been down since last call. extern fix mouse_button_down_time(int button); @@ -119,11 +72,10 @@ extern int mouse_button_state(int button); #define mouse_set_limits(a,b,c,d) -1 #define mouse_flush() #define mouse_close() -#define mouse_get_pos(a,b) -#define mouse_get_delta(a,b) +#define mouse_get_pos(a,b,c) +#define mouse_get_delta(a,b,c) #define mouse_get_btns() 0 #define mouse_set_pos(a,b) -#define mouse_get_cyberman_pos(a,b) #define mouse_button_down_time(a) 0 #define mouse_button_down_count(a) 0 #define mouse_button_state(a) 0 diff --git a/arch/sdl/init.c b/arch/sdl/init.c index 69ac912b8..566f078f0 100755 --- a/arch/sdl/init.c +++ b/arch/sdl/init.c @@ -28,9 +28,9 @@ void arch_sdl_init() //end edit -MM Error("SDL library initialisation failed: %s.",SDL_GetError()); } -#ifdef SDL_INPUT + if (!FindArg("-nomouse")) d_mouse_init(); -#endif + atexit(sdl_close); } diff --git a/arch/sdl/joydefs.c b/arch/sdl/joydefs.c index 81cd125e6..3945864e1 100755 --- a/arch/sdl/joydefs.c +++ b/arch/sdl/joydefs.c @@ -1,9 +1,7 @@ -/* $Id: joydefs.c,v 1.1.1.1 2006/03/17 19:53:43 zicodxx Exp $ */ /* * * SDL joystick support * - * */ #ifdef HAVE_CONFIG_H @@ -20,21 +18,6 @@ extern int num_joysticks; extern int joy_deadzone; -int joydefs_calibrate_flag = 0; - -void joydefs_calibrate() -{ - joydefs_calibrate_flag = 0; - - if (!num_joysticks) { - nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK ); - return; - } - - //Actual calibration if necessary - -} - //this change was made in DESCENT.TEX, but since we're not including that //file in the v1.1 update, we're making the change in the code here also // #ifdef SHAREWARE @@ -57,22 +40,7 @@ void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE; if (Config_control_type == 3) Config_control_type = CONTROL_JOYMOUSE; - if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) { - nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS ); - } - if (oc_type != Config_control_type) { - switch (Config_control_type) { - // case CONTROL_NONE: - case CONTROL_JOYSTICK: - case CONTROL_FLIGHTSTICK_PRO: - case CONTROL_THRUSTMASTER_FCS: - case CONTROL_GRAVIS_GAMEPAD: - // case CONTROL_MOUSE: - // case CONTROL_CYBERMAN: - case CONTROL_JOYMOUSE: - joydefs_calibrate_flag = 1; - } kc_set_controls(); } } diff --git a/arch/sdl/mouse.c b/arch/sdl/mouse.c index 97864a9c8..2d72d604c 100755 --- a/arch/sdl/mouse.c +++ b/arch/sdl/mouse.c @@ -98,23 +98,7 @@ void mouse_flush() // clears all mice events... } //======================================================================== -void mouse_get_pos( int *x, int *y) -{ - event_poll(); - *x=Mouse.x; - *y=Mouse.y; -} - -void mouse_get_delta( int *dx, int *dy ) -{ - event_poll(); - *dx = Mouse.delta_x; - *dy = Mouse.delta_y; - Mouse.delta_x = 0; - Mouse.delta_y = 0; -} - -void mouse_get_pos_z( int *x, int *y, int *z ) +void mouse_get_pos( int *x, int *y, int *z ) { event_poll(); *x=Mouse.x; @@ -122,7 +106,7 @@ void mouse_get_pos_z( int *x, int *y, int *z ) *z=Mouse.z; } -void mouse_get_delta_z( int *dx, int *dy, int *dz ) +void mouse_get_delta( int *dx, int *dy, int *dz ) { event_poll(); *dx = Mouse.delta_x; @@ -150,12 +134,6 @@ int mouse_get_btns() return status; } -void mouse_get_cyberman_pos( int *x, int *y ) -{ - // Shrug... - event_poll(); -} - // Returns how long this button has been down since last call. fix mouse_button_down_time(int button) { @@ -193,5 +171,3 @@ int mouse_button_state(int button) event_poll(); return Mouse.buttons[button].pressed; } - - diff --git a/main/game.c b/main/game.c index 281274649..d0b39392c 100755 --- a/main/game.c +++ b/main/game.c @@ -964,11 +964,11 @@ void start_time() void game_flush_inputs() { - int dx,dy; + int dx,dy,dz; key_flush(); joy_flush(); mouse_flush(); - mouse_get_delta( &dx, &dy ); // Read mouse + mouse_get_delta( &dx, &dy, &dz ); // Read mouse memset(&Controls,0,sizeof(control_info)); } @@ -1790,7 +1790,7 @@ void show_help() m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_ALT_F3; mc++; m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F2; mc++; m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F3; mc++; - m[mc].type = NM_TYPE_TEXT; m[mc].text = "SHIFT-F3\t TOGGLE RADAR"; mc++; + m[mc].type = NM_TYPE_TEXT; m[mc].text = "F4\t TOGGLE RADAR"; mc++; m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F5; mc++; m[mc].type = NM_TYPE_TEXT; m[mc].text = "ALT-F7\t switch hud-mode"; mc++; m[mc].type = NM_TYPE_TEXT; m[mc].text = "ALT-F9/F10\t change screen size"; mc++; @@ -2415,9 +2415,9 @@ void HandleGameKey(int key) case KEY_F1: do_show_help(); break; case KEY_F2: Config_menu_flag = 1; break; case KEY_F3: toggle_cockpit(); break; + case KEY_F4: case KEY_SHIFTED+KEY_F3: if(!(Game_mode & GM_MULTI)||Network_allow_radar||I_am_observer) show_radar = !show_radar; break; - case KEY_F4: palette_save(); joydefs_calibrate(); palette_restore(); break; case KEY_F5: if ( Newdemo_state == ND_STATE_RECORDING ) newdemo_stop_recording(); diff --git a/main/inferno.c b/main/inferno.c index 3a8651a66..dd848cc2b 100755 --- a/main/inferno.c +++ b/main/inferno.c @@ -538,11 +538,6 @@ int main(int argc,char **argv) control_invul_time = 0; #endif - i = FindArg( "-xcontrol" ); - if ( i > 0 ) { - kconfig_init_external_controls( strtol(Args[i+1], NULL, 0), strtol(Args[i+2], NULL, 0) ); - } - if (Inferno_verbose) printf( "\n%s\n\n", TXT_INITIALIZING_GRAPHICS); if ((t=gr_init( SM_ORIGINAL ))!=0) diff --git a/main/kconfig.c b/main/kconfig.c index d16a4a35b..b76c8eeb0 100755 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -29,11 +29,6 @@ static char rcsid[] = "$Id: kconfig.c,v 1.1.1.1 2006/03/17 19:44:27 zicodxx Exp #include #include -#ifdef __MSDOS__ -#include -#include -#endif - #include "error.h" #include "types.h" #include "gr.h" @@ -76,18 +71,15 @@ static char rcsid[] = "$Id: kconfig.c,v 1.1.1.1 2006/03/17 19:44:27 zicodxx Exp // Array used to 'blink' the cursor while waiting for a keypress. 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 }; -int invert_text[2] = { TNUM_N, TNUM_Y }; +char * invert_text[2] = { "N", "Y" }; char *joybutton_text[JOY_MAX_BUTTONS]; char *joyaxis_text[JOY_MAX_AXES]; -int mouseaxis_text[3] = { TNUM_L_R, TNUM_F_B, TNUM_MID }; -int mousebutton_text[3] = { TNUM_LEFT, TNUM_RIGHT, TNUM_MID }; +char * mouseaxis_text[3] = { "L/R", "F/B", "WHEEL" }; +char * mousebutton_text[3] = { "LEFT", "RIGHT", "MID" }; char * mousebutton_textra[13] = { "M4", "M5", "M6", "M7", "M8", "M9", "M10","M11","M12","M13","M14","M15","M16" };//text for buttons above 3. -MPM -//added/removed by Victor Rachels for adding rebindable keys for these -// KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0 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 }; -//extern void GameLoop(int, int ); extern void gr_bm_bitblt(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest); extern void nm_draw_background1(char * filename); @@ -131,7 +123,7 @@ typedef struct kc_item { short w2; // Input box length short u,d,l,r; // ID of neighboring selection ie. when you hit the up arrow, it will go to // the ID of 'u' - short text_num1; + char *text; ubyte type; ubyte value; // what key,button,etc } kc_item; @@ -140,10 +132,7 @@ int Num_items=23; kc_item *All_items; ubyte kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS]; - -//added on 2/4/99 by Victor Rachels to add d1x new keys ubyte kconfig_d1x_settings[MAX_D1X_CONTROLS]; -//end this section addition - VR //----------- WARNING!!!!!!! ------------------------------------------- // THESE NEXT FOUR BLOCKS OF DATA ARE GENERATED BY PRESSING DEL+F12 WHEN @@ -152,237 +141,188 @@ ubyte kconfig_d1x_settings[MAX_D1X_CONTROLS]; //------------------------------------------------------------------------- ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS] = { -{KEY_UP, KEY_PAD8, KEY_DOWN, KEY_PAD2, KEY_LEFT, KEY_PAD4, KEY_RIGHT, KEY_PAD6, - KEY_LALT, 255, 255, KEY_PAD1, 255, KEY_PAD3, 255, KEY_PADMINUS, 255, KEY_PADPLUS, - 255, 255, KEY_Q, KEY_PAD7, KEY_E, KEY_PAD9, KEY_LCTRL, KEY_RCTRL, KEY_SPACEBAR, - 255, KEY_F, 255, KEY_A, 255, KEY_Z, 255, KEY_B, 255, KEY_R, 0xff,0xff,0xff,0xff, - 0xff,0xff,0xff, KEY_TAB, 0xff,0xff,0xff,0xff,0xff,0xff, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels -{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, -//added/edited on 9/3/98 by Victor Rachels to fix the default keysetting - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, -//end this section change - Victor Rachels +{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,0x15,0xff,0x30,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{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,0x2,0x0,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, +{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, }; -//added on 2/4/99 by Victor Rachels to add new keys system + ubyte default_kconfig_d1x_settings[MAX_D1X_CONTROLS] = { 0x2 ,0xff,0x3 ,0xff,0x4 ,0xff,0x5 ,0xff,0x6 ,0xff,0x7 ,0xff,0x8 ,0xff,0x9 , 0xff,0xa ,0xff,0xb ,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff }; -//end this section addition - VR kc_item kc_keyboard[NUM_KEY_CONTROLS] = { - { 0, 15, 49, 71, 26, 43, 2, 23, 1,TNUM_PITCH_FORWARD, BT_KEY, 255 }, - { 1, 15, 49,100, 26, 22, 3, 0, 24,TNUM_PITCH_FORWARD, BT_KEY, 255 }, - { 2, 15, 57, 71, 26, 0, 4, 25, 3,TNUM_PITCH_BACKWARD, BT_KEY, 255 }, - { 3, 15, 57,100, 26, 1, 5, 2, 26,TNUM_PITCH_BACKWARD, BT_KEY, 255 }, - { 4, 15, 65, 71, 26, 2, 6, 27, 5,TNUM_TURN_LEFT, BT_KEY, 255 }, - { 5, 15, 65,100, 26, 3, 7, 4, 28,TNUM_TURN_LEFT, BT_KEY, 255 }, - { 6, 15, 73, 71, 26, 4, 8, 29, 7,TNUM_TURN_RIGHT, BT_KEY, 255 }, - { 7, 15, 73,100, 26, 5, 9, 6, 34,TNUM_TURN_RIGHT, BT_KEY, 255 }, - { 8, 15, 85, 71, 26, 6, 10, 35, 9,TNUM_SLIDE_ON, BT_KEY, 255 }, - { 9, 15, 85,100, 26, 7, 11, 8, 36,TNUM_SLIDE_ON, BT_KEY, 255 }, - { 10, 15, 93, 71, 26, 8, 12, 37, 11,TNUM_SLIDE_LEFT, BT_KEY, 255 }, - { 11, 15, 93,100, 26, 9, 13, 10, 44,TNUM_SLIDE_LEFT, BT_KEY, 255 }, - { 12, 15,101, 71, 26, 10, 14, 45, 13,TNUM_SLIDE_RIGHT, BT_KEY, 255 }, - { 13, 15,101,100, 26, 11, 15, 12, 30,TNUM_SLIDE_RIGHT, BT_KEY, 255 }, - { 14, 15,109, 71, 26, 12, 16, 31, 15,TNUM_SLIDE_UP, BT_KEY, 255 }, - { 15, 15,109,100, 26, 13, 17, 14, 32,TNUM_SLIDE_UP, BT_KEY, 255 }, - { 16, 15,117, 71, 26, 14, 18, 33, 17,TNUM_SLIDE_DOWN, BT_KEY, 255 }, - { 17, 15,117,100, 26, 15, 19, 16, 38,TNUM_SLIDE_DOWN, BT_KEY, 255 }, - { 18, 15,129, 71, 26, 16, 20, 39, 19,TNUM_BANK_ON, BT_KEY, 255 }, - { 19, 15,129,100, 26, 17, 21, 18, 40,TNUM_BANK_ON, BT_KEY, 255 }, - { 20, 15,137, 71, 26, 18, 22, 41, 21,TNUM_BANK_LEFT, BT_KEY, 255 }, - { 21, 15,137,100, 26, 19, 23, 20, 42,TNUM_BANK_LEFT, BT_KEY, 255 }, - { 22, 15,145, 71, 26, 20, 1, 43, 23,TNUM_BANK_RIGHT, BT_KEY, 255 }, - { 23, 15,145,100, 26, 21, 24, 22, 0,TNUM_BANK_RIGHT, BT_KEY, 255 }, - { 24,158, 49, 83, 26, 23, 26, 1, 25,TNUM_FIRE_PRIMARY, BT_KEY, 255 }, - { 25,158, 49,112, 26, 42, 27, 24, 2,TNUM_FIRE_PRIMARY, BT_KEY, 255 }, - { 26,158, 57, 83, 26, 24, 28, 3, 27,TNUM_FIRE_SECONDARY, BT_KEY, 255 }, - { 27,158, 57,112, 26, 25, 29, 26, 4,TNUM_FIRE_SECONDARY, BT_KEY, 255 }, - { 28,158, 65, 83, 26, 26, 34, 5, 29,TNUM_FIRE_FLARE, BT_KEY, 255 }, - { 29,158, 65,112, 26, 27, 35, 28, 6,TNUM_FIRE_FLARE, BT_KEY, 255 }, - { 30,158,105, 83, 26, 44, 32, 13, 31,TNUM_ACCELERATE, BT_KEY, 255 }, - { 31,158,105,112, 26, 45, 33, 30, 14,TNUM_ACCELERATE, BT_KEY, 255 }, - { 32,158,113, 83, 26, 30, 38, 15, 33,TNUM_REVERSE, BT_KEY, 255 }, - { 33,158,113,112, 26, 31, 39, 32, 16,TNUM_REVERSE, BT_KEY, 255 }, - { 34,158, 73, 83, 26, 28, 36, 7, 35,TNUM_DROP_BOMB, BT_KEY, 255 }, - { 35,158, 73,112, 26, 29, 37, 34, 8,TNUM_DROP_BOMB, BT_KEY, 255 }, - { 36,158, 85, 83, 26, 34, 44, 9, 37,TNUM_REAR_VIEW, BT_KEY, 255 }, - { 37,158, 85,112, 26, 35, 45, 36, 10,TNUM_REAR_VIEW, BT_KEY, 255 }, - { 38,158,125, 83, 26, 32, 40, 17, 39,TNUM_CRUISE_FASTER, BT_KEY, 255 }, - { 39,158,125,112, 26, 33, 41, 38, 18,TNUM_CRUISE_FASTER, BT_KEY, 255 }, - { 40,158,133, 83, 26, 38, 42, 19, 41,TNUM_CRUISE_SLOWER, BT_KEY, 255 }, - { 41,158,133,112, 26, 39, 43, 40, 20,TNUM_CRUISE_SLOWER, BT_KEY, 255 }, - { 42,158,141, 83, 26, 40, 25, 21, 43,TNUM_CRUISE_OFF, BT_KEY, 255 }, - { 43,158,141,112, 26, 41, 0, 42, 22,TNUM_CRUISE_OFF, BT_KEY, 255 }, - { 44,158, 93, 83, 26, 36, 30, 11, 45,TNUM_AUTOMAP, BT_KEY, 255 }, - { 45,158, 93,112, 26, 37, 31, 44, 12,TNUM_AUTOMAP, BT_KEY, 255 }, + { 0, 15, 49, 71, 26, 43, 2, 23, 1,"Pitch forward", BT_KEY, 255 }, + { 1, 15, 49,100, 26, 22, 3, 0, 24,"Pitch forward", BT_KEY, 255 }, + { 2, 15, 57, 71, 26, 0, 4, 25, 3,"Pitch backward", BT_KEY, 255 }, + { 3, 15, 57,100, 26, 1, 5, 2, 26,"Pitch backward", BT_KEY, 255 }, + { 4, 15, 65, 71, 26, 2, 6, 27, 5,"Turn left", BT_KEY, 255 }, + { 5, 15, 65,100, 26, 3, 7, 4, 28,"Turn left", BT_KEY, 255 }, + { 6, 15, 73, 71, 26, 4, 8, 29, 7,"Turn right", BT_KEY, 255 }, + { 7, 15, 73,100, 26, 5, 9, 6, 34,"Turn right", BT_KEY, 255 }, + { 8, 15, 85, 71, 26, 6, 10, 35, 9,"Slide on", BT_KEY, 255 }, + { 9, 15, 85,100, 26, 7, 11, 8, 36,"Slide on", BT_KEY, 255 }, + { 10, 15, 93, 71, 26, 8, 12, 37, 11,"Slide left", BT_KEY, 255 }, + { 11, 15, 93,100, 26, 9, 13, 10, 44,"Slide left", BT_KEY, 255 }, + { 12, 15,101, 71, 26, 10, 14, 45, 13,"Slide right", BT_KEY, 255 }, + { 13, 15,101,100, 26, 11, 15, 12, 30,"Slide right", BT_KEY, 255 }, + { 14, 15,109, 71, 26, 12, 16, 31, 15,"Slide up", BT_KEY, 255 }, + { 15, 15,109,100, 26, 13, 17, 14, 32,"Slide up", BT_KEY, 255 }, + { 16, 15,117, 71, 26, 14, 18, 33, 17,"Slide down", BT_KEY, 255 }, + { 17, 15,117,100, 26, 15, 19, 16, 38,"Slide down", BT_KEY, 255 }, + { 18, 15,129, 71, 26, 16, 20, 39, 19,"Bank on", BT_KEY, 255 }, + { 19, 15,129,100, 26, 17, 21, 18, 40,"Bank on", BT_KEY, 255 }, + { 20, 15,137, 71, 26, 18, 22, 41, 21,"Bank left", BT_KEY, 255 }, + { 21, 15,137,100, 26, 19, 23, 20, 42,"Bank left", BT_KEY, 255 }, + { 22, 15,145, 71, 26, 20, 1, 43, 23,"Bank right", BT_KEY, 255 }, + { 23, 15,145,100, 26, 21, 24, 22, 0,"Bank right", BT_KEY, 255 }, + { 24,158, 49, 83, 26, 23, 26, 1, 25,"Fire primary", BT_KEY, 255 }, + { 25,158, 49,112, 26, 42, 27, 24, 2,"Fire primary", BT_KEY, 255 }, + { 26,158, 57, 83, 26, 24, 28, 3, 27,"Fire secondary", BT_KEY, 255 }, + { 27,158, 57,112, 26, 25, 29, 26, 4,"Fire secondary", BT_KEY, 255 }, + { 28,158, 65, 83, 26, 26, 34, 5, 29,"Fire flare", BT_KEY, 255 }, + { 29,158, 65,112, 26, 27, 35, 28, 6,"Fire flare", BT_KEY, 255 }, + { 30,158,105, 83, 26, 44, 32, 13, 31,"Accelerate", BT_KEY, 255 }, + { 31,158,105,112, 26, 45, 33, 30, 14,"Accelerate", BT_KEY, 255 }, + { 32,158,113, 83, 26, 30, 38, 15, 33,"Reverse", BT_KEY, 255 }, + { 33,158,113,112, 26, 31, 39, 32, 16,"Reverse", BT_KEY, 255 }, + { 34,158, 73, 83, 26, 28, 36, 7, 35,"Drop bomb", BT_KEY, 255 }, + { 35,158, 73,112, 26, 29, 37, 34, 8,"Drop bomb", BT_KEY, 255 }, + { 36,158, 85, 83, 26, 34, 44, 9, 37,"Rear view", BT_KEY, 255 }, + { 37,158, 85,112, 26, 35, 45, 36, 10,"Rear view", BT_KEY, 255 }, + { 38,158,125, 83, 26, 32, 40, 17, 39,"Cruise faster", BT_KEY, 255 }, + { 39,158,125,112, 26, 33, 41, 38, 18,"Cruise faster", BT_KEY, 255 }, + { 40,158,133, 83, 26, 38, 42, 19, 41,"Cruise slower", BT_KEY, 255 }, + { 41,158,133,112, 26, 39, 43, 40, 20,"Cruise slower", BT_KEY, 255 }, + { 42,158,141, 83, 26, 40, 25, 21, 43,"Cruise off", BT_KEY, 255 }, + { 43,158,141,112, 26, 41, 0, 42, 22,"Cruise off", BT_KEY, 255 }, + { 44,158, 93, 83, 26, 36, 30, 11, 45,"Automap", BT_KEY, 255 }, + { 45,158, 93,112, 26, 37, 31, 44, 12,"Automap", BT_KEY, 255 }, }; kc_item kc_joystick[NUM_JOYSTICK_CONTROLS] = { - { 0, 22, 52, 82, 26, 15, 1, 24, 29,TNUM_FIRE_PRIMARY, BT_JOY_BUTTON, 255 }, - { 1, 22, 60, 82, 26, 0, 4, 34, 30,TNUM_FIRE_SECONDARY, BT_JOY_BUTTON, 255 }, - { 2, 22, 88, 82, 26, 26, 3, 38, 31,TNUM_ACCELERATE, BT_JOY_BUTTON, 255 }, - { 3, 22, 96, 82, 26, 2, 25, 31, 32,TNUM_REVERSE, BT_JOY_BUTTON, 255 }, - { 4, 22, 68, 82, 26, 1, 26, 35, 33,TNUM_FIRE_FLARE, BT_JOY_BUTTON, 255 }, - { 5,180, 52, 59, 26, 23, 6, 29, 34,TNUM_SLIDE_ON, BT_JOY_BUTTON, 255 }, - { 6,180, 60, 59, 26, 5, 7, 30, 35,TNUM_SLIDE_LEFT, BT_JOY_BUTTON, 255 }, - { 7,180, 68, 59, 26, 6, 8, 33, 36,TNUM_SLIDE_RIGHT, BT_JOY_BUTTON, 255 }, - { 8,180, 76, 59, 26, 7, 9, 43, 37,TNUM_SLIDE_UP, BT_JOY_BUTTON, 255 }, - { 9,180, 84, 59, 26, 8, 10, 37, 38,TNUM_SLIDE_DOWN, BT_JOY_BUTTON, 255 }, - { 10,180, 96, 59, 26, 9, 11, 32, 39,TNUM_BANK_ON, BT_JOY_BUTTON, 255 }, - { 11,180,104, 59, 26, 10, 12, 39, 40,TNUM_BANK_LEFT, BT_JOY_BUTTON, 255 }, - { 12,180,112, 59, 26, 11, 17, 42, 41,TNUM_BANK_RIGHT, BT_JOY_BUTTON, 255 }, - { 13, 22,146, 51, 26, 27, 15, 28, 14,TNUM_PITCH_UD, BT_JOY_AXIS, 255 }, - { 14, 22,146, 99, 8, 28, 16, 13, 17,TNUM_PITCH_UD, BT_INVERT, 255 }, - { 15, 22,154, 51, 26, 13, 0, 18, 16,TNUM_TURN_LR, BT_JOY_AXIS, 255 }, - { 16, 22,154, 99, 8, 14, 29, 15, 19,TNUM_TURN_LR, BT_INVERT, 255 }, - { 17,164,146, 58, 26, 12, 19, 14, 18,TNUM_SLIDE_LR, BT_JOY_AXIS, 255 }, - { 18,164,146,106, 8, 41, 20, 17, 15,TNUM_SLIDE_LR, BT_INVERT, 255 }, - { 19,164,154, 58, 26, 17, 21, 16, 20,TNUM_SLIDE_UD, BT_JOY_AXIS, 255 }, - { 20,164,154,106, 8, 18, 22, 19, 21,TNUM_SLIDE_UD, BT_INVERT, 255 }, - { 21,164,162, 58, 26, 19, 23, 20, 22,TNUM_BANK_LR, BT_JOY_AXIS, 255 }, - { 22,164,162,106, 8, 20, 24, 21, 23,TNUM_BANK_LR, BT_INVERT, 255 }, - { 23,164,174, 58, 26, 21, 5, 22, 24,TNUM_THROTTLE, BT_JOY_AXIS, 255 }, - { 24,164,174,106, 8, 22, 34, 23, 0,TNUM_THROTTLE, BT_INVERT, 255 }, - { 25, 22,108, 82, 26, 3, 27, 40, 42,TNUM_REAR_VIEW, BT_JOY_BUTTON, 255 }, - { 26, 22, 76, 82, 26, 4, 2, 36, 43,TNUM_DROP_BOMB, BT_JOY_BUTTON, 255 }, - { 27, 22,116, 82, 26, 25, 13, 41, 28,TNUM_AUTOMAP, BT_JOY_BUTTON, 255 }, - { 28, 22,116,111, 26, 42, 14, 27, 13,TNUM_AUTOMAP, BT_JOY_BUTTON, 255 }, - { 29, 22, 52,111, 26, 16, 30, 0, 5,TNUM_FIRE_PRIMARY, BT_JOY_BUTTON, 255 }, - { 30, 22, 60,111, 26, 29, 33, 1, 6,TNUM_FIRE_SECONDARY, BT_JOY_BUTTON, 255 }, - { 31, 22, 88,111, 26, 43, 32, 2, 3,TNUM_ACCELERATE, BT_JOY_BUTTON, 255 }, - { 32, 22, 96,111, 26, 31, 42, 3, 10,TNUM_REVERSE, BT_JOY_BUTTON, 255 }, - { 33, 22, 68,111, 26, 30, 43, 4, 7,TNUM_FIRE_FLARE, BT_JOY_BUTTON, 255 }, - { 34,180, 52, 88, 26, 24, 35, 5, 1,TNUM_SLIDE_ON, BT_JOY_BUTTON, 255 }, - { 35,180, 60, 88, 26, 34, 36, 6, 4,TNUM_SLIDE_LEFT, BT_JOY_BUTTON, 255 }, - { 36,180, 68, 88, 26, 35, 37, 7, 26,TNUM_SLIDE_RIGHT, BT_JOY_BUTTON, 255 }, - { 37,180, 76, 88, 26, 36, 38, 8, 9,TNUM_SLIDE_UP, BT_JOY_BUTTON, 255 }, - { 38,180, 84, 88, 26, 37, 39, 9, 2,TNUM_SLIDE_DOWN, BT_JOY_BUTTON, 255 }, - { 39,180, 96, 88, 26, 38, 40, 10, 11,TNUM_BANK_ON, BT_JOY_BUTTON, 255 }, - { 40,180,104, 88, 26, 39, 41, 11, 25,TNUM_BANK_LEFT, BT_JOY_BUTTON, 255 }, - { 41,180,112, 88, 26, 40, 18, 12, 27,TNUM_BANK_RIGHT, BT_JOY_BUTTON, 255 }, - { 42, 22,108,111, 26, 32, 28, 25, 12,TNUM_REAR_VIEW, BT_JOY_BUTTON, 255 }, - { 43, 22, 76,111, 26, 33, 31, 26, 8,TNUM_DROP_BOMB, BT_JOY_BUTTON, 255 }, + { 0, 22, 52, 82, 26, 15, 1, 24, 29,"Fire primary", BT_JOY_BUTTON, 255 }, + { 1, 22, 60, 82, 26, 0, 4, 34, 30,"Fire secondary", BT_JOY_BUTTON, 255 }, + { 2, 22, 88, 82, 26, 26, 3, 38, 31,"Accelerate", BT_JOY_BUTTON, 255 }, + { 3, 22, 96, 82, 26, 2, 25, 31, 32,"Reverse", BT_JOY_BUTTON, 255 }, + { 4, 22, 68, 82, 26, 1, 26, 35, 33,"Fire flare", BT_JOY_BUTTON, 255 }, + { 5,180, 52, 59, 26, 23, 6, 29, 34,"Slide on", BT_JOY_BUTTON, 255 }, + { 6,180, 60, 59, 26, 5, 7, 30, 35,"Slide left", BT_JOY_BUTTON, 255 }, + { 7,180, 68, 59, 26, 6, 8, 33, 36,"Slide right", BT_JOY_BUTTON, 255 }, + { 8,180, 76, 59, 26, 7, 9, 43, 37,"Slide up", BT_JOY_BUTTON, 255 }, + { 9,180, 84, 59, 26, 8, 10, 37, 38,"Slide down", BT_JOY_BUTTON, 255 }, + { 10,180, 96, 59, 26, 9, 11, 32, 39,"Bank on", BT_JOY_BUTTON, 255 }, + { 11,180,104, 59, 26, 10, 12, 39, 40,"Bank left", BT_JOY_BUTTON, 255 }, + { 12,180,112, 59, 26, 11, 34, 42, 41,"Bank right", BT_JOY_BUTTON, 255 }, + { 13, 22,146, 51, 26, 24, 15, 28, 14,"Pitch U/D", BT_JOY_AXIS, 255 }, + { 14, 22,146, 99, 8, 27, 16, 13, 17,"Pitch U/D", BT_INVERT, 255 }, + { 15, 22,154, 51, 26, 13, 0, 18, 16,"Turn L/R", BT_JOY_AXIS, 255 }, + { 16, 22,154, 99, 8, 14, 29, 15, 19,"Turn L/R", BT_INVERT, 255 }, + { 17,164,146, 58, 26, 28, 19, 14, 18,"Slide L/R", BT_JOY_AXIS, 255 }, + { 18,164,146,106, 8, 41, 20, 17, 15,"Slide L/R", BT_INVERT, 255 }, + { 19,164,154, 58, 26, 17, 21, 16, 20,"Slide U/D", BT_JOY_AXIS, 255 }, + { 20,164,154,106, 8, 18, 22, 19, 21,"Slide U/D", BT_INVERT, 255 }, + { 21,164,162, 58, 26, 19, 23, 20, 22,"Bank L/R", BT_JOY_AXIS, 255 }, + { 22,164,162,106, 8, 20, 24, 21, 23,"Bank L/R", BT_INVERT, 255 }, + { 23,164,174, 58, 26, 21, 5, 22, 24,"Throttle", BT_JOY_AXIS, 255 }, + { 24,164,174,106, 8, 22, 13, 23, 0,"Throttle", BT_INVERT, 255 }, + { 25, 22,108, 82, 26, 3, 27, 40, 42,"Rear view", BT_JOY_BUTTON, 255 }, + { 26, 22, 76, 82, 26, 4, 2, 36, 43,"Drop bomb", BT_JOY_BUTTON, 255 }, + { 27, 22,116, 82, 26, 25, 14, 41, 28,"Automap", BT_JOY_BUTTON, 255 }, + { 28, 22,116,111, 26, 42, 17, 27, 13,"Automap", BT_JOY_BUTTON, 255 }, + { 29, 22, 52,111, 26, 16, 30, 0, 5,"Fire primary", BT_JOY_BUTTON, 255 }, + { 30, 22, 60,111, 26, 29, 33, 1, 6,"Fire secondary", BT_JOY_BUTTON, 255 }, + { 31, 22, 88,111, 26, 43, 32, 2, 3,"Accelerate", BT_JOY_BUTTON, 255 }, + { 32, 22, 96,111, 26, 31, 42, 3, 10,"Reverse", BT_JOY_BUTTON, 255 }, + { 33, 22, 68,111, 26, 30, 43, 4, 7,"Fire flare", BT_JOY_BUTTON, 255 }, + { 34,180, 52, 88, 26, 12, 35, 5, 1,"Slide on", BT_JOY_BUTTON, 255 }, + { 35,180, 60, 88, 26, 34, 36, 6, 4,"Slide left", BT_JOY_BUTTON, 255 }, + { 36,180, 68, 88, 26, 35, 37, 7, 26,"Slide right", BT_JOY_BUTTON, 255 }, + { 37,180, 76, 88, 26, 36, 38, 8, 9,"Slide up", BT_JOY_BUTTON, 255 }, + { 38,180, 84, 88, 26, 37, 39, 9, 2,"Slide down", BT_JOY_BUTTON, 255 }, + { 39,180, 96, 88, 26, 38, 40, 10, 11,"Bank on", BT_JOY_BUTTON, 255 }, + { 40,180,104, 88, 26, 39, 41, 11, 25,"Bank left", BT_JOY_BUTTON, 255 }, + { 41,180,112, 88, 26, 40, 18, 12, 27,"Bank right", BT_JOY_BUTTON, 255 }, + { 42, 22,108,111, 26, 32, 28, 25, 12,"Rear view", BT_JOY_BUTTON, 255 }, + { 43, 22, 76,111, 26, 33, 31, 26, 8,"Drop bomb", BT_JOY_BUTTON, 255 }, }; - kc_item kc_mouse[NUM_MOUSE_CONTROLS] = { - { 0, 25, 46, 85, 26, 12, 1, 24, 5,TNUM_FIRE_PRIMARY, BT_MOUSE_BUTTON, 255 }, - { 1, 25, 54, 85, 26, 0, 4, 5, 6,TNUM_FIRE_SECONDARY, BT_MOUSE_BUTTON, 255 }, - { 2, 25, 85, 85, 26, 26, 3, 9, 10,TNUM_ACCELERATE, BT_MOUSE_BUTTON, 255 }, - { 3, 25, 93, 85, 26, 2, 25, 10, 11,TNUM_REVERSE, BT_MOUSE_BUTTON, 255 }, - { 4, 25, 62, 85, 26, 1, 26, 6, 7,TNUM_FIRE_FLARE, BT_MOUSE_BUTTON, 255 }, - { 5,180, 46, 59, 26, 24, 6, 0, 1,TNUM_SLIDE_ON, BT_MOUSE_BUTTON, 255 }, - { 6,180, 54, 59, 26, 5, 7, 1, 4,TNUM_SLIDE_LEFT, BT_MOUSE_BUTTON, 255 }, - { 7,180, 62, 59, 26, 6, 8, 4, 26,TNUM_SLIDE_RIGHT, BT_MOUSE_BUTTON, 255 }, - { 8,180, 70, 59, 26, 7, 9, 26, 9,TNUM_SLIDE_UP, BT_MOUSE_BUTTON, 255 }, - { 9,180, 78, 59, 26, 8, 10, 8, 2,TNUM_SLIDE_DOWN, BT_MOUSE_BUTTON, 255 }, - { 10,180, 90, 59, 26, 9, 11, 2, 3,TNUM_BANK_ON, BT_MOUSE_BUTTON, 255 }, - { 11,180, 98, 59, 26, 10, 12, 3, 12,TNUM_BANK_LEFT, BT_MOUSE_BUTTON, 255 }, - { 12,180,106, 59, 26, 11, 0, 11, 25,TNUM_BANK_RIGHT, BT_MOUSE_BUTTON, 255 }, - { 13,103,138, 58, 26, 25, 15, 25, 14,TNUM_PITCH_UD, BT_MOUSE_AXIS, 255 }, - { 14,103,138,106, 8, 23, 16, 13, 15,TNUM_PITCH_UD, BT_INVERT, 255 }, - { 15,103,146, 58, 26, 13, 17, 14, 16,TNUM_TURN_LR, BT_MOUSE_AXIS, 255 }, - { 16,103,146,106, 8, 14, 18, 15, 17,TNUM_TURN_LR, BT_INVERT, 255 }, - { 17,103,154, 58, 26, 15, 19, 16, 18,TNUM_SLIDE_LR, BT_MOUSE_AXIS, 255 }, - { 18,103,154,106, 8, 16, 20, 17, 19,TNUM_SLIDE_LR, BT_INVERT, 255 }, - { 19,103,162, 58, 26, 17, 21, 18, 20,TNUM_SLIDE_UD, BT_MOUSE_AXIS, 255 }, - { 20,103,162,106, 8, 18, 22, 19, 21,TNUM_SLIDE_UD, BT_INVERT, 255 }, - { 21,103,170, 58, 26, 19, 23, 20, 22,TNUM_BANK_LR, BT_MOUSE_AXIS, 255 }, - { 22,103,170,106, 8, 20, 24, 21, 23,TNUM_BANK_LR, BT_INVERT, 255 }, - { 23,103,182, 58, 26, 21, 14, 22, 24,TNUM_THROTTLE, BT_MOUSE_AXIS, 255 }, - { 24,103,182,106, 8, 22, 5, 23, 0,TNUM_THROTTLE, BT_INVERT, 255 }, - { 25, 25,109, 85, 26, 3, 13, 12, 13,TNUM_REAR_VIEW, BT_MOUSE_BUTTON, 255 }, - { 26, 25, 70, 85, 26, 4, 2, 7, 8,TNUM_DROP_BOMB, BT_MOUSE_BUTTON, 255 }, + { 0, 25, 46, 85, 26, 19, 1, 20, 5,"Fire primary", BT_MOUSE_BUTTON, 255 }, + { 1, 25, 54, 85, 26, 0, 4, 5, 6,"Fire secondary", BT_MOUSE_BUTTON, 255 }, + { 2, 25, 85, 85, 26, 26, 3, 9, 10,"Accelerate", BT_MOUSE_BUTTON, 255 }, + { 3, 25, 93, 85, 26, 2, 25, 10, 11,"Reverse", BT_MOUSE_BUTTON, 255 }, + { 4, 25, 62, 85, 26, 1, 26, 6, 7,"Fire flare", BT_MOUSE_BUTTON, 255 }, + { 5,180, 46, 59, 26, 27, 6, 0, 1,"Slide on", BT_MOUSE_BUTTON, 255 }, + { 6,180, 54, 59, 26, 5, 7, 1, 4,"Slide left", BT_MOUSE_BUTTON, 255 }, + { 7,180, 62, 59, 26, 6, 8, 4, 26,"Slide right", BT_MOUSE_BUTTON, 255 }, + { 8,180, 70, 59, 26, 7, 9, 26, 9,"Slide up", BT_MOUSE_BUTTON, 255 }, + { 9,180, 78, 59, 26, 8, 10, 8, 2,"Slide down", BT_MOUSE_BUTTON, 255 }, + { 10,180, 90, 59, 26, 9, 11, 2, 3,"Bank on", BT_MOUSE_BUTTON, 255 }, + { 11,180, 98, 59, 26, 10, 12, 3, 12,"Bank left", BT_MOUSE_BUTTON, 255 }, + { 12,180,106, 59, 26, 11, 22, 11, 25,"Bank right", BT_MOUSE_BUTTON, 255 }, + { 13, 25,138, 58, 26, 28, 15, 25, 14,"Pitch U/D", BT_MOUSE_AXIS, 255 }, + { 14, 25,138,106, 8, 25, 16, 13, 21,"Pitch U/D", BT_INVERT, 255 }, + { 15, 25,146, 58, 26, 13, 17, 22, 16,"Turn L/R", BT_MOUSE_AXIS, 255 }, + { 16, 25,146,106, 8, 14, 18, 15, 23,"Turn L/R", BT_INVERT, 255 }, + { 17, 25,154, 58, 26, 15, 19, 24, 18,"Slide L/R", BT_MOUSE_AXIS, 255 }, + { 18, 25,154,106, 8, 16, 20, 17, 27,"Slide L/R", BT_INVERT, 255 }, + { 19, 25,162, 58, 26, 17, 0, 28, 20,"Slide U/D", BT_MOUSE_AXIS, 255 }, + { 20, 25,162,106, 8, 18, 21, 19, 0,"Slide U/D", BT_INVERT, 255 }, + { 21,180,138, 58, 26, 20, 23, 14, 22,"Bank L/R", BT_MOUSE_AXIS, 255 }, + { 22,180,138,106, 8, 12, 24, 21, 15,"Bank L/R", BT_INVERT, 255 }, + { 23,180,146, 58, 26, 21, 27, 16, 24,"Throttle", BT_MOUSE_AXIS, 255 }, + { 24,180,146,106, 8, 22, 28, 23, 17,"Throttle", BT_INVERT, 255 }, + { 25, 25,109, 85, 26, 3, 14, 12, 13,"Rear view", BT_MOUSE_BUTTON, 255 }, + { 26, 25, 70, 85, 26, 4, 2, 7, 8,"Drop bomb", BT_MOUSE_BUTTON, 255 }, + { 27,180,154, 58, 26, 23, 5, 18, 28,"Cycle P/S", BT_MOUSE_AXIS, 255 }, + { 28,180,154,106, 8, 24, 13, 27, 19,"Cycle P/S", BT_INVERT, 255 }, }; -//added on 2/4/99 by Victor Rachels to add d1x new keys + + //id, x, y, w1, w2, u, d, l, r, text, type, value kc_item kc_d1x[NUM_D1X_CONTROLS] = { -// id,x,y,w1,w2,u,d,l,r,text_num1,type,value - { 0, 15, 49, 71, 26, 27, 2, 27, 1,TNUM_PRIMARY_1, BT_KEY, 255}, - { 1, 15, 49,100, 26, 26, 3, 0, 2,TNUM_PRIMARY_1, BT_JOY_BUTTON, 255}, - { 2, 15, 57, 71, 26, 0, 4, 1, 3,TNUM_PRIMARY_2, BT_KEY, 255}, - { 3, 15, 57,100, 26, 1, 5, 2, 4,TNUM_PRIMARY_2, BT_JOY_BUTTON, 255}, - { 4, 15, 65, 71, 26, 2, 6, 3, 5,TNUM_PRIMARY_3, BT_KEY, 255}, - { 5, 15, 65,100, 26, 3, 7, 4, 6,TNUM_PRIMARY_3, BT_JOY_BUTTON, 255}, - { 6, 15, 73, 71, 26, 4, 8, 5, 7,TNUM_PRIMARY_4, BT_KEY, 255}, - { 7, 15, 73,100, 26, 5, 9, 6, 8,TNUM_PRIMARY_4, BT_JOY_BUTTON, 255}, - { 8, 15, 81, 71, 26, 6, 10, 7, 9,TNUM_PRIMARY_5, BT_KEY, 255}, - { 9, 15, 81,100, 26, 7, 11, 8, 10,TNUM_PRIMARY_5, BT_JOY_BUTTON, 255}, + { 0, 15, 49, 71, 26, 27, 2, 27, 1,"LASER", BT_KEY, 255}, + { 1, 15, 49,100, 26, 26, 3, 0, 2,"LASER", BT_JOY_BUTTON, 255}, + { 2, 15, 57, 71, 26, 0, 4, 1, 3,"VULCAN", BT_KEY, 255}, + { 3, 15, 57,100, 26, 1, 5, 2, 4,"VULCAN", BT_JOY_BUTTON, 255}, + { 4, 15, 65, 71, 26, 2, 6, 3, 5,"SPREAD", BT_KEY, 255}, + { 5, 15, 65,100, 26, 3, 7, 4, 6,"SPREAD", BT_JOY_BUTTON, 255}, + { 6, 15, 73, 71, 26, 4, 8, 5, 7,"PLASMA", BT_KEY, 255}, + { 7, 15, 73,100, 26, 5, 9, 6, 8,"PLASMA", BT_JOY_BUTTON, 255}, + { 8, 15, 81, 71, 26, 6, 10, 7, 9,"FUSION", BT_KEY, 255}, + { 9, 15, 81,100, 26, 7, 11, 8, 10,"FUSION", BT_JOY_BUTTON, 255}, - { 10, 15, 89, 71, 26, 8, 12, 9, 11,TNUM_SECONDARY_1, BT_KEY, 255}, - { 11, 15, 89,100, 26, 9, 13, 10, 12,TNUM_SECONDARY_1, BT_JOY_BUTTON, 255}, - { 12, 15, 97, 71, 26, 10, 14, 11, 13,TNUM_SECONDARY_2, BT_KEY, 255}, - { 13, 15, 97,100, 26, 11, 15, 12, 14,TNUM_SECONDARY_2, BT_JOY_BUTTON, 255}, - { 14, 15,105, 71, 26, 12, 16, 13, 15,TNUM_SECONDARY_3, BT_KEY, 255}, - { 15, 15,105,100, 26, 13, 17, 14, 16,TNUM_SECONDARY_3, BT_JOY_BUTTON, 255}, - { 16, 15,113, 71, 26, 14, 18, 15, 17,TNUM_SECONDARY_4, BT_KEY, 255}, - { 17, 15,113,100, 26, 15, 19, 16, 18,TNUM_SECONDARY_4, BT_JOY_BUTTON, 255}, - { 18, 15,121, 71, 26, 16, 20, 17, 19,TNUM_SECONDARY_5, BT_KEY, 255}, - { 19, 15,121,100, 26, 17, 21, 18, 20,TNUM_SECONDARY_5, BT_JOY_BUTTON, 255}, + { 10, 15, 89, 71, 26, 8, 12, 9, 11,"CONCSN", BT_KEY, 255}, + { 11, 15, 89,100, 26, 9, 13, 10, 12,"CONCSN", BT_JOY_BUTTON, 255}, + { 12, 15, 97, 71, 26, 10, 14, 11, 13,"HOMING", BT_KEY, 255}, + { 13, 15, 97,100, 26, 11, 15, 12, 14,"HOMING", BT_JOY_BUTTON, 255}, + { 14, 15,105, 71, 26, 12, 16, 13, 15,"PROX B", BT_KEY, 255}, + { 15, 15,105,100, 26, 13, 17, 14, 16,"PROX B", BT_JOY_BUTTON, 255}, + { 16, 15,113, 71, 26, 14, 18, 15, 17,"SMART", BT_KEY, 255}, + { 17, 15,113,100, 26, 15, 19, 16, 18,"SMART", BT_JOY_BUTTON, 255}, + { 18, 15,121, 71, 26, 16, 20, 17, 19,"MEGA", BT_KEY, 255}, + { 19, 15,121,100, 26, 17, 21, 18, 20,"MEGA", BT_JOY_BUTTON, 255}, - { 20, 15,131, 71, 26, 18, 22, 19, 21,TNUM_PRIMARY_CYCLE, BT_KEY, 255}, - { 21, 15,131,100, 26, 19, 23, 20, 22,TNUM_PRIMARY_CYCLE, BT_JOY_BUTTON, 255}, - { 22, 15,139, 71, 26, 20, 24, 21, 23,TNUM_SECONDARY_CYCLE, BT_KEY, 255}, - { 23, 15,139,100, 26, 21, 25, 22, 24,TNUM_SECONDARY_CYCLE, BT_JOY_BUTTON, 255}, - { 24, 8,147, 78, 26, 22, 26, 23, 25,TNUM_CYCLE_P_TOGGLE, BT_KEY, 255}, - { 25, 8,147,107, 26, 23, 27, 24, 26,TNUM_CYCLE_P_TOGGLE, BT_JOY_BUTTON, 255}, - { 26, 8,155, 78, 26, 24, 1, 25, 27,TNUM_CYCLE_S_TOGGLE, BT_KEY, 255}, - { 27, 8,155,107, 26, 25, 0, 26, 0,TNUM_CYCLE_S_TOGGLE, BT_JOY_BUTTON, 255}, + { 20, 15,131, 71, 26, 18, 22, 19, 21,"CYCLE PRI", BT_KEY, 255}, + { 21, 15,131,100, 26, 19, 23, 20, 22,"CYCLE PRI", BT_JOY_BUTTON, 255}, + { 22, 15,139, 71, 26, 20, 24, 21, 23,"CYCLE SEC", BT_KEY, 255}, + { 23, 15,139,100, 26, 21, 25, 22, 24,"CYCLE SEC", BT_JOY_BUTTON, 255}, + { 24, 8,147, 78, 26, 22, 26, 23, 25,"TOGGLE PRI AUTO", BT_KEY, 255}, + { 25, 8,147,107, 26, 23, 27, 24, 26,"TOGGLE PRI AUTO", BT_JOY_BUTTON, 255}, + { 26, 8,155, 78, 26, 24, 1, 25, 27,"TOGGLE SEC AUTO", BT_KEY, 255}, + { 27, 8,155,107, 26, 25, 0, 26, 0,"TOGGLE SEC AUTO", BT_JOY_BUTTON, 255}, }; -//end this section addition - VR - void kc_drawitem( kc_item *item, int is_current ); void kc_change_key( kc_item * item ); void kc_change_joybutton( kc_item * item ); void kc_change_mousebutton( kc_item * item ); -void kc_next_joyaxis(kc_item *item); //added by WraithX on 11/22/00 void kc_change_joyaxis( kc_item * item ); void kc_change_mouseaxis( kc_item * item ); void kc_change_invert( kc_item * item ); -void kconfig_read_fcs( int raw_axis ); -void kconfig_set_fcs_button( int btn, int button ); -//the following methods added by WraithX, 4/17/00 int isJoyRotationKey(int test_key) { if ( test_key == kc_joystick[11].value || @@ -393,7 +333,7 @@ int isJoyRotationKey(int test_key) //else... return 0; -}//method isJoyRotationKey +} int isMouseRotationKey(int test_key) { @@ -405,7 +345,7 @@ int isMouseRotationKey(int test_key) //else... return 0; -}//method isMouseRotationKey +} int isKeyboardRotationKey(int test_key) { @@ -427,8 +367,7 @@ int isKeyboardRotationKey(int test_key) //else... return 0; -}//method isKeyboardRotationKey -//end addition - WraithX +} int kconfig_is_axes_used(int axis) { @@ -554,34 +493,23 @@ int get_item_height(kc_item *item) case BT_KEY: strncpy( btext, key_text[item->value], 10 ); break; case BT_MOUSE_BUTTON: - strncpy( btext, Text_string[mousebutton_text[item->value]], 10); break; + strncpy( btext, mousebutton_text[item->value], 10); break; case BT_MOUSE_AXIS: - strncpy( btext, Text_string[mouseaxis_text[item->value]], 10 ); break; + strncpy( btext, mouseaxis_text[item->value], 10 ); break; case BT_JOY_BUTTON: -#if defined(SDL_INPUT) if (joybutton_text[item->value]) strncpy(btext, joybutton_text[item->value], 10); else sprintf(btext, "BTN%2d", item->value + 1); -#else - if ( joybutton_text[item->value] !=-1 ) - strncpy( btext, Text_string[ joybutton_text[item->value] ], 10 ); - else - sprintf( btext, "BTN%d", item->value ); -#endif break; case BT_JOY_AXIS: -#if defined(SDL_INPUT) if (joyaxis_text[item->value]) strncpy(btext, joyaxis_text[item->value], 10); else sprintf(btext, "AXIS%2d", item->value + 1); -#else - strncpy(btext, Text_string[joyaxis_text[item->value]], 10); -#endif break; case BT_INVERT: - strncpy( btext, Text_string[invert_text[item->value]], 10 ); break; + strncpy( btext, invert_text[item->value], 10 ); break; } } gr_get_string_size(btext, &w, &h, &aw ); @@ -598,11 +526,6 @@ void kconfig_sub_draw_table(kc_item * items,int nitems, char * title) char * p; int i; int w = LHX(290), h = LHY(170); -#ifdef NEWMENU_MOUSE - int close_x = (SWIDTH/2)-(w/2)-8*(SWIDTH/320); - int close_y = (SHEIGHT/2)-(h/2)-8*(SHEIGHT/200); - int close_size = FONTSCALE_X(hiresfont && SWIDTH>=640 && SHEIGHT>=480?10:5); -#endif gr_set_current_canvas(NULL); #ifdef OGL @@ -610,13 +533,6 @@ void kconfig_sub_draw_table(kc_item * items,int nitems, char * title) #endif nm_draw_background((SWIDTH/2)-(w/2)-15*(SWIDTH/320), (SHEIGHT/2)-(h/2)-15*(SHEIGHT/200), (SWIDTH/2)+(w/2)+15*(SWIDTH/320), (SHEIGHT/2)+(h/2)+15*(SHEIGHT/200)); -#ifdef NEWMENU_MOUSE - gr_setcolor( BM_XRGB(0, 0, 0) ); - gr_rect(close_x, close_y, close_x + close_size, close_y + close_size); - gr_setcolor( BM_XRGB(21, 21, 21) ); - gr_rect(close_x + LHX(1), close_y + LHX(1), close_x + close_size - LHX(1), close_y + close_size - LHX(1)); -#endif - if (kc_d1x_flag) { items = kc_d1x; nitems = NUM_D1X_CONTROLS; @@ -692,8 +608,10 @@ void kconfig_sub_draw_table(kc_item * items,int nitems, char * title) gr_string( 0x8000, LHY(35), TXT_BUTTONS ); gr_string( 0x8000,LHY(122), TXT_AXES ); gr_set_fontcolor( BM_XRGB(28,28,28), -1 ); - gr_string( LHX(169), LHY(129), TXT_AXIS ); - gr_string( LHX(199), LHY(129), TXT_INVERT ); + gr_string( LHX(91), LHY(129), TXT_AXIS ); + gr_string( LHX(121), LHY(129), TXT_INVERT ); + gr_string( LHX(246), LHY(129), TXT_AXIS ); + gr_string( LHX(276), LHY(129), TXT_INVERT ); } else if ( items == kc_d1x ) { @@ -717,11 +635,10 @@ void kconfig_sub(kc_item * items,int nitems, char * title) int old_keyd_repeat; int i,k,ocitem,citem; int time_stopped = 0; - int w = LHX(290), h = LHY(170); #ifdef NEWMENU_MOUSE - int mouse_state, omouse_state, mx, my, x1, x2, y1, y2; - int close_x = (SWIDTH/2)-(w/2)-8*(SWIDTH/320); - int close_y = (SHEIGHT/2)-(h/2)-8*(SHEIGHT/200); + int mouse_state, omouse_state, mx, my, mz, x1, x2, y1, y2; + int close_x = 8*(SWIDTH/320); + int close_y = 8*(SHEIGHT/200); int close_size = FONTSCALE_X(hiresfont && SWIDTH>=640 && SHEIGHT>=480?10:5); #endif @@ -778,6 +695,13 @@ void kconfig_sub(kc_item * items,int nitems, char * title) kc_drawitem( &items[citem], 1 ); #endif +#ifdef NEWMENU_MOUSE + gr_setcolor( BM_XRGB(0, 0, 0) ); + gr_rect(close_x, close_y, close_x + close_size, close_y + close_size); + gr_setcolor( BM_XRGB(21, 21, 21) ); + gr_rect(close_x + LHX(1), close_y + LHX(1), close_x + close_size - LHX(1), close_y + close_size - LHX(1)); +#endif + gr_update(); k = key_inkey(); @@ -878,16 +802,6 @@ void kconfig_sub(kc_item * items,int nitems, char * title) case BT_INVERT: kc_change_invert( &items[citem] ); break; } break; - //the following case added by WraithX on 11/22/00 to work around the weird joystick bug... - case KEY_SPACEBAR: - switch(items[citem].type) - { - case BT_JOY_AXIS: - kc_next_joyaxis(&items[citem]); - break; - } - break; - //end addition by WraithX case -2: case KEY_ESC: grd_curcanv->cv_font = save_font; @@ -935,7 +849,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n", kc_keyboard[i].id, kc_keyboard[i].x, kc_keyboard[i].y, kc_keyboard[i].w1, kc_keyboard[i].w2, kc_keyboard[i].u, kc_keyboard[i].d, kc_keyboard[i].l, kc_keyboard[i].r, - 34, Text_string[kc_keyboard[i].text_num1], 34, btype_text[kc_keyboard[i].type] ); + 34, kc_keyboard[i].text, 34, btype_text[kc_keyboard[i].type] ); } fprintf( fp, "};" ); @@ -944,7 +858,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n", kc_joystick[i].id, kc_joystick[i].x, kc_joystick[i].y, kc_joystick[i].w1, kc_joystick[i].w2, kc_joystick[i].u, kc_joystick[i].d, kc_joystick[i].l, kc_joystick[i].r, - 34, Text_string[kc_joystick[i].text_num1], 34, btype_text[kc_joystick[i].type] ); + 34, kc_joystick[i].text, 34, btype_text[kc_joystick[i].type] ); } fprintf( fp, "};" ); @@ -953,7 +867,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) fprintf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n", kc_mouse[i].id, kc_mouse[i].x, kc_mouse[i].y, kc_mouse[i].w1, kc_mouse[i].w2, kc_mouse[i].u, kc_mouse[i].d, kc_mouse[i].l, kc_mouse[i].r, - 34, Text_string[kc_mouse[i].text_num1], 34, btype_text[kc_mouse[i].type] ); + 34, kc_mouse[i].text, 34, btype_text[kc_mouse[i].type] ); } fprintf( fp, "};" ); @@ -968,7 +882,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) if ( (mouse_state && !omouse_state) || (mouse_state && omouse_state) ) { int item_height; - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); for (i=0; icv_bitmap.bm_x + FONTSCALE_X(items[i].x) + FONTSCALE_X(items[i].w1); @@ -984,7 +898,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) else if ( !mouse_state && omouse_state ) { int item_height; - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); item_height = get_item_height( &items[citem] ); x1 = grd_curcanv->cv_bitmap.bm_x + FONTSCALE_X(items[citem].x) + FONTSCALE_X(items[citem].w1); x2 = x1 + FONTSCALE_X(items[citem].w2); @@ -1040,28 +954,7 @@ void kc_drawitem( kc_item *item, int is_current ) else gr_set_fontcolor( BM_XRGB(15,15,24), -1 ); - if((item->text_num1) < N_TEXT_STRINGS) - gr_string( LHX(item->x), LHY(item->y), Text_string[item->text_num1] ); - else - { - switch(item->text_num1-N_TEXT_STRINGS) - { - case 0: gr_string( LHX(item->x), LHY(item->y),"CYC PRIMARY"); break; - case 1: gr_string( LHX(item->x), LHY(item->y),"CYC SECONDARY"); break; - case 2: gr_string( LHX(item->x), LHY(item->y),"TOGGLE PRIM AUTO"); break; - case 3: gr_string( LHX(item->x), LHY(item->y),"TOGGLE SEC AUTO"); break; - case 4: gr_string( LHX(item->x), LHY(item->y),"WEAPON 1"); break; - case 5: gr_string( LHX(item->x), LHY(item->y),"WEAPON 2"); break; - case 6: gr_string( LHX(item->x), LHY(item->y),"WEAPON 3"); break; - case 7: gr_string( LHX(item->x), LHY(item->y),"WEAPON 4"); break; - case 8: gr_string( LHX(item->x), LHY(item->y),"WEAPON 5"); break; - case 9: gr_string( LHX(item->x), LHY(item->y),"WEAPON 6"); break; - case 10: gr_string( LHX(item->x), LHY(item->y),"WEAPON 7"); break; - case 11: gr_string( LHX(item->x), LHY(item->y),"WEAPON 8"); break; - case 12: gr_string( LHX(item->x), LHY(item->y),"WEAPON 9"); break; - case 13: gr_string( LHX(item->x), LHY(item->y),"WEAPON 0"); break; - } - } + gr_string( LHX(item->x), LHY(item->y), item->text ); if (item->value==255) { strcpy( btext, "" ); @@ -1071,9 +964,9 @@ void kc_drawitem( kc_item *item, int is_current ) strncpy( btext, key_text[item->value], 10 ); break; case BT_MOUSE_BUTTON: - strncpy( btext, item->value<=3?Text_string[mousebutton_text[item->value]]:mousebutton_textra[item->value-3], 10 ); break; + strncpy( btext, item->value<=3?mousebutton_text[item->value]:mousebutton_textra[item->value-3], 10 ); break; case BT_MOUSE_AXIS: - strncpy( btext, Text_string[mouseaxis_text[item->value]], 10 ); break; + strncpy( btext, mouseaxis_text[item->value], 10 ); break; case BT_JOY_BUTTON: if (joybutton_text[item->value]) strncpy(btext, joybutton_text[item->value], 10); @@ -1088,7 +981,7 @@ void kc_drawitem( kc_item *item, int is_current ) sprintf(btext, "AXIS%2d", item->value + 1); break; case BT_INVERT: - strncpy( btext, Text_string[invert_text[item->value]], 10 ); break; + strncpy( btext, invert_text[item->value], 10 ); break; } } gr_get_string_size(btext, &w, &h, &aw ); @@ -1217,33 +1110,9 @@ void kc_change_joybutton( kc_item * item ) gr_string( 0x8000, LHY(INFO_Y), TXT_PRESS_NEW_JBUTTON ); kc_drawquestion( item ); - if (Config_control_type==CONTROL_THRUSTMASTER_FCS) { - - int axis[JOY_NUM_AXES]; - joystick_read_raw_axis( JOY_ALL_AXIS, axis ); - kconfig_read_fcs( axis[3] ); - if ( joy_get_button_state(7) ) code = 7; - if ( joy_get_button_state(11) ) code = 11; - if ( joy_get_button_state(15) ) code = 15; - if ( joy_get_button_state(19) ) code = 19; - for (i=0; i<4; i++ ) { - if ( joy_get_button_state(i) ) - code = i; - } - - } else if (Config_control_type==CONTROL_FLIGHTSTICK_PRO) { - for (i=4; i<20; i++ ) { - if ( joy_get_button_state(i) ) { - code = i; - mprintf(( 0, "JB: %d\n", code )); - } - } - } else { - - for (i=0; ivalue + 1) % max; - - if (code != 255) - { - for (i = 0; i < Num_items; i++) - { - n = item - All_items; - if ((i != n) && (All_items[i].type == BT_JOY_AXIS) && (All_items[i].value == code)) - { - if (tries > max) - return; // all axes allocated already - i = -1; // -1 so the i++ will push back to 0 - code = (item->value + ++tries) % max; // try next axis - }//end if - }//end for - - item->value = code; - }//end if - - kc_drawitem(item, 1); - game_flush_inputs(); - -}//method kc_next_joyaxis -//end addition by WraithX - void kc_change_joyaxis( kc_item * item ) { int axis[JOY_MAX_AXES]; @@ -1425,10 +1255,7 @@ void kc_change_mouseaxis( kc_item * item ) { int i,n,k; ubyte code; - int dx,dy; -#ifdef SDL_INPUT - int dz; -#endif + int dx,dy,dz; gr_set_fontcolor( BM_XRGB(28,28,28), -1 ); @@ -1436,7 +1263,7 @@ void kc_change_mouseaxis( kc_item * item ) code=255; k=255; - mouse_get_delta( &dx, &dy ); + mouse_get_delta( &dx, &dy, &dz ); while( (k!=KEY_ESC) && (code==255)) { #ifdef NETWORK @@ -1456,17 +1283,13 @@ void kc_change_mouseaxis( kc_item * item ) gr_string( 0x8000, LHY(INFO_Y), TXT_MOVE_NEW_MSE_AXIS ); kc_drawquestion( item ); -#ifdef SDL_INPUT - mouse_get_delta_z( &dx, &dy, &dz ); -#else - mouse_get_delta( &dx, &dy ); -#endif + mouse_get_delta( &dx, &dy, &dz ); + if ( abs(dx)>20 ) code = 0; if ( abs(dy)>20 ) code = 1; -#ifdef SDL_INPUT if ( abs(dz)>20 ) code = 2; -#endif } + if (code!=255) { for (i=0; i #endif -void kconfig_read_fcs( int raw_axis ) -{ - int raw_button, button, axis_min[JOY_NUM_AXES], axis_center[JOY_NUM_AXES], axis_max[JOY_NUM_AXES]; - - if (Config_control_type!=CONTROL_THRUSTMASTER_FCS) return; - - joy_get_cal_vals(axis_min, axis_center, axis_max); - - if ( axis_max[3] > 1 ) - raw_button = (raw_axis*100)/axis_max[3]; - else - raw_button = 0; - - if ( raw_button > 88 ) - button = 0; - else if ( raw_button > 63 ) - button = 7; - else if ( raw_button > 39 ) - button = 11; - else if ( raw_button > 15 ) - button = 15; - else - button = 19; - - kconfig_set_fcs_button( 19, button ); - kconfig_set_fcs_button( 15, button ); - kconfig_set_fcs_button( 11, button ); - kconfig_set_fcs_button( 7, button ); -} - - -void kconfig_set_fcs_button( int btn, int button ) -{ - int state,time_down,upcount,downcount; - state = time_down = upcount = downcount = 0; - - if ( joy_get_button_state(btn) ) { - if ( btn==button ) { - state = 1; - time_down = FrameTime; - } else { - upcount=1; - } - } else { - if ( btn==button ) { - state = 1; - time_down = FrameTime; - downcount=1; - } else { - upcount=1; - } - } - - joy_set_btn_values( btn, state, time_down, downcount, upcount ); - + kconfig_d1x_settings[i] = kc_d1x[i].value; } #define PH_SCALE 8 -//added/changed 9/6/98 Matt Mueller -> #endif #ifdef __LINUX__ #define JOYSTICK_READ_TIME (F1_0/20) // Read joystick at 20 Hz. #else @@ -1629,176 +1391,18 @@ void kconfig_set_fcs_button( int btn, int button ) fix LastReadTime = 0; fix joy_axis[JOY_MAX_AXES]; -ubyte kc_use_external_control = 0; -ubyte kc_enable_external_control = 1; -ubyte kc_external_intno = 0; -control_info *kc_external_control = NULL; -//added on 8/8/98 by Matt Mueller - sporb support -#ifdef __DJGPP__ -unsigned long kc_external_control_addr=0; -#endif -//end modified section - Matt Mueller -char *kc_external_name = NULL; -ubyte kc_external_version = 0; - -void kconfig_init_external_controls(int intno, ssize_t address) -{ - int i; - kc_external_intno = intno; -//added/changed on 8/8/98 by Matt Mueller - sporb support -#ifdef __DJGPP__ - MALLOC(kc_external_control,control_info,1); - kc_external_control_addr=address; -#else - kc_external_control = (control_info *)address; -#endif -//end modified section - kc_use_external_control = 1; - kc_enable_external_control = 1; - - i = FindArg( "-xname" ); - if ( i ) - kc_external_name = Args[i+1]; - else - kc_external_name = "External Controller"; - - i = FindArg( "-xver" ); - if ( i ) - kc_external_version = atoi(Args[i+1]); - - printf( "%s int: 0x%x, data: 0x%p, ver:%d\n", kc_external_name, kc_external_intno, kc_external_control, kc_external_version ); - -} - -#ifdef __MSDOS__ -void kconfig_read_external_controls() -{ - union REGS r; - - if ( !kc_enable_external_control ) return; - - if ( kc_external_version == 0 ) - memset( kc_external_control, 0, sizeof(control_info) ); - else if ( kc_external_version > 0 ) { - memset( kc_external_control, 0, sizeof(control_info)+sizeof(vms_angvec) + 64 ); - if ( kc_external_version > 1 ) { - // Write ship pos and angles to external controls... - ubyte *temp_ptr = (ubyte *)kc_external_control; - vms_vector *ship_pos; - vms_matrix *ship_orient; - memset( kc_external_control, 0, sizeof(control_info)+sizeof(vms_angvec) + 64 + sizeof(vms_vector)+sizeof(vms_matrix) ); - temp_ptr += sizeof(control_info)+sizeof(vms_angvec) + 64; - ship_pos = (vms_vector *)temp_ptr; - temp_ptr += sizeof(vms_vector); - ship_orient = (vms_matrix *)temp_ptr; - // Fill in ship postion... - *ship_pos = Objects[Players[Player_num].objnum].pos; - // Fill in ship orientation... - *ship_orient = Objects[Players[Player_num].objnum].orient; - } - } - - if ( grd_curscreen->sc_mode != SM(320,200) ) // (If in automap...) - kc_external_control->automap_state = 1; - -//added on 8/8/98 by Matt Mueller - sporb support -#ifdef __DJGPP__ - dosmemput(kc_external_control,sizeof(control_info),kc_external_control_addr); -#endif -//end modified section - Matt Mueller - - memset(&r,0,sizeof(r)); - int386 ( kc_external_intno, &r, &r); // Read external info... - -//added on 8/8/98 by Matt Mueller - sporb support -#ifdef __DJGPP__ - dosmemget(kc_external_control_addr,sizeof(control_info),kc_external_control); -#endif -//end modified section - Matt Mueller - if ( Player_num > -1 ) { - Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_TURNROLL); // Turn off roll when turning - Objects[Players[Player_num].objnum].mtype.phys_info.flags &= (~PF_LEVELLING); // Turn off leveling to nearest side. - Auto_leveling_on = 0; - - if ( kc_external_version > 0 ) { - vms_matrix tempm, ViewMatrix; - vms_angvec * Kconfig_abs_movement; - char * oem_message; - - Kconfig_abs_movement = (vms_angvec *)((uint)kc_external_control + sizeof(control_info)); - - if ( Kconfig_abs_movement->p || Kconfig_abs_movement->b || Kconfig_abs_movement->h ) { - vm_angles_2_matrix(&tempm,Kconfig_abs_movement); - vm_matrix_x_matrix(&ViewMatrix,&Objects[Players[Player_num].objnum].orient,&tempm); - Objects[Players[Player_num].objnum].orient = ViewMatrix; - } - oem_message = (char *)((uint)Kconfig_abs_movement + sizeof(vms_angvec)); - if (oem_message[0] != '\0' ) - hud_message(MSGC_GAME_FEEDBACK, oem_message ); - } - } - - - //added/changed on 3/12/99 by Victor Rachels for faster sporb - if(extfaster) - { - externalctrlp = fixmul(kc_external_control->pitch_time,FrameTime); - externalctrlh = fixmul(kc_external_control->heading_time,FrameTime); - externalctrlb = fixmul(kc_external_control->bank_time,FrameTime); - } - else - { - Controls.pitch_time += fixmul(kc_external_control->pitch_time,FrameTime); - Controls.bank_time += fixmul(kc_external_control->bank_time ,FrameTime); - Controls.heading_time += fixmul(kc_external_control->heading_time,FrameTime); - } -//^ Controls.pitch_time += fixmul(kc_external_control->pitch_time,FrameTime); - Controls.vertical_thrust_time += fixmul(kc_external_control->vertical_thrust_time,FrameTime); -//^ Controls.heading_time += fixmul(kc_external_control->heading_time,FrameTime); - Controls.sideways_thrust_time += fixmul(kc_external_control->sideways_thrust_time ,FrameTime); -//^ Controls.bank_time += fixmul(kc_external_control->bank_time ,FrameTime); -//end this section addition/change - VR - - Controls.forward_thrust_time += fixmul(kc_external_control->forward_thrust_time ,FrameTime); - Controls.rear_view_down_count += kc_external_control->rear_view_down_count; - Controls.rear_view_down_state |= kc_external_control->rear_view_down_state; - Controls.fire_primary_down_count += kc_external_control->fire_primary_down_count; - Controls.fire_primary_state |= kc_external_control->fire_primary_state; - Controls.fire_secondary_state |= kc_external_control->fire_secondary_state; - Controls.fire_secondary_down_count += kc_external_control->fire_secondary_down_count; - Controls.fire_flare_down_count += kc_external_control->fire_flare_down_count; - Controls.drop_bomb_down_count += kc_external_control->drop_bomb_down_count; - Controls.automap_down_count += kc_external_control->automap_down_count; - Controls.automap_state |= kc_external_control->automap_state; -} -#else -void kconfig_read_external_controls() {} -#endif - -//added/edited on 11/01/98 by Victor Rachels for primary/secondary -//added on 9/15/98 by Victor Rachels to finagle the weapon toggle stuff int Allow_primary_cycle_ostate = 0; int Allow_secondary_cycle_ostate = 0; -//end addition -//end this section edit - Victor Rachels -//added on 2/7/99 by Victor Rachels for jostick state setting int d1x_joystick_ostate[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -//end this section adition - VR -//added on 4/16/99 by Victor Rachels for vulcantoggle int Vulcan_kostate = 0; int Vulcan_jostate = 0; int Vulcan_mostate = 0; -//end addition - VR void controls_read_all() { int i; int slide_on, bank_on; - int dx, dy; -#ifdef SDL_INPUT - int dz; -#endif - int idx, idy; + int dx, dy, dz; fix ctime; fix mouse_axis[3] = {0,0,0}; int raw_joy_axis[JOY_MAX_AXES]; @@ -1825,13 +1429,8 @@ void controls_read_all() ctime = timer_get_fixed_seconds(); //--------- Read Joystick ----------- - if ( (LastReadTime + JOYSTICK_READ_TIME > ctime) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) ) { -//added/changed 9/6/98 Matt Mueller -> #endif -#if defined(__LINUX__) || defined(__WINDOWS__) + if ( (LastReadTime + JOYSTICK_READ_TIME > ctime) ) { if ((ctime < 0) && (LastReadTime >= 0)) -#else - if ((ctime < 0) && (LastReadTime > 0)) -#endif LastReadTime = ctime; use_joystick=1; } else if ( CONTROL_USING_JOYSTICK ) { @@ -1842,22 +1441,18 @@ void controls_read_all() if (channel_masks&(1< joy_null_value) - raw_joy_axis[i] = ((raw_joy_axis[i]-joy_null_value)*128)/(128-joy_null_value); - else if (raw_joy_axis[i] < -joy_null_value) - raw_joy_axis[i] = ((raw_joy_axis[i]+joy_null_value)*128)/(128-joy_null_value); - else - raw_joy_axis[i] = 0; - joy_axis[i] = (raw_joy_axis[i]*FrameTime)/128; - } + raw_joy_axis[i] = joy_get_scaled_reading( raw_joy_axis[i], i ); + + if (kc_joystick[23].value==i) // If this is the throttle + joy_null_value = 20; // Then use a larger dead-zone + + if (raw_joy_axis[i] > joy_null_value) + raw_joy_axis[i] = ((raw_joy_axis[i]-joy_null_value)*128)/(128-joy_null_value); + else if (raw_joy_axis[i] < -joy_null_value) + raw_joy_axis[i] = ((raw_joy_axis[i]+joy_null_value)*128)/(128-joy_null_value); + else + raw_joy_axis[i] = 0; + joy_axis[i] = (raw_joy_axis[i]*FrameTime)/128; } else { joy_axis[i] = 0; } @@ -1871,26 +1466,15 @@ void controls_read_all() if (CONTROL_USING_MOUSE) { //--------- Read Mouse ----------- -#ifdef SDL_INPUT - mouse_get_delta_z( &dx, &dy, &dz ); -#else - mouse_get_delta( &dx, &dy ); -#endif + mouse_get_delta( &dx, &dy, &dz ); + mouse_axis[0] = (dx*60); //(dx*FrameTime)/35; mouse_axis[1] = (dy*85); //(dy*FrameTime)/25; -#ifdef SDL_INPUT - mouse_axis[2] = (dz*FrameTime); -#endif + mouse_axis[2] = (dz*512); + mouse_buttons = mouse_get_btns(); //mprintf(( 0, "Mouse %d,%d b:%d, 0x%x\n", mouse_axis[0], mouse_axis[1], mouse_buttons, FrameTime )); use_mouse=1; - } else if (Config_control_type==6 ) { - //--------- Read Cyberman ----------- - mouse_get_cyberman_pos(&idx,&idy ); - mouse_axis[0] = (idx*FrameTime)/128; - mouse_axis[1] = (idy*FrameTime)/128; - mouse_buttons = mouse_get_btns(); - use_mouse=1; } else { mouse_axis[0] = 0; mouse_axis[1] = 0; @@ -1898,163 +1482,149 @@ void controls_read_all() use_mouse=0; } -//added on 2/4/99 by Victor Rachels for d1x keys -//--------- Read primary weapon select ------------- -//the following "if" added by WraithX to stop deadies from switchin weapons, 4/14/00 -if (!Player_is_dead) -{ - { - int d1x_joystick_state[10]; - - for(i=0;i<10;i++) - d1x_joystick_state[i] = joy_get_button_state(kc_d1x[i*2+1].value); - - - //----------------Weapon 1---------------- - if(key_down_count(kc_d1x[0].value) || - (joy_get_button_state(kc_d1x[1].value) && - (d1x_joystick_state[0]!=d1x_joystick_ostate[0]) ) ) - { - int i, valu=0; - if (!Automap_flag) { // this (and the following statements) prevents to select weapon if Automap is active - do_weapon_select(0,0); - for(i=MAX_PRIMARY_WEAPONS;iprimary_order[valu]&&player_has_weapon(i,0)) - valu = i; - LaserPowSelected = valu; - } - } - //----------------Weapon 2---------------- - if(key_down_count(kc_d1x[2].value) || - (joy_get_button_state(kc_d1x[3].value) && - (d1x_joystick_state[1]!=d1x_joystick_ostate[1]) ) ) - if (!Automap_flag) - do_weapon_select(1,0); - //----------------Weapon 3---------------- - if(key_down_count(kc_d1x[4].value) || - (joy_get_button_state(kc_d1x[5].value) && - (d1x_joystick_state[2]!=d1x_joystick_ostate[2]) ) ) - if (!Automap_flag) - do_weapon_select(2,0); - //----------------Weapon 4---------------- - if(key_down_count(kc_d1x[6].value) || - (joy_get_button_state(kc_d1x[7].value) && - (d1x_joystick_state[3]!=d1x_joystick_ostate[3]) ) ) - if (!Automap_flag) - do_weapon_select(3,0); - //----------------Weapon 5---------------- - if(key_down_count(kc_d1x[8].value) || - (joy_get_button_state(kc_d1x[9].value) && - (d1x_joystick_state[4]!=d1x_joystick_ostate[4]) ) ) - if (!Automap_flag) - do_weapon_select(4,0); - - //--------- Read secondary weapon select ---------- - //----------------Weapon 6---------------- - if(key_down_count(kc_d1x[10].value) || - (joy_get_button_state(kc_d1x[11].value) && - (d1x_joystick_state[5]!=d1x_joystick_ostate[5]) ) ) - if (!Automap_flag) - do_weapon_select(0,1); - //----------------Weapon 7---------------- - if(key_down_count(kc_d1x[12].value) || - (joy_get_button_state(kc_d1x[13].value) && - (d1x_joystick_state[6]!=d1x_joystick_ostate[6]) ) ) - if (!Automap_flag) - do_weapon_select(1,1); - //----------------Weapon 8---------------- - if(key_down_count(kc_d1x[14].value) || - (joy_get_button_state(kc_d1x[15].value) && - (d1x_joystick_state[7]!=d1x_joystick_ostate[7]) ) ) - if (!Automap_flag) - do_weapon_select(2,1); - //----------------Weapon 9---------------- - if(key_down_count(kc_d1x[16].value) || - (joy_get_button_state(kc_d1x[17].value) && - (d1x_joystick_state[8]!=d1x_joystick_ostate[8]) ) ) - if (!Automap_flag) - do_weapon_select(3,1); - //----------------Weapon 0---------------- - if(key_down_count(kc_d1x[18].value) || - (joy_get_button_state(kc_d1x[19].value) && - (d1x_joystick_state[9]!=d1x_joystick_ostate[9]) ) ) - if (!Automap_flag) - do_weapon_select(4,1); - memcpy(d1x_joystick_ostate,d1x_joystick_state,10*sizeof(int)); - } - //end this section addition - VR -//added/edited on 11/01/98 by Victor Rachels for primary/secondary -//added on 9/15/98 by Victor Rachels to add weapon cycle toggle - //from keybaord + if (!Player_is_dead) { - int Allow_primary_cycle_count=0; - int Allow_primary_cycle_jstate=0; - - //added/killed on 2/4/99 by Victor Rachels for d1x keys - if ( kc_d1x[24].value < 255 ) Allow_primary_cycle_count += key_down_count(kc_d1x[24].value); - if ( (use_joystick)&&(kc_d1x[25].value < 255) ) Allow_primary_cycle_jstate= joy_get_button_state( kc_d1x[25].value ); - - - if (Allow_primary_cycle_count || Allow_primary_cycle_jstate!=Allow_primary_cycle_ostate) { - if((Allow_primary_cycle_jstate!=Allow_primary_cycle_ostate)&&(Allow_primary_cycle_jstate==0)) - Allow_primary_cycle_ostate = Allow_primary_cycle_jstate; - else + int d1x_joystick_state[10]; + + for(i=0;i<10;i++) + d1x_joystick_state[i] = joy_get_button_state(kc_d1x[i*2+1].value); + + + //----------------Weapon 1---------------- + if(key_down_count(kc_d1x[0].value) || + (joy_get_button_state(kc_d1x[1].value) && + (d1x_joystick_state[0]!=d1x_joystick_ostate[0]) ) ) + { + int i, valu=0; + if (!Automap_flag) { // this (and the following statements) prevents to select weapon if Automap is active + do_weapon_select(0,0); + for(i=MAX_PRIMARY_WEAPONS;iprimary_order[valu]&&player_has_weapon(i,0)) + valu = i; + LaserPowSelected = valu; + } + } + //----------------Weapon 2---------------- + if(key_down_count(kc_d1x[2].value) || + (joy_get_button_state(kc_d1x[3].value) && + (d1x_joystick_state[1]!=d1x_joystick_ostate[1]) ) ) + if (!Automap_flag) + do_weapon_select(1,0); + //----------------Weapon 3---------------- + if(key_down_count(kc_d1x[4].value) || + (joy_get_button_state(kc_d1x[5].value) && + (d1x_joystick_state[2]!=d1x_joystick_ostate[2]) ) ) + if (!Automap_flag) + do_weapon_select(2,0); + //----------------Weapon 4---------------- + if(key_down_count(kc_d1x[6].value) || + (joy_get_button_state(kc_d1x[7].value) && + (d1x_joystick_state[3]!=d1x_joystick_ostate[3]) ) ) + if (!Automap_flag) + do_weapon_select(3,0); + //----------------Weapon 5---------------- + if(key_down_count(kc_d1x[8].value) || + (joy_get_button_state(kc_d1x[9].value) && + (d1x_joystick_state[4]!=d1x_joystick_ostate[4]) ) ) + if (!Automap_flag) + do_weapon_select(4,0); + + //--------- Read secondary weapon select ---------- + //----------------Weapon 6---------------- + if(key_down_count(kc_d1x[10].value) || + (joy_get_button_state(kc_d1x[11].value) && + (d1x_joystick_state[5]!=d1x_joystick_ostate[5]) ) ) + if (!Automap_flag) + do_weapon_select(0,1); + //----------------Weapon 7---------------- + if(key_down_count(kc_d1x[12].value) || + (joy_get_button_state(kc_d1x[13].value) && + (d1x_joystick_state[6]!=d1x_joystick_ostate[6]) ) ) + if (!Automap_flag) + do_weapon_select(1,1); + //----------------Weapon 8---------------- + if(key_down_count(kc_d1x[14].value) || + (joy_get_button_state(kc_d1x[15].value) && + (d1x_joystick_state[7]!=d1x_joystick_ostate[7]) ) ) + if (!Automap_flag) + do_weapon_select(2,1); + //----------------Weapon 9---------------- + if(key_down_count(kc_d1x[16].value) || + (joy_get_button_state(kc_d1x[17].value) && + (d1x_joystick_state[8]!=d1x_joystick_ostate[8]) ) ) + if (!Automap_flag) + do_weapon_select(3,1); + //----------------Weapon 0---------------- + if(key_down_count(kc_d1x[18].value) || + (joy_get_button_state(kc_d1x[19].value) && + (d1x_joystick_state[9]!=d1x_joystick_ostate[9]) ) ) + if (!Automap_flag) + do_weapon_select(4,1); + memcpy(d1x_joystick_ostate,d1x_joystick_state,10*sizeof(int)); + } + + //from keybaord + { + int Allow_primary_cycle_count=0; + int Allow_primary_cycle_jstate=0; + + if ( kc_d1x[24].value < 255 ) Allow_primary_cycle_count += key_down_count(kc_d1x[24].value); + if ( (use_joystick)&&(kc_d1x[25].value < 255) ) Allow_primary_cycle_jstate= joy_get_button_state( kc_d1x[25].value ); + + if (Allow_primary_cycle_count || Allow_primary_cycle_jstate!=Allow_primary_cycle_ostate) { - Allow_primary_cycle = !Allow_primary_cycle; - if(!Allow_primary_cycle) - hud_message(MSGC_GAME_FEEDBACK, "Primary autoselect Off"); - else - hud_message(MSGC_GAME_FEEDBACK, "Primary autoselect On"); - Allow_primary_cycle_count = 0; + if((Allow_primary_cycle_jstate!=Allow_primary_cycle_ostate)&&(Allow_primary_cycle_jstate==0)) Allow_primary_cycle_ostate = Allow_primary_cycle_jstate; - } - } - } -//end addition - Victor Rachels - - { - int Allow_secondary_cycle_count=0; - int Allow_secondary_cycle_jstate=0; - -//added/killed on 2/4/99 by Victor Rachels for d1x keys - if ( kc_d1x[26].value < 255 ) Allow_secondary_cycle_count += key_down_count(kc_d1x[26].value); - if ( (use_joystick)&&(kc_d1x[27].value < 255) ) Allow_secondary_cycle_jstate= joy_get_button_state( kc_d1x[27].value ); - - if (Allow_secondary_cycle_count || Allow_secondary_cycle_jstate!=Allow_secondary_cycle_ostate) - { - if((Allow_secondary_cycle_jstate!=Allow_secondary_cycle_ostate)&&(Allow_secondary_cycle_jstate==0)) - Allow_secondary_cycle_ostate = Allow_secondary_cycle_jstate; - else - { - Allow_secondary_cycle = !Allow_secondary_cycle; - if(!Allow_secondary_cycle) - hud_message(MSGC_GAME_FEEDBACK, "Secondary autoselect Off"); else - hud_message(MSGC_GAME_FEEDBACK, "Secondary autoselect On"); - Allow_secondary_cycle_count = 0; - Allow_secondary_cycle_ostate = Allow_secondary_cycle_jstate; + { + Allow_primary_cycle = !Allow_primary_cycle; + if(!Allow_primary_cycle) + hud_message(MSGC_GAME_FEEDBACK, "Primary autoselect Off"); + else + hud_message(MSGC_GAME_FEEDBACK, "Primary autoselect On"); + Allow_primary_cycle_count = 0; + Allow_primary_cycle_ostate = Allow_primary_cycle_jstate; + } } } + + { + int Allow_secondary_cycle_count=0; + int Allow_secondary_cycle_jstate=0; + + if ( kc_d1x[26].value < 255 ) Allow_secondary_cycle_count += key_down_count(kc_d1x[26].value); + if ( (use_joystick)&&(kc_d1x[27].value < 255) ) Allow_secondary_cycle_jstate= joy_get_button_state( kc_d1x[27].value ); + + if (Allow_secondary_cycle_count || Allow_secondary_cycle_jstate!=Allow_secondary_cycle_ostate) + { + if((Allow_secondary_cycle_jstate!=Allow_secondary_cycle_ostate)&&(Allow_secondary_cycle_jstate==0)) + Allow_secondary_cycle_ostate = Allow_secondary_cycle_jstate; + else + { + Allow_secondary_cycle = !Allow_secondary_cycle; + if(!Allow_secondary_cycle) + hud_message(MSGC_GAME_FEEDBACK, "Secondary autoselect Off"); + else + hud_message(MSGC_GAME_FEEDBACK, "Secondary autoselect On"); + Allow_secondary_cycle_count = 0; + Allow_secondary_cycle_ostate = Allow_secondary_cycle_jstate; + } + } + } + + if ( kc_d1x[20].value < 255 ) Controls.cycle_primary_down_count += key_down_count(kc_d1x[20].value); + if ( (use_joystick)&&(kc_d1x[21].value < 255) ) Controls.cycle_primary_state= joy_get_button_state( kc_d1x[21].value ); + if ( (use_mouse)&&(kc_mouse[27].value < 255) ) Controls.cycle_primary_state = kc_mouse[28].value?(mouse_axis[kc_mouse[27].value]<0):(mouse_axis[kc_mouse[27].value]>0); + + //Read secondary cycle + + if ( kc_d1x[22].value < 255 ) Controls.cycle_secondary_down_count += key_down_count(kc_d1x[22].value); + if ( (use_joystick)&&(kc_d1x[23].value < 255) ) Controls.cycle_secondary_state= joy_get_button_state( kc_d1x[23].value ); + if ( (use_mouse)&&(kc_mouse[27].value < 255) ) Controls.cycle_secondary_state = kc_mouse[28].value?(mouse_axis[kc_mouse[27].value]>0):(mouse_axis[kc_mouse[27].value]<0); + } -//end this section addition/edit - Victor Rachels - -//added on 8/6/98 by Victor Rachels to add cycle primary/secondary -//killed on 8/7/98 by Victor Rachels due to compatability problems. -//brought back on 8/21/98 by Victor Rachels cuz I think I fixed it - //Read primary cycle - -///added/killed on 2/4/99 by Victor Rachels for d1x keys - if ( kc_d1x[20].value < 255 ) Controls.cycle_primary_down_count += key_down_count(kc_d1x[20].value); - if ( (use_joystick)&&(kc_d1x[21].value < 255) ) Controls.cycle_primary_state= joy_get_button_state( kc_d1x[21].value ); - - //Read secondary cycle - - if ( kc_d1x[22].value < 255 ) Controls.cycle_secondary_down_count += key_down_count(kc_d1x[22].value); - if ( (use_joystick)&&(kc_d1x[23].value < 255) ) Controls.cycle_secondary_state= joy_get_button_state( kc_d1x[23].value ); - -}//end "if (!Player_is_dead)" - WraithX //------------- Read slide_on ------------- @@ -2062,7 +1632,7 @@ if (!Player_is_dead) if ( kc_keyboard[8].value < 255 ) slide_on |= keyd_pressed[ kc_keyboard[8].value ]; if ( kc_keyboard[9].value < 255 ) slide_on |= keyd_pressed[ kc_keyboard[9].value ]; // From joystick... - + if ((use_joystick)&&(kc_joystick[5].value<255)) slide_on |= joy_get_button_state( kc_joystick[5].value ); if ((use_joystick)&&(kc_joystick[34].value<255)) slide_on |= joy_get_button_state( kc_joystick[34].value ); // From mouse... @@ -2081,7 +1651,6 @@ if (!Player_is_dead) //------------ Read pitch_time ----------- if ( !slide_on ) { - // mprintf((0, "pitch: %7.3f %7.3f: %7.3f\n", f2fl(k4), f2fl(k6), f2fl(Controls.heading_time))); kp = 0; k0 = speed_factor*key_down_time( kc_keyboard[0].value )/2; // Divide by two since we want pitch to go slower k1 = speed_factor*key_down_time( kc_keyboard[1].value )/2; @@ -2094,12 +1663,6 @@ if (!Player_is_dead) if ( kc_keyboard[2].value < 255 ) kp -= k2/PH_SCALE; if ( kc_keyboard[3].value < 255 ) kp -= k3/PH_SCALE; - // From Cyberman... - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - kp += mouse_button_down_time(MB_PITCH_FORWARD)/(PH_SCALE*2); - kp -= mouse_button_down_time(MB_PITCH_BACKWARD)/(PH_SCALE*2); - } - if (kp == 0) Controls.pitch_time = 0; else if (kp > 0) { @@ -2130,86 +1693,73 @@ if (!Player_is_dead) Controls.pitch_time = 0; } -//the following "if" added by WraithX, 4/14/00 -//done so that dead players can't move -if (!Player_is_dead) -{ -//----------- Read vertical_thrust_time ----------------- + if (!Player_is_dead) + { + //----------- Read vertical_thrust_time ----------------- + + if ( slide_on ) { + k0 = speed_factor*key_down_time( kc_keyboard[0].value ); + k1 = speed_factor*key_down_time( kc_keyboard[1].value ); + k2 = speed_factor*key_down_time( kc_keyboard[2].value ); + k3 = speed_factor*key_down_time( kc_keyboard[3].value ); + + // From keyboard... + if ( kc_keyboard[0].value < 255 ) Controls.vertical_thrust_time += k0; + if ( kc_keyboard[1].value < 255 ) Controls.vertical_thrust_time += k1; + if ( kc_keyboard[2].value < 255 ) Controls.vertical_thrust_time -= k2; + if ( kc_keyboard[3].value < 255 ) Controls.vertical_thrust_time -= k3; + - if ( slide_on ) { - k0 = speed_factor*key_down_time( kc_keyboard[0].value ); - k1 = speed_factor*key_down_time( kc_keyboard[1].value ); - k2 = speed_factor*key_down_time( kc_keyboard[2].value ); - k3 = speed_factor*key_down_time( kc_keyboard[3].value ); - - // From keyboard... - if ( kc_keyboard[0].value < 255 ) Controls.vertical_thrust_time += k0; - if ( kc_keyboard[1].value < 255 ) Controls.vertical_thrust_time += k1; - if ( kc_keyboard[2].value < 255 ) Controls.vertical_thrust_time -= k2; - if ( kc_keyboard[3].value < 255 ) Controls.vertical_thrust_time -= k3; - - // From Cyberman... - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - Controls.vertical_thrust_time -= mouse_button_down_time(MB_PITCH_FORWARD); - Controls.vertical_thrust_time += mouse_button_down_time(MB_PITCH_BACKWARD); + // From joystick... + if ((use_joystick)&&( kc_joystick[13].value < 255 )) { + if ( !kc_joystick[14].value ) // If not inverted... + Controls.vertical_thrust_time += (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + else + Controls.vertical_thrust_time -= (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + } + + // From mouse... + if ( (use_mouse)&&(kc_mouse[13].value < 255 )) { + if ( !kc_mouse[14].value ) // If not inverted... + Controls.vertical_thrust_time -= (mouse_axis[kc_mouse[13].value]*Config_mouse_sensitivity)/8; + else + Controls.vertical_thrust_time += (mouse_axis[kc_mouse[13].value]*Config_mouse_sensitivity)/8; + } } + // From keyboard... + if ( kc_keyboard[14].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[14].value ); + if ( kc_keyboard[15].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[15].value ); + if ( kc_keyboard[16].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[16].value ); + if ( kc_keyboard[17].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[17].value ); + // From joystick... - if ((use_joystick)&&( kc_joystick[13].value < 255 )) { - if ( !kc_joystick[14].value ) // If not inverted... - Controls.vertical_thrust_time += (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + if ((use_joystick)&&( kc_joystick[19].value < 255 )) { + if ( !kc_joystick[20].value ) // If not inverted... + Controls.vertical_thrust_time += (joy_axis[kc_joystick[19].value]*Config_joystick_sensitivity)/8; else - Controls.vertical_thrust_time -= (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + Controls.vertical_thrust_time -= (joy_axis[kc_joystick[19].value]*Config_joystick_sensitivity)/8; } + // From joystick buttons + if ( (use_joystick)&&(kc_joystick[8].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_joystick[8].value ); + if ( (use_joystick)&&(kc_joystick[37].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_joystick[37].value ); + if ( (use_joystick)&&(kc_joystick[9].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_joystick[9].value ); + if ( (use_joystick)&&(kc_joystick[38].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_joystick[38].value ); + + // From mouse buttons + if ( (use_mouse)&&(kc_mouse[8].value < 255 )) Controls.vertical_thrust_time += mouse_button_down_time( kc_mouse[8].value ); + if ( (use_mouse)&&(kc_mouse[9].value < 255 )) Controls.vertical_thrust_time -= mouse_button_down_time( kc_mouse[9].value ); + // From mouse... - if ( (use_mouse)&&(kc_mouse[13].value < 255 )) { - if ( !kc_mouse[14].value ) // If not inverted... - Controls.vertical_thrust_time -= (mouse_axis[kc_mouse[13].value]*Config_mouse_sensitivity)/8; + if ( (use_mouse)&&(kc_mouse[19].value < 255 )) { + if ( !kc_mouse[20].value ) // If not inverted... + Controls.vertical_thrust_time += (mouse_axis[kc_mouse[19].value]*Config_mouse_sensitivity)/8; else - Controls.vertical_thrust_time += (mouse_axis[kc_mouse[13].value]*Config_mouse_sensitivity)/8; + Controls.vertical_thrust_time -= (mouse_axis[kc_mouse[19].value]*Config_mouse_sensitivity)/8; } } - // From keyboard... - if ( kc_keyboard[14].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[14].value ); - if ( kc_keyboard[15].value < 255 ) Controls.vertical_thrust_time += speed_factor*key_down_time( kc_keyboard[15].value ); - if ( kc_keyboard[16].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[16].value ); - if ( kc_keyboard[17].value < 255 ) Controls.vertical_thrust_time -= speed_factor*key_down_time( kc_keyboard[17].value ); - - // From joystick... - if ((use_joystick)&&( kc_joystick[19].value < 255 )) { - if ( !kc_joystick[20].value ) // If not inverted... - Controls.vertical_thrust_time += (joy_axis[kc_joystick[19].value]*Config_joystick_sensitivity)/8; - else - Controls.vertical_thrust_time -= (joy_axis[kc_joystick[19].value]*Config_joystick_sensitivity)/8; - } - - // From joystick buttons - if ( (use_joystick)&&(kc_joystick[8].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_joystick[8].value ); - if ( (use_joystick)&&(kc_joystick[37].value < 255 )) Controls.vertical_thrust_time += joy_get_button_down_time( kc_joystick[37].value ); - if ( (use_joystick)&&(kc_joystick[9].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_joystick[9].value ); - if ( (use_joystick)&&(kc_joystick[38].value < 255 )) Controls.vertical_thrust_time -= joy_get_button_down_time( kc_joystick[38].value ); - - // From mouse buttons - if ( (use_mouse)&&(kc_mouse[8].value < 255 )) Controls.vertical_thrust_time += mouse_button_down_time( kc_mouse[8].value ); - if ( (use_mouse)&&(kc_mouse[9].value < 255 )) Controls.vertical_thrust_time -= mouse_button_down_time( kc_mouse[9].value ); - - // From mouse... - if ( (use_mouse)&&(kc_mouse[19].value < 255 )) { - if ( !kc_mouse[20].value ) // If not inverted... - Controls.vertical_thrust_time += (mouse_axis[kc_mouse[19].value]*Config_mouse_sensitivity)/8; - else - Controls.vertical_thrust_time -= (mouse_axis[kc_mouse[19].value]*Config_mouse_sensitivity)/8; - } - - // From Cyberman... - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - Controls.vertical_thrust_time += mouse_button_down_time(MB_Z_UP)/2; - Controls.vertical_thrust_time -= mouse_button_down_time(MB_Z_DOWN)/2; - } -}//end "if" added by WraithX - //---------- Read heading_time ----------- if (!slide_on && !bank_on) { @@ -2226,12 +1776,6 @@ if (!Player_is_dead) if ( kc_keyboard[6].value < 255 ) kh += k6/PH_SCALE; if ( kc_keyboard[7].value < 255 ) kh += k7/PH_SCALE; - // From Cyberman... - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - kh -= mouse_button_down_time(MB_HEAD_LEFT)/PH_SCALE; - kh += mouse_button_down_time(MB_HEAD_RIGHT)/PH_SCALE; - } - if (kh == 0) Controls.heading_time = 0; else if (kh > 0) { @@ -2261,80 +1805,72 @@ if (!Player_is_dead) Controls.heading_time = 0; } -//the following "if" added by WraithX, 4/14/00 -//done so that dead players can't move -if (!Player_is_dead) -{ -//----------- Read sideways_thrust_time ----------------- - - if ( slide_on ) { - k0 = speed_factor*key_down_time( kc_keyboard[4].value ); - k1 = speed_factor*key_down_time( kc_keyboard[5].value ); - k2 = speed_factor*key_down_time( kc_keyboard[6].value ); - k3 = speed_factor*key_down_time( kc_keyboard[7].value ); - - // From keyboard... - if ( kc_keyboard[4].value < 255 ) Controls.sideways_thrust_time -= k0; - if ( kc_keyboard[5].value < 255 ) Controls.sideways_thrust_time -= k1; - if ( kc_keyboard[6].value < 255 ) Controls.sideways_thrust_time += k2; - if ( kc_keyboard[7].value < 255 ) Controls.sideways_thrust_time += k3; + if (!Player_is_dead) + { + //----------- Read sideways_thrust_time ----------------- - // From joystick... - if ( (use_joystick)&&(kc_joystick[15].value < 255 )) { - if ( !kc_joystick[16].value ) // If not inverted... - Controls.sideways_thrust_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; - else - Controls.sideways_thrust_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; - } + if ( slide_on ) { + k0 = speed_factor*key_down_time( kc_keyboard[4].value ); + k1 = speed_factor*key_down_time( kc_keyboard[5].value ); + k2 = speed_factor*key_down_time( kc_keyboard[6].value ); + k3 = speed_factor*key_down_time( kc_keyboard[7].value ); + + // From keyboard... + if ( kc_keyboard[4].value < 255 ) Controls.sideways_thrust_time -= k0; + if ( kc_keyboard[5].value < 255 ) Controls.sideways_thrust_time -= k1; + if ( kc_keyboard[6].value < 255 ) Controls.sideways_thrust_time += k2; + if ( kc_keyboard[7].value < 255 ) Controls.sideways_thrust_time += k3; - // From cyberman - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - Controls.sideways_thrust_time -= mouse_button_down_time(MB_HEAD_LEFT); - Controls.sideways_thrust_time += mouse_button_down_time(MB_HEAD_RIGHT); + // From joystick... + if ( (use_joystick)&&(kc_joystick[15].value < 255 )) { + if ( !kc_joystick[16].value ) // If not inverted... + Controls.sideways_thrust_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + else + Controls.sideways_thrust_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + } + + // From mouse... + if ( (use_mouse)&&(kc_mouse[15].value < 255 )) { + if ( !kc_mouse[16].value ) // If not inverted... + Controls.sideways_thrust_time += (mouse_axis[kc_mouse[15].value]*Config_mouse_sensitivity)/8; + else + Controls.sideways_thrust_time -= (mouse_axis[kc_mouse[15].value]*Config_mouse_sensitivity)/8; + } } + // From keyboard... + if ( kc_keyboard[10].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[10].value ); + if ( kc_keyboard[11].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[11].value ); + if ( kc_keyboard[12].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[12].value ); + if ( kc_keyboard[13].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[13].value ); + + // From joystick... + if ( (use_joystick)&&(kc_joystick[17].value < 255 )) { + if ( !kc_joystick[18].value ) // If not inverted... + Controls.sideways_thrust_time -= (joy_axis[kc_joystick[17].value]*Config_joystick_sensitivity)/8; + else + Controls.sideways_thrust_time += (joy_axis[kc_joystick[17].value]*Config_joystick_sensitivity)/8; + } + + // From joystick buttons + if ( (use_joystick)&&(kc_joystick[6].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_joystick[6].value ); + if ( (use_joystick)&&(kc_joystick[35].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_joystick[35].value ); + if ( (use_joystick)&&(kc_joystick[7].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_joystick[7].value ); + if ( (use_joystick)&&(kc_joystick[36].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_joystick[36].value ); + + // From mouse buttons + if ( (use_mouse)&&(kc_mouse[6].value < 255 )) Controls.sideways_thrust_time -= mouse_button_down_time( kc_mouse[6].value ); + if ( (use_mouse)&&(kc_mouse[7].value < 255 )) Controls.sideways_thrust_time += mouse_button_down_time( kc_mouse[7].value ); + // From mouse... - if ( (use_mouse)&&(kc_mouse[15].value < 255 )) { - if ( !kc_mouse[16].value ) // If not inverted... - Controls.sideways_thrust_time += (mouse_axis[kc_mouse[15].value]*Config_mouse_sensitivity)/8; + if ( (use_mouse)&&(kc_mouse[17].value < 255 )) { + if ( !kc_mouse[18].value ) // If not inverted... + Controls.sideways_thrust_time += (mouse_axis[kc_mouse[17].value]*Config_mouse_sensitivity)/8; else - Controls.sideways_thrust_time -= (mouse_axis[kc_mouse[15].value]*Config_mouse_sensitivity)/8; + Controls.sideways_thrust_time -= (mouse_axis[kc_mouse[17].value]*Config_mouse_sensitivity)/8; } } - // From keyboard... - if ( kc_keyboard[10].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[10].value ); - if ( kc_keyboard[11].value < 255 ) Controls.sideways_thrust_time -= speed_factor*key_down_time( kc_keyboard[11].value ); - if ( kc_keyboard[12].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[12].value ); - if ( kc_keyboard[13].value < 255 ) Controls.sideways_thrust_time += speed_factor*key_down_time( kc_keyboard[13].value ); - - // From joystick... - if ( (use_joystick)&&(kc_joystick[17].value < 255 )) { - if ( !kc_joystick[18].value ) // If not inverted... - Controls.sideways_thrust_time -= (joy_axis[kc_joystick[17].value]*Config_joystick_sensitivity)/8; - else - Controls.sideways_thrust_time += (joy_axis[kc_joystick[17].value]*Config_joystick_sensitivity)/8; - } - - // From joystick buttons - if ( (use_joystick)&&(kc_joystick[6].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_joystick[6].value ); - if ( (use_joystick)&&(kc_joystick[35].value < 255 )) Controls.sideways_thrust_time -= joy_get_button_down_time( kc_joystick[35].value ); - if ( (use_joystick)&&(kc_joystick[7].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_joystick[7].value ); - if ( (use_joystick)&&(kc_joystick[36].value < 255 )) Controls.sideways_thrust_time += joy_get_button_down_time( kc_joystick[36].value ); - - // From mouse buttons - if ( (use_mouse)&&(kc_mouse[6].value < 255 )) Controls.sideways_thrust_time -= mouse_button_down_time( kc_mouse[6].value ); - if ( (use_mouse)&&(kc_mouse[7].value < 255 )) Controls.sideways_thrust_time += mouse_button_down_time( kc_mouse[7].value ); - - // From mouse... - if ( (use_mouse)&&(kc_mouse[17].value < 255 )) { - if ( !kc_mouse[18].value ) // If not inverted... - Controls.sideways_thrust_time += (mouse_axis[kc_mouse[17].value]*Config_mouse_sensitivity)/8; - else - Controls.sideways_thrust_time -= (mouse_axis[kc_mouse[17].value]*Config_mouse_sensitivity)/8; - } -}//end "if" added by WraithX - //----------- Read bank_time ----------------- if ( bank_on ) { @@ -2349,12 +1885,6 @@ if (!Player_is_dead) if ( kc_keyboard[6].value < 255 ) Controls.bank_time -= k2; if ( kc_keyboard[7].value < 255 ) Controls.bank_time -= k3; - // From Cyberman... - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - Controls.bank_time -= mouse_button_down_time(MB_HEAD_LEFT); - Controls.bank_time += mouse_button_down_time(MB_HEAD_RIGHT); - } - // From joystick... if ( (use_joystick)&&(kc_joystick[15].value < 255) ) { if ( !kc_joystick[16].value ) // If not inverted... @@ -2403,147 +1933,139 @@ if (!Player_is_dead) Controls.bank_time -= mouse_axis[kc_mouse[21].value]; } - // From Cyberman - if ((use_mouse)&&(Config_control_type==CONTROL_CYBERMAN)) { - Controls.bank_time += mouse_button_down_time(MB_BANK_LEFT); - Controls.bank_time -= mouse_button_down_time(MB_BANK_RIGHT); - } - -//the following "if" added by WraithX, 4/14/00 -//done so that dead players can't move -if (!Player_is_dead) -{ -//----------- Read forward_thrust_time ------------- - - // From keyboard... - if ( kc_keyboard[30].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[30].value ); - if ( kc_keyboard[31].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[31].value ); - if ( kc_keyboard[32].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[32].value ); - if ( kc_keyboard[33].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[33].value ); - - // From joystick... - if ( (use_joystick)&&(kc_joystick[23].value < 255 )) { - if ( !kc_joystick[24].value ) // If not inverted... - Controls.forward_thrust_time -= joy_axis[kc_joystick[23].value]; - else - Controls.forward_thrust_time += joy_axis[kc_joystick[23].value]; - } - - // From joystick buttons - if ( (use_joystick)&&(kc_joystick[2].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_joystick[2].value ); - if ( (use_joystick)&&(kc_joystick[31].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_joystick[31].value ); - if ( (use_joystick)&&(kc_joystick[3].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_joystick[3].value ); - if ( (use_joystick)&&(kc_joystick[32].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_joystick[32].value ); - - // From mouse... - if ( (use_mouse)&&(kc_mouse[23].value < 255 )) { - if ( !kc_mouse[24].value ) // If not inverted... - Controls.forward_thrust_time -= mouse_axis[kc_mouse[23].value]; - else - Controls.forward_thrust_time += mouse_axis[kc_mouse[23].value]; - } - - // From mouse buttons - if ( (use_mouse)&&(kc_mouse[2].value < 255 )) Controls.forward_thrust_time += mouse_button_down_time( kc_mouse[2].value ); - if ( (use_mouse)&&(kc_mouse[3].value < 255 )) Controls.forward_thrust_time -= mouse_button_down_time( kc_mouse[3].value ); - -//----------- Read fire_primary_down_count -#ifdef GP2X // deny these controls for GP2X combo actions with SELECT -if (!keyd_pressed[ KEY_LALT ]) -#endif -{ - if (kc_keyboard[24].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[24].value); - if (kc_keyboard[25].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[25].value); - - if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_joystick[0].value); - if ((use_joystick)&&(kc_joystick[29].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_joystick[29].value); - if ((use_mouse)&&(kc_mouse[0].value < 255 )) Controls.fire_primary_down_count += mouse_button_down_count(kc_mouse[0].value); -} -#ifdef NETWORK - if(use_alt_vulcanfire) + if (!Player_is_dead) { - if(Primary_weapon != VULCAN_INDEX) - { - Vulcan_jostate = 0; - Vulcan_kostate = 0; - Vulcan_mostate = 0; - do_vulcan_fire(0); - } - else - { - int Vulcan_jstate=0; - int Vulcan_kstate=0; - int Vulcan_mstate=0; - Vulcan_kstate = (keyd_pressed[kc_keyboard[24].value]||keyd_pressed[kc_keyboard[25].value]); - Vulcan_jstate = joy_get_button_state( kc_joystick[0].value); - Vulcan_mstate = mouse_button_state( kc_mouse[0].value); + //----------- Read forward_thrust_time ------------- - if (Vulcan_kstate!=Vulcan_kostate || Vulcan_jstate!=Vulcan_jostate || Vulcan_mstate!=Vulcan_mostate) + // From keyboard... + if ( kc_keyboard[30].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[30].value ); + if ( kc_keyboard[31].value < 255 ) Controls.forward_thrust_time += speed_factor*key_down_time( kc_keyboard[31].value ); + if ( kc_keyboard[32].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[32].value ); + if ( kc_keyboard[33].value < 255 ) Controls.forward_thrust_time -= speed_factor*key_down_time( kc_keyboard[33].value ); + + // From joystick... + if ( (use_joystick)&&(kc_joystick[23].value < 255 )) { + if ( !kc_joystick[24].value ) // If not inverted... + Controls.forward_thrust_time -= joy_axis[kc_joystick[23].value]; + else + Controls.forward_thrust_time += joy_axis[kc_joystick[23].value]; + } + + // From joystick buttons + if ( (use_joystick)&&(kc_joystick[2].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_joystick[2].value ); + if ( (use_joystick)&&(kc_joystick[31].value < 255 )) Controls.forward_thrust_time += joy_get_button_down_time( kc_joystick[31].value ); + if ( (use_joystick)&&(kc_joystick[3].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_joystick[3].value ); + if ( (use_joystick)&&(kc_joystick[32].value < 255 )) Controls.forward_thrust_time -= joy_get_button_down_time( kc_joystick[32].value ); + + // From mouse... + if ( (use_mouse)&&(kc_mouse[23].value < 255 )) { + if ( !kc_mouse[24].value ) // If not inverted... + Controls.forward_thrust_time -= mouse_axis[kc_mouse[23].value]; + else + Controls.forward_thrust_time += mouse_axis[kc_mouse[23].value]; + } + + // From mouse buttons + if ( (use_mouse)&&(kc_mouse[2].value < 255 )) Controls.forward_thrust_time += mouse_button_down_time( kc_mouse[2].value ); + if ( (use_mouse)&&(kc_mouse[3].value < 255 )) Controls.forward_thrust_time -= mouse_button_down_time( kc_mouse[3].value ); + + //----------- Read fire_primary_down_count + #ifdef GP2X // deny these controls for GP2X combo actions with SELECT + if (!keyd_pressed[ KEY_LALT ]) + #endif + { + if (kc_keyboard[24].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[24].value); + if (kc_keyboard[25].value < 255 ) Controls.fire_primary_down_count += key_down_count(kc_keyboard[25].value); + + if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_joystick[0].value); + if ((use_joystick)&&(kc_joystick[29].value < 255 )) Controls.fire_primary_down_count += joy_get_button_down_cnt(kc_joystick[29].value); + if ((use_mouse)&&(kc_mouse[0].value < 255 )) Controls.fire_primary_down_count += mouse_button_down_count(kc_mouse[0].value); + } + #ifdef NETWORK + if(use_alt_vulcanfire) + { + if(Primary_weapon != VULCAN_INDEX) { - do_vulcan_fire(Vulcan_kstate||Vulcan_jstate||Vulcan_mstate); - Vulcan_kostate = Vulcan_kstate; - Vulcan_jostate = Vulcan_jstate; - Vulcan_mostate = Vulcan_mstate; + Vulcan_jostate = 0; + Vulcan_kostate = 0; + Vulcan_mostate = 0; + do_vulcan_fire(0); + } + else + { + int Vulcan_jstate=0; + int Vulcan_kstate=0; + int Vulcan_mstate=0; + Vulcan_kstate = (keyd_pressed[kc_keyboard[24].value]||keyd_pressed[kc_keyboard[25].value]); + Vulcan_jstate = joy_get_button_state( kc_joystick[0].value); + Vulcan_mstate = mouse_button_state( kc_mouse[0].value); + + if (Vulcan_kstate!=Vulcan_kostate || Vulcan_jstate!=Vulcan_jostate || Vulcan_mstate!=Vulcan_mostate) + { + do_vulcan_fire(Vulcan_kstate||Vulcan_jstate||Vulcan_mstate); + Vulcan_kostate = Vulcan_kstate; + Vulcan_jostate = Vulcan_jstate; + Vulcan_mostate = Vulcan_mstate; + } } } + #endif + + #ifdef GP2X // deny these controls for GP2X combo actions with SELECT + if (!keyd_pressed[ KEY_LALT ]) + #endif + { + //----------- Read fire_primary_state + if (kc_keyboard[24].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[24].value]; + if (kc_keyboard[25].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[25].value]; + if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_joystick[0].value); + if ((use_joystick)&&(kc_joystick[29].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_joystick[29].value); + if ((use_mouse)&&(kc_mouse[0].value < 255) ) Controls.fire_primary_state |= mouse_button_state(kc_mouse[0].value); + + //----------- Read fire_secondary_down_count + if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[26].value); + if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[27].value); + if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_joystick[1].value); + if ((use_joystick)&&(kc_joystick[30].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_joystick[30].value); + if ((use_mouse)&&(kc_mouse[1].value < 255 )) Controls.fire_secondary_down_count += mouse_button_down_count(kc_mouse[1].value); + + //----------- Read fire_secondary_state + if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[26].value]; + if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[27].value]; + if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_joystick[1].value); + if ((use_joystick)&&(kc_joystick[30].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_joystick[30].value); + if ((use_mouse)&&(kc_mouse[1].value < 255) ) Controls.fire_secondary_state |= mouse_button_state(kc_mouse[1].value); } - #endif - -#ifdef GP2X // deny these controls for GP2X combo actions with SELECT -if (!keyd_pressed[ KEY_LALT ]) -#endif -{ -//----------- Read fire_primary_state - if (kc_keyboard[24].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[24].value]; - if (kc_keyboard[25].value < 255 ) Controls.fire_primary_state |= keyd_pressed[kc_keyboard[25].value]; - if ((use_joystick)&&(kc_joystick[0].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_joystick[0].value); - if ((use_joystick)&&(kc_joystick[29].value < 255 )) Controls.fire_primary_state |= joy_get_button_state(kc_joystick[29].value); - if ((use_mouse)&&(kc_mouse[0].value < 255) ) Controls.fire_primary_state |= mouse_button_state(kc_mouse[0].value); - -//----------- Read fire_secondary_down_count - if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[26].value); - if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_down_count += key_down_count(kc_keyboard[27].value); - if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_joystick[1].value); - if ((use_joystick)&&(kc_joystick[30].value < 255 )) Controls.fire_secondary_down_count += joy_get_button_down_cnt(kc_joystick[30].value); - if ((use_mouse)&&(kc_mouse[1].value < 255 )) Controls.fire_secondary_down_count += mouse_button_down_count(kc_mouse[1].value); - -//----------- Read fire_secondary_state - if (kc_keyboard[26].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[26].value]; - if (kc_keyboard[27].value < 255 ) Controls.fire_secondary_state |= keyd_pressed[kc_keyboard[27].value]; - if ((use_joystick)&&(kc_joystick[1].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_joystick[1].value); - if ((use_joystick)&&(kc_joystick[30].value < 255 )) Controls.fire_secondary_state |= joy_get_button_state(kc_joystick[30].value); - if ((use_mouse)&&(kc_mouse[1].value < 255) ) Controls.fire_secondary_state |= mouse_button_state(kc_mouse[1].value); -} - -//----------- Read fire_flare_down_count - if (kc_keyboard[28].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[28].value); - if (kc_keyboard[29].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[29].value); - if ((use_joystick)&&(kc_joystick[4].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_joystick[4].value); - if ((use_joystick)&&(kc_joystick[33].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_joystick[33].value); - if ((use_mouse)&&(kc_mouse[4].value < 255 )) Controls.fire_flare_down_count += mouse_button_down_count(kc_mouse[4].value); - -//----------- Read drop_bomb_down_count - if (kc_keyboard[34].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[34].value); - if (kc_keyboard[35].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[35].value); - if ((use_joystick)&&(kc_joystick[26].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_joystick[26].value); - if ((use_joystick)&&(kc_joystick[43].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_joystick[43].value); - if ((use_mouse)&&(kc_mouse[26].value < 255 )) Controls.drop_bomb_down_count += mouse_button_down_count(kc_mouse[26].value); - -//----------- Read rear_view_down_count - if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[36].value); - if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[37].value); - if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_joystick[25].value); - if ((use_joystick)&&(kc_joystick[42].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_joystick[42].value); - if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_count += mouse_button_down_count(kc_mouse[25].value); - -//----------- Read rear_view_down_state - if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[36].value]; - if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[37].value]; - if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_joystick[25].value); - if ((use_joystick)&&(kc_joystick[42].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_joystick[42].value); - if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_state |= mouse_button_state(kc_mouse[25].value); - -}//end "if" added by WraithX + + //----------- Read fire_flare_down_count + if (kc_keyboard[28].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[28].value); + if (kc_keyboard[29].value < 255 ) Controls.fire_flare_down_count += key_down_count(kc_keyboard[29].value); + if ((use_joystick)&&(kc_joystick[4].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_joystick[4].value); + if ((use_joystick)&&(kc_joystick[33].value < 255 )) Controls.fire_flare_down_count += joy_get_button_down_cnt(kc_joystick[33].value); + if ((use_mouse)&&(kc_mouse[4].value < 255 )) Controls.fire_flare_down_count += mouse_button_down_count(kc_mouse[4].value); + + //----------- Read drop_bomb_down_count + if (kc_keyboard[34].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[34].value); + if (kc_keyboard[35].value < 255 ) Controls.drop_bomb_down_count += key_down_count(kc_keyboard[35].value); + if ((use_joystick)&&(kc_joystick[26].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_joystick[26].value); + if ((use_joystick)&&(kc_joystick[43].value < 255 )) Controls.drop_bomb_down_count += joy_get_button_down_cnt(kc_joystick[43].value); + if ((use_mouse)&&(kc_mouse[26].value < 255 )) Controls.drop_bomb_down_count += mouse_button_down_count(kc_mouse[26].value); + + //----------- Read rear_view_down_count + if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[36].value); + if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_count += key_down_count(kc_keyboard[37].value); + if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_joystick[25].value); + if ((use_joystick)&&(kc_joystick[42].value < 255 )) Controls.rear_view_down_count += joy_get_button_down_cnt(kc_joystick[42].value); + if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_count += mouse_button_down_count(kc_mouse[25].value); + + //----------- Read rear_view_down_state + if (kc_keyboard[36].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[36].value]; + if (kc_keyboard[37].value < 255 ) Controls.rear_view_down_state |= keyd_pressed[kc_keyboard[37].value]; + if ((use_joystick)&&(kc_joystick[25].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_joystick[25].value); + if ((use_joystick)&&(kc_joystick[42].value < 255 )) Controls.rear_view_down_state |= joy_get_button_state(kc_joystick[42].value); + if ((use_mouse)&&(kc_mouse[25].value < 255 )) Controls.rear_view_down_state |= mouse_button_state(kc_mouse[25].value); + + }//end "if" added by WraithX //----------- Read automap_down_count if (kc_keyboard[44].value < 255 ) Controls.automap_down_count += key_down_count(kc_keyboard[44].value); @@ -2553,7 +2075,7 @@ if (!keyd_pressed[ KEY_LALT ]) //----------- Read automap_state if (kc_keyboard[44].value < 255 ) Controls.automap_state |= keyd_pressed[kc_keyboard[44].value]; if (kc_keyboard[45].value < 255 ) Controls.automap_state |= keyd_pressed[kc_keyboard[45].value]; - + //----------- Read stupid-cruise-control-type of throttle. { if ( kc_keyboard[38].value < 255 ) Cruise_speed += fixdiv(speed_factor*key_down_time(kc_keyboard[38].value)*5,FrameTime); @@ -2572,32 +2094,26 @@ if (!keyd_pressed[ KEY_LALT ]) Controls.forward_thrust_time = fixmul(Cruise_speed,FrameTime)/100; } - // Read external controls - if (kc_use_external_control) - kconfig_read_external_controls(); - //----------- Clamp values between -FrameTime and FrameTime if (FrameTime > F1_0 ) mprintf( (1, "Bogus frame time of %.2f seconds\n", f2fl(FrameTime) )); -// ZICO - remove clamp for pitch and heading if mouselook on and no multiplayer game -if ((Config_control_type != 5) || !mouselook || (Game_mode & GM_MULTI) ) { - if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2; - if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime; - if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2; - if (Controls.heading_time < -FrameTime ) Controls.heading_time = -FrameTime; -} + // ZICO - remove clamp for pitch and heading if mouselook on and no multiplayer game + if ((Config_control_type != 5) || !mouselook || (Game_mode & GM_MULTI) ) { + if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2; + if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime; + if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2; + if (Controls.heading_time < -FrameTime ) Controls.heading_time = -FrameTime; + } if (Controls.vertical_thrust_time > FrameTime ) Controls.vertical_thrust_time = FrameTime; if (Controls.sideways_thrust_time > FrameTime ) Controls.sideways_thrust_time = FrameTime; if (Controls.bank_time > FrameTime ) Controls.bank_time = FrameTime; if (Controls.forward_thrust_time > FrameTime ) Controls.forward_thrust_time = FrameTime; -// if (Controls.afterburner_time > FrameTime ) Controls.afterburner_time = FrameTime; if (Controls.vertical_thrust_time < -FrameTime ) Controls.vertical_thrust_time = -FrameTime; if (Controls.sideways_thrust_time < -FrameTime ) Controls.sideways_thrust_time = -FrameTime; if (Controls.bank_time < -FrameTime ) Controls.bank_time = -FrameTime; if (Controls.forward_thrust_time < -FrameTime ) Controls.forward_thrust_time = -FrameTime; -// if (Controls.afterburner_time < -FrameTime ) Controls.afterburner_time = -FrameTime; //--------- Don't do anything if in debug mode diff --git a/main/kconfig.h b/main/kconfig.h index aefc84fee..f93d6405a 100755 --- a/main/kconfig.h +++ b/main/kconfig.h @@ -11,116 +11,9 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/kconfig.h,v $ - * $Revision: 1.1.1.1 $ - * $Author: zicodxx $ - * $Date: 2006/03/17 19:44:27 $ * * Prototypes for reading controls * - * $Log: kconfig.h,v $ - * Revision 1.1.1.1 2006/03/17 19:44:27 zicodxx - * initial import - * - * Revision 1.4 2000/04/19 21:27:57 sekmu - * movable death-cam from WraithX - * - * Revision 1.3 1999/10/15 05:22:15 donut - * typedef'd ssize_t on windows - * - * Revision 1.2 1999/10/14 04:48:20 donut - * alpha fixes, and gl_font args - * - * Revision 1.1.1.1 1999/06/14 22:12:31 donut - * Import of d1x 1.37 source. - * - * Revision 2.0 1995/02/27 11:29:38 john - * New version 2.0, which has no anonymous unions, builds with - * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. - * - * Revision 1.23 1995/01/12 11:41:44 john - * Added external control reading. - * - * Revision 1.22 1994/12/07 16:15:30 john - * Added command to check to see if a joystick axes has been used. - * - * Revision 1.21 1994/11/29 03:46:29 john - * Added joystick sensitivity; Added sound channels to detail menu. Removed -maxchannels - * command line arg. - * - * Revision 1.20 1994/11/22 16:54:45 mike - * autorepeat on missiles. - * - * Revision 1.19 1994/11/07 14:01:27 john - * Changed the gamma correction sequencing. - * - * Revision 1.18 1994/11/01 16:40:02 john - * Added Gamma correction. - * - * Revision 1.17 1994/10/25 23:09:24 john - * Made the automap key configurable. - * - * Revision 1.16 1994/10/24 19:56:51 john - * Made the new user setup prompt for config options. - * - * Revision 1.15 1994/10/24 17:44:18 john - * Added stereo channel reversing. - * - * Revision 1.14 1994/10/22 13:19:33 john - * Took out toggle primary/secondary weapons. Fixed black - * background for 'axes' and 'buttons' text. - * - * Revision 1.13 1994/10/17 13:06:51 john - * Moved the descent.cfg info into the player config file. - * - * Revision 1.12 1994/10/14 12:14:47 john - * Changed code so that by doing DEL+F12 saves the current kconfig - * values as default. Added support for drop_bomb key. Took out - * unused slots for keyboard. Made keyboard use control_type of 0 - * save slots. - * - * Revision 1.11 1994/10/13 19:21:33 john - * Added separate config saves for different devices. - * Made all the devices work together better, such as mice won't - * get read when you're playing with the joystick. - * - * Revision 1.10 1994/10/13 15:18:41 john - * Started ripping out old afterburner, show message, show automap - * keys in the keyboard config stuff. - * - * Revision 1.9 1994/10/13 11:35:27 john - * Made Thrustmaster FCS Hat work. Put a background behind the - * keyboard configure. Took out turn_sensitivity. Changed sound/config - * menu to new menu. Made F6 be calibrate joystick. - * - * Revision 1.8 1994/10/06 14:10:50 matt - * New function reset_cruise() - * - * Revision 1.7 1994/10/03 14:58:25 john - * Added rear_view_down_state so that the rear view can - * work like the automap. - * - * Revision 1.6 1994/09/30 12:37:25 john - * Added midi,digi volume to configuration. - * - * Revision 1.5 1994/09/19 18:49:59 john - * Added switch to disable joystick. - * - * Revision 1.4 1994/09/15 16:11:21 john - * Added support for VFX1 head tracking. Fixed bug with memory over- - * write when using stereo mode. - * - * Revision 1.3 1994/09/12 11:47:38 john - * Made stupid cruise work better. Make kconfig values get - * read/written to disk. - * - * Revision 1.2 1994/09/10 15:46:55 john - * First version of new keyboard configuration. - * - * Revision 1.1 1994/09/10 13:51:40 john - * Initial revision - * - * */ #include "types.h" @@ -129,100 +22,69 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define _KCONFIG_H typedef struct control_info { - fix pitch_time; + fix pitch_time; fix vertical_thrust_time; fix heading_time; fix sideways_thrust_time; fix bank_time; fix forward_thrust_time; - ubyte rear_view_down_count; ubyte rear_view_down_state; - ubyte fire_primary_down_count; ubyte fire_primary_state; ubyte fire_secondary_state; ubyte fire_secondary_down_count; ubyte fire_flare_down_count; - ubyte drop_bomb_down_count; - ubyte automap_down_count; ubyte automap_state; - -//added on 8/6/98 by Victor Rachels to add weapon cycle ubyte cycle_primary_state; ubyte cycle_primary_down_count; ubyte cycle_secondary_state; ubyte cycle_secondary_down_count; -//end this section edit - Victor Rachels } control_info; +#define CONTROL_NONE 0 +#define CONTROL_JOYSTICK 1 +#define CONTROL_MOUSE 5 +#define CONTROL_MAX_TYPES 7 +#define CONTROL_JOYMOUSE 8 + +// old stuff - kept for compability reasons +#define CONTROL_FLIGHTSTICK_PRO 2 +#define CONTROL_THRUSTMASTER_FCS 3 +#define CONTROL_GRAVIS_GAMEPAD 4 +#define CONTROL_CYBERMAN 6 + +#define NUM_D1X_CONTROLS 28 +#define MAX_D1X_CONTROLS 40 +#define NUM_KEY_CONTROLS 46 +#define NUM_JOYSTICK_CONTROLS 44 +#define NUM_MOUSE_CONTROLS 29 +#define MAX_CONTROLS 62 +#define MAX_NOND1X_CONTROLS 50 + +void kconfig_sense_init(); extern control_info Controls; extern void controls_read_all(); extern void kconfig(int n, char * title ); - extern ubyte Config_digi_volume; extern ubyte Config_midi_volume; extern ubyte Config_control_type; extern ubyte Config_channels_reversed; extern ubyte Config_joystick_sensitivity; extern ubyte Config_mouse_sensitivity; - -#define CONTROL_NONE 0 -#define CONTROL_JOYSTICK 1 -#define CONTROL_FLIGHTSTICK_PRO 2 -#define CONTROL_THRUSTMASTER_FCS 3 -#define CONTROL_GRAVIS_GAMEPAD 4 -#define CONTROL_MOUSE 5 -#define CONTROL_CYBERMAN 6 -#define CONTROL_MAX_TYPES 7 -#define CONTROL_JOYMOUSE 8 - -//added on 2/4/99 by Victor Rachels to add new keys menu -#define NUM_D1X_CONTROLS 28 -#define MAX_D1X_CONTROLS 40 - extern ubyte kconfig_d1x_settings[MAX_D1X_CONTROLS]; extern ubyte default_kconfig_d1x_settings[MAX_D1X_CONTROLS]; -//end this section addition - VR - -//added/edited on 2/5/99 by Victor Rachels to move to kconfig_d1x_settings -//added/edited on 8/6/98 by Victor Rachels to add weapon cycle -//changed back from 50,29 due to compatability problems. - -#define NUM_KEY_CONTROLS 46 -#define NUM_JOYSTICK_CONTROLS 44 -#define NUM_MOUSE_CONTROLS 27 - -//end this section edit - Victor Rachels - -#define MAX_CONTROLS 60 -#define MAX_NOND1X_CONTROLS 50 - extern ubyte kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS]; extern ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS]; - extern char *control_text[CONTROL_MAX_TYPES]; - extern void kc_set_controls(); - -// Tries to use vfx1 head tracking. -void kconfig_sense_init(); - -//set the cruise speed to zero extern void reset_cruise(void); - extern int kconfig_is_axes_used(int axis); - extern void kconfig_init_external_controls(int intno, ssize_t address); - extern void HUD_init_message(char * format, ...); - -//the following methods added by WraithX, 4/17/00 extern int isJoyRotationKey(int test_key); //tells if "test_key" is setup for rotation on the joy extern int isMouseRotationKey(int test_key); //tells if "test_key" is setup for rotation on the mouse extern int isKeyboardRotationKey(int test_key); //tells if "test_key" is setup for rotation on the keyboard -//end addition - WraithX - #endif diff --git a/main/laser.c b/main/laser.c index 54f38248a..5dde8615a 100755 --- a/main/laser.c +++ b/main/laser.c @@ -1095,7 +1095,7 @@ void Laser_do_weapon_sequence(object *obj) if (Weapon_info[obj->id].render_type == WEAPON_RENDER_POLYMODEL) turn_radius = 0x0014 * F1_0; // homing missiles, mega missiles else - turn_radius = 0x0020 * F1_0; // smart missile blobs + turn_radius = 0x0030 * F1_0; // smart missile blobs vm_vec_sub(&vector_to_object, &Objects[track_goal].pos, &obj->pos); @@ -1107,15 +1107,15 @@ void Laser_do_weapon_sequence(object *obj) // homing missile speeds : insane - 0x005a max_speed = Weapon_info[obj->id].speed[Difficulty_level]; - if (speed + F1_0 < max_speed) + if (speed /*+ F1_0*/ < max_speed) { speed += fixmul(max_speed, FrameTime/2); if (speed > max_speed) speed = max_speed; } - + dot = vm_vec_dot(&temp_vec, &vector_to_object); - + Laser_TurnSpeedLimit(&temp_vec, &vector_to_object, speed, turn_radius); obj->mtype.phys_info.velocity = temp_vec; // orient it directly by movement vector @@ -1154,7 +1154,7 @@ void Laser_do_weapon_sequence(object *obj) if (speed > max_speed) speed = max_speed; } - + dot = vm_vec_dot(&temp_vec, &vector_to_object); vm_vec_add2(&temp_vec, &vector_to_object); diff --git a/main/menu.c b/main/menu.c index f63ff263c..e17dece80 100755 --- a/main/menu.c +++ b/main/menu.c @@ -673,8 +673,7 @@ void do_new_game_menu() return; //abort! strcpy(config_last_mission, m[new_mission_num] ); - - if (!load_mission(new_mission_num) || (strcmp(get_level_file(new_mission_num),"")?!cfexist(get_level_file(new_mission_num)):0)) { + if (!load_mission(new_mission_num)) { nm_messagebox( NULL, 1, TXT_OK, "Error loading Mission file"); return; } diff --git a/main/newmenu.c b/main/newmenu.c index df6c0d2de..1bcb3ae83 100755 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -462,14 +462,10 @@ int check_button_press() switch (Config_control_type) { case CONTROL_JOYSTICK: - case CONTROL_FLIGHTSTICK_PRO: - case CONTROL_THRUSTMASTER_FCS: - case CONTROL_GRAVIS_GAMEPAD: for (i=0; i<4; i++ ) if (joy_get_button_down_cnt(i)>0) return 1; break; case CONTROL_MOUSE: - case CONTROL_CYBERMAN: case CONTROL_JOYMOUSE: #ifndef NEWMENU_MOUSE // don't allow mouse to continue from menu for (i=0; i<3; i++ ) @@ -549,7 +545,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item * int sound_stopped=0, time_stopped=0; #ifdef NEWMENU_MOUSE int mouse_state, omouse_state, dblclick_flag=0; - int mx=0, my=0, x1 = 0, x2, y1, y2; + int mx=0, my=0, mz=0, x1 = 0, x2, y1, y2; int close_box=0; #endif @@ -1092,7 +1088,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item * #ifdef NEWMENU_MOUSE // for mouse selection of menu's etc. if ( !done && mouse_state && !omouse_state && !all_text ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); for (i=0; icv_bitmap.bm_x + item[i].x - item[i].right_offset - 6; x2 = x1 + item[i].w; @@ -1134,7 +1130,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item * done = 1; if ( !done && mouse_state && !all_text ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); for (i=0; icv_bitmap.bm_x + item[i].x - item[i].right_offset - 6; @@ -1204,7 +1200,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item * } if ( !done && !mouse_state && omouse_state && !all_text && (choice != -1) && (item[choice].type == NM_TYPE_MENU) ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); x1 = grd_curcanv->cv_bitmap.bm_x + item[choice].x; x2 = x1 + item[choice].w; y1 = grd_curcanv->cv_bitmap.bm_y + item[choice].y; @@ -1230,7 +1226,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item * } if ( !done && !mouse_state && omouse_state && close_box ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); x1 = grd_curcanv->cv_bitmap.bm_x + CLOSE_X; x2 = x1 + CLOSE_SIZE; y1 = grd_curcanv->cv_bitmap.bm_y + CLOSE_Y; @@ -1519,7 +1515,7 @@ int newmenu_get_filename( char * title, char * filespec, char * filename, int al bkg bg; // background under listbox #endif #ifdef NEWMENU_MOUSE - int mx, my, x1, x2, y1, y2, mouse_state, omouse_state; + int mx, my, mz, x1, x2, y1, y2, mouse_state, omouse_state; int mouse2_state, omouse2_state; int dblclick_flag=0; #endif @@ -1848,7 +1844,7 @@ ReadFileNames: if (mouse_state || mouse2_state) { int w, h, aw; - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); for (i=first_item; icv_font->ft_h + 2) + box_y; @@ -1882,7 +1878,7 @@ ReadFileNames: } if ( !mouse_state && omouse_state ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); x1 = w_x + CLOSE_X + 2; x2 = x1 + CLOSE_SIZE - 2; y1 = w_y + CLOSE_Y + 2; @@ -2033,7 +2029,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_ keyd_repeat = 1; bkg bg; #ifdef NEWMENU_MOUSE - int mx, my, x1, x2, y1, y2, mouse_state, omouse_state; //, dblclick_flag; + int mx, my, mz, x1, x2, y1, y2, mouse_state, omouse_state; //, dblclick_flag; int close_x,close_y; #endif @@ -2217,7 +2213,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_ if (mouse_state) { int w, h, aw; - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); for (i=first_item; i nitems) break; @@ -2236,7 +2232,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_ //check for close box clicked if ( !mouse_state && omouse_state ) { - mouse_get_pos(&mx, &my); + mouse_get_pos(&mx, &my, &mz); x1 = close_x + CLOSE_X + 2; x2 = x1 + CLOSE_SIZE - 2; y1 = close_y + CLOSE_Y + 2; diff --git a/main/newmenu.h b/main/newmenu.h index 5a970b2d6..7492929ed 100755 --- a/main/newmenu.h +++ b/main/newmenu.h @@ -153,19 +153,10 @@ int nm_messagebox_fixedfont( char *title, int nchoices, ... ); #define SLIDER_MIDDLE "…" // 133 #define SLIDER_MARKER "†" // 134 -#if defined(__WINDOWS__) || defined(SDL_INPUT) -# define NEWMENU_MOUSE -#endif +#define NEWMENU_MOUSE -#ifdef NEWMENU_MOUSE -# if defined(SDL_INPUT) # include # define newmenu_show_cursor() SDL_ShowCursor(SDL_ENABLE) # define newmenu_hide_cursor() SDL_ShowCursor(SDL_DISABLE) -# else -# define newmenu_show_cursor() -# define newmenu_hide_cursor() -# endif -#endif diff --git a/main/playsave.c b/main/playsave.c index 01eabe6b5..228cc83fb 100755 --- a/main/playsave.c +++ b/main/playsave.c @@ -46,17 +46,9 @@ static char rcsid[] = "$Id: playsave.c,v 1.1.1.1 2006/03/17 19:42:10 zicodxx Exp #include "state.h" #include "reorder.h" #include "d_io.h" -//added on 9/16/98 by adb to add memory tracking for this module #include "u_mem.h" -//end additions - adb -//added on 11/12/98 by Victor Rachels to add networkrejoin thing #include "network.h" -//end this section addition - VR -//added 6/15/99 - Owen Evans #include "strutil.h" -//end added - - #include "strio.h" #include "vers_id.h" @@ -147,51 +139,26 @@ void init_game_list() int new_player_config() { int i,j,control_choice; - newmenu_item m[8]; int mct=CONTROL_MAX_TYPES; - mct--; - -RetrySelection: - for (i=0; i0) && (Config_control_type<5)) { - joydefs_calibrate(); - } - Player_default_difficulty = 1; Auto_leveling_on = Default_leveling_on = 1; n_highest_levels = 1; - highest_levels[0].shortname[0] = 0; //no name for mission 0 - highest_levels[0].level_num = 1; //was highest level in old struct + highest_levels[0].shortname[0] = 0; //no name for mission 0 + highest_levels[0].level_num = 1; //was highest level in old struct Config_joystick_sensitivity = 8; Config_mouse_sensitivity = 8; @@ -213,343 +180,310 @@ int read_player_d1x(const char *filename) { FILE *f; int rc = 0; - char *line,*word; - int Stop=0; - int i; - char plxver[6]; + char *line,*word; + int Stop=0; + int i; + char plxver[6]; - sprintf(plxver,"v0.00"); + sprintf(plxver,"v0.00"); - //added on 10/15/98 by Victor Rachels for effeciency stuff - plyr_read_stats(); - //end this section addition - Victor Rachels + plyr_read_stats(); // set defaults for when nothing is specified - memcpy(primary_order, default_primary_order, sizeof(primary_order)); + memcpy(primary_order, default_primary_order, sizeof(primary_order)); memcpy(secondary_order, default_secondary_order, sizeof(secondary_order)); - //added/killed on 2/4/99 by Victor Rachels for new keys -//-killed- kconfig_settings[0][46]=255; -//-killed- kconfig_settings[0][47]=255; -//-killed- kconfig_settings[0][48]=255; -//-killed- kconfig_settings[0][49]=255; -//-killed- kconfig_settings[0][50]=255; -//-killed- kconfig_settings[0][51]=255; + for(i=0;i='a'){ neg=1;I=p[0]-'a'; @@ -566,50 +500,50 @@ unsigned char * decode_stat(unsigned char *p,int *v,char *effcode){ } if (neg) *v *= -1; -// printf("decode_stat: i=%i neg=%i v=%i\n",i,neg,*v); if (!p[i*2])return NULL; return p+(i*2); } + void plyr_read_stats_v(int *k, int *d){ - char filename[14]; - int k1=-1,k2=0,d1=-1,d2=0; - FILE *f; - - *k=0;*d=0;//in case the file doesn't exist. + char filename[14]; + int k1=-1,k2=0,d1=-1,d2=0; + FILE *f; - sprintf(filename,"%s.eff",Players[Player_num].callsign); - strlwr(filename); - f=fopen(filename, "rt"); + *k=0;*d=0;//in case the file doesn't exist. + + sprintf(filename,"%s.eff",Players[Player_num].callsign); + strlwr(filename); + f=fopen(filename, "rt"); - if(f && isatty(fileno(f))) - { - fclose(f); - sprintf(filename,"$%.7s.pl$",Players[Player_num].callsign); - strlwr(filename); - f=fopen(filename,"rt"); - } + if(f && isatty(fileno(f))) + { + fclose(f); + sprintf(filename,"$%.7s.pl$",Players[Player_num].callsign); + strlwr(filename); + f=fopen(filename,"rt"); + } - if(f) - { - char *line,*word; - if(!feof(f)) - { + if(f) + { + char *line,*word; + if(!feof(f)) + { line=fsplitword(f,'\n'); word=splitword(line,':'); if(!strcmp(word,"kills")) *k=atoi(line); free(line); free(word); - } - if(!feof(f)) - { + } + if(!feof(f)) + { line=fsplitword(f,'\n'); word=splitword(line,':'); if(!strcmp(word,"deaths")) *d=atoi(line); free(line); free(word); } - if(!feof(f)) - { + if(!feof(f)) + { line=fsplitword(f,'\n'); word=splitword(line,':'); if(!strcmp(word,"key") && strlen(line)>10){ @@ -623,64 +557,56 @@ void plyr_read_stats_v(int *k, int *d){ } } free(line); free(word); - } - if (k1!=k2 || k1!=*k || d1!=d2 || d1!=*d){ - *k=0;*d=0;//printf("cheater!\n"); - } - } + } + if (k1!=k2 || k1!=*k || d1!=d2 || d1!=*d) + { + *k=0;*d=0; + } + } - if(f) - fclose(f); + if(f) + fclose(f); } -//end addition -MM - int multi_kills_stat=0; int multi_deaths_stat=0; -//edited 11/11/98 by Matthew Mueller - some stuff cut out, some moved into above function -//added on 10/15/98 by Victor Rachels for effeciency stuff void plyr_read_stats() { plyr_read_stats_v(&multi_kills_stat,&multi_deaths_stat); } -//end this section addition - Victor Rachels - -//added on 10/15/98 by Victor Rachels to add player stats void plyr_save_stats() { - int kills,deaths,neg; - char filename[14]; - unsigned char buf[16],buf2[16],a; - int i; - FILE *f; - kills=0; - deaths=0; - - //added/edited on 11/12/98 by Victor Rachels to fix - kills=multi_kills_stat; - deaths=multi_deaths_stat; - //end this section addition - VR - - sprintf(filename,"%s.eff",Players[Player_num].callsign); - strlwr(filename); - f=fopen(filename, "rt"); - - if(f && isatty(fileno(f))) - { - fclose(f); - sprintf(filename,"$%.7s.pl$",Players[Player_num].callsign); - strlwr(filename); - f=fopen(filename,"rt"); - } - - f=fopen(filename, "wt"); - if(!f) - return; //broken! - - fprintf(f,"kills:%i\n",kills); - fprintf(f,"deaths:%i\n",deaths); + int kills,deaths,neg; + char filename[14]; + unsigned char buf[16],buf2[16],a; + int i; + FILE *f; + kills=0; + deaths=0; + + kills=multi_kills_stat; + deaths=multi_deaths_stat; + + sprintf(filename,"%s.eff",Players[Player_num].callsign); + strlwr(filename); + f=fopen(filename, "rt"); + + if(f && isatty(fileno(f))) + { + fclose(f); + sprintf(filename,"$%.7s.pl$",Players[Player_num].callsign); + strlwr(filename); + f=fopen(filename,"rt"); + } + + f=fopen(filename, "wt"); + if(!f) + return; //broken! + + fprintf(f,"kills:%i\n",kills); + fprintf(f,"deaths:%i\n",deaths); fprintf(f,"key:01 "); if (kills<0){ neg=1; @@ -720,418 +646,371 @@ void plyr_save_stats() else i+='A'; fprintf(f,"%c%s %c%s\n",i,buf,i,buf2); - fclose(f); + fclose(f); } -//end this section addition - Victor Rachels -//end edit -MM -// this mess tries to preserve unknown settings in the file... int write_player_d1x(const char *filename) { FILE *fin, *fout; - int rc=0; - int Stop=0; - char *line; - char tempfile[PATH_MAX]; - - - - strcpy(tempfile,filename); - tempfile[strlen(tempfile)-4]=0; - strcat(tempfile,".pl$"); - - fout=fopen(tempfile,"wt"); - - if (fout && isatty(fileno(fout))) - { - //if the callsign is the name of a tty device, prepend a char - fclose(fout); - sprintf(tempfile,"$%.7s.pl$",Players[Player_num].callsign); - strlwr(tempfile); - fout = fopen(tempfile,"wt"); - } - - if(fout) - { - fin=fopen(filename,"rt"); - if(!fin) - { - fprintf(fout,"[D1X Options]\n"); - - fprintf(fout,"[new keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); - fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); - fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); -// fprintf(fout,"cycle primary=0x%x,0x%x,0x%x\n",kconfig_settings[0][46],kconfig_settings[0][47],kconfig_settings[Config_control_type][27]); -// fprintf(fout,"cycle secondary=0x%x,0x%x,0x%x\n",kconfig_settings[0][48],kconfig_settings[0][49],kconfig_settings[Config_control_type][28]); -// fprintf(fout,"autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -//end this section change - VR - fprintf(fout,"[end]\n"); - - fprintf(fout,"[joystick]\n"); - fprintf(fout,"deadzone=%i\n",joy_deadzone); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[weapon order]\n"); - fprintf(fout,"primary=1,2,3,4,5\n"); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[advanced ordering]\n"); - fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3], primary_order[4]); - fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[newer keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); - fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); -// fprintf(fout,"primary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -// fprintf(fout,"secondary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][52],kconfig_settings[0][53],kconfig_settings[Config_control_type][30]); -//end this section change - VR - fprintf(fout,"[end]\n"); - -//added on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"[weapon keys]\n"); - fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); - fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); - fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); - fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); - fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); - fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); - fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); - fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); - fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); - fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); - fprintf(fout,"[end]\n"); -//end this section change - VR - fprintf(fout,"[windowsize]\n"); - fprintf(fout,"width=%d\n", Game_window_w); - fprintf(fout,"height=%d\n", Game_window_h); - fprintf(fout,"[end]\n"); - fprintf(fout,"[resolution]\n"); - fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); - fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); - fprintf(fout,"[end]\n"); - fprintf(fout,"[mouse]\n"); - fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[plx version]\n"); - fprintf(fout,"plx version=%s\n",D1X_VERSION); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[end]\n"); - } - else - { - int printed=0; - - while(!Stop && !feof(fin)) - { - line=fsplitword(fin,'\n'); - strupr(line); - - if (strstr(line,"PLX VERSION")) // we don't want to keep this - { - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - } - else if (strstr(line,"WEAPON ORDER")) - { - fprintf(fout,"[weapon order]\n"); - fprintf(fout,"primary=1,2,3,4,5\n"); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= WEAPON_ORDER; - } -//added on 2/5/99 by Victor Rachels for d1x new keys - else if (strstr(line,"WEAPON KEYS")) - { - fprintf(fout,"[weapon keys]\n"); - fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); - fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); - fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); - fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); - fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); - fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); - fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); - fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); - fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); - fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); - fprintf(fout,"[end]\n"); - - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= WEAPON_KEYS; - } -//end this section addition - VR - else if (strstr(line,"ADVANCED ORDERING")) - { - fprintf(fout,"[advanced ordering]\n"); - fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3], primary_order[4]); - fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= ADV_WEAPON_ORDER; - } - else if (strstr(line,"CYCLE KEYS")||strstr(line,"NEW KEYS")) - { - fprintf(fout,"[new keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); - fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); - fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); -// fprintf(fout,"cycle primary=0x%x,0x%x,0x%0x\n",kconfig_settings[0][46],kconfig_settings[0][47],kconfig_settings[Config_control_type][27]); -// fprintf(fout,"cycle secondary=0x%x,0x%x,0x%x\n",kconfig_settings[0][48],kconfig_settings[0][49],kconfig_settings[Config_control_type][28]); -// fprintf(fout,"autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -//end this section addition - VR - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= NEW_KEYS; - } - else if (strstr(line,"NEWER KEYS")) - { - fprintf(fout,"[newer keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); - fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); -// fprintf(fout,"primary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -// fprintf(fout,"secondary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][52],kconfig_settings[0][53],kconfig_settings[Config_control_type][30]); -//end this section addition - VR - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= NEWER_KEYS; - } - else if (strstr(line,"JOYSTICK")) - { - fprintf(fout,"[joystick]\n"); - fprintf(fout,"deadzone=%i\n",joy_deadzone); - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= JOYSTICK; - } - else if (strstr(line,"WINDOWSIZE")) - { - fprintf(fout,"[windowsize]\n"); - fprintf(fout,"width=%d\n", Game_window_w); - fprintf(fout,"height=%d\n", Game_window_h); - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= WINDOWSIZE; - } - else if (strstr(line,"RESOLUTION")) - { - fprintf(fout,"[resolution]\n"); - fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); - fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= RESOLUTION; - } - else if (strstr(line,"MOUSE")) - { - fprintf(fout,"[mouse]\n"); - fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); - fprintf(fout,"[end]\n"); - while(!strstr(line,"END")&&!feof(fin)) - { - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - free(line); - printed |= MOUSE_SENSITIVITY; - } - else if (strstr(line,"END")) - { - Stop=1; - free(line); - } - else - { - if(line[0]=='['&&!strstr(line,"D1X OPTIONS")) - while(!strstr(line,"END") && !feof(fin)) - { - fprintf(fout,"%s\n",line); - free(line); - line=fsplitword(fin,'\n'); - strupr(line); - } - fprintf(fout,"%s\n",line); - free(line); - } - - if(!Stop&&feof(fin)) - Stop=1; - } - - if(!(printed&NEW_KEYS)) - { - fprintf(fout,"[new keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); - fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); - fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); -// fprintf(fout,"cycle primary=0x%x,0x%x,0x%x\n",kconfig_settings[0][46],kconfig_settings[0][47],kconfig_settings[Config_control_type][27]); -// fprintf(fout,"cycle secondary=0x%x,0x%x,0x%x\n",kconfig_settings[0][48],kconfig_settings[0][49],kconfig_settings[Config_control_type][28]); -// fprintf(fout,"autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -//end this section addition - VR - fprintf(fout,"[end]\n"); - } - if(!(printed&JOYSTICK)) - { - fprintf(fout,"[joystick]\n"); - fprintf(fout,"deadzone=%i\n",joy_deadzone); - fprintf(fout,"[end]\n"); - } - if(!(printed&WEAPON_ORDER)) - { - fprintf(fout,"[weapon order]\n"); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - } - if(!(printed&ADV_WEAPON_ORDER)) - { - fprintf(fout,"[advanced ordering]\n"); - fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3],primary_order[4]); - fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); - fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); - fprintf(fout,"[end]\n"); - } - if(!(printed&NEWER_KEYS)) - { - fprintf(fout,"[newer keys]\n"); -//added/changed on 2/5/99 by Victor Rachels for d1x new keys - fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); - fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); -// fprintf(fout,"primary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][50],kconfig_settings[0][51],kconfig_settings[Config_control_type][29]); -// fprintf(fout,"secondary autoselect toggle=0x%x,0x%x,0x%x\n",kconfig_settings[0][52],kconfig_settings[0][53],kconfig_settings[Config_control_type][30]); -//end this section addition - VR - fprintf(fout,"[end]\n"); - } -//added on 2/5/99 by Victor Rachels for d1x new keys - if(!(printed&WEAPON_KEYS)) - { - fprintf(fout,"[weapon keys]\n"); - fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); - fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); - fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); - fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); - fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); - fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); - fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); - fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); - fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); - fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); - fprintf(fout,"[end]\n"); - } -//end this section addition - VR - if(!(printed&WINDOWSIZE)) - { - fprintf(fout,"[windowsize]\n"); - fprintf(fout,"width=%d\n", Game_window_w); - fprintf(fout,"height=%d\n", Game_window_h); - fprintf(fout,"[end]\n"); - } - - if(!(printed&RESOLUTION)) - { - fprintf(fout,"[resolution]\n"); - fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); - fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); - fprintf(fout,"[end]\n"); - } - if(!(printed&MOUSE_SENSITIVITY)) - { - fprintf(fout,"[mouse]\n"); - fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); - fprintf(fout,"[end]\n"); - } - - fprintf(fout,"[plx version]\n"); - fprintf(fout,"plx version=%s\n",D1X_VERSION); - fprintf(fout,"[end]\n"); - - fprintf(fout,"[end]\n"); - - fclose(fin); - } - - if (ferror(fout)) - rc = errno; - fclose(fout); - if(rc==0) - { - unlink(filename); - rc = rename(tempfile,filename); - } - return rc; - } - else - return errno; + int rc=0; + int Stop=0; + char *line; + char tempfile[PATH_MAX]; + + + + strcpy(tempfile,filename); + tempfile[strlen(tempfile)-4]=0; + strcat(tempfile,".pl$"); + + fout=fopen(tempfile,"wt"); + + if (fout && isatty(fileno(fout))) + { + //if the callsign is the name of a tty device, prepend a char + fclose(fout); + sprintf(tempfile,"$%.7s.pl$",Players[Player_num].callsign); + strlwr(tempfile); + fout = fopen(tempfile,"wt"); + } + + if(fout) + { + fin=fopen(filename,"rt"); + if(!fin) + { + fprintf(fout,"[D1X Options]\n"); + fprintf(fout,"[new keys]\n"); + fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); + fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); + fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"[end]\n"); + fprintf(fout,"[joystick]\n"); + fprintf(fout,"deadzone=%i\n",joy_deadzone); + fprintf(fout,"[end]\n"); + fprintf(fout,"[weapon order]\n"); + fprintf(fout,"primary=1,2,3,4,5\n"); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + fprintf(fout,"[advanced ordering]\n"); + fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3], primary_order[4]); + fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + fprintf(fout,"[newer keys]\n"); + fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); + fprintf(fout,"[end]\n"); + fprintf(fout,"[weapon keys]\n"); + fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); + fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); + fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); + fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); + fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); + fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); + fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); + fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); + fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); + fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); + fprintf(fout,"[end]\n"); + fprintf(fout,"[windowsize]\n"); + fprintf(fout,"width=%d\n", Game_window_w); + fprintf(fout,"height=%d\n", Game_window_h); + fprintf(fout,"[end]\n"); + fprintf(fout,"[resolution]\n"); + fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); + fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); + fprintf(fout,"[end]\n"); + fprintf(fout,"[mouse]\n"); + fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); + fprintf(fout,"[end]\n"); + fprintf(fout,"[plx version]\n"); + fprintf(fout,"plx version=%s\n",D1X_VERSION); + fprintf(fout,"[end]\n"); + fprintf(fout,"[end]\n"); + } + else + { + int printed=0; + + while(!Stop && !feof(fin)) + { + line=fsplitword(fin,'\n'); + strupr(line); + + if (strstr(line,"PLX VERSION")) // we don't want to keep this + { + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + } + else if (strstr(line,"WEAPON ORDER")) + { + fprintf(fout,"[weapon order]\n"); + fprintf(fout,"primary=1,2,3,4,5\n"); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= WEAPON_ORDER; + } + else if (strstr(line,"WEAPON KEYS")) + { + fprintf(fout,"[weapon keys]\n"); + fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); + fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); + fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); + fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); + fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); + fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); + fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); + fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); + fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); + fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); + fprintf(fout,"[end]\n"); + + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= WEAPON_KEYS; + } + else if (strstr(line,"ADVANCED ORDERING")) + { + fprintf(fout,"[advanced ordering]\n"); + fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3], primary_order[4]); + fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= ADV_WEAPON_ORDER; + } + else if (strstr(line,"CYCLE KEYS")||strstr(line,"NEW KEYS")) + { + fprintf(fout,"[new keys]\n"); + fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); + fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); + fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= NEW_KEYS; + } + else if (strstr(line,"NEWER KEYS")) + { + fprintf(fout,"[newer keys]\n"); + fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= NEWER_KEYS; + } + else if (strstr(line,"JOYSTICK")) + { + fprintf(fout,"[joystick]\n"); + fprintf(fout,"deadzone=%i\n",joy_deadzone); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= JOYSTICK; + } + else if (strstr(line,"WINDOWSIZE")) + { + fprintf(fout,"[windowsize]\n"); + fprintf(fout,"width=%d\n", Game_window_w); + fprintf(fout,"height=%d\n", Game_window_h); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= WINDOWSIZE; + } + else if (strstr(line,"RESOLUTION")) + { + fprintf(fout,"[resolution]\n"); + fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); + fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= RESOLUTION; + } + else if (strstr(line,"MOUSE")) + { + fprintf(fout,"[mouse]\n"); + fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); + fprintf(fout,"[end]\n"); + while(!strstr(line,"END")&&!feof(fin)) + { + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + free(line); + printed |= MOUSE_SENSITIVITY; + } + else if (strstr(line,"END")) + { + Stop=1; + free(line); + } + else + { + if(line[0]=='['&&!strstr(line,"D1X OPTIONS")) + while(!strstr(line,"END") && !feof(fin)) + { + fprintf(fout,"%s\n",line); + free(line); + line=fsplitword(fin,'\n'); + strupr(line); + } + fprintf(fout,"%s\n",line); + free(line); + } + + if(!Stop&&feof(fin)) + Stop=1; + } + + if(!(printed&NEW_KEYS)) + { + fprintf(fout,"[new keys]\n"); + fprintf(fout,"cycle primary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[20],kconfig_d1x_settings[21]); + fprintf(fout,"cycle secondary=0x%x,0xff,0x%x\n",kconfig_d1x_settings[22],kconfig_d1x_settings[23]); + fprintf(fout,"autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"[end]\n"); + } + if(!(printed&JOYSTICK)) + { + fprintf(fout,"[joystick]\n"); + fprintf(fout,"deadzone=%i\n",joy_deadzone); + fprintf(fout,"[end]\n"); + } + if(!(printed&WEAPON_ORDER)) + { + fprintf(fout,"[weapon order]\n"); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + } + if(!(printed&ADV_WEAPON_ORDER)) + { + fprintf(fout,"[advanced ordering]\n"); + fprintf(fout,"primary=%d,%d,%d,%d,%d\n",primary_order[0], primary_order[1], primary_order[2],primary_order[3],primary_order[4]); + fprintf(fout,"primary+=%d,%d,%d,%d,%d,%d,%d,%d\n",primary_order[5],primary_order[6],primary_order[7],primary_order[8],primary_order[9],primary_order[10],primary_order[11],primary_order[12]); + fprintf(fout,"secondary=%d,%d,%d,%d,%d\n",secondary_order[0], secondary_order[1], secondary_order[2],secondary_order[3], secondary_order[4]); + fprintf(fout,"[end]\n"); + } + if(!(printed&NEWER_KEYS)) + { + fprintf(fout,"[newer keys]\n"); + fprintf(fout,"primary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[24],kconfig_d1x_settings[25]); + fprintf(fout,"secondary autoselect toggle=0x%x,0xff,0x%x\n",kconfig_d1x_settings[26],kconfig_d1x_settings[27]); + fprintf(fout,"[end]\n"); + } + if(!(printed&WEAPON_KEYS)) + { + fprintf(fout,"[weapon keys]\n"); + fprintf(fout,"1=0x%x,0x%x\n",kconfig_d1x_settings[0],kconfig_d1x_settings[1]); + fprintf(fout,"2=0x%x,0x%x\n",kconfig_d1x_settings[2],kconfig_d1x_settings[3]); + fprintf(fout,"3=0x%x,0x%x\n",kconfig_d1x_settings[4],kconfig_d1x_settings[5]); + fprintf(fout,"4=0x%x,0x%x\n",kconfig_d1x_settings[6],kconfig_d1x_settings[7]); + fprintf(fout,"5=0x%x,0x%x\n",kconfig_d1x_settings[8],kconfig_d1x_settings[9]); + fprintf(fout,"6=0x%x,0x%x\n",kconfig_d1x_settings[10],kconfig_d1x_settings[11]); + fprintf(fout,"7=0x%x,0x%x\n",kconfig_d1x_settings[12],kconfig_d1x_settings[13]); + fprintf(fout,"8=0x%x,0x%x\n",kconfig_d1x_settings[14],kconfig_d1x_settings[15]); + fprintf(fout,"9=0x%x,0x%x\n",kconfig_d1x_settings[16],kconfig_d1x_settings[17]); + fprintf(fout,"0=0x%x,0x%x\n",kconfig_d1x_settings[18],kconfig_d1x_settings[19]); + fprintf(fout,"[end]\n"); + } + if(!(printed&WINDOWSIZE)) + { + fprintf(fout,"[windowsize]\n"); + fprintf(fout,"width=%d\n", Game_window_w); + fprintf(fout,"height=%d\n", Game_window_h); + fprintf(fout,"[end]\n"); + } + if(!(printed&RESOLUTION)) + { + fprintf(fout,"[resolution]\n"); + fprintf(fout,"width=%d\n", SM_W(Game_screen_mode)); + fprintf(fout,"height=%d\n", SM_H(Game_screen_mode)); + fprintf(fout,"[end]\n"); + } + if(!(printed&MOUSE_SENSITIVITY)) + { + fprintf(fout,"[mouse]\n"); + fprintf(fout,"sensitivity=%d\n",Config_mouse_sensitivity); + fprintf(fout,"[end]\n"); + } + + fprintf(fout,"[plx version]\n"); + fprintf(fout,"plx version=%s\n",D1X_VERSION); + fprintf(fout,"[end]\n"); + fprintf(fout,"[end]\n"); + fclose(fin); + } + + if (ferror(fout)) + rc = errno; + fclose(fout); + if(rc==0) + { + unlink(filename); + rc = rename(tempfile,filename); + } + return rc; + } + else + return errno; } - extern int screen_width; - extern int screen_height; +extern int screen_width; +extern int screen_height; //read in the player's saved games. returns errno (0 == no error) int read_player_file() @@ -1362,15 +1241,15 @@ int read_player_file() read_player_d1x(filename); { - int i; - highest_primary=0; - highest_secondary=0; - for(i=0; i0) - highest_primary++; - for(i=0; i0) - highest_secondary++; + int i; + highest_primary=0; + highest_secondary=0; + for(i=0; i0) + highest_primary++; + for(i=0; i0) + highest_secondary++; } if (errno_ret==EZERO) { @@ -1533,22 +1412,21 @@ int write_player_file() { // if (fwrite( kconfig_settings, MAX_CONTROLS*CONTROL_MAX_TYPES, 1, file )!=1) // errno_ret=errno; - int i,j; - for(i=0;i