Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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