Break the Capsules ends when you lose bumpers

This commit is contained in:
Sally Cochenour 2020-03-22 16:07:25 -04:00
parent 601ab839f0
commit b18df427dd
5 changed files with 74 additions and 28 deletions

View file

@ -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++)

View file

@ -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<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL);
patch_t *p = kp_battlecool;
if (K_IsPlayerLosing(stplyr))
p = kp_battlelose;
else if (stplyr->kartstuff[k_position] == 1)
p = kp_battlewin;
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, p, NULL);
}
else
K_drawKartFinish();

View file

@ -3615,12 +3615,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
dummy.y = thiscam->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;
}

View file

@ -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;

View file

@ -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))