Merge remote-tracking branch 'isle/master'

This commit is contained in:
Christian Semmler 2025-06-09 13:04:34 -07:00
commit fae0416716
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
24 changed files with 291 additions and 273 deletions

View File

@ -16,6 +16,24 @@ class MxStillPresenter;
// SIZE 0x18
class HospitalState : public LegoState {
public:
enum {
e_exitToClose = 0,
e_newState = 1,
e_unknown3 = 3,
e_unknown4 = 4,
e_introduction = 5,
e_explainQuestShort = 6,
e_explainQuest = 7,
e_waitAcceptingQuest = 8,
e_beforeEnteringAmbulance = 9,
e_unknown10 = 10, // Can never be reached
e_unknown11 = 11, // Can only be reached via e_unknown10
e_afterAcceptingQuest = 12,
e_exitImmediately = 13,
e_exitToInfocenter = 14,
e_exitToFront = 15,
};
HospitalState();
~HospitalState() override {}
@ -40,13 +58,13 @@ public:
// TODO: Most likely getters/setters are not used according to BETA.
undefined4 m_unk0x08; // 0x08
MxS16 m_unk0x0c; // 0x0c
MxS16 m_unk0x0e; // 0x0e
MxS16 m_unk0x10; // 0x10
MxS16 m_unk0x12; // 0x12
MxS16 m_unk0x14; // 0x14
MxS16 m_unk0x16; // 0x16
MxS32 m_state; // 0x08
MxS16 m_stateActor; // 0x0c
MxS16 m_statePepper; // 0x0e
MxS16 m_stateMama; // 0x10
MxS16 m_statePapa; // 0x12
MxS16 m_stateNick; // 0x14
MxS16 m_stateLaura; // 0x16
};
// VTABLE: LEGO1 0x100d9730
@ -95,13 +113,13 @@ private:
MxS16 m_currentActorId; // 0xf8
LegoGameState::Area m_destLocation; // 0xfc
undefined2 m_unk0x100; // 0x100
MxU16 m_interactionMode; // 0x100
HospitalState* m_hospitalState; // 0x104
undefined2 m_unk0x108; // 0x108
MxU16 m_setWithCurrentAction; // 0x108
HospitalScript::Script m_currentAction; // 0x10c
MxStillPresenter* m_copLedBitmap; // 0x110
MxStillPresenter* m_pizzaLedBitmap; // 0x114
undefined m_unk0x118; // 0x118
MxBool m_flashingLeds; // 0x118
MxLong m_copLedAnimTimer; // 0x11c
MxLong m_pizzaLedAnimTimer; // 0x120
MxLong m_time; // 0x124

View File

@ -39,7 +39,7 @@ public:
MxResult AddActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void CheckAndCallPathTriggers(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void SwitchBoundary(
LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary,
@ -47,8 +47,8 @@ public:
float& p_unk0xe4
);
MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoOrientedEdge*& p_edge);
MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter);
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);
MxU32 AddPresenterIfInRange(LegoAnimPresenter* p_presenter);
MxU32 RemovePresenter(LegoAnimPresenter* p_presenter);
// FUNCTION: BETA10 0x1001ffb0
LegoPathActorSet& GetActors() { return m_actors; }

View File

@ -110,7 +110,7 @@ public:
MxResult PlaceActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100468f0(LegoAnimPresenter* p_presenter);
void FUN_10046930(LegoAnimPresenter* p_presenter);
void RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter);
MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL);
LegoPathBoundary* GetPathBoundary(const char* p_name);
void Enable(MxBool p_enable);
@ -194,12 +194,12 @@ private:
LegoPathBoundary* m_boundaries; // 0x08
LegoPathCtrlEdge* m_edges; // 0x0c
Mx3DPointFloat* m_unk0x10; // 0x10
Mx3DPointFloat* m_nodes; // 0x10
LegoPathStruct* m_structs; // 0x14
MxU16 m_numL; // 0x18
MxU16 m_numE; // 0x1a
MxU16 m_numN; // 0x1c
MxU16 m_numT; // 0x1e
MxU16 m_numL; // 0x18 Number of boundaries
MxU16 m_numE; // 0x1a Number of edges
MxU16 m_numN; // 0x1c Number of nodes
MxU16 m_numT; // 0x1e Number of structs
LegoPathCtrlEdgeSet m_pfsE; // 0x20
LegoPathActorSet m_actors; // 0x30

View File

@ -24,7 +24,7 @@ public:
static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo);
static BOOL GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo);
LegoResult FUN_10066010(const LegoU8* p_bits);
LegoResult LoadBits(const LegoU8* p_bits);
// private:
char* m_name; // 0x00

View File

