601 Commits

Author SHA1 Message Date
f0c7b26d0f vitreous and ganon fixes for damage table 2023-06-15 07:06:23 -05:00
f87b95525f Fix moldorm damage table 2023-06-14 20:10:34 -05:00
148a9760e6 Fix trinexx damage table 2023-06-14 19:38:02 -05:00
45b56c6328 Trolls 2023-06-14 19:02:51 -05:00
015f769521 Move kara-branch code to bank A2 so there's space 2023-02-26 14:31:51 -06:00
bfbc180ff3 Merge branch 'OWMain' into overworld_kara 2023-02-26 14:30:05 -06:00
codemann8
750c412f59 Minor comment change 2023-02-25 21:37:44 -06:00
codemann8
b1f23151a2 Disable flute in rain state 2023-02-25 21:37:25 -06:00
codemann8
09b75c3bf6 Merged in DR v1.2.0.9 2023-02-24 16:00:54 -06:00
aerinon
096157e981 Changes graphical status of standard exits when blocking exits in rain
Fixes graphical issues with sanctuary and swamp hub lobbies
Major fix for decoupled doors landing area
Fix for multiworld absorbables
2023-02-24 14:22:42 -07:00
codemann8
2136de4928 Merge pull request #9 from Catobat/HoboFix 2023-02-24 10:46:32 -06:00
Catobat
aa5c3b63a2 Fix swim state when leaving Hobo area 2023-02-24 13:14:19 +01:00
codemann8
3f13cee945 Improved door landing 2023-02-18 10:36:40 -06:00
aerinon
2411d0344e Minor optimization on handling special door landing 2023-02-17 23:48:08 -07:00
aerinon
ff6b8b996b Merge branch 'DRFixes' of github.com:codemann8/z3randomizer into codemann8-DRFixes 2023-02-17 23:43:07 -07:00
codemann8
bfb131be81 Merged in DR v1.2.0.8 2023-02-17 18:47:36 -06:00
aerinon
4a8b8b7691 Standard save and quit change for DR 2023-02-17 16:58:50 -07:00
codemann8
aaff8a1975 Improved door landing
Improved door landing
2023-02-02 18:37:13 -06:00
codemann8
7fdc59bb08 Improved door landing 2023-02-01 22:14:38 -06:00
ec6231955d Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2023-01-30 19:47:34 -06:00
codemann8
fd53cea697 Merge branch 'DRUnstable' into OWMain 2023-01-30 11:59:05 -06:00
codemann8
468fe5f2af Improved door landing 2023-01-30 10:34:48 -06:00
aerinon
296c311b0a Fix for lamp check in escape if entering from dark world. Also fixes the torch going out bug. 2023-01-27 15:12:30 -07:00
codemann8
bae7c6175c Merge branch 'DRUnstable' into OWMain 2023-01-06 21:20:56 -06:00
aerinon
8957b8db7b Fast ROM updates 2023-01-06 15:02:22 -07:00
codemann8
782f18d9d9 Merge branch 'DRUnstable' into OWMain 2022-12-16 17:16:08 -06:00
aerinon
83465e39af Fix for blocked entrance doors 2022-12-16 15:14:33 -07:00
aerinon
955766dc2a Door state fix attempt2 2022-12-05 08:19:59 -07:00
aerinon
46272e7fad New goal "completionist" 2022-12-01 14:04:09 -07:00
aerinon
9e50d5f02c Aga fix for door state (no trap door) 2022-12-01 14:03:39 -07:00
codemann8
4af93256a5 Merged DR v1.2.0.0 2022-12-01 14:10:35 -06:00
aerinon
612597be12 Merge branch 'Synthesis' into DRUnstable 2022-12-01 10:01:57 -07:00
aerinon
3af9e75dbd Possible fix for standing items after Aga transition 2022-12-01 10:01:37 -07:00
9699c4d731 Fix swordless boss counter 2022-11-19 21:09:34 -08:00
846ad798cf Fix conflict between hammer-on-B code with bunny-pressing-A code 2022-11-19 10:06:37 -08:00
44e2ccf7f7 Fix bomb on file select screen in swordless 2022-11-16 14:39:47 -08:00
5d4e7fa62d Add Hammer-On-B mode 2022-11-16 14:39:05 -08:00
be81787446 Bee Mode 2022-11-16 14:37:42 -08:00
682583c215 Merge branch 'OWMain' into overworld_kara 2022-11-16 14:24:25 -08:00
codemann8
1e2a0c7774 Remove the sprite spawn delay when bonking prizes 2022-11-08 18:52:11 -06:00
codemann8
0174e5dbf5 Fixed fake world handling for IB transitions 2022-10-26 13:45:19 -05:00
codemann8
01475f313a Fixed fake world handling for IB transitions 2022-10-26 07:54:05 -05:00
codemann8
74b01030e0 Fixed Murahduhla freeze issue 2022-10-24 17:56:32 -05:00
codemann8
bf034c0f7c Setting World flag on initial spawn 2022-10-22 09:12:20 -05:00
codemann8
43448cc5b6 Fixed OOB transition behavior in Mixed OWR 2022-10-21 00:11:45 -05:00
codemann8
33cfd010a0 Renamed/used some labels 2022-10-20 10:25:08 -05:00
codemann8
3ed0ec0835 Merge pull request #8 from Catobat/Terrain 2022-10-12 21:18:18 -05:00
3cec56c5d8 Revert "Fix mixing progressive/non-progressive swords and shields"
This reverts commit d05169d5e2.
2022-10-12 15:55:48 -07:00
Catobat
d8e11838c1 Fix direction Link is facing 2022-10-13 00:55:20 +02:00
Catobat
304cb34478 Consistent handling of glitched states 2022-10-13 00:46:24 +02:00
codemann8
36feaff153 Merge pull request #7 from Catobat/Terrain 2022-10-08 18:56:47 -05:00
d05169d5e2 Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:43:28 -07:00
Catobat
10567536a1 Add free RAM notes 2022-10-08 18:18:50 +02:00
Catobat
4ccca38888 Implement forced transitions 2022-10-08 18:09:44 +02:00
aerinon
686bb0c064 Big key door fix 2022-09-30 15:29:00 -06:00
f93a817ed3 Show chest keys count always 2022-09-18 23:21:55 -07:00
d6f3aee02b Remove non-progressive bomb/cane upgrades 2022-09-18 18:18:12 -07:00
4817fa2013 Fix up labels
still WIP

still do not use
2022-09-18 18:11:21 -07:00
6f138825d9 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara
WIP, Broken, Do Not Use
2022-09-18 17:36:49 -07:00
codemann8
f0a15dce36 Fixed incorrect comment 2022-09-07 19:41:39 -05:00
codemann8
3c6c089323 Added warning if overworld map code exceeds original bounds 2022-09-07 19:41:01 -05:00
codemann8
223c086c82 Merge branch 'DRUnstable' into OWMain 2022-09-07 19:38:34 -05:00
aerinon
9cdca6edb3 Fix for rain prevented doors and key door numbering 2022-09-07 16:51:57 -06:00
aerinon
6b853222f2 Fix for rain prevented doors and key door numbering 2022-09-07 16:51:29 -06:00
aerinon
2acee4abb9 Flute activated pickup sfx 2022-09-07 15:09:04 -06:00
codemann8
ee7e08f46c Merge branch 'DRUnstable' into OWMain 2022-08-25 16:14:08 -05:00
codemann8
348da3ac99 Chickens now spawn on same layer as Link 2022-08-25 00:27:25 -05:00
aerinon
8a18566da1 Merge branch 'DRUnstable' into Synthesis
# Conflicts:
#	doorrando/overrides.asm
2022-08-24 14:27:34 -06:00
aerinon
0e15eb3560 Merge branch 'BlindZeldaDespawn' into DRUnstable 2022-08-24 14:26:48 -06:00
aerinon
0941cd321e Merge branch 'DRUnstable' into Synthesis 2022-08-24 14:24:37 -06:00
aerinon
2457c67d0e Bank map update 2022-08-24 13:13:24 -06:00
codemann8
93b1949c71 Merged DR v1.0.1.1 2022-08-18 20:51:22 -05:00
codemann8
bfa105fd62 Minor MSU change for bunny music 2022-08-18 20:48:51 -05:00
aerinon
e1fa3aa7b7 Merge branch 'DRUnstable' into Synthesis 2022-08-11 15:28:38 -06:00
aerinon
ca70d8c2a3 Merge branch 'DRVolatile' into Synthesis 2022-08-11 15:28:32 -06:00
aerinon
ad6a2ed2fe Merge remote-tracking branch 'origin/DRVolatile' into DRVolatile 2022-08-11 15:28:00 -06:00
aerinon
2309b88545 Standing items fix for reloading pot items 2022-08-11 15:27:38 -06:00
aerinon
22b5524a4c Merge pull request #22 from Catobat/Tavern
Shuffle Back of Tavern
2022-08-11 15:27:00 -06:00
aerinon
e321299603 Fix for crash 2022-08-08 10:33:01 -06:00
aerinon
a6577b4e4b Output for collection rate config 2022-08-05 13:31:18 -06:00
aerinon
196905a83f Merge branch 'DRUnstable' into Synthesis 2022-08-05 13:29:54 -06:00
codemann8
f60b03ba42 Fixed TR Peg Puzzle Not Spawning Portal Overlay 2022-07-31 21:46:54 -05:00
codemann8
c029de9cdc Fixed disappearing mirror portal in Inverted 2022-07-31 21:12:54 -05:00
codemann8
25761a1aa6 Changed MSU-1 in Inverted to flip the triggers for the secondary OW tracks 2022-07-31 21:11:40 -05:00
codemann8
c209abd2a5 Fixed Sprite Author in credits to have same gap as other groups 2022-07-31 09:06:35 -05:00
codemann8
bbc7197933 Adding print statements to help with Credits Debugging 2022-07-29 16:10:36 -05:00
codemann8
8aeeb5efa3 Changed to spawn sprites in chests to nearest 8 pixel boundary 2022-07-29 13:13:03 -05:00
aerinon
53f89790a7 Fix for floodgates in vanilla mode 2022-07-29 12:08:36 -06:00
codemann8
9cca3adb8e Reserving space for the excluded Murahduhla tree sprite in Bonk Drop shuffle 2022-07-28 19:23:43 -05:00
codemann8
324014bb54 Added struct for OW Bonk Prize data table 2022-07-28 18:53:01 -05:00
codemann8
6f58eb7c2c Update OW Event Data documentation for newly occupied Bonk Drop Shuffle bitflag slots 2022-07-28 16:54:02 -05:00
codemann8
5d65ae09da Fixed SP floodgate issue 2022-07-28 16:53:17 -05:00
codemann8
da85032de2 Fixed disappearing mirror portal in Inverted+CrossedOWR 2022-07-28 16:03:53 -05:00
codemann8
959f5ce5ab Fixed all goals requiring Aga2 to look at the Aga2 boss flag instead of pyramid hole 2022-07-27 17:53:15 -05:00
codemann8
b107297705 Moving some of the bonk sprite offsets up so the item is collectable without boots 2022-07-26 18:43:06 -05:00
codemann8
cce3594532 Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 18:30:04 -05:00
codemann8
b25c477958 Bonk Trees will revert color after collection 2022-07-26 18:13:20 -05:00
codemann8
1be10e5e12 Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 17:51:15 -05:00
codemann8
2cee6ea4ee Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 17:34:59 -05:00
codemann8
fff99a2f6b Fixed issue with bonk prize on screen 2B 2022-07-24 14:56:03 -05:00
codemann8
1716b4583c Fixed wrong loot ID reference 2022-07-24 13:55:39 -05:00
codemann8
5e6038b464 Shift AddReceivedItemExpanded data section down, sorry Fish 2022-07-24 13:44:11 -05:00
codemann8
8ccf8ecd66 Adding alternate tree colors for Bonk Drops 2022-07-24 11:30:46 -05:00
codemann8
ed72830397 Implemented Bonk Drop Shuffle 2022-07-24 11:29:28 -05:00
codemann8
6696f4bc24 Add new items from Bonk/Pot pool 2022-07-24 11:23:48 -05:00
codemann8
ac934dde3b Formatting improvements 2022-07-19 14:08:22 -05:00
codemann8
c64d0266d5 Move owrando hook out of DR and into main rando 2022-07-18 07:10:49 -05:00
codemann8
7ae2102a16 Revert "Merged DR v1.0.1.0"
This reverts commit 7ddca582e5.
2022-07-08 10:25:00 -05:00
codemann8
7ddca582e5 Merged DR v1.0.1.0 2022-07-08 10:15:00 -05:00
codemann8
7c7664224e Merged DR v1.0.1.0 2022-07-08 05:32:08 -05:00
aerinon
17d1b12890 Merge branch 'master' into DRVolatile
# Conflicts:
#	compasses.asm
2022-07-06 10:03:01 -06:00
aerinon
4e6acaf7b9 Big key door double-sided check 2022-07-06 09:48:42 -06:00
aerinon
7f8e560b76 Merge branch 'DRVolatile' into StandardThrone 2022-07-01 15:15:22 -06:00
aerinon
3b5ccc7dfa Enemizer fix for pot substitution. 2022-06-30 11:52:02 -06:00
aerinon
3e6da34c71 Pot substitution for certain ammo and rupee items. 2022-06-29 11:32:51 -06:00
aerinon
92c155f5c0 Re-implemented mirror scroll during escape behavior to not affect entrance and include the throne spawn point 2022-06-16 12:32:31 -06:00
aerinon
ae1fde65f4 Fix for followers despawning near maiden cell 2022-06-16 06:45:11 -06:00
aerinon
a36068fb04 Fix for Zelda despawning near maiden cell 2022-06-15 23:49:20 -06:00
aerinon
6f1eda9296 Fix for pottery/shopsanity conflict 2022-06-15 16:53:49 -06:00
aerinon
2579038832 Mirror scroll spawns in Zelda's cell instead of last entrance (mirror remains unchanged)
Tapestry is open when spawning in the throne room.
2022-06-14 12:36:04 -06:00
Catobat
87cac1a113 Shuffle Back of Tavern 2022-06-13 20:37:59 +02:00
Lexi Rose
04906b5f87 Merge pull request #164 from aerinon/DungeonsCompletedReverse
Dungeons completed reverse
2022-06-11 10:32:21 -05:00
Lexi Rose
2297a8f0a2 Merge pull request #163 from cassidoxa/cavestate_dungeonitems
Add data after dungeon item masks to maintain expected glitch behavior
2022-06-11 10:31:14 -05:00
cassidoxa
da8ce3c6b1 Fix OW event data bit labels 2022-05-30 19:33:27 -04:00
aerinon
1ccc24f72f Fix dungeon completion bitfield (16-bit) 2022-05-26 09:14:08 -06:00
aerinon
bea2d24d4d Fix dungeon completion bitfield 2022-05-26 09:14:05 -06:00
codemann8
2298148206 Added new DPad invert options for just L/R and just U/D 2022-05-25 14:52:50 -05:00
cassidoxa
e1258eba06 Add data after dungeon item masks to maintain expected glitch behavior 2022-05-22 15:13:01 -04:00
codemann8
f86780913f Fixed issue with mirror portals showing up in DW in Crossed OW 2022-05-21 20:53:00 -05:00
codemann8
9b846498a2 Moved some mirror code out to new function 2022-05-21 20:51:54 -05:00
codemann8
9b48477418 Adding explicit notation to ASM commands for asar 2022-05-21 20:48:44 -05:00
codemann8
5842cecf0d Replacing hardcoded jumps and references to labels 2022-05-21 20:47:01 -05:00
codemann8
74f66abf51 Replacing hardcoded jumps and references to labels 2022-05-21 20:44:38 -05:00
codemann8
c157708769 For moving mirror portals in Crossed OW, changing EOR to ORA 2022-05-21 17:46:29 -05:00
codemann8
478d4fc7f3 Fix issue with mirror portals showing up on map checks when they shouldn't 2022-05-21 14:55:42 -05:00
codemann8
57bc6a1f59 Fixed crash in Crossed OW when performing mirror superbunny 2022-05-21 11:04:15 -05:00
Lexi Rose
6ff400776a Merge pull request #162 from cassidoxa/compasses
Fix checking compass mode for compass count display bitfield
2022-05-19 23:59:16 -05:00
cassidoxa
cc1d97466c Fix compass count stuff 2022-05-19 13:23:55 -04:00
aerinon
9779f91ce9 Fix dungeon completion bitfield (16-bit) 2022-05-19 10:36:20 -06:00
aerinon
003278f7e0 Fix dungeon completion bitfield 2022-05-18 14:52:47 -06:00
aerinon
15cc72c1e0 Correct the width on the AND for MaybeFlagCompassTotalPickup 2022-05-18 14:52:34 -06:00
cassidoxa
b095a0c337 Mask out high bits of CompassMode when maybe setting compass counts
displayed flag
2022-05-17 17:23:15 -04:00
aerinon
db2fe4cf39 Fix compass compare 2022-05-17 13:05:34 -06:00
aerinon
ed3ce6af6f Merge pull request #20 from cassidoxa/compasses_dr
Fix checking compass mode for compass count display bitfield
2022-05-17 13:03:06 -06:00
codemann8
04948c72f6 Adding Catobat to OWR credits 2022-05-17 08:04:37 -05:00
cassidoxa
336931fb02 Fix checking compass mode for compass count display bitfield 2022-05-15 18:54:52 -04:00
codemann8
a62fcff30a Add lowercase letters to credits end screen 2022-05-05 23:24:32 -05:00
codemann8
31e98903bc Unscramble lowercase letters for new font 2022-05-05 18:26:11 -05:00
codemann8
34f4b72524 Adding labels and rearrange some of the Special Transition code 2022-05-04 16:31:32 -05:00
codemann8
e1a17fa945 Merge pull request #6 from Catobat/Special
Randomize Special Transitions
2022-05-04 15:58:45 -05:00
aerinon
4cdd41dbf5 Fix for standing item, all enemy drops and pot item converted to new system 2022-05-03 13:51:11 -06:00
Catobat
c62b69d1a8 Randomize Special Transitions 2022-05-01 01:25:21 +02:00
aerinon
5863f9783f Minor fix up on CrystalPendantFlags_3 2022-04-30 15:20:53 -06:00
aerinon
445a91c2aa Merge pull request #19 from cassidoxa/keyfix
Fix key door indexing
2022-04-30 15:17:59 -06:00
cassidoxa
e804455743 Fix key door indexing 2022-04-30 13:35:20 -04:00
Lexi Rose
6d39ea5872 Merge pull request #161 from aerinon/FontFix
Add lowercase letters to credits end screen
2022-04-29 10:17:45 -05:00
aerinon
675d68175c Delete test file 2022-04-28 16:39:06 -06:00
aerinon
55970bdff9 Delete test file 2022-04-28 16:38:50 -06:00
aerinon
326b8f294e Shifted uppercase font.
Used FEATURE_NEW_TEXT flag
2022-04-28 16:09:12 -06:00
aerinon
3685d8194e SRAM fix for MultiClient. Only set SRAM flag on locations that count toward collection rate.
Shifted uppercase font.
2022-04-28 16:06:31 -06:00
aerinon
6def39ff58 Add lowercase letters to credits end screen 2022-04-27 14:16:24 -06:00
aerinon
71d26eb109 Lowercase font 2022-04-27 14:14:54 -06:00
aerinon
0960dcaac9 Merge branch 'master' into DRVolatile 2022-04-27 13:50:42 -06:00
aerinon
eb0bc2b7f6 Moved doorrando code. Fixed a multiclient issue with pot switches. 2022-04-27 13:47:12 -06:00
aerinon
f0b767885c Fix bug with .checkAga2 in overworld map with new SRAM constants 2022-04-26 12:16:07 -06:00
aerinon
e088a040f8 Merge branch 'dr_sram' of https://github.com/cassidoxa/z3randomizer into cassidoxa-dr_sram
# Conflicts:
#	hooks.asm
#	menu/overworldmap.asm
#	music.asm
2022-04-26 11:57:51 -06:00
aerinon
53f723a196 Letters/Crystal numbers 2022-04-21 15:42:32 -06:00
codemann8
a26b128b52 Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-04-21 13:11:31 -05:00
cassidoxa
352d1e8a22 Re-add accidentally deleted HUD stuff
Fix some processor flags
2022-04-20 20:33:40 -04:00
codemann8
405edc51b5 Merge pull request #5 from Catobat/MixedMap
Implement new overworld map draw routine for Mixed
2022-04-20 16:51:23 -05:00
Catobat
d1a874cd7f Implement new overworld map draw routine for Mixed 2022-04-20 23:38:20 +02:00
aerinon
4b68406be0 Merge branch 'DRUnstable' into DRVolatile 2022-04-20 13:56:31 -06:00
aerinon
a017c98c4e Map bug with prizes 2022-04-20 09:07:59 -06:00
aerinon
e8f06f2da6 Pottery fix for vanilla hera key 2022-04-20 08:52:01 -06:00
cassidoxa
9c41ffb55b Merge branch 'sram_rework' into dr_sram 2022-04-20 00:30:35 -04:00
codemann8
0a7b886978 Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-04-19 21:32:47 -05:00
aerinon
3114223a04 Can force the drawing algorithm to skip 2022-04-19 14:35:16 -06:00
aerinon
f6015a8569 New colorized pot and bitfields 2022-04-19 14:04:12 -06:00
Lexi Rose
5861f546ad Merge pull request #160 from ardnaxelarak/main
Unscramble lowercase letters for new font
2022-04-17 03:17:31 -05:00
638967ee9c unscramble lowercase letters for new font 2022-04-17 00:42:10 -07:00
codemann8
0a57153762 Changed OW map in attract mode to show LW map always 2022-04-15 10:48:33 -05:00
codemann8
436ecbb17d Merged DR v1.0.0.3 2022-04-15 10:34:10 -05:00
aerinon
d116249412 Merge branch 'DRUnstable' into DRVolatile 2022-04-13 13:32:31 -06:00
aerinon
4239e7204e Check Aga2's boss defeat flag instead of pyramid hole
New flag on compass mode to indicate maps should be used instead for showing the location
2022-04-13 13:30:15 -06:00
codemann8
ed03692bef Fix from Aerinon for map/compass dungeon locations on map check 2022-04-10 19:16:24 -05:00
codemann8
c7f9b5c3a0 Fixed map check for GT skull icon to check if Aga2 defeated rather than pyramid hole opened 2022-04-05 11:29:46 -05:00
Lexi Rose
c6adf11a0d Merge pull request #159 from cassidoxa/sram_rework
SRAM Re-work
2022-04-05 09:38:27 -05:00
Lexi Rose
a754a6f22b Merge pull request #158 from spannerisms/master
Failures
2022-04-05 09:37:57 -05:00
6400a563ea unscramble lowercase letters for new font 2022-04-02 10:07:39 -07:00
9c30e3cdf9 Merge commit '697a742e0937780d3e6d1193876c8096ef1e2200' into HEAD 2022-04-01 18:28:29 -07:00
aerinon
281beeeb58 Switch standing item gfx to a different slot
Rain state fix
2022-03-29 14:29:04 -06:00
codemann8
7dabea9f8b Update events.asm 2022-03-26 07:03:54 -05:00
codemann8
da788dadcd Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-03-26 07:00:13 -05:00
aerinon
93fe175cab Don't delete hammer when hammer dashing through pots and the sprite limit is reached
Hook for frozen enemies killed with hammer (if there's an item they won't automatically drop the freeze prize now)
2022-03-23 14:24:36 -06:00
codemann8
697a742e09 Minor fix to flute SFX for pre-activated flute 2022-03-18 23:21:45 -05:00
aerinon
c687157882 Fix the Y index for ShouldCountNormalPot 2022-03-08 08:53:23 -07:00
codemann8
eb30242920 Fixed mirror bonk issue incorrectly leaving a mirror portal behind 2022-03-07 20:12:32 -06:00
codemann8
bd8b79ae5c Fixed issue with mirror portal not spawning when entering OW from the DW in Crossed OWR 2022-03-07 19:03:52 -06:00
aerinon
60026bea50 Pottery refinements 2022-03-07 10:44:53 -07:00
aerinon
66657eb956 Missed a line 2022-03-04 17:56:07 -07:00
aerinon
a0ebf72d59 Lifting normal pots increases location count
Pot despawn protection
Hud updates
2022-03-04 15:24:22 -07:00
aerinon
c83185c1b2 Minor bug fix 2022-02-24 14:04:33 -07:00
codemann8
4958d43d71 Some additional changes to lowercase dungeon text 2022-02-24 06:05:23 -06:00
cassidoxa
5d943d9a6d Add dungeons completed bitfield from door rando 2022-02-23 12:42:21 -05:00
codemann8
cb48137fa7 Fixed issue with mirror portal deleting after mirror bonk in Crossed OW 2022-02-22 19:55:02 -06:00
cassidoxa
838d4e9bf8 Refactor dungeon locations checked incrementing
Fix BowTracking documentation
2022-02-18 17:45:33 -05:00
aerinon
2c8299bac3 Standing item key for hera basement cage 2022-02-15 12:13:29 -07:00
aerinon
fe66c67d07 Fixing up the hud to indicate Pendant/Crystal etc 2022-02-15 12:12:42 -07:00
7da5e6257a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2022-02-11 13:36:00 -08:00
aerinon
a80171ba9b Revert SRAM changes (not yet ready) 2022-02-10 08:37:05 -07:00
aerinon
57dec5651f Merge branch 'DRMain' into DRUnstable 2022-02-09 14:34:58 -07:00
aerinon
5bd4d36cd9 Fix for standing item palette 2022-02-09 14:17:42 -07:00
aerinon
e8b85e4815 Lowercase item text 2022-02-09 10:06:16 -07:00
aerinon
93fe72466d Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	hooks.asm
#	music.asm
2022-02-09 09:59:56 -07:00
aerinon
7db582d894 Moved SRAM to reserved locations 2022-02-09 09:02:17 -07:00
cassidoxa
905e897b52 Handle 16-bit GoalCounter and TotalItemCounter
Fix vanilla sword + shield item
Fix how progressive items handled
Clean up compasses.asm
2022-02-08 19:25:59 -05:00
codemann8
e01e8569d7 Fixed issue with TR Peg Puzzle Portal not working 2022-02-07 19:20:32 -06:00
cassidoxa
02932a2a9d Add comments to initsramtables.asm 2022-02-07 20:05:52 -05:00
codemann8
ea8f4dbc57 Fixed issue with TR Peg Puzzle Portal not working 2022-02-07 18:00:10 -06:00
codemann8
ece66e38df Added lowercase version of dungeon item text 2022-02-06 01:00:16 -06:00
codemann8
ba8a9aeb90 Merged in Upstream ER changes 2022-02-04 06:04:26 -06:00
cassidoxa
959aa40f58 Increment ROM version 2022-02-03 22:48:20 -05:00
cassidoxa
3c6c45ddb4 Fix some mangled labels 2022-02-03 22:01:34 -05:00
cassidoxa
dfc4284a70 Merge branch 'master' into sram_rework 2022-02-03 21:20:16 -05:00
cassidoxa
3e2362b7ca Implement initial SRAM table
Data in initialsramtable.asm gets copied to SRAM on save file init
Frontend will be responsible for setting this, requires frontend changes
Changed some label names to disambiguate WRAM and SRAM labels
Deleted open mode
2022-02-03 20:25:32 -05:00
codemann8
98949be9bc Changed GT/AT swap in Mixed OW to prioritize leaving AT vanilla unless GT is the only one in the starting world 2022-02-03 06:13:13 -06:00
codemann8
ddd86a96cf Minor code improvement 2022-02-02 20:00:49 -06:00
cassidoxa
c048589c02 Add static file name feature by special request
Move compass count ram init to compasses.asm
Rename WRAMEquipment and SRAMEquipment to EquipmentWRAM/SRAM
2022-02-02 16:51:50 -05:00
spannerisms
8f74ddab05 fix
forgot to account for the stack pointer being screwed up when we start using the stack again

