diff --git a/PC.tscn b/PC.tscn index 34f4d56..00a8d7a 100644 --- a/PC.tscn +++ b/PC.tscn @@ -2,6 +2,5 @@ [ext_resource path="res://PC.gd" type="Script" id=1] -[node name="Node2D" type="Node2D"] +[node name="PC" type="Node2D"] script = ExtResource( 1 ) - diff --git a/theme/border_imagetexture_black.tres b/theme/border_imagetexture_black.tres new file mode 100644 index 0000000..9998176 --- /dev/null +++ b/theme/border_imagetexture_black.tres @@ -0,0 +1,16 @@ +[gd_resource type="ImageTexture" load_steps=2 format=2] + +[sub_resource type="Image" id=1] +data = { +"data": PoolByteArray( 31, 0, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 0, 128, 255, 128, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 128, 255, 128, 255, 128, 255, 255, 255, 255, 255, 128, 255, 128, 255, 128, 255, 128, 255, 255, 255, 255, 255, 128, 255, 128, 255, 255, 255, 128, 255, 128, 255, 0, 255, 0, 255, 128, 255, 128, 255, 255, 255, 128, 255, 128, 255, 255, 255, 128, 255, 0, 255, 0, 255, 0, 255, 0, 255, 128, 255, 255, 255, 128, 255, 128, 255, 255, 255, 128, 255, 0, 255, 0, 255, 0, 255, 0, 255, 128, 255, 255, 255, 128, 255, 128, 255, 255, 255, 128, 255, 128, 255, 0, 255, 0, 255, 128, 255, 128, 255, 255, 255, 128, 255, 128, 255, 255, 255, 255, 255, 128, 255, 128, 255, 128, 255, 128, 255, 255, 255, 255, 255, 128, 255, 128, 255, 128, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 128, 255, 128, 255, 128, 0, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 255, 128, 0 ), +"format": "LumAlpha8", +"height": 10, +"mipmaps": false, +"width": 10 +} + +[resource] +flags = 2 +flags = 2 +image = SubResource( 1 ) +size = Vector2( 10, 10 ) diff --git a/theme/border_stylebox_black.tres b/theme/border_stylebox_black.tres new file mode 100644 index 0000000..de84fd3 --- /dev/null +++ b/theme/border_stylebox_black.tres @@ -0,0 +1,11 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=2] + +[ext_resource path="res://theme/border_imagetexture_black.tres" type="Texture" id=1] + +[resource] +texture = ExtResource( 1 ) +region_rect = Rect2( 0, 0, 10, 10 ) +margin_left = 4.0 +margin_right = 4.0 +margin_top = 4.0 +margin_bottom = 4.0 diff --git a/widgets/RomSelect.gd b/widgets/RomSelect.gd index 7d7eed1..a84c52c 100644 --- a/widgets/RomSelect.gd +++ b/widgets/RomSelect.gd @@ -150,7 +150,7 @@ func view_entry(entry: String, index: int = -1): var s = key.trim_prefix('./') var re_match := RomLoader.psx_productcode_regex.search(s) if re_match: - prodcode = '%s\n %s\n %s' % [cd.pvd.system_identifier.strip_edges(), cd.pvd.volume_identifier.strip_edges(), re_match.get_string(1)] + prodcode = '%s\n%s\n%s' % [cd.pvd.system_identifier.strip_edges(), cd.pvd.volume_identifier.strip_edges(), re_match.get_string(1)] type = 'PSX CD-ROM Image' cached_cd_bin_paths[filename] = prodcode if index >= 0: diff --git a/widgets/SaveSlot.gd b/widgets/SaveSlot.gd new file mode 100644 index 0000000..9be72fe --- /dev/null +++ b/widgets/SaveSlot.gd @@ -0,0 +1,56 @@ +extends PanelContainer +const PC := preload('res://PC.tscn') +var PCs = [] + +var dummy_data := { + 'characters': [ + {'character_id': 0}, + {'character_id': 1}, + {'character_id': 2}, + {'character_id': 3}, + ], + 'game_time_frames': randi() % 0x01000000, + 'character_names': ['Butz', 'Lenna', 'Galuf', 'Faris', 'Krile'], + 'config': {'menu_color_r': randi()%32, 'menu_color_g': randi()%32, 'menu_color_b': randi()%32} +} + +func _init_dummy(): + for i in 4: + var c = dummy_data.characters[i] + c.level = 1 + (randi()%99) + c.current_job_id = randi()%22 + c.hp_max = (50*c.level) + (randi()%(100 + 50*c.level)) + c.hp_current = 1 + (randi()%c.hp_max) + dummy_data.characters.shuffle() + +func set_data(data: Dictionary): + self.material.set_shader_param('MenuBGColour', Color(data.config.menu_color_r/31.0, data.config.menu_color_g/31.0, data.config.menu_color_b/31.0)) + for i in 4: + var char_id: int = data.characters[i].character_id + var job_id: int = data.characters[i].current_job_id + var sprite_id := (char_id * 22) + job_id + PCs[i].material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[sprite_id]) + PCs[i].texture = SpriteLoader.strip_textures[sprite_id] + $HBoxContainer/right_labels/HBoxContainer/lbl_level_num.text = '%d' % data.characters[0].level + var game_seconds = data.game_time_frames / 60 + var game_minutes = game_seconds / 60 + var game_hours = game_minutes / 60 + $HBoxContainer/left_labels/lbl_gametime.text = '%d:%02d' % [game_hours, game_minutes % 60] + $HBoxContainer/left_labels/lbl_name.text = data.character_names[data.characters[0].character_id] + $HBoxContainer/right_labels/lbl_hp.text = '%d/%4d' % [data.characters[0].hp_current, data.characters[0].hp_max] + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + _init_dummy() + self.material = self.material.duplicate() + for i in 4: + var pc = PC.instance() + pc.set_position(Vector2(i*24, 8)) + $HBoxContainer/PCs.add_child(pc) + PCs.append(pc) + set_data(dummy_data) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta: float) -> void: +# pass diff --git a/widgets/SaveSlot.tscn b/widgets/SaveSlot.tscn new file mode 100644 index 0000000..2ec0306 --- /dev/null +++ b/widgets/SaveSlot.tscn @@ -0,0 +1,88 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://theme/menu_theme.tres" type="Theme" id=1] +[ext_resource path="res://PC.tscn" type="PackedScene" id=2] +[ext_resource path="res://shaders/box_shadermat.tres" type="Material" id=3] +[ext_resource path="res://theme/border_stylebox_black.tres" type="StyleBox" id=4] +[ext_resource path="res://widgets/SaveSlot.gd" type="Script" id=5] + +[node name="SaveSlot" type="PanelContainer"] +material = ExtResource( 3 ) +theme = ExtResource( 1 ) +custom_styles/panel = ExtResource( 4 ) +script = ExtResource( 5 ) + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 220.0 +margin_bottom = 40.0 + +[node name="left_labels" type="VBoxContainer" parent="HBoxContainer"] +margin_right = 40.0 +margin_bottom = 36.0 +rect_min_size = Vector2( 40, 0 ) + +[node name="lbl_name" type="Label" parent="HBoxContainer/left_labels"] +margin_right = 40.0 +margin_bottom = 14.0 +size_flags_vertical = 1 +text = "Butz" + +[node name="lbl_gametime" type="Label" parent="HBoxContainer/left_labels"] +margin_top = 22.0 +margin_right = 40.0 +margin_bottom = 36.0 +size_flags_vertical = 8 +text = "13:42" +align = 2 + +[node name="PCs" type="Control" parent="HBoxContainer"] +margin_left = 48.0 +margin_right = 136.0 +margin_bottom = 36.0 +rect_min_size = Vector2( 88, 0 ) + +[node name="PC1" parent="HBoxContainer/PCs" instance=ExtResource( 2 )] + +[node name="PC2" parent="HBoxContainer/PCs" instance=ExtResource( 2 )] +position = Vector2( 24, 0 ) + +[node name="PC3" parent="HBoxContainer/PCs" instance=ExtResource( 2 )] +position = Vector2( 48, 0 ) + +[node name="PC4" parent="HBoxContainer/PCs" instance=ExtResource( 2 )] +position = Vector2( 72, 0 ) + +[node name="right_labels" type="VBoxContainer" parent="HBoxContainer"] +margin_left = 144.0 +margin_right = 216.0 +margin_bottom = 36.0 +rect_min_size = Vector2( 72, 0 ) + +[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/right_labels"] +margin_right = 72.0 +margin_bottom = 14.0 + +[node name="lbl_level" type="Label" parent="HBoxContainer/right_labels/HBoxContainer"] +margin_right = 15.0 +margin_bottom = 14.0 +size_flags_vertical = 1 +text = "LV" + +[node name="lbl_level_num" type="Label" parent="HBoxContainer/right_labels/HBoxContainer"] +margin_left = 23.0 +margin_right = 72.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +text = "33" +align = 2 + +[node name="lbl_hp" type="Label" parent="HBoxContainer/right_labels"] +margin_top = 22.0 +margin_right = 72.0 +margin_bottom = 36.0 +size_flags_vertical = 9 +text = "1345/1345" +align = 2 diff --git a/widgets/SaveSlotSelect.tscn b/widgets/SaveSlotSelect.tscn new file mode 100644 index 0000000..60d3ca3 --- /dev/null +++ b/widgets/SaveSlotSelect.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://theme/menu_theme.tres" type="Theme" id=1] +[ext_resource path="res://widgets/SaveSlot.tscn" type="PackedScene" id=2] + +[node name="SaveSlotSelect" type="PanelContainer"] +theme = ExtResource( 1 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 228.0 +margin_bottom = 202.0 +custom_constants/separation = 0 + +[node name="Button" type="Button" parent="VBoxContainer"] +margin_right = 224.0 +margin_bottom = 22.0 +text = "New Game" + +[node name="SaveSlot1" parent="VBoxContainer" instance=ExtResource( 2 )] +margin_top = 22.0 +margin_right = 224.0 +margin_bottom = 66.0 + +[node name="SaveSlot2" parent="VBoxContainer" instance=ExtResource( 2 )] +margin_top = 66.0 +margin_right = 224.0 +margin_bottom = 110.0 + +[node name="SaveSlot3" parent="VBoxContainer" instance=ExtResource( 2 )] +margin_top = 110.0 +margin_right = 224.0 +margin_bottom = 154.0 + +[node name="SaveSlot4" parent="VBoxContainer" instance=ExtResource( 2 )] +margin_top = 154.0 +margin_right = 224.0 +margin_bottom = 198.0