Skip to content

Commit

Permalink
import/export defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Nov 30, 2023
1 parent c2f2f20 commit 8d020e3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 47 deletions.
3 changes: 0 additions & 3 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7166,7 +7166,6 @@ script = SubResource( 20 )
[connection signal="value_changed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/ScrollContainer/VBoxContainer/PanelContainer3/VBoxContainer/SlabsetObjectSection/VBoxContainer/GridContainer/ObjThingTypeSpinBox" to="Ui/UiSystem/SlabsetWindow" method="_on_ObjThingTypeSpinBox_value_changed"]
[connection signal="toggled" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/ScrollContainer/VBoxContainer/PanelContainer3/VBoxContainer/SlabsetObjectSection/VBoxContainer/GridContainer/ObjIsLightCheckBox" to="Ui/UiSystem/SlabsetWindow" method="_on_ObjIsLightCheckBox_toggled"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/ScrollContainer/VBoxContainer/SlabsetCopyValues" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetCopyValues_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/ExportSlabsDat" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsDat_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/PanelContainer/VBoxContainer/HBoxContainer/ExportSlabsCfg" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsCfg_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/PanelContainer/VBoxContainer/HBoxContainer/ImportSlabsCfg" to="Ui/UiSystem/SlabsetWindow" method="_on_ImportSlabsCfg_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/VBoxContainer/PanelContainer/VBoxContainer/HBoxContainer/SlabsetHelpButton" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetHelpButton_pressed"]
Expand All @@ -7188,8 +7187,6 @@ script = SubResource( 20 )
[connection signal="timeout" from="Ui/UiSystem/NewMapWindow/MarginContainer/HBoxContainer/VBoxContainer/NewMapNoiseOptions/NoiseUpdateTimer" to="Ui/UiSystem/NewMapWindow" method="_on_NoiseUpdateTimer_timeout"]
[connection signal="pressed" from="Ui/UiSystem/NewMapWindow/MarginContainer/HBoxContainer/VBoxContainer/ButtonNewMapOK" to="Ui/UiSystem/NewMapWindow" method="_on_ButtonNewMapOK_pressed"]
[connection signal="gui_input" from="Ui/UiSystem/NewMapWindow/MarginContainer/HBoxContainer/QuickNoisePreview" to="Ui/UiSystem/NewMapWindow" method="_on_QuickNoisePreview_gui_input"]
[connection signal="file_selected" from="Ui/UiSystem/ExportSlabsetDatDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsetDatDialog_file_selected"]
[connection signal="file_selected" from="Ui/UiSystem/ExportSlabsetClmDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsetClmDialog_file_selected"]
[connection signal="file_selected" from="Ui/UiSystem/ExportSlabsetCfgDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsetCfgDialog_file_selected"]
[connection signal="file_selected" from="Ui/UiSystem/ImportSlabsetCfgDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ImportSlabsetCfgDialog_file_selected"]
[connection signal="file_selected" from="Ui/UiSystem/ImportColumnsetCfgDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ImportColumnsetCfgDialog_file_selected"]
Expand Down
88 changes: 44 additions & 44 deletions Scenes/SlabsetWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -224,37 +224,37 @@ func _on_SlabsetCopyValues_pressed():
oPickSlabWindow._on_pressed_add_new_custom_slab()


func _on_ExportSlabsDat_pressed():
Utils.popup_centered(oExportSlabsetDatDialog)
oExportSlabsetDatDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportSlabsetDatDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportSlabsetDatDialog.current_file = "slabs.dat"
func _on_ExportSlabsClm_pressed():
Utils.popup_centered(oExportSlabsetClmDialog)
oExportSlabsetClmDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportSlabsetClmDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportSlabsetClmDialog.current_file = "slabs.clm"
#func _on_ExportSlabsDat_pressed():
# Utils.popup_centered(oExportSlabsetDatDialog)
# oExportSlabsetDatDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
# oExportSlabsetDatDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
# oExportSlabsetDatDialog.current_file = "slabs.dat"
#func _on_ExportSlabsClm_pressed():
# Utils.popup_centered(oExportSlabsetClmDialog)
# oExportSlabsetClmDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
# oExportSlabsetClmDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
# oExportSlabsetClmDialog.current_file = "slabs.clm"

