* Tighter y[ud]most clamping in TROR/classic. This fixes the overdraw bug when standing on the rails in the test map.

* Voxel tweaks: horizontally scale wall-aligned ones by 5/4, make them ignore per-tile yoffset in classic (i.e. emulate Polymost; I think this is more sensible since they're not clipped to floors/ceilings anyway), make Polymost know the voxel scale
* Always cull back-facing, one-sided, wall-aligned sprites (classic/Polymost), irrespective of whether it's a sprite, voxel or model. This can lead to falsely not drawing them in certain circumstances, but IMO that's preferable to visible hidden switches etc.
* Change defaults for r_novoxmips to 1 and lazytileselector to 0


git-svn-id: https://svn.eduke32.com/eduke32@1908 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-06-18 13:02:08 +00:00
parent fdcfd8db0f
commit 5a632bc1f0
6 changed files with 67 additions and 32 deletions

View file

@ -362,11 +362,15 @@ int32_t writesetup(const char *fn)
"grid = %d\n"
"\n"
#ifdef USE_OPENGL
"; OpenGL mode options\n"
";; OpenGL mode options\n"
"usemodels = %d\n"
"usehightile = %d\n"
"; Enabling lazytileselector allows the tile display to interrupt\n"
"; drawing hightiles so you can quickly browse without waiting\n"
"; for all of them to load. Set to 0 if you experience flickering.\n"
"lazytileselector = %d\n"
"; glusetexcache: 0:no, 1:yes, 2:compressed\n"
"; For best performance, keep this setting in sync with EDuke32\n"
"glusetexcache = %d\n"
"gltexfiltermode = %d\n"
"glanisotropy = %d\n"

View file

@ -1347,6 +1347,10 @@ static int32_t defsparser(scriptfile *script)
double scale=1.0;
scriptfile_getdouble(script,&scale);
voxscale[lastvoxid] = (int32_t)(65536*scale);
#ifdef USE_OPENGL
if (voxmodels[lastvoxid])
voxmodels[lastvoxid]->scale = scale;
#endif
break;
}
}

View file

