mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
terrain texture change by all seasons
This commit is contained in:
Binary file not shown.
@@ -23,6 +23,7 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
|||||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.HumanoidNPC
|
import net.torvald.terrarum.modulebasegame.gameactors.HumanoidNPC
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
|
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UITitleRemoConYaml
|
import net.torvald.terrarum.modulebasegame.ui.UITitleRemoConYaml
|
||||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||||
@@ -129,7 +130,8 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
|
|
||||||
demoWorld = ReadLayerData(FileInputStream(ModMgr.getFile("basegame", "demoworld")))
|
demoWorld = ReadLayerData(FileInputStream(ModMgr.getFile("basegame", "demoworld")))
|
||||||
|
// set time to summer
|
||||||
|
demoWorld.time.addTime(WorldTime.DAY_LENGTH * 32)
|
||||||
|
|
||||||
// construct camera nodes
|
// construct camera nodes
|
||||||
val nodeCount = 100
|
val nodeCount = 100
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set time to summer
|
||||||
|
gameWorld.time.addTime(WorldTime.DAY_LENGTH * 32)
|
||||||
|
|
||||||
world = gameWorld
|
world = gameWorld
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,12 @@ internal object BlocksDrawer {
|
|||||||
* If not, the engine will choose wrong tile for a number you provided.
|
* If not, the engine will choose wrong tile for a number you provided.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
val tilesTerrain: TextureRegionPack
|
/** Index zero: spring */
|
||||||
|
val weatherTerrains: Array<TextureRegionPack>
|
||||||
|
lateinit var tilesTerrain: TextureRegionPack; private set
|
||||||
|
lateinit var tilesTerrainBlend: TextureRegionPack; private set
|
||||||
val tilesWire: TextureRegionPack
|
val tilesWire: TextureRegionPack
|
||||||
val tileItemWall: TextureRegionPack
|
val tileItemWall: TextureRegionPack
|
||||||
val tilesTerrainBlend: TextureRegionPack
|
|
||||||
val tilesFluid: TextureRegionPack
|
val tilesFluid: TextureRegionPack
|
||||||
|
|
||||||
//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
|
||||||
@@ -97,8 +99,8 @@ internal object BlocksDrawer {
|
|||||||
// -- Torvald, 2018-12-19
|
// -- Torvald, 2018-12-19
|
||||||
|
|
||||||
// hard-coded as tga.gz
|
// hard-coded as tga.gz
|
||||||
val gzFileList = listOf("blocks/terrain.tga.gz", "blocks/wire.tga.gz", "blocks/terrain_autumn.tga.gz", "blocks/fluids.tga.gz")
|
val gzFileList = listOf("blocks/wire.tga.gz", "blocks/fluids.tga.gz", "blocks/terrain_spring.tga.gz", "blocks/terrain.tga.gz", "blocks/terrain_autumn.tga.gz", "blocks/terrain_winter.tga.gz")
|
||||||
val gzTmpFName = listOf("tmp_terrain.tga", "tmp_wire.tga", "tmp_terrain_autumn.tga", "tmp_fluids.tga")
|
val gzTmpFName = listOf("tmp_wire.tga", "tmp_fluids.tga", "tmp_vor.tga", "tmp_sumar.tga", "tmp_haust.tga", "tmp_vetter.tga")
|
||||||
// unzip GZIP temporarily
|
// unzip GZIP temporarily
|
||||||
gzFileList.forEachIndexed { index, filename ->
|
gzFileList.forEachIndexed { index, filename ->
|
||||||
val terrainTexFile = ModMgr.getGdxFile("basegame", filename)
|
val terrainTexFile = ModMgr.getGdxFile("basegame", filename)
|
||||||
@@ -111,27 +113,29 @@ internal object BlocksDrawer {
|
|||||||
fos.close()
|
fos.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
val _terrainPixMap = Pixmap(Gdx.files.internal(gzTmpFName[0]))
|
val _wirePixMap = Pixmap(Gdx.files.internal(gzTmpFName[0]))
|
||||||
val _wirePixMap = Pixmap(Gdx.files.internal(gzTmpFName[1]))
|
val _fluidPixMap = Pixmap(Gdx.files.internal(gzTmpFName[1]))
|
||||||
val _terrainBlendPixMap = Pixmap(Gdx.files.internal(gzTmpFName[2]))
|
|
||||||
val _fluidPixMap = Pixmap(Gdx.files.internal(gzTmpFName[3]))
|
val _terrainPixMap = Array(4) { Pixmap(Gdx.files.internal(gzTmpFName[it + 2])) }
|
||||||
|
|
||||||
// delete temp files
|
// delete temp files
|
||||||
gzTmpFName.forEach { File(it).delete() }
|
gzTmpFName.forEach { File(it).delete() }
|
||||||
|
|
||||||
tilesTerrain = TextureRegionPack(Texture(_terrainPixMap), TILE_SIZE, TILE_SIZE)
|
|
||||||
tilesTerrain.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
weatherTerrains = Array(4) {
|
||||||
|
val t = TextureRegionPack(Texture(_terrainPixMap[it]), TILE_SIZE, TILE_SIZE)
|
||||||
|
t.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||||
|
t
|
||||||
|
}
|
||||||
|
|
||||||
tilesWire = TextureRegionPack(Texture(_wirePixMap), TILE_SIZE, TILE_SIZE)
|
tilesWire = TextureRegionPack(Texture(_wirePixMap), TILE_SIZE, TILE_SIZE)
|
||||||
tilesWire.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
tilesWire.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||||
tilesTerrainBlend = TextureRegionPack(Texture(_terrainBlendPixMap), TILE_SIZE, TILE_SIZE)
|
|
||||||
tilesTerrainBlend.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
|
||||||
tilesFluid = TextureRegionPack(Texture(_fluidPixMap), TILE_SIZE, TILE_SIZE)
|
tilesFluid = TextureRegionPack(Texture(_fluidPixMap), TILE_SIZE, TILE_SIZE)
|
||||||
tilesFluid.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
tilesFluid.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||||
|
|
||||||
// also dispose unused temp files
|
// also dispose unused temp files
|
||||||
//terrainPixMap.dispose() // commented: tileItemWall needs it
|
//terrainPixMap.dispose() // commented: tileItemWall needs it
|
||||||
_wirePixMap.dispose()
|
_wirePixMap.dispose()
|
||||||
_terrainBlendPixMap.dispose()
|
|
||||||
_fluidPixMap.dispose()
|
_fluidPixMap.dispose()
|
||||||
|
|
||||||
|
|
||||||
@@ -140,10 +144,13 @@ internal object BlocksDrawer {
|
|||||||
|
|
||||||
// create item_wall images
|
// create item_wall images
|
||||||
// will just use the terrain texture :p
|
// will just use the terrain texture :p
|
||||||
tileItemWall = tilesTerrain
|
tileItemWall = weatherTerrains[1]
|
||||||
|
|
||||||
|
|
||||||
_terrainPixMap.dispose() // finally
|
_terrainPixMap.forEach { it.dispose() } // finally
|
||||||
|
|
||||||
|
|
||||||
|
tilesTerrain = weatherTerrains[1]
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "init() exit")
|
printdbg(this, "init() exit")
|
||||||
@@ -340,6 +347,12 @@ internal object BlocksDrawer {
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
|
|
||||||
internal fun renderData() {
|
internal fun renderData() {
|
||||||
|
try {
|
||||||
|
tilesTerrain = weatherTerrains[(world as GameWorldExtension).time.months - 1]
|
||||||
|
tilesTerrainBlend = weatherTerrains[(world as GameWorldExtension).time.months fmod 4]
|
||||||
|
}
|
||||||
|
catch (e: ClassCastException) { }
|
||||||
|
|
||||||
drawTiles(WALL)
|
drawTiles(WALL)
|
||||||
drawTiles(TERRAIN) // regular tiles
|
drawTiles(TERRAIN) // regular tiles
|
||||||
drawTiles(WIRE)
|
drawTiles(WIRE)
|
||||||
@@ -735,7 +748,7 @@ internal object BlocksDrawer {
|
|||||||
/*shader hard-code*/shader.setUniformi("tilesInAtlas", tileAtlas.horizontalCount, tileAtlas.verticalCount) //depends on the tile atlas
|
/*shader hard-code*/shader.setUniformi("tilesInAtlas", tileAtlas.horizontalCount, tileAtlas.verticalCount) //depends on the tile atlas
|
||||||
/*shader hard-code*/shader.setUniformi("atlasTexSize", tileAtlas.texture.width, tileAtlas.texture.height) //depends on the tile atlas
|
/*shader hard-code*/shader.setUniformi("atlasTexSize", tileAtlas.texture.width, tileAtlas.texture.height) //depends on the tile atlas
|
||||||
// set the blend value as world's time progresses, in linear fashion
|
// set the blend value as world's time progresses, in linear fashion
|
||||||
shader.setUniformf("tilesBlend", if (world is GameWorldExtension && mode != FLUID)
|
shader.setUniformf("tilesBlend", if (world is GameWorldExtension && (mode == TERRAIN || mode == WALL))
|
||||||
(world as GameWorldExtension).time.days.minus(1f) / WorldTime.MONTH_LENGTH
|
(world as GameWorldExtension).time.days.minus(1f) / WorldTime.MONTH_LENGTH
|
||||||
else
|
else
|
||||||
0f
|
0f
|
||||||
|
|||||||
Binary file not shown.
BIN
work_files/graphics/gui/watches/basic_info1.psd
LFS
Normal file
BIN
work_files/graphics/gui/watches/basic_info1.psd
LFS
Normal file
Binary file not shown.
BIN
work_files/graphics/gui/watches/basic_info2.psd
LFS
Normal file
BIN
work_files/graphics/gui/watches/basic_info2.psd
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user