Implement/match LegoTextureInfo::FUN_10066010 (#815)

This commit is contained in:
Christian Semmler 2024-04-17 10:05:51 -04:00 committed by GitHub
parent 7d0957aa3c
commit 97b502362d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -184,9 +184,34 @@ BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_text
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x10066010 // FUNCTION: LEGO1 0x10066010
LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits) LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits)
{ {
// TODO if (m_surface != NULL && m_texture != NULL) {
return SUCCESS; DDSURFACEDESC desc;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
if (m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
MxU8* surface = (MxU8*) desc.lpSurface;
LegoU8* bits = p_bits;
if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, p_bits, desc.dwWidth * desc.dwHeight);
}
else {
for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth);
surface += desc.lPitch;
bits += desc.dwWidth;
}
}
m_surface->Unlock(desc.lpSurface);
m_texture->Changed(TRUE, FALSE);
return SUCCESS;
}
}
return FAILURE;
} }