fixed clock flash after closing item/quest menu

This commit is contained in:
Jared_Brian_
2024-03-19 18:23:46 -06:00
parent f71e1dc92a
commit c8c062ee89
4 changed files with 193 additions and 170 deletions

View File

@@ -69,7 +69,7 @@ Menu_Entry:
dw Menu_ScrollUp ; 08
dw Menu_CheckBottle ; 09
dw Menu_Exit ; 0A
dw Menu_CopyToRight ; 0B
dw Menu_InitiateScrollDown ; 0B
; =========================================================
; 00 MENU INIT GRAPHICS
@@ -261,7 +261,6 @@ Menu_ScrollTo:
SEP #$20
JSR Menu_ScrollHorizontal
BCC .not_done
INC.w $0200
.not_done
@@ -298,8 +297,6 @@ Menu_ScrollFrom:
Menu_ScrollUp:
{
JSL $0DFA58 ; HUD_Rebuild_Long
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
SEP #$10
REP #$20
@@ -377,7 +374,7 @@ Menu_Exit:
; =========================================================
; 0B MENU COPY TO RIGHT
Menu_CopyToRight:
Menu_InitiateScrollDown:
{
REP #$20
@@ -398,7 +395,8 @@ Menu_CopyToRight:
DEX : DEX
BNE .loop
; TODO: The BPL wasn't working so figure out why and fix it.
; TODO: The BPL wasn't working so figure out why and
; fix it instead of doing this abomination.
STA.w $1000
STA.w $1100
STA.w $1200
@@ -410,7 +408,15 @@ Menu_CopyToRight:
SEP #$20
; The whole HUD fits on 4 rows so I'm only going to copy 4 here.
JSL $0DFA58 ; HUD_Rebuild_Long
; Draw one frame of the clock so it doesn't just
; pop in when scrolling down.
JSL DrawClockToHudLong
; The whole HUD fits on 4 rows so I'm only going to
; copy 4 here. Also we start 2 in because thats the
; left we need to go.
LDX.b #$3A
.loop1
@@ -437,6 +443,8 @@ Menu_CopyToRight:
LDA.b #$08 : STA.w $0200
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
RTS
}
@@ -444,3 +452,5 @@ menu_frame: incbin "tilemaps/menu_frame.tilemap"
quest_icons: incbin "tilemaps/quest_icons.tilemap"
incsrc "menu_map_names.asm"
incsrc "menu_hud.asm"
; =========================================================

View File

@@ -558,6 +558,7 @@ FloorIndicator:
; disable the floor indicator during the next frame.
LDA.w #$0000
.dont_disable
STA $04A0
PHB : PHK : PLB
LDA.w #$251E : STA $7EC7F0

View File

@@ -17,19 +17,29 @@ org $068361
JSL HUD_ClockDisplay ; $1CFF30
;originally JSL $09B06E, executed every frame
; =========================================================
; org $1CFF30
org $328000 ; Free space
HUD_ClockDisplay:
{
JSR RunClock
JSR DrawToHud
JSR DrawClockToHud
JSL $09B06E ; Restore Garnish_ExecuteUpperSlots_long
RTL
}
DrawToHud:
DrawClockToHudLong:
{
JSR DrawClockToHud
RTL
}
DrawClockToHud:
{
LDX #$00
.debut
LDY #$00 : LDA $7EE000,x
@@ -38,66 +48,68 @@ DrawToHud:
SBC #$0A : INY : BRA .debut2
.draw
ADC #$90 : CPX #$01 : BEQ .minutes_low
STA.l !hud_hours_low
LDA #$30 : STA.l !hud_hours_low+1 ; white palette
BRA .continue_draw ; 04
.minutes_low
STA.l !hud_min_low
LDA #$30 : STA.l !hud_min_low+1 ; white palette
.continue_draw
TYA
CLC : ADC #$90 : CPX #$01
BEQ .minutes_high
CLC : ADC #$90 : CPX #$01 : BEQ .minutes_high
STA.l !hud_hours_high
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
RTS
}
;--------------------------------
; =========================================================
RunClock:
{
LDA $10 ;checks current event in game
CMP #$07 ;dungeon/building?
BEQ .counter_increasing
CMP #$09 ;overworld?
BEQ .overworld
CMP #$0B
BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
CMP #$0E ;dialog box?
BEQ .dialog
CMP #$07 : BEQ .counter_increasing ;dungeon/building?
CMP #$09 : BEQ .overworld ;overworld?
CMP #$0B : BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
CMP #$0E : BEQ .dialog ;dialog box?
RTS
.overworld
LDA $11
CMP #$23 ;hdma transfer? (warping)
BNE .mosaic
LDA $11 : CMP #$23 : BNE .mosaic ;hdma transfer? (warping)
; Lol what?
.mosaic
CMP #$0D ;mosaic ?
BMI .counter_increasing
CMP #$0D : BMI .counter_increasing ;mosaic ?
RTS
.dialog
LDA $11 ;which kind of dialog? (to prevent the counter from increasing if save menu or item menu openned)
CMP #$02 ;NPC/signs speech
BEQ .counter_increasing
CMP #$02 : BEQ .counter_increasing ;NPC/signs speech
RTS
.counter_increasing
; time speed (1,3,5,7,F,1F,3F,7F,FF)
; #$3F is almost 1 sec = 1 game minute
LDA $1A : AND #$3F ; 05
BEQ .increase_minutes
LDA $1A : AND #$3F : BEQ .increase_minutes ; 05
.end
RTS
.increase_minutes
@@ -106,18 +118,19 @@ RunClock:
RTS
.increase_hours
LDA #$00 : STA $7EE001
LDA $7EE000 : INC A : STA $7EE000
CMP #$18 ; hours = #24 ?
BPL .reset_hours
CMP #$18 : BPL .reset_hours ; hours = #24 ?
;check indoors/outdoors
LDA $1B : BEQ .outdoors0
RTS
.outdoors0
JSL rom_to_buff ;update buffer palette
JSL buff_to_eff ;update effective palette
;rain layer ?
LDA $8C : CMP #$9F : BEQ .skip_bg_updt0
LDA $8C : CMP #$9E : BEQ .skip_bg_updt0 ; canopy layer ?
@@ -127,33 +140,38 @@ RunClock:
.skip_bg_updt0 ;prevent the sub layer from disappearing ($1D zeroed)
JSL $0BFE72
.inc_hours_end
RTS
.reset_hours
LDA #$00 : STA $7EE000
;check indoors/outdoors
LDA $1B : BEQ .outdoors1
RTS
.outdoors1
JSL rom_to_buff
JSL buff_to_eff
LDA $8C : CMP #$9F ;rain layer ?
BEQ .skip_bg_updt1
LDA $8C : CMP #$9F : BEQ .skip_bg_updt1 ;rain layer ?
LDA $8C : CMP #$9E : BEQ .skip_bg_updt1 ; canopy layer ?
JSL $0BFE70 ;update background color
BRA .reset_end
.skip_bg_updt1 ;prevent the sub layer from disappearing ($1D zeroed)
JSL $0BFE72
.reset_end
RTS
}
;-----------------------------------------------
; =========================================================
;----[ Day / Night system * palette effect ]----
;-----------------------------------------------
; =========================================================
!blue_value = $7EE010
!green_value = $7EE012
@@ -196,26 +214,29 @@ LoadDayNightPaletteEffect:
RTL
.title_check
LDA $10 : AND #$00FF
CMP #$0002 ; title or file select screen ?
BPL .outin_check
; title or file select screen ?
LDA $10 : AND #$00FF : CMP #$0002 : BPL .outin_check
LDA.l !pal_color : STA $7EC300,X
RTL
.outin_check
LDA $1B : AND #$00FF : BEQ .outdoors2
LDA.l !pal_color
STA $7EC300,X
RTL
.outdoors2
PHX
JSL ColorSubEffect
PLX
STA.l $7EC300,X
RTL
}
;--------------------------------
; =========================================================
ColorSubEffect:
{
@@ -231,9 +252,7 @@ ColorSubEffect:
; substract amount to blue field based on a table
SEC : SBC.l blue_table, X : STA !temp_value
AND #$7C00 ; mask out everything except the blue bits
CMP !temp_value ; overflow ?
BEQ .no_blue_sign_change
CMP !temp_value : BEQ .no_blue_sign_change; overflow ?
.blue_sign_change
LDA #$0400 ; LDA smallest blue value
@@ -245,9 +264,7 @@ do_green:
SEC : SBC.l green_table,x ; substract amount to blue field based on a table
STA.l !temp_value
; mask out everything except the green bits
AND #$03E0 : CMP !temp_value ; overflow ?
BEQ .no_green_sign_change
AND #$03E0 : CMP !temp_value : BEQ .no_green_sign_change ; overflow ?
.green_sign_change
LDA #$0020 ; LDA smallest green value
@@ -259,9 +276,7 @@ do_green:
SEC : SBC.l red_table,x ; substract amount to red field based on a table
STA.l !temp_value
AND #$001F ; mask out everything except the red bits
CMP !temp_value ; overflow ?
BEQ .no_red_sign_change
CMP !temp_value : BEQ .no_red_sign_change ; overflow ?
.red_sign_change
LDA #$0001 ; LDA smallest red value
@@ -275,6 +290,8 @@ do_green:
RTL
}
; =========================================================
; color_sub_tables : 24 * 2 bytes each = 48 bytes (2 bytes = 1 color sub for each hour)
blue_table:
@@ -325,13 +342,10 @@ SubAreasFix:
rtl
}
GlovesFix:
{
STA.l !pal_color
LDA $1B
AND #$00FF
BEQ .outdoors3
LDA $1B : AND #$00FF : BEQ .outdoors3
LDA.l !pal_color
STA $7EC4FA
RTL
@@ -346,18 +360,14 @@ GlovesFix:
CheckIfNight:
{
LDA $7EE000 : CMP.b #$06
BCC .night_time
LDA $7EE000 : CMP.b #$06 : BCC .night_time
.day_time
LDA.l $7EF3C5
RTL
.night_time
LDA $7EE000 : CMP.b #$14
BCS .day_time
LDA $7EE000 : CMP.b #$14 : BCS .day_time
LDA.l $7EF3C5
CLC
ADC #$01
@@ -402,7 +412,7 @@ org $2885F9
org $0ED601
JSL SubAreasFix
;--------------------------------
; =========================================================
; Gloves color loading routine
;$1B/EE1B C2 30 REP #$30
@@ -421,3 +431,5 @@ org $0ED601
org $1BEE2D
JSL GlovesFix
; =========================================================

View File

@@ -1,4 +1,4 @@
; ==============================
; =========================================================
; WRAM in Use
org $008000
base $7E0730 ; MAP16OVERFLOW free ram region
@@ -24,7 +24,7 @@ SomariaOrByrna: skip 1
base off
; ==============================
; =========================================================
; SRAM in Use
FishingRod = $7EF38A