Skip to content

Commit

Permalink
Merge pull request #396 from randovania/vignettes
Browse files Browse the repository at this point in the history
Fully remove problematic vignettes
  • Loading branch information
ThanatosGit authored Jul 5, 2024
2 parents 1fe847f + 7d3b847 commit 3d1436f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/open_samus_returns_rando/files/levels/s010_area1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function s010_area1.SetupDebugGameBlackboard()
Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_SPECIAL_ENERGY_PHASE_DISPLACEMENT", "f", 0)
end
function s010_area1.InitFromBlackboard()
Game.SetSceneGroupEnabledByName("sg_vignette_201", false)
if Scenario.ReadFromBlackboard("Alpha_PreSpawn11Event", false) then
if Game.GetEntity("LE_Alpha_PreSpawn11Event") ~= nil then
Game.GetEntity("LE_Alpha_PreSpawn11Event"):DelMe()
Expand Down
1 change: 0 additions & 1 deletion src/open_samus_returns_rando/files/levels/s030_area3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ function s030_area3.ElevatorSetTarget(_ARG_0_)
end
end
function s030_area3.InitFromBlackboard()
Game.SetSceneGroupEnabledByName("sg_vignette_03", false)
if Game.GetEntity("LE_Event_03") ~= nil and Scenario.ReadFromBlackboard("SpecialEvent03Launched") then
Game.GetEntity("LE_Event_03"):Disable()
end
Expand Down
1 change: 0 additions & 1 deletion src/open_samus_returns_rando/files/levels/s040_area4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ function s040_area4.SetupDebugGameBlackboard()
Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_SPECIAL_ENERGY_PHASE_DISPLACEMENT", "f", 0)
end
function s040_area4.InitFromBlackboard()
Game.SetSceneGroupEnabledByName("sg_vignette_003", false)
Game.SetSceneGroupEnabledByName("sg_Hazardous_Puddle_001", true)
Game.SetSceneGroupEnabledByName("sg_Hazardous_Puddle_002", true)
if Blackboard.GetProp("s040_area4", "entity_LE_HazarousPool_001_enabled") == nil then
Expand Down
1 change: 0 additions & 1 deletion src/open_samus_returns_rando/files/levels/s090_area9.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ function s090_area9.ElevatorSetTarget(_ARG_0_)
end
end
function s090_area9.InitFromBlackboard()
Game.SetSceneGroupEnabledByName("sg_vignette_005", false)
s090_area9.bAfterOmegasKilledMusicChange = false
s090_area9.AllOmegasDeadCallback()
s090_area9.OnFansInit()
Expand Down
52 changes: 51 additions & 1 deletion src/open_samus_returns_rando/specific_patches/static_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import typing

from construct import Container, ListContainer
from mercury_engine_data_structures.formats import Bmsad, Bmsbk, Bmscc, Bmtun
from mercury_engine_data_structures.formats import Bmsad, Bmsbk, Bmscc, Bmssd, Bmtun
from open_samus_returns_rando.patcher_editor import PatcherEditor

MULTI_ROOM_GAMMAS = [
Expand Down Expand Up @@ -300,6 +300,55 @@ def patch_a1_teleporter_crumbles(editor: PatcherEditor) -> None:
area1.raw["block_groups"][15]["types"][0]["blocks"][0]["respawn_time"] = 0.0


def disable_vignettes(editor: PatcherEditor) -> None:
scenario_block_sg: dict[str, list[dict[str, typing.Any]]] = {
# Exterior Alpha Bomb Block
"s010_area1": [
{"block_group": 6, "cc": ["017", "018"], "vignette_models": [2177967912]},
],
# Beam Burst Shot Blocks
"s030_area3": [
{"block_group": 5, "cc": ["036"], "vignette_models": [1239739760, 2986218869]},
],
# Lower Chozo Seal Bomb Blocks
"s040_area4": [
{"block_group": 27, "cc": ["006"], "vignette_models": [46617345, 354988048]}
],
# Diggernaut Bomb Blocks
"s070_area7": [
{"block_group": 52, "cc": ["034"], "vignette_models": [1941338226]}
],
# Middle Save Station Water Bomb Blocks
"s090_area9": [
{"block_group": 66, "cc": ["007"], "vignette_models": [3224282959]}
],
}
for scenario_name, vignette_objects in scenario_block_sg.items():
for vignette_object in vignette_objects:
block_group = vignette_object["block_group"]

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)):
# Separate the vignette from the block
blocks[block]["name2"] = ""

bmssd = editor.get_file(f"maps/levels/c10_samus/{scenario_name}/{scenario_name}.bmssd", Bmssd)
cc_group = bmssd.raw["unk_structs_b"]
vignette_models = vignette_object["vignette_models"]
for camera in vignette_object["cc"]:
cc_name = "sg_SubArea_collision_camera_" + camera
for group in cc_group:
# Check for the cc_name
if group["str1"] == cc_name:
for model in group["struct3"][0]["struct5"]:
idx = group["struct3"][0]["struct5"].index(model)
for vignette in vignette_models:
# Remove the model to prevent it from loading
if model["int6"] == vignette:
group["struct3"][0]["struct5"].pop(idx)


def apply_static_fixes(editor: PatcherEditor) -> None:
patch_multi_room_gammas(editor)
patch_pickup_rotation(editor)
Expand All @@ -313,3 +362,4 @@ def apply_static_fixes(editor: PatcherEditor) -> None:
patch_area7_item(editor)
patch_a4_collision(editor)
patch_a1_teleporter_crumbles(editor)
disable_vignettes(editor)

0 comments on commit 3d1436f

Please sign in to comment.