- fixed: P_TeleportMove must clear the spechits array.

This was accidentally deleted during one round of portal refactoring but is essential to prevent multiple teleport activations in one move.
Fixing this also allowed removing the fudging that was added to work around the issue in P_TryMove.
This commit is contained in:
Christoph Oelckers 2016-04-04 14:16:43 +02:00
parent 7de8c2b5eb
commit c346ac6143
1 changed files with 3 additions and 6 deletions

View File

@ -426,6 +426,8 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
tmf.abovemidtex = false; tmf.abovemidtex = false;
P_GetFloorCeilingZ(tmf, 0); P_GetFloorCeilingZ(tmf, 0);
spechit.Clear(); // this is needed so that no more specials get activated after crossing a teleporter.
bool StompAlwaysFrags = ((thing->flags2 & MF2_TELESTOMP) || (level.flags & LEVEL_MONSTERSTELEFRAG) || telefrag) && !(thing->flags7 & MF7_NOTELESTOMP); bool StompAlwaysFrags = ((thing->flags2 & MF2_TELESTOMP) || (level.flags & LEVEL_MONSTERSTELEFRAG) || telefrag) && !(thing->flags7 & MF7_NOTELESTOMP);
// P_LineOpening requires the thing's z to be the destination z in order to work. // P_LineOpening requires the thing's z to be the destination z in order to work.
@ -2420,12 +2422,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
line_t *ld = spec.line; line_t *ld = spec.line;
// see if the line was crossed // see if the line was crossed
// One more case of trying to preserve some side effects from the original: side = P_PointOnLineSide(spec.refpos.x, spec.refpos.y, ld);
// If the reference position is the same as the actor's position before checking the spechits,
// we use the thing's actual position, including all the side effects of the original.
// If some portal transition has to be considered here, we cannot do that and use the reference position stored with the spechit.
bool posisoriginal = (spec.refpos.x == lastpos.x && spec.refpos.y == lastpos.y);
side = posisoriginal? P_PointOnLineSide(thing->X(), thing->Y(), ld) : P_PointOnLineSide(spec.refpos.x, spec.refpos.y, ld);
oldside = P_PointOnLineSide(spec.oldrefpos.x, spec.oldrefpos.y, ld); oldside = P_PointOnLineSide(spec.oldrefpos.x, spec.oldrefpos.y, ld);
if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER)) if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER))
{ {