Don't apply lighting changes on housing skybox replacements (fixes windows)

This commit is contained in:
Jade Macho 2024-08-21 16:35:02 +02:00
parent 4f25d3f0d4
commit 57258598c0
Signed by: 0x0ade
GPG Key ID: E1960710FE4FBEEF
2 changed files with 21 additions and 15 deletions

View File

@ -70,7 +70,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
Service.Plugin = null!; Service.Plugin = null!;
} }
private void Replace(EnvState* env) private void Replace(EnvState* env, bool housing)
{ {
var config = Service.Config; var config = Service.Config;
if (!config.IsEnabled) if (!config.IsEnabled)
@ -85,13 +85,15 @@ public sealed unsafe class Plugin : IDalamudPlugin
} }
var savedEnvVal = savedEnv.Value; 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->SkyId = from->SkyId;
if (!housing)
{
to->Lighting.SunLightColor = from->Lighting.SunLightColor; to->Lighting.SunLightColor = from->Lighting.SunLightColor;
to->Lighting.MoonLightColor = from->Lighting.MoonLightColor; to->Lighting.MoonLightColor = from->Lighting.MoonLightColor;
to->Lighting.Ambient = from->Lighting.Ambient; to->Lighting.Ambient = from->Lighting.Ambient;
@ -101,6 +103,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
to->Lighting._unk2 = from->Lighting._unk2; to->Lighting._unk2 = from->Lighting._unk2;
to->Lighting._unk3 = from->Lighting._unk3; to->Lighting._unk3 = from->Lighting._unk3;
to->Lighting._unk4 = from->Lighting._unk4; to->Lighting._unk4 = from->Lighting._unk4;
}
to->Stars.ConstellationIntensity = from->Stars.ConstellationIntensity; to->Stars.ConstellationIntensity = from->Stars.ConstellationIntensity;
to->Stars.Constellations = from->Stars.Constellations; to->Stars.Constellations = from->Stars.Constellations;
@ -163,6 +166,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
var exec = _envStateCopyHook.Original(dest, src); var exec = _envStateCopyHook.Original(dest, src);
var replace = Preview != null; var replace = Preview != null;
var housing = false;
if (!Service.ClientState.IsLoggedIn) if (!Service.ClientState.IsLoggedIn)
{ {
@ -170,7 +174,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
} }
else else
{ {
replace |= housing |=
dest->SkyId == 0 && dest->SkyId == 0 &&
dest->Clouds.Gradient == 0.5f && dest->Clouds.Gradient == 0.5f &&
dest->Lighting._unk1 == 0.5f && dest->Lighting._unk1 == 0.5f &&
@ -183,11 +187,13 @@ public sealed unsafe class Plugin : IDalamudPlugin
dest->Fog._unk2 == 1.0f && dest->Fog._unk2 == 1.0f &&
dest->Fog.Opacity == 0.0f && dest->Fog.Opacity == 0.0f &&
dest->Fog.SkyVisibility == 1.0f; dest->Fog.SkyVisibility == 1.0f;
replace |= housing;
} }
if (replace) if (replace)
{ {
Replace(dest); Replace(dest, housing);
} }
return exec; return exec;

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors>0x0ade</Authors> <Authors>0x0ade</Authors>
<Company></Company> <Company></Company>
<Version>0.1.0.9</Version> <Version>0.1.0.10</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl></PackageProjectUrl> <PackageProjectUrl></PackageProjectUrl>