mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
LADX: generate without rom (#4278)
This commit is contained in:
@@ -425,46 +425,11 @@ class TrendyGame(Choice):
|
||||
default = option_normal
|
||||
|
||||
|
||||
class GfxMod(FreeText, LADXROption):
|
||||
class GfxMod(DefaultOffToggle):
|
||||
"""
|
||||
Sets the sprite for link, among other things
|
||||
The option should be the same name as a with sprite (and optional name) file in data/sprites/ladx
|
||||
If enabled, the patcher will prompt the user for a modification file to change sprites in the game and optionally some text.
|
||||
"""
|
||||
display_name = "GFX Modification"
|
||||
ladxr_name = "gfxmod"
|
||||
normal = ''
|
||||
default = 'Link'
|
||||
|
||||
__spriteDir: str = Utils.local_path(os.path.join('data', 'sprites', 'ladx'))
|
||||
__spriteFiles: typing.DefaultDict[str, typing.List[str]] = defaultdict(list)
|
||||
|
||||
extensions = [".bin", ".bdiff", ".png", ".bmp"]
|
||||
|
||||
for file in os.listdir(__spriteDir):
|
||||
name, extension = os.path.splitext(file)
|
||||
if extension in extensions:
|
||||
__spriteFiles[name].append(file)
|
||||
|
||||
def __init__(self, value: str):
|
||||
super().__init__(value)
|
||||
|
||||
def verify(self, world, player_name: str, plando_options) -> None:
|
||||
if self.value == "Link" or self.value in GfxMod.__spriteFiles:
|
||||
return
|
||||
raise Exception(
|
||||
f"LADX Sprite '{self.value}' not found. Possible sprites are: {['Link'] + list(GfxMod.__spriteFiles.keys())}")
|
||||
|
||||
def to_ladxr_option(self, all_options):
|
||||
if self.value == -1 or self.value == "Link":
|
||||
return None, None
|
||||
|
||||
assert self.value in GfxMod.__spriteFiles
|
||||
|
||||
if len(GfxMod.__spriteFiles[self.value]) > 1:
|
||||
logger.warning(
|
||||
f"{self.value} does not uniquely identify a file. Possible matches: {GfxMod.__spriteFiles[self.value]}. Using {GfxMod.__spriteFiles[self.value][0]}")
|
||||
|
||||
return self.ladxr_name, self.__spriteDir + "/" + GfxMod.__spriteFiles[self.value][0]
|
||||
|
||||
|
||||
class Palette(Choice):
|
||||
|
||||
Reference in New Issue
Block a user