summaryrefslogtreecommitdiff
path: root/src/poweruphax.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/poweruphax.S')
-rw-r--r--src/poweruphax.S38
1 files changed, 28 insertions, 10 deletions
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"