diff --git a/NTSC-J 1.0/SpawnYoshi.txt b/NTSC-J 1.0/SpawnYoshi.txt index 05f106f..c660505 100644 --- a/NTSC-J 1.0/SpawnYoshi.txt +++ b/NTSC-J 1.0/SpawnYoshi.txt @@ -1,11 +1,22 @@ -$ Spwan Yoshi (2022/08/29) [sup39] -C21604C4 00000009 +$ Spwan Yoshi (2022/10/14) [sup39] +C21604C4 0000000A 807F03F0 3C808040 A0840D50 54800436 -2C000800 40820030 -54840EFD 41820028 +2C000800 40820034 +54840EFD 4182002C 3C006300 5C0027BE 980300D0 80030008 -9003000C 3D808016 -618C0640 7D8803A6 -4E800020 00000000 +9003000C 807F03F0 +3D808016 618C0640 +7D8803A6 4E800020 +60000000 00000000 +C21945AC 00000009 +3C808040 A0840D50 +54800436 2C000800 +4082002C 54840EFD +41820024 806D98B8 +806303F0 93E300F0 +7FE3FB78 81830000 +818C0104 7D8803A6 +4E800021 A01F00FC +60000000 00000000 diff --git a/src/SpawnYoshi.ld b/src/SpawnYoshi.ld new file mode 100644 index 0000000..c5c0086 --- /dev/null +++ b/src/SpawnYoshi.ld @@ -0,0 +1,6 @@ +$$ = 0; + +$C2$.TMario.checkCollision.checkYoshi = 0x44 + TMario.checkCollision; +$RideYoshi = 0x1C0 + TMario.checkCollision; + +$C2$.TEggYoshi.control.killEgg = 0x1c + TEggYoshi.control; diff --git a/src/SpawnYoshi.s b/src/SpawnYoshi.s index 40c1b4b..e242e86 100644 --- a/src/SpawnYoshi.s +++ b/src/SpawnYoshi.s @@ -1,21 +1,19 @@ -.set rYoshi, 3 # required to be r3 +.set rYoshi, 3 .set rInput, 4 -.set aInput, 0x80400D50 -.set aRideYoshi, 0x80160640 -_C2_801604c4: +.TMario.checkCollision.checkYoshi: lwz rYoshi, 0x3f0(r31) ## check input - lis rInput, aInput@ha - lhz rInput, aInput@l(rInput) + lis rInput, JUTGamePad.mPadStatus@ha + lhz rInput, JUTGamePad.mPadStatus@l(rInput) ### Y rlwinm r0, rInput, 0, 0xFFF0 cmpwi r0, 0x0800 - bne .L.end + bne .checkYoshi.inactived ### D-Pad rlwinm. rInput, rInput, 1, 30-3, 30 - beq .L.end + beq .checkYoshi.inactived ## color lis r0, 0x6300 @@ -26,9 +24,37 @@ _C2_801604c4: stw r0, 0xC(rYoshi) ## goto ride Yoshi - lis r12, aRideYoshi@h - ori r12, r12, aRideYoshi@l +.checkYoshi.done: + lwz r3, 0x3f0(r31) + lis r12, $RideYoshi@h + ori r12, r12, $RideYoshi@l mtlr r12 blr -.L.end: +.checkYoshi.inactived: + + +.TEggYoshi.control.killEgg: +## check input + lis rInput, JUTGamePad.mPadStatus@ha + lhz rInput, JUTGamePad.mPadStatus@l(rInput) +### Y + rlwinm r0, rInput, 0, 0xFFF0 + cmpwi r0, 0x0800 + bne .killEgg.done +### D-Pad + rlwinm. rInput, rInput, 1, 30-3, 30 + beq .killEgg.done +## set pointer + lwz r3, gpMarioOriginal$r13(r13) + lwz r3, 0x3f0(r3) + stw r31, 0xf0(r3) +## egg.makeObjDead() + mr r3, r31 + lwz r12, 0(r3) # egg.vtable + lwz r12, 0x104(r12) # &makeObjDead() + mtlr r12 + blrl + +.killEgg.done: + lhz r0, 0xfc(r31)