Make dumpers works as gdt dumpers and raw dumpers

This commit is contained in:
Jan 2021-03-06 13:25:08 +01:00
parent fc59a09d02
commit ea7b1eadae
46 changed files with 783 additions and 449 deletions

View File

@ -86,6 +86,17 @@ std::string InfoString::ToString(const std::string& prefix) const
return ss.str();
}
void InfoString::ToGdtProperties(const std::string& prefix, GdtEntry& gdtEntry) const
{
for (const auto& key : m_keys_by_insertion)
{
const auto value = m_values.find(key);
gdtEntry.m_properties[key] = value->second;
}
gdtEntry.m_properties["configstringFileType"] = prefix;
}
void InfoString::FromString()
{
}

View File

@ -4,6 +4,8 @@
#include <string>
#include <vector>
#include "Obj/GDT/GdtEntry.h"
#include "Zone/ZoneTypes.h"
class InfoString
@ -21,6 +23,7 @@ public:
std::string ToString() const;
std::string ToString(const std::string& prefix) const;
void ToGdtProperties(const std::string& prefix, GdtEntry& gdtEntry) const;
void FromString();
void FromString(const std::string& prefix);

View File

@ -0,0 +1,91 @@
#pragma once
#include "IAssetDumper.h"
#include <fstream>
#include <filesystem>
#include <iostream>
template<class T>
class AbstractAssetDumper : public IAssetDumper<T>
{
protected:
virtual bool ShouldDump(XAssetInfo<T>* asset)
{
return true;
}
virtual bool CanDumpAsRaw()
{
return false;
}
virtual bool CanDumpAsGdtEntry()
{
return false;
}
virtual std::string GetFileNameForAsset(Zone* zone, XAssetInfo<T>* asset)
{
return asset->m_name;
}
virtual void DumpRaw(AssetDumpingContext& context, XAssetInfo<T>* asset, std::ostream& stream)
{
}
virtual GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<T>* asset)
{
return GdtEntry();
}
public:
void DumpPool(AssetDumpingContext& context, AssetPool<T>* pool) override
{
if(context.m_gdt && CanDumpAsGdtEntry())
{
for (auto assetInfo : *pool)
{
if (assetInfo->m_name[0] == ','
|| !ShouldDump(assetInfo))
{
continue;
}
auto entry = DumpGdtEntry(context, assetInfo);
context.m_gdt->WriteEntry(entry);
}
}
else if(CanDumpAsRaw())
{
for (auto assetInfo : *pool)
{
if (assetInfo->m_name[0] == ','
|| !ShouldDump(assetInfo))
{
continue;
}
std::filesystem::path assetFilePath(context.m_base_path);
assetFilePath.append(GetFileNameForAsset(context.m_zone, assetInfo));
auto assetFileFolder(assetFilePath);
assetFileFolder.replace_filename("");
create_directories(assetFileFolder);
std::ofstream file(assetFilePath, std::fstream::out | std::fstream::binary);
if (file.is_open())
{
DumpRaw(context, assetInfo, file);
file.close();
}
else
{
std::cout << "Failed to open file '" << assetFilePath.string() << "' to dump asset '" << assetInfo->m_name.c_str() << "'\n";
}
}
}
}
};

View File

@ -1,48 +0,0 @@
#pragma once
#include "IAssetDumper.h"
#include <fstream>
#include <filesystem>
#include <iostream>
template<class T>
class AbstractFileDumper : public IAssetDumper<T>
{
protected:
virtual bool ShouldDump(XAssetInfo<T>* asset) = 0;
virtual std::string GetFileNameForAsset(Zone* zone, XAssetInfo<T>* asset) = 0;
virtual void DumpAsset(AssetDumpingContext& context, XAssetInfo<T>* asset, std::ostream& stream) = 0;
public:
void DumpPool(AssetDumpingContext& context, AssetPool<T>* pool) override
{
for(auto assetInfo : *pool)
{
if(assetInfo->m_name[0] == ','
|| !ShouldDump(assetInfo))
{
continue;
}
std::filesystem::path assetFilePath(context.m_base_path);
assetFilePath.append(GetFileNameForAsset(context.m_zone, assetInfo));
auto assetFileFolder(assetFilePath);
assetFileFolder.replace_filename("");
create_directories(assetFileFolder);
std::ofstream file(assetFilePath, std::fstream::out | std::fstream::binary);
if(file.is_open())
{
DumpAsset(context, assetInfo, file);
file.close();
}
else
{
std::cout << "Failed to open file '" << assetFilePath.string() << "' to dump asset '" << assetInfo->m_name.c_str() << "'\n";
}
}
}
};

View File

@ -10,12 +10,17 @@ bool AssetDumperAddonMapEnts::ShouldDump(XAssetInfo<AddonMapEnts>* asset)
return true;
}
bool AssetDumperAddonMapEnts::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperAddonMapEnts::GetFileNameForAsset(Zone* zone, XAssetInfo<AddonMapEnts>* asset)
{
return asset->m_name;
}
void AssetDumperAddonMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream)
void AssetDumperAddonMapEnts::DumpRaw(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream)
{
const auto* addonMapEnts = asset->Asset();
stream.write(addonMapEnts->entityString, std::max(addonMapEnts->numEntityChars - 1, 0));

View File

@ -1,15 +1,16 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class AssetDumperAddonMapEnts final : public AbstractFileDumper<AddonMapEnts>
class AssetDumperAddonMapEnts final : public AbstractAssetDumper<AddonMapEnts>
{
protected:
bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<AddonMapEnts>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream) override;
};
}

View File

