Skip to content

Commit

Permalink
Add slider for simplified graphics - render distance
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Feb 8, 2024
1 parent e5c30ac commit 6bd1ceb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Content/Text/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

"TAS_PauseOptions": "TAS Options",
"TAS_OptionsTitle": "TAS Options",
"TAS_SimplifiedGraphics": "Simplified Graphics"
"TAS_SimplifiedGraphics": "Simplified Graphics",
"TAS_SimplifiedRenderDistance": "Simplified Graphics - Render Distance Multiplier"
},
"Dialog":
{
Expand Down
14 changes: 13 additions & 1 deletion Source/Data/Save.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public enum FreecamMode
// TAS Settings
public FreecamMode Freecam { get; set; } = FreecamMode.Disabled;
public bool SimplifiedGraphics { get; set; } = false;
public int SimplifiedRenderDistance { get; set; } = 10;
public bool Hitboxes { get; set; } = false;

public bool InvisiblePlayer { get; set; } = false;
Expand Down Expand Up @@ -163,7 +164,7 @@ public void ToggleSimplifiedGraphics()

if (Game.Scene is World world)
{
world.Camera.FarPlane = SimplifiedGraphics ? World.CameraFarPlane * 10 : World.CameraFarPlane;
world.Camera.FarPlane = SimplifiedGraphics ? World.CameraFarPlane * SimplifiedRenderDistance : World.CameraFarPlane;

// Update "simplified" flag in shader
foreach (var actor in world.Actors)
Expand All @@ -184,6 +185,17 @@ public void ToggleSimplifiedGraphics()
}
}

public void SetSimplifiedRenderDistance(int value)
{
SimplifiedRenderDistance = Calc.Clamp(value, 1, 10);
SyncSettings();

if (Game.Scene is World world)
{
world.Camera.FarPlane = SimplifiedGraphics ? World.CameraFarPlane * SimplifiedRenderDistance : World.CameraFarPlane;
}
}

public void ToggleZGuide()
{
ZGuide = !ZGuide;
Expand Down
3 changes: 2 additions & 1 deletion Source/Scenes/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public World(EntryInfo entry)
var map = Assets.Maps[entry.Map];

Camera.NearPlane = 20;
Camera.FarPlane = Save.Instance.SimplifiedGraphics ? CameraFarPlane * 10 : CameraFarPlane;
Camera.FarPlane = Save.Instance.SimplifiedGraphics ? CameraFarPlane * Save.Instance.SimplifiedRenderDistance : CameraFarPlane;
Camera.FOVMultiplier = 1;

strawbCounterWas = Save.CurrentRecord.Strawberries.Count;
Expand All @@ -99,6 +99,7 @@ public World(EntryInfo entry)
Menu tasMenu = new();
tasMenu.Title = Loc.Str("TAS_OptionsTitle");
tasMenu.Add(new Menu.Toggle(Loc.Str("TAS_SimplifiedGraphics"), Save.Instance.ToggleSimplifiedGraphics, () => Save.Instance.SimplifiedGraphics));
tasMenu.Add(new Menu.Slider(Loc.Str("TAS_SimplifiedRenderDistance"), 1, 10,() => Save.Instance.SimplifiedRenderDistance, Save.Instance.SetSimplifiedRenderDistance));

pauseMenu.Title = Loc.Str("PauseTitle");
pauseMenu.Add(new Menu.Option(Loc.Str("PauseResume"), () => SetPaused(false)));
Expand Down

0 comments on commit 6bd1ceb

Please sign in to comment.