mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 21:10:50 +00:00
- fixed floorclipping checks for 3D floors.
Neither the setup nor the in-game checks were correct, because this code comes from a time where ceilings could not have a terrain, meaning that 3D floors couldn't have one.
This commit is contained in:
parent
b43d87c4cd
commit
55390b2403
1 changed files with 28 additions and 8 deletions
|
@ -4892,22 +4892,37 @@ void AActor::AdjustFloorClip ()
|
||||||
double shallowestclip = INT_MAX;
|
double shallowestclip = INT_MAX;
|
||||||
const msecnode_t *m;
|
const msecnode_t *m;
|
||||||
|
|
||||||
// possibly standing on a 3D-floor
|
|
||||||
if (Sector->e->XFloor.ffloors.Size() && Z() > Sector->floorplane.ZatPoint(this)) Floorclip = 0;
|
|
||||||
|
|
||||||
// [RH] clip based on shallowest floor player is standing on
|
// [RH] clip based on shallowest floor player is standing on
|
||||||
// If the sector has a deep water effect, then let that effect
|
// If the sector has a deep water effect, then let that effect
|
||||||
// do the floorclipping instead of the terrain type.
|
// do the floorclipping instead of the terrain type.
|
||||||
for (m = touching_sectorlist; m; m = m->m_tnext)
|
for (m = touching_sectorlist; m; m = m->m_tnext)
|
||||||
{
|
{
|
||||||
DVector3 pos = PosRelative(m->m_sector);
|
DVector3 pos = PosRelative(m->m_sector);
|
||||||
sector_t *hsec = m->m_sector->GetHeightSec();
|
sector_t* hsec = m->m_sector->GetHeightSec();
|
||||||
if (hsec == NULL && m->m_sector->floorplane.ZatPoint (pos) == Z())
|
if (hsec == NULL)
|
||||||
{
|
{
|
||||||
double clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip;
|
if (m->m_sector->floorplane.ZatPoint(pos) == Z())
|
||||||
if (clip < shallowestclip)
|
|
||||||
{
|
{
|
||||||
shallowestclip = clip;
|
double clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip;
|
||||||
|
if (clip < shallowestclip)
|
||||||
|
{
|
||||||
|
shallowestclip = clip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (auto& ff : m->m_sector->e->XFloor.ffloors)
|
||||||
|
{
|
||||||
|
if ((ff->flags & FF_SOLID) && (ff->flags & FF_EXISTS) && ff->top.plane->ZatPoint(pos) == Z())
|
||||||
|
{
|
||||||
|
double clip = Terrains[ff->top.model->GetTerrain(ff->top.isceiling)].FootClip;
|
||||||
|
if (clip < shallowestclip)
|
||||||
|
{
|
||||||
|
shallowestclip = clip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5503,6 +5518,11 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
else if (sz == ONCEILINGZ)
|
else if (sz == ONCEILINGZ)
|
||||||
mobj->AddZ(-mthing->pos.Z);
|
mobj->AddZ(-mthing->pos.Z);
|
||||||
|
|
||||||
|
if (mobj->flags2 & MF2_FLOORCLIP)
|
||||||
|
{
|
||||||
|
mobj->AdjustFloorClip();
|
||||||
|
}
|
||||||
|
|
||||||
mobj->SpawnPoint = mthing->pos;
|
mobj->SpawnPoint = mthing->pos;
|
||||||
mobj->SpawnAngle = mthing->angle;
|
mobj->SpawnAngle = mthing->angle;
|
||||||
mobj->SpawnFlags = mthing->flags;
|
mobj->SpawnFlags = mthing->flags;
|
||||||
|
|
Loading…
Reference in a new issue