From b077b2aeef086c2a376eba0a9892d54504986c2e Mon Sep 17 00:00:00 2001 From: lordlou <87331798+lordlou@users.noreply.github.com> Date: Mon, 3 Jul 2023 07:40:32 -0400 Subject: [PATCH] SM: save and quit escape restriction and bad EscapeTrigger code fix (#1929) * prevent using save and reload when escaping Zebes fixed wrong code when EscapeTrigger is required (X.item.advancement isnt defined for ItemLocation) --- worlds/sm/__init__.py | 29 +- .../multiworld-basepatch.ips | Bin 19117 -> 19126 bytes .../data/SMBasepatch_prebuilt/multiworld.sym | 271 +++++++++--------- .../sm-basepatch-symbols.json | 10 +- 4 files changed, 158 insertions(+), 152 deletions(-) diff --git a/worlds/sm/__init__.py b/worlds/sm/__init__.py index 28ed288d..f7d0f717 100644 --- a/worlds/sm/__init__.py +++ b/worlds/sm/__init__.py @@ -345,6 +345,18 @@ class SMWorld(World): loc.address = loc.item.code = None def post_fill(self): + def get_player_ItemLocation(progression_only: bool): + return [ + ItemLocation(copy.copy(ItemManager.Items[ + itemLoc.item.type if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else + 'ArchipelagoItem']), + copy.copy(locationsDict[itemLoc.name] if itemLoc.game == self.game else + locationsDict[first_local_collected_loc.name]), + itemLoc.item.player, + True) + for itemLoc in SMWorld.spheres if itemLoc.item.player == self.player and (not progression_only or itemLoc.item.advancement) + ] + # Having a sorted itemLocs from collection order is required for escapeTrigger when Tourian is Disabled. # We cant use stage_post_fill for this as its called after worlds' post_fill. # get_spheres could be cached in multiworld? @@ -366,22 +378,13 @@ class SMWorld(World): #used to simulate received items first_local_collected_loc = next(itemLoc for itemLoc in SMWorld.spheres if itemLoc.player == self.player) - playerItemsItemLocs = [ - ItemLocation(copy.copy(ItemManager.Items[ - itemLoc.item.type if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else - 'ArchipelagoItem']), - copy.copy(locationsDict[itemLoc.name] if itemLoc.game == self.game else - locationsDict[first_local_collected_loc.name]), - itemLoc.item.player, - True) - for itemLoc in SMWorld.spheres if itemLoc.item.player == self.player - ] - for itemLoc in playerItemsItemLocs: + playerItemsItemLocs = get_player_ItemLocation(False) + playerProgItemsItemLocs = get_player_ItemLocation(True) + + for itemLoc in playerItemsItemLocs + playerProgItemsItemLocs: if itemLoc.Item.Class == "Boss": itemLoc.Item.Class = "Minor" - playerProgItemsItemLocs = [itemLoc for itemLoc in playerItemsItemLocs if itemLoc.item.advancement] - escapeTrigger = (playerItemsItemLocs, playerProgItemsItemLocs, 'Full') escapeOk = self.variaRando.randoExec.graphBuilder.escapeGraph(self.variaRando.container, self.variaRando.randoExec.areaGraph, self.variaRando.randoExec.randoSettings.maxDiff, escapeTrigger) diff --git a/worlds/sm/data/SMBasepatch_prebuilt/multiworld-basepatch.ips b/worlds/sm/data/SMBasepatch_prebuilt/multiworld-basepatch.ips index e7b7c54649929a5ea1f5ed11a26d7b84c9e73aaf..0455364d8a7b68251975be054fbb7e8ffbde4791 100644 GIT binary patch delta 74 zcmV-Q0JZxSu0g#Y5!wAAKNTrJ@Ffhq5FwiTn1SW9MC9M|*&>*dt3CRKgkQlGR g34X}{0Pqi~4gexEf`G6FXec1ek-szn6|wZWNk7LN!~g&Q delta 65 zcmV-H0KWgWl>x1l0g#X{x(LEBNTrJ@Ffhq5Fwi2e1SW9M9IY1y&=;+k3CRKgkPolI X34X}{0PqHAC?La;$TR^AvHiJ8Pb(S0 diff --git a/worlds/sm/data/SMBasepatch_prebuilt/multiworld.sym b/worlds/sm/data/SMBasepatch_prebuilt/multiworld.sym index 6d73322f..2d231bc8 100644 --- a/worlds/sm/data/SMBasepatch_prebuilt/multiworld.sym +++ b/worlds/sm/data/SMBasepatch_prebuilt/multiworld.sym @@ -2,7 +2,7 @@ ; generated by asar [labels] -82:FA1A :neg_1_1 +82:FA23 :neg_1_1 B8:83C1 :neg_1_2 B8:85DA :neg_1_3 B8:85F9 :neg_1_4 @@ -41,7 +41,7 @@ B8:8609 ap_playerid_to_rom_other_player_index_notfound 84:FC20 archipelago_visible_item_plm 84:FC42 c_item 82:F990 check_reload -82:F9C0 check_reload_end +82:F9C9 check_reload_end CE:FF04 config_deathlink CE:FF00 config_flags CE:FF00 config_multiworld @@ -53,8 +53,8 @@ B8:83FD copy_memory B8:8417 copy_memory_done B8:8409 copy_memory_even B8:840F copy_memory_loop -82:F9C3 deathhook -82:F9D8 deathhook_zebes +82:F9CC deathhook +82:F9E1 deathhook_zebes 84:FC44 h_item 84:FC5D i_chozo_item 84:FC64 i_hidden_item @@ -177,7 +177,7 @@ A0:FE00 setup_music A0:FE0B setup_music_quick A0:FE94 setup_samus A0:FEA5 setup_samus_normal -82:FA0C sm_fix_checksum +82:FA15 sm_fix_checksum B8:8800 sm_item_graphics B8:882E sm_item_plm_pickup_sequence_pointers B8:847B sm_save_done_hook @@ -192,7 +192,7 @@ B8:83F4 write_repeated_memory_loop [source files] 0000 fe019f55 main.asm -0001 5d628289 ../common/fast_reload.asm +0001 91a745e3 ../common/fast_reload.asm 0002 06780555 ../common/nofanfare.asm 0003 7a8904b6 ../common/multiworld.asm 0004 f7e9db95 ../common/itemextras.asm @@ -200,7 +200,7 @@ B8:83F4 write_repeated_memory_loop 0006 dbfcb38d ../common/startitem.asm [rom checksum] -72f7eb3b +f95f09a7 [addr-to-line mapping] ff:ffff 0000:00000001 @@ -223,137 +223,140 @@ ce:ff0a 0001:00000012 82:f9b5 0001:00000025 82:f9b8 0001:00000026 82:f9ba 0001:00000027 -82:f9bb 0001:00000028 -82:f9bc 0001:00000029 -82:f9bf 0001:0000002a -82:f9c0 0001:0000002c -82:f9c1 0001:0000002d -82:f9c2 0001:0000002e -82:f9c3 0001:00000031 -82:f9c4 0001:00000032 -82:f9c6 0001:00000033 -82:f9c9 0001:00000034 -82:f9cc 0001:00000036 -82:f9d0 0001:00000037 -82:f9d3 0001:00000037 -82:f9d5 0001:00000038 -82:f9d8 0001:0000003a -82:f9d9 0001:0000003b -82:f9dc 0001:0000003b -82:f9dd 0001:0000003b -82:f9e0 0001:0000003c -82:f9e1 0001:0000003c -82:f9e2 0001:0000003d -82:f9e5 0001:0000003d -82:f9e8 0001:0000003e +82:f9bd 0001:00000028 +82:f9c1 0001:00000029 +82:f9c3 0001:0000002a +82:f9c4 0001:0000002b +82:f9c5 0001:0000002c +82:f9c8 0001:0000002d +82:f9c9 0001:0000002f +82:f9ca 0001:00000030 +82:f9cb 0001:00000031 +82:f9cc 0001:00000034 +82:f9cd 0001:00000035 +82:f9cf 0001:00000036 +82:f9d2 0001:00000037 +82:f9d5 0001:00000039 +82:f9d9 0001:0000003a +82:f9dc 0001:0000003a +82:f9de 0001:0000003b +82:f9e1 0001:0000003d +82:f9e2 0001:0000003e +82:f9e5 0001:0000003e +82:f9e6 0001:0000003e 82:f9e9 0001:0000003f -82:f9ed 0001:00000040 +82:f9ea 0001:0000003f +82:f9eb 0001:00000040 +82:f9ee 0001:00000040 82:f9f1 0001:00000041 -82:f9f5 0001:00000043 -82:f9f9 0001:00000044 -82:f9fc 0001:00000045 -82:fa00 0001:00000046 -82:fa04 0001:00000047 -82:fa07 0001:00000048 -82:fa0a 0001:00000049 -82:fa0b 0001:0000004a -82:fa0c 0001:0000004d -82:fa0d 0001:0000004e -82:fa0e 0001:0000004f -82:fa0f 0001:00000050 -82:fa10 0000:00000013 -82:fa12 0001:00000054 -82:fa14 0001:00000055 -82:fa15 0001:00000056 -82:fa17 0001:00000057 -82:fa1a 0001:00000059 -82:fa1e 0001:0000005a -82:fa1f 0001:0000005b -82:fa21 0001:0000005c -82:fa23 0001:0000005d -82:fa24 0001:0000005e -82:fa25 0001:0000005f -82:fa28 0001:00000060 -82:fa2a 0001:00000062 -82:fa2d 0001:00000063 -82:fa2f 0001:00000064 +82:f9f2 0001:00000042 +82:f9f6 0001:00000043 +82:f9fa 0001:00000044 +82:f9fe 0001:00000046 +82:fa02 0001:00000047 +82:fa05 0001:00000048 +82:fa09 0001:00000049 +82:fa0d 0001:0000004a +82:fa10 0001:0000004b +82:fa13 0001:0000004c +82:fa14 0001:0000004d +82:fa15 0001:00000050 +82:fa16 0001:00000051 +82:fa17 0001:00000052 +82:fa18 0001:00000053 +82:fa19 0000:00000013 +82:fa1b 0001:00000057 +82:fa1d 0001:00000058 +82:fa1e 0001:00000059 +82:fa20 0001:0000005a +82:fa23 0001:0000005c +82:fa27 0001:0000005d +82:fa28 0001:0000005e +82:fa2a 0001:0000005f +82:fa2c 0001:00000060 +82:fa2d 0001:00000061 +82:fa2e 0001:00000062 +82:fa31 0001:00000063 82:fa33 0001:00000065 -82:fa37 0001:00000066 -82:fa3a 0001:00000067 -82:fa3e 0001:00000068 -82:fa42 0001:00000069 +82:fa36 0001:00000066 +82:fa38 0001:00000067 +82:fa3c 0001:00000068 +82:fa40 0001:00000069 82:fa43 0001:0000006a -82:fa45 0001:0000006c -82:fa46 0001:0000006d -82:fa47 0001:0000006e -82:fa48 0001:0000006f -82:fa49 0001:00000070 -80:a088 0001:00000076 -80:a08c 0001:00000076 -80:a08d 0001:00000076 -80:a095 0001:00000079 -80:a0ce 0001:0000007c -80:a113 0001:0000007f -91:e164 0001:00000082 -91:e168 0001:00000082 -91:e169 0001:00000082 -a0:fe00 0001:00000087 -a0:fe03 0001:00000088 -a0:fe05 0001:00000089 -a0:fe08 0001:0000008a -a0:fe0b 0001:0000008c -a0:fe0c 0001:0000008f -a0:fe10 0001:00000090 -a0:fe13 0001:00000091 -a0:fe15 0001:00000092 -a0:fe18 0001:00000093 -a0:fe1b 0001:00000094 -a0:fe1f 0001:00000096 -a0:fe23 0001:00000097 -a0:fe27 0001:00000098 -a0:fe2b 0001:00000099 -a0:fe2f 0001:0000009c -a0:fe33 0001:0000009d -a0:fe36 0001:0000009e -a0:fe38 0001:0000009f -a0:fe3c 0001:000000a0 -a0:fe40 0001:000000a2 -a0:fe44 0001:000000a5 -a0:fe48 0001:000000a6 -a0:fe49 0001:000000a7 -a0:fe4c 0001:000000a8 -a0:fe4e 0001:000000a9 -a0:fe4f 0001:000000aa -a0:fe53 0001:000000ab -a0:fe57 0001:000000ad -a0:fe58 0001:000000ae -a0:fe5c 0001:000000af -a0:fe5f 0001:000000b0 -a0:fe62 0001:000000b1 -a0:fe65 0001:000000b2 -a0:fe67 0001:000000b3 -a0:fe6a 0001:000000b4 -a0:fe6d 0001:000000b5 -a0:fe6f 0001:000000b6 -a0:fe73 0001:000000b9 -a0:fe76 0001:000000ba -a0:fe79 0001:000000bb -a0:fe7c 0001:000000bc -a0:fe7f 0001:000000be -a0:fe82 0001:000000bf -a0:fe85 0001:000000c0 -a0:fe89 0001:000000c1 -a0:fe8c 0001:000000c2 -a0:fe90 0001:000000c4 -a0:fe94 0001:000000c7 -a0:fe97 0001:000000c8 -a0:fe99 0001:000000c9 -a0:fe9c 0001:000000ca -a0:fe9f 0001:000000cb -a0:fea2 0001:000000cc -a0:fea5 0001:000000ce -a0:fea8 0001:000000cf -a0:feab 0001:000000d0 +82:fa47 0001:0000006b +82:fa4b 0001:0000006c +82:fa4c 0001:0000006d +82:fa4e 0001:0000006f +82:fa4f 0001:00000070 +82:fa50 0001:00000071 +82:fa51 0001:00000072 +82:fa52 0001:00000073 +80:a088 0001:00000079 +80:a08c 0001:00000079 +80:a08d 0001:00000079 +80:a095 0001:0000007c +80:a0ce 0001:0000007f +80:a113 0001:00000082 +91:e164 0001:00000085 +91:e168 0001:00000085 +91:e169 0001:00000085 +a0:fe00 0001:0000008a +a0:fe03 0001:0000008b +a0:fe05 0001:0000008c +a0:fe08 0001:0000008d +a0:fe0b 0001:0000008f +a0:fe0c 0001:00000092 +a0:fe10 0001:00000093 +a0:fe13 0001:00000094 +a0:fe15 0001:00000095 +a0:fe18 0001:00000096 +a0:fe1b 0001:00000097 +a0:fe1f 0001:00000099 +a0:fe23 0001:0000009a +a0:fe27 0001:0000009b +a0:fe2b 0001:0000009c +a0:fe2f 0001:0000009f +a0:fe33 0001:000000a0 +a0:fe36 0001:000000a1 +a0:fe38 0001:000000a2 +a0:fe3c 0001:000000a3 +a0:fe40 0001:000000a5 +a0:fe44 0001:000000a8 +a0:fe48 0001:000000a9 +a0:fe49 0001:000000aa +a0:fe4c 0001:000000ab +a0:fe4e 0001:000000ac +a0:fe4f 0001:000000ad +a0:fe53 0001:000000ae +a0:fe57 0001:000000b0 +a0:fe58 0001:000000b1 +a0:fe5c 0001:000000b2 +a0:fe5f 0001:000000b3 +a0:fe62 0001:000000b4 +a0:fe65 0001:000000b5 +a0:fe67 0001:000000b6 +a0:fe6a 0001:000000b7 +a0:fe6d 0001:000000b8 +a0:fe6f 0001:000000b9 +a0:fe73 0001:000000bc +a0:fe76 0001:000000bd +a0:fe79 0001:000000be +a0:fe7c 0001:000000bf +a0:fe7f 0001:000000c1 +a0:fe82 0001:000000c2 +a0:fe85 0001:000000c3 +a0:fe89 0001:000000c4 +a0:fe8c 0001:000000c5 +a0:fe90 0001:000000c7 +a0:fe94 0001:000000ca +a0:fe97 0001:000000cb +a0:fe99 0001:000000cc +a0:fe9c 0001:000000cd +a0:fe9f 0001:000000ce +a0:fea2 0001:000000cf +a0:fea5 0001:000000d1 +a0:fea8 0001:000000d2 +a0:feab 0001:000000d3 85:ff00 0002:0000010b 85:ff03 0002:0000010c 85:ff06 0002:0000010d diff --git a/worlds/sm/data/SMBasepatch_prebuilt/sm-basepatch-symbols.json b/worlds/sm/data/SMBasepatch_prebuilt/sm-basepatch-symbols.json index 351a5485..1e5dcccb 100644 --- a/worlds/sm/data/SMBasepatch_prebuilt/sm-basepatch-symbols.json +++ b/worlds/sm/data/SMBasepatch_prebuilt/sm-basepatch-symbols.json @@ -22,7 +22,7 @@ "archipelago_visible_item_plm": "84:FC20", "c_item": "84:FC42", "check_reload": "82:F990", - "check_reload_end": "82:F9C0", + "check_reload_end": "82:F9C9", "config_deathlink": "CE:FF04", "config_flags": "CE:FF00", "config_multiworld": "CE:FF00", @@ -34,8 +34,8 @@ "copy_memory_done": "B8:8417", "copy_memory_even": "B8:8409", "copy_memory_loop": "B8:840F", - "deathhook": "82:F9C3", - "deathhook_zebes": "82:F9D8", + "deathhook": "82:F9CC", + "deathhook_zebes": "82:F9E1", "h_item": "84:FC44", "i_chozo_item": "84:FC5D", "i_hidden_item": "84:FC64", @@ -158,7 +158,7 @@ "setup_music_quick": "A0:FE0B", "setup_samus": "A0:FE94", "setup_samus_normal": "A0:FEA5", - "sm_fix_checksum": "82:FA0C", + "sm_fix_checksum": "82:FA15", "sm_item_graphics": "B8:8800", "sm_item_plm_pickup_sequence_pointers": "B8:882E", "sm_save_done_hook": "B8:847B", @@ -172,7 +172,7 @@ "write_repeated_memory_loop": "B8:83F4", "deathhook82": "82:DDC7", "freespace82_start": "82:F990", - "freespace82_end": "82:FA4A", + "freespace82_end": "82:FA53", "freespacea0": "a0:fe00", "SRAM_SAVING": "70:2604", "current_save_slot": "7e:0952",