diff options
Diffstat (limited to 'src/bossMegaGoomba.cpp')
-rw-r--r-- | src/bossMegaGoomba.cpp | 186 |
1 files changed, 123 insertions, 63 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index e353c23..42ff2d4 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -2,32 +2,33 @@ #include <game.h> #include <g3dhax.h> #include <sfx.h> +#include "boss.h" //Enable this if you're fixing it -// void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { -// float amtX = scale->x; -// float amtY = scale->y; - -// ActivePhysics::Info info; -// info.xDistToCenter = 0.0; -// info.yDistToCenter = 7.65 * amtY; -// info.xDistToEdge = 4.0 * amtX; -// info.yDistToEdge = 7.7 * amtY; - -// info.category1 = actor->aPhysics.info.category1; -// info.category2 = actor->aPhysics.info.category2; -// info.bitfield1 = actor->aPhysics.info.bitfield1; -// info.bitfield2 = actor->aPhysics.info.bitfield2; -// info.unkShort1C = actor->aPhysics.info.unkShort1C; -// info.callback = actor->aPhysics.info.callback; - -// //OSReport("Making new Physics Class and adding to the list\n"); -// actor->aPhysics.removeFromList(); -// actor->aPhysics.initWithStruct(actor, &info); -// actor->aPhysics.addToList(); -// } - -class daMegaGoomba_c : public dEn_c { +void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { + float amtX = scale->x; + float amtY = scale->y; + + ActivePhysics::Info info; + info.xDistToCenter = 0.0; + info.yDistToCenter = 7.65 * amtY; + info.xDistToEdge = 4.0 * amtX; + info.yDistToEdge = 7.7 * amtY; + + info.category1 = actor->aPhysics.info.category1; + info.category2 = actor->aPhysics.info.category2; + info.bitfield1 = actor->aPhysics.info.bitfield1; + info.bitfield2 = actor->aPhysics.info.bitfield2; + info.unkShort1C = actor->aPhysics.info.unkShort1C; + info.callback = actor->aPhysics.info.callback; + + //OSReport("Making new Physics Class and adding to the list\n"); + actor->aPhysics.removeFromList(); + actor->aPhysics.initWithStruct(actor, &info); + actor->aPhysics.addToList(); +} + +class daMegaGoomba_c : public daBoss { int onCreate(); int onDelete(); int onExecute(); @@ -99,6 +100,9 @@ class daMegaGoomba_c : public dEn_c { DECLARE_STATE(Turn); DECLARE_STATE(Jump); DECLARE_STATE(Launch); + + DECLARE_STATE(Kameck); + DECLARE_STATE(Outro); }; u8 struct_1[] = { 0, 0, 0, 1, 0xff, 0xff, 0x40, 0, 0, 0, 0xc0, 0, 0, 0, 0, 0 }; @@ -137,15 +141,8 @@ void HexDump(char* address, u32 length) { } -extern "C" void *PlaySound(daMegaGoomba_c *, int soundID); - -extern "C" u32 GenerateRandomNumber(int max); -extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daMegaGoomba_c *, Vec pos); -extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); -extern "C" dStageActor_c *GetSpecificPlayerActor(int number); //FIXME make this dEn_c->used... -extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); extern "C" int SomeStrangeModification(dStageActor_c* actor); extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); @@ -459,44 +456,70 @@ void daMegaGoomba_c::updateModelMatrices() { bodyModel.calcWorld(false); } - +/////////////// // Grow State -void daMegaGoomba_c::beginState_Grow() { - this->timer = 1.0; +/////////////// + void daMegaGoomba_c::beginState_Grow() { + this->timer = 0; + + SetupKameck(this, Kameck); + } + + 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); + } - 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() { + +// 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; +// this->timer += 1.0; - if ((this->timer > 60.0) && (this->timer < 140.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 == 60.0) +// PlaySound(this, SE_EMY_KURI_CHANGE_BIG); - if (this->timer > 170.0) { doStateChange(&StateID_Walk); } +// if (this->timer > 170.0) { doStateChange(&StateID_Walk); } -} -void daMegaGoomba_c::endState_Grow() { } +// } +// void daMegaGoomba_c::endState_Grow() { } + + // Shrink State @@ -510,7 +533,7 @@ void daMegaGoomba_c::beginState_Shrink() { // disable being hit Vec tempVec = (Vec){0.0, 0.0, 0.0}; - // setNewActivePhysicsRect(this, &tempVec ); + setNewActivePhysicsRect(this, &tempVec ); } void daMegaGoomba_c::executeState_Shrink() { this->timer += 1.0; @@ -525,7 +548,7 @@ void daMegaGoomba_c::executeState_Shrink() { } void daMegaGoomba_c::endState_Shrink() { // enable being hit - // setNewActivePhysicsRect(this, &this->scale); + setNewActivePhysicsRect(this, &this->scale); this->already_hit = false; } @@ -718,3 +741,40 @@ void daMegaGoomba_c::executeState_Walk() { } void daMegaGoomba_c::endState_Walk() { } + + + + + + + +/////////////// +// Outro State +/////////////// + void daMegaGoomba_c::beginState_Outro() { + OutroSetup(this); + } + void daMegaGoomba_c::executeState_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; + } + + bool ret; + ret = ShrinkBoss(this, &this->pos, 0.5, 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() { } + |