diff options
author | Treeki <treeki@gmail.com> | 2013-02-25 22:02:46 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-02-25 22:02:46 +0100 |
commit | 6cfe2dd3ddce416e8884dd61218751bc5c77e54c (patch) | |
tree | ccaa490b16d873b80c22d572a2b06adbf2b40351 /src/koopatlas/pathmanager.cpp | |
parent | b14d7c87531ae8d19120033d67f1c1917143fb37 (diff) | |
download | kamek-6cfe2dd3ddce416e8884dd61218751bc5c77e54c.tar.gz kamek-6cfe2dd3ddce416e8884dd61218751bc5c77e54c.zip |
lots of tweaks to animations and sounds for map paths
Diffstat (limited to 'src/koopatlas/pathmanager.cpp')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 0855bd4..cf3e0eb 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -181,6 +181,9 @@ dWMPathManager_c::~dWMPathManager_c() { } } } + + if (penguinSlideSound.Exists()) + penguinSlideSound.Stop(5); } void dWMPathManager_c::unlockPaths() { @@ -613,8 +616,17 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { player->scale.x = player->scale.y = player->scale.z = playerScale; int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; + int whichAnim = Animations[id].anim; + float updateRate = Animations[id].animParam1; + if (whichAnim == swim_wait) { + if (player->modelHandler->mdlClass->powerup_id == 3) { + whichAnim = b_dash; + updateRate = 2.5f; + } else if (player->modelHandler->mdlClass->powerup_id == 5) + whichAnim = P_slip; + } - player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f); + player->startAnimation(whichAnim, updateRate, Animations[id].animParam2, 0.0f); if (Animations[id].forceRotation != -1) { forcedRotation = true; @@ -626,6 +638,12 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f; moveSpeed = path->speed * moveSpeed; + if (path->animation == dKPPath_s::SWIM) { + if (player->modelHandler->mdlClass->powerup_id == 3) + moveSpeed *= 1.1f; + else if (player->modelHandler->mdlClass->powerup_id == 5) + moveSpeed *= 2.0f; + } if (Animations[id].repeatEffect) { player->hasEffect = true; @@ -645,13 +663,36 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { SpawnEffect(Animations[id].initialEffect, 0, &player->pos, 0, &player->scale); } - if (Animations[id].initialSound != SE_NULL) { - nw4r::snd::SoundHandle something; - PlaySoundWithFunctionB4(SoundRelatedClass, &something, Animations[id].initialSound, 1); + if (path->animation == dKPPath_s::SWIM) { + if (player->modelHandler->mdlClass->powerup_id == 5) { + if (!swimming) { + nw4r::snd::SoundHandle something; + if (firstPathDone) + PlaySoundWithFunctionB4(SoundRelatedClass, &something, SE_VOC_MA_PNGN_SLIDE, 1); + PlaySoundWithFunctionB4(SoundRelatedClass, &penguinSlideSound, SE_EMY_PENGUIN_SLIDE, 1); + } + player->hasSound = false; + } else if (player->modelHandler->mdlClass->powerup_id == 3) { + player->hasSound = true; + player->soundName = SE_PLY_FOOTNOTE_WATER; + } + swimming = true; + } else { + if (swimming && penguinSlideSound.Exists()) { + penguinSlideSound.Stop(10); + penguinSlideSound.DetachSound(); + } + swimming = false; - if (Animations[id].initialSound == SE_PLY_JUMP) { - nw4r::snd::SoundHandle something2; - PlaySoundWithFunctionB4(SoundRelatedClass, &something2, SE_VOC_MA_CS_JUMP, 1); + if (Animations[id].initialSound != SE_NULL) { + nw4r::snd::SoundHandle something; + PlaySoundWithFunctionB4(SoundRelatedClass, &something, Animations[id].initialSound, 1); + + if (Animations[id].initialSound == SE_PLY_JUMP) { + nw4r::snd::SoundHandle something2; + PlaySoundWithFunctionB4(SoundRelatedClass, &something2, SE_VOC_MA_CS_JUMP, 1); + something2.SetPitch(player->modelHandler->mdlClass->powerup_id == 3 ? 1.5f : 1.0f); + } } } } @@ -903,6 +944,7 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { SpammyReport("stopping here\n"); isMoving = false; + swimming = false; SaveBlock *save = GetSaveFile()->GetBlock(-1); save->current_path_node = pathLayer->findNodeID(to); @@ -913,6 +955,8 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { SpammyReport("passthrough node, continuing to next path\n"); } } + + firstPathDone = true; } void dWMPathManager_c::copyWorldDefToSave(const dKPWorldDef_s *world) { |