mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
wipwip
This commit is contained in:
@@ -33,6 +33,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame;
|
|||||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
|
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
|
||||||
import net.torvald.terrarum.utils.JsonFetcher;
|
import net.torvald.terrarum.utils.JsonFetcher;
|
||||||
import net.torvald.terrarum.utils.JsonWriter;
|
import net.torvald.terrarum.utils.JsonWriter;
|
||||||
|
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
|
||||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
||||||
import net.torvald.util.ArrayListMap;
|
import net.torvald.util.ArrayListMap;
|
||||||
@@ -494,6 +495,10 @@ public class AppLoader implements ApplicationListener {
|
|||||||
|
|
||||||
// make loading list
|
// make loading list
|
||||||
CommonResourcePool.INSTANCE.loadAll();
|
CommonResourcePool.INSTANCE.loadAll();
|
||||||
|
|
||||||
|
// create tile atlas
|
||||||
|
printdbg(this, "Making terrain textures...");
|
||||||
|
CreateTileAtlas.INSTANCE.invoke(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -34,7 +34,15 @@ object BlockCodex {
|
|||||||
// fake props for "randomised" dynamic lights
|
// fake props for "randomised" dynamic lights
|
||||||
const val DYNAMIC_RANDOM_CASES = 64
|
const val DYNAMIC_RANDOM_CASES = 64
|
||||||
private var virtualTileCursor = 1
|
private var virtualTileCursor = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One-to-Many
|
||||||
|
*/
|
||||||
val tileToVirtual = HashMap<ItemID, List<ItemID>>()
|
val tileToVirtual = HashMap<ItemID, List<ItemID>>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Many-to-One
|
||||||
|
*/
|
||||||
val virtualToTile = HashMap<ItemID, ItemID>()
|
val virtualToTile = HashMap<ItemID, ItemID>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +64,7 @@ object BlockCodex {
|
|||||||
|
|
||||||
val numericID = intVal(it, "id")
|
val numericID = intVal(it, "id")
|
||||||
setProp(module, numericID, it)
|
setProp(module, numericID, it)
|
||||||
val tileId = "tile@$module:$numericID"
|
val tileId = "$module:$numericID"
|
||||||
|
|
||||||
// register tiles with dynamic light
|
// register tiles with dynamic light
|
||||||
if ((blockProps[tileId]?.dynamicLuminosityFunction ?: 0) != 0) {
|
if ((blockProps[tileId]?.dynamicLuminosityFunction ?: 0) != 0) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.torvald.terrarum.gameitem.ItemID
|
|||||||
import net.torvald.terrarum.lock
|
import net.torvald.terrarum.lock
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
|
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
|
||||||
|
import java.math.BigInteger
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
|
|||||||
val itemList = ArrayList<InventoryPair>()
|
val itemList = ArrayList<InventoryPair>()
|
||||||
val quickSlot = Array<ItemID?>(UIQuickslotBar.SLOT_COUNT) { null } // 0: Slot 1, 9: Slot 10
|
val quickSlot = Array<ItemID?>(UIQuickslotBar.SLOT_COUNT) { null } // 0: Slot 1, 9: Slot 10
|
||||||
|
|
||||||
var wallet = 0 // unified currency for whole civs; Dwarf Fortress approach seems too complicated
|
var wallet = BigInteger("0") // unified currency for whole civs; Dwarf Fortress approach seems too complicated
|
||||||
|
|
||||||
init {
|
init {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,23 +97,7 @@ internal object BlocksDrawer {
|
|||||||
// with TGA, you have a complete control over this, with the expense of added hassle on your side.
|
// with TGA, you have a complete control over this, with the expense of added hassle on your side.
|
||||||
// -- Torvald, 2018-12-19
|
// -- Torvald, 2018-12-19
|
||||||
|
|
||||||
printdbg(this, "Making terrain textures...")
|
// CreateTileAtlas.invoke() has been moved to the AppLoader.create() //
|
||||||
|
|
||||||
CreateTileAtlas()
|
|
||||||
//JsonWriter.writeToFile(CreateTileAtlas.tags, "${AppLoader.defaultDir}/test_rendertags.json")
|
|
||||||
// each takes about 60 seconds
|
|
||||||
//printdbg(this, "Writing pixmap as tga: atlas.tga")
|
|
||||||
//PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlas.tga"), CreateTileAtlas.atlas, false)
|
|
||||||
//printdbg(this, "Writing pixmap as tga: atlasAutumn.tga")
|
|
||||||
//PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasAutumn.tga"), CreateTileAtlas.atlasAutumn, false)
|
|
||||||
//printdbg(this, "Writing pixmap as tga: atlasWinter.tga")
|
|
||||||
//PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasWinter.tga"), CreateTileAtlas.atlasWinter, false)
|
|
||||||
//printdbg(this, "Writing pixmap as tga: atlasSpring.tga")
|
|
||||||
//PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasSpring.tga"), CreateTileAtlas.atlasSpring, false)
|
|
||||||
//printdbg(this, "Writing pixmap as tga: atlasFluid.tga")
|
|
||||||
//PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasFluid.tga"), CreateTileAtlas.atlasFluid, false)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create terrain texture from pixmaps
|
// create terrain texture from pixmaps
|
||||||
weatherTerrains = arrayOf(
|
weatherTerrains = arrayOf(
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ object CreateTileAtlas {
|
|||||||
// 112x112 or 224x224
|
// 112x112 or 224x224
|
||||||
else {
|
else {
|
||||||
if (tilesPixmap.width != tilesPixmap.height && tilesPixmap.width % (7 * TILE_SIZE) >= 2) {
|
if (tilesPixmap.width != tilesPixmap.height && tilesPixmap.width % (7 * TILE_SIZE) >= 2) {
|
||||||
throw IllegalArgumentException("Unrecognized image dimension: ${tilesPixmap.width}x${tilesPixmap.height}")
|
throw IllegalArgumentException("Unrecognized image dimension ${tilesPixmap.width}x${tilesPixmap.height} from $modname:${matte.name()}")
|
||||||
}
|
}
|
||||||
// figure out the tags
|
// figure out the tags
|
||||||
var connectionType = 0
|
var connectionType = 0
|
||||||
@@ -266,8 +266,10 @@ object CreateTileAtlas {
|
|||||||
tilesPixmap.dispose()
|
tilesPixmap.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun tileIDtoAtlasNumber(tileID: ItemID) = tags[tileID]!!.tileNumber
|
fun tileIDtoAtlasNumber(tileID: ItemID) = tags[tileID]?.tileNumber
|
||||||
fun tileIDtoItemSheetNumber(tileID: ItemID) = itemSheetNumbers[tileID]!!
|
?: throw NullPointerException("AtlasNumbers mapping from $tileID does not exist")
|
||||||
|
fun tileIDtoItemSheetNumber(tileID: ItemID) = itemSheetNumbers[tileID]
|
||||||
|
?: throw NullPointerException("ItemSheetNumber mapping from $tileID does not exist")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function must precede the drawToAtlantes() function, as the marking requires the variable
|
* This function must precede the drawToAtlantes() function, as the marking requires the variable
|
||||||
|
|||||||
Reference in New Issue
Block a user