Skip to content

Commit

Permalink
Merge pull request #1320 from drzel/play-to-completion
Browse files Browse the repository at this point in the history
Add play to completion admin option
  • Loading branch information
drzel authored Apr 22, 2024
2 parents 4d9986e + c1a10b3 commit 6d5c820
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ sound files are found in `fortress/sound/hitaudio/` and `fortress/sound/announc
* Website backend for match results, stats. Get a token at fortressone.org, connect to a FortressOne server, and `login <token>`.


* `localinfo play_to_completion 0` set to 1 to allow quad to continue to round end even after required score exceeded.
* `localinfo pipecooldown_time <number>` time in seconds for demo pipe cooldown
* `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)
* `localinfo discord_channel_id <number>` to specify discord_channel. Required for autoreporting.
Expand Down
1 change: 1 addition & 0 deletions csqc/csextradefs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ typedef struct {
float quad_round_time;
float fo_login_required;
float fo_matchrated;
float play_to_completion;
float captainmode;
float timelimit;
float fraglimit;
Expand Down
1 change: 1 addition & 0 deletions csqc/events.qc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ void() CSQC_Parse_Event = {
SERVER_ADMIN.quad_round_time = readfloat();
SERVER_ADMIN.fo_login_required = readfloat();
SERVER_ADMIN.fo_matchrated = readfloat();
SERVER_ADMIN.play_to_completion = readfloat();
SERVER_ADMIN.timelimit = readfloat();
SERVER_ADMIN.fraglimit = readfloat();
SERVER_ADMIN.clanmode = readfloat();
Expand Down
28 changes: 25 additions & 3 deletions csqc/menu.qc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ void (float force) FO_Menu_Admin_Timelimit;
void (float force) FO_Menu_Admin_Fraglimit;
void (float force) FO_Menu_Admin_QuadTimelimit;
void (float force) FO_Menu_Admin_FoMatchRated;
void (float force) FO_Menu_Admin_PlayToCompletion;
void (float force) FO_Menu_Admin_NewBalance;
void (float force) FO_Menu_Spy;
void (float force) FO_Menu_Spy_Skin;
Expand Down Expand Up @@ -443,6 +444,7 @@ var fo_menu FO_MENU_ADMIN_MODES = {
{"7","Rated/Unrated","","Will player ratings be affected?",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_FoMatchRated(TRUE);},MENU_BORDER_WARNING},
{"8","New Balance","","New Balance Test",FO_MENU_STATE_NORMAL,{localcmd("cmd new_balance");},MENU_BORDER_WARNING},
{"9","Force Start","","Skip prematch and start the game\nPlease use sparingly",FO_MENU_STATE_NORMAL,{localcmd("cmd forcestart\n");},MENU_BORDER_WARNING},
MenuSpacer,
{"0","Close Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();},MENU_BUTTON},
{"+","Next - Settings","","",FO_MENU_STATE_NORMAL,{Menu_Cancel(); FO_Menu_Admin_Settings(TRUE);},MENU_BUTTON},
{"-","Prev - Main","","",FO_MENU_STATE_NORMAL,{Menu_Cancel(); FO_Menu_Admin_Main(TRUE);},MENU_BUTTON},
Expand All @@ -463,9 +465,7 @@ var fo_menu FO_MENU_ADMIN_SETTINGS = {
{"2","Fraglimit","","",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_Fraglimit(TRUE);},MENU_BORDER_WARNING},
{"3","Quad Rounds...","","Number of rounds in Quad mode. Usually 2",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_Rounds(TRUE);},MENU_BORDER_WARNING},
{"4","Quad Round Time...","","Round time for each quad round",FO_MENU_STATE_NORMAL,{FO_Menu_Admin_QuadTimelimit(TRUE);},MENU_BORDER_WARNING},
MenuSpacer,
MenuSpacer,
MenuSpacer,
{"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},
MenuSpacer,
MenuSpacer,
MenuSpacer,
Expand All @@ -479,6 +479,7 @@ var fo_menu FO_MENU_ADMIN_SETTINGS = {
FO_MENU_ADMIN_SETTINGS.options[1].value = ftos(SERVER_ADMIN.fraglimit);
FO_MENU_ADMIN_SETTINGS.options[2].value = ftos(SERVER_ADMIN.quad_rounds);
FO_MENU_ADMIN_SETTINGS.options[3].value = ftos(SERVER_ADMIN.quad_round_time);
FO_MENU_ADMIN_SETTINGS.options[4].value = modeStatus(SERVER_ADMIN.play_to_completion);
}
};
var void execute_admin_players(float choice, float page) {
Expand Down Expand Up @@ -620,6 +621,20 @@ var fo_menu FO_MENU_ADMIN_QUAD_TIMELIMIT = {
{"0","Back to Main Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();FO_Menu_Admin_Modes(TRUE);},MENU_BUTTON},
}, 11, TRUE
};
var fo_menu FO_MENU_ADMIN_PLAY_TO_COMPLETION = {
[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, {
{"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},
{"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},
MenuSpacer,
MenuSpacer,
MenuSpacer,
MenuSpacer,
MenuSpacer,
MenuSpacer,
MenuSpacer,
{"0","Back to Main Menu","","",FO_MENU_STATE_NORMAL,{Menu_Cancel();FO_Menu_Admin_Modes(TRUE);},MENU_BUTTON},
}, 10, TRUE
};
var fo_menu FO_MENU_ADMIN_MATCH_RATED = {
[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, {
{"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},
Expand Down Expand Up @@ -1215,6 +1230,12 @@ void FO_Menu_Admin_QuadTimelimit(float force) = {
CurrentMenu = &FO_MENU_ADMIN_QUAD_TIMELIMIT;
fo_hud_menu_active = TRUE;
}
void FO_Menu_Admin_PlayToCompletion(float force) = {
if(fo_hud_menu_active && !force)
return;
CurrentMenu = &FO_MENU_ADMIN_PLAY_TO_COMPLETION;
fo_hud_menu_active = TRUE;
}
void FO_Menu_Admin_FoMatchRated(float force) = {
if(fo_hud_menu_active && !force)
return;
Expand Down Expand Up @@ -1401,6 +1422,7 @@ void FO_Hud_Init() {
INIT_MENU_IDS(FO_MENU_ADMIN_ROUNDS);
INIT_MENU_IDS(FO_MENU_ADMIN_QUAD_TIMELIMIT);
INIT_MENU_IDS(FO_MENU_ADMIN_MATCH_RATED);
INIT_MENU_IDS(FO_MENU_ADMIN_PLAY_TO_COMPLETION);
INIT_MENU_IDS(FO_MENU_ADMIN_TIMELIMIT);
INIT_MENU_IDS(FO_MENU_ADMIN_FRAGLIMIT);
INIT_MENU_IDS(FO_MENU_VOTE);
Expand Down
3 changes: 3 additions & 0 deletions ssqc/client.qc
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,9 @@ void () DecodeLevelParms = {

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

// if 1, quad round will not finish immediately if result is determined [off]
play_to_completion = CF_GetSetting("ptc", "play_to_completion", "0");

// enforces login
loginRequired = CF_GetSetting("loginrequired", "logreq", "0");

Expand Down
8 changes: 8 additions & 0 deletions ssqc/commands.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,14 @@ float (string arg1, string arg2, string arg3) ParseCmds = {
UpdateAllAdmins();
}
break;
case "play_to_completion":
if(arg2 != "0" && arg2 != "1")
return;

processedCmd = TRUE;
localcmd ("localinfo play_to_completion ",arg2,"\n");
UpdateAllAdmins();
break;
case "captainmode":
processedCmd = TRUE;
if(arg2 && arg3) {
Expand Down
8 changes: 5 additions & 3 deletions ssqc/csmenu.qc
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,19 @@ void Update_ServerAdminInfo(entity pl) = {
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
return;
msg_entity = pl;
local float cm = CF_GetSetting("c", "clan", "off"),
qm = CF_GetSetting("quadmode", "quadmode", "off"),
local float cm = CF_GetSetting("c", "clan", "off"),
qm = CF_GetSetting("quadmode", "quadmode", "off"),
dm = CF_GetSetting("duelmode", "duelmode", "off"),
flr = CF_GetSetting("flr", "fologinrequired", "off");
flr = CF_GetSetting("flr", "fologinrequired", "off"),
ptc = CF_GetSetting("ptc", "play_to_completion", "off");
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, MSG_SERVER_ADMIN_INFO);
WriteByte(MSG_MULTICAST, is_paused || cease_fire);
WriteFloat(MSG_MULTICAST, infokeyf(world, "rounds"));
WriteFloat(MSG_MULTICAST, infokeyf(world, "round_time"));
WriteFloat(MSG_MULTICAST, (fo_login_required?1:0) + (flr?2:0));
WriteFloat(MSG_MULTICAST, CF_GetSetting("mra", "fo_matchrated", "2"));
WriteFloat(MSG_MULTICAST, (play_to_completion?1:0) + (ptc?2:0));
WriteFloat(MSG_MULTICAST, infokeyf(world, "timelimit"));
WriteFloat(MSG_MULTICAST, infokeyf(world, "fraglimit"));
WriteFloat(MSG_MULTICAST, (clanbattle?1:0) + (cm?2:0));
Expand Down
2 changes: 1 addition & 1 deletion ssqc/quadmode.qc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void () QuadRoundThink = {
local float fl;

if (rounds < 2) {
if (CheckWinningTeam() != 0) {
if (CheckWinningTeam() != 0 && !play_to_completion) {
if (quad_winner != CheckWinningTeam()) {
quad_winner = CheckWinningTeam();
self.think = QuadRoundOver;
Expand Down
1 change: 1 addition & 0 deletions ssqc/qw.qc
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ float round_delay_time;
float round_start_time;
float round_end_time;
float map_restart_time;
float play_to_completion;
float gametime;
float is_countdown;
float duelmode;
Expand Down

0 comments on commit 6d5c820

Please sign in to comment.