From b18df427dd9f3597c5d67806a9d39ac87d0b1880 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 16:07:25 -0400 Subject: [PATCH] Break the Capsules ends when you lose bumpers --- src/k_battle.c | 53 +++++++++++++++++++++++++++++++++++++------------- src/k_kart.c | 15 ++++++++++---- src/p_mobj.c | 5 ++++- src/p_user.c | 11 ++++++----- src/y_inter.c | 18 +++++++++++++---- 5 files changed, 74 insertions(+), 28 deletions(-) diff --git a/src/k_battle.c b/src/k_battle.c index b188e3921..f57ba5ec9 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -205,9 +205,7 @@ void K_CheckBumpers(void) UINT8 numingame = 0; SINT8 winnernum = -1; INT32 winnerscoreadd = 0; - - if (!multiplayer) - return; + boolean nobumpers = false; if (!G_BattleGametype()) return; @@ -227,8 +225,11 @@ void K_CheckBumpers(void) winnerscoreadd += players[i].marescore; if (players[i].kartstuff[k_bumper] <= 0) // if you don't have any bumpers, you're probably not a winner + { + nobumpers = true; continue; - else if (winnernum > -1) // TWO winners? that's dumb :V + } + else if (winnernum != -1) // TWO winners? that's dumb :V return; winnernum = i; @@ -238,7 +239,23 @@ void K_CheckBumpers(void) if (numingame <= 1) { if (!battlecapsules) + { + // Reset map to turn on battle capsules D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); + } + else + { + if (nobumpers) + { + for (i = 0; i < MAXPLAYERS; i++) + { + players[i].pflags |= PF_TIMEOVER; + //players[i].lives = 0; + P_DoPlayerExit(&players[i]); + } + } + } + return; } @@ -534,7 +551,6 @@ static void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj) void K_SpawnBattleCapsules(void) { mapthing_t *mt; - UINT8 n = 0; size_t i; if (battlecapsules) @@ -543,18 +559,27 @@ void K_SpawnBattleCapsules(void) if (!G_BattleGametype()) return; - for (i = 0; i < MAXPLAYERS; i++) + if (modeattacking == ATTACKING_CAPSULES) { - if (playeringame[i] && !players[i].spectator) - n++; - if (players[i].exiting) - return; - if (n > 1) - break; + ; } + else + { + UINT8 n = 0; - if (n > 1) - return; + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + n++; + if (players[i].exiting) + return; + if (n > 1) + break; + } + + if (n > 1) + return; + } mt = mapthings; for (i = 0; i < nummapthings; i++, mt++) diff --git a/src/k_kart.c b/src/k_kart.c index ee2b6f0d4..9da1244f0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -605,6 +605,9 @@ boolean K_IsPlayerLosing(player_t *player) INT32 winningpos = 1; UINT8 i, pcount = 0; + if (battlecapsules && player->kartstuff[k_bumper] <= 0) + return true; // DNF in break the capsules + if (player->kartstuff[k_position] == 1) return false; @@ -10131,10 +10134,14 @@ static void K_drawBattleFullscreen(void) V_DrawFadeScreen(0xFF00, 16); if (stplyr->exiting < 6*TICRATE && !stplyr->spectator) { - if (stplyr->kartstuff[k_position] == 1) - V_DrawFixedPatch(x<kartstuff[k_position] == 1) + p = kp_battlewin; + + V_DrawFixedPatch(x<y; dummy.z = thiscam->z; dummy.height = thiscam->height; - if (player->pflags & PF_TIMEOVER) + + if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) player->karthud[khud_timeovercam] = (2*TICRATE)+1; + if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. P_ResetCamera(player, thiscam); else P_SlideCameraMove(thiscam); + if (resetcalled) // Okay this means the camera is fully reset. return true; } diff --git a/src/p_user.c b/src/p_user.c index 666855f53..757354631 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1158,10 +1158,10 @@ boolean P_EndingMusic(player_t *player) sprintf(buffer, "k*fail"); // F-Zero death results theme else { - if (bestlocalpos == 1) - sprintf(buffer, "k*win"); - else if (K_IsPlayerLosing(bestlocalplayer)) + if (K_IsPlayerLosing(bestlocalplayer)) sprintf(buffer, "k*lose"); + else if (bestlocalpos == 1) + sprintf(buffer, "k*win"); else sprintf(buffer, "k*ok"); } @@ -6961,9 +6961,10 @@ static void P_DeathThink(player_t *player) if (player->bot) // don't allow bots to do any of the below, B_CheckRespawn does all they need for respawning already goto notrealplayer; - if (player->pflags & PF_TIMEOVER) + if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) { player->karthud[khud_timeovercam]++; + if (player->mo) { player->mo->flags |= (MF_NOGRAVITY|MF_NOCLIP); @@ -7178,7 +7179,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall || (leveltime < introtime)); // Kart intro cam #endif - if (player->pflags & PF_TIMEOVER) // 1 for momentum keep, 2 for turnaround + if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) // 1 for momentum keep, 2 for turnaround timeover = (player->karthud[khud_timeovercam] > 2*TICRATE ? 2 : 1); else timeover = 0; diff --git a/src/y_inter.c b/src/y_inter.c index 1f489fa2c..7adf601d7 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -796,16 +796,26 @@ static void Y_UpdateRecordReplays(void) if (!mainrecords[gamemap-1]) G_AllocMainRecordData(gamemap-1); - if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) - mainrecords[gamemap-1]->time = players[consoleplayer].realtime; + if (players[consoleplayer].pflags & PF_TIMEOVER) + { + players[consoleplayer].realtime = UINT32_MAX; + } - if (modeattacking != ATTACKING_CAPSULES) + if (((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) + && (players[consoleplayer].realtime < UINT32_MAX)) // DNF + { + mainrecords[gamemap-1]->time = players[consoleplayer].realtime; + } + + if (modeattacking == ATTACKING_RECORD) { if ((mainrecords[gamemap-1]->lap == 0) || (bestlap < mainrecords[gamemap-1]->lap)) mainrecords[gamemap-1]->lap = bestlap; } else + { mainrecords[gamemap-1]->lap = 0; + } // Save demo! bestdemo[255] = '\0'; @@ -836,7 +846,7 @@ static void Y_UpdateRecordReplays(void) CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); } - if (modeattacking != ATTACKING_CAPSULES) + if (modeattacking == ATTACKING_RECORD) { snprintf(bestdemo, 255, "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string); if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))