From 649f1998d02d54344c0b8cd902dea9c770be8656 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 22 Sep 2012 23:32:44 +0200 Subject: refactored animations, and added new untested ones --- src/koopatlas/pathmanager.cpp | 217 ++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 124 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index d329c6d..a80c2b4 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -7,6 +7,7 @@ void dWMPathManager_c::setup() { isMoving = false; isJumping = false; + scaleAnimProgress = -1; timer = 0.0; currentPath = 0; reverseThroughPath = false; @@ -373,131 +374,88 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // hang_walk_l = 65, // hang_walk_r = 66, - SpammyReport("h\n"); - player->rot.y = direction; - player->hasSound = false; - player->hasEffect = false; - moveSpeed = 3.0f; - - switch (path->animation) { - - // Running - case 0: - player->startAnimation(run, 2.0, 10.0, 0.0); - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_DIRT; - break; - case 1: - player->startAnimation(run, 2.0, 10.0, 0.0); - player->hasSound = true; - player->hasEffect = true; - player->soundName = SE_PLY_FOOTNOTE_CS_SAND; - player->effectName = "Wm_mr_foot_sand"; - break; - case 2: - player->startAnimation(run, 2.0, 10.0, 0.0); - player->hasSound = true; - player->hasEffect = true; - player->soundName = SE_PLY_FOOTNOTE_CS_SNOW; - player->effectName = "Wm_mr_foot_snow"; - break; - case 3: - player->startAnimation(run, 2.0, 10.0, 0.0); - player->hasSound = true; - player->hasEffect = true; - player->soundName = SE_PLY_FOOTNOTE_CS_WATER; - player->effectName = "Wm_mr_foot_water"; - break; + static const struct { + PlayerAnim anim; + float animParam1, animParam2; + s16 forceRotation; + float forceSpeed; + SFX repeatSound, initialSound; + const char *repeatEffect, *initialEffect; + } Animations[] = { + // Walking + {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, + {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_SAND,SE_NULL, "Wm_mr_foot_sand",0}, + {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_SNOW,SE_NULL, "Wm_mr_foot_snow",0}, + {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_WATER,SE_NULL, "Wm_mr_foot_water",0}, // Jumping - case 4: - player->startAnimation(jump, 1.0, 1.0, 0.0); - MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1); - isJumping = true; - moveSpeed = 2.5f; - break; - case 5: - player->startAnimation(jump, 1.0, 10.0, 0.0); - MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1); - isJumping = true; - moveSpeed = 2.5f; - break; - case 6: - player->startAnimation(jump, 1.0, 10.0, 0.0); - MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1); - isJumping = true; - moveSpeed = 2.5f; - 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); - moveSpeed = 2.0f; - break; - - // Climbing - case 8: - player->startAnimation(pea_plant, 1.2, 10.0, 0.0); - player->rot.y = 0x8000; - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB; - moveSpeed = 1.5f; - break; - case 9: - player->startAnimation(tree_climb, 1.2, 10.0, 0.0); - player->rot.y = 0xC000; - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB; - moveSpeed = 1.5f; - break; - case 10: - player->startAnimation(tree_climb, 1.2, 10.0, 0.0); - player->rot.y = 0x4000; - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB; - moveSpeed = 1.5f; - break; - - // Others - case 12: - player->startAnimation(swim_wait, 1.2, 10.0, 0.0); - player->hasSound = true; - player->hasEffect = true; - player->soundName = SE_PLY_SWIM; - player->effectName = "Wm_mr_waterswim"; - moveSpeed = 2.0f; - break; - case 13: - player->startAnimation(b_dash2, 3.0, 10.0, 0.0); - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_DIRT; - moveSpeed = 5.0f; - break; - case 14: - player->startAnimation(wait, 2.0, 10.0, 0.0); - player->rot.y = 0x0000; - MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1); - moveSpeed = 1.0f; - break; - case 15: - player->startAnimation(wait, 2.0, 10.0, 0.0); - player->rot.y = 0x8000; - MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1); - moveSpeed = 0.2f; - break; - case 16: - player->startAnimation(Tjumped, 2.0, 0.0, 0.0); - break; - default: - SpammyReport("No animtaion?!"); - player->startAnimation(run, 2.0, 10.0, 0.0); - player->hasSound = true; - player->soundName = SE_PLY_FOOTNOTE_DIRT; - break; + {jump,1.0f,1.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, + {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, + {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0}, + {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,"Wm_mr_waterwave_out"}, + + // Ladder up, left, right + {pea_plant,1.2f,10.0f, 0x8000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, + {tree_climb,1.2f,10.0f, 0xC000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, + {tree_climb,1.2f,10.0f, 0x4000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, + // Fall (default?) + {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, + + // Swim + {swim_wait,1.2f,10.0f, -1,2.0f, SE_PLY_SWIM,SE_NULL, "Wm_mr_waterswim",0}, + // Run + {b_dash2,3.0f,10.0f, -1,5.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, + // Pipe + {wait,2.0f,10.0f, 0x8000,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, + // Door + {wait,2.0f,10.0f, 0x8000,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0}, + + // TJumped + {Tjumped,2.0f,0.0f, -1,-1.0f, SE_NULL,SE_NULL, 0,0}, + + // Enter/leave cave, these are handled specially + {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, + {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, + + // Invisible, this is handled specially + {wait,2.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, + }; + + isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); + + if (path->animation == dKPPath_s::ENTER_CAVE || path->animation == dKPPath_s::LEAVE_CAVE) { + scaleAnimProgress = 60; + if (path->animation == dKPPath_s::LEAVE_CAVE) + player->scale = (Vec){0.0f,0.0f,0.0f}; } - - SpammyReport("i\n"); + + player->visible = (path->animation != dKPPath_s::INVISIBLE); + + int id = (path->animation < dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; + + player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f); + + player->rot.y = (Animations[id].forceRotation >= 0) ? Animations[id].forceRotation : direction; + moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f; + + if (Animations[id].repeatEffect) { + player->hasEffect = true; + player->effectName = Animations[id].repeatEffect; + } else { + player->hasEffect = false; + } + + if (Animations[id].repeatSound != SE_NULL) { + player->hasSound = true; + player->soundName = Animations[id].repeatSound; + } else { + player->hasSound = false; + } + + if (Animations[id].initialEffect) + SpawnEffect(Animations[id].initialEffect, 0, &player->pos, 0, &player->scale); + if (Animations[id].initialSound != SE_NULL) + MapSoundPlayer(SoundRelatedClass, Animations[id].initialSound, 1); } void dWMPathManager_c::moveThroughPath() { @@ -506,12 +464,23 @@ void dWMPathManager_c::moveThroughPath() { from = reverseThroughPath ? currentPath->end : currentPath->start; to = reverseThroughPath ? currentPath->start : currentPath->end; + daWMPlayer_c *player = daWMPlayer_c::instance; + + + if (scaleAnimProgress >= 0) { + float soFar = scaleAnimProgress * (1.6f / 60.0f); + float sc = (currentPath->animation == dKPPath_s::ENTER_CAVE) ? (1.6f - soFar) : soFar; + player->scale.x = player->scale.y = player->scale.z = sc; + + scaleAnimProgress--; + return; + } + + Vec move = (Vec){to->x - from->x, to->y - from->y, 0}; VECNormalize(&move, &move); VECScale(&move, &move, moveSpeed); - daWMPlayer_c *player = daWMPlayer_c::instance; - if (isJumping) { float ys = (float)from->y; float ye = (float)to->y; -- cgit v1.2.3 From 888a7aacf0cc617739e891cb5774ec1da96803ed Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 22 Sep 2012 23:57:21 +0200 Subject: some badly needed polishing for the map engine --- src/koopatlas/pathmanager.cpp | 50 +++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index a80c2b4..300e628 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -11,6 +11,7 @@ void dWMPathManager_c::setup() { timer = 0.0; currentPath = 0; reverseThroughPath = false; + beginWait = 120; pathLayer = dScKoopatlas_c::instance->mapData.pathLayer; @@ -21,6 +22,7 @@ void dWMPathManager_c::setup() { SpammyReport("Unlocking paths\n"); isEnteringLevel = false; + levelStartWait = -1; unlockPaths(); SpammyReport("done\n"); @@ -283,21 +285,44 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta void dWMPathManager_c::execute() { + if (beginWait > 0) { + beginWait--; + return; + } + + if (isEnteringLevel) { + if (levelStartWait > 0) { + levelStartWait--; + if (levelStartWait == 0) { + dScKoopatlas_c::instance->startLevel(enteredLevel); + } + } + return; + } + int nowPressed = Remocon_GetPressed(GetActiveRemocon()); if (isMoving) { moveThroughPath(); } else { - if (nowPressed & WPAD_LEFT && canUseExit(currentNode->leftExit)) - startMovementTo(currentNode->leftExit); - else if (nowPressed & WPAD_RIGHT && canUseExit(currentNode->rightExit)) - startMovementTo(currentNode->rightExit); - else if (nowPressed & WPAD_UP && canUseExit(currentNode->upExit)) - startMovementTo(currentNode->upExit); - else if (nowPressed & WPAD_DOWN && canUseExit(currentNode->downExit)) - startMovementTo(currentNode->downExit); + // Left, right, up, down + int pressedDir = -1; + if (nowPressed & WPAD_LEFT) pressedDir = 0; + else if (nowPressed & WPAD_RIGHT) pressedDir = 1; + else if (nowPressed & WPAD_UP) pressedDir = 2; + else if (nowPressed & WPAD_DOWN) pressedDir = 3; else if (nowPressed & WPAD_TWO) activatePoint(); + + if (pressedDir >= 0) { + if (canUseExit(currentNode->exits[pressedDir])) { + startMovementTo(currentNode->exits[pressedDir]); + } else { + // TODO: maybe remove this? got to see how it looks + static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0}; + daWMPlayer_c::instance->rot.y = directions[pressedDir]; + } + } } // handle path fading @@ -590,6 +615,9 @@ void dWMPathManager_c::moveThroughPath() { } void dWMPathManager_c::activatePoint() { + if (levelStartWait >= 0) + return; + if (currentNode->type == dKPNode_s::LEVEL) { int w = currentNode->levelNumber[0] - 1; int l = currentNode->levelNumber[1] - 1; @@ -613,11 +641,11 @@ void dWMPathManager_c::activatePoint() { MapSoundPlayer(SoundRelatedClass, SE_SYS_GAME_START, 1); daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0); + daWMPlayer_c::instance->rot.y = 0; isEnteringLevel = true; - - dLevelInfo_c::entry_s *level = dScKoopatlas_c::instance->levelInfo.search(w, l); - dScKoopatlas_c::instance->startLevel(level); + levelStartWait = 40; + enteredLevel = dScKoopatlas_c::instance->levelInfo.search(w, l); } } -- cgit v1.2.3 From 6130a0ee3efd6cc3987f2dcfcf26ad6208d22da5 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 03:47:29 +0200 Subject: Various fixes --- src/koopatlas/pathmanager.cpp | 68 +++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 32 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 300e628..4ae0b44 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -11,7 +11,6 @@ void dWMPathManager_c::setup() { timer = 0.0; currentPath = 0; reverseThroughPath = false; - beginWait = 120; pathLayer = dScKoopatlas_c::instance->mapData.pathLayer; @@ -285,11 +284,6 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta void dWMPathManager_c::execute() { - if (beginWait > 0) { - beginWait--; - return; - } - if (isEnteringLevel) { if (levelStartWait > 0) { levelStartWait--; @@ -300,37 +294,14 @@ void dWMPathManager_c::execute() { return; } - int nowPressed = Remocon_GetPressed(GetActiveRemocon()); - - if (isMoving) { - moveThroughPath(); - } else { - // Left, right, up, down - int pressedDir = -1; - if (nowPressed & WPAD_LEFT) pressedDir = 0; - else if (nowPressed & WPAD_RIGHT) pressedDir = 1; - else if (nowPressed & WPAD_UP) pressedDir = 2; - else if (nowPressed & WPAD_DOWN) pressedDir = 3; - else if (nowPressed & WPAD_TWO) - activatePoint(); - - if (pressedDir >= 0) { - if (canUseExit(currentNode->exits[pressedDir])) { - startMovementTo(currentNode->exits[pressedDir]); - } else { - // TODO: maybe remove this? got to see how it looks - static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0}; - daWMPlayer_c::instance->rot.y = directions[pressedDir]; - } - } - } - // handle path fading if (countdownToFadeIn > 0) { countdownToFadeIn--; if (countdownToFadeIn <= 0) { unlockingAlpha = 0; MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT, 1); + } else { + return; } } @@ -355,6 +326,39 @@ void dWMPathManager_c::execute() { // we've reached the end unlockingAlpha = -1; MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT_END, 1); + waitAfterUnlock = 15; + } + + return; + } + + if (waitAfterUnlock > 0) { + waitAfterUnlock--; + return; + } + + int nowPressed = Remocon_GetPressed(GetActiveRemocon()); + + if (isMoving) { + moveThroughPath(); + } else { + // Left, right, up, down + int pressedDir = -1; + if (nowPressed & WPAD_LEFT) pressedDir = 0; + else if (nowPressed & WPAD_RIGHT) pressedDir = 1; + else if (nowPressed & WPAD_UP) pressedDir = 2; + else if (nowPressed & WPAD_DOWN) pressedDir = 3; + else if (nowPressed & WPAD_TWO) + activatePoint(); + + if (pressedDir >= 0) { + if (canUseExit(currentNode->exits[pressedDir])) { + startMovementTo(currentNode->exits[pressedDir]); + } else { + // TODO: maybe remove this? got to see how it looks + static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0}; + daWMPlayer_c::instance->rot.y = directions[pressedDir]; + } } } } @@ -456,7 +460,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { player->visible = (path->animation != dKPPath_s::INVISIBLE); - int id = (path->animation < dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; + int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f); -- cgit v1.2.3 From 41824ae3312c3413d3ef00354aeb5a956f160c89 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 04:04:17 +0200 Subject: fixing animation directions, hopefully? --- src/koopatlas/pathmanager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 4ae0b44..fc17383 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -424,8 +424,8 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,"Wm_mr_waterwave_out"}, // Ladder up, left, right - {pea_plant,1.2f,10.0f, 0x8000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, - {tree_climb,1.2f,10.0f, 0xC000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, + {pea_plant,1.2f,10.0f, -0x7FFF,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, + {tree_climb,1.2f,10.0f, -0x4000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, {tree_climb,1.2f,10.0f, 0x4000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0}, // Fall (default?) {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, @@ -435,9 +435,9 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // Run {b_dash2,3.0f,10.0f, -1,5.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, // Pipe - {wait,2.0f,10.0f, 0x8000,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, + {wait,2.0f,10.0f, -0x7FFF,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, // Door - {wait,2.0f,10.0f, 0x8000,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0}, + {wait,2.0f,10.0f, -0x7FFF,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0}, // TJumped {Tjumped,2.0f,0.0f, -1,-1.0f, SE_NULL,SE_NULL, 0,0}, -- cgit v1.2.3 From ea8aca1a99032a4d5326a62bf5e7e5ed946f2f2a Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 05:06:17 +0200 Subject: finally fixed all animations... I hope? --- src/koopatlas/pathmanager.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index fc17383..38d18d1 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -442,7 +442,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // TJumped {Tjumped,2.0f,0.0f, -1,-1.0f, SE_NULL,SE_NULL, 0,0}, - // Enter/leave cave, these are handled specially + // Enter cave, this is handled specially {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0}, @@ -452,9 +452,12 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); - if (path->animation == dKPPath_s::ENTER_CAVE || path->animation == dKPPath_s::LEAVE_CAVE) { + if (path->animation == dKPPath_s::ENTER_CAVE) { scaleAnimProgress = 60; - if (path->animation == dKPPath_s::LEAVE_CAVE) + // what direction does this path go in? + isScalingUp = (deltaY < 0) ^ reverseThroughPath; + + if (!isScalingUp) player->scale = (Vec){0.0f,0.0f,0.0f}; } @@ -464,7 +467,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f); - player->rot.y = (Animations[id].forceRotation >= 0) ? Animations[id].forceRotation : direction; + player->rot.y = (Animations[id].forceRotation != -1) ? Animations[id].forceRotation : direction; moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f; if (Animations[id].repeatEffect) { @@ -498,7 +501,7 @@ void dWMPathManager_c::moveThroughPath() { if (scaleAnimProgress >= 0) { float soFar = scaleAnimProgress * (1.6f / 60.0f); - float sc = (currentPath->animation == dKPPath_s::ENTER_CAVE) ? (1.6f - soFar) : soFar; + float sc = isScalingUp ? soFar : (1.6f - soFar); player->scale.x = player->scale.y = player->scale.z = sc; scaleAnimProgress--; -- cgit v1.2.3 From b64a916bb622353fdcb80f10168d1a6511e649ef Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 05:32:23 +0200 Subject: I have this uncanny ability to break things right before I commit them --- src/koopatlas/pathmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 38d18d1..733c5e2 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -452,7 +452,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); - if (path->animation == dKPPath_s::ENTER_CAVE) { + if (path->animation == dKPPath_s::ENTER_CAVE_UP) { scaleAnimProgress = 60; // what direction does this path go in? isScalingUp = (deltaY < 0) ^ reverseThroughPath; -- cgit v1.2.3 From 4f567256d015cf7a835ac03b9e5abb8a2a7eb12a Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 24 Sep 2012 05:38:14 +0200 Subject: various changes and bugfixes --- src/koopatlas/pathmanager.cpp | 53 +++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 733c5e2..e1d7993 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -63,7 +63,7 @@ void dWMPathManager_c::setup() { //OSReport("Path: %p nodes %p to %p\n", path, srcNode, destNode); int ct = destNode->getAvailableExitCount(); //OSReport("Dest Node available exits: %d; type: %d\n", ct, destNode->type); - if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) { + if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL || destNode->type == dKPNode_s::CHANGE) { exitTo = candidateExit; //OSReport("Accepting this node\n"); break; @@ -153,36 +153,36 @@ void dWMPathManager_c::unlockPaths() { int cmdID = 0; while (*in != 0) { - SpammyReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID); + UnlockCmdReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID); // begin processing a block bool value = evaluateUnlockCondition(in, save, 0); - SpammyReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value); - //SpammyReport("Unlock condition: %d\n", value); + UnlockCmdReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value); + //UnlockCmdReport("Unlock condition: %d\n", value); // get what it's supposed to affect // for now we'll assume that it affects one or more paths u8 affectedCount = *(in++); - SpammyReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount); + UnlockCmdReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount); for (int i = 0; i < affectedCount; i++) { u8 one = *(in++); u8 two = *(in++); u16 pathID = (one << 8) | two; - SpammyReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID); + UnlockCmdReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID); dKPPath_s *path = pathLayer->paths[pathID]; - SpammyReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path); + UnlockCmdReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path); path->isAvailable = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE; - SpammyReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i); + UnlockCmdReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i); PathAvailabilityData[pathID] = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE; - SpammyReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i); + UnlockCmdReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i); // NEWLY_AVAILABLE is set later, when that stuff is figured out path->setLayerAlpha(value ? 255 : 0); - SpammyReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i); + UnlockCmdReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i); } - SpammyReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount); + UnlockCmdReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount); cmdID++; } @@ -232,14 +232,14 @@ void dWMPathManager_c::unlockPaths() { } bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack) { - SpammyReport("[%p] CondStk:%d begin\n", in, stack); + UnlockCmdReport("[%p] CondStk:%d begin\n", in, stack); u8 controlByte = *(in++); u8 conditionType = (controlByte >> 6); - SpammyReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType); + UnlockCmdReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType); if (conditionType == 0) { - SpammyReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack); + UnlockCmdReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack); return true; } @@ -249,10 +249,10 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta bool isSecret = (controlByte & 0x10); u8 worldNumber = controlByte & 0xF; u8 levelNumber = *(in++); - SpammyReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret); + UnlockCmdReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret); u32 conds = save->GetLevelCondition(worldNumber, levelNumber); - SpammyReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds); + UnlockCmdReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds); if (isSecret) return (conds & COND_SECRET) != 0; @@ -267,7 +267,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta bool value = isOr ? false : true; u8 termCount = (controlByte & 0x3F) + 1; - SpammyReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount); + UnlockCmdReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount); for (int i = 0; i < termCount; i++) { bool what = evaluateUnlockCondition(in, save, stack+1); @@ -278,7 +278,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta value &= what; } - SpammyReport("[%p] CondStk:%d end, returning %d\n", in, stack, value); + UnlockCmdReport("[%p] CondStk:%d end, returning %d\n", in, stack, value); return value; } @@ -365,7 +365,7 @@ void dWMPathManager_c::execute() { void dWMPathManager_c::startMovementTo(dKPPath_s *path) { - SpammyReport("moving to path %p\n", path); + SpammyReport("moving to path %p [%d,%d to %d,%d]\n", path, path->start->x, path->start->y, path->end->x, path->end->y); dWMHud_c::instance->hidePointBar(); SpammyReport("point bar hidden\n"); @@ -435,7 +435,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // Run {b_dash2,3.0f,10.0f, -1,5.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, // Pipe - {wait,2.0f,10.0f, -0x7FFF,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, + {wait,2.0f,10.0f, 0,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, // Door {wait,2.0f,10.0f, -0x7FFF,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0}, @@ -452,16 +452,19 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); + float playerScale = 1.6f; + if (path->animation == dKPPath_s::ENTER_CAVE_UP) { scaleAnimProgress = 60; // what direction does this path go in? isScalingUp = (deltaY < 0) ^ reverseThroughPath; if (!isScalingUp) - player->scale = (Vec){0.0f,0.0f,0.0f}; + playerScale = 0.0f; } player->visible = (path->animation != dKPPath_s::INVISIBLE); + player->scale.x = player->scale.y = player->scale.z = playerScale; int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; @@ -505,7 +508,6 @@ void dWMPathManager_c::moveThroughPath() { player->scale.x = player->scale.y = player->scale.z = sc; scaleAnimProgress--; - return; } @@ -537,8 +539,10 @@ void dWMPathManager_c::moveThroughPath() { // Check if we've reached the end yet if ( - ((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && - ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y)) + (((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && + ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y))) + || + (from->x == to->x && from->y == to->y) ) { currentNode = to; @@ -590,6 +594,7 @@ void dWMPathManager_c::moveThroughPath() { SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID); + ActivateWipe(to->transition); DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0); } else if (reallyStop) { -- cgit v1.2.3