Skip to content

Commit

Permalink
- renamed PlanesAtPointf to PlanesAtPoint
Browse files Browse the repository at this point in the history
The old PlanesAtPoint is not needed anymore.
  • Loading branch information
coelckers committed Feb 15, 2022
1 parent 08500ca commit a781517
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion source/core/gamefuncs.cpp
Expand Up @@ -185,7 +185,7 @@ void calcSlope(const sectortype* sec, float xpos, float ypos, float* pceilz, flo

void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pceilz, float* pflorz)
{
calcSlope(sec, dax, day, pceilz, pflorz);
calcSlope(sec, dax * worldtomap, day * worldtomap, pceilz, pflorz);
if (pceilz) *pceilz *= -(1 / 256.f);
if (pflorz) *pflorz *= -(1 / 256.f);
}
Expand Down
4 changes: 0 additions & 4 deletions source/core/gamefuncs.h
Expand Up @@ -157,10 +157,6 @@ void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp =
bool calcChaseCamPos(int* px, int* py, int* pz, DCoreActor* pspr, sectortype** psectnum, binangle ang, fixedhoriz horiz, double const smoothratio);

void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz);
inline void PlanesAtPointf(const sectortype* sec, float dax, float day, float* ceilz, float* florz)
{
PlanesAtPoint(sec, dax * worldtomap, day * worldtomap, ceilz, florz);
}

int getslopeval(sectortype* sect, int x, int y, int z, int planez);

Expand Down
2 changes: 1 addition & 1 deletion source/core/rendering/hw_vertexmap.cpp
Expand Up @@ -163,7 +163,7 @@ void vertex_t::RecalcVertexHeights()
float heights[2];

