This commit is contained in:
Christian Semmler 2024-06-05 13:35:17 -04:00
parent ece95c4d1a
commit e100d96643
8 changed files with 112 additions and 26 deletions

View File

@ -18,14 +18,14 @@ struct LegoBuildingInfo {
c_hasVariants = 0x01,
c_hasSounds = 0x02,
c_hasMoves = 0x04,
c_bit4 = 0x08
c_hasMoods = 0x08
};
LegoEntity* m_entity; // 0x00
const char* m_hausName; // 0x04
MxU32 m_sound; // 0x08
MxU32 m_move; // 0x0c
MxU8 m_cycle3; // 0x10
MxU8 m_mood; // 0x10
MxS8 m_unk0x11; // 0x11
MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11
MxU8 m_flags; // 0x13
@ -75,7 +75,7 @@ class LegoBuildingManager : public MxCore {
MxBool SwitchVariant(LegoEntity* p_entity);
MxBool SwitchSound(LegoEntity* p_entity);
MxBool SwitchMove(LegoEntity* p_entity);
MxBool FUN_1002fed0(LegoEntity* p_entity);
MxBool SwitchMood(LegoEntity* p_entity);
MxU32 GetBuildingEntityId(LegoEntity* p_entity);
MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool);
MxBool FUN_10030000(LegoEntity* p_entity);

View File

@ -69,9 +69,11 @@ class LegoCharacterManager {
LegoExtraActor* GetExtraActor(const char* p_name);
LegoActorInfo* GetActorInfo(const char* p_name);
LegoActorInfo* GetActorInfo(LegoROI* p_roi);
MxBool SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI);
MxBool SwitchVariant(LegoROI* p_roi);
MxBool SwitchSound(LegoROI* p_roi);
MxBool SwitchMove(LegoROI* p_roi);
MxBool SwitchMood(LegoROI* p_roi);
MxU32 FUN_10085120(LegoROI* p_roi);
MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und);
MxU8 GetMood(LegoROI* p_roi);

View File

@ -64,13 +64,13 @@ class LegoEntity : public MxEntity {
// FUNCTION: LEGO1 0x10001090
virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30
virtual void ClickSound(MxBool p_und); // vtable+0x34
virtual void ClickAnimation(); // vtable+0x38
virtual void SwitchVariant(); // vtable+0x3c
virtual void SwitchSound(); // vtable+0x40
virtual void SwitchMove(); // vtable+0x44
virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48
virtual void VTable0x4c(); // vtable+0x4c
virtual void ClickSound(MxBool p_und); // vtable+0x34
virtual void ClickAnimation(); // vtable+0x38
virtual void SwitchVariant(); // vtable+0x3c
virtual void SwitchSound(); // vtable+0x40
virtual void SwitchMove(); // vtable+0x44
virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48
virtual void SwitchMood(); // vtable+0x4c
void FUN_10010c30();
void SetType(MxU8 p_type);

View File

@ -29,9 +29,11 @@ class LegoPlantManager : public MxCore {
void FUN_100263a0(undefined4 p_und);
void Write(LegoStorage* p_storage);
MxResult Read(LegoStorage* p_storage);
MxBool SwitchColor(LegoEntity* p_entity);
MxBool SwitchVariant(LegoEntity* p_entity);
MxBool SwitchSound(LegoEntity* p_entity);
MxBool SwitchMove(LegoEntity* p_entity);
MxBool SwitchMood(LegoEntity* p_entity);
MxU32 FUN_10026b70(LegoEntity* p_entity);
MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool);
void FUN_10026c50(LegoEntity* p_entity);

View File

@ -336,7 +336,7 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) {
if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) {
@ -369,7 +369,7 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) {
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) {
@ -511,16 +511,16 @@ MxBool LegoBuildingManager::SwitchMove(LegoEntity* p_entity)
// FUNCTION: LEGO1 0x1002fed0
// FUNCTION: BETA10 0x100642c2
MxBool LegoBuildingManager::FUN_1002fed0(LegoEntity* p_entity)
MxBool LegoBuildingManager::SwitchMood(LegoEntity* p_entity)
{
MxBool result = FALSE;
LegoBuildingInfo* info = GetInfo(p_entity);
if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit4) {
info->m_cycle3++;
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoods) {
info->m_mood++;
if (info->m_cycle3 > 3) {
info->m_cycle3 = 0;
if (info->m_mood > 3) {
info->m_mood = 0;
}
result = TRUE;
@ -553,7 +553,7 @@ MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state)
}
if (p_state) {
return info->m_cycle3 + g_cycleLengthOffset3;
return info->m_mood + g_cycleLengthOffset3;
}
if (info != NULL) {

View File

@ -708,6 +708,14 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
return NULL;
}
// STUB: LEGO1 0x10084d50
// FUNCTION: BETA10 0x10076223
MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI)
{
// TODO
return FALSE;
}
// FUNCTION: LEGO1 0x10084ec0
MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
{
@ -802,6 +810,26 @@ MxBool LegoCharacterManager::SwitchMove(LegoROI* p_roi)
return result;
}
// FUNCTION: LEGO1 0x100850f0
// FUNCTION: BETA10 0x100767b2
MxBool LegoCharacterManager::SwitchMood(LegoROI* p_roi)
{
MxBool result = FALSE;
LegoActorInfo* info = GetActorInfo(p_roi);
if (info != NULL) {
info->m_mood++;
if (info->m_mood > 3) {
info->m_mood = 0;
}
result = TRUE;
}
return result;
}
// FUNCTION: LEGO1 0x10085120
// FUNCTION: BETA10 0x1007680c
MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi)

