diff options
-rwxr-xr-x | include/game.h | 4 | ||||
-rw-r--r-- | levelspecial.yaml | 6 | ||||
-rw-r--r-- | src/levelspecial.cpp | 21 |
3 files changed, 28 insertions, 3 deletions
diff --git a/include/game.h b/include/game.h index 7035850..b032f40 100755 --- a/include/game.h +++ b/include/game.h @@ -3643,6 +3643,10 @@ extern u32 GlobalTickCount; // A hack, imported from tilesetfixer.cpp
extern void *BGDatClass, *StagePtr;
+inline int GetZoneNum() {
+ char *st = (char*)StagePtr;
+ return st[0x120F];
+}
inline int GetAreaNum() {
char *st = (char*)StagePtr;
return st[0x120E];
diff --git a/levelspecial.yaml b/levelspecial.yaml index 58a6ced..b55c67e 100644 --- a/levelspecial.yaml +++ b/levelspecial.yaml @@ -29,4 +29,8 @@ hooks: src_addr_pal: 0x803259FC
target_func: 'MarioStateChanger(void *, dStateBase_c *, unsigned int)'
-
+ - name: FuckinBubbles
+ type: branch_insn
+ branch_type: b
+ src_addr_pal: 0x80926200
+ target_func: 'FuckinBubbles(void)'
diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index ba8539c..8b37d5e 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -1,5 +1,6 @@ #include <common.h> #include <game.h> +#include <dCourse.h> struct LevelSpecial { u32 id; // 0x00 @@ -92,14 +93,30 @@ bool ResetAfterLevel(bool didItWork) { ZOrderOn = 0; GlobalStarsCollected = 0; NoMichaelBuble = false; - for (int i = 0; i < 4; i++) - Player_Flags[i] &= ~4; BGScaleEnabled = 0; CameraLockEnabled = 0; isLockPlayerRotation = false; return didItWork; } +void FuckinBubbles() { + dCourse_c *course = dCourseFull_c::instance->get(GetAreaNum()); + bool thing = false; + + int zone = GetZoneNum(); + for (int i = 0; i < course->zoneSpriteCount[zone]; i++) { + dCourse_c::sprite_s *spr = &course->zoneFirstSprite[zone][i]; + if (spr->type == 246 && (spr->settings & 0xFFFFFF) == 2) + thing = true; + } + + if (thing) { + OSReport("DISABLING EXISTING BUBBLES.\n"); + for (int i = 0; i < 4; i++) + Player_Flags[i] &= ~4; + } +} + bool LevelSpecial_Create(LevelSpecial *self) { char eventNum = (self->settings >> 24) & 0xFF; self->eventFlag = (u64)1 << (eventNum - 1); |