Skip to content
Newer
Older
100644 86 lines (73 sloc) 1.49 KB
b126e26 @tbradshaw The source of the setup program included with DOOM, Final DOOM, Strif…
tbradshaw authored Jan 31, 2012
1 //
2 // Choose which type of controller to use
3 //
4 enum {CON_MOUSE,CON_JOY,CON_KEY,CON_MAX};
5 item_t controlitems[]=
6 {
7 {CON_MOUSE, 26,11,28, -1,-1},
8 {CON_JOY, 26,12,28, -1,-1},
9 {CON_KEY, 26,13,28, -1,-1}
10 };
11 menu_t controlmenu=
12 {
13 &controlitems[0],
14 CON_MOUSE,
15 CON_MAX,
16 0x7f
17 };
18
19 int ChooseController (void)
20 {
21 short key;
22 short field;
23 int rval = 0;
24
25 SaveScreen();
26 DrawPup(&control);
27
28 // DEFAULT FIELD ========================================
29
30 if (newc.control == C_MOUSE)
31 field = CON_MOUSE;
32 else
33 if (newc.control == C_JOYSTICK)
34 field = CON_JOY;
35 else
36 field = CON_KEY;
37
38 controlmenu.startitem = field;
39 while(1)
40 {
41 SetupMenu(&controlmenu);
42 field = GetMenuInput();
43 key = menukey;
44 switch ( key )
45 {
46 case KEY_ESC:
47 rval = -1;
48 goto func_exit;
49
50 case KEY_ENTER:
51 case KEY_F10:
52 switch ( field )
53 {
54 case CON_KEY:
55 newc.control = C_KEY;
56 usemouse = 0;
57 usejoystick = 0;
58 goto func_exit;
59
60 case CON_MOUSE:
61 newc.control = C_MOUSE;
62 usemouse = 1;
63 usejoystick = 0;
64 goto func_exit;
65
66 case CON_JOY:
67 newc.control = C_JOYSTICK;
68 usemouse = 0;
69 usejoystick = 1;
70 goto func_exit;
71
72 default:
73 break;
74 }
75 break;
76 }
77 }
78
79 func_exit:
80
81 RestoreScreen();
82 DrawCurrentConfig();
83 return ( rval );
84 }
85
Something went wrong with that request. Please try again.