diff --git a/data/string_blocks.tsv b/data/string_blocks.tsv index 44c97a7..dfe7632 100644 --- a/data/string_blocks.tsv +++ b/data/string_blocks.tsv @@ -6,7 +6,7 @@ dialogue 0x900 0x2013F0 0x082220 3 2 0x000000 0x0A0000 True enemy_names 384 0x200050 0x105C00 10 8 items 0x100 0x111380 9 job_names 22 0x115600 8 -job_and_ability_descs 133 0x117140 2 0x110000 0x110000 +job_and_ability_descs 133 0x117140 2 0x110000 0x110000 True magics 87 0x111C80 6 magics2 73 0x111E8A 9 menu_strings 139 0x00F987 2 0x270000 0x000000 True diff --git a/scripts/loaders/StringLoader.gd b/scripts/loaders/StringLoader.gd index 2598565..891c7f4 100644 --- a/scripts/loaders/StringLoader.gd +++ b/scripts/loaders/StringLoader.gd @@ -83,14 +83,30 @@ func load_snes_rom(rom: File, is_RPGe: bool = false) -> void: else: for raw in raw_strings: strings.append(decode_string(raw, glyph_table_small)) - tables_raw[block_name] = raw_strings - tables[block_name] = strings + self.tables_raw[block_name] = raw_strings + self.tables[block_name] = strings func get_ability_name(id: int) -> String: if id < 128: - return tables.battle_commands[id] + return self.tables.battle_commands[id] else: - return tables.ability_names[id-128] + return self.tables.ability_names[id-128] + +func get_ability_desc(id: int) -> String: + # TODO: revisit for GBA + if id < 78: + return self.tables.job_and_ability_descs[id+22] + elif (id >= 128) and (id <= 161): + return self.tables.job_and_ability_descs[(id-128)+100] + else: + assert(false, 'ability id %d out of description ranges' % id) + return 'ability id %d out of description ranges' % id + +func get_job_name(id: int) -> String: + return self.tables.job_names[id] + +func get_job_desc(id: int) -> String: + return self.tables.job_and_ability_descs[id] func _ready() -> void: pass diff --git a/test_scene.gd b/test_scene.gd index 0345a2d..024f1ec 100644 --- a/test_scene.gd +++ b/test_scene.gd @@ -24,3 +24,12 @@ func _ready(): data.characters[2].equipped_abilities[3] = 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) + + var lbl = Label.new() + for i in 22: + lbl.text = lbl.text + '%s - %s\n' % [StringLoader.get_job_name(i), StringLoader.get_job_desc(i)] + for i in 78: + lbl.text = lbl.text + '\n%s - %s' % [StringLoader.get_ability_name(i), StringLoader.get_ability_desc(i)] + for i in range(128, 161): + lbl.text = lbl.text + '\n%s - %s' % [StringLoader.get_ability_name(i), StringLoader.get_ability_desc(i)] + add_child(lbl)