mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- some more portal preparation .
This commit is contained in:
parent
d5a1004c41
commit
c338b9cde3
7 changed files with 66 additions and 0 deletions
|
@ -104,6 +104,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
|
|||
sec->floorplane.d = sec->floorplane.PointToDist (spot, newheight);
|
||||
fixed_t newtheight = sec->floorplane.Zat0();
|
||||
sec->ChangePlaneTexZ(sector_t::floor, newtheight - oldtheight);
|
||||
sec->CheckPortalPlane(sector_t::floor);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
|
|
|
@ -2582,6 +2582,11 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
|
|||
abs(corpsehit->Y() - viletry.y) > maxdist)
|
||||
continue; // not actually touching
|
||||
// Let's check if there are floors in between the archvile and its target
|
||||
|
||||
// if in a different section of the map, only consider possible if a line of sight exists.
|
||||
if (corpsehit->Sector->PortalGroup != self->Sector->PortalGroup && !P_CheckSight(self, corpsehit))
|
||||
continue;
|
||||
|
||||
sector_t *vilesec = self->Sector;
|
||||
sector_t *corpsec = corpsehit->Sector;
|
||||
// We only need to test if at least one of the sectors has a 3D floor.
|
||||
|
|
|
@ -5532,6 +5532,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
|
|||
}
|
||||
}
|
||||
} while (n);
|
||||
sec->CheckPortalPlane(!floorOrCeil);
|
||||
}
|
||||
}
|
||||
P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists
|
||||
|
@ -5595,6 +5596,8 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool
|
|||
}
|
||||
} while (n); // repeat from scratch until all things left are marked valid
|
||||
|
||||
sector->CheckPortalPlane(floorOrCeil); // check for portal obstructions after everything is done.
|
||||
|
||||
if (!cpos.nofit && !isreset /* && sector->MoreFlags & (SECF_UNDERWATERMASK)*/)
|
||||
{
|
||||
// If this is a control sector for a deep water transfer, all actors in affected
|
||||
|
|
|
@ -871,6 +871,19 @@ int sector_t::GetTerrain(int pos) const
|
|||
return terrainnum[pos] >= 0 ? terrainnum[pos] : TerrainTypes[GetTexture(pos)];
|
||||
}
|
||||
|
||||
void sector_t::CheckPortalPlane(int plane)
|
||||
{
|
||||
ASkyViewpoint *portal = SkyBoxes[plane];
|
||||
if (!portal || portal->special1 != SKYBOX_LINKEDPORTAL) return;
|
||||
|
||||
fixed_t planeh = planes[plane].TexZ;
|
||||
int obstructed = PLANEF_OBSTRUCTED * (plane == sector_t::floor ?
|
||||
planeh > portal->threshold : planeh < portal->threshold);
|
||||
planes[plane].Flags = (planes[plane].Flags & ~PLANEF_OBSTRUCTED) | obstructed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FArchive &operator<< (FArchive &arc, secspecial_t &p)
|
||||
{
|
||||
if (SaveVersion < 4529)
|
||||
|
|
24
src/portal.h
24
src/portal.h
|
@ -8,6 +8,30 @@
|
|||
#include "p_local.h"
|
||||
#include "m_bbox.h"
|
||||
|
||||
struct FDisplacement
|
||||
{
|
||||
fixed_t x, y;
|
||||
bool isSet;
|
||||
BYTE indirect; // just for illustration.
|
||||
};
|
||||
|
||||
struct FDisplacementTable
|
||||
{
|
||||
TArray<FDisplacement> data;
|
||||
int size;
|
||||
|
||||
void Create(int numgroups)
|
||||
{
|
||||
data.Resize(numgroups*numgroups);
|
||||
memset(&data[0], 0, numgroups*numgroups*sizeof(data[0]));
|
||||
size = numgroups;
|
||||
}
|
||||
|
||||
FDisplacement &operator()(int x, int y)
|
||||
{
|
||||
return data[x + size*y];
|
||||
}
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -469,6 +469,7 @@ void DSectorPlaneInterpolation::Restore()
|
|||
sector->SetPlaneTexZ(sector_t::ceiling, baktexz);
|
||||
}
|
||||
P_RecalculateAttached3DFloors(sector);
|
||||
sector->CheckPortalPlane(ceiling? sector_t::ceiling : sector_t::floor);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -505,6 +506,7 @@ void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
|
|||
*pheight = oldheight + FixedMul(bakheight - oldheight, smoothratio);
|
||||
sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio));
|
||||
P_RecalculateAttached3DFloors(sector);
|
||||
sector->CheckPortalPlane(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
18
src/r_defs.h
18
src/r_defs.h
|
@ -518,6 +518,7 @@ struct sector_t
|
|||
DInterpolation *SetInterpolation(int position, bool attach);
|
||||
|
||||
ASkyViewpoint *GetSkyBox(int which);
|
||||
void CheckPortalPlane(int plane);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -738,6 +739,22 @@ struct sector_t
|
|||
Flags &= ~SECF_SPECIALFLAGS;
|
||||
}
|
||||
|
||||
inline bool PortalBlocksView(int plane)
|
||||
{
|
||||
return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
}
|
||||
|
||||
inline bool PortalBlocksMovement(int plane)
|
||||
{
|
||||
return !!(planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
}
|
||||
|
||||
inline bool PortalBlocksSound(int plane)
|
||||
{
|
||||
return !!(planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
}
|
||||
|
||||
|
||||
int GetTerrain(int pos) const;
|
||||
|
||||
void TransferSpecial(sector_t *model);
|
||||
|
@ -830,6 +847,7 @@ struct sector_t
|
|||
// [RH] The sky box to render for this sector. NULL means use a
|
||||
// regular sky.
|
||||
TObjPtr<ASkyViewpoint> SkyBoxes[2];
|
||||
int PortalGroup;
|
||||
|
||||
int sectornum; // for comparing sector copies
|
||||
|
||||
|
|
Loading…
Reference in a new issue