Skip to content

Commit

Permalink
Refactor custom missile launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Feb 17, 2024
1 parent c91ce8c commit 267db4c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/open_samus_returns_rando/pickups/model_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ class ModelData:
),
),
"powerup_missilelauncher": ModelData(
bcmdl_path="actors/items/powerup_randomissile/models/powerup_randomissile.bcmdl",
bcmdl_path="actors/items/powerup_missilelauncher/models/powerup_missilelauncher.bcmdl",
dependencies=(
"actors/items/powerup_randomissile/models/powerup_randomissile.bcmdl",
"actors/items/powerup_randomissile/models/textures/missile_e.bctex",
"actors/items/powerup_missilelauncher/models/powerup_missilelauncher.bcmdl",
"actors/items/powerup_missilelauncher/models/textures/missile_e.bctex",
),
),
}
Expand Down
15 changes: 10 additions & 5 deletions src/open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def _read_schema():
with Path(__file__).parent.joinpath("files", "schema.json").open() as f:
return json.load(f)

def add_custom_files(editor: PatcherEditor):
custom_romfs = files_path().joinpath("romfs")
for child in custom_romfs.rglob("*"):
if not child.is_file():
continue
relative = child.relative_to(custom_romfs).as_posix()
LOG.info("Adding custom asset %s", relative)
editor.add_new_asset(str(relative), child.read_bytes(), [])

def patch_exefs(exefs_patches: Path):
exefs_patches.mkdir(parents=True, exist_ok=True)
Expand All @@ -51,11 +59,8 @@ def patch_extracted(input_path: Path, output_path: Path, configuration: dict):
editor = PatcherEditor(input_path)
lua_scripts = LuaEditor()

# TODO: Move me somewhere!
missile_tex = files_path().joinpath("missile_e.bctex").read_bytes()
missile_model = files_path().joinpath("powerup_randomissile.bcmdl").read_bytes()
editor.add_new_asset("actors/items/powerup_randomissile/models/powerup_randomissile.bcmdl", missile_model, [])
editor.add_new_asset("actors/items/powerup_randomissile/models/textures/missile_e.bctex", missile_tex, [])
# Add all custom files from RomFS
add_custom_files(editor)

# Apply fixes
apply_static_fixes(editor)
Expand Down

0 comments on commit 267db4c

Please sign in to comment.