From 992141d8e313cc0c697385cd975d4e1b4347170b Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Sun, 27 Sep 2020 17:00:47 -0500 Subject: [PATCH] Added a vector to CanCrossLine to indicate the next position the actor will be in if the move succeeds. --- src/playsim/p_map.cpp | 8 ++++---- wadsrc/static/zscript/actors/actor.zs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 5d0017bffa..56688fd062 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -163,7 +163,7 @@ bool P_CanCollideWith(AActor *tmthing, AActor *thing) // If false, the line blocks them. //========================================================================== -bool P_CanCrossLine(AActor *mo, line_t *line, int side) +bool P_CanCrossLine(AActor *mo, line_t *line, int side, DVector3 next) { static unsigned VIndex = ~0u; if (VIndex == ~0u) @@ -172,7 +172,7 @@ bool P_CanCrossLine(AActor *mo, line_t *line, int side) assert(VIndex != ~0u); } - VMValue params[4] = { mo, line, side, false }; + VMValue params[] = { mo, line, side, next.X, next.Y, next.Z, false }; VMReturn ret; int retval; ret.IntAt(&retval); @@ -181,7 +181,7 @@ bool P_CanCrossLine(AActor *mo, line_t *line, int side) VMFunction *func = clss->Virtuals.Size() > VIndex ? clss->Virtuals[VIndex] : nullptr; if (func != nullptr) { - VMCall(func, params, 4, &ret, 1); + VMCall(func, params, countof(params), &ret, 1); return retval; } return true; @@ -985,7 +985,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec } } - if (!P_CanCrossLine(tm.thing, ld, P_PointOnLineSide(cres.Position, ld))) + if (!P_CanCrossLine(tm.thing, ld, P_PointOnLineSide(cres.Position, ld), tm.pos)) { if (wasfit) tm.thing->BlockingLine = ld; diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 2972055989..1c702e9d55 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -502,7 +502,7 @@ class Actor : Thinker native } // Called by PIT_CheckLine to check if an actor can cross a line. - virtual bool CanCrossLine(Line crossing, int side) + virtual bool CanCrossLine(Line crossing, int side, Vector3 next) { return true; }