mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-23 16:32:36 +00:00
Fix player->lappoints for ending last lap
- Previous order:
- K_HandleLapIncrement
- K_UpdateAllPlayerPositions
- Sets player->position
- !! Relies on player->exiting
- Set lap points
- !! Based on player->position
- Set latestlap
- P_DoPlayerExit
- Set player->exiting
- K_UpdateAllPlayerPositions
- Sets player->position
- Relies on player->exiting
- Overwrites latestlap if not set
- K_InitPlayerTally
- Based on lap points
- New order:
- K_HandleLapIncrement
- Set latestlap
- If ending last lap, P_DoPlayerExit
- Set player->exiting
- K_UpdateAllPlayerPositions
- Sets player->position
- Relies on player->exiting
- Overwrites latestlap if not set
- [NO LONGER INITS TALLY]
- OTHERWISE, K_UpdateAllPlayerPositions
- Sets player->position
- Relies on player->exiting
- Set lap points
- Based on player->position
- P_PlayerAfterThink
- If player is exiting and no tally, K_InitPlayerTally
Hopefully you can see the magnitude of the gordian knot I had to untangle to fix this
This commit is contained in:
parent
1990c10635
commit
2ac891abe8
2 changed files with 49 additions and 37 deletions
78
src/p_spec.c
78
src/p_spec.c
|
|
@ -1956,7 +1956,46 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
|
|
||||||
player->cheatchecknum = 0;
|
player->cheatchecknum = 0;
|
||||||
player->laps++;
|
player->laps++;
|
||||||
K_UpdateAllPlayerPositions();
|
|
||||||
|
// P_DoPlayerExit can edit latestlap, so we do this first
|
||||||
|
boolean lapisfresh = (player->laps > player->latestlap);
|
||||||
|
if (lapisfresh) // mcgamer would be proud
|
||||||
|
{
|
||||||
|
player->latestlap = player->laps;
|
||||||
|
}
|
||||||
|
|
||||||
|
// finished race exit setup
|
||||||
|
if (player->laps > numlaps)
|
||||||
|
{
|
||||||
|
pflags_t applyflags = 0;
|
||||||
|
if (specialstageinfo.valid == true)
|
||||||
|
{
|
||||||
|
// Don't permit a win just by sneaking ahead of the UFO/emerald.
|
||||||
|
if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo)))
|
||||||
|
{
|
||||||
|
applyflags |= PF_NOCONTEST;
|
||||||
|
|
||||||
|
HU_DoTitlecardCEcho(player, "EMPTY\\HANDED?", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
P_DoPlayerExit(player, applyflags);
|
||||||
|
|
||||||
|
if (netgame && lapisfresh)
|
||||||
|
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UINT32 skinflags = (demo.playback)
|
||||||
|
? demo.skinlist[demo.currentskinid[(player-players)]].flags
|
||||||
|
: skins[player->skin].flags;
|
||||||
|
if (skinflags & SF_IRONMAN)
|
||||||
|
{
|
||||||
|
SetRandomFakePlayerSkin(player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
K_UpdateAllPlayerPositions(); // P_DoPlayerExit calls this
|
||||||
|
}
|
||||||
|
|
||||||
if (G_TimeAttackStart() && !linecrossed)
|
if (G_TimeAttackStart() && !linecrossed)
|
||||||
{
|
{
|
||||||
|
|
@ -1979,16 +2018,13 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
rainbowstartavailable = false;
|
rainbowstartavailable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->laps == 1 && modeattacking & ATTACKING_SPB)
|
if (player->laps == 1 && (modeattacking & ATTACKING_SPB))
|
||||||
{
|
{
|
||||||
P_SpawnMobj(player->mo->x - FixedMul(1000*mapobjectscale, FINECOSINE(player->mo->angle >> ANGLETOFINESHIFT)),
|
P_SpawnMobj(player->mo->x - FixedMul(1000*mapobjectscale, FINECOSINE(player->mo->angle >> ANGLETOFINESHIFT)),
|
||||||
player->mo->y - FixedMul(1000*mapobjectscale, FINESINE(player->mo->angle >> ANGLETOFINESHIFT)),
|
player->mo->y - FixedMul(1000*mapobjectscale, FINESINE(player->mo->angle >> ANGLETOFINESHIFT)),
|
||||||
player->mo->z, MT_SPB);
|
player->mo->z, MT_SPB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netgame && player->laps > numlaps)
|
|
||||||
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
|
|
||||||
|
|
||||||
if (gametyperules & GTR_SPECIALSTART)
|
if (gametyperules & GTR_SPECIALSTART)
|
||||||
{
|
{
|
||||||
if (player->laps > numlaps)
|
if (player->laps > numlaps)
|
||||||
|
|
@ -2019,7 +2055,7 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->laps > player->latestlap)
|
if (lapisfresh)
|
||||||
{
|
{
|
||||||
if (player->laps > 1)
|
if (player->laps > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -2050,8 +2086,6 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player->latestlap = player->laps;
|
|
||||||
|
|
||||||
// Set up lap animation vars
|
// Set up lap animation vars
|
||||||
if (player->latestlap > 1)
|
if (player->latestlap > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -2074,34 +2108,6 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// finished race exit setup
|
|
||||||
if (player->laps > numlaps)
|
|
||||||
{
|
|
||||||
pflags_t applyflags = 0;
|
|
||||||
if (specialstageinfo.valid == true)
|
|
||||||
{
|
|
||||||
// Don't permit a win just by sneaking ahead of the UFO/emerald.
|
|
||||||
if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo)))
|
|
||||||
{
|
|
||||||
applyflags |= PF_NOCONTEST;
|
|
||||||
|
|
||||||
HU_DoTitlecardCEcho(player, "EMPTY\\HANDED?", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
P_DoPlayerExit(player, applyflags);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UINT32 skinflags = (demo.playback)
|
|
||||||
? demo.skinlist[demo.currentskinid[(player-players)]].flags
|
|
||||||
: skins[player->skin].flags;
|
|
||||||
if (skinflags & SF_IRONMAN)
|
|
||||||
{
|
|
||||||
SetRandomFakePlayerSkin(player, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
thwompsactive = true; // Lap 2 effects
|
thwompsactive = true; // Lap 2 effects
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1275,7 +1275,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
K_InitPlayerTally(player);
|
//K_InitPlayerTally(player); -- we defer this to P_PlayerAfterThink
|
||||||
|
|
||||||
if (demo.playback == false)
|
if (demo.playback == false)
|
||||||
{
|
{
|
||||||
|
|
@ -4465,6 +4465,12 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (player->exiting && !K_PlayerTallyActive(player))
|
||||||
|
{
|
||||||
|
// We defer P_DoPlayerExit tallies to the end of the tic.
|
||||||
|
K_InitPlayerTally(player);
|
||||||
|
}
|
||||||
|
|
||||||
if (P_IsObjectOnGround(player->mo) == true)
|
if (P_IsObjectOnGround(player->mo) == true)
|
||||||
{
|
{
|
||||||
player->outrun = 0;
|
player->outrun = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue