diff options
author | Stephen Simpson <megazig@gmail.com> | 2011-10-19 12:36:15 -0500 |
---|---|---|
committer | Stephen Simpson <megazig@gmail.com> | 2011-10-19 12:36:15 -0500 |
commit | b14405c831f2e94f771f65e786d7b2b88146ca97 (patch) | |
tree | 75e4b3d9eb75db7e2b09566dc51809be571f389c /src/bossRamboo.cpp | |
parent | 4d5d95ec2c70578627353e40047462c82ac695c1 (diff) | |
parent | 80e51e409ca322ff22431be8a33131d2f705a8c7 (diff) | |
download | kamek-b14405c831f2e94f771f65e786d7b2b88146ca97.tar.gz kamek-b14405c831f2e94f771f65e786d7b2b88146ca97.zip |
Merge branch 'level-select' into megaTestBoss
Diffstat (limited to 'src/bossRamboo.cpp')
-rw-r--r-- | src/bossRamboo.cpp | 278 |
1 files changed, 219 insertions, 59 deletions
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 11c0249..6bc7e51 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" @@ -13,20 +14,29 @@ class daRamboo_c : public dEn_c { mHeapAllocator_c allocator; m3d::mdl_c bodyModel; + m3d::mdl_c hideModel; m3d::mdl_c fogModel; + nw4r::g3d::ResFile resFile; + m3d::anmChr_c anmFog; + m3d::anmChr_c anmWaitA; + m3d::anmChr_c anmShayA; + m3d::anmChr_c anmWaitB; + m3d::anmChr_c anmShayB; + int timer; int ytimer; - char BigBossRamboo; + char Hiding; float Baseline; float dying; 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 +50,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 +73,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 +108,59 @@ 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"); + this->fogModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&this->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->anmFog.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"); + this->bodyModel.setup(mdlB, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&this->bodyModel, 0); - this->timer += 1; + nw4r::g3d::ResAnmChr anmChrC = this->resFile.GetResAnmChr("shay_teresaA"); + ret = this->anmShayA.setup(mdlB, anmChrC, &this->allocator, 0); + nw4r::g3d::ResAnmChr anmChrD = this->resFile.GetResAnmChr("wait"); + ret = this->anmWaitA.setup(mdlB, anmChrD, &this->allocator, 0); -} + nw4r::g3d::ResMdl mdlC = this->resFile.GetResMdl("teresaB"); + this->hideModel.setup(mdlC, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&this->bodyModel, 0); + nw4r::g3d::ResAnmChr anmChrE = this->resFile.GetResAnmChr("shay_teresaB"); + ret = this->anmShayB.setup(mdlC, anmChrE, &this->allocator, 0); -int daRamboo_c::onCreate() { - - OSReport("Creating the Ramboo Model"); - allocator.link(-1, GameHeaps[0], 0, 0x20); + nw4r::g3d::ResAnmChr anmChrF = this->resFile.GetResAnmChr("shay_teresaB_wait"); + ret = this->anmWaitB.setup(mdlC, anmChrF, &this->allocator, 0); - nw4r::g3d::ResFile rf(getResource("teresa", "g3d/teresa.brres")); - - fogModel.setup(rf.GetResMdl("fog"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&fogModel, 0); + allocator.unlink(); +} - bodyModel.setup(rf.GetResMdl("teresaA"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&bodyModel, 0); - allocator.unlink(); +int daRamboo_c::onCreate() { -// this->BigBossRamboo = this->settings >> 28; + OSReport("Creating the Ramboo Model"); + setupModels(); OSReport("Setting Ramboo's Size to 16.0"); @@ -192,6 +194,7 @@ int daRamboo_c::onCreate() { this->rot.y = 0xE000; // Y is horizontal axis this->rot.z = 0; // Z is ... an axis >.> this->direction = 0; // Heading left. + this->Hiding = 0; this->speed.x = 0.0; this->ytimer = 0; @@ -200,9 +203,12 @@ int daRamboo_c::onCreate() { OSReport("Event to activate: %d", eventNum); this->eventFlag = (u64)1 << (eventNum - 1); - - + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("fog"); + this->anmFog.bind(&this->fogModel, anmChr, 1); + this->fogModel.bindAnim(&this->anmFog, 0.0); + this->anmFog.setUpdateRate(1.0); + OSReport("Setting the State"); doStateChange(&StateID_Grow); @@ -219,6 +225,11 @@ int daRamboo_c::onExecute() { acState.execute(); updateModelMatrices(); + this->fogModel._vf1C(); + + if(this->anmFog.isAnimationDone()) + this->anmFog.setCurrentFrame(0.0); + if (this->aPhysics.result1 == 1) { char PlayerID = NearestPlayer(this); dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); @@ -227,7 +238,7 @@ int daRamboo_c::onExecute() { } if (EventTable->events & this->eventFlag) { - doStateChange(&StateID_DieBigFall); + doStateChange(&StateID_Outro); } return true; @@ -235,7 +246,11 @@ int daRamboo_c::onExecute() { int daRamboo_c::onDraw() { fogModel.scheduleForDrawing(); - bodyModel.scheduleForDrawing(); + + if (this->Hiding == 0) { + bodyModel.scheduleForDrawing(); } + else { + hideModel.scheduleForDrawing(); } return true; } @@ -248,12 +263,17 @@ 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); - bodyModel.setScale(&scale); - bodyModel.calcWorld(false); + if (this->Hiding == 0) { + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); } + else { + hideModel.setDrawMatrix(matrix); + hideModel.setScale(&scale); + hideModel.calcWorld(false); } } @@ -263,6 +283,7 @@ void daRamboo_c::beginState_Grow() { OSReport("Growing when Kameck Tells me to."); this->timer = 0; // PlaySound(this, SE_BOSS_ROY_MAGIC_MAKE_FAST); + } void daRamboo_c::executeState_Grow() { @@ -271,8 +292,8 @@ void daRamboo_c::executeState_Grow() { float scaleSpeed, yPosScaling; + if (this->timer == 60) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); } if ((this->timer > 60) && (this->timer < 140)) { - PlaySound(this, SE_BOSS_IGGY_WANWAN_L_TO_M); scaleSpeed = 0.175; // yPosScaling = 0; @@ -309,9 +330,13 @@ void daRamboo_c::beginState_Advance() { this->speed.y = 0; this->speed.z = 0; this->timer = 0; + + } void daRamboo_c::executeState_Advance() { + this->bodyModel._vf1C(); + this->pos.x -= this->timer / 32; this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 48; @@ -342,16 +367,36 @@ void daRamboo_c::beginState_Wait() { } void daRamboo_c::executeState_Wait() { + + if (this->timer == 55) { + nw4r::g3d::ResAnmChr anmChrB = this->resFile.GetResAnmChr("shay_teresaB"); + this->anmShayB.bind(&this->hideModel, anmChrB, 1); + this->hideModel.bindAnim(&this->anmShayB, 0.0); + this->anmShayB.setUpdateRate(1.0); + } + if (this->timer > 60) { PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); doStateChange(&StateID_Advance); } + + + this->hideModel._vf1C(); this->timer += 1; } -void daRamboo_c::endState_Wait() { OSReport("No more bouncing."); } +void daRamboo_c::endState_Wait() { + + this->Hiding = 0; + + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaA"); + this->anmShayA.bind(&this->bodyModel, anmChr, 1); + this->bodyModel.bindAnim(&this->anmShayA, 0.0); + this->anmShayA.setUpdateRate(1.0); + + OSReport("No more bouncing."); } @@ -361,18 +406,133 @@ 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); + + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait"); + this->anmWaitA.bind(&this->bodyModel, anmChr, 1); + this->bodyModel.bindAnim(&this->anmWaitA, 0.0); + this->anmWaitA.setUpdateRate(1.0); + OSReport("Damnit that hurt."); this->timer = 0; + } void daRamboo_c::executeState_Flee() { - + + if (timer == 10) { + this->Hiding = 1; + + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait"); + this->anmWaitB.bind(&this->hideModel, anmChr, 1); + this->hideModel.bindAnim(&this->anmWaitB, 0.0); + this->anmWaitB.setUpdateRate(1.0); + } + this->pos.x += (60 - this->timer) / 8; - if (this->timer > 60) { doStateChange(&StateID_Wait); } + if (timer < 10) { + this->bodyModel._vf1C(); } + else { + this->hideModel._vf1C(); } + + + if (this->timer > 60) { + doStateChange(&StateID_Wait); + } this->timer += 1; } -void daRamboo_c::endState_Flee() { OSReport("Ugh, so dizzy."); } +void daRamboo_c::endState_Flee() { + + OSReport("Ugh, so dizzy."); +} + + + + +void daRamboo_c::beginState_Outro() { + + this->removeMyActivePhysics(); + 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() { } + |