- removed polymost_dorotatespritemodel.

Models are inoperable right now anyway so this would never get called, but it does a few things that would cause problems with refactoring the backend code.
This commit is contained in:
Christoph Oelckers 2020-06-01 11:28:07 +02:00
parent 350acd2ac3
commit 080333311c
2 changed files with 2 additions and 176 deletions

View file

@ -5329,11 +5329,13 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
{
tileUpdatePicnum(&picnum, (int16_t)0xc000);
if ((tileWidth(picnum) <= 0) || (tileHeight(picnum) <= 0)) return;
#if 0
if (hw_models && tile2model[picnum].hudmem[(dastat & 4) >> 2])
{
polymost_dorotatespritemodel(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, guniqhudid);
return;
}
#endif
}
// We must store all calls in the 2D drawer so that the backend can operate on a clean 3D view.

View file

@ -4335,182 +4335,6 @@ _drawsprite_return:
EDUKE32_STATIC_ASSERT((int)RS_YFLIP == (int)HUDFLAG_FLIPPED);
//sx,sy center of sprite; screen coords*65536
//z zoom*65536. > is zoomed in
//a angle (0 is default)
//dastat&1 1:translucence
//dastat&2 1:auto-scale mode (use 320*200 coordinates)
//dastat&4 1:y-flip
//dastat&8 1:don't clip to startumost/startdmost
//dastat&16 1:force point passed to be top-left corner, 0:Editart center
//dastat&32 1:reverse translucence
//dastat&64 1:non-masked, 0:masked
//dastat&128 1:draw all pages (permanent)
//cx1,... clip window (actual screen coords)
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)
{
float d, cosang, sinang, cosang2, sinang2;
float m[4][4];
const int32_t tilenum = Ptile2tile(picnum, dapalnum);
if (tile2model[tilenum].modelid == -1 || tile2model[tilenum].framenum == -1)
return;
vec3f_t vec1;
tspritetype tspr{};
hudtyp const * const hud = tile2model[tilenum].hudmem[(dastat&4)>>2];
if (!hud || hud->flags & HUDFLAG_HIDE)
return;
polymost_outputGLDebugMessage(3, "polymost_dorotatespritemodel(sx:%d, sy:%d, z:%d, a:%hd, picnum:%hd, dashade:%hhd, dapalnum:%hhu, dastat:%d, daalpha:%hhu, dablend:%hhu, uniqid:%d)",
sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, uniqid);
gchang = 1.f;
gshang = 0.f; d = (float) z*(1.0f/(65536.f*16384.f));
gctang = (float) sintable[(a+512)&2047]*d;
gstang = (float) sintable[a&2047]*d;
gvrcorrection = 1.f;
polymost_updaterotmat();
int const ogshade = globalshade; globalshade = dashade;
int const ogpal = globalpal; globalpal = (int32_t) ((uint8_t) dapalnum);
double const ogxyaspect = gxyaspect; gxyaspect = 1.f;
int const oldviewingrange = viewingrange; viewingrange = 65536;
float const oldfviewingrange = fviewingrange; fviewingrange = 65536.f;
vec1 = hud->add;
if (!(hud->flags & HUDFLAG_NOBOB))
{
vec2f_t f = { (float)sx * (1.f / 65536.f), (float)sy * (1.f / 65536.f) };
if (dastat & RS_TOPLEFT)
{
vec2_16_t siz = tilesiz[picnum];
vec2_16_t off = { (int16_t)((siz.x >> 1) + tileLeftOffset(picnum)), (int16_t)((siz.y >> 1) + tileTopOffset(picnum)) };
d = (float)z * (1.0f / (65536.f * 16384.f));
cosang2 = cosang = (float)sintable[(a + 512) & 2047] * d;
sinang2 = sinang = (float)sintable[a & 2047] * d;
if ((dastat & RS_AUTO) || (!(dastat & RS_NOCLIP))) // Don't aspect unscaled perms
{
d = (float)xyaspect * (1.0f / 65536.f);
cosang2 *= d;
sinang2 *= d;
}
vec2f_t const foff = { (float)off.x, (float)off.y };
f.x += -foff.x * cosang2 + foff.y * sinang2;
f.y += -foff.x * sinang - foff.y * cosang;
}
if (!(dastat & RS_AUTO))
{
vec1.x += f.x / ((float)(xdim << 15)) - 1.f; //-1: left of screen, +1: right of screen
vec1.y += f.y / ((float)(ydim << 15)) - 1.f; //-1: top of screen, +1: bottom of screen
}
else
{
vec1.x += f.x * (1.0f / 160.f) - 1.f; //-1: left of screen, +1: right of screen
vec1.y += f.y * (1.0f / 100.f) - 1.f; //-1: top of screen, +1: bottom of screen
}
}
tspr.ang = hud->angadd+globalang;
if (dastat & RS_YFLIP) { vec1.x = -vec1.x; vec1.y = -vec1.y; }
// In Polymost, we don't care if the model is very big
{
tspr.xrepeat = tspr.yrepeat = 32;
tspr.x = globalposx + Blrintf((gcosang*vec1.z - gsinang*vec1.x)*16384.f);
tspr.y = globalposy + Blrintf((gsinang*vec1.z + gcosang*vec1.x)*16384.f);
tspr.z = globalposz + Blrintf(vec1.y * (16384.f * 0.8f));
}
tspr.picnum = picnum;
tspr.shade = dashade;
tspr.pal = dapalnum;
tspr.owner = uniqid+MAXSPRITES;
// 1 -> 1
// 32 -> 32*16 = 512
// 4 -> 8
tspr.cstat = globalorientation = (dastat&RS_TRANS1) | ((dastat&RS_TRANS2)<<4) | ((dastat&RS_YFLIP)<<1);
if ((dastat&(RS_AUTO|RS_NOCLIP)) == RS_AUTO)
{
GLInterface.SetViewport(windowxy1.x, ydim-(windowxy2.y+1), windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1);
}
else
{
GLInterface.SetViewport(0, 0, xdim, ydim);
}
{
Bmemset(m, 0, sizeof(m));
if ((dastat&(RS_AUTO|RS_NOCLIP)) == RS_AUTO)
{
float f = 1.f;
int32_t fov = hud->fov;
if (fov != -1)
f = 1.f/tanf(((float)fov * 2.56f) * ((.5f * fPI) * (1.0f/2048.f)));
m[0][0] = f*fydimen; m[0][2] = 1.f;
m[1][1] = f*fxdimen; m[1][2] = 1.f;
m[2][2] = 1.f; m[2][3] = fydimen;
m[3][2] =-1.f;
}
else
{
m[0][0] = m[2][3] = 1.f;
m[1][1] = fxdim/fydim;
m[2][2] = 1.0001f;
m[3][2] = 1-m[2][2];
}
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
VSMatrix identity(0);
}
if (hud->flags & HUDFLAG_NODEPTH)
GLInterface.EnableDepthTest(false);
else
{
static int32_t onumframes = 0;
GLInterface.EnableDepthTest(true);
if (onumframes != numframes)
{
onumframes = numframes;
GLInterface.ClearDepth();
}
}
spriteext[tspr.owner].alpha = daalpha * (1.0f / 255.0f);
tspr.blend = dablend;
if (videoGetRenderMode() == REND_POLYMOST)
polymost_mddraw(&tspr);
viewingrange = oldviewingrange;
fviewingrange = oldfviewingrange;
gxyaspect = ogxyaspect;
globalshade = ogshade;
globalpal = ogpal;
}
void polymost_initosdfuncs(void)
{
}