diff --git a/source/hazard/hbarrel.cpp b/source/hazard/hbarrel.cpp index 1a8609420..63224f341 100644 --- a/source/hazard/hbarrel.cpp +++ b/source/hazard/hbarrel.cpp @@ -26,6 +26,7 @@ void CNpcBarrelHazard::init() CNpcHazard::init(); m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); + m_rotation = 0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,41 @@ void CNpcBarrelHazard::processMovement( int _frames ) } } + if ( moveX < 0 ) + { + m_rotation -= 64 * _frames; + m_rotation &= 4095; + } + else if ( moveX > 0 ) + { + m_rotation += 64 * _frames; + m_rotation &= 4095; + } + Pos.vx += moveX; Pos.vy += moveY; -} \ No newline at end of file +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcBarrelHazard::render() +{ + CHazardThing::render(); + + if (canRender()) + { + DVECTOR &renderPos=getRenderPos(); + + SVECTOR rotation; + rotation.vx = 0; + rotation.vy = 0; + rotation.vz = m_rotation; + + VECTOR scale; + scale.vx = ONE; + scale.vy = ONE; + scale.vz = ONE; + + m_modelGfx->Render(renderPos,&rotation,&scale); + } +} diff --git a/source/hazard/hbarrel.h b/source/hazard/hbarrel.h index 3b928ca44..fa1c0f2b3 100644 --- a/source/hazard/hbarrel.h +++ b/source/hazard/hbarrel.h @@ -22,8 +22,11 @@ class CNpcBarrelHazard : public CNpcHazard { public: void init(); + void render(); protected: void processMovement( int _frames ); + + s16 m_rotation; }; #endif \ No newline at end of file