10 Commits

Author SHA1 Message Date
0263546e46 Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:36:41 -07:00
Lexi Rose
48ccf03ac8 Merge pull request #170 from cassidoxa/ammo_capacity
Combine starting max ammo and capacity upgrade in SRAM into single, flat ammo capacity values
2022-10-01 08:08:26 -05:00
cassidoxa
f8d9be201a tables.asm: Add GFX pointer to table in utilities.asm 2022-09-09 19:30:16 -04:00
cassidoxa
031e3965b2 Requires frontend changes
Change SRAM ammo capacity upgrades to flatly represent max capacity
2022-08-08 13:42:19 -04:00
Lexi Rose
aba3ec930d Merge pull request #169 from cassidoxa/validate_sram
Compute checksum for extended SRAM
2022-08-01 08:40:19 -05:00
cassidoxa
95ee31f7c9 Remove some hard coded addresses for MVN instructions 2022-07-29 22:04:13 -04:00
cassidoxa
d8846a4ba9 Add backup save that gets checked and loaded if main save is corrupt
Add suffixes to instructions in save.asm
Disable HDMA, NMI, and joypad during extended save DMA
2022-07-29 20:57:54 -04:00
cassidoxa
10079a539b Compute checksum for extended SRAM
Validate SRAM on file screen load and delete if checksum incorrect
2022-07-25 22:19:06 -04:00
Lexi Rose
0e6e5d5b45 Merge pull request #167 from cassidoxa/elder_submodule
Check submodule during goal NPC interaction to prevent it from firing when menu is open
2022-07-14 22:40:37 -05:00
cassidoxa
9e5e9a17ed Check submodule during goal NPC interaction to prevent it from firing
when menu is open (via kan)
2022-07-05 12:49:00 -04:00
109 changed files with 3942 additions and 15358 deletions

4
.gitignore vendored
View File

@@ -1,5 +1,3 @@
tournament.asm
/build
/.idea
/__pycache__
/.vscode
/.idea

View File

@@ -44,10 +44,7 @@ dw !ROM_VERSION_HIGH
!MS_GOT = "$7F5031"
;!REDRAW = "$7F5000"
!SPRITE_REDRAW = "$7E0790" ; 16 bytes
!SPRITE_OAM = "$7EC025" ; 16 bytes
!SPRITE_DYNAMIC_OAM = "$7EC035" ; 16 bytes
!REDRAW = "$7F5000"
!GANON_WARP_CHAIN = "$7F5032";
!TILE_UPLOAD_BUFFER = "$7EA180";
@@ -77,31 +74,10 @@ dw !ROM_VERSION_HIGH
function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<0))
; Feature flags, run asar with -DFEATURE_X=1 to enable
!FEATURE_NEW_TEXT ?= 1
!FEATURE_NEW_TEXT ?= 0
;================================================================================
!MULTIWORLD_ITEM = "$7EF4D2"
!MULTIWORLD_ITEM_FROM = "$7EF4D3"
!MULTIWORLD_ROOMID = "$7EF4D4"
!MULTIWORLD_ROOMDATA = "$7EF4D6"
!MULTIWORLD_SCOUT_LOCATION = "$7EF4D7"
!MULTIWORLD_SCOUTREPLY_LOCATION = "$7EF4D8"
!MULTIWORLD_SCOUTREPLY_ITEM = "$7EF4D9"
!MULTIWORLD_SCOUTREPLY_PLAYER = "$7EF4DA"
!MULTIWORLD_RECEIVING_ITEM = "$7EC057" ; 0 = default | 1 = receiving
!MULTIWORLD_HUD_CHARACTER_DATA = "$7EC058" ; 0x40 bytes
!MULTIWORLD_ITEM_PLAYER_ID = "$7EC098" ; 0 = disabled
!MULTIWORLD_SPRITEITEM_PLAYER_ID = "$7EC099"
!MULTIWORLD_HUD_TIMER = "$7EC09A"
!MULTIWORLD_HUD_DELAY = "#120"
!MULTIWORLD_ITEM_ID = "$7EC09B" ; for lua scripts?
!Dungeon_ChestData = "$01E96C"
!FLAG_OW_MIXED = $04
!FLAG_OW_CROSSED = $02
!FLAG_OW_BONKDROP = $02
incsrc hooks.asm
incsrc treekid.asm
incsrc spriteswap.asm
@@ -142,6 +118,7 @@ incsrc dungeondrops.asm
incsrc halfmagicbat.asm
incsrc mantle.asm
incsrc swordswap.asm
incsrc stats.asm
incsrc scratchpad.asm
incsrc map.asm
incsrc dialog.asm
@@ -150,6 +127,12 @@ incsrc clock.asm
incsrc accessibility.asm
incsrc heartbeep.asm
incsrc capacityupgrades.asm
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
warnpc $A18000
org $1C8000 ; text tables for translation
@@ -181,12 +164,6 @@ org $A1FF00 ; static mapping area
incsrc init.asm
org $A48000 ; code bank - PUT NEW CODE HERE
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
@@ -204,14 +181,12 @@ incsrc decryption.asm
incsrc hashalphabet.asm
incsrc inverted.asm
incsrc invertedmaps.asm
incsrc bonktreemaps.asm
incsrc newhud.asm
incsrc compasses.asm
incsrc save.asm
incsrc password.asm
incsrc enemy_adjustments.asm
incsrc stats.asm
;incsrc hudtext.asm
incsrc hudtext.asm
incsrc servicerequest.asm
incsrc elder.asm
incsrc toast.asm
@@ -219,8 +194,6 @@ incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc multiworld.asm
incsrc terrorpin.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
@@ -229,24 +202,12 @@ warnpc $A58000
;org $228000 ; contrib area
org $A28000 ; contrib area
incsrc contrib.asm
incsrc special_weapons.asm
incsrc item_on_b.asm
incsrc variable_ganon_vulnerability.asm
warnpc $A38000
org $A38000
incsrc stats/main.asm
incsrc menu/overworldmap.asm ; overwrites some code in bank 0A
incsrc doorrando/doorrando.asm ; bank 27 likely A7 in the future
;bank 28/A8 for keydropshuffle / standing items
incsrc keydrop/standing_items.asm
incsrc owrando.asm ; bank AA
incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37
org $308000 ; bank #$30
incsrc tables.asm
warnpc $318000
org $348000
incsrc spc.asm
@@ -310,16 +271,6 @@ InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin sheet73.gfx
warnpc $31E501
org $31E800
Damage_Table_Bombs:
incbin damage_table_sword_bombs.bin
warnpc $31F000
org $31F000
Damage_Table_Pseudo:
incbin damage_table_pseudo_sword.bin
warnpc $31F800
org $338000
GFX_HUD_Palette:
incbin hudpalette.pal
@@ -334,30 +285,21 @@ BossMapIconGFX:
incbin bossicons.4bpp
if !FEATURE_NEW_TEXT
org $339C00
NewFont:
incbin newfont.bin
NewFontInverted:
incbin newfont_inverted.bin
org $339C00
NewFont:
incbin newfont.bin
NewFontInverted:
incbin newfont_inverted.bin
org $0CD7DF
incbin text_unscramble1.bin
org $0CE4D5
incbin text_unscramble2.bin
org $0CD7DF
incbin text_unscramble1.bin
org $0CE4D5
incbin text_unscramble2.bin
endif
org $328000
Extra_Text_Table:
if !FEATURE_NEW_TEXT
incsrc itemtext_lower.asm
else
incsrc itemtext.asm
endif
warnpc $32E000
org $32DFD0 ; PC 0x195FD0
incsrc multiworldplayernames.asm
warnpc $330000
incsrc itemtext.asm
incsrc externalhooks.asm
;================================================================================
@@ -381,11 +323,7 @@ warnpc $B08000
;$22 Contrib Code
;$23 Stats & Credits
;$24 Code Bank
;$27 DR Code Bank
;$28 Keydrop / Standing Items Code bank
;$29 External hooks (rest of bank not used)
;$2A Reserved for OWR
;$2B Room Data migration
;$2E Reserved for Tournament Use
;$2F Static RNG (rest is reserved for tournament use)
;$30 Main Configuration Table
@@ -518,9 +456,6 @@ Attract_DecompressStoryGfx:
org $00E529
LoadSelectScreenGfx:
org $00E784
LoadCommonSprites_in_file_select:
org $00F945
PrepDungeonExit:
@@ -535,42 +470,15 @@ Module_PreDungeon:
org $028296
.setAmbientSfx
org $828AD9
Underworld_SetBossOrSancMusicUponEntry:
org $02A0A8
Dungeon_SaveRoomData:
org $02A0BE
Dungeon_SaveRoomData_justKeys:
org $02A4E3
Overworld_ActualScreenID:
org $02A9F3
OverworldHandleTransitions_change_palettes:
org $02B861
Dungeon_SaveRoomQuadrantData:
org $02C11D
CalculateTransitionLanding:
org $02C176
Overworld_FinalizeEntryOntoScreen_Data:
org $82C3F2
OverworldLoadScreensPaletteSet_long:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $02E99D
FluteMenu_LoadTransport:
org $02FD6D
LoadGearPalettes_link:
org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank
LoadGearPalettes_bunny:
@@ -580,15 +488,6 @@ LoadGearPalettes_variable:
org $02FEAB
Filter_Majorly_Whiten_Color:
org $04E780
Overworld_MemorizeMap16Change:
org $04E879
Overworld_CheckForSpecialOverworldTrigger_Direction:
org $058008
Sprite_SpawnSparkleGarnish:
org $05A51D
Sprite_SpawnFallingItem:
@@ -622,9 +521,6 @@ Utility_CheckIfHitBoxesOverlapLong:
org $06A7DB
Chicken_SpawnAvengerChicken: ; returns short
org $06AD58
Sprite_TransmuteToBomb:
org $06DC5C
Sprite_DrawShadowLong:
@@ -637,9 +533,6 @@ Sprite_PrepAndDrawSingleLargeLong:
org $06DC00
Sprite_PrepAndDrawSingleSmallLong:
org $06E41C
Sprite_PrepOAMCoordLong:
org $06EA18
Sprite_ApplySpeedTowardsPlayerLong:
@@ -658,41 +551,23 @@ Player_HaltDashAttackLong:
org $07999D
Link_ReceiveItem:
org $079F82
Link_UseHammer:
org $07AFEE
Link_UseBugNet:
org $07A985
SetGameModeLikeMirror:
org $07E68F
Unknown_Method_0: ; In US version disassembly simply called "$3E6A6 IN ROM"
org $07F413
Link_CheckForEdgeScreenTransition:
org $07F4AA
Sprite_CheckIfPlayerPreoccupied:
org $08C3AE
Ancilla_ReceiveItem:
org $08C505
Ancilla_ReceiveItem_objectFinished:
org $08CE2E
GTCutscene_AnimateCrystals_NoRotate:
org $08CEB6
GTCutscene_DrawSingleCrystal_SkipCrystal:
org $08CE93
Ancilla_BreakTowerSeal_draw_single_crystal:
org $08CEC3
GTCutscene_DrawSingleCrystal_SkipSparkle:
Ancilla_BreakTowerSeal_stop_spawning_sparkles:
org $08CF59
GTCutscene_SparkleALot:
BreakTowerSeal_ExecuteSparkles:
org $08F710
Ancilla_SetOam_XY_Long:
@@ -700,12 +575,6 @@ Ancilla_SetOam_XY_Long:
org $0985E2 ; (break on $0985E4)
AddReceivedItem:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $098BAD
AddPendantOrCrystal:
@@ -721,18 +590,12 @@ AddAncillaLong:
org $099D1A
Ancilla_CheckIfAlreadyExistsLong:
org $09AC57
Ancilla_TerminateSelectInteractives:
org $09AE64
Sprite_SetSpawnedCoords:
org $09AD58
GiveRupeeGift:
org $0AB7BD
FluteMenu_HandleSelection_NoSelection:
org $0ABA4F
OverworldMap_InitGfx:
@@ -742,9 +605,6 @@ OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
org $8AE817
DungeonMapBossRooms:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
@@ -858,12 +718,6 @@ DiggingGameGuy_AttemptPrizeSpawn:
org $1EDE28
Sprite_GetEmptyBottleIndex: ; this is totally in sprite_bees.asm
org $1EDE89
GoldBee_Dormant_exit:
org $1EDE8A
GoldBee_SpawnSelf:
org $1EF4E7
Sprite_PlayerCantPassThrough:
;================================================================================

View File

@@ -1,15 +0,0 @@
# z3randomizer
Zelda 3 Randomizer Template ASM
How to create the bps patch:
* Assemble the ROM with asar (recommend to use a copy of original rom)
`asar LTTP_RND_GeneralBugfixes.asm copy_original_rom.sfc`
(copy_orignal_rom.sfc is now assembled_rom.sfc)
* Use flips to create a bps file
`flips original_rom.sfc assembled_rom.sfc base2current.bps`
* Update RANDOMIZERBASEHASH in DR with the md5 sum of assembled_rom.sfc. And put base2current.bps in the data directory.

Binary file not shown.

BIN
asar.dll

Binary file not shown.

421
asar.py
View File

@@ -1,421 +0,0 @@
#!/usr/bin/env python3
"""
python interface for asar.dll
by randomdude999
Usage: import asar, call asar.init, call asar.patch, then use the various
functions to get info about the patch
"""
import ctypes
import enum
import sys
from ctypes import c_int, c_char_p, POINTER
c_int_ptr = POINTER(c_int)
__all__ = ["errordata", "writtenblockdata", "mappertype", "version",
"apiversion", "init", "reset", "patch", "maxromsize", "close",
"geterrors", "getwarnings", "getprints", "getalllabels",
"getlabelval", "getdefine", "getalldefines", "resolvedefines",
"math", "getwrittenblocks", "getmapper", "getsymbolsfile"]
_target_api_ver = 303
_asar = None
class AsarArithmeticError(ArithmeticError):
pass
class errordata(ctypes.Structure):
_fields_ = [("fullerrdata", c_char_p),
("rawerrdata", c_char_p),
("block", c_char_p),
("filename", c_char_p),
("line", c_int),
("callerfilename", c_char_p),
("callerline", c_int),
("errid", c_int)]
def __repr__(self):
return "<asar error: {!r}>".format(self.fullerrdata.decode())
# for internal use only. getalllabels() returns a dict.
class _labeldata(ctypes.Structure):
_fields_ = [("name", c_char_p),
("location", c_int)]
# for internal use only. getalldefines() returns a dict.
class _definedata(ctypes.Structure):
_fields_ = [("name", c_char_p),
("contents", c_char_p)]
class writtenblockdata(ctypes.Structure):
_fields_ = [("pcoffset", c_int),
("snesoffset", c_int),
("numbytes", c_int)]
def __repr__(self):
return "<written block ${:06x} 0x{:x} size:{}>".format(
self.snesoffset, self.pcoffset, self.numbytes)
# internal use only. patch() accepts a dict.
class _memoryfile(ctypes.Structure):
_fields_ = [("path", c_char_p),
("buffer", c_char_p),
("length", ctypes.c_size_t)]
# internal use only. patch() accepts a dict.
class _warnsetting(ctypes.Structure):
_fields_ = [("warnid", c_char_p),
("enabled", ctypes.c_bool)]
# For internal use only.
class _patchparams(ctypes.Structure):
_fields_ = [("structsize", c_int),
("patchloc", c_char_p),
("romdata", c_char_p),
("buflen", c_int),
("romlen", c_int_ptr),
("includepaths", POINTER(c_char_p)),
("numincludepaths", c_int),
("should_reset", ctypes.c_bool),
("additional_defines", POINTER(_definedata)),
("additional_define_count", c_int),
("stdincludesfile", c_char_p),
("stddefinesfile", c_char_p),
("warning_settings", POINTER(_warnsetting)),
("warning_setting_count", c_int),
("memory_files", POINTER(_memoryfile)),
("memory_file_count", c_int),
("override_checksum_gen", ctypes.c_bool),
("generate_checksum", ctypes.c_bool)]
class mappertype(enum.Enum):
invalid_mapper = 0
lorom = 1
hirom = 2
sa1rom = 3
bigsa1rom = 4
sfxrom = 5
exlorom = 6
exhirom = 7
norom = 8
def _getall(func):
"""Helper that does the work common to all the getall* functions."""
count = c_int()
raw_errs = func(ctypes.byref(count))
errs = []
for i in range(count.value):
errs.append(raw_errs[i])
return errs
class _AsarDLL:
def __init__(self, dllname):
dll = ctypes.CDLL(dllname)
self.dll = dll
self.funcs = {}
try:
# argument/return type setup
# (also verifies that those functions are exported from the DLL)
# this is directly from asardll.h
# setup_func(name, argtypes, returntype)
self.setup_func("version", (), c_int)
self.setup_func("apiversion", (), c_int)
self.setup_func("init", (), ctypes.c_bool)
self.setup_func("reset", (), ctypes.c_bool)
self.setup_func("patch", (c_char_p, c_char_p, c_int, c_int_ptr),
ctypes.c_bool)
self.setup_func("patch_ex", (POINTER(_patchparams),), ctypes.c_bool)
self.setup_func("maxromsize", (), c_int)
self.setup_func("close", (), None)
self.setup_func("geterrors", (c_int_ptr,), POINTER(errordata))
self.setup_func("getwarnings", (c_int_ptr,), POINTER(errordata))
self.setup_func("getprints", (c_int_ptr,), POINTER(c_char_p))
self.setup_func("getalllabels", (c_int_ptr,), POINTER(_labeldata))
self.setup_func("getlabelval", (c_char_p,), c_int)
self.setup_func("getdefine", (c_char_p,), c_char_p)
self.setup_func("getalldefines", (c_int_ptr,), POINTER(_definedata))
self.setup_func("resolvedefines", (c_char_p, ctypes.c_bool),
c_char_p)
self.setup_func("math", (c_char_p, POINTER(c_char_p)),
ctypes.c_double)
self.setup_func("getwrittenblocks", (c_int_ptr,),
POINTER(writtenblockdata))
self.setup_func("getmapper", (), c_int)
self.setup_func("getsymbolsfile", (c_char_p,), c_char_p)
except AttributeError:
raise OSError("Asar DLL is missing some functions")
api_ver = dll.asar_apiversion()
if api_ver < _target_api_ver or \
(api_ver // 100) > (_target_api_ver // 100):
raise OSError("Asar DLL version "+str(api_ver)+" unsupported")
def setup_func(self, name, argtypes, restype):
"""Setup argument and return types for a function.
name: name of the function in the DLL. "asar_" is added automatically
argtypes and restype: see ctypes documentation
"""
func = getattr(self.dll, "asar_" + name)
func.argtypes = argtypes
func.restype = restype
def init(dll_path=None):
"""Load the Asar DLL.
You must call this before calling any other Asar functions. Raises OSError
if there was something wrong with the DLL (not found, wrong version,
doesn't have all necessary functions).
You can pass a custom DLL path if you want. If you don't, some common names
for the asar dll are tried.
"""
global _asar
if _asar is not None:
return
if dll_path is not None:
_asar = _AsarDLL(dll_path)
else:
if sys.platform == "win32":
libnames = ["./asar.dll", "asar", "./asar-x64.dll", "asar-x64"]
elif sys.platform == "darwin":
libnames = ["./libasar.dylib", "libasar"]
else:
libnames = ["./libasar.so", "libasar"]
for x in libnames:
try:
_asar = _AsarDLL(x)
except OSError:
continue
if _asar is None:
# Nothing in the search path is valid
raise OSError("Could not find asar DLL")
if not _asar.dll.asar_init():
_asar = None
return False
else:
return True
def close():
"""Free all of Asar's structures and unload the module.
Only asar.init() may be called after calling this.
"""
global _asar
if _asar is None:
return
_asar.dll.asar_close()
_asar = None
def version():
"""Return the version, in the format major*10000+minor*100+bugfix*1.
This means that 1.2.34 would be returned as 10234.
"""
return _asar.dll.asar_version()
def apiversion():
"""Return the API version, in the format major*100+minor.
Minor is incremented on backwards compatible changes; major is incremented
on incompatible changes. Does not have any correlation with the Asar
version. It's not very useful directly, since asar.init() verifies this
automatically.
"""
return _asar.dll.asar_apiversion()
def reset():
"""Clear out errors, warnings, printed statements and the file cache.
Not really useful, since asar.patch() already does this.
"""
return _asar.dll.asar_reset()
def patch(patch_name, rom_data, includepaths=[], should_reset=True,
additional_defines={}, std_include_file=None, std_define_file=None,
warning_overrides={}, memory_files={}, override_checksum=None):
"""Applies a patch.
Returns (success, new_rom_data). If success is False you should call
geterrors() to see what went wrong. rom_data is assumed to be headerless.
If includepaths is specified, it lists additional include paths for asar
to search.
should_reset specifies whether asar should clear out all defines, labels,
etc from the last inserted file. Setting it to False will make Asar act
like the currently patched file was directly appended to the previous one.
additional_defines specifies extra defines to give to the patch
(similar to the -D option).
std_include_file and std_define_file specify files where to look for extra
include paths and defines, respectively.
warning_overrides is a dict of str (warning ID) -> bool. It overrides
enabling/disabling specific warnings.
memory_files is a dict of str (file name) -> bytes (file contents). It
specifies memory files to use.
override_checksum specifies whether to override checksum generation. True
forces Asar to update the ROM's checksum, False forces Asar to not update
it.
"""
romlen = c_int(len(rom_data))
rom_ptr = ctypes.create_string_buffer(bytes(rom_data), maxromsize())
pp = _patchparams()
pp.structsize = ctypes.sizeof(_patchparams)
pp.patchloc = patch_name.encode()
pp.romdata = ctypes.cast(rom_ptr, c_char_p)
pp.buflen = maxromsize()
pp.romlen = ctypes.pointer(romlen)
# construct an array type of len(includepaths) elements and initialize
# it with elements from includepaths
pp.includepaths = (c_char_p*len(includepaths))(*includepaths)
pp.numincludepaths = len(includepaths)
defines = (_definedata * len(additional_defines))()
for i, (k, v) in enumerate(additional_defines.items()):
defines[i].name = k.encode()
defines[i].contents = v.encode()
pp.additional_defines = defines
pp.additional_define_count = len(additional_defines)
pp.should_reset = should_reset
pp.stdincludesfile = std_include_file.encode() if std_include_file else None
pp.stddefinesfile = std_define_file.encode() if std_define_file else None
warnsettings = (_warnsetting * len(warning_overrides))()
for i, (k, v) in enumerate(warning_overrides.items()):
warnsettings[i].warnid = k.encode()
warnsettings[i].enabled = v
pp.warning_settings = warnsettings
pp.warning_setting_count = len(warnsettings)
memoryfiles = (_memoryfile * len(memory_files))()
for i, (k, v) in enumerate(memory_files.items()):
memoryfiles[i].path = k.encode()
memoryfiles[i].buffer = v
memoryfiles[i].length = len(v)
pp.memory_files = memoryfiles
pp.memory_file_count = len(memory_files)
if override_checksum is not None:
pp.override_checksum_gen = True
pp.generate_checksum = override_checksum
else:
pp.override_checksum_gen = False
pp.generate_checksum = False
result = _asar.dll.asar_patch_ex(ctypes.byref(pp))
return result, rom_ptr.raw[:romlen.value]
def maxromsize():
"""Return the maximum possible size of the output ROM."""
return _asar.dll.asar_maxromsize()
def geterrors():
"""Get a list of all errors."""
return _getall(_asar.dll.asar_geterrors)
def getwarnings():
"""Get a list of all warnings."""
return _getall(_asar.dll.asar_getwarnings)
def getprints():
"""Get a list of all printed data."""
return [x.decode() for x in _getall(_asar.dll.asar_getprints)]
def getalllabels():
"""Get a dictionary of label name -> SNES address."""
labeldatas = _getall(_asar.dll.asar_getalllabels)
return {x.name.decode(): x.location for x in labeldatas}
def getlabelval(name):
"""Get the ROM location of one label. None means "not found"."""
val = _asar.dll.asar_getlabelval(name.encode())
return None if (val == -1) else val
def getdefine(name):
"""Get the value of a define."""
return _asar.dll.asar_getdefine(name.encode()).decode()
def getalldefines():
"""Get the names and values of all defines."""
definedatas = _getall(_asar.dll.asar_getalldefines)
return {x.name.decode(): x.contents.decode() for x in definedatas}
def resolvedefines(data, learnnew):
"""Parse all defines in the given data.
Returns the data with all defines evaluated.
learnnew controls whether it'll learn new defines in this string if it
finds any. Note that it may emit errors.
"""
return _asar.dll.asar_resolvedefines(data, learnnew)
def math(to_calculate):
"""Parse a string containing math.
It automatically assumes global scope (no namespaces), and has access to
all functions and labels from the last call to asar.patch(). If there was
an error, ArithmeticError is raised with the message returned by Asar.
"""
error = ctypes.c_char_p()
result = _asar.dll.asar_math(to_calculate.encode(), ctypes.byref(error))
if not bool(error):
# Null pointer, means no error
return result
else:
raise AsarArithmeticError(error.value.decode())
def getwrittenblocks():
"""Get a list of all the blocks written to the ROM."""
return _getall(_asar.dll.asar_getwrittenblocks)
def getmapper():
"""Get the ROM mapper currently used by Asar."""
return mappertype(_asar.dll.asar_getmapper())
def getsymbolsfile(fmt="wla"):
"""Generates the contents of a symbols file for in a specific format.
Returns the textual contents of the symbols file.
format specified the format of the symbols file that gets generated.
"""
return _asar.dll.asar_getsymbolsfile(fmt.encode()).decode()

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,15 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JML RequestSlottedTile
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA $0E80, X ; Retrieve stored item type
JSL.l DrawSlottedTile
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
@@ -24,30 +24,32 @@ RTL
;================================================================================
; Randomize Bonk Keys
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
LoadBonkItemGFX:
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LoadBonkItemGFX_inner:
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.b #$00 : STA !REDRAW
JSR LoadBonkItem
JML RequestSlottedTile
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
PHA
LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit
BRA .done ; don't draw on the init frame
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
JSL DrawSlottedTile
JSR LoadBonkItem
JSL.l DrawDynamicTileNoShadow
.done
PLA
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
CMP #$24 : BNE .notKey
.key
@@ -64,25 +66,12 @@ RTL
LoadBonkItem:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert
LDA.l BonkKey_Desert
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
LDA.l BonkKey_GTower
BRA ++
+
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
RTS

View File

@@ -49,7 +49,7 @@ DecideIfBunnyByScreenIndex:
; superbunny work
LDA $1B : BNE .done
LDA MoonPearlEquipment : BNE .done
PHX : LDX $8A : LDA.l OWTileWorldAssoc, X : PLX : PHA
LDA $8A : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -90,11 +90,11 @@ FixAga2Bunny:
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
LDA.b #$04 : STA.w $012C ; play bunny music
BRA .done
+
LDA.b #$09 : STA.w $012C ; what we wrote over
.done
PHX
JSL Overworld_DetermineMusic : STX !REG_MUSIC_CONTROL_REQUEST
PLX
RTL
;--------------------------------------------------------------------------------
@@ -123,7 +123,7 @@ FixFrogSmith:
STA.l FollowerIndicator
JSL Tagalong_LoadGfx
.done
RTL
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
@@ -200,27 +200,6 @@ LDA $1B : BNE +
+
RTL
;--------------------------------------------------------------------------------
; Fix losing VRAM gfx when using quake
PostNMIUpdateBGCharHalf:
STA.w $420B : SEP #$10 ; what we wrote over
LDA.w $0116 : CMP.b #$46 : BNE .return ; checks to see if this is the last VRAM write
LDA.b $5D : CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion
RTL
+ JSL HeartPieceSetRedraw ; set redraw flag for items
.return
RTL
; Force redraws of items following map checks
PostOverworldGfxLoad:
INC.b $11 : STZ.b $13 ; what we wrote over
JSL HeartPieceSetRedraw
RTL
PostUnderworldMap:
JSL HeartPieceSetRedraw
LDA.l $7EC229 ; what we wrote over
RTL
;--------------------------------------------------------------------------------
FixJingleGlitch:
LDA.b $11

View File

@@ -1,2 +1,4 @@
py -3 build.py
@echo %cmdcmdline%|find /i """%~f0""">nul && cmd /k
del ..\working.sfc
copy ..\alttp.sfc ..\working.sfc
xkas.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc
cmd /k

115
build.py
View File

@@ -1,115 +0,0 @@
import os
import sys
import hashlib
from asar import init as asar_init, close as asar_close, patch as asar_patch, geterrors as asar_errors, getprints as asar_prints, getwarnings as asar_warnings
JAP10HASH = '03a63945398191337e896e5771f77173'
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
def int16_as_bytes(value):
value = value & 0xFFFF
return [value & 0xFF, (value >> 8) & 0xFF]
def int32_as_bytes(value):
value = value & 0xFFFFFFFF
return [value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF]
def is_bundled():
return getattr(sys, 'frozen', False)
def local_path(path):
if local_path.cached_path:
return os.path.join(local_path.cached_path, path)
elif is_bundled():
if hasattr(sys, "_MEIPASS"):
# we are running in a PyInstaller bundle
local_path.cached_path = sys._MEIPASS # pylint: disable=protected-access,no-member
else:
# cx_Freeze
local_path.cached_path = os.path.dirname(os.path.abspath(sys.argv[0]))
else:
# we are running in a normal Python environment
import __main__
local_path.cached_path = os.path.dirname(os.path.abspath(__main__.__file__))
return os.path.join(local_path.cached_path, path)
local_path.cached_path = None
def make_new_base2current(old_rom_data, new_rom_data):
from collections import OrderedDict
import json
# extend to 2 mb
old_rom_data.extend(bytearray([0x00]) * (2097152 - len(old_rom_data)))
out_data = OrderedDict()
for idx, old in enumerate(old_rom_data):
new = new_rom_data[idx]
if old != new:
out_data[idx] = [int(new)]
for offset in reversed(list(out_data.keys())):
if offset - 1 in out_data:
out_data[offset-1].extend(out_data.pop(offset))
with open('../base2current.json', 'wt') as outfile:
json.dump([{key: value} for key, value in out_data.items()], outfile, separators=(",", ":"))
basemd5 = hashlib.md5()
basemd5.update(new_rom_data)
return "New Rom Hash: " + basemd5.hexdigest()
if __name__ == '__main__':
try:
asar_init()
print("Asar DLL initialized")
print("Opening Base rom")
with open('../alttp.sfc', 'rb') as stream:
old_rom_data = bytearray(stream.read())
if len(old_rom_data) % 0x400 == 0x200:
old_rom_data = old_rom_data[0x200:]
basemd5 = hashlib.md5()
basemd5.update(old_rom_data)
if JAP10HASH != basemd5.hexdigest():
raise Exception("Base rom is not 'Zelda no Densetsu - Kamigami no Triforce (J) (V1.0)'")
print("Patching Base Rom")
result, new_rom_data = asar_patch(os.path.abspath('LTTP_RND_GeneralBugfixes.asm'), old_rom_data)
if result:
with open('../working.sfc', 'wb') as stream:
stream.write(new_rom_data)
print("Success\n")
print(make_new_base2current(old_rom_data, new_rom_data))
prints = asar_prints()
for p in prints:
print(p)
else:
errors = asar_errors()
print("\nErrors: " + str(len(errors)))
for error in errors:
print (error)
warnings = asar_warnings()
print("\nWarnings: " + str(len(warnings)))
for w in warnings:
print(w)
asar_close()
except:
import traceback
traceback.print_exc()

Binary file not shown.

Binary file not shown.

View File

@@ -2,36 +2,26 @@
; Capacity Logic
;================================================================================
IncrementBombs:
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs
DEC
CMP BombsEquipment
!BLT +
LDA BombsEquipment
CMP.b #99 : !BGE +
INC : STA BombsEquipment
+
LDA.l BombCapacity : BEQ + ; Skip if we can't have bombs
DEC
CMP.l BombsEquipment : !BLT +
LDA.l BombsEquipment
CMP.b #99 : !BGE +
INC : STA.l BombsEquipment
+
RTL
;--------------------------------------------------------------------------------
IncrementArrows:
LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP CurrentArrows
!BLT +
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA CurrentArrows
+
LDA.l ArrowCapacity : DEC
CMP.l CurrentArrows : !BLT +
LDA.l CurrentArrows
CMP.b #99 : !BGE +
INC : STA.l CurrentArrows
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP BombsEquipment
LDA.l BombCapacity
CMP.l BombsEquipment
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,40 +1,34 @@
;================================================================================
; Randomize Catfish
;--------------------------------------------------------------------------------
!HEART_REDRAW = "$7F5000"
LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $1DE185 ; location randomizer writes catfish item to
JML RequestSlottedTile
LDA.l $1DE185 ; location randomizer writes catfish item to
JML PrepDynamicTile
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
LDA.l $1DE1C3 ; location randomizer writes zora item to
LDA.b #$01 : STA !HEART_REDRAW
LDA.l $1DE1C3 ; location randomizer writes zora item to
BRA .draw
.catfish
LDA.l $1DE185 ; location randomizer writes catfish item to
LDA.l $1DE185 ; location randomizer writes catfish item to
.draw
JML DrawSlottedTile
JML DrawDynamicTile
;--------------------------------------------------------------------------------
MarkThrownItem:
PHA
JSL Link_ReceiveItem ; thing we wrote over
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
JSL.l ItemSet_ZoraKing
LDA ZoraItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
BRA .done
JML ItemSet_ZoraKing
.catfish
JSL.l ItemSet_Catfish
LDA CatfishItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JML ItemSet_Catfish
.done
PLA
JSL Link_ReceiveItem ; thing we wrote over
RTL
;--------------------------------------------------------------------------------

View File

@@ -3,7 +3,6 @@
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
SEP #$10
LDX $1B : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
@@ -11,42 +10,33 @@ DrawDungeonCompassCounts:
LDA.w $040C : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCC + ; Skip if not in a valid dungeon ID
JMP .done
+
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
TXY : TXA : LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA CompassExists, X : BEQ ++
TYX : LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BNE ++
JMP .done ; skip if we don't have compass
++
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
LDA $040C : LSR
BNE +
INC
+ TAX : LDA.l CompassTotalsWRAM, X : AND #$00FF
PHX
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT .two_digit
LDX.b $05 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79C
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79E
BRA .end_total
.two_digit
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79C
.end_total
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass
++
TXA : LSR : TAX
BNE +
INC
+
LDA.l CompassTotalsWRAM, X : AND #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b $06 : TXA : ORA #$2400 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2400 : STA $7EC79C
PLX
LDA DungeonLocationsChecked, X : AND #$00FF
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA #$2490 : STA $7EC792 ; Draw the 100's digit
+
LDX.b $06 : TXA : ORA #$2490 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2490 : STA $7EC796
LDA DungeonLocationsChecked, X : AND #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2400 : STA $7EC796
LDA.w #$2830 : STA $7EC798 ; draw the slash
.done
@@ -55,13 +45,6 @@ RTL
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
; maps from $040C to the odd order used in overworld map
ExistsTransfer:
db $0C, $0C, $00, $02, $0B, $09, $03, $07, $04, $08, $01, $06, $05, $0A
;--------------------------------------------------------------------------------
; $7EF4C0-7EF4CF - item locations checked indexed by $040C >> 1
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
@@ -70,3 +53,4 @@ InitCompassTotalsRAM:
INX
CPX #$0F : !BLT -
RTL

View File

@@ -180,6 +180,3 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
RTL
}
;================================================================
incsrc menu/hudalpha.asm
incsrc util/utils.asm

View File

@@ -6,61 +6,6 @@
; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????]
!INVERT_DPAD = "$7F50CB"
InvertDPad_DPadOnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01
JML.l InvertDPadReturn
InvertDPad_ButtonsOnly:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_Both:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
BIT.w #$0C00 : BEQ + : EOR.w #$0C00 : + ; swap up/down
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_SwapSides:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$0840 : BEQ + : EOR.w #$0840 : + ; swap X/up
BIT.w #$0180 : BEQ + : EOR.w #$0180 : + ; swap A/right
BIT.w #$4200 : BEQ + : EOR.w #$4200 : + ; swap Y/left
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_DPadLROnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01
JML.l InvertDPadReturn
InvertDPad_DPadUDOnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
STA $01
JML.l InvertDPadReturn
InvertDPad:
LDA.l OneMindPlayerCount : BEQ .crowd_control
@@ -84,18 +29,44 @@ InvertDPad:
LDA $4219 : STA $01
JML.l InvertDPadReturn
+ DEC : BNE +
JMP.w InvertDPad_DPadOnly
+ DEC : BNE +
JMP.w InvertDPad_ButtonsOnly
+ DEC : BNE +
JMP.w InvertDPad_Both
+ DEC : BNE +
JMP.w InvertDPad_SwapSides
+ DEC : BNE +
JMP.w InvertDPad_DPadLROnly
+ JMP.w InvertDPad_DPadUDOnly
+ DEC : BEQ .dpadOnly
DEC : BEQ .buttonsOnly
DEC : BEQ .invertBoth
.swapSides
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$0840 : BEQ + : EOR.w #$0840 : + ; swap X/up
BIT.w #$0180 : BEQ + : EOR.w #$0180 : + ; swap A/right
BIT.w #$4200 : BEQ + : EOR.w #$4200 : + ; swap Y/left
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.invertBoth
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
BIT.w #$0C00 : BEQ + : EOR.w #$0C00 : + ; swap up/down
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.buttonsOnly
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.dpadOnly
LDA $4218 : STA $00
LDA $4219
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01
JML.l InvertDPadReturn
.onemind_controller_offset
db 0 ; player 0 - $4218 - joy1d1
@@ -105,6 +76,8 @@ InvertDPad:
db 2 ; player 4 - $421A - joy2d1
db 6 ; player 5 - $421E - joy2d2
;--------------------------------------------------------------------------------
HandleOneMindController:

Binary file not shown.

Binary file not shown.

View File

@@ -1,13 +1,13 @@
CheckReceivedItemPropertiesBeforeLoad:
LDA $A0 : BEQ .normalCode
LDA $7EC005 : BNE .lightOff
.normalCode
JSL LoadReceivedItemExpandedProperties ; get palette
.normalCode
LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code
RTL
.lightOff
PHX : PHY : PHB
JSL LoadReceivedItemExpandedProperties ; get palette
LDA.l AddReceivedItemExpanded_properties, X ; get palette
REP #$30
AND #$0007 ; mask out palette

View File

@@ -11,24 +11,13 @@ DoWorldFix:
JMP DoWorldFix_Inverted
+
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l OldManRetrievalWorld
BRA .noMirror
+ LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld
.aga1Alive
LDA #$00
.noMirror
STA CurrentWorld ; set flag to light world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done
RTL
@@ -57,26 +46,18 @@ RTL
;================================================================================
DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l OldManRetrievalWorld
BRA .setWorld
+ LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror
.setDarkWorld
LDA #$40
.setWorld
STA CurrentWorld ; set flag to dark world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.aga1Alive
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA FollowerIndicator ; clear follower
.done
RTL
;--------------------------------------------------------------------------------
@@ -87,7 +68,7 @@ SetDeathWorldChecked_Inverted:
LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix_Inverted
JMP DoWorldFix
.dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
@@ -104,21 +85,10 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA FixFakeWorld : BEQ +
PHX
LDX $8A : LDA.l OWTileWorldAssoc, X : STA CurrentWorld
PLX
LDA $8A : AND.b #$40 : STA CurrentWorld
+
RTL
;--------------------------------------------------------------------------------
GetCurrentWorldForLoad:
LDA FollowerIndicator : CMP #$04 : BNE .default
LDA InvertedMode : BEQ +
LDA #$40
+ RTL
.default
LDA CurrentWorld
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear:
LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower
@@ -144,46 +114,37 @@ RefreshRainAmmo:
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ +++
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
+++ BRA .done
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
BRA .done
+ CMP.b #$02 : BNE + ; Cell
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
BRA .done
+ CMP.b #$04 : BNE + ; Mantle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
+
.done
RTL
;--------------------------------------------------------------------------------
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetEscapeAssist:
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
BRA ++
.no_train ; choo choo
LDA.l EscapeAssist
BIT.b #$40 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$20 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$10 : BEQ + : STA InfiniteArrowsModifier : +
LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA !INFINITE_MAGIC : +
LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA !INFINITE_BOMBS : +
LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA !INFINITE_ARROWS : +
++
LDA.l SpecialWeapons : AND.b #$7F : CMP #$01 : BNE +
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombsModifier
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:

View File

@@ -268,7 +268,8 @@ RTL
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
.noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.b #$51
@@ -299,64 +300,31 @@ RTL
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
JSL.l CheckGanonVulnerability
JSL.l CheckGanonVulnerability
REP #$20
BCS +
LDA.w #$018D : JMP .done
+
LDA.l GanonVulnerabilityItem : AND #$00FF : BNE .special_item
LDA.l SpecialWeapons : AND.w #$007F
CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode
.silver_arrows
LDA.w #$018D : BRA ++
+
LDA.l BowTracking
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : JMP .done
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : JMP .done
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : JMP .done
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : JMP .done
+
LDA.w #$016E : JMP .done
.special_item
CMP.w #$0001 : BEQ .silver_arrows
CMP.w #$0004 : BEQ .bombs
CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee
PHX : TAX
LDA.l EquipmentWRAM-1, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done
+
LDA.w #$0195 : BRA .done
.bombs
LDA.l BombsEquipment : AND #$00FF : BNE +
LDA.l InfiniteBombsModifier : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.powder
LDA.l InventoryTracking : AND #$0010 : BNE + ; check for powder
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.bee
LDA.l BottleContentsOne : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsTwo : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsThree : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsFour : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.done
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : BRA ++
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : BRA ++
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : BRA ++
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : BRA ++
+
LDA.w #$016E
++
STA $1CF0
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
@@ -366,8 +334,11 @@ DialogEtherTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++
.yesText
PLA
LDA.b #$0C
@@ -385,10 +356,13 @@ DialogBombosTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++
.yesText
PLA
PLA
LDA.b #$0D
LDY.b #$01
JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm)
@@ -400,7 +374,7 @@ RTL
DialogSahasrahla:
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
LDY.b #$00
JML Sprite_ShowMessageUnconditional
+
RTL
@@ -481,7 +455,7 @@ RTL
CalculateSignIndex:
; for the big 1024x1024 screens we are calculating link's effective
; screen area, as though the screen was 4 different 512x512 screens.
; And we do this in a way that will likely give the right value even
; And we do this in a way that will likely give the right value even
; with major glitches.
LDA $8A : ASL A : TAY ;what we wrote over
@@ -490,13 +464,13 @@ CalculateSignIndex:
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
+
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
TYA : AND.w #$00FF : TAY
TYA : AND.w #$00FF : TAY
.done
RTL

View File

@@ -37,54 +37,3 @@ WalkDownIntoTavern:
CMP #$43
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; TurnAroundOnUnderworld
;--------------------------------------------------------------------------------
TurnAroundOnUnderworld:
LDA $26 : BEQ .done
; turn around if ($010E == #$43) != ($7F5099 == #$43)
LDX #$00
LDA #$43 : CMP $010E : BEQ +
INX
+
CMP $7F5099 : BEQ +
DEX
+
CPX #$00 : BEQ .done
LDA $26 : EOR #$0C : STA $26
.done
JML $0FFD65 ; what we overwrote
;--------------------------------------------------------------------------------
; TurnUpOnOverworld
;--------------------------------------------------------------------------------
TurnUpOnOverworld:
LDA.l EntranceTavernBack : CMP #$43 : BEQ .done
LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla
.done
JML $07E68F ; what we overwrote
;--------------------------------------------------------------------------------
; WalkUpOnOverworld
;--------------------------------------------------------------------------------
WalkUpOnOverworld:
LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate
STZ $2F
RTL
.normal
LDA #$0002 : STA $2F ; what we overwrote
RTL
;--------------------------------------------------------------------------------
; CheckStairsAdjustment
;--------------------------------------------------------------------------------
CheckStairsAdjustment:
LDA.b $A0
CMP.w #$0124 ; vanilla check, rooms $0124 to $0127 have a lower exit position (currently ER ignores the entrance location)
BCC .done
LDA.w #$FFFF-1
CMP.w $0696 ; tavern back ($0696 == #$FFFF) should always have carry cleared
.done
RTL
; if carry cleared, shift position up

View File

@@ -1,51 +0,0 @@
pushpc
org $9E9463
JSL CheckKholdShellCoordinates
BCC Sprite_A3_KholdstareShell_link_not_close
BRA Sprite_A3_KholdstareShell_link_close
NOP #13
Sprite_A3_KholdstareShell_link_close = $9E9478
Sprite_A3_KholdstareShell_link_not_close = $9E9480
pullpc
CheckKholdShellCoordinates:
LDA.w $0D30, X
XBA
LDA.w $0D10, X ; full 16 bit X coordinate of sprite
REP #$21
SBC.w #$0020
CMP.b $22
BCS .not_colliding
ADC.w #$0040
CMP.b $22
BCC .not_colliding
SEP #$20
LDA.w $0D20, X
XBA
LDA.w $0D00, X ; full 16 bit Y coordinate of sprite
REP #$21
SBC.w #$001F ; could go to 27 and let link squeeze in at Lanmo 2 (please adjust the following one)
CMP.b $20
BCS .not_colliding
ADC.w #$0037
CMP.b $20
BCC .not_colliding
SEP #$20 ; collision detected
SEC
RTL
.not_colliding
SEP #$30
CLC
RTL

View File

@@ -1,65 +0,0 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator
; Normal doors use $045e to store Y coordinate when transitioning to in-room stairs
; Normal doors use $045f to determine the order in which supertile quadrants are drawn
; Straight stairs use $046d to store X coordinate on animation start
; Spiral doors use $045e to store stair type
; Gfx uses $b1 to for sub-sub-sub-module thing
; Hooks into various routines
incsrc drhooks.asm
;Main Code
org $A78000 ;138000
db $44, $52 ;DR
DRMode:
dw 0
; xxpg rmse
; xxxx xBDM
; x - unused
; p - use the original palette for the dungeon rooms instead of the DR table
; g - fix the EG glitch in more places (should be off for no logic)
; r - The collection rate flag
; m - Whether to display keys Map Info
; s - Start with Mirror Scroll
; e - GT minibosses marked as defeated instead of spawning heart container in all dungeons
; B - Big Key doors can displayed and be opened on the "south" side in addition
; D - Enabled spawning as a bunny in the Dark World underworld
; M - hides the total number in the collection rate
DRFlags:
dw 0
DRScroll:
db 0
OffsetTable:
dw -8, 8
org $A78010
DRVersionInfo:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
org $A78020
incsrc normal.asm
incsrc scroll.asm
incsrc spiral.asm
incsrc gfx.asm
incsrc keydoors.asm
incsrc overrides.asm
incsrc edges.asm
incsrc math.asm
incsrc hudadditions.asm
incsrc dr_lobby.asm
incsrc entrance_fixes.asm
incsrc bugfix/kholdstare_shell_collision.asm
warnpc $A79C00
incsrc doortables.asm
warnpc $A88000

View File

@@ -1,698 +0,0 @@
org $A79C00
KeyDoorOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
dw $0000,$0001,$0003,$0000,$0006,$0000,$000b,$0000,$0000,$0000,$000c,$000d,$0010,$0011,$0012,$0000
dw $0000,$0015,$0018,$001c,$001e,$0025,$0027,$0000,$0000,$002b,$002d,$0033,$0035,$0038,$0039,$003d
dw $003f,$0040,$0043,$0045,$0047,$0000,$004f,$0000,$0053,$0000,$0055,$005b,$0000,$0000,$005f,$0000
dw $0060,$0062,$0064,$0065,$0066,$0068,$006e,$0074,$007a,$007c,$007e,$0081,$0000,$0082,$0086,$0088
dw $0089,$008a,$0000,$008b,$008e,$0092,$0096,$0000,$0000,$0099,$009d,$00a2,$00a5,$00a6,$00a8,$00aa
dw $00ab,$00ad,$00af,$00b2,$0000,$0000,$00b5,$00b9,$00bf,$00c5,$00c9,$00ca,$00cc,$00ce,$00d1,$00d5
dw $00d6,$00dc,$00e3,$00e9,$00ec,$00ed,$00ee,$00f2,$00f5,$0000,$00f7,$00f8,$00fc,$00ff,$0102,$0000
dw $0000,$0103,$0106,$0107,$010a,$010c,$010e,$0112,$0000,$0000,$0000,$0114,$0117,$011b,$011e,$0121
dw $0000,$0123,$0000,$0124,$0127,$0128,$0000,$012c,$0000,$0000,$0000,$012e,$0133,$0139,$013e,$0000
dw $013f,$0140,$0141,$0146,$0000,$0149,$014b,$014d,$014f,$0150,$0000,$0153,$0156,$015a,$015d,$0161
dw $0163,$0164,$0166,$016a,$016c,$016d,$0000,$0000,$0170,$0176,$017c,$0182,$0184,$0000,$0185,$0186
dw $0188,$018b,$018f,$0197,$019c,$019d,$019e,$01a3,$01a4,$01a6,$01aa,$01ad,$01b3,$0000,$01bb,$01be
dw $01bf,$01c2,$01ca,$01d2,$01d9,$01da,$01dd,$01e3,$01e6,$01e7,$0000,$01ec,$01ed,$0000,$01f0,$0000
dw $01f1,$01f3,$01f7,$0000,$0000,$01f8,$01fa,$0000,$01fd,$0200,$0203,$0204,$0206,$0000,$0000,$0000
dw $0207
org $A79E00
SpiralOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$01,$02,$00,$03,$00,$00,$04,$00,$05,$07,$00,$08,$00,$0b,$00
db $00,$0c,$00,$00,$00,$0d,$0e,$0f,$00,$00,$11,$00,$13,$14,$15,$00
db $00,$00,$00,$00,$00,$00,$16,$19,$1b,$00,$00,$00,$00,$00,$00,$00
db $00,$1c,$00,$00,$1f,$00,$00,$00,$20,$00,$21,$00,$00,$00,$00,$22
db $23,$24,$25,$00,$00,$26,$00,$00,$00,$00,$27,$00,$29,$2a,$2b,$00
db $00,$00,$00,$2c,$2d,$00,$00,$00,$00,$00,$00,$00,$2e,$2f,$00,$30
db $00,$00,$00,$35,$36,$00,$37,$00,$00,$00,$38,$3a,$3b,$00,$3c,$00
db $3d,$40,$41,$00,$00,$00,$42,$45,$00,$00,$00,$00,$00,$00,$00,$49
db $4a,$00,$00,$00,$00,$00,$00,$4b,$00,$00,$00,$00,$4f,$00,$53,$00
db $00,$54,$00,$55,$00,$00,$00,$56,$57,$58,$00,$00,$00,$00,$59,$00
db $5a,$00,$5b,$00,$00,$5c,$5d,$00,$00,$00,$00,$5e,$00,$00,$5f,$00
db $60,$00,$00,$00,$00,$63,$64,$00,$00,$00,$00,$00,$65,$00,$66,$00
db $67,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $6a,$6d,$6e,$00,$00,$00,$00,$00,$00,$00,$6f,$00,$00,$00,$00,$00
db $70
org $A79F00
DoorOffset:
db $00,$01,$02,$00,$03,$00,$04,$00,$00,$00,$00,$00,$9A,$05,$99,$00
db $00,$06,$07,$08,$09,$0A,$0B,$00,$00,$0C,$0D,$0E,$00,$0F,$10,$11
db $12,$13,$14,$15,$16,$00,$17,$00,$98,$00,$18,$19,$00,$00,$1A,$00
db $1B,$00,$1C,$1D,$1E,$1F,$20,$21,$22,$23,$24,$25,$00,$26,$27,$00
db $96,$28,$97,$29,$2A,$2B,$2C,$00,$00,$2D,$2E,$2F,$30,$31,$32,$00
db $33,$34,$35,$36,$00,$00,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F,$40
db $41,$42,$43,$A0,$00,$00,$44,$45,$46,$00,$47,$48,$49,$4A,$4B,$00
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$4C,$00,$00,$00,$4D,$4E,$9E,$00,$00,$00,$4F,$50,$51,$52,$53
db $00,$54,$00,$9C,$9D,$55,$00,$00,$00,$00,$00,$56,$57,$58,$59,$00
db $5A,$5B,$5C,$5D,$00,$5E,$5F,$00,$9B,$60,$00,$61,$62,$63,$64,$65
db $66,$67,$68,$69,$6A,$6B,$00,$00,$6C,$6D,$6E,$6F,$70,$00,$71,$72
db $00,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$00,$7F,$80
db $00,$81,$82,$83,$84,$85,$86,$87,$88,$89,$00,$8A,$8B,$00,$8C,$00
db $00,$8D,$8E,$00,$00,$8F,$90,$00,$91,$92,$93,$94,$95,$00,$00,$00
db $9f
org $A7A000
DoorTable:
;; NW 00 N 01 NE 02 WN 00 W 01 WS 02 SW 00 S 01 SE 02 EN 00 E 01 ES 02 - Door ruler
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Default/Garbage row
dw $0003, $0003, $0003, $0450, $0003, $0003, $0003, $0003, $0003, $0452, $0003, $0003 ; HC Back Hall (x01)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Switches (x02)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Crystaroller
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Arghus
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Aga 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Secret Room
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sanc
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pokey
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Lava Pipe
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pipes n Ledge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swap Canal
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod dark Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Eye Statue
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Pre Aga
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice BK
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x20 Aga1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Key Rat
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Waters
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Eye Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chest Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Statue
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Arena (x2a)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Statue (x2b)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Compass
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x30 Aga's Altar
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Dark Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Lanmolas
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp West Wing
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Flooded Key
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Main Hub (x36)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Hammer Time
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp First Basement
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Drop to the Moth
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod 3 Catwalks
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Conveyor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Minihelma
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Conveyor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewers
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Big Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Cellblock
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Compass Loop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull3 Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Mimics 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Conveyor Ice
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Moldorm
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; IPBJ
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0401, $0003, $0003 ; HC West Hall (x50)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Throne Room (x51)
dw $0003, $0003, $0003, $0401, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Hall (x52)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Tiles 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Left Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Right Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 1 Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 3 Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Helmasaur
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Spike Switch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Cannonball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Gauntlet 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Choice Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced U
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC West Lobby (x60)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Main Lobby (x61)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Lobby (x62)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x66 Swamp Waterfall
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x67 Skull 1 Left Drop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x68 Skull 1 Pinball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6a Pod Rupees
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6b GT Mimics
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6c GT Lanmolas
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6d Gauntlet 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6e Ice Gators
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Armory
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert BK Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Flooded Chests
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT DM's Tile
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Randoroom
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Freezors
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Hookpit
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Catawalk
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Right Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Left
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Hopeful Torch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Right
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Lonely Freezor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Vitreous (x90)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Rain
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Dark Crystals
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Blockswitch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Fallbridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Torch Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Darkness
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Invis Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Compass Room
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Big Chests
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Icy Pots
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Pre-Vitreous (xa0)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Fishbone
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Bridges
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Corner
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Trinexx (xa4)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Wizzrobes
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Compass (xa8)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Courtyard (xa9)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Map (xaa)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Switch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Blind
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced T
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Slipway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Warpzone
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire ????
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Spikes
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Refill
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Dark Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chainchomp
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Rollers
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Big Key
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Easter Cannonball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Dark Circle
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Hellway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Bossway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Blockswitch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Backtracker
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Tiles
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Main Hub
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Big Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Switch Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Narrow
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Early Hub
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Floating Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Armos
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NW Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NE Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Boss Drop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire BK
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Laser Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Main Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Eyegores
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Switches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Start
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Entrance Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT SE Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Aga 6F
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewers Rope
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert West Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Main Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Hera Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Tower Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Back Lobby
; this should end at 27AF18 about (160 * 24 bytes = 3840 or F18)
; some values you can hardcode for spirals
;dw $0070, $36a0 ; ->HC Stairwell
;dw $0072, $4ff8 ; ->HC Map Room
;dw $0080, $1f50 ; ->zelda's cellblock
org $A7B000
SpiralTable: ;113 4 byte entries - should end at 27B1C4
dw $0203, $8080 ;null row
dw $0203, $8080 ;HC Backhallway
dw $0203, $8080 ;Sewer Pull
dw $0203, $8080 ;Crystaroller
dw $0203, $8080 ;Moldorm
dw $0203, $8080, $0203, $8080 ;Pod Basement
dw $0203, $8080 ;Pod Stalfos
dw $0203, $8080, $0203, $8080, $0203, $8080 ;GT Entrance
dw $0203, $8080 ;Ice Entrance
dw $0203, $8080 ;Escape
dw $0203, $8080 ;TR Pipe Ledge
dw $0203, $8080 ;Swamp Way
dw $0203, $8080, $0203, $8080 ;Hera Fallplace
dw $0203, $8080, $0203, $8080 ;PoD Bridge
dw $0203, $8080 ;GT Ice
dw $0203, $8080 ;GT F8
dw $0203, $8080 ;Ice Cross
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Swamp Statue
dw $0203, $8080, $0203, $8080 ;Hera Big
dw $0203, $8080 ;Swamp Ent
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Startiles (middle value unused)
dw $0203, $8080 ;West Swamp
dw $0203, $8080 ;Swamp Basement
dw $0203, $8080 ;Pod Drops
dw $0203, $8080 ;Ice Hammer
dw $0203, $8080 ;Aga Guards
dw $0203, $8080 ;Sewer Begin
dw $0203, $8080 ;Sewer Rope
dw $0203, $8080 ;TT Cellblock
dw $0203, $8080, $0203, $8080 ;Pod Entrance
dw $0203, $8080 ;GT Icespike
dw $0203, $8080 ;GT Moldorm
dw $0203, $8080 ;IPBJ
dw $0203, $8080 ;Desert Prep
dw $0203, $8080 ;Swamp Attic
dw $0203, $8080 ;GT Cannonball
dw $0203, $8080 ;GT Gauntlet1
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Ice U (1st three values unused)
dw $0203, $8080 ;Desert Back
dw $0203, $8080 ;TT Attic L
dw $0203, $8080 ;Swamp Waterf
dw $0203, $8080 ;Pod Rupees
dw $0203, $8080 ;Pod Rupees
dw $0203, $8080 ;GT Mimics
dw $0203, $8080 ;GT Lanmo
dw $0203, $8080 ;Ice Gators
dw $0203, $8080, $0203, $8080, $0203, $8080 ;HC Tiny (first value placeholder)
dw $0203, $8080 ;HC Boomer
dw $0203, $8080 ;HC Pits1
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Swamp Sunken
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Entrance (first value unused)
dw $0203, $8080 ;Ice Hookshot
dw $0203, $8080 ;HC Cellblock
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Basement (first and third values unused)
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;GT Circle (third value unused)
dw $0203, $8080 ;Ice Last Freeze
dw $0203, $8080 ;Mire Drops
dw $0203, $8080 ;Mire Block
dw $0203, $8080 ;Mire Attic
dw $0203, $8080 ;Mire Entrance
dw $0203, $8080 ;East Dark
dw $0203, $8080 ;Ice Big
dw $0203, $8080 ;Mire Previtreous
dw $0203, $8080 ;Mire Bridges
dw $0203, $8080 ;GT Wizzrobes
dw $0203, $8080 ;GT Spikepit
dw $0203, $8080 ;TT Switch
dw $0203, $8080 ;Ice T
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Usains (2nd value unused)
dw $0203, $8080 ;TR PlatMaze
dw $0203, $8080 ;TR Chainchomp
dw $0203, $8080 ;TT Bossway
dw $0203, $8080 ;Ice FallZone
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Dark2 (2nd value unused)
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Dark1 (2nd value unused)
dw $0203, $8080 ;Mire BK Thang
dw $0203, $8080 ;Mire2
dw $0203, $8080 ;East Attic Start
dw $0203, $8080 ;Tower Entrance
org $A7C000 ;ends around 27C418
PairedDoorTable:
dw $0000 ; the bad template
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000,$8021
dw $0000,$0000,$0000,$0000
dw $4014,$0000
dw $8024,$8013,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $201a,$401a
dw $0000,$4019,$8019,$402a,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $2011,$0000,$0000
dw $8032,$0000
dw $0000,$0000
dw $8014,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $4036,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$101a,$402b,$0000,$0000,$0000
dw $0000,$202a,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000,$0000
dw $8022
dw $0000
dw $0000,$0000
dw $2036,$0000,$0000,$0000,$0000,$0000
dw $8037,$8026,$8035,$0000,$0000,$0000
dw $8036,$8038,$0000,$4038,$0000,$0000
dw $4037,$1037
dw $0000,$0000
dw $204a,$0000,$0000
dw $0000
dw $0000,$0000,$804d,$0000
dw $0000,$404e
dw $0000
dw $0000
dw $0000
dw $0000,$0000,$2053
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$8059,$0000
dw $0000,$0000,$803a,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $203d,$0000
dw $0000,$403e
dw $0000 ; this is the odd extra room - shouldn't be used
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$2043
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$4058,$0000,$0000,$0000
dw $0000,$2057,$4068,$0000,$0000,$0000
dw $2049,$0000,$0000,$0000
dw $0000
dw $806b,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $805f,$0000,$0000,$0000
dw $805e
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$2058
dw $0000
dw $805b,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$207c,$0000
dw $0000,$407d,$407b,$0000
dw $0000,$407c,$0000
dw $808e,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $807e
dw $0000
dw $0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$20a9,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $40b1,$0000
dw $80b2,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000,$80b8,$0000,$0000,$0000
dw $0000,$0000,$4099,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$80a1,$0000,$0000
dw $80a2,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$80c6,$0000,$0000
dw $0000
dw $20a8,$0000
dw $80ba,$0000,$0000,$0000
dw $80b9,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$80cc,$0000,$40cc,$0000,$0000,$0000,$0000
dw $0000,$80bf,$0000
dw $40be
dw $0000,$0000,$0000
dw $0000,$40c2,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c3,$40c1,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c2,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c5
dw $80c4,$0000,$0000
dw $20b6,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000,$0000
dw $20cc
dw $40bc,$10bc,$80cb
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $ffff ; indicates the end - we can drop this
; Edge Transition Table (Target Room, Flags, MultiDiv ratio for edges)
org $A7C500 ;ends around 27C5F(9) 4 bytes would be 27C649
;I kind of want to split the 3rd byte into two
NorthOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
SouthOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
WestOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
EastOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
; Edge Info Table (Midpoint, Width, Min Coord)
; I kind of want to add a fourth byte to help indicate quadrant info on min coord
NorthEdgeInfo:
db $a8,$10,$a0, $2c,$08,$28 ;HC
db $b8,$20,$a8 ; DP West Wing
db $38,$20,$28, $f8,$a0,$a8, $b8,$20,$a8 ; DP Main
db $78,$20,$68 ; DP East Wing
db $f8,$10,$f0, $7c,$18,$70 ; TT Lobby
db $74,$18,$68, $f8,$10,$f0 ; TT Compass
SouthEdgeInfo:
db $a8,$10,$a0, $2c,$08,$28 ; HC
db $b8,$20,$a8 ; DP Sandworm
db $38,$20,$28, $f8,$a0,$a8, $b8,$20,$a8 ; DP North Hall & Dead End
db $78,$20,$68 ; DP Arrow Pot
db $f8,$10,$f0, $7c,$18,$70 ; TT Ambush
db $74,$18,$68, $f8,$10,$f0 ; TT BK Corner
WestEdgeInfo:
db $78,$30,$60 ; TT Attic
db $40,$20,$30 ; DP North Hall
db $40,$20,$30 ; DP Arrow Pot
db $84,$18,$78, $68,$10,$60 ; HC South
db $a0,$a0,$50 ; DP East Wing
db $58,$50,$30, $98,$50,$70 ; TT BK Corner
db $58,$50,$30 ; TT Compass
EastEdgeInfo:
db $78,$30,$60 ; TT Attic
db $40,$20,$30 ; DP Sandworm
db $40,$20,$30 ; DP North Hall
db $68,$10,$60, $84,$18,$78 ; HC Guards
db $a0,$a0,$50 ; DP Main Lobby
db $58,$50,$30, $98,$50,$70 ; TT Ambush
db $58,$50,$30 ; TT Nook
MultDivInfo: ; (1, 2, 3, 4, 5, 6, 10, 20)
db $01, $02, $03, $04, $05, $06, $0a, $14
; indices: 0-7
; In-room stairs in North/South pairs. From left to right:
; PoD, IP right side, IP Freezor chest and GT
org $A7C700
InroomStairsTable:
dw $0003,$0003, $0003,$0003, $0003,$0003, $0003,$0003
org $A7C720
InroomStairsRoom:
db $0B,$1B, $3F,$1F, $7E,$5E, $96,$3D
InroomStairsX:
dw $0190, $0160, $0040, $0178
InroomStairsY:
dw $0058, $0148, $0198, $0190
org $A7E000
CutoffRooms:
; TT Alcove, Mire Bridge Left & Right, Mire Bent Bridge, Mire Hub
; Pod Falling & Harmless, SW Star Pits, TR Lava Escape & TR Dual Pipes, Bob's Room & GT Big Chest
dw $00bc, $00a2, $00a3, $00c2, $001a, $0049, $0014, $008c
; Ice Many Pots, Swamp Waterfall, GT Gauntlet 3, Eastern Push Block, Eastern Courtyard, Eastern Map Valley
; Eastern Cannonball, HC East Hall
dw $009f, $0066, $005d, $00a8, $00a9, $00aa, $00b9, $0052
; HC West Hall, TR Dash Bridge, TR Hub, Pod Arena, GT Petting Zoo, Ice Spike Cross
dw $0050, $00c5, $00c6, $0009, $0003, $002a, $007d, $005e
; Sewer Drop, Mire Cross, GT Crystal Circles
dw $0011, $00b2, $003d
dw $ffff
; dungeon tables
; HC HC EP DP AT SP PD MM SW IP TH TT TR GT
org $A7f000
CompassBossIndicator:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f020
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08, $00, $00
ChestKeys: ;27f030
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
BigKeyStatus: ;27f040 (status 2 indicate BnC guard)
dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0000, $0000
DungeonReminderTable: ;27f060
dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C, $0000, $0000
TotalLocationsLow: ;27f080
db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07, $00, $00
TotalLocationsHigh: ;27f090
db $00, $00, $00, $00, $00, $01, $01, $00, $00, $00, $00, $00, $01, $02, $00, $00
org $A7f0a0
TotalLocations:
db $08, $08, $06, $06, $02, $0a, $0e, $08, $08, $08, $06, $08, $0c, $1b, $00, $00
; no more room here
; Vert 0,6,0 Horz 2,0,8
org $A7f0b0
CoordIndex: ; Horizontal 1st
db 2, 0 ; Coordinate Index $20-$23
OppCoordIndex:
db 0, 2 ; Swapped coordinate Index $20-$23 (minor optimization)
CameraIndex: ; Horizontal 1st
db 0, 6 ; Camera Index $e2-$ea
CamQuadIndex: ; Horizontal 1st
db 8, 0 ; Camera quadrants $600-$60f
ShiftQuadIndex:
db 2, 1 ; see ShiftQuad func (relates to $a9,$aa)
CamBoundIndex: ; Horizontal 1st
db 0, 4 ; Camera Bounds $0618-$61f
OppCamBoundIndex: ; Horizontal 1st
db 4, 0 ; Camera Bounds $0618-$61f
CamBoundBaseLine: ; X camera stuff is 1st column todo Y camera needs more testing
dw $007f, $0077 ; Left/Top camera bounds when at edge or layout frozen
dw $0007, $000b ; Left/Top camera bounds when not frozen + appropriate low byte $22/$20 (preadj. by #$78/#$6c)
dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte $20/$22
dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen
;27f0ce next free byte
org $A7f0f0
RemoveRainDoorsRoom:
dw $0060, $0062, $ffff ; ffff indicates end of list
RainDoorMatch: ; org $A7f0f6 and f8 for now
dw $0081, $0061 ; not xba'd
BlockSanctuaryDoorInRain: ;27f0fa
dw $0000
org $A7f100
TilesetTable:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff
db $13,$04,$04,$0d,$0d,$0d,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$0d,$0d,$ff,$08,$05,$08,$09,$07,$07,$06,$ff,$0b,$06
db $04,$05,$04,$12,$08,$08,$08,$08,$08,$09,$07,$07,$06,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$ff,$ff,$09,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$08,$01,$09,$09,$09,$09,$07,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$09,$09,$ff,$07,$0e,$0e,$0e,$0b,$ff
db $04,$04,$04,$12,$12,$12,$08,$05,$ff,$ff,$ff,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$12,$12,$ff,$05,$ff,$05,$ff,$0e,$0e,$0e,$0b,$ff
db $0c,$0c,$0c,$0c,$ff,$0e,$0e,$0c,$0c,$05,$ff,$0e,$0e,$0e,$0b,$0b
db $0c,$0c,$0c,$0c,$0d,$0e,$0e,$05,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$ff,$0a,$0a,$ff,$0b,$ff
db $04,$0c,$0c,$ff,$ff,$0d,$0d,$ff,$05,$05,$05,$0a,$0a,$ff,$0b,$06
db $04,$06,$06,$06,$06,$06,$06,$06,$06,$ff,$06,$06,$ff,$06,$06,$06
db $06,$06,$03,$03,$03,$03,$ff,$ff,$06,$06,$06,$06,$ff,$06,$06,$06
;27f200
PaletteTable:
db $21,$00,$00,$07,$00,$08,$00,$00,$07,$00,$00,$00,$00,$00,$00,$21
db $21,$00,$00,$00,$00,$00,$00,$00,$07,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$0e,$00,$00,$07,$00,$00,$07
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$07,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$13
db $00,$00,$00,$00,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$00,$00,$00,$00,$00,$00,$06,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$14,$20
db $00,$07,$20,$20,$07,$07,$07,$07,$07,$20,$20,$07,$20,$20,$20,$20
db $07,$07,$02,$02,$02,$02,$07,$07,$07,$20,$20,$07,$20,$20,$20,$07
;A7f300
DungeonTilesets:
db $04,$04,$05,$12,$04,$08,$07,$0C,$09,$0B,$05,$0A,$0D,$0E,$06,$06
;
;org $A7ff00
org $A7fff0
LinksHouseDarkWorld:
dw $ffff
SanctuaryDarkWorld:
dw $ffff
OldManDarkWorld:
dw $ffff
OldManRetrievalWorld:
dw $0000

View File

@@ -1,22 +0,0 @@
CheckDarkWorldSpawn:
PHP
STA $A0 : STA $048E ; what we wrote over
JSL SetDefaultWorld
LDA.l LinksHouseDarkWorld : CMP.b $A0 : BEQ ++
LDA.l SanctuaryDarkWorld : CMP.b $A0 : BEQ ++
LDA.l OldManDarkWorld : CMP.b $A0 : BNE +
++ SEP #$20 : LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld
LDA.l DRFlags+1 : AND #$02 : BEQ + ; skip if the flag isn't set
LDA.l MoonPearlEquipment : BNE + ; moon pearl?
LDA #$17 : STA $5D : INC $02E0
+ PLP : RTL
SetDefaultWorld:
PHP : SEP #$20
LDA.l FollowerIndicator : CMP #$04 : BNE .default
LDA.l OldManRetrievalWorld : BRA +
.default
LDA.l InvertedMode : BEQ +
LDA.b #$40
+ STA CurrentWorld
PLP : RTL

View File

@@ -1,228 +0,0 @@
org $82b5c4 ; -- moving right routine 135c4
jsl WarpRight
org $82b665 ; -- moving left routine
jsl WarpLeft
org $82b713 ; -- moving down routine
jsl WarpDown
org $82b7b4 ; -- moving up routine
jsl WarpUp
org $82bd80
jsl AdjustTransition
nop
;turn off linking doors -- see .notRoomLinkDoor label in Bank02.asm
org $82b5a8 ; <- 135a8 - Bank02.asm : 8368 (LDA $7EC004 : STA $A0)
jsl CheckLinkDoorR
bcc NotLinkDoor1
org $82b5b6
NotLinkDoor1:
org $82b649 ; <- 135a8 - Bank02.asm : 8482 (LDA $7EC004 : STA $A0)
jsl CheckLinkDoorL
bcc NotLinkDoor2
org $82b657
NotLinkDoor2:
; Staircase routine
org $81c3d4 ; <- c3d4 - Bank01.asm : 9762-4 (Dungeon_DetectStaircase-> STA $A0 : LDA $063D, X)
jsl RecordStairType : nop
org $82a1e7 ;(PC: 121e7)
jsl SpiralWarp
org $8291b3 ; <- Bank02.asm : 3303 (LDA $0462 : AND.b #$04)
jsl SpiralPriorityHack : nop
org $8290f9 ; <- Bank02.asm : 3188 (LDA $0462 : AND.b #$04)
jsl SpiralPriorityHack : nop
org $829369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E)
jsl StraightStairsAdj : nop #2
org $829383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20)
jsl StraightStairsFix : nop
org $8293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20)
jsl StraightStairsFix : nop
org $8293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA)
jsl StraightStairsFix : nop
org $829396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X)
jsl StraightStairLayerFix
org $82c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02)
jsl DoorToStraight : nop
org $82c092 ; STA $0020, Y : LDX #$00
jsl DoorToInroom : nop
org $82c0f8 ; CMP $02C034, X
jsl DoorToInroomEnd
org $82941a ; <- Bank02.asm : 3748 module 7.12.11 (LDA $0464 : BNE BRANCH_$11513 : INC $B0 : RTS)
jsl StraightStairsTrapDoor : rts
org $828b54 ; <- Bank02.asm : 2200 (JSL UseImplicitRegIndexedLocalJumpTable)
jsl InroomStairsTrapDoor
org $82c146
jsl HandleSpecialDoorLanding
org $8289a0 ; JSL $0091C4
jsl QuadrantLoadOrderBeforeScroll
org $82bd9c ; JSL $0091C4
jsl QuadrantLoadOrderAfterScroll
; Graphics fix
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer:
jsl GfxFixer
lda $b1 : beq .done
rts
nop #5
.done
org $81b618 ; Bank01.asm : 7963 Dungeon_LoadHeader (REP #$20 : INY : LDA [$0D], Y)
nop : jsl OverridePaletteHeader
org $82817e ; Bank02.asm : 414 (LDA $02811E, X)
jsl FixAnimatedTiles
org $8aef43 ; UnderworldMap_RecoverGFX
jsl FixCloseDungeonMap
org $828a06 ; Bank02.asm : 1941 Dungeon_ResetTorchBackgroundAndPlayer
JSL FixWallmasterLamp
org $80d377 ;Bank 00 line 3185
DecompDungAnimatedTiles:
org $80fda4 ;Bank 00 line 8882
Dungeon_InitStarTileCh:
org $80d6ae ;(PC: 56ae)
LoadTransAuxGfx:
org $80d739 ;
LoadTransAuxGfx_Alt:
org $80df5a ;(PC: 5f5a)
PrepTransAuxGfx:
org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr:
org $81feb0
Dungeon_ApproachFixedColor:
;org $01fec1
;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version
;LoadRoomHook:
org $9bee74 ;(PC: 0dee74)
Palette_DungBgMain:
org $9bec77
Palette_SpriteAux3:
org $9becc5
Palette_SpriteAux2:
org $9bece4
Palette_SpriteAux1:
org $828046 ; <- 10046 - Bank02.asm : 217 (JSL EnableForceBlank) (Start of Module_LoadFile)
jsl OnFileLoadOverride
org $87A93F ; < 3A93F - Bank07.asm 6548 (LDA $8A : AND.b #$40 - Mirror checks)
jsl MirrorCheckOverride
org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower)
jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz $0dd0, X : rts
.not_in_ganons_tower
org $87a955 ; <- Bank07.asm : around 6564 (JP is a bit different) (STZ $05FC : STZ $05FD)
jsl BlockEraseFix
nop #2
org $82A0A8
Mirror_SaveRoomData:
org $87A95B ; < bank_07.asm ; #_07A95B: JSL Mirror_SaveRoomData
jsl EGFixOnMirror
org $82b82a
jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties)
jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
jsl GuruguruFix : bra .next
nop #3
.next
org $828fc9
nop #2 : jsl BlindAtticFix
org $828409
jsl SuctionOverworldFix
org $8ded04 ; <- rando's hooks.asm line 2192 - 6ED04 - equipment.asm : 1963 (REP #$30)
jsl DrHudDungeonItemsAdditions
;org $098638 ; rando's hooks.asm line 2192
;jsl CountChestKeys
org $86D192 ; rando's hooks.asm line 457
jsl CountAbsorbedKeys
; rando's hooks.asm line 1020
;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
;jsl CountBonkItem
org $819dbd ; <- Bank01.asm : 4465 of Object_Draw8xN (LDA $9B52, Y : STA $7E2000, X)
jsl CutoffEntranceRug : bra .nextTile : nop
.nextTile
;maybe set 02e2 to 0
org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState
;
org $88c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : NOP
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP
org $9edabf ; <- sprite_energy_ball.asm : 86-7 Sprite_EnergyBall (LDA.b #$10 : LDX.b #$00)
JSL StandardAgaDmg
org $89F7B2 ; 09F7B2 Module17_01 S&Q
JSL StandardSaveAndQuit
org $89a681 ; < - similar to talalong.asm : 1157 (JSL Main_ShowTextMessage)
JSL BlindsAtticHint : NOP #2
org $9cfd69
Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$FF
BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : +
org $82FD00 ; unreachable code
Underworld_SetBossOrSancMusicUponEntry_long:
JSR Underworld_SetBossOrSancMusicUponEntry : RTL
org $81AA90
JSL BigKeyDoorCheck : NOP
org $81AAA2
RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door:
;Enable south facing bk graphic
org $80CE24
dw $2ac8
org $81b714 ; PC: b714
OpenableDoors:
jsl CheckIfDoorsOpen
bcs .normal
rts
.normal
org $82C157
JSL AlwaysPushThroughFDoors
; Modified from OWR - will need to remove once merged
; org $85AF75
; Sprite_6C_MirrorPortal:
; JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $05AFDF
; org $85AFDF
; Sprite_6C_MirrorPortal_missing_mirror:
org $80E766
JML ConditionalLoadCommonSprites_Do3To4Low : NOP #2
LoadCommonSprites_Prep3To4Low:

View File

@@ -1,305 +0,0 @@
; defines
; Ram usage
HorzEdge:
cpy #$ff : beq +
jsr DetectWestEdge : ldy #$02 : bra ++
+ jsr DetectEastEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadWestData : bra .main
++ jsr LoadEastData
.main
jsr LoadEdgeRoomHorz
sec : rts
+ clc : rts
VertEdge:
cpy #$ff : beq +
jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadNorthData : bra .main
++ jsr LoadSouthData
.main
jsr LoadEdgeRoomVert
sec : rts
+ clc : rts
LoadEdgeRoomHorz:
lda $03 : sta $a0
sty $06
and.b #$0f : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
jsr PrepScrollToNormal
bra .scroll
.edge
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
jsr MathHorz
.scroll
jsr ScrollY
rts
LoadEdgeRoomVert:
lda $03 : sta $a0
sty $06
and.b #$f0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
and #$03 : cmp #$03 : beq .inroom
ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
bra .scroll
.inroom
jsr ScrollToInroomStairs
rts
.edge
ldy #$01 : jsr ShiftVariablesMainDir
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
jsr MathVert
lda $03
.scroll
jsr ScrollX
rts
MathHorz:
jsr MathStart : lda $20
jsr MathMid : and #$0040
jsr MathEnd
rts
MathVert:
jsr MathStart : lda $22
jsr MathMid : and #$0020
jsr MathEnd
rts
MathStart:
rep #$30
lda $08 : and #$00ff : sta $00
rts
MathMid:
and #$01ff : !sub $00 : and #$00ff : sta $00
; nothing should be bigger than $a0 at this point
lda $05 : and #$00f0 : lsr #4 : tax
lda MultDivInfo, x : and #$00ff : tay
lda $00 : jsr MultiplyByY : sta $02
lda $07 : and #$00ff : jsr MultiplyByY : tax
lda $05 : and #$000f : tay
lda MultDivInfo, y : and #$00ff : tay
lda $02 : jsr DivideByY : sta $00
lda $0c : and #$00ff : sta $02
lda $04
rts
MathEnd:
beq +
lda #$0100
+ !add $02 : !add $00
sta $04
sep #$30
rts
; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator)
; don't need width of edge Link is going to (currently in $0b)
LoadNorthData:
lda NorthOpenEdge, x : sta $03 : inx ; target room
lda NorthEdgeInfo, x : sta $07 ; needed for maths - (divide by 2 anyway)
lda NorthOpenEdge, x : sta $04 : inx ; bit field
lda NorthEdgeInfo, x : sta $08 ; needed for maths
lda NorthOpenEdge, x : sta $05 ; ratio
lda $04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition
lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed todo: remove
lda SouthEdgeInfo, x : sta $0c ; needed for maths
rts
LoadSouthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda SouthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadSouthData:
lda SouthOpenEdge, x : sta $03 : inx
lda SouthEdgeInfo, x : sta $07
lda SouthOpenEdge, x : sta $04 : inx
lda SouthEdgeInfo, x : sta $08
lda SouthOpenEdge, x : sta $05
lda $04 : jsr LoadNorthMidpoint : inx
lda NorthEdgeInfo, x : sta $0b : inx
lda NorthEdgeInfo, x : sta $0c
rts
LoadNorthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda NorthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadWestData:
lda WestOpenEdge, x : sta $03 : inx
lda WestEdgeInfo, x : sta $07
lda WestOpenEdge, x : sta $04 : inx
lda WestEdgeInfo, x : sta $08
lda WestOpenEdge, x : sta $05
lda $04 : jsr LoadEastMidpoint : inx
lda EastEdgeInfo, x : sta $0b : inx
lda EastEdgeInfo, x : sta $0c
rts
LoadEastMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda EastEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadEastData:
lda EastOpenEdge, x : sta $03 : inx
lda EastEdgeInfo, x : sta $07
lda EastOpenEdge, x : sta $04 : inx
lda EastEdgeInfo, x : sta $08
lda EastOpenEdge, x : sta $05
lda $04 : jsr LoadWestMidpoint : inx
lda WestEdgeInfo, x : sta $0b : inx
lda WestEdgeInfo, x : sta $0c
LoadWestMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda WestEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
DetectNorthEdge:
ldx #$ff
lda $a2
cmp #$82 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$83 : bne +
ldx #$02 : bra .end
+ cmp #$84 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$06 : bra .end
+ cmp #$db : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectSouthEdge:
ldx #$ff
lda $a2
cmp #$72 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$02 : bra .end
+ cmp #$74 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$75 : bne +
ldx #$06 : bra .end
+ cmp #$cb : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$cc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectWestEdge:
ldx #$ff
lda $a2
cmp #$65 : bne +
ldx #$00 : bra .end
+ cmp #$74 : bne +
ldx #$01 : bra .end
+ cmp #$75 : bne +
ldx #$02 : bra .end
+ cmp #$82 : bne +
lda $aa : beq ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$05 : bra .end
+ cmp #$cc : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
ldx #$08
.end txa : rts
DetectEastEdge:
ldx #$ff
lda $a2
cmp #$64 : bne +
ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$01 : bra .end
+ cmp #$74 : bne +
ldx #$02 : bra .end
+ cmp #$81 : bne +
lda $aa : beq ++
ldx #$04 : bra .end
++ ldx #$03 : bra .end
+ cmp #$84 : bne +
ldx #$05 : bra .end
+ cmp #$cb : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$db : bne .end
ldx #$08
.end txa : rts
AlwaysPushThroughFDoors:
PHA : AND.b #$F0 : CMP.b #$F0 : BNE +
PLA : RTL
+ PLA : AND.b #$8E : CMP.b #$80
RTL

View File

@@ -1,300 +0,0 @@
;===================================================================================================
; The only specific concern to keep in mind with this code is that your databank will be $00
; Actually, it should be $80, if you're using my fastrom changes.
;
; Leave all your door data vanilla
; Do not try to adjust doors as I previously suggested (not worth the effort)
; We need a few hooks and some light hardcoding either way
; Might as well just do it in a brute, but reliable, way
;
; In brief, this is the hack we're making:
; 1) Let vanilla routines draw the door normally
; 2) Draw over what vanilla just drew
; 3) Hijack the door tile type routine
; and replace the vanilla value with that of solid collision
; For door dection free RAM at $19EE-$19FF has been co-opted to door each drawn doors position and type bytes
; 19EE is for the "current" door for the IdentifyBlockedEntrance routine
; The array at 19F0 is for the collision routine to retrieve that information as it is no longer
; available by that point
;===================================================================================================
pushpc
org $01B0E6
JSL StoreDoorInfo
org $01892F
DoorDrawJankMove:
JML PrepDoorDraw
.return
JSL AdjustEscapeDoorGraphics
RTS
; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to
warnpc $018939
org $01BF43
JSL AdjustEscapeDoorCollision
org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00
JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2
pullpc
;===================================================================================================
StoreDoorInfo:
STA.w $1980,X
LDA.b $00 : STA.w $19F0,X
TXA
RTL
PrepDoorDraw:
; first off, we need this routine to return to our jank hook
; otherwise, finding a reliable place to put the graphics change check will be a pin
; so push the address to return to the routine
; It's a lot to explain why this is necessary
; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1
LDA.b $00
STA.w $19EE ; for current routine
; copy vanilla code (but fast rom)
LDA.l $8186F0,X
STA.b $0E
LDX.b $02
LDA.b $04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML.l $818939
;===================================================================================================
; Adjustment stage 1: graphics
AdjustEscapeDoorGraphics:
JSR IdentifyBlockedEntrance
BCS .replace_graphics
JSR IdentifySancEntrance
BCS .fix_sanctuary_entrance
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance
; Do nothing
RTL
;---------------------------------------------------------------------------------------------------
.replace_graphics ; for blocked doors
; using the value in $19A0 should be fine for finding the graphics
; the only caveat is that this appears to locate the tile just above the north-west corner
; so below, I've indicated that offset with a +$xxx after the base tilemap buffer
; The only odd thing I notice with this position is that some bad hardcoded adjust for
; exploding walls that shouldn't affect how we use this value at all!
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; hardcoded shutter door graphics tile replacement
; the horizontal flips could easily be explicit LDAs
; but it's probably best the door is symmetrical
; using ORA makes your intent more clear
; and gives you fewer values to change if you experiment with other graphics
; row 1
LDA.w #$8838
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
; row 2
LDA.w #$8828
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
LDA.w #$8829
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate
; the state of the A, X, and Y registers is irrelevant when we exit
; they're all subsequently loaded with new values
RTL
.fix_sanctuary_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; row 0
LDA.w #$14C4
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$006,X
LDA.w #$14C5
STA.l $7E2000+$002,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$004,X
; row 1
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 2
LDA.w #$14F8
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
RTL
.fix_swamp_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; row 1 - outer section
LDA.w #$0908
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
; row 2
LDA.w #$0918
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
LDA.w #$14F8
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
.fix_swamp_entrance_alternate
; row 0
LDA.w #$9DFC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
; row 1 - mid section
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 3
LDA.w #$A82C
STA.l $7E2000+$180,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$186,X
LDA.w #$A82D
STA.l $7E2000+$182,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$184,X
RTL
IdentifySancEntrance:
LDA.b $A0 : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
IdentifySwampEntrance:
LDA.b $A0 : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
;===================================================================================================
; Leaving this here in case you desire a fully custom door later
; For now, we'll just hardcode the tiles, as I did above
; I put these in column order because that's how they're expected for the vanilla draw routines
; but I changed my mind on redefining things
; and am too lazy to change it to a row-wise listing
BlockedEntrance:
dw $8838, $8828, $A888 ; column 0
dw $14E8, $8829, $C888 ; column 1
dw $14E8, $8829, $A888 ; column 2
dw $C838, $C828, $C888 ; column 3
;===================================================================================================
; Adjustment stage 2: collision
AdjustEscapeDoorCollision:
LSR ; vanilla shift
AdjustEscapeDoorCollisionShared:
; save our parameters
; but one or both of these may not be necessary depending on how you detect these doors
; all that matters is that after identifying blockage, we have:
; Y is the same as what we entered with
; X has A>>1, for whatever A entered with
PHA
LDA.w $19F0, Y ; grab door info (type, position)
STA.w $19EE ; store in temporary variable
JSR IdentifyBlockedEntrance
PLX ; this is a TAX in vanilla, just have X pull A instead
BCS .block_entrance
; vanilla value
LDA.b $00
RTL
.block_entrance
LDA.w #$0101 ; load tile type for solid collision
RTL
AdjustEscapeDoorCollision_LowEntrance:
ADC.w #$0040 ; vanilla add
JMP AdjustEscapeDoorCollisionShared
;===================================================================================================
; Enter with:
; $19EE containing the door information: position and type bytes
; Exit with:
; carry clear - leave door alone
; carry set - block door
IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1)
LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b $A0 : CMP.w #$0012 : BNE +
; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently
; but that's enforced in the logic, so this is to catch that case in case some mode allows it
LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b $0A
CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone
.block_door
SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX #$FFFE
- INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE -
LDA.l RainDoorMatch, X
CMP.w $19EE : BNE .leave_alone
BRA .block_door
.continue
BRA -
.leave_alone
CLC : RTS
;===================================================================================================

View File

@@ -1,104 +0,0 @@
GfxFixer:
{
lda.l DRMode : bne +
jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt
inc $b0
rtl
+ lda $b1 : bne .stage2
jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
lda #$09 : sta $17 : sta $0710
jsl Palette_SpriteAux3
jsl Palette_SpriteAux2
jsl Palette_SpriteAux1
jsl Palette_DungBgMain
jsr CgramAuxToMain
inc $b1
rtl
.stage2
lda #$0a : sta $17 : sta $0710
stz $b1 : inc $b0
rtl
}
FixAnimatedTiles:
LDA.L DRMode : CMP #$02 : BNE +
LDA $040C : CMP.b #$FF : BEQ +
PHX
LDX $A0 : LDA.l TilesetTable, x
CMP $0AA1 : beq ++
TAX : PLA : BRA +
++
PLX
+ LDA $02802E, X ; what we wrote over
RTL
FixCloseDungeonMap:
LDA.l DRMode : CMP #$02 : BNE .vanilla
LDA $040C : BMI .vanilla
LSR : TAX
LDA.l DungeonTilesets,x
RTL
.vanilla
LDA $7EC20E
RTL
FixWallmasterLamp:
ORA $0458
STY $1C : STA $1D : RTL ; what we wrote over
CgramAuxToMain: ; ripped this from bank02 because it ended with rts
{
rep #$20
ldx.b #$00
.loop
lda $7EC300, X : sta $7EC500, x
lda $7EC340, x : sta $7EC540, x
lda $7EC380, x : sta $7EC580, x
lda $7EC3C0, x : sta $7EC5C0, x
lda $7EC400, x : sta $7EC600, x
lda $7EC440, x : sta $7EC640, x
lda $7EC480, x : sta $7EC680, x
lda $7EC4C0, x : sta $7EC6C0, x
inx #2 : cpx.b #$40 : bne .loop
sep #$20
; tell NMI to upload new CGRAM data
inc $15
rts
}
OverridePaletteHeader:
lda.l DRMode : cmp #$02 : bne +
lda.l DRFlags : and #$20 : bne +
cpx #$01c2 : !bge +
rep #$20
txa : lsr : tax
lda.l PaletteTable, x
iny : rtl
+ rep #$20 : iny : lda [$0D], Y ; what we wrote over
rtl
Sprite_ConditionalPrepOAMCoord:
LDA.w $0E20,X : CMP.b #$62 : BNE .notMasterSword
LDA.w $0D90,X : BNE .specialCutscene
.notMasterSword
JML Sprite_PrepOAMCoordLong ; what we wrote over
.specialCutscene
SEC ; this prevents MasterSword sprite from drawing if it is a special cutscene
RTL

View File

@@ -1,299 +0,0 @@
DrHudOverride:
{
jsl.l NewDrawHud
jsr HudAdditions
rtl
}
HudAdditions:
{
SEP #$10
LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : +
LDA.l TotalItemCounter : PHA : CMP #1000 : !BLT +
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS ; draw 1000's digit
BRA .skip
+ JSL HexToDec_fast
.skip
LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4
LDA.b 1,S : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
+ PLA : CMP.w #10 : !BLT +
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
+ LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l DRFlags : AND #$0100 : BNE +
LDA.l MultiClientFlagsWRAM+1 : CMP #1000 : !BLT .three_digit_goal
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 1000's digit
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+16 ; draw 1's digit
BRA .end_item_count
.three_digit_goal
JSL HexToDec_fast
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .end_item_count
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12
STA !GOAL_DRAW_ADDRESS+14 : STA !GOAL_DRAW_ADDRESS+16
.end_item_count
LDX $1B : BNE + ; if outdoors
lda.l OWMode : and.w #((!FLAG_OW_CROSSED+!FLAG_OW_MIXED)<<8)+$ff : bne ++ : rts ; Skip if vanilla ow rando
++ lda CurrentHealth : and #$00ff : beq ++
lda CurrentWorld : and #$00ff : beq +++
lda #$2d60 : bra .owdisplay
+++ lda #$2d68 : bra .owdisplay
++ lda #$207f
.owdisplay sta $7ec702 : rts
+ ldx $040c : cpx #$ff : bne + : rts : + ; Skip if not in dungeon
lda.l DRMode : bne + : rts : + ; Skip if not door rando
phb : phk : plb
lda CompassField : and.l $0098c0, x : beq +
lda.w CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
lda $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790
.next lda.w DRMode : and #$0002 : bne + : plb : rts : +
lda CurrentHealth : and #$00ff : beq +
lda.w DungeonReminderTable, x : bra .reminder
+ lda #$207f
.reminder sta $7ec702
+ lda.w DRFlags : and #$0004 : beq .restore
; lda MapField : and.l $0098c0, x : beq .restore
txa : lsr : tax
lda.l GenericKeys : and #$00ff : bne +
lda DungeonCollectedKeys, x : jsr ConvertToDisplay : sta $7ec7a2
lda #$2830 : sta $7ec7a4
+
lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
; todo 4b0 no longer in use
.restore
plb : rts
}
;column distance for BK/Smalls
HudOffsets:
; none hc east desert aga swamp pod mire skull ice hera tt tr gt
dw $fffe, $0000, $0006, $0008, $0002, $0010, $000e, $0018, $0012, $0016, $000a, $0014, $001a, $001e
; offset from 1644
RowOffsets:
dw $0000, $0000, $0040, $0080, $0000, $0080, $0040, $0080, $00c0, $0040, $00c0, $0000, $00c0, $0000
ColumnOffsets:
dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000, $0014, $0014, $001e
DrHudDungeonItemsAdditions:
{
jsl DrawHUDDungeonItems
lda.l HUDDungeonItems : and #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : +
phx : phy : php
rep #$30
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4
ldx #$0000
- sta $1704, x : sta $170e, x : sta $1718, x
inx #2 : cpx #$0008 : !blt -
lda HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624
; sm symbols
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4
; blank out stuff
lda.w #$24f5 : sta $1724
ldx #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2
lda.w #$24f5 : sta $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey
lda.w #$2826 : sta $1644, y
.smallKey
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ stx $00
txa : lsr : tax
lda.w #$24f5 : sta $1644, y
lda.l GenericKeys : and #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y
phx : ldx $00
; lda MapField : and.l $0098c0, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02
lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02
+++ lda $02
rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals
bra .skipStack
+ plx
.skipStack iny #2
cpx #$000d : beq +
lda.w #$24f5 : sta $1644, y
+
ldx $00
+ inx #2 : cpx #$001b : bcs ++ : JMP -
++
lda HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624
; blank out a couple thing from old hud
lda.w #$24f5 : sta $16e4 : sta $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators
ldx #$0002
- lda #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y
iny #2
lda.w #$24f5 : sta $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass
phx ; total chest counts
txa : lsr : tax
sep #$30
lda.l TotalLocations, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy
rep #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx
bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y
.skipBlanks iny #2
cpx #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP -
++
plp : ply : plx : rtl
}
MapIndicatorLong:
PHX
LDA.l OldHudToNewHudTable, X : TAX
JSR MapIndicator
PLX
RTL
MapIndicatorShort:
PHX
TXA : LSR : TAX
JSR MapIndicator
PLX
RTS
OldHudToNewHudTable:
dw 1, 2, 3, 10, 4, 6, 5, 8, 11, 9, 7, 12, 13
IndicatorCharacters:
; check 1 2 3 4 5 6 7 G B R
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND #$00FF
PHX
ASL : TAX : LDA.l IndicatorCharacters, X
PLX
RTS
BkStatus:
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++
lda #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne +
lda #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark
ConvertToDisplay:
and.w #$00ff : cmp #$000a : !blt +
!add #$2553 : rts
+ !add #$2490 : rts
ConvertToDisplay2:
and.w #$00ff : beq ++
cmp #$000a : !blt +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:
jsl IncrementSmallKeysNoPrimary : phx
lda $040c : cmp #$ff : beq +
lsr : tax
lda DungeonAbsorbedKeys, x : inc : sta DungeonAbsorbedKeys, x
+ plx : rtl
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4DigitCopy:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2DigitCopy: ; modified
PHY
LDY.b #$00
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
PLY
RTS

View File

@@ -1,42 +0,0 @@
; code to un-pair or re-pair doors
; doorlist is loaded into 19A0 but no terminator
; new room is in A0
; for "each" door do the following: (each could mean the first four doors?)
; in lookup table, grab room and corresponding position
; find the info at 7ef000, x where x is twice the paired room
; check the corresponding bit (there are only 4)
; set the bit in 068C
; Note the carry bit is used to indicate if we should aborted (set) or not
CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now
lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior
.gtg
phb : phk : plb
stx $00 : ldy #$0000
.nextDoor
lda $a0 : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax
lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c
.skipDoor
iny #2 : cpy $00 : bne .nextDoor
plb : clc : rtl
}
; outstanding issues
; how to indicate opening for other (non-first four doors?)
; Bank01 Door Register stores the 4 bits in 068c to 400 (depending on type)
; Key collision and others depend on F0-F3 attribute not sure if extendable to other numbers
; Dungeon_ProcessTorchAndDoorInteractives.isOpenableDoor is the likely culprit for collision problems
; Saving open status to other unused rooms is tricky -- Bank 2 13947 (line 8888)

View File

@@ -1,66 +0,0 @@
;divide by 2 example
; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10--Offset Ruler
;v 00 01 01 02 02 03 03 04 04 04 05 05 06 06 07 07 08
;divide by 3 example
; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18
;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08
MultiplyByY:
.loop cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr MultiBy3 : bra .done
++ cpy #$0005 : bne ++
jsr MultiBy5 : bra .done
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop
.done rts
;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY:
.loop
cpy #$0000 : beq .done
cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr DivideBy3 : bra .done
++ cpy #$0005 : bne ++
jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta $00
tya : lsr : tay
txa : lsr : tax
lda $00 : bra .loop
.done rts
MultiBy3:
sta $00 : asl : !add $00
rts
MultiBy5:
sta $00 : asl #2 : !add $00
rts
;width of divison in x: rounds toward X/2
DivideBy2:
sta $00
lsr : bcc .done
sta $02 : txa : lsr : cmp $00 : !blt +
lda $02 : inc : bra .done
+ lda $02
.done rts
DivideBy3:
sta $00
ldx #$0000
lda #$0002
.loop cmp $00 : !bge .store
inx : !add #$0003 : bra .loop
.store txa
rts
DivideBy5:
sta $00
ldx #$0000
lda #$0003
.loop cmp $00 : !bge .store
inx : !add #$0005 : bra .loop
.store txa
rts

View File

@@ -1,447 +0,0 @@
WarpLeft:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$06 : ldy #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpRight:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$12 : ldy #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpUp:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $22 : ldx $a9
jsr CalcIndex
ldy #$02 ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
rtl
; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there
macro StonewallCheck(Room)
lda $a0 : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora #$80 : sta.l <Room>*2+$7ef000
?end
endmacro
WarpDown:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda $22 : ldx $a9
jsr CalcIndex
!add #$0c : ldy #$ff ; offsets in A, Y
jsr LoadRoomVert
%StonewallCheck($43)
.end
jsr Cleanup
rtl
; carry set = use link door like normal
; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR:
lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
CheckLinkDoorL:
lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
TrapDoorFixer:
lda $fe : and #$0038 : beq .end
xba : asl #2 : sta $00
stz $0468 : lda $068c : ora $00 : sta $068c
.end
stz $fe ; clear our fe here because we don't need it anymore
rts
Cleanup:
lda.l DRFlags : and #$10 : beq +
stz $047a
+ inc $11
lda $ef
rts
; carry set if cave, clear otherwise
CheckIfCave:
REP #$30
LDA.b $A2 : CMP.w #$00E1 : BCS .invalid
SEP #$30 : CLC : RTS
.invalid
SEP #$30 : SEC : RTS
;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down
; This sets A (00,02,04) and stores half that at $04 for later use, (src door)
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor
lda #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done
.largeDoor lda #$02
.done
sta $04
asl
rts
; Y is an adjustment for main direction of travel
; A is a door table row offset
LoadRoomHorz:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : pha
jsr ScrollY
pla : beq .end
ldy #$06 : jsr ApplyScroll
.end
plb ; restore db register
rts
}
; Y is an adjustment for main direction of travel (stored at $06)
; A is a door table row offset (stored a $07)
LoadRoomVert:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr VertEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda $01 : and #$80 : beq .notEdge
ldy #$01 : jsr ShiftVariablesMainDir
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
jsr ScrollToInroomStairs
stz $046d
bra .end
.normal
ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : sta $046d
jsr ScrollX
.end
plb ; restore db register
rts
}
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00
and #$00FF : sta $a0 ; assign new room
sep #$30
rts
}
; INPUTS-- Y: Direction Index , $02: Shift Value
; Sets high bytes of various registers
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update
lda.w CameraIndex,y : tax
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x
lda $0603,x : !add $02 : sta $0603,x
rts
}
; Normal Flags should be in $01
ScrollToInroomStairs:
{
jsr PrepScrollToInroomStairs
ldy #$01 : jsr ShiftVariablesMainDir
jsr ScrollX
ldy #$00 : jsr ApplyScroll
lda $a0 : and #$0f : cmp #$0f : bne +
stz $e0 : stz $e2 ; special case camera fix
lda #$1f : sta $e1 : sta $e3
+
rts
}
; Direction should be in $06, Shift Value (see above) in $02 and other info in $01
; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate
PrepScrollToInroomStairs:
{
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta $04
lda.w InroomStairsX+1,y : sta $05
lda $06 : cmp #$ff : beq .south
lda.w InroomStairsY+1,y : bne +
inc $045f ; flag indicating special screen transition
dec $02 ; shift variables further
stz $aa
lda $a8 : and #%11111101 : sta $a8
stz $0613 ; North scroll target
inc $0603 : inc $0607
dec $0619 : dec $061b
+
lda.w InroomStairsY,y : !add #$20 : sta $20
!sub #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !add #$20 : sta $20
stz $045f
+
dec $21
%StonewallCheck($1b)
bra ++
.south
lda.w InroomStairsY+1,y : beq +
inc $045f ; flag indicating special screen transition
inc $02 ; shift variables further
lda #$02 : sta $aa
lda $a8 : ora #%00000010 : sta $a8
inc $0611 ; South scroll target
dec $0603 : dec $0607
inc $0619 : inc $061b
+
lda.w InroomStairsY,y : !sub #$20 : sta $20
!add #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !sub #$20 : sta $20
stz $045f
+
inc $21
++
lda $01 : and #$04 : lsr #2 : sta $ee : bne +
stz $0476
+ rts
}
; Target pixel should be in A, other info in $01
; Sets $04 $05 and $ee
PrepScrollToEdge:
{
sta $04 : lda $01 : and #$20 : beq +
lda #01
+ sta $05
lda $01 : and #$10 : beq +
lda #01
+ sta $ee : bne +
stz $0476
+ rts
}
; Normal Flags should be in $01
; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal:
{
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer
bne +
stz $0476
+ stz $05 : lda #$78 : sta $04
lda $01 : and #$03 : beq .end
cmp #$02 : !bge +
lda #$f8 : sta $04 : bra .end
+ inc $05
.end rts
}
StraightStairsAdj:
{
stx $0464 : sty $012e ; what we wrote over
lda.l DRMode : beq +
lda $045e : bne .toInroom
lda $046d : beq .noScroll
sta $22
ldy #$00 : jsr ApplyScroll
stz $046d
.noScroll
jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
inx
++ lda.l StepAdjustmentUp, X
.end
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
+ rtl
.toInroom
lda #$32 : sta $0464 : stz $045e
rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
}
; 0 open edge
; 1 nrm door high
; 2 straight str
; 3 nrm door low
; 4 trap door high
; 5 trap door low (none of these exist on North direction)
StepAdjustmentUp: ; really North Stairs
db $00, $f6, $1a, $18, $16, $38
StepAdjustmentDown: ; really South Stairs
db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix:
{
pha
lda.l DRMode : bne +
pla : !add $20 : sta $20 : rtl ;what we wrote over
+ pla : rtl
}
StraightStairLayerFix:
{
lda.l DRMode : beq +
lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over
}
DoorToStraight:
{
pha
lda.l DRMode : beq .skip
pla : bne .end
pha
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
.skip pla
.end LDX.w $0418 : CMP.b #$02 ; what we wrote over
rtl
}
DoorToInroom:
{
ldx $045e : bne .end
sta $0020, y ; what we wrote over
.end
ldx #$00 ; what we wrote over
rtl
}
DoorToInroomEnd:
{
ldy $045e : beq .vanilla
cmp $045e : bne .return
stz $045e ; clear
.return
rtl
.vanilla
cmp $02c034, x ; what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda $0464 : bne +
; reset function
.reset phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
.jslrtsreturn
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
.animateTraps
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
++ JML Underworld_SetBossOrSancMusicUponEntry_long
+ JML Dungeon_ApproachFixedColor ; what we wrote over
}
InroomStairsTrapDoor:
{
lda $0200 : cmp #$05 : beq .reset
lda $b0 : jml $008781 ; what we wrote over (essentially)
.reset
pla : pla : pla
jsl StraightStairsTrapDoor_reset
jml $028b15 ; just some RTS in bank 02
}
HandleSpecialDoorLanding: {
LDA.l $7F2000,X ; what we wrote over
SEP #$30
; A = tiletype
HandleIncomingDoorState:
PHA
LDA.l DRMode : BEQ .noDoor
LDA.b 1,S : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState
LDA.w $0418 : AND.b #$02 : BNE + : INC
+ STA.b $6C
.noDoor
PLA
CMP.b #$34 : BNE + ; inroom stairs
PHA : LDA.b #$26 : STA.w $045E : PLA
+ RTL
}

View File

@@ -1,140 +0,0 @@
GtBossHeartCheckOverride:
lda $a0 : cmp #$1c : beq ++
cmp #$6c : beq ++
cmp #$4d : bne +
++ lda.l DRFlags : and #$01 : bne ++ ;skip if flag on
lda $403 : ora #$80 : sta $403
++ clc
rtl
+ sec
rtl
OnFileLoadOverride:
jsl OnFileLoad ; what I wrote over
+ lda.l DRFlags : and #$02 : beq + ; Mirror Scroll
lda MirrorEquipment : bne +
lda #$01 : sta MirrorEquipment
+ rtl
MirrorCheckOverride:
lda.l DRFlags : and #$02 : beq ++
lda MirrorEquipment : cmp #$01 : beq +
;++ lda $8A : and #$40 ; what I wrote over
++ phx : ldx $8A : lda.l OWTileWorldAssoc,x : plx : and.b #$ff
rtl
+ lda.l DRScroll : rtl
EGFixOnMirror:
lda.l DRFlags : and #$10 : beq +
stz $047a
+ jsl Mirror_SaveRoomData
rtl
BlockEraseFix:
lda MirrorEquipment : and #$02 : beq +
stz $05fc : stz $05fd
+ rtl
FixShopCode:
cpx #$300 : !bge +
sta RoomDataWRAM[$00].l, x
+ rtl
VitreousKeyReset:
lda.l DRMode : beq +
stz $0cba, x
+ JML $0db818 ;restore old code
GuruguruFix:
lda $a0 : cmp #$df : !bge +
and #$0f : cmp #$0e : !blt +
iny #2
+ rtl
BlindAtticFix:
lda.l DRMode : beq +
lda #$01 : rtl
+ lda FollowerIndicator : cmp.b #$06
rtl
SuctionOverworldFix:
stz $50 : stz $5e
lda.l DRMode : beq +
stz $49
+ rtl
!CutoffTable = "$27E000"
CutoffEntranceRug:
PHA : PHX
LDA.l DRMode : BEQ .norm
LDA $04 : cmp #$000A : BEQ + ; only affect A & C objects
cmp #$000C : BNE .norm
+ LDX #$0000 : LDA !CutoffTable, x
- CMP.W $A0 : BEQ .check
INX #2 : LDA !CutoffTable, x : CMP.w #$FFFF : BNE -
.norm PLX : PLA : LDA $9B52, y : STA $7E2000, x ; what we wrote over
RTL
.check
LDA $0c : CMP #$0004 : !BGE .skip
LDA $0e : CMP #$0008 : !BGE .skip
CMP.l #$0004 : !BLT .skip
BRA .norm
.skip PLX : PLA : RTL
StoreTempBunnyState:
LDA $5D : CMP #$1C : BNE +
STA $5F
+ LDA #$15 : STA $5D ; what we wrote over
RTL
RetrieveBunnyState:
STY $5D : STZ $02D8 ; what we wrote over
LDA $5F : BEQ +
STA $5D
+ RTL
; A should be how much dmg to do to Aga when leaving this function
StandardAgaDmg:
LDX.b #$00 ; part of what we wrote over
LDA.l ProgressFlags : AND #$04 : BEQ + ; zelda's not been rescued
LDA.b #$10 ; hurt him!
+ RTL ; A is zero if the AND results in zero and then Agahnim's invincible!
StandardSaveAndQuit:
LDA.b #$0F : STA.b $95 ; what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE +
LDA.l DRMode : BEQ +
LDA.l StartingEntrance : CMP.b #$02 : BCC +
LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >=
+ RTL
; note: this skips both maiden dialog triggers if the hole is open
BlindsAtticHint:
REP #$20
CMP.w #$0122 : BNE +
LDA RoomDataWRAM[$65].low : AND.w #$0100 : BEQ +
SEP #$20 : RTL ; skip the dialog box if the hole is already open
+ SEP #$20 : JML Main_ShowTextMessage
BlindZeldaDespawnFix:
CMP.b #06 : BEQ +
LDA.w $0D00,X : BEQ + ; don't despawn follower if maiden isn't "present"
PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL
+ PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL
BigKeyDoorCheck:
CPY.w #$001E : BNE + ; skip if it isn't a BK door
LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided
PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1
+ LDA.w #$0000 : RTL
; FixOvalFadeOutMirror:
; LDA.b $10 : CMP.b #$0F : BEQ .skip_activation
; LDA.l InvertedMode : BNE +
; LDA.l CurrentWorld : BNE .skip_activation
; RTL
; + LDA.l CurrentWorld : BEQ .skip_activation
; RTL
; .skip_activation
; PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror

View File

@@ -1,222 +0,0 @@
AdjustTransition:
{
lda $ab : and #$01ff : beq .reset
phy : ldy #$06 ; operating on vertical registers during horizontal trans
cpx.b #$02 : bcs .horizontalScrolling
ldy #$00 ; operate on horizontal regs during vert trans
.horizontalScrolling
cmp #$0008 : bcs +
pha : lda $ab : and #$0200 : beq ++
pla : bra .add
++ pla : eor #$ffff : inc ; convert to negative
.add jsr AdjustCamAdd : ply : bra .reset
+ lda $ab : and #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd
lda $ab : !sub #$0008 : sta $ab
ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors
stz $ab
.done
lda $00 : and #$01fc
rtl
}
AdjustCamAdd:
!add $00E2,y : pha
and #$01ff : cmp #$0111 : !blt +
cmp #$01f8 : !bge ++
pla : and #$ff10 : pha : bra +
++ pla : and #$ff00 : !add #$0100 : pha
+ pla : sta $00E2,y : sta $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; $06 is either $ff or $01/02
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollY: ;change the Y offset variables
lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607
lda $05 : bne +
lda $603 : sta $00 : stz $01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01
++ ; $01 now contains 0 or 2 and $00 contains the correct lat
stz $0e
rep #$30
lda $00 : pha
lda $e8 : and #$01ff : sta $02
lda $04 : jsr LimitYCamera : sta $00
jsr CheckRoomLayoutY : bcc +
lda $00 : cmp #$0080 : !bge ++
cmp #$0010 : !blt .cmpSrll
lda #$0010 : bra .cmpSrll
++ cmp #$0100 : !bge .cmpSrll
lda #$0100
.cmpSrll sta $00
; figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab
jsr AdjustCameraBoundsY
pla : sta $00
sep #$30
lda $04 : sta $20
lda $00 : sta $21 : sta $0601 : sta $0605
lda $01 : sta $aa
lda $0e : asl : ora $ac : sta $ac
lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9
rts
LimitYCamera:
cmp #$006c : !bge +
lda #$0000 : bra .end
+ cmp #$017d : !blt +
lda #$0110 : bra .end
+ !sub #$006c
.end rts
CheckRoomLayoutY:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$00 : beq .lock
cmp #$07 : beq .free
cmp #$01 : beq .free
cmp #$04 : !bge .lock
cmp #$02 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$03 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only)
lda $04 : and #$00ff : cmp #$007d : !blt +
lda #$0088 : bra ++
+ cmp #$006d : !bge +
lda #$0078 : bra ++
+ !add #$000b
; I think we no longer need the $02 variable
++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds
; layouts where the camera is free
.free lda $04 : cmp #$006c : !bge +
lda #$0077 : bra .setBounds
+ cmp #$017c : !blt +
lda #$0187 : bra .setBounds
+ !add #$000b
.setBounds sta $0618 : inc #2 : sta $061a
rts
LoadRoomLayout:
lda $a0 : asl : !add $a0 : tax
lda $1f8001, x : sta $b8
lda $1f8000, x : sta $b7
sep #$30
ldy #$01 : lda [$b7], y : and #$1c : lsr #2
rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollX: ;change the X offset variables
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f
lda $05 : bne +
lda $60b : sta $00 : stz $01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01
++ ; $01 now contains 0 or 1 and $00 contains the correct long
stz $0e ; pos/neg indicator
rep #$30
lda $00 : pha
lda $e2 : and #$01ff : sta $02
lda $04 : jsr LimitXCamera : sta $00
jsr CheckRoomLayoutX : bcc +
lda $00 : cmp #$0080 : !bge ++
lda #$0000 : bra .cmpSrll
++ lda #$0100
.cmpSrll sta $00
;figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab : lda $04
cmp #$0078 : !bge +
lda #$007f : bra ++
+ cmp #$0178 : !blt +
lda #$017f : bra ++
+ !add #$0007
++ sta $061c : inc #2 : sta $061e
pla : sta $00
sep #$30
lda $04 : ldx $046d : bne .straight
sta $22 : bra +
.straight
sta $046d ; set X position later
+
lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9
lda $0e : asl : ora $ac : sta $ac
lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3
rts
LimitXCamera:
cmp #$0079 : !bge +
lda #$0000 : bra .end
+ cmp #$0178 : !blt +
lda #$0178
+ !sub #$0078
.end rts
CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$04 : !blt .lock
cmp #$05 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$06 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
ApplyScroll:
rep #$30
lda $ab : and #$01ff : sta $00
lda $ab : and #$0200 : beq +
lda $00e2, y : !add $00 : bra .end
+ lda $00e2, y : !sub $00
.end
sta $00e2, y
sta $00e0, y
stz $ab : sep #$30 : rts
QuadrantLoadOrderBeforeScroll:
lda $045f : beq .end
lda #$08 : sta $045c ; start with opposite quadrant row
.end
JML $0091c4 ; what we overwrote
QuadrantLoadOrderAfterScroll:
lda $045f : beq .end
stz $045c : stz $045f ; draw other row and clear flag
.end
JML $0091c4 ; what we overwrote

View File

@@ -1,338 +0,0 @@
RecordStairType: {
pha
lda.l DRMode : beq .norm
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm
CMP #$00DF : BEQ .norm
SEP #$30
lda $0e
cmp #$25 : bcc ++ ; don't record straight staircases
sta $045e
++ pla : bra +
.norm SEP #$30 : pla : sta $a0
+ lda $063d, x
rtl
}
SpiralWarp: {
lda.l DRMode : beq .abort ; abort if not DR
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort
CMP #$00DF : BEQ .abort
SEP #$30
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg
cmp #$26 : beq .inroom
.abort
SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out
.inroom
jsr InroomStairsWarp
lda $a2 : and #$0f ; this is the code we are hijacking
rtl
.gtg
phb : phk : plb : phx : phy ; push stuff
jsr LookupSpiralOffset
rep #$30 : and #$00FF : asl #2 : tax
lda.w SpiralTable, x : sta $00
lda.w SpiralTable+2, x : sta $02
sep #$30
lda $00 : sta $a0
; shift quadrant if necessary
stz $07 ; this is a x quad adjuster for those blasted staircase on the edges
lda $01 : and #$01 : !sub $a9
bne .xQuad
lda $0462 : and #$04 : bne .xqCont
inc $07
.xqCont lda $22 : bne .skipXQuad ; this is an edge case
dec $23 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta $06 : !add $a9 : sta $a9
lda $0462 : and #$04 : bne .xCont
inc $07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $01 : and #$02 : lsr : !sub $06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1
lda $01 : and #$08 : lsr #2 : sta $0492 ;fix from layer calc 0->0 2->1
; shift lower coordinates
lda $02 : sta $22 : bne .adjY : lda $23 : !add $07 : sta $23
.adjY lda $03 : sta $20 : bne .upDownAdj : inc $21
.upDownAdj ldx #$08
lda $0462 : and #$04 : beq .upStairs
ldx #$fd
lda $01 : and #$80 : bne .set53
; if target is also down adjust by (6,-15)
lda #$06 : !add $20 : sta $20 : lda #$eb : !add $22 : sta $22 : bra .set53
.upStairs
lda $01 : and #$80 : beq .set53
; if target is also up adjust by (-6, 14)
lda #$fa : !add $20 : sta $20 : lda #$14 : !add $22 : sta $22
bne .set53 : inc $23
.set53
txa : !add $22 : sta $53
lda $01 : and #$10 : sta $07 ; zeroHzCam check
ldy #$00 : jsr SetCamera
lda $01 : and #$20 : sta $07 ; zeroVtCam check
ldy #$01 : jsr SetCamera
jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed
lda $a2 : and #$0f ; this is the code we are hijacking
rtl
}
StairCleanup: {
stz $045e ; clear the staircase flag
; animated tiles fix
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
stz $047a
rts
}
LookupSpiralOffset_long:
PHB : PHK : PLB
JSR LookupSpiralOffset
PLB : RTL
;Sets the offset in A
LookupSpiralOffset: {
;where link currently is in $a2: quad in a8 & #$03
;count doors
stz $00 : ldx #$00 : stz $01
.loop
lda $047e, x : cmp $00 : bcc .continue
sta $00
.continue inx #2
cpx #$08 : bcc .loop
lda $00 : lsr
cmp #$01 : beq .done
; look up the quad
lda $a9 : ora $aa : and #$03 : beq .quad0
cmp #$01 : beq .quad1
cmp #$02 : beq .quad2
bra .quad3
.quad0
inc $01 : lda $a2
cmp #$0c : beq .q0diff ;gt ent
cmp #$70 : bne .done ;hc stairwell
.q0diff lda $22 : cmp #$00 : beq .secondDoor
cmp #$98 : bcc .done ;gt ent and hc stairwell
.secondDoor inc $01 : bra .done
.quad1
lda $a2
cmp #$1a : beq .q1diff ;pod compass
cmp #$26 : beq .q1diff ;swamp elbows
cmp #$6a : beq .q1diff ;pod dark basement
cmp #$76 : bne .done ;swamp drain
.q1diff lda $22 : cmp #$98 : bcc .done
inc $01 : bra .done
.quad2
lda #$03 : sta $01 : lda $a2
cmp #$5f : beq .iceu ;ice u room
cmp #$3f : bne .done ;hammer ice exception
stz $01 : bra .done
.iceu lda $22 : cmp #$78 : bcc .done
inc $01 : bra .done
.quad3
lda $a2 : cmp #$40 : beq .done ; top of aga exception
lda #$02 : sta $01 ; always 2
.done
lda $a2 : tax : lda.w SpiralOffset,x
!add $01 ;add a thing (0 in easy case)
rts
}
InroomStairsWarp: {
phb : phk : plb : phx : phy ; push stuff
; find stairs by room and store index in X
lda $a0 : ldx #$07
.loop
cmp.w InroomStairsRoom,x
beq .found
dex
bne .loop
.found
rep #$30
txa : and #$00ff : asl : tay
lda.w InroomStairsTable,y : sta $00
sep #$30
sta $a0
; set position and everything else based on target door type
txa : and #$01 : eor #$01 : sta $07
; should be the same as lda $0462 : and #$04 : lsr #2 : eor #$01 : sta $07
lda $01 : and #$80 : beq .notEdge
lda $07 : sta $03 : beq +
lda $01 : jsr LoadSouthMidpoint : sta $22 : lda #$f4
bra ++
+
lda $01 : jsr LoadNorthMidpoint : sta $22 : dec $21 : lda #$f7
++
sta $20
lda $01 : and #$20 : beq +
lda #$01
+
sta $02
stz $07
lda $01 : and #$10 : lsr #4
JMP .layer
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
txa : and #$06 : sta $07
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX+1,y : sta $02
lda.w InroomStairsY+1,y : sta $03
cpy $07 : beq .vanillaTransition
lda.w InroomStairsX,y : sta $22
lda.w InroomStairsY,y
ldy $07 : beq +
!add #$07
+
sta $20
inc $07
bra ++
.vanillaTransition
lda #$c0 : sta $07 ; leave camera
++
%StonewallCheck($1b)
lda $01 : and #$04 : lsr #2
bra .layer
.normal
lda $01 : sta $fe ; trap door
lda $07 : sta $03 : beq +
lda $01 : and #$04 : bne .specialFix
lda #$e0 : bra ++
.specialFix
lda #$c8 : bra ++
+
%StonewallCheck($43)
lda $01 : and #$04 : bne +
lda #$1b : bra ++
+ lda #$33
++ sta $20
inc $07 : stz $02 : lda #$78 : sta $22
lda $01 : and #$03 : beq ++
cmp #$02 : !bge +
lda #$f8 : sta $22 : stz $07 : bra ++
+ inc $02
++
lda $01 : and #$04 : lsr #2
.layer
sta $ee
bne +
stz $0476
+
lda $02 : !sub $a9
beq .skipXQuad
sta $06 : !add $a9 : sta $a9
ldy #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $03 : !sub $06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $07 : bmi .skipCamera
ldy #$00 : jsr SetCamera ; horizontal camera
ldy #$01 : sty $07 : jsr SetCamera ; vertical camera
lda $20 : cmp #$e0 : bcc +
lda $e8 : bne +
lda #$10 : sta $e8 ; adjust vertical camera at bottom
+
.skipCamera
jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed
rts
}
ShiftQuadSimple: {
lda.w CoordIndex,y : tax
lda $20,x : beq .skip
lda $21,x : !add $06 : sta $21,x ; coordinate update
.skip
lda.w CamQuadIndex,y : tax
lda $0601,x : !add $06 : sta $0601,x
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
rts
}
SetCamera: {
stz $04
tyx : lda $a9,x : bne .nonZeroHalf
lda.w CamQuadIndex,y : tax : lda $607,x : pha
lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
dec $e3,x
.noQuadAdj
lda $07 : bne .adj0
lda.w CoordIndex,y : tax
lda $20,x : beq .oddQuad
cmp #$79 : bcc .adj0
!sub #$78 : sta $04
tya : asl : !add #$04 : tax : jsr AdjCamBounds : bra .done
.oddQuad
lda #$80 : sta $04 : bra .adj1 ; this is such a weird case - quad cross boundary
.adj0
tya : asl : tax : jsr AdjCamBounds : bra .done
.nonZeroHalf ;meaning either right half or bottom half
lda $07 : bne .setQuad
lda.w CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad
!add #$78 : sta $04
lda.w CamQuadIndex,y : tax : lda $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
.adj1
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad
lda.w CamQuadIndex,y : tax : lda $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
.done
lda.w CameraIndex,y : tax
lda $04 : sta $e2, x
rts
}
; input, expects X to be an appropriate offset into the CamBoundBaseLine table
; when $04 is 0 no coordinate are added
AdjCamBounds: {
rep #$20 : lda.w CamBoundBaseLine, x : sta $05
lda $04 : and #$00ff : beq .common
lda.w CoordIndex,y : tax
lda $20, x : and #$00ff : !add $05 : sta $05
.common
lda.w OppCamBoundIndex,y : tax
lda $05 : sta $0618, x
inc #2 : sta $061A, x : sep #$20
rts
}
SpiralPriorityHack: {
lda.l DRMode : beq +
lda #$01 : rtl ; always skip the priority code - until I figure out how to fix it
+ lda $0462 : and #$04 ; what we wrote over
rtl
}

View File

@@ -21,7 +21,7 @@ DoDungeonMapBossIcon:
; get dungeon boss room
++ REP #$30
LDA.l DungeonMapBossRooms, X
LDA.l $8AE817,X
ASL
TAX

161
elder.asm
View File

@@ -1,6 +1,6 @@
NewElderCode:
{
LDA $8A : AND.b #$3F : CMP #$1B : BEQ .newCodeContinue
LDA $8A : CMP #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $05F0CD
.newCodeContinue
@@ -12,7 +12,7 @@ JSR Elder_Code
PLB
RTL
}
Elder_Draw:
{
@@ -60,7 +60,7 @@ RTL
LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL ActivateTriforceCutscene
JSL.l ActivateGoal
+
.dont_show
@@ -69,158 +69,3 @@ RTL
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
RTS
}
;--------------------------------------------------------------------------------
; Triforce (Pedestal) Cutscene
;--------------------------------------------------------------------------------
ActivateTriforceCutscene:
; despawn other sprites
LDY.b #$0F
- LDA.w $0E20,Y : CMP.b #$16 : BNE +
CPY.b #$00 : BEQ .next
; move Murahdahla to slot 0 for draw priority reasons
LDA.w $0E20,Y : STA.w $0E20
LDA.w $0D00,Y : STA.w $0D00
LDA.w $0D10,Y : STA.w $0D10
LDA.w $0D20,Y : STA.w $0D20
LDA.w $0D30,Y : STA.w $0D30
LDA.w $0D40,Y : STA.w $0D40
LDA.w $0F50,Y : STA.w $0F50
LDA.w $0E40,Y : STA.w $0E40
LDA.w $0E60,Y : STA.w $0E60
LDA.w $0DD0,Y : STA.w $0DD0
LDA.b #$02 : STA.w $0F20
+ LDA.b #$00 : STA.w $0DD0,Y
.next
DEY : BPL -
LDA.b #$62 ; MasterSword Sprite
JSL Sprite_SpawnDynamically
; set up coords
LDA.b $22 : STA.w $0D10,Y
LDA.b $23 : STA.w $0D30,Y
LDA.b $20 : CLC : ADC.b #$08 : STA.w $0D00,Y
LDA.b $21 : ADC.b #$00 : STA.w $0D20,Y
LDA.b #$01 : STA.w $0D90,Y ; our indicator this is a special cutscene sprite
INC : STA.b $2F ; makes Link face downward
; reset modules
LDA.b $1B : BEQ +
LDA.b #$07
BRA ++
+ LDA.b #$09
++ STA.b $10
STZ.b $11 : STZ.b $B0
RTL
pushpc
org $058928
MasterSword_InPedestal_DoCutscene:
org $0589B1
MasterSword_ConditionalHandleReceipt_DoReceipt:
org $0588DF
JSL MasterSword_CheckIfPulled : PLX : NOP #2
db $90 ; BCC instead of BEQ
org $05890E
JSL MasterSword_ConditionalActivateCutscene
org $05895F
JSL MasterSword_ConditionalGrabPose : NOP
org $058994
JSL MasterSword_ConditionalGrabPose : NOP
org $058D1C
JML MasterSword_SpawnPendantProp_ChangePalette
MasterSword_SpawnPendantProp_ChangePalette_return:
org $0589A3
JSL MasterSword_ConditionalHandleReceipt : NOP #2
pullpc
MasterSword_CheckIfPulled:
CPX.b #$80 : BEQ +
- CLC : RTL ; not on pedestal screen, continue with cutscene
+ LDA.l $7EF280,X : AND.b #$40 ; what we wrote over
BEQ - : SEC : RTL
MasterSword_ConditionalActivateCutscene:
LDA.w $0D90,X : BNE .specialCutscene
JML Sprite_CheckDamageToPlayerSameLayerLong ; what we wrote over
.specialCutscene
LDA.b #$02 : STA.w $02DA ; Link's 2-hands-up pose
STA.b $EE ; draw Link on top
LDA.b #$6A : JSL RequestSlottedTile ; draw Triforce piece in VRAM
PLA : PLA : PLA : JML MasterSword_InPedestal_DoCutscene ; do cutscene
MasterSword_ConditionalGrabPose:
PHA
LDA.w $0D90,X : BNE .specialCutscene
PLA
STA.w $0377 : LDA.b #$01 ; what we wrote over
RTL
.specialCutscene
PLA
LDA.b #$01
RTL
MasterSword_SpawnPendantProp_ChangePalette:
STA.w $0D40,Y : PLX ; what we wrote over
LDA.w $0D90,X : BNE .specialCutscene
BRA .done
.specialCutscene
LDA.b #$08 : STA.w $0F50,Y ; change palette
LDA.b #$02 : STA.w $0F20,Y ; change layer
.done
JML MasterSword_SpawnPendantProp_ChangePalette_return
MasterSword_ConditionalHandleReceipt:
LDA.w $0D90,X : BNE .specialCutscene
LDX.b $8A : LDA.l $7EF280,X ; what we wrote over
RTL
.specialCutscene
PLA : PLA : PEA.w MasterSword_ConditionalHandleReceipt_DoReceipt-1
LDA.b 4,S : TAX
LDY.b #$6A
RTL
pushpc
org $058AB6
MasterSword_SpawnLightWell:
org $058AD0
MasterSword_SpawnLightFountain:
org $058B62
MasterSword_SpawnLightBeam:
org $058941
JSL MasterSword_ConditionalSpawnLightWell : NOP #2
MasterSword_SpawnLightWell_return:
org $058952
JSL MasterSword_ConditionalSpawnLightFountain : NOP #2
MasterSword_SpawnLightFountain_return:
org $058B64
JSL MasterSword_ConditionalSpawnLightBeam : NOP #2
pullpc
MasterSword_ConditionalSpawnLightWell:
INC.w $0D80,X ; part of what we wrote over
LDA.w $0D90,X : BNE .specialCutscene
PLA : PLA : PLA : PEA.w MasterSword_SpawnLightWell_return-1
JML MasterSword_SpawnLightWell ; part of what we wrote over
.specialCutscene
RTL
MasterSword_ConditionalSpawnLightFountain:
INC.w $0D80,X ; part of what we wrote over
LDA.w $0D90,X : BNE .specialCutscene
PLA : PLA : PLA : PEA.w MasterSword_SpawnLightFountain_return-1
JML MasterSword_SpawnLightFountain ; part of what we wrote over
.specialCutscene
RTL
MasterSword_ConditionalSpawnLightBeam:
LDA.w $0D90,X : BNE .specialCutscene
LDA.b #$62 : JSL Sprite_SpawnDynamically ; what we wrote over
RTL
.specialCutscene
LDY.b #$FF
RTL

View File

@@ -1,13 +0,0 @@
;================================================================================
; Blind Boss fight
;--------------------------------------------------------------------------------
print "Blind Spawn Code Check: ", pc
check_blind_boss_room:
LDA $A0 ; load room index (low byte)
CMP #172 : BNE + ; Is is Thieve Town Boss Room
LDA $09DE81 : BEQ + ; Blind maiden does not need rescuing
LDA FollowerIndicator : JML Check_for_Blind_Fight
+
JML Initialize_Blind_Fight

View File

@@ -1,13 +0,0 @@
;================================================================================
; Blind Boss fight
;--------------------------------------------------------------------------------
org $9DA081 ; Original Code
JML check_blind_boss_room
Check_for_Blind_Fight:
org $9DA090
Initialize_Blind_Fight:

View File

@@ -1 +0,0 @@
incsrc blindboss_hooks.asm

View File

@@ -1,35 +0,0 @@
; Intended to be a migration of code generated by enemizer
lorom
;================================================================================
!ADD = "CLC : ADC"
!SUB = "SEC : SBC"
!BLT = "BCC"
!BGE = "BCS"
;=Constants======================================================================
!BUSHES_FLAG = "$368100"
!BLIND_DOOR_FLAG = "$368101"
!MOLDORM_EYES_FLAG = "$368102"
!RANDOM_SPRITE_FLAG = "$368103"
!AGAHNIM_FUN_BALLS = "$368104"
!ENABLE_MIMIC_OVERRIDE = "$368105"
!ENABLE_TERRORPIN_AI_FIX = "$368106"
; Enemizer reserved memory
; $7F50B0 - $7F50BF - Downstream Reserved (Enemizer)
!SHELL_DMA_FLAG = "$7F50B0"
!SOUNDFX_LOADED = "$7F50B1"
;================================================================================
incsrc hooks.asm
org $B78000 ; the original org is 368000, but I'm putting this here for migration purposes, and I think B6 is the same bank but fastrom
EnemizerTablesStart:
;none migrated yet
EnemizerCodeStart:
incsrc blindboss.asm

View File

@@ -20,7 +20,7 @@ LockAgahnimDoors:
!BGE .crystalOrUnlock
LDA #$0001 : RTL
.crystalOrUnlock
LDA SwapAgaGanonsTower : AND.w #$00FF : BEQ .unlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock
LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item
@@ -42,7 +42,7 @@ LockAgahnimDoors:
RTL
;---------------------------------------------------------------------------------
FlagAgahnimDoor:
LDA.l SwapAgaGanonsTower : BEQ .vanilla
LDA.l InvertedMode : BEQ .vanilla
LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
@@ -80,7 +80,8 @@ AllowStartFromSingleEntranceCave:
LDA StartingEntrance : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X : AND.w #$00FF
LDA.l StartingAreaExitOffset, X
AND.w #$00FF
BNE +
JMP .done
@@ -123,11 +124,10 @@ AllowStartFromSingleEntranceCave:
STZ $0699 ;zero out door overlays in case starting overworld door is not set
SEP #$20 ; set 8-bit accumulator
LDA StartingEntrance : TAX
LDA $7EF3C8 : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door
REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData
JSL.l CacheDoorFrameData
.done
PLA
@@ -194,9 +194,9 @@ JML Overworld_Hole_End
;--------------------------------------------------------------------------------
PreventEnterOnBonk:
STA $00 ; part of what we wrote over
LDA.b $8A : TAX : LDA.l OWTileMapAlt, X : AND.w #$0001 : BEQ .done
LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b $8A : TAX : LDA.l OWTileWorldAssoc, X : AND.w #$00FF : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
LDA.b $8A : AND.w #$0040 : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX
@@ -214,16 +214,15 @@ TurtleRockEntranceFix:
RTL
;--------------------------------------------------------------------------------
AnimatedEntranceFix: ;when an entrance animation tries to start
PHA : PHX
PHA
LDA.l InvertedMode : BEQ + ;If we are in inverted mode
LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BNE + ;If we are in Mixed OW shuffle mode
LDA $8A : AND #$40 : BNE + ;and in the light world
PLX : PLA
LDA $8A : AND.b #$40 : BNE + ;and in the light world
PLA
STZ $04C6 ; skip it.
LDA #$00
RTL
+
PLX : PLA
PLA
STA $02E4 ;what we wrote over
STA $0FC1 ;what we wrote over
STA $0710 ;what we wrote over

View File

@@ -15,7 +15,6 @@ OnPrepFileSelect:
;--------------------------------------------------------------------------------
OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l DrHudOverride
JSL.l NewDrawHud
JSL.l SwapSpriteIfNecessary
JSL.l CuccoStorm
@@ -58,65 +57,66 @@ RTL
;--------------------------------------------------------------------------------
OnUncleItemGet:
PHA
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
LDA UncleItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
PLA
JSL.l Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows
LDA.b #70 : STA.l ArrowsFiller
LDA.b #70 : STA.l ArrowsFiller
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
RTL
;--------------------------------------------------------------------------------
OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword
;--------------------------------------------------------------------------------
OnFileCreation:
; Copy initial SRAM state from ROM to cart SRAM
PHB
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN $70, $30 ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN $70, $30 ; /
PLB
; Copy initial SRAM state from ROM to cart SRAM
; If the inital SRAM table is move these addresses must be changed
PHB
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN SRAMBank, SRAMTableBank ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN SRAMBank, SRAMTableBank ; /
PLB
; resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
LDA.b #$00 : STA.l ProgressIndicatorSRAM ; set post-aga after zelda rescue
LDA.b #$00 : STA.l OverworldEventDataSRAM+$02 ; keep rain state vanilla
+
REP #$20
; resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
LDA.b #$00 : STA.l ProgressIndicatorSRAM ; set post-aga after zelda rescue
LDA.b #$00 : STA.l OverworldEventDataSRAM+$02 ; keep rain state vanilla
+
REP #$20
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l $7003E1
STZ $00
STZ $01
LDX.b $00
LDY.w #$0000
TYA
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l $7003E1
STZ $00
STZ $01
LDX.b $00
LDY.w #$0000
TYA
JML.l InitializeSaveFile_build_checksum
;--------------------------------------------------------------------------------
@@ -124,8 +124,6 @@ JML.l InitializeSaveFile_build_checksum
OnFileLoad:
REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over
REP #$20 : LDA.l $30F010 : STA.l MultiClientFlagsWRAM+1 : SEP #$20
LDA MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area
@@ -249,22 +247,11 @@ PostItemAnimation:
LDA.b #$00 : STA $7F509F
+
LDA $1B : BEQ +
REP #$20 : LDA $A0 : STA !MULTIWORLD_ROOMID : SEP #$20
LDA $0403 : STA !MULTIWORLD_ROOMDATA
+
LDA.w $02E9 : CMP.b #$01 : BNE +
LDA.b $2F : BEQ +
JSL.l IncrementChestTurnCounter
+
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
STZ $02E9
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID
JML.l Ancilla_ReceiveItem_objectFinished
+
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
JML.l Ancilla_ReceiveItem_optimus+6
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
RTL
;--------------------------------------------------------------------------------

View File

@@ -268,16 +268,15 @@ DrawPlayerFileShared:
%fs_drawBottle(EquipmentSRAM+$1F,9,23)
; Sword
LDA.l SpecialWeapons : AND.w #$007F : CMP #$0001 : BEQ .bombSword
LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_sword)
BRA ++
@@ -287,29 +286,6 @@ DrawPlayerFileShared:
+
; a sword value above 4 is either corrupted or 0xFF (a.k.a. swordless)
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
BRA ++
.bombSword
LDA.l $70038F : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_gold_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
BRA ++
+
; a bomb value above 5 is... who knows, let's just pretend it's 5
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
++
; Shield
@@ -580,18 +556,6 @@ FileSelectItems:
.good_bee_bottle
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0254|!FS_COLOR_YELLOW, #$0246|!FS_COLOR_YELLOW
.fighters_bombs
dw #$020C|!FS_COLOR_GREEN, #$020D|!FS_COLOR_GREEN, #$021C|!FS_COLOR_GREEN, #$02A1|!FS_COLOR_GREEN
.master_bombs
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE, #$02A2|!FS_COLOR_BLUE
.tempered_bombs
dw #$020C|!FS_COLOR_RED, #$020D|!FS_COLOR_RED, #$021C|!FS_COLOR_RED, #$02A3|!FS_COLOR_RED
.gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A4|!FS_COLOR_YELLOW
.extra_gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A5|!FS_COLOR_YELLOW
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
@@ -602,29 +566,11 @@ FileSelectDrawHudBar:
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA SpecialWeapons : AND.w #$007F : CMP #$0001 : BEQ .colorBombs
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA EquipmentSRAM+$03 : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
BRA ++
.colorBombs
LDA $70038F : AND.w #$00FF : BNE +
; no bombs, draw no icon
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
BRA ++
+
LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)

View File

@@ -135,20 +135,3 @@ protectff:
.spow
db $80, $81, $81, $FF, $FF, $FF, $FF, $FF
db $FF, $81, $81, $FF, $FF, $FF, $FF, $FF
FlipperScrollWarp:
STZ $00 : STZ $02 ; what we wrote over
LDA $308358 : BEQ .checkX : RTL
.checkX
LDA $22 : CMP.w $0604 : BCC +
CMP.w $0616 : BCS +
BRA .checkY
+ LDA $7EC186
STA $22
.checkY
LDA $20 : CMP.w $0600 : BCC +
CMP.w $0612 : BCS +
RTL
+ LDA $7EC184
STA $20
RTL

View File

@@ -11,19 +11,15 @@ FloodGateReset:
LDA RoomDataWRAM[$28].high : AND.b #$FE : STA RoomDataWRAM[$28].high ; clear water front room (room 40)
+
FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ .done
LDA DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l SwampDrain1HasItem : BEQ .flipper_check
LDA $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected.
.flipper_check
LDA FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_37
LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
.check_room_35
LDA.l SwampDrain2HasItem : BEQ .done
LDA $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected.
LDA.l Bugfix_SwampWaterLevel : BEQ +++
LDA RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected.
LDA FlippersEquipment : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
+
LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches
++
LDA RoomDataWRAM[$35].high : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected.
; no need to check for flippers on the inner room, as you can't get to the west door no matter what, without flippers.
LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 35 - inner room with the easy key flood softlock
.done
LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 53 - inner room with the easy key flood softlock
+++
RTL
;================================================================================

View File

@@ -5,15 +5,13 @@ SpawnHauntedGroveItem:
LDA $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA $1B : BEQ + : RTL : + ; Skip if indoors
LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile
LDA.b #$EB
STA $7FFE00
JSL Sprite_SpawnDynamically
LDA.b #$01 : STA.w !SPRITE_REDRAW, Y
LDX.b #$00
LDA $2F : CMP.b #$04 : BEQ + : INX : +
@@ -62,10 +60,7 @@ FluteBoy:
JML.l FluteBoy_Continue
;--------------------------------------------------------------------------------
FreeDuckCheck:
LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BNE .skipInvertedCheck
LDA.l InvertedMode : BEQ .done
.skipInvertedCheck
LDA.l InvertedMode : BEQ .done
LDA FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active
; check the area, is it #$18 = 30?

View File

@@ -20,25 +20,9 @@ FrameHookAction:
++
REP #$30 : PLA : PLP
RTL
!NMI_MW = "$7F5047"
;--------------------------------------------------------------------------------
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !NMI_MW : BEQ ++
PHP
SEP #$30
LDA #$00 : STA !NMI_MW
; Multiworld text
LDA !NMI_MW+1 : BEQ +
LDA #$00 : STA !NMI_MW+1
JSL.l WriteText
+
PLP
++
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
@@ -49,27 +33,27 @@ NMIHookAction:
JML.l NMIHookReturn
;--------------------------------------------------------------------------------
!NMI_AUX = "$7F5044"
PostNMIHookAction:
LDA.l !NMI_AUX+2 : BEQ .return
PHK
PEA .return-1
PHA
LDA.b #$00 : STA.l !NMI_AUX+2
REP #$20
LDA.l !NMI_AUX+0 : DEC : PHA
SEP #$20
RTL
.return
LDA.b $13 : STA.w $2100
JML.l PostNMIHookReturn
LDA !NMI_AUX : BEQ +
LDA $00 : PHA ; preserve DP ram
LDA $01 : PHA
LDA $02 : PHA
LDA !NMI_AUX+2 : STA $02 ; set up jump pointer
LDA !NMI_AUX+1 : STA $01
LDA !NMI_AUX+0 : STA $00
PHK : PER .return-1 ; push stack for RTL return
JMP [$0000]
.return
LDA.b #$00 : STA !NMI_AUX ; zero bank byte of NMI hook pointer
PLA : STA $02
PLA : STA $01
PLA : STA $00
+
LDA $13 : STA $2100 ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------

View File

@@ -1,74 +0,0 @@
def process_values(sprite, values)
ret = values.clone
if [1, 2].include?(ret[0]) # boomerang
if sprite == 0x53 # armos knight
ret[0] = 0 # do nothing
else
ret[0] = 5 # stun very briefly instead of damage
end
end
if ret[6] > 0 && sprite != 0x84 # bow and not red eyegore/mimic
ret[6] = 0
end
if ret[7] == 2 # hookshot
ret[7] = 1 # still want to stun
end
if [1, 2, 7].include?(ret[8]) && sprite != 0x92 # bomb and not helmasaur king
ret[8] = 0
end
if ret[9] > 0 && sprite != 0x84 # silver bow and not red eyegore/mimic
ret[9] = 0
end
if ret[10] == 4 # powder
ret[10] = 0
end
if ret[11] > 0 && ![0x23, 0xA1, 0xA3, 0xCD].include?(sprite) # fire rod
ret[11] = 0
end
if ret[12] != 3 && sprite != 0xCC # ice rod
ret[12] = 0
end
if ret[13] > 0 && ![0x23, 0xA1, 0xA3, 0xD1].include?(sprite) # bombos
ret[13] = 0
end
if ret[14] != 1 && ![0xD1].include?(sprite) # ether
ret[14] = 0
end
if [1, 2].include?(ret[15]) && ![0xD1].include?(sprite) # quake
ret[15] = 0
end
if sprite == 0x53 and ret[2] == 3
ret[2] = 1 # armos knight? let's make class 2 not suck
end
return ret
end
def split_value(byte)
return [byte >> 4, byte & 0x0F]
end
def join_values(value1, value2)
return (value1 & 0x0F) << 4 | (value2 & 0x0F)
end
File.open("damage_table.bin") do |input|
File.open("damage_table_sword_bombs.bin", "w") do |output|
i_enum = input.each_byte
(0...0xD7).each do |sprite|
values = []
(0...8).each do
values += split_value(i_enum.next)
end
v_enum = process_values(sprite, values).to_enum
(0...8).each do
output.putc(join_values(v_enum.next, v_enum.next))
end
end
begin
while true
output.putc(i_enum.next)
end
rescue StopIteration
end
end
end

View File

@@ -1,38 +0,0 @@
def process_values(sprite, values)
ret = values.clone
if (ret[1] == 0 && sprite != 0x40) || sprite == 0xCE
# fighter sword does no damage and it's not the evil barrier, or it's Blind
ret[5] = 0
end
return ret
end
def split_value(byte)
return [byte >> 4, byte & 0x0F]
end
def join_values(value1, value2)
return (value1 & 0x0F) << 4 | (value2 & 0x0F)
end
File.open("damage_table.bin") do |input|
File.open("damage_table_pseudo_sword.bin", "w") do |output|
i_enum = input.each_byte
(0...0xD7).each do |sprite|
values = []
(0...8).each do
values += split_value(i_enum.next)
end
v_enum = process_values(sprite, values).to_enum
(0...8).each do
output.putc(join_values(v_enum.next, v_enum.next))
end
end
begin
while true
output.putc(i_enum.next)
end
rescue StopIteration
end
end
end

View File

@@ -46,7 +46,6 @@ CheckGanonVulnerability:
dw .crystals_and_bosses
dw .bosses_only
dw .all_dungeons_no_agahnim
dw .completionist
; 00 = always vulnerable
.vulnerable
@@ -68,12 +67,12 @@ CheckGanonVulnerability:
.all_dungeons_no_agahnim
LDA.l PendantsField : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals
LDA RoomDataWRAM[$0D].high : AND.b #$08 : BEQ .fail ; require aga2 defeated (pyramid hole open)
LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open)
BRA .success
; 03 = crystals and aga 2
.crystals_and_aga
LDA RoomDataWRAM[$0D].high : AND.b #$08 : BEQ .fail ; check aga2 first then bleed in
LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; check aga2 first then bleed in
; 04 = crystals only
.crystals
@@ -100,74 +99,29 @@ CheckGanonVulnerability:
.bosses_only
JMP CheckForCrystalBossesDefeated
; 0a = Check Item counter
.completionist
REP #$20
LDA.l TotalItemCounter : CMP.l MaxItemCounter
SEP #$20
BCC .fail
BRA .all_dungeons
;--------------------------------------------------------------------------------
GTCutscene_CrystalMasks:
db %00000000 ; 0 crystals
db %10000000 ; BIT INDEX DIAGRAM
db %00010010 ; 0
db %00010101 ; 5 1
db %10010101 ; 7
db %10110110 ; 4 2
db %00111111 ; 3
db %10111111 ; 7 crystals
GetRequiredCrystalsForTower:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : +
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : +
LDA.l NumberOfCrystalsRequiredForTower : DEC #2 : TAX
JML.l GetRequiredCrystalsForTower_continue
;--------------------------------------------------------------------------------
GTCutscene_ConditionalAnimateCrystals:
PHX : PHX
LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X
PLX
- LSR : DEX : BPL -
PLX : BCC .skip_crystal
GetRequiredCrystalsInX:
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE +
TAX
RTL
+
.draw_crystal
LDA.b $11 : BEQ + : JML.l GTCutscene_AnimateCrystals_NoRotate ; what we wrote over
+ JML.l GTCutscene_AnimateCrystals_NextCrystal+4
TXA
.skip_crystal
JML.l GTCutscene_DrawSingleCrystal-3
;--------------------------------------------------------------------------------
GTCutscene_ConditionalDrawSingleCrystal:
LDA.w $06FA : BEQ .draw_crystal : STZ.w $06FA
LDA.l NumberOfCrystalsRequiredForTower : TAX
LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal
.draw_crystal
LDX.w $0FA0 : PHY ; what we wrote over
JML.l GTCutscene_DrawSingleCrystal+4
.skip_crystal
JML.l GTCutscene_DrawSingleCrystal_SkipCrystal
;--------------------------------------------------------------------------------
GTCutscene_AnimateCrystals_Prep:
BEQ + : JSL.l GTCutscene_SparkleALot : + ; thing we wrote over
LDA.l NumberOfCrystalsRequiredForTower : BNE +
JML.l GTCutscene_DrawSingleCrystal_SkipSparkle
+ CMP.b #$01 : BNE +
JML.l GTCutscene_DrawSingleCrystal
+ INC.w $06FA ; some free ram OWR also uses
JML.l GTCutscene_AnimateCrystals_NextCrystal-2
;--------------------------------------------------------------------------------
GTCutscene_ActivateSparkle_SelectCrystal:
LDA.l NumberOfCrystalsRequiredForTower : BNE +
TAX : RTL
+ TXA
- CMP.l NumberOfCrystalsRequiredForTower : BCC +
SBC.l NumberOfCrystalsRequiredForTower ; carry guaranteed set
BRA -
- CMP.l NumberOfCrystalsRequiredForTower : BCC +
SBC.l NumberOfCrystalsRequiredForTower : BRA - ; carry guaranteed set
+ PHY : TAY
LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X
LDX.b #$FF
- LSR : INX : BCC +
DEY
+ BPL -
PLY
+ INC : CMP.l NumberOfCrystalsRequiredForTower : BNE +
LDA.b #$08
+ : DEC : TAX
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:

View File

@@ -6,7 +6,6 @@ GetMagicBatItem:
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic
TAY
PHA : LDA MagicBatItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
STZ $02E9 ; 0 = Receiving item from an NPC or message
JML.l Link_ReceiveItem
.normalLogic

View File

@@ -76,18 +76,12 @@ GetItemDamageValue:
CPX.b #$04 : BEQ .boomerang
CPX.b #$05 : BEQ .boomerang
CPX.b #$39 : BEQ .hookshot
CPX.b #$3B : BEQ .hookshot
CPX.b #$3C : BEQ .hookshot
CPX.b #$3D : BEQ .hookshot
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$02 : BNE .normal
TXA : AND.b #$78 : CMP.b #$28 : BNE .normal
LDA.l $0DB8F1, X : BEQ .noDamage
LDA.b #$01
RTL
CPX.b #$3b : BEQ .hookshot
CPX.b #$3c : BEQ .hookshot
CPX.b #$3d : BEQ .hookshot
.normal
LDA.l $0DB8F1, X ; what we wrote over
lda $0db8f1,x ;what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND #$01 : BNE .normal

View File

@@ -12,12 +12,9 @@ HeartPieceGet:
.skipLoad
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9 ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .notHeart
LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
@@ -49,27 +46,31 @@ HeartContainerGet:
BRA HeartPieceGet_skipLoad
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartPieceGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit
BRA .done ; don't draw on the init frame
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
.skipLoad
JSL DrawSlottedTile : BCS .done
; draw shadow
CMP #$03 : BNE +
INC.b $00 : INC.b $00 : INC.b $00 : INC.b $00 ; move narrow sprite shadow over 4 pixels
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+
JSL.l Sprite_DrawShadowLong
PHA
JSL.l IsNarrowSprite : BCC +
LDA $0E60, X : ORA.b #$20 : STA $0E60, X
+
;LDA $0E60, X : ORA.b #$10 : STA $0E60, X
PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
@@ -77,20 +78,22 @@ DrawHeartPieceGFX:
PLP
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartContainerGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
PHA : PHY
LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
BRA DrawHeartPieceGFX_skipInit
LDA $0E80, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
HeartContainerSound:
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
@@ -104,11 +107,6 @@ HeartContainerSound:
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
SEC
RTL
+
LDA $0C5E, X ; thing we wrote over
CPY.b #$20 : BEQ + ; Skip for Crystal
@@ -125,60 +123,52 @@ RTL
RTL
;--------------------------------------------------------------------------------
HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
LDA.l !FORCE_HEART_SPAWN : BEQ .bonk_prize_check
LDA !FORCE_HEART_SPAWN : BEQ .normal_behavior
LDA.b #$00 : STA.l !FORCE_HEART_SPAWN
DEC : STA !FORCE_HEART_SPAWN
LDA #$00
RTL
.bonk_prize_check
PHX
LDA.b 5,S : TAX : LDA.w $0ED0, X : BEQ .normal_behavior-1
PLX
LDA.b #$00
RTL
PLX
.normal_behavior
LDA.l OverworldEventDataWRAM, X
LDA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
SaveHeartCollectedStatus:
LDA !SKIP_HEART_SAVE : BEQ .save_flag
LDA !SKIP_HEART_SAVE : BEQ .normal_behavior
LDA #$00 : STA !SKIP_HEART_SAVE
DEC : STA !SKIP_HEART_SAVE
RTL
.save_flag
LDA 4,S : TAY : LDA $0ED0,Y : BEQ .normal_behavior
PHA
LDA OverworldEventDataWRAM, X : ORA 1,S : STA OverworldEventDataWRAM, X
PLA
RTL
.normal_behavior
LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartPieceSpritePrep:
PHA
LDA ServerRequestMode : BEQ + : : +
LDA.b #$01 : STA.w !SPRITE_REDRAW, X
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA #$01 : STA !REDRAW
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
JSL.l LoadHeartPieceRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l RequestSlottedTile
JSL.l PrepDynamicTile
.skip
PLA
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartContainerSpritePrep:
PHA
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA #$00 : STA !REDRAW
JSL.l LoadHeartContainerRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l RequestSlottedTile
JSL.l PrepDynamicTile
PLA
RTL
@@ -193,25 +183,10 @@ LoadHeartPieceRoomValue:
.done
RTL
;--------------------------------------------------------------------------------
!DynamicDropGFXSlotCount_UW = (FreeUWGraphics_end-FreeUWGraphics)>>1
!DynamicDropGFXSlotCount_OW = (FreeOWGraphics_end-FreeOWGraphics)>>1
!REDRAW = "$7F5000"
HPItemReset:
PHA
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip
PLA
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
BRA .done
.skip
PLA
.done
PHA : PHY
LDY.b #$0F
- LDA.w $0DD0,Y : BEQ +
LDA.w !SPRITE_REDRAW, Y : CMP.b #$02 : BNE +
; attempt redraw of any sprite using the overflow slot
LDA.b #$01 : STA.w !SPRITE_REDRAW, Y
+ DEY : BPL -
PLY : PLA
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
PHA : LDA #$01 : STA !REDRAW : PLA
RTL
;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected:
@@ -225,13 +200,6 @@ MaybeMarkDigSpotCollected:
PLP : PLA
RTL
;--------------------------------------------------------------------------------
HeartPieceSpawnDelayFix:
JSL Sprite_DrawRippleIfInWater
; Fix the delay when spawning a HeartPiece sprite
JSL.l Sprite_CheckIfPlayerPreoccupied : BCS + ; what we moved from $05F037
JSL.l Sprite_CheckDamageToPlayerSameLayerLong : RTL ; what we wrote over
+ CLC : RTL
;--------------------------------------------------------------------------------
macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
LDA IsEncrypted : BNE ?encrypted
LDA.l <ItemLabel>
@@ -246,7 +214,7 @@ macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
LDA.w #<ItemLabel>-<TableLabel>
JSL RetrieveValueFromEncryptedTable
PLX : STX $02 : PLX : STX $00
PLX : STX $02 : PLX : STX $01
PLP : PLX
?done:
endmacro
@@ -272,9 +240,6 @@ LoadIndoorValue:
++
%GetPossiblyEncryptedItem(HeartPiece_Graveyard_Warp, HeartPieceIndoorValues)
JMP .done
+ CMP.w #288 : BNE +
LDA.l UWBonkPrizeData+3
JMP .done
+ CMP.w #294 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Mire_Warp, HeartPieceIndoorValues)
JMP .done
@@ -303,10 +268,7 @@ LoadOutdoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$00 : BNE +
LDA.l OWBonkPrizeTable[$00].loot
JMP .done
+ CMP.w #$03 : BNE +
CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)
JMP .done
@@ -314,92 +276,14 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(EtherItem, SpriteItemValues)
JMP .done
+ CMP.w #$05 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$01].loot
JMP .done
++
%GetPossiblyEncryptedItem(HeartPiece_Mountain_Warp, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$0A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$02].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$03].loot
JMP .done
+ CMP.w #$10 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$04].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$05].loot
JMP .done
+ CMP.w #$11 : BNE +
LDA.l OWBonkPrizeTable[$06].loot
JMP .done
+ CMP.w #$12 : BNE +
LDA.l OWBonkPrizeTable[$07].loot
JMP .done
+ CMP.w #$13 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$08].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$09].loot
JMP .done
+ CMP.w #$15 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0A].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$0B].loot
JMP .done
+ CMP.w #$18 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0C].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$0D].loot
JMP .done
+ CMP.w #$1A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0E].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$0F].loot
JMP .done
+ CMP.w #$1B : BNE +
LDA.l OWBonkPrizeTable[$10].loot
JMP .done
+ CMP.w #$1D : BNE +
LDA.l OWBonkPrizeTable[$11].loot
JMP .done
+ CMP.w #$1E : BNE +
LDA.l OWBonkPrizeTable[$12].loot
%GetPossiblyEncryptedItem(HeartPiece_Mountain_Warp, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$28 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Maze, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$2A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$13].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$14].loot
JMP .done
++
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$2B : BNE +
LDA.l OWBonkPrizeTable[$15].loot
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$2E : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$16].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$17].loot
JMP .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
%GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues)
@@ -407,13 +291,6 @@ LoadOutdoorValue:
++
%GetPossiblyEncryptedItem(BombosItem, SpriteItemValues)
JMP .done
+ CMP.w #$32 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$18].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$19].loot
JMP .done
+ CMP.w #$35 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Lake, HeartPieceOutdoorValues)
JMP .done
@@ -421,68 +298,17 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(HeartPiece_Swamp, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$42 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1A].loot
JMP .done
++
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
JMP .done
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$4A : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$51 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1B].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$1C].loot
JMP .done
+ CMP.w #$54 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1D].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$1E].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$1F].loot
JMP .done
+ CMP.w #$55 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$20].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$21].loot
JMP .done
+ CMP.w #$56 : BNE +
LDA.l OWBonkPrizeTable[$22].loot
JMP .done
+ CMP.w #$5B : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$23].loot
JMP .done
++
%GetPossiblyEncryptedItem(HeartPiece_Pyramid, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$5E : BNE +
LDA.l OWBonkPrizeTable[$24].loot
%GetPossiblyEncryptedItem(HeartPiece_Pyramid, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$68 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Digging, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$6E : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$25].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$26].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$27].loot
JMP .done
+ CMP.w #$74 : BNE +
LDA.l OWBonkPrizeTable[$28].loot
JMP .done
+ CMP.w #$81 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Zora, HeartPieceOutdoorValues)
JMP .done
@@ -588,305 +414,3 @@ RTL
;JSL $00D51B ; GetAnimatedSpriteTile
;JSL $00D52D ; GetAnimatedSpriteTile.variable
;================================================================================
HeartPieceGetPlayer:
{
PHY
LDA $1B : BNE +
BRL .outdoors
+
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #135 : BNE +
LDA StandingKey_Hera_Player
BRL .done
+ CMP.w #200 : BNE +
LDA HeartContainer_ArmosKnights_Player
BRL .done
+ CMP.w #51 : BNE +
LDA HeartContainer_Lanmolas_Player
BRL .done
+ CMP.w #7 : BNE +
LDA HeartContainer_Moldorm_Player
BRL .done
+ CMP.w #90 : BNE +
LDA HeartContainer_HelmasaurKing_Player
BRL .done
+ CMP.w #6 : BNE +
LDA HeartContainer_Arrghus_Player
BRL .done
+ CMP.w #41 : BNE +
LDA HeartContainer_Mothula_Player
BRL .done
+ CMP.w #172 : BNE +
LDA HeartContainer_Blind_Player
BRL .done
+ CMP.w #222 : BNE +
LDA HeartContainer_Kholdstare_Player
BRL .done
+ CMP.w #144 : BNE +
LDA HeartContainer_Vitreous_Player
BRL .done
+ CMP.w #164 : BNE +
LDA HeartContainer_Trinexx_Player
BRL .done
+ CMP.w #225 : BNE +
LDA HeartPiece_Forest_Thieves_Player
BRL .done
+ CMP.w #226 : BNE +
LDA HeartPiece_Lumberjack_Tree_Player
BRL .done
+ CMP.w #234 : BNE +
LDA HeartPiece_Spectacle_Cave_Player
BRL .done
+ CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
BNE ++
LDA HeartPiece_Circle_Bushes_Player
BRL .done
++
LDA HeartPiece_Graveyard_Warp_Player
BRL .done
+ CMP.w #288 : BNE +
LDA.l OWBonkPrizeTable[$2A].mw_player
BRL .done
+ CMP.w #294 : BNE +
LDA HeartPiece_Mire_Warp_Player
BRL .done
+ CMP.w #295 : BNE +
LDA HeartPiece_Smith_Pegs_Player
BRL .done
LDA.w #$0000
BRL .done
.outdoors
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$00 : BNE +
LDA.l OWBonkPrizeTable[$00].mw_player
BRL .done
+ CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
LDA HeartPiece_Spectacle_Player
BRL .done
++
LDA EtherItem_Player
BRL .done
+ CMP.w #$05 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$01].mw_player
BRL .done
++
LDA HeartPiece_Mountain_Warp_Player
BRL .done
+ CMP.w #$0A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$02].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$03].mw_player
BRL .done
+ CMP.w #$10 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$04].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$05].mw_player
BRL .done
+ CMP.w #$11 : BNE +
LDA.l OWBonkPrizeTable[$06].mw_player
BRL .done
+ CMP.w #$12 : BNE +
LDA.l OWBonkPrizeTable[$07].mw_player
BRL .done
+ CMP.w #$13 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$08].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$09].mw_player
BRL .done
+ CMP.w #$15 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0A].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$0B].mw_player
BRL .done
+ CMP.w #$18 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0C].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$0D].mw_player
BRL .done
+ CMP.w #$1A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$0E].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$0F].mw_player
BRL .done
+ CMP.w #$1B : BNE +
LDA.l OWBonkPrizeTable[$11].mw_player
BRL .done
+ CMP.w #$1D : BNE +
LDA.l OWBonkPrizeTable[$12].mw_player
BRL .done
+ CMP.w #$1E : BNE +
LDA.l OWBonkPrizeTable[$13].mw_player
BRL .done
+ CMP.w #$28 : BNE +
LDA HeartPiece_Maze_Player
BRL .done
+ CMP.w #$2A : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$14].mw_player
BRL .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$15].mw_player
BRL .done
++
LDA HauntedGroveItem_Player
BRL .done
+ CMP.w #$2B : BNE +
LDA.l OWBonkPrizeTable[$16].mw_player
BRL .done
+ CMP.w #$2E : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$17].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$18].mw_player
BRL .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
LDA HeartPiece_Desert_Player
BRL .done
++
LDA BombosItem_Player
BRL .done
+ CMP.w #$32 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$19].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$1A].mw_player
BRL .done
+ CMP.w #$35 : BNE +
LDA HeartPiece_Lake_Player
BRL .done
+ CMP.w #$3B : BNE +
LDA HeartPiece_Swamp_Player
BRL .done
+ CMP.w #$42 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1B].mw_player
BRL .done
++
LDA HeartPiece_Cliffside_Player
BRL .done
+ CMP.w #$4A : BNE +
LDA HeartPiece_Cliffside_Player
BRL .done
+ CMP.w #$51 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1C].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$1D].mw_player
BRL .done
+ CMP.w #$54 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1E].mw_player
BRL .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$1F].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$20].mw_player
BRL .done
+ CMP.w #$55 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$21].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$22].mw_player
BRL .done
+ CMP.w #$56 : BNE +
LDA.l OWBonkPrizeTable[$23].mw_player
BRL .done
+ CMP.w #$5B : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$24].mw_player
BRL .done
++
LDA HeartPiece_Pyramid_Player
BRL .done
+ CMP.w #$5E : BNE +
LDA.l OWBonkPrizeTable[$25].mw_player
BRL .done
+ CMP.w #$68 : BNE +
LDA HeartPiece_Digging_Player
BRL .done
+ CMP.w #$6E : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$26].mw_player
BRL .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$27].mw_player
BRL .done
++
LDA.l OWBonkPrizeTable[$28].mw_player
BRL .done
+ CMP.w #$74 : BNE +
LDA.l OWBonkPrizeTable[$29].mw_player
BRL .done
+ CMP.w #$81 : BNE +
LDA HeartPiece_Zora_Player
BRL .done
+
LDA.w #$0000
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
PLY
RTL
}
;--------------------------------------------------------------------------------
HeartPieceSetRedraw:
PHY
LDY.b #$0F
.next
LDA.w $0DD0,Y : BEQ ++
LDA.w $0E20,Y : CMP.b #$EB : BEQ + ; heart piece
CMP.b #$E4 : BEQ + ; enemy key drop
CMP.b #$3B : BEQ + ; bonk item (book/key)
CMP.b #$E5 : BEQ + ; enemy big key drop
CMP.b #$E7 : BEQ + ; mushroom item
CMP.b #$E9 : BEQ + ; powder item
BRA ++
+ LDA.b #$01 : STA.w !SPRITE_REDRAW,Y
++ DEY : BPL .next
PLY
RTL
HeartPieceGetRedraw:
PHY
LDY.b #$0F
.next
LDA.w $0DD0,Y : BEQ ++
LDA.w $0E20,Y : CMP.b #$EB : BEQ + ; heart piece
CMP.b #$E4 : BEQ + ; enemy key drop
CMP.b #$3B : BEQ + ; bonk item (book/key)
CMP.b #$E5 : BEQ + ; enemy big key drop
CMP.b #$E7 : BEQ + ; mushroom item
CMP.b #$E9 : BEQ + ; powder item
BRA ++
+ LDA.w !SPRITE_REDRAW,Y : BEQ ++
PLY : SEC : RTL
++ DEY : BPL .next
PLY
CLC : RTL

557
hooks.asm
View File

@@ -1,10 +1,3 @@
org $078102 ; no idea where that is, ask zarby
JSL GetMultiworldItem
org $01EC07 ; Dungeon_OpenKeyedObject .nextChest : LDA Dungeon_ChestData+2, X
JSL.l Multiworld_OpenKeyedObject
;================================================================================
; Init Hook
;--------------------------------------------------------------------------------
@@ -36,9 +29,6 @@ org $00821B ; <- 21B - Bank00.asm : 329 (LDA $13 : STA $2100)
JML.l PostNMIHookAction : NOP
PostNMIHookReturn:
;--------------------------------------------------------------------------------
org $008F6C
JSL PostNMIUpdateBGCharHalf : NOP
;--------------------------------------------------------------------------------
;================================================================================
; Anti-ZSNES Hook
@@ -191,9 +181,6 @@ db Password_Tilemap>>16
org $0CD527 ; <- 65527 : Bank0C.asm : 2913 (LDA.w #$0004 : STA $02) [LDA.w #$0006 : STA $02]
JSL.l DrawPlayerFile : NOP ; hijack hearts draw routine to draw a full inventory
; Random incredible patch that I should add right now - File Select Fairy
org $1BF029+1 : db $10
org $0ccdd5 ; Bank0C.asm:1881 (LDX.w #$00FD)
JSL.l AltBufferTable : NOP #8 ; Selection screen
org $0cd393 ; Bank0c.asm:2674 (LDX.w #$00FD)
@@ -201,7 +188,7 @@ JSL.l AltBufferTable : NOP #8 ; Delete screen
;--------------------------------------------------------------------------------
org $0CCCCC ;<- 64CCC - Bank0C.asm : 1628 (JSL Intro_ValidateSram) / Bank02.asm : 75 (REP #$30)
; Explanation: In JP 1.0 the code for Intro_ValidateSram was inline in Bank 0C
JML.l Validate_SRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that)
JML.l ValidateSRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that)
org $0CCD57 ;<- 64D57 - Bank0C.asm :
RTL ;Just in case anybody ever removes the previous hook
;--------------------------------------------------------------------------------
@@ -312,12 +299,17 @@ BRA +
;================================================================================
; Extended SRAM Save file
;--------------------------------------------------------------------------------
org $0ccf08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013)
org $0CCF08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013)
JSL CopyExtendedSaveFileToWRAM
;--------------------------------------------------------------------------------
org $008998 ; <- Bank00.asm : 1296 (LDX.w #$0000)
JSL CopyExtendedWRAMSaveFileToSRAM
;--------------------------------------------------------------------------------
org $00899C ; <- bank_00.asm : #_00899C (CLC)
JSL WriteSaveChecksumAndBackup
LDA.w #$01F3 : TCS : SEP #$30 : PLB : RTL ; Get the stack and data bank correct
padbyte $FF : pad $0089C2 ; Fill adjacent free rom forward. See bank_00.asm: #_0089C2
;--------------------------------------------------------------------------------
org $0CD7AB ; <- Bank0C.asm : 3342 (STA $700400, X)
JSL.l ClearExtendedSaveFile
;--------------------------------------------------------------------------------
@@ -396,6 +388,9 @@ JSL.l LoadBombCount
org $098133 ; <- 48133 - ancilla_init.asm : 211 (STA $7EF343 : BNE .bombs_left_over)
JSL.l StoreBombCount
;--------------------------------------------------------------------------------
org $0DE4BF ; <- 6E4BF - equipment.asm : 1249 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs)
JSL.l LoadBombCount16
;--------------------------------------------------------------------------------
org $0DDEB3 ; <- 6DEB3 - equipment.asm : 328 (LDA $7EF33F, X)
JSL.l IsItemAvailable
;--------------------------------------------------------------------------------
@@ -453,12 +448,8 @@ org $02EC8D ; <- bank02.asm : 11981 (LDA.w #$020F : LDX $8A : CPX.w #$0033 : BNE
JSL HardcodedRocks
NOP #19 ;23 bytes removed with the JSL
;--------------------------------------------------------------------------------
;org $04E7AE ; <- bank0E.asm : 4230 (LDA $7EF287 : AND.w #$0020)
;JSL.l TurtleRockPegSolved
;--------------------------------------------------------------------------------
org $1BCAA1 ; <- bank_1B.asm (LDA.w #$0212 : LDX.w #$0720 : STA.l $7E2000,X : JSL : JSL)
JSL.l Overworld_InvertedTRPuzzle
BRA + : NOP #12 : +
org $04E7AE ; <- bank0E.asm : 4230 (LDA $7EF287 : AND.w #$0020)
JSL.l TurtleRockPegSolved
org $04E7B9 ; <- bank0E.asm : 4237 (LDX $04C8)
JMP.w TurtleRockTrollPegs
@@ -475,9 +466,9 @@ PegProbability:
db $00 ; Probability out of 255. 0 = Vanilla behavior
TurtleRockTrollPegs:
SEP #$20
LDX.w $04C8 : CPX.w #$FFFF : BEQ .vanilla
JSL.l GetRandomInt
LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1
LDX.w $04C8 : CPX.w #$FFFF : BEQ .vanilla
JSL.l GetRandomInt
LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1
REP #$20 : !BGE .succeed
.fail
JMP.w TurtleRockPegFail
@@ -502,21 +493,16 @@ JSL.l CheckEnoughCrystalsForTower
NOP #4
db #$90 ; BCC
;--------------------------------------------------------------------------------
org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06)
JML.l GTCutscene_AnimateCrystals_Prep : NOP
LDX.b #$05
GTCutscene_AnimateCrystals_NextCrystal:
JML.l GTCutscene_ConditionalAnimateCrystals
;--------------------------------------------------------------------------------
org $08CE93
GTCutscene_DrawSingleCrystal:
JML.l GTCutscene_ConditionalDrawSingleCrystal
org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06)
JML.l GetRequiredCrystalsForTower
NOP #3
GetRequiredCrystalsForTower_continue:
;--------------------------------------------------------------------------------
org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
JSL.l GTCutscene_ActivateSparkle_SelectCrystal
JSL.l GetRequiredCrystalsInX
;--------------------------------------------------------------------------------
org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
RTL
db #$6B
;--------------------------------------------------------------------------------
;================================================================================
@@ -851,10 +837,10 @@ JSL.l ConditionalWhitenBg
org $02FEE6 ; <- 17EE6 - Bank0E.asm : 3907 (RTS)
RTL ; the whiten color routine is only JSL-ed to
;--------------------------------------------------------------------------------
org $07FA7B ; <- 3FA7B - Bank0E.asm : 4735 (REP #$20 : LDX.b #$02)
org $07FA7B ; <- 3FA7B - Bank0E.asm : 4735 (REP #$20 : LDX.b #$02)
JML DDMConditionalLightning
;--------------------------------------------------------------------------------
org $07FACB ; <- 3FACB - Bank0E.asm : 4773 (REP #$20 : LDA #$F531, Y)
org $07FACB ; <- 3FACB - Bank0E.asm : 4773 (REP #$20 : LDA #$F531, Y)
JSL.l ConditionalGTFlash : BRA + : NOP #11 : +
;--------------------------------------------------------------------------------
org $0AFF48 ; <- 57F48 - Bank0A.asm : 4935 (REP #$20 : LDA $7EC3DA)
@@ -866,7 +852,7 @@ JSL.l ConditionalPedAncilla : BRA + : NOP #4 : +
org $079976 ; <- 039976 - Bank07.asm : 4009 (JSL Palette_ElectroThemedGear)
JSL.l LoadElectroPalette
;--------------------------------------------------------------------------------
org $07997C ; <- 03997C - Bank07.asm : 4015 (JSL LoadActualGearPalettes)
org $07997C ; <- 03997C - Bank07.asm : 4015 (JSL LoadActualGearPalettes)
JSL.l RestoreElectroPalette
;--------------------------------------------------------------------------------
@@ -979,9 +965,6 @@ JSL.l ChestPrep
NOP #3
db $90 ; !BCC .cantOpen
;--------------------------------------------------------------------------------
org $008A9D
JSL ConditionalPushBlockTransfer : NOP
org $00D531 ; 5531 - Bank00.asm:3451 (LDY.b #$5D)
JML.l GetAnimatedSpriteGfxFile
@@ -992,19 +975,9 @@ org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X)
JSL.l GetAnimatedSpriteBufferPointer
NOP
org $05FA50
JSL Sprite_ConditionalPrepOAMCoord
org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem)
JSL.l AddReceivedItemExpanded
org $08C505
JSL Ancilla22_ItemReceipt_ContinueB : NOP #2
org $098605 ; 48605 - ancilla_init.asm:709 (TYA : STA $02E4 : PHX)
JML.l Multiworld_AddReceivedItem_notCrystal
NOP
org $098611 ; 48611 - ancilla_init.asm:720 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X
org $098616 ; 48616 - ancilla_init.asm:721 (LDA .item_target_addr+1, X)
@@ -1057,11 +1030,6 @@ NOP
org $07B57D ; 3B57D - Bank07.asm:8527 (LDA Link_ReceiveItemAlternates, Y : STA $03)
JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate
NOP
org $08C563
JML ItemGetAlternateSFX : NOP
org $0988A5
JSL ItemGetOverworldAlternateSFX : NOP #5
;--------------------------------------------------------------------------------
org $09892E ; 4892E - ancilla_init.asm:1307 (LDA BottleList, X)
LDA.w BottleListExpanded, X
@@ -1078,10 +1046,6 @@ JSL HandleBombAbsorbtion
;org $09873F ; <- 04873F - ancilla_init.asm : 960 (ADC [$00] : STA [$00] )
;JSL.l AddToStock
;--------------------------------------------------------------------------------
org $02EB18
JSL PostOverworldGfxLoad
org $18BD55
JSL PostUnderworldMap
;================================================================================
; Kholdstare Shell Fix
@@ -1317,9 +1281,6 @@ org $08D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253
JSL.l UpgradeFlute
NOP #2
;--------------------------------------------------------------------------------
org $07A408 ; LDA.l $7EF34C
JSL.l FluteCallForDuck
;--------------------------------------------------------------------------------
org $05E4D7 ; <- 2E4D7 - sprite_witch.asm : 213
JSL.l RemoveMushroom
NOP #2
@@ -1327,9 +1288,10 @@ NOP #2
org $05F55F ; <- 2F55F - sprite_potion_shop.asm : 59
JSL.l LoadPowder
;--------------------------------------------------------------------------------
org $05F67B ; <- 2F67B - sprite_potion_shop.asm : 234
JSL DrawPowder
org $05F681 ; <- 2F681 - sprite_potion_shop.asm : 234
JSL.l DrawPowder
RTS
NOP #8
;--------------------------------------------------------------------------------
org $05F65D ; <- 2F65D - sprite_potion_shop.asm : 198
JSL.l CollectPowder
@@ -1337,7 +1299,7 @@ NOP #5
;--------------------------------------------------------------------------------
org $05EE5F ; <- 2EE5F - sprite_mushroom.asm : 30
JSL.l LoadMushroom
BRA + : NOP #7 : +
NOP
;--------------------------------------------------------------------------------
org $05EE78 ; <- 2EE78 - sprite_mushroom.asm : 58
JSL.l DrawMushroom
@@ -1345,34 +1307,6 @@ JSL.l DrawMushroom
org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
NOP #14
;--------------------------------------------------------------------------------
org $06C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_PotionShopLong)
JSL SpritePrep_ShopKeeper_PotionShop
org $05F521
SpritePrep_PotionShopLong:
org $05F539
SpawnMagicPowder:
;--------------------------------------------------------------------------------
org $05F568 ; <- 2F568 - sprite_potion_shop.asm
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item
LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y
JMP $F61D
;--------------------------------------------------------------------------------
org $05F633 ; <- 2F633 - sprite_potion_shop.asm
JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player
PotionShopkeeperJumpTable:
org $05F893 ; <- witch behavior here
Sprite_WitchAssistant:
org $05F644 ; <- powder behavior here
Sprite_MagicPowderItem:
;--------------------------------------------------------------------------------
org $05EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158
JSL.l Multiworld_BottleVendor_GiveBottle
;--------------------------------------------------------------------------------
org $07A36F ; <- 3A36F - Bank07.asm : 5679
NOP #5
org $07A379 ; <- 3A379 - Bank07.asm : 5687
@@ -1384,8 +1318,6 @@ org $07A303 ; 3A303 - Bank07.asm : 5622
org $07A3A2 ; 3A3A2 - Bank07.asm : 5720 - JSL DiggingGameGuy_AttemptPrizeSpawn
JSL.l SpawnShovelItem
BRA _Bank07_5726
org $1DFDAC
JSL.l SpawnShovelGamePrize
org $07A3AB ; 3A3AB - Bank07.asm : 5726 - LDA.b #$12 : JSR Player_DoSfx2
_Bank07_5726:
;org $07A381 ; 3A381 - Bank07.asm : 5693 - ORA $035B
@@ -1810,17 +1742,6 @@ org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace)
JSL.l HUDRebuildIndoorHole
;--------------------------------------------------------------------------------
;================================================================================
; Skull Woods back entrance fire fix
;--------------------------------------------------------------------------------
org $099C42 ; ancilla_init.asm:4264 - (LDA $8A : AND.b #$40 : BEQ AddDoorDebris.spawn_failed)
JML.l Multiworld_ConsumingFire_TransmuteToSkullWoodsFire
NOP #2
ConsumingFire_TransmuteToSkullWoodsFire_continue:
org $099C39
AddDoorDebris_spawn_failed:
;================================================================================
; Pendant / Crystal Fixes
;--------------------------------------------------------------------------------
@@ -1881,13 +1802,13 @@ LDA CrystalPendantFlags_2, X
;NOP #10
;CLC
;================================================================================
;org $0AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail)
;JSL.l OverworldMap_CheckObject : RTS
;org $0AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail)
;JSL.l OverworldMap_CheckObject : RTS
org $0AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail)
JSL.l OverworldMap_CheckObject : RTS
org $0AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail)
JSL.l OverworldMap_CheckObject : RTS
;================================================================================
org $0AC53e ; <- 5453E - Bank0A.asm:1771 - (LDA $0AC50D, X : STA $0D)
LDA.l CrystalNumberTable-1, X
JSL.l GetCrystalNumber
;================================================================================
; EVERY INSTANCE OF STA $7EF3C7 IN THE ENTIRE CODEBASE
org $029D51 ; <- 11D51
@@ -1923,35 +1844,34 @@ JSL.l GetMapMode
org $0AC01A ; <- 5401A
JSL.l GetMapMode
;Overwritten
;org $0AC037 ; <- 54037
;JSL.l GetMapMode
;org $0AC079 ; <- 54079
;JSL.l GetMapMode
;org $0AC0B8 ; <- 540B8 x
;JSL.l GetMapMode
;org $0AC0F8 ; <- 540F8
;JSL.l GetMapMode
;org $0AC137 ; <- 54137
;JSL.l GetMapMode
;org $0AC179 ; <- 54179
;JSL.l GetMapMode
;org $0AC1B3 ; <- 541B3
;JSL.l GetMapMode
;org $0AC1F5 ; <- 541F5
;JSL.l GetMapMode
;org $0AC22F ; <- 5422F
;JSL.l GetMapMode
;org $0AC271 ; <- 54271
;JSL.l GetMapMode
;org $0AC2AB ; <- 542AB
;JSL.l GetMapMode
;org $0AC2ED ; <- 542ED
;JSL.l GetMapMode
;org $0AC327 ; <- 54327
;JSL.l GetMapMode
;org $0AC369 ; <- 54369
;JSL.l GetMapMode
org $0AC037 ; <- 54037
JSL.l GetMapMode
org $0AC079 ; <- 54079
JSL.l GetMapMode
org $0AC0B8 ; <- 540B8 x
JSL.l GetMapMode
org $0AC0F8 ; <- 540F8
JSL.l GetMapMode
org $0AC137 ; <- 54137
JSL.l GetMapMode
org $0AC179 ; <- 54179
JSL.l GetMapMode
org $0AC1B3 ; <- 541B3
JSL.l GetMapMode
org $0AC1F5 ; <- 541F5
JSL.l GetMapMode
org $0AC22F ; <- 5422F
JSL.l GetMapMode
org $0AC271 ; <- 54271
JSL.l GetMapMode
org $0AC2AB ; <- 542AB
JSL.l GetMapMode
org $0AC2ED ; <- 542ED
JSL.l GetMapMode
org $0AC327 ; <- 54327
JSL.l GetMapMode
org $0AC369 ; <- 54369
JSL.l GetMapMode
org $0DC849 ; <- 6C849
JSL.l GetMapMode
@@ -1961,14 +1881,15 @@ NOP #8
;org $0AC012 ; <- 54012 - Bank0A.asm:1039 - (LDA $7EF2DB)
;JSL.l OnLoadMap
;================================================================================
org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A)
JSL CheckHeraBossDefeated : NOP
org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA)
JSL CheckHeraBossDefeated : BNE + : NOP
LDX.b #$F1 : STX $012C
+
;================================================================================
org $028D6E
JSL FallingMusicFadeOut : BRA + : NOP #2 : +
;================================================================================
org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A)
JSL CheckHeraBossDefeated : NOP
org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A : BCS BRANCH_GAMMA)
JSL CheckHeraBossDefeated : BNE + : NOP
STX $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS
+
;================================================================================
org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA)
NOP #6 ; remove crystal room cutscene check that causes softlocks
@@ -2139,9 +2060,6 @@ PHB : JSL.l DarkWorldSaveFix
org $028046 ; <- 10046 - Bank02.asm : 217 (JSL EnableForceBlank) (Start of Module_LoadFile)
JSL.l OnFileLoad
;--------------------------------------------------------------------------------
org $0280A2
JSL GetCurrentWorldForLoad
;--------------------------------------------------------------------------------
org $09F520 ; <- 4F520 - module_death.asm : 401 (LDA $7EF3C5 : CMP.b #$03 : BCS BRANCH_THETA)
JSL.l OnPlayerDead
JSL.l IncrementDeathCounter
@@ -2160,18 +2078,8 @@ JSL FixAgahnimFollowers
org $028823 ; <- 10823 - Bank02.asm:1560 (LDA $7EF3C5 : BEQ .ignoreInput)
JSL.l AllowSQ
;--------------------------------------------------------------------------------
org $08C45F ; <- 4445F - ancilla_recieve_item.asm:157 (STZ $02E9 : LDA $0C5E, X)
Ancilla_ReceiveItem_optimus:
JML.l PostItemAnimation : NOP #2
org $08C548 ; <- 44548 - ancilla_recieve_item.asm:297 (CMP.b #$28 : BNE .dontGiveRupees)
JML.l Multiworld_Ancilla_ReceiveItem_stillInMotion
Ancilla_ReceiveItem_stillInMotion_moveon:
org $08C560 ; <- 44548 - ancilla_recieve_item.asm:307
Ancilla_ReceiveItem_dontGiveRupees:
org $08C45F ; <- 4445F - ancilla_recieve_item.asm:157 (STZ $02E9)
JSL.l PostItemAnimation : NOP #2
;--------------------------------------------------------------------------------
org $1EE90A ; <- F690A
JSL.l ItemCheck_OldMan
@@ -2299,12 +2207,8 @@ JSL.l MarkThrownItem
org $05FAFF ; <- 2FAFF - sprite_mad_batter.asm:57 (LDA $7EF37B : CMP.b #$01 : BCS .magic_already_doubled)
JSL.l ItemCheck_MagicBat : BEQ + : RTS : NOP : +
;================================================================================
org $06BD6C ; <- 33D6C - sprite_middle_aged_man.asm:143 (JSL Link_ReceiveItem)
JSL.l Multiworld_MiddleAgedMan_ReactToSecretKeepingResponse
org $06BE81 ; <- 33E81 - sprite_hobo.asm:150 (JSL Link_ReceiveItem)
JSL.l Multiworld_Hobo_GrantBottle
org $0589B4 ; <- 289B4 ; sprite_master_sword.asm:183 (JSL Link_ReceiveItem)
JSL.l Multiworld_MasterSword_GrantToPlayer
;================================================================================
; Boss Hearts
;--------------------------------------------------------------------------------
@@ -2338,16 +2242,10 @@ AddReceivedItem_doneWithSoundEffects:
org $05F030 ; <- 2F030 - display item
JSL.l DrawHeartPieceGFX
;--------------------------------------------------------------------------------
; moving LinkBusy check to later time to avoid a delay in HP movement
org $05F037 ; (JSL CheckIfLinkIsBusy : BCS .exit)
BRA + : NOP #4 : +
org $05F083
JSL.l HeartPieceSpawnDelayFix
;--------------------------------------------------------------------------------
org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .got_4_piecese) item determination
JSL.l HeartPieceGet
BCS $18 ; reinsert the near branch that appears midway through what we overrode
BRA + : NOP #20 : +
NOP #22
;--------------------------------------------------------------------------------
org $06C0B0 ; <- 340B0 - sprite prep
JSL.l HeartPieceSpritePrep
@@ -2382,20 +2280,18 @@ JSL.l OnLinkDamagedFromPit
org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D)
JSL.l OnLinkDamagedFromPitOutdoors
;--------------------------------------------------------------------------------
;org $078F27 ; <- 38F27
;JSL.l FlipperReset
org $078F27 ; <- 38F27
JSL.l FlipperReset
;--------------------------------------------------------------------------------
org $02B468
dw FakeFlipperProtection
dw FakeFlipperProtection
org $02FFC7
FakeFlipperProtection:
JSR.w $029485
JSL protectff
RTS
;--------------------------------------------------------------------------------
org $02B46C ; <- bank_02.asm:9722 (STZ.b $00 : STZ.b $02)
JSL FlipperScrollWarp
;--------------------------------------------------------------------------------
;org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00)
;JSL.l IgnoreFairyCheck
@@ -2436,7 +2332,7 @@ JSL.l FreeDuckCheck : BEQ +
+
;================================================================================
org $07A9AC ; <- 3A9AC - Bank07.asm:6628 (LDA $0C : ORA $0E : STA $00 : AND.b #$0C : BEQ BRANCH_BETA)
JML MirrorBonk
JML.l MirrorBonk
MirrorBonk_NormalReturn:
org $07A9D1 ; <- 3A9D1 - Bank07.asm:6649 (BRANCH_GAMMA:)
MirrorBonk_BranchGamma:
@@ -2483,9 +2379,6 @@ NOP #6 ; remove check
org $068841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X)
JSL.l Mantle_CorrectPosition : NOP #2
;--------------------------------------------------------------------------------
org $0297FD ; <- bank02 : Module07_19_MirrorFade (STZ.b $11 : STZ.b $14)
JSL MirrorScrollSpawnZelda
;--------------------------------------------------------------------------------
org $0DFA53 ; <- 6FA53 - hud check for lantern
JSL.l LampCheck
;--------------------------------------------------------------------------------
@@ -2559,58 +2452,50 @@ JSL Overworld_MosaicDarkWorldChecks : NOP
org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18)
JSL PsychoSolder_MusicCheck
NOP #1
;
org $06F96A
JSL PsychoSolder_MusicCheck
NOP #1
;--------------------------------------------------------------------------------
org $02B13A ; <- Bank02.asm:7647
dl Overworld_FinishMirrorWarp
;--------------------------------------------------------------------------------
org $0AB949 ; <- Bank0A.asm:270 (Different from US ROM)
JSL BirdTravel_LoadTargetAreaMusic
BRA + : NOP #14 : +
;--------------------------------------------------------------------------------
org $02B027 ; <- Bank02.asm:7535-7541
JSL Overworld_DetermineMusic
BRA + : NOP #42 : +
NOP #16
;================================================================================
;================================================================================
; Hooks for roomloading.asm
;--------------------------------------------------------------------------------
org $02895D ; <- Bank02.asm:1812 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook
JSL LoadRoomHook
;--------------------------------------------------------------------------------
org $028BE7 ; <- Bank02.asm:2299 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
JSL LoadRoomHook_noStats
;--------------------------------------------------------------------------------
org $029309 ; <- Bank02.asm:3533 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
JSL LoadRoomHook_noStats
;--------------------------------------------------------------------------------
org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
JSL LoadRoomHook_noStats
;================================================================================
;================================================================================
; Hooks into the "Reloading all graphics" routine
;--------------------------------------------------------------------------------
org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02)
JML BgGraphicsLoading
BgGraphicsLoadingCancel:
RTS : NOP
BgGraphicsLoadingResume:
JML BgGraphicsLoading
BgGraphicsLoadingCancel:
RTS : NOP
BgGraphicsLoadingResume:
;================================================================================
;================================================================================
; Hook when updating the floor tileset in dungeons (such as between floors)
;--------------------------------------------------------------------------------
org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
JML ReloadingFloors
NOP : NOP
ReloadingFloorsResume:
JML ReloadingFloors
NOP : NOP
ReloadingFloorsResume:
org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit
ReloadingFloorsCancel:
ReloadingFloorsCancel:
;================================================================================
;================================================================================
@@ -2639,14 +2524,7 @@ JSL.l QuickSwap
org $0689AB ; <- 309AB - sprite_prep.asm: 647 (LDA $7EF3CC : CMP.b #$06 : BEQ .killSprite)
; Note: In JP 1.0 we have: (CMP.b #$00 : BNE .killSprite) appling US bugfix
; Prevent followers from causing blind/maiden to despawn:
; Door rando: let zelda despawn the maiden.
JSL BlindZeldaDespawnFix
org $0689AF
SpritePrep_BlindMaiden_despawn_follower: ; this is the normal execution path
org $0689C9
SpritePrep_BlindMaiden_kill_the_girl: ; not the follower
CMP.b #$06 : db #$F0 ; BEQ
;--------------------------------------------------------------------------------
; Fix old man purple chest issues using the same method as above
org $1EE906 ; <- F6906 - sprite_old_mountain_man.asm : 31 (LDA $7EF3CC : CMP.b #$00 : BNE .already_have_tagalong)
@@ -2730,8 +2608,8 @@ JSL NewElderCode
;--------------------------------------------------------------------------------
; Add him to Castle Map post-rain, and post aga1
;--------------------------------------------------------------------------------
org $09D0A9
db #$18, #$0A, #$D8, #$18, #$0F, #$43, #$FF;remove heart from tree adjancent map [LW1]
org $09D0AC
db #$18, #$0F, #$43, #$FF;remove heart from tree adjancent map [LW1]
db #$12, #$19, #$16 ;add sahasrala in castle Y, X, Sprite ID
org $09C937
db #$B0, #$D0 ;change [LW1] map 01C pointers
@@ -2896,176 +2774,6 @@ org $0AEEF2
org $008BE5 ; hijack stripes for boss GFX transfer
JSL DoDungeonMapBossIcon
;================================================================================
; Terrorpin AI fix
;--------------------------------------------------------------------------------
org $1EB2B1 ; sprite_terrorpin.asm(57) : AND.b #$03 : STA $0DE0, X ; 5 bytes
JSL FixTerrorpin ; 4 bytes
NOP ; 1 byte
;--------------------------------------------------------------------------------
;================================================================================
; Bomb-Only Mode
;--------------------------------------------------------------------------------
org $06ECC3 ; Bank06.asm@4704 (PHX : TAX : LDA.l .damage_classes, X : PLX)
JSL DamageClassCalc
BRA + : NOP #29 : +
;--------------------------------------------------------------------------------
org $0882D4 ; Bank08.asm@445 (PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #5 : +
;--------------------------------------------------------------------------------
org $088DB1 ; Bank08.asm@1207 (PHY : PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #7 : +
;--------------------------------------------------------------------------------
org $08E252 ; Bank08.asm@1770 (PHY : PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #7 : +
;--------------------------------------------------------------------------------
org $0882E8 ; Bank08.asm@456 (LDA $0DB0, Y : CMP.b #$03)
JSL Utility_CheckHelmasaurKingCollision
NOP
;--------------------------------------------------------------------------------
org $06ED94 ; Bank06.asm@4866 (LDA $0E60, X : AND.b #$40)
JSL Utility_CheckImpervious
NOP
;--------------------------------------------------------------------------------
org $068F94 ; sprite_prep.asm@1984 (INC $0BA0, X : JSL Sprite_InitializedSegmented)
JSL AllowBombingMoldorm
BRA + : NOP : +
;--------------------------------------------------------------------------------
org $06892F ; sprite_prep.asm@548 (LDA $0D00, X : SUB #$0C : STA $0D00, X : ...)
JSL AllowBombingBarrier
RTS : NOP #7
;--------------------------------------------------------------------------------
org $0DE4BF ; equipment.asm@1247 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs : ...)
JSL DrawBombInMenu
BRA + : NOP #13 : +
;--------------------------------------------------------------------------------
org $0DFB6A ; headsup_display@727 (CPX #$0004 : BNE .bombsNotEquipped : LDA #$0001)
JSL DrawBombInYBox
BRA + : NOP #2 : +
;--------------------------------------------------------------------------------
org $0DEE05 ; equipment.asm@2065 (LDA $7EF359 : AND.w #$00FF : CMP.w #$00FF : ...)
JSL DrawSwordInMenu
BRA + : NOP #16 : +
;--------------------------------------------------------------------------------
org $0DFA92 ; headsup_display.asm@622 (PDB : LDA.w #$0149 : ...)
JSL DrawBombOnHud
BRA + : NOP #8 : +
;--------------------------------------------------------------------------------
org $089EF8 ; ancilla_bomb@1438 (LDA.w #$04 : STA $0B)
JSL SetBombSpriteColor
;--------------------------------------------------------------------------------
; bomb icons with numbers
org $0DFC51 ; we freed this up earlier in hooks; probably shouldn't use it but *shrug*
db $F5, $20, $F5, $20, $F5, $20, $F5, $20
db $B2, $3C, $B3, $3C, $C2, $3C, $17, $3C
db $B2, $2C, $B3, $2C, $C2, $2C, $18, $2C
db $B2, $24, $B3, $24, $C2, $24, $19, $24
db $B2, $28, $B3, $28, $C2, $28, $1A, $28
db $B2, $28, $B3, $28, $C2, $28, $1B, $28
; bomb icons without numbers
; $0DFC81
db $F5, $20, $F5, $20, $F5, $20, $F5, $20
db $B2, $3C, $B3, $3C, $C2, $3C, $C2, $7C
db $B2, $2C, $B3, $2C, $C2, $2C, $C2, $6C
db $B2, $24, $B3, $24, $C2, $24, $C2, $64
db $B2, $28, $B3, $28, $C2, $28, $C2, $68
db $B2, $28, $B3, $28, $C2, $28, $C2, $68
warnpc $0DFC51+197 ; we only filled in 197 NOPs so don't overwrite past that
;--------------------------------------------------------------------------------
org $1EDCF8 ; bank_1E.asm@16086 (LDX $0202 : ...)
JSL SetBeeType
BRA + : NOP #15 : +
;--------------------------------------------------------------------------------
org $1EB5E8 ; bank_1E.asm@9387 (LDA #$03 : STA $0D80, X)
JSL ArrghusBoing
;--------------------------------------------------------------------------------
org $1EDFAF ; bank_1E.asm@16607 (.next_sprite)
JSL BeeCheckTarget
BCS .bee_valid_target
BRA .bee_unsuitable_target
NOP #48
.bee_unsuitable_target
skip 11
.bee_valid_target
;--------------------------------------------------------------------------------
org $07F889 ; free rom from F877 - F88F; the starting part of this is used in quadrant glitch fix in overworld fork, however.
Link_UseItemLong:
PER .done-1
JMP.w ($0000)
.done
RTL
warnpc $07F890
;--------------------------------------------------------------------------------
org $06F2DC ; bank_06.asm@22763 (LDA.w $037A : AND.b #$10)
JSL CheckBugNet : NOP
org $06EB91 ; bank_06.asm@21178 (LDA.w $037A : AND.b #$10)
JSL CheckBugNet : NOP
;--------------------------------------------------------------------------------
org $06ED77 ; bank_06.asm@21597 (LDA.w $0301 : AND.b #$0A : ...)
JSL SetHammerClass
BRA + : NOP #7 : +
;--------------------------------------------------------------------------------
;================================================================================
; Variable Ganon Vulnerability
;--------------------------------------------------------------------------------
org $08BBD4 ; ancilla_magic_powder.asm@253 (LDA #$0A : JSL Ancilla_CheckSpriteDamage.preset_class)
JSL Ganon_CheckPowderVulnerability
NOP #2
;--------------------------------------------------------------------------------
org $1D8F4E ; sprite_ganon.asm@325 (LDA $04C5 : CMP #$02)
JSL Ganon_CheckInvincible
NOP
;--------------------------------------------------------------------------------
org $0DD628 ; Bank0D.asm@1266 (LDA $0B6B, Y : AND #$02)
JSL CheckBeeBoss
NOP
;--------------------------------------------------------------------------------
org $0DD676 ; Bank0D.asm@1303 (TYX : JSL Ancilla_CheckSpriteDamage.preset_class)
JSL Ganon_CheckBeeVulnerability
NOP
;--------------------------------------------------------------------------------
;================================================================================
; Pseudo-Sword Mode
;--------------------------------------------------------------------------------
org $06ED70 ; Bank06.asm@4842 (LDA $06ED39, X : STA $0CF2)
JSL StoreSwordDamage
;================================================================================
; Item-On-B
;--------------------------------------------------------------------------------
org $0DEB3C
JSL DrawBIndicator : BRA + : NOP #3 : +
;--------------------------------------------------------------------------------
org $079CE6 ; Bank07.asm@4632 (LDA #$80 : TSB $3A : ...)
JSL UseItem
BCC + : RTS : +
JSR $9C56
NOP #1
;--------------------------------------------------------------------------------
;================================================================================
; Fix quadrant glitch
org $07A879
JSR SwordSpinQuadrantFix
org $07F877 ; free rom
SwordSpinQuadrantFix:
LDA.l AllowAccidentalMajorGlitch
BEQ ++
JMP.w $07E8D9 ; HandleIndoorCameraAndDoors
++ RTS
warnpc $07F88C ; hammer-on-B hook uses the end of this free rom section
;================================================================================
org $01C4B8 : JSL FixJingleGlitch
@@ -3074,61 +2782,34 @@ org $01C592 : JSL FixJingleGlitch
org $01C65F : JSL FixJingleGlitch
;================================================================================
; Hooks for when submenu opens
;--------------------------------------------------------------------------------
org $028818
JSL OnMenuLoad
org $02A463
JSL OnMenuLoad
;--------------------------------------------------------------------------------
; Text Renderer
;--------------------------------------------------------------------------------
if !FEATURE_NEW_TEXT
org $0EF51B
JML RenderCharExtended
org $0EF520
RenderCharExtended_returnOriginal:
org $0EF567
RenderCharExtended_returnUncompressed:
org $0EF51B
JML RenderCharExtended
org $0EF520
RenderCharExtended_returnOriginal:
org $0EF567
RenderCharExtended_returnUncompressed:
org $0EF356
JSL RenderCharLookupWidth
org $0EF3BA
JSL RenderCharLookupWidth
org $0EF48E
JML RenderCharLookupWidthDraw
org $0EF499
RenderCharLookupWidthDraw_return:
org $0EF356
JSL RenderCharLookupWidth
org $0EF3BA
JSL RenderCharLookupWidth
org $0EF48E
JML RenderCharLookupWidthDraw
org $0EF499
RenderCharLookupWidthDraw_return:
org $0EF6AA
JML RenderCharToMapExtended
org $0EF6C2
RenderCharToMapExtended_return:
org $0EF6AA
JML RenderCharToMapExtended
org $0EF6C2
RenderCharToMapExtended_return:
org $0EFA50
JSL RenderCharSetColorExtended
org $0EEE5D
JSL RenderCharSetColorExtended_init
org $0EF285
JSL RenderCharSetColorExtended_close : NOP
org $0EFA50
JSL RenderCharSetColorExtended
org $0EEE5D
JSL RenderCharSetColorExtended_init
org $0EF285
JSL RenderCharSetColorExtended_close : NOP
endif
;--------------------------------------------------------------------------------
; Back of tavern fixes
;--------------------------------------------------------------------------------
org $028177 ; JSL Underworld_LoadCustomTileAttributes
JSL TurnAroundOnUnderworld
org $02ABC1 ; JSL Link_HandleMovingAnimation_FullLongEntry
JSL TurnUpOnOverworld
org $02E297 ; LDA.w #$0002 : STA.b $2F
JSL WalkUpOnOverworld
NOP
org $02E36F
JSL CheckStairsAdjustment
NOP
org $02D7D2 ; BEQ .face_up
NOP #2 ; this fixes Link's direction after mirroring and falling after entering through back of tavern

View File

@@ -10,7 +10,6 @@ Init_Primary:
LDX #$00 ; initalize our ram
-
STA $7EC025, X
STA $7EC035, X
STA $7F5000, X
INX
CPX #$10 : !BLT -

View File

@@ -15,6 +15,7 @@ fillword $0000 ; Zero out the table
fill $500 ;
org $30B000 ; PC 0x183000
InitSRAMTable:
InitRoomDataWRAM:
org $30B060 ; PC 0x183060
InitATAltarRoom: dw $0000 ; aga curtains
@@ -81,8 +82,8 @@ StartingHealth: db $18 ; PC 0x18336C
StartingMaximumHealth: db $18 ; PC 0x18336D
StartingMagic: skip 1 ; PC 0x18336E
StartingSmallKeys: db $FF ; PC 0x18336F
StartingBombCapacityUpgrade: skip 1 ; PC 0x183370
StartingArrowCapacityUpgrade: skip 1 ; PC 0x183371
StartingBombCapacity: db $0A ; PC 0x183370
StartingArrowCapacity: db $1E ; PC 0x183371
InitHeartsFiller: skip 1 ; PC 0x183372
InitMagicFiller: skip 1 ; PC 0x183373
StartingPendants: skip 1 ; PC 0x183374
@@ -150,13 +151,13 @@ org $30B414 ; PC 0x183414-0x183416
InitMapOverlay: dw $0000
org $30B417 ; PC 0x183417
InitHighestSword: db $00
InitProgressiveSwords: db $00
org $30B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422
InitHighestShield: db $00
InitProgressiveShields: db $00
org $30B428 ; PC 0x183428
InitMapsCompasses: db $00

View File

@@ -30,10 +30,9 @@
ProcessMenuButtons:
;LDA #$FD : STA InventoryTracking ; DEBUG MODE
;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button
LDA.b $F4 : BIT.b #$40 : BNE .y_pressed ; check for P1 Y-button
BIT.b #$20 : BNE .sel_pressed ; check for P1 Select button
BIT.b #$80 : BNE .b_pressed ; check for P1 B-button
LDA.b $F0 : BIT.b #$20 : BNE .sel_held
LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button
BIT #$20 : BNE .sel_pressed ; check for P1 Select button
LDA $F0 : BIT #$20 : BNE .sel_held
.sel_unheld
LDA HudFlag : AND #$20 : BEQ +
LDA HudFlag : AND #$DF : STA HudFlag ; select is released, unset hud flag
@@ -49,18 +48,6 @@ RTL
LDA HudFlag : ORA #$20 : STA HudFlag ; set hud flag
LDA.b #$20 : STA $012F ; menu select sound
JSL.l ResetEquipment
RTL
.b_pressed
JSR CanPressB : BCC .b_error
LDA.w $0202 : CMP.l ItemOnB : BNE .set_b
LDA.b #$00
.set_b
STA.l ItemOnB
BRA .b_done
.b_error
LDA.b #$3C : STA.w $012E ; error sound
.b_done
SEC
RTL
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
LDA.b #$10 : STA $0207
@@ -128,27 +115,6 @@ RTL
SEC
RTL
;--------------------------------------------------------------------------------
CanPressB:
PHY : PHP : SEP #$30
LDA.l AllowedItemOnB : BEQ .no
CMP.b #$FF : BEQ .skip_allow_check
CMP.w $0202 : BNE .no
.skip_allow_check
PHX
LDA.w $0202 : TAX
LDA.l ValidItemOnB, X : BNE .plx_and_no
PLX
PLP : PLY
SEC
RTS
.plx_and_no
PLX
.no
PLP : PLY
CLC
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;ProcessBottleMenu:
@@ -180,7 +146,7 @@ RTL
OpenBottleMenu:
LDA $F6 : AND #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA $0207 ; set 16 frame cool off
LDA.b #$20 : STA $012F ; make menu sound
LDA.b #$20 : STA $012F ; make menu sound
LDA.b #$07 : STA $0200 ; thing we wrote over - opens bottle menu
.x_not_pressed
RTL
@@ -193,10 +159,10 @@ CloseBottleMenu:
LDA $F6 : AND #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA $0207 ; set 16 frame cool off
LDA.b #$20 : STA $012F ; make menu sound
LDA.b #$20 : STA $012F ; make menu sound
INC $0200 ; return to normal menu
STZ $0205
STZ $0205
LDA #$00
RTL
@@ -230,11 +196,6 @@ FullInventoryExternal:
;--------------------------------------------------------------------------------
AddInventory:
PHA : PHX : PHP
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
BRL .incrementCounts
+
CPY.b #$0C : BNE + ; Blue Boomerang
LDA InventoryTracking : ORA #$80 : STA InventoryTracking
JMP .incrementCounts
@@ -282,19 +243,12 @@ AddInventory:
.incrementCounts
LDA StatsLocked : BEQ + : JMP .done : +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
BRL .dungeonCounts
+
; don't count any of this stuff
CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal
CPY.b #$26 : BNE + : JMP .itemCounts : + ; Heart Piece Completion Heart
LDA.l !SHOP_ENABLE_COUNT : BNE ++
CPY.b #$2E : BNE + : JMP .itemCounts : + ; Red Potion (Refill)
CPY.b #$2F : BNE + : JMP .itemCounts : + ; Green Potion (Refill)
CPY.b #$30 : BNE + : JMP .itemCounts : + ; Blue Potion (Refill)
++
CPY.b #$2E : BNE + : JMP .itemCounts : + ; Red Potion (Refill)
CPY.b #$2F : BNE + : JMP .itemCounts : + ; Green Potion (Refill)
CPY.b #$30 : BNE + : JMP .itemCounts : + ; Blue Potion (Refill)
CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$38 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$39 : BNE + : JMP .itemCounts : + ; Pendant
@@ -309,7 +263,7 @@ AddInventory:
+
CPY.b #$3B : BNE + : JMP .dungeonCounts : + ; Silver Arrow Bow - Skip Shop/Fairy Check for Silver Arrow Bow
LDA $1B : BNE + : JMP .dungeonCounts : + ; skip shop check if outdoors
LDA $1B : BEQ ++ ; skip shop check if outdoors
LDA $02E9 : CMP.b #$01 : BEQ ++ ; skip shop check for chests
PHP : REP #$20 ; set 16-bit accumulator
LDA $048E
@@ -317,41 +271,35 @@ AddInventory:
CMP.w #271 : BNE + : JMP .shop : + ; villiage of outcasts shop, lumberjack shop, lake hylia shop, dark world magic shop
CMP.w #272 : BNE + : JMP .shop : + ; red shield shop
CMP.w #284 : BNE + : JMP .shop : + ; bomb shop
CMP.w #265 : BNE + : JMP .shop : + ; potion shop - commented this out because it's easier to just block potion refills because this one interferes with the powder item being counted
CMP.w #287 : BNE + : LDA.b $A9 : CMP.w #$0201 : BNE + ; kakariko shop
JMP .shop : + LDA.b $A0
CMP.w #255 : BNE + : LDA.b $A9 : BNE + ; light world death mountain shop
JMP .shop : + LDA.b $A0
CMP.w #276 : BNE + : LDA.b $A9 : CMP.w #$0200 : BNE + ; waterfall fairy
JMP .shop : + LDA.b $A0
;CMP.w #265 : BNE + : JMP .shop : + ; potion shop - commented this out because it's easier to just block potion refills because this one interferes with the powder item being counted
;CMP.w #271 : BNE + : JMP .shop : + ; lake hylia shop
CMP.w #287 : BNE + : JMP .shop : + ; kakariko shop
CMP.w #255 : BNE + : JMP .shop : + ; light world death mountain shop
CMP.w #276 : BNE + : JMP .shop : + ; waterfall fairy
CMP.w #277 : BNE + : JMP .shop : + ; upgrade fairy (shop)
CMP.w #278 : BNE + : JMP .shop : + ; pyramid fairy
PLP : BRA ++
.shop
PLP
LDA.l !SHOP_ENABLE_COUNT : BNE ++
JMP .done
PLP : JMP .done
++
.dungeonCounts
LDA !MULTIWORLD_RECEIVING_ITEM : CMP #$01 : BNE +
JMP .fullItemCounts
+
LDA $1B : BNE + : JMP .fullItemCounts : +
SEP #$20 ; Set 8-bit Accumulator
LDA $040C ; get dungeon id
BNE +
INC #2 ; treat sewers as HC
+ CMP #$FF : BEQ .fullItemCounts
CMP.b #$FF : BEQ .fullItemCounts
CMP.l BallNChainDungeon : BNE +
CMP.l BallNChainDungeon : BNE +
CPY.b #$32 : BNE +
JMP .done
+ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
CPX.b #$0D : BNE +
JMP .done
+
CMP.b #$04 : BCS +
LDA SewersLocations : INC : STA SewersLocations
LDA HCLocations : INC : STA HCLocations
BRA .fullItemCounts
+ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
++ CPX.b #$0D : BNE +
LDA BigKeyField : AND #$04 : BNE ++
JSR .incrementGTowerPreBigKey
++
@@ -359,62 +307,35 @@ AddInventory:
; == END INDOOR-ONLY SECTION
.fullItemCounts
LDA !MULTIWORLD_RECEIVING_ITEM : CMP #$01 : BEQ ++
LDA BootsEquipment : BNE + ; Check for Boots
REP #$20
LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter
SEP #$20
+
LDA BootsEquipment : BNE + ; Check for Boots
LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter
+
LDA MirrorEquipment : BNE + ; Check for Mirror
REP #$20
LDA PreMirrorLocations : INC : STA PreMirrorLocations ; Increment Pre Mirror Counter
SEP #$20
+
LDA FluteEquipment : BNE + ; Check for Flute
REP #$20
LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Flute Counter
SEP #$20
+
REP #$20
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
SEP #$20
++
LDA MirrorEquipment : BNE + ; Check for Mirror
LDA PreMirrorLocations : INC : STA PreMirrorLocations ; Increment Pre Mirror Counter
+
LDA FluteEquipment : BNE + ; Check for Flute
LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter
+
REP #$20
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
SEP #$20
.itemCounts
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
BRL .done
+
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
LDX #$01
JSR .incrementSword
JSR .incrementShield
JSR .stampSword
JMP .done
+ CPY.b #$01 : BNE + ; Master Sword
LDX #$02
JSR .incrementSword
JSR .stampSword
JMP .done
+ CPY.b #$02 : BNE + ; Tempered Sword
LDX #$03
JSR .incrementSword
JSR .stampSword
JMP .done
+ CPY.b #$03 : BNE + ; Golden Sword
LDX #$04
JSR .incrementSword
JMP .done
+ CPY.b #$04 : BNE + ; Fighter's Shield
LDX #$01
JSR .incrementShield
JMP .done
+ CPY.b #$05 : BNE + ; Red Shield
LDX #$02
JSR .incrementShield
JMP .done
+ CPY.b #$06 : BNE + ; Mirror Shield
LDX #$03
JSR .incrementShield
JSR .stampSword
JMP .done
+ CPY.b #$07 : !BLT + ; Items $07 - $0D
CPY.b #$0E : !BGE +
@@ -448,22 +369,22 @@ AddInventory:
JMP .done
+ CPY.b #$20 : BNE + ; Crystal
JSR .incrementCrystal
JSR .setDungeonCompletion
JSR .setDungeonCompletion
JMP .done
+ CPY.b #$21 : BNE + ; Bug Net
JSR .incrementY
JMP .done
+ CPY.b #$22 : BNE + ; Blue Mail
LDX #$01
JSR .incrementMail
LDX #$01
JSR .incrementMail
+ CPY.b #$23 : BNE + ; Red Mail
LDX #$02
JSR .incrementMail
LDX #$02
JSR .incrementMail
+ CPY.b #$24 : BNE + ; Small Key
JSR .incrementKey
JMP .done
+ CPY.b #$25 : BNE + ; Compass
JSL MaybeFlagCompassTotalPickup
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass
JMP .done
+ CPY.b #$26 : BNE + ; Liar Heart (Container)
@@ -494,7 +415,7 @@ AddInventory:
+ CPY.b #$37 : !BLT + ; Items $37 - $39 - Pendants
CPY.b #$3A : !BGE +
JSR .incrementPendant
JSR .setDungeonCompletion
JSR .setDungeonCompletion
JMP .done
+ CPY.b #$3A : !BLT + ; Items $3A - $3B - Bow & Silver Arrows
CPY.b #$3C : !BGE +
@@ -514,8 +435,7 @@ AddInventory:
JSR .incrementY
JMP .done
+ CPY.b #$49 : BNE + ; Fighter's Sword
LDX #$01
JSR .incrementSword
JSR .stampSword
JMP .done
+ CPY.b #$4A : BNE + ; Flute (Active)
JSR .stampFlute
@@ -534,15 +454,14 @@ AddInventory:
JSR .incrementCapacity
JMP .done
+ CPY.b #$50 : BNE + ; Master Sword (Safe)
LDX #$02
JSR .incrementSword
JSR .stampSword
JMP .done
+ CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade
LDX #$02
LDX #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$52 : BNE + ; 10 Bomb Capacity Upgrade
LDX #$02
LDX #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
@@ -553,15 +472,14 @@ AddInventory:
JSR .incrementBow
JMP .done
+ CPY.b #$5E : BNE + ; Progressive Sword
LDA SwordEquipment : INC : TAX
JSR .incrementSword
JSR .stampSword
LDA.l ProgressiveSwords : INC : STA.l ProgressiveSwords
JMP .done
+ CPY.b #$5F : BNE + ; Progressive Shield
LDA ShieldEquipment : INC : TAX
JSR .incrementShield
LDA.l ProgressiveShields : INC : STA.l ProgressiveShields
JMP .done
+ CPY.b #$60 : BNE + ; Progressive Armor
LDA ArmorEquipment : INC : TAX
LDA ArmorEquipment : INC : TAX
JSR .incrementMail
JMP .done
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove
@@ -576,31 +494,18 @@ AddInventory:
JSR .incrementMap
JMP .done
+ CPY.b #$80 : !BLT + ; Items $80 - $8F - Free Compasses
; there was a bug for all loot ID's >$7F
LDA.w AddReceivedItemExpanded_item_target_addr+$100, X : STA.b $00
LDA.w AddReceivedItemExpanded_item_target_addr+$101, X : STA.b $01
CPY.b #$90 : !BGE +
JSL MaybeFlagCompassTotalPickup
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass
BRA .done
JMP .done
+ CPY.b #$90 : !BLT + ; Items $90 - $9F - Free Big Keys
CPY.b #$A0 : !BGE +
JSR .incrementBigKey
BRA .done
JMP .done
+ CPY.b #$A0 : !BLT + ; Items $A0 - $AF - Free Small Keys
CPY.b #$B0 : !BGE +
JSR .incrementKey
BRA .done
+ CPY.b #$C0 : BEQ .special_weapon ; Item $C0 - Bomb Upgrade
CPY.b #$C1 : BEQ .special_weapon ; Item $C1 - Cane Upgrade
CPY.b #$C2 : BEQ .special_weapon ; Item $C2 - Bug Net Upgrade
BRA .done
.special_weapon
JSR .stampSword ; update "first bomb" timestamp
LDA.l SpecialWeaponLevel ; get current bomb level
CMP #$05 : !BGE ++ ; check if already maxed
INC : STA.l SpecialWeaponLevel
++ BRA .done
JMP .done
+
.done
PLP : PLX : PLA
@@ -648,23 +553,8 @@ RTS
SEP #$20 ; set 8-bit accumulator
RTS
.incrementSword
JSR .stampSword
LDA HighestSword
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better sword
TXA : STA HighestSword
+
RTS
.incrementShield
LDA HighestShield
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better shield
TXA : STA HighestShield
+
RTS
.incrementBow
LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
.incrementY
LDA YAItemCounter : !ADD #$08 : STA YAItemCounter
.dontCount
@@ -697,10 +587,10 @@ RTS
RTS
.incrementMail
LDA HighestMail
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better mail
TXA : STA HighestMail
+
LDA HighestMail
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better mail
TXA : STA HighestMail
+
RTS
.incrementKeyLong
@@ -708,7 +598,7 @@ RTS
RTL
.incrementKey
LDA SmallKeyCounter : INC : STA SmallKeyCounter
LDA SmallKeyCounter : INC : STA SmallKeyCounter
RTS
.incrementCompass
@@ -720,7 +610,7 @@ RTS
RTS
.incrementGTowerPreBigKey
LDA PreGTBKLocations : INC : STA PreGTBKLocations
LDA PreGTBKLocations : INC : STA PreGTBKLocations
RTS
.maybeIncrementBombs
@@ -739,17 +629,10 @@ RTS
RTL
.incrementBossSword
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BEQ +
CMP.b #$03 : BEQ +
CMP.b #$04 : BEQ +
CMP.b #$05 : BEQ +
CMP.b #$08 : BEQ +
LDA SwordEquipment : BRA ++
+ : LDA SpecialWeaponLevel
++
LDA SwordEquipment
BNE + : -
LDA SwordlessBossKills : INC : STA SwordlessBossKills
RTS
LDA SwordlessBossKills : INC : STA SwordlessBossKills
RTS
+ CMP #$FF : BEQ -
+ CMP #$01 : BNE +
%TopHalf(SwordBossKills) : RTS
@@ -777,7 +660,7 @@ RTS
;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh:
LDA BombsEquipment : BNE + ; skip if we have bombs
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA BombsFiller : BEQ + ; skip if we are filling no bombs
DEC : STA BombsFiller ; decrease bomb fill count
LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
@@ -794,7 +677,7 @@ RTL
HandleBombAbsorbtion:
STA BombsFiller ; thing we wrote over
LDA $0303 : BNE + ; skip if we already have some item selected
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA $0202 ; set selected item to bombs
LDA.b #$01 : STA $0303 ; set selected item to bombs
JSL.l HUD_RebuildLong
@@ -821,7 +704,6 @@ AddYMarker:
+ CMP.w #$10 : BEQ .drawJarMarker
.drawNormal
JSR CanPressB : BCS .drawBBubble
LDA.w #$7C60
BRA .drawTile
@@ -830,20 +712,12 @@ AddYMarker:
LDA $0207 : AND.w #$0020 : BNE .drawXBubble
.drawYBubble
JSR CanPressB : BCC .drawY
LDA.w $0207 : AND.w #$0020 : BNE .drawBBubble
.drawY
LDA.w #$3D4F
BRA .drawTile
.drawXBubble
JSR MakeCircleBlue
LDA.w #$2D3E
BRA .drawTile
.drawBBubble
JSR MakeCircleRed
LDA.w #$293F
.drawTile
STA $FFC4, Y
@@ -855,40 +729,22 @@ RTL
; this is horrible, make it better
;--------------------------------------------------------------------------------
MakeCircleBlue:
LDA $FFC0, Y : AND.w #$EFFF : STA $FFC0, Y
LDA $FFC2, Y : AND.w #$EFFF : STA $FFC2, Y
LDA $FFC0, Y : AND.w #$EFFF : STA $FFC0, Y
LDA $FFC2, Y : AND.w #$EFFF : STA $FFC2, Y
LDA $FFFE, Y : AND.w #$EFFF : STA $FFFE, Y
LDA $0004, Y : AND.w #$EFFF : STA $0004, Y
LDA $FFFE, Y : AND.w #$EFFF : STA $FFFE, Y
LDA $0004, Y : AND.w #$EFFF : STA $0004, Y
LDA $003E, Y : AND.w #$EFFF : STA $003E, Y
LDA $0044, Y : AND.w #$EFFF : STA $0044, Y
LDA $003E, Y : AND.w #$EFFF : STA $003E, Y
LDA $0044, Y : AND.w #$EFFF : STA $0044, Y
LDA $0080, Y : AND.w #$EFFF : STA $0080, Y
LDA $0082, Y : AND.w #$EFFF : STA $0082, Y
LDA $0080, Y : AND.w #$EFFF : STA $0080, Y
LDA $0082, Y : AND.w #$EFFF : STA $0082, Y
LDA $FFBE, Y : AND.w #$EFFF : STA $FFBE, Y
LDA $FFC4, Y : AND.w #$EFFF : STA $FFC4, Y
LDA $0084, Y : AND.w #$EFFF : STA $0084, Y
LDA $007E, Y : AND.w #$EFFF : STA $007E, Y
RTS
MakeCircleRed:
LDA.w $FFC0, Y : AND.w #$EBFF : STA.w $FFC0, Y
LDA.w $FFC2, Y : AND.w #$EBFF : STA.w $FFC2, Y
LDA.w $FFFE, Y : AND.w #$EBFF : STA.w $FFFE, Y
LDA.w $0004, Y : AND.w #$EBFF : STA.w $0004, Y
LDA.w $003E, Y : AND.w #$EBFF : STA.w $003E, Y
LDA.w $0044, Y : AND.w #$EBFF : STA.w $0044, Y
LDA.w $0080, Y : AND.w #$EBFF : STA.w $0080, Y
LDA.w $0082, Y : AND.w #$EBFF : STA.w $0082, Y
LDA.w $FFBE, Y : AND.w #$EBFF : STA.w $FFBE, Y
LDA.w $FFC4, Y : AND.w #$EBFF : STA.w $FFC4, Y
LDA.w $0084, Y : AND.w #$EBFF : STA.w $0084, Y
LDA.w $007E, Y : AND.w #$EBFF : STA.w $007E, Y
LDA $FFBE, Y : AND.w #$EFFF : STA $FFBE, Y
LDA $FFC4, Y : AND.w #$EFFF : STA $FFC4, Y
LDA $0084, Y : AND.w #$EFFF : STA $0084, Y
LDA $007E, Y : AND.w #$EFFF : STA $007E, Y
RTS
;--------------------------------------------------------------------------------
@@ -901,22 +757,6 @@ UpgradeFlute:
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; FluteCallForDuck:
;--------------------------------------------------------------------------------
; sets A to #$02 to ignore summoning the duck
FluteCallForDuck:
LDA.l WarningFlags : AND.b #$20 : BNE .vanilla ; glitched modes allowed flute in rain state
LDA.l ProgressIndicator : CMP.b #$02 : BCS .vanilla ; must rescue Zelda first
.noDuck
LDA.b #$02 : RTL
.vanilla
LDA.l FluteEquipment ; what we wrote over
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; CheckKeys:
;--------------------------------------------------------------------------------
@@ -1015,8 +855,8 @@ RTL
; PrepItemScreenBigKey:
;--------------------------------------------------------------------------------
PrepItemScreenBigKey:
STZ $02
STZ $03
STZ $02
STZ $03
REP #$30 ; thing we wrote over - set 16-bit accumulator
RTL
;--------------------------------------------------------------------------------
@@ -1026,14 +866,9 @@ RTL
;--------------------------------------------------------------------------------
LoadPowder:
JSL.l Sprite_SpawnDynamically ; thing we wrote over
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
STA $0DA0, Y ; Store item type
LDA.b #$01 : STA.w !SPRITE_REDRAW, Y
LDA #$00
STA $7F505F
STA $7F5060
STA $7F5061
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
@@ -1053,16 +888,18 @@ RTL
;--------------------------------------------------------------------------------
; DrawPowder:
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
DrawPowder:
LDA $02DA : BNE .defer ; defer if link is buying a potion
LDA.w !SPRITE_REDRAW, X : BEQ +
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l !REDRAW : BEQ +
LDA $0DA0, X ; Retrieve stored item type
JML RequestSlottedTile
JSL.l PrepDynamicTile
LDA #$00 : STA.l !REDRAW ; reset redraw flag
BRA .defer
+
; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom
LDA $0DA0, X ; Retrieve stored item type
JML DrawSlottedTile
JSL.l DrawDynamicTile
.defer
RTL
;--------------------------------------------------------------------------------
@@ -1073,12 +910,18 @@ RTL
LoadMushroom:
LDA.b #$00 : STA $0DC0, X ; thing we wrote over
.justGFX
;LDA MushroomItem
;JSL.l PrepDynamicTile
PHA
LDA.l MushroomItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA #$01 : STA !REDRAW
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l RequestSlottedTile
JSL.l PrepDynamicTile
.skip
PLA
@@ -1088,18 +931,19 @@ RTL
;--------------------------------------------------------------------------------
; DrawMushroom:
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
DrawMushroom:
PHA : PHY
LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready
JSL.l LoadMushroom_justGFX
LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit
BRA .done ; don't draw on the init frame
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadMushroom_justGFX
BRA .done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
JSL.l DrawSlottedTile
JSL.l DrawDynamicTile
.done
.done
PLY : PLA
RTL
;--------------------------------------------------------------------------------
@@ -1113,13 +957,8 @@ CollectPowder:
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY
+
PHA
LDA WitchItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$01 : STA.l !SHOP_ENABLE_COUNT
PLA
STZ $02E9 ; item from NPC
JSL.l Link_ReceiveItem
PHA : LDA.b #$00 : STA.l !SHOP_ENABLE_COUNT : PLA
STZ $02E9 ; item from NPC
JSL.l Link_ReceiveItem
;JSL.l FullInventoryExternal
JSL.l ItemSet_Powder
RTL
@@ -1144,14 +983,14 @@ RTL
DrawMagicHeader:
LDA MagicConsumption : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
.halfMagic
LDA.w #$28F7 : STA $7EC704
LDA.w #$2851 : STA $7EC706
LDA.w #$28FA : STA $7EC708
LDA.w #$28F7 : STA $7EC704
LDA.w #$2851 : STA $7EC706
LDA.w #$28FA : STA $7EC708
RTL
.quarterMagic
LDA.w #$28F7 : STA $7EC704
LDA.w #$2800 : STA $7EC706
LDA.w #$2801 : STA $7EC708
LDA.w #$28F7 : STA $7EC704
LDA.w #$2800 : STA $7EC706
LDA.w #$2801 : STA $7EC708
RTL
;--------------------------------------------------------------------------------
@@ -1193,14 +1032,12 @@ RTL
;--------------------------------------------------------------------------------
; SpawnShovelItem:
;--------------------------------------------------------------------------------
SpawnShovelGamePrize:
JSL Sprite_SpawnDynamically ; thing we wrote over
LDA.b #$01 : STA.w !SPRITE_REDRAW, Y
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
SpawnShovelItem:
LDA $03FC : BEQ +
JSL DiggingGameGuy_AttemptPrizeSpawn
LDA.b #$01 : STA !REDRAW
LDA $03FC : BEQ +
JSL DiggingGameGuy_AttemptPrizeSpawn
JMP .skip
+
@@ -1258,30 +1095,12 @@ RTL
{
.x_speeds
db $F0
db $10
db $F0
db $10
.x_offsets
db $00
db $13
db $00
db $13
}
;--------------------------------------------------------------------------------
; A = item id being collected
ItemGetAlternateSFX:
PEA.w $C567 ; SNES to RTS to in bank 08
LDA.w $0C5E,X : CMP.b #$4A : BNE +
; collecting pre-activated flute
LDA.b #$13 : JML $088007
+ ; normal itemget sfx
LDA.b #$0F : JML $08800E ; what we wrote over
; A = item id being collected
ItemGetOverworldAlternateSFX:
CMP.b #$4A : BNE +
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w $012E
RTL
+ ; normal itemget sfx
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w $012F ; what we wrote over
RTL
;--------------------------------------------------------------------------------

View File

@@ -3,7 +3,7 @@
; Does tile modification for... the pyramid of power hole
; after Ganon slams into it in bat form?
Overworld_CreatePyramidHoleModified:
PHX : LDX $8A : LDA.l OWTileMapAlt, X : PLX : AND.b #$01 : BNE +
LDA.l InvertedMode : BNE +
JMP .originalBehaviour
+
.invertedBehavior
@@ -80,7 +80,7 @@ Overworld_CreatePyramidHoleModified:
RTL
;------------------------------------------------------------------------------
Draw_PyramidOverlay:
PHX : LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : PLX : AND.w #$0001 : BNE .done
LDA.l InvertedMode : AND.w #$00FF : BNE .done
.normal
LDA.w #$0E39 : STA $23BC
INC A : STA $23BE
@@ -130,7 +130,7 @@ db $02, $02, $02, $00, $08, $02, $02, $00, $00, $00, $00, $01, $00, $00, $20, $0
db $02, $02, $02, $02, $02, $02, $02, $00, $00, $01, $01, $01, $02, $00, $08, $00
Electric_Barrier:
LDA SwapAgaGanonsTower : BEQ .done
LDA InvertedMode : BEQ .done
LDA OverworldEventDataWRAM, X : ORA #$40 : STA OverworldEventDataWRAM, X ;set barrier dead
.done
LDA OverworldEventDataWRAM, X ; what we wrote over
@@ -138,7 +138,7 @@ RTL
GanonTowerAnimation:
LDA SwapAgaGanonsTower : BEQ .done
LDA InvertedMode : BEQ .done
LDA.b #$1B : STA $012F
STZ $04C6
STZ $B0
@@ -151,9 +151,7 @@ GanonTowerAnimation:
STZ $011B
STZ $011C
STZ $011D
PHX
JSL Overworld_DetermineMusic : STX !REG_MUSIC_CONTROL_REQUEST
PLX
LDA.b #$02 : STA $012C
LDA.b #$09 : STA $012D
RTL
.done
@@ -164,7 +162,7 @@ RTL
GanonTowerInvertedCheck:
{
LDA SwapAgaGanonsTower : BEQ .done
LDA InvertedMode : BEQ .done
LDA #$01 ; Load a random value so it doesn't BEQ
RTL
.done
@@ -176,7 +174,7 @@ GanonTowerInvertedCheck:
;Hard coded rock removed in LW for Inverted mode
HardcodedRocks:
LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : AND.w #$0001 : BEQ .normalrocks
LDA InvertedMode : AND.w #$00FF : BEQ .normalrocks
BRA .noRock2
.normalrocks
LDA.w #$020F : LDX $8A : CPX.w #$0033 : BNE .noRock
@@ -188,7 +186,7 @@ HardcodedRocks:
RTL
TurtleRockPegSolved:
PHX : LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : PLX : AND.w #$0001 : BNE +
LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.l OverworldEventDataWRAM+07 ; What we wrote over (reading flags for this screen)
RTL
+
@@ -197,17 +195,14 @@ RTL
MirrorBonk:
; must preserve X/Y, and must preserve $00-$0F
PHX : LDX $8A : LDA.l OWTileMapAlt, X : PLX : AND.b #$01 : BEQ .normal
LDA.l InvertedMode : BEQ .normal
; Goal: use $20 and $22 to decide to force a bonk
; if we want to bonk branch to .forceBonk
; otherwise fall through to .normal
PHX : PHP
PHB : PHK : PLB
LDX $8A : LDA.l OWTileWorldAssoc, X
TAX : LDA.l InvertedMode : BEQ +
TXA : EOR #$40 : TAX
+ TXA : BNE .endLoop ;World we're in? branch if we are in LW we don't want bonks
LDA $8A : AND.b #$40 : BEQ .endLoop ;World we're in? branch if we are in LW we don't want bonks
REP #$30
LDX #$0000
.loop

File diff suppressed because it is too large Load Diff

View File

@@ -1,98 +0,0 @@
;--------------------------------------------------------------------------------
ItemMenuLocations:
dw $11C8 ; Bow
dw $11CE ; Boomerang
dw $11D4 ; Hookshot
dw $11DA ; Bombs
dw $11E0 ; Powder / Mushroom
dw $1288 ; Fire Rod
dw $128E ; Ice Rod
dw $1294 ; Bombos
dw $129A ; Ether
dw $12A0 ; Quake
dw $1348 ; Lamp
dw $134E ; Hammer
dw $1354 ; Flute / Shovel
dw $135A ; Bug Net
dw $1360 ; Book
dw $1408 ; Bottles
dw $140E ; Somaria
dw $1414 ; Byrna
dw $141A ; Cape
dw $1420 ; Mirror
DrawBIndicator:
LDA.l ItemOnB : AND.w #$00FF : BEQ .done
DEC : ASL : TAX
LDA.l ItemMenuLocations, X : TAX
LDA.w #$3D3B
STA.w $0042, X
.done ; what we wrote over
LDA.w $0202
AND.w #$00FF
DEC
ASL
TAX
RTL
;--------------------------------------------------------------------------------
ItemHandlerLocs:
dw $A003 ; Bow
dw $A0B8 ; Boomerang
dw $AB23 ; Hookshot
dw $A139 ; Bombs
dw $FFFF ; Powder / Mushroom
dw $9EEC ; Fire Rod
dw $9EEC ; Ice Rod
dw $A55E ; Bombos
dw $A489 ; Ether
dw $A640 ; Quake
dw $A246 ; Lamp
dw $9F82 ; Hammer
dw $FFFF ; Flute / Shovel
dw $AFEE ; Bug Net
dw $A46E ; Book
dw $FFFF ; Bottles
dw $AEBB ; Somaria
dw $FFFF ; Byrna
dw $FFFF ; Cape
dw $A913 ; Mirror
ValidItemOnB:
db $FF
db $00, $00, $00, $00, $FF
db $00, $00, $00, $00, $00
db $00, $00, $FF, $00, $00
db $FF, $00, $FF, $FF, $00
UseItem:
JSL CheckDetonateBomb : BCS .normal
LDA.l ItemOnB : BEQ .normal
TAX
LDA.b $6C : BNE .prevent_swing
CPX.b #$11 : BNE .not_somaria
LDA.w $02F5 : BNE .prevent_swing
.not_somaria
LDA.l ValidItemOnB, X : BNE .normal
LDA.b $3A : ORA.b #$40 : STA.b $3A
LDA.l $0DFA35, X : STA.w $0304
CPX.b #$06 : BEQ .fire_rod
CPX.b #$07 : BNE .not_rod
.ice_rod
LDA.b #$02 : STA.w $0307
BRA .not_rod
.fire_rod
LDA.b #$01 : STA.w $0307
.not_rod
TXA : DEC : ASL : TAX
LDA.l ItemHandlerLocs+1, X : STA.b $01
LDA.l ItemHandlerLocs, X : STA.b $00
JSL Link_UseItemLong
.prevent_swing
SEC
RTL
.normal
LDA.b #$80 : TSB.b $3A
LDA.b #$01 : TSB.b $50
CLC
RTL

View File

@@ -9,29 +9,29 @@ RTL
ItemDowngradeFixMain:
JSL.l AddInventory
BMI .dontWrite ; thing we wrote over part 1
CPY.b #$1B : BEQ .isPowerGloves ; Power Gloves
CPY.b #$05 : BEQ .isRedShield ; Red Shield
CPY.b #$04 : BEQ .isBlueShield ; Blue Shield
CPY.b #$0C : BEQ .isBlueBoomerang ; Blue Boomerang
CPY.b #$0B : BEQ .isBow ; Bow
CPY.b #$3A : BEQ .isBowAndArrows ; Bow
CPY.b #$49 : BEQ .isSword ; Fighter's Sword
CPY.b #$01 : BEQ .isSword ; Master Sword
CPY.b #$50 : BEQ .isSword ; Master Sword (Safe)
CPY.b #$02 : BEQ .isSword ; Tempered Sword
CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow
CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang
CPY.b #$0D : BEQ .isMagicPowder ; Magic Powder
CPY.b #$14 : BEQ .isFlute ; Flute
CPY.b #$13 : BEQ .isShovel ; Shovel
CPY.b #$29 : BEQ .isMushroom ; Mushroom
CPY.b #$00 : BEQ .isUncleSwordShield ; Fighter's Sword & Shield
.done
.done
STA [$00] ; thing we wrote over part 2
.dontWrite
RTS
@@ -60,7 +60,7 @@ RTS
RTS
.isSword
PHA
LDA HighestSword : STA $04
LDA SwordEquipment : STA $04
TYA ; load sword item
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter's sword to normal one
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
@@ -71,11 +71,13 @@ RTS
+
PLA
JMP .done
.isUncleSwordShield
.isUncleSwordShield
PHA
LDA HighestSword : STA [$00] ; already set to 1 if we had no sword, always keep highest
INC $00
LDA HighestShield : STA [$00]
; set sword to 1 if current sword is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
INC $00
; set shield to 1 if current shield is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
PLA
RTS
;================================================================================

View File

@@ -1,113 +0,0 @@
org $328000
; You have found
; the Map of
Notice_MapOf:
db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $B6, $00, $30, $00, $3F, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; You have found
; the Compass of
Notice_CompassOf:
db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $AC, $00, $3E, $00, $3C, $00, $3F, $00, $30, $00, $42, $00, $42, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; Oh look! it's
; the Big Key of
Notice_BigKeyOf:
db $74, $00, $B8, $00, $37, $00, $FF, $00, $3B, $00, $3E, $00, $3E, $00, $3A, $00, $C7, $00, $FF, $00, $38, $00, $43, $00, $D8, $00, $42
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $AB, $00, $38, $00, $36, $00, $FF, $00, $B4, $00, $34, $00, $48, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; This is a
; Small Key to
Notice_SmallKeyOf:
db $74, $00, $BD, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $38, $00, $42, $00, $FF, $00, $30
db $75, $00, $BC, $00, $3C, $00, $30, $00, $3B, $00, $3B, $00, $FF, $00, $B4, $00, $34, $00, $48, $00, $FF, $00, $43, $00, $3E
dw #$7F7F
; Light World
Notice_LightWorld:
db $76, $00, $B5, $00, $38, $00, $36, $00, $37, $00, $43, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33
dw #$7F7F
; Dark World
Notice_DarkWorld:
db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33
dw #$7F7F
; Ganons Tower
Notice_GTower:
db $76, $00, $B0, $00, $30, $00, $3D, $00, $3E, $00, $3D, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41
dw #$7F7F
; Turtle Rock
Notice_TRock:
db $76, $00, $BD, $00, $44, $00, $41, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BB, $00, $3E, $00, $32, $00, $3A
dw #$7F7F
; Thieves Town
Notice_Thieves:
db $76, $00, $BD, $00, $37, $00, $38, $00, $34, $00, $45, $00, $34, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $3D
dw #$7F7F
; Tower of Hera
Notice_Hera:
db $76, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41, $00, $FF, $00, $3E, $00, $35, $00, $FF, $00, $B1, $00, $34, $00, $41, $00, $30
dw #$7F7F
; Ice Palace
Notice_Ice:
db $76, $00, $B2, $00, $32, $00, $34, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Skull Woods
Notice_Skull:
db $76, $00, $BC, $00, $3A, $00, $44, $00, $3B, $00, $3B, $00, $FF, $00, $C0, $00, $3E, $00, $3E, $00, $33, $00, $42
dw #$7F7F
; Misery Mire
Notice_Mire:
db $76, $00, $B6, $00, $38, $00, $42, $00, $34, $00, $41, $00, $48, $00, $FF, $00, $B6, $00, $38, $00, $41, $00, $34
dw #$7F7F
; Dark Palace
Notice_PoD:
db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Swamp Palace
Notice_Swamp:
db $76, $00, $BC, $00, $46, $00, $30, $00, $3C, $00, $3F, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Castle Tower
Notice_AgaTower:
db $76, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41
dw #$7F7F
; Desert Palace
Notice_Desert:
db $76, $00, $AD, $00, $34, $00, $42, $00, $34, $00, $41, $00, $43, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Eastern Palace
Notice_Eastern:
db $76, $00, $AE, $00, $30, $00, $42, $00, $43, $00, $34, $00, $41, $00, $3D, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Hyrule Castle
Notice_Castle:
db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34
dw #$7F7F
; Hyrule Castle
Notice_Sewers:
db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34
dw #$7F7F
; this dungeon
Notice_Self:
db $76, $00, $43, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $33, $00, $44, $00, $3D, $00, $36, $00, $34, $00, $3E, $00, $3D
dw #$7F7F

View File

@@ -1,520 +0,0 @@
; where we shove the decompressed graphics to send to WRAM
DynamicDropGFX = $7ECC00
; this will just count from 0 to 4 to determine which slot we're using
; we're expecting 5 items max per room, and order is irrelevant
; we just need to keep track of where they go
DynamicDropGFXIndex = $7E1E70
!DynamicDropGFXSlotCount_UW = (FreeUWGraphics_end-FreeUWGraphics)>>1
!DynamicDropGFXSlotCount_OW = (FreeOWGraphics_end-FreeOWGraphics)>>1
; this will keep track of the above for each item
SprItemGFX = $7E0780
; this is the item requested and a flag (we anticipate no more than 3 requests to be active, but built to support 8)
DynamicDropRequest = $7E1E71 ; bitfield indicating which request slot to process
DynamicDropQueue = $7E1E72 ; 0x08 bytes, occupies 1 byte for each slot in the request queue (loot id at first, but stores GFX index)
; Come in with
; A = item receipt ID
; X = sprite slot
RequestSlottedTile:
PHX : PHY
PHA
LDA.b #$01 : STA.w !SPRITE_REDRAW, X
JSL Sprite_IsOnscreen : BCC ++
; skip sending the request if busy with other things
LDA.b $11 : CMP.b #$21 : BCS ++ ; skip if OW is loading Map16 GFX ; TODO: Figure out how to allow submodule 22, check DMA status instead
LDA.b $5D : CMP.b #$14 : BEQ ++ ; skip if we're mid-mirror
LDA.b $1B : BEQ + ; OW current doesn't occupy any slots that medallion gfx do
CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion
++ PLA : JMP .return
+
LDA.w $0E20, X : CMP.b #$C0 : BNE + ; if catfish
TYX
+ CMP.b #$52 : BNE + ; if zora
TYX
+
LDA.b 1,S : JSL.l GetSpritePalette : STA.w $0F50, X ; setup the palette
PLA
; gfx that are already present, use that instead of a new slot
CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + ; if rupees, use animated rupee OAM slot
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : STA.w SprItemGFX,X
JMP .success
+ CMP.b #$A0 : BCC + : CMP.b #$AF+1 : BCS + ; if key, use key OAM slot
LDY.b $5D : CPY.b #$19 : BCC ++ : CPY.b #$1A+1 : BCS ++ ; if getting tablet item, don't use key slot
BRA +
++
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : INC : STA.w SprItemGFX,X
JMP .success
+ CMP.b #$B5 : BNE + ; if good bee, use bee OAM slot
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : INC : INC : STA.w SprItemGFX,X
JMP .success
+ CMP.b #$B2 : BNE + ; if fairy, use fairy OAM slot
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : INC : STA.w SprItemGFX,X
JMP .success
+ CMP.b #$B1 : BNE + ; if apple, use apple OAM slot
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : INC : INC : STA.w SprItemGFX,X
JMP .success
+ CMP.b #$6A : BNE + ; if triforce, use cutscene OAM slot
PHA
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ INC : STA.w SprItemGFX,X
JMP .initRequest ; don't jump to end, we need the TF GFX to draw at $E7
+
PHA
LDA.w DynamicDropGFXIndex
INC
PHX
LDX.b $1B : BEQ +
CMP.b #!DynamicDropGFXSlotCount_UW : BCC .setIndex
BRA ++
+ CMP.b #!DynamicDropGFXSlotCount_OW : BCC .setIndex
++ LDA.b #$00
.setIndex
PLX
STA.w DynamicDropGFXIndex
STA.w SprItemGFX,X
PHX
; loop thru other sprites, check if any use the same gfx slot
LDY.b #$0F
- TYA : CMP 1,S : BEQ + ; don't check self
LDA.w $0DD0,Y : BEQ +
LDA.w !SPRITE_REDRAW, Y : BNE +
LDA.w SprItemGFX,Y : CMP.w DynamicDropGFXIndex : BNE +
LDA.w $0E20,Y ; don't need E5 enemy big key drop and E9 powder item
CMP.b #$EB : BEQ ++ ; heart piece
CMP.b #$E4 : BEQ ++ ; enemy drop
CMP.b #$3B : BEQ ++ ; bonk item
CMP.b #$E7 : BEQ ++ ; mushroom
BRA +
++
; slot already in use, use overflow slot
LDA.b #$02 : STA.w !SPRITE_REDRAW, X
LDA.b $1B : BEQ ++
LDA.b #!DynamicDropGFXSlotCount_UW
BRA +++
++ LDA.b #!DynamicDropGFXSlotCount_OW
+++ STA.w SprItemGFX,X
PLX : PLA : BRA .return
+ DEY : BPL -
PLX
.initRequest
PHX
LDY.b #$00
LDA.w DynamicDropRequest
- LSR : INY : BCS -
CPY.b #$08 : BCC +
; all request slots occupied, exit without drawing
PLX : PLA
LDY.b #$FE ; indicate failure
BRA .return
+ TYX
LDA.b #$00 : SEC
- ROL : DEX : BNE -
DEY ; y = slot index, a = new request bit flag
ORA.w DynamicDropRequest
STA.w DynamicDropRequest
PLX
PLA
STA.w DynamicDropQueue,Y
; decompress graphics
PHX : PHY
REP #$20
LDA.w #DynamicDropGFX-$7E9000
TYX : BEQ +
- CLC : ADC.w #$0080 : DEX : BNE -
+ STA.l !TILE_UPLOAD_OFFSET_OVERRIDE
SEP #$20
LDA.w DynamicDropQueue,Y
JSL.l GetSpriteID
JSL.l GetAnimatedSpriteTile_variable
SEP #$30
PLY : PLX
LDA.w DynamicDropQueue,Y : PHA ; we want A to return the loot id
LDA.w SprItemGFX,X : STA.w DynamicDropQueue,Y
PLA
.success
STZ.w !SPRITE_REDRAW, X
.return
PLY : PLX
RTL
;===================================================================================================
TransferPotGFX:
SEP #$10
REP #$20
LDA.w DynamicDropRequest : AND.w #$00FF
BEQ .no
.next
LDY.b #$00
- INY : LSR : BCC -
PHY
LDA.w #$0000
- ROL : DEY : BNE -
PLY
DEY ; y = slot index, a = request bit flag
EOR.w DynamicDropRequest : STA.w DynamicDropRequest
LDA.w DynamicDropQueue,Y
ASL
TAX
LDA.b $1B : AND.w #$00FF : BEQ +
LDA.l FreeUWGraphics,X
BRA ++
+ LDA.l FreeOWGraphics,X
++ STA.w $2116
; calculate bottom row now
CLC : ADC.w #$0200>>1 : PHA
LDX.b #$7E : STX.w $4314
LDA.w #DynamicDropGFX
CPY.b #$00 : BEQ +
- CLC : ADC.w #$0080 : DEY : BNE -
+ STA.w $4302
LDX.b #$80 : STX.w $2115
LDA.w #$1801 : STA.w $4300
LDA.w #$0040 : STA.w $4305
LDY.b #$01
STY.w $420B
STA.w $4305
PLA
STA.w $2116
STY.w $420B
LDA.w DynamicDropRequest : AND.w #$00FF
BNE .next
.no
RTL
FreeUWGraphics:
dw $8800>>1
dw $8840>>1
dw $8980>>1
dw $9960>>1 ; Arghuss Splash apparently
dw $9C00>>1
; dw $9CA0>>1
dw $9DC0>>1
; add new slots above this line
.end
dw $0000 ; overflow slot, intentionally blank
dw $9CE0>>1 ; Triforce
; above this line, add slots that we want to draw to specific slots
FreeOWGraphics:
dw $8180>>1 ; Push Block
;dw $8800>>1 ; Shovel Dirt
dw $9960>>1 ; Arghuss/Zora Splash
dw $9C00>>1 ; Heart Piece
;dw $9CA0>>1 ; Apple
;dw $9DC0>>1 ; Whirlpool
; add new slots above this line
.end
dw $0000 ; overflow slot, intentionally blank
dw $9CE0>>1 ; Triforce
; above this line, add slots that we want to draw to specific slots
;===================================================================================================
; Come in with
; A = item receipt ID
; X = sprite slot
; Returns with Carry flag set if gfx drawing was skipped
DrawSlottedTile:
PHA
; TODO: allow drawing if gfx are not using a VRAM slot that changes during medallion
LDA.b $5D : CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion
PLA : SEC : RTL
+
PLA
STA.b $07 ; store loot ID temporarily, will get overwritten in Sprite_DrawMultiple_quantity_preset call
JSL.l IsNarrowSprite : BCS .narrow
; TODO: Instead of loading the whole fixed 16 bytes from DynamicOAMTile**_** into !SPRITE_DYNAMIC_OAM
; Do something more like how DrawDynamicTile does it
; Then we won't need all the separate DynamicOAMTile**_** tables
.full
LDA.b #$01 : STA $06
LDA #$0C : JSL.l OAM_AllocateFromRegionC
LDA #$02 : PHA
REP #$20
LDA.b $1B : AND.w #$00FF : BEQ +
LDA.w #DynamicOAMTileUW_full
BRA .transfer
+ LDA.w #DynamicOAMTileOW_full
BRA .transfer
.narrow
LDA.b #$02 : STA $06
LDA #$10 : JSL.l OAM_AllocateFromRegionC
LDA #$03 : PHA
REP #$20
LDA.b $1B : AND.w #$00FF : BEQ +
LDA.w #DynamicOAMTileUW_thin
BRA .transfer
+ LDA.w #DynamicOAMTileOW_thin
.transfer
STA.b $08
LDA.w SprItemGFX,X
AND.w #$00FF
ASL : ASL : ASL : ASL
ADC.b $08
STA.b $08
PHK : PLY : STY.b $0A
LDY #$7E : PHB : PHY : PLB
; transfer fixed table data into WRAM
LDY.b #$0E
- LDA.b [$08],Y : STA.w !SPRITE_DYNAMIC_OAM,Y
DEY : DEY : BPL -
LDA.w SprItemFlags, X : AND.w #$00FF : BNE .draw
LDA.b $06 : LSR : BCC +
; full
LDA.w #$0000
STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+2
BRA .draw
+ ; narrow
LDA.w $0E20, X : AND.w #$00FF : CMP.w #$003B : BEQ .draw ; bonk item
LDA.b $A0 : CMP.w #$0120 : BNE +
LDA.b $1B : BNE .draw ; good bee statue
+
; TODO: Figure out how to target bottle vendor fish item better than this
LDA.b $8A : AND.w #$00FF : CMP.w #$0018 : BNE +
LDA.b $1B : BEQ .draw ; bottle vendor key
+
LDA.w #$0004
STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8
.draw
; special handling
LDY.b $07 : CPY.b #$B2 : BNE + ; fairy
LDA.b $1A : AND.w #$0020 : BEQ ++ ; alternate every 32 frames
LDA.w !SPRITE_DYNAMIC_OAM+4 : CLC : ADC.w #$02 ; use other fairy GFX
STA.w !SPRITE_DYNAMIC_OAM+4
++ LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ + ; alternate every 32 frames
LDA.w !SPRITE_DYNAMIC_OAM+2 : SEC : SBC.w #$02 ; move fairy up 2 pixels
STA.w !SPRITE_DYNAMIC_OAM+2
+ CPY.b #$B5 : BNE + ; good bee
LDA.b $1A : AND.w #$0020 : BEQ ++ ; alternate every 32 frames
LDA.w !SPRITE_DYNAMIC_OAM+12 : SEC : SBC.w #$10 ; use other fairy GFX
STA.w !SPRITE_DYNAMIC_OAM+12
++ LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ + ; alternate every 32 frames
LDA.w !SPRITE_DYNAMIC_OAM+10 : SEC : SBC.w #$02 ; move fairy up 2 pixels
STA.w !SPRITE_DYNAMIC_OAM+10
+
LDA.w #!SPRITE_DYNAMIC_OAM : STA.b $08
SEP #$20
STZ.b $07
LDA.b #$00 : STA.l !SKIP_EOR
JSL Sprite_DrawMultiple_quantity_preset
PLB
LDA.b $90 : CLC : ADC.b #$08 : STA.b $90
INC.b $92 : INC.b $92
PLA
CLC
RTL
DynamicOAMTileUW_thin:
dw 0, 0 : db $40, $00, $20, $00
dw 0, 8 : db $50, $00, $20, $00
dw 0, 0 : db $42, $00, $20, $00
dw 0, 8 : db $52, $00, $20, $00
dw 0, 0 : db $4C, $00, $20, $00
dw 0, 8 : db $5C, $00, $20, $00
dw 0, 0 : db $CB, $00, $20, $00
dw 0, 8 : db $DB, $00, $20, $00
dw 0, 0 : db $E0, $00, $20, $00
dw 0, 8 : db $F0, $00, $20, $00
dw 0, 0 : db $EE, $00, $20, $00
dw 0, 8 : db $FE, $00, $20, $00
; add new slots above this line
dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot
dw 0, 8 : db $F3, $00, $20, $00
; above this line, add slots that we want to draw to specific slots
dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot
dw 0, 8 : db $1B, $00, $20, $00
dw 0, 0 : db $6B, $00, $20, $00 ; key
dw 0, 8 : db $7B, $00, $20, $00
dw 0, 0 : db $7C, $00, $20, $00 ; good bee
dw 0, 8 : db $F4, $00, $20, $00
DynamicOAMTileUW_full:
dw -4, -1 : db $40, $00, $20, $02
dd 0, 0
dw -4, -1 : db $42, $00, $20, $02
dd 0, 0
dw -4, -1 : db $4C, $00, $20, $02
dd 0, 0
dw -4, -1 : db $CB, $00, $20, $02
dd 0, 0
dw -4, -1 : db $E0, $00, $20, $02
dd 0, 0
dw -4, -1 : db $EE, $00, $20, $02
dd 0, 0
; add new rotating slots above this line
dw -4, -1 : db $A0, $00, $20, $02 ; overflow slot
dd 0, 0
dw -4, -1 : db $E7, $00, $20, $02 ; triforce
dd 0, 0
; above this line, add slots that we want to draw to specific slots
dw -4, -1 : db $EA, $00, $20, $02 ; fairy
dd 0, 0
dw -4, -1 : db $E5, $00, $20, $02 ; apple
dd 0, 0
DynamicOAMTileOW_thin:
dw 0, 0 : db $0C, $00, $20, $00
dw 0, 8 : db $1C, $00, $20, $00
; dw 0, 0 : db $40, $00, $20, $00
; dw 0, 8 : db $50, $00, $20, $00
dw 0, 0 : db $CB, $00, $20, $00
dw 0, 8 : db $DB, $00, $20, $00
dw 0, 0 : db $E0, $00, $20, $00
dw 0, 8 : db $F0, $00, $20, $00
;dw 0, 0 : db $E5, $00, $20, $00
;dw 0, 8 : db $F5, $00, $20, $00
;dw 0, 0 : db $EE, $00, $20, $00
;dw 0, 8 : db $FE, $00, $20, $00
; add new slots above this line
dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot
dw 0, 8 : db $F3, $00, $20, $00
; above this line, add slots that we want to draw to specific slots
dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot
dw 0, 8 : db $1B, $00, $20, $00
dw 0, 0 : db $6B, $00, $20, $00 ; key
dw 0, 8 : db $7B, $00, $20, $00
dw 0, 0 : db $7C, $00, $20, $00 ; good bee
dw 0, 8 : db $F4, $00, $20, $00
DynamicOAMTileOW_full:
dw 0, 0 : db $0C, $00, $20, $02
dd 0, 0
; dw 0, 0 : db $40, $00, $20, $02
; dd 0, 0
dw 0, 0 : db $CB, $00, $20, $02
dd 0, 0
dw 0, 0 : db $E0, $00, $20, $02
dd 0, 0
;dw 0, 0 : db $E5, $00, $20, $02
;dd 0, 0
;dw 0, 0 : db $EE, $00, $20, $02
;dd 0, 0
; add new slots above this line
dw 0, 0 : db $A0, $00, $20, $02 ; overflow slot
dd 0, 0
dw 0, 0 : db $E7, $00, $20, $02 ; triforce
dd 0, 0
; above this line, add slots that we want to draw to specific slots
dw 0, 0 : db $EA, $00, $20, $02 ; fairy
dd 0, 0
dw 0, 0 : db $E5, $00, $20, $02 ; apple
dd 0, 0
ConditionalPushBlockTransfer:
LDA.b $1B : BNE +
LDA.b #$0F ; don't transfer push block when on the OW
BRA .return-3
+
LDA.b #$1F : STA.w $420B ; what we wrote over
.return
RTL
pushpc
; fix Arghuss/Zora splash graphics
org $068595
db $E7, $E7, $E7, $E7, $E7, $C0, $C0
pullpc

View File

@@ -1,724 +0,0 @@
; hooks
org $81E6B0
JSL RevealPotItem
RTS
org $829C25
JSL SetTheSceneFix
org $89C2BB
JSL ClearSpriteData
; underworld -> overworld transition
org $8282D1
JSL ClearSpriteData2
org $89C327
JSL LoadSpriteData
org $86F976
JSL RevealSpriteDrop : NOP
org $86E3C4
JSL RevealSpriteDrop2 : NOP
org $86926e ; <- 3126e - sprite_prep.asm : 2664 (LDA $0B9B : STA $0CBA, X)
JSL SpriteKeyPrep : NOP #2
org $86d049 ; <- 35049 sprite_absorbable : 31-32 (JSL Sprite_DrawRippleIfInWater : JSR Sprite_DrawAbsorbable)
JSL SpriteKeyDrawGFX : BRA + : NOP : +
org $86d03d
JSL ShouldSpawnItem : NOP #2
org $86D19F
JSL MarkSRAMForItem : NOP #2
org $86d180
JSL BigKeyGet : BCS $07 : NOP #5
org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F)
JSL KeyGet
org $86f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties)
JSL LoadProperties_PreserveCertainProps
org $808BAA ; NMI hook
JSL TransferPotGFX
org $86828A
JSL CheckSprite_Spawn
org $87B169
JSL PreventPotSpawn : NOP
org $87B17D
JSL PreventPotSpawn2
org $868275
JSL SubstitionFlow
org $80A9DC
dw $1928, $1938, $5928, $5938 ; change weird ugly black diagonal pot to blue-ish pot
org $818650
dw $B395 ; change tile type to normal pot
org $81B3D5
JSL CheckIfPotIsSpecial
; refs to other functions
org $8681F4
Sprite_SpawnSecret_pool_ID:
org $868283
Sprite_SpawnSecret_NotRandomBush:
org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
org $8682A5
Sprite_SpawnSecret_SetCoords:
org $86d23a
Sprite_DrawAbsorbable:
org $9eff81
Sprite_DrawRippleIfInWater:
org $8db818
Sprite_LoadProperties:
org $86D038
KeyRoomFlagMasks:
org $80FDEE
InitializeMirrorHDMA:
org $80E3C4
LoadCommonSprites_long:
; defines
; Ram usage
SpawnedItemID = $7E0720 ; 0x02
SpawnedItemIndex = $7E0722 ; 0x02
SpawnedItemIsMultiWorld = $7E0724 ; 0x02
SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop
; (flag used as a bitmask in conjunction with StandingItemCounterMask)
SpawnedItemMWPlayer = $7E0728 ; 0x02
; clear all of them in a loop during room load
SprDropsItem = $7E0730 ; 0x16
SprItemReceipt = $7E0740 ; 0x16
SprItemIndex = $7E0750
SprItemMWPlayer = $7E0760 ; 0x16
SprItemFlags = $7E0770 ; 0x16 (used for both pots and drops) (combine with SprDropsItem?)
; todo: move sprites
;org $09D62E
;UWSpritesPointers ; 0x250 bytes for 0x128 rooms' 16-bit pointers
;org $09D87E
;UWPotsPointers ; 0x250 bytes for 0x128 rooms' 16-bit pointers
;org $09DACE
;UWPotsData ; variable number of bytes (max 0x11D1) for all pots data
;org $A88000
;UWSpritesData ; variable number of bytes (max 0x2800) for all sprites and sprite drop data
; First $2800 bytes of this bank (28) is reserved for the sprite tables
;org $09C297
;LDA.w UWSpritesPointers,Y
;org $01E6BF ; not sure this code is reachable anymore
;LDA.l UWPotsPointers,X
;STA.b $00
;LDA.w #UWPotsPointers>>16
; $2800 bytes reserved for sprites
; temporary pot table until sprites get moved:
org $A88000
UWPotsPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers
org $A88250
UWPotsData:
org $A8A800
;tables:
PotMultiWorldTable:
; Reserved $250 296 * 2
org $A8AA50
StandingItemsOn: ; 142A50
db 0
MultiClientFlagsROM: ; 142A51-2 -> stored in SRAM at 7ef33d (for now)
dw 0
SwampDrain1HasItem: ; 142A53
db 1
SwampDrain2HasItem: ; 142A54
db 1
StandingItemCounterMask: ; 142A55
db 0 ; if 0x01 is set then pot should be counted, if 0x02 then sprite drops, 0x03 (both bits for both)
PotCountMode: ; 28AA56-7
; 0 is don't count pots
; 1 for check PotCollectionRateTable
dw 0
org $A8AA60
PotCollectionRateTable:
; Reserved $250 296 * 2
org $A8ACB0
RevealPotItem:
STA.b $04 ; save tilemap coordinates
STZ.w SpawnedItemFlag
STZ.w SpawnedItemMWPlayer
LDA.w $0B9C : AND.w #$FF00 : STA.w $0B9C
LDA.b $A0 : ASL : TAX
LDA.l UWPotsPointers,X : STA.b $00 ; we may move this
LDA.w #UWPotsPointers>>16 : STA.b $02
LDY.w #$FFFD : LDX.w #$FFFF
.next_pot
INY : INY : INY
LDA.b [$00],Y
CMP.w #$FFFF : BEQ .exit
INX
STA.w $08 ; remember the exact value
AND.w #$3FFF
CMP.b $04 : BNE .next_pot ; not the correct value
STZ.w SpawnedItemIsMultiWorld
BIT.b $08
BVS LoadMultiWorldPotItem
BMI LoadMajorPotItem
.normal_secret
STA $08
PHX : PHY
; set bit and count if first time lifting this pot
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A
LDA.b $A0 : ASL : TAX
JSR ShouldCountNormalPot : BCC .obtained
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
; increment dungeon counts
SEP #$30
LDA $040C : CMP #$FF : BEQ +
BNE ++
INC #2 ; treat sewers as HC
++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
; Could increment GT Tower Pre Big Key but we aren't showing that stat right now
+ REP #$30
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
.obtained
PLY : PLX
PLA ; remove the JSL return lower 16 bits
LDA $08
PEA.w $01E6E2-1 ; change return address to go back to the vanilla routine
.exit
RTL
LoadMultiWorldPotItem:
INY : INY
LDA.b [$00],Y : AND.w #$00FF
INC.w SpawnedItemIsMultiWorld
PHX
ASL : TAX
LDA.l PotMultiWorldTable+1,X : AND.w #$00FF : STA.w SpawnedItemMWPlayer
LDA.l PotMultiWorldTable+0,X : AND.w #$00FF
PLX
BRA SaveMajorItemDrop
MultiItemExit:
LDA.w #$0008 : STA.w $0B9C
RTL
LoadMajorPotItem:
INY : INY
LDA.b [$00],Y : AND.w #$00FF
SaveMajorItemDrop:
; A currently holds the item receipt ID
; X currently holds the pot item index
STA.w SpawnedItemID
STX.w SpawnedItemIndex
INC.w SpawnedItemFlag
TAY
LDA.l SpawnedItemIsMultiWorld : BNE MultiItemExit
LDA.w #$0008
CPY.w #$0036 : BNE + ; Red Rupee
LDA.w #$0016 : BRA .substitute
+ CPY.w #$0044 : BNE + ; 10 pack arrows
LDA.w #$0017 : BRA .substitute
+ CPY.w #$0028 : BNE + ; 3 pack bombs
LDA.w #$0018 : BRA .substitute
+ CPY.w #$0031 : BNE + ; 10 pack bombs
LDA.w #$0019 : BRA .substitute
+ CPY.w #$00B1 : BNE + ; Apples
LDA.w #$001A : BRA .substitute
+ CPY.w #$00B0 : BNE + ; Bee Trap
LDA.w #$001B : BRA .substitute
+ CPY.w #$00B5 : BNE + ; Good Bee
LDA.w #$001C : BRA .substitute
+ STA $0B9C ; indicates we should use the key routines or a substitute
RTL
.substitute
PHA
TXA : ASL : STA.b $00
LDA.w #$001F : SBC $00
TAX : LDA.l BitFieldMasks, X : STA $00
LDA.b $A0 : ASL : TAX
LDA.l $7EF580, X
AND.b $00
BNE .exit
LDA.l $7EF580, X : ORA $00 : STA.l $7EF580, X
PLA : STA $0B9C
RTL
.exit
PLA : STZ.w $0B9C
RTL
ShouldCountNormalPot:
INY : INY : LDA [$00], Y : AND #$00FF : CMP #$0080 : BCS .clear
LDA.l PotCountMode : BEQ .clear
LDA.l PotCollectionRateTable, X : BIT $0A : BEQ .clear ; don't count if clear
.set
SEC
RTS
.clear
CLC
RTS
IncrementCountsForSubstitute:
PHX : REP #$30
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A
LDA.b $A0 : ASL : TAX
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
SEP #$30
LDA $040C : CMP #$FF : BEQ +
BNE ++
INC #2 ; treat sewers as HC
++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
; Could increment GT Tower Pre Big Key but we aren't showing that stat right now
+ REP #$30
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
.obtained
SEP #$30 : PLX
RTS
ClearSpriteData:
STZ.b $02 : STZ.b $03 ; what we overrode
.shared:
PHX
LDA #$00 : LDX #$00
.loop
STA SprDropsItem, X : STA SprItemReceipt, X : STA SprItemIndex, X
STA SprItemMWPlayer, X : STA SprItemFlags, X
INX : CPX #$10 : BCC .loop
PLX
RTL
ClearSpriteData2:
LDA.b #$82 : STA.b $99
JMP ClearSpriteData_shared
; Runs during sprite load of the room
LoadSpriteData:
INY : INY
LDA.b ($00), Y
CMP #$F3 : BCC .normal
PHA
DEC.b $02 ; standing items shouldn't consume a sprite slot
LDX.b $02
CMP #$F9 : BNE .not_multiworld
DEY : LDA.b ($00), Y : STA.l SprItemMWPlayer, X
LDA.b #$02 : STA.l SprDropsItem, X : BRA .common
.not_multiworld
LDA.b #$00 : STA.l SprItemMWPlayer, X
LDA.b #$01 : STA.l SprDropsItem, X
DEY
.common
DEY : LDA.b ($00), Y : STA.l SprItemReceipt, X
INY : INY
PLA
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $09C344-1 ; change return address to exit from Underworld_LoadSingleSprite
RTL
.normal
RTL
; Run when a sprite dies ... Sets Flag to #$02 and Index to sprite slot for
RevealSpriteDrop:
LDA.l SprDropsItem, X : BEQ .normal
LDA #$02 : STA.l SpawnedItemFlag
STX.w SpawnedItemIndex
LDA.l SprItemReceipt, X : STA SpawnedItemID
LDA.l SprItemMWPlayer, X : STA SpawnedItemMWPlayer
LDY.b #$01 ; trigger the small key routines
LDA SpawnedItemID : CMP #$32 : BNE +
LDA.l StandingItemsOn : BNE +
INY ; big key routine
+ RTL ; unstun if stunned
.normal
LDY.w $0CBA, X : BEQ .no_forced_drop
RTL
.no_forced_drop
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $06F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL
RevealSpriteDrop2:
LDY.w SprDropsItem, X : BEQ .normal
BRA .no_forced_drop
.normal
LDY.w $0CBA, X : BEQ .no_forced_drop
RTL
.no_forced_drop
PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $06E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL
BitFieldMasks:
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004, $0002, $0001
; Runs during Sprite_E4_SmallKey and during Sprite_E5_BigKey spawns
ShouldSpawnItem:
LDA $048E : CMP.b #$87 : BNE + ; check for hera basement cage
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant
LDA.w $0403 : AND.w KeyRoomFlagMasks,Y : RTL
+
; checking our sram table
PHX : PHY
REP #$30
LDA.b $A0 : ASL : TAY
LDA.w SprItemIndex, X : AND #$00FF : ASL
PHX
TAX : LDA.l BitFieldMasks, X : STA $00
PLX ; restore X again
LDA.w SprItemFlags, X : AND #$00FF : CMP #$0001 : BEQ +
TYX : LDA.l SpritePotData, X : BIT $00 : BEQ .notObtained
BRA .obtained
+ TYX : LDA.l RoomPotData, X : BIT $00 : BEQ .notObtained
.obtained
SEP #$30 : PLY : PLX : LDA #$01 : RTL ; already obtained
.notObtained
SEP #$30 : PLY : PLX
LDA #$00
RTL
MarkSRAMForItem:
LDA $048E : CMP.b #$87 : BNE + ; check for hera basement cage
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE +
LDA.w $0403 : ORA.w KeyRoomFlagMasks, Y : RTL
+ PHX : PHY : REP #$30
LDA.b $A0 : ASL : TAY
LDA.l SpawnedItemIndex : ASL
TAX : LDA.l BitFieldMasks, X : STA $00
TYX
LDA.w SpawnedItemFlag : CMP #$0001 : BEQ +
LDA SpritePotData, X : ORA $00 : STA SpritePotData, X : BRA .end
+ LDA RoomPotData, X : ORA $00 : STA RoomPotData, X
.end
SEP #$30 : PLY : PLX
LDA.w $0403
RTL
SpriteKeyPrep:
LDA.w $0B9B : STA.w $0CBA, X ; what we wrote over
PHA
LDA $A0 : CMP #$87 : BNE .continue
LDA $A9 : ORA $AA : AND #$03 : CMP #$02 : BNE .continue
LDA #$00 : STA.w SpawnedItemFlag : STA SprItemFlags, X
LDA #$24 : STA $0E80, X
BRA +
.continue
LDA.w SpawnedItemIndex : STA SprItemIndex, X
LDA.w SpawnedItemMWPlayer : STA SprItemMWPlayer, X
LDA.w SpawnedItemFlag : STA SprItemFlags, X : BEQ +
LDA.l SpawnedItemID : STA $0E80, X
CMP #$24 : BNE ++ ;
JSL.l GetSpritePalette : STA.w $0F50, X ; setup the palette
LDA $A0 : CMP.b #$80 : BNE +
LDA SpawnedItemFlag : BNE +
LDA #$24 ; it's the big key drop?
++ JSL RequestSlottedTile
+ PLA
RTL
SpriteKeyDrawGFX:
JSL Sprite_DrawRippleIfInWater
PHA
LDA.w !SPRITE_REDRAW, X : BEQ +
LDA $0E80, X
JSL RequestSlottedTile
LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ +
BRA .skipDraw
+ LDA $0E80, X
CMP.b #$24 : BNE +
LDA $A0 : CMP #$80 : BNE ++
LDA SpawnedItemFlag : BNE ++
LDA #$24 : BRA +
++ PLA
PHK : PEA.w .jslrtsreturn-1
PEA.w $068014 ; an rtl address - 1 in Bank06
JML Sprite_DrawAbsorbable
.jslrtsreturn
RTL
+ JSL DrawSlottedTile : BCS .skipDraw
; draw shadow
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+ JSL.l Sprite_DrawShadowLong
.skipDraw
PLA
RTL
KeyGet:
LDA CurrentSmallKeys ; what we wrote over
PHA
LDA.l StandingItemsOn : BNE +
PLA : RTL
+ LDY $0E80, X
LDA SprItemIndex, X : STA SpawnedItemIndex
LDA SprItemFlags, X : STA SpawnedItemFlag
LDA $A0 : CMP #$87 : BNE + ;check for hera cage
LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine
JSR ShouldKeyBeCountedForDungeon : BCC ++
JSL CountChestKeyLong
++ PLA : RTL
+ STY $00
LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID : BNE .receive
PHX
LDA $040C : CMP #$FF : BNE +
LDA $00 : CMP.b #$AF : BNE .skip
LDA CurrentGenericKeys : INC : STA CurrentGenericKeys
LDA $00 : BRA .countIt
+ LSR : TAX
LDA $00 : CMP.l KeyTable, X : BNE +
.countIt
LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++
JSL.l FullInventoryExternal : JSL CountChestKeyLong
++ PLX : PLA : RTL
+ CMP.b #$AF : beq .countIt ; universal key
CMP.b #$24 : beq .countIt ; small key for this dungeon
.skip PLX
.receive
JSL $0791b3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem
PLA : DEC : RTL
KeyTable:
db $A0, $A0, $A2, $A3, $A4, $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC, $AD
; Input Y - the item type
ShouldKeyBeCountedForDungeon:
PHX
LDA $040C : CMP #$FF : BEQ .done
LSR : TAX
TYA : cmp KeyTable, X : BNE +
- PLX : SEC : RTS
+ CMP.B #$24 : BEQ -
.done
PLX : CLC : RTS
BigKeyGet:
LDY $0E80, X
CPY #$32 : BNE +
STZ $02E9 : LDY.b #$32 ; what we wrote over
PHX : JSL Link_ReceiveItem : PLX ; what we wrote over
CLC : RTL
+ SEC : RTL
LoadProperties_PreserveCertainProps:
LDA $0E20, X : CMP #$E4 : BEQ +
CMP #$E5 : BEQ +
JML Sprite_LoadProperties
+ LDA $0F50, X : PHA
LDA $0E80, X : PHA
JSL Sprite_LoadProperties
PLA : STA $0E80, X
PLA : STA $0F50, X
RTL
SubstitionFlow:
CPY.b #$04 : BNE +
RTL ; let enemizer/vanilla take care of it
+ PLA : PLA ; remove JSL stuff
CPY.b #$16 : BCS +
PEA.w Sprite_SpawnSecret_NotRandomBush-1 : RTL ; jump to not_random_bush spot
; jump directly to new code
+ PEA.w Sprite_SpawnSecret_SpriteSpawnDynamically-1
RTL
SubstitionTable:
db $DB ; RED RUPEE - 0x16
db $E2 ; ARROW REFILL 10 - 0x17
db $DD ; BOMB REFILL 4 - 0x18
db $DE ; BOMB REFILL 8 - 0x19
db $AC ; APPLES - 0x1A
db $79 ; BEE TRAP - 0x1B
db $79 ; GOOD BEE - 0x1C
SubstituteSpriteId:
CPY.b #$16 : BCS +
RTS
+ LDA.b #$01
CPY.b #$18 : BCC +
LDA.b #$05
+ STA.b $0D
JSR IncrementCountsForSubstitute
PHB : PHK : PLB
LDA.w SubstitionTable-$16, Y ; Do substitute
PLB
RTS
CheckSprite_Spawn:
JSR SubstituteSpriteId
CPY.b #$1C : BNE + ; good bee handling
JSL Sprite_SpawnDynamically
BMI .check
PHX
TYX : JSL.l Sprite_LoadProperties
PLX
JSL.l GoldBee_SpawnSelf_SetProperties
PLA : PLA : PLA ; pop the return address
PHX : LDX.b #$03
JML Sprite_SpawnSecret_SetCoords
+ CPY.b #$1A : BCC + ; all other non-normal pot sprite spawns
JSL Sprite_SpawnDynamically
BMI .check
LDA.b #$10 : STA.b $0D ; lets the outside code treat this sprite like a Stal (most normal table values)
RTL
+
JSL Sprite_SpawnDynamically
BMI .check
RTL
.check
LDA $0D : CMP #$08 : BNE +
LDA $0372 : BNE .error
LDX #$0F
; loop looking for a Sprite with state 0A (carried by the player)
- LDA $0DD0, X : CMP #$0A : BEQ .foundIt
DEX : BMI .error : BRA -
.foundIt
LDA #$00 : STZ $0DD0, X
LDA #$E4 : JSL Sprite_SpawnDynamically
BMI .error
LDA #$40 : TSB $0308 : RTL
.error
LDA.b #$3C ; SFX2_3C - error beep
STA.w $012E
+ LDA #$FF
RTL
PreventPotSpawn:
LDA #$40 : BIT $0308 : BEQ +
STZ $0308 : RTL
+ LDA.b #$80 : STA.w $0308 ; what we wrote over
RTL
PreventPotSpawn2:
LDA $0308 : BEQ +
LDA.b #$01 : TSB.b $50 ; what we wrote over
+ RTL
CheckIfPotIsSpecial:
TXA ; give index to A so we can do a CMP.l
CMP.l $018550 ; see if our current index is that of object 230
BEQ .specialpot
; Normal pot, so run the vanilla code
LDA.l CurrentWorld ; check for dark world
.specialpot ; zero flag already set, so gtg
RTL
SetTheSceneFix:
STZ.b $6C
JSL InitializeMirrorHDMA
JSL LoadCommonSprites_long
RTL
pushpc
org $868072
JSL SetBottleVendorKey : NOP #4
pullpc
SetBottleVendorKey:
LDA.w $0E20,Y : CMP.b #$E4 : BNE +
; small key from bottle vendor
LDA.b #$AF : STA.w $0E80,Y
LDA.b #$01 : STA.w !SPRITE_REDRAW, Y
BRA .shift
+ CMP.b #$DE : BEQ .return
CMP.b #$E2 : BEQ .return
; shift narrow sprite to left by 4
.shift
LDA.b $00 : CLC : ADC.b #$04 : STA.w $0D10,Y ; what we wrote over
.return
RTL
ConditionalLoadCommonSprites_Do3To4Low:
LDA.b $10 : CMP.b #$01 : BEQ + ; what we wrote over
CMP.b #$0E : BEQ ++
JML LoadCommonSprites_Prep3To4Low
+ JML LoadCommonSprites_in_file_select
++ LDA.b #$50 : STA.w $2117 ; skip over some DMA bytes
JML Sound_LoadLightWorldSongBank-1 ; just some RTS in Bank 00
incsrc dynamic_si_vram.asm
;===================================================================================================
; Pot items
;===================================================================================================
;Vanilla:
; Data starts at $01DDE7 formatted:
; dw aaaa : db i
; aaaa is a 14 bit number: ..tt tttt tttt tttt indicating the tilemap ID
; i is the secrets ID
;Drop shuffle changes:
; normal secrets stay vanilla
; major items (anything not a secret) use the bits 14 and 15 to produce different behavior
; aaaa is now a 16 bit number:
; imtt tttt tttt tttt
; t - is still tilemap id (aaaa & #$3FFF)
; i - flag indicates a major item
; m - indicates a multiworld item
; for major items (non multiworld), i indicates the item receipt ID
; for multi world items, i indicates the multiworld id
; multiworld id indexes a new table of 256 entries of 2 bytes each
; MultiWorldTable:
; db <item receipt ID>, <player ID>
;===================================================================================================
; Sprite items
;===================================================================================================
;Vanilla:
;If this value appears in the sprite table, then the sprite that preceded it is given a key drop
; db $FE, $00, $E4
;Drop shuffle changes:
; db <receipt id>, $00, $F8 ; this denotes the previous sprite is given a major item (non MW)
; db <receipt id>, <player>, $F9 ; this denotes the previous sprite is given a MW item

View File

@@ -8,13 +8,16 @@ LampCheck:
CMP.b #$FF : BNE + : INC : RTL : +
LDA LampEquipment : BNE .done ; skip if we already have lantern
LDA $040C : CMP.b #$FF : BEQ +
CMP.b #$04 : BCS + ; check if we're in HC
LDA CurrentWorld : BNE +
.lightWorld
LDA $040C : BNE ++ ; check if we're in sewers
LDA LampConeSewers : BRA .done
+ LDA CurrentWorld : BNE +
LDA LampConeLightWorld : BRA .done
+ LDA LampConeDarkWorld
++
LDA LampConeLightWorld : BRA .done
+
.darkWorld
LDA LampConeDarkWorld
.done
;BNE + : STZ $1D : + ; remember to turn cone off after a torch
RTL

View File

@@ -2,9 +2,7 @@
; Mantle Object Changes
;--------------------------------------------------------------------------------
Mantle_CorrectPosition:
LDA.l ProgressFlags : AND.b #$04 : BNE .spawnOpen
LDA.l StartingEntrance : CMP.b #$04 : BNE +
.spawnOpen
LDA ProgressFlags : AND.b #$04 : BEQ +
LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be
LDA.b #$03 : STA $0D30, X
LDA.b #$90 : STA $0ED0, X
@@ -12,11 +10,3 @@ Mantle_CorrectPosition:
LDA $0D00, X : !ADD.b #$03 ; thing we did originally
RTL
;--------------------------------------------------------------------------------
MirrorScrollSpawnZelda:
LDA.l MirrorEquipment : CMP.b #$01 : BNE + ;mirror scroll
LDA.l StartingEntrance : CMP.b #$02 : BEQ ++ ; zelda's cell
CMP.b #$04 : BNE +
++ INC $04AA
; what we replaced
+ STZ.b $11 : STZ.b $14
RTL

View File

@@ -1,23 +0,0 @@
OnMenuLoad:
LDA.b #UploadMenuOnlyIcons>>0 : STA !NMI_AUX
LDA.b #UploadMenuOnlyIcons>>8 : STA !NMI_AUX+1
LDA.b #UploadMenuOnlyIcons>>16 : STA !NMI_AUX+2
LDA.b #$0E : STA.b $10 ; what we overwrote
RTL
UploadMenuOnlyIcons:
REP #$20
LDA.w #MenuOnlyIcons : STA.w $4342
LDA.w #$1801 : STA.w $4340
LDA.w #$0240 : STA.w $4345
LDA.w #$0F800>>1 : STA.w $2116
SEP #$20
LDA.b #MenuOnlyIcons>>16 : STA.w $4344
LDA.b #$80 : STA.w $2118
LDA.b #$10 : STA.w $420B
RTL
MenuOnlyIcons:
incbin "menuonly.2bpp"

Binary file not shown.

View File

@@ -1,300 +0,0 @@
; adding support for up to 13 markers
!MC_FLAG = "$7F5420"
; tables
org $8ABDF6
WorldMapIcon_posx_vanilla:
dw $0F31 ; prize1
dw $08D0 ; prize2
dw $0108
dw $0F40
dw $0082
dw $0F11
dw $01D0
dw $0100
dw $0CA0
dw $0759
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE16
WorldMapIcon_posy_vanilla:
dw $0620 ; prize1
dw $0080 ; prize2
dw $0D70
dw $0620
dw $00B0
dw $0103
dw $0780
dw $0CA0
dw $0DA0
dw $0ED0
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE36
WorldMapIcon_posx_located:
dw $FF00 ; prize1
dw $FF00 ; prize2
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE56
WorldMapIcon_posy_located:
dw $FF00 ; prize1
dw $FF00 ; prize2
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FF00
dw $FFFF ; reserved - not used
dw $FFFF
dw $FFFF
org $8ABE76
WorldMapIcon_tile:
db $38, $62 ; green pendant
db $32, $60 ; red pendant
db $34, $60 ; blue pendant
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $34, $64 ; crystal
db $32, $66 ; skull looking thing
db $00, $00 ; red x
db $00, $00 ; red x
db $00, $00 ; unused red x's
db $00, $00
db $00, $00
org $8ABE96
CompassExists:
; dw $37FC ; todo: convert to two bytes with masks? so much extra code...
; eastern hera desert pod skull trock thieves mire ice swamp gt at escape
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00
; 0 = light world, 1 = dark world
org $8ABEA6
WorldCompassMask:
db $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00
; eastern desert hera pod skull trock thieves mire ice swamp gt at escape x1 x2 x3
; refs
org $8AC59B
WorldMapIcon_AdjustCoordinate:
org $8AC3B1
WorldMap_CalculateOAMCoordinates:
org $8AC52E
WorldMap_HandleSpriteBlink:
org $8ABF70
WorldMap_RedXChars:
org $8AC02B
DrawPrizesOverride:
LDX.b #$FF
.loopStart
INX : PHX
JSR OverworldMap_CheckForPrize
BCC + : JMP .skip_draw : +
TXA : ASL A : TAX
LDA.l !MC_FLAG
AND #$01 : BNE +
LDA.l WorldMapIcon_posx_vanilla+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_vanilla, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_vanilla+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_vanilla, X : STA.l $7EC108
BRA .adjustment
+ LDA.l WorldMapIcon_posx_located+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_located, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_located+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_located, X : STA.l $7EC108
.adjustment
LDA.l WorldMapIcon_tile, X : CMP #$FF : BEQ .skip_draw
LDA.l WorldMapIcon_tile+1, X : BEQ .dont_adjust
CMP.b #$64 : BEQ .is_crystal
LDA.b $1A : AND.b #$10 : BNE .skip_draw
.is_crystal
JSR WorldMapIcon_AdjustCoordinate
.dont_adjust
JSR WorldMap_CalculateOAMCoordinates
BCC .skip_draw
PLX : PHX : TXA : ASL A : TAX
LDA.l WorldMapIcon_tile+1, X : BEQ .is_red_x
LDA.l !MC_FLAG : CMP.b #$01 : BEQ .is_red_x
LDA.l WorldMapIcon_tile+1, X : STA.b $0D
LDA.l WorldMapIcon_tile, X : STA.b $0C
LDA.b #$02 : BRA .continue
.is_red_x
LDA.b $1A : LSR #3 : AND.b #$03 : TAX
LDA.l WorldMap_RedXChars,X : STA.b $0D
LDA.b #$32 : STA.b $0C : LDA.b #$00
.continue
STA.b $0B
PLX : PHX
INX : JSR WorldMap_HandleSpriteBlink
.skip_draw
; end of loop
PLX : CPX #12 : BCS + : JMP .loopStart : +
PLA : STA.l $7EC10B
PLA : STA.l $7EC10A
PLA : STA.l $7EC109
PLA : STA.l $7EC108
RTS
; X - the index of the prize marker
OverworldMap_CheckForPrize:
PHX
LDA #$00 : STA.l !MC_FLAG
JSR OverworldMap_CheckForCompass
BCC +
LDA.l !MC_FLAG : ORA #$01 : STA.l !MC_FLAG
LDA CurrentWorld : AND #$40 : BNE ++ ; is the compass position on LW or DW?
LDA.l WorldCompassMask, X : BEQ + : JMP .fail
++ LDA.l WorldCompassMask, X : BNE + : JMP .fail
+ JSR OverworldMap_CheckForMap
BCC +
LDA.l !MC_FLAG : ORA #$02 : STA.l !MC_FLAG
+
LDA.l !MC_FLAG : BEQ .fail
CMP #$02 : BNE .checkIfObtained
LDA CurrentWorld : AND #$40 : BNE +
CPX #3 : BCS .fail : BRA .checkIfObtained
+ CPX #10 : BCS .fail
CPX #3 : BCC .fail
.checkIfObtained
LDA.l MC_DungeonIdsForPrize, X
BPL +++ : CLC : BRA .done : +++ ; non-prize flags
TAX : LDA.l CrystalPendantFlags_2, X : BEQ .checkPendant
AND.b #$40 : BNE .checkCrystal
LDA.l CrystalPendantFlags_2, X : AND.b #$01 : BNE .checkAga1
LDA.l CrystalPendantFlags_2, X : AND.b #$02 : BNE .checkAga2
; see if hyrule castle has been completely cleared
LDA.l CompassTotalsWRAM, X : SEC : SBC DungeonLocationsChecked, X : BEQ .fail
CLC : BRA .done
.checkPendant
LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkCrystal
LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkAga1
LDA ProgressIndicator : CMP #$03 : BEQ .fail
CLC : BRA .done
.checkAga2
LDA RoomDataWRAM[$0D].high : AND #$08 : BNE .fail
CLC : BRA .done
.fail
SEC
.done
PLX
RTS
; X - which compass in question
; CLC - should not move indicator
; SEC - yep indicator can move
OverworldMap_CheckForCompass:
LDA.l CompassMode : AND #$80 : BEQ .unset ; should I check for compass logic
LDA.l CompassMode : AND #$40 : BEQ .set ; compasses/maps aren't shuffled
LDA.l CompassMode : AND #$20 : BNE +
JSR OverworldMap_CheckForMap : BCC .unset : BRA .set
+ LDA.l CompassExists, X : BEQ .set ; compass doesn't exist
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put compass offset into X
LDA CompassField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the compass obtained
.unset
CLC
RTS
.set
SEC
RTS
; map - which map in question
; CLC - should not show exact prize
; SEC - yep should show exact prize
OverworldMap_CheckForMap:
LDA.l MapMode : BEQ .set ; obtaining map doesn't change anything
LDA CurrentWorld : AND #$40 : BNE + ; not really sure on this check
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE .set : BRA .continue
+ LDA MapField : ORA MapOverlay : AND.b #$02 : BNE .set
.continue
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put map offset into X
LDA MapField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the map obtained?
.unset
CLC
RTS
.set
SEC
RTS
; eastern desert hera pod skull trock thieves mire ice swamp gt at escape
MC_DungeonIdsForPrize:
db $02, $0A, $03, $06, $08, $0C, $0B, $07, $09, $05, $00, $04, $01
MC_SRAM_Offsets:
db $01, $00, $01, $01, $00, $00, $00, $01, $00, $01, $00, $01, $01
MC_Masks:
; EP TH DP PD SK TR TT MM
db $20, $20, $10, $02, $80, $08, $10, $01, $40, $04, $04, $08, $40
warnpc $8AC3B1 ; above code should not exceed the space of the code segment it is overwriting

61
msu.asm
View File

@@ -76,7 +76,7 @@
;
; Additional tracks
;
; 60 - Light World OW (after aga kill)
; 60 - Light World OW (after ped pull)
; 61 - Dark World OW (with all crystals)
;
;=======================================
@@ -237,54 +237,41 @@ CheckMusicLoadRequest:
LDA !REG_MUSIC_CONTROL_REQUEST
CMP.b #02 : BEQ .lightworld
CMP.b #04 : BEQ .no_change+1 ; bunny
CMP.b #09 : BEQ .darkworld
CMP.b #13 : BEQ .darkwoods
CMP.b #15 : BEQ .darkwoods
CMP.b #16 : BEQ .castle
CMP.b #17 : BEQ .dungeon
CMP.b #22 : BEQ .dungeon
CMP.b #21 : BEQ .boss
JMP .check_fallback
CMP.b #21 : BNE .check_fallback
.boss
;.boss
LDA $040C : LSR : !ADD.b #45
BRA .check_fallback-3
.no_change
PLA : BRA .check_fallback-3
.lightworld
PHA
LDA InvertedMode : BNE +
;LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ + ; ped pull
LDA ProgressIndicator : CMP.b #03 : BNE .no_change ; aga1 killed
- PLA : LDA.b #60 : BRA .check_fallback-3
LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
PLA
LDA.b #60 : BRA .check_fallback-3
+
LDA CrystalsField : CMP.b #$7F : BNE .no_change
BRA -
-- : PLA : BRA .check_fallback-3
.darkworld
PHA
LDA InvertedMode : BNE +
LDA CrystalsField : CMP.b #$7F : BNE .no_change
- PLA : LDA.b #61 : BRA .check_fallback-3
+
LDA ProgressIndicator : CMP.b #03 : BNE .no_change ; aga1 killed
BRA -
LDA CrystalsField : CMP.b #$7F : BNE --
- : PLA
LDA.b #61 : BRA .check_fallback-3
.darkwoods
PHA
LDX $8A : LDA.l OWTileWorldAssoc,X : BEQ +
PLA : BRA .darkworld
+ PLA : BRA .lightworld
LDA CrystalsField : CMP.b #$7F : BEQ -
LDA CurrentWorld : BEQ --
LDA $8A : CMP #$40 : BNE --
PLA
LDA.b #15 : BRA .check_fallback-3
.castle
LDA $040C
CMP.b #$08 : BNE .check_fallback ; Hyrule Castle 2
.dungeon
LDA $040C : CMP.b #$1A : BNE +
PHA : LDA.l DRMode : BEQ ++
LDA.w BigKeyField : AND.b #$04 : BEQ ++
; if door rando and entering GT with BK
PLA : LDA.b #59 : BRA .check_fallback-3
++ PLA
+ LSR : !ADD.b #33 : STA !REG_MUSIC_CONTROL_REQUEST
LDA $040C : LSR : !ADD.b #33 : STA !REG_MUSIC_CONTROL_REQUEST
.check_fallback
LDX !REG_MUSIC_CONTROL_REQUEST
@@ -383,15 +370,7 @@ CheckMusicLoadRequest:
; Fade out music if we're changing tracks on a stair transition
;--------------------------------------------------------------------------------
SpiralStairsPreCheck:
LDA.l DRMode : BEQ + ; if door rando enabled
JSL LookupSpiralOffset_long
REP #$30 : AND.w #$00FF : ASL #2 : TAX
LDA.l SpiralTable,X
SEP #$10 : TAX : CPX.b #$07 : BNE .done ; check if hera boss
JSL CheckHeraBossDefeated : BCS .done
LDX.b #$F1 : STX !REG_MUSIC_CONTROL_REQUEST
BRA .done
+ REP #$20 ; thing we wrote over
REP #$20 ; thing we wrote over
LDA $A0
CMP.w #$000C : BNE +
LDA !REG_CURRENT_MSU_TRACK : AND.w #$00FF : CMP.w #59 : BNE .done
@@ -421,11 +400,7 @@ SpiralStairsPreCheck:
; Change music on stair transition (ToH/GT)
;--------------------------------------------------------------------------------
SpiralStairsPostCheck:
LDA.l DRMode : BEQ + ; if door rando enabled
LDA.b $A2 : CMP.w #$0007 : BNE .done
LDA.l Music_Hera : TAX : STX !REG_MUSIC_CONTROL_REQUEST
BRA .done
+ LDA $A0
LDA $A0
CMP.w #$000C : BNE +
; Ganon's tower entrance
LDX $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out

View File

@@ -1,288 +0,0 @@
macro Print_Text(hdr, hdr_len, player_id)
PHX : PHY : PHP
REP #$30
LDX #$0000
-
CPX <hdr_len> : !BGE ++
LDA <hdr>, X
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
LDY <hdr_len>
LDA <player_id>
AND #$00FF
DEC
CMP #$00FF : !BGE .textdone
ASL #5
TAX
-
CPY <hdr_len>+$20 : !BGE ++
LDA PlayerNames, X
PHX : TYX : STA !MULTIWORLD_HUD_CHARACTER_DATA, X : PLX
INX #2 : INY #2
BRA -
++
TYX
-
CPX #$0040 : !BGE ++
LDA #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
SEP #$20
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW
LDA !MULTIWORLD_HUD_DELAY
STA !MULTIWORLD_HUD_TIMER
.textdone
PLP : PLY : PLX
endmacro
WriteText:
{
PHA : PHX : PHP
SEP #$10
LDX $4340 : PHX ; preserve DMA parameters
LDX $4341 : PHX ; preserve DMA parameters
LDX $4342 : PHX ; preserve DMA parameters
LDX $4343 : PHX ; preserve DMA parameters
LDX $4344 : PHX ; preserve DMA parameters
LDX $4345 : PHX ; preserve DMA parameters
LDX $4346 : PHX ; preserve DMA parameters
LDX $2115 : PHX ; preserve DMA parameters
LDX $2116 : PHX ; preserve DMA parameters
LDX $2117 : PHX ; preserve DMA parameters
LDX $2100 : PHX : LDX.b #$80 : STX $2100 ; save screen state & turn screen off
REP #$20
LDX #$80 : STX $2115
LDA #$6000+$0340 : STA $2116
LDA.w #!MULTIWORLD_HUD_CHARACTER_DATA : STA $4342
LDX.b #!MULTIWORLD_HUD_CHARACTER_DATA>>16 : STX $4344
LDA #$0040 : STA $4345
LDA #$1801 : STA $4340
LDX #$10 : STX $420B
PLX : STX $2100 ; put screen back however it was before
PLX : STX $2117 ; restore DMA parameters
PLX : STX $2116 ; restore DMA parameters
PLX : STX $2115 ; restore DMA parameters
PLX : STX $4346 ; restore DMA parameters
PLX : STX $4345 ; restore DMA parameters
PLX : STX $4344 ; restore DMA parameters
PLX : STX $4343 ; restore DMA parameters
PLX : STX $4342 ; restore DMA parameters
PLX : STX $4341 ; restore DMA parameters
PLX : STX $4340 ; restore DMA parameters
PLP : PLX : PLA
RTL
}
GetMultiworldItem:
{
PHP
LDA !MULTIWORLD_ITEM : BNE +
LDA !MULTIWORLD_HUD_TIMER : BNE +
BRL .return
+
LDA $10
CMP #$07 : BEQ +
CMP #$09 : BEQ +
CMP #$0B : BEQ +
BRL .return
+
LDA !MULTIWORLD_HUD_TIMER : BEQ .textend
DEC #$01 : STA !MULTIWORLD_HUD_TIMER
CMP #$00 : BNE .textend
; Clear text
PHP : REP #$30
LDX #$0000
-
CPX #$0040 : !BGE ++
LDA #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2
BRA -
++
PLP
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW
.textend
LDA $5D
CMP #$00 : BEQ +
CMP #$04 : BEQ +
CMP #$17 : BEQ +
BRL .return
+
LDA !MULTIWORLD_ITEM : BNE +
BRL .return
+
PHA
LDA #$22
LDY #$04
JSL Ancilla_CheckForAvailableSlot : BPL +
PLA
BRL .return
+
PLA
; Check if we have a key for the dungeon we are currently in
LDX $040C
; Escape
CMP #$A0 : BNE + : CPX #$00 : BEQ ++ : CPX #$02 : BEQ ++ : BRL .keyend : ++ : BRL .thisdungeon : +
; Eastern
CMP #$A2 : BNE + : CPX #$04 : BEQ .thisdungeon : BRA .keyend : +
; Desert
CMP #$A3 : BNE + : CPX #$06 : BEQ .thisdungeon : BRA .keyend : +
; Hera
CMP #$AA : BNE + : CPX #$14 : BEQ .thisdungeon : BRA .keyend : +
; Aga
CMP #$A4 : BNE + : CPX #$08 : BEQ .thisdungeon : BRA .keyend : +
; PoD
CMP #$A6 : BNE + : CPX #$0C : BEQ .thisdungeon : BRA .keyend : +
; Swamp
CMP #$A5 : BNE + : CPX #$0A : BEQ .thisdungeon : BRA .keyend : +
; SW
CMP #$A8 : BNE + : CPX #$10 : BEQ .thisdungeon : BRA .keyend : +
; TT
CMP #$AB : BNE + : CPX #$16 : BEQ .thisdungeon : BRA .keyend : +
; Ice
CMP #$A9 : BNE + : CPX #$12 : BEQ .thisdungeon : BRA .keyend : +
; Mire
CMP #$A7 : BNE + : CPX #$0E : BEQ .thisdungeon : BRA .keyend : +
; TR
CMP #$AC : BNE + : CPX #$18 : BEQ .thisdungeon : BRA .keyend : +
; GT
CMP #$AD : BNE + : CPX #$1A : BEQ .thisdungeon : BRA .keyend : +
; GT BK
CMP #$92 : BNE .keyend : CPX #$1A : BNE .keyend : LDA #$32 : BRA .keyend
.thisdungeon
LDA #$24
.keyend
STA $02D8 ;Set Item to receive
TAY
LDA #$01 : STA !MULTIWORLD_RECEIVING_ITEM
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9
JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL Link_ReceiveItem
LDA #$00 : STA !MULTIWORLD_ITEM : STA !MULTIWORLD_RECEIVING_ITEM
%Print_Text(HUD_ReceivedFrom, #$001C, !MULTIWORLD_ITEM_FROM)
.return
PLP
LDA $5D : ASL A : TAX
RTL
}
Multiworld_OpenKeyedObject:
{
PHP
SEP #$20
LDA ChestData_Player+2, X : STA !MULTIWORLD_ITEM_PLAYER_ID
PLP
LDA !Dungeon_ChestData+2, X ; thing we wrote over
RTL
}
Multiworld_BottleVendor_GiveBottle:
{
PHA : PHP
SEP #$20
LDA BottleMerchant_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
RTL
}
Multiworld_MiddleAgedMan_ReactToSecretKeepingResponse:
{
PHA : PHP
SEP #$20
LDA PurpleChest_Item_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
RTL
}
Multiworld_Hobo_GrantBottle:
{
PHA : PHP
SEP #$20
LDA HoboItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over
RTL
}
Multiworld_MasterSword_GrantToPlayer:
{
PHA : PHP
SEP #$20
LDA PedestalSword_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
CPY.b #$6A : BEQ +
JSL Link_ReceiveItem ; thing we wrote over
RTL
+ JSL ActivateGoal
RTL
}
Multiworld_AddReceivedItem_notCrystal:
{
TYA : STA $02E4 : PHX ; things we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PHY : LDY $02D8 : JSL AddInventory : PLY
%Print_Text(HUD_SentTo, #$0010, !MULTIWORLD_ITEM_PLAYER_ID)
LDA #$33 : STA $012F
JML.l AddReceivedItem_gfxHandling
+
JML.l AddReceivedItem_notCrystal+5
}
Multiworld_Ancilla_ReceiveItem_stillInMotion:
{
CMP.b #$28 : BNE + ; thing we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
JML.l Ancilla_ReceiveItem_stillInMotion_moveon
+
JML.l Ancilla_ReceiveItem_dontGiveRupees
}
Multiworld_ConsumingFire_TransmuteToSkullWoodsFire:
{
LDA $8A : AND.b #$40 : BEQ .failed ; things we wrote over
LDA $0C4A : CMP #$22 : BEQ .failed
LDA $0C4B : CMP #$22 : BEQ .failed
LDA $0C4C : CMP #$22 : BEQ .failed
LDA $0C4D : CMP #$22 : BEQ .failed
LDA $0C4E : CMP #$22 : BEQ .failed
LDA $0C4F : CMP #$22 : BEQ .failed
JML.l ConsumingFire_TransmuteToSkullWoodsFire_continue
.failed
JML.l AddDoorDebris_spawn_failed
}

View File

@@ -1,525 +0,0 @@
;org $32DFD0 ; PC 0x195FD0
;"received from " 28 bytes
HUD_ReceivedFrom:
dw $296E, $2961, $295F, $2961, $2965, $2972, $2961, $2960, $007F, $2962, $296E, $296B, $2969, $007F
;org $32DFEC ; PC 0x195FEC
;"sent to " 16 bytes
HUD_SentTo:
dw $296F, $2961, $296A, $2970, $007F, $2970, $296B, $007F
;org $32DFFC ; PC 0x195FFC
;--------------------------------------------------------------------------------
; Player names (32 bytes/player) - 255 players
;--------------------------------------------------------------------------------
PlayerNames:
; Player1
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player2
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player3
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player4
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player5
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player6
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player7
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player8
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player9
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player10
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player11
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player12
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player13
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player14
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player15
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player16
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player17
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player18
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player19
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player20
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player21
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player22
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player23
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player24
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player25
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player26
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player27
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player28
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player29
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player30
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player31
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player32
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player33
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player34
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player35
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player36
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player37
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player38
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player39
dw $296C, $2968, $295D, $2975, $2961, $296E, $297A, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player40
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player41
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player42
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player43
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player44
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player45
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player46
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player47
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player48
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player49
dw $296C, $2968, $295D, $2975, $2961, $296E, $297B, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player50
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player51
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player52
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player53
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player54
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player55
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player56
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player57
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player58
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player59
dw $296C, $2968, $295D, $2975, $2961, $296E, $297C, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player60
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player61
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player62
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player63
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player64
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player65
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player66
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player67
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player68
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player69
dw $296C, $2968, $295D, $2975, $2961, $296E, $297D, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player70
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player71
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player72
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player73
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player74
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player75
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player76
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player77
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player78
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player79
dw $296C, $2968, $295D, $2975, $2961, $296E, $297E, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player80
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player81
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player82
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player83
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player84
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player85
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player86
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player87
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player88
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player89
dw $296C, $2968, $295D, $2975, $2961, $296E, $297F, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player90
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player91
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player92
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player93
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player94
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player95
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player96
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player97
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player98
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player99
dw $296C, $2968, $295D, $2975, $2961, $296E, $294B, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player100
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player101
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player102
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player103
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player104
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player105
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player106
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player107
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player108
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player109
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2977, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player110
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player111
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player112
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player113
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player114
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player115
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player116
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player117
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player118
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player119
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2978, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player120
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player121
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player122
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player123
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player124
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player125
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player126
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player127
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player128
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player129
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $2979, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player130
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player131
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player132
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player133
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player134
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player135
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player136
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player137
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player138
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player139
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297A, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player140
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player141
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player142
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player143
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player144
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player145
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player146
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player147
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player148
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player149
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297B, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player150
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player151
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player152
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player153
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player154
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player155
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player156
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player157
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player158
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player159
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297C, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player160
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player161
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player162
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player163
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player164
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player165
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player166
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player167
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player168
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player169
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297D, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player170
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player171
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player172
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player173
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player174
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player175
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player176
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player177
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player178
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player179
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297E, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player180
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player181
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player182
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player183
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player184
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player185
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player186
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player187
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player188
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player189
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $297F, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player190
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player191
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player192
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player193
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player194
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player195
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player196
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player197
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player198
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player199
dw $296C, $2968, $295D, $2975, $2961, $296E, $2978, $294B, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player200
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player201
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player202
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player203
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player204
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player205
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player206
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player207
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player208
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player209
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2977, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player210
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player211
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player212
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player213
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player214
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player215
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player216
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player217
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player218
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player219
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2978, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player220
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player221
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player222
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player223
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player224
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player225
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player226
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player227
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player228
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player229
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $2979, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player230
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player231
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player232
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player233
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player234
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player235
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player236
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player237
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player238
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player239
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297A, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player240
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player241
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player242
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player243
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player244
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player245
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player246
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297D, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player247
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297E, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player248
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $297F, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player249
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297B, $294B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player250
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $2977, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player251
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $2978, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player252
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $2979, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player253
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $297A, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player254
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $297B, $007F, $007F, $007F, $007F, $007F, $007F, $007F
; Player255
dw $296C, $2968, $295D, $2975, $2961, $296E, $2979, $297C, $297C, $007F, $007F, $007F, $007F, $007F, $007F, $007F

272
music.asm
View File

@@ -3,20 +3,77 @@ PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
JSL.l FixFrogSmith ; Just a convenient spot to install this hook
JSR.w FixFrogSmith ; Just a convenient spot to install this hook
LDY.b #$58 ; death mountain animated tileset.
LDX.b #$02 ; Default light world theme
LDA $8A : ORA #$40 ; check both light and dark world DM at the same time
CMP.b #$43 : BEQ +
CMP.b #$45 : BEQ +
CMP.b #$47 : BEQ +
CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks
LDY.b #$5A ; Main overworld animated tileset
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check what phase we're in
;LDA ProgressIndicator : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3)
;+
; Check if we're entering the village
LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
LDX.b #$05 ; Lost woods theme
; check if we've pulled from the master sword pedestal
LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
LDX.b #$02 ; Default light world theme
+
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA ProgressIndicator : CMP.b #$02 : !BGE +
; If phase < 2, play the legend music
LDX.b #$03
+
.endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection
;LDA CurrentWorld : BEQ .checkInverted+4
+ JSL Overworld_DetermineMusic
LDA CurrentWorld : BEQ .checkInverted+4
LDX.b #$0F ; dark woods theme
; This music is used in dark woods
LDA $8A
CMP.b #$40 : BEQ +
LDX.b #$0D ; dark death mountain theme
; This music is used in dark death mountain
CMP.b #$43 : BEQ + : CMP.b #$45 : BEQ + : CMP.b #$47 : BEQ +
LDX.b #$09 ; dark overworld theme
+
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme
+
.lastCheck
LDA $0132 : CMP.b #$F2 : BNE +
@@ -57,12 +114,58 @@ Overworld_FinishMirrorWarp:
LDA.b #$80 : STA $9B
JSL Overworld_DetermineAmbientSFX
JSL Overworld_DetermineMusic
LDX.b #$04 ; bunny theme
.done
; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ +
LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks
+
LDX.b #$09 ; default dark world theme
LDA $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDX.b #$02 ; hyrule field theme
; Check if we're entering the lost woods
CMP.b #$00 : BNE +
LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks
LDX.b #$05 ; lost woods theme
BRA .endOfLightWorldChecks
+
; Check if we're entering the village
CMP.b #$18 : BNE .endOfLightWorldChecks
; Check what phase we're in
; LDA ProgressIndicator : CMP.b #$03 : !BGE .endOfLightWorldChecks
LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks
STX $012C
LDA $8A : CMP.b #$40 : BNE +
LDX #$0F ; dark woods theme
BRA .bunny
+
CMP.b #$43 : BEQ .darkMountain
CMP.b #$45 : BEQ .darkMountain
CMP.b #$47 : BNE .notDarkMountain
.darkMountain
LDA.b #$09 : STA $012D ; set storm ambient SFX
LDX.b #$0D ; dark mountain theme
.bunny
LDA MoonPearlEquipment : ORA InvertedMode : BNE +
LDX #$04 ; bunny theme
+
STX $012C
.notDarkMountain
LDA $11 : STA $010C
STZ $11
@@ -75,85 +178,78 @@ Overworld_FinishMirrorWarp:
;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic:
JSL Overworld_DetermineAmbientSFX
JSL Overworld_DetermineMusic
STZ $04C8 ; Clear peg puzzle count
RTL
;--------------------------------------------------------------------------------
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$40 : !BGE .notVillageOrWoods
;--------------------------------------------------------------------------------
;X to be set to music track to load
Overworld_DetermineMusic:
LDA ProgressIndicator : CMP.b #$02 : !BGE +
LDX.b #$03 ; If phase < 2, play the rain music
BRA .done
+ LDA $8A : CMP.b #$43 : BEQ .darkMountain
CMP.b #$45 : BEQ .darkMountain
CMP.b #$47 : BEQ .darkMountain
LDX.b #$07 ; Default village theme
LDX.b #$02 ; hyrule field theme
LDA CurrentWorld : BEQ +
LDX.b #$09 ; default dark world theme
; Check what phase we're in
;LDA ProgressIndicator : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3)
;+
; Check if we're entering the village
+ LDA $8A : CMP.b #$18 : BNE +
; Check what phase we're in
; LDA ProgressIndicator : CMP.b #$03 : !BGE .bunny
LDX.b #$07 ; Default village theme (phase <3)
BRA .bunny
; Check if we're entering the lost woods
+ CMP.b #$00 : BNE +
LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .bunny
LDX.b #$05 ; lost woods theme
BRA .bunny
+ CMP.b #$40 : BNE .bunny
LDX #$0F ; dark woods theme
BRA .bunny
LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
.darkMountain
LDX.b #$0D ; dark mountain theme
;LDX.b #$05 ; Lost woods theme
.bunny
; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .done
LDA MoonPearlEquipment : BNE .done
LDX #$04 ; bunny theme
; check if we've pulled from the master sword pedestal
;LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
; LDX.b #$02 ; Default light world theme
;+
.done
RTL
;--------------------------------------------------------------------------------
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
;--------------------------------------------------------------------------------
;$012D to be set to any ambient SFX for the area
Overworld_DetermineAmbientSFX:
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA ProgressIndicator : CMP.b #$02 : !BGE +
BRA .done ; rain state sfx handled elsewhere
+ LDA $8A : CMP.b #$43 : BEQ .darkMountain
CMP.b #$45 : BEQ .darkMountain
CMP.b #$47 : BEQ .darkMountain
; If phase < 2, play the legend music
LDX.b #$03
+
CMP.b #$70 : BEQ .mire
.endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection
LDA CurrentWorld : BEQ .checkInverted+4
LDA.b #$05 : BRA .setSfx ; silence
LDX.b #$09 ; dark overworld theme
.mire
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .done
LDA.b #$01 : BRA .setSfx ; Misery Mire rain SFX
LDA $8A
; Misery Mire rain SFX
CMP.b #$70 : BNE ++
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP $0131 : BEQ +
STA $012D
+ : BRA .checkInverted
++
; This music is used in dark death mountain
CMP.b #$43 : BEQ .darkMountain
; CMP.b #$45 : BEQ .darkMountain
; CMP.b #$47 : BEQ .darkMountain
LDA.b #$05 : STA $012D
BRA .checkInverted
.darkMountain
LDA.b #$09 : BRA .setSfx ; set storm ambient SFX
LDA CrystalsField : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme
+ : LDA.b #$09 : STA $012D
.setSfx
CMP $0131 : BEQ +
STA $012D
+ STZ $012D
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
.done
; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme
+
.lastCheck
RTL
;--------------------------------------------------------------------------------
@@ -189,34 +285,8 @@ Overworld_MosaicDarkWorldChecks:
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; This is the where the music can change due to an UW transition
;
; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown
Underworld_DoorDown_Entry:
LDX #$FF ; some junk value to be used later to determine if the below lines will change the track
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #2 : !BLT .vanilla
LDA.l DRMode : BNE .done
.vanilla ; thing we wrote over
LDA $A0 : CMP.w #$0012 : BNE +
LDX.b #$14 ; value for Sanc music
BRA .done
+ LDA $A2 : CMP.w #$0012 : BNE .done
LDX.b #$10 ; value for Hyrule Castle music
.done
LDA $A0 : RTL
;--------------------------------------------------------------------------------
; This is for changing to/from ToH dungeon/boss music
;
; A=16bit XY=8bit
; Check if the boss in ToH has been defeated (16-bit accumulator)
CheckHeraBossDefeated:
LDA RoomDataWRAM[$07].high : AND.w #$00FF : BEQ +
SEC : RTL
+ CLC : RTL
FallingMusicFadeOut:
CMP.w #$0017 ; what we wrote over
BNE .return
LDA.w $0130 : AND.w #$00FF : CMP.w #$0015 ; if boss music is playing, then fade out
.return
LDA $7EF00F : AND #$00FF
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,300 +1,301 @@
NewDrawHud:
SEP #$30
;================================================================================
; Draw bomb count
!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A"
;================================================================================
LDA InfiniteBombsModifier : BNE .infinite_bombs
.finite_bombs
LDA.l SpecialWeapons : AND.b #$7F : CMP #$01 : BNE .normal
LDA.l SpecialWeaponLevel : BEQ .no_bombs
.normal
LDA.l BombsEquipment ; bombs
JSR HudHexToDec2Digit ;requires 8 bit registers!
REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit
BRA +
.no_bombs
REP #$20
LDA.w #$207F : STA !BOMBCOUNT_DRAW_ADDRESS ; blank
STA !BOMBCOUNT_DRAW_ADDRESS+2 ; blank
BRA +
.infinite_bombs
REP #$20
LDA.w #$2431 : STA !BOMBCOUNT_DRAW_ADDRESS ; infinity (left half)
INC A : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
+
;================================================================================
; Draw rupee counter
!RUPEE_DRAW_ADDRESS = "$7EC750"
;================================================================================
LDA.l $7EF362 ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
JSR HudHexToDec4Digit
LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s
LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s
LDX.b $06 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+4 ; 10s
LDX.b $07 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+6 ; 1s
;================================================================================
; Draw arrow count
!ARROWCOUNT_DRAW_ADDRESS = "$7EC760"
;================================================================================
SEP #$20
LDA.l ArrowMode : BNE +
LDA InfiniteArrowsModifier : BNE .infinite_arrows
.finite_arrows
LDA.l CurrentArrows ; arrows
JSR HudHexToDec2Digit
REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; Draw arrows 1 digit
BRA +
.infinite_arrows
REP #$20
LDA.w #$2431 : STA !ARROWCOUNT_DRAW_ADDRESS ; infinity (left half)
INC A : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
+
;================================================================================
; Draw Goal Item Indicator
!GOAL_DRAW_ADDRESS = "$7EC72A"
;================================================================================
REP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
LDA.l GoalCounter
JSR HudHexToDec4Digit
LDA.l GoalItemIcon : STA !GOAL_DRAW_ADDRESS ; draw star icon
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
LDA.l GoalItemRequirement
JSR HudHexToDec4Digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .done
.skip
LDA.w #$207F ; transparent tile
STA !GOAL_DRAW_ADDRESS+8
STA !GOAL_DRAW_ADDRESS+10
STA !GOAL_DRAW_ADDRESS+12
.done
;================================================================================
; Draw Dungeon Compass Counts
;================================================================================
LDA.l CompassMode : AND #$000F : BEQ + ; skip if CompassMode is 0.
JSL.l DrawDungeonCompassCounts ; compasses.asm
+
;================================================================================
; Draw key count
!KEY_DIGITS_ADDRESS = "$7EC764"
!KEY_ICON_ADDRESS = "$7EC726"
;================================================================================
SEP #$20
LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
.in_dungeon
JSR HudHexToDec2Digit : REP #$20
; if 10s digit is 0, draw transparent tile instead of 0
LDX.b $06 : TXA : CPX.b #$90 : BNE +
LDA.w #$007F
+
ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS
; 1s digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS+2
BRA .done_keys
.not_in_dungeon
REP #$20
;in the overworld, draw transparent tiles instead of key count
LDA.w #$247F : STA !KEY_DIGITS_ADDRESS : STA !KEY_DIGITS_ADDRESS+2
STA !KEY_ICON_ADDRESS
.done_keys
;--------------------------------------------------------------------------------
; Draw pendant/crystal icon
;--------------------------------------------------------------------------------
!PRIZE_ICON = $7EC742
!P_ICON = $296C
!C_ICON = $295F
SEP #$20
LDA.b $1B : BEQ .noprize
LDX.w $040C
CPX #$1A : !BGE .noprize
CPX #$04 : !BLT .noprize
CPX #$08 : BEQ .noprize
LDA $10 : CMP #$12 : BEQ .noprize
LDA.l MapMode
REP #$20
BEQ .drawprize
LDA.l MapField
AND.l DungeonItemMasks,X
BEQ .noprize
.drawprize
TXA : LSR : TAX
LDA.l CrystalPendantFlags_2, X
AND.w #$0040 : BNE .is_crystal
LDA.w #!P_ICON
BRA .doneprize
.is_crystal
LDA.w #!C_ICON
BRA .doneprize
.noprize
REP #$20
LDA.w #$207F
.doneprize
STA.l !PRIZE_ICON
;--------------------------------------------------------------------------------
; Draw Magic Meter
!DrawMagicMeter_mp_tilemap = "$0DFE0F"
;--------------------------------------------------------------------------------
LDA CurrentMagic : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud
!ADD #$0007
AND #$FFF8
TAX ; end of crap
LDA InfiniteMagicModifier : AND.w #$00FF : BNE + : JMP .green : +
SEP #$20 : LDA.b #$80 : STA CurrentMagic : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA $1A : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : JMP .green : +
.blue
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA $7EC806
RTL
.red
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA $7EC806
RTL
.yellow
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA $7EC806
RTL
.orange
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA $7EC806
RTL
.green
LDA !DrawMagicMeter_mp_tilemap+0, X : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : STA $7EC806
RTL
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4Digit:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $05 - $07 (high - low)
;================================================================================
;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
; LDY.b #$90
; -
; CMP.b #100 : !BLT +
; INY
; SBC.b #100 : BRA -
; +
; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
; -
; CMP.b #10 : !BLT +
; INY
; SBC.b #10 : BRA -
; +
; STY $06 : LDY #$90 ; Store 10s digit and reset Y
; CMP.b #1 : !BLT +
; -
; INY
; DEC : BNE -
; +
; STY $07 ; Store 1s digit
;RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2Digit:
LDY.b #$90
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
NewDrawHud:
SEP #$30
;================================================================================
; Draw bomb count
!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A"
!INFINITE_BOMBS = "$7F50C9"
;================================================================================
LDA !INFINITE_BOMBS : BNE .infinite_bombs
.finite_bombs
LDA.l BombsEquipment ; bombs
JSR HudHexToDec2Digit ;requires 8 bit registers!
REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit
BRA +
.infinite_bombs
REP #$20
LDA.w #$2431 : STA !BOMBCOUNT_DRAW_ADDRESS ; infinity (left half)
INC A : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
+
;================================================================================
; Draw rupee counter
!RUPEE_DRAW_ADDRESS = "$7EC750"
;================================================================================
LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
JSR HudHexToDec4Digit
LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s
LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s
LDX.b $06 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+4 ; 10s
LDX.b $07 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+6 ; 1s
;================================================================================
; Draw arrow count
!ARROWCOUNT_DRAW_ADDRESS = "$7EC760"
!INFINITE_ARROWS = "$7F50C8"
;================================================================================
SEP #$20
LDA.l ArrowMode : BNE +
LDA !INFINITE_ARROWS : BNE .infinite_arrows
.finite_arrows
LDA.l CurrentArrows ; arrows
JSR HudHexToDec2Digit
REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; Draw arrows 1 digit
BRA +
.infinite_arrows
REP #$20
LDA.w #$2431 : STA !ARROWCOUNT_DRAW_ADDRESS ; infinity (left half)
INC A : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
+
;================================================================================
; Draw Goal Item Indicator
!GOAL_DRAW_ADDRESS = "$7EC72A"
;================================================================================
REP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
LDA.l GoalCounter
JSR HudHexToDec4Digit
LDA.l GoalItemIcon : STA.l !GOAL_DRAW_ADDRESS ; draw star icon
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
LDA.l GoalItemRequirement
JSR HudHexToDec4Digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .done
.skip
LDA.w #$207F ; transparent tile
STA !GOAL_DRAW_ADDRESS+8
STA !GOAL_DRAW_ADDRESS+10
STA !GOAL_DRAW_ADDRESS+12
.done
;================================================================================
; Draw Dungeon Compass Counts
;================================================================================
LDA.l CompassMode : AND #$00FF : BEQ + ; skip if CompassMode is 0.
JSL.l DrawDungeonCompassCounts ; compasses.asm
+
;================================================================================
; Draw key count
!KEY_DIGITS_ADDRESS = "$7EC764"
!KEY_ICON_ADDRESS = "$7EC726"
;================================================================================
SEP #$20
LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
.in_dungeon
JSR HudHexToDec2Digit : REP #$20
; if 10s digit is 0, draw transparent tile instead of 0
LDX.b $06 : TXA : CPX.b #$90 : BNE +
LDA.w #$007F
+
ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS
; 1s digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS+2
BRA .done_keys
.not_in_dungeon
REP #$20
;in the overworld, draw transparent tiles instead of key count
LDA.w #$247F : STA !KEY_DIGITS_ADDRESS : STA !KEY_DIGITS_ADDRESS+2
STA !KEY_ICON_ADDRESS
.done_keys
;--------------------------------------------------------------------------------
; Draw pendant/crystal icon
;--------------------------------------------------------------------------------
!PRIZE_ICON = $7EC742
!P_ICON = $296C
!C_ICON = $295F
SEP #$20
LDA.b $1B : BEQ .noprize
LDX.w $040C
CPX #$1A : !BGE .noprize
CPX #$04 : !BLT .noprize
CPX #$08 : BEQ .noprize
LDA $10 : CMP #$12 : BEQ .noprize
LDA.l MapMode
REP #$20
BEQ .drawprize
LDA.l MapField
AND.l DungeonItemMasks,X
BEQ .noprize
.drawprize
TXA : LSR : TAX
LDA.l CrystalPendantFlags_2, X
AND.w #$0040 : BNE .is_crystal
LDA.w #!P_ICON
BRA .doneprize
.is_crystal
LDA.w #!C_ICON
BRA .doneprize
.noprize
REP #$20
LDA.w #$207F
.doneprize
STA.l !PRIZE_ICON
;--------------------------------------------------------------------------------
; Draw Magic Meter
!INFINITE_MAGIC = "$7F50CA"
!DrawMagicMeter_mp_tilemap = "$0DFE0F"
;--------------------------------------------------------------------------------
LDA CurrentMagic : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud
!ADD #$0007
AND #$FFF8
TAX ; end of crap
LDA !INFINITE_MAGIC : AND.w #$00FF : BNE + : JMP .green : +
SEP #$20 : LDA.b #$80 : STA CurrentMagic : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA $1A : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : JMP .green : +
.blue
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA $7EC806
RTL
.red
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA $7EC806
RTL
.yellow
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA $7EC806
RTL
.orange
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA $7EC806
RTL
.green
LDA !DrawMagicMeter_mp_tilemap+0, X : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : STA $7EC806
RTL
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4Digit:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $05 - $07 (high - low)
;================================================================================
;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
; LDY.b #$90
; -
; CMP.b #100 : !BLT +
; INY
; SBC.b #100 : BRA -
; +
; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
; -
; CMP.b #10 : !BLT +
; INY
; SBC.b #10 : BRA -
; +
; STY $06 : LDY #$90 ; Store 10s digit and reset Y
; CMP.b #1 : !BLT +
; -
; INY
; DEC : BNE -
; +
; STY $07 ; Store 1s digit
;RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2Digit:
LDY.b #$90
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS

File diff suppressed because it is too large Load Diff

View File

@@ -115,7 +115,6 @@ ItemSet_MagicBat:
RTL
ItemSet_OldMan:
PHA : LDA OldManItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA NpcFlags : ORA.b #$01 : STA NpcFlags : PLA
RTL
@@ -126,19 +125,16 @@ ItemSet_ZoraKing:
RTL
ItemSet_SickKid:
PHA : LDA SickKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA NpcFlags : ORA.b #$04 : STA NpcFlags : PLA
RTL
ItemSet_TreeKid:
PHA : LDA TreeKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA NpcFlags : ORA.b #$08 : STA NpcFlags : PLA
RTL
ItemSet_Sahasrala:
PHA : LDA SahasralaItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA NpcFlags : ORA.b #$10 : STA NpcFlags : PLA
RTL
@@ -150,7 +146,6 @@ ItemSet_Catfish:
RTL
ItemSet_Library:
PHA : LDA LibraryItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA NpcFlags : ORA.b #$80 : STA NpcFlags : PLA
RTL
@@ -163,7 +158,6 @@ ItemSet_Mushroom:
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+
LDA MushroomItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLA
;LDY.b #$29
STZ $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently
@@ -186,19 +180,14 @@ Set300RupeeNPCItem:
CMP.w #291 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues)
TAY ; load moldorm cave value into Y
LDA RupeeNPC_MoldormCave_Player
BRA .done
+ CMP.w #286 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_NortheastDarkSwampCave, SpriteItemValues)
TAY ; load northeast dark swamp cave value into Y
LDA RupeeNPC_NortheastDarkSwampCave_Player
BRA .done
+
LDA #$0000
LDY.b #$46 ; default to a normal 300 rupees
.done
SEP #$20
STA !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA
RTL
;================================================================================

File diff suppressed because it is too large Load Diff

View File

@@ -42,6 +42,80 @@ RTL
LDA.b #$FF ; don't show keys
RTL
;================================================================================
GetCrystalNumber:
PHX
TXA : ASL : TAX
LDA CurrentWorld : EOR.b #$40 : BNE +
INX
+
LDA.l CrystalNumberTable-16, X
PLX
RTL
;================================================================================
OverworldMap_CheckObject:
PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA CurrentWorld : AND.b #$40 : BNE +
;LW Map
LDA.l MapMode : BEQ +++
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE +++
PHX
LDA.l .lw_map_offsets, X : TAX ; put map offset into X
LDA MapField, X : ORA MapOverlay, X
PLX
AND.l .lw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .lw_offsets, X
BPL +++ : CLC : BRA .done : +++ ; don't display master sword
TAX : BRA ++
+
;DW Map
LDA.l MapMode : BEQ +++
LDA MapField : ORA MapOverlay : AND.b #$02 : BNE +++
PHX
LDA.l .dw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA MapOverlay, X
PLX
AND.l .dw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .dw_offsets, X
TAX : BRA ++
SEC
PLX
RTL
++
LDA.l CrystalPendantFlags_2, X
AND.b #$40 : BNE .checkCrystal
.checkPendant
LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkCrystal
LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.fail
SEC
.done
PLX
RTL
.lw_offsets
db $02, $0A, $03, $FF
.dw_offsets
db $06, $08, $0C, $0B, $07, $09, $05
.lw_map_offsets
db $01, $00, $01
; pod skull trock thieves mire ice swamp
.dw_map_offsets
db $01, $00, $00, $00, $01, $00, $01
.lw_map_masks
db $20, $20, $10, $00
.dw_map_masks
db $02, $80, $08, $10, $01, $40, $04
;================================================================================
SetLWDWMap:
PHP
SEP #$20 ; set 8-bit accumulator
@@ -397,18 +471,16 @@ DrawHUDDungeonItems:
.next_map
BIT.w .dungeon_bitmasks,X
BNE ..draw_map
; MapMode indicates if maps are needed for the info
LDA.l MapMode : AND #$00FF : BNE ..skip_map
BEQ ..skip_map
..draw_map
LDY.w .dungeon_positions,X
JSL MapIndicatorLong
LDA.w #$2826
STA.w $1686,Y
..skip_map
; reload
LDA.l MapField
..skip_map
INX : INX
CPX.w #26 : BCC .next_map

View File

@@ -33,7 +33,6 @@ QuickSwap:
CPX.b #$01 : BEQ + ; bow
CPX.b #$05 : BEQ + ; powder
CPX.b #$0D : BEQ + ; flute
CPX.b #$0E : BEQ + ; bug net
CPX.b #$10 : BEQ + ; bottle
BRA .store
+ STX $0202 : JSL ProcessMenuButtons_y_pressed

View File

@@ -1,5 +1,6 @@
!INFINITE_BOMBS = "$7F50C9"
IsItemAvailable:
LDA InfiniteBombsModifier : BEQ .finite
LDA !INFINITE_BOMBS : BEQ .finite
.infinite
CPX.b #$04 : BNE .finite
LDA.b #$01 : RTL
@@ -7,39 +8,34 @@ IsItemAvailable:
LDA EquipmentWRAM-1, X
RTL
LoadBombCount:
LDA InfiniteBombsModifier : BNE .infinite
LDA !INFINITE_BOMBS : BNE .infinite
.finite
LDA BombsEquipment
.infinite
RTL
LoadBombCount16:
LDA InfiniteBombsModifier : AND.w #$00FF : BNE .infinite
LDA !INFINITE_BOMBS : AND.w #$00FF : BNE .infinite
.finite
LDA BombsEquipment
.infinite
RTL
StoreBombCount:
JSL IncrementBombsPlacedCounter
PHA : LDA InfiniteBombsModifier : BEQ .finite
PHA : LDA !INFINITE_BOMBS : BEQ .finite
.infinite
PLA : LDA.b #$01 : RTL
.finite
PLA : STA.l BombsEquipment
BNE .done
LDA.l ItemOnB : CMP #$04 : BNE .done
LDA.b #$00 : STA.l ItemOnB
.done
LDA.l BombsEquipment
PLA : STA BombsEquipment
RTL
SearchForEquippedItem:
LDA InfiniteBombsModifier : BEQ +
LDA !INFINITE_BOMBS : BEQ +
LDA.b #$01 : LDX.b #$00 : RTL
+
LDA BowEquipment ; thing we wrote over
RTL
!INFINITE_ARROWS = "$7F50C8"
DecrementArrows:
LDA InfiniteArrowsModifier : BNE .infinite
LDA !INFINITE_ARROWS : BNE .infinite
LDA.l ArrowMode : BNE .rupees : BRA .normal
.infinite
LDA.b #$01 : RTL

View File

@@ -22,7 +22,6 @@ RTL
.forceHeart
LDA #$33 : STA $C8 ; assure the correct state if player talked to shopkeeper
LDA $0403 : AND.b #$40 : BNE .notHeart
LDA ChestGameItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA #$07 ; give prize item
RTL
.notHeart
@@ -111,10 +110,6 @@ RTL
;--------------------------------------------------------------------------------
!RNG_POINTERS = "$7F5200"
GetStaticRNG:
LDA.l SeededRNG : BNE .seeded
JML GetRandomInt
RTL
.seeded
PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F

View File

@@ -83,14 +83,69 @@ IcePalaceBombosNE:
%DrawBombosPlatform(14, 18, 1, 0)
RTL
CastleEastEntrance: ; new solution (see Rain Prevention)
CastleEastEntrance:
LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A
LDA.w #$08e1 ; square peg
%writeTileAt(11,21,0,1)
%writeTileAt(11,26,0,1)
%writeTileAt(20,21,0,1)
%writeTileAt(20,26,0,1)
INC ;horizontal rail
%writeTileAt(12,21,0,1)
%writeTileAt(13,21,0,1)
%writeTileAt(14,21,0,1)
%writeTileAt(15,21,0,1)
%writeTileAt(16,21,0,1)
%writeTileAt(17,21,0,1)
%writeTileAt(18,21,0,1)
%writeTileAt(19,21,0,1)
INC ;vertical rail
%writeTileAt(11,22,0,1)
%writeTileAt(11,23,0,1)
%writeTileAt(11,24,0,1)
%writeTileAt(11,25,0,1)
%writeTileAt(20,22,0,1)
%writeTileAt(20,23,0,1)
%writeTileAt(20,24,0,1)
%writeTileAt(20,25,0,1)
SEP #$20 ; 8 A
RTL
CastleWestEntrance: ; new solution (see Rain Prevention)
CastleWestEntrance:
LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A
LDA.w #$08e1 ; square peg
%writeTileAt(11,21,1,1)
%writeTileAt(11,26,1,1)
%writeTileAt(20,21,1,1)
%writeTileAt(20,26,1,1)
INC ;horizontal rail
%writeTileAt(12,21,1,1)
%writeTileAt(13,21,1,1)
%writeTileAt(14,21,1,1)
%writeTileAt(15,21,1,1)
%writeTileAt(16,21,1,1)
%writeTileAt(17,21,1,1)
%writeTileAt(18,21,1,1)
%writeTileAt(19,21,1,1)
INC ;vertical rail
%writeTileAt(11,22,1,1)
%writeTileAt(11,23,1,1)
%writeTileAt(11,24,1,1)
%writeTileAt(11,25,1,1)
%writeTileAt(20,22,1,1)
%writeTileAt(20,23,1,1)
%writeTileAt(20,24,1,1)
%writeTileAt(20,25,1,1)
SEP #$20 ; 8 A
RTL
RoomCallbackTable:
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00 ; 00x
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 01x
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 02x

View File

@@ -340,22 +340,22 @@ org $1BD1DD : db #$A4, #$06, #$82, #$9E, #$06, #$82, #$FF, #$FF ;new data for ma
;;move pyramid exit overworld door
org $1BB96F+$35+$35 : dw $001b
org $1BBA71+$35+$35 : dw $011c
org $1BBA71+$35+$35 : dw $06a4
org $1BBB73+$35 : db $36
org $02DAEE+$37+$37 : dw $0010
org $02DB8C+$37 : db $1B
org $02DBDB+$37+$37 : dw $000e
org $02DC79+$37+$37 : dw $0600
org $02DD17+$37+$37 : dw $0676
org $02DDB5+$37+$37 : dw $0604
org $02DE53+$37+$37 : dw $06e8
org $02DEF1+$37+$37 : dw $066d
org $02DF8F+$37+$37 : dw $06f3
org $02E02D+$37 : db $00
org $02E07C+$37 : db $0a
org $02DBDB+$37+$37 : dw $0418
org $02DC79+$37+$37 : dw $0679
org $02DD17+$37+$37 : dw $06b4
org $02DDB5+$37+$37 : dw $06c6
org $02DE53+$37+$37 : dw $0728
org $02DEF1+$37+$37 : dw $06e6
org $02DF8F+$37+$37 : dw $0733
org $02E02D+$37 : db $07
org $02E07C+$37 : db $f9
org $02E0CB+$37+$37 : dw $0000
org $02E169+$37+$37 : dw $811c
org $02E169+$37+$37 : dw $0000
;org $02E849 ; Fly 1 to Sanctuary

297
save.asm
View File

@@ -1,129 +1,218 @@
;--------------------------------------------------------------------------------
Validate_SRAM:
REP #$30 ; vanilla behavior from $0CCD45, includes prize pack reset after save and quit
LDX #$00FE : -
STZ $0D00, X
STZ $0E00, X
STZ $0F00, X
DEX #2
BPL -
WriteSaveChecksumAndBackup:
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
CLC : ADC.l SaveDataWRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : - ; Checksum extended save data
CLC : ADC.l ExtendedFileNameWRAM, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
STA.l InverseChecksumSRAM
PHB
LDA.w #$14FF ; \
LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to
LDY.w #SaveBackupSRAM&$FFFF ; | $704000
MVN SRAMBank, SRAMBank ; /
PLB
RTL
;--------------------------------------------------------------------------------
ValidateSRAM:
REP #$30
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
CLC : ADC.l CartridgeSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : - ; Checksum extended save data
CLC : ADC.l ExtendedFileNameSRAM, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l InverseChecksumSRAM : BEQ .goodchecksum
LDX.w #$0000 : TXA : - ; Do the same for the backup save
CLC : ADC.l SaveBackupSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : -
CLC : ADC.l SaveBackupSRAM+$500, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l SaveBackupSRAM+$4FE : BEQ +
TDC : STA.l FileValiditySRAM ; Delete save by way of zeroing validity marker
BRA .goodchecksum : +
PHB
LDA.w #$14FF ; \
LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to
LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000
MVN SRAMBank, SRAMBank ; /
PLB
.goodchecksum
LDX.w #$00FE : - ; includes prize pack reset after save and quit
STZ.w $0D00, X
STZ.w $0E00, X
STZ.w $0F00, X
DEX #2
BPL -
SEP #$30
RTL
;--------------------------------------------------------------------------------
ClearExtendedSaveFile:
STA $700400, X ; what we wrote over
STA $700500, X
STA $700600, X
STA $700700, X
STA $700800, X
STA $700900, X
STA $700A00, X
STA $700B00, X
STA $700C00, X
STA $700D00, X
STA $700E00, X
STA $700F00, X
STA.l $700400, X ; what we wrote over
STA.l $700500, X
STA.l $700600, X
STA.l $700700, X
STA.l $700800, X
STA.l $700900, X
STA.l $700A00, X
STA.l $700B00, X
STA.l $700C00, X
STA.l $700D00, X
STA.l $700E00, X
STA.l $700F00, X
STA.l $701000, X
STA.l $701100, X
STA.l $701200, X
STA.l $701300, X
STA.l $701400, X
; Clear backup save
STA.l $704000, X
STA.l $704100, X
STA.l $704200, X
STA.l $704300, X
STA.l $704400, X
STA.l $704500, X
STA.l $704600, X
STA.l $704700, X
STA.l $704800, X
STA.l $704900, X
STA.l $704A00, X
STA.l $704B00, X
STA.l $704C00, X
STA.l $704D00, X
STA.l $704E00, X
STA.l $704F00, X
STA.l $705000, X
STA.l $705100, X
STA.l $705200, X
STA.l $705300, X
STA.l $705400, X
RTL
;--------------------------------------------------------------------------------
ClearExtendedWRAMSaveFile:
STA $7EF400, X ; what we wrote over
STA $7F6000, X
STA $7F6100, X
STA $7F6200, X
STA $7F6300, X
STA $7F6400, X
STA $7F6500, X
STA $7F6600, X
STA $7F6700, X
STA $7F6800, X
STA $7F6900, X
STA $7F6A00, X
STA $7F6B00, X
STA $7F6C00, X
STA $7F6D00, X
STA $7F6E00, X
STA $7F6F00, X
STA.l $7EF400, X ; what we wrote over
STA.l $7F6000, X
STA.l $7F6100, X
STA.l $7F6200, X
STA.l $7F6300, X
STA.l $7F6400, X
STA.l $7F6500, X
STA.l $7F6600, X
STA.l $7F6700, X
STA.l $7F6800, X
STA.l $7F6900, X
STA.l $7F6A00, X
STA.l $7F6B00, X
STA.l $7F6C00, X
STA.l $7F6D00, X
STA.l $7F6E00, X
STA.l $7F6F00, X
RTL
;--------------------------------------------------------------------------------
CopyExtendedSaveFileToWRAM:
PHA
SEP #$30
LDA $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA #$00 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
PHA
SEP #$30
LDA.w $4300 : PHA ; preserve DMA parameters
LDA.w $4301 : PHA ; preserve DMA parameters
LDA.w $4302 : PHA ; preserve DMA parameters
LDA.w $4303 : PHA ; preserve DMA parameters
LDA.w $4304 : PHA ; preserve DMA parameters
LDA.w $4305 : PHA ; preserve DMA parameters
LDA.w $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$00 : STA.w $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
LDA #$80 : STA $4301 ; set bus B source to WRAM register
LDA.b #$80 : STA.w $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$60 : STA $2182
LDA #$7F : STA $2183
LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA.b #$60 : STA.w $2182
LDA.b #$7F : STA.w $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
STZ.w $4302 ; set bus A destination address to SRAM
LDA.b #$05 : STA.w $4303
LDA.b #$70 : STA.w $4304
LDA #$00 : STA $4305 ; set transfer size to 0x1000
LDA #$10 : STA $4306 ; STZ $4307
LDA.b #$00 : STA.w $4305 ; set transfer size to 0x1000
LDA.b #$10 : STA.w $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
REP #$30
PLA
STA $7EC00D ; what we wrote over
LDA.b #$01 : STA.w $420B ; begin DMA transfer
LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
;--------------------------------------------------------------------------------
PLA : STA.w $4306 ; restore DMA parameters
PLA : STA.w $4305 ; restore DMA parameters
PLA : STA.w $4304 ; restore DMA parameters
PLA : STA.w $4303 ; restore DMA parameters
PLA : STA.w $4302 ; restore DMA parameters
PLA : STA.w $4301 ; restore DMA parameters
PLA : STA.w $4300 ; restore DMA parameters
REP #$30
PLA
STA $7EC00D ; what we wrote over
RTL
;--------------------------------------------------------------------------------
CopyExtendedWRAMSaveFileToSRAM:
PHA
PHB
SEP #$30
LDA #$00 : PHA : PLB
LDA $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA #$80 : STA $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
PHA
PHB
SEP #$30
LDA #$00 : PHA : PLB
LDA.w $4300 : PHA ; preserve DMA parameters
LDA.w $4301 : PHA ; preserve DMA parameters
LDA.w $4302 : PHA ; preserve DMA parameters
LDA.w $4303 : PHA ; preserve DMA parameters
LDA.w $4304 : PHA ; preserve DMA parameters
LDA.w $4305 : PHA ; preserve DMA parameters
LDA.w $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$80 : STA.w $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
STA $4301 ; set bus B source to WRAM register
STA.w $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$60 : STA $2182
LDA #$7F : STA $2183
LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA.b #$60 : STA.w $2182
LDA.b #$7F : STA.w $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
STZ.w $4302 ; set bus A destination address to SRAM
LDA.b #$05 : STA.w $4303
LDA.b #$70 : STA.w $4304
LDA #$10 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307
LDA.b #$10 : STA.w $4305 ; set transfer size to 0xB00
LDA.b #$0B : STA.w $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
REP #$30
PLB
PLA
LDX.w #$0000 : TXA ; what we wrote over
LDA.b #$01 : STA.w $420B ; begin DMA transfer
LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
;--------------------------------------------------------------------------------
PLA : STA.w $4306 ; restore DMA parameters
PLA : STA.w $4305 ; restore DMA parameters
PLA : STA.w $4304 ; restore DMA parameters
PLA : STA.w $4303 ; restore DMA parameters
PLA : STA.w $4302 ; restore DMA parameters
PLA : STA.w $4301 ; restore DMA parameters
PLA : STA.w $4300 ; restore DMA parameters
REP #$30
PLB
PLA
RTL

View File

@@ -4,6 +4,7 @@
;--------------------------------------------------------------------------------
!BIGRAM = "$7EC900";
;--------------------------------------------------------------------------------
!SPRITE_OAM = "$7EC025"
; A = Tile ID
macro UploadOAM(dest)
PHA : PHP
@@ -56,7 +57,6 @@ macro DrawDigit(value,offset)
+
LDA $0E : STA !BIGRAM, X : INX : INX
LDA.w #56 : STA !BIGRAM, X : INX : INX
LDA $A0 : CMP.l #$109 : BNE + : LDA.w #$FFCA : STA !BIGRAM-2, X : +
LDY $0A : TYA : ASL : TAY : LDA.w .digit_properties, Y : STA !BIGRAM, X : INX : INX
LDA.w #$0000 : STA !BIGRAM, X : INX : INX
@@ -66,7 +66,6 @@ endmacro
!COLUMN_LOW = "$7F5022"
!COLUMN_HIGH = "$7F5023"
DrawPrice:
STX $07
PHX : PHY : PHP
LDY.b #$FF
LDX #$00 ; clear bigram pointer
@@ -87,7 +86,7 @@ DrawPrice:
.len1
%DrawDigit(#1,#0)
SEP #$20 ; set 8-bit accumulator
TXA : LSR #3 : STA $06 ; request 1-4 OAM slots
ASL #2
@@ -105,19 +104,15 @@ RTS
;--------------------------------------------------------------------------------
!TILE_UPLOAD_OFFSET_OVERRIDE = "$7F5042"
!FREE_TILE_BUFFER = "#$1180"
!SHOP_ENABLE_COUNT = "$7F504F"
!SHOP_ID = "$7F5050"
!SHOP_TYPE = "$7F5051"
!SHOP_INVENTORY = "$7F5052" ; $7F5056 - 5a - 5e
!SHOP_INVENTORY_PLAYER = "$7F5062"
!SHOP_INVENTORY_DISGUISE = "$7F5065" ; was going to remove this, but this lets more than one bee trap exist with its own icon.
!SHOP_STATE = "$7F5069"
!SHOP_CAPACITY = "$7F506A"
!SCRATCH_TEMP_X = "$7F506B"
!SHOP_SRAM_INDEX = "$7F506C"
!SHOP_MERCHANT = "$7F506D"
!SHOP_DMA_TIMER = "$7F506E"
!SHOP_KEEP_REFILL = "$7F506F"
!SHOP_INVENTORY = "$7F5052" ; $7F505E
!SHOP_STATE = "$7F505F"
!SHOP_CAPACITY = "$7F5060"
!SCRATCH_TEMP_X = "$7F5061"
!SHOP_SRAM_INDEX = "$7F5062"
!SHOP_MERCHANT = "$7F5063"
!SHOP_DMA_TIMER = "$7F5064"
;--------------------------------------------------------------------------------
!NMI_AUX = "$7F5044"
;--------------------------------------------------------------------------------
@@ -127,23 +122,11 @@ dw $0230, $0231, $0202, $0203, $0212, $0213, $0222, $0223, $0232, $0233
.digit_offsets
dw 4, 0, -4, -8
;--------------------------------------------------------------------------------
SpritePrep_ShopKeeper_PotionShop:
JSL SpritePrep_ShopKeeper
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE +
JSL SpritePrep_PotionShopLong
RTL
+ LDX #$0
PHK : PEA.w .jslrtsreturn-1
PEA.w $05f527 ; an rtl address - 1 in Bank05
JML SpawnMagicPowder
.jslrtsreturn
RTL
SpritePrep_ShopKeeper:
PHX : PHY : PHP
REP #$30 ; set 16-bit accumulator & index registers
;LDA $A0
LDX.w #$0000
-
LDA ShopTable+1, X : CMP $A0 : BNE +
@@ -181,37 +164,25 @@ SpritePrep_ShopKeeper:
LDA.l ShopContentsTable+1, X : PHX : TYX : STA.l !SHOP_INVENTORY, X : PLX
LDA.l ShopContentsTable+2, X : PHX : TYX : STA.l !SHOP_INVENTORY+1, X : PLX
LDA.l ShopContentsTable+3, X : PHX : TYX : STA.l !SHOP_INVENTORY+2, X : PLX
LDA.l ShopContentsTable+8, X : PHX : PHA : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA #0 : XBA : TYA : LSR #2 : TAX ; This will convert the value back to the slot number (in 8-bit accumulator mode)
PLA : STA.l !SHOP_INVENTORY_PLAYER, X : LDA #0 : STA.l !SHOP_INVENTORY_DISGUISE, X : PLX
PHY
PHX
LDA.b #$00 : XBA : TYA : LSR #2 : !ADD !SHOP_SRAM_INDEX : TAX
LDA PurchaseCounts, X : TYX : STA.l !SHOP_INVENTORY+3, X : TAY
PLX
LDA.l ShopContentsTable+4, X : BEQ +
LDA.l ShopContentsTable+4, X : BEQ ++
TYA : CMP.l ShopContentsTable+4, X : !BLT ++
PLY
LDA.l ShopContentsTable+5, X : PHX : TYX : STA.l !SHOP_INVENTORY, X : PLX
LDA.l ShopContentsTable+6, X : PHX : TYX : STA.l !SHOP_INVENTORY+1, X : PLX
LDA.l ShopContentsTable+7, X : PHX : TYX : STA.l !SHOP_INVENTORY+2, X : PLX
LDA #$40 : PHX : TYX : STA.l !SHOP_INVENTORY+3, X : PLX
PHX : LDA #0 : XBA : TYA : LSR #2 : TAX ; This will convert the value back to the slot number (in 8-bit accumulator mode)
LDA #0 : STA.l !SHOP_INVENTORY_PLAYER, X : PLX
BRA +++
+ : PLY : LDA #$40 : PHX : TYX : STA.l !SHOP_INVENTORY+3, X : PLX : BRA +++
++
PLY : +++
PHX : PHY
PHX : TYX : LDA.l !SHOP_INVENTORY, X : PLX
CMP #$B0 : BNE +
PHX : LDA #0 : XBA : TYA : LSR #2 : TAX ; This will convert the value back to the slot number (in 8-bit accumulator mode)
JSL GetRandomInt : AND #$3F
BNE ++ : LDA #$49 : ++ : CMP #$26 : BNE ++ : LDA #$6A : ++ ; if 0 (fighter's sword + shield), set to just sword, if filled container (bugged palette), switch to triforce piece
STA.l !SHOP_INVENTORY_DISGUISE, X : PLX
+ : TAY
PHX : TYX : LDA.l !SHOP_INVENTORY, X : PLX : TAY
REP #$20 ; set 16-bit accumulator
LDA 1,s : TAX : LDA.l .tile_offsets, X : TAX
JSR LoadTile
@@ -219,24 +190,24 @@ SpritePrep_ShopKeeper:
INY #4
.next
INX #9
INX #8
JMP -
.stop
LDA $A0 : CMP.b #$FF : BNE .normal
.dumb
LDA $2137
LDA $213F
LDA $213D
CMP.b #60
!BLT .dumb
.normal
LDA #$80 : STA $2100
JSR Shopkeeper_UploadVRAMTiles
LDA #$0F : STA $2100
; LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA !NMI_AUX+2
; LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA !NMI_AUX+1
; LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA !NMI_AUX
;LDA $A0 : CMP.b #$FF : BNE .normal
;.dumb
; LDA $2137
; LDA $213F
; LDA $213D
; CMP.b #60
; !BLT .dumb
;.normal
;LDA #$80 : STA $2100
;JSR Shopkeeper_UploadVRAMTiles
;LDA #$0F : STA $2100
LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA !NMI_AUX+2
LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA !NMI_AUX+1
LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA !NMI_AUX
.done
LDA.l !SHOP_TYPE : BIT.b #$20 : BEQ .notTakeAll ; Take-all
@@ -264,9 +235,7 @@ SpritePrep_ShopKeeper:
PLP : PLY : PLX
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE +
LDA $A0 : CMP.b #$09 : BNE ++
RTL
++ PLA : PLA : PLA
PLA : PLA : PLA
INC $0BA0, X
LDA $0E40, X
JML.l ShopkeeperFinishInit
@@ -393,16 +362,6 @@ Shopkeeper_UploadVRAMTiles:
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
RTS
;--------------------------------------------------------------------------------
ShopkepeerPotion_CallOriginal:
PLA : PLA : PLA
LDA.b #PotionShopkeeperJumpTable>>16 : PHA
LDA.b #PotionShopkeeperJumpTable>>8 : PHA
LDA.b #PotionShopkeeperJumpTable : PHA
LDA $0E80, X
JML.l UseImplicitRegIndexedLocalJumpTable
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
Shopkepeer_CallOriginal:
PLA : PLA : PLA
@@ -415,31 +374,6 @@ Shopkepeer_CallOriginal:
;!SHOP_TYPE = "$7F5051"
;!SHOP_CAPACITY = "$7F5020"
;!SCRATCH_TEMP_X = "$7F5021"
Sprite_ShopKeeperPotion:
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + : JMP.w ShopkepeerPotion_CallOriginal : +
TXA : BEQ +
PHK : PEA.w .jslrtsreturn2-1
PEA.w $05f527 ; an rtl address - 1 in Bank05
JML Sprite_MagicPowderItem
.jslrtsreturn2
RTL
+
PHB : PHK : PLB ;; we can just call the default shopkeeper but the potion shopkeeper refills your health
LDA $A0 : CMP.b #$09 : BNE +
JSR.w Shopkeeper_DrawItems
JSR.w Shopkeeper_SetupHitboxes
+
PLB
LDA $0E80, X : BNE +
PHK : PEA.w .jslrtsreturn-1
PEA.w $05f527 ; an rtl address - 1 in Bank05
JML Sprite_WitchAssistant
.jslrtsreturn
+
RTL
Sprite_ShopKeeper:
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + : JMP.w Shopkepeer_CallOriginal : +
@@ -576,7 +510,6 @@ Shopkeeper_SetupHitboxes:
JSR.w Setup_ShopItemInteractionHitbox
JSL.l Utility_CheckIfHitBoxesOverlapLong : BCC .no_interaction
LDA $02DA : BNE .no_interaction ; defer if link is buying a potion (this is faster than the potion buying speed before potion shop shuffle)
LDA $F6 : AND.b #$80 : BEQ .no_interaction ; check for A-press
LDA $10 : CMP.b #$0C : !BGE .no_interaction ; don't interact in other modes besides game action
JSR.w Shopkeeper_BuyItem
@@ -587,13 +520,12 @@ Shopkeeper_SetupHitboxes:
PLP : PLY : PLX
RTS
;--------------------
;!SHOP_STATE
Shopkeeper_BuyItem:
PHX : PHY
TYX
LDA.l !SHOP_INVENTORY, X
CMP.b #$0E : BEQ .refill ; Bee Refill
CMP.b #$2E : BEQ .refill ; Red Potion Refill
@@ -602,7 +534,6 @@ Shopkeeper_BuyItem:
BRA +
.refill
JSL.l Sprite_GetEmptyBottleIndex : BMI .full_bottles
LDA #$1 : STA !SHOP_KEEP_REFILL ; If this is on, don't toggle bit to remove from shop
+
LDA !SHOP_TYPE : AND.b #$80 : BNE .buy ; don't charge if this is a take-any
@@ -624,22 +555,12 @@ Shopkeeper_BuyItem:
LDA !SHOP_TYPE : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
REP #$20 : LDA CurrentRupees : !SUB !SHOP_INVENTORY+1, X : STA CurrentRupees : SEP #$20 ; Take price away
++
PHX
LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_PLAYER, X : STA !MULTIWORLD_ITEM_PLAYER_ID
TXA : !ADD !SHOP_SRAM_INDEX : TAX
LDA.l PurchaseCounts, X : BNE +++ ;Is this the first time buying this slot?
LDA.l EnableShopItemCount, X : STA.l !SHOP_ENABLE_COUNT ; If so, store the permission to count the item here.
+++
PLX
LDA.l !SHOP_INVENTORY, X : TAY : JSL.l Link_ReceiveItem
LDA.l !SHOP_INVENTORY+3, X : INC : STA.l !SHOP_INVENTORY+3, X
LDA.b #0 : STA.l !SHOP_ENABLE_COUNT
TXA : LSR #2 : TAX
LDA !SHOP_TYPE : BIT.b #$80 : BNE +
LDA !SHOP_KEEP_REFILL : BNE +++
LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE
+++
LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE
PHX
TXA : !ADD !SHOP_SRAM_INDEX : TAX
LDA PurchaseCounts, X : INC : BEQ +++ : STA PurchaseCounts, X : +++
@@ -650,24 +571,17 @@ Shopkeeper_BuyItem:
BIT.b #$20 : BNE .takeAll
.takeAny
LDA.l !SHOP_STATE : ORA.b #$07 : STA.l !SHOP_STATE
PHX
LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l PurchaseCounts, X
LDA.l EnableShopItemCount, X : STA.l !SHOP_ENABLE_COUNT
PLX
PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l PurchaseCounts, X : PLX
BRA ++
.takeAll
LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE
PHX
LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l PurchaseCounts, X
LDA.l EnableShopItemCount, X : STA.l !SHOP_ENABLE_COUNT
PLX
PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l PurchaseCounts, X : PLX
++
.done
LDA #$0 : STA !SHOP_KEEP_REFILL
PLY : PLX
RTS
Shopkeeper_ItemMasks:
db #$01, #$02, #$04, #$08
db #$01, #$02, #$04
;--------------------
;!SHOP_ID = "$7F5050"
;!SHOP_SRAM_INDEX = "$7F5062"
@@ -686,7 +600,6 @@ Setup_ShopItemCollisionHitbox:
REP #$20 ; set 16-bit accumulator
PHA : PHY
LDA !SHOP_TYPE : AND.w #$0003 : DEC : ASL : TAY
LDA $A0 : CMP.l #$109 : BNE + : INY #6 : +
LDA.w Shopkeeper_DrawNextItem_item_offsets_idx, Y : STA $00 ; get table from the table table
PLY : PLA
@@ -769,6 +682,7 @@ RTS
;--------------------------------------------------------------------------------
;!SHOP_TYPE = "$7F5051"
;!SHOP_INVENTORY = "$7F5052"
!SPRITE_OAM = "$7EC025"
Shopkeeper_DrawItems:
PHB : PHK : PLB
PHX : PHY
@@ -796,7 +710,6 @@ Shopkeeper_DrawNextItem:
LDA !SHOP_TYPE : AND.b #$03 : DEC : ASL : TAY
REP #$20 ; set 16-bit accumulator
LDA $A0 : CMP.l #$109 : BNE + : INY #6 : +
LDA.w .item_offsets_idx, Y : STA $00 ; get table from the table table
LDA 1,s : ASL #2 : TAY ; set Y to the item index
LDA ($00), Y : STA.l !SPRITE_OAM ; load X-coordinate
@@ -809,59 +722,12 @@ Shopkeeper_DrawNextItem:
SEP #$20 ; set 8-bit accumulator
PLY
STZ $0E ; $0E will be used temporarily to store a non-zero value if VRAM slot is in OAM1
PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++
LDA.l !SHOP_INVENTORY, X
++
CMP.b #$2E : BNE + : JMP .potion
+ CMP.b #$2F : BNE + : JMP .potion
+ CMP.b #$30 : BNE + : JMP .potion
+ CMP.b #$B1 : BNE + : BRA .apple
+ CMP.b #$B2 : BNE + : BRA .fairy
+ CMP.b #$B5 : BNE + : BRA .goodbee
+ CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS +
BRA .rupee
+
LDA.l !SHOP_INVENTORY, X ; get item id
CMP.b #$2E : BNE + : BRA .potion
+ CMP.b #$2F : BNE + : BRA .potion
+ CMP.b #$30 : BEQ .potion
.normal
LDA.w .tile_indices, Y : BRA + ; get item gfx index
.rupee
LDA.b #$0B ; rupee is #$0B because it's already there in VRAM
STA.b $0E
BRA .vramLoc
.fairy
REP #$20
LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ ++ ; alternate every 32 frames
LDA.l !SPRITE_OAM+2 : SEC : SBC.w #$02 ; move fairy up 2 pixels
STA.l !SPRITE_OAM+2
++
SEP #$20
LDA.b $1A : AND.b #$20 : BEQ ++ ; alternate every 32 frames
LDA.b #$EC ; use other fairy GFX
STA.b $0E
BRA .vramLoc
++
LDA.b #$EA ; fairy is #$EA/EC because it's already there in VRAM
STA.b $0E
BRA .vramLoc
.goodbee
REP #$20
LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ ++ ; alternate every 32 frames
LDA.l !SPRITE_OAM+2 : SEC : SBC.w #$02 ; move bee up 2 pixels
STA.l !SPRITE_OAM+2
++
SEP #$20
LDA.b $1A : AND.b #$20 : BEQ ++ ; alternate every 32 frames
LDA.b #$D4 ; use other bee GFX
STA.b $0E
BRA .vramLoc
++
LDA.b #$E4 ; good bee is #$E4/D4 because it's already there in VRAM
STA.b $0E
BRA .vramLoc
.apple
LDA.b #$E5 ; apple is #$E5 because it's already there in VRAM
STA.b $0E
BRA .vramLoc
.potion
LDA.b #$C0 ; potion is #$C0 because it's already there in VRAM
+
@@ -872,28 +738,14 @@ Shopkeeper_DrawNextItem:
+
XBA
AND #$FE
.vramLoc
STA.l !SPRITE_OAM+4
PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++
LDA.l !SHOP_INVENTORY, X ; get item palette
++
LDA.l !SHOP_INVENTORY, X ; get item palette
JSL.l GetSpritePalette : STA.l !SPRITE_OAM+5
LDA.b $0E : BNE .oam1 ; item uses VRAM in OAM1
LDA.w .tile_indices, Y : AND.b #$01 : BEQ ++ ; get tile index sheet
.oam1
LDA.l !SPRITE_OAM+5
ORA.b #$1
STA.l !SPRITE_OAM+5
++
LDA.b #$00 : STA.l !SPRITE_OAM+6
PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++
LDA.l !SHOP_INVENTORY, X ; get item id for narrowness
++
LDA.l !SHOP_INVENTORY, X ; get item palette
JSL.l IsNarrowSprite : BCS .narrow
.full
LDA.b #$02
@@ -904,16 +756,11 @@ Shopkeeper_DrawNextItem:
LDA.b #$00
STA.l !SPRITE_OAM+7
JSR.w PrepNarrowLower
LDA.b $0E : AND.b #$0F : CMP.b #$04 : BNE +
; special exception for bee gfx, need top tile to be blank
LDA.b #$7C : STA.l !SPRITE_OAM+4
+
LDA.b #$02
++
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSR.w RequestItemOAM : PLX
LDA !SHOP_TYPE : AND.b #$80 : BNE +
CPX.b #12 : BEQ + ; don't render potion price
JSR.w Shopkeeper_DrawNextPrice
+
@@ -922,14 +769,10 @@ Shopkeeper_DrawNextItem:
INX #4
RTS
;--------------------------------------------------------------------------------
.item_offsets_idx ; 112 60
.item_offsets_idx
dw #.item_offsets_1
dw #.item_offsets_2
dw #.item_offsets_3
.item_offsets_idx_Potion ; 160 176 - (112 64) = (48 112)
dw #.item_offsets_1p
dw #.item_offsets_2p
dw #.item_offsets_3p
.item_offsets_1
dw 8, 40
.item_offsets_2
@@ -939,19 +782,8 @@ dw 32, 40
dw -40, 40
dw 8, 40
dw 56, 40
.item_offsets_1p
dw -40, -72
.item_offsets_2p
dw -64, -72
dw -16, -72
.item_offsets_3p
dw -88, -72
dw -40, -72
dw 8, -72
.potion_offset
dw -16, 0
.tile_indices
db $C6, $C8, $CA, $25 ; last bit is for sheet change
db $C6, $C8, $CA
;--------------------------------------------------------------------------------
!COLUMN_LOW = "$7F5022"
!COLUMN_HIGH = "$7F5023"
@@ -962,7 +794,6 @@ Shopkeeper_DrawNextPrice:
REP #$20 ; set 16-bit accumulator
PHY
LDA !SHOP_TYPE : AND.w #$0003 : DEC : ASL : TAY
LDA $A0 : CMP.l #$109 : BNE + : INY #6 : +
LDA.w Shopkeeper_DrawNextItem_item_offsets_idx, Y : STA $00 ; get table from the table table
LDA.w .price_columns_idx, Y : STA $02 ; get table from the table table
PLY : PHY
@@ -973,7 +804,7 @@ Shopkeeper_DrawNextPrice:
INY : LDA ($02), Y : STA !COLUMN_HIGH
PLY
LDA.l !SHOP_INVENTORY+1, X : STA $0C ; set value
BEQ .free
JSR.w DrawPrice
SEP #$20 : STA $06 : STZ $07 ; set 8-bit accumulator & store result
@@ -983,7 +814,7 @@ Shopkeeper_DrawNextPrice:
LDA.b #$7E : PHA : PLB ; set data bank to $7E
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSL.l Sprite_DrawMultiple_quantity_preset : PLX
LDA 1,s
ASL #2 : !ADD $90 : STA $90 ; increment oam pointer
PLA
@@ -1001,7 +832,7 @@ db #$00, #$FF
.price_columns_2
db #$00, #$80, #$80, $FF
.price_columns_3
db #$00, #$60, #$60, #$90, #$90, $FF, $FF, $FF
db #$00, #$60, #$60, #$90, #$90, $FF
;--------------------------------------------------------------------------------
RequestItemOAM:
PHX : PHY : PHA

View File

@@ -1,600 +0,0 @@
;--------------------------------------------------------------------------------
!ANCILLA_DAMAGE = "$06EC84"
; start with X = sprite index, A = ancilla type index
;--------------------------------------------------------------------------------
DamageClassCalc:
PHA
LDA GanonVulnerabilityItem : BEQ +
LDA $0E20, X : CMP #$D7 : BNE +
PLA
JSL Ganon_CheckAncillaVulnerability
RTL
+
LDA SpecialWeapons : AND.b #$7F : CMP #$06 : BEQ .cane_immune ; only crystal switches in bee mode
PLA
CMP #$01 : BEQ .red_cane
CMP #$2C : BEQ .red_cane
CMP #$31 : BEQ .blue_cane
CMP #$0C : BEQ .beam
BRA .not_cane_or_beam
.red_cane
PHA
LDA SpecialWeapons : AND.b #$7F : CMP.b #$04 : BEQ .special_cane
CMP.b #$05 : BEQ .special_cane
LDA SpecialWeapons : AND.b #$80 : BNE .cane_immune
BRA .normal
.blue_cane
PHA
LDA SpecialWeapons : AND.b #$7F : CMP.b #$03 : BEQ .special_cane
CMP.b #$05 : BEQ .special_cane
LDA SpecialWeapons : AND.b #$80 : BNE .cane_immune
BRA .normal
.cane_immune
LDA $0E20, X : CMP.b #$1E : BEQ .normal ; crystal switch
PLA
BRA .impervious
.special_cane
PLA
LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon
CMP.b #$88 : BEQ .mothula
BRA .special_level
.impervious
LDA #$FF
RTL
.beam
PHA
LDA SpecialWeapons : AND.b #$7F : CMP.b #$02 : BNE .normal
PLA
LDA #$05
RTL
.normal
PLA
.not_cane_or_beam
CMP #$07 : BNE .no_change
LDA SpecialWeapons : AND.b #$7F : CMP #$01 : BNE .normal_bombs
LDA SpecialWeaponLevel : BEQ .normal_bombs
LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon
CMP.b #$D7 : BEQ .stunned_ganon
CMP.b #$88 : BEQ .mothula
CMP.b #$91 : BEQ .stalfos_knight
CMP.b #$92 : BEQ .helmasaur_king
.special_level
LDA SpecialWeaponLevel
BRA .done
.mothula
LDA SpecialWeaponLevel
CMP #$04 : !BGE .fix_mothula
BRA .done
.fix_mothula
LDA #$03
BRA .done
.stalfos_knight
LDA !StalfosBombDamage : BEQ .special_level
LDA #$08
BRA .done
.helmasaur_king
LDA $0DB0, X : CMP #$03 : !BGE .special_level
LDA #$08
BRA .done
.unstunned_ganon
LDA $04C5 : CMP.b #$02 : BNE .impervious
LDA $0EE0, X : BNE .impervious
LDA #$34 : STA $0EE0, X ; give the poor pig some iframes
BRA .special_level
.stunned_ganon
LDA $0EE0, X : BNE .impervious
LDA #$34 : STA $0EE0, X ; give the poor pig some iframes
LDA #$20 : STA $0F10, X ; knock ganon back or something? idk
LDA #$09
BRA .done
.normal_bombs
LDA #$07
.no_change
PHX : TAX
LDA.l !ANCILLA_DAMAGE, X
PLX
CMP.b #$06 : BNE .done ; not arrows
LDA BowEquipment : CMP.b #$03 : !BGE .actual_silver_arrows
.normal_arrows
LDA #$06
.done
RTL
.actual_silver_arrows
LDA $0E20, X : CMP.b #$D7 : BNE +
LDA SpecialWeapons : AND.b #$7F : CMP #$01 : BEQ .normal_arrows
LDA #$20 : STA $0F10, X
+
LDA #$09
RTL
; end with X = sprite index, A = damage class
;--------------------------------------------------------------------------------
!SPRITE_SETUP_HIT_BOX_LONG = "$0683EA"
!UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG = "$0683E6"
; start with X = ancilla index, Y = sprite index
;--------------------------------------------------------------------------------
Utility_CheckAncillaOverlapWithSprite:
LDA $0E20, Y : CMP #$09 : BEQ .giant_moldorm
CMP #$CB : BEQ .trinexx
.not_giant_moldorm ; ordinary collision checking
PHY : PHX
TYX
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX : PLY
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
.giant_moldorm
LDA.w $0E10, Y : BNE .ignore_collision ; Moldy can have little a I-Frames, as a treat
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BNE ++
LDA.w $0C4A, X : CMP.b #$07 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-bombs
++ : CMP.b #$03 : BNE ++
LDA.w $0C4A, X : CMP.b #$31 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-byrna
++ : CMP.b #$04 : BNE ++
LDA.w $0C4A, X : CMP.b #$01 : BEQ .check_collision_moldorm
CMP.b #$2C : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-somaria
++ : CMP.b #$05 : BNE .ignore_collision
LDA.w $0C4A, X : CMP.b #$01 : BEQ .check_collision_moldorm
CMP.b #$2C : BEQ .check_collision_moldorm
CMP.b #$31 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-canes
.check_collision_moldorm
JSR SetUpMoldormHitbox
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
.ignore_collision
CLC
RTL
.trinexx
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BNE ++
LDA.w $0C4A, X : CMP.b #$07 : BEQ .check_collision_trinexx
BRA .ignore_collision ; don't collide with non-bombs
++ : CMP.b #$03 : BNE ++
LDA.w $0C4A, X : CMP.b #$31 : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-byrna
++ : CMP.b #$04 : BNE ++
LDA.w $0C4A, X : CMP.b #$01 : BEQ .check_collision_trinexx
CMP.b #$2C : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-somaria
++ : CMP #$05 : BNE .ignore_collision
LDA.w $0C4A, X : CMP.b #$01 : BEQ .check_collision_trinexx
CMP.b #$2C : BEQ .check_collision_trinexx
CMP.b #$31 : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-canes
.check_collision_trinexx
JSR SetUpTrinexxHitbox
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
; returns carry clear if there was no overlap
;--------------------------------------------------------------------------------
SetUpTrinexxHitbox:
; rearrange trinexx's hitbox to be her middle instead of her head
LDA $0CAA, Y : PHA
LDA $0E60, Y : PHA
LDA $0D10, Y : PHA
LDA $0D30, Y : PHA
LDA $0D00, Y : PHA
LDA $0D20, Y : PHA
LDA #$80 : STA $0CAA, Y
PHX
LDA $0E80, Y : !SUB.l $1DAF28 : AND.b #$7F : TAX
LDA $7FFC00, X : STA $0D10, Y
LDA $7FFC80, X : STA $0D30, Y
LDA $7FFD00, X : STA $0D00, Y
LDA $7FFD80, X : STA $0D20, Y
TYX
STZ $0E60, X
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX
PLA : STA $0D20, Y
PLA : STA $0D00, Y
PLA : STA $0D30, Y
PLA : STA $0D10, Y
PLA : STA $0E60, Y
PLA : STA $0CAA, Y
RTS
;--------------------------------------------------------------------------------
SetUpMoldormHitbox:
; rearrange moldorm's hitbox to be his tail instead of his head
LDA $0D90, Y : PHA
LDA $0F60, Y : PHA
LDA $0D10, Y : PHA
LDA $0D30, Y : PHA
LDA $0D00, Y : PHA
LDA $0D20, Y : PHA
PHY : PHX
LDA $0E80, Y : !SUB.b #$30 : AND.b #$7F : TAX
LDA $7FFC00, X : STA $0D10, Y
LDA $7FFC80, X : STA $0D30, Y
LDA $7FFD00, X : STA $0D00, Y
LDA $7FFD80, X : STA $0D20, Y
LDA #$01 : STA $09D0, Y
TYX
STZ $0F60, X
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX : PLY
PLA : STA $0D20, Y
PLA : STA $0D00, Y
PLA : STA $0D30, Y
PLA : STA $0D10, Y
PLA : STA $0F60, Y
PLA : STA $0D90, Y
RTS
;--------------------------------------------------------------------------------
; start with X = ancilla index, Y = sprite index
Utility_CheckHelmasaurKingCollision:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BNE ++
LDA.w $0C4A, X : CMP.b #$07 : BEQ .collide
BRA .normal ; normal behavior with non-bombs
++ : CMP.b #$03 : BNE ++
LDA.w $0C4A, X : CMP.b #$31 : BEQ .collide
BRA .normal ; normal behavior with non-byrna
++ : CMP.b #$04 : BNE ++
LDA.w $0C4A, X : CMP.b #$01 : BEQ .collide
CMP.b #$2C : BEQ .collide
BRA .normal ; normal behavior with non-somaria
++ : CMP.b #$05 : BNE .normal
LDA.w $0C4A, X : CMP.b #$01 : BEQ .collide
CMP.b #$2C : BEQ .collide
CMP.b #$31 : BEQ .collide
BRA .normal ; normal behavior with non-canes
.collide
CLC
RTL
.normal
LDA.w $0DB0, Y : CMP.b #$03
RTL
; returns carry set if there is collision immunity
;--------------------------------------------------------------------------------
Utility_CheckImpervious:
LDA $0E20, X : CMP.b #$CB : BNE .normal
.trinexx
LDA SpecialWeapons : AND.b #$7F : CMP.b #$06 : BEQ .check_sidenexx
LDA SpecialWeapons : AND.b #$80 : BNE +
BRA .normal
+
LDA $0301 : AND.b #$0A : BNE .impervious ; impervious to hammer
.check_sidenexx
LDA.w $0DD1 : ORA.w $0DD2 : BNE .impervious ; at least one sidenexx alive
LDA.w $0D80, X : CMP.b #$02 : BCS .impervious ; at least one sidenexx alive
BRA .not_impervious
.normal
LDA $0E60, X : AND.b #$40 : BNE .impervious
LDA $0CF2 : CMP #$FF : BEQ .impervious ; special "always-impervious" class
LDA $0E20, X : CMP.b #$CC : BEQ .sidenexx : CMP.b #$CD : BEQ .sidenexx
LDA $0301 : AND.b #$0A : BEQ .not_impervious ; normal behavior if not hammer
JSL Ganon_CheckHammerVulnerability : BCS .not_impervious
LDA SpecialWeapons : AND.b #$80 : BEQ .not_impervious
LDA $0E20, X : CMP.b #$1E : BEQ .not_impervious ; crystal switch
CMP.b #$40 : BEQ .not_impervious ; aga barrier
BRA .impervious
.not_impervious
LDA #$00 : RTL
.impervious
LDA #$01 : RTL
.sidenexx
LDA $0CAA, X : AND.b #$04 : BEQ .vulnerable
LDA.l SpecialWeapons : AND.b #$80 : BEQ .not_impervious
LDA $0CF2 : CMP #$06 : !BLT .impervious ; swords are ineffective
BRA .not_impervious
.vulnerable
LDA.l SpecialWeapons : AND.b #$80 : BEQ .not_impervious
LDA $0CF2 : CMP #$06 : !BGE .impervious ; non-swords are ineffective
BRA .not_impervious
; returns nonzero A if impervious
;--------------------------------------------------------------------------------
!SPRITE_INITIALIZED_SEGMENTED = "$1DD6D1"
; start with X = sprite index
;--------------------------------------------------------------------------------
AllowBombingMoldorm:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BEQ .no_disable_projectiles
CMP.b #$03 : BEQ .no_disable_projectiles
CMP.b #$04 : BEQ .no_disable_projectiles
CMP.b #$05 : BEQ .no_disable_projectiles
CMP.b #$06 : BEQ .no_disable_projectiles
INC $0BA0, X
.no_disable_projectiles
JSL !SPRITE_INITIALIZED_SEGMENTED
RTL
;--------------------------------------------------------------------------------
AllowBombingBarrier:
; what we wrote over
LDA $0D00, X : !SUB.b #$0C : STA $0D00, X
LDA $0E20, X : CMP #$40 : BNE .disable_projectiles
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BEQ .no_disable_projectiles
CMP.b #$03 : BEQ .no_disable_projectiles
CMP.b #$04 : BEQ .no_disable_projectiles
CMP.b #$05 : BEQ .no_disable_projectiles
CMP.b #$06 : BEQ .no_disable_projectiles
.disable_projectiles
INC $0BA0, X
.no_disable_projectiles
RTL
;--------------------------------------------------------------------------------
DrawBombInMenu:
JSL LoadBombCount16 : AND.w #$00FF : BEQ .noBombs
LDA SpecialWeapons : AND.w #$007F : CMP.w #$0001 : BNE .vanillaBombs
LDA.l SpecialWeaponLevel : AND.w #$00FF : BEQ .noBombs : STA $02
LDA.w #$FC81 : STA $04
BRA .done
.vanillaBombs
LDA.w #$0001 : STA $02
LDA.w #$F699 : STA $04
BRA .done
.noBombs
LDA.w #$0000 : STA $02
LDA.w #$F699 : STA $04
.done
RTL
;--------------------------------------------------------------------------------
DrawSwordInMenu:
LDA SpecialWeapons : AND.w #$007F : CMP.w #$0001 : BEQ .specialSword
CMP.w #$0003 : BEQ .specialSword
CMP.w #$0004 : BEQ .specialSword
CMP.w #$0005 : BEQ .specialSword
CMP.w #$0008 : BEQ .specialSword
LDA SwordEquipment : AND.w #$00FF : CMP.w #$00FF : BEQ .noSword
.hasSword
STA $02
LDA.w #$F859 : STA $04
RTL
.noSword
LDA.w #$0000 : STA $02
LDA.w #$F859 : STA $04
RTL
.specialSword
LDA SpecialWeaponLevel : AND.w #$00FF : STA $02
LDA.w #$FC51 : STA $04
RTL
;--------------------------------------------------------------------------------
DrawBombInYBox:
CPX.w #$0004 : BNE .done
LDA SpecialWeapons : AND.w #$007F : CMP.w #$0001 : BNE .vanilla
LDA SpecialWeaponLevel : AND.w #$00FF : CLC : ADC.w #$00BD : BRA .done
.vanilla
LDA.w #$0001
.done
RTL
;--------------------------------------------------------------------------------
BombIcon:
dw $207F, $207F, $3C88, $3C89, $2C88, $2C89, $2488, $2489, $2888, $2889,$2888, $2889
DrawBombOnHud:
PHB
LDA.w #$0149
LDX.w #$86B0
LDY.w #$C700
MVN $7E, $21
PLB
LDA.l SpecialWeapons : AND.w #$007F : CMP.w #$0001 : BNE .regularBombs
LDA.l SpecialWeaponLevel : AND.w #$00FF : ASL #2 : TAX
LDA.l BombIcon, X : STA.l $7EC71A
LDA.l BombIcon+2, X : STA.l $7EC71C
.regularBombs
RTL
;--------------------------------------------------------------------------------
BombSpriteColor:
db $04, $08, $04, $02, $0A, $0A
SetBombSpriteColor:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BNE .normal
PHX
LDA.l SpecialWeaponLevel
TAX
LDA.l BombSpriteColor, X
STA $0B
PLX
RTL
.normal
LDA #$04 : STA $0B
RTL
;--------------------------------------------------------------------------------
StoreSwordDamage:
LDA.l SpecialWeapons : AND.b #$7F : CMP #$02 : BEQ +
LDA.l $06ED39, X : RTL
+
LDA #$05
RTL
;--------------------------------------------------------------------------------
BeeDamageClass:
db $FF
db $06, $00, $07, $08, $0A
db $0B, $0C, $0D, $0E, $0F
db $FF, $03, $FF, $FF, $FF
db $FF, $01, $01, $FF, $FF
;--------------------------------------------------------------------------------
CheckDetonateBomb:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BEQ .detonate_bombs
CMP.b #$06 : BEQ .release_bee
CLC : RTL
.detonate_bombs
LDX.b #09
.check_ancilla
LDA.w $0C4A, X
CMP.b #$07
BNE .next_ancilla
LDA.b #03
STA.w $039F, X
.next_ancilla
DEX
BPL .check_ancilla
JMP .done
.release_bee
LDX.w $0202
LDA.l BeeDamageClass, X : CMP.b #$FF : BEQ .nope
JSL $1EDCC9
BMI .nope
LDX.w $0202
LDA.l BeeDamageClass, X
CMP.b #$06 : BNE .set_bee_class
LDA.l $7EF340 : CMP.b #$03 : !BGE .silver_arrows
LDA.b #$06
BRA .set_bee_class
.silver_arrows
LDA.b #$09
.set_bee_class
STA.w $0ED0, Y
BRA .done
.nope
LDA.b #$3C
STA.w $0CF8
JSL $0DBB67
ORA.w $0CF8
STA.w $012E
.done
SEC
RTL
;--------------------------------------------------------------------------------
SetBeeType:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$06 : BEQ .bee_mode
LDX.w $0202
.check_bee_type
LDA.l $7EF33F, X
TAX
LDA.l $7EF35B, X
CMP.b #$08
BNE .regular_bee
LDA.b #$01
STA.w $0EB0, Y
.regular_bee
LDA.b #$01
STA.w $0ED0, Y
RTL
.bee_mode
LDX.w $0202
CPX.b #$10 : BEQ .check_bee_type
BRA .regular_bee
;--------------------------------------------------------------------------------
ArrghusBoing:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$06 : BNE .done
LDA.w $0F60, X : AND.b #$BF : STA.w $0F60, X
.done
; what we wrote over
LDA.b #$03
STA.w $0D80, X
RTL
;--------------------------------------------------------------------------------
BeeCheckTarget:
CPY.w $0FA0
BEQ .unsuitable_target
LDA.w $0DD0,Y
CMP.b #$09
BCC .unsuitable_target
LDA.w $0F00,Y
BNE .unsuitable_target
; in bee-mode skip targets that the bee can't hurt
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$06 : BNE +
JSR BeeCheckDamage
CMP.b #$00 : BEQ .unsuitable_target
+
LDA.w $0E40,Y
BMI .potential_target
LDA.w $0F20,Y
CMP.w $0F20,X
BNE .unsuitable_target
LDA.w $0F60,Y
AND.b #$40
BEQ +
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$06 : BNE .unsuitable_target
; in bee mode, allow targetting anti-fairies, bunny beams, and keese
LDA.w $0E20,Y
CMP.b #$15 : BEQ + ; anti-fairy
CMP.b #$6F : BEQ + ; keese
CMP.b #$D1 : BEQ + ; bunny beam
BRA .unsuitable_target
+
LDA.w $0BA0,Y
BEQ .valid_target
BRA .unsuitable_target
.potential_target
LDA.w $0EB0,X
BEQ .unsuitable_target
LDA.w $0CD2,Y
AND.b #$40
BNE .valid_target
.unsuitable_target
CLC : RTL
.valid_target
SEC : RTL
;--------------------------------------------------------------------------------
BeeCheckDamage:
PHX : PHP
REP #$20
LDA.w $0E20,Y : AND.w #$00FF
ASL #4
SEP #$20
ORA.w $0ED0,X
REP #$30
TAX
SEP #$20
JSL LookupDamageLevel
SEP #$10
PLP : PLX
RTS
;--------------------------------------------------------------------------------
CheckBugNet:
LDA.w $037A : AND.b #$10 : BEQ .done ; normal behavior if not bugnet
PHP ; we want to preserve the carry bit
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$08 : BNE .return_10 ; normal behavior if not bugnet mode
.bugnet_mode
LDA.w $0E20, X : CMP.b #$E3 : BEQ .return_10 ; normal behavior if fairy
CMP.b #$79 : BEQ .return_10 ; normal behavior if bee
CMP.b #$B2 : BEQ .return_10 ; normal behavior if bee
PLP : LDA.b #$00 : RTL
.return_10
PLP : LDA.b #$10
.done
RTL
;--------------------------------------------------------------------------------
SetHammerClass:
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$08 : BNE .normal ; normal behavior if not bugnet mode
LDA.w $037A : AND.b #$10 : BEQ .normal ; normal behavior if not bugnet
LDA 4, S : TAX ; get sprite index off of stack
LDA.w $0E20, X : CMP.b #$88 : BNE .not_mothula
LDA.l SpecialWeaponLevel
CMP #$04 : !BGE .fix_mothula
BRA .done
.fix_mothula
LDA #$03
BRA .done
.not_mothula
LDA.l SpecialWeaponLevel
.done
STA.w $0CF2
RTL
.normal
LDA.w $0301
AND.b #$0A
BEQ .not_hammer
LDA.b #$03
STA.w $0CF2
.not_hammer
RTL
;--------------------------------------------------------------------------------

View File

@@ -10,6 +10,7 @@
;--------------------------------------------------------------------------------
pushpc
org 0 ; This module writes no bytes. Asar gives bank cross errors without this.
SaveDataWRAM = $7EF000
;================================================================================
; Room Data ($7EF000 - $7EF27F
@@ -53,17 +54,14 @@ endstruct align 2
; This label can be indexed with a plus symbol (e.g. The Hyrule Castle screen would
; be OverworldEventDataWRAM+$1B or OverworldEventDataWRAM+27)
;--------------------------------------------------------------------------------
; - i o t t t b -
; - i o - - - b -
;
; i = Free-standing item collected. Also used for sprites like the castle tower barrier
; o = Overlay active
; b = Bomb wall opened
; t = Tree/Rock/Statue prize collected (Bonk Drop Shuffle)
;--------------------------------------------------------------------------------
OverworldEventDataWRAM = $7EF280
; Temp location
MultiClientFlagsWRAM = $7EF33D
;================================================================================
; Items & Equipment ($7EF340 - $7EF38B)
;--------------------------------------------------------------------------------
@@ -128,8 +126,8 @@ MaximumHealth: skip 1 ; \ Max Health & Current Health
CurrentHealth: skip 1 ; / Max value for both is $A0 | $04 = half heart | $08 = heart
CurrentMagic: skip 1 ; Current magic | Max value is $80
CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer)
BombCapacityUpgrades: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacityUpgrades: skip 1 ; / Indicates flatly how many can be held above vanilla max (integers)
BombCapacity: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacity: skip 1 ; / Indicates flatly how many can be held (integers)
HeartsFiller: skip 1 ; Hearts collected yet to be filled. Write in multiples of $08
MagicFiller: skip 1 ; Magic collected yet to be filled
PendantsField: skip 1 ; - - - - - g b r (bitfield)
@@ -168,14 +166,13 @@ CurrentGenericKeys: skip 1 ; Generic small keys
;================================================================================
; Tracking & Indicators ($7EF38C - $7EF3F0)
;--------------------------------------------------------------------------------
InventoryTracking: skip 2 ; - - - - - - o q b r m p n s k f (bitfield)
InventoryTracking: skip 2 ; b r m p n s k f - - - - - - o q (bitfield)
; b = Blue Boomerang | r = Red Boomerang | m = Mushroom Current
; p = Magic Powder | n = Mushroom Past | s = Shovel
; k = Inactive Flute | f = Active Flute | o = Any bomb acquired
; q = Quickswap locked
BowTracking: skip 2 ; - - - - - - - - b s p f - - - - (bitfield)
; b = Any Bow | s = Silver Arrows Upgrade | p = Second Progressive Bow
; f = First progressive bow
BowTracking: skip 2 ; b s p - - - - - - - - - - - - - (bitfield)
; b = Bow | s = Silver Arrows Upgrade | p = Second Progressive Bow
; The front end writes two distinct progressive bow items. p
; indicates whether the "second" has been found independent of
; the first
@@ -183,9 +180,7 @@ ItemLimitCounts: skip 16 ; Keeps track of limited non-progressive items s
; See: ItemSubstitutionRules in tables.asm
; Right now this is only used for three items but extra space is
; reserved
skip 35 ; Unused
SpecialWeaponLevel: skip 1 ; Keeps track of level of weapon in item modes
ItemOnB: skip 1 ; same table as $0202; $01 = arrows .. $14 = mirror
skip 37 ; Unused
ProgressIndicator: skip 1 ; $00 = Pre-Uncle | $01 = Post-Uncle item | $02 = Zelda Rescued
; $03 = Agahnim 1 defeated
; $04 and above don't do anything. $00-$02 used in standard mode
@@ -258,7 +253,7 @@ IgnoreFaeries: ;
HasGroveItem: ;
GeneralFlags: skip 1 ; - - h - - i - g (bitfield)
; h = HUD Flag | i = ignore faeries | g = has diggable grove item
HighestSword: skip 1 ; Highest sword level (integer)
ProgressiveSwords: skip 1 ; Number of Progressive Swords obatined (integer)
GoalCounter: skip 2 ; Goal items collected (16-bit integer)
ProgrammableItemOne: skip 2 ; \ Reserved for programmable items
ProgrammableItemTwo: skip 2 ; |
@@ -266,7 +261,7 @@ ProgrammableItemThree: skip 2 ; /
BonkCounter: skip 1 ; Number of times the player has bonked (integer)
YAItemCounter: skip 1 ; y y y y y a a a (packed integers)
; Number of Y and A items collected represented as packed integers
HighestShield: skip 1 ; Highest Shield level
ProgressiveShields: skip 1 ; Number of Progressive Shields obtained
TotalItemCounter: skip 2 ; Total items collected (integer)
SwordBossKills: skip 2 ; t t t t g g g g f f f f m m m m (packed integers)
; t = Tempered Sword boss kills | g = Gold Sword boss kills
@@ -316,8 +311,7 @@ HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer
CrystalCounter: skip 1 ; Total Number of crystals collected (integer)
DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected.
; This has the same shape as the dungeon item bitfields.
BombsPlaced: skip 2 ; Total Number of bombs placed (16-bit integer)
skip 42 ; Unused
skip 44 ; Unused
ServiceSequenceRx: ; Service sequence receive
ServiceSequenceTx: ; Service sequence transmit
ServiceSequence: skip 8 ; Service request block. See servicerequest.asm
@@ -373,27 +367,7 @@ GTCollectedKeys: skip 1 ; / Ganon's Tower
skip 2 ; Reserved for previous table
FileMarker: skip 1 ; $FF = Active save file | $00 = Inactive save file
skip 13 ; Unused
InverseChecksum: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
;================================================================================
; Temporary Effects ($7F50C0 - $7F50CF)
;--------------------------------------------------------------------------------
base $7F50C0
SwordModifier: skip 1
ShieldModifier: skip 1 ; (not implemented)
ArmorModifier: skip 1
MagicModifier: skip 1
LightConeModifier: skip 1
CuccoStormModifier: skip 1
OldManDashModifier: skip 1
IcePhysicsModifier: skip 1
InfiniteArrowsModifier: skip 1
InfiniteBombsModifier: skip 1
InfiniteMagicModifier: skip 1
InvertDPadModifier: skip 1
TemporaryOHKO: skip 1
SpriteSwapper: skip 1
BootsModifier: skip 1 ; (0=Off, 1=Always, 2=Never)
InverseChecksumWRAM: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
;================================================================================
; Expanded SRAM ($7F6000 - $7F6FFF)
@@ -406,8 +380,7 @@ ExtendedFileNameWRAM: skip 24 ; File name, 12 word-length characters.
RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per room.
SpritePotData: skip 592 ; Table for expanded pot shuffle. One word per room.
PurchaseCounts: skip 96 ; Keeps track of shop purchases
PrivateBlock: skip 512 ; Reserved for 3rd party developers
DummyValue: skip 1 ; $01 if you're a real dummy
PrivateBlock: skip 513 ; Reserved for 3rd party developers
;================================================================================
; Direct SRAM Assignments ($700000 - $7080000)
@@ -430,18 +403,29 @@ ProgressIndicatorSRAM: skip 1 ;
skip 19 ;
FileNameVanillaSRAM: skip 8 ; First four characters of file name
FileValiditySRAM: skip 2 ;
skip 285 ;
skip 283 ;
InverseChecksumSRAM: skip 2 ;
ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes)
skip $1AE4 ;
RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes
; $01 for now (32-bits total)
RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes)
; If value in the ROM doesn't match SRAM, save is cleared.
skip 4075 ;
PasswordSRAM: skip 16 ; Password value (16 bytes)
skip 8155 ;
SaveBackupSRAM: ; Backup copy of save ram. Game will attempt to use this if
; checksum on file select screen load fails.
base off
;================================================================================
; Bank Definitions
;--------------------------------------------------------------------------------
; If these move (most likely by placing initsramtable.asm somewhere else) these
; bank definitions need to be changed as well.
;================================================================================
SRAMBank = $70
SRAMTableBank = $30|$80
;================================================================================
; Assertions
;================================================================================
@@ -499,8 +483,8 @@ endmacro
%assertSRAM(CurrentHealth, $7EF36D)
%assertSRAM(CurrentMagic, $7EF36E)
%assertSRAM(CurrentSmallKeys, $7EF36F)
%assertSRAM(BombCapacityUpgrades, $7EF370)
%assertSRAM(ArrowCapacityUpgrades, $7EF371)
%assertSRAM(BombCapacity, $7EF370)
%assertSRAM(ArrowCapacity, $7EF371)
%assertSRAM(HeartsFiller, $7EF372)
%assertSRAM(MagicFiller, $7EF373)
%assertSRAM(PendantsField, $7EF374)
@@ -542,7 +526,7 @@ endmacro
%assertSRAM(FollowerDropped, $7EF3D3)
%assertSRAM(FileNameVanillaWRAM, $7EF3D9)
%assertSRAM(FileValidity, $7EF3E1)
%assertSRAM(InverseChecksum, $7EF4FE)
%assertSRAM(InverseChecksumWRAM, $7EF4FE)
;================================================================================
; Randomizer Assertions
@@ -551,7 +535,6 @@ endmacro
;--------------------------------------------------------------------------------
%assertSRAM(InventoryTracking, $7EF38C)
%assertSRAM(BowTracking, $7EF38E)
%assertSRAM(SpecialWeaponLevel, $7EF3C3)
%assertSRAM(ItemLimitCounts, $7EF390)
;--------------------------------------------------------------------------------
%assertSRAM(GameCounter, $7EF3FF)
@@ -564,14 +547,14 @@ endmacro
%assertSRAM(IgnoreFaeries, $7EF416)
%assertSRAM(HasGroveItem, $7EF416)
%assertSRAM(GeneralFlags, $7EF416)
%assertSRAM(HighestSword, $7EF417)
%assertSRAM(ProgressiveSwords, $7EF417)
%assertSRAM(GoalCounter, $7EF418)
%assertSRAM(ProgrammableItemOne, $7EF41A)
%assertSRAM(ProgrammableItemTwo, $7EF41C)
%assertSRAM(ProgrammableItemThree, $7EF41E)
%assertSRAM(BonkCounter, $7EF420)
%assertSRAM(YAItemCounter, $7EF421)
%assertSRAM(HighestShield, $7EF422)
%assertSRAM(ProgressiveShields, $7EF422)
%assertSRAM(TotalItemCounter, $7EF423)
%assertSRAM(SwordBossKills, $7EF425)
%assertSRAM(BigKeysBigChests, $7EF427)
@@ -668,7 +651,6 @@ endmacro
%assertSRAM(SpritePotData, $7F6268)
%assertSRAM(PurchaseCounts, $7F64B8)
%assertSRAM(PrivateBlock, $7F6518)
%assertSRAM(DummyValue, $7F6718)
;================================================================================
; Direct SRAM Assertions
@@ -682,9 +664,11 @@ endmacro
%assertSRAM(ProgressIndicatorSRAM, $7003C5)
%assertSRAM(FileNameVanillaSRAM, $7003D9)
%assertSRAM(FileValiditySRAM, $7003E1)
%assertSRAM(InverseChecksumSRAM, $7004FE)
%assertSRAM(ExtendedFileNameSRAM, $700500)
%assertSRAM(RomNameSRAM, $702000)
%assertSRAM(RomVersionSRAM, $701FFC)
%assertSRAM(PasswordSRAM, $703000)
%assertSRAM(RomNameSRAM, $702000)
%assertSRAM(PasswordSRAM, $702015)
%assertSRAM(SaveBackupSRAM, $704000)
pullpc

View File

@@ -7,7 +7,8 @@
;--------------------------------------------------------------------------------
IncrementBonkCounter:
LDA StatsLocked : BNE +
LDA BonkCounter : INC : BEQ + ; overflow
LDA BonkCounter : INC
CMP.b #100 : BEQ + ; decimal 100
STA BonkCounter
+
RTL
@@ -94,12 +95,9 @@ IncrementSmallKeysNoPrimary:
JSL.l UpdateKeys
LDA $1B : BEQ + ; skip room check if outdoors
PHP : REP #$20 ; set 16-bit accumulator
LDA $048E : CMP.w #$0087 : BNE ++ ; check for hera basement cage
LDA $A8 : AND #$0003 : CMP #$0002 : BNE ++ ; must be quadrant 2
LDA $048E : CMP.w #$0087 : BNE ++ ; hera basement
PLP : PHY : LDY.b #$24 : JSL.l FullInventoryExternal
LDA StandingItemsOn : BNE +++
JSR CountChestKey
+++ PLY : BRA +
JSR CountChestKey : PLY : BRA +
++
PLP
+
@@ -118,7 +116,6 @@ RTL
;--------------------------------------------------------------------------------
CountChestKey: ; called by neighbor functions
PHA : PHX
LDA !MULTIWORLD_ITEM_PLAYER_ID : bne .end
CPY #$24 : BEQ + ; small key for this dungeon - use $040C
CPY #$A0 : !BLT .end ; Ignore most items
CPY #$AE : !BGE .end ; Ignore reserved key and generic key
@@ -184,16 +181,6 @@ IncrementChestTurnCounter:
PLA
RTL
;--------------------------------------------------------------------------------
IncrementBombsPlacedCounter:
PHA
LDA StatsLocked : BNE +
PHP : REP #$20
LDA BombsPlaced : INC : STA BombsPlaced
PLP
+
PLA
RTL
;--------------------------------------------------------------------------------
IncrementChestCounter:
LDA.b #$01 : STA $02E9 ; thing we wrote over
PHA
@@ -214,9 +201,9 @@ RTL
DecrementItemCounter:
PHA
LDA StatsLocked : BNE +
REP #$20
REP #$20
LDA TotalItemCounter : DEC : STA TotalItemCounter
SEP #$20
SEP #$20
+
PLA
RTL
@@ -327,7 +314,9 @@ RTL
IndoorTileTransitionCounter:
JMP StatTransitionCounter
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
IndoorSubtileTransitionCounter:
LDA.b #$01 : STA !REDRAW ; set redraw flag for items
STZ $0646 ; stuff we wrote over
STZ $0642
JMP StatTransitionCounter

View File

@@ -459,7 +459,6 @@ CreditsLine151:
CreditsLine152:
;GAME STATS
db $0B, $13, $06, $00, $0C, $04, $9F, $12, $13, $00, $13, $12
print "GT Big Key Credit Start: ", pc
CreditsLine153:
;GT BIG KEY $$$$/22
db $02, $37, $63, $70, $9F, $5E, $65, $63, $9F, $67, $61, $75, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $A2, $55, $55

View File

@@ -3,67 +3,15 @@
;===================================================================================================
table "creditscharmapbighi.txt"
YourSpriteCreditsHi:
db 2, 55, " " ; $238002
db 2
db 55
db " " ; $238002
table "creditscharmapbiglo.txt"
YourSpriteCreditsLo:
db 2, 55, " " ; $238020
table "creditscharmapbighi.txt"
CollectionRateHi:
db 2, 55, "COLLECTION RATE /216" ; $23803E, "216" at $238057
table "creditscharmapbiglo.txt"
CollectionRateLo:
db 2, 55, "COLLECTION RATE /216" ; $23805C, "216" at $238075
table "creditscharmapbighi.txt"
FirstSwordStatsHi:
db 2, 55, "FIRST SWORD " ; $23807A
table "creditscharmapbiglo.txt"
FirstSwordStatsLo:
db 2, 55, "FIRST SWORD " ; $238098
table "creditscharmapbighi.txt"
SwordlessKillsHi:
db 2, 55, "SWORDLESS /13" ; $2380B6
table "creditscharmapbiglo.txt"
SwordlessKillsLo:
db 2, 55, "SWORDLESS /13" ; $2380D4
table "creditscharmapbighi.txt"
FighterSwordKillsHi:
db 2, 55, "FIGHTER'S SWORD /13" ; $2380F2
table "creditscharmapbiglo.txt"
FighterSwordKillsLo:
db 2, 55, "FIGHTER'S SWORD /13" ; $238110
table "creditscharmapbighi.txt"
MasterSwordKillsHi:
db 2, 55, "MASTER SWORD /13" ; $23812E
table "creditscharmapbiglo.txt"
MasterSwordKillsLo:
db 2, 55, "MASTER SWORD /13" ; $23814C
table "creditscharmapbighi.txt"
TemperedSwordKillsHi:
db 2, 55, "TEMPERED SWORD /13" ; $23816A
table "creditscharmapbiglo.txt"
TemperedSwordKillsLo:
db 2, 55, "TEMPERED SWORD /13" ; $238188
table "creditscharmapbighi.txt"
GoldSwordKillsHi:
db 2, 55, "GOLD SWORD /13" ; $2381A6
table "creditscharmapbiglo.txt"
GoldSwordKillsLo:
db 2, 55, "GOLD SWORD /13" ; $2381C4
db 2
db 55
db " " ; $238020
;===================================================================================================
@@ -478,16 +426,7 @@ CreditsLineBlank:
%blankline()
%blankline()
%smallcredits("OVERWORLD RANDOMIZER", "yellow")
%blankline()
%bigcredits("CODEMANN8 CATOBAT")
%blankline()
%blankline()
%smallcredits("FESTIVE RANDOMIZER", "green")
%smallcredits("FESTIVE RANDOMIZER", "yellow")
%blankline()
@@ -500,7 +439,7 @@ CreditsLineBlank:
%blankline()
%blankline()
%smallcredits("SPRITE DEVELOPMENT", "yellow")
%smallcredits("SPRITE DEVELOPMENT", "green")
%blankline()
@@ -524,9 +463,7 @@ CreditsLineBlank:
%blankline()
%blankline()
%smallcredits("YOUR SPRITE BY", "green")
%blankline()
%smallcredits("YOUR SPRITE BY", "yellow")
%addarbline(YourSpriteCreditsHi)
%addarbline(YourSpriteCreditsLo)
@@ -534,7 +471,7 @@ CreditsLineBlank:
%blankline()
%blankline()
%smallcredits("MSU SUPPORT", "yellow")
%smallcredits("MSU SUPPORT", "green")
%blankline()
@@ -543,7 +480,7 @@ CreditsLineBlank:
%blankline()
%blankline()
%smallcredits("PALETTE SHUFFLER", "green")
%smallcredits("PALETTE SHUFFLER", "yellow")
%blankline()
@@ -608,6 +545,14 @@ CreditsLineBlank:
%bigcredits("HTTPS://ALTTPR.COM/DISCORD")
%blankline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
@@ -651,8 +596,7 @@ endif
%blankline()
%blankline()
%addarbline(FirstSwordStatsHi)
%addarbline(FirstSwordStatsLo)
%bigcreditsleft("FIRST SWORD")
%blankline()
@@ -675,28 +619,23 @@ endif
%blankline()
%blankline()
%addarbline(SwordlessKillsHi)
%addarbline(SwordlessKillsLo)
%bigcreditsleft("SWORDLESS /13")
%blankline()
%addarbline(FighterSwordKillsHi)
%addarbline(FighterSwordKillsLo)
%bigcreditsleft("FIGHTER'S SWORD /13")
%blankline()
%addarbline(MasterSwordKillsHi)
%addarbline(MasterSwordKillsLo)
%bigcreditsleft("MASTER SWORD /13")
%blankline()
%addarbline(TemperedSwordKillsHi)
%addarbline(TemperedSwordKillsLo)
%bigcreditsleft("TEMPERED SWORD /13")
%blankline()
%addarbline(GoldSwordKillsHi)
%addarbline(GoldSwordKillsLo)
%bigcreditsleft("GOLD SWORD /13")
%blankline()
%blankline()
@@ -718,10 +657,6 @@ endif
%blankline()
%bigcreditsleft("BOMBS PLACED")
%blankline()
%bigcreditsleft("SAVE AND QUITS")
%blankline()
@@ -741,6 +676,11 @@ endif
%bigcreditsleft("TOTAL LAG TIME")
%blankline()
%blankline()
%blankline()
%blankline()
%blankline()
@@ -755,8 +695,7 @@ endif
%emptyline()
%emptyline()
%addarbline(CollectionRateHi)
%addarbline(CollectionRateLo)
%bigcreditsleft("COLLECTION RATE /216")
%blankline()
@@ -772,3 +711,42 @@ endif
%emptyline()
;---------------------------------------------------------------------------------------------------
!FIRST_SWORD_X = 19
!FIRST_SWORD_Y = 310
!PEGASUS_BOOTS_X = 19
!PEGASUS_BOOTS_Y = 313
!FLUTE_X = 19
!FLUTE_Y = 316
!MIRROR_X = 19
!MIRROR_Y = 319
!SWORDLESS_X = 23
!SWORDLESS_Y = 327
!FIGHTERS_SWORD_X = 23
!FIGHTERS_SWORD_Y = 330
!MASTER_SWORD_X = 23
!MASTER_SWORD_Y = 333
!TEMPERED_SWORD_X = 23
!TEMPERED_SWORD_Y = 336
!GOLD_SWORD_X = 23
!GOLD_SWORD_Y = 339
!DAMAGETAKEN_X = 26
!DAMAGETAKEN_Y = 346
!MAGICUSED_X = 26
!MAGICUSED_Y = 349
!BONKS_X = 26
!BONKS_Y = 352
!SAVE_AND_QUITS_X = 26
!SAVE_AND_QUITS_Y = 355
!DEATHS_X = 26
!DEATHS_Y = 358
!FAERIE_REVIVALS_X = 26
!FAERIE_REVIVALS_Y = 361
!TOTAL_MENU_TIME_X = 19
!TOTAL_MENU_TIME_Y = 364
!TOTAL_LAG_TIME_X = 19
!TOTAL_LAG_TIME_Y = 367
!COLLECTION_RATE_X = 22
!COLLECTION_RATE_Y = 380
!TOTAL_TIME_X = 19
!TOTAL_TIME_Y = 383

Binary file not shown.

View File

@@ -635,7 +635,6 @@ RTS
FontTable:
incbin stats/fonttable.bin
print "Stats Config address: ", pc
CreditsStats:
incsrc stats/statConfig.asm
dw $FFFF
@@ -668,4 +667,4 @@ org $0ee86d
JMP.w AfterDeathCounterOutput
org $0ee8fd
AfterDeathCounterOutput:
AfterDeathCounterOutput:

View File

@@ -1,64 +1,21 @@
!FIRST_SWORD_X = 19
!FIRST_SWORD_Y = 310
!PEGASUS_BOOTS_X = 19
!PEGASUS_BOOTS_Y = 313
!FLUTE_X = 19
!FLUTE_Y = 316
!MIRROR_X = 19
!MIRROR_Y = 319
!SWORDLESS_X = 23
!SWORDLESS_Y = 327
!FIGHTERS_SWORD_X = 23
!FIGHTERS_SWORD_Y = 330
!MASTER_SWORD_X = 23
!MASTER_SWORD_Y = 333
!TEMPERED_SWORD_X = 23
!TEMPERED_SWORD_Y = 336
!GOLD_SWORD_X = 23
!GOLD_SWORD_Y = 339
!DAMAGETAKEN_X = 26
!DAMAGETAKEN_Y = 346
!MAGICUSED_X = 26
!MAGICUSED_Y = 349
!BONKS_X = 26
!BONKS_Y = 352
!BOMBS_X = 26
!BOMBS_Y = 355
!SAVE_AND_QUITS_X = 26
!SAVE_AND_QUITS_Y = 358
!DEATHS_X = 26
!DEATHS_Y = 361
!FAERIE_REVIVALS_X = 26
!FAERIE_REVIVALS_Y = 364
!TOTAL_MENU_TIME_X = 19
!TOTAL_MENU_TIME_Y = 367
!TOTAL_LAG_TIME_X = 19
!TOTAL_LAG_TIME_Y = 370
!COLLECTION_RATE_X = 22
!COLLECTION_RATE_Y = 380
!TOTAL_TIME_X = 19
!TOTAL_TIME_Y = 383
;(address, type, shiftRight, bits, digits, xPos, lineNumber)
%AddStat(SwordTime, 1, 0, 32, 4, !FIRST_SWORD_X, !FIRST_SWORD_Y)
%AddStat(BootsTime, 1, 0, 32, 4, !PEGASUS_BOOTS_X, !PEGASUS_BOOTS_Y)
%AddStat(FluteTime, 1, 0, 32, 4, !FLUTE_X, !FLUTE_Y)
%AddStat(MirrorTime, 1, 0, 32, 4, !MIRROR_X, !MIRROR_Y)
%AddStat(SwordlessBossKills, 0, 0, 04, 2, !SWORDLESS_X, !SWORDLESS_Y)
%AddStat(SwordBossKills, 0, 4, 04, 2, !FIGHTERS_SWORD_X, !FIGHTERS_SWORD_Y)
%AddStat(SwordBossKills, 0, 0, 04, 2, !MASTER_SWORD_X, !MASTER_SWORD_Y)
%AddStat(SwordBossKills+1, 0, 4, 04, 2, !TEMPERED_SWORD_X, !TEMPERED_SWORD_Y)
%AddStat(SwordBossKills+1, 0, 0, 04, 2, !GOLD_SWORD_X, !GOLD_SWORD_Y)
%AddStat(DamageCounter, 0, 0, 16, 5, !DAMAGETAKEN_X, !DAMAGETAKEN_Y)
%AddStat(MagicCounter, 0, 0, 16, 5, !MAGICUSED_X, !MAGICUSED_Y)
%AddStat(BonkCounter, 0, 0, 08, 3, !BONKS_X, !BONKS_Y)
%AddStat(BombsPlaced, 0, 0, 16, 4, !BOMBS_X, !BOMBS_Y)
%AddStat(SaveQuitCounter, 0, 0, 08, 2, !SAVE_AND_QUITS_X, !SAVE_AND_QUITS_Y)
%AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y)
%AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y)
%AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y)
%AddStat($7F5038, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y)
print "Colletion Rate config: ", pc
%AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y)
%AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y)
;(address, type, shiftRight, bits, digits, xPos, lineNumber)
%AddStat(SwordTime, 1, 0, 32, 4, !FIRST_SWORD_X, !FIRST_SWORD_Y)
%AddStat(BootsTime, 1, 0, 32, 4, !PEGASUS_BOOTS_X, !PEGASUS_BOOTS_Y)
%AddStat(FluteTime, 1, 0, 32, 4, !FLUTE_X, !FLUTE_Y)
%AddStat(MirrorTime, 1, 0, 32, 4, !MIRROR_X, !MIRROR_Y)
%AddStat(SwordlessBossKills, 0, 0, 08, 2, !SWORDLESS_X, !SWORDLESS_Y)
%AddStat(SwordBossKills, 0, 4, 04, 2, !FIGHTERS_SWORD_X, !FIGHTERS_SWORD_Y)
%AddStat(SwordBossKills, 0, 0, 04, 2, !MASTER_SWORD_X, !MASTER_SWORD_Y)
%AddStat(SwordBossKills+1, 0, 4, 04, 2, !TEMPERED_SWORD_X, !TEMPERED_SWORD_Y)
%AddStat(SwordBossKills+1, 0, 0, 04, 2, !GOLD_SWORD_X, !GOLD_SWORD_Y)
%AddStat(DamageCounter, 0, 0, 16, 5, !DAMAGETAKEN_X, !DAMAGETAKEN_Y)
%AddStat(MagicCounter, 0, 0, 16, 5, !MAGICUSED_X, !MAGICUSED_Y)
%AddStat(BonkCounter, 0, 0, 08, 3, !BONKS_X, !BONKS_Y)
%AddStat(SaveQuitCounter, 0, 0, 08, 2, !SAVE_AND_QUITS_X, !SAVE_AND_QUITS_Y)
%AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y)
%AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y)
%AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y)
%AddStat($7F5038, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y)
%AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y)
%AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y)

View File

@@ -39,34 +39,25 @@ LoadSwordForDamage:
JSR.w LoadModifiedSwordLevel ; load normal sword value
RTL
;================================================================================
macro LookupDamageSubclass(table_address)
PHP
REP #$20 ; set 16-bit accumulator
TXA : LSR : TAX : BCS +
PLP
LDA.l <table_address>, X
LSR #4
BRA ++
+
PLP
LDA.l <table_address>, X
AND.b #$0F
++
endmacro
;================================================================================
;!StalfosBombDamage = "$7F509D"
LookupDamageLevel:
CPX.w #$0918 : BNE +
LDA.l !StalfosBombDamage
RTL
+
LDA SpecialWeapons : AND.b #$7F : CMP.b #$02 : BEQ .pseudo_table
LDA SpecialWeapons : AND.b #$80 : BNE .bomb_table
%LookupDamageSubclass(Damage_Table) : RTL
.bomb_table
%LookupDamageSubclass(Damage_Table_Bombs) : RTL
.pseudo_table
%LookupDamageSubclass(Damage_Table_Pseudo) : RTL
PHP
REP #$20 ; set 16-bit accumulator
TXA : LSR : TAX : BCS .lower
.upper
PLP
LDA.l Damage_Table, X
LSR #4
RTL
.lower
PLP
LDA.l Damage_Table, X
AND.b #$0F
RTL
;================================================================================
; $7F50C0 - Sword Modifier
LoadModifiedSwordLevel: ; returns short
@@ -105,40 +96,29 @@ LoadModifiedMagicLevel:
RTL
;================================================================================
; $7E0348 - Ice Value
; $7F50C7 - Temporary Ice Modifier
; $30802D - Permanent Ice Modifier ($01 bit)
LoadModifiedIceFloorValue:
; $7F50C7 - Ice Modifier
LoadModifiedIceFloorValue_a11:
LDA $A0 : CMP #$91 : BEQ + : CMP #$92 : BEQ + : CMP #$93 : BEQ + ; mire basement currently broken - not sure why
LDA $5D : CMP #$01 : BEQ + : CMP #$17 : BEQ + : CMP #$1C : BEQ +
LDA $5E : CMP #$02 : BEQ +
LDA $5B : BNE +
LDA.l $30802D : BIT #$01 : BEQ ++
LDA $A0 : CMP #$16 : BEQ ++ ; swamp supertile with current -- fine for temporary physics but impossible without boots for permanent
LDA.w $0348 : ORA $7F50C7 : ORA #$10 : RTS
++ : LDA.w $0348 : ORA $7F50C7 : RTS
+ : LDA.w $0348
RTS
LoadModifiedIceFloorValue_a11:
JSR LoadModifiedIceFloorValue : AND.b #$11 : RTL
LDA.w $0348 : ORA $7F50C7 : AND.b #$11 : RTL
+ : LDA.w $0348 : AND.b #$11
RTL
LoadModifiedIceFloorValue_a01:
JSR LoadModifiedIceFloorValue : AND.b #$01 : RTL
LDA $A0 : CMP #$91 : BEQ + : CMP #$92 : BEQ + : CMP #$93 : BEQ + ; mire basement currently broken - not sure why
LDA $5D : CMP #$01 : BEQ + : CMP #$17 : BEQ + : CMP #$1C : BEQ +
LDA $5E : CMP #$02 : BEQ +
LDA $5B : BNE +
LDA.w $0348 : ORA $7F50C7 : AND.b #$01 : RTL
+ : LDA.w $0348 : AND.b #$01
RTL
;================================================================================
CheckTabletSword:
LDA.l AllowHammerTablets : BEQ +
LDA HammerEquipment : BNE .allow ; check for hammer
+
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$01 : BEQ .check_special
CMP.b #$03 : BEQ .check_special
CMP.b #$04 : BEQ .check_special
CMP.b #$05 : BEQ .check_special
CMP.b #$06 : BEQ .allow
CMP.b #$08 : BEQ .check_special
BRA .normal
.allow
LDA HammerEquipment : BEQ + ; check for hammer
LDA.b #$02 : RTL
.check_special
LDA SpecialWeaponLevel : CMP #$02 : !BGE .allow ; check for master bombs
.normal
+
LDA SwordEquipment ; get actual sword value
RTL
;================================================================================
@@ -146,27 +126,15 @@ GetSwordLevelForEvilBarrier:
LDA.l AllowHammerEvilBarrierWithFighterSword : BEQ +
LDA #$FF : RTL
+
LDA.l SpecialWeapons : AND.b #$7F : CMP.b #$08 : BEQ +
LDA.l SwordEquipment : RTL
+
LDA.l SpecialWeaponLevel : RTL
LDA SwordEquipment
RTL
;================================================================================
CheckGanonHammerDamage:
LDA.l HammerableGanon : BEQ +
LDA $0E20, X : CMP.b #$D8 ; original behavior except ganon
RTL
+
LDA.l GanonVulnerabilityItem : CMP.b #$0C : BEQ +
LDA $0E20, X : CMP.b #$D6 ; original behavior
RTL
+
LDA $0E20, X : CMP.b #$D8 : BCC +
RTL
+
CMP.b #$D6 : BNE +
RTL
+
CLC
RTL
;================================================================================
GetSmithSword:
@@ -186,14 +154,13 @@ GetSmithSword:
BRA .done
.buy
LDA SmithItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
LDA.l SmithItem : TAY
STZ $02E9 ; Item from NPC
PHX : JSL Link_ReceiveItem : PLX
REP #$20 : LDA CurrentRupees : !SUB.w #$000A : STA CurrentRupees : SEP #$20 ; Take 10 rupees
JSL ItemSet_SmithSword
.done
JML.l Smithy_AlreadyGotSword
;================================================================================

1272
tables.asm

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More