mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
fixed a "bug" that assumed the framerates are normally distributed
This commit is contained in:
@@ -11,8 +11,7 @@ import com.badlogic.gdx.utils.Disposable
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.Terrarum.ingame
|
||||
import net.torvald.terrarum.App.measureDebugTime
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
@@ -222,7 +221,7 @@ object IngameRenderer : Disposable {
|
||||
this.player = player
|
||||
|
||||
|
||||
if (!gamePaused || newWorldLoadedLatch) {
|
||||
if ((!gamePaused && !App.isScreenshotRequested()) || newWorldLoadedLatch) {
|
||||
measureDebugTime("Renderer.LightRun*") {
|
||||
// recalculate for even frames, or if the sign of the cam-x changed
|
||||
if (App.GLOBAL_RENDER_TIMER % 3 == 0 || Math.abs(WorldCamera.x - oldCamX) >= world.width * 0.85f * TILE_SIZEF || newWorldLoadedLatch) {
|
||||
|
||||
@@ -742,6 +742,8 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
private var oldCamX = 0
|
||||
private var oldPlayerX = 0.0
|
||||
|
||||
private var deltaTeeCleared = false
|
||||
|
||||
/**
|
||||
* Ingame (world) related updates; UI update must go to renderGame()
|
||||
*/
|
||||
@@ -756,7 +758,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
// will also queue up the block/wall/wire placed events
|
||||
ingameController.update()
|
||||
|
||||
if (!paused || newWorldLoadedLatch) {
|
||||
if ((!paused && !App.isScreenshotRequested()) || newWorldLoadedLatch) {
|
||||
|
||||
//hypothetical_input_capturing_function_if_you_finally_decided_to_forgo_gdx_input_processor_and_implement_your_own_to_synchronise_everything()
|
||||
|
||||
@@ -822,11 +824,17 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
if (KeyToggler.isOn(App.getConfigInt("debug_key_deltat_benchmark"))) {
|
||||
deltaTeeBenchmarks.appendHead(1f / Gdx.graphics.deltaTime)
|
||||
|
||||
if (deltaTeeCleared) deltaTeeCleared = false
|
||||
}
|
||||
else if (!deltaTeeCleared) {
|
||||
deltaTeeCleared = true
|
||||
deltaTeeBenchmarks.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!paused || newWorldLoadedLatch) {
|
||||
if ((!paused && !App.isScreenshotRequested()) || newWorldLoadedLatch) {
|
||||
// completely consume block change queues because why not
|
||||
terrainChangeQueue.clear()
|
||||
wallChangeQueue.clear()
|
||||
@@ -858,7 +866,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
//println("paused = $paused")
|
||||
|
||||
if (!paused && newWorldLoadedLatch) newWorldLoadedLatch = false
|
||||
if ((!paused && !App.isScreenshotRequested()) && newWorldLoadedLatch) newWorldLoadedLatch = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user