2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-03 15:27:25 +00:00

Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,10 +1,10 @@
#include "AssetDumperGfxImage.h"
#include <cassert>
#include "ObjWriting.h"
#include "Image/IwiWriter8.h"
#include "Image/DdsWriter.h"
#include "Image/IwiWriter8.h"
#include "ObjWriting.h"
#include <cassert>
using namespace IW4;

View File

@@ -1,11 +1,11 @@
#pragma once
#include <memory>
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Image/IImageWriter.h"
#include <memory>
namespace IW4
{
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
@@ -21,4 +21,4 @@ namespace IW4
public:
AssetDumperGfxImage();
};
}
} // namespace IW4

View File

@@ -13,4 +13,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<GfxLightDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxLightDef>* asset) override;
};
}
} // namespace IW4

View File

@@ -15,10 +15,7 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load
const WavWriter writer(stream);
const WavMetaData metaData{
static_cast<unsigned>(asset->sound.info.channels),
static_cast<unsigned>(asset->sound.info.rate),
static_cast<unsigned>(asset->sound.info.bits)
};
static_cast<unsigned>(asset->sound.info.channels), static_cast<unsigned>(asset->sound.info.rate), static_cast<unsigned>(asset->sound.info.bits)};
writer.WritePcmHeader(metaData, asset->sound.info.data_len);
writer.WritePcmData(asset->sound.data, asset->sound.info.data_len);

View File

@@ -8,8 +8,9 @@ namespace IW4
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
{
static void DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream);
protected:
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,9 +1,9 @@
#include "AssetDumperLocalizeEntry.h"
#include <sstream>
#include "Localize/LocalizeCommon.h"
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <sstream>
using namespace IW4;
@@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
}
}
}

View File

@@ -10,4 +10,4 @@ namespace IW4
public:
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
};
}
} // namespace IW4

View File

@@ -1,21 +1,21 @@
#include "AssetDumperMaterial.h"
#include <iomanip>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#include <nlohmann/json.hpp>
#include "Utils/ClassUtils.h"
#include "Game/IW4/MaterialConstantsIW4.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Math/Vector.h"
#include "Utils/ClassUtils.h"
#include <iomanip>
#include <nlohmann/json.hpp>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#define DUMP_AS_JSON 1
//#define DUMP_AS_GDT 1
//#define FLAGS_DEBUG 1
// #define DUMP_AS_GDT 1
// #define FLAGS_DEBUG 1
using namespace IW4;
using json = nlohmann::json;
@@ -30,8 +30,7 @@ namespace IW4
return name;
}
template <size_t S>
json ArrayEntry(const char* (&a)[S], const size_t index)
template<size_t S> json ArrayEntry(const char* (&a)[S], const size_t index)
{
assert(index < S);
if (index < S)
@@ -82,20 +81,8 @@ namespace IW4
json BuildSamplerStateJson(unsigned char samplerState)
{
static const char* samplerFilterNames[]
{
"none",
"nearest",
"linear",
"aniso2x",
"aniso4x"
};
static const char* samplerMipmapNames[]
{
"disabled",
"nearest",
"linear"
};
static const char* samplerFilterNames[]{"none", "nearest", "linear", "aniso2x", "aniso4x"};
static const char* samplerMipmapNames[]{"disabled", "nearest", "linear"};
return json{
{"filter", ArrayEntry(samplerFilterNames, (samplerState & SAMPLER_FILTER_MASK) >> SAMPLER_FILTER_SHIFT)},
@@ -108,21 +95,8 @@ namespace IW4
json BuildTextureTableJson(MaterialTextureDef* textureTable, const size_t count)
{
static const char* semanticNames[]
{
"2d",
"function",
"colorMap",
"detailMap",
"unused2",
"normalMap",
"unused3",
"unused4",
"specularMap",
"unused5",
"unused6",
"waterMap"
};
static const char* semanticNames[]{
"2d", "function", "colorMap", "detailMap", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"};
auto jArray = json::array();
@@ -145,9 +119,9 @@ namespace IW4
else
{
jEntry.merge_patch({
{"nameHash", entry.nameHash},
{"nameHash", entry.nameHash },
{"nameStart", entry.nameStart},
{"nameEnd", entry.nameEnd},
{"nameEnd", entry.nameEnd },
});
}
@@ -220,8 +194,7 @@ namespace IW4
json BuildStateBitsTableJson(const GfxStateBits* stateBitsTable, const size_t count)
{
static const char* blendNames[]
{
static const char* blendNames[]{
"disabled",
"zero",
"one",
@@ -234,51 +207,21 @@ namespace IW4
"destColor",
"invDestColor",
};
static const char* blendOpNames[]
{
"disabled",
"add",
"subtract",
"revSubtract",
"min",
"max"
};
static const char* depthTestNames[]
{
static const char* blendOpNames[]{"disabled", "add", "subtract", "revSubtract", "min", "max"};
static const char* depthTestNames[]{
"always",
"less",
"equal",
"lessEqual",
};
static const char* polygonOffsetNames[]
{
static const char* polygonOffsetNames[]{
"0",
"1",
"2",
"shadowMap",
};
static const char* stencilOpNames[]
{
"keep",
"zero",
"replace",
"incrSat",
"decrSat",
"invert",
"incr",
"decr"
};
static const char* stencilFuncNames[]
{
"never",
"less",
"equal",
"lessEqual",
"greater",
"notEqual",
"greaterEqual",
"always"
};
static const char* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"};
static const char* stencilFuncNames[]{"never", "less", "equal", "lessEqual", "greater", "notEqual", "greaterEqual", "always"};
auto jArray = json::array();
@@ -371,7 +314,8 @@ namespace IW4
if (!surfaceTypeBits)
return "<none>";
static constexpr auto NON_SURFACE_TYPE_BITS = ~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1)));
static constexpr auto NON_SURFACE_TYPE_BITS =
~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1)));
assert((surfaceTypeBits & NON_SURFACE_TYPE_BITS) == 0);
std::ostringstream ss;
@@ -396,44 +340,32 @@ namespace IW4
void DumpMaterialAsJson(Material* material, std::ostream& stream)
{
static const char* cameraRegionNames[]
{
"litOpaque",
"litTrans",
"emissive",
"depthHack",
"none"
};
static const char* cameraRegionNames[]{"litOpaque", "litTrans", "emissive", "depthHack", "none"};
const json j = {
{
"info", {
{"info",
{
#if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1
{"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean
{"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean
#else
{"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean
{"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean
#endif
{"sortKey", material->info.sortKey},
{"textureAtlasRowCount", material->info.textureAtlasRowCount},
{"textureAtlasColumnCount", material->info.textureAtlasColumnCount},
{
"drawSurf", {
{"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)},
{"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)},
{"hasGfxEntIndex", static_cast<unsigned>(material->info.drawSurf.fields.hasGfxEntIndex)},
{"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)},
{"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)},
{"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)},
{"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.useHeroLighting)},
{"sceneLightIndex", static_cast<unsigned>(material->info.drawSurf.fields.sceneLightIndex)},
{"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)},
{"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}
}
},
{"surfaceTypeBits", CreateSurfaceTypeString(material->info.surfaceTypeBits)},
{"hashIndex", material->info.hashIndex}
}
},
{"sortKey", material->info.sortKey},
{"textureAtlasRowCount", material->info.textureAtlasRowCount},
{"textureAtlasColumnCount", material->info.textureAtlasColumnCount},
{"drawSurf",
{{"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)},
{"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)},
{"hasGfxEntIndex", static_cast<unsigned>(material->info.drawSurf.fields.hasGfxEntIndex)},
{"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)},
{"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)},
{"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)},
{"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.useHeroLighting)},
{"sceneLightIndex", static_cast<unsigned>(material->info.drawSurf.fields.sceneLightIndex)},
{"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)},
{"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}}},
{"surfaceTypeBits", CreateSurfaceTypeString(material->info.surfaceTypeBits)},
{"hashIndex", material->info.hashIndex}}},
{"stateBitsEntry", std::vector(std::begin(material->stateBitsEntry), std::end(material->stateBitsEntry))},
#if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1
{"stateFlags", BuildCharFlagsJson("stateFlag", material->stateFlags)},
@@ -478,7 +410,8 @@ namespace IW4
bool m_outdoor_only = false;
// TODO: Find out what p0 in techset name actually means, seems like it only does stuff for techsets using a specular texture though
// TODO: Find out what o0 in techset name actually means, seems like it gives the colormap a blue/whiteish tint and is almost exclusively used on snow-related materials
// TODO: Find out what o0 in techset name actually means, seems like it gives the colormap a blue/whiteish tint and is almost exclusively used on
// snow-related materials
// TODO: Find out what _lin in techset name actually means
bool m_specular_p_flag = false;
bool m_color_o_flag = false;
@@ -576,9 +509,7 @@ namespace IW4
m_entry.m_properties.emplace(std::make_pair(key, value ? "1" : "0"));
}
template <typename T,
typename = typename std::enable_if_t<std::is_arithmetic_v<T>, T>>
void SetValue(const std::string& key, T value)
template<typename T, typename = typename std::enable_if_t<std::is_arithmetic_v<T>, T>> void SetValue(const std::string& key, T value)
{
m_entry.m_properties.emplace(std::make_pair(key, std::to_string(value)));
}
@@ -679,8 +610,8 @@ namespace IW4
m_techset_info.m_uv_anim = true;
else
{
if (namePart != "add" && namePart != "replace" && namePart != "blend" && namePart != "eyeoffset" && namePart != "screen" && namePart != "effect" && namePart != "unlit"
&& namePart != "multiply" && namePart != "sm")
if (namePart != "add" && namePart != "replace" && namePart != "blend" && namePart != "eyeoffset" && namePart != "screen"
&& namePart != "effect" && namePart != "unlit" && namePart != "multiply" && namePart != "sm")
{
assert(false);
}
@@ -942,26 +873,78 @@ namespace IW4
CustomBlendFunc_e m_dst_blend_func_alpha;
};
static inline BlendFuncParameters knownBlendFuncs[]
{
// Only considering passthrough statemap
{BlendFunc_e::ADD, BlendOp_e::ADD, CustomBlendFunc_e::ONE, CustomBlendFunc_e::ONE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::BLEND, BlendOp_e::ADD, CustomBlendFunc_e::SRC_ALPHA, CustomBlendFunc_e::INV_SRC_ALPHA, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::MULTIPLY, BlendOp_e::ADD, CustomBlendFunc_e::ZERO, CustomBlendFunc_e::SRC_COLOR, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::REPLACE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::SCREEN_ADD, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_COLOR, CustomBlendFunc_e::ONE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN},
static inline BlendFuncParameters knownBlendFuncs[]{
// Only considering passthrough statemap
{BlendFunc_e::ADD,
BlendOp_e::ADD,
CustomBlendFunc_e::ONE,
CustomBlendFunc_e::ONE,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::BLEND,
BlendOp_e::ADD,
CustomBlendFunc_e::SRC_ALPHA,
CustomBlendFunc_e::INV_SRC_ALPHA,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::MULTIPLY,
BlendOp_e::ADD,
CustomBlendFunc_e::ZERO,
CustomBlendFunc_e::SRC_COLOR,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::REPLACE,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN},
{BlendFunc_e::SCREEN_ADD,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_COLOR,
CustomBlendFunc_e::ONE,
BlendOp_e::DISABLE,
CustomBlendFunc_e::UNKNOWN,
CustomBlendFunc_e::UNKNOWN},
// TODO: Enable when using statemaps
// Considering default statemap
{BlendFunc_e::ADD, BlendOp_e::ADD, CustomBlendFunc_e::ONE, CustomBlendFunc_e::ONE, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE},
{BlendFunc_e::BLEND, BlendOp_e::ADD, CustomBlendFunc_e::SRC_ALPHA, CustomBlendFunc_e::INV_SRC_ALPHA, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE},
{BlendFunc_e::MULTIPLY, BlendOp_e::ADD, CustomBlendFunc_e::ZERO, CustomBlendFunc_e::SRC_COLOR, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE},
// REPLACE matches passthrough statemap
{BlendFunc_e::SCREEN_ADD, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_COLOR, CustomBlendFunc_e::ONE, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE},
// TODO: Enable when using statemaps
// Considering default statemap
{BlendFunc_e::ADD,
BlendOp_e::ADD,
CustomBlendFunc_e::ONE,
CustomBlendFunc_e::ONE,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_ALPHA,
CustomBlendFunc_e::ONE },
{BlendFunc_e::BLEND,
BlendOp_e::ADD,
CustomBlendFunc_e::SRC_ALPHA,
CustomBlendFunc_e::INV_SRC_ALPHA,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_ALPHA,
CustomBlendFunc_e::ONE },
{BlendFunc_e::MULTIPLY,
BlendOp_e::ADD,
CustomBlendFunc_e::ZERO,
CustomBlendFunc_e::SRC_COLOR,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_ALPHA,
CustomBlendFunc_e::ONE },
// REPLACE matches passthrough statemap
{BlendFunc_e::SCREEN_ADD,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_COLOR,
CustomBlendFunc_e::ONE,
BlendOp_e::ADD,
CustomBlendFunc_e::INV_DST_ALPHA,
CustomBlendFunc_e::ONE },
};
template <typename T>
bool KnownBlendFuncParameterMatches(const T materialValue, const T blendFuncValue)
template<typename T> bool KnownBlendFuncParameterMatches(const T materialValue, const T blendFuncValue)
{
if (blendFuncValue == T::UNKNOWN)
return true;
@@ -983,8 +966,7 @@ namespace IW4
&& KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func, knownBlendFunc.m_dst_blend_func)
&& KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_blend_op_alpha, knownBlendFunc.m_blend_op_alpha)
&& KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_src_blend_func_alpha, knownBlendFunc.m_src_blend_func_alpha)
&& KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func_alpha, knownBlendFunc.m_dst_blend_func_alpha)
)
&& KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func_alpha, knownBlendFunc.m_dst_blend_func_alpha))
{
m_state_bits_info.m_blend_func = knownBlendFunc.m_blend_func;
return;
@@ -994,8 +976,7 @@ namespace IW4
m_state_bits_info.m_blend_func = BlendFunc_e::CUSTOM;
}
template <typename T>
T StateBitsToEnum(const unsigned input, const size_t mask, const size_t shift)
template<typename T> T StateBitsToEnum(const unsigned input, const size_t mask, const size_t shift)
{
const unsigned value = (input & mask) >> shift;
return value >= (static_cast<unsigned>(T::COUNT) - 1) ? T::UNKNOWN : static_cast<T>(value + 1);
@@ -1027,19 +1008,24 @@ namespace IW4
m_state_bits_info.m_custom_blend_op_rgb = StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_RGB_MASK, GFXS0_BLENDOP_RGB_SHIFT);
if (m_state_bits_info.m_custom_blend_op_alpha == BlendOp_e::UNKNOWN)
m_state_bits_info.m_custom_blend_op_alpha = StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_ALPHA_MASK, GFXS0_BLENDOP_ALPHA_SHIFT);
m_state_bits_info.m_custom_blend_op_alpha =
StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_ALPHA_MASK, GFXS0_BLENDOP_ALPHA_SHIFT);
if (m_state_bits_info.m_custom_src_blend_func == CustomBlendFunc_e::UNKNOWN)
m_state_bits_info.m_custom_src_blend_func = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_RGB_MASK, GFXS0_SRCBLEND_RGB_SHIFT);
m_state_bits_info.m_custom_src_blend_func =
StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_RGB_MASK, GFXS0_SRCBLEND_RGB_SHIFT);
if (m_state_bits_info.m_custom_dst_blend_func == CustomBlendFunc_e::UNKNOWN)
m_state_bits_info.m_custom_dst_blend_func = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_RGB_MASK, GFXS0_DSTBLEND_RGB_SHIFT);
m_state_bits_info.m_custom_dst_blend_func =
StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_RGB_MASK, GFXS0_DSTBLEND_RGB_SHIFT);
if (m_state_bits_info.m_custom_src_blend_func_alpha == CustomBlendFunc_e::UNKNOWN)
m_state_bits_info.m_custom_src_blend_func_alpha = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_ALPHA_MASK, GFXS0_SRCBLEND_ALPHA_SHIFT);
m_state_bits_info.m_custom_src_blend_func_alpha =
StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_ALPHA_MASK, GFXS0_SRCBLEND_ALPHA_SHIFT);
if (m_state_bits_info.m_custom_dst_blend_func_alpha == CustomBlendFunc_e::UNKNOWN)
m_state_bits_info.m_custom_dst_blend_func_alpha = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_ALPHA_MASK, GFXS0_DSTBLEND_ALPHA_SHIFT);
m_state_bits_info.m_custom_dst_blend_func_alpha =
StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_ALPHA_MASK, GFXS0_DSTBLEND_ALPHA_SHIFT);
if (m_state_bits_info.m_alpha_test == AlphaTest_e::UNKNOWN)
{
@@ -1070,7 +1056,8 @@ namespace IW4
}
if (m_state_bits_info.m_depth_write == StateBitsEnabledStatus_e::UNKNOWN)
m_state_bits_info.m_depth_write = (stateBits.loadBits[1] & GFXS1_DEPTHWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
m_state_bits_info.m_depth_write =
(stateBits.loadBits[1] & GFXS1_DEPTHWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
if (m_state_bits_info.m_cull_face == CullFace_e::UNKNOWN)
{
@@ -1085,16 +1072,20 @@ namespace IW4
}
if (m_state_bits_info.m_polygon_offset == PolygonOffset_e::UNKNOWN)
m_state_bits_info.m_polygon_offset = StateBitsToEnum<PolygonOffset_e>(stateBits.loadBits[1], GFXS1_POLYGON_OFFSET_MASK, GFXS1_POLYGON_OFFSET_SHIFT);
m_state_bits_info.m_polygon_offset =
StateBitsToEnum<PolygonOffset_e>(stateBits.loadBits[1], GFXS1_POLYGON_OFFSET_MASK, GFXS1_POLYGON_OFFSET_SHIFT);
if (m_state_bits_info.m_color_write_rgb == StateBitsEnabledStatus_e::UNKNOWN)
m_state_bits_info.m_color_write_rgb = (stateBits.loadBits[0] & GFXS0_COLORWRITE_RGB) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
m_state_bits_info.m_color_write_rgb =
(stateBits.loadBits[0] & GFXS0_COLORWRITE_RGB) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
if (m_state_bits_info.m_color_write_alpha == StateBitsEnabledStatus_e::UNKNOWN)
m_state_bits_info.m_color_write_alpha = (stateBits.loadBits[0] & GFXS0_COLORWRITE_ALPHA) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
m_state_bits_info.m_color_write_alpha =
(stateBits.loadBits[0] & GFXS0_COLORWRITE_ALPHA) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
if (m_state_bits_info.m_gamma_write == StateBitsEnabledStatus_e::UNKNOWN)
m_state_bits_info.m_gamma_write = (stateBits.loadBits[0] & GFXS0_GAMMAWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
m_state_bits_info.m_gamma_write =
(stateBits.loadBits[0] & GFXS0_GAMMAWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED;
if (m_state_bits_info.m_stencil_mode == StencilMode_e::UNKNOWN)
{
@@ -1115,28 +1106,36 @@ namespace IW4
}
if (m_state_bits_info.m_stencil_front_func == StencilFunc_e::UNKNOWN)
m_state_bits_info.m_stencil_front_func = StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FUNC_MASK, GFXS1_STENCIL_FRONT_FUNC_SHIFT);
m_state_bits_info.m_stencil_front_func =
StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FUNC_MASK, GFXS1_STENCIL_FRONT_FUNC_SHIFT);
if (m_state_bits_info.m_stencil_front_pass == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_front_pass = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_PASS_MASK, GFXS1_STENCIL_FRONT_PASS_SHIFT);
m_state_bits_info.m_stencil_front_pass =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_PASS_MASK, GFXS1_STENCIL_FRONT_PASS_SHIFT);
if (m_state_bits_info.m_stencil_front_fail == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_front_fail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FAIL_MASK, GFXS1_STENCIL_FRONT_FAIL_SHIFT);
m_state_bits_info.m_stencil_front_fail =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FAIL_MASK, GFXS1_STENCIL_FRONT_FAIL_SHIFT);
if (m_state_bits_info.m_stencil_front_zfail == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_front_zfail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_ZFAIL_MASK, GFXS1_STENCIL_FRONT_ZFAIL_SHIFT);
m_state_bits_info.m_stencil_front_zfail =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_ZFAIL_MASK, GFXS1_STENCIL_FRONT_ZFAIL_SHIFT);
if (m_state_bits_info.m_stencil_back_func == StencilFunc_e::UNKNOWN)
m_state_bits_info.m_stencil_back_func = StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FUNC_MASK, GFXS1_STENCIL_BACK_FUNC_SHIFT);
m_state_bits_info.m_stencil_back_func =
StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FUNC_MASK, GFXS1_STENCIL_BACK_FUNC_SHIFT);
if (m_state_bits_info.m_stencil_back_pass == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_back_pass = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_PASS_MASK, GFXS1_STENCIL_BACK_PASS_SHIFT);
m_state_bits_info.m_stencil_back_pass =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_PASS_MASK, GFXS1_STENCIL_BACK_PASS_SHIFT);
if (m_state_bits_info.m_stencil_back_fail == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_back_fail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FAIL_MASK, GFXS1_STENCIL_BACK_FAIL_SHIFT);
m_state_bits_info.m_stencil_back_fail =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FAIL_MASK, GFXS1_STENCIL_BACK_FAIL_SHIFT);
if (m_state_bits_info.m_stencil_back_zfail == StencilOp_e::UNKNOWN)
m_state_bits_info.m_stencil_back_zfail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_ZFAIL_MASK, GFXS1_STENCIL_BACK_ZFAIL_SHIFT);
m_state_bits_info.m_stencil_back_zfail =
StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_ZFAIL_MASK, GFXS1_STENCIL_BACK_ZFAIL_SHIFT);
ExamineBlendFunc();
}
@@ -1214,17 +1213,17 @@ namespace IW4
const auto materialType = m_techset_info.m_gdt_material_type;
const auto colorMapIndex = FindTexture("colorMap");
const auto detailMapIndex = FindTexture("detailMap");
const auto hasColorMap = colorMapIndex >= 0 && m_material->textureTable[colorMapIndex].semantic != TS_WATER_MAP && m_material->textureTable[colorMapIndex].u.image;
const auto hasDetailMap = detailMapIndex >= 0 && m_material->textureTable[detailMapIndex].semantic != TS_WATER_MAP && m_material->textureTable[detailMapIndex].u.image;
const auto hasColorMap = colorMapIndex >= 0 && m_material->textureTable[colorMapIndex].semantic != TS_WATER_MAP
&& m_material->textureTable[colorMapIndex].u.image;
const auto hasDetailMap = detailMapIndex >= 0 && m_material->textureTable[detailMapIndex].semantic != TS_WATER_MAP
&& m_material->textureTable[detailMapIndex].u.image;
if ((materialType == MATERIAL_TYPE_MODEL_PHONG || materialType == MATERIAL_TYPE_WORLD_PHONG)
&& hasColorMap && hasDetailMap)
if ((materialType == MATERIAL_TYPE_MODEL_PHONG || materialType == MATERIAL_TYPE_WORLD_PHONG) && hasColorMap && hasDetailMap)
{
const auto colorMapTexture = m_material->textureTable[colorMapIndex].u.image;
const auto detailMapTexture = m_material->textureTable[detailMapIndex].u.image;
if (colorMapTexture->width != 0 && colorMapTexture->height != 0
&& detailMapTexture->width != 0 && detailMapTexture->height != 0)
if (colorMapTexture->width != 0 && colorMapTexture->height != 0 && detailMapTexture->width != 0 && detailMapTexture->height != 0)
{
const auto detailScaleFactorX = static_cast<float>(colorMapTexture->width) / static_cast<float>(detailMapTexture->width);
const auto detailScaleFactorY = static_cast<float>(colorMapTexture->height) / static_cast<float>(detailMapTexture->height);
@@ -1304,7 +1303,6 @@ namespace IW4
SetValue("outdoorOnly", m_techset_info.m_outdoor_only);
SetValue("eyeOffsetDepth", m_constants_info.m_eye_offset_depth);
// TODO: These are not good names, change when known what they do
SetValue("specularP", m_techset_info.m_specular_p_flag);
SetValue("colorO", m_techset_info.m_color_o_flag);
@@ -1371,7 +1369,8 @@ namespace IW4
if (knownMaterialSourceName == knownTextureMaps.end())
{
assert(false);
std::cout << "Unknown material texture source name hash: 0x" << std::hex << entry.nameHash << " (" << entry.nameStart << "..." << entry.nameEnd << ")\n";
std::cout << "Unknown material texture source name hash: 0x" << std::hex << entry.nameHash << " (" << entry.nameStart << "..."
<< entry.nameEnd << ")\n";
continue;
}
@@ -1457,7 +1456,7 @@ namespace IW4
return m_entry;
}
};
}
} // namespace IW4
bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset)
{

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<Material>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,13 +1,13 @@
#include "AssetDumperMenuDef.h"
#include <filesystem>
#include <string>
#include "AssetDumperMenuList.h"
#include "ObjWriting.h"
#include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/Menu/MenuDumperIW4.h"
#include "Menu/AbstractMenuDumper.h"
#include "ObjWriting.h"
#include <filesystem>
#include <string>
using namespace IW4;
@@ -31,7 +31,7 @@ void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo<menu
const auto* menu = asset->Asset();
auto* zoneState = context.GetZoneAssetDumperState<menu::MenuDumpingZoneState>();
if(!ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST))
if (!ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST))
{
// Make sure menu paths based on menu lists are created
const auto* gameAssetPool = dynamic_cast<GameAssetPoolIW4*>(asset->m_zone->m_pools.get());

View File

@@ -14,4 +14,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<menuDef_t>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,13 +1,13 @@
#include "AssetDumperMenuList.h"
#include "Game/IW4/Menu/MenuDumperIW4.h"
#include "Menu/AbstractMenuDumper.h"
#include "ObjWriting.h"
#include <cassert>
#include <filesystem>
#include <sstream>
#include <set>
#include "ObjWriting.h"
#include "Game/IW4/Menu/MenuDumperIW4.h"
#include "Menu/AbstractMenuDumper.h"
#include <sstream>
namespace fs = std::filesystem;
@@ -21,17 +21,17 @@ std::vector<const ExpressionSupportingData*> AssetDumperMenuList::GetAllUniqueEx
if (menuList->menus == nullptr)
return result;
for(auto i = 0; i < menuList->menuCount; i++)
for (auto i = 0; i < menuList->menuCount; i++)
{
if(menuList->menus[i] == nullptr)
if (menuList->menus[i] == nullptr)
continue;
const auto* menu = menuList->menus[i];
if(menu->expressionData == nullptr)
if (menu->expressionData == nullptr)
continue;
if(alreadyAddedSupportingData.find(menu->expressionData) == alreadyAddedSupportingData.end())
if (alreadyAddedSupportingData.find(menu->expressionData) == alreadyAddedSupportingData.end())
{
result.push_back(menu->expressionData);
alreadyAddedSupportingData.emplace(menu->expressionData);
@@ -53,10 +53,10 @@ void AssetDumperMenuList::DumpFunctions(MenuDumper& menuDumper, const MenuList*
if (supportingData->uifunctions.functions == nullptr)
continue;
for(auto i = 0; i < supportingData->uifunctions.totalFunctions; i++)
for (auto i = 0; i < supportingData->uifunctions.totalFunctions; i++)
{
const auto* function = supportingData->uifunctions.functions[i];
if(function != nullptr)
if (function != nullptr)
{
std::stringstream ss;
ss << "FUNC_" << functionIndex;
@@ -76,7 +76,7 @@ void AssetDumperMenuList::DumpMenus(MenuDumper& menuDumper, menu::MenuDumpingZon
const auto* menu = menuList->menus[menuNum];
const auto menuDumpingState = zoneState->m_menu_dumping_state_map.find(menu);
if(menuDumpingState == zoneState->m_menu_dumping_state_map.end())
if (menuDumpingState == zoneState->m_menu_dumping_state_map.end())
continue;
// If the menu was embedded directly as menu list write its data in the menu list file
@@ -106,7 +106,7 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfo<Men
menuDumper.Start();
if(!ObjWriting::Configuration.MenuLegacyMode)
if (!ObjWriting::Configuration.MenuLegacyMode)
DumpFunctions(menuDumper, menuList);
DumpMenus(menuDumper, zoneState, menuList);
@@ -141,21 +141,21 @@ void AssetDumperMenuList::CreateDumpingStateForMenuList(menu::MenuDumpingZoneSta
if (p.has_parent_path())
parentPath = p.parent_path().string() + "/";
for(auto i = 0; i < menuList->menuCount; i++)
for (auto i = 0; i < menuList->menuCount; i++)
{
auto* menu = menuList->menus[i];
if(menu == nullptr)
if (menu == nullptr)
continue;
auto existingState = zoneState->m_menu_dumping_state_map.find(menu);
if(existingState == zoneState->m_menu_dumping_state_map.end())
if (existingState == zoneState->m_menu_dumping_state_map.end())
{
auto menuPath = PathForMenu(parentPath, menu);
const auto isTheSameAsMenuList = menuPath == menuListName;
zoneState->CreateMenuDumpingState(menu, std::move(menuPath), isTheSameAsMenuList ? menuList : nullptr);
}
else if(existingState->second.m_alias_menu_list == nullptr)
else if (existingState->second.m_alias_menu_list == nullptr)
{
auto menuPath = PathForMenu(parentPath, menu);
const auto isTheSameAsMenuList = menuPath == menuListName;
@@ -172,7 +172,7 @@ void AssetDumperMenuList::DumpPool(AssetDumpingContext& context, AssetPool<MenuL
{
auto* zoneState = context.GetZoneAssetDumperState<menu::MenuDumpingZoneState>();
for(auto* asset : *pool)
for (auto* asset : *pool)
CreateDumpingStateForMenuList(zoneState, asset->Asset());
AbstractAssetDumper<MenuList>::DumpPool(context, pool);

View File

@@ -24,4 +24,4 @@ namespace IW4
static void CreateDumpingStateForMenuList(menu::MenuDumpingZoneState* zoneState, const MenuList* menuList);
void DumpPool(AssetDumpingContext& context, AssetPool<MenuList>* pool) override;
};
}
} // namespace IW4

View File

@@ -1,10 +1,10 @@
#include "AssetDumperPhysCollmap.h"
#include "Dumping/MapFile/MapFileDumper.h"
#include <cassert>
#include <sstream>
#include "Dumping/MapFile/MapFileDumper.h"
using namespace IW4;
std::string AssetDumperPhysCollmap::GetAssetFilename(const std::string& assetName)
@@ -54,9 +54,9 @@ void AssetDumperPhysCollmap::DumpAsset(AssetDumpingContext& context, XAssetInfo<
mapFileDumper.WritePhysicsBox({
{geom.bounds.midPoint[0], geom.bounds.midPoint[1], geom.bounds.midPoint[2]},
{geom.bounds.halfSize[0], geom.bounds.halfSize[1], geom.bounds.halfSize[2]},
{geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2]},
{geom.orientation[1][0], geom.orientation[1][1], geom.orientation[1][2]},
{geom.orientation[2][0], geom.orientation[2][1], geom.orientation[2][2]}
{geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2] },
{geom.orientation[1][0], geom.orientation[1][1], geom.orientation[1][2] },
{geom.orientation[2][0], geom.orientation[2][1], geom.orientation[2][2] }
});
break;
@@ -65,7 +65,7 @@ void AssetDumperPhysCollmap::DumpAsset(AssetDumpingContext& context, XAssetInfo<
{geom.bounds.midPoint[0], geom.bounds.midPoint[1], geom.bounds.midPoint[2]},
geom.bounds.halfSize[0],
geom.bounds.halfSize[2] * 2,
{geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2]}
{geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2] }
});
break;

View File

@@ -13,4 +13,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<PhysCollmap>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysCollmap>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,14 +1,14 @@
#include "AssetDumperPhysPreset.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/PhysPresetFields.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <type_traits>
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/PhysPresetFields.h"
using namespace IW4;
namespace IW4
@@ -22,12 +22,15 @@ namespace IW4
}
public:
InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback)
InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback))
{
}
};
}
} // namespace IW4
void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo)
{
@@ -59,14 +62,17 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset
auto* physPresetInfo = new PhysPresetInfo;
CopyToPhysPresetInfo(asset->Asset(), physPresetInfo);
InfoStringFromPhysPresetConverter converter(physPresetInfo, phys_preset_fields, std::extent<decltype(phys_preset_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
InfoStringFromPhysPresetConverter converter(physPresetInfo,
phys_preset_fields,
std::extent<decltype(phys_preset_fields)>::value,
[asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
@@ -98,4 +104,4 @@ void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<P
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET);
stream.write(stringValue.c_str(), stringValue.size());
}
}
}

View File

@@ -15,4 +15,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<PhysPreset>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override;
};
}
} // namespace IW4

View File

@@ -21,5 +21,6 @@ void AssetDumperPixelShader::DumpAsset(AssetDumpingContext& context, XAssetInfo<
if (!shaderFile)
return;
shaderFile->write(reinterpret_cast<const char*>(pixelShader->prog.loadDef.program), static_cast<std::streamsize>(pixelShader->prog.loadDef.programSize) * 4u);
shaderFile->write(reinterpret_cast<const char*>(pixelShader->prog.loadDef.program),
static_cast<std::streamsize>(pixelShader->prog.loadDef.programSize) * 4u);
}

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<MaterialPixelShader>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,7 +1,7 @@
#include "AssetDumperRawFile.h"
#include <zlib.h>
#include <stdexcept>
#include <zlib.h>
using namespace IW4;

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,9 +1,9 @@
#include "AssetDumperSndCurve.h"
#include <sstream>
#include "Dumping/SndCurve/SndCurveDumper.h"
#include <sstream>
using namespace IW4;
std::string AssetDumperSndCurve::GetAssetFilename(const std::string& assetName)

View File

@@ -13,4 +13,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<SndCurve>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset) override;
};
}
} // namespace IW4

View File

@@ -16,7 +16,7 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<
if (!assetFile)
return;
CsvOutputStream csv(*assetFile);
for (auto row = 0; row < stringTable->rowCount; row++)

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,10 +1,10 @@
#include "AssetDumperStructuredDataDefSet.h"
#include "StructuredDataDef/StructuredDataDefDumper.h"
#include <algorithm>
#include <cassert>
#include <sstream>
#include <algorithm>
#include "StructuredDataDef/StructuredDataDefDumper.h"
using namespace IW4;
using namespace std::string_literals;
@@ -73,7 +73,7 @@ void AssetDumperStructuredDataDefSet::ConvertEnum(CommonStructuredDataEnum* out,
out->m_reserved_entry_count = -1;
out->m_entries.resize(static_cast<size_t>(std::max(in->entryCount, 0)));
for(auto i = 0u; i < out->m_entries.size(); i++)
for (auto i = 0u; i < out->m_entries.size(); i++)
{
auto& outEntry = out->m_entries[i];
const auto& inEntry = in->entries[i];
@@ -85,7 +85,11 @@ void AssetDumperStructuredDataDefSet::ConvertEnum(CommonStructuredDataEnum* out,
out->SortEntriesByOffset();
}
void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDef* def, const StructuredDataDef* gameDef, CommonStructuredDataStruct* out, const StructuredDataStruct* in, const size_t structIndex)
void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDef* def,
const StructuredDataDef* gameDef,
CommonStructuredDataStruct* out,
const StructuredDataStruct* in,
const size_t structIndex)
{
if (gameDef->rootType.type == DATA_STRUCT && structIndex == static_cast<size_t>(gameDef->rootType.u.structIndex))
{
@@ -118,14 +122,18 @@ void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDe
out->SortPropertiesByOffset();
}
void AssetDumperStructuredDataDefSet::ConvertIndexedArray(const CommonStructuredDataDef* def, CommonStructuredDataIndexedArray* out, const StructuredDataIndexedArray* in)
void AssetDumperStructuredDataDefSet::ConvertIndexedArray(const CommonStructuredDataDef* def,
CommonStructuredDataIndexedArray* out,
const StructuredDataIndexedArray* in)
{
out->m_element_count = static_cast<size_t>(std::max(in->arraySize, 0));
out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8;
out->m_array_type = ConvertType(def, in->elementType);
}
void AssetDumperStructuredDataDefSet::ConvertEnumedArray(const CommonStructuredDataDef* def, CommonStructuredDataEnumedArray* out, const StructuredDataEnumedArray* in)
void AssetDumperStructuredDataDefSet::ConvertEnumedArray(const CommonStructuredDataDef* def,
CommonStructuredDataEnumedArray* out,
const StructuredDataEnumedArray* in)
{
assert(!def->m_enums.empty());
out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8;

View File

@@ -1,18 +1,22 @@
#pragma once
#include <cstddef>
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "StructuredDataDef/CommonStructuredDataDef.h"
#include <cstddef>
namespace IW4
{
class AssetDumperStructuredDataDefSet final : public AbstractAssetDumper<StructuredDataDefSet>
{
static CommonStructuredDataType ConvertType(const CommonStructuredDataDef* def, StructuredDataType in);
static void ConvertEnum(CommonStructuredDataEnum* out, const StructuredDataEnum* in, size_t enumIndex);
static void ConvertStruct(const CommonStructuredDataDef* def, const StructuredDataDef* gameDef, CommonStructuredDataStruct* out, const StructuredDataStruct* in, size_t structIndex);
static void ConvertStruct(const CommonStructuredDataDef* def,
const StructuredDataDef* gameDef,
CommonStructuredDataStruct* out,
const StructuredDataStruct* in,
size_t structIndex);
static void ConvertIndexedArray(const CommonStructuredDataDef* def, CommonStructuredDataIndexedArray* out, const StructuredDataIndexedArray* in);
static void ConvertEnumedArray(const CommonStructuredDataDef* def, CommonStructuredDataEnumedArray* out, const StructuredDataEnumedArray* in);
static std::unique_ptr<CommonStructuredDataDef> ConvertDef(const StructuredDataDef* in);
@@ -21,4 +25,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<StructuredDataDefSet>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StructuredDataDefSet>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,15 +1,15 @@
#include "AssetDumperTechniqueSet.h"
#include <algorithm>
#include <cassert>
#include <sstream>
#include <type_traits>
#include "Dumping/AbstractTextDumper.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Pool/GlobalAssetPool.h"
#include "Shader/D3D9ShaderAnalyser.h"
#include <algorithm>
#include <cassert>
#include <sstream>
#include <type_traits>
using namespace IW4;
namespace IW4
@@ -38,7 +38,9 @@ namespace IW4
m_stream << "stateMap \"passthrough\"; // TODO\n";
}
static bool FindCodeConstantSourceAccessor(const MaterialConstantSource sourceIndexToFind, const CodeConstantSource* codeConstantTable, std::string& codeSourceAccessor)
static bool FindCodeConstantSourceAccessor(const MaterialConstantSource sourceIndexToFind,
const CodeConstantSource* codeConstantTable,
std::string& codeSourceAccessor)
{
const auto* currentCodeConst = codeConstantTable;
while (currentCodeConst->name != nullptr)
@@ -60,7 +62,8 @@ namespace IW4
&& static_cast<unsigned>(currentCodeConst->source) + currentCodeConst->arrayCount > static_cast<unsigned>(sourceIndexToFind))
{
std::ostringstream ss;
ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) << ']';
ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source))
<< ']';
codeSourceAccessor = ss.str();
return true;
}
@@ -77,7 +80,9 @@ namespace IW4
return false;
}
static bool FindCodeSamplerSourceAccessor(const MaterialTextureSource sourceIndexToFind, const CodeSamplerSource* codeSamplerTable, std::string& codeSourceAccessor)
static bool FindCodeSamplerSourceAccessor(const MaterialTextureSource sourceIndexToFind,
const CodeSamplerSource* codeSamplerTable,
std::string& codeSourceAccessor)
{
const auto* currentCodeConst = codeSamplerTable;
while (currentCodeConst->name != nullptr)
@@ -99,7 +104,8 @@ namespace IW4
&& static_cast<unsigned>(currentCodeConst->source) + currentCodeConst->arrayCount > static_cast<unsigned>(sourceIndexToFind))
{
std::ostringstream ss;
ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) << ']';
ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source))
<< ']';
codeSourceAccessor = ss.str();
return true;
}
@@ -118,11 +124,15 @@ namespace IW4
void DumpShaderArg(const MaterialShaderArgument& arg, const d3d9::ShaderInfo& shaderInfo) const
{
const auto expectedRegisterSet = arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4;
const auto targetShaderArg = std::find_if(shaderInfo.m_constants.begin(), shaderInfo.m_constants.end(), [arg, expectedRegisterSet](const d3d9::ShaderConstant& constant)
{
return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest && constant.m_register_index + constant.m_register_count > arg.dest;
});
const auto expectedRegisterSet =
arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4;
const auto targetShaderArg = std::find_if(shaderInfo.m_constants.begin(),
shaderInfo.m_constants.end(),
[arg, expectedRegisterSet](const d3d9::ShaderConstant& constant)
{
return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest
&& constant.m_register_index + constant.m_register_count > arg.dest;
});
assert(targetShaderArg != shaderInfo.m_constants.end());
if (targetShaderArg == shaderInfo.m_constants.end())
@@ -200,11 +210,8 @@ namespace IW4
if (arg.u.literalConst)
{
Indent();
m_stream << codeDestAccessor << " = float4( " << (*arg.u.literalConst)[0]
<< ", " << (*arg.u.literalConst)[1]
<< ", " << (*arg.u.literalConst)[2]
<< ", " << (*arg.u.literalConst)[3]
<< " );\n";
m_stream << codeDestAccessor << " = float4( " << (*arg.u.literalConst)[0] << ", " << (*arg.u.literalConst)[1] << ", "
<< (*arg.u.literalConst)[2] << ", " << (*arg.u.literalConst)[3] << " );\n";
}
}
else if (arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER)
@@ -221,7 +228,7 @@ namespace IW4
{
const auto knownMaterialTextureName = knownTextureMaps.find(arg.u.nameHash);
if(knownMaterialTextureName != knownTextureMaps.end())
if (knownMaterialTextureName != knownTextureMaps.end())
{
m_stream << knownMaterialTextureName->second.m_name;
}
@@ -265,29 +272,28 @@ namespace IW4
vertexShader = loadedVertexShaderFromOtherZone->Asset();
}
const auto vertexShaderInfo = d3d9::ShaderAnalyser::GetShaderInfo(vertexShader->prog.loadDef.program, vertexShader->prog.loadDef.programSize * sizeof(uint32_t));
const auto vertexShaderInfo =
d3d9::ShaderAnalyser::GetShaderInfo(vertexShader->prog.loadDef.program, vertexShader->prog.loadDef.programSize * sizeof(uint32_t));
assert(vertexShaderInfo);
if (!vertexShaderInfo)
return;
m_stream << "\n";
Indent();
m_stream << "vertexShader " << vertexShaderInfo->m_version_major << "." << vertexShaderInfo->m_version_minor << " \"" << vertexShader->name << "\"\n";
m_stream << "vertexShader " << vertexShaderInfo->m_version_major << "." << vertexShaderInfo->m_version_minor << " \"" << vertexShader->name
<< "\"\n";
Indent();
m_stream << "{\n";
IncIndent();
if (pass.args)
{
const auto totalArgCount = static_cast<size_t>(pass.perPrimArgCount)
+ static_cast<size_t>(pass.perObjArgCount)
+ static_cast<size_t>(pass.stableArgCount);
const auto totalArgCount =
static_cast<size_t>(pass.perPrimArgCount) + static_cast<size_t>(pass.perObjArgCount) + static_cast<size_t>(pass.stableArgCount);
for (auto i = 0u; i < totalArgCount; i++)
{
const auto& arg = pass.args[i];
if (arg.type == MTL_ARG_MATERIAL_VERTEX_CONST
|| arg.type == MTL_ARG_LITERAL_VERTEX_CONST
|| arg.type == MTL_ARG_CODE_VERTEX_CONST)
if (arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg.type == MTL_ARG_LITERAL_VERTEX_CONST || arg.type == MTL_ARG_CODE_VERTEX_CONST)
{
DumpShaderArg(arg, *vertexShaderInfo);
}
@@ -321,7 +327,8 @@ namespace IW4
pixelShader = loadedPixelShaderFromOtherZone->Asset();
}
const auto pixelShaderInfo = d3d9::ShaderAnalyser::GetShaderInfo(pixelShader->prog.loadDef.program, pixelShader->prog.loadDef.programSize * sizeof(uint32_t));
const auto pixelShaderInfo =
d3d9::ShaderAnalyser::GetShaderInfo(pixelShader->prog.loadDef.program, pixelShader->prog.loadDef.programSize * sizeof(uint32_t));
assert(pixelShaderInfo);
if (!pixelShaderInfo)
return;
@@ -335,17 +342,13 @@ namespace IW4
if (pass.args)
{
const auto totalArgCount = static_cast<size_t>(pass.perPrimArgCount)
+ static_cast<size_t>(pass.perObjArgCount)
+ static_cast<size_t>(pass.stableArgCount);
const auto totalArgCount =
static_cast<size_t>(pass.perPrimArgCount) + static_cast<size_t>(pass.perObjArgCount) + static_cast<size_t>(pass.stableArgCount);
for (auto i = 0u; i < totalArgCount; i++)
{
const auto& arg = pass.args[i];
if (arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER
|| arg.type == MTL_ARG_CODE_PIXEL_SAMPLER
|| arg.type == MTL_ARG_CODE_PIXEL_CONST
|| arg.type == MTL_ARG_MATERIAL_PIXEL_CONST
|| arg.type == MTL_ARG_LITERAL_PIXEL_CONST)
if (arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER || arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_CODE_PIXEL_CONST
|| arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg.type == MTL_ARG_LITERAL_PIXEL_CONST)
{
DumpShaderArg(arg, *pixelShaderInfo);
}
@@ -408,8 +411,8 @@ namespace IW4
{
const auto& stream = vertexDecl->routing.data[streamIndex];
Indent();
m_stream << "vertex." << GetStreamDestinationString(static_cast<MaterialStreamDestination_e>(stream.dest))
<< " = code." << GetStreamSourceString(static_cast<MaterialStreamStreamSource_e>(stream.source)) << ";\n";
m_stream << "vertex." << GetStreamDestinationString(static_cast<MaterialStreamDestination_e>(stream.dest)) << " = code."
<< GetStreamSourceString(static_cast<MaterialStreamStreamSource_e>(stream.source)) << ";\n";
}
}
@@ -448,12 +451,12 @@ namespace IW4
void DumpTechnique(const MaterialTechnique* technique)
{
#ifdef TECHSET_DEBUG
if(technique->flags)
if (technique->flags)
{
for(auto i = 0u; i < 16; i++)
for (auto i = 0u; i < 16; i++)
{
const auto mask = 1u << i;
if(technique->flags & mask)
if (technique->flags & mask)
{
Indent();
m_stream << "// TECHNIQUE FLAGS: 0x" << std::hex << mask << "\n";
@@ -512,7 +515,8 @@ namespace IW4
dumpedTechniques[techniqueIndex] = true;
WriteTechniqueType(techniqueIndex);
for (auto nextTechniqueIndex = techniqueIndex + 1; nextTechniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; nextTechniqueIndex++)
for (auto nextTechniqueIndex = techniqueIndex + 1; nextTechniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>;
nextTechniqueIndex++)
{
if (techset->techniques[nextTechniqueIndex] != technique)
continue;
@@ -525,7 +529,7 @@ namespace IW4
}
}
};
}
} // namespace IW4
std::string AssetDumperTechniqueSet::GetTechniqueFileName(const MaterialTechnique* technique)
{

View File

@@ -14,4 +14,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<MaterialTechniqueSet>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialTechniqueSet>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,14 +1,14 @@
#include "AssetDumperTracer.h"
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/TracerFields.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include <cassert>
#include <sstream>
#include <type_traits>
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/TracerFields.h"
using namespace IW4;
namespace IW4
@@ -22,23 +22,29 @@ namespace IW4
}
public:
InfoStringFromTracerConverter(const TracerDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback)
InfoStringFromTracerConverter(const TracerDef* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback))
{
}
};
}
} // namespace IW4
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
{
assert(scrStr < asset->m_zone->m_script_strings.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
InfoStringFromTracerConverter converter(asset->Asset(),
tracer_fields,
std::extent<decltype(tracer_fields)>::value,
[asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset->m_zone->m_script_strings.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}

View File

@@ -14,4 +14,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<TracerDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,15 +1,15 @@
#include "AssetDumperVehicle.h"
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/InfoString/EnumStrings.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/VehicleFields.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include <cassert>
#include <sstream>
#include <type_traits>
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/InfoString/EnumStrings.h"
#include "Game/IW4/InfoString/VehicleFields.h"
using namespace IW4;
namespace IW4
@@ -32,29 +32,29 @@ namespace IW4
break;
case VFT_TROPHY_TAGS:
{
const auto* trophyTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(VehicleDef::trophyTags)>::value; i++)
{
const auto* trophyTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(VehicleDef::trophyTags)>::value; i++)
const auto& str = m_get_scr_string(trophyTags[i]);
if (!str.empty())
{
const auto& str = m_get_scr_string(trophyTags[i]);
if (!str.empty())
{
if (!first)
ss << "\n";
else
first = false;
if (!first)
ss << "\n";
else
first = false;
ss << str;
}
ss << str;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case VFT_NUM:
default:
assert(false);
@@ -63,23 +63,29 @@ namespace IW4
}
public:
InfoStringFromVehicleConverter(const VehicleDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback)
InfoStringFromVehicleConverter(const VehicleDef* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback))
{
}
};
}
} // namespace IW4
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.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
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.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}

View File

@@ -14,4 +14,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
};
}
} // namespace IW4

View File

@@ -21,5 +21,6 @@ void AssetDumperVertexShader::DumpAsset(AssetDumpingContext& context, XAssetInfo
if (!shaderFile)
return;
shaderFile->write(reinterpret_cast<const char*>(vertexShader->prog.loadDef.program), static_cast<std::streamsize>(vertexShader->prog.loadDef.programSize) * 4u);
shaderFile->write(reinterpret_cast<const char*>(vertexShader->prog.loadDef.program),
static_cast<std::streamsize>(vertexShader->prog.loadDef.programSize) * 4u);
}

View File

@@ -11,4 +11,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<MaterialVertexShader>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,16 +1,16 @@
#include "AssetDumperWeapon.h"
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/InfoString/EnumStrings.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/WeaponFields.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include <cassert>
#include <cstring>
#include <sstream>
#include <type_traits>
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/InfoString/EnumStrings.h"
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW4/InfoString/WeaponFields.h"
using namespace IW4;
namespace IW4
@@ -67,28 +67,27 @@ namespace IW4
break;
case WFT_BOUNCE_SOUND:
{
const auto* bounceSound = *reinterpret_cast<SndAliasCustom**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (bounceSound && bounceSound->name)
{
const auto* bounceSound = *reinterpret_cast<SndAliasCustom**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
const std::string firstBounceSound(bounceSound->name->soundName);
const auto endOfBouncePrefix = firstBounceSound.rfind("_default");
assert(endOfBouncePrefix != std::string::npos);
if (bounceSound && bounceSound->name)
if (endOfBouncePrefix != std::string::npos)
{
const std::string firstBounceSound(bounceSound->name->soundName);
const auto endOfBouncePrefix = firstBounceSound.rfind("_default");
assert(endOfBouncePrefix != std::string::npos);
if (endOfBouncePrefix != std::string::npos)
{
m_info_string.SetValueForKey(std::string(field.szName),
firstBounceSound.substr(0, endOfBouncePrefix));
}
else
m_info_string.SetValueForKey(std::string(field.szName), "");
m_info_string.SetValueForKey(std::string(field.szName), firstBounceSound.substr(0, endOfBouncePrefix));
}
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
case WFT_STICKINESS:
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value);
@@ -119,87 +118,87 @@ namespace IW4
break;
case WFT_HIDETAGS:
{
const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
{
const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
const auto& str = m_get_scr_string(hideTags[i]);
if (!str.empty())
{
const auto& str = m_get_scr_string(hideTags[i]);
if (!str.empty())
{
if (!first)
ss << "\n";
else
first = false;
if (!first)
ss << "\n";
else
first = false;
ss << str;
}
ss << str;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case WFT_NOTETRACKSOUNDMAP:
{
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value];
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; i++)
{
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value];
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; i++)
const auto& key = m_get_scr_string(keys[i]);
const auto& value = m_get_scr_string(values[i]);
if (!key.empty())
{
const auto& key = m_get_scr_string(keys[i]);
const auto& value = m_get_scr_string(values[i]);
if (!key.empty())
{
if (!first)
ss << "\n";
else
first = false;
if (!first)
ss << "\n";
else
first = false;
ss << key;
ss << key;
if (!value.empty())
ss << " " << value;
}
if (!value.empty())
ss << " " << value;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case WFT_NOTETRACKRUMBLEMAP:
{
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value];
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value; i++)
{
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value];
std::stringstream ss;
bool first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value; i++)
const auto& key = m_get_scr_string(keys[i]);
const auto& value = m_get_scr_string(values[i]);
if (!key.empty())
{
const auto& key = m_get_scr_string(keys[i]);
const auto& value = m_get_scr_string(values[i]);
if (!key.empty())
{
if (!first)
ss << "\n";
else
first = false;
if (!first)
ss << "\n";
else
first = false;
ss << key;
ss << key;
if (!value.empty())
ss << " " << value;
}
if (!value.empty())
ss << " " << value;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case WFT_NUM_FIELD_TYPES:
default:
assert(false);
@@ -208,12 +207,15 @@ namespace IW4
}
public:
InfoStringFromWeaponConverter(const WeaponFullDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback)
InfoStringFromWeaponConverter(const WeaponFullDef* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback))
{
}
};
}
} // namespace IW4
void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef)
{
@@ -263,28 +265,36 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
if (fullDef->weapDef.notetrackSoundMapKeys)
{
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
memcpy(fullDef->notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
memcpy(fullDef->notetrackSoundMapKeys,
fullDef->weapDef.notetrackSoundMapKeys,
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
}
if (fullDef->weapDef.notetrackSoundMapValues)
{
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
memcpy(fullDef->notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
memcpy(fullDef->notetrackSoundMapValues,
fullDef->weapDef.notetrackSoundMapValues,
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
}
if (fullDef->weapDef.notetrackRumbleMapKeys)
{
assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
memcpy(fullDef->notetrackRumbleMapKeys, fullDef->weapDef.notetrackRumbleMapKeys, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
memcpy(fullDef->notetrackRumbleMapKeys,
fullDef->weapDef.notetrackRumbleMapKeys,
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
}
if (fullDef->weapDef.notetrackRumbleMapValues)
{
assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
memcpy(fullDef->notetrackRumbleMapValues, fullDef->weapDef.notetrackRumbleMapValues, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
memcpy(fullDef->notetrackRumbleMapValues,
fullDef->weapDef.notetrackRumbleMapValues,
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
}
@@ -305,14 +315,18 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
if (fullDef->weapDef.perpendicularBounce)
{
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
memcpy(fullDef->perpendicularBounce,
fullDef->weapDef.perpendicularBounce,
sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
}
if (fullDef->weapDef.locationDamageMultipliers)
{
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
memcpy(fullDef->locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers, sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
memcpy(fullDef->locationDamageMultipliers,
fullDef->weapDef.locationDamageMultipliers,
sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
}
}
@@ -323,14 +337,17 @@ InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* as
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.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
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.Count());
if (scrStr >= asset->m_zone->m_script_strings.Count())
return "";
return asset->m_zone->m_script_strings[scrStr];
});
return asset->m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}

View File

@@ -15,4 +15,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<WeaponCompleteDef>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset) override;
};
}
} // namespace IW4

View File

@@ -1,14 +1,14 @@
#include "AssetDumperXModel.h"
#include <cassert>
#include "ObjWriting.h"
#include "Game/IW4/CommonIW4.h"
#include "Math/Quaternion.h"
#include "Model/XModel/XModelExportWriter.h"
#include "ObjWriting.h"
#include "Utils/HalfFloat.h"
#include "Utils/QuatInt16.h"
#include <cassert>
using namespace IW4;
namespace IW4
@@ -27,7 +27,7 @@ namespace IW4
return true;
}
};
}
} // namespace IW4
bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset)
{
@@ -287,7 +287,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr
bone.globalOffset[0] = model->baseMat[boneNum].trans[0];
bone.globalOffset[1] = model->baseMat[boneNum].trans[1];
bone.globalOffset[2] = model->baseMat[boneNum].trans[2];
bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]);
bone.globalRotation =
Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]);
if (boneNum < model->numRootBones)
{
@@ -301,12 +302,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr
bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0];
bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1];
bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2];
bone.localRotation = Quaternion32(
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])
);
bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]));
}
writer.AddBone(std::move(bone));
@@ -404,7 +403,9 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModelSurfs* modelSurfs,
weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount);
}
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection)
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
const XModelSurfs* modelSurfs,
XModelVertexBoneWeightCollection& weightCollection)
{
size_t weightOffset = 0u;
@@ -420,17 +421,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
const auto& vertList = surface.vertList[vertListIndex];
const auto* boneWeightOffset = &weightCollection.weights[weightOffset];
weightCollection.weights[weightOffset++] = XModelBoneWeight{
static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)),
1.0f
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f};
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
{
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
boneWeightOffset,
1
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1});
}
handledVertices += vertList.vertCount;
}
@@ -444,17 +439,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
{
const auto* boneWeightOffset = &weightCollection.weights[weightOffset];
const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat));
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex0,
1.0f
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f};
vertsBlendOffset += 1;
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
boneWeightOffset,
1
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1});
}
// 2 bone weights
@@ -466,21 +455,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
const auto boneWeight0 = 1.0f - boneWeight1;
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex0,
boneWeight0
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex1,
boneWeight1
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1};
vertsBlendOffset += 3;
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
boneWeightOffset,
2
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2});
}
// 3 bone weights
@@ -494,25 +474,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex0,
boneWeight0
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex1,
boneWeight1
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex2,
boneWeight2
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2};
vertsBlendOffset += 5;
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
boneWeightOffset,
3
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3});
}
// 4 bone weights
@@ -528,29 +496,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex0,
boneWeight0
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex1,
boneWeight1
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex2,
boneWeight2
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{
boneIndex3,
boneWeight3
};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3};
vertsBlendOffset += 7;
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
boneWeightOffset,
4
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4});
}
handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3];
@@ -558,15 +511,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
for (; handledVertices < surface.vertCount; handledVertices++)
{
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
nullptr,
0
});
writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0});
}
}
}
void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs,
void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer,
const DistinctMapper<Material*>& materialMapper,
const XModelSurfs* modelSurfs,
const int baseSurfaceIndex)
{
for (auto surfIndex = 0u; surfIndex < modelSurfs->numsurfs; surfIndex++)

View File

@@ -2,9 +2,9 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Utils/DistinctMapper.h"
#include "Model/XModel/AbstractXModelWriter.h"
#include "Model/Obj/ObjWriter.h"
#include "Model/XModel/AbstractXModelWriter.h"
#include "Utils/DistinctMapper.h"
namespace IW4
{
@@ -28,7 +28,8 @@ namespace IW4
static void AddXModelVertices(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs);
static void AllocateXModelBoneWeights(const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection);
static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection);
static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex);
static void
AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex);
static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod);
static void DumpXModelExport(AssetDumpingContext& context, XAssetInfo<XModel>* asset);
@@ -36,4 +37,4 @@ namespace IW4
bool ShouldDump(XAssetInfo<XModel>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override;
};
}
} // namespace IW4