This commit is contained in:
Charles 2001-05-03 20:47:20 +00:00
parent 352fdae548
commit 0ef5e735f7
3 changed files with 112 additions and 0 deletions

View File

@ -27,6 +27,10 @@
#include "game\game.h" #include "game\game.h"
#endif #endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
#ifndef __PLAYER_PLAYER_H__ #ifndef __PLAYER_PLAYER_H__
#include "player\player.h" #include "player\player.h"
#endif #endif
@ -39,17 +43,23 @@
#include <ACTOR_SPIKEYANENOME_ANIM.h> #include <ACTOR_SPIKEYANENOME_ANIM.h>
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemoneEnemy::postInit() void CNpcAnemoneEnemy::postInit()
{ {
CNpcEnemy::postInit(); CNpcEnemy::postInit();
m_drawRotation = m_heading + 1024; m_drawRotation = m_heading + 1024;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing ) void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing )
{ {
// do nothing // do nothing
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcAnemoneEnemy::processSensor() bool CNpcAnemoneEnemy::processSensor()
{ {
switch( m_sensorFunc ) switch( m_sensorFunc )
@ -73,6 +83,8 @@ bool CNpcAnemoneEnemy::processSensor()
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone1Enemy::processClose( int _frames ) void CNpcAnemone1Enemy::processClose( int _frames )
{ {
s32 moveX, moveY; s32 moveX, moveY;
@ -200,6 +212,8 @@ void CNpcAnemone1Enemy::processClose( int _frames )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::postInit() void CNpcAnemone2Enemy::postInit()
{ {
CProjectile *projectile; CProjectile *projectile;
@ -228,14 +242,21 @@ void CNpcAnemone2Enemy::postInit()
} }
m_drawRotation = m_heading + 1024; m_drawRotation = m_heading + 1024;
m_scaleX = ONE;
m_scaleY = ONE;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::shutdown() void CNpcAnemone2Enemy::shutdown()
{ {
deleteAllChild(); deleteAllChild();
CNpcEnemy::shutdown(); CNpcEnemy::shutdown();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processClose( int _frames ) void CNpcAnemone2Enemy::processClose( int _frames )
{ {
int fireLoop; int fireLoop;
@ -306,6 +327,92 @@ void CNpcAnemone2Enemy::processClose( int _frames )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
s32 maxTimer = GameState::getOneSecondInFrames() >> 1;
m_movementTimer += _frames;
if ( m_movementTimer > maxTimer )
{
m_movementTimer -= maxTimer;
}
s32 sineVal = ( m_movementTimer * ONE ) / maxTimer;
m_scaleX = ONE + ( rsin( sineVal ) >> 2 );
m_scaleY = ONE + ( rcos( sineVal ) >> 2 );
CProjectile *projectile;
projectile = (CProjectile *) Next;
for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ )
{
DVECTOR spikePos;
s16 heading = m_heading - 1024 + ( fireLoop * 512 );
heading &= 4095;
spikePos = Pos;
s16 multiplier, multiplier2;
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
multiplier = ( m_scaleX * 40 ) >> 12;
multiplier2 = ( m_scaleY * 40 ) >> 12;
multiplier += multiplier2;
multiplier >>= 1;
spikePos.vx += ( multiplier * rcos( heading ) ) >> 12;
spikePos.vy += ( multiplier * rsin( heading ) ) >> 12;
if ( projectile )
{
projectile->setPos( spikePos );
projectile = (CProjectile *) projectile->getNext();
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone2Enemy::render()
{
SprFrame = NULL;
if ( m_isActive )
{
CEnemyThing::render();
// 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,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, m_scaleX, m_scaleY );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemone3Enemy::processClose( int _frames ) void CNpcAnemone3Enemy::processClose( int _frames )
{ {
if ( m_animNo != ANIM_ANENOME_FIRE ) if ( m_animNo != ANIM_ANENOME_FIRE )

View File

@ -38,8 +38,12 @@ class CNpcAnemone2Enemy : public CNpcAnemoneEnemy
public: public:
virtual void postInit(); virtual void postInit();
virtual void shutdown(); virtual void shutdown();
virtual void render();
protected: protected:
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
u16 m_scaleX, m_scaleY;
}; };
class CNpcAnemone3Enemy : public CNpcAnemoneEnemy class CNpcAnemone3Enemy : public CNpcAnemoneEnemy

View File

@ -51,6 +51,7 @@ public:
void setToShutdown(); void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );} u8 isSetToShutdown() {return( m_isShuttingDown );}
void think(int _frames); void think(int _frames);
void setPos( DVECTOR newPos ) {Pos = newPos;}
virtual void render(); virtual void render();
void processEvent( GAME_EVENT evt, CThing *sourceThing ); void processEvent( GAME_EVENT evt, CThing *sourceThing );
void setMovementType( PROJECTILE_MOVEMENT_TYPE moveType ); void setMovementType( PROJECTILE_MOVEMENT_TYPE moveType );