mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- replaced all direct access to vertex coordinates with wrapper functions.
So that code replacement can be done piece by piece and not all at once.
This commit is contained in:
parent
8d071f85b3
commit
c7ae4688a3
26 changed files with 328 additions and 299 deletions
|
@ -78,8 +78,8 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const
|
||||||
|
|
||||||
if (ld->dx == 0)
|
if (ld->dx == 0)
|
||||||
{ // ST_VERTICAL
|
{ // ST_VERTICAL
|
||||||
p1 = m_Box[BOXRIGHT] < ld->v1->x;
|
p1 = m_Box[BOXRIGHT] < ld->v1->fixX();
|
||||||
p2 = m_Box[BOXLEFT] < ld->v1->x;
|
p2 = m_Box[BOXLEFT] < ld->v1->fixX();
|
||||||
if (ld->dy < 0)
|
if (ld->dy < 0)
|
||||||
{
|
{
|
||||||
p1 ^= 1;
|
p1 ^= 1;
|
||||||
|
@ -88,8 +88,8 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const
|
||||||
}
|
}
|
||||||
else if (ld->dy == 0)
|
else if (ld->dy == 0)
|
||||||
{ // ST_HORIZONTAL:
|
{ // ST_HORIZONTAL:
|
||||||
p1 = m_Box[BOXTOP] > ld->v1->y;
|
p1 = m_Box[BOXTOP] > ld->v1->fixY();
|
||||||
p2 = m_Box[BOXBOTTOM] > ld->v1->y;
|
p2 = m_Box[BOXBOTTOM] > ld->v1->fixY();
|
||||||
if (ld->dx < 0)
|
if (ld->dx < 0)
|
||||||
{
|
{
|
||||||
p1 ^= 1;
|
p1 ^= 1;
|
||||||
|
|
|
@ -64,8 +64,7 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
||||||
|
|
||||||
for (i = 0; i < vertCount; ++i)
|
for (i = 0; i < vertCount; ++i)
|
||||||
{
|
{
|
||||||
outVerts[i].x = Vertices[i].x;
|
outVerts[i].set(Vertices[i].x, Vertices[i].y);
|
||||||
outVerts[i].y = Vertices[i].y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subCount = Subsectors.Size();
|
subCount = Subsectors.Size();
|
||||||
|
@ -169,8 +168,7 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp)
|
||||||
bsp->Verts.Resize(Vertices.Size());
|
bsp->Verts.Resize(Vertices.Size());
|
||||||
for (i = 0; i < Vertices.Size(); ++i)
|
for (i = 0; i < Vertices.Size(); ++i)
|
||||||
{
|
{
|
||||||
bsp->Verts[i].x = Vertices[i].x;
|
bsp->Verts[i].set(Vertices[i].x, Vertices[i].y);
|
||||||
bsp->Verts[i].y = Vertices[i].y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bsp->Subsectors.Resize(Subsectors.Size());
|
bsp->Subsectors.Resize(Subsectors.Size());
|
||||||
|
@ -400,14 +398,14 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
|
||||||
{
|
{
|
||||||
Printf(PRINT_LOG, " Seg %5d%c(%5d,%5d)-(%5d,%5d) [%08x,%08x]-[%08x,%08x]\n", i,
|
Printf(PRINT_LOG, " Seg %5d%c(%5d,%5d)-(%5d,%5d) [%08x,%08x]-[%08x,%08x]\n", i,
|
||||||
segs[i].linedef == NULL ? '+' : ' ',
|
segs[i].linedef == NULL ? '+' : ' ',
|
||||||
segs[i].v1->x>>16,
|
segs[i].v1->fixX()>>16,
|
||||||
segs[i].v1->y>>16,
|
segs[i].v1->fixY()>>16,
|
||||||
segs[i].v2->x>>16,
|
segs[i].v2->fixX()>>16,
|
||||||
segs[i].v2->y>>16,
|
segs[i].v2->fixY()>>16,
|
||||||
segs[i].v1->x,
|
segs[i].v1->fixX(),
|
||||||
segs[i].v1->y,
|
segs[i].v1->fixY(),
|
||||||
segs[i].v2->x,
|
segs[i].v2->fixX(),
|
||||||
segs[i].v2->y);
|
segs[i].v2->fixY());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -96,14 +96,14 @@ void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max)
|
||||||
|
|
||||||
if (map[v1] == -1)
|
if (map[v1] == -1)
|
||||||
{
|
{
|
||||||
newvert.x = oldverts[v1].x;
|
newvert.x = oldverts[v1].fixX();
|
||||||
newvert.y = oldverts[v1].y;
|
newvert.y = oldverts[v1].fixY();
|
||||||
map[v1] = VertexMap->SelectVertexExact (newvert);
|
map[v1] = VertexMap->SelectVertexExact (newvert);
|
||||||
}
|
}
|
||||||
if (map[v2] == -1)
|
if (map[v2] == -1)
|
||||||
{
|
{
|
||||||
newvert.x = oldverts[v2].x;
|
newvert.x = oldverts[v2].fixX();
|
||||||
newvert.y = oldverts[v2].y;
|
newvert.y = oldverts[v2].fixY();
|
||||||
map[v2] = VertexMap->SelectVertexExact (newvert);
|
map[v2] = VertexMap->SelectVertexExact (newvert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,11 +222,11 @@ void FNodeBuilder::AddSegs(seg_t *segs, int numsegs)
|
||||||
|
|
||||||
seg.frontsector = segs[i].frontsector;
|
seg.frontsector = segs[i].frontsector;
|
||||||
seg.backsector = segs[i].backsector;
|
seg.backsector = segs[i].backsector;
|
||||||
vert.x = segs[i].v1->x;
|
vert.x = segs[i].v1->fixX();
|
||||||
vert.y = segs[i].v1->y;
|
vert.y = segs[i].v1->fixY();
|
||||||
seg.v1 = VertexMap->SelectVertexExact(vert);
|
seg.v1 = VertexMap->SelectVertexExact(vert);
|
||||||
vert.x = segs[i].v2->x;
|
vert.x = segs[i].v2->fixX();
|
||||||
vert.y = segs[i].v2->y;
|
vert.y = segs[i].v2->fixY();
|
||||||
seg.v2 = VertexMap->SelectVertexExact(vert);
|
seg.v2 = VertexMap->SelectVertexExact(vert);
|
||||||
seg.linedef = int(segs[i].linedef - Level.Lines);
|
seg.linedef = int(segs[i].linedef - Level.Lines);
|
||||||
seg.sidedef = segs[i].sidedef != NULL ? int(segs[i].sidedef - Level.Sides) : int(NO_SIDE);
|
seg.sidedef = segs[i].sidedef != NULL ? int(segs[i].sidedef - Level.Sides) : int(NO_SIDE);
|
||||||
|
@ -430,18 +430,18 @@ void FNodeBuilder::FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolySt
|
||||||
vertex_t mid;
|
vertex_t mid;
|
||||||
vertex_t center;
|
vertex_t center;
|
||||||
|
|
||||||
mid.x = bbox[BOXLEFT] + (bbox[BOXRIGHT]-bbox[BOXLEFT])/2;
|
mid.set(bbox[BOXLEFT] + (bbox[BOXRIGHT]-bbox[BOXLEFT])/2,
|
||||||
mid.y = bbox[BOXBOTTOM] + (bbox[BOXTOP]-bbox[BOXBOTTOM])/2;
|
bbox[BOXBOTTOM] + (bbox[BOXTOP]-bbox[BOXBOTTOM])/2);
|
||||||
|
|
||||||
center.x = mid.x - anchor->x + spot->x;
|
center.set(mid.fixX() - anchor->x + spot->x,
|
||||||
center.y = mid.y - anchor->y + spot->y;
|
mid.fixY() - anchor->y + spot->y);
|
||||||
|
|
||||||
// Scan right for the seg closest to the polyobject's center after it
|
// Scan right for the seg closest to the polyobject's center after it
|
||||||
// gets moved to its start spot.
|
// gets moved to its start spot.
|
||||||
fixed_t closestdist = FIXED_MAX;
|
fixed_t closestdist = FIXED_MAX;
|
||||||
unsigned int closestseg = UINT_MAX;
|
unsigned int closestseg = UINT_MAX;
|
||||||
|
|
||||||
P(Printf ("start %d,%d -- center %d, %d\n", spot->x>>16, spot->y>>16, center.x>>16, center.y>>16));
|
P(Printf ("start %d,%d -- center %d, %d\n", spot->x>>16, spot->y>>16, center.fixX()>>16, center.fixY()>>16));
|
||||||
|
|
||||||
for (unsigned int j = 0; j < Segs.Size(); ++j)
|
for (unsigned int j = 0; j < Segs.Size(); ++j)
|
||||||
{
|
{
|
||||||
|
@ -454,16 +454,16 @@ void FNodeBuilder::FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolySt
|
||||||
{ // Horizontal, so skip it
|
{ // Horizontal, so skip it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((v1->y < center.y && v2->y < center.y) || (v1->y > center.y && v2->y > center.y))
|
if ((v1->y < center.fixY() && v2->y < center.fixY()) || (v1->y > center.fixY() && v2->y > center.fixY()))
|
||||||
{ // Not crossed
|
{ // Not crossed
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t dx = v2->x - v1->x;
|
fixed_t dx = v2->x - v1->x;
|
||||||
|
|
||||||
if (PointOnSide (center.x, center.y, v1->x, v1->y, dx, dy) <= 0)
|
if (PointOnSide (center.fixX(), center.fixY(), v1->x, v1->y, dx, dy) <= 0)
|
||||||
{
|
{
|
||||||
fixed_t t = DivScale30 (center.y - v1->y, dy);
|
fixed_t t = DivScale30 (center.fixY() - v1->y, dy);
|
||||||
fixed_t sx = v1->x + MulScale30 (dx, t);
|
fixed_t sx = v1->x + MulScale30 (dx, t);
|
||||||
fixed_t dist = sx - spot->x;
|
fixed_t dist = sx - spot->x;
|
||||||
|
|
||||||
|
@ -565,8 +565,7 @@ bool FNodeBuilder::GetPolyExtents (int polynum, fixed_t bbox[4])
|
||||||
|
|
||||||
vert = Segs[i].v1;
|
vert = Segs[i].v1;
|
||||||
|
|
||||||
start.x = Vertices[vert].x;
|
start.set(Vertices[vert].x, Vertices[vert].y);
|
||||||
start.y = Vertices[vert].y;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -574,7 +573,7 @@ bool FNodeBuilder::GetPolyExtents (int polynum, fixed_t bbox[4])
|
||||||
vert = Segs[i].v2;
|
vert = Segs[i].v2;
|
||||||
i = Vertices[vert].segs;
|
i = Vertices[vert].segs;
|
||||||
count++; // to prevent endless loops. Stop when this reaches the number of segs.
|
count++; // to prevent endless loops. Stop when this reaches the number of segs.
|
||||||
} while (i != DWORD_MAX && (Vertices[vert].x != start.x || Vertices[vert].y != start.y) && count < Segs.Size());
|
} while (i != DWORD_MAX && (Vertices[vert].x != start.fixX() || Vertices[vert].y != start.fixY()) && count < Segs.Size());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -614,15 +613,15 @@ void FNodeBuilder::FLevel::FindMapBounds ()
|
||||||
{
|
{
|
||||||
fixed_t minx, maxx, miny, maxy;
|
fixed_t minx, maxx, miny, maxy;
|
||||||
|
|
||||||
minx = maxx = Vertices[0].x;
|
minx = maxx = Vertices[0].fixX();
|
||||||
miny = maxy = Vertices[0].y;
|
miny = maxy = Vertices[0].fixY();
|
||||||
|
|
||||||
for (int i = 1; i < NumVertices; ++i)
|
for (int i = 1; i < NumVertices; ++i)
|
||||||
{
|
{
|
||||||
if (Vertices[i].x < minx) minx = Vertices[i].x;
|
if (Vertices[i].fixX() < minx) minx = Vertices[i].fixX();
|
||||||
else if (Vertices[i].x > maxx) maxx = Vertices[i].x;
|
else if (Vertices[i].fixX() > maxx) maxx = Vertices[i].fixX();
|
||||||
if (Vertices[i].y < miny) miny = Vertices[i].y;
|
if (Vertices[i].fixY() < miny) miny = Vertices[i].fixY();
|
||||||
else if (Vertices[i].y > maxy) maxy = Vertices[i].y;
|
else if (Vertices[i].fixY() > maxy) maxy = Vertices[i].fixY();
|
||||||
}
|
}
|
||||||
|
|
||||||
MinX = minx;
|
MinX = minx;
|
||||||
|
|
|
@ -764,13 +764,12 @@ vertex_t *FindVertex (SDWORD x, SDWORD y)
|
||||||
|
|
||||||
for (i = 0; i < numvertexes; ++i)
|
for (i = 0; i < numvertexes; ++i)
|
||||||
{
|
{
|
||||||
if (vertexes[i].x == x && vertexes[i].y == y)
|
if (vertexes[i].fixX() == x && vertexes[i].fixY() == y)
|
||||||
{
|
{
|
||||||
return &vertexes[i];
|
return &vertexes[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vertexes[i].x = x;
|
vertexes[i].set(x, y);
|
||||||
vertexes[i].y = y;
|
|
||||||
numvertexes++;
|
numvertexes++;
|
||||||
return &vertexes[i];
|
return &vertexes[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,12 +162,12 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
||||||
// I wish there was a better method to do this than randomly looking through the portal at a few places...
|
// I wish there was a better method to do this than randomly looking through the portal at a few places...
|
||||||
if (checkabove)
|
if (checkabove)
|
||||||
{
|
{
|
||||||
sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::ceiling]->Scale);
|
sector_t *upper = P_PointInSector(check->V1() + check->Delta() / 2 + sec->SkyBoxes[sector_t::ceiling]->Scale);
|
||||||
P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist);
|
P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist);
|
||||||
}
|
}
|
||||||
if (checkbelow)
|
if (checkbelow)
|
||||||
{
|
{
|
||||||
sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::floor]->Scale);
|
sector_t *lower = P_PointInSector(check->V1() + check->Delta() / 2 + sec->SkyBoxes[sector_t::floor]->Scale);
|
||||||
P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist);
|
P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist);
|
||||||
}
|
}
|
||||||
FLinePortal *port = check->getPortal();
|
FLinePortal *port = check->getPortal();
|
||||||
|
@ -195,18 +195,18 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
||||||
other = check->sidedef[0]->sector;
|
other = check->sidedef[0]->sector;
|
||||||
|
|
||||||
// check for closed door
|
// check for closed door
|
||||||
if ((sec->floorplane.ZatPoint (check->v1->fPos()) >=
|
if ((sec->floorplane.ZatPoint (check->V1()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
other->ceilingplane.ZatPoint (check->V1()) &&
|
||||||
sec->floorplane.ZatPoint (check->v2->fPos()) >=
|
sec->floorplane.ZatPoint (check->V2()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v2->fPos()))
|
other->ceilingplane.ZatPoint (check->V2()))
|
||||||
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
|
|| (other->floorplane.ZatPoint (check->V1()) >=
|
||||||
sec->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
sec->ceilingplane.ZatPoint (check->V1()) &&
|
||||||
other->floorplane.ZatPoint (check->v2->fPos()) >=
|
other->floorplane.ZatPoint (check->V2()) >=
|
||||||
sec->ceilingplane.ZatPoint (check->v2->fPos()))
|
sec->ceilingplane.ZatPoint (check->V2()))
|
||||||
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
|
|| (other->floorplane.ZatPoint (check->V1()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
other->ceilingplane.ZatPoint (check->V1()) &&
|
||||||
other->floorplane.ZatPoint (check->v2->fPos()) >=
|
other->floorplane.ZatPoint (check->V2()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v2->fPos())))
|
other->ceilingplane.ZatPoint (check->V2())))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int CheckForMissingSegs()
|
||||||
if (seg->sidedef!=NULL)
|
if (seg->sidedef!=NULL)
|
||||||
{
|
{
|
||||||
// check all the segs and calculate the length they occupy on their sidedef
|
// check all the segs and calculate the length they occupy on their sidedef
|
||||||
DVector2 vec1(seg->v2->x - seg->v1->x, seg->v2->y - seg->v1->y);
|
DVector2 vec1(seg->v2->fixX() - seg->v1->fixX(), seg->v2->fixY() - seg->v1->fixY());
|
||||||
added_seglen[seg->sidedef - sides] += float(vec1.Length());
|
added_seglen[seg->sidedef - sides] += float(vec1.Length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,8 +268,7 @@ static bool LoadGLVertexes(FileReader * lump)
|
||||||
|
|
||||||
for (i = firstglvertex; i < numvertexes; i++)
|
for (i = firstglvertex; i < numvertexes; i++)
|
||||||
{
|
{
|
||||||
vertexes[i].x = LittleLong(mgl->x);
|
vertexes[i].set(LittleLong(mgl->x), LittleLong(mgl->y));
|
||||||
vertexes[i].y = LittleLong(mgl->y);
|
|
||||||
mgl++;
|
mgl++;
|
||||||
}
|
}
|
||||||
delete[] gldata;
|
delete[] gldata;
|
||||||
|
@ -1102,8 +1101,8 @@ static void CreateCachedNodes(MapData *map)
|
||||||
WriteLong(ZNodes, numvertexes);
|
WriteLong(ZNodes, numvertexes);
|
||||||
for(int i=0;i<numvertexes;i++)
|
for(int i=0;i<numvertexes;i++)
|
||||||
{
|
{
|
||||||
WriteLong(ZNodes, vertexes[i].x);
|
WriteLong(ZNodes, vertexes[i].fixX());
|
||||||
WriteLong(ZNodes, vertexes[i].y);
|
WriteLong(ZNodes, vertexes[i].fixY());
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLong(ZNodes, numsubsectors);
|
WriteLong(ZNodes, numsubsectors);
|
||||||
|
@ -1492,7 +1491,7 @@ void P_SetRenderSector()
|
||||||
ss->flags |= SSECF_DEGENERATE;
|
ss->flags |= SSECF_DEGENERATE;
|
||||||
for(j=2; j<ss->numlines; j++)
|
for(j=2; j<ss->numlines; j++)
|
||||||
{
|
{
|
||||||
if (!PointOnLine(seg[j].v1->x, seg[j].v1->y, seg->v1->x, seg->v1->y, seg->v2->x-seg->v1->x, seg->v2->y-seg->v1->y))
|
if (!PointOnLine(seg[j].v1->fixX(), seg[j].v1->fixY(), seg->v1->fixX(), seg->v1->fixY(), seg->v2->fixX() -seg->v1->fixX(), seg->v2->fixY() -seg->v1->fixY()))
|
||||||
{
|
{
|
||||||
// Not on the same line
|
// Not on the same line
|
||||||
ss->flags &= ~SSECF_DEGENERATE;
|
ss->flags &= ~SSECF_DEGENERATE;
|
||||||
|
|
|
@ -109,7 +109,7 @@ static DVector2 FindRefPoint(line_t *ld, const DVector2 &pos)
|
||||||
!ld->frontsector->PortalBlocksMovement(sector_t::floor))
|
!ld->frontsector->PortalBlocksMovement(sector_t::floor))
|
||||||
{
|
{
|
||||||
|
|
||||||
DVector2 v1 = ld->v1->fPos();
|
DVector2 v1 = ld->V1();
|
||||||
DVector2 d = ld->Delta();
|
DVector2 d = ld->Delta();
|
||||||
double r = clamp(((pos.X - v1.X) * d.X + (pos.Y - v1.Y) * d.Y) / (d.X*d.X + d.Y*d.Y), 0., 1.);
|
double r = clamp(((pos.X - v1.X) * d.X + (pos.Y - v1.Y) * d.Y) / (d.X*d.X + d.Y*d.Y), 0., 1.);
|
||||||
return v1 + d*r;
|
return v1 + d*r;
|
||||||
|
|
|
@ -104,7 +104,7 @@ fixed_t P_InterceptVector (const fdivline_t *v2, const fdivline_t *v1)
|
||||||
SQWORD den = ( ((SQWORD)v1->dy*v2->dx - (SQWORD)v1->dx*v2->dy) >> FRACBITS );
|
SQWORD den = ( ((SQWORD)v1->dy*v2->dx - (SQWORD)v1->dx*v2->dy) >> FRACBITS );
|
||||||
if (den == 0)
|
if (den == 0)
|
||||||
return 0; // parallel
|
return 0; // parallel
|
||||||
SQWORD num = ((SQWORD)(v1->x - v2->x)*v1->dy + (SQWORD)(v2->y - v1->y)*v1->dx);
|
SQWORD num = ((SQWORD)(v1->fixX() - v2->fixX())*v1->dy + (SQWORD)(v2->fixY() - v1->fixY())*v1->dx);
|
||||||
return (fixed_t)(num / den);
|
return (fixed_t)(num / den);
|
||||||
|
|
||||||
#elif 0 // This is the original Doom version
|
#elif 0 // This is the original Doom version
|
||||||
|
@ -120,8 +120,8 @@ fixed_t P_InterceptVector (const fdivline_t *v2, const fdivline_t *v1)
|
||||||
// I_Error ("P_InterceptVector: parallel");
|
// I_Error ("P_InterceptVector: parallel");
|
||||||
|
|
||||||
num =
|
num =
|
||||||
FixedMul ( (v1->x - v2->x)>>8 ,v1->dy )
|
FixedMul ( (v1->fixX() - v2->fixX())>>8 ,v1->dy )
|
||||||
+FixedMul ( (v2->y - v1->y)>>8, v1->dx );
|
+FixedMul ( (v2->fixY() - v1->fixY())>>8, v1->dx );
|
||||||
|
|
||||||
frac = FixedDiv (num , den);
|
frac = FixedDiv (num , den);
|
||||||
|
|
||||||
|
@ -1230,8 +1230,8 @@ void FPathTraverse::AddLineIntercepts(int bx, int by)
|
||||||
|| trace.dx < -FRACUNIT*16
|
|| trace.dx < -FRACUNIT*16
|
||||||
|| trace.dy < -FRACUNIT*16)
|
|| trace.dy < -FRACUNIT*16)
|
||||||
{
|
{
|
||||||
s1 = P_PointOnDivlineSide (ld->v1->x, ld->v1->y, &trace);
|
s1 = P_PointOnDivlineSide (ld->v1->fixX(), ld->v1->fixY(), &trace);
|
||||||
s2 = P_PointOnDivlineSide (ld->v2->x, ld->v2->y, &trace);
|
s2 = P_PointOnDivlineSide (ld->v2->fixX(), ld->v2->fixY(), &trace);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1939,21 +1939,21 @@ int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line)
|
||||||
|
|
||||||
if (!line->dx)
|
if (!line->dx)
|
||||||
{
|
{
|
||||||
if (x <= line->v1->x)
|
if (x <= line->v1->fixX())
|
||||||
return line->dy > 0;
|
return line->dy > 0;
|
||||||
|
|
||||||
return line->dy < 0;
|
return line->dy < 0;
|
||||||
}
|
}
|
||||||
if (!line->dy)
|
if (!line->dy)
|
||||||
{
|
{
|
||||||
if (y <= line->v1->y)
|
if (y <= line->v1->fixY())
|
||||||
return line->dx < 0;
|
return line->dx < 0;
|
||||||
|
|
||||||
return line->dx > 0;
|
return line->dx > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = (x - line->v1->x);
|
dx = (x - line->v1->fixX());
|
||||||
dy = (y - line->v1->y);
|
dy = (y - line->v1->fixY());
|
||||||
|
|
||||||
left = FixedMul ( line->dy>>FRACBITS , dx );
|
left = FixedMul ( line->dy>>FRACBITS , dx );
|
||||||
right = FixedMul ( dy , line->dx>>FRACBITS );
|
right = FixedMul ( dy , line->dx>>FRACBITS );
|
||||||
|
|
|
@ -45,18 +45,20 @@ struct intercept_t
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
const double POL_Epsilon = -1. / 65536.;
|
||||||
|
|
||||||
inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
|
inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
|
||||||
{
|
{
|
||||||
extern int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line);
|
extern int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line);
|
||||||
|
|
||||||
return i_compatflags2 & COMPATF2_POINTONLINE
|
return i_compatflags2 & COMPATF2_POINTONLINE
|
||||||
? P_VanillaPointOnLineSide(x, y, line)
|
? P_VanillaPointOnLineSide(x, y, line)
|
||||||
: DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
|
: DMulScale32 (y-line->v1->fixY(), line->dx, line->v1->fixX()-x, line->dy) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
|
inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
|
||||||
{
|
{
|
||||||
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
|
return DMulScale32 (y-line->v1->fixY(), line->dx, line->v1->fixX()-x, line->dy) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnLineSide(double x, double y, const line_t *line)
|
inline int P_PointOnLineSide(double x, double y, const line_t *line)
|
||||||
|
@ -71,12 +73,12 @@ inline int P_PointOnLineSide(const DVector2 & p, const line_t *line)
|
||||||
|
|
||||||
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
|
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
|
||||||
{
|
{
|
||||||
return DMulScale32(FLOAT2FIXED(y) - line->v1->y, line->dx, line->v1->x - FLOAT2FIXED(x), line->dy) > 0;
|
return (y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - x) * line->Delta().Y > POL_Epsilon ;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
|
inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
|
||||||
{
|
{
|
||||||
return DMulScale32(FLOAT2FIXED(pt.Y) - line->v1->y, line->dx, line->v1->x - FLOAT2FIXED(pt.X), line->dy) > 0;
|
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > POL_Epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,8 +123,8 @@ inline int P_PointOnDivlineSidePrecise(const DVector2 &pos, const divline_t *lin
|
||||||
|
|
||||||
inline void P_MakeDivline (const line_t *li, fdivline_t *dl)
|
inline void P_MakeDivline (const line_t *li, fdivline_t *dl)
|
||||||
{
|
{
|
||||||
dl->x = li->v1->x;
|
dl->x = li->v1->fixX();
|
||||||
dl->y = li->v1->y;
|
dl->y = li->v1->fixY();
|
||||||
dl->dx = li->dx;
|
dl->dx = li->dx;
|
||||||
dl->dy = li->dy;
|
dl->dy = li->dy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1401,9 +1401,9 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
|
||||||
den = line->Delta().LengthSquared();
|
den = line->Delta().LengthSquared();
|
||||||
if (den != 0)
|
if (den != 0)
|
||||||
{
|
{
|
||||||
frac = clamp<double>((mo->Pos() - line->v1->fPos()) | line->Delta(), 0, den) / den;
|
frac = clamp<double>((mo->Pos() - line->V1()) | line->Delta(), 0, den) / den;
|
||||||
|
|
||||||
linepos = DVector3(line->v1->fPos() + line->Delta() * frac, pos.Z);
|
linepos = DVector3(line->V1() + line->Delta() * frac, pos.Z);
|
||||||
|
|
||||||
F3DFloor * ffloor=NULL;
|
F3DFloor * ffloor=NULL;
|
||||||
if (line->sidedef[side^1] != NULL)
|
if (line->sidedef[side^1] != NULL)
|
||||||
|
|
|
@ -725,34 +725,34 @@ void sector_t::ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy) co
|
||||||
{
|
{
|
||||||
vertex_t *v1 = lines[i]->v1;
|
vertex_t *v1 = lines[i]->v1;
|
||||||
vertex_t *v2 = lines[i]->v2;
|
vertex_t *v2 = lines[i]->v2;
|
||||||
double a = v2->x - v1->x;
|
double a = v2->fixX() - v1->fixX();
|
||||||
double b = v2->y - v1->y;
|
double b = v2->fixY() - v1->fixY();
|
||||||
double den = a*a + b*b;
|
double den = a*a + b*b;
|
||||||
double ix, iy, dist;
|
double ix, iy, dist;
|
||||||
|
|
||||||
if (den == 0)
|
if (den == 0)
|
||||||
{ // Line is actually a point!
|
{ // Line is actually a point!
|
||||||
ix = v1->x;
|
ix = v1->fixX();
|
||||||
iy = v1->y;
|
iy = v1->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double num = (x - v1->x) * a + (y - v1->y) * b;
|
double num = (x - v1->fixX()) * a + (y - v1->fixY()) * b;
|
||||||
double u = num / den;
|
double u = num / den;
|
||||||
if (u <= 0)
|
if (u <= 0)
|
||||||
{
|
{
|
||||||
ix = v1->x;
|
ix = v1->fixX();
|
||||||
iy = v1->y;
|
iy = v1->fixY();
|
||||||
}
|
}
|
||||||
else if (u >= 1)
|
else if (u >= 1)
|
||||||
{
|
{
|
||||||
ix = v2->x;
|
ix = v2->fixX();
|
||||||
iy = v2->y;
|
iy = v2->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ix = v1->x + u * a;
|
ix = v1->fixX() + u * a;
|
||||||
iy = v1->y + u * b;
|
iy = v1->fixY() + u * b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a = (ix - x);
|
a = (ix - x);
|
||||||
|
@ -1136,10 +1136,10 @@ bool P_AlignFlat (int linenum, int side, int fc)
|
||||||
if (!sec)
|
if (!sec)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fixed_t x = line->v1->x;
|
fixed_t x = line->v1->fixX();
|
||||||
fixed_t y = line->v1->y;
|
fixed_t y = line->v1->fixY();
|
||||||
|
|
||||||
angle_t angle = R_PointToAngle2 (x, y, line->v2->x, line->v2->y);
|
angle_t angle = R_PointToAngle2 (x, y, line->v2->fixX(), line->v2->fixY());
|
||||||
angle_t norm = (angle-ANGLE_90) >> ANGLETOFINESHIFT;
|
angle_t norm = (angle-ANGLE_90) >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
fixed_t dist = -DMulScale16 (finecosine[norm], x, finesine[norm], y);
|
fixed_t dist = -DMulScale16 (finecosine[norm], x, finesine[norm], y);
|
||||||
|
|
107
src/p_setup.cpp
107
src/p_setup.cpp
|
@ -864,8 +864,7 @@ void P_LoadVertexes (MapData * map)
|
||||||
SWORD x, y;
|
SWORD x, y;
|
||||||
|
|
||||||
(*map->file) >> x >> y;
|
(*map->file) >> x >> y;
|
||||||
vertexes[i].x = x << FRACBITS;
|
vertexes[i].set(x << FRACBITS, y << FRACBITS);
|
||||||
vertexes[i].y = y << FRACBITS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,7 +1002,9 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
||||||
}
|
}
|
||||||
for (i = 0; i < newVerts; ++i)
|
for (i = 0; i < newVerts; ++i)
|
||||||
{
|
{
|
||||||
data >> newvertarray[i + orgVerts].x >> newvertarray[i + orgVerts].y;
|
fixed_t x, y;
|
||||||
|
data >> x >> y;
|
||||||
|
newvertarray[i + orgVerts].set(x, y);
|
||||||
}
|
}
|
||||||
if (vertexes != newvertarray)
|
if (vertexes != newvertarray)
|
||||||
{
|
{
|
||||||
|
@ -1316,28 +1317,30 @@ void P_LoadSegs (MapData * map)
|
||||||
// off, then move one vertex. This may seem insignificant, but one degree
|
// off, then move one vertex. This may seem insignificant, but one degree
|
||||||
// errors _can_ cause firelines.
|
// errors _can_ cause firelines.
|
||||||
|
|
||||||
ptp_angle = R_PointToAngle2 (li->v1->x, li->v1->y, li->v2->x, li->v2->y);
|
ptp_angle = R_PointToAngle2 (li->v1->fixX(), li->v1->fixY(), li->v2->fixX(), li->v2->fixY());
|
||||||
dis = 0;
|
dis = 0;
|
||||||
delta_angle = (absangle(ptp_angle-(segangle<<16))>>ANGLETOFINESHIFT)*360/FINEANGLES;
|
delta_angle = (absangle(ptp_angle-(segangle<<16))>>ANGLETOFINESHIFT)*360/FINEANGLES;
|
||||||
|
|
||||||
if (delta_angle != 0)
|
if (delta_angle != 0)
|
||||||
{
|
{
|
||||||
segangle >>= (ANGLETOFINESHIFT-16);
|
segangle >>= (ANGLETOFINESHIFT-16);
|
||||||
dx = (li->v1->x - li->v2->x)>>FRACBITS;
|
dx = (li->v1->fixX() - li->v2->fixX())>>FRACBITS;
|
||||||
dy = (li->v1->y - li->v2->y)>>FRACBITS;
|
dy = (li->v1->fixY() - li->v2->fixY())>>FRACBITS;
|
||||||
dis = ((int) g_sqrt((double)(dx*dx + dy*dy)))<<FRACBITS;
|
dis = ((int) g_sqrt((double)(dx*dx + dy*dy)))<<FRACBITS;
|
||||||
dx = finecosine[segangle];
|
dx = finecosine[segangle];
|
||||||
dy = finesine[segangle];
|
dy = finesine[segangle];
|
||||||
if ((vnum2 > vnum1) && (vertchanged[vnum2] == 0))
|
if ((vnum2 > vnum1) && (vertchanged[vnum2] == 0))
|
||||||
{
|
{
|
||||||
li->v2->x = li->v1->x + FixedMul(dis,dx);
|
li->v2->set(
|
||||||
li->v2->y = li->v1->y + FixedMul(dis,dy);
|
li->v1->fixX() + FixedMul(dis,dx),
|
||||||
|
li->v1->fixY() + FixedMul(dis,dy));
|
||||||
vertchanged[vnum2] = 1; // this was changed
|
vertchanged[vnum2] = 1; // this was changed
|
||||||
}
|
}
|
||||||
else if (vertchanged[vnum1] == 0)
|
else if (vertchanged[vnum1] == 0)
|
||||||
{
|
{
|
||||||
li->v1->x = li->v2->x - FixedMul(dis,dx);
|
li->v1->set(
|
||||||
li->v1->y = li->v2->y - FixedMul(dis,dy);
|
li->v2->fixX() - FixedMul(dis,dx),
|
||||||
|
li->v2->fixY() - FixedMul(dis,dy));
|
||||||
vertchanged[vnum1] = 1; // this was changed
|
vertchanged[vnum1] = 1; // this was changed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1904,29 +1907,29 @@ void P_AdjustLine (line_t *ld)
|
||||||
v1 = ld->v1;
|
v1 = ld->v1;
|
||||||
v2 = ld->v2;
|
v2 = ld->v2;
|
||||||
|
|
||||||
ld->dx = v2->x - v1->x;
|
ld->dx = v2->fixX() - v1->fixX();
|
||||||
ld->dy = v2->y - v1->y;
|
ld->dy = v2->fixY() - v1->fixY();
|
||||||
|
|
||||||
if (v1->x < v2->x)
|
if (v1->fixX() < v2->fixX())
|
||||||
{
|
{
|
||||||
ld->bbox[BOXLEFT] = v1->x;
|
ld->bbox[BOXLEFT] = v1->fixX();
|
||||||
ld->bbox[BOXRIGHT] = v2->x;
|
ld->bbox[BOXRIGHT] = v2->fixX();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ld->bbox[BOXLEFT] = v2->x;
|
ld->bbox[BOXLEFT] = v2->fixX();
|
||||||
ld->bbox[BOXRIGHT] = v1->x;
|
ld->bbox[BOXRIGHT] = v1->fixX();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v1->y < v2->y)
|
if (v1->fixY() < v2->fixY())
|
||||||
{
|
{
|
||||||
ld->bbox[BOXBOTTOM] = v1->y;
|
ld->bbox[BOXBOTTOM] = v1->fixY();
|
||||||
ld->bbox[BOXTOP] = v2->y;
|
ld->bbox[BOXTOP] = v2->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ld->bbox[BOXBOTTOM] = v2->y;
|
ld->bbox[BOXBOTTOM] = v2->fixY();
|
||||||
ld->bbox[BOXTOP] = v1->y;
|
ld->bbox[BOXTOP] = v1->fixY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2015,8 +2018,8 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
||||||
|
|
||||||
ld->frontsector = ld->sidedef[0] != NULL ? ld->sidedef[0]->sector : NULL;
|
ld->frontsector = ld->sidedef[0] != NULL ? ld->sidedef[0]->sector : NULL;
|
||||||
ld->backsector = ld->sidedef[1] != NULL ? ld->sidedef[1]->sector : NULL;
|
ld->backsector = ld->sidedef[1] != NULL ? ld->sidedef[1]->sector : NULL;
|
||||||
double dx = FIXED2DBL(ld->v2->x - ld->v1->x);
|
double dx = FIXED2DBL(ld->v2->fixX() - ld->v1->fixX());
|
||||||
double dy = FIXED2DBL(ld->v2->y - ld->v1->y);
|
double dy = FIXED2DBL(ld->v2->fixY() - ld->v1->fixY());
|
||||||
int linenum = int(ld-lines);
|
int linenum = int(ld-lines);
|
||||||
|
|
||||||
if (ld->frontsector == NULL)
|
if (ld->frontsector == NULL)
|
||||||
|
@ -2141,8 +2144,8 @@ void P_LoadLineDefs (MapData * map)
|
||||||
I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %d vertices.", i+skipped, v1, v2, numvertexes);
|
I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %d vertices.", i+skipped, v1, v2, numvertexes);
|
||||||
}
|
}
|
||||||
else if (v1 == v2 ||
|
else if (v1 == v2 ||
|
||||||
(vertexes[LittleShort(mld->v1)].x == vertexes[LittleShort(mld->v2)].x &&
|
(vertexes[LittleShort(mld->v1)].fixX() == vertexes[LittleShort(mld->v2)].fixX() &&
|
||||||
vertexes[LittleShort(mld->v1)].y == vertexes[LittleShort(mld->v2)].y))
|
vertexes[LittleShort(mld->v1)].fixY() == vertexes[LittleShort(mld->v2)].fixY()))
|
||||||
{
|
{
|
||||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||||
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
||||||
|
@ -2230,8 +2233,8 @@ void P_LoadLineDefs2 (MapData * map)
|
||||||
mld = ((maplinedef2_t*)mldf) + i;
|
mld = ((maplinedef2_t*)mldf) + i;
|
||||||
|
|
||||||
if (mld->v1 == mld->v2 ||
|
if (mld->v1 == mld->v2 ||
|
||||||
(vertexes[LittleShort(mld->v1)].x == vertexes[LittleShort(mld->v2)].x &&
|
(vertexes[LittleShort(mld->v1)].fixX() == vertexes[LittleShort(mld->v2)].fixX() &&
|
||||||
vertexes[LittleShort(mld->v1)].y == vertexes[LittleShort(mld->v2)].y))
|
vertexes[LittleShort(mld->v1)].fixY() == vertexes[LittleShort(mld->v2)].fixY()))
|
||||||
{
|
{
|
||||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||||
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
||||||
|
@ -2794,15 +2797,15 @@ static void P_CreateBlockMap ()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find map extents for the blockmap
|
// Find map extents for the blockmap
|
||||||
minx = maxx = vertexes[0].x;
|
minx = maxx = vertexes[0].fixX();
|
||||||
miny = maxy = vertexes[0].y;
|
miny = maxy = vertexes[0].fixY();
|
||||||
|
|
||||||
for (i = 1; i < numvertexes; ++i)
|
for (i = 1; i < numvertexes; ++i)
|
||||||
{
|
{
|
||||||
if (vertexes[i].x < minx) minx = vertexes[i].x;
|
if (vertexes[i].fixX() < minx) minx = vertexes[i].fixX();
|
||||||
else if (vertexes[i].x > maxx) maxx = vertexes[i].x;
|
else if (vertexes[i].fixX() > maxx) maxx = vertexes[i].fixX();
|
||||||
if (vertexes[i].y < miny) miny = vertexes[i].y;
|
if (vertexes[i].fixY() < miny) miny = vertexes[i].fixY();
|
||||||
else if (vertexes[i].y > maxy) maxy = vertexes[i].y;
|
else if (vertexes[i].fixY() > maxy) maxy = vertexes[i].fixY();
|
||||||
}
|
}
|
||||||
|
|
||||||
maxx >>= FRACBITS;
|
maxx >>= FRACBITS;
|
||||||
|
@ -2824,10 +2827,10 @@ static void P_CreateBlockMap ()
|
||||||
|
|
||||||
for (line = 0; line < numlines; ++line)
|
for (line = 0; line < numlines; ++line)
|
||||||
{
|
{
|
||||||
int x1 = lines[line].v1->x >> FRACBITS;
|
int x1 = lines[line].v1->fixX() >> FRACBITS;
|
||||||
int y1 = lines[line].v1->y >> FRACBITS;
|
int y1 = lines[line].v1->fixY() >> FRACBITS;
|
||||||
int x2 = lines[line].v2->x >> FRACBITS;
|
int x2 = lines[line].v2->fixX() >> FRACBITS;
|
||||||
int y2 = lines[line].v2->y >> FRACBITS;
|
int y2 = lines[line].v2->fixY() >> FRACBITS;
|
||||||
int dx = x2 - x1;
|
int dx = x2 - x1;
|
||||||
int dy = y2 - y1;
|
int dy = y2 - y1;
|
||||||
int bx = (x1 - minx) >> BLOCKBITS;
|
int bx = (x1 - minx) >> BLOCKBITS;
|
||||||
|
@ -3217,8 +3220,8 @@ static void P_GroupLines (bool buildmap)
|
||||||
for (j = 0; j < sector->linecount; ++j)
|
for (j = 0; j < sector->linecount; ++j)
|
||||||
{
|
{
|
||||||
li = sector->lines[j];
|
li = sector->lines[j];
|
||||||
bbox.AddToBox (li->v1->x, li->v1->y);
|
bbox.AddToBox (li->v1->fixX(), li->v1->fixY());
|
||||||
bbox.AddToBox (li->v2->x, li->v2->y);
|
bbox.AddToBox (li->v2->fixX(), li->v2->fixY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3234,8 +3237,8 @@ static void P_GroupLines (bool buildmap)
|
||||||
Triangle[1] = sector->lines[0]->v2;
|
Triangle[1] = sector->lines[0]->v2;
|
||||||
if (sector->linecount > 1)
|
if (sector->linecount > 1)
|
||||||
{
|
{
|
||||||
fixed_t dx = Triangle[1]->x - Triangle[0]->x;
|
fixed_t dx = Triangle[1]->fixX() - Triangle[0]->fixX();
|
||||||
fixed_t dy = Triangle[1]->y - Triangle[0]->y;
|
fixed_t dy = Triangle[1]->fixY() - Triangle[0]->fixY();
|
||||||
// Find another point in the sector that does not lie
|
// Find another point in the sector that does not lie
|
||||||
// on the same line as the first two points.
|
// on the same line as the first two points.
|
||||||
for (j = 0; j < 2; ++j)
|
for (j = 0; j < 2; ++j)
|
||||||
|
@ -3243,11 +3246,11 @@ static void P_GroupLines (bool buildmap)
|
||||||
vertex_t *v;
|
vertex_t *v;
|
||||||
|
|
||||||
v = (j == 1) ? sector->lines[1]->v1 : sector->lines[1]->v2;
|
v = (j == 1) ? sector->lines[1]->v1 : sector->lines[1]->v2;
|
||||||
if (DMulScale32 (v->y - Triangle[0]->y, dx,
|
if (DMulScale32 (v->fixY() - Triangle[0]->fixY(), dx,
|
||||||
Triangle[0]->x - v->x, dy) != 0)
|
Triangle[0]->fixX() - v->fixX(), dy) != 0)
|
||||||
{
|
{
|
||||||
sector->centerspot.X = FIXED2DBL(Triangle[0]->x / 3 + Triangle[1]->x / 3 + v->x / 3);
|
sector->centerspot.X = FIXED2DBL(Triangle[0]->fixX() / 3 + Triangle[1]->fixX() / 3 + v->fixX() / 3);
|
||||||
sector->centerspot.Y = FIXED2DBL(Triangle[0]->y / 3 + Triangle[1]->y / 3 + v->y / 3);
|
sector->centerspot.Y = FIXED2DBL(Triangle[0]->fixY() / 3 + Triangle[1]->fixY() / 3 + v->fixY() / 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3926,8 +3929,8 @@ void P_SetupLevel (const char *lumpname, int position)
|
||||||
seg_t * seg=&segs[i];
|
seg_t * seg=&segs[i];
|
||||||
if (seg->backsector == seg->frontsector && seg->linedef)
|
if (seg->backsector == seg->frontsector && seg->linedef)
|
||||||
{
|
{
|
||||||
fixed_t d1=P_AproxDistance(seg->v1->x-seg->linedef->v1->x,seg->v1->y-seg->linedef->v1->y);
|
fixed_t d1=P_AproxDistance(seg->v1->fixX()-seg->linedef->v1->fixX(),seg->v1->fixY()-seg->linedef->v1->fixY());
|
||||||
fixed_t d2=P_AproxDistance(seg->v2->x-seg->linedef->v1->x,seg->v2->y-seg->linedef->v1->y);
|
fixed_t d2=P_AproxDistance(seg->v2->fixX()-seg->linedef->v1->fixX(),seg->v2->fixY()-seg->linedef->v1->fixY());
|
||||||
|
|
||||||
if (d2<d1) // backside
|
if (d2<d1) // backside
|
||||||
{
|
{
|
||||||
|
@ -4202,9 +4205,9 @@ CCMD (lineloc)
|
||||||
{
|
{
|
||||||
Printf ("No such line\n");
|
Printf ("No such line\n");
|
||||||
}
|
}
|
||||||
Printf ("(%d,%d) -> (%d,%d)\n", lines[linenum].v1->x >> FRACBITS,
|
Printf ("(%d,%d) -> (%d,%d)\n", lines[linenum].v1->fixX() >> FRACBITS,
|
||||||
lines[linenum].v1->y >> FRACBITS,
|
lines[linenum].v1->fixY() >> FRACBITS,
|
||||||
lines[linenum].v2->x >> FRACBITS,
|
lines[linenum].v2->fixX() >> FRACBITS,
|
||||||
lines[linenum].v2->y >> FRACBITS);
|
lines[linenum].v2->fixY() >> FRACBITS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -375,8 +375,8 @@ bool SightCheck::P_SightCheckLine (line_t *ld)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ld->validcount = validcount;
|
ld->validcount = validcount;
|
||||||
if (P_PointOnDivlineSidePrecise (ld->v1->fPos(), &Trace) ==
|
if (P_PointOnDivlineSidePrecise (ld->V1(), &Trace) ==
|
||||||
P_PointOnDivlineSidePrecise (ld->v2->fPos(), &Trace))
|
P_PointOnDivlineSidePrecise (ld->V2(), &Trace))
|
||||||
{
|
{
|
||||||
return true; // line isn't crossed
|
return true; // line isn't crossed
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,14 +79,14 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
|
||||||
|
|
||||||
DVector3 p, v1, v2, cross;
|
DVector3 p, v1, v2, cross;
|
||||||
|
|
||||||
p[0] = FIXED2DBL (line->v1->x);
|
p[0] = FIXED2DBL (line->v1->fixX());
|
||||||
p[1] = FIXED2DBL (line->v1->y);
|
p[1] = FIXED2DBL (line->v1->fixY());
|
||||||
p[2] = FIXED2DBL (plane->ZatPoint (line->v1->x, line->v1->y));
|
p[2] = FIXED2DBL (plane->ZatPoint (line->v1->fixX(), line->v1->fixY()));
|
||||||
v1[0] = FIXED2DBL (line->dx);
|
v1[0] = FIXED2DBL (line->dx);
|
||||||
v1[1] = FIXED2DBL (line->dy);
|
v1[1] = FIXED2DBL (line->dy);
|
||||||
v1[2] = FIXED2DBL (plane->ZatPoint (line->v2->x, line->v2->y)) - p[2];
|
v1[2] = FIXED2DBL (plane->ZatPoint (line->v2->fixX(), line->v2->fixY())) - p[2];
|
||||||
v2[0] = FIXED2DBL (x - line->v1->x);
|
v2[0] = FIXED2DBL (x - line->v1->fixX());
|
||||||
v2[1] = FIXED2DBL (y - line->v1->y);
|
v2[1] = FIXED2DBL (y - line->v1->fixY());
|
||||||
v2[2] = FIXED2DBL (z) - p[2];
|
v2[2] = FIXED2DBL (z) - p[2];
|
||||||
|
|
||||||
cross = v1 ^ v2;
|
cross = v1 ^ v2;
|
||||||
|
@ -232,12 +232,12 @@ void P_VavoomSlope(sector_t * sec, int id, fixed_t x, fixed_t y, fixed_t z, int
|
||||||
secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
|
secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
|
||||||
fixed_t srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
|
fixed_t srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
|
||||||
|
|
||||||
v1[0] = FIXED2DBL (x - l->v2->x);
|
v1[0] = FIXED2DBL (x - l->v2->fixX());
|
||||||
v1[1] = FIXED2DBL (y - l->v2->y);
|
v1[1] = FIXED2DBL (y - l->v2->fixY());
|
||||||
v1[2] = FIXED2DBL (z - srcheight);
|
v1[2] = FIXED2DBL (z - srcheight);
|
||||||
|
|
||||||
v2[0] = FIXED2DBL (x - l->v1->x);
|
v2[0] = FIXED2DBL (x - l->v1->fixX());
|
||||||
v2[1] = FIXED2DBL (y - l->v1->y);
|
v2[1] = FIXED2DBL (y - l->v1->fixY());
|
||||||
v2[2] = FIXED2DBL (z - srcheight);
|
v2[2] = FIXED2DBL (z - srcheight);
|
||||||
|
|
||||||
cross = v1 ^ v2;
|
cross = v1 ^ v2;
|
||||||
|
@ -360,7 +360,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
||||||
vt2.Z = h2? *h2 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling);
|
vt2.Z = h2? *h2 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling);
|
||||||
vt3.Z = h3? *h3 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling);
|
vt3.Z = h3? *h3 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling);
|
||||||
|
|
||||||
if (P_PointOnLineSidePrecise(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0)
|
if (P_PointOnLineSidePrecise(vertexes[vi3].fixX(), vertexes[vi3].fixY(), sec->lines[0]) == 0)
|
||||||
{
|
{
|
||||||
vec1 = vt2 - vt3;
|
vec1 = vt2 - vt3;
|
||||||
vec2 = vt1 - vt3;
|
vec2 = vt1 - vt3;
|
||||||
|
@ -394,8 +394,8 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
||||||
srcplane->b = FLOAT2FIXED (cross[1]);
|
srcplane->b = FLOAT2FIXED (cross[1]);
|
||||||
srcplane->c = FLOAT2FIXED (cross[2]);
|
srcplane->c = FLOAT2FIXED (cross[2]);
|
||||||
srcplane->ic = DivScale32 (1, srcplane->c);
|
srcplane->ic = DivScale32 (1, srcplane->c);
|
||||||
srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x,
|
srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].fixX(),
|
||||||
srcplane->b, vertexes[vi3].y,
|
srcplane->b, vertexes[vi3].fixY(),
|
||||||
srcplane->c, FLOAT2FIXED(vt3.Z));
|
srcplane->c, FLOAT2FIXED(vt3.Z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,8 +507,8 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
|
||||||
vert = (*probe++)->v2;
|
vert = (*probe++)->v2;
|
||||||
else
|
else
|
||||||
vert = (*probe)->v1;
|
vert = (*probe)->v1;
|
||||||
dist = fabs((double(line->v1->y) - vert->y) * line->dx -
|
dist = fabs((double(line->v1->fixY()) - vert->fixY()) * line->dx -
|
||||||
(double(line->v1->x) - vert->x) * line->dy);
|
(double(line->v1->fixX()) - vert->fixX()) * line->dy);
|
||||||
|
|
||||||
if (dist > bestdist)
|
if (dist > bestdist)
|
||||||
{
|
{
|
||||||
|
@ -528,14 +528,14 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
|
||||||
srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
|
srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
|
||||||
destheight = (which == 0) ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling);
|
destheight = (which == 0) ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling);
|
||||||
|
|
||||||
p[0] = FIXED2DBL (line->v1->x);
|
p[0] = FIXED2DBL (line->v1->fixX());
|
||||||
p[1] = FIXED2DBL(line->v1->y);
|
p[1] = FIXED2DBL(line->v1->fixY());
|
||||||
p[2] = FIXED2DBL(destheight);
|
p[2] = FIXED2DBL(destheight);
|
||||||
v1[0] = FIXED2DBL(line->dx);
|
v1[0] = FIXED2DBL(line->dx);
|
||||||
v1[1] = FIXED2DBL(line->dy);
|
v1[1] = FIXED2DBL(line->dy);
|
||||||
v1[2] = 0;
|
v1[2] = 0;
|
||||||
v2[0] = FIXED2DBL(refvert->x - line->v1->x);
|
v2[0] = FIXED2DBL(refvert->fixX() - line->v1->fixX());
|
||||||
v2[1] = FIXED2DBL(refvert->y - line->v1->y);
|
v2[1] = FIXED2DBL(refvert->fixY() - line->v1->fixY());
|
||||||
v2[2] = FIXED2DBL(srcheight - destheight);
|
v2[2] = FIXED2DBL(srcheight - destheight);
|
||||||
|
|
||||||
cross = (v1 ^ v2).Unit();
|
cross = (v1 ^ v2).Unit();
|
||||||
|
@ -551,8 +551,8 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
|
||||||
srcplane->c = FLOAT2FIXED (cross[2]);
|
srcplane->c = FLOAT2FIXED (cross[2]);
|
||||||
//srcplane->ic = FLOAT2FIXED (1.f/cross[2]);
|
//srcplane->ic = FLOAT2FIXED (1.f/cross[2]);
|
||||||
srcplane->ic = DivScale32 (1, srcplane->c);
|
srcplane->ic = DivScale32 (1, srcplane->c);
|
||||||
srcplane->d = -TMulScale16 (srcplane->a, line->v1->x,
|
srcplane->d = -TMulScale16 (srcplane->a, line->v1->fixX(),
|
||||||
srcplane->b, line->v1->y,
|
srcplane->b, line->v1->fixY(),
|
||||||
srcplane->c, destheight);
|
srcplane->c, destheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
|
||||||
// which wasn't necessarily anywhere near the switch if it was
|
// which wasn't necessarily anywhere near the switch if it was
|
||||||
// facing a big sector (and which wasn't necessarily for the
|
// facing a big sector (and which wasn't necessarily for the
|
||||||
// button just activated, either).
|
// button just activated, either).
|
||||||
DVector2 pt(side->linedef->v1->fPos() + side->linedef->Delta() / 2);
|
DVector2 pt(side->linedef->V1() + side->linedef->Delta() / 2);
|
||||||
bool playsound;
|
bool playsound;
|
||||||
|
|
||||||
side->SetTexture(texture, Switch->frames[0].Texture);
|
side->SetTexture(texture, Switch->frames[0].Texture);
|
||||||
|
|
|
@ -1676,21 +1676,22 @@ public:
|
||||||
|
|
||||||
void ParseVertex(vertex_t *vt, vertexdata_t *vd)
|
void ParseVertex(vertex_t *vt, vertexdata_t *vd)
|
||||||
{
|
{
|
||||||
vt->x = vt->y = 0;
|
vt->set(0, 0);
|
||||||
vd->zCeiling = vd->zFloor = vd->flags = 0;
|
vd->zCeiling = vd->zFloor = vd->flags = 0;
|
||||||
|
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
|
fixed_t x, y;
|
||||||
while (!sc.CheckToken('}'))
|
while (!sc.CheckToken('}'))
|
||||||
{
|
{
|
||||||
FName key = ParseKey();
|
FName key = ParseKey();
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case NAME_X:
|
case NAME_X:
|
||||||
vt->x = CheckFixed(key);
|
x = CheckFixed(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Y:
|
case NAME_Y:
|
||||||
vt->y = CheckFixed(key);
|
y = CheckFixed(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_ZCeiling:
|
case NAME_ZCeiling:
|
||||||
|
@ -1707,6 +1708,7 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vt->set(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -1729,7 +1731,7 @@ public:
|
||||||
I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes);
|
I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes);
|
||||||
}
|
}
|
||||||
else if (v1i == v2i ||
|
else if (v1i == v2i ||
|
||||||
(vertexes[v1i].x == vertexes[v2i].x && vertexes[v1i].y == vertexes[v2i].y))
|
(vertexes[v1i].fixX() == vertexes[v2i].fixX() && vertexes[v1i].fixY() == vertexes[v2i].fixY()))
|
||||||
{
|
{
|
||||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||||
ParsedLines.Delete(i);
|
ParsedLines.Delete(i);
|
||||||
|
|
|
@ -167,8 +167,8 @@ static int WriteVERTEXES (FILE *file)
|
||||||
|
|
||||||
for (int i = 0; i < numvertexes; ++i)
|
for (int i = 0; i < numvertexes; ++i)
|
||||||
{
|
{
|
||||||
mv.x = LittleShort(short(vertexes[i].x >> FRACBITS));
|
mv.x = LittleShort(short(vertexes[i].fixX() >> FRACBITS));
|
||||||
mv.y = LittleShort(short(vertexes[i].y >> FRACBITS));
|
mv.y = LittleShort(short(vertexes[i].fixY() >> FRACBITS));
|
||||||
fwrite (&mv, sizeof(mv), 1, file);
|
fwrite (&mv, sizeof(mv), 1, file);
|
||||||
}
|
}
|
||||||
return numvertexes * sizeof(mv);
|
return numvertexes * sizeof(mv);
|
||||||
|
@ -189,7 +189,7 @@ static int WriteSEGS (FILE *file)
|
||||||
ms.v2 = LittleShort(short(segs[i].v2 - vertexes));
|
ms.v2 = LittleShort(short(segs[i].v2 - vertexes));
|
||||||
ms.linedef = LittleShort(short(segs[i].linedef - lines));
|
ms.linedef = LittleShort(short(segs[i].linedef - lines));
|
||||||
ms.side = segs[i].sidedef == segs[i].linedef->sidedef[0] ? 0 : LittleShort((short)1);
|
ms.side = segs[i].sidedef == segs[i].linedef->sidedef[0] ? 0 : LittleShort((short)1);
|
||||||
ms.angle = LittleShort(short(R_PointToAngle2 (segs[i].v1->x, segs[i].v1->y, segs[i].v2->x, segs[i].v2->y)>>16));
|
ms.angle = LittleShort(short(R_PointToAngle2 (segs[i].v1->fixX(), segs[i].v1->fixY(), segs[i].v2->fixX(), segs[i].v2->fixY())>>16));
|
||||||
fwrite (&ms, sizeof(ms), 1, file);
|
fwrite (&ms, sizeof(ms), 1, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,7 +867,7 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
|
||||||
}
|
}
|
||||||
vertex_t *v1 = side->V1();
|
vertex_t *v1 = side->V1();
|
||||||
vertex_t *v2 = side->V2();
|
vertex_t *v2 = side->V2();
|
||||||
thrustAngle = VecToAngle(v2->x - v1->x, v2->y - v1->y) - 90.;
|
thrustAngle = VecToAngle(v2->fixX() - v1->fixX(), v2->fixY() - v1->fixY()) - 90.;
|
||||||
|
|
||||||
pe = static_cast<DPolyAction *>(specialdata);
|
pe = static_cast<DPolyAction *>(specialdata);
|
||||||
if (pe)
|
if (pe)
|
||||||
|
@ -921,30 +921,30 @@ void FPolyObj::UpdateBBox ()
|
||||||
{
|
{
|
||||||
line_t *line = Linedefs[i];
|
line_t *line = Linedefs[i];
|
||||||
|
|
||||||
if (line->v1->x < line->v2->x)
|
if (line->v1->fixX() < line->v2->fixX())
|
||||||
{
|
{
|
||||||
line->bbox[BOXLEFT] = line->v1->x;
|
line->bbox[BOXLEFT] = line->v1->fixX();
|
||||||
line->bbox[BOXRIGHT] = line->v2->x;
|
line->bbox[BOXRIGHT] = line->v2->fixX();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line->bbox[BOXLEFT] = line->v2->x;
|
line->bbox[BOXLEFT] = line->v2->fixX();
|
||||||
line->bbox[BOXRIGHT] = line->v1->x;
|
line->bbox[BOXRIGHT] = line->v1->fixX();
|
||||||
}
|
}
|
||||||
if (line->v1->y < line->v2->y)
|
if (line->v1->fixY() < line->v2->fixY())
|
||||||
{
|
{
|
||||||
line->bbox[BOXBOTTOM] = line->v1->y;
|
line->bbox[BOXBOTTOM] = line->v1->fixY();
|
||||||
line->bbox[BOXTOP] = line->v2->y;
|
line->bbox[BOXTOP] = line->v2->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line->bbox[BOXBOTTOM] = line->v2->y;
|
line->bbox[BOXBOTTOM] = line->v2->fixY();
|
||||||
line->bbox[BOXTOP] = line->v1->y;
|
line->bbox[BOXTOP] = line->v1->fixY();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the line's slopetype
|
// Update the line's slopetype
|
||||||
line->dx = line->v2->x - line->v1->x;
|
line->dx = line->v2->fixX() - line->v1->fixX();
|
||||||
line->dy = line->v2->y - line->v1->y;
|
line->dy = line->v2->fixY() - line->v1->fixY();
|
||||||
}
|
}
|
||||||
CalcCenter();
|
CalcCenter();
|
||||||
}
|
}
|
||||||
|
@ -954,8 +954,8 @@ void FPolyObj::CalcCenter()
|
||||||
SQWORD cx = 0, cy = 0;
|
SQWORD cx = 0, cy = 0;
|
||||||
for(unsigned i=0;i<Vertices.Size(); i++)
|
for(unsigned i=0;i<Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
cx += Vertices[i]->x;
|
cx += Vertices[i]->fixX();
|
||||||
cy += Vertices[i]->y;
|
cy += Vertices[i]->fixY();
|
||||||
}
|
}
|
||||||
CenterSpot.x = (fixed_t)(cx / Vertices.Size());
|
CenterSpot.x = (fixed_t)(cx / Vertices.Size());
|
||||||
CenterSpot.y = (fixed_t)(cy / Vertices.Size());
|
CenterSpot.y = (fixed_t)(cy / Vertices.Size());
|
||||||
|
@ -1011,8 +1011,7 @@ void FPolyObj::DoMovePolyobj (int x, int y)
|
||||||
{
|
{
|
||||||
for(unsigned i=0;i < Vertices.Size(); i++)
|
for(unsigned i=0;i < Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
Vertices[i]->x += x;
|
Vertices[i]->set(Vertices[i]->fixX() + x, Vertices[i]->fixY() + y);
|
||||||
Vertices[i]->y += y;
|
|
||||||
PrevPts[i].x += x;
|
PrevPts[i].x += x;
|
||||||
PrevPts[i].y += y;
|
PrevPts[i].y += y;
|
||||||
}
|
}
|
||||||
|
@ -1061,11 +1060,11 @@ bool FPolyObj::RotatePolyobj (angle_t angle, bool fromsave)
|
||||||
|
|
||||||
for(unsigned i=0;i < Vertices.Size(); i++)
|
for(unsigned i=0;i < Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
PrevPts[i].x = Vertices[i]->x;
|
PrevPts[i].x = Vertices[i]->fixX();
|
||||||
PrevPts[i].y = Vertices[i]->y;
|
PrevPts[i].y = Vertices[i]->fixY();
|
||||||
Vertices[i]->x = OriginalPts[i].x;
|
FPolyVertex torot = OriginalPts[i];
|
||||||
Vertices[i]->y = OriginalPts[i].y;
|
RotatePt(an, &torot.x, &torot.y, StartSpot.x, StartSpot.y);
|
||||||
RotatePt(an, &Vertices[i]->x, &Vertices[i]->y, StartSpot.x, StartSpot.y);
|
Vertices[i]->set(torot.x, torot.y);
|
||||||
}
|
}
|
||||||
blocked = false;
|
blocked = false;
|
||||||
validcount++;
|
validcount++;
|
||||||
|
@ -1085,8 +1084,7 @@ bool FPolyObj::RotatePolyobj (angle_t angle, bool fromsave)
|
||||||
{
|
{
|
||||||
for(unsigned i=0;i < Vertices.Size(); i++)
|
for(unsigned i=0;i < Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
Vertices[i]->x = PrevPts[i].x;
|
Vertices[i]->set(PrevPts[i].x, PrevPts[i].y);
|
||||||
Vertices[i]->y = PrevPts[i].y;
|
|
||||||
}
|
}
|
||||||
UpdateBBox();
|
UpdateBBox();
|
||||||
LinkPolyobj();
|
LinkPolyobj();
|
||||||
|
@ -1281,9 +1279,9 @@ void FPolyObj::LinkPolyobj ()
|
||||||
vertex_t *vt;
|
vertex_t *vt;
|
||||||
|
|
||||||
vt = Sidedefs[i]->linedef->v1;
|
vt = Sidedefs[i]->linedef->v1;
|
||||||
Bounds.AddToBox(vt->x, vt->y);
|
Bounds.AddToBox(vt->fixX(), vt->fixY());
|
||||||
vt = Sidedefs[i]->linedef->v2;
|
vt = Sidedefs[i]->linedef->v2;
|
||||||
Bounds.AddToBox(vt->x, vt->y);
|
Bounds.AddToBox(vt->fixX(), vt->fixY());
|
||||||
}
|
}
|
||||||
bbox[BOXRIGHT] = GetSafeBlockX(Bounds.Right() - bmaporgx);
|
bbox[BOXRIGHT] = GetSafeBlockX(Bounds.Right() - bmaporgx);
|
||||||
bbox[BOXLEFT] = GetSafeBlockX(Bounds.Left() - bmaporgx);
|
bbox[BOXLEFT] = GetSafeBlockX(Bounds.Left() - bmaporgx);
|
||||||
|
@ -1373,34 +1371,34 @@ void FPolyObj::ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy, si
|
||||||
{
|
{
|
||||||
vertex_t *v1 = Sidedefs[i]->V1();
|
vertex_t *v1 = Sidedefs[i]->V1();
|
||||||
vertex_t *v2 = Sidedefs[i]->V2();
|
vertex_t *v2 = Sidedefs[i]->V2();
|
||||||
double a = v2->x - v1->x;
|
double a = v2->fixX() - v1->fixX();
|
||||||
double b = v2->y - v1->y;
|
double b = v2->fixY() - v1->fixY();
|
||||||
double den = a*a + b*b;
|
double den = a*a + b*b;
|
||||||
double ix, iy, dist;
|
double ix, iy, dist;
|
||||||
|
|
||||||
if (den == 0)
|
if (den == 0)
|
||||||
{ // Line is actually a point!
|
{ // Line is actually a point!
|
||||||
ix = v1->x;
|
ix = v1->fixX();
|
||||||
iy = v1->y;
|
iy = v1->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double num = (x - v1->x) * a + (y - v1->y) * b;
|
double num = (x - v1->fixX()) * a + (y - v1->fixY()) * b;
|
||||||
double u = num / den;
|
double u = num / den;
|
||||||
if (u <= 0)
|
if (u <= 0)
|
||||||
{
|
{
|
||||||
ix = v1->x;
|
ix = v1->fixX();
|
||||||
iy = v1->y;
|
iy = v1->fixY();
|
||||||
}
|
}
|
||||||
else if (u >= 1)
|
else if (u >= 1)
|
||||||
{
|
{
|
||||||
ix = v2->x;
|
ix = v2->fixX();
|
||||||
iy = v2->y;
|
iy = v2->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ix = v1->x + u * a;
|
ix = v1->fixX() + u * a;
|
||||||
iy = v1->y + u * b;
|
iy = v1->fixY() + u * b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a = (ix - x);
|
a = (ix - x);
|
||||||
|
@ -1692,10 +1690,9 @@ static void TranslateToStartSpot (int tag, int originX, int originY)
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < po->Vertices.Size(); i++)
|
for (unsigned i = 0; i < po->Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
po->Vertices[i]->x -= deltaX;
|
po->Vertices[i]->set(po->Vertices[i]->fixX() - deltaX, po->Vertices[i]->fixY() - deltaY);
|
||||||
po->Vertices[i]->y -= deltaY;
|
po->OriginalPts[i].x = po->Vertices[i]->fixX() - po->StartSpot.x;
|
||||||
po->OriginalPts[i].x = po->Vertices[i]->x - po->StartSpot.x;
|
po->OriginalPts[i].y = po->Vertices[i]->fixY() - po->StartSpot.y;
|
||||||
po->OriginalPts[i].y = po->Vertices[i]->y - po->StartSpot.y;
|
|
||||||
}
|
}
|
||||||
po->CalcCenter();
|
po->CalcCenter();
|
||||||
// For compatibility purposes
|
// For compatibility purposes
|
||||||
|
|
|
@ -13,8 +13,8 @@ struct FPolyVertex
|
||||||
|
|
||||||
FPolyVertex &operator=(vertex_t *v)
|
FPolyVertex &operator=(vertex_t *v)
|
||||||
{
|
{
|
||||||
x = v->x;
|
x = v->fixX();
|
||||||
y = v->y;
|
y = v->fixX();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -168,8 +168,8 @@ void FLinePortalTraverse::AddLineIntercepts(int bx, int by)
|
||||||
|
|
||||||
if (ld->validcount == validcount) continue; // already processed
|
if (ld->validcount == validcount) continue; // already processed
|
||||||
|
|
||||||
if (P_PointOnDivlineSidePrecise (ld->v1->x, ld->v1->y, &trace) ==
|
if (P_PointOnDivlineSidePrecise (ld->v1->fixX(), ld->v1->fixY(), &trace) ==
|
||||||
P_PointOnDivlineSidePrecise (ld->v2->x, ld->v2->y, &trace))
|
P_PointOnDivlineSidePrecise (ld->v2->fixX(), ld->v2->fixY(), &trace))
|
||||||
{
|
{
|
||||||
continue; // line isn't crossed
|
continue; // line isn't crossed
|
||||||
}
|
}
|
||||||
|
@ -513,13 +513,13 @@ inline int P_PointOnLineSideExplicit (fixed_t x, fixed_t y, fixed_t x1, fixed_t
|
||||||
|
|
||||||
inline int P_GetLineSide(fixed_t x, fixed_t y, const line_t *line)
|
inline int P_GetLineSide(fixed_t x, fixed_t y, const line_t *line)
|
||||||
{
|
{
|
||||||
return DMulScale32(y - line->v1->y, line->dx, line->v1->x - x, line->dy);
|
return DMulScale32(y - line->v1->fixY(), line->dx, line->v1->fixX() - x, line->dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t viewy, bool partial, bool samebehind)
|
bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t viewy, bool partial, bool samebehind)
|
||||||
{
|
{
|
||||||
int behind1 = P_GetLineSide(line->v1->x, line->v1->y, portal);
|
int behind1 = P_GetLineSide(line->v1->fixX(), line->v1->fixY(), portal);
|
||||||
int behind2 = P_GetLineSide(line->v2->x, line->v2->y, portal);
|
int behind2 = P_GetLineSide(line->v2->fixX(), line->v2->fixY(), portal);
|
||||||
|
|
||||||
if (behind1 == 0 && behind2 == 0)
|
if (behind1 == 0 && behind2 == 0)
|
||||||
{
|
{
|
||||||
|
@ -544,8 +544,8 @@ bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t vie
|
||||||
{
|
{
|
||||||
// The line intersects with the portal straight, so we need to do another check to see how both ends of the portal lie in relation to the viewer.
|
// The line intersects with the portal straight, so we need to do another check to see how both ends of the portal lie in relation to the viewer.
|
||||||
int viewside = P_PointOnLineSidePrecise(viewx, viewy, line);
|
int viewside = P_PointOnLineSidePrecise(viewx, viewy, line);
|
||||||
int p1side = P_GetLineSide(portal->v1->x, portal->v1->y, line);
|
int p1side = P_GetLineSide(portal->v1->fixX(), portal->v1->fixY(), line);
|
||||||
int p2side = P_GetLineSide(portal->v2->x, portal->v2->y, line);
|
int p2side = P_GetLineSide(portal->v2->fixX(), portal->v2->fixY(), line);
|
||||||
// Do the same handling of points on the portal straight than above.
|
// Do the same handling of points on the portal straight than above.
|
||||||
if (p1side == 0) p1side = p2side;
|
if (p1side == 0) p1side = p2side;
|
||||||
else if (p2side == 0) p2side = p1side;
|
else if (p2side == 0) p2side = p1side;
|
||||||
|
@ -569,15 +569,15 @@ void P_TranslatePortalXY(line_t* src, fixed_t& x, fixed_t& y)
|
||||||
if (!port) return;
|
if (!port) return;
|
||||||
|
|
||||||
// offsets from line
|
// offsets from line
|
||||||
fixed_t nposx = x - src->v1->x;
|
fixed_t nposx = x - src->v1->fixX();
|
||||||
fixed_t nposy = y - src->v1->y;
|
fixed_t nposy = y - src->v1->fixY();
|
||||||
|
|
||||||
// Rotate position along normal to match exit linedef
|
// Rotate position along normal to match exit linedef
|
||||||
fixed_t tx = FixedMul(nposx, port->mCosRot) - FixedMul(nposy, port->mSinRot);
|
fixed_t tx = FixedMul(nposx, port->mCosRot) - FixedMul(nposy, port->mSinRot);
|
||||||
fixed_t ty = FixedMul(nposy, port->mCosRot) + FixedMul(nposx, port->mSinRot);
|
fixed_t ty = FixedMul(nposy, port->mCosRot) + FixedMul(nposx, port->mSinRot);
|
||||||
|
|
||||||
tx += port->mDestination->v2->x;
|
tx += port->mDestination->v2->fixX();
|
||||||
ty += port->mDestination->v2->y;
|
ty += port->mDestination->v2->fixY();
|
||||||
|
|
||||||
x = tx;
|
x = tx;
|
||||||
y = ty;
|
y = ty;
|
||||||
|
@ -632,11 +632,11 @@ void P_TranslatePortalZ(line_t* src, fixed_t& z)
|
||||||
switch (src->getPortalAlignment())
|
switch (src->getPortalAlignment())
|
||||||
{
|
{
|
||||||
case PORG_FLOOR:
|
case PORG_FLOOR:
|
||||||
z = z - src->frontsector->floorplane.ZatPoint(src->v1->x, src->v1->y) + dst->frontsector->floorplane.ZatPoint(dst->v2->x, dst->v2->y);
|
z = z - src->frontsector->floorplane.ZatPoint(src->v1->fixX(), src->v1->fixY()) + dst->frontsector->floorplane.ZatPoint(dst->v2->fixX(), dst->v2->fixY());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PORG_CEILING:
|
case PORG_CEILING:
|
||||||
z = z - src->frontsector->ceilingplane.ZatPoint(src->v1->x, src->v1->y) + dst->frontsector->ceilingplane.ZatPoint(dst->v2->x, dst->v2->y);
|
z = z - src->frontsector->ceilingplane.ZatPoint(src->v1->fixX(), src->v1->fixY()) + dst->frontsector->ceilingplane.ZatPoint(dst->v2->fixX(), dst->v2->fixY());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -655,8 +655,8 @@ fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y)
|
||||||
angle_t angle = R_PointToAngle2(0, 0, line->dx, line->dy);
|
angle_t angle = R_PointToAngle2(0, 0, line->dx, line->dy);
|
||||||
angle += ANGLE_180;
|
angle += ANGLE_180;
|
||||||
|
|
||||||
fixed_t dx = line->v1->x - x;
|
fixed_t dx = line->v1->fixX() - x;
|
||||||
fixed_t dy = line->v1->y - y;
|
fixed_t dy = line->v1->fixY() - y;
|
||||||
|
|
||||||
fixed_t s = finesine[angle>>ANGLETOFINESHIFT];
|
fixed_t s = finesine[angle>>ANGLETOFINESHIFT];
|
||||||
fixed_t c = finecosine[angle>>ANGLETOFINESHIFT];
|
fixed_t c = finecosine[angle>>ANGLETOFINESHIFT];
|
||||||
|
|
|
@ -404,8 +404,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
||||||
// sectors at the same time.
|
// sectors at the same time.
|
||||||
if (back && !r_fakingunderwater && curline->frontsector->heightsec == NULL)
|
if (back && !r_fakingunderwater && curline->frontsector->heightsec == NULL)
|
||||||
{
|
{
|
||||||
if (rw_frontcz1 <= s->floorplane.ZatPoint (curline->v1->x, curline->v1->y) &&
|
if (rw_frontcz1 <= s->floorplane.ZatPoint (curline->v1->fixX(), curline->v1->fixY()) &&
|
||||||
rw_frontcz2 <= s->floorplane.ZatPoint (curline->v2->x, curline->v2->y))
|
rw_frontcz2 <= s->floorplane.ZatPoint (curline->v2->fixX(), curline->v2->fixY()))
|
||||||
{
|
{
|
||||||
// Check that the window is actually visible
|
// Check that the window is actually visible
|
||||||
for (int z = WallC.sx1; z < WallC.sx2; ++z)
|
for (int z = WallC.sx1; z < WallC.sx2; ++z)
|
||||||
|
@ -529,10 +529,10 @@ void R_AddLine (seg_t *line)
|
||||||
// [RH] Color if not texturing line
|
// [RH] Color if not texturing line
|
||||||
dc_color = (((int)(line - segs) * 8) + 4) & 255;
|
dc_color = (((int)(line - segs) * 8) + 4) & 255;
|
||||||
|
|
||||||
tx1 = line->v1->x - viewx;
|
tx1 = line->v1->fixX() - viewx;
|
||||||
tx2 = line->v2->x - viewx;
|
tx2 = line->v2->fixX() - viewx;
|
||||||
ty1 = line->v1->y - viewy;
|
ty1 = line->v1->fixY() - viewy;
|
||||||
ty2 = line->v2->y - viewy;
|
ty2 = line->v2->fixY() - viewy;
|
||||||
|
|
||||||
// Reject lines not facing viewer
|
// Reject lines not facing viewer
|
||||||
if (DMulScale32 (ty1, tx1-tx2, tx1, ty2-ty1) >= 0)
|
if (DMulScale32 (ty1, tx1-tx2, tx1, ty2-ty1) >= 0)
|
||||||
|
@ -573,17 +573,17 @@ void R_AddLine (seg_t *line)
|
||||||
{
|
{
|
||||||
swapvalues (v1, v2);
|
swapvalues (v1, v2);
|
||||||
}
|
}
|
||||||
WallT.InitFromLine(v1->x - viewx, v1->y - viewy, v2->x - viewx, v2->y - viewy);
|
WallT.InitFromLine(v1->fixX() - viewx, v1->fixY() - viewy, v2->fixX() - viewx, v2->fixY() - viewy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fake3D & FAKE3D_FAKEBACK))
|
if (!(fake3D & FAKE3D_FAKEBACK))
|
||||||
{
|
{
|
||||||
backsector = line->backsector;
|
backsector = line->backsector;
|
||||||
}
|
}
|
||||||
rw_frontcz1 = frontsector->ceilingplane.ZatPoint (line->v1->x, line->v1->y);
|
rw_frontcz1 = frontsector->ceilingplane.ZatPoint (line->v1->fixX(), line->v1->fixY());
|
||||||
rw_frontfz1 = frontsector->floorplane.ZatPoint (line->v1->x, line->v1->y);
|
rw_frontfz1 = frontsector->floorplane.ZatPoint (line->v1->fixX(), line->v1->fixY());
|
||||||
rw_frontcz2 = frontsector->ceilingplane.ZatPoint (line->v2->x, line->v2->y);
|
rw_frontcz2 = frontsector->ceilingplane.ZatPoint (line->v2->fixX(), line->v2->fixY());
|
||||||
rw_frontfz2 = frontsector->floorplane.ZatPoint (line->v2->x, line->v2->y);
|
rw_frontfz2 = frontsector->floorplane.ZatPoint (line->v2->fixX(), line->v2->fixY());
|
||||||
|
|
||||||
rw_mustmarkfloor = rw_mustmarkceiling = false;
|
rw_mustmarkfloor = rw_mustmarkceiling = false;
|
||||||
rw_havehigh = rw_havelow = false;
|
rw_havehigh = rw_havelow = false;
|
||||||
|
@ -602,10 +602,10 @@ void R_AddLine (seg_t *line)
|
||||||
}
|
}
|
||||||
doorclosed = 0; // killough 4/16/98
|
doorclosed = 0; // killough 4/16/98
|
||||||
|
|
||||||
rw_backcz1 = backsector->ceilingplane.ZatPoint (line->v1->x, line->v1->y);
|
rw_backcz1 = backsector->ceilingplane.ZatPoint (line->v1->fixX(), line->v1->fixY());
|
||||||
rw_backfz1 = backsector->floorplane.ZatPoint (line->v1->x, line->v1->y);
|
rw_backfz1 = backsector->floorplane.ZatPoint (line->v1->fixX(), line->v1->fixY());
|
||||||
rw_backcz2 = backsector->ceilingplane.ZatPoint (line->v2->x, line->v2->y);
|
rw_backcz2 = backsector->ceilingplane.ZatPoint (line->v2->fixX(), line->v2->fixY());
|
||||||
rw_backfz2 = backsector->floorplane.ZatPoint (line->v2->x, line->v2->y);
|
rw_backfz2 = backsector->floorplane.ZatPoint (line->v2->fixX(), line->v2->fixY());
|
||||||
|
|
||||||
// Cannot make these walls solid, because it can result in
|
// Cannot make these walls solid, because it can result in
|
||||||
// sprite clipping problems for sprites near the wall
|
// sprite clipping problems for sprites near the wall
|
||||||
|
|
|
@ -788,8 +788,8 @@ void DPolyobjInterpolation::UpdateInterpolation()
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
oldverts[i*2 ] = poly->Vertices[i]->x;
|
oldverts[i*2 ] = poly->Vertices[i]->fixX();
|
||||||
oldverts[i*2+1] = poly->Vertices[i]->y;
|
oldverts[i*2+1] = poly->Vertices[i]->fixY();
|
||||||
}
|
}
|
||||||
oldcx = poly->CenterSpot.x;
|
oldcx = poly->CenterSpot.x;
|
||||||
oldcy = poly->CenterSpot.y;
|
oldcy = poly->CenterSpot.y;
|
||||||
|
@ -805,8 +805,7 @@ void DPolyobjInterpolation::Restore()
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
poly->Vertices[i]->x = bakverts[i*2 ];
|
poly->Vertices[i]->set(bakverts[i*2 ], bakverts[i*2+1]);
|
||||||
poly->Vertices[i]->y = bakverts[i*2+1];
|
|
||||||
}
|
}
|
||||||
poly->CenterSpot.x = bakcx;
|
poly->CenterSpot.x = bakcx;
|
||||||
poly->CenterSpot.y = bakcy;
|
poly->CenterSpot.y = bakcy;
|
||||||
|
@ -824,17 +823,15 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
fixed_t *px = &poly->Vertices[i]->x;
|
bakverts[i*2 ] = poly->Vertices[i]->fixX();
|
||||||
fixed_t *py = &poly->Vertices[i]->y;
|
bakverts[i*2+1] = poly->Vertices[i]->fixY();
|
||||||
|
|
||||||
bakverts[i*2 ] = *px;
|
|
||||||
bakverts[i*2+1] = *py;
|
|
||||||
|
|
||||||
if (bakverts[i * 2] != oldverts[i * 2] || bakverts[i * 2 + 1] != oldverts[i * 2 + 1])
|
if (bakverts[i * 2] != oldverts[i * 2] || bakverts[i * 2 + 1] != oldverts[i * 2 + 1])
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
*px = oldverts[i * 2] + FixedMul(bakverts[i * 2] - oldverts[i * 2], smoothratio);
|
poly->Vertices[i]->set(
|
||||||
*py = oldverts[i * 2 + 1] + FixedMul(bakverts[i * 2 + 1] - oldverts[i * 2 + 1], smoothratio);
|
oldverts[i * 2] + FixedMul(bakverts[i * 2] - oldverts[i * 2], smoothratio),
|
||||||
|
oldverts[i * 2 + 1] + FixedMul(bakverts[i * 2 + 1] - oldverts[i * 2 + 1], smoothratio));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refcount == 0 && !changed)
|
if (refcount == 0 && !changed)
|
||||||
|
|
43
src/r_defs.h
43
src/r_defs.h
|
@ -91,10 +91,33 @@ struct vertexdata_t
|
||||||
double zCeiling, zFloor;
|
double zCeiling, zFloor;
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef USE_FLOAT
|
||||||
|
typedef float vtype;
|
||||||
|
#elif !defined USE_FIXED
|
||||||
|
typedef double vtype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct vertex_t
|
struct vertex_t
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
fixed_t x, y;
|
fixed_t x, y;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void set(fixed_t x, fixed_t y)
|
||||||
|
{
|
||||||
|
this->x = x;
|
||||||
|
this->y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set(double x, double y)
|
||||||
|
{
|
||||||
|
this->x = FLOAT2FIXED(x);
|
||||||
|
this->y = FLOAT2FIXED(y);
|
||||||
|
}
|
||||||
|
|
||||||
double fX() const
|
double fX() const
|
||||||
{
|
{
|
||||||
return FIXED2DBL(x);
|
return FIXED2DBL(x);
|
||||||
|
@ -105,6 +128,16 @@ struct vertex_t
|
||||||
return FIXED2DBL(y);
|
return FIXED2DBL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixed_t fixX() const
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed_t fixY() const
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
DVector2 fPos()
|
DVector2 fPos()
|
||||||
{
|
{
|
||||||
return{ fX(), fY() };
|
return{ fX(), fY() };
|
||||||
|
@ -320,7 +353,7 @@ struct secplane_t
|
||||||
// Returns the value of z at vertex v
|
// Returns the value of z at vertex v
|
||||||
fixed_t ZatPoint (const vertex_t *v) const
|
fixed_t ZatPoint (const vertex_t *v) const
|
||||||
{
|
{
|
||||||
return FixedMul (ic, -d - DMulScale16 (a, v->x, b, v->y));
|
return FixedMul (ic, -d - DMulScale16 (a, v->fixX(), b, v->fixY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t ZatPoint (const AActor *ac) const
|
fixed_t ZatPoint (const AActor *ac) const
|
||||||
|
@ -342,7 +375,7 @@ struct secplane_t
|
||||||
// Returns the value of z at vertex v if d is equal to dist
|
// Returns the value of z at vertex v if d is equal to dist
|
||||||
fixed_t ZatPointDist (const vertex_t *v, fixed_t dist)
|
fixed_t ZatPointDist (const vertex_t *v, fixed_t dist)
|
||||||
{
|
{
|
||||||
return FixedMul (ic, -dist - DMulScale16 (a, v->x, b, v->y));
|
return FixedMul (ic, -dist - DMulScale16 (a, v->fixX(), b, v->fixY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flips the plane's vertical orientiation, so that if it pointed up,
|
// Flips the plane's vertical orientiation, so that if it pointed up,
|
||||||
|
@ -404,7 +437,7 @@ struct secplane_t
|
||||||
|
|
||||||
fixed_t PointToDist (const vertex_t *v, fixed_t z) const
|
fixed_t PointToDist (const vertex_t *v, fixed_t z) const
|
||||||
{
|
{
|
||||||
return -TMulScale16 (a, v->x, b, v->y, z, c);
|
return -TMulScale16 (a, v->fixX(), b, v->fixY(), z, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAtHeight(fixed_t height, int ceiling)
|
void SetAtHeight(fixed_t height, int ceiling)
|
||||||
|
@ -1254,12 +1287,12 @@ struct line_t
|
||||||
|
|
||||||
DVector2 V1() const
|
DVector2 V1() const
|
||||||
{
|
{
|
||||||
return{ FIXED2DBL(v1->x), FIXED2DBL(v1->y) };
|
return v1->fPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
DVector2 V2() const
|
DVector2 V2() const
|
||||||
{
|
{
|
||||||
return{ FIXED2DBL(v2->x), FIXED2DBL(v2->y) };
|
return v1->fPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
DVector2 Delta() const
|
DVector2 Delta() const
|
||||||
|
|
|
@ -704,20 +704,20 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
|
||||||
// Reflect the current view behind the mirror.
|
// Reflect the current view behind the mirror.
|
||||||
if (pds->src->dx == 0)
|
if (pds->src->dx == 0)
|
||||||
{ // vertical mirror
|
{ // vertical mirror
|
||||||
viewx = v1->x - startx + v1->x;
|
viewx = v1->fixX() - startx + v1->fixX();
|
||||||
}
|
}
|
||||||
else if (pds->src->dy == 0)
|
else if (pds->src->dy == 0)
|
||||||
{ // horizontal mirror
|
{ // horizontal mirror
|
||||||
viewy = v1->y - starty + v1->y;
|
viewy = v1->fixY() - starty + v1->fixY();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // any mirror--use floats to avoid integer overflow
|
{ // any mirror--use floats to avoid integer overflow
|
||||||
vertex_t *v2 = pds->src->v2;
|
vertex_t *v2 = pds->src->v2;
|
||||||
|
|
||||||
double dx = FIXED2DBL(v2->x - v1->x);
|
double dx = v2->fX() - v1->fX();
|
||||||
double dy = FIXED2DBL(v2->y - v1->y);
|
double dy = v2->fY() - v1->fY();
|
||||||
double x1 = FIXED2DBL(v1->x);
|
double x1 = v1->fX();
|
||||||
double y1 = FIXED2DBL(v1->y);
|
double y1 = v1->fY();
|
||||||
double x = FIXED2DBL(startx);
|
double x = FIXED2DBL(startx);
|
||||||
double y = FIXED2DBL(starty);
|
double y = FIXED2DBL(starty);
|
||||||
|
|
||||||
|
@ -727,8 +727,8 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
|
||||||
viewx = FLOAT2FIXED((x1 + r * dx)*2 - x);
|
viewx = FLOAT2FIXED((x1 + r * dx)*2 - x);
|
||||||
viewy = FLOAT2FIXED((y1 + r * dy)*2 - y);
|
viewy = FLOAT2FIXED((y1 + r * dy)*2 - y);
|
||||||
}
|
}
|
||||||
viewangle = 2*R_PointToAngle2 (pds->src->v1->x, pds->src->v1->y,
|
viewangle = 2*R_PointToAngle2 (pds->src->v1->fixX(), pds->src->v1->fixY(),
|
||||||
pds->src->v2->x, pds->src->v2->y) - startang;
|
pds->src->v2->fixX(), pds->src->v2->fixY()) - startang;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1388,10 +1388,10 @@ static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *d
|
||||||
{
|
{
|
||||||
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
||||||
{
|
{
|
||||||
fixed_t frontcz1 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v1->x, ds->curline->v1->y);
|
fixed_t frontcz1 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v1->fixX(), ds->curline->v1->fixY());
|
||||||
fixed_t frontfz1 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v1->x, ds->curline->v1->y);
|
fixed_t frontfz1 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v1->fixX(), ds->curline->v1->fixY());
|
||||||
fixed_t frontcz2 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v2->x, ds->curline->v2->y);
|
fixed_t frontcz2 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v2->fixX(), ds->curline->v2->fixY());
|
||||||
fixed_t frontfz2 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v2->x, ds->curline->v2->y);
|
fixed_t frontfz2 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v2->fixX(), ds->curline->v2->fixY());
|
||||||
fixed_t top = MAX(frontcz1, frontcz2);
|
fixed_t top = MAX(frontcz1, frontcz2);
|
||||||
fixed_t bot = MIN(frontfz1, frontfz2);
|
fixed_t bot = MIN(frontfz1, frontfz2);
|
||||||
if (fake3D & FAKE3D_CLIPTOP)
|
if (fake3D & FAKE3D_CLIPTOP)
|
||||||
|
@ -2778,25 +2778,25 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
|
|
||||||
if (MirrorFlags & RF_XFLIP)
|
if (MirrorFlags & RF_XFLIP)
|
||||||
{
|
{
|
||||||
x = curline->v2->x;
|
x = curline->v2->fixX();
|
||||||
y = curline->v2->y;
|
y = curline->v2->fixY();
|
||||||
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
||||||
{
|
{
|
||||||
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
||||||
x -= MulScale30 (frac, x - curline->v1->x);
|
x -= MulScale30 (frac, x - curline->v1->fixX());
|
||||||
y -= MulScale30 (frac, y - curline->v1->y);
|
y -= MulScale30 (frac, y - curline->v1->fixY());
|
||||||
}
|
}
|
||||||
z1 = viewz - plane.ZatPoint (x, y);
|
z1 = viewz - plane.ZatPoint (x, y);
|
||||||
|
|
||||||
if (wallc->sx2 > wallc->sx1 + 1)
|
if (wallc->sx2 > wallc->sx1 + 1)
|
||||||
{
|
{
|
||||||
x = curline->v1->x;
|
x = curline->v1->fixX();
|
||||||
y = curline->v1->y;
|
y = curline->v1->fixY();
|
||||||
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
||||||
{
|
{
|
||||||
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
||||||
x += MulScale30 (frac, curline->v2->x - x);
|
x += MulScale30 (frac, curline->v2->fixX() - x);
|
||||||
y += MulScale30 (frac, curline->v2->y - y);
|
y += MulScale30 (frac, curline->v2->fixY() - y);
|
||||||
}
|
}
|
||||||
z2 = viewz - plane.ZatPoint (x, y);
|
z2 = viewz - plane.ZatPoint (x, y);
|
||||||
}
|
}
|
||||||
|
@ -2807,25 +2807,25 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = curline->v1->x;
|
x = curline->v1->fixX();
|
||||||
y = curline->v1->y;
|
y = curline->v1->fixY();
|
||||||
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
||||||
{
|
{
|
||||||
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
||||||
x += MulScale30 (frac, curline->v2->x - x);
|
x += MulScale30 (frac, curline->v2->fixX() - x);
|
||||||
y += MulScale30 (frac, curline->v2->y - y);
|
y += MulScale30 (frac, curline->v2->fixY() - y);
|
||||||
}
|
}
|
||||||
z1 = viewz - plane.ZatPoint (x, y);
|
z1 = viewz - plane.ZatPoint (x, y);
|
||||||
|
|
||||||
if (wallc->sx2 > wallc->sx1 + 1)
|
if (wallc->sx2 > wallc->sx1 + 1)
|
||||||
{
|
{
|
||||||
x = curline->v2->x;
|
x = curline->v2->fixX();
|
||||||
y = curline->v2->y;
|
y = curline->v2->fixY();
|
||||||
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
||||||
{
|
{
|
||||||
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
||||||
x -= MulScale30 (frac, x - curline->v1->x);
|
x -= MulScale30 (frac, x - curline->v1->fixX());
|
||||||
y -= MulScale30 (frac, y - curline->v1->y);
|
y -= MulScale30 (frac, y - curline->v1->fixY());
|
||||||
}
|
}
|
||||||
z2 = viewz - plane.ZatPoint (x, y);
|
z2 = viewz - plane.ZatPoint (x, y);
|
||||||
}
|
}
|
||||||
|
@ -3101,7 +3101,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
||||||
decalx = FLOAT2FIXED(dcx);
|
decalx = FLOAT2FIXED(dcx);
|
||||||
decaly = FLOAT2FIXED(dcy);
|
decaly = FLOAT2FIXED(dcy);
|
||||||
|
|
||||||
angle_t ang = R_PointToAngle2 (curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y) >> ANGLETOFINESHIFT;
|
angle_t ang = R_PointToAngle2 (curline->v1->fixX(), curline->v1->fixY(), curline->v2->fixX(), curline->v2->fixY()) >> ANGLETOFINESHIFT;
|
||||||
lx = decalx - FixedMul (x1, finecosine[ang]) - viewx;
|
lx = decalx - FixedMul (x1, finecosine[ang]) - viewx;
|
||||||
lx2 = decalx + FixedMul (x2, finecosine[ang]) - viewx;
|
lx2 = decalx + FixedMul (x2, finecosine[ang]) - viewx;
|
||||||
ly = decaly - FixedMul (x1, finesine[ang]) - viewy;
|
ly = decaly - FixedMul (x1, finesine[ang]) - viewy;
|
||||||
|
|
|
@ -2211,8 +2211,8 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
}
|
}
|
||||||
// Check if sprite is in front of draw seg:
|
// Check if sprite is in front of draw seg:
|
||||||
if ((!spr->bWallSprite && neardepth > spr->depth) || ((spr->bWallSprite || fardepth > spr->depth) &&
|
if ((!spr->bWallSprite && neardepth > spr->depth) || ((spr->bWallSprite || fardepth > spr->depth) &&
|
||||||
DMulScale32(spr->gy - ds->curline->v1->y, ds->curline->v2->x - ds->curline->v1->x,
|
DMulScale32(spr->gy - ds->curline->v1->fixY(), ds->curline->v2->fixX() - ds->curline->v1->fixX(),
|
||||||
ds->curline->v1->x - spr->gx, ds->curline->v2->y - ds->curline->v1->y) <= 0))
|
ds->curline->v1->fixX() - spr->gx, ds->curline->v2->fixY() - ds->curline->v1->fixY()) <= 0))
|
||||||
{
|
{
|
||||||
// seg is behind sprite, so draw the mid texture if it has one
|
// seg is behind sprite, so draw the mid texture if it has one
|
||||||
if (ds->CurrentPortalUniq == CurrentPortalUniq && // [ZZ] instead, portal uniq check is made here
|
if (ds->CurrentPortalUniq == CurrentPortalUniq && // [ZZ] instead, portal uniq check is made here
|
||||||
|
|
Loading…
Reference in a new issue