- removed several unused setter functions for level data structures and fixed some incorrect uses.

This commit is contained in:
Christoph Oelckers 2016-04-02 22:05:23 +02:00
parent 9a07f81269
commit 9b5a4b6d43
8 changed files with 25 additions and 100 deletions

View file

@ -1931,7 +1931,7 @@ void AM_drawSubsectors()
sector_t *sec = Renderer->FakeFlat(subsectors[i].render_sector, &tempsec, &floorlight, &ceilinglight, false); sector_t *sec = Renderer->FakeFlat(subsectors[i].render_sector, &tempsec, &floorlight, &ceilinglight, false);
// Find texture origin. // Find texture origin.
originpt.x = -sec->GetXOffsetF(sector_t::floor); originpt.x = -sec->GetXOffsetF(sector_t::floor);
originpt.y = sec->GetYOffset(sector_t::floor); originpt.y = sec->GetYOffsetF(sector_t::floor);
rotation = -sec->GetAngleF(sector_t::floor); rotation = -sec->GetAngleF(sector_t::floor);
// Coloring for the polygon // Coloring for the polygon
colormap = sec->ColorMap; colormap = sec->ColorMap;

View file

@ -1782,7 +1782,7 @@ public:
m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value
m_Tag=tag; m_Tag=tag;
m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->centerspot,destheight); m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->centerspot,destheight);
m_Direction=destheight>sec->GetPlaneTexZ(sector_t::ceiling)? 1:-1; m_Direction=destheight>sec->GetPlaneTexZF(sector_t::ceiling)? 1:-1;
// Do not interpolate instant movement ceilings. // Do not interpolate instant movement ceilings.
double movedist = fabs(sec->ceilingplane.fD() - m_BottomHeight); double movedist = fabs(sec->ceilingplane.fD() - m_BottomHeight);

View file

@ -102,7 +102,7 @@ static bool MoveCeiling(sector_t *sector, int crush, double move)
// Don't let the ceiling go below the floor // Don't let the ceiling go below the floor
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; sector->GetPlaneTexZF(sector_t::floor) > sector->GetPlaneTexZF(sector_t::ceiling)) return false;
return true; return true;
} }
@ -116,7 +116,7 @@ static bool MoveFloor(sector_t *sector, int crush, double move)
// Don't let the floor go above the ceiling // Don't let the floor go above the ceiling
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; sector->GetPlaneTexZF(sector_t::floor) > sector->GetPlaneTexZF(sector_t::ceiling)) return false;
return true; return true;
} }

View file

@ -2182,7 +2182,7 @@ FUNC(LS_Sector_SetTranslucent)
FSectorTagIterator itr(arg0); FSectorTagIterator itr(arg0);
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
sectors[secnum].SetAlpha(arg1, Scale(arg2, OPAQUE, 255)); sectors[secnum].SetAlpha(arg1, clamp(arg2, 0, 255) / 255.);
sectors[secnum].ChangeFlags(arg1, ~PLANEF_ADDITIVE, arg3? PLANEF_ADDITIVE:0); sectors[secnum].ChangeFlags(arg1, ~PLANEF_ADDITIVE, arg3? PLANEF_ADDITIVE:0);
} }
return true; return true;
@ -2461,9 +2461,9 @@ FUNC(LS_Sector_SetFloorScale2)
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
if (arg1) if (arg1)
sectors[secnum].SetXScale(sector_t::floor, arg1); sectors[secnum].SetXScale(sector_t::floor, xscale);
if (arg2) if (arg2)
sectors[secnum].SetYScale(sector_t::floor, arg2); sectors[secnum].SetYScale(sector_t::floor, yscale);
} }
return true; return true;
} }
@ -2483,9 +2483,9 @@ FUNC(LS_Sector_SetCeilingScale2)
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
if (arg1) if (arg1)
sectors[secnum].SetXScale(sector_t::ceiling, arg1); sectors[secnum].SetXScale(sector_t::ceiling, xscale);
if (arg2) if (arg2)
sectors[secnum].SetYScale(sector_t::ceiling, arg2); sectors[secnum].SetYScale(sector_t::ceiling, yscale);
} }
return true; return true;
} }

View file

