Skip to content

Commit

Permalink
Export slabs.dat
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed May 6, 2022
1 parent e45fb09 commit c1d0617
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 36 deletions.
10 changes: 5 additions & 5 deletions AutoLoad/Things.gd
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ var DATA_OBJECT = {
049 : ["Hero Gate", preload("res://dk_images/crucials/anim0780/r1frame01.png"), null, TAB_ACTION],
050 : ["Spinning Key 2", preload("res://dk_images/traps_doors/anim0811/r1frame11.png"), null, TAB_MISC],
051 : ["Armour Effect", null, null, TAB_MISC],
052 : ["Treasury Gold 1 (up to 800)", preload("res://dk_images/valuables/gold_hoard1_tp/r1frame01.png"), null, TAB_GOLD],
053 : ["Treasury Gold 2 (up to 1200)", preload("res://dk_images/valuables/gold_hoard2_tp/r1frame01.png"), null, TAB_GOLD],
054 : ["Treasury Gold 3 (up to 1600)", preload("res://dk_images/valuables/gold_hoard3_tp/r1frame01.png"), null, TAB_GOLD],
055 : ["Treasury Gold 4 (up to 2000)", preload("res://dk_images/valuables/gold_hoard4_tp/r1frame01.png"), null, TAB_GOLD],
056 : ["Treasury Gold 5 (up to 2000)", preload("res://dk_images/valuables/gold_hoard5_tp/r1frame01.png"), null, TAB_GOLD],
052 : ["Treasury Gold 1 (~800)", preload("res://dk_images/valuables/gold_hoard1_tp/r1frame01.png"), null, TAB_GOLD],
053 : ["Treasury Gold 2 (~1200)", preload("res://dk_images/valuables/gold_hoard2_tp/r1frame01.png"), null, TAB_GOLD],
054 : ["Treasury Gold 3 (~1600)", preload("res://dk_images/valuables/gold_hoard3_tp/r1frame01.png"), null, TAB_GOLD],
055 : ["Treasury Gold 4 (~2000)", preload("res://dk_images/valuables/gold_hoard4_tp/r1frame01.png"), null, TAB_GOLD],
056 : ["Treasury Gold 5 (~2000)", preload("res://dk_images/valuables/gold_hoard5_tp/r1frame01.png"), null, TAB_GOLD],
057 : ["Lair: Wizard", preload("res://edited_images/lair/creature_generic/anim0126/r1frame01.png"), null, TAB_LAIR],
058 : ["Lair: Barbarian", preload("res://edited_images/lair/creature_generic/anim0126/r1frame01.png"), null, TAB_LAIR],
059 : ["Lair: Archer", preload("res://edited_images/lair/creature_generic/anim0126/r1frame01.png"), null, TAB_LAIR],
Expand Down
79 changes: 48 additions & 31 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2406,9 +2406,9 @@ __meta__ = {
visible = true
margin_left = -2006.0
margin_top = 2227.0
margin_right = -1329.0
margin_bottom = 2789.0
rect_min_size = Vector2( 300, 105 )
margin_right = -1326.0
margin_bottom = 2787.0
rect_min_size = Vector2( 250, 87.5 )
popup_exclusive = true
window_title = "Save as"
resizable = true
Expand All @@ -2419,9 +2419,6 @@ show_hidden_files = true
current_dir = "/Godot/MyProjects/Unearth"
current_path = "/Godot/MyProjects/Unearth/"
script = ExtResource( 51 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="FileDialogOpen" type="FileDialog" parent="Ui/UiSystem"]
visible = true
Expand Down Expand Up @@ -3789,8 +3786,8 @@ anims/RESET = SubResource( 18 )
visible = true
margin_left = -2004.0
margin_top = 1631.0
margin_right = -1326.0
margin_bottom = 2186.0
margin_right = -1324.0
margin_bottom = 2191.0
rect_min_size = Vector2( 250, 87.5 )
window_title = "Open a File"
resizable = true
Expand All @@ -3809,8 +3806,8 @@ __meta__ = {
visible = true
margin_left = -1278.0
margin_top = 2226.0
margin_right = -607.0
margin_bottom = 2792.0
margin_right = -598.0
margin_bottom = 2786.0
rect_min_size = Vector2( 250, 87.5 )
window_title = "Open a File"
resizable = true
Expand All @@ -3833,8 +3830,8 @@ __meta__ = {
visible = true
margin_left = -1278.0
margin_top = 1626.0
margin_right = -607.0
margin_bottom = 2190.0
margin_right = -598.0
margin_bottom = 2186.0
rect_min_size = Vector2( 250, 87.5 )
resizable = true
dialog_text = "Any colours used that aren't in the DK palette will be set as bright purple.
Expand All @@ -3857,9 +3854,6 @@ margin_bottom = 1345.0
window_title = "Texture editing"
resizable = true
script = ExtResource( 126 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/TextureEditingWindow"]
anchor_right = 1.0
Expand Down Expand Up @@ -4409,36 +4403,40 @@ margin_left = -2945.0
margin_top = -1513.0
margin_right = -1665.0
margin_bottom = -793.0
window_title = "Slabset [WIP]"
window_title = "Slabset"
resizable = true
script = ExtResource( 132 )

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer"]
margin_right = 1280.0
margin_bottom = 720.0
margin_right = 1260.0
margin_bottom = 700.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="SlabsetVoxelView" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer" instance=ExtResource( 19 )]
margin_right = 1108.0
margin_bottom = 720.0
margin_right = 1088.0
margin_bottom = 700.0

[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer"]
margin_left = 1112.0
margin_right = 1280.0
margin_bottom = 720.0
margin_left = 1092.0
margin_right = 1260.0
margin_bottom = 700.0
size_flags_vertical = 3
scroll_horizontal_enabled = false

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer"]
margin_right = 168.0
margin_bottom = 720.0
margin_bottom = 700.0
size_flags_vertical = 3

[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer"]
Expand Down Expand Up @@ -4529,19 +4527,24 @@ size_flags_horizontal = 6
size_flags_vertical = 4
columns = 3

[node name="SlabsetButton" type="Button" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer"]
margin_left = 5.0
[node name="Spacing2" type="Control" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer"]
margin_top = 177.0
margin_right = 163.0
margin_bottom = 204.0
size_flags_horizontal = 4
margin_right = 168.0
margin_bottom = 201.0
rect_min_size = Vector2( 24, 24 )

[node name="SlabsetExportButton" type="Button" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer"]
margin_top = 205.0
margin_right = 168.0
margin_bottom = 232.0
size_flags_horizontal = 9
text = "Export slabs.dat"

[node name="SlabsetHelpButton" type="Button" parent="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer"]
margin_left = 114.0
margin_top = 693.0
margin_top = 673.0
margin_right = 168.0
margin_bottom = 720.0
margin_bottom = 700.0
size_flags_horizontal = 10
size_flags_vertical = 10
text = "Help"
Expand Down Expand Up @@ -4658,6 +4661,18 @@ margin_bottom = 271.0
size_flags_vertical = 10
text = "Close"

[node name="ExportSlabsetDatDialog" type="FileDialog" parent="Ui/UiSystem"]
visible = true
margin_left = -2004.0
margin_top = 2858.0
margin_right = -1324.0
margin_bottom = 3418.0
rect_min_size = Vector2( 250, 87.5 )
access = 2
show_hidden_files = true
current_dir = "/Godot/MyProjects/Unearth"
current_path = "/Godot/MyProjects/Unearth/"

[node name="UiMessages" type="Control" parent="Ui"]
anchor_right = 1.0
anchor_bottom = 1.0
Expand Down Expand Up @@ -4921,8 +4936,10 @@ script = ExtResource( 88 )
[connection signal="value_changed" from="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer/GridContainer/SlabsetIDSpinBox" to="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/SlabsetVoxelView" method="_on_SlabsetIDSpinBox_value_changed"]
[connection signal="value_changed" from="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer/GridContainer/VariationNumberSpinBox" to="Ui/UiSystem/SlabsetWindow" method="_on_VariationNumberSpinBox_value_changed"]
[connection signal="value_changed" from="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer/GridContainer/VariationNumberSpinBox" to="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/SlabsetVoxelView" method="_on_VariationNumberSpinBox_value_changed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer/SlabsetExportButton" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetExportButton_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/VBoxContainer/HBoxContainer/ScrollContainer/VBoxContainer/SlabsetHelpButton" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetHelpButton_pressed"]
[connection signal="pressed" from="Ui/UiSystem/NewMapWindow/VBoxContainer/ButtonBlankMap" to="Ui/UiSystem/NewMapWindow" method="_on_ButtonBlankMap_pressed"]
[connection signal="pressed" from="Ui/UiSystem/NewMapWindow/VBoxContainer/NoiseButtonApplyBorder" to="Ui/UiSystem/NewMapWindow" method="_on_NoiseButtonApply_pressed"]
[connection signal="pressed" from="Ui/UiSystem/NewMapWindow/VBoxContainer/NewMapCloseButton" to="Ui/UiSystem/NewMapWindow" method="_on_NewMapCloseButton_pressed"]
[connection signal="file_selected" from="Ui/UiSystem/ExportSlabsetDatDialog" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsetDatDialog_file_selected"]
[connection signal="timeout" from="Ui/UiMessages/FPScounter/Timer" to="Ui/UiMessages/FPScounter" method="_on_Wait_timeout"]
24 changes: 24 additions & 0 deletions Scenes/ModifyDynamicSlabsWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ onready var oDkSlabs = Nodelist.list["oDkSlabs"]
onready var oVariationNumberSpinBox = Nodelist.list["oVariationNumberSpinBox"]
onready var oSlabPalette = Nodelist.list["oSlabPalette"]
onready var oMessage = Nodelist.list["oMessage"]
onready var oExportSlabsetDatDialog = Nodelist.list["oExportSlabsetDatDialog"]
onready var oGame = Nodelist.list["oGame"]


# Declare member variables here. Examples:
# var a = 2
Expand Down Expand Up @@ -147,3 +150,24 @@ func _on_SlabsetHelpButton_pressed():
#helptxt += '\n'
#helptxt += ""
oMessage.big("Help",helptxt)


func _on_SlabsetExportButton_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_ExportSlabsetDatDialog_file_selected(filePath):
var buffer = StreamPeerBuffer.new()

buffer.put_u16(1304)
for slab in 1304:
for subtile in 9:
var value = 65536 - oDkSlabs.dat[slab][subtile]
buffer.put_u16(value)

var file = File.new()
file.open(filePath,File.WRITE)
file.store_buffer(buffer.data_array)
file.close()

0 comments on commit c1d0617

Please sign in to comment.