diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-10-15 22:46:57 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-10-15 22:46:57 -0500 |
commit | 4a8e3bab52041db92648a2c8773b0952bdf39703 (patch) | |
tree | 29ff4635019a7caac4b96a438125e72e982cff38 /src/bossRamboo.cpp | |
parent | d287567cb54f4ba68633e3580e5e39a38a533604 (diff) | |
download | kamek-4a8e3bab52041db92648a2c8773b0952bdf39703.tar.gz kamek-4a8e3bab52041db92648a2c8773b0952bdf39703.zip |
Ramboo broken-like, pushing so someone can get me the linker error
Diffstat (limited to '')
-rw-r--r-- | src/bossRamboo.cpp | 198 |
1 files changed, 148 insertions, 50 deletions
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 11c0249..15304c5 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -2,6 +2,7 @@ #include <game.h> #include <g3dhax.h> #include <sfx.h> +#include <stage.h> #include "effects.h" #include "player.h" @@ -15,6 +16,13 @@ class daRamboo_c : public dEn_c { m3d::mdl_c bodyModel; m3d::mdl_c fogModel; + nw4r::g3d::ResFile resFile; + m3d::anmChr_c animationChrA; + m3d::anmChr_c animationChrB; + m3d::anmChr_c animationChrC; + m3d::anmChr_c animationChrD; + + int timer; int ytimer; char BigBossRamboo; @@ -24,9 +32,10 @@ class daRamboo_c : public dEn_c { u64 eventFlag; - void dieBigFall_Execute(); static daRamboo_c *build(); + void bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate); + void setupModels(); void updateModelMatrices(); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -40,6 +49,7 @@ class daRamboo_c : public dEn_c { DECLARE_STATE(Advance); DECLARE_STATE(Wait); DECLARE_STATE(Flee); + DECLARE_STATE(Outro); }; daRamboo_c *daRamboo_c::build() { @@ -62,6 +72,7 @@ CREATE_STATE(daRamboo_c, Grow); CREATE_STATE(daRamboo_c, Advance); CREATE_STATE(daRamboo_c, Wait); CREATE_STATE(daRamboo_c, Flee); +CREATE_STATE(daRamboo_c, Outro); struct EventTable_t { @@ -96,69 +107,51 @@ void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); } -void daRamboo_c::dieBigFall_Execute() { - - if (this->dying == 1) { return; } - this->rot.x = 0x0; // X is vertical axis - this->rot.y = 0xE000; // Y is horizontal axis - this->rot.z = 0x0; // Z is ... an axis >.> +void daRamboo_c::bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate) { + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); + animationChr.bind(&model, anmChr, 1); + model.bindAnim(&animationChr, 0.0); + animationChr.setUpdateRate(rate); +} - if (this->scale.x > 0.1) { - this->pos.y += 2.0; +void daRamboo_c::setupModels() { + allocator.link(-1, GameHeaps[0], 0, 0x20); - PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); - PlaySound(this, SE_EMY_BIG_TERESA_DEAD); + this->resFile.data = getResource("teresa", "g3d/teresa.brres"); + bool ret; - this->scale.x -= 0.175; - this->scale.y -= 0.175; - this->scale.z -= 0.175; + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("fog"); + fogModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&fogModel, 0); - Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("fog"); + ret = this->animationChrA.setup(mdl, anmChr, &this->allocator, 0); - if (this->timer == 30) { - CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756); - CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801); - CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 957); - this->timer = 0; - } - } - else { - this->scale.x = 0.0; - this->scale.y = 0.0; - this->scale.z = 0.0; - - Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; - CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588); - this->dying = 1; - } + nw4r::g3d::ResMdl mdlB = this->resFile.GetResMdl("teresaA"); + bodyModel.setup(mdlB, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); - this->timer += 1; + nw4r::g3d::ResAnmChr anmChrB = this->resFile.GetResAnmChr("move_cartain"); + ret = this->animationChrB.setup(mdlB, anmChrB, &this->allocator, 0); + nw4r::g3d::ResAnmChr anmChrC = this->resFile.GetResAnmChr("shay_teresaA"); + ret = this->animationChrC.setup(mdlB, anmChrC, &this->allocator, 0); + nw4r::g3d::ResAnmChr anmChrD = this->resFile.GetResAnmChr("wait"); + ret = this->animationChrD.setup(mdlB, anmChrD, &this->allocator, 0); + allocator.unlink(); } + int daRamboo_c::onCreate() { OSReport("Creating the Ramboo Model"); - allocator.link(-1, GameHeaps[0], 0, 0x20); - - nw4r::g3d::ResFile rf(getResource("teresa", "g3d/teresa.brres")); - - fogModel.setup(rf.GetResMdl("fog"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&fogModel, 0); - - bodyModel.setup(rf.GetResMdl("teresaA"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&bodyModel, 0); - - - allocator.unlink(); - -// this->BigBossRamboo = this->settings >> 28; + setupModels(); OSReport("Setting Ramboo's Size to 16.0"); @@ -200,9 +193,9 @@ int daRamboo_c::onCreate() { OSReport("Event to activate: %d", eventNum); this->eventFlag = (u64)1 << (eventNum - 1); - - + bindAnimChr_and_setUpdateRates("fog", this->animationChrA, this->fogModel, 1.0); + OSReport("Setting the State"); doStateChange(&StateID_Grow); @@ -219,6 +212,9 @@ int daRamboo_c::onExecute() { acState.execute(); updateModelMatrices(); + if(this->animationChrA.isAnimationDone()) + this->animationChrA.setCurrentFrame(0.0); + if (this->aPhysics.result1 == 1) { char PlayerID = NearestPlayer(this); dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); @@ -227,7 +223,7 @@ int daRamboo_c::onExecute() { } if (EventTable->events & this->eventFlag) { - doStateChange(&StateID_DieBigFall); + doStateChange(&StateID_Outro); } return true; @@ -248,7 +244,7 @@ void daRamboo_c::updateModelMatrices() { fogModel.setScale(&scale); fogModel.calcWorld(false); - matrix.translation(pos.x + 160.0, pos.y - 80.0, pos.z); + matrix.translation(pos.x + 160.0, pos.y - 80.0, pos.z + 200.0); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); bodyModel.setDrawMatrix(matrix); @@ -263,10 +259,15 @@ void daRamboo_c::beginState_Grow() { OSReport("Growing when Kameck Tells me to."); this->timer = 0; // PlaySound(this, SE_BOSS_ROY_MAGIC_MAKE_FAST); + bindAnimChr_and_setUpdateRates("wait", this->animationChrD, this->bodyModel, 1.0); + } void daRamboo_c::executeState_Grow() { + if(this->animationChrD.isAnimationDone()) + this->animationChrD.setCurrentFrame(0.0); + this->timer = this->timer + 1; float scaleSpeed, yPosScaling; @@ -309,9 +310,15 @@ void daRamboo_c::beginState_Advance() { this->speed.y = 0; this->speed.z = 0; this->timer = 0; + + bindAnimChr_and_setUpdateRates("move_cartain", this->animationChrB, this->bodyModel, 1.0); + } void daRamboo_c::executeState_Advance() { + if(this->animationChrB.isAnimationDone()) + this->animationChrB.setCurrentFrame(0.0); + this->pos.x -= this->timer / 32; this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 48; @@ -361,12 +368,17 @@ void daRamboo_c::endState_Wait() { OSReport("No more bouncing."); } void daRamboo_c::beginState_Flee() { + bindAnimChr_and_setUpdateRates("shay_teresaA", this->animationChrC, this->bodyModel, 1.0); + OSReport("Damnit that hurt."); this->timer = 0; } void daRamboo_c::executeState_Flee() { + if(this->animationChrC.isAnimationDone()) + this->animationChrC.setCurrentFrame(0.0); + this->pos.x += (60 - this->timer) / 8; if (this->timer > 60) { doStateChange(&StateID_Wait); } @@ -376,3 +388,89 @@ void daRamboo_c::executeState_Flee() { void daRamboo_c::endState_Flee() { OSReport("Ugh, so dizzy."); } + + + +void daRamboo_c::beginState_Outro() { + + this->timer = 0; + this->rot.x = 0x0; // X is vertical axis + this->rot.y = 0xE000; // Y is horizontal axis + this->rot.z = 0x0; // Z is ... an axis >.> + +} +void daRamboo_c::executeState_Outro() { + + if (this->dying == 1) { + if (this->timer > 180) { + ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); + } + + if (this->timer == 60) { + + if (GetSpecificPlayerActor(0) != 0) { + PlaySound(this, SE_VOC_MA_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(1) != 0) { + PlaySound(this, SE_VOC_LU_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(2) != 0) { + PlaySound(this, SE_VOC_KO_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(3) != 0) { + PlaySound(this, SE_VOC_KO2_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + } + + this->timer += 1; + return; + } + + if (this->scale.x > 0.1) { + + PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); + PlaySound(this, SE_EMY_BIG_TERESA_DEAD); + + // Adjust this to equal the scale of your boss / 80. + this->scale.x -= 0.175; + this->scale.y -= 0.175; + this->scale.z -= 0.175; + + this->pos.y += 2.0; + + Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; + + if (this->timer == 30) { + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756); + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801); + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 957); + this->timer = 0; + } + } + else { + this->scale.x = 0.0; + this->scale.y = 0.0; + this->scale.z = 0.0; + + Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; + + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588); + this->dying = 1; + this->timer = 0; + + PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); + } + + this->timer += 1; + +} +void daRamboo_c::endState_Outro() { } + + |