2023-12-07 07:10:42 -05:00
|
|
|
#include "impl.h"
|
|
|
|
|
|
|
|
using namespace TglImpl;
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a31d0
|
|
|
|
void* GroupImpl::ImplementationDataPtr()
|
|
|
|
{
|
|
|
|
return reinterpret_cast<void*>(&m_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a31e0
|
2024-01-12 19:34:38 -05:00
|
|
|
Result GroupImpl::SetTransformation(FloatMatrix4& matrix)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
D3DRMMATRIX4D helper;
|
|
|
|
D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper);
|
|
|
|
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix));
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a3240
|
|
|
|
Result GroupImpl::SetColor(float r, float g, float b, float a)
|
|
|
|
{
|
|
|
|
// The first instruction makes no sense here:
|
|
|
|
// cmp dword ptr [esp + 0x10], 0
|
|
|
|
// This compares a, which we know is a float because it immediately
|
|
|
|
// gets passed into D3DRMCreateColorRGBA, but does the comparison
|
|
|
|
// as though it's an int??
|
|
|
|
if (*reinterpret_cast<int*>(&a) > 0) {
|
|
|
|
D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a);
|
|
|
|
return ResultVal(m_data->SetColor(color));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return ResultVal(m_data->SetColorRGB(r, a, b));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a32b0
|
|
|
|
Result GroupImpl::SetTexture(const Texture* pTexture)
|
|
|
|
{
|
|
|
|
IDirect3DRMTexture* pD3DTexture = pTexture ? static_cast<const TextureImpl*>(pTexture)->ImplementationData() : NULL;
|
|
|
|
return ResultVal(m_data->SetTexture(pD3DTexture));
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a32e0
|
|
|
|
Result GroupImpl::GetTexture(Texture*& pTexture)
|
|
|
|
{
|
|
|
|
IDirect3DRMTexture* pD3DTexture;
|
|
|
|
TextureImpl* holder = new TextureImpl();
|
|
|
|
Result result = ResultVal(m_data->GetTexture(&pD3DTexture));
|
|
|
|
if (result) {
|
|
|
|
// Seems to actually call the first virtual method of holder here
|
|
|
|
// but that doesn't make any sense since it passes three arguments
|
|
|
|
// to the method (self + string constant? + an offset?).
|
|
|
|
|
|
|
|
// This line makes the start of the function match and is what I
|
|
|
|
// would expect to see there but it clearly isn't what's actually
|
|
|
|
// there.
|
|
|
|
holder->SetImplementation(pD3DTexture);
|
|
|
|
}
|
|
|
|
pTexture = holder;
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a33c0
|
|
|
|
Result GroupImpl::SetMaterialMode(MaterialMode mode)
|
|
|
|
{
|
|
|
|
D3DRMMATERIALMODE d3dMode;
|
|
|
|
switch (mode) {
|
|
|
|
case FromParent:
|
|
|
|
d3dMode = D3DRMMATERIAL_FROMPARENT;
|
|
|
|
break;
|
|
|
|
case FromFrame:
|
|
|
|
d3dMode = D3DRMMATERIAL_FROMFRAME;
|
|
|
|
break;
|
|
|
|
case FromMesh:
|
|
|
|
d3dMode = D3DRMMATERIAL_FROMMESH;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ResultVal(m_data->SetMaterialMode(d3dMode));
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a3410
|
2024-03-04 16:57:35 -05:00
|
|
|
Result GroupImpl::Add(const Group* pGroup)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
2024-03-04 16:57:35 -05:00
|
|
|
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
|
|
|
|
return ResultVal(m_data->AddVisual(pGroupImpl->m_data));
|
2023-12-07 07:10:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a3430
|
2024-03-09 23:12:15 -05:00
|
|
|
Result GroupImpl::Add(const MeshBuilder* pMeshBuilder)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
2024-03-09 23:12:15 -05:00
|
|
|
const MeshBuilderImpl* pMeshBuilderImpl = static_cast<const MeshBuilderImpl*>(pMeshBuilder);
|
|
|
|
return ResultVal(m_data->AddVisual(pMeshBuilderImpl->ImplementationData()));
|
2023-12-07 07:10:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a3450
|
2024-03-08 11:55:25 -05:00
|
|
|
Result GroupImpl::Remove(const MeshBuilder* pMeshBuilder)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
2024-03-08 11:55:25 -05:00
|
|
|
const MeshBuilderImpl* pMeshBuilderImpl = static_cast<const MeshBuilderImpl*>(pMeshBuilder);
|
|
|
|
return ResultVal(m_data->DeleteVisual(pMeshBuilderImpl->ImplementationData()));
|
2023-12-07 07:10:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100a3480
|
2024-03-04 16:57:35 -05:00
|
|
|
Result GroupImpl::Remove(const Group* pGroup)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
2024-03-04 16:57:35 -05:00
|
|
|
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
|
|
|
|
return ResultVal(m_data->DeleteVisual(pGroupImpl->m_data));
|
2023-12-07 07:10:42 -05:00
|
|
|
}
|
|
|
|
|
2023-12-12 14:27:17 -05:00
|
|
|
// STUB: LEGO1 0x100a34b0
|
2023-12-07 07:10:42 -05:00
|
|
|
Result GroupImpl::RemoveAll()
|
|
|
|
{
|
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
|
2024-01-20 18:04:46 -05:00
|
|
|
// STUB: LEGO1 0x100a3540
|
2023-12-07 07:10:42 -05:00
|
|
|
Result GroupImpl::Unknown()
|
|
|
|
{
|
|
|
|
return Error;
|
|
|
|
}
|