]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/joydefs.c
This commit was manufactured by cvs2svn to create tag 'd2x-0_1_3'.
[btb/d2x.git] / arch / sdl / joydefs.c
1 /*
2  * $Source: /cvs/cvsroot/d2x/arch/sdl/joydefs.c,v $
3  * $Revision: 1.4 $
4  * $Author: bradleyb $
5  * $Date: 2002-03-05 12:38:08 $
6  *
7  * SDL joystick support
8  *
9  * $Log: not supported by cvs2svn $
10  * Revision 1.3  2001/11/14 03:56:53  bradleyb
11  * #include pstypes.h
12  *
13  * Revision 1.2  2001/11/14 03:29:39  bradleyb
14  * copied joydefs_config from linux/joydefs.c - controls menu now works
15  *
16  * Revision 1.1  2001/10/24 09:25:05  bradleyb
17  * Moved input stuff to arch subdirs, as in d1x.
18  *
19  * Revision 1.1  2001/10/10 03:01:29  bradleyb
20  * Replacing win32 joystick (broken) with SDL joystick (stubs)
21  *
22  *
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include <conf.h>
27 #endif
28
29 #include "joydefs.h"
30 #include "pstypes.h"
31 #include "newmenu.h"
32 #include "config.h"
33 #include "text.h"
34 #include "kconfig.h"
35
36 extern int num_joysticks;
37
38 int joydefs_calibrate_flag = 0;
39
40 void joydefs_calibrate()
41 {
42         joydefs_calibrate_flag = 0;
43
44         if (!num_joysticks) {
45                 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
46                 return;
47         }
48
49         //Actual calibration if necessary
50
51 }
52
53 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
54 {
55         int i;
56         int oc_type = Config_control_type;
57
58         nitems = nitems;
59         last_key = last_key;
60         citem = citem;          
61
62         for (i=0; i<3; i++ )
63                 if (items[i].value) Config_control_type = i;
64
65         if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE;
66
67         if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
68                 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
69         }
70
71         if (oc_type != Config_control_type) {
72                 switch (Config_control_type) {
73         //              case    CONTROL_NONE:
74                         case    CONTROL_JOYSTICK:
75                         case    CONTROL_FLIGHTSTICK_PRO:
76                         case    CONTROL_THRUSTMASTER_FCS:
77                         case    CONTROL_GRAVIS_GAMEPAD:
78         //              case    CONTROL_MOUSE:
79         //              case    CONTROL_CYBERMAN:
80                                 joydefs_calibrate_flag = 1;
81                 }
82                 kc_set_controls();
83         }
84 }
85
86 void joydefs_config()
87 {
88         newmenu_item m[13];
89         int i, i1=5, j, nitems=7;
90
91         m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0;
92         m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0;
93         m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0;
94         m[3].type = NM_TYPE_TEXT; m[3].text="";
95         m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE";
96         m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD";
97         m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS";
98
99         do {
100
101                 i = Config_control_type;
102                 if(i==CONTROL_MOUSE) i = 2;
103                 m[i].value=1;
104
105                 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
106
107                 for (j = 0; j <= 2; j++)
108                         if (m[j].value)
109                                 Config_control_type = j;
110                 i = Config_control_type;
111                 if (Config_control_type == 2)
112                         Config_control_type = CONTROL_MOUSE;
113
114                 switch(i1)      {
115                 case 4: 
116                         kconfig (i, m[i].text);
117                         break;
118                 case 5: 
119                         kconfig(0, "KEYBOARD"); 
120                         break;
121                 case 6:
122                         kconfig(3, "D1X KEYS");
123                         break;
124                 } 
125
126         } while(i1>-1);
127
128 }