Add some junction-inspired ability icons

This commit is contained in:
Luke Hubmayer-Werner 2023-08-04 22:11:42 +09:30
parent 72e193f8e0
commit 2c667cf539
13 changed files with 98 additions and 29 deletions

View File

@ -61,6 +61,8 @@ func load_save_slot(buffer: StreamPeerBuffer) -> Dictionary:
# Like deserialize_save_slot, but also decodes strings and maybe other postprocessing later
var data = deserialize_save_slot(buffer)
data.character_names_decoded = StringLoader.decode_array(data.character_names, 'RPGe_small')
for c in data.characters:
c.equipped_abilities = [c.ability_1, c.ability_2, c.ability_3, c.ability_4]
return data
func serialize_save_slot(data: Dictionary) -> StreamPeerBuffer:

View File

@ -87,11 +87,10 @@ func load_snes_rom(rom: File, is_RPGe: bool = false) -> void:
tables[block_name] = strings
func get_ability_name(id: int) -> String:
var l = 128
if id < l:
if id < 128:
return tables.battle_commands[id]
else:
return tables.ability_names[id-l]
return tables.ability_names[id-128]
func _ready() -> void:
pass

View File

@ -22,6 +22,18 @@ func set_menu_color_555(r5: int, g5: int, b5: int) -> void:
self.menu_b5 = b5
self.update_configuration_warning()
# Not really theme as such, move later?
const icon_ability_command := preload('res://theme/icons/ability_command.tres')
const icon_ability_character := preload('res://theme/icons/ability_character.tres')
const icon_ability_party := preload('res://theme/icons/ability_party.tres')
const icon_ability_menu := preload('res://theme/icons/ability_menu.tres')
func get_ability_icon(id: int) -> Texture:
if id < 128:
return icon_ability_command
if ((0x9A <= id) and (id <= 0x9E)) or (id == 0xA0):
return icon_ability_party
return icon_ability_character
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
border_texture.create_from_image(border_image, 0)

View File

@ -6,7 +6,8 @@ var save_slot_dicts = []
func _ready():
Engine.set_target_fps(60)
var save_file := File.new()
var error := save_file.open('test.srm', File.READ)
#var error := save_file.open('test.srm', File.READ)
var error := save_file.open('/home/luke/.config/Mesen2/Saves/FF5_SCC_WepTweaks_Inus_Dash.srm', File.READ)
if error == OK:
for i in 4:
save_slots.append(SaveLoader.get_save_slot(save_file, i))
@ -19,4 +20,7 @@ func _ready():
# save_file.seek(0x2FA0)
# buffer.data_array = save_file.get_buffer(0x600)
# save_slot_dicts.append(SaveLoader.get_struct(buffer, 'Save_slot'))
$PartyMenu.update_labels(save_slot_dicts[0])
var data = save_slot_dicts[0]
data.characters[2].ability_4 = 0x9B
$PartyMenu.update_labels(data)
ThemeManager.set_menu_color_555(data.config.menu_color_r, data.config.menu_color_g, data.config.menu_color_b)

View File

@ -24,3 +24,4 @@ visible = false
visible = false
[node name="PartyMenu" parent="." instance=ExtResource( 1 )]
margin_right = 320.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://theme/ThemeElements.png" type="Texture" id=1]
[resource]
atlas = ExtResource( 1 )
region = Rect2( 64, 14, 12, 12 )

View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://theme/ThemeElements.png" type="Texture" id=1]
[resource]
atlas = ExtResource( 1 )
region = Rect2( 64, 1, 12, 12 )

View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://theme/ThemeElements.png" type="Texture" id=1]
[resource]
atlas = ExtResource( 1 )
region = Rect2( 64, 40, 12, 12 )

View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=2]
[ext_resource path="res://theme/ThemeElements.png" type="Texture" id=1]
[resource]
atlas = ExtResource( 1 )
region = Rect2( 64, 27, 12, 12 )

View File

@ -19,21 +19,17 @@ margin_right = -8.0
margin_bottom = -8.0
[node name="PartyMenuCharacter" parent="characters" instance=ExtResource( 3 )]
margin_right = 240.0
[node name="PartyMenuCharacter2" parent="characters" instance=ExtResource( 3 )]
margin_top = 58.0
margin_right = 240.0
margin_bottom = 108.0
[node name="PartyMenuCharacter3" parent="characters" instance=ExtResource( 3 )]
margin_top = 116.0
margin_right = 240.0
margin_bottom = 166.0
[node name="PartyMenuCharacter4" parent="characters" instance=ExtResource( 3 )]
margin_top = 174.0
margin_right = 240.0
margin_bottom = 224.0
[node name="rightside" type="VBoxContainer" parent="."]

