From 67f6f28b55318954d373a6235e8c8b486aca67ed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Feb 2017 13:14:59 +0100 Subject: [PATCH] - fixed: When finding the highest floor plane on a given side of a linedef, the necessary tests may not depend on the actual highest floor, which may originate from the other side of the line and cause valid planes that are between the currently set plane and the actual highest floor to be skipped. --- src/menu/menu.cpp | 2 +- src/p_3dfloors.cpp | 42 ++++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 9d8e5f4f3..676057321 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -1283,7 +1283,7 @@ DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int ce DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings) { - auto c = PClass::FindClass("OptionMenuItemControl"); + auto c = PClass::FindClass("OptionMenuItemControlBase"); auto p = c->CreateNew(); VMValue params[] = { p, FString(label), cmd.GetIndex(), bindings }; auto f = dyn_cast(c->Symbols.FindSymbol("Init", false)); diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index fa7b66d65..b699fadbd 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -773,7 +773,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li int highestfloorterrain = -1; FTextureID lowestceilingpic; sector_t *lowestceilingsec = NULL, *highestfloorsec = NULL; - secplane_t *highestfloorplanes[2] = { NULL, NULL }; + secplane_t *highestfloorplanes[2] = { &open.frontfloorplane, &open.backfloorplane }; highestfloorpic.SetInvalid(); lowestceilingpic.SetInvalid(); @@ -800,13 +800,19 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector; } - if(ff_top > highestfloor && delta1 <= delta2 && (!restrict || thing->Z() >= ff_top)) + if(delta1 <= delta2 && (!restrict || thing->Z() >= ff_top)) { - highestfloor = ff_top; - highestfloorpic = *rover->top.texture; - highestfloorterrain = rover->model->GetTerrain(rover->top.isceiling); - highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector; - highestfloorplanes[j] = rover->top.plane; + if (ff_top > highestfloor) + { + highestfloor = ff_top; + highestfloorpic = *rover->top.texture; + highestfloorterrain = rover->model->GetTerrain(rover->top.isceiling); + highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector; + } + if (ff_top > highestfloorplanes[j]->ZatPoint(x, y)) + { + highestfloorplanes[j] = rover->top.plane; + } } if(ff_top > lowestfloor[j] && ff_top <= thing->Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top; } @@ -818,18 +824,18 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li open.floorpic = highestfloorpic; open.floorterrain = highestfloorterrain; open.bottomsec = highestfloorsec; - if (highestfloorplanes[0]) - { - open.frontfloorplane = *highestfloorplanes[0]; - if (open.frontfloorplane.fC() < 0) open.frontfloorplane.FlipVert(); - } - if (highestfloorplanes[1]) - { - open.backfloorplane = *highestfloorplanes[1]; - if (open.backfloorplane.fC() < 0) open.backfloorplane.FlipVert(); - } } - + if (highestfloorplanes[0] != &open.frontfloorplane) + { + open.frontfloorplane = *highestfloorplanes[0]; + if (open.frontfloorplane.fC() < 0) open.frontfloorplane.FlipVert(); + } + if (highestfloorplanes[1] != &open.backfloorplane) + { + open.backfloorplane = *highestfloorplanes[1]; + if (open.backfloorplane.fC() < 0) open.backfloorplane.FlipVert(); + } + if(lowestceiling < open.top) { open.top = lowestceiling;