Merge branch 'master' of c:\programming\doom-dev\zdoom

This commit is contained in:
Christoph Oelckers 2016-04-23 12:42:21 +02:00
commit e56d643924
6 changed files with 57 additions and 140 deletions

View file

@ -492,8 +492,8 @@ FArchive &operator<< (FArchive &arc, side_t::part &p)
FArchive &operator<< (FArchive &arc, sector_t::splane &p) FArchive &operator<< (FArchive &arc, sector_t::splane &p)
{ {
arc << p.xform.xoffs << p.xform.yoffs << p.xform.xscale << p.xform.yscale arc << p.xform.xOffs << p.xform.yOffs << p.xform.xScale << p.xform.yScale
<< p.xform.angle << p.xform.base_yoffs << p.xform.base_angle << p.xform.Angle << p.xform.baseyOffs << p.xform.baseAngle
<< p.Flags << p.Light << p.Texture << p.TexZ << p.alpha; << p.Flags << p.Light << p.Texture << p.TexZ << p.alpha;
return arc; return arc;
} }

View file

@ -680,28 +680,18 @@ void R_AddLine (seg_t *line)
|| curline->sidedef->GetTexture(side_t::mid).isValid() || curline->sidedef->GetTexture(side_t::mid).isValid()
// killough 3/7/98: Take flats offsets into account: // killough 3/7/98: Take flats offsets into account:
|| backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor) || backsector->planes[sector_t::floor].xform != frontsector->planes[sector_t::floor].xform
|| backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor) || backsector->planes[sector_t::ceiling].xform != frontsector->planes[sector_t::ceiling].xform
|| backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling)
|| backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) || backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor)
|| backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) || backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling)
|| backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor) || backsector->GetVisFlags(sector_t::floor) != frontsector->GetVisFlags(sector_t::floor)
|| backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling) || backsector->GetVisFlags(sector_t::ceiling) != frontsector->GetVisFlags(sector_t::ceiling)
// [RH] Also consider colormaps // [RH] Also consider colormaps
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
// [RH] and scaling
|| backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|| backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|| backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|| backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
// [RH] and rotation
|| backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|| backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
// kg3D - and fake lights // kg3D - and fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (frontsector->e && frontsector->e->XFloor.lightlist.Size())
@ -1118,11 +1108,7 @@ void R_Subsector (subsector_t *sub)
ceilinglightlevel + r_actualextralight, // killough 4/11/98 ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->GetAlpha(sector_t::ceiling), frontsector->GetAlpha(sector_t::ceiling),
!!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE), !!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98 frontsector->planes[sector_t::ceiling].xform,
frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetXScale(sector_t::ceiling),
frontsector->GetYScale(sector_t::ceiling),
frontsector->GetAngle(sector_t::ceiling),
frontsector->sky, frontsector->sky,
portal portal
) : NULL; ) : NULL;
@ -1159,11 +1145,7 @@ void R_Subsector (subsector_t *sub)
floorlightlevel + r_actualextralight, // killough 3/16/98 floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->GetAlpha(sector_t::floor), frontsector->GetAlpha(sector_t::floor),
!!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE), !!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::floor), // killough 3/7/98 frontsector->planes[sector_t::floor].xform,
frontsector->GetYOffset(sector_t::floor), // killough 3/7/98
frontsector->GetXScale(sector_t::floor),
frontsector->GetYScale(sector_t::floor),
frontsector->GetAngle(sector_t::floor),
frontsector->sky, frontsector->sky,
portal portal
) : NULL; ) : NULL;
@ -1221,11 +1203,7 @@ void R_Subsector (subsector_t *sub)
floorlightlevel + r_actualextralight, // killough 3/16/98 floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->GetAlpha(sector_t::floor), frontsector->GetAlpha(sector_t::floor),
!!(fakeFloor->flags & FF_ADDITIVETRANS), !!(fakeFloor->flags & FF_ADDITIVETRANS),
frontsector->GetXOffset(position), // killough 3/7/98 frontsector->planes[position].xform,
frontsector->GetYOffset(position), // killough 3/7/98
frontsector->GetXScale(position),
frontsector->GetYScale(position),
frontsector->GetAngle(position),
frontsector->sky, frontsector->sky,
NULL); NULL);
@ -1286,11 +1264,7 @@ void R_Subsector (subsector_t *sub)
ceilinglightlevel + r_actualextralight, // killough 4/11/98 ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->GetAlpha(sector_t::ceiling), frontsector->GetAlpha(sector_t::ceiling),
!!(fakeFloor->flags & FF_ADDITIVETRANS), !!(fakeFloor->flags & FF_ADDITIVETRANS),
frontsector->GetXOffset(position), // killough 3/7/98 frontsector->planes[position].xform,
frontsector->GetYOffset(position), // killough 3/7/98
frontsector->GetXScale(position),
frontsector->GetYScale(position),
frontsector->GetAngle(position),
frontsector->sky, frontsector->sky,
NULL); NULL);

