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 --- include/playerAnim.h | 182 +++++++++++++++++++++++++++++++++++ include/sfx.h | 3 +- src/koopatlas/mapdata.h | 11 ++- src/koopatlas/pathmanager.cpp | 217 ++++++++++++++++++------------------------ src/koopatlas/pathmanager.h | 2 + src/koopatlas/player.h | 181 +---------------------------------- 6 files changed, 290 insertions(+), 306 deletions(-) create mode 100644 include/playerAnim.h diff --git a/include/playerAnim.h b/include/playerAnim.h new file mode 100644 index 0000000..905703f --- /dev/null +++ b/include/playerAnim.h @@ -0,0 +1,182 @@ +#ifndef PLAYERANIM_H +#define PLAYERANIM_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 +}; +#endif /* PLAYERANIM_H */ diff --git a/include/sfx.h b/include/sfx.h index 61ee664..b84e89c 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -4,6 +4,7 @@ #include enum SFX { + SE_NULL = -1, SE_DEMO_OP_DUMMY_U = 0, SE_DEMO_OP_JUMP_JR_0954f = 1, SE_DEMO_OP_LAND_JR_0983f = 2, @@ -1984,4 +1985,4 @@ enum SFX { SE_GAKKI_L_2_ON = 1977 }; -#endif \ No newline at end of file +#endif 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(-) 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(-) 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(-) 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(-) 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(-) 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 e8701fd19f92b4a2cd7d6bb9c52ca9c558d2221f Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 15:58:40 +0200 Subject: debugging junk for effects --- koopatlas.yaml | 15 +++++++++++++++ src/randomcrap.S | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/koopatlas.yaml b/koopatlas.yaml index 4c79acf..268ee12 100644 --- a/koopatlas.yaml +++ b/koopatlas.yaml @@ -70,3 +70,18 @@ hooks: addr_pal: 0x80926800 data: '60000000' +# try to fix effects? +# - name: WMEffectFixTry +# type: patch +# addr_pal: 0x80124DCC +# data: '2800000D' +# - name: WMEffectDebug +# type: branch_insn +# src_addr_pal: 0x802863AC #Effect::Calc +# src_addr_pal: 0x8016CB10 #mEf::effect_c::spawnWithName or something +# src_addr_pal: 0x802858B0 #Effect::Draw +# src_addr_pal: 0x8016C9CC #DealWithPuttingEffectsOnTheScreen-succeeds with extra RenderEffects +# src_addr_pal: 0x80286A70 +# branch_type: b +# target_func: 'UniversalFunctionLog' + diff --git a/src/randomcrap.S b/src/randomcrap.S index 808009b..36bbde7 100644 --- a/src/randomcrap.S +++ b/src/randomcrap.S @@ -6,3 +6,47 @@ HeapChangeAttempt: lwz 4, 0(4) blr + +.extern OSReport +.global UniversalFunctionLog +UniversalFunctionLog: + stwu r1, -0x10(r1) + stw r0, 0x14(r1) + stw r31, 0xC(r1) + stw r30, 0x8(r1) + mr r31, r3 + mr r30, r4 + + crclr 4*cr1+eq + mr r4, r31 + #Loop through callstack, kind of + lwz r3, 0(r1) + lwz r5, 4(r3) + lwz r3, 0(r3) + lwz r6, 4(r3) + lwz r3, 0(r3) + lwz r7, 4(r3) + lwz r3, 0(r3) + lwz r8, 4(r3) + lwz r3, 0(r3) + lwz r9, 4(r3) + lwz r3, 0(r3) + lwz r10, 4(r3) + #lwz r10, 0x14(r29) + + lis r3, UniLogStr@h + ori r3, r3, UniLogStr@l + bl OSReport + + mr r3, r31 + mr r4, r30 + lwz r30, 0x8(r1) + lwz r31, 0xC(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +.data +UniLogStr: .string "[ULog] returning %8x to: %x > %x > %x > %x > %x > %x\n" + -- 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 --- include/game.h | 10 ++++++++++ kamek_pal.x | 3 +++ src/koopatlas/map.cpp | 10 ++++++++++ src/koopatlas/map.h | 2 ++ 4 files changed, 25 insertions(+) diff --git a/include/game.h b/include/game.h index 169b01d..a5fa86b 100755 --- a/include/game.h +++ b/include/game.h @@ -3092,5 +3092,15 @@ extern "C" u32 GetActivePlayerCount(); #include "newer.h" +class BGGMEffectRenderer : public m3d::proc_c { + private: + u32 effectGroupID; + public: + ~BGGMEffectRenderer(); + void drawOpa(); + void drawXlu(); + virtual bool setupEffectRenderer(mAllocator_c *allocator, int opaPrio, int xluPrio, int groupID); +}; + #endif diff --git a/kamek_pal.x b/kamek_pal.x index 02bc004..c0f9887 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,6 +1,9 @@ SECTIONS { /* Scrolling is annoying, clown car goes here! */ + __dt__18BGGMEffectRendererFv = 0x80092E30; + __vt__18BGGMEffectRenderer = 0x80311908; + __construct_array = 0x802DCC90; m2d__Anm_c__Load = 0x801644F0; m2d__AnmResHandler_c__Load = 0x80163FA0; 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(-) 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 --- include/game.h | 5 +++++ kamek_pal.x | 7 +++++++ src/koopatlas/core.cpp | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/include/game.h b/include/game.h index a5fa86b..837d340 100755 --- a/include/game.h +++ b/include/game.h @@ -3102,5 +3102,10 @@ class BGGMEffectRenderer : public m3d::proc_c { virtual bool setupEffectRenderer(mAllocator_c *allocator, int opaPrio, int xluPrio, int groupID); }; +void CleanUpEffectThings(); +bool FreeEffects(int efNum); +bool FreeBreff(int efNum); +bool FreeBreft(int efNum); + #endif diff --git a/kamek_pal.x b/kamek_pal.x index c0f9887..d88df1e 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,6 +1,13 @@ SECTIONS { /* Scrolling is annoying, clown car goes here! */ + StockWMInit_LoadEffects__FPv = 0x80926B10; + + CleanUpEffectThings__Fv = 0x80093520; + FreeEffects__Fi = 0x800934D0; + FreeBreff__Fi = 0x80093170; + FreeBreft__Fi = 0x800931B0; + __dt__18BGGMEffectRendererFv = 0x80092E30; __vt__18BGGMEffectRenderer = 0x80311908; __construct_array = 0x802DCC90; 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 9df87851bac473d72f8c061af719e2b0a0116dec Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sun, 23 Sep 2012 16:08:54 -0500 Subject: fixed up the level select yaml, fixed snowman pokey and commented out cheep cheep textures --- NewerProject.yaml | 4 ++++ spritetex.yaml | 28 ++++++++++++++++++++++------ src/spritetex.S | 26 +++++++++++++++++++++----- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/NewerProject.yaml b/NewerProject.yaml index ae354bf..056cdbd 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -2,8 +2,11 @@ output_dir: "NewerASM" code_address: 0x808D9000 modules: - processed/prolog.yaml +# - processed/layoutDebug.yaml - processed/fileselect.yaml - processed/magicplatform.yaml + - processed/cutScene.yaml + - processed/bonepiece.yaml - processed/bugfixes.yaml - processed/worldmap.yaml # - processed/koopatlas.yaml @@ -54,5 +57,6 @@ modules: - processed/makeYourOwn.yaml - processed/challengeStar.yaml - processed/singAlong.yaml + - processed/pumpkinGoomba.yaml # - processed/pengi.yaml # - processed/actorlog.yaml diff --git a/spritetex.yaml b/spritetex.yaml index 88d0d55..a15b859 100644 --- a/spritetex.yaml +++ b/spritetex.yaml @@ -443,12 +443,28 @@ hooks: # data: '60000000' # addr_pal: 0x80A9D054 + - name: TEX_PokeySnowmanRotA + type: patch + data: '60000000' + addr_pal: 0x80A9F740 + + - name: TEX_PokeySnowmanRotB + type: patch + data: '60000000' + addr_pal: 0x80A9F768 + - name: TEX_PokeySnowmanRotate type: branch_insn branch_type: bl - src_addr_pal: 0x80A9F76C + src_addr_pal: 0x80AA0690 target_func: 'TEX_PokeySnowmanRotate' + - name: TEX_PokeySnowmanImmuneToIce + type: branch_insn + branch_type: bl + src_addr_pal: 0x80A9D940 + target_func: 'TEX_PokeySnowmanImmuneToIce' + - name: TEX_PokeySnowman type: branch_insn @@ -648,11 +664,11 @@ hooks: src_addr_pal: 0x808BB34C target_func: 'TobiPukuBypass' - - name: TEX_TobiPuku - type: branch_insn - branch_type: bl - src_addr_pal: 0x80AB2288 - target_func: 'TEX_TobiPuku' + # - name: TEX_TobiPuku + # type: branch_insn + # branch_type: bl + # src_addr_pal: 0x80AB2288 + # target_func: 'TEX_TobiPuku' - name: TobiPukuSoundChangeB type: branch_insn diff --git a/src/spritetex.S b/src/spritetex.S index 692a381..7c9f505 100755 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -638,13 +638,10 @@ SnowmanSandToSnowB: - SnowmanPokeyRotate: - - lha r3, 0x102(r30) + li r5, 0x100 blr - .global TEX_PokeySnowmanRotate TEX_PokeySnowmanRotate: @@ -655,10 +652,29 @@ TEX_PokeySnowmanRotate: cmpwi r10, 0x2 bne SnowmanPokeyRotate + li r5, 0 + blr + + +PokeySnowmanImmuneToIce: + lwz r31, 4(r5) + blr + +.global TEX_PokeySnowmanImmuneToIce +TEX_PokeySnowmanImmuneToIce: + lwz r10, 4(r3) + srwi r10, r10, 24 + andi. r10, r10, 0xF + + cmpwi r10, 0x2 + bne PokeySnowmanImmuneToIce + li r3, 0 - sth r3, 0x102(r30) + mtlr r0 blr + + .global TEX_PokeySnowman TEX_PokeySnowman: -- cgit v1.2.3 From 32e3eb665715ae6bf6d633873526715dd140fe91 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sun, 23 Sep 2012 17:43:47 -0500 Subject: shy guy fixes --- shyguy.yaml | 4 ++-- src/shyguy.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/shyguy.yaml b/shyguy.yaml index 3f4ec44..c75c690 100644 --- a/shyguy.yaml +++ b/shyguy.yaml @@ -10,10 +10,10 @@ hooks: - name: UpdateShyGuySpriteInfo type: patch - addr_pal: 0x8030DA3C #0x8030DA18 + addr_pal: 0x8030DA1C #0x8030DA18 # [204] ( 16, 48) ( 0, -24 16: 24) 64? 64? 0? 0? | [8:Environment?] # 00CC 0000 00000010 00000030 00000000 FFFFFFE8 00000010 00000018 0040 0040 0000 0000 0008 0000 - data: '0000 0000' + data: '00000010 00000030 00000000 FFFFFFC0 00000010 00000040 0040 0040 0000 0000 0000 0000' - name: ShyGuySpriteFileInfo type: add_func_pointer diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 174b075..f0ae63a 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -114,6 +114,7 @@ class daShyGuy : public dEn_c { void _vf148(); void _vf14C(); + bool CreateIceActors(); USING_STATES(daShyGuy); DECLARE_STATE(Walk); @@ -354,6 +355,22 @@ daShyGuy *daShyGuy::build() { doStateChange(&StateID_Die); } + DoSomethingCool my_struct; + + extern "C" void sub_80024C20(void); + extern "C" void __destroy_arr(void*, void(*)(void), int, int); + //extern "C" __destroy_arr(struct DoSomethingCool, void(*)(void), int cnt, int bar); + + bool daShyGuy::CreateIceActors() + { + struct DoSomethingCool my_struct = { 0, this->pos, {1.0, 1.5, 1.5}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + this->frzMgr.Create_ICEACTORs( (void*)&my_struct, 1 ); + __destroy_arr( (void*)&my_struct, sub_80024C20, 0x3C, 1 ); + return true; + } + + + void daShyGuy::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Die); } -- cgit v1.2.3 From e739a0171f3efc5791ae32460a341d284efa36be Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 24 Sep 2012 00:52:54 +0200 Subject: fixed fasthack compilation --- src/shyguy.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/shyguy.cpp b/src/shyguy.cpp index f0ae63a..5a21e6c 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -355,8 +355,6 @@ daShyGuy *daShyGuy::build() { doStateChange(&StateID_Die); } - DoSomethingCool my_struct; - extern "C" void sub_80024C20(void); extern "C" void __destroy_arr(void*, void(*)(void), int, int); //extern "C" __destroy_arr(struct DoSomethingCool, void(*)(void), int cnt, int bar); -- cgit v1.2.3 From ec8ad32b054e7680aec1536b36a02f6aaf154c0b Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 24 Sep 2012 00:53:20 +0200 Subject: unfinished ActivePhysics debugging --- NewerProjectKP.yaml | 1 + apDebug.yaml | 9 +++ include/game.h | 5 ++ kamek_pal.x | 4 + src/apDebug.cpp | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 241 insertions(+) create mode 100644 apDebug.yaml create mode 100644 src/apDebug.cpp diff --git a/NewerProjectKP.yaml b/NewerProjectKP.yaml index 934ea99..2f66e32 100644 --- a/NewerProjectKP.yaml +++ b/NewerProjectKP.yaml @@ -2,6 +2,7 @@ output_dir: "NewerASM" code_address: 0x808D9000 modules: - processed/prolog.yaml +# - processed/apDebug.yaml # - processed/layoutDebug.yaml - processed/fileselect.yaml - processed/magicplatform.yaml diff --git a/apDebug.yaml b/apDebug.yaml new file mode 100644 index 0000000..25f87fd --- /dev/null +++ b/apDebug.yaml @@ -0,0 +1,9 @@ +--- +source_files: [../src/apDebug.cpp] +hooks: + - name: DrawAPhysics + type: branch_insn + branch_type: b + src_addr_pal: 0x80830BD8 + target_func: 'APDebugDraw(void)' + diff --git a/include/game.h b/include/game.h index 837d340..4695ea6 100755 --- a/include/game.h +++ b/include/game.h @@ -1213,6 +1213,8 @@ public: void update(); + static Physics *globalListHead; + static Physics *globalListTail; // todo: more stuff that might not be relevant atm }; @@ -1275,6 +1277,9 @@ public: float xCenter(); // Plus more stuff that isn't needed in the public API, I'm pretty sure. + + static ActivePhysics *globalListHead; + static ActivePhysics *globalListTail; }; diff --git a/kamek_pal.x b/kamek_pal.x index d88df1e..6f7db85 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -648,12 +648,15 @@ SECTIONS { addToList__13ActivePhysicsFv = 0x8008C330; initWithStruct__13ActivePhysicsFP8dActor_cPCQ213ActivePhysics4Info = 0x8008C3E0; + globalListHead__13ActivePhysics = 0x8042A140; + __ct__7PhysicsFv = 0x8007F7A0; __dt__7PhysicsFv = 0x8007F810; baseSetup__7PhysicsFP8dActor_cPvPvPvUcUc = 0x8007F9B0; setup__7PhysicsFP8dActor_cffffPvPvPvUcUcP7Point2d = 0x8007FA40; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10; + globalListHead__7Physics = 0x8042A0C0; spinningPhysicsCallback = 0x808A2380; /* spinningPhysicsCallback__7Physics = 0x808A2380; */ @@ -1192,6 +1195,7 @@ SECTIONS { GXSetTexCoordGen2 = 0x801C4910; GXSetNumTexGens = 0x801C4B60; GXBegin = 0x801C56B0; + GXSetLineWidth = 0x801C58E0; GXSetCullMode = 0x801C59A0; GXInitLightAttn = 0x801C6570; GXInitLightSpot = 0x801C65B0; diff --git a/src/apDebug.cpp b/src/apDebug.cpp new file mode 100644 index 0000000..f534e58 --- /dev/null +++ b/src/apDebug.cpp @@ -0,0 +1,222 @@ +#include +#define GEKKO +#include "rvl/mtx.h" +#include "rvl/GXEnum.h" +#include "rvl/GXStruct.h" +#include "rvl/GXTransform.h" +#include "rvl/GXGeometry.h" +#include "rvl/GXDispList.h" +#include "rvl/GXLighting.h" +#include "rvl/GXTev.h" +#include "rvl/GXTexture.h" +#include "rvl/GXCull.h" +#include "rvl/GXPixel.h" +#include "rvl/GXBump.h" +#include "rvl/GXVert.h" +#include "rvl/vifuncs.h" + +class APDebugDrawer : public m3d::proc_c { + public: + APDebugDrawer(); + + bool amISetUp; + mHeapAllocator_c allocator; + + void setMeUp(); + + void drawMe(); + + void drawOpa(); + void drawXlu(); +}; + + +static APDebugDrawer defaultInstance; + +int APDebugDraw() { + defaultInstance.drawMe(); + return 1; +} + + +APDebugDrawer::APDebugDrawer() { + amISetUp = false; +} + +void APDebugDrawer::setMeUp() { + allocator.setup(GameHeaps[0], 0x20); + setup(&allocator); +} + +void APDebugDrawer::drawMe() { + if (!amISetUp) { + setMeUp(); + amISetUp = true; + } + + scheduleForDrawing(); +} + +void APDebugDrawer::drawOpa() { +} +void APDebugDrawer::drawXlu() { + GXClearVtxDesc(); + + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + + GXSetNumIndStages(0); + for (int i = 0; i < 0x10; i++) + GXSetTevDirect((GXTevStageID)i); + + GXSetNumChans(1); + GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); + GXSetChanAmbColor(GX_COLOR0A0, (GXColor){255,255,255,255}); + GXSetChanMatColor(GX_COLOR0A0, (GXColor){255,255,255,255}); + GXSetNumTexGens(0); + + GXSetNumTevStages(1); + GXSetNumIndStages(0); + + GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); +// GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_RASC, GX_CC_ZERO); +// GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); +// GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_RASA, GX_CA_ZERO); +// GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + + GXSetZCompLoc(GX_FALSE); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); + GXSetZMode(GX_TRUE, GX_LEQUAL, GX_FALSE); + GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0); + + GXSetFog(GX_FOG_NONE, 0, 0, 0, 0, (GXColor){0,0,0,0}); + GXSetFogRangeAdj(GX_FALSE, 0, 0); + + GXSetCullMode(GX_CULL_NONE); + + GXSetDither(GX_TRUE); + GXSetLineWidth(18, GX_TO_ZERO); + + GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,255}); + GXSetTevColor(GX_TEVREG1, (GXColor){0,0,0,255}); + + ActivePhysics *ap = ActivePhysics::globalListHead; + + while (ap) { + u32 uptr = (u32)ap; + u8 r = (uptr>>16)&0xFF; + u8 g = (uptr>>8)&0xFF; + u8 b = uptr&0xFF; + u8 a = 0xFF; + + GXBegin(GX_LINES, GX_VTXFMT0, 10); + + float centreX = ap->owner->pos.x + ap->info.xDistToCenter; + float centreY = ap->owner->pos.y + ap->info.yDistToCenter; + float edgeDistX = ap->info.xDistToEdge; + float edgeDistY = ap->info.yDistToEdge; + + float tlX = centreX - edgeDistX, tlY = centreY + edgeDistY; + float trX = centreX + edgeDistX, trY = centreY + edgeDistY; + + float blX = centreX - edgeDistX, blY = centreY - edgeDistY; + float brX = centreX + edgeDistX, brY = centreY - edgeDistY; + + // Top + GXPosition3f32(tlX, tlY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Left + GXPosition3f32(tlX, tlY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Right + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(brX, brY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Bottom + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(brX, brY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Diagonal + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + + GXEnd(); + + ap = ap->listPrev; + } + + Physics *p = Physics::globalListHead; + + while (p) { + u32 uptr = (u32)p; + u8 r = (uptr>>16)&0xFF; + u8 g = (uptr>>8)&0xFF; + u8 b = uptr&0xFF; + u8 a = 0xFF; + + GXBegin(GX_LINES, GX_VTXFMT0, 10); + + float centreX = p->owner->pos.x; + float centreY = p->owner->pos.y; + float edgeDistX = p->_88; + float edgeDistY = p->_8C; + + float tlX = centreX + p->x, tlY = centreY + p->y; + float trX = centreX + p->_88, trY = centreY + p->y; + + float blX = centreX + p->x, blY = centreY + p->_8C; + float brX = centreX + p->_88, brY = centreY + p->_8C; + + // Top + GXPosition3f32(tlX, tlY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Left + GXPosition3f32(tlX, tlY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Right + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(brX, brY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Bottom + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(brX, brY, 8000.0f); + GXColor4u8(r,g,b,a); + + // Diagonal + GXPosition3f32(trX, trY, 8000.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32(blX, blY, 8000.0f); + GXColor4u8(r,g,b,a); + + GXEnd(); + + p = p->next; + } +} -- 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(-) 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