Re3/src/entities/Building.cpp

27 lines
723 B
C++
Raw Normal View History

2019-05-15 10:52:37 -04:00
#include "common.h"
2019-06-19 17:41:43 -04:00
#include "patcher.h"
2019-05-15 10:52:37 -04:00
#include "Building.h"
2019-06-19 17:41:43 -04:00
#include "Streaming.h"
2019-05-15 10:52:37 -04:00
#include "Pools.h"
void *CBuilding::operator new(size_t sz) { return CPools::GetBuildingPool()->New(); }
void CBuilding::operator delete(void *p, size_t sz) { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
2019-06-19 17:41:43 -04:00
void
CBuilding::ReplaceWithNewModel(int32 id)
{
DeleteRwObject();
if(CModelInfo::GetModelInfo(m_modelIndex)->m_refCount == 0)
CStreaming::RemoveModel(m_modelIndex);
m_modelIndex = id;
if(bIsBIGBuilding)
if(m_level == LEVEL_NONE || m_level == CGame::currLevel)
2019-06-20 08:49:16 -04:00
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
2019-06-19 17:41:43 -04:00
}
STARTPATCHES
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
ENDPATCHES