View File

@ -49,6 +49,13 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage)
return SUCCESS;
}
// STUB: LEGO1 0x10026920
MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity)
{
// TODO
return FALSE;
}
// STUB: LEGO1 0x100269e0
MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity)
{
@ -70,6 +77,13 @@ MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity)
return FALSE;
}
// STUB: LEGO1 0x10026b40
MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity)
{
// TODO
return FALSE;
}
// STUB: LEGO1 0x10026b70
MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity)
{

View File

@ -335,6 +335,8 @@ void LegoEntity::SwitchVariant()
case e_building:
BuildingManager()->SwitchVariant(this);
break;
case e_autoROI:
break;
}
ClickSound(FALSE);
@ -357,6 +359,8 @@ void LegoEntity::SwitchSound()
case e_building:
BuildingManager()->SwitchSound(this);
break;
case e_autoROI:
break;
}
ClickSound(FALSE);
@ -379,24 +383,60 @@ void LegoEntity::SwitchMove()
case e_building:
BuildingManager()->SwitchMove(this);
break;
case e_autoROI:
break;
}
ClickSound(FALSE);
ClickAnimation();
}
// STUB: LEGO1 0x10011420
// FUNCTION: LEGO1 0x10011420
// FUNCTION: BETA10 0x1007f57f
void LegoEntity::VTable0x48(LegoROI* p_roi)
void LegoEntity::SwitchColor(LegoROI* p_roi)
{
// TODO
switch (m_type) {
case e_actor:
CharacterManager()->SwitchColor(m_roi, p_roi);
break;
case e_unk1:
break;
case e_plant:
PlantManager()->SwitchColor(this);
break;
case e_building:
break;
case e_autoROI:
break;
}
ClickSound(FALSE);
ClickAnimation();
}
// STUB: LEGO1 0x10011470
// FUNCTION: LEGO1 0x10011470
// FUNCTION: BETA10 0x1007f62c
void LegoEntity::VTable0x4c()
void LegoEntity::SwitchMood()
{
// TODO
switch (m_type) {
case e_actor:
CharacterManager()->SwitchMood(m_roi);
break;
case e_unk1:
break;
case e_plant:
PlantManager()->SwitchMood(this);
break;
case e_building:
BuildingManager()->SwitchMood(this);
break;
case e_autoROI:
break;
}
ClickSound(TRUE);
ClickSound(FALSE);
ClickAnimation();
}
// FUNCTION: LEGO1 0x100114e0
@ -434,10 +474,10 @@ MxLong LegoEntity::Notify(MxParam& p_param)
SwitchMove();
break;
case LegoActor::c_nick:
VTable0x48(param.GetROI());
SwitchColor(param.GetROI());
break;
case LegoActor::c_laura:
VTable0x4c();
SwitchMood();
break;
case LegoActor::c_brickster:
switch (m_type) {