Refactor Time System: Introduce TimeState struct and modularize RunClock

This commit is contained in:
scawful
2025-11-22 19:10:15 -05:00
parent 52a5ed4b02
commit 93bd42be8b
10 changed files with 665 additions and 655 deletions

View File

@@ -1,4 +1,3 @@
struct Sprite $7E0BA0
{
.BulletProof: skip 16
@@ -61,3 +60,16 @@ struct Sprite $7E0BA0
}
endstruct
struct TimeState $7EE000
{
.Hours: skip 1
.Minutes: skip 1
.Speed: skip 1
.Padding: skip 13 ; Pad to $7EE010
.BlueVal: skip 2
.GreenVal: skip 2
.RedVal: skip 2
.TempColor: skip 2
.SubColor: skip 2
}
endstruct

View File

@@ -43,7 +43,7 @@ HouseTag_Main:
HouseTag_TelepathicPlea:
{
LDA.b #$08 : STA $7EE000 ; Set the time to 8:00am
LDA.b #$08 : STA.l TimeState.Hours ; Set the time to 8:00am
LDA.b #$03 : STA.w $012C ; Play the deku tree music
; Set Link's coordinates to this specific position.

View File

@@ -27,7 +27,7 @@ UpdateBunnyPalette:
.loop
LDA.l bunny_palette, X
PHX
STA.l !SubPalColor
STA.l TimeState.SubColor
JSL ColorSubEffect
PLX
STA $7EC6E0, X

View File

@@ -15,7 +15,7 @@ UpdateDekuPalette:
.loop
LDA.l deku_palette, X
PHX
STA.l !SubPalColor
STA.l TimeState.SubColor
JSL ColorSubEffect
PLX
STA $7EC6E0, X

View File

@@ -11,7 +11,7 @@ UpdateWolfPalette:
.loop
LDA.l WolfPalette, X
PHX
STA.l !SubPalColor
STA.l TimeState.SubColor
JSL ColorSubEffect
PLX
STA $7EC6E0, X

View File

@@ -19,7 +19,7 @@ UpdateZoraPalette:
.loop
LDA.l zora_palette, X
PHX
STA.l !SubPalColor
STA.l TimeState.SubColor
JSL ColorSubEffect
PLX
STA $7EC6E0, X

View File

@@ -58,7 +58,7 @@ PlaytimeLabel:
Menu_DrawHourDigit:
{
SEP #$30
LDA.l $7EE000
LDA.l TimeState.Hours
ASL A : ASL A
TAX
REP #$30
@@ -71,7 +71,7 @@ Menu_DrawHourDigit:
Menu_DrawMinuteDigit:
{
SEP #$30
LDA.l $7EE001
LDA.l TimeState.Minutes
ASL A : ASL A
TAX
REP #$30

View File

@@ -37,6 +37,7 @@
; =========================================================
incsrc "Util/macros.asm"
incsrc "Core/structs.asm"
incsrc "Overworld/ZSCustomOverworld.asm"
%log_end("ZSCustomOverworld.asm", !LOG_OVERWORLD)

View File

@@ -3176,7 +3176,7 @@ CheckForChangeGraphicsTransitionLoad:
; Where ZS saves the array of palettes
LDA.w Pool_BGColorTable, X
STA.l $7EE018
STA.l TimeState.SubColor
JSL Oracle_BackgroundFix
; STA.l $7EC300 : STA.l $7EC500
; STA.l $7EC540 : STA.l $7EC340
@@ -3238,7 +3238,7 @@ CheckForChangeGraphicsTransitionLoad:
; Set transparent color. only set the buffer so it fades in right
; during mosaic transition.
STA.l $7EE018
STA.l TimeState.SubColor
JSL Oracle_MosaicFix
;STA.l $7EC300 : STA.l $7EC340
@@ -3351,7 +3351,7 @@ Palette_MultiLoad_NonBuffer:
.copyColors
; We're loading A from the address set up in the calling function.
LDA.b [$00]
STA.l $7EE018
STA.l TimeState.SubColor
BEQ +
JSL Oracle_ColorSubEffect
+
@@ -3845,7 +3845,7 @@ ReplaceBGColor:
; Set the BG color buffer.
PLA
STA.l $7EE018
STA.l TimeState.SubColor
JSL Oracle_BackgroundFix ; $3482DD ; Background Fix
; STA.l $7EC300 : STA.l $7EC340 ; Set the BG color.
; STA.l $7EC500 : STA.l $7EC540
@@ -3858,7 +3858,7 @@ ReplaceBGColor:
; Set the BG color.
PLA
STA.l $7EE018
STA.l TimeState.SubColor
JSL Oracle_BackgroundFix
; STA.l $7EC500
; STA.l $7EC540
@@ -3956,7 +3956,7 @@ InitColorLoad2:
.storeColor
; Set transparent color.
STA.l $7EE018 ; Set temp color for tinting
STA.l TimeState.SubColor ; Set temp color for tinting
JSL Oracle_BackgroundFix ; Apply tint and write to buffers
INC.b $15

File diff suppressed because it is too large Load Diff