tiny optimizations
This commit is contained in:
1 parent
91883b2718
commit
b57d52d9c5
3 files changed
+73
-46
No files matched your search
+6
-4
@@ -601,11 +601,13 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
||||
//
|
||||
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* localspanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
||||
{
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
// Alam: from r_splats's R_RenderFloorSplat
|
||||
if (t1 >= vid.height) t1 = vid.height-1;
|
||||
if (b1 >= vid.height) b1 = vid.height-1;
|
||||
if (t2 >= vid.height) t2 = vid.height-1;
|
||||
if (b2 >= vid.height) b2 = vid.height-1;
|
||||
if (t1 >= vidheight) t1 = vidheight-1;
|
||||
if (b1 >= vidheight) b1 = vidheight-1;
|
||||
if (t2 >= vidheight) t2 = vidheight-1;
|
||||
if (b2 >= vidheight) b2 = vidheight-1;
|
||||
if (x-1 >= vid.width) x = vid.width;
|
||||
|
||||
// We want to draw N spans per subtask to ensure the work is
|
||||
|
||||
+6
-5
@@ -2238,6 +2238,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
visplane_t *plane;
|
||||
INT32 sintersect;
|
||||
fixed_t scale = 0;
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
// Add the 3D floors, thicksides, and masked textures...
|
||||
for (ds = drawsegs + mask->drawsegs[1]; ds-- > drawsegs + mask->drawsegs[0];)
|
||||
@@ -2257,7 +2258,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
plane = ds->curline->polyseg->visplane;
|
||||
R_PlaneBounds(plane);
|
||||
|
||||
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
|
||||
if (plane->low < 0 || plane->high > vidheight || plane->high > plane->low)
|
||||
;
|
||||
else
|
||||
{
|
||||
@@ -2287,7 +2288,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
plane = ds->ffloorplanes[p];
|
||||
R_PlaneBounds(plane);
|
||||
|
||||
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
|
||||
if (plane->low < 0 || plane->high > vidheight || plane->high > plane->low || plane->polyobj)
|
||||
{
|
||||
ds->ffloorplanes[p] = NULL;
|
||||
continue;
|
||||
@@ -2327,7 +2328,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
plane = PolyObjects[i].visplane;
|
||||
R_PlaneBounds(plane);
|
||||
|
||||
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
|
||||
if (plane->low < 0 || plane->high > vidheight || plane->high > plane->low)
|
||||
{
|
||||
PolyObjects[i].visplane = NULL;
|
||||
continue;
|
||||
@@ -2347,7 +2348,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
|
||||
for (rover = vsprsortedhead.prev; rover != &vsprsortedhead; rover = rover->prev)
|
||||
{
|
||||
if (rover->szt > vid.height || rover->sz < 0)
|
||||
if (rover->szt > vidheight || rover->sz < 0)
|
||||
continue;
|
||||
|
||||
sintersect = (rover->x1 + rover->x2) / 2;
|
||||
@@ -2364,7 +2365,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
|
||||
// Effective height may be different for each comparison in the case of slopes
|
||||
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy, r2->plane->height);
|
||||
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy, r2->plane->height);
|
||||
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy, r2->plane->height);
|
||||
|
||||
if (rover->mobjflags & MF_NOCLIPHEIGHT)
|
||||
{
|
||||
|
||||
+61
-37
@@ -656,10 +656,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
fixed_t pwidth; // patch width
|
||||
fixed_t offx = 0; // x offset
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
if (!patch)
|
||||
if (rendermode == render_none || !patch)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -679,12 +676,18 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
v_translevel = NULL;
|
||||
if (alphalevel || blendmode)
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
switch (alphalevel)
|
||||
{
|
||||
case 13:
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
break;
|
||||
case 14:
|
||||
alphalevel = (10 - hudtrans);
|
||||
break;
|
||||
case 15:
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
break;
|
||||
}
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
@@ -972,10 +975,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
UINT8 *desttop, *dest;
|
||||
const UINT8 *source, *deststop;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
if (!patch)
|
||||
if (rendermode == render_none || !patch)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -991,12 +991,18 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
v_translevel = NULL;
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
switch (alphalevel)
|
||||
{
|
||||
case 13:
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
break;
|
||||
case 14:
|
||||
alphalevel = (10 - hudtrans);
|
||||
break;
|
||||
case 15:
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
break;
|
||||
}
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
@@ -1239,6 +1245,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
else if (!(c & V_SNAPTOTOP))
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
|
||||
if (c & V_SPLITSCREEN)
|
||||
y += (BASEVIDHEIGHT * dupy)/2;
|
||||
if (c & V_HORZSCREEN)
|
||||
@@ -1272,12 +1279,18 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
switch (alphalevel)
|
||||
{
|
||||
case 13:
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
break;
|
||||
case 14:
|
||||
alphalevel = (10 - hudtrans);
|
||||
break;
|
||||
case 15:
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
break;
|
||||
}
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
@@ -1354,7 +1367,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
UINT32 hwcolor = V_GetHWConsBackColor();
|
||||
HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
|
||||
HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1416,12 +1429,18 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
switch (alphalevel)
|
||||
{
|
||||
case 13:
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
break;
|
||||
case 14:
|
||||
alphalevel = (10 - hudtrans);
|
||||
break;
|
||||
case 15:
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
break;
|
||||
}
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
@@ -1429,13 +1448,18 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
c &= 255;
|
||||
|
||||
if (!alphalevel) {
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
if (!alphalevel)
|
||||
{
|
||||
for (v = 0; v < h; v++, dest += vid.width)
|
||||
{
|
||||
for (u = 0; u < w; u++)
|
||||
{
|
||||
dest[u] = consolebgmap[dest[u]];
|
||||
}
|
||||
}
|
||||
} else { // mpc 12-04-2018
|
||||
}
|
||||
else
|
||||
{ // mpc 12-04-2018
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
#define clip(x,y) (x>y) ? y : x
|
||||
w = clip(w,vid.width);
|
||||
|
||||
Reference in new issue
Block a user