Skip to content

Commit

Permalink
Fixed|World: Linking planes for render hacks
Browse files Browse the repository at this point in the history
The logic for linking planes with matching heights was incorrect.

IssueID #2370
  • Loading branch information
skyjake committed Feb 23, 2020
1 parent e58a089 commit f1b553a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions doomsday/apps/client/include/client/clientsubsector.h
Expand Up @@ -248,10 +248,11 @@ class ClientSubsector : public Subsector, public ILightSource

//- Visual Planes (mapped) --------------------------------------------------------------

enum VisPlaneLinkMode {
LinkWhenLowerThanTarget = 0x1,
LinkWhenHigherThanTarget = 0x2,
LinkAlways = 0x3,
enum VisPlaneLinkMode { // flags
LinkWhenLowerThanTarget = 0x1,
LinkWhenHigherThanTarget = 0x2,
LinkWhenDifferentThanTarget = 0x3,
LinkAlways = 0x4,
};

void linkVisPlane(int planeIndex, ClientSubsector &target, VisPlaneLinkMode linkMode);
Expand Down
12 changes: 6 additions & 6 deletions doomsday/apps/client/src/client/clientsubsector.cpp
Expand Up @@ -400,13 +400,13 @@ DENG2_PIMPL(ClientSubsector)
if (!visp->target) continue; // Not linked to anything.

// The actual height of the plane.
const double planeZ = self().sector().plane(planeIdx).heightSmoothed();
const coord_t planeZ = self().sector().plane(planeIdx).heightSmoothed();
const coord_t targetZ = visp->target->visPlane(planeIdx).heightSmoothed();

if ((visp->linkMode == LinkAlways) ||
(visp->linkMode == LinkWhenLowerThanTarget &&
planeZ < visp->target->visPlane(planeIdx).heightSmoothed()) ||
(visp->linkMode == LinkWhenHigherThanTarget &&
planeZ > visp->target->visPlane(planeIdx).heightSmoothed()))
if ( visp->linkMode == LinkAlways ||
(visp->linkMode == LinkWhenDifferentThanTarget && !fequal(planeZ, targetZ)) ||
(visp->linkMode == LinkWhenLowerThanTarget && planeZ < targetZ) ||
(visp->linkMode == LinkWhenHigherThanTarget && planeZ > targetZ))
{
linkVisPlane(planeIdx, visp->target);
}
Expand Down

0 comments on commit f1b553a

Please sign in to comment.