diff options
Diffstat (limited to '')
-rw-r--r-- | include/playerAnim.h | 182 | ||||
-rw-r--r-- | include/sfx.h | 3 | ||||
-rw-r--r-- | src/koopatlas/mapdata.h | 11 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 217 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.h | 2 | ||||
-rw-r--r-- | src/koopatlas/player.h | 181 |
6 files changed, 290 insertions, 306 deletions
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 <common.h>
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 <playeranim.h> class daWMPlayer_c : public dActor_c { |