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_ScrollUp ; 08
dw Menu_CheckBottle ; 09 dw Menu_CheckBottle ; 09
dw Menu_Exit ; 0A dw Menu_Exit ; 0A
dw Menu_CopyToRight ; 0B dw Menu_InitiateScrollDown ; 0B
; ========================================================= ; =========================================================
; 00 MENU INIT GRAPHICS ; 00 MENU INIT GRAPHICS
@@ -261,7 +261,6 @@ Menu_ScrollTo:
SEP #$20 SEP #$20
JSR Menu_ScrollHorizontal JSR Menu_ScrollHorizontal
BCC .not_done BCC .not_done
INC.w $0200 INC.w $0200
.not_done .not_done
@@ -298,8 +297,6 @@ Menu_ScrollFrom:
Menu_ScrollUp: Menu_ScrollUp:
{ {
JSL $0DFA58 ; HUD_Rebuild_Long
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
SEP #$10 SEP #$10
REP #$20 REP #$20
@@ -377,7 +374,7 @@ Menu_Exit:
; ========================================================= ; =========================================================
; 0B MENU COPY TO RIGHT ; 0B MENU COPY TO RIGHT
Menu_CopyToRight: Menu_InitiateScrollDown:
{ {
REP #$20 REP #$20
@@ -398,7 +395,8 @@ Menu_CopyToRight:
DEX : DEX DEX : DEX
BNE .loop 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 $1000
STA.w $1100 STA.w $1100
STA.w $1200 STA.w $1200
@@ -410,7 +408,15 @@ Menu_CopyToRight:
SEP #$20 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 LDX.b #$3A
.loop1 .loop1
@@ -437,6 +443,8 @@ Menu_CopyToRight:
LDA.b #$08 : STA.w $0200 LDA.b #$08 : STA.w $0200
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
RTS RTS
} }
@@ -444,3 +452,5 @@ menu_frame: incbin "tilemaps/menu_frame.tilemap"
quest_icons: incbin "tilemaps/quest_icons.tilemap" quest_icons: incbin "tilemaps/quest_icons.tilemap"
incsrc "menu_map_names.asm" incsrc "menu_map_names.asm"
incsrc "menu_hud.asm" incsrc "menu_hud.asm"
; =========================================================

View File

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

View File

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

View File

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