Fix IW4 XModel Surfaces not being copied even though they are being loaded into the temp block

This commit is contained in:
Jan 2021-05-08 14:02:38 +02:00
parent 4d37d37fd7
commit 54579deea4
3 changed files with 35 additions and 0 deletions

View File

@ -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;

View File

@ -0,0 +1,19 @@
#include "xmodel_actions.h"
#include <cstring>
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<XModelSurfs>();
memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs));
}
}

View File

@ -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;
};
}