diff options
Diffstat (limited to 'src/bossMegaGoomba.cpp')
-rw-r--r-- | src/bossMegaGoomba.cpp | 345 |
1 files changed, 202 insertions, 143 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index e4bc270..0029f10 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -4,16 +4,33 @@ #include <sfx.h> #include "boss.h" +extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int); +extern "C" void *ShakePlayers(dEn_c *); +extern "C" void *StopPlayerShake(dEn_c *); +extern "C" void *StageScreen; + +const char* MGarcNameList [] = { + "kuriboBig", + "kuriboBoss", + NULL +}; + //Enable this if you're fixing it void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { float amtX = scale->x; float amtY = scale->y; + // 0, 20.0, 18.0, 20.0 ActivePhysics::Info info; + // info.xDistToCenter = 0.0; + // info.yDistToCenter = 7.65 * amtY; + // info.xDistToEdge = 8.0 * amtX; + // info.yDistToEdge = 8.7 * amtY; + info.xDistToCenter = 0.0; - info.yDistToCenter = 7.65 * amtY; - info.xDistToEdge = 4.0 * amtX; - info.yDistToEdge = 7.7 * amtY; + info.yDistToCenter = 22.0 * amtY; + info.xDistToEdge = 18.0 * amtX; + info.yDistToEdge = 24.0 * amtY; info.category1 = actor->aPhysics.info.category1; info.category2 = actor->aPhysics.info.category2; @@ -28,7 +45,7 @@ void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { actor->aPhysics.addToList(); } -class daMegaGoomba_c : public daBoss { +class daMegaGoomba_c : public dEn_c { int onCreate(); int onDelete(); int onExecute(); @@ -57,6 +74,9 @@ class daMegaGoomba_c : public daBoss { float JumpDist; float JumpTime; + char isBigBoss; + char isPanic; + bool takeHit(char count); void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); @@ -70,8 +90,8 @@ class daMegaGoomba_c : public daBoss { void updateModelMatrices(); - bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); - bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + // bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + // bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool stageActorCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -82,13 +102,15 @@ class daMegaGoomba_c : public daBoss { void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); - void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + // void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat11_PipeCannon(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void addScoreWhenHit(void *other); void _vf120(ActivePhysics *apThis, ActivePhysics *apOther); void _vf110(ActivePhysics *apThis, ActivePhysics *apOther); void _vf108(ActivePhysics *apThis, ActivePhysics *apOther); @@ -115,8 +137,6 @@ daMegaGoomba_c *daMegaGoomba_c::build() { } - - //FIXME make this dEn_c->used... extern "C" int SomeStrangeModification(dStageActor_c* actor); extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); @@ -129,6 +149,7 @@ CREATE_STATE(daMegaGoomba_c, Walk); CREATE_STATE(daMegaGoomba_c, Turn); CREATE_STATE(daMegaGoomba_c, Jump); CREATE_STATE(daMegaGoomba_c, Launch); +CREATE_STATE(daMegaGoomba_c, Outro); //TODO better fix for possible bug with sign (ex. life=120; count=-9;) @@ -140,7 +161,10 @@ bool daMegaGoomba_c::takeHit(char count) { c = 127 - l; } this->life -= c; - this->XSpeed += 0.25; + // this->XSpeed += 0.10; + + // float rate = this->animationChr.getUpdateRate(); + // this->animationChr.setUpdateRate(rate+0.05); this->JumpHeight += 12.0; this->JumpDist += 12.0; this->JumpTime += 5.0; @@ -153,27 +177,19 @@ bool daMegaGoomba_c::takeHit(char count) { #define ACTIVATE 1 #define DEACTIVATE 0 -bool daMegaGoomba_c::preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - return false; -} -bool daMegaGoomba_c::prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - return false; -} - - +extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther); void daMegaGoomba_c::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { //HE'S TOO BADASS TO STOP FOR SMALLER GOOMBAS -#if 0 - float me = apThis->firstFloatArray[3]; - if(((this->direction == 1) && (me > 0.0)) || ((this->direction == 0) && (me < 0.0))) { - dStateBase_c* state = this->acState.getCurrentState(); - if(!state->isEqual(&StateID_Turn)) { - doStateChange(&StateID_Turn); + #if 0 + float me = apThis->firstFloatArray[3]; + if(((this->direction == 1) && (me > 0.0)) || ((this->direction == 0) && (me < 0.0))) { + dStateBase_c* state = this->acState.getCurrentState(); + if(!state->isEqual(&StateID_Turn)) { + doStateChange(&StateID_Turn); + } } - } -#endif + #endif } - void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { /* * * * * * * * * * * * * * * * * * * * * @@ -194,6 +210,7 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth //FIXME rename and make part of dStageActor_c //unk=0 does _vfs, unk=1 does playSeCmnStep //char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); if(ret == 1) { // regular jump apOther->someFlagByte |= 2; @@ -215,13 +232,28 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth this->flags_4FC |= (1<<(31-7)); this->counter_504[apOther->owner->which_player] = 0; } +void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + OSReport("Ground Pounded"); + apOther->someFlagByte |= 2; + + if(this->takeHit(1)) + doStateChange(&StateID_DieFall); + + // dEn_c *mario = (dEn_c*)apOther->owner; + // mario->speed.y = 6.0; + // EN_LandbarrelPlayerCollision(this, apThis, apOther); + // mario->speed.x += 16.0; + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; +} void daMegaGoomba_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {} bool daMegaGoomba_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } -void daMegaGoomba_c::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther) { } -void daMegaGoomba_c::collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther) { } +void daMegaGoomba_c::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_DieFall); } +// void daMegaGoomba_c::collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { if(this->takeHit(1)) doStateChange(&StateID_DieFall); @@ -237,6 +269,7 @@ void daMegaGoomba_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysi if(this->takeHit(1)) doStateChange(&StateID_DieFall); } +void daMegaGoomba_c::addScoreWhenHit(void *other) {} void daMegaGoomba_c::_vf120(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::_vf110(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::_vf108(ActivePhysics *apThis, ActivePhysics *apOther) { } @@ -267,15 +300,15 @@ void daMegaGoomba_c::dieFall_Execute() { void daMegaGoomba_c::setupBodyModel() { allocator.link(-1, GameHeaps[0], 0, 0x20); - this->resFile.data = getResource("kuribo", "g3d/t02.brres"); - nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kuribo"); + this->resFile.data = getResource("kuriboBoss", "g3d/kuriboBoss.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kuriboBig"); bodyModel.setup(mdl, &allocator, 0x224, 1, 0); SetupTextures_Enemy(&bodyModel, 0); bool ret; nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); - this->bindAnimChr_and_setUpdateRate("walk", 1, 0.0, 1.0); + this->bindAnimChr_and_setUpdateRate("walk", 1, 0.0, 0.2); nw4r::g3d::ResAnmTexPat anmPat = this->resFile.GetResAnmTexPat("walk"); this->resTexPat = anmPat; @@ -328,14 +361,17 @@ int daMegaGoomba_c::onCreate() { this->rot.y = (this->direction) ? 0xE000 : 0x2000; this->_518 = 2; + isBigBoss = this->settings & 0xF; + this->animationChr.setCurrentFrame(69.0); + ActivePhysics::Info hm; hm.xDistToCenter = 0.0; hm.yDistToCenter = 8.0; - hm.xDistToEdge = 8.0; - hm.yDistToEdge = 8.0; + hm.xDistToEdge = 12.0; + hm.yDistToEdge = 12.0; hm.category1 = 0x3; hm.category2 = 0x0; - hm.bitfield1 = 0x6f; + hm.bitfield1 = 0x4f; hm.bitfield2 = 0xffbafffe; hm.unkShort1C = 0; hm.callback = &dEn_c::collisionCallback; @@ -354,14 +390,21 @@ int daMegaGoomba_c::onCreate() { life = 3; already_hit = false; this->x_speed_inc = 0.1; + this->pos.y -= 16.0; // 2.0 is good final speed - this->XSpeed = 1.5; + this->XSpeed = 0.2; this->JumpHeight = 48.0; this->JumpDist = 64.0; this->JumpTime = 50.0; - doStateChange(&StateID_Grow); + // doStateChange(&StateID_Grow); + + scale.x = 5.0; + scale.y = 5.0; + scale.z = 5.0; + setNewActivePhysicsRect(this, &this->scale); + doStateChange(&StateID_Walk); this->onExecute(); return true; @@ -410,65 +453,66 @@ void daMegaGoomba_c::updateModelMatrices() { /////////////// // Grow State /////////////// - void daMegaGoomba_c::beginState_Grow() { - this->timer = 0; + // void daMegaGoomba_c::beginState_Grow() { + // this->timer = 0; - SetupKameck(this, Kameck); - } + // SetupKameck(this, Kameck); + // } - void daMegaGoomba_c::executeState_Grow() { - this->timer += 1; + // void daMegaGoomba_c::executeState_Grow() { + // this->timer += 1; - bool ret; - ret = GrowBoss(this, Kameck, 1.0, 7.0, 0, this->timer); - - if (ret) { - PlaySound(this, SE_EMY_KURI_CHANGE_BIG); - doStateChange(&StateID_Walk); - } - } - void daMegaGoomba_c::endState_Grow() { - CleanupKameck(this, Kameck); - } - - -// Grow State -// void daMegaGoomba_c::beginState_Grow() { -// this->timer = 1.0; - -// float start, end, shift1, shift2; -// start = 59.0; -// shift1 = 90.0; -// shift2 = 120.0; -// end = 139.0; -// /* keysX[i] = { frame, value, slope }; */ -// Xkey_count = 7; -// keysX[0] = (HermiteKey){ start, 1.0, 1.0 }; -// keysX[1] = (HermiteKey){ (start+shift1)/2, 2.0, 1.0 }; -// keysX[2] = (HermiteKey){ shift1, 4.0, 1.0 }; -// keysX[3] = (HermiteKey){ (shift1+shift2)/2, 3.0, 1.0 }; -// keysX[3] = (HermiteKey){ shift2, 6.0, 1.0 }; -// keysX[3] = (HermiteKey){ (shift2+end)/2, 5.0, 1.0 }; -// keysX[6] = (HermiteKey){ end, 7.0, 1.0 }; -// } -// void daMegaGoomba_c::executeState_Grow() { - -// this->timer += 1.0; - -// if ((this->timer > 60.0) && (this->timer < 140.0)) { + // bool ret; + // // ret = GrowBoss(this, Kameck, 1.0, 16.0, 0, this->timer); + // ret = GrowBoss(this, Kameck, 1.0, 5.0, 0, this->timer); + + // if (ret) { + // setNewActivePhysicsRect(this, &this->scale); + // PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + // doStateChange(&StateID_Walk); + // } + // } + // void daMegaGoomba_c::endState_Grow() { + // CleanupKameck(this, Kameck); + // } + + // Grow State + // void daMegaGoomba_c::beginState_Grow() { + // this->timer = 1.0; + + // float start, end, shift1, shift2; + // start = 59.0; + // shift1 = 90.0; + // shift2 = 120.0; + // end = 139.0; + // /* keysX[i] = { frame, value, slope }; */ + // Xkey_count = 7; + // keysX[0] = (HermiteKey){ start, 1.0, 1.0 }; + // keysX[1] = (HermiteKey){ (start+shift1)/2, 2.0, 1.0 }; + // keysX[2] = (HermiteKey){ shift1, 4.0, 1.0 }; + // keysX[3] = (HermiteKey){ (shift1+shift2)/2, 3.0, 1.0 }; + // keysX[3] = (HermiteKey){ shift2, 6.0, 1.0 }; + // keysX[3] = (HermiteKey){ (shift2+end)/2, 5.0, 1.0 }; + // keysX[6] = (HermiteKey){ end, 7.0, 1.0 }; + // } + // void daMegaGoomba_c::executeState_Grow() { + + // this->timer += 1.0; + + // if ((this->timer > 60.0) && (this->timer < 140.0)) { -// float modifier = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); -// this->scale = (Vec){modifier, modifier, modifier}; -// setNewActivePhysicsRect(this, &this->scale); + // float modifier = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); + // this->scale = (Vec){modifier, modifier, modifier}; + // setNewActivePhysicsRect(this, &this->scale); -// } -// if(this->timer == 60.0) -// PlaySound(this, SE_EMY_KURI_CHANGE_BIG); - -// if (this->timer > 170.0) { doStateChange(&StateID_Walk); } - -// } -// void daMegaGoomba_c::endState_Grow() { } + // } + // if(this->timer == 60.0) + // PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + + // if (this->timer > 170.0) { doStateChange(&StateID_Walk); } + + // } + // void daMegaGoomba_c::endState_Grow() { } @@ -477,10 +521,10 @@ void daMegaGoomba_c::updateModelMatrices() { void daMegaGoomba_c::beginState_Shrink() { this->timer = 1.0; Xkey_count = 4; - keysX[0] = (HermiteKey){ 0.0, this->scale.y, 1.0 }; - keysX[1] = (HermiteKey){ 20.0, this->scale.y - 2.0, 1.0 }; - keysX[2] = (HermiteKey){ 40.0, this->scale.y, 1.0 }; - keysX[3] = (HermiteKey){ 59.0, this->scale.y - 2.0, 1.0 }; + keysX[0] = (HermiteKey){ 0.0, this->scale.y, 0.5 }; + keysX[1] = (HermiteKey){ 10.0, this->scale.y - 0.75, 0.5 }; + keysX[2] = (HermiteKey){ 20.0, this->scale.y - 0.35, 0.5 }; + keysX[3] = (HermiteKey){ 39.0, this->scale.y - 0.75, 0.5 }; // disable being hit Vec tempVec = (Vec){0.0, 0.0, 0.0}; @@ -495,7 +539,7 @@ void daMegaGoomba_c::executeState_Shrink() { if(this->timer == 2.0) PlaySound(this, SE_EMY_KURIBO_L_DAMAGE_02); - if (this->timer > 60.0) { doStateChange(&StateID_Walk); } + if (this->timer > 40.0) { doStateChange(&StateID_Walk); } } void daMegaGoomba_c::endState_Shrink() { // enable being hit @@ -616,10 +660,26 @@ void daMegaGoomba_c::executeState_Turn() { this->pos.x = this->last_pos.x; DoStuffAndMarkDead(this, this->pos, 1.0); u16 amt = (this->direction == 0) ? 0x2000 : 0xE000; - int done = SmoothRotation(&this->rot.y, amt, 0x200); + int done = SmoothRotation(&this->rot.y, amt, 0x80); if(done) { this->doStateChange(&StateID_Walk); } + + int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); + if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { + ShakeScreen(StageScreen, 0, 1, 0, 0); + ShakePlayers(this); + PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); + } + + if (isBigBoss) { + if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) + StopPlayerShake(this); + } + else { + if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) + StopPlayerShake(this); + } } void daMegaGoomba_c::endState_Turn() { this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; @@ -661,32 +721,30 @@ void daMegaGoomba_c::executeState_Walk() { } DoStuffAndMarkDead(this, this->pos, 1.0); - if(this->animationChr.isAnimationDone()) { - this->animationChr.setCurrentFrame(0.0); - int Choice = GenerateRandomNumber(6); - switch(Choice) { - case 0: - //doStateChange(&StateID_Jump); - this->speed.y = 5.0 + (1.0 * (life - 2)); - break; - case 1: - doStateChange(&StateID_Launch); - break; - default: - int new_dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, pos); - if(this->direction != new_dir) - doStateChange(&StateID_Turn); - break; - }; - + int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); + if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { + ShakeScreen(StageScreen, 0, 1, 0, 0); + ShakePlayers(this); + PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); } -#if 0 - //if(CollidedWithTile(this->classAt1EC)) { - if( this->collMgr.CollidedWithTile() { + + if (isBigBoss) { + if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) + StopPlayerShake(this); } -#endif + else { + if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) + StopPlayerShake(this); + } + + if(this->animationChr.isAnimationDone()) { + this->animationChr.setCurrentFrame(0.0); + int new_dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, pos); + if(this->direction != new_dir) + doStateChange(&StateID_Turn); + } } void daMegaGoomba_c::endState_Walk() { } @@ -694,35 +752,36 @@ void daMegaGoomba_c::endState_Walk() { } - - /////////////// // Outro State /////////////// - void daMegaGoomba_c::beginState_Outro() { - OutroSetup(this); - } - void daMegaGoomba_c::executeState_Outro() { + // void daMegaGoomba_c::beginState_Outro() { - if (this->dying == 1) { - if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } - if (this->timer == 60) { PlayerVictoryCries(this); } - - this->timer += 1; - return; - } + // OutroSetup(this); + // this->aPhysics.removeFromList(); + // } + // void daMegaGoomba_c::executeState_Outro() { - bool ret; - ret = ShrinkBoss(this, &this->pos, 0.5, this->timer); + // if (this->dying == 1) { - if (ret == true) { - BossExplode(this, &this->pos); - this->dying = 1; - this->timer = 0; - } - else { PlaySound(this, SE_EMY_BIG_KURIBO_DOWN); } + // if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } + // if (this->timer == 60) { PlayerVictoryCries(this); } + + // this->timer += 1; + // return; + // } + + // bool ret; + // ret = ShrinkBoss(this, &this->pos, 1.0, this->timer); + + // if (ret == true) { + // BossExplode(this, &this->pos); + // this->dying = 1; + // this->timer = 0; + // } + // else { PlaySound(this, SE_EMY_BIG_KURIBO_DOWN); } - this->timer += 1; - } - void daMegaGoomba_c::endState_Outro() { } + // this->timer += 1; + // } + // void daMegaGoomba_c::endState_Outro() { } |