]> icculus.org git repositories - btb/d2x.git/blob - input/win32_joydefs.c
updated anonymous password
[btb/d2x.git] / input / win32_joydefs.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 #ifdef HAVE_CONFIG_H
15 #include <conf.h>
16 #endif
17
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <string.h>
21
22 #include "mono.h"
23 #include "key.h"
24 #include "joy.h"
25 #include "timer.h"
26 #include "error.h"
27
28 #include "inferno.h"
29 #include "game.h"
30 #include "object.h"
31 #include "player.h"
32
33 #include "controls.h"
34 #include "joydefs.h"
35 #include "render.h"
36 #include "palette.h"
37 #include "newmenu.h"
38 #include "args.h"
39 #include "text.h"
40 #include "kconfig.h"
41 #include "digi.h"
42 #include "playsave.h"
43
44 int joydefs_calibrate_flag=0;
45
46 int Joy_is_Sidewinder=0; //not needed, but lots of main/* stuff use it
47
48 void joy_delay()
49 {
50
51 }
52
53 int joycal_message( char * title, char * text )
54 {
55         int i;
56         newmenu_item    m[2];
57         m[0].type = NM_TYPE_TEXT; m[0].text = text;
58         m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
59         i = newmenu_do( title, NULL, 2, m, NULL );
60         if ( i < 0 ) 
61                 return 1;
62         return 0;
63 }
64
65 void joydefs_calibrate()
66 {
67   joycal_message("No Calibration", "calibration should be performed\nthrough windows");
68   return;
69 }
70
71 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
72 {
73         int i;
74         int oc_type = Config_control_type;
75
76         nitems = nitems;
77         last_key = last_key;
78         citem = citem;          
79
80         for (i=0; i<3; i++ )
81                 if (items[i].value) Config_control_type = i;
82
83         if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE;
84
85         if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) )   {
86                 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
87         }
88
89         if (oc_type != Config_control_type) {
90                 switch (Config_control_type) {
91         //              case    CONTROL_NONE:
92                         case    CONTROL_JOYSTICK:
93                         case    CONTROL_FLIGHTSTICK_PRO:
94                         case    CONTROL_THRUSTMASTER_FCS:
95                         case    CONTROL_GRAVIS_GAMEPAD:
96         //              case    CONTROL_MOUSE:
97         //              case    CONTROL_CYBERMAN:
98                                 joydefs_calibrate_flag = 1;
99                 }
100                 kc_set_controls();
101         }
102
103 }
104
105 extern ubyte kc_use_external_control;
106 extern ubyte kc_enable_external_control;
107 extern ubyte *kc_external_name;
108
109 void joydefs_config()
110 {
111         newmenu_item m[13];
112         int i, j, i1=0, nitems=7;
113
114             m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0;
115             m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0;
116             m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0;
117             m[3].type = NM_TYPE_TEXT; m[3].text="";
118             m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE";
119             m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD";
120             m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS";
121
122             do {
123                 i = Config_control_type;
124                  if(i==CONTROL_MOUSE) i = 2;
125                   m[i].value=1;
126                 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
127
128 //added 6-15-99 Owen Evans
129                 for (j = 0; j <= 2; j++)
130                         if (m[j].value)
131                                 Config_control_type = j;
132                 i = Config_control_type;
133                 if (Config_control_type == 2)
134                         Config_control_type = CONTROL_MOUSE;
135 //end added - OE
136
137                 switch(i1)      {
138                         case 4: 
139                                 kconfig (i, m[i].text);
140                                 break;
141                         case 5: 
142                                 kconfig(0, "KEYBOARD"); 
143                                 break;
144                         case 6:
145                                 kconfig(3, "D1X KEYS");
146                                 break;
147                 } 
148         } while(i1>-1);
149 }