Permalink
Browse files

Jump height is now saved to options and so persists across sessions.

  • Loading branch information...
UnknownShadow200 committed Nov 14, 2017
1 parent e2cd62a commit 945fa5d2bac56ce1dc35c0ca7d18008193613d77
@@ -67,6 +67,8 @@ public class HacksSettingsScreen : MenuOptionsScreen {
static string GetJump(Game g) { return g.LocalPlayer.JumpHeight.ToString("F3"); }
static void SetJump(Game g, string v) {
g.LocalPlayer.physics.CalculateJumpVelocity(true, Utils.ParseDecimal(v));
float jumpVel = g.LocalPlayer.physics.jumpVel;
Options.Set(OptionsKey.JumpVelocity, jumpVel.ToString());
}
static string GetWOMHacks(Game g) { return GetBool(g.LocalPlayer.Hacks.WOMStyleHacks); }
@@ -261,13 +261,11 @@ public sealed class PhysicsComponent {
jumpVel = 0;
if (jumpHeight == 0) return;
if (jumpHeight >= 256) jumpVel = 10.0f;
if (jumpHeight >= 256) jumpVel = 10.0f;
if (jumpHeight >= 512) jumpVel = 16.5f;
if (jumpHeight >= 768) jumpVel = 22.5f;
while (GetMaxHeight(jumpVel) <= jumpHeight) {
jumpVel += 0.001f;
}
while (GetMaxHeight(jumpVel) <= jumpHeight) { jumpVel += 0.001f; }
if (userVel) userJumpVel = jumpVel;
}
@@ -135,13 +135,18 @@ public class LocalPlayer : Player, IGameComponent {
}
public void Init(Game game) {
Hacks.SpeedMultiplier = Options.GetFloat(OptionsKey.Speed, 0.1f, 50, 10);
Hacks.PushbackPlacing = !game.ClassicMode && Options.GetBool(OptionsKey.PushbackPlacing, false);
Hacks.NoclipSlide = Options.GetBool(OptionsKey.NoclipSlide, false);
Hacks.WOMStyleHacks = !game.ClassicMode && Options.GetBool(OptionsKey.WOMStyleHacks, false);
Hacks.Enabled = !game.PureClassic && Options.GetBool(OptionsKey.HacksOn, true);
Hacks.FullBlockStep = !game.ClassicMode && Options.GetBool(OptionsKey.FullBlockStep, false);
Health = 20;
if (game.ClassicMode) return;
Hacks.SpeedMultiplier = Options.GetFloat(OptionsKey.Speed, 0.1f, 50, 10);
Hacks.PushbackPlacing = Options.GetBool(OptionsKey.PushbackPlacing, false);
Hacks.NoclipSlide = Options.GetBool(OptionsKey.NoclipSlide, false);
Hacks.WOMStyleHacks = Options.GetBool(OptionsKey.WOMStyleHacks, false);
Hacks.FullBlockStep = Options.GetBool(OptionsKey.FullBlockStep, false);
physics.userJumpVel = Options.GetFloat(OptionsKey.JumpVelocity, 0.0f, 52.0f, 0.42f);
physics.jumpVel = physics.userJumpVel;
}
public void Ready(Game game) { }
@@ -38,6 +38,7 @@ public static class OptionsKey {
public const string HacksOn = "hacks-hacksenabled";
public const string FieldOfView = "hacks-fov";
public const string Speed = "hacks-speedmultiplier";
public const string JumpVelocity = "hacks-jumpvelocity";
public const string ModifiableLiquids = "hacks-liquidsbreakable";
public const string PushbackPlacing = "hacks-pushbackplacing";
public const string NoclipSlide = "hacks-noclipslide";
View
@@ -41,6 +41,7 @@ typedef UInt8 FpsLimitMethod;
#define OptionsKey_HacksEnabled "hacks-hacksenabled"
#define OptionsKey_FieldOfView "hacks-fov"
#define OptionsKey_Speed "hacks-speedmultiplier"
#define OptionsKey_JumpVelocity "hacks-jumpvelocity"
#define OptionsKey_ModifiableLiquids "hacks-liquidsbreakable"
#define OptionsKey_PushbackPlacing "hacks-pushbackplacing"
#define OptionsKey_NoclipSlide "hacks-noclipslide"

0 comments on commit 945fa5d

Please sign in to comment.