From 273758344f767ff166b9dc13277c4a6a2f796c6f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 23 May 2009 10:21:33 +0000 Subject: [PATCH] - Fixed: When setting up a deep water sector with Transfer_Heights the floorclip information of all actors in the sector needs to be updated. SVN r1600 (trunk) --- docs/rh-log.txt | 6 +++++- src/p_map.cpp | 4 ++-- src/p_mobj.cpp | 34 +++++++++++++--------------------- src/p_sight.cpp | 4 ++-- src/p_spec.cpp | 21 +++++++++++---------- src/p_trace.cpp | 6 +++--- src/r_bsp.cpp | 4 ++-- src/r_defs.h | 5 +++++ src/r_main.cpp | 5 ++--- src/r_segs.cpp | 3 +-- src/r_things.cpp | 16 +++------------- 11 files changed, 49 insertions(+), 59 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4f7b79a72..e9953b1dc 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ -May 22, 2009 (Changes by Graf Zahl) +May 23, 2009 (Changes by Graf Zahl) +- Fixed: When setting up a deep water sector with Transfer_Heights the floorclip + information of all actors in the sector needs to be updated. + +May 22, 2009 (Changes by Graf Zahl) - Fixed: A_CountdownArg and A_Die must ensure a certain kill. May 22, 2009 diff --git a/src/p_map.cpp b/src/p_map.cpp index 422b9230b..2746fb982 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -490,8 +490,8 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) } if ((secfriction(sec) < friction || friction == ORIG_FRICTION) && (mo->z <= sec->floorplane.ZatPoint (mo->x, mo->y) || - (sec->heightsec && !(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && - mo->z <= sec->heightsec->floorplane.ZatPoint (mo->x, mo->y)))) + (sec->GetHeightSec() != NULL && + mo->z <= sec->heightsec->floorplane.ZatPoint (mo->x, mo->y)))) { friction = secfriction (sec); movefactor = secmovefac (sec); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index de57026b1..bc7f90ed1 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2971,20 +2971,20 @@ void AActor::Tick () { continue; } - if (flags & MF_NOGRAVITY && - (sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))) + sector_t *heightsec = sec->GetHeightSec(); + if (flags & MF_NOGRAVITY && heightsec == NULL) { continue; } height = sec->floorplane.ZatPoint (x, y); if (z > height) { - if (sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + if (heightsec == NULL) { continue; } - waterheight = sec->heightsec->floorplane.ZatPoint (x, y); + waterheight = heightsec->floorplane.ZatPoint (x, y); if (waterheight > height && z >= waterheight) { continue; @@ -3232,8 +3232,8 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) } else { - const sector_t *hsec = Sector->heightsec; - if (hsec != NULL && !(hsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + const sector_t *hsec = Sector->GetHeightSec(); + if (hsec != NULL) { fh = hsec->floorplane.ZatPoint (x, y); //if (hsec->MoreFlags & SECF_UNDERWATERMASK) // also check Boom-style non-swimmable sectors @@ -3648,9 +3648,8 @@ void AActor::AdjustFloorClip () // do the floorclipping instead of the terrain type. for (m = touching_sectorlist; m; m = m->m_tnext) { - if ((m->m_sector->heightsec == NULL || - m->m_sector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && - m->m_sector->floorplane.ZatPoint (x, y) == z) + sector_t *hsec = m->m_sector->GetHeightSec(); + if (hsec == NULL && m->m_sector->floorplane.ZatPoint (x, y) == z) { fixed_t clip = Terrains[TerrainTypes[m->m_sector->GetTexture(sector_t::floor)]].FootClip; if (clip < shallowestclip) @@ -4517,16 +4516,14 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z if (planez < z) return false; } #endif - if (sec->heightsec == NULL || - //!sec->heightsec->waterzone || - (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) || - !(sec->heightsec->MoreFlags & SECF_CLIPFAKEPLANES)) + sector_t *hsec = sec->GetHeightSec(); + if (hsec == NULL || !(hsec->MoreFlags & SECF_CLIPFAKEPLANES)) { terrainnum = TerrainTypes[sec->GetTexture(sector_t::floor)]; } else { - terrainnum = TerrainTypes[sec->heightsec->GetTexture(sector_t::floor)]; + terrainnum = TerrainTypes[hsec->GetTexture(sector_t::floor)]; } #ifdef _3DFLOORS foundone: @@ -4542,10 +4539,7 @@ foundone: // don't splash when touching an underwater floor if (thing->waterlevel>=1 && z<=thing->floorz) return Terrains[terrainnum].IsLiquid; - plane = (sec->heightsec != NULL && - //sec->heightsec->waterzone && - !(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) - ? &sec->heightsec->floorplane : &sec->floorplane; + plane = hsec != NULL? &sec->heightsec->floorplane : &sec->floorplane; // Don't splash for living things with small vertical velocities. // There are levels where the constant splashing from the monsters gets extremely annoying @@ -4642,9 +4636,7 @@ bool P_HitFloor (AActor *thing) } #endif } - if (m == NULL || - (m->m_sector->heightsec != NULL && - !(m->m_sector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))) + if (m == NULL || m->m_sector->GetHeightSec() != NULL) { return false; } diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 345e35b2f..3b59eb9e5 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -681,13 +681,13 @@ sightcounts[0]++; // killough 4/19/98: make fake floors and ceilings block monster view - if ((s1->heightsec && !(s1->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && + if ((s1->GetHeightSec() && ((t1->z + t1->height <= s1->heightsec->floorplane.ZatPoint (t1->x, t1->y) && t2->z >= s1->heightsec->floorplane.ZatPoint (t2->x, t2->y)) || (t1->z >= s1->heightsec->ceilingplane.ZatPoint (t1->x, t1->y) && t2->z + t1->height <= s1->heightsec->ceilingplane.ZatPoint (t2->x, t2->y)))) || - (s2->heightsec && !(s2->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && + (s2->GetHeightSec() && ((t2->z + t2->height <= s2->heightsec->floorplane.ZatPoint (t2->x, t2->y) && t1->z >= s2->heightsec->floorplane.ZatPoint (t1->x, t1->y)) || (t2->z >= s2->heightsec->ceilingplane.ZatPoint (t2->x, t2->y) && diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 185719b28..5756c95ac 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -636,17 +636,17 @@ CUSTOM_CVAR (Bool, forcewater, false, CVAR_ARCHIVE|CVAR_SERVERINFO) for (i = 0; i < numsectors; i++) { - if (sectors[i].heightsec && - !(sectors[i].heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && + sector_t *hsec = sectors[i].GetHeightSec(); + if (hsec && !(sectors[i].heightsec->MoreFlags & SECF_UNDERWATER)) { if (self) { - sectors[i].heightsec->MoreFlags |= SECF_FORCEDUNDERWATER; + hsec->MoreFlags |= SECF_FORCEDUNDERWATER; } else { - sectors[i].heightsec->MoreFlags &= ~SECF_FORCEDUNDERWATER; + hsec->MoreFlags &= ~SECF_FORCEDUNDERWATER; } } } @@ -1010,6 +1010,7 @@ void P_SpawnSpecials (void) { sectors[s].heightsec = sec; sec->e->FakeFloor.Sectors.Push(§ors[s]); + sectors[s].AdjustFloorClip(); } break; @@ -1747,10 +1748,11 @@ void DPusher::Tick () thing = node->m_thing; if (!(thing->flags2 & MF2_WINDTHRUST) || (thing->flags & MF_NOCLIP)) continue; + + sector_t *hsec = sec->GetHeightSec(); if (m_Type == p_wind) { - if (sec->heightsec == NULL || - sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) + if (hsec == NULL) { // NOT special water sector if (thing->z > thing->floorz) // above ground { @@ -1765,7 +1767,7 @@ void DPusher::Tick () } else // special water sector { - ht = sec->heightsec->floorplane.ZatPoint (thing->x, thing->y); + ht = hsec->floorplane.ZatPoint (thing->x, thing->y); if (thing->z > ht) // above ground { xspeed = m_Xmag; // full force @@ -1786,14 +1788,13 @@ void DPusher::Tick () { const secplane_t *floor; - if (sec->heightsec == NULL || - (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + if (hsec == NULL) { // NOT special water sector floor = &sec->floorplane; } else { // special water sector - floor = &sec->heightsec->floorplane; + floor = &hsec->floorplane; } if (thing->z > floor->ZatPoint (thing->x, thing->y)) { // above ground diff --git a/src/p_trace.cpp b/src/p_trace.cpp index c2f94d8c3..1f38cc694 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -312,11 +312,11 @@ bool FTraceInfo::TraceTraverse (int ptflags) bc = entersector->ceilingplane.ZatPoint (hitx, hity); } + sector_t *hsec = CurSector->GetHeightSec(); if (Results->CrossedWater == NULL && - CurSector->heightsec && - !(CurSector->MoreFlags & SECF_IGNOREHEIGHTSEC) && + hsec != NULL && //CurSector->heightsec->waterzone && - hitz <= CurSector->heightsec->floorplane.ZatPoint (hitx, hity)) + hitz <= hsec->floorplane.ZatPoint (hitx, hity)) { // hit crossed a water plane Results->CrossedWater = §ors[CurSector->sectornum]; diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index d45d7f6a6..ffb8a1f4f 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -352,9 +352,9 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, FakeSide = FAKED_Center; - if (sec->heightsec && !(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + const sector_t *s = sec->GetHeightSec(); + if (s != NULL) { - const sector_t *s = sec->heightsec; sector_t *heightsec = viewsector->heightsec; bool underwater = r_fakingunderwater || (heightsec && viewz <= heightsec->floorplane.ZatPoint (viewx, viewy)); diff --git a/src/r_defs.h b/src/r_defs.h index f28d22ad6..d81335ebc 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -585,6 +585,11 @@ struct sector_t planes[pos].TexZ += val; } + sector_t *GetHeightSec() const + { + return (MoreFlags & SECF_IGNOREHEIGHTSEC)? NULL : heightsec; + } + // Member variables fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); } diff --git a/src/r_main.cpp b/src/r_main.cpp index 3f8394423..0a3b57e99 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1108,10 +1108,9 @@ void R_SetupFrame (AActor *actor) // killough 3/20/98, 4/4/98: select colormap based on player status // [RH] Can also select a blend - if (viewsector->heightsec && - !(viewsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + const sector_t *s = viewsector->GetHeightSec(); + if (s != NULL) { - const sector_t *s = viewsector->heightsec; newblend = viewz < s->floorplane.ZatPoint (viewx, viewy) ? s->bottommap : viewz > s->ceilingplane.ZatPoint (viewx, viewy) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 4896288c2..bc04fc37e 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1391,8 +1391,7 @@ void R_NewWall (bool needlights) // it is definitely invisible and doesn't need to be marked. // killough 3/7/98: add deep water check - if (frontsector->heightsec == NULL || - (frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) + if (frontsector->GetHeightSec() == NULL) { if (frontsector->floorplane.ZatPoint (viewx, viewy) >= viewz) // above view plane markfloor = false; diff --git a/src/r_things.cpp b/src/r_things.cpp index 765e7a20e..576321128 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1347,14 +1347,9 @@ void R_ProjectSprite (AActor *thing, int fakeside) // from the viewer, by either water or fake ceilings // killough 4/11/98: improve sprite clipping for underwater/fake ceilings - heightsec = thing->Sector->heightsec; + heightsec = thing->Sector->GetHeightSec(); - if (heightsec != NULL && heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) - { - heightsec = NULL; - } - - if (heightsec) // only clip things which are in special sectors + if (heightsec != NULL) // only clip things which are in special sectors { if (fakeside == FAKED_AboveCeiling) { @@ -2356,12 +2351,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, return; // Clip particles above the ceiling or below the floor. - heightsec = sector->heightsec; - - if (heightsec != NULL && heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) - { - heightsec = NULL; - } + heightsec = sector->GetHeightSec(); const secplane_t *topplane; const secplane_t *botplane;