v3.3.0: removed deadlock-causing sync checks

This commit is contained in:
Evan Debenham
2025-10-30 12:52:28 -04:00
parent 62f5d398ca
commit 658f29fb5b

View File

@@ -172,7 +172,7 @@ public class GameScene extends PixelScene {
private BossHealthBar boss; private BossHealthBar boss;
private GameLog log; private GameLog log;
private static CellSelector cellSelector; private static CellSelector cellSelector;
private Group terrain; private Group terrain;
@@ -209,7 +209,7 @@ public class GameScene extends PixelScene {
{ {
inGameScene = true; inGameScene = true;
} }
@Override @Override
public void create() { public void create() {
@@ -530,7 +530,7 @@ public class GameScene extends PixelScene {
} }
layoutTags(); layoutTags();
switch (InterlevelScene.mode) { switch (InterlevelScene.mode) {
case RESURRECT: case RESURRECT:
Sample.INSTANCE.play(Assets.Sounds.TELEPORT); Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
@@ -831,7 +831,7 @@ public class GameScene extends PixelScene {
public static boolean updateTags = false; public static boolean updateTags = false;
private static float waterOfs = 0; private static float waterOfs = 0;
@Override @Override
public synchronized void update() { public synchronized void update() {
lastOffset = null; lastOffset = null;
@@ -869,7 +869,7 @@ public class GameScene extends PixelScene {
Actor.process(); Actor.process();
} }
}; };
//if cpu cores are limited, game should prefer drawing the current frame //if cpu cores are limited, game should prefer drawing the current frame
if (Runtime.getRuntime().availableProcessors() == 1) { if (Runtime.getRuntime().availableProcessors() == 1) {
actorThread.setPriority(Thread.NORM_PRIORITY - 1); actorThread.setPriority(Thread.NORM_PRIORITY - 1);
@@ -1028,22 +1028,25 @@ public class GameScene extends PixelScene {
public void addCustomWall( CustomTilemap visual){ public void addCustomWall( CustomTilemap visual){
customWalls.add( visual.create() ); customWalls.add( visual.create() );
} }
private synchronized void addHeapSprite( Heap heap ) { //FIXME added a sync check here in v3.2.5, which caused deadlocks
// what I really need to do is have these queue additions that then happen on render thread
// this can also apply to adding mob sprites
private void addHeapSprite( Heap heap ) {
ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class ); ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class );
sprite.revive(); sprite.revive();
sprite.link( heap ); sprite.link( heap );
heaps.add( sprite ); heaps.add( sprite );
} }
private synchronized void addDiscardedSprite( Heap heap ) { private void addDiscardedSprite( Heap heap ) {
heap.sprite = (DiscardedItemSprite)heaps.recycle( DiscardedItemSprite.class ); heap.sprite = (DiscardedItemSprite)heaps.recycle( DiscardedItemSprite.class );
heap.sprite.revive(); heap.sprite.revive();
heap.sprite.link( heap ); heap.sprite.link( heap );
heaps.add( heap.sprite ); heaps.add( heap.sprite );
} }
private synchronized void addBlobSprite( final Blob gas ) { private void addBlobSprite( final Blob gas ) {
if (gas.emitter == null) { if (gas.emitter == null) {
gases.add( new BlobEmitter( gas ) ); gases.add( new BlobEmitter( gas ) );
} }
@@ -1340,7 +1343,7 @@ public class GameScene extends PixelScene {
scene.terrainFeatures.growPlant( cell ); scene.terrainFeatures.growPlant( cell );
} }
} }
public static void discoverTile( int pos, int oldValue ) { public static void discoverTile( int pos, int oldValue ) {
if (scene != null) { if (scene != null) {
scene.tiles.discover( pos, oldValue ); scene.tiles.discover( pos, oldValue );
@@ -1581,7 +1584,7 @@ public class GameScene extends PixelScene {
return wnd; return wnd;
} }
} }
return null; return null;
} }