mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Move some draw segment functions to r_draw_segment
This commit is contained in:
parent
de896920b4
commit
b615b1b497
4 changed files with 31 additions and 44 deletions
|
@ -46,4 +46,33 @@ namespace swrenderer
|
||||||
ds_p = drawsegs;
|
ds_p = drawsegs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptrdiff_t R_NewOpening(ptrdiff_t len)
|
||||||
|
{
|
||||||
|
ptrdiff_t res = lastopening;
|
||||||
|
len = (len + 1) & ~1; // only return DWORD aligned addresses because some code stores fixed_t's and floats in openings...
|
||||||
|
lastopening += len;
|
||||||
|
if ((size_t)lastopening > maxopenings)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
maxopenings = maxopenings ? maxopenings * 2 : 16384;
|
||||||
|
while ((size_t)lastopening > maxopenings);
|
||||||
|
openings = (short *)M_Realloc(openings, maxopenings * sizeof(*openings));
|
||||||
|
DPrintf(DMSG_NOTIFY, "MaxOpenings increased to %zu\n", maxopenings);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_CheckDrawSegs()
|
||||||
|
{
|
||||||
|
if (ds_p == &drawsegs[MaxDrawSegs])
|
||||||
|
{ // [RH] Grab some more drawsegs
|
||||||
|
size_t newdrawsegs = MaxDrawSegs ? MaxDrawSegs * 2 : 32;
|
||||||
|
ptrdiff_t firstofs = firstdrawseg - drawsegs;
|
||||||
|
drawsegs = (drawseg_t *)M_Realloc(drawsegs, newdrawsegs * sizeof(drawseg_t));
|
||||||
|
firstdrawseg = drawsegs + firstofs;
|
||||||
|
ds_p = drawsegs + MaxDrawSegs;
|
||||||
|
MaxDrawSegs = newdrawsegs;
|
||||||
|
DPrintf(DMSG_NOTIFY, "MaxDrawSegs increased to %zu\n", MaxDrawSegs);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,6 @@ namespace swrenderer
|
||||||
extern size_t FirstInterestingDrawseg;
|
extern size_t FirstInterestingDrawseg;
|
||||||
|
|
||||||
void R_ClearDrawSegs();
|
void R_ClearDrawSegs();
|
||||||
|
void R_CheckDrawSegs();
|
||||||
|
ptrdiff_t R_NewOpening(ptrdiff_t len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1542,46 +1542,6 @@ void R_NewWall (bool needlights)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// R_CheckDrawSegs
|
|
||||||
//
|
|
||||||
|
|
||||||
void R_CheckDrawSegs ()
|
|
||||||
{
|
|
||||||
if (ds_p == &drawsegs[MaxDrawSegs])
|
|
||||||
{ // [RH] Grab some more drawsegs
|
|
||||||
size_t newdrawsegs = MaxDrawSegs ? MaxDrawSegs*2 : 32;
|
|
||||||
ptrdiff_t firstofs = firstdrawseg - drawsegs;
|
|
||||||
drawsegs = (drawseg_t *)M_Realloc (drawsegs, newdrawsegs * sizeof(drawseg_t));
|
|
||||||
firstdrawseg = drawsegs + firstofs;
|
|
||||||
ds_p = drawsegs + MaxDrawSegs;
|
|
||||||
MaxDrawSegs = newdrawsegs;
|
|
||||||
DPrintf (DMSG_NOTIFY, "MaxDrawSegs increased to %zu\n", MaxDrawSegs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// R_CheckOpenings
|
|
||||||
//
|
|
||||||
|
|
||||||
ptrdiff_t R_NewOpening (ptrdiff_t len)
|
|
||||||
{
|
|
||||||
ptrdiff_t res = lastopening;
|
|
||||||
len = (len + 1) & ~1; // only return DWORD aligned addresses because some code stores fixed_t's and floats in openings...
|
|
||||||
lastopening += len;
|
|
||||||
if ((size_t)lastopening > maxopenings)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
maxopenings = maxopenings ? maxopenings*2 : 16384;
|
|
||||||
while ((size_t)lastopening > maxopenings);
|
|
||||||
openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings));
|
|
||||||
DPrintf (DMSG_NOTIFY, "MaxOpenings increased to %zu\n", maxopenings);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_StoreWallRange
|
// R_StoreWallRange
|
||||||
// A wall segment will be drawn between start and stop pixels (inclusive).
|
// A wall segment will be drawn between start and stop pixels (inclusive).
|
||||||
|
|
|
@ -45,10 +45,6 @@ inline int R_CreateWallSegmentY(short *outbuf, double z, const FWallCoords *wall
|
||||||
void PrepWall (float *swall, fixed_t *lwall, double walxrepeat, int x1, int x2);
|
void PrepWall (float *swall, fixed_t *lwall, double walxrepeat, int x1, int x2);
|
||||||
void PrepLWall (fixed_t *lwall, double walxrepeat, int x1, int x2);
|
void PrepLWall (fixed_t *lwall, double walxrepeat, int x1, int x2);
|
||||||
|
|
||||||
ptrdiff_t R_NewOpening (ptrdiff_t len);
|
|
||||||
|
|
||||||
void R_CheckDrawSegs ();
|
|
||||||
|
|
||||||
void R_RenderSegLoop ();
|
void R_RenderSegLoop ();
|
||||||
|
|
||||||
extern float swall[MAXWIDTH];
|
extern float swall[MAXWIDTH];
|
||||||
|
|
Loading…
Reference in a new issue