mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
#include "AssetDumperGfxImage.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Image/IwiWriter6.h"
|
||||
#include "Image/DdsWriter.h"
|
||||
#include "Image/IwiWriter6.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
@ -21,4 +21,4 @@ namespace IW3
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -11,41 +11,25 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
|
||||
|
||||
void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream)
|
||||
{
|
||||
const auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF)
|
||||
+ sizeof(uint32_t)
|
||||
+ sizeof(WAV_WAVE_ID)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(WavFormatChunkPcm)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(asset->sound.info.data_len);
|
||||
const auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF) + sizeof(uint32_t) + sizeof(WAV_WAVE_ID) + sizeof(WavChunkHeader) + sizeof(WavFormatChunkPcm)
|
||||
+ sizeof(WavChunkHeader) + sizeof(asset->sound.info.data_len);
|
||||
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_CHUNK_ID_RIFF), sizeof(WAV_CHUNK_ID_RIFF));
|
||||
stream.write(reinterpret_cast<const char*>(&riffMasterChunkSize), sizeof(riffMasterChunkSize));
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_WAVE_ID), sizeof(WAV_WAVE_ID));
|
||||
|
||||
const WavChunkHeader formatChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_FMT,
|
||||
sizeof(WavFormatChunkPcm)
|
||||
};
|
||||
const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader));
|
||||
|
||||
WavFormatChunkPcm formatChunk
|
||||
{
|
||||
WavFormat::PCM,
|
||||
static_cast<uint16_t>(asset->sound.info.channels),
|
||||
asset->sound.info.rate,
|
||||
asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8,
|
||||
static_cast<uint16_t>(asset->sound.info.block_size),
|
||||
static_cast<uint16_t>(asset->sound.info.bits)
|
||||
};
|
||||
WavFormatChunkPcm formatChunk{WavFormat::PCM,
|
||||
static_cast<uint16_t>(asset->sound.info.channels),
|
||||
asset->sound.info.rate,
|
||||
asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8,
|
||||
static_cast<uint16_t>(asset->sound.info.block_size),
|
||||
static_cast<uint16_t>(asset->sound.info.bits)};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk));
|
||||
|
||||
const WavChunkHeader dataChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_DATA,
|
||||
asset->sound.info.data_len
|
||||
};
|
||||
const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len};
|
||||
stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader));
|
||||
stream.write(asset->sound.data, asset->sound.info.data_len);
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -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 IW3;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,4 @@ namespace IW3
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -11,4 +11,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<MapEnts>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "AssetDumperMaterial.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "Game/IW3/MaterialConstantsIW3.h"
|
||||
#include "Game/IW3/TechsetConstantsIW3.h"
|
||||
|
||||
//#define FLAGS_DEBUG 1
|
||||
#include <iomanip>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <sstream>
|
||||
|
||||
// #define FLAGS_DEBUG 1
|
||||
|
||||
using namespace IW3;
|
||||
using json = nlohmann::json;
|
||||
@ -21,8 +21,7 @@ namespace IW3
|
||||
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)
|
||||
@ -73,20 +72,8 @@ namespace IW3
|
||||
|
||||
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)},
|
||||
@ -99,21 +86,8 @@ namespace IW3
|
||||
|
||||
json BuildTextureTableJson(const MaterialTextureDef* textureTable, const size_t count)
|
||||
{
|
||||
static const char* semanticNames[]
|
||||
{
|
||||
"2d",
|
||||
"function",
|
||||
"colorMap",
|
||||
"unused1",
|
||||
"unused2",
|
||||
"normalMap",
|
||||
"unused3",
|
||||
"unused4",
|
||||
"specularMap",
|
||||
"unused5",
|
||||
"unused6",
|
||||
"waterMap"
|
||||
};
|
||||
static const char* semanticNames[]{
|
||||
"2d", "function", "colorMap", "unused1", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"};
|
||||
|
||||
auto jArray = json::array();
|
||||
|
||||
@ -136,9 +110,9 @@ namespace IW3
|
||||
else
|
||||
{
|
||||
jEntry.merge_patch({
|
||||
{"nameHash", entry.nameHash},
|
||||
{"nameHash", entry.nameHash },
|
||||
{"nameStart", entry.nameStart},
|
||||
{"nameEnd", entry.nameEnd},
|
||||
{"nameEnd", entry.nameEnd },
|
||||
});
|
||||
}
|
||||
|
||||
@ -211,8 +185,7 @@ namespace IW3
|
||||
|
||||
json BuildStateBitsTableJson(const GfxStateBits* stateBitsTable, const size_t count)
|
||||
{
|
||||
static const char* blendNames[]
|
||||
{
|
||||
static const char* blendNames[]{
|
||||
"disabled",
|
||||
"zero",
|
||||
"one",
|
||||
@ -225,40 +198,20 @@ namespace IW3
|
||||
"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* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"};
|
||||
|
||||
auto jArray = json::array();
|
||||
|
||||
@ -333,7 +286,8 @@ namespace IW3
|
||||
if (!surfaceTypeBits)
|
||||
return json(surfaceTypeNames[SURF_TYPE_DEFAULT]);
|
||||
|
||||
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;
|
||||
@ -372,7 +326,7 @@ namespace IW3
|
||||
|
||||
return json(values);
|
||||
}
|
||||
}
|
||||
} // namespace IW3
|
||||
|
||||
bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset)
|
||||
{
|
||||
@ -392,84 +346,72 @@ void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Mat
|
||||
|
||||
auto& stream = *assetFile;
|
||||
|
||||
static const char* cameraRegionNames[]
|
||||
{
|
||||
"lit",
|
||||
"decal",
|
||||
"emissive",
|
||||
"none"
|
||||
};
|
||||
static std::unordered_map<size_t, std::string> sortKeyNames
|
||||
{
|
||||
{0, "distortion"},
|
||||
{1, "opaque water"},
|
||||
{2, "boat hull"},
|
||||
{3, "opaque ambient"},
|
||||
{4, "opaque"},
|
||||
{5, "sky"},
|
||||
{6, "skybox - sun / moon"},
|
||||
{7, "skybox - clouds"},
|
||||
{8, "skybox - horizon"},
|
||||
{9, "decal - bottom 1"},
|
||||
{10, "decal - bottom 2"},
|
||||
{11, "decal - bottom 3"},
|
||||
{12, "decal - static decal"},
|
||||
{13, "decal - middle 1"},
|
||||
{14, "decal - middle 2"},
|
||||
{15, "decal - middle 3"},
|
||||
{24, "decal - weapon impact"},
|
||||
{29, "decal - top 1"},
|
||||
{30, "decal - top 2"},
|
||||
{31, "decal - top 3"},
|
||||
{32, "multiplicative"},
|
||||
{33, "banner / curtain"},
|
||||
{34, "hair"},
|
||||
{35, "underwater"},
|
||||
{36, "transparent water"},
|
||||
{37, "corona"},
|
||||
{38, "window inside"},
|
||||
{39, "window outside"},
|
||||
static const char* cameraRegionNames[]{"lit", "decal", "emissive", "none"};
|
||||
static std::unordered_map<size_t, std::string> sortKeyNames{
|
||||
{0, "distortion" },
|
||||
{1, "opaque water" },
|
||||
{2, "boat hull" },
|
||||
{3, "opaque ambient" },
|
||||
{4, "opaque" },
|
||||
{5, "sky" },
|
||||
{6, "skybox - sun / moon" },
|
||||
{7, "skybox - clouds" },
|
||||
{8, "skybox - horizon" },
|
||||
{9, "decal - bottom 1" },
|
||||
{10, "decal - bottom 2" },
|
||||
{11, "decal - bottom 3" },
|
||||
{12, "decal - static decal" },
|
||||
{13, "decal - middle 1" },
|
||||
{14, "decal - middle 2" },
|
||||
{15, "decal - middle 3" },
|
||||
{24, "decal - weapon impact" },
|
||||
{29, "decal - top 1" },
|
||||
{30, "decal - top 2" },
|
||||
{31, "decal - top 3" },
|
||||
{32, "multiplicative" },
|
||||
{33, "banner / curtain" },
|
||||
{34, "hair" },
|
||||
{35, "underwater" },
|
||||
{36, "transparent water" },
|
||||
{37, "corona" },
|
||||
{38, "window inside" },
|
||||
{39, "window outside" },
|
||||
{40, "before effects - bottom"},
|
||||
{41, "before effects - middle"},
|
||||
{42, "before effects - top"},
|
||||
{43, "blend / additive"},
|
||||
{48, "effect - auto sort"},
|
||||
{56, "after effects - bottom"},
|
||||
{57, "after effects - middle"},
|
||||
{58, "after effects - top"},
|
||||
{59, "viewmodel effect"},
|
||||
{42, "before effects - top" },
|
||||
{43, "blend / additive" },
|
||||
{48, "effect - auto sort" },
|
||||
{56, "after effects - bottom" },
|
||||
{57, "after effects - middle" },
|
||||
{58, "after effects - top" },
|
||||
{59, "viewmodel effect" },
|
||||
};
|
||||
|
||||
const auto foundSortKeyName = sortKeyNames.find(material->info.sortKey);
|
||||
assert(foundSortKeyName != sortKeyNames.end());
|
||||
|
||||
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", foundSortKeyName != sortKeyNames.end() ? foundSortKeyName->second : std::to_string(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)},
|
||||
{"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.primaryLightIndex)},
|
||||
{"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)},
|
||||
{"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}
|
||||
}
|
||||
},
|
||||
{"surfaceTypeBits", BuildSurfaceTypeBitsJson(material->info.surfaceTypeBits)},
|
||||
{"hashIndex", material->info.hashIndex}
|
||||
}
|
||||
},
|
||||
{"sortKey", foundSortKeyName != sortKeyNames.end() ? foundSortKeyName->second : std::to_string(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)},
|
||||
{"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.primaryLightIndex)},
|
||||
{"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)},
|
||||
{"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}}},
|
||||
{"surfaceTypeBits", BuildSurfaceTypeBitsJson(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)},
|
||||
|
@ -11,4 +11,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<Material>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -11,4 +11,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -11,4 +11,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "AssetDumperXModel.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW3/CommonIW3.h"
|
||||
#include "Math/Quaternion.h"
|
||||
#include "Model/XModel/XModelExportWriter.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "Utils/HalfFloat.h"
|
||||
#include "Utils/QuatInt16.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset)
|
||||
@ -273,7 +273,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)
|
||||
{
|
||||
@ -287,12 +288,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));
|
||||
@ -398,7 +397,10 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModel* model, const uns
|
||||
weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount);
|
||||
}
|
||||
|
||||
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, const unsigned lod, XModelVertexBoneWeightCollection& weightCollection)
|
||||
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
|
||||
const XModel* model,
|
||||
const unsigned lod,
|
||||
XModelVertexBoneWeightCollection& weightCollection)
|
||||
{
|
||||
const auto* surfs = &model->surfs[model->lodInfo[lod].surfIndex];
|
||||
const auto surfCount = model->lodInfo[lod].numsurfs;
|
||||
@ -417,17 +419,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;
|
||||
}
|
||||
@ -441,17 +437,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
|
||||
@ -463,21 +453,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
|
||||
@ -491,25 +472,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
|
||||
@ -525,29 +494,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];
|
||||
@ -555,10 +509,7 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
|
||||
|
||||
for (; handledVertices < surface.vertCount; handledVertices++)
|
||||
{
|
||||
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
|
||||
nullptr,
|
||||
0
|
||||
});
|
||||
writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW3/IW3.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 IW3
|
||||
{
|
||||
@ -27,7 +27,8 @@ namespace IW3
|
||||
static void AddXModelObjects(AbstractXModelWriter& writer, const XModel* model, unsigned lod);
|
||||
static void AddXModelVertices(AbstractXModelWriter& writer, const XModel* model, unsigned lod);
|
||||
static void AllocateXModelBoneWeights(const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void
|
||||
AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModel* model, unsigned lod);
|
||||
static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod);
|
||||
static void DumpXModelExport(const AssetDumpingContext& context, XAssetInfo<XModel>* asset);
|
||||
@ -36,4 +37,4 @@ namespace IW3
|
||||
bool ShouldDump(XAssetInfo<XModel>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -1,9 +1,5 @@
|
||||
#include "ZoneDumperIW3.h"
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW3/GameIW3.h"
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
|
||||
#include "AssetDumpers/AssetDumperGfxImage.h"
|
||||
#include "AssetDumpers/AssetDumperLoadedSound.h"
|
||||
#include "AssetDumpers/AssetDumperLocalizeEntry.h"
|
||||
@ -13,6 +9,9 @@
|
||||
#include "AssetDumpers/AssetDumperStringTable.h"
|
||||
#include "AssetDumpers/AssetDumperWeapon.h"
|
||||
#include "AssetDumpers/AssetDumperXModel.h"
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
#include "Game/IW3/GameIW3.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
|
||||
|
||||
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
|
||||
{
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
}
|
||||
|
||||
const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone->m_pools.get());
|
||||
|
@ -9,4 +9,4 @@ namespace IW3
|
||||
bool CanHandleZone(AssetDumpingContext& context) const override;
|
||||
bool DumpZone(AssetDumpingContext& context) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -13,4 +13,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<GfxLightDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxLightDef>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,4 @@ namespace IW4
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<Material>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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());
|
||||
|
@ -14,4 +14,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<menuDef_t>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -13,4 +13,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<PhysCollmap>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysCollmap>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<PhysPreset>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<MaterialPixelShader>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "AssetDumperRawFile.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdexcept>
|
||||
#include <zlib.h>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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)
|
||||
|
@ -13,4 +13,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<SndCurve>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -16,7 +16,7 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
|
||||
CsvOutputStream csv(*assetFile);
|
||||
|
||||
for (auto row = 0; row < stringTable->rowCount; row++)
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -14,4 +14,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<MaterialTechniqueSet>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialTechniqueSet>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -14,4 +14,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<TracerDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -14,4 +14,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -11,4 +11,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<MaterialVertexShader>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ namespace IW4
|
||||
bool ShouldDump(XAssetInfo<WeaponCompleteDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -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++)
|
||||
|
@ -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
|
||||
|
@ -75,8 +75,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_MATERIAL:
|
||||
{
|
||||
const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (material)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name)));
|
||||
@ -87,8 +86,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_PHYS_COLLMAP:
|
||||
{
|
||||
const auto* physCollMap = *reinterpret_cast<PhysCollmap**>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* physCollMap = *reinterpret_cast<PhysCollmap**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (physCollMap)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physCollMap->name)));
|
||||
@ -99,8 +97,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_SOUND:
|
||||
{
|
||||
const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (sndAlias->name)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(sndAlias->name->soundName));
|
||||
@ -111,8 +108,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_TRACER:
|
||||
{
|
||||
const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (tracer)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name)));
|
||||
@ -142,18 +138,19 @@ void InfoStringFromStructConverter::FillInfoString()
|
||||
}
|
||||
}
|
||||
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields,
|
||||
const size_t fieldCount)
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount)
|
||||
: InfoStringFromStructConverterBase(structure),
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
{
|
||||
}
|
||||
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure,
|
||||
const cspField_t* fields,
|
||||
const size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
: InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)),
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
{
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "InfoString/InfoStringFromStructConverterBase.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "InfoString/InfoStringFromStructConverterBase.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
@ -16,6 +16,9 @@ namespace IW4
|
||||
|
||||
public:
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount);
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
InfoStringFromStructConverter(const void* structure,
|
||||
const cspField_t* fields,
|
||||
size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "MenuDumperIW4.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW4/MenuConstantsIW4.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
@ -92,9 +92,7 @@ void MenuDumper::WriteStatementOperator(const Statement_s* statement, size_t& cu
|
||||
const auto& staticDvarEntry = statement->entries[currentPos + 1];
|
||||
if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)
|
||||
{
|
||||
if (statement->supportingData
|
||||
&& statement->supportingData->staticDvarList.staticDvars
|
||||
&& staticDvarEntry.data.operand.internals.intVal >= 0
|
||||
if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0
|
||||
&& staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars)
|
||||
{
|
||||
const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal];
|
||||
@ -245,9 +243,7 @@ void MenuDumper::WriteStatementSkipInitialUnnecessaryParenthesis(const Statement
|
||||
|
||||
const auto statementEnd = static_cast<size_t>(statementValue->numEntries);
|
||||
|
||||
if (statementValue->numEntries >= 1
|
||||
&& statementValue->entries[0].type == EET_OPERATOR
|
||||
&& statementValue->entries[0].data.op == OP_LEFTPAREN)
|
||||
if (statementValue->numEntries >= 1 && statementValue->entries[0].type == EET_OPERATOR && statementValue->entries[0].data.op == OP_LEFTPAREN)
|
||||
{
|
||||
const auto parenthesisEnd = FindStatementClosingParenthesis(statementValue, 0);
|
||||
|
||||
@ -296,7 +292,7 @@ void MenuDumper::WriteSetLocalVarData(const std::string& setFunction, const SetL
|
||||
m_stream << ";\n";
|
||||
}
|
||||
|
||||
//#define WRITE_ORIGINAL_SCRIPT
|
||||
// #define WRITE_ORIGINAL_SCRIPT
|
||||
|
||||
void MenuDumper::WriteUnconditionalScript(const char* script) const
|
||||
{
|
||||
@ -360,8 +356,7 @@ void MenuDumper::WriteMenuEventHandlerSet(const MenuEventHandlerSet* eventHandle
|
||||
break;
|
||||
|
||||
case EVENT_IF:
|
||||
if (eventHandler->eventData.conditionalScript == nullptr
|
||||
|| eventHandler->eventData.conditionalScript->eventExpression == nullptr
|
||||
if (eventHandler->eventData.conditionalScript == nullptr || eventHandler->eventData.conditionalScript->eventExpression == nullptr
|
||||
|| eventHandler->eventData.conditionalScript->eventHandlerSet == nullptr)
|
||||
{
|
||||
continue;
|
||||
@ -423,7 +418,8 @@ void MenuDumper::WriteRectProperty(const std::string& propertyKey, const rectDef
|
||||
{
|
||||
Indent();
|
||||
WriteKey(propertyKey);
|
||||
m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) << "\n";
|
||||
m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign)
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
void MenuDumper::WriteMaterialProperty(const std::string& propertyKey, const Material* materialValue) const
|
||||
@ -487,7 +483,7 @@ void MenuDumper::WriteFloatExpressionsProperty(const ItemFloatExpression* floatE
|
||||
continue;
|
||||
|
||||
std::string propertyName = std::string("exp ") + floatExpressionTargetBindings[floatExpression.target].name + std::string(" ")
|
||||
+ floatExpressionTargetBindings[floatExpression.target].componentName;
|
||||
+ floatExpressionTargetBindings[floatExpression.target].componentName;
|
||||
|
||||
WriteStatementProperty(propertyName, floatExpression.expression, false);
|
||||
}
|
||||
@ -533,10 +529,8 @@ void MenuDumper::WriteColumnProperty(const std::string& propertyKey, const listB
|
||||
for (auto i = 0u; i < MENU_KEY_SPACING; i++)
|
||||
m_stream << " ";
|
||||
|
||||
m_stream << listBox->columnInfo[col].pos
|
||||
<< " " << listBox->columnInfo[col].width
|
||||
<< " " << listBox->columnInfo[col].maxChars
|
||||
<< " " << listBox->columnInfo[col].alignment << "\n";
|
||||
m_stream << listBox->columnInfo[col].pos << " " << listBox->columnInfo[col].width << " " << listBox->columnInfo[col].maxChars << " "
|
||||
<< listBox->columnInfo[col].alignment << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,7 +713,7 @@ void MenuDumper::WriteItemData(const itemDef_s* item)
|
||||
// WriteFloatProperty("special", item->special, 0.0f);
|
||||
WriteSoundAliasProperty("focusSound", item->focusSound);
|
||||
WriteStringProperty("dvarTest", item->dvarTest);
|
||||
|
||||
|
||||
if (item->dvarFlags & ITEM_DVAR_FLAG_ENABLE)
|
||||
WriteMultiTokenStringProperty("enableDvar", item->enableDvar);
|
||||
else if (item->dvarFlags & ITEM_DVAR_FLAG_DISABLE)
|
||||
@ -796,7 +790,7 @@ void MenuDumper::WriteMenuData(const menuDef_t* menu)
|
||||
WriteStatementProperty("visible", menu->visibleExp, true);
|
||||
else if (menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE)
|
||||
WriteIntProperty("visible", 1, 0);
|
||||
|
||||
|
||||
WriteStatementProperty("exp rect X", menu->rectXExp, false);
|
||||
WriteStatementProperty("exp rect Y", menu->rectYExp, false);
|
||||
WriteStatementProperty("exp rect W", menu->rectWExp, false);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
@ -52,4 +52,4 @@ namespace IW4
|
||||
void WriteFunctionDef(const std::string& functionName, const Statement_s* statement);
|
||||
void WriteMenu(const menuDef_t* menu);
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -1,9 +1,5 @@
|
||||
#include "ZoneDumperIW4.h"
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW4/GameIW4.h"
|
||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||
|
||||
#include "AssetDumpers/AssetDumperAddonMapEnts.h"
|
||||
#include "AssetDumpers/AssetDumperGfxImage.h"
|
||||
#include "AssetDumpers/AssetDumperGfxLightDef.h"
|
||||
@ -25,6 +21,9 @@
|
||||
#include "AssetDumpers/AssetDumperVertexShader.h"
|
||||
#include "AssetDumpers/AssetDumperWeapon.h"
|
||||
#include "AssetDumpers/AssetDumperXModel.h"
|
||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||
#include "Game/IW4/GameIW4.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
@ -35,11 +34,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
|
||||
|
||||
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
|
||||
{
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
}
|
||||
|
||||
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone->m_pools.get());
|
||||
|
@ -9,4 +9,4 @@ namespace IW4
|
||||
bool CanHandleZone(AssetDumpingContext& context) const override;
|
||||
bool DumpZone(AssetDumpingContext& context) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW4
|
||||
|
@ -11,4 +11,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -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 IW5;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
@ -21,4 +21,4 @@ namespace IW5
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -11,41 +11,25 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
|
||||
|
||||
void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream)
|
||||
{
|
||||
const auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF)
|
||||
+ sizeof(uint32_t)
|
||||
+ sizeof(WAV_WAVE_ID)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(WavFormatChunkPcm)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(asset->sound.info.data_len);
|
||||
const auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF) + sizeof(uint32_t) + sizeof(WAV_WAVE_ID) + sizeof(WavChunkHeader) + sizeof(WavFormatChunkPcm)
|
||||
+ sizeof(WavChunkHeader) + sizeof(asset->sound.info.data_len);
|
||||
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_CHUNK_ID_RIFF), sizeof(WAV_CHUNK_ID_RIFF));
|
||||
stream.write(reinterpret_cast<const char*>(&riffMasterChunkSize), sizeof(riffMasterChunkSize));
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_WAVE_ID), sizeof(WAV_WAVE_ID));
|
||||
|
||||
const WavChunkHeader formatChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_FMT,
|
||||
sizeof(WavFormatChunkPcm)
|
||||
};
|
||||
const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader));
|
||||
|
||||
WavFormatChunkPcm formatChunk
|
||||
{
|
||||
WavFormat::PCM,
|
||||
static_cast<uint16_t>(asset->sound.info.channels),
|
||||
asset->sound.info.rate,
|
||||
asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8,
|
||||
static_cast<uint16_t>(asset->sound.info.block_size),
|
||||
static_cast<uint16_t>(asset->sound.info.bits)
|
||||
};
|
||||
WavFormatChunkPcm formatChunk{WavFormat::PCM,
|
||||
static_cast<uint16_t>(asset->sound.info.channels),
|
||||
asset->sound.info.rate,
|
||||
asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8,
|
||||
static_cast<uint16_t>(asset->sound.info.block_size),
|
||||
static_cast<uint16_t>(asset->sound.info.bits)};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk));
|
||||
|
||||
const WavChunkHeader dataChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_DATA,
|
||||
asset->sound.info.data_len
|
||||
};
|
||||
const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len};
|
||||
stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader));
|
||||
stream.write(asset->sound.data, asset->sound.info.data_len);
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -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 IW5;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,4 @@ namespace IW5
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "AssetDumperMenuDef.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW5/GameAssetPoolIW5.h"
|
||||
#include "Game/IW5/Menu/MenuDumperIW5.h"
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@ -55,7 +55,7 @@ void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo<menu
|
||||
const auto* menu = asset->Asset();
|
||||
const auto menuFilePath = GetPathForMenu(asset);
|
||||
|
||||
if(ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST))
|
||||
if (ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST))
|
||||
{
|
||||
// Don't dump menu file separately if the name matches the menu list
|
||||
const auto* menuListParent = GetParentMenuList(asset);
|
||||
|
@ -14,4 +14,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<menuDef_t>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "AssetDumperMenuList.h"
|
||||
|
||||
#include "Game/IW5/Menu/MenuDumperIW5.h"
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <filesystem>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW5/Menu/MenuDumperIW5.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->data == nullptr || menu->data->expressionData == nullptr)
|
||||
if (menu->data == nullptr || menu->data->expressionData == nullptr)
|
||||
continue;
|
||||
|
||||
if(alreadyAddedSupportingData.find(menu->data->expressionData) == alreadyAddedSupportingData.end())
|
||||
if (alreadyAddedSupportingData.find(menu->data->expressionData) == alreadyAddedSupportingData.end())
|
||||
{
|
||||
result.push_back(menu->data->expressionData);
|
||||
alreadyAddedSupportingData.emplace(menu->data->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)
|
||||
continue;
|
||||
|
||||
std::stringstream ss;
|
||||
@ -114,7 +114,7 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfo<Men
|
||||
|
||||
menuDumper.Start();
|
||||
|
||||
if(!ObjWriting::Configuration.MenuLegacyMode)
|
||||
if (!ObjWriting::Configuration.MenuLegacyMode)
|
||||
DumpFunctions(menuDumper, menuList);
|
||||
|
||||
DumpMenus(menuDumper, menuList);
|
||||
|
@ -17,4 +17,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<MenuList>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MenuList>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "AssetDumperRawFile.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdexcept>
|
||||
#include <zlib.h>
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
|
@ -13,4 +13,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -11,4 +11,4 @@ namespace IW5
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "AssetDumperXModel.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW5/CommonIW5.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 IW5;
|
||||
|
||||
namespace IW5
|
||||
@ -27,7 +27,7 @@ namespace IW5
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
||||
bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset)
|
||||
{
|
||||
@ -286,7 +286,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)
|
||||
{
|
||||
@ -300,12 +301,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));
|
||||
@ -403,7 +402,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;
|
||||
|
||||
@ -419,17 +420,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;
|
||||
}
|
||||
@ -443,17 +438,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
|
||||
@ -465,21 +454,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
|
||||
@ -493,25 +473,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
|
||||
@ -527,29 +495,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];
|
||||
@ -557,15 +510,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++)
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW5/IW5.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 IW5
|
||||
{
|
||||
@ -28,7 +28,8 @@ namespace IW5
|
||||
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 IW5
|
||||
bool ShouldDump(XAssetInfo<XModel>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -75,8 +75,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_MATERIAL:
|
||||
{
|
||||
const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (material)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name)));
|
||||
@ -87,8 +86,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_SOUND:
|
||||
{
|
||||
const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (sndAlias->name)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(sndAlias->name->soundName));
|
||||
@ -99,8 +97,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
|
||||
|
||||
case CSPFT_TRACER:
|
||||
{
|
||||
const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.
|
||||
iOffset);
|
||||
const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
|
||||
if (tracer)
|
||||
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name)));
|
||||
@ -130,18 +127,19 @@ void InfoStringFromStructConverter::FillInfoString()
|
||||
}
|
||||
}
|
||||
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields,
|
||||
const size_t fieldCount)
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount)
|
||||
: InfoStringFromStructConverterBase(structure),
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
{
|
||||
}
|
||||
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure,
|
||||
const cspField_t* fields,
|
||||
const size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
: InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)),
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
{
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "InfoString/InfoStringFromStructConverterBase.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "InfoString/InfoStringFromStructConverterBase.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
@ -16,6 +16,9 @@ namespace IW5
|
||||
|
||||
public:
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount);
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
InfoStringFromStructConverter(const void* structure,
|
||||
const cspField_t* fields,
|
||||
size_t fieldCount,
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "MenuDumperIW5.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW5/MenuConstantsIW5.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
@ -92,9 +92,7 @@ void MenuDumper::WriteStatementOperator(const Statement_s* statement, size_t& cu
|
||||
const auto& staticDvarEntry = statement->entries[currentPos + 1];
|
||||
if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)
|
||||
{
|
||||
if (statement->supportingData
|
||||
&& statement->supportingData->staticDvarList.staticDvars
|
||||
&& staticDvarEntry.data.operand.internals.intVal >= 0
|
||||
if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0
|
||||
&& staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars)
|
||||
{
|
||||
const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal];
|
||||
@ -244,9 +242,7 @@ void MenuDumper::WriteStatementSkipInitialUnnecessaryParenthesis(const Statement
|
||||
|
||||
const auto statementEnd = static_cast<size_t>(statementValue->numEntries);
|
||||
|
||||
if (statementValue->numEntries >= 1
|
||||
&& statementValue->entries[0].type == EET_OPERATOR
|
||||
&& statementValue->entries[0].data.op == OP_LEFTPAREN)
|
||||
if (statementValue->numEntries >= 1 && statementValue->entries[0].type == EET_OPERATOR && statementValue->entries[0].data.op == OP_LEFTPAREN)
|
||||
{
|
||||
const auto parenthesisEnd = FindStatementClosingParenthesis(statementValue, 0);
|
||||
|
||||
@ -295,7 +291,7 @@ void MenuDumper::WriteSetLocalVarData(const std::string& setFunction, const SetL
|
||||
m_stream << ";\n";
|
||||
}
|
||||
|
||||
//#define WRITE_ORIGINAL_SCRIPT
|
||||
// #define WRITE_ORIGINAL_SCRIPT
|
||||
|
||||
void MenuDumper::WriteUnconditionalScript(const char* script) const
|
||||
{
|
||||
@ -359,8 +355,7 @@ void MenuDumper::WriteMenuEventHandlerSet(const MenuEventHandlerSet* eventHandle
|
||||
break;
|
||||
|
||||
case EVENT_IF:
|
||||
if (eventHandler->eventData.conditionalScript == nullptr
|
||||
|| eventHandler->eventData.conditionalScript->eventExpression == nullptr
|
||||
if (eventHandler->eventData.conditionalScript == nullptr || eventHandler->eventData.conditionalScript->eventExpression == nullptr
|
||||
|| eventHandler->eventData.conditionalScript->eventHandlerSet == nullptr)
|
||||
{
|
||||
continue;
|
||||
@ -422,7 +417,8 @@ void MenuDumper::WriteRectProperty(const std::string& propertyKey, const rectDef
|
||||
{
|
||||
Indent();
|
||||
WriteKey(propertyKey);
|
||||
m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) << "\n";
|
||||
m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign)
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
void MenuDumper::WriteMaterialProperty(const std::string& propertyKey, const Material* materialValue) const
|
||||
@ -486,7 +482,7 @@ void MenuDumper::WriteFloatExpressionsProperty(const ItemFloatExpression* floatE
|
||||
continue;
|
||||
|
||||
std::string propertyName = std::string("exp ") + floatExpressionTargetBindings[floatExpression.target].name + std::string(" ")
|
||||
+ floatExpressionTargetBindings[floatExpression.target].componentName;
|
||||
+ floatExpressionTargetBindings[floatExpression.target].componentName;
|
||||
|
||||
WriteStatementProperty(propertyName, floatExpression.expression, false);
|
||||
}
|
||||
@ -532,12 +528,8 @@ void MenuDumper::WriteColumnProperty(const std::string& propertyKey, const listB
|
||||
for (auto i = 0u; i < MENU_KEY_SPACING; i++)
|
||||
m_stream << " ";
|
||||
|
||||
m_stream << listBox->columnInfo[col].xpos
|
||||
<< " " << listBox->columnInfo[col].ypos
|
||||
<< " " << listBox->columnInfo[col].width
|
||||
<< " " << listBox->columnInfo[col].height
|
||||
<< " " << listBox->columnInfo[col].maxChars
|
||||
<< " " << listBox->columnInfo[col].alignment << "\n";
|
||||
m_stream << listBox->columnInfo[col].xpos << " " << listBox->columnInfo[col].ypos << " " << listBox->columnInfo[col].width << " "
|
||||
<< listBox->columnInfo[col].height << " " << listBox->columnInfo[col].maxChars << " " << listBox->columnInfo[col].alignment << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Menu/AbstractMenuDumper.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
@ -52,4 +52,4 @@ namespace IW5
|
||||
void WriteFunctionDef(const std::string& functionName, const Statement_s* statement);
|
||||
void WriteMenu(const menuDef_t* menu);
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,9 +1,5 @@
|
||||
#include "ZoneDumperIW5.h"
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/IW5/GameIW5.h"
|
||||
#include "Game/IW5/GameAssetPoolIW5.h"
|
||||
|
||||
#include "AssetDumpers/AssetDumperAddonMapEnts.h"
|
||||
#include "AssetDumpers/AssetDumperGfxImage.h"
|
||||
#include "AssetDumpers/AssetDumperLoadedSound.h"
|
||||
@ -13,6 +9,9 @@
|
||||
#include "AssetDumpers/AssetDumperRawFile.h"
|
||||
#include "AssetDumpers/AssetDumperStringTable.h"
|
||||
#include "AssetDumpers/AssetDumperXModel.h"
|
||||
#include "Game/IW5/GameAssetPoolIW5.h"
|
||||
#include "Game/IW5/GameIW5.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
|
||||
|
||||
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
|
||||
{
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
}
|
||||
|
||||
const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone->m_pools.get());
|
||||
|
@ -9,4 +9,4 @@ namespace IW5
|
||||
bool CanHandleZone(AssetDumpingContext& context) const override;
|
||||
bool DumpZone(AssetDumpingContext& context) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW5
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "AssetDumperGfxImage.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Image/IwiWriter27.h"
|
||||
#include "Image/DdsWriter.h"
|
||||
#include "Image/IwiWriter27.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace T5;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace T5
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
@ -21,4 +21,4 @@ namespace T5
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -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 T5;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,4 @@ namespace T5
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -23,13 +23,13 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
||||
|
||||
assert(inLen == static_cast<unsigned>(rawFile->len) - 8);
|
||||
|
||||
if(inLen > static_cast<unsigned>(rawFile->len - 8) + 1)
|
||||
if (inLen > static_cast<unsigned>(rawFile->len - 8) + 1)
|
||||
{
|
||||
std::cout << "Invalid compression of gsc file \"" << rawFile->name << "\": " << inLen << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(outLen > GSC_MAX_SIZE)
|
||||
if (outLen > GSC_MAX_SIZE)
|
||||
{
|
||||
std::cout << "Invalid size of gsc file \"" << rawFile->name << "\": " << outLen << std::endl;
|
||||
return;
|
||||
@ -71,7 +71,7 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
||||
|
||||
const auto inflateOutSize = sizeof buffer - zs.avail_out;
|
||||
|
||||
if(writtenSize + inflateOutSize >= outLen)
|
||||
if (writtenSize + inflateOutSize >= outLen)
|
||||
{
|
||||
// Last byte is a \0 byte. Skip it.
|
||||
stream.write(reinterpret_cast<char*>(buffer), inflateOutSize - 1);
|
||||
@ -111,4 +111,4 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
||||
{
|
||||
stream.write(rawFile->buffer, rawFile->len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ namespace T5
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -29,4 +29,4 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<
|
||||
|
||||
csv.NextRow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,4 +11,4 @@ namespace T5
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "AssetDumperXModel.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/T5/CommonT5.h"
|
||||
#include "Math/Quaternion.h"
|
||||
#include "Model/XModel/XModelExportWriter.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "Utils/HalfFloat.h"
|
||||
#include "Utils/QuatInt16.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
using namespace T5;
|
||||
|
||||
bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset)
|
||||
@ -21,7 +21,7 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material)
|
||||
{
|
||||
std::vector<MaterialTextureDef*> potentialTextureDefs;
|
||||
|
||||
for(auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++)
|
||||
for (auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++)
|
||||
{
|
||||
MaterialTextureDef* def = &material->textureTable[textureIndex];
|
||||
|
||||
@ -34,7 +34,7 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material)
|
||||
if (potentialTextureDefs.size() == 1)
|
||||
return potentialTextureDefs[0]->u.image;
|
||||
|
||||
for(const auto* def : potentialTextureDefs)
|
||||
for (const auto* def : potentialTextureDefs)
|
||||
{
|
||||
if (def->nameStart == 'c' && def->nameEnd == 'p')
|
||||
return def->u.image;
|
||||
@ -273,7 +273,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)
|
||||
{
|
||||
@ -287,12 +288,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));
|
||||
@ -398,7 +397,10 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModel* model, const uns
|
||||
weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount);
|
||||
}
|
||||
|
||||
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, const unsigned lod, XModelVertexBoneWeightCollection& weightCollection)
|
||||
void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
|
||||
const XModel* model,
|
||||
const unsigned lod,
|
||||
XModelVertexBoneWeightCollection& weightCollection)
|
||||
{
|
||||
const auto* surfs = &model->surfs[model->lodInfo[lod].surfIndex];
|
||||
const auto surfCount = model->lodInfo[lod].numsurfs;
|
||||
@ -417,17 +419,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;
|
||||
}
|
||||
@ -441,17 +437,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
|
||||
@ -463,21 +453,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
|
||||
@ -491,25 +472,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
|
||||
@ -525,29 +494,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];
|
||||
@ -555,10 +509,7 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer,
|
||||
|
||||
for (; handledVertices < surface.vertCount; handledVertices++)
|
||||
{
|
||||
writer.AddVertexBoneWeights(XModelVertexBoneWeights{
|
||||
nullptr,
|
||||
0
|
||||
});
|
||||
writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.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 T5
|
||||
{
|
||||
@ -27,7 +27,8 @@ namespace T5
|
||||
static void AddXModelObjects(AbstractXModelWriter& writer, const XModel* model, unsigned lod);
|
||||
static void AddXModelVertices(AbstractXModelWriter& writer, const XModel* model, unsigned lod);
|
||||
static void AllocateXModelBoneWeights(const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void
|
||||
AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection);
|
||||
static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModel* model, unsigned lod);
|
||||
static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod);
|
||||
static void DumpXModelExport(const AssetDumpingContext& context, XAssetInfo<XModel>* asset);
|
||||
@ -36,4 +37,4 @@ namespace T5
|
||||
bool ShouldDump(XAssetInfo<XModel>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -1,18 +1,17 @@
|
||||
#include "ZoneDumperT5.h"
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Game/T5/GameT5.h"
|
||||
#include "Game/T5/GameAssetPoolT5.h"
|
||||
|
||||
#include "AssetDumpers/AssetDumperRawFile.h"
|
||||
#include "AssetDumpers/AssetDumperStringTable.h"
|
||||
#include "AssetDumpers/AssetDumperLocalizeEntry.h"
|
||||
#include "AssetDumpers/AssetDumperGfxImage.h"
|
||||
#include "AssetDumpers/AssetDumperLocalizeEntry.h"
|
||||
#include "AssetDumpers/AssetDumperPhysConstraints.h"
|
||||
#include "AssetDumpers/AssetDumperPhysPreset.h"
|
||||
#include "AssetDumpers/AssetDumperRawFile.h"
|
||||
#include "AssetDumpers/AssetDumperSndBank.h"
|
||||
#include "AssetDumpers/AssetDumperStringTable.h"
|
||||
#include "AssetDumpers/AssetDumperWeapon.h"
|
||||
#include "AssetDumpers/AssetDumperXModel.h"
|
||||
#include "Game/T5/GameAssetPoolT5.h"
|
||||
#include "Game/T5/GameT5.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
using namespace T5;
|
||||
|
||||
@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
|
||||
|
||||
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
|
||||
{
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
|
||||
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(context, assetPools->poolName.get()); \
|
||||
}
|
||||
|
||||
const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone->m_pools.get());
|
||||
|
@ -9,4 +9,4 @@ namespace T5
|
||||
bool CanHandleZone(AssetDumpingContext& context) const override;
|
||||
bool DumpZone(AssetDumpingContext& context) const override;
|
||||
};
|
||||
}
|
||||
} // namespace T5
|
||||
|
@ -23,123 +23,105 @@ class AssetDumperFontIconInternal
|
||||
};
|
||||
|
||||
inline static const std::string TYPE_ICON = "icon";
|
||||
inline static const std::string ICON_HEADERS[]
|
||||
{
|
||||
"# index",
|
||||
"# type",
|
||||
"# name",
|
||||
"# material",
|
||||
"# size",
|
||||
"# xScale",
|
||||
"# yScale"
|
||||
};
|
||||
inline static const std::string ICON_HEADERS[]{"# index", "# type", "# name", "# material", "# size", "# xScale", "# yScale"};
|
||||
|
||||
inline static const std::string TYPE_ALIAS = "alias";
|
||||
inline static const std::string ALIAS_HEADERS[]
|
||||
{
|
||||
"# index",
|
||||
"# type",
|
||||
"# alias",
|
||||
"# button"
|
||||
};
|
||||
inline static const std::string ALIAS_HEADERS[]{"# index", "# type", "# alias", "# button"};
|
||||
|
||||
inline static const KnownAlias KNOWN_ALIASES[]
|
||||
{
|
||||
KnownAlias("BUTTON_ADS"),
|
||||
KnownAlias("BUTTON_CAC_NEXT"),
|
||||
KnownAlias("BUTTON_CAC_PREV"),
|
||||
KnownAlias("BUTTON_CANCEL"),
|
||||
KnownAlias("BUTTON_CAROUSEL_STICK"),
|
||||
KnownAlias("BUTTON_CREATE"),
|
||||
KnownAlias("BUTTON_CYCLE_LEFT"),
|
||||
KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"),
|
||||
KnownAlias("BUTTON_CYCLE_RIGHT"),
|
||||
KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"),
|
||||
KnownAlias("BUTTON_DELETE"),
|
||||
KnownAlias("BUTTON_EDIT"),
|
||||
KnownAlias("BUTTON_EMBLEM_BACKWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_FLIP"),
|
||||
KnownAlias("BUTTON_EMBLEM_FORWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_MOVE"),
|
||||
KnownAlias("BUTTON_EMBLEM_OUTLINE"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"),
|
||||
KnownAlias("BUTTON_EMBLEM_RESET"),
|
||||
KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"),
|
||||
KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"),
|
||||
KnownAlias("BUTTON_EMBLEM_SCALE"),
|
||||
KnownAlias("BUTTON_FIRE"),
|
||||
KnownAlias("BUTTON_FRIENDSLIST"),
|
||||
KnownAlias("BUTTON_INTERACT"),
|
||||
KnownAlias("BUTTON_LOOKSTICK"),
|
||||
KnownAlias("BUTTON_LOOK"),
|
||||
KnownAlias("BUTTON_LUI_ALT1"),
|
||||
KnownAlias("BUTTON_LUI_ALT2"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_ALL"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_D"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_L"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_RL"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_R"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_UD"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_U"),
|
||||
KnownAlias("BUTTON_LUI_LEFT_STICK_UP"),
|
||||
KnownAlias("BUTTON_LUI_LEFT_TRIGGER"),
|
||||
KnownAlias("BUTTON_LUI_PRIMARY"),
|
||||
KnownAlias("BUTTON_LUI_RIGHT_STICK"),
|
||||
KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"),
|
||||
KnownAlias("BUTTON_LUI_SECONDARY"),
|
||||
KnownAlias("BUTTON_LUI_SELECT"),
|
||||
KnownAlias("BUTTON_LUI_SHOULDERL"),
|
||||
KnownAlias("BUTTON_LUI_SHOULDERR"),
|
||||
KnownAlias("BUTTON_LUI_START"),
|
||||
KnownAlias("BUTTON_MOUSE_CLICK"),
|
||||
KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"),
|
||||
KnownAlias("BUTTON_MOUSE_EDIT"),
|
||||
KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"),
|
||||
KnownAlias("BUTTON_MOUSE_LEFT"),
|
||||
KnownAlias("BUTTON_MOUSE_MIDDLE"),
|
||||
KnownAlias("BUTTON_MOUSE_RIGHT"),
|
||||
KnownAlias("BUTTON_MOVESTICK"),
|
||||
KnownAlias("BUTTON_MOVE"),
|
||||
KnownAlias("BUTTON_MP_CANCELCOMMAND"),
|
||||
KnownAlias("BUTTON_MP_CHANGESETTINGS"),
|
||||
KnownAlias("BUTTON_MP_GAMERCARD"),
|
||||
KnownAlias("BUTTON_MP_GAMERREVIEW"),
|
||||
KnownAlias("BUTTON_MP_JOINGAME"),
|
||||
KnownAlias("BUTTON_MP_KICKPLAYER"),
|
||||
KnownAlias("BUTTON_MP_LEAVEGAME"),
|
||||
KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"),
|
||||
KnownAlias("BUTTON_MP_NOTREADY"),
|
||||
KnownAlias("BUTTON_MP_PGDOWN"),
|
||||
KnownAlias("BUTTON_MP_PGUP"),
|
||||
KnownAlias("BUTTON_MP_READY"),
|
||||
KnownAlias("BUTTON_MP_REFRESH"),
|
||||
KnownAlias("BUTTON_MP_SCOREBOARD"),
|
||||
KnownAlias("BUTTON_MP_SIGNIN"),
|
||||
KnownAlias("BUTTON_MP_SPECNEXT"),
|
||||
KnownAlias("BUTTON_MP_SPECPREV"),
|
||||
KnownAlias("BUTTON_MP_STARTGAME"),
|
||||
KnownAlias("BUTTON_MP_TOGGLECHASECAM"),
|
||||
KnownAlias("BUTTON_MP_TOGGLEVIEW"),
|
||||
KnownAlias("BUTTON_NO"),
|
||||
KnownAlias("BUTTON_RECORD_VIEW_NEXT"),
|
||||
KnownAlias("BUTTON_RECORD_VIEW_PREV"),
|
||||
KnownAlias("BUTTON_SELECTCHOICE"),
|
||||
KnownAlias("BUTTON_SP_TOGGLEMENU"),
|
||||
KnownAlias("BUTTON_YES"),
|
||||
KnownAlias("CP"),
|
||||
KnownAlias("FONT_CAPITAL_I"),
|
||||
KnownAlias("FONT_NUMBER_ZERO"),
|
||||
KnownAlias("KEY_DOWN_ARROW"),
|
||||
KnownAlias("KEY_LEFT_ARROW"),
|
||||
KnownAlias("KEY_RIGHT_ARROW"),
|
||||
KnownAlias("KEY_UP_ARROW"),
|
||||
KnownAlias("MOUSE_WHEEL_DOWN"),
|
||||
KnownAlias("MOUSE_WHEEL_UP"),
|
||||
KnownAlias("Remote_LStick")
|
||||
};
|
||||
inline static const KnownAlias KNOWN_ALIASES[]{KnownAlias("BUTTON_ADS"),
|
||||
KnownAlias("BUTTON_CAC_NEXT"),
|
||||
KnownAlias("BUTTON_CAC_PREV"),
|
||||
KnownAlias("BUTTON_CANCEL"),
|
||||
KnownAlias("BUTTON_CAROUSEL_STICK"),
|
||||
KnownAlias("BUTTON_CREATE"),
|
||||
KnownAlias("BUTTON_CYCLE_LEFT"),
|
||||
KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"),
|
||||
KnownAlias("BUTTON_CYCLE_RIGHT"),
|
||||
KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"),
|
||||
KnownAlias("BUTTON_DELETE"),
|
||||
KnownAlias("BUTTON_EDIT"),
|
||||
KnownAlias("BUTTON_EMBLEM_BACKWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_FLIP"),
|
||||
KnownAlias("BUTTON_EMBLEM_FORWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"),
|
||||
KnownAlias("BUTTON_EMBLEM_MOVE"),
|
||||
KnownAlias("BUTTON_EMBLEM_OUTLINE"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"),
|
||||
KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"),
|
||||
KnownAlias("BUTTON_EMBLEM_RESET"),
|
||||
KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"),
|
||||
KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"),
|
||||
KnownAlias("BUTTON_EMBLEM_SCALE"),
|
||||
KnownAlias("BUTTON_FIRE"),
|
||||
KnownAlias("BUTTON_FRIENDSLIST"),
|
||||
KnownAlias("BUTTON_INTERACT"),
|
||||
KnownAlias("BUTTON_LOOKSTICK"),
|
||||
KnownAlias("BUTTON_LOOK"),
|
||||
KnownAlias("BUTTON_LUI_ALT1"),
|
||||
KnownAlias("BUTTON_LUI_ALT2"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_ALL"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_D"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_L"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_RL"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_R"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_UD"),
|
||||
KnownAlias("BUTTON_LUI_DPAD_U"),
|
||||
KnownAlias("BUTTON_LUI_LEFT_STICK_UP"),
|
||||
KnownAlias("BUTTON_LUI_LEFT_TRIGGER"),
|
||||
KnownAlias("BUTTON_LUI_PRIMARY"),
|
||||
KnownAlias("BUTTON_LUI_RIGHT_STICK"),
|
||||
KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"),
|
||||
KnownAlias("BUTTON_LUI_SECONDARY"),
|
||||
KnownAlias("BUTTON_LUI_SELECT"),
|
||||
KnownAlias("BUTTON_LUI_SHOULDERL"),
|
||||
KnownAlias("BUTTON_LUI_SHOULDERR"),
|
||||
KnownAlias("BUTTON_LUI_START"),
|
||||
KnownAlias("BUTTON_MOUSE_CLICK"),
|
||||
KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"),
|
||||
KnownAlias("BUTTON_MOUSE_EDIT"),
|
||||
KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"),
|
||||
KnownAlias("BUTTON_MOUSE_LEFT"),
|
||||
KnownAlias("BUTTON_MOUSE_MIDDLE"),
|
||||
KnownAlias("BUTTON_MOUSE_RIGHT"),
|
||||
KnownAlias("BUTTON_MOVESTICK"),
|
||||
KnownAlias("BUTTON_MOVE"),
|
||||
KnownAlias("BUTTON_MP_CANCELCOMMAND"),
|
||||
KnownAlias("BUTTON_MP_CHANGESETTINGS"),
|
||||
KnownAlias("BUTTON_MP_GAMERCARD"),
|
||||
KnownAlias("BUTTON_MP_GAMERREVIEW"),
|
||||
KnownAlias("BUTTON_MP_JOINGAME"),
|
||||
KnownAlias("BUTTON_MP_KICKPLAYER"),
|
||||
KnownAlias("BUTTON_MP_LEAVEGAME"),
|
||||
KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"),
|
||||
KnownAlias("BUTTON_MP_NOTREADY"),
|
||||
KnownAlias("BUTTON_MP_PGDOWN"),
|
||||
KnownAlias("BUTTON_MP_PGUP"),
|
||||
KnownAlias("BUTTON_MP_READY"),
|
||||
KnownAlias("BUTTON_MP_REFRESH"),
|
||||
KnownAlias("BUTTON_MP_SCOREBOARD"),
|
||||
KnownAlias("BUTTON_MP_SIGNIN"),
|
||||
KnownAlias("BUTTON_MP_SPECNEXT"),
|
||||
KnownAlias("BUTTON_MP_SPECPREV"),
|
||||
KnownAlias("BUTTON_MP_STARTGAME"),
|
||||
KnownAlias("BUTTON_MP_TOGGLECHASECAM"),
|
||||
KnownAlias("BUTTON_MP_TOGGLEVIEW"),
|
||||
KnownAlias("BUTTON_NO"),
|
||||
KnownAlias("BUTTON_RECORD_VIEW_NEXT"),
|
||||
KnownAlias("BUTTON_RECORD_VIEW_PREV"),
|
||||
KnownAlias("BUTTON_SELECTCHOICE"),
|
||||
KnownAlias("BUTTON_SP_TOGGLEMENU"),
|
||||
KnownAlias("BUTTON_YES"),
|
||||
KnownAlias("CP"),
|
||||
KnownAlias("FONT_CAPITAL_I"),
|
||||
KnownAlias("FONT_NUMBER_ZERO"),
|
||||
KnownAlias("KEY_DOWN_ARROW"),
|
||||
KnownAlias("KEY_LEFT_ARROW"),
|
||||
KnownAlias("KEY_RIGHT_ARROW"),
|
||||
KnownAlias("KEY_UP_ARROW"),
|
||||
KnownAlias("MOUSE_WHEEL_DOWN"),
|
||||
KnownAlias("MOUSE_WHEEL_UP"),
|
||||
KnownAlias("Remote_LStick")};
|
||||
|
||||
CsvOutputStream m_csv;
|
||||
|
||||
|
@ -11,4 +11,4 @@ namespace T6
|
||||
bool ShouldDump(XAssetInfo<FontIcon>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset) override;
|
||||
};
|
||||
}
|
||||
} // namespace T6
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "AssetDumperGfxImage.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "ObjWriting.h"
|
||||
#include "Image/IwiWriter27.h"
|
||||
#include "Image/DdsWriter.h"
|
||||
#include "Image/IwiWriter27.h"
|
||||
#include "ObjWriting.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace T6;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
@ -21,4 +21,4 @@ namespace T6
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
};
|
||||
}
|
||||
} // namespace T6
|
||||
|
@ -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 T6;
|
||||
|
||||
@ -29,7 +29,7 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
|
||||
|
||||
stringFileDumper.SetNotes("");
|
||||
|
||||
for(auto* localizeEntry : *pool)
|
||||
for (auto* localizeEntry : *pool)
|
||||
{
|
||||
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
|
||||
}
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user