This commit is contained in:
Charles 2001-04-30 18:55:38 +00:00
parent cfb4cb7ea2
commit 6961688ccd
7 changed files with 121 additions and 114 deletions

View File

@ -108,7 +108,8 @@ hazard_src := hazard \
hbarrel \
hboat
projectl_src := projectl
projectl_src := projectl \
prnpc
fileio_src := fileio \
$($(FILE_SYSTEM)_FILESYS_SRC)

View File

@ -51,6 +51,10 @@
#include "projectl\projectl.h"
#endif
#ifndef __PROJECTL_PRNPC_H__
#include "projectl\prnpc.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __ENEMY_NSJFISH_H__
@ -700,6 +704,8 @@ void CNpcEnemy::setToShutdown()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool gitTrigger = false;
int CNpcEnemy::getFrameCount()
{
return( m_actorGfx->getFrameCount( m_animNo ) );
@ -799,6 +805,11 @@ void CNpcEnemy::think(int _frames)
{
processTimer( moveFrames );
}
if ( gitTrigger )
{
fireAsProjectile( 0 );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1441,7 +1452,7 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist )
bool CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist )
{
s32 moveX, moveY;
s16 headingToTarget;
@ -1503,6 +1514,22 @@ void CNpcEnemy::processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist )
Pos.vx += moveX;
Pos.vy += moveY;
if ( moveX || moveY )
{
return( false );
}
else
{
return( true );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcEnemy::canBeSuckedUp()
{
return( m_data[m_type].canBeSuckedUp );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1512,6 +1539,8 @@ bool CNpcEnemy::suckUp( DVECTOR *suckPos, int _frames )
m_isCaught = true;
m_isBlowerOn = true;
bool returnVal = false;
switch( m_state )
{
case NPC_CORAL_BLOWER_SUCK:
@ -1521,7 +1550,7 @@ bool CNpcEnemy::suckUp( DVECTOR *suckPos, int _frames )
s32 targetXDist = suckPos->vx - Pos.vx;
s32 targetYDist = suckPos->vy - Pos.vy;
processCoralBlowerMovement( _frames, targetXDist, targetYDist );
returnVal = processCoralBlowerMovement( _frames, targetXDist, targetYDist );
break;
}
@ -1543,7 +1572,7 @@ bool CNpcEnemy::suckUp( DVECTOR *suckPos, int _frames )
}
}
return( false );
return( returnVal );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1594,3 +1623,25 @@ void CNpcEnemy::processCoralBlower( int _frames )
m_isBlowerOn = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::fireAsProjectile( s16 heading )
{
m_isActive = false;
setToShutdown();
DVECTOR newPos = Pos;
newPos.vy -= 10;
CEnemyAsProjectile *projectile;
projectile = new( "blower projectile" ) CEnemyAsProjectile;
projectile->init( newPos,
heading,
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,
CPlayerProjectile::PLAYER_PROJECTILE_FINITE_LIFE,
5*60);
projectile->setLayerCollision( m_layerCollision );
projectile->setGraphic( m_actorGfx );
}

View File

@ -116,7 +116,10 @@ public:
void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );}
bool canBeSuckedUp();
bool suckUp( DVECTOR *suckPos, int _frames );
void fireAsProjectile( s16 heading );
protected:
class CLayerCollision *m_layerCollision;
@ -212,7 +215,7 @@ protected:
NPC_MOVEMENT_FUNC movementFunc;
NPC_CLOSE_FUNC closeFunc;
NPC_TIMER_FUNC timerFunc;
bool canTalk;
u8 canTalk;
u8 speed;
u16 turnSpeed;
DETECT_TYPE detectCollision;
@ -222,8 +225,9 @@ protected:
NPC_SHOT_FUNC shotFunc;
u16 dieAnim;
u16 recoilAnim;
bool canBeNetted;
bool respawning;
u8 canBeNetted;
u8 respawning;
u8 canBeSuckedUp;
}
NPC_DATA;
@ -250,7 +254,7 @@ protected:
void reinit();
void processCoralBlower( int _frames );
void processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist );
bool processCoralBlowerMovement( int _frames, s32 xDist, s32 yDist );
// data

View File