@ -245,7 +245,7 @@ void Act3Cop::ParseAction(char* p_extra)
}
}
Mx4DPointFloat* boundary0x14 = boundary->GetUnknown0x14();
Mx4DPointFloat* boundary0x14 = boundary->GetUp();
if (point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) <= 0.001 &&
point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) >= -0.001) {

View File

@ -337,7 +337,7 @@ void Act3Ammo::Animate(float p_time)
Vector3 local174(local104[2]);
if (IsPizza()) {
local184 = *m_boundary->GetUnknown0x14();
local184 = *m_boundary->GetUp();
local17c[0] = 1.0f;
local17c[1] = local17c[2] = 0.0f;
local174.EqualsCross(local17c, local184);
@ -345,7 +345,7 @@ void Act3Ammo::Animate(float p_time)
local17c.EqualsCross(local184, local174);
}
else {
local17c = *m_boundary->GetUnknown0x14();
local17c = *m_boundary->GetUp();
local184[0] = 1.0f;
local184[1] = local184[2] = 0.0f;
local174.EqualsCross(local17c, local184);

View File

@ -827,7 +827,7 @@ MxResult LegoBuildingManager::FUN_10030630()
}
if (g_buildingInfo[i].m_boundary != NULL) {
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUnknown0x14();
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUp();
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {

View File

@ -160,7 +160,7 @@ MxResult LegoPlantManager::FUN_10026410()
}
if (g_plantInfo[i].m_boundary != NULL) {
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUnknown0x14();
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUp();
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {

View File

@ -186,7 +186,7 @@ BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_text
}
// FUNCTION: LEGO1 0x10066010
LegoResult LegoTextureInfo::FUN_10066010(const LegoU8* p_bits)
LegoResult LegoTextureInfo::LoadBits(const LegoU8* p_bits)
{
if (m_surface != NULL && m_texture != NULL) {
DDSURFACEDESC desc;

View File

@ -792,6 +792,6 @@ void FUN_1003f930(LegoNamedTexture* p_namedTexture)
LegoTextureInfo* textureInfo = TextureContainer()->Get(p_namedTexture->GetName()->GetData());
if (textureInfo != NULL) {
textureInfo->FUN_10066010(p_namedTexture->GetTexture()->GetImage()->GetBits());
textureInfo->LoadBits(p_namedTexture->GetTexture()->GetImage()->GetBits());
}
}

View File

@ -371,7 +371,7 @@ void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter)
LegoPathController* controller;
while (cursor.Next(controller)) {
controller->FUN_10046930(p_presenter);
controller->RemovePresenterFromBoundaries(p_presenter);
}
}

View File

@ -36,7 +36,7 @@ DECOMP_SIZE_ASSERT(LegoWorldPresenter, 0x54)
MxS32 g_legoWorldPresenterQuality = 1;
// GLOBAL: LEGO1 0x100f75d8
Sint64 g_wdbOffset = 0;
Sint64 g_wdbSkipGlobalPartsOffset = 0;
// FUNCTION: LEGO1 0x100665b0
void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality)
@ -208,7 +208,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
return FAILURE;
}
if (g_wdbOffset == 0) {
if (g_wdbSkipGlobalPartsOffset == 0) {
if (SDL_ReadIO(wdbFile, &size, sizeof(MxU32)) != sizeof(MxU32)) {
return FAILURE;
}
@ -248,10 +248,10 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
delete[] buff;
g_wdbOffset = SDL_TellIO(wdbFile);
g_wdbSkipGlobalPartsOffset = SDL_TellIO(wdbFile);
}
else {
if (SDL_SeekIO(wdbFile, g_wdbOffset, SDL_IO_SEEK_SET) != g_wdbOffset) {
if (SDL_SeekIO(wdbFile, g_wdbSkipGlobalPartsOffset, SDL_IO_SEEK_SET) != g_wdbSkipGlobalPartsOffset) {
return FAILURE;
}
}

View File

@ -141,7 +141,7 @@ MxResult LegoPathActor::VTable0x88(
matrix.SetIdentity();
pos = p1;
dir = p4;
up = *m_boundary->GetUnknown0x14();
up = *m_boundary->GetUp();
if (!m_cameraFlag || !m_userNavFlag) {
dir *= -1.0f;
@ -151,7 +151,7 @@ MxResult LegoPathActor::VTable0x88(
m_roi->UpdateTransformationRelativeToParent(matrix);
if (!m_cameraFlag || !m_userNavFlag) {
p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3);
p5.EqualsCross(*p_boundary->GetUp(), p3);
p5.Unitize();
if (VTable0x80(p1, p4, p2, p5) == SUCCESS) {
@ -212,7 +212,7 @@ MxResult LegoPathActor::VTable0x84(
matrix.SetIdentity();
pos = p_p1;
dir = p_p4;
up = *m_boundary->GetUnknown0x14();
up = *m_boundary->GetUp();
if (!m_cameraFlag || !m_userNavFlag) {
dir *= -1.0f;
@ -226,7 +226,7 @@ MxResult LegoPathActor::VTable0x84(
FUN_10010c30();
}
else {
p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3);
p5.EqualsCross(*p_boundary->GetUp(), p3);
p5.Unitize();
if (VTable0x80(p_p1, p_p4, p2, p5) != SUCCESS) {
@ -257,7 +257,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
m_worldSpeed = nav->GetLinearVel();
if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUnknown0x14())) {
if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUp())) {
Mx3DPointFloat p6;
p6 = p2;
MxS32 result = 0;
@ -281,7 +281,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
result = 0;
}
else {
m_boundary->FUN_100575b0(p4, p2, this);
m_boundary->CheckAndCallPathTriggers(p4, p2, this);
}
LegoPathBoundary* oldBoundary = m_boundary;
@ -322,7 +322,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
Vector3 pos(p_transform[3]);
dir = p1;
up = *m_boundary->GetUnknown0x14();
up = *m_boundary->GetUp();
right.EqualsCross(up, dir);
MxS32 res = right.Unitize();
@ -355,10 +355,10 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
LegoResult r;
if (m_userNavFlag) {
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 0);
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 0);
}
else {
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 1);
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 1);
}
assert(r == 0); // SUCCESS
@ -372,7 +372,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
return 1;
}
else {
m_boundary->FUN_100575b0(pos2, pos1, this);
m_boundary->CheckAndCallPathTriggers(pos2, pos1, this);
pos2 = pos1;
}
@ -663,7 +663,7 @@ MxResult LegoPathActor::VTable0x9c()
LERP3(local34, v1, v2, m_unk0xe4);
m_destEdge->GetFaceNormal(*m_boundary, local78);
local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78);
local48.EqualsCross(*m_boundary->GetUp(), local78);
local48.Unitize();
}
@ -671,7 +671,7 @@ MxResult LegoPathActor::VTable0x9c()
Vector3 upRef(m_unk0xec[1]);
Vector3 dirRef(m_unk0xec[2]);
upRef = *m_boundary->GetUnknown0x14();
upRef = *m_boundary->GetUp();
rightRef.EqualsCross(upRef, dirRef);
rightRef.Unitize();

View File

