diff options
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | spritetex.yaml | 5 | ||||
-rwxr-xr-x | src/spritetex.S | 96 |
3 files changed, 100 insertions, 2 deletions
diff --git a/kamek_pal.x b/kamek_pal.x index dbb213f..6bf4875 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -18,6 +18,7 @@ SECTIONS { AlwaysDrawBranch = 0x80064544; GenerateRandomNumber = 0x800B2EE0; OneofManySoundPlayers = 0x800CE9B0; + BombExplodeState = 0x80B12A48; _savefpr_14 = 0x802DCF98; _savefpr_15 = 0x802DCF9C; diff --git a/spritetex.yaml b/spritetex.yaml index 453ab24..8ec7b9e 100644 --- a/spritetex.yaml +++ b/spritetex.yaml @@ -513,6 +513,11 @@ hooks: src_addr_pal: 0x80A5BA90 target_func: 'HammerSpin' + - name: HammerColour + type: branch_insn + branch_type: bl + src_addr_pal: 0x80023FBC + target_func: 'HammerColour' diff --git a/src/spritetex.S b/src/spritetex.S index 75e0256..48c6a64 100755 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -1,5 +1,6 @@ .extern sprintf .extern GenerateRandomNumber +.extern BombExplodeState #ifndef __MWERKS__ .set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 @@ -838,6 +839,12 @@ TEX_HuckitBalls: +.global HammerColour +HammerColour: + lwz r5, 4(r30) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 .global HammerTime @@ -956,6 +963,9 @@ HammerLaunch: cmpwi r5, 5 beq LemmyLaunch +# cmpwi r5, 1 +# beq BombLaunch + li r6, 1 slwi r6, r6, 2 # size *= 4 (size of float) @@ -979,8 +989,11 @@ FacingLeft: lfsx f0, r7, r6 # get it from the array stfs f0, 0xE8(r31) - li r7, 270 - sth r7, 0x102(r31) + li r7, 90 + sth r7, 0x100(r31) + + li r7, 90 + sth r7, 0x106(r31) blr @@ -1000,6 +1013,85 @@ LemmyLaunch: blr +BombLaunch: + + stwu sp, -0x40(sp) + mflr r0 + stw r31, 0x2C(sp) + stw r30, 0x28(sp) + stw r0, 0x24(sp) + stw r3, 0x20(sp) + stw r4, 0x1C(sp) + stw r5, 0x18(sp) + stw r6, 0x10(sp) + stw r7, 0x8(sp) + stw r8, 0x34(sp) + stw r9, 0x30(sp) + + mr r3, r31 + + lwz r12, 0x60(r31) + lwz r12, 0xD4(r12) + mtctr r12 + lis r4, BombExplodeState@h + ori r4, r4, BombExplodeState@l + + lwz r5, 4(r30) + srwi r5, r5, 28 + + mulli r5, r5, 0x40 + + add r4, r4, r5 + bctrl + + + lwz r31, 0x2C(sp) + lwz r30, 0x28(sp) + lwz r0, 0x24(sp) + lwz r3, 0x20(sp) + lwz r4, 0x1C(sp) + lwz r5, 0x18(sp) + lwz r6, 0x10(sp) + lwz r7, 0x8(sp) + lwz r8, 0x34(sp) + lwz r9, 0x30(sp) + mr r3, r30 + + lis r7, LaunchAngle@h + ori r7, r7, LaunchAngle@l + + li r6, 0 + slwi r6, r6, 2 # size *= 4 (size of float) + + lwz r8, 0x348(r30) + cmpwi r8, 0 + bne BombFacingLeft + + lfsx f0, r7, r6 + stfs f0, 0xE8(r31) + + mtlr r0 + addi sp, sp, 0x40 + blr + +BombFacingLeft: + + lis r7, LaunchAngleLeft@h + ori r7, r7, LaunchAngleLeft@l + + lfsx f0, r7, r6 + stfs f0, 0xE8(r31) + + li r7, 180 + sth r7, 0x102(r31) + + mtlr r0 + addi sp, sp, 0x40 + blr + + + + .global HammerSpin HammerSpin: # sth r3, 0x100(r31) |