Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
451 changes: 349 additions & 102 deletions DynamicReflections/DynamicReflections.cs

Large diffs are not rendered by default.

24 changes: 2 additions & 22 deletions DynamicReflections/DynamicReflections.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>3.0.0</Version>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<EnableHarmony>true</EnableHarmony>
<EnableModZip>false</EnableModZip>
<EnableModZip>true</EnableModZip>
<EnableModDeploy>false</EnableModDeploy>
<GameModsPath>E:\SteamLibrary\steamapps\common\Stardew Valley\Mods</GameModsPath>
</PropertyGroup>
Expand Down Expand Up @@ -68,24 +68,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<PropertyGroup>
<PostBuildEventDependsOn>
$(PostBuildEventDependsOn);
PostBuildMacros;
</PostBuildEventDependsOn>
<PostBuildEvent>
powershell -Command "(ls *manifest.json -rec | foreach-object { $f=$_.FullName; (gc -LiteralPath \"$f\") -replace 'REPLACE_ME_WITH_VERSION', '$(Version)' | sc -LiteralPath \"$f\" })"

powershell Remove-Item -Path 'C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\releases\latest\DynamicReflections"' -Recurse -Force
xcopy /s /y /i "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\bin\Debug\$(TargetFramework)" "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\releases\latest\DynamicReflections"
7z a -tzip "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\releases\DynamicReflections-$(Version).zip" "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\releases\latest\DynamicReflections"

powershell Remove-Item -Path '$(GameModsPath)\DynamicReflections' -Recurse -Force
powershell Remove-Item -Path '$(GameModsPath)\Dynamic Reflections Examples' -Recurse -Force

xcopy /s /y /i "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\releases\latest\DynamicReflections" "$(GameModsPath)\DynamicReflections"
xcopy /s /y /i "C:\Users\Floogen\Documents\GitHub Repos\DynamicReflections\DynamicReflections\Examples\*" "$(GameModsPath)\Dynamic Reflections Examples"
</PostBuildEvent>
</PropertyGroup>
</Project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ public class ModConfig
public bool AreWaterReflectionsEnabled { get; set; } = true;
public bool AreMirrorReflectionsEnabled { get; set; } = true;
public bool ArePuddleReflectionsEnabled { get; set; } = true;
public bool AreNPCReflectionsEnabled { get; set; } = true;
public bool AreNPCReflectionsEnabled { get; set; } = true;
public bool AreCompanionReflectionsEnabled { get; set; } = true;
public bool AreSkyReflectionsEnabled { get; set; } = true;

public WaterSettings WaterReflectionSettings { get; set; } = new WaterSettings();
public PuddleSettings PuddleReflectionSettings { get; set; } = new PuddleSettings();
public SkySettings SkyReflectionSettings { get; set; } = new SkySettings();
public SkySettings SkyReflectionSettings { get; set; } = new SkySettings();
public PerformanceSettings Performance { get; set; } = new PerformanceSettings();
public int MeteorShowerNightChance { get; set; } = 10;

public Dictionary<string, WaterSettings> LocalWaterReflectionSettings { get; set; } = new Dictionary<string, WaterSettings>();
public Dictionary<string, PuddleSettings> LocalPuddleReflectionSettings { get; set; } = new Dictionary<string, PuddleSettings>();
public Dictionary<string, SkySettings> LocalSkyReflectionSettings { get; set; } = new Dictionary<string, SkySettings>();
public SButton QuickMenuKey { get; set; } = SButton.R;
public SButton QuickMenuKey { get; set; } = SButton.None;

public WaterSettings GetCurrentWaterSettings(GameLocation location)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;

