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

View File

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

View File

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