diff options
Diffstat (limited to 'src/levelspecial.cpp')
-rw-r--r-- | src/levelspecial.cpp | 172 |
1 files changed, 19 insertions, 153 deletions
diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index adadc50..25e2130 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -17,11 +17,12 @@ struct LevelSpecial { u8 effect; // 0x3D5 u8 lastEvState; // 0x3D6 u8 func; // 0x3D7 + u32 keepTime; + u32 setTime; }; extern u16 TimeStopFlag; -extern u32 TimerBranch; extern u32 AlwaysDrawFlag; extern u32 AlwaysDrawBranch; @@ -38,6 +39,10 @@ extern char SizerOn; extern char ZOrderOn; extern int GlobalStarsCollected; +extern u32 GameTimer; + +#define time *(u32*)((GameTimer) + 0x4) + float GlobalSizeFloatModifications [] = {1, 0.25, 0.5, 0.75, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 6, 7, 8, 10 }; float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5}; @@ -56,7 +61,6 @@ fBase_c *FindActorByID(u32 id); bool ResetAfterLevel(void) { // TimeStopFlag = 0; - TimerBranch = 0x3403FFA4; MarioDescentRate = -4; MarioJumpMax = 3.628; MarioJumpArc = 2.5; @@ -77,11 +81,12 @@ bool LevelSpecial_Create(LevelSpecial *self) { char eventNum = (self->settings >> 24) & 0xFF; self->eventFlag = (u64)1 << (eventNum - 1); - + self->keepTime = 0; self->type = (self->settings) & 15; self->effect = (self->settings >> 4) & 15; - + self->setTime = (self->settings >> 8) & 0xFFFF; + self->lastEvState = 0xFF; LevelSpecial_Update(self); @@ -90,6 +95,9 @@ bool LevelSpecial_Create(LevelSpecial *self) { } bool LevelSpecial_Execute(LevelSpecial *self) { + if (self->keepTime > 0) { + time = self->keepTime; } + LevelSpecial_Update(self); return true; } @@ -116,7 +124,7 @@ void LevelSpecial_Update(LevelSpecial *self) { // break; case 2: // Stop Timer - TimerBranch = 0x7C601B78; + self->keepTime = time; break; @@ -137,81 +145,9 @@ void LevelSpecial_Update(LevelSpecial *self) { } break; -// case 4: // Mario Size -// dAc_Py_c *Mario; -// if (self->effect == 0) //Super Size -// { -// MarioSize = 4.0; - -// for(int n=0; n<4; n++) { -// OSReport("Changing Physics for Player %d\n", n); -// Mario = GetSpecificPlayerActor(n); -// OSReport("Player Actor at %08x\n", Mario); -// if(Mario == 0) -// continue; -// // Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter * 4.0; -// // Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge * 4.0; -// // Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter * 4.0; -// // Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge * 4.0; -// // -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter * 4.0; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge * 4.0; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter * 4.0; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter * 4.0; -// // Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge * 4.0; -// // Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter * 4.0; -// // Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter * 4.0; -// // Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge * 4.0; -// // Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter * 4.0; -// // Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter * 4.0; -// // Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge * 4.0; -// // Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter * 4.0; -// // Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge * 4.0; -// } -// } - - -// else //Half-Pint -// { -// MarioSize = 0.25; - -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter * 0.25; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge * 0.25; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter * 0.25; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge * 0.25; - -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter * 0.25; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge * 0.25; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter * 0.25; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge * 0.25; - -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter * 0.25; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge * 0.25; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter * 0.25; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge * 0.25; - -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter * 0.25; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge * 0.25; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter * 0.25; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge * 0.25; - -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter * 0.25; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge * 0.25; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter * 0.25; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge * 0.25; -// } -// } -// break; + case 4: // Set Time + time = (self->setTime << 0xC) - 1; // Possibly - 0xFFF? + break; case 5: // Global Enemy Size @@ -258,7 +194,7 @@ void LevelSpecial_Update(LevelSpecial *self) { // break; case 2: // Stop Timer - TimerBranch = 0x3403FFA4; + self->keepTime = 0; break; @@ -269,78 +205,8 @@ void LevelSpecial_Update(LevelSpecial *self) { MarioJumpMax = 3.628; break; - // case 4: // Mario Size - // dAc_Py_c *Mario; -// if (self->effect == 0) //Super Size -// { -// MarioSize = 4.0; -// -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter / 4.0; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge / 4.0; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter / 4.0; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge / 4.0; -// -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter / 4.0; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge / 4.0; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter / 4.0; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge / 4.0; -// -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter / 4.0; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge / 4.0; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter / 4.0; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge / 4.0; -// -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter / 4.0; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge / 4.0; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter / 4.0; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge / 4.0; -// -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter / 4.0; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge / 4.0; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter / 4.0; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge / 4.0; -// } -// } -// -// else //Half-Pint -// { -// MarioSize = 0.25; -// -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter / 0.25; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge / 0.25; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter / 0.25; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge / 0.25; -// -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter / 0.25; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge / 0.25; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter / 0.25; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge / 0.25; -// -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter / 0.25; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge / 0.25; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter / 0.25; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge / 0.25; -// -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter / 0.25; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge / 0.25; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter / 0.25; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge / 0.25; -// -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter / 0.25; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge / 0.25; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter / 0.25; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge / 0.25; -// } -// } - // break; + case 4: // Mario Size + break; case 5: // Global Enemy Size SizerOn = 0; |