1
0
Fork 0
mirror of https://github.com/isledecomp/isle.git synced 2025-04-11 22:24:24 -04:00

Implement LegoAct2::Tickle() and others ()

* Implement `LegoAct2::Tickle()` and others

* Fix decomplint errors

* Minor cleanup

* Address review comments

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz 2024-11-25 23:24:46 +01:00 committed by GitHub
parent b9a1da6a7a
commit 83b85f26a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 221 additions and 14 deletions

View file

@ -18,6 +18,8 @@ public:
MxResult VTable0x9c() override; // vtable+0x9c
MxS32 VTable0xa0() override; // vtable+0xa0
void FUN_10019520();
// SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor'

View file

@ -66,6 +66,15 @@ public:
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; }
undefined4 FUN_10052560(
undefined4 p_param1,
MxBool p_param2,
MxBool p_param3,
Mx3DPointFloat* p_param4,
Mx3DPointFloat* p_param5,
Mx3DPointFloat* p_param6
);
// SYNTHETIC: LEGO1 0x1004fe20
// LegoAct2::`scalar deleting destructor'
@ -79,9 +88,9 @@ private:
undefined4 m_unk0x10c4; // 0x10c4
undefined4 m_unk0x10c8; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc
undefined4 m_unk0x10d0; // 0x10d0
MxS32 m_unk0x10d0; // 0x10d0
char* m_unk0x10d4; // 0x10d4
undefined4 m_unk0x10d8; // 0x10d8
LegoROI* m_unk0x10d8; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc
undefined4 m_unk0x1124; // 0x1124
undefined4 m_unk0x1128; // 0x1128

View file

@ -155,7 +155,9 @@ public:
MxBool FindVehicle(const char* p_name, MxU32& p_index);
MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info);
MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info);
void FUN_10060480(LegoChar* p_param1[], undefined4 p_param2);
void FUN_100604d0(MxBool p_unk0x08);
void FUN_100604f0(MxS32* p_param1, undefined4 p_param2);
void FUN_10060540(MxBool p_unk0x29);
void FUN_10060570(MxBool p_unk0x1a);
MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity);
@ -181,6 +183,7 @@ public:
MxResult FUN_10064670(Vector3* p_position);
MxResult FUN_10064740(Vector3* p_position);
MxResult FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10);
undefined FUN_10064ee0(MxU32 p_param);
static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig);

View file

@ -22,7 +22,8 @@ extern const char* g_strHIT_WALL_SOUND;
class LegoPathActor : public LegoActor {
public:
enum {
c_bit3 = 0x04
c_bit3 = 0x04,
c_bit9 = 0x100
};
LegoPathActor();

View file

@ -67,6 +67,13 @@ void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed)
m_unk0x44 = 0;
}
// STUB: LEGO1 0x10019520
// STUB: BETA10 0x1000d4d6
void Act2Actor::FUN_10019520()
{
// TODO
}
// STUB: LEGO1 0x100195a0
MxS32 Act2Actor::VTable0xa0()
{

View file

@ -133,7 +133,7 @@ MxLong Helicopter::HandleClick()
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter);
FUN_10015820(TRUE, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE);
SetState(4);
SetState(LegoPathActor::c_bit3);
PlayMusic(JukeboxScript::c_Jail_Music);
break;
case LegoGameState::e_act2:
@ -206,7 +206,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
m_state->SetUnknown8(3);
m_world->RemoveActor(this);
InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterLand_Anim, NULL);
SetState(4);
SetState(LegoPathActor::c_bit3);
}
ret = 1;
break;

View file

