From 6400b57caf0fe3dbf01e8dabd5eabb670fd18034 Mon Sep 17 00:00:00 2001 From: njohnson Date: Tue, 28 Apr 2026 20:54:49 -0400 Subject: [PATCH] Add dumper logic from IW4. --- .../Game/IW3/Sound/SndCurveDumperIW3.cpp | 27 +++++++++++++++++++ .../Game/IW3/Sound/SndCurveDumperIW3.h | 13 +++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.cpp create mode 100644 src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.h diff --git a/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.cpp b/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.cpp new file mode 100644 index 00000000..d3ab138e --- /dev/null +++ b/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.cpp @@ -0,0 +1,27 @@ +#include "SndCurveDumperIW3.h" + +#include "Sound/SndCurveDumper.h" +#include "Sound/SoundCurveCommon.h" + +using namespace IW3; + +namespace sound_curve +{ + void DumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo& asset) + { + const auto* sndCurve = asset.Asset(); + + const auto assetFile = context.OpenAssetFile(GetFileNameForAssetName(sndCurve->filename)); + + if (!assetFile) + return; + + SndCurveDumper dumper(*assetFile); + + const auto knotCount = std::min(static_cast(sndCurve->knotCount), std::extent_v); + dumper.Init(knotCount); + + for (auto i = 0u; i < knotCount; i++) + dumper.WriteKnot(sndCurve->knots[i][0], sndCurve->knots[i][1]); + } +} // namespace sound_curve diff --git a/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.h b/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.h new file mode 100644 index 00000000..20ba622c --- /dev/null +++ b/src/ObjWriting/Game/IW3/Sound/SndCurveDumperIW3.h @@ -0,0 +1,13 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/IW3/IW3.h" + +namespace sound_curve +{ + class DumperIW3 final : public AbstractAssetDumper + { + protected: + void DumpAsset(AssetDumpingContext& context, const XAssetInfo& asset) override; + }; +} // namespace sound_curve