-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg_menu.cpp
1268 lines (1053 loc) · 41 KB
/
g_menu.cpp
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) ZeniMax Media Inc.
// Licensed under the GNU General Public License 2.0.
#include "g_local.h"
#include "monsters/m_player.h"
#include <assert.h>
constexpr const char *BREAKER = "\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37";
bool Vote_Menu_Active(gentity_t *ent) {
if (level.vote_time <= 0_sec)
return false;
if (!level.vote_client)
return false;
if (ent->client->pers.voted)
return false;
return true;
}
static void G_Menu_SetHostName(menu_t *p) {
Q_strlcpy(p->text, hostname->string, sizeof(p->text));
}
static void G_Menu_SetGamemodName(menu_t *p) {
Q_strlcpy(p->text, level.gamemod_name, sizeof(p->text));
}
static void G_Menu_SetLevelName(menu_t *p) {
static char levelname[33];
levelname[0] = '*';
if (g_entities[0].message)
Q_strlcpy(levelname + 1, g_entities[0].message, sizeof(levelname) - 1);
else
Q_strlcpy(levelname + 1, level.mapname, sizeof(levelname) - 1);
levelname[sizeof(levelname) - 1] = 0;
Q_strlcpy(p->text, levelname, sizeof(p->text));
}
/*----------------------------------------------------------------------------------*/
/* ADMIN */
void G_Menu_ReturnToMain(gentity_t *ent, menu_hnd_t *p);
struct admin_settings_t {
int timelimit;
bool weaponsstay;
bool instantitems;
bool pu_drop;
bool instantweap;
bool match_lock;
};
void G_Menu_Admin_UpdateSettings(gentity_t *ent, menu_hnd_t *setmenu);
void G_Menu_Admin(gentity_t *ent, menu_hnd_t *p);
static void G_Menu_Admin_SettingsApply(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
if (settings->timelimit != timelimit->integer) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} changed the timelimit to {} minutes.\n",
ent->client->resp.netname, settings->timelimit);
gi.cvar_set("timelimit", G_Fmt("{}", settings->timelimit).data());
}
if (settings->weaponsstay != !!g_dm_weapons_stay->integer) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} turned {} weapons stay.\n",
ent->client->resp.netname, settings->weaponsstay ? "on" : "off");
gi.cvar_set("g_dm_weapons_stay", settings->weaponsstay ? "1" : "0");
}
if (settings->instantitems != !!g_dm_instant_items->integer) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} turned {} instant items.\n",
ent->client->resp.netname, settings->instantitems ? "on" : "off");
gi.cvar_set("g_dm_instant_items", settings->instantitems ? "1" : "0");
}
if (settings->pu_drop != (bool)g_dm_powerup_drop->integer) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} turned {} powerup dropping.\n",
ent->client->resp.netname, settings->pu_drop ? "on" : "off");
gi.cvar_set("g_dm_powerup_drop", settings->pu_drop ? "1" : "0");
}
if (settings->instantweap != !!(g_instant_weapon_switch->integer || g_frenzy->integer)) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} turned {} instant weapon switch.\n",
ent->client->resp.netname, settings->instantweap ? "on" : "off");
gi.cvar_set("g_instant_weapon_switch", settings->instantweap ? "1" : "0");
}
if (settings->match_lock != !!g_match_lock->integer) {
gi.LocBroadcast_Print(PRINT_HIGH, "{} turned {} match lock.\n",
ent->client->resp.netname, settings->match_lock ? "on" : "off");
gi.cvar_set("g_match_lock", settings->match_lock ? "1" : "0");
}
P_Menu_Close(ent);
G_Menu_Admin(ent, p);
}
static void G_Menu_Admin_SettingsCancel(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
G_Menu_Admin(ent, p);
}
static void G_Menu_Admin_ChangeMatchLen(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->timelimit = (settings->timelimit % 60) + 5;
if (settings->timelimit < 5)
settings->timelimit = 5;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeMatchSetupLen(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeMatchStartLen(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeWeapStay(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->weaponsstay = !settings->weaponsstay;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeInstantItems(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->instantitems = !settings->instantitems;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangePowerupDrop(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->pu_drop = !settings->pu_drop;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeInstantWeap(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->instantweap = !settings->instantweap;
G_Menu_Admin_UpdateSettings(ent, p);
}
static void G_Menu_Admin_ChangeMatchLock(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings = (admin_settings_t *)p->arg;
settings->match_lock = !settings->match_lock;
G_Menu_Admin_UpdateSettings(ent, p);
}
void G_Menu_Admin_UpdateSettings(gentity_t *ent, menu_hnd_t *setmenu) {
int i = 2;
admin_settings_t *settings = (admin_settings_t *)setmenu->arg;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("time limit: {:2} mins", settings->timelimit).data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangeMatchLen);
i++;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("weapons stay: {}", settings->weaponsstay ? "Yes" : "No").data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangeWeapStay);
i++;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("instant items: {}", settings->instantitems ? "Yes" : "No").data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangeInstantItems);
i++;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("powerup drops: {}", settings->pu_drop ? "Yes" : "No").data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangePowerupDrop);
i++;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("instant weapon switch: {}", settings->instantweap ? "Yes" : "No").data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangeInstantWeap);
i++;
P_Menu_UpdateEntry(setmenu->entries + i, G_Fmt("match lock: {}", settings->match_lock ? "Yes" : "No").data(), MENU_ALIGN_LEFT, G_Menu_Admin_ChangeMatchLock);
i++;
P_Menu_Update(ent);
}
const menu_t def_setmenu[] = {
{ "*Settings Menu", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr }, // int timelimit;
{ "", MENU_ALIGN_LEFT, nullptr }, // bool weaponsstay;
{ "", MENU_ALIGN_LEFT, nullptr }, // bool instantitems;
{ "", MENU_ALIGN_LEFT, nullptr }, // bool pu_drop;
{ "", MENU_ALIGN_LEFT, nullptr }, // bool instantweap;
{ "", MENU_ALIGN_LEFT, nullptr }, // bool g_match_lock;
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
static void G_Menu_Admin_Settings(gentity_t *ent, menu_hnd_t *p) {
admin_settings_t *settings;
menu_hnd_t *menu;
P_Menu_Close(ent);
settings = (admin_settings_t *)gi.TagMalloc(sizeof(*settings), TAG_LEVEL);
settings->timelimit = timelimit->integer;
settings->weaponsstay = g_dm_weapons_stay->integer;
settings->instantitems = g_dm_instant_items->integer;
settings->pu_drop = !!g_dm_powerup_drop->integer;
settings->instantweap = g_instant_weapon_switch->integer != 0;
settings->match_lock = g_match_lock->integer != 0;
menu = P_Menu_Open(ent, def_setmenu, -1, sizeof(def_setmenu) / sizeof(menu_t), settings, nullptr);
G_Menu_Admin_UpdateSettings(ent, menu);
}
static void G_Menu_Admin_MatchSet(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
if (level.match_state <= matchst_t::MATCH_COUNTDOWN) {
gi.LocBroadcast_Print(PRINT_CHAT, "Match has been forced to start.\n");
Match_Start();
} else if (level.match_state == matchst_t::MATCH_IN_PROGRESS) {
gi.LocBroadcast_Print(PRINT_CHAT, "Match has been forced to terminate.\n");
Match_Reset();
}
}
static void G_Menu_Admin_Cancel(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
}
menu_t adminmenu[] = {
{ "*Administration Menu", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Settings", MENU_ALIGN_LEFT, G_Menu_Admin_Settings },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
void G_Menu_Admin(gentity_t *ent, menu_hnd_t *p) {
adminmenu[3].text[0] = '\0';
adminmenu[3].SelectFunc = nullptr;
adminmenu[4].text[0] = '\0';
adminmenu[4].SelectFunc = nullptr;
if (level.match_state <= matchst_t::MATCH_COUNTDOWN) {
Q_strlcpy(adminmenu[3].text, "Force start match", sizeof(adminmenu[3].text));
adminmenu[3].SelectFunc = G_Menu_Admin_MatchSet;
} else if (level.match_state == matchst_t::MATCH_IN_PROGRESS) {
Q_strlcpy(adminmenu[3].text, "Reset match", sizeof(adminmenu[3].text));
adminmenu[3].SelectFunc = G_Menu_Admin_MatchSet;
}
P_Menu_Close(ent);
P_Menu_Open(ent, adminmenu, -1, sizeof(adminmenu) / sizeof(menu_t), nullptr, nullptr);
}
/*-----------------------------------------------------------------------*/
const menu_t pmstatsmenu[] = {
{ "Player Match Stats", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
static void G_Menu_PMStats_Update(gentity_t *ent) {
if (!g_matchstats->integer) return;
menu_t *entries = ent->client->menu->entries;
client_match_stats_t *st = &ent->client->mstats;
int i = 0;
char value[MAX_INFO_VALUE] = { 0 };
gi.Info_ValueForKey(g_entities[1].client->pers.userinfo, "name", value, sizeof(value));
Q_strlcpy(entries[i].text, "Player Stats for Match", sizeof(entries[i].text));
i++;
if (value[0]) {
Q_strlcpy(entries[i].text, G_Fmt("{}", value).data(), sizeof(entries[i].text));
i++;
}
Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, G_Fmt("kills: {}", st->total_kills).data(), sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, G_Fmt("deaths: {}", st->total_deaths).data(), sizeof(entries[i].text));
i++;
if (st->total_kills) {
float val = st->total_kills > 0 ? ((float)st->total_kills / (float)st->total_deaths) : 0;
Q_strlcpy(entries[i].text, G_Fmt("k/d ratio: {:2}", val).data(), sizeof(entries[i].text));
i++;
}
i++;
Q_strlcpy(entries[i].text, G_Fmt("dmg dealt: {}", st->total_dmg_dealt).data(), sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, G_Fmt("dmg received: {}", st->total_dmg_received).data(), sizeof(entries[i].text));
i++;
if (st->total_dmg_dealt) {
float val = st->total_dmg_dealt ? ((float)st->total_dmg_dealt / (float)st->total_dmg_received) : 0;
Q_strlcpy(entries[i].text, G_Fmt("dmg ratio: {:02}", val).data(), sizeof(entries[i].text));
i++;
}
i++;
Q_strlcpy(entries[i].text, G_Fmt("shots fired: {}", st->total_shots).data(), sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, G_Fmt("shots on target: {}", st->total_hits).data(), sizeof(entries[i].text));
i++;
if (st->total_hits) {
int val = st->total_hits ? ((float)st->total_hits / (float)st->total_shots) * 100. : 0;
Q_strlcpy(entries[i].text, G_Fmt("total accuracy: {}%", val).data(), sizeof(entries[i].text));
i++;
}
}
static void G_Menu_PMStats(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
P_Menu_Open(ent, pmstatsmenu, -1, sizeof(pmstatsmenu) / sizeof(menu_t), nullptr, G_Menu_PMStats_Update);
}
/*-----------------------------------------------------------------------*/
static const int cvmenu_map = 3;
static const int cvmenu_nextmap = 4;
static const int cvmenu_restart = 5;
static const int cvmenu_timelimit = 6;
static const int cvmenu_scorelimit = 7;
static const int cvmenu_shuffle = 8;
static const int cvmenu_balance = 9;
static const int cvmenu_unlagged = 10;
static const int cvmenu_cointoss = 11;
static const int cvmenu_random = 12;
void G_Menu_CallVote_Map(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_NextMap(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_Restart(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_TimeLimit_Update(gentity_t *ent);
void G_Menu_CallVote_TimeLimit(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_ScoreLimit(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_ShuffleTeams(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_BalanceTeams(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_Unlagged(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_Cointoss(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_Random(gentity_t *ent, menu_hnd_t *p);
void G_Menu_CallVote_Map_Selection(gentity_t *ent, menu_hnd_t *p);
const menu_t pmcallvotemenu[] = {
{ "Call a Vote", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "change map", MENU_ALIGN_LEFT, G_Menu_CallVote_Map },
{ "go to next map", MENU_ALIGN_LEFT, G_Menu_CallVote_NextMap },
{ "restart match", MENU_ALIGN_LEFT, G_Menu_CallVote_Restart },
{ "change time limit", MENU_ALIGN_LEFT, G_Menu_CallVote_TimeLimit },
{ "change score limit", MENU_ALIGN_LEFT, G_Menu_CallVote_ScoreLimit },
{ "shuffle teams", MENU_ALIGN_LEFT, G_Menu_CallVote_ShuffleTeams },
{ "balance teams", MENU_ALIGN_LEFT, G_Menu_CallVote_BalanceTeams },
{ "lag compensation", MENU_ALIGN_LEFT, G_Menu_CallVote_Unlagged },
{ "generate heads/tails", MENU_ALIGN_LEFT, G_Menu_CallVote_Cointoss },
{ "generate random number", MENU_ALIGN_LEFT, G_Menu_CallVote_Random },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
const menu_t pmcallvotemenu_map[] = {
{ "Choose a Map", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection },
{ "", MENU_ALIGN_LEFT, G_Menu_CallVote_Map_Selection }
};
const menu_t pmcallvotemenu_timelimit[] = {
{ "Select Time Limit (mins)", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "5", MENU_ALIGN_LEFT, nullptr },
{ "10", MENU_ALIGN_LEFT, nullptr },
{ "15", MENU_ALIGN_LEFT, nullptr },
{ "20", MENU_ALIGN_LEFT, nullptr },
{ "25", MENU_ALIGN_LEFT, nullptr },
{ "30", MENU_ALIGN_LEFT, nullptr },
{ "35", MENU_ALIGN_LEFT, nullptr },
{ "40", MENU_ALIGN_LEFT, nullptr },
{ "45", MENU_ALIGN_LEFT, nullptr },
{ "50", MENU_ALIGN_LEFT, nullptr },
{ "55", MENU_ALIGN_LEFT, nullptr },
{ "60", MENU_ALIGN_LEFT, nullptr },
{ "120", MENU_ALIGN_LEFT, nullptr },
{ "150", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
void G_Menu_CallVote_Map_Selection(gentity_t *ent, menu_hnd_t *p) {
vcmds_t *cc = FindVoteCmdByName("map");
level.vote = cc;
level.vote_arg = std::string("q2dm1"); //TODO: store selected map name for use here
VoteCommandStore(ent);
P_Menu_Close(ent);
}
inline std::vector<std::string> str_split(const std::string_view &str, char by) {
std::vector<std::string> out;
size_t start, end = 0;
while ((start = str.find_first_not_of(by, end)) != std::string_view::npos) {
end = str.find(by, start);
out.push_back(std::string{ str.substr(start, end - start) });
}
return out;
}
static void G_Menu_CallVote_Map_Update(gentity_t *ent) {
menu_t *entries = ent->client->menu->entries;
int i = 2;
size_t num = 0;
auto values = str_split(g_map_list->string, ' ');
if (!values.size())
return;
for (i = 2; i < 15; i++)
entries[i].SelectFunc = nullptr;
for (num = 0, i = 2; num < values.size(), num < 15; num++, i++) {
Q_strlcpy(entries[i].text, values[num].c_str(), sizeof(entries[i].text));
entries[i].SelectFunc = G_Menu_CallVote_Map_Selection;
}
}
void G_Menu_CallVote_Map(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
P_Menu_Open(ent, pmcallvotemenu_map, -1, sizeof(pmcallvotemenu_map) / sizeof(menu_t), nullptr, G_Menu_CallVote_Map_Update);
}
void G_Menu_CallVote_NextMap(gentity_t *ent, menu_hnd_t *p) {
level.vote = FindVoteCmdByName("nextmap");
level.vote_arg = nullptr;
VoteCommandStore(ent);
P_Menu_Close(ent);
}
void G_Menu_CallVote_Restart(gentity_t *ent, menu_hnd_t *p) {
level.vote = FindVoteCmdByName("restart");
level.vote_arg = nullptr;
VoteCommandStore(ent);
P_Menu_Close(ent);
}
void G_Menu_CallVote_TimeLimit_Update(gentity_t *ent) {
level.vote_arg = nullptr;
}
void G_Menu_CallVote_TimeLimit(gentity_t *ent, menu_hnd_t *p) {
//level.vote = FindVoteCmdByName("timelimit");
//level.vote_arg = nullptr;
//VoteCommandStore(ent);
P_Menu_Close(ent);
P_Menu_Open(ent, pmcallvotemenu_timelimit, -1, sizeof(pmcallvotemenu_timelimit) / sizeof(menu_t), nullptr, G_Menu_CallVote_TimeLimit_Update);
}
void G_Menu_CallVote_ScoreLimit(gentity_t *ent, menu_hnd_t *p) {
}
void G_Menu_CallVote_ShuffleTeams(gentity_t *ent, menu_hnd_t *p) {
level.vote = FindVoteCmdByName("shuffle");
level.vote_arg = nullptr;
VoteCommandStore(ent);
P_Menu_Close(ent);
}
void G_Menu_CallVote_BalanceTeams(gentity_t *ent, menu_hnd_t *p) {
level.vote = FindVoteCmdByName("balance");
level.vote_arg = nullptr;
VoteCommandStore(ent);
P_Menu_Close(ent);
}
void G_Menu_CallVote_Unlagged(gentity_t *ent, menu_hnd_t *p) {
}
void G_Menu_CallVote_Cointoss(gentity_t *ent, menu_hnd_t *p) {
level.vote = FindVoteCmdByName("cointoss");
level.vote_arg = nullptr;
VoteCommandStore(ent);
P_Menu_Close(ent);
}
void G_Menu_CallVote_Random(gentity_t *ent, menu_hnd_t *p) {
}
static void G_Menu_CallVote_Update(gentity_t *ent) {
menu_t *entries = ent->client->menu->entries;
int i = 0;
Q_strlcpy(entries[i].text, "Call a Vote", sizeof(entries[i].text));
i++;
i++;
}
static void G_Menu_CallVote(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
P_Menu_Open(ent, pmcallvotemenu, -1, sizeof(pmcallvotemenu) / sizeof(menu_t), nullptr, G_Menu_CallVote_Update);
}
/*-----------------------------------------------------------------------*/
static void G_Menu_Vote_Yes(gentity_t *ent, menu_hnd_t *p) {
level.vote_yes++;
ent->client->pers.voted = 1;
gi.LocClient_Print(ent, PRINT_HIGH, "Vote cast.\n");
P_Menu_Close(ent);
}
static void G_Menu_Vote_No(gentity_t *ent, menu_hnd_t *p) {
level.vote_no++;
ent->client->pers.voted = -1;
gi.LocClient_Print(ent, PRINT_HIGH, "Vote cast.\n");
P_Menu_Close(ent);
}
const menu_t votemenu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "Voting Menu", MENU_ALIGN_CENTER, nullptr }, //x called a vote
{ "", MENU_ALIGN_CENTER, nullptr },
{ "none", MENU_ALIGN_CENTER, nullptr }, //vote type, eg: map q2dm1
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "[ YES ]", MENU_ALIGN_CENTER, G_Menu_Vote_Yes }, // GET READY TO VOTE... / vote yes
{ "[ NO ]", MENU_ALIGN_CENTER, G_Menu_Vote_No }, // COUNTDOWN... / vote no
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "30", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr }
};
static void G_Menu_Vote_Update(gentity_t *ent) {
if (!Vote_Menu_Active(ent)) {
P_Menu_Close(ent);
return;
}
int timeout = 30 - (level.time - level.vote_time).seconds<int>();
if (timeout <= 0) {
P_Menu_Close(ent);
return;
}
menu_t *entries = ent->client->menu->entries;
int i = 2;
Q_strlcpy(entries[i].text, G_Fmt("{} called a vote:", level.vote_client->resp.netname).data(), sizeof(entries[i].text));
i = 4;
Q_strlcpy(entries[i].text, G_Fmt("{} {}", level.vote->name, level.vote_arg).data(), sizeof(entries[i].text));
if (level.vote_time + 3_sec > level.time) {
i = 7;
Q_strlcpy(entries[i].text, "GET READY TO VOTE!", sizeof(entries[i].text));
entries[i].SelectFunc = nullptr;
i = 8;
int time = 3 - (level.time - level.vote_time).seconds<int>();
Q_strlcpy(entries[i].text, G_Fmt("{}...", time).data(), sizeof(entries[i].text));
entries[i].SelectFunc = nullptr;
return;
}
i = 7;
Q_strlcpy(entries[i].text, "[ YES ]", sizeof(entries[i].text));
entries[i].SelectFunc = G_Menu_Vote_Yes;
i = 8;
Q_strlcpy(entries[i].text, "[ NO ]", sizeof(entries[i].text));
entries[i].SelectFunc = G_Menu_Vote_No;
i = 16;
Q_strlcpy(entries[i].text, G_Fmt("{}", timeout).data(), sizeof(entries[i].text));
}
void G_Menu_Vote_Open(gentity_t *ent) {
P_Menu_Open(ent, votemenu, -1, sizeof(votemenu) / sizeof(menu_t), nullptr, G_Menu_Vote_Update);
}
/*-----------------------------------------------------------------------*/
static void G_Menu_Join_Team_Free(gentity_t *ent, menu_hnd_t *p) {
SetTeam(ent, TEAM_FREE, false, false, false);
}
static void G_Menu_Join_Team_Red(gentity_t *ent, menu_hnd_t *p) {
SetTeam(ent, !g_teamplay_allow_team_pick->integer ? PickTeam(-1) : TEAM_SOLDIERS, false, false, false);
}
static void G_Menu_Join_Team_Blue(gentity_t *ent, menu_hnd_t *p) {
if (!g_teamplay_allow_team_pick->integer)
return;
SetTeam(ent, TEAM_PREDATOR, false, false, false);
}
static void G_Menu_Join_Team_Spec(gentity_t *ent, menu_hnd_t *p) {
SetTeam(ent, TEAM_SPECTATOR, false, false, false);
}
void G_Menu_ReturnToMain(gentity_t *ent, menu_hnd_t *p);
void G_Menu_ChaseCam(gentity_t *ent, menu_hnd_t *p);
void G_Menu_HostInfo(gentity_t *ent, menu_hnd_t *p);
void G_Menu_ServerInfo(gentity_t *ent, menu_hnd_t *p);
static const int jmenu_hostname = 0;
static const int jmenu_level = 1;
static const int jmenu_match = 2;
static const int jmenu_teams_join_red = 5;
static const int jmenu_teams_join_blue = 6;
static const int jmenu_teams_spec = 7;
static const int jmenu_teams_chase = 8;
static const int jmenu_teams_hostinfo = 10;
static const int jmenu_teams_svinfo = 11;
static const int jmenu_teams_player = 12;
static const int jmenu_teams_callvote = 13;
static const int jmenu_teams_admin = 14;
static const int jmenu_free_join = 5;
static const int jmenu_free_spec = 7;
static const int jmenu_free_chase = 8;
static const int jmenu_free_hostinfo = 10;
static const int jmenu_free_svinfo = 11;
static const int jmenu_free_player = 12;
static const int jmenu_free_callvote = 13;
static const int jmenu_free_admin = 14;
static const int jmenu_gamemod = 16;
static const int jmenu_notice = 17;
const menu_t teams_join_menu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "$g_pc_join_red_team", MENU_ALIGN_LEFT, G_Menu_Join_Team_Red },
{ "$g_pc_join_blue_team", MENU_ALIGN_LEFT, G_Menu_Join_Team_Blue },
{ "Spectate", MENU_ALIGN_LEFT, G_Menu_Join_Team_Spec },
{ "$g_pc_chase_camera", MENU_ALIGN_LEFT, G_Menu_ChaseCam },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Host Info", MENU_ALIGN_LEFT, G_Menu_HostInfo },
{ "Match Info", MENU_ALIGN_LEFT, G_Menu_ServerInfo },
//{ "Game Rules", MENU_ALIGN_LEFT, G_Menu_GameRules },
{ "Player Stats", MENU_ALIGN_LEFT, G_Menu_PMStats },
//{ "Call a Vote", MENU_ALIGN_LEFT, G_Menu_CallVote },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Admin", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr }
};
const menu_t free_join_menu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Join Game", MENU_ALIGN_LEFT, G_Menu_Join_Team_Free },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Spectate", MENU_ALIGN_LEFT, G_Menu_Join_Team_Spec },
{ "$g_pc_chase_camera", MENU_ALIGN_LEFT, G_Menu_ChaseCam },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "Host Info", MENU_ALIGN_LEFT, G_Menu_HostInfo },
{ "Match Info", MENU_ALIGN_LEFT, G_Menu_ServerInfo },
//{ "Game Rules", MENU_ALIGN_LEFT, G_Menu_GameRules },
{ "Player Stats", MENU_ALIGN_LEFT, G_Menu_PMStats },
//{ "Call a Vote", MENU_ALIGN_LEFT, G_Menu_CallVote },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "Admin", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr }
};
const menu_t nochasemenu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "$g_pc_no_chase", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
const menu_t hostinfomenu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_CENTER, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
const menu_t svinfomenu[] = {
{ "", MENU_ALIGN_CENTER, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "", MENU_ALIGN_LEFT, nullptr },
{ "$g_pc_return", MENU_ALIGN_LEFT, G_Menu_ReturnToMain }
};
static void G_Menu_NoChaseCamUpdate(gentity_t *ent) {
menu_t *entries = ent->client->menu->entries;
G_Menu_SetGamemodName(&entries[jmenu_gamemod]);
G_Menu_SetLevelName(&entries[jmenu_level]);
}
void G_Menu_ChaseCam(gentity_t *ent, menu_hnd_t *p) {
SetTeam(ent, TEAM_SPECTATOR, false, false, false);
if (ent->client->follow_target) {
FreeFollower(ent);
P_Menu_Close(ent);
return;
}
GetFollowTarget(ent);
P_Menu_Close(ent);
P_Menu_Open(ent, nochasemenu, -1, sizeof(nochasemenu) / sizeof(menu_t), nullptr, G_Menu_NoChaseCamUpdate);
}
void G_Menu_ReturnToMain(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
G_Menu_Join_Open(ent);
gi.local_sound(ent, CHAN_AUTO, gi.soundindex("misc/menu3.wav"), 1, ATTN_NONE, 0);
}
static void G_Menu_HostInfo_Update(gentity_t *ent) {
menu_t *entries = ent->client->menu->entries;
int i = 0;
bool limits = false;
if (hostname->string[0]) {
Q_strlcpy(entries[i].text, "Server Name:", sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, hostname->string, sizeof(entries[i].text));
i++;
i++;
}
if (g_entities[1].client) {
char value[MAX_INFO_VALUE] = { 0 };
gi.Info_ValueForKey(g_entities[1].client->pers.userinfo, "name", value, sizeof(value));
if (value[0]) {
Q_strlcpy(entries[i].text, "Host:", sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, value, sizeof(entries[i].text));
i++;
i++;
}
}
if (game.motd.size()) {
Q_strlcpy(entries[i].text, "Message of the Day:", sizeof(entries[i].text));
i++;
// 26 char line width
// 9 lines
// = 234
Q_strlcpy(entries[i].text, G_Fmt("{}", game.motd.c_str()).data(), sizeof(entries[i].text));
}
}
void G_Menu_HostInfo(gentity_t *ent, menu_hnd_t *p) {
P_Menu_Close(ent);
P_Menu_Open(ent, hostinfomenu, -1, sizeof(hostinfomenu) / sizeof(menu_t), nullptr, G_Menu_HostInfo_Update);
}
static void G_Menu_ServerInfo_Update(gentity_t *ent) {
menu_t *entries = ent->client->menu->entries;
int i = 0;
bool limits = false;
bool infiniteammo = InfiniteAmmoOn(nullptr);
bool items = ItemSpawnsEnabled();
int scorelimit = GT_ScoreLimit();
Q_strlcpy(entries[i].text, "Match Info", sizeof(entries[i].text));
i++;
Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text));
i++;
i++;
if (level.level_name[0]) {
Q_strlcpy(entries[i].text, G_Fmt("map: {}", level.level_name).data(), sizeof(entries[i].text));
i++;
}
if (level.mapname[0]) {
Q_strlcpy(entries[i].text, G_Fmt("mapname: {}", level.mapname).data(), sizeof(entries[i].text));
i++;
}
if (level.author[0]) {
Q_strlcpy(entries[i].text, G_Fmt("author: {}", level.author).data(), sizeof(entries[i].text));
i++;
}
if (level.author2[0] && level.author[0]) {
Q_strlcpy(entries[i].text, G_Fmt(" {}", level.author2).data(), sizeof(entries[i].text));
i++;
}
Q_strlcpy(entries[i].text, G_Fmt("ruleset: {}", rs_long_name[(int)game.ruleset]).data(), sizeof(entries[i].text));
i++;
if (scorelimit) {
Q_strlcpy(entries[i].text, G_Fmt("{} limit: {}", GT_ScoreLimitString(), scorelimit).data(), sizeof(entries[i].text));
i++;
limits = true;
}
if (timelimit->value > 0) {
Q_strlcpy(entries[i].text, G_Fmt("time limit: {}", G_TimeString(timelimit->value * 60000, false)).data(), sizeof(entries[i].text));
i++;
limits = true;
}
if (limits) {
Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text));
i++;
}
if (g_instagib->integer) {
if (g_instagib_splash->integer) {
Q_strlcpy(entries[i].text, "InstaGib + Rail Splash", sizeof(entries[i].text));
} else {
Q_strlcpy(entries[i].text, "InstaGib", sizeof(entries[i].text));
}
i++;
}
if (g_vampiric_damage->integer) {
Q_strlcpy(entries[i].text, "Vampiric Damage", sizeof(entries[i].text));
i++;
}
if (g_frenzy->integer) {
Q_strlcpy(entries[i].text, "Weapons Frenzy", sizeof(entries[i].text));
i++;
}
if (g_nadefest->integer) {
Q_strlcpy(entries[i].text, "Nade Fest", sizeof(entries[i].text));
i++;
}
if (g_quadhog->integer) {
Q_strlcpy(entries[i].text, "Quad Hog", sizeof(entries[i].text));
i++;
}
Q_strlcpy(entries[i].text, BREAKER, sizeof(entries[i].text));
i++;
if (items) {
if (g_dm_weapons_stay->integer) {
Q_strlcpy(entries[i].text, "weapons stay", sizeof(entries[i].text));
i++;
} else {
if (g_weapon_respawn_time->integer != 30) {
Q_strlcpy(entries[i].text, G_Fmt("weapon respawn delay: {}", g_weapon_respawn_time->integer).data(), sizeof(entries[i].text));
i++;
}
}
}
if (g_infinite_ammo->integer && !infiniteammo) {
Q_strlcpy(entries[i].text, "infinite ammo", sizeof(entries[i].text));
i++;
}
if (Teams() && g_friendly_fire->integer) {
Q_strlcpy(entries[i].text, "friendly fire", sizeof(entries[i].text));
i++;
}
if (g_allow_grapple->integer) {
if (i >= 16) return;
Q_strlcpy(entries[i].text, G_Fmt("{}grapple enabled", g_grapple_offhand->integer ? "off-hand " : "").data(), sizeof(entries[i].text));
i++;
}
if (g_inactivity->integer > 0) {
if (i >= 16) return;
Q_strlcpy(entries[i].text, G_Fmt("inactivity timer: {} sec", g_inactivity->integer).data(), sizeof(entries[i].text));
i++;
}
if (g_teleporter_freeze->integer) {
if (i >= 16) return;
Q_strlcpy(entries[i].text, "teleporter freeze", sizeof(entries[i].text));