From 6ef2a1eb746fc819f97da808e0f5ccd4d0344a6a Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 5 Nov 2023 10:46:34 -0500 Subject: [PATCH] Add number of metatiles to dmapack structure --- src/reskit/level/system.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reskit/level/system.rs b/src/reskit/level/system.rs index 6ec8630..111dc38 100644 --- a/src/reskit/level/system.rs +++ b/src/reskit/level/system.rs @@ -109,11 +109,12 @@ pub fn get_tiles( tilemap: &TiledTilemap ) -> Result<(Vec, Vec), Box>> * 2 bytes: The offset to the instances table + * 2 bytes: The number of metatiles in the `dmapack` structure * For each metatile: * 2 bytes: Metatile width * 2 bytes: Metatile height @@ -136,7 +137,7 @@ pub fn get_metatile_maps( tilemap: &TiledTilemap ) -> Result, Box = vec![]; // Get offsets for each bucket @@ -246,6 +247,8 @@ pub fn get_metatile_maps( tilemap: &TiledTilemap ) -> Result, Box = vec![]; let offset_to_instances = header_offset + definitions.len(); result.extend( ( offset_to_instances as u16 ).to_be_bytes() ); + let num_metatiles: u16 = tilemap.metatiles.len() as u16; + result.extend( num_metatiles.to_be_bytes() ); result.extend( header ); result.extend( definitions ); result.extend( instances );