This commit is contained in:
Charles 2001-05-04 20:11:44 +00:00
parent ea618523f8
commit 6f4ea38c12
7 changed files with 112 additions and 10 deletions

View File

@ -79,7 +79,8 @@ enemy_src := npc \
ngen \
nsdart \
ndustdev \
npbug
npbug \
nprojjf
friend_src := friend \
fdata \

View File

@ -19,6 +19,10 @@
#include "enemy\nmjfish.h"
#endif
#ifndef __ENEMY_NPROJJF_H__
#include "enemy\nprojjf.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
@ -35,11 +39,16 @@
#define MJ_HALF_CYCLE_WIDTH ( MJ_CYCLE_WIDTH >> 1 )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::postInit()
{
m_state = MOTHER_JELLYFISH_RETURN_TO_START_1;
m_spawnTimer = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
{
s32 xDist, yDist;
@ -102,6 +111,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
{
m_controlFunc = NPC_CONTROL_CLOSE;
m_state++;
m_jellyfishCount = 3;
}
}
}
@ -126,6 +136,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
{
m_controlFunc = NPC_CONTROL_CLOSE;
m_state++;
m_jellyfishCount = 3;
}
}
}
@ -138,6 +149,8 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::processClose( int _frames )
{
switch( m_state )
@ -191,6 +204,8 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
Pos.vy = m_base.vy - ( ( 50 * rcos( ( xExtension << 11 ) / MJ_CYCLE_WIDTH ) ) >> 12 );
m_heading = 0;
spawnJellyfish( _frames );
}
else
{
@ -210,6 +225,8 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
Pos.vy = m_base.vy + ( ( 50 * rcos( ( xExtension << 11 ) / MJ_CYCLE_WIDTH ) ) >> 12 );
m_heading = 2048;
spawnJellyfish( _frames );
}
else
{
@ -225,6 +242,47 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames )
{
if ( m_jellyfishCount )
{
if ( m_spawnTimer > 0 )
{
m_spawnTimer -= _frames;
}
else
{
CNpcEnemy *enemy;
enemy = new( "jellyfish projectile" ) CNpcSmallJellyfishProjectileEnemy;
ASSERT(enemy);
enemy->setType( CNpcEnemy::NPC_PROJECTILE_JELLYFISH );
enemy->init();
enemy->setLayerCollision( m_layerCollision );
enemy->setStartPos( Pos.vx >> 4, ( Pos.vy + 20 ) >> 4 );
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();
if ( sourceWaypoint )
{
while( sourceWaypoint )
{
enemy->addWaypoint( sourceWaypoint->pos.vx >> 4, sourceWaypoint->pos.vy >> 4 );
sourceWaypoint = sourceWaypoint->nextWaypoint;
}
}
enemy->setPathType( CNpcPath::PONG_PATH );
enemy->postInit();
m_jellyfishCount--;
m_spawnTimer = 1 * GameState::getOneSecondInFrames();
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::render()
{
SprFrame = NULL;
@ -244,7 +302,7 @@ void CNpcMotherJellyfishEnemy::render()
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 8192, 8192 );
sBBox boundingBox = m_actorGfx->GetBBox();

View File

@ -22,6 +22,7 @@ public:
protected:
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
void spawnJellyfish( int _frames );
enum NPC_MOTHER_JELLYFISH_STATE
{
@ -35,6 +36,9 @@ protected:
MOTHER_JELLYFISH_CYCLE_3,
MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK,
};
int m_jellyfishCount;
s32 m_spawnTimer;
};
#endif

View File

@ -712,6 +712,20 @@ int CNpcEnemy::getFrameCount()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processGraphicFlipping()
{
if ( m_heading > 1024 && m_heading < 3072 )
{
m_reversed = true;
}
else
{
m_reversed = false;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::think(int _frames)
{
int moveFrames = _frames;
@ -789,14 +803,7 @@ void CNpcEnemy::think(int _frames)
break;
}
if ( m_heading > 1024 && m_heading < 3072 )
{
m_reversed = true;
}
else
{
m_reversed = false;
}
processGraphicFlipping();
}
}

View File

@ -80,6 +80,7 @@ public:
NPC_PARASITIC_WORM_SEGMENT,
NPC_BALL_BLOB,
NPC_SHELL,
NPC_PROJECTILE_JELLYFISH,
NPC_UNIT_TYPE_MAX,
};
@ -237,6 +238,7 @@ protected:
virtual void processClose( int _frames );
virtual void processCollision();
virtual void processAttackCollision();
virtual void processGraphicFlipping();
void processTimer( int _frames );
bool isCollisionWithGround();

View File

@ -949,6 +949,28 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
true,
},
{ // NPC_PROJECTILE_JELLYFISH
0,//ACTORS_JELLYFISH1_SBK,
FRM_JELLYFISH1_SWIM1,
NPC_SENSOR_USER_CLOSE,
NPC_MOVEMENT_FIXED_PATH,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
2,
128,
DETECT_ALL_COLLISION,
DAMAGE__SHOCK_ENEMY,
16,
FRM_JELLYFISH1_SWIM1,
NPC_SHOT_GENERIC,
0,
FRM_JELLYFISH1_SWIM1,
true,
true,
true,
},
};
CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] =

View File

@ -277,6 +277,14 @@ SOURCE=..\..\..\source\enemy\npcpath.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nprojjf.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nprojjf.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\npuffa.cpp
# End Source File
# Begin Source File