diff --git a/CMakeLists.txt b/CMakeLists.txt index b23166f7..21e1fd13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -732,6 +732,7 @@ set(WOWEE_SOURCES src/pipeline/wowee_sound_swap.cpp src/pipeline/wowee_tutorial_steps.cpp src/pipeline/wowee_chat_commands.cpp + src/pipeline/wowee_camera_presets.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/dbc_layout.cpp @@ -1627,6 +1628,7 @@ add_executable(wowee_editor tools/editor/cli_sound_swap_catalog.cpp tools/editor/cli_tutorial_steps_catalog.cpp tools/editor/cli_chat_commands_catalog.cpp + tools/editor/cli_camera_presets_catalog.cpp tools/editor/cli_catalog_pluck.cpp tools/editor/cli_catalog_find.cpp tools/editor/cli_catalog_by_name.cpp @@ -1841,6 +1843,7 @@ add_executable(wowee_editor src/pipeline/wowee_sound_swap.cpp src/pipeline/wowee_tutorial_steps.cpp src/pipeline/wowee_chat_commands.cpp + src/pipeline/wowee_camera_presets.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/terrain_mesh.cpp diff --git a/include/pipeline/wowee_camera_presets.hpp b/include/pipeline/wowee_camera_presets.hpp new file mode 100644 index 00000000..4eb45703 --- /dev/null +++ b/include/pipeline/wowee_camera_presets.hpp @@ -0,0 +1,142 @@ +#pragma once + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +// Wowee Open Camera Presets catalog (.wcam) — +// novel format covering what vanilla WoW handled +// with hard-coded camera profiles in the client's +// CameraMgr (the standard third-person camera, the +// flight-path camera, vehicle cameras and +// cinematic cameras were all bespoke C++ classes +// with no data-driven extension point). Each WCAM +// entry binds one camera preset to its FOV, +// distance, pitch/yaw offsets, shoulder offset, +// focus-bone tracking target, motion damping +// curve, and intended purpose (Cinematic / Combat +// / Mounted / Vehicle / Cutscene / PhotoMode). +// +// Cross-references with previously-added formats: +// None directly — camera presets are +// self-contained client-side configurations +// selected by the camera controller based on +// gameplay context. +// +// Binary layout (little-endian): +// magic[4] = "WCAM" +// version (uint32) = current 1 +// nameLen + name (catalog label) +// entryCount (uint32) +// entries (each): +// presetId (uint32) +// nameLen + name +// purposeKind (uint8) — 0=Cinematic / +// 1=Combat / +// 2=Mounted / +// 3=Vehicle / +// 4=Cutscene / +// 5=PhotoMode +// motionDamping (uint8) — 0..255 (0 = +// instant +// follow / 255 = +// maximum lag) +// pad0 (uint16) +// fovDegrees (float) — typical 60..90 +// distanceFromTarget (float) — meters from +// focus point +// pitchDegrees (float) — vertical angle +// yawOffsetDegrees (float) — horizontal +// offset from +// character +// facing +// shoulderOffsetMeters (float) — over-shoulder +// offset +// (negative = +// left, positive +// = right) +// focusBoneId (uint32) — M2 bone index +// (typical: +// 0=root, 12= +// chest, 50= +// head); 0xFFFF +// = follow root +struct WoweeCameraPresets { + enum PurposeKind : uint8_t { + Cinematic = 0, + Combat = 1, + Mounted = 2, + Vehicle = 3, + Cutscene = 4, + PhotoMode = 5, + }; + + static constexpr uint32_t kFollowRootBoneId = 0xFFFFu; + + struct Entry { + uint32_t presetId = 0; + std::string name; + uint8_t purposeKind = Combat; + uint8_t motionDamping = 0; + uint16_t pad0 = 0; + float fovDegrees = 0.f; + float distanceFromTarget = 0.f; + float pitchDegrees = 0.f; + float yawOffsetDegrees = 0.f; + float shoulderOffsetMeters = 0.f; + uint32_t focusBoneId = 0; + }; + + std::string name; + std::vector entries; + + bool isValid() const { return !entries.empty(); } + + const Entry* findById(uint32_t presetId) const; + + // Returns all presets of one purpose — used by + // the camera controller when context changes + // (e.g. entering a vehicle picks the first + // Vehicle-purpose preset). + std::vector findByPurpose(uint8_t purposeKind) const; +}; + +class WoweeCameraPresetsLoader { +public: + static bool save(const WoweeCameraPresets& cat, + const std::string& basePath); + static WoweeCameraPresets load(const std::string& basePath); + static bool exists(const std::string& basePath); + + // Preset emitters used by --gen-cam* variants. + // + // makeCombatPresets — 3 combat camera variants + // (default 75 FOV / wide + // 90 FOV ranged-DPS / tight + // 60 FOV melee shoulder- + // cam). Low motion damping + // (10) for responsive + // tracking. + // makeMountedPresets — 2 mounted-camera variants + // (ground-mount slightly- + // pulled-back vs flying- + // mount higher pitch). + // Medium damping (60) for + // smooth turning. + // makeCinematicPresets — 3 cinematic angles + // (over-shoulder dialogue + // / wide establishing + // / close-up portrait). + // High damping (180) + // for film-quality + // motion. + static WoweeCameraPresets makeCombatPresets(const std::string& catalogName); + static WoweeCameraPresets makeMountedPresets(const std::string& catalogName); + static WoweeCameraPresets makeCinematicPresets(const std::string& catalogName); +}; + +} // namespace pipeline +} // namespace wowee diff --git a/src/pipeline/wowee_camera_presets.cpp b/src/pipeline/wowee_camera_presets.cpp new file mode 100644 index 00000000..28162940 --- /dev/null +++ b/src/pipeline/wowee_camera_presets.cpp @@ -0,0 +1,248 @@ +#include "pipeline/wowee_camera_presets.hpp" + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +namespace { + +constexpr char kMagic[4] = {'W', 'C', 'A', 'M'}; +constexpr uint32_t kVersion = 1; + +template +void writePOD(std::ofstream& os, const T& v) { + os.write(reinterpret_cast(&v), sizeof(T)); +} + +template +bool readPOD(std::ifstream& is, T& v) { + is.read(reinterpret_cast(&v), sizeof(T)); + return is.gcount() == static_cast(sizeof(T)); +} + +void writeStr(std::ofstream& os, const std::string& s) { + uint32_t n = static_cast(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(n)) { + s.clear(); + return false; + } + } + return true; +} + +std::string normalizePath(std::string base) { + if (base.size() < 5 || base.substr(base.size() - 5) != ".wcam") { + base += ".wcam"; + } + return base; +} + +} // namespace + +const WoweeCameraPresets::Entry* +WoweeCameraPresets::findById(uint32_t presetId) const { + for (const auto& e : entries) + if (e.presetId == presetId) return &e; + return nullptr; +} + +std::vector +WoweeCameraPresets::findByPurpose(uint8_t purposeKind) const { + std::vector out; + for (const auto& e : entries) + if (e.purposeKind == purposeKind) out.push_back(&e); + return out; +} + +bool WoweeCameraPresetsLoader::save(const WoweeCameraPresets& 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(cat.entries.size()); + writePOD(os, entryCount); + for (const auto& e : cat.entries) { + writePOD(os, e.presetId); + writeStr(os, e.name); + writePOD(os, e.purposeKind); + writePOD(os, e.motionDamping); + writePOD(os, e.pad0); + writePOD(os, e.fovDegrees); + writePOD(os, e.distanceFromTarget); + writePOD(os, e.pitchDegrees); + writePOD(os, e.yawOffsetDegrees); + writePOD(os, e.shoulderOffsetMeters); + writePOD(os, e.focusBoneId); + } + return os.good(); +} + +WoweeCameraPresets WoweeCameraPresetsLoader::load( + const std::string& basePath) { + WoweeCameraPresets 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.presetId)) { + out.entries.clear(); return out; + } + if (!readStr(is, e.name)) { + out.entries.clear(); return out; + } + if (!readPOD(is, e.purposeKind) || + !readPOD(is, e.motionDamping) || + !readPOD(is, e.pad0) || + !readPOD(is, e.fovDegrees) || + !readPOD(is, e.distanceFromTarget) || + !readPOD(is, e.pitchDegrees) || + !readPOD(is, e.yawOffsetDegrees) || + !readPOD(is, e.shoulderOffsetMeters) || + !readPOD(is, e.focusBoneId)) { + out.entries.clear(); return out; + } + } + return out; +} + +bool WoweeCameraPresetsLoader::exists(const std::string& basePath) { + std::ifstream is(normalizePath(basePath), std::ios::binary); + return is.good(); +} + +namespace { + +WoweeCameraPresets::Entry makePreset( + uint32_t presetId, const char* name, + uint8_t purposeKind, uint8_t motionDamping, + float fov, float distance, float pitch, + float yawOffset, float shoulderOffset, + uint32_t focusBoneId) { + WoweeCameraPresets::Entry e; + e.presetId = presetId; e.name = name; + e.purposeKind = purposeKind; + e.motionDamping = motionDamping; + e.fovDegrees = fov; + e.distanceFromTarget = distance; + e.pitchDegrees = pitch; + e.yawOffsetDegrees = yawOffset; + e.shoulderOffsetMeters = shoulderOffset; + e.focusBoneId = focusBoneId; + return e; +} + +} // namespace + +WoweeCameraPresets WoweeCameraPresetsLoader::makeCombatPresets( + const std::string& catalogName) { + using C = WoweeCameraPresets; + WoweeCameraPresets c; + c.name = catalogName; + // Default combat camera: 75° FOV, 12m back, + // -15° pitch (slightly looking down). Low + // damping (10) for responsive tracking. + c.entries.push_back(makePreset( + 1, "Combat Default", C::Combat, 10, + 75.f, 12.f, -15.f, 0.f, 0.f, + C::kFollowRootBoneId)); + // Wide FOV ranged-DPS camera: 90° FOV, 18m back, + // good for hunters/mages tracking enemies at + // range. Slight shoulder offset for visibility + // past the player model. + c.entries.push_back(makePreset( + 2, "Combat Ranged Wide", C::Combat, 15, + 90.f, 18.f, -12.f, 0.f, 0.5f, + C::kFollowRootBoneId)); + // Tight melee shoulder-cam: 60° FOV, 5m back, + // strong over-the-shoulder offset (1.0m right). + // Tracks chest bone (12) for steady framing. + c.entries.push_back(makePreset( + 3, "Combat Melee Shoulder", C::Combat, 8, + 60.f, 5.f, -10.f, 0.f, 1.0f, + 12)); + return c; +} + +WoweeCameraPresets WoweeCameraPresetsLoader::makeMountedPresets( + const std::string& catalogName) { + using C = WoweeCameraPresets; + WoweeCameraPresets c; + c.name = catalogName; + // Ground mount: pulled back 16m to fit the mount + // model into frame, normal pitch. Medium damping + // (60) smooths turning that would otherwise feel + // jerky on a horse/wolf at gallop speed. + c.entries.push_back(makePreset( + 10, "Mount Ground", C::Mounted, 60, + 80.f, 16.f, -18.f, 0.f, 0.f, + C::kFollowRootBoneId)); + // Flying mount: more pitch (looking down at + // landscape) and pulled back further to show + // wings. Higher damping (90) for cinematic + // soaring feel. + c.entries.push_back(makePreset( + 11, "Mount Flying", C::Mounted, 90, + 85.f, 22.f, -28.f, 0.f, 0.f, + C::kFollowRootBoneId)); + return c; +} + +WoweeCameraPresets WoweeCameraPresetsLoader::makeCinematicPresets( + const std::string& catalogName) { + using C = WoweeCameraPresets; + WoweeCameraPresets c; + c.name = catalogName; + // Over-shoulder dialogue: 50° FOV (telephoto), + // 4m back, strong shoulder offset (1.5m right), + // tracks head bone (50) for face-level framing. + // High damping (180) for film-quality motion. + c.entries.push_back(makePreset( + 20, "Cinematic Dialogue", C::Cinematic, 180, + 50.f, 4.f, 0.f, 0.f, 1.5f, + 50 /* head bone */)); + // Wide establishing: 100° FOV, 30m back, looking + // down at -30°. Used for "you arrive at a new + // zone" reveals. No shoulder offset. + c.entries.push_back(makePreset( + 21, "Cinematic Establishing", C::Cinematic, 200, + 100.f, 30.f, -30.f, 0.f, 0.f, + C::kFollowRootBoneId)); + // Close-up portrait: 35° (very telephoto), + // 2m back at face level (head bone 50), + // slight 0.3m shoulder offset for dramatic + // composition. + c.entries.push_back(makePreset( + 22, "Cinematic Portrait", C::Cinematic, 220, + 35.f, 2.f, 5.f /* slightly looking up */, + 15.f /* yawed for 3/4 face */, + 0.3f, 50)); + return c; +} + +} // namespace pipeline +} // namespace wowee diff --git a/tools/editor/cli_arg_required.cpp b/tools/editor/cli_arg_required.cpp index 9168286d..36851a5f 100644 --- a/tools/editor/cli_arg_required.cpp +++ b/tools/editor/cli_arg_required.cpp @@ -440,6 +440,8 @@ const char* const kArgRequired[] = { "--gen-cmd-basic", "--gen-cmd-movement", "--gen-cmd-admin", "--info-wcmd", "--validate-wcmd", "--export-wcmd-json", "--import-wcmd-json", + "--gen-cam-combat", "--gen-cam-mounted", "--gen-cam-cinematic", + "--info-wcam", "--validate-wcam", "--gen-weather-temperate", "--gen-weather-arctic", "--gen-weather-desert", "--gen-weather-stormy", "--gen-zone-atmosphere", diff --git a/tools/editor/cli_camera_presets_catalog.cpp b/tools/editor/cli_camera_presets_catalog.cpp new file mode 100644 index 00000000..75a3d1a0 --- /dev/null +++ b/tools/editor/cli_camera_presets_catalog.cpp @@ -0,0 +1,301 @@ +#include "cli_camera_presets_catalog.hpp" +#include "cli_arg_parse.hpp" +#include "cli_box_emitter.hpp" + +#include "pipeline/wowee_camera_presets.hpp" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace wowee { +namespace editor { +namespace cli { + +namespace { + +std::string stripWcamExt(std::string base) { + stripExt(base, ".wcam"); + return base; +} + +const char* purposeKindName(uint8_t k) { + using C = wowee::pipeline::WoweeCameraPresets; + switch (k) { + case C::Cinematic: return "cinematic"; + case C::Combat: return "combat"; + case C::Mounted: return "mounted"; + case C::Vehicle: return "vehicle"; + case C::Cutscene: return "cutscene"; + case C::PhotoMode: return "photomode"; + default: return "?"; + } +} + +bool saveOrError(const wowee::pipeline::WoweeCameraPresets& c, + const std::string& base, const char* cmd) { + if (!wowee::pipeline::WoweeCameraPresetsLoader::save(c, base)) { + std::fprintf(stderr, "%s: failed to save %s.wcam\n", + cmd, base.c_str()); + return false; + } + return true; +} + +void printGenSummary(const wowee::pipeline::WoweeCameraPresets& c, + const std::string& base) { + std::printf("Wrote %s.wcam\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" presets : %zu\n", c.entries.size()); +} + +int handleGenCombat(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "CombatCameraPresets"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcamExt(base); + auto c = wowee::pipeline::WoweeCameraPresetsLoader:: + makeCombatPresets(name); + if (!saveOrError(c, base, "gen-cam-combat")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenMounted(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "MountedCameraPresets"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcamExt(base); + auto c = wowee::pipeline::WoweeCameraPresetsLoader:: + makeMountedPresets(name); + if (!saveOrError(c, base, "gen-cam-mounted")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenCinematic(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "CinematicCameraPresets"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcamExt(base); + auto c = wowee::pipeline::WoweeCameraPresetsLoader:: + makeCinematicPresets(name); + if (!saveOrError(c, base, "gen-cam-cinematic")) 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 = stripWcamExt(base); + if (!wowee::pipeline::WoweeCameraPresetsLoader::exists(base)) { + std::fprintf(stderr, "WCAM not found: %s.wcam\n", + base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeCameraPresetsLoader::load(base); + if (jsonOut) { + nlohmann::json j; + j["wcam"] = base + ".wcam"; + j["name"] = c.name; + j["count"] = c.entries.size(); + nlohmann::json arr = nlohmann::json::array(); + for (const auto& e : c.entries) { + arr.push_back({ + {"presetId", e.presetId}, + {"name", e.name}, + {"purposeKind", e.purposeKind}, + {"purposeKindName", + purposeKindName(e.purposeKind)}, + {"motionDamping", e.motionDamping}, + {"fovDegrees", e.fovDegrees}, + {"distanceFromTarget", + e.distanceFromTarget}, + {"pitchDegrees", e.pitchDegrees}, + {"yawOffsetDegrees", e.yawOffsetDegrees}, + {"shoulderOffsetMeters", + e.shoulderOffsetMeters}, + {"focusBoneId", e.focusBoneId}, + }); + } + j["entries"] = arr; + std::printf("%s\n", j.dump(2).c_str()); + return 0; + } + std::printf("WCAM: %s.wcam\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" presets : %zu\n", c.entries.size()); + if (c.entries.empty()) return 0; + std::printf(" id purpose damp FOV dist pitch yaw shoulder bone name\n"); + for (const auto& e : c.entries) { + std::printf(" %4u %-10s %3u %5.1f %6.2f %+6.1f %+5.1f %+8.2f %4u %s\n", + e.presetId, + purposeKindName(e.purposeKind), + e.motionDamping, + e.fovDegrees, e.distanceFromTarget, + e.pitchDegrees, e.yawOffsetDegrees, + e.shoulderOffsetMeters, + e.focusBoneId, e.name.c_str()); + } + return 0; +} + +int handleValidate(int& i, int argc, char** argv) { + std::string base = argv[++i]; + bool jsonOut = consumeJsonFlag(i, argc, argv); + base = stripWcamExt(base); + if (!wowee::pipeline::WoweeCameraPresetsLoader::exists(base)) { + std::fprintf(stderr, + "validate-wcam: WCAM not found: %s.wcam\n", + base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeCameraPresetsLoader::load(base); + std::vector errors; + std::vector warnings; + if (c.entries.empty()) { + warnings.push_back("catalog has zero entries"); + } + std::set idsSeen; + 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.presetId); + if (!e.name.empty()) ctx += " " + e.name; + ctx += ")"; + if (e.presetId == 0) + errors.push_back(ctx + ": presetId is 0"); + if (e.name.empty()) + errors.push_back(ctx + ": name is empty"); + if (e.purposeKind > 5) { + errors.push_back(ctx + ": purposeKind " + + std::to_string(e.purposeKind) + + " out of range (0..5)"); + } + // FOV must be in (0..180). Negative or zero + // FOV makes no sense; >= 180 inverts the view + // frustum. + if (e.fovDegrees <= 0.f || e.fovDegrees >= 180.f) { + errors.push_back(ctx + ": fovDegrees=" + + std::to_string(e.fovDegrees) + + " out of range (must be in (0, 180))"); + } + // FOV outside human-comfort range warns. <30 + // = extreme telephoto; >120 = fish-eye that + // disorients players. + if (e.fovDegrees > 0.f && + (e.fovDegrees < 30.f || e.fovDegrees > 120.f)) { + warnings.push_back(ctx + ": fovDegrees=" + + std::to_string(e.fovDegrees) + + " outside 30..120 player-comfort range " + "— may cause motion sickness or " + "extreme telephoto compression"); + } + // Negative distance places camera in front of + // target — almost certainly a typo. + if (e.distanceFromTarget < 0.f) { + errors.push_back(ctx + + ": distanceFromTarget=" + + std::to_string(e.distanceFromTarget) + + " is negative — camera would render in " + "front of target"); + } + // Very small distance (< 0.5m) clips into the + // model — warn, since some shots want this + // (extreme close-up portraits). + if (e.distanceFromTarget > 0.f && + e.distanceFromTarget < 0.5f) { + warnings.push_back(ctx + + ": distanceFromTarget=" + + std::to_string(e.distanceFromTarget) + + " under 0.5m — likely clips into the " + "model; verify intentional"); + } + // Pitch outside ±89° gimbal-locks the camera. + if (e.pitchDegrees < -89.f || + e.pitchDegrees > 89.f) { + errors.push_back(ctx + ": pitchDegrees=" + + std::to_string(e.pitchDegrees) + + " gimbal-locks the camera (must be " + "within (-89, +89))"); + } + // Yaw beyond ±180° is degenerate (wraps). + if (std::fabs(e.yawOffsetDegrees) > 180.f) { + warnings.push_back(ctx + + ": yawOffsetDegrees=" + + std::to_string(e.yawOffsetDegrees) + + " beyond ±180° — wraps to a smaller " + "equivalent angle, simplify"); + } + if (!idsSeen.insert(e.presetId).second) { + errors.push_back(ctx + ": duplicate presetId"); + } + } + bool ok = errors.empty(); + if (jsonOut) { + nlohmann::json j; + j["wcam"] = base + ".wcam"; + 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-wcam: %s.wcam\n", base.c_str()); + if (ok && warnings.empty()) { + std::printf(" OK — %zu presets, all presetIds " + "unique, purposeKind 0..5, FOV in " + "(0,180), distanceFromTarget >= 0, " + "pitch within (-89, +89)\n", + c.entries.size()); + 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 handleCameraPresetsCatalog(int& i, int argc, char** argv, + int& outRc) { + if (std::strcmp(argv[i], "--gen-cam-combat") == 0 && + i + 1 < argc) { + outRc = handleGenCombat(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-cam-mounted") == 0 && + i + 1 < argc) { + outRc = handleGenMounted(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-cam-cinematic") == 0 && + i + 1 < argc) { + outRc = handleGenCinematic(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--info-wcam") == 0 && i + 1 < argc) { + outRc = handleInfo(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--validate-wcam") == 0 && + i + 1 < argc) { + outRc = handleValidate(i, argc, argv); return true; + } + return false; +} + +} // namespace cli +} // namespace editor +} // namespace wowee diff --git a/tools/editor/cli_camera_presets_catalog.hpp b/tools/editor/cli_camera_presets_catalog.hpp new file mode 100644 index 00000000..6353b4eb --- /dev/null +++ b/tools/editor/cli_camera_presets_catalog.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace wowee { +namespace editor { +namespace cli { + +bool handleCameraPresetsCatalog(int& i, int argc, char** argv, + int& outRc); + +} // namespace cli +} // namespace editor +} // namespace wowee diff --git a/tools/editor/cli_dispatch.cpp b/tools/editor/cli_dispatch.cpp index c24c4536..5acc0e2d 100644 --- a/tools/editor/cli_dispatch.cpp +++ b/tools/editor/cli_dispatch.cpp @@ -188,6 +188,7 @@ #include "cli_sound_swap_catalog.hpp" #include "cli_tutorial_steps_catalog.hpp" #include "cli_chat_commands_catalog.hpp" +#include "cli_camera_presets_catalog.hpp" #include "cli_catalog_pluck.hpp" #include "cli_catalog_find.hpp" #include "cli_catalog_by_name.hpp" @@ -421,6 +422,7 @@ constexpr DispatchFn kDispatchTable[] = { handleSoundSwapCatalog, handleTutorialStepsCatalog, handleChatCommandsCatalog, + handleCameraPresetsCatalog, handleCatalogPluck, handleCatalogFind, handleCatalogByName, diff --git a/tools/editor/cli_format_table.cpp b/tools/editor/cli_format_table.cpp index 08440199..eee3674c 100644 --- a/tools/editor/cli_format_table.cpp +++ b/tools/editor/cli_format_table.cpp @@ -146,6 +146,7 @@ constexpr FormatMagicEntry kFormats[] = { {{'W','S','W','P'}, ".wswp", "audio", "--info-wswp", "Sound swap rules catalog"}, {{'W','T','U','R'}, ".wtur", "ui", "--info-wtur", "Tutorial steps catalog"}, {{'W','C','M','D'}, ".wcmd", "chat", "--info-wcmd", "Chat slash command catalog"}, + {{'W','C','A','M'}, ".wcam", "camera", "--info-wcam", "Camera preset 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"}, diff --git a/tools/editor/cli_help.cpp b/tools/editor/cli_help.cpp index 4e4a59bc..b1c91c10 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -2769,6 +2769,16 @@ void printUsage(const char* argv0) { std::printf(" Export binary .wcmd to a human-editable JSON sidecar (defaults to .wcmd.json; emits both minSecurityLevel and category as int + name string; aliases as JSON string array)\n"); std::printf(" --import-wcmd-json [out-base]\n"); std::printf(" Import a .wcmd.json sidecar back into binary .wcmd (minSecurityLevel int OR \"player\"/\"helper\"/\"moderator\"/\"gamemaster\"/\"admin\"; category int OR \"info\"/\"movement\"/\"communication\"/\"admincmd\"/\"debug\"; aliases array preserved)\n"); + std::printf(" --gen-cam-combat [name]\n"); + std::printf(" Emit .wcam 3 Combat camera presets (default 75deg / wide ranged 90deg / tight melee 60deg shoulder-cam tracking chest bone) with low motion damping\n"); + std::printf(" --gen-cam-mounted [name]\n"); + std::printf(" Emit .wcam 2 Mounted camera presets (ground 80deg pulled-back / flying 85deg high-pitch wing-frame) with medium-high damping for smooth turning\n"); + std::printf(" --gen-cam-cinematic [name]\n"); + std::printf(" Emit .wcam 3 Cinematic camera presets (over-shoulder dialogue 50deg / wide establishing 100deg / portrait 35deg telephoto) with high damping for film-quality motion\n"); + std::printf(" --info-wcam [--json]\n"); + std::printf(" Print WCAM entries (id / purpose / damping / FOV / distance / pitch / yaw / shoulder / focusBone / name)\n"); + std::printf(" --validate-wcam [--json]\n"); + std::printf(" Static checks: id+name required, purposeKind 0..5, no duplicate presetIds, FOV in (0,180) (zero/negative makes no sense, >=180 inverts the view frustum), distanceFromTarget >= 0 (negative places camera in front of target); CRITICAL: pitch within (-89,+89) — beyond gimbal-locks the camera. Warns on FOV outside 30..120 player-comfort range (motion-sickness risk), distanceFromTarget < 0.5m (clips into model), and yawOffsetDegrees beyond ±180 (wraps to smaller equivalent — simplify)\n"); std::printf(" --catalog-pluck [--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 [--magic ] [--json]\n"); diff --git a/tools/editor/cli_list_formats.cpp b/tools/editor/cli_list_formats.cpp index 88b50039..bfabce50 100644 --- a/tools/editor/cli_list_formats.cpp +++ b/tools/editor/cli_list_formats.cpp @@ -168,6 +168,7 @@ constexpr FormatRow kFormats[] = { {"WSWP", ".wswp", "audio", "(absent in vanilla — patch-level edits)","Sound swap rules catalog (priority + condition-gated substitution)"}, {"WTUR", ".wtur", "ui", "TutorialFrame.xml + Tutorial.lua", "Tutorial steps catalog (event-triggered first-time-player popup sequences)"}, {"WCMD", ".wcmd", "chat", "ChatFrame.lua + per-command CommandHandler","Chat slash command catalog (security-gated registry + aliases + throttle)"}, + {"WCAM", ".wcam", "camera", "CameraMgr hard-coded camera profiles","Camera preset catalog (per-purpose FOV/distance/pitch/damping)"}, // Additional pipeline catalogs without the alternating // gen/info/validate CLI surface (loaded by the engine