Enable waypoints for patched maps
This commit is contained in:
parent
d58aa37228
commit
54a628bdfd
5 changed files with 38 additions and 21 deletions
|
|
@ -11002,6 +11002,11 @@ boolean K_SlipdashActive(void)
|
|||
|
||||
boolean K_UsingLegacyCheckpoints(void)
|
||||
{
|
||||
if (patch_version && waypointcap)
|
||||
{
|
||||
// we're presumably adding waypoints to an existing map
|
||||
return false;
|
||||
}
|
||||
if (numbosswaypoints > 0)
|
||||
{
|
||||
// We are using Kart V1 waypoints!
|
||||
|
|
|
|||
|
|
@ -941,8 +941,8 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost)
|
|||
|
||||
(void)snaptopost;
|
||||
|
||||
// Player must have touched all previous starposts
|
||||
if ((post->health - player->starpostnum > 1) && (!K_UsingLegacyCheckpoints()))
|
||||
// Going backwards triggers sound
|
||||
if (post->health >= ((numstarposts/2) + player->starpostnum))
|
||||
{
|
||||
if (!player->checkskip)
|
||||
{
|
||||
|
|
@ -952,17 +952,7 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost)
|
|||
player->grieftime += TICRATE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
player->checkskip = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
// Going backwards triggers sound
|
||||
if ((post->health >= ((numstarposts/2) + player->starpostnum)) && (K_UsingLegacyCheckpoints()))
|
||||
{
|
||||
if (!player->checkskip)
|
||||
S_StartSound(toucher, sfx_s26d);
|
||||
|
||||
player->checkskip = 3;
|
||||
return;
|
||||
|
|
|
|||
37
src/p_mobj.c
37
src/p_mobj.c
|
|
@ -12860,15 +12860,22 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void P_SnapToFinishLine(mobj_t *mobj)
|
||||
static void SpreadFinishLine(line_t *line, line_t *prev, boolean flip)
|
||||
{
|
||||
line_t *finishline = P_FindNearestLine(mobj->x, mobj->y,
|
||||
mobj->subsector->sector, 2001); // case 2001: Finish Line
|
||||
if (finishline != NULL)
|
||||
size_t i;
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
P_UnsetThingPosition(mobj);
|
||||
P_ClosestPointOnLine(mobj->x, mobj->y, finishline, (vertex_t *)&mobj->x);
|
||||
P_SetThingPosition(mobj);
|
||||
line_t *line2 = &lines[i];
|
||||
if (line2 != line && line2 != prev && (line2->slopetype == ST_HORIZONTAL || line2->slopetype == ST_VERTICAL) && line2->slopetype == line->slopetype &&
|
||||
(line->v1 == line2->v1 || line->v2 == line2->v2 || line->v1 == line2->v2 || line->v2 == line2->v1))
|
||||
{
|
||||
boolean flipped = line->v1 == line2->v1 || line->v2 == line2->v2;
|
||||
line2->special = 2001; // Finish Line
|
||||
line2->activation = SPAC_CROSS|SPAC_REPEATSPECIAL;
|
||||
if (flipped != flip)
|
||||
line2->args[0] |= TMCFF_FLIP;
|
||||
SpreadFinishLine(line2, line, flipped != flip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -13161,7 +13168,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
mobj->extravalue2 = 1; // args[2] of 1 means the waypoint is at the finish line
|
||||
mobj->reactiontime = 0; // Also don't respawn at finish lines
|
||||
|
||||
P_SnapToFinishLine(mobj);
|
||||
line_t *finishline = P_FindNearestLine(mobj->x, mobj->y,
|
||||
mobj->subsector->sector, -1);
|
||||
if (finishline != NULL)
|
||||
{
|
||||
P_UnsetThingPosition(mobj);
|
||||
P_ClosestPointOnLine(mobj->x, mobj->y, finishline, (vertex_t *)&mobj->x);
|
||||
P_SetThingPosition(mobj);
|
||||
|
||||
boolean flip = mthing->args[2] & TMWPF_FLIPFINISH;
|
||||
finishline->special = 2001; // Finish Line
|
||||
finishline->activation = SPAC_CROSS|SPAC_REPEATSPECIAL;
|
||||
if (flip)
|
||||
finishline->args[0] |= TMCFF_FLIP;
|
||||
SpreadFinishLine(finishline, NULL, flip);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5356,7 +5356,7 @@ static void P_EvaluateSpecialFlags(player_t *player, sector_t *sector, sector_t
|
|||
P_ProcessZoomTube(player, sectag, true);
|
||||
if (sector->specialflags & SSF_FINISHLINE)
|
||||
{
|
||||
if ((gametyperules & GTR_CIRCUIT) && (player->exiting == 0) && !(player->pflags & PF_HITFINISHLINE))
|
||||
if (K_UsingLegacyCheckpoints() && (gametyperules & GTR_CIRCUIT) && (player->exiting == 0) && !(player->pflags & PF_HITFINISHLINE))
|
||||
{
|
||||
K_HandleLapIncrement(player);
|
||||
player->pflags |= PF_HITFINISHLINE;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ typedef enum
|
|||
TMWPF_SHORTCUT = 1<<1,
|
||||
TMWPF_NORESPAWN = 1<<2,
|
||||
TMWPF_FINISHLINE = 1<<3,
|
||||
TMWPF_FLIPFINISH = 1<<4,
|
||||
} textmapwaypointflags_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
|||
Loading…
Reference in a new issue