Merge branch 'OWMain' into overworld_kara

This commit is contained in:
2021-11-08 00:09:02 -08:00
10 changed files with 126 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
; Normal doors use $FE to store the trap door indicator ; Normal doors use $FE to store the trap door indicator
; Normal doors use $045e to store Y coordinate when transitioning to in-room stairs ; Normal doors use $045e to store Y coordinate when transitioning to in-room stairs
; Normal doors use $045f to determine the order in which supertile quadrants are drawn ; Normal doors use $045f to determine the order in which supertile quadrants are drawn
; Straight stairs use $046d to store X coordinate on animation start
; Spiral doors use $045e to store stair type ; Spiral doors use $045e to store stair type
; Gfx uses $b1 to for sub-sub-sub-module thing ; Gfx uses $b1 to for sub-sub-sub-module thing

View File

@@ -681,6 +681,8 @@ db $00,$07,$20,$20,$07,$07,$07,$07,$07,$20,$20,$07,$20,$20,$20,$20
db $07,$07,$02,$02,$02,$02,$07,$07,$07,$20,$20,$07,$20,$20,$20,$07 db $07,$07,$02,$02,$02,$02,$07,$07,$07,$20,$20,$07,$20,$20,$20,$07
;27f300 ;27f300
DungeonTilesets:
db $04,$04,$05,$12,$04,$08,$07,$0C,$09,$0B,$05,$0A,$0D,$0E,$06,$06
; ;
;org $27ff00 ;org $27ff00

View File

@@ -186,9 +186,9 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando ; Conditionally disable UW music changes in Door Rando
org $028ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) org $028ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$10 JSL.l Underworld_DoorDown_Entry : CPX #$FF
db $B0, $21 ; BCS $028B04 BEQ + : db $80, $1C ; BRA $028B04
BRA + : NOP #6 : + NOP #6 : +
org $02C3F2 ; <- Bank02.asm:10521 Unused call org $02C3F2 ; <- Bank02.asm:10521 Unused call
Underworld_DoorDown_Call: Underworld_DoorDown_Call:

View File

@@ -181,7 +181,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamaged: OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb JSL.l IncrementDamageTakenCounter_Arb
JSL.l FlipperKill ;JSL.l FlipperKill
JML.l OHKOTimer JML.l OHKOTimer
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -68,3 +68,70 @@ MysteryWaterFunction: ; *$3AE54 ALTERNATE ENTRY POINT
STZ $0360 STZ $0360
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;===================================================================================================
; More elegant solution
;===================================================================================================
protectff:
LDA.l AllowAccidentalMajorGlitch
BEQ .yes_protect
RTL
.yes_protect
REP #$30
LDA.b $20
AND.w #$1E00
ASL
ASL
ASL
STA.b $06
LDA.b $22
AND.w #$1E00
ORA.b $06
XBA
LSR
TAX
SEP #$30
; Remove dark world bit
; in game table that converts coordinates to actual screen ID
; special case for other areas
LDA.b $8A
BMI .special_overworld
AND.b #$3F
CMP.l $02A4E3,X
BEQ ++
.protect
LDA.b #$15
STA.b $5D
STZ.b $2E
STZ.b $67
LDA.b #$02
STA.b $2F
STZ.w $0112
STZ.w $02E4
STZ.w $0FFC
++ RTL
.special_overworld
CMP.l .spow,X
BNE .protect
RTL
.spow
db $80, $81, $81, $FF, $FF, $FF, $FF, $FF
db $FF, $81, $81, $FF, $FF, $FF, $FF, $FF

View File

@@ -2313,8 +2313,17 @@ JSL.l OnLinkDamagedFromPit
org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D) org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D)
JSL.l OnLinkDamagedFromPitOutdoors JSL.l OnLinkDamagedFromPitOutdoors
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $078F27 ; <- 38F27 org $02B468
JSL.l FlipperReset dw FakeFlipperProtection
org $02FFC7
FakeFlipperProtection:
JSR.w $029485
JSL protectff
RTS
;--------------------------------------------------------------------------------
;org $078F27 ; <- 38F27
;JSL.l FlipperReset
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00) org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00)
JSL.l IgnoreFairyCheck JSL.l IgnoreFairyCheck

View File

