mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
more on savegame migrator and virtualdisk bugfix
This commit is contained in:
BIN
lib/TerranVirtualDisk-src.jar
LFS
BIN
lib/TerranVirtualDisk-src.jar
LFS
Binary file not shown.
BIN
lib/TerranVirtualDisk.jar
LFS
BIN
lib/TerranVirtualDisk.jar
LFS
Binary file not shown.
@@ -159,7 +159,7 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
|
|||||||
val wallChangeQueue = ArrayList<BlockChangeQueueItem?>()
|
val wallChangeQueue = ArrayList<BlockChangeQueueItem?>()
|
||||||
val wireChangeQueue = ArrayList<BlockChangeQueueItem?>() // if 'old' is set and 'new' is blank, it's a wire cutter
|
val wireChangeQueue = ArrayList<BlockChangeQueueItem?>() // if 'old' is set and 'new' is blank, it's a wire cutter
|
||||||
|
|
||||||
val modifiedChunks = Array(16) { TreeSet<Int>() }
|
val modifiedChunks = Array(16) { TreeSet<Long>() }
|
||||||
|
|
||||||
var loadedTime_t = App.getTIME_T()
|
var loadedTime_t = App.getTIME_T()
|
||||||
protected set
|
protected set
|
||||||
|
|||||||
@@ -49,11 +49,17 @@ object SavegameConverter {
|
|||||||
val DOM = ClusteredFormatDOM(newDisk)
|
val DOM = ClusteredFormatDOM(newDisk)
|
||||||
val root = DOM.getRootFile()
|
val root = DOM.getRootFile()
|
||||||
|
|
||||||
|
var cnt = 0
|
||||||
|
|
||||||
// do filecopy
|
// do filecopy
|
||||||
type254DOM.entries.filter { it.key != 0L }.forEach { entryID, diskEntry ->
|
type254DOM.entries.filter { it.key != 0L }.forEach { entryID, diskEntry ->
|
||||||
val filename = Common.type254EntryIDtoType17Filename(entryID)
|
val filename = Common.type254EntryIDtoType17Filename(entryID)
|
||||||
|
|
||||||
|
println("Converting file $filename; old cluster size: ${DOM.usedClusterCount}; old ROOT cluster num: ${DOM.getRootDir().entryID}; fileCount: $cnt")
|
||||||
|
|
||||||
if (diskEntry.contents !is EntryFile) throw IllegalStateException("Entry in the savegame is not a file (${diskEntry.contents.javaClass.simpleName})")
|
if (diskEntry.contents !is EntryFile) throw IllegalStateException("Entry in the savegame is not a file (${diskEntry.contents.javaClass.simpleName})")
|
||||||
|
|
||||||
|
cnt += 1
|
||||||
val entry = diskEntry.contents as EntryFile
|
val entry = diskEntry.contents as EntryFile
|
||||||
|
|
||||||
val oldBytes = entry.bytes.toByteArray()
|
val oldBytes = entry.bytes.toByteArray()
|
||||||
@@ -73,3 +79,10 @@ object SavegameConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val infile = File("/home/torvald/.Terrarum/Worlds/2d3e3aa5-bf5b-45c8-acf6-66ef9f1c2217")
|
||||||
|
val outfile = File("/home/torvald/.Terrarum/Worlds/2d3e3aa5-bf5b-45c8-acf6-66ef9f1c2217.terrarumworld")
|
||||||
|
|
||||||
|
SavegameConverter.type254toType11(infile, outfile)
|
||||||
|
}
|
||||||
@@ -550,7 +550,7 @@ abstract class Gen(val world: GameWorld, val isFinal: Boolean, val seed: Long, v
|
|||||||
protected abstract fun getGenerator(seed: Long, params: Any?): List<Joise>
|
protected abstract fun getGenerator(seed: Long, params: Any?): List<Joise>
|
||||||
protected abstract fun draw(xStart: Int, yStart: Int, noises: List<Joise>, soff: Double)
|
protected abstract fun draw(xStart: Int, yStart: Int, noises: List<Joise>, soff: Double)
|
||||||
|
|
||||||
private fun getChunksRange(): List<Int> {
|
private fun getChunksRange(): List<Long> {
|
||||||
val (yStart, yEnd) = Worldgen.getChunkGenStrip(world)
|
val (yStart, yEnd) = Worldgen.getChunkGenStrip(world)
|
||||||
return (0 until world.width / CHUNK_W step 2).flatMap { cx -> // skip every other column because we can :smiling_face_with_horns:
|
return (0 until world.width / CHUNK_W step 2).flatMap { cx -> // skip every other column because we can :smiling_face_with_horns:
|
||||||
(LandUtil.chunkXYtoChunkNum(world, cx, yStart)..LandUtil.chunkXYtoChunkNum(world, cx, yEnd)).toList()
|
(LandUtil.chunkXYtoChunkNum(world, cx, yStart)..LandUtil.chunkXYtoChunkNum(world, cx, yEnd)).toList()
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ object Common {
|
|||||||
|
|
||||||
|
|
||||||
fun type254EntryIDtoType17Filename(entryID: Long): String {
|
fun type254EntryIDtoType17Filename(entryID: Long): String {
|
||||||
return entryID.toString(16).uppercase().padStart(16,'0')
|
return entryID.toULong().toString(16).uppercase().padStart(16,'0')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user