diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-07-20 21:29:54 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-07-20 21:29:54 -0500 |
commit | a37e9d8030a5274072cc085db74e463eb4be0a73 (patch) | |
tree | 128457c6cc7ee7ff51574b25cefefb065c2e3a91 /src/koopatlas/pathmanager.cpp | |
parent | 061f0c1d9eda240eace4b638575f0fca1d1a3b1c (diff) | |
download | kamek-a37e9d8030a5274072cc085db74e463eb4be0a73.tar.gz kamek-a37e9d8030a5274072cc085db74e463eb4be0a73.zip |
Arrrgh
Diffstat (limited to 'src/koopatlas/pathmanager.cpp')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 28 |
1 files changed, 14 insertions, 14 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)) && |