might as well add in better VWF control and move hex to BG2 for more space
2022-01-27 01:24:28 -05:00
spannerisms
a247a0ae01 tinker tinker 2022-01-26 08:22:44 -05:00
spannerisms
7ca4fd6467 Merge branch 'master' of https://github.com/spannerisms/z3randomizer 2022-01-26 06:41:56 -05:00
spannerisms
32d619c9e7 BSOD 2022-01-26 06:41:34 -05:00
aerinon
725f6c110a Couple of fixes for Standing Items counts and generic keys in caves 2022-01-24 16:06:04 -07:00
8dfdd3ee87 Merge branch 'main' into overworld_kara 2022-01-24 14:07:50 -08:00
ede8760b5c Make non-seeded rng a rom flag instead of compile flag 2022-01-24 13:55:29 -08:00
2a15f39e65 Fix boomerang instakilling Armos Knights 2022-01-24 13:55:19 -08:00
aerinon
3c9b04f30a Fixed up the anti-soft lock in swamp
Combined flags and fixed a couple of bugs
2022-01-21 16:07:03 -07:00
cassidoxa
b91ac58b47 Merge branch 'master' into sram 2022-01-20 11:16:31 -05:00
cassidoxa
6c4acb1e5b Check new value in SRAM to determine if Aga 2 duck comes
Added pushpc/pullpc to sram.asm
2022-01-19 20:17:02 -05:00
codemann8
c7718e7a47 Fixed Hera boss music to correctly read boss defeated flag 2022-01-19 14:39:19 -06:00
codemann8
335744f7b6 Restored vanilla Ice Palace terrain for Inverted 2022-01-19 03:18:31 -06:00
codemann8
7633c8b586 Fixed Hera boss music to correctly read boss defeated flag 2022-01-19 02:31:38 -06:00
codemann8
1677b95744 Restoring vanilla terrain for glitched Inverted modes 2022-01-19 01:42:16 -06:00
codemann8
14748b7788 Fixed world flag on Mountain Cave start 2022-01-19 01:39:24 -06:00
codemann8
bfbc7f16b1 Fixed issue with spawning on Pyramid/HC Ledge with old man 2022-01-19 00:23:24 -06:00
codemann8
c79863aad2 Fixed issue with Inverted Mirror Bonks not getting applied appropriately 2022-01-18 03:14:09 -06:00
codemann8
b72f89ff87 Made flute SFX louder for preactivated flute item get 2022-01-15 20:56:16 -06:00
codemann8
51d7f663c3 Restored vanilla ladder to Dark Graveyard in Inverted 2022-01-15 13:28:45 -06:00
codemann8
49b0cf0669 Inverted TR Peg screen terrain changes 2022-01-15 12:40:51 -06:00
codemann8
cbc4bbd6f3 Removed ladder from DDM 2022-01-15 12:22:01 -06:00
codemann8
3e9f598fe1 Added flute SFX to itemget if collecting a pre-activated flute 2022-01-15 04:07:27 -06:00
codemann8
f2a03f0bda Reorganized and reserved new starting data section 2022-01-14 12:59:14 -06:00
codemann8
fdea61fbf3 Added Starting OW Flag Table 2022-01-13 22:09:01 -06:00
codemann8
b5e313d709 Added Starting OW Flag Table 2022-01-13 21:56:03 -06:00
codemann8
5589127f81 ER Fix by cassidy 2022-01-13 21:54:56 -06:00
aerinon
50dd0c7be4 Fixing bugs with pottery lottery 2022-01-13 15:03:20 -07:00
cassidoxa
cad5a43d4b Change bitfield letters to match JP disassembly
Add sprite item pot data block
2022-01-12 21:52:47 -05:00
aerinon
149f19df83 Merge branch 'DRVolatile' into Potsanity 2022-01-06 16:08:02 -07:00
aerinon
8698c3e109 Merge branch 'DRMain' into DRVolatile 2022-01-06 16:04:08 -07:00
codemann8
d71e873d72 Extended Spiral/Mimic Ledge in Inverted 2022-01-06 12:45:27 -06:00
codemann8
c5ff897be6 Inverted TR Peg screen terrain changes 2022-01-06 11:39:21 -06:00
codemann8
b20f9ddd67 Merged DR v0.5.1.7 2022-01-06 02:13:05 -06:00
codemann8
67b96b3051 Extended Spiral/Mimic Ledge in Inverted 2022-01-06 01:52:58 -06:00
aerinon
7bf2a259a4 Merge remote-tracking branch 'origin/DRMain' into DRMain 2022-01-05 14:32:48 -07:00
aerinon
83ce4bf566 Merge pull request #17 from codemann8/MSUMuteFix
Preserve original Sanc/HC music track change if Zelda isn't delivered yet
2022-01-05 14:32:37 -07:00
aerinon
fc5e6191eb Merge remote-tracking branch 'origin/DRMain' into DRMain 2022-01-05 14:29:03 -07:00
aerinon
52c40ba0ca Merge pull request #16 from Catobat/DRFix
General fixes
2022-01-05 14:28:36 -07:00
aerinon
c88a301708 Merge branch 'master' into DRMain
# Conflicts:
#	tables.asm
2022-01-05 14:26:48 -07:00
aerinon
e5d3ebf3cd Minor potsanity refinements 2022-01-04 15:49:00 -07:00
Thomas Prescott
c416bfa917 update credits 2022-01-03 12:29:04 -08:00
b2043ef15e Adjust credits to match layout of base randomizer fork 2022-01-03 12:26:15 -08:00
74c55cf048 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2022-01-01 15:30:19 -08:00
spannerisms
e78c41ef38 match expected usage 2021-12-29 18:58:15 -08:00
6db6733d80 Add permanent ice physics bit 2021-12-29 18:51:42 -08:00
cassidy
6f58b9f959 Merge branch 'master' into sram 2021-12-28 00:30:13 -05:00
8ffef89fb8 Fix bee damage 2021-12-27 14:04:20 -08:00
8c6d2ac26d Fix moldorm/somaria issue and add both-canes mode 2021-12-23 22:13:30 -08:00
0f26e5aaa5 Fix width of special cane freestanding sprites 2021-12-23 22:13:30 -08:00
8a25dc9d52 Prevent hitting stunned ganon in cane-mode with default vulnerability 2021-12-23 22:13:30 -08:00
d2ad452170 Fix mothula/ganon breaking things (hopefully) 2021-12-23 22:13:30 -08:00
b1e3a7999c Remove bomb damage in cane modes 2021-12-23 22:13:30 -08:00
53792aea25 Add cane-only modes 2021-12-23 22:13:26 -08:00
codemann8
d75325e1c5 Move mirror portal off screen during mirror bonk in Crossed OW 2021-12-22 10:51:26 -06:00
codemann8
0a4c624f2f Move mirror portal off screen during mirror bonk in Crossed OW 2021-12-22 10:49:12 -06:00
cassidy
e8623768af Merge branch 'sram' of https://github.com/cassidoxa/z3randomizer into sram 2021-12-17 13:56:15 -05:00
cassidy
ed225e044b Cleanup in sram.asm and compasses.asm 2021-12-17 13:53:53 -05:00
aerinon
7cf57a7a37 Merge branch 'DRVolatile' into Potsanity 2021-12-16 16:03:23 -07:00
aerinon
6821648443 potsanity advancement 2021-12-16 16:03:10 -07:00
cassidy
c09839eb33 Fix sword and shield item downgrade 2021-12-16 17:19:55 -05:00
cassidy
be2d59eec8 Fix compass items collected counts on HUD 2021-12-16 17:19:55 -05:00
cassidy
c4c9065a79 Fix ROM version location
Remove comments, general cleanup
2021-12-16 17:19:55 -05:00
cassidy
c8ea2c6dce Move compass counts to ROM and trackable RAM
Add flag if compass HUD count has been displayed in SRAM
Move low hearts fix from tables.asm to bugfixes.asm
Rearrange dungeon stats in SRAM to match door rando ROM
2021-12-16 17:19:55 -05:00
cassidy
6c9b33ed93 Write macro for SRAM assertions
Change some label names to be clearer
Fix some of the progress flags and dungeon bitfields
2021-12-16 17:19:55 -05:00
cassidy
15d88b19a3 Fix dungeon key and locations checked tables, reserve unused indices
Swap locations checked with absorbed keys to match door rando
2021-12-16 17:19:55 -05:00
cassidy
e2bb55c1ba Fix asserts 2021-12-16 17:19:55 -05:00
cassidy
9e2382cbb2 Add absorbed keys
Adjust service request stuff
Change chest keys to "collected" keys
2021-12-16 17:19:55 -05:00
cassidy
ae0b57635c Remove defines from LTTP_RND_GeneralBugfixes
Replace more labels
Add ROM version and reserve extra 16 bytes in unused hardware vector in
LTTP_RND_GeneralBugfixes
Move IncrementChestCounter to ChestPrep in newitems.asm
Remove IncrementChestCounter hook which was getting overwritten
More revisions to sram.asm
2021-12-16 17:19:55 -05:00
cassidy
06d0c6e9f9 Removed SRAM trace from tables.asm
Fixed comments related to OpenMode, left open as default
2021-12-16 17:19:54 -05:00
cassidy
7f03cf68e8 Replace labels in fileselect.asm
Full file name has also been moved to the beginning of the new save
space at $7F6000 in WRAM and $700500 in SRAM
2021-12-16 17:19:54 -05:00
cassidy
ae82caca45 Replace more labels
Removed mask from rupeelimit.asm as total item counter is now a 16-bit
value
Commented out CountBits in utilities.asm in previous commit as I've
allocated a counter byte in SRAM
2021-12-16 17:19:54 -05:00
cassidy
fa76b61df0 Change addresses to labels and remove SRAM trace calls 2021-12-16 17:19:54 -05:00
cassidy
774aeb5e73 Next draft of sram.asm. Save/SRAM changes to save, init, and password
Deleted previewdatacopy.asm which was for SRAM Trace which we no longer
support. Password moved to $703000. 32-bits at $FFE0 in ROM (unused
hardware vector) now burned into $702015 in SRAM with ROM name.
2021-12-16 17:19:54 -05:00
cassidy
640e94153d Refactor inventory code and add more labels
Refactored highest sword, shield, and mail counting
Refactored how heart pieces, heart containers, and crystals are counted
Moved quickswap lock bit to high byte of InventoryTracking
Fixed sword and shield item downgrade
Added PreFluteLocations counter
2021-12-16 17:19:54 -05:00
cassidy
e4d917c47c First pass-through adding labels
Added items, equipment, and tracking/indicators
Added playername changes
Removed some defines
2021-12-16 17:19:54 -05:00
cassidy
d47dea6123 Initial SRAM module check in
Changes to save.asm and fileselect.asm to account for new WRAM buffer at
$7F6000 saved at $700500, length $1000.
Moves and additions noted at bottom of sram.asm, to be removed later.
2021-12-16 17:19:53 -05:00
cassidy
7b263917ff Fix sword and shield item downgrade 2021-12-15 19:58:53 -05:00
cassidy
faaf89f584 Fix compass items collected counts on HUD 2021-12-15 19:26:32 -05:00
cassidy
b994668676 Fix ROM version location
Remove comments, general cleanup
2021-12-15 18:06:55 -05:00
cassidy
7cc5f802f9 Move compass counts to ROM and trackable RAM
Add flag if compass HUD count has been displayed in SRAM
Move low hearts fix from tables.asm to bugfixes.asm
Rearrange dungeon stats in SRAM to match door rando ROM
2021-12-14 22:52:20 -05:00
cassidy
b943f86c15 Write macro for SRAM assertions
Change some label names to be clearer
Fix some of the progress flags and dungeon bitfields
2021-12-14 12:59:05 -05:00
codemann8
9c3d85e360 Improvement to FF damage fix to insta-warp Link to destination once Link has exceeded the bounds of the current screen 2021-12-13 23:16:29 -06:00
cassidy
7edaedf3f8 Fix dungeon key and locations checked tables, reserve unused indices
Swap locations checked with absorbed keys to match door rando
2021-12-07 20:51:41 -05:00
cassidy
046a98fdaf Fix asserts 2021-12-07 20:51:41 -05:00
cassidy
7c6c5f4316 Add absorbed keys
Adjust service request stuff
Change chest keys to "collected" keys
2021-12-07 20:51:41 -05:00
cassidy
190653d70f Remove defines from LTTP_RND_GeneralBugfixes
Replace more labels
Add ROM version and reserve extra 16 bytes in unused hardware vector in
LTTP_RND_GeneralBugfixes
Move IncrementChestCounter to ChestPrep in newitems.asm
Remove IncrementChestCounter hook which was getting overwritten
More revisions to sram.asm
2021-12-07 20:51:06 -05:00
cassidy
1b9734d1af Removed SRAM trace from tables.asm
Fixed comments related to OpenMode, left open as default
2021-12-07 20:49:58 -05:00
cassidy
db8df2a12b Replace labels in fileselect.asm
Full file name has also been moved to the beginning of the new save
space at $7F6000 in WRAM and $700500 in SRAM
2021-12-07 20:49:58 -05:00
cassidy
c1e4ca0053 Replace more labels
Removed mask from rupeelimit.asm as total item counter is now a 16-bit
value
Commented out CountBits in utilities.asm in previous commit as I've
allocated a counter byte in SRAM
2021-12-07 20:49:58 -05:00
cassidy
c29de40484 Change addresses to labels and remove SRAM trace calls 2021-12-07 20:49:58 -05:00
cassidy
d5c4834b1d Next draft of sram.asm. Save/SRAM changes to save, init, and password
Deleted previewdatacopy.asm which was for SRAM Trace which we no longer
support. Password moved to $703000. 32-bits at $FFE0 in ROM (unused
hardware vector) now burned into $702015 in SRAM with ROM name.
2021-12-07 20:49:58 -05:00
cassidy
2e97329250 Refactor inventory code and add more labels
Refactored highest sword, shield, and mail counting
Refactored how heart pieces, heart containers, and crystals are counted
Moved quickswap lock bit to high byte of InventoryTracking
Fixed sword and shield item downgrade
Added PreFluteLocations counter
2021-12-07 20:49:58 -05:00
cassidy
14b899d47a First pass-through adding labels
Added items, equipment, and tracking/indicators
Added playername changes
Removed some defines
2021-12-07 20:49:58 -05:00
cassidy
fcd9b949e8 Initial SRAM module check in
Changes to save.asm and fileselect.asm to account for new WRAM buffer at
$7F6000 saved at $700500, length $1000.
Moves and additions noted at bottom of sram.asm, to be removed later.
2021-12-07 20:49:57 -05:00
codemann8
c3df5f6cb1 Fixed mirror portals showing in DW 2021-12-06 07:43:04 -06:00
0ab9095222 Merge branch 'OWMain' into overworld_kara 2021-11-29 00:04:13 -08:00
codemann8
a1fff4ff76 Fix mirror portals getting erased when changing worlds 2021-11-24 15:58:39 -06:00
codemann8
10ad8ab834 Fix mirror portals getting erased when changing worlds 2021-11-22 09:07:38 -06:00
codemann8
3262c6ff1a Fix mirror portals getting erased when changing worlds 2021-11-20 00:34:57 -06:00
codemann8
9094d118df Fixed Inverted Double-Swap issue 2021-11-14 17:08:06 -06:00
e96d802ed1 Shorten duration of boomerang stun 2021-11-10 00:08:35 -08:00
b515b59a38 Make boomerang in bomb-only mode stun enemies it would normally damage 2021-11-08 16:38:03 -08:00
69a669e16e Merge branch 'OWMain' into overworld_kara 2021-11-08 00:09:02 -08:00
4896985493 Fix bomb icons on file select/endgame screens 2021-11-07 23:58:40 -08:00
2fd459d8ca Show bomb level on file select screen in bomb-only mode 2021-11-07 19:32:27 -08:00
918eefc3bd Minor fixes 2021-11-07 19:31:53 -08:00
codemann8
7d80b8087a Allow normal Link speed with Old Man if not in his cave or on WDM 2021-11-07 16:24:45 -06:00
2b241b2340 Unify handling of bomb colors in bomb-only mode 2021-11-07 12:47:13 -08:00
codemann8
2c6db075a9 Fixed boss music 2021-11-06 16:19:48 -05:00
codemann8
ad5b78b3d1 Preserve Sanc music change in Standard 2021-11-06 16:18:09 -05:00
codemann8
e8d5a9635d Play Sanc music on arrival in Sanc in Standard 2021-11-06 16:17:37 -05:00
codemann8
15a381769c Merge branch 'DRMain' into OWMain 2021-11-02 17:20:03 -05:00
codemann8
582abf3d32 Fixed boss music 2021-11-02 17:17:37 -05:00
aerinon
f19b65b86c Merge branch 'DRMain' into DRVolatile 2021-11-02 15:29:20 -06:00
aerinon
6757e35dca Straight Stair fixes 2021-11-02 15:24:21 -06:00
codemann8
ff6a553a0d Fake flipper autokill reversal 2021-11-01 10:59:37 -05:00
codemann8
dd57b4be79 Preserve Sanc music change in Standard 2021-11-01 02:09:05 -05:00
codemann8
4bcc76e83b Play Sanc music on arrival in Sanc in Standard 2021-10-31 20:56:27 -05:00
Catobat
1e6d79badc Fix bug with straight stairs and vanilla doors 2021-10-31 23:16:47 +01:00
Catobat
3f34e50a62 Improve transition animation from straight stairs 2021-10-31 21:17:18 +01:00
Catobat
a1fafb72cd Keep dungeon tileset after opening the map 2021-10-31 21:16:09 +01:00
0c6ba20470 Merge branch 'main' into overworld_kara 2021-10-30 16:38:09 -07:00
82c5190f63 Merge branch 'OWMain' into overworld_kara 2021-10-30 11:55:08 -07:00
aeec3fe6c6 Allow early detonation of bombs and add build flag to remove static RNG 2021-10-30 09:11:36 -07:00
codemann8
2e9f4c5abb Fixed issue with whirlpools not changing world in Crossed OW 2021-10-28 21:40:51 -05:00
codemann8
86212c8d25 Adding cross-world behavior for Whirlpool Shuffle 2021-10-27 01:09:53 -05:00
codemann8
4e67ebd959 Make Smith deletion on S+Q dependent of a new flag 2021-10-22 00:21:22 -05:00
codemann8
7819e80051 Fixed portal to match grass in Inverted 2021-10-21 22:18:23 -05:00
codemann8
2215b16240 Merge branch 'DRMain' into OWMain 2021-10-21 21:26:38 -05:00
aerinon
85d799ba67 Merge branch 'DRMain' into DRVolatile 2021-10-21 16:35:09 -06:00
aerinon
620c672fe1 Turn off Terrorpin AI fix by default - can be a post-gen option 2021-10-21 16:18:51 -06:00
aerinon
f95bce282b Removed some comment cruft 2021-10-21 16:15:34 -06:00
aerinon
415e2cae41 Merge pull request #15 from spannerisms/master
Quadrant glitch fix
2021-10-21 16:09:45 -06:00
aerinon
9bf662642b Merge branch 'DRMain' into OverworldMapRefactor 2021-10-21 14:53:55 -06:00
aerinon
27654b9ac9 Merge remote-tracking branch 'baserom/master' into DRMain
# Conflicts:
#	hooks.asm
#	newhud.asm
#	utilities.asm
2021-10-21 14:15:54 -06:00
aerinon
aee5fe506a Standing items start 2021-10-21 14:11:57 -06:00
aerinon
c503e3eb61 Overworld Map Refactor 2021-10-21 14:05:59 -06:00
aerinon
319aba5e4d EG disarmament on mirror 2021-10-05 14:15:38 -06:00
825d4a1ead Merge branch 'overworld_kara' of github.com:ardnaxelarak/z3randomizer into overworld_kara 2021-10-02 21:19:06 -07:00
6d9cbc85b7 Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-10-02 20:46:14 -07:00
f6f6383913 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2021-09-21 14:10:23 -07:00
fb4068a3e1 Merge branch 'main' into overworld_kara 2021-09-21 11:55:33 -07:00
codemann8
a30e459dbb Merge branch 'DRMain' into OWMain 2021-09-17 10:54:00 -05:00
aerinon
cc502c7524 Removed stonewall pre-opens 2021-09-16 16:01:51 -06:00
aerinon
f9e3bec5cb Removed rails using a dynamic flag 2021-09-07 16:24:18 -06:00
codemann8
200c1ff334 Merge branch 'DRMain' into OWMain 2021-08-31 19:21:19 -05:00
aerinon
07a3a9ad03 Catobat map fix
Cutoff table updated
Mutliworld mem location added for item ids
2021-08-31 15:35:19 -06:00
42002ae839 Merge branch 'main' into overworld_kara 2021-08-26 08:44:15 -07:00
codemann8
53dd7ba820 Fix for TR Pegs issue when fluting direct to TR from a screen with hammerpegs 2021-08-26 00:53:02 -05:00
codemann8
5d6d509bd9 Update Crossed OW to only perform Link/Bunny state changes when world changes 2021-08-26 00:51:41 -05:00
codemann8
fe24f6f865 Play SFX on crossworld transition in Crossed OW 2021-08-25 02:21:56 -05:00
codemann8
9b48a88df6 Retain Link state on transition unless bunny in Crossed OW 2021-08-21 18:02:59 -05:00
codemann8
aed1506114 Fixed issue with waterwalking in Crossed 2021-08-21 15:16:21 -05:00
codemann8
11be05c65a Fix Bunny/Lonk issues in Crossed OW 2021-08-20 22:47:17 -05:00
codemann8
f7525866c7 Fixed Flute crash 2021-08-20 20:43:48 -05:00
codemann8
a8e119285e Actually fixed Mixed flag problems 2021-08-19 21:53:26 -05:00
codemann8
58bf92ba04 Moved OW flag checks to global variable 2021-08-19 20:01:48 -05:00
codemann8
94a987f23f Fixed missing OW flag check changes 2021-08-19 18:47:29 -05:00
codemann8
ad8c4e8e70 ROM changes to support Crossed OW changes 2021-08-16 22:52:04 -05:00
codemann8
1210264294 Changed LW2 track in MSU-1 to play after Aga1 kill instead of ped pull 2021-08-11 06:04:09 -05:00
codemann8
c399f8c77b Separated ambient SFX from music track selection
Fixes issue with ambient SFX stopping and starting
2021-08-11 05:53:27 -05:00
0816bb7cab Merge branch 'fix_ohko' into overworld_kara 2021-08-09 15:33:03 -07:00
a12b5a9188 Merge branch 'OWMain' into overworld_kara 2021-08-02 19:00:33 -07:00
f14fea3699 Merge branch 'main' into overworld_kara 2021-08-02 19:00:13 -07:00
codemann8
06a7b7bead Fixed SW MSU track to play regardless of world 2021-08-02 04:20:02 -05:00
codemann8
677ad64419 Rewrote music calculation 2021-08-01 23:41:24 -05:00
codemann8
634764d4fc Merge branch 'DRMain' into OWMain 2021-07-28 16:24:02 -05:00
07f0ee9962 Merge branch 'OWMain' into overworld_kara 2021-07-28 12:54:14 -07:00
aerinon
fa516b58d4 Merge pull request #14 from codemann8/MSUMuteFix
Fix for boss music not playing in non-DR modes
2021-07-27 08:53:08 -06:00
codemann8
9cecd30e89 Fix for boss music not playing in non-DR modes 2021-07-27 02:42:36 -05:00
codemann8
6e721fb069 Fix for boss music not playing in non-DR modes 2021-07-27 02:40:12 -05:00
7aac3970d1 Add pseudo-sword mode 2021-07-25 01:42:21 -07:00
b663bb982f Merge branch 'OWMain' into overworld_kara 2021-07-23 15:42:41 -07:00
73ac8d8c25 Merge branch 'main' into overworld_kara 2021-07-23 15:28:30 -07:00
codemann8
11099f53b0 Merging DRMain 2021-07-23 15:49:10 -05:00
aerinon
15337a1382 Collection Rate moved to arbline marco 2021-07-23 09:14:43 -07:00
aerinon
9861c76d23 Minor refactor to keep dr hooks in DR 2021-07-23 09:13:35 -07:00
aerinon
5b8c90e069 Merge pull request #12 from codemann8/MSUMuteFix
Some music fixes
2021-07-23 07:44:01 -07:00
aerinon
e038b0bb18 Merge pull request #13 from ardnaxelarak/DR_statCountersFix
Fix counters for damage taken and magic used
2021-07-23 07:42:18 -07:00
8e12033105 Fix counters for damage taken and magic used 2021-07-23 00:07:51 -07:00
6df8dca127 Fix Stalfos Knights in bomb-mode to have bombs instakill while collapsed 2021-07-20 20:34:08 -07:00
faf05fb9a9 Merge branch 'OWMain' into overworld_kara 2021-07-17 12:19:56 -07:00
6da1227578 Color bombs in the HUD according to bomb level in bomb-only mode 2021-07-17 12:11:25 -07:00
59affe8b93 Adjust things for replacing sword stats with bomb stats 2021-07-17 12:11:25 -07:00
codemann8
b06492d419 Merge branch 'DRMain' into OWMain 2021-07-16 01:15:39 -05:00
aerinon
bfbe3fbcc0 Addition to Cutoff room table 2021-07-15 10:33:47 -07:00
codemann8
0cd7986318 Merge branch 'DRMain' into OWMain 2021-07-14 00:06:51 -05:00
bdd665db24 move storage of BOMB_LEVEL to make it play nicely with starting equipment 2021-07-13 11:28:04 -07:00
aerinon
641ec0ffa0 Minor fix to credits
Default to AgaDoor to Std/Open state
2021-07-13 10:51:01 -07:00
aerinon
e35c437fe3 Merge pull request #10 from ardnaxelarak/DRMain
Fix junk graphics appearing during GAME OVER screen
2021-07-13 10:44:51 -07:00
codemann8
c01c6f337a Fixed boss music when boss room entered thru Straight Stairs in DR 2021-07-12 20:59:57 -05:00
codemann8
a05b148261 Fixed boss music when boss room entered thru Straight Stairs in DR 2021-07-12 20:59:47 -05:00
codemann8
30d8bdd813 Suppressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 19:23:13 -05:00
codemann8
dc2a468acb Suppressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 19:22:57 -05:00
codemann8
9209153643 Supressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 16:44:03 -05:00
codemann8
0bce51af4e Supressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 15:41:59 -05:00
e81905a517 Fix bomb downgrades and track bomb stats in bomb-mode 2021-07-12 02:35:24 -07:00
da14e440c7 Add L-1 bombs as separate from no bombs in bomb-only mode 2021-07-12 02:34:57 -07:00
8d92e39451 Fix extra space in credits 2021-07-12 02:13:08 -07:00
2c221dfa37 Allow bombing barrier and getting tablet checks with L2+ bombs 2021-07-10 23:47:27 -07:00
codemann8
ec04d05c37 Merge branch 'DRMain' into OWMain 2021-07-10 13:46:57 -05:00
a6a8cda041 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:32:48 -07:00
2be05eed33 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:30:48 -07:00
aerinon
1c9936d231 Merge pull request #9 from ardnaxelarak/DRMain
Fix drawing C/P indicator and Stat Tracking
2021-07-09 10:38:20 -07:00
0054be1e4b Fix some stat tracking
- move chest turn counter to not overlap locations before mirror
- correctly print from correct memory in credits for damage/magic counter
2021-07-08 19:47:37 -07:00
2c931527e9 Merge branch 'DRMain' into overworld_kara 2021-07-08 19:39:10 -07:00
02e66ba9e3 Fix drawing C/P indicator
- no longer show icon for sewer, HC, AT, or GT
- no longer show junk in map shuffle for dungeons without the map
2021-07-08 18:34:39 -07:00
codemann8
195fd74e0b Reverting Dark Bonk Rocks rain state sprite fix 2021-07-08 20:26:18 -05:00
codemann8
a474212475 Added Rain state guards for Dark Bonk Rocks 2021-07-08 14:08:34 -05:00
8b173ac27b Fix printing damage and magic to stat counters in credits 2021-07-08 01:57:12 -07:00
codemann8
6cd0d15abf Merge branch 'DRMain' into OWMain 2021-07-07 19:11:36 -05:00
aerinon
aee82fa319 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	events.asm
#	hooks.asm
#	stats.asm
#	stats/creditsnew.asm
#	stats/statConfig.asm
#	swordswap.asm
#	utilities.asm
2021-07-07 11:15:11 -07:00
d960103e86 Merge branch 'main' into overworld_kara 2021-07-07 09:15:29 -07:00
7022b8768a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-07-06 19:00:52 -07:00
codemann8
e5ec4f8393 Fixed Stumpy 2021-07-06 14:44:55 -05:00
codemann8
a87ae37eab Minor reformatting comments 2021-07-06 14:29:48 -05:00
codemann8
7f4d783870 Fixed Stumpy sprite loading 2021-07-06 14:29:10 -05:00
codemann8
17b7a23550 Fixed Frogsmith spawning as a bad sprite 2021-07-06 11:57:34 -05:00
d4e1337471 Add bombs-placed counter to stat screen 2021-07-05 17:56:56 -07:00
b8545ca055 Fix quake not blobbifying certain enemies 2021-07-05 16:15:26 -07:00
f4e7d412ed Fix hookshot and armos knights:
- hookshot now stuns enemies it would normally damage
- armos knights now take same damage from L-2 bombs as L-1/L-3
2021-07-04 18:34:10 -07:00
28b84484e0 NO BOMBOS DAMAGE 2021-07-04 15:40:57 -07:00
codemann8
6f7f9d2a39 Adding OW Rando credits 2021-07-04 11:38:24 -05:00
codemann8
f2f53e8999 Adding OW Rando credits 2021-07-04 11:29:21 -05:00
2fec3f7484 Merge commit 'f403ca10da9e009599a531be8cdcd20a61b4801c' of github.com:spannerisms/z3randomizer into overworld_kara 2021-07-01 23:05:48 -07:00
01abf889d7 Merge branch 'main' into overworld_kara 2021-07-01 23:02:23 -07:00
b8dc86d7c5 Allow Ganon to be vulnerable to arbitrary item 2021-06-29 16:43:01 -07:00
8b0f0464f8 Implement always-allowed medallions 2021-06-29 16:43:01 -07:00
b3d649a0fb Add bomb-only mode 2021-06-29 16:43:01 -07:00
codemann8
b9193d2fbf Added ability to cancel out of flute menu by pressing X 2021-06-27 19:02:19 -05:00
codemann8
8df468840f Added ability to cancel out of flute menu by pressing X 2021-06-27 14:49:28 -05:00
codemann8
7e615bc033 Fixed Aga portal mirror bonk issue 2021-06-25 13:02:40 -05:00
codemann8
3bb6f78491 Fixed VRAM issue 2021-06-24 14:47:40 -05:00
codemann8
7ba76d4a5c Partial revert of VRAM adjustment 2021-06-24 14:35:31 -05:00
codemann8
92c3448ac2 Merge branch 'DRMain' into OWMain 2021-06-23 10:58:18 -05:00
codemann8
04ffd3a00d Fixed horizontal VRAM loading glitch on megatiles 2021-06-23 08:41:43 -05:00
codemann8
5d06322bd3 Whoops 2021-06-23 05:33:43 -05:00
codemann8
17eb8073ab Initial Mixed/Crossed OW shuffle implementation 2021-06-23 03:05:13 -05:00
codemann8
b03283efd2 Various inverted map changes, including adding correct tiles to GT entrance 2021-06-22 23:09:22 -05:00
codemann8
da0b2c62e2 Added default music track to avoid game crash 2021-06-22 22:52:14 -05:00
aerinon
e9aec2ba86 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	hooks.asm
2021-06-22 13:12:07 -06:00
aerinon
717434bd88 Bank notes added 2021-06-22 13:05:40 -06:00
codemann8
6f0d52f70e Merge pull request #4 from m0zes/OWMain
Cherry Picked Bank fixes
2021-06-21 20:29:10 -05:00
qwertymodo
b0b65f2131 More robust bank fix
Shouldn't crash on crystal/pendant anymore
2021-06-21 20:25:05 -05:00
qwertymodo
18422922e2 Set DB/DP to 0 in frame hook
Possible fix for hole transition crashes
2021-06-21 20:24:53 -05:00
codemann8
5a7bcfe9f5 Renamed inverted map subroutines to be consistent with OWID 2021-06-19 04:06:34 -05:00
codemann8
a6dafc5fa6 Add HUD indicator if LW/DW in Mixed OW mode 2021-06-13 12:17:51 -05:00
codemann8
c1ecc4c891 Merge branch 'DRMain' into OWMain 2021-06-04 21:49:55 -05:00
aerinon
050ce5e20e Changes from DR 0.4.0.6 2021-06-04 17:02:23 -06:00
codemann8
4846bcbb58 Merge branch 'DRMain' into OWMain 2021-06-03 10:56:15 -05:00
codemann8
22f761a6c5 Added map terrain changes specific to OW Shuffle 2021-06-03 10:54:30 -05:00
codemann8
5cb8b68e8a Added convenient portals on WDM for OW Shuffle 2021-06-03 08:05:41 -05:00
codemann8
53d3fc3737 Added convenient portals on WDM for OW Shuffle 2021-06-03 07:36:59 -05:00
codemann8
6c616a20b2 Made world checks table-based rather than based on OW ID 2021-06-03 00:50:25 -05:00
codemann8
ff87b09d4b Minor reorganization of code/data placement 2021-05-30 06:44:34 -05:00
aerinon
429649bde8 Merge pull request #8 from codemann8/MSUMuteFix
Msu mute fix
2021-05-29 21:51:08 -06:00
codemann8
dd2110f91d Moved Inverted Pyramid Entrance to HC Ledge 2021-05-26 21:07:16 -05:00
codemann8
1f37695fe0 Merge branch 'DRMain' into OWMain 2021-05-24 17:52:01 -05:00
aerinon
c7a4d817c0 Changes from DR 2021-05-24 15:12:09 -06:00
aerinon
5672e2f090 Merge branch 'master' into DRMain 2021-05-24 14:52:26 -06:00
codemann8
60ab0fcae2 Merge branch 'MSUMuteFix' into OWMain 2021-05-19 04:32:10 -05:00
codemann8
9d64b5edd1 Whoops, lines got swapped 2021-05-19 04:31:55 -05:00
codemann8
2e91981a1e Merge branch 'MSUMuteFix' into OWMain 2021-05-19 04:30:05 -05:00
codemann8
6e86c5c9b8 Fixed GT/ToH MSU muting when playing Door Shuffle 2021-05-18 00:21:32 -05:00
codemann8
89881f3bee Merge remote-tracking branch 'upstream/DRMain' into OWMain 2021-05-16 04:51:57 -05:00
aerinon
e9a376d92a Bugfixes 2021-05-14 16:49:49 -06:00
aerinon
842bb043e6 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	catfish.asm
#	compasses.asm
#	darkworldspawn.asm
#	hooks.asm
#	inventory.asm
#	newitems.asm
#	shopkeeper.asm
#	stats.asm
#	tables.asm

