Text Plando Support
This commit is contained in:
		
							parent
							
								
									938ccccbd4
								
							
						
					
					
						commit
						07df9b9e80
					
				| 
						 | 
					@ -136,6 +136,7 @@ class World(object):
 | 
				
			||||||
            set_player_attr('dark_room_logic', "lamp")
 | 
					            set_player_attr('dark_room_logic', "lamp")
 | 
				
			||||||
            set_player_attr('restrict_dungeon_item_on_boss', False)
 | 
					            set_player_attr('restrict_dungeon_item_on_boss', False)
 | 
				
			||||||
            set_player_attr('plando_items', [])
 | 
					            set_player_attr('plando_items', [])
 | 
				
			||||||
 | 
					            set_player_attr('plando_texts', {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def secure(self):
 | 
					    def secure(self):
 | 
				
			||||||
        self.random = secrets.SystemRandom()
 | 
					        self.random = secrets.SystemRandom()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -357,7 +357,8 @@ def parse_arguments(argv, no_defaults=False):
 | 
				
			||||||
    ret = parser.parse_args(argv)
 | 
					    ret = parser.parse_args(argv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # cannot be set through CLI currently
 | 
					    # cannot be set through CLI currently
 | 
				
			||||||
    ret.plando_items = {}
 | 
					    ret.plando_items = []
 | 
				
			||||||
 | 
					    ret.plando_texts = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret.glitch_boots = not ret.disable_glitch_boots
 | 
					    ret.glitch_boots = not ret.disable_glitch_boots
 | 
				
			||||||
    if ret.timer == "none":
 | 
					    if ret.timer == "none":
 | 
				
			||||||
| 
						 | 
					@ -386,7 +387,7 @@ def parse_arguments(argv, no_defaults=False):
 | 
				
			||||||
                         'shufflebosses', 'enemy_shuffle', 'enemy_health', 'enemy_damage', 'shufflepots',
 | 
					                         'shufflebosses', 'enemy_shuffle', 'enemy_health', 'enemy_damage', 'shufflepots',
 | 
				
			||||||
                         'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor',
 | 
					                         'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor',
 | 
				
			||||||
                         'heartbeep', "skip_progression_balancing", "triforce_pieces_available",
 | 
					                         'heartbeep', "skip_progression_balancing", "triforce_pieces_available",
 | 
				
			||||||
                         "triforce_pieces_required", "shop_shuffle", "plando_items",
 | 
					                         "triforce_pieces_required", "shop_shuffle", "plando_items", "plando_texts",
 | 
				
			||||||
                         'remote_items', 'progressive', 'dungeon_counters', 'glitch_boots', 'killable_thieves',
 | 
					                         'remote_items', 'progressive', 'dungeon_counters', 'glitch_boots', 'killable_thieves',
 | 
				
			||||||
                         'tile_shuffle', 'bush_shuffle', 'shuffle_prizes', 'sprite_pool', 'dark_room_logic',
 | 
					                         'tile_shuffle', 'bush_shuffle', 'shuffle_prizes', 'sprite_pool', 'dark_room_logic',
 | 
				
			||||||
                         'restrict_dungeon_item_on_boss',
 | 
					                         'restrict_dungeon_item_on_boss',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										1
									
								
								Main.py
								
								
								
								
							| 
						 | 
					@ -88,6 +88,7 @@ def main(args, seed=None):
 | 
				
			||||||
    world.sprite_pool = args.sprite_pool.copy()
 | 
					    world.sprite_pool = args.sprite_pool.copy()
 | 
				
			||||||
    world.dark_room_logic = args.dark_room_logic.copy()
 | 
					    world.dark_room_logic = args.dark_room_logic.copy()
 | 
				
			||||||
    world.plando_items = args.plando_items.copy()
 | 
					    world.plando_items = args.plando_items.copy()
 | 
				
			||||||
 | 
					    world.plando_texts = args.plando_texts.copy()
 | 
				
			||||||
    world.restrict_dungeon_item_on_boss = args.restrict_dungeon_item_on_boss.copy()
 | 
					    world.restrict_dungeon_item_on_boss = args.restrict_dungeon_item_on_boss.copy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    world.rom_seeds = {player: random.Random(world.random.randint(0, 999999999)) for player in range(1, world.players + 1)}
 | 
					    world.rom_seeds = {player: random.Random(world.random.randint(0, 999999999)) for player in range(1, world.players + 1)}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -559,6 +559,13 @@ def roll_settings(weights, plando_options: typing.Set[str] = frozenset(("bosses"
 | 
				
			||||||
                location_world = get_choice("world", placement, False)
 | 
					                location_world = get_choice("world", placement, False)
 | 
				
			||||||
                ret.plando_items.append(PlandoItem(item, location, location_world, from_pool))
 | 
					                ret.plando_items.append(PlandoItem(item, location, location_world, from_pool))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ret.plando_texts = {}
 | 
				
			||||||
 | 
					    if "texts" in plando_options:
 | 
				
			||||||
 | 
					        options = weights.get("plando_texts", [])
 | 
				
			||||||
 | 
					        for placement in options:
 | 
				
			||||||
 | 
					            if roll_percentage(get_choice("percentage", placement, 100)):
 | 
				
			||||||
 | 
					                ret.plando_texts[str(get_choice("at", placement))] = str(get_choice("text", placement))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if 'rom' in weights:
 | 
					    if 'rom' in weights:
 | 
				
			||||||
        romweights = weights['rom']
 | 
					        romweights = weights['rom']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								Rom.py
								
								
								
								
							
							
						
						
									
										7
									
								
								Rom.py
								
								
								
								
							| 
						 | 
					@ -2208,6 +2208,13 @@ def write_strings(rom, world, player, team):
 | 
				
			||||||
        tt['menu_start_2'] = "{MENU}\n{SPEED0}\n≥@'s house\n Dark Chapel\n{CHOICE3}"
 | 
					        tt['menu_start_2'] = "{MENU}\n{SPEED0}\n≥@'s house\n Dark Chapel\n{CHOICE3}"
 | 
				
			||||||
        tt['menu_start_3'] = "{MENU}\n{SPEED0}\n≥@'s house\n Dark Chapel\n Mountain Cave\n{CHOICE2}"
 | 
					        tt['menu_start_3'] = "{MENU}\n{SPEED0}\n≥@'s house\n Dark Chapel\n Mountain Cave\n{CHOICE2}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for at, text in world.plando_texts[player].items():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if at not in tt:
 | 
				
			||||||
 | 
					            raise Exception(f"No text target \"{at}\" found.")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            tt[at] = text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rom.write_bytes(0xE0000, tt.getBytes())
 | 
					    rom.write_bytes(0xE0000, tt.getBytes())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    credits = Credits()
 | 
					    credits = Credits()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								Text.py
								
								
								
								
							
							
						
						
									
										4
									
								
								Text.py
								
								
								
								
							| 
						 | 
					@ -1286,6 +1286,7 @@ class LargeCreditBottomMapper(CharTextMapper):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TextTable(object):
 | 
					class TextTable(object):
 | 
				
			||||||
    SIZE = 0x7355
 | 
					    SIZE = 0x7355
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        self._text = OrderedDict()
 | 
					        self._text = OrderedDict()
 | 
				
			||||||
        self.setDefaultText()
 | 
					        self.setDefaultText()
 | 
				
			||||||
| 
						 | 
					@ -1293,6 +1294,9 @@ class TextTable(object):
 | 
				
			||||||
    def __getitem__(self, key):
 | 
					    def __getitem__(self, key):
 | 
				
			||||||
        return self._text[key]
 | 
					        return self._text[key]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __contains__(self, key):
 | 
				
			||||||
 | 
					        return key in self._text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __setitem__(self, key, value):
 | 
					    def __setitem__(self, key, value):
 | 
				
			||||||
        if not key in self._text:
 | 
					        if not key in self._text:
 | 
				
			||||||
            raise KeyError(key)
 | 
					            raise KeyError(key)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue