Skip to content

Commit

Permalink
Merge pull request #456 from randovania:big-baby
Browse files Browse the repository at this point in the history
Support custom Baby size
  • Loading branch information
ThanatosGit authored Aug 17, 2024
2 parents 224b885 + 6b26616 commit dfc5763
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/open_samus_returns_rando/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,25 @@
},
"default": {}
},
"actor_attributes": {
"description": "Modifications to actor attributes.",
"type": "object",
"properties": {
"babyhatchling": {
"properties": {
"model_scale": {
"description": "Size of the Baby Metroid.",
"type": "number",
"minimum": 0.1,
"maximum": 10,
"default": 0.6600000262260437
}
},
"default": {}
}
},
"default": {}
},
"configuration_identifier": {
"type": "string",
"description": "An unique identifier for this configuration. Only save files created with this identifier can be loaded."
Expand Down
11 changes: 11 additions & 0 deletions src/open_samus_returns_rando/misc_patches/actor_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from mercury_engine_data_structures.formats import Bmsad
from open_samus_returns_rando.patcher_editor import PatcherEditor


def patch_actor_attributes(editor: PatcherEditor, configuration: dict) -> None:
_custom_baby_size(editor, configuration)


def _custom_baby_size(editor: PatcherEditor, configuration: dict) -> None:
baby = editor.get_file("actors/characters/babyhatchling/charclasses/babyhatchling.bmsad", Bmsad)
baby.raw["header"]["model_scale"] = configuration["babyhatchling"]["model_scale"]
4 changes: 4 additions & 0 deletions src/open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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.actor_attributes import patch_actor_attributes
from open_samus_returns_rando.misc_patches.block_patches import patch_block_types
from open_samus_returns_rando.misc_patches.collision_camera_table import create_collision_camera_table
from open_samus_returns_rando.misc_patches.credits import patch_credits
Expand Down Expand Up @@ -137,6 +138,9 @@ def patch_extracted(input_path: Path, input_exheader: Path | None, output_path:
# Patch blocks to another type
patch_block_types(editor, configuration)

# Patch actor attributes
patch_actor_attributes(editor, configuration["actor_attributes"])

out_exefs = output_path.joinpath("exefs")
out_romfs = output_path.joinpath("romfs")
out_code = output_path.joinpath("code.bps")
Expand Down

0 comments on commit dfc5763

Please sign in to comment.