Skip to content

Commit 6d5c820

Browse files
authored
Merge pull request #1320 from drzel/play-to-completion
Add play to completion admin option
2 parents 4d9986e + c1a10b3 commit 6d5c820

File tree

9 files changed

+46
-7
lines changed

9 files changed

+46
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ sound files are found in `fortress/sound/hitaudio/` and `fortress/sound/announc
7171
* Website backend for match results, stats. Get a token at fortressone.org, connect to a FortressOne server, and `login <token>`.
7272

7373

74+
* `localinfo play_to_completion 0` set to 1 to allow quad to continue to round end even after required score exceeded.
7475
* `localinfo pipecooldown_time <number>` time in seconds for demo pipe cooldown
7576
* `localinfo allpipes_cooldown on/off` whether cooldown is applied to individual pipes or all pipes. i.e. with this on the demo can not det any of his pipes immediately after firing. (default off)
7677
* `localinfo discord_channel_id <number>` to specify discord_channel. Required for autoreporting.

csqc/csextradefs.qc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ typedef struct {
333333
float quad_round_time;
334334
float fo_login_required;
335335
float fo_matchrated;
336+
float play_to_completion;
336337
float captainmode;
337338
float timelimit;
338339
float fraglimit;

csqc/events.qc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ void() CSQC_Parse_Event = {
267267
SERVER_ADMIN.quad_round_time = readfloat();
268268
SERVER_ADMIN.fo_login_required = readfloat();
269269
SERVER_ADMIN.fo_matchrated = readfloat();
270+
SERVER_ADMIN.play_to_completion = readfloat();
270271
SERVER_ADMIN.timelimit = readfloat();
271272
SERVER_ADMIN.fraglimit = readfloat();
272273
SERVER_ADMIN.clanmode = readfloat();

csqc/menu.qc

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ void (float force) FO_Menu_Admin_Timelimit;
77
void (float force) FO_Menu_Admin_Fraglimit;
88
void (float force) FO_Menu_Admin_QuadTimelimit;
99
void (float force) FO_Menu_Admin_FoMatchRated;
10+
void (float force) FO_Menu_Admin_PlayToCompletion;
1011
void (float force) FO_Menu_Admin_NewBalance;
1112
void (float force) FO_Menu_Spy;
1213
void (float force) FO_Menu_Spy_Skin;
@@ -443,6 +444,7 @@ var fo_menu FO_MENU_ADMIN_MODES = {
443444
{"7","Rated/Unrated","","Will player ratings be affected?",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_FoMatchRated(TRUE);},MENU_BORDER_WARNING},
444445
{"8","New Balance","","New Balance Test",FO_MENU_STATE_NORMAL,{localcmd("cmd new_balance");},MENU_BORDER_WARNING},
445446
{"9","Force Start","","Skip prematch and start the game\nPlease use sparingly",FO_MENU_STATE_NORMAL,{localcmd("cmd forcestart\n");},MENU_BORDER_WARNING},
447+
MenuSpacer,
446448
{"0","Close Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();},MENU_BUTTON},
447449
{"+","Next - Settings","","",FO_MENU_STATE_NORMAL,{Menu_Cancel(); FO_Menu_Admin_Settings(TRUE);},MENU_BUTTON},
448450
{"-","Prev - Main","","",FO_MENU_STATE_NORMAL,{Menu_Cancel(); FO_Menu_Admin_Main(TRUE);},MENU_BUTTON},
@@ -463,9 +465,7 @@ var fo_menu FO_MENU_ADMIN_SETTINGS = {
463465
{"2","Fraglimit","","",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_Fraglimit(TRUE);},MENU_BORDER_WARNING},
464466
{"3","Quad Rounds...","","Number of rounds in Quad mode. Usually 2",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_Rounds(TRUE);},MENU_BORDER_WARNING},
465467
{"4","Quad Round Time...","","Round time for each quad round",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_QuadTimelimit(TRUE);},MENU_BORDER_WARNING},
466-
MenuSpacer,
467-
MenuSpacer,
468-
MenuSpacer,
468+
{"5","Play To Completion","","Play match to end of round even if result decided",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_PlayToCompletion(TRUE);},MENU_BORDER_WARNING},
469469
MenuSpacer,
470470
MenuSpacer,
471471
MenuSpacer,
@@ -479,6 +479,7 @@ var fo_menu FO_MENU_ADMIN_SETTINGS = {
479479
FO_MENU_ADMIN_SETTINGS.options[1].value = ftos(SERVER_ADMIN.fraglimit);
480480
FO_MENU_ADMIN_SETTINGS.options[2].value = ftos(SERVER_ADMIN.quad_rounds);
481481
FO_MENU_ADMIN_SETTINGS.options[3].value = ftos(SERVER_ADMIN.quad_round_time);
482+
FO_MENU_ADMIN_SETTINGS.options[4].value = modeStatus(SERVER_ADMIN.play_to_completion);
482483
}
483484
};
484485
var void execute_admin_players(float choice, float page) {
@@ -620,6 +621,20 @@ var fo_menu FO_MENU_ADMIN_QUAD_TIMELIMIT = {
620621
{"0","Back to Main Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();FO_Menu_Admin_Modes(TRUE);},MENU_BUTTON},
621622
}, 11, TRUE
622623
};
624+
var fo_menu FO_MENU_ADMIN_PLAY_TO_COMPLETION = {
625+
[0,0], [300,200], "Play to completion?", FO_MENU_FLAG_USE_MOUSE | FO_MENU_FLAG_CENTER | FO_MENU_FLAG_SHOW_SHORTCUTS | FO_MENU_FLAG_SHOW_VALUES | FO_MENU_FLAG_WARNING | FO_MENU_FLAG_ALLOW_INTERMISSION, {
626+
{"1","No","","Match will end as soon as the winner is known",FO_MENU_STATE_NORMAL,{localcmd("cmd play_to_completion 0\n");FO_Menu_Admin_Settings(TRUE);},MENU_BORDER_WARNING},
627+
{"2","Yes","","Match will end at the end of the final round",FO_MENU_STATE_NORMAL,{localcmd("cmd play_to_completion 1\n");FO_Menu_Admin_Settings(TRUE);},MENU_BORDER_WARNING},
628+
MenuSpacer,
629+
MenuSpacer,
630+
MenuSpacer,
631+
MenuSpacer,
632+
MenuSpacer,
633+
MenuSpacer,
634+
MenuSpacer,
635+
{"0","Back to Main Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();FO_Menu_Admin_Modes(TRUE);},MENU_BUTTON},
636+
}, 10, TRUE
637+
};
623638
var fo_menu FO_MENU_ADMIN_MATCH_RATED = {
624639
[0,0], [300,200], "Match Rated?", FO_MENU_FLAG_USE_MOUSE | FO_MENU_FLAG_CENTER | FO_MENU_FLAG_SHOW_SHORTCUTS | FO_MENU_FLAG_SHOW_VALUES | FO_MENU_FLAG_WARNING | FO_MENU_FLAG_ALLOW_INTERMISSION, {
625640
{"1","Rated","","Match result will affect player ratings",FO_MENU_STATE_NORMAL,{localcmd("cmd fo_matchrated 1\n");FO_Menu_Admin_Modes(TRUE);},MENU_BORDER_WARNING},
@@ -1215,6 +1230,12 @@ void FO_Menu_Admin_QuadTimelimit(float force) = {
12151230
CurrentMenu = &FO_MENU_ADMIN_QUAD_TIMELIMIT;
12161231
fo_hud_menu_active = TRUE;
12171232
}
1233+
void FO_Menu_Admin_PlayToCompletion(float force) = {
1234+
if(fo_hud_menu_active && !force)
1235+
return;
1236+
CurrentMenu = &FO_MENU_ADMIN_PLAY_TO_COMPLETION;
1237+
fo_hud_menu_active = TRUE;
1238+
}
12181239
void FO_Menu_Admin_FoMatchRated(float force) = {
12191240
if(fo_hud_menu_active && !force)
12201241
return;
@@ -1401,6 +1422,7 @@ void FO_Hud_Init() {
14011422
INIT_MENU_IDS(FO_MENU_ADMIN_ROUNDS);
14021423
INIT_MENU_IDS(FO_MENU_ADMIN_QUAD_TIMELIMIT);
14031424
INIT_MENU_IDS(FO_MENU_ADMIN_MATCH_RATED);
1425+
INIT_MENU_IDS(FO_MENU_ADMIN_PLAY_TO_COMPLETION);
14041426
INIT_MENU_IDS(FO_MENU_ADMIN_TIMELIMIT);
14051427
INIT_MENU_IDS(FO_MENU_ADMIN_FRAGLIMIT);
14061428
INIT_MENU_IDS(FO_MENU_VOTE);

ssqc/client.qc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,9 @@ void () DecodeLevelParms = {
779779

780780
map_restart_time = CF_GetSetting("map_restart_Time", "mrt", "120");
781781

782+
// if 1, quad round will not finish immediately if result is determined [off]
783+
play_to_completion = CF_GetSetting("ptc", "play_to_completion", "0");
784+
782785
// enforces login
783786
loginRequired = CF_GetSetting("loginrequired", "logreq", "0");
784787

ssqc/commands.qc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,14 @@ float (string arg1, string arg2, string arg3) ParseCmds = {
12961296
UpdateAllAdmins();
12971297
}
12981298
break;
1299+
case "play_to_completion":
1300+
if(arg2 != "0" && arg2 != "1")
1301+
return;
1302+
1303+
processedCmd = TRUE;
1304+
localcmd ("localinfo play_to_completion ",arg2,"\n");
1305+
UpdateAllAdmins();
1306+
break;
12991307
case "captainmode":
13001308
processedCmd = TRUE;
13011309
if(arg2 && arg3) {

ssqc/csmenu.qc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,19 @@ void Update_ServerAdminInfo(entity pl) = {
168168
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
169169
return;
170170
msg_entity = pl;
171-
local float cm = CF_GetSetting("c", "clan", "off"),
172-
qm = CF_GetSetting("quadmode", "quadmode", "off"),
171+
local float cm = CF_GetSetting("c", "clan", "off"),
172+
qm = CF_GetSetting("quadmode", "quadmode", "off"),
173173
dm = CF_GetSetting("duelmode", "duelmode", "off"),
174-
flr = CF_GetSetting("flr", "fologinrequired", "off");
174+
flr = CF_GetSetting("flr", "fologinrequired", "off"),
175+
ptc = CF_GetSetting("ptc", "play_to_completion", "off");
175176
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
176177
WriteByte(MSG_MULTICAST, MSG_SERVER_ADMIN_INFO);
177178
WriteByte(MSG_MULTICAST, is_paused || cease_fire);
178179
WriteFloat(MSG_MULTICAST, infokeyf(world, "rounds"));
179180
WriteFloat(MSG_MULTICAST, infokeyf(world, "round_time"));
180181
WriteFloat(MSG_MULTICAST, (fo_login_required?1:0) + (flr?2:0));
181182
WriteFloat(MSG_MULTICAST, CF_GetSetting("mra", "fo_matchrated", "2"));
183+
WriteFloat(MSG_MULTICAST, (play_to_completion?1:0) + (ptc?2:0));
182184
WriteFloat(MSG_MULTICAST, infokeyf(world, "timelimit"));
183185
WriteFloat(MSG_MULTICAST, infokeyf(world, "fraglimit"));
184186
WriteFloat(MSG_MULTICAST, (clanbattle?1:0) + (cm?2:0));

ssqc/quadmode.qc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void () QuadRoundThink = {
388388
local float fl;
389389

390390
if (rounds < 2) {
391-
if (CheckWinningTeam() != 0) {
391+
if (CheckWinningTeam() != 0 && !play_to_completion) {
392392
if (quad_winner != CheckWinningTeam()) {
393393
quad_winner = CheckWinningTeam();
394394
self.think = QuadRoundOver;

ssqc/qw.qc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ float round_delay_time;
470470
float round_start_time;
471471
float round_end_time;
472472
float map_restart_time;
473+
float play_to_completion;
473474
float gametime;
474475
float is_countdown;
475476
float duelmode;

0 commit comments

Comments
 (0)