Adn some updates from DR
2021-05-13 12:11:40 -06:00
codemann8
99a695c1a2 Removed unnecessary data 2021-05-02 20:28:55 -05:00
codemann8
fd3f27adb1 Minor formatting changes 2021-05-02 19:16:02 -05:00
codemann8
a0b731ffbd Moved VRAM adjustment back to original spot 2021-05-02 19:15:42 -05:00
codemann8
fd3aed6d60 Preserve Link's position if within incoming gap 2021-05-02 18:30:49 -05:00
codemann8
ff08965ce5 Minor efficiency improvements 2021-05-01 19:50:46 -05:00
codemann8
e1a763c29f Minor formatting/labeling 2021-04-29 01:18:10 -05:00
codemann8
42f77472c5 Merge pull request #3 from Catobat/OWFix3
Fix camera unlocking
2021-04-28 18:39:32 -05:00
codemann8
8be83d6f94 Merge pull request #2 from Catobat/OWFix2
Fix transitions for real
2021-04-28 18:37:44 -05:00
Catobat
0abda3e210 Fix camera unlocking 2021-04-27 22:41:32 +02:00
codemann8
e8cba03156 Updated gitignore 2021-04-26 23:15:59 -05:00
codemann8
340a3c1c9d Catobat fix for transition bugs 2021-04-26 18:06:01 -05:00
Catobat
2b65123802 Fix transitions for real 2021-04-26 21:52:06 +02:00
codemann8
7333bf7f92 Minor efficiency 2021-04-24 15:25:17 -05:00
codemann8
619185e1e0 Fixed vanilla/ID-0 transition bug 2021-04-24 15:09:13 -05:00
codemann8
cd4949ce65 Disabled setting LW/DW flag on trans 2021-04-24 15:08:39 -05:00
codemann8
e72193a6be Fixed incorrect data for special areas 2021-04-21 00:11:20 -05:00
codemann8
de637242fc Fixed bad transition data 2021-04-21 00:11:00 -05:00
codemann8
f294773832 Fixed issue with DW transitions causing hardlocking mapwrap crashes 2021-04-21 00:10:45 -05:00
codemann8
5062da19d4 Fixed visual issue with megatiles with VRAM 2021-04-21 00:09:43 -05:00
codemann8
b242f6ae9d Fixed DW hardlocks 2021-04-20 02:14:46 -05:00
codemann8
c43fb64878 Fixed incorrect transition data 2021-04-20 02:14:28 -05:00
codemann8
eb11bb455d Milestone update, all transitions work, megatiles have a visual issue 2021-04-18 13:57:57 -05:00
codemann8
9089a9eb40 Merge remote-tracking branch 'upstream/DRMain' into OWMain 2021-04-12 13:33:04 -05:00
codemann8
9a5448e1bb Fixed bad data 2021-04-12 12:13:27 -05:00
codemann8
174b17d9a2 Not quite accurate transitions, opposite coordinate incorrect still 2021-04-11 21:10:30 -05:00
codemann8
deccdfb630 Milestone successful transition to midpoint 2021-04-07 12:17:03 -05:00
aerinon
d015310e4d Blind boss checks for maiden sequence 2021-02-27 15:30:28 -07:00
aerinon
f6cc3607df Refactored Potion shop hooks to allow old behaviors 2021-02-22 14:48:10 -07:00
codemann8
fd13889f68 Merge remote-tracking branch 'upstream/DRMain' into DRMain 2021-02-18 22:45:56 -06:00
aerinon
8b622dd841 Multiclient flags
Multi Sprite Player set to skip progressive limits
2021-02-18 13:37:33 -07:00
aerinon
ddf56a9ed1 Merge branch 'DRMain2' into DRMain 2021-02-18 13:13:44 -07:00
codemann8
3dd2e7892d Initial OW Shuffle Hook 2021-02-18 09:57:54 -06:00
aerinon
4ae59ad1e6 Double count hera basement cage in keydropshuffle 2021-02-17 11:50:51 -07:00
aerinon
9d607b7caa Inverted fix - no longer a bunny in DW sanc
Standard fix - can't kill Aga1 before rescuing Zelda
Total locations to check set on file load, and displayed in HUD
2021-02-16 13:36:44 -07:00
aerinon
d15dc91db4 Fix for BallnChain guard when keydropshuffle is off 2021-02-13 20:48:51 -07:00
aerinon
9b33530dba Merge branch 'DRStairFix' into DRMain2 2021-02-13 20:45:24 -07:00
aerinon
c9d42587a4 Merge branch '16_bit_collection_rate' of https://github.com/CaitSith2/z3randomizer into InvCountMerge 2021-02-13 20:44:25 -07:00
aerinon
7fee6ce440 Merge branch '16_bit_collection_rate' of https://github.com/CaitSith2/z3randomizer into InventoryCountMerge 2021-02-12 20:45:59 -07:00
Catobat
f68a635e2b Minor fixes for in-room stairs 2021-02-12 23:00:24 +01:00
CaitSith2
a83608366c document full usage of 7EF420-7EF4FF in stats.asm 2021-02-12 07:48:09 -08:00
CaitSith2
d3af10649c Dungeon completion flags, that indicate for which dungeons the prize was collected from. 2021-02-12 07:45:32 -08:00
CaitSith2
244b622074 Move stats that were not compass related out of the former compass counters. 2021-02-12 07:27:21 -08:00
aerinon
2f5b555e0e Merge branch 'DRMain' into ShopBranch 2021-02-02 14:42:03 -07:00
aerinon
96d7a6a9ae Merge branch 'InventoryCount' into DRMain 2021-02-02 10:12:44 -07:00
aerinon
6fe4132564 Merge pull request #4 from Catobat/DRStairs
Shuffle in-room stairs
2021-02-01 16:29:51 -07:00
aerinon
a63aa6f5fe Shop fixes 2021-02-01 16:29:09 -07:00
aerinon
2a08959229 Shop counting items 2021-02-01 10:11:38 -07:00
Catobat
dab4d58f12 Shuffle in-room stairs 2021-01-30 00:07:50 +01:00
aerinon
b1d4ef3252 Merge branch 'InventoryCount' into ShopBranch 2021-01-29 15:13:14 -07:00
aerinon
05e7f8eb96 Ported over pepper's shop code 2021-01-29 13:55:13 -07:00
CaitSith2
356bfb3a05 Need more bits for end game stats 2021-01-18 12:23:18 -08:00
CaitSith2
7266706315 Make inventory count stats 16 bit. 2021-01-18 12:02:44 -08:00
aerinon
a9bddea1b4 Change how hera basement key is counted to not count Byrna 2020-12-09 14:28:12 -07:00
aerinon
b3fcd2192e Some DR changes (outdoor check for hub and keydrop correct KeyTable address)
Shop VRAM issue investigated but not solved
2020-12-08 10:57:37 -07:00
aerinon
443070fe2c Merge branch 'ChestKeyCounter' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	build.sh
#	darkworldspawn.asm
#	events.asm
#	itemdowngrade.asm
#	shopkeeper.asm
#	stats.asm
2020-11-30 09:34:18 -07:00
aerinon
264e9f337d Keysanity menu bug fix 2020-11-20 13:57:49 -07:00
aerinon
6c7f5e46a3 Support for GT Big Key Credit
Support for Rain state prevention without rails
2020-11-19 16:27:47 -07:00
aerinon
94561e01c2 Bugfixes for lobby stuff 2020-11-12 12:18:23 -07:00
aerinon
8d9775c3de Change Compass addresses 2020-11-09 16:07:34 -07:00
aerinon
4c4fa74f1a Invisible Bunny fix
Double count Hera Basement Cage fix
2020-11-09 13:59:00 -07:00
aerinon
5310569aa3 Minor fixes 2020-11-03 10:15:41 -07:00
aerinon
5c2df8b6a6 Scroll fix 2020-11-03 10:12:48 -07:00
aerinon
b5bcc13806 Merge remote-tracking branch 'origin/DRMain' into DRMain 2020-11-03 10:12:21 -07:00
aerinon
717913b8fb Compass Refactor 2020-11-03 10:12:08 -07:00
CaitSith2
fcebea97af Don't count chest keys if they are for another player. 2020-10-30 16:53:44 -07:00
CaitSith2
44485fc02a Use defined labels instead of hard-coding the addresses. 2020-10-30 16:42:50 -07:00
aerinon
0dba58c194 Support for Mirror Scroll
DR Hud Additions
2020-10-30 16:26:28 -06:00
aerinon
6fe8496fde Create README.md 2020-10-29 16:07:44 -06:00
aerinon
49dc0f4037 DR Code Init Commit
Rails for Mixed Travel
2020-10-29 15:58:05 -06:00
randall.rupper
233afa1e38 Chest Key counters 2020-09-18 11:06:02 -06:00
CaitSith2
94722d452e Fix glitch where you can bomb yourself at high stakes chest game to get on top of pyramid/castle.
Since this is not a vanilla glitch, it has to be fixed, as it wasn't intended.
2020-09-18 11:04:48 -06:00
CaitSith2
820b5d5357 Low stakes and high stakes chest game no longer increments item counter. 2020-09-18 11:04:22 -06:00
CaitSith2
a892ff39b2 Backport terrorpin ai fix from enemizer. (and fix a bug with it.) 2020-08-05 08:48:25 -07:00
Zarby89
dad73fc883 ganon room fix for multiworld 2020-07-29 21:46:01 -07:00
caitsith2
65bd0df346 Labels added for Door rando hook points. 2020-07-15 01:27:33 -07:00
caitsith2
ff3bdc1326 Check for door rando before doing safety checks to and possibly draining room 55 (the hammer locked room) 2020-07-14 21:07:21 -07:00
caitsith2
715ba87517 Reserve the space for berserkermulti.world seed guid. 2020-07-14 11:12:25 -07:00
compiling
5a10017747 Triforce Hunt + Kill Ganon goal. 2020-06-25 07:40:53 -07:00
caitsith2
6b6bce9b78 Print hook address helpers for doors 2020-06-24 07:07:38 -07:00
caitsith2
c78559ec0f Merge branch 'master' into multiworld 2020-06-23 17:24:24 -07:00
caitsith2
c4e21be268 Merge branch 'patch-1' into multiworld 2020-06-23 01:31:50 -07:00
caitsith2
594e4e56c0 Output addresses for doors compass_r_addr and compass_w_addr hooks. 2020-06-22 06:47:33 -07:00
caitsith2
9c8e531d20 Fix asar relative path warning. 2020-06-22 06:46:34 -07:00
caitsith2
7b3e200d22 Output warnings and prints on build. 2020-06-22 06:45:58 -07:00
compiling
3cae3a66a5 Fix fake world when fluting to pyramid twice 2020-06-20 19:43:45 -07:00
caitsith2
59f851395c Merge branch 'master' into multiworld 2020-06-20 18:35:48 -07:00
caitsith2
ffc190e3cf reinstate build.bat 2020-06-13 22:04:59 -07:00
caitsith2
ea477878fc Add __pycache__ to .gitignore, rename utils.py to build.py 2020-06-09 09:14:46 -07:00
caitsith2
47091dfd68 Patch and build base2current.json in one go.
Just need to provide a linux asar library when the time comes to build on linux.
2020-06-09 09:11:02 -07:00
randall.rupper
8cf3ccb13e Add PHX/PLX in a better spot to prevent CountBottles from overwritting X 2020-06-08 09:58:46 -07:00
caitsith2
b5c7846c40 Make it a tiny bit easier to build the baserom for inclusion in multiworld and get the updated hash while at it. 2020-06-08 09:30:49 -07:00
caitsith2
4530021fea Revert exetend msu flag as it is no longer needed. 2020-06-08 09:30:49 -07:00
caitsith2
1b3a586a57 Update multiworld to be compatible with save & quit delay fix. 2020-06-08 09:30:49 -07:00
caitsith2
65db6eefb7 update windows build process to asar 2020-06-08 09:29:31 -07:00
caitsith2
e8a384200f Only launch cmd /k if the batch file was doubleclicked. 2020-06-08 09:27:32 -07:00
caitsith2
0bdc88d13a Flag for adjuster to know if extended MSU is present in rom or not. 2020-06-08 09:26:58 -07:00
caitsith2
80bc9c2028 Move player names and max them out at 255. 2020-06-08 09:26:25 -07:00
Bonta-kun
2a5e305fc6 implement remote item checks 2020-06-08 09:25:25 -07:00
Bonta-kun
c3c5ba9d53 move clock.asm from bank A0 to A4 2020-06-08 09:24:56 -07:00
Bonta-kun
af4c84c1aa fix unusable infinite bombs with empty inventory 2020-06-08 09:24:36 -07:00
Bonta-kun
f843ef9eb8 bee trap 2020-06-08 09:24:07 -07:00
Bonta-kun
49ba8e064d Make sword upgrade appear as fighter sword for swordless players 2020-06-08 09:20:42 -07:00
Bonta-kun
94218b048b Dont replace multiworld items 2020-06-08 09:20:17 -07:00
Bonta-kun
6818c3e119 free some space in bank A0 2020-06-08 09:20:00 -07:00
Bonta-kun
ddd456c04e multiworld 2020-06-08 09:19:18 -07:00
125 changed files with 15618 additions and 5441 deletions

2
.gitignore vendored
View File

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

View File

@@ -9,7 +9,6 @@ lorom
;db #$23, $4E
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
;db #$35 ; set fast exhirom
db #$30 ; set fast lorom
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
@@ -29,7 +28,7 @@ db #$20, #$19, #$08, #$31 ; year/month/day
;================================================================================
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
!ROM_VERSION_HIGH ?= 1 ;
!ROM_VERSION_HIGH ?= 2 ;
org $00FFE0 ; Unused hardware vector
RomVersion:
@@ -43,39 +42,7 @@ dw !ROM_VERSION_HIGH
!BLT = "BCC"
!BGE = "BCS"
; Rando Specific SRAM assignments
!SHOP_PURCHASE_COUNTS = "$7EF302" ;$7EF302 - $7EF33F (temporary home)
!INVENTORY_SWAP = "$7EF38C"
!INVENTORY_SWAP_2 = "$7EF38E"
!WEAPON_LEVEL = "$7EF38F"
!ITEM_LIMIT_COUNTS = "$7EF390" ; $7EF390 - ????
!NPC_FLAGS = "$7EF410"
!NPC_FLAGS_2 = "$7EF411"
!MAP_OVERLAY = "$7EF414" ; [w]
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
!HUD_FLAG = "$7EF416" ; --h- ----
!FORCE_PYRAMID = "$7EF416" ; ---- p---
!IGNORE_FAIRIES = "$7EF416" ; ---- -i--
!SHAME_CHEST = "$7EF416" ; ---s ----
!HAS_GROVE_ITEM = "$7EF416" ; ---- ---g general flags, don't waste these
!HIGHEST_SWORD_LEVEL = "$7EF417" ; --- -sss
;$7EF41A[w] - Programmable Item #1
;$7EF41C[w] - Programmable Item #2
;$7EF41E[w] - Programmable Item #3
!SRAM_SINK = "$7EF41E" ; <- change this (conflicts with Programmable item 3)
;$7EF418 - Goal Item Counter
;$7EF419 - Service Sequence
;$7EF420 - $7EF46D - Stat Tracking Bank 1 (overlaps with RNG Item Flags)
;$7EF450 - $7EF45F - RNG Item (Single) Flags
;$7EF4A0 - $7EF4A7 - Service Request Block
!FRESH_FILE_MARKER = "$7EF4F0" ; zero if fresh file
;$700500 - $70050F - Extended File Name
;$701000 - $70100F - Password (incorporate into log header)
;$702000 - $702014 - Rom title copy (incorporate into log header)
!MS_GOT = "$7F5031"
!DARK_WORLD = "$7EF3CA"
!REDRAW = "$7F5000"
!GANON_WARP_CHAIN = "$7F5032";
@@ -111,11 +78,33 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<
;================================================================================
!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
incsrc hooks.asm
incsrc treekid.asm
incsrc spriteswap.asm
incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm
incsrc ram.asm
incsrc sram.asm
;org $208000 ; bank #$20
org $A08000 ; bank #$A0
@@ -129,7 +118,6 @@ incsrc heartpieces.asm
incsrc npcitems.asm
incsrc utilities.asm
incsrc flipperkill.asm
incsrc previewdatacopy.asm
incsrc pendantcrystalhud.asm
incsrc potions.asm
incsrc shopkeeper.asm
@@ -150,7 +138,6 @@ incsrc dungeondrops.asm
incsrc halfmagicbat.asm
incsrc mantle.asm
incsrc swordswap.asm
incsrc stats.asm
incsrc scratchpad.asm
incsrc map.asm
incsrc dialog.asm
@@ -159,12 +146,6 @@ 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
@@ -187,14 +168,24 @@ org $A1A000 ; static mapping area. Referenced by front end. Do not move.
incsrc invertedstatic.asm
warnpc $A1A100
org $A1B000
incsrc failure.asm
warnpc $A1FF00
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
incsrc openmode.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
@@ -209,12 +200,14 @@ 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 hudtext.asm
incsrc stats.asm
;incsrc hudtext.asm
incsrc servicerequest.asm
incsrc elder.asm
incsrc toast.asm
@@ -222,8 +215,8 @@ incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc multiworld.asm
incsrc terrorpin.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
@@ -232,12 +225,24 @@ warnpc $A58000
;org $228000 ; contrib area
org $A28000 ; contrib area
incsrc contrib.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc trolls.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
@@ -339,7 +344,16 @@ endif
org $328000
Extra_Text_Table:
incsrc itemtext.asm
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 externalhooks.asm
;================================================================================
@@ -363,7 +377,11 @@ 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
@@ -379,20 +397,21 @@ warnpc $B08000
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region
; See tables.asm for specific assignments
;$7F6000[0x500]: Free RAM (reclaimed from damage table) Not allocated yet
;$7F6500[0xB00]: SRAM mirror for last 0xB00 bytes of SRAM (extended sram)
;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
; See sram.asm for labels and assignments
;$7F7667[0x6719] - free ram
;================================================================================
;SRAM Map
;$70:0000 ( 4K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at 0x7EF000)
; See earlier in this file for rando specific assignments
; 0500-0FFF Ext Slot 1 (not yet mirrored)
; See earlier in this file for rando specific assignments
;$70:1000 (20K) Log entries
;$70:6000 ( 8K) Scratch buffers
;See sram.asm for rando-specific assignments
;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
;$70:2000 (0x25) ROM Name and version number
;$70:3000 (0x16) Password
;$70:6000 (8K) Scratch buffers
;================================================================================
;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music
;db #$A9, #$00, #$EA
@@ -472,6 +491,8 @@ org $00891D
org $00893D
EnableForceBlank:
DungeonMask = $0098C0
org $00D308
DecompSwordGfx:
@@ -513,9 +534,24 @@ Dungeon_SaveRoomData:
org $02A0BE
Dungeon_SaveRoomData_justKeys:
org $02A4E3
Overworld_ActualScreenID:
org $02B861
Dungeon_SaveRoomQuadrantData:
org $02C11D
CalculateTransitionLanding:
org $02C176
Overworld_FinalizeEntryOntoScreen_Data:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $02E99D
FluteMenu_LoadTransport:
org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank
LoadGearPalettes_bunny:
@@ -525,9 +561,18 @@ LoadGearPalettes_variable:
org $02FEAB
Filter_Majorly_Whiten_Color:
org $04E780
Overworld_MemorizeMap16Change:
org $04E879
Overworld_CheckForSpecialOverworldTrigger_Direction:
org $05A51D
Sprite_SpawnFallingItem:
org $05AFF1
Sprite_6C_MirrorPortal_dont_do_warp:
org $05DF6C ; 02DF6C - Bank05.asm : 2445
Sprite_DrawMultiple:
@@ -558,6 +603,9 @@ Utility_CheckIfHitBoxesOverlapLong:
org $06A7DB
Chicken_SpawnAvengerChicken: ; returns short
org $06AD58
Sprite_TransmuteToBomb:
org $06DC5C
Sprite_DrawShadowLong:
@@ -588,15 +636,27 @@ Player_HaltDashAttackLong:
org $07999D
Link_ReceiveItem:
org $079F82
Link_UseHammer:
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 $08CE93
Ancilla_BreakTowerSeal_draw_single_crystal:
@@ -612,6 +672,12 @@ Ancilla_SetOam_XY_Long:
org $0985E2 ; (break on $0985E4)
AddReceivedItem:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $098BAD
AddPendantOrCrystal:
@@ -627,12 +693,18 @@ 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:
@@ -642,6 +714,16 @@ OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
org $8AE817
DungeonMapBossRooms:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
InitializeSaveFile:
org $0CDBC0
InitializeSaveFile_build_checksum:
org $0DBA71
GetRandomInt:

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
# 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.

BIN
asar-x64.dll Normal file

Binary file not shown.

BIN
asar.dll Normal file

Binary file not shown.

421
asar.py Normal file
View File

@@ -0,0 +1,421 @@
#!/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()

1021
bonktreemaps.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -30,6 +31,7 @@ LoadBonkItemGFX:
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LoadBonkItemGFX_inner:
LDA.b #$00 : STA !REDRAW
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
JSL.l PrepDynamicTile
RTL
@@ -50,11 +52,12 @@ DrawBonkItemGFX:
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
CMP #$24 : BNE .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA $7EF36F : INC A : STA $7EF36F
LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem
RTL
@@ -69,9 +72,22 @@ LoadBonkItem:
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
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

@@ -4,16 +4,20 @@
!BOOTS_MODIFIER = "$7F50CE"
ModifyBoots:
PHA
LDA.b $A0 : CMP.b #$06 : BNE +
LDA.b $A1 : CMP.b #$00 : BEQ .no_boots
+
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE +
PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots
PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots
+ : CMP.b #$02 : BNE +
PLA : AND $7EF379 : AND.b #$FB : RTL ; no boots
.no_boots
PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA FakeBoots : CMP.b #$01 : BNE +
LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check
++ : PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots, not hovering
++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
AND $7EF379 ; regular boots
AND AbilityFlags ; regular boots
RTL
;--------------------------------------------------------------------------------
AddBonkTremors:
@@ -22,7 +26,7 @@ AddBonkTremors:
JSL.l IncrementBonkCounter
+
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots
LDA BootsEquipment : BNE + ; Check for Boots
PLA : RTL
+
PLA
@@ -33,7 +37,7 @@ BonkBreakableWall:
PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots
LDA BootsEquipment : BNE + ; Check for Boots
PLP : PLX : LDA.w #$0000 : RTL
+
PLP : PLX
@@ -42,7 +46,7 @@ RTL
;--------------------------------------------------------------------------------
BonkRockPile:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$00 : RTL
+
LDA $02EF : AND.b #$70 ; things we wrote over
@@ -50,7 +54,7 @@ RTL
;--------------------------------------------------------------------------------
GravestoneHook:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BEQ .done ; Check for Boots
LDA BootsEquipment : BEQ .done ; Check for Boots
+
LDA $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone
@@ -59,7 +63,7 @@ GravestoneHook:
;--------------------------------------------------------------------------------
JumpDownLedge:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots
LDA BootsEquipment : BNE + ; Check for Boots
; Disarm Waterwalk
LDA $5B : CMP.b #$01 : BNE +
STZ $5B
@@ -70,7 +74,7 @@ RTL
;--------------------------------------------------------------------------------
BonkRecoil:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA $29 : RTL
+
LDA.b #$24 : STA $29 ; things we wrote over

71
bsodencode.txt Normal file
View File

@@ -0,0 +1,71 @@
=00
A=01
a=01
B=02
b=02
C=03
c=03
D=04
d=04
E=05
e=05
F=06
f=06
G=07
g=07
H=08
h=08
I=09
i=09
J=0A
j=0A
K=0B
k=0B
L=0C
l=0C
M=0D
m=0D
N=0E
n=0E
O=0F
o=0F
P=10
p=10
Q=11
q=11
R=12
r=12
S=13
s=13
T=14
t=14
U=15
u=15
V=16
v=16
W=17
w=17
X=18
x=18
Y=19
y=19
Z=1A
z=1A
0=1B
1=1C
2=1D
3=1E
4=1F
5=20
6=21
7=22
8=23
9=24
.=25
#=26
?=27
-=28
/=29
,=2A
'=2B
;=2C

BIN
bsodfont.1bpp Normal file

Binary file not shown.

BIN
bsodhex.2bpp Normal file

Binary file not shown.

View File

@@ -2,8 +2,8 @@
;--------------------------------------------------------------------------------
AssignKiki:
LDA.b #$00 : STA $7EF3D3 ; defuse bomb
LDA.b #$0A : STA $7EF3CC ; assign kiki as follower
LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
RTL
;--------------------------------------------------------------------------------
@@ -13,7 +13,7 @@ RTL
;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091"
AllowSQ:
LDA $7EF3C5 : BEQ .done ; thing we overwrote - check if link is in his bed
LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01
.done
RTL
@@ -32,8 +32,8 @@ RTL
;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny
DecideIfBunny:
LDA $7EF357 : BNE .done
LDA $7EF3CA : AND.b #$40
LDA MoonPearlEquipment : BNE .done
LDA CurrentWorld : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -48,8 +48,8 @@ DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA $1B : BNE .done
LDA $7EF357 : BNE .done
LDA $8A : AND.b #$40 : PHA
LDA MoonPearlEquipment : BNE .done
PHX : LDX $8A : LDA.l OWTileWorldAssoc, X : PLX : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -63,7 +63,7 @@ RTL
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA $7EF340, X
; LDA EquipmentWRAM, X
;RTL
;--------------------------------------------------------------------------------
@@ -83,10 +83,10 @@ RTS
FixAga2Bunny:
LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
@@ -112,18 +112,18 @@ RTS
; fix issue where cross world caves (in Entrance randomizer) don't cause
; frog to become smith or vice versa.
FixFrogSmith:
LDA.l $7EF3CA : BNE .darkWorld
LDA.l $7EF3CC : CMP.b #$07 : BNE .done
LDA.l CurrentWorld : BNE .darkWorld
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done
LDA.b #$08 ; make frog into smith in light world
BRA .loadgfx
.darkWorld
LDA.l $7EF3CC : CMP.b #$08 : BNE .done
LDA.l FollowerIndicator : CMP.b #$08 : BNE .done
LDA.b #$07 ; make smith into frog in dark world
.loadgfx
STA.l $7EF3CC
STA.l FollowerIndicator
JSL Tagalong_LoadGfx
.done
RTS
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
@@ -158,8 +158,8 @@ WallmasterCameraFix:
; Fix losing glove colors
LoadActualGearPalettesWithGloves:
REP #$20
LDA $7EF359 : STA $0C
LDA $7EF35B : AND.w #$00FF
LDA SwordEquipment : STA $0C
LDA ArmorEquipment : AND.w #$00FF
JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
@@ -214,7 +214,12 @@ FixJingleGlitch:
.exit
RTL
;--------------------------------------------------------------------------------
; Fix spawning with more hearts than capacity when less than 3 heart containers
pushpc
org $09F4AC ; <- module_death.asm:331
db $08, $08, $10
pullpc
;--------------------------------------------------------------------------------
SetOverworldTransitionFlags:
LDA #$01

View File

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

115
build.py Normal file
View File

@@ -0,0 +1,115 @@
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()

View File

@@ -1,43 +1,37 @@
;================================================================================
; Capacity Logic
;================================================================================
!BOMB_UPGRADES = "$7EF370"
!BOMB_CURRENT = "$7EF343"
;--------------------------------------------------------------------------------
IncrementBombs:
LDA !BOMB_UPGRADES ; get bomb upgrades
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs
DEC
CMP !BOMB_CURRENT
CMP BombsEquipment
!BLT +
LDA !BOMB_CURRENT
LDA BombsEquipment
CMP.b #99 : !BGE +
INC : STA !BOMB_CURRENT
INC : STA BombsEquipment
+
RTL
;--------------------------------------------------------------------------------
!ARROW_UPGRADES = "$7EF371"
!ARROW_CURRENT = "$7EF377"
;--------------------------------------------------------------------------------
IncrementArrows:
LDA !ARROW_UPGRADES ; get arrow upgrades
LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP !ARROW_CURRENT
CMP CurrentArrows
!BLT +
LDA !ARROW_CURRENT
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA !ARROW_CURRENT
INC : STA CurrentArrows
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA !BOMB_UPGRADES ; get bomb upgrades
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP !BOMB_CURRENT
CMP BombsEquipment
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

View File

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

View File

@@ -1,18 +1,9 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space
;--------------------------------------------------------------------------------
; The number of items in a dungeon never changes. use this macro instead of
; HexToDec when drawing the "??/XX" item counter
; %DrawConstantNumber(1,4) draws 14
;--------------------------------------------------------------------------------
macro DrawConstantNumber(digit1,digit2)
LDA.w #$2490+<digit1> : STA $7EC79A
LDA.w #$2490+<digit2> : STA $7EC79C
SEP #$20
endmacro
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
SEP #$10
LDX $1B : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
@@ -20,22 +11,42 @@ DrawDungeonCompassCounts:
LDA.w $040C : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass
LDA $7EF364 : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass
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
++
JMP (CompassCountDungeonHandlers, X) : .return_spot
; we switch to 8-bit A in the jump before this
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 $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
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.w #$2830 : STA $7EC798 ; draw the slash
.done
@@ -44,103 +55,18 @@ 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
CompassCountDungeonHandlers: ; pointers to functions that handle dungeon-specific code
dw CompassCount_Escape, CompassCount_Escape ; (hyrule castle, sewers)
dw CompassCount_Eastern, CompassCount_Desert, CompassCount_Agah
dw CompassCount_Swamp, CompassCount_PoD, CompassCount_Mire
dw CompassCount_Skull, CompassCount_Ice, CompassCount_Hera
dw CompassCount_Thieves, CompassCount_Trock, CompassCount_Gt
}
CompassCount_Escape:
%DrawConstantNumber(0,8)
LDA $7EF434 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Eastern:
%DrawConstantNumber(0,6)
LDA $7EF436 : AND.b #$07
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Desert:
%DrawConstantNumber(0,6)
LDA $7EF435 : LSR #5
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Agah:
%DrawConstantNumber(0,2)
LDA $7EF435 : AND.b #$03
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Swamp:
%DrawConstantNumber(1,0)
LDA $7EF439 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_PoD:
%DrawConstantNumber(1,4)
LDA $7EF434 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Mire:
%DrawConstantNumber(0,8)
LDA $7EF438 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Skull:
%DrawConstantNumber(0,8)
LDA $7EF437 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Ice:
%DrawConstantNumber(0,8)
LDA $7EF438 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Hera:
%DrawConstantNumber(0,6)
LDA $7EF435 : AND.b #$1C : LSR #2
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Thieves:
%DrawConstantNumber(0,8)
LDA $7EF437 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Trock:
%DrawConstantNumber(1,2)
LDA $7EF439 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Gt:
%DrawConstantNumber(2,7)
LDA $7EF436 : LSR #3
JMP DrawDungeonCompassCounts_return_spot
; 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
;--------------------------------------------------------------------------------
; $7EF434 - hhhhdddd - item locations checked
; h - hyrule castle/sewers
; d - palace of darkness
; $7EF4C0-7EF4CF - item locations checked indexed by $040C >> 1
;--------------------------------------------------------------------------------
; $7EF435 - dddhhhaa - item locations checked
; d - desert palace
; h - tower of hera
; a - agahnim's tower
;--------------------------------------------------------------------------------
; $7EF436 - gggggeee - item locations checked
; g - ganon's tower
; e - eastern palace
;--------------------------------------------------------------------------------
; $7EF437 - sssstttt - item locations checked
; s - skull woods
; t - thieves town
;--------------------------------------------------------------------------------
; $7EF438 - iiiimmmm - item locations checked
; i - ice palace
; m - misery mire
;--------------------------------------------------------------------------------
; $7EF439 - ttttssss - item locations checked
; t - turtle rock
; s - swamp palace
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
-
LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
INX
CPX #$0F : !BLT -
RTL

View File

@@ -71,14 +71,13 @@
;
; PLX
;
; LDA.b #$00 : STA $7EF3CC
; LDA.b #$00 : STA FollowerIndicator
;
; STZ $5E
;
; JML $09A6B6 ; <- 4A6B6 tagalong.asm:1194 (SEP #$30 : RTS)
;}
;================================================================
!MAP_OVERLAY = "$7EF414" ; [2]
Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
{
STA $1CF0
@@ -108,11 +107,11 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
BRA .SayNothing
.SahasrahlaDialogs
REP #$20 : LDA.l MapReveal_Sahasrahla : ORA !MAP_OVERLAY : STA !MAP_OVERLAY : SEP #$20
REP #$20 : LDA.l MapReveal_Sahasrahla : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogSahasrahla : BRA .SayNothing
.BombShopGuyDialog
REP #$20 : LDA.l MapReveal_BombShop : ORA !MAP_OVERLAY : STA !MAP_OVERLAY : SEP #$20
REP #$20 : LDA.l MapReveal_BombShop : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogBombShopGuy
.SayNothing
@@ -181,3 +180,6 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
RTL
}
;================================================================
incsrc menu/hudalpha.asm
incsrc util/utils.asm

View File

@@ -6,6 +6,61 @@
; 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
@@ -24,49 +79,26 @@ InvertDPad:
.crowd_control
LDA !INVERT_DPAD : BNE +
LDA.b $A0 : CMP.b #$DE : BNE .off
LDA.b #$01 : BRA +
.off
LDA $4218 : STA $00
LDA $4219 : STA $01
JML.l InvertDPadReturn
+ 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
+ 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
.onemind_controller_offset
db 0 ; player 0 - $4218 - joy1d1
@@ -76,8 +108,6 @@ JML.l InvertDPadReturn
db 2 ; player 4 - $421A - joy2d1
db 6 ; player 5 - $421E - joy2d2
;--------------------------------------------------------------------------------
HandleOneMindController:

View File

@@ -23,8 +23,12 @@ CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors
LDA.l !LOOP_FRAMES_LOW : AND.b #$7F : BNE + ; check every 128 frames
LDA.b $10 : CMP.b #$09 : BEQ .check ; only if outdoors
.indoors
LDA.b #$00 : STA.l !CUCCO_STORM
BRA +
.check
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
-
;==== Find a Cucco
@@ -72,4 +76,4 @@ CuccoStorm:
;====
+
RTL
;================================================================================
;================================================================================

Binary file not shown.

View File

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

View File

@@ -10,15 +10,24 @@ DoWorldFix:
LDA InvertedMode : BEQ +
JMP DoWorldFix_Inverted
+
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA $7EF353 : BEQ .noMirror ; check if we have the mirror
LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.aga1Alive
LDA #$00
.noMirror
STA $7EF3CA ; set flag to light world
LDA $7EF3CC : CMP #$07 : BNE .done : INC : STA $7EF3CC ; convert frog to dwarf
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
;--------------------------------------------------------------------------------
@@ -39,25 +48,29 @@ JMP DoWorldFix
JMP DoWorldFix_skip_mirror_check
.pyramid
LDA #$40 : STA $7EF3CA ; set flag to dark world
LDA $7EF3CC : CMP #$08 : BNE .done : DEC : STA $7EF3CC : + ; convert dwarf to frog
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog
.done
RTL
;================================================================================
DoWorldFix_Inverted:
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA $7EF353 : BEQ .noMirror ; check if we have the mirror
LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror
.aga1Alive
LDA #$40 : STA $7EF3CA ; set flag to dark world
LDA $7EF3CC
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA $7EF3CC ; clear follower
LDA #$40 : 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
.done
RTL
;--------------------------------------------------------------------------------
@@ -68,15 +81,15 @@ SetDeathWorldChecked_Inverted:
LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix
JMP DoWorldFix_Inverted
.dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_Inverted_skip_mirror_check
.castle
LDA #$00 : STA $7EF3CA ; set flag to dark world
LDA $7EF3CC : CMP #$07 : BNE + : LDA.b #$08 : STA $7EF3CC : + ; convert frog to dwarf
LDA #$00 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf
.done
RTL
;================================================================================
@@ -85,19 +98,21 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA FixFakeWorld : BEQ +
LDA $8A : AND.b #$40 : STA $7EF3CA
PHX
LDX $8A : LDA.l OWTileWorldAssoc, X : STA CurrentWorld
PLX
+
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear:
LDA $7EF3CC
LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA $7EF3CC ; clear follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
.exit
RTL
;--------------------------------------------------------------------------------
FixAgahnimFollowers:
LDA.b #$00 : STA $7EF3CC ; clear follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over
;--------------------------------------------------------------------------------
@@ -107,56 +122,53 @@ macro SetMinimum(base,filler,compare)
?done:
endmacro
RefreshRainAmmo:
LDA $7EF3C5 : CMP.b #$01 : BEQ .rain ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL
.rain
LDA $7EF3C8
LDA StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Uncle)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Uncle)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Uncle)
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
BRA .done
+ CMP.b #$02 : BNE + ; Cell
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Cell)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Cell)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Cell)
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
BRA .done
+ CMP.b #$04 : BNE + ; Mantle
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Mantle)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Mantle)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Mantle)
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
+
.done
RTL
;--------------------------------------------------------------------------------
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetEscapeAssist:
LDA $7EF3C5 : CMP.b #$01 : BNE .no_train ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
BRA ++
.no_train ; choo choo
LDA.l EscapeAssist
BIT.b #$40 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$20 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$10 : BEQ + : STA !INFINITE_ARROWS : +
BIT.b #$40 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$20 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$10 : BEQ + : STA InfiniteArrowsModifier : +
++
LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l !WEAPON_LEVEL : BEQ +
LDA #$01 : STA !INFINITE_BOMBS
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombsModifier
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA $7EF340 : CMP.b #$3 : BCC +
SBC.b #$02 : STA $7EF340
LDA BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA BowEquipment
+
RTL
;================================================================================

View File

