2023-06-29 04:10:08 -04:00
|
|
|
#include "act3.h"
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "3dmanager/lego3dmanager.h"
|
|
|
|
#include "act3_actions.h"
|
2024-12-12 09:14:46 -05:00
|
|
|
#include "act3actors.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "helicopter.h"
|
2024-12-08 13:39:03 -05:00
|
|
|
#include "jukebox_actions.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "legoanimationmanager.h"
|
|
|
|
#include "legobuildingmanager.h"
|
|
|
|
#include "legocontrolmanager.h"
|
|
|
|
#include "legomain.h"
|
2024-12-07 13:57:59 -05:00
|
|
|
#include "legonavcontroller.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "legoplantmanager.h"
|
2024-12-08 13:39:03 -05:00
|
|
|
#include "legoutils.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "legovideomanager.h"
|
2024-12-07 13:57:59 -05:00
|
|
|
#include "misc.h"
|
2024-12-08 14:52:32 -05:00
|
|
|
#include "mxactionnotificationparam.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "mxbackgroundaudiomanager.h"
|
2024-12-07 13:57:59 -05:00
|
|
|
#include "mxmisc.h"
|
|
|
|
#include "mxnotificationmanager.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "mxticklemanager.h"
|
2024-12-08 13:39:03 -05:00
|
|
|
#include "mxtimer.h"
|
2024-12-08 12:00:57 -05:00
|
|
|
#include "mxtransitionmanager.h"
|
2024-12-08 14:52:32 -05:00
|
|
|
#include "scripts.h"
|
2024-12-07 13:57:59 -05:00
|
|
|
|
2023-10-24 04:14:45 -04:00
|
|
|
DECOMP_SIZE_ASSERT(Act3, 0x4274)
|
2024-06-03 12:53:25 -04:00
|
|
|
DECOMP_SIZE_ASSERT(Act3State, 0x0c)
|
2024-12-07 13:57:59 -05:00
|
|
|
DECOMP_SIZE_ASSERT(Act3ListElement, 0x0c)
|
|
|
|
DECOMP_SIZE_ASSERT(Act3List, 0x10)
|
2023-10-24 04:14:45 -04:00
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// GLOBAL: LEGO1 0x100d95e8
|
|
|
|
Act3Script::Script g_unk0x100d95e8[] =
|
|
|
|
{Act3Script::c_tlp053in_RunAnim, Act3Script::c_tlp064la_RunAnim, Act3Script::c_tlp068in_RunAnim};
|
|
|
|
|
2024-12-11 12:01:55 -05:00
|
|
|
// FUNCTION: LEGO1 0x10071d40
|
|
|
|
void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
|
|
|
|
{
|
|
|
|
if (m_unk0x0c) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (p_option) {
|
|
|
|
case 1:
|
|
|
|
if (!empty()) {
|
|
|
|
FUN_10071fa0();
|
|
|
|
push_back(Act3ListElement(p_objectId, p_option, FALSE));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL);
|
|
|
|
push_back(Act3ListElement(p_objectId, p_option, TRUE));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (empty()) {
|
|
|
|
push_back(Act3ListElement(p_objectId, p_option, TRUE));
|
|
|
|
InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
push_back(Act3ListElement(p_objectId, p_option, FALSE));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (empty()) {
|
|
|
|
push_back(Act3ListElement(p_objectId, p_option, TRUE));
|
|
|
|
InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-09 17:41:51 -05:00
|
|
|
// FUNCTION: LEGO1 0x10071fa0
|
|
|
|
void Act3List::FUN_10071fa0()
|
|
|
|
{
|
|
|
|
DeleteAction();
|
|
|
|
}
|
|
|
|
|
2024-12-11 12:01:55 -05:00
|
|
|
// FUNCTION: LEGO1 0x10071fb0
|
|
|
|
void Act3List::Clear()
|
|
|
|
{
|
|
|
|
m_unk0x0c = 1;
|
|
|
|
BackgroundAudioManager()->Stop();
|
|
|
|
|
|
|
|
if (empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Act3List::iterator it = begin(); it != end();) {
|
|
|
|
if ((*it).m_unk0x08) {
|
|
|
|
MxDSAction ds;
|
|
|
|
ds.SetAtomId(*g_act3Script);
|
|
|
|
ds.SetObjectId((*it).m_objectId);
|
|
|
|
DeleteObject(ds);
|
|
|
|
}
|
|
|
|
|
|
|
|
erase(it++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-09 17:41:51 -05:00
|
|
|
// FUNCTION: LEGO1 0x100720d0
|
2024-12-08 14:52:32 -05:00
|
|
|
void Act3List::FUN_100720d0(MxU32 p_objectId)
|
|
|
|
{
|
2024-12-09 17:41:51 -05:00
|
|
|
if (m_unk0x0c == 0) {
|
|
|
|
MxU32 removed = FALSE;
|
|
|
|
|
|
|
|
if (!empty()) {
|
|
|
|
if (p_objectId != 0) {
|
|
|
|
for (Act3List::iterator it = begin(); it != end(); it++) {
|
|
|
|
if ((*it).m_unk0x08 && (*it).m_objectId == p_objectId) {
|
|
|
|
erase(it);
|
|
|
|
removed = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pop_front();
|
|
|
|
removed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (removed && size() > 0) {
|
|
|
|
// TODO: Match
|
|
|
|
Act3List::iterator it = begin();
|
|
|
|
Act3ListElement& item = *(it++);
|
|
|
|
|
|
|
|
for (; it != end(); it++) {
|
|
|
|
if ((*it).m_unk0x04 == 1) {
|
|
|
|
for (Act3List::iterator it2 = begin(); it2 != it;) {
|
|
|
|
if ((*it2).m_unk0x08) {
|
|
|
|
FUN_10071fa0();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
it2 = erase(it2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!item.m_unk0x08) {
|
|
|
|
item.m_unk0x08 = TRUE;
|
|
|
|
InvokeAction(Extra::e_start, *g_act3Script, item.m_objectId, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-12-08 14:52:32 -05:00
|
|
|
}
|
|
|
|
|
2024-12-07 13:57:59 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072270
|
|
|
|
// FUNCTION: BETA10 0x10015470
|
2023-06-29 04:10:08 -04:00
|
|
|
Act3::Act3()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
m_state = NULL;
|
2024-12-07 13:57:59 -05:00
|
|
|
m_unk0x41fc = 0;
|
2024-12-08 12:00:57 -05:00
|
|
|
m_cop1 = NULL;
|
|
|
|
m_cop2 = NULL;
|
|
|
|
m_brickster = NULL;
|
|
|
|
m_copter = NULL;
|
|
|
|
m_shark = NULL;
|
2024-12-08 13:39:03 -05:00
|
|
|
m_time = -1;
|
2024-12-07 13:57:59 -05:00
|
|
|
m_unk0x421e = 0;
|
|
|
|
|
2024-12-08 14:52:32 -05:00
|
|
|
memset(m_helicopterDots, 0, sizeof(m_helicopterDots));
|
2024-12-07 13:57:59 -05:00
|
|
|
|
|
|
|
NavController()->ResetMaxLinearAccel(NavController()->GetMaxLinearAccel() * 30.0f);
|
|
|
|
NavController()->ResetMaxLinearDeccel(NavController()->GetMaxLinearDeccel() * 30.0f);
|
|
|
|
NotificationManager()->Register(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-02-07 06:13:20 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072500
|
2024-01-20 18:04:46 -05:00
|
|
|
MxBool Act3::VTable0x5c()
|
|
|
|
{
|
2024-02-07 06:13:20 -05:00
|
|
|
return TRUE;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x100726a0
|
|
|
|
// FUNCTION: BETA10 0x100155da
|
2023-06-29 04:10:08 -04:00
|
|
|
Act3::~Act3()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
Destroy(TRUE);
|
|
|
|
NotificationManager()->Unregister(this);
|
|
|
|
TickleManager()->UnregisterClient(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-12-11 16:20:21 -05:00
|
|
|
// FUNCTION: LEGO1 0x100727a0
|
|
|
|
// FUNCTION: BETA10 0x1001570d
|
|
|
|
void Act3::EatDonut(MxS32 p_index)
|
|
|
|
{
|
|
|
|
assert(p_index < MAX_DONUTS);
|
|
|
|
RemoveDonut(m_donuts[p_index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100727d0
|
|
|
|
// FUNCTION: BETA10 0x10015828
|
|
|
|
void Act3::RemoveDonut(Act3Ammo& p_p)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
MxS32 i;
|
|
|
|
for (i = 0; i < MAX_DONUTS; i++) {
|
|
|
|
if (&m_donuts[i] == &p_p) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(i != MAX_DONUTS);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
assert(p_p.IsValid());
|
|
|
|
p_p.Remove();
|
|
|
|
}
|
|
|
|
|
2024-12-09 17:41:51 -05:00
|
|
|
// FUNCTION: LEGO1 0x100727e0
|
|
|
|
// FUNCTION: BETA10 0x100158e2
|
|
|
|
MxResult Act3::ShootPizza(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up)
|
2024-01-27 12:15:14 -05:00
|
|
|
{
|
2024-12-09 17:41:51 -05:00
|
|
|
MxS32 nextPizza;
|
|
|
|
for (nextPizza = 0; nextPizza < (MxS32) sizeOfArray(m_pizzas); nextPizza++) {
|
2024-12-10 16:35:59 -05:00
|
|
|
if (!m_pizzas[nextPizza].IsValid()) {
|
2024-12-09 17:41:51 -05:00
|
|
|
LegoPathBoundary* boundary = NULL;
|
|
|
|
MxU32 local18 = TRUE;
|
|
|
|
|
2024-12-10 16:35:59 -05:00
|
|
|
m_pizzas[nextPizza].Create(this, TRUE, nextPizza);
|
2024-12-09 17:41:51 -05:00
|
|
|
|
|
|
|
if (m_pizzas[nextPizza].FUN_10053b40(p_location, p_direction, p_up) != SUCCESS) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MxFloat unk0x19c = *m_pizzas[nextPizza].GetUnknown0x19c();
|
|
|
|
if (p_controller->FUN_1004a380(
|
|
|
|
p_location,
|
|
|
|
p_direction,
|
|
|
|
m_pizzas[nextPizza].GetUnknown0x160(),
|
|
|
|
boundary,
|
|
|
|
unk0x19c
|
|
|
|
) == SUCCESS) {
|
|
|
|
Mx3DPointFloat direction;
|
|
|
|
|
|
|
|
direction = p_direction;
|
|
|
|
direction *= unk0x19c;
|
|
|
|
direction += p_location;
|
|
|
|
|
|
|
|
assert(m_brickster && m_brickster->GetROI());
|
|
|
|
|
|
|
|
direction -= m_brickster->GetROI()->GetLocal2World()[3];
|
|
|
|
|
|
|
|
local18 = FALSE;
|
|
|
|
if (m_pizzas[nextPizza].FUN_10053cb0(p_controller, boundary, unk0x19c) == SUCCESS) {
|
|
|
|
p_controller->PlaceActor(&m_pizzas[nextPizza]);
|
|
|
|
boundary->AddActor(&m_pizzas[nextPizza]);
|
|
|
|
m_pizzas[nextPizza].SetWorldSpeed(10.0f);
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (local18 && m_pizzas[nextPizza].FUN_10053d30(p_controller, unk0x19c) == SUCCESS) {
|
|
|
|
p_controller->PlaceActor(&m_pizzas[nextPizza]);
|
|
|
|
m_pizzas[nextPizza].SetWorldSpeed(10.0f);
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FAILURE;
|
2024-01-27 12:15:14 -05:00
|
|
|
}
|
|
|
|
|
2024-12-09 17:41:51 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072980
|
|
|
|
// FUNCTION: BETA10 0x10015c69
|
|
|
|
MxResult Act3::ShootDonut(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up)
|
2024-01-27 12:15:14 -05:00
|
|
|
{
|
2024-12-09 17:41:51 -05:00
|
|
|
MxS32 nextDonut;
|
|
|
|
for (nextDonut = 0; nextDonut < (MxS32) sizeOfArray(m_donuts); nextDonut++) {
|
2024-12-10 16:35:59 -05:00
|
|
|
if (!m_donuts[nextDonut].IsValid()) {
|
2024-12-09 17:41:51 -05:00
|
|
|
LegoPathBoundary* boundary = NULL;
|
|
|
|
|
2024-12-10 16:35:59 -05:00
|
|
|
m_donuts[nextDonut].Create(this, FALSE, nextDonut);
|
2024-12-09 17:41:51 -05:00
|
|
|
|
|
|
|
if (m_donuts[nextDonut].FUN_10053b40(p_location, p_direction, p_up) != SUCCESS) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MxFloat unk0x19c = *m_donuts[nextDonut].GetUnknown0x19c();
|
|
|
|
if (p_controller->FUN_1004a380(
|
|
|
|
p_location,
|
|
|
|
p_direction,
|
|
|
|
m_donuts[nextDonut].GetUnknown0x160(),
|
|
|
|
boundary,
|
|
|
|
unk0x19c
|
|
|
|
) == SUCCESS) {
|
|
|
|
if (m_donuts[nextDonut].FUN_10053cb0(p_controller, boundary, unk0x19c) == SUCCESS) {
|
|
|
|
p_controller->PlaceActor(&m_donuts[nextDonut]);
|
|
|
|
boundary->AddActor(&m_donuts[nextDonut]);
|
|
|
|
m_donuts[nextDonut].SetWorldSpeed(10.0f);
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_donuts[nextDonut].FUN_10053d30(p_controller, unk0x19c) == SUCCESS) {
|
|
|
|
p_controller->PlaceActor(&m_donuts[nextDonut]);
|
|
|
|
m_donuts[nextDonut].SetWorldSpeed(10.0f);
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FAILURE;
|
2024-01-27 12:15:14 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072c30
|
|
|
|
// FUNCTION: BETA10 0x100160fb
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult Act3::Create(MxDSAction& p_dsAction)
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
GameState()->FindLoadedAct();
|
|
|
|
|
|
|
|
MxResult result = LegoWorld::Create(p_dsAction);
|
|
|
|
if (result == SUCCESS) {
|
|
|
|
ControlManager()->Register(this);
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
InputManager()->Register(this);
|
|
|
|
|
|
|
|
switch (GameState()->GetLoadedAct()) {
|
|
|
|
case LegoGameState::e_act2:
|
|
|
|
GameState()->StopArea(LegoGameState::e_infomain);
|
|
|
|
GameState()->StopArea(LegoGameState::e_act2main);
|
|
|
|
break;
|
|
|
|
case LegoGameState::e_act3:
|
|
|
|
GameState()->StopArea(LegoGameState::e_infomain);
|
|
|
|
GameState()->StopArea(LegoGameState::e_act3script);
|
|
|
|
break;
|
|
|
|
case LegoGameState::e_act1:
|
|
|
|
case LegoGameState::e_actNotFound:
|
|
|
|
GameState()->StopArea(LegoGameState::e_undefined);
|
|
|
|
if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) {
|
|
|
|
GameState()->StopArea(LegoGameState::e_isle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LegoGameState* gameState = GameState();
|
|
|
|
Act3State* state = (Act3State*) gameState->GetState("Act3State");
|
|
|
|
|
|
|
|
if (state == NULL) {
|
|
|
|
state = (Act3State*) gameState->CreateState("Act3State");
|
|
|
|
}
|
|
|
|
|
|
|
|
m_state = state;
|
|
|
|
assert(m_state);
|
|
|
|
|
|
|
|
GameState()->m_currentArea = LegoGameState::e_act3script;
|
|
|
|
GameState()->SetCurrentAct(LegoGameState::e_act3);
|
|
|
|
GameState()->SetDirty(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072d50
|
|
|
|
// FUNCTION: BETA10 0x1001627f
|
2024-01-20 18:04:46 -05:00
|
|
|
void Act3::Destroy(MxBool p_fromDestructor)
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
NavController()->Reset();
|
|
|
|
ControlManager()->Unregister(this);
|
|
|
|
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
|
|
|
|
InputManager()->UnRegister(this);
|
|
|
|
|
|
|
|
if (UserActor() != NULL) {
|
|
|
|
if ((IslePathActor*) UserActor() == m_copter) {
|
|
|
|
((IslePathActor*) UserActor())->Exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
Remove(UserActor());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p_fromDestructor) {
|
|
|
|
LegoWorld::Destroy(FALSE);
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 14:52:32 -05:00
|
|
|
// FUNCTION: LEGO1 0x10072de0
|
|
|
|
// FUNCTION: BETA10 0x10016322
|
2024-01-20 18:04:46 -05:00
|
|
|
MxLong Act3::Notify(MxParam& p_param)
|
|
|
|
{
|
2024-12-08 14:52:32 -05:00
|
|
|
MxNotificationParam& param = (MxNotificationParam&) p_param;
|
|
|
|
LegoWorld::Notify(p_param);
|
|
|
|
|
|
|
|
if (m_worldStarted) {
|
|
|
|
switch (param.GetNotification()) {
|
|
|
|
case c_notificationEndAction: {
|
|
|
|
MxEndActionNotificationParam& param = (MxEndActionNotificationParam&) p_param;
|
|
|
|
|
|
|
|
if (param.GetAction() != NULL && param.GetAction()->GetAtomId() == *g_act3Script) {
|
|
|
|
if (param.GetAction()->GetObjectId() == Act3Script::c_HelicopterDashboard) {
|
|
|
|
MxDSAction action;
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
SetAppCursor(e_cursorArrow);
|
|
|
|
VideoManager()->Get3DManager()->SetFrustrum(45.0f, 0.1f, 125.0f);
|
|
|
|
|
|
|
|
m_brickster->SetWorldSpeed(5.0f);
|
|
|
|
m_brickster->SetState(0);
|
|
|
|
assert(BackgroundAudioManager());
|
|
|
|
|
|
|
|
action.SetAtomId(*g_jukeboxScript);
|
|
|
|
action.SetObjectId(Act3Script::c_pzhitdn_PlayWav);
|
|
|
|
|
|
|
|
BackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating);
|
|
|
|
m_brickster->FUN_100417c0();
|
|
|
|
|
|
|
|
m_cop1->SetState(0);
|
|
|
|
m_cop1->SetWorldSpeed(2.0f);
|
|
|
|
m_cop1->VTable0xa8();
|
|
|
|
|
|
|
|
m_cop2->SetState(0);
|
|
|
|
m_cop2->SetWorldSpeed(2.0f);
|
|
|
|
m_cop2->VTable0xa8();
|
|
|
|
|
|
|
|
m_brickster->VTable0xa8();
|
|
|
|
|
|
|
|
m_unk0x4218 = 0;
|
|
|
|
m_unk0x4219 = 0;
|
|
|
|
m_unk0x421a = 0;
|
|
|
|
m_unk0x421b = 0;
|
|
|
|
m_unk0x421c = 0;
|
|
|
|
m_unk0x421d = 0;
|
|
|
|
|
|
|
|
MxS32 length;
|
|
|
|
LegoBuildingInfo* info = BuildingManager()->GetInfoArray(length);
|
|
|
|
m_unk0x421e = 0;
|
|
|
|
|
|
|
|
while (--length >= 0) {
|
|
|
|
if (info[length].m_unk0x11 < 0 && info[length].m_boundary != NULL &&
|
|
|
|
info[length].m_entity != NULL) {
|
|
|
|
m_unk0x421e++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
length = 0;
|
|
|
|
m_unk0x421e--;
|
|
|
|
char buf[80];
|
|
|
|
|
|
|
|
do {
|
|
|
|
sprintf(buf, "HelicopterDotOn%d_Bitmap", length + 1);
|
|
|
|
m_helicopterDots[length] = (MxPresenter*) Find("MxPresenter", buf);
|
|
|
|
|
|
|
|
if (m_unk0x421e > length) {
|
|
|
|
m_helicopterDots[length]->Enable(TRUE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_helicopterDots[length]->Enable(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
length++;
|
|
|
|
} while (length < (MxS32) sizeOfArray(m_helicopterDots));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_unk0x4220.FUN_100720d0(param.GetAction()->GetObjectId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case c_notificationKeyPress:
|
|
|
|
if (m_state->m_unk0x08 == 1 && ((LegoEventNotificationParam&) p_param).GetKey() == ' ') {
|
|
|
|
AnimationManager()->FUN_10061010(FALSE);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case c_notificationButtonUp:
|
|
|
|
case c_notificationButtonDown:
|
|
|
|
if (m_state->m_unk0x08 == 1) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case c_notificationEndAnim:
|
|
|
|
if (m_state->m_unk0x08 == 1) {
|
|
|
|
assert(m_copter && m_brickster && m_cop1 && m_cop2);
|
|
|
|
m_unk0x4220.FUN_100720d0(NULL);
|
|
|
|
m_state->m_unk0x08 = 0;
|
|
|
|
FUN_10015820(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
m_copter->HandleClick();
|
|
|
|
m_copter->m_state->m_unk0x08 = 1;
|
|
|
|
m_copter->HandleEndAnim((LegoEndAnimNotificationParam&) param);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case c_notificationTransitioned:
|
|
|
|
HandleTransitionEnd();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-20 18:04:46 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-12-08 14:52:32 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073240
|
|
|
|
MxLong Act3::HandleTransitionEnd()
|
|
|
|
{
|
|
|
|
if (m_destLocation != LegoGameState::e_undefined) {
|
|
|
|
GameState()->SwitchArea(m_destLocation);
|
|
|
|
m_destLocation = LegoGameState::e_undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073270
|
2024-01-27 15:18:35 -05:00
|
|
|
void Act3::ReadyWorld()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
PlantManager()->FUN_10027200();
|
|
|
|
BuildingManager()->FUN_10030800();
|
|
|
|
AnimationManager()->FUN_1005f6d0(FALSE);
|
|
|
|
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f);
|
|
|
|
|
|
|
|
m_unk0x426c = g_unk0x100d95e8[rand() % 3];
|
|
|
|
AnimationManager()->FUN_10060dc0(m_unk0x426c, NULL, TRUE, FALSE, NULL, TRUE, FALSE, FALSE, FALSE);
|
|
|
|
|
|
|
|
m_state->m_unk0x08 = 1;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073300
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult Act3::Tickle()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
if (!m_worldStarted) {
|
|
|
|
LegoWorld::Tickle();
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_unk0x426c != (Act3Script::Script) 0) {
|
|
|
|
if (AnimationManager()->FUN_10064ee0(m_unk0x426c)) {
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
TickleManager()->UnregisterClient(this);
|
|
|
|
m_unk0x426c = (Act3Script::Script) 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-20 18:04:46 -05:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073400
|
2024-01-27 12:15:14 -05:00
|
|
|
void Act3::FUN_10073400()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
m_state->m_unk0x08 = 2;
|
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-01-27 12:15:14 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073430
|
2024-01-27 12:15:14 -05:00
|
|
|
void Act3::FUN_10073430()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
m_state->m_unk0x08 = 3;
|
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-01-27 12:15:14 -05:00
|
|
|
}
|
|
|
|
|
2024-12-11 16:20:21 -05:00
|
|
|
// STUB: LEGO1 0x10073460
|
|
|
|
// STUB: BETA10 0x10016bc6
|
|
|
|
void Act3::GoodEnding(const Matrix4& p_matrix)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
DebugPrintf("In Good Ending...");
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10073500
|
|
|
|
void Act3::DebugPrintf(const char* p_format, ...)
|
|
|
|
{
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
2024-12-08 13:39:03 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073a90
|
2024-02-02 12:18:46 -05:00
|
|
|
void Act3::Enable(MxBool p_enable)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-12-08 13:39:03 -05:00
|
|
|
if ((MxBool) m_set0xd0.empty() == p_enable) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LegoWorld::Enable(p_enable);
|
|
|
|
|
|
|
|
if (p_enable) {
|
|
|
|
if (GameState()->m_previousArea == LegoGameState::e_infomain) {
|
|
|
|
GameState()->StopArea(LegoGameState::e_infomain);
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
PlayMusic(JukeboxScript::c_Act3Music);
|
|
|
|
GameState()->SetDirty(TRUE);
|
|
|
|
|
|
|
|
if (m_time > 0) {
|
|
|
|
MxFloat delta = Timer()->GetTime() - m_time - 100.0f;
|
|
|
|
m_time = -1.0f;
|
|
|
|
|
|
|
|
m_cop1->SetLastTime(m_cop1->GetLastTime() + delta);
|
|
|
|
m_cop1->SetActorTime(m_cop1->GetActorTime() + delta);
|
|
|
|
m_cop1->SetUnknown0x20(m_cop1->GetUnknown0x20() + delta);
|
|
|
|
m_cop1->SetUnknown0x1c(m_cop1->GetUnknown0x1c() + delta);
|
|
|
|
|
|
|
|
m_cop2->SetLastTime(m_cop2->GetLastTime() + delta);
|
|
|
|
m_cop2->SetActorTime(m_cop2->GetActorTime() + delta);
|
|
|
|
m_cop2->SetUnknown0x20(m_cop2->GetUnknown0x20() + delta);
|
|
|
|
m_cop2->SetUnknown0x1c(m_cop2->GetUnknown0x1c() + delta);
|
|
|
|
|
|
|
|
m_brickster->SetLastTime(m_brickster->GetLastTime() + delta);
|
|
|
|
m_brickster->SetActorTime(m_brickster->GetActorTime() + delta);
|
|
|
|
m_brickster->SetUnknown0x20(m_brickster->GetUnknown0x20() + delta);
|
|
|
|
m_brickster->SetUnknown0x24(m_brickster->GetUnknown0x24() + delta);
|
|
|
|
m_brickster->SetUnknown0x50(m_brickster->GetUnknown0x50() + delta);
|
|
|
|
m_brickster->SetUnknown0x1c(m_brickster->GetUnknown0x1c() + delta);
|
|
|
|
|
|
|
|
m_copter->SetLastTime(m_copter->GetLastTime() + delta);
|
|
|
|
m_copter->SetActorTime(m_copter->GetActorTime() + delta);
|
|
|
|
|
|
|
|
m_shark->SetLastTime(m_shark->GetLastTime() + delta);
|
|
|
|
m_shark->SetActorTime(m_shark->GetActorTime() + delta);
|
|
|
|
m_shark->SetUnknown0x2c(m_shark->GetUnknown0x2c() + delta);
|
|
|
|
|
|
|
|
MxS32 i;
|
|
|
|
for (i = 0; i < (MxS32) sizeOfArray(m_pizzas); i++) {
|
2024-12-10 16:35:59 -05:00
|
|
|
if (m_pizzas[i].IsValid()) {
|
2024-12-08 13:39:03 -05:00
|
|
|
m_pizzas[i].SetLastTime(m_pizzas[i].GetLastTime() + delta);
|
|
|
|
m_pizzas[i].SetActorTime(m_pizzas[i].GetActorTime() + delta);
|
|
|
|
m_pizzas[i].SetUnknown0x158(m_pizzas[i].GetUnknown0x158() + delta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < (MxS32) sizeOfArray(m_donuts); i++) {
|
2024-12-10 16:35:59 -05:00
|
|
|
if (m_donuts[i].IsValid()) {
|
2024-12-08 13:39:03 -05:00
|
|
|
m_donuts[i].SetLastTime(m_donuts[i].GetLastTime() + delta);
|
|
|
|
m_donuts[i].SetActorTime(m_donuts[i].GetActorTime() + delta);
|
|
|
|
m_donuts[i].SetUnknown0x158(m_donuts[i].GetUnknown0x158() + delta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PlaceActor(m_copter);
|
|
|
|
m_copter->GetBoundary()->AddActor(m_copter);
|
|
|
|
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
InputManager()->Register(this);
|
|
|
|
SetUserActor(m_copter);
|
|
|
|
m_copter->VTable0xa8();
|
|
|
|
SetAppCursor(e_cursorArrow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SetUserActor(NULL);
|
|
|
|
BackgroundAudioManager()->Stop();
|
|
|
|
m_time = Timer()->GetTime();
|
|
|
|
TickleManager()->UnregisterClient(this);
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073e40
|
2024-01-20 18:04:46 -05:00
|
|
|
void Act3::VTable0x60()
|
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
// empty
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-12-08 12:00:57 -05:00
|
|
|
// FUNCTION: LEGO1 0x10073e50
|
2024-05-24 20:41:57 -04:00
|
|
|
MxBool Act3::Escape()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-12-08 12:00:57 -05:00
|
|
|
BackgroundAudioManager()->Stop();
|
|
|
|
AnimationManager()->FUN_10061010(FALSE);
|
|
|
|
DeleteObjects(&m_atomId, Act3Script::c_tlp053in_RunAnim, 999);
|
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
|
|
|
return TRUE;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|