mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
implement various LegoWorldPresenter functions (#621)
* implement LegoWorldPresenterFunctions * fix typo * Fixes/match * Fix * Match * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -83,7 +83,7 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100109b0
|
||||
void LegoEntity::SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up, MxBool)
|
||||
void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -82,11 +82,7 @@ void LegoEntityPresenter::RepeatingTickle()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10053730
|
||||
void LegoEntityPresenter::SetEntityLocation(
|
||||
Mx3DPointFloat& p_location,
|
||||
Mx3DPointFloat& p_direction,
|
||||
Mx3DPointFloat& p_up
|
||||
)
|
||||
void LegoEntityPresenter::SetEntityLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up)
|
||||
{
|
||||
if (m_entity) {
|
||||
m_entity->SetLocation(p_location, p_direction, p_up, TRUE);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "legoworldpresenter.h"
|
||||
|
||||
#include "define.h"
|
||||
#include "legoactorpresenter.h"
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legobuildingmanager.h"
|
||||
#include "legoentity.h"
|
||||
#include "legomodelpresenter.h"
|
||||
#include "legoomni.h"
|
||||
#include "legopartpresenter.h"
|
||||
#include "legoplantmanager.h"
|
||||
@@ -29,7 +31,7 @@
|
||||
MxS32 g_legoWorldPresenterQuality = 1;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f75d8
|
||||
long g_wdbOffset = 0;
|
||||
MxLong g_wdbOffset = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x100665b0
|
||||
void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality)
|
||||
@@ -224,7 +226,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
chunk.SetData(buff);
|
||||
|
||||
LegoTexturePresenter texturePresenter;
|
||||
if (texturePresenter.ParseTexture(chunk) == SUCCESS) {
|
||||
if (texturePresenter.Read(chunk) == SUCCESS) {
|
||||
texturePresenter.FUN_1004f290();
|
||||
}
|
||||
|
||||
@@ -243,7 +245,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
chunk.SetData(buff);
|
||||
|
||||
LegoPartPresenter partPresenter;
|
||||
if (partPresenter.ParsePart(chunk) == SUCCESS) {
|
||||
if (partPresenter.Read(chunk) == SUCCESS) {
|
||||
partPresenter.FUN_1007df20();
|
||||
}
|
||||
|
||||
@@ -314,17 +316,89 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10067360
|
||||
// FUNCTION: LEGO1 0x10067360
|
||||
MxResult LegoWorldPresenter::FUN_10067360(ModelDbPart& p_part, FILE* p_wdbFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
MxResult result;
|
||||
MxU8* buff = new MxU8[p_part.m_partDataLength];
|
||||
|
||||
fseek(p_wdbFile, p_part.m_partDataOffset, 0);
|
||||
if (fread(buff, p_part.m_partDataLength, 1, p_wdbFile) != 1) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxDSChunk chunk;
|
||||
chunk.SetLength(p_part.m_partDataLength);
|
||||
chunk.SetData(buff);
|
||||
|
||||
LegoPartPresenter part;
|
||||
result = part.Read(chunk);
|
||||
|
||||
if (result == SUCCESS) {
|
||||
part.FUN_1007df20();
|
||||
}
|
||||
|
||||
delete[] buff;
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100674b0
|
||||
// FUNCTION: LEGO1 0x100674b0
|
||||
MxResult LegoWorldPresenter::FUN_100674b0(ModelDbModel& p_model, FILE* p_wdbFile, LegoWorld* p_world)
|
||||
{
|
||||
// TODO
|
||||
MxU8* buff = new MxU8[p_model.m_unk0x04];
|
||||
|
||||
fseek(p_wdbFile, p_model.m_unk0x08, 0);
|
||||
if (fread(buff, p_model.m_unk0x04, 1, p_wdbFile) != 1) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxDSChunk chunk;
|
||||
chunk.SetLength(p_model.m_unk0x04);
|
||||
chunk.SetData(buff);
|
||||
|
||||
MxDSAction action;
|
||||
MxAtomId atom;
|
||||
action.SetLocation(p_model.m_location);
|
||||
action.SetDirection(p_model.m_direction);
|
||||
action.SetUp(p_model.m_up);
|
||||
|
||||
MxU32 objectId = m_unk0x50;
|
||||
m_unk0x50++;
|
||||
action.SetObjectId(objectId);
|
||||
|
||||
action.SetAtomId(atom);
|
||||
|
||||
LegoEntity* createdEntity = NULL;
|
||||
|
||||
if (!strcmp(p_model.m_presenterName, "LegoActorPresenter")) {
|
||||
LegoActorPresenter presenter;
|
||||
presenter.SetAction(&action);
|
||||
LegoEntity* entity = (LegoEntity*) presenter.CreateEntity("LegoActor");
|
||||
presenter.SetInternalEntity(entity);
|
||||
presenter.SetEntityLocation(p_model.m_location, p_model.m_direction, p_model.m_up);
|
||||
entity->Create(action);
|
||||
}
|
||||
else if (!strcmp(p_model.m_presenterName, "LegoEntityPresenter")) {
|
||||
LegoEntityPresenter presenter;
|
||||
presenter.SetAction(&action);
|
||||
createdEntity = (LegoEntity*) presenter.CreateEntity("LegoEntity");
|
||||
presenter.SetInternalEntity(createdEntity);
|
||||
presenter.SetEntityLocation(p_model.m_location, p_model.m_direction, p_model.m_up);
|
||||
createdEntity->Create(action);
|
||||
}
|
||||
|
||||
LegoModelPresenter modelPresenter;
|
||||
|
||||
if (createdEntity != NULL) {
|
||||
action.SetLocation(Mx3DPointFloat(0.0, 0.0, 0.0));
|
||||
action.SetUp(Mx3DPointFloat(0.0, 0.0, 1.0));
|
||||
action.SetDirection(Mx3DPointFloat(0.0, 1.0, 0.0));
|
||||
}
|
||||
|
||||
modelPresenter.SetAction(&action);
|
||||
modelPresenter.FUN_1007ff70(chunk, createdEntity, p_model.m_unk0x34, p_world);
|
||||
delete[] buff;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,16 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007ff70
|
||||
void LegoModelPresenter::FUN_1007ff70(
|
||||
MxDSChunk& p_chunk,
|
||||
LegoEntity* p_entity,
|
||||
undefined p_modelUnknown0x34,
|
||||
LegoWorld* p_world
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10080050
|
||||
void LegoModelPresenter::ReadyTickle()
|
||||
{
|
||||
@@ -214,13 +224,13 @@ void LegoModelPresenter::ReadyTickle()
|
||||
|
||||
if (m_roi != NULL) {
|
||||
if (m_compositePresenter && m_compositePresenter->IsA("LegoEntityPresenter")) {
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->SetROI(m_roi, m_addedToView, TRUE);
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetROI(m_roi, m_addedToView, TRUE);
|
||||
((LegoEntityPresenter*) m_compositePresenter)
|
||||
->GetEntity()
|
||||
->GetInternalEntity()
|
||||
->SetFlags(
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->GetFlags() & ~LegoEntity::c_bit2
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ~LegoEntity::c_bit2
|
||||
);
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->FUN_100114e0(0);
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->FUN_100114e0(0);
|
||||
}
|
||||
|
||||
ParseExtra();
|
||||
@@ -240,11 +250,12 @@ void LegoModelPresenter::ReadyTickle()
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->Moved(*m_roi);
|
||||
|
||||
if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoEntityPresenter")) {
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->SetROI(m_roi, TRUE, TRUE);
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetROI(m_roi, TRUE, TRUE);
|
||||
((LegoEntityPresenter*) m_compositePresenter)
|
||||
->GetEntity()
|
||||
->GetInternalEntity()
|
||||
->SetFlags(
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->GetFlags() & ~LegoEntity::c_bit2
|
||||
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() &
|
||||
~LegoEntity::c_bit2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void LegoPartPresenter::Destroy(MxBool p_fromDestructor)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007ca30
|
||||
MxResult LegoPartPresenter::ParsePart(MxDSChunk& p_chunk)
|
||||
MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -20,7 +20,7 @@ MxResult LegoTexturePresenter::AddToManager()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004ebd0
|
||||
MxResult LegoTexturePresenter::ParseTexture(MxDSChunk& p_chunk)
|
||||
MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user