auto point = wall[masterwall].pos;
PlanesAtPointf(&sector[sect], point.X, point.Y, &heights[0], &heights[1]);
PlanesAtPoint(&sector[sect], point.X, point.Y, &heights[0], &heights[1]);
for(auto height : heights)
{
int k;
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/scene/hw_bunchdrawer.cpp
Expand Up @@ -168,11 +168,11 @@ bool BunchDrawer::CheckClip(walltype* wal, float* topclip, float* bottomclip)
// Mirrors and horizons always block the view
//if (linedef->special==Line_Mirror || linedef->special==Line_Horizon) return true;

PlanesAtPointf(frontsector, wal->pos.X, wal->pos.Y, &fs_ceilingheight1, &fs_floorheight1);
PlanesAtPointf(frontsector, pt2->pos.X, pt2->pos.Y, &fs_ceilingheight2, &fs_floorheight2);
PlanesAtPoint(frontsector, wal->pos.X, wal->pos.Y, &fs_ceilingheight1, &fs_floorheight1);
PlanesAtPoint(frontsector, pt2->pos.X, pt2->pos.Y, &fs_ceilingheight2, &fs_floorheight2);

PlanesAtPointf(backsector, wal->pos.X, wal->pos.Y, &bs_ceilingheight1, &bs_floorheight1);
PlanesAtPointf(backsector, pt2->pos.X, pt2->pos.Y, &bs_ceilingheight2, &bs_floorheight2);
PlanesAtPoint(backsector, wal->pos.X, wal->pos.Y, &bs_ceilingheight1, &bs_floorheight1);
PlanesAtPoint(backsector, pt2->pos.X, pt2->pos.Y, &bs_ceilingheight2, &bs_floorheight2);

*bottomclip = max(min(bs_floorheight1, bs_floorheight2), min(fs_floorheight1, fs_floorheight2));

Expand Down
2 changes: 1 addition & 1 deletion source/core/rendering/scene/hw_flats.cpp
Expand Up @@ -316,7 +316,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
const auto &vp = di->Viewpoint;

float florz, ceilz;
PlanesAtPointf(frontsector, vp.Pos.X, -vp.Pos.Y, &ceilz, &florz);
PlanesAtPoint(frontsector, vp.Pos.X, -vp.Pos.Y, &ceilz, &florz);

visibility = sectorVisibility(frontsector);
sec = frontsector;
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/scene/hw_walls.cpp
Expand Up @@ -914,8 +914,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
FVector2 v1(WallStartX(wal), WallStartY(wal));
FVector2 v2(WallEndX(wal), WallEndY(wal));

PlanesAtPointf(frontsector, wal->pos.X, wal->pos.Y, &fch1, &ffh1);
PlanesAtPointf(frontsector, p2wall->pos.X, p2wall->pos.Y, &fch2, &ffh2);
PlanesAtPoint(frontsector, wal->pos.X, wal->pos.Y, &fch1, &ffh1);
PlanesAtPoint(frontsector, p2wall->pos.X, p2wall->pos.Y, &fch2, &ffh2);


#ifdef _DEBUG
Expand Down Expand Up @@ -1008,8 +1008,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
float bfh2;
float bch1;
float bch2;
PlanesAtPointf(backsector, wal->pos.X, wal->pos.Y, &bch1, &bfh1);
PlanesAtPointf(backsector, p2wall->pos.X, p2wall->pos.Y, &bch2, &bfh2);
PlanesAtPoint(backsector, wal->pos.X, wal->pos.Y, &bch1, &bfh1);
PlanesAtPoint(backsector, p2wall->pos.X, p2wall->pos.Y, &bch2, &bfh2);

SkyTop(di, wal, frontsector, backsector, v1, v2, fch1, fch2);
SkyBottom(di, wal, frontsector, backsector, v1, v2, ffh1, ffh2);
Expand Down
12 changes: 6 additions & 6 deletions source/core/sectorgeometry.cpp
Expand Up @@ -63,8 +63,8 @@ static FVector3 CalcNormal(sectortype* sector, int plane)

pt[0] = { (float)WallStartX(wal), 0.f, (float)WallStartY(wal)};
pt[1] = { (float)WallStartX(wal2), 0.f, (float)WallStartY(wal2)};
PlanesAtPointf(sector, wal->pos.X, wal->pos.Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y);
PlanesAtPointf(sector, wal2->pos.X, wal2->pos.Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y);
PlanesAtPoint(sector, wal->pos.X, wal->pos.Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y);
PlanesAtPoint(sector, wal2->pos.X, wal2->pos.Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y);

if (pt[0].X == pt[1].X)
{
Expand All @@ -77,7 +77,7 @@ static FVector3 CalcNormal(sectortype* sector, int plane)
pt[2].X = pt[0].X;
pt[2].Z = pt[0].Z + 4;
}
PlanesAtPointf(sector, pt[2].X, -pt[2].Z, plane ? &pt[2].Y : nullptr, plane ? nullptr : &pt[2].Y);
PlanesAtPoint(sector, pt[2].X, -pt[2].Z, plane ? &pt[2].Y : nullptr, plane ? nullptr : &pt[2].Y);

auto normal = ((pt[2] - pt[0]) ^ (pt[1] - pt[0])).Unit();
if ((normal.Y < 0 && !plane) || (normal.Y > 0 && plane)) return -normal;
Expand Down Expand Up @@ -128,14 +128,14 @@ class UVCalculator
stat = sec->floorstat;
xpan = sec->floorxpan_;
ypan = sec->floorypan_;
PlanesAtPointf(sec, ix1, iy1, nullptr, &z1);
PlanesAtPoint(sec, ix1, iy1, nullptr, &z1);
}
else
{
stat = sec->ceilingstat;
xpan = sec->ceilingxpan_;
ypan = sec->ceilingypan_;
PlanesAtPointf(sec, ix1, iy1, &z1, nullptr);
PlanesAtPoint(sec, ix1, iy1, &z1, nullptr);
}

DVector2 dv = { (ix2 - ix1), -(iy2 - iy1) };
Expand Down Expand Up @@ -453,7 +453,7 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector
auto& tc = entry.texcoords[i];

pt.X = org.X; pt.Y = org.Y;
PlanesAtPointf(sectorp, pt.X, -pt.Y, plane ? &pt.Z : nullptr, !plane ? &pt.Z : nullptr);
PlanesAtPoint(sectorp, pt.X, -pt.Y, plane ? &pt.Z : nullptr, !plane ? &pt.Z : nullptr);
tc = uvcalc.GetUV(pt.X, -pt.Y, pt.Z);
}
sectorp->setfloorz(fz, true);
Expand Down

0 comments on commit a781517

Please sign in to comment.