mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-12 21:31:43 +00:00
Add dumper logic from IW4.
This commit is contained in:
@@ -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<AssetSoundCurve::Type>& 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<size_t>(sndCurve->knotCount), std::extent_v<decltype(SndCurve::knots)>);
|
||||
dumper.Init(knotCount);
|
||||
|
||||
for (auto i = 0u; i < knotCount; i++)
|
||||
dumper.WriteKnot(sndCurve->knots[i][0], sndCurve->knots[i][1]);
|
||||
}
|
||||
} // namespace sound_curve
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace sound_curve
|
||||
{
|
||||
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetSoundCurve>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::AssetSoundCurve::Type>& asset) override;
|
||||
};
|
||||
} // namespace sound_curve
|
||||
Reference in New Issue
Block a user