Skip to content

Commit

Permalink
Add more custom doors
Browse files Browse the repository at this point in the history
  • Loading branch information
dyceron committed May 11, 2024
1 parent c761c36 commit aa47221
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 17 deletions.
108 changes: 108 additions & 0 deletions src/open_samus_returns_rando/files/custom/sprites_texturehud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,111 @@ GUI.AddSpriteSheetItem("dooricecenter", "gui/textures/texturehud.bctex", {
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorgrappleleft", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "128",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorgrappleright", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "132",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorgrapplecenter", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "128",
VPixelOffset = "40",
UPixelScale = "8",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbombleft", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "136",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbombright", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "140",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbombcenter", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "136",
VPixelOffset = "40",
UPixelScale = "8",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbeamburstleft", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "144",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbeamburstright", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "148",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorbeamburstcenter", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "144",
VPixelOffset = "40",
UPixelScale = "8",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorlockedleft", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "152",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorlockedright", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "156",
VPixelOffset = "40",
UPixelScale = "4",
VPixelScale = "8",
AngleOffset = "0"
})
GUI.AddSpriteSheetItem("doorlockedcenter", "gui/textures/texturehud.bctex", {
TextureWidth = "512",
TextureHeight = "256",
UPixelOffset = "152",
VPixelOffset = "40",
UPixelScale = "8",
VPixelScale = "8",
AngleOffset = "0"
})
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion src/open_samus_returns_rando/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@
"missile",
"super_missile",
"power_bomb",
"ice_beam"
"ice_beam",
"grapple_beam",
"bomb",
"beam_burst",
"locked"
]
}
},
Expand Down
64 changes: 48 additions & 16 deletions src/open_samus_returns_rando/specific_patches/door_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ class ActorData(Enum):
SHIELD_SUPER_MISSILE = (["doorshieldsupermissile"])
SHIELD_POWER_BOMB = (["doorshieldpowerbomb"])
SHIELD_ICE_BEAM = (["doorshieldicebeam"])
SHIELD_GRAPPLE_BEAM = (["doorshieldgrapplebeam"])
SHIELD_BEAM_BURST = (["doorshieldbeamburst"])
SHIELD_BOMB = (["doorshieldbomb"])
SHIELD_LOCKED = (["doorshieldlocked"])

class DoorType(Enum):
"""
Expand Down Expand Up @@ -251,6 +255,18 @@ class DoorType(Enum):
ICE_BEAM = ("ice_beam", ActorData.DOOR_POWER, "doorice", True, ActorData.SHIELD_ICE_BEAM, [
"actors/props/doorshield", "actors/props/doorshieldicebeam"
])
GRAPPLE_BEAM = ("grapple_beam", ActorData.DOOR_POWER, "doorgrapple", True, ActorData.SHIELD_GRAPPLE_BEAM, [
"actors/props/doorshield", "actors/props/doorshieldgrapplebeam"
])
BOMB = ("bomb", ActorData.DOOR_POWER, "doorbomb", True, ActorData.SHIELD_BOMB, [
"actors/props/doorshield", "actors/props/doorshieldsupermissile", "actors/props/doorshieldbomb"
])
BEAM_BURST = ("beam_burst", ActorData.DOOR_POWER, "doorbeamburst", True, ActorData.SHIELD_BEAM_BURST, [
"actors/props/doorshield", "actors/props/doorshieldpowerbomb", "actors/props/doorshieldbeamburst"
])
LOCKED = ("locked", ActorData.DOOR_POWER, "doorlocked", True, ActorData.SHIELD_LOCKED, [
"actors/props/doorshield", "actors/props/doorshieldpowerbomb","actors/props/doorshieldlocked"
])

def __init__(self, rdv_door_type: str, door_data: ActorData, minimap_name: str,
need_shield: bool = False, shield_data: ActorData | None = None,
Expand Down Expand Up @@ -440,20 +456,31 @@ def patch_actor(
class NewShield(typing.NamedTuple):
shield_name: str
weakness: str
base_shield: str


new_shields = [
NewShield("icebeam", "ICE_BEAM"),
NewShield("icebeam", "ICE_BEAM", "doorcreature"),
NewShield("grapplebeam", "GRAPPLE_BEAM", "doorshield"),
NewShield("bomb", "BOMB", "doorshieldsupermissile"),
NewShield("beamburst", "WEAPON_BOOST", "doorshieldpowerbomb"),
NewShield("locked", "", "doorshieldpowerbomb"),
]


def add_custom_shields(editor: PatcherEditor, new_shield: NewShield) -> None:
plasma_bmsad = "actors/props/doorcreature/charclasses/doorcreature.bmsad"
# Missile shields are split across doorshield and doorshieldmissile
if new_shield.base_shield == "doorshield":
template_bmsad = "actors/props/doorshieldmissile/charclasses/doorshieldmissile.bmsad"
new_model = f"actors/props/doorshield{new_shield.shield_name}/models/doorshield.bcmdl"
else:
template_bmsad = f"actors/props/{new_shield.base_shield}/charclasses/{new_shield.base_shield}.bmsad"
new_model = f"actors/props/doorshield{new_shield.shield_name}/models/doorshield{new_shield.shield_name}.bcmdl"

new_bmsad = f"actors/props/doorshield{new_shield.shield_name}/charclasses/doorshield{new_shield.shield_name}.bmsad"
new_model = f"actors/props/doorshield{new_shield.shield_name}/models/doorshield{new_shield.shield_name}.bcmdl"

# Create a copy of the bmsad
template_shield = editor.get_file(plasma_bmsad, Bmsad)
template_shield = editor.get_file(template_bmsad, Bmsad)
editor.add_new_asset(new_bmsad, template_shield, [])

# Modify the new bmsad
Expand All @@ -466,18 +493,23 @@ def add_custom_shields(editor: PatcherEditor, new_shield: NewShield) -> None:
life_component = custom_shield.raw["components"]["LIFE"]["functions"]
life_component[0]["params"]["Param1"]["value"] = new_shield.weakness

# Remove the second weakness container
life_component.pop(1)

# Set shield health to 1
life_component[2]["params"]["Param2"]["value"] = 1.0
life_component[3]["params"]["Param2"]["value"] = 1.0

# Remove the drops from breaking the shield
custom_shield.raw["components"].pop("DROP")

# Remove the particle animation that occurs after the shield breaks (color mismatch)
custom_shield.raw["action_sets"][0]["animations"][0]["events0"][1]["args"][729149823]["value"] = 0
if new_shield.base_shield == "doorshield":
# Remove the second weakness container
life_component.pop(1)
elif new_shield.base_shield == "doorcreature":
# Remove the second weakness container
life_component.pop(1)
# Set shield health to 1
life_component[2]["params"]["Param2"]["value"] = 1.0
life_component[3]["params"]["Param2"]["value"] = 1.0
# Remove the drops from breaking the shield
custom_shield.raw["components"].pop("DROP")
# Remove the particle animation that occurs after the shield breaks (color mismatch)
custom_shield.raw["action_sets"][0]["animations"][0]["events0"][1]["args"][729149823]["value"] = 0
else:
# Some shaders do not use dissolve fx, so force fx to be used
custom_shield.raw["components"]["LIFE"]["fields"]["bDisolveByMaterial"]["value"] = False
custom_shield.raw["components"]["LIFE"]["fields"]["fTimeToStartDisolve"]["value"] = 0.2


def patch_doors(editor: PatcherEditor, door_patches: list[dict]) -> None:
Expand Down

0 comments on commit aa47221

Please sign in to comment.