From 67f6f28b55318954d373a6235e8c8b486aca67ed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Feb 2017 13:14:59 +0100 Subject: [PATCH 1/3] - 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; From 46d12635cef78009e60ac452783023516cab5c5e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Feb 2017 13:17:20 +0100 Subject: [PATCH 2/3] - fixed warning --- src/p_udmf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index a13c24e63..fc71160ae 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1854,7 +1854,7 @@ public: intptr_t v1i = intptr_t(ParsedLines[i].v1); intptr_t v2i = intptr_t(ParsedLines[i].v2); - if (v1i >= level.vertexes.Size() || v2i >= level.vertexes.Size() || v1i < 0 || v2i < 0) + if ((unsigned)v1i >= level.vertexes.Size() || (unsigned)v2i >= level.vertexes.Size()) { I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %u vertices.", i+skipped, v1i, v2i, level.vertexes.Size()); } From bd86abede35f91bace6733c465f40084ebc9a070 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 15 Feb 2017 10:09:18 -0500 Subject: [PATCH 3/3] - fixed Skulltag rune bugs. 1) When used in a hub, returning to a previous level in the hub deactivated the runes if they were a permanent powerup. 2) When picking up two different runes with the same effect, one rune wearing off removed the effect completely. 3) This entire system was done through an extremely hacky CheatFlags implementation. This was a gross hack, and it was no wonder it didn't always work properly. --- src/g_inventory/a_weapons.cpp | 4 ++-- src/namedef.h | 2 ++ src/p_lnspec.cpp | 6 ++++-- src/p_pspr.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/g_inventory/a_weapons.cpp b/src/g_inventory/a_weapons.cpp index af180a4ea..fa9f63afa 100644 --- a/src/g_inventory/a_weapons.cpp +++ b/src/g_inventory/a_weapons.cpp @@ -230,7 +230,7 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo, int am int enough, enoughmask; int lAmmoUse1; - if ((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO)) + if ((dmflags & DF_INFINITE_AMMO) || (Owner->FindInventory (PClass::FindActor(NAME_PowerInfiniteAmmo), true) != nullptr)) { return true; } @@ -311,7 +311,7 @@ DEFINE_ACTION_FUNCTION(AWeapon, CheckAmmo) bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough, int ammouse) { - if (!((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO))) + if (!((dmflags & DF_INFINITE_AMMO) || (Owner->FindInventory (PClass::FindActor(NAME_PowerInfiniteAmmo), true) != nullptr))) { if (checkEnough && !CheckAmmo (altFire ? AltFire : PrimaryFire, false, false, ammouse)) { diff --git a/src/namedef.h b/src/namedef.h index a010fbb8a..ebd9f3e8e 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -203,6 +203,8 @@ xx(CallTryPickup) xx(QuestItem25) xx(QuestItem28) xx(QuestItem29) +xx(PowerDoubleFiringSpeed) +xx(PowerInfiniteAmmo) xx(AcolyteBlue) xx(SpectralLightningV1) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 5375085dd..e71cf2f79 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2841,7 +2841,7 @@ FUNC(LS_SetPlayerProperty) // Add or remove a power if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED) { - static ENamedName powers[11] = + static ENamedName powers[13] = { NAME_PowerInvulnerable, NAME_PowerStrength, @@ -2853,7 +2853,9 @@ FUNC(LS_SetPlayerProperty) NAME_PowerFlight, NAME_None, NAME_None, - NAME_PowerSpeed + NAME_PowerSpeed, + NAME_PowerInfiniteAmmo, + NAME_PowerDoubleFiringSpeed }; int power = arg2 - PROP_INVULNERABILITY; diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index bf6c79a82..8b8e93f6a 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -1381,7 +1381,7 @@ void DPSprite::Tick() Tics--; // [BC] Apply double firing speed. - if ((Flags & PSPF_POWDOUBLE) && Tics && (Owner->cheats & CF_DOUBLEFIRINGSPEED)) + if ((Flags & PSPF_POWDOUBLE) && Tics && (Owner->mo->FindInventory (PClass::FindActor(NAME_PowerDoubleFiringSpeed), true))) Tics--; if (!Tics)