This commit is contained in:
Karkat
2018-01-21 23:53:01 -05:00
7 changed files with 159 additions and 20 deletions

View File

@@ -127,6 +127,7 @@ incsrc hardmode.asm
incsrc goalitem.asm incsrc goalitem.asm
incsrc compasses.asm incsrc compasses.asm
incsrc doorframefixes.asm incsrc doorframefixes.asm
incsrc music.asm
;incsrc shopkeeper.asm ;incsrc shopkeeper.asm
incsrc cuccostorm.asm incsrc cuccostorm.asm
incsrc roomloading.asm incsrc roomloading.asm

View File

@@ -61,6 +61,12 @@ SetDeathWorldChecked:
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FakeWorldFix:
LDA FixFakeWorld : BEQ +
LDA $8A : AND.b #$40 : STA $7EF3CA
+
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear: MasterSwordFollowerClear:
LDA $7EF3CC LDA $7EF3CC
CMP #$0E : BEQ .clear ; clear master sword follower CMP #$0E : BEQ .clear ; clear master sword follower

View File

@@ -3,17 +3,12 @@
;================================================================================ ;================================================================================
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; StoreLastEntranceID ; StoreLastOverworldDoorID
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
StoreLastEntranceID: StoreLastOverworldDoorID:
CPX #$003a : BCC .noStore TXA : INC
TXA : SBC #$3a STA $7F5099
BRA .done LDA $1BBB73, X : STA $010E
.noStore
LDA #$00
.done
STA $7F5099
LDA $1BBB73, X : STA $010E
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -24,13 +19,12 @@ CacheDoorFrameData:
LDA $7F5099 : BEQ .originalBehaviour LDA $7F5099 : BEQ .originalBehaviour
DEC : ASL : TAX DEC : ASL : TAX
LDA EntranceDoorFrameTable, X : STA $0696 LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
BRA .done BRA .done
.originalBehaviour .originalBehaviour
LDA $D724, X : STA $0696 LDA $D724, X : STA $0696
.done
STZ $0698 STZ $0698
LDA #$00 .done
STA $7F5099
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -39,6 +33,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
WalkDownIntoTavern: WalkDownIntoTavern:
LDA $7F5099 LDA $7F5099
CMP #$08 ; tavern door has index 0x42 (saved off value is incremented by one)
CMP #$43
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1934,12 +1934,12 @@ JSL.l SetOverlayIfLamp
; Overworld Door Frame Overlay Fix ; Overworld Door Frame Overlay Fix
; ;
; When entering an overworld entrance, if it is an entrance to a simple cave, we ; When entering an overworld entrance, if it is an entrance to a simple cave, we
; store the entrance id, then use that (instead of the cave id) to determine the ; store the overworld door id, then use that (instead of the cave id) to determine the
; overlay to draw when leaving the cave again. We also use this value to ; overlay to draw when leaving the cave again. We also use this value to
; identify the tavern entrance to determine whether link should walk up or down. ; identify the tavern entrance to determine whether link should walk up or down.
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E) org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
JSL.l StoreLastEntranceID JSL.l StoreLastOverworldDoorID
NOP #3 NOP #3
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698) org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
@@ -1951,6 +1951,19 @@ JSL.l WalkDownIntoTavern
NOP #1 NOP #1
;================================================================================ ;================================================================================
;================================================================================
; Music fixes
;--------------------------------------------------------------------------------
org $0282F4 ; <- Bank02.asm:654 (LDY.b #$58 ...)
JML.l PreOverworld_LoadProperties_ChooseMusic
org $028389 ; <- Bank02.asm:763
PreOverworld_LoadProperties_SetSong:
;--------------------------------------------------------------------------------
org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18)
JSL PsychoSolder_MusicCheck
NOP #1
;================================================================================
;================================================================================ ;================================================================================
; Hooks for roomloading.asm ; Hooks for roomloading.asm
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1987,4 +2000,3 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
ReloadingFloorsCancel: ReloadingFloorsCancel:
;================================================================================ ;================================================================================

View File

@@ -830,6 +830,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ClearOWKeys: ClearOWKeys:
PHA PHA
JSL.l FakeWorldFix
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
PLA : LDA $7EF38B : STA $7EF36F PLA : LDA $7EF38B : STA $7EF36F
RTL RTL

89
music.asm Normal file
View File

