Skip to content

Commit

Permalink
automatically load slabset.cfg and columnset.cfg from /fxdata/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Nov 26, 2023
1 parent ffd5f3d commit 960771b
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 116 deletions.
19 changes: 16 additions & 3 deletions Autoload/Columnset.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@ var default_data = {}
# map0000x.clm : 49,160 bytes. first 4 bytes contains 2048, second 4 bytes are ???, then comes the column data.
# slabs.clm : 49,156 bytes. first 4 bytes contains 2048, then comes the column data.


func load_default_columnset():
var CODETIME_START = OS.get_ticks_msec()
clear_all_column_data() # Important, for reloading/refreshing slabs.clm

# Decide which one to load
var filePath = oGame.get_precise_filepath(oGame.DK_FXDATA_DIRECTORY, "COLUMNSET.CFG")
if filePath != "":
# Load columnset.cfg file
import_cfg_columnset(filePath, true)
else:
# Load slabs.clm file
load_default_original_columnset()

store_default_data()
print('Created Columnset : '+str(OS.get_ticks_msec()-CODETIME_START)+'ms')


func load_default_original_columnset():
var filePath = oGame.get_precise_filepath(oGame.DK_DATA_DIRECTORY, "SLABS.CLM")
var buffer = Filetypes.file_path_to_buffer(filePath)

Expand Down Expand Up @@ -47,9 +62,7 @@ func load_default_columnset():
cubes[entry].resize(8)
for cubeNumber in 8:
cubes[entry][cubeNumber] = buffer.get_u16() # 8-23

print('Created Columnset : '+str(OS.get_ticks_msec()-CODETIME_START)+'ms')
store_default_data()


