summaryrefslogtreecommitdiffstats
path: root/src/entities/Building.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-19 23:41:43 +0200
committeraap <aap@papnet.eu>2019-06-19 23:56:27 +0200
commit12f009e708b5969cd42ccf5bfb60be37b70f31d8 (patch)
tree9af4251be23041f3c68d4ccd8a34d6d14f9d6709 /src/entities/Building.cpp
parentimplemented CObjectData (diff)
downloadre3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.gz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.bz2
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.lz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.xz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.zst
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.zip
Diffstat (limited to '')
-rw-r--r--src/entities/Building.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp
index e8f19b01..ef236e89 100644
--- a/src/entities/Building.cpp
+++ b/src/entities/Building.cpp
@@ -1,7 +1,26 @@
#include "common.h"
-#include "rpworld.h"
+#include "patcher.h"
#include "Building.h"
+#include "Streaming.h"
#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); }
+
+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)
+ CStreaming::RequestModel(id, STREAM_DONT_REMOVE);
+}
+
+STARTPATCHES
+ InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
+ENDPATCHES