@@ -267,8 +267,8 @@ RTL
;--------------------------------------------------------------------------------
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA $7EF35C : ORA $7EF35D : ORA $7EF35E : ORA $7EF35F : BNE .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
.noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.b #$51
@@ -284,7 +284,10 @@ DialogGanon1:
REP #$20
LDA.w #$018C
BCC +
JSL CheckMushroom
LDA.w #$016D
BCC +
LDA.w #$0197
+ STA $1CF0
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
@@ -294,7 +297,7 @@ RTL
; #$0193 - no silvers alternate
; #$0194 - no silvers
; #$0195 - silvers
; $7EF38E - bsp-- ---
; BowTracking - bsp-- ---
; b = bow
; s = silver arrow bow
; p = 2nd progressive bow
@@ -304,12 +307,16 @@ DialogGanon2:
REP #$20
BCS +
LDA.w #$018D : JMP .done
+
JSL CheckMushroom
BCC +
LDA.w #$0198 : JMP .done
+
LDA.l GanonVulnerabilityItem : AND #$00FF : BNE .special_item
LDA.l SpecialWeapons : AND.w #$00FF
CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode
.silver_arrows
LDA.l $7EF38E
LDA.l BowTracking
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : JMP .done
@@ -330,26 +337,26 @@ DialogGanon2:
CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee
PHX : TAX
LDA.l $7EF33F, X : PLX : AND #$00FF : BNE +
LDA.l EquipmentWRAM-1, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done
+
LDA.w #$0195 : BRA .done
.bombs
LDA.l $7EF343 : AND #$00FF : BNE +
LDA.l $7F50C9 : AND #$00FF : BNE + ; check for infinite 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 $7EF38C : AND #$0010 : BNE +
LDA.l InventoryTracking : AND #$0010 : BNE + ; check for powder
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.bee
LDA.l $7EF35C : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35D : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35E : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35F : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
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
@@ -398,7 +405,7 @@ DialogBombosTablet:
RTL
;--------------------------------------------------------------------------------
DialogSahasrahla:
LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
JML Sprite_ShowMessageUnconditional
@@ -407,7 +414,7 @@ RTL
;--------------------------------------------------------------------------------
DialogBombShopGuy:
LDY.b #$15
LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16
+
TYA
@@ -420,7 +427,7 @@ AgahnimAsksAboutPed:
LDA.l InvincibleGanon
CMP.b #$06 : BNE .vanilla
LDA.l $7EF300 ; check ped flag
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40
BNE .vanilla

View File

@@ -37,3 +37,41 @@ 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

59
doorrando/doorrando.asm Normal file
View File

@@ -0,0 +1,59 @@
!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
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
warnpc $A79C00
incsrc doortables.asm
warnpc $A88000

696
doorrando/doortables.asm Normal file
View File

@@ -0,0 +1,696 @@
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

19
doorrando/dr_lobby.asm Normal file
View File

@@ -0,0 +1,19 @@
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 InvertedMode : BEQ +
LDA.b #$40
+ STA CurrentWorld
PLP : RTL

220
doorrando/drhooks.asm Normal file
View File

@@ -0,0 +1,220 @@
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 $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 $82C3F2 ; <- Bank02.asm:10521 Unused call
Underworld_DoorDown_Call:
org $82C3F3
dw $8AD9 ; address of Bank02.asm:2085
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
; fixes an issue with edges -> normal doors (bombable, dashable, keydoor)
org $82C06A
JSL TransitionCalculateLanding_Fix : NOP #2
org $82C157
JSL AlwaysPushThroughFDoors

325
doorrando/edges.asm Normal file
View File

@@ -0,0 +1,325 @@
; defines
; Ram usage
EdgeToNormalFlag = $7E1200
HorzEdge:
LDA.b #$00 : STA.l EdgeToNormalFlag
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:
LDA.b #$00 : STA.l EdgeToNormalFlag
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
LDA.b #$01 : STA.l EdgeToNormalFlag
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
TransitionCalculateLanding_Fix:
LDA.l EdgeToNormalFlag : BEQ +
LDX.w $0418 : CPX.b #$01 : BNE +
LDA.b $20 : SBC #$08 : STA.b $20
+ PHK : PEA.w .jslrtsreturn-1
PEA.w $02802C
JML CalculateTransitionLanding
.jslrtsreturn
LDX.w $0418 : CPX.b #$01 : BNE .zero ; the LDX is vanilla and needs to always run
LDA.l EdgeToNormalFlag : BEQ +
LDA.b $20 : ADC #$08 : STA.b $20
.zero LDA.b #$00 : STA.l EdgeToNormalFlag
+ JSL DoorToStraight
RTL
AlwaysPushThroughFDoors:
PHA : AND.b #$F0 : CMP.b #$F0 : BNE +
PLA : RTL
+ PLA : AND.b #$8E : CMP.b #$80
RTL

View File

@@ -0,0 +1,274 @@
;===================================================================================================
; 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
;===================================================================================================
pushpc
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
pullpc
;===================================================================================================
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
; 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
; 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
.fix_swamp_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; 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
LDA.w #$0908
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,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
; 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
; 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 $1980, Y ; grab door info (type)
AND.w #$00FF
STA.b $0A ; 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
;===================================================================================================
; Enter with:
; $0A containing the door information: position and type bytes
; which should be from $1980, Y or [$B7], Y depending on where in the door process we are
; 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.b $0A
CMP.w #$000A : BCC .continue
CMP.w #$0014 : BCS .continue
BRA .block_door
.continue
BRA -
.leave_alone
CLC : RTS
;===================================================================================================

95
doorrando/gfx.asm Normal file
View File

@@ -0,0 +1,95 @@
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

299
doorrando/hudadditions.asm Normal file
View File

@@ -0,0 +1,299 @@
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
PLA : PHA : 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

42
doorrando/keydoors.asm Normal file
View File

@@ -0,0 +1,42 @@
; 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)

66
doorrando/math.asm Normal file
View File

@@ -0,0 +1,66 @@
;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

440
doorrando/normal.asm Normal file
View File

@@ -0,0 +1,440 @@
WarpLeft:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .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
lda $040c : cmp.b #$ff : beq .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
lda $040c : cmp.b #$ff : beq .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
lda $040c : cmp.b #$ff : beq .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
;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
; the ldx $0418 is now taken care of by TransitionCalculateLanding_Fix
.end cmp #$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
++ JSL Underworld_DoorDown_Call : rtl
+ 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
PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState
LDA.w $0418 : AND.b #$02 : BNE + : INC
+ STA.b $6C
.noDoor
PLA
CMP #$34 : bne + ; inroom stairs
PHA : LDA #$26 : STA $045E : PLA
+ RTL
}

131
doorrando/overrides.asm Normal file
View File

@@ -0,0 +1,131 @@
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

222
doorrando/scroll.asm Normal file
View File

@@ -0,0 +1,222 @@
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

329
doorrando/spiral.asm Normal file
View File

@@ -0,0 +1,329 @@
RecordStairType: {
pha
lda.l DRMode : beq .norm
lda $040c : cmp #$ff : beq .norm
lda $0e
cmp #$25 : bcc ++ ; don't record straight staircases
sta $045e
++ pla : bra +
.norm pla : sta $a0
+ lda $063d, x
rtl
}
SpiralWarp: {
lda.l DRMode : beq .abort ; abort if not DR
lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg
cmp #$26 : beq .inroom
.abort
stz $045e : lda $a2 : and #$0f : rtl ; clear,run hijacked code and get out
.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
}
;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 $8AE817,X
LDA.l DungeonMapBossRooms, X
ASL
TAX

View File

@@ -40,25 +40,32 @@ RTL
Elder_Code:
{
LDA GoalItemRequirement : BEQ .despawn
LDA InvincibleGanon : CMP #$05 : BEQ .despawn
LDA TurnInGoalItems : BNE +
REP #$20
LDA.l GoalItemRequirement : BEQ .despawn
LDA.l InvincibleGanon : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn
SEP #$20
STZ $0DD0, X ; despawn self
RTS
+
SEP #$20
LDA.b $11
BNE .done
LDA.b #$96
LDY.b #$01
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show
LDA !GOAL_COUNTER
CMP GoalItemRequirement : !BLT +
REP #$20
LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL.l ActivateGoal
+
.dont_show
.done
LDA $1A : LSR #5 : AND.b #$01 : STA $0DC0, X
SEP #$20
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
RTS
}
}

13
enemizer/blindboss.asm Normal file
View File

@@ -0,0 +1,13 @@
;================================================================================
; 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

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

1
enemizer/hooks.asm Normal file
View File

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

35
enemizer/main.asm Normal file
View File

@@ -0,0 +1,35 @@
; 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

@@ -8,7 +8,7 @@ LockAgahnimDoors:
;#$0 = Never Locked
LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE +
LDA $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
LDA ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
@@ -20,9 +20,9 @@ LockAgahnimDoors:
!BGE .crystalOrUnlock
LDA #$0001 : RTL
.crystalOrUnlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock
LDA SwapAgaGanonsTower : AND.w #$00FF : BEQ .unlock
LDA $7EF2C3 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
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
.locked
@@ -42,9 +42,9 @@ LockAgahnimDoors:
RTL
;---------------------------------------------------------------------------------
FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla
LDA.l SwapAgaGanonsTower : BEQ .vanilla
LDA $7EF2C3 : ORA #$20 : STA $7EF2C3 ; activate GT overlay
LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
.vanilla
LDA.b #$28 : STA.b $72
@@ -77,11 +77,10 @@ JML.l Overworld_Entrance_BRANCH_RHO
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y
LDA $7EF3C8 : AND.w #$00FF ; What we wrote over
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
@@ -124,10 +123,11 @@ AllowStartFromSingleEntranceCave:
STZ $0699 ;zero out door overlays in case starting overworld door is not set
SEP #$20 ; set 8-bit accumulator
LDA $7EF3C8 : TAX
LDA StartingEntrance : 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
@@ -138,7 +138,7 @@ AllowStartFromExit:
LDX $1CE8
LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l $7EF3C8 ; what we wrote over
LDA.l StartingEntrance ; what we wrote over
JML.l AllowStartFromExitReturn
.doStart
@@ -194,9 +194,9 @@ JML Overworld_Hole_End
;--------------------------------------------------------------------------------
PreventEnterOnBonk:
STA $00 ; part of what we wrote over
LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.b $8A : TAX : LDA.l OWTileMapAlt, X : AND.w #$0001 : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b $8A : AND.w #$0040 : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
LDA.b $8A : TAX : LDA.l OWTileWorldAssoc, X : AND.w #$00FF : 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
@@ -209,20 +209,21 @@ TurtleRockEntranceFix:
LDA TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done
;If exiting to turtle rock ensure the entrance is open
LDA.l $7EF2C7 : ORA.b #$20 : STA.l $7EF2C7
LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
.done
RTL
;--------------------------------------------------------------------------------
AnimatedEntranceFix: ;when an entrance animation tries to start
PHA
PHA : PHX
LDA.l InvertedMode : BEQ + ;If we are in inverted mode
LDA $8A : AND.b #$40 : BNE + ;and in the light world
PLA
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
STZ $04C6 ; skip it.
LDA #$00
RTL
+
PLA
PLX : PLA
STA $02E4 ;what we wrote over
STA $0FC1 ;what we wrote over
STA $0710 ;what we wrote over

View File

@@ -2,7 +2,7 @@
; OnLoadOW
;--------------------------------------------------------------------------------
;OnLoadMap:
; LDA $7EF2DB ; thing we wrote over
; LDA OverworldEventDataWRAM+$5B ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnPrepFileSelect:
@@ -15,15 +15,17 @@ 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
JSL.l PollService
JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
;OnDungeonEntrance:
; STA $7EC172 ; thing we wrote over
;RTL
OnDungeonEntrance:
STA $7EC172 ; thing we wrote over
JSL MaybeFlagCompassTotalEntrance
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
PHA
@@ -56,60 +58,90 @@ 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.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
LDA UncleItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLA
JSL Link_ReceiveItem
JSL.l Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA $7EF373 : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA $7EF375 : + ; refill bombs
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 $7EF376
LDA.b #70 : STA.l ArrowsFiller
LDA.l ArrowMode : BEQ +
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA $7EF360 : !ADD.l FreeUncleItemAmount : STA $7EF360 ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
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
+
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
;--------------------------------------------------------------------------------
OnFileCreation:
TAX ; what we wrote over
LDA StartingEquipment+$4C : STA $700340+$4C ; copy starting equipment swaps to file select screen
LDA StartingEquipment+$4E : STA $700340+$4E
LDA StartingEquipment+$4F : STA $700340+$4F ; copy starting bomb level
RTL
; 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
; 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
JML.l InitializeSaveFile_build_checksum
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
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
LDA !FRESH_FILE_MARKER : BNE +
LDA.l FileMarker : BNE +
JSL.l OnNewFile
LDA.b #$FF : STA !FRESH_FILE_MARKER
LDA.b #$FF : STA.l FileMarker
+
LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
JSL.l DoWorldFix
+
JSL.l MasterSwordFollowerClear
JSL.l InitOpenMode
LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.l GenericKeys : BEQ +
LDA $7EF38B : STA $7EF36F ; copy generic keys to key counter
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+
JSL.l SetSilverBowMode
@@ -125,39 +157,8 @@ RTL
!RNG_ITEM_LOCK_IN = "$7F5090"
OnNewFile:
PHX : PHP
REP #$20 ; set 16-bit accumulator
LDA.l LinkStartingRupees : STA $7EF362 : STA $7EF360
LDA.l StartingTime : STA $7EF454
LDA.l StartingTime+2 : STA $7EF454+2
LDX.w #$004F : - ; copy over starting equipment
LDA StartingEquipment, X : STA $7EF340, X
DEX : DEX
BPL -
LDX #$000E : -
LDA $7EF37C, X : STA $7EF4E0, X
DEX : DEX
BPL -
SEP #$20 ; set 8-bit accumulator
;LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.l PreopenCurtains : BEQ +
LDA.b #$80 : STA $7EF061 ; open aga tower curtain
LDA.b #$80 : STA $7EF093 ; open skull woods curtain
+
LDA.l PreopenPyramid : BEQ +
LDA.b #$20 : STA $7EF2DB ; pyramid hole already open
+
LDA.l PreopenGanonsTower : BEQ +
LDA.b #$20 : STA $7EF2C3 ; Ganons Tower already open
+
LDA StartingSword : STA $7EF359 ; set starting sword type
; reset some values on new file that are otherwise only reset on hard reset
SEP #$20 ; set 8-bit accumulator
STZ $03C4 ; ancilla slot index
STZ $047A ; EG
STZ $0B08 : STZ $0B09 ; arc variable
@@ -236,8 +237,8 @@ PreItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemGet:
JML.l MaybeWriteSRAMTrace
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished
@@ -248,11 +249,22 @@ 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
RTL
JML.l Ancilla_ReceiveItem_optimus+6
;--------------------------------------------------------------------------------

565
failure.asm Normal file
View File

@@ -0,0 +1,565 @@
pushtable
table "bsodencode.txt"
; Uncomment this to force a crash to test message
;pushpc : org $008132 : db 0 : pullpc
;===================================================================================================
DontUseZSNES:
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l $4304
REP #$20
LDA.w #AllZeros
STA.l $4302
LDA.w #$1809
STA.l $4300
LDA.w #$0000
STA.l $4305
LDA.w #$0001
STA.l $420B
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
STZ.b VWFR
LDA.w #ZSNESMessage
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w $2100
-- BRA --
ZSNESMessage:
db "It has been detected that you are attempting to load", $80
db "this ROM on a low-quality emulator.", $80
db "The randomizer is designed to work on real hardware,", $80
db "which this application cannot emulate properly;", $80
db "as such, this ROM file refuses to boot.", $80
db "Please upgrade to a more accurate emulator such as", $80
db "SNES9X or BSNES/higan.", $80
db $FF
;===================================================================================================
AllZeros:
db $00
UselessStackTooFar:
dw $137
Crashed:
;===================================================================================================
;===================================================================================================
;===================================================================================================
; !!!DO NOT TRY TO OPTIMIZE THIS CODE!!!
; IT IS INTENTIONALLY AVOIDING CHANGING CERTAIN REGISTERS, ESPECIALLY THE STACK.
;===================================================================================================
;===================================================================================================
;===================================================================================================
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l $4304
REP #$38
LDA.w #AllZeros
STA.l $4302
LDA.w #$1809
STA.l $4300
LDA.w #$0000
STA.l $4305
LDA.w #$0001
STA.l $420B
;===================================================================================================
; Create report
LDA.w #$2100
TCD
;---------------------------------------------------------------------------------------------------
; Report status
; stack pointer
LDA.w #$0C38>>1
STA.b $2116
TSC
XBA
AND.w #$00FF
ORA.w #$0100
STA.b $2118
TSC
AND.w #$00FF
ORA.w #$0100
STA.l $2118
; game module
LDA.w #$0C78>>1
STA.b $2116
LDA.l $10
AND.w #$00FF
ORA.w #$0100
STA.b $2118
LDA.l $11
AND.w #$00FF
ORA.w #$0100
STA.b $2118
;---------------------------------------------------------------------------------------------------
; Report stack
TSC
INC
STA.l $7F0100
LDA.l UselessStackTooFar
; For now, we can report as much of the stack as possible
; If desired later on, uncomment the code below to keep the stack limited to
; where it was last doing stuff
; TSC
;
; ; keep stack in a useful range
; CMP.w #$01FF ; this means we pulled too much and the stack is useless
; BCC .stack_fine
;
; JMP .skip_stack
;
;.stack_fine
; CMP.l UselessStackTooFar
; BCS .stack_adjusted
;
; ; this means we went too far in, and the stack contains little useful info
; LDA.l UselessStackTooFar
;
;.stack_adjusted
STA.l $7F0000
LDX.w #$01FF
LDA.w #$0C04>>1
.next_row
STA.l $7F0004
STA.b $2116
LDY.w #20
TXA
.next_char
; set carry to see if we should color this value as being in the stack
CMP.l $7F0100
LDA.l $000000,X
AND.w #$00FF
ORA.w #$0500
BCS .in_stack
AND.w #$01FF
.in_stack
STA.b $2118
DEX
TXA
CMP.l $7F0000
BEQ .skip_stack
DEY
BNE .next_char
.done_row
CLC
LDA.l $7F0004
ADC.w #32
BRA .next_row
;===================================================================================================
;===================================================================================================
;===================================================================================================
; once the stack is reported, we can start doing stuff that mucks with it
.skip_stack
LDA.w #$0000
TCD
; TSC
; STA.b $80 ; remember stack for later messages
LDA.w #$01FF
TCS
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
JSR LoadBSODHexFont
STZ.b VWFR
LDA.w #BSODMessage
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w $2100
-- BRA --
; LDA.w #$0000
; TCD
;
; TSC
BSODMessage:
db "A fatal error has occurred and resulted in an", $80
db "unrecoverable crash. ?", $80
db "If you believe this was the result of a bug caused by", $80
db "the randomizer itself, please screenshot this message", $80
db "and share it in the #bug-reports channel of the official", $80
db "ALTTPR discord along with a detailed description of", $80
db "what you were doing, including video if available.", $80
db "Please also make a savestate now and include that in", $80
db "your report.", $80
db $FF
;===================================================================================================
DrawVWFMessage:
STA.b $06
.next
LDA.b ($06)
INC.b $06
AND.w #$00FF
CMP.w #$0080
BEQ .done_row
CMP.w #$00FF
BEQ .done_message
JSR DrawFailureVWFChar
BRA .next
.done_message
RTS
.done_row
LDA.b VWFR
ASL
TAX
LDA.w .row_offset,X
STA.w $2116
INC.b VWFR
LDA.w #$1800
STA.w $4300
LDA.w #20*16
STA.w $4305
LDA.w #$1000
STA.w $4302
SEP #$20
STZ.w $2115
STZ.w $4304
LDA.b #$01
STA.w $420B
REP #$20
JSR ResetVFW
BRA .next
.row_offset
dw $10F8
dw $11E8
dw $12D8
dw $13C8
dw $14B8
dw $15A8
dw $1698
dw $1788
dw $1878
dw $1968
dw $1A58
;===================================================================================================
VWFL = $40
VWFX = $44
VWFS = $46
VWFP = $48
VWFR = $4A
;===================================================================================================
DrawFailureVWFChar:
AND.w #$00FF
STA.b VWFL
TAX
ASL
ASL
ASL
ADC.w #BSODFontGFX
STA.b $08
LDA.b VWFP
AND.w #$FFF8
STA.w VWFX
LDA.b VWFP
AND.w #$0007
STA.w VWFS
; carry set on purpose to add letter spacing
SEC
LDA.w BSODCharWidths,X
AND.w #$00FF
ADC.b VWFP
STA.b VWFP
LDY.w #$0000
.next_row
LDA.b ($08),Y
AND.w #$00FF
XBA
LDX.w VWFS
BEQ ++
-- LSR
DEX
BNE --
++ LDX.w VWFX
SEP #$20
ORA.w $1008,X
STA.w $1008,X
XBA
ORA.w $1000,X
STA.w $1000,X
REP #$20
INX
STX.w VWFX
INY
CPY.w #$0008
BCC .next_row
RTS
;===================================================================================================
LoadBSODHexFont:
REP #$20
LDA.w #BSODHex
STA.w $4302
LDA.w #$1801
STA.w $4300
LDA.w #$1000
STA.w $4305
LDA.w #$2800
STA.w $2116
SEP #$20
LDA.b #BSODHex>>16
STA.w $4304
LDA.b #$01
STA.w $420B
REP #$30
RTS
;===================================================================================================
ConfigureBSODVWF:
REP #$30
LDA.w #$2100
TCD
SEP #$30
LDX.b #$FF
LDY.b #$7F
STZ.b $2121
STZ.b $2122 : STZ.b $2122
STX.b $2122 : STY.b $2122
LDA.b #$05
STA.b $2121
LDA.b #$11 : STA.b $2122 : STY.b $2122
LDA.b #$21 : STA.b $2121
STX.b $2122 : STY.b $2122
LDA.b #$25 : STA.b $2121
LDA.b #$11 : STA.b $2122 : STY.b $2122
REP #$30
PEA.w $0001
LDA.w #15
STA.w $28
LDA.w #$0042>>1
BRA .start
.next_row
PHA
LDA.w $20
CLC
LDA.w $20
ADC.w #32
.start
STA.w $20
STA.b $2116
PLA
LDY.w #30
.next_char
STA.b $2118
INC
DEY
BNE .next_char
DEC.w $28
BNE .next_row
LDA.w #$0000
TCD
ResetVFW:
REP #$30
LDX.w #$0400
-- STZ.w $1000,X
DEX
DEX
BPL --
STZ.b VWFL
STZ.b VWFX
STZ.b VWFS
STZ.b VWFP
RTS
;===================================================================================================
ConfigurePPUForFailureReport:
SEP #$30
PHK
PLB
STZ.w $2105 ; BG mode 0
STZ.w $2106 ; no mosaic
STZ.w $2107 ; BG1 tilemap to $0000
STZ.w $212D
STZ.w $210D : STZ.w $210D
STZ.w $210E : STZ.w $210E
STZ.w $210F : STZ.w $210F
STZ.w $2110 : STZ.w $2110
STZ.w $2123
STZ.w $2131
STZ.w $2133
LDA.b #$04
STA.w $2108 ; BG1 tilemap to $0800
LDA.b #$21
STA.w $210B
LDA.b #$03
STA.w $212C
RTS
;===================================================================================================
BSODHex:
incbin "bsodhex.2bpp"
BSODFontGFX:
incbin "bsodfont.1bpp"
BSODCharWidths:
; [space]
db 3
; A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
db 4, 4, 3, 4, 3, 3, 4, 3, 1, 4, 3, 3, 5, 4, 4, 4, 5, 4, 4, 3, 4, 5, 5, 3, 3, 3
; 0 1 2 3 4 5 6 7 8 9 . # ? - / , '
db 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 8, 3, 3, 2, 1
;===================================================================================================
pulltable

View File

@@ -2,20 +2,20 @@
; Fairy Changes & Fixes
;--------------------------------------------------------------------------------
RefillHealthPlusMagic:
LDA BigFairyHealth : STA $7EF372
LDA BigFairyHealth : STA HeartsFiller
RTL
;--------------------------------------------------------------------------------
RefillHealthPlusMagic8bit:
LDA BigFairyHealth : STA $7EF372
LDA BigFairyMagic : STA $7EF373
LDA BigFairyHealth : STA HeartsFiller
LDA BigFairyMagic : STA MagicFiller
RTL
;--------------------------------------------------------------------------------
CheckFullHealth:
LDA BigFairyHealth : BEQ +
LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet
LDA CurrentHealth : CMP MaximumHealth : BNE .player_hp_not_full_yet
+
LDA BigFairyMagic : BEQ +
LDA $7EF36E : CMP.b #$80 : BNE .player_mp_not_full_yet
LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet
+
LDA.b #$00
RTL
@@ -30,10 +30,10 @@ FairyPond_Init:
JML.l Sprite_ShowMessageFromPlayerContact
+
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA $7EF35C : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA $7EF35D : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA $7EF35E : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA $7EF35F : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
.noInventory
LDA.b #$0A : STA $0D80, X
LDA.b #$51

View File

@@ -117,7 +117,7 @@ FastTextScroll:
RTL
DumbFlagForMSU:
STA.l $7EF3CA
STA.l CurrentWorld
STZ.b $50
RTL

View File

@@ -1,10 +1,6 @@
!ExtendedPlayerName = "$700500"
!ValidKeyLoaded = "$7F509E"
;FS prefix means file_select, since these defines and macros are specific to this screen
!FS_INVENTORY_SWAP = "$70038C"
!FS_INVENTORY_SWAP_2 = "$70038E"
!FS_COLOR_BROWN = "$0000" ;(only used for: Shovel, hammer, powder)
!FS_COLOR_RED = "$0400"
@@ -136,36 +132,36 @@ DrawPlayerFileShared:
LDA.b #FileSelectItems>>16 : PHA : PLB
REP #$20 ; restore 16 bit accumulator
LDA !ExtendedPlayerName+$00 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,5)
LDA !ExtendedPlayerName+$02 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,6)
LDA !ExtendedPlayerName+$04 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,7)
LDA !ExtendedPlayerName+$06 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,8)
LDA !ExtendedPlayerName+$08 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,5)
LDA !ExtendedPlayerName+$0A : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,6)
LDA !ExtendedPlayerName+$0C : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,7)
LDA !ExtendedPlayerName+$0E : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,8)
JSR FileSelectDrawHudBar
; Bow
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ +
LDA $700340 : AND.w #$00FF : BEQ ++
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
%fs_drawItem(3,12,FileSelectItems_silver_bow)
BRA .bow_end
++
%fs_drawItem(3,12,FileSelectItems_silver_arrow)
BRA .bow_end
+
LDA.l $700340 : AND.w #$00FF : BEQ +
LDA.l EquipmentSRAM : AND.w #$00FF : BEQ +
%fs_drawItem(3,12,FileSelectItems_bow)
BRA .bow_end
+
@@ -173,15 +169,15 @@ DrawPlayerFileShared:
.bow_end
; Boomerang
LDA.l !FS_INVENTORY_SWAP : AND.w #$00C0 : CMP.w #$00C0 : BNE +
LDA.l InventoryTrackingSRAM : AND.w #$00C0 : CMP.w #$00C0 : BNE +
%fs_drawItem(3,14,FileSelectItems_both_boomerang)
BRA .boomerang_end
+
LDA.l !FS_INVENTORY_SWAP : AND.w #$0040 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0040 : BEQ +
%fs_drawItem(3,14,FileSelectItems_red_boomerang)
BRA .boomerang_end
+
LDA.l !FS_INVENTORY_SWAP : AND.w #$0080 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0080 : BEQ +
%fs_drawItem(3,14,FileSelectItems_blue_boomerang)
BRA .boomerang_end
+
@@ -189,13 +185,13 @@ DrawPlayerFileShared:
.boomerang_end
; Hookshot
%fs_drawItemBasic($700342,3,16,FileSelectItems_hookshot)
%fs_drawItemBasic(EquipmentSRAM+$02,3,16,FileSelectItems_hookshot)
; Bombs
; %fs_drawItemBasic($700343,3,18,FileSelectItems_bombs)
; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs)
; Powder
LDA.l !FS_INVENTORY_SWAP : AND.w #$0010 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0010 : BEQ +
%fs_drawItem(3,20,FileSelectItems_powder)
BRA ++
+
@@ -203,7 +199,7 @@ DrawPlayerFileShared:
++
; Mushroom
LDA.l !FS_INVENTORY_SWAP : AND.w #$0008 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++
+
@@ -211,7 +207,7 @@ DrawPlayerFileShared:
++
; Flute
LDA.l !FS_INVENTORY_SWAP : AND.w #$0003 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ +
%fs_drawItem(7,16,FileSelectItems_flute)
BRA ++
+
@@ -219,7 +215,7 @@ DrawPlayerFileShared:
++
; Shovel
LDA.l !FS_INVENTORY_SWAP : AND.w #$0004 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0004 : BEQ +
%fs_drawItem(9,12,FileSelectItems_shovel)
BRA ++
+
@@ -227,53 +223,53 @@ DrawPlayerFileShared:
++
; Fire Rod
%fs_drawItemBasic($700345,5,12,FileSelectItems_fire_rod)
%fs_drawItemBasic(EquipmentSRAM+$05,5,12,FileSelectItems_fire_rod)
; Ice Rod
%fs_drawItemBasic($700346,5,14,FileSelectItems_ice_rod)
%fs_drawItemBasic(EquipmentSRAM+$06,5,14,FileSelectItems_ice_rod)
; Bombos Medallion
%fs_drawItemBasic($700347,5,16,FileSelectItems_bombos)
%fs_drawItemBasic(EquipmentSRAM+$07,5,16,FileSelectItems_bombos)
; Ether Medallion
%fs_drawItemBasic($700348,5,18,FileSelectItems_ether)
%fs_drawItemBasic(EquipmentSRAM+$08,5,18,FileSelectItems_ether)
; Quake Medallion
%fs_drawItemBasic($700349,5,20,FileSelectItems_quake)
%fs_drawItemBasic(EquipmentSRAM+$09,5,20,FileSelectItems_quake)
; Lamp
%fs_drawItemBasic($70034A,7,12,FileSelectItems_lamp)
%fs_drawItemBasic(EquipmentSRAM+$0A,7,12,FileSelectItems_lamp)
; Hammer
%fs_drawItemBasic($70034B,7,14,FileSelectItems_hammer)
%fs_drawItemBasic(EquipmentSRAM+$0B,7,14,FileSelectItems_hammer)
; Bug Net
%fs_drawItemBasic($70034D,7,18,FileSelectItems_bugnet)
%fs_drawItemBasic(EquipmentSRAM+$0D,7,18,FileSelectItems_bugnet)
; Book of Mudora
%fs_drawItemBasic($70034E,7,20,FileSelectItems_book)
%fs_drawItemBasic(EquipmentSRAM+$0E,7,20,FileSelectItems_book)
; Red Cane
%fs_drawItemBasic($700350,9,14,FileSelectItems_redcane)
%fs_drawItemBasic(EquipmentSRAM+$10,9,14,FileSelectItems_redcane)
; Blue Cane
%fs_drawItemBasic($700351,9,16,FileSelectItems_bluecane)
%fs_drawItemBasic(EquipmentSRAM+$11,9,16,FileSelectItems_bluecane)
; Cape
%fs_drawItemBasic($700352,9,18,FileSelectItems_cape)
%fs_drawItemBasic(EquipmentSRAM+$12,9,18,FileSelectItems_cape)
; Mirror
%fs_drawItemBasic($700353,9,20,FileSelectItems_mirror)
%fs_drawItemBasic(EquipmentSRAM+$13,9,20,FileSelectItems_mirror)
; Bottles
%fs_drawBottle($70035C,3,23)
%fs_drawBottle($70035D,5,23)
%fs_drawBottle($70035E,7,23)
%fs_drawBottle($70035F,9,23)
%fs_drawBottle(EquipmentSRAM+$1C,3,23)
%fs_drawBottle(EquipmentSRAM+$1D,5,23)
%fs_drawBottle(EquipmentSRAM+$1E,7,23)
%fs_drawBottle(EquipmentSRAM+$1F,9,23)
; Sword
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword
LDA.l $700359 : AND.w #$00FF : BNE +
LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
JMP ++
+ : DEC : BNE +
@@ -291,6 +287,7 @@ 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)
@@ -316,7 +313,7 @@ DrawPlayerFileShared:
++
; Shield
LDA.l $70035A : AND.w #$00FF : BNE +
LDA.l EquipmentSRAM+$1A : AND.w #$00FF : BNE +
%fs_drawItemGray(5,26,FileSelectItems_fighters_shield)
BRA ++
+ : DEC : BNE +
@@ -330,7 +327,7 @@ DrawPlayerFileShared:
++
; Mail
LDA.l $70035B : AND.w #$00FF : BNE +
LDA.l EquipmentSRAM+$1B : AND.w #$00FF : BNE +
%fs_drawItem(7,26,FileSelectItems_green_mail)
BRA ++
+ : DEC : BNE +
@@ -341,7 +338,7 @@ DrawPlayerFileShared:
++
; Heart Pieces
LDA.l $70036B : AND.w #$00FF : BNE +
LDA.l EquipmentSRAM+$2B : AND.w #$00FF : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_0_of_4)
BRA ++
+ : DEC : BNE +
@@ -354,16 +351,16 @@ DrawPlayerFileShared:
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
++
LDA $700448 : AND.w #$00FF
LDA EquipmentSRAM+$0108 : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
; Boots
%fs_drawItemBasic($700355,3,28,FileSelectItems_boots)
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
; Gloves
LDA.l $700354 : AND.w #$00FF : BNE +
LDA.l EquipmentSRAM+$14 : AND.w #$00FF : BNE +
%fs_drawItemGray(5,28,FileSelectItems_gloves)
BRA ++
+ : DEC : BNE +
@@ -374,27 +371,27 @@ DrawPlayerFileShared:
++
; Flippers
%fs_drawItemBasic($700356,7,28,FileSelectItems_flippers)
%fs_drawItemBasic(EquipmentSRAM+$16,7,28,FileSelectItems_flippers)
; Moon Pearl
%fs_drawItemBasic($700357,9,28,FileSelectItems_pearl)
%fs_drawItemBasic(EquipmentSRAM+$17,9,28,FileSelectItems_pearl)
; Pendants
LDA $700374 : AND.w #$0004 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
%fs_drawItem(12,12,FileSelectItems_green_pendant)
BRA ++
+
%fs_drawItem(12,12,FileSelectItems_no_pendant)
++
LDA $700374 : AND.w #$0002 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
%fs_drawItem(12,14,FileSelectItems_blue_pendant)
BRA ++
+
%fs_drawItem(12,14,FileSelectItems_no_pendant)
++
LDA $700374 : AND.w #$0001 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
%fs_drawItem(12,16,FileSelectItems_red_pendant)
BRA ++
+
@@ -402,49 +399,49 @@ DrawPlayerFileShared:
++
; Crystals
LDA $70037A : AND.w #$0002 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18)
LDA $70037A : AND.w #$0010 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19)
LDA $70037A : AND.w #$0040 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20)
LDA $70037A : AND.w #$0020 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21)
LDA $70037A : AND.w #$0004 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22)
LDA $70037A : AND.w #$0001 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23)
LDA $70037A : AND.w #$0008 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
@@ -598,7 +595,7 @@ FileSelectItems:
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA $700362
LDA EquipmentSRAM+$22
JSL.l HexToDec
LDA $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
@@ -607,7 +604,7 @@ FileSelectDrawHudBar:
LDA SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA $700343 : AND.w #$00FF
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)
@@ -629,13 +626,13 @@ FileSelectDrawHudBar:
LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ +
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA $700377 : AND.w #$00FF
LDA EquipmentSRAM+$37 : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
@@ -844,16 +841,16 @@ DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator
LDA $7003D9 : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5)
LDA $7003DB : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,6)
LDA $7003DD : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7)
LDA $7003DF : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8)
LDA $70036C : AND.w #$00FF : LSR #3 : STA $02
LDA EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA $02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A
@@ -923,3 +920,21 @@ JML FSSelectFile_continue
LDA.b #$3C : STA $012E ; play error sound
JML FSSelectFile_return
;--------------------------------------------------------------------------------
MaybeForceFileName:
LDA.l ForceFileName : BEQ +
REP #$20
LDX.b #$FE
-
INX : INX
LDA.l StaticFileName, X : STA.l ExtendedFileNameSRAM, X
CPX #$16 : BEQ .done
CPX #$08 : BCS -
STA.l FileNameVanillaSRAM, X
BRA -
.done
SEP #$20
JML.l InitializeSaveFile
+
JML.l NameFile_MakeScreenVisible
;--------------------------------------------------------------------------------

