From eb031d73e74b7f535111e01f53e9f10000761210 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 18 Sep 2010 02:55:08 +0000 Subject: [PATCH] - Change the time when walking monsters step down steps to just after the step rather than just before. This allows for thrusting walking monsters vertically without them suddenly warping to the ground. SVN r2819 (trunk) --- src/p_enemy.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 1cf28aa5d..1a3de085a 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -427,20 +427,14 @@ bool P_Move (AActor *actor) return false; } - // [RH] Instead of yanking non-floating monsters to the ground, - // let gravity drop them down, unless they're moving down a step. + // [RH] Walking actors that are not on the ground cannot walk. We don't + // want to yank them to the ground here as Doom did, since that makes + // it difficult ot thrust them vertically in a reasonable manner. // [GZ] Let jumping actors jump. if (!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) && actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) { - if (actor->z > actor->floorz + actor->MaxStepHeight) - { - return false; - } - else - { - actor->z = actor->floorz; - } + return false; } if ((unsigned)actor->movedir >= 8) @@ -537,6 +531,26 @@ bool P_Move (AActor *actor) actor->vely += FixedMul (deltay, movefactor); } + // [RH] If a walking monster is no longer on the floor, move it down + // to the floor if it is within MaxStepHeight, presuming that it is + // actually walking down a step. + if (try_ok && + !((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) + && actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) + { + if (actor->z <= actor->floorz + actor->MaxStepHeight) + { + fixed_t savedz = actor->z; + actor->z = actor->floorz; + // Make sure that there isn't some other actor between us and + // the floor we could get stuck in. The old code did not do this. + if (!P_TestMobjZ(actor)) + { + actor->z = savedz; + } + } + } + if (!try_ok) { if (((actor->flags6 & MF6_CANJUMP)||(actor->flags & MF_FLOAT)) && tm.floatok)