[SM] Add support for Remote Items (#317)

This commit is contained in:
lordlou
2022-03-21 00:34:47 -04:00
committed by GitHub
parent 9ba70951d5
commit 7df12930ef
4 changed files with 18 additions and 3 deletions

View File

@@ -52,6 +52,10 @@ class DeathLink(Choice):
alias_true = 1
default = 0
class RemoteItems(Toggle):
"""Indicates you get items sent from your own world. This allows coop play of a world."""
display_name = "Remote Items"
class MaxDifficulty(Choice):
"""Depending on the perceived difficulties of the techniques, bosses, hell runs etc. from the preset, it will prevent the Randomizer from placing an item in a location too difficult to reach with the current items."""
display_name = "Maximum Difficulty"
@@ -225,6 +229,7 @@ sm_options: typing.Dict[str, type(Option)] = {
"start_inventory_removes_from_pool": StartItemsRemovesFromPool,
"preset": Preset,
"start_location": StartLocation,
"remote_items": RemoteItems,
"death_link": DeathLink,
#"majors_split": "Full",
#"scav_num_locs": "10",

View File

@@ -91,6 +91,8 @@ class SMWorld(World):
if (self.variaRando.args.morphPlacement == "early"):
self.world.local_items[self.player].value.add('Morph')
self.remote_items = self.world.remote_items[self.player]
if (len(self.variaRando.randoExec.setup.restrictedLocs) > 0):
self.world.accessibility[self.player] = self.world.accessibility[self.player].from_text("items")
logger.warning(f"accessibility forced to 'items' for player {self.world.get_player_name(self.player)} because of 'fun' settings")
@@ -285,6 +287,7 @@ class SMWorld(World):
openTourianGreyDoors = {0x07C823 + 5: [0x0C], 0x07C831 + 5: [0x0C]}
deathLink = {0x277f04: [self.world.death_link[self.player].value]}
remoteItem = {0x277f06: self.getWordArray(0b001 + (0b010 if self.remote_items else 0b000))}
playerNames = {}
playerNameIDMap = {}
@@ -299,6 +302,7 @@ class SMWorld(World):
'offworldSprites': offworldSprites,
'openTourianGreyDoors': openTourianGreyDoors,
'deathLink': deathLink,
'remoteItem': remoteItem,
'PlayerName': playerNames,
'PlayerNameIDMap': playerNameIDMap}
romPatcher.applyIPSPatchDict(patchDict)
@@ -310,6 +314,7 @@ class SMWorld(World):
self.romName.extend([0] * (21 - len(self.romName)))
romPatcher.applyIPSPatch('ROMName', { 'ROMName': {0x1C4F00 : self.romName, 0x007FC0 : self.romName} })
startItemROMAddressBase = 0x2FD8B9
# current, base value or bitmask, max, base value or bitmask