View File

@@ -4,23 +4,23 @@
FlipperKill:
PHP
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA $7EF356 : BNE .done ; skip if we have the flippers
LDA FlippersEquipment : BNE .done ; skip if we have the flippers
LDA $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock
LDA $8A : CMP $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on
;JSL.l KillFairies ; take away fairies
LDA !IGNORE_FAIRIES : ORA.b #$04 : STA !IGNORE_FAIRIES
LDA.b #$00 : STA $7EF36D ; kill link
LDA IgnoreFaeries : ORA.b #$04 : STA IgnoreFaeries
LDA.b #$00 : STA CurrentHealth ; kill link
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done
PLP
LDA $7EF36D ; thing we wrote over
LDA CurrentHealth ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
IgnoreFairyCheck:
LDX.b #$00 ; thing we wrote over
LDA !IGNORE_FAIRIES : BIT.b #$04 : BEQ .normal
LDA IgnoreFaeries : BIT.b #$04 : BEQ .normal
AND.b #$FB : STA !IGNORE_FAIRIES ; clear ignore fairy flag
AND.b #$FB : STA IgnoreFaeries ; clear ignore fairy flag
LDA.b #$F0 ; set check to invalid entry
RTL
.normal
@@ -28,14 +28,14 @@ RTL
RTL
;--------------------------------------------------------------------------------
;KillFairies:
; LDA $7EF35C : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35C
; + LDA $7EF35D : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35D
; + LDA $7EF35E : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35E
; + LDA $7EF35F : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35F
; LDA BottleContentsOne : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsOne
; + LDA BottleContentsTwo : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsTwo
; + LDA BottleContentsThree : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsThree
; + LDA BottleContentsFour : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsFour
; +
;RTL
;--------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ RTL
;--------------------------------------------------------------------------------
FlipperFlag:
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA $7EF356 : BNE .safe ; skip if we have the flippers
LDA FlippersEquipment : BNE .safe ; skip if we have the flippers
LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible
BRA .done
.safe
@@ -135,3 +135,20 @@ 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

@@ -5,21 +5,25 @@ FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear
FloodGateReset:
LDA.l PersistentFloodgate : BNE +
LDA $7EF2BB : AND.b #$DF : STA $7EF2BB ; reset water outside floodgate
LDA $7EF2FB : AND.b #$DF : STA $7EF2FB ; reset water outside swamp palace
LDA $7EF216 : AND.b #$7F : STA $7EF216 ; clear water inside floodgate
LDA $7EF051 : AND.b #$FE : STA $7EF051 ; clear water front room (room 40)
LDA OverworldEventDataWRAM+$3B : AND.b #$DF : STA OverworldEventDataWRAM+$3B ; reset water outside floodgate
LDA OverworldEventDataWRAM+$7B : AND.b #$DF : STA OverworldEventDataWRAM+$7B ; reset water outside swamp palace
LDA RoomDataWRAM[$010B].low : AND.b #$7F : STA RoomDataWRAM[$010B].low ; clear water inside floodgate
LDA RoomDataWRAM[$28].high : AND.b #$FE : STA RoomDataWRAM[$28].high ; clear water front room (room 40)
+
FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ +++
LDA $7EF06F : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected.
LDA $7EF356 : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
+
LDA $7EF06E : AND.b #$7F : STA $7EF06E ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches
++
LDA $7EF06B : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected.
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.
; 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 $7EF06A : AND.b #$7F : STA $7EF06A ; clear water room 53 - inner room with the easy key flood softlock
+++
LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 35 - inner room with the easy key flood softlock
.done
RTL
;================================================================================

View File

@@ -5,6 +5,7 @@ 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
@@ -23,17 +24,17 @@ SpawnHauntedGroveItem:
LDA.b #$30 : STA $0F10, Y
LDA $22 : !ADD.l .x_offsets, X
AND.b #$F0 : STA $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y
AND.b #$F0 : STA $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y
LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y
LDA $21 : ADC.b #$00 : STA $0D20, Y
LDA $21 : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA $0F20, Y
TYX
LDX $8A ; haunted grove (208D0A)
LDA $7EF280, X : AND.b #$40 : BNE +
LDA OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDA.b #$1B : JSL Sound_SetSfx3PanLong
+
RTL
@@ -60,8 +61,11 @@ FluteBoy:
JML.l FluteBoy_Continue
;--------------------------------------------------------------------------------
FreeDuckCheck:
LDA.l InvertedMode : BEQ .done
LDA $7EF34C : CMP.b #$03 : BEQ .done ; flute is already active
LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BNE .skipInvertedCheck
LDA.l InvertedMode : BEQ .done
.skipInvertedCheck
LDA FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active
; check the area, is it #$18 = 30?
LDA $8A : CMP.b #$18 : BNE .done

View File

@@ -1,83 +1,75 @@
;================================================================================
; Frame Hook
;--------------------------------------------------------------------------------
; $7EF42Ew[2] - loop frame counter (low)
!LOOP_FRAMES_LOW = "$7EF42E"
;--------------------------------------------------------------------------------
; $7EF430w[2] - loop frame counter (high)
!LOOP_FRAMES_HIGH = "$7EF430"
;--------------------------------------------------------------------------------
; $7EF43Ew[2] - nmi frame counter (low)
!NMI_FRAMES_LOW = "$7EF43E"
;--------------------------------------------------------------------------------
; $7EF440w[2] - nmi frame counter (high)
!NMI_FRAMES_HIGH = "$7EF440"
;--------------------------------------------------------------------------------
; $7EF444w[2] - item menu frame counter (low)
!ITEM_FRAMES_LOW = "$7EF444"
;--------------------------------------------------------------------------------
; $7EF446w[2] - item menu frame counter (high)
!ITEM_FRAMES_HIGH = "$7EF446"
;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
FrameHookAction:
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
;LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
; LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames
;+
LDA !LOCK_STATS : BNE ++
LDA StatsLocked : BNE ++
REP #$20 ; set 16-bit accumulator
LDA !LOOP_FRAMES_LOW : INC : STA !LOOP_FRAMES_LOW : BNE +
LDA !LOOP_FRAMES_HIGH : INC : STA !LOOP_FRAMES_HIGH
LDA LoopFrames : INC : STA LoopFrames : BNE +
LDA LoopFrames+2 : INC : STA LoopFrames+2
+
LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA !ITEM_FRAMES_LOW : INC : STA !ITEM_FRAMES_LOW : BNE +
LDA !ITEM_FRAMES_HIGH : INC : STA !ITEM_FRAMES_HIGH
LDA MenuFrames : INC : STA MenuFrames : BNE +
LDA MenuFrames+2 : INC : STA MenuFrames+2
+
;SEP #$20 ; set 8-bit accumulator ?? check this
++
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 !LOCK_STATS : AND.w #$00FF : BNE ++
LDA !NMI_FRAMES_LOW : INC : STA !NMI_FRAMES_LOW : BNE +
LDA !NMI_FRAMES_HIGH : INC : STA !NMI_FRAMES_HIGH
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA NMIFrames+2 : INC : STA NMIFrames+2
+
++
JML.l NMIHookReturn
;--------------------------------------------------------------------------------
!NMI_AUX = "$7F5044"
PostNMIHookAction:
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
;--------------------------------------------------------------------------------
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
;--------------------------------------------------------------------------------

View File

@@ -16,20 +16,20 @@ GetAgahnimDeath:
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
++
LDA.b #$01 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
BRA ++
+++
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
LDA.b #$00 : STA CurrentWorld ; Switch to light world
; (This will later get flipped to DW when Agahnim 1
; warps us to the pyramid)
++

View File

@@ -1,15 +1,17 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space (Callee Preserved)
;--------------------------------------------------------------------------------
!GOAL_COUNTER = "$7EF418"
!GOAL_DRAW_ADDRESS = "$7EC72A"
;--------------------------------------------------------------------------------
; DrawGoalIndicator moved to newhud.asm
;--------------------------------------------------------------------------------
GoalItemGanonCheck:
LDA $0E20, X : CMP.b #$D6 : BNE .success ; skip if not ganon
LDA.w $0D80, X : CMP.b #$12 : BEQ .fail
JSL.l CheckGanonVulnerability
BCS .success
BCC .fail
JSL CheckMushroom
BCC .success
.fail
LDA $0D80, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
@@ -47,6 +49,7 @@ CheckGanonVulnerability:
dw .crystals_and_bosses
dw .bosses_only
dw .all_dungeons_no_agahnim
dw .completionist
; 00 = always vulnerable
.vulnerable
@@ -62,18 +65,18 @@ CheckGanonVulnerability:
; 02 = All dungeons
.all_dungeons
LDA.l $7EF3C5 : CMP.b #$03 : BCC .fail ; require post-aga world state
LDA.l ProgressIndicator : CMP.b #$03 : BCC .fail ; require post-aga world state
; 09 = All dungeons except agahnim
.all_dungeons_no_agahnim
LDA.l $7EF374 : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants
LDA.l $7EF37A : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals
LDA.l $7EF2DB : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open)
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)
BRA .success
; 03 = crystals and aga 2
.crystals_and_aga
LDA.l $7EF2DB : AND.b #$20 : BEQ .fail ; check aga2 first then bleed in
LDA RoomDataWRAM[$0D].high : AND.b #$08 : BEQ .fail ; check aga2 first then bleed in
; 04 = crystals only
.crystals
@@ -82,7 +85,9 @@ CheckGanonVulnerability:
; 05 = require goal item
.goal_item
LDA.l !GOAL_COUNTER : CMP GoalItemRequirement
REP #$20
LDA.l GoalCounter : CMP.l GoalItemRequirement
SEP #$20
RTS
; 06 = light speed
@@ -96,9 +101,17 @@ CheckGanonVulnerability:
; 08 = Crystal bosses but no crystals
.bosses_only
;LDA.l $7EF2DDB : AND.b #$20 : BEQ .fail ; check aga2
JMP CheckForCrystalBossesDefeated
; 0a = Check Item counter
.completionist
REP #$20
LDA.l TotalItemCounter : CMP.l MaxItemCounter
SEP #$20
BCC .fail
BRA .all_dungeons
;--------------------------------------------------------------------------------
GetRequiredCrystalsForTower:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
@@ -125,12 +138,12 @@ GetRequiredCrystalsInX:
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less
LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less
LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower
RTL
@@ -140,7 +153,7 @@ CheckAgaForPed:
CMP.b #$06 : BNE .vanilla
.light_speed
LDA.l $7EF300 ; check ped flag
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40
BEQ .force_blue_ball
@@ -158,15 +171,15 @@ CheckAgaForPed:
;---------------------------------------------------------------------------------------------------
KillGanon:
STA.l $7EF3C5 ; vanilla game state stuff we overwrote
STA.l ProgressIndicator ; vanilla game state stuff we overwrote
LDA.l InvincibleGanon
CMP.b #$06 : BNE .exit
.light_speed
LDA.l $7EF2DB : ORA.b #$20 : STA.l $7EF2DB ; pyramid hole
LDA.b #$08 : STA.l $7EF001 ; kill ganon
LDA.b #$02 : STA.l $7EF357 ; pearl but invisible in menu
LDA.l OverworldEventDataWRAM+$5B : ORA.b #$20 : STA.l OverworldEventDataWRAM+$5B ; pyramid hole
LDA.b #$08 : STA.l RoomDataWRAM[$00].high ; kill ganon
LDA.b #$02 : STA.l MoonPearlEquipment ; pearl but invisible in menu
.exit
RTL
@@ -197,7 +210,7 @@ CheckForCrystalBossesDefeated:
LDA.l DrawHUDDungeonItems_boss_room_ids-4,X
TAX
LDA.l $7EF000,X
LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ++

View File

@@ -6,10 +6,11 @@ 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
LDA HalfMagic
STA $7EF37B
STA MagicConsumption
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

View File

@@ -32,7 +32,7 @@ CalculateByrnaUsage:
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00
PLX
++
LDA $7EF36E ; thing we wrote over
LDA CurrentMagic ; thing we wrote over
JML IncrementMagicUseCounterByrna
;--------------------------------------------------------------------------------
CalculateCapeUsage:

View File

@@ -12,10 +12,13 @@ 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 $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters
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
.notHeart
@@ -61,16 +64,13 @@ DrawHeartPieceGFX:
.skipLoad
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
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
@@ -94,6 +94,7 @@ DrawHeartContainerGFX:
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 +
@@ -107,6 +108,11 @@ 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
@@ -130,17 +136,22 @@ HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
RTL
.normal_behavior
LDA $7EF280, X
LDA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
SaveHeartCollectedStatus:
LDA !SKIP_HEART_SAVE : BEQ .normal_behavior
LDA !SKIP_HEART_SAVE : BEQ .save_flag
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 $7EF280, X : ORA.b #$40 : STA $7EF280, X
LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
@@ -153,6 +164,7 @@ HeartPieceSpritePrep:
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartPieceRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -166,6 +178,7 @@ HeartContainerSpritePrep:
PHA
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartContainerRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -185,7 +198,14 @@ RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HPItemReset:
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
PHA
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip
PLA
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
BRA .done
.skip
PLA
.done
PHA : LDA #$01 : STA !REDRAW : PLA
RTL
;--------------------------------------------------------------------------------
@@ -195,11 +215,17 @@ MaybeMarkDigSpotCollected:
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$2A : BNE +
LDA !HAS_GROVE_ITEM : ORA.w #$0001 : STA !HAS_GROVE_ITEM
LDA HasGroveItem : ORA.w #$0001 : STA HasGroveItem
+
PLP : PLA
RTL
;--------------------------------------------------------------------------------
HeartPieceSpawnDelayFix:
; 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>
@@ -214,7 +240,7 @@ macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
LDA.w #<ItemLabel>-<TableLabel>
JSL RetrieveValueFromEncryptedTable
PLX : STX $02 : PLX : STX $01
PLX : STX $02 : PLX : STX $00
PLP : PLX
?done:
endmacro
@@ -268,7 +294,10 @@ LoadOutdoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$03 : BNE +
CMP.w #$00 : BNE +
LDA.l OWBonkPrizeTable[$00].loot
JMP .done
+ CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)
JMP .done
@@ -276,14 +305,92 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(EtherItem, SpriteItemValues)
JMP .done
+ CMP.w #$05 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Mountain_Warp, HeartPieceOutdoorValues)
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[$11].loot
JMP .done
+ CMP.w #$1D : BNE +
LDA.l OWBonkPrizeTable[$12].loot
JMP .done
+ CMP.w #$1E : BNE +
LDA.l OWBonkPrizeTable[$13].loot
JMP .done
+ CMP.w #$28 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Maze, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$2A : BNE +
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$14].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$15].loot
JMP .done
++
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$2B : BNE +
LDA.l OWBonkPrizeTable[$16].loot
JMP .done
+ CMP.w #$2E : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$17].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$18].loot
JMP .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
%GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues)
@@ -291,6 +398,13 @@ LoadOutdoorValue:
++
%GetPossiblyEncryptedItem(BombosItem, SpriteItemValues)
JMP .done
+ CMP.w #$32 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$19].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$1A].loot
JMP .done
+ CMP.w #$35 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Lake, HeartPieceOutdoorValues)
JMP .done
@@ -298,17 +412,68 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(HeartPiece_Swamp, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$42 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
JMP .done
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1B].loot
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[$1C].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$1D].loot
JMP .done
+ CMP.w #$54 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$1E].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$1F].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$20].loot
JMP .done
+ CMP.w #$55 : BNE +
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$21].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$22].loot
JMP .done
+ CMP.w #$56 : BNE +
LDA.l OWBonkPrizeTable[$23].loot
JMP .done
+ CMP.w #$5B : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Pyramid, HeartPieceOutdoorValues)
LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++
LDA.l OWBonkPrizeTable[$24].loot
JMP .done
++
%GetPossiblyEncryptedItem(HeartPiece_Pyramid, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$5E : BNE +
LDA.l OWBonkPrizeTable[$25].loot
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[$26].loot
JMP .done
++ CMP.w #$0008 : BNE ++
LDA.l OWBonkPrizeTable[$27].loot
JMP .done
++
LDA.l OWBonkPrizeTable[$28].loot
JMP .done
+ CMP.w #$74 : BNE +
LDA.l OWBonkPrizeTable[$29].loot
JMP .done
+ CMP.w #$81 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Zora, HeartPieceOutdoorValues)
JMP .done
@@ -414,3 +579,268 @@ 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 #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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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 : 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
}

543
hooks.asm
View File

