From dc6bcf65abf7cc718436c38d128e1c8f81688779 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 26 Apr 2001 15:13:31 +0000 Subject: [PATCH] --- source/enemy/npbug.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 source/enemy/npbug.cpp diff --git a/source/enemy/npbug.cpp b/source/enemy/npbug.cpp new file mode 100644 index 000000000..3f47d6ea4 --- /dev/null +++ b/source/enemy/npbug.cpp @@ -0,0 +1,44 @@ +/*========================================================================= + + npbug.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NPBUG_H__ +#include "enemy\npbug.h" +#endif + +#ifndef __LAYER_COLLISION_H__ +#include "level\layercollision.h" +#endif + +void CNpcPricklyBugEnemy::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; +}