Skip to content

Commit

Permalink
Improve disable_vignettes
Browse files Browse the repository at this point in the history
With profiler overhead, this about 3.5 times faster.
  • Loading branch information
henriquegemignani committed Jul 13, 2024
1 parent 29027f2 commit 69c4e95
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/open_samus_returns_rando/specific_patches/static_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ def disable_vignettes(editor: PatcherEditor) -> None:

bmsbk = editor.get_file(f"maps/levels/c10_samus/{scenario_name}/{scenario_name}.bmsbk", Bmsbk)
blocks = bmsbk.raw["block_groups"][block_group]["types"][0]["blocks"]
for block in range(len(blocks)):
for block in blocks:
# Separate the vignette from the block
blocks[block]["name2"] = ""
block["name2"] = ""

bmssd = editor.get_file(f"maps/levels/c10_samus/{scenario_name}/{scenario_name}.bmssd", Bmssd)
sg_group = bmssd.raw["unk_structs_b"]
Expand All @@ -338,14 +338,12 @@ def disable_vignettes(editor: PatcherEditor) -> None:
for sg in sg_group:
# Check for the cc_name
if sg["str1"] == cc_name:
for cc_group in range(len(sg["struct3"])):
model_group = sg["struct3"][cc_group]["struct5"]
for model in model_group:
idx = model_group.index(model)
for vignette in vignette_models:
for cc_group in sg["struct3"]:
model_group = cc_group["struct5"]
for idx, model in reversed(list(enumerate(model_group))):
if any(model["int6"] == vignette for vignette in vignette_models):
# Remove the model to prevent it from loading
if model["int6"] == vignette:
model_group.pop(idx)
model_group.pop(idx)


def apply_static_fixes(editor: PatcherEditor) -> None:
Expand All @@ -362,3 +360,4 @@ def apply_static_fixes(editor: PatcherEditor) -> None:
patch_a4_collision(editor)
patch_a1_teleporter_crumbles(editor)
disable_vignettes(editor)
raise SystemExit

0 comments on commit 69c4e95

Please sign in to comment.