Merge branch 'Saturn-Next' into refactorpostimg
This commit is contained in:
commit
ea00bebb04
8 files changed
+189
-186
No files matched your search
@@ -99,7 +99,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];
|
||||
|
||||
@@ -2067,7 +2066,6 @@ void D_SRB2Main(void)
|
||||
|
||||
if (dedicated && server)
|
||||
{
|
||||
pagename = "TITLESKY";
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false, false))
|
||||
|
||||
+138
-152
@@ -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);
|
||||
|
||||
@@ -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,26 +1090,30 @@ 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++)
|
||||
{
|
||||
@@ -1177,13 +1183,10 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
endbheight = endrealbot;
|
||||
}
|
||||
|
||||
if (cv_splitwallfix.value)
|
||||
{
|
||||
if (endbheight > endtop)
|
||||
endbot = endtop;
|
||||
}
|
||||
if (endbheight > endtop)
|
||||
endbot = endtop;
|
||||
|
||||
if ((endbheight >= endtop && bheight >= top && !cv_splitwallfix.value) || (bheight >= top && cv_splitwallfix.value))
|
||||
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,16 +1482,14 @@ 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);
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
@@ -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]))
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -5678,8 +5666,6 @@ void HWR_AddCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_grbatching);
|
||||
|
||||
CV_RegisterVar(&cv_splitwallfix);
|
||||
|
||||
CV_RegisterVar(&cv_grrenderdistance);
|
||||
|
||||
CV_RegisterVar(&cv_grfakecontrast);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -4724,7 +4720,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
@@ -9989,10 +9989,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);
|
||||
|
||||
@@ -10286,7 +10289,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;
|
||||
@@ -10319,7 +10322,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:
|
||||
@@ -10327,6 +10330,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)
|
||||
@@ -10346,38 +10351,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)
|
||||
|
||||
+2
-1
@@ -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]);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user