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
This commit is contained in:
pogokeen 2018-05-23 15:04:52 +00:00
parent 5629f4f433
commit 5ff4e22eb9

View file

@ -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); const int32_t dayscalerecip = divideu32_noinline(1<<30, dayscale);
int32_t *longptr = (int32_t *)davoxptr; 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 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 daxpivot = B_LITTLE32(longptr[3]), daypivot = B_LITTLE32(longptr[4]);// dazpivot = B_LITTLE32(longptr[5]);
davoxptr += (6<<2); davoxptr += (6<<2);
x = mulscale16(globalposx-dasprx, daxscalerecip); 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)) if ((klabs(globalposz-dasprz)>>10) >= klabs(odayscale))
return; 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; int32_t yoff = (klabs(gxinc)+klabs(gyinc))>>1;
longptr = (int32_t *)davoxptr; longptr = (int32_t *)davoxptr;
int32_t xyvoxoffs = (daxsiz+1)<<2; int32_t xyvoxoffs = (daxsiz+1)<<2;