Added Z collision detection

This commit is contained in:
Boondorl 2023-12-16 01:45:21 -05:00 committed by Rachael Alexanderson
parent fc6191deb9
commit cf7654bb5a

View file

@ -170,6 +170,25 @@ bool P_CanCollideWith(AActor *tmthing, AActor *thing)
return true; 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 // CanCrossLine
@ -2046,8 +2065,15 @@ AActor *P_CheckOnmobj(AActor *thing)
oldz = thing->Z(); oldz = thing->Z();
P_FakeZMovement(thing); P_FakeZMovement(thing);
good = P_TestMobjZ(thing, false, &onmobj); 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; 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 // P_TryMove