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
10 changed files with 95 additions and 23 deletions

View File

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