@ -82,7 +82,7 @@ int32_t tiletovox[MAXTILES];
int32_t usevoxels = 1;
#define kloadvoxel loadvoxel
int32_t novoxmips = 0;
int32_t novoxmips = 1;
int32_t editorgridextent = 131072;
//These variables need to be copied into BUILD
@ -965,14 +965,15 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
#endif
#ifdef YAX_DEBUG_YMOSTS
if (getrendermode()==0)
if (getrendermode()==0 && numyaxbunches>0)
{
char purple = getclosestcol(63, 0, 63);
char yellow = getclosestcol(63, 63, 0);
begindrawing();
for (i=0; i<numyaxbunches; i++)
{
int32_t x, x1;
char purple = getclosestcol(63, 0, 63);
char yellow = getclosestcol(63, 63, 0);
if ((haveymost[i>>3]&(1<<i&7))==0)
continue;
@ -981,10 +982,10 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
for (x=x1; x<x1+xdimen; x++)
{
if (yumost[x] >= 0 && yumost[x] < ydim)
if (yumost[x] >= 0 && yumost[x] < ydim && (x&1))
*((char *)frameplace + yumost[x]*bytesperline + x-x1) = purple;
if (ydmost[x]-1 >= 0 && ydmost[x]-1 < ydim)
if (ydmost[x]-1 >= 0 && ydmost[x]-1 < ydim && !(x&1))
*((char *)frameplace + (ydmost[x]-1)*bytesperline + x-x1) = yellow;
}
}
@ -2160,8 +2161,8 @@ static inline int32_t getpalookup(int32_t davis, int32_t dashade)
}
// returns: 0=continue;
// 1=break;
// returns: 0=continue sprite collecting;
// 1=break out of sprite collecting;
int32_t engine_addtsprite(int16_t z, int16_t sectnum)
{
spritetype *spr = &sprite[z];
@ -2254,8 +2255,9 @@ static void scansector(int16_t sectnum)
{
xs = spr->x-globalposx; ys = spr->y-globalposy;
if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0))
if (engine_addtsprite(z, sectnum))
break;
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-xs, sintable[spr->ang&2047],-ys) > 0)
if (engine_addtsprite(z, sectnum))
break;
}
}
@ -4276,10 +4278,16 @@ static void drawalls(int32_t bunch)
x1 = bn[i]*xdimen;
for (x=x1+xb1[bunchfirst[bunch]]; x<=x1+xb2[bunchlast[bunch]]; x++)
{
// if (i==YAX_CEILING)
if (i==YAX_CEILING)
{
yumost[x] = min(yumost[x], umost[x-x1]);
// else
ydmost[x] = max(ydmost[x], min(dmost[x-x1], uplc[x-x1]));
}
else
{
yumost[x] = min(yumost[x], max(umost[x-x1], dplc[x-x1]));
ydmost[x] = max(ydmost[x], dmost[x-x1]);
}
}
}
}
@ -4705,7 +4713,7 @@ static void drawalls(int32_t bunch)
//
static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang,
int32_t daxscale, int32_t dayscale, char daindex,
int8_t dashade, char dapal, int32_t *daumost, int32_t *dadmost)
int8_t dashade, char dapal, const int32_t *daumost, const int32_t *dadmost)
{
int32_t i, j, k, x, y, syoff, ggxstart, ggystart, nxoff;
int32_t cosang, sinang, sprcosang, sprsinang, backx, backy, gxinc, gyinc;
@ -4949,6 +4957,16 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp
}
}
#if 0
for (x=0; x<xdimen; x++)
{
if (daumost[x]>=0 && daumost[x]<ydimen)
*(char *)(frameplace + x + bytesperline*daumost[x]) = editorcolors[13];
if (dadmost[x]>=0 && dadmost[x]<ydimen)
*(char *)(frameplace + x + bytesperline*dadmost[x]) = editorcolors[14];
}
#endif
enddrawing(); //}}}
}
@ -5773,7 +5791,11 @@ static void drawsprite(int32_t snum)
}
else if ((cstat&48) == 48)
{
int32_t nxrepeat, nyrepeat;
int32_t nxrepeat, nyrepeat, daxrepeat;
daxrepeat = (int32_t)tspr->xrepeat;
if ((sprite[spritenum].cstat&48)==16)
daxrepeat = (daxrepeat*5)/4;
lx = 0; rx = xdim-1;
for (x=lx; x<=rx; x++)
@ -5831,17 +5853,17 @@ static void drawsprite(int32_t snum)
if (voxscale[vtilenum] == 65536)
{
nxrepeat = (((int32_t)tspr->xrepeat)<<16);
nxrepeat = (daxrepeat<<16);
nyrepeat = (((int32_t)tspr->yrepeat)<<16);
}
else
{
nxrepeat = ((int32_t)tspr->xrepeat)*voxscale[vtilenum];
nxrepeat = daxrepeat*voxscale[vtilenum];
nyrepeat = ((int32_t)tspr->yrepeat)*voxscale[vtilenum];
}
if (!(cstat&128)) tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat);
yoff = (int32_t)((int8_t)((picanm[sprite[tspr->owner].picnum]>>16)&255))+((int32_t)tspr->yoffset);
yoff = /*(int32_t) ((int8_t)((picanm[sprite[tspr->owner].picnum]>>16)&255)) +*/ (int32_t)tspr->yoffset;
tspr->z -= mulscale14(yoff,nyrepeat);
globvis = globalvisibility;
@ -5899,7 +5921,7 @@ static void drawsprite(int32_t snum)
#ifdef USE_OPENGL
i += spriteext[tspr->owner].angoff;
#endif
drawvox(tspr->x,tspr->y,tspr->z,i,(int32_t)tspr->xrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall);
drawvox(tspr->x,tspr->y,tspr->z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall);
}
// if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7];
}

