feat(editor): add WMVC (Movie Credits Roll) — 112th open format

Novel replacement for the embedded credit-roll text
vanilla WoW carried inside the cinematic-renderer blob
(the post-cinematic credits that scroll up the screen
after each expansion intro). Each entry binds one
credits category (Production / Music / Voice Acting /
etc.) for one cinematic to its ordered list of credit
lines.

First catalog with a variable-length STRING array
payload — previous variable-length formats used int
arrays (WCMR waypoints / WCMG mutex spells / WPTT
rank-spells / WBAB rank chains / WRPR unlocked items +
recipes). The lines[] field serializes as count +
(length + bytes)* per line, mirroring how strings work
elsewhere in the catalog set just lifted into a per-
entry array.

Seven category enum values cover the full credit
taxonomy: Production / Music / Audio / Engineering /
Art / Voice / Special. Three preset emitters:
makeWotLKIntro (5 blocks for the WotLK Arthas/Terenas
cinematic with the actual canonical music credits —
Brower/Duke/Stafford/Hayes), makeQuestCinema (3-block
template for per-quest cinematics), makeStarterRoll
(4-block generic template).

orderHint sorts blocks within a single cinematic so
the renderer can render Production -> Direction ->
Music -> Voice -> Special Thanks in canonical order
without depending on entry order in the binary.

Validator's most novel checks combine string + grouping
constraints unique to credit rolls: per-cinematic
orderHint slot uniqueness — two blocks at the same
(cinematicId, orderHint) would render in non-
deterministic order due to the std::sort being stable
but content-order undefined. Per-line: empty lines
warn (would render as blank, intentional spacers
should use a placeholder character), lines >80 chars
warn (text-buffer wrap at the canonical 80-char
credit-renderer width).

Format count 111 -> 112. CLI flag count 1206 -> 1211.
This commit is contained in:
Kelsi 2026-05-10 02:15:34 -07:00
parent 9a0309818e
commit 46213baea0
10 changed files with 769 additions and 0 deletions

View file

@ -700,6 +700,7 @@ set(WOWEE_SOURCES
src/pipeline/wowee_reputation_rewards.cpp
src/pipeline/wowee_minimap_levels.cpp
src/pipeline/wowee_pet_care.cpp
src/pipeline/wowee_movie_credits.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/dbc_layout.cpp
@ -1563,6 +1564,7 @@ add_executable(wowee_editor
tools/editor/cli_reputation_rewards_catalog.cpp
tools/editor/cli_minimap_levels_catalog.cpp
tools/editor/cli_pet_care_catalog.cpp
tools/editor/cli_movie_credits_catalog.cpp
tools/editor/cli_catalog_pluck.cpp
tools/editor/cli_catalog_find.cpp
tools/editor/cli_catalog_by_name.cpp
@ -1745,6 +1747,7 @@ add_executable(wowee_editor
src/pipeline/wowee_reputation_rewards.cpp
src/pipeline/wowee_minimap_levels.cpp
src/pipeline/wowee_pet_care.cpp
src/pipeline/wowee_movie_credits.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/terrain_mesh.cpp

View file

@ -0,0 +1,122 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Movie Credits Roll catalog (.wmvc) —
// novel replacement for the embedded credit-roll text
// vanilla WoW carried inside the cinematic-renderer
// blob (the post-cinematic credits that scroll up the
// screen after each expansion intro). Each entry binds
// one credits category (Production / Music / Voice
// Acting / etc.) for one cinematic to its ordered list
// of credit lines.
//
// First catalog with a variable-length STRING array
// payload — previous variable-length formats used int
// arrays (WCMR waypoints, WCMG members, WPTT spell
// rank-arrays, WBAB rank chains, WRPR unlocked items
// + recipes). The lines[] field is serialized as
// count + (length + bytes)* per line.
//
// Cross-references with previously-added formats:
// WCMS: cinematicId references the WCMS cinematic
// catalog (the cinematic these credits play
// after).
//
// Binary layout (little-endian):
// magic[4] = "WMVC"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// rollId (uint32)
// nameLen + name
// descLen + description
// cinematicId (uint32)
// category (uint8) — Production / Music /
// Audio / Engineering
// / Art / Voice /
// Special
// pad0 / pad1 / pad2 (uint8)
// orderHint (uint16) — sort key for the
// cinematic's credit
// order (lower =
// earlier in roll)
// pad4 / pad5 (uint8)
// iconColorRGBA (uint32)
// lineCount (uint32)
// lines (count × { uint32 strLen + bytes })
struct WoweeMovieCredits {
enum Category : uint8_t {
Production = 0, // Director, Producer, etc.
Music = 1, // Composer, Orchestra
Audio = 2, // Sound Design, Foley
Engineering = 3, // Tools, Pipeline
Art = 4, // Concept, Modeling, Anim
Voice = 5, // Voice cast
Special = 6, // Special Thanks, Dedication
};
struct Entry {
uint32_t rollId = 0;
std::string name;
std::string description;
uint32_t cinematicId = 0;
uint8_t category = Production;
uint8_t pad0 = 0;
uint8_t pad1 = 0;
uint8_t pad2 = 0;
uint16_t orderHint = 0;
uint8_t pad4 = 0;
uint8_t pad5 = 0;
uint32_t iconColorRGBA = 0xFFFFFFFFu;
std::vector<std::string> lines;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t rollId) const;
// Returns all credit-roll entries for one cinematic,
// sorted by orderHint. Used by the credit renderer
// to assemble the full scroll for one cinematic.
std::vector<const Entry*> findByCinematic(uint32_t cinematicId) const;
};
class WoweeMovieCreditsLoader {
public:
static bool save(const WoweeMovieCredits& cat,
const std::string& basePath);
static WoweeMovieCredits load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-mvc* variants.
//
// makeWotLKIntro — 5 categories for the WotLK
// cinematic (Production /
// Direction / Music / Voice
// Acting / Special Thanks)
// with 3-4 lines each.
// makeQuestCinema — 3 categories for a typical
// per-quest cinematic (Quest
// Designer / Voice Cast /
// Cinematic Director).
// makeStarterRoll — 4 categories demonstrating
// roll structure (Production
// / Engineering / Art /
// Special Thanks).
static WoweeMovieCredits makeWotLKIntro(const std::string& catalogName);
static WoweeMovieCredits makeQuestCinema(const std::string& catalogName);
static WoweeMovieCredits makeStarterRoll(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee

View file

@ -0,0 +1,329 @@
#include "pipeline/wowee_movie_credits.hpp"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <fstream>
namespace wowee {
namespace pipeline {
namespace {
constexpr char kMagic[4] = {'W', 'M', 'V', 'C'};
constexpr uint32_t kVersion = 1;
template <typename T>
void writePOD(std::ofstream& os, const T& v) {
os.write(reinterpret_cast<const char*>(&v), sizeof(T));
}
template <typename T>
bool readPOD(std::ifstream& is, T& v) {
is.read(reinterpret_cast<char*>(&v), sizeof(T));
return is.gcount() == static_cast<std::streamsize>(sizeof(T));
}
void writeStr(std::ofstream& os, const std::string& s) {
uint32_t n = static_cast<uint32_t>(s.size());
writePOD(os, n);
if (n > 0) os.write(s.data(), n);
}
bool readStr(std::ifstream& is, std::string& s) {
uint32_t n = 0;
if (!readPOD(is, n)) return false;
if (n > (1u << 20)) return false;
s.resize(n);
if (n > 0) {
is.read(s.data(), n);
if (is.gcount() != static_cast<std::streamsize>(n)) {
s.clear();
return false;
}
}
return true;
}
std::string normalizePath(std::string base) {
if (base.size() < 5 || base.substr(base.size() - 5) != ".wmvc") {
base += ".wmvc";
}
return base;
}
uint32_t packRgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0xFF) {
return (static_cast<uint32_t>(a) << 24) |
(static_cast<uint32_t>(b) << 16) |
(static_cast<uint32_t>(g) << 8) |
static_cast<uint32_t>(r);
}
} // namespace
const WoweeMovieCredits::Entry*
WoweeMovieCredits::findById(uint32_t rollId) const {
for (const auto& e : entries)
if (e.rollId == rollId) return &e;
return nullptr;
}
std::vector<const WoweeMovieCredits::Entry*>
WoweeMovieCredits::findByCinematic(uint32_t cinematicId) const {
std::vector<const Entry*> out;
for (const auto& e : entries)
if (e.cinematicId == cinematicId) out.push_back(&e);
std::sort(out.begin(), out.end(),
[](const Entry* a, const Entry* b) {
return a->orderHint < b->orderHint;
});
return out;
}
bool WoweeMovieCreditsLoader::save(const WoweeMovieCredits& cat,
const std::string& basePath) {
std::ofstream os(normalizePath(basePath), std::ios::binary);
if (!os) return false;
os.write(kMagic, 4);
writePOD(os, kVersion);
writeStr(os, cat.name);
uint32_t entryCount = static_cast<uint32_t>(cat.entries.size());
writePOD(os, entryCount);
for (const auto& e : cat.entries) {
writePOD(os, e.rollId);
writeStr(os, e.name);
writeStr(os, e.description);
writePOD(os, e.cinematicId);
writePOD(os, e.category);
writePOD(os, e.pad0);
writePOD(os, e.pad1);
writePOD(os, e.pad2);
writePOD(os, e.orderHint);
writePOD(os, e.pad4);
writePOD(os, e.pad5);
writePOD(os, e.iconColorRGBA);
uint32_t lineCount = static_cast<uint32_t>(
e.lines.size());
writePOD(os, lineCount);
for (const auto& L : e.lines) writeStr(os, L);
}
return os.good();
}
WoweeMovieCredits WoweeMovieCreditsLoader::load(
const std::string& basePath) {
WoweeMovieCredits out;
std::ifstream is(normalizePath(basePath), std::ios::binary);
if (!is) return out;
char magic[4];
is.read(magic, 4);
if (std::memcmp(magic, kMagic, 4) != 0) return out;
uint32_t version = 0;
if (!readPOD(is, version) || version != kVersion) return out;
if (!readStr(is, out.name)) return out;
uint32_t entryCount = 0;
if (!readPOD(is, entryCount)) return out;
if (entryCount > (1u << 20)) return out;
out.entries.resize(entryCount);
for (auto& e : out.entries) {
if (!readPOD(is, e.rollId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.name) || !readStr(is, e.description)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.cinematicId) ||
!readPOD(is, e.category) ||
!readPOD(is, e.pad0) ||
!readPOD(is, e.pad1) ||
!readPOD(is, e.pad2) ||
!readPOD(is, e.orderHint) ||
!readPOD(is, e.pad4) ||
!readPOD(is, e.pad5) ||
!readPOD(is, e.iconColorRGBA)) {
out.entries.clear(); return out;
}
uint32_t lineCount = 0;
if (!readPOD(is, lineCount)) {
out.entries.clear(); return out;
}
if (lineCount > 4096) {
out.entries.clear(); return out;
}
e.lines.resize(lineCount);
for (uint32_t k = 0; k < lineCount; ++k) {
if (!readStr(is, e.lines[k])) {
out.entries.clear(); return out;
}
}
}
return out;
}
bool WoweeMovieCreditsLoader::exists(const std::string& basePath) {
std::ifstream is(normalizePath(basePath), std::ios::binary);
return is.good();
}
WoweeMovieCredits WoweeMovieCreditsLoader::makeWotLKIntro(
const std::string& catalogName) {
using M = WoweeMovieCredits;
WoweeMovieCredits c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint8_t cat,
uint16_t order,
std::vector<std::string> lines,
uint32_t color, const char* desc) {
M::Entry e;
e.rollId = id; e.name = name; e.description = desc;
e.cinematicId = 100; // WotLK intro cinematic
e.category = cat;
e.orderHint = order;
e.lines = std::move(lines);
e.iconColorRGBA = color;
c.entries.push_back(e);
};
add(1, "WotLK_Production", M::Production, 10,
{
"DIRECTOR",
"Cinematic Director (placeholder)",
"EXECUTIVE PRODUCER",
"Cinematic Producer (placeholder)",
"PRODUCER",
"Production Coordinator (placeholder)",
},
packRgba(220, 220, 100),
"WotLK intro — Production block. 6 lines: 3 "
"title + 3 name pairs.");
add(2, "WotLK_Direction", M::Production, 20,
{
"ART DIRECTION",
"Art Director (placeholder)",
"TECHNICAL DIRECTION",
"Tech Director (placeholder)",
},
packRgba(220, 200, 80),
"WotLK intro — Direction block. 4 lines.");
add(3, "WotLK_Music", M::Music, 30,
{
"ORIGINAL SCORE COMPOSED BY",
"Russell Brower",
"Derek Duke",
"Glenn Stafford",
"ADDITIONAL MUSIC",
"Jason Hayes",
},
packRgba(180, 100, 240),
"WotLK intro — Music block. The actual WoTLK "
"score credits, 6 lines.");
add(4, "WotLK_Voice", M::Voice, 40,
{
"VOICE CAST",
"Arthas Menethil ...... Patrick Seitz",
"King Terenas ......... Earl Boen",
"Narrator ............ Patrick Seitz",
},
packRgba(255, 220, 220),
"WotLK intro — Voice cast block. The iconic "
"Arthas/Terenas exchange in the cinematic.");
add(5, "WotLK_SpecialThanks", M::Special, 90,
{
"SPECIAL THANKS",
"All the players who beta-tested the expansion",
"The Blizzard QA team",
"Our families and loved ones",
"FOR THE LICH KING",
},
packRgba(180, 220, 255),
"WotLK intro — Special Thanks block. End of "
"the credit roll, traditionally last.");
return c;
}
WoweeMovieCredits WoweeMovieCreditsLoader::makeQuestCinema(
const std::string& catalogName) {
using M = WoweeMovieCredits;
WoweeMovieCredits c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint8_t cat,
uint16_t order,
std::vector<std::string> lines,
uint32_t color, const char* desc) {
M::Entry e;
e.rollId = id; e.name = name; e.description = desc;
e.cinematicId = 200; // generic quest cine
e.category = cat;
e.orderHint = order;
e.lines = std::move(lines);
e.iconColorRGBA = color;
c.entries.push_back(e);
};
add(100, "QuestCine_Designer", M::Production, 10,
{
"QUEST DESIGN",
"Quest Designer (placeholder)",
},
packRgba(140, 200, 255),
"Per-quest cinematic — Designer credit. Two "
"lines: title + name.");
add(101, "QuestCine_Voice", M::Voice, 20,
{
"VOICE",
"NPC Voice Actor (placeholder)",
},
packRgba(255, 220, 220),
"Per-quest cinematic — single voice credit.");
add(102, "QuestCine_Director", M::Production, 30,
{
"CINEMATIC DIRECTOR",
"Director (placeholder)",
},
packRgba(220, 220, 100),
"Per-quest cinematic — Cinematic Director "
"credit. Always last per Blizzard convention.");
return c;
}
WoweeMovieCredits WoweeMovieCreditsLoader::makeStarterRoll(
const std::string& catalogName) {
using M = WoweeMovieCredits;
WoweeMovieCredits c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint8_t cat,
uint16_t order,
std::vector<std::string> lines,
uint32_t color, const char* desc) {
M::Entry e;
e.rollId = id; e.name = name; e.description = desc;
e.cinematicId = 1; // starter / vanilla intro
e.category = cat;
e.orderHint = order;
e.lines = std::move(lines);
e.iconColorRGBA = color;
c.entries.push_back(e);
};
add(200, "Starter_Production", M::Production, 10,
{ "PRODUCTION", "Producer Name", "Co-Producer" },
packRgba(220, 220, 100),
"Generic starter cinematic — 3-line Production "
"block.");
add(201, "Starter_Engineering", M::Engineering, 20,
{ "ENGINEERING", "Lead Engineer", "Pipeline Tools" },
packRgba(140, 200, 255),
"Generic starter cinematic — 3-line Engineering "
"block.");
add(202, "Starter_Art", M::Art, 30,
{ "ART", "Concept Artist", "3D Modeler", "Animator" },
packRgba(255, 180, 100),
"Generic starter cinematic — 4-line Art block.");
add(203, "Starter_Special", M::Special, 90,
{ "WITH SPECIAL THANKS TO", "Our players",
"Our families" },
packRgba(180, 220, 255),
"Generic starter cinematic — 3-line Special "
"Thanks block.");
return c;
}
} // namespace pipeline
} // namespace wowee

