mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
Optimized CanCrossLine.
- Remove P_PointOnLineSide check - Made CanCrossLine opt-in by requiring the CROSSLINECHECK flag.
This commit is contained in:
parent
5afd14fd4d
commit
748156c846
4 changed files with 6 additions and 4 deletions
|
@ -425,6 +425,7 @@ enum ActorFlag8
|
||||||
MF8_STAYONLIFT = 0x02000000, // MBF AI enhancement.
|
MF8_STAYONLIFT = 0x02000000, // MBF AI enhancement.
|
||||||
MF8_DONTFOLLOWPLAYERS = 0x04000000, // [inkoalawetrust] Friendly monster will not follow players.
|
MF8_DONTFOLLOWPLAYERS = 0x04000000, // [inkoalawetrust] Friendly monster will not follow players.
|
||||||
MF8_SEEFRIENDLYMONSTERS = 0X08000000, // [inkoalawetrust] Hostile monster can see friendly monsters.
|
MF8_SEEFRIENDLYMONSTERS = 0X08000000, // [inkoalawetrust] Hostile monster can see friendly monsters.
|
||||||
|
MF8_CROSSLINECHECK = 0x10000000, // [MC]Enables CanCrossLine virtual
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- mobj.renderflags ---
|
// --- mobj.renderflags ---
|
||||||
|
|
|
@ -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, DVector3 next)
|
bool P_CanCrossLine(AActor *mo, line_t *line, 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, DVector3 next)
|
||||||
assert(VIndex != ~0u);
|
assert(VIndex != ~0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
VMValue params[] = { mo, line, side, next.X, next.Y, next.Z, false };
|
VMValue params[] = { mo, line, next.X, next.Y, next.Z, false };
|
||||||
VMReturn ret;
|
VMReturn ret;
|
||||||
int retval;
|
int retval;
|
||||||
ret.IntAt(&retval);
|
ret.IntAt(&retval);
|
||||||
|
@ -985,7 +985,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!P_CanCrossLine(tm.thing, ld, P_PointOnLineSide(cres.Position, ld), tm.pos))
|
if ((tm.thing->flags8 & MF8_CROSSLINECHECK) && !P_CanCrossLine(tm.thing, ld, tm.pos))
|
||||||
{
|
{
|
||||||
if (wasfit)
|
if (wasfit)
|
||||||
tm.thing->BlockingLine = ld;
|
tm.thing->BlockingLine = ld;
|
||||||
|
|
|
@ -340,6 +340,7 @@ static FFlagDef ActorFlagDefs[]=
|
||||||
DEFINE_FLAG(MF8, STAYONLIFT, AActor, flags8),
|
DEFINE_FLAG(MF8, STAYONLIFT, AActor, flags8),
|
||||||
DEFINE_FLAG(MF8, DONTFOLLOWPLAYERS, AActor, flags8),
|
DEFINE_FLAG(MF8, DONTFOLLOWPLAYERS, AActor, flags8),
|
||||||
DEFINE_FLAG(MF8, SEEFRIENDLYMONSTERS, AActor, flags8),
|
DEFINE_FLAG(MF8, SEEFRIENDLYMONSTERS, AActor, flags8),
|
||||||
|
DEFINE_FLAG(MF8, CROSSLINECHECK, AActor, flags8),
|
||||||
|
|
||||||
// Effect flags
|
// Effect flags
|
||||||
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
||||||
|
|
|
@ -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, Vector3 next)
|
virtual bool CanCrossLine(Line crossing, Vector3 next)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue