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) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index a3d0858ee..e4138afd8 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -983,6 +983,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. diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 014f8be06..de083d7b0 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) diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index ac369a135..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 @@ -697,6 +701,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; 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;