Isle
Loading...
Searching...
No Matches
legoact2.cpp
Go to the documentation of this file.
1#include "legoact2.h"
2
4#include "act2actor.h"
5#include "act2main_actions.h"
6#include "infomain_actions.h"
7#include "islepathactor.h"
8#include "jukebox_actions.h"
11#include "legogamestate.h"
12#include "legoinputmanager.h"
14#include "legomain.h"
15#include "legopathstruct.h"
16#include "legosoundmanager.h"
17#include "legoutils.h"
18#include "legovideomanager.h"
19#include "misc.h"
22#include "mxdebug.h"
23#include "mxmisc.h"
25#include "mxticklemanager.h"
26#include "mxtransitionmanager.h"
27#include "mxvariabletable.h"
28#include "scripts.h"
29
30#include <vec.h>
31
34
35// GLOBAL: LEGO1 0x100f4474
37
38// GLOBAL: LEGO1 0x100f43f0
39// GLOBAL: BETA10 0x101e14a8
41 Act2mainScript::c_tns030bd_RunAnim,
42 Act2mainScript::c_tns030pg_RunAnim,
43 Act2mainScript::c_tns030rd_RunAnim,
44 Act2mainScript::c_tns030sy_RunAnim,
45 Act2mainScript::c_snsx35ro_RunAnim,
46 Act2mainScript::c_snsx36ro_RunAnim,
47 Act2mainScript::c_snsx37ro_RunAnim,
48 Act2mainScript::c_snsx48cl_RunAnim
49};
50
51// GLOBAL: LEGO1 0x100f4410
52const LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
53
54// GLOBAL: LEGO1 0x100f4428
56 Act2mainScript::c_snsx07pa_RunAnim,
57 Act2mainScript::c_snsx12ni_RunAnim,
58 Act2mainScript::c_snsx15la_RunAnim,
59 Act2mainScript::c_snsx47cl_RunAnim,
60 Act2mainScript::c_snsx65pg_RunAnim,
61 Act2mainScript::c_snsx68pg_RunAnim,
62 Act2mainScript::c_snsx69rd_RunAnim,
63 Act2mainScript::c_snsx72sy_RunAnim,
64 0,
65 0,
66 0,
67 0
68};
69
70// GLOBAL: LEGO1 0x100f4458
71const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd", "sy"};
72
73// FUNCTION: LEGO1 0x1004fce0
74// FUNCTION: BETA10 0x1003a5a0
76{
77 m_unk0x10c4 = 0;
78 m_gameState = NULL;
79 m_pepper = NULL;
80 m_ambulance = NULL;
81 m_ready = FALSE;
82 m_unk0x1130 = 0;
83 m_nextBrick = 0;
84 m_unk0x10c1 = 0;
85 m_unk0x1138 = NULL;
86 m_unk0x1140 = (Act2mainScript::Script) 0;
87 m_unk0x1144 = (Act2mainScript::Script) 0;
88 m_destLocation = LegoGameState::e_undefined;
90 m_siFile = "";
91 m_unk0x113c = 5;
93}
94
95// FUNCTION: LEGO1 0x1004fe40
96// FUNCTION: BETA10 0x1003a6f0
98{
99 if (m_ready) {
101 }
102
103 FUN_10051900();
104 InputManager()->UnRegister(this);
105 if (UserActor()) {
106 Remove(UserActor());
107 }
108
110}
111
112// FUNCTION: LEGO1 0x1004ff20
113// FUNCTION: BETA10 0x1003a7ff
115{
117
118 MxResult result = LegoWorld::Create(p_dsAction);
119 if (result == SUCCESS) {
121
122 LegoGameState* gameState = GameState();
123 LegoAct2State* state = (LegoAct2State*) gameState->GetState("LegoAct2State");
124
125 if (state == NULL) {
126 state = (LegoAct2State*) gameState->CreateState("LegoAct2State");
127 }
128
129 m_gameState = state;
130 m_gameState->m_unk0x08 = 0;
131
132 switch (GameState()->GetLoadedAct()) {
136 break;
140 break;
144 if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) {
146 }
147 }
148
151 InputManager()->Register(this);
153 }
154
155 return result;
156}
157
158// FUNCTION: LEGO1 0x10050040
159// FUNCTION: BETA10 0x1003a976
161{
162 MxFloat distance;
163
164 if (!m_worldStarted) {
166 return SUCCESS;
167 }
168
169 switch (m_unk0x10c4) {
170 case 0:
171 m_unk0x10c4 = 1;
172 break;
173 case 1:
174 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
175
176 switch (rand() % 3) {
177 case 0:
178 g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim;
179 break;
180 case 1:
181 g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim;
182 break;
183 case 2:
184 g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim;
185 break;
186 }
187
189 m_unk0x10d0 = 0;
190 m_unk0x10c4 = 2;
191 break;
192 case 2:
193 if (g_unk0x100f4474) {
194 if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) {
197 }
198 }
199
200 m_unk0x10d0 += 50;
201 break;
202 case 3:
204 m_unk0x10d0 = 0;
205 m_unk0x10c4 = 4;
206 FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
207
212 break;
213 case 4:
214 m_unk0x10d0 += 50;
215 break;
216 case 5:
217 m_unk0x10d0 += 50;
218
219 if (m_unk0x10d0 == 20000) {
220 const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition();
221 MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f};
222
223 distance = DISTSQRD3(pepperPosition, otherPoint);
224
225 if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
226 FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
227 m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav;
228 }
229 }
230 else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) {
231 FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
232 m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav;
233 }
234
235 break;
236 case 6:
237 m_unk0x10d0 += 50;
238 break;
239 case 9:
240 m_unk0x10d0 += 50;
241
242 if (m_unk0x10d0 >= 200) {
243 if (m_nextBrick < 5) {
244 m_unk0x10c4 = 7;
245 }
246 else {
247 m_unk0x10c4 = 10;
248 m_unk0x10d0 = 0;
249 m_unk0x1138->FUN_10019520();
250 }
251 }
252
253 break;
254 case 10:
255 m_unk0x10d0 += 50;
256 break;
257 case 11:
258 break;
259 case 12:
260 break;
261 }
262
263 return SUCCESS;
264}
265
266// FUNCTION: LEGO1 0x10050380
267// FUNCTION: BETA10 0x1003b049
269{
270 MxNotificationParam& param = (MxNotificationParam&) p_param;
271 MxLong result = 0;
272
273 LegoWorld::Notify(p_param);
274
275 if (m_worldStarted) {
276 switch (param.GetNotification()) {
278 result = HandleEndAction((MxEndActionNotificationParam&) p_param);
279 break;
281 MxTrace("trigger %d\n", ((LegoPathStructNotificationParam&) p_param).GetData());
282
284 LegoEntity* entity = (LegoEntity*) param.GetSender();
285
286 if (m_ambulance == NULL) {
287 m_ambulance = FindROI("ambul");
288 }
289
290 if (entity->GetROI() == m_pepper) {
291 HandlePathStruct(param);
292 }
293
294 result = 1;
295 break;
296 }
299
300 m_unk0x10c1++;
301 if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) {
302 m_unk0x10c4 = 14;
303
304 LegoEntity* entity = (LegoEntity*) param.GetSender();
305
306 Mx3DPointFloat local20(entity->GetROI()->GetWorldPosition());
307 Mx3DPointFloat locale8(m_pepper->GetWorldPosition());
308 Mx3DPointFloat locala4(locale8);
309
310 local20 -= locale8;
311
312 MxMatrix local2world(m_pepper->GetLocal2World());
313 Vector3 local30(local2world[0]);
314 Vector3 localac(local2world[1]);
315 Vector3 local28(local2world[2]);
316
317 local28 = local20;
318 local28.Unitize();
319
320 Mx3DPointFloat local90(local28);
321 local90 *= 1.25f;
322 locala4 += local90;
323 locala4[1] += 0.25;
324 local30.EqualsCross(localac, local28);
325 local30.Unitize();
326
327 Mx3DPointFloat locald4(local2world[2]);
328 Mx3DPointFloat localc0(local2world[1]);
329 FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL);
330
331 m_unk0x10c4 = 14;
332 m_unk0x10d0 = 0;
333 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
334 }
335 break;
337 result = HandleTransitionEnd();
338 break;
339 }
340 }
341
342 return result;
343}
344
345// FUNCTION: LEGO1 0x100506f0
346MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
347{
348 if (m_gameState->m_enabled && p_param.GetAction() != NULL) {
349 MxU32 objectId = p_param.GetAction()->GetObjectId();
350
351 if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) {
352 m_unk0x1144 = (Act2mainScript::Script) 0;
353 return 0;
354 }
355
356 if (m_unk0x1140 != objectId) {
357 return 0;
358 }
359
360 m_unk0x1140 = (Act2mainScript::Script) 0;
361
362 switch (m_unk0x10c4) {
363 case 2:
364 m_unk0x10c4 = 3;
365 break;
366 case 4:
367 FUN_10051960();
368 m_unk0x10c4 = 5;
369 m_unk0x10d0 = 0;
370 break;
371 case 6: {
372 LegoROI* roi;
373
374 roi = FindROI("nick");
375 if (roi != NULL) {
376 roi->SetVisibility(FALSE);
377 }
378
379 roi = FindROI("laura");
380 if (roi != NULL) {
381 roi->SetVisibility(FALSE);
382 }
383
384 roi = FindROI("motoni");
385 if (roi != NULL) {
386 roi->SetVisibility(FALSE);
387 }
388
389 roi = FindROI("motola");
390 if (roi != NULL) {
391 roi->SetVisibility(FALSE);
392 }
393
394 roi = FindROI("Block01");
396 roi->SetVisibility(FALSE);
397
398 roi = FindROI("Block02");
400 roi->SetVisibility(FALSE);
401
402 VariableTable()->SetVariable("ACTOR_01", "brickstr");
403 FUN_10052800();
404 m_unk0x10c4 = 7;
406 break;
407 }
408 case 11:
409 m_bricks[m_nextBrick - 1].Mute(TRUE);
410 m_unk0x10c4 = 12;
411 m_unk0x10d0 = 0;
412
413 FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
414 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
419 break;
420 case 12: {
421 LegoROI* roi;
422
423 roi = FindROI("nick");
424 if (roi != NULL) {
425 roi->SetVisibility(FALSE);
426 }
427
428 roi = FindROI("laura");
429 if (roi != NULL) {
430 roi->SetVisibility(FALSE);
431 }
432
433 roi = FindROI("motoni");
434 if (roi != NULL) {
435 roi->SetVisibility(FALSE);
436 }
437
438 roi = FindROI("motola");
439 if (roi != NULL) {
440 roi->SetVisibility(FALSE);
441 }
442
443 m_bricks[m_nextBrick - 1].Mute(FALSE);
444 m_unk0x10c4 = 13;
445 SpawnBricks();
447 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial);
448 break;
449 }
450 case 14:
451 for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
452 m_bricks[i].Remove();
453 }
454
455 FUN_10051900();
456 m_destLocation = LegoGameState::e_copterbuild;
458 break;
459 }
460 }
461
462 return 0;
463}
464
465// FUNCTION: LEGO1 0x10050a50
466MxLong LegoAct2::HandleTransitionEnd()
467{
468 if (m_destLocation != LegoGameState::e_undefined) {
469 GameState()->SwitchArea(m_destLocation);
470 m_destLocation = LegoGameState::e_undefined;
471 }
472
473 return 1;
474}
475
476// FUNCTION: LEGO1 0x10050a80
478{
480
482 TickleManager()->RegisterClient(this, 20);
483
484 m_ready = TRUE;
485 m_siFile = VariableTable()->GetVariable("ACT2_ANIMS_FILE");
486
488 m_pepper = FindROI("pepper");
489 IslePathActor* pepper = (IslePathActor*) m_pepper->GetEntity();
490 pepper->SpawnPlayer(
492 TRUE,
494 );
495
496 LegoROI* roi = FindROI("Block01");
497 BoundingSphere sphere = roi->GetBoundingSphere();
498 sphere.Radius() *= 1.5;
499 roi->SetBoundingSphere(sphere);
500 LegoPathActor* actor = (LegoPathActor*) roi->GetEntity();
501 PlaceActor(actor, "EDG01_04", 1, 0.5f, 3, 0.5f);
502
503 MxMatrix local2world = roi->GetLocal2World();
504 local2world[3][0] -= 1.5;
505 roi->FUN_100a58f0(local2world);
506 roi->VTable0x14();
507
508 roi = FindROI("Block02");
509 sphere = roi->GetBoundingSphere();
510 sphere.Radius() *= 1.5;
511 roi->SetBoundingSphere(sphere);
512 actor = (LegoPathActor*) roi->GetEntity();
513 PlaceActor(actor, "EDG00_149", 0, 0.5f, 2, 0.5f);
514
516 FUN_10051900();
517 VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 250.f);
518 m_gameState->m_enabled = TRUE;
519}
520
521// FUNCTION: LEGO1 0x10050cf0
522// FUNCTION: BETA10 0x1003bb2d
524{
525 if ((MxBool) m_set0xd0.empty() == p_enable) {
526 return;
527 }
528
529 LegoWorld::Enable(p_enable);
530
531 if (p_enable) {
532 m_gameState->m_enabled = TRUE;
533
535 m_pepper = FindROI("pepper");
536
537 ((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_unk0x10dc, m_unk0x1124, TRUE);
538
541 }
542
544
545 if (m_unk0x10c4 != 6 && m_unk0x10c4 != 12) {
546 PlayMusic(m_music);
547 }
548
549 if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
550 m_bricks[5].PlayWhistleSound();
551 }
552 else if (m_unk0x10c4 == 13) {
553 InitBricks();
554 }
555
556 TickleManager()->RegisterClient(this, 20);
558
559 if (m_unk0x10c4 == 2 || m_unk0x10c4 == 4 || m_unk0x10c4 == 6 || m_unk0x10c4 == 11 || m_unk0x10c4 == 12 ||
560 m_unk0x10c4 == 14) {
561 MxDSAction action;
563
564 m_unk0x1140 = (Act2mainScript::Script) 0;
565 action.SetObjectId(0);
566 HandleEndAction(param);
567 }
568
570 }
571 else {
572 m_unk0x10dc = m_pepper->GetLocal2World();
573 m_unk0x1124 = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
574
575 FUN_10051900();
577 UninitBricks();
578 DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav);
579
580 if (m_unk0x1144 != (Act2mainScript::Script) 0) {
581 MxDSAction action;
582 action.SetAtomId(m_atomId);
583 action.SetUnknown24(-2);
584 action.SetObjectId(m_unk0x1144);
585 DeleteObject(action);
586 m_unk0x1144 = (Act2mainScript::Script) 0;
587 }
588
590 }
591}
592
593// FUNCTION: LEGO1 0x10051460
594// FUNCTION: BETA10 0x1003bb72
595MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
596{
597 if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) {
598 LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity();
600 actor->SetWorldSpeed(0.0f);
601 FUN_10051900();
602
603 if (m_unk0x10d0 < 90000) {
604 FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
605 }
606 else {
607 FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
608 }
609
610 m_unk0x112c = 50;
611 m_unk0x10c4 = 6;
612 m_unk0x10d0 = 0;
613 }
614 else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) {
615 if (m_unk0x1144 == (Act2mainScript::Script) 0) {
616 FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
617 m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav;
618 }
619 }
620 else if (m_unk0x10c4 == 5) {
621 FUN_100521f0(p_param.GetData());
622 }
623 else if (m_unk0x10c4 == 7) {
624 FUN_10051fa0(p_param.GetData());
625 }
626 else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) {
627 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
628
629 if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
630 m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav;
631 }
632
633 m_unk0x1138->FUN_10019560();
634
635 m_unk0x10c4 = 11;
636 m_unk0x10d0 = 0;
637
638 if (m_nextBrick < 6) {
639 m_bricks[m_nextBrick].Create(m_nextBrick);
640 m_nextBrick++;
641 }
642
643 MxMatrix local2world = m_ambulance->GetLocal2World();
644 MxMatrix local2world2 = local2world;
645
646 LegoPathBoundary* boundary = m_unk0x1138->GetBoundary();
647 local2world[3][1] += 1.5;
648 local2world2[3][1] -= 0.1;
649
650 m_bricks[m_nextBrick - 1].FUN_1007a670(local2world, local2world2, boundary);
651 }
652
653 return 0;
654}
655
656// FUNCTION: LEGO1 0x100516b0
657// FUNCTION: BETA10 0x1003bcbc
659{
660 if (m_nextBrick > 4) {
661 return FAILURE;
662 }
663
664 Act2Brick& brick = m_bricks[m_nextBrick];
665 brick.Create(m_nextBrick);
666
667 MxMatrix local2world = m_ambulance->GetLocal2World();
668 MxMatrix local2world2 = local2world;
669
670 LegoPathBoundary* boundary = m_unk0x1138->GetBoundary();
671 local2world[3][1] += 1.3;
672 local2world2[3][1] -= 0.1;
673
674 brick.FUN_1007a670(local2world, local2world2, boundary);
675 m_nextBrick++;
676 m_unk0x10c4 = 9;
677 m_unk0x10d0 = 0;
678 return SUCCESS;
679}
680
681// FUNCTION: LEGO1 0x100517b0
683{
684 Act2Brick& brick = m_bricks[m_nextBrick];
685 brick.Create(m_nextBrick);
686
687 MxMatrix local2world = m_ambulance->GetLocal2World();
688 local2world[3][1] += 1.5;
689
690 LegoROI* roi = brick.GetROI();
691 roi->FUN_100a58f0(local2world);
692 roi->VTable0x14();
693 brick.PlayWhistleSound();
694 m_nextBrick++;
695}
696
697// FUNCTION: LEGO1 0x10051840
698void LegoAct2::PlayMusic(JukeboxScript::Script p_objectId)
699{
700 MxDSAction action;
701 action.SetAtomId(*g_jukeboxScript);
702 action.SetObjectId(p_objectId);
703
705 m_music = p_objectId;
706}
707
708// FUNCTION: LEGO1 0x10051900
709// FUNCTION: BETA10 0x1003bed1
710void LegoAct2::FUN_10051900()
711{
712 if (AnimationManager()) {
719 }
720}
721
722// FUNCTION: LEGO1 0x10051960
723// FUNCTION: BETA10 0x1003bf2c
724void LegoAct2::FUN_10051960()
725{
726 LegoROI* roi;
727
728 roi = FindROI("mama");
729 if (roi != NULL) {
730 roi->SetVisibility(FALSE);
731 }
732
733 roi = FindROI("papa");
734 if (roi != NULL) {
735 roi->SetVisibility(FALSE);
736 }
737
738 roi = FindROI("infoman");
739 if (roi != NULL) {
740 roi->SetVisibility(FALSE);
741 }
742
743 ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial);
744}
745
746// FUNCTION: LEGO1 0x100519c0
748{
749 // empty
750}
751
752// FUNCTION: LEGO1 0x100519d0
754{
757 DeleteObjects(&m_atomId, Act2mainScript::c_snsx50bu_RunAnim, 999);
758
759 if (UserActor() != NULL) {
760 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
761 ((IslePathActor*) UserActor())->Exit();
762 }
763 }
764
765 if (m_gameState != NULL) {
766 m_gameState->m_enabled = FALSE;
767 }
768
769 m_destLocation = LegoGameState::e_infomain;
770 return TRUE;
771}
772
773// FUNCTION: LEGO1 0x10051a60
774void LegoAct2::InitBricks()
775{
776 for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
777 if (m_bricks[i].GetROI() != NULL && m_bricks[i].GetROI()->GetVisibility()) {
778 m_bricks[i].PlayWhistleSound();
779 }
780 }
781}
782
783// FUNCTION: LEGO1 0x10051a90
784void LegoAct2::UninitBricks()
785{
786 for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
787 if (m_bricks[i].GetROI() != NULL) {
788 m_bricks[i].StopWhistleSound();
789 }
790 }
791}
792
793// FUNCTION: LEGO1 0x10051ac0
794// FUNCTION: BETA10 0x100138c0
795void LegoAct2::SpawnBricks()
796{
797 MxFloat infobridge[] = {79.0625f, 0.5f, -19.75f};
798 MxFloat palmTreeInPark[] = {67.62728f, 0.917197f, 11.49833f};
799 MxFloat store[] = {-53.9328f, 2.372259f, -61.2073f};
800 MxFloat postOffice[] = {-30.9856f, 0.30453f, -47.4378f};
801 MxFloat h3[] = {-71.2397f, 7.319758f, -23.0f};
802 MxFloat ht[] = {-59.5102f, 14.37329f, 24.70311f};
803 MxFloat posta[] = {74.0625f, 1.5f, -91.125f};
804 MxFloat ptree[] = {-20.4375f, 0.5f, -82.5625f};
805 MxFloat jail[] = {80.46174f, 0.6f, -59.50533f};
806 MxFloat hospital[] = {84.0f, 4.5f, 26.0f};
807
808 InitBricks();
809
810 Act2Brick* brick = &m_bricks[m_nextBrick];
811 brick->Create(m_nextBrick);
812 LegoROI* roi = brick->GetROI();
813 MxMatrix local2world = roi->GetLocal2World();
814 MxFloat* location;
815
816 // Unused but present in BETA
817 LegoEntity* entity;
818
819 if ((MxS16) (rand() % 2) == 1) {
820 m_firstBrick = 0;
821 location = infobridge;
822 MxTrace("infobridge\n");
823 }
824 else {
825 m_firstBrick = 1;
826 location = palmTreeInPark;
827 MxTrace("palm tree in park\n");
828 }
829
830 SET3(local2world[3], location);
831 roi->FUN_100a58f0(local2world);
832 roi->SetVisibility(TRUE);
833 roi->VTable0x14();
834 entity = roi->GetEntity();
835 brick->PlayWhistleSound();
836 m_nextBrick++;
837
838 brick = &m_bricks[m_nextBrick];
839 brick->Create(m_nextBrick);
840 roi = brick->GetROI();
841 local2world = roi->GetLocal2World();
842
843 if ((MxS16) (rand() % 2) == 1) {
844 m_secondBrick = 2;
845 location = store;
846 MxTrace("store\n");
847 }
848 else {
849 m_secondBrick = 3;
850 location = postOffice;
851 MxTrace("p.o.\n");
852 }
853
854 SET3(local2world[3], location);
855 roi->FUN_100a58f0(local2world);
856 roi->SetVisibility(TRUE);
857 roi->VTable0x14();
858 entity = roi->GetEntity();
859 brick->PlayWhistleSound();
860 m_nextBrick++;
861
862 brick = &m_bricks[m_nextBrick];
863 brick->Create(m_nextBrick);
864 roi = brick->GetROI();
865 local2world = roi->GetLocal2World();
866
867 if ((MxS16) (rand() % 2) == 1) {
868 m_thirdBrick = 4;
869 location = h3;
870 MxTrace("h3\n");
871 }
872 else {
873 m_thirdBrick = 5;
874 location = ht;
875 MxTrace("ht\n");
876 }
877
878 SET3(local2world[3], location);
879 roi->FUN_100a58f0(local2world);
880 roi->SetVisibility(TRUE);
881 roi->VTable0x14();
882 entity = roi->GetEntity();
883 brick->PlayWhistleSound();
884 m_nextBrick++;
885
886 brick = &m_bricks[m_nextBrick];
887 brick->Create(m_nextBrick);
888 roi = brick->GetROI();
889 local2world = roi->GetLocal2World();
890
891 if ((MxS16) (rand() % 2) == 1) {
892 if ((MxS16) (rand() % 2) == 1) {
893 m_fourthBrick = 6;
894 location = posta;
895 MxTrace("po.sta.\n");
896 }
897 else {
898 m_fourthBrick = 7;
899 location = ptree;
900 MxTrace("p.tree\n");
901 }
902 }
903 else {
904 if ((MxS16) (rand() % 2) == 1) {
905 m_fourthBrick = 8;
906 location = jail;
907 MxTrace("jail\n");
908 }
909 else {
910 m_fourthBrick = 9;
911 location = hospital;
912 MxTrace("hospi\n");
913 }
914 }
915
916 SET3(local2world[3], location);
917 roi->FUN_100a58f0(local2world);
918 roi->SetVisibility(TRUE);
919 roi->VTable0x14();
920 entity = roi->GetEntity();
921 brick->PlayWhistleSound();
922 m_nextBrick++;
923}
924
925// FUNCTION: LEGO1 0x10051f20
926// FUNCTION: BETA10 0x10013f48
928{
929 for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
930 m_bricks[i].Remove();
931 }
932
933 LegoPathActor* actor = m_unk0x1138;
935
936 m_gameState->SetUnknown0x08(104);
937 m_destLocation = LegoGameState::e_infomain;
939
940 MxTrace("Bad End of Act2\n");
941 m_unk0x10c4 = 14;
942 return SUCCESS;
943}
944
945// FUNCTION: LEGO1 0x10051fa0
946// FUNCTION: BETA10 0x10013fd3
947void LegoAct2::FUN_10051fa0(MxS32 p_param1)
948{
949 MxU8 randN = rand() / (RAND_MAX / 3);
950 randN++;
951
952 switch (p_param1) {
953 case 2:
954 if (randN == 1) {
955 FUN_10052560(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
956 }
957 else {
958 FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
959 }
960 break;
961 case 8:
962 if (randN == 1) {
963 FUN_10052560(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
964 }
965 else {
966 FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
967 }
968 break;
969 case 9:
970 if (randN == 1) {
971 FUN_10052560(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
972 }
973 else {
974 FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
975 }
976 break;
977 case 14:
978 if (randN == 1) {
979 FUN_10052560(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
980 }
981 else {
982 FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
983 }
984 break;
985 case 23:
986 if (randN == 1) {
987 FUN_10052560(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
988 }
989 else {
990 FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
991 }
992 break;
993 case 24:
994 case 25:
995 FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
996 break;
997 case 26:
998 if (randN == 1) {
999 FUN_10052560(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1000 }
1001 else {
1002 FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1003 }
1004 break;
1005 case 34:
1006 if (randN == 1) {
1007 FUN_10052560(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1008 }
1009 else {
1010 FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1011 }
1012 break;
1013 case 36:
1014 if (randN == 1) {
1015 FUN_10052560(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1016 }
1017 else {
1018 FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1019 }
1020 break;
1021 case 38:
1022 case 42:
1023 if (randN == 1) {
1024 FUN_10052560(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1025 }
1026 else {
1027 FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
1028 }
1029 break;
1030 }
1031}
1032
1033// FUNCTION: LEGO1 0x100521f0
1034// FUNCTION: BETA10 0x100142f1
1035void LegoAct2::FUN_100521f0(MxS32 p_param1)
1036{
1038 Mx3DPointFloat vec;
1039
1040 switch (p_param1) {
1041 case 0x02: {
1042 vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
1043 VariableTable()->SetVariable("ACTOR_01", "bd");
1044 objectId = Act2mainScript::c_tns030bd_RunAnim;
1045 break;
1046 }
1047 case 0x2a: {
1048 vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
1049 VariableTable()->SetVariable("ACTOR_01", "rd");
1050 objectId = Act2mainScript::c_tns030rd_RunAnim;
1051 break;
1052 }
1053 case 0x133: {
1054 vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
1055 VariableTable()->SetVariable("ACTOR_01", "pg");
1056 objectId = Act2mainScript::c_tns030pg_RunAnim;
1057 break;
1058 }
1059 case 0x134: {
1060 vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
1061 VariableTable()->SetVariable("ACTOR_01", "sy");
1062 objectId = Act2mainScript::c_tns030sy_RunAnim;
1063 break;
1064 }
1065 case 0x135: {
1066 vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
1067 VariableTable()->SetVariable("ACTOR_01", "rd");
1068 objectId = Act2mainScript::c_tns030rd_RunAnim;
1069 break;
1070 }
1071 case 0x138: {
1072 vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
1073 VariableTable()->SetVariable("ACTOR_01", "sy");
1074 objectId = Act2mainScript::c_tns030sy_RunAnim;
1075 break;
1076 }
1077 }
1078
1079 if (objectId != (Act2mainScript::Script) 0) {
1080 Mx3DPointFloat local30(vec);
1081 Mx3DPointFloat position(m_pepper->GetWorldPosition());
1082 local30 -= position;
1083 Mx3DPointFloat local44 = local30;
1084 local30.Unitize();
1085 FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL);
1086 }
1087}
1088
1089// FUNCTION: LEGO1 0x10052560
1090// FUNCTION: BETA10 0x100145c6
1092 Act2mainScript::Script p_objectId,
1093 MxBool p_param2,
1094 MxBool p_param3,
1095 Mx3DPointFloat* p_location,
1096 Mx3DPointFloat* p_direction,
1097 Mx3DPointFloat* p_param6
1098)
1099{
1100 if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) {
1101 assert(strlen(m_siFile));
1102
1103 if (!p_param2) {
1104 MxDSAction action;
1105
1106 action.SetObjectId(p_objectId);
1107 // World index: see LegoOmni::RegisterWorlds
1108 action.SetAtomId(*Lego()->GetWorldAtom(LegoOmni::e_act2));
1109
1110 if (p_location) {
1111 action.SetUp(Mx3DPointFloat(0.0f, 1.0f, 0.0f));
1112 action.SetLocation(*p_location);
1113 }
1114
1115 if (p_direction) {
1116 action.SetDirection(*p_direction);
1117 }
1118
1120 }
1121 else {
1122 MxMatrix matrix;
1123
1124 matrix.SetIdentity();
1125 MxBool oneVectorNotNull = FALSE;
1126
1127 if (p_location) {
1128 matrix[3][0] = (*p_location)[0];
1129 matrix[3][1] = (*p_location)[1];
1130 matrix[3][2] = (*p_location)[2];
1131 oneVectorNotNull = TRUE;
1132 }
1133
1134 if (p_direction) {
1135 matrix[2][0] = (*p_direction)[0];
1136 matrix[2][1] = (*p_direction)[1];
1137 matrix[2][2] = (*p_direction)[2];
1138 oneVectorNotNull = TRUE;
1139 }
1140
1141 if (p_param6) {
1142 matrix[1][0] = (*p_param6)[0];
1143 matrix[1][1] = (*p_param6)[1];
1144 matrix[1][2] = (*p_param6)[2];
1145 oneVectorNotNull = TRUE;
1146 }
1147
1148 Vector3 firstColumn(matrix[0]);
1149 Vector3 secondColumn(matrix[1]);
1150 Vector3 thirdColumn(matrix[2]);
1151
1152 firstColumn.EqualsCross(secondColumn, thirdColumn);
1153 firstColumn.Unitize();
1154
1155 MxMatrix* pmatrix = NULL;
1156
1157 if (oneVectorNotNull) {
1158 pmatrix = &matrix;
1159 }
1160
1161 MxResult result;
1162
1163 if (p_objectId == Act2mainScript::c_tja009ni_RunAnim) {
1164 result = AnimationManager()->FUN_10060dc0(
1165 p_objectId,
1166 pmatrix,
1167 TRUE,
1169 NULL,
1170 TRUE,
1171 TRUE,
1172 TRUE,
1173 TRUE
1174 );
1175 }
1176 else {
1177 result = AnimationManager()->FUN_10060dc0(
1178 p_objectId,
1179 pmatrix,
1180 TRUE,
1182 NULL,
1183 TRUE,
1184 TRUE,
1185 TRUE,
1186 FALSE
1187 );
1188 }
1189
1190 if (result == SUCCESS) {
1191 m_unk0x1140 = p_objectId;
1192 }
1193 }
1194 }
1195
1196 return SUCCESS;
1197}
1198
1199// FUNCTION: LEGO1 0x10052800
1200// FUNCTION: BETA10 0x10014aa8
1201MxResult LegoAct2::FUN_10052800()
1202{
1203 LegoPathActor* actor = m_unk0x1138;
1205
1206 PlaceActor(actor, "EDG01_27", 2, 0.5f, 0, 0.5f);
1207
1208 ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim0");
1209 assert(ap);
1210 ap->FUN_1006d680(m_unk0x1138, 0.0f);
1211
1212 ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim2");
1213 assert(ap);
1214 ap->FUN_1006d680(m_unk0x1138, 6.0f);
1215
1216 ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim3");
1217 assert(ap);
1218 ap->FUN_1006d680(m_unk0x1138, 3.0f);
1219
1220 ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "BrShoot");
1221 assert(ap);
1222 ap->FUN_1006d680(m_unk0x1138, -1.0f);
1223
1224 actor->SetWorldSpeed(0.0f);
1225 m_unk0x1138->FUN_10018980();
1226 return SUCCESS;
1227}
void FUN_10018980()
[AI] Searches animation maps for a "shoot" animation, and prepares the mission audio effect.
Definition: act2actor.cpp:145
void FUN_10019520()
[AI] Triggers major mission state transition: switches to "escape" mode and moves to special location...
Definition: act2actor.cpp:433
void FUN_10019560()
[AI] Triggers mission state transition: switches to "destroyed" mode and moves to special location 9.
Definition: act2actor.cpp:441
[AI] Represents a special 'brick' object in the LEGO Island "Act 2" sequence, derived from LegoPathAc...
Definition: act2brick.h:12
MxResult Create(MxS32 p_index)
[AI] Instantiates and initializes the brick actor in the world with a specified index/type,...
Definition: act2brick.cpp:45
void FUN_1007a670(MxMatrix &p_param1, MxMatrix &p_param2, LegoPathBoundary *p_boundary)
[AI] Starts the brick motion and animation parameters, registers the object for tickling and places t...
Definition: act2brick.cpp:96
void PlayWhistleSound()
[AI] Begins playback of the looping whistle sound associated with this brick, if not already playing.
Definition: act2brick.cpp:179
void StopWhistleSound()
[AI] Stops the playback of the whistle sound if it is currently playing.
Definition: act2brick.cpp:188
void Mute(MxBool p_muted)
[AI] Mutes or unmutes the whistle sound according to the argument given.
Definition: act2brick.cpp:197
void Remove()
[AI] Removes this brick from the world, releases associated resources, and notifies the character man...
Definition: act2brick.cpp:81
[AI] Represents a bounding sphere in 3D space with center and radius.
Definition: roi.h:56
const float & Radius() const
[AI] Const accessor for the sphere radius.
Definition: roi.h:72
Derived path actor type for handling player transitions and activities on LEGO Island.
Definition: islepathactor.h:23
@ c_spawnBit1
[AI] Bit flag to trigger additional camera/animation sequence during spawn. [AI]
Definition: islepathactor.h:30
@ c_playMusic
[AI] Bit flag to trigger background music playback on spawn. [AI]
Definition: islepathactor.h:31
@ c_spawnBit3
[AI] Unused/reserved extra spawn bit in flag set. [AI]
Definition: islepathactor.h:32
virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags)
[AI] Spawns the player in a specific area/location, potentially triggering music and animation.
int SetFrustrum(float p_fov, float p_front, float p_back)
[AI] Sets the 3D perspective frustum parameters for camera and view.
Represents the state object for Act 2 of the game.
Definition: legoact2.h:25
undefined4 m_unk0x08
[AI] Unknown state variable. Purpose unclear. [AI]
Definition: legoact2.h:82
MxBool m_enabled
[AI] TRUE if this state is currently enabled/active. [AI]
Definition: legoact2.h:83
void SetUnknown0x08(undefined4 p_unk0x08)
Sets the unknown value (purpose unclear).
Definition: legoact2.h:72
Implements the world and game logic for Act 2.
Definition: legoact2.h:98
MxLong Notify(MxParam &p_param) override
Handles incoming notifications dispatched by the notification system.
Definition: legoact2.cpp:268
MxBool Escape() override
Handles the Escape (quit/abort) action, stops audio/cutscene/cleans up state.
Definition: legoact2.cpp:753
MxResult Create(MxDSAction &p_dsAction) override
Creates and initializes this world object using a DSAction.
Definition: legoact2.cpp:114
void FUN_100517b0()
Spawns the next brick and triggers sound/whistle for the new brick.
Definition: legoact2.cpp:682
~LegoAct2() override
Destructor.
Definition: legoact2.cpp:97
LegoAct2()
Constructor, initializes all members and registers to the notification manager.
Definition: legoact2.cpp:75
MxResult FUN_10052560(Act2mainScript::Script p_objectId, MxBool p_param2, MxBool p_param3, Mx3DPointFloat *p_location, Mx3DPointFloat *p_direction, Mx3DPointFloat *p_param6)
Plays an animation (or cutscene) at optional location/direction in world space.
Definition: legoact2.cpp:1091
MxResult BadEnding()
Handles the "bad ending" sequence for Act 2.
Definition: legoact2.cpp:927
MxResult Tickle() override
Main update tick for Act 2.
Definition: legoact2.cpp:160
void Enable(MxBool p_enable) override
Enables or disables the Act 2 world and logic.
Definition: legoact2.cpp:523
MxResult FUN_100516b0()
Spawns the next collectible brick at its position and plays associated animation if possible.
Definition: legoact2.cpp:658
void VTable0x60() override
Unused; placeholder for possible extension.
Definition: legoact2.cpp:747
void ReadyWorld() override
Prepares the world for player interaction, resumes animation, registers tickle, etc.
Definition: legoact2.cpp:477
@ c_pepper
Pepper Roni ([AI])
Definition: legoactor.h:17
void FUN_10060540(MxBool p_unk0x29)
[AI] Sets the 'enabled for random camera animation' flag for all animations.
void FUN_10060480(const LegoChar *p_characterNames[], MxU32 p_numCharacterNames)
[AI] Marks characters in the global character list (g_characters) as available for animation accordin...
MxResult FUN_10060dc0(MxU32 p_objectId, MxMatrix *p_matrix, MxBool p_param3, MxU8 p_param4, LegoROI *p_roi, MxBool p_param6, MxBool p_param7, MxBool p_param8, MxBool p_param9)
[AI] Helper for starting a specific animation, including world matrix and camera settings.
void FUN_10061010(MxBool p_und)
[AI] Cancels all camera/transition animations and resets camera after completion.
@ e_unk0
[AI] Unknown/unspecified play mode
void FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds)
[AI] Enables/disables certain animations by object id list (sets m_unk0x29 flag in AnimInfo).
void Resume()
[AI] Resumes animation manager from suspension, restoring all previously suspended state.
void FUN_100604d0(MxBool p_unk0x08)
[AI] Sets the m_unk0x08 flag for all characters.
void EnableCamAnims(MxBool p_enableCamAnims)
[AI] Sets whether camera-based queued animations are enabled for the world.
void Suspend()
[AI] Suspends all activity, saving out transition/animation state, and disables extra processing.
void FUN_1005f6d0(MxBool p_unk0x400)
[AI] Enables or disables extras (extra actors).
LegoCacheSound * Play(const char *p_key, const char *p_name, MxBool p_looping)
[AI] Plays a sound identified by key, with the given playback name and looping flag.
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
virtual void SetWorldSpeed(MxFloat p_worldSpeed)
[AI] Sets the current world speed value for this entity (used to control motion/animation rate).
Definition: legoentity.h:98
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
Comprehensive persistent game state manager: handles save/load, player selection, area switching,...
Definition: legogamestate.h:78
void SwitchArea(Area p_area)
Switches the whole game state into a new area/world; manages transitions/scene loads.
void SetCurrentAct(Act p_currentAct)
Sets the current game act.
Area m_currentArea
Area/world the player is presently in. [AI].
MxBool m_isDirty
TRUE if unsaved changes present. [AI].
LegoState * CreateState(const char *p_stateName)
Creates an instance of given state, registers it, and returns pointer.
@ e_act3
Act 3: final main story segment. [AI].
Definition: legogamestate.h:86
@ e_act1
Act 1: the first main segment of the game. [AI].
Definition: legogamestate.h:84
@ e_actNotFound
No act currently loaded (does not correspond to valid play). [AI].
Definition: legogamestate.h:83
@ e_act2
Act 2: main story segment two. [AI].
Definition: legogamestate.h:85
void StopArea(Area p_area)
Calls cleanup logic for the specified area (removes actors, VMs, closes handles, etc....
void FindLoadedAct()
Analyses the loaded Lego worlds to determine which act is present. [AI].
LegoState * GetState(const char *p_stateName)
Find an existing state (LegoState-derived) object by its registered script/class name.
@ e_infomain
Information Center, main screen. [AI].
Definition: legogamestate.h:96
@ e_unk50
Unknown [AI].
@ e_act3script
Act 3 world/script main. [AI].
@ e_act2main
Act 2 world main screen. [AI].
@ e_copterbuild
Vehicle construction: helicopter. [AI].
@ e_isle
Open world (LEGO Island main map). [AI].
Definition: legogamestate.h:95
@ e_undefined
Undefined or unset area. [AI].
Definition: legogamestate.h:93
Area GetPreviousArea()
Gets the last area before the current one. [AI].
Act GetLoadedAct()
Returns the act that is currently loaded in memory. [AI].
void SetActor(MxU8 p_actorId)
Change the player character in the world to the given actor ID.
void SetDirty(MxBool p_isDirty)
Sets whether there are unsaved changes to the state.
void UnRegister(MxCore *)
[AI] Unregister a previously registered recipient so it will no longer receive input notifications.
void Register(MxCore *)
[AI] Register a core object as a recipient for keyboard events; safe for concurrent multi-threading.
[AI] Specialized presenter class for handling locomotion animation playback and state in the LEGO Isl...
void FUN_1006d680(LegoAnimActor *p_actor, MxFloat p_value)
[AI] Binds a LegoAnimActor to the internal animation context and ROI mapping.
@ c_clearScreen
[AI] When set, clears the display surface. [AI]
Definition: legomain.h:49
@ c_disable3d
[AI] When set, disables 3D rendering. [AI]
Definition: legomain.h:48
@ c_disableInput
[AI] When set, disables input processing. [AI]
Definition: legomain.h:47
@ e_act2
[AI] Act 2. [AI]
Definition: legomain.h:74
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
@ c_initial
[AI] Default state upon creation or reset. [AI]
Definition: legopathactor.h:37
@ c_disabled
[AI] Marks as disabled or inactive for path follow logic. [AI]
Definition: legopathactor.h:41
LegoPathBoundary * GetBoundary()
[AI] Retrieves the current path boundary associated with this actor.
void SetActorState(MxU32 p_actorState)
[AI] Sets the navigation/path state of the actor.
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
[AI] Specialized notification parameter used for path structure related events in LEGO Island.
MxS16 GetData()
[AI] Retrieves the supplemental data associated with the notification.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
void SetBoundingSphere(const BoundingSphere &p_sphere)
[AI] Sets the local and world bounding spheres.
Definition: legoroi.h:317
BoundingSphere & GetBoundingSphere()
[AI] Accesses the local bounding sphere object.
Definition: legoroi.h:299
LegoEntity * GetEntity()
[AI] Gets the entity associated with this ROI (or NULL).
Definition: legoroi.h:293
LegoCacheSoundManager * GetCacheSoundManager()
[AI] Returns the cache sound manager used to cache and reuse sound effects.
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
void Remove(MxCore *p_object)
Removes an object from all relevant world-managed lists or sets, and also detaches if needed.
Definition: legoworld.cpp:508
virtual void ReadyWorld()
Called when the world is ready to be used—typically for custom scene setup after startup.
Definition: legoworld.cpp:874
MxResult PlaceActor(LegoPathActor *p_actor, const char *p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, float p_destScale)
Places an actor along a path, from source to destination, using named references and scaling.
Definition: legoworld.cpp:267
MxCoreSet m_set0xd0
Set of currently paused/disconnected objects when world is disabled.
Definition: legoworld.h:363
virtual void Enable(MxBool p_enable)
Enables or disables (pauses) the world and its main components.
Definition: legoworld.cpp:684
MxResult Tickle() override
Main world tick/update, especially manages startup countdown.
Definition: legoworld.cpp:810
MxBool m_worldStarted
Indicates if the world has successfully started and is considered active.
Definition: legoworld.h:388
MxCore * Find(const char *p_class, const char *p_name)
Finds an object of a given class and name in the world.
Definition: legoworld.cpp:573
MxLong Notify(MxParam &p_param) override
Notification callback responding to registered events such as EndAction and NewPresenter.
Definition: legoworld.cpp:212
void RemoveActor(LegoPathActor *p_actor)
Removes an actor from all known path controllers.
Definition: legoworld.cpp:325
MxResult Create(MxDSAction &p_dsAction) override
Initializes the world using an action, creating entity and sound lists, and camera controller.
Definition: legoworld.cpp:58
virtual void SetIdentity()
Sets this matrix to identity (diagonal 1, others 0).
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
MxDSAction * GetAction()
[AI] Direct access to the underlying action.
MxResult PlayMusic(MxDSAction &p_action, undefined4 p_speed, MxPresenter::TickleState p_tickleState)
[AI] Initiates playback of a new background music action with specified speed and target tickle state...
void Stop()
[AI] Immediately stops all background music, clears all actions and presenters, and resets tickle sta...
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
void SetLocation(const Vector3 &p_location)
[AI] Sets the location vector for this action.
Definition: mxdsaction.h:231
void SetDirection(const Vector3 &p_direction)
[AI] Sets the direction vector for this action.
Definition: mxdsaction.h:237
void SetUp(const Vector3 &p_up)
[AI] Sets the up vector for this action.
Definition: mxdsaction.h:243
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
Definition: mxdsobject.h:118
void SetUnknown24(MxS16 p_unk0x24)
[AI] Sets the unknown field at 0x24 (possibly version/state).
Definition: mxdsobject.h:151
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
Definition: mxdsobject.h:147
MxU32 GetObjectId()
[AI] Returns the object id numeric value.
Definition: mxdsobject.h:130
[AI] Notification parameter marking the end of an action, specialization of MxActionNotificationParam...
MxAtomId m_atomId
The AtomId associated with this entity, used for resource and script identification.
Definition: mxentity.h:124
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
void Unregister(MxCore *p_listener)
[AI] Removes a previously registered listener and flushes any pending notifications for it.
void Register(MxCore *p_listener)
[AI] Registers a listener object to receive notifications.
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
NotificationId GetNotification() const
[AI] Retrieves the current notification type of this parameter.
MxCore * GetSender() const
[AI] Retrieves the sender pointer associated with this notification.
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
@ e_repeating
[AI] Presentation is repeating (e.g., looping media).
Definition: mxpresenter.h:28
virtual void UnregisterClient(MxCore *p_client)
[AI] Unregisters (marks for destruction) a previously registered client.
virtual void RegisterClient(MxCore *p_client, MxTime p_interval)
[AI] Registers an MxCore object to receive periodic tickles.
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_doCopy, MxBool p_playMusicInAnim)
[AI] Begins a new transition animation of type p_animationType at the specified speed,...
@ e_mosaic
[AI] Complex mosaic block-out effect.
const char * GetVariable(const char *p_key)
Returns the value for the variable with a given key, or an empty string if not found.
void SetVariable(const char *p_key, const char *p_value)
Sets a variable by key and value, replacing or updating if it exists.
const float * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
virtual void VTable0x14()
[AI] Calls VTable0x1c().
Definition: orientableroi.h:64
void FUN_100a58f0(const Matrix4 &p_transform)
Assigns the given matrix as the local-to-world transformation and enables some internal flags.
unsigned char GetVisibility()
[AI] Returns the visibility flag; true if visible, false if hidden.
Definition: roi.h:228
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
Definition: roi.h:235
virtual int Unitize()
[AI] Scales the vector so its norm is 1 (unit vector).
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
virtual void EqualsCross(const Vector3 &p_a, const Vector3 &p_b)
[AI] Sets this vector to be the cross product of p_a and p_b.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define sizeOfArray(arr)
Definition: decomp.h:23
const LegoChar * g_unk0x100f4410[]
Definition: legoact2.cpp:52
MxS32 g_unk0x100f4428[]
Definition: legoact2.cpp:55
Act2mainScript::Script g_unk0x100f4474
Definition: legoact2.cpp:36
MxS32 g_unk0x100f43f0[]
Definition: legoact2.cpp:40
const LegoChar * g_unk0x100f4458[]
Definition: legoact2.cpp:71
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
char LegoChar
[AI] Alias for char, for use in character/byte data and string handling.
Definition: legotypes.h:83
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
void SetAppCursor(Cursor p_cursor)
[AI] Sets the in-game cursor to a specified type.
Definition: legoutils.cpp:566
@ e_cursorArrow
[AI] Standard arrow cursor. [AI]
Definition: legoutils.h:23
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
Definition: misc.cpp:61
MxResult StartActionIfUnknown0x13c(MxDSAction &p_dsAction)
[AI] Triggers a DSAction if a certain unknown flag (0x13c) is set.
Definition: misc.cpp:175
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
Definition: misc.cpp:29
LegoAnimationManager * AnimationManager()
[AI] Accessor for the animation manager, which controls Lego character/world animation state....
Definition: misc.cpp:69
void DeleteObjects(MxAtomId *p_id, MxS32 p_first, MxS32 p_last)
[AI] Batch deletes objects, given by atom id, and within the entity id range [p_first,...
Definition: misc.cpp:237
LegoSoundManager * SoundManager()
[AI] Accessor for the game's LegoSoundManager subsystem from the global LegoOmni instance....
Definition: misc.cpp:22
MxTransitionManager * TransitionManager()
[AI] Accessor for the MxTransitionManager, handling level transitions, fades, and world changes....
Definition: misc.cpp:208
MxBackgroundAudioManager * BackgroundAudioManager()
[AI] Accessor for the background audio manager. Used for background music and ambient sounds....
Definition: misc.cpp:37
void FUN_10015820(MxBool p_disable, MxU16 p_flags)
[AI] Utility for enabling or disabling functionality in LegoOmni based on certain flags.
Definition: misc.cpp:143
LegoOmni * Lego()
[AI] Retrieves the global LegoOmni singleton instance, providing access to core subsystems.
Definition: misc.cpp:16
LegoPathActor * UserActor()
[AI] Accessor for the user (player-controllable) LegoPathActor. [AI]
Definition: misc.cpp:85
LegoInputManager * InputManager()
[AI] Accessor for the input manager, which handles keyboard, mouse, and controller input....
Definition: misc.cpp:45
LegoROI * FindROI(const char *p_name)
[AI] Looks up a LegoROI (Real-time Object Instance) by name in the current world or global registry.
Definition: misc.cpp:151
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
Definition: mxdebug.h:55
MxVariableTable * VariableTable()
[AI] Returns the variable table used for script variables and global key/value state.
Definition: mxmisc.cpp:73
void DeleteObject(MxDSAction &p_dsAction)
[AI] Deletes the specified action object, removing it from the global action list.
Definition: mxmisc.cpp:105
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
MxTickleManager * TickleManager()
[AI] Provides access to the global tickle manager.
Definition: mxmisc.cpp:25
@ c_notificationType22
[AI] Unspecified notification type [AI]
@ c_notificationTransitioned
[AI] Object has transitioned states or locations [AI]
@ c_notificationEndAction
[AI] Indicates the end of an action [AI]
@ c_notificationPathStruct
[AI] Data related to a path structure [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
signed short MxS16
[AI]
Definition: mxtypes.h:26
float MxFloat
[AI]
Definition: mxtypes.h:68
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
Script
[AI] Identifiers for scripts, actions, entities, and resources for Act2Main.
@ c_BrickstrChase
[AI] Music for the Brickster Chase sequence.
@ c_BrickHunt
[AI] Music for Brick Hunt mission.
@ c_Jail_Music
[AI] Background music for the jail area.
@ c_MusicTheme1
[AI] Main theme music, variant 1.
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_jukeboxScript
[AI] Script AtomId for the Jukebox entity/event script.
Definition: scripts.cpp:70
#define SET3(to, from)
Definition: vec.h:310
#define DISTSQRD3(v, w)
Definition: vec.h:478