diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index b79345cd2..99db0cfd2 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -108,5 +108,6 @@ EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK); extern float fcosglobalang, fsinglobalang; extern float fxdim, fydim, fydimen, fviewingrange; +extern int32_t viewingrangerecip; #endif diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 05d3f78a5..618088285 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1104,7 +1104,7 @@ static int32_t globaluclip, globaldclip; //char globparaceilclip, globparaflorclip; int32_t xyaspect; -static int32_t viewingrangerecip; +int32_t viewingrangerecip; static char globalxshift, globalyshift; static int32_t globalxpanning, globalypanning; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index ac5638519..7ff3c180c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -266,7 +266,7 @@ static void polymost_updaterotmat(void) }; multiplyMatrix4f(matrix, tiltmatrix); renderSetViewMatrix(matrix); - renderSetVisibility(((float)(g_visibility) / r_ambientlight) * fviewingrange * (7.5f / (65536.f * 65536.f))); + renderSetVisibility(mulscale16(g_visibility, mulscale16(xdimenscale, viewingrangerecip)) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight); } static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, int32_t method, const vec2_16_t& tilesiz);