From 6de69604d9166124c99700a36f007891302e3024 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Tue, 25 May 2021 17:27:41 -0600 Subject: [PATCH] Extend CCL support with a chunk for storing the author's name --- js/format-dat.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/format-dat.js b/js/format-dat.js index 4d809e2..a5e41e9 100644 --- a/js/format-dat.js +++ b/js/format-dat.js @@ -391,6 +391,10 @@ function parse_level(bytes, number) { // Password, but not encoded // TODO ??? } + else if (field_type === 0x09) { + // EXTENSION: Author, including trailing NUL + level.author = util.string_from_buffer_ascii(bytes, p, field_length - 1); + } else if (field_type === 0x0a) { // Initial actor order // TODO ??? should i... trust this... @@ -639,6 +643,10 @@ export function synthesize_level(stored_level) { if (hint_text !== null) { add_block(7, util.bytestring_to_buffer(hint_text.substring(0, 127) + "\0")); } + // EXTENSION: Author's name, if present + if (stored_level.author) { + add_block(9, util.bytestring_to_buffer(stored_level.author.substring(0, 255) + "\0")); + } // Monster positions (dumb as hell and only used in MS mode) if (monster_coords.length > 0) { if (monster_coords.length > 256) {