Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAMS: Flightlight/Blindfold update #98

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions YAMS-LIB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,20 @@ void AddAllSpritesFromDir(string dirPath)
{
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemFlashlight_1"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemFlashlight_2"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemFlashlight_1"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemFlashlight_2"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemFlashlight_1"]] },
}
});
gmData.Sprites.Add(new UndertaleSprite()
{
Name = gmData.Strings.MakeString("sItemBlindfold"), Height = 16, Width = 16, MarginRight = 15, MarginBottom = 15, OriginX = 0, OriginY = 16,
Textures =
{
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemBlindfold_1"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemBlindfold_2"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemBlindfold_3"]] },
new UndertaleSprite.TextureEntry() {Texture = gmData.TexturePageItems[nameToPageItemDict["sItemBlindfold_2"]] },
Comment on lines +365 to +378
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine for now. I was thinking in the future of refactoring sprite adding to just "import everyting in order by sprite name that exists" (so thatt i..e i can just add a new frame without needing to modify code) in which case this would break.

}
});

Expand Down Expand Up @@ -2038,7 +2052,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
ds_list_add(list, global.speedBoosterFramesReduction)

comment = "gives me some leeway in case i need to add more"
repeat (14)
repeat (16)
{
ds_list_add(list, 0)
i += 1
Expand Down Expand Up @@ -2151,7 +2165,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
PrependGMLInCode(gmData.Code.ByName("gml_Script_ApplyLightPreset"),
"""
var lightLevel = 0
lightLevel = global.darkness - global.flashlightLevel
lightLevel = global.darkness - (global.flashlightLevel)
Miepee marked this conversation as resolved.
Show resolved Hide resolved
if (lightLevel < 0)
lightLevel = 0
if (lightLevel > 4)
Expand Down Expand Up @@ -2282,6 +2296,9 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
case ItemEnum.Flashlight:
ReplaceGMLInCode(characterVarsCode, "global.flashlightLevel = 0", $"global.flashlightLevel = {quantity};");
break;
case ItemEnum.Blindfold:
ReplaceGMLInCode(characterVarsCode, "global.flashlightLevel = 0", $"global.flashlightLevel = {quantity};");
Miepee marked this conversation as resolved.
Show resolved Hide resolved
break;
case ItemEnum.SpeedBoosterUpgrade:
ReplaceGMLInCode(characterVarsCode, "global.speedBoosterFramesReduction = 0", $"global.speedBoosterFramesReduction = {quantity}");
break;
Expand Down Expand Up @@ -2621,6 +2638,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
ItemEnum.SuperMissileDrop => $"event_inherited(); if (active) {{ global.smissiles += {pickup.Quantity}; if (global.smissiles > global.maxsmissiles) global.smissiles = global.maxsmissiles }}",
ItemEnum.PBombDrop => $"event_inherited(); if (active) {{ global.pbombs += {pickup.Quantity}; if (global.pbombs > global.maxpbombs) global.pbombs = global.maxpbombs }}",
ItemEnum.Flashlight => $"event_inherited(); if (active) {{ global.flashlightLevel += {pickup.Quantity}; with (oLightEngine) instance_destroy(); with (oFlashlight64) instance_destroy(); ApplyLightPreset() }}",
ItemEnum.Blindfold => $"event_inherited(); if (active) {{ global.flashlightLevel -= {pickup.Quantity}; with (oLightEngine) instance_destroy(); with (oFlashlight64) instance_destroy(); ApplyLightPreset() }}",
ItemEnum.SpeedBoosterUpgrade => $"event_inherited(); if (active) {{ global.speedBoosterFramesReduction += {pickup.Quantity}; }}",
ItemEnum.Nothing => "event_inherited();",
_ => throw new NotSupportedException("Unsupported item! " + pickup.ItemEffect)
Expand Down
102 changes: 52 additions & 50 deletions YAMS-LIB/SeedObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ public class SeedObject
[JsonInclude]
[JsonPropertyName("configuration_identifier")]
public ConfigurationIdentifier Identifier;

[JsonInclude]
[JsonPropertyName("game_patches")]
public GamePatches Patches;

[JsonInclude] [JsonPropertyName("door_locks")]
public Dictionary<uint, DoorLock> DoorLocks;

[JsonInclude]
[JsonPropertyName("pickups")]
public Dictionary<string, PickupObject> PickupObjects = new Dictionary<string, PickupObject>();

[JsonInclude]
[JsonPropertyName("rooms")]
public Dictionary<string, RoomObject> RoomObjects = new Dictionary<string, RoomObject>();

[JsonInclude]
[JsonPropertyName("pipes")]
public Dictionary<uint, PipeObject> PipeObjects = new Dictionary<uint, PipeObject>();
Expand All @@ -38,11 +38,11 @@ [JsonInclude] [JsonPropertyName("door_locks")]
[JsonInclude]
[JsonPropertyName("starting_location")]
public StartingLocationObject StartingLocation;

[JsonInclude]
[JsonPropertyName("hints")]
public Dictionary<HintLocationEnum, string> Hints = new Dictionary<HintLocationEnum, string>();

[JsonInclude]
[JsonPropertyName("cosmetics")]
public GameCosmetics Cosmetics;
Expand Down Expand Up @@ -163,27 +163,27 @@ public class GameCosmetics
[JsonInclude]
[JsonPropertyName("show_unexplored_map")]
public bool ShowUnexploredMap;

[JsonInclude]
[JsonPropertyName("unveiled_blocks")]
public bool UnveilBlocks;

[JsonInclude]
[JsonPropertyName("health_hud_rotation")]
public int HealthHUDRotation;

[JsonInclude]
[JsonPropertyName("etank_hud_rotation")]
public int EtankHUDRotation;

[JsonInclude]
[JsonPropertyName("dna_hud_rotation")]
public int DNAHUDRotation;

[JsonInclude]
[JsonPropertyName("room_names_on_hud")]
public RoomNameHudEnum RoomNameHud;

[JsonInclude]
[JsonPropertyName("music_shuffle")]
public Dictionary<string, string> MusicShuffleDict = new Dictionary<string, string>();
Expand All @@ -194,82 +194,82 @@ public class GamePatches
[JsonInclude]
[JsonPropertyName("septogg_helpers")]
public bool SeptoggHelpers;

[JsonInclude]
[JsonPropertyName("change_level_design")]
public bool ChangeLevelDesign;

[JsonInclude] [JsonPropertyName("grave_grotto_blocks")]
public bool GraveGrottoBlocks;

[JsonInclude]
[JsonPropertyName("respawn_bomb_blocks")]
public bool RespawnBombBlocks;

[JsonInclude]
[JsonPropertyName("skip_cutscenes")]
public bool SkipCutscenes;

[JsonInclude]
[JsonPropertyName("skip_save_cutscene")]
public bool SkipSaveCutscene;

[JsonInclude]
[JsonPropertyName("skip_item_cutscenes")]
public bool SkipItemFanfares;

[JsonInclude]
[JsonPropertyName("energy_per_tank")]
public int EnergyPerTank;

[JsonInclude]
[JsonPropertyName("require_missile_launcher")]
public bool RequireMissileLauncher;

[JsonInclude]
[JsonPropertyName("require_super_launcher")]
public bool RequireSuperLauncher;

[JsonInclude]
[JsonPropertyName("require_pb_launcher")]
public bool RequirePBLauncher;

[JsonInclude]
[JsonPropertyName("fusion_mode")]
public bool FusionMode;

[JsonInclude]
[JsonInclude]
[JsonPropertyName("supers_on_missile_doors")]
public bool CanUseSupersOnMissileDoors = true;

[JsonInclude]
[JsonPropertyName("nest_pipes")]
public bool NestPipes;

[JsonInclude]
[JsonPropertyName("softlock_prevention_blocks")]
public bool SoftlockPrevention;

[JsonInclude]
[JsonPropertyName("a3_entrance_blocks")]
public bool A3EntranceBlocks;

[JsonInclude]
[JsonPropertyName("screw_blocks")]
public bool ScrewPipeBlocks;

[JsonInclude]
[JsonPropertyName("sabre_designed_skippy")]
public bool SabreSkippy;

[JsonInclude]
[JsonPropertyName("locked_missile_text")]
public TextDetails LockedMissileText;

[JsonInclude]
[JsonPropertyName("locked_super_text")]
public TextDetails LockedSuperText;

[JsonInclude]
[JsonPropertyName("locked_pb_text")]
public TextDetails LockedPBombText;
Expand All @@ -280,15 +280,15 @@ public class ConfigurationIdentifier
[JsonInclude]
[JsonPropertyName("hash")]
public string Hash = "Quack";

[JsonInclude]
[JsonPropertyName("word_hash")]
public string WordHash = "Have fun";

[JsonInclude]
[JsonPropertyName("randovania_version")]
public string RDVVersion = "Randovania";

[JsonInclude]
[JsonPropertyName("patcher_version")]
public string PatcherVersion = "YAMS";
Expand Down Expand Up @@ -398,7 +398,7 @@ public enum ItemEnum
DNA45,
[EnumMember(Value = "Metroid DNA 46")]
DNA46,

[EnumMember(Value = "Missile Expansion")]
MissileExpansion,
[EnumMember(Value = "Super Missile Expansion")]
Expand All @@ -407,7 +407,7 @@ public enum ItemEnum
PBombExpansion,
[EnumMember(Value = "Energy Tank")]
EnergyTank,

[EnumMember(Value = "Missiles")]
Missile,
[EnumMember(Value = "Locked Missiles")]
Expand All @@ -420,14 +420,14 @@ public enum ItemEnum
PBomb,
[EnumMember(Value = "Locked Power Bombs")]
LockedPBomb,

[EnumMember(Value = "Missile Launcher")]
MissileLauncher,
[EnumMember(Value = "Super Missile Launcher")]
SuperMissileLauncher,
[EnumMember(Value = "Power Bomb Launcher")]
PBombLauncher,

[EnumMember(Value = "Bombs")]
Bombs,
[EnumMember(Value = "Power Grip")]
Expand Down Expand Up @@ -480,6 +480,8 @@ public enum ItemEnum
PBombDrop,
[EnumMember(Value = "Flashlight")]
Flashlight,
[EnumMember(Value = "Blindfold")]
Blindfold,
[EnumMember(Value = "Speed Booster Upgrade")]
SpeedBoosterUpgrade,
}
Expand All @@ -499,7 +501,7 @@ public class PickupObject
[JsonPropertyName("quantity")]
public int Quantity;

[JsonInclude]
[JsonInclude]
[JsonPropertyName("text")]
public TextDetails Text;

Expand All @@ -517,11 +519,11 @@ public class SpriteDetails

public class TextDetails
{
[JsonInclude]
[JsonInclude]
[JsonPropertyName("header")]
public string Header = "INVALID TEXT";
[JsonInclude]

[JsonInclude]
[JsonPropertyName("description")]
public string Description = "INVALID DESCRIPTION";
}
Expand All @@ -531,38 +533,38 @@ public class RoomObject
[JsonInclude]
[JsonPropertyName("display_name")]
public string DisplayName = "";

[JsonInclude]
[JsonPropertyName("region_name")]
public string RegionName = "";

[JsonInclude]
[JsonPropertyName("minimap_data")]
public List<Coordinate> MinimapData = new List<Coordinate>();
}

public class PipeObject
{
[JsonInclude]
[JsonInclude]
[JsonPropertyName("dest_x")]
public int XPosition;

[JsonInclude]
[JsonInclude]
[JsonPropertyName("dest_y")]
public int YPosition;
[JsonInclude]

[JsonInclude]
[JsonPropertyName("dest_room")]
public string Room = "";
}

public struct Coordinate
{
[JsonInclude]
[JsonInclude]
[JsonPropertyName("x")]
public int X;

[JsonInclude]
[JsonInclude]
[JsonPropertyName("y")]
public int Y;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified YAMS-LIB/sprites/items/flashlight/sItemFlashlight_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified YAMS-LIB/sprites/items/flashlight/sItemFlashlight_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading