Skip to content

Commit

Permalink
Gomez Placer, Trileset loader
Browse files Browse the repository at this point in the history
Add the ability to place Gomez as the starting point for a level, improved object detection for the cursor, and implemented a palette picker. We have the bare minimum!
  • Loading branch information
edintomato2 committed Jan 13, 2024
1 parent 9d5b0ae commit ef00f4c
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 159 deletions.
12 changes: 8 additions & 4 deletions Defaults/default.tres
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
[gd_resource type="Theme" load_steps=4 format=3 uid="uid://5wxvr808qkyw"]
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://5wxvr808qkyw"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jyao1"]
bg_color = Color(0, 0, 0, 0.196078)
border_width_top = 2
border_color = Color(0, 0, 0, 1)
border_blend = true

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rx68y"]
bg_color = Color(0, 0, 0, 0.196078)
border_width_left = 2
border_color = Color(0, 0, 0, 1)

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mceqj"]
content_margin_left = 6.0
content_margin_right = 6.0
Expand All @@ -14,13 +19,12 @@ bg_color = Color(0, 0, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7tf7i"]
bg_color = Color(0, 0, 0, 0.196078)
border_width_left = 2
border_width_top = 2
border_width_bottom = 2
border_color = Color(0, 0, 0, 1)
border_blend = true

[resource]
HBoxContainer/constants/separation = 0
ItemList/styles/panel = SubResource("StyleBoxFlat_jyao1")
Label/styles/normal = SubResource("StyleBoxFlat_rx68y")
MenuButton/styles/normal = SubResource("StyleBoxFlat_mceqj")
RichTextLabel/styles/normal = SubResource("StyleBoxFlat_7tf7i")
VSplitContainer/constants/separation = 0
184 changes: 145 additions & 39 deletions Scenes/UI.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=3 uid="uid://cdwpy8hm6qseq"]
[gd_scene load_steps=29 format=3 uid="uid://cdwpy8hm6qseq"]

[ext_resource type="Script" path="res://Scripts/UI/UI.gd" id="1_yufu8"]
[ext_resource type="Theme" uid="uid://5wxvr808qkyw" path="res://Defaults/default.tres" id="2_pfeim"]
Expand All @@ -8,7 +8,8 @@
[ext_resource type="PackedScene" uid="uid://baepcmjcgsbk0" path="res://Objects/Compass.glb" id="6_exilt"]
[ext_resource type="Script" path="res://Scripts/UI/Sidebar/EditorInfo.gd" id="7_jfdyk"]
[ext_resource type="Script" path="res://Scripts/UI/Compass.gd" id="7_lgwbb"]
[ext_resource type="Script" path="res://Scripts/UI/Toolbar/Palette.gd" id="10_yvdlw"]
[ext_resource type="Script" path="res://Scripts/UI/Toolbar/Triles.gd" id="9_4swbr"]
[ext_resource type="Script" path="res://Scripts/UI/Toolbar/NPCs.gd" id="10_2driq"]
[ext_resource type="Script" path="res://Scripts/Importer/Importer.gd" id="11_b3xhm"]
[ext_resource type="Script" path="res://Scripts/Exporter/Exporter.gd" id="12_4xdn3"]

Expand Down Expand Up @@ -36,6 +37,14 @@ keycode = 83
[sub_resource type="Shortcut" id="Shortcut_c4g0v"]
events = [SubResource("InputEventKey_txw7b")]

[sub_resource type="InputEventKey" id="InputEventKey_pptsy"]
device = -1
ctrl_pressed = true
keycode = 78

[sub_resource type="Shortcut" id="Shortcut_o221s"]
events = [SubResource("InputEventKey_pptsy")]

[sub_resource type="InputEventKey" id="InputEventKey_slhck"]
device = -1
ctrl_pressed = true
Expand All @@ -60,6 +69,14 @@ keycode = 72
[sub_resource type="Shortcut" id="Shortcut_efjk7"]
events = [SubResource("InputEventKey_oq4ek")]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mn0ei"]
bg_color = Color(0, 0, 0, 0.196078)
border_width_left = 2
border_color = Color(0, 0, 0, 1)

