mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-26 13:52:08 +00:00
Made some efforts to improve efficiency of new code, hard to tell if I've made it better or worse though honestly
R_IsEmptyLine is now a thing too btw
This commit is contained in:
parent
1e98e3b4f2
commit
c4569e61a8
3 changed files with 52 additions and 103 deletions
|
@ -2347,6 +2347,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
// e6y: Check whether the player can look beyond this line
|
// e6y: Check whether the player can look beyond this line
|
||||||
//
|
//
|
||||||
#ifdef NEWCLIP
|
#ifdef NEWCLIP
|
||||||
|
boolean checkforemptylines = true;
|
||||||
// Don't modify anything here, just check
|
// Don't modify anything here, just check
|
||||||
// Kalaron: Modified for sloped linedefs
|
// Kalaron: Modified for sloped linedefs
|
||||||
static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
|
static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
|
||||||
|
@ -2389,6 +2390,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
||||||
// now check for closed sectors!
|
// now check for closed sectors!
|
||||||
if (backc1 <= frontf1 && backc2 <= frontf2)
|
if (backc1 <= frontf1 && backc2 <= frontf2)
|
||||||
{
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
if (!seg->sidedef->toptexture)
|
if (!seg->sidedef->toptexture)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2400,6 +2402,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
||||||
|
|
||||||
if (backf1 >= frontc1 && backf2 >= frontc2)
|
if (backf1 >= frontc1 && backf2 >= frontc2)
|
||||||
{
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
if (!seg->sidedef->bottomtexture)
|
if (!seg->sidedef->bottomtexture)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2412,6 +2415,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
||||||
|
|
||||||
if (backc1 <= backf1 && backc2 <= backf2)
|
if (backc1 <= backf1 && backc2 <= backf2)
|
||||||
{
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
// preserve a kind of transparent door/lift special effect:
|
// preserve a kind of transparent door/lift special effect:
|
||||||
if (backc1 < frontc1 || backc2 < frontc2)
|
if (backc1 < frontc1 || backc2 < frontc2)
|
||||||
{
|
{
|
||||||
|
@ -2432,42 +2436,13 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backc1 != frontc1 || backc2 != frontc2
|
||||||
// Reject empty lines used for triggers and special events.
|
|| backf1 != frontf1 || backf2 != frontf2)
|
||||||
// Identical floor and ceiling on both sides,
|
|
||||||
// identical light levels on both sides,
|
|
||||||
// and no middle texture.
|
|
||||||
if (
|
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
!seg->polyseg &&
|
|
||||||
#endif
|
|
||||||
gr_backsector->ceilingpic == gr_frontsector->ceilingpic
|
|
||||||
&& gr_backsector->floorpic == gr_frontsector->floorpic
|
|
||||||
#ifdef ESLOPE
|
|
||||||
&& gr_backsector->f_slope == gr_frontsector->f_slope
|
|
||||||
&& gr_backsector->c_slope == gr_frontsector->c_slope
|
|
||||||
#endif
|
|
||||||
&& gr_backsector->lightlevel == gr_frontsector->lightlevel
|
|
||||||
&& !gr_curline->sidedef->midtexture
|
|
||||||
// Check offsets too!
|
|
||||||
&& gr_backsector->floor_xoffs == gr_frontsector->floor_xoffs
|
|
||||||
&& gr_backsector->floor_yoffs == gr_frontsector->floor_yoffs
|
|
||||||
&& gr_backsector->floorpic_angle == gr_frontsector->floorpic_angle
|
|
||||||
&& gr_backsector->ceiling_xoffs == gr_frontsector->ceiling_xoffs
|
|
||||||
&& gr_backsector->ceiling_yoffs == gr_frontsector->ceiling_yoffs
|
|
||||||
&& gr_backsector->ceilingpic_angle == gr_frontsector->ceilingpic_angle
|
|
||||||
// Consider altered lighting.
|
|
||||||
&& gr_backsector->floorlightsec == gr_frontsector->floorlightsec
|
|
||||||
&& gr_backsector->ceilinglightsec == gr_frontsector->ceilinglightsec
|
|
||||||
// Consider colormaps
|
|
||||||
&& gr_backsector->extra_colormap == gr_frontsector->extra_colormap
|
|
||||||
&& ((!gr_frontsector->ffloors && !gr_backsector->ffloors)
|
|
||||||
|| gr_frontsector->tag == gr_backsector->tag))
|
|
||||||
{
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -2802,6 +2777,8 @@ static void HWR_AddLine(seg_t * line)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkforemptylines = true;
|
||||||
#else
|
#else
|
||||||
// Clip to view edges.
|
// Clip to view edges.
|
||||||
span = angle1 - angle2;
|
span = angle1 - angle2;
|
||||||
|
@ -2893,18 +2870,17 @@ static void HWR_AddLine(seg_t * line)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
|
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
|
||||||
if (line->frontsector == line->backsector)
|
|
||||||
{
|
|
||||||
if (!line->sidedef->midtexture)
|
|
||||||
{
|
|
||||||
//e6y: nothing to do here!
|
|
||||||
//return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CheckClip(line, gr_frontsector, gr_backsector))
|
if (CheckClip(line, gr_frontsector, gr_backsector))
|
||||||
{
|
{
|
||||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||||
|
checkforemptylines = false;
|
||||||
}
|
}
|
||||||
|
// Reject empty lines used for triggers and special events.
|
||||||
|
// Identical floor and ceiling on both sides,
|
||||||
|
// identical light levels on both sides,
|
||||||
|
// and no middle texture.
|
||||||
|
if (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
|
HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
|
||||||
|
@ -2981,38 +2957,8 @@ static void HWR_AddLine(seg_t * line)
|
||||||
// Identical floor and ceiling on both sides,
|
// Identical floor and ceiling on both sides,
|
||||||
// identical light levels on both sides,
|
// identical light levels on both sides,
|
||||||
// and no middle texture.
|
// and no middle texture.
|
||||||
if (
|
if (R_IsEmptyLine(curline, frontsector, backsector))
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
!line->polyseg &&
|
|
||||||
#endif
|
|
||||||
gr_backsector->ceilingpic == gr_frontsector->ceilingpic
|
|
||||||
&& gr_backsector->floorpic == gr_frontsector->floorpic
|
|
||||||
#ifdef ESLOPE
|
|
||||||
&& gr_backsector->f_slope == gr_frontsector->f_slope
|
|
||||||
&& gr_backsector->c_slope == gr_frontsector->c_slope
|
|
||||||
#endif
|
|
||||||
&& gr_backsector->lightlevel == gr_frontsector->lightlevel
|
|
||||||
&& !gr_curline->sidedef->midtexture
|
|
||||||
// Check offsets too!
|
|
||||||
&& gr_backsector->floor_xoffs == gr_frontsector->floor_xoffs
|
|
||||||
&& gr_backsector->floor_yoffs == gr_frontsector->floor_yoffs
|
|
||||||
&& gr_backsector->floorpic_angle == gr_frontsector->floorpic_angle
|
|
||||||
&& gr_backsector->ceiling_xoffs == gr_frontsector->ceiling_xoffs
|
|
||||||
&& gr_backsector->ceiling_yoffs == gr_frontsector->ceiling_yoffs
|
|
||||||
&& gr_backsector->ceilingpic_angle == gr_frontsector->ceilingpic_angle
|
|
||||||
// Consider altered lighting.
|
|
||||||
&& gr_backsector->floorlightsec == gr_frontsector->floorlightsec
|
|
||||||
&& gr_backsector->ceilinglightsec == gr_frontsector->ceilinglightsec
|
|
||||||
// Consider colormaps
|
|
||||||
&& gr_backsector->extra_colormap == gr_frontsector->extra_colormap
|
|
||||||
&& ((!gr_frontsector->ffloors && !gr_backsector->ffloors)
|
|
||||||
|| gr_frontsector->tag == gr_backsector->tag))
|
|
||||||
// SoM: For 3D sides... Boris, would you like to take a
|
|
||||||
// crack at rendering 3D sides? You would need to add the
|
|
||||||
// above check and add code to HWR_StoreWallRange...
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
clippass:
|
clippass:
|
||||||
if (x1 == x2)
|
if (x1 == x2)
|
||||||
|
|
60
src/r_bsp.c
60
src/r_bsp.c
|
@ -365,6 +365,36 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||||
return sec;
|
return sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
#ifdef POLYOBJECTS
|
||||||
|
!line->polyseg &&
|
||||||
|
#endif
|
||||||
|
back->ceilingpic == front->ceilingpic
|
||||||
|
&& back->floorpic == front->floorpic
|
||||||
|
#ifdef ESLOPE
|
||||||
|
&& back->f_slope == front->f_slope
|
||||||
|
&& back->c_slope == front->c_slope
|
||||||
|
#endif
|
||||||
|
&& back->lightlevel == front->lightlevel
|
||||||
|
&& !line->sidedef->midtexture
|
||||||
|
// Check offsets too!
|
||||||
|
&& back->floor_xoffs == front->floor_xoffs
|
||||||
|
&& back->floor_yoffs == front->floor_yoffs
|
||||||
|
&& back->floorpic_angle == front->floorpic_angle
|
||||||
|
&& back->ceiling_xoffs == front->ceiling_xoffs
|
||||||
|
&& back->ceiling_yoffs == front->ceiling_yoffs
|
||||||
|
&& back->ceilingpic_angle == front->ceilingpic_angle
|
||||||
|
// Consider altered lighting.
|
||||||
|
&& back->floorlightsec == front->floorlightsec
|
||||||
|
&& back->ceilinglightsec == front->ceilinglightsec
|
||||||
|
// Consider colormaps
|
||||||
|
&& back->extra_colormap == front->extra_colormap
|
||||||
|
&& ((!front->ffloors && !back->ffloors)
|
||||||
|
|| front->tag == back->tag));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_AddLine
|
// R_AddLine
|
||||||
// Clips the given segment and adds any visible pieces to the line list.
|
// Clips the given segment and adds any visible pieces to the line list.
|
||||||
|
@ -526,36 +556,8 @@ static void R_AddLine(seg_t *line)
|
||||||
// Identical floor and ceiling on both sides, identical light levels on both sides,
|
// Identical floor and ceiling on both sides, identical light levels on both sides,
|
||||||
// and no middle texture.
|
// and no middle texture.
|
||||||
|
|
||||||
if (
|
if (R_IsEmptyLine(line, frontsector, backsector))
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
!line->polyseg &&
|
|
||||||
#endif
|
|
||||||
backsector->ceilingpic == frontsector->ceilingpic
|
|
||||||
&& backsector->floorpic == frontsector->floorpic
|
|
||||||
#ifdef ESLOPE
|
|
||||||
&& backsector->f_slope == frontsector->f_slope
|
|
||||||
&& backsector->c_slope == frontsector->c_slope
|
|
||||||
#endif
|
|
||||||
&& backsector->lightlevel == frontsector->lightlevel
|
|
||||||
&& !curline->sidedef->midtexture
|
|
||||||
// Check offsets too!
|
|
||||||
&& backsector->floor_xoffs == frontsector->floor_xoffs
|
|
||||||
&& backsector->floor_yoffs == frontsector->floor_yoffs
|
|
||||||
&& backsector->floorpic_angle == frontsector->floorpic_angle
|
|
||||||
&& backsector->ceiling_xoffs == frontsector->ceiling_xoffs
|
|
||||||
&& backsector->ceiling_yoffs == frontsector->ceiling_yoffs
|
|
||||||
&& backsector->ceilingpic_angle == frontsector->ceilingpic_angle
|
|
||||||
// Consider altered lighting.
|
|
||||||
&& backsector->floorlightsec == frontsector->floorlightsec
|
|
||||||
&& backsector->ceilinglightsec == frontsector->ceilinglightsec
|
|
||||||
// Consider colormaps
|
|
||||||
&& backsector->extra_colormap == frontsector->extra_colormap
|
|
||||||
&& ((!frontsector->ffloors && !backsector->ffloors)
|
|
||||||
|| frontsector->tag == backsector->tag))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
clippass:
|
clippass:
|
||||||
R_ClipPassWallSegment(x1, x2 - 1);
|
R_ClipPassWallSegment(x1, x2 - 1);
|
||||||
|
|
|
@ -50,6 +50,7 @@ extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
|
||||||
|
|
||||||
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||||
INT32 *ceilinglightlevel, boolean back);
|
INT32 *ceilinglightlevel, boolean back);
|
||||||
|
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
|
||||||
|
|
||||||
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
||||||
void R_Prep3DFloors(sector_t *sector);
|
void R_Prep3DFloors(sector_t *sector);
|
||||||
|
|
Loading…
Reference in a new issue