Match LegoOmni::Destroy and related (#917)

* Match LegoOmni::Destroy and related

* Write COMPAT_MODE macro differently

* fix lint issue
This commit is contained in:
Christian Semmler 2024-05-14 08:13:27 -04:00 committed by GitHub
parent ccf33575db
commit 939c09139f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 60 additions and 8 deletions

View file

@ -49,6 +49,7 @@ typedef map<char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap;
class LegoCharacterManager {
public:
LegoCharacterManager();
~LegoCharacterManager();
MxResult Write(LegoStorage* p_storage);
MxResult Read(LegoStorage* p_storage);

View file

@ -103,7 +103,9 @@ class LegoPathController : public MxCore {
LegoPathBoundary* GetPathBoundary(const char* p_name);
void Enable(MxBool p_enable);
void FUN_10046bb0(LegoWorld* p_world);
static MxResult Init();
static MxResult Reset();
private:
void FUN_10046970();

View file

@ -52,6 +52,26 @@ LegoCharacterManager::LegoCharacterManager()
VariableTable()->SetVariable(m_customizeAnimFile);
}
// FUNCTION: LEGO1 0x10083180
// FUNCTION: BETA10 0x10073dad
LegoCharacterManager::~LegoCharacterManager()
{
LegoCharacter* character = NULL;
LegoCharacterMap::iterator it;
for (it = m_characters->begin(); it != m_characters->end(); it++) {
character = (*it).second;
RemoveROI(character->m_roi);
delete[] (*it).first;
delete (*it).second;
}
delete m_characters;
delete[] g_customizeAnimFile;
}
// FUNCTION: LEGO1 0x10083270
void LegoCharacterManager::Init()
{

View file

@ -114,6 +114,7 @@ void LegoOmni::Destroy()
}
if (m_textureContainer) {
m_textureContainer->Clear();
delete m_textureContainer;
m_textureContainer = NULL;
}
@ -128,16 +129,10 @@ void LegoOmni::Destroy()
m_inputManager = NULL;
}
if (m_inputManager) {
delete m_inputManager;
m_inputManager = NULL;
}
// todo FUN_10046de0
LegoPathController::Reset();
if (m_bkgAudioManager) {
m_bkgAudioManager->Stop();
delete m_bkgAudioManager;
m_bkgAudioManager = NULL;
}
@ -150,7 +145,9 @@ void LegoOmni::Destroy()
m_action.ClearAtom();
DestroyScripts();
delete[] m_scripts;
if (m_scripts) {
delete[] m_scripts;
}
MxOmni::Destroy();
}

View file

@ -428,6 +428,25 @@ MxResult LegoPathController::Init()
return SUCCESS;
}
// FUNCTION: LEGO1 0x10046de0
// FUNCTION: BETA10 0x100b779e
MxResult LegoPathController::Reset()
{
if (g_ctrlBoundariesA == NULL || g_ctrlEdgesA == NULL) {
return FAILURE;
}
delete[] g_ctrlBoundariesA;
delete[] g_ctrlEdgesA;
delete[] g_ctrlBoundariesB;
delete[] g_ctrlEdgesB;
g_ctrlBoundariesA = NULL;
g_ctrlEdgesA = NULL;
g_ctrlBoundariesB = NULL;
g_ctrlEdgesB = NULL;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10046e50
// FUNCTION: BETA10 0x100b781f
MxResult LegoPathController::Read(LegoStorage* p_storage)

View file

@ -45,6 +45,18 @@ class LegoContainer {
}
}
void Clear()
{
#ifdef COMPAT_MODE
for (typename LegoContainerInfo<T>::iterator it = m_map.begin(); it != m_map.end(); it++)
#else
for (LegoContainerInfo<T>::iterator it = m_map.begin(); it != m_map.end(); it++)
#endif
{
delete (*it).second;
}
}
// FUNCTION: BETA10 0x1007bc00
inline T* Get(const char* p_name)
{

View file

@ -81,6 +81,7 @@ def process_files(files, module=None):
def main():
args = parse_args()
files_to_check = []
if os.path.isdir(args.target):
files_to_check = list(walk_source_dir(args.target))
elif os.path.isfile(args.target) and is_file_cpp(args.target):