mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-16 17:57:57 -05:00
Reformat code with clang format
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user