diff options
author | Treeki <treeki@gmail.com> | 2012-12-04 01:36:13 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-12-04 01:36:13 +0100 |
commit | 49fe08ecf61e59fe13bef6a50fffd119e8909e64 (patch) | |
tree | 725917681502b33988d41db3f4b9c426a46ab9f6 /src/bossMegaGoomba.cpp | |
parent | 4dab891a526d909dd51523f3d3173c3184ec7705 (diff) | |
download | kamek-49fe08ecf61e59fe13bef6a50fffd119e8909e64.tar.gz kamek-49fe08ecf61e59fe13bef6a50fffd119e8909e64.zip |
cleaned up gigoomba code a bit
Diffstat (limited to '')
-rw-r--r-- | src/bossMegaGoomba.cpp | 303 |
1 files changed, 11 insertions, 292 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index cd20c4d..2dcc3d7 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -70,19 +70,12 @@ class daMegaGoomba_c : public dEn_c { void removeMyActivePhysics(); void addMyActivePhysics(); - // bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); - // bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); -// bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); - -// bool stageActorCollision(ActivePhysics *apThis, ActivePhysics *apOther); void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); void playerCollision(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 collisionCat3_StarPower(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); @@ -100,15 +93,9 @@ class daMegaGoomba_c : public dEn_c { void dieOther_End(); USING_STATES(daMegaGoomba_c); - // DECLARE_STATE(Grow); DECLARE_STATE(Shrink); DECLARE_STATE(Walk); DECLARE_STATE(Turn); - // DECLARE_STATE(Jump); - // DECLARE_STATE(Launch); - - // DECLARE_STATE(Kameck); - // DECLARE_STATE(Outro); }; @@ -146,36 +133,17 @@ void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) { actor->adjacentSensor.x = s32((amtX * 32.0f) * 4096.0f); actor->adjacentSensor.y = s32((amtY * 22.0f) * 4096.0f); - // 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.0f; - info.yDistToCenter = 57.0f * amtY; - info.xDistToEdge = 14.0f * amtX; - info.yDistToEdge = 32.0f * 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; - - /*actor->aPhysics.trpValue0 = amtX * -12.0f; - actor->aPhysics.trpValue1 = amtX * 12.0f; - actor->aPhysics.trpValue2 = amtX * -48.0f; - actor->aPhysics.trpValue3 = amtX * 48.0f;*/ + u8 cat1 = 3, cat2 = 0, bitfield1 = 0x6f, bitfield2 = 0xffbafffe; + ActivePhysics::Info info = { + 0.0f, amtY*57.0f, amtX*14.0f, amtY*31.0f, + cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->aPhysics.initWithStruct(actor, &info); // Original trapezium was -12,12 to -48,48 ActivePhysics::Info left = { amtX*-28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, - 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; + cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->leftTrapAPhysics.initWithStruct(actor, &left); actor->leftTrapAPhysics.trpValue0 = amtX * 14.0f; actor->leftTrapAPhysics.trpValue1 = amtX * 14.0f; @@ -185,7 +153,7 @@ void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) { ActivePhysics::Info right = { amtX*28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, - 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; + cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->rightTrapAPhysics.initWithStruct(actor, &right); actor->rightTrapAPhysics.trpValue0 = amtX * -14.0f; actor->rightTrapAPhysics.trpValue1 = amtX * -14.0f; @@ -195,7 +163,7 @@ void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) { ActivePhysics::Info stalk = { 0.0f, amtY*12.0f, amtX*28.0f, amtY*12.0f, - 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; + cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->stalkAPhysics.initWithStruct(actor, &stalk); } @@ -207,13 +175,9 @@ extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); -// CREATE_STATE(daMegaGoomba_c, Grow); CREATE_STATE(daMegaGoomba_c, Shrink); 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;) @@ -281,16 +245,12 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth //char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); -// OSReport("I hate my life: %d\n", ret); if(ret == 1) { // regular jump apOther->someFlagByte |= 2; if(this->takeHit(1)) { // kill me VEC2 eSpeed = {speed.x, speed.y}; - OSReport("I'M DYING\n"); - OSReport("State: %s\n", acState.getCurrentState()->getName()); killWithSpecifiedState(apOther->owner, &eSpeed, &dEn_c::StateID_DieOther); - OSReport("State: %s\n", acState.getCurrentState()->getName()); } } else if(ret == 3) { // spinning apOther->someFlagByte |= 2; @@ -302,28 +262,16 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth } else if(ret == 2) { } else { } - - //this->flags_4FC |= (1<<(31-7)); } 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->flags_4FC |= (1<<(31-7)); } 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) { 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); @@ -404,11 +352,6 @@ void daMegaGoomba_c::setupCollision() { this->_518 = 2; - this->aPhysics.info.xDistToCenter = 0.0; - this->aPhysics.info.yDistToCenter = 12.0; - this->aPhysics.info.xDistToEdge = 14.0; - this->aPhysics.info.yDistToEdge = 12.0; - //NOT NEEDED //this->doStateChange(&StateID_Walk); } @@ -424,30 +367,9 @@ int daMegaGoomba_c::onCreate() { isBigBoss = this->settings & 0xF; this->animationChr.setCurrentFrame(69.0); - ActivePhysics::Info hm; - hm.xDistToCenter = 0.0; - hm.yDistToCenter = 8.0; - hm.xDistToEdge = 12.0; - hm.yDistToEdge = 12.0; - hm.category1 = 0x3; - hm.category2 = 0x0; - hm.bitfield1 = 0x6f; - hm.bitfield2 = 0xffbafffe; - hm.unkShort1C = 0; - hm.callback = &dEn_c::collisionCallback; - this->aPhysics.initWithStruct(this, &hm); - this->aPhysics.addToList(); - - ActivePhysics::Info stalk = { - 0.0f, 24.0f, 32.0f, 22.0f, - 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback}; - stalkAPhysics.initWithStruct(this, &stalk); + aPhysics.addToList(); stalkAPhysics.addToList(); - - // for dummy purposes, we'll replace the info later - leftTrapAPhysics.initWithStruct(this, &stalk); leftTrapAPhysics.addToList(); - rightTrapAPhysics.initWithStruct(this, &stalk); rightTrapAPhysics.addToList(); this->_120 |= 0x200; @@ -472,9 +394,9 @@ int daMegaGoomba_c::onCreate() { // doStateChange(&StateID_Grow); - scale.x = 4.0; - scale.y = 4.0; - scale.z = 4.0; + scale.x = 4.0f; + scale.y = 4.0f; + scale.z = 4.0f; setNewActivePhysicsRect(this, &this->scale); doStateChange(&StateID_Walk); @@ -487,17 +409,9 @@ int daMegaGoomba_c::onDelete() { } int daMegaGoomba_c::onExecute() { - // what state am I in? -// OSReport("State for %p: %s\n", this, acState.getCurrentState()->getName()); //80033450 acState.execute(); - //if(CheckSomethingEnemyRelated()) // checks class1EC bitfield - // sub_80033f10(this); // spawn hit effect and play hit sound - //else - // dStageActor_c__checkZoneBoundaries(this, 0); - //// dont do updateModelMatrices //// checkZoneBoundaries(0); - updateModelMatrices(); return true; @@ -505,11 +419,6 @@ int daMegaGoomba_c::onExecute() { int daMegaGoomba_c::onDraw() { bodyModel.scheduleForDrawing(); - - //DONT DO REST HERE// -#if 0 - bodyModel._vf1C(); -#endif return true; } @@ -524,71 +433,6 @@ void daMegaGoomba_c::updateModelMatrices() { bodyModel.calcWorld(false); } -/////////////// -// Grow State -/////////////// - // 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, 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); - - // } - // 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() { } - - // Shrink State @@ -623,96 +467,6 @@ void daMegaGoomba_c::endState_Shrink() { -// Launch State - Launches some small goombas up in arcs - // void daMegaGoomba_c::beginState_Launch() { - // this->timer = 0.0; - // rot.y = 0x0; - // } - // void daMegaGoomba_c::executeState_Launch() { - - // if (this->timer < 120.0) { - // // 3 shakes per second, exactly 24 shakes overall - // this->rot.y = sin(this->timer * 3.14 / 5) * 4000; - - // dStageActor_c *spawner = NULL; - // // 120ticks / 120numbers * 3cases = 3avg kuribo - // int randChoice = GenerateRandomNumber(120); - // int randChoiceX = GenerateRandomNumber(10); - // int randChoiceY = GenerateRandomNumber(7); - // switch(randChoice) { - // case 0: - // case 1: - // spawner = CreateActor(EN_KURIBO, 0, this->pos, 0, 0); - // spawner->speed.x = randChoiceX - 5.0; - // spawner->speed.y = randChoiceY + 6.0; - // spawner->scale = (Vec){1.0, 1.0, 1.0}; - // break; - // case 2: - // spawner = CreateActor(EN_BEANS_KURIBO, 0, this->pos, 0, 0); - // spawner->speed.x = randChoiceX - 5.0; - // spawner->speed.y = randChoiceY + 6.0; - // spawner->scale = (Vec){1.0, 1.0, 1.0}; - // break; - // case 3: - // spawner = CreateActor(EN_PATA_KURIBO, 0, this->pos, 0, 0); - // spawner->speed.x = randChoiceX - 5.0; - // spawner->speed.y = randChoiceY + 6.0; - // spawner->scale = (Vec){1.0, 1.0, 1.0}; - // break; - // default: - // break; - // }; - // } - - // if (this->timer > 150.0) { doStateChange(&StateID_Walk); } - // this->timer = this->timer + 1.0; - // } - // void daMegaGoomba_c::endState_Launch() { - // //rot.y = (this->direction) ? 0xe000 : 0x2000; - // } - -// Jump State - // void daMegaGoomba_c::beginState_Jump() { - // this->timer = 1.0; - - // //Variables for choosing a curve - // float jump_height = this->JumpHeight; - // float delta = (this->direction) ? -JumpDist : JumpDist; - // float fullTime = this->JumpTime; - // //Key count - // Xkey_count = 2; - // Ykey_count = 3; - - // //Initial Position - // keysX[0] = (HermiteKey){ 0.0, this->pos.x, 0.0 }; - // keysY[0] = (HermiteKey){ 0.0, this->pos.y, 0.8 }; - - // //Middle Position - // keysY[1] = (HermiteKey){ (fullTime/2.0), this->pos.y + jump_height, 0.0 }; - - // //End Position - // keysX[1] = (HermiteKey){ fullTime, this->pos.x + delta, 0.0 }; - // keysY[2] = (HermiteKey){ fullTime, this->pos.y, 0.8 }; - - // // using this to stop walk animation - // this->animationChr.setCurrentFrame(900.0); - // } - // void daMegaGoomba_c::executeState_Jump() { - - // this->pos.x = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); - // this->pos.y = GetHermiteCurveValue(this->timer, this->keysY, Ykey_count); - - // float TimerMax = JumpTime + 1.0; - // if (this->timer > TimerMax) { - // doStateChange(&StateID_Walk); - // } - - // this->timer = this->timer + 1.0; - - // } - // void daMegaGoomba_c::endState_Jump() { } - - // Turn State void daMegaGoomba_c::beginState_Turn() { this->direction ^= 1; @@ -824,41 +578,6 @@ void daMegaGoomba_c::endState_Walk() { } -/////////////// -// Outro State -/////////////// - // void daMegaGoomba_c::beginState_Outro() { - - // OutroSetup(this); - // this->aPhysics.removeFromList(); - // } - // 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, 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() { } - - - extern "C" void stunPlayer(void *, int); extern "C" void unstunPlayer(void *); |