diff --git a/source/projectl/prnpc.cpp b/source/projectl/prnpc.cpp new file mode 100644 index 000000000..d38cb0db5 --- /dev/null +++ b/source/projectl/prnpc.cpp @@ -0,0 +1,59 @@ +/*========================================================================= + + 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; + + if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() ) + { + if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() ) + { + SprFrame = m_actorGfx->Render(renderPos,0,0,0); + m_actorGfx->RotateScale( SprFrame, renderPos, m_rotation, 4096, 4096 ); + } + } +} diff --git a/source/projectl/prnpc.h b/source/projectl/prnpc.h new file mode 100644 index 000000000..201878894 --- /dev/null +++ b/source/projectl/prnpc.h @@ -0,0 +1,41 @@ +/*========================================================================= + + prnpc.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PROJECTL_PRNPC_H__ +#define __PROJECTL_PRNPC_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 CEnemyAsProjectile : public CPlayerProjectile +{ +public: + void render(); + void setGraphic( CActorGfx *graphic ); + virtual void think(int _frames); +protected: + CActorGfx *m_actorGfx; + POLY_FT4 *SprFrame; + s16 m_rotation; +}; + +#endif \ No newline at end of file