From 77f05a00101cc3a1c2b31b5f79087f4ce0a83515 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 14 Apr 2016 00:21:38 +0200 Subject: [PATCH 1/6] - fixed spawn positions for Korax's missiles. --- src/g_hexen/a_korax.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index 2597fe8cd..7f0d3a43c 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -484,7 +484,7 @@ AActor *P_SpawnKoraxMissile (const DVector3 &pos, AActor *source, AActor *dest, DAngle an; double dist; - th = Spawn (type, source->PosPlusZ(-source->Floorclip), ALLOW_REPLACE); + th = Spawn (type, pos, ALLOW_REPLACE); th->target = source; // Originator an = th->AngleTo(dest); if (dest->flags & MF_SHADOW) From f0c2cd2d50d9a0d08c6ae28cd4577d98ff966d8f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 10:45:31 +0200 Subject: [PATCH 2/6] - fixed: 24 bit PNGs with transparent color need to set transpal to true in FPNGTexture::CopyTrueColorPixels. --- src/textures/pngtexture.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index ac369a135..4e664aef3 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -697,6 +697,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo { bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 3, pixwidth, rotate, CF_RGBT, inf, NonPaletteTrans[0], NonPaletteTrans[1], NonPaletteTrans[2]); + transpal = true; } break; From ed211ecbabab1d8451aa8b2f40610c0abe430087 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 15:02:28 +0200 Subject: [PATCH 3/6] - fixed positioning of portal things In some situations it can happen that the sector here is not the frontsector of the anchor linedef, because some colinear node line with opposite direction causes this to be positioned on the wrong side. The only remedy here is to explicitly set the correct sector after spawning these things. --- src/p_spec.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 994f7584d..33e09bf03 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -966,6 +966,13 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int bytealpha, int li AStackPoint *anchor = Spawn(pos1, NO_REPLACE); AStackPoint *reference = Spawn(pos2, NO_REPLACE); + + // In some situations it can happen that the sector here is not the frontsector of the anchor linedef, + // because some colinear node line with opposite direction causes this to be positioned on the wrong side. + // Fortunately these things will never move so it should be sufficient to set the intended sector directly. + anchor->Sector = line->frontsector; + reference->Sector = lines[i].frontsector; + reference->special1 = linked ? SKYBOX_LINKEDPORTAL : SKYBOX_PORTAL; anchor->special1 = SKYBOX_ANCHOR; // store the portal displacement in the unused scaleX/Y members of the portal reference actor. From 94cec02acc0057645dd203d3d7862c8be6ae861d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 15:15:34 +0200 Subject: [PATCH 4/6] - fixed: FPNGTexture must readjust the file pointer after deciding to skip the tRNS chunk. --- src/textures/pngtexture.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index 4e664aef3..e47fa62c0 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -659,6 +659,10 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo transpal = true; } } + else + { + lump->Seek(len, SEEK_CUR); + } break; } lump->Seek(4, SEEK_CUR); // Skip CRC From 24776edd133d0a489e16c0ec9941e4137cc06146 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 16:39:58 +0200 Subject: [PATCH 5/6] - fixed one of the most glaring omissions in the portal code: The wall clipper completely ignored portals when deciding how to treat a sector boundary, and ended up merging portal with non-portal planes. This check is only active for linedef based portals, due to the large amount of maps that did it wrong with thing based portals. Although it may well be that there are some maps that abuse this omission for linedef portals as well, these are better handled with a compatibility option if the need arises. The main reason this was added is to streamline and optimize the portal handling between renderers in ZDoom and GZDoom. For that both need to show the same general behavior and for linedef portals it is also important to handle the same as in Eternity. --- src/r_bsp.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 4f664d1bc..010f1e72e 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -513,6 +513,23 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, } +bool R_SkyboxCompare(sector_t *frontsector, sector_t *backsector) +{ + AActor *frontc = frontsector->SkyBoxes[sector_t::ceiling]; + AActor *frontf = frontsector->SkyBoxes[sector_t::floor]; + AActor *backc = backsector->SkyBoxes[sector_t::ceiling]; + AActor *backf = backsector->SkyBoxes[sector_t::floor]; + + // return true if any of the planes has a linedef-based portal (unless both sides have the same one. + // Ideally this should also check thing based portals but the omission of this check had been abused to hell and back for those. + // (Note: This may require a compatibility option if some maps ran into this for line based portals as well.) + if (frontc != NULL && (frontc->special1 == SKYBOX_PORTAL || frontc->special1 == SKYBOX_LINKEDPORTAL)) return (frontc != backc); + if (frontf != NULL && (frontf->special1 == SKYBOX_PORTAL || frontf->special1 == SKYBOX_LINKEDPORTAL)) return (frontf != backf); + if (backc != NULL && (backc->special1 == SKYBOX_PORTAL || backc->special1 == SKYBOX_LINKEDPORTAL)) return true; + if (backf != NULL && (backf->special1 == SKYBOX_PORTAL || backf->special1 == SKYBOX_LINKEDPORTAL)) return true; + return false; +} + // // R_AddLine // Clips the given segment @@ -655,6 +672,10 @@ void R_AddLine (seg_t *line) // Window. solid = false; } + else if (R_SkyboxCompare(frontsector, backsector)) + { + solid = false; + } else if (backsector->lightlevel != frontsector->lightlevel || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) From b73c6e847a4911fda99dd8be663e0f23f0270ec3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 18:46:31 +0200 Subject: [PATCH 6/6] - fixed: A_CheckRange calculated the square twice, resulting in a far too large value that got checked. --- src/thingdef/thingdef_codeptr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 53685c43b..03f011b41 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3120,7 +3120,7 @@ static bool DoCheckSightOrRange(AActor *self, AActor *camera, double range, bool dz = 0; } double distance = DVector3(pos, twodi? 0. : dz).LengthSquared(); - if (distance <= range*range) + if (distance <= range) { // Within range return true;