From e271c2de5d4065b4cdb23a548439dd022b21d315 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 4 Sep 2018 20:16:42 -0400 Subject: [PATCH] If the game would normally end in a bomb kill, then always switch their places --- src/k_kart.c | 6 ++++-- src/p_inter.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 930223b3..ecee1416 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4490,7 +4490,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) void K_CalculateBattleWanted(void) { - UINT8 numingame = 0, numwanted = 0; + UINT8 numingame = 0, numplaying = 0, numwanted = 0; SINT8 bestbumperplayer = -1, bestbumper = -1; SINT8 camppos[MAXPLAYERS]; // who is the biggest camper UINT8 ties = 0, nextcamppos = 0; @@ -4519,6 +4519,8 @@ void K_CalculateBattleWanted(void) if (players[i].exiting) // We're done, don't calculate. return; + numplaying++; + if (players[i].kartstuff[k_bumper] <= 0) // Not alive, so don't do anything else continue; @@ -4554,7 +4556,7 @@ void K_CalculateBattleWanted(void) camppos[position] = i; } - if (numingame <= 2) + if (numplaying <= 2 || (numingame <= 2 && bestbumper == 1)) // In 1v1s then there's no need for WANTED. In bigger netgames, don't show anyone as WANTED when they're equally matched. numwanted = 0; else numwanted = min(4, 1 + ((numingame-2) / 4)); diff --git a/src/p_inter.c b/src/p_inter.c index ca933069..7e35731a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -516,6 +516,22 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) boom->color = SKINCOLOR_RED; S_StartSound(boom, special->info->attacksound); + if (player->kartstuff[k_bumper] == 1) // If you have only one bumper left, and see if it's a 1v1 + { + INT32 numingame = 0; + INT32 i; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator || players[i].kartstuff[k_bumper] <= 0) + continue; + numingame++; + } + + if (numingame <= 2) // If so, then an extra karma point so they are 100% certain to switch places; it's annoying to end matches with a bomb kill + special->target->player->kartstuff[k_comebackpoints]++; + } + special->target->player->kartstuff[k_comebackpoints] += 2 * (K_IsPlayerWanted(player) ? 2 : 1); if (netgame && cv_hazardlog.value) CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]);