fix: new world from world portal not updating world ref of IngameRenderer

This commit is contained in:
minjaesong
2023-09-14 13:33:24 +09:00
parent 6772daaf37
commit 1b0b279e3d
4 changed files with 68 additions and 56 deletions

View File

@@ -175,26 +175,29 @@ object IngameRenderer : Disposable {
* - When the game make transition to the new world (advancing to the next level/entering or exiting the room)
*/
fun setRenderedWorld(world: GameWorld) {
try {
if (this.world != world) {
printdbg(this, "Set new RenderedWorld (UUID=${world.worldIndex}) at time ${System.currentTimeMillis()}, called by:")
printStackTrace(this)
try {
if (this.world != world) {
// printdbg(this, "World change detected -- " +
// "old world: ${this.world.hashCode()}, " +
// "new world: ${world.hashCode()}")
// change worlds from internal methods
this.world = world
LightmapRenderer.internalSetWorld(world)
BlocksDrawer.world = world
FeaturesDrawer.world = world
newWorldLoadedLatch = true
}
}
catch (e: UninitializedPropertyAccessException) {
// new init, do nothing
// change worlds from internal methods
this.world = world
LightmapRenderer.internalSetWorld(world)
BlocksDrawer.world = world
FeaturesDrawer.world = world
newWorldLoadedLatch = true
}
}
catch (e: UninitializedPropertyAccessException) {
// new init, do nothing
this.world = world
}
}
private var oldCamX = 0

View File

@@ -52,6 +52,8 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
previewPixmap.setColor(Color.BLACK)
previewPixmap.fill()
IngameRenderer.setRenderedWorld(world)
}
override fun render(delta: Float) {