From 5ff4e22eb9886720b39324bbeff7580bbc59a7f0 Mon Sep 17 00:00:00 2001 From: pogokeen Date: Wed, 23 May 2018 15:04:52 +0000 Subject: [PATCH] engine.cpp: fix classicDrawVoxel() positioning bugs by: +avoid adding the pivot's z offset again after it was already added in classicDrawSprite() +offset the voxel object by half of the voxel object's z size git-svn-id: https://svn.eduke32.com/eduke32@6904 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 78cc90373..269e25e45 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -4410,8 +4410,8 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int const int32_t dayscalerecip = divideu32_noinline(1<<30, dayscale); int32_t *longptr = (int32_t *)davoxptr; - const int32_t daxsiz = B_LITTLE32(longptr[0]), daysiz = B_LITTLE32(longptr[1]); //dazsiz = B_LITTLE32(longptr[2]); - const int32_t daxpivot = B_LITTLE32(longptr[3]), daypivot = B_LITTLE32(longptr[4]), dazpivot = B_LITTLE32(longptr[5]); + const int32_t daxsiz = B_LITTLE32(longptr[0]), daysiz = B_LITTLE32(longptr[1]), dazsiz = B_LITTLE32(longptr[2]); + const int32_t daxpivot = B_LITTLE32(longptr[3]), daypivot = B_LITTLE32(longptr[4]);// dazpivot = B_LITTLE32(longptr[5]); davoxptr += (6<<2); x = mulscale16(globalposx-dasprx, daxscalerecip); @@ -4445,7 +4445,7 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int if ((klabs(globalposz-dasprz)>>10) >= klabs(odayscale)) return; - const int32_t syoff = divscale21(globalposz-dasprz,odayscale) + (dazpivot<<7); + const int32_t syoff = divscale21(globalposz-dasprz,odayscale) + (dazsiz<<14); int32_t yoff = (klabs(gxinc)+klabs(gyinc))>>1; longptr = (int32_t *)davoxptr; int32_t xyvoxoffs = (daxsiz+1)<<2;