- Added: Sector movement that causes deep water to change its height now

will trigger associated sector actions and adjust the actor's water level.


SVN r836 (trunk)
This commit is contained in:
Christoph Oelckers 2008-03-22 12:17:52 +00:00
parent 9adf1d4ddc
commit 60ad26b231
11 changed files with 66 additions and 25 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}
//==========================================================================

View File

@ -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 |

View File

@ -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)

View File

@ -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<sector_t *> & 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;
}

View File

@ -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

View File

@ -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(&sectors[s]);
}
break;

View File

@ -279,6 +279,12 @@ struct FLinkedSector
struct extsector_t
{
// Boom sector transfer information
struct fakefloor
{
TArray<sector_t *> Sectors;
} FakeFloor;
// 3DMIDTEX information
struct midtex
{

View File

@ -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