block itemimage to use vernal season textures

This commit is contained in:
minjaesong
2023-09-10 20:22:39 +09:00
parent ca155a7e99
commit 5f0e6135e7
4 changed files with 38 additions and 17 deletions

View File

@@ -87,12 +87,17 @@ object PlayerBuilderSigrid {
inventory.add("item@basegame:1", 16) // copper pick
inventory.add("item@basegame:2", 64) // iron pick
inventory.add("item@basegame:3", 256) // steel pick
inventory.add("item@basegame:5", 385930603) // test tiki torch
inventory.add("item@basegame:12", 16) // copper sledgehammer
inventory.add("item@basegame:4", 16) // iron sledgehammer
inventory.add("item@basegame:13", 16) // steel sledgehammer
inventory.add("item@basegame:5", 995) // test tiki torch
inventory.add("item@basegame:6", 95) // storage chest
inventory.add("item@basegame:7", 1) // wire debugger
inventory.add("item@basegame:8", 9995) // power source
inventory.add("item@basegame:9", 1) // wire cutter
inventory.add("item@basegame:11", 10) // calendar
inventory.add("item@basegame:256", 995) // doors
inventory.add("item@basegame:257", 995) // doors
inventory.add("item@basegame:258", 995) // doors

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input.Keys
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
@@ -42,8 +44,10 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
private val buttonRowY = full.buttonRowY - buttonHeight
private val buttonRowY2 = buttonRowY - buttonHeight - buttonGap
private var altDown = false
private val mainGoButton = UIItemTextButton(this,
{ Lang["MENU_IO_LOAD_GAME"] }, buttonX1third, buttonRowY2, buttonWidth * 3 + buttonGap * 2, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also {
{ if (altDown) Lang["MENU_LABEL_PREV_SAVES"] else Lang["MENU_IO_LOAD_GAME"] }, buttonX1third, buttonRowY2, buttonWidth * 3 + buttonGap * 2, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also {
it.clickOnceListener = { _,_ ->
App.printdbg(this, "Load playerUUID: ${UILoadGovernor.playerUUID}, worldUUID: ${UILoadGovernor.worldUUID}")
@@ -51,15 +55,22 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
full.bringAutosaveSelectorUp()
full.changePanelTo(2)
}
else */if (full.loadables.saveAvaliable()) {
if (full.loadables.newerSaveIsDamaged) {
UILoadGovernor.previousSaveWasLoaded = true
}
else */
if (!altDown) {
if (full.loadables.saveAvaliable()) {
if (full.loadables.newerSaveIsDamaged) {
UILoadGovernor.previousSaveWasLoaded = true
}
// full.takeAutosaveSelectorDown()
full.loadManageSelectedGame = full.loadables.getLoadableSave()!!
full.loadManageSelectedGame = full.loadables.getLoadableSave()!!
mode = MODE_LOAD
mode = MODE_LOAD
}
}
else {
mode = MODE_PREV_SAVES
}
}
}
@@ -152,6 +163,7 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
private val MODE_INIT = 0
private val MODE_DELETE = 16 // are you sure?
private val MODE_RENAME = 32 // show rename dialogue
private val MODE_PREV_SAVES = 48
private val MODE_LOAD = 256 // is needed to make the static loading screen
init {
@@ -185,6 +197,8 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
}
override fun updateUI(delta: Float) {
altDown = Gdx.input.isKeyPressed(Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Keys.ALT_RIGHT)
when (mode) {
MODE_INIT -> {
mainButtons.forEach { it.update(delta) }

View File

@@ -104,7 +104,7 @@ internal object BlocksDrawer {
// create terrain texture from pixmaps
weatherTerrains = arrayOf(
TextureRegionPack(Texture(App.tileMaker.atlas), TILE_SIZE, TILE_SIZE),
TextureRegionPack(Texture(App.tileMaker.atlasPrevernal), TILE_SIZE, TILE_SIZE),
TextureRegionPack(Texture(App.tileMaker.atlasVernal), TILE_SIZE, TILE_SIZE),
TextureRegionPack(Texture(App.tileMaker.atlasAestival), TILE_SIZE, TILE_SIZE),
TextureRegionPack(Texture(App.tileMaker.atlasSerotinal), TILE_SIZE, TILE_SIZE),

View File

@@ -39,7 +39,7 @@ class CreateTileAtlas {
val wallOverlayColour = Color(.65f, .65f, .65f, 1f)
lateinit var atlas: Pixmap // prevernal
lateinit var atlasPrevernal: Pixmap
lateinit var atlasVernal: Pixmap
lateinit var atlasAestival: Pixmap
lateinit var atlasSerotinal: Pixmap
@@ -74,6 +74,8 @@ class CreateTileAtlas {
internal lateinit var itemWallPixmap: Pixmap
internal lateinit var itemWallPixmapGlow: Pixmap
val atlas: Pixmap
get() = atlasVernal
private fun drawInitPixmap() {
val initPixmap = Pixmap(Gdx.files.internal(atlasInit))
@@ -84,7 +86,7 @@ class CreateTileAtlas {
if (tilesInInitPixmap > tilesPossibleInCurrentPixmap) throw Error("Atlas size too small -- can't even fit the init.tga (MAX_TEX_SIZE must be at least ${FastMath.nextPowerOfTwo((sqrt(tilesInInitPixmap.toFloat()) * TILE_SIZE).ceilToInt())})")
if (MAX_TEX_SIZE >= initPixmap.width) {
atlas.drawPixmap(initPixmap, 0, 0)
atlasPrevernal.drawPixmap(initPixmap, 0, 0)
atlasVernal.drawPixmap(initPixmap, 0, 0)
atlasAestival.drawPixmap(initPixmap, 0, 0)
atlasSerotinal.drawPixmap(initPixmap, 0, 0)
@@ -109,7 +111,7 @@ class CreateTileAtlas {
val srcX = scantile * scanW
val destY = scantile * TILE_SIZE
atlas.drawPixmap(initPixmap, srcX, srcY, scanW, scanH, destX, destY, scanW, scanH)
atlasPrevernal.drawPixmap(initPixmap, srcX, srcY, scanW, scanH, destX, destY, scanW, scanH)
atlasVernal.drawPixmap(initPixmap, srcX, srcY, scanW, scanH, destX, destY, scanW, scanH)
atlasAestival.drawPixmap(initPixmap, srcX, srcY, scanW, scanH, destX, destY, scanW, scanH)
atlasSerotinal.drawPixmap(initPixmap, srcX, srcY, scanW, scanH, destX, destY, scanW, scanH)
@@ -129,7 +131,7 @@ class CreateTileAtlas {
tags = HashMap<ItemID, RenderTag>()
itemSheetNumbers = HashMap<ItemID, Int>()
atlas = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888).also { it.blending = Pixmap.Blending.None }
atlasPrevernal = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888).also { it.blending = Pixmap.Blending.None }
atlasVernal = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888).also { it.blending = Pixmap.Blending.None }
atlasAestival = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888).also { it.blending = Pixmap.Blending.None }
atlasSerotinal = Pixmap(TILES_IN_X * TILE_SIZE, TILES_IN_X * TILE_SIZE, Pixmap.Format.RGBA8888).also { it.blending = Pixmap.Blending.None }
@@ -409,7 +411,7 @@ class CreateTileAtlas {
//if (mode == 1) printdbg(this, "atlaspos: ($atlasX, $atlasY), srcpos: ($sourceX, $sourceY), srcpixmap = $pixmap")
when (source) {
PREVERNAL -> atlas.drawPixmap(pixmap, sourceX, sourceY, TILE_SIZE, TILE_SIZE, atlasX, atlasY, TILE_SIZE, TILE_SIZE)
PREVERNAL -> atlasPrevernal.drawPixmap(pixmap, sourceX, sourceY, TILE_SIZE, TILE_SIZE, atlasX, atlasY, TILE_SIZE, TILE_SIZE)
VERNAL -> atlasVernal.drawPixmap(pixmap, sourceX, sourceY, TILE_SIZE, TILE_SIZE, atlasX, atlasY, TILE_SIZE, TILE_SIZE)
AESTIVAL -> atlasAestival.drawPixmap(pixmap, sourceX, sourceY, TILE_SIZE, TILE_SIZE, atlasX, atlasY, TILE_SIZE, TILE_SIZE)
SEROTINAL -> atlasSerotinal.drawPixmap(pixmap, sourceX, sourceY, TILE_SIZE, TILE_SIZE, atlasX, atlasY, TILE_SIZE, TILE_SIZE)
@@ -450,7 +452,7 @@ class CreateTileAtlas {
}
fun dispose() {
atlas.dispose()
atlasPrevernal.dispose()
atlasVernal.dispose()
atlasAestival.dispose()
atlasSerotinal.dispose()
@@ -494,7 +496,7 @@ class CreateTileAtlas {
it.filter = Pixmap.Filter.NearestNeighbour
}
}
listOf(atlas, atlasVernal, atlasAestival, atlasSerotinal, atlasAutumnal, atlasHibernal, atlasGlow).forEachIndexed { index, pixmap ->
listOf(atlasPrevernal, atlasVernal, atlasAestival, atlasSerotinal, atlasAutumnal, atlasHibernal, atlasGlow).forEachIndexed { index, pixmap ->
/*
How it works:
@@ -519,7 +521,7 @@ class CreateTileAtlas {
pixmap.dispose()
}
atlas = newAtlantes[0]
atlasPrevernal = newAtlantes[0]
atlasVernal = newAtlantes[1]
atlasAestival = newAtlantes[2]
atlasSerotinal = newAtlantes[3]