From bc5d0c882b9146e079b8dd32766c03320bf839c5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Aug 2008 20:19:35 +0000 Subject: [PATCH] - Put more floor/ceiling properties in sector_t into a substructure and added wrapper functions. SVN r1174 (trunk) --- docs/rh-log.txt | 2 ++ src/dsectoreffect.cpp | 20 ++++++------ src/g_shared/a_decals.cpp | 24 +++++++-------- src/g_shared/a_lightning.cpp | 2 +- src/p_3dmidtex.cpp | 4 +-- src/p_acs.cpp | 24 +++++---------- src/p_buildmap.cpp | 26 ++++++++-------- src/p_ceiling.cpp | 8 ++--- src/p_floor.cpp | 45 ++++++++++----------------- src/p_linkedsectors.cpp | 8 ++--- src/p_map.cpp | 18 +++++------ src/p_maputl.cpp | 6 ++-- src/p_mobj.cpp | 18 +++++------ src/p_plats.cpp | 2 +- src/p_saveg.cpp | 11 ++----- src/p_sectors.cpp | 4 +-- src/p_setup.cpp | 14 ++++----- src/p_slopes.cpp | 8 ++--- src/p_spec.cpp | 8 ++--- src/p_trace.cpp | 8 ++--- src/p_udmf.cpp | 26 ++++++++-------- src/p_writemap.cpp | 8 ++--- src/r_bsp.cpp | 60 ++++++++++++++++++------------------ src/r_data.cpp | 3 +- src/r_defs.h | 55 ++++++++++++++++++++++++++++++--- src/r_interpolate.cpp | 17 +++++----- src/r_polymost.cpp | 16 +++++----- src/r_segs.cpp | 56 ++++++++++++++++----------------- src/r_things.cpp | 16 +++++----- 29 files changed, 271 insertions(+), 246 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 24a4e25bd..01e9f7475 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ August 16, 2008 (Changes by Graf Zahl) +- Put more floor/ceiling properties in sector_t into a substructure and + added wrapper functions. - Fixed: A_Explode wants the distance parameter as an int, not a fixed_t. - some minor DECORATE fixes. diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 118aefb34..93c2a17b0 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -186,7 +186,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, } else { - m_Sector->floortexz += move; + m_Sector->ChangePlaneTexZ(sector_t::floor, move); m_Sector->AdjustFloorClip (); } return pastdest; @@ -207,7 +207,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, } else { - m_Sector->floortexz += m_Sector->floorplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::floor, m_Sector->floorplane.HeightDiff (lastpos)); m_Sector->AdjustFloorClip (); } } @@ -244,7 +244,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, } else { - m_Sector->floortexz += move; + m_Sector->ChangePlaneTexZ(sector_t::floor, move); m_Sector->AdjustFloorClip (); } return pastdest; @@ -261,7 +261,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, { if (crush >= 0 && !hexencrush) { - m_Sector->floortexz += m_Sector->floorplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::floor, m_Sector->floorplane.HeightDiff (lastpos)); m_Sector->AdjustFloorClip (); return crushed; } @@ -270,7 +270,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, MoveAttached(crush, -speed, 0, false); return crushed; } - m_Sector->floortexz += m_Sector->floorplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::floortexz, m_Sector->floorplane.HeightDiff (lastpos)); m_Sector->AdjustFloorClip (); } break; @@ -311,7 +311,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, } else { - m_Sector->ceilingtexz += move; + m_Sector->ChangePlaneTexZ(sector_t::ceiling, move); } return pastdest; } @@ -327,7 +327,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, { if (crush >= 0 && !hexencrush) { - m_Sector->ceilingtexz += m_Sector->ceilingplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos)); return crushed; } m_Sector->ceilingplane.d = lastpos; @@ -335,7 +335,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, MoveAttached(crush, speed, 1, false); return crushed; } - m_Sector->ceilingtexz += m_Sector->ceilingplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos)); } break; @@ -359,7 +359,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, } else { - m_Sector->ceilingtexz += move; + m_Sector->ChangePlaneTexZ(sector_t::ceiling, move); } return pastdest; } @@ -377,7 +377,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, MoveAttached(crush, -speed, 1, false); return crushed; } - m_Sector->ceilingtexz += m_Sector->ceilingplane.HeightDiff (lastpos); + m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos)); } break; } diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index f88e680b8..3e54f25d0 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -245,27 +245,27 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y) { RenderFlags |= RF_RELMID; if (line->flags & ML_DONTPEGBOTTOM) - Z -= front->floortexz; + Z -= front->GetPlaneTexZ(sector_t::floor); else - Z -= front->ceilingtexz; + Z -= front->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::mid); } else if (back->floorplane.ZatPoint (x, y) >= Z) { RenderFlags |= RF_RELLOWER|RF_CLIPLOWER; if (line->flags & ML_DONTPEGBOTTOM) - Z -= front->ceilingtexz; + Z -= front->GetPlaneTexZ(sector_t::ceiling); else - Z -= back->floortexz; + Z -= back->GetPlaneTexZ(sector_t::floor); tex = wall->GetTexture(side_t::bottom); } else { RenderFlags |= RF_RELUPPER|RF_CLIPUPPER; if (line->flags & ML_DONTPEGTOP) - Z -= front->ceilingtexz; + Z -= front->GetPlaneTexZ(sector_t::ceiling); else - Z -= back->ceilingtexz; + Z -= back->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::top); } @@ -301,29 +301,29 @@ fixed_t DBaseDecal::GetRealZ (const side_t *wall) const case RF_RELUPPER: if (curline->linedef->flags & ML_DONTPEGTOP) { - return Z + front->ceilingtexz; + return Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - return Z + back->ceilingtexz; + return Z + back->GetPlaneTexZ(sector_t::ceiling); } case RF_RELLOWER: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - return Z + front->ceilingtexz; + return Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - return Z + back->floortexz; + return Z + back->GetPlaneTexZ(sector_t::floor); } case RF_RELMID: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - return Z + front->floortexz; + return Z + front->GetPlaneTexZ(sector_t::floor); } else { - return Z + front->ceilingtexz; + return Z + front->GetPlaneTexZ(sector_t::ceiling); } } } diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index d0c957e05..315bc757d 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -118,7 +118,7 @@ void DLightningThinker::LightningFlash () { // allow combination of the lightning sector specials with bit masks int special = (tempSec->special&0xff); - if (tempSec->ceilingpic == skyflatnum + if (tempSec->GetTexture(sector_t::ceiling) == skyflatnum || special == Light_IndoorLightning1 || special == Light_IndoorLightning2 || special == Light_OutdoorLightning) diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 1541bc627..039e9871d 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -231,14 +231,14 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f if(line->flags & ML_DONTPEGBOTTOM) { *ptexbot = y_offset + - MAX(line->frontsector->floortexz, line->backsector->floortexz); + MAX(line->frontsector->GetPlaneTexZ(sector_t::floor), line->backsector->GetPlaneTexZ(sector_t::floor)); *ptextop = *ptexbot + textureheight; } else { *ptextop = y_offset + - MIN(line->frontsector->ceilingtexz, line->backsector->ceilingtexz); + MIN(line->frontsector->GetPlaneTexZ(sector_t::ceiling), line->backsector->GetPlaneTexZ(sector_t::ceiling)); *ptexbot = *ptextop - textureheight; } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 565de0da5..ca59f9a42 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1898,18 +1898,8 @@ void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling) while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0) { - if (floorOrCeiling == false) - { - if (sectors[secnum].floorpic != flat) - { - sectors[secnum].floorpic = flat; - sectors[secnum].AdjustFloorClip (); - } - } - else - { - sectors[secnum].ceilingpic = flat; - } + int pos = floorOrCeiling? sector_t::ceiling : sector_t::floor; + sectors[secnum].SetTexture(pos, flat); } } @@ -2000,8 +1990,10 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags) { sector_t *sec = §ors[i]; - if (!(flags & NOT_FLOOR) && sec->floorpic == picnum1) sec->floorpic = picnum2; - if (!(flags & NOT_CEILING) && sec->ceilingpic == picnum1) sec->ceilingpic = picnum2; + if (!(flags & NOT_FLOOR) && sec->GetTexture(sector_t::floor) == picnum1) + sec->SetTexture(sector_t::floor, picnum2); + if (!(flags & NOT_CEILING) && sec->GetTexture(sector_t::ceiling) == picnum1) + sec->SetTexture(sector_t::ceiling, picnum2); } } } @@ -5321,7 +5313,7 @@ int DLevelScript::RunScript () if (actor != NULL) { FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(STACK(1))); - STACK(2) = (tex == TexMan[actor->Sector->ceilingpic]); + STACK(2) = (tex == TexMan[actor->Sector->GetTexture(sector_t::ceiling)]); } else STACK(2)=0; sp--; @@ -5334,7 +5326,7 @@ int DLevelScript::RunScript () if (actor != NULL) { FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(STACK(1))); - STACK(2) = (tex == TexMan[actor->Sector->floorpic]); + STACK(2) = (tex == TexMan[actor->Sector->GetTexture(sector_t::floor)]); } else STACK(2)=0; sp--; diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 3850983e4..1ef6de6a7 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -369,38 +369,38 @@ static void LoadSectors (sectortype *bsec) bsec->ceilingstat = WORD(bsec->ceilingstat); bsec->floorstat = WORD(bsec->floorstat); - sec->floortexz = -(LittleLong(bsec->floorz) << 8); - sec->floorplane.d = -sec->floortexz; + sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorz) << 8)); + sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); sec->floorplane.c = FRACUNIT; sec->floorplane.ic = FRACUNIT; mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->floorpicnum)); - sec->floorpic = TexMan.GetTexture (tnam, FTexture::TEX_Build); + sec->SetTexture(sector_t::floor, TexMan.GetTexture (tnam, FTexture::TEX_Build)); sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT); sec->SetYScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT); sec->SetXOffset(sector_t::floor, (bsec->floorxpanning << FRACBITS) + (32 << FRACBITS)); sec->SetYOffset(sector_t::floor, bsec->floorypanning << FRACBITS); - sec->FloorLight = SHADE2LIGHT (bsec->floorshade); - sec->FloorFlags = SECF_ABSLIGHTING; + sec->SetPlaneLight(sector_t::floor, SHADE2LIGHT (bsec->floorshade)); + sec->ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); - sec->ceilingtexz = -(LittleLong(bsec->ceilingz) << 8); - sec->ceilingplane.d = sec->ceilingtexz; + sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingz) << 8)); + sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); sec->ceilingplane.c = -FRACUNIT; sec->ceilingplane.ic = -FRACUNIT; mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->ceilingpicnum)); - sec->ceilingpic = TexMan.GetTexture (tnam, FTexture::TEX_Build); + sec->SetTexture(sector_t::ceiling, TexMan.GetTexture (tnam, FTexture::TEX_Build)); if (bsec->ceilingstat & 1) { - sky1texture = sky2texture = sec->ceilingpic; - sec->ceilingpic = skyflatnum; + sky1texture = sky2texture = sec->GetTexture(sector_t::ceiling); + sec->SetTexture(sector_t::ceiling, skyflatnum); } sec->SetXScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT); sec->SetYScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT); sec->SetXOffset(sector_t::ceiling, (bsec->ceilingxpanning << FRACBITS) + (32 << FRACBITS)); sec->SetYOffset(sector_t::ceiling, bsec->ceilingypanning << FRACBITS); - sec->CeilingLight = SHADE2LIGHT (bsec->ceilingshade); - sec->CeilingFlags = SECF_ABSLIGHTING; + sec->SetPlaneLight(sector_t::ceiling, SHADE2LIGHT (bsec->ceilingshade)); + sec->ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); - sec->lightlevel = (sec->FloorLight + sec->CeilingLight) / 2; + sec->lightlevel = (sec->GetPlaneLight(sector_t::floor) + sec->GetPlaneLight(sector_t::ceiling)) / 2; sec->seqType = -1; sec->nextsec = -1; diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 7a895838d..26d5538ee 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -110,7 +110,7 @@ void DCeiling::Tick () m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: - m_Sector->ceilingpic = m_Texture; + m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: SN_StopSequence (m_Sector); @@ -143,7 +143,7 @@ void DCeiling::Tick () m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: - m_Sector->ceilingpic = m_Texture; + m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: SN_StopSequence (m_Sector); @@ -421,7 +421,7 @@ manual_ceiling: sec->FindModelCeilingSector (targheight); if (modelsec != NULL) { - ceiling->m_Texture = modelsec->ceilingpic; + ceiling->m_Texture = modelsec->GetTexture(sector_t::ceiling); switch (change & 3) { case 1: // type is zeroed @@ -440,7 +440,7 @@ manual_ceiling: } else if (line) // else if a trigger model change { - ceiling->m_Texture = line->frontsector->ceilingpic; + ceiling->m_Texture = line->frontsector->GetTexture(sector_t::ceiling); switch (change & 3) { case 1: // type is zeroed diff --git a/src/p_floor.cpp b/src/p_floor.cpp index d920908c5..a2c846ca6 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -180,8 +180,7 @@ void DFloor::Tick () m_Sector->special = (m_Sector->special & SECRET_MASK) | m_NewSpecial; //fall thru case genFloorChg: - m_Sector->floorpic = m_Texture; - m_Sector->AdjustFloorClip (); + m_Sector->SetTexture(sector_t::floor, m_Texture); break; default: break; @@ -197,8 +196,7 @@ void DFloor::Tick () m_Sector->special = (m_Sector->special & SECRET_MASK) | m_NewSpecial; //fall thru case genFloorChg: - m_Sector->floorpic = m_Texture; - m_Sector->AdjustFloorClip (); + m_Sector->SetTexture(sector_t::floor, m_Texture); break; default: break; @@ -299,7 +297,7 @@ void DElevator::Tick () void DFloor::SetFloorChangeType (sector_t *sec, int change) { - m_Texture = sec->floorpic; + m_Texture = sec->GetTexture(sector_t::floor); switch (change & 3) { @@ -517,13 +515,9 @@ manual_floor: floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, newheight); if (line != NULL) { - FTextureID oldpic = sec->floorpic; - sec->floorpic = line->frontsector->floorpic; + FTextureID oldpic = sec->GetTexture(sector_t::floor); + sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor)); sec->special = (sec->special & SECRET_MASK) | (line->frontsector->special & ~SECRET_MASK); - if (oldpic != sec->floorpic) - { - sec->AdjustFloorClip (); - } } else { @@ -535,7 +529,7 @@ manual_floor: floor->m_Direction = -1; newheight = sec->FindLowestFloorSurrounding (&spot); floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight); - floor->m_Texture = sec->floorpic; + floor->m_Texture = sec->GetTexture(sector_t::floor); // jff 1/24/98 make sure floor->m_NewSpecial gets initialized // in case no surrounding sector is at floordestheight // --> should not affect compatibility <-- @@ -546,7 +540,7 @@ manual_floor: modelsec = sec->FindModelFloorSector (newheight); if (modelsec != NULL) { - floor->m_Texture = modelsec->floorpic; + floor->m_Texture = modelsec->GetTexture(sector_t::floor); floor->m_NewSpecial = modelsec->special & ~SECRET_MASK; } break; @@ -659,14 +653,14 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) rtn = true; // handle trigger or numeric change type - FTextureID oldpic = sec->floorpic; + FTextureID oldpic = sec->GetTexture(sector_t::floor); switch(changetype) { case trigChangeOnly: if (line) { // [RH] if no line, no change - sec->floorpic = line->frontsector->floorpic; + sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor)); sec->special = (sec->special & SECRET_MASK) | (line->frontsector->special & ~SECRET_MASK); } break; @@ -674,18 +668,13 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) secm = sec->FindModelFloorSector (sec->CenterFloor()); if (secm) { // if no model, no change - sec->floorpic = secm->floorpic; + sec->SetTexture(sector_t::floor, secm->GetTexture(sector_t::floor)); sec->special = secm->special; } break; default: break; } - - if (oldpic != sec->floorpic) - { - sec->AdjustFloorClip (); - } } return rtn; } @@ -787,7 +776,7 @@ manual_stair: height = sec->floorplane.ZatPoint (0, 0) + stairstep; floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, height); - texture = sec->floorpic; + texture = sec->GetTexture(sector_t::floor); osecnum = secnum; //jff 3/4/98 preserve loop index // Find next sector to raise @@ -837,7 +826,7 @@ manual_stair: if (!tsec) continue; //jff 5/7/98 if no backside, continue newsecnum = (int)(tsec - sectors); - if (!igntxt && tsec->floorpic != texture) + if (!igntxt && tsec->GetTexture(sector_t::floor) != texture) continue; height += stairstep; @@ -954,7 +943,7 @@ bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) floor->m_Direction = 1; floor->m_Sector = s2; floor->m_Speed = slimespeed; - floor->m_Texture = s3->floorpic; + floor->m_Texture = s3->GetTexture(sector_t::floor); floor->m_NewSpecial = 0; height = s3->FindHighestFloorPoint (&spot); floor->m_FloorDestDist = s2->floorplane.PointToDist (spot, height); @@ -1110,18 +1099,18 @@ void DWaggleBase::Destroy() void DWaggleBase::DoWaggle (bool ceiling) { secplane_t *plane; - fixed_t *texz; + int pos; fixed_t dist; if (ceiling) { plane = &m_Sector->ceilingplane; - texz = &m_Sector->ceilingtexz; + pos = sector_t::ceiling; } else { plane = &m_Sector->floorplane; - texz = &m_Sector->floortexz; + pos = sector_t::floor; } switch (m_State) @@ -1138,7 +1127,7 @@ void DWaggleBase::DoWaggle (bool ceiling) if ((m_Scale -= m_ScaleDelta) <= 0) { // Remove dist = FixedMul (m_OriginalDist - plane->d, plane->ic); - *texz -= plane->HeightDiff (m_OriginalDist); + m_Sector->ChangePlaneTexZ(pos, -plane->HeightDiff (m_OriginalDist)); plane->d = m_OriginalDist; P_ChangeSector (m_Sector, true, dist, ceiling, false); if (ceiling) diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index dcdd7dcec..b5f5e6a78 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -92,14 +92,14 @@ bool sector_t::IsLinked(sector_t *other, bool ceiling) const static bool MoveCeiling(sector_t *sector, int crush, fixed_t move) { sector->ceilingplane.ChangeHeight (move); - sector->ceilingtexz += move; + sector->ChangePlaneTexZ(sector_t::ceiling, move); if (P_ChangeSector(sector, crush, move, 1, true)) return false; // Don't let the ceiling go below the floor if ((sector->ceilingplane.a | sector->ceilingplane.b | sector->floorplane.a | sector->floorplane.b) == 0 && - sector->floortexz > sector->ceilingtexz) return false; + sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; return true; } @@ -107,14 +107,14 @@ static bool MoveCeiling(sector_t *sector, int crush, fixed_t move) static bool MoveFloor(sector_t *sector, int crush, fixed_t move) { sector->floorplane.ChangeHeight (move); - sector->floortexz += move; + sector->ChangePlaneTexZ(sector_t::floortexz, move); if (P_ChangeSector(sector, crush, move, 0, true)) return false; // Don't let the floor go above the ceiling if ((sector->ceilingplane.a | sector->ceilingplane.b | sector->floorplane.a | sector->floorplane.b) == 0 && - sector->floortexz > sector->ceilingtexz) return false; + sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false; return true; } diff --git a/src/p_map.cpp b/src/p_map.cpp index d5356f901..445c6c7ae 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -180,9 +180,9 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex) tmf.thing = actor; tmf.floorz = tmf.dropoffz = sec->floorplane.ZatPoint (tmf.x, tmf.y); tmf.ceilingz = sec->ceilingplane.ZatPoint (tmf.x, tmf.y); - tmf.floorpic = sec->floorpic; + tmf.floorpic = sec->GetTexture(sector_t::floor); tmf.floorsector = sec; - tmf.ceilingpic = sec->ceilingpic; + tmf.ceilingpic = sec->GetTexture(sector_t::ceiling); tmf.ceilingsector = sec; tmf.touchmidtex = false; validcount++; @@ -239,9 +239,9 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr tmf.z = z; tmf.floorz = tmf.dropoffz = newsec->floorplane.ZatPoint (x, y); tmf.ceilingz = newsec->ceilingplane.ZatPoint (x, y); - tmf.floorpic = newsec->floorpic; + tmf.floorpic = newsec->GetTexture(sector_t::floor); tmf.floorsector = newsec; - tmf.ceilingpic = newsec->ceilingpic; + tmf.ceilingpic = newsec->GetTexture(sector_t::ceiling); tmf.ceilingsector = newsec; spechit.Clear (); @@ -365,13 +365,13 @@ void P_PlayerStartStomp (AActor *actor) inline fixed_t secfriction (const sector_t *sec) { - fixed_t friction = Terrains[TerrainTypes[sec->floorpic]].Friction; + fixed_t friction = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction; return friction != 0 ? friction : sec->friction; } inline fixed_t secmovefac (const sector_t *sec) { - fixed_t movefactor = Terrains[TerrainTypes[sec->floorpic]].MoveFactor; + fixed_t movefactor = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].MoveFactor; return movefactor != 0 ? movefactor : sec->movefactor; } @@ -408,7 +408,7 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) { sec = m->m_sector; if (!(sec->special & FRICTION_MASK) && - Terrains[TerrainTypes[sec->floorpic]].Friction == 0) + Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction == 0) { continue; } @@ -1025,9 +1025,9 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm) // Any contacted lines the step closer together will adjust them. tm.floorz = tm.dropoffz = newsec->floorplane.ZatPoint (x, y); tm.ceilingz = newsec->ceilingplane.ZatPoint (x, y); - tm.floorpic = newsec->floorpic; + tm.floorpic = newsec->GetTexture(sector_t::floor); tm.floorsector = newsec; - tm.ceilingpic = newsec->ceilingpic; + tm.ceilingpic = newsec->GetTexture(sector_t::ceiling); tm.ceilingsector = newsec; tm.touchmidtex = false; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 023c1777c..310b642cb 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -157,7 +157,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, /*Printf ("]]]]]] %d %d\n", ff, bf);*/ open.topsec = fc < bc? front : back; - open.ceilingpic = open.topsec->ceilingpic; + open.ceilingpic = open.topsec->GetTexture(sector_t::ceiling); open.top = fc < bc ? fc : bc; bool usefront; @@ -186,14 +186,14 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, { open.bottom = ff; open.bottomsec = front; - open.floorpic = front->floorpic; + open.floorpic = front->GetTexture(sector_t::floor); open.lowfloor = bf; } else { open.bottom = bf; open.bottomsec = back; - open.floorpic = back->floorpic; + open.floorpic = back->GetTexture(sector_t::floor); open.lowfloor = ff; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 81d369dd3..264301ce5 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1635,7 +1635,7 @@ explode: // explode a missile if (tm.ceilingline && tm.ceilingline->backsector && - tm.ceilingline->backsector->ceilingpic == skyflatnum && + tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && mo->z >= tm.ceilingline->backsector->ceilingplane.ZatPoint (mo->x, mo->y) && //killough !(mo->flags3 & MF3_SKYEXPLODE)) { @@ -3108,9 +3108,9 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t actor->floorz = actor->Sector->floorplane.ZatPoint (ix, iy); actor->ceilingz = actor->Sector->ceilingplane.ZatPoint (ix, iy); actor->floorsector = actor->Sector; - actor->floorpic = actor->floorsector->floorpic; + actor->floorpic = actor->floorsector->GetTexture(sector_t::floor); actor->ceilingsector = actor->Sector; - actor->ceilingpic = actor->ceilingsector->ceilingpic; + actor->ceilingpic = actor->ceilingsector->GetTexture(sector_t::ceiling); // Check if there's something solid to stand on between the current position and the // current sector's floor. P_FindFloorCeiling(actor, true); @@ -3124,9 +3124,9 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t actor->floorz = FIXED_MIN; actor->dropoffz = FIXED_MIN; actor->ceilingz = FIXED_MAX; - actor->floorpic = actor->Sector->floorpic; + actor->floorpic = actor->Sector->GetTexture(sector_t::floor); actor->floorsector = actor->Sector; - actor->ceilingpic = actor->Sector->ceilingpic; + actor->ceilingpic = actor->Sector->GetTexture(sector_t::ceiling); actor->ceilingsector = actor->Sector; } @@ -3363,7 +3363,7 @@ void AActor::AdjustFloorClip () m->m_sector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && m->m_sector->floorplane.ZatPoint (x, y) == z) { - fixed_t clip = Terrains[TerrainTypes[m->m_sector->floorpic]].FootClip; + fixed_t clip = Terrains[TerrainTypes[m->m_sector->GetTexture(sector_t::floor)]].FootClip; if (clip < shallowestclip) { shallowestclip = clip; @@ -4182,7 +4182,7 @@ int P_GetThingFloorType (AActor *thing) } else { - return TerrainTypes[thing->Sector->floorpic]; + return TerrainTypes[thing->Sector->GetTexture(sector_t::floor)]; } } @@ -4213,11 +4213,11 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z) (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) || !(sec->heightsec->MoreFlags & SECF_CLIPFAKEPLANES)) { - terrainnum = TerrainTypes[sec->floorpic]; + terrainnum = TerrainTypes[sec->GetTexture(sector_t::floor)]; } else { - terrainnum = TerrainTypes[sec->heightsec->floorpic]; + terrainnum = TerrainTypes[sec->heightsec->GetTexture(sector_t::floor)]; } int splashnum = Terrains[terrainnum].Splash; diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 0b19acc8c..cc03ed7cd 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -261,7 +261,7 @@ manual_plat: if (change) { if (line) - sec->floorpic = sides[line->sidenum[0]].sector->floorpic; + sec->SetTexture(sector_t::floor, sides[line->sidenum[0]].sector->GetTexture(sector_t::floor)); if (change == 1) sec->special &= SECRET_MASK; // Stop damage and other stuff, if any } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 596b1367e..ad355ed9f 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -291,10 +291,6 @@ void P_SerializeWorld (FArchive &arc) { arc << sec->floorplane << sec->ceilingplane - << sec->floortexz - << sec->ceilingtexz - << sec->floorpic - << sec->ceilingpic << sec->lightlevel << sec->special << sec->tag @@ -317,10 +313,6 @@ void P_SerializeWorld (FArchive &arc) << sec->mod << sec->SoundTarget << sec->SecActTarget - << sec->FloorLight - << sec->CeilingLight - << sec->FloorFlags - << sec->CeilingFlags << sec->sky << sec->MoreFlags << sec->Flags @@ -415,7 +407,8 @@ FArchive &operator<< (FArchive &arc, side_t::part &p) FArchive &operator<< (FArchive &arc, sector_t::splane &p) { arc << p.xform.xoffs << p.xform.yoffs << p.xform.xscale << p.xform.yscale - << p.xform.angle << p.xform.base_yoffs << p.xform.base_angle; + << p.xform.angle << p.xform.base_yoffs << p.xform.base_angle + << p.Flags << p.Light << p.Texture << p.TexZ; return arc; } diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index de3738db9..cccb53052 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -63,7 +63,7 @@ fixed_t sector_t::FindLowestFloorSurrounding (vertex_t **v) const fixed_t ofloor; vertex_t *spot; - if (linecount == 0) return floortexz; + if (linecount == 0) return GetPlaneTexZ(sector_t::floor); spot = lines[0]->v1; floor = floorplane.ZatPoint (spot); @@ -270,7 +270,7 @@ fixed_t sector_t::FindNextLowestCeiling (vertex_t **v) const int i; - if (linecount == 0) return ceilingtexz; + if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); spot = lines[0]->v1; height = ceilingplane.ZatPoint (spot); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index dae7ea029..0800e8f04 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1186,18 +1186,18 @@ void P_LoadSectors (MapData * map) { ss->e = §ors[0].e[i]; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; - ss->floortexz = LittleShort(ms->floorheight)<floorplane.d = -ss->floortexz; + ss->SetPlaneTexZ(sector_t::floor, LittleShort(ms->floorheight)<floorplane.d = -ss->GetPlaneTexZ(sector_t::floor); ss->floorplane.c = FRACUNIT; ss->floorplane.ic = FRACUNIT; - ss->ceilingtexz = LittleShort(ms->ceilingheight)<ceilingplane.d = ss->ceilingtexz; + ss->SetPlaneTexZ(sector_t::ceiling, LittleShort(ms->ceilingheight)<ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling); ss->ceilingplane.c = -FRACUNIT; ss->ceilingplane.ic = -FRACUNIT; strncpy (fname, ms->floorpic, 8); - ss->floorpic = TexMan.GetTexture (fname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); + ss->SetTexture(sector_t::floor, TexMan.GetTexture (fname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable)); strncpy (fname, ms->ceilingpic, 8); - ss->ceilingpic = TexMan.GetTexture (fname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); + ss->SetTexture(sector_t::ceiling, TexMan.GetTexture (fname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable)); ss->lightlevel = clamp (LittleShort(ms->lightlevel), (short)0, (short)255); if (map->HasBehavior) ss->special = LittleShort(ms->special); @@ -1225,7 +1225,7 @@ void P_LoadSectors (MapData * map) // [RH] Sectors default to white light with the default fade. // If they are outside (have a sky ceiling), they use the outside fog. - if (level.outsidefog != 0xff000000 && (ss->ceilingpic == skyflatnum || (ss->special&0xff) == Sector_Outside)) + if (level.outsidefog != 0xff000000 && (ss->GetTexture(sector_t::ceiling) == skyflatnum || (ss->special&0xff) == Sector_Outside)) { if (fogMap == NULL) fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 93d79172a..e3501a337 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -209,7 +209,7 @@ void P_VavoomSlope(sector_t * sec, int id, fixed_t x, fixed_t y, fixed_t z, int { FVector3 v1, v2, cross; secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane; - fixed_t srcheight = (which == 0) ? sec->floortexz : sec->ceilingtexz; + fixed_t srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); v1[0] = FIXED2FLOAT (x - l->v2->x); v1[1] = FIXED2FLOAT (y - l->v2->y); @@ -327,9 +327,9 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt) fixed_t z3; if (h1==NULL && h2==NULL && h3==NULL) continue; - vt1.Z = FIXED2FLOAT(h1? *h1 : j==0? sec->floortexz : sec->ceilingtexz); - vt2.Z = FIXED2FLOAT(h2? *h2 : j==0? sec->floortexz : sec->ceilingtexz); - z3 = h3? *h3 : j==0? sec->floortexz : sec->ceilingtexz; + vt1.Z = FIXED2FLOAT(h1? *h1 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling)); + vt2.Z = FIXED2FLOAT(h2? *h2 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling)); + z3 = h3? *h3 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); vt3.Z = FIXED2FLOAT(z3); if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 8cbd03235..a168edb2d 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -684,12 +684,12 @@ DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor) if (copyFloor) { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].FloorFlags |= SECF_ABSLIGHTING; + sectors[secnum].ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); } else { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].CeilingFlags |= SECF_ABSLIGHTING; + sectors[secnum].ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); } ChangeStatNum (STAT_LIGHTTRANSFER); } @@ -712,12 +712,12 @@ void DLightTransfer::DoTransfer (BYTE level, int target, bool floor) if (floor) { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].FloorLight = level; + sectors[secnum].SetPlaneLight(sector_t::floor, level); } else { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].CeilingLight = level; + sectors[secnum].SetPlaneLight(sector_t::ceiling, level); } } diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 230279bc3..0f71bc8f1 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -419,7 +419,7 @@ static bool EditTraceResult (DWORD flags, FTraceResults &res) { // Throw away sky hits if (res.HitType == TRACE_HitFloor) { - if (res.Sector->floorpic == skyflatnum) + if (res.Sector->GetTexture(sector_t::floor) == skyflatnum) { res.HitType = TRACE_HitNone; return false; @@ -427,7 +427,7 @@ static bool EditTraceResult (DWORD flags, FTraceResults &res) } else if (res.HitType == TRACE_HitCeiling) { - if (res.Sector->ceilingpic == skyflatnum) + if (res.Sector->GetTexture(sector_t::ceiling) == skyflatnum) { res.HitType = TRACE_HitNone; return false; @@ -436,8 +436,8 @@ static bool EditTraceResult (DWORD flags, FTraceResults &res) else if (res.HitType == TRACE_HitWall) { if (res.Tier == TIER_Upper && - res.Line->frontsector->ceilingpic == skyflatnum && - res.Line->backsector->ceilingpic == skyflatnum) + res.Line->frontsector->GetTexture(sector_t::ceiling) == skyflatnum && + res.Line->backsector->GetTexture(sector_t::ceiling) == skyflatnum) { res.HitType = TRACE_HitNone; return false; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 1f761b40f..5ffa75082 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -800,19 +800,19 @@ struct UDMFParser switch(key) { case NAME_Heightfloor: - sec->floortexz = CheckInt(key) << FRACBITS; + sec->SetPlaneTexZ(sector_t::floor, CheckInt(key) << FRACBITS); break; case NAME_Heightceiling: - sec->ceilingtexz = CheckInt(key) << FRACBITS; + sec->SetPlaneTexZ(sector_t::ceiling, CheckInt(key) << FRACBITS); break; case NAME_Texturefloor: - sec->floorpic = TexMan.GetTexture (CheckString(key), FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); + sec->SetTexture(sector_t::floor, TexMan.GetTexture (CheckString(key), FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable)); break; case NAME_Textureceiling: - sec->ceilingpic = TexMan.GetTexture (CheckString(key), FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); + sec->SetTexture(sector_t::ceiling, TexMan.GetTexture (CheckString(key), FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable)); break; case NAME_Lightlevel: @@ -880,21 +880,21 @@ struct UDMFParser break; case NAME_Lightfloor: - sec->FloorLight = CheckInt(key); + sec->SetPlaneLight(sector_t::floor, CheckInt(key)); break; case NAME_Lightceiling: - sec->CeilingLight = CheckInt(key); + sec->SetPlaneLight(sector_t::ceiling, CheckInt(key)); break; case NAME_Lightfloorabsolute: - if (CheckBool(key)) sec->FloorFlags |= SECF_ABSLIGHTING; - else sec->FloorFlags &= ~SECF_ABSLIGHTING; + if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); + else sec->ChangeFlags(sector_t::floor, SECF_ABSLIGHTING, 0); break; case NAME_Lightceilingabsolute: - if (CheckBool(key)) sec->CeilingFlags |= SECF_ABSLIGHTING; - else sec->CeilingFlags &= ~SECF_ABSLIGHTING; + if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); + else sec->ChangeFlags(sector_t::ceiling, SECF_ABSLIGHTING, 0); break; case NAME_Gravity: @@ -932,16 +932,16 @@ struct UDMFParser sc.MustGetToken(';'); } - sec->floorplane.d = -sec->floortexz; + sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); sec->floorplane.c = FRACUNIT; sec->floorplane.ic = FRACUNIT; - sec->ceilingplane.d = sec->ceilingtexz; + sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); sec->ceilingplane.c = -FRACUNIT; sec->ceilingplane.ic = -FRACUNIT; // [RH] Sectors default to white light with the default fade. // If they are outside (have a sky ceiling), they use the outside fog. - if (level.outsidefog != 0xff000000 && (sec->ceilingpic == skyflatnum || (sec->special&0xff) == Sector_Outside)) + if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) { if (fogMap == NULL) fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index 95628e7b5..b2038ccae 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -242,10 +242,10 @@ static int WriteSECTORS (FILE *file) for (int i = 0; i < numsectors; ++i) { - ms.floorheight = LittleShort(short(sectors[i].floortexz >> FRACBITS)); - ms.ceilingheight = LittleShort(short(sectors[i].ceilingtexz >> FRACBITS)); - uppercopy (ms.floorpic, GetTextureName (sectors[i].floorpic)); - uppercopy (ms.ceilingpic, GetTextureName (sectors[i].ceilingpic)); + ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::floor) >> FRACBITS)); + ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling) >> FRACBITS)); + uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor))); + uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling))); ms.lightlevel = LittleShort(sectors[i].lightlevel); ms.special = LittleShort(sectors[i].special); ms.tag = LittleShort(sectors[i].tag); diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 44e354b30..9a9a2e244 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -269,25 +269,25 @@ void R_ClearClipSegs (short left, short right) int GetFloorLight (const sector_t *sec) { - if (sec->FloorFlags & SECF_ABSLIGHTING) + if (sec->GetFlags(sector_t::floor) & SECF_ABSLIGHTING) { - return sec->FloorLight; + return sec->GetPlaneLight(sector_t::floor); } else { - return clamp (sec->lightlevel + (SBYTE)sec->FloorLight, 0, 255); + return clamp (sec->lightlevel + sec->GetPlaneLight(sector_t::floor), 0, 255); } } int GetCeilingLight (const sector_t *sec) { - if (sec->CeilingFlags & SECF_ABSLIGHTING) + if (sec->GetFlags(sector_t::ceiling) & SECF_ABSLIGHTING) { - return sec->CeilingLight; + return sec->GetPlaneLight(sector_t::ceiling); } else { - return clamp (sec->lightlevel + (SBYTE)sec->CeilingLight, 0, 255); + return clamp (sec->lightlevel + sec->GetPlaneLight(sector_t::ceiling), 0, 255); } } @@ -368,7 +368,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, { if (CopyPlaneIfValid (&tempsec->floorplane, &s->floorplane, &sec->ceilingplane)) { - tempsec->floorpic = s->floorpic; + tempsec->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false); } else if (s->MoreFlags & SECF_FAKEFLOORONLY) { @@ -406,7 +406,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, { if (CopyPlaneIfValid (&tempsec->ceilingplane, &s->ceilingplane, &sec->floorplane)) { - tempsec->ceilingpic = s->ceilingpic; + tempsec->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false); } } else @@ -456,23 +456,23 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, // killough 11/98: prevent sudden light changes from non-water sectors: if ((underwater && !back) || doorunderwater) { // head-below-floor hack - tempsec->floorpic = diffTex ? sec->floorpic : s->floorpic; + tempsec->SetTexture(sector_t::floor, diffTex ? sec->GetTexture(sector_t::floor) : s->GetTexture(sector_t::floor), false); tempsec->planes[sector_t::floor].xform = s->planes[sector_t::floor].xform; tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane.FlipVert (); tempsec->ceilingplane.ChangeHeight (-1); - if (s->ceilingpic == skyflatnum) + if (s->GetTexture(sector_t::ceiling) == skyflatnum) { tempsec->floorplane = tempsec->ceilingplane; tempsec->floorplane.FlipVert (); tempsec->floorplane.ChangeHeight (+1); - tempsec->ceilingpic = tempsec->floorpic; + tempsec->SetTexture(sector_t::ceiling, tempsec->GetTexture(sector_t::floor), false); tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform; } else { - tempsec->ceilingpic = diffTex ? s->floorpic : s->ceilingpic; + tempsec->SetTexture(sector_t::ceiling, diffTex ? s->GetTexture(sector_t::floor) : s->GetTexture(sector_t::ceiling), false); tempsec->planes[sector_t::ceiling].xform = s->planes[sector_t::ceiling].xform; } @@ -502,14 +502,14 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, tempsec->ColorMap = s->ColorMap; tempsec->ColorMap = s->ColorMap; - tempsec->ceilingpic = diffTex ? sec->ceilingpic : s->ceilingpic; - tempsec->floorpic = s->ceilingpic; + tempsec->SetTexture(sector_t::ceiling, diffTex ? sec->GetTexture(sector_t::ceiling) : s->GetTexture(sector_t::ceiling), false); + tempsec->SetTexture(sector_t::floor, s->GetTexture(sector_t::ceiling), false); tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform = s->planes[sector_t::ceiling].xform; - if (s->floorpic != skyflatnum) + if (s->GetTexture(sector_t::floor) != skyflatnum) { tempsec->ceilingplane = sec->ceilingplane; - tempsec->floorpic = s->floorpic; + tempsec->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false); tempsec->planes[sector_t::floor].xform = s->planes[sector_t::floor].xform; } @@ -723,7 +723,7 @@ void R_AddLine (seg_t *line) } else if ( // properly render skies (consider door "open" if both ceilings are sky): - (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum) + (backsector->GetTexture(sector_t::ceiling) != skyflatnum || frontsector->GetTexture(sector_t::ceiling) != skyflatnum) // if door is closed because back is shut: && rw_backcz1 <= rw_backfz1 && rw_backcz2 <= rw_backfz2 @@ -750,8 +750,8 @@ void R_AddLine (seg_t *line) solid = false; } else if (backsector->lightlevel != frontsector->lightlevel - || backsector->floorpic != frontsector->floorpic - || backsector->ceilingpic != frontsector->ceilingpic + || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) + || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || curline->sidedef->GetTexture(side_t::mid).isValid() // killough 3/7/98: Take flats offsets into account: @@ -760,10 +760,10 @@ void R_AddLine (seg_t *line) || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling) || backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling) - || backsector->FloorLight != frontsector->FloorLight - || backsector->CeilingLight != frontsector->CeilingLight - || backsector->FloorFlags != frontsector->FloorFlags - || backsector->CeilingFlags != frontsector->CeilingFlags + || backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) + || backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) + || backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor) + || backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling) // [RH] Also consider colormaps || backsector->ColorMap != frontsector->ColorMap @@ -1041,13 +1041,13 @@ void R_Subsector (subsector_t *sub) r_actualextralight = foggy ? 0 : extralight << 4; basecolormap = frontsector->ColorMap; ceilingplane = frontsector->ceilingplane.ZatPoint (viewx, viewy) > viewz || - frontsector->ceilingpic == skyflatnum || + frontsector->GetTexture(sector_t::ceiling) == skyflatnum || (frontsector->CeilingSkyBox != NULL && frontsector->CeilingSkyBox->bAlways) || (frontsector->heightsec && !(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && - frontsector->heightsec->floorpic == skyflatnum) ? + frontsector->heightsec->GetTexture(sector_t::floor) == skyflatnum) ? R_FindPlane(frontsector->ceilingplane, // killough 3/8/98 - frontsector->ceilingpic, + frontsector->GetTexture(sector_t::ceiling), ceilinglightlevel + r_actualextralight, // killough 4/11/98 frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98 frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98 @@ -1065,13 +1065,13 @@ void R_Subsector (subsector_t *sub) // killough 3/16/98: add floorlightlevel // killough 10/98: add support for skies transferred from sidedefs floorplane = frontsector->floorplane.ZatPoint (viewx, viewy) < viewz || // killough 3/7/98 - frontsector->floorpic == skyflatnum || + frontsector->GetTexture(sector_t::floor) == skyflatnum || (frontsector->FloorSkyBox != NULL && frontsector->FloorSkyBox->bAlways) || (frontsector->heightsec && !(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && - frontsector->heightsec->ceilingpic == skyflatnum) ? + frontsector->heightsec->GetTexture(sector_t::ceiling) == skyflatnum) ? R_FindPlane(frontsector->floorplane, - frontsector->floorpic, + frontsector->GetTexture(sector_t::floor), floorlightlevel + r_actualextralight, // killough 3/16/98 frontsector->GetXOffset(sector_t::floor), // killough 3/7/98 frontsector->GetYOffset(sector_t::floor), // killough 3/7/98 @@ -1087,7 +1087,7 @@ void R_Subsector (subsector_t *sub) // lightlevels on floor & ceiling lightlevels in the surrounding area. // [RH] Handle sprite lighting like Duke 3D: If the ceiling is a sky, sprites are lit by // it, otherwise they are lit by the floor. - R_AddSprites (sub->sector, frontsector->ceilingpic == skyflatnum ? + R_AddSprites (sub->sector, frontsector->GetTexture(sector_t::ceiling) == skyflatnum ? ceilinglightlevel : floorlightlevel, FakeSide); // [RH] Add particles diff --git a/src/r_data.cpp b/src/r_data.cpp index 70738ae29..a4bfa0fed 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -457,7 +457,8 @@ void R_PrecacheLevel (void) for (i = numsectors - 1; i >= 0; i--) { - hitlist[sectors[i].floorpic.GetIndex()] = hitlist[sectors[i].ceilingpic.GetIndex()] |= 2; + hitlist[sectors[i].GetTexture(sector_t::floor).GetIndex()] = + hitlist[sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= 2; } for (i = numsides - 1; i >= 0; i--) diff --git a/src/r_defs.h b/src/r_defs.h index 09ff9076a..3466574ab 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -373,6 +373,10 @@ struct sector_t struct splane { FTransform xform; + int Flags; + int Light; + FTextureID Texture; + fixed_t TexZ; }; @@ -458,6 +462,53 @@ struct sector_t planes[pos].xform.base_angle = o; } + int GetFlags(int pos) const + { + return planes[pos].Flags; + } + + void ChangeFlags(int pos, int And, int Or) + { + planes[pos].Flags &= ~And; + planes[pos].Flags |= Or; + } + + int GetPlaneLight(int pos) const + { + return planes[pos].Light; + } + + void SetPlaneLight(int pos, int level) + { + planes[pos].Light = level; + } + + FTextureID GetTexture(int pos) const + { + return planes[pos].Texture; + } + + void SetTexture(int pos, FTextureID tex, bool floorclip = true) + { + FTextureID old = planes[pos].Texture; + planes[pos].Texture = tex; + if (floorclip && pos == floor && tex != old) AdjustFloorClip(); + } + + fixed_t GetPlaneTexZ(int pos) const + { + return planes[pos].TexZ; + } + + void SetPlaneTexZ(int pos, fixed_t val) + { + planes[pos].TexZ = val; + } + + void ChangePlaneTexZ(int pos, fixed_t val) + { + planes[pos].TexZ += val; + } // Member variables @@ -466,14 +517,10 @@ struct sector_t // [RH] store floor and ceiling planes instead of heights secplane_t floorplane, ceilingplane; - fixed_t floortexz, ceilingtexz; // [RH] used for wall texture mapping // [RH] give floor and ceiling even more properties FDynamicColormap *ColorMap; // [RH] Per-sector colormap - BYTE FloorLight, CeilingLight; - BYTE FloorFlags, CeilingFlags; - FTextureID floorpic, ceilingpic; BYTE lightlevel; TObjPtr SoundTarget; diff --git a/src/r_interpolate.cpp b/src/r_interpolate.cpp index 61a896ff9..0b16fd438 100644 --- a/src/r_interpolate.cpp +++ b/src/r_interpolate.cpp @@ -429,12 +429,12 @@ void DSectorPlaneInterpolation::UpdateInterpolation() if (!ceiling) { oldheight = sector->floorplane.d; - oldtexz = sector->floortexz; + oldtexz = sector->GetPlaneTexZ(sector_t::floor); } else { oldheight = sector->ceilingplane.d; - oldtexz = sector->ceilingtexz; + oldtexz = sector->GetPlaneTexZ(sector_t::ceiling); } } @@ -449,12 +449,12 @@ void DSectorPlaneInterpolation::Restore() if (!ceiling) { sector->floorplane.d = bakheight; - sector->floortexz = baktexz; + sector->SetPlaneTexZ(sector_t::floor, baktexz); } else { sector->ceilingplane.d = bakheight; - sector->ceilingtexz = baktexz; + sector->GetPlaneTexZ(sector_t::ceiling, baktexz?; } } @@ -467,24 +467,25 @@ void DSectorPlaneInterpolation::Restore() void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio) { fixed_t *pheight; + int pos; fixed_t *ptexz; if (!ceiling) { pheight = §or->floorplane.d; - ptexz = §or->floortexz; + pos = sector_t::floor; } else { pheight = §or->ceilingplane.d; - ptexz = §or->ceilingtexz; + pos = sector_t::ceiling; } bakheight = *pheight; - baktexz = *ptexz; + baktexz = sector->GetPlaneTexZ(pos); *pheight = oldheight + FixedMul(bakheight - oldheight, smoothratio); - *ptexz = oldtexz + FixedMul(baktexz - oldtexz, smoothratio); + sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio)); } //========================================================================== diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index bae0bb5bb..ecf049750 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -1267,8 +1267,8 @@ void RP_AddLine (seg_t *line) solid = true; } else if ( - (backsector->ceilingpic != skyflatnum || - frontsector->ceilingpic != skyflatnum) + (backsector->GetTexture(sector_t::ceiling) != skyflatnum || + frontsector->GetTexture(sector_t::ceiling) != skyflatnum) // if door is closed because back is shut: && bcz0 <= bfz0 && bcz1 <= bfz1 @@ -1296,8 +1296,8 @@ void RP_AddLine (seg_t *line) solid = false; } else if (backsector->lightlevel != frontsector->lightlevel - || backsector->floorpic != frontsector->floorpic - || backsector->ceilingpic != frontsector->ceilingpic + || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) + || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || curline->sidedef->GetTexture(side_t::mid).isValid() // killough 3/7/98: Take flats offsets into account: @@ -1306,10 +1306,10 @@ void RP_AddLine (seg_t *line) || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling) || backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling) - || backsector->FloorLight != frontsector->FloorLight - || backsector->CeilingLight != frontsector->CeilingLight - || backsector->FloorFlags != frontsector->FloorFlags - || backsector->CeilingFlags != frontsector->CeilingFlags + || backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) + || backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) + || backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor) + || backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling) // [RH] Also consider colormaps || backsector->ColorMap != frontsector->ColorMap diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 8be003d53..28e376c7d 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -144,7 +144,7 @@ inline bool IsFogBoundary (sector_t *front, sector_t *back) { return r_fogboundary && !fixedcolormap && front->ColorMap->Fade && front->ColorMap->Fade != back->ColorMap->Fade && - (front->ceilingpic != skyflatnum || back->ceilingpic != skyflatnum); + (front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum); } //============================================================================= @@ -255,11 +255,11 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) texheight = tex->GetScaledHeight() << FRACBITS; if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - dc_texturemid = MAX (frontsector->floortexz, backsector->floortexz) + texheight; + dc_texturemid = MAX (frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight; } else { - dc_texturemid = MIN (frontsector->ceilingtexz, backsector->ceilingtexz); + dc_texturemid = MIN (frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling)); } { // encapsilate the lifetime of rowoffset @@ -1198,11 +1198,11 @@ void R_NewWall (bool needlights) rowoffset = sidedef->GetTextureYOffset(side_t::mid); if (linedef->flags & ML_DONTPEGBOTTOM) { // bottom of texture at bottom - rw_midtexturemid = frontsector->floortexz + (midtexture->GetHeight() << FRACBITS); + rw_midtexturemid = frontsector->GetPlaneTexZ(sector_t::floor) + (midtexture->GetHeight() << FRACBITS); } else { // top of texture at top - rw_midtexturemid = frontsector->ceilingtexz; + rw_midtexturemid = frontsector->GetPlaneTexZ(sector_t::ceiling); if (rowoffset < 0 && midtexture != NULL) { rowoffset += midtexture->GetHeight() << FRACBITS; @@ -1230,10 +1230,10 @@ void R_NewWall (bool needlights) { // two-sided line // hack to allow height changes in outdoor areas - rw_frontlowertop = frontsector->ceilingtexz; + rw_frontlowertop = frontsector->GetPlaneTexZ(sector_t::ceiling); - if (frontsector->ceilingpic == skyflatnum && - backsector->ceilingpic == skyflatnum) + if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum && + backsector->GetTexture(sector_t::ceiling) == skyflatnum) { if (rw_havehigh) { // front ceiling is above back ceiling @@ -1251,7 +1251,7 @@ void R_NewWall (bool needlights) } // Putting sky ceilings on the front and back of a line alters the way unpegged // positioning works. - rw_frontlowertop = backsector->ceilingtexz; + rw_frontlowertop = backsector->GetPlaneTexZ(sector_t::ceiling); } if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || @@ -1265,7 +1265,7 @@ void R_NewWall (bool needlights) markfloor = rw_mustmarkfloor || backsector->floorplane != frontsector->floorplane || backsector->lightlevel != frontsector->lightlevel - || backsector->floorpic != frontsector->floorpic + || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) // killough 3/7/98: Add checks for (x,y) offsets || backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor) @@ -1275,8 +1275,8 @@ void R_NewWall (bool needlights) // from bleeding through deep water || frontsector->heightsec - || backsector->FloorLight != frontsector->FloorLight - || backsector->FloorFlags != frontsector->FloorFlags + || backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) + || backsector->GetFlags(sector_t::floor) != frontsector->GetFlags(sector_t::floor) // [RH] Add checks for colormaps || backsector->ColorMap != frontsector->ColorMap @@ -1289,12 +1289,12 @@ void R_NewWall (bool needlights) || (sidedef->GetTexture(side_t::mid).isValid() && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX)) ; - markceiling = (frontsector->ceilingpic != skyflatnum || - backsector->ceilingpic != skyflatnum) && + markceiling = (frontsector->GetTexture(sector_t::ceiling) != skyflatnum || + backsector->GetTexture(sector_t::ceiling) != skyflatnum) && (rw_mustmarkceiling || backsector->ceilingplane != frontsector->ceilingplane || backsector->lightlevel != frontsector->lightlevel - || backsector->ceilingpic != frontsector->ceilingpic + || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) // killough 3/7/98: Add checks for (x,y) offsets || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling) @@ -1302,10 +1302,10 @@ void R_NewWall (bool needlights) // killough 4/15/98: prevent 2s normals // from bleeding through fake ceilings - || (frontsector->heightsec && frontsector->ceilingpic != skyflatnum) + || (frontsector->heightsec && frontsector->GetTexture(sector_t::ceiling) != skyflatnum) - || backsector->CeilingLight != frontsector->CeilingLight - || backsector->CeilingFlags != frontsector->CeilingFlags + || backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) + || backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling) // [RH] Add check for colormaps || backsector->ColorMap != frontsector->ColorMap @@ -1328,7 +1328,7 @@ void R_NewWall (bool needlights) rowoffset = sidedef->GetTextureYOffset(side_t::top); if (linedef->flags & ML_DONTPEGTOP) { // top of texture at top - rw_toptexturemid = MulScale16 (frontsector->ceilingtexz - viewz, scale); + rw_toptexturemid = MulScale16 (frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, scale); if (rowoffset < 0 && toptexture != NULL) { rowoffset += toptexture->GetHeight() << FRACBITS; @@ -1336,7 +1336,7 @@ void R_NewWall (bool needlights) } else { // bottom of texture at bottom - rw_toptexturemid = MulScale16 (backsector->ceilingtexz - viewz, scale) + (toptexture->GetHeight() << FRACBITS); + rw_toptexturemid = MulScale16 (backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, scale) + (toptexture->GetHeight() << FRACBITS); } if (toptexture->bWorldPanning) { @@ -1359,7 +1359,7 @@ void R_NewWall (bool needlights) } else { // top of texture at top - rw_bottomtexturemid = backsector->floortexz; + rw_bottomtexturemid = backsector->GetPlaneTexZ(sector_t::floor); if (rowoffset < 0 && bottomtexture != NULL) { rowoffset += bottomtexture->GetHeight() << FRACBITS; @@ -1388,7 +1388,7 @@ void R_NewWall (bool needlights) if (frontsector->floorplane.ZatPoint (viewx, viewy) >= viewz) // above view plane markfloor = false; if (frontsector->ceilingplane.ZatPoint (viewx, viewy) <= viewz && - frontsector->ceilingpic != skyflatnum) // below view plane + frontsector->GetTexture(sector_t::ceiling) != skyflatnum) // below view plane markceiling = false; } @@ -2145,31 +2145,31 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, case RF_RELUPPER: if (curline->linedef->flags & ML_DONTPEGTOP) { - zpos = decal->Z + front->ceilingtexz; + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - zpos = decal->Z + back->ceilingtexz; + zpos = decal->Z + back->GetPlaneTexZ(sector_t::ceiling); } break; case RF_RELLOWER: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->Z + front->ceilingtexz; + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - zpos = decal->Z + back->floortexz; + zpos = decal->Z + back->GetPlaneTexZ(sector_t::floor); } break; case RF_RELMID: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->Z + front->floortexz; + zpos = decal->Z + front->GetPlaneTexZ(sector_t::floor); } else { - zpos = decal->Z + front->ceilingtexz; + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } } diff --git a/src/r_things.cpp b/src/r_things.cpp index 1783532b6..34835254d 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2381,24 +2381,24 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, { topplane = §or->ceilingplane; botplane = &heightsec->ceilingplane; - toppic = sector->ceilingpic; - botpic = heightsec->ceilingpic; + toppic = sector->GetTexture(sector_t::ceiling); + botpic = heightsec->GetTexture(sector_t::ceiling); map = heightsec->ColorMap->Maps; } else if (fakeside == FAKED_BelowFloor) { topplane = &heightsec->floorplane; botplane = §or->floorplane; - toppic = heightsec->floorpic; - botpic = sector->floorpic; + toppic = heightsec->GetTexture(sector_t::floor); + botpic = sector->GetTexture(sector_t::floor); map = heightsec->ColorMap->Maps; } else { topplane = &heightsec->ceilingplane; botplane = &heightsec->floorplane; - toppic = heightsec->ceilingpic; - botpic = heightsec->floorpic; + toppic = heightsec->GetTexture(sector_t::ceiling); + botpic = heightsec->GetTexture(sector_t::floor); map = sector->ColorMap->Maps; } } @@ -2406,8 +2406,8 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, { topplane = §or->ceilingplane; botplane = §or->floorplane; - toppic = sector->ceilingpic; - botpic = sector->floorpic; + toppic = sector->GetTexture(sector_t::ceiling); + botpic = sector->GetTexture(sector_t::floor); map = sector->ColorMap->Maps; }