From 597e1acee4062492374c992efa882d3ec630dee8 Mon Sep 17 00:00:00 2001 From: Minjae Song Date: Wed, 19 Dec 2018 01:53:09 +0900 Subject: [PATCH] fluidmap won't have errenous behaviour at the world edge; tga alpha fix --- assets/mods/basegame/blocks/terrain.tga.gz | 4 ++-- assets/mods/basegame/blocks/terrain_autumn.tga.gz | 4 ++-- .../terrarum/modulebasegame/gameworld/WorldSimulator.kt | 1 + src/net/torvald/terrarum/realestate/LandUtil.kt | 6 +++++- src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt | 6 ++++++ work_files/graphics/terrain/fluids.psd | 4 ++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/assets/mods/basegame/blocks/terrain.tga.gz b/assets/mods/basegame/blocks/terrain.tga.gz index 30fe4a3f1..9184e7e18 100644 --- a/assets/mods/basegame/blocks/terrain.tga.gz +++ b/assets/mods/basegame/blocks/terrain.tga.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18714948c695e59d3ce83a67737fdd85633fe5e8ded0d9b56239bab136d8ac8f -size 340009 +oid sha256:b72a190e0d16260271b005a21ae215f9cb21a6d3308073520cb586876c7c460a +size 338991 diff --git a/assets/mods/basegame/blocks/terrain_autumn.tga.gz b/assets/mods/basegame/blocks/terrain_autumn.tga.gz index a849af38d..4d85f2e58 100644 --- a/assets/mods/basegame/blocks/terrain_autumn.tga.gz +++ b/assets/mods/basegame/blocks/terrain_autumn.tga.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d04078d156da24b727be6d12455d3a7a6b2a7091b3ba64b2796ff70c75e9985 -size 348534 +oid sha256:d25f5074039edc2aa3a97d7ba4aefc4c5c137efc721854e2e1005a6aa0e7bb16 +size 347514 diff --git a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt index f929862ad..8dae05bde 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt @@ -25,6 +25,7 @@ object WorldSimulator { * In tiles; * square width/height = field * 2 */ + // TODO: increase the radius and then MULTITHREAD const val FLUID_UPDATING_SQUARE_RADIUS = 80 // larger value will have dramatic impact on performance const private val DOUBLE_RADIUS = FLUID_UPDATING_SQUARE_RADIUS * 2 diff --git a/src/net/torvald/terrarum/realestate/LandUtil.kt b/src/net/torvald/terrarum/realestate/LandUtil.kt index 06994fc34..e0ca501c3 100644 --- a/src/net/torvald/terrarum/realestate/LandUtil.kt +++ b/src/net/torvald/terrarum/realestate/LandUtil.kt @@ -4,13 +4,15 @@ import net.torvald.terrarum.Terrarum import net.torvald.terrarum.gameactors.faction.FactionCodex import net.torvald.terrarum.gameworld.BlockAddress import net.torvald.terrarum.gameworld.GameWorld +import net.torvald.terrarum.gameworld.fmod /** * Created by minjaesong on 2016-03-27. */ object LandUtil { fun getBlockAddr(world: GameWorld, x: Int, y: Int): BlockAddress = - (world.width * y).toLong() + x + // coercing and fmod-ing follows ROUNDWORLD rule + (world.width * y.coerceIn(0, world.height - 1)).toLong() + x.fmod(world.width) fun resolveBlockAddr(world: GameWorld, t: BlockAddress): Pair = Pair((t % world.width).toInt(), (t / world.width).toInt()) @@ -26,4 +28,6 @@ object LandUtil { Terrarum.ingame!!.getActorByID(id) else FactionCodex.getFactionByID(id) + + } \ No newline at end of file diff --git a/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt b/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt index 0ef3431dc..f3b940462 100644 --- a/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt +++ b/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt @@ -82,6 +82,12 @@ internal object BlocksDrawer { private val shader = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/tiling.frag")) init { + // PNG still doesn't work right. + // The thing is, pixel with alpha 0 must have RGB of also 0, which PNG does not guarantee it. + // (pixels of RGB = 255, A = 0 -- white transparent -- causes 'glow') + // with TGA, you have a complete control over this, with the expense of added hassle on your side. + // -- Torvald, 2018-12-19 + // hard-coded as tga.gz val gzFileList = listOf("blocks/terrain.tga.gz", "blocks/wire.tga.gz", "blocks/terrain_autumn.tga.gz") val gzTmpFName = listOf("tmp_terrain.tga", "tmp_wire.tga", "tmp_terrain_autumn.tga") diff --git a/work_files/graphics/terrain/fluids.psd b/work_files/graphics/terrain/fluids.psd index c350bdf9e..709c5e9f2 100644 --- a/work_files/graphics/terrain/fluids.psd +++ b/work_files/graphics/terrain/fluids.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e048eab006eb0c047524c47c9d092010eff37bd43c33947eabdfb1ae8dc20f5a -size 2152456 +oid sha256:41846536255efd7712bc71c51cc53f309502e8b3872f63f92735be1636288f88 +size 2152898