From ff1eb7f3f21826582d9ac509c4e7c86ec518ddbf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 25 Jun 2018 10:27:02 +0200 Subject: [PATCH 01/17] - calculate a proper opening range when encountering a sector portal on a one-sided line in the sight checking code --- src/p_sight.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 1854b743b..d53343594 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -151,6 +151,7 @@ public: void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, double x, double y) { open.portalflags = 0; + open.bottom = open.top = 0; sector_t *front = linedef->frontsector; sector_t *back = linedef->backsector; @@ -159,8 +160,10 @@ void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, doubl // single sided line if (linedef->flags & ML_PORTALCONNECT) { - if (!front->PortalBlocksSight(sector_t::ceiling)) open.portalflags |= SO_TOPFRONT; - if (!front->PortalBlocksSight(sector_t::floor)) open.portalflags |= SO_BOTTOMFRONT; + if (!front->PortalBlocksSight(sector_t::ceiling)) open.top = LINEOPEN_MAX, open.portalflags |= SO_TOPFRONT; + if (!front->PortalBlocksSight(sector_t::floor)) open.bottom = LINEOPEN_MIN, open.portalflags |= SO_BOTTOMFRONT; + if (open.top == 0) open.top = front->floorplane.ZatPoint(x, y); + if (open.bottom == 0) open.bottom = front->ceilingplane.ZatPoint(x, y); } open.range = 0; @@ -213,7 +216,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) // // ignore self referencing sectors if COMPAT_TRACE is on - if ((i_compatflags & COMPATF_TRACE) && li->frontsector == li->backsector) + if ((i_compatflags & COMPATF_TRACE) && li->frontsector == li->backsector) return true; double trX = Trace.x + Trace.dx * in->frac; @@ -224,7 +227,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) { // This may not skip P_SightOpening, but only reduce the open range to 0. open.range = 0; - open.bottom = open.top; + if (open.bottom != LINEOPEN_MIN) open.bottom = open.top; } FLinePortal *lport = li->getPortal(); From f8272287d21e6455323418c7c5db242089496c9b Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 26 Jun 2018 02:19:47 +0200 Subject: [PATCH 02/17] - make softpoly use the r_dynlights cvar --- src/polyrenderer/scene/poly_plane.cpp | 6 ++++++ src/polyrenderer/scene/poly_wall.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index 55a4c11d0..08a8897e7 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -269,6 +269,12 @@ void RenderPolyPlane::SetLightLevel(PolyRenderThread *thread, PolyDrawArgs &args void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args, subsector_t *sub, bool ceiling) { + if (!r_dynlights) + { + args.SetLights(nullptr, 0); + return; + } + FLightNode *light_list = sub->lighthead; auto cameraLight = PolyCameraLight::Instance(); diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index 02eb5e7b2..7aae2c32c 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -374,6 +374,12 @@ void RenderPolyWall::Render(PolyRenderThread *thread) void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args) { + if (!r_dynlights) + { + args.SetLights(nullptr, 0); + return; + } + FLightNode *light_list = (LineSeg && LineSeg->sidedef) ? LineSeg->sidedef->lighthead : nullptr; auto cameraLight = PolyCameraLight::Instance(); From e402babfc00a84c1000dae39e458ed1880a5d470 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 26 Jun 2018 08:23:07 +0200 Subject: [PATCH 03/17] Fixed: Software rendered models checked the wrong CVAR for enabled dynamic lights. --- src/polyrenderer/scene/poly_model.cpp | 2 +- src/swrenderer/things/r_model.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/polyrenderer/scene/poly_model.cpp b/src/polyrenderer/scene/poly_model.cpp index 4251589d9..a49212989 100644 --- a/src/polyrenderer/scene/poly_model.cpp +++ b/src/polyrenderer/scene/poly_model.cpp @@ -56,7 +56,7 @@ PolyModelRenderer::PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worl void PolyModelRenderer::AddLights(AActor *actor) { - if (gl_lights && actor) + if (r_dynlights && actor) { auto &addedLights = Thread->AddedLightsArray; diff --git a/src/swrenderer/things/r_model.cpp b/src/swrenderer/things/r_model.cpp index 0991d1d45..70995c32c 100644 --- a/src/swrenderer/things/r_model.cpp +++ b/src/swrenderer/things/r_model.cpp @@ -98,7 +98,7 @@ namespace swrenderer void SWModelRenderer::AddLights(AActor *actor) { - if (gl_lights && actor) + if (r_dynlights && actor) { auto &addedLights = Thread->AddedLightsArray; From 0ed1077f2992aa2d0d509f091e905684dcdae75d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 26 Jun 2018 08:51:21 +0200 Subject: [PATCH 04/17] - correct checks for HasDynamicLights --- src/d_main.cpp | 2 +- src/g_shared/a_dynlight.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 4172909bc..ea727b6fb 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -786,7 +786,7 @@ void D_Display () // // Check for the presence of dynamic lights at the start of the frame once. - if (gl_lights) + if ((gl_lights && vid_rendermode == 4) || (r_dynlights && vid_rendermode != 4)) { TThinkerIterator it(STAT_DLIGHT); level.HasDynamicLights = !!it.Next(); diff --git a/src/g_shared/a_dynlight.h b/src/g_shared/a_dynlight.h index ae2493ca2..fa9d5840e 100644 --- a/src/g_shared/a_dynlight.h +++ b/src/g_shared/a_dynlight.h @@ -3,6 +3,7 @@ #include "actor.h" #include "cycler.h" +EXTERN_CVAR(Bool, r_dynlights) EXTERN_CVAR(Bool, gl_lights) EXTERN_CVAR(Bool, gl_attachedlights) From 446be98f37529696cf0e7b7acae3048f701ecee3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 26 Jun 2018 09:28:10 +0200 Subject: [PATCH 05/17] - fixed light application logic for flats. The light mode check wasn't done properly anymore after merging GLPASS_ALL and GLPASS_PLAIN. --- src/gl/scene/gl_flats.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index d50a00f9c..e399037fa 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -55,7 +55,6 @@ void FDrawInfo::SetupSubsectorLights(GLFlat *flat, int pass, subsector_t * sub, int *dli) { - if (isFullbrightScene()) return; if (dli != NULL && *dli != -1) { gl_RenderState.ApplyLightIndex(GLRenderer->mLights->GetIndex(*dli)); @@ -84,7 +83,6 @@ void FDrawInfo::SetupSubsectorLights(GLFlat *flat, int pass, subsector_t * sub, void FDrawInfo::SetupSectorLights(GLFlat *flat, int pass, int *dli) { - if (isFullbrightScene()) return; if (dli != NULL && *dli != -1) { gl_RenderState.ApplyLightIndex(GLRenderer->mLights->GetIndex(*dli)); @@ -303,6 +301,7 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m int rel = getExtraLight(); auto &plane = flat->plane; + auto processLights = level.HasDynamicLights && !isFullbrightScene(); gl_RenderState.SetNormal(plane.plane.Normal().X, plane.plane.Normal().Z, plane.plane.Normal().Y); switch (pass) @@ -316,19 +315,19 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m { gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture); - DrawSubsectors(flat, pass, (pass == GLPASS_ALL || flat->dynlightindex > -1), false); + DrawSubsectors(flat, pass, processLights && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1), false); gl_RenderState.EnableTextureMatrix(false); } else { gl_RenderState.SetMaterial(flat->gltexture, CLAMP_XY, 0, -1, false); - DrawSkyboxSector(flat, pass, (pass == GLPASS_ALL || flat->dynlightindex > -1)); + DrawSkyboxSector(flat, pass, processLights && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1)); } gl_RenderState.SetObjectColor(0xffffffff); break; case GLPASS_LIGHTSONLY: - if (!trans || flat->gltexture) + if ((!trans || flat->gltexture) && processLights) { ProcessLights(flat, trans); } @@ -353,7 +352,7 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture); - DrawSubsectors(flat, pass, (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1), true); + DrawSubsectors(flat, pass, processLights && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1), true); gl_RenderState.EnableTextureMatrix(false); } if (flat->renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); From cbe4c9c5c1ea2cbb193d548e96e9902f03faa61a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Jun 2018 08:51:45 +0200 Subject: [PATCH 06/17] Added lump size validation to the WAD loader --- src/resourcefiles/file_wad.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/resourcefiles/file_wad.cpp b/src/resourcefiles/file_wad.cpp index c7a3a262f..a0ae033db 100644 --- a/src/resourcefiles/file_wad.cpp +++ b/src/resourcefiles/file_wad.cpp @@ -188,6 +188,17 @@ bool FWadFile::Open(bool quiet) Lumps[i].Namespace = ns_global; Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0; Lumps[i].FullName = NULL; + + // Check if the lump is within the WAD file and print a warning if not. + if (Lumps[i].Position + Lumps[i].LumpSize > wadSize || Lumps[i].Position < 0 || Lumps[i].LumpSize < 0) + { + if (Lumps[i].LumpSize != 0) + { + Printf(PRINT_HIGH, "%s: Lump %s contains invalid positioning info and will be ignored\n", Filename, Lumps[i].Name); + Lumps[i].Name[0] = 0; + } + Lumps[i].LumpSize = Lumps[i].Position = 0; + } } delete[] fileinfo; From 97aba0c416510119758f612a52c46f8f76a9308d Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 24 Jun 2018 17:31:55 +0700 Subject: [PATCH 07/17] add tags for Doom and Heretic monsters Why? So mods that reveal enemy names don't show internal monster class names. Tags are based on language.enu lump: - Tags for Doom/Doom 2 monsters are referring directly to CC_* strings. - Tags for Heretic monsters are based on obituaries. - All tags match corresponding obituaries. --- wadsrc/static/language.enu | 35 ++++++++++++++++++++ wadsrc/static/zscript/doom/arachnotron.txt | 1 + wadsrc/static/zscript/doom/archvile.txt | 1 + wadsrc/static/zscript/doom/bruiser.txt | 2 ++ wadsrc/static/zscript/doom/cacodemon.txt | 1 + wadsrc/static/zscript/doom/cyberdemon.txt | 1 + wadsrc/static/zscript/doom/demon.txt | 2 ++ wadsrc/static/zscript/doom/doomimp.txt | 1 + wadsrc/static/zscript/doom/fatso.txt | 1 + wadsrc/static/zscript/doom/lostsoul.txt | 1 + wadsrc/static/zscript/doom/painelemental.txt | 1 + wadsrc/static/zscript/doom/possessed.txt | 4 +++ wadsrc/static/zscript/doom/revenant.txt | 1 + wadsrc/static/zscript/doom/spidermaster.txt | 1 + wadsrc/static/zscript/heretic/beast.txt | 1 + wadsrc/static/zscript/heretic/chicken.txt | 1 + wadsrc/static/zscript/heretic/clink.txt | 1 + wadsrc/static/zscript/heretic/dsparil.txt | 2 ++ wadsrc/static/zscript/heretic/hereticimp.txt | 1 + wadsrc/static/zscript/heretic/ironlich.txt | 1 + wadsrc/static/zscript/heretic/knight.txt | 1 + wadsrc/static/zscript/heretic/mummy.txt | 2 ++ wadsrc/static/zscript/heretic/snake.txt | 1 + wadsrc/static/zscript/heretic/wizard.txt | 1 + wadsrc/static/zscript/raven/minotaur.txt | 1 + wadsrc/static/zscript/shared/dog.txt | 1 + 26 files changed, 67 insertions(+) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index b73520259..0cb1e42fc 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -598,6 +598,27 @@ CC_SPIDER = "THE SPIDER MASTERMIND"; CC_CYBER = "THE CYBERDEMON"; CC_HERO = "OUR HERO"; +// Friendly names +FN_ZOMBIE = "Zombieman"; +FN_SHOTGUN = "Sergeant"; +FN_HEAVY = "Chaingunner"; +FN_IMP = "Imp"; +FN_DEMON = "Demon"; +FN_SPECTRE = "Spectre"; +FN_LOST = "Lost Soul"; +FN_CACO = "Cacodemon"; +FN_HELL = "Hell Knight"; +FN_BARON = "Baron of Hell"; +FN_ARACH = "Arachnotron"; +FN_PAIN = "Pain Elemental"; +FN_REVEN = "Revenant"; +FN_MANCU = "Mancubus"; +FN_ARCH = "Arch-vile"; +FN_SPIDER = "Spider Mastermind"; +FN_CYBER = "Cyberdemon"; +FN_WOLFSS = "Nazi"; +FN_DOG = "Dog"; + // New strings from BOOM PD_BLUEC = "You need a blue card to open this door"; PD_REDC = "You need a red card to open this door"; @@ -1300,6 +1321,20 @@ TXT_IMTIME = "TIME"; RAVENQUITMSG = "ARE YOU SURE YOU WANT TO QUIT?"; +// Friendly names +FN_CHICKEN = "Chicken"; +FN_BEAST = "Weredragon"; +FN_CLINK = "Sabreclaw"; +FN_DSPARIL = "D'Sparil"; +FN_HERETICIMP = "Gargoyle"; +FN_IRONLICH = "Ironlich"; +FN_BONEKNIGHT = "Undead Warrior"; +FN_MINOTAUR = "Maulotaur"; +FN_MUMMY = "Golem"; +FN_MUMMYLEADER = "Nitrogolem"; +FN_SNAKE = "Ophidian"; +FN_WIZARD = "Wizard"; + // Hexen strings // Mana diff --git a/wadsrc/static/zscript/doom/arachnotron.txt b/wadsrc/static/zscript/doom/arachnotron.txt index 36bb2b38e..35b9daf2a 100644 --- a/wadsrc/static/zscript/doom/arachnotron.txt +++ b/wadsrc/static/zscript/doom/arachnotron.txt @@ -21,6 +21,7 @@ class Arachnotron : Actor DeathSound "baby/death"; ActiveSound "baby/active"; Obituary "$OB_BABY"; + Tag "$FN_ARACH"; } States { diff --git a/wadsrc/static/zscript/doom/archvile.txt b/wadsrc/static/zscript/doom/archvile.txt index c6c3f53a8..4969c4553 100644 --- a/wadsrc/static/zscript/doom/archvile.txt +++ b/wadsrc/static/zscript/doom/archvile.txt @@ -25,6 +25,7 @@ class Archvile : Actor ActiveSound "vile/active"; MeleeSound "vile/stop"; Obituary "$OB_VILE"; + Tag "$FN_ARCH"; } States { diff --git a/wadsrc/static/zscript/doom/bruiser.txt b/wadsrc/static/zscript/doom/bruiser.txt index 234166669..1a8f97011 100644 --- a/wadsrc/static/zscript/doom/bruiser.txt +++ b/wadsrc/static/zscript/doom/bruiser.txt @@ -22,6 +22,7 @@ class BaronOfHell : Actor ActiveSound "baron/active"; Obituary "$OB_BARON"; HitObituary "$OB_BARONHIT"; + Tag "$FN_BARON"; } States { @@ -72,6 +73,7 @@ class HellKnight : BaronOfHell DeathSound "knight/death"; HitObituary "$OB_KNIGHTHIT"; Obituary "$OB_KNIGHT"; + Tag "$FN_HELL"; } States { diff --git a/wadsrc/static/zscript/doom/cacodemon.txt b/wadsrc/static/zscript/doom/cacodemon.txt index bdd3a6bbd..da6b58b16 100644 --- a/wadsrc/static/zscript/doom/cacodemon.txt +++ b/wadsrc/static/zscript/doom/cacodemon.txt @@ -21,6 +21,7 @@ class Cacodemon : Actor ActiveSound "caco/active"; Obituary "$OB_CACO"; HitObituary "$OB_CACOHIT"; + Tag "$FN_CACO"; } States { diff --git a/wadsrc/static/zscript/doom/cyberdemon.txt b/wadsrc/static/zscript/doom/cyberdemon.txt index 1a2890f9a..61fd1d273 100644 --- a/wadsrc/static/zscript/doom/cyberdemon.txt +++ b/wadsrc/static/zscript/doom/cyberdemon.txt @@ -27,6 +27,7 @@ class Cyberdemon : Actor DeathSound "cyber/death"; ActiveSound "cyber/active"; Obituary "$OB_CYBORG"; + Tag "$FN_CYBER"; } States { diff --git a/wadsrc/static/zscript/doom/demon.txt b/wadsrc/static/zscript/doom/demon.txt index ab51adccd..b93621da6 100644 --- a/wadsrc/static/zscript/doom/demon.txt +++ b/wadsrc/static/zscript/doom/demon.txt @@ -21,6 +21,7 @@ class Demon : Actor DeathSound "demon/death"; ActiveSound "demon/active"; Obituary "$OB_DEMONHIT"; + Tag "$FN_DEMON"; } States { @@ -71,6 +72,7 @@ class Spectre : Demon DeathSound "spectre/death"; ActiveSound "spectre/active"; HitObituary "$OB_SPECTREHIT"; + Tag "$FN_SPECTRE"; } } diff --git a/wadsrc/static/zscript/doom/doomimp.txt b/wadsrc/static/zscript/doom/doomimp.txt index 9a963c7d1..d690fffce 100644 --- a/wadsrc/static/zscript/doom/doomimp.txt +++ b/wadsrc/static/zscript/doom/doomimp.txt @@ -21,6 +21,7 @@ class DoomImp : Actor ActiveSound "imp/active"; HitObituary "$OB_IMPHIT"; Obituary "$OB_IMP"; + Tag "$FN_IMP"; } States { diff --git a/wadsrc/static/zscript/doom/fatso.txt b/wadsrc/static/zscript/doom/fatso.txt index 2e6321650..7d3c1197a 100644 --- a/wadsrc/static/zscript/doom/fatso.txt +++ b/wadsrc/static/zscript/doom/fatso.txt @@ -21,6 +21,7 @@ class Fatso : Actor DeathSound "fatso/death"; ActiveSound "fatso/active"; Obituary "$OB_FATSO"; + Tag "$FN_MANCU"; } States { diff --git a/wadsrc/static/zscript/doom/lostsoul.txt b/wadsrc/static/zscript/doom/lostsoul.txt index ce7f07f51..89086bf17 100644 --- a/wadsrc/static/zscript/doom/lostsoul.txt +++ b/wadsrc/static/zscript/doom/lostsoul.txt @@ -22,6 +22,7 @@ class LostSoul : Actor ActiveSound "skull/active"; RenderStyle "SoulTrans"; Obituary "$OB_SKULL"; + Tag "$FN_LOST"; } States { diff --git a/wadsrc/static/zscript/doom/painelemental.txt b/wadsrc/static/zscript/doom/painelemental.txt index fe9e0590a..f953e47ef 100644 --- a/wadsrc/static/zscript/doom/painelemental.txt +++ b/wadsrc/static/zscript/doom/painelemental.txt @@ -20,6 +20,7 @@ class PainElemental : Actor PainSound "pain/pain"; DeathSound "pain/death"; ActiveSound "pain/active"; + Tag "$FN_PAIN"; } States { diff --git a/wadsrc/static/zscript/doom/possessed.txt b/wadsrc/static/zscript/doom/possessed.txt index 8b6612076..51505c80b 100644 --- a/wadsrc/static/zscript/doom/possessed.txt +++ b/wadsrc/static/zscript/doom/possessed.txt @@ -21,6 +21,7 @@ class ZombieMan : Actor DeathSound "grunt/death"; ActiveSound "grunt/active"; Obituary "$OB_ZOMBIE"; + Tag "$FN_ZOMBIE"; DropItem "Clip"; } States @@ -84,6 +85,7 @@ class ShotgunGuy : Actor DeathSound "shotguy/death"; ActiveSound "shotguy/active"; Obituary "$OB_SHOTGUY"; + Tag "$FN_SHOTGUN"; DropItem "Shotgun"; } States @@ -147,6 +149,7 @@ class ChaingunGuy : Actor ActiveSound "chainguy/active"; AttackSound "chainguy/attack"; Obituary "$OB_CHAINGUY"; + Tag "$FN_HEAVY"; Dropitem "Chaingun"; } States @@ -209,6 +212,7 @@ class WolfensteinSS : Actor ActiveSound "wolfss/active"; AttackSound "wolfss/attack"; Obituary "$OB_WOLFSS"; + Tag "$FN_WOLFSS"; Dropitem "Clip"; } States diff --git a/wadsrc/static/zscript/doom/revenant.txt b/wadsrc/static/zscript/doom/revenant.txt index 67b5d0b1d..91363edb8 100644 --- a/wadsrc/static/zscript/doom/revenant.txt +++ b/wadsrc/static/zscript/doom/revenant.txt @@ -24,6 +24,7 @@ class Revenant : Actor MeleeSound "skeleton/melee"; HitObituary "$OB_UNDEADHIT"; Obituary "$OB_UNDEAD"; + Tag "$FN_REVEN"; } States { diff --git a/wadsrc/static/zscript/doom/spidermaster.txt b/wadsrc/static/zscript/doom/spidermaster.txt index 5e1a39d76..c6aaa9cfd 100644 --- a/wadsrc/static/zscript/doom/spidermaster.txt +++ b/wadsrc/static/zscript/doom/spidermaster.txt @@ -26,6 +26,7 @@ class SpiderMastermind : Actor DeathSound "spider/death"; ActiveSound "spider/active"; Obituary "$OB_SPIDER"; + Tag "$FN_SPIDER"; } States { diff --git a/wadsrc/static/zscript/heretic/beast.txt b/wadsrc/static/zscript/heretic/beast.txt index e5f30d25b..a27bb70bd 100644 --- a/wadsrc/static/zscript/heretic/beast.txt +++ b/wadsrc/static/zscript/heretic/beast.txt @@ -19,6 +19,7 @@ class Beast : Actor DeathSound "beast/death"; ActiveSound "beast/active"; Obituary "$OB_BEAST"; + Tag "$FN_BEAST"; DropItem "CrossbowAmmo", 84, 10; } States diff --git a/wadsrc/static/zscript/heretic/chicken.txt b/wadsrc/static/zscript/heretic/chicken.txt index b60a89136..38b76894e 100644 --- a/wadsrc/static/zscript/heretic/chicken.txt +++ b/wadsrc/static/zscript/heretic/chicken.txt @@ -256,6 +256,7 @@ class Chicken : MorphedMonster DeathSound "chicken/death"; ActiveSound "chicken/active"; Obituary "$OB_CHICKEN"; + Tag "$FN_CHICKEN"; } States { diff --git a/wadsrc/static/zscript/heretic/clink.txt b/wadsrc/static/zscript/heretic/clink.txt index 7549ff097..5dc1aa39d 100644 --- a/wadsrc/static/zscript/heretic/clink.txt +++ b/wadsrc/static/zscript/heretic/clink.txt @@ -17,6 +17,7 @@ class Clink : Actor DeathSound "clink/death"; ActiveSound "clink/active"; Obituary "$OB_CLINK"; + Tag "$FN_CLINK"; DropItem "SkullRodAmmo", 84, 20; } States diff --git a/wadsrc/static/zscript/heretic/dsparil.txt b/wadsrc/static/zscript/heretic/dsparil.txt index fc4ade00e..c8c78bb8e 100644 --- a/wadsrc/static/zscript/heretic/dsparil.txt +++ b/wadsrc/static/zscript/heretic/dsparil.txt @@ -36,6 +36,7 @@ class Sorcerer1 : Actor ActiveSound "dsparilserpent/active"; Obituary "$OB_DSPARIL1"; HitObituary "$OB_DSPARIL1HIT"; + Tag "$FN_DSPARIL"; } @@ -237,6 +238,7 @@ class Sorcerer2 : Actor ActiveSound "dsparil/active"; Obituary "$OB_DSPARIL2"; HitObituary "$OB_DSPARIL2HIT"; + Tag "$FN_DSPARIL"; } diff --git a/wadsrc/static/zscript/heretic/hereticimp.txt b/wadsrc/static/zscript/heretic/hereticimp.txt index 11430712a..3a938b4ed 100644 --- a/wadsrc/static/zscript/heretic/hereticimp.txt +++ b/wadsrc/static/zscript/heretic/hereticimp.txt @@ -26,6 +26,7 @@ class HereticImp : Actor ActiveSound "himp/active"; Obituary "$OB_HERETICIMP"; HitObituary "$OB_HERETICIMPHIT"; + Tag "$FN_HERETICIMP"; } States diff --git a/wadsrc/static/zscript/heretic/ironlich.txt b/wadsrc/static/zscript/heretic/ironlich.txt index db0985e6d..cf64a6aec 100644 --- a/wadsrc/static/zscript/heretic/ironlich.txt +++ b/wadsrc/static/zscript/heretic/ironlich.txt @@ -23,6 +23,7 @@ class Ironlich : Actor ActiveSound "ironlich/active"; Obituary "$OB_IRONLICH"; HitObituary "$OB_IRONLICHHIT"; + Tag "$FN_IRONLICH"; DropItem "BlasterAmmo", 84, 10; DropItem "ArtiEgg", 51, 0; } diff --git a/wadsrc/static/zscript/heretic/knight.txt b/wadsrc/static/zscript/heretic/knight.txt index ada592ccf..1bc71d6af 100644 --- a/wadsrc/static/zscript/heretic/knight.txt +++ b/wadsrc/static/zscript/heretic/knight.txt @@ -20,6 +20,7 @@ class Knight : Actor ActiveSound "hknight/active"; Obituary "$OB_BONEKNIGHT"; HitObituary "$OB_BONEKNIGHTHIT"; + Tag "$FN_BONEKNIGHT"; DropItem "CrossbowAmmo", 84, 5; } diff --git a/wadsrc/static/zscript/heretic/mummy.txt b/wadsrc/static/zscript/heretic/mummy.txt index 5ccedc9e4..928439ecc 100644 --- a/wadsrc/static/zscript/heretic/mummy.txt +++ b/wadsrc/static/zscript/heretic/mummy.txt @@ -19,6 +19,7 @@ class Mummy : Actor DeathSound "mummy/death"; ActiveSound "mummy/active"; HitObituary "$OB_MUMMY"; + Tag "$FN_MUMMY"; DropItem "GoldWandAmmo", 84, 3; } States @@ -60,6 +61,7 @@ class MummyLeader : Mummy Health 100; Painchance 64; Obituary "$OB_MUMMYLEADER"; + Tag "$FN_MUMMYLEADER"; } States { diff --git a/wadsrc/static/zscript/heretic/snake.txt b/wadsrc/static/zscript/heretic/snake.txt index e2f5b381f..6f741e93d 100644 --- a/wadsrc/static/zscript/heretic/snake.txt +++ b/wadsrc/static/zscript/heretic/snake.txt @@ -16,6 +16,7 @@ class Snake : Actor DeathSound "snake/death"; ActiveSound "snake/active"; Obituary "$OB_SNAKE"; + Tag "$FN_SNAKE"; DropItem "PhoenixRodAmmo", 84, 5; } States diff --git a/wadsrc/static/zscript/heretic/wizard.txt b/wadsrc/static/zscript/heretic/wizard.txt index d799e5721..ae12e5838 100644 --- a/wadsrc/static/zscript/heretic/wizard.txt +++ b/wadsrc/static/zscript/heretic/wizard.txt @@ -22,6 +22,7 @@ class Wizard : Actor ActiveSound "wizard/active"; Obituary "$OB_WIZARD"; HitObituary "$OB_WIZARDHIT"; + Tag "$FN_WIZARD"; DropItem "BlasterAmmo", 84, 10; DropItem "ArtiTomeOfPower", 4, 0; } diff --git a/wadsrc/static/zscript/raven/minotaur.txt b/wadsrc/static/zscript/raven/minotaur.txt index 1738bc3f6..5a85ac877 100644 --- a/wadsrc/static/zscript/raven/minotaur.txt +++ b/wadsrc/static/zscript/raven/minotaur.txt @@ -30,6 +30,7 @@ class Minotaur : Actor DropItem "PhoenixRodAmmo", 84, 10; Obituary "$OB_MINOTAUR"; HitObituary "$OB_MINOTAURHIT"; + Tag "$FN_MINOTAUR"; } States diff --git a/wadsrc/static/zscript/shared/dog.txt b/wadsrc/static/zscript/shared/dog.txt index 663dd6b98..a623344c7 100644 --- a/wadsrc/static/zscript/shared/dog.txt +++ b/wadsrc/static/zscript/shared/dog.txt @@ -16,6 +16,7 @@ class MBFHelperDog : Actor PainSound "dog/pain"; SeeSound "dog/sight"; Obituary "$OB_DOG"; + Tag "$FN_DOG"; } States { From 43919ead4057082acb5d742b0cbc07d403b7ef01 Mon Sep 17 00:00:00 2001 From: Erick Tenorio Date: Tue, 26 Jun 2018 15:16:29 -0500 Subject: [PATCH 08/17] Various map fixes Map fixes for the following maps: MAP33: Betray (Doom II: BFG Edition) Icarus: https://www.doomworld.com/idgames/themes/TeamTNT/icarus/icarus Flashback to Hell: https://www.doomworld.com/idgames/levels/doom2/Ports/d-f/fth666 Hell to Pay (HTP-RAW.WAD) --- wadsrc/static/compatibility.txt | 1 + wadsrc/static/zscript/level_compatibility.txt | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index f5ea9710d..621f2f9ad 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -59,6 +59,7 @@ F84AB4557464A383E93F37CD3A82AC48 // MM2 map03 71C2E6D9CFA3D8750C6A9599FB2453BD // Hacx map03: There are some switches behind 96368EB950E33AF62EA6423434E3CEF7 // HacX map17: shootable covers in these levels BA530202AF0BA0C6CBAE6A0C7076FB72 // Requiem map04 +E2819F69CB79BA66E0ACBCD7DE652F9D // Hell to Pay MAP32: Exit switch pressable through lasers { useblocking } diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt index ddd308a75..76060956d 100644 --- a/wadsrc/static/zscript/level_compatibility.txt +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -401,6 +401,26 @@ class LevelCompatibility play } break; } + + case '915409A89746D6BFD92C7956BE6A0A2D': // Doom II: BFG Edition MAP33 + { + // Missing textures on sector with a Super Shotgun at map start. + TextureID rock2 = TexMan.CheckForTexture("ROCK2", TexMan.Type_Wall); + for(int i=0; i<4; i++) + { + SetWallTextureID(567+i, Line.front, Side.bottom, ROCK2); + SetWallTextureID(567+i, Line.back, Side.top, ROCK2); + } + // Tags the linedefs on the teleporter at the end of the level so that + // it's possible to leave the room near the yellow keycard door. + for(int i=0; i<2; i++) + { + SetLineSpecial(400+i, Teleport, 0, 36); + SetLineSpecial(559+i, Teleport, 0, 36); + } + break; + } + case 'ABC4EB5A1535ECCD0061AD14F3547908': // Plutonia Experiment, map26 { SetSectorSpecial(156, 0); @@ -702,6 +722,48 @@ class LevelCompatibility play GetDefaultActor('WolfensteinSS').bActivateMCross = true; break; } + + case 'D67CECE3F60083383DF992B8C824E4AC': // Icarus: Alien Vanuguard MAP13 + { + // Moves sector special to platform with Berserk powerup. The + // map's only secret can now be scored. + SetSectorSpecial(119, 0); + SetSectorSpecial(122, 1024); + break; + } + + case '61373587339A768854E2912CC99A4781': // Icarus: Alien Vanuguard MAP15 + { + // Can press use on the lift to reveal the secret Shotgun, + // making 100% secrets possible. + SetLineSpecial(222, Plat_DownWaitUpStayLip, 11, 64, 105, 0); + SetLineActivation(222, SPAC_Use); + SetLineFlags(222, Line.ML_REPEAT_SPECIAL); + break; + } + + case '9F66B0797925A09D4DC0725540F8EEF7': // Icarus: Alien Vanuguard MAP16 + { + // Can press use on the walls at the secret Rocket Launcher in + // case of getting stuck. + for(int i=0; i<7; i++) + { + SetLineSpecial(703+i, Plat_DownWaitUpStayLip, 14, 64, 105, 0); + SetLineActivation(703+i, SPAC_Use); + SetLineFlags(703+i, Line.ML_REPEAT_SPECIAL); + } + break; + } + + case '09645D198010BF634EF0DE3EFCB0052C': // Flashback to Hell MAP12 + { + // Can press use behind bookshelf in case of getting stuck. + SetLineSpecial(4884, Plat_DownWaitUpStayLip, 15, 32, 105, 0); + SetLineActivation(4884, SPAC_Use); + SetLineActivation(4884, SPAC_UseBack); + SetLineFlags(4884, Line.ML_REPEAT_SPECIAL); + break; + } } } From 245801ca17d8fcc699aed411c65c60d178d9f1f1 Mon Sep 17 00:00:00 2001 From: Erick Tenorio Date: Tue, 26 Jun 2018 20:03:20 -0500 Subject: [PATCH 09/17] Removed useless SetLineActivation SPAC_Use removed as the line in fth666.wad MAP12 is not facing front. --- wadsrc/static/zscript/level_compatibility.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt index 76060956d..d91f1b19b 100644 --- a/wadsrc/static/zscript/level_compatibility.txt +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -759,7 +759,6 @@ class LevelCompatibility play { // Can press use behind bookshelf in case of getting stuck. SetLineSpecial(4884, Plat_DownWaitUpStayLip, 15, 32, 105, 0); - SetLineActivation(4884, SPAC_Use); SetLineActivation(4884, SPAC_UseBack); SetLineFlags(4884, Line.ML_REPEAT_SPECIAL); break; From a968aeba8a5958e51474e81b8778608755960723 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 28 Jun 2018 11:06:19 +0300 Subject: [PATCH 10/17] - added detection of macOS Mojave --- src/posix/cocoa/i_main.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index 665f2203a..e1b388d3d 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -152,6 +152,7 @@ static void I_DetectOS() case 11: name = "OS X El Capitan"; break; case 12: name = "macOS Sierra"; break; case 13: name = "macOS High Sierra"; break; + case 14: name = "macOS Mojave"; break; } char release[16] = "unknown"; From c30505d02aa9f8b5d961f748e4b8870f35a167b2 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 11:33:59 +0300 Subject: [PATCH 11/17] - fixed excess keyboard events in Cocoa backend https://forum.zdoom.org/viewtopic.php?t=61104 --- src/posix/cocoa/i_input.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 78841d906..c6fc86e44 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -559,11 +559,13 @@ void ProcessKeyboardEvent(NSEvent* theEvent) return; } + const bool isARepeat = [theEvent isARepeat]; + if (k_allowfullscreentoggle && (kVK_ANSI_F == keyCode) && (NSCommandKeyMask & [theEvent modifierFlags]) && (NSKeyDown == [theEvent type]) - && ![theEvent isARepeat]) + && !isARepeat) { ToggleFullscreen = !ToggleFullscreen; return; @@ -573,7 +575,7 @@ void ProcessKeyboardEvent(NSEvent* theEvent) { ProcessKeyboardEventInMenu(theEvent); } - else + else if (!isARepeat) { event_t event = {}; From 6e4c0fc416eab642d8ad61d87fb32141a8c42bca Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 11:57:01 +0300 Subject: [PATCH 12/17] - disabled annoying macOS spaces in SDL backend --- src/posix/sdl/hardware.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 3c000cb8e..eda9081e3 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -69,6 +69,10 @@ void I_ShutdownGraphics () void I_InitGraphics () { +#ifdef __APPLE__ + SDL_SetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, "0"); +#endif // __APPLE__ + if (SDL_InitSubSystem (SDL_INIT_VIDEO) < 0) { I_FatalError ("Could not initialize SDL video:\n%s\n", SDL_GetError()); From 0342bf532d02381bdd04addf6643e95f6b18d26a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 12:20:26 +0300 Subject: [PATCH 13/17] - fixed excess keyboard events in SDL backend https://forum.zdoom.org/viewtopic.php?t=61104 --- src/posix/sdl/i_input.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/posix/sdl/i_input.cpp b/src/posix/sdl/i_input.cpp index 88c43050c..561870a4e 100644 --- a/src/posix/sdl/i_input.cpp +++ b/src/posix/sdl/i_input.cpp @@ -407,6 +407,11 @@ void MessagePump (const SDL_Event &sev) case SDL_KEYUP: if (!GUICapture) { + if (sev.key.repeat) + { + break; + } + event.type = sev.type == SDL_KEYDOWN ? EV_KeyDown : EV_KeyUp; // Try to look up our key mapped key for conversion to DirectInput. From 0703030be3551b1914bec99ce6140d84db39c0c0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 12:26:30 +0300 Subject: [PATCH 14/17] - simplified key repeat detection in SDL backend --- src/posix/sdl/i_input.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/posix/sdl/i_input.cpp b/src/posix/sdl/i_input.cpp index 561870a4e..fe777d77a 100644 --- a/src/posix/sdl/i_input.cpp +++ b/src/posix/sdl/i_input.cpp @@ -64,8 +64,6 @@ EXTERN_CVAR (Bool, fullscreen) extern int WaitingForKey, chatmodeon; extern constate_e ConsoleState; -static bool DownState[SDL_NUM_SCANCODES]; - static const SDL_Keycode DIKToKeySym[256] = { 0, SDLK_ESCAPE, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, @@ -190,10 +188,6 @@ static void I_CheckGUICapture () if (wantCapt != GUICapture) { GUICapture = wantCapt; - if (wantCapt) - { - memset (DownState, 0, sizeof(DownState)); - } ResetButtonStates(); } } @@ -441,17 +435,9 @@ void MessagePump (const SDL_Event &sev) ((kmod & KMOD_CTRL) ? GKM_CTRL : 0) | ((kmod & KMOD_ALT) ? GKM_ALT : 0); - if (event.subtype == EV_GUI_KeyDown) + if (event.subtype == EV_GUI_KeyDown && sev.key.repeat) { - if (DownState[sev.key.keysym.scancode]) - { - event.subtype = EV_GUI_KeyRepeat; - } - DownState[sev.key.keysym.scancode] = 1; - } - else - { - DownState[sev.key.keysym.scancode] = 0; + event.subtype = EV_GUI_KeyRepeat; } switch (sev.key.keysym.sym) From 907ce777a35160a554661255267668d024b3fa12 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 13:47:06 +0300 Subject: [PATCH 15/17] - added extra validation for status bar classes Print a message when status bar class defined in GAMEINFO is missing or when it's not derived from BaseStatusBar Validate internal status bar classes for basic consistency in Debug configuration --- src/g_statusbar/sbarinfo.cpp | 6 ++++- src/g_statusbar/shared_sbar.cpp | 40 ++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index 7e7ace6a3..9c3c71017 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -1567,7 +1567,11 @@ DBaseStatusBar *CreateCustomStatusBar(int scriptno) auto script = SBarInfoScript[scriptno]; if (script == nullptr) return nullptr; - auto sbar = (DBaseStatusBar*)PClass::FindClass("SBarInfoWrapper")->CreateNew(); + PClass *sbarclass = PClass::FindClass("SBarInfoWrapper"); + assert(sbarclass != nullptr); + assert(sbarclass->IsDescendantOf(RUNTIME_CLASS(DBaseStatusBar))); + auto sbar = (DBaseStatusBar*)sbarclass->CreateNew(); + auto core = new DSBarInfo(sbar, script); sbar->PointerVar("core") = core; sbar->SetSize(script->height, script->_resW, script->_resH); diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index e0e2cc9d5..7236bc39b 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -247,6 +247,31 @@ static void CreateBaseStatusBar() StatusBar->SetSize(0); } +static void CreateGameInfoStatusBar(bool &shouldWarn) +{ + auto cls = PClass::FindClass(gameinfo.statusbarclass); + if (cls == nullptr) + { + if (shouldWarn) + { + Printf(TEXTCOLOR_RED "Unknown status bar class \"%s\"\n", gameinfo.statusbarclass.GetChars()); + shouldWarn = false; + } + } + else + { + if (cls->IsDescendantOf(RUNTIME_CLASS(DBaseStatusBar))) + { + StatusBar = (DBaseStatusBar *)cls->CreateNew(); + } + else if (shouldWarn) + { + Printf(TEXTCOLOR_RED "Status bar class \"%s\" is not derived from BaseStatusBar\n", gameinfo.statusbarclass.GetChars()); + shouldWarn = false; + } + } +} + void ST_CreateStatusBar(bool bTitleLevel) { if (StatusBar != NULL) @@ -255,6 +280,8 @@ void ST_CreateStatusBar(bool bTitleLevel) StatusBar = NULL; } + bool shouldWarn = true; + if (bTitleLevel) { CreateBaseStatusBar(); @@ -268,11 +295,7 @@ void ST_CreateStatusBar(bool bTitleLevel) int sbarinfofile = Wads.GetLumpFile(sbarinfolump); if (gameinfo.statusbarclassfile >= gameinfo.statusbarfile && gameinfo.statusbarclassfile >= sbarinfofile) { - auto cls = PClass::FindClass(gameinfo.statusbarclass); - if (cls != nullptr) - { - StatusBar = (DBaseStatusBar *)cls->CreateNew(); - } + CreateGameInfoStatusBar(shouldWarn); } } if (StatusBar == nullptr && SBarInfoScript[SCRIPT_CUSTOM] != nullptr) @@ -291,11 +314,7 @@ void ST_CreateStatusBar(bool bTitleLevel) // SBARINFO failed so try the current statusbarclass again. if (StatusBar == nullptr) { - auto cls = PClass::FindClass(gameinfo.statusbarclass); - if (cls != nullptr) - { - StatusBar = (DBaseStatusBar *)cls->CreateNew(); - } + CreateGameInfoStatusBar(shouldWarn); } } if (StatusBar == nullptr) @@ -311,6 +330,7 @@ void ST_CreateStatusBar(bool bTitleLevel) auto cls = PClass::FindClass(defname); if (cls != nullptr) { + assert(cls->IsDescendantOf(RUNTIME_CLASS(DBaseStatusBar))); StatusBar = (DBaseStatusBar *)cls->CreateNew(); } } From 1ebc169d5672a9a06498435fb4fc1a7db1649afb Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 17:14:58 +0300 Subject: [PATCH 16/17] - fixed potential crash on fatal error in Cocoa backend Early fatal error can be triggered when native OpenGL frame buffer is not created yet and DDummyFrameBuffer is still used --- src/posix/cocoa/i_video.mm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 9305e708f..f50f1a4af 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -319,6 +319,9 @@ NSOpenGLPixelFormat* CreatePixelFormat(const NSOpenGLPixelFormatAttribute profil // --------------------------------------------------------------------------- +static SystemGLFrameBuffer* frameBuffer; + + SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen) : DFrameBuffer(vid_defwidth, vid_defheight) , m_window(CreateWindow(STYLE_MASK_WINDOWED)) @@ -383,6 +386,8 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen) } } + frameBuffer = this; + FConsoleWindow::GetInstance().Show(false); } @@ -532,24 +537,19 @@ void SystemGLFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI) } -static SystemGLFrameBuffer* GetSystemFrameBuffer() -{ - return static_cast(screen); -} - void SystemGLFrameBuffer::UseHiDPI(const bool hiDPI) { - if (auto fb = GetSystemFrameBuffer()) + if (frameBuffer != nullptr) { - fb->SetMode(fb->m_fullscreen, hiDPI); + frameBuffer->SetMode(frameBuffer->m_fullscreen, hiDPI); } } void SystemGLFrameBuffer::SetCursor(NSCursor* cursor) { - if (auto fb = GetSystemFrameBuffer()) + if (frameBuffer != nullptr) { - NSWindow* const window = fb->m_window; + NSWindow* const window = frameBuffer->m_window; CocoaView* const view = [window contentView]; [view setCursor:cursor]; @@ -559,15 +559,15 @@ void SystemGLFrameBuffer::SetCursor(NSCursor* cursor) void SystemGLFrameBuffer::SetWindowVisible(bool visible) { - if (auto fb = GetSystemFrameBuffer()) + if (frameBuffer != nullptr) { if (visible) { - [fb->m_window orderFront:nil]; + [frameBuffer->m_window orderFront:nil]; } else { - [fb->m_window orderOut:nil]; + [frameBuffer->m_window orderOut:nil]; } I_SetNativeMouse(!visible); @@ -576,11 +576,11 @@ void SystemGLFrameBuffer::SetWindowVisible(bool visible) void SystemGLFrameBuffer::SetWindowTitle(const char* title) { - if (auto fb = GetSystemFrameBuffer()) + if (frameBuffer != nullptr) { NSString* const nsTitle = nullptr == title ? nil : [NSString stringWithCString:title encoding:NSISOLatin1StringEncoding]; - [fb->m_window setTitle:nsTitle]; + [frameBuffer->m_window setTitle:nsTitle]; } } From ecb5bfec135160c9d0ea44eb0fdea0c6b6773553 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Jun 2018 17:13:38 +0300 Subject: [PATCH 17/17] - removed obsolete code from POSIX backends --- src/posix/cocoa/gl_sysfb.h | 2 -- src/posix/cocoa/i_video.mm | 4 ---- src/posix/sdl/gl_sysfb.h | 1 - src/posix/sdl/sdlglvideo.cpp | 6 ------ 4 files changed, 13 deletions(-) diff --git a/src/posix/cocoa/gl_sysfb.h b/src/posix/cocoa/gl_sysfb.h index 39c8f8ab4..fc957a641 100644 --- a/src/posix/cocoa/gl_sysfb.h +++ b/src/posix/cocoa/gl_sysfb.h @@ -83,8 +83,6 @@ protected: void SetFullscreenMode(); void SetWindowedMode(); - void InitializeState(); - void SwapBuffers(); void SetGammaTable(uint16_t* table); diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index f50f1a4af..f4f03f2df 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -422,10 +422,6 @@ void SystemGLFrameBuffer::SetVSync(bool vsync) } -void SystemGLFrameBuffer::InitializeState() -{ -} - void SystemGLFrameBuffer::SwapBuffers() { [[NSOpenGLContext currentContext] flushBuffer]; diff --git a/src/posix/sdl/gl_sysfb.h b/src/posix/sdl/gl_sysfb.h index 16f2171ce..6972dd449 100644 --- a/src/posix/sdl/gl_sysfb.h +++ b/src/posix/sdl/gl_sysfb.h @@ -32,7 +32,6 @@ public: protected: void SetGammaTable(uint16_t *tbl); void ResetGammaTable(); - void InitializeState(); SystemGLFrameBuffer () {} uint8_t GammaTable[3][256]; diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 42c7a7c20..34200520a 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -273,12 +273,6 @@ SystemGLFrameBuffer::~SystemGLFrameBuffer () } - - -void SystemGLFrameBuffer::InitializeState() -{ -} - void SystemGLFrameBuffer::SetGammaTable(uint16_t *tbl) { if (m_supportsGamma)