Implement/match LegoAct2::Notify (#1175)

* Implement LegoAct2::Notify

* Fix naming

* Remove unnecessary actions/ prefix in includes
This commit is contained in:
Christian Semmler 2024-11-29 13:11:29 -07:00 committed by GitHub
parent 29a0ae8f07
commit a17b3168e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 114 additions and 11 deletions

View file

@ -6,6 +6,8 @@
#include "legoworld.h" #include "legoworld.h"
class Act2Actor; class Act2Actor;
class LegoPathStructNotificationParam;
class MxEndActionNotificationParam;
// VTABLE: LEGO1 0x100d4a70 // VTABLE: LEGO1 0x100d4a70
// SIZE 0x10 // SIZE 0x10
@ -79,6 +81,9 @@ class LegoAct2 : public LegoWorld {
// LegoAct2::`scalar deleting destructor' // LegoAct2::`scalar deleting destructor'
private: private:
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleTransitionEnd();
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void FUN_10051900(); void FUN_10051900();
Act2Brick m_bricks[10]; // 0x00f8 Act2Brick m_bricks[10]; // 0x00f8
@ -96,7 +101,7 @@ class LegoAct2 : public LegoWorld {
LegoROI* m_unk0x10d8; // 0x10d8 LegoROI* m_unk0x10d8; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc MxMatrix m_unk0x10dc; // 0x10dc
undefined4 m_unk0x1124; // 0x1124 undefined4 m_unk0x1124; // 0x1124
undefined4 m_unk0x1128; // 0x1128 LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134 undefined4 m_unk0x1134; // 0x1134

View file

@ -1,9 +1,9 @@
#include "carrace.h" #include "carrace.h"
#include "actions/carrace_actions.h" #include "carrace_actions.h"
#include "actions/jukebox_actions.h"
#include "dunebuggy.h" #include "dunebuggy.h"
#include "isle.h" #include "isle.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legobackgroundcolor.h" #include "legobackgroundcolor.h"
#include "legocontrolmanager.h" #include "legocontrolmanager.h"

View file

@ -1,10 +1,10 @@
#include "jetskirace.h" #include "jetskirace.h"
#include "actions/jetrace_actions.h"
#include "actions/jetski_actions.h"
#include "actions/jukebox_actions.h"
#include "dunebuggy.h" #include "dunebuggy.h"
#include "isle.h" #include "isle.h"
#include "jetrace_actions.h"
#include "jetski_actions.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legohideanimpresenter.h" #include "legohideanimpresenter.h"

View file

@ -2,15 +2,19 @@
#include "act2actor.h" #include "act2actor.h"
#include "act2main_actions.h" #include "act2main_actions.h"
#include "actions/act2main_actions.h" #include "infomain_actions.h"
#include "actions/infomain_actions.h"
#include "islepathactor.h" #include "islepathactor.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legocachesoundmanager.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legomain.h" #include "legomain.h"
#include "legopathstruct.h"
#include "legosoundmanager.h"
#include "misc.h" #include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h" #include "mxbackgroundaudiomanager.h"
#include "mxdebug.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
@ -46,7 +50,7 @@ LegoAct2::LegoAct2()
m_unk0x10c4 = 0; m_unk0x10c4 = 0;
m_gameState = NULL; m_gameState = NULL;
m_unk0x10d8 = NULL; m_unk0x10d8 = NULL;
m_unk0x1128 = 0; m_ambulance = NULL;
m_unk0x10c2 = 0; m_unk0x10c2 = 0;
m_unk0x1130 = 0; m_unk0x1130 = 0;
m_unk0x10c0 = 0; m_unk0x10c0 = 0;
@ -238,9 +242,94 @@ MxResult LegoAct2::Tickle()
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x10050380 // FUNCTION: LEGO1 0x10050380
// STUB: BETA10 0x1003b049 // FUNCTION: BETA10 0x1003b049
MxLong LegoAct2::Notify(MxParam& p_param) MxLong LegoAct2::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationPathStruct: {
MxTrace("trigger %d\n", ((LegoPathStructNotificationParam&) p_param).GetData());
LegoPathStructNotificationParam& param = (LegoPathStructNotificationParam&) p_param;
LegoEntity* entity = (LegoEntity*) param.GetSender();
if (m_ambulance == NULL) {
m_ambulance = FindROI("ambul");
}
if (entity->GetROI() == m_unk0x10d8) {
HandlePathStruct(param);
}
result = 1;
break;
}
case c_notificationType22:
SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE);
m_unk0x10c1++;
if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) {
m_unk0x10c4 = 14;
LegoEntity* entity = (LegoEntity*) param.GetSender();
Mx3DPointFloat entityPosition(entity->GetROI()->GetWorldPosition());
Mx3DPointFloat unk0x10d8(m_unk0x10d8->GetWorldPosition());
Mx3DPointFloat locala4(unk0x10d8);
((Vector3&) entityPosition).Sub(unk0x10d8);
MxMatrix local2world(m_unk0x10d8->GetLocal2World());
Vector3 local30(local2world[0]);
Vector3 localac(local2world[1]);
Vector3 local28(local2world[2]);
local28 = entityPosition;
local28.Unitize();
Mx3DPointFloat local90(local28);
((Vector3&) local90).Mul(1.25f);
((Vector3&) locala4).Add(local90);
locala4[1] += 0.25;
local30.EqualsCross(&localac, &local28);
local30.Unitize();
Mx3DPointFloat direction(local2world[2]);
Mx3DPointFloat location(local2world[1]);
FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &location, &direction, NULL);
m_unk0x10c4 = 14;
m_unk0x10d0 = 0;
((LegoPathActor*) m_unk0x10d8->GetEntity())->SetState(LegoPathActor::c_bit3);
}
break;
case c_notificationTransitioned:
result = HandleTransitionEnd();
break;
}
}
return result;
}
// STUB: LEGO1 0x100506f0
MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10050a50
MxLong LegoAct2::HandleTransitionEnd()
{ {
// TODO // TODO
return 0; return 0;
@ -259,6 +348,14 @@ void LegoAct2::Enable(MxBool p_enable)
// TODO // TODO
} }
// STUB: LEGO1 0x10051460
// STUB: BETA10 0x1003bb72
MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10051900 // FUNCTION: LEGO1 0x10051900
// FUNCTION: BETA10 0x1003bed1 // FUNCTION: BETA10 0x1003bed1
void LegoAct2::FUN_10051900() void LegoAct2::FUN_10051900()

View file

@ -15,6 +15,7 @@ class MxMatrix : public Matrix4 {
// FUNCTION: LEGO1 0x10032770 // FUNCTION: LEGO1 0x10032770
MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
// FUNCTION: BETA10 0x1000fc20
MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
// FUNCTION: BETA10 0x10010860 // FUNCTION: BETA10 0x10010860