summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp50
-rw-r--r--src/koopatlas/pathmanager.h5
-rw-r--r--src/koopatlas/player.cpp4
3 files changed, 35 insertions, 24 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 6cf0750..f33bc7b 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -6,6 +6,8 @@
void dWMPathManager_c::setup() {
isMoving = false;
+ isJumping = false;
+ timer = 0.0;
currentPath = 0;
reverseThroughPath = false;
@@ -126,29 +128,15 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("f\n");
daWMPlayer_c *player = daWMPlayer_c::instance;
SpammyReport("g %p\n", player);
- // path->speed
- // wait = 0,
- // walk = 1,
- // run = 2,
- // b_dash2 = 4,
-
- // jump = 5,
- // 2jmp_c_2 = 9,
- // 2jumped = 10,
-
- // tree_climb = 45,
-
- // swim_wait
- // swim_walk = 38,
+ // Consider adding these as options
// wall_walk_l = 60,
// wall_walk_r = 61,
// hang_walk_l = 65,
// hang_walk_r = 66,
- // wait, door_walk
SpammyReport("h\n");
player->rot.y = direction;
player->hasSound = false;
@@ -188,18 +176,22 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
case 4:
player->startAnimation(jump, 1.0, 1.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 5:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 6:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
break;
case 7:
player->startAnimation(jump, 1.0, 10.0, 0.0);
MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ isJumping = true;
SpawnEffect("Wm_mr_waterwave_out", 0, &player->pos, 0, &player->scale);
break;
@@ -225,7 +217,6 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
// Others
case 12:
- OSReport("Swimming");
player->startAnimation(swim_wait, 1.2, 10.0, 0.0);
player->hasSound = true;
player->hasEffect = true;
@@ -233,23 +224,19 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
player->effectName = "Wm_mr_waterswim";
break;
case 13:
- OSReport("Falling");
player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
break;
case 14:
- OSReport("Dashing");
player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_DIRT;
break;
case 15:
- OSReport("Piping");
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x0000;
MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
break;
case 16:
- OSReport("Dooring");
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x8000;
MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
@@ -277,8 +264,24 @@ void dWMPathManager_c::moveThroughPath() {
daWMPlayer_c *player = daWMPlayer_c::instance;
- player->pos.x += move.x;
- player->pos.y -= move.y;
+ if (isJumping) {
+ float midpoint = (from->y + to->y) / 2;
+
+ keysY[0] = (HermiteKey){ from->y, 0.0, 1.0 };
+ keysY[1] = (HermiteKey){ midpoint, 48.0, 0.8 };
+ keysY[2] = (HermiteKey){ to->y, 0.0, 1.0 };
+
+ float modY = GetHermiteCurveValue(player->pos.y, keysY, 3);
+ OSReport("From: %f to %f, midpoint at: %f, pos at %f, Y mod: %f", from->y, to->y, midpoint, player->pos.y, modY);
+
+ player->pos.x += move.x;
+ player->pos.y -= move.y;
+ }
+
+ else {
+ player->pos.x += move.x;
+ player->pos.y -= move.y;
+ }
// Check if we've reached the end yet
if (
@@ -290,6 +293,9 @@ void dWMPathManager_c::moveThroughPath() {
player->pos.x = to->x;
player->pos.y = -to->y;
+ isJumping = false;
+ timer = 0.0;
+
SpammyReport("reached path end (%p)\n", to);
if (to->type == dKPNode_s::CHANGE) {
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index a9a04ed..66c5e3b 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -25,6 +25,11 @@ class dWMPathManager_c {
bool isMoving;
dKPNode_s *currentNode;
+ HermiteKey keysX[2];
+ HermiteKey keysY[3];
+ float timer;
+ bool isJumping;
+
dKPPath_s *currentPath;
bool reverseThroughPath; // direction we are going through the path
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index c6820a0..d0ec607 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -44,13 +44,13 @@ int daWMPlayer_c::onExecute() {
if (hasSound) {
timer++;
- if (timer == 10) {
+ if (timer == 12) {
if (step) { MapSoundPlayer(SoundRelatedClass, soundName, 1); step = false; }
else { MapSoundPlayer(SoundRelatedClass, soundName+1, 1); step = true; }
timer = 0;
}
- if (timer > 10) { timer = 0; }
+ if (timer > 12) { timer = 0; }
}