@ -13,10 +13,10 @@ AssetDumperGfxImage::AssetDumperGfxImage()
switch (ObjWriting::Configuration.ImageOutputFormat)
{
case ObjWriting::Configuration_t::ImageOutputFormat_e::DDS:
m_writer = new DdsWriter();
m_writer = std::make_unique<DdsWriter>();
break;
case ObjWriting::Configuration_t::ImageOutputFormat_e::IWI:
m_writer = new iwi8::IwiWriter();
m_writer = std::make_unique<iwi8::IwiWriter>();
break;
default:
assert(false);
@ -25,24 +25,23 @@ AssetDumperGfxImage::AssetDumperGfxImage()
}
}
AssetDumperGfxImage::~AssetDumperGfxImage()
{
delete m_writer;
m_writer = nullptr;
}
bool AssetDumperGfxImage::ShouldDump(XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
return image->cardMemory.platform[0] > 0;
}
bool AssetDumperGfxImage::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset)
{
return "images/" + asset->m_name + m_writer->GetFileExtension();
}
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
void AssetDumperGfxImage::DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
{
const auto* image = asset->Asset();
m_writer->DumpImage(stream, image->texture.texture);

View File

@ -1,27 +1,24 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include <memory>
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Image/IImageWriter.h"
namespace IW4
{
class AssetDumperGfxImage final : public AbstractFileDumper<GfxImage>
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
{
IImageWriter* m_writer;
std::unique_ptr<IImageWriter> m_writer;
protected:
bool ShouldDump(XAssetInfo<GfxImage>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
public:
AssetDumperGfxImage();
~AssetDumperGfxImage() override;
AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete;
AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete;
AssetDumperGfxImage& operator=(const AssetDumperGfxImage& other) = delete;
AssetDumperGfxImage& operator=(AssetDumperGfxImage&& other) noexcept = delete;
};
}

View File

@ -9,6 +9,11 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
return true;
}
bool AssetDumperLoadedSound::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperLoadedSound::GetFileNameForAsset(Zone* zone, XAssetInfo<LoadedSound>* asset)
{
return "sound/" + asset->m_name;
@ -55,7 +60,7 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load
stream.write(asset->sound.data, asset->sound.info.data_len);
}
void AssetDumperLoadedSound::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream)
void AssetDumperLoadedSound::DumpRaw(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream)
{
const auto* loadedSound = asset->Asset();
switch (static_cast<WavFormat>(loadedSound->sound.info.format))

View File

@ -1,16 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class AssetDumperLoadedSound final : public AbstractFileDumper<LoadedSound>
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
{
static void DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream);
protected:
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<LoadedSound>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream) override;
};
}

View File

@ -1,6 +1,6 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4

View File

@ -10,12 +10,17 @@ bool AssetDumperRawFile::ShouldDump(XAssetInfo<RawFile>* asset)
return true;
}
bool AssetDumperRawFile::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset)
{
return asset->m_name;
}
void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
{
const auto* rawFile = asset->Asset();
if (rawFile->compressedLen > 0)

View File

@ -1,15 +1,16 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class AssetDumperRawFile final : public AbstractFileDumper<RawFile>
class AssetDumperRawFile final : public AbstractAssetDumper<RawFile>
{
protected:
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
};
}

View File

@ -9,12 +9,17 @@ bool AssetDumperStringTable::ShouldDump(XAssetInfo<StringTable>* asset)
return true;
}
bool AssetDumperStringTable::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset)
{
return asset->m_name;
}
void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
void AssetDumperStringTable::DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
{
const auto* stringTable = asset->Asset();
CsvWriter csv(stream);
@ -29,4 +34,4 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<
csv.NextRow();
}
}
}

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class AssetDumperStringTable final : public AbstractFileDumper<StringTable>
class AssetDumperStringTable final : public AbstractAssetDumper<StringTable>
{
protected:
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
};
}

View File

@ -231,17 +231,7 @@ namespace IW4
};
}
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
{
return true;
}
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
{
return "vehicles/" + asset->m_name;
}
void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
{
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
@ -252,7 +242,41 @@ void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<Vehi
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("VEHICLEFILE");
return converter.Convert();
}
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
{
return true;
}
bool AssetDumperVehicle::CanDumpAsRaw()
{
return true;
}
bool AssetDumperVehicle::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
{
return "vehicles/" + asset->m_name;
}
GdtEntry AssetDumperVehicle::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
return gdtEntry;
}
void AssetDumperVehicle::DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}
}

View File

@ -1,18 +1,26 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Utils/InfoString.h"
namespace IW4
{
class AssetDumperVehicle final : public AbstractFileDumper<VehicleDef>
class AssetDumperVehicle final : public AbstractAssetDumper<VehicleDef>
{
static constexpr const char* FILE_TYPE_STR = "VEHICLEFILE";
static constexpr const char* GDF_NAME = "vehicle.gdf";
static cspField_t vehicle_fields[];
static cspField_t vehicle_fields2[];
static InfoString CreateInfoString(XAssetInfo<VehicleDef>* asset);
protected:
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
};
}

View File

@ -1162,34 +1162,56 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
}
}
InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset)
{
const auto fullDef = std::make_unique<WeaponFullDef>();
memset(fullDef.get(), 0, sizeof(WeaponFullDef));
CopyToFullDef(asset->Asset(), fullDef.get());
InfoStringFromWeaponConverter converter(fullDef.get(), weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponCompleteDef>* asset)
{
return true;
}
bool AssetDumperWeapon::CanDumpAsRaw()
{
return true;
}
bool AssetDumperWeapon::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponCompleteDef>* asset)
{
return "weapons/" + asset->m_name;
}
void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream)
GdtEntry AssetDumperWeapon::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
{
auto* fullDef = new WeaponFullDef;
memset(fullDef, 0, sizeof(WeaponFullDef));
CopyToFullDef(asset->Asset(), fullDef);
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("WEAPONFILE");
stream.write(stringValue.c_str(), stringValue.size());
delete fullDef;
return gdtEntry;
}
void AssetDumperWeapon::DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,19 +1,27 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Utils/InfoString.h"
namespace IW4
{
class AssetDumperWeapon final : public AbstractFileDumper<WeaponCompleteDef>
class AssetDumperWeapon final : public AbstractAssetDumper<WeaponCompleteDef>
{
static constexpr const char* FILE_TYPE_STR = "WEAPONFILE";
static constexpr const char* GDF_NAME = "weapon.gdf";
static cspField_t weapon_fields[];
static void CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef);
static InfoString CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset);
protected:
bool ShouldDump(XAssetInfo<WeaponCompleteDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponCompleteDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream) override;
};
}