@@ -1,3 +1,10 @@
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
;--------------------------------------------------------------------------------
@@ -38,11 +45,33 @@ JML.l CheckZSNES
ReturnCheckZSNES:
;--------------------------------------------------------------------------------
;================================================================================
; Ok so basically, in rare cases, major glitches may try to read far into the
; A bus until they reach a value of $FFFF
; For maximum security of vanilla behavior, I am reserving this space
; that could otherwise be considered free ROM.
;--------------------------------------------------------------------------------
org $0089C2
dw $FFFF, $FFFF, $FFFF, $FFFF
dw $FFFF, $FFFF, $FFFF, $FFFF
dw $FFFF, $FFFF, $FFFF, $FFFF
;================================================================================
; BSOD for BRK and COP opcodes
;--------------------------------------------------------------------------------
org $00FFB7
SoftwareInterrupt:
JML Crashed
org $00FFE4 : dw SoftwareInterrupt
org $00FFE6 : dw SoftwareInterrupt
org $00FFF4 : dw SoftwareInterrupt
;================================================================================
; Dungeon Entrance Hook (works, but not needed at the moment)
;--------------------------------------------------------------------------------
;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
;JSL.l OnDungeonEntrance
org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
JSL.l OnDungeonEntrance
;--------------------------------------------------------------------------------
;================================================================================
@@ -159,6 +188,9 @@ db Password_Tilemap>>16
org $0CD527 ; <- 65527 : Bank0C.asm : 2913 (LDA.w #$0004 : STA $02) [LDA.w #$0006 : STA $02]
JSL.l DrawPlayerFile : NOP ; hijack hearts draw routine to draw a full inventory
; Random incredible patch that I should add right now - File Select Fairy
org $1BF029+1 : db $10
org $0ccdd5 ; Bank0C.asm:1881 (LDX.w #$00FD)
JSL.l AltBufferTable : NOP #8 ; Selection screen
org $0cd393 ; Bank0c.asm:2674 (LDX.w #$00FD)
@@ -214,6 +246,8 @@ LDA.l HeartCursorPositions, X
org $0CDAEB ; <- 65AEB : Bank0C.asm : 3571-3575,3581-3587 (...) [LDA $0B12 : AND #$03]
; JP here is different. Indicated line number implement the US version of the same functionality
JSL.l WrapCharacterPosition : NOP
org $0CD75E ; bank_0C.asm (dl NameFile_MakeScreenVisible)
dl MaybeForceFileName
;--------------------------------------------------------------------------------
org $0CE43A ; No assembly source. Makes name entry box wider
db $2C
@@ -308,9 +342,8 @@ org $0CCE85 ; <- Bank0C.asm : 1953 (LDA $C8 : ASL A : INC #2 : STA $701FFE)
NOP #4
;--------------------------------------------------------------------------------
org $0CDB4C ; <- Bank0C.asm : 3655 (LDA $C8 : ASL A : INC #2 : STA $701FFE : TAX)
JSL OnFileCreation
JML OnFileCreation
NOP
;Additionally, display inventory swap starting equipment on file select
;--------------------------------------------------------------------------------
org $09F5EA ; <- module_death.asm : 510 (LDA $701FFE : TAX : DEX #2)
LDA.w #$0002 : NOP
@@ -417,8 +450,12 @@ 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 $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 $04E7B9 ; <- bank0E.asm : 4237 (LDX $04C8)
JMP.w TurtleRockTrollPegs
@@ -435,9 +472,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
@@ -531,17 +568,13 @@ JSL.l CheckGanonHammerDamage : NOP
org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10)
JSL.l StatsFinalPrep
;--------------------------------------------------------------------------------
org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomData)
org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomDataWRAM)
JSL.l IncrementUWMirror
;--------------------------------------------------------------------------------
org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646)
JSL.l IndoorSubtileTransitionCounter
NOP #2
;--------------------------------------------------------------------------------
org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9)
JSL.l IncrementChestCounter
NOP
;--------------------------------------------------------------------------------
;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
;JSL.l IncrementSmallKeys
;--------------------------------------------------------------------------------
@@ -709,7 +742,7 @@ JSL.l GetItemDamageValue
;================================================================================
; Misc Stats
;--------------------------------------------------------------------------------
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData.justKeys)
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomDataWRAM.justKeys)
JSL.l OnAga2Defeated
;--------------------------------------------------------------------------------
org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees)
@@ -810,10 +843,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)
@@ -825,7 +858,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
;--------------------------------------------------------------------------------
@@ -951,6 +984,10 @@ NOP
org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem)
JSL.l AddReceivedItemExpanded
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)
@@ -1000,6 +1037,11 @@ 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
@@ -1251,6 +1293,9 @@ 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
@@ -1258,10 +1303,9 @@ NOP #2
org $05F55F ; <- 2F55F - sprite_potion_shop.asm : 59
JSL.l LoadPowder
;--------------------------------------------------------------------------------
org $05F681 ; <- 2F681 - sprite_potion_shop.asm : 234
JSL.l DrawPowder
org $05F67B ; <- 2F67B - sprite_potion_shop.asm : 234
JSL DrawPowder
RTS
NOP #8
;--------------------------------------------------------------------------------
org $05F65D ; <- 2F65D - sprite_potion_shop.asm : 198
JSL.l CollectPowder
@@ -1277,6 +1321,34 @@ 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
@@ -1672,7 +1744,7 @@ JSL.l FixAga2Bunny : NOP
; Open Mode Fixes
;--------------------------------------------------------------------------------
org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5)
JSL.l SetUncleRainState : RTS
NOP #6
;--------------------------------------------------------------------------------
;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors)
;JSL.l ForceLinksHouse
@@ -1712,6 +1784,17 @@ 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
;--------------------------------------------------------------------------------
@@ -1772,13 +1855,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)
JSL.l GetCrystalNumber
LDA.l CrystalNumberTable-1, X
;================================================================================
; EVERY INSTANCE OF STA $7EF3C7 IN THE ENTIRE CODEBASE
org $029D51 ; <- 11D51
@@ -1814,34 +1897,35 @@ JSL.l GetMapMode
org $0AC01A ; <- 5401A
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
;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 $0DC849 ; <- 6C849
JSL.l GetMapMode
@@ -1851,15 +1935,11 @@ NOP #8
;org $0AC012 ; <- 54012 - Bank0A.asm:1039 - (LDA $7EF2DB)
;JSL.l OnLoadMap
;================================================================================
org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA)
JSL CheckHeraBossDefeated : BNE + : NOP
LDX.b #$F1 : STX $012C
+
org $028B8F ; <- 10B8F - Bank02.asm:2236 (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 $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A)
JSL CheckHeraBossDefeated : NOP
;================================================================================
org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA)
NOP #6 ; remove crystal room cutscene check that causes softlocks
@@ -2048,8 +2128,18 @@ 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)
JSL.l PostItemAnimation : NOP #2
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 $1EE90A ; <- F690A
JSL.l ItemCheck_OldMan
@@ -2095,7 +2185,7 @@ JSL.l ItemCheck_TreeKid2
org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
;NOP #8
LDA !HAS_GROVE_ITEM : AND.b #$01
LDA HasGroveItem : AND.b #$01
db #$D0 ; BNE
org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
@@ -2177,8 +2267,12 @@ 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
;--------------------------------------------------------------------------------
@@ -2212,6 +2306,12 @@ 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
@@ -2250,18 +2350,20 @@ 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
@@ -2295,17 +2397,18 @@ org $02EC2E ;<- 016C2E
JSL.l Overworld_LoadNewTiles
NOP #$02
;================================================================================
org $07A3E2 ;<- 3A3E2 Bank07.asm:5764 (LDA.b #$80 : STA $03F0)
JSL.l FreeDuckCheck : BEQ +
NOP
skip 3 ; a JSR we need to keep
+
; org $07A3E2 ;<- 3A3E2 Bank07.asm:5764 (LDA.b #$80 : STA $03F0)
; JSL.l FreeDuckCheck : BEQ +
; NOP
; skip 3 ; a JSR we need to keep
; +
;================================================================================
org $07A9AC ; <- 3A9AC - Bank07.asm:6628 (LDA $0C : ORA $0E : STA $00 : AND.b #$0C : BEQ BRANCH_BETA)
JML.l MirrorBonk
JML MirrorBonk
MirrorBonk_NormalReturn:
org $07A9D1 ; <- 3A9D1 - Bank07.asm:6649 (BRANCH_GAMMA:)
MirrorBonk_BranchGamma:
JML OWMirrorSpriteBonk
;================================================================================
;================================================================================
@@ -2346,6 +2449,9 @@ 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
;--------------------------------------------------------------------------------
@@ -2389,15 +2495,13 @@ Overworld_Hole_End:
;--------------------------------------------------------------------------------
;================================================================================
; Disable pyramid hole check for killing aga2
; Replace pyramid hole check for killing aga2
;
; this check is intended to prevent getting fluted out a second time if you
; return to his room after already killing him once. But with a pre-opened
; pyramid hole, it can cause you to get stuck there on killing him the first
; time. So we change it, and accept the flute out if you return.
; return to his room after already killing him once.
;---------------------------------------------------------------------------------
org $01C753 ; 0C753 = Bank01:10398 (LDA $7EF2DB : AND.b #$20 : BNE .return)
db $00 ; (originally $20)
org $01C74E ; 00C74E - bank_01.asm:13281 - (LDA.l $7EF2DB : AND.b #$20)
LDA.l Aga2Duck : NOP #2
;================================================================================
; Music fixes
@@ -2427,44 +2531,48 @@ dl Overworld_FinishMirrorWarp
;--------------------------------------------------------------------------------
org $0AB949 ; <- Bank0A.asm:270 (Different from US ROM)
JSL BirdTravel_LoadTargetAreaMusic
NOP #16
BRA + : NOP #14 : +
;--------------------------------------------------------------------------------
org $02B027 ; <- Bank02.asm:7535-7541
JSL Overworld_DetermineMusic
BRA + : NOP #42 : +
;================================================================================
;================================================================================
; 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:
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
ReloadingFloorsCancel:
JML ReloadingFloors
NOP : NOP
ReloadingFloorsResume:
org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit
ReloadingFloorsCancel:
;================================================================================
;================================================================================
@@ -2474,7 +2582,7 @@ org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA)
JSL.l ArrowGame : NOP #14
org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON)
JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377
JSL.l DecrementArrows : SKIP 2 : NOP : LDA CurrentArrows
;================================================================================
;================================================================================
@@ -2493,7 +2601,14 @@ 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:
CMP.b #$06 : db #$F0 ; BEQ
; 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
;--------------------------------------------------------------------------------
; 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)
@@ -2577,8 +2692,8 @@ JSL NewElderCode
;--------------------------------------------------------------------------------
; Add him to Castle Map post-rain, and post aga1
;--------------------------------------------------------------------------------
org $09D0AC
db #$18, #$0F, #$43, #$FF;remove heart from tree adjancent map [LW1]
org $09D0A9
db #$18, #$0A, #$D8, #$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
@@ -2661,11 +2776,9 @@ org $07839E ; bunny BAGE check
BunnyRead:
JSR.w $07B5A9 ; check A button
BCC .noA
JSR.w CheckIfReading
BNE .noread
JSR.w $07B4DB
NOP
.noread
JSL BunnyThrowPot
BRA .noA
NOP #3
.noA
org $07FFF4
@@ -2743,12 +2856,13 @@ org $0AEEF2
org $008BE5 ; hijack stripes for boss GFX transfer
JSL DoDungeonMapBossIcon
;================================================================================
org $01C4B8 : JSL FixJingleGlitch
org $01C536 : JSL FixJingleGlitch
org $01C592 : JSL FixJingleGlitch
org $01C65F : JSL FixJingleGlitch
;================================================================================
; 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
@@ -2829,6 +2943,9 @@ db $B2, $28, $B3, $28, $C2, $28, $C2, $68
org $079CE6 ; Bank07.asm@4632 (LDA #$80 : TSB $3A)
JSL CheckDetonateBomb
;--------------------------------------------------------------------------------
org $079D08 ; bank_07.asm@6068 (INC $3C : LDA $3C : CMP #$09)
JSL NoSwingHammerB : NOP #2
;--------------------------------------------------------------------------------
org $1EDCF8 ; bank_1E.asm@16086 (LDX $0202 : ...)
JSL SetBeeType
BRA + : NOP #15 : +
@@ -2845,6 +2962,11 @@ NOP #48
skip 11
.bee_valid_target
;--------------------------------------------------------------------------------
org $07F88C ; free rom from F877 - F88F; the starting part of this is used in quadrant glitch fix below, however.
Link_UseHammerLong:
JSR Link_UseHammer : RTL
warnpc $07F890
;--------------------------------------------------------------------------------
;================================================================================
; Variable Ganon Vulnerability
@@ -2871,36 +2993,183 @@ NOP
;--------------------------------------------------------------------------------
org $06ED70 ; Bank06.asm@4842 (LDA $06ED39, X : STA $0CF2)
JSL StoreSwordDamage
;================================================================================
; 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
org $01C536 : JSL FixJingleGlitch
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 $02D7D2 ; BEQ .face_up
NOP #2 ; this fixes Link's direction after mirroring and falling after entering through back of tavern
;--------------------------------------------------------------------------------
; Various nonsense
;--------------------------------------------------------------------------------
org $0780B9 ; LDA.b #$3A : STA.w $031F
JSL CalcIFrames
NOP
org $09814E ; LDA.w Bomb_timer : STA.w $039F, X
JSL SetBombTimer
NOP #2
org $07B282 ; LDA.b #$1D : STA.w $0374
JSL SetDashTimer
NOP
org $07A3E7 ; LDA.b #$13 : JSR PlaySFX_Set2 : ...
JSL ProcessFlute
BCS +
RTS
NOP #14 : +
org $08E073 ; LDA.b #$0E : STA.b $10
JSL FluteMap
org $07A329
JSL UseShovel
BCS +
RTS
NOP #4 : +
org $079D11
JSL SwordSwingDelay : NOP
org $079DAB
JSL SwordSwingDelay : NOP
org $079DEE
JSL SwordSwingDelay : NOP
org $088E4A
JSL MaybeRecoil
BRA + : NOP #6 : +
org $06EC4D
JSL MaybeRecoil2
BRA + : NOP #10 : +
; make moldorm check head for hitbox instead of tail
org $1DDADD
; BRA + : NOP #22 : +
BRA + : NOP #26 : +
org $1DDAF9
BRA + : NOP : +
org $1DDB01
BRA + : NOP #3 : +
; make moldorm repel sword when not stunned
org $06F354
JSL CheckMoldormRepel
BCC .not_moldorm
NOP
skip 17
.not_moldorm
; make mini moldorms faster
org $0697DF
db $30, $2C, $22, $12, $00, $EE, $DE, $D4
db $D0, $D4, $DE, $EE, $00, $12, $22, $2C
db $00, $12, $22, $2C, $30, $2C, $22, $12
db $00, $EE, $DE, $D4, $D0, $D4, $DE, $EE
; make lanmolas faster
org $05A4B7
LDA.b #$18
; ganon - silvers just don't work like they used to
org $0DB93D
db $08
; ganon - randomize vulnerability when stunned
org $1D9010
JSL StunGanon : NOP
; agahnim - pattern? we don't need no steenken pattern!
org $1ED637
JSL AgaDecision : NOP
; agahnim - no guaranteed normal balls
org $1ED6ED
NOP #2
; helmie's mask is brittle
org $1E8112
db $03, $03, $03, $03, $00
; vitreous - bombs work a bit better
org $0DB938
db $0C
; tile rooms - make them a bit faster
org $09BA20
LDA.b #$B8
org $1EBC56
LDA.b #$28

View File

@@ -1,5 +1,3 @@
RomVersionSRAM = $701FFC
;--------------------------------------------------------------------------------
; Init_Primary
;--------------------------------------------------------------------------------
@@ -24,7 +22,7 @@ Init_Primary:
LDX #$00
-
LDA $702000, X : CMP $00FFC0, X : BNE .clear
LDA RomNameSRAM, X : CMP $00FFC0, X : BNE .clear
INX
CPX #$15 : !BLT -
BRA .done
@@ -38,7 +36,7 @@ Init_Primary:
SEP #$30 ; set 8-bit accumulator & index registers
LDX #$00
-
LDA $00FFC0, X : STA $702000, X
LDA $00FFC0, X : STA RomNameSRAM, X
INX
CPX #$15 : !BLT -
LDX #$00
@@ -69,5 +67,6 @@ Init_PostRAMClear:
JSL MSUInit
JSL InitRNGPointerTable
JSL InitCompassTotalsRAM
JML $00D463 ; The original target of the jump table that we hijacked

174
initsramtable.asm Normal file
View File

@@ -0,0 +1,174 @@
;================================================================================
; Initial SRAM table.
;--------------------------------------------------------------------------------
; The ROM copies blocks of bytes from here on save file init. This table has an
; identical layout to the first $500 bytes of SRAM, although some values such as
; the file validity value, file name, and inverse checksum are skipped.
;
; NOTE: Set InitProgressIndicator to $80 for standard mode with instant post-aga
; world state
;
; See sram.asm for further documentation on how to write to this table.
;--------------------------------------------------------------------------------
fillword $0000 ; Zero out the table
fill $500 ;
org $30B000 ; PC 0x183000
InitRoomDataWRAM:
org $30B060 ; PC 0x183060
InitATAltarRoom: dw $0000 ; aga curtains
org $30B092 ; PC 0x183092
InitSWBackEntryRoom: dw $0000 ; skull woods curtains (?)
org $30B20C
dw $F000, $F000 ; Pre-open kak bomb hut & brewery
org $30B280 ; PC 0x183280 - 0x1832FF
InitOverworldEvents:
org $30B282 ; PC 0x183282 - Lumberjacks
InitLumberjackOW: db $00
org $30B29B ; PC 0x18329B - Open castle gate
InitHyruleCastleOW: db $20
org $30B2DB ; PC 0x1832DB - Pyramid hole
InitPyramidOW: db $00
org $30B2C3 ; PC 0x1832C3 - GT
InitDDMWestOW: db $00
org $30B340 ; PC 0x183340
StartingEquipment:
StartingBow: skip 1 ; PC 0x183340
StartingBoomerang: skip 1 ; PC 0x183341
StartingHookshot: skip 1 ; PC 0x183342
StartingBombs: skip 1 ; PC 0x183343
StartingPowder: skip 1 ; PC 0x183344
StartingFireRod: skip 1 ; PC 0x183345
StartingIceRod: skip 1 ; PC 0x183346
StartingBombos: skip 1 ; PC 0x183347
StartingEther: skip 1 ; PC 0x183348
StartingQuake: skip 1 ; PC 0x183349
StartingLamp: skip 1 ; PC 0x18334A
StartingHammer: skip 1 ; PC 0x18334B
StartingFlute: skip 1 ; PC 0x18334C
StartingBugNet: skip 1 ; PC 0x18334D
StartingBookOfMudora: skip 1 ; PC 0x18334E
StartingBottleIndex: skip 1 ; PC 0x18334F
StartingSomaria: skip 1 ; PC 0x183350
StartingByrna: skip 1 ; PC 0x183351
StartingCape: skip 1 ; PC 0x183352
StartingMirror: skip 1 ; PC 0x183353
StartingGlove: skip 1 ; PC 0x183354
StartingBoots: skip 1 ; PC 0x183355
StartingFlippers: skip 1 ; PC 0x183356
StartingMoonPearl: skip 1 ; PC 0x183357
skip 1 ; PC 0x183358
StartingSword: skip 1 ; PC 0x183359
StartingShield: skip 1 ; PC 0x18335A
StartingArmor: skip 1 ; PC 0x18335B
StartingBottleContentsOne: skip 1 ; PC 0x18335C
StartingBottleContentsTwo: skip 1 ; PC 0x18335D
StartingBottleContentsThree: skip 1 ; PC 0x18335E
StartingBottleContentsFour: skip 1 ; PC 0x18335F
StartingCurrentRupees: skip 2 ; PC 0x183360 \ Write same value to both
StartingDisplayRupees: skip 2 ; PC 0x183362 / of these
StartingCompasses: skip 2 ; PC 0x183364
StartingBigKeys: skip 2 ; PC 0x183366
StartingMaps: skip 2 ; PC 0x183368
skip 1 ; PC 0x18336A
StartingQuarterHearts: skip 1 ; PC 0x18336B
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
InitHeartsFiller: skip 1 ; PC 0x183372
InitMagicFiller: skip 1 ; PC 0x183373
StartingPendants: skip 1 ; PC 0x183374
InitBombsFiller: skip 1 ; PC 0x183375
InitArrowsFiller: skip 1 ; PC 0x183376
StartingArrows: skip 1 ; PC 0x183377
skip 1 ; PC 0x183378
InitAbilityFlags: db $68 ; PC 0x183379
StartingCrystals: skip 1 ; PC 0x18337A
StartingMagicConsumption: skip 1 ; PC 0x18337B
StartingDungeonKeys: ;
StartingSewerKeys: skip 1 ; PC 0x18337C
StartingHyruleCastleKeys: skip 1 ; PC 0x18337D
StartingEasternKeys: skip 1 ; PC 0x18337E
StartingDesertKeys: skip 1 ; PC 0x18337F
StartingCastleTowerKeys: skip 1 ; PC 0x183380
StartingSwampKeys: skip 1 ; PC 0x183381
StartingPalaceOfDarknessKeys: skip 1 ; PC 0x183382
StartingMireKeys: skip 1 ; PC 0x183383
StartingSkullWoodsKeys: skip 1 ; PC 0x183384
StartingIcePalaceKeys: skip 1 ; PC 0x183385
StartingHeraKeys: skip 1 ; PC 0x183386
StartingThievesTownKeys: skip 1 ; PC 0x183387
StartingTurtleRockKeys: skip 1 ; PC 0x183388
StartingGanonsTowerKeys: skip 1 ; PC 0x183389
skip 1 ; PC 0x18338A
StartingGenericKeys: skip 1 ; PC 0x18338B
InitInventoryTracking: skip 2 ; PC 0x18338C \ Need to set bits here for silver arrows,
InitBowTracking: skip 2 ; PC 0x18338E / boomerangs, powder/mushroom, etc
InitItemLimitCounts: skip 16 ; PC 0x183390
skip 37 ;
InitProgressIndicator: db $02 ; PC 0x1833C5 - Set to $80 for instant post-aga with standard
InitProgressFlags: db $14 ; PC 0x1833C6 - Set to $00 for standard
InitMapIcons: skip 1 ; PC 0x1833C7
InitStartingEntrance: db $01 ; PC 0x1833C8 - Set to $00 for standard
InitNpcFlagsVanilla: skip 1 ; PC 0x1833C9
InitCurrentWorld: skip 1 ; PC 0x1833CA
skip 1 ; PC 0x1833CB
InitFollowerIndicator: skip 1 ; PC 0x1833CC
InitFollowerXCoord: skip 2 ; PC 0x1833CD
InitFollowerYCoord: skip 2 ; PC 0x1833CF
InitDroppedFollowerIndoors: skip 1 ; PC 0x1833D1
InitDroppedFollowerLayer: skip 1 ; PC 0x1833D2
InitFollowerDropped: skip 1 ; PC 0x1833D3
org $30B3D9 ; PC 0x1833D9 - 0x1833F0
StaticFileName: ; The validity value ($55AA) must be written manually on SRAM init at $7003E1
dw $0181, $0162, $0168, $018C
dw $0166, $014E, $0162, $018C
dw $0165, $0162, $0167, $018C
org $30B401 ; PC 0x183401
InitDeathCounter:
dw $FFFF
;--------------------------------------------------------------------------------
; The following labels and their addresses are provided for convenience. You
; may want to write, for example, to InitHighestSword in addition to setting
; StartingSword. But any value can be written to the whole block from
; $30B000-$30B4FF (PC 0x183000-0x18034FF) and it will be initialized
; excluding ~28 bytes (File name, validity value, and checksum.)
;--------------------------------------------------------------------------------
org $30B414 ; PC 0x183414-0x183416
InitMapOverlay: dw $0000
org $30B417 ; PC 0x183417
InitHighestSword: db $00
org $30B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422
InitHighestShield: db $00
org $30B428 ; PC 0x183428
InitMapsCompasses: db $00
org $30B429 ; PC 0x183429
InitPendantCounter: db $00
org $30B454 ; PC 0x183454-0x183457
InitChallengeTimer: dw $0000, $0000
org $30B46E ; PC 0x18346E
InitHighestMail: db $00
org $30B471 ; PC 0x183471
InitCrystalCounter: db $00

File diff suppressed because it is too large Load Diff

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:
LDA.l InvertedMode : BNE +
PHX : LDX $8A : LDA.l OWTileMapAlt, X : PLX : AND.b #$01 : BNE +
JMP .originalBehaviour
+
.invertedBehavior
@@ -71,7 +71,7 @@ Overworld_CreatePyramidHoleModified:
SEP #$30
LDA $7EF2DB : ORA.b #$20 : STA $7EF2DB
LDA OverworldEventDataWRAM+$5B : ORA.b #$20 : STA OverworldEventDataWRAM+$5B
LDA.b #$03 : STA $012F
@@ -80,7 +80,7 @@ Overworld_CreatePyramidHoleModified:
RTL
;------------------------------------------------------------------------------
Draw_PyramidOverlay:
LDA.l InvertedMode : AND.w #$00FF : BNE .done
PHX : LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : PLX : AND.w #$0001 : BNE .done
.normal
LDA.w #$0E39 : STA $23BC
INC A : STA $23BE
@@ -130,15 +130,15 @@ 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 InvertedMode : BEQ .done
LDA $7EF280, X : ORA #$40 : STA $7EF280, X ;set barrier dead
LDA SwapAgaGanonsTower : BEQ .done
LDA OverworldEventDataWRAM, X : ORA #$40 : STA OverworldEventDataWRAM, X ;set barrier dead
.done
LDA $7EF280, X ; what we wrote over
LDA OverworldEventDataWRAM, X ; what we wrote over
RTL
GanonTowerAnimation:
LDA InvertedMode : BEQ .done
LDA SwapAgaGanonsTower : BEQ .done
LDA.b #$1B : STA $012F
STZ $04C6
STZ $B0
@@ -162,7 +162,7 @@ RTL
GanonTowerInvertedCheck:
{
LDA InvertedMode : BEQ .done
LDA SwapAgaGanonsTower : BEQ .done
LDA #$01 ; Load a random value so it doesn't BEQ
RTL
.done
@@ -174,7 +174,7 @@ GanonTowerInvertedCheck:
;Hard coded rock removed in LW for Inverted mode
HardcodedRocks:
LDA InvertedMode : AND.w #$00FF : BEQ .normalrocks
LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : AND.w #$0001 : BEQ .normalrocks
BRA .noRock2
.normalrocks
LDA.w #$020F : LDX $8A : CPX.w #$0033 : BNE .noRock
@@ -186,8 +186,8 @@ HardcodedRocks:
RTL
TurtleRockPegSolved:
LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.l $7ef287 ; What we wrote over (reading flags for this screen)
PHX : LDA $8A : AND.w #$00FF : TAX : LDA.l OWTileMapAlt, X : PLX : AND.w #$0001 : BNE +
LDA.l OverworldEventDataWRAM+07 ; What we wrote over (reading flags for this screen)
RTL
+
LDA.w #$0020 ; We always treat puzzle as pre solved (overlay flag set) for inverted mode.
@@ -195,14 +195,17 @@ RTL
MirrorBonk:
; must preserve X/Y, and must preserve $00-$0F
LDA.l InvertedMode : BEQ .normal
PHX : LDX $8A : LDA.l OWTileMapAlt, X : PLX : AND.b #$01 : 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
LDA $8A : AND.b #$40 : BEQ .endLoop ;World we're in? branch if we are in LW we don't want bonks
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
REP #$30
LDX #$0000
.loop

File diff suppressed because it is too large Load Diff

View File

@@ -17,10 +17,10 @@ ItemDowngradeFixMain:
CPY.b #$0B : BEQ .isBow ; Bow
CPY.b #$3A : BEQ .isBowAndArrows ; Bow
CPY.b #$49 : BEQ .isFightersSword ; Fighter's Sword
CPY.b #$01 : BEQ .isMasterSword ; Master Sword
CPY.b #$50 : BEQ .isMasterSword ; Master Sword (Safe)
CPY.b #$02 : BEQ .isTemperedSword ; Tempered Sword
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
@@ -29,8 +29,7 @@ ItemDowngradeFixMain:
CPY.b #$13 : BEQ .isShovel ; Shovel
CPY.b #$29 : BEQ .isMushroom ; Mushroom
CPY.b #$B1 : !BLT + : CPY.b #$B6 : !BLT .isBombUpgrade : +
CPY.b #$B7 : !BLT + : CPY.b #$BC : !BLT .isCaneUpgrade : +
CPY.b #$00 : BEQ .isUncleSwordShield ; Fighter's Sword & Shield
.done
STA [$00] ; thing we wrote over part 2
@@ -59,40 +58,24 @@ RTS
+
PLA
RTS
.isFightersSword
.isMasterSword
.isTemperedSword
.isSword
PHA
LDA HighestSword : 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
INC : CMP !HIGHEST_SWORD_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA !HIGHEST_SWORD_LEVEL : DEC ; convert to item id
TAY : PLA : LDA !HIGHEST_SWORD_LEVEL ; put sword id into the thing to write
INC : CMP $04 : !BGE + ; skip if highest is lower (this is an upgrade)
LDA $04 : DEC ; convert to item id
TAY : PLA : LDA $04 ; put sword id into the thing to write
JMP .done
+
PLA
JMP .done
.isBombUpgrade
.isUncleSwordShield
PHA
TYA ; load bomb upgrade item
!SUB #$B0 ; convert to bomb level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B0 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put bomb level into the thing to write
JMP .done
+
LDA HighestSword : STA [$00] ; already set to 1 if we had no sword, always keep highest
INC $00
LDA HighestShield : STA [$00]
PLA
JMP .done
.isCaneUpgrade
PHA
TYA ; load cane upgrade item
!SUB #$B6 ; convert to cane level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B6 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put cane level into the thing to write
JMP .done
+
PLA
JMP .done
RTS
;================================================================================

113
itemtext_lower.asm Normal file
View File

@@ -0,0 +1,113 @@
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

180
keydrop/dynamic_si_vram.asm Normal file
View File

@@ -0,0 +1,180 @@
; where we shove the decompressed graphics to send to WRAM
DynamicDropGFX = $7EF500
; 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
; this will keep track of the above for each item
SprItemGFX = $7E0780
; this is the item requested and a flag
DynamicDropRequest = $7E1E71
DynamicDropQueue = $7E1E72
; Come in with
; A = item receipt ID
; X = slot
RequestStandingItemVRAMSlot:
STA.w DynamicDropQueue
LDA.b #$01
STA.w DynamicDropRequest
LDA.w DynamicDropGFXIndex
INC
CMP.b #$05 : BCC .fine
LDA.b #$00
.fine
STA.w DynamicDropGFXIndex
STA.w SprItemGFX,X
; decompress graphics
PHX
LDX.w DynamicDropQueue
REP #$20
LDA.w #DynamicDropGFX-$7E9000
STA.l !TILE_UPLOAD_OFFSET_OVERRIDE
SEP #$20
LDA.w DynamicDropQueue
JSL.l GetSpriteID
JSL.l GetAnimatedSpriteTile_variable
SEP #$30
PLX
RTL
;===================================================================================================
TransferPotGFX:
SEP #$10
REP #$20
LDX.w DynamicDropRequest
BEQ .no
STZ.w DynamicDropRequest
LDA.w DynamicDropGFXIndex
ASL
TAX
LDA.l FreeUWGraphics,X
STA.w $2116
; calculate bottom row now
CLC : ADC.w #$0200>>1 : PHA
LDX.b #$7E : STX.w $4314
LDA.w #DynamicDropGFX : 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
.no
RTL
FreeUWGraphics:
dw $8800>>1
dw $8840>>1
dw $8980>>1
dw $9CA0>>1
dw $9DC0>>1
; dw $8800>>1
; dw $8840>>1
; dw $8980>>1
; dw $9960>>1 # Arghuss Splash apparently
; dw $9C00>>1
; dw $9CA0>>1
; dw $9DC0>>1
;===================================================================================================
DrawPotItem:
JSL.l IsNarrowSprite : BCS .narrow
.full
LDA.b #$01 : STA $06
LDA #$0C : JSL.l OAM_AllocateFromRegionC
LDA #$02 : PHA
REP #$20
LDA.w #DynamicOAMTile_full
BRA .draw
.narrow
LDA.b #$02 : STA $06
LDA #$10 : JSL.l OAM_AllocateFromRegionC
LDA #$03 : PHA
REP #$20
LDA.w #DynamicOAMTile_thin
.draw
PHB : PHK : PLB
STA.b $08
LDA.w SprItemGFX,X
AND.w #$00FF
ASL : ASL : ASL : ASL
ADC.b $08
STA.b $08
SEP #$20
STZ.b $07
LDA.b #$00 : STA.l !SKIP_EOR
JSL Sprite_DrawMultiple_quantity_preset
LDA.b $90 : CLC : ADC.b #$08 : STA.b $90
INC.b $92
INC.b $92
PLB
PLA
RTL
DynamicOAMTile_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 $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
DynamicOAMTile_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 $E5, $00, $20, $02
dd 0, 0
dw -4, -1 : db $EE, $00, $20, $02
dd 0, 0

656
keydrop/standing_items.asm Normal file
View File

@@ -0,0 +1,656 @@
; hooks
org $81E6B0
JSL RevealPotItem
RTS
org $829C25
JSL SetTheSceneFix
org $89C2BB
JSL ClearSpriteData
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 $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
+ 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
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
; 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 reswamturn 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 reswamturn 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 duning 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
PHA
JSL.l GetSpritePalette : STA $0F50, X ; setup the palette
PLA
CMP #$24 : BNE ++ ;
LDA $A0 : CMP.b #$80 : BNE +
LDA SpawnedItemFlag : BNE +
LDA #$24 ; it's the big key drop?
++ JSL RequestStandingItemVRAMSlot
+ PLA
RTL
SpriteKeyDrawGFX:
JSL Sprite_DrawRippleIfInWater
PHA
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 DrawPotItem
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+ JSL.l Sprite_DrawShadowLong
PLA : RTL
KeyGet:
LDA CurrentSmallKeys ; what we wrote over
PHA
LDA.l 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
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
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
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

@@ -7,17 +7,14 @@ LampCheck:
LDA $7F50C4 : CMP.b #$01 : BNE + : RTL : +
CMP.b #$FF : BNE + : INC : RTL : +
LDA $7EF34A : BNE .done ; skip if we already have lantern
LDA $7EF3CA : BNE +
.lightWorld
LDA $040C : BNE ++ ; check if we're in sewers
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 LampConeSewers : BRA .done
++
LDA LampConeLightWorld : BRA .done
+
.darkWorld
LDA LampConeDarkWorld
+ LDA CurrentWorld : BNE +
LDA LampConeLightWorld : BRA .done
+ LDA LampConeDarkWorld
.done
;BNE + : STZ $1D : + ; remember to turn cone off after a torch
RTL
@@ -26,20 +23,17 @@ RTL
; Output: 0 locked, 1 open
;--------------------------------------------------------------------------------
CheckForZelda:
;LDA.l OpenMode : BEQ + ; Skip if not open mode
;LDA $FFFFFF
LDA.l $7EF3C5 : CMP.b #$02 : !BLT + ; Skip if rain is falling
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
LDA.b #$01 ; pretend we have zelda anyway
RTL
+
LDA $7EF3CC
LDA FollowerIndicator
RTL
;================================================================================
;--------------------------------------------------------------------------------
SetOverlayIfLamp:
;LDA $7EF34A ; check if lamp
JSL.l LampCheck
STA $1D ; write it directly to the overlay, this isn't a terrible idea at all
RTL
;================================================================================
;LDA $7EF3CA : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world
;LDA CurrentWorld : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world

View File

@@ -14,14 +14,12 @@ MaidenCrystalScript:
; Load the dungeon index. Is it the Dark Palace?
;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE +
; LDA $7EF3C7 : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA $7EF3C7 : ++
; LDA MapIcons : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA MapIcons : ++
;+
LDA $7EF37A : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA $7EF3C7 ; Update the map icon to just be Ganon's Tower
LDA CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA MapIcons ; Update the map icon to just be Ganon's Tower
+
JSL.l MaybeWriteSRAMTrace
JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
;--------------------------------------------------------------------------------

View File

@@ -2,11 +2,21 @@
; Mantle Object Changes
;--------------------------------------------------------------------------------
Mantle_CorrectPosition:
LDA $7EF3C6 : AND.b #$04 : BEQ +
LDA.l ProgressFlags : AND.b #$04 : BNE .spawnOpen
LDA.l StartingEntrance : CMP.b #$04 : BNE +
.spawnOpen
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
+
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

@@ -6,7 +6,7 @@ TryOpenMire:
LDA $8A : CMP.b #$70 : BNE .untriggered
; Checks whether the Misery Mire dungeon is already revealed.
LDA $7EF2F0 : AND.b #$20 : BNE .untriggered
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
@@ -25,7 +25,7 @@ TryOpenTRock:
LDA $8A : CMP.b #$47 : BNE .untriggered
; Checks whether the Turtle Rock dungeon is already revealed.
LDA $7EF2C7 : AND.b #$20 : BNE .untriggered
LDA OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
@@ -73,4 +73,4 @@ MedallionTrigger_Quake:
+
PLA
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

23
menu/hudalpha.asm Normal file
View File

@@ -0,0 +1,23 @@
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"

BIN
menu/menuonly.2bpp Normal file

Binary file not shown.

300
menu/overworldmap.asm Normal file
View File

@@ -0,0 +1,300 @@
; 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

54
msu.asm
View File

@@ -76,7 +76,7 @@
;
; Additional tracks
;
; 60 - Light World OW (after ped pull)
; 60 - Light World OW (after aga kill)
; 61 - Dark World OW (with all crystals)
;
;=======================================
@@ -237,6 +237,7 @@ 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
@@ -248,25 +249,30 @@ CheckMusicLoadRequest:
;.boss
LDA $040C : LSR : !ADD.b #45
BRA .check_fallback-3
.no_change
PLA : BRA .check_fallback-3
.lightworld
PHA
LDA $7EF300 : AND.b #$40 : BEQ +
PLA
LDA.b #60 : BRA .check_fallback-3
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
+
-- : PLA : BRA .check_fallback-3
LDA CrystalsField : CMP.b #$7F : BNE .no_change
BRA -
.darkworld
PHA
LDA $7EF37A : CMP.b #$7F : BNE --
- : PLA
LDA.b #61 : BRA .check_fallback-3
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 -
.darkwoods
PHA
LDA $7EF37A : CMP.b #$7F : BEQ -
LDA $7EF3CA : BEQ --
LDA $8A : CMP #$40 : BNE --
PLA
LDA.b #15 : BRA .check_fallback-3
LDA.b #15 : PHA
LDX $8A : LDA.l OWTileWorldAssoc,X : BEQ +
PLA : BRA .darkworld
+ PLA : BRA .lightworld
.castle
LDA $040C
CMP.b #$08 : BNE .check_fallback ; Hyrule Castle 2
@@ -344,10 +350,10 @@ CheckMusicLoadRequest:
+
CMP.b #$70 : BNE + ; Misery Mire
LDA $7EF2F0 : AND.b #$20 : BEQ .rain
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BEQ .rain
+
LDA $7EF3C5 : CMP.b #$02 : BCS +
LDA ProgressIndicator : CMP.b #$02 : BCS +
.rain
LDX.b #$01
+
@@ -371,6 +377,7 @@ CheckMusicLoadRequest:
;--------------------------------------------------------------------------------
SpiralStairsPreCheck:
REP #$20 ; thing we wrote over
LDA.l DRMode : BNE .done ; exit if door rando enabled
LDA $A0
CMP.w #$000C : BNE +
LDA !REG_CURRENT_MSU_TRACK : AND.w #$00FF : CMP.w #59 : BNE .done
@@ -385,7 +392,7 @@ SpiralStairsPreCheck:
LDA !REG_MSU_ID_45 : CMP !VAL_MSU_ID_45 : BNE .done
+
LDA $7EF366 : AND.w #$0004 : BEQ .done ; Check that we have the GT big key
LDA BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key
LDA !REG_MSU_FALLBACK_TABLE+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track
.fade
@@ -400,6 +407,7 @@ SpiralStairsPreCheck:
; Change music on stair transition (ToH/GT)
;--------------------------------------------------------------------------------
SpiralStairsPostCheck:
LDA.l DRMode : BNE .done ; exit if door rando enabled
LDA $A0
CMP.w #$000C : BNE +
; Ganon's tower entrance
@@ -517,16 +525,16 @@ PHA : XBA : PHA
; dont save if we already saved recently
REP #$20
LDA !MSU_RESUME_TRACK : AND #$00FF : BEQ ++
LDA !NMI_COUNTER : !SUB !MSU_RESUME_TIME : PHA
LDA !NMI_COUNTER+2 : SBC !MSU_RESUME_TIME+2 : BNE +++
LDA NMIFrames : !SUB !MSU_RESUME_TIME : PHA
LDA NMIFrames+2 : SBC !MSU_RESUME_TIME+2 : BNE +++
PLA : CMP MSUResumeTimer : !BLT .too_early
BRA ++
+++
PLA
++
; saving
LDA !NMI_COUNTER : STA !MSU_RESUME_TIME
LDA !NMI_COUNTER+2 : STA !MSU_RESUME_TIME+2
LDA NMIFrames : STA !MSU_RESUME_TIME
LDA NMIFrames+2 : STA !MSU_RESUME_TIME+2
SEP #$20
LDA !MSU_LOADED_TRACK : STA !MSU_RESUME_TRACK
@@ -683,8 +691,8 @@ MSUMain:
PLX
TXA : CMP !MSU_RESUME_TRACK : BNE + ; dont resume if too late
REP #$20
LDA !NMI_COUNTER : !SUB !MSU_RESUME_TIME : PHA
LDA !NMI_COUNTER+2 : SBC !MSU_RESUME_TIME+2 : BNE ++
LDA NMIFrames : !SUB !MSU_RESUME_TIME : PHA
LDA NMIFrames+2 : SBC !MSU_RESUME_TIME+2 : BNE ++
PLA : CMP MSUResumeTimer : !BGE +++
SEP #$20
LDA !FLAG_RESUME_FADEIN : BRA .done_resume

285
multiworld.asm Normal file
View File

@@ -0,0 +1,285 @@
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
JSL Link_ReceiveItem ; thing we wrote over
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
}

525
multiworldplayernames.asm Normal file
View File

@@ -0,0 +1,525 @@
;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

281
music.asm
View File

@@ -3,77 +3,20 @@ PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
JSR.w FixFrogSmith ; Just a convenient spot to install this hook
JSL.l 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 .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks
CMP.b #$43 : BEQ +
CMP.b #$45 : BEQ +
CMP.b #$47 : BEQ +
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 $7EF3C5 : 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 $7EF300 : 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 $7EF3C5 : 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 $7EF3CA : 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 $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA $7EF357 : BNE +
LDX.b #$04 ; bunny theme
+
;LDA CurrentWorld : BEQ .checkInverted+4
+ JSL Overworld_DetermineMusic
.lastCheck
LDA $0132 : CMP.b #$F2 : BNE +
@@ -114,58 +57,12 @@ Overworld_FinishMirrorWarp:
LDA.b #$80 : STA $9B
LDX.b #$04 ; bunny theme
JSL Overworld_DetermineAmbientSFX
JSL Overworld_DetermineMusic
; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ +
LDA $7EF357 : 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 $7EF300 : 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 $7EF3C5 : CMP.b #$03 : !BGE .endOfLightWorldChecks
LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks
.done
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 $7EF357 : ORA InvertedMode : BNE +
LDX #$04 ; bunny theme
+
STX $012C
.notDarkMountain
LDA $11 : STA $010C
STZ $11
@@ -178,78 +75,85 @@ Overworld_FinishMirrorWarp:
;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic:
; 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
JSL Overworld_DetermineAmbientSFX
JSL Overworld_DetermineMusic
STZ $04C8 ; Clear peg puzzle count
RTL
;--------------------------------------------------------------------------------
LDX.b #$07 ; Default village theme
;--------------------------------------------------------------------------------
;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
; Check what phase we're in
;LDA $7EF3C5 : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3)
;+
LDX.b #$02 ; hyrule field theme
LDA CurrentWorld : BEQ +
LDX.b #$09 ; default dark world theme
; 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 $7EF300 : 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 $7EF3C5 : 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 $7EF3CA : BEQ .checkInverted+4
LDX.b #$09 ; dark overworld theme
LDA $8A
; Misery Mire rain SFX
CMP.b #$70 : BNE ++
LDA $7EF2F0 : 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
+ 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
+ LDA $8A : CMP.b #$40 : BNE +
LDX #$0F ; dark woods theme
BRA .bunny
.darkMountain
LDA $7EF37A : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme
+ : LDA.b #$09 : STA $012D
LDX.b #$0D ; dark mountain theme
.bunny
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .done
LDA MoonPearlEquipment : BNE .done
LDX #$04 ; bunny theme
; Does Link have a moon pearl?
LDA $7EF357 : BNE +
LDX.b #$04 ; bunny theme
+
.done
RTL
;--------------------------------------------------------------------------------
.lastCheck
;--------------------------------------------------------------------------------
;$012D to be set to any ambient SFX for the area
Overworld_DetermineAmbientSFX:
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
CMP.b #$70 : BEQ .mire
LDA.b #$05 : BRA .setSfx ; silence
.mire
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .done
LDA.b #$01 : BRA .setSfx ; Misery Mire rain SFX
.darkMountain
LDA.b #$09 : BRA .setSfx ; set storm ambient SFX
.setSfx
CMP $0131 : BEQ +
STA $012D
+ STZ $012D
.done
RTL
;--------------------------------------------------------------------------------
@@ -275,7 +179,7 @@ Overworld_MosaicDarkWorldChecks:
CMP.b #$51 : bne .doFade
.checkCrystals
LDA $7EF37A : CMP.b #$7F : BEQ .done
LDA CrystalsField : CMP.b #$7F : BEQ .done
.doFade
LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music
@@ -285,8 +189,27 @@ Overworld_MosaicDarkWorldChecks:
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Check if the boss in ToH has been defeated (16-bit accumulator)
CheckHeraBossDefeated:
LDA $7EF00F : AND #$00FF
RTL
; 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
CheckHeraBossDefeated:
LDA RoomDataWRAM[$08].high : AND.w #$00FF : BEQ +
SEC : RTL
+ CLC : RTL

View File

@@ -1,318 +1,300 @@
NewDrawHud:
SEP #$30
;================================================================================
; Draw bomb count
!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A"
!INFINITE_BOMBS = "$7F50C9"
;================================================================================
LDA !INFINITE_BOMBS : BNE .infinite_bombs
.finite_bombs
LDA.l SpecialWeapons : CMP #$01 : BNE .normal
LDA.l !WEAPON_LEVEL : BEQ .no_bombs
.normal
LDA.l $7EF343 ; 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
STA !BOMBCOUNT_DRAW_ADDRESS+2
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"
!INFINITE_ARROWS = "$7F50C8"
;================================================================================
SEP #$20
LDA.l ArrowMode : BNE +
LDA !INFINITE_ARROWS : BNE .infinite_arrows
.finite_arrows
LDA.l $7EF377 ; 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_COUNTER = "$7EF418"
!GOAL_DRAW_ADDRESS = "$7EC72A"
;================================================================================
SEP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
LDA.l !GOAL_COUNTER
JSR HudHexToDec3Digit
REP #$20
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
SEP #$20
LDA.l GoalItemRequirement : CMP.b #$FF : BEQ .skip
LDA.l GoalItemRequirement
JSR HudHexToDec3Digit
REP #$20
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
REP #$20
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
;================================================================================
REP #$20
LDA.l CompassMode : AND #$00FF : BEQ + ; skip if CompassMode is 0.
JSL.l DrawDungeonCompassCounts ; compasses.asm
+
;================================================================================
; Draw key count
!KEYS = "$7EF36F"
!KEY_DIGITS_ADDRESS = "$7EC764"
!KEY_ICON_ADDRESS = "$7EC726"
;================================================================================
SEP #$20
LDA.l !KEYS : 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 $7EF368
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 $7EF36E : 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 $7EF36E : 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"
;================================================================================
JSL CheckInfiniteBombs : BNE .infinite_bombs
.finite_bombs
LDA.l SpecialWeapons : 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 #$003F : 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

View File

@@ -39,19 +39,14 @@
; #$80 - Compasses
; #$90 - Big Keys
; #$A0 - Small Keys
; #$B0 - reserved for bee traps
; #$B1 - L-1 Bombs
; #$B2 - L-2 Bombs
; #$B3 - L-3 Bombs
; #$B4 - L-4 Bombs
; #$B5 - L-5 Bombs
; #$B6 - Progressive Bombs
; #$B7 - L-1 Cane
; #$B8 - L-2 Cane
; #$B9 - L-3 Cane
; #$BA - L-4 Cane
; #$BB - L-5 Cane
; #$BC - Progressive Cane
; #$B0 - Bee Trap
; #$B1 - Apples
; #$B2 - Fairy
; #$B3 - Chicken
; #$B4 - Big Magic
; #$B5 - 5 Arrows
; #$B6 - Progressive Bomb
; #$B7 - Progressive Cane
; #$FE - Server Request (Asychronous Chest)
; #$FF - Null Chest
;--------------------------------------------------------------------------------
@@ -155,10 +150,6 @@ macro ValueShift()
BRA ?start : ?end:
endmacro
;--------------------------------------------------------------------------------
!CHALLENGE_TIMER = "$7EF454"
!GOAL_COUNTER = "$7EF418"
!INVENTORY_SWAP_2 = "$7EF38E"
;--------------------------------------------------------------------------------
;carry clear if pass
;carry set if caught
;incsrc eventdata.asm
@@ -172,24 +163,24 @@ ProcessEventItems:
LDA $02D8
CMP.b #$E0 : BNE +
REP #$30 ; set 16-bit accumulator & index registers
LDA $7EF450 : ASL : TAX
LDA RNGItem : ASL : TAX
LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA $00
SEP #$20 ; set 8-bit accumulator
LDA.b #$AF : STA $02
JSL.l LoadDialogAddressIndirect
LDA $7EF450 : INC : STA $7EF450
LDA RNGItem : INC : STA RNGItem
SEP #$10 ; set 8-bit index registers
REP #$20 ; set 16-bit accumulator
LDA GoalItemRequirement : BEQ ++
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
LDA GoalCounter : INC : STA GoalCounter
CMP GoalItemRequirement : !BLT ++
LDA TurnInGoalItems : BNE ++
LDA TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal
++
SEP #$20 ; set 8-bit accumulator
LDX.b #$01 : BRA .done
+
LDX.b #$00
@@ -204,72 +195,73 @@ RTS
AddReceivedItemExpandedGetItem:
PHX
;JSR.w ProcessEventItems : CPX.b #$00 : BEQ ++
; ;JSL.l Main_ShowTextMessage_Alt
; LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
; LDA.b #$01 : STA $7F50XX
; JMP .done
;++
;STA $FFFFFF
LDA $02D8 ; check inventory
JSL.l FreeDungeonItemNotice
PHA
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PLA
BRL .done
+
PLA
CMP.b #$0B : BNE + ; Bow
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++
LDA BowTracking : AND.b #$40 : BEQ ++
LDA.l SilverArrowsUseRestriction : BNE ++
LDA.b #03 : STA $7EF340 ; set bow to silver
LDA.b #03 : STA BowEquipment ; set bow to silver
++
JMP .done
+ CMP.b #$3B : BNE + ; Silver Bow
LDA.l SilverArrowsUseRestriction : BNE .noequip
LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip
LDA $7EF376 : BNE ++ ; check arrows
LDA ArrowsFiller : BNE ++ ; check arrows
LDA.b #$03 : BRA +++ ; bow without arrow
++
LDA.b #$04 ; bow with arrow
+++
STA $7EF340
STA BowEquipment
.noequip
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 ; mark silver bow on y-toggle
LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle
JMP .done
+ CMP.b #$4C : BNE + ; 50 bombs
;LDA.b #$07 : STA $7EF370 ; upgrade bombs
LDA.b #50 : !SUB.l StartingMaxBombs : STA $7EF370 ; upgrade bombs
LDA.b #50 : STA $7EF375 ; fill bombs
;LDA.b #$07 : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : !SUB.l StartingMaxBombs : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$4D : BNE + ; 70 arrows
;LDA #$07 : STA $7EF371 ; upgrade arrows
LDA.b #70 : !SUB.l StartingMaxArrows : STA $7EF371 ; upgrade arrows
LDA.b #70 : STA $7EF376 ; fill arrows
;LDA #$07 : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : !SUB.l StartingMaxArrows : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$4E : BNE + ; 1/2 magic
LDA $7EF37B : CMP #$02 : !BGE ++
INC : STA $7EF37B ; upgrade magic
LDA MagicConsumption : CMP #$02 : !BGE ++
INC : STA MagicConsumption ; upgrade magic
++
LDA.b #$80 : STA $7EF373 ; fill magic
LDA.b #$80 : STA MagicFiller ; fill magic
JMP .done
+ CMP.b #$4F : BNE + ; 1/4 magic
LDA.b #$02 : STA $7EF37B ; upgrade magic
LDA.b #$80 : STA $7EF373 ; fill magic
LDA.b #$02 : STA MagicConsumption ; upgrade magic
LDA.b #$80 : STA MagicFiller ; fill magic
JMP .done
+ CMP.b #$50 : BNE + ; Master Sword (Safe)
LDA $7EF359 : CMP.b #$02 : !BGE + ; skip if we have a better sword
LDA.b #$02 : STA $7EF359 ; set master sword
LDA SwordEquipment : CMP.b #$02 : !BGE + ; skip if we have a better sword
LDA.b #$02 : STA SwordEquipment ; set master sword
JMP .done
+ CMP.b #$51 : BNE + ; +5 Bombs
LDA $7EF370 : !ADD.b #$05 : STA $7EF370 ; upgrade bombs +5
LDA.l Upgrade5BombsRefill : STA $7EF375 ; fill bombs
LDA BombCapacityUpgrades : !ADD.b #$05 : STA BombCapacityUpgrades ; upgrade bombs +5
LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$52 : BNE + ; +10 Bombs
LDA $7EF370 : !ADD.b #$0A : STA $7EF370 ; upgrade bombs +10
LDA.l Upgrade10BombsRefill : STA $7EF375 ; fill bombs
LDA BombCapacityUpgrades : !ADD.b #$0A : STA BombCapacityUpgrades ; upgrade bombs +10
LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs
JMP .done
+ CMP.b #$53 : BNE + ; +5 Arrows
LDA $7EF371 : !ADD.b #$05 : STA $7EF371 ; upgrade arrows +5
LDA.l Upgrade5ArrowsRefill : STA $7EF376 ; fill arrows
LDA ArrowCapacityUpgrades : !ADD.b #$05 : STA ArrowCapacityUpgrades ; upgrade arrows +5
LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$54 : BNE + ; +10 Arrows
LDA $7EF371 : !ADD.b #$0A : STA $7EF371 ; upgrade arrows +10
LDA.l Upgrade10ArrowsRefill : STA $7EF376 ; fill arrows
LDA ArrowCapacityUpgrades : !ADD.b #$0A : STA ArrowCapacityUpgrades ; upgrade arrows +10
LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done
+ CMP.b #$55 : BNE + ; Programmable Object 1
%ProgrammableItemLogic(1)
@@ -283,34 +275,34 @@ AddReceivedItemExpandedGetItem:
+ CMP.b #$58 : BNE + ; Upgrade-Only Silver Arrows
LDA.l SilverArrowsUseRestriction : BNE +++
LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ +++
LDA $7EF340 : BEQ ++ : CMP.b #$03 : !BGE ++
!ADD.b #$02 : STA $7EF340 ; switch to silver bow
LDA BowEquipment : BEQ ++ : CMP.b #$03 : !BGE ++
!ADD.b #$02 : STA BowEquipment ; switch to silver bow
++
+++
LDA.l ArrowMode : BEQ ++
LDA.b #$01 : STA $7EF376
LDA.b #$01 : STA ArrowsFiller
++
+ CMP.b #$59 : BNE + ; 1 Rupoor
REP #$20 : LDA $7EF360 : !SUB RupoorDeduction : STA $7EF360 : SEP #$20 ; Take 1 rupee
REP #$20 : LDA CurrentRupees : !SUB RupoorDeduction : STA CurrentRupees : SEP #$20 ; Take 1 rupee
JMP .done
+ CMP.b #$5A : BNE + ; Null Item
JMP .done
+ CMP.b #$5B : BNE + ; Red Clock
REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l RedClockAmount : STA !CHALLENGE_TIMER
LDA !CHALLENGE_TIMER+2 : ADC.l RedClockAmount+2 : STA !CHALLENGE_TIMER+2
LDA ChallengeTimer : !ADD.l RedClockAmount : STA ChallengeTimer
LDA ChallengeTimer+2 : ADC.l RedClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator
JMP .done
+ CMP.b #$5C : BNE + ; Blue Clock
REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l BlueClockAmount : STA !CHALLENGE_TIMER
LDA !CHALLENGE_TIMER+2 : ADC.l BlueClockAmount+2 : STA !CHALLENGE_TIMER+2
LDA ChallengeTimer : !ADD.l BlueClockAmount : STA ChallengeTimer
LDA ChallengeTimer+2 : ADC.l BlueClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator
JMP .done
+ CMP.b #$5D : BNE + ; Green Clock
REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l GreenClockAmount : STA !CHALLENGE_TIMER
LDA !CHALLENGE_TIMER+2 : ADC.l GreenClockAmount+2 : STA !CHALLENGE_TIMER+2
LDA ChallengeTimer : !ADD.l GreenClockAmount : STA ChallengeTimer
LDA ChallengeTimer+2 : ADC.l GreenClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator
JMP .done
+ CMP.b #$5E : BNE + ; Progressive Sword
@@ -336,12 +328,14 @@ AddReceivedItemExpandedGetItem:
BRA .multi_collect
+ CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic
.multi_collect
LDA GoalItemRequirement : BEQ ++
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
CMP GoalItemRequirement : !BLT ++
LDA TurnInGoalItems : BNE ++
REP #$20 ; set 16-bit accumulator
LDA.l GoalItemRequirement : BEQ ++
LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.w GoalItemRequirement : !BLT ++
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal
++
SEP #$20 ; set 8-bit accumulator
JMP .done
+ CMP.b #$6D : BNE + ; Server Request F0
JSL.l ItemGetServiceRequest_F0
@@ -358,70 +352,107 @@ AddReceivedItemExpandedGetItem:
+ CMP.b #$70 : !BLT + : CMP.b #$80 : !BGE + ; Free Map
AND #$0F : CMP #$08 : !BGE ++
%ValueShift()
ORA $7EF368 : STA $7EF368 ; Map 1
ORA MapField : STA MapField ; Map 1
JMP .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF369 : STA $7EF369 ; Map 2
ORA MapField+1 : STA MapField+1 ; Map 2
JMP .done
+ CMP.b #$80 : !BLT + : CMP.b #$90 : !BGE + ; Free Compass
AND #$0F : CMP #$08 : !BGE ++
%ValueShift()
ORA $7EF364 : STA $7EF364 ; Compass 1
ORA CompassField : STA CompassField ; Compass 1
JMP .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF365 : STA $7EF365 ; Compass 2
ORA CompassField+1 : STA CompassField+1 ; Compass 2
JMP .done
+ CMP.b #$90 : !BLT + : CMP.b #$A0 : !BGE + ; Free Big Key
AND #$0F : CMP #$08 : !BGE ++
%ValueShift()
ORA $7EF366 : STA $7EF366 ; Big Key 1
ORA BigKeyField : STA BigKeyField ; Big Key 1
JMP .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF367 : STA $7EF367 ; Big Key 2
ORA BigKeyField+1 : STA BigKeyField+1 ; Big Key 2
JMP .done
+ CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key
AND #$0F : TAX
LDA $7EF37C, X : INC : STA $7EF37C, X ; Increment Key Count
LDA DungeonKeys, X : INC : STA DungeonKeys, X ; Increment Key Count
CPX.b #$00 : BNE ++
STA $7EF37D ; copy HC to sewers
STA HyruleCastleKeys ; copy HC to sewers
++ : CPX.b #$01 : BNE ++
STA $7EF37C ; copy sewers to HC
STA SewerKeys ; copy sewers to HC
++
LDA.l GenericKeys : BEQ +
.generic
LDA $7EF36F : INC : STA $7EF36F
LDA CurrentSmallKeys : INC : STA CurrentSmallKeys
JMP .done
.normal
TXA : ASL : CMP $040C : BNE ++
LDA $7EF36F : INC : STA $7EF36F
LDA CurrentSmallKeys : INC : STA CurrentSmallKeys
++
JMP .done
+ CMP.b #$B1 : !BLT + : CMP.b #$B7 : !BGE + ; Bomb Upgrades
LDA.l SpecialWeapons : CMP #$01 : BNE .done
LDA #$01 : STA $7F50C9 ; infinite bombs
JMP .done
+ : CMP.b #$B7 : !BLT + : CMP.b #$BD : !BGE + ; Cane Upgrades
+ CMP.b #$B0 : BNE + ; Bee Trap
LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI ++ ; DashBeeHive_SpawnBee
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA $20 : STA $0D00, Y : LDA $21 : STA $0D20, Y
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
++ JMP .done
+ CMP.b #$B1 : BNE + ; Apples
LDA.b #$AC : JSL Sprite_SpawnDynamically : BMI ++
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$10 : STA.w $0D00,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 16 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
LDA.b #$FF : STA.w $0B58,Y ; allows them to expire
++ JMP .done
+ CMP.b #$B2 : BNE + ; Fairy
LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI ++
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$10 : STA.w $0D00,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 16 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
LDA.b #$FF : STA.w $0B58,Y ; allows them to expire
++ JMP .done
+ CMP.b #$B3 : BNE + ; Chicken
LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI .done
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$08 : STA.w $0D00,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 8 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link
BRA .done
+ CMP.b #$B4 : BNE + ; Big Magic
LDA.b #$80 : STA MagicFiller ; fill magic
BRA .done
+ CMP.b #$B5 : BNE + ; 5 Arrows
LDA.b #$05 : STA ArrowsFiller ; add 5 arrows
BRA .done
+ CMP.b #$B6 : BNE + ; Bomb Upgrade
LDA #$01 : STA InfiniteBombsModifier ; infinite bombs
JMP .done
+ : CMP.b #$B7 : BNE + ; Cane Upgrade
LDA.l SpecialWeapons : CMP #$03 : BEQ .blue_cane
CMP #$04 : BEQ .red_cane
BRA .done
.blue_cane
LDA #$01 : STA $7EF351
LDA #$01 : STA ByrnaEquipment
BRA .done
.red_cane
LDA #$01 : STA $7EF350
LDA #$01 : STA SomariaEquipment
BRA .done
BRA .done
+
.done
PLX
@@ -433,8 +464,6 @@ RTL
; #$90 - Big Keys
; #$A0 - Small Keys
;--------------------------------------------------------------------------------
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
!RNG_ITEM = "$7EF450"
!SCRATCH_AREA = "$7F5020"
!SINGLE_INDEX_TEMP = "$7F5020"
!SINGLE_INDEX_OFFSET_TEMP = "$7F5021"
@@ -450,49 +479,55 @@ RTL
AddReceivedItemExpanded:
{
PHA : PHX
LDA RemoteItems : BEQ + : LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA $02E9 : BEQ ++ : CMP #$03 : BNE +++ : ++
; fromTextOrObject
LDA $0345 : BEQ ++ : LDA.b #$04 : ++ : STA $5D ; Restore Link to his swimming state
STZ $02DA : STZ $037B : STZ $02E4
LDA #$0E : STA $012F
+++
STZ $02D8 : STZ $02D9 : STZ $02E9
PHY : LDY.b #$00 : JSL AddInventory : PLY
PLX : PLA : RTL
+
JSL.l PreItemGet
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA $02D8
JSR AttemptItemSubstitution
STA $02D8
JSR IncrementItemCounters
+
LDA $02D8 ; Item Value
JSR AttemptItemSubstitution
STA $02D8
STA !MULTIWORLD_ITEM_ID
JSR IncrementItemCounters
CMP.b #$16 : BNE ++ ; Bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$2B : BNE ++ ; Red Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$2C : BNE ++ ; Green Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$2D : BNE ++ ; Blue Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$3C : BNE ++ ; Bee w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$3D : BNE ++ ; Fairy w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
++ : CMP.b #$48 : BNE ++ ; Gold Bee w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
CMP.b #$16 : BEQ .bottle ; Bottle
CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle
CMP.b #$2C : BEQ .bottle ; Green Potion w/bottle
CMP.b #$2D : BEQ .bottle ; Blue Potion w/bottle
CMP.b #$3C : BEQ .bottle ; Bee w/bottle
CMP.b #$3D : BEQ .bottle ; Fairy w/bottle
CMP.b #$48 : BEQ .bottle ; Gold Bee w/bottle
BRA .notBottle
.bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done
.notBottle
++ : CMP.b #$4E : BNE ++ ; Progressive Magic
LDA $7EF37B : BEQ +++
LDA MagicConsumption : BEQ +++
LDA.b #$4F : STA $02D8
+++ : JMP .done
++ : CMP.b #$5E : BNE ++ ; Progressive Sword
LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA HighestSword : CMP.l ProgressiveSwordLimit : !BLT +
LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done
+
LDA SwordEquipment : CMP.b #$FF : BNE + ; Swordless
LDA.b #$49 : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Sword
LDA.b #$49 : STA $02D8 : JMP .done
+ : CMP.b #$01 : BNE + ; Fighter Sword
@@ -502,40 +537,51 @@ AddReceivedItemExpanded:
+ ; Everything Else
LDA.b #$03 : STA $02D8 : JMP .done
++ : CMP.b #$5F : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA ShieldEquipment : BNE +++ ; No Shield
LDA.b #$04 : STA $02D8 : JMP .done
+++ : CMP.b #$40 : BNE +++ ; Fighter Shield
LDA.b #$05 : STA $02D8 : JMP .done
+++ ; Everything Else
LDA.b #$06 : STA $02D8 : JMP .done
+
LDA HighestShield : CMP.l ProgressiveShieldLimit : !BLT +
LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done
+
LDA !PROGRESSIVE_SHIELD : AND.b #$C0 : BNE + ; No Shield
LDA.b #$04 : STA $02D8
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done
+ : CMP.b #$40 : BNE + ; Fighter Shield
LDA.b #$05 : STA $02D8
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done
LDA HighestShield : BNE + ; No Shield
LDA.b #$04 : BRA .shielddone
+ : CMP.b #$01 : BNE + ; Fighter Shield
LDA.b #$05 : BRA .shielddone
+ ; Everything Else
LDA.b #$06 : STA $02D8
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done
LDA.b #$06
.shielddone : STA $02D8
JMP .done
++ : CMP.b #$60 : BNE ++ ; Progressive Armor
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA HighestMail : CMP.l ProgressiveArmorLimit : !BLT +
LDA.l ProgressiveArmorReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Armor
+
LDA ArmorEquipment : CMP.b #$00 : BNE + ; No Armor
LDA.b #$22 : STA $02D8 : JMP .done
+ ; Everything Else
LDA.b #$23 : STA $02D8 : JMP .done
++ : CMP.b #$61 : BNE ++ ; Progressive Lifting Glove
LDA $7EF354 : BNE + ; No Lift
LDA GloveEquipment : BNE + ; No Lift
LDA.b #$1B : STA $02D8 : JMP .done
+ ; Everything Else
LDA.b #$1C : STA $02D8 : JMP .done
++ : CMP.b #$64 : BNE ++ : -- ; Progressive Bow
LDA $7EF340 : INC : LSR : CMP.l ProgressiveBowLimit : !BLT +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Bow
+ LDA BowEquipment : INC : LSR : CMP.b #$00 : BNE + ; No Bow
LDA.b #$3A : STA $02D8 : JMP .done
+ ; Any Bow
LDA.b #$3B : STA $02D8 : JMP .done
++ : CMP.b #$65 : BNE ++ ; Progressive Bow 2
LDA.l !INVENTORY_SWAP_2 : ORA #$20 : STA.l !INVENTORY_SWAP_2
BRA --
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +++
LDA.l BowTracking : ORA #$20 : STA.l BowTracking
+++ : BRA --
; ++ : CMP.b #$FE : BNE ++ ; Server Request (Null Chest)
; JSL ChestItemServiceRequest
; BRA .done
@@ -548,30 +594,10 @@ AddReceivedItemExpanded:
JSL.l GetRNGItemMulti : STA $02D8
LDA #$FF : STA !LOCK_IN ; clear lock-in
JMP .done
++ : CMP.b #$B6 : BNE ++ ; Progressive Bombs
LDA !WEAPON_LEVEL
CMP.b #$00 : BNE + ; have no Bombs
LDA.b #$B1 : STA $02D8 : JMP .done
+ : CMP.b #$01 : BNE + ; have L-1 Bombs
LDA.b #$B2 : STA $02D8 : JMP .done
+ : CMP.b #$02 : BNE + ; have L-2 Bombs
LDA.b #$B3 : STA $02D8 : JMP .done
+ : CMP.b #$03 : BNE + ; have L-3 Bombs
LDA.b #$B4 : STA $02D8 : JMP .done
+ ; Everything Else
LDA.b #$B5 : STA $02D8 : JMP .done
++ : CMP.b #$BC : BNE ++ ; Progressive Cane
LDA !WEAPON_LEVEL
CMP.b #$00 : BNE + ; have no Cane
LDA.b #$B7 : STA $02D8 : JMP .done
+ : CMP.b #$01 : BNE + ; have L-1 Cane
LDA.b #$B8 : STA $02D8 : JMP .done
+ : CMP.b #$02 : BNE + ; have L-2 Cane
LDA.b #$B9 : STA $02D8 : JMP .done
+ : CMP.b #$03 : BNE + ; have L-3 Cane
LDA.b #$BA : STA $02D8 : JMP .done
+ ; Everything Else
LDA.b #$BB : STA $02D8 : JMP .done
++ : CMP.b #$B0 : BNE ++ ; Bee Trap
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +++
LDA.b #$0E : STA $02D8 : JMP .done ; Bee in a bottle
+++
++
.done
PLX : PLA
@@ -616,10 +642,15 @@ AddReceivedItemExpanded:
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Compass
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Big Key
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Small Key
db -4 ; reserved for bee traps
db -4, -4, -4, -4, -4, -4 ; Bomb Upgrades
db -4, -4, -4, -4, -4, -4 ; Cane Upgrades
db -4, -4, -4 ; Unused
db -4 ; Bee Trap
db -4 ; Apples
db -4 ; Fairy
db -4 ; Chicken
db -4 ; Big Magic
db -4 ; 5 Arrows
db -4 ; Bomb Upgrade
db -4 ; Cane Upgrade
db -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
@@ -659,10 +690,15 @@ AddReceivedItemExpanded:
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Free Big Key
;db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; *EVENT*
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Small Key
db 0 ; reserved for bee traps
db 0, 0, 0, 0, 0, 0 ; Bomb Upgrades
db 4, 4, 4, 4, 4, 4 ; Cane Upgrades
db 0, 0, 0 ; Unused
db 0 ; Bee Trap
db 0 ; Apples
db 0 ; Fairy
db 0 ; Chicken
db 4 ; Big Magic
db 0 ; 5 Arrows
db 0 ; Bomb Upgrade
db 4 ; Cane Upgrade
db 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
@@ -706,10 +742,16 @@ AddReceivedItemExpanded:
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
db $49 ; reserved for bee traps
db $13, $13, $13, $13, $13, $13 ; Bomb Upgrades
db $07, $07, $07, $07, $07, $07 ; Cane Upgrades
db $49, $49, $49 ; Unused
db $47 ; Bee Trap
db $47 ; Apples
db $47 ; Fairy
db $47 ; Chicken
db $3B ; Big Magic
db $02 ; 5 Arrows
db $13 ; Bomb Upgrade
db $07 ; Cane Upgrade
db $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
@@ -748,10 +790,15 @@ AddReceivedItemExpanded:
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Free Compass
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Free Big Key
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; Free Small Key
db $02 ; reserved for bee traps
db $02, $02, $02, $02, $02, $02 ; Bomb Upgrades
db $00, $00, $00, $00, $00, $00 ; Cane Upgrades
db $02, $02, $02 ; Unused
db $02 ; Bee Trap
db $02 ; Apples
db $02 ; Fairy
db $02 ; Chicken
db $00 ; Big Magic
db $02 ; 5 Arrows
db $02 ; Bomb Upgrade
db $00 ; Cane Upgrade
db $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
@@ -791,10 +838,15 @@ AddReceivedItemExpanded:
db 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ; Free Compass
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Big Key
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Small Key
db 4 ; reserved for bee traps
db 4, 2, 1, 5, 5, 5 ; Bomb Upgrades
db 5, 5, 5, 5, 5, 5 ; Cane Upgrades
db 4, 4, 4 ; Unused
db 1 ; Bee Trap
db 1 ; Apples
db 1 ; Fairy
db 1 ; Chicken
db 4 ; Big Magic
db 2 ; 5 Arrows
db 5 ; Bomb Upgrade
db 5 ; Cane Upgrade
db 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
@@ -835,10 +887,15 @@ AddReceivedItemExpanded:
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Compass
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Big Key
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Small Key
dw $F36A ; reserved for bee traps
dw $F38F, $F38F, $F38F, $F38F, $F38F, $F38F ; Bomb Upgrades
dw $F38F, $F38F, $F38F, $F38F, $F38F, $F38F ; Cane Upgrades
dw $F36A, $F36A, $F36A ; Unused
dw $F36A ; Bee Trap
dw $F36A ; Apples
dw $F36A ; Fairy
dw $F36A ; Chicken
dw $F373 ; Big Magic
dw $F376 ; 5 Arrows
dw $F38F ; Bomb Upgrade
dw $F38F ; Cane Upgrade
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
@@ -881,10 +938,15 @@ AddReceivedItemExpanded:
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Compass
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Big Key
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Small Key
db $FF ; reserved for bee traps
db $01, $02, $03, $04, $05, $FF ; Bomb Upgrades
db $01, $02, $03, $04, $05, $FF ; Cane Upgrades
db $FF, $FF, $FF ; Unused
db $FF ; Bee Trap
db $FF ; Apples
db $FF ; Fairy
db $FF ; Chicken
db $80 ; Big Magic
db $05 ; 5 Arrows
db $FF ; Bomb Upgrade
db $FF ; Cane Upgrade
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
@@ -906,27 +968,26 @@ AddReceivedItemExpanded:
;0x1A - Ganon's Tower
.item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
; sewers and castle get 2 bits active so that they can share their items elegantly
; sewers and castle get 2 bits active so that they can share their items elegantly
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004, $0000, $0000
dw $0080, $0040, $0020, $0010, $0008, $0004, $4B8B, $20AB ; last two can be re-used
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000
db $00
dw $0000 ; Caves
; caves
dw $9CCE, $0390, $2F82, $AD03, $02E9, $01C9, $06D0, $72A5
dw $A548, $4873, $01A0, $D8AD, $C902, $D020, $A002, $9802
dw $E48D, $DA02, $D8AC, $D002, $A215, $BD08, $84E2, $0085
dw $E3BD, $8584, $A901, $857E, $B902, $857A, $0087, $0A98
dw $BDAA, $84E2, $0085, $E3BD, $8584, $A901, $857E, $B902
dw $857A, $0230, $0087, $1FC0, $02D0, $5664, $04A9, $4BC0
dw $06F0, $1EC0, $0AD0, $02A9, $790F, $7EF3, $798F, $7EF3
dw $1BC0, $04F0, $1CC0, $07D0, $1B22, $1BEE, $0182, $A201
dw $C004, $F037, $A20C, $C001, $F038, $A206, $C002, $D039
dw $8A14, $0007, $0087, $00EE, $2902, $C907, $D007, $A906
dw $8F04, $F3C7, $C07E, $D022, $A70A, $D000, $A904, $8701
dw $8000, $C0C9, $F025, $C008, $F032, $C004, $D033, $AE11
dw $040C, $20C2, $C6BD, $0785, $8700, $E200, $8220, $00B0
dw $3EC0, $0AD0, $082C, $1003, $A905, $8D02, $0309, $20C0
dw $44D0
}
;--------------------------------------------------------------------------------
BottleListExpanded:
@@ -970,10 +1031,15 @@ Link_ReceiveItemAlternatesExpanded:
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Free Compass
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Free Big Key
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Free Small Key
db -1 ; reserved for bee traps
db -1, -1, -1, -1, -1, -1 ; Bomb Upgrades
db -1, -1, -1, -1, -1, -1 ; Cane Upgrades
db -1, -1, -1 ; Unused
db -1 ; Bee Trap
db -1 ; Apples
db -1 ; Fairy
db -1 ; Chicken
db -1 ; Big Magic
db -1 ; 5 Arrows
db -1 ; Bomb Upgrade
db -1 ; Cane Upgrade
db -1, -1, -1, -1, -1, -1, -1, -1 ; Unused
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused
db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused
@@ -984,14 +1050,21 @@ Link_ReceiveItemAlternatesExpanded:
PHB : PHK : PLB
;TYA : JSR IncrementItemCounters
;LDA Link_ReceiveItemAlternatesExpanded, Y : STA $03
TYA : JSR AttemptItemSubstitution : STA $03
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
TYA
JSR AttemptItemSubstitution
BRA ++
+
TYA
++
STA $03
CPY $03 : BNE + : LDA.b #$FF : STA $03 : +
PLB
RTL
;--------------------------------------------------------------------------------
;DrawHUDSilverArrows:
; LDA $7EF340 : AND.w #$00FF : BNE +
; LDA !INVENTORY_SWAP_2 : AND.w #$0040 : BEQ +
; LDA BowEquipment : AND.w #$00FF : BNE +
; LDA BowTracking : AND.w #$0040 : BEQ +
; LDA.w #$2810 : STA $11C8
; LDA.w #$2811 : STA $11CA
; LDA.w #$2820 : STA $1208
@@ -1000,19 +1073,19 @@ RTL
; LDA.w #$11CE : STA $00 ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
;Return $7EF340 but also draw silver arrows if you have the upgrade even if you don't have the bow
;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow
CheckHUDSilverArrows:
LDA.l ArrowMode : BEQ .normal
.rupee_arrows
JSL.l DrawHUDArrows
LDA $7EF340
LDA BowEquipment
RTL
.normal
LDA $7EF340 : BNE +
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++
LDA BowEquipment : BNE +
LDA BowTracking : AND.b #$40 : BEQ ++
JSL.l DrawHUDArrows
++
LDA $7EF340
LDA BowEquipment
+
RTL
;--------------------------------------------------------------------------------
@@ -1020,9 +1093,9 @@ DrawHUDArrows:
LDA.l ArrowMode : BEQ .normal
.rupee_arrows
LDA $7EF377 : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks
LDA $7EF340 : BNE +
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BNE .silver
LDA CurrentArrows : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks
LDA BowEquipment : BNE +
LDA BowTracking : AND.b #$40 : BNE .silver
BRA .wooden
+ CMP.b #03 : !BGE .silver
@@ -1046,7 +1119,6 @@ RTL
LDA.b #$24 : STA $7EC723
RTL
;--------------------------------------------------------------------------------
!RNG_ITEM = "$7EF450"
!SCRATCH_AREA = "$7F5020"
!SINGLE_INDEX_TEMP = "$7F5020"
!SINGLE_INDEX_OFFSET_TEMP = "$7F5021"
@@ -1084,7 +1156,7 @@ RTL
;--------------------------------------------------------------------------------
CheckSingleItem:
LSR #3 : TAX
LDA.l !RNG_ITEM, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary
LDA.l RNGItem, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary
PHX
LDA !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X
LDA !SINGLE_INDEX_BITMASK_TEMP
@@ -1102,7 +1174,7 @@ MarkRNGItemSingle:
;STA !SINGLE_INDEX_TEMP
LSR #3 : STA !SINGLE_INDEX_OFFSET_TEMP : TAX
LDA.l !RNG_ITEM, X
LDA.l RNGItem, X
STA.l !SINGLE_INDEX_BITMASK_TEMP
LDA.l !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X
LDA.b #01
@@ -1117,7 +1189,7 @@ MarkRNGItemSingle:
LDA.l !SINGLE_INDEX_OFFSET_TEMP : TAX
PLA
ORA.l !SINGLE_INDEX_BITMASK_TEMP
STA.l !RNG_ITEM, X
STA.l RNGItem, X
RTS
;--------------------------------------------------------------------------------
GetRNGItemMulti:
@@ -1142,7 +1214,7 @@ IncrementItemCounters:
.match
PHX
TXA : LSR #2 : TAX
LDA !ITEM_LIMIT_COUNTS, X : INC : STA !ITEM_LIMIT_COUNTS, X
LDA ItemLimitCounts, X : INC : STA ItemLimitCounts, X
PLX
BEQ .exit
.noMatch
@@ -1162,7 +1234,7 @@ AttemptItemSubstitution:
.match
PHX
TXA : LSR #2 : TAX
LDA !ITEM_LIMIT_COUNTS, X
LDA ItemLimitCounts, X
PLX
CMP.l ItemSubstitutionRules+1, X : !BLT +
LDA.l ItemSubstitutionRules+2, X : STA 1,s
@@ -1178,10 +1250,10 @@ RTS
CountBottles:
PHX
LDX.b #$00
LDA $7EF35C : BEQ ++ : INX
++ : LDA $7EF35D : BEQ ++ : INX
++ : LDA $7EF35E : BEQ ++ : INX
++ : LDA $7EF35F : BEQ ++ : INX
LDA BottleContentsOne : BEQ ++ : INX
++ : LDA BottleContentsTwo : BEQ ++ : INX
++ : LDA BottleContentsThree : BEQ ++ : INX
++ : LDA BottleContentsFour : BEQ ++ : INX
++
TXA
PLX
@@ -1194,6 +1266,7 @@ JML.l StatsFinalPrep
;--------------------------------------------------------------------------------
ChestPrep:
LDA.b #$01 : STA $02E9
JSL.l IncrementChestCounter
LDA.l ServerRequestMode : BEQ +
JSL.l ChestItemServiceRequest
RTL
@@ -1218,3 +1291,64 @@ UpdateInventoryLocationExpanded:
JSL ItemDowngradeFix
RTL
}
;--------------------------------------------------------------------------------
; Set a flag in SRAM if we pick up a compass in its own dungeon with HUD compass
; counts on
MaybeFlagCompassTotalPickup:
LDA.l CompassMode : AND.b #$0F : BEQ .done
LDA $040C : CMP #$FF : BEQ .done
LSR : STA $04 : LDA #$0F : !SUB $04 ; Compute flag "index"
CPY #$25 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA $04
TYA : AND #$0F : CMP $04 : BNE .done ; Check if compass is for this dungeon
.setFlag
CMP #$08 : !BGE ++
%ValueShift()
ORA CompassCountDisplay : STA CompassCountDisplay
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA CompassCountDisplay+1 : STA CompassCountDisplay+1
.done
RTL
;--------------------------------------------------------------------------------
; Set the compass count display flag if we're entering a dungeon and alerady have
; that compass
MaybeFlagCompassTotalEntrance:
LDX $040C : CPX #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA.l CompassMode : AND.w #$000F : BEQ .done ; Skip if we're not showing compass counts
CMP.w #$0002 : BEQ .countShown
LDA CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass
.countShown
SEP #$20
TXA : LSR : STA.b $04 : LDA.b #$0F : !SUB $04 ; Compute flag "index"
CMP #$08 : !BGE ++
%ValueShift()
ORA CompassCountDisplay : STA CompassCountDisplay
REP #$20
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA CompassCountDisplay+1 : STA CompassCountDisplay+1
REP #$20
.done
RTL
;--------------------------------------------------------------------------------
LoadReceivedItemExpandedProperties:
CPX.b #$B6 : BEQ .bomb_upgrade
LDA.l AddReceivedItemExpanded_properties, X ; load from table
RTL
.bomb_upgrade
LDA SpecialWeaponLevel
CMP.b #$01 : BNE + ; L1 Bombs
LDA.b #4 : RTL
+ : CMP.b #$02 : BNE + ; L2 Bombs
LDA.b #2 : RTL
+ : CMP.b #$03 : BNE + ; L3 Bombs
LDA.b #1 : RTL
+ ; Everything Else
LDA.b #5 : RTL

View File

@@ -21,44 +21,42 @@
;UNUSED = "#$40"
;MAGIC_BAT = "#$80"
;--------------------------------------------------------------------------------
!NPC_FLAGS = "$7EF410"
!NPC_FLAGS_2 = "$7EF411"
ItemCheck_FairySword:
LDA !NPC_FLAGS_2 : AND.b #$08
LDA NpcFlags+1 : AND.b #$08
RTL
ItemCheck_SmithSword:
LDA !NPC_FLAGS_2 : AND.b #$04
LDA NpcFlags+1 : AND.b #$04
RTL
ItemCheck_MagicBat:
LDA !NPC_FLAGS_2 : AND.b #$80
LDA NpcFlags+1 : AND.b #$80
RTL
ItemCheck_OldMan:
LDA !NPC_FLAGS : AND.b #$01 : CMP #$01
LDA NpcFlags : AND.b #$01 : CMP #$01
RTL
ItemCheck_ZoraKing:
LDA !NPC_FLAGS : AND.b #$02
LDA NpcFlags : AND.b #$02
RTL
ItemCheck_SickKid:
LDA !NPC_FLAGS : AND.b #$04
LDA NpcFlags : AND.b #$04
RTL
ItemCheck_TreeKid:
LDA !NPC_FLAGS : AND.b #$08 ; FluteBoy_Chillin - 73: LDA $7EF34C
LDA NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment
RTL
ItemCheck_TreeKid2:
LDA !NPC_FLAGS : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA $7EF34C : AND.b #$03
LDA NpcFlags : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03
RTL
ItemCheck_TreeKid3:
JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over
LDA !NPC_FLAGS : AND.b #$08
LDA NpcFlags : AND.b #$08
BEQ .normal
BRA .done
LDA.b #$05
@@ -68,16 +66,16 @@ ItemCheck_TreeKid3:
RTL
ItemCheck_Sahasrala:
LDA !NPC_FLAGS : AND.b #$10
LDA NpcFlags : AND.b #$10
RTL
ItemCheck_Library:
LDA !NPC_FLAGS : AND.b #$80
LDA NpcFlags : AND.b #$80
RTL
ItemCheck_Mushroom:
LDA !NPC_FLAGS_2 : ROL #4 ; does the same thing as below
; LDA !NPC_FLAGS_2 : AND.b #$10 : BEQ .clear
LDA NpcFlags+1 : ROL #4 ; does the same thing as below
; LDA NpcFlags+1 : AND.b #$10 : BEQ .clear
; SEC
;RTL
; .clear
@@ -85,14 +83,14 @@ ItemCheck_Mushroom:
RTL
ItemCheck_Powder:
LDA !NPC_FLAGS_2 : AND.b #$20
LDA NpcFlags+1 : AND.b #$20
RTL
ItemCheck_Catfish:
;LDA CatfishGoodItem : BEQ .junk
;PHX
; LDA CatfishGoodItem+1 : TAX
; LDA $7EF340-1, X
; LDA BowEquipment-1, X
;PLX
;--
;CMP CatfishGoodItem : !BLT .oursNewer
@@ -101,72 +99,78 @@ ItemCheck_Catfish:
;.oursNewers
;LDA #$00 : RTL ; give item
;.junk
LDA !NPC_FLAGS : AND.b #$20
LDA NpcFlags : AND.b #$20
RTL
;--------------------------------------------------------------------------------
ItemSet_FairySword:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$08 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$08 : STA NpcFlags+1 : PLA
RTL
ItemSet_SmithSword:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$04 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$04 : STA NpcFlags+1 : PLA
RTL
ItemSet_MagicBat:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$80 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$80 : STA NpcFlags+1 : PLA
RTL
ItemSet_OldMan:
PHA : LDA OldManItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA !NPC_FLAGS : ORA.b #$01 : STA !NPC_FLAGS : PLA
PHA : LDA NpcFlags : ORA.b #$01 : STA NpcFlags : PLA
RTL
ItemSet_ZoraKing:
;JSL $1DE1AA ; Sprite_SpawnFlippersItem ; thing we wrote over
PHA : LDA !NPC_FLAGS : ORA.b #$02 : STA !NPC_FLAGS : PLA
PHA : LDA NpcFlags : ORA.b #$02 : STA NpcFlags : PLA
RTL
ItemSet_SickKid:
PHA : LDA SickKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA !NPC_FLAGS : ORA.b #$04 : STA !NPC_FLAGS : PLA
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 !NPC_FLAGS : ORA.b #$08 : STA !NPC_FLAGS : PLA
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 !NPC_FLAGS : ORA.b #$10 : STA !NPC_FLAGS : PLA
PHA : LDA NpcFlags : ORA.b #$10 : STA NpcFlags : PLA
RTL
ItemSet_Catfish:
;JSL $00D52D ; GetAnimatedSpriteTile.variable ; thing we wrote over
;JSL.l LoadCatfishItemGFX
PHA : LDA !NPC_FLAGS : ORA.b #$20 : STA !NPC_FLAGS : PLA
PHA : LDA NpcFlags : ORA.b #$20 : STA NpcFlags : PLA
RTL
ItemSet_Library:
PHA : LDA LibraryItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over
PHA : LDA !NPC_FLAGS : ORA.b #$80 : STA !NPC_FLAGS : PLA
PHA : LDA NpcFlags : ORA.b #$80 : STA NpcFlags : PLA
RTL
ItemSet_Mushroom:
PHA
LDA !NPC_FLAGS_2 : ORA.b #$10 : STA !NPC_FLAGS_2
LDA NpcFlags+1 : ORA.b #$10 : STA NpcFlags+1
LDY $0E80, X ; Retrieve stored item type
BNE +
; 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
RTL
ItemSet_Powder:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$20 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$20 : STA NpcFlags+1 : PLA
RTL
;================================================================================
@@ -182,14 +186,19 @@ 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
;================================================================================

View File

@@ -1,29 +0,0 @@
;================================================================================
; Open Mode Uncle Rain State Check
;================================================================================
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetUncleRainState:
LDA.l OpenMode : BEQ + : RTL : + ; we're done if open mode is on
LDA.b #$01 : STA $7EF3C5
RTL
;--------------------------------------------------------------------------------
InitOpenMode:
LDA.l OpenMode : BEQ + ; Skip if not open mode
LDA $7EF3C5 : CMP #$02 : !BGE + ; Skip if already past escape
LDA.b #$02 : STA $7EF3C5 ; Go to post-escape phase (pre aga1)
LDA $7EF3C6 : ORA #$14 : STA $7EF3C6 ; remove uncle
LDA $7EF3C8 : CMP #$05 : BEQ ++ : LDA.b #$01 : ++ : STA $7EF3C8 ; set spawn points to house+sanc unless already house+sanc+mountain
LDA $7EF29B : ORA.b #$20 : STA $7EF29B ; open castle gate
JSL MaybeSetPostAgaWorldState
+
RTL
;--------------------------------------------------------------------------------
MaybeSetPostAgaWorldState:
LDA.l InstantPostAgaWorldState : BEQ + ; Skip if not enabled
LDA.b #$03 : STA $7EF3C5 ; Go to post-aga phase
LDA $7EF282 : ORA.b #$20 : STA $7EF282 ; make lumberjack tree accessible
+
RTL
;--------------------------------------------------------------------------------

1555
owrando.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,5 @@
!PASSWORD_CODE_POSITION = "$C8"
!PASSWORD_SELECTION_POSITION = "$C9"
!PASSWORD_SRAM = "$701000"
Module_Password:
LDA $11
@@ -39,7 +37,7 @@ Password_EndInit:
LDX.b #$0F
LDA.b #$00
-
STA.l !PASSWORD_SRAM, X
STA.l PasswordSRAM, X
DEX : BPL -
+
@@ -108,7 +106,7 @@ Password_Main:
BRA +
++
LDX !PASSWORD_CODE_POSITION
STA !PASSWORD_SRAM,X
STA PasswordSRAM,X
TXA : INC A : AND.b #$0F : STA !PASSWORD_CODE_POSITION
BNE ++
STZ $012E
@@ -166,7 +164,7 @@ ValidatePassword:
;check for incomplete password
LDX #$0F
-
LDA.l !PASSWORD_SRAM, X : BNE +
LDA.l PasswordSRAM, X : BNE +
JMP .incorrect
+
DEX : BPL -
@@ -229,7 +227,7 @@ PasswordToKey:
LDA.w #$000B : STA $04
-
LDX $00
LDA !PASSWORD_SRAM, X : DEC : AND #$001F
LDA PasswordSRAM, X : DEC : AND #$001F
LDY $04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA
@@ -343,7 +341,7 @@ UpdatePasswordTiles:
REP #$30 ; set 16-bit both
LDX.w #$000F
-
LDA.l !PASSWORD_SRAM, X : AND.w #$00FF : TXY
LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA $00
TYA : ASL #4 : STA $03
LDX $00 : LDA.l HashAlphabetTilesWithBlank, X

View File

@@ -2,19 +2,19 @@
; Pendant / Crystal HUD Fix
;--------------------------------------------------------------------------------
;CheckPendantHUD:
; LDA !HUD_FLAG : CMP.b #$40 ; check for hud flag instead
; LDA HudFlag : CMP.b #$40 ; check for hud flag instead
;RTL
;================================================================================
FlipLWDWFlag:
PHP
SEP #$20 ; set 8-bit accumulator
LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA
LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld
BEQ +
LDA.b #07 : BRA ++ ; dark world - crystals
+
LDA.b #03 ; light world - pendants
++
STA $7EF3C7
STA MapIcons
PLP
RTL
;================================================================================
@@ -23,7 +23,7 @@ HUDRebuildIndoorHole:
LDA.l GenericKeys : BEQ .normal
.generic
PLA
LDA $7EF38B ; generic key count
LDA CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace
RTL
.normal
@@ -35,104 +35,28 @@ HUDRebuildIndoor:
LDA.l GenericKeys : BEQ .normal
.generic
LDA.b #$00 : STA $7EC017
LDA $7EF38B ; generic key count
LDA CurrentGenericKeys ; generic key count
RTL
.normal
LDA.b #$00 : STA $7EC017
LDA.b #$FF ; don't show keys
RTL
;================================================================================
GetCrystalNumber:
PHX
TXA : ASL : TAX
LDA $7EF3CA : EOR.b #$40 : BNE +
INX
+
LDA.l CrystalNumberTable-16, X
PLX
RTL
;================================================================================
!INVENTORY_MAP = "$7EF368"
!MAP_OVERLAY = "$7EF414" ; [2]
OverworldMap_CheckObject:
PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA $7EF3CA : AND.b #$40 : BNE +
;LW Map
LDA.l MapMode : BEQ +++
LDA !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$01 : BNE +++
PHX
LDA.l .lw_map_offsets, X : TAX ; put map offset into X
LDA !INVENTORY_MAP, X : ORA !MAP_OVERLAY, 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 !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$02 : BNE +++
PHX
LDA.l .dw_map_offsets, X : TAX ; put map offset into X
LDA.l !INVENTORY_MAP, X : ORA !MAP_OVERLAY, 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 $7EF374 : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkCrystal
LDA $7EF37A : 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
LDA $7EF3CA : EOR.b #$40
LDA CurrentWorld : EOR.b #$40
BNE +
LDA.b #07 : BRA ++ ; dark world - crystals
+
LDA.b #03 ; light world - pendants
++
STA $7EF3C7
STA MapIcons
PLP
RTL
;================================================================================
GetMapMode:
LDA $7EF3CA : AND.b #$40 : BEQ +
LDA CurrentWorld : AND.b #$40 : BEQ +
LDA.b #07 ; dark world - crystals
RTL
+
@@ -193,7 +117,7 @@ RTL
ShowDungeonItems:
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
;LDA $F0 : AND.w #$0020 ; check for select
LDA !HUD_FLAG : AND.w #$0020 ; check hud flag
LDA HudFlag : AND.w #$0020 ; check hud flag
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards
LDA $040C : AND.w #$00FF : CMP.w #$00FF ; original logic
RTL
@@ -205,13 +129,13 @@ UpdateKeys:
LSR : TAX ; get dungeon index and store to X
LDA $7EF36F ; load current key count
STA $7EF37C, X ; save to main counts
LDA CurrentSmallKeys ; load current key count
STA DungeonKeys, X ; save to main counts
CPX.b #$00 : BNE +
STA $7EF37D ; copy HC to sewers
STA HyruleCastleKeys ; copy HC to sewers
+ : CPX.b #$01 : BNE +
STA $7EF37C ; copy sewers to HC
STA SewerKeys ; copy sewers to HC
+
.skip
JSL.l PostItemGet
@@ -285,19 +209,19 @@ DrawHUDDungeonItems:
dw 30 ; Ganon's Tower
.small_key_x_offset
dw $7EF37D-$7EF37D ; Hyrule Castle
dw $7EF37E-$7EF37D ; Eastern
dw $7EF37F-$7EF37D ; Desert
dw $7EF386-$7EF37D ; Hera
dw $7EF380-$7EF37D ; Agahnims Tower
dw $7EF382-$7EF37D ; PoD
dw $7EF381-$7EF37D ; Swamp
dw $7EF384-$7EF37D ; Skull Woods
dw $7EF387-$7EF37D ; Thieves Town
dw $7EF385-$7EF37D ; Ice
dw $7EF383-$7EF37D ; Mire
dw $7EF388-$7EF37D ; Turtle Rock
dw $7EF389-$7EF37D ; Ganon's Tower
dw HyruleCastleKeys-DungeonKeys ; Hyrule Castle
dw EasternKeys-DungeonKeys ; Eastern
dw DesertKeys-DungeonKeys ; Desert
dw HeraKeys-DungeonKeys ; Hera
dw CastleTowerKeys-DungeonKeys ; Agahnims Tower
dw PalaceOfDarknessKeys-DungeonKeys ; PoD
dw SwampKeys-DungeonKeys ; Swamp
dw SkullWoodsKeys-DungeonKeys ; Skull Woods
dw ThievesTownKeys-DungeonKeys ; Thieves Town
dw IcePalaceKeys-DungeonKeys ; Ice
dw MireKeys-DungeonKeys ; Mire
dw TurtleRockKeys-DungeonKeys ; Turtle Rock
dw GanonsTowerKeys-DungeonKeys ; Ganon's Tower
.dungeon_bitmasks
@@ -366,7 +290,7 @@ DrawHUDDungeonItems:
DEX : DEX : BPL --
LDA.l !HUD_FLAG : AND.w #$0020 : BEQ +
LDA.l HudFlag : AND.w #$0020 : BEQ +
JMP .maps_and_compasses
@@ -386,7 +310,7 @@ DrawHUDDungeonItems:
.next_small_key
LDX.w .small_key_x_offset,Y
LDA.l $7EF37D,X
LDA.l DungeonKeys,X
AND.w #$00FF
LDX.w .dungeon_positions,Y
@@ -410,7 +334,7 @@ DrawHUDDungeonItems:
LDX.w #0
; load once and test multiple times
LDA.l $7EF366
LDA.l BigKeyField
.next_big_key
BIT.w .dungeon_bitmasks,X
@@ -421,7 +345,7 @@ DrawHUDDungeonItems:
STA.w $16C6,Y
; reload
LDA.l $7EF366
LDA.l BigKeyField
..skip_key
INX : INX
@@ -439,7 +363,7 @@ DrawHUDDungeonItems:
.next_boss_kill
LDX.w .boss_room_ids,Y
LDA.l $7EF000,X
LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ..skip_boss_kill
@@ -469,20 +393,22 @@ DrawHUDDungeonItems:
LDX.w #0
; load once and test multiple times
LDA.l $7EF368
LDA.l MapField
.next_map
BIT.w .dungeon_bitmasks,X
BEQ ..skip_map
BNE ..draw_map
; MapMode indicates if maps are needed for the info
LDA.l MapMode : AND #$00FF : BNE ..skip_map
..draw_map
LDY.w .dungeon_positions,X
LDA.w #$2826
JSL MapIndicatorLong
STA.w $1686,Y
; reload
LDA.l $7EF368
..skip_map
; reload
LDA.l MapField
INX : INX
CPX.w #26 : BCC .next_map
@@ -498,7 +424,7 @@ DrawHUDDungeonItems:
LDX.w #0
; load once and test multiple times
LDA.l $7EF364
LDA.l CompassField
.next_compass
BIT.w .dungeon_bitmasks,X
@@ -509,7 +435,7 @@ DrawHUDDungeonItems:
STA.w $16C6,Y
; reload
LDA.l $7EF364
LDA.l CompassField
..skip_compass
INX : INX
@@ -542,7 +468,7 @@ DrawPendantCrystalDiagram:
INX #2 : CPX.w #$0014 : BCC -
; pendants
LDA $7EF374
LDA PendantsField
LSR : BCC + ; pendant of wisdom (red)
LDX.w #$252B
@@ -569,7 +495,7 @@ DrawPendantCrystalDiagram:
; crystals
LDA $7EF37A
LDA CrystalsField
LDX.w #$2D44
LDY.w #$2D45
@@ -675,4 +601,4 @@ dw $A8FB, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $E8FB
;0x1A - Ganon's Tower
;0x1C - ??? possibly unused. (Were they planning two extra dungeons perhaps?)
;0x1E - ??? possibly unused.
;================================================================================
;================================================================================

View File

@@ -1,30 +1,35 @@
; Note shortly before this we have a blank-the-sram slot code that we might want to hook
WriteBlanksToPlayerName:
STA.l !ExtendedPlayerName
STA.l !ExtendedPlayerName+2
STA.l !ExtendedPlayerName+4
STA.l !ExtendedPlayerName+6
STA.l ExtendedFileNameSRAM
STA.l ExtendedFileNameSRAM+2
STA.l ExtendedFileNameSRAM+4
STA.l ExtendedFileNameSRAM+6
STA.l !ExtendedPlayerName+8
STA.l !ExtendedPlayerName+10
STA.l !ExtendedPlayerName+12
STA.l !ExtendedPlayerName+14
STA.l ExtendedFileNameSRAM+8
STA.l ExtendedFileNameSRAM+10
STA.l ExtendedFileNameSRAM+12
STA.l ExtendedFileNameSRAM+14
STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot)
STA.l ExtendedFileNameSRAM+16
STA.l ExtendedFileNameSRAM+18
STA.l ExtendedFileNameSRAM+20
STA.l ExtendedFileNameSRAM+22
STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot)
RTL
WriteCharacterToPlayerName:
CPX.w #$0008 : !BLT .orig
STA !ExtendedPlayerName-8, X
.orig
STA $7003D9, X ;what we wrote over
STA ExtendedFileNameSRAM, X
CPX.w #$0008 : !BGE +
STA $7003D9, X ;what we wrote over
+
RTL
ReadCharacterFromPlayerName: ;Only for use on Name Screen
CPX.w #$0008 : !BLT .orig
LDA !ExtendedPlayerName-8, X
.orig
LDA $7003D9, X ;what we wrote over
LDA ExtendedFileNameSRAM, X
CPX.w #$0008 : !BGE +
LDA $7003D9, X ;what we wrote over
+
RTL
GetCharacterPosition:

