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: