1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//
/*
=======================================================================
INGAME MENU
=======================================================================
*/
#include "ui_local.h"
#define INGAME_FRAME "menu/art/addbotframe"
//#define INGAME_FRAME "menu/art/cut_frame"
#define INGAME_MENU_VERTICAL_SPACING 28
#define ID_TEAM 10
#define ID_ADDBOTS 11
#define ID_REMOVEBOTS 12
#define ID_SETUP 13
#define ID_SERVERINFO 14
#define ID_LEAVEARENA 15
#define ID_RESTART 16
#define ID_QUIT 17
#define ID_RESUME 18
#define ID_TEAMORDERS 19
typedef struct {
menuframework_s menu;
menubitmap_s frame;
menutext_s team;
menutext_s setup;
menutext_s server;
menutext_s leave;
menutext_s restart;
menutext_s addbots;
menutext_s removebots;
menutext_s teamorders;
menutext_s quit;
menutext_s resume;
} ingamemenu_t;
static ingamemenu_t s_ingame;
/*
=================
InGame_RestartAction
=================
*/
static void InGame_RestartAction( qboolean result ) {
if( !result ) {
return;
}
UI_PopMenu();
trap_Cmd_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
}
/*
=================
InGame_QuitAction
=================
*/
static void InGame_QuitAction( qboolean result ) {
if( !result ) {
return;
}
UI_PopMenu();
UI_CreditMenu();
}
/*
=================
InGame_Event
=================
*/
void InGame_Event( void *ptr, int notification ) {
if( notification != QM_ACTIVATED ) {
return;
}
switch( ((menucommon_s*)ptr)->id ) {
case ID_TEAM:
UI_TeamMainMenu();
break;
case ID_SETUP:
UI_SetupMenu();
break;
case ID_LEAVEARENA:
trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );
break;
case ID_RESTART:
UI_ConfirmMenu( "RESTART ARENA?", 0, InGame_RestartAction );
break;
case ID_QUIT:
UI_ConfirmMenu( "EXIT GAME?", 0, InGame_QuitAction );
break;
case ID_SERVERINFO:
UI_ServerInfoMenu();
break;
case ID_ADDBOTS:
UI_AddBotsMenu();
break;
case ID_REMOVEBOTS:
UI_RemoveBotsMenu();
break;
case ID_TEAMORDERS:
UI_TeamOrdersMenu();
break;
case ID_RESUME:
UI_PopMenu();
break;
}
}
/*
=================
InGame_MenuInit
=================
*/
void InGame_MenuInit( void ) {
int y;
uiClientState_t cs;
char info[MAX_INFO_STRING];
int team;
memset( &s_ingame, 0 ,sizeof(ingamemenu_t) );
InGame_Cache();
s_ingame.menu.wrapAround = qtrue;
s_ingame.menu.fullscreen = qfalse;
s_ingame.frame.generic.type = MTYPE_BITMAP;
s_ingame.frame.generic.flags = QMF_INACTIVE;
s_ingame.frame.generic.name = INGAME_FRAME;
s_ingame.frame.generic.x = 320-233;//142;
s_ingame.frame.generic.y = 240-166;//118;
s_ingame.frame.width = 466;//359;
s_ingame.frame.height = 332;//256;
//y = 96;
y = 88;
s_ingame.team.generic.type = MTYPE_PTEXT;
s_ingame.team.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.team.generic.x = 320;
s_ingame.team.generic.y = y;
s_ingame.team.generic.id = ID_TEAM;
s_ingame.team.generic.callback = InGame_Event;
s_ingame.team.string = "START";
s_ingame.team.color = color_red;
s_ingame.team.style = UI_CENTER|UI_SMALLFONT;
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.addbots.generic.type = MTYPE_PTEXT;
s_ingame.addbots.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.addbots.generic.x = 320;
s_ingame.addbots.generic.y = y;
s_ingame.addbots.generic.id = ID_ADDBOTS;
s_ingame.addbots.generic.callback = InGame_Event;
s_ingame.addbots.string = "ADD BOTS";
s_ingame.addbots.color = color_red;
s_ingame.addbots.style = UI_CENTER|UI_SMALLFONT;
if( !trap_Cvar_VariableValue( "sv_running" ) || !trap_Cvar_VariableValue( "bot_enable" ) || (trap_Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER)) {
s_ingame.addbots.generic.flags |= QMF_GRAYED;
}
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.removebots.generic.type = MTYPE_PTEXT;
s_ingame.removebots.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.removebots.generic.x = 320;
s_ingame.removebots.generic.y = y;
s_ingame.removebots.generic.id = ID_REMOVEBOTS;
s_ingame.removebots.generic.callback = InGame_Event;
s_ingame.removebots.string = "REMOVE BOTS";
s_ingame.removebots.color = color_red;
s_ingame.removebots.style = UI_CENTER|UI_SMALLFONT;
if( !trap_Cvar_VariableValue( "sv_running" ) || !trap_Cvar_VariableValue( "bot_enable" ) || (trap_Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER)) {
s_ingame.removebots.generic.flags |= QMF_GRAYED;
}
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.teamorders.generic.type = MTYPE_PTEXT;
s_ingame.teamorders.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.teamorders.generic.x = 320;
s_ingame.teamorders.generic.y = y;
s_ingame.teamorders.generic.id = ID_TEAMORDERS;
s_ingame.teamorders.generic.callback = InGame_Event;
s_ingame.teamorders.string = "TEAM ORDERS";
s_ingame.teamorders.color = color_red;
s_ingame.teamorders.style = UI_CENTER|UI_SMALLFONT;
if( !(trap_Cvar_VariableValue( "g_gametype" ) >= GT_TEAM) ) {
s_ingame.teamorders.generic.flags |= QMF_GRAYED;
}
else {
trap_GetClientState( &cs );
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING );
team = atoi( Info_ValueForKey( info, "t" ) );
if( team == TEAM_SPECTATOR ) {
s_ingame.teamorders.generic.flags |= QMF_GRAYED;
}
}
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.setup.generic.type = MTYPE_PTEXT;
s_ingame.setup.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.setup.generic.x = 320;
s_ingame.setup.generic.y = y;
s_ingame.setup.generic.id = ID_SETUP;
s_ingame.setup.generic.callback = InGame_Event;
s_ingame.setup.string = "SETUP";
s_ingame.setup.color = color_red;
s_ingame.setup.style = UI_CENTER|UI_SMALLFONT;
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.server.generic.type = MTYPE_PTEXT;
s_ingame.server.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.server.generic.x = 320;
s_ingame.server.generic.y = y;
s_ingame.server.generic.id = ID_SERVERINFO;
s_ingame.server.generic.callback = InGame_Event;
s_ingame.server.string = "SERVER INFO";
s_ingame.server.color = color_red;
s_ingame.server.style = UI_CENTER|UI_SMALLFONT;
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.restart.generic.type = MTYPE_PTEXT;
s_ingame.restart.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.restart.generic.x = 320;
s_ingame.restart.generic.y = y;
s_ingame.restart.generic.id = ID_RESTART;
s_ingame.restart.generic.callback = InGame_Event;
s_ingame.restart.string = "RESTART ARENA";
s_ingame.restart.color = color_red;
s_ingame.restart.style = UI_CENTER|UI_SMALLFONT;
if( !trap_Cvar_VariableValue( "sv_running" ) ) {
s_ingame.restart.generic.flags |= QMF_GRAYED;
}
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.resume.generic.type = MTYPE_PTEXT;
s_ingame.resume.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.resume.generic.x = 320;
s_ingame.resume.generic.y = y;
s_ingame.resume.generic.id = ID_RESUME;
s_ingame.resume.generic.callback = InGame_Event;
s_ingame.resume.string = "RESUME GAME";
s_ingame.resume.color = color_red;
s_ingame.resume.style = UI_CENTER|UI_SMALLFONT;
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.leave.generic.type = MTYPE_PTEXT;
s_ingame.leave.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.leave.generic.x = 320;
s_ingame.leave.generic.y = y;
s_ingame.leave.generic.id = ID_LEAVEARENA;
s_ingame.leave.generic.callback = InGame_Event;
s_ingame.leave.string = "LEAVE ARENA";
s_ingame.leave.color = color_red;
s_ingame.leave.style = UI_CENTER|UI_SMALLFONT;
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.quit.generic.type = MTYPE_PTEXT;
s_ingame.quit.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_ingame.quit.generic.x = 320;
s_ingame.quit.generic.y = y;
s_ingame.quit.generic.id = ID_QUIT;
s_ingame.quit.generic.callback = InGame_Event;
s_ingame.quit.string = "EXIT GAME";
s_ingame.quit.color = color_red;
s_ingame.quit.style = UI_CENTER|UI_SMALLFONT;
Menu_AddItem( &s_ingame.menu, &s_ingame.frame );
Menu_AddItem( &s_ingame.menu, &s_ingame.team );
Menu_AddItem( &s_ingame.menu, &s_ingame.addbots );
Menu_AddItem( &s_ingame.menu, &s_ingame.removebots );
Menu_AddItem( &s_ingame.menu, &s_ingame.teamorders );
Menu_AddItem( &s_ingame.menu, &s_ingame.setup );
Menu_AddItem( &s_ingame.menu, &s_ingame.server );
Menu_AddItem( &s_ingame.menu, &s_ingame.restart );
Menu_AddItem( &s_ingame.menu, &s_ingame.resume );
Menu_AddItem( &s_ingame.menu, &s_ingame.leave );
Menu_AddItem( &s_ingame.menu, &s_ingame.quit );
}
/*
=================
InGame_Cache
=================
*/
void InGame_Cache( void ) {
trap_R_RegisterShaderNoMip( INGAME_FRAME );
}
/*
=================
UI_InGameMenu
=================
*/
void UI_InGameMenu( void ) {
// force as top level menu
uis.menusp = 0;
// set menu cursor to a nice location
uis.cursorx = 319;
uis.cursory = 80;
InGame_MenuInit();
UI_PushMenu( &s_ingame.menu );
}
|