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

@@ -58,18 +58,18 @@ Menu_Entry:
RTL RTL
} }
.vectors .vectors
dw Menu_InitGraphics ; 00 dw Menu_InitGraphics ; 00
dw Menu_UploadRight ; 01 dw Menu_UploadRight ; 01
dw Menu_UploadLeft ; 02 dw Menu_UploadLeft ; 02
dw Menu_ScrollDown ; 03 dw Menu_ScrollDown ; 03
dw Menu_ItemScreen ; 04 dw Menu_ItemScreen ; 04
dw Menu_ScrollTo ; 05 dw Menu_ScrollTo ; 05
dw Menu_StatsScreen ; 06 dw Menu_StatsScreen ; 06
dw Menu_ScrollFrom ; 07 dw Menu_ScrollFrom ; 07
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,10 +261,9 @@ 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
RTS RTS
} }
@@ -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

@@ -554,10 +554,11 @@ FloorIndicator:
REP #$30 REP #$30
LDA $04A0 : AND.w #$00FF : BEQ .hide_indicator LDA $04A0 : AND.w #$00FF : BEQ .hide_indicator
INC A : CMP.w #$00C0 : BNE .dont_disable INC A : CMP.w #$00C0 : BNE .dont_disable
; if the count up timer reaches 0x00BF frames ; if the count up timer reaches 0x00BF frames
; 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,143 +17,161 @@ 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
LDY #$00 : LDA $7EE000,x
.debut2 .debut
CMP #$0A : BMI .draw LDY #$00 : LDA $7EE000,x
SBC #$0A : INY : BRA .debut2
.draw .debut2
ADC #$90 : CPX #$01 : BEQ .minutes_low CMP #$0A : BMI .draw
STA.l !hud_hours_low SBC #$0A : INY : BRA .debut2
LDA #$30 : STA.l !hud_hours_low+1 ; white palette
BRA .continue_draw ; 04
.minutes_low .draw
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
STA.l !hud_hours_high
LDA #$30 : STA.l !hud_hours_high+1 ; white palette
BRA .finish_draw ; 04
.minutes_high ADC #$90 : CPX #$01 : BEQ .minutes_low
STA.l !hud_min_high STA.l !hud_hours_low
LDA #$30 : STA.l !hud_min_high+1 ; white palette LDA #$30 : STA.l !hud_hours_low+1 ; white palette
.finish_draw 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
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 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 RTS
BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
CMP #$0E ;dialog box?
BEQ .dialog
RTS
.overworld .overworld
LDA $11
CMP #$23 ;hdma transfer? (warping)
BNE .mosaic
.mosaic
CMP #$0D ;mosaic ?
BMI .counter_increasing
RTS
.dialog LDA $11 : CMP #$23 : BNE .mosaic ;hdma transfer? (warping)
LDA $11 ;which kind of dialog? (to prevent the counter from increasing if save menu or item menu openned) ; Lol what?
CMP #$02 ;NPC/signs speech .mosaic
BEQ .counter_increasing
RTS 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 : BEQ .counter_increasing ;NPC/signs speech
RTS
.counter_increasing .counter_increasing
; time speed (1,3,5,7,F,1F,3F,7F,FF)
; #$3F is almost 1 sec = 1 game minute ; time speed (1,3,5,7,F,1F,3F,7F,FF)
LDA $1A : AND #$3F ; 05 ; #$3F is almost 1 sec = 1 game minute
BEQ .increase_minutes LDA $1A : AND #$3F : BEQ .increase_minutes ; 05
.end .end
RTS RTS
.increase_minutes .increase_minutes
LDA $7EE001 : INC A : STA $7EE001 LDA $7EE001 : INC A : STA $7EE001
CMP #$3C : BPL .increase_hours ; minutes = #60 ? CMP #$3C : BPL .increase_hours ; minutes = #60 ?
RTS RTS
.increase_hours .increase_hours
LDA #$00 : STA $7EE001
LDA $7EE000 : INC A : STA $7EE000
CMP #$18 ; hours = #24 ?
BPL .reset_hours
LDA #$00 : STA $7EE001
LDA $7EE000 : INC A : STA $7EE000
CMP #$18 : BPL .reset_hours ; hours = #24 ?
;check indoors/outdoors ;check indoors/outdoors
LDA $1B : BEQ .outdoors0 LDA $1B : BEQ .outdoors0
RTS RTS
.outdoors0
JSL rom_to_buff ;update buffer palette
JSL buff_to_eff ;update effective palette
.outdoors0
JSL rom_to_buff ;update buffer 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 ?
CMP #$97 : BEQ .skip_bg_updt0 ; fog layer? CMP #$97 : BEQ .skip_bg_updt0 ; fog layer?
JSL $0BFE70 ;update background color JSL $0BFE70 ;update background color
BRA .inc_hours_end BRA .inc_hours_end
.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
;check indoors/outdoors LDA #$00 : STA $7EE000
LDA $1B : BEQ .outdoors1
;check indoors/outdoors
LDA $1B : BEQ .outdoors1
RTS RTS
.outdoors1 .outdoors1
JSL rom_to_buff
JSL buff_to_eff JSL rom_to_buff
LDA $8C : CMP #$9F ;rain layer ? JSL buff_to_eff
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
@@ -189,33 +207,36 @@ org $1BEF84
org $0EEE25 ; free space org $0EEE25 ; free space
LoadDayNightPaletteEffect: LoadDayNightPaletteEffect:
{ {
STA.l !pal_color STA.l !pal_color
CPX #$0041 : BPL .title_check CPX #$0041 : BPL .title_check
STA $7EC300,X STA $7EC300,X
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
JSL ColorSubEffect PHX
PLX JSL ColorSubEffect
STA.l $7EC300,X PLX
RTL STA.l $7EC300,X
RTL
} }
;--------------------------------
; =========================================================
ColorSubEffect: ColorSubEffect:
{ {
@@ -226,46 +247,40 @@ ColorSubEffect:
AND #$00FF AND #$00FF
TAX TAX
.do_blue .do_blue
LDA.l !pal_color : AND #$7C00 : STA !blue_value LDA.l !pal_color : AND #$7C00 : STA !blue_value
; 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
LDA #$0400 ; LDA smallest blue value
.blue_sign_change .no_blue_sign_change
LDA #$0400 ; LDA smallest blue value
.no_blue_sign_change
STA.l !blue_value STA.l !blue_value
do_green: do_green:
LDA !pal_color : AND #$03E0 : STA !green_value LDA !pal_color : AND #$03E0 : STA !green_value
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
LDA #$0020 ; LDA smallest green value
.green_sign_change
LDA #$0020 ; LDA smallest green value
.no_green_sign_change .no_green_sign_change
STA.l !green_value STA.l !green_value
.do_red .do_red
LDA.l !pal_color : AND #$001F : STA.l !red_value LDA.l !pal_color : AND #$001F : STA.l !red_value
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
LDA #$0001 ; LDA smallest red value
.red_sign_change .no_red_sign_change
LDA #$0001 ; LDA smallest red value
.no_red_sign_change
STA.l !red_value STA.l !red_value
LDA.l !blue_value LDA.l !blue_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:
@@ -304,9 +321,9 @@ red_table:
BackgroundFix: BackgroundFix:
{ {
BEQ .no_effect ;BRAnch if A=#$0000 (transparent bg) BEQ .no_effect ;BRAnch if A=#$0000 (transparent bg)
JSL ColorSubEffect JSL ColorSubEffect
.no_effect: .no_effect:
STA.l $7EC500 STA.l $7EC500
STA.l $7EC300 STA.l $7EC300
STA.l $7EC540 STA.l $7EC540
@@ -325,18 +342,15 @@ SubAreasFix:
rtl rtl
} }
GlovesFix: GlovesFix:
{ {
STA.l !pal_color STA.l !pal_color
LDA $1B LDA $1B : AND #$00FF : BEQ .outdoors3
AND #$00FF LDA.l !pal_color
BEQ .outdoors3 STA $7EC4FA
LDA.l !pal_color RTL
STA $7EC4FA
RTL
.outdoors3: .outdoors3:
PHX PHX
JSL ColorSubEffect JSL ColorSubEffect
PLX PLX
@@ -346,22 +360,18 @@ GlovesFix:
CheckIfNight: CheckIfNight:
{ {
LDA $7EE000 : CMP.b #$06 LDA $7EE000 : CMP.b #$06 : BCC .night_time
BCC .night_time .day_time
LDA.l $7EF3C5
.day_time RTL
LDA.l $7EF3C5 .night_time
RTL LDA $7EE000 : CMP.b #$14 : BCS .day_time
.night_time LDA.l $7EF3C5
CLC
LDA $7EE000 : CMP.b #$14 ADC #$01
BCS .day_time RTL
LDA.l $7EF3C5
CLC
ADC #$01
RTL
} }
warnpc $0EF3F9 ; free space warnpc $0EF3F9 ; free space
@@ -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