[Day/Night] Cleanup DrawClockToHud, CheckForSongOfTime

This commit is contained in:
scawful
2024-10-07 14:48:54 -04:00
parent b19f2e2de1
commit 0099a81adc

View File

@@ -65,42 +65,30 @@ DrawClockToHudLong:
DrawClockToHud: DrawClockToHud:
{ {
LDX #$00 LDX #$00
.debut .debut
LDY #$00 : LDA $7EE000,x LDY #$00 : LDA $7EE000,x
.debut2
.debut2 CMP #$0A : BMI .draw
CMP #$0A : BMI .draw
SBC #$0A : INY : BRA .debut2 SBC #$0A : INY : BRA .debut2
.draw
.draw ADC #$90 : CPX #$01 : BEQ .minutes_low
STA.l !hud_hours_low
ADC #$90 : CPX #$01 : BEQ .minutes_low LDA #$30 : STA.l !hud_hours_low+1 ; white palette
STA.l !hud_hours_low BRA .continue_draw ; 04
LDA #$30 : STA.l !hud_hours_low+1 ; white palette .minutes_low
BRA .continue_draw ; 04 STA.l !hud_min_low
LDA #$30 : STA.l !hud_min_low+1 ; white palette
.minutes_low .continue_draw
TYA
STA.l !hud_min_low CLC : ADC #$90 : CPX #$01 : BEQ .minutes_high
LDA #$30 : STA.l !hud_min_low+1 ; white palette STA.l !hud_hours_high
LDA #$30 : STA.l !hud_hours_high+1 ; white palette
.continue_draw BRA .finish_draw ; 04
.minutes_high
TYA STA.l !hud_min_high
CLC : ADC #$90 : CPX #$01 : BEQ .minutes_high LDA #$30 : STA.l !hud_min_high+1 ; white palette
STA.l !hud_hours_high .finish_draw
LDA #$30 : STA.l !hud_hours_high+1 ; white palette
BRA .finish_draw ; 04
.minutes_high
STA.l !hud_min_high
LDA #$30 : STA.l !hud_min_high+1 ; white palette
.finish_draw
INX : CPX #$02 : BMI .debut INX : CPX #$02 : BMI .debut
RTS RTS
} }
@@ -114,7 +102,7 @@ RunClock:
LDA $10 ; checks current event in game LDA $10 ; checks current event in game
CMP #$07 : BEQ .counter_increasing ; dungeon/building? CMP #$07 : BEQ .counter_increasing ; dungeon/building?
CMP #$09 : BEQ .overworld ; overworld? CMP #$09 : BEQ .overworld ; overworld?
CMP #$0B : BEQ .overworld ; sub-area ? (under the bridge; zora domain...) CMP #$0B : BEQ .overworld ; special overworld?
CMP #$0E : BEQ .dialog ; dialog box? CMP #$0E : BEQ .dialog ; dialog box?
RTS RTS
.overworld .overworld
@@ -129,7 +117,8 @@ RunClock:
RTS RTS
.dialog .dialog
LDA $11 ; check submodule to prevent the counter from increasing if save/menu open ; check submodule to prevent the counter from increasing if save/menu open
LDA $11
CMP #$02 : BEQ .counter_increasing ; NPC/signs speech CMP #$02 : BEQ .counter_increasing ; NPC/signs speech
RTS RTS
@@ -162,7 +151,6 @@ RunClock:
;check indoors/outdoors ;check indoors/outdoors
LDA $1B : BEQ .outdoors0 LDA $1B : BEQ .outdoors0
RTS RTS
.outdoors0 .outdoors0
JSL RomToPaletteBuffer ; update buffer palette JSL RomToPaletteBuffer ; update buffer palette
@@ -205,15 +193,19 @@ RunClock:
CheckForSongOfTime: CheckForSongOfTime:
{ {
; Check if Song of Time was activated
LDA $FE : CMP.b #$02 : BNE + LDA $FE : CMP.b #$02 : BNE +
; Speed up the time
LDA.b #$00 : STA.l TimeSpeed LDA.b #$00 : STA.l TimeSpeed
; If we reached 6am
LDA.l Hours : CMP.b #$06 : BNE ++ LDA.l Hours : CMP.b #$06 : BNE ++
LDA.l Minutes : BNE ++ LDA.l Minutes : BNE ++
LDA.b #$3F : STA.l TimeSpeed LDA.b #$3F : STA.l TimeSpeed
STZ $FE STZ $FE
++ ++
; If we reached 6pm
LDA.l Hours : CMP.b #$12 : BNE ++ LDA.l Hours : CMP.b #$12 : BNE ++
LDA.l Minutes : BNE ++ LDA.l Minutes : BNE ++
LDA.b #$3F : STA.l TimeSpeed LDA.b #$3F : STA.l TimeSpeed