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,

View File

@ -309,6 +309,8 @@ void CGameScene::initLevel()
enemy->addWaypoint( newXPos, newYPos );
}
}
enemy->postInit();
}
// Song is loaded/dumped by the level, and played from here. This just gives some

View File

@ -190,12 +190,39 @@ bool CProjectile::processTargetSeek( int _frames, DVECTOR targetPos )
}
}
void CProjectile::setMovementType( PROJECTILE_MOVEMENT_TYPE moveType )
{
m_movementType = moveType;
}
CProjectile::PROJECTILE_MOVEMENT_TYPE CProjectile::getMovementType()
{
return( m_movementType );
}
void CProjectile::setState( PROJECTILE_STATE newState )
{
m_state = newState;
}
void CProjectile::setPosition( DVECTOR newPos )
{
Pos = newPos;
}
void CProjectile::think(int _frames)
{
CEnemyProjectileThing::think( _frames );
switch( m_movementType )
{
case PROJECTILE_FIXED:
{
// don't move at all
break;
}
case PROJECTILE_USER_SEEK:
{
switch( m_state )

View File

@ -25,8 +25,9 @@ class CProjectile : public CEnemyProjectileThing
public:
enum PROJECTILE_MOVEMENT_TYPE
{
PROJECTILE_DUMBFIRE = 0,
PROJECTILE_USER_SEEK = 1,
PROJECTILE_FIXED = 0,
PROJECTILE_DUMBFIRE = 1,
PROJECTILE_USER_SEEK,
PROJECTILE_GAS_CLOUD,
};
@ -50,6 +51,10 @@ public:
void think(int _frames);
virtual void render();
void processEvent( GAME_EVENT evt, CThing *sourceThing );
void setMovementType( PROJECTILE_MOVEMENT_TYPE moveType );
PROJECTILE_MOVEMENT_TYPE getMovementType();
void setState( PROJECTILE_STATE newState );
void setPosition( DVECTOR newPos );
protected:
DVECTOR getScreenOffset();