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/mapdata.h | 11 ++- src/koopatlas/pathmanager.cpp | 217 ++++++++++++++++++------------------------ src/koopatlas/pathmanager.h | 2 + src/koopatlas/player.h | 181 +---------------------------------- 4 files changed, 106 insertions(+), 305 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index 70c31ee..a0df0dc 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -112,6 +112,15 @@ struct dKPPath_s { ALWAYS_AVAILABLE = 3 }; + enum Animation { + WALK = 0, WALK_SAND = 1, WALK_SNOW = 2, WALK_WATER = 3, + JUMP = 4, JUMP_SAND = 5, JUMP_SNOW = 6, JUMP_WATER = 7, + LADDER = 8, LADDER_LEFT = 9, LADDER_RIGHT = 10, FALL = 11, + SWIM = 12, RUN = 13, PIPE = 14, DOOR = 15, + TJUMPED = 16, ENTER_CAVE = 17, LEAVE_CAVE = 18, INVISIBLE = 19, + MAX_ANIM = 20 + }; + dKPNode_s *start, *end; dKPLayer_s *tileLayer, *doodadLayer; @@ -119,7 +128,7 @@ struct dKPPath_s { u8 isSecret; u8 _padding[2]; float speed; - int animation; + Animation animation; void setLayerAlpha(u8 alpha); }; 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; diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index e010aa4..d22168b 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -35,6 +35,8 @@ class dWMPathManager_c { bool isJumping; float moveSpeed; + int scaleAnimProgress; + dKPPath_s *currentPath; bool reverseThroughPath; // direction we are going through the path diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index 6fbbf5a..d553afb 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -3,186 +3,7 @@ #include "koopatlas/core.h" #include "poweruphax.h" - -enum PlayerAnim { - wait = 0, - walk = 1, - run = 2, - b_dash = 3, - b_dash2 = 4, - jump = 5, - jump2 = 6, - jumped = 7, - Tjmp_c_1 = 8, - Tjmp_c_2 = 9, - Tjumped = 10, - roll_jump = 11, - Tjump2 = 12, - mame_jump2 = 13, - turn = 14, - turned = 15, - hipsr = 16, - hipat = 17, - hiped = 18, - hip_to_stoop = 19, - stoop = 20, - stoop_start = 21, - slip = 22, - sliped = 23, - slip_to_stoop = 24, - carry_wait = 25, - carry_walk = 26, - carry_throw = 27, - Rcarry_wait = 28, - wsld = 29, - fire_at = 30, - swim_fire_at = 31, - swim_fire_at2 = 32, - star_roll = 33, - P_swim = 34, - swim = 35, - swim_wait = 36, - swim_throw = 37, - swim_walk = 38, - swim_standing = 39, - paddle_1 = 40, - paddle_2 = 41, - paddle_carry = 42, - tree_start = 43, - tree_wait = 44, - tree_climb = 45, - tree_pose = 46, - monkey_start = 47, - monkey_wait_r = 48, - monkey_wait_l = 49, - monkey_r_to_l = 50, - monkey_l_to_r = 51, - net_wait = 52, - net_walk1 = 53, - net_walk2 = 54, - net_attack = 55, - pea_plant = 56, - pea_plant_st = 57, - pea_plant_wait = 58, - wall_wait = 59, - wall_walk_l = 60, - wall_walk_r = 61, - hang_start = 62, - hang_up = 63, - hang_wait = 64, - hang_walk_l = 65, - hang_walk_r = 66, - w_jump1 = 67, - w_jump2 = 68, - RTjumped = 69, - jump_hang = 70, - spin_st = 71, - spin_end = 72, - spin_low_st = 73, - spin_low_ed = 74, - spin_jump2 = 75, - spin_jump_end = 76, - damF = 77, - damB = 78, - dowF = 79, - dowB = 80, - firejmp = 81, - e_shock = 82, - dead = 83, - dead_pose = 84, - Rtree_start = 85, - Rtree_wait = 86, - Rtree_pose = 87, - goal_jump = 88, - goal_jump_ed = 89, - goal_puton_capA = 90, - goal_puton_capB = 91, - goal_puton_capC = 92, - PL_Rgoal_puton_cap = 93, - P_Rgoal_puton_cap = 94, - goal_puton_capF = 95, - waitB = 96, - eat_out = 97, - eat_success = 98, - eat_fail = 99, - eat_successB = 100, - eat_successC = 101, - Seat = 102, - Seat_out = 103, - Seat_success = 104, - Seat_fail = 105, - Seat_successB = 106, - Seat_successC = 107, - carryP_start = 108, - carryP_wait = 109, - carryP_walk = 110, - carryP_throw = 111, - carryP_waitR = 112, - ride_on = 113, - Fjump = 114, - waitC = 115, - set_to_wait = 116, - star_rollB = 117, - Sjump = 118, - Sjump2 = 119, - Sjumped = 120, - get_down = 121, - turnB = 122, - turnedB = 123, - ice_slipF = 124, - ice_slipB = 125, - rope_swing = 126, - shoot = 127, - shoot_slip = 128, - shoot_slip_end = 129, - low_walk_start = 130, - low_walk = 131, - swim_pipe = 132, - door_walk = 133, - PL_spin_jump = 134, - waitL = 135, - waitR = 136, - fire_at2 = 137, - blow_up = 138, - P_slip = 139, - P_slip_jump = 140, - P_slip_jump2 = 141, - FjumpB = 142, - stamp = 143, - waitRB = 144, - waitLB = 145, - waitR3 = 146, - waitL3 = 147, - boss_key_get = 148, - balloon_wait = 149, - slope_waitL = 150, - slope_waitR = 151, - slope_waitL2 = 152, - slope_waitR2 = 153, - carryP_waitLB = 154, - carryP_waitRB = 155, - carry_waitL = 156, - carry_waitR = 157, - spin_jump3 = 158, - ride_wait = 159, - P_paddle_1 = 160, - P_paddle_2 = 161, - poseL = 162, - poseR = 163, - gorl_wait = 164, - dm_notice = 165, - dm_noti_wait = 166, - dm_surprise = 167, - dm_surp_wait = 168, - wait_select = 169, - course_in = 170, - waitD = 171, - waitE = 172, - dm_escort = 173, - dm_glad = 174, - ending_wait = 175, - coin_comp = 176 -}; +#include class daWMPlayer_c : public dActor_c { -- 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 +++++++++++++++++++++++++++++++++---------- src/koopatlas/pathmanager.h | 4 ++++ 2 files changed, 43 insertions(+), 11 deletions(-) (limited to 'src/koopatlas') 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); } } diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index d22168b..6f2e763 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -19,6 +19,8 @@ class dWMPathManager_c { return (path != 0) && (path->isAvailable); } + int beginWait; + void startMovementTo(dKPPath_s *path); void moveThroughPath(); void activatePoint(); @@ -53,6 +55,8 @@ class dWMPathManager_c { bool evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack); bool isEnteringLevel; + int levelStartWait; + dLevelInfo_c::entry_s *enteredLevel; }; #endif -- 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 +++++++++++++++++++++++-------------------- src/koopatlas/pathmanager.h | 3 +- 2 files changed, 37 insertions(+), 34 deletions(-) (limited to 'src/koopatlas') 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); diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index 6f2e763..9be8e86 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -19,8 +19,6 @@ class dWMPathManager_c { return (path != 0) && (path->isAvailable); } - int beginWait; - void startMovementTo(dKPPath_s *path); void moveThroughPath(); void activatePoint(); @@ -49,6 +47,7 @@ class dWMPathManager_c { int unlockingAlpha; // -1 if not used int countdownToFadeIn; + int waitAfterUnlock; private: void unlockPaths(); -- 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') 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/mapdata.h | 2 +- src/koopatlas/pathmanager.cpp | 13 ++++++++----- src/koopatlas/pathmanager.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index a0df0dc..bc0c599 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -117,7 +117,7 @@ struct dKPPath_s { JUMP = 4, JUMP_SAND = 5, JUMP_SNOW = 6, JUMP_WATER = 7, LADDER = 8, LADDER_LEFT = 9, LADDER_RIGHT = 10, FALL = 11, SWIM = 12, RUN = 13, PIPE = 14, DOOR = 15, - TJUMPED = 16, ENTER_CAVE = 17, LEAVE_CAVE = 18, INVISIBLE = 19, + TJUMPED = 16, ENTER_CAVE_UP = 17, RESERVED_18 = 18, INVISIBLE = 19, MAX_ANIM = 20 }; 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--; diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index 9be8e86..3c3ae1f 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -36,6 +36,7 @@ class dWMPathManager_c { float moveSpeed; int scaleAnimProgress; + bool isScalingUp; dKPPath_s *currentPath; bool reverseThroughPath; // direction we are going through the path -- 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') 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 01b29290b95a116c9bd18db567fa51b2bec47846 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 15:59:10 +0200 Subject: fixed effect rendering on the map --- src/koopatlas/map.cpp | 10 ++++++++++ src/koopatlas/map.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src/koopatlas') diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 316c001..ff28e19 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -62,6 +62,12 @@ int dWMMap_c::onCreate() { bgSrtAnm.bindEntry(&bgModel, anmRes, 0, 0); bgModel.bindAnim(&bgSrtAnm, 0.0f); + static int EffectGroups[] = {1,0,4,5,7,8,9,10,11,12,13,14}; + static int EffectPrios[] = {141,142,143,129,144,145,146,147,148,149,150,151}; + for (int i = 0; i < EFFECT_RENDERER_COUNT; i++) { + effectRenderers[i].setupEffectRenderer(&allocator, -1, EffectPrios[i], EffectGroups[i]); + } + allocator.unlink(); return true; @@ -83,6 +89,10 @@ int dWMMap_c::onDraw() { renderer.scheduleForDrawing(); bgModel.scheduleForDrawing(); + for (int i = 0; i < EFFECT_RENDERER_COUNT; i++) { + effectRenderers[i].scheduleForDrawing(); + } + dKPMapData_c *dataCls = &dScKoopatlas_c::instance->mapData; renderPathLayer(dataCls->pathLayer); diff --git a/src/koopatlas/map.h b/src/koopatlas/map.h index 8d3e2ae..82bee1f 100644 --- a/src/koopatlas/map.h +++ b/src/koopatlas/map.h @@ -58,6 +58,8 @@ class dWMMap_c : public dBase_c { }; renderer_c renderer; + enum EffRenderCount { EFFECT_RENDERER_COUNT = 12 }; + BGGMEffectRenderer effectRenderers[EFFECT_RENDERER_COUNT]; mHeapAllocator_c allocator; m3d::mdl_c bgModel; -- cgit v1.2.3 From 7bbcfa56ab06e12181a682227b0481d1f0d9b142 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 17:15:17 +0200 Subject: fixed repeating player effects --- src/koopatlas/player.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index ebd0124..ed2aa5b 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -48,8 +48,9 @@ int daWMPlayer_c::onExecute() { this->modelHandler->setSRT(modifiedPos, this->rot, this->scale); if (hasEffect) { - Vec effPos = {pos.x, pos.y, -1000.0}; - effect.spawn(effectName, 0, &effPos, &rot, &scale); } + Vec effPos = {pos.x, pos.y, 3300.0f}; + effect.spawn(effectName, 0, &effPos, &rot, &scale); + } if (hasSound) { timer++; -- cgit v1.2.3 From b9d6e55d5823ec18050ba2bd3c9c968c219dec92 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 17:22:44 +0200 Subject: made the world map effects be loaded --- src/koopatlas/core.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/koopatlas') diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 164ea89..c20d715 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -46,6 +46,7 @@ dScKoopatlas_c *dScKoopatlas_c::build() { } bool WMInit_StartLoading(void*); +bool StockWMInit_LoadEffects(void*); bool WMInit_LoadSIAnims(void*); bool WMInit_EndLoading(void*); bool WMInit_LoadResources1(void*); @@ -56,6 +57,7 @@ bool WMInit_SetupWipe(void*); ChainedFunc initFunctions[] = { WMInit_StartLoading, + StockWMInit_LoadEffects, WMInit_LoadSIAnims, WMInit_EndLoading, WMInit_LoadResources1, @@ -409,6 +411,11 @@ int dScKoopatlas_c::onDelete() { FreeScene(0); FreeScene(1); + CleanUpEffectThings(); + FreeEffects(1); + FreeBreff(1); + FreeBreft(1); + DVD_FreeFile(GetDVDClass2(), "SI_kinoko"); DVD_FreeFile(GetDVDClass2(), "SI_fireflower"); DVD_FreeFile(GetDVDClass2(), "SI_iceflower"); @@ -419,6 +426,8 @@ int dScKoopatlas_c::onDelete() { levelInfoLoader.unload(); mapListLoader.unload(); + CleanUpEffectThings(); + return true; } -- 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/core.h | 2 +- src/koopatlas/hud.cpp | 4 ++-- src/koopatlas/pathmanager.cpp | 53 +++++++++++++++++++++++-------------------- src/koopatlas/pathmanager.h | 7 ++++++ src/koopatlas/player.cpp | 3 +++ 5 files changed, 42 insertions(+), 27 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 2a69927..41fba45 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -18,7 +18,7 @@ #include "koopatlas/pathmanager.h" #define WM_DEBUGGING -// #define WM_SPAMMY_DEBUGGING +#define WM_SPAMMY_DEBUGGING #ifdef WM_DEBUGGING #define MapReport OSReport diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 3989a1c..44b0fce 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -200,7 +200,7 @@ void dWMHud_c::setLevelText(const wchar_t *str, int length) { tw.tagProcessorMaybe = box->tagProc; float width = tw.CalcStringWidth(str, length); - SpammyReport("Text width: %f\n", width); + //SpammyReport("Text width: %f\n", width); layout.findWindowByName("W_levelname")->size.x = width + 22; layout.findPictureByName("P_topleftboxbg")->size.x = width; @@ -370,7 +370,7 @@ void dWMHud_c::setWorldText(const wchar_t *str, int length) { tw.tagProcessorMaybe = box->tagProc; float width = tw.CalcStringWidth(str, length); - SpammyReport("Text width: %f\n", width); + //SpammyReport("Text width: %f\n", width); box->SetString(str); } 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) { diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index 3c3ae1f..4604fc7 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -1,6 +1,13 @@ #ifndef __KOOPATLAS_PATH_MANAGER_H #define __KOOPATLAS_PATH_MANAGER_H +//#define WM_UNLOCK_DEBUGGING +#ifdef WM_UNLOCK_DEBUGGING +#define UnlockCmdReport OSReport +#else +#define UnlockCmdReport(...) +#endif + #include "koopatlas/mapdata.h" extern "C" void *SoundRelatedClass; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index ed2aa5b..3f791b6 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -68,6 +68,9 @@ int daWMPlayer_c::onExecute() { } int daWMPlayer_c::onDraw() { + if (!visible) + return true; + this->modelHandler->draw(); hammerSuit.draw(); -- cgit v1.2.3