diff options
Diffstat (limited to '')
-rw-r--r-- | src/bossBalboaWrench.cpp | 959 |
1 files changed, 515 insertions, 444 deletions
diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index a503876..1b1cf6b 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -14,52 +14,52 @@ class daBalboa_c : public dEn_c { mHeapAllocator_c allocator; m3d::mdl_c bodyModel; - m3d::mdl_c manholeModel; - m3d::mdl_c holeModel; nw4r::g3d::ResFile resFile; - m3d::anmChr_c anmDead; - m3d::anmChr_c anmDead_2; - m3d::anmChr_c anmGo_out_ed; - m3d::anmChr_c anmGo_out_st; - m3d::anmChr_c anmThrow_1; - m3d::anmChr_c anmThrow_2; - m3d::anmChr_c anmThrow_3; - m3d::anmChr_c anmThrow_4Left; - m3d::anmChr_c anmThrow_4Right; - m3d::anmChr_c anmThrow_5; + m3d::anmChr_c animationChr; int timer; int damage; float Baseline; float dying; - Vec PopUp [4]; + Vec PopUp [3]; char throwCount; + char throwMax; + float throwRate; char upsideDown; + int isBigBoss; + char isRevenging; + int spinner; + + dEn_c *Kameck; static daBalboa_c *build(); void setupModels(); void updateModelMatrices(); + void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); - // void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); - // void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + void addScoreWhenHit(void *other); + USING_STATES(daBalboa_c); DECLARE_STATE(Grow); DECLARE_STATE(ManholeUp); DECLARE_STATE(HeadPoke); DECLARE_STATE(AllOut); - DECLARE_STATE(ThrowHoming); DECLARE_STATE(ThrowWrench); DECLARE_STATE(BackDown); DECLARE_STATE(Outro); + DECLARE_STATE(Damage); + DECLARE_STATE(RevengeUp); + DECLARE_STATE(Revenge); }; daBalboa_c *daBalboa_c::build() { @@ -67,85 +67,113 @@ daBalboa_c *daBalboa_c::build() { return new(buffer) daBalboa_c; } +// Externs + extern "C" u32 GenerateRandomNumber(int max); + extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); + extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daBalboa_c *, Vec pos); + extern "C" dStageActor_c *GetSpecificPlayerActor(int number); + extern "C" void *PlaySound(daBalboa_c *, int soundID); + extern "C" void *PlaySoundAsync(daBalboa_c *, int soundID); + extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); + + extern "C" void *StopBGMMusic(); + extern "C" void *StartBGMMusic(); + + extern "C" void *MakeMarioEnterDemoMode(); + extern "C" void *MakeMarioExitDemoMode(); + extern "C" void *UpdateGameMgr(); + + + CREATE_STATE(daBalboa_c, Grow); + CREATE_STATE(daBalboa_c, ManholeUp); + CREATE_STATE(daBalboa_c, HeadPoke); + CREATE_STATE(daBalboa_c, AllOut); + CREATE_STATE(daBalboa_c, ThrowWrench); + CREATE_STATE(daBalboa_c, BackDown); + CREATE_STATE(daBalboa_c, Outro); + CREATE_STATE(daBalboa_c, Damage); + CREATE_STATE(daBalboa_c, RevengeUp); + CREATE_STATE(daBalboa_c, Revenge); + +// Collisions + void balbieCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther); + + void balbieCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther) { + if (apOther->owner->name != 544) { + dEn_c::collisionCallback(apThis, apOther); + } + } -extern "C" u32 GenerateRandomNumber(int max); -extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); -extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daBalboa_c *, Vec pos); -extern "C" dStageActor_c *GetSpecificPlayerActor(int number); -extern "C" void *PlaySound(daBalboa_c *, int soundID); -extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); - - -CREATE_STATE(daBalboa_c, Grow); -CREATE_STATE(daBalboa_c, ManholeUp); -CREATE_STATE(daBalboa_c, HeadPoke); -CREATE_STATE(daBalboa_c, AllOut); -CREATE_STATE(daBalboa_c, ThrowHoming); -CREATE_STATE(daBalboa_c, ThrowWrench); -CREATE_STATE(daBalboa_c, BackDown); -CREATE_STATE(daBalboa_c, Outro); - + void daBalboa_c::addScoreWhenHit(void *other) {} + void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { -void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); - char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + if(ret == 1) { // regular jump - if(ret == 1) { // regular jump + apOther->someFlagByte |= 0; - apOther->someFlagByte |= 2; - OSReport("ret == 1; regular jump;\n"); + } else if(ret == 3) { // spinning - } else if(ret == 3) { // spinning + apOther->someFlagByte |= 0; - apOther->someFlagByte |= 2; - OSReport("ret == 3; spinning collision;\n"); + } else if(ret == 0) { - } else if(ret == 0) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); - OSReport("calling dEn_c::playerCollsiion(apThis, apOther);\n"); - this->dEn_c::playerCollision(apThis, apOther); - this->_vf220(apOther->owner); + } else if(ret == 2) { // mini Mario + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); - } else if(ret == 2) { - OSReport("Y U USIN' MINIMARIO?\n"); - this->dEn_c::playerCollision(apThis, apOther); - this->_vf220(apOther->owner); + } else { + } - } else { - OSReport("usedForDeter...() returned %d\n", ret); + //FIXME hack to make multiple playerCollisions work + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->which_player < 4) { + this->counter_504[apOther->owner->which_player] = 0; + } } - //FIXME hack to make multiple playerCollisions work - this->isDead = 0; - this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->which_player > 3) { - OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n"); - }else{ - this->counter_504[apOther->owner->which_player] = 0; - } -} + void daBalboa_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { -void daBalboa_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { - this->damage -= 1; - - apOther->someFlagByte |= 2; - - // Create a huge hit effect and play a nice sound - // goto a get hurt state where he does his dance and then retreats underground + dActor_c *block = apOther->owner; + dEn_c *mario = (dEn_c*)block; - // Prevent him from getting hurt during his dancing + CreateEffect(mario, 33); - if (this->damage == 0) { doStateChange(&StateID_Outro); } + mario->speed.y = -mario->speed.y; + mario->pos.y += mario->speed.y; -} + if (mario->direction == 0) { mario->speed.x = 4.0; } + else { mario->speed.x = -4.0; } + + mario->doSpriteMovement(); + mario->doSpriteMovement(); -void daBalboa_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } -bool daBalboa_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); return false; } -void daBalboa_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { } -void daBalboa_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); } + if (isRevenging) { + return; + } + else { + this->damage -= 1; + + apOther->someFlagByte |= 2; + + PlaySoundAsync(this, SE_EMY_PENGUIN_DAMAGE); + doStateChange(&StateID_Damage); + } + + } + void daBalboa_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } + bool daBalboa_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } + void daBalboa_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { } + void daBalboa_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { } + void daBalboa_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { } void daBalboa_c::setupModels() { @@ -156,56 +184,23 @@ void daBalboa_c::setupModels() { this->resFile.data = getResource("choropoo", "g3d/choropoo.brres"); - mdl = this->resFile.GetResMdl("manhole"); - this->manholeModel.setup(mdl, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&this->manholeModel, 0); - - mdl = this->resFile.GetResMdl("choropoo_hole"); - this->holeModel.setup(mdl, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&this->holeModel, 0); - mdl = this->resFile.GetResMdl("choropoo"); this->bodyModel.setup(mdl, &allocator, 0x224, 1, 0); SetupTextures_Enemy(&this->bodyModel, 0); + anmChr = this->resFile.GetResAnmChr("throw_1"); // 11 + this->animationChr.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("dead"); - this->anmDead.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("dead_2"); - this->anmDead_2.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("go_out_ed"); - this->anmGo_out_ed.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("go_out_st"); - this->anmGo_out_st.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_1"); - this->anmThrow_1.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_2"); - this->anmThrow_2.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_3"); - this->anmThrow_3.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_4_left_hand"); - this->anmThrow_4Left.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_4_right_hand"); - this->anmThrow_4Right.setup(mdl, anmChr, &this->allocator, 0); - - anmChr = this->resFile.GetResAnmChr("throw_5"); - this->anmThrow_5.setup(mdl, anmChr, &this->allocator, 0); - + // throw_1 // 11 + // throw_2 // 75 + // throw_3 // 33 + // throw_4_left_hand // 87 + // throw_4_right_hand // 87 + // throw_5 // 23 allocator.unlink(); } - - // Animation Order... // AppearLittle - Throw One, sound 0x21F // Search - Throw two @@ -214,38 +209,38 @@ void daBalboa_c::setupModels() { // Disappear - Throw 5 +void daBalboa_c::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); + this->animationChr.bind(&this->bodyModel, anmChr, unk); + this->bodyModel.bindAnim(&this->animationChr, unk2); + this->animationChr.setUpdateRate(rate); +} int daBalboa_c::onCreate() { - OSReport("Creating the Balboa Model"); setupModels(); - - OSReport("Setting Balboa's Size to 4.0"); this->scale = (Vec){1.0, 1.0, 1.0}; - - OSReport("Creating Balboa's Physics Struct"); + this->isBigBoss = (this->settings >> 28); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; - HitMeBaby.yDistToCenter = 36.0; + HitMeBaby.yDistToCenter = 27.0; - HitMeBaby.xDistToEdge = 24.0; - HitMeBaby.yDistToEdge = 32.0; + HitMeBaby.xDistToEdge = 18.0; + HitMeBaby.yDistToEdge = 24.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; HitMeBaby.bitfield2 = 0xFFBAFFFE; HitMeBaby.unkShort1C = 0; - HitMeBaby.callback = &dEn_c::collisionCallback; + HitMeBaby.callback = &balbieCollisionCallback; - OSReport("Making the Physics Class and adding to the list"); this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - OSReport("Setting up the Box of Goodies"); this->rot.x = 0; // X is vertical axis this->rot.y = 0xE000; // Y is horizontal axis @@ -255,18 +250,16 @@ int daBalboa_c::onCreate() { this->pos.z = -800.0; this->pos.y -= 8.0; this->damage = 3; + this->isRevenging = 0; - this->PopUp[0] = (Vec){this->pos.x, this->pos.y - 72.0, this->pos.z}; - this->PopUp[1] = (Vec){this->pos.x - 224.0, this->pos.y - 72.0, this->pos.z}; - this->PopUp[2] = (Vec){this->pos.x, this->pos.y + 248.0, this->pos.z}; - this->PopUp[3] = (Vec){this->pos.x - 224.0, this->pos.y + 248.0, this->pos.z}; - this->PopUp[4] = (Vec){this->pos.x - 112.0, this->pos.y - 40.0, this->pos.z}; + this->PopUp[0] = (Vec){this->pos.x, this->pos.y - 54.0, this->pos.z}; + this->PopUp[1] = (Vec){this->pos.x - 224.0, this->pos.y - 54.0, this->pos.z}; + this->PopUp[2] = (Vec){this->pos.x - 112.0, this->pos.y - 22.0, this->pos.z}; + this->PopUp[3] = (Vec){this->pos.x - 112.0, this->pos.y - 22.0, this->pos.z}; - OSReport("Setting the State"); doStateChange(&StateID_Grow); - OSReport("Going to Execute Balboa"); this->onExecute(); return true; } @@ -278,6 +271,8 @@ int daBalboa_c::onDelete() { int daBalboa_c::onExecute() { acState.execute(); updateModelMatrices(); + + bodyModel._vf1C(); return true; } @@ -289,7 +284,6 @@ int daBalboa_c::onDraw() { return true; } - void daBalboa_c::updateModelMatrices() { // This won't work with wrap because I'm lazy. matrix.translation(pos.x, pos.y, pos.z); @@ -301,429 +295,506 @@ void daBalboa_c::updateModelMatrices() { } - // Grow State -void daBalboa_c::beginState_Grow() { - OSReport("Growing when Kameck Tells me to."); - this->timer = 0; + void daBalboa_c::beginState_Grow() { + this->timer = 0; -} + // Stop the BGM Music + StopBGMMusic(); -void daBalboa_c::executeState_Grow() { - - this->timer = this->timer + 1; - - float scaleSpeed, yPosScaling; - - if (this->timer == 60) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); } - if ((this->timer > 60) && (this->timer < 140)) { - scaleSpeed = 0.025; -// yPosScaling = 0; - - float modifier; + // Set the necessary Flags and make Mario enter Demo Mode + dStage32C_c::instance->freezeMarioBossFlag = 1; + WLClass::instance->_4 = 4; + WLClass::instance->_8 = 0; - modifier = 1.0 + ((this->timer - 60) * scaleSpeed); - - this->scale = (Vec){modifier, modifier, modifier}; -// this->pos.y = this->pos.y + (yPosScaling/80); - - } - - if (this->timer > 170) { - PlaySound(this, SE_EMY_CHOROPU_BOUND); - this->upsideDown = 0; - doStateChange(&StateID_BackDown); - } - -} -void daBalboa_c::endState_Grow() { + MakeMarioEnterDemoMode(); - OSReport("OK. All grown up now."); -} + // Make sure to use the correct position + Vec pos = (Vec){this->pos.x - 124.0, this->pos.y + 104.0, 3564.0}; + S16Vec rot = (S16Vec){0, 0, 0}; + // Create And use Kameck + Kameck = (daKameckDemo*)createChild(KAMECK_FOR_CASTLE_DEMO, (dStageActor_c*)this, 0, &pos, &rot, 0); + Kameck->doStateChange(&daKameckDemo::StateID_DemoWait); + bindAnimChr_and_setUpdateRate("throw_2", 1, 0.0, 0.6); + } + void daBalboa_c::executeState_Grow() { + if(this->animationChr.isAnimationDone()) + this->animationChr.setCurrentFrame(0.0); -// ManholeUp State + if (this->timer == 130) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt); } + if (this->timer == 400) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt2); } + + this->timer = this->timer + 1; + + float scaleSpeed, yPosScaling; -void daBalboa_c::beginState_ManholeUp() { + if (this->timer == 150) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); } + + if ((this->timer > 150) && (this->timer < 230)) { + + scaleSpeed = 0.015625; + + float modifier; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_1"); - this->anmThrow_1.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_1, 0.0); - this->anmThrow_1.setUpdateRate(1.0); + modifier = 1.0 + ((this->timer - 150) * scaleSpeed); + + this->scale = (Vec){modifier, modifier, modifier}; + + } - this->timer = 0; + if (this->timer == 360) { + Vec tempPos = (Vec){this->pos.x - 40.0, this->pos.y + 120.0, 3564.0}; + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 175); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 400); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 401); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 564); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 583); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 754); // 400 & 401 // 564 // 583 // 754 // 958 + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 958); // 400 & 401 // 564 // 583 // 754 // 958 + } - int randChoice; - randChoice = GenerateRandomNumber(5); - - this->pos = this->PopUp[randChoice]; - - if (randChoice == 0) { // On the left side! - this->rot.y = 0xE000; - this->rot.z = 0; - this->upsideDown = 0; - this->direction = 0; } - - else if (randChoice == 1) { // On the right side! - this->rot.y = 0x2000; - this->rot.z = 0; - this->upsideDown = 0; - this->direction = 1; } - - else if (randChoice == 2) { // On the right ceiling! - this->rot.y = 0xE000; - this->rot.z = 0x8000; - this->upsideDown = 1; - this->direction = 0; } - - else if (randChoice == 3) { // On the left ceiling! - this->rot.y = 0x2000; - this->rot.z = 0x8000; - this->upsideDown = 1; - this->direction = 1; } - - else if (randChoice == 4) { // In the Center! - char PlayerID = NearestPlayer(this); - dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); - - this->upsideDown = 0; - this->rot.z = 0; - if (Player->pos.x < this->pos.x) { - this->rot.y = 0xE000; - this->direction = 0; } - else { - this->rot.y = 0x2000; - this->direction = 1; } + if (this->timer > 420) { + PlaySound(this, SE_EMY_CHOROPU_BOUND); + this->upsideDown = 0; + doStateChange(&StateID_BackDown); + } } + void daBalboa_c::endState_Grow() { - PlaySound(this, 0x21F); -} + // Clean up the flags and Kameck + dStage32C_c::instance->freezeMarioBossFlag = 0; + WLClass::instance->_8 = 1; -void daBalboa_c::executeState_ManholeUp() { + MakeMarioExitDemoMode(); + StartBGMMusic(); - this->bodyModel._vf1C(); - - if (this->timer < 30) { - if (this->upsideDown == 0) { - this->pos.y += 0.6; } // Height is 72 pixels, move up 18 pixels. - else { - this->pos.y -= 0.6; } // Height is 72 pixels, move down 18 pixels. + Kameck->Delete(1); } - - if (this->timer > 60) { - doStateChange(&StateID_HeadPoke); } - - this->timer += 1; -} -void daBalboa_c::endState_ManholeUp() { } +// ManholeUp State + void daBalboa_c::beginState_ManholeUp() { + bindAnimChr_and_setUpdateRate("throw_1", 1, 0.0, 1.0); -// HeadPoke State + this->timer = 0; + + int randChoice; + randChoice = GenerateRandomNumber(3); + + this->pos = this->PopUp[randChoice]; -void daBalboa_c::beginState_HeadPoke() { + OSReport("Rand Choice is: %d\n", randChoice); + OSReport("Position is: %f, %f, %f\n\n", pos.x, pos.y, pos.z); - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_2"); - this->anmThrow_2.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_2, 0.0); - this->anmThrow_2.setUpdateRate(1.0); + + if (randChoice == 0) { // On the left side! + this->rot.y = 0xE000; + this->rot.z = 0; + this->upsideDown = 0; + this->direction = 0; } - this->timer = 0; -} + else if (randChoice == 1) { // On the right side! + this->rot.y = 0x2000; + this->rot.z = 0; + this->upsideDown = 0; + this->direction = 1; } -void daBalboa_c::executeState_HeadPoke() { + // else if (randChoice == 2) { // On the right ceiling! + // this->rot.y = 0xE000; + // this->rot.z = 0x8000; + // this->upsideDown = 1; + // this->direction = 0; } + + // else if (randChoice == 3) { // On the left ceiling! + // this->rot.y = 0x2000; + // this->rot.z = 0x8000; + // this->upsideDown = 1; + // this->direction = 1; } + + else if (randChoice == 2) { // In the Center! + char PlayerID = NearestPlayer(this); + dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); + + this->upsideDown = 0; + this->rot.z = 0; + if (Player->pos.x < this->pos.x) { + this->rot.y = 0xE000; + this->direction = 0; } + else { + this->rot.y = 0x2000; + this->direction = 1; } + } - if (this->timer < 30) { - if (this->upsideDown == 0) { - this->pos.y += 0.6; } // Height is 72 pixels, move up 20 pixels. - else { - this->pos.y -= 0.6; } // Height is 72 pixels, move down 20 pixels. + PlaySound(this, 0x21F); } - - if (this->timer > 90) { - doStateChange(&StateID_AllOut); } - - this->timer += 1; - this->bodyModel._vf1C(); -} -void daBalboa_c::endState_HeadPoke() { } + void daBalboa_c::executeState_ManholeUp() { + if (this->timer > 51) { + doStateChange(&StateID_HeadPoke); + } + if (this->timer > 11) { } + else { + this->pos.y += 0.8182; // Height is 54 pixels, move up 9 pixels. + } + + this->timer += 1; + } + void daBalboa_c::endState_ManholeUp() { } +// HeadPoke State + void daBalboa_c::beginState_HeadPoke() { -// AllOut State + bindAnimChr_and_setUpdateRate("throw_2", 1, 0.0, 1.0); -void daBalboa_c::beginState_AllOut() { + this->timer = 0; + } - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_3"); - this->anmThrow_3.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_3, 0.0); - this->anmThrow_3.setUpdateRate(1.0); + void daBalboa_c::executeState_HeadPoke() { - this->timer = 0; + this->pos.y += 0.24; // Height is 54 pixels, move up 18 pixels. + + if(this->animationChr.isAnimationDone()) { + doStateChange(&StateID_AllOut); } - PlaySound(this, 0x220); -} + } + void daBalboa_c::endState_HeadPoke() { } -void daBalboa_c::executeState_AllOut() { - this->bodyModel._vf1C(); +// AllOut State - if (this->timer < 30) { - if (this->upsideDown == 0) { - this->pos.y += 1.2; } // Height is 72 pixels, move up last 36 pixels. - else { - this->pos.y -= 1.2; } // Height is 72 pixels, move down last 36 pixels. - } - - if (this->timer > 45) { - int randChoice; - randChoice = GenerateRandomNumber(2); - - if (randChoice == 0) { - doStateChange(&StateID_ThrowHoming); } - else { - doStateChange(&StateID_ThrowWrench); } + void daBalboa_c::beginState_AllOut() { + + bindAnimChr_and_setUpdateRate("throw_3", 1, 0.0, 1.0); + + this->timer = 0; + + PlaySound(this, 0x220); } - - this->timer += 1; -} -void daBalboa_c::endState_AllOut() { } + void daBalboa_c::executeState_AllOut() { + this->pos.y += 0.8182; // Height is 54 pixels, move up 27 pixels. + + if(this->animationChr.isAnimationDone()) { + doStateChange(&StateID_ThrowWrench); + } + } + void daBalboa_c::endState_AllOut() { } -// ThrowHoming State +// ThrowWrench State -void daBalboa_c::beginState_ThrowHoming() { + void daBalboa_c::beginState_ThrowWrench() { - if (this->direction == 0) { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_left_hand"); - this->anmThrow_4Left.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_4Left, 0.0); - this->anmThrow_4Left.setUpdateRate(1.0); - } - else { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_right_hand"); - this->anmThrow_4Right.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_4Right, 0.0); - this->anmThrow_4Right.setUpdateRate(1.0); + this->throwCount = 0; + if (this->isBigBoss == 1) { + throwMax = 6; + throwRate = 3.0; + } + else { + throwMax = 4; + throwRate = 2.0; + } + bindAnimChr_and_setUpdateRate("throw_4_right_hand", 1, 0.0, throwRate); } + void daBalboa_c::executeState_ThrowWrench() { - u32 settings; - char dir; - - if (this->direction) { dir = 0; } - else { dir = 1; } - - settings = (dir) | (this->upsideDown << 1); - settings = settings | 0x10; + float frame = this->animationChr.getCurrentFrame(); + if (frame == 54.0) { + u32 settings; + u8 up = this->upsideDown; + u8 throwc = this->throwCount; + u8 dir; + + if (this->direction) { dir = 0; } + else { dir = 1; } - CreateActor(544, settings, this->pos, 0, 0); + settings = (dir) | (up << 1); + settings = settings | (throwc & 1 << 8); + if (this->isBigBoss == 1) { settings = settings | 0x10; } - this->timer = 0; -} + CreateActor(544, settings, this->pos, 0, 0); + } -void daBalboa_c::executeState_ThrowHoming() { - this->bodyModel._vf1C(); + if(this->animationChr.isAnimationDone()) { + this->throwCount += 1; - if (this->timer > 60) { - doStateChange(&StateID_BackDown); } + if (this->throwCount & 1) { + bindAnimChr_and_setUpdateRate("throw_4_left_hand", 1, 0.0, throwRate); + } + else { + bindAnimChr_and_setUpdateRate("throw_4_right_hand", 1, 0.0, throwRate); + } + } - this->timer += 1; - this->bodyModel._vf1C(); -} -void daBalboa_c::endState_ThrowHoming() { } + if (this->throwCount > throwMax) { + doStateChange(&StateID_BackDown); } + } + void daBalboa_c::endState_ThrowWrench() { } +// BackDown State + void daBalboa_c::beginState_BackDown() { -// ThrowWrench State + bindAnimChr_and_setUpdateRate("throw_5", 1, 0.0, 1.0); -void daBalboa_c::beginState_ThrowWrench() { + this->timer = 0; - this->throwCount = 0; - this->timer = 0; -} + PlaySound(this, 0x221); -void daBalboa_c::executeState_ThrowWrench() { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 351); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 352); + } + void daBalboa_c::executeState_BackDown() { + if (this->timer < 60) { + this->pos.y -= 2.0; // Height is 54 pixels, move down + } + + if (this->timer > 90) { + doStateChange(&StateID_ManholeUp); } + + this->timer += 1; - if (this->timer > 60) { + } + void daBalboa_c::endState_BackDown() { } - if (this->throwCount & 1) { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_left_hand"); - this->anmThrow_4Left.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_4Left, 0.0); - this->anmThrow_4Left.setUpdateRate(1.0); - } - else { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_right_hand"); - this->anmThrow_4Right.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_4Right, 0.0); - this->anmThrow_4Right.setUpdateRate(1.0); - } +// Outro - u32 settings; - u8 up = this->upsideDown; - u8 throwc = this->throwCount; - u8 dir; - - if (this->direction) { dir = 0; } - else { dir = 1; } + void daBalboa_c::beginState_Outro() { - settings = (dir) | (up << 1); - settings = settings | (throwc & 1 << 8); + bindAnimChr_and_setUpdateRate("dead", 1, 0.0, 1.0); - CreateActor(544, settings, this->pos, 0, 0); + WLClass::instance->_4 = 5; + WLClass::instance->_8 = 0; + dStage32C_c::instance->freezeMarioBossFlag = 1; - this->throwCount += 1; + this->removeMyActivePhysics(); this->timer = 0; - } - - if (this->throwCount > 4) { - doStateChange(&StateID_BackDown); } + this->rot.x = 0x0; // X is vertical axis + this->rot.z = 0x0; // Z is ... an axis >.> - this->timer += 1; - this->bodyModel._vf1C(); - -} -void daBalboa_c::endState_ThrowWrench() { } + } + void daBalboa_c::executeState_Outro() { + if(this->animationChr.isAnimationDone()) + this->animationChr.setCurrentFrame(0.0); + 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; + } -// BackDown State + if (this->scale.x > 0.1) { -void daBalboa_c::beginState_BackDown() { + PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); + PlaySound(this, SE_EMY_BIG_TERESA_DEAD); - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_5"); - this->anmThrow_5.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmThrow_5, 0.0); - this->anmThrow_5.setUpdateRate(1.0); + // Adjust this to equal the scale of your boss / 80. + this->scale.x -= 0.028125; + this->scale.y -= 0.028125; + this->scale.z -= 0.028125; - this->timer = 0; + this->pos.y -= 0.02; + + if (this->timer == 30) { + Vec tempPos = (Vec){this->pos.x + 0.0, this->pos.y - 0.0, 5500.0}; + + 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 + 0.0, this->pos.y - 0.0, 5500.0}; - PlaySound(this, 0x221); + CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588); + this->dying = 1; + this->timer = 0; - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 351); - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 352); -} + PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); + MakeMarioEnterDemoMode(); + } -void daBalboa_c::executeState_BackDown() { + this->timer += 1; - if (this->timer < 60) { - if (this->upsideDown == 0) { - this->pos.y -= 1.2; } // Height is 72 pixels, move down - else { - this->pos.y += 1.2; } // Height is 72 pixels, move up } - - if (this->timer > 90) { - doStateChange(&StateID_ManholeUp); } - - this->timer += 1; - this->bodyModel._vf1C(); - -} -void daBalboa_c::endState_BackDown() { } + void daBalboa_c::endState_Outro() { } +// Damage + void daBalboa_c::beginState_Damage() { + + bindAnimChr_and_setUpdateRate("dead", 1, 0.0, 0.5); -void daBalboa_c::beginState_Outro() { + this->timer = 0; + this->removeMyActivePhysics(); + } + void daBalboa_c::executeState_Damage() { - 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 >.> + if (this->timer > 6) { doStateChange(&StateID_RevengeUp); } -} -void daBalboa_c::executeState_Outro() { + if(this->animationChr.isAnimationDone()) { + this->animationChr.setCurrentFrame(0.0); - if (this->dying == 1) { - if (this->timer > 180) { - ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); + this->timer += 1; } - - 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 (this->timer > 3) { + this->pos.y -= 5.0; // Height is 54 pixels, move down + } + else if (this->timer > 2) { + if (this->damage == 0) { + StopBGMMusic(); + doStateChange(&StateID_Outro); } + this->pos.y -= 3.5; // Height is 54 pixels, move down + } + else if (this->timer > 1) { + this->pos.y -= 1.0; // Height is 54 pixels, move down + } + else if (this->timer > 0) { + this->pos.y += 1.0; // Height is 54 pixels, move down + } + else { + this->pos.y += 3.5; // Height is 54 pixels, move down + } - if (GetSpecificPlayerActor(3) != 0) { - PlaySound(this, SE_VOC_KO2_CLEAR_BOSS); - // Send PlBase into DemoGoal State here, kthxbai - } - } - - this->timer += 1; - return; - } + } + void daBalboa_c::endState_Damage() { + this->addMyActivePhysics(); + } - if (this->scale.x > 0.1) { - PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); - PlaySound(this, SE_EMY_BIG_TERESA_DEAD); +// Revenge Up - // 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; + void daBalboa_c::beginState_RevengeUp() { - this->pos.y += 2.0; + this->pos = this->PopUp[2]; + this->rot.y = 0; - Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; + isRevenging = 1; + bindAnimChr_and_setUpdateRate("throw_3", 1, 0.0, 1.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; + PlaySound(this, 0x220); + } + void daBalboa_c::executeState_RevengeUp() { + + this->pos.y += 1.6363; // Height is 54 pixels, move up 27 pixels. + + if(this->animationChr.isAnimationDone()) { + doStateChange(&StateID_Revenge); } + } - 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}; + void daBalboa_c::endState_RevengeUp() { } - 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); +// Revenge + + void daBalboa_c::beginState_Revenge() { + spinner = 0; + + this->throwCount = 0; + if (this->isBigBoss == 1) { + throwMax = 16; + throwRate = 5.0; + } + else { + throwMax = 12; + throwRate = 3.0; + } + bindAnimChr_and_setUpdateRate("throw_4_right_hand", 1, 0.0, throwRate); } + void daBalboa_c::executeState_Revenge() { - this->timer += 1; + float frame = this->animationChr.getCurrentFrame(); -} -void daBalboa_c::endState_Outro() { } + rot.y = 16384.0 * (frame / 87.0) + (16384.0 * spinner); + + if (frame == 60.0) { + u32 settings; + u8 up = this->upsideDown; + u8 throwc = this->throwCount; + u8 dir; + + if (spinner < 2) { dir = 0; } + else { dir = 1; } + + settings = (dir) | (up << 1); + settings = settings | (throwc & 1 << 8); + + if (this->isBigBoss == 1) { settings = settings | 0x10; } + + CreateActor(544, settings, this->pos, 0, 0); + } + if(this->animationChr.isAnimationDone()) { + this->throwCount += 1; + spinner += 1; + if (spinner == 4) { spinner = 0; } + if (this->throwCount & 1) { + bindAnimChr_and_setUpdateRate("throw_4_left_hand", 1, 0.0, throwRate); + } + else { + bindAnimChr_and_setUpdateRate("throw_4_right_hand", 1, 0.0, throwRate); + } + } + + if (this->throwCount > throwMax) { + doStateChange(&StateID_BackDown); } + + } + void daBalboa_c::endState_Revenge() { + isRevenging = 0; + } |