mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Voxel fixes from Nuke.YKT
git-svn-id: https://svn.eduke32.com/eduke32@7778 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2882609822
commit
a075a89304
2 changed files with 30 additions and 17 deletions
|
@ -4716,7 +4716,7 @@ typedef zint_t voxint_t;
|
|||
static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang,
|
||||
int32_t daxscale, int32_t dayscale, int32_t daindex,
|
||||
int8_t dashade, char dapal, const int32_t *daumost, const int32_t *dadmost,
|
||||
const int8_t cstat)
|
||||
const int8_t cstat, const int32_t clipcf, int32_t floorz, int32_t ceilingz)
|
||||
{
|
||||
int32_t i, j, k, x, y;
|
||||
|
||||
|
@ -4801,6 +4801,10 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
return;
|
||||
|
||||
const int32_t syoff = divscale21(globalposz-dasprz,odayscale) + (dazsiz<<14);
|
||||
floorz = min(floorz, dasprz+mulscale7(dazsiz,odayscale));
|
||||
ceilingz = max(ceilingz, dasprz-mulscale7(dazsiz, odayscale));
|
||||
const int32_t flooroff = divscale21(floorz-globalposz,odayscale);
|
||||
const int32_t ceilingoff = divscale21(ceilingz-globalposz,odayscale);
|
||||
int32_t yoff = (klabs(gxinc)+klabs(gyinc))>>1;
|
||||
longptr = (int32_t *)davoxptr;
|
||||
int32_t xyvoxoffs = (daxsiz+1)<<2;
|
||||
|
@ -4951,6 +4955,13 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
// FIXME! AMCTC RC2/beta shotgun voxel
|
||||
// (e.g. training map right after M16 shooting):
|
||||
const int32_t l2 = distrecip[clamp((ny+yoff)>>14, 1, DISTRECIPSIZ-1)];
|
||||
int32_t cz1 = 0, cz2 = INT32_MAX;
|
||||
|
||||
if (clipcf)
|
||||
{
|
||||
cz1 = mulscale32((ceilingoff < 0) ? l1 : l2, ceilingoff) + globalhoriz;
|
||||
cz2 = mulscale32((flooroff < 0) ? l2 : l1, flooroff) + globalhoriz;
|
||||
}
|
||||
|
||||
for (; voxptr<voxend; voxptr+=voxptr[1]+3)
|
||||
{
|
||||
|
@ -4984,11 +4995,13 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
|
||||
int32_t yplc, yinc=0;
|
||||
|
||||
const int32_t um = max(daumost[lx], cz1);
|
||||
const int32_t dm = min(dadmost[lx], cz2);
|
||||
if (voxptr[1] == 1)
|
||||
{
|
||||
yplc = 0; yinc = 0;
|
||||
if (z1 < daumost[lx])
|
||||
z1 = daumost[lx];
|
||||
if (z1 < um)
|
||||
z1 = um;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4997,7 +5010,7 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
else if (z2 > z1)
|
||||
yinc = lowrecip[z2-z1]*voxptr[1]>>8;
|
||||
|
||||
if (z1 < daumost[lx]) { yplc = yinc*(daumost[lx]-z1); z1 = daumost[lx]; }
|
||||
if (z1 < um) { yplc = yinc*(um-z1); z1 = um; }
|
||||
else yplc = 0;
|
||||
|
||||
if (cstat & 8)
|
||||
|
@ -5006,8 +5019,8 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
yplc = ((voxptr[1])<<16) - yplc + yinc;
|
||||
}
|
||||
|
||||
if (z2 > dadmost[lx])
|
||||
z2 = dadmost[lx];
|
||||
if (z2 > dm)
|
||||
z2 = dm;
|
||||
z2 -= z1;
|
||||
if (z2 <= 0)
|
||||
continue;
|
||||
|
@ -5184,7 +5197,7 @@ static void classicDrawSprite(int32_t snum)
|
|||
|
||||
if ((cstat&48)==48)
|
||||
vtilenum = tilenum; // if the game wants voxels, it gets voxels
|
||||
else if (usevoxels && tiletovox[tilenum] != -1 && spritenum != -1 && !(spriteext[spritenum].flags&SPREXT_NOTMD))
|
||||
else if ((cstat & 48) != 32 && usevoxels && tiletovox[tilenum] != -1 && spritenum != -1 && !(spriteext[spritenum].flags&SPREXT_NOTMD))
|
||||
{
|
||||
vtilenum = tiletovox[tilenum];
|
||||
cstat |= 48;
|
||||
|
@ -6104,16 +6117,11 @@ draw_as_face_sprite:
|
|||
}
|
||||
|
||||
if (!(cstat&128))
|
||||
{
|
||||
if (cstat&8)
|
||||
tspr->z += mulscale22(B_LITTLE32(longptr[5]),nyrepeat);
|
||||
else
|
||||
tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat);
|
||||
}
|
||||
tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat);
|
||||
off.x = tspr->xoffset;
|
||||
off.y = /*picanm[sprite[tspr->owner].picnum].yofs +*/ tspr->yoffset;
|
||||
if (cstat & 4) off.x = -off.x;
|
||||
if (cstat & 8) off.y = -off.y;
|
||||
if ((cstat & 8) && (tspr->cstat&48) != 0) off.y = -off.y;
|
||||
tspr->z -= off.y * tspr->yrepeat << 2;
|
||||
|
||||
if ((sprite[spritenum].cstat&CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_WALL)
|
||||
|
@ -6183,7 +6191,12 @@ draw_as_face_sprite:
|
|||
|
||||
i = (int32_t)tspr->ang+1536;
|
||||
i += spriteext[spritenum].angoff;
|
||||
classicDrawVoxel(tspr->x,tspr->y,tspr->z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall,cstat);
|
||||
|
||||
const int32_t ceilingz = (sec->ceilingstat&3) == 0 ? sec->ceilingz : INT32_MIN;
|
||||
const int32_t floorz = (sec->floorstat&3) == 0 ? sec->floorz : INT32_MAX;
|
||||
|
||||
classicDrawVoxel(tspr->x,tspr->y,tspr->z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum,
|
||||
tspr->shade,tspr->pal,lwall,swall,cstat,(tspr->cstat&48)!=48,floorz,ceilingz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1046,9 +1046,9 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
|
|||
m0.z *= f; a0.z *= f;
|
||||
|
||||
k0 = (float) tspr->z;
|
||||
f = (globalorientation&8) ? -4.f : 4.f;
|
||||
f = ((globalorientation&8) && (sprite[tspr->owner].cstat&48)!=0) ? -4.f : 4.f;
|
||||
k0 -= (tspr->yoffset*tspr->yrepeat)*f*m->bscale;
|
||||
if (!(tspr->cstat&128)) k0 -= (m->piv.z*tspr->yrepeat)*f*m->scale;
|
||||
if (!(tspr->cstat&128)) k0 -= (m->piv.z*tspr->yrepeat)*4.f*m->scale;
|
||||
|
||||
f = (65536.f*512.f) / ((float)xdimen*viewingrange);
|
||||
g = 32.f / ((float)xdimen*gxyaspect);
|
||||
|
|
Loading…
Reference in a new issue