isle-portable/LEGO1/tgl/d3drm/group.cpp
MS b5a3c5feea
Enforce vtable match (#464)
* vtable enforce

* Vtable progress

* IslePathActor subclasses

* LegoState subclasses

* LegoWorld subclasses

* Presenter progress

* Remaining presenters

* All but two that need new files

* Merge into vtable branch (#3)

* Implement MxDisplaySurface::VTable0x44 (#467)

* Update mxdisplaysurface.cpp

* add arguments to header

* Fix glitched bitmaps

* WIP fixes

* Match

* Fix

* Changes

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>

* Implmement PoliceState::VTable0x1c (#468)

* Implmement PoliceState::VTable0x1c

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>

* Implement Lego3DView::Render (#470)

* Implement Lego3DView::Render

* use MxDouble

* Revert "use MxDouble"

This reverts commit a006b60e2066b79ded3e15e143a302d8fd707deb.

* Begin work on Police class (#469)

* Begin work on Police class

* Use JukeBox::e_policeStation value

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>

* Implement MxDisplaySurface::CreateCursorSurface (#471)

* Update mxdisplaysurface.cpp

* Fixes

* Update legovideomanager.cpp

* Match to 100%

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>

---------

Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>

* Police fix

* Finish

* motocycle lower case

* Update historybook.h

* Update hospitalstate.h

* Update jetski.h

* Update legoinputmanager.h

* Update legolocomotionanimpresenter.h

* Update pizza.h

* Update act3shark.h

* Update ambulancemissionstate.h

* Update bumpbouy.h

* Update doors.h

---------

Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>
2024-01-20 18:04:46 -05:00

119 lines
3.2 KiB
C++

#include "impl.h"
using namespace TglImpl;
// FUNCTION: LEGO1 0x100a31d0
void* GroupImpl::ImplementationDataPtr()
{
return reinterpret_cast<void*>(&m_data);
}
// FUNCTION: LEGO1 0x100a31e0
Result GroupImpl::SetTransformation(FloatMatrix4& matrix)
{
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
Result GroupImpl::Add(const Mesh* pMesh)
{
const MeshImpl* pMeshImpl = static_cast<const MeshImpl*>(pMesh);
return ResultVal(m_data->AddVisual(pMeshImpl->ImplementationData()->groupMesh));
}
// FUNCTION: LEGO1 0x100a3430
Result GroupImpl::Add(const Group* pGroup)
{
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
return ResultVal(m_data->AddVisual(pGroupImpl->m_data));
}
// FUNCTION: LEGO1 0x100a3450
Result GroupImpl::Remove(const Group* pGroup)
{
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
return ResultVal(m_data->DeleteVisual(pGroupImpl->m_data));
}
// FUNCTION: LEGO1 0x100a3480
Result GroupImpl::Remove(const Mesh* pMesh)
{
const MeshImpl* pMeshImpl = static_cast<const MeshImpl*>(pMesh);
return ResultVal(m_data->DeleteVisual(pMeshImpl->ImplementationData()->groupMesh));
}
// STUB: LEGO1 0x100a34b0
Result GroupImpl::RemoveAll()
{
return Error;
}
// STUB: LEGO1 0x100a3540
Result GroupImpl::Unknown()
{
return Error;
}