diff --git a/makefile.gfx b/makefile.gfx index c9306c336..fe2fd7dba 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -163,7 +163,7 @@ SFX_GFX := +smoke.bmp \ +fire01.bmp +fire02.bmp +fire03.bmp +fire04.bmp +fire05.bmp +fire06.bmp \ +drip.bmp +bubblepop.bmp \ +Gush000.bmp +Gush001.bmp +Gush002.bmp \ - +leg.bmp +thwack.bmp +lightning2.bmp + +leg.bmp +thwack.bmp +lightning1.bmp +lightning2.bmp SFX_GFX_IN := $(foreach FILE,$(SFX_GFX),$(SFX_GFX_DIR)/$(FILE)) diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index 46708ce96..8698bd42f 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -48,6 +48,7 @@ void CNpcIronDogfishEnemy::postInit() m_extendDir = EXTEND_RIGHT; m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_steamTimer = 0; + m_vulnerableTimer = 0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -81,29 +82,43 @@ bool CNpcIronDogfishEnemy::processSensor() void CNpcIronDogfishEnemy::processMovement( int _frames ) { - s32 moveX = 0, moveY = 0; - s32 moveVel = 0; - s32 moveDist = 0; - - if ( m_movementTimer > 0 ) + if ( m_vulnerableTimer > 0 ) { - if ( !m_animPlaying ) + m_vulnerableTimer -= _frames; + + if ( m_animNo != ANIM_IRONDOGFISH_IDLE ) { m_animPlaying = true; - m_animNo = ANIM_IRONDOGFISH_WALK; + m_animNo = ANIM_IRONDOGFISH_IDLE; m_frame = 0; } - - processGenericFixedPathWalk( _frames, &moveX, &moveY ); - - Pos.vx += moveX; - Pos.vy += moveY; - - m_movementTimer -= _frames; } else { - processStandardIronDogfishAttack( _frames ); + s32 moveX = 0, moveY = 0; + s32 moveVel = 0; + s32 moveDist = 0; + + if ( m_movementTimer > 0 ) + { + if ( m_animNo != ANIM_IRONDOGFISH_WALK || !m_animPlaying ) + { + m_animPlaying = true; + m_animNo = ANIM_IRONDOGFISH_WALK; + m_frame = 0; + } + + processGenericFixedPathWalk( _frames, &moveX, &moveY ); + + Pos.vx += moveX; + Pos.vy += moveY; + + m_movementTimer -= _frames; + } + else + { + processStandardIronDogfishAttack( _frames ); + } } } @@ -321,7 +336,10 @@ void CNpcIronDogfishEnemy::hasBeenSteamed( DVECTOR &steamPos ) { if ( m_steamTimer <= 0 ) { - hasBeenAttacked(); + m_controlFunc = NPC_CONTROL_MOVEMENT; + m_vulnerableTimer = 2 * GameState::getOneSecondInFrames(); + + //hasBeenAttacked(); m_steamTimer = 4 * GameState::getOneSecondInFrames(); } } @@ -451,3 +469,89 @@ void CNpcIronDogfishEnemy::processShot( int _frames ) } } } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcIronDogfishEnemy::collidedWith( CThing *_thisThing ) +{ + if ( m_isActive && !m_isCaught && !m_isDying ) + { + switch(_thisThing->getThingType()) + { + case TYPE_PLAYER: + { + CPlayer *player = (CPlayer *) _thisThing; + + ATTACK_STATE playerState = player->getAttackState(); + + if(playerState==ATTACK_STATE__NONE) + { + if ( !player->isRecoveringFromHit() ) + { + switch( m_data[m_type].detectCollision ) + { + case DETECT_NO_COLLISION: + { + // ignore + + break; + } + + case DETECT_ALL_COLLISION: + { + m_oldControlFunc = m_controlFunc; + m_controlFunc = NPC_CONTROL_COLLISION; + + processUserCollision( _thisThing ); + + break; + } + + case DETECT_ATTACK_COLLISION_GENERIC: + { + processAttackCollision(); + processUserCollision( _thisThing ); + + break; + } + } + } + } + else if ( m_vulnerableTimer > 0 ) + { + // player is attacking, respond appropriately + + if ( m_controlFunc != NPC_CONTROL_SHOT ) + { + if(playerState==ATTACK_STATE__BUTT_BOUNCE) + { + player->justButtBouncedABadGuy(); + } + m_controlFunc = NPC_CONTROL_SHOT; + m_state = NPC_GENERIC_HIT_CHECK_HEALTH; + + drawAttackEffect(); + } + } + + break; + } + + case TYPE_ENEMY: + { + CNpcEnemy *enemy = (CNpcEnemy *) _thisThing; + + if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() ) + { + processEnemyCollision( _thisThing ); + } + + break; + } + + default: + ASSERT(0); + break; + } + } +} diff --git a/source/enemy/ndogfish.h b/source/enemy/ndogfish.h index f790ddbfc..46610c249 100644 --- a/source/enemy/ndogfish.h +++ b/source/enemy/ndogfish.h @@ -28,6 +28,7 @@ protected: virtual void processAttackCollision(); virtual void hasBeenSteamed( DVECTOR &steamPos ); virtual void processShot( int _frames ); + virtual void collidedWith(CThing *_thisThing); enum NPC_IRON_DOGFISH_STATE { @@ -39,6 +40,7 @@ protected: }; s32 m_steamTimer; + s32 m_vulnerableTimer; }; #endif \ No newline at end of file diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index a5a890a5f..b4892148c 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -1008,7 +1008,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = false, 3, 2048, - DETECT_ATTACK_COLLISION_GENERIC, + DETECT_ALL_COLLISION, DAMAGE__HIT_ENEMY, 50, ANIM_IRONDOGFISH_WALK,