diff --git a/source/fma/fma.cpp b/source/fma/fma.cpp index b0530a2eb..d9a7fa4b0 100644 --- a/source/fma/fma.cpp +++ b/source/fma/fma.cpp @@ -131,6 +131,8 @@ enum FMA_ANIM_UNHIDEIDLE, FMA_ANIM_SIT, FMA_ANIM_SITLOOKLEFT, + FMA_ANIM_SITASLEEP, + FMA_ANIM_RUBHEAD, FMA_NUM_ANIMS, }; @@ -274,6 +276,8 @@ static const ACTOR_GRAPHICS_DATA s_actorGraphicsData[FMA_NUM_ACTORS]= /*FMA_ANIM_UNHIDEIDLE*/ {0,-1}, /*FMA_ANIM_SIT*/ {0,-1}, /*FMA_ANIM_SITLOOKLEFT*/ {0,-1}, +/*FMA_ANIM_SITASLEEP*/ {0,-1}, +/*FMA_ANIM_RUBHEAD*/ {0,-1}, }, }, { // Mermaid Man @@ -294,6 +298,8 @@ static const ACTOR_GRAPHICS_DATA s_actorGraphicsData[FMA_NUM_ACTORS]= /*FMA_ANIM_UNHIDEIDLE*/ {0,-1}, /*FMA_ANIM_SIT*/ {0,ANIM_MERMAIDMAN_SIT}, /*FMA_ANIM_SITLOOKLEFT*/ {0,-1}, +/*FMA_ANIM_SITASLEEP*/ {0,ANIM_MERMAIDMAN_SITASLEEP}, +/*FMA_ANIM_RUBHEAD*/ {0,-1}, }, }, { // Barnicle Boy @@ -314,6 +320,8 @@ static const ACTOR_GRAPHICS_DATA s_actorGraphicsData[FMA_NUM_ACTORS]= /*FMA_ANIM_UNHIDEIDLE*/ {0,ANIM_BARNACLEBOY_UNHIDEIDLE}, /*FMA_ANIM_SIT*/ {0,ANIM_BARNACLEBOY_SIT}, /*FMA_ANIM_SITLOOKLEFT*/ {0,ANIM_BARNACLEBOY_SITLOOKLEFT}, +/*FMA_ANIM_SITASLEEP*/ {0,ANIM_BARNACLEBOY_SITASLEEP}, +/*FMA_ANIM_RUBHEAD*/ {0,ANIM_BARNACLEBOY_RUBHEAD}, }, }, @@ -335,6 +343,8 @@ static const ACTOR_GRAPHICS_DATA s_actorGraphicsData[FMA_NUM_ACTORS]= /*FMA_ANIM_UNHIDEIDLE*/ {0,-1}, /*FMA_ANIM_SIT*/ {0,-1}, /*FMA_ANIM_SITLOOKLEFT*/ {0,-1}, +/*FMA_ANIM_SITASLEEP*/ {0,-1}, +/*FMA_ANIM_RUBHEAD*/ {0,-1}, }, }, { // Plankton @@ -355,6 +365,8 @@ static const ACTOR_GRAPHICS_DATA s_actorGraphicsData[FMA_NUM_ACTORS]= /*FMA_ANIM_UNHIDEIDLE*/ {0,-1}, /*FMA_ANIM_SIT*/ {0,-1}, /*FMA_ANIM_SITLOOKLEFT*/ {0,-1}, +/*FMA_ANIM_SITASLEEP*/ {0,-1}, +/*FMA_ANIM_RUBHEAD*/ {0,-1}, }, }, }; @@ -432,6 +444,7 @@ static const int s_FMAIntroScript[]= SC_SET_ACTOR_FACING, FMA_ACTOR_SPONGEBOB,0, SC_WAIT_ON_ACTOR_ANIM, FMA_ACTOR_SPONGEBOB, SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_SPONGEBOB,FMA_ANIM_WALK,1, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_RUBHEAD,1, SC_WALK_ACTOR_TO_POSITION, FMA_ACTOR_SPONGEBOB,40*16,30*16,30, SC_WAIT_ON_ACTOR_STOP, FMA_ACTOR_SPONGEBOB, @@ -461,12 +474,12 @@ static const int s_FMAC1EndScript[]= SC_WAIT_ON_TIMER, 60*2, // Scene 2 - inside Shady Shoals - SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_MM,FMA_ANIM_SIT,1, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_MM,FMA_ANIM_SITASLEEP,1, SC_SET_ACTOR_POSITION, FMA_ACTOR_MM,208*16,(30*16)+8, SC_SET_ACTOR_FACING, FMA_ACTOR_MM,0, SC_SET_ACTOR_VISIBILITY, FMA_ACTOR_MM,true, - SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_SIT,1, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_SITASLEEP,1, SC_SET_ACTOR_POSITION, FMA_ACTOR_BB,211*16,(30*16)+8, SC_SET_ACTOR_FACING, FMA_ACTOR_BB,1, SC_SET_ACTOR_VISIBILITY, FMA_ACTOR_BB,true, @@ -520,6 +533,7 @@ static const int s_FMAC1EndScript[]= SC_WAIT_ON_ACTOR_ANIM, FMA_ACTOR_SPONGEBOB, SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_SPONGEBOB,FMA_ANIM_WALK,1, SC_WALK_ACTOR_TO_POSITION, FMA_ACTOR_SPONGEBOB,240*16,30*16,40, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_RUBHEAD,1, SC_WAIT_ON_ACTOR_STOP, FMA_ACTOR_SPONGEBOB, SC_STOP }; @@ -585,6 +599,7 @@ static const int s_FMAC2EndScript[]= SC_WAIT_ON_ACTOR_ANIM, FMA_ACTOR_SPONGEBOB, SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_SPONGEBOB,FMA_ANIM_WALK,1, SC_WALK_ACTOR_TO_POSITION, FMA_ACTOR_SPONGEBOB,240*16,30*16,40, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_RUBHEAD,1, SC_WAIT_ON_ACTOR_STOP, FMA_ACTOR_SPONGEBOB, SC_STOP }; @@ -667,6 +682,7 @@ static const int s_FMAC3EndScript[]= SC_WAIT_ON_ACTOR_ANIM, FMA_ACTOR_SPONGEBOB, SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_SPONGEBOB,FMA_ANIM_WALK,1, SC_WALK_ACTOR_TO_POSITION, FMA_ACTOR_SPONGEBOB,240*16,30*16,40, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_RUBHEAD,1, SC_WAIT_ON_ACTOR_STOP, FMA_ACTOR_SPONGEBOB, SC_STOP @@ -719,6 +735,7 @@ static const int s_FMAC4EndScript[]= SC_WAIT_ON_ACTOR_ANIM, FMA_ACTOR_SPONGEBOB, SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_SPONGEBOB,FMA_ANIM_WALK,1, SC_WALK_ACTOR_TO_POSITION, FMA_ACTOR_SPONGEBOB,420*16,30*16,40, + SC_SET_ACTOR_ANIM_STATE, FMA_ACTOR_BB,FMA_ANIM_RUBHEAD,1, SC_WAIT_ON_ACTOR_STOP, FMA_ACTOR_SPONGEBOB, SC_STOP diff --git a/source/fx/fx.cpp b/source/fx/fx.cpp index 5bf52a375..ddb561812 100644 --- a/source/fx/fx.cpp +++ b/source/fx/fx.cpp @@ -51,30 +51,35 @@ CFXBaseAnim::sFXBaseData FXDropBaseData= { FRM__DRIP,FRM__DRIP,1, FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_HAS_GRAVITY | FX_FLAG_NO_THINK_KILL, + 0,CSoundMediator::SFX_HAZARD__ACID_DROP, }; CFXBaseAnim::sFXBaseData FXSplashBaseData= { FRM__SPLASH001,FRM__SPLASH006,1, FX_FLAG_NO_THINK_KILL, + 0,0, }; CFXBaseAnim::sFXBaseData FXExplodeBaseData= { FRM__EXPLOSION0001,FRM__EXPLOSION0008,1, FX_FLAG_NO_THINK_KILL, + CSoundMediator::SFX_HAZARD__FIREBALL_LAND,0, }; CFXBaseAnim::sFXBaseData FXFireBaseData= { FRM__FIRE01,FRM__FIRE08,1, FX_FLAG_LOOP | FX_FLAG_TRANS, + 0,0, }; CFXBaseAnim::sFXBaseData FXBubbleBaseData= { FRM__BUBBLE_2,FRM__BUBBLE_2,1, FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_NO_THINK_KILL | FX_FLAG_HAS_LIFE, + 0,0, }; /*****************************************************************************/ @@ -295,6 +300,9 @@ void CFX::init() OtPos=OTPOS__ACTOR_POS; Flags=0; Velocity.vx=Velocity.vy=0; + m_soundId = NOT_PLAYING; + EndSnd=0; + } /*****************************************************************************/ @@ -345,7 +353,9 @@ CThing *Parent=getParent(); Pos.vx+=Velocity.vx; Pos.vy+=Velocity.vy; - if (Flags & FX_FLAG_COLLIDE_KILL || Flags & FX_FLAG_COLLIDE_BOUNCE) + + if (Velocity.vy) + if (Flags & FX_FLAG_COLLIDE_KILL || Flags ) { CLayerCollision *ColLayer=CGameScene::getCollision(); int DistY = ColLayer->getHeightFromGround( Pos.vx, Pos.vy, 16 ); @@ -360,7 +370,11 @@ CThing *Parent=getParent(); else { Velocity.vx/=2; - Velocity.vy=-Velocity.vy>>1; + Velocity.vy=-(Velocity.vy/2); + if (Velocity.vy) + { + CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_BLINK,false); + } } } } @@ -377,6 +391,14 @@ void CFX::killFX() { CFX::Create((CFX::FX_TYPE)AfterEffect,getPos()); } + if (EndSnd) + { + CSoundMediator::playSfx( (CSoundMediator::SFXID)EndSnd,false); + } + if( m_soundId != NOT_PLAYING ) + { + CSoundMediator::stopAndUnlockSfx(m_soundId ); + } } diff --git a/source/fx/fx.h b/source/fx/fx.h index c7b68825b..7ce7dac98 100644 --- a/source/fx/fx.h +++ b/source/fx/fx.h @@ -6,6 +6,7 @@ #define __FX_FX_HEADER__ #include "thing/thing.h" +#include "sound\sound.h" /*****************************************************************************/ enum FX_FLAG @@ -30,44 +31,44 @@ public: { FX_TYPE_NONE=0, - FX_TYPE_BASE_ANIM, +/* 1*/ FX_TYPE_BASE_ANIM, - FX_TYPE_DROP_WATER, - FX_TYPE_DROP_ACID, - FX_TYPE_DROP_LAVA, - FX_TYPE_DROP_OIL, +/* 2*/ FX_TYPE_DROP_WATER, +/* 3*/ FX_TYPE_DROP_ACID, +/* 4*/ FX_TYPE_DROP_LAVA, +/* 5*/ FX_TYPE_DROP_OIL, - FX_TYPE_SPLASH_WATER, - FX_TYPE_SPLASH_ACID, - FX_TYPE_SPLASH_LAVA, - FX_TYPE_SPLASH_OIL, +/* 6*/ FX_TYPE_SPLASH_WATER, +/* 7*/ FX_TYPE_SPLASH_ACID, +/* 8*/ FX_TYPE_SPLASH_LAVA, +/* 9*/ FX_TYPE_SPLASH_OIL, - FX_TYPE_BUBBLE_WATER, - FX_TYPE_BUBBLE_ACID, - FX_TYPE_BUBBLE_LAVA, - FX_TYPE_BUBBLE_OIL, +/* 10*/ FX_TYPE_BUBBLE_WATER, +/* 11*/ FX_TYPE_BUBBLE_ACID, +/* 12*/ FX_TYPE_BUBBLE_LAVA, +/* 13*/ FX_TYPE_BUBBLE_OIL, - FX_TYPE_GEYSER_WATER, - FX_TYPE_GEYSER_ACID, - FX_TYPE_GEYSER_LAVA, - FX_TYPE_GEYSER_OIL, +/* 14*/ FX_TYPE_GEYSER_WATER, +/* 15*/ FX_TYPE_GEYSER_ACID, +/* 16*/ FX_TYPE_GEYSER_LAVA, +/* 17*/ FX_TYPE_GEYSER_OIL, - FX_TYPE_THWACK, - FX_TYPE_LIGHTNING_BOLT, +/* 18*/ FX_TYPE_THWACK, +/* 19*/ FX_TYPE_LIGHTNING_BOLT, - FX_TYPE_STEAM, - FX_TYPE_GAS, - FX_TYPE_FLAMES, +/* 20*/ FX_TYPE_STEAM, +/* 21*/ FX_TYPE_GAS, +/* 22*/ FX_TYPE_FLAMES, - FX_TYPE_SMOKE, - FX_TYPE_SMOKE_PUFF, +/* 23*/ FX_TYPE_SMOKE, +/* 24*/ FX_TYPE_SMOKE_PUFF, - FX_TYPE_JELLYFISH_LEGS, - FX_TYPE_FALLINGTILE, - FX_TYPE_EXPLODE, - FX_TYPE_NRG_BAR, - FX_TYPE_LASER, - FX_TYPE_TV_EXPLODE, +/* 25*/ FX_TYPE_JELLYFISH_LEGS, +/* 26*/ FX_TYPE_FALLINGTILE, +/* 27*/ FX_TYPE_EXPLODE, +/* 28*/ FX_TYPE_NRG_BAR, +/* 29*/ FX_TYPE_LASER, +/* 30*/ FX_TYPE_TV_EXPLODE, FX_TYPE_MAX }; @@ -138,7 +139,9 @@ public: u16 Flags; sFXRGB RGB; FX_TYPE AfterEffect; + u16 EndSnd; DVECTOR Velocity; + xmPlayingId m_soundId; s32 OtPos; static sFXRGB FXRGBTable[FX_RGB_MAX]; diff --git a/source/fx/fxbaseanim.cpp b/source/fx/fxbaseanim.cpp index 9cd64513e..7e99b3da2 100644 --- a/source/fx/fxbaseanim.cpp +++ b/source/fx/fxbaseanim.cpp @@ -11,6 +11,7 @@ #include "level\level.h" #include "game\game.h" #include "level\layercollision.h" + #include "FX\FXBaseAnim.h" @@ -43,6 +44,11 @@ void CFXBaseAnim::think(int _frames) MaxFrame=((BaseData->EndFrame-BaseData->StartFrame)<FrameShift)-1; Flags|=BaseData->Flags; renderFrame=BaseData->StartFrame; + if (BaseData->StartSnd) + { + CSoundMediator::playSfx((CSoundMediator::SFXID)BaseData->StartSnd,false); + } + EndSnd=BaseData->EndSnd; HasInit=true; } diff --git a/source/fx/fxbaseanim.h b/source/fx/fxbaseanim.h index e0d6ecd87..ef67abc62 100644 --- a/source/fx/fxbaseanim.h +++ b/source/fx/fxbaseanim.h @@ -15,6 +15,7 @@ public: { s16 StartFrame,EndFrame,FrameShift; u16 Flags; + u16 StartSnd,EndSnd; }; virtual void init(DVECTOR const &Pos); diff --git a/source/fx/fxbubble.cpp b/source/fx/fxbubble.cpp index 5e75851f1..e0d9cd733 100644 --- a/source/fx/fxbubble.cpp +++ b/source/fx/fxbubble.cpp @@ -37,6 +37,7 @@ void CFXBubble::think(int _frames) { if (renderFrame!=FRM__BUBBLEPOP) { + CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP,false); renderFrame=FRM__BUBBLEPOP; } else diff --git a/source/fx/fxfallingtile.cpp b/source/fx/fxfallingtile.cpp index 9b38f3b35..eb6e33ea7 100644 --- a/source/fx/fxfallingtile.cpp +++ b/source/fx/fxfallingtile.cpp @@ -35,6 +35,7 @@ sLevelHdr *LevelHdr=CLevel::getLevelHdr(); Velocity.vx=getRndRange(7)-4; Velocity.vy=FallingTile_DefVY; Life=FallingTile_DefLife; + CSoundMediator::playSfx(CSoundMediator::SFX_ANY_OBJECT_FALLING,false); } /*****************************************************************************/ diff --git a/source/fx/fxgeyser.cpp b/source/fx/fxgeyser.cpp index 04a5f72d6..0cede5e68 100644 --- a/source/fx/fxgeyser.cpp +++ b/source/fx/fxgeyser.cpp @@ -21,6 +21,7 @@ void CFXGeyser::init(DVECTOR const &_Pos) CFX::init(_Pos); Height=TargetHeight=8; currentFrame=FRM__GUSH000; +/* m_soundId=*/CSoundMediator::playSfx(CSoundMediator::SFX_WORLD_OBJECT__GEYSER,false); } /*****************************************************************************/ diff --git a/source/fx/fxsteam.cpp b/source/fx/fxsteam.cpp index f274ca198..5f989ac94 100644 --- a/source/fx/fxsteam.cpp +++ b/source/fx/fxsteam.cpp @@ -31,6 +31,7 @@ void CFXSteam::init(DVECTOR const &_Pos) DieOut=false; SetSize(DefSize); IsHorizontal=false; + m_soundId=CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STEAM,true); } /*****************************************************************************/ @@ -113,6 +114,10 @@ int TotalLife=0; if (DieOut && TotalLife==0) { + if( m_soundId != NOT_PLAYING ) + { + CSoundMediator::stopAndUnlockSfx(m_soundId ); + } setToShutdown(); } } diff --git a/source/fx/fxthwack.cpp b/source/fx/fxthwack.cpp index 10aff7b91..d0c618f97 100644 --- a/source/fx/fxthwack.cpp +++ b/source/fx/fxthwack.cpp @@ -25,6 +25,7 @@ void CFXThwack::init(DVECTOR const &_Pos) Angle=getRnd()&4095; Scale=2048+1024+(getRnd()&2047); Flags |=FX_FLAG_HAS_LIFE; + CSoundMediator::playSfx(CSoundMediator::SFX_KAPOW_V1,false); } /*****************************************************************************/ diff --git a/source/system/main.cpp b/source/system/main.cpp index ab9e8946f..84356ad4f 100644 --- a/source/system/main.cpp +++ b/source/system/main.cpp @@ -207,6 +207,11 @@ void MainLoop() /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ +#if defined(__USER_daveo__) +#include "fma/fma.h" +int TestFMA=-1; +#endif + int main() { CFileIO::GetAllFilePos(); @@ -215,7 +220,16 @@ int main() #ifdef __USER_paul__ GameState::setNextScene( &SceneSelector ); #elif defined(__USER_daveo__) - GameState::setNextScene( &GameScene ); + if (TestFMA==-1) + { + GameState::setNextScene( &GameScene ); + } + else + { + FmaScene.selectFma((CFmaScene::FMA_SCRIPT_NUMBER)TestFMA); + GameState::setNextScene(&FmaScene); + + } #elif defined(__USER_charles__) GameState::setNextScene( &MapScene ); #else