mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
something's not right with tile numbering
This commit is contained in:
BIN
assets/mods/basegame/blocks/0.tga
LFS
Normal file
BIN
assets/mods/basegame/blocks/0.tga
LFS
Normal file
Binary file not shown.
@@ -1,6 +1,5 @@
|
|||||||
"id";"drop";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"plat";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs"
|
"id";"drop";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"plat";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs"
|
||||||
"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
||||||
"1";"1";"BLOCK_MIASMA";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
|
||||||
"16";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
"16";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
||||||
"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
||||||
"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
|
||||||
|
|||||||
|
@@ -137,7 +137,7 @@ object MinimapComposer : Disposable {
|
|||||||
val tileTerr = world.getTileFromTerrain(x, y)
|
val tileTerr = world.getTileFromTerrain(x, y)
|
||||||
val wallTerr = world.getTileFromWall(x, y)
|
val wallTerr = world.getTileFromWall(x, y)
|
||||||
val colTerr = CreateTileAtlas.terrainTileColourMap.get(tileTerr)!!.toGdxColor()
|
val colTerr = CreateTileAtlas.terrainTileColourMap.get(tileTerr)!!.toGdxColor()
|
||||||
val colWall = CreateTileAtlas.terrainTileColourMap.get(wallTerr)!!.toGdxColor().mul(BlocksDrawer.wallOverlayColour)
|
val colWall = CreateTileAtlas.terrainTileColourMap.get(wallTerr)!!.toGdxColor().mul(CreateTileAtlas.wallOverlayColour)
|
||||||
|
|
||||||
val outCol = if (colTerr.a > 0.1f) colTerr else colWall
|
val outCol = if (colTerr.a > 0.1f) colTerr else colWall
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ open class GameWorld : Disposable {
|
|||||||
tileNumberToNameMap = HashMap<Int, ItemID>()
|
tileNumberToNameMap = HashMap<Int, ItemID>()
|
||||||
tileNameToNumberMap = HashMap<ItemID, Int>()
|
tileNameToNumberMap = HashMap<ItemID, Int>()
|
||||||
CreateTileAtlas.tags.forEach {
|
CreateTileAtlas.tags.forEach {
|
||||||
|
printdbg(this, "tileNumber ${it.value.tileNumber} <-> tileName ${it.key}")
|
||||||
|
|
||||||
tileNumberToNameMap[it.value.tileNumber] = it.key
|
tileNumberToNameMap[it.value.tileNumber] = it.key
|
||||||
tileNameToNumberMap[it.key] = it.value.tileNumber
|
tileNameToNumberMap[it.key] = it.value.tileNumber
|
||||||
}
|
}
|
||||||
@@ -224,7 +226,14 @@ open class GameWorld : Disposable {
|
|||||||
*/
|
*/
|
||||||
fun getTileFromTerrain(rawX: Int, rawY: Int): ItemID {
|
fun getTileFromTerrain(rawX: Int, rawY: Int): ItemID {
|
||||||
val (x, y) = coerceXY(rawX, rawY)
|
val (x, y) = coerceXY(rawX, rawY)
|
||||||
return tileNumberToNameMap[layerTerrain.unsafeGetTile(x, y)]!!
|
|
||||||
|
try {
|
||||||
|
return tileNumberToNameMap[layerTerrain.unsafeGetTile(x, y)]!!
|
||||||
|
}
|
||||||
|
catch (e: NullPointerException) {
|
||||||
|
System.err.println("NPE for tilenum ${layerTerrain.unsafeGetTile(x, y)}")
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ internal object BlocksDrawer {
|
|||||||
|
|
||||||
//val tileItemWall = Image(TILE_SIZE * 16, TILE_SIZE * GameWorld.TILES_SUPPORTED / 16) // 4 MB
|
//val tileItemWall = Image(TILE_SIZE * 16, TILE_SIZE * GameWorld.TILES_SUPPORTED / 16) // 4 MB
|
||||||
|
|
||||||
|
|
||||||
val wallOverlayColour = Color(5f / 9f, 5f / 9f, 5f / 9f, 1f)
|
|
||||||
|
|
||||||
const val BREAKAGE_STEPS = 10
|
const val BREAKAGE_STEPS = 10
|
||||||
|
|
||||||
val WALL = GameWorld.WALL
|
val WALL = GameWorld.WALL
|
||||||
@@ -582,7 +579,7 @@ internal object BlocksDrawer {
|
|||||||
}
|
}
|
||||||
val vertexColour = when (mode) {
|
val vertexColour = when (mode) {
|
||||||
TERRAIN, WIRE, FLUID -> Color.WHITE
|
TERRAIN, WIRE, FLUID -> Color.WHITE
|
||||||
WALL -> wallOverlayColour
|
WALL -> CreateTileAtlas.wallOverlayColour
|
||||||
else -> throw IllegalArgumentException()
|
else -> throw IllegalArgumentException()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.Texture
|
|||||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||||
import net.torvald.gdx.graphics.Cvec
|
import net.torvald.gdx.graphics.Cvec
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.blockproperties.Fluid
|
import net.torvald.terrarum.blockproperties.Fluid
|
||||||
@@ -35,6 +36,8 @@ object CreateTileAtlas {
|
|||||||
|
|
||||||
private val TOTAL_TILES = TILES_IN_X * TILES_IN_X
|
private val TOTAL_TILES = TILES_IN_X * TILES_IN_X
|
||||||
|
|
||||||
|
val wallOverlayColour = Color(5f / 9f, 5f / 9f, 5f / 9f, 1f)
|
||||||
|
|
||||||
lateinit var atlas: Pixmap
|
lateinit var atlas: Pixmap
|
||||||
lateinit var atlasAutumn: Pixmap
|
lateinit var atlasAutumn: Pixmap
|
||||||
lateinit var atlasWinter: Pixmap
|
lateinit var atlasWinter: Pixmap
|
||||||
@@ -61,7 +64,6 @@ object CreateTileAtlas {
|
|||||||
// 16 tiles are reserved for internal use: solid black, solid white, breakage stages.
|
// 16 tiles are reserved for internal use: solid black, solid white, breakage stages.
|
||||||
// 0th tile is complete transparent tile and is also a BlockID of zero: air.
|
// 0th tile is complete transparent tile and is also a BlockID of zero: air.
|
||||||
private var atlasCursor = 0
|
private var atlasCursor = 0
|
||||||
private var atlasCursorGlow = 0
|
|
||||||
private val atlasInit = "./assets/graphics/blocks/init.tga"
|
private val atlasInit = "./assets/graphics/blocks/init.tga"
|
||||||
private var itemSheetCursor = 16
|
private var itemSheetCursor = 16
|
||||||
|
|
||||||
@@ -72,7 +74,6 @@ object CreateTileAtlas {
|
|||||||
|
|
||||||
tags = HashMap<ItemID, RenderTag>()
|
tags = HashMap<ItemID, RenderTag>()
|
||||||
itemSheetNumbers = HashMap<ItemID, Int>()
|
itemSheetNumbers = HashMap<ItemID, Int>()
|
||||||
tags[Block.AIR] = RenderTag(0, RenderTag.CONNECT_SELF, RenderTag.MASK_NA)
|
|
||||||
|
|
||||||
atlas = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888)
|
atlas = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888)
|
||||||
atlasAutumn = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888)
|
atlasAutumn = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888)
|
||||||
@@ -160,7 +161,7 @@ object CreateTileAtlas {
|
|||||||
// darken things for the wall
|
// darken things for the wall
|
||||||
for (y in 0 until itemWallPixmap.height) {
|
for (y in 0 until itemWallPixmap.height) {
|
||||||
for (x in 0 until itemWallPixmap.width) {
|
for (x in 0 until itemWallPixmap.width) {
|
||||||
val c = Color(itemWallPixmap.getPixel(x, y)).mulAndAssign(BlocksDrawer.wallOverlayColour).toRGBA()
|
val c = Color(itemWallPixmap.getPixel(x, y)).mulAndAssign(wallOverlayColour).toRGBA()
|
||||||
itemWallPixmap.drawPixel(x, y, c)
|
itemWallPixmap.drawPixel(x, y, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,6 +282,8 @@ object CreateTileAtlas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tags[id] = RenderTag(atlasCursor, connectionType, maskType)
|
tags[id] = RenderTag(atlasCursor, connectionType, maskType)
|
||||||
|
|
||||||
|
printdbg(this, "tileName ${id} ->> tileNumber ${atlasCursor}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawToAtlantes(pixmap: Pixmap, glow: Pixmap, tilesCount: Int) {
|
private fun drawToAtlantes(pixmap: Pixmap, glow: Pixmap, tilesCount: Int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user