View File

@ -260,12 +260,17 @@ bool AssetDumperFontIcon::ShouldDump(XAssetInfo<FontIcon>* asset)
return true;
}
bool AssetDumperFontIcon::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperFontIcon::GetFileNameForAsset(Zone* zone, XAssetInfo<FontIcon>* asset)
{
return asset->m_name;
}
void AssetDumperFontIcon::DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream)
void AssetDumperFontIcon::DumpRaw(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream)
{
AssetDumperFontIconInternal dumper(stream);
dumper.DumpFontIcon(asset->Asset());

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperFontIcon final : public AbstractFileDumper<FontIcon>
class AssetDumperFontIcon final : public AbstractAssetDumper<FontIcon>
{
protected:
bool ShouldDump(XAssetInfo<FontIcon>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<FontIcon>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream) override;
};
}

View File

@ -13,10 +13,10 @@ AssetDumperGfxImage::AssetDumperGfxImage()
switch (ObjWriting::Configuration.ImageOutputFormat)
{
case ObjWriting::Configuration_t::ImageOutputFormat_e::DDS:
m_writer = new DdsWriter();
m_writer = std::make_unique<DdsWriter>();
break;
case ObjWriting::Configuration_t::ImageOutputFormat_e::IWI:
m_writer = new iwi27::IwiWriter();
m_writer = std::make_unique<iwi27::IwiWriter>();
break;
default:
assert(false);
@ -25,24 +25,23 @@ AssetDumperGfxImage::AssetDumperGfxImage()
}
}
AssetDumperGfxImage::~AssetDumperGfxImage()
{
delete m_writer;
m_writer = nullptr;
}
bool AssetDumperGfxImage::ShouldDump(XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
return image->loadedSize > 0;
}
bool AssetDumperGfxImage::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset)
{
return "images/" + asset->m_name + m_writer->GetFileExtension();
}
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
void AssetDumperGfxImage::DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
{
const auto* image = asset->Asset();
m_writer->DumpImage(stream, image->texture.texture);

View File

@ -1,27 +1,24 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include <memory>
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Image/IImageWriter.h"
namespace T6
{
class AssetDumperGfxImage final : public AbstractFileDumper<GfxImage>
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
{
IImageWriter* m_writer;
std::unique_ptr<IImageWriter> m_writer;
protected:
bool ShouldDump(XAssetInfo<GfxImage>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
public:
AssetDumperGfxImage();
~AssetDumperGfxImage() override;
AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete;
AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete;
AssetDumperGfxImage& operator=(const AssetDumperGfxImage& other) = delete;
AssetDumperGfxImage& operator=(AssetDumperGfxImage&& other) noexcept = delete;
};
}

View File

@ -1,6 +1,6 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6

View File

@ -129,30 +129,54 @@ namespace T6
};
}
InfoString AssetDumperPhysConstraints::CreateInfoString(XAssetInfo<PhysConstraints>* asset)
{
assert(asset->Asset()->count <= 4);
InfoStringFromPhysConstraintsConverter converter(asset->Asset(), phys_constraints_fields, std::extent<decltype(phys_constraints_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
bool AssetDumperPhysConstraints::ShouldDump(XAssetInfo<PhysConstraints>* asset)
{
return true;
}
bool AssetDumperPhysConstraints::CanDumpAsRaw()
{
return true;
}
bool AssetDumperPhysConstraints::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperPhysConstraints::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysConstraints>* asset)
{
return "physconstraints/" + asset->m_name;
}
void AssetDumperPhysConstraints::DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream)
GdtEntry AssetDumperPhysConstraints::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset)
{
assert(asset->Asset()->count <= 4);
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
InfoStringFromPhysConstraintsConverter converter(asset->Asset(), phys_constraints_fields, std::extent<decltype(phys_constraints_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("PHYSCONSTRAINTS");
stream.write(stringValue.c_str(), stringValue.size());
return gdtEntry;
}
void AssetDumperPhysConstraints::DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,17 +1,26 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperPhysConstraints final : public AbstractFileDumper<PhysConstraints>
class AssetDumperPhysConstraints final : public AbstractAssetDumper<PhysConstraints>
{
static constexpr const char* FILE_TYPE_STR = "PHYSCONSTRAINTS";
static constexpr const char* GDF_NAME = "physconstraints.gdf";
static cspField_t phys_constraints_fields[];
static InfoString CreateInfoString(XAssetInfo<PhysConstraints>* asset);
protected:
bool ShouldDump(XAssetInfo<PhysConstraints>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<PhysConstraints>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream) override;
};
}

View File

@ -77,17 +77,7 @@ void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, P
physPresetInfo->buoyancyBoxMax = physPreset->buoyancyBoxMax;
}
bool AssetDumperPhysPreset::ShouldDump(XAssetInfo<PhysPreset>* asset)
{
return true;
}
std::string AssetDumperPhysPreset::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset)
{
return "physic/" + asset->m_name;
}
void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream)
InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset)
{
auto* physPresetInfo = new PhysPresetInfo;
CopyToPhysPresetInfo(asset->Asset(), physPresetInfo);
@ -101,27 +91,41 @@ void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<P
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("PHYSIC");
stream.write(stringValue.c_str(), stringValue.size());
delete physPresetInfo;
return converter.Convert();
}
//void AssetDumperPhysPreset::CheckFields()
//{
// assert(std::extent<decltype(physpreset_fields)>::value == std::extent<decltype(fields222)>::value);
//
// for(auto i = 0u; i < std::extent<decltype(physpreset_fields)>::value; i++)
// {
// if(physpreset_fields[i].iOffset != fields222[i].iOffset)
// {
// std::string error = "Error in field: " + std::string(physpreset_fields[i].szName);
// MessageBoxA(NULL, error.c_str(), "", 0);
// exit(0);
// }
// }
//
// MessageBoxA(NULL, "No error", "", 0);
// exit(0);
//}
bool AssetDumperPhysPreset::ShouldDump(XAssetInfo<PhysPreset>* asset)
{
return true;
}
bool AssetDumperPhysPreset::CanDumpAsRaw()
{
return true;
}
bool AssetDumperPhysPreset::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperPhysPreset::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset)
{
return "physic/" + asset->m_name;
}
GdtEntry AssetDumperPhysPreset::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
return gdtEntry;
}
void AssetDumperPhysPreset::DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,19 +1,27 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperPhysPreset final : public AbstractFileDumper<PhysPreset>
class AssetDumperPhysPreset final : public AbstractAssetDumper<PhysPreset>
{
static constexpr const char* FILE_TYPE_STR = "PHYSIC";
static constexpr const char* GDF_NAME = "physpreset.gdf";
static cspField_t physpreset_fields[];
static void CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo);
static InfoString CreateInfoString(XAssetInfo<PhysPreset>* asset);
protected:
bool ShouldDump(XAssetInfo<PhysPreset>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream) override;
};
}