View File

@@ -15,19 +15,19 @@ RefillHealth:
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done
LDA !BUSY_HEALTH : BNE ++
LDA.l PotionHealthRefill ; load refill amount
!ADD $7EF36D ; add to current health
CMP $7EF36C : !BLT +++ : LDA $7EF36C : +++
!ADD CurrentHealth ; add to current health
CMP MaximumHealth : !BLT +++ : LDA MaximumHealth : +++
STA !BUSY_HEALTH
++
LDA $7EF36D : CMP.l !BUSY_HEALTH : !BLT ++
LDA.b #$00 : STA $7EF372
LDA CurrentHealth : CMP.l !BUSY_HEALTH : !BLT ++
LDA.b #$00 : STA HeartsFiller
LDA $020A : BNE .notDone
LDA.b #$00 : STA !BUSY_HEALTH
SEC
RTL
++
LDA.b #$08 : STA $7EF372 ; refill some health
LDA.b #$08 : STA HeartsFiller ; refill some health
.notDone
CLC
RTL
@@ -35,16 +35,16 @@ RefillHealth:
; Check goal health versus actual health.
; if(actual < goal) then branch.
LDA $7EF36D : CMP $7EF36C : BCC .refillAllHealth
LDA $7EF36C : STA $7EF36D
LDA.b #$00 : STA $7EF372
LDA CurrentHealth : CMP MaximumHealth : BCC .refillAllHealth
LDA MaximumHealth : STA CurrentHealth
LDA.b #$00 : STA HeartsFiller
; ??? not sure what purpose this branch serves.
LDA $020A : BNE .beta
SEC
RTL
.refillAllHealth
; Fill up ze health.
LDA.b #$A0 : STA $7EF372
LDA.b #$A0 : STA HeartsFiller
.beta
CLC
RTL
@@ -62,27 +62,27 @@ RefillMagic:
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done
LDA !BUSY_MAGIC : BNE ++
LDA.l PotionMagicRefill ; load refill amount
!ADD $7EF36E ; add to current magic
!ADD CurrentMagic ; add to current magic
CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++
STA !BUSY_MAGIC
++
LDA $7EF36E : CMP.l !BUSY_MAGIC : !BLT ++
LDA CurrentMagic : CMP.l !BUSY_MAGIC : !BLT ++
LDA.b #$00 : STA !BUSY_MAGIC
SEC
RTL
++
LDA.b #$01 : STA $7EF373 ; refill some magic
LDA.b #$01 : STA MagicFiller ; refill some magic
CLC
RTL
.done
SEP #$30
; Check if Link's magic meter is full
LDA $7EF36E : CMP.b #$80
LDA CurrentMagic : CMP.b #$80
BCS .itsFull
; Tell the magic meter to fill up until it's full.
LDA.b #$80 : STA $7EF373
LDA.b #$80 : STA MagicFiller
SEP #$30
RTL
.itsFull

