Merge branch 'Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2024-10-25 03:28:50 +02:00
commit e9cfff8165
10 files changed
+236 -237

No files matched your search

-2
View File
@@ -101,7 +101,6 @@ UINT8 window_notinfocus = false;
// DEMO LOOP
//
//static INT32 demosequence;
static const char *pagename = "MAP1PIC";
static char *startupwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
@@ -2076,7 +2075,6 @@ void D_SRB2Main(void)
if (dedicated && server)
{
pagename = "TITLESKY";
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false, false))
-1
View File
@@ -32,7 +32,6 @@ typedef struct gr_vissprite_s
float scale;
float spritexscale, spriteyscale;
float spritexoffset, spriteyoffset;
UINT32 renderflags;
GLPatch_t *gpatch;
boolean flip;
UINT8 translucency; //alpha level 0-255
+168 -182
View File
@@ -106,8 +106,6 @@ consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL
consvar_t cv_grframebuffer = {"gr_framebuffer", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, CV_grframebuffer_OnChange, 0, NULL, NULL, 0, 0, NULL};
#endif
consvar_t cv_splitwallfix = {"splitwallfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t grrenderdistance_cons_t[] = {
{0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"},
{6, "12288"}, {7, "16384"}, {0, NULL}};
@@ -297,6 +295,8 @@ ps_metric_t ps_hw_numcolors = {0};
ps_metric_t ps_hw_batchsorttime = {0};
ps_metric_t ps_hw_batchdrawtime = {0};
static void HWR_AddSprites(sector_t *sec);
static void HWR_ProjectSprite(mobj_t *thing);
static void HWR_AddPrecipitationSprites(void);
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
@@ -679,7 +679,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
// no convex poly were generated for this subsector
if (!xsub->planepoly)
return;
pv = xsub->planepoly->pts;
nrPlaneVerts = xsub->planepoly->numpts;
@@ -838,14 +838,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
PolyFlags |= PF_Masked|PF_Modulated;
if (HWR_UseShader())
{
{
if (PolyFlags & PF_Fog)
shader = SHADER_FOG;
else if (cv_ripplewater.value && (PolyFlags & PF_Ripple))
shader = SHADER_WATER;
else
shader = SHADER_FLOOR;
PolyFlags |= PF_ColorMapped;
}
@@ -950,7 +950,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
fixed_t i;
// seg bbox
fixed_t segbbox[4];
INT32 shader = SHADER_NONE;
M_ClearBox(segbbox);
@@ -1005,7 +1005,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
if (HWR_UseShader())
shader = SHADER_WALL;
HWR_ProcessPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal, shader, false);
}
}
@@ -1038,7 +1038,7 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf)
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap)
{
INT32 shader = SHADER_NONE;
HWR_Lighting(pSurf, lightlevel, wallcolormap);
if (HWR_UseShader())
@@ -1077,6 +1077,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
float endpegt, endpegb, endpegmul;
float endheight = 0.0f, endbheight = 0.0f;
float diff;
fixed_t v1x = FloatToFixed(wallVerts[0].x);
fixed_t v1y = FloatToFixed(wallVerts[0].z);
fixed_t v2x = FloatToFixed(wallVerts[1].x);
@@ -1088,32 +1090,36 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
realtop = top = wallVerts[3].y;
realbot = bot = wallVerts[0].y;
diff = top - bot;
pegt = wallVerts[3].t;
pegb = wallVerts[0].t;
// Lactozilla: If both heights of a side lay on the same position, then this wall is a triangle.
// To avoid division by zero, which would result in a NaN, we check if the vertical difference
// between the two vertices is not zero.
if (fpclassify(top - bot) == FP_ZERO && cv_splitwallfix.value)
if (fpclassify(diff) == FP_ZERO)
pegmul = 0.0;
else
pegmul = (pegb - pegt) / (top - bot);
pegmul = (pegb - pegt) / diff;
endrealtop = endtop = wallVerts[2].y;
endrealbot = endbot = wallVerts[1].y;
diff = endtop - endbot;
endpegt = wallVerts[2].t;
endpegb = wallVerts[1].t;
if (fpclassify(endtop - endbot) == FP_ZERO && cv_splitwallfix.value)
if (fpclassify(diff) == FP_ZERO)
endpegmul = 0.0;
else
endpegmul = (endpegb - endpegt) / (endtop - endbot);
endpegmul = (endpegb - endpegt) / diff;
for (INT32 i = 0; i < sector->numlights; i++)
{
if (endtop < endrealbot && top < realbot)
return;
lightlist_t *list = sector->lightlist;
if (!(list[i].flags & FF_NOSHADE))
@@ -1176,14 +1182,11 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
bheight = realbot;
endbheight = endrealbot;
}
if (cv_splitwallfix.value)
{
if (endbheight > endtop)
endbot = endtop;
}
if ((endbheight >= endtop && bheight >= top && !cv_splitwallfix.value) || (bheight >= top && cv_splitwallfix.value))
if (endbheight > endtop)
endbot = endtop;
if (bheight >= top)
continue;
// Found a break
@@ -1193,15 +1196,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
if (bot < realbot)
bot = realbot;
if (cv_splitwallfix.value)
endbot = min(max(endbheight, endrealbot), endtop);
else
{
endbot = endbheight;
if (endbot < endrealbot)
endbot = endrealbot;
}
endbot = min(max(endbheight, endrealbot), endtop);
Surf->PolyColor.s.alpha = alpha;
@@ -1429,19 +1424,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
fixed_t worldhighslope = 0, worldlowslope = 0;
fixed_t v1x, v1y, v2x, v2y;
float cliplow = 0.0f, cliphigh = 0.0f;
fixed_t h, l; // 3D sides and 2s middle textures
fixed_t hS, lS;
FUINT lightnum = 0; // shut up compiler
extracolormap_t *colormap;
FSurfaceInfo Surf;
boolean noencore = false;
gr_sidedef = gr_curline->sidedef;
gr_linedef = gr_curline->linedef;
const boolean noencore = (gr_linedef->flags & ML_TFERLINE);
if (gr_curline->pv1)
{
vs.x = ((polyvertex_t *)gr_curline->pv1)->x;
@@ -1492,18 +1482,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// x offset the texture
fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset;
cliplow = (float)texturehpeg;
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
float cliplow = (float)texturehpeg;
float cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
lightnum = gr_frontsector->lightlevel;
colormap = gr_frontsector->extra_colormap;
FUINT lightnum = gr_frontsector->lightlevel;
extracolormap_t *colormap = gr_frontsector->extra_colormap;
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gr_curline);
if (gr_linedef->flags & ML_TFERLINE)
noencore = true;
FSurfaceInfo Surf;
Surf.PolyColor.s.alpha = 255;
INT32 gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture);
GLMapTexture_t *grTex = NULL;
@@ -1512,6 +1500,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
INT32 gr_toptexture = 0, gr_bottomtexture = 0;
fixed_t texturevpeg;
SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight)
@@ -1527,8 +1517,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
// Both front and back sectors are sky, needs skywall from the frontsector's ceiling, but only if the
// backsector is lower
if ((worldhigh <= worldtop && worldhighslope <= worldtopslope)// Assuming ESLOPE is always on with my changes
&& (worldhigh != worldtop || worldhighslope != worldtopslope))
if ((worldhigh <= worldtop && worldhighslope <= worldtopslope) // Assuming ESLOPE is always on with my changes
&& (worldhigh != worldtop || worldhighslope != worldtopslope))
// Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race
{
wallVerts[0].y = FIXED_TO_FLOAT(worldhigh);
@@ -1604,51 +1594,47 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// check TOP TEXTURE
if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gr_toptexture)
{
// PEGGING
if (gr_linedef->flags & ML_DONTPEGTOP)
texturevpeg = 0;
else if (gr_linedef->flags & ML_EFFECT1)
texturevpeg = worldhigh + textureheight[gr_toptexture] - worldtop;
else
texturevpeg = gr_backsector->ceilingheight + textureheight[gr_toptexture] - gr_frontsector->ceilingheight;
texturevpeg += gr_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpeg %= textureheight[gr_toptexture];
grTex = HWR_GetTexture(gr_toptexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
fixed_t texturevpegtop; // top
grTex = HWR_GetTexture(gr_toptexture, gr_linedef->flags & ML_TFERLINE);
// PEGGING
if (gr_linedef->flags & ML_DONTPEGTOP)
texturevpegtop = 0;
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop;
else
texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight;
texturevpegtop += gr_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpegtop %= SHORT(textures[gr_toptexture]->height)<<FRACBITS;
wallVerts[3].t = wallVerts[2].t = texturevpegtop * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY;
}
else if (gr_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY;
wallVerts[1].t = (texturevpegtop + worldtopslope - worldhighslope) * grTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * grTex->scaleY;
}
// Unskewed
wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY;
}
else if (gr_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpeg + worldtop - worldhigh) * grTex->scaleY;
wallVerts[1].t = (texturevpeg + worldtopslope - worldhighslope) * grTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldhigh) * grTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * grTex->scaleY;
}
// set top/bottom coords
@@ -1658,35 +1644,33 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope);
if (!gl_drawing_stencil && gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0);
HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0);
else if (!gl_drawing_stencil && grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap);
HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, noencore, PF_Environment, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
// check BOTTOM TEXTURE
if ((worldlowslope > worldbottomslope || worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
if ((worldlowslope > worldbottomslope || worldlow > worldbottom) && gr_bottomtexture)
{
fixed_t texturevpegbottom = 0; // bottom
grTex = HWR_GetTexture(gr_bottomtexture, gr_linedef->flags & ML_TFERLINE);
// PEGGING
if (!(gr_linedef->flags & ML_DONTPEGBOTTOM))
texturevpegbottom = 0;
texturevpeg = 0;
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegbottom = worldbottom - worldlow;
texturevpeg = worldbottom - worldlow;
else
texturevpegbottom = gr_frontsector->floorheight - gr_backsector->floorheight;
texturevpeg = gr_frontsector->floorheight - gr_backsector->floorheight;
texturevpegbottom += gr_sidedef->rowoffset;
texturevpeg += gr_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpegbottom %= SHORT(textures[gr_bottomtexture]->height)<<FRACBITS;
texturevpeg %= textureheight[gr_bottomtexture];
wallVerts[3].t = wallVerts[2].t = texturevpegbottom * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY;
grTex = HWR_GetTexture(gr_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
@@ -1702,15 +1686,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (gr_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
//wallVerts[3].t = wallVerts[0].t - (worldlow - worldbottom) * grTex->scaleY; // no need, [3] is already this
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldlow - worldbottom) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * grTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY;
wallVerts[0].t = (texturevpeg + worldlow - worldbottom) * grTex->scaleY;
wallVerts[1].t = (texturevpeg + worldlowslope - worldbottomslope) * grTex->scaleY;
}
// set top/bottom coords
@@ -1720,9 +1703,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
if (!gl_drawing_stencil && gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0);
HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0);
else if (!gl_drawing_stencil && grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap);
HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, noencore, PF_Environment, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
@@ -1758,23 +1741,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
low = back->floorheight;
repeats = (high - low)/textureheight[gr_sidedef->midtexture];
if ((high-low)%textureheight[gr_sidedef->midtexture])
repeats = (high - low) / textureheight[gr_midtexture];
if ((high - low) % textureheight[gr_midtexture])
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
}
else
repeats = 1;
fixed_t midtexheight = textureheight[gr_midtexture] * repeats;
fixed_t popentop, popenbottom, polytop, polybottom, lowcut, highcut;
fixed_t popentopslope, popenbottomslope, polytopslope, polybottomslope, lowcutslope, highcutslope;
// SoM: a little note: This code re-arranging will
// fix the bug in Nimrod map02. popentop and popenbottom
// record the limits the texture can be displayed in.
// polytop and polybottom, are the ideal (i.e. unclipped)
// heights of the polygon, and h & l, are the final (clipped)
// poly coords.
fixed_t popentop, popenbottom, polytop, polybottom, lowcut, highcut;
fixed_t popentopslope, popenbottomslope, polytopslope, polybottomslope, lowcutslope, highcutslope;
// NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to,
// you must use the linedef's backsector to be correct
@@ -1788,39 +1769,40 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
popentop = min(worldtop, worldhigh);
popenbottom = max(worldbottom, worldlow);
popentopslope = min(worldtopslope, worldhighslope);
popenbottomslope = max(worldbottomslope, worldlowslope);
}
// Find the wall's coordinates
fixed_t midtexheight = textureheight[gr_midtexture] * repeats;
if (gr_linedef->flags & ML_EFFECT2)
{
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) // Peg it to the floor
{
polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset;
polybottomslope = polybottom;
polytop = polybottom + midtexheight;
polytopslope = polytop;
}
else
else // Peg it to the ceiling
{
polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset;
polytopslope = polytop;
polybottom = polytop - midtexheight;
polybottomslope = polybottom;
}
// The right side's coordinates are the the same as the left side
polytopslope = polytop;
polybottomslope = polybottom;
}
else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) // Skew the texture, but peg it to the floor
{
polybottom = popenbottom + gr_sidedef->rowoffset;
polytop = polybottom + midtexheight;
polybottomslope = popenbottomslope + gr_sidedef->rowoffset;
polytopslope = polybottomslope + midtexheight;
}
else
else // Skew it according to the ceiling's slope
{
polytop = popentop + gr_sidedef->rowoffset;
polybottom = polytop - textureheight[gr_midtexture]*repeats;
polybottom = polytop - midtexheight;
polytopslope = popentopslope + gr_sidedef->rowoffset;
polybottomslope = polytopslope - midtexheight;
@@ -1851,9 +1833,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
lS = max(polybottomslope, lowcutslope);
// PEGGING
fixed_t texturevpeg, texturevpegslope;
grTex = HWR_GetTexture(gr_midtexture, gr_linedef->flags & ML_TFERLINE);
fixed_t texturevpegslope;
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
{
@@ -1866,11 +1846,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
texturevpegslope = polytopslope - hS;
}
grTex = HWR_GetTexture(gr_midtexture, noencore);
// Left side
wallVerts[3].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
// Right side
wallVerts[2].t = texturevpegslope * grTex->scaleY;
wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
// set top/bottom coords
@@ -1889,9 +1874,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
blendmode |= PF_Decal;
if (!gl_drawing_stencil && gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, gr_linedef->flags & ML_TFERLINE, &Surf, (!(blendmode & PF_Masked)) ? FF_TRANSLUCENT : FF_CUTLEVEL, NULL, PF_Decal);
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, noencore, &Surf, (!(blendmode & PF_Masked)) ? FF_TRANSLUCENT : FF_CUTLEVEL, NULL, PF_Decal);
else if (!gl_drawing_stencil && !(blendmode & PF_Masked))
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, gr_linedef->flags & ML_TFERLINE, blendmode, false, lightnum, colormap);
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
}
@@ -1911,7 +1896,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
texturevpeg = gr_sidedef->rowoffset; // top of texture at top
grTex = HWR_GetTexture(gr_midtexture, gr_linedef->flags & ML_TFERLINE);
grTex = HWR_GetTexture(gr_midtexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_frontsector->floorheight) * grTex->scaleY;
@@ -1944,11 +1929,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0);
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0);
else // I don't think that solid walls can use translucent linedef types...
{
if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap);
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, noencore, PF_Environment, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
@@ -1965,22 +1950,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
HWR_DrawSkyWall(wallVerts, &Surf);
}
// Single sided lines are simple for skywalls, just need to draw from the top or bottom of the sector if there's
// a sky flat
if (!gr_curline->polyseg)
{
if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
{
wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(INT32_MAX);
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space
wallVerts[0].y = FIXED_TO_FLOAT(worldtop);
wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope);
HWR_DrawSkyWall(wallVerts, &Surf);
}
if (gr_frontsector->floorpic == skyflatnum)
{
wallVerts[3].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space
HWR_DrawSkyWall(wallVerts, &Surf);
}
@@ -1988,7 +1972,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
//Hurdler: 3d-floors test
if (!gl_drawing_stencil && gr_frontsector && gr_backsector && gr_frontsector->tag != gr_backsector->tag && (gr_backsector->ffloors || gr_frontsector->ffloors))
if (!gl_drawing_stencil && gr_backsector && gr_frontsector->tag != gr_backsector->tag && (gr_backsector->ffloors || gr_frontsector->ffloors))
{
ffloor_t * rover;
fixed_t highcut = 0, lowcut = 0;
@@ -2120,9 +2104,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
lightnum = rover->master->frontsector->lightlevel;
colormap = rover->master->frontsector->extra_colormap;
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gr_curline);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(lightnum, colormap);
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gr_curline);
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
@@ -2144,7 +2129,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
{
if (blendmode != PF_Masked)
HWR_AddTransparentWall(wallVerts, &Surf, texnum, gr_linedef->flags & ML_TFERLINE, blendmode, false, lightnum, colormap);
HWR_AddTransparentWall(wallVerts, &Surf, texnum, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
@@ -2190,7 +2175,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
l = lowcut;
lS = lowcutslope;
}
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
@@ -2234,9 +2219,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
lightnum = rover->master->frontsector->lightlevel;
colormap = rover->master->frontsector->extra_colormap;
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gr_curline);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(lightnum, colormap);
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gr_curline);
if (gr_backsector->numlights)
HWR_SplitWall(gr_backsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
@@ -2288,7 +2274,7 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
if (gr_curline->pv1)
{
v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x);
@@ -2309,7 +2295,7 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
v2x = gr_curline->v2->x;
v2y = gr_curline->v2->y;
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, v1x, v1y); \
@@ -2680,7 +2666,7 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
INT32 shader = SHADER_NONE;
nrPlaneVerts = polysector->numVertices;
@@ -2826,11 +2812,11 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
blendmode |= PF_Masked|PF_Modulated;
if (HWR_UseShader())
{
{
shader = SHADER_FLOOR;
blendmode |= PF_ColorMapped;
}
HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, shader, false);
}
@@ -3092,7 +3078,7 @@ static void HWR_Subsector(size_t num)
continue;
if (sub->validcount == validcount)
continue;
// rendering heights for bottom and top planes
// yes there were functions for this stuff, no idea why it wasnt used but bleh
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
@@ -3325,7 +3311,7 @@ static void HWR_RenderBSPNode(INT32 bspnum)
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
side = R_PointOnSideRender(viewx, viewy, bsp);
// Recursively divide front space.
if (HWR_PortalCheckBBox(bsp->bbox[side]))
@@ -3811,7 +3797,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
}
alpha = Surf.PolyColor.s.alpha;
// Start with the lightlevel and colormap from the top of the sprite
lightlevel = *list[sector->numlights - 1].lightlevel;
@@ -3951,7 +3937,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
FBITFIELD blend = 0;
INT32 shader = SHADER_NONE;
if (!spr->mobj)
@@ -4484,7 +4470,7 @@ static void HWR_RenderDrawNodes(void)
wall->lightlevel, wall->wallcolormap);
}
}
PS_STOP_TIMING(ps_hw_nodedrawtime);
numdrawnodes = 0;
@@ -4496,9 +4482,10 @@ static void HWR_RenderDrawNodes(void)
// --------------------------------------------------------------------------
// Draw all vissprites
// --------------------------------------------------------------------------
void HWR_DrawSprites(void)
static void HWR_DrawSprites(void)
{
UINT32 i;
for (i = 0; i < gr_visspritecount; i++)
{
gr_vissprite_t *spr = gr_vsprorder[i];
@@ -4542,7 +4529,7 @@ void HWR_DrawSprites(void)
// HWR_AddSprites
// During BSP traversal, this adds sprites by sector.
// --------------------------------------------------------------------------
void HWR_AddSprites(sector_t *sec)
static void HWR_AddSprites(sector_t *sec)
{
mobj_t *thing;
fixed_t limit_dist;
@@ -4595,7 +4582,7 @@ static void HWR_AddPrecipitationSprites(void)
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th;
if (current_bsp_culling_distance)
drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * precipscale);
else
@@ -4629,7 +4616,7 @@ static void HWR_AddPrecipitationSprites(void)
// Generates a vissprite for a thing if it might be visible.
// --------------------------------------------------------------------------
// BP why not use xtoviexangle/viewangletox like in bsp ?....
void HWR_ProjectSprite(mobj_t *thing)
static void HWR_ProjectSprite(mobj_t *thing)
{
gr_vissprite_t *vis;
float tr_x, tr_y;
@@ -4666,12 +4653,12 @@ void HWR_ProjectSprite(mobj_t *thing)
angle_t sliptiderollangle = 0;
#endif
// uncapped/interpolation
interpmobjstate_t interp = {0};
if (!thing)
return;
// uncapped/interpolation
interpmobjstate_t interp = {0};
vflip = (thing->eflags & MFE_VERTICALFLIP);
mirrored = thing->mirrored;
hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
@@ -4776,9 +4763,9 @@ void HWR_ProjectSprite(mobj_t *thing)
else
{
// choose a different rotation based on player view
if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
rot = 6; // F7 slot
else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
rot = 2; // F3 slot
else // Normal behaviour
rot = (ang+ANGLE_202h)>>29;
@@ -4802,9 +4789,9 @@ void HWR_ProjectSprite(mobj_t *thing)
#ifdef ROTSPRITE
if (cv_spriteroll.value)
{
rollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll)
rollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll)
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch)
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll)
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll)
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch)
+ thing->rollangle;
@@ -4828,7 +4815,7 @@ void HWR_ProjectSprite(mobj_t *thing)
spr_offset = SHORT(rotsprite->leftoffset) << FRACBITS;
spr_topoffset = SHORT(rotsprite->topoffset) << FRACBITS;
spr_topoffset += FEETADJUST;
// flip -> rotate, not rotate -> flip
flip = 0;
}
@@ -4852,7 +4839,7 @@ void HWR_ProjectSprite(mobj_t *thing)
spritexscale *= this_scale;
spriteyscale *= this_scale;
flip = !flip != !hflip;
if (flip)
@@ -4897,13 +4884,12 @@ void HWR_ProjectSprite(mobj_t *thing)
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{
if (gr_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ?
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) :
gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight))
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) :
gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight))
return;
if (gr_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ?
gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gr_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) :
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight))
gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gr_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) :
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight))
return;
}
@@ -4913,7 +4899,9 @@ void HWR_ProjectSprite(mobj_t *thing)
vis->x2 = x2;
vis->z1 = z1;
vis->z2 = z2;
vis->tz = tz; // Keep tz for the simple sprite sorting that happens
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->flip = flip;
@@ -5415,7 +5403,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
}
else
portalclipline = NULL;
// Set transform.
HWD.pfnSetTransform(&atransform);
@@ -5465,7 +5453,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
HWR_SetTransform(fpov, player);// restore transform
}
gr_collect_skywalls = false;
ps_numsprites.value.i = gr_visspritecount;
PS_START_TIMING(ps_hw_spritesorttime);
HWR_SortVisSprites();
@@ -5689,8 +5677,6 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_grbatching);
CV_RegisterVar(&cv_splitwallfix);
CV_RegisterVar(&cv_grrenderdistance);
CV_RegisterVar(&cv_grfakecontrast);
@@ -5737,7 +5723,7 @@ void HWR_Startup(void)
{
CONS_Printf("HWR_Startup()...\n");
textureformat = patchformat = GL_TEXFMT_RGBA;
HWR_InitTextureCache();
HWR_InitMD2();
@@ -5776,7 +5762,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
{
FBITFIELD blendmode = blend;
UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
INT32 shader = SHADER_NONE;
// Lighting is done here instead so that fog isn't drawn incorrectly on transparent walls after sorting
@@ -5796,10 +5782,10 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
blendmode |= PF_ColorMapped;
}
if (fogwall)
blendmode |= PF_Fog;
blendmode |= PF_Modulated; // No PF_Occlude means overlapping (incorrect) transparency
HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode, shader, false);
-7
View File
@@ -131,12 +131,6 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 t
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
// hw_main.c: Sprites
void HWR_AddSprites(sector_t *sec);
void HWR_ProjectSprite(mobj_t *thing);
//void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
void HWR_DrawSprites(void);
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gr_maphasportals;
@@ -152,7 +146,6 @@ extern consvar_t cv_grshaders;
#ifdef USE_FBO_OGL
extern consvar_t cv_grframebuffer;
#endif
extern consvar_t cv_splitwallfix;
extern consvar_t cv_grshearing;
extern consvar_t cv_grfov;
extern consvar_t cv_grmdls;
-5
View File
@@ -1498,8 +1498,6 @@ static menuitem_t OP_ExpOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 110},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 130},
{IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 150},
#endif
};
@@ -1517,7 +1515,6 @@ static const char* OP_ExpTooltips[] =
"Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.",
#endif
"Change the depth of the Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
"Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.",
#endif
};
@@ -1535,7 +1532,6 @@ enum
op_exp_fbo,
#endif
op_exp_paldepth,
op_exp_spltwal,
#endif
};
@@ -4695,7 +4691,6 @@ void M_Init(void)
#ifdef USE_FBO_OGL
OP_ExpOptionsMenu[op_exp_fbo].status = IT_DISABLED;
#endif
OP_ExpOptionsMenu[op_exp_spltwal].status = IT_DISABLED;
}
if (rendermode == render_opengl)
+41 -17
View File
@@ -9958,10 +9958,13 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
if (mobj->floorz != starting_floorz)
mobj->precipflags |= PCF_FOF;
else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7
|| GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6
|| mobj->subsector->sector->floorpic == skyflatnum)
mobj->precipflags |= PCF_PIT;
else
{
INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1);
if (special == 7 || special == 6 || mobj->subsector->sector->floorpic == skyflatnum)
mobj->precipflags |= PCF_PIT;
}
R_ResetPrecipitationMobjInterpolationState(mobj);
@@ -10255,7 +10258,7 @@ void P_PrecipitationEffects(void)
INT32 volume;
size_t i;
boolean sounds_rain = true;
boolean rainsfx = true;
boolean sounds_thunder = true;
boolean effects_lightning = true;
boolean lightningStrike = false;
@@ -10288,7 +10291,7 @@ void P_PrecipitationEffects(void)
effects_lightning = false;
break;
case PRECIP_STORM_NORAIN: // no rain, lightning and thunder allowed
sounds_rain = false;
rainsfx = false;
case PRECIP_STORM: // everything.
break;
default:
@@ -10296,6 +10299,8 @@ void P_PrecipitationEffects(void)
return;
}
boolean sounds_rain = ((cv_drawdist_precip.value != 0) && rainsfx && (!leveltime || leveltime % 80 == 1));
// Currently thunderstorming with lightning, and we're sounding the thunder...
// and where there's thunder, there's gotta be lightning!
if (effects_lightning && lightningStrike)
@@ -10315,38 +10320,57 @@ void P_PrecipitationEffects(void)
if (sound_disabled)
return; // Sound off? D'aw, no fun.
if (!sounds_rain && !sounds_thunder)
return; // no need to calculate volume at ALL
if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
volume = 255; // Sky above? We get it full blast.
else
{
/* GCC is optimizing away y >= yl, FUCK YOU */
volatile fixed_t x, y, yl, yh, xl, xh;
INT64 x, y, yl, yh, xl, xh;
fixed_t closedist, newdist;
// Essentially check in a 1024 unit radius of the player for an outdoor area.
yl = players[displayplayers[0]].mo->y - 1024*FRACUNIT;
yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT;
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT;
closedist = 2048*FRACUNIT;
#define RADIUSSTEP (64*FRACUNIT)
#define SEARCHRADIUS (16*RADIUSSTEP)
yl = yh = players[displayplayers[0]].mo->y;
yl -= SEARCHRADIUS;
while (yl < INT32_MIN)
yl += RADIUSSTEP;
yh += SEARCHRADIUS;
while (yh > INT32_MAX)
yh -= RADIUSSTEP;
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
xl = xh = players[displayplayers[0]].mo->x;
xl -= SEARCHRADIUS;
while (xl < INT32_MIN)
xl += RADIUSSTEP;
xh += SEARCHRADIUS;
while (xh > INT32_MAX)
xh -= RADIUSSTEP;
closedist = SEARCHRADIUS*2;
#undef SEARCHRADIUS
for (y = yl; y <= yh; y += RADIUSSTEP)
for (x = xl; x <= xh; x += RADIUSSTEP)
{
if (R_PointInSubsector(x, y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
continue;
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
if (newdist < closedist)
closedist = newdist;
}
volume = 255 - (closedist>>(FRACBITS+2));
}
#undef RADIUSSTEP
volume = CLAMP(volume, 0, 255);
if (sounds_rain && (!leveltime || leveltime % 80 == 1))
if (sounds_rain)
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume);
if (!sounds_thunder)
+3 -5
View File
@@ -288,8 +288,7 @@ typedef struct mobj_s
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
UINT32 renderflags; // render flags
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
@@ -441,8 +440,7 @@ typedef struct precipmobj_s
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
UINT32 renderflags; // render flags
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
@@ -451,7 +449,7 @@ typedef struct precipmobj_s
fixed_t realxscale, realyscale; // funn-E streeetch
fixed_t stretchslam; // "squish" effect when you land
//sloperollangle
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
+2 -1
View File
@@ -1319,7 +1319,8 @@ void R_RenderBSPNode(INT32 bspnum)
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
side = R_PointOnSideRender(viewx, viewy, bsp);
// Recursively divide front space.
R_RenderBSPNode(bsp->children[side]);
+6
View File
@@ -74,6 +74,12 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
// Utility functions.
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideRender(fixed_t x, fixed_t y, const node_t *node)
{
// use cross product to determine side quickly
return (INT64)(y - node->y) * node->dx - (INT64)(x - node->x) * node->dy > 0;
}
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
{
fixed_t lx = line->v1->x;
+16 -17
View File
@@ -522,7 +522,7 @@ void R_InitSprites(void)
// it can be is do before loading config for skin cvar possible value
R_InitSkins();
for (i = 0; i < numwadfiles; i++)
for (i = 0; i < numwadfiles; i++)
{
R_AddSkins((UINT16)i, false);
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
@@ -732,7 +732,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
if (overflow_test < 0) overflow_test = -overflow_test;
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto
}
// TODO This check should not be necessary. But Papersprites near to the camera will sometimes create invalid values
// for the vissprite's startfrac. This happens because they are not depth culled like other sprites.
// Someone who is more familiar with papersprites pls check and try to fix <3
@@ -1166,7 +1166,7 @@ static void R_ProjectSprite(mobj_t *thing)
angle_t pitchnroll = 0;
angle_t sliptiderollangle = 0;
#endif
INT32 dist = -1;
if (cv_grmaxinterpdist.value)
@@ -1268,7 +1268,7 @@ static void R_ProjectSprite(mobj_t *thing)
{
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
camang = R_PointToAngle (interp.x, interp.y);
if (mirrored)
ang = InvAngle(ang);
}
@@ -1285,9 +1285,9 @@ static void R_ProjectSprite(mobj_t *thing)
// choose a different rotation based on player view
//ang = R_PointToAngle (interp.x, interp.y) - interpangle;
if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
rot = 6; // F7 slot
else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
rot = 2; // F3 slot
else // Normal behaviour
rot = (ang+ANGLE_202h)>>29;
@@ -1298,7 +1298,7 @@ static void R_ProjectSprite(mobj_t *thing)
}
I_Assert(lump < max_spritelumps);
if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES)
this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale);
else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
@@ -1311,7 +1311,7 @@ static void R_ProjectSprite(mobj_t *thing)
#ifdef ROTSPRITE
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
if (cv_spriteroll.value)
{
if (papersprite)
@@ -1456,7 +1456,7 @@ static void R_ProjectSprite(mobj_t *thing)
tx2 += FixedDiv(tx-tx2, div);
tz2 = FixedMul(MINZ, this_scale);
}
if ((tx2 / 4) < -(FixedMul(tz2, fovtan)) || (tx / 4) > FixedMul(tz, fovtan)) // too far off the side?
return;
@@ -1484,7 +1484,7 @@ static void R_ProjectSprite(mobj_t *thing)
return;
range++; // fencepost problem
if (range > 32767)
{
// If the range happens to be too large for fixed_t,
@@ -1599,7 +1599,6 @@ static void R_ProjectSprite(mobj_t *thing)
// store information in a vissprite
vis = R_NewVisSprite();
vis->renderflags = thing->renderflags;
vis->heightsec = heightsec; //SoM: 3/17/2000
vis->mobjflags = thing->flags;
vis->scale = yscale; //<<detailshift;
@@ -2370,7 +2369,7 @@ static drawnode_t *R_CreateDrawNode(drawnode_t *link)
node->thickseg = NULL;
node->ffloor = NULL;
node->sprite = NULL;
ps_numdrawnodes.value.i++;
return node;
}
@@ -2647,7 +2646,7 @@ static void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
if (spr->cliptop[x] == -2)
spr->cliptop[x] = -1;
}
// Check if it'll be visible
// Not done for floorsprites.
if (cv_spriteclip.value)
@@ -2722,7 +2721,7 @@ void R_ClipSprites(void)
for (; clippedvissprites < visspritecount; clippedvissprites++)
{
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
if (cv_spriteclip.value
&& (spr->szt > vid.height || spr->sz < 0))
{
@@ -2747,7 +2746,7 @@ void R_ClipSprites(void)
}
R_ClipVisSprite(spr, spr->x1, spr->x2);
if ((spr->cut & SC_NOTVISIBLE) == 0)
numvisiblesprites++;
}
@@ -3558,7 +3557,7 @@ next_token:
Forceskin_cons_t[numskins+1].value = numskins;
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
}
skin->localskin = local;
// so we dont have to guess
@@ -3585,7 +3584,7 @@ next_token:
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
skinsorted[numskins] = numskins;
}
allskins[numallskins] = ( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
local ? numlocalskins++ : numskins++;