Day and Night system updates, ZS OW compatible
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
;----------------[ Time system ]----------------
|
;----------------[ Time system ]----------------
|
||||||
@xkas
|
; @xkas
|
||||||
warn xkas off
|
; warn xkas off
|
||||||
lorom
|
lorom
|
||||||
|
|
||||||
; tiles locations on HUD
|
; tiles locations on HUD
|
||||||
!hud_min_low = $7EC798
|
!hud_min_low = $7EC7CC
|
||||||
!hud_min_high = $7EC796
|
!hud_min_high = $7EC7CA
|
||||||
!hud_hours_low = $7EC792
|
!hud_hours_low = $7EC7C6
|
||||||
!hud_hours_high = $7EC790
|
!hud_hours_high = $7EC7C4
|
||||||
!hud_template = $0DFF07
|
!hud_template = $0DFF07
|
||||||
|
|
||||||
org !hud_template
|
org !hud_template
|
||||||
@@ -17,140 +17,137 @@ org !hud_template
|
|||||||
db $6C,$25,$90,$24,$90,$24 ; HUD Template(adjusts timer's color)
|
db $6C,$25,$90,$24,$90,$24 ; HUD Template(adjusts timer's color)
|
||||||
|
|
||||||
org $068361
|
org $068361
|
||||||
JSL $1CFF30
|
JSL HUD_ClockDisplay ; $1CFF30
|
||||||
;originally JSL $09B06E, executed every frame
|
;originally JSL $09B06E, executed every frame
|
||||||
|
|
||||||
org $1CFF30
|
; org $1CFF30
|
||||||
|
org $328000
|
||||||
|
HUD_ClockDisplay:
|
||||||
|
{
|
||||||
JSR counter_preroutine
|
JSR counter_preroutine
|
||||||
LDX #$00
|
LDX #$00
|
||||||
debut:
|
.debut
|
||||||
LDY #$00
|
LDY #$00 : LDA $7EE000,x
|
||||||
LDA $7EE000,x
|
|
||||||
|
|
||||||
debut2:
|
.debut2
|
||||||
CMP #$0A
|
CMP #$0A : BMI .draw
|
||||||
BMI draw
|
SBC #$0A : INY : BRA .debut2
|
||||||
SBC #$0A
|
|
||||||
INY
|
|
||||||
BRA debut2
|
|
||||||
|
|
||||||
draw:
|
.draw
|
||||||
adc #$90
|
ADC #$90 : CPX #$01 : BEQ .minutes_low
|
||||||
CPX #$01
|
|
||||||
BEQ minutes_low
|
|
||||||
STA !hud_hours_low
|
STA !hud_hours_low
|
||||||
BRA 04
|
LDA #$30 : STA !hud_hours_low+1 ; white palette
|
||||||
|
BRA .continue_draw ; 04
|
||||||
|
|
||||||
minutes_low:
|
.minutes_low
|
||||||
STA !hud_min_low
|
STA !hud_min_low
|
||||||
tya
|
LDA #$30 : STA !hud_min_low+1 ; white palette
|
||||||
clc
|
.continue_draw
|
||||||
adc #$90
|
TYA
|
||||||
CPX #$01
|
CLC : ADC #$90 : CPX #$01
|
||||||
BEQ minutes_high
|
BEQ .minutes_high
|
||||||
STA !hud_hours_high
|
STA !hud_hours_high
|
||||||
BRA 04
|
LDA #$30 : STA !hud_hours_high+1 ; white palette
|
||||||
|
BRA .finish_draw ; 04
|
||||||
|
|
||||||
minutes_high:
|
.minutes_high
|
||||||
STA !hud_min_high
|
STA !hud_min_high
|
||||||
INX
|
LDA #$30 : STA !hud_min_high+1 ; white palette
|
||||||
CPX #$02
|
.finish_draw
|
||||||
BMI debut
|
INX : CPX #$02 : BMI .debut
|
||||||
JSL $09B06E
|
JSL $09B06E ; Restore Garnish_ExecuteUpperSlots_long
|
||||||
rtl
|
RTL
|
||||||
|
}
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
counter_preroutine:
|
counter_preroutine:
|
||||||
|
{
|
||||||
LDA $10 ;checks current event in game
|
LDA $10 ;checks current event in game
|
||||||
CMP #$07 ;dungeon/building?
|
CMP #$07 ;dungeon/building?
|
||||||
BEQ counter_increasing
|
BEQ .counter_increasing
|
||||||
CMP #$09 ;overworld?
|
CMP #$09 ;overworld?
|
||||||
BEQ overworld
|
BEQ .overworld
|
||||||
CMP #$0B
|
CMP #$0B
|
||||||
BEQ overworld ;sub-area ? (under the bridge; zora domain...)
|
BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
|
||||||
CMP #$0E ;dialog box?
|
CMP #$0E ;dialog box?
|
||||||
BEQ dialog
|
BEQ .dialog
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
overworld:
|
.overworld
|
||||||
LDA $11
|
LDA $11
|
||||||
CMP #$23 ;hdma transfer? (warping)
|
CMP #$23 ;hdma transfer? (warping)
|
||||||
bne mosaic
|
BNE .mosaic
|
||||||
mosaic:
|
.mosaic
|
||||||
CMP #$0D ;mosaic ?
|
CMP #$0D ;mosaic ?
|
||||||
BMI counter_increasing
|
BMI .counter_increasing
|
||||||
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 ;NPC/signs speech
|
||||||
BEQ counter_increasing
|
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 #$05
|
LDA $1A : AND #$3F ; 05
|
||||||
BEQ increase_minutes
|
BEQ .increase_minutes
|
||||||
end:
|
.end
|
||||||
rts
|
|
||||||
|
|
||||||
increase_minutes:
|
|
||||||
LDA $7EE001
|
|
||||||
INC A
|
|
||||||
STA $7EE001
|
|
||||||
CMP #$3C ; minutes = #60 ?
|
|
||||||
BPL increase_hours
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
increase_hours:
|
.increase_minutes
|
||||||
LDA #$00
|
LDA $7EE001 : INC A : STA $7EE001
|
||||||
STA $7EE001
|
CMP #$3C : BPL .increase_hours ; minutes = #60 ?
|
||||||
LDA $7EE000
|
RTS
|
||||||
INC A
|
|
||||||
STA $7EE000
|
.increase_hours
|
||||||
|
LDA #$00 : STA $7EE001
|
||||||
|
LDA $7EE000 : INC A : STA $7EE000
|
||||||
CMP #$18 ; hours = #24 ?
|
CMP #$18 ; hours = #24 ?
|
||||||
BPL reset_hours
|
BPL .reset_hours
|
||||||
|
|
||||||
LDA $1B ;check indoors/outdoors
|
;check indoors/outdoors
|
||||||
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
|
||||||
LDA $8C
|
;rain layer ?
|
||||||
CMP #$9F ;rain layer ?
|
LDA $8C : CMP #$9F : BEQ .skip_bg_updt0
|
||||||
BEQ skip_bg_updt0
|
LDA $8C : CMP #$9E : BEQ .skip_bg_updt0 ; canopy 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
|
LDA #$00 : STA $7EE000
|
||||||
STA $7EE000
|
|
||||||
|
|
||||||
LDA $1B ;check indoors/outdoors
|
;check indoors/outdoors
|
||||||
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
|
LDA $8C : CMP #$9F ;rain layer ?
|
||||||
CMP #$9F ;rain layer ?
|
BEQ .skip_bg_updt1
|
||||||
BEQ skip_bg_updt1
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
print pc
|
||||||
|
|
||||||
;-----------------------------------------------
|
;-----------------------------------------------
|
||||||
;----[ Day / Night system * palette effect ]----
|
;----[ Day / Night system * palette effect ]----
|
||||||
@@ -192,27 +189,24 @@ LoadDayNightPaletteEffect:
|
|||||||
{
|
{
|
||||||
STA !pal_color
|
STA !pal_color
|
||||||
|
|
||||||
CPX #$0041
|
CPX #$0041 : BPL .title_check
|
||||||
BPL title_check
|
|
||||||
STA $7EC300,X
|
STA $7EC300,X
|
||||||
RTL
|
RTL
|
||||||
|
|
||||||
title_check:
|
.title_check
|
||||||
LDA $10
|
LDA $10 : AND #$00FF
|
||||||
AND #$00FF
|
|
||||||
CMP #$0002 ; title or file select screen ?
|
CMP #$0002 ; title or file select screen ?
|
||||||
BPL outin_check
|
BPL .outin_check
|
||||||
|
LDA !pal_color : STA $7EC300,X
|
||||||
|
RTL
|
||||||
|
|
||||||
|
.outin_check
|
||||||
|
LDA $1B : AND #$00FF : BEQ .outdoors2
|
||||||
LDA !pal_color
|
LDA !pal_color
|
||||||
STA $7EC300,X
|
STA $7EC300,X
|
||||||
RTL
|
RTL
|
||||||
|
|
||||||
outin_check:
|
.outdoors2
|
||||||
LDA $1B : AND #$00FF : BEQ outdoors2
|
|
||||||
LDA !pal_color
|
|
||||||
STA $7EC300,X
|
|
||||||
RTL
|
|
||||||
|
|
||||||
outdoors2:
|
|
||||||
PHX
|
PHX
|
||||||
JSL ColorSubEffect
|
JSL ColorSubEffect
|
||||||
PLX
|
PLX
|
||||||
@@ -230,54 +224,46 @@ ColorSubEffect:
|
|||||||
AND #$00FF
|
AND #$00FF
|
||||||
TAX
|
TAX
|
||||||
|
|
||||||
do_blue:
|
.do_blue
|
||||||
LDA !pal_color
|
LDA !pal_color : AND #$7C00 : STA !blue_value
|
||||||
AND #$7C00
|
; substract amount to blue field based on a table
|
||||||
STA !blue_value
|
SEC : SBC blue_table, X : STA !temp_value
|
||||||
SEC
|
|
||||||
SBC blue_table,x ; substract amount to blue field based on a table
|
|
||||||
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 ; overflow ?
|
||||||
BEQ no_blue_sign_change
|
BEQ .no_blue_sign_change
|
||||||
|
|
||||||
blue_sign_change:
|
.blue_sign_change
|
||||||
LDA #$0400 ; LDA smallest blue value
|
LDA #$0400 ; LDA smallest blue value
|
||||||
|
|
||||||
no_blue_sign_change:
|
.no_blue_sign_change
|
||||||
STA !blue_value
|
STA !blue_value
|
||||||
|
|
||||||
do_green:
|
do_green:
|
||||||
LDA !pal_color
|
LDA !pal_color : AND #$03E0 : STA !green_value
|
||||||
AND #$03E0
|
SEC : SBC green_table,x ; substract amount to blue field based on a table
|
||||||
STA !green_value
|
|
||||||
SEC
|
|
||||||
SBC green_table,x ; substract amount to blue field based on a table
|
|
||||||
STA !temp_value
|
STA !temp_value
|
||||||
AND #$03E0 ; mask out everything except the green bits
|
; mask out everything except the green bits
|
||||||
CMP !temp_value ; overflow ?
|
AND #$03E0 : CMP !temp_value ; overflow ?
|
||||||
BEQ no_green_sign_change
|
BEQ .no_green_sign_change
|
||||||
|
|
||||||
green_sign_change:
|
.green_sign_change
|
||||||
LDA #$0020 ; LDA smallest green value
|
LDA #$0020 ; LDA smallest green value
|
||||||
no_green_sign_change:
|
|
||||||
|
.no_green_sign_change
|
||||||
STA !green_value
|
STA !green_value
|
||||||
|
|
||||||
do_red:
|
.do_red
|
||||||
LDA !pal_color
|
LDA !pal_color : AND #$001F : STA !red_value
|
||||||
AND #$001F
|
SEC : SBC red_table,x ; substract amount to red field based on a table
|
||||||
STA !red_value
|
|
||||||
SEC
|
|
||||||
SBC red_table,x ; substract amount to red field based on a table
|
|
||||||
STA !temp_value
|
STA !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 ; overflow ?
|
||||||
BEQ no_red_sign_change
|
BEQ .no_red_sign_change
|
||||||
|
|
||||||
red_sign_change:
|
.red_sign_change
|
||||||
LDA #$0001 ; LDA smallest red value
|
LDA #$0001 ; LDA smallest red value
|
||||||
|
|
||||||
no_red_sign_change:
|
.no_red_sign_change
|
||||||
STA !red_value
|
STA !red_value
|
||||||
|
|
||||||
LDA !blue_value
|
LDA !blue_value
|
||||||
@@ -356,6 +342,31 @@ GlovesFix:
|
|||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckIfNight:
|
||||||
|
{
|
||||||
|
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.l $7EF3C5
|
||||||
|
CLC
|
||||||
|
ADC #$01
|
||||||
|
RTL
|
||||||
|
}
|
||||||
|
|
||||||
|
warnpc $0EF3F9 ; free space
|
||||||
|
|
||||||
|
org $09C4E3
|
||||||
|
JSL CheckIfNight
|
||||||
|
|
||||||
|
|
||||||
; $0BFE70 -> background color loading routine
|
; $0BFE70 -> background color loading routine
|
||||||
;Background color write fix - 16 bytes
|
;Background color write fix - 16 bytes
|
||||||
@@ -364,10 +375,12 @@ GlovesFix:
|
|||||||
;$0B/FEBE 8F 40 C5 7E STA $7EC540
|
;$0B/FEBE 8F 40 C5 7E STA $7EC540
|
||||||
;$0B/FEC2 8F 40 C3 7E STA $7EC340
|
;$0B/FEC2 8F 40 C3 7E STA $7EC340
|
||||||
|
|
||||||
org $0BFEB6
|
; org $0BFEB6
|
||||||
|
org $2886B0 ; ZS OW Expanded
|
||||||
STA !pal_color
|
STA !pal_color
|
||||||
JSL BackgroundFix
|
JSL BackgroundFix
|
||||||
nop #8
|
;NOP #8
|
||||||
|
|
||||||
|
|
||||||
; Subareas background color fix (under the bridge; zora...)
|
; Subareas background color fix (under the bridge; zora...)
|
||||||
;$0E/D601 8F 00 C3 7E STA $7EC300[$7E:C300]
|
;$0E/D601 8F 00 C3 7E STA $7EC300[$7E:C300]
|
||||||
|
|||||||
Reference in New Issue
Block a user