feat: dump and load xmodels for IW5 via template

This commit is contained in:
Jan
2024-09-14 16:28:46 +02:00
parent 0eb321f8c8
commit d05c1730fa
14 changed files with 362 additions and 622 deletions

View File

@ -0,0 +1,32 @@
#pragma once
#include "Json/JsonCommon.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>
namespace IW5
{
class JsonXModelLod
{
public:
std::string file;
float distance;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModelLod, file, distance);
class JsonXModel
{
public:
std::vector<JsonXModelLod> lods;
std::optional<int> collLod;
std::optional<std::string> physPreset;
std::optional<std::string> physCollmap;
uint8_t flags;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModel, lods, collLod, physPreset, physCollmap, flags);
} // namespace IW5

View File

@ -0,0 +1,32 @@
#pragma once
#include "Game/IW5/IW5.h"
namespace IW5
{
inline const char* HITLOC_NAMES[]{
// clang-format off
"none",
"helmet",
"head",
"neck",
"torso_upper",
"torso_lower",
"right_arm_upper",
"left_arm_upper",
"right_arm_lower",
"left_arm_lower",
"right_hand",
"left_hand",
"right_leg_upper",
"left_leg_upper",
"right_leg_lower",
"left_leg_lower",
"right_foot",
"left_foot",
"gun",
"shield",
// clang-format on
};
static_assert(std::extent_v<decltype(HITLOC_NAMES)> == HITLOC_COUNT);
} // namespace IW5