This commit is contained in:
Christoph Oelckers 2016-04-15 19:46:41 +02:00
commit dce9bf2760
5 changed files with 35 additions and 2 deletions

View file

@ -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)

View file

@ -983,6 +983,13 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int bytealpha, int li
AStackPoint *anchor = Spawn<AStackPoint>(pos1, NO_REPLACE);
AStackPoint *reference = Spawn<AStackPoint>(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.

View file

@ -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)

View file

@ -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;

View file

@ -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;