mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- floatification of sector_t::centerspot.
This commit is contained in:
parent
30b57fd7b0
commit
35bb686281
9 changed files with 52 additions and 47 deletions
|
@ -1962,8 +1962,8 @@ void AM_drawSubsectors()
|
|||
}
|
||||
else
|
||||
{
|
||||
secx = FIXED2DBL(sec->centerspot.x);
|
||||
secy = FIXED2DBL(sec->centerspot.y);
|
||||
secx = sec->centerspot.X;
|
||||
secy = sec->centerspot.Y;
|
||||
}
|
||||
seczb = floorplane->ZatPoint(secx, secy);
|
||||
seczt = sec->ceilingplane.ZatPoint(secx, secy);
|
||||
|
|
|
@ -1595,7 +1595,7 @@ void FParser::SF_FloorHeight(void)
|
|||
DFloorChanger * f = new DFloorChanger(§ors[i]);
|
||||
if (!f->Move(
|
||||
abs(dest - sectors[i].CenterFloor()),
|
||||
sectors[i].floorplane.PointToDist (sectors[i].centerspot, dest),
|
||||
sectors[i].floorplane.PointToDist (sectors[i]._f_centerspot(), dest),
|
||||
crush? 10:-1,
|
||||
(dest > sectors[i].CenterFloor()) ? 1 : -1))
|
||||
{
|
||||
|
@ -1679,7 +1679,7 @@ void FParser::SF_MoveFloor(void)
|
|||
// Don't start a second thinker on the same floor
|
||||
if (sec->floordata) continue;
|
||||
|
||||
new DMoveFloor(sec,sec->floorplane.PointToDist(sec->centerspot,destheight),
|
||||
new DMoveFloor(sec,sec->floorplane.PointToDist(sec->_f_centerspot(),destheight),
|
||||
destheight < sec->CenterFloor() ? -1:1,crush,platspeed);
|
||||
}
|
||||
}
|
||||
|
@ -1743,7 +1743,7 @@ void FParser::SF_CeilingHeight(void)
|
|||
DCeilingChanger * c = new DCeilingChanger(§ors[i]);
|
||||
if (!c->Move(
|
||||
abs(dest - sectors[i].CenterCeiling()),
|
||||
sectors[i].ceilingplane.PointToDist (sectors[i].centerspot, dest),
|
||||
sectors[i].ceilingplane.PointToDist (sectors[i]._f_centerspot(), dest),
|
||||
crush? 10:-1,
|
||||
(dest > sectors[i].CenterCeiling()) ? 1 : -1))
|
||||
{
|
||||
|
@ -1787,7 +1787,7 @@ public:
|
|||
m_Silent = silent;
|
||||
m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value
|
||||
m_Tag=tag;
|
||||
m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->centerspot,destheight);
|
||||
m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->_f_centerspot(),destheight);
|
||||
m_Direction=destheight>sec->GetPlaneTexZ(sector_t::ceiling)? 1:-1;
|
||||
|
||||
// Do not interpolate instant movement ceilings.
|
||||
|
|
|
@ -464,13 +464,13 @@ void P_Recalculate3DFloors(sector_t * sector)
|
|||
while (oldlist.Size())
|
||||
{
|
||||
pick=oldlist[0];
|
||||
fixed_t height=pick->top.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t height=pick->top.plane->ZatPoint(sector->_f_centerspot());
|
||||
|
||||
// find highest starting ffloor - intersections are not supported!
|
||||
pickindex=0;
|
||||
for (j=1;j<oldlist.Size();j++)
|
||||
{
|
||||
fixed_t h2=oldlist[j]->top.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t h2=oldlist[j]->top.plane->ZatPoint(sector->_f_centerspot());
|
||||
|
||||
if (h2>height)
|
||||
{
|
||||
|
@ -481,7 +481,7 @@ void P_Recalculate3DFloors(sector_t * sector)
|
|||
}
|
||||
|
||||
oldlist.Delete(pickindex);
|
||||
fixed_t pick_bottom=pick->bottom.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t pick_bottom=pick->bottom.plane->ZatPoint(sector->_f_centerspot());
|
||||
|
||||
if (pick->flags & FF_THISINSIDE)
|
||||
{
|
||||
|
@ -595,7 +595,7 @@ void P_Recalculate3DFloors(sector_t * sector)
|
|||
if ( !(rover->flags & FF_EXISTS) || rover->flags & FF_NOSHADE )
|
||||
continue;
|
||||
|
||||
fixed_t ff_top=rover->top.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t ff_top=rover->top.plane->ZatPoint(sector->_f_centerspot());
|
||||
if (ff_top < minheight) break; // reached the floor
|
||||
if (ff_top < maxheight)
|
||||
{
|
||||
|
@ -610,7 +610,7 @@ void P_Recalculate3DFloors(sector_t * sector)
|
|||
}
|
||||
else
|
||||
{
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->_f_centerspot());
|
||||
if (ff_bottom<maxheight)
|
||||
{
|
||||
// this segment begins over the ceiling and extends beyond it
|
||||
|
@ -636,7 +636,7 @@ void P_Recalculate3DFloors(sector_t * sector)
|
|||
|
||||
if (rover->flags&FF_DOUBLESHADOW)
|
||||
{
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->_f_centerspot());
|
||||
if(ff_bottom < maxheight && ff_bottom>minheight)
|
||||
{
|
||||
newlight.caster = rover;
|
||||
|
@ -724,11 +724,11 @@ lightlist_t * P_GetPlaneLight(sector_t * sector, secplane_t * plane, bool unders
|
|||
unsigned i;
|
||||
TArray<lightlist_t> &lightlist = sector->e->XFloor.lightlist;
|
||||
|
||||
fixed_t planeheight=plane->ZatPoint(sector->centerspot);
|
||||
fixed_t planeheight=plane->ZatPoint(sector->_f_centerspot());
|
||||
if(underside) planeheight--;
|
||||
|
||||
for(i = 1; i < lightlist.Size(); i++)
|
||||
if (lightlist[i].plane.ZatPoint(sector->centerspot) <= planeheight)
|
||||
if (lightlist[i].plane.ZatPoint(sector->_f_centerspot()) <= planeheight)
|
||||
return &lightlist[i - 1];
|
||||
|
||||
return &lightlist[lightlist.Size() - 1];
|
||||
|
@ -989,8 +989,8 @@ CCMD (dump3df)
|
|||
|
||||
for (unsigned int i = 0; i < ffloors.Size(); i++)
|
||||
{
|
||||
fixed_t height=ffloors[i]->top.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t bheight=ffloors[i]->bottom.plane->ZatPoint(sector->centerspot);
|
||||
fixed_t height=ffloors[i]->top.plane->ZatPoint(sector->_f_centerspot());
|
||||
fixed_t bheight=ffloors[i]->bottom.plane->ZatPoint(sector->_f_centerspot());
|
||||
|
||||
IGNORE_FORMAT_PRE
|
||||
Printf("FFloor %d @ top = %f (model = %d), bottom = %f (model = %d), flags = %B, alpha = %d %s %s\n",
|
||||
|
|
|
@ -344,7 +344,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
|||
case DFloor::floorLowerByValue:
|
||||
floor->m_Direction = -1;
|
||||
newheight = sec->CenterFloor() - height;
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight);
|
||||
break;
|
||||
|
||||
case DFloor::floorRaiseInstant:
|
||||
|
@ -352,7 +352,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
|||
case DFloor::floorRaiseByValue:
|
||||
floor->m_Direction = 1;
|
||||
newheight = sec->CenterFloor() + height;
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight);
|
||||
break;
|
||||
|
||||
case DFloor::floorMoveToValue:
|
||||
|
@ -413,7 +413,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
|||
case DFloor::floorLowerByTexture:
|
||||
floor->m_Direction = -1;
|
||||
newheight = sec->CenterFloor() - sec->FindShortestTextureAround ();
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight);
|
||||
break;
|
||||
|
||||
case DFloor::floorLowerToCeiling:
|
||||
|
@ -430,13 +430,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
|||
// enough, BOOM preserved the code here even though it
|
||||
// also had this function.)
|
||||
newheight = sec->CenterFloor() + sec->FindShortestTextureAround ();
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight);
|
||||
break;
|
||||
|
||||
case DFloor::floorRaiseAndChange:
|
||||
floor->m_Direction = 1;
|
||||
newheight = sec->CenterFloor() + height;
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), newheight);
|
||||
if (line != NULL)
|
||||
{
|
||||
FTextureID oldpic = sec->GetTexture(sector_t::floor);
|
||||
|
@ -620,7 +620,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
|
|||
|
||||
floor->m_Speed = speed;
|
||||
height = sec->CenterFloor() + stairstep;
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, height);
|
||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), height);
|
||||
|
||||
texture = sec->GetTexture(sector_t::floor);
|
||||
osecnum = secnum; //jff 3/4/98 preserve loop index
|
||||
|
@ -1037,15 +1037,15 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
|
|||
// [RH] elevate up by a specific amount
|
||||
case DElevator::elevateRaise:
|
||||
elevator->m_Direction = 1;
|
||||
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight + height);
|
||||
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight + height);
|
||||
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight + height);
|
||||
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight + height);
|
||||
break;
|
||||
|
||||
// [RH] elevate down by a specific amount
|
||||
case DElevator::elevateLower:
|
||||
elevator->m_Direction = -1;
|
||||
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, floorheight - height);
|
||||
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->centerspot, ceilingheight - height);
|
||||
elevator->m_FloorDestDist = sec->floorplane.PointToDist (sec->_f_centerspot(), floorheight - height);
|
||||
elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->_f_centerspot(), ceilingheight - height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,15 +144,15 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
|
|||
if (floordist == 0)
|
||||
{
|
||||
newheight = (sector->CenterFloor () + sector->CenterCeiling ()) / 2;
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
floordist = newheight - sector->CenterFloor ();
|
||||
}
|
||||
else
|
||||
{
|
||||
newheight = sector->CenterFloor () + floordist;
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
}
|
||||
ceilingdist = sector->CenterCeiling () - newheight;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
|
|||
else
|
||||
{
|
||||
newheight = sector->CenterFloor() - floordist;
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->centerspot, newheight);
|
||||
m_FloorTarget = sector->floorplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
}
|
||||
if (ceilingdist == 0)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed,
|
|||
else
|
||||
{
|
||||
newheight = sector->CenterCeiling() + ceilingdist;
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->centerspot, newheight);
|
||||
m_CeilingTarget = sector->ceilingplane.PointToDist (sector->_f_centerspot(), newheight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3223,8 +3223,8 @@ static void P_GroupLines (bool buildmap)
|
|||
}
|
||||
|
||||
// set the center to the middle of the bounding box
|
||||
sector->centerspot.x = bbox.Right()/2 + bbox.Left()/2;
|
||||
sector->centerspot.y = bbox.Top()/2 + bbox.Bottom()/2;
|
||||
sector->centerspot.X = FIXED2DBL(bbox.Right()/2 + bbox.Left()/2);
|
||||
sector->centerspot.Y = FIXED2DBL(bbox.Top()/2 + bbox.Bottom()/2);
|
||||
|
||||
// For triangular sectors the above does not calculate good points unless the longest of the triangle's lines is perfectly horizontal and vertical
|
||||
if (sector->linecount == 3)
|
||||
|
@ -3246,8 +3246,8 @@ static void P_GroupLines (bool buildmap)
|
|||
if (DMulScale32 (v->y - Triangle[0]->y, dx,
|
||||
Triangle[0]->x - v->x, dy) != 0)
|
||||
{
|
||||
sector->centerspot.x = Triangle[0]->x / 3 + Triangle[1]->x / 3 + v->x / 3;
|
||||
sector->centerspot.y = Triangle[0]->y / 3 + Triangle[1]->y / 3 + v->y / 3;
|
||||
sector->centerspot.X = FIXED2DBL(Triangle[0]->x / 3 + Triangle[1]->x / 3 + v->x / 3);
|
||||
sector->centerspot.Y = FIXED2DBL(Triangle[0]->y / 3 + Triangle[1]->y / 3 + v->y / 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1182,9 +1182,9 @@ void R_Subsector (subsector_t *sub)
|
|||
fakeFloor->validcount = validcount;
|
||||
R_3D_NewClip();
|
||||
}
|
||||
fakeHeight = fakeFloor->top.plane->ZatPoint(frontsector->centerspot);
|
||||
fakeHeight = FLOAT2FIXED(fakeFloor->top.plane->ZatPoint(frontsector->centerspot));
|
||||
if (fakeHeight < viewz &&
|
||||
fakeHeight > frontsector->floorplane.ZatPoint(frontsector->centerspot))
|
||||
fakeHeight > FLOAT2FIXED(frontsector->floorplane.ZatPoint(frontsector->centerspot)))
|
||||
{
|
||||
fake3D = FAKE3D_FAKEFLOOR;
|
||||
tempsec = *fakeFloor->model;
|
||||
|
@ -1244,9 +1244,9 @@ void R_Subsector (subsector_t *sub)
|
|||
fakeFloor->validcount = validcount;
|
||||
R_3D_NewClip();
|
||||
}
|
||||
fakeHeight = fakeFloor->bottom.plane->ZatPoint(frontsector->centerspot);
|
||||
fakeHeight = FLOAT2FIXED(fakeFloor->bottom.plane->ZatPoint(frontsector->centerspot));
|
||||
if (fakeHeight > viewz &&
|
||||
fakeHeight < frontsector->ceilingplane.ZatPoint(frontsector->centerspot))
|
||||
fakeHeight < FLOAT2FIXED(frontsector->ceilingplane.ZatPoint(frontsector->centerspot)))
|
||||
{
|
||||
fake3D = FAKE3D_FAKECEILING;
|
||||
tempsec = *fakeFloor->model;
|
||||
|
|
11
src/r_defs.h
11
src/r_defs.h
|
@ -930,8 +930,8 @@ struct sector_t
|
|||
}
|
||||
|
||||
// Member variables
|
||||
fixed_t CenterFloor () const { return floorplane.ZatPoint (centerspot); }
|
||||
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (centerspot); }
|
||||
fixed_t CenterFloor () const { return floorplane.ZatPoint (_f_centerspot()); }
|
||||
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (_f_centerspot()); }
|
||||
|
||||
// [RH] store floor and ceiling planes instead of heights
|
||||
secplane_t floorplane, ceilingplane;
|
||||
|
@ -949,10 +949,15 @@ struct sector_t
|
|||
int sky;
|
||||
FNameNoInit SeqName; // Sound sequence name. Setting seqType non-negative will override this.
|
||||
|
||||
fixedvec2 centerspot; // origin for any sounds played by the sector
|
||||
DVector2 centerspot; // origin for any sounds played by the sector
|
||||
int validcount; // if == validcount, already checked
|
||||
AActor* thinglist; // list of mobjs in sector
|
||||
|
||||
fixedvec2 _f_centerspot() const
|
||||
{
|
||||
return{ FLOAT2FIXED(centerspot.X), FLOAT2FIXED(centerspot.Y) };
|
||||
}
|
||||
|
||||
// killough 8/28/98: friction is a sector property, not an mobj property.
|
||||
// these fields used to be in AActor, but presented performance problems
|
||||
// when processed as mobj properties. Fix is to make them sector properties.
|
||||
|
|
|
@ -709,8 +709,8 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
|
|||
}
|
||||
else
|
||||
{
|
||||
x = sector->centerspot.x;
|
||||
z = sector->centerspot.y;
|
||||
x = sector->_f_centerspot().x;
|
||||
z = sector->_f_centerspot().y;
|
||||
chanflags |= CHAN_LISTENERZ;
|
||||
}
|
||||
}
|
||||
|
@ -777,8 +777,8 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
|
|||
}
|
||||
else
|
||||
{
|
||||
*x = sec->centerspot.x;
|
||||
*y = sec->centerspot.y;
|
||||
*x = sec->_f_centerspot().x;
|
||||
*y = sec->_f_centerspot().y;
|
||||
}
|
||||
|
||||
// Set sound vertical position based on channel.
|
||||
|
|
Loading…
Reference in a new issue