LF_SECTIONRACE now has a secondary function!

* Sets the player respawn coords on the finish line, so dying in the short interval between crossing an intermediate finish line and hitting a checkpoint doesn't send you all the way back to the beginning.
This commit is contained in:
toaster 2018-11-28 16:33:52 +00:00
parent ecba6a0cb4
commit d8955f1f87
2 changed files with 18 additions and 6 deletions

View file

@ -2997,7 +2997,7 @@ void G_DoReborn(INT32 playernum)
// respawn at the start
mobj_t *oldmo = NULL;
if (player->starpostnum) // SRB2kart
if (player->starpostnum || ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) && player->laps)) // SRB2kart
starpost = true;
// first dissasociate the corpse

View file

@ -4240,12 +4240,24 @@ DoneSection2:
curlap = 0;
}
// Reset starposts (checkpoints) info
// SRB2kart 200117
player->starpostangle = player->starpostnum = 0;
player->starpostx = player->starposty = player->starpostz = 0;
//except the time!
player->starposttime = player->realtime;
player->starpostnum = 0;
if (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
{
// SRB2Kart 281118
// Save the player's time and position.
player->starpostx = player->mo->x>>FRACBITS;
player->starposty = player->mo->y>>FRACBITS;
player->starpostz = player->mo->floorz>>FRACBITS;
player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely...
}
else
{
// SRB2kart 200117
// Reset starposts (checkpoints) info
player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0;
}
if (P_IsLocalPlayer(player))
{