Merge remote-tracking branch 'baserom/master' into MergeDecompression

# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	bookofmudora.asm
#	build.bat
#	catfish.asm
#	compasses.asm
#	contrib.asm
#	darkworldspawn.asm
#	entrances.asm
#	events.asm
#	floodgatesoftlock.asm
#	flute.asm
#	framehook.asm
#	goalitem.asm
#	halfmagicbat.asm
#	heartpieces.asm
#	hooks.asm
#	inventory.asm
#	invertedmaps.asm
#	itemtext_lower.asm
#	lampmantlecone.asm
#	mantle.asm
#	msu.asm
#	music.asm
#	newhud.asm
#	newitems.asm
#	pendantcrystalhud.asm
#	ram.asm
#	rngfixes.asm
#	roomloading.asm
#	shopkeeper.asm
#	stats.asm
#	stats/credits.asm
#	stats/creditsnew.asm
#	stats/statConfig.asm
#	tables.asm
#	tablets.asm
#	utilities.asm
#	zoraking.asm
This commit is contained in:
aerinon
2023-08-23 13:02:39 -06:00
186 changed files with 24631 additions and 15312 deletions

148
music.asm
View File

@@ -9,7 +9,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$02 ; Default light world theme
LDA $8A : ORA #$40 ; check both light and dark world DM at the same time
LDA.b OverworldIndex : ORA.b #$40 ; check both light and dark world DM at the same time
CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks
@@ -17,47 +17,42 @@ PreOverworld_LoadProperties_ChooseMusic:
LDY.b #$5A ; Main overworld animated tileset
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$40 : !BGE .notVillageOrWoods
LDA.b OverworldIndex : CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check what phase we're in
;LDA ProgressIndicator : 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
LDA.b OverworldIndex : 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 OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
LDA.b OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
LDX.b #$02 ; Default light world theme
+
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA ProgressIndicator : CMP.b #$02 : !BGE +
LDA.l ProgressIndicator : 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 CurrentWorld : BEQ .checkInverted+4
LDA.l CurrentWorld : BEQ .checkInverted+4
LDX.b #$0F ; dark woods theme
; This music is used in dark woods
LDA $8A
LDA.b OverworldIndex
CMP.b #$40 : BEQ +
LDX.b #$0D ; dark death mountain theme
@@ -68,18 +63,18 @@ PreOverworld_LoadProperties_ChooseMusic:
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE +
LDA.l MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme
+
.lastCheck
LDA $0132 : CMP.b #$F2 : BNE +
CPX $0130 : BNE +
; If the last played command ($0132) was half volume (#$F2)
; and the actual song playing ($0130) is same as the one for this area (X)
LDA.w MusicControlQueue : CMP.b #$F2 : BNE +
CPX.w LastAPUCommand : BNE +
; If the last played command (MusicControlQueue) was half volume (#$F2)
; and the actual song playing (LastAPUCommand) is same as the one for this area (X)
; then play the full volume command (#F3) instead of restarting the song
LDX.b #$F3
+
@@ -91,7 +86,7 @@ PreOverworld_LoadProperties_ChooseMusic:
Overworld_FinishMirrorWarp:
REP #$20
LDA.w #$2641 : STA $4370
LDA.w #$2641 : STA.w DMAP7
LDX.b #$3E
@@ -99,37 +94,33 @@ Overworld_FinishMirrorWarp:
.clear_hdma_table
STA $1B00, X : STA $1B40, X
STA $1B80, X : STA $1BC0, X
STA $1C00, X : STA $1C40, X
STA $1C80, X
STA.w IrisPtr+$0000, X : STA.w IrisPtr+$0040, X
STA.w IrisPtr+$0080, X : STA.w IrisPtr+$00C0, X
STA.w IrisPtr+$0100, X : STA.w IrisPtr+$0140, X
STA.w IrisPtr+$0180, X
DEX #2 : BPL .clear_hdma_table
LDA.w #$0000 : STA $7EC007 : STA $7EC009
LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection
SEP #$20
JSL $00D7C8 ; $57C8 IN ROM
LDA.b #$80 : STA $9B
JSL $80D7C8
LDA.b #$80 : STA.b HDMAENQ
LDX.b #$04 ; bunny theme
; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ +
LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks
LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ +
LDA.l MoonPearlEquipment : BEQ .endOfLightWorldChecks
+
LDX.b #$09 ; default dark world theme
LDA $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDX.b #$02 ; hyrule field theme
; Check if we're entering the lost woods
CMP.b #$00 : BNE +
LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks
LDA.l OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks
LDX.b #$05 ; lost woods theme
BRA .endOfLightWorldChecks
+
@@ -138,14 +129,13 @@ Overworld_FinishMirrorWarp:
CMP.b #$18 : BNE .endOfLightWorldChecks
; Check what phase we're in
; LDA ProgressIndicator : CMP.b #$03 : !BGE .endOfLightWorldChecks
LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks
STX $012C
STX.w MusicControlRequest
LDA $8A : CMP.b #$40 : BNE +
LDX #$0F ; dark woods theme
LDA.b OverworldIndex : CMP.b #$40 : BNE +
LDX.b #$0F ; dark woods theme
BRA .bunny
+
@@ -154,24 +144,24 @@ Overworld_FinishMirrorWarp:
CMP.b #$47 : BNE .notDarkMountain
.darkMountain
LDA.b #$09 : STA $012D ; set storm ambient SFX
LDA.b #$09 : STA.w SFX1 ; set storm ambient SFX
LDX.b #$0D ; dark mountain theme
.bunny
LDA MoonPearlEquipment : ORA InvertedMode : BNE +
LDX #$04 ; bunny theme
LDA.l MoonPearlEquipment : ORA.l InvertedMode : BNE +
LDX.b #$04 ; bunny theme
+
STX $012C
STX.w MusicControlRequest
.notDarkMountain
LDA $11 : STA $010C
LDA.b GameSubMode : STA.w GameSubModeCache ; GameModeCache
STZ $11
STZ $B0
STZ $0200
STZ $0710
STZ.b GameSubMode
STZ.b SubSubModule
STZ.w SubModuleInterface
STZ.w SkipOAM
RTL
;--------------------------------------------------------------------------------
@@ -179,73 +169,59 @@ Overworld_FinishMirrorWarp:
;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic:
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check what phase we're in
;LDA ProgressIndicator : 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
LDA.b OverworldIndex : 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 OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
; LDX.b #$02 ; Default light world theme
;+
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA ProgressIndicator : CMP.b #$02 : !BGE +
LDA.l ProgressIndicator : 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 CurrentWorld : BEQ .checkInverted+4
LDA.l CurrentWorld : BEQ .checkInverted+4
LDX.b #$09 ; dark overworld theme
LDA $8A
LDA.b OverworldIndex
; Misery Mire rain SFX
CMP.b #$70 : BNE ++
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP $0131 : BEQ +
STA $012D
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP.w LastSFX1 : BEQ +
STA.w SFX1
+ : BRA .checkInverted
++
; This music is used in dark death mountain
CMP.b #$43 : BEQ .darkMountain
; CMP.b #$45 : BEQ .darkMountain
; CMP.b #$47 : BEQ .darkMountain
LDA.b #$05 : STA $012D
LDA.b #$05 : STA.w SFX1
BRA .checkInverted
.darkMountain
LDA CrystalsField : CMP.b #$7F : BEQ +
LDA.l CrystalsField : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme
+ : LDA.b #$09 : STA $012D
+ : LDA.b #$09 : STA.w SFX1
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE +
LDA.l MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme
+
@@ -257,8 +233,8 @@ BirdTravel_LoadTargetAreaMusic:
;0 = Is Kakariko Overworld
;1 = Not Kakariko Overworld
PsychoSolder_MusicCheck:
LDA $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA $1B ; Also check that we are outdoors
LDA.b OverworldIndex : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA.b IndoorsFlag ; Also check that we are outdoors
.done
RTL
;--------------------------------------------------------------------------------
@@ -269,16 +245,16 @@ RTL
;
; On entry, A = $8A (overworld area being loaded)
Overworld_MosaicDarkWorldChecks:
CMP.b #$40 : beq .checkCrystals
CMP.b #$42 : beq .checkCrystals
CMP.b #$50 : beq .checkCrystals
CMP.b #$51 : bne .doFade
CMP.b #$40 : BEQ .checkCrystals
CMP.b #$42 : BEQ .checkCrystals
CMP.b #$50 : BEQ .checkCrystals
CMP.b #$51 : BNE .doFade
.checkCrystals
LDA CrystalsField : CMP.b #$7F : BEQ .done
LDA.l CrystalsField : CMP.b #$7F : BEQ .done
.doFade
LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music
LDA.b #$F1 : STA.w MusicControlRequest ; thing we wrote over, fade out music
.done
RTL
@@ -306,6 +282,6 @@ Underworld_DoorDown_Entry:
;--------------------------------------------------------------------------------
; Check if the boss in ToH has been defeated (16-bit accumulator)
CheckHeraBossDefeated:
LDA RoomDataWRAM[$08].high : AND #$00FF
RTL
LDA.l RoomDataWRAM[$07].l : AND.w #$FF00
RTL
;--------------------------------------------------------------------------------