mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
fixed a bug where picking up a fixture placed on the world would drop one more fixture than it should do
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package net.torvald.terrarum.serialise
|
||||
|
||||
import net.torvald.gdx.graphics.PixmapIO2
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.ccW
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||
@@ -76,7 +74,7 @@ class WorldSavingThread(
|
||||
val tgaout = ByteArray64GrowableOutputStream()
|
||||
val gzout = GZIPOutputStream(tgaout)
|
||||
|
||||
Echo("Writing metadata...")
|
||||
printdbg(this, "Writing metadata...")
|
||||
|
||||
val creation_t = ingame.world.creationTime
|
||||
|
||||
@@ -106,7 +104,7 @@ class WorldSavingThread(
|
||||
for (cy in 0 until ch) {
|
||||
val chunkNumber = LandUtil.chunkXYtoChunkNum(ingame.world, cx, cy).toLong()
|
||||
|
||||
Echo("Writing chunks... ${(cw*ch*layer) + chunkNumber + 1}/${cw*ch*layers.size}")
|
||||
// Echo("Writing chunks... ${(cw*ch*layer) + chunkNumber + 1}/${cw*ch*layers.size}")
|
||||
|
||||
val chunkBytes = WriteWorld.encodeChunk(layers[layer]!!, cx, cy)
|
||||
val entryID = 0x1_0000_0000L or layer.toLong().shl(24) or chunkNumber
|
||||
@@ -124,7 +122,7 @@ class WorldSavingThread(
|
||||
|
||||
// Write Actors //
|
||||
actorsList.forEachIndexed { count, it ->
|
||||
Echo("Writing actors... ${count+1}/${actorsList.size}")
|
||||
// Echo("Writing actors... ${count+1}/${actorsList.size}")
|
||||
|
||||
val actorContent = EntryFile(WriteActor.encodeToByteArray64(it))
|
||||
val actor = DiskEntry(it.referenceID.toLong(), 0, creation_t, time_t, actorContent)
|
||||
@@ -134,7 +132,7 @@ class WorldSavingThread(
|
||||
}
|
||||
|
||||
|
||||
Echo("Writing file to disk...")
|
||||
// Echo("Writing file to disk...")
|
||||
|
||||
disk.entries[0]!!.modificationDate = time_t
|
||||
// entry zero MUST NOT be used to get lastPlayDate, but we'll update it anyway
|
||||
@@ -144,7 +142,7 @@ class WorldSavingThread(
|
||||
|
||||
|
||||
|
||||
Echo ("${ccW}Game saved with size of $ccG${outFile.length()}$ccW bytes")
|
||||
printdbg(this, "Game saved with size of ${outFile.length()} bytes")
|
||||
|
||||
|
||||
if (hasThumbnail) IngameRenderer.fboRGBexportedLatch = false
|
||||
@@ -177,7 +175,7 @@ class PlayerSavingThread(
|
||||
|
||||
WriteSavegame.saveProgress = 0f
|
||||
|
||||
Echo("Writing The Player...")
|
||||
printdbg(this, "Writing The Player...")
|
||||
WritePlayer(ingame.actorGamer, disk, ingame, time_t)
|
||||
disk.entries[0]!!.modificationDate = time_t
|
||||
VDUtil.dumpToRealMachine(disk, outFile)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package net.torvald.terrarum.serialise
|
||||
|
||||
import net.torvald.gdx.graphics.PixmapIO2
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.ccW
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||
@@ -69,7 +67,7 @@ class QuickSingleplayerWorldSavingThread(
|
||||
val tgaout = ByteArray64GrowableOutputStream()
|
||||
val gzout = GZIPOutputStream(tgaout)
|
||||
|
||||
Echo("Writing metadata...")
|
||||
printdbg(this, "Writing metadata...")
|
||||
|
||||
val creation_t = ingame.world.creationTime
|
||||
|
||||
@@ -103,7 +101,7 @@ class QuickSingleplayerWorldSavingThread(
|
||||
ingame.world.getLayer(layerNum)?.let { layer ->
|
||||
chunks.forEach { chunkNumber ->
|
||||
|
||||
Echo("Writing chunks... $chunksWrote/$chunkCount")
|
||||
// Echo("Writing chunks... $chunksWrote/$chunkCount")
|
||||
|
||||
val chunkXY = LandUtil.chunkNumToChunkXY(ingame.world, chunkNumber)
|
||||
|
||||
@@ -128,7 +126,7 @@ class QuickSingleplayerWorldSavingThread(
|
||||
|
||||
// Write Actors //
|
||||
actorsList.forEachIndexed { count, it ->
|
||||
Echo("Writing actors... ${count+1}/${actorsList.size}")
|
||||
printdbg(this, "Writing actors... ${count+1}/${actorsList.size}")
|
||||
|
||||
val actorContent = EntryFile(WriteActor.encodeToByteArray64(it))
|
||||
val actor = DiskEntry(it.referenceID.toLong(), 0, creation_t, time_t, actorContent)
|
||||
@@ -142,7 +140,7 @@ class QuickSingleplayerWorldSavingThread(
|
||||
skimmer.injectDiskCRC(disk.hashCode())
|
||||
skimmer.setSaveMode(1 + 2 * isAuto.toInt())
|
||||
|
||||
Echo ("${ccW}Game saved with size of $ccG${outFile.length()}$ccW bytes")
|
||||
printdbg(this, "Game saved with size of ${outFile.length()} bytes")
|
||||
|
||||
|
||||
if (hasThumbnail) IngameRenderer.fboRGBexportedLatch = false
|
||||
|
||||
@@ -43,11 +43,11 @@ object WriteSavegame {
|
||||
operator fun invoke(time_t: Long, mode: SaveMode, disk: VirtualDisk, outFile: File, ingame: TerrarumIngame, isAuto: Boolean, errorHandler: (Throwable) -> Unit, callback: () -> Unit) {
|
||||
savingStatus = 0
|
||||
val hasThumbnail = (mode == SaveMode.WORLD)
|
||||
Echo("Save queued")
|
||||
printdbg(this, "Save queued")
|
||||
|
||||
if (hasThumbnail) {
|
||||
IngameRenderer.screencapExportCallback = {
|
||||
Echo("Generating thumbnail...")
|
||||
printdbg(this, "Generating thumbnail...")
|
||||
|
||||
val w = 960
|
||||
val h = 640
|
||||
@@ -61,7 +61,7 @@ object WriteSavegame {
|
||||
//p.dispose()
|
||||
IngameRenderer.fboRGBexportedLatch = true
|
||||
|
||||
Echo("Done thumbnail generation")
|
||||
printdbg(this, "Done thumbnail generation")
|
||||
}
|
||||
IngameRenderer.screencapRequested = true
|
||||
}
|
||||
@@ -94,10 +94,10 @@ object WriteSavegame {
|
||||
|
||||
savingStatus = 0
|
||||
|
||||
Echo("Quicksave queued")
|
||||
printdbg(this, "Quicksave queued")
|
||||
|
||||
IngameRenderer.screencapExportCallback = {
|
||||
Echo("Generating thumbnail...")
|
||||
printdbg(this, "Generating thumbnail...")
|
||||
|
||||
val w = 960
|
||||
val h = 640
|
||||
@@ -107,7 +107,7 @@ object WriteSavegame {
|
||||
//p.dispose()
|
||||
IngameRenderer.fboRGBexportedLatch = true
|
||||
|
||||
Echo("Done thumbnail generation")
|
||||
printdbg(this, "Done thumbnail generation")
|
||||
}
|
||||
IngameRenderer.screencapRequested = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user