diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-07-20 21:29:54 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-07-20 21:29:54 -0500 |
commit | a37e9d8030a5274072cc085db74e463eb4be0a73 (patch) | |
tree | 128457c6cc7ee7ff51574b25cefefb065c2e3a91 /src | |
parent | 061f0c1d9eda240eace4b638575f0fca1d1a3b1c (diff) | |
download | kamek-a37e9d8030a5274072cc085db74e463eb4be0a73.tar.gz kamek-a37e9d8030a5274072cc085db74e463eb4be0a73.zip |
Arrrgh
Diffstat (limited to '')
-rw-r--r-- | src/bossSamurshai.cpp | 52 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 28 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 162 | ||||
-rw-r--r-- | src/koopatlas/player.h | 2 |
4 files changed, 136 insertions, 108 deletions
diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index 88886e9..24c8615 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -4,6 +4,10 @@ #include <sfx.h> #include "boss.h" +extern "C" void *SoundRelatedClass; +extern "C" void *MapSoundPlayer(void *SoundRelatedClass, int soundID, int unk); + + const char* SSarcNameList [] = { "Shynja", NULL @@ -429,8 +433,8 @@ void daSamurshai::updateModelMatrices() { if (timer == 230) { SpawnEffect("Wm_en_hanapetal", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){8.0, 0.1, 1.5}); - PlaySound(this, SE_OBJ_WOOD_BOX_BREAK); - PlaySound(this, SE_BOSS_KAMECK_DOWN); + MapSoundPlayer(SoundRelatedClass, SE_OBJ_WOOD_BOX_BREAK, 1); + MapSoundPlayer(SoundRelatedClass, SE_BOSS_KAMECK_DOWN, 1); this->Kameck->doStateChange(&daKameckDemo::StateID_DieFall); } @@ -440,19 +444,15 @@ void daSamurshai::updateModelMatrices() { } int done = 0; - if ((timer > 360) && (done == 0)) { + if ((timer > 330) && (done == 0)) { u16 amt = (this->direction == 0) ? 0x2800 : 0xD800; done = SmoothRotation(&this->rot.y, amt, 0x2000); } - if (timer == 440) { bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0); } - + if (timer == 400) { bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0); } - // if (timer == 130) { actor->Kameck->doStateChange(&daKameckDemo::StateID_DemoSt); } - // if (timer == 400) { actor->Kameck->doStateChange(&daKameckDemo::StateID_DemoSt2); } - - if (timer == 530) { - // PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + if (timer == 500) { + MapSoundPlayer(SoundRelatedClass, SE_BOSS_WENDY_RING_BOUND, 1); doStateChange(&StateID_Walk); } } @@ -482,6 +482,9 @@ void daSamurshai::updateModelMatrices() { } void daSamurshai::beginState_Walk() { + Chuckles.removeFromList(); + Knuckles.removeFromList(); + bindAnimChr_and_setUpdateRate("c18_RUNNING", 1, 0.0, 0.5); chosenOne = GetSpecificPlayerActor(this->randomPlayer()); @@ -494,6 +497,7 @@ void daSamurshai::updateModelMatrices() { OSReport("Speed: %f / %f", speed.x, max_speed.x); } void daSamurshai::executeState_Walk() { + MapSoundPlayer(SoundRelatedClass, SE_EMY_MOUSE_WALK, 1); float xDistance = pos.x - chosenOne->pos.x; float yDistance = pos.y - chosenOne->pos.y; @@ -571,10 +575,10 @@ void daSamurshai::updateModelMatrices() { } void daSamurshai::executeState_Chop() { - PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); speed.x = speed.x / 1.5; if (chrAnimation.getCurrentFrame() == 15.0) { + MapSoundPlayer(SoundRelatedClass, SE_EMY_CRASHER_PUNCH, 1); if (this->direction == 1) { SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x - 18.0, pos.y + 16.0, pos.z-200.0}, &(S16Vec){0,0,0}, &(Vec){2.5, 0.5, 1.5}); Chuckles.addToList(); @@ -583,10 +587,10 @@ void daSamurshai::updateModelMatrices() { SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x + 18.0, pos.y + 16.0, pos.z-200.0}, &(S16Vec){0,0,0}, &(Vec){2.5, 0.5, 1.5}); Knuckles.addToList(); } - timer += 1; } if (chrAnimation.getCurrentFrame() == 20.0) { + MapSoundPlayer(SoundRelatedClass, SE_OBJ_WOOD_BOX_BREAK, 1); if (this->direction == 1) { SpawnEffect("Wm_en_hit", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_en_hanapetal", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); @@ -600,8 +604,10 @@ void daSamurshai::updateModelMatrices() { } if(this->chrAnimation.isAnimationDone()) { - PlaySoundAsync(this, SE_OBJ_WOOD_BOX_BREAK); - doStateChange(&StateID_Walk); + timer += 1; + if (timer > 45) { + doStateChange(&StateID_Walk); + } } } void daSamurshai::endState_Chop() { } @@ -693,11 +699,15 @@ void daSamurshai::updateModelMatrices() { void daSamurshai::beginState_Uppercut() { bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 2.0); slowDown = false; + timer = 0; } void daSamurshai::executeState_Uppercut() { if ((slowDown) && (this->chrAnimation.isAnimationDone())) { - doStateChange(&StateID_Walk); + timer++; + if (timer > 45) { + doStateChange(&StateID_Walk); + } } if (slowDown) { @@ -706,8 +716,8 @@ void daSamurshai::updateModelMatrices() { if (this->chrAnimation.getCurrentFrame() == 34.0) { topHurts = true; - PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); - PlaySoundAsync(this, SE_BOSS_CMN_JUMP_M); + MapSoundPlayer(SoundRelatedClass, SE_EMY_CRASHER_PUNCH, 1); + MapSoundPlayer(SoundRelatedClass, SE_BOSS_CMN_JUMP_M, 1); speed.y = 4.0; y_speed_inc = -0.1875; @@ -735,7 +745,7 @@ void daSamurshai::updateModelMatrices() { Knuckles.removeFromList(); } - PlaySoundAsync(this, SE_OBJ_WOOD_BOX_BREAK); + MapSoundPlayer(SoundRelatedClass, SE_OBJ_WOOD_BOX_BREAK, 1); topHurts = false; } } @@ -819,7 +829,7 @@ void daSamurshai::updateModelMatrices() { Knuckles.removeFromList(); SpawnEffect("Wm_ob_switch", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); - PlaySoundAsync(this, SE_BOSS_CMN_DAMAGE_DEF); + MapSoundPlayer(SoundRelatedClass, SE_BOSS_CMN_DAMAGE_DEF, 1); } void daSamurshai::executeState_Damage() { calculateTileCollisions(); @@ -859,8 +869,8 @@ void daSamurshai::updateModelMatrices() { Chuckles.removeFromList(); Knuckles.removeFromList(); + MapSoundPlayer(SoundRelatedClass, SE_BOSS_CMN_DAMAGE_LAST, 1); - PlaySoundAsync(this, SE_BOSS_CMN_DAMAGE_LAST); } void daSamurshai::executeState_Outro() { @@ -881,7 +891,7 @@ void daSamurshai::updateModelMatrices() { SpawnEffect("Wm_ob_cmnshotstar", 0, &(Vec){pos.x + 8.0, pos.y - 8.0, pos.z + 500.0}, &(S16Vec){0,0,0}, &(Vec){1.75, 1.75, 1.75}); SpawnEffect("Wm_mr_wirehit_hit", 0, &(Vec){pos.x + 8.0, pos.y, pos.z + 500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); - PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); + MapSoundPlayer(SoundRelatedClass, STRM_BGM_SHIRO_BOSS_CLEAR, 1); MakeMarioEnterDemoMode(); this->dying = 1; diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 50c1ee2..8e0edac 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -265,27 +265,27 @@ void dWMPathManager_c::moveThroughPath() { daWMPlayer_c *player = daWMPlayer_c::instance; if (isJumping) { + float ys = (float)from->y; + float ye = (float)to->y; float midpoint = (from->y + to->y) / 2; - keysY[0] = (HermiteKey){ from->y, 0.0, 1.0 }; - keysY[1] = (HermiteKey){ midpoint, 48.0, 0.8 }; - keysY[2] = (HermiteKey){ to->y, 0.0, 1.0 }; + float top, len; + if (ys > ye) { len = ys - ye; top = ys - midpoint + 4.0; } + else { len = ye - ys; top = ye - midpoint + 4.0; } - float modY = GetHermiteCurveValue(player->pos.y, keysY, 3); - OSReport("From: %f", from->y); - OSReport("ModY: %f", modY); - OSReport("Pos: %f", player->pos.y); - OSReport("From: %f to %f, midpoint at: %f, pos at %f, Y mod: %f", from->y, to->y, midpoint, player->pos.y, modY); + float a; + if (timer > 0.0) { a = -timer; } + else { a = timer; } - player->pos.x += move.x; - player->pos.y -= move.y; - } + player->jumpOffset = -sin(a * 3.14 / len) * top; + OSReport("%f = sin(%f * 3.14 / %f) * %f", player->jumpOffset, a, len, top); - else { - player->pos.x += move.x; - player->pos.y -= move.y; + timer -= move.y; } + player->pos.x += move.x; + player->pos.y -= move.y; + // Check if we've reached the end yet if ( ((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index d0ec607..32cc684 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -23,6 +23,7 @@ int daWMPlayer_c::onCreate() { effectName = ""; soundName = 0; timer = 0; + jumpOffset = 0.0; return true; } @@ -53,84 +54,99 @@ int daWMPlayer_c::onExecute() { if (timer > 12) { timer = 0; } } - - -// #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 + // #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; } int daWMPlayer_c::onDraw() { + matrix.translation(pos.x, pos.y + jumpOffset, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + + + + + OSReport("someVector: %f", this->modelHandler->mdlClass->someVector.x); + this->modelHandler->mdlClass->someVector = (Vec){2.0,2.0,2.0}; + + OSReport("someVectorB: %f", this->modelHandler->mdlClass->someVectorB.x); + this->modelHandler->mdlClass->someVectorB = (Vec){2.0,2.0,2.0}; + + OSReport("headOffs: %f", this->modelHandler->mdlClass->headOffs.x); + this->modelHandler->mdlClass->headOffs = (Vec){2.0,2.0,2.0}; + + this->modelHandler->setMatrix(matrix); this->modelHandler->draw(); return true; diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index 33bd560..6e98e4e 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -208,6 +208,8 @@ class daWMPlayer_c : public dActor_c { int timer; + float jumpOffset; + mEf::es2 effect; void startAnimation(int id, float frame, float unk, float updateRate); |