summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kamek_ntsc.x2
-rw-r--r--kamek_ntsc2.x2
-rw-r--r--kamek_pal.x2
-rw-r--r--kamek_pal2.x2
-rw-r--r--poweruphax.yaml2
-rw-r--r--src/poweruphax.S38
6 files changed, 37 insertions, 11 deletions
diff --git a/kamek_ntsc.x b/kamek_ntsc.x
index 9ccb893..ab702c3 100644
--- a/kamek_ntsc.x
+++ b/kamek_ntsc.x
@@ -988,6 +988,8 @@ SECTIONS {
continuePlumberSetPowerupTextureDebug = 0x800CA5C4;
+ returnFromPowerupSoundChange = 0x801412FC;
+
ExitFromTileGodHack = 0x807E1684;
SomeTable_802F5440 = 0x802F5140;
diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x
index 619f4c3..f803db3 100644
--- a/kamek_ntsc2.x
+++ b/kamek_ntsc2.x
@@ -988,6 +988,8 @@ SECTIONS {
continuePlumberSetPowerupTextureDebug = 0x800CA5C4;
+ returnFromPowerupSoundChange = 0x801412FC;
+
ExitFromTileGodHack = 0x807E1694;
SomeTable_802F5440 = 0x802F5140;
diff --git a/kamek_pal.x b/kamek_pal.x
index 84d6005..81be80c 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -988,6 +988,8 @@ SECTIONS {
continuePlumberSetPowerupTextureDebug = 0x800CA6B4;
+ returnFromPowerupSoundChange = 0x8014143C;
+
ExitFromTileGodHack = 0x807E1684;
SomeTable_802F5440 = 0x802F5440;
diff --git a/kamek_pal2.x b/kamek_pal2.x
index 86a067a..f9f8a9a 100644
--- a/kamek_pal2.x
+++ b/kamek_pal2.x
@@ -988,6 +988,8 @@ SECTIONS {
continuePlumberSetPowerupTextureDebug = 0xDEADBEEF;
+ returnFromPowerupSoundChange = 0xDEADBEEF;
+
ExitFromTileGodHack = 0xDEADBEEF;
SomeTable_802F5440 = 0xDEADBEEF;
diff --git a/poweruphax.yaml b/poweruphax.yaml
index 1eb53af..191c31d 100644
--- a/poweruphax.yaml
+++ b/poweruphax.yaml
@@ -186,7 +186,7 @@ hooks:
- name: FixPowerupSound
type: branch_insn
- branch_type: bl
+ branch_type: b
src_addr_pal: 0x80141334
target_func: 'FixPowerupSound'
diff --git a/src/poweruphax.S b/src/poweruphax.S
index 9274b78..e028eb9 100644
--- a/src/poweruphax.S
+++ b/src/poweruphax.S
@@ -16,6 +16,7 @@
.extern continuePlumberSetPowerupTexture
.extern doneSettingThePowerupTexture
.extern doneSettingThePowerupTexture2
+.extern returnFromPowerupSoundChange
#ifndef __MWERKS__
.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
@@ -391,16 +392,30 @@ _not19:
.global FixPowerupSound
FixPowerupSound:
- # WARNING! This is a bad, bad, bad hack.
- # I was too lazy to add anything to the linker script, so...
-
- # We branch at 80141334, so our LR is 80141338
- # We need to jump to 80141384
- mflr r3
- addi r3, r3, 0x4C
- mtlr r3
+ #lis r3, DBString@h
+ #ori r3, r3, DBString@l
+ #lwz r4, 0x1090(r29)
+ #crclr 4*cr1+eq
+ #bl OSReport
+
+ lwz r5, 0x14DC(r29) # Original powerup
+ lwz r0, 0x1090(r29) # New powerup
+ # if NEW is 1 (big) and OLD is not 0 or 3, then play 273 (powerdown)
+ cmpwi r0, 1
+ bne dontConsiderPowerdown
+
+ cmpwi r5, 0
+ beq dontConsiderPowerdown
+ cmpwi r5, 3
+ beq dontConsiderPowerdown
+ # If the player is here, he was downgraded from a higher powerup to Big Mario
+ # So play the powerdown sound
+ mr r3, r29
+ li r4, 273
+ li r5, 0
+ b returnFromPowerupSoundChange
- lwz r0, 0x1090(r29)
+dontConsiderPowerdown:
lis r3, PowerupSounds@h
ori r3, r3, PowerupSounds@l
slwi r4, r0, 2
@@ -408,7 +423,7 @@ FixPowerupSound:
mr r3, r29
li r5, 0
- blr
+ b returnFromPowerupSoundChange
.global WeirdAnimLoadHack
@@ -719,6 +734,9 @@ I_hammerModelName:
PowerupTexDebugStr:
.string "Plumber::SetPowerupTexture() called on class %p with texnum %d lr=%p\n"
+DBString:
+ .string "PW:%d\n"
+
#.global BrosModelFilename
#BrosModelFilename:
# .string "g3d/bros.brres"