From 8364b41cd1ae1f72d0260794d866340b71398db0 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 26 Apr 2001 16:18:31 +0000 Subject: [PATCH] --- source/enemy/ndustdev.cpp | 31 ++++++++++++++++++++++++++++--- source/enemy/ndustdev.h | 1 + 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/source/enemy/ndustdev.cpp b/source/enemy/ndustdev.cpp index 2749dda0e..0216ba78f 100644 --- a/source/enemy/ndustdev.cpp +++ b/source/enemy/ndustdev.cpp @@ -39,6 +39,8 @@ void CNpcDustDevilEnemy::processMovement( int _frames ) s32 moveX = 0; s32 moveY = 0; + s32 moveVel = 0; + s32 moveDist = 0; bool pathComplete; @@ -117,6 +119,29 @@ void CNpcDustDevilEnemy::processMovement( int _frames ) } } - Pos.vx += moveX; - Pos.vy += moveY; -} \ No newline at end of file + processMovementModifier( _frames, moveX, moveY, moveVel, moveDist ); +} + +void CNpcDustDevilEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ) +{ + Pos.vx += distX; + Pos.vy += distY; + + // sort out draw rotation + + DVECTOR testPos1, testPos2; + + testPos1 = testPos2 = Pos; + testPos1.vx -= 10; + testPos2.vx += 10; + + testPos1.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 ); + testPos2.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 ); + + s32 xDist = testPos2.vx - testPos1.vx; + s32 yDist = testPos2.vy - testPos1.vy; + + s16 heading = ratan2( yDist, xDist ); + + m_drawRotation = heading; +} diff --git a/source/enemy/ndustdev.h b/source/enemy/ndustdev.h index 183346c33..fddf8abc6 100644 --- a/source/enemy/ndustdev.h +++ b/source/enemy/ndustdev.h @@ -20,6 +20,7 @@ public: virtual void postInit(); protected: virtual void processMovement( int _frames ); + virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); }; #endif \ No newline at end of file