diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-12-20 12:39:44 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-12-20 12:39:44 +0200 |
commit | affd3c6baa9505328a804263434b14ee0aba1b3f (patch) | |
tree | 8c2bbbfd0d6e1c02740532662b93d99284f463b1 /src/buildings | |
parent | ae7cb924379b628ee6da1b6bceee8f1a85376d24 (diff) |
buildings directory
Diffstat (limited to 'src/buildings')
-rw-r--r-- | src/buildings/Building.cpp | 22 | ||||
-rw-r--r-- | src/buildings/Building.h | 21 | ||||
-rw-r--r-- | src/buildings/Solid.h | 12 | ||||
-rw-r--r-- | src/buildings/Treadable.cpp | 8 | ||||
-rw-r--r-- | src/buildings/Treadable.h | 17 |
5 files changed, 80 insertions, 0 deletions
diff --git a/src/buildings/Building.cpp b/src/buildings/Building.cpp new file mode 100644 index 00000000..00bbb21e --- /dev/null +++ b/src/buildings/Building.cpp @@ -0,0 +1,22 @@ +#include "common.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)->GetNumRefs() == 0) + CStreaming::RemoveModel(m_modelIndex); + m_modelIndex = id; + + if(bIsBIGBuilding) + if(m_level == LEVEL_GENERIC || m_level == CGame::currLevel) + CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE); +} diff --git a/src/buildings/Building.h b/src/buildings/Building.h new file mode 100644 index 00000000..3586a8dc --- /dev/null +++ b/src/buildings/Building.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Entity.h" + +class CBuilding : public CEntity +{ +public: + CBuilding(void) { + m_type = ENTITY_TYPE_BUILDING; + bUsesCollision = true; + } + static void *operator new(size_t); + static void operator delete(void*, size_t); + + void ReplaceWithNewModel(int32 id); + + virtual bool GetIsATreadable(void) { return false; } +}; + +VALIDATE_SIZE(CBuilding, 0x64); + diff --git a/src/buildings/Solid.h b/src/buildings/Solid.h new file mode 100644 index 00000000..4ca800c2 --- /dev/null +++ b/src/buildings/Solid.h @@ -0,0 +1,12 @@ +#pragma once + +#include "Entity.h" + +class CSolid : public CEntity +{ +public: + CSolid(void) { + m_type = ENTITY_TYPE_BUILDING; + bUsesCollision = true; + } +};
\ No newline at end of file diff --git a/src/buildings/Treadable.cpp b/src/buildings/Treadable.cpp new file mode 100644 index 00000000..00abbe13 --- /dev/null +++ b/src/buildings/Treadable.cpp @@ -0,0 +1,8 @@ +#include "common.h" + +#include "rpworld.h" +#include "Treadable.h" +#include "Pools.h" + +void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); } +void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); } diff --git a/src/buildings/Treadable.h b/src/buildings/Treadable.h new file mode 100644 index 00000000..c3160f47 --- /dev/null +++ b/src/buildings/Treadable.h @@ -0,0 +1,17 @@ +#pragma once + +#include "Building.h" + +class CTreadable : public CBuilding +{ +public: + static void *operator new(size_t); + static void operator delete(void*, size_t); + + int16 m_nodeIndices[2][12]; // first car, then ped + + bool GetIsATreadable(void) { return true; } +}; + +VALIDATE_SIZE(CTreadable, 0x94); + |