From a75926b9e6a350943334b85ec3a751a8e5fb8214 Mon Sep 17 00:00:00 2001 From: qwertymodo Date: Wed, 28 Nov 2018 18:17:49 -0800 Subject: [PATCH] Fix inverted mode flute loading light world music --- hooks.asm | 4 ++++ music.asm | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/hooks.asm b/hooks.asm index ac7149f..ba46f1b 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2216,6 +2216,10 @@ NOP #1 ;-------------------------------------------------------------------------------- org $02B13A ; <- Bank02.asm:7647 dl Overworld_FinishMirrorWarp +;-------------------------------------------------------------------------------- +org $0AB949 ; <- Bank0A.asm:270 (Different from US ROM) +JSL BirdTravel_LoadTargetAreaMusic +NOP #16 ;================================================================================ ;================================================================================ diff --git a/music.asm b/music.asm index 1e1290d..23554ff 100644 --- a/music.asm +++ b/music.asm @@ -169,6 +169,71 @@ Overworld_FinishMirrorWarp: RTL ;-------------------------------------------------------------------------------- +;-------------------------------------------------------------------------------- +BirdTravel_LoadTargetAreaMusic: + ; Skip village and lost woods checks if entering dark world or a special area + LDA $8A : CMP.b #$40 : !BGE .notVillageOrWoods + + LDX.b #$07 ; Default village theme + + ; Check what phase we're in + LDA $7EF3C5 : CMP.b #$03 : !BLT + + LDX.b #$02 ; Default light world theme (phase >=3) + + + + ; Check if we're entering the village + LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks + ; For NA release would we also branch on indexes #$22 #$28 #$29 + + LDX.b #$05 ; Lost woods theme + + ; check if we've pulled from the master sword pedestal + LDA $7EF300 : AND.b #$40 : BEQ + + LDX.b #$02 ; Default light world theme + + + + ; check if we are entering lost woods + LDA $8A : BEQ .endOfLightWorldChecks + + .notVillageOrWoods + ; Use the normal overworld (light world) music + LDX.b #$02 + + ; Check phase ; In phase >= 2 + LDA $7EF3C5 : CMP.b #$02 : !BGE + + ; If phase < 2, play the legend music + LDX.b #$03 + + + + .endOfLightWorldChecks + ; if we are in the light world go ahead and set chosen selection + LDA $7EF3CA : BEQ .checkInverted+4 + + LDX.b #$0F ; dark woods theme + + ; This music is used in dark woods + LDA $8A + CMP.b #$40 : BEQ + + LDX.b #$0D ; dark death mountain theme + + ; This music is used in dark death mountain + CMP.b #$43 : BEQ + : CMP.b #$45 : BEQ + : CMP.b #$47 : BEQ + + LDX.b #$09 ; dark overworld theme + + + + ; if not inverted and light world, or inverted and dark world, skip moon pearl check + .checkInverted + LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck + + ; Does Link have a moon pearl? + LDA $7EF357 : BNE + + LDX.b #$04 ; bunny theme + + + + .lastCheck + RTL +;-------------------------------------------------------------------------------- + ;-------------------------------------------------------------------------------- ;0 = Is Kakariko Overworld ;1 = Not Kakariko Overworld