diff --git a/assets/graphics/fonts/terrarum-sans-bitmap/latinExt_additional_variable.tga b/assets/graphics/fonts/terrarum-sans-bitmap/latinExt_additional_variable.tga new file mode 100644 index 000000000..370f06d47 --- /dev/null +++ b/assets/graphics/fonts/terrarum-sans-bitmap/latinExt_additional_variable.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:552cb0759613eb9dd72b672974f06d1969b037669abb5350869d08a8c0482cc8 +size 327724 diff --git a/assets/graphics/test_loading_arrow_atlas.tga b/assets/graphics/test_loading_arrow_atlas.tga new file mode 100644 index 000000000..d8c5fd252 --- /dev/null +++ b/assets/graphics/test_loading_arrow_atlas.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fda36e66bfb1d4e11e0d79e0a35f6c080a6f6baaed998805421453ddd84d716 +size 4532 diff --git a/src/net/torvald/terrarum/Ingame.kt b/src/net/torvald/terrarum/Ingame.kt index b593a89ec..088dfbc96 100644 --- a/src/net/torvald/terrarum/Ingame.kt +++ b/src/net/torvald/terrarum/Ingame.kt @@ -80,7 +80,6 @@ class Ingame(val batch: SpriteBatch) : Screen { private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888 private val lightFBOformat = Pixmap.Format.RGB888 - private val lightUvFBOformat = Pixmap.Format.RGB888 var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true) var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true) @@ -88,9 +87,6 @@ class Ingame(val batch: SpriteBatch) : Screen { // RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit var lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) var lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) - // A elements of Lightmap for UV Light Vec4(A, A, A, A) 8-bit - //var lightmapUvFboA = FrameBuffer(lightUvFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) - //var lightmapUvFboB = FrameBuffer(lightUvFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) init { @@ -146,6 +142,11 @@ class Ingame(val batch: SpriteBatch) : Screen { private lateinit var updateThreadWrapper: Thread //private val ingameDrawThread: ThreadIngameDraw // draw must be on the main thread + + private var gameFullyLoaded = false + + + ////////////// // GDX code // ////////////// @@ -186,9 +187,22 @@ class Ingame(val batch: SpriteBatch) : Screen { } + lateinit var gameLoadMode: GameLoadMode + lateinit var gameLoadInfoPayload: Any + + enum class GameLoadMode { + CREATE_NEW, LOAD_FROM + } + override fun show() { - // Set up viewport on first load initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) + + // gameLoadMode and gameLoadInfoPayload must be set beforehand!! + + when (gameLoadMode) { + GameLoadMode.CREATE_NEW -> enter(gameLoadInfoPayload as NewWorldParameters) + GameLoadMode.LOAD_FROM -> enter(gameLoadInfoPayload as GameSaveData) + } } data class GameSaveData( @@ -197,7 +211,21 @@ class Ingame(val batch: SpriteBatch) : Screen { val realGamePlayer: ActorHumanoid ) - fun enter(gameSaveData: GameSaveData) { + data class NewWorldParameters( + val width: Int, + val height: Int, + val worldGenSeed: Long + // other worldgen options + ) + + /** + * Init instance by loading saved world + */ + private fun enter(gameSaveData: GameSaveData) { + if (gameFullyLoaded) { + Error("You are doing things horribly wrong, fucknugget.") + } + world = gameSaveData.world historicalFigureIDBucket = gameSaveData.historicalFigureIDBucket playableActorDelegate = PlayableActorDelegate(gameSaveData.realGamePlayer) @@ -206,21 +234,22 @@ class Ingame(val batch: SpriteBatch) : Screen { initGame() + + gameFullyLoaded = true } /** - * Create new world + * Init instance by creating new world */ - fun enter() { + private fun enter(worldParams: NewWorldParameters) { // init map as chosen size - world = GameWorld(8192, 2048) + world = GameWorld(worldParams.width, worldParams.height) // generate terrain for the map WorldGenerator.attachMap(world) - //WorldGenerator.SEED = 0x51621D2 - WorldGenerator.SEED = HQRNG().nextLong() + WorldGenerator.SEED = worldParams.worldGenSeed WorldGenerator.generateMap() @@ -1463,10 +1492,6 @@ class Ingame(val batch: SpriteBatch) : Screen { lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) lightmapFboB.dispose() lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) - //lightmapUvFboA.dispose() - //lightmapUvFboA = FrameBuffer(lightUvFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) - //lightmapUvFboB.dispose() - //lightmapUvFboB = FrameBuffer(lightUvFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true) // Set up viewport when window is resized @@ -1491,7 +1516,9 @@ class Ingame(val batch: SpriteBatch) : Screen { - LightmapRenderer.fireRecalculateEvent() + if (gameFullyLoaded) { + LightmapRenderer.fireRecalculateEvent() + } } override fun dispose() { diff --git a/src/net/torvald/terrarum/LoadScreen.kt b/src/net/torvald/terrarum/LoadScreen.kt new file mode 100644 index 000000000..dc68a10fb --- /dev/null +++ b/src/net/torvald/terrarum/LoadScreen.kt @@ -0,0 +1,32 @@ +package net.torvald.terrarum + +import com.badlogic.gdx.Screen +import com.badlogic.gdx.ScreenAdapter +import net.torvald.dataclass.HistoryArray + +/** + * Created by minjaesong on 2017-07-13. + */ +object LoadScreen : ScreenAdapter() { + + private lateinit var actualSceneToBeLoaded: Screen + private lateinit var sceneLoadingThread: Thread + + private val messages = HistoryArray(20) + + + + + + fun setMessage(msg: String) { + messages.add(msg) + } + + override fun show() { + + } + + override fun render(delta: Float) { + + } +} \ No newline at end of file diff --git a/src/net/torvald/terrarum/Terrarum.kt b/src/net/torvald/terrarum/Terrarum.kt index 2f266228c..fd4cf69c8 100644 --- a/src/net/torvald/terrarum/Terrarum.kt +++ b/src/net/torvald/terrarum/Terrarum.kt @@ -1,6 +1,7 @@ package net.torvald.terrarum import com.badlogic.gdx.ApplicationAdapter +import com.badlogic.gdx.Game import com.badlogic.gdx.Gdx import com.badlogic.gdx.Screen import com.badlogic.gdx.backends.lwjgl.LwjglApplication @@ -14,6 +15,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer import com.badlogic.gdx.math.Matrix4 import com.google.gson.JsonArray import com.google.gson.JsonPrimitive +import net.torvald.random.HQRNG import net.torvald.terrarum.Terrarum.RENDER_FPS import net.torvald.terrarum.gamecontroller.GameController import net.torvald.terrarum.imagefont.TinyAlphNum @@ -62,7 +64,7 @@ fun main(args: Array) { typealias RGBA8888 = Int -object Terrarum : ApplicationAdapter() { +object Terrarum : Game() { internal var screenW: Int? = null internal var screenH: Int? = null @@ -125,7 +127,6 @@ object Terrarum : ApplicationAdapter() { return lan + country } - lateinit var currentScreen: Screen var previousScreen: Screen? = null // to be used with temporary states like StateMonitorCheck @@ -336,26 +337,27 @@ object Terrarum : ApplicationAdapter() { ingame = Ingame(batch) - currentScreen = ingame as Screen - ingame!!.enter() + ingame!!.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, HQRNG().nextLong()) + ingame!!.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW + super.setScreen(ingame) } override fun render() { - currentScreen.render(Gdx.graphics.deltaTime) + super.screen.render(Gdx.graphics.deltaTime) GLOBAL_RENDER_TIMER += 1 } override fun pause() { - currentScreen.pause() + super.screen.pause() } override fun resume() { - currentScreen.resume() + super.screen.resume() } override fun dispose() { - currentScreen.dispose() + super.screen.dispose() fontGame.dispose() fontSmallNumbers.dispose() //dispose any other resources used in this level @@ -365,7 +367,7 @@ object Terrarum : ApplicationAdapter() { screenW = width screenH = height - currentScreen.resize(WIDTH, HEIGHT) + super.screen.resize(WIDTH, HEIGHT) } diff --git a/work_files/graphics/fonts/LatinExtA_variable.psd b/work_files/graphics/fonts/LatinExtA_variable.psd index 24fddea24..88cf62e51 100644 --- a/work_files/graphics/fonts/LatinExtA_variable.psd +++ b/work_files/graphics/fonts/LatinExtA_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf9401bf56bca913b22a4bb6283e46ebc738a7c1a6671af68eb58ae431ac727c -size 173875 +oid sha256:7e855feac432c883abf7a13f6baa21938e821ef6672d97f7af729dfa4640de07 +size 173952 diff --git a/work_files/graphics/fonts/greek_variable.psd b/work_files/graphics/fonts/greek_variable.psd index 61b93c071..d4264404e 100644 --- a/work_files/graphics/fonts/greek_variable.psd +++ b/work_files/graphics/fonts/greek_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68106131cf3f68b6770e6db0950c113eab237ed5597a2dc5f356e150db5bb794 -size 130572 +oid sha256:c3bd8e31a0d3b758b511eb7bb43952f25c8fd9c5c522f7caec2ce159c55d9e93 +size 130562 diff --git a/work_files/graphics/fonts/latinExt_additional_variable.psd b/work_files/graphics/fonts/latinExt_additional_variable.psd index a2d7dd9a4..007f3328b 100644 --- a/work_files/graphics/fonts/latinExt_additional_variable.psd +++ b/work_files/graphics/fonts/latinExt_additional_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:74849cda517eafead6f4e2e9428977904bcaa8c8114a455fc21ce5c90145a4b7 -size 308411 +oid sha256:0f34e0746df01c75a341808da32a366113bce646ead6c1de12b48d0c056310fc +size 348408 diff --git a/work_files/graphics/nowloading_arrow.psd b/work_files/graphics/nowloading_arrow.psd new file mode 100644 index 000000000..1b18200f3 --- /dev/null +++ b/work_files/graphics/nowloading_arrow.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b76b67a7d98f7d2f52caf9b975af839ed1d2f2e435926b5293a789750f86c0a +size 41682