@ -878,6 +878,13 @@ void LegoAnimationManager::DeleteAnimations()
m_suspended = suspended;
}
// STUB: LEGO1 0x10060480
// STUB: BETA10 0x100412a9
void LegoAnimationManager::FUN_10060480(LegoChar* p_param1[], undefined4 p_param2)
{
// TODO
}
// FUNCTION: LEGO1 0x100604d0
// FUNCTION: BETA10 0x10041335
void LegoAnimationManager::FUN_100604d0(MxBool p_unk0x08)
@ -887,6 +894,13 @@ void LegoAnimationManager::FUN_100604d0(MxBool p_unk0x08)
}
}
// STUB: LEGO1 0x100604f0
// STUB: BETA10 0x1004137b
void LegoAnimationManager::FUN_100604f0(MxS32* p_param1, undefined4 p_param2)
{
// TODO
}
// FUNCTION: LEGO1 0x10060540
// FUNCTION: BETA10 0x1004140f
void LegoAnimationManager::FUN_10060540(MxBool p_unk0x29)
@ -1001,7 +1015,7 @@ MxResult LegoAnimationManager::FUN_100605e0(
LegoPathActor* actor = UserActor();
if (actor != NULL) {
actor->SetState(4);
actor->SetState(LegoPathActor::c_bit3);
actor->SetWorldSpeed(0.0f);
}
}
@ -2762,7 +2776,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x
LegoPathActor* actor = UserActor();
if (actor != NULL) {
actor->SetState(4);
actor->SetState(LegoPathActor::c_bit3);
actor->SetWorldSpeed(0.0f);
}
@ -2823,6 +2837,13 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time)
}
}
// STUB: LEGO1 0x10064ee0
undefined LegoAnimationManager::FUN_10064ee0(MxU32 p_param)
{
// TODO
return FALSE;
}
// FUNCTION: LEGO1 0x10064ff0
AnimState::AnimState()
{

View file

@ -143,8 +143,10 @@ void FUN_10015820(MxBool p_disable, MxU16 p_flags)
}
// FUNCTION: LEGO1 0x10015840
// FUNCTION: BETA10 0x100e4ce4
LegoROI* FindROI(const char* p_name)
{
assert(LegoOmni::GetInstance());
return LegoOmni::GetInstance()->FindROI(p_name);
}

View file

