- Exhumed: changed MoveSectorSprites so it only moves sprites that actually stand on the sector's floor.

Since this had no check for z it even moved things floating above a lift or players hanging over a dropoff with the lift below.
This commit is contained in:
Christoph Oelckers 2021-01-12 20:57:28 +01:00
parent fc11f537f7
commit 91f8df48c6

View file

@ -683,12 +683,18 @@ int CheckSectorSprites(short nSector, int nVal)
// done // done
void MoveSectorSprites(int nSector, int z) void MoveSectorSprites(int nSector, int z)
{ {
int newz = sector[nSector].floorz;
int oldz = newz - z;
int minz = std::min(newz, oldz);
int maxz = std::max(newz, oldz);
int nSprite; int nSprite;
SectIterator it(nSector); SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0) while ((nSprite = it.NextIndex()) >= 0)
{ {
if (sprite[nSprite].statnum != 200) { int z = sprite[nSprite].z;
sprite[nSprite].z += z; if (sprite[nSprite].statnum != 200 && z >= minz && z <= maxz)
{
sprite[nSprite].z = newz;
} }
} }
} }