use memcmp for R_IsEmptyLine

:chonkbuncle:
this actually is quite a little faster too
This commit is contained in:
Alug committed 2025-03-05 00:09:35 +01:00
1 parent 1e79d464b0
commit 637499dcd7
3 files changed
+26 -40

No files matched your search

+4 -23
View File
@@ -372,30 +372,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
return sec;
}
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
boolean R_IsEmptyLine(seg_t *line, const sector_t *front, const sector_t *back)
{
return (
!line->polyseg &&
back->ceilingpic == front->ceilingpic
&& back->floorpic == front->floorpic
&& back->f_slope == front->f_slope
&& back->c_slope == front->c_slope
&& 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));
return (!line->polyseg && !line->sidedef->midtexture
&& ((!front->ffloors && !back->ffloors) || front->tag == back->tag)
&& (memcmp(front, back, (offsetof(sector_t, extra_colormap) + sizeof(extracolormap_t *))) == 0));
}
//
+1 -1
View File
@@ -55,7 +55,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,
INT32 *ceilinglightlevel, boolean back);
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
boolean R_IsEmptyLine(seg_t *line, const sector_t *front, const sector_t *back);
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
void R_Prep3DFloors(sector_t *sector);
+21 -16
View File
@@ -279,13 +279,32 @@ typedef enum
//
typedef struct sector_s
{
fixed_t floorheight;
fixed_t ceilingheight;
INT32 floorpic;
INT32 ceilingpic;
INT16 lightlevel;
pslope_t *f_slope; // floor slope
pslope_t *c_slope; // ceiling slope
// floor and ceiling texture offsets
fixed_t floor_xoffs, floor_yoffs;
fixed_t ceiling_xoffs, ceiling_yoffs;
// flat angle
angle_t floorpic_angle;
angle_t ceilingpic_angle;
INT32 floorlightsec, ceilinglightsec;
// per-sector colormaps!
extracolormap_t *extra_colormap;
fixed_t floorheight;
fixed_t ceilingheight;
INT16 special;
UINT16 tag;
INT32 nexttag, firsttag; // for fast tag searches
// origin for any sounds played by the sector
@@ -303,18 +322,9 @@ typedef struct sector_s
void *ceilingdata; // ceiling move thinker
void *lightingdata; // lighting change thinker
// floor and ceiling texture offsets
fixed_t floor_xoffs, floor_yoffs;
fixed_t ceiling_xoffs, ceiling_yoffs;
// flat angle
angle_t floorpic_angle;
angle_t ceilingpic_angle;
INT32 heightsec; // other sector, or -1 if no other sector
INT32 camsec; // used for camera clipping
INT32 floorlightsec, ceilinglightsec;
INT32 crumblestate; // used for crumbling and bobbing
INT32 bottommap, midmap, topmap; // dynamic colormaps
@@ -341,9 +351,6 @@ typedef struct sector_s
INT32 numlights;
boolean moved;
// per-sector colormaps!
extracolormap_t *extra_colormap;
// This points to the master's floorheight, so it can be changed in realtime!
fixed_t *gravity; // per-sector gravity
boolean verticalflip; // If gravity < 0, then allow flipped physics
@@ -356,8 +363,6 @@ typedef struct sector_s
fixed_t floorspeed, ceilspeed;
// Eternity engine slope
pslope_t *f_slope; // floor slope
pslope_t *c_slope; // ceiling slope
boolean hasslope; // The sector, or one of its visible FOFs, contains a slope
// these are saved for netgames, so do not let Lua touch these!