mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +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.utils.JsonFetcher;
|
||||
import net.torvald.terrarum.utils.JsonWriter;
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
||||
import net.torvald.util.ArrayListMap;
|
||||
@@ -494,6 +495,10 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
// make loading list
|
||||
CommonResourcePool.INSTANCE.loadAll();
|
||||
|
||||
// create tile atlas
|
||||
printdbg(this, "Making terrain textures...");
|
||||
CreateTileAtlas.INSTANCE.invoke(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,15 @@ object BlockCodex {
|
||||
// fake props for "randomised" dynamic lights
|
||||
const val DYNAMIC_RANDOM_CASES = 64
|
||||
private var virtualTileCursor = 1
|
||||
|
||||
/**
|
||||
* One-to-Many
|
||||
*/
|
||||
val tileToVirtual = HashMap<ItemID, List<ItemID>>()
|
||||
|
||||
/**
|
||||
* Many-to-One
|
||||
*/
|
||||
val virtualToTile = HashMap<ItemID, ItemID>()
|
||||
|
||||
/**
|
||||
@@ -56,7 +64,7 @@ object BlockCodex {
|
||||
|
||||
val numericID = intVal(it, "id")
|
||||
setProp(module, numericID, it)
|
||||
val tileId = "tile@$module:$numericID"
|
||||
val tileId = "$module:$numericID"
|
||||
|
||||
// register tiles with dynamic light
|
||||
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.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
|
||||
import java.math.BigInteger
|
||||
import java.util.*
|
||||
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 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 {
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
// -- Torvald, 2018-12-19
|
||||
|
||||
printdbg(this, "Making terrain textures...")
|
||||
|
||||
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)
|
||||
|
||||
|
||||
// CreateTileAtlas.invoke() has been moved to the AppLoader.create() //
|
||||
|
||||
// create terrain texture from pixmaps
|
||||
weatherTerrains = arrayOf(
|
||||
|
||||
@@ -240,7 +240,7 @@ object CreateTileAtlas {
|
||||
// 112x112 or 224x224
|
||||
else {
|
||||
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
|
||||
var connectionType = 0
|
||||
@@ -266,8 +266,10 @@ object CreateTileAtlas {
|
||||
tilesPixmap.dispose()
|
||||
}
|
||||
|
||||
fun tileIDtoAtlasNumber(tileID: ItemID) = tags[tileID]!!.tileNumber
|
||||
fun tileIDtoItemSheetNumber(tileID: ItemID) = itemSheetNumbers[tileID]!!
|
||||
fun tileIDtoAtlasNumber(tileID: ItemID) = tags[tileID]?.tileNumber
|
||||
?: 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
|
||||
|
||||
Reference in New Issue
Block a user