Animmanager (#712)

* Implement LegoAnimationManager::StartEntityAction
Fix some class definitions

* Fix style issues

* Add size annotations

* Fix global pointer

* Style/naming

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-03-23 10:09:20 -04:00
committed by GitHub
parent fca8f74bd8
commit 8b21e8136e
17 changed files with 165 additions and 49 deletions

View File

@@ -1,13 +1,22 @@
#include "legoanimationmanager.h"
#include "legocharactermanager.h"
#include "legogamestate.h"
#include "legoomni.h"
#include "misc.h"
#include "mxutilities.h"
#include "roi/legoroi.h"
#include <io.h>
DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500)
DECOMP_SIZE_ASSERT(Character, 0x18)
DECOMP_SIZE_ASSERT(Vehicle, 0x8)
DECOMP_SIZE_ASSERT(Unknown0x3c, 0x18)
// GLOBAL: LEGO1 0x100f6d20
Vehicle g_vehicles[] = {"bikebd", 0, FALSE, "bikepg", 0, FALSE, "bikerd", 0, FALSE, "bikesy", 0,
FALSE, "motoni", 0, FALSE, "motola", 0, FALSE, "board", 0, FALSE};
// GLOBAL: LEGO1 0x100f7048
Character g_characters[47]; // TODO: Initialize this
@@ -344,6 +353,45 @@ void LegoAnimationManager::FUN_100603c0()
// TODO
}
// FUNCTION: LEGO1 0x10060d00
MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity)
{
MxResult result = FAILURE;
LegoROI* roi = p_entity->GetROI();
if (p_entity->GetUnknown0x59() == 0) {
LegoPathActor* actor = CharacterManager()->FUN_10084c40(roi->GetName());
if (actor) {
LegoPathController* controller = actor->GetController();
if (controller) {
controller->FUN_10046770(actor);
actor->ClearController();
for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) {
if (m_unk0x3c[i].m_roi == roi) {
MxU32 characterId = m_unk0x3c[i].m_id;
g_characters[characterId].m_unk0x07 = TRUE;
MxS32 vehicleId = g_characters[characterId].m_vehicleId;
if (vehicleId >= 0) {
g_vehicles[vehicleId].m_unk0x05 = FALSE;
}
break;
}
}
}
}
}
if (StartActionIfUnknown0x13c(p_dsAction) == SUCCESS) {
result = SUCCESS;
}
return result;
}
// STUB: LEGO1 0x10060dc0
undefined4 LegoAnimationManager::FUN_10060dc0(
IsleScript::Script,

View File

@@ -170,7 +170,7 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity)
if (character != NULL) {
if (p_createEntity && character->m_roi->GetEntity() == NULL) {
// TODO: Match
LegoAnimActor* actor = new LegoAnimActor();
LegoExtraActor* actor = new LegoExtraActor();
actor->SetROI(character->m_roi, FALSE, FALSE);
actor->FUN_100114e0(0);
@@ -352,6 +352,11 @@ MxBool LegoCharacterManager::FUN_10084c00(const LegoChar*)
return FALSE;
}
// STUB: LEGO1 0x10084c40
LegoExtraActor* LegoCharacterManager::FUN_10084c40(const LegoChar*)
{
return NULL;
}
// FUNCTION: LEGO1 0x10084c60
LegoCharacterData* LegoCharacterManager::Find(const char* p_key)
{

View File

@@ -1,8 +1,5 @@
#include "misc.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
@@ -139,6 +136,12 @@ void SetCurrentActor(IslePathActor* p_currentActor)
LegoOmni::GetInstance()->SetCurrentActor(p_currentActor);
}
// FUNCTION: LEGO1 0x100158b0
void DeleteAction()
{
LegoOmni::GetInstance()->DeleteAction();
}
// FUNCTION: LEGO1 0x100158c0
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
{