View File

@ -7,12 +7,17 @@ bool AssetDumperQdb::ShouldDump(XAssetInfo<Qdb>* asset)
return true;
}
bool AssetDumperQdb::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperQdb::GetFileNameForAsset(Zone* zone, XAssetInfo<Qdb>* asset)
{
return asset->m_name;
}
void AssetDumperQdb::DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream)
void AssetDumperQdb::DumpRaw(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream)
{
const auto* qdb = asset->Asset();
stream.write(qdb->buffer, qdb->len);

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperQdb final : public AbstractFileDumper<Qdb>
class AssetDumperQdb final : public AbstractAssetDumper<Qdb>
{
protected:
bool ShouldDump(XAssetInfo<Qdb>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<Qdb>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream) override;
};
}

View File

@ -7,12 +7,17 @@ bool AssetDumperRawFile::ShouldDump(XAssetInfo<RawFile>* asset)
return true;
}
bool AssetDumperRawFile::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset)
{
return asset->m_name;
}
void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
{
const auto* rawFile = asset->Asset();
stream.write(rawFile->buffer, rawFile->len);

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperRawFile final : public AbstractFileDumper<RawFile>
class AssetDumperRawFile final : public AbstractAssetDumper<RawFile>
{
protected:
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
};
}

View File

@ -7,12 +7,17 @@ bool AssetDumperScriptParseTree::ShouldDump(XAssetInfo<ScriptParseTree>* asset)
return true;
}
bool AssetDumperScriptParseTree::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperScriptParseTree::GetFileNameForAsset(Zone* zone, XAssetInfo<ScriptParseTree>* asset)
{
return asset->m_name;
}
void AssetDumperScriptParseTree::DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream)
void AssetDumperScriptParseTree::DumpRaw(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream)
{
const auto* scriptParseTree = asset->Asset();
stream.write(scriptParseTree->buffer, scriptParseTree->len);

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperScriptParseTree final : public AbstractFileDumper<ScriptParseTree>
class AssetDumperScriptParseTree final : public AbstractAssetDumper<ScriptParseTree>
{
protected:
bool ShouldDump(XAssetInfo<ScriptParseTree>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<ScriptParseTree>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream) override;
};
}

View File

@ -7,12 +7,17 @@ bool AssetDumperSlug::ShouldDump(XAssetInfo<Slug>* asset)
return true;
}
bool AssetDumperSlug::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperSlug::GetFileNameForAsset(Zone* zone, XAssetInfo<Slug>* asset)
{
return asset->m_name;
}
void AssetDumperSlug::DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream)
void AssetDumperSlug::DumpRaw(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream)
{
const auto* slug = asset->Asset();
stream.write(slug->buffer, slug->len);

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperSlug final : public AbstractFileDumper<Slug>
class AssetDumperSlug final : public AbstractAssetDumper<Slug>
{
protected:
bool ShouldDump(XAssetInfo<Slug>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<Slug>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream) override;
};
}

View File

@ -9,12 +9,17 @@ bool AssetDumperStringTable::ShouldDump(XAssetInfo<StringTable>* asset)
return true;
}
bool AssetDumperStringTable::CanDumpAsRaw()
{
return true;
}
std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset)
{
return asset->m_name;
}
void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
void AssetDumperStringTable::DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
{
const auto* stringTable = asset->Asset();
CsvWriter csv(stream);

View File

@ -1,15 +1,17 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperStringTable final : public AbstractFileDumper<StringTable>
class AssetDumperStringTable final : public AbstractAssetDumper<StringTable>
{
protected:
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
bool CanDumpAsRaw() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
};
}

View File

@ -76,17 +76,7 @@ namespace T6
};
}
bool AssetDumperTracer::ShouldDump(XAssetInfo<TracerDef>* asset)
{
return true;
}
std::string AssetDumperTracer::GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset)
{
return "tracer/" + asset->m_name;
}
void AssetDumperTracer::DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream)
InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset)
{
InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, std::extent<decltype(tracer_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
@ -97,7 +87,41 @@ void AssetDumperTracer::DumpAsset(AssetDumpingContext& context, XAssetInfo<Trace
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
return converter.Convert();
}
bool AssetDumperTracer::ShouldDump(XAssetInfo<TracerDef>* asset)
{
return true;
}
bool AssetDumperTracer::CanDumpAsRaw()
{
return true;
}
bool AssetDumperTracer::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperTracer::GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset)
{
return "tracer/" + asset->m_name;
}
GdtEntry AssetDumperTracer::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
return gdtEntry;
}
void AssetDumperTracer::DumpRaw(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString("TRACER");
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,17 +1,26 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperTracer final : public AbstractFileDumper<TracerDef>
class AssetDumperTracer final : public AbstractAssetDumper<TracerDef>
{
static constexpr const char* FILE_TYPE_STR = "TRACER";
static constexpr const char* GDF_NAME = "tracer.gdf";
static cspField_t tracer_fields[];
static InfoString CreateInfoString(XAssetInfo<TracerDef>* asset);
protected:
bool ShouldDump(XAssetInfo<TracerDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream) override;
};
}

