diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0f7f719205..06c4b04dbe 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ November 24, 2009 (Changes by Graf Zahl) +- Fixed: EV_DoDonut, EV_DoElevator and EV_StartWaggle did not to any 0-tag + checks. - Fixed: Doom line type 44 (lower ceiling to 8 above floor) must halt movement if blocked which essentially means it acts like a Hexen-style crusher. diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 4e2afe1091..0b9a634e8d 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -770,7 +770,7 @@ manual_stair: // //========================================================================== -bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) +bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed) { sector_t* s1; sector_t* s2; @@ -781,13 +781,24 @@ bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) DFloor* floor; vertex_t* spot; fixed_t height; + bool manual = false; secnum = -1; rtn = false; + + if (tag == 0) + { + if (!line || !(s1 = line->backsector)) + return rtn; + manual = true; + goto manual_donut; + } + while ((secnum = P_FindSectorFromTag(tag,secnum)) >= 0) { s1 = §ors[secnum]; // s1 is pillar's sector - + +manual_donut: // ALREADY MOVING? IF SO, KEEP GOING... if (s1->PlaneMoving(sector_t::floor)) continue; @@ -834,6 +845,7 @@ bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed) floor->StartFloorSound (); break; } + if (manual) break; } return rtn; } @@ -989,17 +1001,28 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, fixed_t floorheight, ceilingheight; fixed_t newheight; vertex_t* spot; + bool manual = false; if (!line && (elevtype == DElevator::elevateCurrent)) return false; secnum = -1; rtn = false; + + if (tag == 0) + { + if (!line || !(sec = line->backsector)) + return rtn; + manual = true; + goto manual_elevator; + } + + // act on all sectors with the same tag as the triggering linedef while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0) { sec = §ors[secnum]; - +manual_elevator: // If either floor or ceiling is already activated, skip it if (sec->PlaneMoving(sector_t::floor) || sec->ceilingdata) //jff 2/22/98 continue; @@ -1060,6 +1083,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, elevator->m_CeilingDestDist = sec->ceilingplane.PointToDist (sec->soundorg[0], sec->soundorg[1], ceilingheight - height); break; } + if (manual) break; } return rtn; } @@ -1307,19 +1331,31 @@ void DCeilingWaggle::Tick () // //========================================================================== -bool EV_StartWaggle (int tag, int height, int speed, int offset, +bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling) { int sectorIndex; sector_t *sector; DWaggleBase *waggle; bool retCode; + bool manual = false; retCode = false; sectorIndex = -1; + + if (tag == 0) + { + if (!line || !(sector = line->backsector)) + return retCode; + manual = true; + goto manual_waggle; + } + + while ((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sector = §ors[sectorIndex]; +manual_waggle: if ((!ceiling && sector->PlaneMoving(sector_t::floor)) || (ceiling && sector->PlaneMoving(sector_t::ceiling))) { // Already busy with another thinker @@ -1344,6 +1380,7 @@ bool EV_StartWaggle (int tag, int height, int speed, int offset, /(TICRATE+((3*TICRATE)*height)/255); waggle->m_Ticker = timer ? timer*TICRATE : -1; waggle->m_State = WGLSTATE_EXPAND; + if (manual) break; } return retCode; } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index e5d2c78fcd..7417ebbefd 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -341,13 +341,13 @@ FUNC(LS_Floor_LowerToLowestTxTy) FUNC(LS_Floor_Waggle) // Floor_Waggle (tag, amplitude, frequency, delay, time) { - return EV_StartWaggle (arg0, arg1, arg2, arg3, arg4, false); + return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, false); } FUNC(LS_Ceiling_Waggle) // Ceiling_Waggle (tag, amplitude, frequency, delay, time) { - return EV_StartWaggle (arg0, arg1, arg2, arg3, arg4, true); + return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, true); } FUNC(LS_Floor_TransferTrigger) @@ -365,7 +365,7 @@ FUNC(LS_Floor_TransferNumeric) FUNC(LS_Floor_Donut) // Floor_Donut (pillartag, pillarspeed, slimespeed) { - return EV_DoDonut (arg0, SPEED(arg1), SPEED(arg2)); + return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2)); } FUNC(LS_Generic_Floor) diff --git a/src/p_spec.h b/src/p_spec.h index b47f9aa9d1..ca0d9492c5 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -825,7 +825,7 @@ protected: friend bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, fixed_t speed, fixed_t height, int crush, int change, bool hexencrush); friend bool EV_FloorCrushStop (int tag); - friend bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed); + friend bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); private: DFloor (); }; @@ -836,7 +836,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, fixed_t speed, fixed_t height, int crush, int change, bool hexencrush); bool EV_FloorCrushStop (int tag); -bool EV_DoDonut (int tag, fixed_t pillarspeed, fixed_t slimespeed); +bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); inline FArchive &operator<< (FArchive &arc, DFloor::EFloor &type) { @@ -915,7 +915,7 @@ protected: int m_State; TObjPtr m_Interpolation; - friend bool EV_StartWaggle (int tag, int height, int speed, + friend bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling); void DoWaggle (bool ceiling); @@ -923,7 +923,7 @@ protected: DWaggleBase (); }; -bool EV_StartWaggle (int tag, int height, int speed, +bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling); class DFloorWaggle : public DWaggleBase