Added a vector to CanCrossLine to indicate the next position the actor will be in if the move succeeds.

This commit is contained in:
Major Cooke 2020-09-27 17:00:47 -05:00 committed by Christoph Oelckers
parent b5b2dd0903
commit 5afd14fd4d
2 changed files with 5 additions and 5 deletions

View file

@ -163,7 +163,7 @@ bool P_CanCollideWith(AActor *tmthing, AActor *thing)
// If false, the line blocks them. // 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; static unsigned VIndex = ~0u;
if (VIndex == ~0u) if (VIndex == ~0u)
@ -172,7 +172,7 @@ bool P_CanCrossLine(AActor *mo, line_t *line, int side)
assert(VIndex != ~0u); assert(VIndex != ~0u);
} }
VMValue params[4] = { mo, line, side, false }; VMValue params[] = { mo, line, side, next.X, next.Y, next.Z, false };
VMReturn ret; VMReturn ret;
int retval; int retval;
ret.IntAt(&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; VMFunction *func = clss->Virtuals.Size() > VIndex ? clss->Virtuals[VIndex] : nullptr;
if (func != nullptr) if (func != nullptr)
{ {
VMCall(func, params, 4, &ret, 1); VMCall(func, params, countof(params), &ret, 1);
return retval; return retval;
} }
return true; 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) if (wasfit)
tm.thing->BlockingLine = ld; tm.thing->BlockingLine = ld;

View file

@ -503,7 +503,7 @@ class Actor : Thinker native
} }
// Called by PIT_CheckLine to check if an actor can cross a line. // 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; return true;
} }