Add Pre/PostTeleport virtuals, for special handling of actor teleportation.
This commit is contained in:
parent
53199e4553
commit
e0aa8db616
2 changed files with 26 additions and 0 deletions
|
|
@ -148,6 +148,19 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
|
|||
pos.Z = floorheight;
|
||||
}
|
||||
}
|
||||
// [MK] notify thing of incoming teleport, check for an early cancel
|
||||
// if it returns false
|
||||
{
|
||||
int nocancel = 1;
|
||||
IFVIRTUALPTR(thing, AActor, PreTeleport)
|
||||
{
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees, flags };
|
||||
VMReturn ret;
|
||||
ret.IntAt(&nocancel);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
}
|
||||
if ( !nocancel ) return false;
|
||||
}
|
||||
if (!P_TeleportMove (thing, pos, false))
|
||||
{
|
||||
return false;
|
||||
|
|
@ -213,6 +226,14 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
|
|||
// killough 10/98: kill all bobbing velocity too
|
||||
if (player) player->Vel.Zero();
|
||||
}
|
||||
// [MK] notify thing of successful teleport
|
||||
{
|
||||
IFVIRTUALPTR(thing, AActor, PostTeleport)
|
||||
{
|
||||
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees, flags };
|
||||
VMCall(func, params, countof(params), nullptr, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue