diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-02 17:12:34 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-02 17:12:34 -0600 |
commit | 5dece655469940b4752cb0dc81328c8171e2b5e7 (patch) | |
tree | c609321eac5499816afdd63e00a8e510d7c55bbc | |
parent | 10c0df080e801ec4abb2c2272a90d04d00fee4e7 (diff) | |
download | kamek-5dece655469940b4752cb0dc81328c8171e2b5e7.tar.gz kamek-5dece655469940b4752cb0dc81328c8171e2b5e7.zip |
Lots of poss updates, meteors, shy guys, penguins, etc.
Diffstat (limited to '')
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rwxr-xr-x | include/game.h | 2 | ||||
-rw-r--r-- | kamek_pal.x | 6 | ||||
-rw-r--r-- | pengi.yaml | 10 | ||||
-rw-r--r-- | src/bossBalboaWrench.cpp | 959 | ||||
-rw-r--r-- | src/bossFuzzyBear.cpp | 116 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 121 | ||||
-rw-r--r-- | src/bossWrenchThrow.cpp | 290 | ||||
-rwxr-xr-x | src/meteor.cpp | 11 | ||||
-rw-r--r-- | src/penguin.cpp | 429 | ||||
-rw-r--r-- | src/player.cpp | 22 | ||||
-rw-r--r-- | src/shyguy.cpp | 13 | ||||
-rw-r--r-- | src/soundPlayer.S | 39 |
13 files changed, 1315 insertions, 704 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index 062bb17..3a9ee3f 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -42,4 +42,5 @@ modules: - processed/fakeStarCoin.yaml - processed/shyguy.yaml - processed/meteor.yaml + - processed/pengi.yaml # - processed/actorlog.yaml diff --git a/include/game.h b/include/game.h index d4d345d..f458dfd 100755 --- a/include/game.h +++ b/include/game.h @@ -2020,7 +2020,7 @@ public: virtual int _vf244(); // returns 0. might be bool. params unknown
virtual int _vf248(int something); // does some math involving field510 and [7,7,4,0] and param
virtual void _vf24C(void *other); // deals with something in the class involving the bahp flag
- virtual void _vf250(void *other);
+ virtual void addScoreWhenHit(void *other); // Other is dPlayer
virtual void _vf254(void *other);
virtual void _vf258(void *other);
virtual void _vf25C(void *other); // calls vf250
diff --git a/kamek_pal.x b/kamek_pal.x index 8d5499d..67ed990 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -30,6 +30,9 @@ SECTIONS { SinCosFIdx__Q24nw4r4mathFPfPff = 0x80237DE0; init__18StandOnTopColliderFP13dStageActor_cfffffsUcP7Point2d = 0x800DB270; + __ct__18StandOnTopColliderFv = 0x800DB220; + __dt__18StandOnTopColliderFv = 0x80044400; + __dt__13BasicColliderFv = 0x800DAEF0; @@ -77,6 +80,7 @@ SECTIONS { StateID_DemoGoal__7dPlayer = 0x80354DDC; StateID_DemoControl__7dPlayer = 0x80354E1C; + PlayWrenchSound = 0x808A94C0; /* Mr Sun Related */ @@ -414,7 +418,7 @@ SECTIONS { _vf244__5dEn_cFv = 0x80020690; _vf248__5dEn_cFi = 0x800968E0; _vf24C__5dEn_cFPv = 0x80096710; - _vf250__5dEn_cFPv = 0x80096700; + addScoreWhenHit__5dEn_cFPv = 0x80096700; _vf254__5dEn_cFPv = 0x80096720; _vf258__5dEn_cFPv = 0x80096760; _vf25C__5dEn_cFPv = 0x80096770; diff --git a/pengi.yaml b/pengi.yaml new file mode 100644 index 0000000..b29e11a --- /dev/null +++ b/pengi.yaml @@ -0,0 +1,10 @@ +--- +# Replaces TARZAN_ROPE + +source_files: [../src/penguin.cpp] +hooks: + - name: PengiBuild + type: add_func_pointer + src_addr_pal: 0x8097CFC8 + target_func: 'daPengi::build(void)' + 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; + } diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index b13955c..97fc893 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -44,13 +44,16 @@ class daFuzzyBear_c : public dEn_c { void updateModelMatrices(); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); -// void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void yoshiCollision(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 collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); USING_STATES(daFuzzyBear_c); DECLARE_STATE(Grow); @@ -96,14 +99,22 @@ CREATE_STATE(daFuzzyBear_c, Outro); void daFuzzyBear_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); - OSReport("I hit Mario."); + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->which_player < 4) { + this->counter_504[apOther->owner->which_player] = 0; + } +} +void daFuzzyBear_c::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->playerCollision(apThis, apOther); } void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { if (this->isInvulnerable == 1) { return; } - OSReport("Hit Fireball"); this->timer = 0; PlaySound(this, SE_BOSS_KOOPA_FIRE_DISAPP); @@ -111,14 +122,32 @@ void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, Ac this->damage++; if (this->damage > 14) { doStateChange(&StateID_Outro); } } -bool daFuzzyBear_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); return false; } -void daFuzzyBear_c::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Groundpound\n"); } +void daFuzzyBear_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + apOther->someFlagByte |= 2; + + dActor_c *block = apOther->owner; + dEn_c *mario = (dEn_c*)block; + + 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 daFuzzyBear_c::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { + this->collisionCat7_WMWaggleWater(apThis, apOther); +} void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { - OSReport("Hit Rolling Object"); dActor_c *block = apOther->owner; dEn_c *blah = (dEn_c*)block; + if (blah->direction == 0) { blah->direction = 1; this->roly = 1; } + else { blah->direction = 0; this->roly = 0; } + blah->speed.x = -blah->speed.x; blah->pos.x += blah->speed.x; @@ -134,10 +163,7 @@ void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhy else { blah->direction = 0; } return; - } - - if (blah->direction == 0) { blah->direction = 1; this->roly = 0; } - else { blah->direction = 0; this->roly = 1; } + } this->pos.x += blah->speed.x; @@ -155,8 +181,13 @@ void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics * if (this->isInvulnerable == 1) { return; } + dActor_c *block = apOther->owner; + dEn_c *blah = (dEn_c*)block; + + if (blah->direction == 0) { blah->direction = 1; this->roly = 1; } + else { blah->direction = 0; this->roly = 0; } + PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1); - OSReport("Hit Hammer"); this->timer = 0; this->damage += 5; @@ -165,7 +196,10 @@ void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics * if (this->damage > 14) { doStateChange(&StateID_Outro); } else { doStateChange(&StateID_RolyPoly); } } -void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi Fire"); } + +bool daFuzzyBear_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } +void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { } +void daFuzzyBear_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { } @@ -196,17 +230,12 @@ void daFuzzyBear_c::setupBodyModel() { int daFuzzyBear_c::onCreate() { - OSReport("Creating the Fuzzy Bear Model"); setupBodyModel(); this->BigBossFuzzyBear = this->settings >> 28; - - - OSReport("Setting Fuzzy Bear's Size to 1.0"); this->scale = (Vec){1.0, 1.0, 1.0}; - OSReport("Creating Fuzzy Bear's Physics Struct"); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; @@ -227,11 +256,9 @@ int daFuzzyBear_c::onCreate() { HitMeBaby.callback = &dEn_c::collisionCallback; - OSReport("Making the Physics Class and adding to the list"); this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - OSReport("Setting up Fuzzy Bear's Box of Goodies"); this->pos.y = this->pos.y + 6; this->rot.x = 0; // X is vertical axis @@ -253,6 +280,7 @@ int daFuzzyBear_c::onCreate() { this->damage = 0; this->isInvulnerable = 0; this->dying = 0; + this->disableEatIn(); bindAnimChr_and_setUpdateRate("run", 1, 0.0, 1.0); @@ -276,13 +304,6 @@ int daFuzzyBear_c::onExecute() { if(this->animationChr.isAnimationDone()) this->animationChr.setCurrentFrame(0.0); - - if (this->aPhysics.result1 == 1) { - char PlayerID = NearestPlayer(this); - dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); - - this->_vf220(Player); - } return true; } @@ -309,35 +330,27 @@ void daFuzzyBear_c::updateModelMatrices() { // Grow State void daFuzzyBear_c::beginState_Grow() { - OSReport("Growing when Kameck Tells me to.\n"); this->timer = 0; - OSReport("Stopping the Music.\n"); + // Stop the BGM Music StopBGMMusic(); - OSReport("Setting the boss flag. %p\n", dStage32C_c::instance); - OSReport("Boss flag is; %d\n", dStage32C_c::instance->freezeMarioBossFlag); + // Set the necessary Flags and make Mario enter Demo Mode dStage32C_c::instance->freezeMarioBossFlag = 1; - - MakeMarioEnterDemoMode(); - - OSReport("WLClass Flags are; %d and %d\n", WLClass::instance->_4, WLClass::instance->_8); - WLClass::instance->_4 = 4; WLClass::instance->_8 = 0; - OSReport("Creating the Vecs.\n"); + MakeMarioEnterDemoMode(); + + // 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}; - - OSReport("Creating Kameck.\n"); + // Create And use Kameck Kameck = (daKameckDemo*)createChild(KAMECK_FOR_CASTLE_DEMO, (dStageActor_c*)this, 0, &pos, &rot, 0); - - OSReport("Setting Kameck's State.\n"); Kameck->doStateChange(&daKameckDemo::StateID_DemoWait); - OSReport("Executing the Kamek.\n"); + this->scale = (Vec){1.0, 1.0, 1.0}; } void daFuzzyBear_c::executeState_Grow() { @@ -389,25 +402,18 @@ void daFuzzyBear_c::executeState_Grow() { void daFuzzyBear_c::endState_Grow() { this->Baseline = this->pos.y; - OSReport("Ending boss flag.\n"); + // Clean up the flags and Kameck dStage32C_c::instance->freezeMarioBossFlag = 0; WLClass::instance->_8 = 1; MakeMarioExitDemoMode(); - - OSReport("Ending BGMusic.\n"); StartBGMMusic(); - OSReport("Deleting the Kamek.\n"); - Kameck->Delete(1); - OSReport("OK. All grown up now."); } - - // Bounce State void daFuzzyBear_c::beginState_Bounce() { @@ -663,8 +669,12 @@ void daFuzzyBear_c::beginState_RolyPoly() { this->isInvulnerable = 1; - if (this->roly == 0) { this->speed.x = 12.0; } - else { this->speed.x = -12.0; } + if (this->roly == 1) { + this->direction = 1; + this->speed.x = 12.0; } + else { + this->direction = 0; + this->speed.x = -12.0; } this->speed.y = 0; this->RolyBounces = 0; @@ -773,8 +783,6 @@ void daFuzzyBear_c::endState_Wait() { } void daFuzzyBear_c::beginState_Outro() { - MakeMarioEnterDemoMode(); - WLClass::instance->_4 = 5; WLClass::instance->_8 = 0; diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 3ed947d..08a04f7 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -35,7 +35,8 @@ class daRamboo_c : public dEn_c { u64 eventFlag; - + dEn_c *Kameck; + static daRamboo_c *build(); void bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate); @@ -47,6 +48,9 @@ class daRamboo_c : public dEn_c { bool collisionCat2_IceBall_15_YoshiIce(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 collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + USING_STATES(daRamboo_c); DECLARE_STATE(Grow); @@ -68,6 +72,14 @@ extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daRamboo_c extern "C" dStageActor_c *GetSpecificPlayerActor(int number); extern "C" void *PlaySound(daRamboo_c *, int soundID); +extern "C" void *StopBGMMusic(); +extern "C" void *StartBGMMusic(); + +extern "C" void *MakeMarioEnterDemoMode(); +extern "C" void *MakeMarioExitDemoMode(); +extern "C" void *UpdateGameMgr(); + + CREATE_STATE(daRamboo_c, Grow); CREATE_STATE(daRamboo_c, Advance); @@ -85,15 +97,21 @@ extern EventTable_t *EventTable; void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); - OSReport("I hit Mario."); + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->which_player < 4) { + this->counter_504[apOther->owner->which_player] = 0; + } } void daRamboo_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Fireball"); CreateEffect(378, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}); this->pos.x += 6.0; } -bool daRamboo_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); return false; } +bool daRamboo_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Rolling Object"); @@ -106,7 +124,10 @@ void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic apOther->owner->Delete(apOther->owner->_390); } } -void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); } +void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { } +void daRamboo_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { } +void daRamboo_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { } + @@ -252,12 +273,12 @@ int daRamboo_c::onExecute() { if(this->fogSrt.isEntryAnimationDone(0)) this->fogSrt.setFrameForEntry(1.0, 0); - if (this->aPhysics.result1 == 1) { - char PlayerID = NearestPlayer(this); - dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); + // if (this->aPhysics.result1 == 1) { + // char PlayerID = NearestPlayer(this); + // dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); - this->_vf220(Player); - } + // this->_vf220(Player); + // } if (EventTable->events & this->eventFlag) { doStateChange(&StateID_Outro); @@ -304,41 +325,76 @@ void daRamboo_c::updateModelMatrices() { void daRamboo_c::beginState_Grow() { OSReport("Growing when Kameck Tells me to."); this->timer = 0; -// PlaySound(this, SE_BOSS_ROY_MAGIC_MAKE_FAST); + // Stop the BGM Music + StopBGMMusic(); + + // Set the necessary Flags and make Mario enter Demo Mode + dStage32C_c::instance->freezeMarioBossFlag = 1; + WLClass::instance->_4 = 4; + WLClass::instance->_8 = 0; + + MakeMarioEnterDemoMode(); + + // 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); } void daRamboo_c::executeState_Grow() { + + 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; + + if (this->timer == 150) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); } - if (this->timer == 60) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); } - if ((this->timer > 60) && (this->timer < 140)) { + if ((this->timer > 150) && (this->timer < 230)) { + scaleSpeed = 0.175; -// yPosScaling = 0; float modifier; - modifier = 2.0 + ((this->timer - 60) * scaleSpeed); + modifier = 1.0 + ((this->timer - 150) * scaleSpeed); this->scale = (Vec){modifier, modifier, modifier}; -// this->pos.y = this->pos.y + (yPosScaling/80); } + + 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 + } - if (this->timer > 170) { + if (this->timer > 420) { PlaySound(this, SE_EMY_CS_TERESA_BRING_IT); doStateChange(&StateID_Advance); - } - + } } void daRamboo_c::endState_Grow() { this->Baseline = this->pos.y; -// StopSound(SE_BOSS_ROY_MAGIC_MAKE_FAST); - OSReport("OK. All grown up now."); + // Clean up the flags and Kameck + dStage32C_c::instance->freezeMarioBossFlag = 0; + WLClass::instance->_8 = 1; + + MakeMarioExitDemoMode(); + StartBGMMusic(); + + Kameck->Delete(1); } @@ -348,7 +404,6 @@ void daRamboo_c::endState_Grow() { // Advance State void daRamboo_c::beginState_Advance() { - OSReport("Charge!"); this->speed.y = 0; this->speed.z = 0; this->timer = 0; @@ -379,7 +434,7 @@ void daRamboo_c::executeState_Advance() { this->ytimer += 1; } -void daRamboo_c::endState_Advance() { OSReport("Ouch. Stop Charging."); } +void daRamboo_c::endState_Advance() { } @@ -389,7 +444,6 @@ void daRamboo_c::endState_Advance() { OSReport("Ouch. Stop Charging."); } void daRamboo_c::beginState_Wait() { - OSReport("Waiting"); this->timer = 0; PlaySound(this, SE_EMY_TERESA_STOP); @@ -439,8 +493,7 @@ void daRamboo_c::endState_Wait() { this->anmShayA.bind(&this->bodyModel, anmChr, 1); this->bodyModel.bindAnim(&this->anmShayA, 0.0); this->anmShayA.setUpdateRate(1.0); - - OSReport("No more bouncing."); } +} @@ -450,7 +503,6 @@ void daRamboo_c::endState_Wait() { void daRamboo_c::beginState_Flee() { - OSReport("Damnit that hurt."); this->timer = 0; } @@ -478,8 +530,6 @@ void daRamboo_c::executeState_Flee() { } void daRamboo_c::endState_Flee() { - - OSReport("Ugh, so dizzy."); } @@ -487,15 +537,29 @@ void daRamboo_c::endState_Flee() { void daRamboo_c::beginState_Outro() { + 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->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 >.> + StopBGMMusic(); + + WLClass::instance->_4 = 5; + WLClass::instance->_8 = 0; + dStage32C_c::instance->freezeMarioBossFlag = 1; + } void daRamboo_c::executeState_Outro() { + if (this->anmWaitB.isAnimationDone()) + this->anmWaitB.setCurrentFrame(0.0); + if (this->dying == 1) { if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); @@ -561,6 +625,7 @@ void daRamboo_c::executeState_Outro() { this->timer = 0; PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); + MakeMarioEnterDemoMode(); } this->timer += 1; diff --git a/src/bossWrenchThrow.cpp b/src/bossWrenchThrow.cpp index 6ce36f6..1abc226 100644 --- a/src/bossWrenchThrow.cpp +++ b/src/bossWrenchThrow.cpp @@ -16,11 +16,12 @@ class daWrench : public dEn_c { m3d::mdl_c bodyModel; int timer; - char homing; + char Kaboom; char direction; char front; float ymod; int lifespan; + u32 cmgr_returnValue; static daWrench *build(); @@ -32,34 +33,34 @@ class daWrench : public dEn_c { void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); USING_STATES(daWrench); - DECLARE_STATE(HandThrow); - DECLARE_STATE(Homing); DECLARE_STATE(Straight); + DECLARE_STATE(Kaboom); }; -CREATE_STATE(daWrench, HandThrow); -CREATE_STATE(daWrench, Homing); CREATE_STATE(daWrench, Straight); - +CREATE_STATE(daWrench, Kaboom); extern "C" void *PlaySound(dEn_c *, int soundID); +extern "C" void *PlaySoundAsync(dEn_c *, int soundID); +extern "C" void *PlayWrenchSound(dEn_c *); extern "C" dStageActor_c *GetSpecificPlayerActor(int number); +extern "C" u32 GenerateRandomNumber(int max); void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); - + this->isDead = 0; this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->which_player > 3) { - OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n"); - }else{ + if(apOther->owner->which_player < 4) { this->counter_504[apOther->owner->which_player] = 0; } } @@ -72,13 +73,18 @@ void daWrench::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics void daWrench::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}, 48); - PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); - - //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) - this->Delete(this->_390); + PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); + this->Delete(1); } void daWrench::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {} +void daWrench::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + this->_vf220(apOther->owner); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}, 48); + + PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); + this->Delete(1); +} @@ -100,32 +106,31 @@ int daWrench::onCreate() { this->direction = this->settings & 0xF; - this->homing = (this->settings >> 4) & 0xF; + this->Kaboom = (this->settings >> 4) & 0xF; this->front = (this->settings >> 8) & 0xF; - ActivePhysics::Info HitMeBaby; - if (this->homing == 0) { + if (this->Kaboom == 0) { HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = 0.0; - HitMeBaby.xDistToEdge = 6.0; - HitMeBaby.yDistToEdge = 6.0; + HitMeBaby.xDistToEdge = 5.0; + HitMeBaby.yDistToEdge = 5.0; - this->scale.x = 1.5; - this->scale.y = 1.5; - this->scale.z = 1.5; + this->scale.x = 1.25; + this->scale.y = 1.25; + this->scale.z = 1.25; } else { HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = 0.0; - HitMeBaby.xDistToEdge = 12.0; - HitMeBaby.yDistToEdge = 12.0; + HitMeBaby.xDistToEdge = 8.0; + HitMeBaby.yDistToEdge = 8.0; - this->scale.x = 3.0; - this->scale.y = 3.0; - this->scale.z = 3.0; + this->scale.x = 2.0; + this->scale.y = 2.0; + this->scale.z = 2.0; } HitMeBaby.category1 = 0x3; @@ -139,9 +144,40 @@ int daWrench::onCreate() { this->aPhysics.addToList(); - this->pos.z = 3300.0; + spriteSomeRectX = 5.0f; + spriteSomeRectY = 5.0f; + _320 = 0.0f; + _324 = 5.0f; + + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + + collMgr.Init(this, one, two, three); + collMgr.execute(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + + + if (this->direction == 0) { // Ground Facing Left + this->pos.x -= 0.0; // -32 to +32 + this->pos.y += 36.0; + this->rot.z = 0x2000; + } + else if (this->direction == 1) { // Ground Facing Right + this->pos.x += 0.0; // +32 to -32 + this->pos.y += 36.0; + this->rot.z = 0xE000; + } + if (this->front == 1) { this->pos.z = -1804.0; } + else { this->pos.z = 3300.0; } + - doStateChange(&StateID_HandThrow); + if (this->Kaboom) { + doStateChange(&StateID_Kaboom); } + else { + doStateChange(&StateID_Straight); } this->onExecute(); return true; @@ -176,160 +212,110 @@ int daWrench::onExecute() { } +void daWrench::beginState_Kaboom() { + float rand = (float)GenerateRandomNumber(10) * 0.4; -void daWrench::beginState_HandThrow() { - - if (this->direction == 0) { // Ground Facing Left - this->pos.x += 32.0; - this->pos.y += 48.0; - this->rot.z = 0x4000; + if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards + speed.x = 1.0 + rand; } - else if (this->direction == 1) { // Ground Facing Right - this->pos.x -= 32.0; - this->pos.y += 48.0; - this->rot.z = 0xC000; + else { // directions 0 spins anti-clockwise, fly leftwards + speed.x = -1.0 - rand; } - else if (this->direction == 2) { // Upside Down Facing Left - this->pos.x += 32.0; - this->pos.y -= 48.0; - this->rot.z = 0x4000; - } - else if (this->direction == 3) { // Upside Down Facing Right - this->pos.x -= 32.0; - this->pos.y -= 48.0; - this->rot.z = 0xC000; - } - - if (this->front == 1) { this->pos.z = -1804.0; } - - this->lifespan = 0; -} -void daWrench::executeState_HandThrow() { - - if (this->lifespan > 30) { - - if (this->homing == 0) { - doStateChange(&StateID_Straight); } - else { - doStateChange(&StateID_Homing); } - } - - this->lifespan += 1; - + speed.y = 6.0; } -void daWrench::endState_HandThrow() { } - - - -void daWrench::beginState_Homing() { - this->lifespan = 360; +void daWrench::executeState_Kaboom() { - Vec tempPos = this->pos; + speed.y = speed.y - 0.01875; - char PlayerID = NearestPlayer(this); - dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); - if ((Player->pos.y >= tempPos.y - 16.0) && (Player->pos.y <= tempPos.y + 16.0)) { - this->ymod = 0.0; } + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); - else if ((Player->pos.y >= tempPos.y - 106.0) && (Player->pos.y < tempPos.y - 16.0)) { - this->ymod = -0.6; } + if (collMgr.CollidedWithTile()) { + // hit the ground + PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); - else if ((Player->pos.y <= tempPos.y + 106.0) && (Player->pos.y > tempPos.y + 16.0)) { - this->ymod = 0.6; } - - else if (Player->pos.y < tempPos.y - 106.0) { - this->ymod = -1.2; } - - else if (Player->pos.y > tempPos.y + 106.0) { - this->ymod = 1.2; } - - else { - this->ymod = 0.0; } - - if (this->direction & 1) { this->speed.x = -1.5; } - else { this->speed.x = 1.5; } - - this->speed.y = 0; - -} -void daWrench::executeState_Homing() { - - if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards - this->rot.z -= 0x1000; } - else { // directions 0 and 2 spin anti-clockwise, fly leftwards - this->rot.z += 0x1000; } - - this->pos.y += this->ymod * this->lifespan / 360; - - this->UpdateObjectPosBasedOnSpeedValuesReal(); - - if (this->lifespan < 1) { - - PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 9); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.25, 1.25, 1.25}, 167); + this->Delete(1); + } + if (collMgr.bitfield_for_checks & (0x15 << direction)) { + // hit the wall + PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); + + if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards + CreateEffect(&this->pos, &(S16Vec){0,0x4000,0}, &(Vec){0.75, 0.75, 0.75}, 9); + CreateEffect(&this->pos, &(S16Vec){0,0x4000,0}, &(Vec){1.25, 1.25, 1.25}, 167); + } + else { // directions 0 spins anti-clockwise, fly leftwards + CreateEffect(&this->pos, &(S16Vec){0,0xE000,0}, &(Vec){0.75, 0.75, 0.75}, 9); + CreateEffect(&this->pos, &(S16Vec){0,0xE000,0}, &(Vec){1.25, 1.25, 1.25}, 167); + } - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242); - //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) - this->Delete(this->_390); + this->Delete(1); } - PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); + if (this->direction == 1) { // directions 1 spins clockwise, fly rightwards + this->rot.z -= 0x1000; } + else { // directions 0 spins anti-clockwise, fly leftwards + this->rot.z += 0x1000; } - this->lifespan -= 1; + PlayWrenchSound(this); } -void daWrench::endState_Homing() { } +void daWrench::endState_Kaboom() { } void daWrench::beginState_Straight() { - - char PlayerID = NearestPlayer(this); - dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); - - - float slope = ( (this->pos.y - Player->pos.y) / (this->pos.x - Player->pos.x) ); + float rand = (float)GenerateRandomNumber(10) * 0.4; + if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards + speed.x = 1.0 + rand; + } + else { // directions 0 spins anti-clockwise, fly leftwards + speed.x = -1.0 - rand; + } - Vec tempPos = this->pos; - if (this->direction & 1) { - this->speed.x = -2.0; - this->speed.y = 2.0 * slope; - } - - else { - this->speed.x = 2.0; - this->speed.y = 2.0 * slope; - } + speed.y = 6.0; } - void daWrench::executeState_Straight() { - this->lifespan = 360; - - if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards - this->rot.z -= 0x1000; } - else { // directions 0 and 2 spin anti-clockwise, fly leftwards - this->rot.z += 0x1000; } - + speed.y = speed.y - 0.01875; - this->UpdateObjectPosBasedOnSpeedValuesReal(); - - PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); - if (this->lifespan == (360-45)) { this->pos.z = 3300.0; } + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); - if (this->lifespan < 1) { - - PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); + if (collMgr.CollidedWithTile()) { + // hit the ground + PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); + + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 9); + this->Delete(1); + } + if (collMgr.bitfield_for_checks & (0x15 << direction)) { + // hit the wall + PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 242); - //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) - this->Delete(this->_390); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 9); + this->Delete(1); } - this->lifespan -= 1; + if (this->direction == 1) { // directions 1 spins clockwise, fly rightwards + this->rot.z -= 0x1000; } + else { // directions 0 spins anti-clockwise, fly leftwards + this->rot.z += 0x1000; } + + PlayWrenchSound(this); + } void daWrench::endState_Straight() { } diff --git a/src/meteor.cpp b/src/meteor.cpp index c7d9220..7d3a9bd 100755 --- a/src/meteor.cpp +++ b/src/meteor.cpp @@ -31,7 +31,6 @@ dMeteor *dMeteor::build() { // extern "C" dStageActor_c *GetSpecificPlayerActor(int num); // extern "C" void *modifyPlayerPropertiesWithRollingObject(dStageActor_c *Player, float _52C); -extern "C" void *spinningPhysicsCallback(); int dMeteor::onCreate() { @@ -55,22 +54,22 @@ int dMeteor::onCreate() { // Other settings this->spinDir = this->settings & 0x1; - this->spinSpeed = ((this->settings >> 16) & 0xFF) * 80; + this->spinSpeed = ((this->settings >> 16) & 0xFF) * 20; // Setup Physics - MakeItRound.baseSetup(this, &spinningPhysicsCallback, 0, 0, 1, 0); + MakeItRound.baseSetup(this, 0, 0, 0, 1, 0); MakeItRound.x = 0.0; MakeItRound.y = 0.0; - MakeItRound.diameter = 16.0 * sca; + MakeItRound.diameter = 13.0 * sca; MakeItRound.isRound = 1; MakeItRound.update(); MakeItRound.addToList(); - this->pos.z = -3458.0; + this->pos.z = 3458.0; this->onExecute(); return true; @@ -88,8 +87,6 @@ int dMeteor::onExecute() { MakeItRound.update(); updateModelMatrices(); - // 518 == opposite of direction - // for (i=0; i<4; i++) { // dStageActor_c *player = GetSpecificPlayerActor(i); // modifyPlayerPropertiesWithRollingObject(player, ); diff --git a/src/penguin.cpp b/src/penguin.cpp new file mode 100644 index 0000000..82c0091 --- /dev/null +++ b/src/penguin.cpp @@ -0,0 +1,429 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include <stage.h> +#include "effects.h" +#include "player.h" + +class daPengi : public dEn_c { + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; + nw4r::g3d::ResFile anmFile; + + m3d::mdl_c bodyModel; + + m3d::anmChr_c chrAnimation; + + int timer; + char damage; + char isDown; + float XSpeed; + u32 cmgr_returnValue; + bool isBouncing; + + static daPengi *build(); + + void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); + void updateModelMatrices(); + bool calculateTileCollisions(); + + // void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); + // bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + + void _vf148(); + void _vf14C(); + + USING_STATES(daPengi); + DECLARE_STATE(Walk); + DECLARE_STATE(Turn); + DECLARE_STATE(Die); +}; + +daPengi *daPengi::build() { + void *buffer = AllocFromGameHeap1(sizeof(daPengi)); + return new(buffer) daPengi; +} + +/////////////////////// +// Externs and States +/////////////////////// + extern "C" void *PlaySound(dStageActor_c *, int soundID); + + extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); + extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daPengi *, Vec pos); + + //FIXME make this dEn_c->used... + extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); + extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); + + + CREATE_STATE(daPengi, Walk); + CREATE_STATE(daPengi, Turn); + CREATE_STATE(daPengi, Die); + +//////////////////////// +// Collision Functions +//////////////////////// + + // Collision callback to help shy guy not die at inappropriate times and ruin the dinner + + void daPengi::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + + char hitType; + hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + + if(hitType == 1) { // regular jump + apOther->someFlagByte |= 2; + doStateChange(&StateID_Die); + } + else if(hitType == 3) { // spinning jump or whatever? + apOther->someFlagByte |= 2; + doStateChange(&StateID_Die); + } + else if(hitType == 0) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + } + + // fix multiple player collisions via megazig + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->which_player < 4) { + this->counter_504[apOther->owner->which_player] = 0; + } + } + + void daPengi::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->playerCollision(apThis, apOther); + } + + void daPengi::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther){ + doStateChange(&StateID_Die); + } + + void daPengi::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){ + doStateChange(&StateID_DieSmoke); + } + + void daPengi::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_DieSmoke); + } + + // void daPengi::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { + // doStateChange(&StateID_DieFall); + // } + + // These handle the ice crap + void daPengi::_vf148() { + dEn_c::_vf148(); + doStateChange(&StateID_Die); + } + void daPengi::_vf14C() { + dEn_c::_vf14C(); + doStateChange(&StateID_Die); + } + + void daPengi::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + +bool daPengi::calculateTileCollisions() { + // Returns true if sprite should turn, false if not. + + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); + + if (isBouncing) { + stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); + if (speed.y != 0.0f) + isBouncing = false; + } + + float xDelta = pos.x - last_pos.x; + if (xDelta >= 0.0f) + direction = 0; + else + direction = 1; + + if (collMgr.CollidedWithTile()) { + // Walking into a tile branch + + if (cmgr_returnValue == 0) + isBouncing = true; + + if (speed.x != 0.0f) { + //playWmEnIronEffect(); + } + + speed.y = 0.0f; + + // u32 blah = collMgr.s_80070760(); + // u8 one = (blah & 0xFF); + // static const float incs[5] = {0.00390625f, 0.0078125f, 0.015625f, 0.0234375f, 0.03125f}; + // x_speed_inc = incs[one]; + max_speed.x = (direction == 1) ? -1.0f : 1.0f; + } else { + x_speed_inc = 0.0f; + } + + // Bouncing checks + if (_34A & 4) { + Vec v = (Vec){0.0f, 1.0f, 0.0f}; + collMgr.parent_speed_ptr = &v; + + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; + + collMgr.parent_speed_ptr = &speed; + + } else { + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; + } + + collMgr.s_8006FA40(0); + + // Switch Direction + if (collMgr.bitfield_for_checks & (0x15 << direction)) { + if (collMgr.CollidedWithTile()) { + isBouncing = true; + } + return true; + } + return false; +} + +void daPengi::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { + nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr(name); + this->chrAnimation.bind(&this->bodyModel, anmChr, unk); + this->bodyModel.bindAnim(&this->chrAnimation, unk2); + this->chrAnimation.setUpdateRate(rate); +} + +int daPengi::onCreate() { + + // Model creation + allocator.link(-1, GameHeaps[0], 0, 0x20); + + this->resFile.data = getResource("penguin2", "g3d/finalpenguin.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("npc011_m1"); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); + + + // Animations start here + this->anmFile.data = getResource("penguin2", "g3d/pengiAnm.brres"); + nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr("npc011_idle"); + this->chrAnimation.setup(mdl, anmChr, &this->allocator, 0); + + allocator.unlink(); + + // Stuff I do understand + this->scale = (Vec){2.0, 2.0, 2.0}; + + // this->pos.y = this->pos.y + 30.0; // X is vertical axis + this->rot.x = 0; // X is vertical axis + this->rot.y = 0xD800; // Y is horizontal axis + this->rot.z = 0; // Z is ... an axis >.> + this->direction = 1; // Heading left. + + this->speed.x = 0.0; + this->speed.y = 0.0; + this->max_speed.x = 0.8; + this->x_speed_inc = 0.2; + this->XSpeed = 0.8; + + + + ActivePhysics::Info HitMeBaby; + + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.yDistToCenter = 12.0; + + HitMeBaby.xDistToEdge = 14.0; + HitMeBaby.yDistToEdge = 12.0; + + HitMeBaby.category1 = 0x3; + HitMeBaby.category2 = 0x0; + HitMeBaby.bitfield1 = 0x4F; + HitMeBaby.bitfield2 = 0xffbafffe; + HitMeBaby.unkShort1C = 0; + HitMeBaby.callback = &dEn_c::collisionCallback; + + OSReport("Making the Physics Class and adding to the list\n"); + this->aPhysics.initWithStruct(this, &HitMeBaby); + this->aPhysics.addToList(); + + + // Tile collider + OSReport("Making the Tile collider Class\n"); + + // These fucking rects do something for the tile rect + spriteSomeRectX = 28.0f; + spriteSomeRectY = 32.0f; + _320 = 0.0f; + _324 = 16.0f; + + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + + collMgr.Init(this, one, two, three); + collMgr.execute(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + + if (collMgr.CollidedWithTile()) + isBouncing = false; + else + isBouncing = true; + + + // State Changers + + doStateChange(&StateID_Walk); + + this->onExecute(); + return true; +} + +int daPengi::onDelete() { + return true; +} + +int daPengi::onExecute() { + acState.execute(); + updateModelMatrices(); + + return true; +} + +int daPengi::onDraw() { + bodyModel.scheduleForDrawing(); + bodyModel._vf1C(); + + return true; +} + +void daPengi::updateModelMatrices() { + matrix.translation(pos.x, pos.y - 2.0, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); +} + + +/////////////// +// Walk State +/////////////// + void daPengi::beginState_Walk() { + //inline this piece of code + bindAnimChr_and_setUpdateRate("npc011_walk", 1, 0.0, 1.5); + this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; + this->speed.x = (direction) ? -0.8f : 0.8f; + + this->max_speed.y = -4.0; + this->speed.y = -4.0; + this->y_speed_inc = -0.1875; + } + void daPengi::executeState_Walk() { + + bool ret = calculateTileCollisions(); + if (ret) { + doStateChange(&StateID_Turn); + } + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + } + void daPengi::endState_Walk() { } + +/////////////// +// Turn State +/////////////// + void daPengi::beginState_Turn() { + bindAnimChr_and_setUpdateRate("npc011_turn", 1, 0.0, 1.0); + + this->direction ^= 1; + this->speed.x = 0.0; + } + void daPengi::executeState_Turn() { + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + + u16 amt = (this->direction == 0) ? 0x2800 : 0xD800; + int done = SmoothRotation(&this->rot.y, amt, 0x800); + + if(done) { + this->doStateChange(&StateID_Walk); + } + } + void daPengi::endState_Turn() { } + + + +/////////////// +// Die State +/////////////// + void daPengi::beginState_Die() { + dEn_c::dieFall_Begin(); + + bindAnimChr_and_setUpdateRate("npc011_damage", 1, 0.0, 1.0); + this->timer = 0; + } + void daPengi::executeState_Die() { + + if(this->chrAnimation.isAnimationDone()) { + this->kill(); + this->Delete(1); + } + } + void daPengi::endState_Die() { }
\ No newline at end of file diff --git a/src/player.cpp b/src/player.cpp index 58960cc..8aa3ca6 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -6,29 +6,29 @@ char NearestPlayer(dStageActor_c* actor) { char nearest = -1; float current = 1000000000000000000000000000000.0; - OSReport("FINDING NEAREST PLAYER\n"); + // OSReport("FINDING NEAREST PLAYER\n"); for(char ii = 0; ii < 4; ii++) { - OSReport("K, let's check out Player %d\n", ii); + // OSReport("K, let's check out Player %d\n", ii); dStageActor_c* player = GetSpecificPlayerActor(ii); if(!player) { - OSReport("Player %d is NULL\n", ii); + // OSReport("Player %d is NULL\n", ii); continue; } - OSReport("Player %d is ok\n", ii); - OSReport("[%f,%f,%f] - [%f,%f,%f]\n", - actor->pos.x, actor->pos.y, actor->pos.z, - player->pos.x, player->pos.y, player->pos.z); + // OSReport("Player %d is ok\n", ii); + // OSReport("[%f,%f,%f] - [%f,%f,%f]\n", + // actor->pos.x, actor->pos.y, actor->pos.z, + // player->pos.x, player->pos.y, player->pos.z); float distance = VECDistance(&actor->pos, &player->pos); - OSReport("Distance: %f [%f]\n", distance, current); + // OSReport("Distance: %f [%f]\n", distance, current); if(distance < current) { current = distance; nearest = ii; - OSReport("Nearest is now %d\n", ii); + // OSReport("Nearest is now %d\n", ii); } } - OSReport("NearestPlayer returning %d\n", nearest); + // OSReport("NearestPlayer returning %d\n", nearest); if(nearest < 0) { - OSReport("***FIX ME IMMEDIATELY***\n***NEED Z COORDINATES FOR ACTOR***\n"); + // OSReport("***FIX ME IMMEDIATELY***\n***NEED Z COORDINATES FOR ACTOR***\n"); } return nearest; } diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 0104f96..bf54c64 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -134,6 +134,7 @@ daShyGuy *daShyGuy::build() { // Externs and States /////////////////////// extern "C" void *PlaySound(dStageActor_c *, int soundID); + extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID); extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daShyGuy *, Vec pos); @@ -558,7 +559,7 @@ int daShyGuy::onCreate() { // giantRider.init(this, -19.5f, 18.0f, 19.5f, 18.0f); - giantRider.init(this, 0.0f, 0.0f, 24.0f, 0.0f, 28.0f, 0, 0); + giantRider.init(this, 0.0f, 0.0f, -24.0f, 0.0f, 28.0f, 0, 0); // addToList(&giantRider); giantRider.addToList(); @@ -841,12 +842,12 @@ void daShyGuy::updateModelMatrices() { if (this->jumpCounter == 3) { bindAnimChr_and_setUpdateRate("c18_NORMAL_STEAL_R", 1, 0.0, 1.0); this->speed.y = 8.0; - PlaySound(this, SE_PLY_JUMPDAI_HIGH); + PlaySoundAsync(this, SE_PLY_JUMPDAI_HIGH); } else { bindAnimChr_and_setUpdateRate("c18_EV_WIN_1_R", 1, 0.0, 1.0); this->speed.y = 6.0; - PlaySound(this, SE_PLY_JUMPDAI); + PlaySoundAsync(this, SE_PLY_JUMPDAI); } OSReport("Takeoff Initiated"); @@ -1013,7 +1014,7 @@ void daShyGuy::updateModelMatrices() { } else if (this->timer == 132) { - PlaySound(this, SE_EMY_CRASHER_PUNCH); + PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); if (this->direction == 1) { CreateEffect(&(Vec){this->pos.x - 18.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 123); @@ -1038,7 +1039,7 @@ void daShyGuy::updateModelMatrices() { } this->timer = 0; - PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1); + PlaySoundAsync(this, SE_EMY_BIG_PAKKUN_DAMAGE_1); } } } @@ -1460,7 +1461,7 @@ void daShyGuy::updateModelMatrices() { if (this->timer > 450) { this->kill(); - return; + this->Delete(1); } // dEn_c::dieFall_Execute(); diff --git a/src/soundPlayer.S b/src/soundPlayer.S index e132849..8866460 100644 --- a/src/soundPlayer.S +++ b/src/soundPlayer.S @@ -81,6 +81,45 @@ GoAwaySoundGuy: blr + +.global PlaySoundAsync +PlaySoundAsync: + stwu r1, -0x30(r1) + mflr r0 + stw r0, 0x34(r1) + stw r31, 0x2C(r1) + stw r30, 0x28(r1) + mr r30, r4 + + # Gets Player Position + mr r4, r3 # object + addi r3, r1, 0x10 # dest + bl Actor_GetVec3WithValuesAdded + + # Gives an accurate position for the sound + addi r3, r1, 8 + addi r4, r1, 0x10 + bl ConvertStagePositionIntoScreenPosition__Maybe + + # If we're good to go, play the sound! + lis r31, SoundClassRelated@h + ori r31, r31, SoundClassRelated@l + lwz r3, 0(r31) + addi r5, r1, 8 + mr r4, r30 + li r6, 0 + bl YetAnotherSoundPlayer + + lwz r30, 0x28(r1) + lwz r31, 0x2C(r1) + lwz r0, 0x34(r1) + mtlr r0 + addi r1, r1, 0x30 + blr + + + + # StopSound(int soundID) .global StopSound |