diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 28 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 162 | ||||
-rw-r--r-- | src/koopatlas/player.h | 2 |
3 files changed, 105 insertions, 87 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 50c1ee2..8e0edac 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -265,27 +265,27 @@ void dWMPathManager_c::moveThroughPath() { daWMPlayer_c *player = daWMPlayer_c::instance; if (isJumping) { + float ys = (float)from->y; + float ye = (float)to->y; 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 top, len; + if (ys > ye) { len = ys - ye; top = ys - midpoint + 4.0; } + else { len = ye - ys; top = ye - midpoint + 4.0; } - float modY = GetHermiteCurveValue(player->pos.y, keysY, 3); - OSReport("From: %f", from->y); - OSReport("ModY: %f", modY); - OSReport("Pos: %f", player->pos.y); - OSReport("From: %f to %f, midpoint at: %f, pos at %f, Y mod: %f", from->y, to->y, midpoint, player->pos.y, modY); + float a; + if (timer > 0.0) { a = -timer; } + else { a = timer; } - player->pos.x += move.x; - player->pos.y -= move.y; - } + player->jumpOffset = -sin(a * 3.14 / len) * top; + OSReport("%f = sin(%f * 3.14 / %f) * %f", player->jumpOffset, a, len, top); - else { - player->pos.x += move.x; - player->pos.y -= move.y; + timer -= move.y; } + player->pos.x += move.x; + player->pos.y -= move.y; + // Check if we've reached the end yet if ( ((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index d0ec607..32cc684 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -23,6 +23,7 @@ int daWMPlayer_c::onCreate() { effectName = ""; soundName = 0; timer = 0; + jumpOffset = 0.0; return true; } @@ -53,84 +54,99 @@ int daWMPlayer_c::onExecute() { if (timer > 12) { timer = 0; } } - - -// #ifdef MARIO_OPTIONS -// // Before we leave, do the debug movement stuff -// int heldButtons = Remocon_GetButtons(GetActiveRemocon()); -// int nowPressed = Remocon_GetPressed(GetActiveRemocon()); -// char buf[100]; -// bool updated = false; - -// if (nowPressed & WPAD_LEFT) { -// current_param--; -// updated = true; -// } - -// if (nowPressed & WPAD_RIGHT) { -// current_param++; -// updated = true; -// } - -// if (current_param < 0) -// current_param = 8; - -// if (current_param > 8) -// current_param = 0; - -// float pos_mod = 0.0f; -// short rot_mod = 0.0f; -// float scale_mod = 0.0f; -// if (nowPressed & WPAD_ONE) { -// pos_mod -= 5.0f; -// rot_mod -= 0x1000; -// scale_mod -= 0.1f; -// updated = true; -// } else if (nowPressed & WPAD_TWO) { -// pos_mod += 5.0f; -// rot_mod += 0x1000; -// scale_mod += 0.1f; -// updated = true; -// } - -// if (!updated) return true; - -// if (current_param == 0) { -// pos.x += pos_mod; -// sprintf(buf, "X position: %f", pos.x); -// } else if (current_param == 1) { -// pos.y += pos_mod; -// sprintf(buf, "Y position: %f", pos.y); -// } else if (current_param == 2) { -// pos.z += pos_mod; -// sprintf(buf, "Z position: %f", pos.z); -// } else if (current_param == 3) { -// rot.x += rot_mod; -// sprintf(buf, "X rotation: 0x%04x", rot.x); -// } else if (current_param == 4) { -// rot.y += rot_mod; -// sprintf(buf, "Y rotation: 0x%04x", rot.y); -// } else if (current_param == 5) { -// rot.z += rot_mod; -// sprintf(buf, "Z rotation: 0x%04x", rot.z); -// } else if (current_param == 6) { -// scale.x += scale_mod; -// sprintf(buf, "X scale: %f", scale.x); -// } else if (current_param == 7) { -// scale.y += scale_mod; -// sprintf(buf, "Y scale: %f", scale.y); -// } else if (current_param == 8) { -// scale.z += scale_mod; -// sprintf(buf, "Z scale: %f", scale.z); -// } - -// dScNewerWorldMap_c::instance->SetTitle(buf); -// #endif + // #ifdef MARIO_OPTIONS + // // Before we leave, do the debug movement stuff + // int heldButtons = Remocon_GetButtons(GetActiveRemocon()); + // int nowPressed = Remocon_GetPressed(GetActiveRemocon()); + // char buf[100]; + // bool updated = false; + + // if (nowPressed & WPAD_LEFT) { + // current_param--; + // updated = true; + // } + + // if (nowPressed & WPAD_RIGHT) { + // current_param++; + // updated = true; + // } + + // if (current_param < 0) + // current_param = 8; + + // if (current_param > 8) + // current_param = 0; + + // float pos_mod = 0.0f; + // short rot_mod = 0.0f; + // float scale_mod = 0.0f; + // if (nowPressed & WPAD_ONE) { + // pos_mod -= 5.0f; + // rot_mod -= 0x1000; + // scale_mod -= 0.1f; + // updated = true; + // } else if (nowPressed & WPAD_TWO) { + // pos_mod += 5.0f; + // rot_mod += 0x1000; + // scale_mod += 0.1f; + // updated = true; + // } + + // if (!updated) return true; + + // if (current_param == 0) { + // pos.x += pos_mod; + // sprintf(buf, "X position: %f", pos.x); + // } else if (current_param == 1) { + // pos.y += pos_mod; + // sprintf(buf, "Y position: %f", pos.y); + // } else if (current_param == 2) { + // pos.z += pos_mod; + // sprintf(buf, "Z position: %f", pos.z); + // } else if (current_param == 3) { + // rot.x += rot_mod; + // sprintf(buf, "X rotation: 0x%04x", rot.x); + // } else if (current_param == 4) { + // rot.y += rot_mod; + // sprintf(buf, "Y rotation: 0x%04x", rot.y); + // } else if (current_param == 5) { + // rot.z += rot_mod; + // sprintf(buf, "Z rotation: 0x%04x", rot.z); + // } else if (current_param == 6) { + // scale.x += scale_mod; + // sprintf(buf, "X scale: %f", scale.x); + // } else if (current_param == 7) { + // scale.y += scale_mod; + // sprintf(buf, "Y scale: %f", scale.y); + // } else if (current_param == 8) { + // scale.z += scale_mod; + // sprintf(buf, "Z scale: %f", scale.z); + // } + + // dScNewerWorldMap_c::instance->SetTitle(buf); + // #endif return true; } int daWMPlayer_c::onDraw() { + matrix.translation(pos.x, pos.y + jumpOffset, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + + + + + OSReport("someVector: %f", this->modelHandler->mdlClass->someVector.x); + this->modelHandler->mdlClass->someVector = (Vec){2.0,2.0,2.0}; + + OSReport("someVectorB: %f", this->modelHandler->mdlClass->someVectorB.x); + this->modelHandler->mdlClass->someVectorB = (Vec){2.0,2.0,2.0}; + + OSReport("headOffs: %f", this->modelHandler->mdlClass->headOffs.x); + this->modelHandler->mdlClass->headOffs = (Vec){2.0,2.0,2.0}; + + this->modelHandler->setMatrix(matrix); this->modelHandler->draw(); return true; diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index 33bd560..6e98e4e 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -208,6 +208,8 @@ class daWMPlayer_c : public dActor_c { int timer; + float jumpOffset; + mEf::es2 effect; void startAnimation(int id, float frame, float unk, float updateRate); |