This commit is contained in:
parent
ea618523f8
commit
6f4ea38c12
7 changed files with 112 additions and 10 deletions
|
@ -79,7 +79,8 @@ enemy_src := npc \
|
||||||
ngen \
|
ngen \
|
||||||
nsdart \
|
nsdart \
|
||||||
ndustdev \
|
ndustdev \
|
||||||
npbug
|
npbug \
|
||||||
|
nprojjf
|
||||||
|
|
||||||
friend_src := friend \
|
friend_src := friend \
|
||||||
fdata \
|
fdata \
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#include "enemy\nmjfish.h"
|
#include "enemy\nmjfish.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ENEMY_NPROJJF_H__
|
||||||
|
#include "enemy\nprojjf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __VID_HEADER_
|
#ifndef __VID_HEADER_
|
||||||
#include "system\vid.h"
|
#include "system\vid.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,11 +39,16 @@
|
||||||
#define MJ_HALF_CYCLE_WIDTH ( MJ_CYCLE_WIDTH >> 1 )
|
#define MJ_HALF_CYCLE_WIDTH ( MJ_CYCLE_WIDTH >> 1 )
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcMotherJellyfishEnemy::postInit()
|
void CNpcMotherJellyfishEnemy::postInit()
|
||||||
{
|
{
|
||||||
m_state = MOTHER_JELLYFISH_RETURN_TO_START_1;
|
m_state = MOTHER_JELLYFISH_RETURN_TO_START_1;
|
||||||
|
m_spawnTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
s32 xDist, yDist;
|
s32 xDist, yDist;
|
||||||
|
@ -102,6 +111,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
m_state++;
|
m_state++;
|
||||||
|
m_jellyfishCount = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +136,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
m_state++;
|
m_state++;
|
||||||
|
m_jellyfishCount = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +149,8 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcMotherJellyfishEnemy::processClose( int _frames )
|
void CNpcMotherJellyfishEnemy::processClose( int _frames )
|
||||||
{
|
{
|
||||||
switch( m_state )
|
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 );
|
Pos.vy = m_base.vy - ( ( 50 * rcos( ( xExtension << 11 ) / MJ_CYCLE_WIDTH ) ) >> 12 );
|
||||||
|
|
||||||
m_heading = 0;
|
m_heading = 0;
|
||||||
|
|
||||||
|
spawnJellyfish( _frames );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -210,6 +225,8 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
|
||||||
Pos.vy = m_base.vy + ( ( 50 * rcos( ( xExtension << 11 ) / MJ_CYCLE_WIDTH ) ) >> 12 );
|
Pos.vy = m_base.vy + ( ( 50 * rcos( ( xExtension << 11 ) / MJ_CYCLE_WIDTH ) ) >> 12 );
|
||||||
|
|
||||||
m_heading = 2048;
|
m_heading = 2048;
|
||||||
|
|
||||||
|
spawnJellyfish( _frames );
|
||||||
}
|
}
|
||||||
else
|
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()
|
void CNpcMotherJellyfishEnemy::render()
|
||||||
{
|
{
|
||||||
SprFrame = NULL;
|
SprFrame = NULL;
|
||||||
|
@ -244,7 +302,7 @@ void CNpcMotherJellyfishEnemy::render()
|
||||||
{
|
{
|
||||||
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
|
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 );
|
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 8192, 8192 );
|
||||||
|
|
||||||
sBBox boundingBox = m_actorGfx->GetBBox();
|
sBBox boundingBox = m_actorGfx->GetBBox();
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
void spawnJellyfish( int _frames );
|
||||||
|
|
||||||
enum NPC_MOTHER_JELLYFISH_STATE
|
enum NPC_MOTHER_JELLYFISH_STATE
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,9 @@ protected:
|
||||||
MOTHER_JELLYFISH_CYCLE_3,
|
MOTHER_JELLYFISH_CYCLE_3,
|
||||||
MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK,
|
MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int m_jellyfishCount;
|
||||||
|
s32 m_spawnTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -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)
|
void CNpcEnemy::think(int _frames)
|
||||||
{
|
{
|
||||||
int moveFrames = _frames;
|
int moveFrames = _frames;
|
||||||
|
@ -789,14 +803,7 @@ void CNpcEnemy::think(int _frames)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_heading > 1024 && m_heading < 3072 )
|
processGraphicFlipping();
|
||||||
{
|
|
||||||
m_reversed = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_reversed = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
NPC_PARASITIC_WORM_SEGMENT,
|
NPC_PARASITIC_WORM_SEGMENT,
|
||||||
NPC_BALL_BLOB,
|
NPC_BALL_BLOB,
|
||||||
NPC_SHELL,
|
NPC_SHELL,
|
||||||
|
NPC_PROJECTILE_JELLYFISH,
|
||||||
NPC_UNIT_TYPE_MAX,
|
NPC_UNIT_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -237,6 +238,7 @@ protected:
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
virtual void processCollision();
|
virtual void processCollision();
|
||||||
virtual void processAttackCollision();
|
virtual void processAttackCollision();
|
||||||
|
virtual void processGraphicFlipping();
|
||||||
void processTimer( int _frames );
|
void processTimer( int _frames );
|
||||||
bool isCollisionWithGround();
|
bool isCollisionWithGround();
|
||||||
|
|
||||||
|
|
|
@ -949,6 +949,28 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
false,
|
false,
|
||||||
true,
|
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] =
|
CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] =
|
||||||
|
|
|
@ -277,6 +277,14 @@ SOURCE=..\..\..\source\enemy\npcpath.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin 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
|
SOURCE=..\..\..\source\enemy\npuffa.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue