mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-04-09 11:31:56 +00:00
This commit is contained in:
parent
36bfb54547
commit
c72c203b24
4 changed files with 47 additions and 0 deletions
|
@ -425,6 +425,7 @@ enum ActorFlag8
|
|||
MF8_STAYONLIFT = 0x02000000, // MBF AI enhancement.
|
||||
MF8_DONTFOLLOWPLAYERS = 0x04000000, // [inkoalawetrust] Friendly monster will not follow players.
|
||||
MF8_SEEFRIENDLYMONSTERS = 0X08000000, // [inkoalawetrust] Hostile monster can see friendly monsters.
|
||||
MF8_CROSSLINECHECK = 0x10000000, // [MC]Enables CanCrossLine virtual
|
||||
};
|
||||
|
||||
// --- mobj.renderflags ---
|
||||
|
|
|
@ -155,6 +155,38 @@ bool P_CanCollideWith(AActor *tmthing, AActor *thing)
|
|||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CanCrossLine
|
||||
//
|
||||
// Checks if an actor can cross a line after all checks are processed.
|
||||
// If false, the line blocks them.
|
||||
//==========================================================================
|
||||
|
||||
bool P_CanCrossLine(AActor *mo, line_t *line, DVector3 next)
|
||||
{
|
||||
static unsigned VIndex = ~0u;
|
||||
if (VIndex == ~0u)
|
||||
{
|
||||
VIndex = GetVirtualIndex(RUNTIME_CLASS(AActor), "CanCrossLine");
|
||||
assert(VIndex != ~0u);
|
||||
}
|
||||
|
||||
VMValue params[] = { mo, line, next.X, next.Y, next.Z, false };
|
||||
VMReturn ret;
|
||||
int retval;
|
||||
ret.IntAt(&retval);
|
||||
|
||||
auto clss = mo->GetClass();
|
||||
VMFunction *func = clss->Virtuals.Size() > VIndex ? clss->Virtuals[VIndex] : nullptr;
|
||||
if (func != nullptr)
|
||||
{
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
return retval;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FindRefPoint
|
||||
|
@ -953,6 +985,13 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
}
|
||||
}
|
||||
|
||||
if ((tm.thing->flags8 & MF8_CROSSLINECHECK) && !P_CanCrossLine(tm.thing, ld, tm.pos))
|
||||
{
|
||||
if (wasfit)
|
||||
tm.thing->BlockingLine = ld;
|
||||
|
||||
return false;
|
||||
}
|
||||
// If the floor planes on both sides match we should recalculate open.bottom at the actual position we are checking
|
||||
// This is to avoid bumpy movement when crossing a linedef with the same slope on both sides.
|
||||
// This should never narrow down the opening, though, only widen it.
|
||||
|
|
|
@ -340,6 +340,7 @@ static FFlagDef ActorFlagDefs[]=
|
|||
DEFINE_FLAG(MF8, STAYONLIFT, AActor, flags8),
|
||||
DEFINE_FLAG(MF8, DONTFOLLOWPLAYERS, AActor, flags8),
|
||||
DEFINE_FLAG(MF8, SEEFRIENDLYMONSTERS, AActor, flags8),
|
||||
DEFINE_FLAG(MF8, CROSSLINECHECK, AActor, flags8),
|
||||
|
||||
// Effect flags
|
||||
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
||||
|
|
|
@ -506,6 +506,12 @@ class Actor : Thinker native
|
|||
return true;
|
||||
}
|
||||
|
||||
// Called by PIT_CheckLine to check if an actor can cross a line.
|
||||
virtual bool CanCrossLine(Line crossing, Vector3 next)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Called by revival/resurrection to check if one can resurrect the other.
|
||||
// "other" can be null when not passive.
|
||||
virtual bool CanResurrect(Actor other, bool passive)
|
||||
|
|
Loading…
Reference in a new issue