Skip to content

Commit

Permalink
Merge pull request #273 from randovania/custom-missile-texture
Browse files Browse the repository at this point in the history
Use super missile model with red texture for missile launcher
  • Loading branch information
ThanatosGit authored Feb 17, 2024
2 parents 7cd58d9 + 267db4c commit 43095bb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
Binary file not shown.
Binary file not shown.
12 changes: 3 additions & 9 deletions src/open_samus_returns_rando/pickups/model_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,10 @@ class ModelData:
),
),
"powerup_missilelauncher": ModelData(
bcmdl_path="actors/weapons/missile/models/missile.bcmdl",
bcmdl_path="actors/items/powerup_missilelauncher/models/powerup_missilelauncher.bcmdl",
dependencies=(
"actors/weapons/missile/models/missile.bcmdl",
"actors/weapons/missile/models/burstmodel.bcmdl",
"actors/weapons/missile/animations/blownaway.bcskla",
"actors/weapons/missile/animations/bounce.bcskla",
"actors/weapons/missile/animations/relax.bcskla",
"actors/weapons/missile/fx/burst.bcptl",
"actors/weapons/missile/fx/explosion.bcptl",
"actors/weapons/missile/fx/ignition.bcptl",
"actors/items/powerup_missilelauncher/models/powerup_missilelauncher.bcmdl",
"actors/items/powerup_missilelauncher/models/textures/missile_e.bctex",
),
),
}
Expand Down
9 changes: 1 addition & 8 deletions src/open_samus_returns_rando/pickups/pickup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"powerup_energywave": 50,
"powerup_phasedisplacement": 50,
"powerup_spiderball": 40,
"powerup_missilelauncher": 45,
"item_energytank": 0,
"item_senergytank": 0,
"item_missiletank": 0,
Expand Down Expand Up @@ -217,9 +216,6 @@ def patch_model(self, model_names: list[str], bmsad: dict) -> None:
MODELUPDATER["functions"][0]["params"].pop("Param2")
bmsad["components"].pop("FX")
bmsad["sound_fx"] = ListContainer([])
elif model_name == "powerup_missilelauncher":
bmsad["header"]["model_scale"] = 1.75
bmsad["components"].pop("FX")
else:
bmsad["components"].pop("FX")
bmsad["sound_fx"] = ListContainer([])
Expand Down Expand Up @@ -249,10 +245,7 @@ def patch_model(self, model_names: list[str], bmsad: dict) -> None:
if model_name not in TANK_MODELS:
MODELUPDATER["fields"] = OFFSET
MODELUPDATER["fields"]["vInitPosWorldOffset"]["value"][1] = y_offset
if model_name == "powerup_missilelauncher":
MODELUPDATER["fields"]["vInitAngWorldOffset"]["value"][0] = -1.6
else:
MODELUPDATER["fields"]["vInitAngWorldOffset"]["value"][0] = 0.0
MODELUPDATER["fields"]["vInitAngWorldOffset"]["value"][0] = 0.0


def patch(self, editor: PatcherEditor):
Expand Down
12 changes: 12 additions & 0 deletions src/open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from mercury_engine_data_structures.file_tree_editor import OutputFormat

from open_samus_returns_rando.debug import debug_custom_pickups, debug_spawn_points
from open_samus_returns_rando.files import files_path
from open_samus_returns_rando.logger import LOG
from open_samus_returns_rando.lua_editor import LuaEditor
from open_samus_returns_rando.misc_patches.collision_camera_table import create_collision_camera_table
Expand All @@ -32,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 @@ -50,6 +59,9 @@ def patch_extracted(input_path: Path, output_path: Path, configuration: dict):
editor = PatcherEditor(input_path)
lua_scripts = LuaEditor()

# Add all custom files from RomFS
add_custom_files(editor)

# Apply fixes
apply_static_fixes(editor)

Expand Down

0 comments on commit 43095bb

Please sign in to comment.