From 3d7c6811c1d37fdf3d016b8e18e825a4f8661e29 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Jun 2012 10:17:49 +0000 Subject: [PATCH] - The bouncing check from r3643 cannot be applied retroactively to the existing DOOMBOUNCE flag because mods depend on the old behavior. Instead of modifying BOUNCE_OnOff's behavior the correct way of doing this has to be implemented as a separate flag in order to avoid problems. SVN r3685 (trunk) --- src/actor.h | 3 ++- src/p_map.cpp | 4 ++-- src/p_mobj.cpp | 12 ++++++++---- src/thingdef/thingdef_data.cpp | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/actor.h b/src/actor.h index 5574f864a2..ac51b6836e 100644 --- a/src/actor.h +++ b/src/actor.h @@ -402,7 +402,7 @@ enum EBounceFlags BOUNCE_Ceilings = 1<<2, // bounces off of ceilings BOUNCE_Actors = 1<<3, // bounces off of some actors BOUNCE_AllActors = 1<<4, // bounces off of all actors (requires BOUNCE_Actors to be set, too) - BOUNCE_AutoOff = 1<<5, // when bouncing off a floor, if the new Z velocity is below 3.0, disable further bouncing + BOUNCE_AutoOff = 1<<5, // when bouncing off a sector plane, if the new Z velocity is below 3.0, disable further bouncing BOUNCE_HereticType = 1<<6, // goes into Death state when bouncing on floors or ceilings BOUNCE_UseSeeSound = 1<<7, // compatibility fallback. This will only be set by @@ -414,6 +414,7 @@ enum EBounceFlags // MBF bouncing is a bit different from other modes as Killough coded many special behavioral cases // for them that are not present in ZDoom, so it is necessary to identify it properly. BOUNCE_MBF = 1<<12, // This in itself is not a valid mode, but replaces MBF's MF_BOUNCE flag. + BOUNCE_AutoOffFloorOnly = 1<<13, // like BOUNCE_AutoOff, but only on floors BOUNCE_TypeMask = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors | BOUNCE_AutoOff | BOUNCE_HereticType | BOUNCE_MBF, diff --git a/src/p_map.cpp b/src/p_map.cpp index 6f5496054c..1dc77dad2c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1822,7 +1822,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y, { goto pushline; } - if (thing->flags6 & MF6_STEPMISSILE) + if (thing->flags6 & MF6_STEPMISSILE) { thing->z = tm.floorz; // If moving down, cancel vertical component of the velocity @@ -2925,7 +2925,7 @@ bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop) if (abs(mo->velz) < (fixed_t)(mo->Mass * mo->GetGravity() / 64)) mo->velz = 0; } - else if (mo->BounceFlags & BOUNCE_AutoOff) + else if (mo->BounceFlags & (BOUNCE_AutoOff|BOUNCE_AutoOffFloorOnly)) { if (!(mo->flags & MF_NOGRAVITY) && (mo->velz < 3*FRACUNIT)) mo->BounceFlags &= ~BOUNCE_TypeMask; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 7bb67a5297..a014aa5f8d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1444,10 +1444,14 @@ bool AActor::FloorBounceMissile (secplane_t &plane) if (abs(velz) < (fixed_t)(Mass * GetGravity() / 64)) velz = 0; } - else if (plane.c > 0 && BounceFlags & BOUNCE_AutoOff) - { // AutoOff only works when bouncing off a floor, not a ceiling. - if (!(flags & MF_NOGRAVITY) && (velz < 3*FRACUNIT)) - BounceFlags &= ~BOUNCE_TypeMask; + else if (BounceFlags & (BOUNCE_AutoOff|BOUNCE_AutoOffFloorOnly)) + { + if (plane.c > 0 || (BounceFlags & BOUNCE_AutoOff)) + { + // AutoOff only works when bouncing off a floor, not a ceiling (or in compatibility mode.) + if (!(flags & MF_NOGRAVITY) && (velz < 3*FRACUNIT)) + BounceFlags &= ~BOUNCE_TypeMask; + } } return false; } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index bafa0fa8b9..f4ee1eedaf 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -256,6 +256,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG2(BOUNCE_AllActors, BOUNCEONACTORS, AActor, BounceFlags), DEFINE_FLAG2(BOUNCE_ExplodeOnWater, EXPLODEONWATER, AActor, BounceFlags), DEFINE_FLAG2(BOUNCE_MBF, MBFBOUNCER, AActor, BounceFlags), + DEFINE_FLAG2(BOUNCE_AutoOffFloorOnly, BOUNCEAUTOOFFFLOORONLY, AActor, BounceFlags), // Deprecated flags. Handling must be performed in HandleDeprecatedFlags DEFINE_DEPRECATED_FLAG(FIREDAMAGE),