From 2c8c4fcb60f66d5ff6907f80963aacfe128b3fbf Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 8 Jun 2001 16:08:18 +0000 Subject: [PATCH] --- source/platform/praft.cpp | 47 ++++++++++++++++++++++++++++++++++++++- source/platform/praft.h | 1 + 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/source/platform/praft.cpp b/source/platform/praft.cpp index b500f0b5f..a4a88988d 100644 --- a/source/platform/praft.cpp +++ b/source/platform/praft.cpp @@ -139,4 +139,49 @@ void CNpcRaftPlatform::processMovement( int _frames ) m_isActivated = true; } } -} \ No newline at end of file + + // sort out rotation + + DVECTOR testPos1, testPos2; + + testPos1 = testPos2 = Pos; + testPos1.vx -= 10; + testPos2.vx += 10; + + testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 ); + testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 ); + + s32 xDist = testPos2.vx - testPos1.vx; + s32 yDist = testPos2.vy - testPos1.vy; + + s16 heading = ratan2( yDist, xDist ); + + setCollisionAngle( heading ); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRaftPlatform::render() +{ + if ( m_isActive ) + { + CPlatformThing::render(); + + if (canRender()) + { + DVECTOR &renderPos=getRenderPos(); + SVECTOR rotation; + + rotation.vx = 0; + rotation.vy = 0; + rotation.vz = getCollisionAngle(); + + VECTOR scale; + scale.vx = ONE; + scale.vy = ONE; + scale.vz = ONE; + + m_modelGfx->Render(renderPos,&rotation,&scale); + } + } +} diff --git a/source/platform/praft.h b/source/platform/praft.h index d227c4094..7d0e66ee9 100644 --- a/source/platform/praft.h +++ b/source/platform/praft.h @@ -22,6 +22,7 @@ class CNpcRaftPlatform : public CNpcPlatform { public: virtual void postInit(); + virtual void render(); protected: virtual void processMovement( int _frames );