Day Night system mosaic transition bg color fix

This commit is contained in:
scawful
2024-11-28 15:38:57 -05:00
parent 8a76b19e07
commit 425ec1d1e1
2 changed files with 153 additions and 158 deletions

View File

@@ -1681,151 +1681,148 @@ NewOverworld_FinishTransGfx:
CheckForChangeGraphicsTransitionLoad: CheckForChangeGraphicsTransitionLoad:
{ {
; Are we currently in a mosaic? ; Are we currently in a mosaic?
LDA.b $11 : CMP.b #$0F : BEQ .mosaic LDA.b $11 : CMP.b #$0F : BEQ .mosaic
; Are we entering a special area? ; Are we entering a special area?
CMP.b #$1A : BEQ .mosaic CMP.b #$1A : BEQ .mosaic
; Are we leaving a special area? ; Are we leaving a special area?
CMP.b #$26 : BEQ .mosaic CMP.b #$26 : BEQ .mosaic
; Just a normal transition, Not a mosaic. ; Just a normal transition, Not a mosaic.
LDA.l Pool_EnableAnimated : BEQ .dontUpdateAnimated1 LDA.l Pool_EnableAnimated : BEQ .dontUpdateAnimated1
; Check to see if we need to update the animated tiles ; Check to see if we need to update the animated tiles
; by checking what was previously loaded. ; by checking what was previously loaded.
JSL ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated1 JSL ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated1
STA.w AnimatedTileGFXSet : DEC : TAY STA.w AnimatedTileGFXSet : DEC : TAY
; This forces the game toupdate the animated tiles ; This forces the game toupdate the animated tiles
; when going from one area to another. ; when going from one area to another.
JSL DecompOwAnimatedTiles JSL DecompOwAnimatedTiles
.dontUpdateAnimated1 .dontUpdateAnimated1
LDA.w Pool_EnableMainPalette : BEQ .dontUpdateMain1 LDA.w Pool_EnableMainPalette : BEQ .dontUpdateMain1
; Check to see if we need to update the main palette by ; Check to see if we need to update the main palette by
; checking what was previously loaded. ; checking what was previously loaded.
LDX.b $8A LDX.b $8A
LDA.w Pool_MainPaletteTable, X : CMP.w $0AB3 : BEQ .dontUpdateMain1 LDA.w Pool_MainPaletteTable, X : CMP.w $0AB3 : BEQ .dontUpdateMain1
STA.w $0AB3 STA.w $0AB3
; Run the modified routine that loads the buffer ; Run the modified routine that loads the buffer
; and normal color ram. ; and normal color ram.
JSL Palette_OverworldBgMain2 JSL Palette_OverworldBgMain2
.dontUpdateMain1 .dontUpdateMain1
LDA.w Pool_EnableBGColor : BEQ .dontUpdateBGColor1 LDA.w Pool_EnableBGColor : BEQ .dontUpdateBGColor1
REP #$30 ; Set A, X, and Y in 16bit mode. REP #$30 ; Set A, X, and Y in 16bit mode.
LDA.b $8A : ASL : TAX ; Get area code and times it by 2. LDA.b $8A : ASL : TAX ; Get area code and times it by 2.
; Where ZS saves the array of palettes ; Where ZS saves the array of palettes
LDA.w Pool_BGColorTable, X LDA.w Pool_BGColorTable, X
JSL Oracle_BackgroundFix JSL Oracle_BackgroundFix
NOP #8 NOP #8
;STA.l $7EC300 : STA.l $7EC500 ;STA.l $7EC300 : STA.l $7EC500
;STA.l $7EC540 : STA.l $7EC340 ;STA.l $7EC540 : STA.l $7EC340
SEP #$30 ; Set A, X, and Y in 8bit mode. SEP #$30 ; Set A, X, and Y in 8bit mode.
; Don't update the CRAM until later when the overlays are ; Don't update the CRAM until later when the overlays are
; loaded so that way the BG overlays have a chance to hide ; loaded so that way the BG overlays have a chance to hide
; the cracks. ; the cracks.
;INC.b $15 ;INC.b $15
.dontUpdateBGColor1 .dontUpdateBGColor1
RTS RTS
.mosaic .mosaic
; Check to see if we need to update the animated tiles by checking what ; Check to see if we need to update the animated tiles by checking what
; was previously loaded. ; was previously loaded.
JSL ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated2 JSL ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated2
STA.w AnimatedTileGFXSet : DEC : TAY STA.w AnimatedTileGFXSet : DEC : TAY
; This forces the game to update the animated tiles when going ; This forces the game to update the animated tiles when going
; from one area to another. ; from one area to another.
JSL DecompOwAnimatedTiles JSL DecompOwAnimatedTiles
.dontUpdateAnimated2 .dontUpdateAnimated2
; Check to see if we need to update the main palette by checking ; Check to see if we need to update the main palette by checking
; what was previously loaded. ; what was previously loaded.
LDX.b $8A LDX.b $8A
LDA.w Pool_MainPaletteTable, X : CMP.w $0AB3 : BEQ .dontUpdateMain2 LDA.w Pool_MainPaletteTable, X : CMP.w $0AB3 : BEQ .dontUpdateMain2
STA.w $0AB3 STA.w $0AB3
; Run the vanilla routine that only loads the buffer. ; Run the vanilla routine that only loads the buffer.
JSL Palette_OverworldBgMain JSL Palette_OverworldBgMain
.dontUpdateMain2 .dontUpdateMain2
REP #$30 ; Set A, X, and Y in 16bit mode. REP #$30 ; Set A, X, and Y in 16bit mode.
; $0181 is the exit room number used for getting into the under the bridge ; $0181 is the exit room number used for getting into the under the bridge
; area. ; area.
LDA.b $A0 : CMP.w #$0181 : BNE .notBridge LDA.b $A0 : CMP.w #$0181 : BNE .notBridge
LDA.w Pool_BGColorTable_Bridge LDA.w Pool_BGColorTable_Bridge
BRA .storeColor
BRA .storeColor .notBridge
.notBridge LDA.b $8A : ASL : TAX ; Get area code and times it by 2.
LDA.w Pool_BGColorTable, X ; Where ZS saves the array of palettes.
LDA.b $8A : ASL : TAX ; Get area code and times it by 2. .storeColor
LDA.w Pool_BGColorTable, X ; Where ZS saves the array of palettes. ; Set transparent color. only set the buffer so it fades in right
; during mosaic transition.
STA $7EE018
JSL Oracle_MosaicFix
;STA.l $7EC300 : STA.l $7EC340
.storeColor LDX.w #$4020 : STX.b $9C
LDX.w #$8040 : STX.b $9D
LDX.w #$4F33
LDY.w #$894F
; Change the fixed color depending on our sub screen overlay.
; Lost woods and skull woods.
JSL ReadOverlayArray : CMP.w #$009D : BEQ .noSpecialColor
CMP.w #$0040 : BEQ .noSpecialColor
; Pyramid area.
CMP.w #$0096 : BEQ .specialColor
LDX.w #$4C26
LDY.w #$8C4C
; LW death mountain.
CMP.w #$0095 : BEQ .specialColor
LDX.w #$4A26
LDY.w #$874A
; DW death mountain.
CMP.w #$009C : BEQ .specialColor
BRA .noSpecialColor
.specialColor
; Set transparent color. only set the buffer so it fades in right STX.b $9C
; during mosaic transition. STY.b $9D
JSL Oracle_MosaicFix .noSpecialColor
NOP #4 SEP #$30 ; Set A, X, and Y in 8bit mode.
;STA.l $7EC300
;STA.l $7EC340
LDX.w #$4020 : STX.b $9C ; Don't update the CRAM until later when the overlays are loaded so
LDX.w #$8040 : STX.b $9D ; that way the BG overlays have a chance to hide the cracks.
LDX.w #$4F33 ;INC.b $15
LDY.w #$894F
; Change the fixed color depending on our sub screen overlay.
; Lost woods and skull woods.
JSL ReadOverlayArray : CMP.w #$009D : BEQ .noSpecialColor
CMP.w #$0040 : BEQ .noSpecialColor
; Pyramid area.
CMP.w #$0096 : BEQ .specialColor
LDX.w #$4C26
LDY.w #$8C4C
; LW death mountain.
CMP.w #$0095 : BEQ .specialColor
LDX.w #$4A26
LDY.w #$874A
; DW death mountain.
CMP.w #$009C : BEQ .specialColor
BRA .noSpecialColor
.specialColor
STX.b $9C ; PLACE CUSTOM GFX LOAD HERE!
STY.b $9D ;JML CheckForChangeGraphicsTransitionLoadCastle
.noSpecialColor
SEP #$30 ; Set A, X, and Y in 8bit mode.
; Don't update the CRAM until later when the overlays are loaded so CheckForChangeGraphicsTransitionLoadRetrun:
; that way the BG overlays have a chance to hide the cracks.
;INC.b $15
; PLACE CUSTOM GFX LOAD HERE! RTS
;JML CheckForChangeGraphicsTransitionLoadCastle
CheckForChangeGraphicsTransitionLoadRetrun: SkipOverworld_FinishTransGfx_firstHalf:
RTS ; Move on to next submodule.
INC.b $11
SkipOverworld_FinishTransGfx_firstHalf: RTS
; Move on to next submodule.
INC.b $11
RTS
} }
; The following 2 functions are copied from the palettes.asm but they only ; The following 2 functions are copied from the palettes.asm but they only
@@ -2152,36 +2149,51 @@ Overworld_LoadBGColorAndSubscreenOverlay:
assert pc() <= $0BFFA8 ; $05FFA8 assert pc() <= $0BFFA8 ; $05FFA8
pullpc pullpc
print "ReplaceBGColor: ", pc print pc
ReplaceBGColor: ReplaceBGColor:
{ {
PHB : PHK : PLB PHB : PHK : PLB
; TODO: This may need to check if we are in a warp and then if so load the SEP #$20 ; Set A in 8bit mode.
; custom color. If not, then chceck if its enabled or not. LDA.w Pool_EnableBGColor : BNE .custom
;SEP #$20 ; Set A in 8bit mode. REP #$20 ; Set A in 16bit mode.
PLB
;LDA.w Pool_EnableBGColor : BNE .custom RTL
;REP #$20 ; Set A in 16bit mode. .custom
;PLB
;RTL
;.custom
;REP #$20 ; Set A in 16bit mode.
REP #$20 ; Set A in 16bit mode.
PHY
LDA.b $8A : ASL : TAX ; Get area code and times it by 2. LDA.b $8A : ASL : TAX ; Get area code and times it by 2.
LDA.w Pool_BGColorTable, X ; Get the color. LDA.w Pool_BGColorTable, X ; Get the color.
; ORACLE TIME SYSTEM ; ORACLE TIME SYSTEM
STA $7EE018 STA $7EE018
JSL Oracle_BackgroundFix ; $3482DD ; Background Fix JSL Oracle_BackgroundFix ; $3482DD ; Background Fix
;STA.l $7EC300 : STA.l $7EC340 ; Set the BG color. ;STA.l $7EC300 : STA.l $7EC340 ; Set the BG color.
STA.l $7EC500 : STA.l $7EC540 STA.l $7EC500 : STA.l $7EC540
TAY ; Save the color.
SEP #$20 ; Set A in 8bit mode.
; TODO: Check if this is needed. I think it is. If not, it should always
; set the buffer too. If not the warp fades into the wrong color for a
; second.
; Only set the buffer color during warps.
LDA.b $11 : CMP.b #$23 : BNE .notWarp
REP #$20 ; Set A in 16bit mode.
TYA
; Set the BG color buffer.
STA.l $7EE018
JSL Oracle_BackgroundFix
; STA.l $7EC300
STA.l $7EC340
.notWarp
REP #$20 ; Set A in 16bit mode.
PLY
PLB PLB
RTL RTL
@@ -2246,8 +2258,10 @@ InitColorLoad2:
LDA.w Pool_BGColorTable, X ; Get the color. LDA.w Pool_BGColorTable, X ; Get the color.
.storeColor .storeColor
STA.l $7EE018
JSL Oracle_BackgroundFix JSL Oracle_BackgroundFix
STA.l $7EC300 : STA.l $7EC340 ; Set transparent color. ; STA.l $7EC300
STA.l $7EC340 ; Set transparent color.
;STA.l $7EC500 : STA.l $7EC540 ;STA.l $7EC500 : STA.l $7EC540
INC.b $15 INC.b $15

View File

@@ -439,8 +439,8 @@ CheckIfNight:
LDA.l $7EF3C5 LDA.l $7EF3C5
RTL RTL
.night_time .night_time
LDA.b #$03 LDA.b #$03
RTL RTL
} }
ColorBgFix: ColorBgFix:
@@ -451,6 +451,7 @@ ColorBgFix:
LDA.b $10 : CMP.b #$17 : BEQ .vanilla LDA.b $10 : CMP.b #$17 : BEQ .vanilla
REP #$30 REP #$30
PLA PLA
STA.l !pal_color
JSL ColorSubEffect JSL ColorSubEffect
STA.l PaletteCgram_HUD STA.l PaletteCgram_HUD
STA.l PaletteCgram_BG STA.l PaletteCgram_BG
@@ -519,13 +520,13 @@ FixShockPalette:
{ {
PHA PHA
LDA $1B : BNE .indoors LDA $1B : BNE .indoors
PLA PLA
STA !pal_color STA !pal_color
PHX PHX
JSL ColorSubEffect JSL ColorSubEffect
PLX PLX
STA.l PaletteCgram_HUD, X STA.l PaletteCgram_HUD, X
RTL RTL
.indoors .indoors
PLA PLA
RTL RTL
@@ -540,7 +541,6 @@ FixDungeonMapColors:
; Set the time to 8:00am while map is open ; Set the time to 8:00am while map is open
LDA #$08 : STA $7EE000 LDA #$08 : STA $7EE000
LDA #$00 : STA $7EE001 LDA #$00 : STA $7EE001
PLA PLA
STA $7EC229 STA $7EC229
RTL RTL
@@ -588,25 +588,6 @@ org $02AE92
; ========================================================= ; =========================================================
; org $0BFEB6 VANILLA DAY/NIGHT HOOK
; ZS OW - ReplaceBGColor
if ZS_CUSTOM_OW_V2 == 0
org $2886B4
STA !pal_color
JSL BackgroundFix
; NOP #8
endif
; ZS OW - CheckForChangeGraphicsTransitionLoad
if ZS_CUSTOM_OW_V2 == 1
org $289447
JSL SubAreasFix
else
org $2885F9
JSL SubAreasFix
endif
; Subareas background color fix (under the bridge; zora...) ; Subareas background color fix (under the bridge; zora...)
; $0E/D601 8F 00 C3 7E STA $7EC300[$7E:C300] ; $0E/D601 8F 00 C3 7E STA $7EC300[$7E:C300]
; $0E/D605 8F 40 C3 7E STA $7EC340[$7E:C340] ; $0E/D605 8F 40 C3 7E STA $7EC340[$7E:C340]