@ -110,48 +110,6 @@
CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{
/*{ // NPC_FALLING_ITEM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_USER_CLOSE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
8,
128,
DETECT_NO_COLLISION,
DAMAGE__SQUASH_ENEMY,
0,
0,
NPC_SHOT_GENERIC,
0,
0,
false,
false,
},
{ // NPC_FISH_HOOK
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
128,
DETECT_NO_COLLISION,
DAMAGE__NONE,
0,
0,
NPC_SHOT_GENERIC,
0,
0,
false,
false,
},*/
{ // NPC_DUST_DEVIL
ACTORS_DUSTDEVIL_SBK,
ANIM_DUSTDEVIL_TWIST,
@ -171,71 +129,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
/*{ // NPC_PENDULUM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
2048,
DETECT_NO_COLLISION,
DAMAGE__HIT_ENEMY,
0,
0,
NPC_SHOT_GENERIC,
0,
0,
false,
false,
},*/
/*{ // NPC_FIREBALL
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
40,
2048,
DETECT_NO_COLLISION,
DAMAGE__BURN_ENEMY,
0,
0,
NPC_SHOT_GENERIC,
0,
0,
false,
false,
},*/
/*{ // NPC_SAW_BLADE
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
2048,
DETECT_NO_COLLISION,
DAMAGE__HIT_ENEMY,
0,
0,
NPC_SHOT_GENERIC,
0,
0,
false,
false,
},*/
{ // NPC_SMALL_JELLYFISH_1
0,//ACTORS_JELLYFISH1_SBK,
FRM_JELLYFISH1_SWIM1,
@ -255,6 +151,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
FRM_JELLYFISH1_SWIM1,
true,
true,
true,
},
{ // NPC_SMALL_JELLYFISH_2
@ -276,6 +173,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
true,
true,
},
{ // NPC_ANEMONE_1
@ -297,6 +195,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_ANEMONE_2
@ -318,6 +217,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_ANEMONE_3
@ -339,6 +239,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SKELETAL_FISH
@ -360,6 +261,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_SKELETALFISH_GETHIT,
false,
false,
false,
},
{ // NPC_CLAM_JUMP
@ -381,6 +283,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_CLAM_STATIC
@ -402,6 +305,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SQUID_DART
@ -423,6 +327,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
true,
},
{ // NPC_FISH_FOLK
@ -444,6 +349,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_PRICKLY_BUG
@ -465,6 +371,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_CATERPILLAR_GETHIT,
false,
false,
true,
},
{ // NPC_SEA_SNAKE
@ -486,6 +393,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_PUFFA_FISH
@ -507,6 +415,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_ANGLER_FISH
@ -528,6 +437,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_HERMIT_CRAB
@ -549,6 +459,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_HERMITCRAB_DIE,
false,
false,
true,
},
{ // NPC_MINE
@ -570,6 +481,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_BOOGER_MONSTER
@ -591,6 +503,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SPIDER_CRAB
@ -612,6 +525,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_SPIDERCRAB_HIT,
false,
false,
true,
},
{ // NPC_SPIDER_CRAB_SPAWNER
@ -633,6 +547,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_SPIDERCRAB_HIT,
false,
false,
false,
},
{ // NPC_EYEBALL
@ -654,6 +569,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_BABY_OCTOPUS
@ -675,6 +591,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_BABYOCTOPUS_HIT,
false,
false,
true,
},
{ // NPC_ZOMBIE_FISH_FOLK
@ -696,6 +613,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_NINJA_STARFISH
@ -717,6 +635,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
true,
},
{ // NPC_GHOST
@ -738,6 +657,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_GHOST_PIRATE
@ -759,6 +679,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_FLAMING_SKULL
@ -780,6 +701,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SHARK_MAN
@ -801,6 +723,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_SHARKMAN_BLOCK,
false,
false,
false,
},
{ // NPC_OIL_BLOB
@ -822,6 +745,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SKULL_STOMPER
@ -843,6 +767,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_MOTHER_JELLYFISH
@ -864,6 +789,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SUB_SHARK
@ -885,6 +811,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_PARASITIC_WORM
@ -906,6 +833,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_FLYING_DUTCHMAN
@ -927,6 +855,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_FLYINGDUTCHMAN_GETHIT,
false,
false,
false,
},
{ // NPC_IRON_DOGFISH
@ -948,6 +877,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_IRONDOGFISH_GETHIT,
false,
false,
false,
},
{ // NPC_PARASITIC_WORM_SEGMENT
@ -969,6 +899,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_BALL_BLOB
@ -990,6 +921,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
false,
},
{ // NPC_SHELL
@ -1011,6 +943,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
true,
},
};

View File

@ -227,6 +227,11 @@ void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType )
void CProjectile::think(int _frames)
{
if ( _frames > 2 )
{
_frames = 2;
}
CEnemyProjectileThing::think( _frames );
switch( m_movementType )
@ -469,6 +474,11 @@ void CPlayerProjectile::setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType )
void CPlayerProjectile::think(int _frames)
{
if ( _frames > 2 )
{
_frames = 2;
}
CPlayerProjectileThing::think( _frames );
m_frame += _frames;

View File

@ -103,7 +103,7 @@ public:
void shutdown();
void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );}
void think(int _frames);
virtual void think(int _frames);
virtual void render();
void processEvent( GAME_EVENT evt, CThing *sourceThing );
void setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType );

View File

@ -1077,6 +1077,14 @@ SOURCE=..\..\..\source\player\player.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\source\projectl\prnpc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\projectl\prnpc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\projectl\projectl.cpp
# End Source File
# Begin Source File