func store_default_data():
default_data["utilized"] = utilized.duplicate(true)
Expand Down
68 changes: 34 additions & 34 deletions Autoload/Slabs.gd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var doors = {42:null,43:null,44:null,45:null,46:null,47:null,48:null,49:null}
# These are just to make it easier to read
const NOT_OWNABLE = false
const OWNABLE = true
const FLOOR_SLAB = false
const EMPTY_SLAB = false
const BLOCK_SLAB = true
enum {
BITMASK_FLOOR = 0
Expand Down Expand Up @@ -147,54 +147,54 @@ var data = {
WALL_WITH_WOMAN: ["Woman Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 7
WALL_WITH_PAIR: ["Pair Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 8
WALL_DAMAGED: ["Damaged Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 9
PATH: ["Dirt Path", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 10
CLAIMED_GROUND: ["Claimed Area", FLOOR_SLAB, BITMASK_CLAIMED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 11
LAVA: ["Lava", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_LAVA, NOT_OWNABLE], # 12
WATER: ["Water", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_WATER, NOT_OWNABLE], # 13
PORTAL: ["Portal", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 14
PATH: ["Dirt Path", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 10
CLAIMED_GROUND: ["Claimed Area", EMPTY_SLAB, BITMASK_CLAIMED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 11
LAVA: ["Lava", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_LAVA, NOT_OWNABLE], # 12
WATER: ["Water", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_WATER, NOT_OWNABLE], # 13
PORTAL: ["Portal", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 14
PORTAL_WALL: ["Portal Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 15
TREASURE_ROOM: ["Treasure Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 16
TREASURE_ROOM: ["Treasure Room", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 16
TREASURE_ROOM_WALL: ["Treasure Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 17
LIBRARY: ["Library", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 18
LIBRARY: ["Library", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 18
LIBRARY_WALL: ["Library Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 19
PRISON: ["Prison", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 20
PRISON: ["Prison", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 20
PRISON_WALL: ["Prison Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 21
TORTURE_CHAMBER: ["Torture Chamber", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 22
TORTURE_CHAMBER: ["Torture Chamber", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 22
TORTURE_CHAMBER_WALL:["Torture Chamber Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 23
TRAINING_ROOM: ["Training Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 24
TRAINING_ROOM: ["Training Room", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 24
TRAINING_ROOM_WALL: ["Training Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 25
DUNGEON_HEART: ["Heart Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 26
DUNGEON_HEART: ["Heart Room", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 26
DUNGEON_HEART_WALL: ["Heart Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 27
WORKSHOP: ["Workshop", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 28
WORKSHOP: ["Workshop", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 28
WORKSHOP_WALL: ["Workshop Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 29
SCAVENGER_ROOM: ["Scavenger Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 30
SCAVENGER_ROOM: ["Scavenger Room", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 30
SCAVENGER_ROOM_WALL: ["Scavenger Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 31
TEMPLE: ["Temple", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 32
TEMPLE: ["Temple", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 32
TEMPLE_WALL: ["Temple Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 33
GRAVEYARD: ["Graveyard", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 34
GRAVEYARD: ["Graveyard", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 34
GRAVEYARD_WALL: ["Graveyard Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 35
HATCHERY: ["Hatchery", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 36
HATCHERY: ["Hatchery", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 36
HATCHERY_WALL: ["Hatchery Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 37
LAIR: ["Lair", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 38
LAIR: ["Lair", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 38
LAIR_WALL: ["Lair Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 39
BARRACKS: ["Barracks", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 40
BARRACKS: ["Barracks", EMPTY_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 40
BARRACKS_WALL: ["Barracks Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 41
WOODEN_DOOR_1: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 42
WOODEN_DOOR_2: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 43
BRACED_DOOR_1: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 44
BRACED_DOOR_2: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 45
IRON_DOOR_1: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 46
IRON_DOOR_2: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 47
MAGIC_DOOR_1: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 48
MAGIC_DOOR_2: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 49
SLAB_50: ["Slab 50", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 50
BRIDGE: ["Bridge", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 51
WOODEN_DOOR_1: ["Wooden Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 42
WOODEN_DOOR_2: ["Wooden Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 43
BRACED_DOOR_1: ["Braced Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 44
BRACED_DOOR_2: ["Braced Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 45
IRON_DOOR_1: ["Iron Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 46
IRON_DOOR_2: ["Iron Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 47
MAGIC_DOOR_1: ["Magic Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 48
MAGIC_DOOR_2: ["Magic Door", EMPTY_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 49
SLAB_50: ["Slab 50", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 50
BRIDGE: ["Bridge", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 51
GEMS: ["Gems", BLOCK_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 52
GUARD_POST: ["Guard Post", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 53
PURPLE_PATH: ["Purple Path", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, NOT_OWNABLE], # 54
# PURPLE_PATH2: ["Purple Path 2", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 55
# PURPLE_PATH3: ["Purple Path 3", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 56
# PURPLE_PATH4: ["Purple Path 4", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 57
GUARD_POST: ["Guard Post", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 53
PURPLE_PATH: ["Purple Path", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, NOT_OWNABLE], # 54
# PURPLE_PATH2: ["Purple Path 2", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 55
# PURPLE_PATH3: ["Purple Path 3", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 56
# PURPLE_PATH4: ["Purple Path 4", EMPTY_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 57
WALL_AUTOMATIC: ["Wall Automatic", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 99999
}
var icons = {
Expand Down
108 changes: 61 additions & 47 deletions Autoload/Slabset.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
extends Node
onready var oGame = Nodelist.list["oGame"]
onready var oMessage = Nodelist.list["oMessage"]

var tng = []
var dat = []
var default_data = {}
Expand Down Expand Up @@ -34,9 +37,66 @@ enum dir {
# import_cfg_slabset("D:/AI/slabset.cfg", true)
# print('Import Codetime: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms')

func load_default_slabset():
var CODETIME_START = OS.get_ticks_msec()
tng = []
dat = []

# Decide which one to load
var filePath = oGame.get_precise_filepath(oGame.DK_FXDATA_DIRECTORY, "SLABSET.CFG")
if filePath != "":
# Load slabset.cfg file
import_cfg_slabset(filePath, true)
else:
# Load slabs.dat and slabs.tng files
load_default_original_slabset()

print('Created Slabset : '+str(OS.get_ticks_msec()-CODETIME_START)+'ms')
store_default_data()


func load_default_original_slabset():

var dat_buffer = Filetypes.file_path_to_buffer(oGame.get_precise_filepath(oGame.DK_DATA_DIRECTORY, "SLABS.DAT"))
var tng_buffer = Filetypes.file_path_to_buffer(oGame.get_precise_filepath(oGame.DK_DATA_DIRECTORY, "SLABS.TNG"))

var object_info = create_object_list(tng_buffer)
if object_info.size() == 0:
oMessage.quick("Failed to load objects")
return

var totalSlabs = 42 + 16
var totalVariations = totalSlabs * 28
tng.resize(totalVariations)
dat.resize(totalVariations)
tng_buffer.seek(2)
dat_buffer.seek(2)

for variation in dat.size():
tng[variation] = []
dat[variation] = [0,0,0, 0,0,0, 0,0,0]
if variation < 42*28 or (variation % 28) < 8: # Handle the longslabs and the shortslabs

for subtile in 9:
dat[variation][subtile] = 65536 - dat_buffer.get_u16()

var getObjectIndex = tng_buffer.get_u16()

while getObjectIndex < object_info.size(): # Continue until "break"
var objectStuff = object_info[getObjectIndex]
if objectStuff[1] != variation:
break
tng[variation].append(objectStuff)
getObjectIndex += 1



func store_default_data():
default_data["dat"] = dat.duplicate(true)
default_data["tng"] = tng.duplicate(true)


func import_cfg_slabset(filePath, fullImport):
var oMessage = Nodelist.list["oMessage"]
var processed_string = preprocess_cfg_file(filePath)
if processed_string == null:
oMessage.quick("Failed to open file: " + str(filePath))
Expand Down Expand Up @@ -138,52 +198,6 @@ func preprocess_cfg_file(filePath): # 7ms
# textFile.store_string(processed_string)
# textFile.close()

func load_default_slabset():
tng = []
dat = []
var CODETIME_START = OS.get_ticks_msec()
var oGame = Nodelist.list["oGame"]
var oMessage = Nodelist.list["oMessage"]

var dat_buffer = Filetypes.file_path_to_buffer(oGame.get_precise_filepath(oGame.DK_DATA_DIRECTORY, "SLABS.DAT"))
var tng_buffer = Filetypes.file_path_to_buffer(oGame.get_precise_filepath(oGame.DK_DATA_DIRECTORY, "SLABS.TNG"))

var object_info = create_object_list(tng_buffer)
if object_info.size() == 0:
oMessage.quick("Failed to load objects")
return

var totalSlabs = 42 + 16
var totalVariations = totalSlabs * 28
tng.resize(totalVariations)
dat.resize(totalVariations)
tng_buffer.seek(2)
dat_buffer.seek(2)

for variation in dat.size():
tng[variation] = []
dat[variation] = [0,0,0, 0,0,0, 0,0,0]
if variation < 42*28 or (variation % 28) < 8: # Handle the longslabs and the shortslabs

for subtile in 9:
dat[variation][subtile] = 65536 - dat_buffer.get_u16()

var getObjectIndex = tng_buffer.get_u16()

while getObjectIndex < object_info.size(): # Continue until "break"
var objectStuff = object_info[getObjectIndex]
if objectStuff[1] != variation:
break
tng[variation].append(objectStuff)
getObjectIndex += 1

print('Created Slabset : '+str(OS.get_ticks_msec()-CODETIME_START)+'ms')
store_default_data()

func store_default_data():
default_data["dat"] = dat.duplicate(true)
default_data["tng"] = tng.duplicate(true)

func create_object_list(tng_buffer):
tng_buffer.seek(0)
var numberOfThings = tng_buffer.get_u16() # It says 359, however there are actually 362 entries in the file.
Expand Down
Loading

0 comments on commit 960771b

Please sign in to comment.