summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp47
-rw-r--r--src/koopatlas/player.cpp2
2 files changed, 37 insertions, 12 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 169668b..0ef89fc 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -687,22 +687,45 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) {
VECScale(&move, &move, moveSpeed);
if (isJumping) {
- float ys = (float)from->y;
- float ye = (float)to->y;
- float midpoint = (from->y + to->y) / 2;
+ bool isFalling;
+ if (from->y == to->y) {
+ float xDistance = to->x - from->x;
+ if (xDistance < 0)
+ xDistance = -xDistance;
+ float currentPoint = max(to->x, from->x) - player->pos.x;
+ player->jumpOffset = (xDistance / 3.0f) * sin((currentPoint / xDistance) * 3.1415f);
+
+ if (to->x > from->x) // Moving right
+ isFalling = (player->pos.x > (to->x - (move.x * 10.0f)));
+ else // Moving left
+ isFalling = (player->pos.x < (to->x + (move.x * 10.0f)));
- float top, len;
- if (ys > ye) { len = ys - ye; top = ys - midpoint + 10.0; }
- else { len = ye - ys; top = ye - midpoint + 10.0; }
+ } else {
+ float ys = (float)from->y;
+ float ye = (float)to->y;
+ float midpoint = (from->y + to->y) / 2;
+
+ float top, len;
+ if (ys > ye) { len = ys - ye; top = ys - midpoint + 10.0; }
+ else { len = ye - ys; top = ye - midpoint + 10.0; }
+
+ if (len == 0.0) { len = 2.0; }
- if (len == 0.0) { len = 2.0; }
+ float a;
+ if (timer > 0.0) { a = -timer; }
+ else { a = timer; }
- float a;
- if (timer > 0.0) { a = -timer; }
- else { a = timer; }
- player->jumpOffset = -sin(a * 3.14 / len) * top;
- timer -= move.y;
+ player->jumpOffset = -sin(a * 3.14 / len) * top;
+ timer -= move.y;
+
+ if (ye > ys) // Moving down
+ isFalling = (-player->pos.y) > (ye - (move.y * 10.0f));
+ else // Moving up
+ isFalling = (-player->pos.y) < (ye + (move.y * 10.0f));
+ }
+ if (isFalling)
+ player->startAnimation(jumped, 1.0f, 10.0f, 0.0f);
}
player->pos.x += move.x;
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index 00092cd..e549871 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -53,6 +53,8 @@ int daWMPlayer_c::onExecute() {
mMtx myMatrix;
myMatrix.scale(scale.x, scale.y, scale.z);
myMatrix.applyTranslation(pos.x, pos.y + jumpOffset, pos.z);
+ if (dScKoopatlas_c::instance->warpZoneHacks && (currentAnim == jump || currentAnim == jumped))
+ myMatrix.applyTranslation(0, 0, 600.0f);
myMatrix.applyRotationX(&rot.x);
myMatrix.applyRotationY(&rot.y);
// Z is unused for now