@ -1500,10 +1500,10 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
{ {
ss->e = &sectors[0].e[i]; ss->e = &sectors[0].e[i];
if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP;
ss->SetPlaneTexZ(sector_t::floor, LittleShort(ms->floorheight)<<FRACBITS); ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight));
ss->floorplane.set(0, 0, FRACUNIT, -ss->GetPlaneTexZ(sector_t::floor)); ss->floorplane.set(0, 0, 1., -ss->GetPlaneTexZF(sector_t::floor));
ss->SetPlaneTexZ(sector_t::ceiling, LittleShort(ms->ceilingheight)<<FRACBITS); ss->SetPlaneTexZ(sector_t::ceiling, (double)LittleShort(ms->ceilingheight));
ss->ceilingplane.set(0, 0, -FRACUNIT, ss->GetPlaneTexZ(sector_t::ceiling)); ss->ceilingplane.set(0, 0, -1., ss->GetPlaneTexZF(sector_t::ceiling));
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true); SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true); SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true);
ss->lightlevel = LittleShort(ms->lightlevel); ss->lightlevel = LittleShort(ms->lightlevel);
@ -1519,12 +1519,12 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
ss->prevsec = -1; // stair retriggering until build completes ss->prevsec = -1; // stair retriggering until build completes
ss->SetAlpha(sector_t::floor, OPAQUE); ss->SetAlpha(sector_t::floor, 1.);
ss->SetAlpha(sector_t::ceiling, OPAQUE); ss->SetAlpha(sector_t::ceiling, 1.);
ss->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling ss->SetXScale(sector_t::floor, 1.); // [RH] floor and ceiling scaling
ss->SetYScale(sector_t::floor, FRACUNIT); ss->SetYScale(sector_t::floor, 1.);
ss->SetXScale(sector_t::ceiling, FRACUNIT); ss->SetXScale(sector_t::ceiling, 1.);
ss->SetYScale(sector_t::ceiling, FRACUNIT); ss->SetYScale(sector_t::ceiling, 1.);
ss->heightsec = NULL; // sector used to get floor and ceiling height ss->heightsec = NULL; // sector used to get floor and ceiling height
// killough 3/7/98: end changes // killough 3/7/98: end changes

View file

@ -860,8 +860,8 @@ static void SetupFloorPortal (AStackPoint *point)
if (skyv != NULL && skyv->bAlways) if (skyv != NULL && skyv->bAlways)
{ {
skyv->Mate = point; skyv->Mate = point;
if (Sector->GetAlpha(sector_t::floor) == OPAQUE) if (Sector->GetAlphaF(sector_t::floor) == 1.)
Sector->SetAlpha(sector_t::floor, Scale (point->args[0], OPAQUE, 255)); Sector->SetAlpha(sector_t::floor, clamp(point->args[0], 0, 255) / 255.);
} }
} }
@ -874,8 +874,8 @@ static void SetupCeilingPortal (AStackPoint *point)
if (skyv != NULL && skyv->bAlways) if (skyv != NULL && skyv->bAlways)
{ {
skyv->Mate = point; skyv->Mate = point;
if (Sector->GetAlpha(sector_t::ceiling) == OPAQUE) if (Sector->GetAlphaF(sector_t::ceiling) == 1.)
Sector->SetAlpha(sector_t::ceiling, Scale(point->args[0], OPAQUE, 255)); Sector->SetAlpha(sector_t::ceiling, clamp(point->args[0], 0, 255) / 255.);
} }
} }

View file

@ -196,8 +196,8 @@ static int WriteSECTORS (FILE *file)
for (int i = 0; i < numsectors; ++i) for (int i = 0; i < numsectors; ++i)
{ {
ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::floor) >> FRACBITS)); ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::floor)));
ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling) >> FRACBITS)); ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::ceiling)));
uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor))); uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor)));
uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling))); uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling)));
ms.lightlevel = LittleShort((short)sectors[i].lightlevel); ms.lightlevel = LittleShort((short)sectors[i].lightlevel);

View file

