From f3f209160e03e273c84f6587eb8598ccf9e7058d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 17 Sep 2009 10:40:38 +0000 Subject: [PATCH] - Renamed plane flags from SECF_* to PLANEF_*. - Changed Heretic's plat raise type to use a flag to block further sector movement instead of keeping the dead thinker around. SVN r1853 (trunk) --- docs/rh-log.txt | 7 ++++++- src/p_buildmap.cpp | 4 ++-- src/p_ceiling.cpp | 2 +- src/p_doors.cpp | 4 ++-- src/p_floor.cpp | 17 +++++++++-------- src/p_linkedsectors.cpp | 3 ++- src/p_pillar.cpp | 2 +- src/p_plats.cpp | 7 +++++-- src/p_sectors.cpp | 9 +++++++++ src/p_spec.cpp | 4 ++-- src/p_udmf.cpp | 8 ++++---- src/r_bsp.cpp | 4 ++-- src/r_defs.h | 5 ++++- 13 files changed, 49 insertions(+), 27 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 2272627fe1..fc665a50ce 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +September 17, 2009 (Changes by Graf Zahl) +- Renamed plane flags from SECF_* to PLANEF_*. +- Changed Heretic's plat raise type to use a flag to block further sector movement + instead of keeping the dead thinker around to block the sector. + September 16, 2009 (Changes by Graf Zahl) - Fixed: A_LookEx did not work for monsters having the MF_NOSECTOR flag. - Fixed: The deprecated flag handler for the old bounce flags needs to clear @@ -16897,7 +16902,7 @@ November 14, 2000 into c_cvars.cpp. Virtual inline functions are not inlined and cause the function to be generated for every source file the class is used in. - Fixed bug with Transfer_CeilingLight special. I was or'ing CeilingLight - with SECF_ABSLIGHTING instead of CeilingFlags. + with PLANEF_ABSLIGHTING instead of CeilingFlags. November 11, 2000 - Slopes don't work in mirrors. :-( diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 4e44e1c26d..a53491370f 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -381,7 +381,7 @@ static void LoadSectors (sectortype *bsec) sec->SetXOffset(sector_t::floor, (bsec->floorxpanning << FRACBITS) + (32 << FRACBITS)); sec->SetYOffset(sector_t::floor, bsec->floorypanning << FRACBITS); sec->SetPlaneLight(sector_t::floor, SHADE2LIGHT (bsec->floorshade)); - sec->ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); + sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingz) << 8)); sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); @@ -399,7 +399,7 @@ static void LoadSectors (sectortype *bsec) sec->SetXOffset(sector_t::ceiling, (bsec->ceilingxpanning << FRACBITS) + (32 << FRACBITS)); sec->SetYOffset(sector_t::ceiling, bsec->ceilingypanning << FRACBITS); sec->SetPlaneLight(sector_t::ceiling, SHADE2LIGHT (bsec->ceilingshade)); - sec->ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); + sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING); sec->lightlevel = (sec->GetPlaneLight(sector_t::floor) + sec->GetPlaneLight(sector_t::ceiling)) / 2; diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 4da11fd045..12f957b47a 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -232,7 +232,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, sec = §ors[secnum]; manual_ceiling: // if ceiling already moving, don't start a second function on it - if (sec->ceilingdata) + if (sec->PlaneMoving(sector_t::ceiling)) { if (!manual) continue; diff --git a/src/p_doors.cpp b/src/p_doors.cpp index 090065fb44..c77ded90db 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -394,7 +394,7 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, secnum = int(sec-sectors); // if door already has a thinker, use it - if (sec->ceilingdata) + if (sec->PlaneMoving(sector_t::ceiling)) { if (sec->ceilingdata->IsKindOf (RUNTIME_CLASS(DDoor))) { @@ -447,7 +447,7 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, { sec = §ors[secnum]; // if the ceiling already moving, don't start the door action - if (sec->ceilingdata) + if (sec->PlaneMoving(sector_t::ceiling)) continue; if (new DDoor (sec, type, speed, delay, lightTag)) diff --git a/src/p_floor.cpp b/src/p_floor.cpp index bd489d525e..7ab77b026b 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -377,7 +377,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, manual_floor: // ALREADY MOVING? IF SO, KEEP GOING... - if (sec->floordata) + if (sec->PlaneMoving(sector_t::floor)) { if (manual) continue; @@ -748,7 +748,7 @@ manual_stair: // ALREADY MOVING? IF SO, KEEP GOING... //jff 2/26/98 add special lockout condition to wait for entire //staircase to build before retriggering - if (sec->floordata || sec->stairlock) + if (sec->PlaneMoving(sector_t::floor) || sec->stairlock) { if (!manual) continue; @@ -800,7 +800,7 @@ manual_stair: // if sector's floor already moving, look for another //jff 2/26/98 special lockout condition for retriggering - if (tsec->floordata || tsec->stairlock) + if (tsec->PlaneMoving(sector_t::floor) || tsec->stairlock) { prev = sec; sec = tsec; @@ -833,7 +833,7 @@ manual_stair: // if sector's floor already moving, look for another //jff 2/26/98 special lockout condition for retriggering - if (tsec->floordata || tsec->stairlock) + if (tsec->PlaneMoving(sector_t::floor) || tsec->stairlock) continue; ok = true; @@ -917,7 +917,7 @@ bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) s1 = §ors[secnum]; // s1 is pillar's sector // ALREADY MOVING? IF SO, KEEP GOING... - if (s1->floordata) + if (s1->PlaneMoving(sector_t::floor)) continue; rtn = true; @@ -925,7 +925,7 @@ bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) if (!s2) // note lowest numbered line around continue; // pillar must be two-sided - if (s2->floordata) + if (s2->PlaneMoving(sector_t::floor)) continue; for (i = 0; i < s2->linecount; i++) @@ -1007,7 +1007,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, sec = §ors[secnum]; // If either floor or ceiling is already activated, skip it - if (sec->floordata || sec->ceilingdata) //jff 2/22/98 + if (sec->PlaneMoving(sector_t::floor) || sec->ceilingdata) //jff 2/22/98 continue; // create and initialize new elevator thinker @@ -1225,7 +1225,8 @@ bool EV_StartWaggle (int tag, int height, int speed, int offset, while ((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sector = §ors[sectorIndex]; - if ((!ceiling && sector->floordata) || (ceiling && sector->ceilingdata)) + if ((!ceiling && sector->PlaneMoving(sector_t::floor)) || + (ceiling && sector->PlaneMoving(sector_t::ceiling))) { // Already busy with another thinker continue; } diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index 4fa4a699d2..b932eb0aaf 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -300,7 +300,8 @@ bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype) int param = movetype; // can't be done if the control sector is moving. - if ((ceiling && control->ceilingdata) || (!ceiling && control->floordata)) return false; + if ((ceiling && control->PlaneMoving(sector_t::ceiling)) || + (!ceiling && control->PlaneMoving(sector_t::floor))) return false; // Make sure we have only valid combinations movetype &= LINK_FLAGMASK; diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index a9135cefb0..f20dc1ef4c 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -205,7 +205,7 @@ bool EV_DoPillar (DPillar::EPillar type, int tag, fixed_t speed, fixed_t height, { sector_t *sec = §ors[secnum]; - if (sec->floordata || sec->ceilingdata) + if (sec->PlaneMoving(sector_t::floor) || sec->PlaneMoving(sector_t::ceiling)) continue; fixed_t flor, ceil; diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 9d64e1145d..962447e491 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -91,7 +91,10 @@ void DPlat::Tick () switch (m_Type) { case platRaiseAndStayLockout: - break; + // Instead of keeping the dead thinker like Heretic did let's + // better use a flag to avoid problems elsewhere. For example, + // keeping the thinker would make tagwait wait indefinitely. + m_Sector->planes[sector_t::floor].Flags |= PLANEF_BLOCKED; case platRaiseAndStay: case platDownByValue: case platDownWaitUpStay: @@ -236,7 +239,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, int height, sec = §ors[secnum]; manual_plat: - if (sec->floordata) + if (sec->PlaneMoving(sector_t::floor)) { if (!manual) continue; diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index dd98faa25a..0e3c88b788 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -761,3 +761,12 @@ void sector_t::ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy) co ox = fixed_t(bestx); oy = fixed_t(besty); } + + +bool sector_t::PlaneMoving(int pos) +{ + if (pos == floor) + return (floordata != NULL || (planes[floor].Flags & PLANEF_BLOCKED)); + else + return (ceilingdata != NULL || (planes[ceiling].Flags & PLANEF_BLOCKED)); +} diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e1d4868697..8f092fc9dc 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -692,12 +692,12 @@ DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor) if (copyFloor) { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); + sectors[secnum].ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); } else { for (secnum = -1; (secnum = P_FindSectorFromTag (target, secnum)) >= 0; ) - sectors[secnum].ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); + sectors[secnum].ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING); } ChangeStatNum (STAT_LIGHTTRANSFER); } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index b9c41b7245..79b64a1de5 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1125,13 +1125,13 @@ struct UDMFParser continue; case NAME_Lightfloorabsolute: - if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, SECF_ABSLIGHTING); - else sec->ChangeFlags(sector_t::floor, SECF_ABSLIGHTING, 0); + if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); + else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0); continue; case NAME_Lightceilingabsolute: - if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, SECF_ABSLIGHTING); - else sec->ChangeFlags(sector_t::ceiling, SECF_ABSLIGHTING, 0); + if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING); + else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0); continue; case NAME_Gravity: diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index bf09603e3d..a1f6f60988 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -270,7 +270,7 @@ void R_ClearClipSegs (short left, short right) int GetFloorLight (const sector_t *sec) { - if (sec->GetFlags(sector_t::floor) & SECF_ABSLIGHTING) + if (sec->GetFlags(sector_t::floor) & PLANEF_ABSLIGHTING) { return sec->GetPlaneLight(sector_t::floor); } @@ -282,7 +282,7 @@ int GetFloorLight (const sector_t *sec) int GetCeilingLight (const sector_t *sec) { - if (sec->GetFlags(sector_t::ceiling) & SECF_ABSLIGHTING) + if (sec->GetFlags(sector_t::ceiling) & PLANEF_ABSLIGHTING) { return sec->GetPlaneLight(sector_t::ceiling); } diff --git a/src/r_defs.h b/src/r_defs.h index cf287de202..88f4e98a82 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -299,7 +299,8 @@ inline FArchive &operator<< (FArchive &arc, secplane_t &plane) // Ceiling/floor flags enum { - SECF_ABSLIGHTING = 1 // floor/ceiling light is absolute, not relative + PLANEF_ABSLIGHTING = 1, // floor/ceiling light is absolute, not relative + PLANEF_BLOCKED = 2 // can not be moved anymore. }; // Internal sector flags @@ -605,6 +606,8 @@ struct sector_t return lightlevel; } + bool PlaneMoving(int pos); + // Member variables fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }