From 3f2a9bd8d43828b6d6c6d3d983b8ff48080ad27c Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Tue, 26 Oct 2021 21:19:37 -0500 Subject: [PATCH] Do not export BG0 tile descriptors ith the mask bit set if there is only one layer defined --- tools/tiled2iigs.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/tiled2iigs.js b/tools/tiled2iigs.js index 70f7ead..23b8650 100644 --- a/tools/tiled2iigs.js +++ b/tools/tiled2iigs.js @@ -197,6 +197,9 @@ function findAnimatedTiles(tileset) { return animations; } +// Global reference object +let GLOBALS = {}; + /** * Command line arguments * @@ -246,6 +249,13 @@ async function main(argv) { // Load up any/all tilesets const tileSets = await Promise.all(doc.tilesets.map(tileset => loadTileset(workdir, tileset))); + // Create a global reference object + GLOBALS = { + outdir, + tileSets, + tileLayers + }; + // Save all of the tilesets let bg0TileSet = null; @@ -398,7 +408,7 @@ function convertTileID(tileId, tileset) { // The tileId starts at one, but the tile set starts at zero. It's ok when we export, // because a special zero tile is inserted, but we have to manually adjust here - const mask_bit = !tileset[tileIndex - 1].isSolid; + const mask_bit = (!tileset[tileIndex - 1].isSolid) && (GLOBALS.tileLayers.length !== 1); // Build up a partial set of control bits let control_bits = (mask_bit ? GTE_MASK_BIT : 0) + (hflip ? GTE_HFLIP_BIT : 0) + (vflip ? GTE_VFLIP_BIT : 0);