Implement/match a few LegoEntity functions (#445)

* Implement/match a few LegoEntity functions

* Add annotations
This commit is contained in:
Christian Semmler
2024-01-16 14:33:03 -05:00
committed by GitHub
parent b1fdb780de
commit 6af0c6cb1a
13 changed files with 74 additions and 27 deletions

View File

@@ -29,7 +29,6 @@ void LegoFullScreenMovie::SetValue(const char* p_option)
LegoVideoManager* videomanager = VideoManager();
if (videomanager) {
if (!strcmp(m_value.GetData(), g_strEnable)) {
videomanager->EnableFullScreenMovie(TRUE);
return;

View File

@@ -47,3 +47,9 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStream* p_stream)
}
return result;
}
// STUB: LEGO1 0x10083db0
void LegoUnkSaveDataWriter::FUN_10083db0(LegoROI* p_roi)
{
// TODO
}

View File

@@ -78,7 +78,7 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3&
}
// STUB: LEGO1 0x100123e0
void LegoCameraController::FUN_100123e0(MxMatrix& p_transform, MxU32)
void LegoCameraController::FUN_100123e0(const MxMatrix& p_transform, MxU32)
{
}

View File

@@ -2,17 +2,13 @@
#include "define.h"
#include "legoomni.h"
#include "legounksavedatawriter.h"
#include "legoutil.h"
#include "legovideomanager.h"
#include "legoworld.h"
DECOMP_SIZE_ASSERT(LegoEntity, 0x68)
// FUNCTION: LEGO1 0x1000c290
LegoEntity::~LegoEntity()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x100105f0
void LegoEntity::Init()
{
@@ -20,10 +16,10 @@ void LegoEntity::Init()
m_worldDirection.Fill(0);
m_worldSpeed = 0;
m_roi = NULL;
m_cameraFlag = 0;
m_cameraFlag = FALSE;
m_actionArgString = NULL;
m_unk0x10 = 0;
m_unk0x11 = 0;
m_flags = 0;
m_actionType = ExtraActionType_unknown;
m_actionArgNumber = -1;
m_unk0x59 = 4;
@@ -50,11 +46,22 @@ MxResult LegoEntity::Create(MxDSAction& p_dsAction)
return SUCCESS;
}
// STUB: LEGO1 0x10010810
// FUNCTION: LEGO1 0x10010810
void LegoEntity::Destroy(MxBool p_fromDestructor)
{
if (m_roi) {
// TODO
if (m_flags & Flag_Bit1) {
if (m_roi->GetUnknown0x104() == this)
m_roi->SetUnknown0x104(NULL);
GetUnkSaveDataWriter()->FUN_10083db0(m_roi);
}
else {
VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi);
if (m_roi)
delete m_roi;
}
}
delete[] m_actionArgString;
@@ -82,9 +89,13 @@ void LegoEntity::SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direc
// TODO
}
// STUB: LEGO1 0x10010c30
// FUNCTION: LEGO1 0x10010c30
void LegoEntity::FUN_10010c30()
{
LegoWorld* world = GetCurrentWorld();
if (m_cameraFlag && world && world->GetCamera() && m_roi)
world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1);
}
// FUNCTION: LEGO1 0x10010e10

View File

@@ -181,6 +181,12 @@ LegoWorld* GetCurrentWorld()
return LegoOmni::GetInstance()->GetCurrentOmniWorld();
}
// FUNCTION: LEGO1 0x100157b0
LegoUnkSaveDataWriter* GetUnkSaveDataWriter()
{
return LegoOmni::GetInstance()->GetUnkSaveDataWriter();
}
// FUNCTION: LEGO1 0x100157e0
LegoPlantManager* PlantManager()
{

View File

@@ -49,12 +49,13 @@ void LegoPalettePresenter::Destroy()
MxResult LegoPalettePresenter::ParsePalette(MxStreamChunk* p_chunk)
{
MxU8 buffer[40];
RGBQUAD palleteData[256];
RGBQUAD palette[256];
MxResult result = FAILURE;
LegoMemoryStream stream((char*) p_chunk->GetData());
if (stream.Read(buffer, 40) == SUCCESS) {
if (stream.Read(palleteData, sizeof(RGBQUAD) * 256) == SUCCESS) {
m_palette = new MxPalette(palleteData);
if (stream.Read(buffer, sizeof(buffer)) == SUCCESS) {
if (stream.Read(palette, sizeof(palette)) == SUCCESS) {
m_palette = new MxPalette(palette);
if (m_palette) {
result = SUCCESS;
}