summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-20 15:10:14 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-20 15:10:14 -0500
commit2d39f19d92673bb9a8f12a71bbd6d86dd2166237 (patch)
treeae0c64dd5329b42564c00ecb990b956467addea0 /src/koopatlas
parent7db25a9cb78f98d57fa0e386eb4a14c2842d52e7 (diff)
downloadkamek-2d39f19d92673bb9a8f12a71bbd6d86dd2166237.tar.gz
kamek-2d39f19d92673bb9a8f12a71bbd6d86dd2166237.zip
Bugfix to the hud, added in player animations for path movement
Diffstat (limited to 'src/koopatlas')
-rw-r--r--src/koopatlas/core.h3
-rw-r--r--src/koopatlas/hud.cpp4
-rw-r--r--src/koopatlas/pathmanager.cpp155
-rw-r--r--src/koopatlas/pathmanager.h4
-rw-r--r--src/koopatlas/player.cpp154
-rw-r--r--src/koopatlas/player.h191
6 files changed, 440 insertions, 71 deletions
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index 54030ab..55baf95 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -8,13 +8,14 @@
#include <common.h>
#include <game.h>
#include <g3dhax.h>
+#include <sfx.h>
#include "levelinfo.h"
#include "koopatlas/mapdata.h"
#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 72f9d5a..587c2c0 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -5,7 +5,7 @@ void CharToWChar(const char *input, wchar_t *output, int length) { for (int i =
int getStarCoinCount() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
- int coinsSpent = save->ambush_countdown[0];
+ int coinsSpent = 0;
int coinsEarned = 0;
for (int w = 0; w < 10; w++) {
@@ -228,7 +228,7 @@ void dWMHud_c::setPointName() {
void dWMHud_c::checkPointStatus() {
dKPNode_s *node = dScKoopatlas_c::instance->pathManager.currentNode;
- if (node->type == dKPNode_s::LEVEL) {
+ if ((node->type == dKPNode_s::LEVEL) && ((node->levelNumber[1] < 30) || (node->levelNumber[1] > 37))) {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
int world = node->levelNumber[0];
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 632edfa..6cf0750 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -2,6 +2,7 @@
#include "koopatlas/core.h"
#include "koopatlas/hud.h"
#include "koopatlas/player.h"
+#include <sfx.h>
void dWMPathManager_c::setup() {
isMoving = false;
@@ -125,9 +126,142 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("f\n");
daWMPlayer_c *player = daWMPlayer_c::instance;
SpammyReport("g %p\n", player);
- player->startAnimation(2, 2.0, 10.0, 0.0);
+ // path->speed
+
+ // wait = 0,
+ // walk = 1,
+ // run = 2,
+ // b_dash2 = 4,
+
+ // jump = 5,
+ // 2jmp_c_2 = 9,
+ // 2jumped = 10,
+
+ // tree_climb = 45,
+
+ // swim_wait
+ // swim_walk = 38,
+
+ // wall_walk_l = 60,
+ // wall_walk_r = 61,
+
+ // hang_walk_l = 65,
+ // hang_walk_r = 66,
+
+ // wait, door_walk
SpammyReport("h\n");
player->rot.y = direction;
+ player->hasSound = false;
+ player->hasEffect = false;
+
+ 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;
+
+ // Jumping
+ case 4:
+ player->startAnimation(jump, 1.0, 1.0, 0.0);
+ MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ break;
+ case 5:
+ player->startAnimation(jump, 1.0, 10.0, 0.0);
+ MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ break;
+ case 6:
+ player->startAnimation(jump, 1.0, 10.0, 0.0);
+ MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ break;
+ case 7:
+ player->startAnimation(jump, 1.0, 10.0, 0.0);
+ MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
+ SpawnEffect("Wm_mr_waterwave_out", 0, &player->pos, 0, &player->scale);
+ 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;
+ 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;
+ 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;
+ break;
+
+ // Others
+ case 12:
+ OSReport("Swimming");
+ 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";
+ break;
+ case 13:
+ OSReport("Falling");
+ player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
+ break;
+ case 14:
+ OSReport("Dashing");
+ player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
+ player->hasSound = true;
+ player->soundName = SE_PLY_FOOTNOTE_DIRT;
+ break;
+ case 15:
+ OSReport("Piping");
+ player->startAnimation(wait, 2.0, 10.0, 0.0);
+ player->rot.y = 0x0000;
+ MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
+ break;
+ case 16:
+ OSReport("Dooring");
+ player->startAnimation(wait, 2.0, 10.0, 0.0);
+ player->rot.y = 0x8000;
+ MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
+ break;
+ default:
+ OSReport("No animtaion?!");
+ player->startAnimation(run, 2.0, 10.0, 0.0);
+ player->hasSound = true;
+ player->soundName = SE_PLY_FOOTNOTE_DIRT;
+ break;
+ }
+
SpammyReport("i\n");
}
@@ -172,6 +306,8 @@ void dWMPathManager_c::moveThroughPath() {
} else if (to->type != dKPNode_s::PASS_THROUGH) {
// Stop here
player->startAnimation(0, 1.2, 10.0, 0.0);
+ player->hasEffect = false;
+ player->hasSound = false;
SpammyReport("stopping here\n");
@@ -191,10 +327,23 @@ void dWMPathManager_c::moveThroughPath() {
void dWMPathManager_c::activatePoint() {
if (currentNode->type == dKPNode_s::LEVEL) {
- daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0);
-
int w = currentNode->levelNumber[0] - 1;
int l = currentNode->levelNumber[1] - 1;
+
+ if ((l > 29) && (l < 38)) {
+ SaveBlock *save = GetSaveFile()->GetBlock(-1);
+ u32 conds = save->GetLevelCondition(w, l);
+
+ SpammyReport("Toad House Flags: %x", conds);
+ if (conds & 0xFF0) {
+
+ MapSoundPlayer(SoundRelatedClass, SE_SYS_INVALID, 1);
+ return; }
+ }
+
+ MapSoundPlayer(SoundRelatedClass, SE_SYS_GAME_START, 1);
+ daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0);
+
dLevelInfo_c::entry_s *level = dScKoopatlas_c::instance->levelInfo.search(w, l);
dScKoopatlas_c::instance->startLevel(level);
}
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index c5a642c..a9a04ed 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -3,6 +3,10 @@
#include "koopatlas/mapdata.h"
+extern "C" void *SoundRelatedClass;
+extern "C" void *MapSoundPlayer(void *SoundClass, int soundID, int unk);
+extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
+
class dWMPathManager_c {
public:
void setup();
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index f8e491a..c6820a0 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -17,6 +17,13 @@ int daWMPlayer_c::onCreate() {
current_param = 0;
+ hasEffect = false;
+ hasSound = false;
+ step = false;
+ effectName = "";
+ soundName = 0;
+ timer = 0;
+
return true;
}
@@ -31,77 +38,94 @@ int daWMPlayer_c::onExecute() {
this->modelHandler->update();
this->modelHandler->setSRT(this->pos, this->rot, this->scale);
-#ifdef MARIO_OPTIONS
- // Before we leave, do the debug movement stuff
- int heldButtons = Remocon_GetButtons(GetActiveRemocon());
- int nowPressed = Remocon_GetPressed(GetActiveRemocon());
- char buf[100];
- bool updated = false;
- if (nowPressed & WPAD_LEFT) {
- current_param--;
- updated = true;
- }
+ if (hasEffect) { effect.spawn(effectName, 0, &pos, &rot, &scale); }
- if (nowPressed & WPAD_RIGHT) {
- current_param++;
- updated = true;
- }
+ if (hasSound) {
+ timer++;
- if (current_param < 0)
- current_param = 8;
-
- if (current_param > 8)
- current_param = 0;
-
- float pos_mod = 0.0f;
- short rot_mod = 0.0f;
- float scale_mod = 0.0f;
- if (nowPressed & WPAD_ONE) {
- pos_mod -= 5.0f;
- rot_mod -= 0x1000;
- scale_mod -= 0.1f;
- updated = true;
- } else if (nowPressed & WPAD_TWO) {
- pos_mod += 5.0f;
- rot_mod += 0x1000;
- scale_mod += 0.1f;
- updated = true;
- }
+ if (timer == 10) {
+ if (step) { MapSoundPlayer(SoundRelatedClass, soundName, 1); step = false; }
+ else { MapSoundPlayer(SoundRelatedClass, soundName+1, 1); step = true; }
+ timer = 0;
+ }
- if (!updated) return true;
-
- if (current_param == 0) {
- pos.x += pos_mod;
- sprintf(buf, "X position: %f", pos.x);
- } else if (current_param == 1) {
- pos.y += pos_mod;
- sprintf(buf, "Y position: %f", pos.y);
- } else if (current_param == 2) {
- pos.z += pos_mod;
- sprintf(buf, "Z position: %f", pos.z);
- } else if (current_param == 3) {
- rot.x += rot_mod;
- sprintf(buf, "X rotation: 0x%04x", rot.x);
- } else if (current_param == 4) {
- rot.y += rot_mod;
- sprintf(buf, "Y rotation: 0x%04x", rot.y);
- } else if (current_param == 5) {
- rot.z += rot_mod;
- sprintf(buf, "Z rotation: 0x%04x", rot.z);
- } else if (current_param == 6) {
- scale.x += scale_mod;
- sprintf(buf, "X scale: %f", scale.x);
- } else if (current_param == 7) {
- scale.y += scale_mod;
- sprintf(buf, "Y scale: %f", scale.y);
- } else if (current_param == 8) {
- scale.z += scale_mod;
- sprintf(buf, "Z scale: %f", scale.z);
+ if (timer > 10) { timer = 0; }
}
- dScNewerWorldMap_c::instance->SetTitle(buf);
-#endif
+
+
+// #ifdef MARIO_OPTIONS
+// // Before we leave, do the debug movement stuff
+// int heldButtons = Remocon_GetButtons(GetActiveRemocon());
+// int nowPressed = Remocon_GetPressed(GetActiveRemocon());
+// char buf[100];
+// bool updated = false;
+
+// if (nowPressed & WPAD_LEFT) {
+// current_param--;
+// updated = true;
+// }
+
+// if (nowPressed & WPAD_RIGHT) {
+// current_param++;
+// updated = true;
+// }
+
+// if (current_param < 0)
+// current_param = 8;
+
+// if (current_param > 8)
+// current_param = 0;
+
+// float pos_mod = 0.0f;
+// short rot_mod = 0.0f;
+// float scale_mod = 0.0f;
+// if (nowPressed & WPAD_ONE) {
+// pos_mod -= 5.0f;
+// rot_mod -= 0x1000;
+// scale_mod -= 0.1f;
+// updated = true;
+// } else if (nowPressed & WPAD_TWO) {
+// pos_mod += 5.0f;
+// rot_mod += 0x1000;
+// scale_mod += 0.1f;
+// updated = true;
+// }
+
+// if (!updated) return true;
+
+// if (current_param == 0) {
+// pos.x += pos_mod;
+// sprintf(buf, "X position: %f", pos.x);
+// } else if (current_param == 1) {
+// pos.y += pos_mod;
+// sprintf(buf, "Y position: %f", pos.y);
+// } else if (current_param == 2) {
+// pos.z += pos_mod;
+// sprintf(buf, "Z position: %f", pos.z);
+// } else if (current_param == 3) {
+// rot.x += rot_mod;
+// sprintf(buf, "X rotation: 0x%04x", rot.x);
+// } else if (current_param == 4) {
+// rot.y += rot_mod;
+// sprintf(buf, "Y rotation: 0x%04x", rot.y);
+// } else if (current_param == 5) {
+// rot.z += rot_mod;
+// sprintf(buf, "Z rotation: 0x%04x", rot.z);
+// } else if (current_param == 6) {
+// scale.x += scale_mod;
+// sprintf(buf, "X scale: %f", scale.x);
+// } else if (current_param == 7) {
+// scale.y += scale_mod;
+// sprintf(buf, "Y scale: %f", scale.y);
+// } else if (current_param == 8) {
+// scale.z += scale_mod;
+// sprintf(buf, "Z scale: %f", scale.z);
+// }
+
+// dScNewerWorldMap_c::instance->SetTitle(buf);
+// #endif
return true;
}
diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h
index 2b53119..33bd560 100644
--- a/src/koopatlas/player.h
+++ b/src/koopatlas/player.h
@@ -3,6 +3,187 @@
#include "koopatlas/core.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
+};
+
+
class daWMPlayer_c : public dActor_c {
public:
dPlayerModelHandler_c *modelHandler;
@@ -19,6 +200,16 @@ class daWMPlayer_c : public dActor_c {
float currentUnk;
float currentUpdateRate;
+ bool hasEffect;
+ const char *effectName;
+ bool hasSound;
+ bool step;
+ int soundName;
+
+ int timer;
+
+ mEf::es2 effect;
+
void startAnimation(int id, float frame, float unk, float updateRate);
static daWMPlayer_c *build();