Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added is3DFloor parameter to SpecialBounceHit #2944

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ class AActor final : public DThinker
// Called when bouncing to allow for custom behavior.
// Returns -1 for normal behavior, 0 to stop, and 1 to keep going.
// (virtual on the script side only)
int SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane);
int SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane, bool is3DFloor);

// Returns true if it's okay to switch target to "other" after being attacked by it.
bool CallOkayToSwitchTarget(AActor *other);
Expand Down
4 changes: 2 additions & 2 deletions src/playsim/p_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3608,7 +3608,7 @@ bool FSlide::BounceWall(AActor *mo)

if (mo->flags & MF_MISSILE)
{
switch (mo->SpecialBounceHit(nullptr, line, nullptr))
switch (mo->SpecialBounceHit(nullptr, line, nullptr, false))
{
case 1: return true;
case 0: return false;
Expand Down Expand Up @@ -3708,7 +3708,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
default: break;
}

switch (mo->SpecialBounceHit(BlockingMobj, nullptr, nullptr))
switch (mo->SpecialBounceHit(BlockingMobj, nullptr, nullptr, false))
{
case 1: return true;
case 0: return false;
Expand Down
8 changes: 4 additions & 4 deletions src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor)
{
if (flags & MF_MISSILE)
{
switch (SpecialBounceHit(nullptr, nullptr, &plane))
switch (SpecialBounceHit(nullptr, nullptr, &plane, is3DFloor))
{
// This one is backwards for some reason...
case 1: return false;
Expand Down Expand Up @@ -3420,15 +3420,15 @@ int AActor::SpecialMissileHit (AActor *victim)
}

// This virtual method only exists on the script side.
int AActor::SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane)
int AActor::SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane, bool is3DFloor)
{
IFVIRTUAL(AActor, SpecialBounceHit)
{
VMValue params[4] = { (DObject*)this, bounceMobj, bounceLine, bouncePlane };
VMValue params[] = { (DObject*)this, bounceMobj, bounceLine, bouncePlane, is3DFloor };
VMReturn ret;
int retval;
ret.IntAt(&retval);
VMCall(func, params, 4, &ret, 1);
VMCall(func, params, 5, &ret, 1);
return retval;
}
else return -1;
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ class Actor : Thinker native
}

// This is called when a missile bounces off something.
virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane)
virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane, bool is3DFloor = false)
{
return MHIT_DEFAULT;
}
Expand Down