1 /*
2 Copyright (C) 2003-2006 Andrey Nazarov
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21 #include "ui_local.h"
22
23
24 /*
25 =======================================================================
26
27 OPTIONS MENU
28
29 =======================================================================
30 */
31
32 #define OPTIONS_ITEMS 16
33
34 static const char *names[] = {
35 "Player Setup",
36 "Keys",
37 "Weapons",
38 "Game",
39 "Video",
40 "Sound",
41 "Network",
42 "Address Book",
43 "Credits"
44 };
45
46 static const int numItems = sizeof( names ) / sizeof( names[0] );
47
48 typedef struct optionsMenu_s {
49 menuFrameWork_t menu;
50 menuAction_t actions[OPTIONS_ITEMS];
51 menuStatic_t banner;
52 } optionsMenu_t;
53
54 static optionsMenu_t m_options;
55
56
OptionsMenu_Callback(int id,int msg,int param)57 static int OptionsMenu_Callback( int id, int msg, int param ) {
58 switch( msg ) {
59 case QM_ACTIVATE:
60 switch( id ) {
61 case 0:
62 M_Menu_PlayerConfig_f();
63 break;
64 case 1:
65 M_Menu_Keys_f();
66 break;
67 case 2:
68 M_Menu_Weapons_f();
69 break;
70 case 3:
71 //M_Menu_Interface_f();
72 break;
73 case 4:
74 M_Menu_Video_f();
75 break;
76 case 5:
77 //M_Menu_Sound_f();
78 break;
79 case 6:
80 M_Menu_Network_f();
81 break;
82 case 7:
83 M_Menu_AddressBook_f();
84 break;
85 case 8:
86 M_Menu_Credits_f();
87 break;
88 }
89 return QMS_IN;
90 default:
91 break;
92 }
93
94 return QMS_NOTHANDLED;
95 }
96
97
98
OptionsMenu_Init(void)99 static void OptionsMenu_Init( void ) {
100 int i;
101 int x, y;
102
103 x = uis.glconfig.vidWidth / 2;
104 y = ( uis.glconfig.vidHeight - MENU_SPACING * numItems ) / 2;
105
106 memset( &m_options, 0, sizeof( m_options ) );
107
108 m_options.menu.callback = OptionsMenu_Callback;
109
110 for( i = 0; i < numItems; i++ ) {
111 m_options.actions[i].generic.type = MTYPE_ACTION;
112 m_options.actions[i].generic.id = i;
113 m_options.actions[i].generic.name = names[i];
114 m_options.actions[i].generic.x = x;
115 m_options.actions[i].generic.y = y;
116 m_options.actions[i].generic.uiFlags = UI_CENTER;
117 y += MENU_SPACING;
118
119 Menu_AddItem( &m_options.menu, (void *)&m_options.actions[i] );
120 }
121
122 m_options.actions[0].generic.flags = QMF_HASFOCUS;
123
124 UI_SetupDefaultBanner( &m_options.banner, "Options" );
125
126 Menu_AddItem( &m_options.menu, (void *)&m_options.banner );
127
128 }
129
130
M_Menu_Options_f(void)131 void M_Menu_Options_f( void ) {
132 OptionsMenu_Init();
133 UI_PushMenu( &m_options.menu );
134 }
135
136
137