-
-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
545f54b
commit bdf1221
Showing
30 changed files
with
723 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: game_sa/CCoverManagerSA.cpp | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#include "StdInc.h" | ||
#include "CCoverManagerSA.h" | ||
|
||
CCoverManagerSA::CCoverManagerSA() | ||
{ | ||
m_pCoverList = reinterpret_cast<CPtrNodeDoubleListSAInterface<CEntitySAInterface>*>(0xC1A2B8); | ||
} | ||
|
||
void CCoverManagerSA::RemoveAllCovers() | ||
{ | ||
CPtrNodeDoubleLink<CEntitySAInterface>* pNode = m_pCoverList->m_pNode; | ||
while (pNode) | ||
{ | ||
RemoveCoverFromArray(pNode->pItem); | ||
pNode = pNode->pNext; | ||
} | ||
m_pCoverList->RemoveAllItems(); | ||
} | ||
|
||
void CCoverManagerSA::RemoveCover(CEntitySAInterface* entity) | ||
{ | ||
RemoveCoverFromArray(entity); | ||
|
||
m_pCoverList->RemoveItem(entity); | ||
} | ||
|
||
void CCoverManagerSA::RemoveCoverFromArray(CEntitySAInterface* entity) | ||
{ | ||
using CCover_RemoveCoverPointsForThisEntity = char(__cdecl*)(CEntitySAInterface*); | ||
((CCover_RemoveCoverPointsForThisEntity)0x698740)(entity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: game_sa/CCoverManagerSA.h | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "CEntitySA.h" | ||
#include "CPtrNodeDoubleListSA.h" | ||
|
||
class CCoverManagerSA | ||
{ | ||
public: | ||
CCoverManagerSA(); | ||
~CCoverManagerSA() = default; | ||
|
||
void RemoveAllCovers(); | ||
void RemoveCover(CEntitySAInterface* entity); | ||
|
||
private: | ||
void RemoveCoverFromArray(CEntitySAInterface* entity); | ||
|
||
private: | ||
CPtrNodeDoubleListSAInterface<CEntitySAInterface>* m_pCoverList; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: game_sa/CDummyPoolSA.cpp | ||
* PURPOSE: Dummy pool class | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "StdInc.h" | ||
#include "CDummyPoolSA.h" | ||
|
||
CDummyPoolSA::CDummyPoolSA() | ||
{ | ||
m_ppDummyPoolInterface = (CPoolSAInterface<CEntitySAInterface>**)0xB744A0; | ||
} | ||
|
||
void CDummyPoolSA::RemoveAllBuildingLods() | ||
{ | ||
if (m_pLodBackup) | ||
return; | ||
|
||
m_pLodBackup = std::make_unique<std::array<CEntitySAInterface*, MAX_DUMMIES>>(); | ||
|
||
for (int i = 0; i < MAX_DUMMIES; i++) | ||
{ | ||
CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); | ||
(*m_pLodBackup)[i] = object->m_pLod; | ||
object->m_pLod = nullptr; | ||
} | ||
} | ||
|
||
void CDummyPoolSA::RestoreAllBuildingsLods() | ||
{ | ||
if (!m_pLodBackup) | ||
return; | ||
|
||
for (int i = 0; i < MAX_DUMMIES; i++) | ||
{ | ||
CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); | ||
object->m_pLod = (*m_pLodBackup)[i]; | ||
} | ||
|
||
m_pLodBackup.release(); | ||
} | ||
|
||
void CDummyPoolSA::UpdateBuildingLods(void* oldPool, void* newPool) | ||
{ | ||
const uint32_t offset = (uint32_t)newPool - (uint32_t)oldPool; | ||
|
||
if (m_pLodBackup) | ||
{ | ||
for (int i = 0; i < MAX_DUMMIES; i++) | ||
{ | ||
if ((*m_pLodBackup)[i] != nullptr) | ||
{ | ||
(*m_pLodBackup)[i] = (CEntitySAInterface*)((uint32_t)(*m_pLodBackup)[i] + offset); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
for (int i = 0; i < MAX_DUMMIES; i++) | ||
{ | ||
CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); | ||
if (object->m_pLod) | ||
{ | ||
object->m_pLod = (CEntitySAInterface*)((uint32_t)object->m_pLod + offset); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.