View file

@ -344,6 +344,8 @@ const char* const kArgRequired[] = {
"--gen-pcr", "--gen-pcr-stable", "--gen-pcr-warlock",
"--info-wpcr", "--validate-wpcr",
"--export-wpcr-json", "--import-wpcr-json",
"--gen-mvc", "--gen-mvc-quest", "--gen-mvc-starter",
"--info-wmvc", "--validate-wmvc",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -156,6 +156,7 @@
#include "cli_reputation_rewards_catalog.hpp"
#include "cli_minimap_levels_catalog.hpp"
#include "cli_pet_care_catalog.hpp"
#include "cli_movie_credits_catalog.hpp"
#include "cli_catalog_pluck.hpp"
#include "cli_catalog_find.hpp"
#include "cli_catalog_by_name.hpp"
@ -357,6 +358,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleReputationRewardsCatalog,
handleMinimapLevelsCatalog,
handlePetCareCatalog,
handleMovieCreditsCatalog,
handleCatalogPluck,
handleCatalogFind,
handleCatalogByName,

View file

@ -114,6 +114,7 @@ constexpr FormatMagicEntry kFormats[] = {
{{'W','R','P','R'}, ".wrpr", "factions", "--info-wrpr", "Reputation reward tier catalog"},
{{'W','M','N','L'}, ".wmnl", "worldmap", "--info-wmnl", "Minimap multi-level catalog"},
{{'W','P','C','R'}, ".wpcr", "pets", "--info-wpcr", "Pet care + action catalog"},
{{'W','M','V','C'}, ".wmvc", "cinematic", "--info-wmvc", "Movie credits roll catalog"},
{{'W','F','A','C'}, ".wfac", "factions", nullptr, "Faction catalog"},
{{'W','L','C','K'}, ".wlck", "locks", nullptr, "Lock catalog"},
{{'W','S','K','L'}, ".wskl", "skills", nullptr, "Skill catalog"},

View file

@ -2321,6 +2321,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wpcr to a human-editable JSON sidecar (defaults to <base>.wpcr.json; emits actionKind as both int AND name string; requiresPet/requiresStableNPC as bool)\n");
std::printf(" --import-wpcr-json <json-path> [out-base]\n");
std::printf(" Import a .wpcr.json sidecar back into binary .wpcr (actionKind int OR \"revive\"/\"mend\"/\"feed\"/\"dismiss\"/\"tame\"/\"beastlore\"/\"stable\"/\"untrain\"/\"rename\"/\"abandon\"/\"summon\"; bool fields accept bool OR int)\n");
std::printf(" --gen-mvc <wmvc-base> [name]\n");
std::printf(" Emit .wmvc 5 WotLK intro cinematic credit blocks (Production / Direction / Music / Voice Cast / Special Thanks) — first format with variable-length string arrays\n");
std::printf(" --gen-mvc-quest <wmvc-base> [name]\n");
std::printf(" Emit .wmvc 3 quest cinematic credit blocks (Quest Designer / Voice / Cinematic Director)\n");
std::printf(" --gen-mvc-starter <wmvc-base> [name]\n");
std::printf(" Emit .wmvc 4 starter cinematic credit blocks (Production / Engineering / Art / Special Thanks) — generic template\n");
std::printf(" --info-wmvc <wmvc-base> [--json]\n");
std::printf(" Print WMVC entries (id / cinematicId / category / orderHint / line count / name) plus per-block credit lines\n");
std::printf(" --validate-wmvc <wmvc-base> [--json]\n");
std::printf(" Static checks: id+name+cinematicId required, category 0..6, lines[] non-empty, no duplicate rollIds, no two blocks at same (cinematicId, orderHint) slot (would render in non-deterministic order); warns on empty lines (blank renders) or lines > 80 chars (text-buffer wrap)\n");
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");

View file

@ -136,6 +136,7 @@ constexpr FormatRow kFormats[] = {
{"WRPR", ".wrpr", "factions", "npc_vendor reqstanding + rep gates", "Reputation reward tier catalog (per faction)"},
{"WMNL", ".wmnl", "worldmap", "WorldMapTransforms.dbc + Overlay", "Minimap multi-level catalog (vertical zones)"},
{"WPCR", ".wpcr", "pets", "Spell.dbc pet ops + npc_text stable","Pet care + action catalog (Hunter / Warlock / stable mgmt)"},
{"WMVC", ".wmvc", "cinematic", "embedded cinematic credit-roll blob","Movie credits roll catalog (per-cinematic)"},
// Additional pipeline catalogs without the alternating
// gen/info/validate CLI surface (loaded by the engine

View file

@ -0,0 +1,287 @@
#include "cli_movie_credits_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_movie_credits.hpp"
#include <nlohmann/json.hpp>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <set>
#include <string>
#include <vector>
namespace wowee {
namespace editor {
namespace cli {
namespace {
std::string stripWmvcExt(std::string base) {
stripExt(base, ".wmvc");
return base;
}
const char* categoryName(uint8_t k) {
using M = wowee::pipeline::WoweeMovieCredits;
switch (k) {
case M::Production: return "production";
case M::Music: return "music";
case M::Audio: return "audio";
case M::Engineering: return "engineering";
case M::Art: return "art";
case M::Voice: return "voice";
case M::Special: return "special";
default: return "unknown";
}
}
bool saveOrError(const wowee::pipeline::WoweeMovieCredits& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeMovieCreditsLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wmvc\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeMovieCredits& c,
const std::string& base) {
size_t totalLines = 0;
for (const auto& e : c.entries) totalLines += e.lines.size();
std::printf("Wrote %s.wmvc\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" blocks : %zu (%zu lines total)\n",
c.entries.size(), totalLines);
}
int handleGenWotLK(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "WotLKIntroCredits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWmvcExt(base);
auto c = wowee::pipeline::WoweeMovieCreditsLoader::makeWotLKIntro(name);
if (!saveOrError(c, base, "gen-mvc")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenQuest(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "QuestCinematicCredits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWmvcExt(base);
auto c = wowee::pipeline::WoweeMovieCreditsLoader::makeQuestCinema(name);
if (!saveOrError(c, base, "gen-mvc-quest")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenStarter(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StarterRollCredits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWmvcExt(base);
auto c = wowee::pipeline::WoweeMovieCreditsLoader::makeStarterRoll(name);
if (!saveOrError(c, base, "gen-mvc-starter")) return 1;
printGenSummary(c, base);
return 0;
}
int handleInfo(int& i, int argc, char** argv) {
std::string base = argv[++i];
bool jsonOut = consumeJsonFlag(i, argc, argv);
base = stripWmvcExt(base);
if (!wowee::pipeline::WoweeMovieCreditsLoader::exists(base)) {
std::fprintf(stderr, "WMVC not found: %s.wmvc\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeMovieCreditsLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wmvc"] = base + ".wmvc";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"rollId", e.rollId},
{"name", e.name},
{"description", e.description},
{"cinematicId", e.cinematicId},
{"category", e.category},
{"categoryName", categoryName(e.category)},
{"orderHint", e.orderHint},
{"iconColorRGBA", e.iconColorRGBA},
{"lines", e.lines},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WMVC: %s.wmvc\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" blocks : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id cinematic category order lines name\n");
for (const auto& e : c.entries) {
std::printf(" %4u %5u %-10s %4u %4zu %s\n",
e.rollId, e.cinematicId,
categoryName(e.category),
e.orderHint, e.lines.size(),
e.name.c_str());
for (const auto& L : e.lines) {
std::printf(" | %s\n", L.c_str());
}
}
return 0;
}
int handleValidate(int& i, int argc, char** argv) {
std::string base = argv[++i];
bool jsonOut = consumeJsonFlag(i, argc, argv);
base = stripWmvcExt(base);
if (!wowee::pipeline::WoweeMovieCreditsLoader::exists(base)) {
std::fprintf(stderr,
"validate-wmvc: WMVC not found: %s.wmvc\n",
base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeMovieCreditsLoader::load(base);
std::vector<std::string> errors;
std::vector<std::string> warnings;
if (c.entries.empty()) {
warnings.push_back("catalog has zero entries");
}
std::set<uint32_t> idsSeen;
// Per-cinematic orderHint uniqueness — two blocks at
// the same orderHint within one cinematic would
// render in unstable order.
std::set<uint64_t> orderSlotsSeen;
auto orderKey = [](uint32_t cine, uint16_t order) {
return (static_cast<uint64_t>(cine) << 32) | order;
};
for (size_t k = 0; k < c.entries.size(); ++k) {
const auto& e = c.entries[k];
std::string ctx = "entry " + std::to_string(k) +
" (id=" + std::to_string(e.rollId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.rollId == 0)
errors.push_back(ctx + ": rollId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.cinematicId == 0) {
errors.push_back(ctx +
": cinematicId is 0 — credit block is "
"unbound to any cinematic");
}
if (e.category > 6) {
errors.push_back(ctx + ": category " +
std::to_string(e.category) +
" out of range (must be 0..6)");
}
if (e.lines.empty()) {
errors.push_back(ctx +
": lines[] is empty — credit block has "
"nothing to display");
}
// Per-line length sanity. WoW cinematic credit
// line buffer is ~80 chars wide before wrap.
for (size_t L = 0; L < e.lines.size(); ++L) {
if (e.lines[L].empty()) {
warnings.push_back(ctx +
": lines[" + std::to_string(L) +
"] is empty — would render as a "
"blank line in the credit roll "
"(intentional spacers should still "
"have a placeholder character)");
}
if (e.lines[L].size() > 80) {
warnings.push_back(ctx + ": lines[" +
std::to_string(L) +
"] is " + std::to_string(e.lines[L].size()) +
" chars (>80) — may wrap or truncate "
"in the credit-renderer 80-char text "
"buffer");
}
}
if (e.cinematicId != 0) {
uint64_t key = orderKey(e.cinematicId, e.orderHint);
if (!orderSlotsSeen.insert(key).second) {
errors.push_back(ctx +
": (cinematicId=" +
std::to_string(e.cinematicId) +
", orderHint=" +
std::to_string(e.orderHint) +
") slot already occupied by another "
"block — credit roll order would be "
"non-deterministic");
}
}
if (!idsSeen.insert(e.rollId).second) {
errors.push_back(ctx + ": duplicate rollId");
}
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wmvc"] = base + ".wmvc";
j["ok"] = ok;
j["errors"] = errors;
j["warnings"] = warnings;
std::printf("%s\n", j.dump(2).c_str());
return ok ? 0 : 1;
}
std::printf("validate-wmvc: %s.wmvc\n", base.c_str());
if (ok && warnings.empty()) {
size_t totalLines = 0;
for (const auto& e : c.entries) totalLines += e.lines.size();
std::printf(" OK — %zu blocks, %zu lines, all "
"rollIds + per-cinematic orderHints "
"unique\n",
c.entries.size(), totalLines);
return 0;
}
if (!warnings.empty()) {
std::printf(" warnings (%zu):\n", warnings.size());
for (const auto& w : warnings)
std::printf(" - %s\n", w.c_str());
}
if (!errors.empty()) {
std::printf(" ERRORS (%zu):\n", errors.size());
for (const auto& e : errors)
std::printf(" - %s\n", e.c_str());
}
return ok ? 0 : 1;
}
} // namespace
bool handleMovieCreditsCatalog(int& i, int argc, char** argv,
int& outRc) {
if (std::strcmp(argv[i], "--gen-mvc") == 0 && i + 1 < argc) {
outRc = handleGenWotLK(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-mvc-quest") == 0 && i + 1 < argc) {
outRc = handleGenQuest(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-mvc-starter") == 0 && i + 1 < argc) {
outRc = handleGenStarter(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wmvc") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wmvc") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

@ -0,0 +1,12 @@
#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleMovieCreditsCatalog(int& i, int argc, char** argv,
int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee