This commit is contained in:
parent
9f1abc52a0
commit
1592c77531
3 changed files with 156 additions and 43 deletions
|
@ -39,7 +39,6 @@
|
||||||
#include "system\vid.h"
|
#include "system\vid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fx\fx.h"
|
|
||||||
#include "fx\fxnrgbar.h"
|
#include "fx\fxnrgbar.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ bool CNpcIronDogfishEnemy::processSensor()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if ( playerXDistSqr + playerYDistSqr < 5000 )
|
if ( m_movementTimer > 0 && playerXDistSqr + playerYDistSqr < 5000 )
|
||||||
{
|
{
|
||||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
|
|
||||||
|
@ -140,32 +139,12 @@ void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
|
||||||
if ( playerXDist > 0 )
|
if ( playerXDist > 0 )
|
||||||
{
|
{
|
||||||
m_heading = 0;
|
m_heading = 0;
|
||||||
|
Pos.vx += _frames * speed;
|
||||||
if ( Pos.vx + playerXDist > maxX )
|
|
||||||
{
|
|
||||||
// abort
|
|
||||||
|
|
||||||
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Pos.vx += _frames * speed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_heading = 2048;
|
m_heading = 2048;
|
||||||
|
Pos.vx -= _frames * speed;
|
||||||
if ( Pos.vx + playerXDist < minX )
|
|
||||||
{
|
|
||||||
// abort
|
|
||||||
|
|
||||||
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Pos.vx -= _frames * speed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 fallSpeed = 3;
|
s32 fallSpeed = 3;
|
||||||
|
@ -190,13 +169,18 @@ void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
|
||||||
|
|
||||||
void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||||
{
|
{
|
||||||
if ( playerXDist > 0 )
|
if ( m_state != IRON_DOGFISH_LASER_EYE_1_WAIT && m_state != IRON_DOGFISH_LASER_EYE_2_WAIT )
|
||||||
{
|
{
|
||||||
m_extendDir = EXTEND_RIGHT;
|
if ( playerXDist > 0 )
|
||||||
}
|
{
|
||||||
else
|
m_extendDir = EXTEND_RIGHT;
|
||||||
{
|
m_heading = 0;
|
||||||
m_extendDir = EXTEND_LEFT;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_extendDir = EXTEND_LEFT;
|
||||||
|
m_heading = 2048;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_state )
|
switch( m_state )
|
||||||
|
@ -204,7 +188,27 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||||
case IRON_DOGFISH_THUMP_1:
|
case IRON_DOGFISH_THUMP_1:
|
||||||
case IRON_DOGFISH_THUMP_2:
|
case IRON_DOGFISH_THUMP_2:
|
||||||
{
|
{
|
||||||
if ( playerXDistSqr > 100 )
|
s32 minX, maxX;
|
||||||
|
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||||
|
|
||||||
|
u8 thump = false;
|
||||||
|
|
||||||
|
if ( playerXDist > 0 )
|
||||||
|
{
|
||||||
|
if ( Pos.vx + playerXDist > maxX )
|
||||||
|
{
|
||||||
|
thump = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( Pos.vx + playerXDist < minX )
|
||||||
|
{
|
||||||
|
thump = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( playerXDistSqr > 100 && !thump )
|
||||||
{
|
{
|
||||||
if ( !m_animPlaying )
|
if ( !m_animPlaying )
|
||||||
{
|
{
|
||||||
|
@ -238,23 +242,75 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||||
case IRON_DOGFISH_LASER_EYE_1:
|
case IRON_DOGFISH_LASER_EYE_1:
|
||||||
case IRON_DOGFISH_LASER_EYE_2:
|
case IRON_DOGFISH_LASER_EYE_2:
|
||||||
{
|
{
|
||||||
|
if ( m_animNo != ANIM_IRONDOGFISH_IDLE || !m_animPlaying )
|
||||||
|
{
|
||||||
|
m_animPlaying = true;
|
||||||
|
m_animNo = ANIM_IRONDOGFISH_IDLE;
|
||||||
|
m_frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// fire at user
|
// fire at user
|
||||||
|
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
|
||||||
|
|
||||||
CProjectile *projectile;
|
/*CProjectile *projectile;
|
||||||
projectile = CProjectile::Create();
|
projectile = CProjectile::Create();
|
||||||
DVECTOR startPos = Pos;
|
DVECTOR startPos = Pos;
|
||||||
startPos.vy -= 20;
|
startPos.vy -= 20;
|
||||||
projectile->init( startPos, headingToPlayer );
|
projectile->init( startPos, headingToPlayer );*/
|
||||||
|
|
||||||
|
m_laserTimer = GameState::getOneSecondInFrames();
|
||||||
|
|
||||||
|
m_effect = (CFXLaser*) CFX::Create( CFX::FX_TYPE_LASER, this );
|
||||||
|
DVECTOR targetPos = GameScene.getPlayer()->getPos();
|
||||||
|
targetPos.vy -= 45;
|
||||||
|
m_effect->setTarget( targetPos );
|
||||||
|
DVECTOR offsetPos;
|
||||||
|
if ( m_heading == 0 )
|
||||||
|
{
|
||||||
|
offsetPos.vx = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offsetPos.vx = -30;
|
||||||
|
}
|
||||||
|
offsetPos.vy = -45;
|
||||||
|
m_effect->setOffset( offsetPos );
|
||||||
|
m_effect->setRGB( 255, 0, 0 );
|
||||||
|
|
||||||
m_state++;
|
m_state++;
|
||||||
|
|
||||||
if ( m_state > IRON_DOGFISH_LASER_EYE_2 )
|
break;
|
||||||
{
|
}
|
||||||
// return to first state
|
|
||||||
|
|
||||||
m_state = IRON_DOGFISH_THUMP_1;
|
case IRON_DOGFISH_LASER_EYE_1_WAIT:
|
||||||
|
case IRON_DOGFISH_LASER_EYE_2_WAIT:
|
||||||
|
{
|
||||||
|
if ( !m_animPlaying )
|
||||||
|
{
|
||||||
|
m_animPlaying = true;
|
||||||
|
m_animNo = ANIM_IRONDOGFISH_IDLE;
|
||||||
|
m_frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_laserTimer > 0 )
|
||||||
|
{
|
||||||
|
m_laserTimer -= _frames;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_effect->killFX();
|
||||||
|
|
||||||
|
m_state++;
|
||||||
|
|
||||||
|
if ( m_state > IRON_DOGFISH_LASER_EYE_2_WAIT )
|
||||||
|
{
|
||||||
|
// return to first state
|
||||||
|
|
||||||
|
m_state = IRON_DOGFISH_THUMP_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_movementTimer = GameState::getOneSecondInFrames() * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -262,9 +318,27 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||||
|
|
||||||
case IRON_DOGFISH_ROLL:
|
case IRON_DOGFISH_ROLL:
|
||||||
{
|
{
|
||||||
// charge user
|
s32 minX, maxX;
|
||||||
|
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||||
|
|
||||||
if ( playerXDistSqr > 100 )
|
u8 thump = false;
|
||||||
|
|
||||||
|
if ( playerXDist > 0 )
|
||||||
|
{
|
||||||
|
if ( Pos.vx + playerXDist > maxX )
|
||||||
|
{
|
||||||
|
thump = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( Pos.vx + playerXDist < minX )
|
||||||
|
{
|
||||||
|
thump = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( playerXDistSqr > 100 && !thump )
|
||||||
{
|
{
|
||||||
if ( !m_animPlaying )
|
if ( !m_animPlaying )
|
||||||
{
|
{
|
||||||
|
@ -517,15 +591,12 @@ void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing )
|
||||||
m_oldControlFunc = m_controlFunc;
|
m_oldControlFunc = m_controlFunc;
|
||||||
m_controlFunc = NPC_CONTROL_COLLISION;
|
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||||
|
|
||||||
processUserCollision( _thisThing );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DETECT_ATTACK_COLLISION_GENERIC:
|
case DETECT_ATTACK_COLLISION_GENERIC:
|
||||||
{
|
{
|
||||||
processAttackCollision();
|
processAttackCollision();
|
||||||
processUserCollision( _thisThing );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -558,7 +629,7 @@ void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing )
|
||||||
|
|
||||||
if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() )
|
if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() )
|
||||||
{
|
{
|
||||||
processEnemyCollision( _thisThing );
|
//processEnemyCollision( _thisThing );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -614,3 +685,12 @@ void CNpcIronDogfishEnemy::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcIronDogfishEnemy::processCollision()
|
||||||
|
{
|
||||||
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
player->takeDamage( m_data[m_type].damageToUserType,REACT__GET_DIRECTION_FROM_THING,(CThing*)this );
|
||||||
|
m_controlFunc = m_oldControlFunc;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#ifndef __ENEMY_NDOGFISH_H__
|
#ifndef __ENEMY_NDOGFISH_H__
|
||||||
#define __ENEMY_NDOGFISH_H__
|
#define __ENEMY_NDOGFISH_H__
|
||||||
|
|
||||||
|
#include "fx\fx.h"
|
||||||
|
#include "fx\fxlaser.h"
|
||||||
|
|
||||||
class CNpcIronDogfishEnemy : public CNpcEnemy
|
class CNpcIronDogfishEnemy : public CNpcEnemy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -27,6 +30,7 @@ protected:
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
void processStandardIronDogfishAttack( int _frames );
|
void processStandardIronDogfishAttack( int _frames );
|
||||||
void processWalkToUser( int _frames, int speed );
|
void processWalkToUser( int _frames, int speed );
|
||||||
|
virtual void processCollision();
|
||||||
virtual void processAttackCollision();
|
virtual void processAttackCollision();
|
||||||
virtual void hasBeenSteamed( DVECTOR &steamPos );
|
virtual void hasBeenSteamed( DVECTOR &steamPos );
|
||||||
virtual void processShot( int _frames );
|
virtual void processShot( int _frames );
|
||||||
|
@ -36,14 +40,19 @@ protected:
|
||||||
{
|
{
|
||||||
IRON_DOGFISH_THUMP_1 = 0,
|
IRON_DOGFISH_THUMP_1 = 0,
|
||||||
IRON_DOGFISH_LASER_EYE_1 = 1,
|
IRON_DOGFISH_LASER_EYE_1 = 1,
|
||||||
|
IRON_DOGFISH_LASER_EYE_1_WAIT,
|
||||||
IRON_DOGFISH_THUMP_2,
|
IRON_DOGFISH_THUMP_2,
|
||||||
IRON_DOGFISH_ROLL,
|
IRON_DOGFISH_ROLL,
|
||||||
IRON_DOGFISH_LASER_EYE_2,
|
IRON_DOGFISH_LASER_EYE_2,
|
||||||
|
IRON_DOGFISH_LASER_EYE_2_WAIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 m_steamTimer;
|
s32 m_steamTimer;
|
||||||
s32 m_vulnerableTimer;
|
s32 m_vulnerableTimer;
|
||||||
|
s32 m_laserTimer;
|
||||||
bool m_meterOn;
|
bool m_meterOn;
|
||||||
|
|
||||||
|
CFXLaser *m_effect;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -637,6 +637,14 @@ SOURCE=..\..\..\source\fx\fx.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxattachanim.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxattachanim.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\fx\fxbaseanim.cpp
|
SOURCE=..\..\..\source\fx\fxbaseanim.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -685,6 +693,14 @@ SOURCE=..\..\..\source\fx\fxjfish.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxlaser.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxlaser.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\fx\fxnrgbar.cpp
|
SOURCE=..\..\..\source\fx\fxnrgbar.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -699,6 +715,14 @@ SOURCE=..\..\..\source\fx\fxsteam.cpp
|
||||||
|
|
||||||
SOURCE=..\..\..\source\fx\fxsteam.h
|
SOURCE=..\..\..\source\fx\fxsteam.h
|
||||||
# End Source File
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxthwack.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\fx\fxthwack.h
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "game"
|
# Begin Group "game"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue