Reimplement reverted commit but with some important safety checks.

This commit is contained in:
Mari the Deer 2023-07-29 14:02:52 +02:00
commit c5e7c0edb8
17 changed files with 139 additions and 228 deletions

View file

@ -178,14 +178,18 @@ extend Class SWWMHandler
// copies the floatbob of overlapping identical items, so it doesn't look weird
private void CopyFloatBob( Actor a )
{
let bt = BlockThingsIterator.Create(a,16);
while ( bt.Next() )
bool breakout = false;
foreach ( s:level.Sectors )
{
let t = bt.Thing;
if ( !t || (t == a) || !(t is 'Inventory') || !(t.spawnpoint ~== a.spawnpoint) ) continue;
a.floatbobphase = t.floatbobphase;
a.angle = t.angle; // also copy angle
break;
for ( Actor t=s.thinglist; t; t=t.snext )
{
if ( (t == a) || !(t is 'Inventory') || !(t.spawnpoint ~== a.spawnpoint) ) continue;
a.floatbobphase = t.floatbobphase;
a.angle = t.angle; // also copy angle
breakout = true;
break;
}
if ( breakout ) break;
}
}