Skip to content

Commit

Permalink
messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Nov 29, 2023
1 parent ee5b119 commit 949ee9f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Autoload/Columnset.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func load_default_columnset():
var filePath = oGame.get_precise_filepath(oGame.DK_FXDATA_DIRECTORY, "COLUMNSET.CFG")
if filePath != "":
# Load columnset.cfg file
import_cfg_columnset(filePath, true)
import_cfg_columnset(filePath, true, false)
else:
# Load slabs.clm file
load_default_original_columnset()
Expand Down Expand Up @@ -78,13 +78,13 @@ func store_default_data():
default_data["floorTexture"] = floorTexture.duplicate(true)


func import_cfg_columnset(filePath, fullExport):
func import_cfg_columnset(filePath, fullExport, showMessages):
var oMessage = Nodelist.list["oMessage"]
var cfg = ConfigFile.new()
var err = cfg.load(filePath)

if err != OK:
oMessage.quick("Failed to load config file: " + str(filePath))
if showMessages == true: oMessage.quick("Failed to load config file: " + str(filePath))
return

for section in cfg.get_sections():
Expand All @@ -99,7 +99,7 @@ func import_cfg_columnset(filePath, fullExport):
orientation[columnIndex] = cfg.get_value(section, "Orientation", 0)
cubes[columnIndex] = cfg.get_value(section, "Cubes", [0,0,0,0, 0,0,0,0])

oMessage.quick("Merged: " + str(filePath))
if showMessages == true: oMessage.quick("Merged: " + str(filePath))



Expand Down
10 changes: 5 additions & 5 deletions Autoload/Slabset.gd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func load_default_slabset():
var filePath = oGame.get_precise_filepath(oGame.DK_FXDATA_DIRECTORY, "SLABSET.CFG")
if filePath != "":
# Load slabset.cfg file
import_cfg_slabset(filePath, true)
import_cfg_slabset(filePath, true, false)
else:
# Load slabs.dat and slabs.tng files
load_default_original_slabset()
Expand Down Expand Up @@ -96,15 +96,15 @@ func store_default_data():
default_data["tng"] = tng.duplicate(true)


func import_cfg_slabset(filePath, fullImport):
func import_cfg_slabset(filePath, fullImport, showMessages):
var processed_string = preprocess_cfg_file(filePath)
if processed_string == null:
oMessage.quick("Failed to open file: " + str(filePath))
if showMessages == true: oMessage.quick("Failed to open file: " + str(filePath))
return
var cfg = ConfigFile.new()
var err = cfg.parse(processed_string)
if err != OK:
oMessage.quick("Failed to parse config file")
if showMessages == true: oMessage.quick("Failed to parse config file")
return

resize_dat_and_tng_based_on_cfg(cfg)
Expand Down Expand Up @@ -141,7 +141,7 @@ func import_cfg_slabset(filePath, fullImport):
"ThingType": getObject[obj.THING_TYPE] = int(value) #int(Things.reverse_data_structure_name.get(value, 0))
"Subtype": getObject[obj.THING_SUBTYPE] = int(value)
"EffectRange": getObject[obj.EFFECT_RANGE] = int(value)
oMessage.quick("Merged: " + str(filePath))
if showMessages == true: oMessage.quick("Merged: " + str(filePath))

func resize_dat_and_tng_based_on_cfg(cfg):
# Determine maximum needed size for dat and tng arrays
Expand Down
4 changes: 2 additions & 2 deletions Scenes/SlabsetWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func _on_ExportSlabsetCfgDialog_file_selected(filePath):

func _on_ImportSlabsetCfgDialog_file_selected(filePath):
var fullImport = oExportImportSlabsFullCheckBox.pressed
Slabset.import_cfg_slabset(filePath, fullImport)
Slabset.import_cfg_slabset(filePath, fullImport, true)
update_columns_ui()
update_objects_ui()

Expand All @@ -274,7 +274,7 @@ func _on_ExportColumnsetCfgDialog_file_selected(filePath):

func _on_ImportColumnsetCfgDialog_file_selected(filePath):
var fullImport = oExportImportColumnsFullCheckBox.pressed
Columnset.import_cfg_columnset(filePath, fullImport)
Columnset.import_cfg_columnset(filePath, fullImport, true)
# Update columnset visuals here
oColumnsetVoxelView.refresh_entire_view()

Expand Down

0 comments on commit 949ee9f

Please sign in to comment.