@@ -193,14 +193,16 @@ Overworld_MosaicDarkWorldChecks:
; ;
; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown ; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown
Underworld_DoorDown_Entry: Underworld_DoorDown_Entry:
LDA.l DRMode : TAX : LDA $A0 : CPX #0 : BNE .done LDX #$FF ; some junk value to be used later to determine if the below lines will change the track
LDA.l $7EF3C5 : AND.w #$00FF : CMP.w #2 : !BLT .vanilla
LDA.l DRMode : BNE .done
.vanilla ; thing we wrote over .vanilla ; thing we wrote over
CMP.w #$0012 : BNE + LDA $A0 : CMP.w #$0012 : BNE +
LDX.b #$14 ; value for Sanc music LDX.b #$14 ; value for Sanc music
BRA .done BRA .done
+ CMP.w #$0002 : BNE .done + LDA $A2 : CMP.w #$0012 : BNE .done
LDX.b #$10 ; value for Hyrule Castle music LDX.b #$10 ; value for Hyrule Castle music
.done .done
RTL LDA $A0 : RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -150,15 +150,14 @@ LoadRoomVert:
.notEdge .notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal lda $01 : and #$03 : cmp #$03 : bne .normal
jsr ScrollToInroomStairs jsr ScrollToInroomStairs
stz $046d
bra .end bra .end
.normal .normal
ldy #$01 : jsr ShiftVariablesMainDir ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal jsr PrepScrollToNormal
.scroll .scroll
lda $01 : and #$40 : pha lda $01 : and #$40 : sta $046d
jsr ScrollX jsr ScrollX
pla : beq .end
ldy #$00 : jsr ApplyScroll
.end .end
plb ; restore db register plb ; restore db register
rts rts
@@ -291,6 +290,11 @@ StraightStairsAdj:
stx $0464 : sty $012e ; what we wrote over stx $0464 : sty $012e ; what we wrote over
lda.l DRMode : beq + lda.l DRMode : beq +
lda $045e : bne .toInroom lda $045e : bne .toInroom
lda $046d : beq .noScroll
sta $22
ldy #$00 : jsr ApplyScroll
stz $046d
.noScroll
jsr GetTileAttribute : tax jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++ lda $a2 : cmp #$51 : bne ++
@@ -338,9 +342,10 @@ db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix: StraightStairsFix:
{ {
pha
lda.l DRMode : bne + lda.l DRMode : bne +
!add $20 : sta $20 ;what we wrote over pla : !add $20 : sta $20 : rtl ;what we wrote over
+ rtl + pla : rtl
} }
StraightStairLayerFix: StraightStairLayerFix:

View File

@@ -35,6 +35,10 @@ db #$b0 ; BCS to replace BEQ
org $06907f ; < 3107f - sprite_prep.asm:2170 (LDA $7EF3CA) org $06907f ; < 3107f - sprite_prep.asm:2170 (LDA $7EF3CA)
lda $8a : and.b #$40 lda $8a : and.b #$40
; override Link speed with Old Man following
org $09a32e ; < bank_09.asm:7457 (LDA.b #$0C : STA.b $5E)
jsl OWOldManSpeed
; Dark Bonk Rocks Rain Sequence Guards (allowing Tile Swap on Dark Bonk Rocks) ; Dark Bonk Rocks Rain Sequence Guards (allowing Tile Swap on Dark Bonk Rocks)
;org $09c957 ; <- 4c957 ;org $09c957 ; <- 4c957
;dw #$cb5f ; matches value on Central Bonk Rocks screen ;dw #$cb5f ; matches value on Central Bonk Rocks screen
@@ -160,6 +164,22 @@ OWSmithAccept:
clc : rtl clc : rtl
+ sec : rtl + sec : rtl
} }
OWOldManSpeed:
{
lda $1b : beq .outdoors
lda $a0 : and #$fe : cmp #$f0 : beq .vanilla ; if in cave where you find Old Man
bra .normalspeed
.outdoors
lda $8a : cmp #$03 : beq .vanilla ; if on WDM screen
.normalspeed
lda $5e : cmp #$0c : rtl
stz $5e : rtl
.vanilla
lda #$0c : sta $5e ; what we wrote over
rtl
}
org $aa9000 org $aa9000
OWEdgeTransition: OWEdgeTransition:

View File

@@ -168,7 +168,11 @@ ScrollX: ;change the X offset variables
pla : sta $00 pla : sta $00
sep #$30 sep #$30
lda $04 : sta $22 lda $04 : ldx $046d : bne .straight
sta $22 : bra +
.straight
sta $046d ; set X position later
+
lda $00 : sta $23 : sta $0609 : sta $060d lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9 lda $01 : sta $a9
lda $0e : asl : ora $ac : sta $ac lda $0e : asl : ora $ac : sta $ac