@ -282,15 +282,6 @@ private:
fixed_t a, b, c, d, ic; fixed_t a, b, c, d, ic;
public: public:
void set(fixed_t aa, fixed_t bb, fixed_t cc, fixed_t dd)
{
a = aa;
b = bb;
c = cc;
d = dd;
ic = FixedDiv(FRACUNIT, c);
}
void set(double aa, double bb, double cc, double dd) void set(double aa, double bb, double cc, double dd)
{ {
a = FLOAT2FIXED(aa); a = FLOAT2FIXED(aa);
@ -446,12 +437,6 @@ public:
return fD() - hdiff * fC(); return fD() - hdiff * fC();
} }
// Returns how much this plane's height would change if d were set to oldd
fixed_t HeightDiff (fixed_t oldd) const
{
return FixedMul (oldd - d, ic);
}
// Returns how much this plane's height would change if d were set to oldd // Returns how much this plane's height would change if d were set to oldd
double HeightDiff(double oldd) const double HeightDiff(double oldd) const
{ {
@ -464,16 +449,6 @@ public:
return (oldd - newd) * fiC(); return (oldd - newd) * fiC();
} }
fixed_t PointToDist (fixed_t x, fixed_t y, fixed_t z) const
{
return -TMulScale16 (a, x, y, b, z, c);
}
fixed_t PointToDist (const vertex_t *v, fixed_t z) const
{
return -TMulScale16 (a, v->fixX(), b, v->fixY(), z, c);
}
double PointToDist(const DVector2 &xy, double z) const double PointToDist(const DVector2 &xy, double z) const
{ {
return -(a * xy.X + b * xy.Y + c * z) / 65536.; return -(a * xy.X + b * xy.Y + c * z) / 65536.;
@ -711,21 +686,11 @@ struct sector_t
splane planes[2]; splane planes[2];
void SetXOffset(int pos, fixed_t o)
{
planes[pos].xform.xoffs = o;
}
void SetXOffset(int pos, double o) void SetXOffset(int pos, double o)
{ {
planes[pos].xform.xoffs = FLOAT2FIXED(o); planes[pos].xform.xoffs = FLOAT2FIXED(o);
} }
void AddXOffset(int pos, fixed_t 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 += FLOAT2FIXED(o);
@ -741,21 +706,11 @@ struct sector_t
return FIXED2DBL(planes[pos].xform.xoffs); return FIXED2DBL(planes[pos].xform.xoffs);
} }
void SetYOffset(int pos, fixed_t o)
{
planes[pos].xform.yoffs = o;
}
void SetYOffset(int pos, double o) void SetYOffset(int pos, double o)
{ {
planes[pos].xform.yoffs = FLOAT2FIXED(o); planes[pos].xform.yoffs = FLOAT2FIXED(o);
} }
void AddYOffset(int pos, fixed_t 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 += FLOAT2FIXED(o);
@ -785,11 +740,6 @@ struct sector_t
} }
} }
void SetXScale(int pos, fixed_t o)
{
planes[pos].xform.xscale = o;
}
void SetXScale(int pos, double o) void SetXScale(int pos, double o)
{ {
planes[pos].xform.xscale = FLOAT2FIXED(o); planes[pos].xform.xscale = FLOAT2FIXED(o);
@ -805,11 +755,6 @@ struct sector_t
return FIXED2DBL(planes[pos].xform.xscale); return FIXED2DBL(planes[pos].xform.xscale);
} }
void SetYScale(int pos, fixed_t o)
{
planes[pos].xform.yscale = o;
}
void SetYScale(int pos, double o) void SetYScale(int pos, double o)
{ {
planes[pos].xform.yscale = FLOAT2FIXED(o); planes[pos].xform.yscale = FLOAT2FIXED(o);
@ -825,11 +770,6 @@ struct sector_t
return FIXED2DBL(planes[pos].xform.yscale); return FIXED2DBL(planes[pos].xform.yscale);
} }
void SetAngle(int pos, angle_t o)
{
planes[pos].xform.angle = o;
}
void SetAngle(int pos, DAngle o) void SetAngle(int pos, DAngle o)
{ {
planes[pos].xform.angle = o.BAMs(); planes[pos].xform.angle = o.BAMs();
@ -865,11 +805,6 @@ struct sector_t
planes[pos].xform.base_angle = o.BAMs(); planes[pos].xform.base_angle = o.BAMs();
} }
void SetAlpha(int pos, fixed_t o)
{
planes[pos].alpha = o;
}
void SetAlpha(int pos, double o) void SetAlpha(int pos, double o)
{ {
planes[pos].alpha = FLOAT2FIXED(o); planes[pos].alpha = FLOAT2FIXED(o);
@ -928,21 +863,11 @@ struct sector_t
return FIXED2DBL(planes[pos].TexZ); return FIXED2DBL(planes[pos].TexZ);
} }
void SetPlaneTexZ(int pos, fixed_t val)
{
planes[pos].TexZ = val;
}
void SetPlaneTexZ(int pos, double val) void SetPlaneTexZ(int pos, double val)
{ {
planes[pos].TexZ = FLOAT2FIXED(val); planes[pos].TexZ = FLOAT2FIXED(val);
} }
void ChangePlaneTexZ(int pos, fixed_t val)
{
planes[pos].TexZ += val;
}
void ChangePlaneTexZ(int pos, double val) void ChangePlaneTexZ(int pos, double val)
{ {
planes[pos].TexZ += FLOAT2FIXED(val); planes[pos].TexZ += FLOAT2FIXED(val);