From 4227d97958d7ba1915ecdfc8b8039472c26145d2 Mon Sep 17 00:00:00 2001 From: Zack Middleton <zack@cloemail.com> Date: Fri, 2 Jun 2017 21:24:57 -0500 Subject: [PATCH] Make Team Arena win logic handle more game types/blue team The Team Arena menu uses red team for single player but q3_ui (and mods could) use blue. Also handle all the game types, not just the ones used by Team Arena. Fixes FFA and Team DM. --- code/game/g_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/code/game/g_main.c b/code/game/g_main.c index 6d9d9fae..af88d349 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1145,6 +1145,7 @@ void LogExit( const char *string ) { gclient_t *cl; #ifdef MISSIONPACK qboolean won = qtrue; + team_t team = TEAM_RED; #endif G_LogPrintf( "Exit: %s\n", string ); @@ -1181,7 +1182,10 @@ void LogExit( const char *string ) { G_LogPrintf( "score: %i ping: %i client: %i %s\n", cl->ps.persistant[PERS_SCORE], ping, level.sortedClients[i], cl->pers.netname ); #ifdef MISSIONPACK - if (g_singlePlayer.integer && g_gametype.integer == GT_TOURNAMENT) { + if (g_singlePlayer.integer && !(g_entities[cl - level.clients].r.svFlags & SVF_BOT)) { + team = cl->sess.sessionTeam; + } + if (g_singlePlayer.integer && g_gametype.integer < GT_TEAM) { if (g_entities[cl - level.clients].r.svFlags & SVF_BOT && cl->ps.persistant[PERS_RANK] == 0) { won = qfalse; } @@ -1192,8 +1196,12 @@ void LogExit( const char *string ) { #ifdef MISSIONPACK if (g_singlePlayer.integer) { - if (g_gametype.integer >= GT_CTF) { - won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE]; + if (g_gametype.integer >= GT_TEAM) { + if (team == TEAM_BLUE) { + won = level.teamScores[TEAM_BLUE] > level.teamScores[TEAM_RED]; + } else { + won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE]; + } } trap_SendConsoleCommand( EXEC_APPEND, (won) ? "spWin\n" : "spLose\n" ); }