diff --git a/doorrando.asm b/doorrando.asm index fe0cc41..7a6c926 100644 --- a/doorrando.asm +++ b/doorrando.asm @@ -9,6 +9,7 @@ ; 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 $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 ; Gfx uses $b1 to for sub-sub-sub-module thing diff --git a/doortables.asm b/doortables.asm index eae1643..90678ca 100644 --- a/doortables.asm +++ b/doortables.asm @@ -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 ;27f300 +DungeonTilesets: +db $04,$04,$05,$12,$04,$08,$07,$0C,$09,$0B,$05,$0A,$0D,$0E,$06,$06 ; ;org $27ff00 diff --git a/drhooks.asm b/drhooks.asm index 1d3b485..a271577 100644 --- a/drhooks.asm +++ b/drhooks.asm @@ -186,9 +186,9 @@ Main_ShowTextMessage: ; Conditionally disable UW music changes in Door Rando org $028ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) -JSL.l Underworld_DoorDown_Entry : CPX #$10 -db $B0, $21 ; BCS $028B04 -BRA + : NOP #6 : + +JSL.l Underworld_DoorDown_Entry : CPX #$FF +BEQ + : db $80, $1C ; BRA $028B04 +NOP #6 : + org $02C3F2 ; <- Bank02.asm:10521 Unused call Underworld_DoorDown_Call: diff --git a/events.asm b/events.asm index 8a1eb81..d2911c8 100644 --- a/events.asm +++ b/events.asm @@ -181,7 +181,7 @@ RTL ;-------------------------------------------------------------------------------- OnLinkDamaged: JSL.l IncrementDamageTakenCounter_Arb - JSL.l FlipperKill + ;JSL.l FlipperKill JML.l OHKOTimer ;-------------------------------------------------------------------------------- diff --git a/flipperkill.asm b/flipperkill.asm index ac782c2..6f8c420 100644 --- a/flipperkill.asm +++ b/flipperkill.asm @@ -68,3 +68,70 @@ MysteryWaterFunction: ; *$3AE54 ALTERNATE ENTRY POINT STZ $0360 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 \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index 794beb2..e2f7230 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2313,8 +2313,17 @@ JSL.l OnLinkDamagedFromPit org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D) JSL.l OnLinkDamagedFromPitOutdoors ;-------------------------------------------------------------------------------- -org $078F27 ; <- 38F27 -JSL.l FlipperReset +org $02B468 +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) JSL.l IgnoreFairyCheck diff --git a/music.asm b/music.asm index 0d8a1dc..3b1b120 100644 --- a/music.asm +++ b/music.asm @@ -193,14 +193,16 @@ Overworld_MosaicDarkWorldChecks: ; ; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown 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 - CMP.w #$0012 : BNE + + LDA $A0 : CMP.w #$0012 : BNE + LDX.b #$14 ; value for Sanc music BRA .done - + CMP.w #$0002 : BNE .done + + LDA $A2 : CMP.w #$0012 : BNE .done LDX.b #$10 ; value for Hyrule Castle music .done - RTL + LDA $A0 : RTL ;-------------------------------------------------------------------------------- diff --git a/normal.asm b/normal.asm index 3bdf962..13323d8 100644 --- a/normal.asm +++ b/normal.asm @@ -150,15 +150,14 @@ LoadRoomVert: .notEdge lda $01 : and #$03 : cmp #$03 : bne .normal jsr ScrollToInroomStairs + stz $046d bra .end .normal ldy #$01 : jsr ShiftVariablesMainDir jsr PrepScrollToNormal .scroll - lda $01 : and #$40 : pha + lda $01 : and #$40 : sta $046d jsr ScrollX - pla : beq .end - ldy #$00 : jsr ApplyScroll .end plb ; restore db register rts @@ -291,6 +290,11 @@ StraightStairsAdj: stx $0464 : sty $012e ; what we wrote over lda.l DRMode : beq + lda $045e : bne .toInroom + lda $046d : beq .noScroll + sta $22 + ldy #$00 : jsr ApplyScroll + stz $046d + .noScroll jsr GetTileAttribute : tax lda $11 : cmp #$12 : beq .goingNorth lda $a2 : cmp #$51 : bne ++ @@ -338,9 +342,10 @@ db $d0, $f6, $10, $1a, $f0, $00 StraightStairsFix: { + pha lda.l DRMode : bne + - !add $20 : sta $20 ;what we wrote over - + rtl + pla : !add $20 : sta $20 : rtl ;what we wrote over + + pla : rtl } StraightStairLayerFix: diff --git a/owrando.asm b/owrando.asm index a36a972..86a6586 100644 --- a/owrando.asm +++ b/owrando.asm @@ -35,6 +35,10 @@ db #$b0 ; BCS to replace BEQ org $06907f ; < 3107f - sprite_prep.asm:2170 (LDA $7EF3CA) 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) ;org $09c957 ; <- 4c957 ;dw #$cb5f ; matches value on Central Bonk Rocks screen @@ -160,6 +164,22 @@ OWSmithAccept: clc : 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 OWEdgeTransition: diff --git a/scroll.asm b/scroll.asm index f66918c..435b5c9 100644 --- a/scroll.asm +++ b/scroll.asm @@ -168,7 +168,11 @@ ScrollX: ;change the X offset variables pla : sta $00 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 $01 : sta $a9 lda $0e : asl : ora $ac : sta $ac