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

@ -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