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 // Reduce by the amount we needed to get to this waypoint
stepamt -= dist; stepamt -= dist;
fixed_t oldx = player->mo->x;
fixed_t oldy = player->mo->y = dest.y;
// We've reached the destination point, // We've reached the destination point,
P_UnsetThingPosition(player->mo); P_UnsetThingPosition(player->mo);
player->mo->x = dest.x; player->mo->x = dest.x;
@ -453,6 +456,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->z = dest.z; player->mo->z = dest.z;
P_SetThingPosition(player->mo); 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 // We are no longer traveling from death location to 1st waypoint, so use standard timings
if (player->respawn.fast) if (player->respawn.fast)
player->respawn.fast = false; player->respawn.fast = false;

View file

@ -3175,16 +3175,16 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, Try
thing->player->pflags |= PF_FREEZEWAYPOINTS; thing->player->pflags |= PF_FREEZEWAYPOINTS;
} }
} }
}
// Currently this just iterates all checkpoints. // Currently this just iterates all checkpoints.
// Pretty shitty way to do it, but only players can // Pretty shitty way to do it, but only players can
// cross it, so it's good enough. Works as long as the // cross it, so it's good enough. Works as long as the
// move doesn't cross multiple -- it can only evaluate // move doesn't cross multiple -- it can only evaluate
// one. // one.
if (thing->player) if (thing->player)
{ {
Obj_CrossCheckpoints(thing->player, oldx, oldy); Obj_CrossCheckpoints(thing->player, oldx, oldy);
}
} }
if (result != NULL) if (result != NULL)

View file

@ -4010,12 +4010,15 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|| mobj->player->loop.radius != 0) || mobj->player->loop.radius != 0)
{ {
P_HitSpecialLines(mobj, mobj->x, mobj->y, mobj->momx, mobj->momy); P_HitSpecialLines(mobj, mobj->x, mobj->y, mobj->momx, mobj->momy);
fixed_t oldx = mobj->x;
fixed_t oldy = mobj->y;
P_UnsetThingPosition(mobj); P_UnsetThingPosition(mobj);
mobj->x += mobj->momx; mobj->x += mobj->momx;
mobj->y += mobj->momy; mobj->y += mobj->momy;
mobj->z += mobj->momz; mobj->z += mobj->momz;
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
P_CheckPosition(mobj, mobj->x, mobj->y, NULL); 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->floorz = g_tm.floorz;
mobj->ceilingz = g_tm.ceilingz; mobj->ceilingz = g_tm.ceilingz;
mobj->terrain = NULL; mobj->terrain = NULL;