This commit is contained in:
Charles 2001-04-03 22:01:52 +00:00
parent 14289f447b
commit 37852c12a2
7 changed files with 84 additions and 11 deletions

View file

@ -31,6 +31,19 @@
void CNpcEnemy::processCloseEyeballAttack( int _frames )
{
if ( Next )
{
CProjectile *projectile;
projectile = (CProjectile *) Next;
if ( projectile->getMovementType() == CProjectile::PROJECTILE_FIXED )
{
projectile->setMovementType( CProjectile::PROJECTILE_USER_SEEK );
projectile->setState( CProjectile::PROJECTILE_ATTACK );
}
}
/*if ( Next )
{
// already have child, ignore
}
@ -40,8 +53,8 @@ void CNpcEnemy::processCloseEyeballAttack( int _frames )
CProjectile *projectile;
projectile = new ( "test projectile" ) CProjectile;
projectile->init( Pos, m_fireHeading, CProjectile::PROJECTILE_USER_SEEK, CProjectile::PROJECTILE_INFINITE_LIFE );
projectile->init( Pos, m_fireHeading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE );
addChild( projectile );
}
}*/
}

View file

@ -52,6 +52,10 @@
#include "system\vid.h"
#endif
#ifndef __PROJECTL_PROJECTL_H__
#include "projectl\projectl.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Friend NPCs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -274,7 +278,12 @@ void CNpcEnemy::init()
setCollisionCentreOffset( 0, -( ofs.vy >> 1 ) );
m_positionHistory = NULL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::postInit()
{
switch ( m_data[this->m_type].initFunc )
{
case NPC_INIT_DEFAULT:
@ -426,6 +435,17 @@ void CNpcEnemy::init()
break;
}
case NPC_INIT_EYEBALL:
{
CProjectile *projectile;
projectile = new ( "eyeball projectile" ) CProjectile;
projectile->init( Pos, m_fireHeading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE );
addChild( projectile );
break;
}
case NPC_INIT_CIRCULAR_PLATFORM:
{
Pos.vx = 300;
@ -557,9 +577,9 @@ void CNpcEnemy::think(int _frames)
{
int frameCount = m_actorGfx->getFrameCount(m_animNo);
if ( frameCount - m_frame > _frames )
if ( frameCount - m_frame > _frames >> 1 )
{
m_frame += _frames;
m_frame += _frames >> 1;
}
else
{
@ -1400,9 +1420,14 @@ void CNpcEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing )
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
removeChild( sourceThing );
sourceThing->shutdown();
delete sourceThing;
//removeChild( sourceThing );
//sourceThing->shutdown();
//delete sourceThing;
CProjectile *projectile;
projectile = (CProjectile *) sourceThing;
projectile->setMovementType( CProjectile::PROJECTILE_FIXED );
projectile->setPosition( Pos );
break;
}

View file

@ -158,6 +158,7 @@ public:
};
void init();
void postInit();
void shutdown();
void think(int _frames);
void render();
@ -200,6 +201,7 @@ protected:
NPC_INIT_PARASITIC_WORM,
NPC_INIT_PARASITIC_WORM_SEGMENT,
NPC_INIT_HERMIT_CRAB,
NPC_INIT_EYEBALL,
};
enum NPC_CONTROL_FUNC
@ -554,7 +556,6 @@ protected:
};
CNpcPositionHistory *m_positionHistory;
};

View file

@ -616,7 +616,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{ // NPC_EYEBALL
ACTORS_EYEBALL_SBK,
ANIM_EYEBALL_STALK,
NPC_INIT_DEFAULT,
NPC_INIT_EYEBALL,
NPC_SENSOR_EYEBALL_USER_CLOSE,
NPC_MOVEMENT_STATIC,
NPC_MOVEMENT_MODIFIER_NONE,