diff --git a/source/enemy/nfdutch.cpp b/source/enemy/nfdutch.cpp index 0c64261ba..becc35116 100644 --- a/source/enemy/nfdutch.cpp +++ b/source/enemy/nfdutch.cpp @@ -241,13 +241,30 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames ) } else { - if ( getRnd() % 2 ) + int val = getRnd() % 3; + + switch( val ) { - m_state = FLYING_DUTCHMAN_ATTACK_PLAYER; - } - else - { - m_state = FLYING_DUTCHMAN_CHARGE_PLAYER_START; + case 0: + { + m_state = FLYING_DUTCHMAN_ATTACK_PLAYER; + + break; + } + + case 1: + { + m_state = FLYING_DUTCHMAN_CHARGE_PLAYER_START; + + break; + } + + case 2: + { + m_state = FLYING_DUTCHMAN_LEVEL_SHAKE; + + break; + } } m_fadeDown = false; @@ -392,6 +409,54 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames ) break; } + case FLYING_DUTCHMAN_LEVEL_SHAKE: + { + if ( m_fadeVal == 128 ) + { + CThingManager::shakePlatformLoose(); + + m_timerTimer = 5 * GameState::getOneSecondInFrames(); + + m_state = FLYING_DUTCHMAN_LEVEL_SHAKE_WAIT; + + CGameScene::setCameraShake(0,8); + } + else + { + if ( !m_animPlaying ) + { + m_animPlaying = true; + m_animNo = m_data[m_type].moveAnim; + m_frame = 0; + } + } + + break; + } + + case FLYING_DUTCHMAN_LEVEL_SHAKE_WAIT: + { + if ( m_timerTimer > 0 ) + { + if ( !m_animPlaying ) + { + m_animNo = m_data[m_type].moveAnim; + m_animPlaying = true; + m_frame = 0; + + CGameScene::setCameraShake(0,8); + } + + m_timerTimer -= _frames; + } + else + { + m_state = FLYING_DUTCHMAN_RETURN; + } + + break; + } + case FLYING_DUTCHMAN_RETURN: { if ( m_timerTimer > 0 ) @@ -610,6 +675,7 @@ void CNpcFlyingDutchmanEnemy::render() SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed); setSemiTrans( SprFrame, true ); + SprFrame->tpage|=1<<5; m_actorGfx->RotateScale( SprFrame, renderPos, 0, 4096, 4096 ); setRGB0( SprFrame, m_fadeVal, m_fadeVal, m_fadeVal ); @@ -731,3 +797,9 @@ u8 CNpcFlyingDutchmanEnemy::hasBeenAttacked() return( true ); } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcFlyingDutchmanEnemy::shakePlatformLoose() +{ +} diff --git a/source/enemy/nfdutch.h b/source/enemy/nfdutch.h index 7caccba88..96630f787 100644 --- a/source/enemy/nfdutch.h +++ b/source/enemy/nfdutch.h @@ -33,6 +33,7 @@ protected: void processShotRecoil( int _frames ); void processShotDeathEnd( int _frames ); void collidedWith(CThing *_thisThing); + void shakePlatformLoose(); enum NPC_FLYING_DUTCHMAN_STATE { @@ -43,6 +44,8 @@ protected: FLYING_DUTCHMAN_ATTACK_PLAYER = 1, FLYING_DUTCHMAN_CHARGE_PLAYER_START, FLYING_DUTCHMAN_CHARGE_PLAYER, + FLYING_DUTCHMAN_LEVEL_SHAKE, + FLYING_DUTCHMAN_LEVEL_SHAKE_WAIT, FLYING_DUTCHMAN_RETURN, }; diff --git a/source/platform/pfblock.cpp b/source/platform/pfblock.cpp index 3014c6eed..1baf53182 100644 --- a/source/platform/pfblock.cpp +++ b/source/platform/pfblock.cpp @@ -40,6 +40,14 @@ void CNpcFallingBlockPlatform::postInit() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcFallingBlockPlatform::trigger() +{ + m_isTriggered = true; + m_timer = GameState::getOneSecondInFrames(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcFallingBlockPlatform::processMovement( int _frames ) { if ( m_isTriggered ) @@ -80,11 +88,6 @@ void CNpcFallingBlockPlatform::processMovement( int _frames ) Pos.vy += moveY; } } - else if ( m_contact ) - { - m_isTriggered = true; - m_timer = GameState::getOneSecondInFrames(); - } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/platform/pfblock.h b/source/platform/pfblock.h index daf6d60ca..3dd865193 100644 --- a/source/platform/pfblock.h +++ b/source/platform/pfblock.h @@ -24,6 +24,7 @@ public: void postInit(); CRECT const *getThinkBBox() {return( CThing::getThinkBBox() );} int checkCollisionAgainst(CThing *_thisThing, int _frames); + void trigger(); protected: void processMovement( int _frames ); diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index f158a6c15..a2398c0b3 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -49,6 +49,7 @@ #include "gfx\otpos.h" #include "fx\fx.h" +#include "fx\fxbaseanim.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -405,7 +406,9 @@ void CProjectile::think(int _frames) if ( m_movementType == PROJECTILE_MINE ) { - CFX::Create( CFX::FX_TYPE_EXPLODE, Pos ); + CFX *newFX = CFX::Create( CFX::FX_TYPE_EXPLODE, Pos ); + ((CFXBaseAnim*)newFX)->SetScale(ONE*2); + CGameScene::setCameraShake(0,8); } } diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 2d8734cad..52eaccbc9 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -66,6 +66,10 @@ #include "triggers\tgarygo.h" #endif +#ifndef __PLATFORM_PFBLOCK_H__ +#include "platform\pfblock.h" +#endif + /* Std Lib ------- */ @@ -377,6 +381,52 @@ void CThingManager::matchGaryTriggers() } } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ + +void CThingManager::shakePlatformLoose() +{ + CNpcPlatform *platform; + + int platformCount = getRnd() % 30; + + int platformTest = 0; + + while( platformCount ) + { + platform = (CNpcPlatform *) s_thingLists[CThing::TYPE_PLATFORM]; + + while( platform ) + { + if ( platform->getThingSubType() == CNpcPlatform::NPC_FALLING_BLOCK_PLATFORM ) + { + platformCount--; + platformTest++; + + if ( !platformCount ) + { + CNpcFallingBlockPlatform *block = (CNpcFallingBlockPlatform *) platform; + + block->trigger(); + + return; + } + } + + platform = (CNpcPlatform *) platform->m_nextListThing; + } + + if ( !platformTest ) + { + return; + } + } +} + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/thing/thing.h b/source/thing/thing.h index ec1fc6a05..1cbce7772 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -65,6 +65,7 @@ static void initCollision(); static void matchWheelsAndWeights(); static void matchPressureSwitches(); static void matchGaryTriggers(); +static void shakePlatformLoose(); static sBBox &getRenderBBox() {return(m_RenderBBox);} static sBBox &getThinkBBox() {return(m_ThinkBBox);}