[sub_resource type="Theme" id="Theme_328gk"]
Label/styles/normal = SubResource("StyleBoxFlat_mn0ei")

[node name="UI" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
Expand All @@ -68,6 +85,7 @@ grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 0
script = ExtResource("1_yufu8")

[node name="Titlebar" type="HBoxContainer" parent="."]
Expand All @@ -80,29 +98,33 @@ shortcut = SubResource("Shortcut_aqtus")
text = "File"
flat = false
switch_on_hover = true
item_count = 5
item_count = 6
popup/item_0/text = "Load Level"
popup/item_0/id = 0
popup/item_1/text = "Save Level"
popup/item_1/id = 1
popup/item_1/disabled = true
popup/item_2/text = "Options"
popup/item_2/id = 2
popup/item_3/text = ""
popup/item_3/id = 3
popup/item_3/separator = true
popup/item_4/text = "Quit"
popup/item_4/id = 4
popup/item_2/text = "New Level"
popup/item_2/id = 5
popup/item_3/text = "Options"
popup/item_3/id = 2
popup/item_4/text = ""
popup/item_4/id = 3
popup/item_4/separator = true
popup/item_5/text = "Quit"
popup/item_5/id = 4
script = ExtResource("3_mnd5b")
loadShortcut = SubResource("Shortcut_8hi2n")
saveShortcut = SubResource("Shortcut_c4g0v")
newShortcut = SubResource("Shortcut_o221s")
quitShortcut = SubResource("Shortcut_x4u3j")

[node name="Load" type="FileDialog" parent="Titlebar/File"]
title = "Open a File"
initial_position = 1
size = Vector2i(454, 400)
ok_button_text = "Open"
dialog_hide_on_ok = true
file_mode = 0
access = 2
filters = PackedStringArray("*.fezlvl.json ; FEZ Levels")
Expand All @@ -111,11 +133,22 @@ use_native_dialog = true
[node name="Save" type="FileDialog" parent="Titlebar/File"]
title = "Save FEZLVL as"
initial_position = 2
ok_button_text = "Save"
dialog_hide_on_ok = true
access = 2
filters = PackedStringArray("*.fezlvl.json ; FEZ Levels")
use_native_dialog = true

[node name="New" type="FileDialog" parent="Titlebar/File"]
title = "Open a File"
initial_position = 2
ok_button_text = "Open"
dialog_hide_on_ok = true
file_mode = 0
access = 2
filters = PackedStringArray("*.fezts.json ; FEZ Trileset")
use_native_dialog = true

[node name="Edit" type="MenuButton" parent="Titlebar"]
layout_mode = 2
text = "Edit"
Expand All @@ -128,18 +161,16 @@ shortcut = SubResource("Shortcut_5p5ho")
text = "View"
flat = false
switch_on_hover = true
item_count = 5
popup/item_0/text = "Palette"
popup/item_0/id = 0
popup/item_1/text = "Hide layers..."
popup/item_1/id = 1
popup/item_2/text = ""
popup/item_2/id = 10
popup/item_2/separator = true
popup/item_3/text = "Debug terminal"
popup/item_3/id = 2
popup/item_4/text = "Raw FEZLVL.JSON"
popup/item_4/id = 3
item_count = 4
popup/item_0/text = "Hide layers..."
popup/item_0/id = 1
popup/item_1/text = ""
popup/item_1/id = 10
popup/item_1/separator = true
popup/item_2/text = "Debug terminal"
popup/item_2/id = 2
popup/item_3/text = "Raw FEZLVL.JSON"
popup/item_3/id = 3

[node name="Help" type="MenuButton" parent="Titlebar"]
layout_mode = 2
Expand Down Expand Up @@ -195,34 +226,44 @@ size_flags_horizontal = 3
mouse_filter = 1
color = Color(0, 0, 0, 1)

[node name="Sidebar" type="HBoxContainer" parent="."]
[node name="VSplitContainer" type="VSplitContainer" parent="."]
clip_contents = true
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("2_pfeim")

[node name="Sidebar" type="HBoxContainer" parent="VSplitContainer"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 15.0

[node name="Spacer" type="Container" parent="Sidebar"]
[node name="Spacer" type="Control" parent="VSplitContainer/Sidebar"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 5.3
mouse_filter = 1

[node name="SidebarVertical" type="VBoxContainer" parent="Sidebar"]
[node name="SidebarVertical" type="VBoxContainer" parent="VSplitContainer/Sidebar"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 0

[node name="Position" type="Label" parent="Sidebar/SidebarVertical"]
[node name="Position" type="Label" parent="VSplitContainer/Sidebar/SidebarVertical"]
layout_mode = 2
mouse_filter = 1
theme = SubResource("Theme_328gk")
text = "[0, 0, 0]"
horizontal_alignment = 1

[node name="Object" type="Label" parent="Sidebar/SidebarVertical"]
[node name="Object" type="Label" parent="VSplitContainer/Sidebar/SidebarVertical"]
layout_mode = 2
mouse_filter = 1
theme = ExtResource("2_pfeim")
text = "None"
horizontal_alignment = 1

[node name="EditorLog" type="RichTextLabel" parent="Sidebar/SidebarVertical"]
[node name="EditorLog" type="RichTextLabel" parent="VSplitContainer/Sidebar/SidebarVertical"]
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("2_pfeim")
Expand All @@ -232,51 +273,114 @@ scroll_following = true
threaded = true
script = ExtResource("7_jfdyk")

[node name="CompassView" type="SubViewportContainer" parent="Sidebar/SidebarVertical"]
[node name="CompassView" type="SubViewportContainer" parent="VSplitContainer/Sidebar/SidebarVertical"]
visible = false
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 0.5
stretch = true

[node name="Compass" type="SubViewport" parent="Sidebar/SidebarVertical/CompassView"]
[node name="Compass" type="SubViewport" parent="VSplitContainer/Sidebar/SidebarVertical/CompassView"]
transparent_bg = true
handle_input_locally = false
size = Vector2i(2, 2)
render_target_update_mode = 0

[node name="Compass" parent="Sidebar/SidebarVertical/CompassView/Compass" instance=ExtResource("6_exilt")]
[node name="Compass" parent="VSplitContainer/Sidebar/SidebarVertical/CompassView/Compass" instance=ExtResource("6_exilt")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
visible = false
script = ExtResource("7_lgwbb")

[node name="CompPivot" type="Node3D" parent="Sidebar/SidebarVertical/CompassView/Compass"]
[node name="CompPivot" type="Node3D" parent="VSplitContainer/Sidebar/SidebarVertical/CompassView/Compass"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0, 0)

[node name="CompassCam" type="Camera3D" parent="Sidebar/SidebarVertical/CompassView/Compass/CompPivot"]
[node name="CompassCam" type="Camera3D" parent="VSplitContainer/Sidebar/SidebarVertical/CompassView/Compass/CompPivot"]
transform = Transform3D(0.707107, -0.380969, 0.595704, 0, 0.842453, 0.538771, -0.707107, -0.380969, 0.595704, 6.79999, 6.79999, 6.79999)
cull_mask = 1
projection = 1
size = 10.0
far = 20.0

[node name="Toolbar" type="HBoxContainer" parent="."]
[node name="Toolbar" type="HBoxContainer" parent="VSplitContainer"]
clip_contents = true
custom_minimum_size = Vector2(0, 1)
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 0

[node name="TextureButton" type="TextureButton" parent="Toolbar"]
[node name="ChoosePalette" type="OptionButton" parent="VSplitContainer/Toolbar"]
layout_mode = 2
alignment = 1
item_count = 3
selected = 0
fit_to_longest_item = false
popup/item_0/text = "Triles"
popup/item_0/id = 0
popup/item_0/disabled = true
popup/item_1/text = "Art Objects"
popup/item_1/id = 1
popup/item_1/disabled = true
popup/item_2/text = "NPCs"
popup/item_2/id = 2
popup/item_2/disabled = true

[node name="Palette" type="ItemList" parent="Toolbar"]
[node name="Palettes" type="Control" parent="VSplitContainer/Toolbar"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 2

[node name="Triles" type="ItemList" parent="VSplitContainer/Toolbar/Palettes"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
mouse_force_pass_scroll_events = false
theme = ExtResource("2_pfeim")
allow_search = false
max_columns = 0
same_column_width = true
icon_mode = 0
icon_scale = 2.0
script = ExtResource("9_4swbr")

[node name="AOs" type="ItemList" parent="VSplitContainer/Toolbar/Palettes"]
visible = false
clip_contents = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
mouse_force_pass_scroll_events = false
theme = ExtResource("2_pfeim")
allow_search = false
max_columns = 0
same_column_width = true
icon_mode = 0
icon_scale = 2.0

[node name="NPCs" type="ItemList" parent="VSplitContainer/Toolbar/Palettes"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
mouse_force_pass_scroll_events = false
theme = ExtResource("2_pfeim")
allow_search = false
max_columns = 0
same_column_width = true
icon_mode = 0
icon_scale = 2.0
script = ExtResource("10_yvdlw")
script = ExtResource("10_2driq")

[node name="SFX" type="AudioStreamPlayer" parent="."]

Expand All @@ -296,9 +400,11 @@ script = ExtResource("12_4xdn3")
[connection signal="confirmed" from="Titlebar/File/Load" to="." method="_on_load_dialog_confirmed"]
[connection signal="file_selected" from="Titlebar/File/Load" to="Loader" method="_on_load_dialog_file_selected"]
[connection signal="file_selected" from="Titlebar/File/Save" to="Exporter" method="_on_save_file_selected"]
[connection signal="file_selected" from="Titlebar/File/New" to="Titlebar/File" method="_on_new_file_selected"]
[connection signal="close_requested" from="Titlebar/Help/About" to="Titlebar/Help" method="_on_about_close_requested"]
[connection signal="item_selected" from="VSplitContainer/Toolbar/ChoosePalette" to="VSplitContainer/Toolbar/Palettes/Triles" method="_on_choose_palette_item_selected"]
[connection signal="levelJSON" from="Loader" to="Titlebar/File" method="_on_loader_level_json"]
[connection signal="levelJSON" from="Loader" to="Titlebar/View" method="_on_loader_level_json"]
[connection signal="levelJSON" from="Loader" to="Sidebar/SidebarVertical/EditorLog" method="_on_loader_level_json"]
[connection signal="loadedTS" from="Loader" to="Toolbar/Palette" method="_on_loader_loaded_ts"]
[connection signal="levelJSON" from="Loader" to="VSplitContainer/Sidebar/SidebarVertical/EditorLog" method="_on_loader_level_json"]
[connection signal="loadedTS" from="Loader" to="VSplitContainer/Toolbar/Palettes/Triles" method="_on_loader_loaded_ts"]
[connection signal="newCurPor" from="Loader" to="." method="_on_loader_new_cur_por"]
5 changes: 5 additions & 0 deletions Scripts/Cursor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func tweenToPos(obj: Object, property: NodePath, direction: Variant, action, spe
allowMove = false

var tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CIRC)

if typeof(direction) == TYPE_VECTOR3: # Round position down.
direction = round(direction)

tween.tween_property(obj, property, direction, speed)
emit_signal("hasMoved", action)

Expand All @@ -40,6 +44,7 @@ func _process(_delta):

func _unhandled_input(_event):
if allowMove: # Movement control. Why does this have to be a bunch of if statements?
# Yes, this is reversed, but that's because of the position of the camera.
var forward = transform.basis.z; var right = -transform.basis.x
var _moveTo = Vector3.ZERO # Prevent cursor from going below (0, 0, 0)

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Exporter/Exporter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func _saveFEZLVL(path, filename):
"StartingPoint":
var id = obj.get_meta("Id")
var face = obj.get_meta("Face")
var spDict = { "Id": id, "Face": face}
var spDict = { "Id": [id[0], id[1], id[2] - 1], "Face": face}

template["StartingPosition"] = spDict
pass
Expand Down
Loading

0 comments on commit ef00f4c

Please sign in to comment.