- re-enabled all model specific code in Duke's animatesprites function and removed some remaining software renderer-only code in the engine.

This commit is contained in:
Christoph Oelckers 2020-12-01 23:57:39 +01:00
parent 9a507e5d0a
commit 25ef58f897
12 changed files with 142 additions and 201 deletions

View file

@ -94,11 +94,8 @@ template<typename T> tspritetype* viewInsertTSprite(int nSector, int nStatnum, T
pTSprite->owner = pSprite->owner;
pTSprite->ang = pSprite->ang;
}
if (videoGetRenderMode() >= REND_POLYMOST)
{
pTSprite->x += Cos(gCameraAng)>>25;
pTSprite->y += Sin(gCameraAng)>>25;
}
return pTSprite;
}
@ -573,7 +570,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
nAnim--;
}
if ((pTSprite->cstat&48) != 48 && r_voxels && videoGetRenderMode() != REND_POLYMER && !(spriteext[nSprite].flags&SPREXT_NOTMD))
if ((pTSprite->cstat&48) != 48 && r_voxels && !(spriteext[nSprite].flags&SPREXT_NOTMD))
{
int const nRootTile = pTSprite->picnum;
int nAnimTile = pTSprite->picnum + animateoffs_replace(pTSprite->picnum, 32768+pTSprite->owner);

View file

@ -298,8 +298,6 @@ void sub_557C4(int x, int y, int interpolation)
void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int viewPlayer)
{
if (videoGetRenderMode() == REND_POLYMER)
return;
for (int i = mirrorcnt - 1; i >= 0; i--)
{
int nTile = 4080+i;

View file

@ -841,7 +841,7 @@ void viewDrawScreen(bool sceneonly)
if ((v78 || bDelirium) && !sceneonly)
{
if (videoGetRenderMode() == REND_POLYMOST && gDeliriumBlur)
if (gDeliriumBlur)
{
// todo: Implement using modern techniques instead of relying on deprecated old stuff that isn't well supported anymore.
/* names broken up so that searching for GL keywords won't find them anymore

View file

@ -41,12 +41,6 @@ EXTERN int16_t sintable[2048];
typedef int64_t coord_t;
enum rendmode_t {
REND_CLASSIC,
REND_POLYMOST = 3,
REND_POLYMER
};
enum
{
MAXSECTORS = 4096,
@ -350,9 +344,6 @@ extern int16_t tiletovox[MAXTILES];
extern int32_t voxscale[MAXVOXELS];
extern char g_haveVoxels;
#ifdef USE_OPENGL
extern int32_t rendmode;
#endif
extern uint8_t globalr, globalg, globalb;
enum {
@ -367,15 +358,6 @@ extern const char *engineerrstr;
EXTERN int32_t editorzrange[2];
static FORCE_INLINE int32_t videoGetRenderMode(void)
{
#ifndef USE_OPENGL
return REND_CLASSIC;
#else
return rendmode;
#endif
}
enum {
ENGINECOMPATIBILITY_NONE = 0,
ENGINECOMPATIBILITY_19950829, // Powerslave/Exhumed
@ -744,7 +726,6 @@ EXTERN_CVAR(Bool, r_voxels)
extern int32_t r_downsize;
extern int32_t mdtims, omdtims;
extern int32_t glrendmode;
extern int32_t r_rortexture;
extern int32_t r_rortexturerange;

View file

@ -4,12 +4,9 @@
#include "mdsprite.h"
void Polymost_CacheHitList(uint8_t* hash);
typedef struct { uint8_t r, g, b, a; } coltype;
typedef struct { float r, g, b, a; } coltypef;
extern int32_t rendmode;
extern float gtang;
extern double gxyaspect;
extern float grhalfxdown10x;
@ -23,7 +20,6 @@ void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...);
void polymost_drawsprite(int32_t snum);
void polymost_drawmaskwall(int32_t damaskwallcnt);
void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t uniqid);
void polymost_fillpolygon(int32_t npoints);
void polymost_initosdfuncs(void);
void polymost_drawrooms(void);
void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang, fixed_t dahoriz, int16_t mirrorWall);

View file

@ -40,8 +40,6 @@
#endif
int32_t rendmode=0;
int32_t glrendmode = REND_POLYMOST;
int32_t r_rortexture = 0;
int32_t r_rortexturerange = 0;
int32_t r_rorphase = 0;
@ -326,12 +324,9 @@ static void renderDrawSprite(int32_t snum)
// drawmaskwall (internal)
//
static void renderDrawMaskedWall(int16_t damaskwallcnt)
{
if (videoGetRenderMode() == REND_POLYMOST)
{
polymost_drawmaskwall(damaskwallcnt); return;
}
}
static uint32_t msqrtasm(uint32_t c)
@ -1129,17 +1124,13 @@ static inline int32_t sameside(const _equation *eq, const vec2f_t *p1, c
static inline int comparetsprites(int const k, int const l)
{
#ifdef USE_OPENGL
if (videoGetRenderMode() == REND_POLYMOST)
{
if ((tspriteptr[k]->cstat & 48) != (tspriteptr[l]->cstat & 48))
return (tspriteptr[k]->cstat & 48) - (tspriteptr[l]->cstat & 48);
if ((tspriteptr[k]->cstat & 48) == 16 && tspriteptr[k]->ang != tspriteptr[l]->ang)
return tspriteptr[k]->ang - tspriteptr[l]->ang;
}
#endif
if (tspriteptr[k]->statnum != tspriteptr[l]->statnum)
return tspriteptr[k]->statnum - tspriteptr[l]->statnum;
@ -1230,9 +1221,6 @@ void renderDrawMasks(void)
int32_t i = spritesortcnt-1;
int32_t numSprites = spritesortcnt;
#ifdef USE_OPENGL
if (videoGetRenderMode() == REND_POLYMOST)
{
spritesortcnt = 0;
int32_t back = i;
for (; i >= 0; --i)
@ -1247,22 +1235,12 @@ void renderDrawMasks(void)
--back;
}
}
} else
#endif
{
for (; i >= 0; --i)
{
tspriteptr[i] = &tsprite[i];
}
}
for (i=numSprites-1; i>=0; --i)
{
const int32_t xs = tspriteptr[i]->x-globalposx, ys = tspriteptr[i]->y-globalposy;
const int32_t yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang);
#ifdef USE_OPENGL
const int32_t modelp = polymost_spriteIsModelOrVoxel(tspriteptr[i]);
#endif
if (yp > (4<<8))
{
@ -1276,9 +1254,7 @@ void renderDrawMasks(void)
else if ((tspriteptr[i]->cstat&48) == 0)
{
killsprite:
#ifdef USE_OPENGL
if (!modelp)
#endif
{
//Delete face sprite if on wrong side!
if (i >= spritesortcnt)
@ -1315,9 +1291,6 @@ killsprite:
sortsprites(spritesortcnt, numSprites);
renderBeginScene();
#ifdef USE_OPENGL
if (videoGetRenderMode() == REND_POLYMOST)
{
GLInterface.EnableBlend(false);
GLInterface.EnableAlphaTest(true);
GLInterface.SetDepthBias(-2, -256);
@ -1388,8 +1361,6 @@ killsprite:
GLInterface.EnableBlend(true);
GLInterface.EnableAlphaTest(true);
GLInterface.SetDepthMask(false);
}
#endif
vec2f_t pos;
@ -1401,8 +1372,7 @@ killsprite:
while (maskwallcnt)
{
// PLAG: sorting stuff
const int32_t w = (videoGetRenderMode()==REND_POLYMER) ?
maskwall[maskwallcnt-1] : thewall[maskwall[maskwallcnt-1]];
const int32_t w = thewall[maskwall[maskwallcnt-1]];
maskwallcnt--;
@ -1878,8 +1848,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
strcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
" (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
rendmode = REND_POLYMOST;
upscalefactor = 1;
xdim = daupscaledxdim;
ydim = daupscaledydim;

View file

@ -2452,8 +2452,6 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
void polymost_drawrooms()
{
if (videoGetRenderMode() == REND_CLASSIC) return;
polymost_outputGLDebugMessage(3, "polymost_drawrooms()");
GLInterface.ClearDepth();
@ -3596,7 +3594,6 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
// basically this just means walls are repeating
// while sprites are clamped
if (videoGetRenderMode() < REND_POLYMOST) return;
if ((dapalnum < (MAXPALOOKUPS - RESERVEDPALS)) && (!lookups.checkTable(dapalnum))) return;//dapalnum = 0;
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);

View file

@ -624,7 +624,7 @@ int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx)
}
pTSprite->cstat = 0x22; // transluscence, floor sprite
pTSprite->z = videoGetRenderMode() >= REND_POLYMOST ? nFloorZ : nFloorZ + 1;
pTSprite->z = nFloorZ;
pTSprite->yrepeat = (uint8_t)edx;
pTSprite->xrepeat = (uint8_t)edx;
pTSprite->statnum = -3;

View file

@ -81,12 +81,11 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->xrepeat = t->yrepeat = 0;
continue;
case CHAIR3:
/*
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) {
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
t->cstat &= ~4;
break;
}
*/
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
if (k > 4)
@ -279,10 +278,11 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->picnum = GROWSPARK + ((ud.levelclock >> 4) & 3);
break;
case RPG:
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
t->cstat &= ~4;
break;
}*/
}
k = getangle(s->x - x, s->y - y);
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
@ -296,10 +296,11 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
break;
case RECON:
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
t->cstat &= ~4;
break;
}*/
}
k = getangle(s->x - x, s->y - y);
if (h->temp_data[0] < 4)
@ -387,10 +388,13 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (!h->GetOwner())
{
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
k = 0;
t->cstat &= ~4;
} else*/ {
}
else
{
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
if (k > 4)
{
@ -504,10 +508,13 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
{
l = ScriptCode[t4 + 2];
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
k = 0;
t->cstat &= ~4;
} else*/ switch (l) {
}
else switch (l)
{
case 2:
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 1;
break;
@ -599,9 +606,6 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
shadowspr->z = daz;
shadowspr->pal = 4;
if (videoGetRenderMode() >= REND_POLYMOST)
{
/*
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
shadowspr->yrepeat = 0;
@ -611,14 +615,12 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
shadowspr->cstat |= 512;
}
else
*/
{
// Alter the shadow's position so that it appears behind the sprite itself.
int look = getangle(shadowspr->x - ps[screenpeek].posx, shadowspr->y - ps[screenpeek].posy);
shadowspr->x += bcos(look, -9);
shadowspr->y += bsin(look, -9);
}
}
spritesortcnt++;
}
}
@ -672,10 +674,13 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->picnum += (s->shade >> 1);
break;
case PLAYERONWATER:
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
k = 0;
t->cstat &= ~4;
} else*/ {
}
else
{
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
if (k > 4)
{
@ -726,10 +731,11 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
case CAMERA1:
case RAT:
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
t->cstat &= ~4;
break;
}*/
}
k = (((t->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
if (k > 4)

View file

@ -438,10 +438,12 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (!h->GetOwner())
{
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
k = 0;
t->cstat &= ~4;
} else*/ {
} else
{
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 7;
if (k > 4)
{
@ -642,10 +644,13 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
{
l = ScriptCode[t4 + 2];
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
{
k = 0;
t->cstat &= ~4;
} else*/ switch (l) {
}
else switch (l)
{
case 2:
k = (((s->ang + 3072 + 128 - a) & 2047) >> 8) & 1;
break;
@ -760,9 +765,6 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
shadowspr->z = daz;
shadowspr->pal = 4;
if (videoGetRenderMode() >= REND_POLYMOST)
{
/*
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
shadowspr->yrepeat = 0;
@ -772,14 +774,12 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
shadowspr->cstat |= 512;
}
else
*/
{
// Alter the shadow's position so that it appears behind the sprite itself.
int look = getangle(shadowspr->x - ps[screenpeek].posx, shadowspr->y - ps[screenpeek].posy);
shadowspr->x += bcos(look, -9);
shadowspr->y += bsin(look, -9);
}
}
spritesortcnt++;
}
}

View file

@ -366,7 +366,6 @@ void renderSetVisibility(float vis)
void renderBeginScene()
{
if (videoGetRenderMode() < REND_POLYMOST) return;
assert(BufferLock == 0);
vp.mPalLightLevels = numshades | (static_cast<int>(gl_fogmode) << 8) | ((int)5 << 16);
@ -380,7 +379,6 @@ void renderBeginScene()
void renderFinishScene()
{
if (videoGetRenderMode() < REND_POLYMOST) return;
assert(BufferLock == 1);
if (--BufferLock == 0)
{

View file

@ -1045,7 +1045,7 @@ JAnalyzeSprites(tspriteptr_t tspr)
// Take care of autosizing
DoAutoSize(tspr);
if (videoGetRenderMode() >= REND_POLYMOST && md_tilehasmodel(tspr->picnum, 0) >= 0 && hw_models) return;
if (md_tilehasmodel(tspr->picnum, 0) >= 0 && hw_models) return;
// Check for voxels
//if (bVoxelsOn)