diff options
Diffstat (limited to '')
-rwxr-xr-x | src/growup.s | 143 | ||||
-rw-r--r-- | src/levelspecial.cpp | 148 | ||||
-rwxr-xr-x | src/spritespawner.cpp | 36 |
3 files changed, 310 insertions, 17 deletions
diff --git a/src/growup.s b/src/growup.s index 724ee4c..b8d8922 100755 --- a/src/growup.s +++ b/src/growup.s @@ -1113,6 +1113,140 @@ LakituBomb: +.global GlobalZOrderDeath +GlobalZOrderDeath: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalZorder + + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f8, 0(r11) + stfs f8, 0xB4(r28) + stfs f8, 0xC(r1) + + mtlr r0 + addi r1, r1, 0x60 + blr + +NormalZorder: + mtlr r0 + addi r1, r1, 0x60 + blr + + +.global PokeyZOrderDeath +PokeyZOrderDeath: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalPokeyZorder + + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f0, 0(r11) + stfs f0, 0xB4(r31) + + lwz r0, 0x5D0(r31) + blr + +NormalPokeyZorder: + lwz r0, 0x5D0(r31) + blr + + +.global PokeyZOrderDeathFreeze +PokeyZOrderDeathFreeze: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalPokeyZorderFreeze + + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f0, 0(r11) + stfs f0, 0xB4(r3) + + lwz r0, 0x604(r3) + blr + +NormalPokeyZorderFreeze: + lwz r0, 0x604(r3) + blr + + +.global PokeyZOrderDamage +PokeyZOrderDamage: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalPokeyZorderDamage + + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f0, 0(r11) + stfs f0, 0xB4(r31) + + mr r3, r31 + blr + +NormalPokeyZorderDamage: + mr r3, r31 + blr + + +.global GabonRockZOrderDeath +GabonRockZOrderDeath: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalGabonRockZorder + + stfs f0, 0xE8(r3) + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f0, 0(r11) + stfs f0, 0xB4(r3) + blr + +NormalGabonRockZorder: + stfs f0, 0xE8(r3) + blr + + +.global GabonRockZOrderDeathDrop +GabonRockZOrderDeathDrop: + + lis r10, ZOrderOn@h + ori r10, r10, ZOrderOn@l + lbz r10, 0(r10) + cmpwi r10, 0 + beq NormalGabonRockZorderDrop + + mr r31, r3 + lis r11, InFront@h + ori r11, r11, InFront@l + lfs f0, 0(r11) + stfs f0, 0xB4(r31) + blr + +NormalGabonRockZorderDrop: + mr r31, r3 + blr + + + .data .global GlobalSpriteSize @@ -1133,6 +1267,12 @@ SizerOn: .align 4 +.global ZOrderOn +ZOrderOn: + .byte 0 + +.align 4 + LookupTable: .float 1, 1, 1, 1, 0.25, 0.5, 0.75, 1.25, 1.5, 2, 2.5, 3, 4, 5, 8, 10 @@ -1142,6 +1282,9 @@ RiderLookupTable: PiranhaPosF: .float 4.0 +InFront: + .float 5500.0 + ConvertFloat: .word 0x43300000,0x0,0x43300000,0x80000000 diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index 5fd900d..7ad69ff 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -23,7 +23,7 @@ struct EventTable_t { u64 events;
// ...
};
-
+ extern EventTable_t *EventTable;
extern u16 TimeStopFlag; @@ -41,6 +41,7 @@ extern float GlobalSpriteSize; extern float GlobalSpriteSpeed; extern float GlobalRiderSize; extern char SizerOn; +extern char ZOrderOn; 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 }; @@ -48,7 +49,7 @@ float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25, -extern "C" void GetSpecificPlayerActor(int number); +extern "C" dAc_Py_c *GetSpecificPlayerActor(int number); void LevelSpecial_Update(LevelSpecial *self);
bool ResetAfterLevel(); @@ -73,6 +74,7 @@ bool ResetAfterLevel(void) { SizerOn = 0; AlwaysDrawFlag = 0x9421FFF0; AlwaysDrawBranch = 0x7C0802A6; + ZOrderOn = 0; return true;
}
@@ -146,10 +148,74 @@ 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); +// 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); + 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; @@ -178,7 +244,10 @@ void LevelSpecial_Update(LevelSpecial *self) { } break; - + case 7: // Z Order Hack + ZOrderOn = 1; + break; + default: break; } @@ -207,7 +276,74 @@ void LevelSpecial_Update(LevelSpecial *self) { break; case 4: // Mario Size - MarioSize = 1.0; + 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); +// 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); +// 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 5: // Global Enemy Size @@ -228,6 +364,10 @@ void LevelSpecial_Update(LevelSpecial *self) { AlwaysDrawBranch = 0x7C0802A6; break; + case 7: // Z Order Hack + ZOrderOn = 0; + break; + default: break; } diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp index 7468bbb..911ae8a 100755 --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -15,7 +15,8 @@ struct SpriteSpawner { u64 eventFlag; // 0x3D0
u16 type; // 0x3D4
u32 inheritSet; // 0x3D6
- u8 lastEvState; // 0x3DA
+ u8 lastEvState; // 0x3DA + dStageActor_c *createdActor;
};
struct EventTable_t {
@@ -31,7 +32,7 @@ struct VEC { extern EventTable_t *EventTable;
-extern "C" void CreateActor(u16 classID, int settings, VEC pos, char rot, char layer); +extern "C" dStageActor_c *CreateActor(u16 classID, int settings, VEC pos, char rot, char layer); void SpriteSpawner_Update(SpriteSpawner *self);
@@ -60,7 +61,6 @@ bool SpriteSpawner_Create(SpriteSpawner *self) { }
bool SpriteSpawner_Execute(SpriteSpawner *self) {
- OSReport("Events: %08x%08x", EventTable->events >> 32, EventTable->events & 0xFFFFFFFF);
SpriteSpawner_Update(self);
return true;
}
@@ -72,15 +72,25 @@ void SpriteSpawner_Update(SpriteSpawner *self) { { // Put an action for when the event turns on here - VEC pos; - pos.x = self->x; - pos.y = self->y; - pos.z = self->z; - - OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z);
- - CreateActor(self->type, self->inheritSet, pos, 0, 0); - - EventTable->events = EventTable->events & ~self->eventFlag; + if (self->createdActor == 0) + { + VEC pos; + pos.x = self->x; + pos.y = self->y; + pos.z = self->z; + + OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z);
+ + self->createdActor = CreateActor(self->type, self->inheritSet, pos, 0, 0); + } +// EventTable->events = EventTable->events & ~self->eventFlag; + } + else + { + self->x = self->createdActor->pos.x; + self->y = self->createdActor->pos.y; + self->z = self->createdActor->pos.z; + self->createdActor->Delete(); + self->createdActor = 0; }
} |