mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 16:34:06 +00:00
Implement/match LegoEntity::SwitchSound / SwitchMove / SwitchColor / SwitchMood (#995)
* Implement/match LegoEntity::SwitchSound * Name * Name * Implement/match LegoEntity::SwitchMove * Mood
This commit is contained in:

committed by
GitHub

parent
f6c923a84e
commit
49c17c9c6a
@@ -193,7 +193,7 @@ LegoBuildingInfo g_buildingInfoInit[16] = {
|
||||
// clang-format on
|
||||
|
||||
// GLOBAL: LEGO1 0x100f3738
|
||||
MxU32 g_buildingCycle1Length = 6;
|
||||
MxU32 LegoBuildingManager::g_maxSound = 6;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f373c
|
||||
MxU32 g_cycleLengthOffset1 = 0x3c;
|
||||
@@ -221,7 +221,7 @@ MxS32 g_buildingManagerConfig = 1;
|
||||
LegoBuildingInfo g_buildingInfo[16];
|
||||
|
||||
// GLOBAL: LEGO1 0x100f3748
|
||||
MxS32 g_buildingCycle2Length[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0};
|
||||
MxS32 LegoBuildingManager::g_maxMove[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0};
|
||||
|
||||
// FUNCTION: LEGO1 0x1002f8b0
|
||||
void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig)
|
||||
@@ -330,13 +330,13 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
|
||||
LegoBuildingInfo* info = &g_buildingInfo[i];
|
||||
|
||||
if (p_storage->Write(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) {
|
||||
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) {
|
||||
@@ -363,13 +363,13 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
|
||||
LegoBuildingInfo* info = &g_buildingInfo[i];
|
||||
|
||||
if (p_storage->Read(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) {
|
||||
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) {
|
||||
@@ -449,7 +449,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
|
||||
|
||||
LegoBuildingInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) {
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) {
|
||||
LegoROI* roi = p_entity->GetROI();
|
||||
if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) {
|
||||
m_nextVariant = 0;
|
||||
@@ -471,16 +471,16 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
|
||||
|
||||
// FUNCTION: LEGO1 0x1002fe40
|
||||
// FUNCTION: BETA10 0x100641d3
|
||||
MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity)
|
||||
MxBool LegoBuildingManager::SwitchSound(LegoEntity* p_entity)
|
||||
{
|
||||
MxBool result = FALSE;
|
||||
LegoBuildingInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit2) {
|
||||
info->m_cycle1++;
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasSounds) {
|
||||
info->m_sound++;
|
||||
|
||||
if (info->m_cycle1 >= g_buildingCycle1Length) {
|
||||
info->m_cycle1 = 0;
|
||||
if (info->m_sound >= g_maxSound) {
|
||||
info->m_sound = 0;
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
@@ -491,16 +491,16 @@ MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity)
|
||||
|
||||
// FUNCTION: LEGO1 0x1002fe80
|
||||
// FUNCTION: BETA10 0x10064242
|
||||
MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity)
|
||||
MxBool LegoBuildingManager::SwitchMove(LegoEntity* p_entity)
|
||||
{
|
||||
MxBool result = FALSE;
|
||||
LegoBuildingInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) {
|
||||
info->m_cycle2++;
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) {
|
||||
info->m_move++;
|
||||
|
||||
if (info->m_cycle2 >= g_buildingCycle2Length[info - g_buildingInfo]) {
|
||||
info->m_cycle2 = 0;
|
||||
if (info->m_move >= g_maxMove[info - g_buildingInfo]) {
|
||||
info->m_move = 0;
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
@@ -511,16 +511,16 @@ MxBool LegoBuildingManager::FUN_1002fe80(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;
|
||||
@@ -535,8 +535,8 @@ MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity)
|
||||
{
|
||||
LegoBuildingInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) {
|
||||
return g_buildingEntityId[info - g_buildingInfo] + info->m_cycle2;
|
||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) {
|
||||
return g_buildingEntityId[info - g_buildingInfo] + info->m_move;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -548,16 +548,16 @@ MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state)
|
||||
{
|
||||
LegoBuildingInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_bit2)) {
|
||||
if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_hasSounds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (p_state) {
|
||||
return info->m_cycle3 + g_cycleLengthOffset3;
|
||||
return info->m_mood + g_cycleLengthOffset3;
|
||||
}
|
||||
|
||||
if (info != NULL) {
|
||||
return info->m_cycle1 + g_cycleLengthOffset1;
|
||||
return info->m_sound + g_cycleLengthOffset1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -21,6 +21,12 @@
|
||||
DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4d0
|
||||
MxU32 LegoCharacterManager::g_maxMove = 4;
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4d4
|
||||
MxU32 LegoCharacterManager::g_maxSound = 9;
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4e0
|
||||
MxU32 g_unk0x100fc4e0 = 10;
|
||||
|
||||
@@ -113,10 +119,10 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
|
||||
LegoActorInfo* info = &g_actorInfo[i];
|
||||
|
||||
if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
@@ -168,10 +174,10 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
|
||||
LegoActorInfo* info = &g_actorInfo[i];
|
||||
|
||||
if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
@@ -450,8 +456,8 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
|
||||
if (!strcmpi(p_key, "pep")) {
|
||||
LegoActorInfo* pepper = GetActorInfo("pepper");
|
||||
|
||||
info->m_unk0x0c = pepper->m_unk0x0c;
|
||||
info->m_unk0x10 = pepper->m_unk0x10;
|
||||
info->m_sound = pepper->m_sound;
|
||||
info->m_move = pepper->m_move;
|
||||
info->m_mood = pepper->m_mood;
|
||||
|
||||
for (i = 0; i < sizeOfArray(info->m_parts); i++) {
|
||||
@@ -702,8 +708,16 @@ 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::SwitchHat(LegoROI* p_roi)
|
||||
MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
|
||||
{
|
||||
LegoActorInfo* info = GetActorInfo(p_roi->GetName());
|
||||
|
||||
@@ -756,6 +770,66 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10085090
|
||||
// FUNCTION: BETA10 0x100766f6
|
||||
MxBool LegoCharacterManager::SwitchSound(LegoROI* p_roi)
|
||||
{
|
||||
MxBool result = FALSE;
|
||||
LegoActorInfo* info = GetActorInfo(p_roi);
|
||||
|
||||
if (info != NULL) {
|
||||
info->m_sound++;
|
||||
|
||||
if (info->m_sound >= g_maxSound) {
|
||||
info->m_sound = 0;
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100850c0
|
||||
// FUNCTION: BETA10 0x10076754
|
||||
MxBool LegoCharacterManager::SwitchMove(LegoROI* p_roi)
|
||||
{
|
||||
MxBool result = FALSE;
|
||||
LegoActorInfo* info = GetActorInfo(p_roi);
|
||||
|
||||
if (info != NULL) {
|
||||
info->m_move++;
|
||||
|
||||
if (info->m_move >= g_maxMove) {
|
||||
info->m_move = 0;
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -763,7 +837,7 @@ MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi)
|
||||
LegoActorInfo* info = GetActorInfo(p_roi);
|
||||
|
||||
if (info != NULL) {
|
||||
return info->m_unk0x10 + g_unk0x100fc4e0;
|
||||
return info->m_move + g_unk0x100fc4e0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -779,7 +853,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und)
|
||||
}
|
||||
|
||||
if (info != NULL) {
|
||||
return info->m_unk0x0c + g_unk0x100fc4d8;
|
||||
return info->m_sound + g_unk0x100fc4d8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -49,8 +49,36 @@ 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::FUN_100269e0(LegoEntity* p_entity)
|
||||
MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026ad0
|
||||
MxBool LegoPlantManager::SwitchSound(LegoEntity* p_entity)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026b00
|
||||
MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026b40
|
||||
MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
|
@@ -325,48 +325,118 @@ void LegoEntity::SwitchVariant()
|
||||
{
|
||||
switch (m_type) {
|
||||
case e_actor:
|
||||
CharacterManager()->SwitchHat(m_roi);
|
||||
CharacterManager()->SwitchVariant(m_roi);
|
||||
break;
|
||||
case e_unk1:
|
||||
break;
|
||||
case e_plant:
|
||||
PlantManager()->FUN_100269e0(this);
|
||||
PlantManager()->SwitchVariant(this);
|
||||
break;
|
||||
case e_building:
|
||||
BuildingManager()->SwitchVariant(this);
|
||||
break;
|
||||
case e_autoROI:
|
||||
break;
|
||||
}
|
||||
|
||||
ClickSound(FALSE);
|
||||
ClickAnimation();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10011360
|
||||
// FUNCTION: LEGO1 0x10011360
|
||||
// FUNCTION: BETA10 0x1007f411
|
||||
void LegoEntity::VTable0x40()
|
||||
void LegoEntity::SwitchSound()
|
||||
{
|
||||
// TODO
|
||||
switch (m_type) {
|
||||
case e_actor:
|
||||
CharacterManager()->SwitchSound(m_roi);
|
||||
break;
|
||||
case e_unk1:
|
||||
break;
|
||||
case e_plant:
|
||||
PlantManager()->SwitchSound(this);
|
||||
break;
|
||||
case e_building:
|
||||
BuildingManager()->SwitchSound(this);
|
||||
break;
|
||||
case e_autoROI:
|
||||
break;
|
||||
}
|
||||
|
||||
ClickSound(FALSE);
|
||||
ClickAnimation();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100113c0
|
||||
// FUNCTION: LEGO1 0x100113c0
|
||||
// FUNCTION: BETA10 0x1007f4c8
|
||||
void LegoEntity::VTable0x44()
|
||||
void LegoEntity::SwitchMove()
|
||||
{
|
||||
// TODO
|
||||
switch (m_type) {
|
||||
case e_actor:
|
||||
CharacterManager()->SwitchMove(m_roi);
|
||||
break;
|
||||
case e_unk1:
|
||||
break;
|
||||
case e_plant:
|
||||
PlantManager()->SwitchMove(this);
|
||||
break;
|
||||
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
|
||||
@@ -398,16 +468,16 @@ MxLong LegoEntity::Notify(MxParam& p_param)
|
||||
}
|
||||
break;
|
||||
case LegoActor::c_mama:
|
||||
VTable0x40();
|
||||
SwitchSound();
|
||||
break;
|
||||
case LegoActor::c_papa:
|
||||
VTable0x44();
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user