Reorganize data definitions for easier reuse in other projects

This commit is contained in:
Luke Hubmayer-Werner 2024-06-26 16:52:24 +09:30
parent 8436a35670
commit 6d98365ecc
9 changed files with 74 additions and 5 deletions

View File

@ -18,6 +18,7 @@ enemy_battle_sprite_palettes 0x0ED000 See enemy_battle_sprite_data for pointe
worldmap_blocks 0x0FF0C0 /nar/ff5_binx.bin 0x040300 3 of 4 of 192 of u8 # Top-left corners, top-right corners, bottom-left corners, bottom-right corners
worldmap_tiles.bias 0x0FF9C0 /nar/ff5_bin3.bin 0x03FB00 3 of 256 of u8 Add to each pixel of the mode7c tiles
worldmap_palettes 0x0FFCC0 /nar/ff5_binx.bin 0x040000 3 of Palette128Of555
enemy_stats 0x100000 384 of EnemyStats
enemy_battle_sprite_layouts_small 0x10D004 102 of 8 of u8 length 0x330
enemy_battle_sprite_layouts_large 0x10D334 72 of 16 of u16 length 0x900
enemy_battle_sprite_mini 0x10E003 4 of TileSNES4bpp length 0x80
1 Label SNES PSX_file PSX_offset format Comment
18 worldmap_blocks 0x0FF0C0 /nar/ff5_binx.bin 0x040300 3 of 4 of 192 of u8 # Top-left corners, top-right corners, bottom-left corners, bottom-right corners
19 worldmap_tiles.bias 0x0FF9C0 /nar/ff5_bin3.bin 0x03FB00 3 of 256 of u8 Add to each pixel of the mode7c tiles
20 worldmap_palettes 0x0FFCC0 /nar/ff5_binx.bin 0x040000 3 of Palette128Of555
21 enemy_stats 0x100000 384 of EnemyStats
22 enemy_battle_sprite_layouts_small 0x10D004 102 of 8 of u8 length 0x330
23 enemy_battle_sprite_layouts_large 0x10D334 72 of 16 of u16 length 0x900
24 enemy_battle_sprite_mini 0x10E003 4 of TileSNES4bpp length 0x80

View File

@ -136,3 +136,30 @@ u8 tilemap_flips_id
u8 tilemap_v_flips_id # Unused, all 0xFF = no flips
u8 tilecycle_id
u8 palcycle_id
struct EnemyStats
u8 speed
u8 attack_power
u8 attack_multiplier
u8 evasion
u8 defense
u8 magic_power
u8 magic_defense
u8 magic_evasion
u16 max_hp
u16 max_mp
u16 reward_exp
u16 reward_gil
u8 attack_graphics
u8 elements_immune
u24 status_immune
u8 elements_absorb
AttackType attack_type
u8 elements_weak
u8 monster_type
u8 flags_25
u16 status_26
u16 status_28
u8 29
u8 30
u8 level # 31
Can't render this file because it has a wrong number of fields in line 43.

View File

@ -0,0 +1,9 @@
struct ItemCost # All definitions here are intended to be overriden in code, but provide correctly-sized stubs for programs that don't care
u1 is_sellable
u1 is_sellprice_5gil
u6 exponent
u8 mantissa # buy_price = mantissa * int(pow(10, exponent)); sell_price = -1 if not is_sellable else (5 if is_sellprice_5gil else buy_price/2)
struct EquipStatBonus
u1 is_stat_bonus # 0 -> data is elemental bonus bitfield; 1 -> 4bit toggle fields for affected stats, 3bit selector of bonus enum
u7 data # Meaning changes based on is_stat_bonus
Can't render this file because it has a wrong number of fields in line 2.

View File

@ -0,0 +1,29 @@
struct TileSNESMode7 # All definitions here are intended to be overriden in code, but provide correctly-sized stubs for programs that don't care
64 of u8 data
struct TileSNESMode7c
32 of u8 data
struct TileSNES4bpp
32 of u8 data
struct TileSNES3bpp
24 of u8 data
struct TileSNES2bpp
16 of u8 data
struct TileSNES1bpp
8 of u8 data
struct SNESTritile
24 of u8 data
struct ColorBGR555
u16 data
struct Palette16Of555 # Typed PoolColorArray in GDscript
16 of ColorBGR555 data
struct Palette128Of555 # Typed PoolColorArray in GDscript
128 of ColorBGR555 data
Can't render this file because it has a wrong number of fields in line 2.

View File

@ -135,9 +135,11 @@ func _ready():
if THREADED_LOADING:
thread = Thread.new()
structdefs.merge(STRUCT.get_base_structarraytypes())
structdefs.merge(STRUCT_SNES.get_structtypes())
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_save.tsv', structdefs)
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_other.tsv', structdefs)
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/structs_SNES_stubs.tsv', structdefs)
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_stubs.tsv', structdefs)
structdefs.merge(STRUCT_SNES.get_structtypes(), true) # Overwrite the stubs!
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_save.tsv', structdefs)
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES.tsv', structdefs)
var _error := psx_productcode_regex.compile('(S[A-Z]{3}_\\d{3}\\.\\d{2});(\\d)')
# Debugging breakpoint
pass

View File

@ -167,4 +167,4 @@ func delete_save_slot(sram: File, slot_id: int):
sram.store_16(0)
func _ready():
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_save.tsv', struct_types)
STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_save.tsv', struct_types)

View File

@ -6,7 +6,7 @@ var shrink_timer := Timer.new()
var last_resolution_pre_shrink := Vector2.ZERO
var config := ConfigFile.new()
var SNES_PSX_addresses := load_tsv('res://data/SNES_PSX_addresses.tsv')
var SNES_PSX_addresses := load_tsv('res://data/5/addresses_SNES_PSX.tsv')
# Canonicalize english stat names within the codebase
# This is based off of FF8, and is more or less RPGe but with Speed instead of Agility

View File

@ -216,4 +216,5 @@ static func parse_struct_definitions_from_tsv_filename(filename: String, existin
parse_struct_definitions_from_tsv_file(file, existing_structs)
return OK
var error:
print_debug('Error reading tsv '+filename+' - %d'%error)
return error