Implement Act2Actor::FUN_10019700 (#1215)

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz 2024-12-13 01:54:51 +01:00 committed by GitHub
parent 1bfeebd004
commit 054f56fd9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 124 additions and 6 deletions

View file

@ -34,6 +34,7 @@ class Act2Actor : public LegoAnimActor {
undefined4 FUN_10019700(MxFloat p_param);
void FUN_100199f0(MxS8 p_param);
void FUN_100192a0(undefined4 p_param);
LegoEntity* FUN_10019b90(undefined* p_param);
// SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor'
@ -58,7 +59,7 @@ class Act2Actor : public LegoAnimActor {
undefined m_unk0x40; // 0x40
MxFloat m_unk0x44; // 0x44
MxS8 m_unk0x48; // 0x48
undefined4 m_unk0x4c; // 0x4c
LegoEntity* m_unk0x4c; // 0x4c
};
// TEMPLATE: LEGO1 0x100194f0

View file

@ -70,6 +70,7 @@ class LegoAct2 : public LegoWorld {
MxResult FUN_100516b0();
void FUN_100517b0();
undefined4 FUN_10051f20();
MxResult FUN_10052560(
Act2mainScript::Script p_objectId,
MxBool p_param2,

View file

@ -18,6 +18,9 @@ struct LegoAnimActorStruct {
// FUNCTION: BETA10 0x10012210
LegoAnim* GetAnimTreePtr() { return m_AnimTreePtr; }
// FUNCTION: BETA10 0x10012240
LegoROI** GetROIMap() { return m_roiMap; }
// TODO: Possibly private
float m_unk0x00; // 0x00
LegoAnim* m_AnimTreePtr; // 0x04

View file

@ -131,8 +131,13 @@ class LegoOmni : public MxOmni {
LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; }
LegoPathActor* GetUserActor() { return m_userActor; }
// FUNCTION: BETA10 0x100e53a0
LegoPlantManager* GetPlantManager() { return m_plantManager; }
LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
// FUNCTION: BETA10 0x100e53d0
LegoBuildingManager* GetBuildingManager() { return m_buildingManager; }
// FUNCTION: BETA10 0x100e52b0

View file

@ -21,6 +21,7 @@ class LegoSoundManager : public MxSoundManager {
void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity);
// FUNCTION: BETA10 0x1000f350
LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }
private:

View file

@ -2,14 +2,18 @@
#include "3dmanager/lego3dmanager.h"
#include "act2main_actions.h"
#include "anim/legoanim.h"
#include "legoact2.h"
#include "legobuildingmanager.h"
#include "legocachesoundmanager.h"
#include "legopathcontroller.h"
#include "legopathedgecontainer.h"
#include "legoplantmanager.h"
#include "legosoundmanager.h"
#include "legovideomanager.h"
#include "legoworld.h"
#include "misc.h"
#include "mxdebug.h"
#include "roi/legoroi.h"
#include "viewmanager/viewmanager.h"
@ -37,6 +41,17 @@ Act2Actor::UnknownListStructure g_unk0x100f0db8[] = {
// GLOBAL: LEGO1 0x100f0f1c
MxFloat g_unk0x100f0f1c = 0.0f;
// GLOBAL: LEGO1 0x100f0f20
// GLOBAL: BETA10 0x101dbe40
MxBool g_unk0x100f0f20 = FALSE;
// GLOBAL: LEGO1 0x100f0f24
MxBool g_unk0x100f0f24 = FALSE;
// GLOBAL: LEGO1 0x100f0f28
// GLOBAL: BETA10 0x101dbe44
MxBool g_unk0x100f0f28 = FALSE;
// GLOBAL: LEGO1 0x10102b1c
// GLOBAL: BETA10 0x10209f60
undefined4 g_nextHeadWavIndex = 0;
@ -66,7 +81,7 @@ Act2Actor::Act2Actor()
m_unk0x44 = 0;
m_unk0x40 = 1;
m_unk0x48 = 0;
m_unk0x4c = 0;
m_unk0x4c = NULL;
m_unk0x38 = NULL;
m_unk0x3c = 0;
@ -194,7 +209,7 @@ void Act2Actor::VTable0x70(float p_time)
FindROI("pwrbrik")->SetVisibility(FALSE);
FindROI("debrick")->SetVisibility(FALSE);
FindROI("ray")->SetVisibility(FALSE);
m_unk0x4c = 0;
m_unk0x4c = NULL;
m_unk0x1e = 2;
VTable0xa0();
FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f);
@ -496,11 +511,80 @@ MxS32 Act2Actor::VTable0xa0()
}
}
// STUB: LEGO1 0x10019700
// STUB: BETA10 0x1000dd27
// FUNCTION: LEGO1 0x10019700
// FUNCTION: BETA10 0x1000dd27
undefined4 Act2Actor::FUN_10019700(MxFloat p_param)
{
// TODO
if (!m_unk0x4c) {
g_unk0x100f0f20 = FALSE;
m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
g_unk0x100f0f24 = FALSE;
g_unk0x100f0f28 = FALSE;
}
if (!m_unk0x4c) {
MxTrace("nothing left to destroy at location %d\n", m_unk0x1d);
m_unk0x1e = 1;
if (m_unk0x1d == 8) {
((LegoAct2*) CurrentWorld())->FUN_10051f20();
}
return 1;
}
if ((!g_unk0x100f0f28) && (m_unk0x30 < p_param)) {
g_unk0x100f0f28 = TRUE;
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE);
if (g_unk0x100f0f20) {
BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE);
}
else {
PlantManager()->ScheduleAnimation(m_unk0x4c, 800);
}
}
if (m_unk0x2c < p_param) {
g_unk0x100f0f20 = FALSE;
m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
m_unk0x2c = m_shootAnim->GetDuration() + p_param;
m_unk0x30 = m_unk0x2c - 1300.0f;
g_unk0x100f0f24 = FALSE;
g_unk0x100f0f28 = FALSE;
return 0;
}
m_lastTime = p_param;
LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 1.0f;
brickstrROI->FUN_100a58f0(matrix);
brickstrROI->VTable0x14();
Vector3 col0(matrix[0]);
Vector3 col1(matrix[1]);
Vector3 col2(matrix[2]);
Vector3 col3(matrix[3]);
col2 = col3;
col2 -= m_unk0x4c->GetROI()->GetWorldPosition();
col2.Unitize();
col0.EqualsCross(&col1, &col2);
col0.Unitize();
col1.EqualsCross(&col2, &col3);
assert(!m_cameraFlag);
LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap());
}
return 0;
}
@ -574,6 +658,14 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
}
}
// STUB: LEGO1 0x10019b90
// STUB: BETA10 0x1000e374
LegoEntity* Act2Actor::FUN_10019b90(undefined* p_param)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x1001a180
MxS32 Act2Actor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
{

View file

@ -660,6 +660,7 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data)
}
// FUNCTION: LEGO1 0x10030150
// FUNCTION: BETA10 0x100644ff
void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28)
{
m_world = CurrentWorld();

View file

@ -111,14 +111,18 @@ ViewManager* GetViewManager()
}
// FUNCTION: LEGO1 0x100157e0
// FUNCTION: BETA10 0x100e4b29
LegoPlantManager* PlantManager()
{
assert(LegoOmni::GetInstance());
return LegoOmni::GetInstance()->GetPlantManager();
}
// FUNCTION: LEGO1 0x100157f0
// FUNCTION: BETA10 0x100e4b70
LegoBuildingManager* BuildingManager()
{
assert(LegoOmni::GetInstance());
return LegoOmni::GetInstance()->GetBuildingManager();
}

View file

@ -928,6 +928,14 @@ void LegoAct2::SpawnBricks()
m_nextBrick++;
}
// STUB: LEGO1 0x10051f20
// STUB: BETA10 0x10013f48
undefined4 LegoAct2::FUN_10051f20()
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10051fa0
// FUNCTION: BETA10 0x10013fd3
void LegoAct2::FUN_10051fa0(MxS32 p_param1)

View file

@ -409,6 +409,7 @@ LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix,
}
// FUNCTION: LEGO1 0x100a8e80
// FUNCTION: BETA10 0x1018ab3a
void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap)
{
MxMatrix mat;

View file

@ -22,6 +22,7 @@ targets:
ghidra:
ignore-types:
# these classes have been changed by hand to account for changes between LEGO1 and BETA10
- Act2Actor
- Act2Brick
- LegoAct2
- LegoCarBuild