func _on_ExportSlabsCfg_pressed():
Utils.popup_centered(oExportSlabsetCfgDialog)
#oExportSlabsetCfgDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
#oExportSlabsetCfgDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportSlabsetCfgDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
oExportSlabsetCfgDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
oExportSlabsetCfgDialog.current_file = "slabset.cfg"
func _on_ImportSlabsCfg_pressed():
Utils.popup_centered(oImportSlabsetCfgDialog)
#oExportSlabsetCfgDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
#oExportSlabsetCfgDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oImportSlabsetCfgDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
oImportSlabsetCfgDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
oImportSlabsetCfgDialog.current_file = "slabset.cfg"

func _on_ExportColumnsCfg_pressed():
Utils.popup_centered(oExportColumnsetCfgDialog)
#oExportColumnsetCfgDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
#oExportColumnsetCfgDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oExportColumnsetCfgDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
oExportColumnsetCfgDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
oExportColumnsetCfgDialog.current_file = "columnset.cfg"
func _on_ImportColumnsCfg_pressed():
Utils.popup_centered(oImportColumnsetCfgDialog)
#oExportSlabsetCfgDialog.current_dir = oGame.DK_DATA_DIRECTORY.plus_file("")
#oExportSlabsetCfgDialog.current_path = oGame.DK_DATA_DIRECTORY.plus_file("")
oImportColumnsetCfgDialog.current_dir = oGame.GAME_DIRECTORY.plus_file("")
oImportColumnsetCfgDialog.current_path = oGame.GAME_DIRECTORY.plus_file("")
oImportColumnsetCfgDialog.current_file = "columnset.cfg"


Expand Down Expand Up @@ -297,34 +297,34 @@ func _on_ExportSlabsetDatDialog_file_selected(filePath):
oMessage.big("Error", "Couldn't save file, maybe try saving to another directory.")


func _on_ExportSlabsetClmDialog_file_selected(filePath):
var buffer = StreamPeerBuffer.new()

var numberOfClmEntries = 2048
buffer.put_16(numberOfClmEntries)
buffer.put_16(0)
#func _on_ExportSlabsetClmDialog_file_selected(filePath):
# var buffer = StreamPeerBuffer.new()
#
# var numberOfClmEntries = 2048
# buffer.put_16(numberOfClmEntries)
# buffer.put_data([0,0])
# buffer.put_16(0)
# buffer.put_data([0,0])

for entry in numberOfClmEntries:
buffer.put_16(Columnset.utilized[entry]) # 0-1
buffer.put_8((Columnset.permanent[entry] & 1) + ((Columnset.lintel[entry] & 7) << 1) + ((Columnset.height[entry] & 15) << 4))
buffer.put_16(Columnset.solidMask[entry]) # 3-4
buffer.put_16(Columnset.floorTexture[entry]) # 5-6
buffer.put_8(Columnset.orientation[entry]) # 7

for cubeNumber in 8:
buffer.put_16(Columnset.cubes[entry][cubeNumber]) # 8-23

var file = File.new()
if file.open(filePath,File.WRITE) == OK:
file.store_buffer(buffer.data_array)
file.close()
oMessage.quick("Saved: " + filePath)
else:
oMessage.big("Error", "Couldn't save file, maybe try saving to another directory.")
## buffer.put_16(numberOfClmEntries)
## buffer.put_data([0,0])
## buffer.put_16(0)
## buffer.put_data([0,0])
#
# for entry in numberOfClmEntries:
# buffer.put_16(Columnset.utilized[entry]) # 0-1
# buffer.put_8((Columnset.permanent[entry] & 1) + ((Columnset.lintel[entry] & 7) << 1) + ((Columnset.height[entry] & 15) << 4))
# buffer.put_16(Columnset.solidMask[entry]) # 3-4
# buffer.put_16(Columnset.floorTexture[entry]) # 5-6
# buffer.put_8(Columnset.orientation[entry]) # 7
#
# for cubeNumber in 8:
# buffer.put_16(Columnset.cubes[entry][cubeNumber]) # 8-23
#
# var file = File.new()
# if file.open(filePath,File.WRITE) == OK:
# file.store_buffer(buffer.data_array)
# file.close()
# oMessage.quick("Saved: " + filePath)
# else:
# oMessage.big("Error", "Couldn't save file, maybe try saving to another directory.")

func get_current_variation():
return (int(oSlabsetIDSpinBox.value) * 28) + int(oVariationNumberSpinBox.value)
Expand Down

0 comments on commit 8d020e3

Please sign in to comment.