From 1c9654686e4b4ab2866292642e2e59e439dddcdc Mon Sep 17 00:00:00 2001 From: NeonKnightOA Date: Thu, 21 Mar 2024 20:29:37 -0300 Subject: [PATCH] Classic UI: Added "Time Between Rounds" for Overload matches (#258) --- code/q3_ui/ui_startserver.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index 1f74568d..80c27af5 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -811,6 +811,9 @@ typedef struct { // Specific for Harvester menuradiobutton_s harvesterFromBodies; + // Specific for Overload + menufield_s overloadRespawnDelay; + // Specific for CTF Elimination (eCTF) menuradiobutton_s oneway; @@ -983,6 +986,9 @@ static void ServerOptions_Start( void ) { // Specific for Harvester int harvesterFromBodies = s_serveroptions.harvesterFromBodies.curvalue; + // Specific for Harvester + int overloadRespawnDelay = atoi( s_serveroptions.overloadRespawnDelay.field.buffer ); + // Specific for CTF Elimination (eCTF) int oneway = s_serveroptions.oneway.curvalue; @@ -1168,6 +1174,7 @@ static void ServerOptions_Start( void ) { trap_Cvar_SetValue( "g_friendlyfire", friendlyfire ); trap_Cvar_SetValue( "elimination_selfdamage", eliminationDamage ); trap_Cvar_SetValue( "g_harvesterFromBodies", harvesterFromBodies ); + trap_Cvar_Set("g_obeliskRespawnDelay", s_serveroptions.overloadRespawnDelay.field.buffer ); trap_Cvar_SetValue( "elimination_ctf_oneway", oneway ); trap_Cvar_SetValue( "g_lms_mode", lmsMode); trap_Cvar_Set("g_lms_lives", s_serveroptions.lmsLives.field.buffer ); @@ -1612,6 +1619,18 @@ static void ServerOptions_StatusBar_harvesterFromBodies( void* ptr ) { UI_DrawString( 320, 460, "rather than a central skull generator.", UI_CENTER|UI_SMALLFONT, colorWhite ); } +/* +================= +ServerOptions_StatusBar_overloadRespawnDelay + +Descriptions should have 48 characters or less per line, and there can't be more than two lines. +================= +*/ +static void ServerOptions_StatusBar_overloadRespawnDelay( void* ptr ) { + UI_DrawString( 320, 440, "Specifies the amount of time between", UI_CENTER|UI_SMALLFONT, colorWhite ); + UI_DrawString( 320, 460, "scoring and the start of the next round.", UI_CENTER|UI_SMALLFONT, colorWhite ); +} + /* ================= ServerOptions_StatusBar_Oneway @@ -2002,6 +2021,7 @@ static void ServerOptions_SetMenuItems( void ) { Q_strncpyz( s_serveroptions.eliminationRoundTime.field.buffer, UI_Cvar_VariableString( "elimination_roundtime" ), sizeof( s_serveroptions.eliminationRoundTime.field.buffer ) ); s_serveroptions.eliminationDamage.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "elimination_selfdamage" ) ); s_serveroptions.harvesterFromBodies.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "g_harvesterFromBodies" ) ); + Q_strncpyz( s_serveroptions.overloadRespawnDelay.field.buffer, UI_Cvar_VariableString( "g_obeliskRespawnDelay" ), sizeof( s_serveroptions.overloadRespawnDelay.field.buffer ) ); s_serveroptions.oneway.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "elimination_ctf_oneway" ) ); s_serveroptions.lmsMode.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue("g_lms_mode") ); Q_strncpyz( s_serveroptions.lmsLives.field.buffer, UI_Cvar_VariableString( "g_lms_lives" ), sizeof( s_serveroptions.lmsLives.field.buffer ) ); @@ -2256,6 +2276,17 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { s_serveroptions.harvesterFromBodies.generic.name = "Skulls From Bodies:"; s_serveroptions.harvesterFromBodies.generic.statusbar = ServerOptions_StatusBar_harvesterFromBodies; } + if( s_serveroptions.gametype == GT_OBELISK ) { + y += BIGCHAR_HEIGHT+2; + s_serveroptions.overloadRespawnDelay.generic.type = MTYPE_FIELD; + s_serveroptions.overloadRespawnDelay.generic.name = "Time Between Rounds:"; + s_serveroptions.overloadRespawnDelay.generic.flags = QMF_SMALLFONT; + s_serveroptions.overloadRespawnDelay.generic.x = OPTIONS_X; + s_serveroptions.overloadRespawnDelay.generic.y = y; + s_serveroptions.overloadRespawnDelay.field.widthInChars = 3; + s_serveroptions.overloadRespawnDelay.field.maxchars = 3; + s_serveroptions.overloadRespawnDelay.generic.statusbar = ServerOptions_StatusBar_overloadRespawnDelay; + } if( s_serveroptions.gametype == GT_CTF_ELIMINATION) { y += BIGCHAR_HEIGHT+2; s_serveroptions.oneway.generic.type = MTYPE_RADIOBUTTON; @@ -2470,6 +2501,9 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { if( s_serveroptions.gametype == GT_HARVESTER) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.harvesterFromBodies ); } + if( s_serveroptions.gametype == GT_OBELISK) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.overloadRespawnDelay ); + } if( s_serveroptions.gametype == GT_CTF_ELIMINATION) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.oneway ); }