View File

@ -671,28 +671,52 @@ namespace T6
};
}
InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
{
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
{
return true;
}
bool AssetDumperVehicle::CanDumpAsRaw()
{
return true;
}
bool AssetDumperVehicle::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
{
return "vehicles/" + asset->m_name;
}
void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
GdtEntry AssetDumperVehicle::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset)
{
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
return asset->m_zone->m_script_strings[scrStr];
});
return gdtEntry;
}
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("VEHICLEFILE");
void AssetDumperVehicle::DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,17 +1,26 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperVehicle final : public AbstractFileDumper<VehicleDef>
class AssetDumperVehicle final : public AbstractAssetDumper<VehicleDef>
{
static constexpr const char* FILE_TYPE_STR = "VEHICLEFILE";
static constexpr const char* GDF_NAME = "vehicle.gdf";
static cspField_t vehicle_fields[];
static InfoString CreateInfoString(XAssetInfo<VehicleDef>* asset);
protected:
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
};
}

View File

@ -1502,7 +1502,7 @@ namespace T6
};
}
void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef) const
void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef)
{
fullDef->weapVariantDef = *weapon;
@ -1623,34 +1623,56 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
}
}
InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponVariantDef>* asset)
{
auto* fullDef = new WeaponFullDef;
memset(fullDef, 0, sizeof(WeaponFullDef));
CopyToFullDef(asset->Asset(), fullDef);
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponVariantDef>* asset)
{
return true;
}
bool AssetDumperWeapon::CanDumpAsRaw()
{
return true;
}
bool AssetDumperWeapon::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset)
{
return "weapons/" + asset->m_name;
}
void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream)
GdtEntry AssetDumperWeapon::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset)
{
auto* fullDef = new WeaponFullDef;
memset(fullDef, 0, sizeof(WeaponFullDef));
CopyToFullDef(asset->Asset(), fullDef);
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("WEAPONFILE");
stream.write(stringValue.c_str(), stringValue.size());
delete fullDef;
return gdtEntry;
}
void AssetDumperWeapon::DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,19 +1,27 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperWeapon final : public AbstractFileDumper<WeaponVariantDef>
class AssetDumperWeapon final : public AbstractAssetDumper<WeaponVariantDef>
{
static constexpr const char* FILE_TYPE_STR = "WEAPONFILE";
static constexpr const char* GDF_NAME = "weapon.gdf";
static cspField_t weapon_fields[];
void CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef) const;
static void CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef);
static InfoString CreateInfoString(XAssetInfo<WeaponVariantDef>* asset);
protected:
bool ShouldDump(XAssetInfo<WeaponVariantDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream) override;
};
}

View File

