UNPKG

homm3-parsers

Version:

Collection of binary parsers able to parse various file formats related to Heroes of Might and Magic III

10 lines 930 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const binary_markup_1 = require("binary-markup"); const bgr = binary_markup_1.bytes(3); exports.pcxFile = binary_markup_1.struct(binary_markup_1.endian(binary_markup_1.Endian.LE), binary_markup_1.uint32 `size`, binary_markup_1.uint32 `width`, binary_markup_1.uint32 `height`, binary_markup_1.computed((context) => context.get('size') === context.get('width') * context.get('height')) `hasPalette`, binary_markup_1.when(binary_markup_1.ctx `hasPalette`, binary_markup_1.struct( // binary_markup_1.bytes(binary_markup_1.ctx `size`) `pixels`, binary_markup_1.array(bgr, 256) `palette`)) `paletteData`, binary_markup_1.computed((context) => context.get('size') === context.get('width') * context.get('height') * 3) `hasBgr`, binary_markup_1.when( // binary_markup_1.ctx `hasBgr`, binary_markup_1.greedyArray(bgr)) `bgr`); //# sourceMappingURL=pcx.bml.js.map