From 0ea4a7ad6fd201ad79949adb41c6fc6235a8f257 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Sun, 17 Aug 2025 13:14:17 -0400 Subject: [PATCH] Added a tonnn of new classes. --- libs/xassets/assetmap.h | 8 +- libs/xassets/assets.cpp | 34 +- libs/xassets/assets.h | 98 ++--- libs/xassets/d3dresource.cpp | 1 - libs/xassets/d3dresource.h | 15 - libs/xassets/font.h | 8 +- libs/xassets/gameworld.cpp | 1 - libs/xassets/gameworld.h | 144 ------- libs/xassets/gfximage.cpp | 1 - libs/xassets/gfximage.h | 62 --- libs/xassets/gfxlightdef.cpp | 1 - libs/xassets/gfxlightdef.h | 18 - libs/xassets/gfxworld.h | 4 +- libs/xassets/loadedsound.cpp | 1 - libs/xassets/loadedsound.h | 72 ---- libs/xassets/materialpixelshader.h | 2 +- libs/xassets/materialtechset.h | 2 +- libs/xassets/menudef.cpp | 1 - libs/xassets/menulist.cpp | 1 - libs/xassets/menulist.h | 13 - libs/xassets/xanimdeltapart.cpp | 58 +++ libs/xassets/xanimdeltapart.h | 46 +++ libs/xassets/xanimdeltapartquat.cpp | 39 ++ libs/xassets/xanimdeltapartquat.h | 36 ++ libs/xassets/xanimdeltapartquatdata.cpp | 43 ++ libs/xassets/xanimdeltapartquatdata.h | 36 ++ libs/xassets/xanimdeltapartquatdataframes.cpp | 55 +++ libs/xassets/xanimdeltapartquatdataframes.h | 41 ++ libs/xassets/xanimdynamicframes.cpp | 33 ++ libs/xassets/xanimdynamicframes.h | 27 ++ libs/xassets/xanimdynamicindices.cpp | 28 ++ libs/xassets/xanimdynamicindices.h | 25 ++ libs/xassets/xanimindices.cpp | 38 ++ libs/xassets/xanimindices.h | 37 ++ libs/xassets/xanimnotifyinfo.cpp | 38 ++ libs/xassets/xanimnotifyinfo.h | 35 ++ libs/xassets/xanimparts.cpp | 382 ++++++++++++++++++ libs/xassets/xanimparts.h | 204 ++++++++++ libs/xassets/xanimparttrans.cpp | 54 +++ libs/xassets/xanimparttrans.h | 40 ++ libs/xassets/xanimparttransdata.cpp | 40 ++ libs/xassets/xanimparttransdata.h | 37 ++ libs/xassets/xanimparttransframes.cpp | 71 ++++ libs/xassets/xanimparttransframes.h | 43 ++ libs/xassets/xassetlist.cpp | 53 +++ libs/xassets/xassetlist.h | 34 ++ libs/xassets/xaudiochannelmap.cpp | 64 +++ libs/xassets/xaudiochannelmap.h | 26 ++ libs/xassets/xaudiochannelmapentry.cpp | 64 +++ libs/xassets/xaudiochannelmapentry.h | 30 ++ libs/xassets/xcardmemory.cpp | 23 ++ libs/xassets/xcardmemory.h | 19 + libs/xassets/xcleaf.cpp | 97 +++++ libs/xassets/xcleaf.h | 59 +++ libs/xassets/xcleafbrushnode.cpp | 55 +++ libs/xassets/xcleafbrushnode.h | 45 +++ libs/xassets/xcleafbrushnodechildren.cpp | 52 +++ libs/xassets/xcleafbrushnodechildren.h | 39 ++ libs/xassets/xcleafbrushnodedata.cpp | 39 ++ libs/xassets/xcleafbrushnodedata.h | 41 ++ libs/xassets/xcleafbrushnodeleaf.cpp | 28 ++ libs/xassets/xcleafbrushnodeleaf.h | 33 ++ libs/xassets/xclipmap.cpp | 104 +++++ libs/xassets/xclipmap.h | 82 ++++ libs/xassets/xcnode.cpp | 45 +++ libs/xassets/xcnode.h | 39 ++ libs/xassets/xcollisionaabbtree.cpp | 74 ++++ libs/xassets/xcollisionaabbtree.h | 49 +++ libs/xassets/xcollisionaabbtreeindex.cpp | 40 ++ libs/xassets/xcollisionaabbtreeindex.h | 39 ++ libs/xassets/xcollisionborder.cpp | 60 +++ libs/xassets/xcollisionborder.h | 47 +++ libs/xassets/xcollisionpartition.cpp | 58 +++ libs/xassets/xcollisionpartition.h | 47 +++ libs/xassets/xcstaticmodels.cpp | 93 +++++ libs/xassets/xcstaticmodels.h | 56 +++ libs/xassets/xcstaticmodelwritable.cpp | 28 ++ libs/xassets/xcstaticmodelwritable.h | 29 ++ libs/xassets/xd3dbasetexture.cpp | 25 ++ libs/xassets/xd3dbasetexture.h | 22 + libs/xassets/xd3dcubetexture.cpp | 31 ++ libs/xassets/xd3dcubetexture.h | 23 ++ libs/xassets/xd3dresource.cpp | 39 ++ libs/xassets/xd3dresource.h | 25 ++ libs/xassets/xd3dvolumetexture.cpp | 31 ++ libs/xassets/xd3dvolumetexture.h | 23 ++ libs/xassets/xdmaterial.cpp | 50 +++ libs/xassets/xdmaterial.h | 40 ++ libs/xassets/xgameworld.cpp | 21 + libs/xassets/xgameworld.h | 25 ++ libs/xassets/xgameworldmp.cpp | 25 ++ libs/xassets/xgameworldmp.h | 23 ++ libs/xassets/xgameworldsp.cpp | 26 ++ libs/xassets/xgameworldsp.h | 26 ++ libs/xassets/xgfximage.cpp | 1 + libs/xassets/xgfximage.h | 31 ++ libs/xassets/xgfximageloaddef.cpp | 31 ++ libs/xassets/xgfximageloaddef.h | 23 ++ libs/xassets/xgfxlight.cpp | 129 ++++++ libs/xassets/xgfxlight.h | 79 ++++ libs/xassets/xgfxlightdef.cpp | 34 ++ libs/xassets/xgfxlightdef.h | 23 ++ libs/xassets/xgfxlightimage.cpp | 31 ++ libs/xassets/xgfxlightimage.h | 21 + libs/xassets/xgfxreflectionprobe.cpp | 48 +++ libs/xassets/xgfxreflectionprobe.h | 47 +++ libs/xassets/xgfxstreamingaabbtree.cpp | 79 ++++ libs/xassets/xgfxstreamingaabbtree.h | 53 +++ libs/xassets/xgfxtexture.cpp | 21 + libs/xassets/xgfxtexture.h | 24 ++ libs/xassets/xgfxworld.cpp | 117 ++++++ libs/xassets/xgfxworld.h | 71 ++++ libs/xassets/xgfxworldstreaminfo.cpp | 77 ++++ libs/xassets/xgfxworldstreaminfo.h | 52 +++ libs/xassets/xgfxworldvertex.cpp | 104 +++++ libs/xassets/xgfxworldvertex.h | 61 +++ libs/xassets/xgfxworldvertexdata.cpp | 53 +++ libs/xassets/xgfxworldvertexdata.h | 44 ++ libs/xassets/xgputexturefetchconstant.cpp | 23 ++ libs/xassets/xgputexturefetchconstant.h | 68 ++++ libs/xassets/xgputexturefetchconstantraw.cpp | 23 ++ libs/xassets/xgputexturefetchconstantraw.h | 19 + libs/xassets/xmenudef.cpp | 46 +++ libs/xassets/{menudef.h => xmenudef.h} | 158 ++++---- libs/xassets/xmenulist.cpp | 70 ++++ libs/xassets/xmenulist.h | 30 ++ libs/xassets/xnodetype.h | 36 ++ libs/xassets/xpathbasenode.cpp | 40 ++ libs/xassets/xpathbasenode.h | 35 ++ libs/xassets/xpathdata.cpp | 80 ++++ libs/xassets/xpathdata.cpp.new | 80 ++++ libs/xassets/xpathdata.h | 45 +++ libs/xassets/xpathdata.h.new | 45 +++ libs/xassets/xpathlink.cpp | 66 +++ libs/xassets/xpathlink.h | 43 ++ libs/xassets/xpathnode.cpp | 47 +++ libs/xassets/xpathnode.h | 42 ++ libs/xassets/xpathnodeconstant.cpp | 220 ++++++++++ libs/xassets/xpathnodeconstant.h | 103 +++++ libs/xassets/xpathnodedynamic.cpp | 96 +++++ libs/xassets/xpathnodedynamic.h | 57 +++ libs/xassets/xpathnodetransient.cpp | 86 ++++ libs/xassets/xpathnodetransient.h | 56 +++ libs/xassets/xpathnodetree.cpp | 56 +++ libs/xassets/xpathnodetree.h | 41 ++ libs/xassets/xpathnodetreeinfo.cpp | 46 +++ libs/xassets/xpathnodetreeinfo.h | 38 ++ libs/xassets/xpathnodetreenodes.cpp | 53 +++ libs/xassets/xpathnodetreenodes.h | 35 ++ libs/xassets/xsoundalias.h | 2 + libs/xassets/xsoundcurve.cpp | 53 ++- libs/xassets/xsoundcurve.h | 11 + libs/xassets/xspeakermap.cpp | 119 ++++++ libs/xassets/xspeakermap.h | 36 ++ libs/xassets/xstring.cpp | 7 + libs/xassets/xstring.h | 1 + libs/xassets/xsunlightparseparams.cpp | 106 +++++ libs/xassets/xsunlightparseparams.h | 69 ++++ libs/xassets/xweapondef.cpp | 48 +++ libs/xassets/xweapondef.h | 62 +++ 160 files changed, 7287 insertions(+), 483 deletions(-) delete mode 100644 libs/xassets/d3dresource.cpp delete mode 100644 libs/xassets/d3dresource.h delete mode 100644 libs/xassets/gameworld.cpp delete mode 100644 libs/xassets/gameworld.h delete mode 100644 libs/xassets/gfximage.cpp delete mode 100644 libs/xassets/gfximage.h delete mode 100644 libs/xassets/gfxlightdef.cpp delete mode 100644 libs/xassets/gfxlightdef.h delete mode 100644 libs/xassets/loadedsound.cpp delete mode 100644 libs/xassets/loadedsound.h delete mode 100644 libs/xassets/menudef.cpp delete mode 100644 libs/xassets/menulist.cpp delete mode 100644 libs/xassets/menulist.h create mode 100644 libs/xassets/xanimdeltapart.cpp create mode 100644 libs/xassets/xanimdeltapart.h create mode 100644 libs/xassets/xanimdeltapartquat.cpp create mode 100644 libs/xassets/xanimdeltapartquat.h create mode 100644 libs/xassets/xanimdeltapartquatdata.cpp create mode 100644 libs/xassets/xanimdeltapartquatdata.h create mode 100644 libs/xassets/xanimdeltapartquatdataframes.cpp create mode 100644 libs/xassets/xanimdeltapartquatdataframes.h create mode 100644 libs/xassets/xanimdynamicframes.cpp create mode 100644 libs/xassets/xanimdynamicframes.h create mode 100644 libs/xassets/xanimdynamicindices.cpp create mode 100644 libs/xassets/xanimdynamicindices.h create mode 100644 libs/xassets/xanimindices.cpp create mode 100644 libs/xassets/xanimindices.h create mode 100644 libs/xassets/xanimnotifyinfo.cpp create mode 100644 libs/xassets/xanimnotifyinfo.h create mode 100644 libs/xassets/xanimparts.cpp create mode 100644 libs/xassets/xanimparts.h create mode 100644 libs/xassets/xanimparttrans.cpp create mode 100644 libs/xassets/xanimparttrans.h create mode 100644 libs/xassets/xanimparttransdata.cpp create mode 100644 libs/xassets/xanimparttransdata.h create mode 100644 libs/xassets/xanimparttransframes.cpp create mode 100644 libs/xassets/xanimparttransframes.h create mode 100644 libs/xassets/xassetlist.cpp create mode 100644 libs/xassets/xassetlist.h create mode 100644 libs/xassets/xaudiochannelmap.cpp create mode 100644 libs/xassets/xaudiochannelmap.h create mode 100644 libs/xassets/xaudiochannelmapentry.cpp create mode 100644 libs/xassets/xaudiochannelmapentry.h create mode 100644 libs/xassets/xcardmemory.cpp create mode 100644 libs/xassets/xcardmemory.h create mode 100644 libs/xassets/xcleaf.cpp create mode 100644 libs/xassets/xcleaf.h create mode 100644 libs/xassets/xcleafbrushnode.cpp create mode 100644 libs/xassets/xcleafbrushnode.h create mode 100644 libs/xassets/xcleafbrushnodechildren.cpp create mode 100644 libs/xassets/xcleafbrushnodechildren.h create mode 100644 libs/xassets/xcleafbrushnodedata.cpp create mode 100644 libs/xassets/xcleafbrushnodedata.h create mode 100644 libs/xassets/xcleafbrushnodeleaf.cpp create mode 100644 libs/xassets/xcleafbrushnodeleaf.h create mode 100644 libs/xassets/xclipmap.cpp create mode 100644 libs/xassets/xclipmap.h create mode 100644 libs/xassets/xcnode.cpp create mode 100644 libs/xassets/xcnode.h create mode 100644 libs/xassets/xcollisionaabbtree.cpp create mode 100644 libs/xassets/xcollisionaabbtree.h create mode 100644 libs/xassets/xcollisionaabbtreeindex.cpp create mode 100644 libs/xassets/xcollisionaabbtreeindex.h create mode 100644 libs/xassets/xcollisionborder.cpp create mode 100644 libs/xassets/xcollisionborder.h create mode 100644 libs/xassets/xcollisionpartition.cpp create mode 100644 libs/xassets/xcollisionpartition.h create mode 100644 libs/xassets/xcstaticmodels.cpp create mode 100644 libs/xassets/xcstaticmodels.h create mode 100644 libs/xassets/xcstaticmodelwritable.cpp create mode 100644 libs/xassets/xcstaticmodelwritable.h create mode 100644 libs/xassets/xd3dbasetexture.cpp create mode 100644 libs/xassets/xd3dbasetexture.h create mode 100644 libs/xassets/xd3dcubetexture.cpp create mode 100644 libs/xassets/xd3dcubetexture.h create mode 100644 libs/xassets/xd3dresource.cpp create mode 100644 libs/xassets/xd3dresource.h create mode 100644 libs/xassets/xd3dvolumetexture.cpp create mode 100644 libs/xassets/xd3dvolumetexture.h create mode 100644 libs/xassets/xdmaterial.cpp create mode 100644 libs/xassets/xdmaterial.h create mode 100644 libs/xassets/xgameworld.cpp create mode 100644 libs/xassets/xgameworld.h create mode 100644 libs/xassets/xgameworldmp.cpp create mode 100644 libs/xassets/xgameworldmp.h create mode 100644 libs/xassets/xgameworldsp.cpp create mode 100644 libs/xassets/xgameworldsp.h create mode 100644 libs/xassets/xgfximage.cpp create mode 100644 libs/xassets/xgfximage.h create mode 100644 libs/xassets/xgfximageloaddef.cpp create mode 100644 libs/xassets/xgfximageloaddef.h create mode 100644 libs/xassets/xgfxlight.cpp create mode 100644 libs/xassets/xgfxlight.h create mode 100644 libs/xassets/xgfxlightdef.cpp create mode 100644 libs/xassets/xgfxlightdef.h create mode 100644 libs/xassets/xgfxlightimage.cpp create mode 100644 libs/xassets/xgfxlightimage.h create mode 100644 libs/xassets/xgfxreflectionprobe.cpp create mode 100644 libs/xassets/xgfxreflectionprobe.h create mode 100644 libs/xassets/xgfxstreamingaabbtree.cpp create mode 100644 libs/xassets/xgfxstreamingaabbtree.h create mode 100644 libs/xassets/xgfxtexture.cpp create mode 100644 libs/xassets/xgfxtexture.h create mode 100644 libs/xassets/xgfxworld.cpp create mode 100644 libs/xassets/xgfxworld.h create mode 100644 libs/xassets/xgfxworldstreaminfo.cpp create mode 100644 libs/xassets/xgfxworldstreaminfo.h create mode 100644 libs/xassets/xgfxworldvertex.cpp create mode 100644 libs/xassets/xgfxworldvertex.h create mode 100644 libs/xassets/xgfxworldvertexdata.cpp create mode 100644 libs/xassets/xgfxworldvertexdata.h create mode 100644 libs/xassets/xgputexturefetchconstant.cpp create mode 100644 libs/xassets/xgputexturefetchconstant.h create mode 100644 libs/xassets/xgputexturefetchconstantraw.cpp create mode 100644 libs/xassets/xgputexturefetchconstantraw.h create mode 100644 libs/xassets/xmenudef.cpp rename libs/xassets/{menudef.h => xmenudef.h} (68%) create mode 100644 libs/xassets/xmenulist.cpp create mode 100644 libs/xassets/xmenulist.h create mode 100644 libs/xassets/xnodetype.h create mode 100644 libs/xassets/xpathbasenode.cpp create mode 100644 libs/xassets/xpathbasenode.h create mode 100644 libs/xassets/xpathdata.cpp create mode 100644 libs/xassets/xpathdata.cpp.new create mode 100644 libs/xassets/xpathdata.h create mode 100644 libs/xassets/xpathdata.h.new create mode 100644 libs/xassets/xpathlink.cpp create mode 100644 libs/xassets/xpathlink.h create mode 100644 libs/xassets/xpathnode.cpp create mode 100644 libs/xassets/xpathnode.h create mode 100644 libs/xassets/xpathnodeconstant.cpp create mode 100644 libs/xassets/xpathnodeconstant.h create mode 100644 libs/xassets/xpathnodedynamic.cpp create mode 100644 libs/xassets/xpathnodedynamic.h create mode 100644 libs/xassets/xpathnodetransient.cpp create mode 100644 libs/xassets/xpathnodetransient.h create mode 100644 libs/xassets/xpathnodetree.cpp create mode 100644 libs/xassets/xpathnodetree.h create mode 100644 libs/xassets/xpathnodetreeinfo.cpp create mode 100644 libs/xassets/xpathnodetreeinfo.h create mode 100644 libs/xassets/xpathnodetreenodes.cpp create mode 100644 libs/xassets/xpathnodetreenodes.h create mode 100644 libs/xassets/xspeakermap.cpp create mode 100644 libs/xassets/xspeakermap.h create mode 100644 libs/xassets/xsunlightparseparams.cpp create mode 100644 libs/xassets/xsunlightparseparams.h create mode 100644 libs/xassets/xweapondef.cpp create mode 100644 libs/xassets/xweapondef.h diff --git a/libs/xassets/assetmap.h b/libs/xassets/assetmap.h index b01d027..722b353 100644 --- a/libs/xassets/assetmap.h +++ b/libs/xassets/assetmap.h @@ -6,7 +6,7 @@ #include "material.h" #include "materialpixelshader.h" #include "materialtechset.h" -#include "gfximage.h" +#include "xgfximage.h" #include "soundalias.h" #include "soundcurve.h" #include "loadedsound.h" @@ -16,10 +16,10 @@ #include "mapent.h" #include "gfxworld.h" #include "gfxlightdef.h" -#include "gfximage.h" +#include "xgfximage.h" #include "font.h" -#include "menulist.h" -#include "menudef.h" +#include "xmenulist.h" +#include "xmenudef.h" #include "xlocalizeentry.h" #include "weapondef.h" #include "xsounddriverglobals.h" diff --git a/libs/xassets/assets.cpp b/libs/xassets/assets.cpp index eb4d028..4b0695b 100644 --- a/libs/xassets/assets.cpp +++ b/libs/xassets/assets.cpp @@ -243,9 +243,9 @@ QVector Assets::Load_GfxStaticModelInstArray(QDataStream *aS } // ?Load_ItemKeyHandler@@YAX_N@Z at 0x822a5f68 -ItemKeyHandler Assets::Load_ItemKeyHandler(QDataStream *aStream) +XItemKeyHandler Assets::Load_ItemKeyHandler(QDataStream *aStream) { - ItemKeyHandler result; + XItemKeyHandler result; *aStream >> result.key @@ -265,18 +265,18 @@ ItemKeyHandler Assets::Load_ItemKeyHandler(QDataStream *aStream) return result; } -typedef ItemKeyHandler ItemKeyHandlerNext; +typedef XItemKeyHandler ItemKeyHandlerNext; // ?Load_ItemKeyHandlerNext@@YAX_N@Z at 0x822a4aa0 -ItemKeyHandler Assets::Load_ItemKeyHandlerNext(QDataStream *aStream) +XItemKeyHandler Assets::Load_ItemKeyHandlerNext(QDataStream *aStream) { return Load_ItemKeyHandler(aStream); } // ?Load_EditFieldDef@@YAX_N@Z at 0x822a4af0 -EditFieldDef Assets::Load_EditFieldDef(QDataStream *aStream) +XEditFieldDef Assets::Load_EditFieldDef(QDataStream *aStream) { - EditFieldDef result; + XEditFieldDef result; *aStream >> result.minVal @@ -2514,7 +2514,7 @@ XLocalizeEntry Assets::Load_LocalizeEntry(QDataStream *aStream) // ?Load_operandInternalDataUnion@@YAX_N@Z at 0x822a6058 void Assets::Load_operandInternalDataUnion(QDataStream *aStream) { - Operand *varOperand = new Operand; + XOperand *varOperand = new XOperand; QString varXString; if ( varOperand->dataType == VAL_STRING ) { @@ -3572,9 +3572,9 @@ XLocalizeEntry Assets::Load_LocalizeEntryPtr(QDataStream *aStream) } // ?Load_MultiDef@@YAX_N@Z at 0x822a78b8 -MultiDef Assets::Load_MultiDef(QDataStream *aStream) +XMultiDef Assets::Load_MultiDef(QDataStream *aStream) { - MultiDef result; + XMultiDef result; for (int i = 0; i < 32; i++) { *aStream >> result.dvarListPtrs[i]; @@ -3606,9 +3606,9 @@ MultiDef Assets::Load_MultiDef(QDataStream *aStream) // ?Load_Operand@@YAX_N@Z at 0x822a7958 -Operand Assets::Load_Operand(QDataStream *aStream) +XOperand Assets::Load_Operand(QDataStream *aStream) { - Operand result; + XOperand result; *aStream >> result.dataType; @@ -5597,7 +5597,7 @@ void Assets::Load_GfxReflectionProbeArray(QDataStream *aStream, int count) // ?Load_expressionEntry_ptrArray@@YAX_NH@Z at 0x822aa790 void Assets::Load_expressionEntry_ptrArray(QDataStream *aStream, int count) { - expressionEntry **v3; // r28 + XExpressionEntry **v3; // r28 int v4; // r26 unsigned __int8 *v5; // r4 int type; // r10 @@ -5998,7 +5998,7 @@ void Assets::Load_GfxLightDefPtr(QDataStream *aStream) bool v2; // cr58 unsigned __int8 *v3; // r11 const void **inserted; // r30 - GfxLightDef **v5; // r31 + XGfxLightDef **v5; // r31 XAssetHeader *v6; // r5 Load_Stream(0, varGfxLightDefPtr, 4u); @@ -7153,8 +7153,8 @@ void Assets::Load_itemDef_t(QDataStream *aStream) { v2 = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); g_streamPos = v2; - varitemDef_t->onKey = (ItemKeyHandler *)v2; - varItemKeyHandler = (ItemKeyHandler *)v2; + varitemDef_t->onKey = (XItemKeyHandler *)v2; + varItemKeyHandler = (XItemKeyHandler *)v2; Load_ItemKeyHandler(1); v1 = varitemDef_t; } @@ -7976,8 +7976,8 @@ void Assets::Load_menuDef_t(QDataStream *aStream) if ( varmenuDef_t->onKey ) { g_streamPos = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); - varItemKeyHandler = (ItemKeyHandler *)g_streamPos; - varmenuDef_t->onKey = (ItemKeyHandler *)g_streamPos; + varItemKeyHandler = (XItemKeyHandler *)g_streamPos; + varmenuDef_t->onKey = (XItemKeyHandler *)g_streamPos; Load_ItemKeyHandler(1); v1 = varmenuDef_t; } diff --git a/libs/xassets/assets.h b/libs/xassets/assets.h index fcdce02..cbd1f4a 100644 --- a/libs/xassets/assets.h +++ b/libs/xassets/assets.h @@ -1352,16 +1352,16 @@ struct SunLightParseParams float angles[3]; }; -struct __declspec(align(4)) GfxLightImage +struct __declspec(align(4)) XGfxLightImage { GfxImage *image; quint8 samplerState; }; -struct GfxLightDef +struct XGfxLightDef { const char *name; - GfxLightImage attenuation; + XGfxLightImage attenuation; int lmapLookupStart; }; @@ -1378,7 +1378,7 @@ struct GfxLight float cosHalfFovInner; int exponent; uint spotShadowIndex; - GfxLightDef *def; + XGfxLightDef *def; }; struct GfxReflectionProbe @@ -1786,7 +1786,7 @@ struct Font_s Glyph *glyphs; }; -struct rectDef_s +struct XRectDef { float x; float y; @@ -1796,11 +1796,11 @@ struct rectDef_s int vertAlign; }; -struct windowDef_t +struct XWindowDef { const char *name; - rectDef_s rect; - rectDef_s rectClient; + XRectDef rect; + XRectDef rectClient; const char *group; int style; int border; @@ -1817,13 +1817,13 @@ struct windowDef_t Material *background; }; -struct ItemKeyHandler +struct XItemKeyHandler { int key; qint32 actionPtr; QString action; qint32 nextPtr; - ItemKeyHandler *next; + XItemKeyHandler *next; }; enum OperationEnum : qint32 @@ -1912,16 +1912,16 @@ enum OperationEnum : qint32 NUM_OPERATORS = 0x50, }; -enum expDataType : __int32 +enum XExpDataType : __int32 { VAL_INT = 0x0, VAL_FLOAT = 0x1, VAL_STRING = 0x2, }; -struct Operand +struct XOperand { - expDataType dataType; + XExpDataType dataType; int intVal; float floatVal; QString stringVal; @@ -1930,26 +1930,26 @@ struct Operand union entryInternalData { OperationEnum op; - Operand operand; + XOperand operand; }; -struct expressionEntry +struct XExpressionEntry { int type; entryInternalData data; }; -struct statement_s +struct XStatement { int numEntries; - expressionEntry **entries; + XExpressionEntry **entries; }; struct ItemDef; struct menuDef_t { - windowDef_t window; + XWindowDef window; const char *font; int fullScreen; int itemCount; @@ -1963,19 +1963,19 @@ struct menuDef_t const char *onOpen; const char *onClose; const char *onESC; - ItemKeyHandler *onKey; - statement_s visibleExp; + XItemKeyHandler *onKey; + XStatement visibleExp; const char *allowedBinding; const char *soundName; int imageTrack; float focusColor[4]; float disableColor[4]; - statement_s rectXExp; - statement_s rectYExp; + XStatement rectXExp; + XStatement rectYExp; ItemDef **items; }; -struct columnInfo_s +struct XColumnInfo { int pos; int width; @@ -1983,7 +1983,7 @@ struct columnInfo_s int alignment; }; -struct listBoxDef_s +struct XListBoxDef { int startPos[4]; int endPos[4]; @@ -1992,7 +1992,7 @@ struct listBoxDef_s float elementHeight; int elementStyle; int numColumns; - columnInfo_s columnInfo[16]; + XColumnInfo columnInfo[16]; const char *doubleClick; int notselectable; int noScrollBars; @@ -2002,7 +2002,7 @@ struct listBoxDef_s Material *selectIcon; }; -struct EditFieldDef +struct XEditFieldDef { float minVal; float maxVal; @@ -2014,7 +2014,7 @@ struct EditFieldDef int paintOffset; }; -struct MultiDef +struct XMultiDef { QVector dvarListPtrs; QStringList dvarList; @@ -2025,19 +2025,19 @@ struct MultiDef int strDef; }; -union ItemDefData +union XItemDefData { - listBoxDef_s *listBox; - EditFieldDef *editField; - MultiDef *multi; + XListBoxDef *listBox; + XEditFieldDef *editField; + XMultiDef *multi; const char *enumDvarName; void *data; }; struct ItemDef { - windowDef_t window; - rectDef_s textRect[4]; + XWindowDef window; + XRectDef textRect[4]; int type; int dataType; int alignment; @@ -2062,22 +2062,22 @@ struct ItemDef const char *leaveFocus; const char *dvar; const char *dvarTest; - ItemKeyHandler *onKey; + XItemKeyHandler *onKey; const char *enableDvar; int dvarFlags; SoundAliasList *focusSound; float special; int cursorPos[4]; - ItemDefData typeData; + XItemDefData typeData; int imageTrack; - statement_s visibleExp; - statement_s textExp; - statement_s materialExp; - statement_s rectXExp; - statement_s rectYExp; - statement_s rectWExp; - statement_s rectHExp; - statement_s forecolorAExp; + XStatement visibleExp; + XStatement textExp; + XStatement materialExp; + XStatement rectXExp; + XStatement rectYExp; + XStatement rectWExp; + XStatement rectHExp; + XStatement forecolorAExp; }; struct MenuList @@ -2911,7 +2911,7 @@ union XAssetHeader GameWorldMp *gameWorldMp; MapEnts *mapEnts; GfxWorld *gfxWorld; - GfxLightDef *lightDef; + XGfxLightDef *lightDef; Font_s *font; MenuList *menuList; menuDef_t *menu; @@ -2951,9 +2951,9 @@ private: QVector Load_GfxCullGroupArray(QDataStream *aStream, int count); QVector Load_StaticModelIndexArray(QDataStream *aStream, int count); QVector Load_GfxStaticModelInstArray(QDataStream *aStream, int count); - ItemKeyHandler Load_ItemKeyHandler(QDataStream *aStream); - ItemKeyHandler Load_ItemKeyHandlerNext(QDataStream *aStream); - EditFieldDef Load_EditFieldDef(QDataStream *aStream); + XItemKeyHandler Load_ItemKeyHandler(QDataStream *aStream); + XItemKeyHandler Load_ItemKeyHandlerNext(QDataStream *aStream); + XEditFieldDef Load_EditFieldDef(QDataStream *aStream); OperationEnum Load_Operator(QDataStream *aStream); QVector Load_LeafBrushArray(QDataStream *aStream, int count); CLeaf Load_CLeaf(QDataStream *aStream); @@ -3090,8 +3090,8 @@ private: StringTable Load_StringTable(QDataStream *aStream); RawFile Load_RawFilePtr(QDataStream *aStream); void Load_LocalizeEntryPtr(QDataStream *aStream); - MultiDef Load_MultiDef(QDataStream *aStream); - Operand Load_Operand(QDataStream *aStream); + XMultiDef Load_MultiDef(QDataStream *aStream); + XOperand Load_Operand(QDataStream *aStream); QVector Load_ComPrimaryLightArray(QDataStream *aStream, int count); CBrushSide Load_cbrushside_t(QDataStream *aStream); CBrush Load_CBrush(QDataStream *aStream); diff --git a/libs/xassets/d3dresource.cpp b/libs/xassets/d3dresource.cpp deleted file mode 100644 index b72c75b..0000000 --- a/libs/xassets/d3dresource.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "d3dresource.h" diff --git a/libs/xassets/d3dresource.h b/libs/xassets/d3dresource.h deleted file mode 100644 index 3a9a680..0000000 --- a/libs/xassets/d3dresource.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef D3DRESOURCE_H -#define D3DRESOURCE_H - -struct D3DResource -{ - unsigned int Common; - unsigned int ReferenceCount; - unsigned int Fence; - unsigned int ReadFence; - unsigned int Identifier; - unsigned int BaseFlush; -}; - - -#endif // D3DRESOURCE_H diff --git a/libs/xassets/font.h b/libs/xassets/font.h index 6af2f48..8dd5ec5 100644 --- a/libs/xassets/font.h +++ b/libs/xassets/font.h @@ -1,7 +1,7 @@ #ifndef FONT_H #define FONT_H -#include "material.h" +#include "xmaterial.h" struct Glyph { @@ -22,9 +22,9 @@ struct GameFont const char *fontName; int pixelHeight; int glyphCount; - Material *material; - Material *glowMaterial; - Glyph *glyphs; + XMaterial *material; + XMaterial *glowMaterial; + XGlyph *glyphs; }; #endif // FONT_H diff --git a/libs/xassets/gameworld.cpp b/libs/xassets/gameworld.cpp deleted file mode 100644 index cbd9fc9..0000000 --- a/libs/xassets/gameworld.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "gameworld.h" diff --git a/libs/xassets/gameworld.h b/libs/xassets/gameworld.h deleted file mode 100644 index 18df25a..0000000 --- a/libs/xassets/gameworld.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef GAMEWORLD_H -#define GAMEWORLD_H - -enum nodeType : __int32 -{ - NODE_BADNODE = 0x0, - NODE_PATHNODE = 0x1, - NODE_COVER_STAND = 0x2, - NODE_COVER_CROUCH = 0x3, - NODE_COVER_CROUCH_WINDOW = 0x4, - NODE_COVER_PRONE = 0x5, - NODE_COVER_RIGHT = 0x6, - NODE_COVER_LEFT = 0x7, - NODE_COVER_WIDE_RIGHT = 0x8, - NODE_COVER_WIDE_LEFT = 0x9, - NODE_CONCEALMENT_STAND = 0xA, - NODE_CONCEALMENT_CROUCH = 0xB, - NODE_CONCEALMENT_PRONE = 0xC, - NODE_REACQUIRE = 0xD, - NODE_BALCONY = 0xE, - NODE_SCRIPTED = 0xF, - NODE_NEGOTIATION_BEGIN = 0x10, - NODE_NEGOTIATION_END = 0x11, - NODE_TURRET = 0x12, - NODE_GUARD = 0x13, - NODE_NUMTYPES = 0x14, - NODE_DONTLINK = 0x14, -}; - -struct PathLink -{ - float fDist; - unsigned __int16 nodeNum; - unsigned __int8 disconnectCount; - unsigned __int8 negotiationLink; - unsigned __int8 ubBadPlaceCount[4]; -}; - -struct PathNodeConstant -{ - nodeType type; - unsigned __int16 spawnflags; - unsigned __int16 targetname; - unsigned __int16 script_linkName; - unsigned __int16 script_noteworthy; - unsigned __int16 target; - unsigned __int16 animscript; - int animscriptfunc; - float vOrigin[3]; - float fAngle; - float forward[2]; - float fRadius; - float minUseDistSq; - __int16 wOverlapNode[2]; - __int16 wChainId; - __int16 wChainDepth; - __int16 wChainParent; - unsigned __int16 totalLinkCount; - PathLink *Links; -}; - -struct pathnode_dynamic_t -{ - void *pOwner; - int iFreeTime; - int iValidTime[3]; - int inPlayerLOSTime; - __int16 wLinkCount; - __int16 wOverlapCount; - __int16 turretEntNumber; - __int16 userCount; -}; - -struct pathnode_t; -struct pathnode_transient_t -{ - int iSearchFrame; - pathnode_t *pNextOpen; - pathnode_t *pPrevOpen; - pathnode_t *pParent; - float fCost; - float fHeuristic; - float costFactor; -}; - -struct pathnode_t -{ - PathNodeConstant constant; - pathnode_dynamic_t dynamic; - pathnode_transient_t transient; -}; - -struct PathBaseNode -{ - float vOrigin[3]; - unsigned int type; -}; - -struct PathNodeTreeNodes -{ - int nodeCount; - unsigned __int16 *nodes; -}; - -struct PathNodeTree; -union PathNodeTreeInfo -{ - PathNodeTree *child[2]; - PathNodeTreeNodes s; -}; - -struct PathNodeTree -{ - int axis; - float dist; - PathNodeTreeInfo u; -}; - -struct PathData -{ - unsigned int nodeCount; - pathnode_t *nodes; - PathBaseNode *basenodes; - unsigned int chainNodeCount; - unsigned __int16 *chainNodeForNode; - unsigned __int16 *nodeForChainNode; - int visBytes; - unsigned __int8 *pathVis; - int nodeTreeCount; - PathNodeTree *nodeTree; -}; - -struct GameWorldSp -{ - const char *name; - PathData path; -}; - -struct GameWorldMp -{ - const char *name; -}; - -#endif // GAMEWORLD_H diff --git a/libs/xassets/gfximage.cpp b/libs/xassets/gfximage.cpp deleted file mode 100644 index 039dfda..0000000 --- a/libs/xassets/gfximage.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "gfximage.h" diff --git a/libs/xassets/gfximage.h b/libs/xassets/gfximage.h deleted file mode 100644 index 38b2e0e..0000000 --- a/libs/xassets/gfximage.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef GFXIMAGE_H -#define GFXIMAGE_H - -#include "material.h" - -struct GfxImageLoadDef; -struct GfxTexture -{ - qint32 baseMapPtr; - D3DBaseTexture *baseMap; - - qint32 mapPtr; - D3DTexture *map; - - qint32 volMapPtr; - D3DVolumeTexture *volMap; - - qint32 cubeMapPtr; - D3DCubeTexture *cubeMap; - - qint32 loadDefPtr; - GfxImageLoadDef *loadDef; -}; - -struct GfxImageLoadDef -{ - quint8 levelCount; - quint8 flags; - quint16 dimensions[3]; - int format; - GfxTexture texture; -}; - -struct CardMemory -{ - int platform[1]; -}; - -struct GfxImage -{ - MapType mapType; - GfxTexture texture; - quint8 semantic; - CardMemory cardMemory; - quint16 width; - quint16 height; - quint16 depth; - quint8 category; - bool delayLoadPixels; - - qint32 pixelsPtr; - quint8 *pixels; - - unsigned int baseSize; - quint16 streamSlot; - bool streaming; - - qint32 namePtr; - QString name; -}; - -#endif // GFXIMAGE_H diff --git a/libs/xassets/gfxlightdef.cpp b/libs/xassets/gfxlightdef.cpp deleted file mode 100644 index 2cb1fef..0000000 --- a/libs/xassets/gfxlightdef.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "gfxlightdef.h" diff --git a/libs/xassets/gfxlightdef.h b/libs/xassets/gfxlightdef.h deleted file mode 100644 index 1790e60..0000000 --- a/libs/xassets/gfxlightdef.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef GFXLIGHTDEF_H -#define GFXLIGHTDEF_H -#include "gfximage.h" - -struct GfxLightImage -{ - GfxImage *image; - unsigned __int8 samplerState; -}; - -struct GfxLightDef -{ - const char *name; - GfxLightImage attenuation; - int lmapLookupStart; -}; - -#endif // GFXLIGHTDEF_H diff --git a/libs/xassets/gfxworld.h b/libs/xassets/gfxworld.h index ec94fa3..fb27131 100644 --- a/libs/xassets/gfxworld.h +++ b/libs/xassets/gfxworld.h @@ -1,7 +1,7 @@ #ifndef GFXWORLD_H #define GFXWORLD_H -#include "gfximage.h" +#include "xgfximage.h" #include "gfxlightdef.h" #include "xmodel.h" @@ -72,7 +72,7 @@ struct GfxLight float cosHalfFovInner; int exponent; unsigned int spotShadowIndex; - GfxLightDef *def; + XGfxLightDef *def; }; struct GfxReflectionProbe diff --git a/libs/xassets/loadedsound.cpp b/libs/xassets/loadedsound.cpp deleted file mode 100644 index 570a871..0000000 --- a/libs/xassets/loadedsound.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "loadedsound.h" diff --git a/libs/xassets/loadedsound.h b/libs/xassets/loadedsound.h deleted file mode 100644 index a1425a7..0000000 --- a/libs/xassets/loadedsound.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef LOADEDSOUND_H -#define LOADEDSOUND_H - -struct XMALOOPREGION -{ - unsigned int LoopStart; - unsigned int LoopEnd; - unsigned __int8 LoopSubframeEnd; - unsigned __int8 LoopSubframeSkip; -}; - -struct XAUDIOPACKET_ALIGNED -{ - char *pBuffer; - unsigned int BufferSize; - unsigned int LoopCount; - XMALOOPREGION XMALoop[6]; - char *pContext; -}; - -union $A914CD29B804E77ACE08D070A31DB5AB -{ - unsigned __int8 NumStreams; - unsigned __int8 ChannelCount; -}; - -struct XAUDIOXMAFORMAT -{ - unsigned int SampleRate; - unsigned __int8 ChannelCount; - unsigned __int8 DecodeBufferSize; -}; - -union $9C5A25260C9CC66355FE8A35CC8403E0 -{ - XAUDIOXMAFORMAT Stream[6]; - unsigned int SampleRate; -}; - -struct XAUDIOSOURCEFORMAT -{ - unsigned __int8 SampleType; - $A914CD29B804E77ACE08D070A31DB5AB ___u1; - $9C5A25260C9CC66355FE8A35CC8403E0 ___u2; -}; - -struct XaIwXmaDataInfo -{ - int totalMsec; -}; - -struct XaSeekTable -{ - int size; - unsigned int *data; -}; - -struct XaSound -{ - XAUDIOPACKET_ALIGNED packet; - XAUDIOSOURCEFORMAT format; - XaIwXmaDataInfo xaIwXmaDataInfo; - XaSeekTable seekTable; -}; - -struct LoadedSound -{ - const char *name; - XaSound sound; -}; - -#endif // LOADEDSOUND_H diff --git a/libs/xassets/materialpixelshader.h b/libs/xassets/materialpixelshader.h index 57850f6..82b9155 100644 --- a/libs/xassets/materialpixelshader.h +++ b/libs/xassets/materialpixelshader.h @@ -1,7 +1,7 @@ #ifndef MATERIAL_PIXERHSHADER_H #define MATERIAL_PIXERHSHADER_H -#include "d3dresource.h" +#include "xd3dresource.h" #include #include diff --git a/libs/xassets/materialtechset.h b/libs/xassets/materialtechset.h index 7aeeb9a..6da64c7 100644 --- a/libs/xassets/materialtechset.h +++ b/libs/xassets/materialtechset.h @@ -1,7 +1,7 @@ #ifndef MATERIALTECHSET_H #define MATERIALTECHSET_H -#include "d3dresource.h" +#include "xd3dresource.h" #include "materialpixelshader.h" #include "QString" diff --git a/libs/xassets/menudef.cpp b/libs/xassets/menudef.cpp deleted file mode 100644 index a635aec..0000000 --- a/libs/xassets/menudef.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "menudef.h" diff --git a/libs/xassets/menulist.cpp b/libs/xassets/menulist.cpp deleted file mode 100644 index e1ae87a..0000000 --- a/libs/xassets/menulist.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "menulist.h" diff --git a/libs/xassets/menulist.h b/libs/xassets/menulist.h deleted file mode 100644 index 17f841e..0000000 --- a/libs/xassets/menulist.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MENULIST_H -#define MENULIST_H - -#include "menudef.h" - -struct MenuList -{ - const char *name; - int menuCount; - MenuDef **menus; -}; - -#endif // MENULIST_H diff --git a/libs/xassets/xanimdeltapart.cpp b/libs/xassets/xanimdeltapart.cpp new file mode 100644 index 0000000..1590305 --- /dev/null +++ b/libs/xassets/xanimdeltapart.cpp @@ -0,0 +1,58 @@ + + + + + + +#include "xanimdeltapart.h" + +XAnimDeltaPart::XAnimDeltaPart() + : XAsset() { +} + +void XAnimDeltaPart::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mTransPtr, sizeof(quint32)); + mTrans.ParseData(aStream); + + aStream->read((char*)&mQuatPtr, sizeof(quint32)); + mQuat.ParseData(aStream); + } +} + +quint32 XAnimDeltaPart::GetTransPtr() const { + return mTransPtr; +} + +void XAnimDeltaPart::SetTransPtr(quint32 ptr) { + mTransPtr = ptr; +} + +const XAnimPartTrans& XAnimDeltaPart::GetTrans() const { + return mTrans; +} + +void XAnimDeltaPart::SetTrans(const XAnimPartTrans& trans) { + mTrans = trans; +} + +quint32 XAnimDeltaPart::GetQuatPtr() const { + return mQuatPtr; +} + +void XAnimDeltaPart::SetQuatPtr(quint32 ptr) { + mQuatPtr = ptr; +} + +const XAnimDeltaPartQuat& XAnimDeltaPart::GetQuat() const { + return mQuat; +} + +void XAnimDeltaPart::SetQuat(const XAnimDeltaPartQuat& quat) { + mQuat = quat; +} + + + + + diff --git a/libs/xassets/xanimdeltapart.h b/libs/xassets/xanimdeltapart.h new file mode 100644 index 0000000..d351c84 --- /dev/null +++ b/libs/xassets/xanimdeltapart.h @@ -0,0 +1,46 @@ + + + + + + +#ifndef XANIMDELTAPART_H +#define XANIMDELTAPART_H + +#include "xasset.h" +#include "xanimparttrans.h" +#include "xanimdeltapartquat.h" + +class XAnimDeltaPart : public XAsset +{ +public: + explicit XAnimDeltaPart(); + + void ParseData(QDataStream *aStream) override; + + quint32 GetTransPtr() const; + void SetTransPtr(quint32 ptr); + + const XAnimPartTrans& GetTrans() const; + void SetTrans(const XAnimPartTrans& trans); + + quint32 GetQuatPtr() const; + void SetQuatPtr(quint32 ptr); + + const XAnimDeltaPartQuat& GetQuat() const; + void SetQuat(const XAnimDeltaPartQuat& quat); + +private: + quint32 mTransPtr = 0; + XAnimPartTrans mTrans; + + quint32 mQuatPtr = 0; + XAnimDeltaPartQuat mQuat; +}; + +#endif // XANIMDELTAPART_H + + + + + diff --git a/libs/xassets/xanimdeltapartquat.cpp b/libs/xassets/xanimdeltapartquat.cpp new file mode 100644 index 0000000..20f67c9 --- /dev/null +++ b/libs/xassets/xanimdeltapartquat.cpp @@ -0,0 +1,39 @@ + + + + + +#include "xanimdeltapartquat.h" + +XAnimDeltaPartQuat::XAnimDeltaPartQuat() + : XAsset() { +} + +void XAnimDeltaPartQuat::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mSize, sizeof(quint16)); + + // Parse data + mData.ParseData(aStream); + } +} + +quint16 XAnimDeltaPartQuat::GetSize() const { + return mSize; +} + +void XAnimDeltaPartQuat::SetSize(quint16 size) { + mSize = size; +} + +const XAnimDeltaPartQuatData& XAnimDeltaPartQuat::GetData() const { + return mData; +} + +void XAnimDeltaPartQuat::SetData(const XAnimDeltaPartQuatData& data) { + mData = data; +} + + + + diff --git a/libs/xassets/xanimdeltapartquat.h b/libs/xassets/xanimdeltapartquat.h new file mode 100644 index 0000000..7d981a5 --- /dev/null +++ b/libs/xassets/xanimdeltapartquat.h @@ -0,0 +1,36 @@ + + + + + + +#ifndef XANIMDELTAPARTQUAT_H +#define XANIMDELTAPARTQUAT_H + +#include "xasset.h" +#include "xanimdeltapartquatdata.h" + +class XAnimDeltaPartQuat : public XAsset +{ +public: + explicit XAnimDeltaPartQuat(); + + void ParseData(QDataStream *aStream) override; + + quint16 GetSize() const; + void SetSize(quint16 size); + + const XAnimDeltaPartQuatData& GetData() const; + void SetData(const XAnimDeltaPartQuatData& data); + +private: + quint16 mSize = 0; + XAnimDeltaPartQuatData mData; +}; + +#endif // XANIMDELTAPARTQUAT_H + + + + + diff --git a/libs/xassets/xanimdeltapartquatdata.cpp b/libs/xassets/xanimdeltapartquatdata.cpp new file mode 100644 index 0000000..66b137f --- /dev/null +++ b/libs/xassets/xanimdeltapartquatdata.cpp @@ -0,0 +1,43 @@ + + + + + + +#include "xanimdeltapartquatdata.h" + +XAnimDeltaPartQuatData::XAnimDeltaPartQuatData() + : XAsset() { +} + +void XAnimDeltaPartQuatData::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // Parse frames + mFrames.ParseData(aStream); + + // Parse frame0 + aStream->read((char*)mFrame0, 2 * sizeof(qint16)); + } +} + +const XAnimDeltaPartQuatDataFrames& XAnimDeltaPartQuatData::GetFrames() const { + return mFrames; +} + +void XAnimDeltaPartQuatData::SetFrames(const XAnimDeltaPartQuatDataFrames& frames) { + mFrames = frames; +} + +const qint16* XAnimDeltaPartQuatData::GetFrame0() const { + return mFrame0; +} + +void XAnimDeltaPartQuatData::SetFrame0(const qint16* frame0, size_t count) { + if (count <= 2) { + memcpy(mFrame0, frame0, count * sizeof(qint16)); + } +} + + + + diff --git a/libs/xassets/xanimdeltapartquatdata.h b/libs/xassets/xanimdeltapartquatdata.h new file mode 100644 index 0000000..fad0f82 --- /dev/null +++ b/libs/xassets/xanimdeltapartquatdata.h @@ -0,0 +1,36 @@ + + + + + + +#ifndef XANIMDELTAPARTQUATDATA_H +#define XANIMDELTAPARTQUATDATA_H + +#include "xasset.h" +#include "xanimdeltapartquatdataframes.h" + +class XAnimDeltaPartQuatData : public XAsset +{ +public: + explicit XAnimDeltaPartQuatData(); + + void ParseData(QDataStream *aStream) override; + + const XAnimDeltaPartQuatDataFrames& GetFrames() const; + void SetFrames(const XAnimDeltaPartQuatDataFrames& frames); + + const qint16* GetFrame0() const; + void SetFrame0(const qint16* frame0, size_t count = 2); + +private: + XAnimDeltaPartQuatDataFrames mFrames; + qint16 mFrame0[2] = {0}; +}; + +#endif // XANIMDELTAPARTQUATDATA_H + + + + + diff --git a/libs/xassets/xanimdeltapartquatdataframes.cpp b/libs/xassets/xanimdeltapartquatdataframes.cpp new file mode 100644 index 0000000..069d85d --- /dev/null +++ b/libs/xassets/xanimdeltapartquatdataframes.cpp @@ -0,0 +1,55 @@ + + + + + + +#include "xanimdeltapartquatdataframes.h" + +XAnimDeltaPartQuatDataFrames::XAnimDeltaPartQuatDataFrames() + : XAsset() { +} + +void XAnimDeltaPartQuatDataFrames::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mFramesPtr, sizeof(quint32)); + aStream->read((char*)mFrames, 2 * sizeof(qint16)); + + // Parse indices + mIndices.ParseData(aStream); + } +} + +quint32 XAnimDeltaPartQuatDataFrames::GetFramesPtr() const { + return mFramesPtr; +} + +void XAnimDeltaPartQuatDataFrames::SetFramesPtr(quint32 ptr) { + mFramesPtr = ptr; +} + +const qint16* XAnimDeltaPartQuatDataFrames::GetFrames() const { + return mFrames; +} + +void XAnimDeltaPartQuatDataFrames::SetFrames(const qint16* frames, size_t count) { + if (count <= 2) { + memcpy(mFrames, frames, count * sizeof(qint16)); + } +} + +XAnimDynamicIndices& XAnimDeltaPartQuatDataFrames::GetIndices() { + return mIndices; +} + +const XAnimDynamicIndices& XAnimDeltaPartQuatDataFrames::GetIndices() const { + return mIndices; +} + +void XAnimDeltaPartQuatDataFrames::SetIndices(const XAnimDynamicIndices& indices) { + mIndices = indices; +} + + + + diff --git a/libs/xassets/xanimdeltapartquatdataframes.h b/libs/xassets/xanimdeltapartquatdataframes.h new file mode 100644 index 0000000..1922fe1 --- /dev/null +++ b/libs/xassets/xanimdeltapartquatdataframes.h @@ -0,0 +1,41 @@ + + + + + + +#ifndef XANIMDELTAPARTQUATDATAFRAMES_H +#define XANIMDELTAPARTQUATDATAFRAMES_H + +#include "xasset.h" +#include "xanimdynamicindices.h" + +class XAnimDeltaPartQuatDataFrames : public XAsset +{ +public: + explicit XAnimDeltaPartQuatDataFrames(); + + void ParseData(QDataStream *aStream) override; + + quint32 GetFramesPtr() const; + void SetFramesPtr(quint32 ptr); + + const qint16* GetFrames() const; + void SetFrames(const qint16* frames, size_t count = 2); + + XAnimDynamicIndices& GetIndices(); + const XAnimDynamicIndices& GetIndices() const; + void SetIndices(const XAnimDynamicIndices& indices); + +private: + quint32 mFramesPtr = 0; + qint16 mFrames[2] = {0}; + XAnimDynamicIndices mIndices; +}; + +#endif // XANIMDELTAPARTQUATDATAFRAMES_H + + + + + diff --git a/libs/xassets/xanimdynamicframes.cpp b/libs/xassets/xanimdynamicframes.cpp new file mode 100644 index 0000000..c269297 --- /dev/null +++ b/libs/xassets/xanimdynamicframes.cpp @@ -0,0 +1,33 @@ + + +#include "xanimdynamicframes.h" + +XAnimDynamicFrames::XAnimDynamicFrames() + : XAsset() { +} + +void XAnimDynamicFrames::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mFramesPtr, sizeof(quint32)); + aStream->read((char*)mFrames, 3 * sizeof(quint8)); + } +} + +quint32 XAnimDynamicFrames::GetFramesPtr() const { + return mFramesPtr; +} + +void XAnimDynamicFrames::SetFramesPtr(quint32 ptr) { + mFramesPtr = ptr; +} + +const quint8* XAnimDynamicFrames::GetFrames() const { + return mFrames; +} + +void XAnimDynamicFrames::SetFrames(const quint8* frames, size_t count) { + if (count <= 3) { + memcpy(mFrames, frames, count * sizeof(quint8)); + } +} + diff --git a/libs/xassets/xanimdynamicframes.h b/libs/xassets/xanimdynamicframes.h new file mode 100644 index 0000000..d132cc9 --- /dev/null +++ b/libs/xassets/xanimdynamicframes.h @@ -0,0 +1,27 @@ + + +#ifndef XANIMDYNAMICFRAMES_H +#define XANIMDYNAMICFRAMES_H + +#include "xasset.h" + +class XAnimDynamicFrames : public XAsset +{ +public: + explicit XAnimDynamicFrames(); + + void ParseData(QDataStream *aStream) override; + + quint32 GetFramesPtr() const; + void SetFramesPtr(quint32 ptr); + + const quint8* GetFrames() const; + void SetFrames(const quint8* frames, size_t count = 3); + +private: + quint32 mFramesPtr = 0; + quint8 mFrames[3] = {0}; +}; + +#endif // XANIMDYNAMICFRAMES_H + diff --git a/libs/xassets/xanimdynamicindices.cpp b/libs/xassets/xanimdynamicindices.cpp new file mode 100644 index 0000000..de56d82 --- /dev/null +++ b/libs/xassets/xanimdynamicindices.cpp @@ -0,0 +1,28 @@ + + + + +#include "xanimdynamicindices.h" + +XAnimDynamicIndices::XAnimDynamicIndices() + : XAsset() { +} + +void XAnimDynamicIndices::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mIndices, sizeof(quint8)); + } +} + +const quint8* XAnimDynamicIndices::GetIndices() const { + return mIndices; +} + +void XAnimDynamicIndices::SetIndices(const quint8* indices, size_t count) { + if (count <= 1) { + memcpy(mIndices, indices, count * sizeof(quint8)); + } +} + + + diff --git a/libs/xassets/xanimdynamicindices.h b/libs/xassets/xanimdynamicindices.h new file mode 100644 index 0000000..9b87d2f --- /dev/null +++ b/libs/xassets/xanimdynamicindices.h @@ -0,0 +1,25 @@ + + + +#ifndef XANIMDYNAMICINDICES_H +#define XANIMDYNAMICINDICES_H + +#include "xasset.h" + +class XAnimDynamicIndices : public XAsset +{ +public: + explicit XAnimDynamicIndices(); + + void ParseData(QDataStream *aStream) override; + + const quint8* GetIndices() const; + void SetIndices(const quint8* indices, size_t count = 1); + +private: + quint8 mIndices[1] = {0}; +}; + +#endif // XANIMDYNAMICINDICES_H + + diff --git a/libs/xassets/xanimindices.cpp b/libs/xassets/xanimindices.cpp new file mode 100644 index 0000000..4b44863 --- /dev/null +++ b/libs/xassets/xanimindices.cpp @@ -0,0 +1,38 @@ + + + + + + +#include "xanimindices.h" + +XAnimIndices::XAnimIndices() + : XAsset() { +} + +void XAnimIndices::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mIndexPtr, sizeof(quint32)); + aStream->read((char*)&mIndex, sizeof(quint16)); + } +} + +quint32 XAnimIndices::GetIndexPtr() const { + return mIndexPtr; +} + +void XAnimIndices::SetIndexPtr(quint32 ptr) { + mIndexPtr = ptr; +} + +quint16 XAnimIndices::GetIndex() const { + return mIndex; +} + +void XAnimIndices::SetIndex(quint16 index) { + mIndex = index; +} + + + + diff --git a/libs/xassets/xanimindices.h b/libs/xassets/xanimindices.h new file mode 100644 index 0000000..fd8a1a0 --- /dev/null +++ b/libs/xassets/xanimindices.h @@ -0,0 +1,37 @@ + + + + + + + +#ifndef XANIMINDICES_H +#define XANIMINDICES_H + +#include "xasset.h" + +class XAnimIndices : public XAsset +{ +public: + explicit XAnimIndices(); + + void ParseData(QDataStream *aStream) override; + + quint32 GetIndexPtr() const; + void SetIndexPtr(quint32 ptr); + + quint16 GetIndex() const; + void SetIndex(quint16 index); + +private: + quint32 mIndexPtr = 0; + quint16 mIndex = 0; +}; + +#endif // XANIMINDICES_H + + + + + + diff --git a/libs/xassets/xanimnotifyinfo.cpp b/libs/xassets/xanimnotifyinfo.cpp new file mode 100644 index 0000000..6acf60b --- /dev/null +++ b/libs/xassets/xanimnotifyinfo.cpp @@ -0,0 +1,38 @@ + + + + + + +#include "xanimnotifyinfo.h" + +XAnimNotifyInfo::XAnimNotifyInfo() + : XAsset() { +} + +void XAnimNotifyInfo::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mName, sizeof(quint16)); + aStream->read((char*)&mTime, sizeof(float)); + } +} + +quint16 XAnimNotifyInfo::GetName() const { + return mName; +} + +void XAnimNotifyInfo::SetName(quint16 name) { + mName = name; +} + +float XAnimNotifyInfo::GetTime() const { + return mTime; +} + +void XAnimNotifyInfo::SetTime(float time) { + mTime = time; +} + + + + diff --git a/libs/xassets/xanimnotifyinfo.h b/libs/xassets/xanimnotifyinfo.h new file mode 100644 index 0000000..e243cf7 --- /dev/null +++ b/libs/xassets/xanimnotifyinfo.h @@ -0,0 +1,35 @@ + + + + + + +#ifndef XANIMNOTIFYINFO_H +#define XANIMNOTIFYINFO_H + +#include "xasset.h" + +class XAnimNotifyInfo : public XAsset +{ +public: + explicit XAnimNotifyInfo(); + + void ParseData(QDataStream *aStream) override; + + quint16 GetName() const; + void SetName(quint16 name); + + float GetTime() const; + void SetTime(float time); + +private: + quint16 mName = 0; + float mTime = 0.0f; +}; + +#endif // XANIMNOTIFYINFO_H + + + + + diff --git a/libs/xassets/xanimparts.cpp b/libs/xassets/xanimparts.cpp new file mode 100644 index 0000000..38bf28c --- /dev/null +++ b/libs/xassets/xanimparts.cpp @@ -0,0 +1,382 @@ + + +#include "xanimparts.h" + +XAnimParts::XAnimParts() + : XAsset() { +} + +void XAnimParts::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // Parse all fields + aStream->read((char*)&mNamePtr, sizeof(quint32)); + mName = ""; // We'll need to resolve this pointer later + + aStream->read((char*)&mDataByteCount, sizeof(quint16)); + aStream->read((char*)&mDataShortCount, sizeof(quint16)); + aStream->read((char*)&mDataIntCount, sizeof(quint16)); + aStream->read((char*)&mRandomDataByteCount, sizeof(quint16)); + aStream->read((char*)&mRandomDataIntCount, sizeof(quint16)); + aStream->read((char*)&mNumFrames, sizeof(quint16)); + + quint8 loopDelta; + aStream->read((char*)&loopDelta, sizeof(quint8)); + mIsLoop = (loopDelta & 0x1) != 0; + mIsDelta = (loopDelta & 0x2) != 0; + + aStream->read((char*)mBoneCount, sizeof(mBoneCount)); + aStream->read((char*)&mNotifyCount, sizeof(quint8)); + aStream->read((char*)&mAssetType, sizeof(quint8)); + + quint8 pad; + aStream->read((char*)&pad, sizeof(quint8)); + mPad = (pad != 0); + + aStream->read((char*)&mRandomDataShortCount, sizeof(quint16)); + aStream->read((char*)&mIndexCount, sizeof(quint16)); + + aStream->read((char*)&mFramerate, sizeof(float)); + aStream->read((char*)&mFrequency, sizeof(float)); + + aStream->read((char*)&mNamesPtr, sizeof(quint32)); + aStream->read((char*)&mNames, sizeof(quint16)); + + aStream->read((char*)&mDataBytePtr, sizeof(quint32)); + aStream->read((char*)&mDataByte, sizeof(quint8)); + + aStream->read((char*)&mDataShortPtr, sizeof(quint32)); + aStream->read((char*)&mDataShort, sizeof(qint16)); + + aStream->read((char*)&mDataIntPtr, sizeof(quint32)); + aStream->read((char*)&mDataInt, sizeof(int)); + + aStream->read((char*)&mRandomDataShortPtr, sizeof(quint32)); + aStream->read((char*)&mRandomDataShort, sizeof(qint16)); + + aStream->read((char*)&mRandomDataBytePtr, sizeof(quint32)); + aStream->read((char*)&mRandomDataByte, sizeof(quint8)); + + aStream->read((char*)&mRandomDataIntPtr, sizeof(quint32)); + aStream->read((char*)&mRandomDataInt, sizeof(int)); + + // Parse indices + mIndices.ParseData(aStream); + + aStream->read((char*)&mNotifyPtr, sizeof(qint32)); + mNotify.ParseData(aStream); + + aStream->read((char*)&mDeltaPartPtr, sizeof(qint32)); + mDeltaPart.ParseData(aStream); + } +} + +const QString& XAnimParts::GetName() const { + return mName; +} + +void XAnimParts::SetName(const QString& name) { + mName = name; +} + +quint32 XAnimParts::GetNamePtr() const { + return mNamePtr; +} + +void XAnimParts::SetNamePtr(quint32 ptr) { + mNamePtr = ptr; +} + +quint16 XAnimParts::GetDataByteCount() const { + return mDataByteCount; +} + +void XAnimParts::SetDataByteCount(quint16 count) { + mDataByteCount = count; +} + +quint16 XAnimParts::GetDataShortCount() const { + return mDataShortCount; +} + +void XAnimParts::SetDataShortCount(quint16 count) { + mDataShortCount = count; +} + +quint16 XAnimParts::GetDataIntCount() const { + return mDataIntCount; +} + +void XAnimParts::SetDataIntCount(quint16 count) { + mDataIntCount = count; +} + +quint16 XAnimParts::GetRandomDataByteCount() const { + return mRandomDataByteCount; +} + +void XAnimParts::SetRandomDataByteCount(quint16 count) { + mRandomDataByteCount = count; +} + +quint16 XAnimParts::GetRandomDataIntCount() const { + return mRandomDataIntCount; +} + +void XAnimParts::SetRandomDataIntCount(quint16 count) { + mRandomDataIntCount = count; +} + +quint16 XAnimParts::GetNumFrames() const { + return mNumFrames; +} + +void XAnimParts::SetNumFrames(quint16 frames) { + mNumFrames = frames; +} + +bool XAnimParts::IsLoop() const { + return mIsLoop; +} + +void XAnimParts::SetIsLoop(bool loop) { + mIsLoop = loop; +} + +bool XAnimParts::IsDelta() const { + return mIsDelta; +} + +void XAnimParts::SetIsDelta(bool delta) { + mIsDelta = delta; +} + +const quint8* XAnimParts::GetBoneCount() const { + return mBoneCount; +} + +void XAnimParts::SetBoneCount(const quint8* count, size_t boneCount) { + if (boneCount <= 12) { + memcpy(mBoneCount, count, boneCount * sizeof(quint8)); + } +} + +quint8 XAnimParts::GetNotifyCount() const { + return mNotifyCount; +} + +void XAnimParts::SetNotifyCount(quint8 count) { + mNotifyCount = count; +} + +quint8 XAnimParts::GetAssetType() const { + return mAssetType; +} + +void XAnimParts::SetAssetType(quint8 type) { + mAssetType = type; +} + +bool XAnimParts::IsPad() const { + return mPad; +} + +void XAnimParts::SetIsPad(bool pad) { + mPad = pad; +} + +quint16 XAnimParts::GetRandomDataShortCount() const { + return mRandomDataShortCount; +} + +void XAnimParts::SetRandomDataShortCount(quint16 count) { + mRandomDataShortCount = count; +} + +quint16 XAnimParts::GetIndexCount() const { + return mIndexCount; +} + +void XAnimParts::SetIndexCount(quint16 count) { + mIndexCount = count; +} + +float XAnimParts::GetFramerate() const { + return mFramerate; +} + +void XAnimParts::SetFramerate(float rate) { + mFramerate = rate; +} + +float XAnimParts::GetFrequency() const { + return mFrequency; +} + +void XAnimParts::SetFrequency(float frequency) { + mFrequency = frequency; +} + +quint32 XAnimParts::GetNamesPtr() const { + return mNamesPtr; +} + +void XAnimParts::SetNamesPtr(quint32 ptr) { + mNamesPtr = ptr; +} + +quint16 XAnimParts::GetNames() const { + return mNames; +} + +void XAnimParts::SetNames(quint16 names) { + mNames = names; +} + +quint32 XAnimParts::GetDataBytePtr() const { + return mDataBytePtr; +} + +void XAnimParts::SetDataBytePtr(quint32 ptr) { + mDataBytePtr = ptr; +} + +quint8 XAnimParts::GetDataByte() const { + return mDataByte; +} + +void XAnimParts::SetDataByte(quint8 byte) { + mDataByte = byte; +} + +quint32 XAnimParts::GetDataShortPtr() const { + return mDataShortPtr; +} + +void XAnimParts::SetDataShortPtr(quint32 ptr) { + mDataShortPtr = ptr; +} + +qint16 XAnimParts::GetDataShort() const { + return mDataShort; +} + +void XAnimParts::SetDataShort(qint16 shortValue) { + mDataShort = shortValue; +} + +quint32 XAnimParts::GetDataIntPtr() const { + return mDataIntPtr; +} + +void XAnimParts::SetDataIntPtr(quint32 ptr) { + mDataIntPtr = ptr; +} + +int XAnimParts::GetDataInt() const { + return mDataInt; +} + +void XAnimParts::SetDataInt(int value) { + mDataInt = value; +} + +quint32 XAnimParts::GetRandomDataShortPtr() const { + return mRandomDataShortPtr; +} + +void XAnimParts::SetRandomDataShortPtr(quint32 ptr) { + mRandomDataShortPtr = ptr; +} + +qint16 XAnimParts::GetRandomDataShort() const { + return mRandomDataShort; +} + +void XAnimParts::SetRandomDataShort(qint16 shortValue) { + mRandomDataShort = shortValue; +} + +quint32 XAnimParts::GetRandomDataBytePtr() const { + return mRandomDataBytePtr; +} + +void XAnimParts::SetRandomDataBytePtr(quint32 ptr) { + mRandomDataBytePtr = ptr; +} + +quint8 XAnimParts::GetRandomDataByte() const { + return mRandomDataByte; +} + +void XAnimParts::SetRandomDataByte(quint8 byte) { + mRandomDataByte = byte; +} + +quint32 XAnimParts::GetRandomDataIntPtr() const { + return mRandomDataIntPtr; +} + +void XAnimParts::SetRandomDataIntPtr(quint32 ptr) { + mRandomDataIntPtr = ptr; +} + +int XAnimParts::GetRandomDataInt() const { + return mRandomDataInt; +} + +void XAnimParts::SetRandomDataInt(int value) { + mRandomDataInt = value; +} + +XAnimIndices& XAnimParts::GetIndices() { + return mIndices; +} + +const XAnimIndices& XAnimParts::GetIndices() const { + return mIndices; +} + +void XAnimParts::SetIndices(const XAnimIndices& indices) { + mIndices = indices; +} + +qint32 XAnimParts::GetNotifyPtr() const { + return mNotifyPtr; +} + +void XAnimParts::SetNotifyPtr(qint32 ptr) { + mNotifyPtr = ptr; +} + +XAnimNotifyInfo& XAnimParts::GetNotify() { + return mNotify; +} + +const XAnimNotifyInfo& XAnimParts::GetNotify() const { + return mNotify; +} + +void XAnimParts::SetNotify(const XAnimNotifyInfo& notify) { + mNotify = notify; +} + +qint32 XAnimParts::GetDeltaPartPtr() const { + return mDeltaPartPtr; +} + +void XAnimParts::SetDeltaPartPtr(qint32 ptr) { + mDeltaPartPtr = ptr; +} + +XAnimDeltaPart& XAnimParts::GetDeltaPart() { + return mDeltaPart; +} + +const XAnimDeltaPart& XAnimParts::GetDeltaPart() const { + return mDeltaPart; +} + +void XAnimParts::SetDeltaPart(const XAnimDeltaPart& deltaPart) { + mDeltaPart = deltaPart; +} + diff --git a/libs/xassets/xanimparts.h b/libs/xassets/xanimparts.h new file mode 100644 index 0000000..b790a23 --- /dev/null +++ b/libs/xassets/xanimparts.h @@ -0,0 +1,204 @@ + + + + + + + + + +#ifndef XANIMPARTS_H +#define XANIMPARTS_H + +#include "xasset.h" +#include +#include "xanimindices.h" +#include "xanimnotifyinfo.h" +#include "xanimdeltapart.h" + +class XAnimParts : public XAsset +{ +public: + explicit XAnimParts(); + + void ParseData(QDataStream *aStream) override; + + const QString& GetName() const; + void SetName(const QString& name); + + quint32 GetNamePtr() const; + void SetNamePtr(quint32 ptr); + + quint16 GetDataByteCount() const; + void SetDataByteCount(quint16 count); + + quint16 GetDataShortCount() const; + void SetDataShortCount(quint16 count); + + quint16 GetDataIntCount() const; + void SetDataIntCount(quint16 count); + + quint16 GetRandomDataByteCount() const; + void SetRandomDataByteCount(quint16 count); + + quint16 GetRandomDataIntCount() const; + void SetRandomDataIntCount(quint16 count); + + quint16 GetNumFrames() const; + void SetNumFrames(quint16 frames); + + bool IsLoop() const; + void SetIsLoop(bool loop); + + bool IsDelta() const; + void SetIsDelta(bool delta); + + const quint8* GetBoneCount() const; + void SetBoneCount(const quint8* count, size_t boneCount = 12); + + quint8 GetNotifyCount() const; + void SetNotifyCount(quint8 count); + + quint8 GetAssetType() const; + void SetAssetType(quint8 type); + + bool IsPad() const; + void SetIsPad(bool pad); + + quint16 GetRandomDataShortCount() const; + void SetRandomDataShortCount(quint16 count); + + quint16 GetIndexCount() const; + void SetIndexCount(quint16 count); + + float GetFramerate() const; + void SetFramerate(float rate); + + float GetFrequency() const; + void SetFrequency(float frequency); + + quint32 GetNamesPtr() const; + void SetNamesPtr(quint32 ptr); + + quint16 GetNames() const; + void SetNames(quint16 names); + + quint32 GetDataBytePtr() const; + void SetDataBytePtr(quint32 ptr); + + quint8 GetDataByte() const; + void SetDataByte(quint8 byte); + + quint32 GetDataShortPtr() const; + void SetDataShortPtr(quint32 ptr); + + qint16 GetDataShort() const; + void SetDataShort(qint16 shortValue); + + quint32 GetDataIntPtr() const; + void SetDataIntPtr(quint32 ptr); + + int GetDataInt() const; + void SetDataInt(int value); + + quint32 GetRandomDataShortPtr() const; + void SetRandomDataShortPtr(quint32 ptr); + + qint16 GetRandomDataShort() const; + void SetRandomDataShort(qint16 shortValue); + + quint32 GetRandomDataBytePtr() const; + void SetRandomDataBytePtr(quint32 ptr); + + quint8 GetRandomDataByte() const; + void SetRandomDataByte(quint8 byte); + + quint32 GetRandomDataIntPtr() const; + void SetRandomDataIntPtr(quint32 ptr); + + int GetRandomDataInt() const; + void SetRandomDataInt(int value); + + XAnimIndices& GetIndices(); + const XAnimIndices& GetIndices() const; + void SetIndices(const XAnimIndices& indices); + + qint32 GetNotifyPtr() const; + void SetNotifyPtr(qint32 ptr); + + XAnimNotifyInfo& GetNotify(); + const XAnimNotifyInfo& GetNotify() const; + void SetNotify(const XAnimNotifyInfo& notify); + + qint32 GetDeltaPartPtr() const; + void SetDeltaPartPtr(qint32 ptr); + + XAnimDeltaPart& GetDeltaPart(); + const XAnimDeltaPart& GetDeltaPart() const; + void SetDeltaPart(const XAnimDeltaPart& deltaPart); + +private: + QString mName; + quint32 mNamePtr = 0; + + quint16 mDataByteCount = 0; + quint16 mDataShortCount = 0; + quint16 mDataIntCount = 0; + quint16 mRandomDataByteCount = 0; + quint16 mRandomDataIntCount = 0; + quint16 mNumFrames = 0; + + bool mIsLoop = false; + bool mIsDelta = false; + + quint8 mBoneCount[12] = {0}; + quint8 mNotifyCount = 0; + quint8 mAssetType = 0; + + bool mPad = false; + + quint16 mRandomDataShortCount = 0; + quint16 mIndexCount = 0; + + float mFramerate = 0.0f; + float mFrequency = 0.0f; + + quint32 mNamesPtr = 0; + quint16 mNames = 0; + + quint32 mDataBytePtr = 0; + quint8 mDataByte = 0; + + quint32 mDataShortPtr = 0; + qint16 mDataShort = 0; + + quint32 mDataIntPtr = 0; + int mDataInt = 0; + + quint32 mRandomDataShortPtr = 0; + qint16 mRandomDataShort = 0; + + quint32 mRandomDataBytePtr = 0; + quint8 mRandomDataByte = 0; + + quint32 mRandomDataIntPtr = 0; + int mRandomDataInt = 0; + + XAnimIndices mIndices; + + qint32 mNotifyPtr = 0; + XAnimNotifyInfo mNotify; + + qint32 mDeltaPartPtr = 0; + XAnimDeltaPart mDeltaPart; +}; + +#endif // XANIMPARTS_H + + + + + + + + diff --git a/libs/xassets/xanimparttrans.cpp b/libs/xassets/xanimparttrans.cpp new file mode 100644 index 0000000..2e97c9e --- /dev/null +++ b/libs/xassets/xanimparttrans.cpp @@ -0,0 +1,54 @@ + + + + + +#include "xanimparttrans.h" + +XAnimPartTrans::XAnimPartTrans() + : XAsset() { +} + +void XAnimPartTrans::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mSize, sizeof(quint16)); + quint8 smallTransByte; + aStream->read((char*)&smallTransByte, sizeof(quint8)); + mIsSmallTrans = (smallTransByte != 0); + + // Parse data + mData.ParseData(aStream); + } +} + +quint16 XAnimPartTrans::GetSize() const { + return mSize; +} + +void XAnimPartTrans::SetSize(quint16 size) { + mSize = size; +} + +bool XAnimPartTrans::IsSmallTrans() const { + return mIsSmallTrans; +} + +void XAnimPartTrans::SetIsSmallTrans(bool isSmall) { + mIsSmallTrans = isSmall; +} + +XAnimPartTransData& XAnimPartTrans::GetData() { + return mData; +} + +const XAnimPartTransData& XAnimPartTrans::GetData() const { + return mData; +} + +void XAnimPartTrans::SetData(const XAnimPartTransData& data) { + mData = data; +} + + + + diff --git a/libs/xassets/xanimparttrans.h b/libs/xassets/xanimparttrans.h new file mode 100644 index 0000000..659b97b --- /dev/null +++ b/libs/xassets/xanimparttrans.h @@ -0,0 +1,40 @@ + + + + + + +#ifndef XANIMPARTTRANS_H +#define XANIMPARTTRANS_H + +#include "xasset.h" +#include "xanimparttransdata.h" + +class XAnimPartTrans : public XAsset +{ +public: + explicit XAnimPartTrans(); + + void ParseData(QDataStream *aStream) override; + + quint16 GetSize() const; + void SetSize(quint16 size); + + bool IsSmallTrans() const; + void SetIsSmallTrans(bool isSmall); + + XAnimPartTransData& GetData(); + const XAnimPartTransData& GetData() const; + void SetData(const XAnimPartTransData& data); + +private: + quint16 mSize = 0; + bool mIsSmallTrans = false; + XAnimPartTransData mData; +}; + +#endif // XANIMPARTTRANS_H + + + + diff --git a/libs/xassets/xanimparttransdata.cpp b/libs/xassets/xanimparttransdata.cpp new file mode 100644 index 0000000..5fa2559 --- /dev/null +++ b/libs/xassets/xanimparttransdata.cpp @@ -0,0 +1,40 @@ + + + + + +#include "xanimparttransdata.h" + +XAnimPartTransData::XAnimPartTransData() + : XAsset() { +} + +void XAnimPartTransData::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We need to determine which part of the union to parse + // For simplicity, we'll assume it's always frames for now + mFrames.ParseData(aStream); + } +} + +const XAnimPartTransFrames& XAnimPartTransData::GetFrames() const { + return mFrames; +} + +void XAnimPartTransData::SetFrames(const XAnimPartTransFrames& frames) { + mFrames = frames; +} + +const float* XAnimPartTransData::GetFrame0() const { + return mFrame0; +} + +void XAnimPartTransData::SetFrame0(const float* frame0, size_t count) { + if (count <= 3) { + memcpy(mFrame0, frame0, count * sizeof(float)); + } +} + + + + diff --git a/libs/xassets/xanimparttransdata.h b/libs/xassets/xanimparttransdata.h new file mode 100644 index 0000000..063c99a --- /dev/null +++ b/libs/xassets/xanimparttransdata.h @@ -0,0 +1,37 @@ + + + + + +#ifndef XANIMPARTTRANSDATA_H +#define XANIMPARTTRANSDATA_H + +#include "xasset.h" +#include "xanimparttransframes.h" + +class XAnimPartTransData : public XAsset +{ +public: + explicit XAnimPartTransData(); + + void ParseData(QDataStream *aStream) override; + + // Option 1: Frames data + const XAnimPartTransFrames& GetFrames() const; + void SetFrames(const XAnimPartTransFrames& frames); + + // Option 2: Frame0 data + const float* GetFrame0() const; + void SetFrame0(const float* frame0, size_t count = 3); + +private: + union { + XAnimPartTransFrames mFrames; + float mFrame0[3] = {0.0f, 0.0f, 0.0f}; + }; +}; + +#endif // XANIMPARTTRANSDATA_H + + + diff --git a/libs/xassets/xanimparttransframes.cpp b/libs/xassets/xanimparttransframes.cpp new file mode 100644 index 0000000..e38af94 --- /dev/null +++ b/libs/xassets/xanimparttransframes.cpp @@ -0,0 +1,71 @@ + + + + + +#include "xanimparttransframes.h" + +XAnimPartTransFrames::XAnimPartTransFrames() + : XAsset() { +} + +void XAnimPartTransFrames::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mMins, 3 * sizeof(float)); + aStream->read((char*)mSize, 3 * sizeof(float)); + + // Parse frames + mFrames.ParseData(aStream); + + // Parse indices + mIndices.ParseData(aStream); + } +} + +const float* XAnimPartTransFrames::GetMins() const { + return mMins; +} + +void XAnimPartTransFrames::SetMins(const float* mins, size_t count) { + if (count <= 3) { + memcpy(mMins, mins, count * sizeof(float)); + } +} + +const float* XAnimPartTransFrames::GetSize() const { + return mSize; +} + +void XAnimPartTransFrames::SetSize(const float* size, size_t count) { + if (count <= 3) { + memcpy(mSize, size, count * sizeof(float)); + } +} + +XAnimDynamicFrames& XAnimPartTransFrames::GetFrames() { + return mFrames; +} + +const XAnimDynamicFrames& XAnimPartTransFrames::GetFrames() const { + return mFrames; +} + +void XAnimPartTransFrames::SetFrames(const XAnimDynamicFrames& frames) { + mFrames = frames; +} + +XAnimDynamicIndices& XAnimPartTransFrames::GetIndices() { + return mIndices; +} + +const XAnimDynamicIndices& XAnimPartTransFrames::GetIndices() const { + return mIndices; +} + +void XAnimPartTransFrames::SetIndices(const XAnimDynamicIndices& indices) { + mIndices = indices; +} + + + + diff --git a/libs/xassets/xanimparttransframes.h b/libs/xassets/xanimparttransframes.h new file mode 100644 index 0000000..3bb35c4 --- /dev/null +++ b/libs/xassets/xanimparttransframes.h @@ -0,0 +1,43 @@ + + + + +#ifndef XANIMPARTTRANSFRAMES_H +#define XANIMPARTTRANSFRAMES_H + +#include "xasset.h" +#include "xanimdynamicframes.h" +#include "xanimdynamicindices.h" + +class XAnimPartTransFrames : public XAsset +{ +public: + explicit XAnimPartTransFrames(); + + void ParseData(QDataStream *aStream) override; + + const float* GetMins() const; + void SetMins(const float* mins, size_t count = 3); + + const float* GetSize() const; + void SetSize(const float* size, size_t count = 3); + + XAnimDynamicFrames& GetFrames(); + const XAnimDynamicFrames& GetFrames() const; + void SetFrames(const XAnimDynamicFrames& frames); + + XAnimDynamicIndices& GetIndices(); + const XAnimDynamicIndices& GetIndices() const; + void SetIndices(const XAnimDynamicIndices& indices); + +private: + float mMins[3] = {0.0f, 0.0f, 0.0f}; + float mSize[3] = {0.0f, 0.0f, 0.0f}; + XAnimDynamicFrames mFrames; + XAnimDynamicIndices mIndices; +}; + +#endif // XANIMPARTTRANSFRAMES_H + + + diff --git a/libs/xassets/xassetlist.cpp b/libs/xassets/xassetlist.cpp new file mode 100644 index 0000000..8314e69 --- /dev/null +++ b/libs/xassets/xassetlist.cpp @@ -0,0 +1,53 @@ + + + +#include "xassetlist.h" + +XAssetList::XAssetList() + : XAsset() { +} + +void XAssetList::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // Parse string list + mStringList.ParseData(aStream); + + // Parse asset count and assets + aStream->read((char*)&mAssetCount, sizeof(int)); + for (int i = 0; i < mAssetCount; ++i) { + XAsset asset; + asset.ParseData(aStream); + mAssets.append(asset); + } + } +} + +const ScriptStringList& XAssetList::GetStringList() const { + return mStringList; +} + +void XAssetList::SetStringList(const ScriptStringList& stringList) { + mStringList = stringList; +} + +int XAssetList::GetAssetCount() const { + return mAssetCount; +} + +void XAssetList::SetAssetCount(int count) { + mAssetCount = count; +} + +QVector& XAssetList::GetAssets() { + return mAssets; +} + +const QVector& XAssetList::GetAssets() const { + return mAssets; +} + +void XAssetList::SetAssets(const QVector& assets) { + mAssets = assets; +} + + diff --git a/libs/xassets/xassetlist.h b/libs/xassets/xassetlist.h new file mode 100644 index 0000000..50cafaf --- /dev/null +++ b/libs/xassets/xassetlist.h @@ -0,0 +1,34 @@ + + +#ifndef XASSETLIST_H +#define XASSETLIST_H + +#include "xasset.h" +#include +#include "scriptstringlist.h" + +class XAssetList : public XAsset +{ +public: + explicit XAssetList(); + + void ParseData(QDataStream *aStream) override; + + const ScriptStringList& GetStringList() const; + void SetStringList(const ScriptStringList& stringList); + + int GetAssetCount() const; + void SetAssetCount(int count); + + QVector& GetAssets(); + const QVector& GetAssets() const; + void SetAssets(const QVector& assets); + +private: + ScriptStringList mStringList; + int mAssetCount = 0; + QVector mAssets; +}; + +#endif // XASSETLIST_H + diff --git a/libs/xassets/xaudiochannelmap.cpp b/libs/xassets/xaudiochannelmap.cpp new file mode 100644 index 0000000..e654f77 --- /dev/null +++ b/libs/xassets/xaudiochannelmap.cpp @@ -0,0 +1,64 @@ +#include "xaudiochannelmap.h" + +XAudioChannelMap::XAudioChannelMap() + : XAsset() + , mEntryCount(0) + , mEntries(QVector()) +{ + +} + +XAudioChannelMap::~XAudioChannelMap() +{ + for (int i = 0; i < mEntries.size(); i++) + { + delete mEntries[i]; + } + mEntries.clear(); +} + +quint8 XAudioChannelMap::GetEntryCount() const +{ + return mEntryCount; +} + +XAudioChannelMapEntry *XAudioChannelMap::GetMapEntry(int aIndex) const +{ + return mEntries[aIndex]; +} + +void XAudioChannelMap::SetMapEntry(int aIndex, XAudioChannelMapEntry *aEntry) +{ + mEntries[aIndex] = aEntry; +} + +void XAudioChannelMap::ParseData(QDataStream *aStream) +{ + *aStream >> mEntryCount; + + aStream->skipRawData(3); + + quint32 entriesPtr; + *aStream >> entriesPtr; + + if (entriesPtr) + { + mEntries.resize(mEntryCount); + for (int i = 0; i < mEntryCount; i++) + { + mEntries[i] = new XAudioChannelMapEntry(); + mEntries[i]->ParseData(aStream); + } + } +} + +void XAudioChannelMap::Clear() +{ + mEntryCount = 0; + + for (int i = 0; i < mEntries.size(); i++) + { + delete mEntries[i]; + } + mEntries.clear(); +} diff --git a/libs/xassets/xaudiochannelmap.h b/libs/xassets/xaudiochannelmap.h new file mode 100644 index 0000000..7734d30 --- /dev/null +++ b/libs/xassets/xaudiochannelmap.h @@ -0,0 +1,26 @@ +#ifndef XAUDIOCHANNELMAP_H +#define XAUDIOCHANNELMAP_H + +#include "xasset.h" +#include "xaudiochannelmapentry.h" + +class XAudioChannelMap : public XAsset +{ +public: + XAudioChannelMap(); + ~XAudioChannelMap(); + + quint8 GetEntryCount() const; + + XAudioChannelMapEntry* GetMapEntry(int aIndex) const; + void SetMapEntry(int aIndex, XAudioChannelMapEntry* aEntry); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mEntryCount; + QVector mEntries; +}; + +#endif // XAUDIOCHANNELMAP_H diff --git a/libs/xassets/xaudiochannelmapentry.cpp b/libs/xassets/xaudiochannelmapentry.cpp new file mode 100644 index 0000000..8604068 --- /dev/null +++ b/libs/xassets/xaudiochannelmapentry.cpp @@ -0,0 +1,64 @@ +#include "xaudiochannelmapentry.h" + +XAudioChannelMapEntry::XAudioChannelMapEntry() + : XAsset() + , mInputChannel(0) + , mOutputChannel(0) + , mVolume(0.0) +{ + +} + +XAudioChannelMapEntry::~XAudioChannelMapEntry() +{ + +} + +quint8 XAudioChannelMapEntry::GetInputChannel() const +{ + return mInputChannel; +} + +void XAudioChannelMapEntry::SetInputChannel(quint8 aInputChannel) +{ + mInputChannel = aInputChannel; +} + +quint8 XAudioChannelMapEntry::GetOutputChannel() const +{ + return mOutputChannel; +} + +void XAudioChannelMapEntry::SetOutputChannel(quint8 aOutputChannel) +{ + mOutputChannel = aOutputChannel; +} + +float XAudioChannelMapEntry::GetVolume() const +{ + return mVolume; +} + +void XAudioChannelMapEntry::SetVolume(float aVolume) +{ + mVolume = aVolume; +} + +void XAudioChannelMapEntry::ParseData(QDataStream *aStream) +{ + *aStream + >> mInputChannel + >> mOutputChannel; + + // Skip padding bytes in struct + aStream->skipRawData(2); + + *aStream >> mVolume; +} + +void XAudioChannelMapEntry::Clear() +{ + mInputChannel = 0; + mOutputChannel = 0; + mVolume = 0.0; +} diff --git a/libs/xassets/xaudiochannelmapentry.h b/libs/xassets/xaudiochannelmapentry.h new file mode 100644 index 0000000..dfe6050 --- /dev/null +++ b/libs/xassets/xaudiochannelmapentry.h @@ -0,0 +1,30 @@ +#ifndef XAUDIOCHANNELMAPENTRY_H +#define XAUDIOCHANNELMAPENTRY_H + +#include "xasset.h" + +class XAudioChannelMapEntry : public XAsset +{ +public: + XAudioChannelMapEntry(); + ~XAudioChannelMapEntry(); + + quint8 GetInputChannel() const; + void SetInputChannel(quint8 aInputChannel); + + quint8 GetOutputChannel() const; + void SetOutputChannel(quint8 aOutputChannel); + + float GetVolume() const; + void SetVolume(float aVolume); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mInputChannel; + quint8 mOutputChannel; + float mVolume; +}; + +#endif // XAUDIOCHANNELMAPENTRY_H diff --git a/libs/xassets/xcardmemory.cpp b/libs/xassets/xcardmemory.cpp new file mode 100644 index 0000000..ef1333f --- /dev/null +++ b/libs/xassets/xcardmemory.cpp @@ -0,0 +1,23 @@ +#include "xcardmemory.h" + +XCardMemory::XCardMemory() + : XAsset() + , mPlatform(0) +{ + +} + +XCardMemory::~XCardMemory() +{ + +} + +void XCardMemory::ParseData(QDataStream *aStream) +{ + *aStream >> mPlatform; +} + +void XCardMemory::Clear() +{ + mPlatform = 0; +} diff --git a/libs/xassets/xcardmemory.h b/libs/xassets/xcardmemory.h new file mode 100644 index 0000000..d8ed56d --- /dev/null +++ b/libs/xassets/xcardmemory.h @@ -0,0 +1,19 @@ +#ifndef XCARDMEMORY_H +#define XCARDMEMORY_H + +#include "xasset.h" + +class XCardMemory : public XAsset +{ +public: + XCardMemory(); + ~XCardMemory(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + int mPlatform; +}; + +#endif // XCARDMEMORY_H diff --git a/libs/xassets/xcleaf.cpp b/libs/xassets/xcleaf.cpp new file mode 100644 index 0000000..217e177 --- /dev/null +++ b/libs/xassets/xcleaf.cpp @@ -0,0 +1,97 @@ + + + + + + +#include "xcleaf.h" + +XCLeaf::XCLeaf() + : XAsset() { +} + +void XCLeaf::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mFirstCollAabbIndex, sizeof(quint16)); + aStream->read((char*)&mCollAabbCount, sizeof(quint16)); + aStream->read((char*)&mBrushContents, sizeof(int)); + aStream->read((char*)&mTerrainContents, sizeof(int)); + aStream->read((char*)mMins, 3 * sizeof(float)); + aStream->read((char*)mMaxs, 3 * sizeof(float)); + aStream->read((char*)&mLeafBrushNode, sizeof(int)); + aStream->read((char*)&mCluster, sizeof(qint16)); + } +} + +quint16 XCLeaf::GetFirstCollAabbIndex() const { + return mFirstCollAabbIndex; +} + +void XCLeaf::SetFirstCollAabbIndex(quint16 index) { + mFirstCollAabbIndex = index; +} + +quint16 XCLeaf::GetCollAabbCount() const { + return mCollAabbCount; +} + +void XCLeaf::SetCollAabbCount(quint16 count) { + mCollAabbCount = count; +} + +int XCLeaf::GetBrushContents() const { + return mBrushContents; +} + +void XCLeaf::SetBrushContents(int contents) { + mBrushContents = contents; +} + +int XCLeaf::GetTerrainContents() const { + return mTerrainContents; +} + +void XCLeaf::SetTerrainContents(int contents) { + mTerrainContents = contents; +} + +const float* XCLeaf::GetMins() const { + return mMins; +} + +void XCLeaf::SetMins(const float* mins, size_t count) { + if (count <= 3) { + memcpy(mMins, mins, count * sizeof(float)); + } +} + +const float* XCLeaf::GetMaxs() const { + return mMaxs; +} + +void XCLeaf::SetMaxs(const float* maxs, size_t count) { + if (count <= 3) { + memcpy(mMaxs, maxs, count * sizeof(float)); + } +} + +int XCLeaf::GetLeafBrushNode() const { + return mLeafBrushNode; +} + +void XCLeaf::SetLeafBrushNode(int node) { + mLeafBrushNode = node; +} + +qint16 XCLeaf::GetCluster() const { + return mCluster; +} + +void XCLeaf::SetCluster(qint16 cluster) { + mCluster = cluster; +} + + + + + diff --git a/libs/xassets/xcleaf.h b/libs/xassets/xcleaf.h new file mode 100644 index 0000000..f2f787d --- /dev/null +++ b/libs/xassets/xcleaf.h @@ -0,0 +1,59 @@ + + + + + + +#ifndef XCLEAF_H +#define XCLEAF_H + +#include "xasset.h" + +class XCLeaf : public XAsset +{ +public: + explicit XCLeaf(); + + void ParseData(QDataStream *aStream) override; + + quint16 GetFirstCollAabbIndex() const; + void SetFirstCollAabbIndex(quint16 index); + + quint16 GetCollAabbCount() const; + void SetCollAabbCount(quint16 count); + + int GetBrushContents() const; + void SetBrushContents(int contents); + + int GetTerrainContents() const; + void SetTerrainContents(int contents); + + const float* GetMins() const; + void SetMins(const float* mins, size_t count = 3); + + const float* GetMaxs() const; + void SetMaxs(const float* maxs, size_t count = 3); + + int GetLeafBrushNode() const; + void SetLeafBrushNode(int node); + + qint16 GetCluster() const; + void SetCluster(qint16 cluster); + +private: + quint16 mFirstCollAabbIndex = 0; + quint16 mCollAabbCount = 0; + int mBrushContents = 0; + int mTerrainContents = 0; + float mMins[3] = {0.0f, 0.0f, 0.0f}; + float mMaxs[3] = {0.0f, 0.0f, 0.0f}; + int mLeafBrushNode = 0; + qint16 mCluster = 0; +}; + +#endif // XCLEAF_H + + + + + diff --git a/libs/xassets/xcleafbrushnode.cpp b/libs/xassets/xcleafbrushnode.cpp new file mode 100644 index 0000000..06105da --- /dev/null +++ b/libs/xassets/xcleafbrushnode.cpp @@ -0,0 +1,55 @@ + + +#include "xcleafbrushnode.h" + +XCLeafBrushNode::XCLeafBrushNode() + : XAsset() { +} + +void XCLeafBrushNode::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mAxis, sizeof(quint8)); + aStream->read((char*)&mLeafBrushCount, sizeof(qint16)); + aStream->read((char*)&mContents, sizeof(int)); + + // Parse data + mData.ParseData(aStream); + } +} + +quint8 XCLeafBrushNode::GetAxis() const { + return mAxis; +} + +void XCLeafBrushNode::SetAxis(quint8 axis) { + mAxis = axis; +} + +qint16 XCLeafBrushNode::GetLeafBrushCount() const { + return mLeafBrushCount; +} + +void XCLeafBrushNode::SetLeafBrushCount(qint16 count) { + mLeafBrushCount = count; +} + +int XCLeafBrushNode::GetContents() const { + return mContents; +} + +void XCLeafBrushNode::SetContents(int contents) { + mContents = contents; +} + +XCLeafBrushNodeData& XCLeafBrushNode::GetData() { + return mData; +} + +const XCLeafBrushNodeData& XCLeafBrushNode::GetData() const { + return mData; +} + +void XCLeafBrushNode::SetData(const XCLeafBrushNodeData& data) { + mData = data; +} + diff --git a/libs/xassets/xcleafbrushnode.h b/libs/xassets/xcleafbrushnode.h new file mode 100644 index 0000000..8394fd0 --- /dev/null +++ b/libs/xassets/xcleafbrushnode.h @@ -0,0 +1,45 @@ + + + + + + +#ifndef XCLEAFBRUSHNODE_H +#define XCLEAFBRUSHNODE_H + +#include "xasset.h" +#include "xcleafbrushnodedata.h" + +class XCLeafBrushNode : public XAsset +{ +public: + explicit XCLeafBrushNode(); + + void ParseData(QDataStream *aStream) override; + + quint8 GetAxis() const; + void SetAxis(quint8 axis); + + qint16 GetLeafBrushCount() const; + void SetLeafBrushCount(qint16 count); + + int GetContents() const; + void SetContents(int contents); + + XCLeafBrushNodeData& GetData(); + const XCLeafBrushNodeData& GetData() const; + void SetData(const XCLeafBrushNodeData& data); + +private: + quint8 mAxis = 0; + qint16 mLeafBrushCount = 0; + int mContents = 0; + XCLeafBrushNodeData mData; +}; + +#endif // XCLEAFBRUSHNODE_H + + + + + diff --git a/libs/xassets/xcleafbrushnodechildren.cpp b/libs/xassets/xcleafbrushnodechildren.cpp new file mode 100644 index 0000000..dd3fbf1 --- /dev/null +++ b/libs/xassets/xcleafbrushnodechildren.cpp @@ -0,0 +1,52 @@ + + + + + + +#include "xcleafbrushnodechildren.h" + +XCLeafBrushNodeChildren::XCLeafBrushNodeChildren() + : XAsset() { +} + +void XCLeafBrushNodeChildren::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mDist, sizeof(float)); + aStream->read((char*)&mRange, sizeof(float)); + aStream->read((char*)mChildOffset, 2 * sizeof(quint16)); + } +} + +float XCLeafBrushNodeChildren::GetDist() const { + return mDist; +} + +void XCLeafBrushNodeChildren::SetDist(float dist) { + mDist = dist; +} + +float XCLeafBrushNodeChildren::GetRange() const { + return mRange; +} + +void XCLeafBrushNodeChildren::SetRange(float range) { + mRange = range; +} + +quint16 XCLeafBrushNodeChildren::GetChildOffset(int index) const { + if (index >= 0 && index < 2) { + return mChildOffset[index]; + } + return 0; +} + +void XCLeafBrushNodeChildren::SetChildOffset(int index, quint16 offset) { + if (index >= 0 && index < 2) { + mChildOffset[index] = offset; + } +} + + + + diff --git a/libs/xassets/xcleafbrushnodechildren.h b/libs/xassets/xcleafbrushnodechildren.h new file mode 100644 index 0000000..f0d5a39 --- /dev/null +++ b/libs/xassets/xcleafbrushnodechildren.h @@ -0,0 +1,39 @@ + + + + + + +#ifndef XCLEAFBRUSHNODECHILDREN_H +#define XCLEAFBRUSHNODECHILDREN_H + +#include "xasset.h" + +class XCLeafBrushNodeChildren : public XAsset +{ +public: + explicit XCLeafBrushNodeChildren(); + + void ParseData(QDataStream *aStream) override; + + float GetDist() const; + void SetDist(float dist); + + float GetRange() const; + void SetRange(float range); + + quint16 GetChildOffset(int index) const; + void SetChildOffset(int index, quint16 offset); + +private: + float mDist = 0.0f; + float mRange = 0.0f; + quint16 mChildOffset[2] = {0}; +}; + +#endif // XCLEAFBRUSHNODECHILDREN_H + + + + + diff --git a/libs/xassets/xcleafbrushnodedata.cpp b/libs/xassets/xcleafbrushnodedata.cpp new file mode 100644 index 0000000..6fe1221 --- /dev/null +++ b/libs/xassets/xcleafbrushnodedata.cpp @@ -0,0 +1,39 @@ + + + + + + +#include "xcleafbrushnodedata.h" + +XCLeafBrushNodeData::XCLeafBrushNodeData() + : XAsset() { +} + +void XCLeafBrushNodeData::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We need to determine which part of the union to parse + // For simplicity, we'll assume it's always leaf for now + mLeaf.ParseData(aStream); + } +} + +const XCLeafBrushNodeLeaf& XCLeafBrushNodeData::GetLeaf() const { + return mLeaf; +} + +void XCLeafBrushNodeData::SetLeaf(const XCLeafBrushNodeLeaf& leaf) { + mLeaf = leaf; +} + +const XCLeafBrushNodeChildren& XCLeafBrushNodeData::GetChildren() const { + return mChildren; +} + +void XCLeafBrushNodeData::SetChildren(const XCLeafBrushNodeChildren& children) { + mChildren = children; +} + + + + diff --git a/libs/xassets/xcleafbrushnodedata.h b/libs/xassets/xcleafbrushnodedata.h new file mode 100644 index 0000000..be2959a --- /dev/null +++ b/libs/xassets/xcleafbrushnodedata.h @@ -0,0 +1,41 @@ + + + + + + +#ifndef XCLEAFBRUSHNODEDATA_H +#define XCLEAFBRUSHNODEDATA_H + +#include "xasset.h" +#include "xcleafbrushnodeleaf.h" +#include "xcleafbrushnodechildren.h" + +class XCLeafBrushNodeData : public XAsset +{ +public: + explicit XCLeafBrushNodeData(); + + void ParseData(QDataStream *aStream) override; + + // Option 1: Leaf data + const XCLeafBrushNodeLeaf& GetLeaf() const; + void SetLeaf(const XCLeafBrushNodeLeaf& leaf); + + // Option 2: Children data + const XCLeafBrushNodeChildren& GetChildren() const; + void SetChildren(const XCLeafBrushNodeChildren& children); + +private: + union { + XCLeafBrushNodeLeaf mLeaf; + XCLeafBrushNodeChildren mChildren; + }; +}; + +#endif // XCLEAFBRUSHNODEDATA_H + + + + + diff --git a/libs/xassets/xcleafbrushnodeleaf.cpp b/libs/xassets/xcleafbrushnodeleaf.cpp new file mode 100644 index 0000000..0c4d2f2 --- /dev/null +++ b/libs/xassets/xcleafbrushnodeleaf.cpp @@ -0,0 +1,28 @@ + + + + + + +#include "xcleafbrushnodeleaf.h" + +XCLeafBrushNodeLeaf::XCLeafBrushNodeLeaf() + : XAsset() { +} + +void XCLeafBrushNodeLeaf::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We would parse brushes here, but we're using a placeholder + } +} + +void* XCLeafBrushNodeLeaf::GetBrushes() const { + return mBrushes; +} + +void XCLeafBrushNodeLeaf::SetBrushes(void* brushes) { + mBrushes = brushes; +} + + + diff --git a/libs/xassets/xcleafbrushnodeleaf.h b/libs/xassets/xcleafbrushnodeleaf.h new file mode 100644 index 0000000..04bf0f8 --- /dev/null +++ b/libs/xassets/xcleafbrushnodeleaf.h @@ -0,0 +1,33 @@ + + + + + + +#ifndef XCLEAFBRUSHNODELEAF_H +#define XCLEAFBRUSHNODELEAF_H + +#include "xasset.h" + +class XCLeafBrushNodeLeaf : public XAsset +{ +public: + explicit XCLeafBrushNodeLeaf(); + + void ParseData(QDataStream *aStream) override; + + // Note: In a real implementation, we would have proper handling for brushes pointer + // For now, we'll just use a placeholder + void* GetBrushes() const; + void SetBrushes(void* brushes); + +private: + void* mBrushes = nullptr; // Placeholder for unsigned __int16* +}; + +#endif // XCLEAFBRUSHNODELEAF_H + + + + + diff --git a/libs/xassets/xclipmap.cpp b/libs/xassets/xclipmap.cpp new file mode 100644 index 0000000..f7e2c25 --- /dev/null +++ b/libs/xassets/xclipmap.cpp @@ -0,0 +1,104 @@ + + + + + + +#include "xclipmap.h" + +XClipMap::XClipMap() + : XAsset() { +} + +void XClipMap::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + char name[64]; + aStream->read(name, 64); + mName = QString::fromUtf8(name); + + aStream->read((char*)&mChecksum, sizeof(int)); + + // We would parse arrays here, but we're using placeholders + } +} + +const QString& XClipMap::GetName() const { + return mName; +} + +void XClipMap::SetName(const QString& name) { + mName = name; +} + +int XClipMap::GetChecksum() const { + return mChecksum; +} + +void XClipMap::SetChecksum(int checksum) { + mChecksum = checksum; +} + +void* XClipMap::GetStaticModels() const { + return mStaticModels; +} + +void XClipMap::SetStaticModels(void* staticModels) { + mStaticModels = staticModels; +} + +int XClipMap::GetNumStaticModels() const { + return mNumStaticModels; +} + +void XClipMap::SetNumStaticModels(int count) { + mNumStaticModels = count; +} + +void* XClipMap::GetCollisionAabbTrees() const { + return mCollisionAabbTrees; +} + +void XClipMap::SetCollisionAabbTrees(void* trees) { + mCollisionAabbTrees = trees; +} + +int XClipMap::GetNumCollisionAabbTrees() const { + return mNumCollisionAabbTrees; +} + +void XClipMap::SetNumCollisionAabbTrees(int count) { + mNumCollisionAabbTrees = count; +} + +void* XClipMap::GetMaterials() const { + return mMaterials; +} + +void XClipMap::SetMaterials(void* materials) { + mMaterials = materials; +} + +int XClipMap::GetNumMaterials() const { + return mNumMaterials; +} + +void XClipMap::SetNumMaterials(int count) { + mNumMaterials = count; +} + +void* XClipMap::GetLeafBrushNodes() const { + return mLeafBrushNodes; +} + +void XClipMap::SetLeafBrushNodes(void* nodes) { + mLeafBrushNodes = nodes; +} + +int XClipMap::GetNumLeafBrushNodes() const { + return mNumLeafBrushNodes; +} + +void XClipMap::SetNumLeafBrushNodes(int count) { + mNumLeafBrushNodes = count; +} + diff --git a/libs/xassets/xclipmap.h b/libs/xassets/xclipmap.h new file mode 100644 index 0000000..c2054bb --- /dev/null +++ b/libs/xassets/xclipmap.h @@ -0,0 +1,82 @@ + + + + + + + +#ifndef XCLIPMAP_H +#define XCLIPMAP_H + +#include "xasset.h" +#include + +class XCStaticModel_s; // Forward declaration +class XCollisionAabbTree; // Forward declaration +class XDmaterial_t; // Forward declaration +class XCLeafBrushNode; // Forward declaration + +class XClipMap : public XAsset +{ +public: + explicit XClipMap(); + + void ParseData(QDataStream *aStream) override; + + const QString& GetName() const; + void SetName(const QString& name); + + int GetChecksum() const; + void SetChecksum(int checksum); + + // Note: In a real implementation, we would have proper handling for these arrays + // For now, we'll just use placeholders + void* GetStaticModels() const; + void SetStaticModels(void* staticModels); + + int GetNumStaticModels() const; + void SetNumStaticModels(int count); + + void* GetCollisionAabbTrees() const; + void SetCollisionAabbTrees(void* trees); + + int GetNumCollisionAabbTrees() const; + void SetNumCollisionAabbTrees(int count); + + void* GetMaterials() const; + void SetMaterials(void* materials); + + int GetNumMaterials() const; + void SetNumMaterials(int count); + + void* GetLeafBrushNodes() const; + void SetLeafBrushNodes(void* nodes); + + int GetNumLeafBrushNodes() const; + void SetNumLeafBrushNodes(int count); + +private: + QString mName = ""; + int mChecksum = 0; + + // Placeholders for arrays + void* mStaticModels = nullptr; // Placeholder for XCStaticModel_s* + int mNumStaticModels = 0; + + void* mCollisionAabbTrees = nullptr; // Placeholder for XCollisionAabbTree* + int mNumCollisionAabbTrees = 0; + + void* mMaterials = nullptr; // Placeholder for XDmaterial_t* + int mNumMaterials = 0; + + void* mLeafBrushNodes = nullptr; // Placeholder for XCLeafBrushNode* + int mNumLeafBrushNodes = 0; +}; + +#endif // XCLIPMAP_H + + + + + + diff --git a/libs/xassets/xcnode.cpp b/libs/xassets/xcnode.cpp new file mode 100644 index 0000000..8f8d7d6 --- /dev/null +++ b/libs/xassets/xcnode.cpp @@ -0,0 +1,45 @@ + + + + + + +#include "xcnode.h" + +XCNode_t::XCNode_t() + : XAsset() { +} + +void XCNode_t::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We would parse plane here, but we're using a placeholder + + // Parse children + aStream->read((char*)mChildren, 2 * sizeof(qint16)); + } +} + +void* XCNode_t::GetPlane() const { + return mPlane; +} + +void XCNode_t::SetPlane(void* plane) { + mPlane = plane; +} + +qint16 XCNode_t::GetChild(int index) const { + if (index >= 0 && index < 2) { + return mChildren[index]; + } + return 0; +} + +void XCNode_t::SetChild(int index, qint16 child) { + if (index >= 0 && index < 2) { + mChildren[index] = child; + } +} + + + + diff --git a/libs/xassets/xcnode.h b/libs/xassets/xcnode.h new file mode 100644 index 0000000..ebb9cc9 --- /dev/null +++ b/libs/xassets/xcnode.h @@ -0,0 +1,39 @@ + + + + + + +#ifndef XCNODE_H +#define XCNODE_H + +#include "xasset.h" + +class CPlane; // Forward declaration + +class XCNode_t : public XAsset +{ +public: + explicit XCNode_t(); + + void ParseData(QDataStream *aStream) override; + + // Note: In a real implementation, we would have an XCPlane class + // For now, we'll just use a pointer to CPlane as a placeholder + void* GetPlane() const; + void SetPlane(void* plane); + + qint16 GetChild(int index) const; + void SetChild(int index, qint16 child); + +private: + void* mPlane = nullptr; // Placeholder for CPlane* + qint16 mChildren[2] = {0}; +}; + +#endif // XCNODE_H + + + + + diff --git a/libs/xassets/xcollisionaabbtree.cpp b/libs/xassets/xcollisionaabbtree.cpp new file mode 100644 index 0000000..a140b0c --- /dev/null +++ b/libs/xassets/xcollisionaabbtree.cpp @@ -0,0 +1,74 @@ + + + + + + +#include "xcollisionaabbtree.h" + +XCollisionAabbTree::XCollisionAabbTree() + : XAsset() { +} + +void XCollisionAabbTree::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mOrigin, 3 * sizeof(float)); + aStream->read((char*)mHalfSize, 3 * sizeof(float)); + aStream->read((char*)&mMaterialIndex, sizeof(quint16)); + aStream->read((char*)&mChildCount, sizeof(quint16)); + + // Parse union + mU.ParseData(aStream); + } +} + +const float* XCollisionAabbTree::GetOrigin() const { + return mOrigin; +} + +void XCollisionAabbTree::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +const float* XCollisionAabbTree::GetHalfSize() const { + return mHalfSize; +} + +void XCollisionAabbTree::SetHalfSize(const float* halfSize, size_t count) { + if (count <= 3) { + memcpy(mHalfSize, halfSize, count * sizeof(float)); + } +} + +quint16 XCollisionAabbTree::GetMaterialIndex() const { + return mMaterialIndex; +} + +void XCollisionAabbTree::SetMaterialIndex(quint16 index) { + mMaterialIndex = index; +} + +quint16 XCollisionAabbTree::GetChildCount() const { + return mChildCount; +} + +void XCollisionAabbTree::SetChildCount(quint16 count) { + mChildCount = count; +} + +XCollisionAabbTreeIndex& XCollisionAabbTree::GetU() { + return mU; +} + +const XCollisionAabbTreeIndex& XCollisionAabbTree::GetU() const { + return mU; +} + +void XCollisionAabbTree::SetU(const XCollisionAabbTreeIndex& u) { + mU = u; +} + + + diff --git a/libs/xassets/xcollisionaabbtree.h b/libs/xassets/xcollisionaabbtree.h new file mode 100644 index 0000000..2e8288b --- /dev/null +++ b/libs/xassets/xcollisionaabbtree.h @@ -0,0 +1,49 @@ + + + + + + +#ifndef XCOLLISIONAABBTREE_H +#define XCOLLISIONAABBTREE_H + +#include "xasset.h" +#include "xcollisionaabbtreeindex.h" + +class XCollisionAabbTree : public XAsset +{ +public: + explicit XCollisionAabbTree(); + + void ParseData(QDataStream *aStream) override; + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + const float* GetHalfSize() const; + void SetHalfSize(const float* halfSize, size_t count = 3); + + quint16 GetMaterialIndex() const; + void SetMaterialIndex(quint16 index); + + quint16 GetChildCount() const; + void SetChildCount(quint16 count); + + XCollisionAabbTreeIndex& GetU(); + const XCollisionAabbTreeIndex& GetU() const; + void SetU(const XCollisionAabbTreeIndex& u); + +private: + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + float mHalfSize[3] = {0.0f, 0.0f, 0.0f}; + quint16 mMaterialIndex = 0; + quint16 mChildCount = 0; + XCollisionAabbTreeIndex mU; +}; + +#endif // XCOLLISIONAABBTREE_H + + + + + diff --git a/libs/xassets/xcollisionaabbtreeindex.cpp b/libs/xassets/xcollisionaabbtreeindex.cpp new file mode 100644 index 0000000..42c2700 --- /dev/null +++ b/libs/xassets/xcollisionaabbtreeindex.cpp @@ -0,0 +1,40 @@ + + + + + + + +#include "xcollisionaabbtreeindex.h" + +XCollisionAabbTreeIndex::XCollisionAabbTreeIndex() + : XAsset() { +} + +void XCollisionAabbTreeIndex::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We need to determine which part of the union to parse + // For simplicity, we'll assume it's always firstChildIndex for now + aStream->read((char*)&mFirstChildIndex, sizeof(int)); + } +} + +int XCollisionAabbTreeIndex::GetFirstChildIndex() const { + return mFirstChildIndex; +} + +void XCollisionAabbTreeIndex::SetFirstChildIndex(int index) { + mFirstChildIndex = index; +} + +int XCollisionAabbTreeIndex::GetPartitionIndex() const { + return mPartitionIndex; +} + +void XCollisionAabbTreeIndex::SetPartitionIndex(int index) { + mPartitionIndex = index; +} + + + + diff --git a/libs/xassets/xcollisionaabbtreeindex.h b/libs/xassets/xcollisionaabbtreeindex.h new file mode 100644 index 0000000..ac28346 --- /dev/null +++ b/libs/xassets/xcollisionaabbtreeindex.h @@ -0,0 +1,39 @@ + + + + + + +#ifndef XCOLLISIONAABBTREEINDEX_H +#define XCOLLISIONAABBTREEINDEX_H + +#include "xasset.h" + +class XCollisionAabbTreeIndex : public XAsset +{ +public: + explicit XCollisionAabbTreeIndex(); + + void ParseData(QDataStream *aStream) override; + + // Option 1: First child index + int GetFirstChildIndex() const; + void SetFirstChildIndex(int index); + + // Option 2: Partition index + int GetPartitionIndex() const; + void SetPartitionIndex(int index); + +private: + union { + int mFirstChildIndex = 0; + int mPartitionIndex = 0; + }; +}; + +#endif // XCOLLISIONAABBTREEINDEX_H + + + + + diff --git a/libs/xassets/xcollisionborder.cpp b/libs/xassets/xcollisionborder.cpp new file mode 100644 index 0000000..a917522 --- /dev/null +++ b/libs/xassets/xcollisionborder.cpp @@ -0,0 +1,60 @@ + + +#include "xcollisionborder.h" + +XCollisionBorder::XCollisionBorder() + : XAsset() { +} + +void XCollisionBorder::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mDistEq, 3 * sizeof(float)); + aStream->read((char*)&mZBase, sizeof(float)); + aStream->read((char*)&mZSlope, sizeof(float)); + aStream->read((char*)&mStart, sizeof(float)); + aStream->read((char*)&mLength, sizeof(float)); + } +} + +const float* XCollisionBorder::GetDistEq() const { + return mDistEq; +} + +void XCollisionBorder::SetDistEq(const float* distEq, size_t count) { + if (count <= 3) { + memcpy(mDistEq, distEq, count * sizeof(float)); + } +} + +float XCollisionBorder::GetZBase() const { + return mZBase; +} + +void XCollisionBorder::SetZBase(float zBase) { + mZBase = zBase; +} + +float XCollisionBorder::GetZSlope() const { + return mZSlope; +} + +void XCollisionBorder::SetZSlope(float zSlope) { + mZSlope = zSlope; +} + +float XCollisionBorder::GetStart() const { + return mStart; +} + +void XCollisionBorder::SetStart(float start) { + mStart = start; +} + +float XCollisionBorder::GetLength() const { + return mLength; +} + +void XCollisionBorder::SetLength(float length) { + mLength = length; +} + diff --git a/libs/xassets/xcollisionborder.h b/libs/xassets/xcollisionborder.h new file mode 100644 index 0000000..d01af88 --- /dev/null +++ b/libs/xassets/xcollisionborder.h @@ -0,0 +1,47 @@ + + + + + + +#ifndef XCOLLISIONBORDER_H +#define XCOLLISIONBORDER_H + +#include "xasset.h" + +class XCollisionBorder : public XAsset +{ +public: + explicit XCollisionBorder(); + + void ParseData(QDataStream *aStream) override; + + const float* GetDistEq() const; + void SetDistEq(const float* distEq, size_t count = 3); + + float GetZBase() const; + void SetZBase(float zBase); + + float GetZSlope() const; + void SetZSlope(float zSlope); + + float GetStart() const; + void SetStart(float start); + + float GetLength() const; + void SetLength(float length); + +private: + float mDistEq[3] = {0.0f, 0.0f, 0.0f}; + float mZBase = 0.0f; + float mZSlope = 0.0f; + float mStart = 0.0f; + float mLength = 0.0f; +}; + +#endif // XCOLLISIONBORDER_H + + + + + diff --git a/libs/xassets/xcollisionpartition.cpp b/libs/xassets/xcollisionpartition.cpp new file mode 100644 index 0000000..707a25a --- /dev/null +++ b/libs/xassets/xcollisionpartition.cpp @@ -0,0 +1,58 @@ + + + + + + + +#include "xcollisionpartition.h" + +XCollisionPartition::XCollisionPartition() + : XAsset() { +} + +void XCollisionPartition::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mTriCount, sizeof(quint8)); + aStream->read((char*)&mBorderCount, sizeof(quint8)); + aStream->read((char*)&mFirstTri, sizeof(int)); + + // We would parse borders here, but we're using a placeholder + } +} + +quint8 XCollisionPartition::GetTriCount() const { + return mTriCount; +} + +void XCollisionPartition::SetTriCount(quint8 count) { + mTriCount = count; +} + +quint8 XCollisionPartition::GetBorderCount() const { + return mBorderCount; +} + +void XCollisionPartition::SetBorderCount(quint8 count) { + mBorderCount = count; +} + +int XCollisionPartition::GetFirstTri() const { + return mFirstTri; +} + +void XCollisionPartition::SetFirstTri(int firstTri) { + mFirstTri = firstTri; +} + +void* XCollisionPartition::GetBorders() const { + return mBorders; +} + +void XCollisionPartition::SetBorders(void* borders) { + mBorders = borders; +} + + + + diff --git a/libs/xassets/xcollisionpartition.h b/libs/xassets/xcollisionpartition.h new file mode 100644 index 0000000..8ac0761 --- /dev/null +++ b/libs/xassets/xcollisionpartition.h @@ -0,0 +1,47 @@ + + + + + + +#ifndef XCOLLISIONPARTITION_H +#define XCOLLISIONPARTITION_H + +#include "xasset.h" + +class CollisionBorder; // Forward declaration + +class XCollisionPartition : public XAsset +{ +public: + explicit XCollisionPartition(); + + void ParseData(QDataStream *aStream) override; + + quint8 GetTriCount() const; + void SetTriCount(quint8 count); + + quint8 GetBorderCount() const; + void SetBorderCount(quint8 count); + + int GetFirstTri() const; + void SetFirstTri(int firstTri); + + // Note: In a real implementation, we would have proper handling for borders pointer + // For now, we'll just use a placeholder + void* GetBorders() const; + void SetBorders(void* borders); + +private: + quint8 mTriCount = 0; + quint8 mBorderCount = 0; + int mFirstTri = 0; + void* mBorders = nullptr; // Placeholder for CollisionBorder* +}; + +#endif // XCOLLISIONPARTITION_H + + + + + diff --git a/libs/xassets/xcstaticmodels.cpp b/libs/xassets/xcstaticmodels.cpp new file mode 100644 index 0000000..19b3b81 --- /dev/null +++ b/libs/xassets/xcstaticmodels.cpp @@ -0,0 +1,93 @@ + + + + + + +#include "xcstaticmodels.h" + +XCStaticModel_s::XCStaticModel_s() + : XAsset() { +} + +void XCStaticModel_s::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // Parse writable + mWritable.ParseData(aStream); + + // We would parse xmodel here, but we're using a placeholder + + // Parse origin + aStream->read((char*)mOrigin, 3 * sizeof(float)); + + // Parse invScaledAxis + for (int i = 0; i < 3; ++i) { + aStream->read((char*)mInvScaledAxis[i], 3 * sizeof(float)); + } + + // Parse absmin and absmax + aStream->read((char*)mAbsmin, 3 * sizeof(float)); + aStream->read((char*)mAbsmax, 3 * sizeof(float)); + } +} + +const XCStaticModelWritable& XCStaticModel_s::GetWritable() const { + return mWritable; +} + +void XCStaticModel_s::SetWritable(const XCStaticModelWritable& writable) { + mWritable = writable; +} + +void* XCStaticModel_s::GetXModel() const { + return mXModel; +} + +void XCStaticModel_s::SetXModel(void* model) { + mXModel = model; +} + +const float* XCStaticModel_s::GetOrigin() const { + return mOrigin; +} + +void XCStaticModel_s::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +const float* XCStaticModel_s::GetInvScaledAxis() const { + return &mInvScaledAxis[0][0]; +} + +void XCStaticModel_s::SetInvScaledAxis(const float* axis, size_t rows, size_t cols) { + if (rows <= 3 && cols <= 3) { + for (size_t i = 0; i < rows; ++i) { + memcpy(mInvScaledAxis[i], &axis[i * cols], cols * sizeof(float)); + } + } +} + +const float* XCStaticModel_s::GetAbsmin() const { + return mAbsmin; +} + +void XCStaticModel_s::SetAbsmin(const float* absmin, size_t count) { + if (count <= 3) { + memcpy(mAbsmin, absmin, count * sizeof(float)); + } +} + +const float* XCStaticModel_s::GetAbsmax() const { + return mAbsmax; +} + +void XCStaticModel_s::SetAbsmax(const float* absmax, size_t count) { + if (count <= 3) { + memcpy(mAbsmax, absmax, count * sizeof(float)); + } +} + + + diff --git a/libs/xassets/xcstaticmodels.h b/libs/xassets/xcstaticmodels.h new file mode 100644 index 0000000..28e6d96 --- /dev/null +++ b/libs/xassets/xcstaticmodels.h @@ -0,0 +1,56 @@ + + + + + + +#ifndef XCSTATICMODELS_H +#define XCSTATICMODELS_H + +#include "xasset.h" +#include "xcstaticmodelwritable.h" + +class XModel; // Forward declaration + +class XCStaticModel_s : public XAsset +{ +public: + explicit XCStaticModel_s(); + + void ParseData(QDataStream *aStream) override; + + const XCStaticModelWritable& GetWritable() const; + void SetWritable(const XCStaticModelWritable& writable); + + // Note: In a real implementation, we would have an XModel class + // For now, we'll just use a pointer to Model as a placeholder + void* GetXModel() const; + void SetXModel(void* model); + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + const float* GetInvScaledAxis() const; + void SetInvScaledAxis(const float* axis, size_t rows = 3, size_t cols = 3); + + const float* GetAbsmin() const; + void SetAbsmin(const float* absmin, size_t count = 3); + + const float* GetAbsmax() const; + void SetAbsmax(const float* absmax, size_t count = 3); + +private: + XCStaticModelWritable mWritable; + void* mXModel = nullptr; // Placeholder for Model* + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + float mInvScaledAxis[3][3] = {{0.0f}}; + float mAbsmin[3] = {0.0f, 0.0f, 0.0f}; + float mAbsmax[3] = {0.0f, 0.0f, 0.0f}; +}; + +#endif // XCSTATICMODELS_H + + + + + diff --git a/libs/xassets/xcstaticmodelwritable.cpp b/libs/xassets/xcstaticmodelwritable.cpp new file mode 100644 index 0000000..58a282a --- /dev/null +++ b/libs/xassets/xcstaticmodelwritable.cpp @@ -0,0 +1,28 @@ + + + + + + +#include "xcstaticmodelwritable.h" + +XCStaticModelWritable::XCStaticModelWritable() + : XAsset() { +} + +void XCStaticModelWritable::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mNextModelInWorldSector, sizeof(quint16)); + } +} + +quint16 XCStaticModelWritable::GetNextModelInWorldSector() const { + return mNextModelInWorldSector; +} + +void XCStaticModelWritable::SetNextModelInWorldSector(quint16 nextModel) { + mNextModelInWorldSector = nextModel; +} + + + diff --git a/libs/xassets/xcstaticmodelwritable.h b/libs/xassets/xcstaticmodelwritable.h new file mode 100644 index 0000000..a70fad4 --- /dev/null +++ b/libs/xassets/xcstaticmodelwritable.h @@ -0,0 +1,29 @@ + + + + + +#ifndef XCSTATICMODELWRITABLE_H +#define XCSTATICMODELWRITABLE_H + +#include "xasset.h" + +class XCStaticModelWritable : public XAsset +{ +public: + explicit XCStaticModelWritable(); + + void ParseData(QDataStream *aStream) override; + + quint16 GetNextModelInWorldSector() const; + void SetNextModelInWorldSector(quint16 nextModel); + +private: + quint16 mNextModelInWorldSector = 0; +}; + +#endif // XCSTATICMODELWRITABLE_H + + + + diff --git a/libs/xassets/xd3dbasetexture.cpp b/libs/xassets/xd3dbasetexture.cpp new file mode 100644 index 0000000..5eef2c4 --- /dev/null +++ b/libs/xassets/xd3dbasetexture.cpp @@ -0,0 +1,25 @@ +#include "xd3dbasetexture.h" + +XD3DBaseTexture::XD3DBaseTexture() + : XAsset() + , mMipFlush(0) + , mFormat(new XGpuTextureFetchConstant()) +{ + +} + +XD3DBaseTexture::~XD3DBaseTexture() +{ + delete mFormat; +} + +void XD3DBaseTexture::ParseData(QDataStream *aStream) +{ + +} + +void XD3DBaseTexture::Clear() +{ + mMipFlush = 0; + mFormat->Clear(); +} diff --git a/libs/xassets/xd3dbasetexture.h b/libs/xassets/xd3dbasetexture.h new file mode 100644 index 0000000..edb39d7 --- /dev/null +++ b/libs/xassets/xd3dbasetexture.h @@ -0,0 +1,22 @@ +#ifndef XD3DBASETEXTURE_H +#define XD3DBASETEXTURE_H + +#include "xasset.h" +#include "xd3dresource.h" + +class XD3DBaseTexture : public XAsset +{ +public: + XD3DBaseTexture(); + ~XD3DBaseTexture(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + unsigned int mMipFlush; + XGpuTextureFetchConstant* mFormat; + XD3DResource* mResource; +}; + +#endif // XD3DBASETEXTURE_H diff --git a/libs/xassets/xd3dcubetexture.cpp b/libs/xassets/xd3dcubetexture.cpp new file mode 100644 index 0000000..f74b2df --- /dev/null +++ b/libs/xassets/xd3dcubetexture.cpp @@ -0,0 +1,31 @@ +#include "xgfximageloaddef.h" + +XGfxImageLoadDef::XGfxImageLoadDef() + : XAsset() + , mLevelCount(0) + , mFlags(0) + , mDimensions(QVector(3)) + , mFormat(0) + , mTexture(new XGfxTexture()) +{ + +} + +XGfxImageLoadDef::~XGfxImageLoadDef() +{ + delete mTexture; +} + +void XGfxImageLoadDef::ParseData(QDataStream *aStream) +{ + +} + +void XGfxImageLoadDef::Clear() +{ + mLevelCount = 0; + mFlags = 0; + mDimensions = QVector(3); + mFormat = 0; + mTexture->Clear(); +} diff --git a/libs/xassets/xd3dcubetexture.h b/libs/xassets/xd3dcubetexture.h new file mode 100644 index 0000000..24ee35e --- /dev/null +++ b/libs/xassets/xd3dcubetexture.h @@ -0,0 +1,23 @@ +#ifndef XGFXIMAGELOADDEF_H +#define XGFXIMAGELOADDEF_H + +#include "xasset.h" + +class XGfxImageLoadDef : public XAsset +{ +public: + XGfxImageLoadDef(); + ~XGfxImageLoadDef(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mLevelCount; + quint8 mFlags; + QVector mDimensions; + int mFormat; + XGfxTexture* mTexture; +}; + +#endif // XGFXIMAGELOADDEF_H diff --git a/libs/xassets/xd3dresource.cpp b/libs/xassets/xd3dresource.cpp new file mode 100644 index 0000000..394406b --- /dev/null +++ b/libs/xassets/xd3dresource.cpp @@ -0,0 +1,39 @@ +#include "xd3dresource.h" + +XD3DResource::XD3DResource() + : XAsset() + , mCommon(0) + , mReferenceCount(0) + , mFence(0) + , mReadFence(0) + , mIdentifier(0) + , mBaseFlush(0) +{ + +} + +XD3DResource::~XD3DResource() +{ + +} + +void XD3DResource::ParseData(QDataStream *aStream) +{ + *aStream + >> mCommon + >> mReferenceCount + >> mFence + >> mReadFence + >> mIdentifier + >> mBaseFlush; +} + +void XD3DResource::Clear() +{ + mCommon = 0; + mReferenceCount = 0; + mFence = 0; + mReadFence = 0; + mIdentifier = 0; + mBaseFlush = 0; +} diff --git a/libs/xassets/xd3dresource.h b/libs/xassets/xd3dresource.h new file mode 100644 index 0000000..925ee67 --- /dev/null +++ b/libs/xassets/xd3dresource.h @@ -0,0 +1,25 @@ +#ifndef XD3DRESOURCE_H +#define XD3DRESOURCE_H + +#include "xasset.h" + +class XD3DResource : public XAsset +{ +public: + XD3DResource(); + ~XD3DResource(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + unsigned int mCommon; + unsigned int mReferenceCount; + unsigned int mFence; + unsigned int mReadFence; + unsigned int mIdentifier; + unsigned int mBaseFlush; +}; + + +#endif // XD3DRESOURCE_H diff --git a/libs/xassets/xd3dvolumetexture.cpp b/libs/xassets/xd3dvolumetexture.cpp new file mode 100644 index 0000000..f74b2df --- /dev/null +++ b/libs/xassets/xd3dvolumetexture.cpp @@ -0,0 +1,31 @@ +#include "xgfximageloaddef.h" + +XGfxImageLoadDef::XGfxImageLoadDef() + : XAsset() + , mLevelCount(0) + , mFlags(0) + , mDimensions(QVector(3)) + , mFormat(0) + , mTexture(new XGfxTexture()) +{ + +} + +XGfxImageLoadDef::~XGfxImageLoadDef() +{ + delete mTexture; +} + +void XGfxImageLoadDef::ParseData(QDataStream *aStream) +{ + +} + +void XGfxImageLoadDef::Clear() +{ + mLevelCount = 0; + mFlags = 0; + mDimensions = QVector(3); + mFormat = 0; + mTexture->Clear(); +} diff --git a/libs/xassets/xd3dvolumetexture.h b/libs/xassets/xd3dvolumetexture.h new file mode 100644 index 0000000..24ee35e --- /dev/null +++ b/libs/xassets/xd3dvolumetexture.h @@ -0,0 +1,23 @@ +#ifndef XGFXIMAGELOADDEF_H +#define XGFXIMAGELOADDEF_H + +#include "xasset.h" + +class XGfxImageLoadDef : public XAsset +{ +public: + XGfxImageLoadDef(); + ~XGfxImageLoadDef(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mLevelCount; + quint8 mFlags; + QVector mDimensions; + int mFormat; + XGfxTexture* mTexture; +}; + +#endif // XGFXIMAGELOADDEF_H diff --git a/libs/xassets/xdmaterial.cpp b/libs/xassets/xdmaterial.cpp new file mode 100644 index 0000000..f8f44a2 --- /dev/null +++ b/libs/xassets/xdmaterial.cpp @@ -0,0 +1,50 @@ + + + + + + +#include "xdmaterial.h" + +XDmaterial_t::XDmaterial_t() + : XAsset() { +} + +void XDmaterial_t::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + char material[64]; + aStream->read(material, 64); + mMaterial = QString::fromUtf8(material); + + aStream->read((char*)&mSurfaceFlags, sizeof(int)); + aStream->read((char*)&mContentFlags, sizeof(int)); + } +} + +const QString& XDmaterial_t::GetMaterial() const { + return mMaterial; +} + +void XDmaterial_t::SetMaterial(const QString& material) { + mMaterial = material; +} + +int XDmaterial_t::GetSurfaceFlags() const { + return mSurfaceFlags; +} + +void XDmaterial_t::SetSurfaceFlags(int flags) { + mSurfaceFlags = flags; +} + +int XDmaterial_t::GetContentFlags() const { + return mContentFlags; +} + +void XDmaterial_t::SetContentFlags(int flags) { + mContentFlags = flags; +} + + + + diff --git a/libs/xassets/xdmaterial.h b/libs/xassets/xdmaterial.h new file mode 100644 index 0000000..62fa94f --- /dev/null +++ b/libs/xassets/xdmaterial.h @@ -0,0 +1,40 @@ + + + + + + +#ifndef XDMATERIAL_H +#define XDMATERIAL_H + +#include "xasset.h" +#include + +class XDmaterial_t : public XAsset +{ +public: + explicit XDmaterial_t(); + + void ParseData(QDataStream *aStream) override; + + const QString& GetMaterial() const; + void SetMaterial(const QString& material); + + int GetSurfaceFlags() const; + void SetSurfaceFlags(int flags); + + int GetContentFlags() const; + void SetContentFlags(int flags); + +private: + QString mMaterial = ""; + int mSurfaceFlags = 0; + int mContentFlags = 0; +}; + +#endif // XDMATERIAL_H + + + + + diff --git a/libs/xassets/xgameworld.cpp b/libs/xassets/xgameworld.cpp new file mode 100644 index 0000000..8e74b6f --- /dev/null +++ b/libs/xassets/xgameworld.cpp @@ -0,0 +1,21 @@ + + + + +#include "xgameworld.h" + +XGameWorld::XGameWorld() + : XAsset() { +} + +void XGameWorld::ParseData(QDataStream *aStream) { + // Implement parsing logic here based on the GameWorldSp and GameWorldMp structures + + // Parse both sp and mp parts using our new classes + sp.ParseData(aStream); + mp.ParseData(aStream); + + // TODO: Add any additional parsing code if needed +} + + diff --git a/libs/xassets/xgameworld.h b/libs/xassets/xgameworld.h new file mode 100644 index 0000000..b6e49d7 --- /dev/null +++ b/libs/xassets/xgameworld.h @@ -0,0 +1,25 @@ + + + +#ifndef XGAMEWORLD_H +#define XGAMEWORLD_H + +#include "xasset.h" +#include "gameworld.h" +#include "xgameworldmp.h" +#include "xgameworldsp.h" + +class XGameWorld : public XAsset +{ +public: + explicit XGameWorld(); + + void ParseData(QDataStream *aStream) override; + +private: + XGameWorldSp sp; + XGameWorldMp mp; +}; + +#endif // XGAMEWORLD_H + diff --git a/libs/xassets/xgameworldmp.cpp b/libs/xassets/xgameworldmp.cpp new file mode 100644 index 0000000..af432d0 --- /dev/null +++ b/libs/xassets/xgameworldmp.cpp @@ -0,0 +1,25 @@ + + + +#include "xgameworldmp.h" + +XGameWorldMp::XGameWorldMp() + : XAsset() { +} + +void XGameWorldMp::ParseData(QDataStream *aStream) { + // Parse the name string + if (GetPtr() == -1) { + mName = XString::ParseCustom(aStream); + } +} + +QString XGameWorldMp::GetName() const { + return mName; +} + +void XGameWorldMp::SetName(const QString& name) { + mName = name; +} + + diff --git a/libs/xassets/xgameworldmp.h b/libs/xassets/xgameworldmp.h new file mode 100644 index 0000000..115691c --- /dev/null +++ b/libs/xassets/xgameworldmp.h @@ -0,0 +1,23 @@ + + +#ifndef XGAMEWORLDMP_H +#define XGAMEWORLDMP_H + +#include "xasset.h" + +class XGameWorldMp : public XAsset +{ +public: + explicit XGameWorldMp(); + + void ParseData(QDataStream *aStream) override; + + QString GetName() const; + void SetName(const QString& name); + +private: + QString mName; +}; + +#endif // XGAMEWORLDMP_H + diff --git a/libs/xassets/xgameworldsp.cpp b/libs/xassets/xgameworldsp.cpp new file mode 100644 index 0000000..746c385 --- /dev/null +++ b/libs/xassets/xgameworldsp.cpp @@ -0,0 +1,26 @@ + + +#include "xgameworldsp.h" + +XGameWorldSp::XGameWorldSp() + : XAsset() { +} + +void XGameWorldSp::ParseData(QDataStream *aStream) { + // Parse the name string + if (GetPtr() == -1) { + mName = XString::ParseCustom(aStream); + + // Parse the path data using our new XPathData class + path.ParseData(aStream); + } +} + +QString XGameWorldSp::GetName() const { + return mName; +} + +void XGameWorldSp::SetName(const QString& name) { + mName = name; +} + diff --git a/libs/xassets/xgameworldsp.h b/libs/xassets/xgameworldsp.h new file mode 100644 index 0000000..c80ed5c --- /dev/null +++ b/libs/xassets/xgameworldsp.h @@ -0,0 +1,26 @@ + + +#ifndef XGAMEWORLDSP_H +#define XGAMEWORLDSP_H + +#include "xasset.h" +#include "gameworld.h" +#include "xpathdata.h" + +class XGameWorldSp : public XAsset +{ +public: + explicit XGameWorldSp(); + + void ParseData(QDataStream *aStream) override; + + QString GetName() const; + void SetName(const QString& name); + +private: + QString mName; + XPathData path; // Using our new XPathData class instead of PathData struct +}; + +#endif // XGAMEWORLDSP_H + diff --git a/libs/xassets/xgfximage.cpp b/libs/xassets/xgfximage.cpp new file mode 100644 index 0000000..fe39209 --- /dev/null +++ b/libs/xassets/xgfximage.cpp @@ -0,0 +1 @@ +#include "xgfximage.h" diff --git a/libs/xassets/xgfximage.h b/libs/xassets/xgfximage.h new file mode 100644 index 0000000..bd8c1aa --- /dev/null +++ b/libs/xassets/xgfximage.h @@ -0,0 +1,31 @@ +#ifndef XGFXIMAGE_H +#define XGFXIMAGE_H + +#include "material.h" +#include "xasset.h" +#include "xcardmemory.h" + +class XGfxImage : public XAsset +{ + MapType mapType; + XGfxTexture texture; + quint8 semantic; + XCardMemory cardMemory; + quint16 width; + quint16 height; + quint16 depth; + quint8 category; + bool delayLoadPixels; + + qint32 pixelsPtr; + quint8 *pixels; + + unsigned int baseSize; + quint16 streamSlot; + bool streaming; + + qint32 namePtr; + QString name; +}; + +#endif // XGFXIMAGE_H diff --git a/libs/xassets/xgfximageloaddef.cpp b/libs/xassets/xgfximageloaddef.cpp new file mode 100644 index 0000000..f74b2df --- /dev/null +++ b/libs/xassets/xgfximageloaddef.cpp @@ -0,0 +1,31 @@ +#include "xgfximageloaddef.h" + +XGfxImageLoadDef::XGfxImageLoadDef() + : XAsset() + , mLevelCount(0) + , mFlags(0) + , mDimensions(QVector(3)) + , mFormat(0) + , mTexture(new XGfxTexture()) +{ + +} + +XGfxImageLoadDef::~XGfxImageLoadDef() +{ + delete mTexture; +} + +void XGfxImageLoadDef::ParseData(QDataStream *aStream) +{ + +} + +void XGfxImageLoadDef::Clear() +{ + mLevelCount = 0; + mFlags = 0; + mDimensions = QVector(3); + mFormat = 0; + mTexture->Clear(); +} diff --git a/libs/xassets/xgfximageloaddef.h b/libs/xassets/xgfximageloaddef.h new file mode 100644 index 0000000..24ee35e --- /dev/null +++ b/libs/xassets/xgfximageloaddef.h @@ -0,0 +1,23 @@ +#ifndef XGFXIMAGELOADDEF_H +#define XGFXIMAGELOADDEF_H + +#include "xasset.h" + +class XGfxImageLoadDef : public XAsset +{ +public: + XGfxImageLoadDef(); + ~XGfxImageLoadDef(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mLevelCount; + quint8 mFlags; + QVector mDimensions; + int mFormat; + XGfxTexture* mTexture; +}; + +#endif // XGFXIMAGELOADDEF_H diff --git a/libs/xassets/xgfxlight.cpp b/libs/xassets/xgfxlight.cpp new file mode 100644 index 0000000..55f00e1 --- /dev/null +++ b/libs/xassets/xgfxlight.cpp @@ -0,0 +1,129 @@ + + + + + + + +#include "xgfxlight.h" + +XGfxLight::XGfxLight() + : XAsset() { +} + +void XGfxLight::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mType, sizeof(unsigned char)); + aStream->read((char*)&mCanUseShadowMap, sizeof(unsigned char)); + aStream->ignore(sizeof(unsigned char) * 2); // Skip unused bytes + aStream->read((char*)mColor, 3 * sizeof(float)); + aStream->read((char*)mDir, 3 * sizeof(float)); + aStream->read((char*)mOrigin, 3 * sizeof(float)); + aStream->read((char*)&mRadius, sizeof(float)); + aStream->read((char*)&mCosHalfFovOuter, sizeof(float)); + aStream->read((char*)&mCosHalfFovInner, sizeof(float)); + aStream->read((char*)&mExponent, sizeof(int)); + + // Skip spotShadowIndex - we'll handle this appropriately later + aStream->ignore(sizeof(unsigned int)); + + // Skip def pointer - we'll handle this appropriately later + aStream->ignore(sizeof(int)); + } +} + +unsigned char XGfxLight::GetType() const { + return mType; +} + +void XGfxLight::SetType(unsigned char type) { + mType = type; +} + +unsigned char XGfxLight::CanUseShadowMap() const { + return mCanUseShadowMap; +} + +void XGfxLight::SetCanUseShadowMap(bool canUse) { + mCanUseShadowMap = canUse ? 1 : 0; +} + +const float* XGfxLight::GetColor() const { + return mColor; +} + +void XGfxLight::SetColor(const float* color, size_t count) { + if (count <= 3) { + memcpy(mColor, color, count * sizeof(float)); + } +} + +const float* XGfxLight::GetDir() const { + return mDir; +} + +void XGfxLight::SetDir(const float* dir, size_t count) { + if (count <= 3) { + memcpy(mDir, dir, count * sizeof(float)); + } +} + +const float* XGfxLight::GetOrigin() const { + return mOrigin; +} + +void XGfxLight::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +float XGfxLight::GetRadius() const { + return mRadius; +} + +void XGfxLight::SetRadius(float radius) { + mRadius = radius; +} + +float XGfxLight::GetCosHalfFovOuter() const { + return mCosHalfFovOuter; +} + +void XGfxLight::SetCosHalfFovOuter(float cosHalfFov) { + mCosHalfFovOuter = cosHalfFov; +} + +float XGfxLight::GetCosHalfFovInner() const { + return mCosHalfFovInner; +} + +void XGfxLight::SetCosHalfFovInner(float cosHalfFov) { + mCosHalfFovInner = cosHalfFov; +} + +int XGfxLight::GetExponent() const { + return mExponent; +} + +void XGfxLight::SetExponent(int exponent) { + mExponent = exponent; +} + +unsigned int XGfxLight::GetSpotShadowIndex() const { + return mSpotShadowIndex; +} + +void XGfxLight::SetSpotShadowIndex(unsigned int index) { + mSpotShadowIndex = index; +} + +int XGfxLight::GetDefPtr() const { + return mDefPtr; +} + +void XGfxLight::SetDefPtr(int ptr) { + mDefPtr = ptr; +} + + diff --git a/libs/xassets/xgfxlight.h b/libs/xassets/xgfxlight.h new file mode 100644 index 0000000..b49bbb9 --- /dev/null +++ b/libs/xassets/xgfxlight.h @@ -0,0 +1,79 @@ + + + + + + + + + +#ifndef XGFXLIGHT_H +#define XGFXLIGHT_H + +#include "xasset.h" + +class XGfxLight : public XAsset +{ +public: + explicit XGfxLight(); + + void ParseData(QDataStream *aStream) override; + + unsigned char GetType() const; + void SetType(unsigned char type); + + unsigned char CanUseShadowMap() const; + void SetCanUseShadowMap(bool canUse); + + const float* GetColor() const; + void SetColor(const float* color, size_t count = 3); + + const float* GetDir() const; + void SetDir(const float* dir, size_t count = 3); + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + float GetRadius() const; + void SetRadius(float radius); + + float GetCosHalfFovOuter() const; + void SetCosHalfFovOuter(float cosHalfFov); + + float GetCosHalfFovInner() const; + void SetCosHalfFovInner(float cosHalfFov); + + int GetExponent() const; + void SetExponent(int exponent); + + unsigned int GetSpotShadowIndex() const; + void SetSpotShadowIndex(unsigned int index); + + // Note: XGfxLightDef is a placeholder - we need to handle this appropriately + int GetDefPtr() const; + void SetDefPtr(int ptr); + +private: + unsigned char mType = 0; + unsigned char mCanUseShadowMap = 0; + unsigned char mUnused[2] = {0, 0}; + float mColor[3] = {0.0f, 0.0f, 0.0f}; + float mDir[3] = {0.0f, 0.0f, 0.0f}; + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + float mRadius = 0.0f; + float mCosHalfFovOuter = 0.0f; + float mCosHalfFovInner = 0.0f; + int mExponent = 0; + unsigned int mSpotShadowIndex = 0; + int mDefPtr = 0; // Placeholder for XGfxLightDef pointer +}; + +#endif // XGFXLIGHT_H + + + + + + + + diff --git a/libs/xassets/xgfxlightdef.cpp b/libs/xassets/xgfxlightdef.cpp new file mode 100644 index 0000000..5379a2c --- /dev/null +++ b/libs/xassets/xgfxlightdef.cpp @@ -0,0 +1,34 @@ +#include "xgfxlightdef.h" + +XGfxLightDef::XGfxLightDef() + : XAsset() + , mName(new XString()) + , mAttenuation(new XGfxLightImage()) + , mLmapLookupStart(0) +{ + +} + +XGfxLightDef::~XGfxLightDef() +{ + delete mName; + delete mAttenuation; +} + +void XGfxLightDef::Clear() +{ + mName->Clear(); + mAttenuation->Clear(); + mLmapLookupStart = 0; +} + +void XGfxLightDef::ParseData(QDataStream *aStream) +{ + mName->ParsePtr(aStream, false); + mAttenuation->ParseData(aStream); + *aStream >> mLmapLookupStart; + + mName->ParseData(aStream); + + //mAttenuation-> +} diff --git a/libs/xassets/xgfxlightdef.h b/libs/xassets/xgfxlightdef.h new file mode 100644 index 0000000..bce6c77 --- /dev/null +++ b/libs/xassets/xgfxlightdef.h @@ -0,0 +1,23 @@ +#ifndef XGFXLIGHTDEF_H +#define XGFXLIGHTDEF_H + +#include "xasset.h" +#include "xgfxlightimage.h" +#include "xstring.h" + +struct XGfxLightDef : public XAsset +{ +public: + XGfxLightDef(); + ~XGfxLightDef(); + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + XString* mName; + XGfxLightImage* mAttenuation; + int mLmapLookupStart; +}; + +#endif // XGFXLIGHTDEF_H diff --git a/libs/xassets/xgfxlightimage.cpp b/libs/xassets/xgfxlightimage.cpp new file mode 100644 index 0000000..44c1e7e --- /dev/null +++ b/libs/xassets/xgfxlightimage.cpp @@ -0,0 +1,31 @@ +#include "xgfxlightimage.h" + +XGfxLightImage::XGfxLightImage() + : XAsset() + , mImage(new XGfxImage()) + , mSamplerState(0) +{ + +} + +XGfxLightImage::~XGfxLightImage() +{ + delete mImage; +} + +void XGfxLightImage::ParseData(QDataStream *aStream) +{ + mImage->ParsePtr(aStream, false); + + *aStream >> mSamplerState; + + aStream->skipRawData(3); + + mImage->ParseData(aStream); +} + +void XGfxLightImage::Clear() +{ + mImage->Clear(); + mSamplerState = 0; +} diff --git a/libs/xassets/xgfxlightimage.h b/libs/xassets/xgfxlightimage.h new file mode 100644 index 0000000..7e5a64e --- /dev/null +++ b/libs/xassets/xgfxlightimage.h @@ -0,0 +1,21 @@ +#ifndef XGFXLIGHTIMAGE_H +#define XGFXLIGHTIMAGE_H + +#include "xgfximage.h" +#include "xasset.h" + +class XGfxLightImage : public XAsset +{ +public: + XGfxLightImage(); + ~XGfxLightImage(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XGfxImage* mImage; + quint8 mSamplerState; +}; + +#endif // XGFXLIGHTIMAGE_H diff --git a/libs/xassets/xgfxreflectionprobe.cpp b/libs/xassets/xgfxreflectionprobe.cpp new file mode 100644 index 0000000..7a24305 --- /dev/null +++ b/libs/xassets/xgfxreflectionprobe.cpp @@ -0,0 +1,48 @@ + + + + + + +#include "xgfxreflectionprobe.h" + +XGfxReflectionProbe::XGfxReflectionProbe() + : XAsset() { +} + +void XGfxReflectionProbe::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mOrigin, 3 * sizeof(float)); + aStream->read((char*)&mRadius, sizeof(float)); + aStream->read((char*)&mFlags, sizeof(int)); + } +} + +const float* XGfxReflectionProbe::GetOrigin() const { + return mOrigin; +} + +void XGfxReflectionProbe::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +float XGfxReflectionProbe::GetRadius() const { + return mRadius; +} + +void XGfxReflectionProbe::SetRadius(float radius) { + mRadius = radius; +} + +int XGfxReflectionProbe::GetFlags() const { + return mFlags; +} + +void XGfxReflectionProbe::SetFlags(int flags) { + mFlags = flags; +} + + + diff --git a/libs/xassets/xgfxreflectionprobe.h b/libs/xassets/xgfxreflectionprobe.h new file mode 100644 index 0000000..d0107db --- /dev/null +++ b/libs/xassets/xgfxreflectionprobe.h @@ -0,0 +1,47 @@ + + + + + + + + + + +#ifndef XGFXREFLECTIONPROBE_H +#define XGFXREFLECTIONPROBE_H + +#include "xasset.h" + +class XGfxReflectionProbe : public XAsset +{ +public: + explicit XGfxReflectionProbe(); + + void ParseData(QDataStream *aStream) override; + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + float GetRadius() const; + void SetRadius(float radius); + + int GetFlags() const; + void SetFlags(int flags); + +private: + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + float mRadius = 0.0f; + int mFlags = 0; +}; + +#endif // XGFXREFLECTIONPROBE_H + + + + + + + + + diff --git a/libs/xassets/xgfxstreamingaabbtree.cpp b/libs/xassets/xgfxstreamingaabbtree.cpp new file mode 100644 index 0000000..e53e12c --- /dev/null +++ b/libs/xassets/xgfxstreamingaabbtree.cpp @@ -0,0 +1,79 @@ + + + + + + +#include "xgfxstreamingaabbtree.h" + +XGfxStreamingAabbTree::XGfxStreamingAabbTree() + : XAsset() { +} + +void XGfxStreamingAabbTree::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mFirstItem, sizeof(unsigned short)); + aStream->read((char*)&mItemCount, sizeof(unsigned short)); + aStream->read((char*)&mFirstChild, sizeof(unsigned short)); + aStream->read((char*)&mChildCount, sizeof(unsigned short)); + aStream->read((char*)mMins, 3 * sizeof(float)); + aStream->read((char*)mMaxs, 3 * sizeof(float)); + } +} + +unsigned short XGfxStreamingAabbTree::GetFirstItem() const { + return mFirstItem; +} + +void XGfxStreamingAabbTree::SetFirstItem(unsigned short item) { + mFirstItem = item; +} + +unsigned short XGfxStreamingAabbTree::GetItemCount() const { + return mItemCount; +} + +void XGfxStreamingAabbTree::SetItemCount(unsigned short count) { + mItemCount = count; +} + +unsigned short XGfxStreamingAabbTree::GetFirstChild() const { + return mFirstChild; +} + +void XGfxStreamingAabbTree::SetFirstChild(unsigned short child) { + mFirstChild = child; +} + +unsigned short XGfxStreamingAabbTree::GetChildCount() const { + return mChildCount; +} + +void XGfxStreamingAabbTree::SetChildCount(unsigned short count) { + mChildCount = count; +} + +const float* XGfxStreamingAabbTree::GetMins() const { + return mMins; +} + +void XGfxStreamingAabbTree::SetMins(const float* mins, size_t count) { + if (count <= 3) { + memcpy(mMins, mins, count * sizeof(float)); + } +} + +const float* XGfxStreamingAabbTree::GetMaxs() const { + return mMaxs; +} + +void XGfxStreamingAabbTree::SetMaxs(const float* maxs, size_t count) { + if (count <= 3) { + memcpy(mMaxs, maxs, count * sizeof(float)); + } +} + + + + + diff --git a/libs/xassets/xgfxstreamingaabbtree.h b/libs/xassets/xgfxstreamingaabbtree.h new file mode 100644 index 0000000..c2ab084 --- /dev/null +++ b/libs/xassets/xgfxstreamingaabbtree.h @@ -0,0 +1,53 @@ + + + + + + + +#ifndef XGFXSTREAMINGAABBTREE_H +#define XGFXSTREAMINGAABBTREE_H + +#include "xasset.h" + +class XGfxStreamingAabbTree : public XAsset +{ +public: + explicit XGfxStreamingAabbTree(); + + void ParseData(QDataStream *aStream) override; + + unsigned short GetFirstItem() const; + void SetFirstItem(unsigned short item); + + unsigned short GetItemCount() const; + void SetItemCount(unsigned short count); + + unsigned short GetFirstChild() const; + void SetFirstChild(unsigned short child); + + unsigned short GetChildCount() const; + void SetChildCount(unsigned short count); + + const float* GetMins() const; + void SetMins(const float* mins, size_t count = 3); + + const float* GetMaxs() const; + void SetMaxs(const float* maxs, size_t count = 3); + +private: + unsigned short mFirstItem = 0; + unsigned short mItemCount = 0; + unsigned short mFirstChild = 0; + unsigned short mChildCount = 0; + float mMins[3] = {0.0f, 0.0f, 0.0f}; + float mMaxs[3] = {0.0f, 0.0f, 0.0f}; +}; + +#endif // XGFXSTREAMINGAABBTREE_H + + + + + + diff --git a/libs/xassets/xgfxtexture.cpp b/libs/xassets/xgfxtexture.cpp new file mode 100644 index 0000000..a8426d1 --- /dev/null +++ b/libs/xassets/xgfxtexture.cpp @@ -0,0 +1,21 @@ +#include "xsoundfile.h" + +XSoundFile::XSoundFile() +{ + +} + +XSoundFile::~XSoundFile() +{ + +} + +void XSoundFile::ParseData(QDataStream *aStream) +{ + +} + +void XSoundFile::Clear() +{ + +} diff --git a/libs/xassets/xgfxtexture.h b/libs/xassets/xgfxtexture.h new file mode 100644 index 0000000..441be36 --- /dev/null +++ b/libs/xassets/xgfxtexture.h @@ -0,0 +1,24 @@ +#ifndef XGFXTEXTURE_H +#define XGFXTEXTURE_H + +#include "xasset.h" +#include "xgfximageloaddef.h" + +class XGfxTexture : public XAsset +{ +public: + XGfxTexture(); + ~XGfxTexture(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XD3DBaseTexture* mBaseMap; + XD3DTexture* mMap; + XD3DVolumeTexture* mVolMap; + XD3DCubeTexture* mCubeMap; + XGfxImageLoadDef* mLoadDef; +}; + +#endif // XGFXTEXTURE_H diff --git a/libs/xassets/xgfxworld.cpp b/libs/xassets/xgfxworld.cpp new file mode 100644 index 0000000..29c9344 --- /dev/null +++ b/libs/xassets/xgfxworld.cpp @@ -0,0 +1,117 @@ + + + + + + + +#include "xgfxworld.h" + +XGfxWorld::XGfxWorld() + : XAsset() { +} + +void XGfxWorld::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read(mName, 64 * sizeof(char)); + + // Parse streaming info + mStreamingInfo.ParseData(aStream); + + // Parse vertex data + mVertexData.ParseData(aStream); + + // Parse sun light params + mSunLightParams.ParseData(aStream); + + // Parse lights count and array + int lightCount; + aStream->read((char*)&lightCount, sizeof(int)); + for (int i = 0; i < lightCount; ++i) { + XGfxLight light; + light.ParseData(aStream); + mLights.append(light); + } + + // Parse reflection probes count and array + int probeCount; + aStream->read((char*)&probeCount, sizeof(int)); + for (int i = 0; i < probeCount; ++i) { + XGfxReflectionProbe probe; + probe.ParseData(aStream); + mReflectionProbes.append(probe); + } + } +} + +const char* XGfxWorld::GetName() const { + return mName; +} + +void XGfxWorld::SetName(const char* name) { + strncpy(mName, name, 64); +} + +XGfxWorldStreamInfo& XGfxWorld::GetStreamingInfo() { + return mStreamingInfo; +} + +const XGfxWorldStreamInfo& XGfxWorld::GetStreamingInfo() const { + return mStreamingInfo; +} + +void XGfxWorld::SetStreamingInfo(const XGfxWorldStreamInfo& info) { + mStreamingInfo = info; +} + +XGfxWorldVertexData& XGfxWorld::GetVertexData() { + return mVertexData; +} + +const XGfxWorldVertexData& XGfxWorld::GetVertexData() const { + return mVertexData; +} + +void XGfxWorld::SetVertexData(const XGfxWorldVertexData& data) { + mVertexData = data; +} + +XSunLightParseParams& XGfxWorld::GetSunLightParams() { + return mSunLightParams; +} + +const XSunLightParseParams& XGfxWorld::GetSunLightParams() const { + return mSunLightParams; +} + +void XGfxWorld::SetSunLightParams(const XSunLightParseParams& params) { + mSunLightParams = params; +} + +QVector& XGfxWorld::GetLights() { + return mLights; +} + +const QVector& XGfxWorld::GetLights() const { + return mLights; +} + +void XGfxWorld::SetLights(const QVector& lights) { + mLights = lights; +} + +QVector& XGfxWorld::GetReflectionProbes() { + return mReflectionProbes; +} + +const QVector& XGfxWorld::GetReflectionProbes() const { + return mReflectionProbes; +} + +void XGfxWorld::SetReflectionProbes(const QVector& probes) { + mReflectionProbes = probes; +} + + + + diff --git a/libs/xassets/xgfxworld.h b/libs/xassets/xgfxworld.h new file mode 100644 index 0000000..0b8c7ce --- /dev/null +++ b/libs/xassets/xgfxworld.h @@ -0,0 +1,71 @@ + + + + + + + + + + + +#ifndef XGFXWORLD_H +#define XGFXWORLD_H + +#include "xasset.h" +#include "xgfxworldstreaminfo.h" +#include "xgfxworldvertexdata.h" +#include "xsunlightparseparams.h" +#include "xgfxlight.h" +#include "xgfxreflectionprobe.h" + +class XGfxWorld : public XAsset +{ +public: + explicit XGfxWorld(); + + void ParseData(QDataStream *aStream) override; + + const char* GetName() const; + void SetName(const char* name); + + XGfxWorldStreamInfo& GetStreamingInfo(); + const XGfxWorldStreamInfo& GetStreamingInfo() const; + void SetStreamingInfo(const XGfxWorldStreamInfo& info); + + XGfxWorldVertexData& GetVertexData(); + const XGfxWorldVertexData& GetVertexData() const; + void SetVertexData(const XGfxWorldVertexData& data); + + XSunLightParseParams& GetSunLightParams(); + const XSunLightParseParams& GetSunLightParams() const; + void SetSunLightParams(const XSunLightParseParams& params); + + QVector& GetLights(); + const QVector& GetLights() const; + void SetLights(const QVector& lights); + + QVector& GetReflectionProbes(); + const QVector& GetReflectionProbes() const; + void SetReflectionProbes(const QVector& probes); + +private: + char mName[64] = {0}; + XGfxWorldStreamInfo mStreamingInfo; + XGfxWorldVertexData mVertexData; + XSunLightParseParams mSunLightParams; + QVector mLights; + QVector mReflectionProbes; +}; + +#endif // XGFXWORLD_H + + + + + + + + + + diff --git a/libs/xassets/xgfxworldstreaminfo.cpp b/libs/xassets/xgfxworldstreaminfo.cpp new file mode 100644 index 0000000..3387516 --- /dev/null +++ b/libs/xassets/xgfxworldstreaminfo.cpp @@ -0,0 +1,77 @@ + + + + + + +#include "xgfxworldstreaminfo.h" + +XGfxWorldStreamInfo::XGfxWorldStreamInfo() + : XAsset() { +} + +void XGfxWorldStreamInfo::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mAabbTreeCount, sizeof(int)); + + // Clear existing data before parsing new data + mAabbTrees.clear(); + + // Parse AABB trees + for (int i = 0; i < mAabbTreeCount; ++i) { + XGfxStreamingAabbTree tree; + tree.ParseData(aStream); + mAabbTrees.append(tree); + } + + // Parse leaf ref count and array + aStream->read((char*)&mLeafRefCount, sizeof(int)); + if (mLeafRefCount > 0) { + mLeafRefs.resize(mLeafRefCount); + aStream->read((char*)mLeafRefs.data(), mLeafRefCount * sizeof(int)); + } + } +} + +int XGfxWorldStreamInfo::GetAabbTreeCount() const { + return mAabbTreeCount; +} + +void XGfxWorldStreamInfo::SetAabbTreeCount(int count) { + mAabbTreeCount = count; +} + +QVector& XGfxWorldStreamInfo::GetAabbTrees() { + return mAabbTrees; +} + +const QVector& XGfxWorldStreamInfo::GetAabbTrees() const { + return mAabbTrees; +} + +void XGfxWorldStreamInfo::SetAabbTrees(const QVector& trees) { + mAabbTrees = trees; +} + +int XGfxWorldStreamInfo::GetLeafRefCount() const { + return mLeafRefCount; +} + +void XGfxWorldStreamInfo::SetLeafRefCount(int count) { + mLeafRefCount = count; +} + +QVector& XGfxWorldStreamInfo::GetLeafRefs() { + return mLeafRefs; +} + +const QVector& XGfxWorldStreamInfo::GetLeafRefs() const { + return mLeafRefs; +} + +void XGfxWorldStreamInfo::SetLeafRefs(const QVector& refs) { + mLeafRefs = refs; +} + + + diff --git a/libs/xassets/xgfxworldstreaminfo.h b/libs/xassets/xgfxworldstreaminfo.h new file mode 100644 index 0000000..be100a3 --- /dev/null +++ b/libs/xassets/xgfxworldstreaminfo.h @@ -0,0 +1,52 @@ + + + + + + + + +#ifndef XGFXWORLDSTREAMINFO_H +#define XGFXWORLDSTREAMINFO_H + +#include "xasset.h" +#include "xgfxstreamingaabbtree.h" + +class XGfxWorldStreamInfo : public XAsset +{ +public: + explicit XGfxWorldStreamInfo(); + + void ParseData(QDataStream *aStream) override; + + int GetAabbTreeCount() const; + void SetAabbTreeCount(int count); + + QVector& GetAabbTrees(); + const QVector& GetAabbTrees() const; + void SetAabbTrees(const QVector& trees); + + int GetLeafRefCount() const; + void SetLeafRefCount(int count); + + QVector& GetLeafRefs(); + const QVector& GetLeafRefs() const; + void SetLeafRefs(const QVector& refs); + +private: + int mAabbTreeCount = 0; + QVector mAabbTrees; + + int mLeafRefCount = 0; + QVector mLeafRefs; +}; + +#endif // XGFXWORLDSTREAMINFO_H + + + + + + + + diff --git a/libs/xassets/xgfxworldvertex.cpp b/libs/xassets/xgfxworldvertex.cpp new file mode 100644 index 0000000..6e4777f --- /dev/null +++ b/libs/xassets/xgfxworldvertex.cpp @@ -0,0 +1,104 @@ + + + + + + + +#include "xgfxworldvertex.h" + +XGfxWorldVertex::XGfxWorldVertex() + : XAsset() { +} + +void XGfxWorldVertex::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mXYZ, 3 * sizeof(float)); + aStream->read((char*)&mBinormalSign, sizeof(float)); + + // Read color components + quint8 r, g, b, a; + aStream->read((char*)&r, sizeof(quint8)); + aStream->read((char*)&g, sizeof(quint8)); + aStream->read((char*)&b, sizeof(quint8)); + aStream->read((char*)&a, sizeof(quint8)); + mColor.r = r; + mColor.g = g; + mColor.b = b; + mColor.a = a; + + // Read texture coordinates + aStream->read((char*)mTexCoord, 2 * sizeof(float)); + aStream->read((char*)mLmapCoord, 2 * sizeof(float)); + + // Read normal and tangent (assuming they're PackedUnitVec) + mNormal.ParseData(aStream); + mTangent.ParseData(aStream); + } +} + +const float* XGfxWorldVertex::GetXYZ() const { + return mXYZ; +} + +void XGfxWorldVertex::SetXYZ(const float* xyz, size_t count) { + if (count <= 3) { + memcpy(mXYZ, xyz, count * sizeof(float)); + } +} + +float XGfxWorldVertex::GetBinormalSign() const { + return mBinormalSign; +} + +void XGfxWorldVertex::SetBinormalSign(float sign) { + mBinormalSign = sign; +} + +const GfxColor& XGfxWorldVertex::GetColor() const { + return mColor; +} + +void XGfxWorldVertex::SetColor(const GfxColor& color) { + mColor = color; +} + +const float* XGfxWorldVertex::GetTexCoord() const { + return mTexCoord; +} + +void XGfxWorldVertex::SetTexCoord(const float* texCoord, size_t count) { + if (count <= 2) { + memcpy(mTexCoord, texCoord, count * sizeof(float)); + } +} + +const float* XGfxWorldVertex::GetLmapCoord() const { + return mLmapCoord; +} + +void XGfxWorldVertex::SetLmapCoord(const float* lmapCoord, size_t count) { + if (count <= 2) { + memcpy(mLmapCoord, lmapCoord, count * sizeof(float)); + } +} + +const PackedUnitVec& XGfxWorldVertex::GetNormal() const { + return mNormal; +} + +void XGfxWorldVertex::SetNormal(const PackedUnitVec& normal) { + mNormal = normal; +} + +const PackedUnitVec& XGfxWorldVertex::GetTangent() const { + return mTangent; +} + +void XGfxWorldVertex::SetTangent(const PackedUnitVec& tangent) { + mTangent = tangent; +} + + + + diff --git a/libs/xassets/xgfxworldvertex.h b/libs/xassets/xgfxworldvertex.h new file mode 100644 index 0000000..740d4c1 --- /dev/null +++ b/libs/xassets/xgfxworldvertex.h @@ -0,0 +1,61 @@ + + + + + + + + + +#ifndef XGFXWORLDVERTEX_H +#define XGFXWORLDVERTEX_H + +#include "xasset.h" + +class XGfxWorldVertex : public XAsset +{ +public: + explicit XGfxWorldVertex(); + + void ParseData(QDataStream *aStream) override; + + const float* GetXYZ() const; + void SetXYZ(const float* xyz, size_t count = 3); + + float GetBinormalSign() const; + void SetBinormalSign(float sign); + + const GfxColor& GetColor() const; + void SetColor(const GfxColor& color); + + const float* GetTexCoord() const; + void SetTexCoord(const float* texCoord, size_t count = 2); + + const float* GetLmapCoord() const; + void SetLmapCoord(const float* lmapCoord, size_t count = 2); + + const PackedUnitVec& GetNormal() const; + void SetNormal(const PackedUnitVec& normal); + + const PackedUnitVec& GetTangent() const; + void SetTangent(const PackedUnitVec& tangent); + +private: + float mXYZ[3] = {0.0f, 0.0f, 0.0f}; + float mBinormalSign = 0.0f; + GfxColor mColor = {0, 0, 0, 255}; // Default to black with full alpha + float mTexCoord[2] = {0.0f, 0.0f}; + float mLmapCoord[2] = {0.0f, 0.0f}; + PackedUnitVec mNormal; + PackedUnitVec mTangent; +}; + +#endif // XGFXWORLDVERTEX_H + + + + + + + + diff --git a/libs/xassets/xgfxworldvertexdata.cpp b/libs/xassets/xgfxworldvertexdata.cpp new file mode 100644 index 0000000..602aa25 --- /dev/null +++ b/libs/xassets/xgfxworldvertexdata.cpp @@ -0,0 +1,53 @@ + + + + + + +#include "xgfxworldvertexdata.h" + +XGfxWorldVertexData::XGfxWorldVertexData() + : XAsset() { +} + +void XGfxWorldVertexData::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // Parse vertex count + int vertexCount; + aStream->read((char*)&vertexCount, sizeof(int)); + + // Clear existing data before parsing new data + mVertices.clear(); + + // Parse vertices + for (int i = 0; i < vertexCount; ++i) { + XGfxWorldVertex vertex; + vertex.ParseData(aStream); + mVertices.append(vertex); + } + + // Skip D3DVertexBuffer pointer - we'll handle this appropriately later + aStream->ignore(sizeof(int)); + } +} + +QVector& XGfxWorldVertexData::GetVertices() { + return mVertices; +} + +const QVector& XGfxWorldVertexData::GetVertices() const { + return mVertices; +} + +void XGfxWorldVertexData::SetVertices(const QVector& vertices) { + mVertices = vertices; +} + +int XGfxWorldVertexData::GetVertexBufferPtr() const { + return mVertexBufferPtr; +} + +void XGfxWorldVertexData::SetVertexBufferPtr(int ptr) { + mVertexBufferPtr = ptr; +} + diff --git a/libs/xassets/xgfxworldvertexdata.h b/libs/xassets/xgfxworldvertexdata.h new file mode 100644 index 0000000..79b8954 --- /dev/null +++ b/libs/xassets/xgfxworldvertexdata.h @@ -0,0 +1,44 @@ + + + + + + + + + +#ifndef XGFXWORLDVERTEXDATA_H +#define XGFXWORLDVERTEXDATA_H + +#include "xasset.h" +#include "xgfxworldvertex.h" + +class XGfxWorldVertexData : public XAsset +{ +public: + explicit XGfxWorldVertexData(); + + void ParseData(QDataStream *aStream) override; + + QVector& GetVertices(); + const QVector& GetVertices() const; + void SetVertices(const QVector& vertices); + + // Note: D3DVertexBuffer is a placeholder - we need to handle this appropriately + int GetVertexBufferPtr() const; + void SetVertexBufferPtr(int ptr); + +private: + QVector mVertices; // Using QVector for automatic memory management + int mVertexBufferPtr = 0; // Placeholder for D3DVertexBuffer pointer +}; + +#endif // XGFXWORLDVERTEXDATA_H + + + + + + + + diff --git a/libs/xassets/xgputexturefetchconstant.cpp b/libs/xassets/xgputexturefetchconstant.cpp new file mode 100644 index 0000000..ef1333f --- /dev/null +++ b/libs/xassets/xgputexturefetchconstant.cpp @@ -0,0 +1,23 @@ +#include "xcardmemory.h" + +XCardMemory::XCardMemory() + : XAsset() + , mPlatform(0) +{ + +} + +XCardMemory::~XCardMemory() +{ + +} + +void XCardMemory::ParseData(QDataStream *aStream) +{ + *aStream >> mPlatform; +} + +void XCardMemory::Clear() +{ + mPlatform = 0; +} diff --git a/libs/xassets/xgputexturefetchconstant.h b/libs/xassets/xgputexturefetchconstant.h new file mode 100644 index 0000000..789326d --- /dev/null +++ b/libs/xassets/xgputexturefetchconstant.h @@ -0,0 +1,68 @@ +#ifndef XGPUTEXTUREFETCHCONSTANT_H +#define XGPUTEXTUREFETCHCONSTANT_H + +#include "xasset.h" + +class XGpuTextureFetchConstant : public XAsset +{ +public: + XGpuTextureFetchConstant(); + ~XGpuTextureFetchConstant(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint32 mType; + quint32 mSignX; + quint32 mSignY; + quint32 mSignZ; + quint32 mSignW; + quint32 mClampX; + quint32 mClampY; + quint32 mClampZ; + quint32 mPitch; + quint32 mTiled; + quint32 mDataFormat; + quint32 mEndian; + quint32 mRequestSize; + quint32 mStacked; + quint32 mClampPolicy; + quint32 mBaseAddress; + union + { + GPUTEXTURESIZE_1D mOneD; + GPUTEXTURESIZE_2D mTwoD; + GPUTEXTURESIZE_3D mThreeD; + GPUTEXTURESIZE_STACK mStack; + } mSize; + quint32 mNumFormat; + quint32 mSwizzleX; + quint32 mSwizzleY; + quint32 mSwizzleZ; + quint32 mSwizzleW; + qint32 mExpAdjust; + quint32 mMagFilter; + quint32 mMinFilter; + quint32 mMipFilter; + quint32 mAnisoFilter; + quint32 mBorderSize; + quint32 mVolMagFilter; + quint32 mVolMinFilter; + quint32 mMinMipLevel; + quint32 mMaxMipLevel; + quint32 mMagAnisoWalk; + quint32 mMinAnisoWalk; + qint32 mLODBias; + qint32 mGradExpAdjustH; + qint32 mGradExpAdjustV; + quint32 mBorderColor; + quint32 mForceBCWToMax; + quint32 mTriClamp; + qint32 mAnisoBias; + quint32 mDimension; + quint32 mPackedMips; + quint32 mMipAddress; +}; + +#endif // XGPUTEXTUREFETCHCONSTANT_H diff --git a/libs/xassets/xgputexturefetchconstantraw.cpp b/libs/xassets/xgputexturefetchconstantraw.cpp new file mode 100644 index 0000000..ef1333f --- /dev/null +++ b/libs/xassets/xgputexturefetchconstantraw.cpp @@ -0,0 +1,23 @@ +#include "xcardmemory.h" + +XCardMemory::XCardMemory() + : XAsset() + , mPlatform(0) +{ + +} + +XCardMemory::~XCardMemory() +{ + +} + +void XCardMemory::ParseData(QDataStream *aStream) +{ + *aStream >> mPlatform; +} + +void XCardMemory::Clear() +{ + mPlatform = 0; +} diff --git a/libs/xassets/xgputexturefetchconstantraw.h b/libs/xassets/xgputexturefetchconstantraw.h new file mode 100644 index 0000000..47481fc --- /dev/null +++ b/libs/xassets/xgputexturefetchconstantraw.h @@ -0,0 +1,19 @@ +#ifndef XGPUTEXTUREFETCHCONSTANT_H +#define XGPUTEXTUREFETCHCONSTANT_H + +#include "xasset.h" + +class XGpuTextureFetchConstant : public XAsset +{ +public: + XGpuTextureFetchConstant(); + ~XGpuTextureFetchConstant(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + int mPlatform; +}; + +#endif // XGPUTEXTUREFETCHCONSTANT_H diff --git a/libs/xassets/xmenudef.cpp b/libs/xassets/xmenudef.cpp new file mode 100644 index 0000000..393fb8d --- /dev/null +++ b/libs/xassets/xmenudef.cpp @@ -0,0 +1,46 @@ +#include "xmenudef.h" + +XMenuDef::XMenuDef() + : XAsset() + , mWindow() + , mFont() + , mFullScreen() + , mItemCount() + , mFontIndex() + , mCursorItem() + , mFadeCycle() + , mFadeClamp() + , mFadeAmount() + , mFadeInAmount() + , mBlurRadius() + , mOnOpen() + , mOnClose() + , mOnESC() + , mOnKey() + , mVisibleExp() + , mAllowedBinding() + , mSoundName() + , mImageTrack() + , mFocusColor() + , mDisableColor() + , mRectXExp() + , mRectYExp() + , mItems() +{ + +} + +XMenuDef::~XMenuDef() +{ + +} + +void XMenuDef::Clear() +{ + +} + +void XMenuDef::ParseData(QDataStream *aStream) +{ + +} diff --git a/libs/xassets/menudef.h b/libs/xassets/xmenudef.h similarity index 68% rename from libs/xassets/menudef.h rename to libs/xassets/xmenudef.h index 4e297c4..a3428b2 100644 --- a/libs/xassets/menudef.h +++ b/libs/xassets/xmenudef.h @@ -1,10 +1,14 @@ -#ifndef MENUDEF_H -#define MENUDEF_H +#ifndef XMENUDEF_H +#define XMENUDEF_H -#include "soundalias.h" -#include "material.h" +#include "qcolor.h" +#include "xsoundalias.h" +#include "xasset.h" +#include "xsoundaliaslist.h" -struct rectDef_s +class XMaterial; + +struct XRectDef { float x; float y; @@ -14,11 +18,11 @@ struct rectDef_s int vertAlign; }; -struct windowDef_t +struct XWindowDef { const char *name; - rectDef_s rect; - rectDef_s rectClient; + XRectDef rect; + XRectDef rectClient; const char *group; int style; int border; @@ -32,17 +36,17 @@ struct windowDef_t float backColor[4]; float borderColor[4]; float outlineColor[4]; - Material *background; + XMaterial *background; }; -struct ItemKeyHandler +struct XItemKeyHandler { int key; const char *action; - ItemKeyHandler *next; + XItemKeyHandler *next; }; -enum OperationEnum : __int32 +enum XOperationEnum : __int32 { OP_NOOP = 0x0, OP_RIGHTPAREN = 0x1, @@ -128,45 +132,45 @@ enum OperationEnum : __int32 NUM_OPERATORS = 0x50, }; -enum expDataType : __int32 +enum XExpDataType : __int32 { VAL_INT = 0x0, VAL_FLOAT = 0x1, VAL_STRING = 0x2, }; -union OperandInternalDataUnion +union XOperandInternalDataUnion { int intVal; float floatVal; const char *string; }; -struct Operand +struct XOperand { - expDataType dataType; - OperandInternalDataUnion internals; + XExpDataType dataType; + XOperandInternalDataUnion internals; }; union entryInternalData { OperationEnum op; - Operand operand; + XOperand operand; }; -struct expressionEntry +struct XExpressionEntry { int type; entryInternalData data; }; -struct statement_s +struct XStatement { int numEntries; - expressionEntry **entries; + XExpressionEntry **entries; }; -struct columnInfo_s +struct XColumnInfo { int pos; int width; @@ -174,7 +178,7 @@ struct columnInfo_s int alignment; }; -struct listBoxDef_s +struct XListBoxDef { int startPos[4]; int endPos[4]; @@ -183,17 +187,17 @@ struct listBoxDef_s float elementHeight; int elementStyle; int numColumns; - columnInfo_s columnInfo[16]; + XColumnInfo columnInfo[16]; const char *doubleClick; int notselectable; int noScrollBars; int usePaging; float selectBorder[4]; float disableColor[4]; - Material *selectIcon; + XMaterial *selectIcon; }; -struct EditFieldDef +struct XEditFieldDef { float minVal; float maxVal; @@ -205,7 +209,7 @@ struct EditFieldDef int paintOffset; }; -struct MultiDef +struct XMultiDef { const char *dvarList[32]; const char *dvarStr[32]; @@ -214,20 +218,20 @@ struct MultiDef int strDef; }; -union ItemDefData +union XItemDefData { - listBoxDef_s *listBox; - EditFieldDef *editField; - MultiDef *multi; + XListBoxDef *listBox; + XEditFieldDef *editField; + XMultiDef *multi; const char *enumDvarName; void *data; }; -struct MenuDef; -struct ItemDef +class XMenuDef; +struct XItemDef { - windowDef_t window; - rectDef_s textRect[4]; + XWindowDef window; + XRectDef textRect[4]; int type; int dataType; int alignment; @@ -241,7 +245,7 @@ struct ItemDef int gameMsgWindowMode; const char *text; int itemFlags; - MenuDef *parent; + XMenuDef *parent; const char *mouseEnterText; const char *mouseExitText; const char *mouseEnter; @@ -252,50 +256,58 @@ struct ItemDef const char *leaveFocus; const char *dvar; const char *dvarTest; - ItemKeyHandler *onKey; + XItemKeyHandler *onKey; const char *enableDvar; int dvarFlags; - SoundAliasList *focusSound; + XSoundAliasList *focusSound; float special; int cursorPos[4]; - ItemDefData typeData; + XItemDefData typeData; int imageTrack; - statement_s visibleExp; - statement_s textExp; - statement_s materialExp; - statement_s rectXExp; - statement_s rectYExp; - statement_s rectWExp; - statement_s rectHExp; - statement_s forecolorAExp; + XStatement visibleExp; + XStatement textExp; + XStatement materialExp; + XStatement rectXExp; + XStatement rectYExp; + XStatement rectWExp; + XStatement rectHExp; + XStatement forecolorAExp; }; -struct MenuDef +class XMenuDef : public XAsset { - windowDef_t window; - const char *font; - int fullScreen; - int itemCount; - int fontIndex; - int cursorItem[4]; - int fadeCycle; - float fadeClamp; - float fadeAmount; - float fadeInAmount; - float blurRadius; - const char *onOpen; - const char *onClose; - const char *onESC; - ItemKeyHandler *onKey; - statement_s visibleExp; - const char *allowedBinding; - const char *soundName; - int imageTrack; - float focusColor[4]; - float disableColor[4]; - statement_s rectXExp; - statement_s rectYExp; - ItemDef **items; +public: + XMenuDef(); + ~XMenuDef(); + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + XWindowDef mWindow; + XString* mFont; + int mFullScreen; + int mItemCount; + int mFontIndex; + int mCursorItem[4]; + int mFadeCycle; + float mFadeClamp; + float mFadeAmount; + float mFadeInAmount; + float mBlurRadius; + XString* mOnOpen; + XString* mOnClose; + XString* mOnESC; + XItemKeyHandler *mOnKey; + XStatement mVisibleExp; + XString* mAllowedBinding; + XString* mSoundName; + int mImageTrack; + QColor mFocusColor; + QColor mDisableColor; + XStatement mRectXExp; + XStatement mRectYExp; + QVector mItems; }; -#endif // MENUDEF_H +#endif // XMENUDEF_H diff --git a/libs/xassets/xmenulist.cpp b/libs/xassets/xmenulist.cpp new file mode 100644 index 0000000..36e564e --- /dev/null +++ b/libs/xassets/xmenulist.cpp @@ -0,0 +1,70 @@ +#include "xmenulist.h" + +MenuList::MenuList() + : XAsset() + , mName(new XString()) + , mMenuCount(0) + , mMenus(QVector()) +{ + +} + +MenuList::~MenuList() +{ + for (int i = 0; i < mMenus.size(); i++) + { + delete mMenus[i]; + } + + delete mName; +} + +void MenuList::SetName(XString *aName) +{ + mName = aName; +} + +XString *MenuList::GetName() const +{ + return mName; +} + +int MenuList::GetMenuCount() const +{ + return mMenuCount; +} + +void MenuList::SetMenuEntry(int aIndex, XMenuDef *aMenuDef) +{ + mMenus[aIndex] = aMenuDef; +} + +XMenuDef *MenuList::GetMenuEntry(int aIndex) const +{ + return mMenus[aIndex]; +} + +void MenuList::Clear() +{ + for (int i = 0; i < mMenus.size(); i++) + { + delete mMenus[i]; + } + + mName->Clear(); + mMenuCount = 0; + mMenus.clear(); +} + +void MenuList::ParseData(QDataStream *aStream) +{ + mName->ParsePtr(aStream, false); + + *aStream + >> mMenuCount; + + for (int i = 0; i < mMenuCount; i++) + { + XMenuDef* newMenu = new XMenuDef(); + } +} diff --git a/libs/xassets/xmenulist.h b/libs/xassets/xmenulist.h new file mode 100644 index 0000000..e99ab6a --- /dev/null +++ b/libs/xassets/xmenulist.h @@ -0,0 +1,30 @@ +#ifndef XMENULIST_H +#define XMENULIST_H + +#include "xstring.h" +#include "xmenudef.h" + +class MenuList : public XAsset +{ +public: + MenuList(); + ~MenuList(); + + void SetName(XString* aName); + XString* GetName() const; + + int GetMenuCount() const; + + void SetMenuEntry(int aIndex, XMenuDef* aMenuDef); + XMenuDef* GetMenuEntry(int aIndex) const; + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + XString* mName; + int mMenuCount; + QVector mMenus; +}; + +#endif // XMENULIST_H diff --git a/libs/xassets/xnodetype.h b/libs/xassets/xnodetype.h new file mode 100644 index 0000000..c2a49bb --- /dev/null +++ b/libs/xassets/xnodetype.h @@ -0,0 +1,36 @@ + + + +#ifndef XNODETYPE_H +#define XNODETYPE_H + +#include + +enum class NodeType : int32_t { + NODE_BADNODE = 0x0, + NODE_PATHNODE = 0x1, + NODE_COVER_STAND = 0x2, + NODE_COVER_CROUCH = 0x3, + NODE_COVER_CROUCH_WINDOW = 0x4, + NODE_COVER_PRONE = 0x5, + NODE_COVER_RIGHT = 0x6, + NODE_COVER_LEFT = 0x7, + NODE_COVER_WIDE_RIGHT = 0x8, + NODE_COVER_WIDE_LEFT = 0x9, + NODE_CONCEALMENT_STAND = 0xA, + NODE_CONCEALMENT_CROUCH = 0xB, + NODE_CONCEALMENT_PRONE = 0xC, + NODE_REACQUIRE = 0xD, + NODE_BALCONY = 0xE, + NODE_SCRIPTED = 0xF, + NODE_NEGOTIATION_BEGIN = 0x10, + NODE_NEGOTIATION_END = 0x11, + NODE_TURRET = 0x12, + NODE_GUARD = 0x13, + NODE_NUMTYPES = 0x14, + NODE_DONTLINK = 0x14, +}; + +#endif // XNODETYPE_H + + diff --git a/libs/xassets/xpathbasenode.cpp b/libs/xassets/xpathbasenode.cpp new file mode 100644 index 0000000..8723584 --- /dev/null +++ b/libs/xassets/xpathbasenode.cpp @@ -0,0 +1,40 @@ + + + + + + +#include "xpathbasenode.h" + +XPathBaseNode::XPathBaseNode() + : XAsset() { +} + +void XPathBaseNode::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)mOrigin, 3 * sizeof(float)); + aStream->read((char*)&mType, sizeof(unsigned int)); + } +} + +const float* XPathBaseNode::GetOrigin() const { + return mOrigin; +} + +void XPathBaseNode::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +unsigned int XPathBaseNode::GetType() const { + return mType; +} + +void XPathBaseNode::SetType(unsigned int type) { + mType = type; +} + + + + diff --git a/libs/xassets/xpathbasenode.h b/libs/xassets/xpathbasenode.h new file mode 100644 index 0000000..43f8f0b --- /dev/null +++ b/libs/xassets/xpathbasenode.h @@ -0,0 +1,35 @@ + + + + + + +#ifndef XPATHBASENODE_H +#define XPATHBASENODE_H + +#include "xasset.h" + +class XPathBaseNode : public XAsset +{ +public: + explicit XPathBaseNode(); + + void ParseData(QDataStream *aStream) override; + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + unsigned int GetType() const; + void SetType(unsigned int type); + +private: + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + unsigned int mType = 0; +}; + +#endif // XPATHBASENODE_H + + + + + diff --git a/libs/xassets/xpathdata.cpp b/libs/xassets/xpathdata.cpp new file mode 100644 index 0000000..ef8cb1e --- /dev/null +++ b/libs/xassets/xpathdata.cpp @@ -0,0 +1,80 @@ + + + + + + +#include "xpathdata.h" + +XPathData::XPathData() + : XAsset() { +} + +void XPathData::ParseData(QDataStream *aStream) { + // Parse the PathData structure + if (GetPtr() == -1) { + aStream->read((char*)&mNodeCount, sizeof(unsigned int)); + + // Clear existing data before parsing new data + mNodes.clear(); + mBaseNodes.clear(); + mChainNodeForNode.clear(); + mNodeForChainNode.clear(); + mPathVis.clear(); + mNodeTrees.clear(); + + // Parse nodes + for (unsigned int i = 0; i < mNodeCount; ++i) { + XPathNode node; + node.ParseData(aStream); + mNodes.append(node); + } + + // Parse base nodes count and array + unsigned int baseNodeCount; + aStream->read((char*)&baseNodeCount, sizeof(unsigned int)); + for (unsigned int i = 0; i < baseNodeCount; ++i) { + XPathBaseNode baseNode; + baseNode.ParseData(aStream); + mBaseNodes.append(baseNode); + } + + // Parse chain node count and arrays + aStream->read((char*)&mChainNodeCount, sizeof(unsigned int)); + + if (mChainNodeCount > 0) { + mChainNodeForNode.resize(mChainNodeCount); + mNodeForChainNode.resize(mChainNodeCount); + + aStream->read((char*)mChainNodeForNode.data(), mChainNodeCount * sizeof(unsigned short)); + aStream->read((char*)mNodeForChainNode.data(), mChainNodeCount * sizeof(unsigned short)); + } + + // Parse visBytes and pathVis + aStream->read((char*)&mVisBytes, sizeof(int)); + if (mVisBytes > 0) { + mPathVis.resize(mVisBytes); + aStream->read(mPathVis.data(), mVisBytes); + } + + // Parse nodeTreeCount and nodeTrees + aStream->read((char*)&mNodeTreeCount, sizeof(int)); + for (int i = 0; i < mNodeTreeCount; ++i) { + XPathNodeTree nodeTree; + nodeTree.ParseData(aStream); + mNodeTrees.append(nodeTree); + } + } +} + +unsigned int XPathData::GetNodeCount() const { + return mNodeCount; +} + +void XPathData::SetNodeCount(unsigned int count) { + mNodeCount = count; +} + + + + diff --git a/libs/xassets/xpathdata.cpp.new b/libs/xassets/xpathdata.cpp.new new file mode 100644 index 0000000..ef8cb1e --- /dev/null +++ b/libs/xassets/xpathdata.cpp.new @@ -0,0 +1,80 @@ + + + + + + +#include "xpathdata.h" + +XPathData::XPathData() + : XAsset() { +} + +void XPathData::ParseData(QDataStream *aStream) { + // Parse the PathData structure + if (GetPtr() == -1) { + aStream->read((char*)&mNodeCount, sizeof(unsigned int)); + + // Clear existing data before parsing new data + mNodes.clear(); + mBaseNodes.clear(); + mChainNodeForNode.clear(); + mNodeForChainNode.clear(); + mPathVis.clear(); + mNodeTrees.clear(); + + // Parse nodes + for (unsigned int i = 0; i < mNodeCount; ++i) { + XPathNode node; + node.ParseData(aStream); + mNodes.append(node); + } + + // Parse base nodes count and array + unsigned int baseNodeCount; + aStream->read((char*)&baseNodeCount, sizeof(unsigned int)); + for (unsigned int i = 0; i < baseNodeCount; ++i) { + XPathBaseNode baseNode; + baseNode.ParseData(aStream); + mBaseNodes.append(baseNode); + } + + // Parse chain node count and arrays + aStream->read((char*)&mChainNodeCount, sizeof(unsigned int)); + + if (mChainNodeCount > 0) { + mChainNodeForNode.resize(mChainNodeCount); + mNodeForChainNode.resize(mChainNodeCount); + + aStream->read((char*)mChainNodeForNode.data(), mChainNodeCount * sizeof(unsigned short)); + aStream->read((char*)mNodeForChainNode.data(), mChainNodeCount * sizeof(unsigned short)); + } + + // Parse visBytes and pathVis + aStream->read((char*)&mVisBytes, sizeof(int)); + if (mVisBytes > 0) { + mPathVis.resize(mVisBytes); + aStream->read(mPathVis.data(), mVisBytes); + } + + // Parse nodeTreeCount and nodeTrees + aStream->read((char*)&mNodeTreeCount, sizeof(int)); + for (int i = 0; i < mNodeTreeCount; ++i) { + XPathNodeTree nodeTree; + nodeTree.ParseData(aStream); + mNodeTrees.append(nodeTree); + } + } +} + +unsigned int XPathData::GetNodeCount() const { + return mNodeCount; +} + +void XPathData::SetNodeCount(unsigned int count) { + mNodeCount = count; +} + + + + diff --git a/libs/xassets/xpathdata.h b/libs/xassets/xpathdata.h new file mode 100644 index 0000000..74ac043 --- /dev/null +++ b/libs/xassets/xpathdata.h @@ -0,0 +1,45 @@ + + + + + + +#ifndef XPATHDATA_H +#define XPATHDATA_H + +#include "xasset.h" +#include "gameworld.h" +#include "xpathnode.h" +#include "xpathbasenode.h" +#include "xpathnodetree.h" + +class XPathData : public XAsset +{ +public: + explicit XPathData(); + + void ParseData(QDataStream *aStream) override; + + unsigned int GetNodeCount() const; + void SetNodeCount(unsigned int count); + +private: + unsigned int mNodeCount = 0; + // Using our new classes instead of raw pointers to structures + QVector mNodes; // Vector for automatic memory management + QVector mBaseNodes; + unsigned int mChainNodeCount = 0; + QVector mChainNodeForNode; + QVector mNodeForChainNode; + int mVisBytes = 0; + QByteArray mPathVis; // Using QByteArray for automatic memory management + int mNodeTreeCount = 0; + QVector mNodeTrees; +}; + +#endif // XPATHDATA_H + + + + + diff --git a/libs/xassets/xpathdata.h.new b/libs/xassets/xpathdata.h.new new file mode 100644 index 0000000..74ac043 --- /dev/null +++ b/libs/xassets/xpathdata.h.new @@ -0,0 +1,45 @@ + + + + + + +#ifndef XPATHDATA_H +#define XPATHDATA_H + +#include "xasset.h" +#include "gameworld.h" +#include "xpathnode.h" +#include "xpathbasenode.h" +#include "xpathnodetree.h" + +class XPathData : public XAsset +{ +public: + explicit XPathData(); + + void ParseData(QDataStream *aStream) override; + + unsigned int GetNodeCount() const; + void SetNodeCount(unsigned int count); + +private: + unsigned int mNodeCount = 0; + // Using our new classes instead of raw pointers to structures + QVector mNodes; // Vector for automatic memory management + QVector mBaseNodes; + unsigned int mChainNodeCount = 0; + QVector mChainNodeForNode; + QVector mNodeForChainNode; + int mVisBytes = 0; + QByteArray mPathVis; // Using QByteArray for automatic memory management + int mNodeTreeCount = 0; + QVector mNodeTrees; +}; + +#endif // XPATHDATA_H + + + + + diff --git a/libs/xassets/xpathlink.cpp b/libs/xassets/xpathlink.cpp new file mode 100644 index 0000000..406bba9 --- /dev/null +++ b/libs/xassets/xpathlink.cpp @@ -0,0 +1,66 @@ + + + + + +#include "xpathlink.h" + +XPathLink::XPathLink() + : XAsset() { +} + +void XPathLink::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mDist, sizeof(float)); + aStream->read((char*)&mNodeNum, sizeof(unsigned short)); + aStream->read((char*)&mDisconnectCount, sizeof(unsigned char)); + aStream->read((char*)&mNegotiationLink, sizeof(unsigned char)); + aStream->read((char*)mBadPlaceCount, 4 * sizeof(unsigned char)); + } +} + +float XPathLink::GetDist() const { + return mDist; +} + +void XPathLink::SetDist(float dist) { + mDist = dist; +} + +unsigned short XPathLink::GetNodeNum() const { + return mNodeNum; +} + +void XPathLink::SetNodeNum(unsigned short num) { + mNodeNum = num; +} + +unsigned char XPathLink::GetDisconnectCount() const { + return mDisconnectCount; +} + +void XPathLink::SetDisconnectCount(unsigned char count) { + mDisconnectCount = count; +} + +unsigned char XPathLink::GetNegotiationLink() const { + return mNegotiationLink; +} + +void XPathLink::SetNegotiationLink(unsigned char link) { + mNegotiationLink = link; +} + +const unsigned char* XPathLink::GetBadPlaceCount() const { + return mBadPlaceCount; +} + +void XPathLink::SetBadPlaceCount(const unsigned char* counts, size_t size) { + if (size <= 4) { + memcpy(mBadPlaceCount, counts, size * sizeof(unsigned char)); + } +} + + + + diff --git a/libs/xassets/xpathlink.h b/libs/xassets/xpathlink.h new file mode 100644 index 0000000..2785c9e --- /dev/null +++ b/libs/xassets/xpathlink.h @@ -0,0 +1,43 @@ + + + + +#ifndef XPATHLINK_H +#define XPATHLINK_H + +#include "xasset.h" + +class XPathLink : public XAsset +{ +public: + explicit XPathLink(); + + void ParseData(QDataStream *aStream) override; + + float GetDist() const; + void SetDist(float dist); + + unsigned short GetNodeNum() const; + void SetNodeNum(unsigned short num); + + unsigned char GetDisconnectCount() const; + void SetDisconnectCount(unsigned char count); + + unsigned char GetNegotiationLink() const; + void SetNegotiationLink(unsigned char link); + + const unsigned char* GetBadPlaceCount() const; + void SetBadPlaceCount(const unsigned char* counts, size_t size = 4); + +private: + float mDist = 0.0f; + unsigned short mNodeNum = 0; + unsigned char mDisconnectCount = 0; + unsigned char mNegotiationLink = 0; + unsigned char mBadPlaceCount[4] = {0, 0, 0, 0}; +}; + +#endif // XPATHLINK_H + + + diff --git a/libs/xassets/xpathnode.cpp b/libs/xassets/xpathnode.cpp new file mode 100644 index 0000000..d0c891a --- /dev/null +++ b/libs/xassets/xpathnode.cpp @@ -0,0 +1,47 @@ + + + + + + +#include "xpathnode.h" + +XPathNode::XPathNode() + : XAsset() { +} + +void XPathNode::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + mConstant.ParseData(aStream); + mDynamic.ParseData(aStream); + mTransient.ParseData(aStream); + } +} + +const XPathNodeConstant& XPathNode::GetConstant() const { + return mConstant; +} + +void XPathNode::SetConstant(const XPathNodeConstant& constant) { + mConstant = constant; +} + +const XPathNodeDynamic& XPathNode::GetDynamic() const { + return mDynamic; +} + +void XPathNode::SetDynamic(const XPathNodeDynamic& dynamic) { + mDynamic = dynamic; +} + +const XPathNodeTransient& XPathNode::GetTransient() const { + return mTransient; +} + +void XPathNode::SetTransient(const XPathNodeTransient& transient) { + mTransient = transient; +} + + + + diff --git a/libs/xassets/xpathnode.h b/libs/xassets/xpathnode.h new file mode 100644 index 0000000..03b646e --- /dev/null +++ b/libs/xassets/xpathnode.h @@ -0,0 +1,42 @@ + + + + + + +#ifndef XPATHNODE_H +#define XPATHNODE_H + +#include "xasset.h" +#include "xpathnodeconstant.h" +#include "xpathnodedynamic.h" +#include "xpathnodetransient.h" + +class XPathNode : public XAsset +{ +public: + explicit XPathNode(); + + void ParseData(QDataStream *aStream) override; + + const XPathNodeConstant& GetConstant() const; + void SetConstant(const XPathNodeConstant& constant); + + const XPathNodeDynamic& GetDynamic() const; + void SetDynamic(const XPathNodeDynamic& dynamic); + + const XPathNodeTransient& GetTransient() const; + void SetTransient(const XPathNodeTransient& transient); + +private: + XPathNodeConstant mConstant; + XPathNodeDynamic mDynamic; + XPathNodeTransient mTransient; +}; + +#endif // XPATHNODE_H + + + + + diff --git a/libs/xassets/xpathnodeconstant.cpp b/libs/xassets/xpathnodeconstant.cpp new file mode 100644 index 0000000..d80573e --- /dev/null +++ b/libs/xassets/xpathnodeconstant.cpp @@ -0,0 +1,220 @@ + + + + + +#include "xpathnodeconstant.h" + +XPathNodeConstant::XPathNodeConstant() + : XAsset() { +} + +void XPathNodeConstant::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + int typeInt; + aStream->read((char*)&typeInt, sizeof(int)); + mType = static_cast(typeInt); + + aStream->read((char*)&mSpawnflags, sizeof(unsigned short)); + aStream->read((char*)&mTargetname, sizeof(unsigned short)); + aStream->read((char*)&mScriptLinkName, sizeof(unsigned short)); + aStream->read((char*)&mScriptNoteworthy, sizeof(unsigned short)); + aStream->read((char*)&mTarget, sizeof(unsigned short)); + aStream->read((char*)&mAnimscript, sizeof(unsigned short)); + aStream->read((char*)&mAnimscriptfunc, sizeof(int)); + + aStream->read((char*)mOrigin, 3 * sizeof(float)); + aStream->read((char*)&mAngle, sizeof(float)); + aStream->read((char*)mForward, 2 * sizeof(float)); + aStream->read((char*)&mRadius, sizeof(float)); + aStream->read((char*)&mMinUseDistSq, sizeof(float)); + + aStream->read((char*)mOverlapNode, 2 * sizeof(short)); + aStream->read((char*)&mChainId, sizeof(short)); + aStream->read((char*)&mChainDepth, sizeof(short)); + aStream->read((char*)&mChainParent, sizeof(short)); + + aStream->read((char*)&mTotalLinkCount, sizeof(unsigned short)); + + // Allocate and parse links + if (mLinks != nullptr) { + delete[] mLinks; + mLinks = nullptr; + } + + if (mTotalLinkCount > 0) { + mLinks = new XPathLink[mTotalLinkCount]; + for (unsigned short i = 0; i < mTotalLinkCount; ++i) { + mLinks[i].ParseData(aStream); + } + } + } +} + +NodeType XPathNodeConstant::GetType() const { + return mType; +} + +void XPathNodeConstant::SetType(NodeType type) { + mType = type; +} + +unsigned short XPathNodeConstant::GetSpawnflags() const { + return mSpawnflags; +} + +void XPathNodeConstant::SetSpawnflags(unsigned short flags) { + mSpawnflags = flags; +} + +unsigned short XPathNodeConstant::GetTargetname() const { + return mTargetname; +} + +void XPathNodeConstant::SetTargetname(unsigned short name) { + mTargetname = name; +} + +unsigned short XPathNodeConstant::GetScriptLinkName() const { + return mScriptLinkName; +} + +void XPathNodeConstant::SetScriptLinkName(unsigned short name) { + mScriptLinkName = name; +} + +unsigned short XPathNodeConstant::GetScriptNoteworthy() const { + return mScriptNoteworthy; +} + +void XPathNodeConstant::SetScriptNoteworthy(unsigned short noteworthy) { + mScriptNoteworthy = noteworthy; +} + +unsigned short XPathNodeConstant::GetTarget() const { + return mTarget; +} + +void XPathNodeConstant::SetTarget(unsigned short target) { + mTarget = target; +} + +unsigned short XPathNodeConstant::GetAnimscript() const { + return mAnimscript; +} + +void XPathNodeConstant::SetAnimscript(unsigned short script) { + mAnimscript = script; +} + +int XPathNodeConstant::GetAnimscriptfunc() const { + return mAnimscriptfunc; +} + +void XPathNodeConstant::SetAnimscriptfunc(int func) { + mAnimscriptfunc = func; +} + +const float* XPathNodeConstant::GetOrigin() const { + return mOrigin; +} + +void XPathNodeConstant::SetOrigin(const float* origin, size_t count) { + if (count <= 3) { + memcpy(mOrigin, origin, count * sizeof(float)); + } +} + +float XPathNodeConstant::GetAngle() const { + return mAngle; +} + +void XPathNodeConstant::SetAngle(float angle) { + mAngle = angle; +} + +const float* XPathNodeConstant::GetForward() const { + return mForward; +} + +void XPathNodeConstant::SetForward(const float* forward, size_t count) { + if (count <= 2) { + memcpy(mForward, forward, count * sizeof(float)); + } +} + +float XPathNodeConstant::GetRadius() const { + return mRadius; +} + +void XPathNodeConstant::SetRadius(float radius) { + mRadius = radius; +} + +float XPathNodeConstant::GetMinUseDistSq() const { + return mMinUseDistSq; +} + +void XPathNodeConstant::SetMinUseDistSq(float dist) { + mMinUseDistSq = dist; +} + +short XPathNodeConstant::GetOverlapNode(int index) const { + if (index >= 0 && index < 2) { + return mOverlapNode[index]; + } + return 0; +} + +void XPathNodeConstant::SetOverlapNode(int index, short node) { + if (index >= 0 && index < 2) { + mOverlapNode[index] = node; + } +} + +short XPathNodeConstant::GetChainId() const { + return mChainId; +} + +void XPathNodeConstant::SetChainId(short id) { + mChainId = id; +} + +short XPathNodeConstant::GetChainDepth() const { + return mChainDepth; +} + +void XPathNodeConstant::SetChainDepth(short depth) { + mChainDepth = depth; +} + +short XPathNodeConstant::GetChainParent() const { + return mChainParent; +} + +void XPathNodeConstant::SetChainParent(short parent) { + mChainParent = parent; +} + +unsigned short XPathNodeConstant::GetTotalLinkCount() const { + return mTotalLinkCount; +} + +void XPathNodeConstant::SetTotalLinkCount(unsigned short count) { + mTotalLinkCount = count; +} + +XPathLink* XPathNodeConstant::GetLinks() const { + return mLinks; +} + +void XPathNodeConstant::SetLinks(XPathLink* links, unsigned short count) { + if (mLinks != nullptr) { + delete[] mLinks; + } + + mLinks = new XPathLink[count]; + memcpy(mLinks, links, count * sizeof(XPathLink)); + mTotalLinkCount = count; +} + diff --git a/libs/xassets/xpathnodeconstant.h b/libs/xassets/xpathnodeconstant.h new file mode 100644 index 0000000..7b7cb53 --- /dev/null +++ b/libs/xassets/xpathnodeconstant.h @@ -0,0 +1,103 @@ + + + + + +#ifndef XPATHNODECONSTANT_H +#define XPATHNODECONSTANT_H + +#include "xasset.h" +#include "xnodetype.h" +#include "xpathlink.h" + +class XPathNodeConstant : public XAsset +{ +public: + explicit XPathNodeConstant(); + + void ParseData(QDataStream *aStream) override; + + NodeType GetType() const; + void SetType(NodeType type); + + unsigned short GetSpawnflags() const; + void SetSpawnflags(unsigned short flags); + + unsigned short GetTargetname() const; + void SetTargetname(unsigned short name); + + unsigned short GetScriptLinkName() const; + void SetScriptLinkName(unsigned short name); + + unsigned short GetScriptNoteworthy() const; + void SetScriptNoteworthy(unsigned short noteworthy); + + unsigned short GetTarget() const; + void SetTarget(unsigned short target); + + unsigned short GetAnimscript() const; + void SetAnimscript(unsigned short script); + + int GetAnimscriptfunc() const; + void SetAnimscriptfunc(int func); + + const float* GetOrigin() const; + void SetOrigin(const float* origin, size_t count = 3); + + float GetAngle() const; + void SetAngle(float angle); + + const float* GetForward() const; + void SetForward(const float* forward, size_t count = 2); + + float GetRadius() const; + void SetRadius(float radius); + + float GetMinUseDistSq() const; + void SetMinUseDistSq(float dist); + + short GetOverlapNode(int index) const; + void SetOverlapNode(int index, short node); + + short GetChainId() const; + void SetChainId(short id); + + short GetChainDepth() const; + void SetChainDepth(short depth); + + short GetChainParent() const; + void SetChainParent(short parent); + + unsigned short GetTotalLinkCount() const; + void SetTotalLinkCount(unsigned short count); + + XPathLink* GetLinks() const; + void SetLinks(XPathLink* links, unsigned short count); + +private: + NodeType mType = NodeType::NODE_BADNODE; + unsigned short mSpawnflags = 0; + unsigned short mTargetname = 0; + unsigned short mScriptLinkName = 0; + unsigned short mScriptNoteworthy = 0; + unsigned short mTarget = 0; + unsigned short mAnimscript = 0; + int mAnimscriptfunc = 0; + float mOrigin[3] = {0.0f, 0.0f, 0.0f}; + float mAngle = 0.0f; + float mForward[2] = {0.0f, 0.0f}; + float mRadius = 0.0f; + float mMinUseDistSq = 0.0f; + short mOverlapNode[2] = {0, 0}; + short mChainId = 0; + short mChainDepth = 0; + short mChainParent = 0; + unsigned short mTotalLinkCount = 0; + XPathLink* mLinks = nullptr; // We'll need to manage memory for this array +}; + +#endif // XPATHNODECONSTANT_H + + + + diff --git a/libs/xassets/xpathnodedynamic.cpp b/libs/xassets/xpathnodedynamic.cpp new file mode 100644 index 0000000..7414f10 --- /dev/null +++ b/libs/xassets/xpathnodedynamic.cpp @@ -0,0 +1,96 @@ + + + + + + +#include "xpathnodedynamic.h" + +XPathNodeDynamic::XPathNodeDynamic() + : XAsset() { +} + +void XPathNodeDynamic::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We can't directly read pointers from the stream, so we'll skip this + aStream->ignore(sizeof(void*)); + + aStream->read((char*)&mFreeTime, sizeof(int)); + aStream->read((char*)mValidTime, 3 * sizeof(int)); + aStream->read((char*)&mPlayerLostTime, sizeof(int)); + + aStream->read((char*)&mLinkCount, sizeof(short)); + aStream->read((char*)&mOverlapCount, sizeof(short)); + aStream->read((char*)&mTurretEntNumber, sizeof(short)); + aStream->read((char*)&mUserCount, sizeof(short)); + } +} + +void* XPathNodeDynamic::GetOwner() const { + return mOwner; +} + +void XPathNodeDynamic::SetOwner(void* owner) { + mOwner = owner; +} + +int XPathNodeDynamic::GetFreeTime() const { + return mFreeTime; +} + +void XPathNodeDynamic::SetFreeTime(int time) { + mFreeTime = time; +} + +const int* XPathNodeDynamic::GetValidTime() const { + return mValidTime; +} + +void XPathNodeDynamic::SetValidTime(const int* times, size_t count) { + if (count <= 3) { + memcpy(mValidTime, times, count * sizeof(int)); + } +} + +int XPathNodeDynamic::GetPlayerLostTime() const { + return mPlayerLostTime; +} + +void XPathNodeDynamic::SetPlayerLostTime(int time) { + mPlayerLostTime = time; +} + +short XPathNodeDynamic::GetLinkCount() const { + return mLinkCount; +} + +void XPathNodeDynamic::SetLinkCount(short count) { + mLinkCount = count; +} + +short XPathNodeDynamic::GetOverlapCount() const { + return mOverlapCount; +} + +void XPathNodeDynamic::SetOverlapCount(short count) { + mOverlapCount = count; +} + +short XPathNodeDynamic::GetTurretEntNumber() const { + return mTurretEntNumber; +} + +void XPathNodeDynamic::SetTurretEntNumber(short number) { + mTurretEntNumber = number; +} + +short XPathNodeDynamic::GetUserCount() const { + return mUserCount; +} + +void XPathNodeDynamic::SetUserCount(short count) { + mUserCount = count; +} + + + diff --git a/libs/xassets/xpathnodedynamic.h b/libs/xassets/xpathnodedynamic.h new file mode 100644 index 0000000..bfdc7e6 --- /dev/null +++ b/libs/xassets/xpathnodedynamic.h @@ -0,0 +1,57 @@ + + + + + +#ifndef XPATHNODEDYNAMIC_H +#define XPATHNODEDYNAMIC_H + +#include "xasset.h" + +class XPathNodeDynamic : public XAsset +{ +public: + explicit XPathNodeDynamic(); + + void ParseData(QDataStream *aStream) override; + + void* GetOwner() const; + void SetOwner(void* owner); + + int GetFreeTime() const; + void SetFreeTime(int time); + + const int* GetValidTime() const; + void SetValidTime(const int* times, size_t count = 3); + + int GetPlayerLostTime() const; + void SetPlayerLostTime(int time); + + short GetLinkCount() const; + void SetLinkCount(short count); + + short GetOverlapCount() const; + void SetOverlapCount(short count); + + short GetTurretEntNumber() const; + void SetTurretEntNumber(short number); + + short GetUserCount() const; + void SetUserCount(short count); + +private: + void* mOwner = nullptr; + int mFreeTime = 0; + int mValidTime[3] = {0, 0, 0}; + int mPlayerLostTime = 0; + short mLinkCount = 0; + short mOverlapCount = 0; + short mTurretEntNumber = 0; + short mUserCount = 0; +}; + +#endif // XPATHNODEDYNAMIC_H + + + + diff --git a/libs/xassets/xpathnodetransient.cpp b/libs/xassets/xpathnodetransient.cpp new file mode 100644 index 0000000..cab969b --- /dev/null +++ b/libs/xassets/xpathnodetransient.cpp @@ -0,0 +1,86 @@ + + + + + + +#include "xpathnodetransient.h" + +XPathNodeTransient::XPathNodeTransient() + : XAsset() { +} + +void XPathNodeTransient::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mSearchFrame, sizeof(int)); + + // We can't directly read pointers from the stream, so we'll skip these + aStream->ignore(sizeof(pathnode_t*)); + aStream->ignore(sizeof(pathnode_t*)); + aStream->ignore(sizeof(pathnode_t*)); + + aStream->read((char*)&mCost, sizeof(float)); + aStream->read((char*)&mHeuristic, sizeof(float)); + aStream->read((char*)&mCostFactor, sizeof(float)); + } +} + +int XPathNodeTransient::GetSearchFrame() const { + return mSearchFrame; +} + +void XPathNodeTransient::SetSearchFrame(int frame) { + mSearchFrame = frame; +} + +pathnode_t* XPathNodeTransient::GetNextOpen() const { + return mNextOpen; +} + +void XPathNodeTransient::SetNextOpen(pathnode_t* node) { + mNextOpen = node; +} + +pathnode_t* XPathNodeTransient::GetPrevOpen() const { + return mPrevOpen; +} + +void XPathNodeTransient::SetPrevOpen(pathnode_t* node) { + mPrevOpen = node; +} + +pathnode_t* XPathNodeTransient::GetParent() const { + return mParent; +} + +void XPathNodeTransient::SetParent(pathnode_t* parent) { + mParent = parent; +} + +float XPathNodeTransient::GetCost() const { + return mCost; +} + +void XPathNodeTransient::SetCost(float cost) { + mCost = cost; +} + +float XPathNodeTransient::GetHeuristic() const { + return mHeuristic; +} + +void XPathNodeTransient::SetHeuristic(float heuristic) { + mHeuristic = heuristic; +} + +float XPathNodeTransient::GetCostFactor() const { + return mCostFactor; +} + +void XPathNodeTransient::SetCostFactor(float factor) { + mCostFactor = factor; +} + + + + diff --git a/libs/xassets/xpathnodetransient.h b/libs/xassets/xpathnodetransient.h new file mode 100644 index 0000000..4f9a877 --- /dev/null +++ b/libs/xassets/xpathnodetransient.h @@ -0,0 +1,56 @@ + + + + + + +#ifndef XPATHNODETRANSIENT_H +#define XPATHNODETRANSIENT_H + +#include "xasset.h" +#include "gameworld.h" // For pathnode_t reference + +class XPathNodeTransient : public XAsset +{ +public: + explicit XPathNodeTransient(); + + void ParseData(QDataStream *aStream) override; + + int GetSearchFrame() const; + void SetSearchFrame(int frame); + + pathnode_t* GetNextOpen() const; + void SetNextOpen(pathnode_t* node); + + pathnode_t* GetPrevOpen() const; + void SetPrevOpen(pathnode_t* node); + + pathnode_t* GetParent() const; + void SetParent(pathnode_t* parent); + + float GetCost() const; + void SetCost(float cost); + + float GetHeuristic() const; + void SetHeuristic(float heuristic); + + float GetCostFactor() const; + void SetCostFactor(float factor); + +private: + int mSearchFrame = 0; + pathnode_t* mNextOpen = nullptr; + pathnode_t* mPrevOpen = nullptr; + pathnode_t* mParent = nullptr; + float mCost = 0.0f; + float mHeuristic = 0.0f; + float mCostFactor = 0.0f; +}; + +#endif // XPATHNODETRANSIENT_H + + + + + diff --git a/libs/xassets/xpathnodetree.cpp b/libs/xassets/xpathnodetree.cpp new file mode 100644 index 0000000..c46584f --- /dev/null +++ b/libs/xassets/xpathnodetree.cpp @@ -0,0 +1,56 @@ + + + + + + +#include "xpathnodetree.h" + +XPathNodeTree::XPathNodeTree() + : XAsset() { +} + +void XPathNodeTree::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mAxis, sizeof(int)); + aStream->read((char*)&mDist, sizeof(float)); + + // Skip reading the union directly from the stream + // We'll assume we're parsing as children by default + for (int i = 0; i < 2; ++i) { + // Skip reading pointers directly from the stream + aStream->ignore(sizeof(PathNodeTree*)); + } + } +} + +int XPathNodeTree::GetAxis() const { + return mAxis; +} + +void XPathNodeTree::SetAxis(int axis) { + mAxis = axis; +} + +float XPathNodeTree::GetDist() const { + return mDist; +} + +void XPathNodeTree::SetDist(float dist) { + mDist = dist; +} + +PathNodeTreeInfo* XPathNodeTree::GetInfo() const { + return mInfo; +} + +void XPathNodeTree::SetInfo(PathNodeTreeInfo* info) { + if (mInfo != nullptr) { + delete mInfo; + } + mInfo = new PathNodeTreeInfo(*info); +} + + + + diff --git a/libs/xassets/xpathnodetree.h b/libs/xassets/xpathnodetree.h new file mode 100644 index 0000000..2618bd2 --- /dev/null +++ b/libs/xassets/xpathnodetree.h @@ -0,0 +1,41 @@ + + + + + + +#ifndef XPATHNODETREE_H +#define XPATHNODETREE_H + +#include "xasset.h" +#include "gameworld.h" // For PathNodeTree reference +#include "xpathnodetreeinfo.h" + +class XPathNodeTree : public XAsset +{ +public: + explicit XPathNodeTree(); + + void ParseData(QDataStream *aStream) override; + + int GetAxis() const; + void SetAxis(int axis); + + float GetDist() const; + void SetDist(float dist); + + PathNodeTreeInfo* GetInfo() const; + void SetInfo(PathNodeTreeInfo* info); + +private: + int mAxis = 0; + float mDist = 0.0f; + PathNodeTreeInfo* mInfo = nullptr; // We'll need to manage memory for this +}; + +#endif // XPATHNODETREE_H + + + + + diff --git a/libs/xassets/xpathnodetreeinfo.cpp b/libs/xassets/xpathnodetreeinfo.cpp new file mode 100644 index 0000000..79ba9c0 --- /dev/null +++ b/libs/xassets/xpathnodetreeinfo.cpp @@ -0,0 +1,46 @@ + + + + + + +#include "xpathnodetreeinfo.h" + +XPathNodeTreeInfo::XPathNodeTreeInfo() + : XAsset() { +} + +void XPathNodeTreeInfo::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + // We'll assume we're parsing as children by default + for (int i = 0; i < 2; ++i) { + // Skip reading pointers directly from the stream + aStream->ignore(sizeof(PathNodeTree*)); + } + } +} + +PathNodeTree* XPathNodeTreeInfo::GetChild(int index) const { + if (index >= 0 && index < 2) { + return mChildren[index]; + } + return nullptr; +} + +void XPathNodeTreeInfo::SetChild(int index, PathNodeTree* child) { + if (index >= 0 && index < 2) { + mChildren[index] = child; + } +} + +const XPathNodeTreeNodes& XPathNodeTreeInfo::GetNodes() const { + return mNodes; +} + +void XPathNodeTreeInfo::SetNodes(const XPathNodeTreeNodes& nodes) { + mNodes = nodes; +} + + + + diff --git a/libs/xassets/xpathnodetreeinfo.h b/libs/xassets/xpathnodetreeinfo.h new file mode 100644 index 0000000..fbd05be --- /dev/null +++ b/libs/xassets/xpathnodetreeinfo.h @@ -0,0 +1,38 @@ + + + + + + +#ifndef XPATHNODETREEINFO_H +#define XPATHNODETREEINFO_H + +#include "xasset.h" +#include "gameworld.h" // For PathNodeTree reference + +class XPathNodeTreeInfo : public XAsset +{ +public: + explicit XPathNodeTreeInfo(); + + void ParseData(QDataStream *aStream) override; + + PathNodeTree* GetChild(int index) const; + void SetChild(int index, PathNodeTree* child); + + const XPathNodeTreeNodes& GetNodes() const; + void SetNodes(const XPathNodeTreeNodes& nodes); + +private: + union { + PathNodeTree* mChildren[2]; + XPathNodeTreeNodes mNodes; + }; +}; + +#endif // XPATHNODETREEINFO_H + + + + + diff --git a/libs/xassets/xpathnodetreenodes.cpp b/libs/xassets/xpathnodetreenodes.cpp new file mode 100644 index 0000000..734f271 --- /dev/null +++ b/libs/xassets/xpathnodetreenodes.cpp @@ -0,0 +1,53 @@ + + + + + +#include "xpathnodetreenodes.h" + +XPathNodeTreeNodes::XPathNodeTreeNodes() + : XAsset() { +} + +void XPathNodeTreeNodes::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read((char*)&mNodeCount, sizeof(int)); + + // Allocate and parse nodes + if (mNodes != nullptr) { + delete[] mNodes; + mNodes = nullptr; + } + + if (mNodeCount > 0) { + mNodes = new unsigned short[mNodeCount]; + aStream->read((char*)mNodes, mNodeCount * sizeof(unsigned short)); + } + } +} + +int XPathNodeTreeNodes::GetNodeCount() const { + return mNodeCount; +} + +void XPathNodeTreeNodes::SetNodeCount(int count) { + mNodeCount = count; +} + +unsigned short* XPathNodeTreeNodes::GetNodes() const { + return mNodes; +} + +void XPathNodeTreeNodes::SetNodes(unsigned short* nodes, int count) { + if (mNodes != nullptr) { + delete[] mNodes; + } + + mNodeCount = count; + mNodes = new unsigned short[count]; + memcpy(mNodes, nodes, count * sizeof(unsigned short)); +} + + + + diff --git a/libs/xassets/xpathnodetreenodes.h b/libs/xassets/xpathnodetreenodes.h new file mode 100644 index 0000000..ea2c86b --- /dev/null +++ b/libs/xassets/xpathnodetreenodes.h @@ -0,0 +1,35 @@ + + + + + + +#ifndef XPATHNODETREENODES_H +#define XPATHNODETREENODES_H + +#include "xasset.h" + +class XPathNodeTreeNodes : public XAsset +{ +public: + explicit XPathNodeTreeNodes(); + + void ParseData(QDataStream *aStream) override; + + int GetNodeCount() const; + void SetNodeCount(int count); + + unsigned short* GetNodes() const; + void SetNodes(unsigned short* nodes, int count); + +private: + int mNodeCount = 0; + unsigned short* mNodes = nullptr; // We'll need to manage memory for this array +}; + +#endif // XPATHNODETREENODES_H + + + + + diff --git a/libs/xassets/xsoundalias.h b/libs/xassets/xsoundalias.h index 82ea1d7..b459db2 100644 --- a/libs/xassets/xsoundalias.h +++ b/libs/xassets/xsoundalias.h @@ -2,6 +2,8 @@ #define XSOUNDALIAS_H #include "xasset.h" +#include "xsoundcurve.h" +#include "xsoundfile.h" #include "xstring.h" class XSoundAlias : public XAsset diff --git a/libs/xassets/xsoundcurve.cpp b/libs/xassets/xsoundcurve.cpp index 0f05254..414e91c 100644 --- a/libs/xassets/xsoundcurve.cpp +++ b/libs/xassets/xsoundcurve.cpp @@ -1,16 +1,67 @@ #include "xsoundcurve.h" XSoundCurve::XSoundCurve() + : XAsset() + , mFileName(nullptr) + , mKnotCount(0) + , mKnots(QVector>()) { } +XString *XSoundCurve::GetFileName() +{ + return mFileName; +} + +void XSoundCurve::SetFileName(XString *aFileName) +{ + mFileName = aFileName; +} + +float XSoundCurve::GetKnotEntry(int aRow, int aColumn) +{ + return mKnots[aRow][aColumn]; +} + +void XSoundCurve::SetKnotEntry(int aRow, int aColumn, float aValue) +{ + mKnots[aRow][aColumn] = aValue; +} + +int XSoundCurve::GetKnotCount() +{ + return mKnotCount; +} + void XSoundCurve::Clear() { - + if (mFileName != nullptr) + { + mFileName->Clear(); + } + mKnotCount = 0; + mKnots.clear(); } void XSoundCurve::ParseData(QDataStream *aStream) { + if (mFileName != nullptr) + { + mFileName->ParsePtr(aStream, false); + } + *aStream + >> mKnotCount; + + for (int i = 0; i < 8; i++) + { + for (int j = 0; j < 2; j++) + { + float knot; + *aStream >> knot; + + mKnots[i][j] = knot; + } + } } diff --git a/libs/xassets/xsoundcurve.h b/libs/xassets/xsoundcurve.h index dbba2ae..8db5943 100644 --- a/libs/xassets/xsoundcurve.h +++ b/libs/xassets/xsoundcurve.h @@ -9,10 +9,21 @@ class XSoundCurve: public XAsset public: XSoundCurve(); + XString* GetFileName(); + void SetFileName(XString* aFileName); + + float GetKnotEntry(int aRow, int aColumn); + + void SetKnotEntry(int aRow, int aColumn, float aValue); + int GetKnotCount(); + virtual void Clear() override; virtual void ParseData(QDataStream* aStream) override; private: + XString* mFileName; + int mKnotCount; + QVector> mKnots; }; #endif // XSOUNDCURVE_H diff --git a/libs/xassets/xspeakermap.cpp b/libs/xassets/xspeakermap.cpp new file mode 100644 index 0000000..96f9e76 --- /dev/null +++ b/libs/xassets/xspeakermap.cpp @@ -0,0 +1,119 @@ +#include "xspeakermap.h" + +XSpeakerMap::XSpeakerMap() + : XAsset() + , mIsDefault(false) + , mName(new XString()) + , mChannelMaps(QVector>()) +{ + for (int i = 0; i < MAP_DIM; i++) + { + for (int j = 0; j < MAP_DIM; j++) + { + mChannelMaps[i][j] = nullptr; + } + } +} + +XSpeakerMap::~XSpeakerMap() +{ + for (int i = 0; i < mChannelMaps.size(); i++) + { + for (int j = 0; j < mChannelMaps[i].size(); j++) + { + delete mChannelMaps[i][j]; + } + } + + delete mName; +} + +QVector> XSpeakerMap::ChannelArrayToMap(const QVector aChannelArray) +{ + QVector> channelMap(MAP_DIM, QVector(MAP_DIM)); + + for (int i = 0; i < MAP_DIM; i++) + { + for (int j = 0; j < MAP_DIM; j++) + { + channelMap[i][j] = aChannelArray[i * MAP_DIM + j]; + } + } + + return channelMap; +} + +void XSpeakerMap::SetIsDefault(bool aIsDefault) +{ + mIsDefault = aIsDefault; +} + +bool XSpeakerMap::IsDefault() const +{ + return mIsDefault; +} + +void XSpeakerMap::SetName(XString *aName) +{ + mName = aName; +} + +XString *XSpeakerMap::GetName() +{ + return mName; +} + +XAudioChannelMap *XSpeakerMap::GetChannelMapEntry(int aRow, int aCol) +{ + return mChannelMaps[aRow][aCol]; +} + +QVector XSpeakerMap::ParseChannelArray(QDataStream *aStream, int aCount) +{ + for (int i = 0; i < aCount; i++) + { + XAudioChannelMap* newChannelMap = new XAudioChannelMap(); + newChannelMap->ParseData(aStream); + } +} + +void XSpeakerMap::ParseData(QDataStream *aStream) +{ + *aStream >> mIsDefault; + + // Skip padding bytes in struct + aStream->skipRawData(3); + + mName->ParsePtr(aStream, false); + + auto channelArray = ParseChannelArray(aStream, MAP_DIM); + + + + for (int i = 0; i < 2; i++) + { + for (int j = 0; j < 2; j++) + { + XAudioChannelMap* newChannelMap = new XAudioChannelMap(); + + mChannelMaps[i][j] = newChannelMap; + } + } + + mName->ParseData(aStream); +} + +void XSpeakerMap::Clear() +{ + mIsDefault = 0; + mName->Clear(); + + for (int i = 0; i < mChannelMaps.size(); i++) + { + for (int j = 0; j < mChannelMaps[i].size(); j++) + { + delete mChannelMaps[i][j]; + } + } + mChannelMaps.clear(); +} diff --git a/libs/xassets/xspeakermap.h b/libs/xassets/xspeakermap.h new file mode 100644 index 0000000..01af37c --- /dev/null +++ b/libs/xassets/xspeakermap.h @@ -0,0 +1,36 @@ +#ifndef XSPEAKERMAP_H +#define XSPEAKERMAP_H + +#include "xasset.h" +#include "xaudiochannelmap.h" +#include "xstring.h" + +#define MAP_DIM 2 + +class XSpeakerMap : public XAsset +{ +public: + XSpeakerMap(); + ~XSpeakerMap(); + + static QVector > ChannelArrayToMap(const QVector aChannelArray); + + void SetIsDefault(bool aIsDefault); + bool IsDefault() const; + + void SetName(XString *aName); + XString* GetName(); + + XAudioChannelMap* GetChannelMapEntry(int aRow, int aCol); + + virtual QVector ParseChannelArray(QDataStream *aStream, int aCount); + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + bool mIsDefault; + XString* mName; + QVector> mChannelMaps; +}; + +#endif // XSPEAKERMAP_H diff --git a/libs/xassets/xstring.cpp b/libs/xassets/xstring.cpp index 9ab0093..395a645 100644 --- a/libs/xassets/xstring.cpp +++ b/libs/xassets/xstring.cpp @@ -7,6 +7,13 @@ XString::XString() } +XString::XString(const QString aString) + : XAsset() + , mString(aString) +{ + +} + XString::~XString() { diff --git a/libs/xassets/xstring.h b/libs/xassets/xstring.h index 1bd1b07..e18d3f6 100644 --- a/libs/xassets/xstring.h +++ b/libs/xassets/xstring.h @@ -11,6 +11,7 @@ class XString : public XAsset { public: XString(); + XString(const QString aString); virtual ~XString() override; void SetString(const QString& aString); diff --git a/libs/xassets/xsunlightparseparams.cpp b/libs/xassets/xsunlightparseparams.cpp new file mode 100644 index 0000000..0ef1dd9 --- /dev/null +++ b/libs/xassets/xsunlightparseparams.cpp @@ -0,0 +1,106 @@ + + + + + + +#include "xsunlightparseparams.h" + +XSunLightParseParams::XSunLightParseParams() + : XAsset() { +} + +void XSunLightParseParams::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read(mName, 64 * sizeof(char)); + aStream->read((char*)&mAmbientScale, sizeof(float)); + aStream->read((char*)mAmbientColor, 3 * sizeof(float)); + aStream->read((char*)&mDiffuseFraction, sizeof(float)); + aStream->read((char*)&mSunLight, sizeof(float)); + aStream->read((char*)mSunColor, 3 * sizeof(float)); + aStream->read((char*)mDiffuseColor, 3 * sizeof(float)); + aStream->read((char*)&mDiffuseColorHasBeenSet, sizeof(bool)); + aStream->read((char*)mAngles, 3 * sizeof(float)); + } +} + +const char* XSunLightParseParams::GetName() const { + return mName; +} + +void XSunLightParseParams::SetName(const char* name) { + strncpy(mName, name, 64); +} + +float XSunLightParseParams::GetAmbientScale() const { + return mAmbientScale; +} + +void XSunLightParseParams::SetAmbientScale(float scale) { + mAmbientScale = scale; +} + +const float* XSunLightParseParams::GetAmbientColor() const { + return mAmbientColor; +} + +void XSunLightParseParams::SetAmbientColor(const float* color, size_t count) { + if (count <= 3) { + memcpy(mAmbientColor, color, count * sizeof(float)); + } +} + +float XSunLightParseParams::GetDiffuseFraction() const { + return mDiffuseFraction; +} + +void XSunLightParseParams::SetDiffuseFraction(float fraction) { + mDiffuseFraction = fraction; +} + +float XSunLightParseParams::GetSunLight() const { + return mSunLight; +} + +void XSunLightParseParams::SetSunLight(float light) { + mSunLight = light; +} + +const float* XSunLightParseParams::GetSunColor() const { + return mSunColor; +} + +void XSunLightParseParams::SetSunColor(const float* color, size_t count) { + if (count <= 3) { + memcpy(mSunColor, color, count * sizeof(float)); + } +} + +const float* XSunLightParseParams::GetDiffuseColor() const { + return mDiffuseColor; +} + +void XSunLightParseParams::SetDiffuseColor(const float* color, size_t count) { + if (count <= 3) { + memcpy(mDiffuseColor, color, count * sizeof(float)); + } +} + +bool XSunLightParseParams::IsDiffuseColorSet() const { + return mDiffuseColorHasBeenSet; +} + +void XSunLightParseParams::SetDiffuseColorSet(bool set) { + mDiffuseColorHasBeenSet = set; +} + +const float* XSunLightParseParams::GetAngles() const { + return mAngles; +} + +void XSunLightParseParams::SetAngles(const float* angles, size_t count) { + if (count <= 3) { + memcpy(mAngles, angles, count * sizeof(float)); + } +} + diff --git a/libs/xassets/xsunlightparseparams.h b/libs/xassets/xsunlightparseparams.h new file mode 100644 index 0000000..f30c583 --- /dev/null +++ b/libs/xassets/xsunlightparseparams.h @@ -0,0 +1,69 @@ + + + + + + + + + +#ifndef XSUNLIGHTPARSEPARAMS_H +#define XSUNLIGHTPARSEPARAMS_H + +#include "xasset.h" + +class XSunLightParseParams : public XAsset +{ +public: + explicit XSunLightParseParams(); + + void ParseData(QDataStream *aStream) override; + + const char* GetName() const; + void SetName(const char* name); + + float GetAmbientScale() const; + void SetAmbientScale(float scale); + + const float* GetAmbientColor() const; + void SetAmbientColor(const float* color, size_t count = 3); + + float GetDiffuseFraction() const; + void SetDiffuseFraction(float fraction); + + float GetSunLight() const; + void SetSunLight(float light); + + const float* GetSunColor() const; + void SetSunColor(const float* color, size_t count = 3); + + const float* GetDiffuseColor() const; + void SetDiffuseColor(const float* color, size_t count = 3); + + bool IsDiffuseColorSet() const; + void SetDiffuseColorSet(bool set); + + const float* GetAngles() const; + void SetAngles(const float* angles, size_t count = 3); + +private: + char mName[64] = {0}; + float mAmbientScale = 1.0f; + float mAmbientColor[3] = {0.0f, 0.0f, 0.0f}; + float mDiffuseFraction = 0.0f; + float mSunLight = 0.0f; + float mSunColor[3] = {0.0f, 0.0f, 0.0f}; + float mDiffuseColor[3] = {0.0f, 0.0f, 0.0f}; + bool mDiffuseColorHasBeenSet = false; + float mAngles[3] = {0.0f, 0.0f, 0.0f}; +}; + +#endif // XSUNLIGHTPARSEPARAMS_H + + + + + + + + diff --git a/libs/xassets/xweapondef.cpp b/libs/xassets/xweapondef.cpp new file mode 100644 index 0000000..e8cd754 --- /dev/null +++ b/libs/xassets/xweapondef.cpp @@ -0,0 +1,48 @@ + + + + + + +#include "xweapondef.h" + +XWeaponDef::XWeaponDef() + : XAsset() { +} + +void XWeaponDef::ParseData(QDataStream *aStream) { + if (GetPtr() == -1) { + aStream->read(mInternalName, 64 * sizeof(char)); + aStream->read(mDisplayName, 64 * sizeof(char)); + aStream->read(mOverlayName, 64 * sizeof(char)); + + // Parse more fields as needed... + } +} + +const char* XWeaponDef::GetInternalName() const { + return mInternalName; +} + +void XWeaponDef::SetInternalName(const char* name) { + strncpy(mInternalName, name, 64); +} + +const char* XWeaponDef::GetDisplayName() const { + return mDisplayName; +} + +void XWeaponDef::SetDisplayName(const char* name) { + strncpy(mDisplayName, name, 64); +} + +const char* XWeaponDef::GetOverlayName() const { + return mOverlayName; +} + +void XWeaponDef::SetOverlayName(const char* name) { + strncpy(mOverlayName, name, 64); +} + +// Implement more getters and setters as needed... + diff --git a/libs/xassets/xweapondef.h b/libs/xassets/xweapondef.h new file mode 100644 index 0000000..8d7c7eb --- /dev/null +++ b/libs/xassets/xweapondef.h @@ -0,0 +1,62 @@ + + + + + + + + + + + +#ifndef XWEAPONDEF_H +#define XWEAPONDEF_H + +#include "xasset.h" +#include + +// Define the WeaponIconRatioType enum +enum WeaponIconRatioType : int { + WEAPON_ICON_RATIO_1TO1 = 0, + WEAPON_ICON_RATIO_2TO1 = 1, + WEAPON_ICON_RATIO_4TO1 = 2, + WEAPON_ICON_RATIO_COUNT = 3 +}; + +class XWeaponDef : public XAsset +{ +public: + explicit XWeaponDef(); + + void ParseData(QDataStream *aStream) override; + + const char* GetInternalName() const; + void SetInternalName(const char* name); + + const char* GetDisplayName() const; + void SetDisplayName(const char* name); + + const char* GetOverlayName() const; + void SetOverlayName(const char* name); + + // Add more getters and setters as needed... + +private: + char mInternalName[64] = {0}; + char mDisplayName[64] = {0}; + char mOverlayName[64] = {0}; + + // Add more member variables as needed... +}; + +#endif // XWEAPONDEF_H + + + + + + + + + +