mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement/match LegoModelPresenter::CreateROI (#591)
* Implement/match LegoModelPresenter::CreateROI * Match * Use inline function * Note about Get()
This commit is contained in:

committed by
GitHub

parent
13fc4e3285
commit
b281866ea6
@@ -14,7 +14,7 @@ LegoTextureContainer::~LegoTextureContainer()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100998e0
|
||||
LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo)
|
||||
LegoTextureInfo* LegoTextureContainer::AddToList(LegoTextureInfo* p_textureInfo)
|
||||
{
|
||||
DDSURFACEDESC desc, newDesc;
|
||||
DWORD width, height;
|
||||
@@ -110,7 +110,7 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099cc0
|
||||
void LegoTextureContainer::Erase(LegoTextureInfo* p_textureInfo)
|
||||
void LegoTextureContainer::EraseFromList(LegoTextureInfo* p_textureInfo)
|
||||
{
|
||||
if (p_textureInfo == NULL) {
|
||||
return;
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
struct LegoContainerInfoComparator {
|
||||
bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; }
|
||||
LegoU8 operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; }
|
||||
};
|
||||
|
||||
// SIZE 0x10
|
||||
@@ -44,16 +44,45 @@ public:
|
||||
|
||||
inline T* Get(const char* p_name)
|
||||
{
|
||||
// TODO: Score::Paint matches better with no `value` on the stack,
|
||||
// while LegoModelPresenter::CreateROI only matches with `value`
|
||||
T* value = NULL;
|
||||
|
||||
#ifdef COMPAT_MODE
|
||||
typename LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#else
|
||||
LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#endif
|
||||
|
||||
if (it != m_map.end()) {
|
||||
return (*it).second;
|
||||
value = (*it).second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline void Add(const char* p_name, T* p_value)
|
||||
{
|
||||
#ifdef COMPAT_MODE
|
||||
typename LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#else
|
||||
LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#endif
|
||||
|
||||
char* name;
|
||||
if (it != m_map.end()) {
|
||||
name = const_cast<char*>((*it).first);
|
||||
|
||||
if (m_ownership) {
|
||||
delete (*it).second;
|
||||
}
|
||||
}
|
||||
else {
|
||||
name = new char[strlen(p_name) + 1];
|
||||
strcpy(name, p_name);
|
||||
}
|
||||
|
||||
m_map[name] = p_value;
|
||||
}
|
||||
|
||||
inline void SetOwnership(LegoBool p_ownership) { m_ownership = p_ownership; }
|
||||
@@ -76,8 +105,8 @@ public:
|
||||
LegoTextureContainer() { m_ownership = TRUE; }
|
||||
~LegoTextureContainer() override;
|
||||
|
||||
LegoTextureInfo* Insert(LegoTextureInfo* p_textureInfo);
|
||||
void Erase(LegoTextureInfo* p_textureInfo);
|
||||
LegoTextureInfo* AddToList(LegoTextureInfo* p_textureInfo);
|
||||
void EraseFromList(LegoTextureInfo* p_textureInfo);
|
||||
|
||||
protected:
|
||||
LegoTextureList m_list; // 0x18
|
||||
@@ -90,6 +119,9 @@ protected:
|
||||
// TEMPLATE: LEGO1 0x10001cc0
|
||||
// _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Lbound
|
||||
|
||||
// TEMPLATE: LEGO1 0x1004f960
|
||||
// _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::iterator::_Dec
|
||||
|
||||
// TEMPLATE: LEGO1 0x1004f9b0
|
||||
// _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Insert
|
||||
|
||||
|
@@ -126,17 +126,3 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994a0
|
||||
LegoResult LegoMemory::GetPosition(LegoU32& p_position)
|
||||
{
|
||||
p_position = m_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994b0
|
||||
LegoResult LegoMemory::SetPosition(LegoU32 p_position)
|
||||
{
|
||||
m_position = p_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@@ -47,8 +47,20 @@ public:
|
||||
LegoMemory(void* p_buffer);
|
||||
LegoResult Read(void* p_buffer, LegoU32 p_size) override;
|
||||
LegoResult Write(const void* p_buffer, LegoU32 p_size) override;
|
||||
LegoResult GetPosition(LegoU32& p_position) override;
|
||||
LegoResult SetPosition(LegoU32 p_position) override;
|
||||
|
||||
// FUNCTION: LEGO1 0x100994a0
|
||||
LegoResult GetPosition(LegoU32& p_position) override
|
||||
{
|
||||
p_position = m_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994b0
|
||||
LegoResult SetPosition(LegoU32 p_position) override
|
||||
{
|
||||
m_position = p_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10045a80
|
||||
// LegoMemory::~LegoMemory
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define MODEL_VERSION 3
|
||||
#define MODEL_VERSION 19
|
||||
|
||||
#endif // __VERSION_H
|
||||
|
Reference in New Issue
Block a user