mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 22:01:01 +00:00
Remove unneeded code from HWR_RenderPlane and HWR_RenderPolyObjectPlane
This commit is contained in:
parent
c53fd6de16
commit
2e4fab3f1a
1 changed files with 14 additions and 58 deletions
|
@ -375,9 +375,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
float height; // constant y for all points on the convex flat polygon
|
float height; // constant y for all points on the convex flat polygon
|
||||||
float flatxref, flatyref, anglef = 0.0f;
|
float flatxref, flatyref, anglef = 0.0f;
|
||||||
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
||||||
UINT16 flatflag = 63;
|
|
||||||
|
|
||||||
boolean texflat = false;
|
|
||||||
|
|
||||||
float tempxsow, tempytow;
|
float tempxsow, tempytow;
|
||||||
float scrollx = 0.0f, scrolly = 0.0f;
|
float scrollx = 0.0f, scrolly = 0.0f;
|
||||||
|
@ -432,8 +429,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
if (levelflat->type == LEVELFLAT_FLAT)
|
if (levelflat->type == LEVELFLAT_FLAT)
|
||||||
{
|
{
|
||||||
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
|
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
|
||||||
flatflag = R_GetFlatSize(len) - 1;
|
unsigned flatflag = R_GetFlatSize(len);
|
||||||
fflatwidth = fflatheight = (float)(flatflag + 1);
|
fflatwidth = fflatheight = (float)flatflag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -447,15 +444,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
fflatwidth = levelflat->width;
|
fflatwidth = levelflat->width;
|
||||||
fflatheight = levelflat->height;
|
fflatheight = levelflat->height;
|
||||||
}
|
}
|
||||||
texflat = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // set no texture
|
else // set no texture
|
||||||
HWR_SetCurrentTexture(NULL);
|
HWR_SetCurrentTexture(NULL);
|
||||||
|
|
||||||
// reference point for flat texture coord for each vertex around the polygon
|
// reference point for flat texture coord for each vertex around the polygon
|
||||||
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatwidth);
|
flatxref = 0.0;
|
||||||
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatheight);
|
flatyref = 0.0;
|
||||||
|
|
||||||
// transform
|
// transform
|
||||||
if (FOFsector != NULL)
|
if (FOFsector != NULL)
|
||||||
|
@ -489,29 +485,12 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
anglef = ANG2RAD(InvAngle(angle));
|
||||||
{
|
|
||||||
tempxsow = flatxref;
|
|
||||||
tempytow = flatyref;
|
|
||||||
|
|
||||||
anglef = ANG2RAD(InvAngle(angle));
|
|
||||||
|
|
||||||
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
|
|
||||||
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SETUP3DVERT(vert, vx, vy) {\
|
#define SETUP3DVERT(vert, vx, vy) {\
|
||||||
/* Hurdler: add scrolling texture on floor/ceiling */\
|
/* Hurdler: add scrolling texture on floor/ceiling */\
|
||||||
if (texflat)\
|
vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
|
||||||
{\
|
vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
|
||||||
vert->s = (float)((vx) / fflatwidth) + scrollx;\
|
|
||||||
vert->t = -(float)((vy) / fflatheight) + scrolly;\
|
|
||||||
}\
|
|
||||||
else\
|
|
||||||
{\
|
|
||||||
vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
|
|
||||||
vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
|
|
||||||
}\
|
|
||||||
\
|
\
|
||||||
/* Need to rotate before translate */\
|
/* Need to rotate before translate */\
|
||||||
if (angle) /* Only needs to be done if there's an altered angle */\
|
if (angle) /* Only needs to be done if there's an altered angle */\
|
||||||
|
@ -2664,9 +2643,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||||
float height = FIXED_TO_FLOAT(fixedheight); // constant y for all points on the convex flat polygon
|
float height = FIXED_TO_FLOAT(fixedheight); // constant y for all points on the convex flat polygon
|
||||||
float flatxref, flatyref;
|
float flatxref, flatyref;
|
||||||
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
||||||
UINT16 flatflag = 63;
|
|
||||||
|
|
||||||
boolean texflat = false;
|
|
||||||
|
|
||||||
float scrollx = 0.0f, scrolly = 0.0f;
|
float scrollx = 0.0f, scrolly = 0.0f;
|
||||||
float tempxsow, tempytow, anglef = 0.0f;
|
float tempxsow, tempytow, anglef = 0.0f;
|
||||||
|
@ -2697,8 +2673,8 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||||
if (levelflat->type == LEVELFLAT_FLAT)
|
if (levelflat->type == LEVELFLAT_FLAT)
|
||||||
{
|
{
|
||||||
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
|
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
|
||||||
flatflag = R_GetFlatSize(len) - 1;
|
unsigned flatflag = R_GetFlatSize(len);
|
||||||
fflatwidth = fflatheight = (float)(flatflag + 1);
|
fflatwidth = fflatheight = (float)flatflag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2712,18 +2688,15 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||||
fflatwidth = levelflat->width;
|
fflatwidth = levelflat->width;
|
||||||
fflatheight = levelflat->height;
|
fflatheight = levelflat->height;
|
||||||
}
|
}
|
||||||
texflat = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // set no texture
|
else // set no texture
|
||||||
HWR_SetCurrentTexture(NULL);
|
HWR_SetCurrentTexture(NULL);
|
||||||
|
|
||||||
// reference point for flat texture coord for each vertex around the polygon
|
// reference point for flat texture coord for each vertex around the polygon
|
||||||
flatxref = FIXED_TO_FLOAT(polysector->origVerts[0].x);
|
flatxref = 0.0;
|
||||||
flatyref = FIXED_TO_FLOAT(polysector->origVerts[0].y);
|
flatyref = 0.0;
|
||||||
|
|
||||||
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatwidth);
|
|
||||||
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatheight);
|
|
||||||
|
|
||||||
// transform
|
// transform
|
||||||
v3d = planeVerts;
|
v3d = planeVerts;
|
||||||
|
@ -2759,31 +2732,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
anglef = ANG2RAD(InvAngle(angle));
|
||||||
{
|
|
||||||
tempxsow = flatxref;
|
|
||||||
tempytow = flatyref;
|
|
||||||
|
|
||||||
anglef = ANG2RAD(InvAngle(angle));
|
|
||||||
|
|
||||||
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
|
|
||||||
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
|
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
|
||||||
{
|
{
|
||||||
// Go from the polysector's original vertex locations
|
// Go from the polysector's original vertex locations
|
||||||
// Means the flat is offset based on the original vertex locations
|
// Means the flat is offset based on the original vertex locations
|
||||||
if (texflat)
|
v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
|
||||||
{
|
v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
|
||||||
v3d->s = (float)(FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) + scrollx;
|
|
||||||
v3d->t = -(float)(FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
|
|
||||||
v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Need to rotate before translate
|
// Need to rotate before translate
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
if (angle) // Only needs to be done if there's an altered angle
|
||||||
|
|
Loading…
Reference in a new issue