81 lines
1.8 KiB
C++
81 lines
1.8 KiB
C++
/*=========================================================================
|
|
|
|
hcsaw.cpp
|
|
|
|
Author: CRB
|
|
Created:
|
|
Project: Spongebob
|
|
Purpose:
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
===========================================================================*/
|
|
|
|
#ifndef __HAZARD_HCSAW_H__
|
|
#include "hazard\hcsaw.h"
|
|
#endif
|
|
|
|
#ifndef __VID_HEADER_
|
|
#include "system\vid.h"
|
|
#endif
|
|
|
|
#ifndef __LEVEL_LEVEL_H__
|
|
#include "level\level.h"
|
|
#endif
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void CNpcCircularSawHazard::init()
|
|
{
|
|
CNpcHazard::init();
|
|
|
|
m_rotation = 0;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void CNpcCircularSawHazard::processMovement( int _frames )
|
|
{
|
|
m_rotation += 256 * _frames;
|
|
m_rotation &= 4095;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void CNpcCircularSawHazard::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);
|
|
}
|
|
}
|
|
}
|