@ -405,6 +405,7 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x1005b270
// FUNCTION: BETA10 0x1008ea6d
LegoROI* LegoOmni::FindROI(const char* p_name)
{
ViewManager* viewManager = GetVideoManager()->Get3DManager()->GetLego3DView()->GetViewManager();

View file

@ -454,7 +454,7 @@ MxU32 LegoExtraActor::VTable0x6c(
if (plpas.find(*itpa) != plpas.end()) {
LegoPathActor* actor = *itpa;
if (this != actor && !(actor->GetState() & 0x100)) {
if (this != actor && !(actor->GetState() & LegoPathActor::c_bit9)) {
LegoROI* roi = actor->GetROI();
if ((roi != NULL && roi->GetVisibility()) || actor->GetCameraFlag()) {

View file

@ -455,7 +455,7 @@ MxU32 LegoPathActor::VTable0x6c(
if (plpas.find(*itpa) != plpas.end()) {
LegoPathActor* actor = *itpa;
if (this != actor && !(actor->GetState() & 0x100)) {
if (this != actor && !(actor->GetState() & LegoPathActor::c_bit9)) {
LegoROI* roi = actor->GetROI();
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {

View file

@ -1,24 +1,63 @@
#include "legoact2.h"
#include "act2actor.h"
#include "act2main_actions.h"
#include "actions/act2main_actions.h"
#include "islepathactor.h"
#include "legoanimationmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legomain.h"
#include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxticklemanager.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(LegoAct2, 0x1154)
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
// STUB: LEGO1 0x1004fce0
// STUB: BETA10 0x1003a5a0
// GLOBAL: LEGO1 0x100f4474
static undefined4 g_unk0x100f4474 = 0;
// GLOBAL: LEGO1 0x100f43f0
// GLOBAL: BETA10 0x101e14a8
static MxS32 g_unk0x100f43f0[] = {
Act2mainScript::c_tns030bd_RunAnim,
Act2mainScript::c_tns030pg_RunAnim,
Act2mainScript::c_tns030rd_RunAnim,
Act2mainScript::c_tns030sy_RunAnim,
Act2mainScript::c_tns051in_RunAnim,
Act2mainScript::c_tra045la_RunAnim,
Act2mainScript::c_tns030bd_RunAnim,
Act2mainScript::c_snsx48cl_RunAnim
};
// GLOBAL: LEGO1 0x100f4410
static LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
// FUNCTION: LEGO1 0x1004fce0
// FUNCTION: BETA10 0x1003a5a0
LegoAct2::LegoAct2()
{
// TODO
m_unk0x10c4 = 0;
m_gameState = NULL;
m_unk0x10d8 = NULL;
m_unk0x1128 = 0;
m_unk0x10c2 = 0;
m_unk0x1130 = 0;
m_unk0x10c0 = 0;
m_unk0x10c1 = 0;
m_unk0x1138 = NULL;
m_unk0x1140 = 0;
m_unk0x1144 = 0;
m_unk0x1150 = 0;
m_unk0x10c8 = 0;
m_unk0x10d4 = "";
m_unk0x113c = 5;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x1004fe10
@ -90,14 +129,116 @@ MxResult LegoAct2::Create(MxDSAction& p_dsAction)
return result;
}
// STUB: LEGO1 0x10050040
// FUNCTION: LEGO1 0x10050040
// FUNCTION: BETA10 0x1003a976
MxResult LegoAct2::Tickle()
{
// TODO
MxFloat distance;
if (!m_worldStarted) {
LegoWorld::Tickle();
return SUCCESS;
}
switch (m_unk0x10c4) {
case 0:
m_unk0x10c4 = 1;
break;
case 1:
((LegoPathActor*) m_unk0x10d8->GetEntity())->SetState(LegoPathActor::c_bit3);
switch (rand() % 3) {
case 0:
g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim;
break;
case 1:
g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim;
break;
case 2:
g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim;
break;
}
FUN_10052560(g_unk0x100f4474, TRUE, TRUE, NULL, NULL, NULL);
m_unk0x10d0 = 0;
m_unk0x10c4 = 2;
break;
case 2:
if (g_unk0x100f4474) {
if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) {
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
g_unk0x100f4474 = 0;
}
}
m_unk0x10d0 += 50;
break;
case 3:
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
m_unk0x10d0 = 0;
m_unk0x10c4 = 4;
FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f43f0, sizeOfArray(g_unk0x100f43f0));
AnimationManager()->FUN_10060480(g_unk0x100f4410, sizeOfArray(g_unk0x100f4410));
break;
case 4:
m_unk0x10d0 += 50;
break;
case 5:
m_unk0x10d0 += 50;
if (m_unk0x10d0 == 20000) {
const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition();
MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f};
distance = DISTSQRD3(pepperPosition, otherPoint);
if (m_unk0x1144 == 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav;
}
}
else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == 0) {
FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav;
}
break;
case 6:
m_unk0x10d0 += 50;
break;
case 9:
m_unk0x10d0 += 50;
if (m_unk0x10d0 >= 200) {
if (m_unk0x10c0 < 5) {
m_unk0x10c4 = 7;
}
else {
m_unk0x10c4 = 10;
m_unk0x10d0 = 0;
m_unk0x1138->FUN_10019520();
}
}
break;
case 10:
m_unk0x10d0 += 50;
break;
case 11:
break;
case 12:
break;
}
return SUCCESS;
}
// STUB: LEGO1 0x10050380
// STUB: BETA10 0x1003b049
MxLong LegoAct2::Notify(MxParam& p_param)
{
// TODO
@ -111,6 +252,7 @@ void LegoAct2::ReadyWorld()
}
// STUB: LEGO1 0x10050cf0
// STUB: BETA10 0x1003bb2d
void LegoAct2::Enable(MxBool p_enable)
{
// TODO
@ -156,3 +298,18 @@ MxBool LegoAct2::Escape()
m_unk0x1150 = 2;
return TRUE;
}
// STUB: LEGO1 0x10052560
// STUB: BETA10 0x100145c6
undefined4 LegoAct2::FUN_10052560(
undefined4 p_param1,
MxBool p_param2,
MxBool p_param3,
Mx3DPointFloat* p_param4,
Mx3DPointFloat* p_param5,
Mx3DPointFloat* p_param6
)
{
// TODO
return 0;
}

View file

@ -68,7 +68,9 @@ public:
// FUNCTION: BETA10 0x1000f320
const LegoChar* GetName() const { return m_name; }
// FUNCTION: BETA10 0x10015180
LegoEntity* GetEntity() { return m_entity; }
BoundingSphere& GetBoundingSphere() { return m_sphere; }
void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }

View file

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