- 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
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;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].statnum != 200) {
sprite[nSprite].z += z;
int z = sprite[nSprite].z;
if (sprite[nSprite].statnum != 200 && z >= minz && z <= maxz)
{
sprite[nSprite].z = newz;
}
}
}