This commit is contained in:
parent
37480a598d
commit
0000a0bbe5
2 changed files with 119 additions and 0 deletions
73
source/projectl/prnpcspr.cpp
Normal file
73
source/projectl/prnpcspr.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
|
||||
void CEnemyAsSpriteProjectile::think( int _frames )
|
||||
{
|
||||
CPlayerProjectile::think( _frames );
|
||||
|
||||
m_rotation += 512;
|
||||
m_rotation &= 4095;
|
||||
}
|
||||
|
||||
void CEnemyAsSpriteProjectile::setGraphic( int frame )
|
||||
{
|
||||
m_spriteFrame = frame;
|
||||
}
|
||||
|
||||
void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
|
||||
{
|
||||
m_R = R;
|
||||
m_G = G;
|
||||
m_B = B;
|
||||
}
|
||||
|
||||
void CEnemyAsSpriteProjectile::render()
|
||||
{
|
||||
sFrameHdr *frameHdr;
|
||||
DVECTOR offset;
|
||||
int x,y;
|
||||
int scrnWidth = VidGetScrW();
|
||||
int scrnHeight = VidGetScrH();
|
||||
int spriteWidth = m_spriteBank->getFrameWidth( m_spriteFrame );
|
||||
int spriteHeight = m_spriteBank->getFrameHeight( m_spriteFrame );
|
||||
|
||||
offset = getScreenOffset();
|
||||
|
||||
x = Pos.vx - offset.vx;
|
||||
y = Pos.vy - offset.vy;
|
||||
|
||||
if ( x < -spriteWidth || y < -spriteHeight || x > scrnWidth || y > scrnHeight )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
frameHdr = m_spriteBank->getFrameHeader( m_spriteFrame );
|
||||
POLY_FT4 *SprFrame = m_spriteBank->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_rotation, 0 );
|
||||
|
||||
if ( m_hasRGB )
|
||||
{
|
||||
setRGB0( SprFrame, m_R, m_G, m_B );
|
||||
}
|
||||
}
|
46
source/projectl/prnpcspr.h
Normal file
46
source/projectl/prnpcspr.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*=========================================================================
|
||||
|
||||
prnpcspr.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2000 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PROJECTL_PRNPCSPR_H__
|
||||
#define __PROJECTL_PRNPCSPR_H__
|
||||
|
||||
#ifndef __PROJECTL_PROJECTL_H__
|
||||
#include "projectl\projectl.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GFX_SPRBANK_H__
|
||||
#include "gfx\sprbank.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ACTOR_HEADER__
|
||||
#include "gfx\actor.h"
|
||||
#endif
|
||||
|
||||
class CEnemyAsSpriteProjectile : public CPlayerProjectile
|
||||
{
|
||||
public:
|
||||
void render();
|
||||
void setGraphic( int frame );
|
||||
void setRGB( int R, int G, int B );
|
||||
void setHasRGB( u8 hasRGB ) {m_hasRGB = hasRGB;}
|
||||
virtual void think(int _frames);
|
||||
protected:
|
||||
s16 m_rotation;
|
||||
int m_spriteFrame;
|
||||
int m_R;
|
||||
int m_G;
|
||||
int m_B;
|
||||
u8 m_hasRGB;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue