Skip to content

Make Dead / NoClipHeight Objects Immune to Death Pits (Resolves #553)

SMS Alfredo requested to merge SMS_Alfredo/SRB2:pit-savior into next

For whatever reason, pretty much every single object in the game that isn't the player or an enemy gets deleted when touching a death pit. No if ands or buts. This really doesn't make sense when an object is already dead, or when it should clip through the death pit anyways. This merge request fixes that. Any object that either has no health, MF_NOCLIPHEIGHT, or MF2_BOSSDEAD will no longer be affected by pits.

This fixes Tails' tails spazzing out while standing on a pit. The reason this happens is because his tails are being constantly despawned by the pit he's standing on. But now with this merge request, since the object has MF_NOCLIPHEIGHT, they won't be affected by the pit at all and will animate like normal.

Before:

srb20262

After:

srb20043

This also finally gives MF2_BOSSDEAD an actual use in the code, instead of being completely unused. So now it can be applied in situations like #553 (closed) to prevent objects from being eaten by pits.

In addition, P_SceneryZMovement's death pit check now has a !mo->player check like its non-scenery counterpart. This is to make sure that, if for whatever reason the player has MF_SCENERY, they won't get deleted by a pit.

Update: Added in changes similar to that of !1290 (closed) that simplifies the pit checking code and gets rid of any redundancy the code has.

Test exe: pitsavior2.exe

Edited by SMS Alfredo

Merge request reports