From 4837962ff5f771e53541e37eee1092407fce26e3 Mon Sep 17 00:00:00 2001 From: Song Minjae Date: Fri, 30 Dec 2016 18:07:36 +0900 Subject: [PATCH] issue #7 implemented Former-commit-id: e63de56e81e19c842c519c77019b9750d751851e Former-commit-id: 6b018d6ac3bb471d5997c1eece4485f967f82ded --- src/net/torvald/terrarum/StateInGame.kt | 78 +++++++++++++------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/net/torvald/terrarum/StateInGame.kt b/src/net/torvald/terrarum/StateInGame.kt index 347dcb505..20f23fb97 100644 --- a/src/net/torvald/terrarum/StateInGame.kt +++ b/src/net/torvald/terrarum/StateInGame.kt @@ -80,8 +80,6 @@ constructor() : BasicGameState() { private val useShader: Boolean = false private val shaderProgram = 0 - private val CORES = ThreadPool.POOL_SIZE - val KEY_LIGHTMAP_RENDER = Key.F7 val KEY_LIGHTMAP_SMOOTH = Key.F8 @@ -94,6 +92,9 @@ constructor() : BasicGameState() { private val UI_INVENTORY_PLAYER = "uiInventoryPlayer" private val UI_INVENTORY_ANON = "uiInventoryAnon" + val paused: Boolean + get() = consoleHandler.isOpened + @Throws(SlickException::class) override fun init(gameContainer: GameContainer, stateBasedGame: StateBasedGame) { // state init code. Executed before the game goes into any "state" in states in StateBasedGame.java @@ -175,48 +176,51 @@ constructor() : BasicGameState() { setAppTitle() - /////////////////////////// - // world-related updates // - /////////////////////////// - world.updateWorldTime(delta) - WorldSimulator(world, player, delta) - WeatherMixer.update(gc, delta) - TileStats.update() - if (!(CommandDict["setgl"] as SetGlobalLightOverride).lightOverride) - world.globalLight = constructRGBFromInt( - WeatherMixer.globalLightNow.redByte, - WeatherMixer.globalLightNow.greenByte, - WeatherMixer.globalLightNow.blueByte - ) + if (!paused) { + + /////////////////////////// + // world-related updates // + /////////////////////////// + world.updateWorldTime(delta) + WorldSimulator(world, player, delta) + WeatherMixer.update(gc, delta) + TileStats.update() + if (!(CommandDict["setgl"] as SetGlobalLightOverride).lightOverride) + world.globalLight = constructRGBFromInt( + WeatherMixer.globalLightNow.redByte, + WeatherMixer.globalLightNow.greenByte, + WeatherMixer.globalLightNow.blueByte + ) - /////////////////////////// - // input-related updates // - /////////////////////////// - GameController.processInput(gc, delta, gc.input) - uiContainer.forEach { it.processInput(gc, delta, gc.input) } + /////////////////////////// + // input-related updates // + /////////////////////////// + GameController.processInput(gc, delta, gc.input) + uiContainer.forEach { it.processInput(gc, delta, gc.input) } - //////////////////////////// - // camera-related updates // - //////////////////////////// - FeaturesDrawer.update(gc, delta) - MapCamera.update() - TilesDrawer.update() + //////////////////////////// + // camera-related updates // + //////////////////////////// + FeaturesDrawer.update(gc, delta) + MapCamera.update() + TilesDrawer.update() - /////////////////////////// - // actor-related updates // - /////////////////////////// - repossessActor() + /////////////////////////// + // actor-related updates // + /////////////////////////// + repossessActor() - // determine whether the inactive actor should be re-active - wakeDormantActors() - // determine whether the actor should be active or dormant - KillOrKnockdownActors() - updateActors(gc, delta) - // TODO thread pool(?) - CollisionSolver.process() + // determine whether the inactive actor should be re-active + wakeDormantActors() + // determine whether the actor should be active or dormant + KillOrKnockdownActors() + updateActors(gc, delta) + // TODO thread pool(?) + CollisionSolver.process() + } ////////////////////////