diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index df5d0d35f..6ec57b055 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -157,8 +157,8 @@ int LS_Sector_SetPlaneReflection (line_t *ln, AActor *it, bool backSide, while ((secnum = itr.Next()) >= 0) { sector_t * s = §ors[secnum]; - if (s->floorplane.a==0 && s->floorplane.b==0) s->reflect[sector_t::floor] = arg1/255.f; - if (s->ceilingplane.a==0 && s->ceilingplane.b==0) sectors[secnum].reflect[sector_t::ceiling] = arg2/255.f; + if (!s->floorplane.isSlope()) s->reflect[sector_t::floor] = arg1/255.f; + if (!s->ceilingplane.isSlope()) sectors[secnum].reflect[sector_t::ceiling] = arg2/255.f; } return true; diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index 3b879df7a..a13192694 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -324,7 +324,7 @@ static void PrepareTransparentDoors(sector_t * sector) if (sector->subsectorcount==0) return; sector->transdoorheight=sector->GetPlaneTexZ(sector_t::floor); - sector->transdoor= !(sector->e->XFloor.ffloors.Size() || sector->heightsec || sector->floorplane.a || sector->floorplane.b); + sector->transdoor= !(sector->e->XFloor.ffloors.Size() || sector->heightsec || sector->floorplane.isSlope()); if (sector->transdoor) { diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index d46bb4996..87df78a6b 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -275,14 +275,14 @@ public: void SetGlowPlanes(const secplane_t &top, const secplane_t &bottom) { - mGlowTopPlane.Set(FIXED2FLOAT(top.a), FIXED2FLOAT(top.b), FIXED2FLOAT(top.ic), FIXED2FLOAT(top.d)); - mGlowBottomPlane.Set(FIXED2FLOAT(bottom.a), FIXED2FLOAT(bottom.b), FIXED2FLOAT(bottom.ic), FIXED2FLOAT(bottom.d)); + mGlowTopPlane.Set(top.fA(), top.fB(), 1. / top.fC(), top.fD()); + mGlowBottomPlane.Set(bottom.fA(), bottom.fB(), 1. / bottom.fC(), bottom.fD()); } void SetSplitPlanes(const secplane_t &top, const secplane_t &bottom) { - mSplitTopPlane.Set(FIXED2FLOAT(top.a), FIXED2FLOAT(top.b), FIXED2FLOAT(top.ic), FIXED2FLOAT(top.d)); - mSplitBottomPlane.Set(FIXED2FLOAT(bottom.a), FIXED2FLOAT(bottom.b), FIXED2FLOAT(bottom.ic), FIXED2FLOAT(bottom.d)); + mSplitTopPlane.Set(top.fA(), top.fB(), 1. / top.fC(), top.fD()); + mSplitBottomPlane.Set(bottom.fA(), bottom.fB(), 1. / bottom.fC(), bottom.fD()); } void SetDynLight(float r, float g, float b) diff --git a/src/gl/scene/gl_fakeflat.cpp b/src/gl/scene/gl_fakeflat.cpp index 8399526da..101fcc8a3 100644 --- a/src/gl/scene/gl_fakeflat.cpp +++ b/src/gl/scene/gl_fakeflat.cpp @@ -80,44 +80,44 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto // on large levels this distinction can save some time // That's a lot of avoided multiplications if there's a lot to see! - if (frontsector->ceilingplane.a | frontsector->ceilingplane.b) + if (frontsector->ceilingplane.isSlope()) { fs_ceilingheight1=frontsector->ceilingplane.ZatPoint(linedef->v1); fs_ceilingheight2=frontsector->ceilingplane.ZatPoint(linedef->v2); } else { - fs_ceilingheight2=fs_ceilingheight1=frontsector->ceilingplane.d; + fs_ceilingheight2=fs_ceilingheight1=frontsector->ceilingplane.fixD(); } - if (frontsector->floorplane.a | frontsector->floorplane.b) + if (frontsector->floorplane.isSlope()) { fs_floorheight1=frontsector->floorplane.ZatPoint(linedef->v1); fs_floorheight2=frontsector->floorplane.ZatPoint(linedef->v2); } else { - fs_floorheight2=fs_floorheight1=-frontsector->floorplane.d; + fs_floorheight2=fs_floorheight1=-frontsector->floorplane.fixD(); } - if (backsector->ceilingplane.a | backsector->ceilingplane.b) + if (backsector->ceilingplane.isSlope()) { bs_ceilingheight1=backsector->ceilingplane.ZatPoint(linedef->v1); bs_ceilingheight2=backsector->ceilingplane.ZatPoint(linedef->v2); } else { - bs_ceilingheight2=bs_ceilingheight1=backsector->ceilingplane.d; + bs_ceilingheight2=bs_ceilingheight1=backsector->ceilingplane.fixD(); } - if (backsector->floorplane.a | backsector->floorplane.b) + if (backsector->floorplane.isSlope()) { bs_floorheight1=backsector->floorplane.ZatPoint(linedef->v1); bs_floorheight2=backsector->floorplane.ZatPoint(linedef->v2); } else { - bs_floorheight2=bs_floorheight1=-backsector->floorplane.d; + bs_floorheight2=bs_floorheight1=-backsector->floorplane.fixD(); } // now check for closed sectors! @@ -206,7 +206,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac // visual glitches because upper amd lower textures overlap. if (back && sec->planes[sector_t::floor].TexZ > sec->planes[sector_t::ceiling].TexZ) { - if (!(sec->floorplane.a | sec->floorplane.b | sec->ceilingplane.a | sec->ceilingplane.b)) + if (!sec->floorplane.isSlope() && !sec->ceilingplane.isSlope()) { *dest = *sec; dest->ceilingplane=sec->floorplane; diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index cffa1ee25..29602fbd2 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -174,7 +174,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli) void GLFlat::DrawSubsector(subsector_t * sub) { FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer(); - if (plane.plane.a | plane.plane.b) + if (plane.plane.isSlope()) { for (unsigned int k = 0; k < sub->numlines; k++) { diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 0fda331b4..1d69d2b99 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -810,7 +810,7 @@ void GLPlaneMirrorPortal::DrawContents() fixed_t planez = origin->ZatPoint(viewx, viewy); viewz = 2*planez - viewz; GLRenderer->mViewActor = NULL; - PlaneMirrorMode = ksgn(origin->c); + PlaneMirrorMode = origin->fC() < 0 ? -1 : 1; r_showviewer = true; validcount++; diff --git a/src/gl/scene/gl_renderhacks.cpp b/src/gl/scene/gl_renderhacks.cpp index 2a3839037..972e970d5 100644 --- a/src/gl/scene/gl_renderhacks.cpp +++ b/src/gl/scene/gl_renderhacks.cpp @@ -296,7 +296,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, fixed_t planez) sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, true); // Don't bother with slopes - if (sec->ceilingplane.a!=0 || sec->ceilingplane.b!=0) return false; + if (sec->ceilingplane.isSlope()) return false; // Is the neighboring ceiling lower than the desired height? if (sec->GetPlaneTexZ(sector_t::ceiling)backsector, &fakesec, true); // Don't bother with slopes - if (sec->floorplane.a!=0 || sec->floorplane.b!=0) return false; + if (sec->floorplane.isSlope()) return false; // Is the neighboring floor higher than the desired height? if (sec->GetPlaneTexZ(sector_t::floor)>planez) @@ -413,7 +413,7 @@ bool FDrawInfo::DoFakeBridge(subsector_t * subsec, fixed_t planez) sector_t * sec = gl_FakeFlat(seg->backsector, &fakesec, true); // Don't bother with slopes - if (sec->floorplane.a!=0 || sec->floorplane.b!=0) return false; + if (sec->floorplane.isSlope()) return false; // Is the neighboring floor higher than the desired height? if (sec->GetPlaneTexZ(sector_t::floor)backsector, &fakesec, true); // Don't bother with slopes - if (sec->ceilingplane.a!=0 || sec->ceilingplane.b!=0) return false; + if (sec->ceilingplane.isSlope()) return false; // Is the neighboring ceiling higher than the desired height? if (sec->GetPlaneTexZ(sector_t::ceiling)>planez) diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 3cedd38c3..3180b0ecf 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -173,8 +173,8 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect) } else if (allowreflect && sector->GetReflect(plane) > 0) { - if ((plane == sector_t::ceiling && viewz > sector->ceilingplane.d) || - (plane == sector_t::floor && viewz < -sector->floorplane.d)) return; + if ((plane == sector_t::ceiling && viewz > sector->ceilingplane.fixD()) || + (plane == sector_t::floor && viewz < -sector->floorplane.fixD())) return; ptype = PORTALTYPE_PLANEMIRROR; planemirror = plane == sector_t::ceiling ? §or->ceilingplane : §or->floorplane; } @@ -263,7 +263,7 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex return; // one more check for some ugly transparent door hacks - if (bs->floorplane.a==0 && bs->floorplane.b==0 && fs->floorplane.a==0 && fs->floorplane.b==0) + if (!bs->floorplane.isSlope() && !fs->floorplane.isSlope()) { if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+FRACUNIT) { @@ -309,7 +309,7 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::ceiling); - if (backreflect > 0 && bs->ceilingplane.d == fs->ceilingplane.d) + if (backreflect > 0 && bs->ceilingplane.fD() == fs->ceilingplane.fD()) { // Don't add intra-portal line to the portal. return; @@ -386,7 +386,7 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver if (frontreflect > 0) { float backreflect = bs->GetReflect(sector_t::floor); - if (backreflect > 0 && bs->floorplane.d == fs->floorplane.d) + if (backreflect > 0 && bs->floorplane.fD() == fs->floorplane.fD()) { // Don't add intra-portal line to the portal. return; diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 80961ae6d..30d5baecc 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -240,8 +240,9 @@ void GLSprite::Draw(int pass) if (lightlist) { // set up the light slice - static secplane_t bottommost = { 0, 0, FRACUNIT, 32767<GetAngle(ceiling); texture = sec->GetTexture(ceiling); plane = sec->GetSecPlane(ceiling); - texheight = (ceiling == sector_t::ceiling)? plane.d : -plane.d; + texheight = (ceiling == sector_t::ceiling)? plane.fixD() : -plane.fixD(); } }; @@ -205,7 +205,7 @@ private: fixed_t fch1, fixed_t fch2, fixed_t ffh1, fixed_t ffh2, fixed_t bch1, fixed_t bch2, fixed_t bfh1, fixed_t bfh2); - void GetPlanePos(F3DFloor::planeref *planeref, int &left, int &right); + void GetPlanePos(F3DFloor::planeref *planeref, fixed_t &left, fixed_t &right); void BuildFFBlock(seg_t * seg, F3DFloor * rover, fixed_t ff_topleft, fixed_t ff_topright, diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index fad482dda..28eb76777 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -191,7 +191,7 @@ void GLWall::PutPortal(int ptype) break; case PORTALTYPE_PLANEMIRROR: - if (GLPortal::PlaneMirrorMode * planemirror->c <=0) + if (GLPortal::PlaneMirrorMode * planemirror->fC() <=0) { //@sync-portal planemirror=UniquePlaneMirrors.Get(planemirror); @@ -283,7 +283,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent) if (iplane->a | planeref->plane->b) + if (planeref->plane->isSlope()) { left=planeref->plane->ZatPoint(vertexes[0]); right=planeref->plane->ZatPoint(vertexes[1]); } else if(planeref->isceiling == sector_t::ceiling) { - left = right = planeref->plane->d; + left = right = planeref->plane->fixD(); } else { - left = right = -planeref->plane->d; + left = right = -planeref->plane->fixD(); } } @@ -1450,7 +1450,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) bottomplane = frontsector->floorplane; // Save a little time (up to 0.3 ms per frame ;) ) - if (frontsector->floorplane.a | frontsector->floorplane.b) + if (frontsector->floorplane.isSlope()) { ffh1 = segfront->floorplane.ZatPoint(v1); ffh2 = segfront->floorplane.ZatPoint(v2); @@ -1459,11 +1459,11 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - ffh1 = ffh2 = -segfront->floorplane.d; + ffh1 = ffh2 = -segfront->floorplane.fixD(); zfloor[0] = zfloor[1] = FIXED2FLOAT(ffh2); } - if (segfront->ceilingplane.a | segfront->ceilingplane.b) + if (segfront->ceilingplane.isSlope()) { fch1 = segfront->ceilingplane.ZatPoint(v1); fch2 = segfront->ceilingplane.ZatPoint(v2); @@ -1472,7 +1472,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else { - fch1 = fch2 = segfront->ceilingplane.d; + fch1 = fch2 = segfront->ceilingplane.fixD(); zceil[0] = zceil[1] = FIXED2FLOAT(fch2); } @@ -1520,24 +1520,24 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) fixed_t bfh1; fixed_t bfh2; - if (segback->floorplane.a | segback->floorplane.b) + if (segback->floorplane.isSlope()) { bfh1 = segback->floorplane.ZatPoint(v1); bfh2 = segback->floorplane.ZatPoint(v2); } else { - bfh1 = bfh2 = -segback->floorplane.d; + bfh1 = bfh2 = -segback->floorplane.fixD(); } - if (segback->ceilingplane.a | segback->ceilingplane.b) + if (segback->ceilingplane.isSlope()) { bch1 = segback->ceilingplane.ZatPoint(v1); bch2 = segback->ceilingplane.ZatPoint(v2); } else { - bch1 = bch2 = segback->ceilingplane.d; + bch1 = bch2 = segback->ceilingplane.fixD(); } SkyTop(seg, frontsector, backsector, v1, v2); @@ -1568,8 +1568,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) { - if ((frontsector->ceilingplane.a | frontsector->ceilingplane.b | - backsector->ceilingplane.a | backsector->ceilingplane.b) && + if ((frontsector->ceilingplane.isSlope() || backsector->ceilingplane.isSlope()) && frontsector->GetTexture(sector_t::ceiling) != skyflatnum && backsector->GetTexture(sector_t::ceiling) != skyflatnum) { @@ -1649,8 +1648,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) { - if ((frontsector->floorplane.a | frontsector->floorplane.b | - backsector->floorplane.a | backsector->floorplane.b) && + if ((frontsector->ceilingplane.isSlope() || backsector->ceilingplane.isSlope()) && frontsector->GetTexture(sector_t::floor) != skyflatnum && backsector->GetTexture(sector_t::floor) != skyflatnum) { diff --git a/src/gl/utility/gl_geometric.cpp b/src/gl/utility/gl_geometric.cpp index 5e3f93ba8..ef9bc88d4 100644 --- a/src/gl/utility/gl_geometric.cpp +++ b/src/gl/utility/gl_geometric.cpp @@ -229,10 +229,10 @@ void Plane::Set(secplane_t &plane) { float a, b, c, d; - a = FIXED2FLOAT(plane.a); - b = FIXED2FLOAT(plane.b); - c = FIXED2FLOAT(plane.c); - d = FIXED2FLOAT(plane.d); + a = (float)plane.fA(); + b = (float)plane.fB(); + c = (float)plane.fC(); + d = (float)plane.fD(); m_normal.Set(a, c, b); //m_normal.Normalize(); the vector is already normalized