summaryrefslogtreecommitdiff
path: root/src/koopatlas/pathmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp58
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) {