From a3d1efc8d63988214c8eab19dbaf1af15a0fec67 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 30 Dec 2017 12:08:32 +0200 Subject: [PATCH 1/9] Better angle selection for rotated automap sprites https://forum.zdoom.org/viewtopic.php?t=58348 --- src/am_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 2d80b59a0..452f82b78 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2950,7 +2950,7 @@ void AM_drawThings () const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); frame = &SpriteFrames[spriteIndex]; - DAngle angle = 270. -t->Angles.Yaw; + DAngle angle = 270. + 22.5 - t->Angles.Yaw; if (frame->Texture[0] != frame->Texture[1]) angle += 180. / 16; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { From 8f7ca00d1930bc9c1671fa36fd7f41ebaf3cee89 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 30 Dec 2017 12:10:39 +0200 Subject: [PATCH 2/9] Added optional angles to player's coordinates display Set hud_showangles CVAR to display pitch, yaw, roll below player's coordinates --- src/g_shared/shared_hud.cpp | 49 ++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index b3e9532d8..9dc90d908 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -96,6 +96,7 @@ CVAR (Int, hud_armor_yellow, 50, CVAR_ARCHIVE) // armor amount less than whic CVAR (Int, hud_armor_green, 100, CVAR_ARCHIVE) // armor amount above is blue, below is green CVAR (Bool, hud_berserk_health, true, CVAR_ARCHIVE); // when found berserk pack instead of health box +CVAR (Bool, hud_showangles, false, CVAR_ARCHIVE) // show player's pitch, yaw, roll CVAR (Int, hudcolor_titl, CR_YELLOW, CVAR_ARCHIVE) // color of automap title CVAR (Int, hudcolor_time, CR_RED, CVAR_ARCHIVE) // color of level/hub time @@ -907,20 +908,44 @@ static void DrawCoordinates(player_t * CPlayer) DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); - mysnprintf(coordstr, countof(coordstr), "X: %d", int(pos.X)); - screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+2*h, coordstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); + int linenum = 3; - mysnprintf(coordstr, countof(coordstr), "Y: %d", int(pos.Y)); - screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+3*h, coordstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); + typedef struct CoordEntry + { + const char* const format; + double value; + } + CoordEntryList[3]; - mysnprintf(coordstr, countof(coordstr), "Z: %d", int(pos.Z)); - screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+4*h, coordstr, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); + const auto drawentries = [&](CoordEntryList&& entries) + { + for (const auto& entry : entries) + { + mysnprintf(coordstr, countof(coordstr), entry.format, entry.value); + screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos + linenum * h, coordstr, + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); + ++linenum; + } + }; + + drawentries({ + { "X: %.0f", pos.X }, + { "Y: %.0f", pos.Y }, + { "Z: %.0f", pos.Z } + }); + + if (hud_showangles) + { + const DRotator& angles = CPlayer->mo->Angles; + ++linenum; + + drawentries({ + { "P: %.1f", angles.Pitch.Degrees }, + { "Y: %.1f", (90.0 - angles.Yaw).Normalized360().Degrees }, + { "R: %.1f", angles.Roll.Degrees }, + }); + } } //--------------------------------------------------------------------------- From 340f1fce30b633b07bf49e0ec65682c123ab2eef Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 30 Dec 2017 16:20:52 -0500 Subject: [PATCH 3/9] - load Doom translations when parsing UMAPINFO in order to activate the correct boss specials - one typo (only on a comment) change --- src/g_mapinfo.cpp | 2 +- src/umapinfo.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 0481c1784..951b6a346 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -2233,7 +2233,7 @@ void G_ParseMapInfo (FString basemapinfo) } if (nindex != 2) { - CommitUMapinfo(&gamedefaults); // UMPAINFOs are collected until a regular MAPINFO is found so that they properly use the base settings. + CommitUMapinfo(&gamedefaults); // UMAPINFOs are collected until a regular MAPINFO is found so that they properly use the base settings. FMapInfoParser parse(nindex == 1 ? FMapInfoParser::FMT_New : FMapInfoParser::FMT_Unknown); level_info_t defaultinfo; parse.ParseMapInfo(lump, gamedefaults, defaultinfo); diff --git a/src/umapinfo.cpp b/src/umapinfo.cpp index b6b435c40..b332a072a 100644 --- a/src/umapinfo.cpp +++ b/src/umapinfo.cpp @@ -332,6 +332,8 @@ static int ParseMapEntry(FScanner &scanner, UMapEntry *val) int ParseUMapInfo(int lumpnum) { + P_LoadTranslator("xlat/doom.txt"); + FScanner scanner(lumpnum); unsigned int i; From a5ded11994210e66fdad5fd28c7002c43f91d9e5 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 30 Dec 2017 16:36:29 -0500 Subject: [PATCH 4/9] - load translator from gameinfo instead of Doom for UMAPINFO --- src/umapinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/umapinfo.cpp b/src/umapinfo.cpp index b332a072a..745cdb94e 100644 --- a/src/umapinfo.cpp +++ b/src/umapinfo.cpp @@ -332,7 +332,7 @@ static int ParseMapEntry(FScanner &scanner, UMapEntry *val) int ParseUMapInfo(int lumpnum) { - P_LoadTranslator("xlat/doom.txt"); + P_LoadTranslator(gameinfo.translator); FScanner scanner(lumpnum); unsigned int i; From 40fd816d544319d26146e931bf1d9f200a1e1a76 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 11:34:12 +0200 Subject: [PATCH 5/9] Improved compatibility of blocking lines handling Only the first blocking line changes contact state during line iteration This reverts 3b818171d5f1796c0c1ff2acc0f06a233900324e https://forum.zdoom.org/viewtopic.php?t=57870 --- src/p_map.cpp | 132 ++++++++++++++++++++++++++++---------------------- 1 file changed, 75 insertions(+), 57 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index d71b22d85..56eea2e1f 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -856,7 +856,7 @@ static int LineIsBelow(line_t *line, AActor *actor) //========================================================================== static // killough 3/26/98: make static -bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::CheckResult &cres, const FBoundingBox &box, FCheckPosition &tm) +bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::CheckResult &cres, const FBoundingBox &box, FCheckPosition &tm, const bool wasfit) { line_t *ld = cres.line; bool rail = false; @@ -902,12 +902,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec double portz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling); if (tm.thing->Z() < portz && tm.thing->Z() + tm.thing->MaxStepHeight >= portz && tm.floorz < portz) { - tm.floorz = portz; - tm.floorsector = cres.line->frontsector; - tm.floorpic = cres.line->sidedef[0]->GetTexture(side_t::mid); - tm.floorterrain = 0; - tm.portalstep = true; - tm.portalgroup = cres.line->frontsector->GetOppositePortalGroup(sector_t::ceiling); + if (wasfit) + { + tm.floorz = portz; + tm.floorsector = cres.line->frontsector; + tm.floorpic = cres.line->sidedef[0]->GetTexture(side_t::mid); + tm.floorterrain = 0; + tm.portalstep = true; + tm.portalgroup = cres.line->frontsector->GetOppositePortalGroup(sector_t::ceiling); + } return true; } } @@ -916,7 +919,10 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec { P_DamageMobj(tm.thing, NULL, NULL, tm.thing->Mass >> 5, NAME_Melee); } - tm.thing->BlockingLine = ld; + if (wasfit) + { + tm.thing->BlockingLine = ld; + } CheckForPushSpecial(ld, 0, tm.thing); return false; } @@ -948,12 +954,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (state == -1) return true; if (state == 1) { - // the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line. - double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::floor); - if (portalz < tm.ceilingz) + if (wasfit) { - tm.ceilingz = portalz; - tm.ceilingsector = cres.line->frontsector; + // the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line. + double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::floor); + if (portalz < tm.ceilingz) + { + tm.ceilingz = portalz; + tm.ceilingsector = cres.line->frontsector; + } } return true; } @@ -965,12 +974,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (state == -1) return true; if (state == 1) { - double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling); - if (portalz > tm.floorz) + if (wasfit) { - tm.floorz = portalz; - tm.floorsector = cres.line->frontsector; - tm.floorterrain = 0; + double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling); + if (portalz > tm.floorz) + { + tm.floorz = portalz; + tm.floorsector = cres.line->frontsector; + tm.floorterrain = 0; + } } return true; } @@ -981,7 +993,10 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec { P_DamageMobj(tm.thing, NULL, NULL, tm.thing->Mass >> 5, NAME_Melee); } - tm.thing->BlockingLine = ld; + if (wasfit) + { + tm.thing->BlockingLine = ld; + } // Calculate line side based on the actor's original position, not the new one. CheckForPushSpecial(ld, P_PointOnLineSide(cres.Position, ld), tm.thing); return false; @@ -1000,9 +1015,12 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec double portz = tm.thing->Sector->GetPortalPlaneZ(sector_t::ceiling); if (tm.thing->Z() < portz && tm.thing->Z() + tm.thing->MaxStepHeight >= portz && tm.floorz < portz) { - // Actor is stepping through a portal. - tm.portalstep = true; - tm.portalgroup = tm.thing->Sector->GetOppositePortalGroup(sector_t::ceiling); + if (wasfit) + { + // Actor is stepping through a portal. + tm.portalstep = true; + tm.portalgroup = tm.thing->Sector->GetOppositePortalGroup(sector_t::ceiling); + } return true; } } @@ -1042,41 +1060,44 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec open.bottom += 32; } - // adjust floor / ceiling heights - if (!(cres.portalflags & FFCF_NOCEILING)) + if (wasfit) { - if (open.top < tm.ceilingz) + // adjust floor / ceiling heights + if (!(cres.portalflags & FFCF_NOCEILING)) { - tm.ceilingz = open.top; - tm.ceilingsector = open.topsec; - tm.ceilingpic = open.ceilingpic; - tm.ceilingline = ld; - tm.thing->BlockingLine = ld; - } - } - - // If we are stepping through a portal the line's opening must be checked, regardless of the NOFLOOR flag - if (!(cres.portalflags & FFCF_NOFLOOR) || (tm.portalstep && open.bottomsec->PortalGroup == tm.portalgroup)) - { - if (open.bottom > tm.floorz) - { - tm.floorz = open.bottom; - tm.floorsector = open.bottomsec; - tm.floorpic = open.floorpic; - tm.floorterrain = open.floorterrain; - tm.touchmidtex = open.touchmidtex; - tm.abovemidtex = open.abovemidtex; - tm.thing->BlockingLine = ld; - } - else if (open.bottom == tm.floorz) - { - tm.touchmidtex |= open.touchmidtex; - tm.abovemidtex |= open.abovemidtex; + if (open.top < tm.ceilingz) + { + tm.ceilingz = open.top; + tm.ceilingsector = open.topsec; + tm.ceilingpic = open.ceilingpic; + tm.ceilingline = ld; + tm.thing->BlockingLine = ld; + } } - if (open.lowfloor < tm.dropoffz) + // If we are stepping through a portal the line's opening must be checked, regardless of the NOFLOOR flag + if (!(cres.portalflags & FFCF_NOFLOOR) || (tm.portalstep && open.bottomsec->PortalGroup == tm.portalgroup)) { - tm.dropoffz = open.lowfloor; + if (open.bottom > tm.floorz) + { + tm.floorz = open.bottom; + tm.floorsector = open.bottomsec; + tm.floorpic = open.floorpic; + tm.floorterrain = open.floorterrain; + tm.touchmidtex = open.touchmidtex; + tm.abovemidtex = open.abovemidtex; + tm.thing->BlockingLine = ld; + } + else if (open.bottom == tm.floorz) + { + tm.touchmidtex |= open.touchmidtex; + tm.abovemidtex |= open.abovemidtex; + } + + if (open.lowfloor < tm.dropoffz) + { + tm.dropoffz = open.lowfloor; + } } } @@ -1881,7 +1902,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo while (it.Next(&lcres)) { - bool thisresult = PIT_CheckLine(it, lcres, it.Box(), tm); + bool thisresult = PIT_CheckLine(it, lcres, it.Box(), tm, good); good &= thisresult; if (thisresult) { @@ -5920,10 +5941,7 @@ bool P_AdjustFloorCeil(AActor *thing, FChangePosition *cpos) } bool isgood = P_CheckPosition(thing, thing->Pos(), tm); - - // This is essentially utterly broken because it even uses the return from a failed P_CheckPosition but the entire logic will break down if that isn't done. - // However, if tm.floorz is greater than tm.ceilingz we have a real problem that needs to be dealt with exolicitly. - if (!(thing->flags4 & MF4_ACTLIKEBRIDGE) && tm.floorz <= tm.ceilingz) + if (!(thing->flags4 & MF4_ACTLIKEBRIDGE)) { thing->floorz = tm.floorz; thing->ceilingz = tm.ceilingz; From de4fc97ac665114bdc4ed46e46c528be0b7191e1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 13:30:30 +0200 Subject: [PATCH 6/9] Fixed ammo limit for give cheat https://forum.zdoom.org/viewtopic.php?t=58930 --- src/p_mobj.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index dc0e76ad1..1cc9d96f6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -829,10 +829,16 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat) } else { - if (!givecheat) - item->Amount = amount; + if (givecheat) + { + item->Amount = MIN(amount, type->IsDescendantOf(NAME_Ammo) + ? item->IntVar("BackpackMaxAmount") + : item->MaxAmount); + } else - item->Amount = MIN (amount, item->MaxAmount); + { + item->Amount = amount; + } } } if (!item->CallTryPickup (this)) From 294bf6ed53ee8971bd3491e5effb109f2f1be6e1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 15:23:54 +0200 Subject: [PATCH 7/9] Simplified base class checks in AActor::GiveInventory() --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 1cc9d96f6..c688f0b98 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -823,7 +823,7 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat) item->ClearCounters(); if (!givecheat || amount > 0) { - if (type->IsDescendantOf (PClass::FindActor(NAME_BasicArmorPickup)) || type->IsDescendantOf(PClass::FindActor(NAME_BasicArmorBonus))) + if (type->IsDescendantOf(NAME_BasicArmorPickup) || type->IsDescendantOf(NAME_BasicArmorBonus)) { item->IntVar(NAME_SaveAmount) *= amount; } From 8f70d70dd6514c2ed4e4aaf748dae555aaca697e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 15:25:51 +0200 Subject: [PATCH 8/9] Generalized maximum amount for give cheat https://forum.zdoom.org/viewtopic.php?t=58930 --- src/p_mobj.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index c688f0b98..d5c5e93ea 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -831,9 +831,11 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat) { if (givecheat) { - item->Amount = MIN(amount, type->IsDescendantOf(NAME_Ammo) - ? item->IntVar("BackpackMaxAmount") - : item->MaxAmount); + const AInventory *const haveitem = FindInventory(type); + + item->Amount = MIN(amount, nullptr == haveitem + ? static_cast(GetDefaultByType(type))->MaxAmount + : haveitem->MaxAmount); } else { From 2c4eae74876bcf1f5c79320db106636cea37fed0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 21:29:27 +0200 Subject: [PATCH 9/9] Applied vertical offset to transferred sky in OpenGL renderer https://forum.zdoom.org/viewtopic.php?t=58934 --- src/gl/scene/gl_sky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 3186dc987..90642ddfd 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -69,7 +69,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor) if (!texture[0] || texture[0]->tex->UseType == FTexture::TEX_Null) goto normalsky; skytexno1 = texno; x_offset[0] = s->GetTextureXOffset(pos) * (360.f/65536.f); - y_offset = s->GetTextureYOffset(pos); + y_offset = s->GetTextureYOffset(pos) - 28.0; mirrored = !l->args[2]; } else