- removed magic flags added to sector indices in Polymost.

These are better done as separate function arguments.
This commit is contained in:
Christoph Oelckers 2021-11-08 23:40:57 +01:00
parent 6581d9d709
commit f2e344a235
8 changed files with 24 additions and 28 deletions

View file

@ -43,7 +43,7 @@ void renderPrepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang,
int32_t* tposx, int32_t* tposy, fixed_t* tang);
void renderCompleteMirror(void);
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int dacursectnum);
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int dacursectnum, bool fromoutside);
void renderDrawMasks(void);

View file

@ -981,10 +981,8 @@ static int32_t global_cf_shade, global_cf_pal, global_cf_fogpal;
static float (*global_getzofslope_func)(usectorptr_t, float, float);
static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0, float ryp1, float x0, float x1,
float y0, float y1, int32_t sectnum)
float y0, float y1, int32_t sectnum, bool have_floor)
{
int const have_floor = sectnum & MAXSECTORS;
sectnum &= ~MAXSECTORS;
auto const sec = (usectorptr_t)&sector[sectnum];
// comments from floor code:
@ -1622,7 +1620,7 @@ static void polymost_drawalls(int32_t const bunch)
{
int32_t fz = getflorzofslope(sectnum, globalposx, globalposy);
if (globalposz <= fz)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum | MAXSECTORS);
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum, true);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
{
@ -1675,7 +1673,7 @@ static void polymost_drawalls(int32_t const bunch)
{
int32_t cz = getceilzofslope(sectnum, globalposx, globalposy);
if (globalposz >= cz)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum);
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum, false);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
{
@ -3307,7 +3305,7 @@ void renderCompleteMirror(void)
EXTERN_CVAR(Int, gl_fogmode)
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
fixed_t daang, fixed_t dahoriz, int dacursectnum)
fixed_t daang, fixed_t dahoriz, int dacursectnum, bool fromoutside)
{
pm_spritesortcnt = 0;
checkRotatedWalls();
@ -3316,9 +3314,7 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
// Update starting sector number (common to classic and Polymost).
// ADJUST_GLOBALCURSECTNUM.
if (dacursectnum >= MAXSECTORS)
dacursectnum -= MAXSECTORS;
else
if (!fromoutside)
{
int i = dacursectnum;
updatesector(daposx, daposy, &dacursectnum);

View file

@ -162,7 +162,7 @@ RORHACK:
gView->pSprite->cstat |= 514;
}
renderDrawRoomsQ16(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, nSectnum);
renderDrawRoomsQ16(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, nSectnum, false);
viewProcessSprites(pm_tsprite, pm_spritesortcnt, cX, cY, cZ, cA.asbuild(), int(gInterpolate));
bool do_ror_hack = false;
for (int i = 0; i < 16; i++)
@ -254,7 +254,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{
renderPrepareMirror(x, y, z, a, horiz, nWall, &cx, &cy, &ca);
}
int32_t didmirror = renderDrawRoomsQ16(cx, cy, z, ca, horiz, mirrorsector | MAXSECTORS);
int32_t didmirror = renderDrawRoomsQ16(cx, cy, z, ca, horiz, mirrorsector, true);
viewProcessSprites(pm_tsprite, pm_spritesortcnt, cx, cy, z, FixedToInt(ca), smooth);
renderDrawMasks();
if (GetWallType(nWall) != kWallStack)
@ -282,7 +282,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
gPlayer[viewPlayer].pSprite->cstat |= 514;
}
}
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector | MAXSECTORS);
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector, true);
viewProcessSprites(pm_tsprite, pm_spritesortcnt, x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, FixedToInt(a), smooth);
short fstat = sector[nSector].floorstat;
sector[nSector].floorstat |= 1;
@ -314,7 +314,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
gPlayer[viewPlayer].pSprite->cstat |= 514;
}
}
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector | MAXSECTORS);
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector, true);
viewProcessSprites(pm_tsprite, pm_spritesortcnt, x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, FixedToInt(a), smooth);
short cstat = sector[nSector].ceilingstat;
sector[nSector].ceilingstat |= 1;

View file

