mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-15 08:06:06 +09:00
newer map data format
This commit is contained in:
@@ -72,18 +72,16 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
println("[LoadScreen] Screen to load is not set. Are you testing the UI?")
|
println("[LoadScreen] Screen to load is not set. Are you testing the UI?")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val runnable = object : Runnable {
|
val runnable = {
|
||||||
override fun run() {
|
try {
|
||||||
try {
|
screenToLoad!!.show()
|
||||||
screenToLoad!!.show()
|
}
|
||||||
}
|
catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
addMessage("$ccR$e")
|
||||||
addMessage("$ccR$e")
|
errorTrapped = true
|
||||||
errorTrapped = true
|
|
||||||
|
|
||||||
System.err.println("Error while loading:")
|
System.err.println("Error while loading:")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screenLoadingThread = Thread(runnable, "LoadScreen GameLoader")
|
screenLoadingThread = Thread(runnable, "LoadScreen GameLoader")
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ Ord Hex Description
|
|||||||
02 4D M
|
02 4D M
|
||||||
03 7A z # 'z' because it's compressed
|
03 7A z # 'z' because it's compressed
|
||||||
|
|
||||||
04 01 Version revision number
|
04 03 Version revision number (unreleased numbers also count)
|
||||||
|
|
||||||
05 03 Number of layers
|
05 03 Number of layers, NOT the number of payload
|
||||||
|
|
||||||
06 00 Reserved
|
06 05 Number of payloads
|
||||||
07 00 Reserved
|
|
||||||
|
07 01 Compression algorithm, 0 for none, 1 for DEFLATE, otherwise undefined (maybe LZMA2 for the future?)
|
||||||
|
|
||||||
08 World width
|
08 World width
|
||||||
09 World width
|
09 World width
|
||||||
@@ -25,41 +26,49 @@ Ord Hex Description
|
|||||||
0E World height
|
0E World height
|
||||||
0F World height
|
0F World height
|
||||||
|
|
||||||
10 Default spawn coord X
|
10 Default spawn coord in Absolute Tile Number
|
||||||
11 Default spawn coord X
|
11 Default spawn coord in Absolute Tile Number
|
||||||
12 Default spawn coord X
|
12 Default spawn coord in Absolute Tile Number
|
||||||
13 Default spawn coord X
|
13 Default spawn coord in Absolute Tile Number
|
||||||
|
14 Default spawn coord in Absolute Tile Number
|
||||||
|
15 Default spawn coord in Absolute Tile Number
|
||||||
|
|
||||||
14 Default spawn coord Y
|
# Payload
|
||||||
15 Default spawn coord Y
|
#
|
||||||
16 Default spawn coord Y
|
# Each layer and other information are stored as a "payload"
|
||||||
17 Default spawn coord Y
|
# A payload is consisted as follows:
|
||||||
|
#
|
||||||
# Layer count 1
|
# Literal Description
|
||||||
18 54 T
|
# "\0pLd" Payload header [00, 70, 4C, 64]
|
||||||
19 45 E
|
# [4] Identifier. 4 lettres ASCII string
|
||||||
20 52 R
|
# [6] Uncompressed size of DEFLATEd binary (max size 256 TB)
|
||||||
21 52 R
|
# [..] DEFLATEd binary
|
||||||
|
# "EndPYLd\xFF" Payload footer [45, 6E, 64, 50, 59, 4C, 64, FF]
|
||||||
22 Uncompressed size of DEFLATEd payload
|
|
||||||
23 Uncompressed size of DEFLATEd payload
|
|
||||||
24 Uncompressed size of DEFLATEd payload
|
|
||||||
25 Uncompressed size of DEFLATEd payload
|
|
||||||
|
|
||||||
26... DEFLATEd payload for the terrain (MSB ++ LSB; uncompressed size must be 1.5x of MSB) # ++ is a list concat sign in Haskell
|
|
||||||
|
|
||||||
# Layer count 2
|
|
||||||
... "WALL"
|
|
||||||
... Uncompressed size of DEFLATEd payload
|
|
||||||
... DEFLATEd payload for the wall (MSB ++ LSB; uncompressed size must be 1.5x of MSB)
|
|
||||||
|
|
||||||
|
|
||||||
# Layer count 3
|
Payload "TERR" -- world terrain data, concatenation of MSB and LSB arrays. In Haskell style: Deflate(MSB ++ LSB)
|
||||||
... "WIRE"
|
Uncompressed size will be 1.5x of (width * height)
|
||||||
... Uncompressed size of DEFLATEd payload
|
|
||||||
... Wire tiles data (MSB only)
|
|
||||||
|
|
||||||
<EOF>
|
Payload "WALL" -- world walls data, concatenation of MSB and LSB arrays. In Haskell style: Deflate(MSB ++ LSB)
|
||||||
|
Uncompressed size will be 1.5x of (width * height)
|
||||||
|
|
||||||
|
Payload "WIRE" -- world wires data
|
||||||
|
Uncompressed size will be as same as (width * height)
|
||||||
|
|
||||||
|
Payload "TdMG" -- world terrain damage data, array of: (Int48 tileAddress, Float32 damage)
|
||||||
|
Uncompressed size will be arbitrary
|
||||||
|
|
||||||
|
Payload "WdMG" -- world walls damage data, array of: (Int48 tileAddress, Float32 damage)
|
||||||
|
Uncompressed size will be arbitrary
|
||||||
|
|
||||||
|
EOF 45 E
|
||||||
|
EOF 6E n
|
||||||
|
EOF 64 d
|
||||||
|
EOF 54 T
|
||||||
|
EOF 45 E
|
||||||
|
EOF 4D M
|
||||||
|
EOF FF Byte order mark
|
||||||
|
EOF FE Byte order mark
|
||||||
|
|
||||||
|
|
||||||
* To read layers: you'll need to search for specific strings, namely ["TERR", "WALL", "WIRE"]
|
* To read layers: you'll need to search for specific strings, namely ["TERR", "WALL", "WIRE"]
|
||||||
|
|||||||
Reference in New Issue
Block a user