View File

@@ -1,66 +0,0 @@
;================================================================================
; RTPreview SRAM Hook
;--------------------------------------------------------------------------------
MaybeWriteSRAMTrace:
LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
JSL.l WriteStatusPreview
+
RTL
;--------------------------------------------------------------------------------
WriteStatusPreview:
PHA
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
STA $4301 ; set bus B source to WRAM register
LDA #$40 : STA $2181 ; set WRAM register source address
LDA #$F3 : STA $2182
LDA #$7E : STA $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$1E : STA $4303
LDA #$70 : STA $4304
LDA #$80 : STA $4305 ; set transfer size to 0x180
LDA #$01 : STA $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
PLA
RTL
;--------------------------------------------------------------------------------
;WriteStatusPreview:
; PHA : PHX : PHP
;
; REP #$20 ; set 16-bit accumulator
; CLC
; LDX.b #$00
; -
; LDA $7EF340, X : STA $701E00, X
; LDA $7EF340+2, X : STA $701E00+2, X
; LDA $7EF340+4, X : STA $701E00+4, X
; TXA : ADC.b #$06 : TAX
; CPX #$24 : !BLT -
;
; SEP #$20 ; set 8-bit accumulator
; LDA $7EF374 : STA $701E24
; LDA $7EF37A : STA $701E25
;
; PLP : PLX : PLA
;RTL
;--------------------------------------------------------------------------------

View File

@@ -28,7 +28,7 @@ QuickSwap:
BRA .store
.special_swap
LDA !INVENTORY_SWAP_2 : ORA #$01 : STA !INVENTORY_SWAP_2
LDA InventoryTracking+1 : ORA #$01 : STA InventoryTracking+1
CPX.b #$02 : BEQ + ; boomerang
CPX.b #$01 : BEQ + ; bow
CPX.b #$05 : BEQ + ; powder
@@ -50,10 +50,10 @@ RTL
RCode:
LDX.w $0202
LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame
LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
BRA +
++
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ +
LDA InventoryTracking+1 : BIT #$01 : BEQ +
RTS
-
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
@@ -65,10 +65,10 @@ RTS
LCode:
LDX.w $0202
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame
LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
BRA +
++
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ +
LDA InventoryTracking+1 : BIT #$01 : BEQ +
RTS
-
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14

18
ram.asm Normal file
View File

@@ -0,0 +1,18 @@
;================================================================================
; RAM Labels & Assertions
;--------------------------------------------------------------------------------
; Labels for values in WRAM and assertions that ensure they're correct and
; at the expected addresses. All values larger than one byte are little endian.
;--------------------------------------------------------------------------------
; Placeholder and for compass item max count allocations, still WIP
;--------------------------------------------------------------------------------
CompassTotalsWRAM = $7F5410
;================================================================================
; RAM Assertions
;--------------------------------------------------------------------------------
macro assertRAM(label, address)
assert <label> = <address>, "<label> labeled at incorrect address."
endmacro
%assertRAM(CompassTotalsWRAM, $7F5410)

View File

@@ -1,48 +1,46 @@
!INFINITE_BOMBS = "$7F50C9"
IsItemAvailable:
LDA !INFINITE_BOMBS : BEQ .finite
JSL CheckInfiniteBombs : BEQ .finite
.infinite
CPX.b #$04 : BNE .finite
LDA.b #$01 : RTL
.finite
LDA $7EF33F, X
LDA EquipmentWRAM-1, X
RTL
LoadBombCount:
LDA !INFINITE_BOMBS : BNE .infinite
JSL CheckInfiniteBombs : BNE .infinite
.finite
LDA $7EF343
LDA BombsEquipment
.infinite
RTL
LoadBombCount16:
LDA !INFINITE_BOMBS : AND.w #$00FF : BNE .infinite
JSL CheckInfiniteBombs16 : BNE .infinite
.finite
LDA $7EF343
LDA BombsEquipment
.infinite
RTL
StoreBombCount:
JSL IncrementBombsPlacedCounter
PHA : LDA !INFINITE_BOMBS : BEQ .finite
PHA : JSL CheckInfiniteBombs : BEQ .finite
.infinite
PLA : LDA.b #$01 : RTL
.finite
PLA : STA $7EF343
PLA : STA BombsEquipment
RTL
SearchForEquippedItem:
LDA !INFINITE_BOMBS : BEQ +
JSL CheckInfiniteBombs : BEQ +
LDA.b #$01 : LDX.b #$00 : RTL
+
LDA $7EF340 ; thing we wrote over
LDA BowEquipment ; thing we wrote over
RTL
!INFINITE_ARROWS = "$7F50C8"
DecrementArrows:
LDA !INFINITE_ARROWS : BNE .infinite
LDA InfiniteArrowsModifier : BNE .infinite
LDA.l ArrowMode : BNE .rupees : BRA .normal
.infinite
LDA.b #$01 : RTL
.normal
LDA $7EF377 : BEQ .done
DEC : STA $7EF377 : INC
LDA CurrentArrows : BEQ .done
DEC : STA CurrentArrows : INC
BRA .done
.rupees
REP #$20
@@ -52,17 +50,17 @@ DecrementArrows:
LDA.b #$00 : BRA .done
.not_archery_game
LDA.l $7EF377 : BNE .shoot_arrow ; check if we have arrows
LDA.l CurrentArrows : BNE .shoot_arrow ; check if we have arrows
BRA .done
.shoot_arrow
PHX
REP #$20
LDA $7EF360 : BEQ +
PHA : LDA $7EF340 : DEC : AND #$0002 : TAX : PLA
LDA CurrentRupees : BEQ +
PHA : LDA BowEquipment : DEC : AND #$0002 : TAX : PLA
!SUB.l ArrowModeWoodArrowCost, X ; CMP.w #$0000
BMI .not_enough_money
STA $7EF360 : LDA.w #$0001 : BRA +
STA CurrentRupees : LDA.w #$0001 : BRA +
.not_enough_money
LDA.w #$0000
+
@@ -77,13 +75,13 @@ ArrowGame:
DEC $0B99 ; reduce minigame arrow count
LDA.l ArrowMode : BNE .rupees
.normal
LDA $7EF377 : INC #2 : STA $7EF377 ; increment arrow count (by 2 for some reason)
LDA CurrentArrows : INC #2 : STA CurrentArrows ; increment arrow count (by 2 for some reason)
RTL
.rupees
PHX
REP #$20 ; set 16-bit accumulator
LDA $7EF340 : DEC : AND #$0002 : TAX
LDA $7EF360 : !ADD.l ArrowModeWoodArrowCost, X : STA $7EF360
LDA BowEquipment : DEC : AND #$0002 : TAX
LDA CurrentRupees : !ADD.l ArrowModeWoodArrowCost, X : STA CurrentRupees
SEP #$20 ; set 8-bit accumulator
PLX
+

View File

@@ -22,6 +22,7 @@ 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
@@ -97,7 +98,7 @@ RNG_Ganon_Extra_Warp:
PLA
RTL
RNG_Enemy_Drops:
LDA.l $7EF3C5 : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda
LDA.l ProgressIndicator : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda
JML GetRandomInt
+
LDA.b #$0F

View File

@@ -83,69 +83,14 @@ IcePalaceBombosNE:
%DrawBombosPlatform(14, 18, 1, 0)
RTL
CastleEastEntrance:
LDA $7EF3C5 : 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
CastleEastEntrance: ; new solution (see Rain Prevention)
RTL
CastleWestEntrance:
LDA $7EF3C5 : 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
CastleWestEntrance: ; new solution (see Rain Prevention)
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

@@ -5,13 +5,11 @@ Draw4DigitRupees:
LDA $1B : AND.w #$00FF : BEQ .outdoors ; skip if outdoors
.indoors
LDA $A0 : BNE .normal ; skip except for ganon's room
;LDA #$246E : STA $7EC712
;LDA #$246F : STA $7EC714
LDA $7EF423 : AND #$00FF
LDA TotalItemCounter
BRA .print
.outdoors
.normal
LDA $7EF362
LDA DisplayRupees
.print
JSL.l HexToDec
LDA $7F5004 : AND.w #$00FF : ORA.w #$2400 : STA $7EC750
@@ -19,4 +17,4 @@ Draw4DigitRupees:
LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA $7EC754
LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA $7EC756
RTL
;================================================================================
;================================================================================

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 $06a4
org $1BBA71+$35+$35 : dw $011c
org $1BBB73+$35 : db $36
org $02DAEE+$37+$37 : dw $0010
org $02DB8C+$37 : db $1B
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 $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 $02E0CB+$37+$37 : dw $0000
org $02E169+$37+$37 : dw $0000
org $02E169+$37+$37 : dw $811c
;org $02E849 ; Fly 1 to Sanctuary

View File

@@ -27,6 +27,11 @@ 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
@@ -55,16 +60,16 @@ CopyExtendedSaveFileToWRAM:
LDA #$80 : STA $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182
LDA #$7F : STA $2183
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$60 : STA $2182
LDA #$7F : STA $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
LDA #$05 : STA $4303
LDA #$70 : STA $4304
LDA #$00 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307
LDA #$00 : STA $4305 ; set transfer size to 0x1000
LDA #$10 : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer
;--------------------------------------------------------------------------------
@@ -97,15 +102,15 @@ CopyExtendedWRAMSaveFileToSRAM:
STA $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182
LDA #$7F : STA $2183
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$60 : STA $2182
LDA #$7F : STA $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
LDA #$00 : STA $4305 ; set transfer size to 0xB00
LDA #$10 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer

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