From 57258598c0f0cabe320ab88b168cfebe4c9f275d Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Wed, 21 Aug 2024 16:35:02 +0200 Subject: [PATCH] Don't apply lighting changes on housing skybox replacements (fixes windows) --- VoidBox/Plugin.cs | 34 ++++++++++++++++++++-------------- VoidBox/VoidBox.csproj | 2 +- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/VoidBox/Plugin.cs b/VoidBox/Plugin.cs index 2162499..639ba0a 100644 --- a/VoidBox/Plugin.cs +++ b/VoidBox/Plugin.cs @@ -70,7 +70,7 @@ public sealed unsafe class Plugin : IDalamudPlugin Service.Plugin = null!; } - private void Replace(EnvState* env) + private void Replace(EnvState* env, bool housing) { var config = Service.Config; if (!config.IsEnabled) @@ -85,22 +85,25 @@ public sealed unsafe class Plugin : IDalamudPlugin } var savedEnvVal = savedEnv.Value; - Replace(env, &savedEnvVal); + Replace(env, &savedEnvVal, housing); } - private void Replace(EnvState* to, EnvState* from) + private void Replace(EnvState* to, EnvState* from, bool housing) { to->SkyId = from->SkyId; - to->Lighting.SunLightColor = from->Lighting.SunLightColor; - to->Lighting.MoonLightColor = from->Lighting.MoonLightColor; - to->Lighting.Ambient = from->Lighting.Ambient; - to->Lighting._unk1 = from->Lighting._unk1; - to->Lighting.AmbientSaturation = from->Lighting.AmbientSaturation; - to->Lighting.Temperature = from->Lighting.Temperature; - to->Lighting._unk2 = from->Lighting._unk2; - to->Lighting._unk3 = from->Lighting._unk3; - to->Lighting._unk4 = from->Lighting._unk4; + if (!housing) + { + to->Lighting.SunLightColor = from->Lighting.SunLightColor; + to->Lighting.MoonLightColor = from->Lighting.MoonLightColor; + to->Lighting.Ambient = from->Lighting.Ambient; + to->Lighting._unk1 = from->Lighting._unk1; + to->Lighting.AmbientSaturation = from->Lighting.AmbientSaturation; + to->Lighting.Temperature = from->Lighting.Temperature; + to->Lighting._unk2 = from->Lighting._unk2; + to->Lighting._unk3 = from->Lighting._unk3; + to->Lighting._unk4 = from->Lighting._unk4; + } to->Stars.ConstellationIntensity = from->Stars.ConstellationIntensity; to->Stars.Constellations = from->Stars.Constellations; @@ -163,6 +166,7 @@ public sealed unsafe class Plugin : IDalamudPlugin var exec = _envStateCopyHook.Original(dest, src); var replace = Preview != null; + var housing = false; if (!Service.ClientState.IsLoggedIn) { @@ -170,7 +174,7 @@ public sealed unsafe class Plugin : IDalamudPlugin } else { - replace |= + housing |= dest->SkyId == 0 && dest->Clouds.Gradient == 0.5f && dest->Lighting._unk1 == 0.5f && @@ -183,11 +187,13 @@ public sealed unsafe class Plugin : IDalamudPlugin dest->Fog._unk2 == 1.0f && dest->Fog.Opacity == 0.0f && dest->Fog.SkyVisibility == 1.0f; + + replace |= housing; } if (replace) { - Replace(dest); + Replace(dest, housing); } return exec; diff --git a/VoidBox/VoidBox.csproj b/VoidBox/VoidBox.csproj index f80a6df..c4604b9 100644 --- a/VoidBox/VoidBox.csproj +++ b/VoidBox/VoidBox.csproj @@ -3,7 +3,7 @@ 0x0ade - 0.1.0.9 + 0.1.0.10