namespace DynamicReflections.Framework.Models.Settings
{
public class PerformanceSettings
{
/// <summary>
/// If true, some internal calculations (like water / puddle / mirror checks) can be cached
/// to reduce CPU usage.
/// </summary>
public bool EnableSafeCaching { get; set; } = false;

/// <summary>
/// If true, NPC reflections can be updated less often and capped to reduce CPU usage.
/// </summary>
public bool EnableNpcThrottling { get; set; } = false;

/// <summary>
/// How often to update NPC reflections, in ticks. 1 = every tick, 2 = every other tick, etc.
/// </summary>
public int NpcUpdateIntervalTicks { get; set; } = 2;

/// <summary>
/// Maximum number of NPC reflections processed per location.
/// </summary>
public int MaxNpcReflections { get; set; } = 100;

/// <summary>
/// If true, checks for which mirrors are active can be throttled.
/// </summary>
public bool EnableMirrorThrottling { get; set; } = false;

/// <summary>
/// How often to re-evaluate which mirrors are active, in ticks.
/// </summary>
public int MirrorUpdateIntervalTicks { get; set; } = 2;

/// <summary>
/// If true, reflections for companions / wild animals can be throttled separately
/// from normal NPCs.
/// </summary>
public bool EnableCompanionThrottling { get; set; } = false;

/// <summary>
/// How often to update reflections for companions / wild animals, in ticks.
/// 1 = every tick.
/// </summary>
public int CompanionUpdateIntervalTicks { get; set; } = 2;

/// <summary>
/// Maximum number of reflections for companions / wild animals to process per location.
/// </summary>
public int MaxCompanionReflections { get; set; } = 100;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class PuddleSettings
public Vector2 ReflectionOffset { get; set; } = Vector2.Zero;
public const string MapProperty_NPCReflectionOffset = "PuddleNPCReflectionOffset";
public Vector2 NPCReflectionOffset { get; set; } = new Vector2(0f, 0.3f);
public const string MapProperty_CompanionReflectionOffset = "PuddleCompanionReflectionOffset";
public Vector2 CompanionReflectionOffset { get; set; } = new Vector2(0f, 0.3f);

public const string MapProperty_PuddlePercentageWhileRaining = "PuddlePercentageWhileRaining";
public int PuddlePercentageWhileRaining { get; set; } = 20;
Expand Down Expand Up @@ -62,6 +64,7 @@ public void Reset(PuddleSettings referencedSettings = null)
ShouldRainSplashPuddles = true;
ReflectionOffset = Vector2.Zero;
NPCReflectionOffset = new Vector2(0f, 0.3f);
CompanionReflectionOffset = new Vector2(0f, 0.3f);
PuddlePercentageWhileRaining = 20;
PuddlePercentageAfterRaining = 10;
BigPuddleChance = 25;
Expand All @@ -79,6 +82,7 @@ public void Reset(PuddleSettings referencedSettings = null)
ShouldRainSplashPuddles = referencedSettings.ShouldRainSplashPuddles;
ReflectionOffset = referencedSettings.ReflectionOffset;
NPCReflectionOffset = referencedSettings.NPCReflectionOffset;
CompanionReflectionOffset = referencedSettings.CompanionReflectionOffset;
PuddlePercentageWhileRaining = referencedSettings.PuddlePercentageWhileRaining;
PuddlePercentageAfterRaining = referencedSettings.PuddlePercentageAfterRaining;
BigPuddleChance = referencedSettings.BigPuddleChance;
Expand All @@ -89,4 +93,4 @@ public void Reset(PuddleSettings referencedSettings = null)
}
}
}
}
}
12 changes: 6 additions & 6 deletions DynamicReflections/Framework/Models/Settings/SkySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public class SkySettings
public int MillisecondsBetweenShootingStarAttemptDuringMeteorShower { get; set; } = 250;

public const string MapProperty_GettingDarkWaterAlpha = "StartingDarkWaterAlpha";
public float GettingDarkWaterAlpha { get; set; } = 0.35f;
public float GettingDarkWaterAlpha { get; set; } = 0.38f;
public const string MapProperty_HalfwayDarkWaterAlpha = "HalfwayDarkWaterAlpha";
public float HalfwayDarkWaterAlpha { get; set; } = 0.075f;
public float HalfwayDarkWaterAlpha { get; set; } = 0.17f;
public const string MapProperty_FinishedDarkWaterAlpha = "FinishedDarkWaterAlpha";
public float FinishedDarkWaterAlpha { get; set; } = 0.005f;
public float FinishedDarkWaterAlpha { get; set; } = 0.04f;