@ -9,151 +9,151 @@ using namespace T6;
cspField_t AssetDumperZBarrier::zbarrier_fields[]
{
{ "delayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSoundsDuration), CSPFT_FLOAT },
{ "earthquakeMaxDuration", offsetof(ZBarrierDef, earthquakeMaxDuration), CSPFT_FLOAT },
{ "earthquakeMaxScale", offsetof(ZBarrierDef, earthquakeMaxScale), CSPFT_FLOAT },
{ "earthquakeMinDuration", offsetof(ZBarrierDef, earthquakeMinDuration), CSPFT_FLOAT },
{ "earthquakeMinScale", offsetof(ZBarrierDef, earthquakeMinScale), CSPFT_FLOAT },
{ "earthquakeOnRepair", offsetof(ZBarrierDef, earthquakeOnRepair), CSPFT_UINT },
{ "earthquakeRadius", offsetof(ZBarrierDef, earthquakeRadius), CSPFT_FLOAT },
{ "generalRepairSound0", offsetof(ZBarrierDef, generalRepairSound1), CSPFT_SOUND_ALIAS_ID },
{ "generalRepairSound1", offsetof(ZBarrierDef, generalRepairSound2), CSPFT_SOUND_ALIAS_ID },
{ "upgradedGeneralRepairSound0", offsetof(ZBarrierDef, upgradedGeneralRepairSound1), CSPFT_SOUND_ALIAS_ID },
{ "upgradedGeneralRepairSound1", offsetof(ZBarrierDef, upgradedGeneralRepairSound2), CSPFT_SOUND_ALIAS_ID },
{ "useDelayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSounds), CSPFT_UINT },
{ "taunts", offsetof(ZBarrierDef, taunts), CSPFT_UINT },
{ "reachThroughAttacks", offsetof(ZBarrierDef, reachThroughAttacks), CSPFT_UINT },
{ "zombieTauntAnimState", offsetof(ZBarrierDef, zombieTauntAnimState), CSPFT_SCRIPT_STRING },
{ "zombieReachThroughAnimState", offsetof(ZBarrierDef, zombieReachThroughAnimState), CSPFT_SCRIPT_STRING },
{ "numAttackSlots", offsetof(ZBarrierDef, numAttackSlots), CSPFT_UINT },
{ "attackSpotHorzOffset", offsetof(ZBarrierDef, attackSpotHorzOffset), CSPFT_FLOAT },
{ "autoHideOpenPieces", offsetof(ZBarrierDef, autoHideOpenPieces), CSPFT_UINT },
{ "alternateBoardModel1", offsetof(ZBarrierDef, boards[0].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim1", offsetof(ZBarrierDef, boards[0].pBoardAnim), CSPFT_STRING },
{ "boardModel1", offsetof(ZBarrierDef, boards[0].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound1", offsetof(ZBarrierDef, boards[0].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound1", offsetof(ZBarrierDef, boards[0].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound1", offsetof(ZBarrierDef, boards[0].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax1", offsetof(ZBarrierDef, boards[0].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin1", offsetof(ZBarrierDef, boards[0].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear1", offsetof(ZBarrierDef, boards[0].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx10", offsetof(ZBarrierDef, boards[0].repairEffect1), CSPFT_FX },
{ "repairFx11", offsetof(ZBarrierDef, boards[0].repairEffect2), CSPFT_FX },
{ "tearAnim1", offsetof(ZBarrierDef, boards[0].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel1", offsetof(ZBarrierDef, boards[0].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{ "alternateBoardModel2", offsetof(ZBarrierDef, boards[1].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim2", offsetof(ZBarrierDef, boards[1].pBoardAnim), CSPFT_STRING },
{ "boardModel2", offsetof(ZBarrierDef, boards[1].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound2", offsetof(ZBarrierDef, boards[1].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound2", offsetof(ZBarrierDef, boards[1].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound2", offsetof(ZBarrierDef, boards[1].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax2", offsetof(ZBarrierDef, boards[1].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin2", offsetof(ZBarrierDef, boards[1].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear2", offsetof(ZBarrierDef, boards[1].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx20", offsetof(ZBarrierDef, boards[1].repairEffect1), CSPFT_FX },
{ "repairFx21", offsetof(ZBarrierDef, boards[1].repairEffect2), CSPFT_FX },
{ "tearAnim2", offsetof(ZBarrierDef, boards[1].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel2", offsetof(ZBarrierDef, boards[1].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{ "alternateBoardModel3", offsetof(ZBarrierDef, boards[2].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim3", offsetof(ZBarrierDef, boards[2].pBoardAnim), CSPFT_STRING },
{ "boardModel3", offsetof(ZBarrierDef, boards[2].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound3", offsetof(ZBarrierDef, boards[2].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound3", offsetof(ZBarrierDef, boards[2].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound3", offsetof(ZBarrierDef, boards[2].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax3", offsetof(ZBarrierDef, boards[2].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin3", offsetof(ZBarrierDef, boards[2].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear3", offsetof(ZBarrierDef, boards[2].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx30", offsetof(ZBarrierDef, boards[2].repairEffect1), CSPFT_FX },
{ "repairFx31", offsetof(ZBarrierDef, boards[2].repairEffect2), CSPFT_FX },
{ "tearAnim3", offsetof(ZBarrierDef, boards[2].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel3", offsetof(ZBarrierDef, boards[2].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{ "alternateBoardModel4", offsetof(ZBarrierDef, boards[3].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim4", offsetof(ZBarrierDef, boards[3].pBoardAnim), CSPFT_STRING },
{ "boardModel4", offsetof(ZBarrierDef, boards[3].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound4", offsetof(ZBarrierDef, boards[3].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound4", offsetof(ZBarrierDef, boards[3].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound4", offsetof(ZBarrierDef, boards[3].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax4", offsetof(ZBarrierDef, boards[3].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin4", offsetof(ZBarrierDef, boards[3].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear4", offsetof(ZBarrierDef, boards[3].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx40", offsetof(ZBarrierDef, boards[3].repairEffect1), CSPFT_FX },
{ "repairFx41", offsetof(ZBarrierDef, boards[3].repairEffect2), CSPFT_FX },
{ "tearAnim4", offsetof(ZBarrierDef, boards[3].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel4", offsetof(ZBarrierDef, boards[3].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{ "alternateBoardModel5", offsetof(ZBarrierDef, boards[4].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim5", offsetof(ZBarrierDef, boards[4].pBoardAnim), CSPFT_STRING },
{ "boardModel5", offsetof(ZBarrierDef, boards[4].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound5", offsetof(ZBarrierDef, boards[4].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound5", offsetof(ZBarrierDef, boards[4].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound5", offsetof(ZBarrierDef, boards[4].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax5", offsetof(ZBarrierDef, boards[4].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin5", offsetof(ZBarrierDef, boards[4].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear5", offsetof(ZBarrierDef, boards[4].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx50", offsetof(ZBarrierDef, boards[4].repairEffect1), CSPFT_FX },
{ "repairFx51", offsetof(ZBarrierDef, boards[4].repairEffect2), CSPFT_FX },
{ "tearAnim5", offsetof(ZBarrierDef, boards[4].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel5", offsetof(ZBarrierDef, boards[4].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{ "alternateBoardModel6", offsetof(ZBarrierDef, boards[5].pAlternateBoardModel), CSPFT_XMODEL },
{ "boardAnim6", offsetof(ZBarrierDef, boards[5].pBoardAnim), CSPFT_STRING },
{ "boardModel6", offsetof(ZBarrierDef, boards[5].pBoardModel), CSPFT_XMODEL },
{ "boardRepairSound6", offsetof(ZBarrierDef, boards[5].boardRepairSound), CSPFT_SOUND_ALIAS_ID },
{ "boardRepairHoverSound6", offsetof(ZBarrierDef, boards[5].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID },
{ "OffsetRepairFxX60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxX61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.x), CSPFT_FLOAT },
{ "OffsetRepairFxY60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxY61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.y), CSPFT_FLOAT },
{ "OffsetRepairFxZ60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.z), CSPFT_FLOAT },
{ "OffsetRepairFxZ61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.z), CSPFT_FLOAT },
{ "pauseAndRepeatBoardRepairSound6", offsetof(ZBarrierDef, boards[5].pauseAndRepeatRepSound), CSPFT_UINT },
{ "pauseBetweenRepSoundsMax6", offsetof(ZBarrierDef, boards[5].maxPause), CSPFT_FLOAT },
{ "pauseBetweenRepSoundsMin6", offsetof(ZBarrierDef, boards[5].minPause), CSPFT_FLOAT },
{ "proBoardNumRepsToTear6", offsetof(ZBarrierDef, boards[5].numRepsToPullProBoard), CSPFT_UINT },
{ "repairFx60", offsetof(ZBarrierDef, boards[5].repairEffect1), CSPFT_FX },
{ "repairFx61", offsetof(ZBarrierDef, boards[5].repairEffect2), CSPFT_FX },
{ "tearAnim6", offsetof(ZBarrierDef, boards[5].pTearAnim), CSPFT_STRING },
{ "upgradedBoardModel6", offsetof(ZBarrierDef, boards[5].pUpgradedBoardModel), CSPFT_XMODEL },
{ "zombieBoardTearAnimState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearStateName), CSPFT_SCRIPT_STRING },
{ "zombieBoardTearAnimSubState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING },
{"delayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSoundsDuration), CSPFT_FLOAT},
{"earthquakeMaxDuration", offsetof(ZBarrierDef, earthquakeMaxDuration), CSPFT_FLOAT},
{"earthquakeMaxScale", offsetof(ZBarrierDef, earthquakeMaxScale), CSPFT_FLOAT},
{"earthquakeMinDuration", offsetof(ZBarrierDef, earthquakeMinDuration), CSPFT_FLOAT},
{"earthquakeMinScale", offsetof(ZBarrierDef, earthquakeMinScale), CSPFT_FLOAT},
{"earthquakeOnRepair", offsetof(ZBarrierDef, earthquakeOnRepair), CSPFT_UINT},
{"earthquakeRadius", offsetof(ZBarrierDef, earthquakeRadius), CSPFT_FLOAT},
{"generalRepairSound0", offsetof(ZBarrierDef, generalRepairSound1), CSPFT_SOUND_ALIAS_ID},
{"generalRepairSound1", offsetof(ZBarrierDef, generalRepairSound2), CSPFT_SOUND_ALIAS_ID},
{"upgradedGeneralRepairSound0", offsetof(ZBarrierDef, upgradedGeneralRepairSound1), CSPFT_SOUND_ALIAS_ID},
{"upgradedGeneralRepairSound1", offsetof(ZBarrierDef, upgradedGeneralRepairSound2), CSPFT_SOUND_ALIAS_ID},
{"useDelayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSounds), CSPFT_UINT},
{"taunts", offsetof(ZBarrierDef, taunts), CSPFT_UINT},
{"reachThroughAttacks", offsetof(ZBarrierDef, reachThroughAttacks), CSPFT_UINT},
{"zombieTauntAnimState", offsetof(ZBarrierDef, zombieTauntAnimState), CSPFT_SCRIPT_STRING},
{"zombieReachThroughAnimState", offsetof(ZBarrierDef, zombieReachThroughAnimState), CSPFT_SCRIPT_STRING},
{"numAttackSlots", offsetof(ZBarrierDef, numAttackSlots), CSPFT_UINT},
{"attackSpotHorzOffset", offsetof(ZBarrierDef, attackSpotHorzOffset), CSPFT_FLOAT},
{"autoHideOpenPieces", offsetof(ZBarrierDef, autoHideOpenPieces), CSPFT_UINT},
{"alternateBoardModel1", offsetof(ZBarrierDef, boards[0].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim1", offsetof(ZBarrierDef, boards[0].pBoardAnim), CSPFT_STRING},
{"boardModel1", offsetof(ZBarrierDef, boards[0].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound1", offsetof(ZBarrierDef, boards[0].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound1", offsetof(ZBarrierDef, boards[0].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound1", offsetof(ZBarrierDef, boards[0].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax1", offsetof(ZBarrierDef, boards[0].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin1", offsetof(ZBarrierDef, boards[0].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear1", offsetof(ZBarrierDef, boards[0].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx10", offsetof(ZBarrierDef, boards[0].repairEffect1), CSPFT_FX},
{"repairFx11", offsetof(ZBarrierDef, boards[0].repairEffect2), CSPFT_FX},
{"tearAnim1", offsetof(ZBarrierDef, boards[0].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel1", offsetof(ZBarrierDef, boards[0].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
{"alternateBoardModel2", offsetof(ZBarrierDef, boards[1].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim2", offsetof(ZBarrierDef, boards[1].pBoardAnim), CSPFT_STRING},
{"boardModel2", offsetof(ZBarrierDef, boards[1].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound2", offsetof(ZBarrierDef, boards[1].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound2", offsetof(ZBarrierDef, boards[1].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound2", offsetof(ZBarrierDef, boards[1].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax2", offsetof(ZBarrierDef, boards[1].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin2", offsetof(ZBarrierDef, boards[1].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear2", offsetof(ZBarrierDef, boards[1].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx20", offsetof(ZBarrierDef, boards[1].repairEffect1), CSPFT_FX},
{"repairFx21", offsetof(ZBarrierDef, boards[1].repairEffect2), CSPFT_FX},
{"tearAnim2", offsetof(ZBarrierDef, boards[1].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel2", offsetof(ZBarrierDef, boards[1].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
{"alternateBoardModel3", offsetof(ZBarrierDef, boards[2].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim3", offsetof(ZBarrierDef, boards[2].pBoardAnim), CSPFT_STRING},
{"boardModel3", offsetof(ZBarrierDef, boards[2].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound3", offsetof(ZBarrierDef, boards[2].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound3", offsetof(ZBarrierDef, boards[2].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound3", offsetof(ZBarrierDef, boards[2].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax3", offsetof(ZBarrierDef, boards[2].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin3", offsetof(ZBarrierDef, boards[2].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear3", offsetof(ZBarrierDef, boards[2].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx30", offsetof(ZBarrierDef, boards[2].repairEffect1), CSPFT_FX},
{"repairFx31", offsetof(ZBarrierDef, boards[2].repairEffect2), CSPFT_FX},
{"tearAnim3", offsetof(ZBarrierDef, boards[2].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel3", offsetof(ZBarrierDef, boards[2].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
{"alternateBoardModel4", offsetof(ZBarrierDef, boards[3].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim4", offsetof(ZBarrierDef, boards[3].pBoardAnim), CSPFT_STRING},
{"boardModel4", offsetof(ZBarrierDef, boards[3].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound4", offsetof(ZBarrierDef, boards[3].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound4", offsetof(ZBarrierDef, boards[3].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound4", offsetof(ZBarrierDef, boards[3].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax4", offsetof(ZBarrierDef, boards[3].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin4", offsetof(ZBarrierDef, boards[3].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear4", offsetof(ZBarrierDef, boards[3].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx40", offsetof(ZBarrierDef, boards[3].repairEffect1), CSPFT_FX},
{"repairFx41", offsetof(ZBarrierDef, boards[3].repairEffect2), CSPFT_FX},
{"tearAnim4", offsetof(ZBarrierDef, boards[3].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel4", offsetof(ZBarrierDef, boards[3].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
{"alternateBoardModel5", offsetof(ZBarrierDef, boards[4].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim5", offsetof(ZBarrierDef, boards[4].pBoardAnim), CSPFT_STRING},
{"boardModel5", offsetof(ZBarrierDef, boards[4].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound5", offsetof(ZBarrierDef, boards[4].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound5", offsetof(ZBarrierDef, boards[4].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound5", offsetof(ZBarrierDef, boards[4].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax5", offsetof(ZBarrierDef, boards[4].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin5", offsetof(ZBarrierDef, boards[4].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear5", offsetof(ZBarrierDef, boards[4].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx50", offsetof(ZBarrierDef, boards[4].repairEffect1), CSPFT_FX},
{"repairFx51", offsetof(ZBarrierDef, boards[4].repairEffect2), CSPFT_FX},
{"tearAnim5", offsetof(ZBarrierDef, boards[4].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel5", offsetof(ZBarrierDef, boards[4].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
{"alternateBoardModel6", offsetof(ZBarrierDef, boards[5].pAlternateBoardModel), CSPFT_XMODEL},
{"boardAnim6", offsetof(ZBarrierDef, boards[5].pBoardAnim), CSPFT_STRING},
{"boardModel6", offsetof(ZBarrierDef, boards[5].pBoardModel), CSPFT_XMODEL},
{"boardRepairSound6", offsetof(ZBarrierDef, boards[5].boardRepairSound), CSPFT_SOUND_ALIAS_ID},
{"boardRepairHoverSound6", offsetof(ZBarrierDef, boards[5].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID},
{"OffsetRepairFxX60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxX61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.x), CSPFT_FLOAT},
{"OffsetRepairFxY60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxY61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.y), CSPFT_FLOAT},
{"OffsetRepairFxZ60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.z), CSPFT_FLOAT},
{"OffsetRepairFxZ61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.z), CSPFT_FLOAT},
{"pauseAndRepeatBoardRepairSound6", offsetof(ZBarrierDef, boards[5].pauseAndRepeatRepSound), CSPFT_UINT},
{"pauseBetweenRepSoundsMax6", offsetof(ZBarrierDef, boards[5].maxPause), CSPFT_FLOAT},
{"pauseBetweenRepSoundsMin6", offsetof(ZBarrierDef, boards[5].minPause), CSPFT_FLOAT},
{"proBoardNumRepsToTear6", offsetof(ZBarrierDef, boards[5].numRepsToPullProBoard), CSPFT_UINT},
{"repairFx60", offsetof(ZBarrierDef, boards[5].repairEffect1), CSPFT_FX},
{"repairFx61", offsetof(ZBarrierDef, boards[5].repairEffect2), CSPFT_FX},
{"tearAnim6", offsetof(ZBarrierDef, boards[5].pTearAnim), CSPFT_STRING},
{"upgradedBoardModel6", offsetof(ZBarrierDef, boards[5].pUpgradedBoardModel), CSPFT_XMODEL},
{"zombieBoardTearAnimState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearStateName), CSPFT_SCRIPT_STRING},
{"zombieBoardTearAnimSubState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING},
};
namespace T6
@ -174,46 +174,52 @@ namespace T6
};
}
InfoString AssetDumperZBarrier::CreateInfoString(XAssetInfo<ZBarrierDef>* asset)
{
InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, std::extent<decltype(zbarrier_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
bool AssetDumperZBarrier::ShouldDump(XAssetInfo<ZBarrierDef>* asset)
{
return true;
}
bool AssetDumperZBarrier::CanDumpAsRaw()
{
return true;
}
bool AssetDumperZBarrier::CanDumpAsGdtEntry()
{
return true;
}
std::string AssetDumperZBarrier::GetFileNameForAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset)
{
return "zbarrier/" + asset->m_name;
}
void AssetDumperZBarrier::DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream)
GdtEntry AssetDumperZBarrier::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset)
{
InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, std::extent<decltype(zbarrier_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();
const auto stringValue = infoString.ToString("ZBARRIER");
stream.write(stringValue.c_str(), stringValue.size());
return gdtEntry;
}
//void AssetDumperZBarrier::CheckFields()
//{
// assert(std::extent<decltype(zbarrier_fields)>::value == std::extent<decltype(fields222)>::value);
//
// for(auto i = 0u; i < std::extent<decltype(zbarrier_fields)>::value; i++)
// {
// if(zbarrier_fields[i].iOffset != fields222[i].iOffset)
// {
// std::string error = "Error in field: " + std::string(zbarrier_fields[i].szName);
// MessageBoxA(NULL, error.c_str(), "", 0);
// exit(0);
// }
// }
//
// MessageBoxA(NULL, "No error", "", 0);
// exit(0);
//}
void AssetDumperZBarrier::DumpRaw(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream)
{
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
stream.write(stringValue.c_str(), stringValue.size());
}

View File

@ -1,17 +1,26 @@
#pragma once
#include "Dumping/AbstractFileDumper.h"
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
#include "Utils/InfoString.h"
namespace T6
{
class AssetDumperZBarrier final : public AbstractFileDumper<ZBarrierDef>
class AssetDumperZBarrier final : public AbstractAssetDumper<ZBarrierDef>
{
static constexpr const char* FILE_TYPE_STR = "ZBARRIER";
static constexpr const char* GDF_NAME = "zbarrier.gdf";
static cspField_t zbarrier_fields[];
static InfoString CreateInfoString(XAssetInfo<ZBarrierDef>* asset);
protected:
bool ShouldDump(XAssetInfo<ZBarrierDef>* asset) override;
bool CanDumpAsRaw() override;
bool CanDumpAsGdtEntry() override;
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream) override;
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset) override;
void DumpRaw(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream) override;
};
}