From de5f27c44616ff659707963a26042a0ca5a21935 Mon Sep 17 00:00:00 2001 From: Daniel Grimwood Date: Sun, 29 Dec 2019 15:38:56 +0800 Subject: [PATCH 1/3] Fixes #1659 by testing both 8 and 9 for water blockid --- overviewer_core/src/primitives/cave.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/overviewer_core/src/primitives/cave.c b/overviewer_core/src/primitives/cave.c index 49313a2..9eb589b 100644 --- a/overviewer_core/src/primitives/cave.c +++ b/overviewer_core/src/primitives/cave.c @@ -78,15 +78,15 @@ cave_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) { * at this point of the code the block has no skylight * but a deep sea can be completely dark */ - if ((getArrayShort3D(state->blocks, x, y, z) == 9) || - (get_data(state, BLOCKS, x, y + 1, z) == 9)) { + if ((getArrayShort3D(state->blocks, x, y, z) == 9) || (getArrayShort3D(state->blocks, x, y, z) == 8) || + (get_data(state, BLOCKS, x, y + 1, z) == 9) || (get_data(state, BLOCKS, x, y + 1, z) == 8)) { for (dy = y + 1; dy < (SECTIONS_PER_CHUNK - state->chunky) * 16; dy++) { /* go up and check for skylight */ if (get_data(state, SKYLIGHT, x, dy, z) != 0) { return true; } - if (get_data(state, BLOCKS, x, dy, z) != 9) { + if (get_data(state, BLOCKS, x, dy, z) != 8 && get_data(state, BLOCKS, x, dy, z) != 9) { /* we are out of the water! and there's no skylight * , i.e. is a cave lake or something similar */ break; From 1770e2e6cd433b5875efb0df445d824c15ff4e19 Mon Sep 17 00:00:00 2001 From: Daniel Grimwood Date: Wed, 12 Feb 2020 21:50:58 +0800 Subject: [PATCH 2/3] mmmm temporary variables --- overviewer_core/src/primitives/cave.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/overviewer_core/src/primitives/cave.c b/overviewer_core/src/primitives/cave.c index 9eb589b..3b06467 100644 --- a/overviewer_core/src/primitives/cave.c +++ b/overviewer_core/src/primitives/cave.c @@ -63,6 +63,8 @@ static bool cave_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) { RenderPrimitiveCave* self; int32_t dy = 0; + uint16_t blockID; + uint32_t blockUpID; self = (RenderPrimitiveCave*)data; /* check if the block is touching skylight */ @@ -79,8 +81,9 @@ cave_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) { * but a deep sea can be completely dark */ - if ((getArrayShort3D(state->blocks, x, y, z) == 9) || (getArrayShort3D(state->blocks, x, y, z) == 8) || - (get_data(state, BLOCKS, x, y + 1, z) == 9) || (get_data(state, BLOCKS, x, y + 1, z) == 8)) { + blockID = getArrayShort3D(state->blocks, x, y, z); + blockUpID = get_data(state, BLOCKS, x, y + 1, z); + if (blockID == 9 || blockID == 8 || blockUpID == 9 || blockUpID == 8) { for (dy = y + 1; dy < (SECTIONS_PER_CHUNK - state->chunky) * 16; dy++) { /* go up and check for skylight */ if (get_data(state, SKYLIGHT, x, dy, z) != 0) { From ede3ac5db4670bbffca1c02a9a1116918c2b6222 Mon Sep 17 00:00:00 2001 From: Daniel Grimwood Date: Thu, 13 Feb 2020 19:58:02 +0800 Subject: [PATCH 3/3] And the other location for the temporary variables --- overviewer_core/src/primitives/cave.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/overviewer_core/src/primitives/cave.c b/overviewer_core/src/primitives/cave.c index 3b06467..66d976e 100644 --- a/overviewer_core/src/primitives/cave.c +++ b/overviewer_core/src/primitives/cave.c @@ -89,7 +89,8 @@ cave_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) { if (get_data(state, SKYLIGHT, x, dy, z) != 0) { return true; } - if (get_data(state, BLOCKS, x, dy, z) != 8 && get_data(state, BLOCKS, x, dy, z) != 9) { + blockUpID = get_data(state, BLOCKS, x, dy, z); + if (blockUpID != 8 && blockUpID != 9) { /* we are out of the water! and there's no skylight * , i.e. is a cave lake or something similar */ break;