Implement/match Act2Actor::FUN_10019b90 (#1222)

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz 2024-12-14 00:19:55 +01:00 committed by GitHub
parent 1aeb458be1
commit 5a6415e0cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 230 additions and 4 deletions

View file

@ -46,8 +46,10 @@ class LegoPlantManager : public MxCore {
MxBool SwitchMood(LegoEntity* p_entity); MxBool SwitchMood(LegoEntity* p_entity);
MxU32 GetAnimationId(LegoEntity* p_entity); MxU32 GetAnimationId(LegoEntity* p_entity);
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
LegoPlantInfo* GetInfoArray(MxS32& p_length);
MxBool FUN_10026c50(LegoEntity* p_entity); MxBool FUN_10026c50(LegoEntity* p_entity);
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length); void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length);
MxResult FUN_10026410();
void FUN_10027120(); void FUN_10027120();
void FUN_10027200(); void FUN_10027200();

View file

@ -9,6 +9,7 @@
#include "legopathcontroller.h" #include "legopathcontroller.h"
#include "legopathedgecontainer.h" #include "legopathedgecontainer.h"
#include "legoplantmanager.h" #include "legoplantmanager.h"
#include "legoplants.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworld.h" #include "legoworld.h"
@ -52,6 +53,46 @@ MxBool g_unk0x100f0f24 = FALSE;
// GLOBAL: BETA10 0x101dbe44 // GLOBAL: BETA10 0x101dbe44
MxBool g_unk0x100f0f28 = FALSE; MxBool g_unk0x100f0f28 = FALSE;
// --- All of these are indices into g_plantInfo (0x10103180) ---
// GLOBAL: LEGO1 0x100f0f30
// GLOBAL: BETA10 0x101dbe48
MxS32 g_unk0x100f0f30[] = {2, 23, 32, 66, 71, 72, 73, -1};
// GLOBAL: LEGO1 0x100f0f50
// GLOBAL: BETA10 0x101dbe68
MxS32 g_unk0x100f0f50[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
// GLOBAL: LEGO1 0x100f0f90
// GLOBAL: BETA10 0x101dbea8
MxS32 g_unk0x100f0f90[] = {12, 19, 24, 48, 60, -1};
// GLOBAL: LEGO1 0x100f0fa8
// GLOBAL: BETA10 0x101dbec0
MxS32 g_unk0x100f0fa8[] = {8, 15, 46, -1};
// GLOBAL: LEGO1 0x100f0fb8
// GLOBAL: BETA10 0x101dbed0
MxS32 g_unk0x100f0fb8[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
// GLOBAL: LEGO1 0x100f0fe8
// GLOBAL: BETA10 0x101dbf00
MxS32 g_unk0x100f0fe8[] = {3, 40, 53, 55, -1};
// GLOBAL: LEGO1 0x100f1000
// GLOBAL: BETA10 0x101dbf18
MxS32 g_unk0x100f1000[] = {22, 33, 41, 45, 67, -1};
// GLOBAL: LEGO1 0x100f1018
// GLOBAL: BETA10 0x101dbf30
MxS32 g_unk0x100f1018[] = {13, 30, 31, 62, -1};
// GLOBAL: LEGO1 0x100f1030
// GLOBAL: BETA10 0x101dbf48
MxS32 g_unk0x100f1030[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
// --- End of indices into g_plantInfo ---
// GLOBAL: LEGO1 0x10102b1c // GLOBAL: LEGO1 0x10102b1c
// GLOBAL: BETA10 0x10209f60 // GLOBAL: BETA10 0x10209f60
undefined4 g_nextHeadWavIndex = 0; undefined4 g_nextHeadWavIndex = 0;
@ -658,12 +699,173 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
} }
} }
// STUB: LEGO1 0x10019b90 // FUNCTION: LEGO1 0x10019b90
// STUB: BETA10 0x1000e374 // FUNCTION: BETA10 0x1000e374
LegoEntity* Act2Actor::FUN_10019b90(undefined* p_param) LegoEntity* Act2Actor::FUN_10019b90(undefined* p_param)
{ {
// TODO MxS32 i;
return 0; LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i);
LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i);
LegoEntity* result = 0;
switch (m_unk0x1d) {
case 0:
if (buildingInfo[12].m_unk0x11) {
result = buildingInfo[12].m_entity;
*p_param = 1;
}
else if (buildingInfo[14].m_unk0x11) {
result = buildingInfo[14].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0f30[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f30[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0f30[i]].m_entity;
break;
}
}
}
break;
case 1:
if (buildingInfo[13].m_unk0x11) {
result = buildingInfo[13].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0f50[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f50[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0f50[i]].m_entity;
break;
}
}
}
break;
case 2:
if (buildingInfo[9].m_unk0x11) {
result = buildingInfo[9].m_entity;
*p_param = 1;
}
else if (buildingInfo[11].m_unk0x11) {
result = buildingInfo[11].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0f90[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f90[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0f90[i]].m_entity;
break;
}
}
}
break;
case 3:
if (buildingInfo[7].m_unk0x11) {
result = buildingInfo[7].m_entity;
*p_param = 1;
}
else if (buildingInfo[8].m_unk0x11) {
result = buildingInfo[8].m_entity;
*p_param = 1;
}
else if (buildingInfo[3].m_unk0x11) {
result = buildingInfo[3].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0fa8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fa8[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0fa8[i]].m_entity;
break;
}
}
}
break;
case 4:
if (buildingInfo[5].m_unk0x11) {
result = buildingInfo[5].m_entity;
*p_param = 1;
}
else if (buildingInfo[10].m_unk0x11) {
result = buildingInfo[10].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0fb8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fb8[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0fb8[i]].m_entity;
break;
}
}
}
break;
case 5:
if (buildingInfo[4].m_unk0x11) {
result = buildingInfo[4].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f0fe8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fe8[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f0fe8[i]].m_entity;
break;
}
}
}
break;
case 6:
if (buildingInfo[2].m_unk0x11) {
result = buildingInfo[2].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f1000[i] != -1; i++) {
if (plantInfo[g_unk0x100f1000[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f1000[i]].m_entity;
break;
}
}
}
break;
case 7:
if (buildingInfo[6].m_unk0x11) {
result = buildingInfo[6].m_entity;
*p_param = 1;
}
else {
for (i = 0; g_unk0x100f1018[i] != -1; i++) {
if (plantInfo[g_unk0x100f1018[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f1018[i]].m_entity;
break;
}
}
}
break;
case 8:
for (i = 0; g_unk0x100f1030[i] != -1; i++) {
if (plantInfo[g_unk0x100f1030[i]].m_unk0x16) {
result = plantInfo[g_unk0x100f1030[i]].m_entity;
break;
}
}
if (result) {
return result;
}
if (buildingInfo[0xf].m_unk0x11) {
result = buildingInfo[0xf].m_entity;
*p_param = 1;
}
break;
}
if (!result && !g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
g_brickstrLocations[m_unk0x1d].m_unk0x1c = 1;
m_unk0x48++;
}
return result;
} }
// FUNCTION: LEGO1 0x1001a180 // FUNCTION: LEGO1 0x1001a180

View file

@ -858,6 +858,7 @@ MxResult LegoBuildingManager::FUN_10030630()
} }
// FUNCTION: LEGO1 0x10030790 // FUNCTION: LEGO1 0x10030790
// FUNCTION: BETA10 0x10064db9
LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length)
{ {
if (!m_unk0x09) { if (!m_unk0x09) {

View file

@ -115,6 +115,27 @@ void LegoPlantManager::Reset(MxS32 p_worldId)
m_unk0x0c = 0; m_unk0x0c = 0;
} }
// STUB: LEGO1 0x10026410
// STUB: BETA10 0x100c50e9
MxResult LegoPlantManager::FUN_10026410()
{
// might be similar to LegoBuildingManager::FUN_10030630()
// TODO
return SUCCESS;
}
// FUNCTION: LEGO1 0x10026570
// FUNCTION: BETA10 0x100c55e0
LegoPlantInfo* LegoPlantManager::GetInfoArray(MxS32& p_length)
{
if (!m_unk0x0c) {
FUN_10026410();
}
p_length = sizeOfArray(g_plantInfo);
return g_plantInfo;
}
// FUNCTION: LEGO1 0x10026590 // FUNCTION: LEGO1 0x10026590
// FUNCTION: BETA10 0x100c561e // FUNCTION: BETA10 0x100c561e
LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId) LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId)