Implement/match LegoEntity::ClickAnimation (#994)

* Implement/match LegoEntity::VTable0x38

* Update names
This commit is contained in:
Christian Semmler 2024-06-05 13:00:46 -04:00 committed by GitHub
parent 6a9f68872b
commit f6c923a84e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 95 additions and 23 deletions

View File

@ -72,12 +72,12 @@ public:
MxResult Write(LegoStorage* p_storage); MxResult Write(LegoStorage* p_storage);
MxResult Read(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage);
LegoBuildingInfo* GetInfo(LegoEntity* p_entity); LegoBuildingInfo* GetInfo(LegoEntity* p_entity);
MxBool IncrementVariant(LegoEntity* p_entity); MxBool SwitchVariant(LegoEntity* p_entity);
MxBool FUN_1002fe40(LegoEntity* p_entity); MxBool FUN_1002fe40(LegoEntity* p_entity);
MxBool FUN_1002fe80(LegoEntity* p_entity); MxBool FUN_1002fe80(LegoEntity* p_entity);
MxBool FUN_1002fed0(LegoEntity* p_entity); MxBool FUN_1002fed0(LegoEntity* p_entity);
MxU32 GetBuildingEntityId(LegoEntity* p_entity); MxU32 GetBuildingEntityId(LegoEntity* p_entity);
MxU32 FUN_1002ff40(LegoEntity*, MxBool); MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool);
MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030000(LegoEntity* p_entity);
MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030030(MxS32 p_index);
MxBool FUN_10030110(LegoBuildingInfo* p_data); MxBool FUN_10030110(LegoBuildingInfo* p_data);
@ -89,6 +89,7 @@ public:
void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust);
static void FUN_10030800(); static void FUN_10030800();
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
// SYNTHETIC: LEGO1 0x1002f940 // SYNTHETIC: LEGO1 0x1002f940
// LegoBuildingManager::`scalar deleting destructor' // LegoBuildingManager::`scalar deleting destructor'

View File

@ -70,6 +70,7 @@ public:
LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(const char* p_name);
LegoActorInfo* GetActorInfo(LegoROI* p_roi); LegoActorInfo* GetActorInfo(LegoROI* p_roi);
MxBool SwitchHat(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi);
MxU32 FUN_10085120(LegoROI* p_roi);
MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und);
MxU8 GetMood(LegoROI* p_roi); MxU8 GetMood(LegoROI* p_roi);
LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity);

View File

@ -64,9 +64,9 @@ public:
// FUNCTION: LEGO1 0x10001090 // FUNCTION: LEGO1 0x10001090
virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30
virtual void VTable0x34(MxBool p_und); // vtable+0x34 virtual void ClickSound(MxBool p_und); // vtable+0x34
virtual void VTable0x38(); // vtable+0x38 virtual void ClickAnimation(); // vtable+0x38
virtual void VTable0x3c(); // vtable+0x3c virtual void SwitchVariant(); // vtable+0x3c
virtual void VTable0x40(); // vtable+0x40 virtual void VTable0x40(); // vtable+0x40
virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x44(); // vtable+0x44
virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48 virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48

View File

@ -128,9 +128,9 @@ public:
LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
LegoPathActor* GetCurrentActor() { return m_currentActor; } LegoPathActor* GetCurrentActor() { return m_currentActor; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoPlantManager* GetPlantManager() { return m_plantManager; }
LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } LegoBuildingManager* GetBuildingManager() { return m_buildingManager; }
LegoGameState* GetGameState() { return m_gameState; } LegoGameState* GetGameState() { return m_gameState; }
MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; } MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; }
MxTransitionManager* GetTransitionManager() { return m_transitionManager; } MxTransitionManager* GetTransitionManager() { return m_transitionManager; }

View File

@ -30,11 +30,13 @@ public:
void Write(LegoStorage* p_storage); void Write(LegoStorage* p_storage);
MxResult Read(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage);
MxBool FUN_100269e0(LegoEntity* p_entity); MxBool FUN_100269e0(LegoEntity* p_entity);
MxU32 FUN_10026ba0(LegoEntity*, MxBool); MxU32 FUN_10026b70(LegoEntity* p_entity);
MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool);
void FUN_10026c50(LegoEntity* p_entity); void FUN_10026c50(LegoEntity* p_entity);
void FUN_10027120(); void FUN_10027120();
static void SetCustomizeAnimFile(const char* p_value); static void SetCustomizeAnimFile(const char* p_value);
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
// SYNTHETIC: LEGO1 0x100262a0 // SYNTHETIC: LEGO1 0x100262a0
// LegoPlantManager::`scalar deleting destructor' // LegoPlantManager::`scalar deleting destructor'

View File

@ -441,7 +441,7 @@ LegoBuildingInfo* LegoBuildingManager::GetInfo(LegoEntity* p_entity)
// FUNCTION: LEGO1 0x1002fdb0 // FUNCTION: LEGO1 0x1002fdb0
// FUNCTION: BETA10 0x10064101 // FUNCTION: BETA10 0x10064101
MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
{ {
if (g_buildingManagerConfig <= 1) { if (g_buildingManagerConfig <= 1) {
return TRUE; return TRUE;

View File

@ -21,6 +21,9 @@
DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
// GLOBAL: LEGO1 0x100fc4e0
MxU32 g_unk0x100fc4e0 = 10;
// GLOBAL: LEGO1 0x100fc4e4 // GLOBAL: LEGO1 0x100fc4e4
char* LegoCharacterManager::g_customizeAnimFile = NULL; char* LegoCharacterManager::g_customizeAnimFile = NULL;
@ -753,6 +756,19 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
return TRUE; return TRUE;
} }
// FUNCTION: LEGO1 0x10085120
// FUNCTION: BETA10 0x1007680c
MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi)
{
LegoActorInfo* info = GetActorInfo(p_roi);
if (info != NULL) {
return info->m_unk0x10 + g_unk0x100fc4e0;
}
return 0;
}
// FUNCTION: LEGO1 0x10085140 // FUNCTION: LEGO1 0x10085140
MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und)
{ {

View File

@ -56,8 +56,15 @@ MxBool LegoPlantManager::FUN_100269e0(LegoEntity* p_entity)
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x10026b70
MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10026ba0 // STUB: LEGO1 0x10026ba0
MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity*, MxBool) MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity* p_entity, MxBool)
{ {
// TODO // TODO
return 0; return 0;

View File

@ -93,13 +93,13 @@ ViewManager* GetViewManager()
// FUNCTION: LEGO1 0x100157e0 // FUNCTION: LEGO1 0x100157e0
LegoPlantManager* PlantManager() LegoPlantManager* PlantManager()
{ {
return LegoOmni::GetInstance()->GetLegoPlantManager(); return LegoOmni::GetInstance()->GetPlantManager();
} }
// FUNCTION: LEGO1 0x100157f0 // FUNCTION: LEGO1 0x100157f0
LegoBuildingManager* BuildingManager() LegoBuildingManager* BuildingManager()
{ {
return LegoOmni::GetInstance()->GetLegoBuildingManager(); return LegoOmni::GetInstance()->GetBuildingManager();
} }
// FUNCTION: LEGO1 0x10015800 // FUNCTION: LEGO1 0x10015800

View File

@ -2,11 +2,13 @@
#include "3dmanager/lego3dmanager.h" #include "3dmanager/lego3dmanager.h"
#include "define.h" #include "define.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h" #include "legobuildingmanager.h"
#include "legocameracontroller.h" #include "legocameracontroller.h"
#include "legocharactermanager.h" #include "legocharactermanager.h"
#include "legoeventnotificationparam.h" #include "legoeventnotificationparam.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legomain.h"
#include "legoplantmanager.h" #include "legoplantmanager.h"
#include "legoutils.h" #include "legoutils.h"
#include "legovideomanager.h" #include "legovideomanager.h"
@ -245,11 +247,12 @@ void LegoEntity::ParseAction(char* p_extra)
} }
// FUNCTION: LEGO1 0x10010f10 // FUNCTION: LEGO1 0x10010f10
void LegoEntity::VTable0x34(MxBool p_und) // FUNCTION: BETA10 0x1007ee87
void LegoEntity::ClickSound(MxBool p_und)
{ {
if (!GetUnknown0x10IsSet(c_altBit1)) { if (!GetUnknown0x10IsSet(c_altBit1)) {
MxU32 objectId = 0; MxU32 objectId = 0;
const LegoChar* roiName = m_roi->GetName(); const char* name = m_roi->GetName();
switch (m_type) { switch (m_type) {
case e_actor: case e_actor:
@ -269,20 +272,56 @@ void LegoEntity::VTable0x34(MxBool p_und)
MxDSAction action; MxDSAction action;
action.SetAtomId(MxAtomId(CharacterManager()->GetCustomizeAnimFile(), e_lowerCase2)); action.SetAtomId(MxAtomId(CharacterManager()->GetCustomizeAnimFile(), e_lowerCase2));
action.SetObjectId(objectId); action.SetObjectId(objectId);
action.AppendExtra(strlen(roiName) + 1, roiName); action.AppendExtra(strlen(name) + 1, name);
Start(&action); Start(&action);
} }
} }
} }
// STUB: LEGO1 0x10011070 // FUNCTION: LEGO1 0x10011070
void LegoEntity::VTable0x38() // FUNCTION: BETA10 0x1007f062
void LegoEntity::ClickAnimation()
{ {
// TODO if (!GetUnknown0x10IsSet(c_altBit1)) {
MxU32 objectId = 0;
MxDSAction action;
const char* name = m_roi->GetName();
char extra[1024];
switch (m_type) {
case e_actor:
objectId = LegoOmni::GetInstance()->GetCharacterManager()->FUN_10085120(m_roi);
action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2));
sprintf(extra, "SUBST:actor_01:%s", name);
break;
case e_unk1:
break;
case e_plant:
objectId = LegoOmni::GetInstance()->GetPlantManager()->FUN_10026b70(this);
action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2));
sprintf(extra, "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name);
break;
case e_building:
objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetBuildingEntityId(this);
action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2));
sprintf(extra, "SUBST:haus1:%s", name);
break;
case e_autoROI:
break;
}
if (objectId) {
action.SetObjectId(objectId);
action.AppendExtra(strlen(extra) + 1, extra);
LegoOmni::GetInstance()->GetAnimationManager()->StartEntityAction(action, this);
m_unk0x10 |= c_altBit1;
}
}
} }
// FUNCTION: LEGO1 0x10011300 // FUNCTION: LEGO1 0x10011300
void LegoEntity::VTable0x3c() // FUNCTION: BETA10 0x1007f35a
void LegoEntity::SwitchVariant()
{ {
switch (m_type) { switch (m_type) {
case e_actor: case e_actor:
@ -294,45 +333,51 @@ void LegoEntity::VTable0x3c()
PlantManager()->FUN_100269e0(this); PlantManager()->FUN_100269e0(this);
break; break;
case e_building: case e_building:
BuildingManager()->IncrementVariant(this); BuildingManager()->SwitchVariant(this);
break; break;
} }
VTable0x34(FALSE); ClickSound(FALSE);
VTable0x38(); ClickAnimation();
} }
// STUB: LEGO1 0x10011360 // STUB: LEGO1 0x10011360
// FUNCTION: BETA10 0x1007f411
void LegoEntity::VTable0x40() void LegoEntity::VTable0x40()
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x100113c0 // STUB: LEGO1 0x100113c0
// FUNCTION: BETA10 0x1007f4c8
void LegoEntity::VTable0x44() void LegoEntity::VTable0x44()
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x10011420 // STUB: LEGO1 0x10011420
// FUNCTION: BETA10 0x1007f57f
void LegoEntity::VTable0x48(LegoROI* p_roi) void LegoEntity::VTable0x48(LegoROI* p_roi)
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x10011470 // STUB: LEGO1 0x10011470
// FUNCTION: BETA10 0x1007f62c
void LegoEntity::VTable0x4c() void LegoEntity::VTable0x4c()
{ {
// TODO // TODO
} }
// FUNCTION: LEGO1 0x100114e0 // FUNCTION: LEGO1 0x100114e0
// FUNCTION: BETA10 0x1007f6f0
void LegoEntity::SetType(MxU8 p_type) void LegoEntity::SetType(MxU8 p_type)
{ {
m_type = p_type; m_type = p_type;
} }
// FUNCTION: LEGO1 0x100114f0 // FUNCTION: LEGO1 0x100114f0
// FUNCTION: BETA10 0x1007f711
MxLong LegoEntity::Notify(MxParam& p_param) MxLong LegoEntity::Notify(MxParam& p_param)
{ {
LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param; LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param;
@ -349,7 +394,7 @@ MxLong LegoEntity::Notify(MxParam& p_param)
case LegoActor::c_pepper: case LegoActor::c_pepper:
if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && if (GameState()->GetCurrentAct() != LegoGameState::e_act2 &&
GameState()->GetCurrentAct() != LegoGameState::e_act3) { GameState()->GetCurrentAct() != LegoGameState::e_act3) {
VTable0x3c(); SwitchVariant();
} }
break; break;
case LegoActor::c_mama: case LegoActor::c_mama: