From 54579deea47a18e9040d3fed2f6a3ad126c98c53 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 8 May 2021 14:02:38 +0200 Subject: [PATCH] Fix IW4 XModel Surfaces not being copied even though they are being loaded into the temp block --- src/ZoneCode/Game/IW4/XAssets/XModel.txt | 1 + .../IW4/XAssets/xmodel/xmodel_actions.cpp | 19 +++++++++++++++++++ .../Game/IW4/XAssets/xmodel/xmodel_actions.h | 15 +++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp create mode 100644 src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h diff --git a/src/ZoneCode/Game/IW4/XAssets/XModel.txt b/src/ZoneCode/Game/IW4/XAssets/XModel.txt index 8d524564..74f6b7e5 100644 --- a/src/ZoneCode/Game/IW4/XAssets/XModel.txt +++ b/src/ZoneCode/Game/IW4/XAssets/XModel.txt @@ -25,6 +25,7 @@ set count boneInfo numBones; // XModelLodInfo use XModelLodInfo; set block modelSurfs XFILE_BLOCK_TEMP; +set action modelSurfs SetModelSurfs(XModelLodInfo, XModelSurfs); set reusable modelSurfs; set condition surfs never; diff --git a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp new file mode 100644 index 00000000..39152ed4 --- /dev/null +++ b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp @@ -0,0 +1,19 @@ +#include "xmodel_actions.h" + +#include + +using namespace IW4; + +Actions_XModel::Actions_XModel(Zone* zone) + : AssetLoadingActions(zone) +{ +} + +void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const +{ + if(modelSurfs) + { + lodInfo->modelSurfs = m_zone->GetMemory()->Create(); + memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs)); + } +} diff --git a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h new file mode 100644 index 00000000..e19dbc0a --- /dev/null +++ b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Loading/AssetLoadingActions.h" +#include "Game/IW4/IW4.h" + +namespace IW4 +{ + class Actions_XModel final : public AssetLoadingActions + { + public: + explicit Actions_XModel(Zone* zone); + + void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const; + }; +}