mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-20 23:01:16 +00:00
TglD3DRMIMAGE functions
This commit is contained in:
parent
23b0cbc17c
commit
748e1598f6
@ -612,7 +612,7 @@ class TglD3DRMIMAGE {
|
|||||||
int paletteSize,
|
int paletteSize,
|
||||||
PaletteEntry* pEntries
|
PaletteEntry* pEntries
|
||||||
);
|
);
|
||||||
~TglD3DRMIMAGE() { Destroy(); }
|
~TglD3DRMIMAGE();
|
||||||
|
|
||||||
Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer);
|
Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
@ -621,6 +621,9 @@ class TglD3DRMIMAGE {
|
|||||||
|
|
||||||
D3DRMIMAGE m_image;
|
D3DRMIMAGE m_image;
|
||||||
int m_texelsAllocatedByClient;
|
int m_texelsAllocatedByClient;
|
||||||
|
|
||||||
|
// SYNTHETIC: BETA10 0x1016abb0
|
||||||
|
// TglImpl::TglD3DRMIMAGE::`scalar deleting destructor'
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100dbb48
|
// VTABLE: LEGO1 0x100dbb48
|
||||||
|
|||||||
@ -16,36 +16,47 @@ inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture)
|
|||||||
void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
|
void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a12a0
|
// FUNCTION: LEGO1 0x100a12a0
|
||||||
|
// FUNCTION: BETA10 0x10169113
|
||||||
Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage)
|
Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage)
|
||||||
{
|
{
|
||||||
void* appData;
|
void* appData;
|
||||||
Result result;
|
Result result;
|
||||||
|
|
||||||
appData = pImage;
|
appData = pImage;
|
||||||
|
assert(reinterpret_cast<TglD3DRMIMAGE*>(appData) == pImage);
|
||||||
|
|
||||||
// This is here because in the original code they asserted
|
if (TextureGetImage(pSelf)) {
|
||||||
// on the return value being NULL.
|
assert(0);
|
||||||
TextureGetImage(pSelf);
|
}
|
||||||
|
|
||||||
result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData));
|
result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData));
|
||||||
|
assert(Succeeded(result));
|
||||||
|
|
||||||
if (Succeeded(result) && pImage) {
|
if (Succeeded(result) && pImage) {
|
||||||
result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL));
|
result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL));
|
||||||
|
assert(Succeeded(result));
|
||||||
|
|
||||||
if (!Succeeded(result)) {
|
if (!Succeeded(result)) {
|
||||||
pSelf->SetAppData(0);
|
pSelf->SetAppData(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a1300
|
// FUNCTION: LEGO1 0x100a1300
|
||||||
|
// FUNCTION: BETA10 0x10169278
|
||||||
void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
|
void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
|
||||||
{
|
{
|
||||||
TglD3DRMIMAGE* pImage = reinterpret_cast<TglD3DRMIMAGE*>(pObject->GetAppData());
|
TglD3DRMIMAGE* pImage = reinterpret_cast<TglD3DRMIMAGE*>(pObject->GetAppData());
|
||||||
|
assert(pImage);
|
||||||
|
|
||||||
delete pImage;
|
delete pImage;
|
||||||
pObject->SetAppData(0);
|
pObject->SetAppData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a1330
|
// FUNCTION: LEGO1 0x100a1330
|
||||||
|
// FUNCTION: BETA10 0x101692e1
|
||||||
TglD3DRMIMAGE::TglD3DRMIMAGE(
|
TglD3DRMIMAGE::TglD3DRMIMAGE(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@ -56,10 +67,10 @@ TglD3DRMIMAGE::TglD3DRMIMAGE(
|
|||||||
PaletteEntry* pEntries
|
PaletteEntry* pEntries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_image.aspectx = 1;
|
|
||||||
m_image.aspecty = 1;
|
|
||||||
m_image.width = 0;
|
m_image.width = 0;
|
||||||
m_image.height = 0;
|
m_image.height = 0;
|
||||||
|
m_image.aspectx = 1;
|
||||||
|
m_image.aspecty = 1;
|
||||||
m_image.depth = 0;
|
m_image.depth = 0;
|
||||||
m_image.rgb = 0;
|
m_image.rgb = 0;
|
||||||
m_image.bytes_per_line = 0;
|
m_image.bytes_per_line = 0;
|
||||||
@ -72,20 +83,27 @@ TglD3DRMIMAGE::TglD3DRMIMAGE(
|
|||||||
m_image.palette_size = 0;
|
m_image.palette_size = 0;
|
||||||
m_image.palette = NULL;
|
m_image.palette = NULL;
|
||||||
m_texelsAllocatedByClient = 0;
|
m_texelsAllocatedByClient = 0;
|
||||||
|
|
||||||
|
Result result;
|
||||||
if (pBuffer != NULL) {
|
if (pBuffer != NULL) {
|
||||||
CreateBuffer(width, height, depth, pBuffer, useBuffer);
|
result = CreateBuffer(width, height, depth, pBuffer, useBuffer);
|
||||||
|
assert(Succeeded(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pEntries != NULL) {
|
if (pEntries != NULL) {
|
||||||
InitializePalette(paletteSize, pEntries);
|
result = InitializePalette(paletteSize, pEntries);
|
||||||
|
assert(Succeeded(result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a13b0
|
// FUNCTION: LEGO1 0x100a13b0
|
||||||
void TglD3DRMIMAGE::Destroy()
|
// FUNCTION: BETA10 0x1016944b
|
||||||
|
TglD3DRMIMAGE::~TglD3DRMIMAGE()
|
||||||
{
|
{
|
||||||
if (m_texelsAllocatedByClient == 0) {
|
if (m_texelsAllocatedByClient == 0) {
|
||||||
delete[] ((char*) m_image.buffer1);
|
delete[] ((char*) m_image.buffer1);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_image.palette;
|
delete m_image.palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +190,7 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries)
|
|||||||
m_image.palette_size = paletteSize;
|
m_image.palette_size = paletteSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paletteSize > 0) {
|
if (paletteSize > 0) {
|
||||||
for (int i = 0; i < paletteSize; i++) {
|
for (int i = 0; i < paletteSize; i++) {
|
||||||
m_image.palette[i].red = pEntries[i].m_red;
|
m_image.palette[i].red = pEntries[i].m_red;
|
||||||
@ -180,6 +199,7 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries)
|
|||||||
m_image.palette[i].flags = D3DRMPALETTE_READONLY;
|
m_image.palette[i].flags = D3DRMPALETTE_READONLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user