View file

@ -3094,6 +3094,9 @@ int32_t voxdraw(voxmodel_t *m, spritetype *tspr)
//if (globalorientation&4) { m0.y = -m0.y; a0.y = -a0.y; } //x-flipping
f = ((float)tspr->xrepeat)*(256.0/320.0)/64.0*m->bscale;
if ((sprite[tspr->owner].cstat&48)==16)
f *= 1.25f;
m0.x *= f; a0.x *= f; f = -f;
m0.y *= f; a0.y *= f;
f = ((float)tspr->yrepeat)/64.0*m->bscale;

View file

@ -4135,8 +4135,9 @@ void polymost_scansector(int32_t sectnum)
xs = spr->x-globalposx; ys = spr->y-globalposy;
if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0) || (usemodels && tile2model[spr->picnum].modelid>=0))
{
if (engine_addtsprite(z, sectnum))
break;
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-xs, sintable[spr->ang&2047],-ys) > 0)
if (engine_addtsprite(z, sectnum))
break;
}
}
}
@ -4769,6 +4770,7 @@ void polymost_drawsprite(int32_t snum)
int32_t posx,posy;
int32_t oldsizx, oldsizy;
int32_t tsizx, tsizy;
tspr = tspriteptr[snum];
if (tspr->owner < 0 || tspr->picnum < 0 || tspr->picnum >= MAXTILES) return;
@ -4782,11 +4784,11 @@ void polymost_drawsprite(int32_t snum)
{
int32_t flag;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,spritenum+32768);
flag = usehightile&&h_xsize[globalpicnum];
flag = usehightile && h_xsize[globalpicnum];
xoff = (int32_t)tspr->xoffset;
yoff = (int32_t)tspr->yoffset;
xoff += (int8_t)((flag)?(h_xoffs[globalpicnum]):((picanm[globalpicnum]>>8)&255));
yoff += (int8_t)((flag)?(h_yoffs[globalpicnum]):((picanm[globalpicnum]>>16)&255));
xoff += (int8_t)(flag ? h_xoffs[globalpicnum] : ((picanm[globalpicnum]>>8)&255));
yoff += (int8_t)(flag ? h_yoffs[globalpicnum] : ((picanm[globalpicnum]>>16)&255));
}
method = 1+4;
@ -4855,14 +4857,14 @@ void polymost_drawsprite(int32_t snum)
if (mddraw(tspr)) return;
break; // else, render as flat sprite
}
if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[ tiletovox[tspr->picnum] ])
if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]])
{
if (voxdraw(voxmodels[ tiletovox[tspr->picnum] ], tspr)) return;
if (voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) return;
break; // else, render as flat sprite
}
if ((tspr->cstat&48)==48 && voxmodels[ tspr->picnum ])
if ((tspr->cstat&48)==48 && voxmodels[tspr->picnum])
{
voxdraw(voxmodels[ tspr->picnum ], tspr);
voxdraw(voxmodels[tspr->picnum], tspr);
return;
}
break;
@ -4888,10 +4890,10 @@ void polymost_drawsprite(int32_t snum)
}
oldsizx=tsizx=tilesizx[globalpicnum];
oldsizy=tsizy=tilesizy[globalpicnum];
if (usehightile&&h_xsize[globalpicnum])
if (usehightile && h_xsize[globalpicnum])
{
tsizx=h_xsize[globalpicnum];
tsizy=h_ysize[globalpicnum];
tsizx = h_xsize[globalpicnum];
tsizy = h_ysize[globalpicnum];
}
switch ((globalorientation>>4)&3)

View file

@ -100,7 +100,7 @@ static struct strllist
const char *scripthist[SCRIPTHISTSIZ];
int32_t scripthistend = 0;
int32_t g_lazy_tileselector = 1;
int32_t g_lazy_tileselector = 0;
int32_t showambiencesounds=2;
int32_t autocorruptcheck = 0;