mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-18 23:52:02 +00:00
Added Z collision detection
This commit is contained in:
parent
fc6191deb9
commit
cf7654bb5a
1 changed files with 27 additions and 20 deletions
|
@ -170,6 +170,25 @@ bool P_CanCollideWith(AActor *tmthing, AActor *thing)
|
|||
return true;
|
||||
}
|
||||
|
||||
void P_CollidedWith(AActor* const collider, AActor* const collidee)
|
||||
{
|
||||
{
|
||||
IFVIRTUALPTR(collider, AActor, CollidedWith)
|
||||
{
|
||||
VMValue params[] = { collider, collidee, false };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IFVIRTUALPTR(collidee, AActor, CollidedWith)
|
||||
{
|
||||
VMValue params[] = { collidee, collider, true };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CanCrossLine
|
||||
|
@ -2046,8 +2065,15 @@ AActor *P_CheckOnmobj(AActor *thing)
|
|||
oldz = thing->Z();
|
||||
P_FakeZMovement(thing);
|
||||
good = P_TestMobjZ(thing, false, &onmobj);
|
||||
thing->SetZ(oldz);
|
||||
|
||||
// Make sure we don't double call a collision with it.
|
||||
if (!good && onmobj != nullptr && onmobj != thing->BlockingMobj
|
||||
&& (thing->player == nullptr || !(thing->player->cheats & CF_PREDICTING)))
|
||||
{
|
||||
P_CollidedWith(thing, onmobj);
|
||||
}
|
||||
|
||||
thing->SetZ(oldz);
|
||||
return good ? NULL : onmobj;
|
||||
}
|
||||
|
||||
|
@ -2257,25 +2283,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 *
|
|||
}
|
||||
}
|
||||
|
||||
static void P_CollidedWith(AActor* const collider, AActor* const collidee)
|
||||
{
|
||||
{
|
||||
IFVIRTUALPTR(collider, AActor, CollidedWith)
|
||||
{
|
||||
VMValue params[] = { collider, collidee, false };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IFVIRTUALPTR(collidee, AActor, CollidedWith)
|
||||
{
|
||||
VMValue params[] = { collidee, collider, true };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_TryMove
|
||||
|
|
Loading…
Reference in a new issue