mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
# Conflicts: # src/r_defs.h
This commit is contained in:
commit
467f833773
5 changed files with 26 additions and 28 deletions
|
@ -1344,9 +1344,11 @@ subsector_t *P_PointInSubsector (double x, double y)
|
||||||
|
|
||||||
node = gamenodes + numgamenodes - 1;
|
node = gamenodes + numgamenodes - 1;
|
||||||
|
|
||||||
|
fixed_t xx = FLOAT2FIXED(x);
|
||||||
|
fixed_t yy = FLOAT2FIXED(y);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
side = R_PointOnSide (x, y, node);
|
side = R_PointOnSide (xx, yy, node);
|
||||||
node = (node_t *)node->children[side];
|
node = (node_t *)node->children[side];
|
||||||
}
|
}
|
||||||
while (!((size_t)node & 1));
|
while (!((size_t)node & 1));
|
||||||
|
|
|
@ -396,14 +396,19 @@ bool AActor::FixMapthingPos()
|
||||||
|
|
||||||
void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
||||||
{
|
{
|
||||||
if (spawningmapthing && (flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL)
|
bool spawning = spawningmapthing;
|
||||||
|
|
||||||
|
if (spawning)
|
||||||
{
|
{
|
||||||
if (FixMapthingPos()) spawningmapthing = false;
|
if ((flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL)
|
||||||
|
{
|
||||||
|
if (FixMapthingPos()) spawning = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sector == NULL)
|
if (sector == NULL)
|
||||||
{
|
{
|
||||||
if (!spawningmapthing || numgamenodes == 0)
|
if (!spawning || numgamenodes == 0)
|
||||||
{
|
{
|
||||||
sector = P_PointInSector(Pos());
|
sector = P_PointInSector(Pos());
|
||||||
}
|
}
|
||||||
|
@ -499,7 +504,8 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateRenderSectorList();
|
// Portal links cannot be done unless the level is fully initialized.
|
||||||
|
if (!spawningmapthing) UpdateRenderSectorList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AActor::SetOrigin(double x, double y, double z, bool moving)
|
void AActor::SetOrigin(double x, double y, double z, bool moving)
|
||||||
|
|
|
@ -897,7 +897,7 @@ double sector_t::HighestCeilingAt(const DVector2 &p, sector_t **resultsec)
|
||||||
// Continue until we find a blocking portal or a portal below where we actually are.
|
// Continue until we find a blocking portal or a portal below where we actually are.
|
||||||
while (!check->PortalBlocksMovement(ceiling) && planeheight < check->SkyBoxes[ceiling]->specialf1)
|
while (!check->PortalBlocksMovement(ceiling) && planeheight < check->SkyBoxes[ceiling]->specialf1)
|
||||||
{
|
{
|
||||||
pos += check->CeilingDisplacement();
|
pos += check->SkyBoxes[ceiling]->Scale;
|
||||||
planeheight = check->SkyBoxes[ceiling]->specialf1;
|
planeheight = check->SkyBoxes[ceiling]->specialf1;
|
||||||
check = P_PointInSector(pos);
|
check = P_PointInSector(pos);
|
||||||
}
|
}
|
||||||
|
@ -920,7 +920,7 @@ double sector_t::LowestFloorAt(const DVector2 &p, sector_t **resultsec)
|
||||||
// Continue until we find a blocking portal or a portal above where we actually are.
|
// Continue until we find a blocking portal or a portal above where we actually are.
|
||||||
while (!check->PortalBlocksMovement(floor) && planeheight > check->SkyBoxes[floor]->specialf1)
|
while (!check->PortalBlocksMovement(floor) && planeheight > check->SkyBoxes[floor]->specialf1)
|
||||||
{
|
{
|
||||||
pos += check->FloorDisplacement();
|
pos += check->SkyBoxes[floor]->Scale;
|
||||||
planeheight = check->SkyBoxes[floor]->specialf1;
|
planeheight = check->SkyBoxes[floor]->specialf1;
|
||||||
check = P_PointInSector(pos);
|
check = P_PointInSector(pos);
|
||||||
}
|
}
|
||||||
|
@ -964,7 +964,7 @@ double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DVector2 pos = sec->CeilingDisplacement();
|
DVector2 pos = sec->SkyBoxes[ceiling]->Scale;
|
||||||
x += pos.X;
|
x += pos.X;
|
||||||
y += pos.Y;
|
y += pos.Y;
|
||||||
planeheight = sec->SkyBoxes[ceiling]->specialf1;
|
planeheight = sec->SkyBoxes[ceiling]->specialf1;
|
||||||
|
@ -1009,7 +1009,7 @@ double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, doub
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DVector2 pos = sec->FloorDisplacement();
|
DVector2 pos = sec->SkyBoxes[floor]->Scale;
|
||||||
x += pos.X;
|
x += pos.X;
|
||||||
y += pos.Y;
|
y += pos.Y;
|
||||||
planeheight = sec->SkyBoxes[floor]->specialf1;
|
planeheight = sec->SkyBoxes[floor]->specialf1;
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ void P_CreateLinkedPortals()
|
||||||
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
|
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
|
||||||
Printf("Error in sector %d: Ceiling portal at z=%f is below floor portal at z=%f\n", i, cz, fz);
|
Printf("Error in sector %d: Ceiling portal at z=%f is below floor portal at z=%f\n", i, cz, fz);
|
||||||
double cp = -sectors[i].ceilingplane.fD();
|
double cp = -sectors[i].ceilingplane.fD();
|
||||||
double fp = -sectors[i].ceilingplane.fD();
|
double fp = sectors[i].floorplane.fD();
|
||||||
if (cp < fp || fz == fp)
|
if (cp < fp || fz == fp)
|
||||||
{
|
{
|
||||||
sectors[i].SkyBoxes[sector_t::ceiling] = NULL;
|
sectors[i].SkyBoxes[sector_t::ceiling] = NULL;
|
||||||
|
@ -1068,6 +1068,9 @@ void P_CreateLinkedPortals()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// mark all sector planes that check out ok for everything.
|
||||||
|
if (sectors[i].PortalIsLinked(sector_t::floor)) sectors[i].planes[sector_t::floor].Flags |= PLANEF_LINKED;
|
||||||
|
if (sectors[i].PortalIsLinked(sector_t::ceiling)) sectors[i].planes[sector_t::ceiling].Flags |= PLANEF_LINKED;
|
||||||
}
|
}
|
||||||
if (linkedPortals.Size() > 0)
|
if (linkedPortals.Size() > 0)
|
||||||
{
|
{
|
||||||
|
|
21
src/r_defs.h
21
src/r_defs.h
|
@ -514,6 +514,7 @@ enum
|
||||||
PLANEF_BLOCKSOUND = 32,
|
PLANEF_BLOCKSOUND = 32,
|
||||||
PLANEF_DISABLED = 64,
|
PLANEF_DISABLED = 64,
|
||||||
PLANEF_OBSTRUCTED = 128, // if the portal plane is beyond the sector's floor or ceiling.
|
PLANEF_OBSTRUCTED = 128, // if the portal plane is beyond the sector's floor or ceiling.
|
||||||
|
PLANEF_LINKED = 256 // plane is flagged as a linked portal
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal sector flags
|
// Internal sector flags
|
||||||
|
@ -969,20 +970,17 @@ public:
|
||||||
|
|
||||||
bool PortalBlocksSight(int plane)
|
bool PortalBlocksSight(int plane)
|
||||||
{
|
{
|
||||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||||
return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PortalBlocksMovement(int plane)
|
bool PortalBlocksMovement(int plane)
|
||||||
{
|
{
|
||||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||||
return !!(planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PortalBlocksSound(int plane)
|
bool PortalBlocksSound(int plane)
|
||||||
{
|
{
|
||||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||||
return !!(planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PortalIsLinked(int plane)
|
bool PortalIsLinked(int plane)
|
||||||
|
@ -990,17 +988,6 @@ public:
|
||||||
return (SkyBoxes[plane] != NULL && SkyBoxes[plane]->special1 == SKYBOX_LINKEDPORTAL);
|
return (SkyBoxes[plane] != NULL && SkyBoxes[plane]->special1 == SKYBOX_LINKEDPORTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These may only be called if the portal has been validated
|
|
||||||
DVector2 FloorDisplacement()
|
|
||||||
{
|
|
||||||
return Displacements.getOffset(PortalGroup, SkyBoxes[sector_t::floor]->Sector->PortalGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
DVector2 CeilingDisplacement()
|
|
||||||
{
|
|
||||||
return Displacements.getOffset(PortalGroup, SkyBoxes[sector_t::ceiling]->Sector->PortalGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetVerticesDirty()
|
void SetVerticesDirty()
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < e->vertices.Size(); i++) e->vertices[i]->dirty = true;
|
for (unsigned i = 0; i < e->vertices.Size(); i++) e->vertices[i]->dirty = true;
|
||||||
|
|
Loading…
Reference in a new issue