]> icculus.org git repositories - btb/d2x.git/blob - arch/win32/joydefs.c
make dist more sensible
[btb/d2x.git] / arch / 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 #include <stdlib.h>
15 #include <stdio.h>
16 #include <string.h>
17
18 #include "mono.h"
19 #include "key.h"
20 #include "joy.h"
21 #include "timer.h"
22 #include "error.h"
23
24 #include "inferno.h"
25 #include "game.h"
26 #include "object.h"
27 #include "player.h"
28
29 #include "controls.h"
30 #include "joydefs.h"
31 #include "render.h"
32 #include "palette.h"
33 #include "newmenu.h"
34 #include "args.h"
35 #include "text.h"
36 #include "kconfig.h"
37 #include "digi.h"
38 #include "playsave.h"
39
40 int joydefs_calibrate_flag=0;
41
42 int Joy_is_Sidewinder=0; //not needed, but lots of main/* stuff use it
43
44 void joy_delay()
45 {
46
47 }
48
49 int joycal_message( char * title, char * text )
50 {
51         int i;
52         newmenu_item    m[2];
53         m[0].type = NM_TYPE_TEXT; m[0].text = text;
54         m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
55         i = newmenu_do( title, NULL, 2, m, NULL );
56         if ( i < 0 ) 
57                 return 1;
58         return 0;
59 }
60
61 void joydefs_calibrate()
62 {
63   joycal_message("No Calibration", "calibration should be performed\nthrough windows");
64   return;
65 }
66
67 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
68 {
69         int i;
70         int oc_type = Config_control_type;
71
72         nitems = nitems;
73         last_key = last_key;
74         citem = citem;          
75
76         for (i=0; i<3; i++ )
77                 if (items[i].value) Config_control_type = i;
78
79         if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE;
80
81         if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) )   {
82                 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
83         }
84
85         if (oc_type != Config_control_type) {
86                 switch (Config_control_type) {
87         //              case    CONTROL_NONE:
88                         case    CONTROL_JOYSTICK:
89                         case    CONTROL_FLIGHTSTICK_PRO:
90                         case    CONTROL_THRUSTMASTER_FCS:
91                         case    CONTROL_GRAVIS_GAMEPAD:
92         //              case    CONTROL_MOUSE:
93         //              case    CONTROL_CYBERMAN:
94                                 joydefs_calibrate_flag = 1;
95                 }
96                 kc_set_controls();
97         }
98
99 }
100
101 extern ubyte kc_use_external_control;
102 extern ubyte kc_enable_external_control;
103 extern ubyte *kc_external_name;
104
105 void joydefs_config()
106 {
107         newmenu_item m[13];
108         int i, j, i1=0, nitems=7;
109
110             m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0;
111             m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0;
112             m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0;
113             m[3].type = NM_TYPE_TEXT; m[3].text="";
114             m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE";
115             m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD";
116             m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS";
117
118             do {
119                 i = Config_control_type;
120                  if(i==CONTROL_MOUSE) i = 2;
121                   m[i].value=1;
122                 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
123
124 //added 6-15-99 Owen Evans
125                 for (j = 0; j <= 2; j++)
126                         if (m[j].value)
127                                 Config_control_type = j;
128                 i = Config_control_type;
129                 if (Config_control_type == 2)
130                         Config_control_type = CONTROL_MOUSE;
131 //end added - OE
132
133                 switch(i1)      {
134                         case 4: 
135                                 kconfig (i, m[i].text);
136                                 break;
137                         case 5: 
138                                 kconfig(0, "KEYBOARD"); 
139                                 break;
140                         case 6:
141                                 kconfig(3, "D1X KEYS");
142                                 break;
143                 } 
144         } while(i1>-1);
145 }