mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Use separate table for maskedtexturecol
This commit is contained in:
parent
2ef231c073
commit
97311dc5b0
6 changed files with 365 additions and 379 deletions
|
@ -757,12 +757,12 @@ typedef struct drawseg_s
|
||||||
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
||||||
INT16 *sprtopclip;
|
INT16 *sprtopclip;
|
||||||
INT16 *sprbottomclip;
|
INT16 *sprbottomclip;
|
||||||
INT16 *maskedtexturecol;
|
fixed_t *maskedtexturecol;
|
||||||
|
|
||||||
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
||||||
INT32 numffloorplanes;
|
INT32 numffloorplanes;
|
||||||
struct ffloor_s *thicksides[MAXFFLOORS];
|
struct ffloor_s *thicksides[MAXFFLOORS];
|
||||||
INT16 *thicksidecol;
|
fixed_t *thicksidecol;
|
||||||
INT32 numthicksides;
|
INT32 numthicksides;
|
||||||
fixed_t frontscale[MAXVIDWIDTH];
|
fixed_t frontscale[MAXVIDWIDTH];
|
||||||
|
|
||||||
|
|
|
@ -1479,6 +1479,7 @@ void R_RenderPlayerView(player_t *player)
|
||||||
R_ClearClipSegs();
|
R_ClearClipSegs();
|
||||||
}
|
}
|
||||||
R_ClearDrawSegs();
|
R_ClearDrawSegs();
|
||||||
|
R_ClearSegTables();
|
||||||
R_ClearSprites();
|
R_ClearSprites();
|
||||||
Portal_InitList();
|
Portal_InitList();
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,6 @@ INT32 numffloors;
|
||||||
#define visplane_hash(picnum,lightlevel,height) \
|
#define visplane_hash(picnum,lightlevel,height) \
|
||||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
||||||
|
|
||||||
//SoM: 3/23/2000: Use boom opening limit removal
|
|
||||||
size_t maxopenings;
|
|
||||||
INT16 *openings, *lastopening; /// \todo free leak
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clip values are the solid pixel bounding the range.
|
// Clip values are the solid pixel bounding the range.
|
||||||
// floorclip starts out SCREENHEIGHT
|
// floorclip starts out SCREENHEIGHT
|
||||||
|
@ -366,8 +362,6 @@ void R_ClearPlanes(void)
|
||||||
freehead = &(*freehead)->next;
|
freehead = &(*freehead)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastopening = openings;
|
|
||||||
|
|
||||||
// texture calculation
|
// texture calculation
|
||||||
memset(cachedheight, 0, sizeof (cachedheight));
|
memset(cachedheight, 0, sizeof (cachedheight));
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,6 @@ extern visplane_t *floorplane;
|
||||||
extern visplane_t *ceilingplane;
|
extern visplane_t *ceilingplane;
|
||||||
|
|
||||||
// Visplane related.
|
// Visplane related.
|
||||||
extern INT16 *lastopening, *openings;
|
|
||||||
extern size_t maxopenings;
|
|
||||||
|
|
||||||
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
|
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
|
||||||
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
|
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
|
||||||
extern fixed_t cachedheight[MAXVIDHEIGHT];
|
extern fixed_t cachedheight[MAXVIDHEIGHT];
|
||||||
|
|
209
src/r_segs.c
209
src/r_segs.c
|
@ -71,9 +71,22 @@ static fixed_t topfrac, topstep;
|
||||||
static fixed_t bottomfrac, bottomstep;
|
static fixed_t bottomfrac, bottomstep;
|
||||||
|
|
||||||
static lighttable_t **walllights;
|
static lighttable_t **walllights;
|
||||||
static INT16 *maskedtexturecol;
|
static fixed_t *maskedtexturecol;
|
||||||
static fixed_t *maskedtextureheight = NULL;
|
static fixed_t *maskedtextureheight = NULL;
|
||||||
|
|
||||||
|
//SoM: 3/23/2000: Use boom opening limit removal
|
||||||
|
static size_t numopenings;
|
||||||
|
static INT16 *openings, *lastopening;
|
||||||
|
|
||||||
|
static size_t texturecolumntablesize;
|
||||||
|
static fixed_t *texturecolumntable, *curtexturecolumntable;
|
||||||
|
|
||||||
|
void R_ClearSegTables(void)
|
||||||
|
{
|
||||||
|
lastopening = openings;
|
||||||
|
curtexturecolumntable = texturecolumntable;
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// R_RenderMaskedSegRange
|
// R_RenderMaskedSegRange
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -350,9 +363,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
dc_texturemid += (textureheight[texnum])*times + textureheight[texnum];
|
dc_texturemid += (textureheight[texnum])*times + textureheight[texnum];
|
||||||
else
|
else
|
||||||
dc_texturemid -= (textureheight[texnum])*times;
|
dc_texturemid -= (textureheight[texnum])*times;
|
||||||
// calculate lighting
|
|
||||||
if (maskedtexturecol[dc_x] != INT16_MAX)
|
|
||||||
{
|
|
||||||
// Check for overflows first
|
// Check for overflows first
|
||||||
overflow_test = (INT64)centeryfrac - (((INT64)dc_texturemid*spryscale)>>FRACBITS);
|
overflow_test = (INT64)centeryfrac - (((INT64)dc_texturemid*spryscale)>>FRACBITS);
|
||||||
if (overflow_test < 0) overflow_test = -overflow_test;
|
if (overflow_test < 0) overflow_test = -overflow_test;
|
||||||
|
@ -371,6 +382,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate lighting
|
||||||
if (dc_numlights)
|
if (dc_numlights)
|
||||||
{
|
{
|
||||||
lighttable_t **xwalllights;
|
lighttable_t **xwalllights;
|
||||||
|
@ -382,7 +394,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
|
|
||||||
// draw the texture
|
// draw the texture
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc_x]) - 3);
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc_x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
for (i = 0; i < dc_numlights; i++)
|
for (i = 0; i < dc_numlights; i++)
|
||||||
{
|
{
|
||||||
|
@ -457,63 +469,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
|
|
||||||
// draw the texture
|
// draw the texture
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc_x]) - 3);
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc_x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
#if 0 // Disabling this allows inside edges to render below the planes, for until the clipping is fixed to work right when POs are near the camera. -Red
|
|
||||||
if (curline->dontrenderme && curline->polyseg && (curline->polyseg->flags & POF_RENDERPLANES))
|
|
||||||
{
|
|
||||||
fixed_t my_topscreen;
|
|
||||||
fixed_t my_bottomscreen;
|
|
||||||
fixed_t my_yl, my_yh;
|
|
||||||
|
|
||||||
my_topscreen = sprtopscreen + spryscale*col->topdelta;
|
|
||||||
my_bottomscreen = sprbotscreen == INT32_MAX ? my_topscreen + spryscale*col->length
|
|
||||||
: sprbotscreen + spryscale*col->length;
|
|
||||||
|
|
||||||
my_yl = (my_topscreen+FRACUNIT-1)>>FRACBITS;
|
|
||||||
my_yh = (my_bottomscreen-1)>>FRACBITS;
|
|
||||||
// CONS_Debug(DBG_RENDER, "my_topscreen: %d\nmy_bottomscreen: %d\nmy_yl: %d\nmy_yh: %d\n", my_topscreen, my_bottomscreen, my_yl, my_yh);
|
|
||||||
|
|
||||||
if (numffloors)
|
|
||||||
{
|
|
||||||
INT32 top = my_yl;
|
|
||||||
INT32 bottom = my_yh;
|
|
||||||
|
|
||||||
for (i = 0; i < numffloors; i++)
|
|
||||||
{
|
|
||||||
if (!ffloor[i].polyobj || ffloor[i].polyobj != curline->polyseg)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ffloor[i].height < viewz)
|
|
||||||
{
|
|
||||||
INT32 top_w = ffloor[i].plane->top[dc_x];
|
|
||||||
|
|
||||||
// CONS_Debug(DBG_RENDER, "Leveltime : %d\n", leveltime);
|
|
||||||
// CONS_Debug(DBG_RENDER, "Top is %d, top_w is %d\n", top, top_w);
|
|
||||||
if (top_w < top)
|
|
||||||
{
|
|
||||||
ffloor[i].plane->top[dc_x] = (INT16)top;
|
|
||||||
ffloor[i].plane->picnum = 0;
|
|
||||||
}
|
|
||||||
// CONS_Debug(DBG_RENDER, "top_w is now %d\n", ffloor[i].plane->top[dc_x]);
|
|
||||||
}
|
|
||||||
else if (ffloor[i].height > viewz)
|
|
||||||
{
|
|
||||||
INT32 bottom_w = ffloor[i].plane->bottom[dc_x];
|
|
||||||
|
|
||||||
if (bottom_w > bottom)
|
|
||||||
{
|
|
||||||
ffloor[i].plane->bottom[dc_x] = (INT16)bottom;
|
|
||||||
ffloor[i].plane->picnum = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
colfunc_2s(col);
|
colfunc_2s(col);
|
||||||
}
|
|
||||||
spryscale += rw_scalestep;
|
spryscale += rw_scalestep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -857,16 +815,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
// draw the columns
|
// draw the columns
|
||||||
for (dc_x = x1; dc_x <= x2; dc_x++)
|
for (dc_x = x1; dc_x <= x2; dc_x++)
|
||||||
{
|
{
|
||||||
if (maskedtexturecol[dc_x] != INT16_MAX)
|
// skew FOF walls
|
||||||
|
if (ffloortextureslide)
|
||||||
{
|
{
|
||||||
if (ffloortextureslide) { // skew FOF walls
|
|
||||||
if (oldx != -1)
|
if (oldx != -1)
|
||||||
dc_texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc_x])<<FRACBITS);
|
dc_texturemid += FixedMul(ffloortextureslide, maskedtexturecol[oldx]-maskedtexturecol[dc_x]);
|
||||||
oldx = dc_x;
|
oldx = dc_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate bounds
|
// Calculate bounds
|
||||||
// clamp the values if necessary to avoid overflows and rendering glitches caused by them
|
// clamp the values if necessary to avoid overflows and rendering glitches caused by them
|
||||||
|
|
||||||
if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
|
if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
|
||||||
else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
|
else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
|
||||||
else sprtopscreen = windowtop = CLAMPMIN;
|
else sprtopscreen = windowtop = CLAMPMIN;
|
||||||
|
@ -897,7 +855,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
dc_iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
|
|
||||||
// Get data for the column
|
// Get data for the column
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc_x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
// SoM: New code does not rely on R_DrawColumnShadowed_8 which
|
// SoM: New code does not rely on R_DrawColumnShadowed_8 which
|
||||||
// will (hopefully) put less strain on the stack.
|
// will (hopefully) put less strain on the stack.
|
||||||
|
@ -1034,7 +992,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
colfunc_2s (col);
|
colfunc_2s (col);
|
||||||
spryscale += rw_scalestep;
|
spryscale += rw_scalestep;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
colfunc = colfuncs[BASEDRAWFUNC];
|
colfunc = colfuncs[BASEDRAWFUNC];
|
||||||
|
|
||||||
#undef CLAMPMAX
|
#undef CLAMPMAX
|
||||||
|
@ -1270,7 +1227,7 @@ static void R_RenderSegLoop (void)
|
||||||
}
|
}
|
||||||
oldtexturecolumn = texturecolumn;
|
oldtexturecolumn = texturecolumn;
|
||||||
|
|
||||||
texturecolumn >>= FRACBITS;
|
INT32 itexturecolumn = texturecolumn >> FRACBITS;
|
||||||
|
|
||||||
// texturecolumn and lighting are independent of wall tiers
|
// texturecolumn and lighting are independent of wall tiers
|
||||||
if (segtextured)
|
if (segtextured)
|
||||||
|
@ -1336,7 +1293,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yl = yl;
|
dc_yl = yl;
|
||||||
dc_yh = yh;
|
dc_yh = yh;
|
||||||
dc_texturemid = rw_midtexturemid;
|
dc_texturemid = rw_midtexturemid;
|
||||||
dc_source = R_GetColumn(midtexture,texturecolumn + (rw_offset_mid>>FRACBITS));
|
dc_source = R_GetColumn(midtexture, itexturecolumn + (rw_offset_mid>>FRACBITS));
|
||||||
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
||||||
|
|
||||||
//profile stuff ---------------------------------------------------------
|
//profile stuff ---------------------------------------------------------
|
||||||
|
@ -1397,7 +1354,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yl = yl;
|
dc_yl = yl;
|
||||||
dc_yh = mid;
|
dc_yh = mid;
|
||||||
dc_texturemid = rw_toptexturemid;
|
dc_texturemid = rw_toptexturemid;
|
||||||
dc_source = R_GetColumn(toptexture,texturecolumn + (rw_offset_top>>FRACBITS));
|
dc_source = R_GetColumn(toptexture, itexturecolumn + (rw_offset_top>>FRACBITS));
|
||||||
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
||||||
colfunc();
|
colfunc();
|
||||||
ceilingclip[rw_x] = (INT16)mid;
|
ceilingclip[rw_x] = (INT16)mid;
|
||||||
|
@ -1433,8 +1390,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yl = mid;
|
dc_yl = mid;
|
||||||
dc_yh = yh;
|
dc_yh = yh;
|
||||||
dc_texturemid = rw_bottomtexturemid;
|
dc_texturemid = rw_bottomtexturemid;
|
||||||
dc_source = R_GetColumn(bottomtexture,
|
dc_source = R_GetColumn(bottomtexture, itexturecolumn + (rw_offset_bot>>FRACBITS));
|
||||||
texturecolumn + (rw_offset_bot>>FRACBITS));
|
|
||||||
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
||||||
colfunc();
|
colfunc();
|
||||||
floorclip[rw_x] = (INT16)mid;
|
floorclip[rw_x] = (INT16)mid;
|
||||||
|
@ -1453,7 +1409,7 @@ static void R_RenderSegLoop (void)
|
||||||
{
|
{
|
||||||
// save texturecol
|
// save texturecol
|
||||||
// for backdrawing of masked mid texture
|
// for backdrawing of masked mid texture
|
||||||
maskedtexturecol[rw_x] = (INT16)(texturecolumn + (rw_offset_mid>>FRACBITS));
|
maskedtexturecol[rw_x] = texturecolumn + rw_offset_mid;
|
||||||
|
|
||||||
if (maskedtextureheight != NULL) {
|
if (maskedtextureheight != NULL) {
|
||||||
maskedtextureheight[rw_x] = (curline->linedef->flags & ML_MIDPEG) ?
|
maskedtextureheight[rw_x] = (curline->linedef->flags & ML_MIDPEG) ?
|
||||||
|
@ -1512,6 +1468,67 @@ static INT64 R_CalcSegDist(seg_t* seg, INT64 x2, INT64 y2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SoM: Code to remove limits on openings.
|
||||||
|
static void R_AllocClippingTables(size_t range)
|
||||||
|
{
|
||||||
|
size_t pos = lastopening - openings;
|
||||||
|
size_t need = range * 2; // for both sprtopclip and sprbottomclip
|
||||||
|
|
||||||
|
if (pos + need < numopenings)
|
||||||
|
return;
|
||||||
|
|
||||||
|
INT16 *oldopenings = openings;
|
||||||
|
INT16 *oldlast = lastopening;
|
||||||
|
|
||||||
|
if (numopenings == 0)
|
||||||
|
numopenings = 16384;
|
||||||
|
|
||||||
|
numopenings += need;
|
||||||
|
openings = Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL);
|
||||||
|
lastopening = openings + pos;
|
||||||
|
|
||||||
|
// borrowed fix from *cough* zdoom *cough*
|
||||||
|
// [RH] We also need to adjust the openings pointers that
|
||||||
|
// were already stored in drawsegs.
|
||||||
|
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
|
||||||
|
{
|
||||||
|
// Check if it's in range of the openings
|
||||||
|
if (ds->sprtopclip + ds->x1 >= oldopenings && ds->sprtopclip + ds->x1 <= oldlast)
|
||||||
|
ds->sprtopclip = (ds->sprtopclip - oldopenings) + openings;
|
||||||
|
if (ds->sprbottomclip + ds->x1 >= oldopenings && ds->sprbottomclip + ds->x1 <= oldlast)
|
||||||
|
ds->sprbottomclip = (ds->sprbottomclip - oldopenings) + openings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_AllocTextureColumnTables(size_t range)
|
||||||
|
{
|
||||||
|
size_t pos = curtexturecolumntable - texturecolumntable;
|
||||||
|
|
||||||
|
// For both tables, we reserve exactly an amount of memory that's equivalent to
|
||||||
|
// how many columns the seg will take on the entire screen (think about it)
|
||||||
|
if (pos + range < texturecolumntablesize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fixed_t *oldtable = texturecolumntable;
|
||||||
|
fixed_t *oldlast = curtexturecolumntable;
|
||||||
|
|
||||||
|
if (texturecolumntablesize == 0)
|
||||||
|
texturecolumntablesize = 16384;
|
||||||
|
|
||||||
|
texturecolumntablesize += range;
|
||||||
|
texturecolumntable = Z_Realloc(texturecolumntable, texturecolumntablesize * sizeof (*texturecolumntable), PU_STATIC, NULL);
|
||||||
|
curtexturecolumntable = texturecolumntable + pos;
|
||||||
|
|
||||||
|
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
|
||||||
|
{
|
||||||
|
// Check if it's in range of the tables
|
||||||
|
if (ds->maskedtexturecol + ds->x1 >= oldtable && ds->maskedtexturecol + ds->x1 <= oldlast)
|
||||||
|
ds->maskedtexturecol = (ds->maskedtexturecol - oldtable) + texturecolumntable;
|
||||||
|
if (ds->thicksidecol + ds->x1 >= oldtable && ds->thicksidecol + ds->x1 <= oldlast)
|
||||||
|
ds->thicksidecol = (ds->thicksidecol - oldtable) + texturecolumntable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_StoreWallRange
|
// R_StoreWallRange
|
||||||
// A wall segment will be drawn
|
// A wall segment will be drawn
|
||||||
|
@ -1580,37 +1597,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ds_p->curline = curline;
|
ds_p->curline = curline;
|
||||||
rw_stopx = stop+1;
|
rw_stopx = stop+1;
|
||||||
|
|
||||||
//SoM: Code to remove limits on openings.
|
|
||||||
{
|
|
||||||
size_t pos = lastopening - openings;
|
|
||||||
size_t need = (rw_stopx - start)*4 + pos;
|
|
||||||
if (need > maxopenings)
|
|
||||||
{
|
|
||||||
drawseg_t *ds; //needed for fix from *cough* zdoom *cough*
|
|
||||||
INT16 *oldopenings = openings;
|
|
||||||
INT16 *oldlast = lastopening;
|
|
||||||
|
|
||||||
do
|
|
||||||
maxopenings = maxopenings ? maxopenings*2 : 16384;
|
|
||||||
while (need > maxopenings);
|
|
||||||
openings = Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL);
|
|
||||||
lastopening = openings + pos;
|
|
||||||
|
|
||||||
// borrowed fix from *cough* zdoom *cough*
|
|
||||||
// [RH] We also need to adjust the openings pointers that
|
|
||||||
// were already stored in drawsegs.
|
|
||||||
for (ds = drawsegs; ds < ds_p; ds++)
|
|
||||||
{
|
|
||||||
#define ADJUST(p) if (ds->p + ds->x1 >= oldopenings && ds->p + ds->x1 <= oldlast) ds->p = ds->p - oldopenings + openings;
|
|
||||||
ADJUST(maskedtexturecol);
|
|
||||||
ADJUST(sprtopclip);
|
|
||||||
ADJUST(sprbottomclip);
|
|
||||||
ADJUST(thicksidecol);
|
|
||||||
#undef ADJUST
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end of code to remove limits on openings
|
|
||||||
|
|
||||||
// calculate scale at both ends and step
|
// calculate scale at both ends and step
|
||||||
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
||||||
|
|
||||||
|
@ -2026,6 +2012,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
rw_toptexturemid += sidedef->rowoffset + sidedef->offsety_top;
|
rw_toptexturemid += sidedef->rowoffset + sidedef->offsety_top;
|
||||||
rw_bottomtexturemid += sidedef->rowoffset + sidedef->offsety_bot;
|
rw_bottomtexturemid += sidedef->rowoffset + sidedef->offsety_bot;
|
||||||
|
|
||||||
|
R_AllocTextureColumnTables(rw_stopx - start);
|
||||||
|
|
||||||
// allocate space for masked texture tables
|
// allocate space for masked texture tables
|
||||||
if (frontsector && backsector && !Tag_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
if (frontsector && backsector && !Tag_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
||||||
{
|
{
|
||||||
|
@ -2040,8 +2028,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
//markceiling = markfloor = true;
|
//markceiling = markfloor = true;
|
||||||
maskedtexture = true;
|
maskedtexture = true;
|
||||||
|
|
||||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->thicksidecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
|
|
||||||
lowcut = max(worldbottom, worldlow) + viewz;
|
lowcut = max(worldbottom, worldlow) + viewz;
|
||||||
highcut = min(worldtop, worldhigh) + viewz;
|
highcut = min(worldtop, worldhigh) + viewz;
|
||||||
|
@ -2224,8 +2212,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
// masked midtexture
|
// masked midtexture
|
||||||
if (!ds_p->thicksidecol)
|
if (!ds_p->thicksidecol)
|
||||||
{
|
{
|
||||||
ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->maskedtexturecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
||||||
|
@ -2737,6 +2725,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ds_p->portalpass = 0;
|
ds_p->portalpass = 0;
|
||||||
|
|
||||||
// save sprite clipping info
|
// save sprite clipping info
|
||||||
|
if (maskedtexture || (ds_p->silhouette & (SIL_TOP | SIL_BOTTOM)))
|
||||||
|
{
|
||||||
|
R_AllocClippingTables(rw_stopx - start);
|
||||||
|
|
||||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||||
{
|
{
|
||||||
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||||
|
@ -2750,6 +2742,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ds_p->sprbottomclip = lastopening - start;
|
ds_p->sprbottomclip = lastopening - start;
|
||||||
lastopening += rw_stopx - start;
|
lastopening += rw_stopx - start;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (maskedtexture && !(ds_p->silhouette & SIL_TOP))
|
if (maskedtexture && !(ds_p->silhouette & SIL_TOP))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,5 +22,6 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha);
|
||||||
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
||||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
||||||
void R_StoreWallRange(INT32 start, INT32 stop);
|
void R_StoreWallRange(INT32 start, INT32 stop);
|
||||||
|
void R_ClearSegTables(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue