diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 1585e95248..18a9d68c09 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ March 22, 2008 (Changes by Graf Zahl) +- Added: Sector movement that causes deep water to change its height now + will trigger associated sector actions and adjust the actor's water level. - Fixed: The serializer for side_t::part never read the texture information from a savegame. - Fixed: side_t::StopInterpolation called setinterpolation instead of diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 11a61c4f5b..865ce8025a 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -152,11 +152,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, if (!MoveAttached(crush, move, 0, true)) return crushed; m_Sector->floorplane.d = dest; - flag = P_ChangeSector (m_Sector, crush, move, 0); + flag = P_ChangeSector (m_Sector, crush, move, 0, false); if (flag) { m_Sector->floorplane.d = lastpos; - P_ChangeSector (m_Sector, crush, -move, 0); + P_ChangeSector (m_Sector, crush, -move, 0, true); MoveAttached(crush, -move, 0, false); } else @@ -172,11 +172,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->floorplane.d = movedest; - flag = P_ChangeSector (m_Sector, crush, -speed, 0); + flag = P_ChangeSector (m_Sector, crush, -speed, 0, false); if (flag) { m_Sector->floorplane.d = lastpos; - P_ChangeSector (m_Sector, crush, speed, 0); + P_ChangeSector (m_Sector, crush, speed, 0, true); MoveAttached(crush, speed, 0, false); return crushed; } @@ -210,11 +210,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->floorplane.d = dest; - flag = P_ChangeSector (m_Sector, crush, move, 0); + flag = P_ChangeSector (m_Sector, crush, move, 0, false); if (flag) { m_Sector->floorplane.d = lastpos; - P_ChangeSector (m_Sector, crush, -move, 0); + P_ChangeSector (m_Sector, crush, -move, 0, true); MoveAttached(crush, -move, 0, false); } else @@ -231,7 +231,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->floorplane.d = movedest; // COULD GET CRUSHED - flag = P_ChangeSector (m_Sector, crush, speed, 0); + flag = P_ChangeSector (m_Sector, crush, speed, 0, false); if (flag) { if (crush >= 0 && !hexencrush) @@ -241,7 +241,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, return crushed; } m_Sector->floorplane.d = lastpos; - P_ChangeSector (m_Sector, crush, -speed, 0); + P_ChangeSector (m_Sector, crush, -speed, 0, true); MoveAttached(crush, -speed, 0, false); return crushed; } @@ -276,12 +276,12 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, if (!MoveAttached(crush, move, 1, true)) return crushed; m_Sector->ceilingplane.d = dest; - flag = P_ChangeSector (m_Sector, crush, move, 1); + flag = P_ChangeSector (m_Sector, crush, move, 1, false); if (flag) { m_Sector->ceilingplane.d = lastpos; - P_ChangeSector (m_Sector, crush, -move, 1); + P_ChangeSector (m_Sector, crush, -move, 1, true); MoveAttached(crush, -move, 1, false); } else @@ -297,7 +297,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->ceilingplane.d = movedest; // COULD GET CRUSHED - flag = P_ChangeSector (m_Sector, crush, -speed, 1); + flag = P_ChangeSector (m_Sector, crush, -speed, 1, false); if (flag) { if (crush >= 0 && !hexencrush) @@ -306,7 +306,7 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, return crushed; } m_Sector->ceilingplane.d = lastpos; - P_ChangeSector (m_Sector, crush, speed, 1); + P_ChangeSector (m_Sector, crush, speed, 1, true); MoveAttached(crush, speed, 1, false); return crushed; } @@ -325,11 +325,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->ceilingplane.d = dest; - flag = P_ChangeSector (m_Sector, crush, move, 1); + flag = P_ChangeSector (m_Sector, crush, move, 1, false); if (flag) { m_Sector->ceilingplane.d = lastpos; - P_ChangeSector (m_Sector, crush, move, 1); + P_ChangeSector (m_Sector, crush, move, 1, true); MoveAttached(crush, move, 1, false); } else @@ -344,11 +344,11 @@ DMover::EResult DMover::MovePlane (fixed_t speed, fixed_t dest, int crush, m_Sector->ceilingplane.d = movedest; - flag = P_ChangeSector (m_Sector, crush, speed, 1); + flag = P_ChangeSector (m_Sector, crush, speed, 1, false); if (flag) { m_Sector->ceilingplane.d = lastpos; - P_ChangeSector (m_Sector, crush, -speed, 1); + P_ChangeSector (m_Sector, crush, -speed, 1, true); MoveAttached(crush, -speed, 1, false); return crushed; } diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index a1ca695ab8..4388c22a90 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -66,7 +66,7 @@ bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling) for(unsigned i = 0; i < scrollplane.AttachedSectors.Size(); i++) { - res |= P_ChangeSector(scrollplane.AttachedSectors[i], crush, move, 2); + res |= P_ChangeSector(scrollplane.AttachedSectors[i], crush, move, 2, true); } return !res; } diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 13b438ed97..cf1fdfb683 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -1112,7 +1112,7 @@ void DWaggleBase::DoWaggle (bool ceiling) dist = FixedMul (m_OriginalDist - plane->d, plane->ic); *texz -= plane->HeightDiff (m_OriginalDist); plane->d = m_OriginalDist; - P_ChangeSector (m_Sector, true, dist, ceiling); + P_ChangeSector (m_Sector, true, dist, ceiling, false); if (ceiling) { m_Sector->ceilingdata = NULL; @@ -1144,7 +1144,7 @@ void DWaggleBase::DoWaggle (bool ceiling) FixedMul (FloatBobOffsets[(m_Accumulator>>FRACBITS)&63], m_Scale)); *texz += plane->HeightDiff (dist); dist = plane->HeightDiff (dist); - P_ChangeSector (m_Sector, true, dist, ceiling); + P_ChangeSector (m_Sector, true, dist, ceiling, false); } //========================================================================== diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index b24ff3d159..ec59e8e9d6 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -94,7 +94,7 @@ static bool MoveCeiling(sector_t *sector, int crush, fixed_t move) sector->ceilingplane.ChangeHeight (move); sector->ceilingtexz += move; - if (P_ChangeSector(sector, crush, move, 1)) return false; + 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 | @@ -109,7 +109,7 @@ static bool MoveFloor(sector_t *sector, int crush, fixed_t move) sector->floorplane.ChangeHeight (move); sector->floortexz += move; - if (P_ChangeSector(sector, crush, move, 0)) return false; + 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 | diff --git a/src/p_local.h b/src/p_local.h index 3fe53764f0..04146959ad 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -302,7 +302,7 @@ bool P_UsePuzzleItem (AActor *actor, int itemType); void PIT_ThrustSpike (AActor *actor); void P_FindFloorCeiling (AActor *actor); -bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil); +bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset); extern AActor* linetarget; // who got hit (or NULL) diff --git a/src/p_map.cpp b/src/p_map.cpp index b904827242..24970f9091 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4406,7 +4406,7 @@ void PIT_CeilingRaise (AActor *thing, FChangePosition *cpos) // //============================================================================= -bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil) +bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil, bool isreset) { FChangePosition cpos; void (*iterator)(AActor *, FChangePosition *); @@ -4478,6 +4478,37 @@ bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil) } } while (n); // repeat from scratch until all things left are marked valid + if (!cpos.nofit && !isreset /* && sector->MoreFlags & (SECF_UNDERWATERMASK)*/) + { + // If this is a control sector for a deep water transfer, all actors in affected + // sectors need to have their waterlevel information updated and if applicable, + // execute appropriate sector actions. + // Only check if the sector move was successful. + TArray & secs = sector->e->FakeFloor.Sectors; + for(unsigned i = 0; i < secs.Size(); i++) + { + sector_t * s = secs[i]; + + for (n = s->touching_thinglist; n; n = n->m_snext) + n->visited = false; + + do + { + for (n = s->touching_thinglist; n; n = n->m_snext) // go through list + { + if (!n->visited && n->m_thing->Sector == s) // unprocessed thing found + { + n->visited = true; // mark thing as processed + + n->m_thing->UpdateWaterLevel(n->m_thing->z, false); + P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->z - amt); + } + } + } while (n); // repeat from scratch until all things left are marked valid + } + + } + return cpos.nofit; } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index b6acb28d97..a18bdee8ec 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -398,7 +398,8 @@ void P_SerializeWorld (FArchive &arc) void extsector_t::Serialize(FArchive &arc) { - arc << Midtex.Floor.AttachedLines + arc << FakeFloor.Sectors + << Midtex.Floor.AttachedLines << Midtex.Floor.AttachedSectors << Midtex.Ceiling.AttachedLines << Midtex.Ceiling.AttachedSectors diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e56393b760..c5beb64584 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -980,6 +980,7 @@ void P_SpawnSpecials (void) for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;) { sectors[s].heightsec = sec; + sec->e->FakeFloor.Sectors.Push(§ors[s]); } break; diff --git a/src/r_defs.h b/src/r_defs.h index 8cd5497dd5..b06b8679d2 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -279,6 +279,12 @@ struct FLinkedSector struct extsector_t { + // Boom sector transfer information + struct fakefloor + { + TArray Sectors; + } FakeFloor; + // 3DMIDTEX information struct midtex { diff --git a/src/version.h b/src/version.h index 8bf3edc215..6dd8175cea 100644 --- a/src/version.h +++ b/src/version.h @@ -75,7 +75,7 @@ // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 832 +#define MINSAVEVER 836 #if SVN_REVISION_NUMBER < MINSAVEVER // Never write a savegame with a version lower than what we need