@@ -0,0 +1,89 @@
;--------------------------------------------------------------------------------
PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
LDY.b #$58 ; death mountain animated tileset.
LDX.b #$02 ; Default light world theme
LDA $8A : ORA #$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
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
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 .lastCheck
LDX.b #$0D ; dark woods theme
; This music is used in dark woods, and dark death mountain
LDA $8A
CMP.b #$40 : BEQ + : CMP.b #$43 : BEQ + : CMP.b #$45 : BEQ + : CMP.b #$47 : BEQ +
LDX.b #$09 ; dark overworld theme
+
; Does Link have a moon pearl?
LDA $7EF357 : 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)
; then play the full volume command (#F3) instead of restarting the song
LDX.b #$F3
+
JML.l PreOverworld_LoadProperties_SetSong
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;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
.done
RTL
;--------------------------------------------------------------------------------

View File

@@ -728,6 +728,13 @@ org $308173 ; PC 0x180173
Bob: Bob:
db #$01 ; #00 = Off - #$01 = On (Default) db #$01 ; #00 = Off - #$01 = On (Default)
;================================================================================ ;================================================================================
org $308174 ; PC 0x180174
; Flag to fix Fake Light World/Fake Dark World as caused by leaving the underworld
; to the other world (As can be caused by EG, Certain underworld clips, or Entance Randomizer).
; Currently, Fake Worlds triggered by other causes like YBA's Fake Flute, are not affected.
FixFakeWorld:
db #$00 ; #00 = Fix Off (Default) - #$01 = Fix On
;================================================================================
org $308190 ; PC 0x180190 org $308190 ; PC 0x180190
TimerStyle: TimerStyle:
db #$00 ; #$00 = Off (Default) - #$01 Countdown - #$02 = Stopwatch db #$00 ; #$00 = Off (Default) - #$01 Countdown - #$02 = Stopwatch
@@ -1288,7 +1295,7 @@ dw #9999 ; Rupee Limit
; $7F5096 - Dialog Offset Pointer Return (Low) ; $7F5096 - Dialog Offset Pointer Return (Low)
; $7F5097 - Dialog Offset Pointer Return (High) ; $7F5097 - Dialog Offset Pointer Return (High)
; $7F5098 - Water Entry Index ; $7F5098 - Water Entry Index
; $7F5099 - Last Entered Entrance ; $7F5099 - Last Entered Overworld Door ID
; $7F50A0 - Event Parameter 1 ; $7F50A0 - Event Parameter 1
@@ -1331,8 +1338,18 @@ db $83, $21, $EB, $6E, $0A, $71, $B0, $11, $85, $C7, $A1, $FD, $E5, $16, $48, $F
db $F2, $23, $2F, $28, $9B, $AA, $AB, $D0, $6A, $9D, $C6, $2D, $00, $FE, $E1, $3F db $F2, $23, $2F, $28, $9B, $AA, $AB, $D0, $6A, $9D, $C6, $2D, $00, $FE, $E1, $3F
db $A0, $4A, $B8, $4E, $74, $1F, $8E, $A9, $F5, $CD, $60, $91, $DB, $D8, $52, $E2 db $A0, $4A, $B8, $4E, $74, $1F, $8E, $A9, $F5, $CD, $60, $91, $DB, $D8, $52, $E2
;================================================================================ ;================================================================================
org $30A100 ; PC 0x182100 - 0x18218C org $30A100 ; PC 0x182100 - 0x182304
EntranceDoorFrameTable: EntranceDoorFrameTable:
; data for multi-entrance caves
dw $0816, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $05cc, $05d4, $0bb6, $0b86
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000
; simple caves:
dw $0000, $0000, $0DE8, $0B98, $14CE, $0000, $1C50, $FFFF dw $0000, $0000, $0DE8, $0B98, $14CE, $0000, $1C50, $FFFF
dw $1466, $0000, $1AB6, $0B98, $1AB6, $040E, $9C0C, $1530 dw $1466, $0000, $1AB6, $0B98, $1AB6, $040E, $9C0C, $1530
dw $0A98, $0000, $0000, $0000, $0000, $0000, $0000, $0816 dw $0A98, $0000, $0000, $0000, $0000, $0000, $0000, $0816
@@ -1342,6 +1359,24 @@ dw $041A, $0000, $091E, $09AC, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0AA8, $07AA, $0000, $0000, $0000, $0000, $0000 dw $0000, $0AA8, $07AA, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000 dw $0000, $0000, $0000, $0000, $0000, $0000
EntranceAltDoorFrameTable:
dw $0000, $01aa, $8124, $87be, $8158, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $82be, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000
;=============================================================================== ;===============================================================================
org $30B000 ; PC 0x183000 - 0x183054 org $30B000 ; PC 0x183000 - 0x183054
StartingEquipment: StartingEquipment:
@@ -1371,4 +1406,4 @@ db $FF, $AF, $50, $00
db $FF, $27, $0A, $00 db $FF, $27, $0A, $00
db $FF, $12, $F4, $01 db $FF, $12, $F4, $01
db $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF
;================================================================================ ;================================================================================