This commit is contained in:
parent
9beaeed67a
commit
f7200d6abe
2 changed files with 65 additions and 0 deletions
|
@ -23,6 +23,14 @@
|
||||||
#include "platform\platform.h"
|
#include "platform\platform.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VID_HEADER_
|
||||||
|
#include "system\vid.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __LEVEL_LEVEL_H__
|
||||||
|
#include "level\level.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcDualPlatformBarrelHazard::init()
|
void CNpcDualPlatformBarrelHazard::init()
|
||||||
|
@ -30,6 +38,9 @@ void CNpcDualPlatformBarrelHazard::init()
|
||||||
CNpcHazard::init();
|
CNpcHazard::init();
|
||||||
|
|
||||||
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
|
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
|
||||||
|
|
||||||
|
m_rotation = 0;
|
||||||
|
m_rotationDir = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -115,6 +126,18 @@ void CNpcDualPlatformBarrelHazard::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( moveX )
|
||||||
|
{
|
||||||
|
m_rotationDir = abs( moveX ) / moveX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_rotationDir = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rotation += m_rotationDir * 64 * _frames;
|
||||||
|
m_rotation &= 4095;
|
||||||
|
|
||||||
Pos.vx += moveX;
|
Pos.vx += moveX;
|
||||||
Pos.vy += moveY;
|
Pos.vy += moveY;
|
||||||
|
|
||||||
|
@ -128,3 +151,41 @@ void CNpcDualPlatformBarrelHazard::processMovement( int _frames )
|
||||||
m_npcPath.resetPath();
|
m_npcPath.resetPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcDualPlatformBarrelHazard::render()
|
||||||
|
{
|
||||||
|
CHazardThing::render();
|
||||||
|
|
||||||
|
// Render
|
||||||
|
DVECTOR renderPos;
|
||||||
|
DVECTOR offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
|
renderPos.vx = Pos.vx - offset.vx;
|
||||||
|
renderPos.vy = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
CRECT collisionRect = getCollisionArea();
|
||||||
|
collisionRect.x1 -= Pos.vx;
|
||||||
|
collisionRect.x2 -= Pos.vx;
|
||||||
|
collisionRect.y1 -= Pos.vy;
|
||||||
|
collisionRect.y2 -= Pos.vy;
|
||||||
|
|
||||||
|
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
||||||
|
{
|
||||||
|
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,8 +22,12 @@ class CNpcDualPlatformBarrelHazard : public CNpcHazard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
void render();
|
||||||
protected:
|
protected:
|
||||||
void processMovement( int _frames );
|
void processMovement( int _frames );
|
||||||
|
|
||||||
|
s16 m_rotation;
|
||||||
|
s8 m_rotationDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue