Car Build variable renaming - fixed issues and added enum ShelfState

This commit is contained in:
mastertimethief 2025-06-10 16:54:59 -04:00
parent 09fef06951
commit db8bac61d1
3 changed files with 51 additions and 44 deletions

View File

@ -13,6 +13,13 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
c_bit1 = 0x01 c_bit1 = 0x01
}; };
enum ShelfState {
e_undefined = -1,
e_selected = 0,
e_stopped = 1,
e_moving = 2
};
// SIZE 0x0c // SIZE 0x0c
struct UnknownListEntry { struct UnknownListEntry {
// FUNCTION: LEGO1 0x100795c0 // FUNCTION: LEGO1 0x100795c0
@ -87,7 +94,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
void SetPartObjectIdByName(const LegoChar* p_name, MxS16 p_objectId); void SetPartObjectIdByName(const LegoChar* p_name, MxS16 p_objectId);
// FUNCTION: BETA10 0x10070180 // FUNCTION: BETA10 0x10070180
void SetShelfState(undefined2 p_state) { m_shelfState = p_state; } void SetShelfState(ShelfState p_shelfState) { m_shelfState = p_shelfState; }
// FUNCTION: BETA10 0x100703b0 // FUNCTION: BETA10 0x100703b0
Matrix4& GetBuildViewMatrix() { return m_buildViewMatrix; } Matrix4& GetBuildViewMatrix() { return m_buildViewMatrix; }
@ -116,7 +123,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
private: private:
void Beta10Inline0x100733d0(); void Beta10Inline0x100733d0();
MxU16 m_shelfState; // 0xbc ShelfState m_shelfState; // 0xbc
// variable name verified by BETA10 0x1007184f // variable name verified by BETA10 0x1007184f
MxS16 m_numberOfParts; // 0xbe MxS16 m_numberOfParts; // 0xbe
@ -131,10 +138,10 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
// variable name verified by BETA10 0x100719f0 // variable name verified by BETA10 0x100719f0
UnknownListEntry* m_parts; // 0x128 UnknownListEntry* m_parts; // 0x128
MxFloat m_ShelfFrameBuffer; // 0x12c MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_ShelfFrame; // 0x130 MxFloat m_shelfFrame; // 0x130
MxFloat m_ShelfFrameMax; // 0x134 MxFloat m_shelfFrameMax; // 0x134
MxFloat m_ShelfFrameInterval; // 0x138 MxFloat m_shelfFrameInterval; // 0x138
MxULong m_unk0x13c; // 0x13c MxULong m_unk0x13c; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140 LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144 MxS32 m_unk0x144; // 0x144

View File

@ -96,7 +96,7 @@ LegoCarBuild::LegoCarBuild()
m_unk0x110 = 0; m_unk0x110 = 0;
m_unk0xf8 = c_unknownminusone; m_unk0xf8 = c_unknownminusone;
m_unk0x2d4 = FALSE; m_unk0x2d4 = FALSE;
m_animPresenter = 0; m_animPresenter = NULL;
m_ColorBook_Bitmap = NULL; m_ColorBook_Bitmap = NULL;
m_Yellow_Ctl = NULL; m_Yellow_Ctl = NULL;
m_Red_Ctl = NULL; m_Red_Ctl = NULL;
@ -138,7 +138,7 @@ LegoCarBuild::~LegoCarBuild()
m_unk0x110 = NULL; m_unk0x110 = NULL;
if (m_animPresenter) { if (m_animPresenter) {
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_animPresenter->SetTickleState(MxPresenter::e_idle); m_animPresenter->SetTickleState(MxPresenter::e_idle);
m_animPresenter = NULL; m_animPresenter = NULL;
} }
@ -290,7 +290,7 @@ void LegoCarBuild::FUN_10022f00()
{ {
if (m_unk0x110) { if (m_unk0x110) {
VTable0x6c(); VTable0x6c();
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_unk0x100 = 5; m_unk0x100 = 5;
} }
} }
@ -308,7 +308,7 @@ void LegoCarBuild::FUN_10022f30()
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
} }
m_animPresenter->SetShelfState(1); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
m_animPresenter->PutFrame(); m_animPresenter->PutFrame();
m_unk0x110 = NULL; m_unk0x110 = NULL;
m_unk0x100 = 0; m_unk0x100 = 0;
@ -481,7 +481,7 @@ void LegoCarBuild::FUN_100236d0()
FUN_10024f70(FALSE); FUN_10024f70(FALSE);
FUN_100250e0(FALSE); FUN_100250e0(FALSE);
m_animPresenter->FUN_10079790(m_unk0x110->GetName()); m_animPresenter->FUN_10079790(m_unk0x110->GetName());
m_animPresenter->SetShelfState(1); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
m_unk0x110 = NULL; m_unk0x110 = NULL;
m_unk0x100 = 0; m_unk0x100 = 0;
@ -872,7 +872,7 @@ undefined4 LegoCarBuild::FUN_100244e0(MxLong p_x, MxLong p_y)
m_GetBrick_Sound->Enable(FALSE); m_GetBrick_Sound->Enable(FALSE);
m_GetBrick_Sound->Enable(TRUE); m_GetBrick_Sound->Enable(TRUE);
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
return 1; return 1;
} }
@ -900,7 +900,7 @@ undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y)
m_unk0x110 = NULL; m_unk0x110 = NULL;
m_PlaceBrick_Sound->Enable(FALSE); m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
m_animPresenter->SetShelfState(1); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
} }
else if (m_animPresenter->FUN_10079c30(m_unk0x110->GetName())) { else if (m_animPresenter->FUN_10079c30(m_unk0x110->GetName())) {
if (SpheresIntersect(m_unk0x114, m_unk0x110->GetWorldBoundingSphere())) { if (SpheresIntersect(m_unk0x114, m_unk0x110->GetWorldBoundingSphere())) {
@ -965,7 +965,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
DeleteObjects(&m_atomId, 500, 510); DeleteObjects(&m_atomId, 500, 510);
} }
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
result = 1; result = 1;
@ -979,7 +979,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
DeleteObjects(&m_atomId, 500, 510); DeleteObjects(&m_atomId, 500, 510);
} }
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
if (GameState()->GetCurrentAct() == LegoGameState::e_act2) { if (GameState()->GetCurrentAct() == LegoGameState::e_act2) {
FUN_100243a0(); FUN_100243a0();
@ -1054,14 +1054,14 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
if (param->m_unk0x28) { if (param->m_unk0x28) {
switch (param->m_clickedObjectId) { switch (param->m_clickedObjectId) {
case CopterScript::c_Info_Ctl: case CopterScript::c_Info_Ctl:
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
result = 1; result = 1;
break; break;
case CopterScript::c_Exit_Ctl: case CopterScript::c_Exit_Ctl:
if (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting) { if (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting) {
m_animPresenter->SetShelfState(0); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) { if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) {
m_buildState->m_unk0x4d = TRUE; m_buildState->m_unk0x4d = TRUE;
@ -1261,7 +1261,7 @@ void LegoCarBuild::FUN_10024ef0()
void LegoCarBuild::FUN_10024f30() void LegoCarBuild::FUN_10024f30()
{ {
FUN_10022f30(); FUN_10022f30();
m_animPresenter->SetShelfState(2); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_moving);
} }
// FUNCTION: LEGO1 0x10024f50 // FUNCTION: LEGO1 0x10024f50

View File

@ -23,15 +23,15 @@ DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: BETA10 0x100707c0 // FUNCTION: BETA10 0x100707c0
LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter() LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
{ {
m_shelfState = 0; m_shelfState = e_selected;
m_numberOfParts = 0; m_numberOfParts = 0;
m_placedPartCount = 0; m_placedPartCount = 0;
m_parts = NULL; m_parts = NULL;
m_platformAnimNodeData = NULL; m_platformAnimNodeData = NULL;
m_ShelfFrame = 0; m_shelfFrame = 0;
m_ShelfFrameBuffer = 0; m_shelfFrameBuffer = 0;
m_ShelfFrameMax = 0; m_shelfFrameMax = 0;
m_ShelfFrameInterval = 0; m_shelfFrameInterval = 0;
m_unk0x13c = 0; m_unk0x13c = 0;
m_carBuildEntity = NULL; m_carBuildEntity = NULL;
m_unk0x144 = -1; m_unk0x144 = -1;
@ -115,13 +115,13 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
void LegoCarBuildAnimPresenter::PutFrame() void LegoCarBuildAnimPresenter::PutFrame()
{ {
switch (m_shelfState) { switch (m_shelfState) {
case 0: //Selected piece for moving / recoloring / decal case e_selected:
break; break;
case 2: //Shelf is moving case e_moving:
MoveShelfForward(); MoveShelfForward();
case 1: //Shelf is still, get next shelf case e_stopped:
if (m_carBuildEntity->GetROI()) { if (m_carBuildEntity->GetROI()) {
FUN_1006b9a0(m_anim, m_ShelfFrameBuffer, NULL); FUN_1006b9a0(m_anim, m_shelfFrameBuffer, NULL);
} }
default: default:
break; break;
@ -167,7 +167,7 @@ void LegoCarBuildAnimPresenter::ReadyTickle()
if (m_carBuildEntity) { if (m_carBuildEntity) {
((LegoCarBuild*) m_currentWorld)->SetCarBuildAnimPresenter(this); ((LegoCarBuild*) m_currentWorld)->SetCarBuildAnimPresenter(this);
m_placedPartCount = ((LegoCarBuild*) m_currentWorld)->GetPlacedPartCount(); m_placedPartCount = ((LegoCarBuild*) m_currentWorld)->GetPlacedPartCount();
SetShelfState(1); SetShelfState(e_stopped);
m_previousTickleStates |= 1 << m_currentTickleState; m_previousTickleStates |= 1 << m_currentTickleState;
m_currentTickleState = e_starting; m_currentTickleState = e_starting;
m_compositePresenter->SendToCompositePresenter(Lego()); m_compositePresenter->SendToCompositePresenter(Lego());
@ -284,7 +284,7 @@ void LegoCarBuildAnimPresenter::EndAction()
if (m_action) { if (m_action) {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxVideoPresenter::EndAction(); MxVideoPresenter::EndAction();
m_shelfState = 0; m_shelfState = e_selected;
} }
} }
@ -294,7 +294,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
{ {
if (p_storage->IsReadMode()) { if (p_storage->IsReadMode()) {
p_storage->ReadS16(m_placedPartCount); p_storage->ReadS16(m_placedPartCount);
p_storage->ReadFloat(m_ShelfFrame); p_storage->ReadFloat(m_shelfFrame);
for (MxS16 i = 0; i < m_numberOfParts; i++) { for (MxS16 i = 0; i < m_numberOfParts; i++) {
p_storage->ReadString(m_parts[i].m_name); p_storage->ReadString(m_parts[i].m_name);
p_storage->ReadString(m_parts[i].m_wiredName); p_storage->ReadString(m_parts[i].m_wiredName);
@ -303,7 +303,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
} }
else if (p_storage->IsWriteMode()) { else if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_placedPartCount); p_storage->WriteS16(m_placedPartCount);
p_storage->WriteFloat(m_ShelfFrame); p_storage->WriteFloat(m_shelfFrame);
for (MxS16 i = 0; i < m_numberOfParts; i++) { for (MxS16 i = 0; i < m_numberOfParts; i++) {
p_storage->WriteString(m_parts[i].m_name); p_storage->WriteString(m_parts[i].m_name);
p_storage->WriteString(m_parts[i].m_wiredName); p_storage->WriteString(m_parts[i].m_wiredName);
@ -372,9 +372,9 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
m_numberOfParts++; m_numberOfParts++;
} }
else { else {
if (m_ShelfFrameMax == 0.0f && StringEqualsShelf(name)) { if (m_shelfFrameMax == 0.0f && StringEqualsShelf(name)) {
m_ShelfFrameMax = m_anim->GetDuration(); m_shelfFrameMax = m_anim->GetDuration();
m_ShelfFrameInterval = m_ShelfFrameMax / (data->GetNumTranslationKeys() - 1); m_shelfFrameInterval = m_shelfFrameMax / (data->GetNumTranslationKeys() - 1);
} }
} }
} }
@ -585,7 +585,7 @@ void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle)
m_platformAnimNodeData->GetRotationKey(0)->SetAngle(newRotation[3]); m_platformAnimNodeData->GetRotationKey(0)->SetAngle(newRotation[3]);
if (m_carBuildEntity->GetROI()) { if (m_carBuildEntity->GetROI()) {
FUN_1006b9a0(&m_platformAnim, m_ShelfFrameBuffer, NULL); FUN_1006b9a0(&m_platformAnim, m_shelfFrameBuffer, NULL);
} }
} }
} }
@ -594,18 +594,18 @@ void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle)
// FUNCTION: BETA10 0x10072412 // FUNCTION: BETA10 0x10072412
void LegoCarBuildAnimPresenter::MoveShelfForward() void LegoCarBuildAnimPresenter::MoveShelfForward()
{ {
if (m_ShelfFrameBuffer >= m_ShelfFrameMax) { if (m_shelfFrameBuffer >= m_shelfFrameMax) {
m_ShelfFrame = 0.0; m_shelfFrame = 0.0;
m_ShelfFrameBuffer = m_ShelfFrame; m_shelfFrameBuffer = m_shelfFrame;
m_shelfState = 1; m_shelfState = e_stopped;
} }
else if (m_ShelfFrameBuffer >= m_ShelfFrameInterval + m_ShelfFrame) { else if (m_shelfFrameBuffer >= m_shelfFrameInterval + m_shelfFrame) {
m_ShelfFrame = m_ShelfFrameInterval + m_ShelfFrame; m_shelfFrame = m_shelfFrameInterval + m_shelfFrame;
m_ShelfFrameBuffer = m_ShelfFrame; m_shelfFrameBuffer = m_shelfFrame;
m_shelfState = 1; m_shelfState = e_stopped;
} }
else { else {
m_ShelfFrameBuffer = m_ShelfFrameInterval / 10.0f + m_ShelfFrameBuffer; m_shelfFrameBuffer = m_shelfFrameInterval / 10.0f + m_shelfFrameBuffer;
} }
} }