@ -93,7 +93,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
offx = x - floor1->x;
offy = y - floor1->y;
renderDrawRoomsQ16(floor2->x + offx, floor2->y + offy, z, a.asq16(), h.asq16(), floor2->sectnum);
renderDrawRoomsQ16(floor2->x + offx, floor2->y + offy, z, a.asq16(), h.asq16(), floor2->sectnum, false);
fi.animatesprites(pm_tsprite, pm_spritesortcnt, offx + floor2->x, offy + floor2->y, a.asbuild(), smoothratio);
renderDrawMasks();
@ -183,7 +183,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
int j = g_visibility;
g_visibility = (j >> 1) + (j >> 2);
renderDrawRoomsQ16(tposx, tposy, cposz, tang, choriz.asq16(), mirrorsector[i] + MAXSECTORS);
renderDrawRoomsQ16(tposx, tposy, cposz, tang, choriz.asq16(), mirrorsector[i], true);
display_mirror = 1;
fi.animatesprites(pm_tsprite, pm_spritesortcnt, tposx, tposy, tang, smoothratio);
@ -205,7 +205,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int sect, int smoothratio)
{
int gs, tgsect, geosect, geoid = 0;
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect);
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
renderDrawMasks();
for (gs = 0; gs < geocnt; gs++)
@ -226,7 +226,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
}
cposx -= geox[geoid];
cposy -= geoy[geoid];
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect);
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
cposx += geox[geoid];
cposy += geoy[geoid];
for (gs = 0; gs < geocnt; gs++)
@ -258,7 +258,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
}
cposx -= geox2[geoid];
cposy -= geoy2[geoid];
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect);
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect, false);
cposx += geox2[geoid];
cposy += geoy2[geoid];
for (gs = 0; gs < geocnt; gs++)

View file

@ -76,7 +76,7 @@ void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, bina
se40code(x, y, z, a, h, smoothratio);
renderMirror(x, y, z, a, h, smoothratio);
renderDrawRoomsQ16(x, y, z, a.asq16(), h.asq16(), sectnum);
renderDrawRoomsQ16(x, y, z, a.asq16(), h.asq16(), sectnum, false);
fi.animatesprites(pm_tsprite, pm_spritesortcnt, x, y, a.asbuild(), smoothratio);
renderDrawMasks();
}
@ -120,7 +120,7 @@ void GameInterface::UpdateCameras(double smoothratio)
if (!testnewrenderer)
{
// Note: no ROR or camera here - Polymost has no means to detect these things before rendering the scene itself.
renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sectnum); // why 'shade'...?
renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sectnum, false); // why 'shade'...?
fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->x, camera->y, ang.asbuild(), (int)smoothratio);
renderDrawMasks();
}

View file

@ -366,7 +366,7 @@ void DrawView(double smoothRatio, bool sceneonly)
if (!testnewrenderer)
{
renderSetRollAngle((float)rotscrnang.asbuildf());
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector);
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector, false);
analyzesprites(pm_tsprite, pm_spritesortcnt, nCamerax, nCameray, viewz, smoothRatio);
renderDrawMasks();
}

View file

@ -57,7 +57,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
if (tsectnum < 0)
return;
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
// reset Z's
for (i = 0; i < save.zcount; i++)
@ -82,7 +82,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
if (tsectnum < 0)
return;
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
// reset Z's
for (i = 0; i < save.zcount; i++)
@ -127,7 +127,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short
}
}
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum);
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum, false);
it.Reset(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next())
@ -296,7 +296,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
if (mirror[cnt].campic != -1)
tileDelete(mirror[cnt].campic);
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS);
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum, true);
analyzesprites(pm_tsprite, pm_spritesortcnt, dx, dy, dz, false);
renderDrawMasks();
}
@ -313,7 +313,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
renderPrepareMirror(tx, ty, tz, tpq16ang, tpq16horiz,
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector, true);
analyzesprites(pm_tsprite, pm_spritesortcnt, tposx, tposy, tz, tang >> 16);
renderDrawMasks();

View file

@ -474,7 +474,7 @@ void drawroomstotile(int daposx, int daposy, int daposz,
{
if (!testnewrenderer)
{
renderDrawRoomsQ16(daposx, daposy, daposz, ang.asq16(), horiz.asq16(), dacursectnum);
renderDrawRoomsQ16(daposx, daposy, daposz, ang.asq16(), horiz.asq16(), dacursectnum, false);
analyzesprites(pm_tsprite, pm_spritesortcnt, daposx, daposy, daposz, ang.asbuild());
renderDrawMasks();
}