diff options
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rwxr-xr-x | include/game.h | 46 | ||||
-rw-r--r-- | kamek_pal.x | 25 | ||||
-rw-r--r-- | meteor.yaml | 10 | ||||
-rw-r--r-- | src/bossFuzzyBear.cpp | 77 | ||||
-rwxr-xr-x | src/meteor.cpp | 118 |
6 files changed, 224 insertions, 53 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index b163f5e..062bb17 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -41,4 +41,5 @@ modules: - processed/effectVideo.yaml - processed/fakeStarCoin.yaml - processed/shyguy.yaml + - processed/meteor.yaml # - processed/actorlog.yaml diff --git a/include/game.h b/include/game.h index e3bbb5f..6412f5e 100755 --- a/include/game.h +++ b/include/game.h @@ -344,6 +344,17 @@ public: };
+class WLClass {
+public:
+ u32 _0;
+ u32 _4;
+ u32 _8;
+ u32 _otherDatum[38];
+
+ static WLClass *instance;
+};
+
+
class dStage32C_c {
public:
@@ -1137,7 +1148,8 @@ public: float lastX, lastY;
Unknown unkArray[4];
float x, y;
- float _88, _8C, _90;
+ float _88, _8C;
+ float diameter;
Vec lastActorPosition;
float _A0, _A4, last_A0, last_A4, _B0, _B4;
u32 _B8;
@@ -1156,7 +1168,7 @@ public: void addToList();
void removeFromList();
- void baseSetup(dActor_c *actor, u32 t_40, u32 t_44, u32 t_48, u8 t_DD, u8 layer);
+ void baseSetup(dActor_c *actor, void *otherCB1, void *otherCB2, void *otherCB3, u8 t_DD, u8 layer);
// note: Scale can be a null pointer (in that case, it'll use 1.0)
void setup(dActor_c *actor,
@@ -1175,7 +1187,7 @@ public: void setupRound(dActor_c *actor,
float x, float y, float radius,
void *otherCB1, void *otherCB2, void *otherCB3,
- u8 t_DD, u8 layer);
+ u8 t_DD, u8 layer, Vec2 *scale = 0);
void setRect(float x1, float y1, float x2, float y2, Vec2 *scale = 0);
void setRect(Vec2 *p1, Vec2 *p2, Vec2 *scale = 0);
@@ -2123,6 +2135,34 @@ public: };
+
+class daKameckDemo : public dEn_c {
+
+public:
+ USING_STATES(daKameckDemo);
+ REF_NINTENDO_STATE(DemoWait);
+ REF_NINTENDO_STATE(DemoSt);
+ REF_NINTENDO_STATE(DemoSt2);
+};
+
+
+class dPlayer : public dActorMultiState_c {
+
+public:
+ USING_STATES(dPlayer);
+ REF_NINTENDO_STATE(None);
+ REF_NINTENDO_STATE(Walk);
+ REF_NINTENDO_STATE(Jump);
+ REF_NINTENDO_STATE(DemoNone);
+ REF_NINTENDO_STATE(DemoWait);
+ REF_NINTENDO_STATE(DemoGoal);
+ REF_NINTENDO_STATE(DemoControl);
+};
+
+
+
+
+
class BgGmBase : public dBase_c {
public:
// TODO, a lot
diff --git a/kamek_pal.x b/kamek_pal.x index 498bcbe..6225b5c 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -47,17 +47,35 @@ SECTIONS { instance__13dCourseFull_c = 0x8042A178; getRectByID__9dCourse_cFUcP5mRect = 0x8008E890; + modifyPlayerPropertiesWithRollingObject = 0x80057820; + /* Boss Related */ StartBGMMusic = 0x807DB420; StopBGMMusic = 0x807DB430; - instance__11dStage32C_c = 0x8043A1F0; + instance__11dStage32C_c = 0x8042A1F0; + instance__7WLClass = 0x80429F74; + createChild__13dStageActor_cF6ActorsP13dStageActor_cUiP7Point3dP6S16VecUc = 0x80064680; + GameMgrBossEndFunc = 0x8001CDB0; + MakeMarioEnterDemoMode = 0x807C7F50; + MakeMarioExitDemoMode = 0x8005CA50; + ResetPlayerState = 0x80052170; + UpdateGameMgr = 0x8001CDB0; + UnsetShit = 0x80056CB0; StateID_DemoSt2__12daKameckDemo = 0x80999C04; StateID_DemoSt__12daKameckDemo = 0x80999C44; StateID_DemoWait__12daKameckDemo = 0x80999C84; + StateID_None__7dPlayer = 0x8035451C; + StateID_Walk__7dPlayer = 0x8035455C; + StateID_Jump__7dPlayer = 0x8035459C; + StateID_DemoNone__7dPlayer = 0x8035499C; + StateID_DemoWait__7dPlayer = 0x80354A1C; + StateID_DemoGoal__7dPlayer = 0x80354DDC; + StateID_DemoControl__7dPlayer = 0x80354E1C; + /* Mr Sun Related */ @@ -542,8 +560,13 @@ SECTIONS { __ct__7PhysicsFv = 0x8007F7A0; __dt__7PhysicsFv = 0x8007F810; + baseSetup__7PhysicsFP8dActor_cPvPvPvUcUc = 0x8007F9B0; setup__7PhysicsFP8dActor_cffffPvPvPvUcUcP7Point2d = 0x8007FA40; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10; + + spinningPhysicsCallback = 0x808A2380; + /* spinningPhysicsCallback__7Physics = 0x808A2380; */ + addToList__7PhysicsFv = 0x8007F900; removeFromList__7PhysicsFv = 0x8007F950; update__7PhysicsFv = 0x8007FDA0; diff --git a/meteor.yaml b/meteor.yaml new file mode 100644 index 0000000..765d350 --- /dev/null +++ b/meteor.yaml @@ -0,0 +1,10 @@ +--- +# Replaces EN_TARZANROPE + +source_files: [../src/meteor.cpp] +hooks: + - name: BuildMeteor + type: add_func_pointer + src_addr_pal: 0x80B0A940 + target_func: 'dMeteor::build(void)' + 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); +} + + |