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; UINT8 numingame = 0;
SINT8 winnernum = -1; SINT8 winnernum = -1;
INT32 winnerscoreadd = 0; INT32 winnerscoreadd = 0;
boolean nobumpers = false;
if (!multiplayer)
return;
if (!G_BattleGametype()) if (!G_BattleGametype())
return; return;
@ -227,8 +225,11 @@ void K_CheckBumpers(void)
winnerscoreadd += players[i].marescore; winnerscoreadd += players[i].marescore;
if (players[i].kartstuff[k_bumper] <= 0) // if you don't have any bumpers, you're probably not a winner if (players[i].kartstuff[k_bumper] <= 0) // if you don't have any bumpers, you're probably not a winner
{
nobumpers = true;
continue; continue;
else if (winnernum > -1) // TWO winners? that's dumb :V }
else if (winnernum != -1) // TWO winners? that's dumb :V
return; return;
winnernum = i; winnernum = i;
@ -238,7 +239,23 @@ void K_CheckBumpers(void)
if (numingame <= 1) if (numingame <= 1)
{ {
if (!battlecapsules) if (!battlecapsules)
{
// Reset map to turn on battle capsules
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); 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; return;
} }
@ -534,7 +551,6 @@ static void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj)
void K_SpawnBattleCapsules(void) void K_SpawnBattleCapsules(void)
{ {
mapthing_t *mt; mapthing_t *mt;
UINT8 n = 0;
size_t i; size_t i;
if (battlecapsules) if (battlecapsules)
@ -543,18 +559,27 @@ void K_SpawnBattleCapsules(void)
if (!G_BattleGametype()) if (!G_BattleGametype())
return; 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) for (i = 0; i < MAXPLAYERS; i++)
return; {
if (playeringame[i] && !players[i].spectator)
n++;
if (players[i].exiting)
return;
if (n > 1)
break;
}
if (n > 1)
return;
}
mt = mapthings; mt = mapthings;
for (i = 0; i < nummapthings; i++, mt++) for (i = 0; i < nummapthings; i++, mt++)

View file

@ -605,6 +605,9 @@ boolean K_IsPlayerLosing(player_t *player)
INT32 winningpos = 1; INT32 winningpos = 1;
UINT8 i, pcount = 0; UINT8 i, pcount = 0;
if (battlecapsules && player->kartstuff[k_bumper] <= 0)
return true; // DNF in break the capsules
if (player->kartstuff[k_position] == 1) if (player->kartstuff[k_position] == 1)
return false; return false;
@ -10131,10 +10134,14 @@ static void K_drawBattleFullscreen(void)
V_DrawFadeScreen(0xFF00, 16); V_DrawFadeScreen(0xFF00, 16);
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator) if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{ {
if (stplyr->kartstuff[k_position] == 1) patch_t *p = kp_battlecool;
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
else if (K_IsPlayerLosing(stplyr))
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL); p = kp_battlelose;
else if (stplyr->kartstuff[k_position] == 1)
p = kp_battlewin;
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, p, NULL);
} }
else else
K_drawKartFinish(); K_drawKartFinish();

View file

@ -3615,12 +3615,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
dummy.y = thiscam->y; dummy.y = thiscam->y;
dummy.z = thiscam->z; dummy.z = thiscam->z;
dummy.height = thiscam->height; dummy.height = thiscam->height;
if (player->pflags & PF_TIMEOVER)
if ((player->pflags & PF_TIMEOVER) && G_RaceGametype())
player->karthud[khud_timeovercam] = (2*TICRATE)+1; player->karthud[khud_timeovercam] = (2*TICRATE)+1;
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
P_ResetCamera(player, thiscam); P_ResetCamera(player, thiscam);
else else
P_SlideCameraMove(thiscam); P_SlideCameraMove(thiscam);
if (resetcalled) // Okay this means the camera is fully reset. if (resetcalled) // Okay this means the camera is fully reset.
return true; return true;
} }

View file

@ -1158,10 +1158,10 @@ boolean P_EndingMusic(player_t *player)
sprintf(buffer, "k*fail"); // F-Zero death results theme sprintf(buffer, "k*fail"); // F-Zero death results theme
else else
{ {
if (bestlocalpos == 1) if (K_IsPlayerLosing(bestlocalplayer))
sprintf(buffer, "k*win");
else if (K_IsPlayerLosing(bestlocalplayer))
sprintf(buffer, "k*lose"); sprintf(buffer, "k*lose");
else if (bestlocalpos == 1)
sprintf(buffer, "k*win");
else else
sprintf(buffer, "k*ok"); 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 if (player->bot) // don't allow bots to do any of the below, B_CheckRespawn does all they need for respawning already
goto notrealplayer; goto notrealplayer;
if (player->pflags & PF_TIMEOVER) if ((player->pflags & PF_TIMEOVER) && G_RaceGametype())
{ {
player->karthud[khud_timeovercam]++; player->karthud[khud_timeovercam]++;
if (player->mo) if (player->mo)
{ {
player->mo->flags |= (MF_NOGRAVITY|MF_NOCLIP); 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 || (leveltime < introtime)); // Kart intro cam
#endif #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); timeover = (player->karthud[khud_timeovercam] > 2*TICRATE ? 2 : 1);
else else
timeover = 0; timeover = 0;

View file

@ -796,16 +796,26 @@ static void Y_UpdateRecordReplays(void)
if (!mainrecords[gamemap-1]) if (!mainrecords[gamemap-1])
G_AllocMainRecordData(gamemap-1); G_AllocMainRecordData(gamemap-1);
if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) if (players[consoleplayer].pflags & PF_TIMEOVER)
mainrecords[gamemap-1]->time = players[consoleplayer].realtime; {
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)) if ((mainrecords[gamemap-1]->lap == 0) || (bestlap < mainrecords[gamemap-1]->lap))
mainrecords[gamemap-1]->lap = bestlap; mainrecords[gamemap-1]->lap = bestlap;
} }
else else
{
mainrecords[gamemap-1]->lap = 0; mainrecords[gamemap-1]->lap = 0;
}
// Save demo! // Save demo!
bestdemo[255] = '\0'; 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); 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); snprintf(bestdemo, 255, "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string);
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)) if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))