From 98a08a3f3a4efba1b9021f5eda5de455b843b946 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 25 Oct 2017 17:36:58 +1100 Subject: [PATCH] Fix particles being shaded wrongly. (Thanks CyberToon) --- ClassicalSharp/Map/Lighting/BasicLighting.cs | 2 +- ClassicalSharp/Map/Lighting/IWorldLighting.cs | 3 ++- src/Client/Lighting.c | 4 ++-- src/Client/Lighting.h | 2 +- src/Client/Particle.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ClassicalSharp/Map/Lighting/BasicLighting.cs b/ClassicalSharp/Map/Lighting/BasicLighting.cs index 6fed83dd0..ca4a7852b 100644 --- a/ClassicalSharp/Map/Lighting/BasicLighting.cs +++ b/ClassicalSharp/Map/Lighting/BasicLighting.cs @@ -95,7 +95,7 @@ namespace ClassicalSharp.Map { } public override int LightCol_ZSide(int x, int y, int z) { - return y > GetLightHeight(x, z) ? OutsideZSide : shadowZSide; + return y > GetLightHeight(x, z) ? OutsideXSide : shadowXSide; } diff --git a/ClassicalSharp/Map/Lighting/IWorldLighting.cs b/ClassicalSharp/Map/Lighting/IWorldLighting.cs index 986992c26..f73ebf143 100644 --- a/ClassicalSharp/Map/Lighting/IWorldLighting.cs +++ b/ClassicalSharp/Map/Lighting/IWorldLighting.cs @@ -42,7 +42,8 @@ namespace ClassicalSharp.Map { public abstract int LightCol(int x, int y, int z); /// Returns the light colour of the block at the given coordinates. - /// *** Does NOT check that the coordinates are inside the map. *** + /// *** Does NOT check that the coordinates are inside the map. *** + /// NOTE: This actually returns X shaded colour, but is called ZSide to avoid breaking compatibility. public abstract int LightCol_ZSide(int x, int y, int z); diff --git a/src/Client/Lighting.c b/src/Client/Lighting.c index d6e8dd573..d0ee3d6ec 100644 --- a/src/Client/Lighting.c +++ b/src/Client/Lighting.c @@ -61,8 +61,8 @@ PackedCol Lighting_Col(Int32 x, Int32 y, Int32 z) { return y > Lighting_GetLightHeight(x, z) ? Lighting_Outside : shadow; } -PackedCol Lighting_Col_ZSide(Int32 x, Int32 y, Int32 z) { - return y > Lighting_GetLightHeight(x, z) ? Lighting_OutsideZSide : shadowZSide; +PackedCol Lighting_Col_XSide(Int32 x, Int32 y, Int32 z) { + return y > Lighting_GetLightHeight(x, z) ? Lighting_OutsideXSide : shadowXSide; } PackedCol Lighting_Col_Sprite_Fast(Int32 x, Int32 y, Int32 z) { diff --git a/src/Client/Lighting.h b/src/Client/Lighting.h index 239b39a73..8330628ac 100644 --- a/src/Client/Lighting.h +++ b/src/Client/Lighting.h @@ -36,7 +36,7 @@ NOTE: Does ***NOT*** check that the coordinates are inside the map. */ PackedCol Lighting_Col(Int32 x, Int32 y, Int32 z); /* Returns the light colour of the block at the given coordinates. NOTE: Does ***NOT*** check that the coordinates are inside the map. */ -PackedCol Lighting_Col_ZSide(Int32 x, Int32 y, Int32 z); +PackedCol Lighting_Col_XSide(Int32 x, Int32 y, Int32 z); PackedCol Lighting_Col_Sprite_Fast(Int32 x, Int32 y, Int32 z); PackedCol Lighting_Col_YTop_Fast(Int32 x, Int32 y, Int32 z); diff --git a/src/Client/Particle.c b/src/Client/Particle.c index d41368fa9..08dcfbe2b 100644 --- a/src/Client/Particle.c +++ b/src/Client/Particle.c @@ -150,7 +150,7 @@ void TerrainParticle_Render(TerrainParticle* p, Real32 t, VertexP3fT2fC4b** vert PackedCol col = PACKEDCOL_WHITE; if (!Block_FullBright[p->Block]) { Int32 x = Math_Floor(pos.X), y = Math_Floor(pos.Y), z = Math_Floor(pos.Z); - col = World_IsValidPos(x, y, z) ? Lighting_Col_ZSide(x, y, z) : Lighting_OutsideZSide; + col = World_IsValidPos(x, y, z) ? Lighting_Col_XSide(x, y, z) : Lighting_OutsideXSide; } if (Block_Tinted[p->Block]) {