From 9f244e88204491e85f1c086bc8d3478ea9c34770 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 12 Feb 2013 23:40:37 +0100 Subject: gigantic background hack --- src/levelspecial.cpp | 24 +++++++++++++++++++++--- src/randomcrap.S | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index 3432002..962b87f 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -39,13 +39,18 @@ extern char SizerOn; extern char ZOrderOn; extern int GlobalStarsCollected; +extern VEC2 BGScaleFront; +extern VEC2 BGScaleBack; +extern char BGScaleEnabled; + 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}; +static const 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 }; +static const 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}; +static const float BGScaleChoices[] = {0.1f, 0.15f, 0.25f, 0.375f, 0.5f, 0.625f, 0.75f, 0.9f, 1.0f, 1.125f, 1.25f, 1.5f, 1.75f, 2.0f, 2.25f, 2.5f}; bool NoMichaelBuble = false; @@ -85,6 +90,7 @@ bool ResetAfterLevel(bool didItWork) { NoMichaelBuble = false; for (int i = 0; i < 4; i++) Player_Flags[i] &= ~4; + BGScaleEnabled = 0; return didItWork; } @@ -193,7 +199,15 @@ void LevelSpecial_Update(LevelSpecial *self) { case 8: NoMichaelBuble = true; break; - + + case 9: + BGScaleEnabled = true; + BGScaleFront.x = BGScaleChoices[(self->settings >> 20) & 15]; + BGScaleFront.y = BGScaleChoices[(self->settings >> 16) & 15]; + BGScaleBack.x = BGScaleChoices[(self->settings >> 12) & 15]; + BGScaleBack.y = BGScaleChoices[(self->settings >> 8) & 15]; + break; + default: break; } @@ -248,6 +262,10 @@ void LevelSpecial_Update(LevelSpecial *self) { case 8: NoMichaelBuble = false; break; + + case 9: + BGScaleEnabled = false; + break; default: break; diff --git a/src/randomcrap.S b/src/randomcrap.S index edf5fef..2842d12 100644 --- a/src/randomcrap.S +++ b/src/randomcrap.S @@ -257,6 +257,37 @@ PowEvent: .extern set__10dFlagMgr_cFUcibbbUi .extern instance__10dFlagMgr_c +.global GiganticBackgrounds +GiganticBackgrounds: + lis r3, BGScale@h + ori r3, r3, BGScale@l + lbz r4, 8(r3) + cmpwi r4, 0 + beq NoBGScale + lwz r4, 0x4E4(r31) + cmplwi r4, 0 + beq dontUseBack + addi r3, r3, 8 +dontUseBack: + + lfs f1, 0(r3) + stfs f1, 0xDC(r31) + lfs f1, 4(r3) + stfs f1, 0xE0(r31) +NoBGScale: + lwz r31, 0x5C(r1) + lwz r0, 0x64(r1) + mtlr r0 + addi r1, r1, 0x60 + blr + +.data +.global BGScaleFront, BGScaleBack, BGScaleEnabled +BGScale: +BGScaleFront: .float 1.0, 1.0 +BGScaleBack: .float 1.0, 1.0 +BGScaleEnabled: .byte 0 + #AllocLog: # stwu r1, -0x20(r1) # mflr r0 -- cgit v1.2.3