From 89c48866057c2186c6685fbb8f996d06f9fd4438 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 27 Dec 2023 16:06:59 -0600 Subject: [PATCH] Fix issues and formatting from adding LCS See "NEW GAME MODE: LAST CAR STANDING" commit 227e4013568a31f3fbc914b8035c129866537cc5 --- engine/code/cgame/cg_rally_hud.c | 4 +- engine/code/game/g_active.c | 4 +- engine/code/game/g_combat.c | 2 +- engine/code/game/g_main.c | 29 +-------- engine/code/game/g_rally_racetools.c | 2 +- engine/code/q3_ui/ui_rally_servers.c | 2 +- engine/code/q3_ui/ui_rally_startserver.c | 76 +++++++++++------------- engine/code/q3_ui/ui_startserver.c | 5 +- engine/code/q3_ui/ui_team.c | 5 -- 9 files changed, 46 insertions(+), 83 deletions(-) diff --git a/engine/code/cgame/cg_rally_hud.c b/engine/code/cgame/cg_rally_hud.c index 045edd47..0ac26d59 100644 --- a/engine/code/cgame/cg_rally_hud.c +++ b/engine/code/cgame/cg_rally_hud.c @@ -417,7 +417,7 @@ static float CG_DrawTimes( float y ) { // Best Time // - if ( cgs.gametype != GT_DERBY || cgs.gametype != GT_LCS ){ + if ( cgs.gametype != GT_DERBY && cgs.gametype != GT_LCS ){ time = getStringForTime( cent->bestLapTime ); Com_sprintf(s, sizeof(s), "B: %s", time); @@ -436,7 +436,7 @@ static float CG_DrawTimes( float y ) { - if (cgs.gametype != GT_DERBY || cgs.gametype != GT_LCS ){ + if ( cgs.gametype != GT_DERBY && cgs.gametype != GT_LCS ){ time = getStringForTime(lapTime); Com_sprintf(s, sizeof(s), "L: %s", time); diff --git a/engine/code/game/g_active.c b/engine/code/game/g_active.c index 38fc707c..c622fa97 100644 --- a/engine/code/game/g_active.c +++ b/engine/code/game/g_active.c @@ -1572,7 +1572,7 @@ void ClientThink_real( gentity_t *ent ) { if ( g_forcerespawn.integer > 0 && ( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) { // STONELANCE - if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS || !ent->client->finishRaceTime) + if ((g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS) || !ent->client->finishRaceTime) // END ClientRespawn( ent ); return; @@ -1581,7 +1581,7 @@ void ClientThink_real( gentity_t *ent ) { // pressing attack or use is the normal respawn method if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) { // STONELANCE - if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS || !ent->client->finishRaceTime) + if ((g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS) || !ent->client->finishRaceTime) // END ClientRespawn( ent ); } diff --git a/engine/code/game/g_combat.c b/engine/code/game/g_combat.c index e631234b..c65c9249 100644 --- a/engine/code/game/g_combat.c +++ b/engine/code/game/g_combat.c @@ -530,7 +530,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->client->ps.pm_type = PM_DEAD; // STONELANCE - if (g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS || level.startRaceTime){ + if ((g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS) && level.startRaceTime){ self->client->finishRaceTime = level.time; trap_SendServerCommand( -1, va("raceFinishTime %i %i", self->s.number, self->client->finishRaceTime) ); } diff --git a/engine/code/game/g_main.c b/engine/code/game/g_main.c index 6ce32c96..1a52f691 100644 --- a/engine/code/game/g_main.c +++ b/engine/code/game/g_main.c @@ -926,7 +926,7 @@ int QDECL SortRanks( const void *a, const void *b ) { } } // sort by finish time if derby - else if (g_gametype.integer == GT_DERBY && g_gametype.integer == GT_LCS ){ + else if (g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS ){ if ( ca->finishRaceTime && cb->finishRaceTime ) { if (ca->finishRaceTime < cb->finishRaceTime) return 1; @@ -1705,7 +1705,7 @@ void CheckExitRules( void ) { return; } - + if (g_gametype.integer == GT_LCS && level.startRaceTime && !level.finishRaceTime) { gclient_t *winner = NULL; @@ -1730,31 +1730,6 @@ void CheckExitRules( void ) { return; } - - if (g_gametype.integer == GT_LCS && level.startRaceTime && !level.finishRaceTime) { - gclient_t *winner = NULL; - - for ( i=0, count = 0 ; i< g_maxclients.integer ; i++ ) { - cl = level.clients + i; - if ( cl->pers.connected != CON_CONNECTED ) continue; - if ( cl->sess.sessionTeam == TEAM_SPECTATOR ) continue; - if ( isRaceObserver( cl->ps.clientNum ) ) continue; - if ( cl->ps.stats[STAT_HEALTH] <= 0 ) continue; - - count++; - winner = cl; - } - - if (winner && count == 1) { - level.winnerNumber = winner->ps.clientNum; - level.finishRaceTime = level.time; - - trap_SendServerCommand( -1, va("print \"%s won the last car standing!\n\"", winner->pers.netname )); - trap_SendServerCommand( level.winnerNumber, "cp \"You won the last car standing!\n\""); - } - - return; - } for ( i = 0, count = 0 ; i< g_maxclients.integer ; i++ ) { diff --git a/engine/code/game/g_rally_racetools.c b/engine/code/game/g_rally_racetools.c index 7edd6b99..f30e827b 100644 --- a/engine/code/game/g_rally_racetools.c +++ b/engine/code/game/g_rally_racetools.c @@ -436,7 +436,7 @@ void RallyStarter_Think( gentity_t *ent ){ Rally_Sound( ent, EV_GLOBAL_SOUND, CHAN_ANNOUNCER, G_SoundIndex("sound/rally/race/go.wav") ); - if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS) + if (g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS) ent->think = RallyRace_Think; } else if ( level.time > ent->pain_debounce_time + 4000 ){ diff --git a/engine/code/q3_ui/ui_rally_servers.c b/engine/code/q3_ui/ui_rally_servers.c index d2dd1f22..a76b0685 100644 --- a/engine/code/q3_ui/ui_rally_servers.c +++ b/engine/code/q3_ui/ui_rally_servers.c @@ -200,7 +200,7 @@ static char* gamenames[] = { "Race DM", "SP ", "Derby", - "LCS ", + "LCS", "DM ", "TRace", "TRace DM", diff --git a/engine/code/q3_ui/ui_rally_startserver.c b/engine/code/q3_ui/ui_rally_startserver.c index 7d3dcedc..0cd07c5f 100644 --- a/engine/code/q3_ui/ui_rally_startserver.c +++ b/engine/code/q3_ui/ui_rally_startserver.c @@ -148,7 +148,7 @@ static const char *gametype_items[] = { // STONELANCE // gametype_items[gametype_remap2[s_serveroptions.gametype]] static int gametype_remap[] = {GT_RACING, GT_RACING_DM, GT_DERBY, GT_LCS, GT_DEATHMATCH, GT_TEAM, GT_TEAM_RACING, GT_TEAM_RACING_DM, GT_CTF, GT_DOMINATION}; -static int gametype_remap2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +static int gametype_remap2[] = {0, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9}; int allowLength[3]; int reversable; @@ -2188,56 +2188,50 @@ if (s_serveroptions.gametype == GT_DOMINATION) { } } -// STONELANCE -if( s_serveroptions.gametype == GT_DERBY || s_serveroptions.gametype == GT_LCS ) { - // Your code here -} -// END + // STONELANCE + if( s_serveroptions.gametype == GT_CTF || s_serveroptions.gametype == GT_DOMINATION ) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit ); + } + else if( s_serveroptions.gametype != GT_DERBY && s_serveroptions.gametype != GT_LCS ) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit ); + } + // END -if( s_serveroptions.gametype != GT_CTF && s_serveroptions.gametype != GT_DOMINATION - && s_serveroptions.gametype != GT_DERBY && s_serveroptions.gametype != GT_LCS ) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit ); -} -else if( s_serveroptions.gametype == GT_CTF || s_serveroptions.gametype == GT_DOMINATION ) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit ); -} + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit ); -Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit ); + if( s_serveroptions.gametype >= GT_TEAM ) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire ); + } -if( s_serveroptions.gametype >= GT_TEAM ) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire ); -} + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure ); -Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure ); + // STONELANCE + if( s_serveroptions.gametype == GT_RACING || s_serveroptions.gametype == GT_RACING_DM + || s_serveroptions.gametype == GT_TEAM_RACING || s_serveroptions.gametype == GT_TEAM_RACING_DM) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.trackLength ); -// STONELANCE -if( s_serveroptions.gametype == GT_RACING || s_serveroptions.gametype == GT_RACING_DM - || s_serveroptions.gametype == GT_TEAM_RACING || s_serveroptions.gametype == GT_TEAM_RACING_DM) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.trackLength ); - + if ( reversable ) + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.reversed ); + } + // END - if ( reversable ) - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.reversed ); -} -// END + if( s_serveroptions.multiplayer ) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dedicated ); + } -if( s_serveroptions.multiplayer ) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dedicated ); -} + if( s_serveroptions.multiplayer ) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.hostname ); + } -if( s_serveroptions.multiplayer ) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.hostname ); -} + if (s_serveroptions.gametype == GT_DOMINATION) { + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dominationSpawnStyle ); + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.sigillocator ); + } -if (s_serveroptions.gametype == GT_DOMINATION) { - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dominationSpawnStyle ); - Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.sigillocator ); -} + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.back ); + Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.go ); -Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.back ); -Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.go ); - -ServerOptions_SetMenuItems(); + ServerOptions_SetMenuItems(); } /* diff --git a/engine/code/q3_ui/ui_startserver.c b/engine/code/q3_ui/ui_startserver.c index b8eea6c2..96908755 100644 --- a/engine/code/q3_ui/ui_startserver.c +++ b/engine/code/q3_ui/ui_startserver.c @@ -97,15 +97,14 @@ static startserver_t s_startserver; static const char *gametype_items[] = { "Free For All", "Team Deathmatch", - "Demolition Derby", - "Last Car Standing", + "Tournament", "Capture the Flag", 0 }; // STONELANCE - removed gametype // static int gametype_remap[] = {GT_FFA, GT_TEAM, GT_TOURNAMENT, GT_CTF}; -static int gametype_remap[] = {GT_RACING, GT_TEAM, GT_DERBY, GT_LCS, GT_CTF}; +static int gametype_remap[] = {GT_RACING, GT_TEAM, GT_DERBY, GT_CTF}; // END static int gametype_remap2[] = {0, 2, 0, 1, 3}; diff --git a/engine/code/q3_ui/ui_team.c b/engine/code/q3_ui/ui_team.c index c5c868a5..4220e792 100644 --- a/engine/code/q3_ui/ui_team.c +++ b/engine/code/q3_ui/ui_team.c @@ -210,11 +210,6 @@ void TeamMain_MenuInit( void ) { case GT_RACING_DM: case GT_DEATHMATCH: case GT_DERBY: - s_teammain.joinred.generic.flags |= QMF_GRAYED; - s_teammain.joinblue.generic.flags |= QMF_GRAYED; - s_teammain.joingreen.generic.flags |= QMF_GRAYED; - s_teammain.joinyellow.generic.flags |= QMF_GRAYED; - break; case GT_LCS: s_teammain.joinred.generic.flags |= QMF_GRAYED; s_teammain.joinblue.generic.flags |= QMF_GRAYED;