SBSPSS/source/projectl/prnpcspr.cpp

102 lines
2.5 KiB
C++
Raw Normal View History

2001-05-05 00:33:37 +02:00
/*=========================================================================
prnpcspr.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
#ifndef __PROJECTL_PRNPCSPR_H__
#include "projectl\prnpcspr.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
2001-05-25 20:43:47 +02:00
#include "game/game.h"
2001-06-14 18:07:48 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CEnemyAsSpriteProjectile *CEnemyAsSpriteProjectile::Create()
{
CEnemyAsSpriteProjectile *projectile;
projectile = (CEnemyAsSpriteProjectile*)CThingManager::GetThing(TYPE_PLAYERPROJECTILE,0);
if ( !projectile )
{
projectile = new ("player projectile") CEnemyAsSpriteProjectile;
}
ASSERT(projectile);
return( projectile );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-05-05 00:33:37 +02:00
void CEnemyAsSpriteProjectile::think( int _frames )
{
CPlayerProjectile::think( _frames );
m_rotation += 512;
m_rotation &= 4095;
}
2001-06-14 18:07:48 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-05-05 00:33:37 +02:00
void CEnemyAsSpriteProjectile::setGraphic( int frame )
{
m_spriteFrame = frame;
2001-05-16 21:45:43 +02:00
m_rotation = 0;
2001-05-05 00:33:37 +02:00
}
2001-06-14 18:07:48 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-05-05 00:33:37 +02:00
void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
{
m_R = R;
m_G = G;
m_B = B;
}
2001-06-14 18:07:48 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-05-05 00:33:37 +02:00
void CEnemyAsSpriteProjectile::render()
{
sFrameHdr *frameHdr;
DVECTOR offset;
int x,y;
int scrnWidth = VidGetScrW();
int scrnHeight = VidGetScrH();
2001-05-25 20:43:47 +02:00
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
2001-05-05 00:33:37 +02:00
offset = getScreenOffset();
x = Pos.vx - offset.vx;
y = Pos.vy - offset.vy;
if ( x < -spriteWidth || y < -spriteHeight || x > scrnWidth || y > scrnHeight )
{
return;
}
2001-05-25 20:43:47 +02:00
frameHdr = CGameScene::getSpriteBank()->getFrameHeader( m_spriteFrame );
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_rotation, 0 );
2001-05-05 00:33:37 +02:00
if ( m_hasRGB )
{
setRGB0( SprFrame, m_R, m_G, m_B );
}
}