From a4739844e38e7455140dc44360e70fe7cc60c361 Mon Sep 17 00:00:00 2001 From: sup39 Date: Sun, 12 Feb 2023 03:07:49 +0900 Subject: [PATCH] add DeathlessBlooperSurfing --- src/DeathlessBlooperSurfing.ld | 3 +++ src/DeathlessBlooperSurfing.s | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/DeathlessBlooperSurfing.ld create mode 100644 src/DeathlessBlooperSurfing.s diff --git a/src/DeathlessBlooperSurfing.ld b/src/DeathlessBlooperSurfing.ld new file mode 100644 index 0000000..fece0c8 --- /dev/null +++ b/src/DeathlessBlooperSurfing.ld @@ -0,0 +1,3 @@ +$$ = 0; + +$C2$.onSurfClash = (DEFINED(SMS__GMSJ01) ? 0x248 : 0x24c) + TMario.surfing; diff --git a/src/DeathlessBlooperSurfing.s b/src/DeathlessBlooperSurfing.s new file mode 100644 index 0000000..5b15bd5 --- /dev/null +++ b/src/DeathlessBlooperSurfing.s @@ -0,0 +1,28 @@ +.set rObjHead, 9 +.set rObjPtr, 10 + +# prevent killing Mario and respawn Bloopers instead +.onSurfClash: +.prepare: + lwz r12, gpMapObjManager$r13(r13) + lwz rObjHead, 0x18(r12) + lwz rObjPtr, 0x14(r12) + slwi rObjPtr, rObjPtr, 2 + add rObjPtr, rObjHead, rObjPtr + +# find blooper and set active +.loop: + lwzu r12, -4(rObjPtr) +## check vtable + lwz r0, 0(r12) + xoris r0, r0, TSurfGesoObj.__vt@h + cmplwi r0, TSurfGesoObj.__vt@l + bne+ .loop.next +## clear 0x9 bit + lhz r0, 0xF2(r12) + andi. r0, r0, 0xffff-0x9 + sth r0, 0xF2(r12) +.loop.next: + cmplw rObjPtr, rObjHead + bgt+ .loop +.loop.done: