Index: customsubs.bas =================================================================== --- customsubs.bas (revision 2282) +++ customsubs.bas (working copy) @@ -1013,8 +1013,24 @@ LoadTextBox box, i '--Write the header guide PRINT #fh, "======================================" - '--Write the box number and separator + '--Write the box number and metadata PRINT #fh, "Box " & i + PRINT #fh, "Size: " & (21 - box.shrink) + IF box.portrait_box <> NO OR box.portrait_type <> 0 THEN + IF box.portrait_box = NO THEN + PRINT #fh, "Portrait Box: NO" + ELSE + PRINT #fh, "Portrait Box: YES" + END IF + END IF + IF box.portrait_type <> 0 THEN + PRINT #fh, "Portrait Type: " & box.portrait_type + PRINT #fh, "Portrait ID: " & box.portrait_id + IF box.portrait_pal <> -1 THEN PRINT #fh, "Portrait Palette: " & box.portrait_pal + PRINT #fh, "Portrait X: " & box.portrait_pos.X + PRINT #fh, "Portrait Y: " & box.portrait_pos.Y + END IF + '--Write the separator PRINT #fh, "--------------------------------------" blank = 0 FOR j = 0 TO 7 @@ -1086,6 +1102,8 @@ debug "import_textboxes: line " & line_number & ": box ID numbers out-of-order. Expected " & index & ", but found " & getindex END IF index = getindex + LoadTextBox box, index + boxlines = 0 mode = 1 ELSE import_textboxes_warn warn, "line " & line_number & ": expected Box # but found """ & s & """." @@ -1094,13 +1112,39 @@ END IF CASE 1 '--Seek divider IF s = STRING(38, "-") THEN - LoadTextBox box, index - boxlines = 0 mode = 2 ELSE - import_textboxes_warn warn, "line " & line_number & ": expected divider line but found """ & s & """." - CLOSE #fh - RETURN NO + IF LEFT(s, 5) = "Size:" THEN + IF VALINT(MID(s, 6)) > 20 THEN + debug "Box size too large, capping" + box.shrink = 0 + ELSE + box.shrink = 21 - VALINT(MID(s, 6)) + END IF + ELSEIF LEFT(s, 13) = "Portrait Box:" THEN + IF LCASE(TRIM(MID(s, 14))) = "yes" THEN + box.portrait_box = YES + ELSEIF LCASE(TRIM(MID(s, 14))) = "no" THEN + box.portrait_box = NO + ELSE + debug "Unknown value for 'Portrait Box' field" + END IF + ELSEIF LEFT(s, 14) = "Portrait Type:" THEN + box.portrait_type = VALINT(MID(s, 15)) + ELSEIF LEFT(s, 12) = "Portrait ID:" THEN + box.portrait_id = VALINT(MID(s, 13)) + ELSEIF LEFT(s, 11) = "Portrait X:" THEN + box.portrait_pos.x = VALINT(MID(s, 12)) + ELSEIF LEFT(s, 11) = "Portrait Y:" THEN + box.portrait_pos.y = VALINT(MID(s, 12)) + ELSEIF LEFT(s, 17) = "Portrait Palette:" THEN + box.portrait_pal = VALINT(MID(s, 18)) + '-- Other metadata can go here + ELSE + import_textboxes_warn warn, "line " & line_number & ": expected divider line but found """ & s & """." + CLOSE #fh + RETURN NO + END IF END IF CASE 2 '--Text lines IF s = STRING(38, "=") THEN