@scm-js/core 0.8.11 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @scm-js/core 0.8.11 — StarCraft maps as the scmJS editor reads and writes them.
2
+ * @scm-js/core 0.9.1 — StarCraft maps as the scmJS editor reads and writes them.
3
3
  * Generated by `npm run build:core` in github.com/scm-js/scm-js from core/src/index.ts; the guide is docs/core.md.
4
4
  */
5
5
  import { Archive, HashEntry, StoredMember } from 'mopaq';
@@ -631,6 +631,15 @@ export interface SaveOptions {
631
631
  export declare const DEFAULT_SAVE_OPTIONS: SaveOptions;
632
632
  /** The extension of a file name, as a format, when it is one the editor writes. */
633
633
  export declare function formatOf(fileName: string | null | undefined): MapFormat | null;
634
+ /**
635
+ * What Save As starts from: the file's own extension (else `.scm` below the Brood War
636
+ * revision, as StarEdit names them), and the archive stored the way it was opened — a map
637
+ * that came in PKWARE-compressed and encrypted, Blizzard's own layout, goes out the same
638
+ * way. A new map, or one opened from a bare .chk, gets StarEdit's layout too, since it is
639
+ * what every build of the game reads — unless `fresh` names another compression for that
640
+ * case (Preferences ▸ General ▸ Saving), which then goes without the encryption.
641
+ */
642
+ export declare function defaultSaveOptions(scn: Scenario, origin: MemberInfo | null, fileName: string | null, fresh?: "asOpened" | ArchiveCompression): SaveOptions;
634
643
  /** Two ready-made settings the dialog offers as buttons. */
635
644
  export declare const SAVE_PRESETS: {
636
645
  /** Every section and member kept; compression as it is. */
@@ -699,6 +708,16 @@ export declare function extraKind(name: string): ExtraKind;
699
708
  * re-encoded — so a section the editor is about to rewrite is judged on its new size.
700
709
  */
701
710
  export declare function planSave(scn: Scenario, extras: Map<string, Uint8Array>, options: SaveOptions, storedMembers?: StoredMembers | null): SavePlan;
711
+ /** The scenario bytes the plan describes. */
712
+ export declare function buildChk(plan: SavePlan): Uint8Array;
713
+ /** The archive members the plan keeps. */
714
+ export declare function keptExtras(plan: SavePlan, extras: Map<string, Uint8Array>): Map<string, Uint8Array>;
715
+ /**
716
+ * The whole file: the CHK alone for `.chk`, else the archive around it. zlib works best
717
+ * with big sectors; PKWARE and uncompressed use StarEdit's 4 KB, the layout the game's own
718
+ * maps carry.
719
+ */
720
+ export declare function buildMapFile(scn: Scenario, extras: Map<string, Uint8Array>, options: SaveOptions, plan?: SavePlan, stored?: StoredMembers | null): Promise<Uint8Array>;
702
721
  /** Human-readable size. */
703
722
  export declare function formatBytes(n: number): string;
704
723
  export declare const BUILD_SOURCE_MEMBER = "scmjs\\source.chk";
@@ -718,6 +737,23 @@ export interface BuildManifest {
718
737
  /** Members the steps added to the archive; they belong to the built file, not to the map. */
719
738
  added: string[];
720
739
  }
740
+ export interface PackInput {
741
+ /** The scenario as Save would write it without the steps. */
742
+ sourceChk: Uint8Array;
743
+ /** The archive members Save keeps, and the ones it carries as stored. */
744
+ extras: Map<string, Uint8Array>;
745
+ stored: StoredMembers | null;
746
+ /** The last step's output: an archive, or a bare scenario. */
747
+ built: Uint8Array;
748
+ steps: BuiltBy[];
749
+ options: Pick<SaveOptions, "compression" | "encrypt">;
750
+ }
751
+ /**
752
+ * The file that goes to the disk: the built scenario in an archive laid out by the user's
753
+ * save options, the map's own members as they were (a step can add a member, not change
754
+ * one), and the source beside it.
755
+ */
756
+ export declare function packBuiltMap(input: PackInput): Promise<Uint8Array>;
721
757
  export declare function readBuildManifest(bytes: Uint8Array): BuildManifest | null;
722
758
  export type Restored =
723
759
  /** Not a built map. */
@@ -751,6 +787,39 @@ export interface OpenedMap {
751
787
  /** The build steps the file names, when the map was restored from a built one. */
752
788
  builtBy?: BuiltBy[] | null;
753
789
  }
790
+ /** A map file's archive as it is: the scenario's bytes and every other member, nothing restored or parsed. */
791
+ export interface ArchiveContents {
792
+ /** `staredit\scenario.chk` as stored — a built map's built scenario, not its source. */
793
+ chk: Uint8Array;
794
+ /** Every other member read by name. */
795
+ extras: Map<string, Uint8Array>;
796
+ /** Members with no name the archive gives up, carried as stored; null when there are none. */
797
+ stored: StoredMembers | null;
798
+ /** How the scenario was stored; null for a bare .chk. */
799
+ origin: MemberInfo | null;
800
+ /** The archive's (listfile), or null when it has none (a protected map) — or is a bare .chk. */
801
+ files: string[] | null;
802
+ /** What could not be read, in the editor's words. */
803
+ problems: string[];
804
+ }
805
+ /**
806
+ * Read a map file's bytes as an archive: the scenario's bytes and the other members, by name where the archive —
807
+ * its (listfile), what the scenario refers to, a script's manifest, a build's — gives one up, as stored where not.
808
+ * `openMapBytes` builds on this; `scmjs map unpack` takes it as it is.
809
+ */
810
+ export declare function readArchive(bytes: Uint8Array): Promise<ArchiveContents>;
811
+ export interface WriteArchiveOptions {
812
+ extras?: Map<string, Uint8Array>;
813
+ /** Members carried as stored; the archive then keeps their sector size. */
814
+ stored?: StoredMembers | null;
815
+ /** How every member is compressed; uncompressed when omitted. */
816
+ compression?: ArchiveCompression;
817
+ encrypt?: boolean;
818
+ /** Write a (listfile) naming the members (default on). */
819
+ listfile?: boolean;
820
+ }
821
+ /** The archive around a scenario's bytes as given — `readArchive` the other way; the editor's sector rule (zlib likes big sectors). */
822
+ export declare function writeArchiveBytes(chk: Uint8Array, options?: WriteArchiveOptions): Promise<Uint8Array>;
754
823
  /** Read a map file's bytes (.scm, .scx or a bare .chk) into a parsed scenario and the rest of its archive. */
755
824
  export declare function openMapBytes(bytes: Uint8Array, fileName: string | null): Promise<OpenedMap>;
756
825
  export interface WriteOptions {
@@ -840,6 +909,8 @@ export interface UnitsDat {
840
909
  yesSoundStart: Uint16Array;
841
910
  yesSoundEnd: Uint16Array;
842
911
  }
912
+ export declare function decodeUnitsDat(data: Uint8Array): UnitsDat;
913
+ export declare const MEGATILE_PX = 32;
843
914
  export interface Cv5Group {
844
915
  /** Doodad groups store 1 here; terrain groups store a group type. */
845
916
  index: number;
@@ -905,6 +976,26 @@ export interface Tileset {
905
976
  megatileFlags: Uint16Array;
906
977
  groups: Cv5Group[];
907
978
  }
979
+ export interface TilesetFiles {
980
+ cv5: Uint8Array;
981
+ vf4: Uint8Array;
982
+ vr4: Uint8Array;
983
+ /** Pass either the classic .vx4 or the Remastered .vx4ex. */
984
+ vx4: Uint8Array;
985
+ vx4Extended?: boolean;
986
+ wpe: Uint8Array;
987
+ }
988
+ /** A .vx4ex file is 64 bytes per megatile where .vx4 is 32; the caller usually knows which. */
989
+ export declare function loadTileset(files: TilesetFiles): Tileset;
990
+ /** Resolve an MTXM tile id to a VX4 megatile index, or -1 when the id is out of range. */
991
+ export declare function megatileForTile(tileset: Tileset, tileId: number): number;
992
+ /**
993
+ * Paint one 32x32 megatile as RGBA into `dest` at (dx, dy) of a `destWidth`-pixel row.
994
+ * Works on a plain array, so it is equally usable against ImageData in the browser and
995
+ * a bare buffer in tests. `palette` defaults to the tileset's own; colour cycling passes
996
+ * a rotated copy (see cycle.ts).
997
+ */
998
+ export declare function drawMegatile(tileset: Tileset, megatile: number, dest: Uint8ClampedArray | Uint8Array, destWidth: number, dx: number, dy: number, palette?: Uint8Array): void;
908
999
  /** StarCraft tileset reference data. */
909
1000
  export type TilesetId = "badlands" | "platform" | "install" | "ashworld" | "jungle" | "desert" | "ice" | "twilight";
910
1001
  /**
@@ -1214,6 +1305,10 @@ export interface TextTrigger {
1214
1305
  /** 1-based line the `Trigger(` header starts on. */
1215
1306
  line: number;
1216
1307
  }
1308
+ export declare class TriggerTextError extends Error {
1309
+ readonly line: number;
1310
+ constructor(message: string, line: number);
1311
+ }
1217
1312
  export declare function formatTrigger(t: ReadonlyTrigger, names: TriggerNames, briefing?: boolean): string;
1218
1313
  export declare function formatTriggers(triggers: readonly ReadonlyTrigger[], names: TriggerNames, briefing?: boolean): string;
1219
1314
  /** Parse a whole text into triggers; throws `TriggerTextError` with the offending line. */
@@ -1424,6 +1519,20 @@ export interface UnitChange {
1424
1519
  after: UnitRecord | null;
1425
1520
  }
1426
1521
  export declare function applyUnitChanges(scn: Scenario, changes: UnitChange[], direction?: "do" | "undo"): void;
1522
+ export interface UnitGeometry {
1523
+ building: boolean;
1524
+ flyer: boolean;
1525
+ /** StarEdit placement box, pixels. */
1526
+ placeW: number;
1527
+ placeH: number;
1528
+ /** Collision extents from the centre, pixels. */
1529
+ left: number;
1530
+ up: number;
1531
+ right: number;
1532
+ down: number;
1533
+ }
1534
+ /** Sizes from units.dat, or a one-tile box when the tables are not loaded. */
1535
+ export declare function unitGeometry(units: UnitsDat | null, unitId: number): UnitGeometry;
1427
1536
  export interface PixelBox {
1428
1537
  left: number;
1429
1538
  top: number;
@@ -1590,12 +1699,48 @@ export declare function applyTechSettings(scn: Scenario, settings: TechSettings,
1590
1699
  export declare function changeMapVersion(scn: Scenario, version: MapVersion, extendedStrings?: boolean): string[];
1591
1700
  /** `setTextEncoding` reporting the section it changed. */
1592
1701
  export declare function changeTextEncoding(scn: Scenario, encoding: TextEncoding): string[];
1702
+ /** The 256 names, "" where a switch has none. */
1703
+ export declare function readSwitchNames(scn: Scenario): string[];
1704
+ export type Extras = ReadonlyMap<string, Uint8Array>;
1705
+ export interface SoundRow {
1706
+ slot: number;
1707
+ stringIndex: number;
1708
+ /** The path as the string table has it. */
1709
+ path: string;
1710
+ /** Whether the archive carries a member at that path. */
1711
+ present: boolean;
1712
+ /** Bytes in the archive, 0 when absent. */
1713
+ size: number;
1714
+ /** The archive member's name as stored (case may differ from the path). */
1715
+ member: string | null;
1716
+ usedBy: string[];
1717
+ }
1718
+ /** The table's filled slots, in slot order. */
1719
+ export declare function soundList(scn: Scenario, extras: Extras, wavs?: readonly number[]): SoundRow[];
1593
1720
  export interface BaseTerrain {
1594
1721
  /** CV5 group `index`, which is also the ISOM terrain id. */
1595
1722
  id: number;
1596
1723
  /** Even CV5 group of the pair; odd columns use `group + 1`. */
1597
1724
  group: number;
1598
1725
  }
1726
+ /** Groups 2/3 are the tileset's base ground (ISOM id 2) — used when graphics are missing. */
1727
+ export declare const DIRT: BaseTerrain;
1728
+ /**
1729
+ * The terrain a new map is filled with: the pair carrying `isomId`, or the lowest-id
1730
+ * pair that has real graphics — ISOM id 2 is the base ground everywhere except Space
1731
+ * Platform, where it is the empty void.
1732
+ *
1733
+ * Ids are not the order the palette lists terrain in (badlands numbers High Dirt 3 and
1734
+ * Mud 4, while StarEdit shows Mud first), so callers name the terrain they want by id.
1735
+ */
1736
+ export declare function baseTerrain(tileset: Tileset | null, isomId?: number): BaseTerrain;
1737
+ export interface TerrainFill {
1738
+ tiles: Uint16Array;
1739
+ isom: Uint16Array;
1740
+ }
1741
+ export declare function flatTerrain(width: number, height: number, terrain: BaseTerrain, tileset: Tileset | null, random?: () => number,
1742
+ /** ERA of the map: the ISOM value of a terrain is numbered per tileset. */
1743
+ era?: number): TerrainFill;
1599
1744
  export interface ResizeOptions {
1600
1745
  width: number;
1601
1746
  height: number;
@@ -1631,6 +1776,7 @@ export interface PlacementOptions {
1631
1776
  /** Buildings snap their placement box to the tile grid (StarEdit always does; SCMDraft lets you turn it off). */
1632
1777
  snapToGrid: boolean;
1633
1778
  }
1779
+ export declare const DEFAULT_PLACEMENT: PlacementOptions;
1634
1780
  export type StartLayout = "ring" | "corners";
1635
1781
  export interface StartPlacementOptions {
1636
1782
  /** How many players get a start location, 1..8; players are numbered from 1. */
@@ -1644,6 +1790,7 @@ export interface StartPlacementOptions {
1644
1790
  searchRadius?: number;
1645
1791
  placement: PlacementOptions;
1646
1792
  }
1793
+ export declare const DEFAULT_START_PLACEMENT: Omit<StartPlacementOptions, "placement">;
1647
1794
  export interface StartPlacementResult {
1648
1795
  changes: UnitChange[];
1649
1796
  /** Per player (0-based), where the start location landed, or null when nothing within reach fit. */
@@ -1666,25 +1813,6 @@ export declare function idealStarts(width: number, height: number, players: numb
1666
1813
  * ones placed before it, so they never overlap each other.
1667
1814
  */
1668
1815
  export declare function placeStartLocations(scn: Scenario, tileset: Tileset | null, tables: UnitsDat | null, options: StartPlacementOptions): StartPlacementResult;
1669
- /** Unit type catalogue: StarEdit names by units.dat id, and the palette's grouping of them. */
1670
- export type RaceKey = "terran" | "zerg" | "protoss" | "neutral";
1671
- /** StarEdit's display names, indexed by units.dat id (0–227). */
1672
- export declare const UNIT_NAMES: readonly string[];
1673
- export declare const UNIT_TYPE_COUNT: number;
1674
- export declare const START_LOCATION = 214;
1675
- /** A unit type's display name: the loaded data's where it differs from the game's own, else StarEdit's. */
1676
- export declare function unitName(id: number): string;
1677
- /**
1678
- * StarEdit's upgrade names by upgrades.dat id (0–60); 46 exist in the original game, Brood War
1679
- * added the rest. The order is the game's (`upgrades.dat`'s `label` column, pinned against the
1680
- * real file in `tests/names.test.ts`): the armour upgrades first, then the weapons, then Plasma
1681
- * Shields at 15 — an earlier table had Plasma Shields at 7, which shifted ids 7–15 by one.
1682
- */
1683
- export declare const UPGRADE_NAMES: readonly string[];
1684
- /** StarEdit's technology names by techdata.dat id (0–43); 24 exist in the original game. */
1685
- export declare const TECH_NAMES: readonly string[];
1686
- export declare const upgradeName: (id: number) => string;
1687
- export declare const techName: (id: number) => string;
1688
1816
  /** OWNR controller bytes as StarEdit's Player Settings lists them, with the rest for maps that use them. */
1689
1817
  export declare const PLAYER_TYPES: {
1690
1818
  value: number;
@@ -1696,6 +1824,8 @@ export declare const PLAYER_RACES: {
1696
1824
  value: number;
1697
1825
  label: string;
1698
1826
  }[];
1827
+ export declare const playerTypeLabel: (v: number) => string;
1828
+ export declare const playerRaceLabel: (v: number) => string;
1699
1829
  export interface PlayerColor {
1700
1830
  id: number;
1701
1831
  name: string;
@@ -1704,6 +1834,30 @@ export interface PlayerColor {
1704
1834
  /** The classic StarCraft player colour table (COLR indices). */
1705
1835
  export declare const PLAYER_COLORS: PlayerColor[];
1706
1836
  export declare function playerColorHex(colors: readonly number[] | null | undefined, owner: number): string;
1837
+ /**
1838
+ * The colour a slot shows everywhere — swatches, markers and the sprites themselves: a
1839
+ * Remastered custom RGB when the slot is set to one, else its palette entry.
1840
+ */
1841
+ export declare function displayColorHex(colors: readonly number[] | null | undefined, rgb: PlayerRgb | null | undefined, owner: number): string;
1842
+ /** Unit type catalogue: StarEdit names by units.dat id, and the palette's grouping of them. */
1843
+ export type RaceKey = "terran" | "zerg" | "protoss" | "neutral";
1844
+ /** StarEdit's display names, indexed by units.dat id (0–227). */
1845
+ export declare const UNIT_NAMES: readonly string[];
1846
+ export declare const UNIT_TYPE_COUNT: number;
1847
+ export declare const START_LOCATION = 214;
1848
+ /** A unit type's display name: the loaded data's where it differs from the game's own, else StarEdit's. */
1849
+ export declare function unitName(id: number): string;
1850
+ /**
1851
+ * StarEdit's upgrade names by upgrades.dat id (0–60); 46 exist in the original game, Brood War
1852
+ * added the rest. The order is the game's (`upgrades.dat`'s `label` column, pinned against the
1853
+ * real file in `tests/names.test.ts`): the armour upgrades first, then the weapons, then Plasma
1854
+ * Shields at 15 — an earlier table had Plasma Shields at 7, which shifted ids 7–15 by one.
1855
+ */
1856
+ export declare const UPGRADE_NAMES: readonly string[];
1857
+ /** StarEdit's technology names by techdata.dat id (0–43); 24 exist in the original game. */
1858
+ export declare const TECH_NAMES: readonly string[];
1859
+ export declare const upgradeName: (id: number) => string;
1860
+ export declare const techName: (id: number) => string;
1707
1861
  /**
1708
1862
  * The version a host provides; a manifest that asks for a newer one is refused. It stays
1709
1863
  * at 1 while the API is only used by the plugins in the scm-js organisation and grows
package/dist/index.mjs CHANGED
@@ -5161,8 +5161,9 @@ var TECH_NAMES = [
5161
5161
  ];
5162
5162
  var upgradeName = (id) => loadedNames?.upgrades[id] ?? UPGRADE_NAMES[id] ?? `Upgrade #${id}`;
5163
5163
  var techName = (id) => loadedNames?.techs[id] ?? TECH_NAMES[id] ?? `Technology #${id}`;
5164
- //#endregion
5165
- //#region src/formats/dat/dat.ts
5164
+ var UNITS_DAT_SIZE = 19876;
5165
+ /** Pre-Brood War layout: no `broodWar` byte or `availability` word. */
5166
+ var UNITS_DAT_SIZE_LEGACY = 19192;
5166
5167
  /** units.dat `flags` (special ability flags) bits. */
5167
5168
  var UnitFlag = {
5168
5169
  Building: 1,
@@ -5197,6 +5198,130 @@ var UnitFlag = {
5197
5198
  Mechanical: 1 << 30,
5198
5199
  ProducesUnits: 2147483648
5199
5200
  };
5201
+ /** Sequential reader over a struct-of-arrays file. */
5202
+ var Fields = class {
5203
+ at = 0;
5204
+ data;
5205
+ view;
5206
+ constructor(data) {
5207
+ this.data = data;
5208
+ this.view = new DataView(data.buffer, data.byteOffset, data.byteLength);
5209
+ }
5210
+ get remaining() {
5211
+ return this.data.length - this.at;
5212
+ }
5213
+ u8(count) {
5214
+ const out = this.data.slice(this.at, this.at + count);
5215
+ this.at += count;
5216
+ return out;
5217
+ }
5218
+ u16(count) {
5219
+ return this.u16Strided(count, 2, 0);
5220
+ }
5221
+ u32(count) {
5222
+ const out = new Uint32Array(count);
5223
+ for (let i = 0; i < count; i++) out[i] = this.view.getUint32(this.at + i * 4, true);
5224
+ this.at += count * 4;
5225
+ return out;
5226
+ }
5227
+ /** Read `count` u16s spaced `stride` bytes apart starting `offset` bytes in, without advancing. */
5228
+ u16Strided(count, stride, offset) {
5229
+ const out = new Uint16Array(count);
5230
+ for (let i = 0; i < count; i++) out[i] = this.view.getUint16(this.at + offset + i * stride, true);
5231
+ if (offset === 0 && stride === 2) this.at += count * 2;
5232
+ return out;
5233
+ }
5234
+ skip(bytes) {
5235
+ this.at += bytes;
5236
+ }
5237
+ };
5238
+ function expectSize(name, data, ...sizes) {
5239
+ if (!sizes.includes(data.length)) throw new Error(`${name} is ${data.length} bytes; expected ${sizes.join(" or ")}`);
5240
+ }
5241
+ function decodeUnitsDat(data) {
5242
+ expectSize("units.dat", data, UNITS_DAT_SIZE, UNITS_DAT_SIZE_LEGACY);
5243
+ const n = 228;
5244
+ const f = new Fields(data);
5245
+ const flingy = f.u8(n);
5246
+ const subunit = f.u16(n);
5247
+ f.skip(456);
5248
+ f.skip(192);
5249
+ f.skip(912);
5250
+ const direction = f.u8(n);
5251
+ const shieldEnable = f.u8(n);
5252
+ const shieldAmount = f.u16(n);
5253
+ const hitPoints = f.u32(n);
5254
+ const elevation = f.u8(n);
5255
+ f.skip(1596);
5256
+ const groundWeapon = f.u8(n);
5257
+ f.skip(n);
5258
+ const airWeapon = f.u8(n);
5259
+ f.skip(456);
5260
+ const flags = f.u32(n);
5261
+ f.skip(912);
5262
+ const armor = f.u8(n);
5263
+ f.skip(n);
5264
+ const readySound = f.u16(106);
5265
+ const whatSoundStart = f.u16(n);
5266
+ const whatSoundEnd = f.u16(n);
5267
+ const annoyedSoundStart = f.u16(106);
5268
+ const annoyedSoundEnd = f.u16(106);
5269
+ const yesSoundStart = f.u16(106);
5270
+ const yesSoundEnd = f.u16(106);
5271
+ const placementWidth = f.u16Strided(n, 4, 0);
5272
+ const placementHeight = f.u16Strided(n, 4, 2);
5273
+ f.skip(912);
5274
+ f.skip(384);
5275
+ const extentLeft = f.u16Strided(n, 8, 0);
5276
+ const extentUp = f.u16Strided(n, 8, 2);
5277
+ const extentRight = f.u16Strided(n, 8, 4);
5278
+ const extentDown = f.u16Strided(n, 8, 6);
5279
+ f.skip(1824);
5280
+ f.skip(456);
5281
+ const mineralCost = f.u16(n);
5282
+ const vespeneCost = f.u16(n);
5283
+ const buildTime = f.u16(n);
5284
+ f.skip(456);
5285
+ const groupFlags = f.u8(n);
5286
+ f.skip(912);
5287
+ f.skip(1368);
5288
+ let availability = new Uint16Array(n);
5289
+ if (f.remaining >= 684) {
5290
+ f.skip(n);
5291
+ availability = f.u16(n);
5292
+ }
5293
+ return {
5294
+ flingy,
5295
+ subunit,
5296
+ direction,
5297
+ shieldEnable,
5298
+ shieldAmount,
5299
+ hitPoints,
5300
+ elevation,
5301
+ flags,
5302
+ placementWidth,
5303
+ placementHeight,
5304
+ extentLeft,
5305
+ extentUp,
5306
+ extentRight,
5307
+ extentDown,
5308
+ mineralCost,
5309
+ vespeneCost,
5310
+ buildTime,
5311
+ armor,
5312
+ groundWeapon,
5313
+ airWeapon,
5314
+ groupFlags,
5315
+ availability,
5316
+ readySound,
5317
+ whatSoundStart,
5318
+ whatSoundEnd,
5319
+ annoyedSoundStart,
5320
+ annoyedSoundEnd,
5321
+ yesSoundStart,
5322
+ yesSoundEnd
5323
+ };
5324
+ }
5200
5325
  function applyUnitChanges(scn, changes, direction = "do") {
5201
5326
  const ordered = direction === "do" ? changes : [...changes].reverse();
5202
5327
  for (const c of ordered) {
@@ -5915,6 +6040,22 @@ function playerColorIndex(colors, owner) {
5915
6040
  function playerColorHex(colors, owner) {
5916
6041
  return PLAYER_COLORS[playerColorIndex(colors, owner)].hex;
5917
6042
  }
6043
+ var hex2 = (v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, "0");
6044
+ function rgbToHex(rgb) {
6045
+ return `#${hex2(rgb[0])}${hex2(rgb[1])}${hex2(rgb[2])}`;
6046
+ }
6047
+ /** The slot's Remastered custom RGB, when CRGB says it is on one; null otherwise. */
6048
+ function customRgb(rgb, owner) {
6049
+ return rgb && owner < 8 && rgb.mode[owner] === ColorMode.Custom ? rgb.rgb[owner] : null;
6050
+ }
6051
+ /**
6052
+ * The colour a slot shows everywhere — swatches, markers and the sprites themselves: a
6053
+ * Remastered custom RGB when the slot is set to one, else its palette entry.
6054
+ */
6055
+ function displayColorHex(colors, rgb, owner) {
6056
+ const custom = customRgb(rgb, owner);
6057
+ return custom ? rgbToHex(custom) : playerColorHex(colors, owner);
6058
+ }
5918
6059
  //#endregion
5919
6060
  //#region src/editor/settings.ts
5920
6061
  /**
@@ -6515,6 +6656,37 @@ function formatOf(fileName) {
6515
6656
  const ext = fileName?.split(".").pop()?.toLowerCase();
6516
6657
  return ext === "scx" || ext === "scm" || ext === "chk" ? ext : null;
6517
6658
  }
6659
+ /**
6660
+ * What Save As starts from: the file's own extension (else `.scm` below the Brood War
6661
+ * revision, as StarEdit names them), and the archive stored the way it was opened — a map
6662
+ * that came in PKWARE-compressed and encrypted, Blizzard's own layout, goes out the same
6663
+ * way. A new map, or one opened from a bare .chk, gets StarEdit's layout too, since it is
6664
+ * what every build of the game reads — unless `fresh` names another compression for that
6665
+ * case (Preferences ▸ General ▸ Saving), which then goes without the encryption.
6666
+ */
6667
+ function defaultSaveOptions(scn, origin, fileName, fresh = "asOpened") {
6668
+ const format = formatOf(fileName) ?? (scn.fileVersion < 205 ? "scm" : "scx");
6669
+ if (origin) {
6670
+ const compression = origin.compression === "zlib" || origin.compression === "pkware" ? origin.compression : "none";
6671
+ return {
6672
+ ...DEFAULT_SAVE_OPTIONS,
6673
+ format,
6674
+ compression,
6675
+ encrypt: origin.encrypted
6676
+ };
6677
+ }
6678
+ return fresh === "asOpened" ? {
6679
+ ...DEFAULT_SAVE_OPTIONS,
6680
+ format,
6681
+ compression: "pkware",
6682
+ encrypt: true
6683
+ } : {
6684
+ ...DEFAULT_SAVE_OPTIONS,
6685
+ format,
6686
+ compression: fresh,
6687
+ encrypt: fresh === "pkware"
6688
+ };
6689
+ }
6518
6690
  /** Two ready-made settings the dialog offers as buttons. */
6519
6691
  var SAVE_PRESETS = {
6520
6692
  /** Every section and member kept; compression as it is. */
@@ -6702,6 +6874,24 @@ function formatBytes(n) {
6702
6874
  function normalizeMember(name) {
6703
6875
  return name.replace(/\//g, "\\").toLowerCase();
6704
6876
  }
6877
+ /** The stored key of the member at `path`, or null. */
6878
+ function findMember(extras, path) {
6879
+ const key = normalizeMember(path);
6880
+ for (const name of extras.keys()) if (normalizeMember(name) === key) return name;
6881
+ return null;
6882
+ }
6883
+ /** Labels of the trigger / briefing actions that play the string at `stringIndex`. */
6884
+ function wavUsage(scn, stringIndex) {
6885
+ const out = [];
6886
+ const scan = (noun, list, briefing) => {
6887
+ list.forEach((t, i) => {
6888
+ for (const a of t.actions) for (const s of actionStrings(a, briefing)) if (s.kind === "wav" && s.index === stringIndex) out.push(`${noun} ${i + 1}: ${s.action}`);
6889
+ });
6890
+ };
6891
+ scan(t("Trigger"), scn.triggers, false);
6892
+ scan(t("Briefing"), scn.briefing, true);
6893
+ return out;
6894
+ }
6705
6895
  /**
6706
6896
  * Every archive path the scenario itself names: the WAV table's entries and the `wav`
6707
6897
  * argument of every trigger and briefing action, plus the members the TrigScript
@@ -6724,8 +6914,41 @@ function referencedMembers(scn) {
6724
6914
  MANIFEST_MEMBER
6725
6915
  ];
6726
6916
  }
6917
+ /** The table's filled slots, in slot order. */
6918
+ function soundList(scn, extras, wavs = scn.wavs ?? []) {
6919
+ const out = [];
6920
+ wavs.forEach((stringIndex, slot) => {
6921
+ if (stringIndex === 0) return;
6922
+ const path = getString(scn.strings, stringIndex) ?? "";
6923
+ const member = path ? findMember(extras, path) : null;
6924
+ out.push({
6925
+ slot,
6926
+ stringIndex,
6927
+ path,
6928
+ present: member !== null,
6929
+ size: member ? extras.get(member).length : 0,
6930
+ member,
6931
+ usedBy: wavUsage(scn, stringIndex)
6932
+ });
6933
+ });
6934
+ return out;
6935
+ }
6727
6936
  //#endregion
6728
6937
  //#region src/editor/mapBuild.ts
6938
+ /**
6939
+ * A built map: what a build step (a plugin's compiler — TrigScript's build is the case) made of the map
6940
+ * on its way to the disk, with the map as the editor holds it kept inside the same file.
6941
+ *
6942
+ * The file the game reads is the step's output: `staredit\scenario.chk` is the built
6943
+ * scenario. Next to it sit two members the game never looks at — `scmjs\source.chk`, the
6944
+ * scenario exactly as Save would have written it without the step, and `scmjs\build.json`,
6945
+ * which names the steps, the members they added and the SHA-256 of the built scenario. On
6946
+ * open, a file whose scenario still has that hash gives back the source, so the editor shows
6947
+ * the map the user was editing and not the step's output; one whose scenario has changed
6948
+ * since (another editor, a protector) opens as it is, with a warning, and keeps both members.
6949
+ *
6950
+ * Pure: no store, no DOM. `services/mapBuild.ts` runs the steps; this file packs and unpacks.
6951
+ */
6729
6952
  /** The archive folder the editor keeps its own members in. */
6730
6953
  var BUILD_FOLDER = "scmjs\\";
6731
6954
  var BUILD_SOURCE_MEMBER = `${BUILD_FOLDER}source.chk`;
@@ -6799,6 +7022,38 @@ function sha256Hex(bytes) {
6799
7022
  }
6800
7023
  return [...h].map((x) => x.toString(16).padStart(8, "0")).join("");
6801
7024
  }
7025
+ /**
7026
+ * The file that goes to the disk: the built scenario in an archive laid out by the user's
7027
+ * save options, the map's own members as they were (a step can add a member, not change
7028
+ * one), and the source beside it.
7029
+ */
7030
+ async function packBuiltMap(input) {
7031
+ const out = await loadMap(input.built);
7032
+ const members = /* @__PURE__ */ new Map();
7033
+ for (const [name, data] of input.extras) if (!isBuildMember(name)) members.set(name, data);
7034
+ const have = new Set([...members.keys()].map(normalize$1));
7035
+ const added = [];
7036
+ if (out.archive) for (const [name, data] of (await readMembers(out.archive, out.files)).extras) {
7037
+ if (have.has(normalize$1(name)) || isBuildMember(name)) continue;
7038
+ members.set(name, data);
7039
+ added.push(name);
7040
+ }
7041
+ const manifest = {
7042
+ version: 1,
7043
+ chk: sha256Hex(out.chk),
7044
+ steps: input.steps,
7045
+ added
7046
+ };
7047
+ const { compression, encrypt } = input.options;
7048
+ return saveMap(out.chk, {
7049
+ extras: members,
7050
+ editorMembers: /* @__PURE__ */ new Map([[BUILD_SOURCE_MEMBER, input.sourceChk], [BUILD_MANIFEST_MEMBER, new TextEncoder().encode(JSON.stringify(manifest))]]),
7051
+ stored: input.stored,
7052
+ compress: compression,
7053
+ encrypt,
7054
+ sectorSize: requiredSectorSize(input.stored, compression === "zlib" ? 65536 : STAREDIT_SECTOR_SIZE)
7055
+ });
7056
+ }
6802
7057
  function readBuildManifest(bytes) {
6803
7058
  try {
6804
7059
  const m = JSON.parse(new TextDecoder().decode(bytes));
@@ -6845,19 +7100,21 @@ async function restoreBuiltMap(chk, extras) {
6845
7100
  * map it was built from, and the warnings the editor would show. `writeMapBytes` is the
6846
7101
  * reverse. The pickers, handles and downloads around them are `services/mapIo.ts`.
6847
7102
  */
6848
- /** Read a map file's bytes (.scm, .scx or a bare .chk) into a parsed scenario and the rest of its archive. */
6849
- async function openMapBytes(bytes, fileName) {
7103
+ /**
7104
+ * Read a map file's bytes as an archive: the scenario's bytes and the other members, by name where the archive —
7105
+ * its (listfile), what the scenario refers to, a script's manifest, a build's — gives one up, as stored where not.
7106
+ * `openMapBytes` builds on this; `scmjs map unpack` takes it as it is.
7107
+ */
7108
+ async function readArchive(bytes) {
6850
7109
  const loaded = await loadMap(bytes);
6851
7110
  const problems = [];
6852
7111
  let members = {
6853
7112
  extras: /* @__PURE__ */ new Map(),
6854
7113
  stored: null
6855
7114
  };
6856
- let scenario = parseScenario(loaded.chk);
6857
- let builtBy = null;
6858
7115
  if (loaded.archive) {
6859
7116
  const hints = [
6860
- ...referencedMembers(scenario),
7117
+ ...referencedMembers(parseScenario(loaded.chk)),
6861
7118
  BUILD_SOURCE_MEMBER,
6862
7119
  BUILD_MANIFEST_MEMBER
6863
7120
  ];
@@ -6870,7 +7127,39 @@ async function openMapBytes(bytes, fileName) {
6870
7127
  }
6871
7128
  return more;
6872
7129
  });
6873
- const restored = await restoreBuiltMap(loaded.chk, members.extras);
7130
+ }
7131
+ return {
7132
+ chk: loaded.chk,
7133
+ ...members,
7134
+ origin: loaded.scenarioInfo,
7135
+ files: loaded.files,
7136
+ problems
7137
+ };
7138
+ }
7139
+ /** The archive around a scenario's bytes as given — `readArchive` the other way; the editor's sector rule (zlib likes big sectors). */
7140
+ function writeArchiveBytes(chk, options = {}) {
7141
+ const compression = options.compression ?? "none";
7142
+ return saveMap(chk, {
7143
+ extras: options.extras,
7144
+ stored: options.stored ?? null,
7145
+ compress: compression,
7146
+ encrypt: options.encrypt ?? false,
7147
+ listfile: options.listfile ?? true,
7148
+ sectorSize: requiredSectorSize(options.stored, compression === "zlib" ? 65536 : STAREDIT_SECTOR_SIZE)
7149
+ });
7150
+ }
7151
+ /** Read a map file's bytes (.scm, .scx or a bare .chk) into a parsed scenario and the rest of its archive. */
7152
+ async function openMapBytes(bytes, fileName) {
7153
+ const archive = await readArchive(bytes);
7154
+ const problems = archive.problems;
7155
+ const members = {
7156
+ extras: archive.extras,
7157
+ stored: archive.stored
7158
+ };
7159
+ let scenario = parseScenario(archive.chk);
7160
+ let builtBy = null;
7161
+ if (archive.origin) {
7162
+ const restored = await restoreBuiltMap(archive.chk, members.extras);
6874
7163
  if (restored.kind === "restored") {
6875
7164
  scenario = parseScenario(restored.chk);
6876
7165
  members.extras = restored.extras;
@@ -6886,7 +7175,7 @@ async function openMapBytes(bytes, fileName) {
6886
7175
  const n = stored.members.length - stored.unreadable.length;
6887
7176
  if (n > 0) scenario.warnings.push(t("{n, plural, one {# archive member has no name the editor knows{list}; it is} other {# archive members have no name the editor knows{list}; they are}} kept in a saved copy exactly as stored.", {
6888
7177
  n,
6889
- list: loaded.files ? "" : t(" (the archive has no file list)")
7178
+ list: archive.files ? "" : t(" (the archive has no file list)")
6890
7179
  }));
6891
7180
  }
6892
7181
  return {
@@ -6894,7 +7183,7 @@ async function openMapBytes(bytes, fileName) {
6894
7183
  extras,
6895
7184
  stored,
6896
7185
  fileName,
6897
- origin: loaded.scenarioInfo,
7186
+ origin: archive.origin,
6898
7187
  builtBy
6899
7188
  };
6900
7189
  }
@@ -6906,6 +7195,90 @@ async function writeMapBytes(scenario, options) {
6906
7195
  format: options.format
6907
7196
  }, void 0, options.stored ?? null);
6908
7197
  }
7198
+ var MEGATILE_PX = 32;
7199
+ var MINITILE_BYTES = 64;
7200
+ var CV5_ENTRY_BYTES = 52;
7201
+ var CV5_MEGATILE_OFFSET = 20;
7202
+ var MEGATILES_PER_GROUP = 16;
7203
+ /** WPE is 256 entries of R,G,B,pad. Expanded to RGBA with a fully opaque alpha. */
7204
+ function decodePalette(wpe) {
7205
+ const out = /* @__PURE__ */ new Uint8Array(1024);
7206
+ for (let i = 0; i < 256; i++) {
7207
+ const at = i * 4;
7208
+ out[at] = wpe[at] ?? 0;
7209
+ out[at + 1] = wpe[at + 1] ?? 0;
7210
+ out[at + 2] = wpe[at + 2] ?? 0;
7211
+ out[at + 3] = 255;
7212
+ }
7213
+ return out;
7214
+ }
7215
+ function decodeCv5(cv5) {
7216
+ const view = new DataView(cv5.buffer, cv5.byteOffset, cv5.byteLength);
7217
+ const count = Math.floor(cv5.length / CV5_ENTRY_BYTES);
7218
+ const groups = Array.from({ length: count });
7219
+ for (let g = 0; g < count; g++) {
7220
+ const at = g * CV5_ENTRY_BYTES;
7221
+ const megatiles = new Uint16Array(MEGATILES_PER_GROUP);
7222
+ for (let m = 0; m < MEGATILES_PER_GROUP; m++) megatiles[m] = view.getUint16(at + CV5_MEGATILE_OFFSET + m * 2, true);
7223
+ const index = view.getUint16(at, true);
7224
+ groups[g] = {
7225
+ index,
7226
+ flags: view.getUint16(at + 2, true),
7227
+ buildability: cv5[at + 2],
7228
+ groundHeight: cv5[at + 3],
7229
+ edges: {
7230
+ left: view.getUint16(at + 4, true),
7231
+ top: view.getUint16(at + 6, true),
7232
+ right: view.getUint16(at + 8, true),
7233
+ bottom: view.getUint16(at + 10, true)
7234
+ },
7235
+ stack: {
7236
+ left: view.getUint16(at + 12, true),
7237
+ top: view.getUint16(at + 14, true),
7238
+ right: view.getUint16(at + 16, true),
7239
+ bottom: view.getUint16(at + 18, true)
7240
+ },
7241
+ megatiles
7242
+ };
7243
+ if (index === 1) groups[g].doodad = {
7244
+ overlay: view.getUint16(at + 4, true),
7245
+ nameIndex: view.getUint16(at + 8, true),
7246
+ ddData: view.getUint16(at + 12, true),
7247
+ width: view.getUint16(at + 14, true),
7248
+ height: view.getUint16(at + 16, true)
7249
+ };
7250
+ }
7251
+ return groups;
7252
+ }
7253
+ function decodeMegatileRefs(vx4, extended) {
7254
+ const view = new DataView(vx4.buffer, vx4.byteOffset, vx4.byteLength);
7255
+ const stride = extended ? 4 : 2;
7256
+ const count = Math.floor(vx4.length / stride);
7257
+ const out = new Uint32Array(count);
7258
+ for (let i = 0; i < count; i++) out[i] = extended ? view.getUint32(i * stride, true) : view.getUint16(i * stride, true);
7259
+ return out;
7260
+ }
7261
+ function decodeMegatileFlags(vf4) {
7262
+ const view = new DataView(vf4.buffer, vf4.byteOffset, vf4.byteLength);
7263
+ const count = Math.floor(vf4.length / 2);
7264
+ const out = new Uint16Array(count);
7265
+ for (let i = 0; i < count; i++) out[i] = view.getUint16(i * 2, true);
7266
+ return out;
7267
+ }
7268
+ /** A .vx4ex file is 64 bytes per megatile where .vx4 is 32; the caller usually knows which. */
7269
+ function loadTileset(files) {
7270
+ const extended = files.vx4Extended ?? false;
7271
+ const megatileRefs = decodeMegatileRefs(files.vx4, extended);
7272
+ return {
7273
+ palette: decodePalette(files.wpe),
7274
+ minitiles: files.vr4,
7275
+ megatileRefs,
7276
+ megatileCount: Math.floor(megatileRefs.length / 16),
7277
+ extended,
7278
+ megatileFlags: decodeMegatileFlags(files.vf4),
7279
+ groups: decodeCv5(files.cv5)
7280
+ };
7281
+ }
6909
7282
  /** The CV5 group an MTXM value names, as the game takes it: bit 15 left out. */
6910
7283
  function tileGroupOf(tileId) {
6911
7284
  return tileId >> 4 & 2047;
@@ -6917,6 +7290,33 @@ function megatileForTile(tileset, tileId) {
6917
7290
  const megatile = group.megatiles[tileId & 15];
6918
7291
  return megatile < tileset.megatileCount ? megatile : -1;
6919
7292
  }
7293
+ /**
7294
+ * Paint one 32x32 megatile as RGBA into `dest` at (dx, dy) of a `destWidth`-pixel row.
7295
+ * Works on a plain array, so it is equally usable against ImageData in the browser and
7296
+ * a bare buffer in tests. `palette` defaults to the tileset's own; colour cycling passes
7297
+ * a rotated copy (see cycle.ts).
7298
+ */
7299
+ function drawMegatile(tileset, megatile, dest, destWidth, dx, dy, palette = tileset.palette) {
7300
+ const { megatileRefs, minitiles } = tileset;
7301
+ const base = megatile * 16;
7302
+ for (let my = 0; my < 4; my++) for (let mx = 0; mx < 4; mx++) {
7303
+ const ref = megatileRefs[base + my * 4 + mx] ?? 0;
7304
+ const flipped = (ref & 1) === 1;
7305
+ const src = (ref >>> 1) * MINITILE_BYTES;
7306
+ for (let y = 0; y < 8; y++) {
7307
+ const row = src + y * 8;
7308
+ let out = ((dy + my * 8 + y) * destWidth + dx + mx * 8) * 4;
7309
+ for (let x = 0; x < 8; x++) {
7310
+ const colour = (minitiles[row + (flipped ? 7 - x : x)] ?? 0) * 4;
7311
+ dest[out] = palette[colour];
7312
+ dest[out + 1] = palette[colour + 1];
7313
+ dest[out + 2] = palette[colour + 2];
7314
+ dest[out + 3] = 255;
7315
+ out += 4;
7316
+ }
7317
+ }
7318
+ }
7319
+ }
6920
7320
  /** Per-group flags; the walk/height bits are overridden per minitile by VF4. */
6921
7321
  var GroupFlag = {
6922
7322
  Walkable: 1,
@@ -7767,6 +8167,12 @@ function plainText(text) {
7767
8167
  }
7768
8168
  //#endregion
7769
8169
  //#region src/editor/placement.ts
8170
+ var DEFAULT_PLACEMENT = {
8171
+ checkCollision: true,
8172
+ checkTerrain: true,
8173
+ removeStranded: true,
8174
+ snapToGrid: true
8175
+ };
7770
8176
  var MINITILE = 8;
7771
8177
  function tileIndexRange(box, mapW, mapH) {
7772
8178
  return {
@@ -9498,6 +9904,12 @@ function applyStrings(scn, next, usages = stringUsages(scn)) {
9498
9904
  return true;
9499
9905
  }
9500
9906
  //#endregion
9907
+ //#region src/editor/switches.ts
9908
+ /** The 256 names, "" where a switch has none. */
9909
+ function readSwitchNames(scn) {
9910
+ return Array.from({ length: 256 }, (_, i) => (scn.switchNames ? getString(scn.strings, scn.switchNames[i] ?? 0) : null) ?? "");
9911
+ }
9912
+ //#endregion
9501
9913
  //#region src/data/isomTables.ts
9502
9914
  function rows(list) {
9503
9915
  return list.map(([index, isomValue = 0, brush = -1, linkId = 0]) => ({
@@ -10445,6 +10857,40 @@ function isomValueOf(era, index) {
10445
10857
  }
10446
10858
  //#endregion
10447
10859
  //#region src/formats/tileset/terrain.ts
10860
+ /** Groups 2/3 are the tileset's base ground (ISOM id 2) — used when graphics are missing. */
10861
+ var DIRT = {
10862
+ id: 2,
10863
+ group: 2
10864
+ };
10865
+ /** Doodad groups mark themselves with index 1. */
10866
+ var DOODAD_INDEX = 1;
10867
+ /**
10868
+ * The terrain a new map is filled with: the pair carrying `isomId`, or the lowest-id
10869
+ * pair that has real graphics — ISOM id 2 is the base ground everywhere except Space
10870
+ * Platform, where it is the empty void.
10871
+ *
10872
+ * Ids are not the order the palette lists terrain in (badlands numbers High Dirt 3 and
10873
+ * Mud 4, while StarEdit shows Mud first), so callers name the terrain they want by id.
10874
+ */
10875
+ function baseTerrain(tileset, isomId) {
10876
+ if (!tileset) return DIRT;
10877
+ let fallback = null;
10878
+ for (let g = 2; g + 1 < tileset.groups.length; g += 2) {
10879
+ const id = tileset.groups[g].index;
10880
+ if (id === 0 || id === DOODAD_INDEX) continue;
10881
+ if (tileset.groups[g + 1].index !== id) continue;
10882
+ if (id === isomId) return {
10883
+ id,
10884
+ group: g
10885
+ };
10886
+ if (tileset.groups[g].megatiles[0] === 0) continue;
10887
+ if (!fallback || id < fallback.id) fallback = {
10888
+ id,
10889
+ group: g
10890
+ };
10891
+ }
10892
+ return fallback ?? DIRT;
10893
+ }
10448
10894
  /** Real maps draw a rare variation roughly one tile in twenty; StarCraft's own odds. */
10449
10895
  var RARE_ODDS = 16;
10450
10896
  function variationsOf(tileset, group) {
@@ -11802,4 +12248,4 @@ function canonicalSpec(source) {
11802
12248
  return source.kind === "builtin" ? `builtin:${source.name}` : source.display;
11803
12249
  }
11804
12250
  //#endregion
11805
- export { ACTION_DEFS, AI_SCRIPT_NAMES, ANYWHERE_NAME, BRIEFING_ACTION_DEFS, BUILD_MANIFEST_MEMBER, BUILD_SOURCE_MEMBER, CHOICES, CONDITION_DEFS, ColorMode, DEFAULT_GAS, DEFAULT_MINERALS, DEFAULT_SAVE_OPTIONS, DEFAULT_TEXT_ENCODING, FIND_KINDS, FORCE_SLOTS, ForceFlag, MAP_SIZES, MAP_VERSIONS, MINERAL_FIELD_IDS, MODELLED_SECTIONS, MapLoadError, PLAYER_COLORS, PLAYER_RACES, PLAYER_SLOTS, PLAYER_TYPES, PLUGIN_API_VERSION, PlayerRace, PlayerType, REQUIRED_SECTIONS, SAVE_PRESETS, SCENARIO_PATH, START_LOCATION, STRX_CAPACITY, TECH_NAMES, TEXT_CODES, TEXT_ENCODINGS, TILESETS, TILESET_BY_ID, TRIGGER_OWNERS, UNIT_LIMIT, UNIT_NAMES, UNIT_TYPE_COUNT, UPGRADE_NAMES, VESPENE_GEYSER, actionDef, actionDefByName, addLocation, addUnits, aiScriptByName, aiScriptName, applyBriefing, applyForceSettings, applyLocationChanges, applyPlayerSettings, applyStringImport, applyStrings, applyTechSettings, applyTriggers, applyUnitChanges, applyUnitSettings, applyUpgradeSettings, changeMapVersion, changeTextEncoding, choiceLabel, choiceValue, conditionDef, conditionDefByName, createScenario, decodeTrg, deleteUnused, editLocation, encodeTrg, escapeStringText, extraKind, findInScenario, fingerprintTrigger, forceName, formatBytes, formatOf, formatStringTable, formatTrigger, formatTriggers, idealStarts, internString, isExpansion, isPreserved, isRemasteredRevision, isResource, issueCounts, loadMap, locationCapacity, locationName, looksLikeMpq, makeUnit, mapStatistics, mapVersionOf, markDirty, moveLocations, moveUnits, newAction, newCondition, newTrigger, nextSerial, openMapBytes, parseChk, parseScenario, parseStringTable, parseTriggers, placeStartLocations, placedLocations, plainText, planSave, playableCount, playerColorHex, readBriefing, readBuildManifest, readExtras, readForceSettings, readMembers, readPlayerSettings, readStrings, readTechSettings, readTriggerFile, readTriggers, readUnitSettings, readUpgradeSettings, removeLocations, removeUnits, requiredSections, resizeScenario, resolveIcon, restoreBuiltMap, runsOf, sameTriggers, scenarioDescription, scenarioName, serializeChk, serializeScenario, setExtendedStrings, setMapVersion, setPreserved, setScenarioDescription, setScenarioName, setTextEncoding, statisticsText, stringCapacity, stringUsages, summarizeTrigger, techName, textCode, tilesetIndex, triggerFormatOf, triggerNames, triggerUsage, triggersFromText, triggersToText, unescapeStringText, unitAt, unitCustomName, unitName, unitsInBox, unusedStrings, updateUnits, upgradeName, usedLocations, validateManifest, validateScenario, writeMapBytes };
12251
+ export { ACTION_DEFS, AI_SCRIPT_NAMES, ANYWHERE_NAME, BRIEFING_ACTION_DEFS, BUILD_MANIFEST_MEMBER, BUILD_SOURCE_MEMBER, CHOICES, CONDITION_DEFS, ColorMode, DEFAULT_GAS, DEFAULT_MINERALS, DEFAULT_PLACEMENT, DEFAULT_SAVE_OPTIONS, DEFAULT_START_PLACEMENT, DEFAULT_TEXT_ENCODING, DIRT, FIND_KINDS, FORCE_SLOTS, ForceFlag, MAP_SIZES, MAP_VERSIONS, MEGATILE_PX, MINERAL_FIELD_IDS, MODELLED_SECTIONS, MapLoadError, PLAYER_COLORS, PLAYER_RACES, PLAYER_SLOTS, PLAYER_TYPES, PLUGIN_API_VERSION, PlayerRace, PlayerType, REQUIRED_SECTIONS, SAVE_PRESETS, SCENARIO_PATH, START_LOCATION, STRX_CAPACITY, TECH_NAMES, TEXT_CODES, TEXT_ENCODINGS, TILESETS, TILESET_BY_ID, TRIGGER_OWNERS, TriggerTextError, UNIT_LIMIT, UNIT_NAMES, UNIT_TYPE_COUNT, UPGRADE_NAMES, VESPENE_GEYSER, actionDef, actionDefByName, addLocation, addUnits, aiScriptByName, aiScriptName, applyBriefing, applyForceSettings, applyLocationChanges, applyPlayerSettings, applyStringImport, applyStrings, applyTechSettings, applyTriggers, applyUnitChanges, applyUnitSettings, applyUpgradeSettings, baseTerrain, buildChk, buildMapFile, changeMapVersion, changeTextEncoding, choiceLabel, choiceValue, conditionDef, conditionDefByName, createScenario, decodeTrg, decodeUnitsDat, defaultSaveOptions, deleteUnused, displayColorHex, drawMegatile, editLocation, encodeTrg, escapeStringText, extraKind, findInScenario, fingerprintTrigger, flatTerrain, forceName, formatBytes, formatOf, formatStringTable, formatTrigger, formatTriggers, idealStarts, internString, isExpansion, isPreserved, isRemasteredRevision, isResource, issueCounts, keptExtras, loadMap, loadTileset, locationCapacity, locationName, looksLikeMpq, makeUnit, mapStatistics, mapVersionOf, markDirty, megatileForTile, moveLocations, moveUnits, newAction, newCondition, newTrigger, nextSerial, openMapBytes, packBuiltMap, parseChk, parseScenario, parseStringTable, parseTriggers, placeStartLocations, placedLocations, plainText, planSave, playableCount, playerColorHex, playerRaceLabel, playerTypeLabel, readArchive, readBriefing, readBuildManifest, readExtras, readForceSettings, readMembers, readPlayerSettings, readStrings, readSwitchNames, readTechSettings, readTriggerFile, readTriggers, readUnitSettings, readUpgradeSettings, removeLocations, removeUnits, requiredSections, resizeScenario, resolveIcon, restoreBuiltMap, runsOf, sameTriggers, scenarioDescription, scenarioName, serializeChk, serializeScenario, setExtendedStrings, setMapVersion, setPreserved, setScenarioDescription, setScenarioName, setTextEncoding, soundList, statisticsText, stringCapacity, stringUsages, summarizeTrigger, techName, textCode, tilesetIndex, triggerFormatOf, triggerNames, triggerUsage, triggersFromText, triggersToText, unescapeStringText, unitAt, unitCustomName, unitGeometry, unitName, unitsInBox, unusedStrings, updateUnits, upgradeName, usedLocations, validateManifest, validateScenario, writeArchiveBytes, writeMapBytes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/core",
3
- "version": "0.8.11",
3
+ "version": "0.9.1",
4
4
  "description": "StarCraft: Brood War maps in Node.js and the browser, as the scmJS editor reads and writes them: open .scm/.scx/.chk, triggers, strings, units, locations, settings, Check Map, and write the map back",
5
5
  "keywords": [
6
6
  "starcraft",