mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 02:31:15 +00:00
Refactor atom
This commit is contained in:
parent
d7568f897d
commit
6b1e74137f
@ -211,8 +211,7 @@ add_library(omni STATIC
|
||||
LEGO1/omni/src/audio/mxsoundmanager.cpp
|
||||
LEGO1/omni/src/audio/mxsoundpresenter.cpp
|
||||
LEGO1/omni/src/audio/mxwavepresenter.cpp
|
||||
LEGO1/omni/src/common/mxatomidcounter.cpp
|
||||
LEGO1/omni/src/common/mxatomid.cpp
|
||||
LEGO1/omni/src/common/mxatom.cpp
|
||||
LEGO1/omni/src/common/mxcompositepresenter.cpp
|
||||
LEGO1/omni/src/common/mxcore.cpp
|
||||
LEGO1/omni/src/common/mxmediamanager.cpp
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
#ifndef MXATOMIDCOUNTER_H
|
||||
#define MXATOMIDCOUNTER_H
|
||||
#ifndef MXATOM_H
|
||||
#define MXATOM_H
|
||||
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxstring.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
// Counts the number of existing MxAtomId objects based
|
||||
// on the matching char* string. A <map> seems fit for purpose here:
|
||||
@ -43,6 +44,36 @@ struct MxAtomIdCounterCompare {
|
||||
|
||||
class MxAtomIdCounterSet : public set<MxAtomIdCounter*, MxAtomIdCounterCompare> {};
|
||||
|
||||
enum LookupMode {
|
||||
e_exact = 0,
|
||||
e_lowerCase,
|
||||
e_upperCase,
|
||||
e_lowerCase2,
|
||||
};
|
||||
|
||||
// SIZE 0x04
|
||||
class MxAtomId {
|
||||
public:
|
||||
MxAtomId(const char*, LookupMode);
|
||||
MxAtomId& operator=(const MxAtomId& p_atomId);
|
||||
~MxAtomId();
|
||||
|
||||
MxAtomId() { this->m_internal = 0; }
|
||||
|
||||
inline MxBool operator==(const MxAtomId& p_atomId) const { return this->m_internal == p_atomId.m_internal; }
|
||||
inline MxBool operator!=(const MxAtomId& p_atomId) const { return this->m_internal != p_atomId.m_internal; }
|
||||
|
||||
void Clear();
|
||||
|
||||
const char* GetInternal() const { return m_internal; }
|
||||
|
||||
private:
|
||||
MxAtomIdCounter* GetCounter(const char*, LookupMode);
|
||||
void Destroy();
|
||||
|
||||
const char* m_internal; // 0x00
|
||||
};
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100ad170
|
||||
// MxAtomIdCounter::~MxAtomIdCounter
|
||||
|
||||
@ -89,4 +120,4 @@ class MxAtomIdCounterSet : public set<MxAtomIdCounter*, MxAtomIdCounterCompare>
|
||||
// TEMPLATE: LEGO1 0x100afe40
|
||||
// Set<MxAtomIdCounter *,MxAtomIdCounterCompare>::~Set<MxAtomIdCounter *,MxAtomIdCounterCompare>
|
||||
|
||||
#endif // MXATOMIDCOUNTER_H
|
||||
#endif // MXATOM_H
|
||||
@ -1,37 +0,0 @@
|
||||
#ifndef MXATOMID_H
|
||||
#define MXATOMID_H
|
||||
|
||||
#include "mxatomidcounter.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
enum LookupMode {
|
||||
e_exact = 0,
|
||||
e_lowerCase,
|
||||
e_upperCase,
|
||||
e_lowerCase2,
|
||||
};
|
||||
|
||||
// SIZE 0x04
|
||||
class MxAtomId {
|
||||
public:
|
||||
MxAtomId(const char*, LookupMode);
|
||||
MxAtomId& operator=(const MxAtomId& p_atomId);
|
||||
~MxAtomId();
|
||||
|
||||
MxAtomId() { this->m_internal = 0; }
|
||||
|
||||
inline MxBool operator==(const MxAtomId& p_atomId) const { return this->m_internal == p_atomId.m_internal; }
|
||||
inline MxBool operator!=(const MxAtomId& p_atomId) const { return this->m_internal != p_atomId.m_internal; }
|
||||
|
||||
void Clear();
|
||||
|
||||
const char* GetInternal() const { return m_internal; }
|
||||
|
||||
private:
|
||||
MxAtomIdCounter* GetCounter(const char*, LookupMode);
|
||||
void Destroy();
|
||||
|
||||
const char* m_internal; // 0x00
|
||||
};
|
||||
|
||||
#endif // MXATOMID_H
|
||||
@ -2,7 +2,7 @@
|
||||
#define MXDSOBJECT_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
class MxPresenter;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define MXENTITY_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxcore.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef MXOBJECTFACTORY_H
|
||||
#define MXOBJECTFACTORY_H
|
||||
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
#define FOR_MXOBJECTFACTORY_OBJECTS(X) \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define MXSOUNDMANAGER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxaudiomanager.h"
|
||||
|
||||
#include <dsound.h>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define MXSTREAMCONTROLLER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxcore.h"
|
||||
#include "mxcriticalsection.h"
|
||||
#include "mxdsaction.h"
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
#include "mxatomid.h"
|
||||
#include "mxatom.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxAtomId, 0x04);
|
||||
DECOMP_SIZE_ASSERT(MxAtomIdCounter, 0x14);
|
||||
DECOMP_SIZE_ASSERT(MxAtomIdCounterSet, 0x10);
|
||||
|
||||
// FUNCTION: LEGO1 0x100acf90
|
||||
MxAtomId::MxAtomId(const char* p_str, LookupMode p_mode)
|
||||
{
|
||||
@ -108,3 +113,17 @@ void MxAtomId::Clear()
|
||||
Destroy();
|
||||
m_internal = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ad7f0
|
||||
void MxAtomIdCounter::Inc()
|
||||
{
|
||||
m_value++;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ad800
|
||||
void MxAtomIdCounter::Dec()
|
||||
{
|
||||
if (m_value) {
|
||||
m_value--;
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#include "mxatomidcounter.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxAtomIdCounter, 0x14);
|
||||
DECOMP_SIZE_ASSERT(MxAtomIdCounterSet, 0x10);
|
||||
|
||||
// FUNCTION: LEGO1 0x100ad7f0
|
||||
void MxAtomIdCounter::Inc()
|
||||
{
|
||||
m_value++;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ad800
|
||||
void MxAtomIdCounter::Dec()
|
||||
{
|
||||
if (m_value) {
|
||||
m_value--;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
#include "mxomni.h"
|
||||
|
||||
#include "mxactionnotificationparam.h"
|
||||
#include "mxatomidcounter.h"
|
||||
#include "mxatom.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxdsmultiaction.h"
|
||||
#include "mxeventmanager.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user