mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-13 23:26:07 +09:00
some old changes I forgot to commit
This commit is contained in:
@@ -28,7 +28,7 @@ object Anarchy : GameUpdateGovernor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object LimitUpdateRate : GameUpdateGovernor {
|
object ConsistentUpdateRate : GameUpdateGovernor {
|
||||||
|
|
||||||
private var akku = 0f
|
private var akku = 0f
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
world = gameWorld
|
world = gameWorld
|
||||||
|
|
||||||
gameUpdateGovernor = LimitUpdateRate.also { it.reset() }
|
gameUpdateGovernor = ConsistentUpdateRate.also { it.reset() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
it.dispose()
|
it.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
gameUpdateGovernor = LimitUpdateRate
|
gameUpdateGovernor = ConsistentUpdateRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
warning32bitJavaIcon.flip(false, false)
|
warning32bitJavaIcon.flip(false, false)
|
||||||
gameUpdateGovernor = LimitUpdateRate.also { it.reset() }
|
gameUpdateGovernor = ConsistentUpdateRate.also { it.reset() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadThingsWhileIntroIsVisible() {
|
private fun loadThingsWhileIntroIsVisible() {
|
||||||
@@ -139,10 +139,12 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
//ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
|
//ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
|
||||||
val world = ReadSimpleWorld(reader, file)
|
val world = ReadSimpleWorld(reader, file)
|
||||||
demoWorld = world
|
demoWorld = world
|
||||||
|
demoWorld.worldTime.timeDelta = 0//60
|
||||||
printdbg(this, "Demo world loaded")
|
printdbg(this, "Demo world loaded")
|
||||||
}
|
}
|
||||||
catch (e: IOException) {
|
catch (e: IOException) {
|
||||||
demoWorld = GameWorld(LandUtil.CHUNK_W, LandUtil.CHUNK_H, 0L, 0L)
|
demoWorld = GameWorld(LandUtil.CHUNK_W, LandUtil.CHUNK_H, 0L, 0L)
|
||||||
|
demoWorld.worldTime.timeDelta = 60
|
||||||
printdbg(this, "Demo world not found, using empty world")
|
printdbg(this, "Demo world not found, using empty world")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,8 +180,6 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
cameraPlayer = CameraPlayer(demoWorld, cameraAI)
|
cameraPlayer = CameraPlayer(demoWorld, cameraAI)
|
||||||
|
|
||||||
demoWorld.worldTime.timeDelta = 0//60
|
|
||||||
|
|
||||||
|
|
||||||
IngameRenderer.setRenderedWorld(demoWorld)
|
IngameRenderer.setRenderedWorld(demoWorld)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.*
|
|||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
import java.util.zip.GZIPInputStream
|
import java.util.zip.GZIPInputStream
|
||||||
import java.util.zip.GZIPOutputStream
|
import java.util.zip.GZIPOutputStream
|
||||||
|
import kotlin.collections.HashMap
|
||||||
import kotlin.experimental.and
|
import kotlin.experimental.and
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,11 +72,14 @@ object VDUtil {
|
|||||||
|
|
||||||
//println("[VDUtil] currentUnixtime = $currentUnixtime")
|
//println("[VDUtil] currentUnixtime = $currentUnixtime")
|
||||||
|
|
||||||
|
val entryOffsetInfoForDebug = HashMap<EntryID, Long>()
|
||||||
|
|
||||||
var entryOffset = VirtualDisk.HEADER_SIZE
|
var entryOffset = VirtualDisk.HEADER_SIZE
|
||||||
// not footer, entries
|
// not footer, entries
|
||||||
while (entryOffset < inbytes.size) {
|
while (entryOffset < inbytes.size) {
|
||||||
//println("[VDUtil] entryOffset = $entryOffset")
|
//println("[VDUtil] entryOffset = $entryOffset")
|
||||||
// read and prepare all the shits
|
// read and prepare all the shits
|
||||||
|
val entryOffsetStart = entryOffset
|
||||||
val entryID = inbytes.sliceArray64(entryOffset..entryOffset + 7).toLongBig()
|
val entryID = inbytes.sliceArray64(entryOffset..entryOffset + 7).toLongBig()
|
||||||
val entryParentID = inbytes.sliceArray64(entryOffset + 8..entryOffset + 15).toLongBig()
|
val entryParentID = inbytes.sliceArray64(entryOffset + 8..entryOffset + 15).toLongBig()
|
||||||
val entryTypeFlag = inbytes[entryOffset + 16]
|
val entryTypeFlag = inbytes[entryOffset + 16]
|
||||||
@@ -187,11 +191,15 @@ object VDUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add entry to disk
|
// add entry to disk
|
||||||
|
if (vdisk.entries[entryID] != null) {
|
||||||
|
println("[savegame.VDUtil] Overwriting existing entry ${entryID.toHex()} to new one; offset: ${entryOffsetInfoForDebug[entryID]} -> $entryOffsetStart; raw type flag: $entryTypeFlag)")
|
||||||
|
}
|
||||||
vdisk.entries[entryID] = diskEntry
|
vdisk.entries[entryID] = diskEntry
|
||||||
|
entryOffsetInfoForDebug[entryID] = entryOffsetStart
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (DEBUG_PRINT_READ) {
|
if (DEBUG_PRINT_READ) {
|
||||||
println("[savegame.VDUtil] Discarding entry ${entryID.toHex()} (raw type flag: $entryTypeFlag)")
|
println("[savegame.VDUtil] Discarding entry ${entryID.toHex()} at offset $entryOffsetStart (raw type flag: $entryTypeFlag)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user