Merge branch 'checkpoint-clip' into 'master'

Can cross checkpoints when respawning and in NOCLIP state now

See merge request KartKrew/Kart!2448
This commit is contained in:
Oni 2024-09-15 20:48:33 +00:00
commit c3208c243a
3 changed files with 18 additions and 9 deletions

View file

@ -446,6 +446,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
// Reduce by the amount we needed to get to this waypoint
stepamt -= dist;
fixed_t oldx = player->mo->x;
fixed_t oldy = player->mo->y = dest.y;
// We've reached the destination point,
P_UnsetThingPosition(player->mo);
player->mo->x = dest.x;
@ -453,6 +456,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->z = dest.z;
P_SetThingPosition(player->mo);
// Did we cross a checkpoint during our last step?
Obj_CrossCheckpoints(player, oldx, oldy);
// We are no longer traveling from death location to 1st waypoint, so use standard timings
if (player->respawn.fast)
player->respawn.fast = false;

View file

@ -3175,6 +3175,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try
thing->player->pflags |= PF_FREEZEWAYPOINTS;
}
}
}
// Currently this just iterates all checkpoints.
// Pretty shitty way to do it, but only players can
@ -3185,7 +3186,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try
{
Obj_CrossCheckpoints(thing->player, oldx, oldy);
}
}
if (result != NULL)
{

View file

@ -4010,12 +4010,15 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|| mobj->player->loop.radius != 0)
{
P_HitSpecialLines(mobj, mobj->x, mobj->y, mobj->momx, mobj->momy);
fixed_t oldx = mobj->x;
fixed_t oldy = mobj->y;
P_UnsetThingPosition(mobj);
mobj->x += mobj->momx;
mobj->y += mobj->momy;
mobj->z += mobj->momz;
P_SetThingPosition(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y, NULL);
Obj_CrossCheckpoints(mobj->player, oldx, oldy); // I would put this inside P_HitSpecialLines, but its wants a player reference with post-move coords instead of and old and new
mobj->floorz = g_tm.floorz;
mobj->ceilingz = g_tm.ceilingz;
mobj->terrain = NULL;