This commit is contained in:
Christian Semmler 2024-02-23 12:23:21 -05:00
parent deed1bb971
commit dfc3a8d33e
2 changed files with 17 additions and 24 deletions

View File

@ -18,7 +18,6 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo)
{ {
DDSURFACEDESC desc, newDesc; DDSURFACEDESC desc, newDesc;
DWORD width, height; DWORD width, height;
LegoTextureInfo* textureInfo;
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
@ -28,36 +27,31 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo)
p_textureInfo->m_surface->Unlock(desc.lpSurface); p_textureInfo->m_surface->Unlock(desc.lpSurface);
} }
LegoTextureList::iterator it; for (LegoTextureList::iterator it = m_list.begin(); it != m_list.end(); it++) {
for (it = m_list.begin(); it != m_list.end(); it++) { if ((*it).second == FALSE && (*it).first->m_texture->AddRef() != 0 && (*it).first->m_texture->Release() == 1) {
if ((*it).second == FALSE) { if (!strcmp((*it).first->m_name, p_textureInfo->m_name)) {
textureInfo = (*it).first; memset(&newDesc, 0, sizeof(newDesc));
newDesc.dwSize = sizeof(newDesc);
if (textureInfo->m_texture->AddRef() != 0 && textureInfo->m_texture->Release() == 1) { if ((*it).first->m_surface->Lock(NULL, &newDesc, DDLOCK_SURFACEMEMORYPTR, NULL) == DD_OK) {
if (!strcmp(textureInfo->m_name, p_textureInfo->m_name)) { BOOL und = FALSE;
memset(&newDesc, 0, sizeof(newDesc)); if (newDesc.dwWidth == width && newDesc.dwHeight == height) {
newDesc.dwSize = sizeof(newDesc); und = TRUE;
}
if (textureInfo->m_surface->Lock(NULL, &newDesc, DDLOCK_SURFACEMEMORYPTR, NULL) == DD_OK) { (*it).first->m_surface->Unlock(newDesc.lpSurface);
BOOL und = FALSE;
if (newDesc.dwWidth == width && newDesc.dwHeight == height) {
und = TRUE;
}
textureInfo->m_surface->Unlock(newDesc.lpSurface); if (und) {
(*it).second = TRUE;
if (und) { (*it).first->m_texture->AddRef();
(*it).second = TRUE; return (*it).first;
textureInfo->m_texture->AddRef();
return textureInfo;
}
} }
} }
} }
} }
} }
textureInfo = new LegoTextureInfo(); LegoTextureInfo* textureInfo = new LegoTextureInfo();
textureInfo->m_palette = p_textureInfo->m_palette; textureInfo->m_palette = p_textureInfo->m_palette;
p_textureInfo->m_palette->Release(); p_textureInfo->m_palette->Release();
@ -107,7 +101,6 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo)
textureInfo->m_name = new char[strlen(p_textureInfo->m_name) + 1]; textureInfo->m_name = new char[strlen(p_textureInfo->m_name) + 1];
strcpy(textureInfo->m_name, p_textureInfo->m_name); strcpy(textureInfo->m_name, p_textureInfo->m_name);
return textureInfo; return textureInfo;
} }
} }

View File

@ -119,7 +119,7 @@ class LegoTextureContainer : public LegoContainer<LegoTextureInfo> {
// _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Erase // _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Erase
// TEMPLATE: LEGO1 0x1005a250 // TEMPLATE: LEGO1 0x1005a250
// list<pair<LegoTextureInfo *,int>,allocator<pair<LegoTextureInfo *,int> > >::~list<pair<LegoTextureInfo *,unsigned int>,allocator<pair<LegoTextureInfo *,unsigned int> > > // list<pair<LegoTextureInfo *,int>,allocator<pair<LegoTextureInfo *,int> > >::~list<pair<LegoTextureInfo *,int>,allocator<pair<LegoTextureInfo *,int> > >
// TEMPLATE: LEGO1 0x1005a2c0 // TEMPLATE: LEGO1 0x1005a2c0
// map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::~map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> > // map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::~map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >