mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Respawn at waypoints once first crossing the finish line.
This commit is contained in:
parent
6eca35aae1
commit
20f8037351
4 changed files with 36 additions and 26 deletions
|
|
@ -3216,7 +3216,8 @@ void G_DoReborn(INT32 playernum)
|
|||
// respawn at the start
|
||||
mobj_t *oldmo = NULL;
|
||||
|
||||
if (player->starpostnum || ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) && player->laps)) // SRB2kart
|
||||
// Now only respawn at the start if you haven't crossed it at all
|
||||
if (player->laps) // SRB2kart
|
||||
starpost = true;
|
||||
|
||||
// first dissasociate the corpse
|
||||
|
|
|
|||
36
src/k_kart.c
36
src/k_kart.c
|
|
@ -5859,8 +5859,40 @@ static void K_UpdateDistanceFromFinishLine(player_t *const player)
|
|||
}
|
||||
else
|
||||
{
|
||||
waypoint_t *finishline = K_GetFinishLineWaypoint();
|
||||
player->nextwaypoint = K_GetPlayerNextWaypoint(player);
|
||||
waypoint_t *finishline = K_GetFinishLineWaypoint();
|
||||
waypoint_t *nextwaypoint = K_GetPlayerNextWaypoint(player);
|
||||
|
||||
if ((nextwaypoint != player->nextwaypoint) &&
|
||||
(K_GetWaypointIsShortcut(nextwaypoint) == false) && (K_GetWaypointIsEnabled(nextwaypoint) == true))
|
||||
{
|
||||
size_t i = 0U;
|
||||
waypoint_t *aimwaypoint = NULL;
|
||||
player->starpostx = nextwaypoint->mobj->x >> FRACBITS;
|
||||
player->starposty = nextwaypoint->mobj->y >> FRACBITS;
|
||||
player->starpostz = nextwaypoint->mobj->z >> FRACBITS;
|
||||
|
||||
// player gravflip determines which way to respawn
|
||||
player->kartstuff[k_starpostflip] = player->mo->flags2 & MF2_OBJECTFLIP;
|
||||
|
||||
// starpostangle is to the first valid nextwaypoint for simplicity
|
||||
// if we reach the last waypoint and it's still not valid, just use it anyway. Someone needs to fix
|
||||
// their map!
|
||||
for (i = 0U; i < nextwaypoint->numnextwaypoints; i++)
|
||||
{
|
||||
aimwaypoint = nextwaypoint->nextwaypoints[i];
|
||||
|
||||
if ((i == nextwaypoint->numnextwaypoints - 1U)
|
||||
|| ((K_GetWaypointIsShortcut(aimwaypoint) == false)
|
||||
&& (K_GetWaypointIsEnabled(aimwaypoint) == true)))
|
||||
{
|
||||
player->starpostangle = R_PointToAngle2(
|
||||
nextwaypoint->mobj->x, nextwaypoint->mobj->y, aimwaypoint->mobj->x, aimwaypoint->mobj->y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player->nextwaypoint = nextwaypoint;
|
||||
|
||||
// nextwaypoint is now the waypoint that is in front of us
|
||||
if ((player->nextwaypoint != NULL) && (finishline != NULL))
|
||||
|
|
|
|||
|
|
@ -1484,13 +1484,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
// Save the player's time and position.
|
||||
player->starposttime = player->realtime; //this makes race mode's timers work correctly whilst not affecting sp -x
|
||||
//player->starposttime = leveltime;
|
||||
player->starpostx = toucher->x>>FRACBITS;
|
||||
player->starposty = toucher->y>>FRACBITS;
|
||||
player->starpostz = special->z>>FRACBITS;
|
||||
player->starpostangle = special->angle;
|
||||
player->starpostnum = special->health;
|
||||
player->kartstuff[k_starpostflip] = special->spawnpoint->options & MTF_OBJECTFLIP; // store flipping
|
||||
|
||||
//S_StartSound(toucher, special->info->painsound);
|
||||
return;
|
||||
|
|
|
|||
17
src/p_spec.c
17
src/p_spec.c
|
|
@ -2254,23 +2254,6 @@ static void K_HandleLapIncrement(player_t *player)
|
|||
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->kartstuff[k_starpostflip] = player->mo->flags2 & MF2_OBJECTFLIP; // store flipping
|
||||
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 = player->kartstuff[k_starpostflip] = 0;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(player))
|
||||
{
|
||||
if (player->laps == (UINT8)(cv_numlaps.value)) // final lap
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue