Remove Events, prefer Overworld or Dungeon.
This commit is contained in:
@@ -1,215 +0,0 @@
|
||||
; variables
|
||||
; 7EE00E - Rain Activator
|
||||
; 7EE00D - Rain Deactivator (overridden if rain is activated before the deactivation occurs)
|
||||
; 7EE00C - Activates the overlay animations and nonimmediate rain things
|
||||
; 7EE00F - Activates thunder and indoor ambience (can be set at the same time as the Rain Activator)
|
||||
; 7EE001 - Minutes in the time sequence script
|
||||
; 7EE000 - Hours in the time sequence script
|
||||
; 7EE00B - used to prevent my script from warping if rain is active, 0 allow rain disallow warp, 1 disallow rain allow warp
|
||||
|
||||
;this is my loader for turning the rain on and off
|
||||
; executed on dungoen load (replaced an LDA $7EF3C5 which is read before we return)
|
||||
org $208100
|
||||
LoadRainEffect:
|
||||
{
|
||||
LDA $7EE00E : BNE .On
|
||||
LDA $7EE00D : BNE .Off
|
||||
BRA LoadRainEffect_End
|
||||
|
||||
LoadRainEffect_On:
|
||||
LDA #$01 : STA $7EE00F : STA $7EE00C
|
||||
LDA #$01 : STA $7EE00E
|
||||
BRA LoadRainEffect_End
|
||||
|
||||
LoadRainEffect_Off:
|
||||
LDA #$00
|
||||
STA $7EE00F
|
||||
STA $7EE00C
|
||||
STA $7EE00D
|
||||
BRA LoadRainEffect_End
|
||||
|
||||
LoadRainEffect_End:
|
||||
LDA #$00
|
||||
STA $7EE00E
|
||||
STA $7EE00D
|
||||
LDA $7EF3C5
|
||||
RTL
|
||||
}
|
||||
|
||||
|
||||
org $208200 ; these are executed every frame
|
||||
RainOnTime:
|
||||
LDA $7EE001
|
||||
cmp #$1E
|
||||
bne .End
|
||||
LDA $7EE000
|
||||
cmp #$01
|
||||
bne .End
|
||||
LDA $7EE00B
|
||||
bne .End
|
||||
LDA #$01
|
||||
sta $7EE00E
|
||||
sta $7EE00F
|
||||
RainOnTime_End:
|
||||
rtl
|
||||
|
||||
org $208300 ; these are executed every frame
|
||||
RainOffTime:
|
||||
LDA $7EE001
|
||||
cmp #$1E
|
||||
bne .End
|
||||
LDA $7EE000
|
||||
cmp #$03
|
||||
bne .End
|
||||
LDA #$01
|
||||
sta $7EE00D
|
||||
RainOffTime_End:
|
||||
rtl
|
||||
|
||||
; moved this function to expanded space to change it, don't think i needed to though :()
|
||||
org $20C000
|
||||
LDA $8A : CMP #$70 : BEQ BRANCH_EVIL_SWAMP
|
||||
LDA $7EE00F : BEQ BRANCH_SKIPMOVEMENT
|
||||
|
||||
BRANCH_EVIL_SWAMP:
|
||||
LDA $7EF2F0 ; If misery mire has been opened already, we're done
|
||||
AND #$20
|
||||
BNE BRANCH_SKIPMOVEMENT
|
||||
LDA $1A ; Check the frame counter.
|
||||
CMP #$03 ; On the third frame do a flash of lightning.
|
||||
BEQ BRANCH_LIGHTNING
|
||||
CMP #$05
|
||||
BEQ BRANCH_NORMAL_LIGHT
|
||||
CMP #$24 ; On the #$24-th frame cue the thunder.
|
||||
BEQ BRANCH_THUNDER
|
||||
CMP #$2C ; On the #$2C-th frame bring the light back to normal.
|
||||
BEQ BRANCH_NORMAL_LIGHT
|
||||
CMP #$58 ; On the #$58-th frame cue the lightning
|
||||
BEQ BRANCH_LIGHTNING
|
||||
CMP #$5A ; On the #$5A-th frame
|
||||
BNE BRANCH_MOVEOVERLAY
|
||||
BRANCH_NORMAL_LIGHT:
|
||||
LDA #$72 ; Keep the screen semi-dark.
|
||||
BRA BRANCH_SETBRIGHTNESS
|
||||
BRANCH_THUNDER:
|
||||
LDX #$36
|
||||
STX $012E ; Play the thunder sound when outdoors.
|
||||
BRANCH_LIGHTNING:
|
||||
LDA #$32 ; Make the screen flash with lightning.
|
||||
BRANCH_SETBRIGHTNESS:
|
||||
STA $9A
|
||||
BRANCH_MOVEOVERLAY:
|
||||
LDA $1A ; if the first two bits are set, do nothing
|
||||
AND #$03
|
||||
BNE BRANCH_SKIPMOVEMENT
|
||||
LDA $0494 ; otherwise start moving some rain
|
||||
INC
|
||||
AND #$03
|
||||
STA $0494
|
||||
TAX
|
||||
LDA $E1
|
||||
CLC
|
||||
ADC $02A46D, X
|
||||
; $01246D IN ROM
|
||||
STA $E1
|
||||
LDA $E7
|
||||
CLC
|
||||
ADC $02A471, X
|
||||
; $012471
|
||||
STA $E7
|
||||
BRANCH_SKIPMOVEMENT:
|
||||
RTL
|
||||
|
||||
org $02A4CD ; rain animating overlays, thunder lightning, darkness (can do immediate)
|
||||
JSL $20C000
|
||||
BRA $59
|
||||
|
||||
org $02AC12 ; load overlays OW to OW
|
||||
LDA $7EE00C
|
||||
NOP #2
|
||||
BEQ $03
|
||||
|
||||
org $02AFFC ; load overlays dungeon to OW
|
||||
LDA $7EE00C
|
||||
NOP #06
|
||||
BEQ $03
|
||||
|
||||
org $02838C ; indoor ambience (can do immediate)
|
||||
LDA $7EE00F
|
||||
NOP #02
|
||||
BEQ $1e
|
||||
|
||||
org $02845D ; music routine
|
||||
LDA $7EE00C
|
||||
NOP #02
|
||||
BEQ $02
|
||||
|
||||
org $0284EA ; outdoor ambience
|
||||
LDA $7EE00C
|
||||
NOP #2
|
||||
BEQ $02
|
||||
|
||||
; overworld music routine
|
||||
; modified to use the 'Beginning' music if 7EE00C is not zero (Rain activated)
|
||||
org $02C463
|
||||
PHB : PHK : PLB
|
||||
REP #$10
|
||||
LDA #$02 : STA $00
|
||||
LDX #$0000
|
||||
LDA $7EE00C
|
||||
BNE $25
|
||||
|
||||
LDY #$00C0
|
||||
LDA $7EF3C5
|
||||
CMP #$03
|
||||
BCS $1D
|
||||
|
||||
LDY #$0080
|
||||
LDA $7EF359
|
||||
CMP #$02
|
||||
BCS $12
|
||||
|
||||
LDA #$05
|
||||
STA $00
|
||||
LDY #$0040
|
||||
LDA $7EF3C5
|
||||
CMP #$02
|
||||
BCS $03
|
||||
|
||||
LDY #$0000
|
||||
LDA $C303,Y
|
||||
STA $7F5B00,X
|
||||
INY
|
||||
INX
|
||||
CPX #$0040
|
||||
BNE $F2
|
||||
|
||||
LDY #$0000
|
||||
LDA $C403,Y
|
||||
STA $7F5B00,X
|
||||
INX
|
||||
INY
|
||||
CPY #$0060
|
||||
BNE $F2
|
||||
|
||||
LDA $00
|
||||
STA $7F5B80
|
||||
SEP #$10
|
||||
PLB
|
||||
RTL
|
||||
|
||||
; Overworld beginning music for each OW Screen
|
||||
; changes the music to use heavy rain outside of lost woods, and light rain inside
|
||||
org $02C303
|
||||
db $25,$25,$13,$13,$13,$13,$13,$13
|
||||
db $25,$25,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
db $13,$13,$13,$13,$13,$13,$13,$13
|
||||
|
||||
; executed on dungoen load
|
||||
org $028356 ; replaced an LDA $7EF3C5 which is read before we return
|
||||
JSL $208100
|
||||
@@ -1,187 +0,0 @@
|
||||
; ==============================================================================
|
||||
; NEW: Custom Room Tag to initialize the game without the Uncle sprite.
|
||||
;
|
||||
|
||||
StoryState = $7C
|
||||
|
||||
org $01CC18 ; override routine 0x39 "Holes(7)"
|
||||
JML HouseTag
|
||||
|
||||
org $01CC5A
|
||||
HouseTag_Return:
|
||||
|
||||
org $2F8000
|
||||
HouseTag:
|
||||
{
|
||||
PHX
|
||||
; -------------------------------
|
||||
LDA $7EF3C6 : BNE .game_has_begun
|
||||
JSR HouseTag_Main
|
||||
.game_has_begun
|
||||
; -------------------------------
|
||||
PLX
|
||||
JML HouseTag_Return
|
||||
}
|
||||
|
||||
; ==============================================================================
|
||||
|
||||
HouseTag_Main:
|
||||
{
|
||||
LDA StoryState
|
||||
|
||||
JSL $008781
|
||||
|
||||
dw HouseTag_TelepathicPlea
|
||||
dw HouseTag_WakeUpPlayer
|
||||
dw HouseTag_End
|
||||
}
|
||||
|
||||
; ==============================================================================
|
||||
|
||||
HouseTag_TelepathicPlea:
|
||||
{
|
||||
; -------------------------------
|
||||
; Set Link's coordinates to this specific position.
|
||||
LDA.b #$40 : STA $0FC2
|
||||
LDA.b #$09 : STA $0FC3
|
||||
|
||||
LDA.b #$5A : STA $0FC4
|
||||
LDA.b #$21 : STA $0FC5
|
||||
|
||||
; "Accept our quest, Link!"
|
||||
LDA.b #$1F : LDY.b #$00
|
||||
JSL $05E219
|
||||
INC.b StoryState
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
; ==============================================================================
|
||||
|
||||
HouseTag_WakeUpPlayer:
|
||||
{
|
||||
; Lighten the screen gradually and then wake Link up partially
|
||||
LDA $1A : AND.b #$03 : BNE .delay
|
||||
LDA $9C : CMP.b #$20 : BEQ .colorTargetReached
|
||||
|
||||
DEC $9C : DEC $9D
|
||||
|
||||
.delay
|
||||
RTS
|
||||
|
||||
.colorTargetReached
|
||||
|
||||
INC $0D80, X
|
||||
|
||||
INC $037D
|
||||
INC $037C
|
||||
|
||||
LDA.b #$57 : STA $20
|
||||
LDA.b #$21 : STA $21
|
||||
|
||||
;LDA.b #$01 : STA $02E4
|
||||
|
||||
STZ $02E4 ; awake from slumber
|
||||
INC.b StoryState
|
||||
|
||||
; TODO: Make it so "uncle" respawns when the player dies
|
||||
; and experiences a game over
|
||||
|
||||
; Make it so Link's uncle never respawns in the house again.
|
||||
LDA $7EF3C6 : ORA.b #$10 : STA $7EF3C6
|
||||
|
||||
; Set the game mode
|
||||
LDA #$00 : STA $7EF3C5 ; (0 - intro, 1 - pendants, 2 - crystals)
|
||||
LDA #$00 : STA $7EF3CC ; disable telepathic message
|
||||
LDA #$01 : STA $7EE00E
|
||||
JSL $00FC41 ; fix monsters
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
; ==============================================================================
|
||||
|
||||
HouseTag_End:
|
||||
{
|
||||
LDA $B6 : BNE .hasMetFarore
|
||||
LDA #$00 : STA StoryState
|
||||
|
||||
.hasMetFarore
|
||||
RTS
|
||||
}
|
||||
|
||||
; ==============================================================================
|
||||
; Dying Uncle Code Hook
|
||||
; Uncle won't remove tagalong when interacting
|
||||
|
||||
org $05DF3A
|
||||
LDA.b #$01 : STA $7EF3CC
|
||||
|
||||
; =============================================================================
|
||||
; SRM Start Modifier
|
||||
; Credit: Conn, Euclid, MathOnNapkins
|
||||
|
||||
org $0cdc5a
|
||||
JSR $ffb1
|
||||
|
||||
org $0cffb1
|
||||
; =============================================================================
|
||||
;$3C5: $00: Unset, Will put Link in his bed state at the beginning of the game. (Also can't use sword or shield)
|
||||
; $01: Start in the castle on start up.
|
||||
; $02: Indicates you have completed the first Hyrule Castle dungeon.
|
||||
; $03: Indicates you have beaten Agahnim and are now searching for crystals.
|
||||
; $04 and above: meaningless. Though, you could write code using them to expand the event system perhaps.
|
||||
|
||||
;$3C6: Progress Flags (bitwise)
|
||||
; 00 - Set after your Uncle gives you his gear in the secret passage. Prevents him from showing up there again.
|
||||
; 01 - Indicates that you've touched the dying priest in Sanctuary.
|
||||
; 02 - Set after you bring Zelda to sanctuary?
|
||||
; 03 - Unused? (98% certainty)
|
||||
; 04 - Set after Link's Uncle leaves your house. It's used to prevent him from respawning there.
|
||||
; 05 - Set after you obtain the Book of Mudora (this is a guess)
|
||||
; 06 - Seems to be a persistent flag that toggles between two possible statements that a fortune teller can give you during your "reading".
|
||||
; In other words, don't expect this to stay in one state if you're using fortune tellers. Has no other known purpose.
|
||||
; 07 - Unused? (98% certainty)
|
||||
; 10 - Start value (in house, bed)
|
||||
LDA #$0000
|
||||
STA $7003C5,x
|
||||
|
||||
; =============================================================================
|
||||
;$3C7: Map Icons Indicator 2 (value, not bitwise)
|
||||
; 00 - start value (cross at Hyrule Castle)
|
||||
; 01 - cross at Sahasrala's house
|
||||
; 02 - cross at ruins
|
||||
; 03 - The Three Pendants
|
||||
; 04 - Master Sword in Lost Woods
|
||||
; 05 - Agahnim (skull icon at Hyrule Castle)
|
||||
; 06 - Just crystal 1 shown (Sahasrala's idea)
|
||||
; 07 - All crystals shown
|
||||
; 08 - Agahnim (skull icon at Ganon's Tower)
|
||||
; All values beyond 8 are invalid, it seems.
|
||||
|
||||
;$3C8: Starting Entrance to use. Abbreviations: LH = Link's House - SA = Sanctuary - MC = Mountain Cave - PP = Pyramid of Power in DW
|
||||
; 00 - Start the game in Link's house always.
|
||||
; 01 - SA.
|
||||
; 03 - Secret passage under HC garden (near dying uncle).
|
||||
; 05 - LH or SA or MC.
|
||||
LDA #$0000
|
||||
STA $7003C7,x
|
||||
|
||||
; =============================================================================
|
||||
;$359: Sword you start with
|
||||
; 00 - No sword
|
||||
; 01 - Fighter Sword
|
||||
; 02 - Master Sword
|
||||
; 03 - Tempered Sword
|
||||
; 04 - Golden Sword
|
||||
|
||||
;$35A: Shield you start with
|
||||
; 00 - No shield
|
||||
; 01 - Blue Shield
|
||||
; 02 - Hero's Shield
|
||||
; 03 - Mirror Shield
|
||||
LDA #$0000 ; 01=sword, 02 = shield to start with
|
||||
STA $700359,x
|
||||
|
||||
LDY #$0000
|
||||
RTS
|
||||
@@ -1,161 +0,0 @@
|
||||
;===========================================================
|
||||
; Lost Woods Hack
|
||||
;
|
||||
; Area: 29
|
||||
; East Exit 2A
|
||||
; North Exit 21
|
||||
; South is 31
|
||||
; West is 28
|
||||
;
|
||||
; combo is N(21), W(28), S(31), W(28)
|
||||
;===========================================================
|
||||
|
||||
!NorthArea = #$21
|
||||
!WestArea = #$28
|
||||
!SouthArea = #$31
|
||||
!EastArea = #$2A
|
||||
!ComboCounter = $1CF7 ; ram address to store combo counter
|
||||
|
||||
; ==========================================================
|
||||
|
||||
org $02AA7D
|
||||
JSL LOST_WOOD_HOOK
|
||||
|
||||
; At this stage the accumulator contains area currently in
|
||||
; X contains the area you're moving to.
|
||||
org $A0F000
|
||||
LOST_WOOD_HOOK:
|
||||
{
|
||||
CMP #$29 ; are we in the right area?
|
||||
BEQ begincode
|
||||
|
||||
normalfinish:
|
||||
{
|
||||
LDA $02A5EC, x ; not right area so return.
|
||||
STZ !ComboCounter
|
||||
RTL
|
||||
} ; label normalfinish
|
||||
|
||||
begincode:
|
||||
{
|
||||
CPX !EastArea
|
||||
BEQ normalfinish
|
||||
|
||||
; from here onwards, use the ram address to determine which combo you're up to
|
||||
; this code is pretty repeatable
|
||||
LDA !ComboCounter
|
||||
|
||||
CMP #$00
|
||||
BNE combo1
|
||||
CPX !NorthArea ; did you get it right?
|
||||
BEQ UP_CORRECT
|
||||
STZ !ComboCounter
|
||||
BRA RESOLVE_INCORRECT
|
||||
} ; label begincode
|
||||
|
||||
combo1:
|
||||
{
|
||||
CMP #$01
|
||||
BNE combo2
|
||||
CPX !WestArea ; did you get it right?
|
||||
BEQ LEFT_CORRECT
|
||||
STZ !ComboCounter
|
||||
BRA RESOLVE_INCORRECT
|
||||
} ; label comb1
|
||||
|
||||
|
||||
combo2:
|
||||
{
|
||||
CMP #$02
|
||||
BNE combo3
|
||||
CPX !SouthArea ; did you get it right?
|
||||
BEQ DOWN_CORRECT
|
||||
STZ !ComboCounter
|
||||
BRA RESOLVE_INCORRECT
|
||||
} ; label comb2
|
||||
|
||||
|
||||
combo3:
|
||||
{
|
||||
CPX !WestArea ; did you get it right?
|
||||
BNE RESOLVE_INCORRECT ; we want to load the down area, since we complete the combos
|
||||
LDA #$1B
|
||||
STA $012F ; play fanfare
|
||||
BRA normalfinish
|
||||
|
||||
RESOLVE_INCORRECT:
|
||||
CPX !NorthArea
|
||||
BEQ CASE_UP
|
||||
CPX !WestArea
|
||||
BEQ CASE_LEFT
|
||||
BRA CASE_DOWN
|
||||
} ; label combo3
|
||||
|
||||
DOWN_CORRECT:
|
||||
{
|
||||
INC !ComboCounter
|
||||
CASE_DOWN:
|
||||
DEC $21
|
||||
DEC $21
|
||||
DEC $E7
|
||||
DEC $E7
|
||||
DEC $E9
|
||||
DEC $E9
|
||||
DEC $611
|
||||
DEC $611
|
||||
DEC $613
|
||||
DEC $613
|
||||
LDA $700
|
||||
SEC
|
||||
SBC #$10
|
||||
STA $700
|
||||
BRA all
|
||||
} ; label DOWN_CORRECT
|
||||
|
||||
|
||||
UP_CORRECT:
|
||||
{
|
||||
INC !ComboCounter
|
||||
CASE_UP:
|
||||
INC $21
|
||||
INC $21
|
||||
INC $E7
|
||||
INC $E7
|
||||
INC $E9
|
||||
INC $E9
|
||||
INC $611
|
||||
INC $611
|
||||
INC $613
|
||||
INC $613
|
||||
LDA $700
|
||||
CLC
|
||||
ADC #$10
|
||||
STA $700
|
||||
BRA all
|
||||
} ; label UP_CORRECT
|
||||
|
||||
|
||||
LEFT_CORRECT:
|
||||
{
|
||||
INC !ComboCounter
|
||||
CASE_LEFT:
|
||||
INC $23
|
||||
INC $23
|
||||
INC $E1
|
||||
INC $E1
|
||||
INC $E3
|
||||
INC $E3
|
||||
INC $615
|
||||
INC $615
|
||||
INC $617
|
||||
INC $617
|
||||
INC $700
|
||||
INC $700
|
||||
} ; label LEFT_CORRECT
|
||||
|
||||
all:
|
||||
{
|
||||
LDA #$29 ; load the same area.
|
||||
RTL
|
||||
}
|
||||
} ; label LOST_WOOD_HOOK
|
||||
@@ -1,396 +0,0 @@
|
||||
;----------------[ Time system ]----------------
|
||||
;@xkas
|
||||
lorom
|
||||
|
||||
; tiles locations on HUD
|
||||
!hud_min_low = $7EC798
|
||||
!hud_min_high = $7EC796
|
||||
!hud_hours_low = $7EC792
|
||||
!hud_hours_high = $7EC790
|
||||
!hud_template = $0DFF07
|
||||
|
||||
org !hud_template
|
||||
db $10,$24,$11,$24
|
||||
db $6C,$25
|
||||
db $90,$24,$90,$24
|
||||
db $6C,$25,$90,$24,$90,$24 ; HUD Template(adjusts timer's color)
|
||||
|
||||
org $068361
|
||||
JSL $1CFF30
|
||||
;originally JSL $09B06E, executed every frame
|
||||
|
||||
org $1CFF30
|
||||
JSR counter_preroutine
|
||||
LDX #$00
|
||||
debut:
|
||||
LDY #$00
|
||||
LDA $7EE000,x
|
||||
|
||||
debut2:
|
||||
CMP #$0A
|
||||
BMI draw
|
||||
SBC #$0A
|
||||
INY
|
||||
BRA debut2
|
||||
|
||||
draw:
|
||||
adc #$90
|
||||
CPX #$01
|
||||
BEQ minutes_low
|
||||
STA !hud_hours_low
|
||||
BRA 04
|
||||
|
||||
minutes_low:
|
||||
STA !hud_min_low
|
||||
tya
|
||||
clc
|
||||
adc #$90
|
||||
CPX #$01
|
||||
BEQ minutes_high
|
||||
STA !hud_hours_high
|
||||
BRA 04
|
||||
|
||||
minutes_high:
|
||||
STA !hud_min_high
|
||||
INX
|
||||
CPX #$02
|
||||
BMI debut
|
||||
JSL $09B06E
|
||||
rtl
|
||||
|
||||
;--------------------------------
|
||||
|
||||
counter_preroutine:
|
||||
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
|
||||
RTS
|
||||
|
||||
overworld:
|
||||
LDA $11
|
||||
CMP #$23 ;hdma transfer? (warping)
|
||||
bne mosaic
|
||||
mosaic:
|
||||
CMP #$0D ;mosaic ?
|
||||
BMI counter_increasing
|
||||
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
|
||||
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 #$05
|
||||
BEQ increase_minutes
|
||||
end:
|
||||
rts
|
||||
|
||||
increase_minutes:
|
||||
LDA $7EE001
|
||||
INC A
|
||||
STA $7EE001
|
||||
CMP #$3C ; minutes = #60 ?
|
||||
BPL increase_hours
|
||||
RTS
|
||||
|
||||
increase_hours:
|
||||
LDA #$00
|
||||
STA $7EE001
|
||||
LDA $7EE000
|
||||
INC A
|
||||
STA $7EE000
|
||||
CMP #$18 ; hours = #24 ?
|
||||
BPL reset_hours
|
||||
|
||||
LDA $1B ;check indoors/outdoors
|
||||
BEQ outdoors0
|
||||
RTS
|
||||
|
||||
outdoors0:
|
||||
JSL rom_to_buff ;update buffer palette
|
||||
JSL buff_to_eff ;update effective palette
|
||||
LDA $8C
|
||||
CMP #$9F ;rain layer ?
|
||||
BEQ skip_bg_updt0
|
||||
JSL $0BFE70 ;update background color
|
||||
BRA inc_hours_end
|
||||
|
||||
skip_bg_updt0: ;prevent the sub layer from disappearing ($1D zeroed)
|
||||
JSL $0BFE72
|
||||
inc_hours_end:
|
||||
RTS
|
||||
|
||||
reset_hours:
|
||||
LDA #$00
|
||||
STA $7EE000
|
||||
|
||||
LDA $1B ;check indoors/outdoors
|
||||
BEQ outdoors1
|
||||
RTS
|
||||
outdoors1:
|
||||
JSL rom_to_buff
|
||||
JSL buff_to_eff
|
||||
LDA $8C
|
||||
CMP #$9F ;rain layer ?
|
||||
BEQ skip_bg_updt1
|
||||
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
|
||||
!red_value = $7EE014
|
||||
|
||||
!temp_value = $7EE016
|
||||
!pal_color = $7EE018
|
||||
|
||||
org $02FF80 ; free space on bank $02
|
||||
buff_to_eff:
|
||||
JSR $C769 ; $02:C65F -> palette buffer to effective routine
|
||||
RTL
|
||||
|
||||
rom_to_buff:
|
||||
JSR $AAF4 ; $02:AAF4 -> change buffer palette of trees,houses,rivers,etc.
|
||||
JSR $C692 ; $02:C692 -> rom to palette buffer for other colors
|
||||
RTL
|
||||
|
||||
; part of rom pal to buffer routine
|
||||
;$1B/EF61 9F 00 C3 7E STA $7EC300,x[$7E:C422]
|
||||
;$1B/EF3D 9F 00 C3 7E STA $7EC300,x[$7E:C412]
|
||||
;$1B/EF84 9F 00 C3 7E STA $7EC300,x[$7E:C4B2]
|
||||
|
||||
org $1BEF3D
|
||||
JSL LoadDayNightPaletteEffect
|
||||
|
||||
org $1BEF61
|
||||
JSL LoadDayNightPaletteEffect
|
||||
|
||||
org $1BEF84
|
||||
JSL LoadDayNightPaletteEffect
|
||||
|
||||
org $0EEE25 ; free space
|
||||
LoadDayNightPaletteEffect:
|
||||
{
|
||||
STA !pal_color
|
||||
|
||||
CPX #$0041
|
||||
BPL title_check
|
||||
STA $7EC300,X
|
||||
RTL
|
||||
|
||||
title_check:
|
||||
LDA $10
|
||||
AND #$00FF
|
||||
CMP #$0002 ; title or file select screen ?
|
||||
BPL outin_check
|
||||
LDA !pal_color
|
||||
STA $7EC300,X
|
||||
RTL
|
||||
|
||||
outin_check:
|
||||
LDA $1B : AND #$00FF : BEQ outdoors2
|
||||
LDA !pal_color
|
||||
STA $7EC300,X
|
||||
RTL
|
||||
|
||||
outdoors2:
|
||||
PHX
|
||||
JSL ColorSubEffect
|
||||
PLX
|
||||
STA $7EC300,X
|
||||
RTL
|
||||
}
|
||||
;--------------------------------
|
||||
|
||||
ColorSubEffect:
|
||||
{
|
||||
LDA $7EE000 ; LDA #hours
|
||||
AND #$00FF
|
||||
CLC
|
||||
ADC $7EE000 ; #hours * 2
|
||||
AND #$00FF
|
||||
TAX
|
||||
|
||||
do_blue:
|
||||
LDA !pal_color
|
||||
AND #$7C00
|
||||
STA !blue_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
|
||||
CMP !temp_value ; overflow ?
|
||||
BEQ no_blue_sign_change
|
||||
|
||||
blue_sign_change:
|
||||
LDA #$0400 ; LDA smallest blue value
|
||||
|
||||
no_blue_sign_change:
|
||||
STA !blue_value
|
||||
|
||||
do_green:
|
||||
LDA !pal_color
|
||||
AND #$03E0
|
||||
STA !green_value
|
||||
SEC
|
||||
SBC green_table,x ; substract amount to blue field based on a table
|
||||
STA !temp_value
|
||||
AND #$03E0 ; mask out everything except the green bits
|
||||
CMP !temp_value ; overflow ?
|
||||
BEQ no_green_sign_change
|
||||
|
||||
green_sign_change:
|
||||
LDA #$0020 ; LDA smallest green value
|
||||
no_green_sign_change:
|
||||
STA !green_value
|
||||
|
||||
do_red:
|
||||
LDA !pal_color
|
||||
AND #$001F
|
||||
STA !red_value
|
||||
SEC
|
||||
SBC red_table,x ; substract amount to red field based on a table
|
||||
STA !temp_value
|
||||
AND #$001F ; mask out everything except the red bits
|
||||
CMP !temp_value ; overflow ?
|
||||
BEQ no_red_sign_change
|
||||
|
||||
red_sign_change:
|
||||
LDA #$0001 ; LDA smallest red value
|
||||
|
||||
no_red_sign_change:
|
||||
STA !red_value
|
||||
|
||||
LDA !blue_value
|
||||
ORA !green_value
|
||||
ORA !red_value
|
||||
|
||||
RTL
|
||||
}
|
||||
|
||||
; color_sub_tables : 24 * 2 bytes each = 48 bytes (2 bytes = 1 color sub for each hour)
|
||||
|
||||
blue_table:
|
||||
dw $1000, $1000, $1000, $1000
|
||||
dw $1000, $1000, $1000, $0800
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0400, $0800, $0800
|
||||
dw $0800, $1000, $1000, $1000
|
||||
|
||||
green_table:
|
||||
dw $0100, $0100, $0100, $0100
|
||||
dw $0100, $00C0, $0080, $0040
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0020, $0040, $0080
|
||||
dw $00C0, $0100, $0100, $0100
|
||||
|
||||
red_table:
|
||||
dw $0008, $0008, $0008, $0008
|
||||
dw $0008, $0006, $0004, $0002
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0000, $0000, $0000
|
||||
dw $0000, $0000, $0000, $0002
|
||||
dw $0004, $0006, $0008, $0008
|
||||
|
||||
BackgroundFix:
|
||||
{
|
||||
BEQ .no_effect ;BRAnch if A=#$0000 (transparent bg)
|
||||
JSL ColorSubEffect
|
||||
|
||||
.no_effect:
|
||||
STA $7EC500
|
||||
STA $7EC300
|
||||
STA $7EC540
|
||||
STA $7EC340
|
||||
rtl
|
||||
}
|
||||
|
||||
SubAreasFix:
|
||||
{
|
||||
STA !pal_color
|
||||
PHX
|
||||
JSL ColorSubEffect
|
||||
PLX
|
||||
STA $7EC300
|
||||
STA $7EC340
|
||||
rtl
|
||||
}
|
||||
|
||||
|
||||
GlovesFix:
|
||||
{
|
||||
STA !pal_color
|
||||
LDA $1B
|
||||
AND #$00FF
|
||||
BEQ .outdoors3
|
||||
LDA !pal_color
|
||||
STA $7EC4FA
|
||||
RTL
|
||||
|
||||
.outdoors3:
|
||||
PHX
|
||||
JSL ColorSubEffect
|
||||
PLX
|
||||
STA $7EC4FA
|
||||
RTL
|
||||
}
|
||||
|
||||
|
||||
; $0BFE70 -> background color loading routine
|
||||
;Background color write fix - 16 bytes
|
||||
;$0B/FEB6 8F 00 C5 7E STA $7EC500
|
||||
;$0B/FEBA 8F 00 C3 7E STA $7EC300
|
||||
;$0B/FEBE 8F 40 C5 7E STA $7EC540
|
||||
;$0B/FEC2 8F 40 C3 7E STA $7EC340
|
||||
|
||||
org $0BFEB6
|
||||
STA !pal_color
|
||||
JSL BackgroundFix
|
||||
nop #8
|
||||
|
||||
; Subareas background color fix (under the bridge; zora...)
|
||||
;$0E/D601 8F 00 C3 7E STA $7EC300[$7E:C300]
|
||||
;$0E/D605 8F 40 C3 7E STA $7EC340[$7E:C340]
|
||||
|
||||
org $0ED601
|
||||
JSL SubAreasFix
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Gloves color loading routine
|
||||
;$1B/EE1B C2 30 REP #$30
|
||||
;$1B/EE1D AF 54 F3 7E LDA $7EF354[$7E:F354]
|
||||
;$1B/EE21 29 FF 00 AND #$00FF
|
||||
;$1B/EE24 F0 0F BEQ $0F [$EE35]
|
||||
;$1B/EE26 3A DEC A
|
||||
;$1B/EE27 0A ASL A
|
||||
;$1B/EE28 AA TAX
|
||||
;$1B/EE29 BF F5 ED 1B LDA $1BEDF5,x[$1B:EDF7]
|
||||
;$1B/EE2D 8F FA C4 7E STA $7EC4FA[$7E:C4FA]
|
||||
;$1B/EE31 8F FA C6 7E STA $7EC6FA[$7E:C6FA]
|
||||
;$1B/EE35 E2 30 SEP #$30
|
||||
;$1B/EE37 E6 15 INC $15 [$00:0015]
|
||||
;$1B/EE39 6B RTL
|
||||
|
||||
org $1BEE2D
|
||||
JSL GlovesFix
|
||||
Reference in New Issue
Block a user