diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 7455ab1..61cd5b6 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -521,6 +521,9 @@ Dungeon_SaveRoomData_justKeys: org $02B861 Dungeon_SaveRoomQuadrantData: +org $02C11D +CalculateTransitionLanding: + org $02D9B9 Underworld_LoadSpawnEntrance: @@ -659,6 +662,9 @@ OverworldMap_DarkWorldTilemap: org $0ABAB9 OverworldMap_LoadSprGfx: +org $8AE817 +DungeonMapBossRooms: + org $0CD7D1 NameFile_MakeScreenVisible: org $0CDB3E diff --git a/doorrando/doorrando.asm b/doorrando/doorrando.asm index 94402b4..2a2ff56 100644 --- a/doorrando/doorrando.asm +++ b/doorrando/doorrando.asm @@ -17,7 +17,7 @@ incsrc drhooks.asm ;Main Code -org $278000 ;138000 +org $A78000 ;138000 db $44, $52 ;DR DRMode: dw 0 @@ -52,7 +52,8 @@ incsrc edges.asm incsrc math.asm incsrc hudadditions.asm incsrc dr_lobby.asm -warnpc $279C00 +incsrc entrance_fixes.asm +warnpc $A79C00 incsrc doortables.asm -warnpc $288000 +warnpc $A88000 diff --git a/doorrando/doortables.asm b/doorrando/doortables.asm index 90678ca..abdd13e 100644 --- a/doorrando/doortables.asm +++ b/doorrando/doortables.asm @@ -1,4 +1,4 @@ -org $279C00 +org $A79C00 KeyDoorOffset: ; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler dw $0000,$0001,$0003,$0000,$0006,$0000,$000b,$0000,$0000,$0000,$000c,$000d,$0010,$0011,$0012,$0000 @@ -18,7 +18,7 @@ dw $01f1,$01f3,$01f7,$0000,$0000,$01f8,$01fa,$0000,$01fd,$0200,$0203,$0204,$0206 dw $0207 -org $279E00 +org $A79E00 SpiralOffset: ; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler db $00,$01,$02,$00,$03,$00,$00,$04,$00,$05,$07,$00,$08,$00,$0b,$00 @@ -37,7 +37,7 @@ db $67,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 db $6a,$6d,$6e,$00,$00,$00,$00,$00,$00,$00,$6f,$00,$00,$00,$00,$00 db $70 -org $279F00 +org $A79F00 DoorOffset: db $00,$01,$02,$00,$03,$00,$04,$00,$00,$00,$00,$00,$9A,$05,$99,$00 db $00,$06,$07,$08,$09,$0A,$0B,$00,$00,$0C,$0D,$0E,$00,$0F,$10,$11 @@ -56,7 +56,7 @@ db $00,$81,$82,$83,$84,$85,$86,$87,$88,$89,$00,$8A,$8B,$00,$8C,$00 db $00,$8D,$8E,$00,$00,$8F,$90,$00,$91,$92,$93,$94,$95,$00,$00,$00 db $9f -org $27A000 +org $A7A000 DoorTable: ;; NW 00 N 01 NE 02 WN 00 W 01 WS 02 SW 00 S 01 SE 02 EN 00 E 01 ES 02 - Door ruler dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Default/Garbage row @@ -226,7 +226,7 @@ dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, ;dw $0072, $4ff8 ; ->HC Map Room ;dw $0080, $1f50 ; ->zelda's cellblock -org $27B000 +org $A7B000 SpiralTable: ;113 4 byte entries - should end at 27B1C4 dw $0203, $8080 ;null row dw $0203, $8080 ;HC Backhallway @@ -309,7 +309,7 @@ dw $0203, $8080 ;East Attic Start dw $0203, $8080 ;Tower Entrance -org $27C000 ;ends around 27C418 +org $A7C000 ;ends around 27C418 PairedDoorTable: dw $0000 ; the bad template dw $0000,$0000 @@ -503,7 +503,7 @@ dw $0000,$0000,$0000,$0000 dw $ffff ; indicates the end - we can drop this ; Edge Transition Table (Target Room, Flags, MultiDiv ratio for edges) -org $27C500 ;ends around 27C5F(9) 4 bytes would be 27C649 +org $A7C500 ;ends around 27C5F(9) 4 bytes would be 27C649 ;I kind of want to split the 3rd byte into two NorthOpenEdge: db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11 @@ -559,11 +559,11 @@ db $01, $02, $03, $04, $05, $06, $0a, $14 ; In-room stairs in North/South pairs. From left to right: ; PoD, IP right side, IP Freezor chest and GT -org $27C700 +org $A7C700 InroomStairsTable: dw $0003,$0003, $0003,$0003, $0003,$0003, $0003,$0003 -org $27C720 +org $A7C720 InroomStairsRoom: db $0B,$1B, $3F,$1F, $7E,$5E, $96,$3D InroomStairsX: @@ -572,7 +572,7 @@ InroomStairsY: dw $0058, $0148, $0198, $0190 -org $27E000 +org $A7E000 CutoffRooms: ; TT Alcove, Mire Bridge Left & Right, Mire Bent Bridge, Mire Hub ; Pod Falling & Harmless, SW Star Pits, TR Lava Escape & TR Dual Pipes, Bob's Room & GT Big Chest @@ -588,7 +588,7 @@ dw $ffff ; dungeon tables ; HC HC EP DP AT SP PD MM SW IP TH TT TR GT -org $27f000 +org $A7f000 CompassBossIndicator: dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 TotalKeys: ;27f020 @@ -603,13 +603,13 @@ TotalLocationsLow: ;27f080 db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07, $00, $00 TotalLocationsHigh: ;27f090 db $00, $00, $00, $00, $00, $01, $01, $00, $00, $00, $00, $00, $01, $02, $00, $00 -org $27f0a0 +org $A7f0a0 TotalLocations: db $08, $08, $06, $06, $02, $0a, $0e, $08, $08, $08, $06, $08, $0c, $1b, $00, $00 ; no more room here ; Vert 0,6,0 Horz 2,0,8 -org $27f0b0 +org $A7f0b0 CoordIndex: ; Horizontal 1st db 2, 0 ; Coordinate Index $20-$23 OppCoordIndex: @@ -631,16 +631,16 @@ dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen ;27f0ce next free byte -org $27f0f0 +org $A7f0f0 RemoveRainDoorsRoom: dw $0060, $0062, $ffff ; ffff indicates end of list -RainDoorMatch: ; org $27f0f6 and f8 for now +RainDoorMatch: ; org $A7f0f6 and f8 for now dw $0081, $0061 ; not xba'd BlockSanctuaryDoorInRain: ;27f0fa dw $0000 -org $27f100 +org $A7f100 TilesetTable: ; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff @@ -680,14 +680,14 @@ db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$14,$20 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 +;A7f300 DungeonTilesets: db $04,$04,$05,$12,$04,$08,$07,$0C,$09,$0B,$05,$0A,$0D,$0E,$06,$06 ; -;org $27ff00 +;org $A7ff00 -org $27fff0 +org $A7fff0 LinksHouseDarkWorld: dw $ffff SanctuaryDarkWorld: diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index 3f786b0..8904c29 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -1,68 +1,70 @@ -org $02b5c4 ; -- moving right routine 135c4 +org $82b5c4 ; -- moving right routine 135c4 jsl WarpRight -org $02b665 ; -- moving left routine +org $82b665 ; -- moving left routine jsl WarpLeft -org $02b713 ; -- moving down routine +org $82b713 ; -- moving down routine jsl WarpDown -org $02b7b4 ; -- moving up routine +org $82b7b4 ; -- moving up routine jsl WarpUp -org $02bd80 +org $82bd80 jsl AdjustTransition nop ;turn off linking doors -- see .notRoomLinkDoor label in Bank02.asm -org $02b5a8 ; <- 135a8 - Bank02.asm : 8368 (LDA $7EC004 : STA $A0) +org $82b5a8 ; <- 135a8 - Bank02.asm : 8368 (LDA $7EC004 : STA $A0) jsl CheckLinkDoorR bcc NotLinkDoor1 -org $02b5b6 +org $82b5b6 NotLinkDoor1: -org $02b649 ; <- 135a8 - Bank02.asm : 8482 (LDA $7EC004 : STA $A0) +org $82b649 ; <- 135a8 - Bank02.asm : 8482 (LDA $7EC004 : STA $A0) jsl CheckLinkDoorL bcc NotLinkDoor2 -org $02b657 +org $82b657 NotLinkDoor2: ; Staircase routine -org $01c3d4 ; <- c3d4 - Bank01.asm : 9762-4 (Dungeon_DetectStaircase-> STA $A0 : LDA $063D, X) +org $81c3d4 ; <- c3d4 - Bank01.asm : 9762-4 (Dungeon_DetectStaircase-> STA $A0 : LDA $063D, X) jsl RecordStairType : nop -org $02a1e7 ;(PC: 121e7) +org $82a1e7 ;(PC: 121e7) jsl SpiralWarp -org $0291b3 ; <- Bank02.asm : 3303 (LDA $0462 : AND.b #$04) +org $8291b3 ; <- Bank02.asm : 3303 (LDA $0462 : AND.b #$04) jsl SpiralPriorityHack : nop -org $0290f9 ; <- Bank02.asm : 3188 (LDA $0462 : AND.b #$04) +org $8290f9 ; <- Bank02.asm : 3188 (LDA $0462 : AND.b #$04) jsl SpiralPriorityHack : nop -org $029369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E) +org $829369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E) jsl StraightStairsAdj : nop #2 -org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20) +org $829383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20) jsl StraightStairsFix : nop -org $0293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20) +org $8293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20) jsl StraightStairsFix : nop -org $0293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA) +org $8293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA) jsl StraightStairsFix : nop -org $029396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X) +org $829396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X) jsl StraightStairLayerFix -org $02c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02) +org $82c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02) jsl DoorToStraight : nop -org $02c092 ; STA $0020, Y : LDX #$00 +org $82c092 ; STA $0020, Y : LDX #$00 jsl DoorToInroom : nop -org $02c0f8 ; CMP $02C034, X +org $82c0f8 ; CMP $02C034, X jsl DoorToInroomEnd -org $02941a ; <- Bank02.asm : 3748 module 7.12.11 (LDA $0464 : BNE BRANCH_$11513 : INC $B0 : RTS) +org $82941a ; <- Bank02.asm : 3748 module 7.12.11 (LDA $0464 : BNE BRANCH_$11513 : INC $B0 : RTS) jsl StraightStairsTrapDoor : rts -org $028b54 ; <- Bank02.asm : 2200 (JSL UseImplicitRegIndexedLocalJumpTable) +org $828b54 ; <- Bank02.asm : 2200 (JSL UseImplicitRegIndexedLocalJumpTable) jsl InroomStairsTrapDoor +org $82c146 +jsl HandleSpecialDoorLanding -org $0289a0 ; JSL $0091C4 +org $8289a0 ; JSL $0091C4 jsl QuadrantLoadOrderBeforeScroll -org $02bd9c ; JSL $0091C4 +org $82bd9c ; JSL $0091C4 jsl QuadrantLoadOrderAfterScroll ; Graphics fix -org $02895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0) +org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0) Splicer: jsl GfxFixer lda $b1 : beq .done @@ -70,147 +72,154 @@ rts nop #5 .done -org $01b618 ; Bank01.asm : 7963 Dungeon_LoadHeader (REP #$20 : INY : LDA [$0D], Y) +org $81b618 ; Bank01.asm : 7963 Dungeon_LoadHeader (REP #$20 : INY : LDA [$0D], Y) nop : jsl OverridePaletteHeader -org $02817e ; Bank02.asm : 414 (LDA $02811E, X) +org $82817e ; Bank02.asm : 414 (LDA $02811E, X) jsl FixAnimatedTiles -org $0aef43 ; UnderworldMap_RecoverGFX +org $8aef43 ; UnderworldMap_RecoverGFX jsl FixCloseDungeonMap -org $028a06 ; Bank02.asm : 1941 Dungeon_ResetTorchBackgroundAndPlayer +org $828a06 ; Bank02.asm : 1941 Dungeon_ResetTorchBackgroundAndPlayer JSL FixWallmasterLamp -org $00d377 ;Bank 00 line 3185 +org $80d377 ;Bank 00 line 3185 DecompDungAnimatedTiles: -org $00fda4 ;Bank 00 line 8882 +org $80fda4 ;Bank 00 line 8882 Dungeon_InitStarTileCh: -org $00d6ae ;(PC: 56ae) +org $80d6ae ;(PC: 56ae) LoadTransAuxGfx: -org $00d739 ; +org $80d739 ; LoadTransAuxGfx_Alt: -org $00df5a ;(PC: 5f5a) +org $80df5a ;(PC: 5f5a) PrepTransAuxGfx: -org $0ffd65 ;(PC: 07fd65) +org $8ffd65 ;(PC: 07fd65) Dungeon_LoadCustomTileAttr: -org $01feb0 +org $81feb0 Dungeon_ApproachFixedColor: ;org $01fec1 ;Dungeon_ApproachFixedColor_variable: ;org $a0f972 ; Rando version ;LoadRoomHook: -org $1bee74 ;(PC: 0dee74) +org $9bee74 ;(PC: 0dee74) Palette_DungBgMain: -org $1bec77 +org $9bec77 Palette_SpriteAux3: -org $1becc5 +org $9becc5 Palette_SpriteAux2: -org $1bece4 +org $9bece4 Palette_SpriteAux1: -org $0DFA53 -jsl.l LampCheckOverride -org $028046 ; <- 10046 - Bank02.asm : 217 (JSL EnableForceBlank) (Start of Module_LoadFile) -jsl.l OnFileLoadOverride -org $07A93F ; < 3A93F - Bank07.asm 6548 (LDA $8A : AND.b #$40 - Mirror checks) -jsl.l MirrorCheckOverride +org $828046 ; <- 10046 - Bank02.asm : 217 (JSL EnableForceBlank) (Start of Module_LoadFile) +jsl OnFileLoadOverride +org $87A93F ; < 3A93F - Bank07.asm 6548 (LDA $8A : AND.b #$40 - Mirror checks) +jsl MirrorCheckOverride -org $05ef47 +org $85ef47 Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower) jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower nop : stz $0dd0, X : rts .not_in_ganons_tower -org $07a955 ; <- Bank07.asm : around 6564 (JP is a bit different) (STZ $05FC : STZ $05FD) +org $87a955 ; <- Bank07.asm : around 6564 (JP is a bit different) (STZ $05FC : STZ $05FD) jsl BlockEraseFix nop #2 -org $02A0A8 +org $82A0A8 Mirror_SaveRoomData: -org $07A95B ; < bank_07.asm ; #_07A95B: JSL Mirror_SaveRoomData +org $87A95B ; < bank_07.asm ; #_07A95B: JSL Mirror_SaveRoomData jsl EGFixOnMirror -org $02b82a +org $82b82a jsl FixShopCode -org $1ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties) +org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties) jsl VitreousKeyReset -org $1ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2 +org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2 jsl GuruguruFix : bra .next nop #3 .next -org $028fc9 +org $828fc9 nop #2 : jsl BlindAtticFix -org $028409 +org $828409 jsl SuctionOverworldFix -org $0ded04 ; <- rando's hooks.asm line 2192 - 6ED04 - equipment.asm : 1963 (REP #$30) +org $8ded04 ; <- rando's hooks.asm line 2192 - 6ED04 - equipment.asm : 1963 (REP #$30) jsl DrHudDungeonItemsAdditions ;org $098638 ; rando's hooks.asm line 2192 ;jsl CountChestKeys -org $06D192 ; rando's hooks.asm line 457 +org $86D192 ; rando's hooks.asm line 457 jsl CountAbsorbedKeys ; rando's hooks.asm line 1020 ;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) ;jsl CountBonkItem -org $019dbd ; <- Bank01.asm : 4465 of Object_Draw8xN (LDA $9B52, Y : STA $7E2000, X) +org $819dbd ; <- Bank01.asm : 4465 of Object_Draw8xN (LDA $9B52, Y : STA $7E2000, X) jsl CutoffEntranceRug : bra .nextTile : nop .nextTile ;maybe set 02e2 to 0 -org $0799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D) +org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D) JSL StoreTempBunnyState ; -org $08c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8) +org $88c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8) JSL RetrieveBunnyState : NOP -org $02d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E) +org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E) JSL CheckDarkWorldSpawn : NOP -org $01891e ; <- Bank 01.asm : 991 Dungeon_LoadType2Object (LDA $00 : XBA : AND.w #$00FF) -JSL RainPrevention : BCC + : RTS : NOP : + - -org $1edabf ; <- sprite_energy_ball.asm : 86-7 Sprite_EnergyBall (LDA.b #$10 : LDX.b #$00) +org $9edabf ; <- sprite_energy_ball.asm : 86-7 Sprite_EnergyBall (LDA.b #$10 : LDX.b #$00) JSL StandardAgaDmg +org $89F7B2 ; 09F7B2 Module17_01 S&Q +JSL StandardSaveAndQuit -org $09a681 ; < - similar to talalong.asm : 1157 (JSL Main_ShowTextMessage) +org $89a681 ; < - similar to talalong.asm : 1157 (JSL Main_ShowTextMessage) JSL BlindsAtticHint : NOP #2 -org $1cfd69 +org $9cfd69 Main_ShowTextMessage: ; Conditionally disable UW music changes in Door Rando -org $028ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) +org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) JSL.l Underworld_DoorDown_Entry : CPX #$FF BEQ + : db $80, $1C ; BRA $028B04 NOP #6 : + -org $02C3F2 ; <- Bank02.asm:10521 Unused call +org $82C3F2 ; <- Bank02.asm:10521 Unused call Underworld_DoorDown_Call: -org $02C3F3 +org $82C3F3 dw $8AD9 ; address of Bank02.asm:2085 -org $01AA90 +org $81AA90 JSL BigKeyDoorCheck : NOP -org $01AAA2 +org $81AAA2 RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door: ;Enable south facing bk graphic -org $00CE24 +org $80CE24 dw $2ac8 -org $01b714 ; PC: b714 +org $81b714 ; PC: b714 OpenableDoors: jsl CheckIfDoorsOpen bcs .normal rts .normal + +org $82C157 +JSL AlwaysPushThroughFDoors + +; Modified from OWR - will need to remove once merged +org $85AF75 +Sprite_6C_MirrorPortal: +JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $05AFDF +org $85AFDF +Sprite_6C_MirrorPortal_missing_mirror: diff --git a/doorrando/edges.asm b/doorrando/edges.asm index 58852b1..62290ac 100644 --- a/doorrando/edges.asm +++ b/doorrando/edges.asm @@ -1,3 +1,6 @@ +; defines +; Ram usage + HorzEdge: cpy #$ff : beq + jsr DetectWestEdge : ldy #$02 : bra ++ @@ -295,5 +298,8 @@ DetectEastEdge: ldx #$08 .end txa : rts - - +AlwaysPushThroughFDoors: + PHA : AND.b #$F0 : CMP.b #$F0 : BNE + + PLA : RTL + + PLA : AND.b #$8E : CMP.b #$80 + RTL diff --git a/doorrando/entrance_fixes.asm b/doorrando/entrance_fixes.asm new file mode 100644 index 0000000..1f540e9 --- /dev/null +++ b/doorrando/entrance_fixes.asm @@ -0,0 +1,300 @@ +;=================================================================================================== +; The only specific concern to keep in mind with this code is that your databank will be $00 +; Actually, it should be $80, if you're using my fastrom changes. +; +; Leave all your door data vanilla +; Do not try to adjust doors as I previously suggested (not worth the effort) +; We need a few hooks and some light hardcoding either way +; Might as well just do it in a brute, but reliable, way +; +; In brief, this is the hack we're making: +; 1) Let vanilla routines draw the door normally +; 2) Draw over what vanilla just drew +; 3) Hijack the door tile type routine +; and replace the vanilla value with that of solid collision + +; For door dection free RAM at $19EE-$19FF has been co-opted to door each drawn doors position and type bytes +; 19EE is for the "current" door for the IdentifyBlockedEntrance routine +; The array at 19F0 is for the collision routine to retrieve that information as it is no longer +; available by that point +;=================================================================================================== +pushpc + +org $01B0E6 + JSL StoreDoorInfo + +org $01892F +DoorDrawJankMove: + JML PrepDoorDraw + +.return + JSL AdjustEscapeDoorGraphics + RTS + +; we don't want to overwrite the JMP ($000E) that's already there +; Well, we could, but we don't need to +warnpc $018939 + +org $01BF43 + JSL AdjustEscapeDoorCollision + +org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 + JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2 + +pullpc + +;=================================================================================================== +StoreDoorInfo: + STA.w $1980,X + LDA.b $00 : STA.w $19F0,X + TXA +RTL + +PrepDoorDraw: + ; first off, we need this routine to return to our jank hook + ; otherwise, finding a reliable place to put the graphics change check will be a pin + ; so push the address to return to the routine + + ; It's a lot to explain why this is necessary + ; Much easier to just tell you to look at $01890D in the disassembly + ; and you should understand the vanilla program flow we need to reject + PEA.w DoorDrawJankMove_return-1 + LDA.b $00 + STA.w $19EE ; for current routine + + ; copy vanilla code (but fast rom) + LDA.l $8186F0,X + STA.b $0E + + LDX.b $02 + LDA.b $04 + + ; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting + JML.l $818939 + +;=================================================================================================== + +; Adjustment stage 1: graphics +AdjustEscapeDoorGraphics: + JSR IdentifyBlockedEntrance + BCS .replace_graphics + JSR IdentifySancEntrance + BCS .fix_sanctuary_entrance + JSR IdentifySwampEntrance + BCS .fix_swamp_entrance + ; Do nothing + RTL + +;--------------------------------------------------------------------------------------------------- + +.replace_graphics ; for blocked doors + ; using the value in $19A0 should be fine for finding the graphics + ; the only caveat is that this appears to locate the tile just above the north-west corner + ; so below, I've indicated that offset with a +$xxx after the base tilemap buffer + ; The only odd thing I notice with this position is that some bad hardcoded adjust for + ; exploding walls that shouldn't affect how we use this value at all! + LDY.w $0460 ; get door index + + LDX.w $19A0-2,Y ; get tilemap index + + ; hardcoded shutter door graphics tile replacement + + ; the horizontal flips could easily be explicit LDAs + ; but it's probably best the door is symmetrical + ; using ORA makes your intent more clear + ; and gives you fewer values to change if you experiment with other graphics + + ; row 1 + LDA.w #$8838 + STA.l $7E2000+$080,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$086,X + + ; row 2 + LDA.w #$8828 + STA.l $7E2000+$100,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$106,X + + LDA.w #$8829 + STA.l $7E2000+$102,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$104,X + + JSR IdentifySwampEntrance + BCS .fix_swamp_entrance_alternate + + ; the state of the A, X, and Y registers is irrelevant when we exit + ; they're all subsequently loaded with new values + RTL + +.fix_sanctuary_entrance + LDY.w $0460 ; get door index + LDX.w $19A0-2,Y ; get tilemap index + + ; row 0 + LDA.w #$14C4 + STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$006,X + + LDA.w #$14C5 + STA.l $7E2000+$002,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$004,X + + ; row 1 + LDA.w #$14E8 + STA.l $7E2000+$082,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$084,X + + ; row 2 + LDA.w #$14F8 + STA.l $7E2000+$102,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$104,X + RTL + +.fix_swamp_entrance + LDY.w $0460 ; get door index + LDX.w $19A0-2,Y ; get tilemap index + + ; row 1 - outer section + LDA.w #$0908 + STA.l $7E2000+$080,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$086,X + + ; row 2 + LDA.w #$0918 + STA.l $7E2000+$100,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$106,X + + LDA.w #$14F8 + STA.l $7E2000+$102,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$104,X + +.fix_swamp_entrance_alternate + ; row 0 + LDA.w #$9DFC + STA.l $7E2000+$000,X + STA.l $7E2000+$002,X + STA.l $7E2000+$004,X + STA.l $7E2000+$006,X + + ; row 1 - mid section + LDA.w #$14E8 + STA.l $7E2000+$082,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$084,X + + ; row 3 + LDA.w #$A82C + STA.l $7E2000+$180,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$186,X + + LDA.w #$A82D + STA.l $7E2000+$182,X + ORA.w #$4000 ; horizontally flip + STA.l $7E2000+$184,X + RTL + +IdentifySancEntrance: + LDA.b $A0 : CMP.w #$0012 : BNE + + LDA.b $0A : CMP.w #$0010 : BNE + + SEC : RTS + + CLC : RTS + +IdentifySwampEntrance: + LDA.b $A0 : CMP.w #$0036 : BNE + + LDA.b $0A : CMP.w #$0010 : BNE + + SEC : RTS + + CLC : RTS + +;=================================================================================================== + +; Leaving this here in case you desire a fully custom door later +; For now, we'll just hardcode the tiles, as I did above +; I put these in column order because that's how they're expected for the vanilla draw routines +; but I changed my mind on redefining things +; and am too lazy to change it to a row-wise listing +BlockedEntrance: + dw $8838, $8828, $A888 ; column 0 + dw $14E8, $8829, $C888 ; column 1 + dw $14E8, $8829, $A888 ; column 2 + dw $C838, $C828, $C888 ; column 3 + +;=================================================================================================== + +; Adjustment stage 2: collision +AdjustEscapeDoorCollision: + LSR ; vanilla shift + +AdjustEscapeDoorCollisionShared: + ; save our parameters + ; but one or both of these may not be necessary depending on how you detect these doors + ; all that matters is that after identifying blockage, we have: + ; Y is the same as what we entered with + ; X has A>>1, for whatever A entered with + PHA + LDA.w $19F0, Y ; grab door info (type, position) + STA.w $19EE ; store in temporary variable + JSR IdentifyBlockedEntrance + + PLX ; this is a TAX in vanilla, just have X pull A instead + + BCS .block_entrance + + ; vanilla value + LDA.b $00 + + RTL + +.block_entrance + LDA.w #$0101 ; load tile type for solid collision + + RTL + +AdjustEscapeDoorCollision_LowEntrance: + ADC.w #$0040 ; vanilla add + JMP AdjustEscapeDoorCollisionShared + +;=================================================================================================== + +; Enter with: +; $19EE containing the door information: position and type bytes +; Exit with: +; carry clear - leave door alone +; carry set - block door +IdentifyBlockedEntrance: + LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1) + LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued + LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged + LDA.b $A0 : CMP.w #$0012 : BNE + + ; we're in the sanctuary + ; this code could be removed because you can't reach sanc without zelda currently + ; but that's enforced in the logic, so this is to catch that case in case some mode allows it + LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following + LDA.b $0A + CMP.w #$000A : BCC .leave_alone + CMP.w #$0014 : BCS .leave_alone + .block_door + SEC : RTS + + LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone + LDX #$FFFE + - INX #2 + LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone + CMP $A0 : BNE - + LDA.l RainDoorMatch, X + CMP.w $19EE : BNE .leave_alone + BRA .block_door + .continue + BRA - + .leave_alone + CLC : RTS + +;=================================================================================================== \ No newline at end of file diff --git a/doorrando/normal.asm b/doorrando/normal.asm index 13323d8..e1fc8ee 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -1,6 +1,6 @@ WarpLeft: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$06 : ldy #$01 ; offsets in A, Y @@ -11,7 +11,7 @@ WarpLeft: WarpRight: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$12 : ldy #$ff ; offsets in A, Y @@ -22,7 +22,7 @@ WarpRight: WarpUp: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex ldy #$02 ; offsets in A, Y @@ -40,7 +40,7 @@ endmacro WarpDown: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex !add #$0c : ldy #$ff ; offsets in A, Y @@ -79,6 +79,14 @@ Cleanup: lda $ef rts +; carry set if cave, clear otherwise +CheckIfCave: + REP #$30 + LDA.b $A2 : CMP.w #$00E1 : BCS .invalid + SEP #$30 : CLC : RTS + .invalid + SEP #$30 : SEC : RTS + ;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down ; This sets A (00,02,04) and stores half that at $04 for later use, (src door) CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic) @@ -324,7 +332,7 @@ GetTileAttribute: { phk : pea.w .jslrtsreturn-1 pea.w $02802c - jml $02c11d ; mucks with x/y sets a to Tile Attribute, I think + jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think .jslrtsreturn rts } @@ -364,7 +372,7 @@ DoorToStraight: lda $a0 : cmp #$51 : bne .skip lda #$04 : sta $4e .skip pla - .end ldx $0418 : cmp #$02 ;what we wrote over + .end LDX.w $0418 : CMP.b #$02 ; what we wrote over rtl } @@ -416,4 +424,25 @@ InroomStairsTrapDoor: pla : pla : pla jsl StraightStairsTrapDoor_reset jml $028b15 ; just some RTS in bank 02 -} \ No newline at end of file +} + +HandleSpecialDoorLanding: { + LDA.l $7F2000,X ; what we wrote over + SEP #$30 + ; A = tiletype + HandleIncomingDoorState: + PHA + LDA.l DRMode : BEQ .noDoor + PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor + + .setDoorState + LDA.w $0418 : AND.b #$02 : BNE + : INC + + STA.b $6C + + .noDoor + PLA + CMP.b #$34 : BNE + ; inroom stairs + PHA : LDA.b #$26 : STA.w $045E : PLA + + +RTL +} diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index 90cddb9..37c8913 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -1,27 +1,3 @@ -;================================================================================ -; Lamp Mantle & Light Cone Fix -;-------------------------------------------------------------------------------- -; Output: 0 for darkness, 1 for lamp cone -;-------------------------------------------------------------------------------- -LampCheckOverride: - LDA $7F50C4 : CMP.b #$01 : BNE + : RTL : + - CMP.b #$FF : BNE + : INC : RTL : + - - LDA LampEquipment : BNE .done ; skip if we already have lantern - - LDA CurrentWorld : BNE + - .lightWorld - LDA $040C : CMP.b #$04 : !BGE ++ ; check if we're in HC - LDA LampConeSewers : BRA .done - ++ - LDA LampConeLightWorld : BRA .done - + - .darkWorld - LDA LampConeDarkWorld - .done - ;BNE + : STZ $1D : + ; remember to turn cone off after a torch -RTL - GtBossHeartCheckOverride: lda $a0 : cmp #$1c : beq ++ cmp #$6c : beq ++ @@ -117,26 +93,6 @@ RetrieveBunnyState: STA $5D + RTL -RainPrevention: - LDA $00 : XBA : AND #$00FF : STA.b $0A ; what we wrote over - PHA - LDA ProgressIndicator : AND #$00FF : CMP #$0002 : !BGE .done ; only in rain states (0 or 1) - LDA.l ProgressFlags : AND #$0004 : BNE .done ; zelda's been rescued - LDA.l BlockSanctuaryDoorInRain : BEQ .done ;flagged - LDA $A0 : CMP #$0012 : BNE + ;we're in the sanctuary - LDA.l FollowerIndicator : AND #$00FF : CMP #$0001 : BEQ .done ; zelda is following - LDA $00 : AND #$00FF : CMP #$00A1 : BNE .done ; position is a1 - PLA : LDA #$0008 : RTL - + LDA.l BlockCastleDoorsInRain : AND #$00FF : BEQ .done ;flagged - LDX #$FFFE - - INX #2 : LDA.l RemoveRainDoorsRoom, X : CMP #$FFFF : BEQ .done - CMP $A0 : BNE - - SEP #$20 : LDA.l RainDoorMatch, X : CMP $00 : BNE .continue - INC.w $0460 : INC.w $0460 : REP #$20 : PLA : SEC : RTL - .continue - REP #$20 : BRA - - .done PLA : CLC : RTL - ; A should be how much dmg to do to Aga when leaving this function StandardAgaDmg: LDX.b #$00 ; part of what we wrote over @@ -144,6 +100,14 @@ StandardAgaDmg: LDA.b #$10 ; hurt him! + RTL ; A is zero if the AND results in zero and then Agahnim's invincible! +StandardSaveAndQuit: + LDA.b #$0F : STA.b $95 ; what we wrote over + LDA.l ProgressFlags : AND #$04 : BNE + + LDA.l DRMode : BEQ + + LDA.l StartingEntrance : CMP.b #$02 : BCC + + LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >= ++ RTL + ; note: this skips both maiden dialog triggers if the hole is open BlindsAtticHint: REP #$20 @@ -158,10 +122,18 @@ BlindZeldaDespawnFix: PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL + PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL - BigKeyDoorCheck: CPY.w #$001E : BNE + ; skip if it isn't a BK door LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1 + LDA.w #$0000 : RTL +FixOvalFadeOutMirror: + LDA.b $10 : CMP.b #$0F : BEQ .skip_activation + LDA.l InvertedMode : BNE + + LDA.l CurrentWorld : BNE .skip_activation + RTL + + LDA.l CurrentWorld : BEQ .skip_activation + RTL + .skip_activation + PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror \ No newline at end of file diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index e73b5e1..81f8533 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -1,24 +1,28 @@ RecordStairType: { pha lda.l DRMode : beq .norm - lda $040c : cmp #$ff : beq .norm + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm + CMP #$00DF : BEQ .norm + SEP #$30 lda $0e cmp #$25 : bcc ++ ; don't record straight staircases sta $045e ++ pla : bra + - .norm pla : sta $a0 + .norm SEP #$30 : pla : sta $a0 + lda $063d, x rtl } SpiralWarp: { lda.l DRMode : beq .abort ; abort if not DR - lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort + CMP #$00DF : BEQ .abort + SEP #$30 lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A! cmp #$5f : beq .gtg cmp #$26 : beq .inroom .abort - stz $045e : lda $a2 : and #$0f : rtl ; clear,run hijacked code and get out + SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out .inroom jsr InroomStairsWarp lda $a2 : and #$0f ; this is the code we are hijacking @@ -207,19 +211,16 @@ InroomStairsWarp: { .normal lda $01 : sta $fe ; trap door lda $07 : sta $03 : beq + - ldy $a0 : cpy #$51 : beq .specialFix ; throne room - cpy #$02 : beq .specialFix ; sewers pull switch - cpy #$71 : beq .specialFix ; castle armory - lda #$e0 - bra ++ + lda $01 : and #$04 : bne .specialFix + lda #$e0 : bra ++ .specialFix - lda #$c8 - bra ++ + lda #$c8 : bra ++ + %StonewallCheck($43) - lda #$1b - ++ - sta $20 + lda $01 : and #$04 : bne + + lda #$1b : bra ++ + + lda #$33 + ++ sta $20 inc $07 : stz $02 : lda #$78 : sta $22 lda $01 : and #$03 : beq ++ cmp #$02 : !bge + diff --git a/dungeonmap.asm b/dungeonmap.asm index 6c97932..4e9b349 100644 --- a/dungeonmap.asm +++ b/dungeonmap.asm @@ -21,7 +21,7 @@ DoDungeonMapBossIcon: ; get dungeon boss room ++ REP #$30 - LDA.l $8AE817,X + LDA.l DungeonMapBossRooms, X ASL TAX diff --git a/enemizer/hooks/blindboss_hooks.asm b/enemizer/hooks/blindboss_hooks.asm index 9871abe..2d67736 100644 --- a/enemizer/hooks/blindboss_hooks.asm +++ b/enemizer/hooks/blindboss_hooks.asm @@ -3,9 +3,9 @@ ; Blind Boss fight ;-------------------------------------------------------------------------------- -org $1DA081 ; Original Code +org $9DA081 ; Original Code JML check_blind_boss_room Check_for_Blind_Fight: -org $1DA090 +org $9DA090 Initialize_Blind_Fight: \ No newline at end of file diff --git a/goalitem.asm b/goalitem.asm index 9d112f8..d4a003f 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -46,6 +46,7 @@ CheckGanonVulnerability: dw .crystals_and_bosses dw .bosses_only dw .all_dungeons_no_agahnim + dw .completionist ; 00 = always vulnerable .vulnerable @@ -99,6 +100,15 @@ CheckGanonVulnerability: .bosses_only JMP CheckForCrystalBossesDefeated +; 0a = Check Item counter +.completionist + REP #$20 + LDA.l TotalItemCounter : CMP.l MaxItemCounter + SEP #$20 + BCC .fail +BRA .all_dungeons + + ;-------------------------------------------------------------------------------- GetRequiredCrystalsForTower: BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over diff --git a/hooks.asm b/hooks.asm index c2a9b56..30723be 100755 --- a/hooks.asm +++ b/hooks.asm @@ -188,6 +188,9 @@ db Password_Tilemap>>16 org $0CD527 ; <- 65527 : Bank0C.asm : 2913 (LDA.w #$0004 : STA $02) [LDA.w #$0006 : STA $02] JSL.l DrawPlayerFile : NOP ; hijack hearts draw routine to draw a full inventory +; Random incredible patch that I should add right now - File Select Fairy +org $1BF029+1 : db $10 + org $0ccdd5 ; Bank0C.asm:1881 (LDX.w #$00FD) JSL.l AltBufferTable : NOP #8 ; Selection screen org $0cd393 ; Bank0c.asm:2674 (LDX.w #$00FD) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 01f6c90..75c1fd3 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -1,81 +1,88 @@ ; hooks -org $01E6B0 +org $81E6B0 JSL RevealPotItem RTS -org $09C2BB +org $829C25 + JSL SetTheSceneFix + +org $89C2BB JSL ClearSpriteData -org $09C327 +org $89C327 JSL LoadSpriteData -org $06F976 +org $86F976 JSL RevealSpriteDrop : NOP -org $06E3C4 +org $86E3C4 JSL RevealSpriteDrop2 : NOP -org $06926e ; <- 3126e - sprite_prep.asm : 2664 (LDA $0B9B : STA $0CBA, X) +org $86926e ; <- 3126e - sprite_prep.asm : 2664 (LDA $0B9B : STA $0CBA, X) JSL SpriteKeyPrep : NOP #2 -org $06d049 ; <- 35049 sprite_absorbable : 31-32 (JSL Sprite_DrawRippleIfInWater : JSR Sprite_DrawAbsorbable) +org $86d049 ; <- 35049 sprite_absorbable : 31-32 (JSL Sprite_DrawRippleIfInWater : JSR Sprite_DrawAbsorbable) JSL SpriteKeyDrawGFX : BRA + : NOP : + -org $06d03d +org $86d03d JSL ShouldSpawnItem : NOP #2 -org $06D19F +org $86D19F JSL MarkSRAMForItem : NOP #2 -org $06d180 +org $86d180 JSL BigKeyGet : BCS $07 : NOP #5 -org $06d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) +org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) JSL KeyGet -org $06f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties) +org $86f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties) JSL LoadProperties_PreserveCertainProps -org $008BAA ; NMI hook +org $808BAA ; NMI hook JSL TransferPotGFX -org $06828A +org $86828A JSL CheckSprite_Spawn -org $07B169 +org $87B169 JSL PreventPotSpawn : NOP -org $07B17D +org $87B17D JSL PreventPotSpawn2 -org $068275 +org $868275 JSL SubstitionFlow -org $00A9DC +org $80A9DC dw $1928, $1938, $5928, $5938 ; change weird ugly black diagonal pot to blue-ish pot -org $018650 +org $818650 dw $B395 ; change tile type to normal pot -org $01B3D5 +org $81B3D5 JSL CheckIfPotIsSpecial ; refs to other functions -org $0681F4 +org $8681F4 Sprite_SpawnSecret_pool_ID: -org $068283 +org $868283 Sprite_SpawnSecret_NotRandomBush: -org $06828A +org $86828A Sprite_SpawnSecret_SpriteSpawnDynamically: -org $06d23a +org $86d23a Sprite_DrawAbsorbable: -org $1eff81 +org $9eff81 Sprite_DrawRippleIfInWater: -org $0db818 +org $8db818 Sprite_LoadProperties: -org $06D038 +org $86D038 KeyRoomFlagMasks: +org $80FDEE +InitializeMirrorHDMA: +org $80E3C4 +LoadCommonSprites_long: ; defines ; Ram usage @@ -207,6 +214,9 @@ LoadMultiWorldPotItem: PLX BRA SaveMajorItemDrop +MultiItemExit: + LDA.w #$0008 : STA.w $0B9C +RTL LoadMajorPotItem: INY : INY @@ -218,7 +228,9 @@ SaveMajorItemDrop: STA.w SpawnedItemID STX.w SpawnedItemIndex INC.w SpawnedItemFlag - TAY : LDA.w #$0008 + TAY + LDA.l SpawnedItemIsMultiWorld : BNE MultiItemExit + LDA.w #$0008 CPY.w #$0036 : BNE + ; Red Rupee LDA.w #$0016 : BRA .substitute + CPY.w #$0044 : BNE + ; 10 pack arrows @@ -625,6 +637,11 @@ CheckIfPotIsSpecial: .specialpot ; zero flag already set, so gtg RTL +SetTheSceneFix: + STZ.b $6C + JSL InitializeMirrorHDMA + JSL LoadCommonSprites_long +RTL incsrc dynamic_si_vram.asm diff --git a/keydropshuffle.asm b/keydropshuffle.asm deleted file mode 100644 index e939d77..0000000 --- a/keydropshuffle.asm +++ /dev/null @@ -1,181 +0,0 @@ -org $06926e ; <- 3126e - sprite_prep.asm : 2664 (LDA $0B9B : STA $0CBA, X) -jsl SpriteKeyPrep : nop #2 - -org $06d049 ; <- 35049 sprite_absorbable : 31-32 (JSL Sprite_DrawRippleIfInWater : JSR Sprite_DrawAbsorbable) -jsl SpriteKeyDrawGFX : bra + : nop : + - -org $06d180 -jsl BigKeyGet : bcs $07 : nop #5 - -org $06d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) -jsl KeyGet - -org $06f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties) -jsl LoadProperties_PreserveItemMaybe - - - - -org $06d23a -Sprite_DrawAbsorbable: -org $1eff81 -Sprite_DrawRippleIfInWater: -org $0db818 -Sprite_LoadProperties: - -org $288000 ;140000 -ShuffleKeyDrops: -db 0 -MultiClientFlagsROM: ; 140001 -> stored in SRAM at 7ef33d -db 0 - -LootTable: ;PC: 140002 -db $0e, $00, $24 ;; ice jelly key -db $13, $00, $24 ;; pokey 2 -db $16, $00, $24 ;; swamp waterway pot -db $21, $00, $24 ;; key rat -db $35, $00, $24 ;; swamp trench 2 pot -db $36, $00, $24 ;; hookshot pot -db $37, $00, $24 ;; trench 1 pot -db $38, $00, $24 ;; pot row pot -db $39, $00, $24 ;; skull gibdo -db $3d, $00, $24 ;; gt minihelma -db $3e, $00, $24 ;; ice conveyor -db $3f, $00, $24 ;; ice hammer block ??? is this a dungeon secret? -db $43, $00, $24 ;; tiles 2 pot -db $53, $00, $24 ;; beamos hall pot -db $56, $00, $24 ;; skull west lobby pot -db $63, $00, $24 ;; desert tiles 1 pot -db $71, $00, $24 ;; boomerang guard -db $72, $00, $24 ;; hc map guard -db $7b, $00, $24 ;; gt star pits pot -db $80, $00, $32 ;; a big key (for the current dungeon) -db $8b, $00, $24 ;; gt conv cross block -db $9b, $00, $24 ;; gt dlb switch pot -db $9f, $00, $24 ;; ice many pots -db $99, $00, $24 ;; eastern eyegore -db $a1, $00, $24 ;; mire fishbone pot -db $ab, $00, $24 ;; tt spike switch pot -db $b0, $00, $24 ;; tower circle of pots usain -db $b3, $00, $24 ;; mire spikes pot -db $b6, $00, $24 ;; pokey 1 -db $ba, $00, $24 ;; eastern dark pot -db $bc, $00, $24 ;; tt hallway pot -db $c0, $00, $24 ;; tower dark archer -db $c1, $00, $24 ;; mire glitchy jelly -db $ff, $00, $ff -;140068 - -KeyTable: -db $a0, $a0, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $aa, $ab, $ac, $ad - -SpriteKeyPrep: -{ - lda $0b9b : sta $0cba, x ; what we wrote over - pha - lda.l ShuffleKeyDrops : beq + - phx - ldx #$fd - - inx #3 : lda.l LootTable, x : cmp #$ff : beq ++ : cmp $a0 : bne - - inx : lda.l LootTable, x : sta !MULTIWORLD_SPRITEITEM_PLAYER_ID - inx : lda.l LootTable, x - plx : sta $0e80, x - cmp #$24 : bne +++ - lda $a0 : cmp #$80 : bne + : lda #$24 - +++ jsl PrepDynamicTile : bra + - ++ plx : lda #$24 : sta $0e80, x - + pla - rtl -} - -SpriteKeyDrawGFX: -{ - jsl Sprite_DrawRippleIfInWater - pha - lda.l ShuffleKeyDrops : bne + - - pla - phk : pea.w .jslrtsreturn-1 - pea.w $068014 ; an rtl address - 1 in Bank06 - jml Sprite_DrawAbsorbable - .jslrtsreturn - rtl - + lda $0e80, x - cmp #$24 : bne + - lda $a0 : cmp #$80 : bne - : lda #$24 - + jsl DrawDynamicTile ; see DrawHeartPieceGFX if problems - cmp #$03 : bne + - pha : lda $0e60, x : ora.b #$20 : sta $0E60, x : pla - + - jsl.l Sprite_DrawShadowLong - - pla : rtl -} - -KeyGet: -{ - lda CurrentSmallKeys ; what we wrote over - pha - lda.l ShuffleKeyDrops : bne + - - pla : rtl - + ldy $0e80, x - lda $a0 : cmp #$87 : bne + - jsr ShouldKeyBeCountedForDungeon : bcc - - jsl CountChestKeyLong : bra - - + sty $00 - jsr KeyGetPlayer : sta !MULTIWORLD_ITEM_PLAYER_ID - lda !MULTIWORLD_ITEM_PLAYER_ID : bne .receive - phx - lda $040c : lsr : tax - lda $00 : CMP.l KeyTable, x : bne + - - JSL.l FullInventoryExternal : jsl CountChestKeyLong : plx : pla : rtl - + cmp #$af : beq - ; universal key - cmp #$24 : beq - ; small key for this dungeon - plx - .receive - jsl.l $0791b3 ; Player_HaltDashAttackLong - jsl.l Link_ReceiveItem - pla : dec : rtl -} - -; Input Y - the item type -ShouldKeyBeCountedForDungeon: -{ - phx - lda $040c : lsr : tax - tya : cmp KeyTable, x : bne + - - plx : sec : rts - + cmp #$24 : beq - - plx : clc : rts -} - -BigKeyGet: -{ - lda.l ShuffleKeyDrops : bne + - - stz $02e9 : ldy.b #$32 ; what we wrote over - phx : jsl Link_ReceiveItem : plx ; what we wrote over - clc : rtl - + - ldy $0e80, x - cpy #$32 : beq - - + sec : rtl -} - -KeyGetPlayer: -{ - phx - ldx #$fd - - inx #3 : lda.l LootTable, x : cmp #$ff : beq ++ : cmp $a0 : bne - - ++ inx : lda.l LootTable, x - plx - rts -} - -LoadProperties_PreserveItemMaybe: -{ - lda.l ShuffleKeyDrops : bne + - JML Sprite_LoadProperties - + lda $0e80, x : pha - jsl Sprite_LoadProperties - pla : sta $0e80, x - rtl -} diff --git a/lampmantlecone.asm b/lampmantlecone.asm index 1262087..8f7bf6c 100644 --- a/lampmantlecone.asm +++ b/lampmantlecone.asm @@ -8,16 +8,13 @@ LampCheck: CMP.b #$FF : BNE + : INC : RTL : + LDA LampEquipment : BNE .done ; skip if we already have lantern - - LDA CurrentWorld : BNE + - .lightWorld - LDA $040C : BNE ++ ; check if we're in sewers + + LDA $040C : CMP.b #$FF : BEQ + + CMP.b #$04 : BCS + ; check if we're in HC LDA LampConeSewers : BRA .done - ++ - LDA LampConeLightWorld : BRA .done - + - .darkWorld - LDA LampConeDarkWorld + + LDA CurrentWorld : BNE + + LDA LampConeLightWorld : BRA .done + + LDA LampConeDarkWorld .done ;BNE + : STZ $1D : + ; remember to turn cone off after a torch RTL diff --git a/menu/overworldmap.asm b/menu/overworldmap.asm index cf2c246..a5348ca 100644 --- a/menu/overworldmap.asm +++ b/menu/overworldmap.asm @@ -2,7 +2,7 @@ !MC_FLAG = "$7F5420" ; tables -org $0ABDF6 +org $8ABDF6 WorldMapIcon_posx_vanilla: dw $0F31 ; prize1 dw $08D0 ; prize2 @@ -24,7 +24,7 @@ dw $FFFF ; reserved - not used dw $FFFF dw $FFFF -org $0ABE16 +org $8ABE16 WorldMapIcon_posy_vanilla: dw $0620 ; prize1 dw $0080 ; prize2 @@ -46,7 +46,7 @@ dw $FFFF ; reserved - not used dw $FFFF dw $FFFF -org $0ABE36 +org $8ABE36 WorldMapIcon_posx_located: dw $FF00 ; prize1 dw $FF00 ; prize2 @@ -68,7 +68,7 @@ dw $FFFF ; reserved - not used dw $FFFF dw $FFFF -org $0ABE56 +org $8ABE56 WorldMapIcon_posy_located: dw $FF00 ; prize1 dw $FF00 ; prize2 @@ -90,7 +90,7 @@ dw $FFFF ; reserved - not used dw $FFFF dw $FFFF -org $0ABE76 +org $8ABE76 WorldMapIcon_tile: db $38, $62 ; green pendant db $32, $60 ; red pendant @@ -112,30 +112,30 @@ db $00, $00 ; unused red x's db $00, $00 db $00, $00 -org $0ABE96 +org $8ABE96 CompassExists: ; dw $37FC ; todo: convert to two bytes with masks? so much extra code... ; eastern hera desert pod skull trock thieves mire ice swamp gt at escape db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00 ; 0 = light world, 1 = dark world -org $0ABEA6 +org $8ABEA6 WorldCompassMask: db $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00 ; eastern desert hera pod skull trock thieves mire ice swamp gt at escape x1 x2 x3 ; refs -org $0AC59B +org $8AC59B WorldMapIcon_AdjustCoordinate: -org $0AC3B1 +org $8AC3B1 WorldMap_CalculateOAMCoordinates: -org $0AC52E +org $8AC52E WorldMap_HandleSpriteBlink: -org $0ABF70 +org $8ABF70 WorldMap_RedXChars: -org $0AC02B +org $8AC02B DrawPrizesOverride: LDX.b #$FF .loopStart diff --git a/tables.asm b/tables.asm index 5c77707..f71e4b8 100644 --- a/tables.asm +++ b/tables.asm @@ -2823,4 +2823,7 @@ db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $0 ;-------------------------------------------------------------------------------- ; 0x187010 - 187FFF (unused) ;-------------------------------------------------------------------------------- +org $30F010 +MaxItemCounter: +dw $00D8 ; 216 default