View file

@ -339,11 +339,6 @@ public:
} }
// Returns < 0 : behind; == 0 : on; > 0 : in front // Returns < 0 : behind; == 0 : on; > 0 : in front
int PointOnSide (fixed_t x, fixed_t y, fixed_t z) const
{
return PointOnSide(DVector3(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z)));
}
int PointOnSide(const DVector3 &pos) const int PointOnSide(const DVector3 &pos) const
{ {
double v = (normal | pos) + D; double v = (normal | pos) + D;
@ -359,23 +354,6 @@ public:
// Returns the value of z at (x,y) // Returns the value of z at (x,y)
fixed_t ZatPoint(fixed_t x, fixed_t y) const = delete; // it is not allowed to call this. fixed_t ZatPoint(fixed_t x, fixed_t y) const = delete; // it is not allowed to call this.
fixed_t ZatPointFixed(fixed_t x, fixed_t y) const
{
return FLOAT2FIXED(ZatPoint(FIXED2DBL(x), FIXED2DBL(y)));
}
// This is for the software renderer
fixed_t ZatPointFixed(const DVector2 &pos) const
{
return FLOAT2FIXED(ZatPoint(pos));
}
fixed_t ZatPointFixed(const vertex_t *v) const
{
return FLOAT2FIXED(ZatPoint(v));
}
// Returns the value of z at (x,y) as a double // Returns the value of z at (x,y) as a double
double ZatPoint (double x, double y) const double ZatPoint (double x, double y) const
{ {
@ -604,16 +582,24 @@ struct extsector_t
struct FTransform struct FTransform
{ {
// killough 3/7/98: floor and ceiling texture offsets // killough 3/7/98: floor and ceiling texture offsets
fixed_t xoffs, yoffs; double xOffs, yOffs, baseyOffs;
// [RH] floor and ceiling texture scales // [RH] floor and ceiling texture scales
fixed_t xscale, yscale; double xScale, yScale;
// [RH] floor and ceiling texture rotation // [RH] floor and ceiling texture rotation
angle_t angle; DAngle Angle, baseAngle;
finline bool operator == (const FTransform &other) const
{
return xOffs == other.xOffs && yOffs + baseyOffs == other.yOffs + other.baseyOffs &&
xScale == other.xScale && yScale == other.yScale && Angle + baseAngle == other.Angle + other.baseAngle;
}
finline bool operator != (const FTransform &other) const
{
return !(*this == other);
}
// base values
fixed_t base_angle, base_yoffs;
}; };
struct secspecial_t struct secspecial_t
@ -713,121 +699,82 @@ public:
void SetXOffset(int pos, double o) void SetXOffset(int pos, double o)
{ {
planes[pos].xform.xoffs = FLOAT2FIXED(o); planes[pos].xform.xOffs = o;
} }
void AddXOffset(int pos, double o) void AddXOffset(int pos, double o)
{ {
planes[pos].xform.xoffs += FLOAT2FIXED(o); planes[pos].xform.xOffs += o;
}
fixed_t GetXOffset(int pos) const
{
return planes[pos].xform.xoffs;
} }
double GetXOffsetF(int pos) const double GetXOffsetF(int pos) const
{ {
return FIXED2DBL(planes[pos].xform.xoffs); return planes[pos].xform.xOffs;
} }
void SetYOffset(int pos, double o) void SetYOffset(int pos, double o)
{ {
planes[pos].xform.yoffs = FLOAT2FIXED(o); planes[pos].xform.yOffs = o;
} }
void AddYOffset(int pos, double o) void AddYOffset(int pos, double o)
{ {
planes[pos].xform.yoffs += FLOAT2FIXED(o); planes[pos].xform.yOffs += o;
}
fixed_t GetYOffset(int pos, bool addbase = true) const
{
if (!addbase)
{
return planes[pos].xform.yoffs;
}
else
{
return planes[pos].xform.yoffs + planes[pos].xform.base_yoffs;
}
} }
double GetYOffsetF(int pos, bool addbase = true) const double GetYOffsetF(int pos, bool addbase = true) const
{ {
if (!addbase) if (!addbase)
{ {
return FIXED2DBL(planes[pos].xform.yoffs); return planes[pos].xform.yOffs;
} }
else else
{ {
return FIXED2DBL(planes[pos].xform.yoffs + planes[pos].xform.base_yoffs); return planes[pos].xform.yOffs + planes[pos].xform.baseyOffs;
} }
} }
void SetXScale(int pos, double o) void SetXScale(int pos, double o)
{ {
planes[pos].xform.xscale = FLOAT2FIXED(o); planes[pos].xform.xScale = o;
}
fixed_t GetXScale(int pos) const
{
return planes[pos].xform.xscale;
} }
double GetXScaleF(int pos) const double GetXScaleF(int pos) const
{ {
return FIXED2DBL(planes[pos].xform.xscale); return planes[pos].xform.xScale;
} }
void SetYScale(int pos, double o) void SetYScale(int pos, double o)
{ {
planes[pos].xform.yscale = FLOAT2FIXED(o); planes[pos].xform.yScale = o;
}
fixed_t GetYScale(int pos) const
{
return planes[pos].xform.yscale;
} }
double GetYScaleF(int pos) const double GetYScaleF(int pos) const
{ {
return FIXED2DBL(planes[pos].xform.yscale); return planes[pos].xform.yScale;
} }
void SetAngle(int pos, DAngle o) void SetAngle(int pos, DAngle o)
{ {
planes[pos].xform.angle = o.BAMs(); planes[pos].xform.Angle = o;
}
angle_t GetAngle(int pos, bool addbase = true) const
{
if (!addbase)
{
return planes[pos].xform.angle;
}
else
{
return planes[pos].xform.angle + planes[pos].xform.base_angle;
}
} }
DAngle GetAngleF(int pos, bool addbase = true) const DAngle GetAngleF(int pos, bool addbase = true) const
{ {
if (!addbase) if (!addbase)
{ {
return ANGLE2DBL(planes[pos].xform.angle); return planes[pos].xform.Angle;
} }
else else
{ {
return ANGLE2DBL(planes[pos].xform.angle + planes[pos].xform.base_angle); return planes[pos].xform.Angle + planes[pos].xform.baseAngle;
} }
} }
void SetBase(int pos, double y, DAngle o) void SetBase(int pos, double y, DAngle o)
{ {
planes[pos].xform.base_yoffs = FLOAT2FIXED(y); planes[pos].xform.baseyOffs = y;
planes[pos].xform.base_angle = o.BAMs(); planes[pos].xform.baseAngle = o;
} }
void SetAlpha(int pos, double o) void SetAlpha(int pos, double o)
@ -850,6 +797,12 @@ public:
return planes[pos].Flags; return planes[pos].Flags;
} }
// like the previous one but masks out all flags which are not relevant for rendering.
int GetVisFlags(int pos) const
{
return planes[pos].Flags & ~(PLANEF_BLOCKED | PLANEF_NOPASS | PLANEF_BLOCKSOUND | PLANEF_LINKED);
}
void ChangeFlags(int pos, int And, int Or) void ChangeFlags(int pos, int And, int Or)
{ {
planes[pos].Flags &= ~And; planes[pos].Flags &= ~And;

View file

@ -582,14 +582,18 @@ static visplane_t *new_visplane (unsigned hash)
//========================================================================== //==========================================================================
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, fixed_t alpha, bool additive, visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, fixed_t alpha, bool additive,
fixed_t xoffs, fixed_t yoffs, const FTransform &xform,
fixed_t xscale, fixed_t yscale, angle_t angle,
int sky, FSectorPortal *portal) int sky, FSectorPortal *portal)
{ {
secplane_t plane; secplane_t plane;
visplane_t *check; visplane_t *check;
unsigned hash; // killough unsigned hash; // killough
bool isskybox; bool isskybox;
fixed_t xoffs = FLOAT2FIXED(xform.xOffs);
fixed_t yoffs = FLOAT2FIXED(xform.yOffs + xform.baseyOffs);
fixed_t xscale = FLOAT2FIXED(xform.xScale);
fixed_t yscale = FLOAT2FIXED(xform.yScale);
angle_t angle = (xform.Angle + xform.baseAngle).BAMs();
if (picnum == skyflatnum) // killough 10/98 if (picnum == skyflatnum) // killough 10/98
{ // most skies map together { // most skies map together
@ -651,6 +655,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
(plane == check->height && (plane == check->height &&
picnum == check->picnum && picnum == check->picnum &&
lightlevel == check->lightlevel && lightlevel == check->lightlevel &&
xoffs == check->xoffs && // killough 2/28/98: Add offset checks xoffs == check->xoffs && // killough 2/28/98: Add offset checks
yoffs == check->yoffs && yoffs == check->yoffs &&
basecolormap == check->colormap && // [RH] Add more checks basecolormap == check->colormap && // [RH] Add more checks

View file

@ -100,11 +100,7 @@ visplane_t *R_FindPlane
int lightlevel, int lightlevel,
fixed_t alpha, fixed_t alpha,
bool additive, bool additive,
fixed_t xoffs, // killough 2/28/98: add x-y offsets const FTransform &xform,
fixed_t yoffs,
fixed_t xscale,
fixed_t yscale,
angle_t angle,
int sky, int sky,
FSectorPortal *portal); FSectorPortal *portal);

View file

@ -2110,26 +2110,21 @@ void R_NewWall (bool needlights)
|| backsector->floorplane != frontsector->floorplane || backsector->floorplane != frontsector->floorplane
|| backsector->lightlevel != frontsector->lightlevel || backsector->lightlevel != frontsector->lightlevel
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor)
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor)
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor) || backsector->planes[sector_t::floor].xform != frontsector->planes[sector_t::floor].xform
|| backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor)
|| backsector->GetAlpha(sector_t::floor) != frontsector->GetAlpha(sector_t::floor) || backsector->GetAlpha(sector_t::floor) != frontsector->GetAlpha(sector_t::floor)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
// from bleeding through deep water // from bleeding through deep water
|| frontsector->heightsec || frontsector->heightsec
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) || backsector->GetVisFlags(sector_t::floor) != frontsector->GetVisFlags(sector_t::floor)
|| backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor)
// [RH] Add checks for colormaps // [RH] Add checks for colormaps
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
|| backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|| backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|| backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
// kg3D - add fake lights // kg3D - add fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (frontsector->e && frontsector->e->XFloor.lightlist.Size())
@ -2148,8 +2143,7 @@ void R_NewWall (bool needlights)
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling)
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling) || backsector->planes[sector_t::ceiling].xform != frontsector->planes[sector_t::ceiling].xform
|| backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
|| backsector->GetAlpha(sector_t::ceiling) != frontsector->GetAlpha(sector_t::ceiling) || backsector->GetAlpha(sector_t::ceiling) != frontsector->GetAlpha(sector_t::ceiling)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
@ -2162,11 +2156,6 @@ void R_NewWall (bool needlights)
// [RH] Add check for colormaps // [RH] Add check for colormaps
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
|| backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|| backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
|| backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
// kg3D - add fake lights // kg3D - add fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (frontsector->e && frontsector->e->XFloor.lightlist.Size())
|| (backsector->e && backsector->e->XFloor.lightlist.Size()) || (backsector->e && backsector->e->XFloor.lightlist.Size())