Skip to content

Commit 09a831f

Browse files
ToKuWofWca
authored andcommitted
Add "Start New Arena" menu item
See the original MR in another repo: clover-moe/mint-arena#7.
1 parent 7801abd commit 09a831f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

code/q3_ui/ui_ingame.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ INGAME MENU
4646
#define ID_QUIT 17
4747
#define ID_RESUME 18
4848
#define ID_TEAMORDERS 19
49+
// https://github.com/clover-moe/mint-arena/pull/7
50+
#define ID_CREATE 21
4951

5052

5153
typedef struct {
@@ -57,6 +59,7 @@ typedef struct {
5759
menutext_s server;
5860
menutext_s leave;
5961
menutext_s restart;
62+
menutext_s startnew;
6063
menutext_s addbots;
6164
menutext_s removebots;
6265
menutext_s teamorders;
@@ -123,6 +126,10 @@ void InGame_Event( void *ptr, int notification ) {
123126
UI_ConfirmMenu( "RESTART ARENA?", 0, InGame_RestartAction );
124127
break;
125128

129+
case ID_CREATE:
130+
UI_StartServerMenu( qtrue );
131+
break;
132+
126133
case ID_QUIT:
127134
UI_ConfirmMenu( "EXIT GAME?", 0, InGame_QuitAction );
128135
break;
@@ -174,7 +181,7 @@ void InGame_MenuInit( void ) {
174181
s_ingame.frame.generic.x = 320-233;//142;
175182
s_ingame.frame.generic.y = 240-166;//118;
176183
s_ingame.frame.width = 466;//359;
177-
s_ingame.frame.height = 332;//256;
184+
s_ingame.frame.height = 356;//256;
178185

179186
//y = 96;
180187
y = 88;
@@ -274,6 +281,20 @@ void InGame_MenuInit( void ) {
274281
s_ingame.restart.generic.flags |= QMF_GRAYED;
275282
}
276283

284+
y += INGAME_MENU_VERTICAL_SPACING;
285+
s_ingame.startnew.generic.type = MTYPE_PTEXT;
286+
s_ingame.startnew.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
287+
s_ingame.startnew.generic.x = 320;
288+
s_ingame.startnew.generic.y = y;
289+
s_ingame.startnew.generic.id = ID_CREATE;
290+
s_ingame.startnew.generic.callback = InGame_Event;
291+
s_ingame.startnew.string = "START NEW ARENA";
292+
s_ingame.startnew.color = text_big_color;
293+
s_ingame.startnew.style = UI_CENTER|UI_SMALLFONT;
294+
if( !trap_Cvar_VariableValue( "sv_running" ) ) {
295+
s_ingame.startnew.generic.flags |= QMF_GRAYED;
296+
}
297+
277298
y += INGAME_MENU_VERTICAL_SPACING;
278299
s_ingame.resume.generic.type = MTYPE_PTEXT;
279300
s_ingame.resume.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
@@ -315,6 +336,7 @@ void InGame_MenuInit( void ) {
315336
Menu_AddItem( &s_ingame.menu, &s_ingame.setup );
316337
Menu_AddItem( &s_ingame.menu, &s_ingame.server );
317338
Menu_AddItem( &s_ingame.menu, &s_ingame.restart );
339+
Menu_AddItem( &s_ingame.menu, &s_ingame.startnew );
318340
Menu_AddItem( &s_ingame.menu, &s_ingame.resume );
319341
Menu_AddItem( &s_ingame.menu, &s_ingame.leave );
320342
Menu_AddItem( &s_ingame.menu, &s_ingame.quit );

0 commit comments

Comments
 (0)