From 3834e4df0f8d2053ab23129cc1f6f809236595cc Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 14 Sep 2025 11:00:37 -0400 Subject: [PATCH] Upgrade to ZSOverworld ASM ver3 - Adds tall and wide areas - Adds support for special overworld maps --- Overworld/ZSCustomOverworld.asm | 4155 ++++++++++++++++++++++--------- 1 file changed, 3007 insertions(+), 1148 deletions(-) diff --git a/Overworld/ZSCustomOverworld.asm b/Overworld/ZSCustomOverworld.asm index 7a5bea6..4b50c17 100644 --- a/Overworld/ZSCustomOverworld.asm +++ b/Overworld/ZSCustomOverworld.asm @@ -3,116 +3,160 @@ ; Written by Jared_Brian_ ; With help and testing from Jeimuzu, Letterbomb, Scawful, and Zarby89 ; ============================================================================== -; The purpose of this ASM is to give users the ability to customize many aspects -; of the ALTTP overworld that were previously hardcoded. -; Features include: -; The ability to add a mosaic on any transition. -; The ability to change the main palette for each area. -; The ability to give each area a custom background transparent color. -; The ability to give each area its own tile GFX set. -; The ability to give each area its own animated tile set. -; The ability to add or remove a subscreen overlay on each area. -; (rain, fog, sky, lava, pyramid, etc.) -; The ability to disable the rain in the beginning phase. -; Removed hardcoded exits playing music instead of using the area's set music. +; The purpose of this ASM is to give users the ability to customize many +; aspects of the ALTTP overworld that were previously hardcoded. ; -; To achieve this, large portions of the game's vanilla code had to be edited or -; even re-written entirely to instead read from tables in expanded space. These -; tables are written to and generated by ZScream. Tables based on the vanilla -; configuration can be used by changing the debug variable !UseVanillaPool +; Features include: +; • The ability to add a mosaic on any transition. +; • The ability to change the main palette for each area. +; • The ability to give each area a custom background transparent color. +; • The ability to give each area its own tile GFX set. +; • The ability to give each area its own animated tile set. +; • The ability to add or remove a subscreen overlay on each area. +; (rain, fog, sky, lava, pyramid, etc.) +; • The ability to disable the rain in the beginning phase. +; • Removed hardcoded exits playing music instead of using the area's set +; music. +; • The ability to change the layout of "small" (1x1) and "large" (2x2) areas +; already present in the vanilla game. +; • The ability to have "wide" (2x1) and "tall" (1x2) areas that were not +; present in the vanilla game. +; • The ability to use the other previously unused "secial world" areas +; as if they were a normal area. Including the use of items, entrances, +; exits, whirlpools, bird transports, sign messages, overworld transitions, +; entrance overlays, and subscreen overlays. +; • The ability to have sprites on the DW and SW during phase 0. +; • Fixes several bugs present in the vanilla game that prevent certain normal +; overworld transitions such as "staggered" layouts or transitions in the +; middle of 2 large areas that are next to each other. See the diagrams in +; the OverworldScreenTileMapChange section below for more details. +; +; To achieve this, large portions of the game's vanilla code had to be edited +; or even re-written entirely to instead read from tables in expanded space. +; These tables are written to and generated by ZScream. Tables based on the +; vanilla configuration can be used by changing the debug variable !UseVanillaPool ; down below to a 1, thus removing the need for ZScream although this is not ; reccomended for your average user. -; Some of the new features require a bit more computation time (to decompress +; Some of the new features require a bit more computation time (to decompress ; GFX for example) causing load times to be slightly longer (1-2 frames more at ; most). Because of this, I have made it so certain features can be disabled to ; instead use the original vanilla code if speed is prefered. See the ; EnableTable below for more details. ; -; There are certain things that are still hardcoded here as a result but can be -; changed if you know a bit of ASM, such as: -; The rain that is originally present in the Misery Mire area. -; The Lost Woods changing to the tree canopy overlay after obtaining the -; master sword. -; The fog overlay being disabled after obtaining the master sword in the -; master sword area. -; The bridge overlay present in the under the bridge area. -; The BG color present in the under the bridge area. -; The pyramid overlay only scrolling properly on area $5B. -; ============================================================================== - +; There are certain things that are still hardcoded here as a result but can +; be changed if you know a bit of ASM, such as: +; • The rain that is originally present in the Misery Mire area. +; • The Lost Woods changing to the tree canopy overlay after obtaining the +; master sword. +; • The fog overlay being disabled after obtaining the master sword in the +; master sword area. +; • The bridge overlay present in the under the bridge area. +; • The BG color present in the under the bridge area. +; • The pyramid overlay only scrolling properly on area $5B. +; • The smaller camera boundaries present in the master sword area and the +; area under the bridge. ; ============================================================================== ; Non-Expanded Space ; ============================================================================== +; TODO: Entrance overlay SRM + pushpc -incsrc Core/hardware.asm +incsrc HardwareRegisters.asm ; Free RAM -AnimatedTileGFXSet = $0FC0 ; [0x01] -TransGFXModuleFrame = $0CF3 ; [0x01] -TransGFXModule_PriorSheets = $04CB ; [0x08] May use more in the future here. -NewNMITarget1 = $04D3 ; [0x02] -NewNMISource1 = $04D5 ; [0x02] -NewNMICount1 = $04D7 ; [0x02] -NewNMITarget2 = $04D9 ; [0x02] -NewNMISource2 = $04DB ; [0x02] -NewNMICount2 = $04DD ; [0x02] + +TransGFXModule_PriorSheets = $04CB ; [0x08] May use more in the future here. +NewNMISource1 = $04D5 ; [0x02] +NewNMITarget1 = $04D3 ; [0x02] +NewNMICount1 = $04D7 ; [0x02] +NewNMITarget2 = $04D9 ; [0x02] +NewNMISource2 = $04DB ; [0x02] +NewNMICount2 = $04DD ; [0x02] +OWCameraBoundsS = $0716 ; [0x02] +OWCameraBoundsE = $0718 ; [0x02] +TransGFXModuleFrame = $0CF3 ; [0x01] +AnimatedTileGFXSet = $0FC0 ; [0x01] +ExpandedSpritePalArray = $7EFDC0 ; [0x40] + +; $0716 is not actually free, but labled as such for the sake of organization. +; $0718 is free RAM and took the horizontal responsibility away from $0716. +; ($0716 is labled as OWCameraBoundsSE in the disassembly). ; Hooks -Sound_LoadLightWorldSongBank = $008913 -GFXSheetPointers_sprite_bank = $00CFF3 -GFXSheetPointers_sprite_high = $00D0D2 -GFXSheetPointers_sprite_low = $00D1B1 -DecompOwAnimatedTiles = $00D394 -GetAnimatedSpriteTile = $00D4DB -GetAnimatedSpriteTile_variable = $00D4ED -LoadTransAuxGFX_sprite_continue = $00D706 -PrepTransAuxGFX = $00DF1A -Do3To4High16Bit = $00DF4F -Do3To4Low16Bit = $00DFB8 -InitTilesets = $00E19B -CopyFontToVram = $00E556 -Decomp_bg_variable = $00E78F -OverworldPalettesScreenToSet = $00FD1C +Sound_LoadLightWorldSongBank = $008913 ; $000913 +EnableForceBlank = $00893D ; $00093D +GFXSheetPointers_sprite_bank = $00CFF3 ; $004FF3 +GFXSheetPointers_sprite_high = $00D0D2 ; $0050D2 +GFXSheetPointers_sprite_low = $00D1B1 ; $0051B1 +DecompOwAnimatedTiles = $00D394 ; $005394 +GetAnimatedSpriteTile = $00D4DB ; $0054DB +GetAnimatedSpriteTile_variable = $00D4ED ; $0054ED +LoadTransAuxGFX_sprite_continue = $00D706 ; $005706 +SheetsTable_0AA4 = $00D8F4 ; $0058F4 +PrepTransAuxGFX = $00DF1A ; $005F1A +Do3To4High16Bit = $00DF4F ; $005F4F +Do3To4Low16Bit = $00DFB8 ; $005FB8 +InitTilesets = $00E19B ; $00619B +CopyFontToVram = $00E556 ; $006556 +Decomp_bg_variable = $00E78F ; $00678F +GFX0AA2ValsOW = $00FC9C ; $007C9C -Credits_LoadScene_PrepGFX_sprite_gfx = $0285E2 -Credits_LoadScene_PrepGFX_sprite_palette = $0285F3 -DeleteCertainAncillaeStopDashing = $028B0C -OWOverlay_HShift = $02A46D -OWOverlay_VShift = $02A471 -Overworld_FinishTransGfx_firstHalf_Retrun = $02ABC5 -Overworld_LoadSubscreenAndSilenceSFX1 = $02AF19 -Overworld_ReloadSubscreenOverlayAndAdvance = $02B1F4 -Dungeon_LoadPalettes_cacheSettings = $02C65F -SpecialOverworld_CopyPalettesToCache = $02C6EB -LoadSubscreenOverlay = $02FD0D +Credits_LoadScene_PrepGFX_sprite_gfx = $0285E2 ; $0105E2 +Credits_LoadScene_PrepGFX_sprite_palette = $0285F3 ; $0105F3 +DeleteCertainAncillaeStopDashing = $028B0C ; $010B0C +OWOverlay_HShift = $02A46D ; $01246D +OWOverlay_VShift = $02A471 ; $012471 +Overworld_LoadMapProperties = $02AB08 ; $012B08 +Overworld_FinishTransGfx_firstHalf_Retrun = $02ABC5 ; $012BC5 +Overworld_LoadSubscreenAndSilenceSFX1 = $02AF19 ; $012F19 +Overworld_ReloadSubscreenOverlayAndAdvance = $02B1F4 ; $0131F4 +Dungeon_LoadPalettes_cacheSettings = $02C65F ; $01465F +SpecialOverworld_CopyPalettesToCache = $02C6EB ; $0146EB +Overworld_CgramAuxToMain = $02C769 ; $014769 +UnderworldExitData_overworld_id = $02DD8A ; $015D8A +Pool_LoadSpecialOverworld_GFX_0AA3 = $02E6E1 ; $0166E1 +Pool_LoadSpecialOverworld_palette_prop_b = $02E701 ; $016701 +Pool_LoadSpecialOverworld_GFX_0AA2 = $02E821 ; $016821 +Overworld_ScrollMap = $02F273 ; $017273 +LoadSubscreenOverlay = $02FD0D ; $017D0D -Link_ItemReset_FromOverworldThings = $07B107 +Link_ItemReset_FromOverworldThings = $07B107 ; $03B107 +Player_IsScreenTransitionPermitted = $07F439 ; $03F439 -Tagalong_Init = $099EFC -Sprite_ReinitWarpVortex = $09AF89 -Sprite_ResetAll = $09C44E -Sprite_OverworldReloadAll = $09C499 +Tagalong_Init = $099EFC ; $049EFC +Sprite_ReinitWarpVortex = $09AF89 ; $04AF89 +Sprite_ResetAll = $09C44E ; $04C44E +Sprite_OverworldReloadAll = $09C499 ; $04C499 +OverworldPalettesScreenToSet_New = $09C635 ; $04C635 -Overworld_SetFixedColorAndScroll = $0BFE70 +BirdTravel_LoadAmbientOverlay = $0AB948 ; $053948 -Overworld_LoadPalettes = $0ED5A8 -Palette_SetOwBgColor_Long = $0ED618 -LoadGearPalettes_bunny = $0ED6DD +Overworld_SetFixedColorAndScroll = $0BFE70 ; $05FE70 -PaletteIDtoOffset_OW2 = $1BEC3B -Palette_SpriteAux3 = $1BEC77 -Palette_MainSpr = $1BEC9E -Palette_SpriteAux1 = $1BECC5 -Palette_SpriteAux2 = $1BECE4 -Palette_Sword = $1BED03 -Palette_Shield = $1BED29 -Palette_MiscSpr = $1BED6E -Palette_ArmorAndGloves = $1BEDF9 -Palette_Hud = $1BEE52 -Palette_OverworldBgAux3 = $1BEEA8 -Palette_OverworldBgMain = $1BEEC7 +Overworld_LoadPalettes = $0ED5A8 ; $0755A8 +Palette_SetOwBgColor_Long = $0ED618 ; $075618 +Overworld_SetScreenBGColorCacheOnly = $0ED61D ; $07561D +LoadGearPalettes_bunny = $0ED6DD ; $0756DD +Overworld_CheckForSpecialOverworldTrigger = $0EDE49 ; $075E49 +SpecialOverworld_CheckForReturnTrigger = $0EDEE3 ; $075EE3 +Overworld_DwDeathMountainPaletteAnimation = $0EF582 ; $077582 + +Overworld_Entrance = $1BBBF4 ; $0DBBF4 +PaletteIDtoOffset_OW_Main = $1BEC3B ; $0DEC3B +Palette_SpriteAux3 = $1BEC77 ; $0DEC77 +Palette_MainSpr = $1BEC9E ; $0DEC9E +Palette_SpriteAux1 = $1BECC5 ; $0DECC5 +Palette_SpriteAux2 = $1BECE4 ; $0DECE4 +Palette_Sword = $1BED03 ; $0DED03 +Palette_Shield = $1BED29 ; $0DED29 +Palette_MiscSpr = $1BED6E ; $0DED6E +Palette_ArmorAndGloves = $1BEDF9 ; $0DEDF9 +Palette_Hud = $1BEE52 ; $0DEE52 +Palette_OverworldBgAux3 = $1BEEA8 ; $0DEEA8 +Palette_OverworldBgMain = $1BEEC7 ; $0DEEC7 +PaletteData_owmain = $1BE6C8 ; $0DE6C8 ; ============================================================================== ; Debug addresses: @@ -120,44 +164,36 @@ Palette_OverworldBgMain = $1BEEC7 ; These can be used to turn off each hook used. Some are reliant on eachother ; and disabling only some can break entire features. +; TODO: Create a log of dependencies and change the naming structure of the +; vars themseleves to be more reflective of those features. -; TODO: Re-assess the letters and numbers. A lot has changed since they were -; originally marked. -; The letter indicates during which process the hook is called and the letter is -; roughly the order in which it is called. -; W = Takes place during a warp -; T = Takes place during a regular transition -; E = Takes place when exiting a dungeon -; S = Takes place when entering a special area - -; W7 -; Animated tiles on warp. -; $00D8D5 -!Func00D8D5 = $01 - -; W8 -; Enable/Disable subscreen. -; $00DA63 -!Func00DA63 = $01 - -; T2.5 (probably) ; Makes the game decompress the 3 static OW tile sheets on transition. ; $00D585 !Func00D585 = $01 +; Animated tiles on warp. +; $00D8D5 +!Func00D8D5 = $01 + +; Enable/Disable subscreen. +; $00DA63 +!Func00DA63 = $01 + ; Changes the InitTilesets function to call from the long tables. -; $006221 +; $00E221 !Func00E221 = $01 ; Zeros out the BG color when mirror warping to the pyramid area. ; $00EEBB !Func00EEBB = $01 -; W9 BG scrolling for HC and the pyramid area. +; $007C67 +!Func00FC67 = $01 + +; BG scrolling for HC and the pyramid area. ; $00FF7C !Func00FF7C = $01 -; E2 ; Changes the function that loads overworld properties when exiting a dungeon. ; Includes removing asm that plays music in certain areas and changing how ; animated tiles are loaded. @@ -168,67 +204,92 @@ Palette_OverworldBgMain = $1BEEC7 ; $028632 !Func028632 = $01 -; E1 ; Changes part of a function that changes the sub mask color when leaving ; dungeons. -; $029AA6 -!Func029AA6 = $01 - -; T2 S2 W2 -; Main subscreen loading function. -; $02AF58 -!Func02AF58 = $01 - -; W1 -; turns on subscreen for pyramid. -; $02B2D4 -!Func02B2D4 = $01 - -; W6 -; Activate subscreen durring pyramid warp. -; $02B3A1 -!Func02B3A1 = $01 - -; Controls overworld vertical subscreen movement for the pyramid BG. -; $02BC44 -!Func02BC44 = $01 - -; T4 Changes how the pyramid BG scrolls durring transition. -; $02C02D -!Func02C02D = $01 - -; W3 Main palette loading routine. -; $02C692 -!Func02C692 = $01 +; $029A37 +!Func029A37 = $01 ; Rain animation code. ; $02A4CD !Func02A4CD = $01 -; T1 -; Mosaic. -; $02AADB -!Func02AADB = $01 +; $02A5D3 +!Func02A5D3 = $01 + +; $02A62C +!Func02A62C = $01 + +; $02A9C4 +!Func02A9C4 = $01 + +; $02AB64 +!Func02AB64 = $01 -; T3 ; Transition animated and main palette. ; $02ABBE !Func02ABBE = $01 -; Loads the animated tiles after the overworld map is closed. -; $0ABC5A -!Func0ABC5A = $01 +; $02AC40 +!Func02AC40 = $01 + +; Main subscreen loading function. +; $02AF58 +!Func02AF58 = $01 + +; turns on subscreen for pyramid. +; $02B2D4 +!Func02B2D4 = $01 + +; Activate subscreen durring pyramid warp. +; $02B391 +!Func02B391 = $01 + +; Reset a var needed for whirpool GFX transfer. +; $02B490 +!Func02B490 = $01 + +; Controls overworld vertical subscreen movement for the pyramid BG. +; $02BC44 +!Func02BC44 = $01 + +; Changes how the pyramid BG scrolls durring transition. +; $02C02D +!Func02C02D = $01 + +; $02C0C3 +!Func02C0C3 = $01 + +; Main palette loading routine. +; $02C692 +!Func02C692 = $01 + +; $02E598 +!Func02E598 = $01 + +; $02E931 +!Func02E931 = $01 + +; $02EF44 +!Func02EF44 = $01 + +; $03B518 +!Func07B518 = $01 + +; $04C4C7 +!Func09C4C7 = $01 ; Loads different animated tiles when returning from bird travel. ; $0AB8F5 !Func0AB8F5 = $01 -; W5 -; Load overlay, fixed color, and BG color. -; $0BFEC6 -!Func0BFEC6 = $01 +; Loads the animated tiles after the overworld map is closed. +; $0ABC5A +!Func0ABC5A = $01 + +; Load overlay, fixed color, and BG color. +; $0BFEB6 +!Func0BFEB6 = $01 -; S1 W4 ; Transparent color durring warp and during special area enter. ; $0ED627 !Func0ED627 = $01 @@ -237,68 +298,77 @@ Palette_OverworldBgMain = $1BEEC7 ; $0ED8AE !Func0ED8AE = $01 +; $1BC8B1 +!Func1BC8B1 = $01 + ; If 1, all of the default vanilla pool values will be applied. 00 by default. -!UseVanillaPool = $02 +!UseVanillaPool = $00 ; Use this var to disable all of the debug vars above. !AllOff = $00 if !AllOff == 1 +!Func00D585 = $00 !Func00D8D5 = $00 !Func00DA63 = $00 -!Func00D585 = $00 !Func00E221 = $00 !Func00EEBB = $00 +!Func00FC67 = $00 !Func00FF7C = $00 + !Func0283EE = $00 !Func028632 = $00 -!Func029AA6 = $00 +!Func029A37 = $00 +!Func02A4CD = $00 +!Func02A5D3 = $00 +!Func02A62C = $00 +!Func02A9C4 = $00 +!Func02AB64 = $00 +!Func02ABBE = $00 +!Func02AC40 = $00 !Func02AF58 = $00 !Func02B2D4 = $00 -!Func02B3A1 = $00 +!Func02B391 = $00 +!Func02B490 = $00 !Func02BC44 = $00 !Func02C02D = $00 +!Func02C0C3 = $00 !Func02C692 = $00 -!Func02A4CD = $00 -!Func02AADB = $00 -!Func02ABBE = $00 -!Func0ABC5A = $00 +!Func02E598 = $00 +!Func02E931 = $00 +!Func02EF44 = $00 + +!Func07B518 = $00 + +!Func09C4C7 = $00 + !Func0AB8F5 = $00 -!Func0BFEC6 = $00 +!Func0ABC5A = $00 + +!Func0BFEB6 = $00 + !Func0ED627 = $00 !Func0ED8AE = $00 + +!Func1BC8B1 = $00 endif ; ============================================================================== ; Fixing old hooks: ; ============================================================================== -; TODO: Eventually remove these? I'm not sure. If anyone uses an old ZS on their +; TODO: Eventually remove these? I'm not sure. If anyone used an old ZS on their ; ROM these will need to be fixed but also could block people from hooking into -; these spots. - -; Loads the transparent color under some load conditions. -org $0BFEB6 - STA.l $7EC500 +; these spots. We could potentially add these to a "repair ROM" asm feature. ; Main Palette loading routine. -org $0ED5E7 +org $0ED5E7 ; $0755E7 JSL.l Palette_OverworldBgAux3 -; After leaving special areas like Zora's and the Master Sword area. -org $02E94A - JSL.l Overworld_LoadPalettes - ; Repairs an old ZS call. org $02ABB8 ; $012BB8 db $A9, $09, $80, $02 -; Some old but now unused addresses: -; $028027 -; $029C0C -; $029D1E -; $029F82 - ; ============================================================================== ; Expanded Space ; ============================================================================== @@ -315,33 +385,33 @@ Pool: ; $2A32 DW dead grass color ; $19C6 SW dark green shadow color .BGColorTable ; $140000 - if !UseVanillaPool == 1 - ; LW - dw $2669, $2669, $2669, $0000, $0000, $0000, $0000, $0000 - dw $2669, $2669, $2669, $0000, $0000, $0000, $0000, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + if !UseVanillaPool == 1 + ; LW + dw $2669, $2669, $2669, $0000, $0000, $0000, $0000, $0000 + dw $2669, $2669, $2669, $0000, $0000, $0000, $0000, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 + dw $2669, $2669, $2669, $2669, $2669, $2669, $2669, $2669 - ; DW - dw $2A32, $2A32, $2A32, $0000, $0000, $0000, $0000, $0000 - dw $2A32, $2A32, $2A32, $0000, $0000, $0000, $0000, $2A32 - dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 - dw $2A32, $2A32, $2A32, $0000, $0000, $2A32, $2A32, $2A32 - dw $2A32, $2A32, $2A32, $0000, $0000, $2A32, $2A32, $2A32 - dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 - dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 - dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 + ; DW + dw $2A32, $2A32, $2A32, $0000, $0000, $0000, $0000, $0000 + dw $2A32, $2A32, $2A32, $0000, $0000, $0000, $0000, $2A32 + dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 + dw $2A32, $2A32, $2A32, $0000, $0000, $2A32, $2A32, $2A32 + dw $2A32, $2A32, $2A32, $0000, $0000, $2A32, $2A32, $2A32 + dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 + dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 + dw $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32, $2A32 - ; SW - dw $19C6, $19C6, $19C6, $0000, $0000, $0000, $0000, $0000 - dw $0000, $19C6, $19C6, $0000, $0000, $0000, $0000, $0000 - dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 - dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 - endif + ; SW + dw $19C6, $19C6, $19C6, $0000, $0000, $0000, $0000, $0000 + dw $0000, $19C6, $19C6, $0000, $0000, $0000, $0000, $0000 + dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + endif assert pc() <= $288140 ; Valid values: @@ -352,76 +422,76 @@ Pool: org $288140 ; $140140 .EnableBGColor ; 0x01 - if !UseVanillaPool > 0 - db $01 - endif + if !UseVanillaPool > 0 + db $01 + endif org $288141 ; $140141 .EnableMainPalette ; 0x01 - if !UseVanillaPool > 0 - db $01 - endif - + if !UseVanillaPool > 0 + db $01 + endif + org $288142 ; $140142 .EnableMosaic ; 0x01 Unused for now. - if !UseVanillaPool > 0 - db $01 - endif + db $01 ; When non 0 this will allow animated tiles to be updated between OW ; transitions. Default is $FF. org $288143 ; $140143 .EnableAnimated ; 0x01 - if !UseVanillaPool > 0 - db $01 - endif - + if !UseVanillaPool > 0 + db $01 + endif + ; When non 0 this will allow Subscreen Overlays to be updated between OW ; transitions. Default is $FF. org $288144 ; $140144 .EnableSubScreenOverlay ; 0x01 - if !UseVanillaPool > 0 - db $01 - endif + if !UseVanillaPool > 0 + db $01 + endif ; This is a reserved value that ZS will write to when it has applied the ; ASM. That way the next time ZS loads the ROM it knows to read the custom - ; values instead of using the default ones. The current version is 02. + ; values instead of using the default ones. The current version is 03. org $288145 ; $140145 .ZSAppliedASM ; 0x01 - db $02 + db $03 ; When non 0 this will cause rain to appear on all areas in the beginning ; phase. Default is $FF. org $288146 ; $140146 .EnableBeginningRain ; 0x01 - if !UseVanillaPool > 0 - db $00 - endif + ;if !UseVanillaPool > 0 + db $FF + ;endif - ; TODO: Add a place to change this in ZS. Once that is done add this to the + ; TODO: Add a place to change this in ZS. Once that is done add this to the ; vanilla pool checks as well. ; When non 0 this will disable the ambiant sound that plays in the mire ; area after the event is triggered. Default is $FF. org $288147 ; $140147 .EnableRainMireEvent ; 0x01 - db $FF + db $FF ; When non 0 this will make the game reload all gfx in between OW ; transitions. Default is $FF. org $288148 ; $140143 .EnableTransitionGFXGroupLoad ; 0x01 - if !UseVanillaPool > 0 - db $01 - endif + if !UseVanillaPool > 0 + db $01 + endif + ; TODO: Vanilla pool check disabled for now until we put an actual place to + ; change it. ; The bridge color is different from the Master Sword area so we are going to - ; hard code it here for now. Defualt is $2669 which is the vanilla LW green. + ; hard code it here for now. Default is $2669 which is the vanilla LW green. org $288149 ; $140149 .BGColorTable_Bridge ; 0x02 - if !UseVanillaPool > 0 - dw $2669 - endif + ;if !UseVanillaPool > 0 + dw $2669 + ;endif ; The rest of these are extra bytes that can be used for anything else ; later on. @@ -440,66 +510,70 @@ Pool: ; $05 is the title screen palette? org $288160 ; $140160 .MainPaletteTable ; 0xA0 - if !UseVanillaPool == 1 - ; LW - db $00, $00, $00, $02, $00, $20, $00, $20 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - ; DW - db $01, $01, $01, $03, $01, $03, $01, $03 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - db $01, $01, $01, $01, $01, $01, $01, $01 - ; SW - db $00, $00, $00, $00, $00, $00, $00, $00 - db $04, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - endif + if !UseVanillaPool == 1 + ; LW + db $00, $00, $00, $02, $00, $02, $00, $02 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + + ; DW + db $01, $01, $01, $03, $01, $03, $01, $03 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + db $01, $01, $01, $01, $01, $01, $01, $01 + + ; SW + db $00, $00, $00, $00, $00, $00, $00, $00 + db $04, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + endif assert pc() <= $288200 ; Valid values: - ; ; ----udlr + ; .... udlr ; u - Up ; d - Down ; l - Left ; r - Right org $288200 ; $140200 .MosaicTable ; 0xA0 - ;if !UseVanillaPool == 1 - ; LW - db $05, $00, $02, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $08, $08, $00, $00, $00, $00, $00, $00 - db $01, $00, $00, $00, $00, $00, $02, $00 - db $00, $00, $02, $00, $00, $01, $00, $00 - db $00, $01, $02, $00, $00, $02, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - ; DW - db $05, $00, $02, $00, $00, $00, $00, $00 - db $00, $00, $02, $04, $00, $00, $00, $00 - db $00, $08, $00, $00, $00, $01, $02, $00 - db $00, $00, $00, $08, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - ; SW - db $04, $01, $00, $00, $00, $00, $00, $00 - db $04, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - db $00, $00, $00, $00, $00, $00, $00, $00 - ;endif + if !UseVanillaPool == 1 + ; LW + db $05, $00, $02, $00, $00, $00, $00, $00 + db $00, $00, $02, $00, $00, $00, $00, $08 + db $08, $08, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + + ; DW + db $05, $00, $02, $00, $00, $00, $00, $00 + db $00, $00, $02, $00, $00, $00, $00, $00 + db $08, $08, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + + ; SW + db $04, $04, $00, $00, $00, $00, $00, $00 + db $04, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + endif assert pc() <= $2882A0 ; Not the same as OWGFXGroupTable_sheet7. The game uses a combination of $59 @@ -515,33 +589,33 @@ Pool: ; frames and the regular water tiles. org $2882A0 ; $1402A0 .AnimatedTable ; 0xA0 - if !UseVanillaPool == 1 - ; LW - db $5B, $5B, $5B, $59, $5B, $59, $5B, $59 - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + if !UseVanillaPool == 1 + ; LW + db $5B, $5B, $5B, $59, $5B, $59, $5B, $59 + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - ; DW - db $5B, $5B, $5B, $59, $5B, $59, $5B, $59 - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + ; DW + db $5B, $5B, $5B, $59, $5B, $59, $5B, $59 + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - ; SW - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B - endif + ; SW + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + db $5B, $5B, $5B, $5B, $5B, $5B, $5B, $5B + endif assert pc() <= $288340 ; Valid values: @@ -560,33 +634,33 @@ Pool: ; $009F is the rain overlay. org $288340 ; $140340 .OverlayTable ; 0x140 - if !UseVanillaPool == 1 - ; LW - dw $009D, $00FF, $00FF, $0095, $00FF, $0095, $00FF, $0095 - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + if !UseVanillaPool == 1 + ; LW + dw $009D, $00FF, $00FF, $0095, $00FF, $0095, $00FF, $0095 + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - ; DW - dw $009D, $00FF, $00FF, $009C, $00FF, $009C, $00FF, $009C - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $0096, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $009F, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + ; DW + dw $009D, $00FF, $00FF, $009C, $00FF, $009C, $00FF, $009C + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $0096, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $009F, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - ; SP - dw $0097, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $0093, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF - endif + ; SP + dw $0097, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $0093, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + dw $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF, $00FF + endif assert pc() <= $288480 ; Just in case 0xFF is used and there is no sheet to load when warping using @@ -599,232 +673,232 @@ Pool: ; LW org $288480 ; $140480 .OWGFXGroupTable_sheet0 - if !UseVanillaPool == 1 - db $3A ; 0x00 sheet 0 - endif + if !UseVanillaPool == 1 + db $3A ; 0x00 sheet 0 + endif org $288481 ; $140481 .OWGFXGroupTable_sheet1 - if !UseVanillaPool == 1 - db $3B ; 0x00 sheet 1 - endif + if !UseVanillaPool == 1 + db $3B ; 0x00 sheet 1 + endif org $288482 ; $140482 .OWGFXGroupTable_sheet2 - if !UseVanillaPool == 1 - db $3C ; 0x00 sheet 2 - endif + if !UseVanillaPool == 1 + db $3C ; 0x00 sheet 2 + endif org $288483 ; $140483 .OWGFXGroupTable_sheet3 - if !UseVanillaPool == 1 - db $FF ; 0x00 sheet 3 - endif + if !UseVanillaPool == 1 + db $FF ; 0x00 sheet 3 + endif org $288484 ; $140484 .OWGFXGroupTable_sheet4 - if !UseVanillaPool == 1 - db $57 ; 0x00 sheet 4 - endif + if !UseVanillaPool == 1 + db $57 ; 0x00 sheet 4 + endif org $288485 ; $140485 .OWGFXGroupTable_sheet5 - if !UseVanillaPool == 1 - db $4C ; 0x00 sheet 5 - endif + if !UseVanillaPool == 1 + db $4C ; 0x00 sheet 5 + endif org $288486 ; $140486 .OWGFXGroupTable_sheet6 - if !UseVanillaPool == 1 - db $FF ; 0x00 sheet 6 - endif + if !UseVanillaPool == 1 + db $FF ; 0x00 sheet 6 + endif org $288487 ; $140487 .OWGFXGroupTable_sheet7 - if !UseVanillaPool == 1 - db $5B ; 0x00 sheet 7 + if !UseVanillaPool == 1 + db $5B ; 0x00 sheet 7 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x01 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x02 - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x03 - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x04 - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x05 - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x06 - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x07 + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x01 + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x02 + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x03 + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x04 + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x05 + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x06 + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x07 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x08 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x09 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x0A - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0B - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0C - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0D - db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0E - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x0F + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x08 + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x09 + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x0A + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0B + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0C + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0D + db $3A, $3B, $3C, $FF, $56, $4F, $FF, $5B ; 0x0E + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x0F - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x10 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x11 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x12 - db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x13 - db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x14 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x15 - db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x16 - db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x17 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x10 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x11 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x12 + db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x13 + db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x14 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x15 + db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x16 + db $3A, $3B, $3C, $FF, $50, $4B, $FF, $5B ; 0x17 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x18 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x19 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x1A - db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x1B - db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x1C - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x1D - db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x1E - db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x1F + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x18 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x19 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x1A + db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x1B + db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x1C + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x1D + db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x1E + db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x1F - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x20 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x21 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x22 - db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x23 - db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x24 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x25 - db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x26 - db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x27 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x20 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x21 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x22 + db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x23 + db $3A, $3B, $3C, $FF, $52, $49, $FF, $5B ; 0x24 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x25 + db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x26 + db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x27 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x28 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x29 - db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x2A - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2B - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2C - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x2D - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2E - db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x2F + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x28 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x29 + db $3A, $3B, $3C, $FF, $57, $4C, $FF, $5B ; 0x2A + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2B + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2C + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x2D + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x2E + db $3A, $3B, $3C, $FF, $55, $4A, $FF, $5B ; 0x2F - db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x30 - db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x31 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x32 - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x33 - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x34 - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x35 - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x36 - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x37 + db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x30 + db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x31 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x32 + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x33 + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x34 + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x35 + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x36 + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x37 - db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x38 - db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x39 - db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x3A - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3B - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3C - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3D - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3E - db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3F + db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x38 + db $3A, $3B, $3C, $FF, $55, $54, $FF, $5B ; 0x39 + db $3A, $3B, $3C, $FF, $FF, $FF, $FF, $5B ; 0x3A + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3B + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3C + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3D + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3E + db $3A, $3B, $3C, $FF, $51, $4E, $FF, $5B ; 0x3F - ; DW - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x40 - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x41 - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x42 - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x43 - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x44 - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x45 - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x46 - db $42, $43, $44, $FF, $60, $34, $FF, $59 ; 0x47 + ; DW + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x40 + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x41 + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x42 + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x43 + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x44 + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x45 + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x46 + db $42, $43, $44, $FF, $60, $34, $FF, $59 ; 0x47 - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x48 - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x49 - db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x4A - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4B - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4C - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4D - db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4E - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x4F + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x48 + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x49 + db $42, $43, $44, $FF, $2D, $2E, $FF, $59 ; 0x4A + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4B + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4C + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4D + db $42, $43, $44, $FF, $33, $34, $FF, $59 ; 0x4E + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x4F - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x50 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x51 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x52 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x53 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x54 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x55 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x56 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x57 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x50 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x51 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x52 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x53 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x54 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x55 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x56 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x57 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x58 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x59 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x5A - db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x5B - db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x5C - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x5D - db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x5E - db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x5F + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x58 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x59 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x5A + db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x5B + db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x5C + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x5D + db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x5E + db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x5F - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x60 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x61 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x62 - db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x63 - db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x64 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x65 - db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x66 - db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x67 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x60 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x61 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x62 + db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x63 + db $42, $43, $44, $FF, $35, $36, $FF, $59 ; 0x64 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x65 + db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x66 + db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x67 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x68 - db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x69 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6A - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6B - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6C - db $42, $43, $44, $FF, $20, $2B, $FF, $59 ; 0x6D - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6E - db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x6F + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x68 + db $42, $43, $44, $FF, $2F, $30, $FF, $59 ; 0x69 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6A + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6B + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6C + db $42, $43, $44, $FF, $20, $2B, $FF, $59 ; 0x6D + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x6E + db $42, $43, $44, $FF, $2B, $2C, $FF, $59 ; 0x6F - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x70 - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x71 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x72 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x73 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x74 - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x75 - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x76 - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x77 + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x70 + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x71 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x72 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x73 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x74 + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x75 + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x76 + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x77 - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x78 - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x79 - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x7A - db $42, $43, $44, $Ff, $37, $38, $FF, $59 ; 0x7B - db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x7C - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x7D - db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x7E - db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x7F + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x78 + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x79 + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x7A + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x7B + db $42, $43, $44, $FF, $37, $38, $FF, $59 ; 0x7C + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x7D + db $42, $43, $44, $FF, $31, $32, $FF, $59 ; 0x7E + db $42, $43, $44, $FF, $FF, $FF, $FF, $59 ; 0x7F - ; SW - db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x80 - db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x81 - db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x82 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x83 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x84 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x85 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x86 - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x87 + ; SW + db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x80 + db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x81 + db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x82 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x83 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x84 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x85 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x86 + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x87 - db $3A, $3B, $3C, $17, $40, $41, $39, $5B ; 0x88 - db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x89 - db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x8A - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8B - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8C - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8D - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8E - db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8F + db $3A, $3B, $3C, $17, $40, $41, $39, $5B ; 0x88 + db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x89 + db $3A, $3B, $3C, $FF, $47, $48, $FF, $5B ; 0x8A + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8B + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8C + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8D + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8E + db $3A, $3B, $3C, $FF, $53, $4D, $FF, $5B ; 0x8F - db $3A, $3B, $3C, $08, $00, $22, $1B, $5B ; 0x90 - db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x91 - db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x92 - db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x93 - db $3A, $3B, $3C, $3D, $53, $47, $48, $5B ; 0x94 - db $3A, $3B, $3C, $3D, $53, $56, $4F, $5B ; 0x95 - db $3A, $3B, $3C, $3D, $35, $36, $3E, $5B ; 0x96 - db $3A, $3B, $3C, $3D, $57, $4C, $3E, $5B ; 0x97 + db $3A, $3B, $3C, $08, $00, $22, $1B, $5B ; 0x90 + db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x91 + db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x92 + db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x93 + db $3A, $3B, $3C, $3D, $53, $47, $48, $5B ; 0x94 + db $3A, $3B, $3C, $3D, $53, $56, $4F, $5B ; 0x95 + db $3A, $3B, $3C, $3D, $35, $36, $3E, $5B ; 0x96 + db $3A, $3B, $3C, $3D, $57, $4C, $3E, $5B ; 0x97 - db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x98 - db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x99 - db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x9A - db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x9B - db $3A, $3B, $3C, $3D, $53, $33, $34, $5B ; 0x9C - db $3A, $3B, $3C, $3D, $53, $57, $4C, $5B ; 0x9D - db $3A, $3B, $3C, $3D, $57, $4C, $3E, $5B ; 0x9E - db $3A, $3B, $3C, $3D, $53, $4D, $3E, $5B ; 0x9F - endif + db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x98 + db $3A, $3B, $3C, $08, $FF, $22, $1B, $5B ; 0x99 + db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x9A + db $3A, $3B, $3C, $06, $FF, $1F, $18, $5B ; 0x9B + db $3A, $3B, $3C, $3D, $53, $33, $34, $5B ; 0x9C + db $3A, $3B, $3C, $3D, $53, $57, $4C, $5B ; 0x9D + db $3A, $3B, $3C, $3D, $57, $4C, $3E, $5B ; 0x9E + db $3A, $3B, $3C, $3D, $53, $4D, $3E, $5B ; 0x9F + endif assert pc() <= $288980 ; TODO: Add a way to edit these within ZS? Unsure. @@ -834,49 +908,496 @@ Pool: ; LW org $288980 ; $140980 .DefaultGFXGroups_sheet0 - db $3A ; Sheet 0 + db $3A ; Sheet 0 org $288981 ; $140981 .DefaultGFXGroups_sheet1 - db $3B ; Sheet 1 + db $3B ; Sheet 1 org $288982 ; $140982 .DefaultGFXGroups_sheet2 - db $3C ; Sheet 2 + db $3C ; Sheet 2 org $288983 ; $140983 .DefaultGFXGroups_sheet3 - db $3D ; Sheet 3 + db $3D ; Sheet 3 org $288984 ; $140984 .DefaultGFXGroups_sheet4 - db $53 ; Sheet 4 + db $53 ; Sheet 4 org $288985 ; $140985 .DefaultGFXGroups_sheet5 - db $4D ; Sheet 5 + db $4D ; Sheet 5 org $288986 ; $140986 .DefaultGFXGroups_sheet6 - db $3E ; Sheet 6 + db $3E ; Sheet 6 org $288987 ; $140987 .DefaultGFXGroups_sheet7 - db $5B ; Sheet 7 + db $5B ; Sheet 7 - ; DW - db $42, $43, $44, $45, $2F, $30, $3F, $59 + ; DW + db $42, $43, $44, $45, $2F, $30, $3F, $59 - ; SW - db $3A, $3B, $3C, $3D, $47, $48, $3E, $5B - assert pc() <= $288998 ; $140998 + ; SW + db $3A, $3B, $3C, $3D, $47, $48, $3E, $5B + + ; This tells the game what each area's "parent" area is. + ; For small areas this is it's own area number. + ; For large areas this is the top left area in the 2x2 grid. + ; For wide areas this is the left area in the 2x1 grid. + ; For tall areas this is the top area in the 1x2 grid. + ; In vanilla, this table was shared for all 3 worlds. + org $288998 ; $140998 + .Overworld_ActualScreenID_New + + if !UseVanillaPool > 0 + ; LW + db $00, $00, $02, $03, $03, $05, $05, $07 + db $00, $00, $0A, $03, $03, $05, $05, $0F + db $10, $11, $12, $13, $14, $15, $16, $17 + db $18, $18, $1A, $1B, $1B, $1D, $1E, $1E + db $18, $18, $22, $1B, $1B, $25, $1E, $1E + db $28, $29, $2A, $2B, $2C, $2D, $2E, $2F + db $30, $30, $32, $33, $34, $35, $35, $37 + db $30, $30, $3A, $3B, $3C, $35, $35, $3F + + ; DW + db $40, $40, $42, $43, $43, $45, $45, $47 + db $40, $40, $4A, $43, $43, $45, $45, $4F + db $50, $51, $52, $53, $54, $55, $56, $57 + db $58, $58, $5A, $5B, $5B, $5D, $5E, $5E + db $58, $58, $62, $5B, $5B, $65, $5E, $5E + db $68, $69, $6A, $6B, $6C, $6D, $6E, $6F + db $70, $70, $72, $73, $74, $75, $75, $77 + db $70, $70, $7A, $7B, $7C, $75, $75, $7F + + ; SW + db $80, $81, $81, $83, $84, $85, $86, $87 + db $88, $81, $81, $8B, $8C, $8D, $8E, $8F + db $90, $91, $92, $93, $94, $95, $96, $97 + db $98, $99, $9A, $9B, $9C, $9D, $9E, $9F + endif + + ; Examples: + ; These work in vanilla: │ These do not: + ; ───────────────────────┼─────────────── + ; ┌──┬──┐ ┌──┬──┐ │ ┌──┬──┐ ┌──┬──┐ + ; │ │ │<->│ │ │ │ │ │ │ │ │ │ + ; ├──┼──┤ ├──┼──┤ │ ├──┼──┤<->├──┼──┤ + ; │ │ │<->│ │ │ │ │ │ │ │ │ │ + ; └──┴──┘ └──┴──┘ │ └──┴──┘ └──┴──┘ + ; ┌──┬──┐ │ ┌──┬──┐ + ; │ │ │ │ │ │ │ + ; ├──┼──┤ │ ├──┼──┤ + ; │ │ │ │ │ │ │ + ; └──┴──┘ │ └──┴──┘ + ; ↕ ↕ │ ↕ + ; ┌──┬──┐ │ ┌──┬──┐ + ; │ │ │ │ │ │ │ + ; ├──┼──┤ │ ├──┼──┤ + ; │ │ │ │ │ │ │ + ; └──┴──┘ │ └──┴──┘ + ; See the layout of Zelda: Interconnected Strongholds. + ; + ; None of these work in vanilla: + ; ┌──┬──┐ ┌──┬──┐ + ; │ │ │ │ │ │ + ; ├──┼──┤ ┌──┬──┐ ┌──┬──┐ ├──┼──┤ + ; │ │ │<->│ │ │ │ │ │<->│ │ │ + ; └──┴──┘ ├──┼──┤ ├──┼──┤ └──┴──┘ + ; │ │ │ │ │ │ + ; └──┴──┘ └──┴──┘ + ; ┌──┬──┐ ┌──┬──┐ + ; │ │ │ │ │ │ + ; ├──┼──┤ ├──┼──┤ + ; │ │ │ │ │ │ + ; └──┴──┘ └──┴──┘ + ; ↕ ↕ + ; ┌──┬──┐ ┌──┬──┐ + ; │ │ │ │ │ │ + ; ├──┼──┤ ├──┼──┤ + ; │ │ │ │ │ │ + ; └──┴──┘ └──┴──┘ + ; As of 05/13/25 there aren't any released hacks that use this kind of layout. + + ; These values or for the area you are going to, not the one coming from. + + org $288A38 ; $140A38 + .ByScreen1_New ; Transitioning right + if !UseVanillaPool > 0 + ; LW + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $1060, $1060, $0060, $1060, $F060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $1060, $1060, $F060, $1060, $1060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $0060, $0060, $1060, $1060, $F060 + + ; DW + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $1060, $1060, $0060, $1060, $F060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $1060, $1060, $F060, $1060, $1060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $F060, $0060, $0060, $1060, $1060, $F060 + + ; SW + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $1060, $1060, $F060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + dw $0060, $0060, $0060, $0060, $0060, $0060, $0060, $0060 + endif + + org $288B78 ; $140B78 + .ByScreen2_New ; Transitioning left + if !UseVanillaPool > 0 + ; LW + dw $0080, $0080, $0040, $0080, $0080, $0080, $0080, $0040 + dw $1080, $1080, $F040, $1080, $0080, $1080, $1080, $0040 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + dw $0080, $0080, $0040, $0080, $0080, $0040, $0080, $F080 + dw $1080, $1080, $F040, $1080, $1080, $F040, $1080, $1080 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + dw $0080, $0080, $0040, $0040, $0040, $0080, $0080, $0040 + dw $1080, $1080, $0040, $0040, $F040, $1080, $1080, $0040 + + ; DW + dw $0080, $0080, $0040, $0080, $0080, $0080, $0080, $0040 + dw $1080, $1080, $F040, $1080, $0080, $1080, $1080, $0040 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + dw $0080, $0080, $0040, $0080, $0080, $0040, $0080, $F080 + dw $1080, $1080, $F040, $1080, $1080, $F040, $1080, $1080 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + dw $0080, $0080, $0040, $0040, $0040, $0080, $0080, $0040 + dw $1080, $1080, $0040, $0040, $F040, $1080, $1080, $0040 + + ; SW + dw $0040, $0080, $0080, $0040, $0040, $0040, $0040, $0040 + dw $F040, $1080, $1080, $0040, $0040, $0040, $0040, $0040 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + dw $0040, $0040, $0040, $0040, $0040, $0040, $0040, $0040 + endif + + org $288CB8 ; $140CB8 + .ByScreen3_New ; Transitioning down + if !UseVanillaPool > 0 + ; LW + dw $1800, $1840, $1800, $1800, $1840, $1800, $1840, $1800 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1840, $1800 + dw $1800, $17C0, $1800, $1800, $17C0, $1800, $17C0, $1800 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1800, $1840 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1800, $1840 + dw $1800, $17C0, $1800, $1800, $17C0, $1800, $1800, $17C0 + dw $1800, $1840, $1800, $1800, $1800, $1800, $1840, $1800 + dw $1800, $1840, $1800, $1800, $1800, $1800, $1840, $1800 + + ; DW + dw $1800, $1840, $1800, $1800, $1840, $1800, $1840, $1800 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1840, $1800 + dw $1800, $17C0, $1800, $1800, $17C0, $1800, $17C0, $1800 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1800, $1840 + dw $1800, $1840, $1800, $1800, $1840, $1800, $1800, $1840 + dw $1800, $17C0, $1800, $1800, $17C0, $1800, $1800, $17C0 + dw $1800, $1840, $1800, $1800, $1800, $1800, $1840, $1800 + dw $1800, $1840, $1800, $1800, $1800, $1800, $1840, $1800 + + ; SW + dw $1800, $1800, $1840, $1800, $1800, $1800, $1800, $1800 + dw $1800, $1800, $1840, $1800, $1800, $1800, $1800, $1800 + dw $1800, $1800, $17C0, $1800, $1800, $1800, $1800, $1800 + dw $1800, $1800, $1800, $1800, $1800, $1800, $1800, $1800 + endif + + org $288DF8 ; $140DF8 + .ByScreen4_New ; Transitioning up + if !UseVanillaPool > 0 + ; LW + dw $2000, $2040, $1000, $2000, $2040, $2000, $2040, $1000 + dw $2000, $2040, $1000, $2000, $2040, $2000, $2040, $1000 + dw $1000, $0FC0, $1000, $1000, $0FC0, $1000, $1000, $0FC0 + dw $2000, $2040, $1000, $2000, $2040, $1000, $2000, $2040 + dw $2000, $2040, $1000, $2000, $2040, $1000, $2000, $2040 + dw $1000, $0FC0, $1000, $1000, $1000, $1000, $0FC0, $1000 + dw $2000, $2040, $1000, $1000, $1000, $2000, $2040, $1000 + dw $2000, $2040, $1000, $1000, $1000, $2000, $2040, $1000 + + ; DW + dw $2000, $2040, $1000, $2000, $2040, $2000, $2040, $1000 + dw $2000, $2040, $1000, $2000, $2040, $2000, $2040, $1000 + dw $1000, $0FC0, $1000, $1000, $0FC0, $1000, $1000, $0FC0 + dw $2000, $2040, $1000, $2000, $2040, $1000, $2000, $2040 + dw $2000, $2040, $1000, $2000, $2040, $1000, $2000, $2040 + dw $1000, $0FC0, $1000, $1000, $1000, $1000, $0FC0, $1000 + dw $2000, $2040, $1000, $1000, $1000, $2000, $2040, $1000 + dw $2000, $2040, $1000, $1000, $1000, $2000, $2040, $1000 + + ; SW + dw $1000, $2000, $2040, $1000, $1000, $1000, $1000, $1000 + dw $1000, $2000, $2040, $1000, $1000, $1000, $1000, $1000 + dw $1000, $1000, $1000, $1000, $1000, $1000, $1000, $1000 + dw $1000, $1000, $1000, $1000, $1000, $1000, $1000, $1000 + endif + + ; UNUSED: + ; The table OverworldTransitionPositionY found at $0128C4 was moved + ; here and the original 0x80 bytes are currently unused. + org $288F38 ; $140F38 + .OverworldTransitionPositionY_New + if !UseVanillaPool > 0 + ; LW + dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + dw $0000, $0000, $0200, $0000, $0000, $0000, $0000, $0200 + dw $0400, $0400, $0400, $0400, $0400, $0400, $0400, $0400 + dw $0600, $0600, $0600, $0600, $0600, $0600, $0600, $0600 + dw $0600, $0600, $0800, $0600, $0600, $0800, $0600, $0600 + dw $0A00, $0A00, $0A00, $0A00, $0A00, $0A00, $0A00, $0A00 + dw $0C00, $0C00, $0C00, $0C00, $0C00, $0C00, $0C00, $0C00 + dw $0C00, $0C00, $0E00, $0E00, $0E00, $0C00, $0C00, $0E00 + + ; DW + dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + dw $0000, $0000, $0200, $0000, $0000, $0000, $0000, $0200 + dw $0400, $0400, $0400, $0400, $0400, $0400, $0400, $0400 + dw $0600, $0600, $0600, $0600, $0600, $0600, $0600, $0600 + dw $0600, $0600, $0800, $0600, $0600, $0800, $0600, $0600 + dw $0A00, $0A00, $0A00, $0A00, $0A00, $0A00, $0A00, $0A00 + dw $0C00, $0C00, $0C00, $0C00, $0C00, $0C00, $0C00, $0C00 + dw $0C00, $0C00, $0E00, $0E00, $0E00, $0C00, $0C00, $0E00 + + ; SW + dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + dw $0200, $0000, $0000, $0200, $0200, $0200, $0200, $0200 + dw $0400, $0400, $0400, $0400, $0400, $0400, $0400, $0400 + dw $0600, $0600, $0600, $0600, $0600, $0600, $0600, $0600 + endif + + ; UNUSED: + ; The table OverworldTransitionPositionX found at 012944 was moved + ; here and the original 0x80 bytes are currently unused. + org $289078 ; $141078 + .OverworldTransitionPositionX_New + if !UseVanillaPool > 0 + ; LW + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0A00, $0E00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0A00, $0E00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0C00, $0C00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0C00, $0C00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0000, $0400, $0600, $0800, $0A00, $0A00, $0E00 + dw $0000, $0000, $0400, $0600, $0800, $0A00, $0A00, $0E00 + + ; DW + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0A00, $0E00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0A00, $0E00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0C00, $0C00 + dw $0000, $0000, $0400, $0600, $0600, $0A00, $0C00, $0C00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0000, $0400, $0600, $0800, $0A00, $0A00, $0E00 + dw $0000, $0000, $0400, $0600, $0800, $0A00, $0A00, $0E00 + + ; SW + dw $0000, $0200, $0200, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0200, $0200, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + dw $0000, $0200, $0400, $0600, $0800, $0A00, $0C00, $0E00 + endif + + ; The original trans_target_north table was moved here from $013EE2. + ; The original 0x0080 bytes space is currently unused. + org $2891B8 ; $1411B8 + .trans_target_north_new + if !UseVanillaPool > 0 + ; LW + dw $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20 + dw $FF20, $FF20, $0120, $FF20, $FF20, $FF20, $FF20, $0120 + dw $0320, $0320, $0320, $0320, $0320, $0320, $0320, $0320 + dw $0520, $0520, $0520, $0520, $0520, $0520, $0520, $0520 + dw $0520, $0520, $0720, $0520, $0520, $0720, $0520, $0520 + dw $0920, $0920, $0920, $0920, $0920, $0920, $0920, $0920 + dw $0B20, $0B20, $0B20, $0B20, $0B20, $0B20, $0B20, $0B20 + dw $0B20, $0B20, $0D20, $0D20, $0D20, $0B20, $0B20, $0D20 + + ; DW + dw $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20 + dw $FF20, $FF20, $0120, $FF20, $FF20, $FF20, $FF20, $0120 + dw $0320, $0320, $0320, $0320, $0320, $0320, $0320, $0320 + dw $0520, $0520, $0520, $0520, $0520, $0520, $0520, $0520 + dw $0520, $0520, $0720, $0520, $0520, $0720, $0520, $0520 + dw $0920, $0920, $0920, $0920, $0920, $0920, $0920, $0920 + dw $0B20, $0B20, $0B20, $0B20, $0B20, $0B20, $0B20, $0B20 + dw $0B20, $0B20, $0D20, $0D20, $0D20, $0B20, $0B20, $0D20 + + ; SW + dw $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20, $FF20 + dw $0120, $FF20, $FF20, $0120, $0120, $0120, $0120, $0120 + dw $0320, $0320, $0320, $0320, $0320, $0320, $0320, $0320 + dw $0520, $0520, $0520, $0520, $0520, $0520, $0520, $0520 + endif + + ; The original trans_target_west table was moved here from $013F62. + ; The original 0x0080 bytes space is currently unused. + org $2892F8 ; $1412F8 + .trans_target_west_new + if !UseVanillaPool > 0 + ; LW + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0900, $0D00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0900, $0D00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0B00, $0B00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0B00, $0B00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $FF00, $0300, $0500, $0700, $0900, $0900, $0D00 + dw $FF00, $FF00, $0300, $0500, $0700, $0900, $0900, $0D00 + + ; DW + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0900, $0D00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0900, $0D00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0B00, $0B00 + dw $FF00, $FF00, $0300, $0500, $0500, $0900, $0B00, $0B00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $FF00, $0300, $0500, $0700, $0900, $0900, $0D00 + dw $FF00, $FF00, $0300, $0500, $0700, $0900, $0900, $0D00 + + ; SW + dw $FF00, $0100, $0100, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $0100, $0100, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + dw $FF00, $0100, $0300, $0500, $0700, $0900, $0B00, $0D00 + endif + + ; The original Overworld_SpritePointers_state_0 table was moved here from + ; $04C881. The original 0x0080 bytes space is currently unused. + org $289438 ; $141438 + .Overworld_SpritePointers_state_0_New + if !UseVanillaPool > 0 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB42, $CB41, $CB5B, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB5F, $CB66, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB73, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + endif + + ; The original Overworld_SpritePointers_state_1 table was moved here from + ; $04C901. The original 0x0120 bytes space is currently unused. + org $289578 ; $141578 + .Overworld_SpritePointers_state_1_New + if !UseVanillaPool > 0 + dw $CF4C, $CB41, $CF7A, $CF84, $CB41, $CFA6, $CB41, $CFCE + dw $CB41, $CB41, $CFDE, $CB41, $CB41, $CB41, $CB41, $CFFD + dw $D013, $D020, $D02D, $D03A, $D041, $D051, $D05E, $D068 + dw $D078, $CB41, $D0A0, $D0B3, $CB41, $D0DB, $D0EB, $CB41 + dw $CB41, $CB41, $D125, $CB41, $CB41, $D12F, $CB41, $CB41 + dw $D148, $CB41, $D152, $D168, $D175, $D17C, $D186, $D193 + dw $D19D, $CB41, $D1E3, $D1F0, $D1FD, $D213, $CB41, $D259 + dw $CB41, $CB41, $D26C, $D279, $D292, $CB41, $CB41, $D2A8 + + dw $CB7A, $CBB7, $CBB7, $CBC4, $CBCB, $CBCB, $CB41, $CBD5 + dw $CB41, $CB41, $CBD9, $CB41, $CB41, $CB41, $CB41, $CBF5 + dw $CC02, $CC12, $CC25, $CC35, $CC45, $CC5E, $CC74, $CC84 + dw $CC9A, $CB41, $CCCE, $CCE1, $CB41, $CD03, $CD19, $CB41 + dw $CB41, $CB41, $CD59, $CB41, $CB41, $CD6C, $CB41, $CB41 + dw $CD7F, $CD83, $CD87, $CD8B, $CD9B, $CDAB, $CDBE, $CDD1 + dw $CDE1, $CE06, $CE06, $CE16, $CE26, $CE3C, $CE7F, $CE7F + dw $CB41, $CB41, $CE92, $CE9F, $CEB2, $CB41, $CB41, $CEC5 + + dw $CEDB, $CEF4, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + endif + + ; The original Overworld_SpritePointers_state_2 table was moved here from + ; $04CA21. The original 0x0120 bytes space is currently unused. + org $2896B8 ; $1416B8 + .Overworld_SpritePointers_state_2_New + if !UseVanillaPool > 0 + dw $D2B8, $CB41, $D2E3, $D2E7, $CB41, $D315, $CB41, $D343 + dw $CB41, $CB41, $D353, $CB41, $CB41, $CB41, $CB41, $D369 + dw $D37F, $D38F, $D39C, $D3A9, $D3B6, $D3C9, $D3D9, $D3E3 + dw $D3F3, $CB41, $D418, $D428, $CB41, $D447, $D454, $CB41 + dw $CB41, $CB41, $D491, $CB41, $CB41, $D49B, $CB41, $CB41 + dw $D4A8, $D4B8, $D4C2, $D4DE, $D4EE, $D4F5, $D502, $D515 + dw $D51F, $CB41, $D55C, $D56F, $D57F, $D58F, $D5D5, $D5D5 + dw $D5E5, $D5E5, $D5E5, $D5FE, $D611, $D621, $D621, $D621 + + dw $CB7A, $CBB7, $CBB7, $CBC4, $CBCB, $CBCB, $CB41, $CBD5 + dw $CB41, $CB41, $CBD9, $CB41, $CB41, $CB41, $CB41, $CBF5 + dw $CC02, $CC12, $CC25, $CC35, $CC45, $CC5E, $CC74, $CC84 + dw $CC9A, $CB41, $CCCE, $CCE1, $CB41, $CD03, $CD19, $CB41 + dw $CB41, $CB41, $CD59, $CB41, $CB41, $CD6C, $CB41, $CB41 + dw $CD7F, $CD83, $CD87, $CD8B, $CD9B, $CDAB, $CDBE, $CDD1 + dw $CDE1, $CE06, $CE06, $CE16, $CE26, $CE3C, $CE7F, $CE7F + dw $CB41, $CB41, $CE92, $CE9F, $CEB2, $CB41, $CB41, $CEC5 + + dw $CEDB, $CEF4, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + dw $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41, $CB41 + endif + + ; The original Overworld_SignText table was moved here from + ; $03F51D. The original 0x0120 bytes space is currently unused. + org $2897F8 ; $1417F8 + .Overworld_SignText_New: + if !UseVanillaPool > 0 + dw $00A7, $00A7, $0048, $0040, $0040, $00A7, $00A7, $00A7 + dw $00A7, $00A7, $003C, $0040, $0040, $00A7, $00A7, $003E + dw $003D, $0049, $0042, $0042, $00A7, $00A7, $003F, $00B0 + dw $003B, $003B, $00A7, $003B, $003B, $0044, $00A7, $00A7 + dw $003B, $003B, $00A7, $003B, $003B, $0045, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00A7, $00A7, $0041, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $0042, $00A7, $0046, $0046, $00A7 + dw $00A7, $00A7, $0047, $0043, $00A7, $0046, $0046, $00A7 + + dw $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7 + dw $00A7, $00A7, $00A8, $00A7, $00A7, $00A7, $00A7, $00A9 + dw $00A7, $00AA, $00AB, $00A7, $00A7, $00A7, $00A7, $00B1 + dw $00AF, $00AF, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7 + dw $00AF, $00AF, $00A7, $00A7, $00A7, $00AC, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00A7, $00A7, $00AD, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00AE, $00A7, $00A7, $00A7, $00A7 + + dw $00AF, $00AF, $00A7, $00A7, $00A7, $00AC, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00A7, $00A7, $00AD, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7, $00A7 + dw $00A7, $00A7, $00A7, $00AE, $00A7, $00A7, $00A7, $00A7 + endif } +assert pc() <= $289938 ; $141938 ; ============================================================================== ; Start of function space. ; ============================================================================== -org $2892B8 ; $1412B8 +org $289940 ; $141940 pushpc ; ============================================================================== @@ -896,14 +1417,13 @@ AnimateMirrorWarp_DecompressAnimatedTiles: PLX JSL.l DecompOwAnimatedTiles - + RTL } assert pc() <= $00D8EE else -; Undo the function above: org $00D8D5 ; $0058D5 db $A0, $58, $A5, $8A, $29, $BF, $C9, $03 db $F0, $0A, $C9, $05, $F0, $06, $C9, $07 @@ -949,9 +1469,6 @@ pushpc if !Func00DA63 == 1 -org $00D8F4 ; $0058F4 - SheetsTable_0AA4: - ; The first half of this function enables or disables BG1 for subscreen overlay ; use depending on the area. The second half reloads global sprite #2 sheet ; (rock vs skulls, different bush gfx, fish vs bone fish, etc.) based on what @@ -963,39 +1480,36 @@ AnimateMirrorWarp_LoadSubscreen: ; From this point on it is the vanilla function. PHB : PHK : PLB - + ; TODO: Eventually un-hardcode this. ; X = 0 for LW, 8 for DW LDA.l SheetsTable_0AA4, X : TAY - + ; Get the pointer for one of the 2 Global sprite #2 sheets. LDA.w GFXSheetPointers_sprite_low, Y : STA.b $00 LDA.w GFXSheetPointers_sprite_high, Y : STA.b $01 LDA.w GFXSheetPointers_sprite_bank, Y : STA.b $02 - STA.b $05 + STA.b $05 PLB - + REP #$31 ; Set A, X, and Y in 16bit mode. +1 no idea. - + ; Source address is determined above, number of tiles is 0x0040, base ; target address is $7F0000. LDX.w #$0000 LDY.w #$0040 - LDA.b $00 - JSR.w Do3To4High16Bit - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + RTL } assert pc() <= $00DABB else -; Undo the function above: org $00DA63 ; $005A63 db $64, $1D, $A5, $8A, $F0, $24, $C9, $70 db $F0, $20, $C9, $40, $F0, $1C, $C9, $5B @@ -1014,6 +1528,8 @@ endif pullpc ActivateSubScreen: { + PHB : PHK : PLB + STZ.b $1D PHX @@ -1025,7 +1541,7 @@ ActivateSubScreen: LDA.l $7EF300 : AND.w #$0040 : BEQ .notForest ; The forest canopy overlay. BRA .turnOn - + .notForest ; Check if we need to disable the rain in the misery mire. @@ -1034,17 +1550,18 @@ ActivateSubScreen: ; Has Misery Mire been triggered yet? LDA.l $7EF2F0 : AND.w #$0020 : BNE .notMire BRA .turnOn - + .notMire ; Check if we are in the beginning phase, if not, no rain. ; If $7EF3C5 >= 0x02. LDA.l $7EF3C5 : AND.w #$00FF : CMP.w #$0002 : BCS .noRain BRA .turnOn + .noRain - + ; Get the overlay value for this overworld area. - ; ReadOverlayArray + ; ReadOverlayArray LDA.b $8A : ASL : TAX LDA.w Pool_OverlayTable, X : CMP.w #$00FF : BEQ .normal ; If not $FF, assume we want an overlay. @@ -1061,6 +1578,8 @@ ActivateSubScreen: PLX + PLB + RTL } pushpc @@ -1069,33 +1588,35 @@ pushpc if !Func00EEBB == 1 -; Zeros out the BG color when mirror warping to the pyramid area. -; TODO: This is done in the vanilla I think as just a precaution at the apex of -; the fade to white to make sure all of the colors truly are white but it may -; not actually be needed. +; Zeros out the BG color when mirror warping from an area with the pyramid BG. +; This is done to prevent a case where the black transparent color is faded to +; white on top of the pyramid BG, resulting in a double faded effect on +; transparent tiles. org $00EEBB ; $006EBB -Func00EEBB: +Palette_InitWhiteFilter_Interupt: { - ; Check if we are warping to an area with the pyramid BG. - JSL.l ReadOverlayArray : CMP.w #$0096 : BNE .notHyruleCastle - ; This is annoying but I just needed a little bit of extra space. + ; Check if we are currently in an area that is using an overlay. + ; By this point $8A is already set to the area we are going to so flip the + ; #$40 bit to get the one we are currently in. + LDA.b $8A : EOR.w #$0040 : ASL : TAX + LDA.l Pool_OverlayTable, X : CMP.w #$0096 : BNE .notPyramidBG + ; If so, don't fade that color to white because then we will get the + ; double fading. JSL.l EraseBGColors - .notHyruleCastle + .notPyramidBG SEP #$20 ; Set A in 8bit mode. - + LDA.b #$08 : STA.w $06BB - - STZ.w $06BA - + STZ.w $06BA + RTL } assert pc() <= $00EEE0 else -; Undo the function above: org $00EEBB ; $006EBB db $A5, $8A, $C9, $1B, $00, $D0, $13, $A9 db $00, $00, $8F, $00, $C3, $7E, $8F, $40 @@ -1108,7 +1629,9 @@ endif pullpc EraseBGColors: { - LDA.w #$0000 : STA.l $7EC300 : STA.l $7EC340 : STA.l $7EC500 : STA.l $7EC540 + LDA.w #$0000 + STA.l $7EC300 : STA.l $7EC340 + STA.l $7EC500 : STA.l $7EC540 RTL } @@ -1120,29 +1643,34 @@ if !Func00FF7C == 1 ; Controls the BG scrolling for HC and the pyramid area. org $00FF7C ; $007F7C -Func00FF7C: +MirrorWarp_BuildDewavingHDMATable_Interupt: { LDA.w $1C80 : ORA.w $1C90 : ORA.w $1CA0 : ORA.w $1CB0 : CMP.b $E2 : BNE .BRANCH_DELTA SEP #$30 ; Set A, X, and Y in 8bit mode. STZ.b $9B - + INC.b $B0 - + JSL.l Overworld_SetFixedColorAndScroll REP #$30 ; Set A, X, and Y in 16bit mode. ; Check if we are warping to an area with the pyramid BG. JSL.l ReadOverlayArray : CMP.w #$0096 : BEQ .dont_align_bgs - LDA.b $E2 : STA.b $E0 : STA.w $0120 : STA.w $011E - LDA.b $E8 : STA.b $E6 : STA.w $0122 : STA.w $0124 + LDA.b $E2 : STA.b $E0 + STA.w $0120 + STA.w $011E + LDA.b $E8 : STA.b $E6 + STA.w $0122 + STA.w $0124 + .dont_align_bgs .BRANCH_DELTA - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + RTL } ; NOTE: This end point also uses up a null block at the end of the function. @@ -1150,7 +1678,6 @@ assert pc() <= $00FFC0 else -; Undo the function above: org $00FF7C ; $007F7C db $AD, $80, $1C, $0D, $90, $1C, $0D, $A0 db $1C, $0D, $B0, $1C, $C5, $E2, $D0, $28 @@ -1171,25 +1698,25 @@ if !Func0283EE == 1 ; Replaces a bunch of calls to a shared function. ; Intro_SetupScreen: org $028027 ; $010027 - JSR.w PreOverworld_LoadProperties_LoadMain_LoadMusicIfNeeded + JSR.w Overworld_LoadMusicIfNeeded assert pc() <= $02802B ; Dungeon_LoadSongBankIfNeeded: org $029C0C ; $011C0C - JMP PreOverworld_LoadProperties_LoadMain_LoadMusicIfNeeded + JMP.w Overworld_LoadMusicIfNeeded assert pc() <= $029C0F ; Mirror_LoadMusic: org $029D1E ; $011D1E - JSR.w PreOverworld_LoadProperties_LoadMain_LoadMusicIfNeeded + JSR.w Overworld_LoadMusicIfNeeded assert pc() <= $029D21 ; GanonEmerges_LoadPyramidArea: org $029F82 ; $011F82 - JSR.w PreOverworld_LoadProperties_LoadMain_LoadMusicIfNeeded + JSR.w Overworld_LoadMusicIfNeeded assert pc() <= $029F85 @@ -1197,7 +1724,7 @@ assert pc() <= $029F85 ; Includes removing asm that plays music in certain areas and changing how ; animated tiles are loaded. org $0283EE ; $0103EE -PreOverworld_LoadProperties_LoadMain: +PreOverworld_LoadProperties_Interupt: { LDX.b #$F3 @@ -1219,19 +1746,21 @@ PreOverworld_LoadProperties_LoadMain: LDX.b $8A LDA.l $7F5B00, X : AND.b #$0F : TAX - + .setToFull - + ; The value written here will take effect during NMI. STX.w $0132 - ; Set the ambient sound. Removed becuase this is also done later on. + ; Set the ambient sound. This is a bug present in vanilla. This was removed + ; because this is also done later on and does not need to be done twice. + ; Doing so creates a slight pause and causes the ambient sound to stop and + ; start playing again rather than just continuing to play. ;LDX.b $8A ;LDA.l $7F5B00, X : LSR #4 : STA.w $012D - + ; The decompression function increases it by 1 so subtract 1 here. JSL.l ReadAnimatedTable : DEC : TAY - JSL.l DecompOwAnimatedTiles ; Decompress all other graphics. @@ -1239,67 +1768,76 @@ PreOverworld_LoadProperties_LoadMain: ; Load palettes for overworld. JSR.w Overworld_LoadAreaPalettes - + LDX.b $8A - LDA.l $7EFD40, X : STA.b $00 - - LDA.l OverworldPalettesScreenToSet, X - + LDA.l OverworldPalettesScreenToSet_New, X + ; Load some other palettes. JSL.l Overworld_LoadPalettes ; Sets the background color (changes depending on area). JSL.l Palette_SetOwBgColor_Long - + LDA.b $10 : CMP.b #$08 : BNE .specialArea2 ; Copies $7EC300[0x200] to $7EC500[0x200]. JSR.w Dungeon_LoadPalettes_cacheSettings - + BRA .normalArea2 - + .specialArea2 - + ; Apparently special overworld handles palettes a bit differently? JSR.w SpecialOverworld_CopyPalettesToCache - + .normalArea2 - + ; Sets fixed colors and scroll values. JSL.l Overworld_SetFixedColorAndScroll - + ; Set darkness level to zero for the overworld. LDA.b #$00 : STA.l $7EC017 - + ; Sets up properties in the event a tagalong shows up. JSL.l Tagalong_Init - + ; Set animated sprite gfx for area 0x00 and 0x40. LDA.b $8A : AND.b #$3F : BNE .notForestArea LDA.b #$1E - JSL.l GetAnimatedSpriteTile_variable - + .notForestArea - ; Cache the overworld mode 0x09. - LDA.b #$09 : STA.w $010C - JSL.l Sprite_OverworldReloadAll + ; 0x09 is the normal overworld $10 module. + LDX.b #$09 + ; Check if we are going to a SW area. If so we need to move into the SW + ; mode after we are done loading. + LDA.b $8A : AND.b #$80 : BEQ .notSWArea + ; 0x0B is the SW overworld $10 module. + LDX.b #$0B + + .notSWArea + + ; Cache the overworld mode. + STX.w $010C + + JSL.l Sprite_OverworldReloadAll + ; Are we in the dark world? If so, there's no warp vortex there. LDA.b $8A : AND.b #$40 : BNE .noWarpVortex JSL.l Sprite_ReinitWarpVortex - + .noWarpVortex - + ; Check if Blind disguised as a crystal maiden was following us when ; we left the dungeon area. LDA.l $7EF3CC : CMP.b #$06 : BNE .notBlindGirl ; If it is Blind, kill her! LDA.b #$00 : STA.l $7EF3CC - + .notBlindGirl - + ; Reset player variables. STZ.b $6C ; In doorway flag STZ.b $3A ; BY Bitfield @@ -1307,56 +1845,62 @@ PreOverworld_LoadProperties_LoadMain: STZ.b $50 ; Link strafe STZ.b $5E ; Link speed handler STZ.w $0351 ; Link feet gfx fx - + ; Reinitialize many of Link's gameplay variables. JSR.w DeleteCertainAncillaeStopDashing - + LDA.l $7EF357 : BNE .notBunny LDA.l $7EF3CA : BEQ .notBunny - LDA.b #$01 : STA.w $02E0 : STA.b $56 - + LDA.b #$01 : STA.w $02E0 + STA.b $56 + LDA.b #$17 : STA.b $5D - + JSL.l LoadGearPalettes_bunny - + .notBunny - + ; Set screen to mode 1 with BG3 priority. LDA.b #$09 : STA.b $94 - + LDA.b #$00 : STA.l $7EC005 - + STZ.w $046C ; Collision BG1 flag STZ.b $EE ; Reset Link layer to BG2 STZ.w $0476 ; Another layer flag - - INC.b $11 ; SCAWFUL: We should verify what submodule this is moving to. + + ; Move to Overworld_LoadSubscreenAndSilenceSFX1 which is the 1st + ; submodule of Module_PreOverworld. + INC.b $11 INC.b $16 ; NMI HUD Update flag - + STZ.w $0402 : STZ.w $0403 - ; Vanilla alternate entry point. Called in 4 different locations all of - ; which are overwritten above. - .LoadMusicIfNeeded + ; Bleeds into the next function +} +; Vanilla alternate entry point. Called in 4 different locations all of +; which are overwritten above. +Overworld_LoadMusicIfNeeded: +{ LDA.w $0136 : BEQ .no_music_load_needed SEI - + ; Shut down NMI until music loads. STZ.w SNES.NMIVHCountJoypadEnable - + ; Stop all HDMA. STZ.w SNES.HDMAChannelEnable - + STZ.w $0136 - + LDA.b #$FF : STA.w SNES.APUIOPort0 - + JSL.l Sound_LoadLightWorldSongBank - + ; Re-enable NMI and joypad. LDA.b #$81 : STA.w SNES.NMIVHCountJoypadEnable - + .no_music_load_needed ; PLACE CUSTOM GFX LOAD HERE! @@ -1368,12 +1912,11 @@ assert pc() <= $02856A ; $01056A else -; Undo the function above: org $028027 ; $010027 - db $20, $4C, $85, $C2 + db $20, $4C, $85 org $029C0C ; $011C0C - db $4C, $4C, $85, $A5 + db $4C, $4C, $85 org $029D1E ; $011D1E db $20, $4C, $85 @@ -1439,60 +1982,56 @@ if !Func028632 == 1 ; Changes a function that loads animated tiles under certain conditions. org $028632 ; $010632 -Func028632: +Credits_LoadScene_Overworld_PrepGFX_Interupt: { ; The decompression function increases it by 1 so subtract 1 here. JSL.l ReadAnimatedTable : DEC : TAY - JSL.l DecompOwAnimatedTiles - - ; SCAWFUL: Verify the submodule ID being manipulated here. - LDA.b $11 : LSR A : TAX - - LDA.l Credits_LoadScene_PrepGFX_sprite_gfx, X : STA.w $0AA3 - + + ; The current scene of the Module_EndSequence module. Example: 0x04 is + ; the shot of kakariko and 0x06 is the shot of the desert palace. + LDA.b $11 : LSR : TAX + LDA.l Credits_LoadScene_PrepGFX_sprite_gfx, X : STA.w $0AA3 LDA.l Credits_LoadScene_PrepGFX_sprite_palette, X : PHA - + JSL.l InitTilesets ; Load Palettes. JSR.w Overworld_LoadAreaPalettes + PLA : STA.b $00 LDX.b $8A - - LDA.l OverworldPalettesScreenToSet, X - + LDA.l OverworldPalettesScreenToSet_New, X JSL.l Overworld_LoadPalettes - + LDA.b #$01 : STA.w $0AB2 - + JSL.l Palette_Hud - + LDA.l $11 : BNE .BRANCH_4 JSL.l CopyFontToVram - + .BRANCH_4 - + JSR.w Dungeon_LoadPalettes_cacheSettings JSL.l Overworld_SetFixedColorAndScroll - + LDA.l $8A : CMP.b #$80 : BCC .BRANCH_5 JSL.l Palette_SetOwBgColor_Long - + .BRANCH_5 - + LDA.b #$09 : STA.b $94 - + INC.b $B0 - + RTS } -assert pc() <= $028697 +assert pc() <= $028697 ; $010697 else -; Undo the function above: org $028632 ; $010632 db $A0, $58, $A5, $8A, $29, $BF, $C9, $03 db $F0, $0A, $C9, $05, $F0, $06, $C9, $07 @@ -1512,48 +2051,123 @@ endif ; ============================================================================== -if !Func029AA6 == 1 +if !Func029A37 == 1 ; Changes part of a function that changes the sub mask color when leaving ; dungeons. -org $029AA6 ; $011AA6 -Func029AA6: +org $029A37 ; $011A37 +Spotlight_ConfigureTableAndControl_Interupt: { + LDA.b $10 : CMP.b #$09 : BEQ .dontPrepForDungeon + CMP.b #$0B : BEQ .dontPrepForDungeon + ; Force V-blank in preperation for Dungeon mode. + JSL.l EnableForceBlank + + JSL.l Link_ItemReset_FromOverworldThings + + .dontPrepForDungeon + + LDA.b $10 : CMP.b #$09 : BEQ .inOWMode + CMP.b #$0B : BNE .notInOWMode + .inOWMode + + LDA.b $A1 : BNE .BRANCH_DELTA + LDA.b $A0 : CMP.b #$20 : BEQ .BRANCH_EPSILON + + .BRANCH_DELTA + + LDA.b #$0A + + LDX.b $2F : BNE .BRANCH_ZETA + LDA.b #$0B + + .BRANCH_ZETA + + STA.b $11 + + .BRANCH_EPSILON + + LDA.b #$10 : STA.w $069A + + ; Not an extended door type (palace or sanctuary). + LDA.w $0696 : ORA.w $0698 : BEQ .BRANCH_GAMMA + LDA.w $0699 : BEQ .BRANCH_GAMMA + LDX.b #$00 + + ASL : BCC .BRANCH_THETA + LDX.b #$18 + + .BRANCH_THETA + + LDA.w $0699 : AND.b #$7F : STA.w $0699 + + STX.w $0692 + STZ.w $0690 + + LDA.b #$09 : STA.b $11 + + STZ.b $B0 + + LDA.b #$15 : STA.w $012F + + .BRANCH_GAMMA + .notInOWMode + + STZ.b $96 : STZ.b $97 : STZ.b $98 + STZ.b $1E : STZ.b $1F : STZ.w $03EF + + REP #$30 + ; Setup fixed color values based on area number. LDX.w #$4C26 LDY.w #$8C4C - + ; TODO: Wtf why is this 0x00? ; Check for LW death mountain. JSL.l ReadOverlayArray : CMP.w #$0095 : BEQ .mountain - LDX.w #$4A26 : LDY.w #$874A - + LDX.w #$4A26 + LDY.w #$874A + ; Check for DW death mountain. CMP.w #$009C : BEQ .mountain BRA .other - + .mountain - - STX.b $9C : STY.b $9D - + + STX.b $9C + STY.b $9D + .other - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + RTS } -assert pc() <= $029AD3 +assert pc() <= $029AD3 ; $011AD3 else -; Undo the function above: -org $029AA6 ; $011AA6 -db $A5, $8A, $C9, $03, $00, $F0, $1F, $C9 -db $05, $00, $F0, $1A, $C9, $07, $00, $F0 -db $15, $A2, $26, $4A, $A0, $4A, $87, $C9 -db $43, $00, $F0, $0A, $C9, $45, $00, $F0 -db $05, $C9, $47, $00, $D0, $04, $86, $9C -db $84, $9D, $E2, $30, $60 +org $029A37 ; $011A37 +db $A5, $10, $C9, $09, $F0, $08, $22, $3D +db $89, $00, $22, $07, $B1, $07, $A5, $10 +db $C9, $09, $D0, $46, $A5, $A1, $D0, $06 +db $A5, $A0, $C9, $20, $F0, $0A, $A9, $0A +db $A6, $2F, $D0, $02, $A9, $0B, $85, $11 +db $A9, $10, $8D, $9A, $06, $AD, $96, $06 +db $0D, $98, $06, $F0, $25, $AD, $99, $06 +db $F0, $20, $A2, $00, $0A, $90, $02, $A2 +db $18, $AD, $99, $06, $29, $7F, $8D, $99 +db $06, $8E, $92, $06, $9C, $90, $06, $A9 +db $09, $85, $11, $64, $B0, $A9, $15, $8D +db $2F, $01, $64, $96, $64, $97, $64, $98 +db $64, $1E, $64, $1F, $9C, $EF, $03, $C2 +db $30, $A2, $26, $4C, $A0, $4C, $8C, $A5 +db $8A, $C9, $03, $00, $F0, $1F, $C9, $05 +db $00, $F0, $1A, $C9, $07, $00, $F0, $15 +db $A2, $26, $4A, $A0, $4A, $87, $C9, $43 +db $00, $F0, $0A, $C9, $45, $00, $F0, $05 +db $C9, $47, $00, $D0, $04, $86, $9C, $84 +db $9D, $E2, $30, $60 endif @@ -1562,12 +2176,12 @@ endif if !Func02AF58 == 1 ; Main subscreen overlay loading function. Changed so that they will load -; from a table. This does not change the event overlays like the lost woods -; changing to the tree canopy, the master sword area or the misery mire rain. +; from a table. This does not change the event overlays like the lost woods +; changing to the tree canopy, the master sword area, or the misery mire rain. ; This also does not change the overlay for under the bridge because it shares ; an area with the master sword. org $02AF58 ; $012F58 -CustomOverworld_LoadSubscreenOverlay_PostInit: +Overworld_ReloadSubscreenOverlay_Interupt: { SEP #$20 ; Set A in 8bit mode. @@ -1583,7 +2197,7 @@ CustomOverworld_LoadSubscreenOverlay_PostInit: ; Check to see if we are in a SW overworld area. LDA.b $8A : CMP.w #$0080 : BCC .notExtendedArea ; $0182 is the exit room number used for getting to Zora's Domain. - LDA.b $A0 : CMP.w #$0182 : BNE .notZoraFalls + LDA.b $A0 : CMP.w #$0182 : BNE .notZoraFalls SEP #$20 ; Set A in 8bit mode. ; Play rain (waterfall) sound. @@ -1607,13 +2221,13 @@ CustomOverworld_LoadSubscreenOverlay_PostInit: ; Save the overlay for later. PHX - JMP .loadSubScreenOverlay + JMP.w .loadSubScreenOverlay .masterSwordRecieved ; TODO: Write a patch to change what overlay is loaded here? BRA .noSubscreenOverlay - + .notMasterSwordArea ; TODO: Write a patch to change what overlay is loaded here? @@ -1631,30 +2245,32 @@ CustomOverworld_LoadSubscreenOverlay_PostInit: ; Triforce room. CMP.w #$0189 : BEQ .loadOverlayShortcut .noSubscreenOverlay - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + ; Clear TSQ PPU Register, to be handled in NMI. STZ.b $1D - INC.b $11 ; SCAWFUL: Verify the submodule we are moving to. - + ; Submodule 0x18 (Module09_18:) of Module 0x0B + ; (Overworld Mode (special overworld)) + INC.b $11 + RTS - + .notExtendedArea .mirrorWarp REP #$20 ; Set A in 16bit mode. JSL.l ReadOverlayArray : TAX - + LDA.b $8A : BNE .notForest ; Check if we have the master sword. LDA.l $7EF300 : AND.w #$0040 : BEQ .notForest ; TODO: Write a patch to change this? ; The forest canopy overlay. LDX.w #$009E - + .notForest ; Check if we need to disable the rain in the misery mire. @@ -1675,60 +2291,59 @@ CustomOverworld_LoadSubscreenOverlay_PostInit: LDA.b #$01 : STA.w $012D REP #$20 ; Set A in 16bit mode. - + .notMire ; Check if we are in the beginning phase, if not, no rain. ; If $7EF3C5 >= 0x02. - LDA.l Pool_EnableBeginningRain : BEQ .noRain + LDA.l Pool_EnableBeginningRain : AND.w #$00FF : BEQ .noRain LDA.l $7EF3C5 : AND.w #$00FF : CMP.w #$0002 : BCS .noRain ; The rain overlay. LDX.w #$009F - + .noRain - + ; Store the overlay for later. PHX ; If the value is 0xFF that means we didn't set any overlay so load the - ; pyramid one by default. + ; pyramid one by default. This is done in vanilla to not have to load the + ; BG during a normal transition from area 0x65 to the pyramid area. CPX.w #$00FF : BNE .notFF ; The pyramid background. - LDX.w #$009F ; #$0096 + LDX.w #$0096 .notFF - - ; TODO: Verify this. If it is an alternate entry I can't find where it is - ; referenced anywhere. - ; $01300B ALTERNATE ENTRY POINT + .loadSubScreenOverlay - STY.b $84 + STY.b $84 + STX.b $8A : STX.b $8C ; Overworld map16 buffer manipulation during scrolling. - LDA.b $84 : SEC : SBC.w #$0400 : AND.w #$0F80 : ASL A : XBA : STA.b $88 - LDA.b $84 : SEC : SBC.w #$0010 : AND.w #$003E : LSR A : STA.b $86 - + LDA.b $84 : SEC : SBC.w #$0400 : AND.w #$0F80 : ASL : XBA : STA.b $88 + LDA.b $84 : SEC : SBC.w #$0010 : AND.w #$003E : LSR : STA.b $86 + STZ.w $0418 : STZ.w $0410 : STZ.w $0416 - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + ; Color +/- buffered register. LDA.b #$82 : STA.b $99 - + ; Puts OBJ, BG2, and BG3 on the main screen. LDA.b #$16 : STA.b $1C - + ; Puts BG1 on the subscreen. LDA.b #$01 : STA.b $1D ; Pull the 16 bit overlay from earlier and just discard the high byte. PLX : PLA - + ; One possible configuration for SNES.AddSubtractSelectAndEnable (CGADSUB). LDA.b #$72 - + ; Comparing different screen types. CPX.b #$97 : BEQ .loadOverlay ; Fog 1 CPX.b #$94 : BEQ .loadOverlay ; Master sword/bridge 2 @@ -1738,56 +2353,53 @@ CustomOverworld_LoadSubscreenOverlay_PostInit: CPX.b #$9F : BEQ .loadOverlay ; Rain ; Alternative setting for CGADSUB (only background is enabled on ; subscreen). - LDA.b #$20 - + LDA.b #$20 + CPX.b #$95 : BEQ .loadOverlay ; Sky CPX.b #$9C : BEQ .loadOverlay ; Lava CPX.b #$96 : BEQ .loadOverlay ; Pyramid BG - LDX.b $11 - ; TODO: Investigate what these checks are for. - CPX.b #$23 : BEQ .loadOverlay - CPX.b #$2C : BEQ .loadOverlay + LDX.b $11 : CPX.b #$23 : BEQ .loadOverlay + CPX.b #$2C : BEQ .loadOverlay STZ.b $1D - + .loadOverlay - + ; Apply the selected settings to CGADSUB's mirror ($9A). STA.b $9A - + JSR.w LoadSubscreenOverlay - + ; This is the "under the bridge" area. LDA.b $8C : CMP.b #$94 : BNE .notUnderBridge ; All this is doing is setting the X coordinate of BG1 to 0x0100 ; rather than 0x0000. (this area uses the second half of the data only, ; similar to the master sword area). LDA.b $E7 : ORA.b #$01 : STA.b $E7 - + .notUnderBridge - + REP #$20 ; Set A in 16bit mode. - + ; We were pretending to be in a different area to load the subscreen ; overlay, so we're restoring all those settings. LDA.l $7EC213 : STA.b $8A LDA.l $7EC215 : STA.b $84 LDA.l $7EC217 : STA.b $88 LDA.l $7EC219 : STA.b $86 - + LDA.l $7EC21B : STA.w $0418 LDA.l $7EC21D : STA.w $0410 LDA.l $7EC21F : STA.w $0416 - + SEP #$20 ; Set A in 8bit mode. - + RTS } assert pc() <= $02B0D2 ; $0130D2 else -; Undo the function above: org $02AF58 ; $012F58 db $A5, $8A, $C9, $80, $00, $90, $44, $A2 db $97, $00, $A5, $A0, $C9, $80, $01, $D0 @@ -1851,7 +2463,7 @@ Func02B2D4: JSR.w Overworld_LoadSubscreenAndSilenceSFX1 ; In vanilla a check for the overlay is done here but we don't need - ; it at all. It is handled in Func02B3A1 later on. + ; it at all. It is handled in Func02B391 later on. ;JSL.l EnableSubScreenCheckForPyramid RTL @@ -1860,7 +2472,6 @@ assert pc() <= $02B2E6 ; $0132E6 else -; Undo the function above: org $02B2D4 ; $0132D4 db $20, $19, $AF, $A5, $8A, $C9, $1B, $F0 db $04, $C9, $5B, $D0, $04, $A9, $01, $85 @@ -1873,13 +2484,12 @@ EnableSubScreenCheckForPyramid: { REP #$20 ; Set A in 16bit mode. - ; ReadOverlayArray LDA.b $8A : ASL : TAX - LDA.w Pool_OverlayTable, X - - CMP.w #$0096 : BNE .notPyramidOrCastle + LDA.w Pool_OverlayTable, X : CMP.w #$0096 : BNE .notPyramidOrCastle SEP #$20 ; Set A in 8bit mode. + LDA.b #$01 : STA.b $1D + .notPyramidOrCastle SEP #$20 ; Set A in 8bit mode. @@ -1890,66 +2500,69 @@ pushpc ; ============================================================================== -if !Func02B3A1 == 1 +if !Func02B391 == 1 ; Handles activating the subscreen and special BG color when warping to an area ; with the pyramid BG. -org $02B3A1 ; $0133A1 -Func02B3A1: +org $02B391 ; $013391 +MirrorWarp_LoadSpritesAndColors_Interupt: { + LDA.l OverworldPalettesScreenToSet_New, X + JSL.l Overworld_LoadPalettes + + JSL.l Overworld_SetScreenBGColorCacheOnly + JSL.l Overworld_SetFixedColorAndScroll + JSL.l EnableSubScreenCheckForPyramid - + REP #$20 ; Set A in 16bit mode. - + LDX.b #$00 - LDA.w #$7FFF - + .setBgPalettesToWhite - STA.l $7EC540, X - STA.l $7EC560, X - STA.l $7EC580, X - - STA.l $7EC5A0, X - STA.l $7EC5C0, X - STA.l $7EC5E0, X - - INX #2 : CPX.b #$20 : BNE .setBgPalettesToWhite - + + STA.l $7EC540, X : STA.l $7EC560, X + STA.l $7EC580, X : STA.l $7EC5A0, X + STA.l $7EC5C0, X : STA.l $7EC5E0, X + INX : INX : CPX.b #$20 : BNE .setBgPalettesToWhite + ; Also set the background color to white. STA.l $7EC500 JSL.l ReadOverlayArray - + ; This sets the color to transparent so that we don't see an additional ; white layer on top of the pyramid bg. CMP.w #$0096 : BNE .notPyramidOfPower - LDA.w #$0000 : STA.l $7EC500 : STA.l $7EC540 - + LDA.w #$0000 : STA.l $7EC500 + STA.l $7EC540 + .notPyramidOfPower - + SEP #$20 ; Set A in 8bit mode. - + JSL.l Sprite_ResetAll JSL.l Sprite_OverworldReloadAll JSL.l Link_ItemReset_FromOverworldThings JSR.w DeleteCertainAncillaeStopDashing - + LDA.b #$14 : STA.b $5D - + LDA.b $8A : AND.b #$40 : BNE .darkWorld JSL.l Sprite_ReinitWarpVortex - + .darkWorld - + RTL } assert pc() <= $02B40A ; $01340A else -; Undo the function above: -org $02B3A1 ; $0133A1 +org $02B391 ; $013391 +db $BF, $1C, $FD, $00, $22, $A8, $D5, $0E +db $22, $1D, $D6, $0E, $22, $70, $FE, $0B db $A5, $8A, $C9, $1B, $F0, $04, $C9, $5B db $D0, $04, $A9, $01, $85, $1D, $C2, $20 db $A2, $00, $A9, $FF, $7F, $9F, $40, $C5 @@ -1973,23 +2586,23 @@ if !Func02BC44 == 1 ; Controls overworld vertical subscreen movement for the pyramid BG. org $02BC44 ; $013C44 -Func02BC44: +Overworld_OperateCameraScroll_Interupt: { ; Check for the pyramid BG. JSL.l ReadOverlayArray : CMP.w #$0096 : BNE .BRANCH_IOTA JSL.l BGControl - BRA .BRANCH_IOTA + BRA .BRANCH_IOTA + assert pc() <= $02BC60 ; $013C60 org $02BC60 ; $013C60 .BRANCH_IOTA } -assert pc() <= $02BC60 +assert pc() <= $02BC60 ; $013C60 else -; Undo the function above: org $02BC44 ; $013C44 db $A5, $8A, $29, $3F, $00, $C9, $1B, $00 db $D0, $12, $A9, $00, $06, $C5, $E6, $90 @@ -2011,32 +2624,33 @@ ReadOverlayArray: RTL } -; TODO: These comparison values will need to be calulated somehow or set +; TODO: These comparison values will need to be calculated somehow or set ; depending on the area. Right now they are hardcoded to work with the ; pyramid area. BGControl: { + ; TODO: I'm pretty sure this part was AHE specific. Verify. ; Check link's Y position. This will need to be changed per area and per ; need. - LDA.b $20 : CMP.w #$08E0 : BCC .startShowingMountains + ;LDA.b $20 : CMP.w #$08E0 : BCC .startShowingMountains ; Lock the position so that nothing shows through the trees. - LDA.w #$06C0 : STA.b $E6 + ;LDA.w #$06C0 : STA.b $E6 - RTL + ;RTL - .startShowingMountains + ;.startShowingMountains ; Don't let the BG scroll down further than the "top" of the bg when ; walking up. - LDA.w #$0600 : CMP.b $E6 : BCC .dontLock ; #$0600 + LDA.w #$0600 : CMP.b $E6 : BCC .dontLock STA.b $E6 - + .dontLock - + ; Don't let the BG scroll up further than the "bottom" of the bg when ; walking down. - LDA.w #$06C0 : CMP.b $E6 : BCS .dontLock2 ; #$06C0 - STA.b $E6 ; $TODO: I had this at $E2 for some reason. + LDA.w #$06C0 : CMP.b $E6 : BCS .dontLock2 + STA.b $E6 .dontLock2 @@ -2050,18 +2664,20 @@ if !Func02C02D == 1 ; Changes how the pyramid BG scrolls durring transition. org $02C02D ; $01402D -Func02C02D: +OverworldScrollTransition_Interupt: { PHA JSL.l ReadOverlayArray2 PLA - + ; Check for the pyramid BG. - CPY.b #$96 : BEQ .dontMoveBg1 + CPY.b #$96 : BEQ .dontMoveBg1 ; This shifts the BG over by a half small area's width. This is to ; line up the mountain with the tower in the distance at the appropriate ; location when coming into the pyramid area from the right. - STA.b $E0, X + ; This also keeps the BG aligned when entering the area from below, + ; keeping you from seeing the mountains through the trees. + STA.b $E0, X ; NOTE: There is currently a bug in vanilla where if you exit a dungeon ; into the LW death mountain the sky background will become miss-aligned @@ -2069,14 +2685,13 @@ Func02C02D: ; another area. In order to fix this you would have to find the ; alignment exit code and change how the game aligns BG2 when exiting. ; Possibly when using the bird too. - + .dontMoveBg1 } assert pc() <= $02C039 ; $014039 else -; Undo the function above: org $02C02D ; $01402D db $A4, $8A, $C0, $1B, $F0, $06, $C0, $5B db $F0, $02, $95, $E0 @@ -2093,7 +2708,7 @@ ReadOverlayArray2: ; ReadOverlayArray LDA.b $8A : ASL : TAX - LDA.w Pool_OverlayTable, X : TAY + LDA.l Pool_OverlayTable, X : TAY SEP #$10 ; Set X and Y in 8bit mode. @@ -2120,20 +2735,18 @@ assert pc() <= $02A07D ; $01207D org $02C692 ; $014692 Overworld_LoadAreaPalettes: { - LDX.b $8A - LDA.l Pool_MainPaletteTable, X - ; $0AB3 = ; 0 - LW ; 1 - DW ; 2 - LW death mountain ; 3 - DW death mountain ; 4 - triforce room - STA.w $0AB3 + LDX.b $8A + LDA.l Pool_MainPaletteTable, X : STA.w $0AB3 ; Reset pal buffer high byte. STZ.w $0AA9 - + ; Load SP1 through SP4. JSL.l Palette_MainSpr @@ -2148,25 +2761,25 @@ Overworld_LoadAreaPalettes: ; Load SP5 (2nd half, 1st 3 colors), which is the sword palette. JSL.l Palette_Sword - + ; Load SP5 (2nd half, next 4 colors), which is the shield. JSL.l Palette_Shield ; Load SP7 (full) Link's whole palette, including Armor. JSL.l Palette_ArmorAndGloves - + LDX.b #$01 - + ; Changes the Palette_SpriteAux3 load depending on if we are in the LW or ; not. Will probably need it own custom table in the future? not sure. LDA.l $7EF3CA : AND.b #$40 : BEQ .lightWorld2 LDX.b #$03 - + .lightWorld2 - + ; Reset pal buffer0. STX.w $0AAC - + ; Load SP0 (first half) (or SP7 (first half)). JSL.l Palette_SpriteAux3 @@ -2175,18 +2788,17 @@ Overworld_LoadAreaPalettes: ; Load BP2 through BP5 (first halves). JSL.l Palette_OverworldBgMain - + RTS } assert pc() <= $02C6EB ; $0146EB else -; Undo the function above: org $02A07A ; $01207A db $20, $AD, $C6 -org $02C692 ; $14692 +org $02C692 ; $014692 db $A2, $02, $A5, $8A, $29, $3F, $C9, $03 db $F0, $0A, $C9, $05, $F0, $06, $C9, $07 db $F0, $02, $A2, $00, $A5, $8A, $29, $40 @@ -2219,11 +2831,8 @@ RainAnimation: ; If misery mire has been opened already, we're done. ;LDA.l $7EF2F0 : AND.b #$20 : BNE .skipMovement ; Check the frame counter. - ; On the third frame do a flash of lightning. - LDA.b $1A - ; On the 0x03rd frame, cue the lightning. - CMP.b #$03 : BEQ .lightning + LDA.b $1A : CMP.b #$03 : BEQ .lightning ; On the 0x05th frame, normal light level. CMP.b #$05 : BEQ .normalLight ; On the 0x24th frame, cue the thunder. @@ -2260,7 +2869,8 @@ RainAnimation: ; Overlay is only moved every 4th frame. LDA.b $1A : AND.b #$03 : BNE .skipMovement - LDA.w $0494 : INC A : AND.b #$03 : STA.w $0494 : TAX + LDA.w $0494 : INC : AND.b #$03 : STA.w $0494 + TAX LDA.b $E1 : CLC : ADC.l OWOverlay_HShift, X : STA.b $E1 LDA.b $E7 : CLC : ADC.l OWOverlay_VShift, X : STA.b $E7 @@ -2273,7 +2883,6 @@ assert pc() <= $02A52D ; $01252D else -; Undo the function above: org $02A4CD ; $0124CD db $A5, $8A, $C9, $70, $F0, $08, $AF, $C5 db $F3, $7E, $C9, $02, $B0, $51, $AF, $F0 @@ -2292,53 +2901,6 @@ endif ; ============================================================================== -if !Func02AADB == 1 - -; Main Mosaic Hook. Changes it to use a table instead of hardcoded to the woods -; areas. -org $02AADB ; $012ADB - JML MosaicAreaCheck - -assert pc() <= $02AADF ; $012ADF - -else - -; Undo the function above: -org $02AADB ; $012ADB -db $29, $3F, $F0, $06 - -endif - -pullpc -MosaicAreaCheck: -{ - PHB : PHK : PLB - - ; Check if the area we are in needs a mosaic. - TAX - LDA.w Pool_MosaicTable, x - - ; ----udlr - ; u - Up - ; d - Down - ; l - Left - ; r - Right - ; Filter out the the direction of the transition we are looking for. - AND.w $0416 : BEQ .noMosaic2 - ; Return to normal, with mosaic. - PLB - JML $02AAE5 - - .noMosaic2 - - ; Return to normal, no mosaic. - PLB - JML $02AAF4 -} -pushpc - -; ============================================================================== - if !Func02ABBE == 1 org $02ABBE ; $012BBE @@ -2349,7 +2911,6 @@ assert pc() <= $02ABC5 ; $012BC5 else -; Undo the function above: org $02ABBE ; $012BBE db $85, $17, $8D, $10, $07, $E6, $11 @@ -2361,34 +2922,113 @@ NewOverworld_FinishTransGfx: { PHB : PHK : PLB - LDA.w TransGFXModuleFrame : BNE .notFirstFrame - JSR.w CheckForChangeGraphicsTransitionLoad + ; The whirlpool code resuses this code so don't do any of the custom stuff if + ; we are in the whirlpool module. + LDA.b $11 : CMP.b #$2E : BEQ .whirpool + LDA.w TransGFXModuleFrame : BNE .notFirstFrame + JSR.w CheckForChangeGraphicsTransitionLoad - ; Prep the new static gfx tile sets. - JSR.w LoadTransMainGFX + ; Prep the new static gfx tile sets. + JSR.w LoadTransMainGFX - ; A check to see if we need to Prep the GFX in the buffer. - ; Saves about a frame. - LDA.b $04 : BEQ .dontPrep - JSR.w PrepTransMainGFX + ; A check to see if we need to Prep the GFX in the buffer. + ; Saves about a frame. + LDA.b $04 : BEQ .dontPrep + JSR.w PrepTransMainGFX - .dontPrep + .dontPrep - ; Move on to next submodule. + ; Move on to next submodule. + INC.b $11 + + .notFirstFrame + + LDA.b #$08 : STA.b $06 + + JSR.w BlockGFXCheck + + ; If we haven't made it to frame 8, don't move on yet. + CPY.b #$08 : BCC .return + ; Move on to next submodule. + INC.b $11 + + .return + + PLB + + RTL + + .whirpool + + ; On the "second" frame, upload the animated tiles. + LDA.b $B0 : CMP.b #$08 : BEQ .loadAnimated + LDA.w TransGFXModuleFrame : BNE .notFirstFrame2 + JSR.w CheckForChangeGraphicsTransitionLoad + + ; Prep the new static gfx tile sets. + JSR.w LoadTransMainGFX + + ; A check to see if we need to Prep the GFX in the buffer. + ; Saves about a frame. + LDA.b $04 : BEQ .dontPrep2 + JSR.w PrepTransMainGFX + + .dontPrep2 + + .notFirstFrame2 + + LDA.b #$08 : STA.b $06 + + JSR.w BlockGFXCheck + + ; If we haven't made it to frame 8, don't move on yet. + CPY.b #$08 : BCS .MoveOn + ; Don't move on to next submodule yet. + DEC.b $B0 + + .MoveOn + + ; Move on to next submodule. This will get undone by the vanilla + ; whirlpool code because it shared the function with the OW + ; transition code which uses $11 as its module index but the + ; whirlpool uses $B0 instead. INC.b $11 - .notFirstFrame + PLB - LDA.b #$08 : STA.b $06 + RTL - JSR.w BlockGFXCheck + .loadAnimated - ; If we haven't made it to frame 8, don't move on yet. - LDA.w TransGFXModuleFrame : CMP.b #$08 : BCC .return - ; Move on to next submodule. - INC.b $11 + ; The NMI_DoUpdates function is never actually run while the whirpool is + ; happening. So we need to upload the animated tiles manually here while + ; the screen is still blue to cover up the change. - .return + ; Set the bank for the source to $7E. + LDA.b #$7E : STA.w DMA.0_SourceAddrBank + + REP #$20 + + LDA.w #DMA.0_TransferParameters : STA.w SNES.VRAMAddrReadWriteLow + + LDA.w $0ADC : STA.w DMA.0_SourceAddrOffsetLow + + ; Set the target VRAM address. + LDA.w $0134 : STA.w SNES.VRAMAddrReadWriteLow + + ; Transfer #$400 = 4 * 256 = 1024 bytes = 1 Kbyte + LDA.w #$0400 : STA.w DMA.0_TransferSizeLow + + SEP #$20 + + ; Activate line 0. + LDA.b #$01 : STA.w SNES.DMAChannelEnable + + ; Move on to next submodule. This will get undone by the vanilla + ; whirlpool code because it shared the function with the OW + ; transition code which uses $11 as its module index but the + ; whirlpool uses $B0 instead. + INC.b $11 PLB @@ -2398,7 +3038,8 @@ NewOverworld_FinishTransGfx: BlockGFXCheck: { REP #$30 - ; $0E = $8A * 8 + + ; $0E = $8A * 8 LDA.b $8A : AND.w #$00FF : ASL #3 : STA.b $0E STZ.b $02 @@ -2417,6 +3058,7 @@ BlockGFXCheck: ; Get the sheet that needs to be loaded. LDA.w .sheetLoadOrder, Y : STA $02 + REP #$30 AND.w #$00FF : CLC : ADC.b $0E : TAX SEP #$20 @@ -2425,20 +3067,16 @@ BlockGFXCheck: ; Check if it is #$FF. CMP.b #$FF : BEQ .dontLoadThisSheet - ; Get the sheet that is currently loaded. + ; Get the sheet that is currently loaded and check if the sheets + ; are the same. LDX.b $02 - LDA.w TransGFXModule_PriorSheets, X - - ; Check if the sheets are the same. - CMP.b $00 : BEQ .dontLoadThisSheet + LDA.w TransGFXModule_PriorSheets, X : CMP.b $00 : BEQ .dontLoadThisSheet LDA.b $00 : STA.w TransGFXModule_PriorSheets, X ; Trigger NMI module: NMI_DoNothing which we replaced with ; NMI_UpdateChr_Bg2HalfAndAnimated down below. - LDA.b #$06 - - ; Signal for a graphics transfer in the NMI routine later. - STA.b $17 : STA.w $0710 + LDA.b #$06 : STA.b $17 + STA.w $0710 TXA : ASL : TAX @@ -2474,7 +3112,7 @@ BlockGFXCheck: INY : CPY.b $06 : BCC .loop .twoReady - + STY.w TransGFXModuleFrame RTS @@ -2483,13 +3121,13 @@ BlockGFXCheck: db $03, $04, $05, $06, $00, $01, $02, $07 .sheetTarget - dw $2000, $2400, $2800, $2C00, $3000, $3400, $3800, $3E00 + dw #$2000, #$2400, #$2800, #$2C00, #$3000, #$3400, #$3800, #$3E00 .sheetSource - dw $2000, $2800, $3000, $0000, $0800, $1000, $1800, $3C00 + dw #$2000, #$2800, #$3000, #$0000, #$0800, #$1000, #$1800, #$3C00 .sheetCount - dw $0800, $0800, $0800, $0800, $0800, $0800, $0800, $0400 + dw #$0800, #$0800, #$0800, #$0800, #$0800, #$0800, #$0800, #$0400 ; Only copy the latter half of the sheet to prevent the animated tiles ; from flickering on transition. @@ -2508,7 +3146,8 @@ CheckForChangeGraphicsTransitionLoad: ; Check to see if we need to update the animated tiles ; by checking what was previously loaded. JSL.l ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated1 - STA.w AnimatedTileGFXSet : DEC : TAY + STA.w AnimatedTileGFXSet + DEC : TAY ; This forces the game toupdate the animated tiles ; when going from one area to another. @@ -2539,9 +3178,8 @@ CheckForChangeGraphicsTransitionLoad: LDA.w Pool_BGColorTable, X STA.l $7EE018 JSL Oracle_BackgroundFix - NOP #4 - ;STA.l $7EC300 : STA.l $7EC500 - ;STA.l $7EC540 : STA.l $7EC340 + ; STA.l $7EC300 : STA.l $7EC500 + ; STA.l $7EC540 : STA.l $7EC340 SEP #$30 ; Set A, X, and Y in 8bit mode. @@ -2549,7 +3187,7 @@ CheckForChangeGraphicsTransitionLoad: ; loaded so that way the BG overlays have a chance to hide ; the cracks. ;INC.b $15 - + .dontUpdateBGColor1 RTS @@ -2559,7 +3197,8 @@ CheckForChangeGraphicsTransitionLoad: ; Check to see if we need to update the animated tiles by checking what ; was previously loaded. JSL.l ReadAnimatedTable : CMP.w AnimatedTileGFXSet : BEQ .dontUpdateAnimated2 - STA.w AnimatedTileGFXSet : DEC : TAY + STA.w AnimatedTileGFXSet + DEC : TAY ; This forces the game to update the animated tiles when going ; from one area to another. @@ -2599,20 +3238,19 @@ CheckForChangeGraphicsTransitionLoad: ; Set transparent color. only set the buffer so it fades in right ; during mosaic transition. - STA $7EE018 + STA.l $7EE018 JSL Oracle_MosaicFix ;STA.l $7EC300 : STA.l $7EC340 ; Write the fixed color. LDX.w #$4020 : STX.b $9C LDX.w #$8040 : STX.b $9D - + LDX.w #$4F33 LDY.w #$894F - + ; Change the fixed color depending on our sub screen overlay. ; Lost woods and skull woods. - ; ReadOverlayArray LDA.b $8A : ASL : TAX LDA.w Pool_OverlayTable, X : CMP.w #$009D : BEQ .noSpecialColor CMP.w #$0040 : BEQ .noSpecialColor @@ -2620,24 +3258,24 @@ CheckForChangeGraphicsTransitionLoad: CMP.w #$0096 : BEQ .specialColor LDX.w #$4C26 LDY.w #$8C4C - + ; LW death mountain. CMP.w #$0095 : BEQ .specialColor LDX.w #$4A26 LDY.w #$874A - + ; DW death mountain. CMP.w #$009C : BEQ .specialColor BRA .noSpecialColor - + .specialColor ; Write the fixed color. STX.b $9C STY.b $9D - + .noSpecialColor - + SEP #$30 ; Set A, X, and Y in 8bit mode. ; Don't update the CRAM until later when the overlays are loaded so @@ -2645,7 +3283,7 @@ CheckForChangeGraphicsTransitionLoad: ;INC.b $15 ; PLACE CUSTOM GFX LOAD HERE! - ;JML CheckForChangeGraphicsTransitionLoadCastle + JSL Oracle_CheckForChangeGraphicsNormalLoadBoat CheckForChangeGraphicsTransitionLoadRetrun: @@ -2659,30 +3297,28 @@ CheckForChangeGraphicsTransitionLoad: RTS } -; The following 2 functions are copied from the palettes.asm but they only +; The following 2 functions are copied from the bank 0x1B but they only ; copied colors into the buffer so these copy colors into the normal ram as ; well. Palette_OverworldBgMain2: { REP #$21 - - LDA.w $0AB3 : ASL A : TAX - - LDA.l PaletteIDtoOffset_OW2, X : ADC.w #$E6C8 : STA.b $00 - + + LDA.w $0AB3 : ASL : TAX + LDA.l PaletteIDtoOffset_OW_Main, X : ADC.w #PaletteData_owmain : STA.b $00 + REP #$10 - + ; Target BP2 through BP6 (first halves). ; Each palette has 7 colors. ; Load 5 palettes. LDA.w #$0042 LDX.w #$0006 LDY.w #$0004 - - JSR.w Palette_MultiLoad2 - + JSR.w Palette_MultiLoad_NonBuffer + SEP #$30 - + RTL } @@ -2690,51 +3326,52 @@ Palette_OverworldBgMain2: ; Upon close inspection, one sees that this algorithm is almost the same as ; the last subroutine. ; Name = Palette_MultiLoad(A, X, Y). - + ; Parameters: X = (number of colors in the palette - 1). ; A = offset to add to $7EC300, in other words, where to write ; in palette memory. ; Y = (number of palettes to load - 1). -Palette_MultiLoad2: +Palette_MultiLoad_NonBuffer: { STA.b $04 ; Save the values for future reference. STX.b $06 STY.b $08 - + ; The absolute address at $00 was planted in the calling function. This ; value is the bank #$1B ( => D in Rom) The address is found from $0AB6 and ; of course, store it at $02. - LDA.w #$001B : STA.b $02 - + LDA.w #$001B : STA.b $02 + .nextPalette ; $0AA8 + A parameter will be the X value. LDA.w $0AA8 : CLC : ADC.b $04 : TAX - + LDY.b $06 ; Tell me how long the palette is. - + .copyColors ; We're loading A from the address set up in the calling function. - LDA.b [$00] : STA.l $7EC300, X : STA.l $7EC500, X - + LDA.b [$00] : STA.l $7EC300, X + STA.l $7EC500, X + ; Increment the absolute portion of the address by two, and ; decrease the color count by one. INC.b $00 : INC.b $00 - - INX #2 - + + INX : INX + ; So basically loop (Y+1) times, taking (Y * 2 bytes) to $7EC300, X. DEY : BPL .copyColors - + ; This technique bumps us up to the next 4bpp (16 color) palette. LDA.b $04 : CLC : ADC.w #$0020 : STA.b $04 - + ; Decrease the number of palettes we have to load. DEC.b $08 - + BPL .nextPalette - + ; We're done loading palettes. - + RTS } @@ -2742,14 +3379,14 @@ LoadTransMainGFX: { ; Setup the decompression buffer address. ; $00[3] = $7E4000 - STZ.b $00 + STZ.b $00 LDA.b #$40 : STA.b $01 LDA.b #$7E : STA.b $02 STZ.b $04 REP #$30 - ; $0E = $8A * 8 + ; $0E = $8A * 8 LDA.b $8A : AND.w #$00FF : ASL #3 : STA.b $0E SEP #$20 @@ -2761,7 +3398,7 @@ LoadTransMainGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange0 @@ -2771,16 +3408,16 @@ LoadTransMainGFX: ; Increment buffer address by 0x0600. LDA.b $01 : CLC : ADC.b #$06 : STA.b $01 REP #$10 - + ; Sheet 1 (static 1) LDX.b $0E - LDA.w Pool_OWGFXGroupTable_sheet1, X : CMP.b #$FF : BEQ .noBgGfxChange1 + LDA.w Pool_OWGFXGroupTable_sheet1, X : CMP.b #$FF : BEQ .noBgGfxChange1 SEP #$10 CMP.w TransGFXModule_PriorSheets+1 : BEQ .noBgGfxChange1 TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange1 @@ -2799,7 +3436,7 @@ LoadTransMainGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange2 @@ -2818,7 +3455,7 @@ LoadTransMainGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange7 @@ -2831,24 +3468,23 @@ LoadTransMainGFX: PrepTransMainGFX: { ; Set bank for source address. - LDA.b #$7E : STA.b $02 : STA.b $05 - + LDA.b #$7E : STA.b $02 + STA.b $05 + REP #$31 - + ; Source address is $7E4000, number of tiles is 0x40, ; base address is $7F0000. LDX.w #$2000 LDY.w #$0040 LDA.w #$4000 - + ; The first graphics pack always uses the higher 8 palette values. JSL.l Do3To4High16BitLONG ; Number of tiles for next set is 0xC0. LDY.w #$00C0 - LDA.b $03 - JSL.l Do3To4Low16BitLONG SEP #$30 @@ -2868,7 +3504,6 @@ assert pc() <= $0ABC5E ; $053C5E else -; Undo the function above: org $0ABC5A ; $053C5A db $22, $9B, $E1, $00 @@ -2882,15 +3517,24 @@ CheckForChangeGraphicsNormalLoad: JSL.l InitTilesets ; Replaced code. - JSL.l ReadAnimatedTable : STA.w AnimatedTileGFXSet : DEC : TAY + JSL.l ReadAnimatedTable : STA.w AnimatedTileGFXSet + DEC : TAY ; This function is not needed here and is handled somewhere else. This ; forces the game to update the animated tiles when going from one area to ; another. - ;JSL.l DecompOwAnimatedTiles + ;JSL.l DecompOwAnimatedTiles ; PLACE CUSTOM GFX LOAD HERE! JSL Oracle_CheckForChangeGraphicsNormalLoadBoat + + ; TODO: Instead of the place custom gfx load here, pre-allocate a function. + ; Some free space + ; ZSOW_LoadCustomGraphics: + ; Maybe register push/pops or leave that to users + ; User defined custom graphics code + ; RTL + PLB RTL @@ -2903,53 +3547,51 @@ if !Func0AB8F5 == 1 ; Loads different animated tiles when returning from bird travel. org $0AB8F5 ; $0538F5 -Func0AB8F5: +BirdTravel_LoadTargetArea_Interupt: { JSL.l ReadAnimatedTable : STA.w AnimatedTileGFXSet - DEC : TAY - + DEC : TAY + ; From this point on it is the vanilla function. JSL.l DecompOwAnimatedTiles JSL.l Overworld_SetFixedColorAndScroll - + STZ.w $0AA9 STZ.w $0AB2 - + JSL.l InitTilesets - - ; SCAWFUL: Verify the interface submodule ID being used here. - ; Provides context on where in the jump table we're at. + + ; Move to the next submodule (BirdTravel_LoadAmbientOverlay) the next frame. INC.w $0200 - + STZ.b $B2 - + JSL.l Overworld_ReloadSubscreenOverlayAndAdvance - + ; Play sound effect indicating we're coming out of map mode. LDA.b #$10 : STA.w $012F JSL.l LoadAmbientSound - + ; If it's a different music track than was playing where we came from, ; simply change to it (as opposed to setting volume back to full). LDA.l $7F5B00, X : AND.b #$0F : TAX : CPX.w $0130 : BNE .different_music ; Otherwise, just set the volume back to full. LDX.b #$F3 - + .different_music - + STX.w $012C ; PLACE CUSTOM GFX LOAD HERE! JSL Oracle_CheckForChangeGraphicsNormalLoadBoat - + RTL } assert pc() <= $0AB948 ; $053948 else -; Undo the function above: org $0AB8F5 ; $0538F5 db $A0, $58, $A5, $8A, $29, $BF, $C9, $03 db $F0, $0A, $C9, $05, $F0, $06, $C9, $07 @@ -2971,7 +3613,8 @@ LoadAmbientSound: PHB : PHK : PLB ; Reset the ambient sound effect to what it was. - LDX.b $8A : LDA.l $7F5B00, X : LSR #4 : STA.w $012D + LDX.b $8A + LDA.l $7F5B00, X : LSR #4 : STA.w $012D ; Check if we need to stop the rain sound in the misery mire. LDA.w Pool_EnableRainMireEvent : BEQ .disableRainSound @@ -2979,7 +3622,7 @@ LoadAmbientSound: ; Has Misery Mire been triggered yet? LDA.l $7EF2F0 : AND.b #$20 : BNE .disableRainSound LDA.b #$01 : STA.w $012D - + .disableRainSound PLB @@ -2990,12 +3633,22 @@ pushpc ; ============================================================================== -if !Func0BFEC6 == 1 +if !Func0BFEB6 == 1 + +; There is a STZ.b $1D here in vanilla and I'm not sure why. It might have been +; to hide something but then just gets set a second later. So all this does in +; function is give the game a chance to hit NMI and flash a transparent color +; on screen when while warping from and area that has a different transparent +; color set. The whole function is NOT overwritten so that the default BG color +; values that get set here will retain their positions in ROM and can be changed +; in ZS. +org $0BFE70 ; $05FE70 + NOP : NOP ; Loads different special transparent colors and overlay speeds based on the -; overlay during transition and under other certain cases. Exact cases need to be -; investigated. When leaving dungeon. -org $0BFEC6 ; $05FEC6 +; overlay during transition and under other certain cases. TODO: Exact cases need +; to be investigated. When leaving dungeon. +org $0BFEB6 ; $05FEB6 Overworld_LoadBGColorAndSubscreenOverlay: { JSL.l ReplaceBGColor @@ -3009,96 +3662,108 @@ Overworld_LoadBGColorAndSubscreenOverlay: LDA.b $8A : CMP.w #$0070 : BNE .notMire ; Has Misery Mire been triggered yet? LDA.l $7EF2F0 : AND.w #$0020 : BNE .notMire - JMP .subscreenOnAndReturn - + JMP.w .subscreenOnAndReturn + .notMire JSL.l ReadOverlayArray ; Check for misery mire. CMP.w #$009F : BNE .notRain - JMP .subscreenOnAndReturn - + JMP.w .subscreenOnAndReturn + .notRain - + ; Change the fixed color depending on our sub screen overlay. ; Check for lost woods?, skull woods, and pyramid area. CMP.w #$009D : BEQ .noCustomFixedColor CMP.w #$0096 : BEQ .noCustomFixedColor LDX.w #$4C26 LDY.w #$8C4C - + ; Check for LW Death mountain. CMP.w #$0095 : BEQ .setCustomFixedColor LDX.w #$4A26 LDY.w #$874A - + ; Check for DW Death mountain. (not turtle rock?). CMP.w #$009C : BEQ .setCustomFixedColor SEP #$30 ; Set A, X, and Y in 8bit mode. + ; Don't set the subscreen during a warp to hide the transparent + ; color change. This will get set properly later in the warp + ; but not everywhere else. + LDA.b $11 : CMP.b #$23 : BEQ .inWarp + STZ.b $1D + + .inWarp + ; Update CGRAM this frame. INC.b $15 - + RTL - + .setCustomFixedColor - + ; Set the fixed color addition color values. STX.b $9C STY.b $9D - + .noCustomFixedColor - + LDA.b $11 : AND.w #$00FF : CMP.w #$0004 : BEQ .BRANCH_11 ; Make sure BG2 and BG1 Y scroll values are synchronized. ; Same for X scroll. LDA.b $E8 : STA.b $E6 LDA.b $E2 : STA.b $E0 - + ; Just because I need a bit more space. JSL.l ReadOverlayArray - + ; Are we at Hyrule Castle or Pyramid of Power? CMP.w #$0096 : BNE .subscreenOnAndReturn - JSL.l NeedSomeSpaceForWhateverThisIs - + JSL.l SpecialBgHorizOffsetAdjustment + BRA .subscreenOnAndReturn - + .BRANCH_11 - + ; Check for the pyramid BG. JSL.l ReadOverlayArray : CMP.w #$0096 : BNE .subscreenOnAndReturn ; Synchronize Y scrolls on BG0 and BG1. Same for X scrolls. LDA.b $E8 : STA.b $E6 LDA.b $E2 : STA.b $E0 - + LDA.w $0410 : AND.w #$00FF : CMP.w #$0008 : BEQ .BRANCH_12 ; Handles scroll for special areas maybe? LDA.w #$0838 : STA.b $E0 - + .BRANCH_12 - + LDA.w #$06C0 : STA.b $E6 - + .subscreenOnAndReturn - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + ; Put BG0 on the subscreen. LDA.b #$01 : STA.b $1D - + ; Update palette. INC.b $15 - + RTL } assert pc() <= $0BFFA8 ; $05FFA8 else -; Undo the function above: -org $0BFEC6 ; $05FEC6 +org $0BFE70 ; $05FE70 +STZ.b $1D + +org $0BFEB6 ; $05FEB6 +db $8F, $00, $C5, $7E, $8F, $00, $C3, $7E +db $8F, $40, $C5, $7E, $8F, $40, $C3, $7E db $A9, $20, $40, $85, $9C, $A9, $40, $80 db $85, $9D, $A5, $8A, $F0, $40, $C9, $70 db $00, $D0, $03, $4C, $9D, $FF, $C9, $40 @@ -3149,92 +3814,82 @@ ReplaceBGColor: REP #$20 ; Set A in 16bit mode. - ; TODO: Saving the Y may not be necessary, done just in case. - PHY - - ; Get area code and times it by 2. + ; Get area code and times it by 2. Get the color. LDA.b $8A : ASL : TAX - - ; Get the color. - LDA.w Pool_BGColorTable, X - - ; ORACLE TIME SYSTEM - STA $7EE018 - JSL Oracle_BackgroundFix ; $3482DD ; Background Fix - ;STA.l $7EC300 : STA.l $7EC340 ; Set the BG color. - STA.l $7EC500 : STA.l $7EC540 - TAY ; Save the color. + LDA.w Pool_BGColorTable, X : PHA + SEP #$20 ; Set A in 8bit mode. ; TODO: Pretty sure this is needed. Just keep an eye out for it. - ; Set the buffer color when exiting to the OW to prevent a bug when using the - ; map in an area with a subscreen overlay. - LDA.b $10 : CMP.b #$08 : BNE .notPreOverworld - BRA .setBuffer + ; Set the buffer color when exiting to the OW to prevent a bug when using + ; the map in an area with a subscreen overlay. + LDA.b $10 : CMP.b #$08 : BEQ .setBuffer + CMP.b #$0A : BEQ .setBuffer + ; Set the buffer color during warps. + LDA.b $11 : CMP.b #$23 : BNE .notWarp + .setBuffer - .notPreOverworld + REP #$20 ; Set A in 16bit mode. - ; TODO: Check if this is needed. I think it is. If not, it should always - ; set the buffer too. If not the warp fades into the wrong color for a - ; second. - ; Only set the buffer color during warps. - LDA.b $11 : CMP.b #$23 : BNE .notWarp - .setBuffer + ; Set the BG color buffer. + PLA + STA.l $7EE018 + JSL Oracle_BackgroundFix ; $3482DD ; Background Fix + ; STA.l $7EC300 : STA.l $7EC340 ; Set the BG color. + ; STA.l $7EC500 : STA.l $7EC540 - REP #$20 ; Set A in 16bit mode. - - TYA - - ; Set the BG color buffer. - STA.l $7EE018 - JSL Oracle_BackgroundFix - ; STA.l $7EC300 - STA.l $7EC340 + BRA .skipActualColor .notWarp REP #$20 ; Set A in 16bit mode. - PLY + ; Set the BG color. + PLA + STA.l $7EE018 + JSL Oracle_BackgroundFix + ; STA.l $7EC500 + ; STA.l $7EC540 + + .skipActualColor PLB RTL } -; TODO: Doccument this better and fiture out what it actually does. ; This sets the initial scroll offsets for the pyramid BG. It seems highly ; hardcoded and overly complicated. it could probably be changed to just a ; standard clamp function to keep it from being too high or too low. -NeedSomeSpaceForWhateverThisIs: +SpecialBgHorizOffsetAdjustment: { - LDA.b $E2 : SEC : SBC.w #$0778 : LSR A : TAY : AND.w #$4000 : BEQ .BRANCH_7 + LDA.b $E2 : SEC : SBC.w #$0778 : LSR : TAY : AND.w #$4000 : BEQ .BRANCH_7 TYA : ORA.w #$8000 : TAY - + .BRANCH_7 - + STY.b $00 - + LDA.b $E2 : SEC : SBC.b $00 : STA.b $E0 - + LDA.b $E6 : CMP.w #$06C0 : BCC .BRANCH_9 SEC : SBC.w #$0600 : AND.w #$03FF : CMP.w #$0180 : BCS .BRANCH_8 - LSR A : ORA.w #$0600 - - BRA .BRANCH_10 - - .BRANCH_8 - - LDA.w #$06C0 - + LSR : ORA.w #$0600 + BRA .BRANCH_10 - + + .BRANCH_8 + + LDA.w #$06C0 + + BRA .BRANCH_10 + .BRANCH_9 - LDA.b $E6 : AND.w #$00FF : LSR A : ORA.w #$0600 - + LDA.b $E6 : AND.w #$00FF : LSR : ORA.w #$0600 + .BRANCH_10 - + ; Set BG1 vertical scroll. STA.b $E6 @@ -3246,27 +3901,27 @@ pushpc if !Func0ED627 == 1 -; Loads the transparent color under some load conditions such as the -; mirror\warp. -; TODO: Investigate the other conditions. Exiting dungeons. +; Loads the transparent color during mirror\warp, entering/leaving special +; overworlds, exiting dungeons, loading end credits overworld scenes, whirlpool +; warps, and bird travel. org $0ED627 ; $075627 - JML InitColorLoad2 + JML.l InitColorLoad2 NOP assert pc() <= $0ED62C ; $07562C -else +else -; Undo the function above: org $0ED627 ; $075627 db $A5, $8A, $C9, $80, $00 endif -org $0ED652 +org $0ED652 ; $075652 InitColorLoad2_Return: pullpc + InitColorLoad2: { PHB : PHK : PLB @@ -3288,18 +3943,24 @@ InitColorLoad2: .storeColor + ; Set transparent color. STA.l $7EE018 JSL Oracle_BackgroundFix - ; STA.l $7EC300 + STA.l $7EC300 STA.l $7EC340 ; Set transparent color. - ;STA.l $7EC500 : STA.l $7EC540 + + ; TODO: Based on the conditions as explained above, double check that this is + ; not needed for any of them. + ;STA.l $7EC500 + ;STA.l $7EC540 INC.b $15 PLB - JML InitColorLoad2_Return + JML.l InitColorLoad2_Return } + pushpc ; ============================================================================== @@ -3308,17 +3969,17 @@ if !Func0ED8AE == 1 ; Resets the area special color after the screen flashes. org $0ED8AE ; $0758AE -Func0ED8AE: +Palette_RestoreFixedColor_Interupt: { LDA.b $1B : BNE .noSpecialColor REP #$30 ; Set A, X, and Y in 16bit mode. LDX.w #$4020 : STX.b $9C LDX.w #$8040 : STX.b $9D - + LDX.w #$4F33 LDY.w #$894F - + ; Change the fixed color depending on our sub screen overlay. ; Lost woods and skull woods. JSL.l ReadOverlayArray : CMP.w #$009D : BEQ .noSpecialColor @@ -3327,32 +3988,31 @@ Func0ED8AE: CMP.w #$0096 : BEQ .specialColor LDX.w #$4C26 LDY.w #$8C4C - + ; LW death mountain. CMP.w #$0095 : BEQ .specialColor LDX.w #$4A26 LDY.w #$874A - + ; DW death mountain. CMP.w #$009C : BEQ .specialColor BRA .noSpecialColor - + .specialColor STX.b $9C STY.b $9D - + .noSpecialColor - + SEP #$30 ; Set A, X, and Y in 8bit mode. - + RTL } assert pc() <= $0ED8FB ; $0758FB else -; Undo the function above: org $0ED8AE ; $0758AE db $A5, $1B, $D0, $46, $C2, $10, $A2, $20 db $40, $86, $9C, $A2, $40, $80, $86, $9D @@ -3373,16 +4033,19 @@ if !Func00D585 == 1 ; Interupts the vanilla LoadTransAuxGFX function org $00D673 ; $005673 - JML NewLoadTransAuxGFX + JML.l NewLoadTransAuxGFX assert pc() <= $00D677 ; $005677 +org $00D677 ; $005677 +LoadTransAuxGFX_return: + org $008C8A ; $000C8A dw NMI_UpdateChr_Bg2HalfAndAnimated assert pc() <= $008C8C ; $000C8C -org $02ABB4 +org $02ABB4 ; $012BB4 JSL.l NewPrepTransAuxGFX assert pc() <= $02ABB8 ; $012BB8 @@ -3393,7 +4056,7 @@ Decomp_bg_variableLONG: { PHB : PHK : PLB - JSR Decomp_bg_variable + JSR.w Decomp_bg_variable PLB @@ -3425,7 +4088,7 @@ Do3To4High16BitLONG: NMI_UpdateChr_Bg2HalfAndAnimated: { JSL.l NMI_UpdateChr_Bg2HalfAndAnimatedLONG - + RTS } @@ -3433,7 +4096,6 @@ assert pc() <= $00D5CB ; $0055CB else -; Undo the functions above: org $00D673 ; $005673 db $A9, $60, $85, $01 @@ -3463,24 +4125,25 @@ NewLoadTransAuxGFX: .indoors PLB - + ; Replaced code: LDA.b #$60 : STA.b $01 - JML $00D677 ; $005677 Return to regular code. + ; Return to regular code. + JML.l LoadTransAuxGFX_return .notNormalLoad ; Setup the decompression buffer address. ; $00[3] = $7E6000 - STZ.b $00 + STZ.b $00 LDA.b #$60 : STA.b $01 LDA.b #$7E : STA.b $02 STZ.b $04 REP #$30 - ; $0E = $8A * 8 + ; $0E = $8A * 8 LDA.b $8A : AND.w #$00FF : ASL #3 : STA.b $0E SEP #$20 @@ -3492,7 +4155,7 @@ NewLoadTransAuxGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange3 @@ -3510,7 +4173,7 @@ NewLoadTransAuxGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange4 @@ -3528,7 +4191,7 @@ NewLoadTransAuxGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange5 @@ -3546,7 +4209,7 @@ NewLoadTransAuxGFX: TAY INC.b $04 - + JSL.l Decomp_bg_variableLONG .noBgGfxChange6 @@ -3561,7 +4224,7 @@ NewLoadTransAuxGFX: PLB ; $005706 Return to regular code. - JML LoadTransAuxGFX_sprite_continue + JML.l LoadTransAuxGFX_sprite_continue } NMI_UpdateChr_Bg2HalfAndAnimatedLONG: @@ -3572,7 +4235,7 @@ NMI_UpdateChr_Bg2HalfAndAnimatedLONG: ; Increment on writes to SNES.VRAMDataWriteHigh. LDY.b #$80 : STY.w SNES.VRAMAddrIncrementVal - + ; Target is SNES.VRAMDataWriteLow, write two registers once ; (SNES.VRAMDataWriteLow / SNES.VRAMDataWriteHigh). LDA.w #$1801 : STA.w DMA.0_TransferParameters @@ -3581,14 +4244,14 @@ NMI_UpdateChr_Bg2HalfAndAnimatedLONG: ; Sheet 1 ; Target address LDA.w NewNMITarget1 : STA.w SNES.VRAMAddrReadWriteLow - + ; Source address LDA.w NewNMISource1 : STA.w DMA.0_SourceAddrOffsetLow LDY.b #$7F : STY.w DMA.0_SourceAddrBank - + ; Write count LDA.w NewNMICount1 : STA.w DMA.0_TransferSizeLow - + ; Transfer data on channel 0. LDY.b #$01 : STY.w SNES.DMAChannelEnable @@ -3598,21 +4261,21 @@ NMI_UpdateChr_Bg2HalfAndAnimatedLONG: ; Sheet 2 ; Target address LDA.w NewNMITarget2 : STA.w SNES.VRAMAddrReadWriteLow - + ; Source address LDA.w NewNMISource2 : STA.w DMA.0_SourceAddrOffsetLow LDY.b #$7F : STY.w DMA.0_SourceAddrBank - + ; Write count LDA.w NewNMICount2 : STA.w DMA.0_TransferSizeLow - + ; Transfer data on channel 0. LDY.b #$01 : STY.w SNES.DMAChannelEnable .skipSecond - + SEP #$20 - + STZ.w $0710 PLB @@ -3637,31 +4300,30 @@ pushpc if !Func00E221 == 1 org $00E221 ; $006221 - JML InitTilesetsLongCalls + JML.l InitTilesetsLongCalls assert pc() <= $00E225 ; $006225 org $00D904 ; $005904 - JML AnimateMirrorWarp_DecompressNewTileSetsLongCalls + JML.l AnimateMirrorWarp_DecompressNewTileSetsLongCalls assert pc() <= $00D908 ; $005908 org $00D97D ; $00597D - JML AnimateMirrorWarp_DecompressNewTileSetsLongCalls2 + JML.l AnimateMirrorWarp_DecompressNewTileSetsLongCalls2 assert pc() <= $00D981 ; $005981 org $00D9BC ; $0059BC - JML AnimateMirrorWarp_DecompressBackgroundsALongCalls + JML.l AnimateMirrorWarp_DecompressBackgroundsALongCalls assert pc() <= $00D9C1 ; $0059C1 org $00DA2F ; $005A2F - JML AnimateMirrorWarp_DecompressBackgroundsCLongCalls + JML.l AnimateMirrorWarp_DecompressBackgroundsCLongCalls else -; Undo the functions above: org $00E221 ; $006221 db $AD, $A1, $0A, $29 @@ -3682,92 +4344,113 @@ endif pullpc InitTilesetsLongCalls: { - PHB : PHK : PLB - SEP #$20 - ; TODO: This will eventually be changed when changing the dungeon GFX. - ; Only trigger the new code when in the: - ; Pre-overworld main module - LDA.b $10 : CMP.b #$08 : BEQ .outdoors - ; Text Mode/Item Screen/Map module - ;CMP.b #$0E : BEQ .outdoors - REP #$30 - PLB + ; TODO: This will eventually be changed when changing the dungeon GFX. + LDA.b $10 : CMP.b #$0E : BNE .notMapMode + ; Mode 0x0E is the map mode for both the OW and in dungeons. + ; So we need to check where we are here. + LDA.b $1B : BEQ .outdoors + ; Indoors + + .notMapMode + + ; TODO: This will eventually be changed when changing the dungeon GFX. + ; Only trigger the new code when in certain outdoor modes. + ; Modes 0x08 through 0x0B are outdoor related modes. + LDA.b $10 : CMP.b #$08 : BCC .regularLoad + CMP.b #$0C : BCC .outdoors + .regularLoad + + REP #$30 ; Replaced code. LDA.w $0AA1 : AND.w #$00FF ; Return to normal code. - JML $00E227 ; $006227 + JML.l $00E227 ; $006227 .outdoors + PHB : PHK : PLB + REP #$30 LDA.b $8A : AND.w #$00FF : ASL #3 : TAX LDA.b $8A : AND.w #$00C0 : LSR #3 : TAY ; (Area / 8) = LW, DW, or SW *8 SEP #$20 - + LDA.w Pool_OWGFXGroupTable_sheet0, X : CMP.b #$FF : BNE .notFF0 LDA.w Pool_DefaultGFXGroups_sheet0, Y .notFF0 - - STA.b $0D : STA.w TransGFXModule_PriorSheets+0 + + STA.b $0D + STA.w TransGFXModule_PriorSheets+0 LDA.w Pool_OWGFXGroupTable_sheet1, X : CMP.b #$FF : BNE .notFF1 LDA.w Pool_DefaultGFXGroups_sheet1, Y .notFF1 - - STA.b $0C : STA.w TransGFXModule_PriorSheets+1 + + STA.b $0C + STA.w TransGFXModule_PriorSheets+1 LDA.w Pool_OWGFXGroupTable_sheet2, X : CMP.b #$FF : BNE .notFF2 LDA.w Pool_DefaultGFXGroups_sheet2, Y .notFF2 - STA.b $0B : STA.w TransGFXModule_PriorSheets+2 - + STA.b $0B + STA.w TransGFXModule_PriorSheets+2 + LDA.w Pool_OWGFXGroupTable_sheet3, X : CMP.b #$FF : BNE .notFF3 LDA.w Pool_DefaultGFXGroups_sheet3, Y .notFF3 - - STA.l $7EC2F8 : STA.b $0A : STA.w TransGFXModule_PriorSheets+3 + + STA.l $7EC2F8 + STA.b $0A + STA.w TransGFXModule_PriorSheets+3 LDA.w Pool_OWGFXGroupTable_sheet4, X : CMP.b #$FF : BNE .notFF4 LDA.w Pool_DefaultGFXGroups_sheet4, Y .notFF4 - - STA.l $7EC2F9 : STA.b $09 : STA.w TransGFXModule_PriorSheets+4 + + STA.l $7EC2F9 + STA.b $09 + STA.w TransGFXModule_PriorSheets+4 LDA.w Pool_OWGFXGroupTable_sheet5, X : CMP.b #$FF : BNE .notFF5 LDA.w Pool_DefaultGFXGroups_sheet5, Y .notFF5 - - STA.l $7EC2FA : STA.b $08 : STA.w TransGFXModule_PriorSheets+5 + + STA.l $7EC2FA + STA.b $08 + STA.w TransGFXModule_PriorSheets+5 LDA.w Pool_OWGFXGroupTable_sheet6, X : CMP.b #$FF : BNE .notFF6 LDA.w Pool_DefaultGFXGroups_sheet6, Y .notFF6 - - STA.l $7EC2FB : STA.b $07 : STA.w TransGFXModule_PriorSheets+6 - + + STA.l $7EC2FB + STA.b $07 + STA.w TransGFXModule_PriorSheets+6 + LDA.w Pool_OWGFXGroupTable_sheet7, X : CMP.b #$FF : BNE .notFF7 LDA.w Pool_DefaultGFXGroups_sheet7, Y .notFF7 - - STA.b $06 : STA.w TransGFXModule_PriorSheets+7 + + STA.b $06 + STA.w TransGFXModule_PriorSheets+7 PLB ; $006282 Skip normal sheet load. - JML $00E282 + JML.l $00E282 } AnimateMirrorWarp_DecompressNewTileSetsLongCalls: @@ -3776,6 +4459,7 @@ AnimateMirrorWarp_DecompressNewTileSetsLongCalls: LDA.b $8A : AND.w #$00FF : ASL #3 : TAX LDA.b $8A : AND.w #$00C0 : LSR #3 : TAY ; (Area / 8) = LW, DW, or SW *8 + SEP #$20 LDA.w Pool_OWGFXGroupTable_sheet3, X : CMP.b #$FF : BNE .notFF3 @@ -3783,33 +4467,37 @@ AnimateMirrorWarp_DecompressNewTileSetsLongCalls: .notFF3 - STA.l $7EC2F8 : STA.w TransGFXModule_PriorSheets+3 + STA.l $7EC2F8 + STA.w TransGFXModule_PriorSheets+3 LDA.w Pool_OWGFXGroupTable_sheet4, X : CMP.b #$FF : BNE .notFF4 LDA.w Pool_DefaultGFXGroups_sheet4, Y .notFF4 - STA.l $7EC2F9 : STA.w TransGFXModule_PriorSheets+4 + STA.l $7EC2F9 + STA.w TransGFXModule_PriorSheets+4 LDA.w Pool_OWGFXGroupTable_sheet5, X : CMP.b #$FF : BNE .notFF5 LDA.w Pool_DefaultGFXGroups_sheet5, Y .notFF5 - STA.l $7EC2FA : STA.w TransGFXModule_PriorSheets+5 + STA.l $7EC2FA + STA.w TransGFXModule_PriorSheets+5 LDA.w Pool_OWGFXGroupTable_sheet6, X : CMP.b #$FF : BNE .notFF6 LDA.w Pool_DefaultGFXGroups_sheet6, Y .notFF6 - STA.l $7EC2FB : STA.w TransGFXModule_PriorSheets+6 + STA.l $7EC2FB + STA.w TransGFXModule_PriorSheets+6 PLB ; $005949 Skip normal sheet load. - JML $00D949 + JML.l $00D949 } AnimateMirrorWarp_DecompressNewTileSetsLongCalls2: @@ -3826,21 +4514,23 @@ AnimateMirrorWarp_DecompressNewTileSetsLongCalls2: .notFF1 - STA.b $08 : STA.w TransGFXModule_PriorSheets+1 + STA.b $08 + STA.w TransGFXModule_PriorSheets+1 LDA.w Pool_OWGFXGroupTable_sheet0, X : CMP.b #$FF : BNE .notFF0 LDA.w Pool_DefaultGFXGroups_sheet0, Y .notFF0 - TAY : STA.w TransGFXModule_PriorSheets+0 + TAY + STA.w TransGFXModule_PriorSheets+0 SEP #$10 PLB ; $005988 Skip normal sheet load. - JML $00D988 + JML.l $00D988 } AnimateMirrorWarp_DecompressBackgroundsALongCalls: @@ -3856,22 +4546,24 @@ AnimateMirrorWarp_DecompressBackgroundsALongCalls: LDA.w Pool_DefaultGFXGroups_sheet3, Y .notFF3 - - STA.b $08 : STA.w TransGFXModule_PriorSheets+3 + + STA.b $08 + STA.w TransGFXModule_PriorSheets+3 LDA.w Pool_OWGFXGroupTable_sheet2, X : CMP.b #$FF : BNE .notFF2 LDA.w Pool_DefaultGFXGroups_sheet2, Y .notFF2 - - TAY : STA.w TransGFXModule_PriorSheets+2 + + TAY + STA.w TransGFXModule_PriorSheets+2 SEP #$10 PLB ; $0059C7 Skip normal sheet load. - JML $00D9C7 + JML.l $00D9C7 } AnimateMirrorWarp_DecompressBackgroundsCLongCalls: @@ -3888,31 +4580,1198 @@ AnimateMirrorWarp_DecompressBackgroundsCLongCalls: .notFF7 - STA.b $08 : STA.w AnimatedTileGFXSet : STA.w TransGFXModule_PriorSheets+7 + STA.b $08 + STA.w AnimatedTileGFXSet + STA.w TransGFXModule_PriorSheets+7 LDA.w Pool_OWGFXGroupTable_sheet6, X : CMP.b #$FF : BNE .notFF6 LDA.w Pool_DefaultGFXGroups_sheet6, Y .notFF6 - - TAY : STA.w TransGFXModule_PriorSheets+6 + + TAY + STA.w TransGFXModule_PriorSheets+6 SEP #$10 PLB ; $005A3A Skip normal sheet load. - JML $00DA3A + JML.l $00DA3A } pushpc ; ============================================================================== +if !Func00E221 == 1 + +org $02B490 ; $013490 + JSL.l Whirlpool_LoadDestinationMap_Interupt + +else + +org $02B490 ; $013490 + JSL.l BirdTravel_LoadAmbientOverlay + +endif + +pullpc + +Whirlpool_LoadDestinationMap_Interupt: +{ + ; Replaced code. + JSL.l BirdTravel_LoadAmbientOverlay + + STZ.w TransGFXModuleFrame + + RTL +} + +pushpc + +; ============================================================================== + +if !Func02A9C4 == 1 + +org $02A9C4 ; $0129C4 +OverworldHandleTransitions: +{ + ; Tells us which direction we're scrolling in. + LDA.w $0416 : BEQ .noScroll + JSR.w Overworld_ScrollMap + + .noScroll + + REP #$20 + + ; Check if link is moving up/down. + LDA.b $30 : AND.w #$00FF : BEQ .noDeltaY + LDA.b $67 : AND.w #$000C : STA.b $00 + + REP #$10 + LDA.b $8A : ASL : TAX + LDA.b $20 : SEC : SBC.l Pool_OverworldTransitionPositionY_New, X + SEP #$10 + + ; Transitioning up. + LDY.b #$06 + LDX.b #$08 + + CMP.w #$0004 : BCC .checkDirection + ; Transitioning down. + LDY.b #$04 + LDX.b #$04 + + CMP.w OWCameraBoundsS : BCS .checkDirection + + .noDeltaY + + ; Check if Link is moving right/left. + LDA.b $31 : AND.w #$00FF : BEQ .noDeltaX + ; Add an offset to the X position. + LDA.w OWCameraBoundsE : CLC : ADC.w #$0004 : STA.b $02 + + LDA.b $67 : AND.w #$0003 : STA.b $00 + + REP #$10 + LDA.b $8A : ASL : TAX + LDA.b $22 : SEC : SBC.l Pool_OverworldTransitionPositionX_New, X + SEP #$10 + + ; Transitioning left. + LDY.b #$02 + LDX.b #$02 + + CMP.w #$0006 : BCC .checkDirection + ; Transitioning right. + LDY.b #$00 + LDX.b #$01 + + CMP.b $02 : BCC .noTransition + + .checkDirection + + ; Check if the direction the player is moving matches the boundary we hit: + CPX.b $00 : BEQ .transition + .noTransition + .noDeltaX + + JSL.l Overworld_CheckForSpecialOverworldTrigger + + RTS + + ; Triggers when Link finally reaches the edge of the screen and is moving + ; in that direction. + .transition + + SEP #$20 + + ; Just makes sure we're not using a medallion or input is disabled. + JSL.l Player_IsScreenTransitionPermitted : BCS .noTransition + STY.b $02 : STZ.b $03 + + JSR.w DeleteCertainAncillaeStopDashing + + REP #$31 + + ; Remove potential large world offest. + LDX.b $02 + LDA.b $84 : AND.l OverworldScreenTileMapChange_Masks, X : STA.b $84 + + ; $0700 does not store the world we are in, so we need to extract it + ; from $8A and then apply it to $0700. We cannot just shift $8A instead + ; because $0700 is the true area and not the "parent" area. + LDA.b $8A : AND.w #$00C0 : ASL + ORA.w $0700 : CLC : ADC.l OverworldScreenIDChange, X : STA.b $04 + + ; X here equals which direction we are currently moving to. + ; 0x00 - Right + ; 0x02 - Left + ; 0x04 - Down + ; 0x06 - Up + CLC : ADC.l .ByScreenAddresses, X : TAX + LDA.b $84 : CLC : ADC.l Pool_ByScreen1_New, X : STA.b $84 + + LDA.b $04 : LSR : TAX + + SEP #$30 + + LDA.b $8A : PHA + + ; Set the OW area number. + LDA.l Pool_Overworld_ActualScreenID_New, X : STA.b $8A + STA.w $040A + TAX + + ; HARDCODED: Bunny music. + LDA.l $7EF3CA : BEQ .lightWorld + ; Check for moon pearl. + LDA.l $7EF357 : BEQ .noMusicChange + + .lightWorld + + ; Extract the ambient sound from this array. + LDA.l $7F5B00, X : LSR #4 : BNE .ambientSound + LDA.b #$05 : STA.w $012D ; No ambient sound. + + .ambientSound + + LDA.l $7F5B00, X : AND.b #$0F : CMP.w $0130 : BEQ .noMusicChange + LDA.b #$F1 : STA.w $012C + + .noMusicChange + + JSR.w Overworld_LoadMapProperties + + LDA.b #$01 : STA.b $11 + + LDA.b $00 : STA.w $0410 + STA.w $0416 + + LDX.b #$04 + + ; Converts a bitwise direction indicator to a value based one. + .loop + DEX + LSR : BCC .loop + + STX.w $0418 + STX.w $069C + + STZ.w $0696 : STZ.w $0698 : STZ.w $0126 + + ; ----udlr + ; u - Up + ; d - Down + ; l - Left + ; r - Right + ; Check if the area we are in needs a mosaic. + ; Filter out the the direction of the transition we are looking for. + PLX + LDA.l Pool_MosaicTable, X : AND.w $0416 : BEQ .noMosaic + ; Trigger a mosaic transition. + + ; Send us to a submodule that will handle a mosaic transition. + LDA.b #$0D : STA.b $11 + + ; Reset mosaic settings. + LDA.b #$00 : STA.b $95 + STA.l $7EC011 + STA.b $B0 + + RTS + + .noMosaic + + LDX.b $8A + LDA.l $7EFD40, X : STA.b $00 + LDA.l OverworldPalettesScreenToSet_New, X + JSL.l Overworld_LoadPalettes + JSR.w Overworld_CgramAuxToMain + + RTS +} +assert pc() <= $02AB08 ; $012B08 + +org $02A62C ; $01262C +OverworldScreenTileMapChange: +{ + ; These mask values are changed to fix several vanilla issues surrounding + ; large areas. Moving from one large area to another twords the center of + ; the side would cause a broken transition. A large area next to another + ; but offset by the length of another would also cause a broken transition. + ; $01262C + .Masks + if !Func02A62C == 1 + dw $1F80, $1F80, $007F, $007F + else + dw $0F80, $0F80, $003F, $003F + endif +} +assert pc() <= $02A634 ; $012634 + +; This table was moved from its original location at $012834 to make more +; space for the bigger tables down below. Replaces a few bytes from +; OverworldScreenTileMapChange_ByScreen1. +org $02A634 ; $012634 +OverworldScreenIDChange: +{ + dw $0002, $FFFE, $0010, $FFF0 +} +assert pc() <= $02A63C ; $01263C + +; This table was moved from its original location at $01283C to make more +; space for the bigger tables down below. This now replaces a few bytes from +; OverworldScreenTileMapChange_ByScreen1. +org $02A63C ; $01263C +OverworldMixedCoordsChange: +{ + dw $FFF0, $0010, $FFFE, $0002 +} +assert pc() <= $02A644 ; $012644 + +; This table was moved from its original location at $016DC5. This now replaces +; OverworldScreenTileMapChange_ByScreen1, OverworldScreenTileMapChange_ByScreen2 +; and part of OverworldScreenTileMapChange_ByScreen3. +org $02A644 ; $012644 +Overworld_HandleOverlaysAndBombDoors_bombable_door_location_New: + +; This table was moved from its original location at $0DC2F9. This now replaces +; part of OverworldScreenTileMapChange_ByScreen3 and all of the following +; OverworldScreenTileMapChange_ByScreen4, +; OverworldScreenIDChange, OverworldMixedCoordsChange, +; OverworldScreenSizeFlag, and OverworldScreenSizeHighByte. +; The bytes of space at $0DC2F9 is now unused. The references to this table are +; updated by ZS itself. +org $02A784 ; $012784 +OverworldData_HiddenItems_New: + +; Update this address. +org $02C098 ; $014098 +ADC.w OverworldMixedCoordsChange, Y + +else + +org $02A9C4 ; $0129C4 +db $AD, $16, $04, $F0, $03, $20, $73, $F2 +db $C2, $20, $A5, $30, $29, $FF, $00, $F0 +db $23, $A5, $67, $29, $0C, $00, $85, $00 +db $AE, $00, $07, $A5, $20, $38, $FF, $C4 +db $A8, $02, $A0, $06, $A2, $08, $C9, $04 +db $00, $90, $3B, $A0, $04, $A2, $04, $CD +db $16, $07, $B0, $32, $A5, $31, $29, $FF +db $00, $F0, $2F, $AD, $16, $07, $18, $69 +db $04, $00, $85, $02, $A5, $67, $29, $03 +db $00, $85, $00, $AE, $00, $07, $A5, $22 +db $38, $FF, $44, $A9, $02, $A0, $02, $A2 +db $02, $C9, $06, $00, $90, $08, $A0, $00 +db $A2, $01, $C5, $02, $90, $04, $E4, $00 +db $F0, $05, $22, $49, $DE, $0E, $60, $E2 +db $20, $22, $39, $F4, $07, $B0, $F3, $84 +db $02, $64, $03, $20, $0C, $8B, $C2, $31 +db $A6, $02, $A5, $84, $3F, $2C, $A6, $02 +db $85, $84, $AD, $00, $07, $18, $7F, $34 +db $A8, $02, $48, $85, $04, $8A, $0A, $0A +db $0A, $0A, $0A, $0A, $05, $04, $AA, $A5 +db $84, $18, $7F, $34, $A6, $02, $85, $84 +db $68, $4A, $AA, $E2, $30, $A5, $8A, $48 +db $C9, $2A, $D0, $05, $A9, $80, $8D, $2D +db $01, $BF, $EC, $A5, $02, $0F, $CA, $F3 +db $7E, $85, $8A, $8D, $0A, $04, $AA, $AF +db $CA, $F3, $7E, $F0, $06, $AF, $57, $F3 +db $7E, $F0, $1F, $BF, $00, $5B, $7F, $4A +db $4A, $4A, $4A, $D0, $05, $A9, $05, $8D +db $2D, $01, $BF, $00, $5B, $7F, $29, $0F +db $CD, $30, $01, $F0, $05, $A9, $F1, $8D +db $2C, $01, $20, $08, $AB, $A9, $01, $85 +db $11, $A5, $00, $8D, $10, $04, $8D, $16 +db $04, $A2, $04, $CA, $4A, $90, $FC, $8E +db $18, $04, $8E, $9C, $06, $9C, $96, $06 +db $9C, $98, $06, $9C, $26, $01, $68, $29 +db $3F, $F0, $06, $A5, $8A, $29, $BF, $D0 +db $0F, $64, $B0, $A9, $0D, $85, $11, $A9 +db $00, $85, $95, $8F, $11, $C0, $7E, $60 +db $A6, $8A, $BF, $40, $FD, $7E, $85, $00 +db $BF, $1C, $FD, $00, $22, $A8, $D5, $0E +db $20, $69, $C7, $60 + +org $02A62C ; $01262C +dw $0F80, $0F80, $003F, $003F + +org $02C098 ; $014098 +db $79, $3C, $A8 + +endif + +pullpc + +OverworldHandleTransitions_ByScreenAddresses: +{ + dw Pool_ByScreen1_New-Pool_ByScreen1_New + dw Pool_ByScreen2_New-Pool_ByScreen1_New + dw Pool_ByScreen3_New-Pool_ByScreen1_New + dw Pool_ByScreen4_New-Pool_ByScreen1_New +} + +pushpc + +; ============================================================================== + +; This section changes how all of the camera values get set. + +if !Func02C0C3 == $01 + +org $02C0C3 ; $0140C3 +Overworld_SetCameraBounds_Interupt: +{ + JSL.l NewOverworld_SetCameraBounds + + RTS +} +assert pc() <= $02C0F8 ; $0140F8 + +else + +org $02C0C3 ; $0140C3 +db $B9, $C4, $A8, $8D, $00, $06, $18, $7D +db $E2, $BF, $8D, $02, $06, $B9, $44, $A9 +db $8D, $04, $06, $18, $7D, $E6, $BF, $8D +db $06, $06, $B9, $E2, $BE, $8D, $10, $06 +db $18, $7D, $EA, $BF, $8D, $12, $06, $B9 +db $62, $BF, $8D, $14, $06, $18, $7D, $EE +db $BF, $8D, $16, $06, $60 + +endif + +pullpc + +; Y - The overworld area number * 2 we are going to. Note: NOT the parent +; number. Meaning if you are going to hyrule castle from Link's house, +; this will be 0x48 (0x24 * 2) and not 0x36 (0x1B * 2). +; X - 0 for small map, 2 for large map +NewOverworld_SetCameraBounds: +{ + PHB : PHK : PLB + + LDX.b $8A + LDA.l Pool_BufferAndBuildMap16Stripes_overworldScreenSize, X + AND.w #$00FF : ASL : TAX + + REP #$10 + + LDA.b $8A : ASL : TAY + LDA.w Pool_OverworldTransitionPositionY_New, Y : STA.w $0600 + CLC : ADC.w .boundary_y_size, X : STA.w $0602 + + LDA.w Pool_OverworldTransitionPositionX_New, Y : STA.w $0604 + CLC : ADC.w .boundary_x_size, X : STA.w $0606 + + LDA.w Pool_trans_target_north_new, Y : STA.w $0610 + CLC : ADC.w .trans_target_south_offset, X : STA.w $0612 + + LDA.w Pool_trans_target_west_new, Y : STA.w $0614 + CLC : ADC.w .trans_target_east_offset, X : STA.w $0616 + + SEP #$10 + + PLB + + RTL + + ; Small, Large, Wide, Tall + .boundary_y_size + dw $011E, $031E, $011E, $031E + + .boundary_x_size + dw $0100, $0300, $0300, $0100 + + .trans_target_south_offset + dw $02E0, $04E0, $02E0, $04E0 + + .trans_target_east_offset + dw $0300, $0500, $0500, $0300 +} + +; NOTE: UNUSED: +; The $0712 check at $01408D in OverworldScrollTransition and at $0165AA +; in Overworld_LoadNewScreenProperties are now unused because of the +; new Overworld_SetCameraBounds function. + +pushpc + +; ============================================================================== + +; This changes how OverworldScreenSizeHighByte is used. Using OWCameraBoundsE +; ($0718) which is free RAM to be the new X boundary check. + +if !Func02E598 == $01 + +org $02E598 ; $016598 + JSL.l Copy0716 + NOP +assert pc() <= $02E59D ; $01659D + +org $02EADC ; $016ADC + JSL.l Copy0716 + NOP +assert pc() <= $02EAE1 ; $016AE1 + +; This function returns carry set if the hookshot is off screen when used. +; It's only use is to prevent the hookshot from interacting with anything +; that is offscreen. +; Changed to use the new x value and the new OverworldTransitionPositionX and Y +; tables. +org $08FA49 ; $047A49 +Hookshot_IsCollisionCheckFutile_Interupt: +{ + LDA.w $0C72, X : AND.w #$0002 : BNE .moving_horizontally + LDX.w $0700 + LDA.b $00 : SEC : SBC.l Pool_OverworldTransitionPositionY_New, X + CMP.w #$0004 : BCC .off_screen + CMP.w OWCameraBoundsS : BCS .off_screen + BRA .not_at_screen_edge + + .moving_horizontally + + LDX.w $0700 + LDA.b $02 : SEC : SBC.l Pool_OverworldTransitionPositionX_New, X + CMP.w #$0006 : BCC .off_screen + CMP.w OWCameraBoundsE : BCC .not_at_screen_edge + + .off_screen + + SEP #$20 + + PLY + PLX + + SEC + + RTS + assert pc() <= $08FA81 + + org $08FA81 + .not_at_screen_edge +} +assert pc() <= $08FA81 ; $047A81 + +; Change an old OverworldScreenSizeFlag use to set the X value instead. +org $02AB0D ; $012B0D +Overworld_LoadMapProperties_Interupt: +{ + CPX.b #$80 : BCS .inSW + ; $0AA3 is the sprite graphics index. + LDA.l $7EFCC0, X + + BRA .write0AA3 + + .inSW + + LDA.l Pool_LoadSpecialOverworld_GFX_0AA3-$80, X + + .write0AA3 + + ; $0AA3 is the sprite graphics index. + STA.w $0AA3 + + ; $0AA2 is the secondary background graphics index. + LDA.l GFX0AA2ValsOW, X + + ; In PrepTransAuxGFX the game checks if $0AA2 is below 0x20, if it is, + ; it will load 3 of the aux sheets as using the low palette instead of + ; the high palette. So since $0AA2 isn't really used on the overworld + ; anymore, we can just OR it so it will always load properly. + ORA.b #$20 : STA.w $0AA2 + + ; Code from vanilla that is still needed. + LDA.w $0712 : STA.w $0714 + + LDA.l Pool_BufferAndBuildMap16Stripes_overworldScreenSize, X : TAX + LDA.l .xSize, X : STA.w $0719 + LDA.l .ySize, X : STA.w $0717 + + LDY.b #$20 + LDX.b #$00 + + LDA.b $8A : AND.b #$40 : BEQ .lightWorld + ; $0AA1 = 0x21 for dark world, 0x20 for light world. + INY + + ; 0x08 for dark world, 0x00 for light world. + LDX.b #$08 + + .lightWorld + + STY.w $0AA1 + + ; X = 0x01 in LW, 0x0B in DW. + LDA.l SheetsTable_0AA4, X : STA.w $0AA4 + + REP #$30 + + JSL.l AreaSizeCheck + + SEP #$30 + + RTS + + ; 0x01 - Small map + ; 0x03 - Large map + .xSize + db $01, $03, $03, $01 + + .ySize + db $01, $03, $01, $03 +} +assert pc() <= $02AB7B ; $012B7B + +else + +org $02E598 ; $016598 +db $A9, $E4, $8D, $16, $07 + +org $02EADC ; $016ADC +db $A9, $E4, $8D, $16, $07 + +org $08FA49 ; $047A49 +db $BD, $72, $0C, $29, $02, $00, $D0, $16 +db $AE, $00, $07, $A5, $00, $38, $FF, $C4 +db $A8, $02, $C9, $04, $00, $90, $1B, $CD +db $16, $07, $B0, $16, $80, $1A, $AE, $00 +db $07, $A5, $02, $38, $FF, $44, $A9, $02 +db $C9, $06, $00, $90, $05, $CD, $16, $07 +db $90, $06, $E2, $20, $7A, $FA, $38 + +org $02AB0D ; $012B0D +db $BF, $C0, $FC, $7E, $8D, $A3, $0A, $BF +db $9C, $FC, $00, $8D, $A2, $0A, $8A, $29 +db $3F, $AA, $AD, $12, $07, $8D, $14, $07 +db $BF, $44, $A8, $02, $8D, $12, $07, $BF +db $84, $A8, $02, $8D, $17, $07, $A0, $20 +db $A2, $00, $A5, $8A, $29, $40, $F0, $03 +db $C8, $A2, $08, $8C, $A1, $0A, $BF, $F4 +db $D8, $00, $8D, $A4, $0A, $C2, $30, $A5 +db $8A, $29, $BF, $00, $0A, $AA, $BF, $C4 +db $A8, $02, $8D, $08, $07, $BF, $44, $A9 +db $02, $4A, $4A, $4A, $8D, $0C, $07, $A9 +db $F0, $03, $AE, $12, $07, $D0, $03, $A9 +db $F0, $01, $8D, $0A, $07, $4A, $4A, $4A +db $8D, $0E, $07, $E2, $30, $60 + +endif + +pullpc + +Copy0716: +{ + LDA.b #$E4 : STA.w OWCameraBoundsS + STA.w OWCameraBoundsE + + RTL +} + +AreaSizeCheck: +{ + PHB : PHK : PLB + + LDA.b $8A : ASL : TAX + LDA.l Pool_OverworldTransitionPositionY_New, X : STA.w $0708 + LDA.l Pool_OverworldTransitionPositionX_New, X : LSR #3 : STA.w $070C + + LDX.b $8A + LDA.l Pool_BufferAndBuildMap16Stripes_overworldScreenSize, X + AND.w #$00FF : ASL : TAX + LDA.w .YSize, X : STA.w $070A + LDA.w .XSize, X : STA.w $070E + + PLB + + RTL + + ; Small, Large, Wide, Tall + .YSize + dw $01F0, $03F0, $01F0, $03F0 + + .XSize + dw $003E, $007E, $007E, $003E +} + +pushpc + +; ============================================================================== + +if !Func09C4C7 == $01 + +org $09C4C7 ; $04C4C7 +LoadOverworldSprites_Interupt: +{ + LDX.w $040A + LDA.l Pool_BufferAndBuildMap16Stripes_overworldScreenSize, X : TAY + + LDA.w .xSize, Y : STA.w $0FB9 + STZ.w $0FB8 + + LDA.w .ySize, Y : STA.w $0FBB + STZ.w $0FBA + + ; What phase are we in? + LDA.l $7EF3C5 : ASL : TAY + + REP #$30 + + ; And then, what overworld area are we in? + TXA : ASL : CLC : ADC.w .phaseOffset, Y : TAX + + ; Get the overworld sprite pointer based on the overworld area and game phase. + LDA.l Pool_Overworld_SpritePointers_state_0_New, X : STA.b $00 + + SEP #$20 + + BRA .skip + + .xSize + db $02, $04, $04, $02 + + .ySize + db $02, $04, $02, $04 + + .phaseOffset + dw $0000, $0000, $0140, $0280 + + ; We have some extra bytes of space here. + NOP : NOP : NOP + + org $09C50D ; $04C50D + .skip +} +assert pc() <= $09C50D ; $04C50D + +; The table OverworldScreenSizeForLoading which is located at $04C635 and +; used by the vanilla LoadOverworldSprites function is no longer needed for +; its original purpose. This is for controlling the boundaries used by sprites +; to check if they should be loaded. This is now unused in favor of just +; getting a value based on the size of the area. Its 0xC0 bytes of space is +; now used by OverworldPalettesScreenToSet_New which was moved here from is +; original loaction at $007D1C. The old 0x88 bytes of space at $007D1C is +; now unused. + +else + +org $09C4C7 ; $04C4C7 +db $AD, $0A, $04, $A8, $BE, $35, $C6, $8E +db $B9, $0F, $9C, $B8, $0F, $8E, $BB, $0F +db $9C, $BA, $0F, $C2, $30, $AD, $0A, $04 +db $0A, $A8, $E2, $20, $AF, $C5, $F3, $7E +db $C9, $03, $F0, $0E, $C9, $02, $F0, $14 +db $B9, $81, $C8, $85, $00, $B9, $82, $C8 +db $80, $12, $B9, $21, $CA, $85, $00, $B9 +db $22, $CA, $80, $08, $B9, $01, $C9, $85 +db $00, $B9, $02, $C9 + +endif + +; ============================================================================== + +; This is the new truth table as to what each area's size is. +org $02F88D ; $01788D +Pool_BufferAndBuildMap16Stripes_overworldScreenSize: +{ + ; The large area value and small area values were swapped. + ; 0x00 was large before and 0x01 was small. + + ; 0x00 - Small area (1x1) + ; 0x01 - Large area (2x2) + ; 0x02 - Wide area (2x1) + ; 0x03 - Tall area (1x2) + + if !UseVanillaPool > 0 + ; LW + db $01, $01, $00, $01, $01, $01, $01, $00 + db $01, $01, $00, $01, $01, $01, $01, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $01, $01, $00, $01, $01, $00, $01, $01 + db $01, $01, $00, $01, $01, $00, $01, $01 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $01, $01, $00, $00, $00, $01, $01, $00 + db $01, $01, $00, $00, $00, $01, $01, $00 + + ; DW + db $01, $01, $00, $01, $01, $01, $01, $00 + db $01, $01, $00, $01, $01, $01, $01, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $01, $01, $00, $01, $01, $00, $01, $01 + db $01, $01, $00, $01, $01, $00, $01, $01 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $01, $01, $00, $00, $00, $01, $01, $00 + db $01, $01, $00, $00, $00, $01, $01, $00 + + ; SW + db $00, $01, $01, $00, $00, $00, $00, $00 + db $00, $01, $01, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + + ; The later half of the SW doesn't exist but this table does have values for + ; them here. So this space could be used for something else. + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $00, $00, $00 + endif +} +assert pc() <= $02F94D ; $01794D + +if !Func02AC40 == $01 + +; Change a bunch of Pool_BufferAndBuildMap16Stripes_overworldScreenSize checks +; from a BEQ to a BNE. +org $02AC40 ; $012C40 + db $D0 + +org $02AC70 ; $012C70 + db $D0 + +org $02B2FA ; $0132FA + db $D0 + +org $02B356 ; $013356 + db $D0 + +org $02ED39 ; $016D39 + db $D0 + +org $02ED6D ; $016D6D + db $D0 + +; Change a bunch of Pool_BufferAndBuildMap16Stripes_overworldScreenSize checks +; from a BNE to a BEQ. + +org $02F039 ; $017039 + db $F0 + +org $02F2EF ; $0172EF + db $F0 + +org $02F323 ; $017323 + db $F0 + +org $02F361 ; $017361 + db $F0 + +org $02F39B ; $01739B + db $F0 + +else + +org $02AC40 ; $012C40 + db $F0 + +org $02AC70 ; $012C70 + db $F0 + +org $02B2FA ; $0132FA + db $F0 + +org $02B356 ; $013356 + db $F0 + +org $02ED39 ; $016D39 + db $F0 + +org $02ED6D ; $016D6D + db $F0 + +org $02F039 ; $017039 + db $D0 + +org $02F2EF ; $0172EF + db $D0 + +org $02F323 ; $017323 + db $D0 + +org $02F361 ; $017361 + db $D0 + +org $02F39B ; $01739B + db $D0 + +endif + +; ============================================================================== + +if !Func02E931 == $01 + +org $02E931 ; $016931 +LoadSpecialOverworld_Interupt: +{ + LDA.b $8A : SEC : SBC.b #$80 : TAX + + ; GFX $0AA3 + LDA.l Pool_LoadSpecialOverworld_GFX_0AA3, X : STA.w $0AA3 + + ; GFX $0AA2 + LDA.l Pool_LoadSpecialOverworld_GFX_0AA2, X : STA.w $0AA2 + + ; Palette property b + LDA.l Pool_LoadSpecialOverworld_palette_prop_b, X : STA.b $00 + + ; This table call was changed to read from the same one as the rest of the + ; areas and is no longer SW specific. + ; Property property a + LDX.b $8A + LDA.l OverworldPalettesScreenToSet_New, X + JSL.l Overworld_LoadPalettes + + PLA : STA.b $A0 + + REP #$30 + + ; These 2 exits need the special smaller camera bounds instead of the usual + ; ones. Such as the master sword area being half of a small area. + LDA.b $A0 : CMP.w #$0180 : BEQ .SpecialCameraBounds + CMP.w #$0181 : BEQ .SpecialCameraBounds + LDA.b $8A : AND.w #$00FF : ASL : TAX + LDA.l Pool_OverworldTransitionPositionY_New, X : STA.w $0708 + LDA.l Pool_OverworldTransitionPositionX_New, X : LSR #3 : STA.w $070C + + JSL.l AreaSizeCheck + + JSL.l NewOverworld_SetCameraBounds + + BRA .end + + .SpecialCameraBounds + + JSL.l SetupSpecialCameraBounds + + .end + + SEP #$30 + + PLB + + JSL.l Overworld_SetScreenBGColorCacheOnly + + RTS +} +assert pc() <= $02E9BC ; $0169BC + +else + +org $02E931 ; $016931 +db $BF, $11, $E8, $02, $8D, $A3, $0A, $BF +db $21, $E8, $02, $8D, $A2, $0A, $DA, $BF +db $41, $E8, $02, $85, $00, $BF, $31, $E8 +db $02, $22, $A8, $D5, $0E, $FA, $C2, $30 +db $A9, $F0, $03, $85, $00, $A5, $A0, $29 +db $3F, $00, $0A, $AA, $BF, $E1, $E6, $02 +db $8D, $08, $07, $BF, $E1, $E7, $02, $4A +db $4A, $4A, $8D, $0C, $07, $A5, $00, $8D +db $0A, $07, $A5, $00, $4A, $4A, $4A, $8D +db $0E, $07, $A5, $A0, $0A, $A8, $E2, $10 +db $B9, $E1, $E6, $8D, $00, $06, $B9, $01 +db $E7, $8D, $02, $06, $B9, $21, $E7, $8D +db $04, $06, $B9, $41, $E7, $8D, $06, $06 +db $B9, $61, $E7, $8D, $10, $06, $B9, $A1 +db $E7, $8D, $12, $06, $B9, $81, $E7, $8D +db $14, $06, $B9, $C1, $E7, $8D, $16, $06 +db $E2, $20, $68, $85, $A0, $AB, $22, $1D +db $D6, $0E, $60 + +endif + +pullpc + +SetupSpecialCameraBounds: +{ + PHB : PHK : PLB + + LDA.w #$03F0 : STA.b $00 + + LDA.b $A0 : SEC : SBC.w #$0080 : AND.w #$003F : ASL : TAX + LDA.w .SpecialCamera600, X : STA.w $0708 + LDA.w .SpecialCamera70C, X : LSR #3 : STA.w $070C + + LDA.b $00 : STA.w $070A + LDA.b $00 : LSR #3 : STA.w $070E + + SEP #$10 + + LDA.w .SpecialCamera600, X : STA.w $0600 + LDA.w .SpecialCamera602, X : STA.w $0602 + LDA.w .SpecialCamera604, X : STA.w $0604 + LDA.w .SpecialCamera606, X : STA.w $0606 + LDA.w .SpecialCamera610, X : STA.w $0610 + LDA.w .SpecialCamera612, X : STA.w $0612 + LDA.w .SpecialCamera614, X : STA.w $0614 + LDA.w .SpecialCamera616, X : STA.w $0616 + + PLB + + RTL + + ; These are the camera values that are used for the master sword area and + ; the area under the bridge. + .SpecialCamera600 + dw $0000, $0000 + + .SpecialCamera602 + dw $0120, $0020 + + .SpecialCamera604 + dw $0000, $0100 + + .SpecialCamera606 + dw $0000, $0100 + + .SpecialCamera610 + dw $FF20, $FF20 + + .SpecialCamera612 + dw $FFFC, $0100 + + .SpecialCamera614 + dw $FF20, $FF20 + + .SpecialCamera616 + dw $0004, $0104 + + .SpecialCamera70C + dw $0000, $0000 +} + +pushpc + +; ============================================================================== + +if !Func02A5D3 == $01 + +org $02A5D3 ; $0125D3 +Overworld_PlayerControl_Interupt: +{ + JSL.l Overworld_Entrance + JSL.l Overworld_DwDeathMountainPaletteAnimation + + ; If not in SW mode skip this part. + LDA.b $8A : CMP.b #$80 : BCC .notSpecialOverworld + ; Checks for tiles that lead back to normal overworld. + JSL.l SpecialOverworld_CheckForReturnTrigger + + ; If $11 == 0x24, that means we did trigger a special overworld tile + LDA.b $11 : CMP.b #$24 : BNE .noSpecialTrigger + ; Tell the game we are in the SW mode. + LDA.b #$0B : STA.b $10 + + RTS + + .noSpecialTrigger + .notSpecialOverworld + + JSR.w OverworldHandleTransitions + + .return + + ; TODO: I think this SEP is not needed but am too scared to comit to + ; removing it. + SEP #$20 + + RTS +} +assert pc() <= $02A62C ; $01262C + +; NOTE: This overwrites the unused table found at $0125EC-$01262B + +else + +org $02A5D3 ; $0125D3 +db $A5, $10, $C9, $0B, $F0, $0D, $22, $F4 +db $BB, $1B, $22, $82, $F5, $0E, $20, $C4 +db $A9, $80, $03, $20, $7B, $AB, $E2, $20 +db $60, $00, $00, $02, $03, $03, $05, $05 +db $07, $00, $00, $0A, $03, $03, $05, $05 +db $0F, $10, $11, $12, $13, $14, $15, $16 +db $17, $18, $18, $1A, $1B, $1B, $1D, $1E +db $1E, $18, $18, $22, $1B, $1B, $25, $1E +db $1E, $28, $29, $2A, $2B, $2C, $2D, $2E +db $2F, $30, $30, $32, $33, $34, $35, $35 +db $37, $30, $30, $3A, $3B, $3C, $35, $35 +db $3F + +endif + +; ============================================================================== + +if !Func00FC67 == $01 + +org $00FC67 ; $007C67 +JSL.l Sprite_LoadGfxProperties_Interupt +NOP : NOP : NOP + +org $0286DB ; $0106DB +LDA.l OverworldPalettesScreenToSet_New, X + +org $02B0FB ; $0130FB +LDA.l OverworldPalettesScreenToSet_New, X + +org $02B4CD ; $0134CD +LDA.l OverworldPalettesScreenToSet_New, X + +org $02EAAB ; $016AAB +LDA.l OverworldPalettesScreenToSet_New, X + +org $02ECE8 ; $016CE8 +LDA.l OverworldPalettesScreenToSet_New, X + +else + +org $00FC67 ; $007C67 +db $A0, $3E, $00, $AF, $C5, $F3, $7E + +org $0286DB ; $0106DB +db $BF, $1C, $FD, $00 + +org $02B0FB ; $0130FB +db $BF, $1C, $FD, $00 + +org $02B4CD ; $0134CD +db $BF, $1C, $FD, $00 + +org $02EAAB ; $016AAB +db $BF, $1C, $FD, $00 + +org $02ECE8 ; $016CE8 +db $BF, $1C, $FD, $00 + +endif + +pullpc + +Sprite_LoadGfxProperties_Interupt: +{ + LDX.w #$003E + + .loop + + ; The free RAM used here is right after $7EFD40 which is where + ; vanilla stores the sprite palettes for the LW and DW. Very convenient + ; for our needs, we don't even have to update the read. + LDA.l Pool_LoadSpecialOverworld_palette_prop_b, X + STA.l ExpandedSpritePalArray, X + DEX : DEX : BPL .loop + + ; Replaced code. + LDY.w #$003E + LDA.l $7EF3C5 + + RTL +} + +pushpc + +; ============================================================================== + +if !Func1BC8B1 == $01 + +; Remove the SW overworld item check. +org $1BC8B4 ; $0DC8B4 +Overworld_RevealSecret_Interupt: +{ + NOP : NOP +} +assert pc() <= $1BC8B6 ; $0DC8B6 + +org $02EF64 ; $016F64 +LDA.l Overworld_HandleOverlaysAndBombDoors_bombable_door_location_New, X + +else + +org $1BC8B4 ; $0DC8B4 +db $B0, $7D + +org $02EF64 ; $016F64 +db $BF, $C5, $ED, $02 + +endif + +; ============================================================================== + +if !Func07B518 == $01 + +org $07B518 ; $03B518 +JSL Link_Read_Interupt + +else + +org $07B518 ; $03B518 +db $A8, $B9, $1D, $F5 + +endif + +pullpc + +Link_Read_Interupt: +{ + PHB : PHK : PLB + + TAY + LDA.w Pool_Overworld_SignText_New, Y + + PLB + + RTL +} + +pushpc + +; ============================================================================== + +if !Func02EF44 == $01 + +; Remove a check so that entrance overlays can be used on the SW. +org $02EF44 ; $016F44 +Overworld_LoadMapData_Interupt: +{ + NOP : NOP : NOP : NOP +} + +else + +org $02EF44 ; $016F44 +db $E0, $80, $B0, $0C + +endif + +; ============================================================================== + +; TODO: Check HandleEdgeTransition_AdjustCameraBounds for possible needed changes. +; Currently I don't think anything is needed here. + ; $013CFB -; In the fog scrolling code, there is a bit that checks for the turtle rock area. -; If left unchanged, this will prevent the fog and lava from working poperly in -; this area. +; TODO: In the fog scrolling code, there is a bit that checks for the turtle +; rock area. If left unchanged, this will prevent the fog and lava from working +; poperly in this area. ; ==============================================================================