mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-09-09 07:27:05 +00:00
feat: templated vehicle loading and dumping for IW4 and IW5 (#929)
* feat: templated vehicle loading and dumping for IW4 and IW5 * chore: restructure vehicle tests into separate files --------- Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "Game/IW4/Techset/TechsetDumperIW4.h"
|
||||
#include "Game/IW4/Techset/VertexShaderDumperIW4.h"
|
||||
#include "Game/IW4/Tracer/TracerDumperIW4.h"
|
||||
#include "Game/IW4/Vehicle/VehicleDumperIW4.h"
|
||||
#include "Game/IW4/XAnim/XAnimDumperIW4.h"
|
||||
#include "Game/IW4/XModel/XModelDumperIW4.h"
|
||||
#include "Leaderboard/LeaderboardJsonDumperIW4.h"
|
||||
@@ -24,7 +25,6 @@
|
||||
#include "Sound/SndCurveDumperIW4.h"
|
||||
#include "StringTable/StringTableDumperIW4.h"
|
||||
#include "StructuredDataDef/StructuredDataDefDumperIW4.h"
|
||||
#include "Vehicle/VehicleDumperIW4.h"
|
||||
#include "Weapon/WeaponDumperIW4.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace vehicle
|
||||
{
|
||||
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetVehicle>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetVehicle::Type>& asset) override;
|
||||
};
|
||||
} // namespace vehicle
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Game/IW5/Techset/TechsetDumperIW5.h"
|
||||
#include "Game/IW5/Techset/VertexShaderDumperIW5.h"
|
||||
#include "Game/IW5/Tracer/TracerDumperIW5.h"
|
||||
#include "Game/IW5/Vehicle/VehicleDumperIW5.h"
|
||||
#include "Game/IW5/XModel/XModelDumperIW5.h"
|
||||
#include "Leaderboard/LeaderboardJsonDumperIW5.h"
|
||||
#include "LightDef/LightDefDumperIW5.h"
|
||||
@@ -71,6 +72,6 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
RegisterAssetDumper(std::make_unique<leaderboard::JsonDumperIW5>());
|
||||
// REGISTER_DUMPER(AssetDumperStructuredDataDefSet)
|
||||
RegisterAssetDumper(std::make_unique<tracer::DumperIW5>());
|
||||
// REGISTER_DUMPER(AssetDumperVehicleDef)
|
||||
RegisterAssetDumper(std::make_unique<vehicle::DumperIW5>());
|
||||
RegisterAssetDumper(std::make_unique<addon_map_ents::DumperIW5>());
|
||||
}
|
||||
|
||||
+33
-8
@@ -1,17 +1,35 @@
|
||||
#include "VehicleDumperIW4.h"
|
||||
#options GAME(IW4, IW5)
|
||||
|
||||
#include "Game/IW4/CommonIW4.h"
|
||||
#include "Game/IW4/InfoString/EnumStrings.h"
|
||||
#include "Game/IW4/InfoString/InfoStringFromStructConverter.h"
|
||||
#include "Game/IW4/ObjConstantsIW4.h"
|
||||
#include "Game/IW4/Vehicle/VehicleFields.h"
|
||||
#filename "Game/" + GAME + "/Vehicle/VehicleDumper" + GAME + ".cpp"
|
||||
|
||||
#set DUMPER_HEADER "\"VehicleDumper" + GAME + ".h\""
|
||||
#set INFO_STRING_CONVERTER_HEADER "\"Game/" + GAME + "/InfoString/InfoStringFromStructConverter.h\""
|
||||
#set OBJ_CONSTANTS_HEADER "\"Game/" + GAME + "/ObjConstants" + GAME + ".h\""
|
||||
#set VEHICLE_FIELDS_HEADER "\"Game/" + GAME + "/Vehicle/VehicleFields" + GAME + ".h\""
|
||||
#set VEHICLE_STRINGS_HEADER "\"Game/" + GAME + "/Vehicle/VehicleStrings" + GAME + ".h\""
|
||||
#set CLASS_NAME "Dumper" + GAME
|
||||
|
||||
#if GAME == "IW5"
|
||||
#define FEATURE_IW5
|
||||
#endif
|
||||
|
||||
// This file was templated.
|
||||
// See VehicleDumper.cpp.template.
|
||||
// Do not modify, changes will be lost.
|
||||
|
||||
#include DUMPER_HEADER
|
||||
|
||||
#include INFO_STRING_CONVERTER_HEADER
|
||||
#include OBJ_CONSTANTS_HEADER
|
||||
#include VEHICLE_FIELDS_HEADER
|
||||
#include VEHICLE_STRINGS_HEADER
|
||||
#include "Vehicle/VehicleCommon.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
|
||||
using namespace IW4;
|
||||
using namespace GAME;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -56,6 +74,13 @@ namespace
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_IW5
|
||||
case VFT_CAM_Z_OFFSET_MODE:
|
||||
FillFromEnumInt(
|
||||
std::string(field.szName), field.iOffset, s_vehicleCameraZOffsetModeNames, std::extent_v<decltype(s_vehicleCameraZOffsetModeNames)>);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VFT_NUM:
|
||||
default:
|
||||
assert(false);
|
||||
@@ -93,7 +118,7 @@ namespace
|
||||
|
||||
namespace vehicle
|
||||
{
|
||||
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetVehicle::Type>& asset)
|
||||
void CLASS_NAME::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetVehicle::Type>& asset)
|
||||
{
|
||||
// Only dump raw when no gdt available
|
||||
if (context.m_gdt)
|
||||
@@ -0,0 +1,24 @@
|
||||
#options GAME(IW4, IW5)
|
||||
|
||||
#filename "Game/" + GAME + "/Vehicle/VehicleDumper" + GAME + ".h"
|
||||
|
||||
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
|
||||
#set CLASS_NAME "Dumper" + GAME
|
||||
|
||||
// This file was templated.
|
||||
// See VehicleDumper.h.template.
|
||||
// Do not modify, changes will be lost.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include GAME_HEADER
|
||||
|
||||
namespace vehicle
|
||||
{
|
||||
class CLASS_NAME final : public AbstractAssetDumper<GAME::AssetVehicle>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<GAME::AssetVehicle::Type>& asset) override;
|
||||
};
|
||||
} // namespace vehicle
|
||||
Reference in New Issue
Block a user