mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-17 07:21:43 +00:00
Add IW5 SndCurve dumper.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "Game/IW5/Techset/VertexShaderDumperIW5.h"
|
||||
#include "Game/IW5/XModel/XModelDumperIW5.h"
|
||||
#include "Image/ImageDumperIW5.h"
|
||||
#include "Sound/SndCurveDumperIW5.h"
|
||||
#include "Leaderboard/LeaderboardJsonDumperIW5.h"
|
||||
#include "Localize/LocalizeDumperIW5.h"
|
||||
#include "Maps/AddonMapEntsDumperIW5.h"
|
||||
@@ -40,7 +41,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
));
|
||||
RegisterAssetDumper(std::make_unique<image::DumperIW5>());
|
||||
// REGISTER_DUMPER(AssetDumpersnd_alias_list_t)
|
||||
// REGISTER_DUMPER(AssetDumperSndCurve)
|
||||
RegisterAssetDumper(std::make_unique<sound_curve::DumperIW5>());
|
||||
RegisterAssetDumper(std::make_unique<sound::LoadedSoundDumperIW5>());
|
||||
// REGISTER_DUMPER(AssetDumperclipMap_t)
|
||||
// REGISTER_DUMPER(AssetDumperComWorld)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "SndCurveDumperIW5.h"
|
||||
|
||||
#include "Sound/SndCurveDumper.h"
|
||||
#include "Sound/SoundCurveCommon.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
namespace sound_curve
|
||||
{
|
||||
void DumperIW5::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/IW5/IW5.h"
|
||||
|
||||
namespace sound_curve
|
||||
{
|
||||
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetSoundCurve>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetSoundCurve::Type>& asset) override;
|
||||
};
|
||||
} // namespace sound_curve
|
||||
Reference in New Issue
Block a user