From baa86aba60247a79a688951e96fad9eed7c65791 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Tue, 11 Oct 2011 02:05:42 -0500 Subject: fixed hardcoded r13 in PlaySound to enable ntsc fun --- kamek_pal.x | 1 + src/bossMegaGoomba.cpp | 12 ++++++++++-- src/soundPlayer.S | 21 +++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/kamek_pal.x b/kamek_pal.x index 7ef8799..aa7b25a 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1087,6 +1087,7 @@ SECTIONS { SomeWipeClass = 0x8042A720; QueryGlobal5758 = 0x800B3B50; + SoundClassRelated = 0x8042a03c; BufferToCheckIfPlaying = 0x8042a768; GetHermiteCurveValue = 0x8017d660; diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index a9069ca..36f521c 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -51,6 +51,7 @@ class daMegaGoomba_c : public dEn_c { int toPlay; u32 marker8_end; u32 marker9_start; + bool timeToPlay; u32 marker9_end; bool takeHit(char count); @@ -259,6 +260,7 @@ int daMegaGoomba_c::onCreate() { this->JumpTime = 50.0; this->playIt = 0; this->toPlay = 0; + this->timeToPlay = false; OSReport("Setting MegaGoomba's State\n"); doStateChange(&StateID_Grow); @@ -516,9 +518,15 @@ void daMegaGoomba_c::executeState_Walk() { break; //FIXME test case for sound effects case 3: - if(this->playIt = 1) { + OSReport("PlaySound(this, %d)\n", this->toPlay); + if(this->timeToPlay) { PlaySound(this, this->toPlay); - this->playIt = 0; + this->timeToPlay = false; + this->toPlay++; + if(this->toPlay > 1977) + this->toPlay = 0; + } else { + this->timeToPlay = true; } break; default: diff --git a/src/soundPlayer.S b/src/soundPlayer.S index 1a95b7c..6c0d0a7 100644 --- a/src/soundPlayer.S +++ b/src/soundPlayer.S @@ -33,17 +33,17 @@ PlaySound: stwu r1, -0x30(r1) mflr r0 - mr r20, r4 + stw r0, 0x34(r1) + stw r31, 0x2C(r1) + stw r30, 0x28(r1) + mr r30, r4 # Gets Player Position mr r4, r3 # object - stw r0, 0x34(r1) addi r3, r1, 0x10 # dest - stw r31, 0x2C(r1) bl Actor_GetVec3WithValuesAdded # Gives an accurate position for the sound - lwz r31, -0x5944(r13) addi r3, r1, 8 addi r4, r1, 0x10 bl ConvertStagePositionIntoScreenPosition__Maybe @@ -52,7 +52,7 @@ PlaySound: lis r4, BufferToCheckIfPlaying@h ori r4, r4, BufferToCheckIfPlaying@l lwz r3, 0(r4) - mr r4, r20 + mr r4, r30 bl CheckIfPlayingSound # Go away if it is @@ -60,19 +60,20 @@ PlaySound: bne GoAwaySoundGuy # If we're good to go, play the sound! - mr r3, r31 + lis r31, SoundClassRelated@h + ori r31, r31, SoundClassRelated@l + lwz r3, 0(r31) addi r5, r1, 8 - mr r4, r20 + mr r4, r30 li r6, 0 bl YetAnotherSoundPlayer b GoAwaySoundGuy - - GoAwaySoundGuy: - lwz r0, 0x34(r1) + lwz r30, 0x28(r1) lwz r31, 0x2C(r1) + lwz r0, 0x34(r1) mtlr r0 addi r1, r1, 0x30 blr -- cgit v1.2.3