More platforms, fixed graphics when switching floors

This commit is contained in:
Smallhacker
2018-01-04 23:35:28 -05:00
parent 3dde5bcbbd
commit c5b97deda1
3 changed files with 101 additions and 45 deletions

View File

@@ -1,18 +1,24 @@
ShouldOverrideFileLoad:
; Y = Graphics file being loaded
CPY #$0A ; 0A = Ice/Mire floor file
BNE .no
LDA $040C ; Dungeon number
CMP #$12 ; Ice Palace
BEQ .yes
.no
CLC : RTS
.yes
SEC : RTS
BgGraphicsLoading:
; Instructions overwritten
STZ $00
STX $01
STA $02
; Y = Graphics file being loaded
CPY #$0A ; 0A = Ice/Mire floor file
BNE .useDefaultGraphics
LDA $040C ; Dungeon number
CMP #$12 ; Ice Palace
BEQ .useSpecialIcePalaceFile
.useDefaultGraphics
JSR ShouldOverrideFileLoad
BCS .useSpecialIcePalaceFile
JML BgGraphicsLoadingResume
.useSpecialIcePalaceFile
@@ -43,5 +49,35 @@ BgGraphicsLoading:
SEP #$20
JML BgGraphicsLoadingCancel
ReloadingFloors:
SEP #$30 ; 8 AXY
LDA $7EC2F8 ; Floor file that has been decompressed
TAY
JSR ShouldOverrideFileLoad
REP #$30 ; 16 AXY
BCS .replaceWithSpecialIcePalaceFile
; Instructions overwritten by hook
LDX.w #$0000
LDY.w #$0040
JML ReloadingFloorsResume
.replaceWithSpecialIcePalaceFile
; Block move our hardcoded graphics into the output buffer
LDX.w #IcePalaceFloorGfx ; Source
LDY.w #$0000 ; Target
LDA.w #$0800 ; Length
PHB
MVN $7F, IcePalaceFloorGfx>>16
PLB
; Pretend that we ran the original routine
LDX.w #$0800
LDA.w #$6600
STA $03
JML ReloadingFloorsCancel
IcePalaceFloorGfx:
incbin ice_palace_floor.bin