feat(editor): add WCMR JSON round-trip (--export/--import-wcmr-json)

Closes the editing loop on the creature-patrol catalog: dump a
.wcmr to JSON, hand-edit pathKind / moveType / waypoint coords /
delays (e.g. add a new mid-route waypoint to a city guard's
patrol, change Stormwind cathedral guards from Walk to Run kind,
extend an ICC patrol from 16 to 24 waypoints to cover a wider
area), re-import to a byte-identical binary.

First round-trip with truly variable-length payloads. The
waypoint arrays serialize as JSON arrays of {x, y, z, delayMs}
objects — adding or removing waypoints in the JSON sidecar
preserves the length-prefixed binary layout on import. The
generic --bulk-export-json / --bulk-import-json utilities work
on these too without modification, since the sidecar follows
the same magic-pattern naming convention.

Two dual-encoded fields:
  - pathKind: int 0..3 OR "loop" / "one-shot" / "reverse" /
    "random"
  - moveType: int 0..3 OR "walk" / "run" / "fly" / "swim"

Verified byte-identical round-trip on all three presets
(patrol / city / boss). The boss preset's 12-pt + 8-pt + 16-pt
patrols (36 waypoints total = 576 bytes of waypoint payload)
round-trip exactly, confirming the variable-length encoding
preserves byte-for-byte order in both directions. CLI flag count
1053 -> 1055.
This commit is contained in:
Kelsi 2026-05-09 23:41:17 -07:00
parent 7d3b80e1f7
commit 5a12f5d183
3 changed files with 186 additions and 0 deletions

View file

@ -278,6 +278,7 @@ const char* const kArgRequired[] = {
"--export-wsps-json", "--import-wsps-json",
"--gen-cmr", "--gen-cmr-city", "--gen-cmr-boss",
"--info-wcmr", "--validate-wcmr",
"--export-wcmr-json", "--import-wcmr-json",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",