Skip to content

Commit

Permalink
Add speed booster upgrades
Browse files Browse the repository at this point in the history
Sprites will come later
  • Loading branch information
Miepee committed Oct 1, 2023
1 parent 772c7b3 commit 5e300b9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 29 additions & 2 deletions YAMS-LIB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,28 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
}
""");
ReplaceGMLInCode(eTankCharacterEvent, "popup_text(get_text(\"Notifications\", \"EnergyTank\"))", "");


// Add speedbooster reduction
PrependGMLInCode(characterVarsCode, "global.speedBoosterFramesReduction = 0;");
ReplaceGMLInCode(gmData.Code.ByName("gml_Script_characterStepEvent"), "speedboost_steps > 75", "speedboost_steps >= 1 && speedboost_steps > (75 - global.speedBoosterFramesReduction)");
ReplaceGMLInCode(gmData.Code.ByName("gml_Script_characterStepEvent"), "dash == 30", "dash >= 1 && dash >= (30 - (max(global.speedBoosterFramesReduction, 76)-76))");
ReplaceGMLInCode(gmData.Code.ByName("gml_Script_characterStepEvent"), """
speedboost = 1
canturn = 0
sjball = 0
charge = 0
sfx_play(sndSBStart)
alarm[2] = 30
""", """
dash = 30
speedboost = 1
canturn = 0
sjball = 0
charge = 0
sfx_play(sndSBStart)
alarm[2] = 30
""");

// Decouple Major items from item locations
PrependGMLInCode(characterVarsCode, "global.dna = 0; global.hasBombs = 0; global.hasPowergrip = 0; global.hasSpiderball = 0; global.hasJumpball = 0; global.hasHijump = 0;" +
"global.hasVaria = 0; global.hasSpacejump = 0; global.hasSpeedbooster = 0; global.hasScrewattack = 0; global.hasGravity = 0;" +
Expand Down Expand Up @@ -1986,8 +2007,9 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
ds_list_add(list, global.gameHash)
ds_list_add(list, global.dna)
ds_list_add(list, global.startingSave)
ds_list_add(list, global.speedBoosterFramesReduction)
comment = "gives me some leeway in case i need to add more"
repeat (15)
repeat (14)
{
ds_list_add(list, 0)
i += 1
Expand Down Expand Up @@ -2038,6 +2060,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
global.gameHash = readline()
global.dna = readline()
global.startingSave = readline();
global.speedBoosterFramesReduction = readline();
ds_list_clear(list)
""");
gmData.Code.Add(loadGlobalsCode);
Expand Down Expand Up @@ -2213,6 +2236,9 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
case ItemEnum.Morphball:
ReplaceGMLInCode(characterVarsCode, "global.hasMorph = 0", $"global.hasMorph = {quantity};");
break;
case ItemEnum.SpeedBoosterUpgrade:
ReplaceGMLInCode(characterVarsCode, "global.speedBoosterFramesReduction = 0", $"global.speedBoosterFramesReduction = {quantity}");
break;
case ItemEnum.Nothing:
break;
default:
Expand Down Expand Up @@ -2549,6 +2575,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te
ItemEnum.MissileDrop => $"event_inherited(); if (active) {{ global.missiles += {pickup.Quantity}; if (global.missiles > global.maxmissiles) global.missiles = global.maxmissiles }}",
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.SpeedBoosterUpgrade => $"event_inherited(); if (active) {{ global.speedBoosterFramesReduction += {pickup.Quantity}; }}",
ItemEnum.Nothing => "event_inherited();",
_ => throw new NotSupportedException("Unsupported item! " + pickup.ItemEffect)
};
Expand Down
2 changes: 2 additions & 0 deletions YAMS-LIB/SeedObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ public enum ItemEnum
SuperMissileDrop,
[EnumMember(Value = "Power Bomb Drop")]
PBombDrop,
[EnumMember(Value = "Speed Booster Upgrade")]
SpeedBoosterUpgrade,
}

public class PickupObject
Expand Down

0 comments on commit 5e300b9

Please sign in to comment.