SBSPSS/source/projectl/prnpc.cpp

66 lines
1.3 KiB
C++
Raw Normal View History

2001-04-30 20:54:26 +02:00
/*=========================================================================
prnpc.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
#ifndef __PROJECTL_PRNPC_H__
#include "projectl\prnpc.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
void CEnemyAsProjectile::think( int _frames )
{
CPlayerProjectile::think( _frames );
m_rotation += 512;
m_rotation &= 4095;
}
void CEnemyAsProjectile::setGraphic( CActorGfx *graphic )
{
m_actorGfx = graphic;
m_rotation = 0;
}
void CEnemyAsProjectile::render()
{
SprFrame = NULL;
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
2001-05-05 16:58:49 +02:00
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() )
2001-04-30 20:54:26 +02:00
{
2001-05-05 16:58:49 +02:00
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
2001-04-30 20:54:26 +02:00
{
SprFrame = m_actorGfx->Render(renderPos,0,0,0);
m_actorGfx->RotateScale( SprFrame, renderPos, m_rotation, 4096, 4096 );
}
}
}