ChocolateBird/scripts/loaders/map_loader.gd

56 lines
2.4 KiB
GDScript

extends Node
# World Map Block Properties
# 3 bytes
# Byte0: movement properties
# 0x01 = passable on foot
# 0x02 = passable on chocobo?
# 0x04 = passable on black chocobo
# 0x08 = passable on hiryuu?
# 0x10 = passable in submarine? set on deep water tiles, and all undersea tiles that aren't cliffs
# 0x20 = passable in ship? set on deep water tiles only (not undersea) - can submerge?
# 0x40 = passable in airship? Pretty much every tile aboveground has this. No undersea.
# 0x80 = only set on clear sea floor. Submarine pathable/can surface?
# Byte1: movement properties
# 0x01 = (water flips) can move from this block rightwards
# 0x02 = (water flips) can move from this block leftwards
# 0x04 = (water flips) can move from this block downwards
# 0x08 = (water flips) can move from this block upwards
# 0x10 = Chocobo can't land/dismount. most aboveground water tiles
# 0x20 = Black Chocobo can't land.
# 0x40 = Hiryuu can't land.
# 0x80 = Airship can't land.
# Byte2: movement properties
# 0x01 = Set on forests, deep water, void.
# 0x02 = Set on deep water, void, desert.
# 0x04 = Only set on diagonal land corners and Galuf World swamp
# 0x08 = No hits.
# 0x10 = Mountains and Exdeath's Castle
# 0x20 = Set on first two rows of forests, also waterfall, but not lower bounds of forests
# 0x40 = Shallow water.
# 0x80 =
# Vehicle landing bit masks: [00 10 20 40 00 00 80] - & with Byte1, if 1, can't land
# Vehicle IDs: [None, Chocobo, BlkChocobo, Hiryuu, Submarine, Ship, Airship]
# Worldmap animations
# World 1 (and probably 3)
# Sea tiles and waterfall tiles have a scrolling effect in tile data
# This may require setting up a proper tile indirect lookup shader
# Shifting sands and the portal have cycling palettes: $6C and $6D swap every frame, $51 through $55 scroll left (i.e. $55->$54, $51->$55)
# This will be best hardcoded as a 10 palette cycle
# World 2:
# Sea tiles have a horizontal scrolling effect in tile data (addresses $1880, $18C0, $1C80, $1CC0)
# ASM at C09660 BF 21 86 7F LDA $7F8621,X
# Probably going to shader this effect instead of storing hundreds of frames
# No palette cycling
var worldmap_block_properties = []
func load_worldmap_block_properties(rom: File):
rom.seek(0x0FEA00)
for world_ts in 3:
var ts_properties = PoolIntArray()
for block in 0xC0:
ts_properties.append(rom.get_16() + (rom.get_8() << 16))
worldmap_block_properties.append(ts_properties)