@ -46,27 +46,27 @@ MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor)
// FUNCTION: LEGO1 0x100575b0
// FUNCTION: BETA10 0x100b1598
void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor)
void LegoPathBoundary::CheckAndCallPathTriggers(Vector3& p_from, Vector3& p_to, LegoPathActor* p_actor)
{
Vector3* ccwV = NULL;
if (m_numTriggers > 0 && m_unk0x50 != NULL) {
if (m_numTriggers > 0 && m_direction != NULL) {
ccwV = m_edges[0]->CCWVertex(*this);
Mx3DPointFloat v;
v = p_point1;
v = p_from;
v -= *ccwV;
float dot1 = v.Dot(v, *m_unk0x50);
float dot1 = v.Dot(v, *m_direction);
v = p_point2;
v = p_to;
v -= *ccwV;
float dot2 = v.Dot(v, *m_unk0x50);
float dot2 = v.Dot(v, *m_direction);
if (dot2 > dot1) {
for (MxS32 i = 0; i < m_numTriggers; i++) {
LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) {
if (m_pathTrigger[i].m_triggerLength >= dot1 && m_pathTrigger[i].m_triggerLength < dot2) {
s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data);
}
}
@ -75,7 +75,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
for (MxS32 i = 0; i < m_numTriggers; i++) {
LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) {
if (m_pathTrigger[i].m_triggerLength >= dot2 && m_pathTrigger[i].m_triggerLength < dot1) {
s->HandleTrigger(p_actor, FALSE, m_pathTrigger[i].m_data);
}
}
@ -341,15 +341,15 @@ MxU32 LegoPathBoundary::Intersect(
// FUNCTION: LEGO1 0x10057fe0
// FUNCTION: BETA10 0x100b2220
MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
MxU32 LegoPathBoundary::AddPresenterIfInRange(LegoAnimPresenter* p_presenter)
{
Mx3DPointFloat unk0x30;
unk0x30 = m_unk0x30;
unk0x30 = m_centerPoint;
unk0x30 -= p_presenter->m_unk0xa8;
float len = unk0x30.LenSquared();
float local20 = p_presenter->m_unk0xa4 + m_unk0x44;
float local20 = p_presenter->m_unk0xa4 + m_boundingRadius;
if (len > 0.001 && len > local20 * local20) {
return 0;
@ -361,7 +361,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
// FUNCTION: LEGO1 0x100586e0
// FUNCTION: BETA10 0x100b22d1
MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter)
MxU32 LegoPathBoundary::RemovePresenter(LegoAnimPresenter* p_presenter)
{
if (p_presenter != NULL) {
if (m_presenters.find(p_presenter) != m_presenters.end()) {

View File

@ -73,7 +73,7 @@ LegoPathController::LegoPathController()
{
m_boundaries = NULL;
m_edges = NULL;
m_unk0x10 = NULL;
m_nodes = NULL;
m_structs = NULL;
m_numL = 0;
m_numE = 0;
@ -101,7 +101,7 @@ MxResult LegoPathController::Create(
}
for (i = 0; i < m_numN; i++) {
m_unk0x10[i] += p_location;
m_nodes[i] += p_location;
}
for (i = 0; i < m_numL; i++) {
@ -151,10 +151,10 @@ void LegoPathController::Destroy()
m_boundaries = NULL;
m_numL = 0;
if (m_unk0x10 != NULL) {
delete[] m_unk0x10;
if (m_nodes != NULL) {
delete[] m_nodes;
}
m_unk0x10 = NULL;
m_nodes = NULL;
m_numN = 0;
if (m_structs != NULL) {
@ -354,17 +354,17 @@ void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter)
{
for (MxS32 i = 0; i < m_numL; i++) {
if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) {
m_boundaries[i].FUN_10057fe0(p_presenter);
m_boundaries[i].AddPresenterIfInRange(p_presenter);
}
}
}
// FUNCTION: LEGO1 0x10046930
// FUNCTION: BETA10 0x100b737b
void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter)
void LegoPathController::RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter)
{
for (MxS32 i = 0; i < m_numL; i++) {
m_boundaries[i].FUN_100586e0(p_presenter);
m_boundaries[i].RemovePresenter(p_presenter);
}
}
@ -478,7 +478,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
return FAILURE;
}
if (m_numN > 0) {
m_unk0x10 = new Mx3DPointFloat[m_numN];
m_nodes = new Mx3DPointFloat[m_numN];
}
if (p_storage->Read(&m_numE, sizeof(MxU16)) != SUCCESS) {
@ -501,7 +501,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
if (m_numN > 0) {
for (MxS32 i = 0; i < m_numN; i++) {
if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) {
if (ReadVector(p_storage, m_nodes[i]) != SUCCESS) {
return FAILURE;
}
}
@ -566,12 +566,12 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
edge.m_pointA = &m_unk0x10[s];
edge.m_pointA = &m_nodes[s];
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE;
}
edge.m_pointB = &m_unk0x10[s];
edge.m_pointB = &m_nodes[s];
if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) {
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
@ -669,7 +669,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
boundary.m_name[length] = '\0';
}
if (ReadVector(p_storage, boundary.m_unk0x14) != SUCCESS) {
if (ReadVector(p_storage, boundary.m_up) != SUCCESS) {
return FAILURE;
}
@ -679,11 +679,11 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
}
}
if (ReadVector(p_storage, boundary.m_unk0x30) != SUCCESS) {
if (ReadVector(p_storage, boundary.m_centerPoint) != SUCCESS) {
return FAILURE;
}
if (p_storage->Read(&boundary.m_unk0x44, sizeof(boundary.m_unk0x44)) != SUCCESS) {
if (p_storage->Read(&boundary.m_boundingRadius, sizeof(boundary.m_boundingRadius)) != SUCCESS) {
return FAILURE;
}
@ -692,7 +692,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
}
if (boundary.m_numTriggers > 0) {
boundary.m_unk0x50 = new Mx3DPointFloat;
boundary.m_direction = new Mx3DPointFloat;
boundary.m_pathTrigger = new PathWithTrigger[boundary.m_numTriggers];
for (j = 0; j < boundary.m_numTriggers; j++) {
@ -708,14 +708,14 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
}
if (p_storage->Read(
&boundary.m_pathTrigger[j].m_unk0x08,
sizeof(boundary.m_pathTrigger[j].m_unk0x08)
&boundary.m_pathTrigger[j].m_triggerLength,
sizeof(boundary.m_pathTrigger[j].m_triggerLength)
) != SUCCESS) {
return FAILURE;
}
}
if (ReadVector(p_storage, *boundary.m_unk0x50) != SUCCESS) {
if (ReadVector(p_storage, *boundary.m_direction) != SUCCESS) {
return FAILURE;
}
}
@ -963,7 +963,7 @@ MxS32 LegoPathController::FUN_1004a240(
p_v1 *= p_f1;
p_v1 += *p_edge->CWVertex(*p_boundary);
p_edge->GetFaceNormal(*p_boundary, vec);
p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec);
p_v2.EqualsCross(*p_boundary->GetUp(), vec);
return 0;
}
@ -987,7 +987,7 @@ MxResult LegoPathController::FUN_1004a380(
}
LegoPathBoundary* b = &m_boundaries[i];
Mx4DPointFloat* unk0x14 = b->GetUnknown0x14();
Mx4DPointFloat* unk0x14 = b->GetUp();
float local28 = p_param3[0].Dot(p_param3[0], *unk0x14);
if (local28 < 0.001 && local28 > -0.001) {

View File

@ -172,7 +172,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector);
crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector);
crossProduct.EqualsCross(*m_boundary->GetUp(), destEdgeUnknownVector);
crossProduct.Unitize();
Mx3DPointFloat worldDirection(Vector3(m_roi->GetWorldDirection()));
@ -266,8 +266,8 @@ MxResult LegoCarRaceActor::VTable0x9c()
d->GetFaceNormal(*b, point2);
m_destEdge->GetFaceNormal(*m_boundary, point3);
point4.EqualsCross(point2, *m_boundary->GetUnknown0x14());
point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3);
point4.EqualsCross(point2, *m_boundary->GetUp());
point5.EqualsCross(*m_boundary->GetUp(), point3);
point4.Unitize();
point5.Unitize();
@ -366,7 +366,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
LERP3(a, *v1, *v2, m_unk0xe4);
m_destEdge->GetFaceNormal(*m_boundary, bbb);
c.EqualsCross(bbb, *m_boundary->GetUnknown0x14());
c.EqualsCross(bbb, *m_boundary->GetUp());
c.Unitize();
Mx3DPointFloat worldDirection(m_roi->GetWorldDirection());

View File

@ -64,7 +64,7 @@ void LegoFlcTexturePresenter::LoadFrame(MxStreamChunk* p_chunk)
void LegoFlcTexturePresenter::PutFrame()
{
if (m_texture != NULL && m_rectCount != 0) {
m_texture->FUN_10066010(m_frameBitmap->GetImage());
m_texture->LoadBits(m_frameBitmap->GetImage());
m_rectCount = 0;
}
}

View File

@ -114,7 +114,7 @@ void LegoPhonemePresenter::LoadFrame(MxStreamChunk* p_chunk)
void LegoPhonemePresenter::PutFrame()
{
if (m_textureInfo != NULL && m_rectCount != 0) {
m_textureInfo->FUN_10066010(m_frameBitmap->GetImage());
m_textureInfo->LoadBits(m_frameBitmap->GetImage());
m_rectCount = 0;
}
}

View File

@ -106,7 +106,7 @@ MxResult LegoTexturePresenter::Store()
}
}
else {
textureInfo->FUN_10066010(texture->GetImage()->GetBits());
textureInfo->LoadBits(texture->GetImage()->GetBits());
}
}

View File

@ -26,7 +26,7 @@ DECOMP_SIZE_ASSERT(Hospital, 0x12c)
DECOMP_SIZE_ASSERT(HospitalState, 0x18)
// GLOBAL: LEGO1 0x100f7918
undefined4 g_unk0x100f7918 = 3;
undefined4 g_animationSkipCounter = 3;
// GLOBAL: LEGO1 0x100f791c
MxBool g_copLedEnabled = FALSE;
@ -38,14 +38,14 @@ MxBool g_pizzaLedEnabled = FALSE;
Hospital::Hospital()
{
m_currentActorId = LegoActor::c_none;
m_unk0x100 = 0;
m_interactionMode = 0;
m_hospitalState = NULL;
m_unk0x108 = 0;
m_setWithCurrentAction = 0;
m_destLocation = LegoGameState::e_undefined;
m_currentAction = HospitalScript::c__StartUp;
m_copLedBitmap = NULL;
m_pizzaLedBitmap = NULL;
m_unk0x118 = 0;
m_flashingLeds = 0;
m_copLedAnimTimer = 0;
m_pizzaLedAnimTimer = 0;
m_unk0x128 = 0;
@ -63,10 +63,10 @@ Hospital::~Hospital()
ControlManager()->Unregister(this);
TickleManager()->UnregisterClient(this);
m_hospitalState->m_unk0x08 = 3;
m_hospitalState->m_state = HospitalState::e_unknown3;
NotificationManager()->Unregister(this);
g_unk0x100f7918 = 3;
g_animationSkipCounter = 3;
}
// FUNCTION: LEGO1 0x100748c0
@ -83,13 +83,13 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
m_hospitalState = (HospitalState*) GameState()->GetState("HospitalState");
if (!m_hospitalState) {
m_hospitalState = (HospitalState*) GameState()->CreateState("HospitalState");
m_hospitalState->m_unk0x08 = 1;
m_hospitalState->m_state = HospitalState::e_newState;
}
else if (m_hospitalState->m_unk0x08 == 4) {
m_hospitalState->m_unk0x08 = 4;
else if (m_hospitalState->m_state == HospitalState::e_unknown4) {
m_hospitalState->m_state = HospitalState::e_unknown4;
}
else {
m_hospitalState->m_unk0x08 = 3;
m_hospitalState->m_state = HospitalState::e_unknown3;
}
GameState()->m_currentArea = LegoGameState::e_hospital;
@ -151,69 +151,69 @@ void Hospital::ReadyWorld()
switch (m_currentActorId) {
case LegoActor::c_pepper:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e;
m_hospitalState->m_stateActor = m_hospitalState->m_statePepper;
if (m_hospitalState->m_unk0x0e < 5) {
m_hospitalState->m_unk0x0e += 1;
if (m_hospitalState->m_statePepper < 5) {
m_hospitalState->m_statePepper += 1;
}
break;
case LegoActor::c_mama:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10;
m_hospitalState->m_stateActor = m_hospitalState->m_stateMama;
if (m_hospitalState->m_unk0x10 < 5) {
m_hospitalState->m_unk0x10 += 1;
if (m_hospitalState->m_stateMama < 5) {
m_hospitalState->m_stateMama += 1;
}
break;
case LegoActor::c_papa:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12;
m_hospitalState->m_stateActor = m_hospitalState->m_statePapa;
if (m_hospitalState->m_unk0x12 < 5) {
m_hospitalState->m_unk0x12 += 1;
if (m_hospitalState->m_statePapa < 5) {
m_hospitalState->m_statePapa += 1;
}
break;
case LegoActor::c_nick:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14;
m_hospitalState->m_stateActor = m_hospitalState->m_stateNick;
if (m_hospitalState->m_unk0x14 < 5) {
m_hospitalState->m_unk0x14 += 1;
if (m_hospitalState->m_stateNick < 5) {
m_hospitalState->m_stateNick += 1;
}
break;
case LegoActor::c_laura:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16;
m_hospitalState->m_stateActor = m_hospitalState->m_stateLaura;
if (m_hospitalState->m_unk0x16 < 5) {
m_hospitalState->m_unk0x16 += 1;
if (m_hospitalState->m_stateLaura < 5) {
m_hospitalState->m_stateLaura += 1;
}
break;
}
if (m_hospitalState->m_unk0x0c < 3) {
if (m_hospitalState->m_stateActor < 3) {
HospitalScript::Script hospitalScript[] = {
HospitalScript::c_hho002cl_RunAnim,
HospitalScript::c_hho004jk_RunAnim,
HospitalScript::c_hho007p1_RunAnim
};
m_hospitalState->m_unk0x08 = 5;
m_hospitalState->m_state = HospitalState::e_introduction;
PlayAction(hospitalScript[m_hospitalState->m_unk0x0c]);
m_currentAction = hospitalScript[m_hospitalState->m_unk0x0c];
m_unk0x108 = 1;
PlayAction(hospitalScript[m_hospitalState->m_stateActor]);
m_currentAction = hospitalScript[m_hospitalState->m_stateActor];
m_setWithCurrentAction = 1;
}
else {
m_unk0x100 = 1;
m_interactionMode = 1;
m_time = Timer()->GetTime();
m_hospitalState->m_unk0x08 = 6;
m_hospitalState->m_state = HospitalState::e_explainQuestShort;
PlayAction(HospitalScript::c_hho003cl_RunAnim);
m_currentAction = HospitalScript::c_hho003cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
}
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
@ -224,7 +224,7 @@ MxLong Hospital::HandleKeyPress(SDL_Keycode p_key)
{
MxLong result = 0;
if (p_key == SDLK_SPACE && g_unk0x100f7918 == 0) {
if (p_key == SDLK_SPACE && g_animationSkipCounter == 0) {
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
result = 1;
}
@ -243,132 +243,132 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
return result;
}
m_unk0x108 = 0;
m_setWithCurrentAction = 0;
switch (m_hospitalState->m_unk0x08) {
case 5:
m_hospitalState->m_unk0x08 = 7;
switch (m_hospitalState->m_state) {
case HospitalState::e_introduction:
m_hospitalState->m_state = HospitalState::e_explainQuest;
PlayAction(HospitalScript::c_hho006cl_RunAnim);
m_currentAction = HospitalScript::c_hho006cl_RunAnim;
m_unk0x108 = 1;
m_unk0x118 = 1;
g_unk0x100f7918 = 0;
m_setWithCurrentAction = 1;
m_flashingLeds = 1;
g_animationSkipCounter = 0;
break;
case 6:
case HospitalState::e_explainQuestShort:
m_time = Timer()->GetTime();
m_unk0x100 = 1;
m_interactionMode = 1;
break;
case 7:
case 10:
m_hospitalState->m_unk0x08 = 8;
m_unk0x100 = 1;
case HospitalState::e_explainQuest:
case HospitalState::e_unknown10:
m_hospitalState->m_state = HospitalState::e_waitAcceptingQuest;
m_interactionMode = 1;
m_time = Timer()->GetTime();
break;
case 11:
case HospitalState::e_unknown11:
switch (m_currentActorId) {
case LegoActor::c_pepper:
switch (m_hospitalState->m_unk0x0e) {
switch (m_hospitalState->m_statePepper) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho017cl_RunAnim);
m_currentAction = HospitalScript::c_hho017cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho018cl_RunAnim);
m_currentAction = HospitalScript::c_hho018cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_mama:
switch (m_hospitalState->m_unk0x10) {
switch (m_hospitalState->m_stateMama) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho019cl_RunAnim);
m_currentAction = HospitalScript::c_hho019cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho020cl_RunAnim);
m_currentAction = HospitalScript::c_hho020cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_papa:
switch (m_hospitalState->m_unk0x12) {
switch (m_hospitalState->m_statePapa) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho023cl_RunAnim);
m_currentAction = HospitalScript::c_hho023cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho024cl_RunAnim);
m_currentAction = HospitalScript::c_hho024cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_nick:
switch (m_hospitalState->m_unk0x14) {
switch (m_hospitalState->m_stateNick) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho021cl_RunAnim);
m_currentAction = HospitalScript::c_hho021cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hhoa22cl_RunAnim);
m_currentAction = HospitalScript::c_hhoa22cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_laura:
switch (m_hospitalState->m_unk0x16) {
switch (m_hospitalState->m_stateLaura) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho025cl_RunAnim);
m_currentAction = HospitalScript::c_hho025cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho026cl_RunAnim);
m_currentAction = HospitalScript::c_hho026cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
}
break;
case 12:
m_hospitalState->m_unk0x08 = 9;
case HospitalState::e_afterAcceptingQuest:
m_hospitalState->m_state = HospitalState::e_beforeEnteringAmbulance;
act1State = (Act1State*) GameState()->GetState("Act1State");
act1State->SetUnknown18(9);
case 14:
case HospitalState::e_exitToFront:
if (m_unk0x128 == 0) {
m_unk0x128 = 1;
m_destLocation = LegoGameState::e_unk31;
@ -377,7 +377,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}
break;
case 15:
case HospitalState::e_exitToInfocenter:
if (m_unk0x128 == 0) {
m_unk0x128 = 1;
m_destLocation = LegoGameState::e_infomain;
@ -397,7 +397,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: BETA10 0x1002d2b1
MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
{
if (m_unk0x100 == 1) {
if (m_interactionMode == 1) {
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
if (roi != NULL) {
const LegoChar* roiName = roi->GetName();
@ -409,15 +409,15 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
if (!SDL_strcasecmp("actor_ha", roiName)) {
InputManager()->DisableInputProcessing();
m_unk0x100 = 3;
m_interactionMode = 3;
if (m_hospitalState->m_unk0x08 == 6) {
if (m_hospitalState->m_state == HospitalState::e_explainQuestShort) {
if (m_unk0x128 == 0) {
m_unk0x128 = 1;
TickleManager()->UnregisterClient(this);
m_hospitalState->m_unk0x08 = 9;
m_hospitalState->m_state = HospitalState::e_beforeEnteringAmbulance;
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
assert(act1State);
@ -432,9 +432,9 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}
}
else if (m_hospitalState->m_unk0x08 == 10 || m_hospitalState->m_unk0x08 == 8) {
if (m_hospitalState->m_unk0x08 == 10) {
m_hospitalState->m_unk0x08 = 11;
else if (m_hospitalState->m_state == HospitalState::e_unknown10 || m_hospitalState->m_state == HospitalState::e_waitAcceptingQuest) {
if (m_hospitalState->m_state == HospitalState::e_unknown10) {
m_hospitalState->m_state = HospitalState::e_unknown11;
BackgroundAudioManager()->RaiseVolume();
DeleteObjects(
@ -446,97 +446,97 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
else {
switch (m_currentActorId) {
case LegoActor::c_pepper:
switch (m_hospitalState->m_unk0x0e) {
switch (m_hospitalState->m_statePepper) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho017cl_RunAnim);
m_currentAction = HospitalScript::c_hho017cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho018cl_RunAnim);
m_currentAction = HospitalScript::c_hho018cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_mama:
switch (m_hospitalState->m_unk0x10) {
switch (m_hospitalState->m_stateMama) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho019cl_RunAnim);
m_currentAction = HospitalScript::c_hho019cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho020cl_RunAnim);
m_currentAction = HospitalScript::c_hho020cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_nick:
switch (m_hospitalState->m_unk0x14) {
switch (m_hospitalState->m_stateNick) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho021cl_RunAnim);
m_currentAction = HospitalScript::c_hho021cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hhoa22cl_RunAnim);
m_currentAction = HospitalScript::c_hhoa22cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_papa:
switch (m_hospitalState->m_unk0x12) {
switch (m_hospitalState->m_statePapa) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho023cl_RunAnim);
m_currentAction = HospitalScript::c_hho023cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho024cl_RunAnim);
m_currentAction = HospitalScript::c_hho024cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
case LegoActor::c_laura:
switch (m_hospitalState->m_unk0x16) {
switch (m_hospitalState->m_stateLaura) {
case 0:
case 1:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho025cl_RunAnim);
m_currentAction = HospitalScript::c_hho025cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
default:
m_hospitalState->m_unk0x08 = 12;
m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest;
PlayAction(HospitalScript::c_hho026cl_RunAnim);
m_currentAction = HospitalScript::c_hho026cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
break;
}
break;
@ -561,16 +561,16 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
BackgroundAudioManager()->RaiseVolume();
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
if (m_unk0x100 == 1) {
m_hospitalState->m_unk0x08 = 14;
if (m_interactionMode == 1) {
m_hospitalState->m_state = HospitalState::e_exitToInfocenter;
PlayAction(HospitalScript::c_hho016cl_RunAnim);
m_currentAction = HospitalScript::c_hho016cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
}
else if (m_unk0x128 == 0) {
m_unk0x128 = 1;
m_hospitalState->m_unk0x08 = 13;
m_hospitalState->m_state = HospitalState::e_exitImmediately;
m_destLocation = LegoGameState::e_infomain;
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
@ -582,16 +582,16 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
case HospitalScript::c_Door_Ctl:
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
if (m_unk0x100 == 1) {
m_hospitalState->m_unk0x08 = 15;
if (m_interactionMode == 1) {
m_hospitalState->m_state = HospitalState::e_exitToFront;
PlayAction(HospitalScript::c_hho016cl_RunAnim);
m_currentAction = HospitalScript::c_hho016cl_RunAnim;
m_unk0x108 = 1;
m_setWithCurrentAction = 1;
}
else if (m_unk0x128 == 0) {
m_unk0x128 = 1;
m_hospitalState->m_unk0x08 = 13;
m_hospitalState->m_state = HospitalState::e_exitImmediately;
m_destLocation = LegoGameState::e_unk31;
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
@ -639,13 +639,13 @@ MxResult Hospital::Tickle()
return SUCCESS;
}
if (g_unk0x100f7918 != 0) {
g_unk0x100f7918 -= 1;
if (g_animationSkipCounter != 0) {
g_animationSkipCounter -= 1;
}
MxLong time = Timer()->GetTime();
if (m_unk0x118 != 0) {
if (m_flashingLeds != 0) {
if (time - m_copLedAnimTimer > 300) {
m_copLedAnimTimer = time;
g_copLedEnabled = !g_copLedEnabled;
@ -666,7 +666,7 @@ MxResult Hospital::Tickle()
MxBool Hospital::Escape()
{
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, 999);
m_hospitalState->m_unk0x08 = 0;
m_hospitalState->m_state = HospitalState::e_exitToClose;
m_destLocation = LegoGameState::e_infomain;
@ -676,12 +676,12 @@ MxBool Hospital::Escape()
// FUNCTION: LEGO1 0x10076370
HospitalState::HospitalState()
{
m_unk0x0c = 0;
m_unk0x0e = 0;
m_unk0x10 = 0;
m_unk0x12 = 0;
m_unk0x14 = 0;
m_unk0x16 = 0;
m_stateActor = 0;
m_statePepper = 0;
m_stateMama = 0;
m_statePapa = 0;
m_stateNick = 0;
m_stateLaura = 0;
}
// FUNCTION: LEGO1 0x10076530
@ -691,20 +691,20 @@ MxResult HospitalState::Serialize(LegoStorage* p_storage)
LegoState::Serialize(p_storage);
if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_unk0x0c);
p_storage->WriteS16(m_unk0x0e);
p_storage->WriteS16(m_unk0x10);
p_storage->WriteS16(m_unk0x12);
p_storage->WriteS16(m_unk0x14);
p_storage->WriteS16(m_unk0x16);
p_storage->WriteS16(m_stateActor);
p_storage->WriteS16(m_statePepper);
p_storage->WriteS16(m_stateMama);
p_storage->WriteS16(m_statePapa);
p_storage->WriteS16(m_stateNick);
p_storage->WriteS16(m_stateLaura);
}
else if (p_storage->IsReadMode()) {
p_storage->ReadS16(m_unk0x0c);
p_storage->ReadS16(m_unk0x0e);
p_storage->ReadS16(m_unk0x10);
p_storage->ReadS16(m_unk0x12);
p_storage->ReadS16(m_unk0x14);
p_storage->ReadS16(m_unk0x16);
p_storage->ReadS16(m_stateActor);
p_storage->ReadS16(m_statePepper);
p_storage->ReadS16(m_stateMama);
p_storage->ReadS16(m_statePapa);
p_storage->ReadS16(m_stateNick);
p_storage->ReadS16(m_stateLaura);
}
return SUCCESS;

View File

@ -20,7 +20,7 @@ LegoWEEdge::~LegoWEEdge()
}
// FUNCTION: LEGO1 0x1009a5b0
LegoS32 LegoWEEdge::VTable0x04()
LegoS32 LegoWEEdge::LinkEdgesAndFaces()
{
for (LegoS32 i = 0; i < m_numEdges; i++) {
LegoOrientedEdge* e1 = m_edges[i];

View File

@ -14,7 +14,7 @@ public:
LegoWEEdge();
virtual ~LegoWEEdge(); // vtable+0x00
virtual LegoS32 VTable0x04(); // vtable+0x04
virtual LegoS32 LinkEdgesAndFaces(); // vtable+0x04
// FUNCTION: BETA10 0x1001c980
LegoU8 GetNumEdges() { return m_numEdges; }

View File

@ -13,12 +13,12 @@ LegoWEGEdge::LegoWEGEdge()
{
m_unk0x0d = 0;
m_name = NULL;
m_unk0x14.Clear();
m_up.Clear();
m_edgeNormals = NULL;
m_flags = 0;
m_numTriggers = 0;
m_pathTrigger = NULL;
m_unk0x50 = NULL;
m_direction = NULL;
}
// FUNCTION: LEGO1 0x1009a800
@ -37,18 +37,18 @@ LegoWEGEdge::~LegoWEGEdge()
if (m_pathTrigger) {
delete[] m_pathTrigger;
}
if (m_unk0x50) {
delete m_unk0x50;
if (m_direction) {
delete m_direction;
}
}
// FUNCTION: LEGO1 0x1009a8c0
// FUNCTION: BETA10 0x101832f7
LegoS32 LegoWEGEdge::VTable0x04()
LegoS32 LegoWEGEdge::LinkEdgesAndFaces()
{
LegoS32 result = 0;
m_unk0x30.Clear();
LegoWEEdge::VTable0x04();
m_centerPoint.Clear();
LegoWEEdge::LinkEdgesAndFaces();
assert(m_numEdges > 1);
@ -72,7 +72,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
local14 = m_edges[1]->m_pointB;
}
result = FUN_1009aea0();
result = ValidateFacePlanarity();
if (result != 0) {
result = -2;
}
@ -86,35 +86,35 @@ LegoS32 LegoWEGEdge::VTable0x04()
for (i = 0; i < m_numEdges; i++) {
edge = m_edges[i];
m_unk0x30 += *edge->m_pointA;
m_unk0x30 += *edge->m_pointB;
m_centerPoint += *edge->m_pointA;
m_centerPoint += *edge->m_pointB;
}
m_unk0x30 /= m_numEdges * 2;
m_unk0x44 = 0.0f;
m_centerPoint /= m_numEdges * 2;
m_boundingRadius = 0.0f;
for (i = 0; i < m_numEdges; i++) {
Mx3DPointFloat local44;
edge = m_edges[i];
local44 = *edge->m_pointA;
local44 -= m_unk0x30;
local44 -= m_centerPoint;
float length = local44.LenSquared();
if (m_unk0x44 < length) {
m_unk0x44 = length;
if (m_boundingRadius < length) {
m_boundingRadius = length;
}
local44 = *edge->m_pointB;
local44 -= m_unk0x30;
local44 -= m_centerPoint;
length = local44.LenSquared();
if (m_unk0x44 < length) {
m_unk0x44 = length;
if (m_boundingRadius < length) {
m_boundingRadius = length;
}
}
m_unk0x44 = sqrt((double) m_unk0x44);
m_boundingRadius = sqrt((double) m_boundingRadius);
for (i = 0; i < m_numEdges; i++) {
edge = m_edges[i];
@ -139,10 +139,10 @@ LegoS32 LegoWEGEdge::VTable0x04()
Mx3DPointFloat local58;
Vector3 local64(&m_edgeNormals[i][0]);
edge->GetFaceNormal(*this, local58);
local64.EqualsCross(local58, m_unk0x14);
local64.EqualsCross(local58, m_up);
m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64);
if (m_edgeNormals[i][3] + m_unk0x30.Dot(m_unk0x30, local64) < 0.0f) {
if (m_edgeNormals[i][3] + m_centerPoint.Dot(m_centerPoint, local64) < 0.0f) {
m_edgeNormals[i] *= -1.0f;
}
@ -156,14 +156,14 @@ LegoS32 LegoWEGEdge::VTable0x04()
Vector3* vTrig2 = m_edges[1]->CCWVertex(*this);
assert(vTrig1 && vTrig2);
m_unk0x50 = new Mx3DPointFloat();
*m_unk0x50 = *vTrig2;
*m_unk0x50 -= *vTrig1;
m_direction = new Mx3DPointFloat();
*m_direction = *vTrig2;
*m_direction -= *vTrig1;
if (m_unk0x50->Unitize() < 0) {
if (m_direction->Unitize() < 0) {
assert(0);
delete m_unk0x50;
m_unk0x50 = NULL;
delete m_direction;
m_direction = NULL;
}
if (GetNumEdges() == 4) {
@ -178,12 +178,12 @@ LegoS32 LegoWEGEdge::VTable0x04()
localb8 -= *vTrig1;
local80 -= *vTrig1;
float locala4 = localb8.Dot(*m_unk0x50, localb8);
float locala4 = localb8.Dot(*m_direction, localb8);
if (local98 < locala4) {
local98 = locala4;
}
locala4 = local80.Dot(*m_unk0x50, local80);
locala4 = local80.Dot(*m_direction, local80);
if (locala4 < local9c) {
local9c = locala4;
}
@ -199,12 +199,12 @@ LegoS32 LegoWEGEdge::VTable0x04()
local9c -= 0.001;
for (LegoS32 j = 0; j < m_numTriggers; j++) {
if (m_pathTrigger[j].m_unk0x08 < local98) {
m_pathTrigger[j].m_unk0x08 = local98;
if (m_pathTrigger[j].m_triggerLength < local98) {
m_pathTrigger[j].m_triggerLength = local98;
}
if (m_pathTrigger[j].m_unk0x08 > local9c) {
m_pathTrigger[j].m_unk0x08 = local9c;
if (m_pathTrigger[j].m_triggerLength > local9c) {
m_pathTrigger[j].m_triggerLength = local9c;
}
}
}
@ -218,7 +218,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
// FUNCTION: LEGO1 0x1009aea0
// FUNCTION: BETA10 0x10183e2a
LegoS32 LegoWEGEdge::FUN_1009aea0()
LegoS32 LegoWEGEdge::ValidateFacePlanarity()
{
LegoU32 localc = FALSE;
Mx3DPointFloat local24;
@ -255,17 +255,17 @@ LegoS32 LegoWEGEdge::FUN_1009aea0()
local24 /= local58;
if (localc) {
float local54 = local24.Dot(m_unk0x14, local24);
float local54 = local24.Dot(m_up, local24);
if (local54 < 0.98) {
delete[] local8;
return -2;
}
}
else {
m_unk0x14[0] = local24[0];
m_unk0x14[1] = local24[1];
m_unk0x14[2] = local24[2];
m_unk0x14[3] = -local8[i]->Dot(*local8[i], local24);
m_up[0] = local24[0];
m_up[1] = local24[1];
m_up[2] = local24[2];
m_up[3] = -local8[i]->Dot(*local8[i], local24);
localc = TRUE;
}
}

View File

@ -16,12 +16,12 @@ struct PathWithTrigger {
{
m_pathStruct = NULL;
m_data = 0;
m_unk0x08 = 0.0f;
m_triggerLength = 0.0f;
}
LegoPathStruct* m_pathStruct; // 0x00
unsigned int m_data; // 0x04
float m_unk0x08; // 0x08
float m_triggerLength; // 0x08
};
#include "mxgeometry/mxgeometry3d.h"
@ -42,7 +42,7 @@ public:
LegoWEGEdge();
~LegoWEGEdge() override;
LegoS32 VTable0x04() override; // vtable+0x04
LegoS32 LinkEdgesAndFaces() override; // vtable+0x04
// FUNCTION: BETA10 0x100270c0
LegoU32 GetFlag0x10()
@ -57,7 +57,7 @@ public:
// TODO: Other BETA10 reference at 0x1001c9e0, not sure what is going on
// FUNCTION: BETA10 0x1001ff80
Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
Mx4DPointFloat* GetUp() { return &m_up; }
// FUNCTION: BETA10 0x1001ca10
Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; }
@ -85,18 +85,18 @@ public:
friend class LegoPathController;
protected:
LegoS32 FUN_1009aea0();
LegoS32 ValidateFacePlanarity();
LegoU8 m_flags; // 0x0c
LegoU8 m_unk0x0d; // 0x0d
LegoChar* m_name; // 0x10
Mx4DPointFloat m_unk0x14; // 0x14
Mx4DPointFloat m_up; // 0x14
Mx4DPointFloat* m_edgeNormals; // 0x2c
Mx3DPointFloat m_unk0x30; // 0x30
float m_unk0x44; // 0x44
Mx3DPointFloat m_centerPoint; // 0x30
float m_boundingRadius; // 0x44
LegoU8 m_numTriggers; // 0x48
PathWithTrigger* m_pathTrigger; // 0x4c
Mx3DPointFloat* m_unk0x50; // 0x50
Mx3DPointFloat* m_direction; // 0x50
};
#endif // __LEGOWEGEDGE_H