diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-02-29 14:43:35 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-02-29 14:43:35 -0600 |
commit | 3f22b00986d9fe2ebc0b596235b9093a96720614 (patch) | |
tree | 7c4d1817b7a1e987e16a07ba8d54aac90e47375a /src | |
parent | 9884b4841032f85c3a94cb5854b244b1235683b0 (diff) | |
download | kamek-3f22b00986d9fe2ebc0b596235b9093a96720614.tar.gz kamek-3f22b00986d9fe2ebc0b596235b9093a96720614.zip |
Added meteor, changes to fuzzybear intro (now complete), some header tweaks
Diffstat (limited to 'src')
-rw-r--r-- | src/bossFuzzyBear.cpp | 77 | ||||
-rwxr-xr-x | src/meteor.cpp | 118 |
2 files changed, 146 insertions, 49 deletions
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index f22cf6c..b13955c 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -7,15 +7,6 @@ #include "player.h" -class daKameckDemo : public dEn_c { - -public: - USING_STATES(daKameckDemo); - REF_NINTENDO_STATE(DemoWait); - REF_NINTENDO_STATE(DemoSt); - REF_NINTENDO_STATE(DemoSt2); -}; - class daFuzzyBear_c : public dEn_c { int onCreate(); int onDelete(); @@ -83,11 +74,15 @@ extern "C" void *StopSound(int soundID); 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(daFuzzyBear_c *, Vec pos); -extern "C" dStageActor_c *GetSpecificPlayerActor(int number); +extern "C" dStageActor_c *GetSpecificPlayerActor(int num); extern "C" void *StopBGMMusic(); extern "C" void *StartBGMMusic(); +extern "C" void *MakeMarioEnterDemoMode(); +extern "C" void *MakeMarioExitDemoMode(); +extern "C" void *UpdateGameMgr(); + CREATE_STATE(daFuzzyBear_c, Grow); CREATE_STATE(daFuzzyBear_c, Bounce); @@ -311,33 +306,6 @@ void daFuzzyBear_c::updateModelMatrices() { } -// How to Start the Level, by Tempus -// -// Turn off the BGM (0x808B1670 ?) -// Store 1 to PointerToStage32C @ 0x15C - This should freeze Mario -// -// Spawn sprite 0x1E as a child actor - You'll need to tweak the position just right! -// It has three states - DemoWait, DemoSt, DemoSt2 - You'll need to trigger them by setting them with the REF_NINTENDO_STATE macro -// Make sure to get the timing right! -// You might also want to use RemoveUnwantedFireballsAndOtherMarioShit. I dunno. -// -// Store 0 to PointerToStage32C @ 0x15C - This should unfreeze Mario -// Start The BGM again (0x808B1680 ?) -// -// -// How to end the Level, by Tempus -// -// Turn off the BGM (0x808B1670 ?) -// -// Store 1 to PointerToStage32C @ 0x15C - This should freeze Mario -// Do the necessary shrinking actions and effect junk -// Do the Mario animation and play the victory sound? -// End the stage with WORLD_MAP, 0, 0, 4 -// -// -// - - // Grow State void daFuzzyBear_c::beginState_Grow() { @@ -347,9 +315,16 @@ void daFuzzyBear_c::beginState_Grow() { OSReport("Stopping the Music.\n"); StopBGMMusic(); - OSReport("Setting the boss flag.\n"); - // dStage32C_c::instance->freezeMarioBossFlag = 1; -// Store 1 to PointerToStage32C @ 0x15C - This should freeze Mario - But it doesn't. Must do something though, right? + OSReport("Setting the boss flag. %p\n", dStage32C_c::instance); + OSReport("Boss flag is; %d\n", dStage32C_c::instance->freezeMarioBossFlag); + 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"); Vec pos = (Vec){this->pos.x - 124.0, this->pos.y + 104.0, 3564.0}; @@ -415,11 +390,11 @@ void daFuzzyBear_c::endState_Grow() { this->Baseline = this->pos.y; OSReport("Ending boss flag.\n"); - // dStage32C_c::instance->freezeMarioBossFlag = 0; + dStage32C_c::instance->freezeMarioBossFlag = 0; + WLClass::instance->_8 = 1; - // Store 0 to PointerToStage32C @ 0x15C - This should unfreeze Mario + MakeMarioExitDemoMode(); - // PlaySound(this, STRM_BGM_TORIDE_BOSS); OSReport("Ending BGMusic.\n"); StartBGMMusic(); @@ -798,11 +773,16 @@ void daFuzzyBear_c::endState_Wait() { } void daFuzzyBear_c::beginState_Outro() { + MakeMarioEnterDemoMode(); + + WLClass::instance->_4 = 5; + WLClass::instance->_8 = 0; + this->removeMyActivePhysics(); this->timer = 0; StopBGMMusic(); - // Store 1 to PointerToStage32C @ 0x15C - This should freeze Mario - // dStage32C_c::instance->freezeMarioBossFlag = 1; + + dStage32C_c::instance->freezeMarioBossFlag = 1; } void daFuzzyBear_c::executeState_Outro() { @@ -814,6 +794,8 @@ void daFuzzyBear_c::executeState_Outro() { if (this->timer == 60) { + UpdateGameMgr(); + if (GetSpecificPlayerActor(0) != 0) { PlaySound(this, SE_VOC_MA_CLEAR_BOSS); // Send PlBase into DemoGoal State here, kthxbai @@ -867,11 +849,8 @@ void daFuzzyBear_c::executeState_Outro() { this->timer = 0; PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); - - this->timer += 1; + MakeMarioEnterDemoMode(); } - - } void daFuzzyBear_c::endState_Outro() { } diff --git a/src/meteor.cpp b/src/meteor.cpp new file mode 100755 index 0000000..85b1358 --- /dev/null +++ b/src/meteor.cpp @@ -0,0 +1,118 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> + +class dMeteor : public dStageActor_c { + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static dMeteor *build(); + + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + nw4r::g3d::ResFile resFile; + + int timer; + int spinSpeed; + char spinDir; + + Physics MakeItRound; + + void updateModelMatrices(); +}; + +dMeteor *dMeteor::build() { + void *buffer = AllocFromGameHeap1(sizeof(dMeteor)); + return new(buffer) dMeteor; +} + + +// extern "C" dStageActor_c *GetSpecificPlayerActor(int num); +// extern "C" void *modifyPlayerPropertiesWithRollingObject(dStageActor_c *Player, float _52C); +extern "C" void *spinningPhysicsCallback(); + + +int dMeteor::onCreate() { + + // Setup Model + allocator.link(-1, GameHeaps[0], 0, 0x20); + + this->resFile.data = getResource("kazan_rock", "g3d/kazan_rock.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kazan_rock"); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); + + allocator.unlink(); + + + // Retrieve Scale and set it up + float sca = (float)((this->settings >> 8) & 0xFF); + sca = (sca/5.0) + 0.2; + + this->scale = (Vec){sca,sca,sca}; + + // Other settings + this->spinDir = this->settings & 0x1; + this->spinSpeed = ((this->settings >> 16) & 0xFF) * 4; + + // Setup Physics + MakeItRound.baseSetup(this, &spinningPhysicsCallback, 0, 0, 1, 1); + + MakeItRound.x = 0.0; + MakeItRound.y = 0.0; + + MakeItRound.diameter = 160.0 * sca; + MakeItRound.isRound = 1; + + MakeItRound.update(); + + MakeItRound.addToList(); + + this->pos.z = -3458.0; + + this->onExecute(); + return true; +} + +int dMeteor::onDelete() { + return true; +} + +int dMeteor::onExecute() { + + if (spinDir == 0) { rot.z -= spinSpeed; } + else { rot.z += spinSpeed; } + + MakeItRound.update(); + updateModelMatrices(); + + // 518 == opposite of direction + + // for (i=0; i<4; i++) { + // dStageActor_c *player = GetSpecificPlayerActor(i); + // modifyPlayerPropertiesWithRollingObject(player, ); + // } + + return true; +} + +int dMeteor::onDraw() { + + bodyModel.scheduleForDrawing(); + bodyModel._vf1C(); + return true; +} + +void dMeteor::updateModelMatrices() { + // This won't work with wrap because I'm lazy. + matrix.translation(pos.x, pos.y, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); +} + + |