public bool OverrideDefaultSettings { get; set; }
Expand All @@ -75,9 +75,9 @@ public void Reset(SkySettings referencedSettings = null)
CometMinSpeed = 0.04f;
CometMaxSpeed = 0.5f;
MillisecondsBetweenShootingStarAttemptDuringMeteorShower = 250;
GettingDarkWaterAlpha = 0.35f;
HalfwayDarkWaterAlpha = 0.075f;
FinishedDarkWaterAlpha = 0.005f;
GettingDarkWaterAlpha = 0.38f;
HalfwayDarkWaterAlpha = 0.17f;
FinishedDarkWaterAlpha = 0.04f;
OverrideDefaultSettings = false;
}
else
Expand Down
30 changes: 17 additions & 13 deletions DynamicReflections/Framework/Models/Settings/WaterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,23 @@ public class WaterSettings
public Color ReflectionOverlay { get; set; } = Color.White;

public const string MapProperty_ReflectionOffset = "WaterReflectionOffset";
public Vector2 PlayerReflectionOffset { get; set; } = new Vector2(0f, 1.5f);
public Vector2 PlayerReflectionOffset { get; set; } = new Vector2(0f, 0.5f);
public const string MapProperty_NPCReflectionOffset = "WaterNPCReflectionOffset";
public Vector2 NPCReflectionOffset { get; set; } = new Vector2(0f, 1.1f);
public Vector2 NPCReflectionOffset { get; set; } = new Vector2(0f, 0.7f);
public const string MapProperty_CompanionReflectionOffset = "WaterCompanionReflectionOffset";
public Vector2 CompanionReflectionOffset { get; set; } = new Vector2(0f, 0.3f);

public const string MapProperty_IsReflectionWavy = "IsWaterReflectionWavy";
public bool IsReflectionWavy { get; set; } = false;
public bool IsReflectionWavy { get; set; } = true;

public const string MapProperty_WaveSpeed = "WaterReflectionWaveSpeed";
public float WaveSpeed { get; set; } = 1f;
public float WaveSpeed { get; set; } = 2f;

public const string MapProperty_WaveAmplitude = "WaterReflectionWaveAmplitude";
public float WaveAmplitude { get; set; } = 0.01f;
public float WaveAmplitude { get; set; } = 0.001f;

public const string MapProperty_WaveFrequency = "WaterReflectionWaveFrequency";
public float WaveFrequency { get; set; } = 50f;
public float WaveFrequency { get; set; } = 200f;


public bool OverrideDefaultSettings { get; set; }
Expand All @@ -55,12 +57,13 @@ public void Reset(WaterSettings referencedSettings = null)
AreReflectionsEnabled = true;
ReflectionDirection = Direction.South;
ReflectionOverlay = Color.White;
PlayerReflectionOffset = new Vector2(0f, 1.5f);
NPCReflectionOffset = new Vector2(0f, 1.1f);
IsReflectionWavy = false;
WaveSpeed = 1f;
WaveAmplitude = 0.01f;
WaveFrequency = 50f;
PlayerReflectionOffset = new Vector2(0f, 0.5f);
NPCReflectionOffset = new Vector2(0f, 0.7f);
CompanionReflectionOffset = new Vector2(0f, 0.3f);
IsReflectionWavy = true;
WaveSpeed = 2f;
WaveAmplitude = 0.001f;
WaveFrequency = 200f;
OverrideDefaultSettings = false;
}
else
Expand All @@ -70,6 +73,7 @@ public void Reset(WaterSettings referencedSettings = null)
ReflectionOverlay = referencedSettings.ReflectionOverlay;
PlayerReflectionOffset = referencedSettings.PlayerReflectionOffset;
NPCReflectionOffset = referencedSettings.NPCReflectionOffset;
CompanionReflectionOffset = referencedSettings.CompanionReflectionOffset;
IsReflectionWavy = referencedSettings.IsReflectionWavy;
WaveSpeed = referencedSettings.WaveSpeed;
WaveAmplitude = referencedSettings.WaveAmplitude;
Expand All @@ -91,4 +95,4 @@ public bool IsFacingCorrectDirection(int direction)
return false;
}
}
}
}
Loading