XAnim tests.
This commit is contained in:
parent
9cd0624f88
commit
599d7c692e
@ -258,8 +258,9 @@ namespace Components
|
|||||||
AssetHandler::RegisterInterface(new Assets::IGfxImage());
|
AssetHandler::RegisterInterface(new Assets::IGfxImage());
|
||||||
AssetHandler::RegisterInterface(new Assets::IMaterial());
|
AssetHandler::RegisterInterface(new Assets::IMaterial());
|
||||||
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
|
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
|
||||||
|
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
|
||||||
AssetHandler::RegisterInterface(new Assets::IPhysCollmap());
|
AssetHandler::RegisterInterface(new Assets::IPhysCollmap());
|
||||||
AssetHandler::RegisterInterface(new Assets::IXModelSurfs());
|
//AssetHandler::RegisterInterface(new Assets::IXModelSurfs());
|
||||||
AssetHandler::RegisterInterface(new Assets::ILocalizedEntry());
|
AssetHandler::RegisterInterface(new Assets::ILocalizedEntry());
|
||||||
AssetHandler::RegisterInterface(new Assets::IMaterialPixelShader());
|
AssetHandler::RegisterInterface(new Assets::IMaterialPixelShader());
|
||||||
AssetHandler::RegisterInterface(new Assets::IMaterialTechniqueSet());
|
AssetHandler::RegisterInterface(new Assets::IMaterialTechniqueSet());
|
||||||
|
@ -61,6 +61,7 @@ namespace Components
|
|||||||
#include "AssetInterfaces\IGfxImage.hpp"
|
#include "AssetInterfaces\IGfxImage.hpp"
|
||||||
#include "AssetInterfaces\IMaterial.hpp"
|
#include "AssetInterfaces\IMaterial.hpp"
|
||||||
#include "AssetInterfaces\IPhysPreset.hpp"
|
#include "AssetInterfaces\IPhysPreset.hpp"
|
||||||
|
#include "AssetInterfaces\IXAnimParts.hpp"
|
||||||
#include "AssetInterfaces\IPhysCollmap.hpp"
|
#include "AssetInterfaces\IPhysCollmap.hpp"
|
||||||
#include "AssetInterfaces\IXModelSurfs.hpp"
|
#include "AssetInterfaces\IXModelSurfs.hpp"
|
||||||
#include "AssetInterfaces\ILocalizedEntry.hpp"
|
#include "AssetInterfaces\ILocalizedEntry.hpp"
|
||||||
|
139
src/Components/Modules/AssetInterfaces/IXAnimParts.cpp
Normal file
139
src/Components/Modules/AssetInterfaces/IXAnimParts.cpp
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
void IXAnimParts::Mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
|
{
|
||||||
|
Game::XAnimParts* asset = header.xanim;
|
||||||
|
|
||||||
|
if (asset->tagnames)
|
||||||
|
{
|
||||||
|
for (char i = 0; i < asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]; ++i)
|
||||||
|
{
|
||||||
|
builder->AddScriptString(asset->tagnames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->notetracks)
|
||||||
|
{
|
||||||
|
for (char i = 0; i < asset->notetrackCount; ++i)
|
||||||
|
{
|
||||||
|
builder->AddScriptString(asset->notetracks[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IXAnimParts::Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
|
{
|
||||||
|
Assert_Size(Game::XAnimParts, 88);
|
||||||
|
|
||||||
|
Utils::Stream* buffer = builder->GetBuffer();
|
||||||
|
Game::XAnimParts* asset = header.xanim;
|
||||||
|
Game::XAnimParts* dest = buffer->Dest<Game::XAnimParts>();
|
||||||
|
buffer->Save(asset, sizeof(Game::XAnimParts));
|
||||||
|
|
||||||
|
buffer->PushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||||
|
|
||||||
|
if (asset->name)
|
||||||
|
{
|
||||||
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
|
dest->name = reinterpret_cast<char*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->tagnames)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
|
|
||||||
|
unsigned short* destTagnames = buffer->Dest<unsigned short>();
|
||||||
|
buffer->SaveArray(asset->tagnames, asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]);
|
||||||
|
|
||||||
|
for (char i = 0; i < asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]; ++i)
|
||||||
|
{
|
||||||
|
builder->MapScriptString(&destTagnames[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest->tagnames = reinterpret_cast<short*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->notetracks)
|
||||||
|
{
|
||||||
|
Assert_Size(Game::XAnimNotifyInfo, 8);
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
|
Game::XAnimNotifyInfo* destNotetracks = buffer->Dest<Game::XAnimNotifyInfo>();
|
||||||
|
buffer->SaveArray(asset->notetracks, asset->notetrackCount);
|
||||||
|
|
||||||
|
for (char i = 0; i < asset->notetrackCount; ++i)
|
||||||
|
{
|
||||||
|
builder->MapScriptString(&destNotetracks[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest->notetracks = reinterpret_cast<Game::XAnimNotifyInfo*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->delta)
|
||||||
|
{
|
||||||
|
Assert_Size(Game::XAnimDeltaPart, 12);
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
|
dest->delta = reinterpret_cast<Game::XAnimDeltaPart*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->dataByte)
|
||||||
|
{
|
||||||
|
buffer->SaveArray(asset->dataByte, asset->dataByteCount);
|
||||||
|
dest->dataByte = reinterpret_cast<char*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->dataShort)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
|
buffer->SaveArray(asset->dataShort, asset->dataShortCount);
|
||||||
|
dest->dataShort = reinterpret_cast<short*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->dataInt)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
buffer->SaveArray(asset->dataInt, asset->dataIntCount);
|
||||||
|
dest->dataInt = reinterpret_cast<int*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->randomDataShort)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
|
buffer->SaveArray(asset->randomDataShort, asset->randomDataShortCount);
|
||||||
|
dest->randomDataShort = reinterpret_cast<short*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->randomDataByte)
|
||||||
|
{
|
||||||
|
buffer->SaveArray(asset->randomDataByte, asset->randomDataByteCount);
|
||||||
|
dest->randomDataByte = reinterpret_cast<char*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->randomDataInt)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
buffer->SaveArray(asset->randomDataInt, asset->randomDataIntCount);
|
||||||
|
dest->randomDataInt = reinterpret_cast<int*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->indices.data)
|
||||||
|
{
|
||||||
|
if (asset->framecount > 0xFF)
|
||||||
|
{
|
||||||
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
|
buffer->SaveArray(dest->indices._2, asset->framecount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer->SaveArray(dest->indices._1, asset->framecount);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest->indices.data = reinterpret_cast<void*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->PopBlock();
|
||||||
|
}
|
||||||
|
}
|
11
src/Components/Modules/AssetInterfaces/IXAnimParts.hpp
Normal file
11
src/Components/Modules/AssetInterfaces/IXAnimParts.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
class IXAnimParts : public Components::AssetHandler::IAsset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual Game::XAssetType GetType() override { return Game::XAssetType::ASSET_TYPE_XANIM; };
|
||||||
|
|
||||||
|
virtual void Mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
};
|
||||||
|
}
|
@ -14,21 +14,8 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//asset->numBones = 0;
|
|
||||||
//asset->numRootBones = 0;
|
|
||||||
//asset->boneNames = 0;
|
|
||||||
//asset->parentList = 0;
|
|
||||||
//asset->tagAngles = 0;
|
|
||||||
//asset->tagPositions = 0;
|
|
||||||
//asset->animMatrix = 0;
|
|
||||||
//asset->colSurf = 0;
|
|
||||||
//asset->partClassification = 0;
|
|
||||||
|
|
||||||
if (asset->materials)
|
if (asset->materials)
|
||||||
{
|
{
|
||||||
//asset->materials = 0;
|
|
||||||
//asset->numSurfaces = 0;
|
|
||||||
|
|
||||||
for (char i = 0; i < asset->numSurfaces; ++i)
|
for (char i = 0; i < asset->numSurfaces; ++i)
|
||||||
{
|
{
|
||||||
if (asset->materials[i])
|
if (asset->materials[i])
|
||||||
|
@ -20,8 +20,11 @@ namespace Components
|
|||||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
info = { "penis", 1, 0 };
|
if (!ZoneBuilder::IsEnabled())
|
||||||
Game::DB_LoadXAssets(&info, 1, 1);
|
{
|
||||||
|
info = { "penis", 1, 0 };
|
||||||
|
Game::DB_LoadXAssets(&info, 1, 1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,6 +1424,155 @@ namespace Game
|
|||||||
PhysCollmap* physCollmap;
|
PhysCollmap* physCollmap;
|
||||||
}; // total size 304
|
}; // total size 304
|
||||||
|
|
||||||
|
union XAnimDynamicIndices
|
||||||
|
{
|
||||||
|
char _1[1];
|
||||||
|
unsigned __int16 _2[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
union XAnimDynamicFrames
|
||||||
|
{
|
||||||
|
char(*_1)[3];
|
||||||
|
unsigned __int16(*_2)[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimNotifyInfo
|
||||||
|
{
|
||||||
|
unsigned __int16 name;
|
||||||
|
float time;
|
||||||
|
};
|
||||||
|
|
||||||
|
union XAnimIndices
|
||||||
|
{
|
||||||
|
char* _1;
|
||||||
|
unsigned short *_2;
|
||||||
|
void* data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimPartTransFrames
|
||||||
|
{
|
||||||
|
float mins[3];
|
||||||
|
float size[3];
|
||||||
|
XAnimDynamicFrames frames;
|
||||||
|
XAnimDynamicIndices indices;
|
||||||
|
};
|
||||||
|
|
||||||
|
union XAnimPartTransData
|
||||||
|
{
|
||||||
|
XAnimPartTransFrames frames;
|
||||||
|
float frame0[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimPartTrans
|
||||||
|
{
|
||||||
|
unsigned __int16 size;
|
||||||
|
char smallTrans;
|
||||||
|
XAnimPartTransData u;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimDeltaPartQuatDataFrames2
|
||||||
|
{
|
||||||
|
__int16 *frames;
|
||||||
|
char indices[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
union XAnimDeltaPartQuatData2
|
||||||
|
{
|
||||||
|
XAnimDeltaPartQuatDataFrames2 frames;
|
||||||
|
__int16 frame0[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimDeltaPartQuat2
|
||||||
|
{
|
||||||
|
unsigned __int16 size;
|
||||||
|
XAnimDeltaPartQuatData2 u;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimDeltaPartQuatDataFrames
|
||||||
|
{
|
||||||
|
__int16 *frames;
|
||||||
|
char indices[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
union XAnimDeltaPartQuatData
|
||||||
|
{
|
||||||
|
XAnimDeltaPartQuatDataFrames frames;
|
||||||
|
__int16 frame0[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimDeltaPartQuat
|
||||||
|
{
|
||||||
|
unsigned __int16 size;
|
||||||
|
XAnimDeltaPartQuatData u;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimDeltaPart
|
||||||
|
{
|
||||||
|
XAnimPartTrans *trans;
|
||||||
|
XAnimDeltaPartQuat2 *quat2;
|
||||||
|
XAnimDeltaPartQuat *quat;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum XAnimPartType
|
||||||
|
{
|
||||||
|
PART_TYPE_NO_QUAT = 0x0,
|
||||||
|
PART_TYPE_HALF_QUAT = 0x1,
|
||||||
|
PART_TYPE_FULL_QUAT = 0x2,
|
||||||
|
PART_TYPE_HALF_QUAT_NO_SIZE = 0x3,
|
||||||
|
PART_TYPE_FULL_QUAT_NO_SIZE = 0x4,
|
||||||
|
PART_TYPE_SMALL_TRANS = 0x5,
|
||||||
|
PART_TYPE_TRANS = 0x6,
|
||||||
|
PART_TYPE_TRANS_NO_SIZE = 0x7,
|
||||||
|
PART_TYPE_NO_TRANS = 0x8,
|
||||||
|
PART_TYPE_ALL = 0x9,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum XAnimFlags
|
||||||
|
{
|
||||||
|
XANIM_LOOP_SYNC_TIME = 0x1,
|
||||||
|
XANIM_NONLOOP_SYNC_TIME = 0x2,
|
||||||
|
XANIM_SYNC_ROOT = 0x4,
|
||||||
|
XANIM_COMPLETE = 0x8,
|
||||||
|
XANIM_ADDITIVE = 0x10,
|
||||||
|
XANIM_CLIENT = 0x20,
|
||||||
|
XANIM_SEPARATE = 0x40,
|
||||||
|
XANIM_FORCELOAD = 0x80,
|
||||||
|
XANIM_PROPOGATE_FLAGS = 0x63,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XAnimParts
|
||||||
|
{
|
||||||
|
char * name; // 0
|
||||||
|
unsigned short dataByteCount; // 4
|
||||||
|
unsigned short dataShortCount; // 6
|
||||||
|
unsigned short dataIntCount; // 8
|
||||||
|
unsigned short randomDataByteCount; // 10 - 0xA
|
||||||
|
unsigned short randomDataIntCount;// 12 - 0xC
|
||||||
|
unsigned short framecount; // 14 - 0xE
|
||||||
|
char pad1; // 16
|
||||||
|
char boneCount[10]; // 17
|
||||||
|
char notetrackCount; // 27
|
||||||
|
bool bLoop; // 28
|
||||||
|
bool bDelta; // 29
|
||||||
|
char assetType; // 30
|
||||||
|
char pad2; // 31
|
||||||
|
int randomDataShortCount; // 32 - 0x20
|
||||||
|
int indexcount; // 36 - 0x24
|
||||||
|
float framerate; // 40 - 0x28
|
||||||
|
float frequency; // 44 - 0x2C
|
||||||
|
short * tagnames; // 48 - 0x30
|
||||||
|
char *dataByte;// 52 - 0x34
|
||||||
|
short *dataShort; // 56 - 0x38
|
||||||
|
int *dataInt; // 60 - 0x3C
|
||||||
|
short *randomDataShort; // 64 - 0x40
|
||||||
|
char *randomDataByte; // 68 - 0x44
|
||||||
|
int *randomDataInt; // 72 - 0x48
|
||||||
|
XAnimIndices indices; // 76 - 0x4C
|
||||||
|
XAnimNotifyInfo* notetracks; // 80 - 0x50
|
||||||
|
XAnimDeltaPart * delta; // 84 - 0x54
|
||||||
|
// 88 - 0x58
|
||||||
|
};
|
||||||
|
|
||||||
union XAssetHeader
|
union XAssetHeader
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
@ -1446,6 +1595,7 @@ namespace Game
|
|||||||
PhysPreset* physPreset;
|
PhysPreset* physPreset;
|
||||||
PhysCollmap* physCollmap;
|
PhysCollmap* physCollmap;
|
||||||
XModelSurfs* surfaces;
|
XModelSurfs* surfaces;
|
||||||
|
XAnimParts* xanim;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XAsset
|
struct XAsset
|
||||||
|
Loading…
x
Reference in New Issue
Block a user