View File

@ -3,6 +3,9 @@ extends ReferenceRect
onready var rect_frontrow := Rect2($ref0/ref_frontrow.rect_position, $ref0/ref_frontrow.rect_size)
onready var rect_backrow := Rect2($ref0/ref_backrow.rect_position, $ref0/ref_backrow.rect_size)
onready var row_rects := [rect_frontrow, rect_backrow]
onready var ls = [$ref_commands/l1, $ref_commands/l2, $ref_commands/l3, $ref_commands/l4]
onready var ts = [$ref_commands/t1, $ref_commands/t2, $ref_commands/t3, $ref_commands/t4]
var t1s = [] # Ability icon shadows
func update_labels(data: Dictionary, i: int):
var c = data.characters[i]
@ -19,10 +22,10 @@ func update_labels(data: Dictionary, i: int):
$ref1/lbl_hp_max.text = '%d' % c.hp_max
$ref1/lbl_mp_cur.text = '%d/' % c.mp_current
$ref1/lbl_mp_max.text = '%d' % c.mp_max
$'ref_commands/1'.text = StringLoader.get_ability_name(c.ability_1)
$'ref_commands/2'.text = StringLoader.get_ability_name(c.ability_2)
$'ref_commands/3'.text = StringLoader.get_ability_name(c.ability_3)
$'ref_commands/4'.text = StringLoader.get_ability_name(c.ability_4)
for i in 4:
ls[i].text = StringLoader.get_ability_name(c.equipped_abilities[i])
ts[i].texture = ThemeManager.get_ability_icon(c.equipped_abilities[i])
t1s[i].texture = ts[i].texture
# Draw character battle sprite in either ref_frontrow or ref_backrow
$ref0/PC.position = row_rects[c.is_back_row].position
$ref0/PC.material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[cj_idx])
@ -31,8 +34,9 @@ func update_labels(data: Dictionary, i: int):
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass
for t in ts:
t1s.append(t.duplicate(0))
t1s[-1].rect_position += Vector2(1, 1)
t1s[-1].modulate = Color(0, 0, 0, 0.5)
$ref_commands.add_child(t1s[-1])
$ref_commands.move_child(t1s[-1], 0)

View File

@ -4,9 +4,9 @@
[ext_resource path="res://PC.tscn" type="PackedScene" id=2]
[node name="PartyMenuCharacter" type="ReferenceRect"]
margin_right = 180.0
margin_right = 252.0
margin_bottom = 50.0
rect_min_size = Vector2( 240, 50 )
rect_min_size = Vector2( 252, 50 )
size_flags_horizontal = 0
size_flags_vertical = 0
script = ExtResource( 1 )
@ -146,28 +146,51 @@ border_color = Color( 0, 1, 0, 1 )
[node name="ref_commands" type="ReferenceRect" parent="."]
margin_left = 168.0
margin_right = 240.0
margin_right = 252.0
margin_bottom = 50.0
[node name="1" type="Label" parent="ref_commands"]
margin_right = 72.0
[node name="l1" type="Label" parent="ref_commands"]
margin_left = 12.0
margin_right = 84.0
margin_bottom = 14.0
text = "Fight"
[node name="2" type="Label" parent="ref_commands"]
[node name="l2" type="Label" parent="ref_commands"]
margin_left = 12.0
margin_top = 12.0
margin_right = 72.0
margin_right = 84.0
margin_bottom = 26.0
text = "Guard"
[node name="3" type="Label" parent="ref_commands"]
[node name="l3" type="Label" parent="ref_commands"]
margin_left = 12.0
margin_top = 24.0
margin_right = 72.0
margin_right = 84.0
margin_bottom = 38.0
text = "DragnSwd"
[node name="4" type="Label" parent="ref_commands"]
[node name="l4" type="Label" parent="ref_commands"]
margin_left = 12.0
margin_top = 36.0
margin_right = 72.0
margin_right = 84.0
margin_bottom = 50.0
text = "Item"
[node name="t1" type="TextureRect" parent="ref_commands"]
margin_right = 12.0
margin_bottom = 12.0
[node name="t2" type="TextureRect" parent="ref_commands"]
margin_top = 12.0
margin_right = 12.0
margin_bottom = 24.0
[node name="t3" type="TextureRect" parent="ref_commands"]
margin_top = 24.0
margin_right = 12.0
margin_bottom = 36.0
[node name="t4" type="TextureRect" parent="ref_commands"]
margin_top = 36.0
margin_right = 12.0
margin_bottom = 48.0