diff --git a/LEGO1/lego/legoomni/include/gifmanager.h b/LEGO1/lego/legoomni/include/gifmanager.h index 902a4ea6..898ab1fb 100644 --- a/LEGO1/lego/legoomni/include/gifmanager.h +++ b/LEGO1/lego/legoomni/include/gifmanager.h @@ -11,13 +11,14 @@ #pragma warning(disable : 4237) +// SIZE 0x14 struct GifData { public: - char* m_name; - LPDIRECTDRAWSURFACE m_surface; - LPDIRECTDRAWPALETTE m_palette; - LPDIRECT3DRMTEXTURE2 m_texture; - MxU8* m_data; + char* m_name; // 0x00 + LPDIRECTDRAWSURFACE m_surface; // 0x04 + LPDIRECTDRAWPALETTE m_palette; // 0x08 + LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c + MxU8* m_data; // 0x10 ~GifData(); }; @@ -26,6 +27,7 @@ struct GifMapComparator { bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; } }; +// SIZE 0x10 class GifMap : public map { // SYNTHETIC: LEGO1 0x1005a400 // GifMap::~GifMap @@ -34,6 +36,7 @@ class GifMap : public map { typedef list GifList; // VTABLE: LEGO1 0x100d86d4 +// SIZE 0x18 class GifManagerBase { public: // FUNCTION: LEGO1 0x1005b660 @@ -65,11 +68,12 @@ class GifManagerBase { // GifManagerBase::`scalar deleting destructor' protected: - MxBool m_ownership; - GifMap m_map; + MxBool m_ownership; // 0x04 + GifMap m_map; // 0x08 }; // VTABLE: LEGO1 0x100d86fc +// SIZE 0x24 class GifManager : public GifManagerBase { public: GifManager() { m_ownership = TRUE; }; @@ -81,7 +85,7 @@ class GifManager : public GifManagerBase { void FUN_10099cc0(GifData* p_data); protected: - GifList m_list; + GifList m_list; // 0x18 }; // TEMPLATE: LEGO1 0x10059c50 diff --git a/LEGO1/lego/legoomni/src/common/gifmanager.cpp b/LEGO1/lego/legoomni/src/common/gifmanager.cpp index 5dd5e9fd..cd485b11 100644 --- a/LEGO1/lego/legoomni/src/common/gifmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/gifmanager.cpp @@ -46,21 +46,16 @@ void GifManager::FUN_10099cc0(GifData* p_data) #else for (GifList::iterator it = m_list.begin(); it != m_list.end(); it++) { #endif - if (*it == p_data) - goto found; - } + if (*it == p_data) { + // TODO: This is wrong, but what is at +0xc on the iterator? + *it = NULL; - // TODO: Maybe a function from would make this more idiomatic - // and not require a goto? This is not the only place where we iterate on - // a and return early if there is no match. - return; + if (p_data->m_texture->Release() == TRUE) { + delete p_data; + m_list.erase(it); + } -found: - // TODO: This is wrong, but what is at +0xc on the iterator? - *it = NULL; - - if (p_data->m_texture->Release() == TRUE) { - delete p_data; - m_list.erase(it); + return; + } } }