Isle
Loading...
Searching...
No Matches
act2actor.cpp
Go to the documentation of this file.
1#include "act2actor.h"
2
4#include "act2main_actions.h"
5#include "anim/legoanim.h"
6#include "legoact2.h"
11#include "legoplantmanager.h"
12#include "legoplants.h"
13#include "legosoundmanager.h"
14#include "legovideomanager.h"
15#include "legoworld.h"
16#include "misc.h"
17#include "mxdebug.h"
18#include "roi/legoroi.h"
20
21#include <vec.h>
22
24DECOMP_SIZE_ASSERT(Act2Actor::Location, 0x20)
25
26// GLOBAL: LEGO1 0x100f0db8
27// GLOBAL: BETA10 0x101dbd00
29 {{-47.92, 7.0699968, -31.58}, {-0.999664, 0.0, -0.025916}, "edg01_27", FALSE},
30 {{-70.393349, 8.07, 3.151935}, {-0.90653503, 0.0, 0.422131}, "int06", FALSE},
31 {{-47.74, 4.079995, -52.3}, {-0.98293, 0.0, -0.18398}, "edg01_08", FALSE},
32 {{-26.273487, 0.069, 12.170015}, {0.987199, 0.0, -0.159491}, "INT14", FALSE},
33 {{26.16499, 0.069, 5.61}, {0.027719, 0.0, 0.999616}, "INT22", FALSE},
34 {{66.383446, 4.07, 32.387417}, {0.979487, 0.0, -0.201506}, "edg02_27", FALSE},
35 {{71.843285, 0.069, -49.524852}, {0.99031502, 0.0, 0.13884}, "edg02_39", FALSE},
36 {{26.470566, 0.069, -44.670845}, {0.004602, 0.0, -0.99998897}, "int26", FALSE},
37 {{-6.323625, 0.069, -47.96045}, {-0.982068, 0.0, 0.188529}, "edg02_53", FALSE},
38 {{-36.689, -0.978409, 31.449}, {0.083792, -0.94303, -0.66398698}, "edg00_157", FALSE},
39 {{-44.6, 0.1, 45.3}, {0.95, 0.0, -0.3}, "edg00_154", FALSE},
40};
41
42// GLOBAL: LEGO1 0x100f0f1c
44
45// GLOBAL: LEGO1 0x100f0f20
46// GLOBAL: BETA10 0x101dbe40
48
49// GLOBAL: LEGO1 0x100f0f24
51
52// GLOBAL: LEGO1 0x100f0f28
53// GLOBAL: BETA10 0x101dbe44
55
56// --- All of these are indices into g_plantInfo (0x10103180) ---
57
58// GLOBAL: LEGO1 0x100f0f30
59// GLOBAL: BETA10 0x101dbe48
60MxS32 g_unk0x100f0f30[] = {2, 23, 32, 66, 71, 72, 73, -1};
61
62// GLOBAL: LEGO1 0x100f0f50
63// GLOBAL: BETA10 0x101dbe68
64MxS32 g_unk0x100f0f50[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
65
66// GLOBAL: LEGO1 0x100f0f90
67// GLOBAL: BETA10 0x101dbea8
68MxS32 g_unk0x100f0f90[] = {12, 19, 24, 48, 60, -1};
69
70// GLOBAL: LEGO1 0x100f0fa8
71// GLOBAL: BETA10 0x101dbec0
72MxS32 g_unk0x100f0fa8[] = {8, 15, 46, -1};
73
74// GLOBAL: LEGO1 0x100f0fb8
75// GLOBAL: BETA10 0x101dbed0
76MxS32 g_unk0x100f0fb8[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
77
78// GLOBAL: LEGO1 0x100f0fe8
79// GLOBAL: BETA10 0x101dbf00
80MxS32 g_unk0x100f0fe8[] = {3, 40, 53, 55, -1};
81
82// GLOBAL: LEGO1 0x100f1000
83// GLOBAL: BETA10 0x101dbf18
84MxS32 g_unk0x100f1000[] = {22, 33, 41, 45, 67, -1};
85
86// GLOBAL: LEGO1 0x100f1018
87// GLOBAL: BETA10 0x101dbf30
88MxS32 g_unk0x100f1018[] = {13, 30, 31, 62, -1};
89
90// GLOBAL: LEGO1 0x100f1030
91// GLOBAL: BETA10 0x101dbf48
92MxS32 g_unk0x100f1030[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
93
94// --- End of indices into g_plantInfo ---
95
96// GLOBAL: LEGO1 0x10102b1c
97// GLOBAL: BETA10 0x10209f60
99
100// GLOBAL: LEGO1 0x10102b20
101// GLOBAL: BETA10 0x10209f64
103
104// GLOBAL: LEGO1 0x10102b24
105// GLOBAL: BETA10 0x10209f68
107
108// FUNCTION: LEGO1 0x100187e0
109// FUNCTION: BETA10 0x1000c7fb
111{
112 m_unk0x1c = 0;
113 m_unk0x1d = 0;
114 m_unk0x1f = FALSE;
115 m_unk0x24 = 0;
116 m_unk0x20 = 0;
117 m_unk0x1e = 0;
118 m_unk0x28 = 4;
119 m_unk0x2c = 0;
120 m_unk0x30 = 0;
121 m_shootAnim = NULL;
122 m_unk0x44 = 0;
123 m_unk0x40 = 1;
124 m_unk0x48 = 0;
125 m_unk0x4c = NULL;
126 m_unk0x38 = NULL;
127 m_unk0x3c = 0;
128
129 // Odd: The code says < 10, but there are 11 entries in the array
130 for (MxS32 i = 0; i < 10; i++) {
132 }
133}
134
135// FUNCTION: LEGO1 0x10018940
136// FUNCTION: BETA10 0x1003d65f
137void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
138{
139 LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2);
141}
142
143// FUNCTION: LEGO1 0x10018980
144// FUNCTION: BETA10 0x1000c963
146{
147 for (MxS32 i = 0; i < m_animMaps.size(); i++) {
148 if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
149 m_shootAnim = m_animMaps[i];
150 }
151 }
152
153 assert(m_shootAnim);
154
155 m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow");
156#ifdef BETA10
157 // actually 0x2c and 0x30
158 m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
159 m_unk0x38->SetDistance(35, 60);
160 m_unk0x38->SetDistance(35, 60);
161#else
162 m_unk0x38->SetDistance(45, 55);
164#endif
165}
166
167// FUNCTION: LEGO1 0x100189f0
168// FUNCTION: BETA10 0x1000ca64
170{
171 if (m_unk0x1f == FALSE) {
172 m_unk0x1f = TRUE;
173 m_unk0x20 = 0;
174 }
175
176 SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE);
177 return SUCCESS;
178}
179
180// FUNCTION: LEGO1 0x10018a20
182{
183 if (m_grec && !m_grec->GetBit1()) {
184 delete m_grec;
185 m_grec = NULL;
186 return SUCCESS;
187 }
188 else {
189 if (m_unk0x1f) {
190 MxMatrix matrix = m_roi->GetLocal2World();
191 matrix[3][1] -= 3.0f;
193
194 LegoROI* brickstrROI = FindROI("brickstr");
195 MxMatrix brickstrMatrix = brickstrROI->GetLocal2World();
196 brickstrMatrix[3][1] -= 3.0f;
197 brickstrROI->UpdateTransformationRelativeToParent(brickstrMatrix);
198 }
199
201 }
202}
203
204// FUNCTION: LEGO1 0x10018c30
205// FUNCTION: BETA10 0x1000cb52
206void Act2Actor::Animate(float p_time)
207{
208 int dummy1; // for BETA10, not sure what it is being used for
209
210#ifndef BETA10
211 MxFloat local48float = 0.0f;
212 if (g_unk0x100f0f1c != 0.0f) {
213 local48float = p_time - g_unk0x100f0f1c;
214 }
215
216 g_unk0x100f0f1c = p_time;
217#endif
218
220
221 if (m_unk0x44 != 0.0f && m_unk0x44 < p_time) {
222 SetWorldSpeed(m_unk0x28);
223 }
224
225 if (m_unk0x1f) {
226 if (m_unk0x20 > 600.0f) {
227 m_unk0x1f = FALSE;
228 m_unk0x20 = 0;
229 }
230 else {
231#ifndef BETA10
232 m_unk0x20 += local48float;
233#endif
234 MxMatrix matrix = m_roi->GetLocal2World();
235 matrix[3][1] += 3.0f;
237
238#ifndef BETA10
239 LegoROI* brickstrROI = FindROI("brickstr");
240 MxMatrix brickstrMatrix = brickstrROI->GetLocal2World();
241 brickstrMatrix[3][1] += 3.0f;
242 brickstrROI->UpdateTransformationRelativeToParent(brickstrMatrix);
243#endif
244 return;
245 }
246 }
247
248 if (!m_grec) {
249 if (m_unk0x1e == 2) {
250 m_unk0x1e = 0;
251 m_unk0x2c = m_shootAnim->GetDuration() + p_time;
252 m_unk0x30 = m_unk0x2c - 1300.0f;
253 SetWorldSpeed(0);
254 m_unk0x1c = FALSE;
255 }
256 else if (m_unk0x1e == 1) {
257 FindROI("pwrbrik")->SetVisibility(FALSE);
258 FindROI("debrick")->SetVisibility(FALSE);
259 FindROI("ray")->SetVisibility(FALSE);
260 m_unk0x4c = NULL;
261 m_unk0x1e = 2;
262 VTable0xa0();
263 FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f);
264 }
265 else if (m_unk0x1e == 0) {
266 if (m_unk0x40) {
267 m_unk0x40 = 0;
268 m_unk0x2c = m_shootAnim->GetDuration() + p_time;
269 m_unk0x30 = m_unk0x2c - 1300.0f;
270 }
271
272 if (FUN_10019700(p_time) == TRUE) {
273 return;
274 }
275 }
276 else if (m_unk0x1e == 5) {
277 FindROI("brickstr")->SetVisibility(FALSE);
279 CurrentWorld()->RemoveActor(this);
280 return;
281 }
282#ifndef BETA10
283 else if (m_unk0x1e == 4) {
284 if (m_worldSpeed == 0.0f) {
285 return;
286 }
287
288 SetWorldSpeed(0.0f);
289 ((LegoAct2*) CurrentWorld())->FUN_100517b0();
290 return;
291 }
292#endif
293 }
294
295 if (m_unk0x1e == 5 || m_unk0x1e == 4) {
296 return;
297 }
298
299 if (m_unk0x1e == 3) {
300 if (p_time - m_unk0x24 > 600.0f) {
301 m_unk0x1e = 2;
302 FUN_10019250(m_unk0x28 + 4, p_time + 15000.0f);
303 }
304 }
305 else {
306 LegoROI* roiPepper = FindROI("pepper");
307
308 if (roiPepper) {
310 assert(vm);
311
313
314 if (inFrustum) {
315 Mx3DPointFloat local18(roiPepper->GetWorldDirection());
317 Mx3DPointFloat local60(roiPepper->GetWorldPosition());
318 local30 -= local60;
319 local30.Unitize();
320
321 MxFloat dotproduct = local18.Dot(local30, local18);
322
323 if (dotproduct >= 0.0) {
324 const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition();
325 const MxFloat* worldPosition = m_roi->GetWorldPosition();
326
327 MxFloat distance1 = DISTSQRD3(pepperWorldPosition, worldPosition);
328
329 if (distance1 < 75.0f) {
330 if (!m_unk0x1c) {
331 m_unk0x1c = 1;
332
333 if (!m_unk0x1e) {
334 FUN_100199f0(2);
335 m_unk0x1e = 1;
336 }
337 else {
338 LegoROI* childROI = m_roi->FindChildROI("windsd", m_roi);
339 const MxFloat* childPosition = childROI->GetWorldPosition();
340 MxFloat distance2 = DISTSQRD3(pepperWorldPosition, childPosition);
341
342 childROI = m_roi->FindChildROI("reardr", m_roi);
343 childPosition = childROI->GetWorldPosition();
344 MxFloat distance3 = DISTSQRD3(pepperWorldPosition, childPosition);
345
346 if (distance3 > distance2) {
347 FUN_100199f0(0);
348 }
349 else
350#ifndef BETA10
351 if (p_time - m_unk0x24 > 3000.0f) {
352#endif
353 SetWorldSpeed(m_unk0x28 - 1);
354 m_unk0x1e = 3;
355 m_unk0x24 = p_time;
356
357 if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) {
358 FUN_100199f0(1);
359 }
360#ifndef BETA10
361 }
362#endif
363 }
364 }
365 }
366 else {
367 if (m_unk0x1c) {
368 m_unk0x1c = 0;
369 }
370 }
371 }
372 }
373 }
374 }
375}
376
377// FUNCTION: LEGO1 0x10019250
378// FUNCTION: BETA10 0x1000d45c
380{
381 // The arguments have been changed from BETA10 to LEGO1
382 SetWorldSpeed(p_speed);
383 m_unk0x44 = p_param2;
384}
385
386// FUNCTION: LEGO1 0x10019280
387// FUNCTION: BETA10 0x1000d4a6
389{
390 LegoAnimActor::SetWorldSpeed(p_worldSpeed);
391 m_unk0x44 = 0;
392}
393
394// FUNCTION: LEGO1 0x100192a0
395// FUNCTION: BETA10 0x1000d4d6
397{
398 Mx3DPointFloat newPosition(0.0, 0.0, 0.0);
399 Mx3DPointFloat newDirection(0.0, 0.0, 0.0);
400
401 if (m_grec) {
402 delete m_grec;
403 }
404
406 assert(m_grec);
407
408 newPosition = g_brickstrLocations[p_location].m_position;
409 newDirection = g_brickstrLocations[p_location].m_direction;
411
413 m_grec,
417 newPosition,
418 newDirection,
419 newBoundary,
421 NULL
422 );
423
424 assert(!sts); // == SUCCESS
425
426 if (sts != SUCCESS) {
427 delete m_grec;
428 m_grec = NULL;
429 }
430}
431
432// FUNCTION: LEGO1 0x10019520
434{
435 m_unk0x1e = 4;
436 SetWorldSpeed(m_unk0x28 + 3);
437 FUN_100192a0(10);
438}
439
440// FUNCTION: LEGO1 0x10019560
442{
443 m_unk0x1e = 5;
444 SetWorldSpeed(m_unk0x28 + 5);
445 FUN_100192a0(9);
446}
447
448// FUNCTION: LEGO1 0x100195a0
449// FUNCTION: BETA10 0x1000d7d3
451{
452 undefined4 newLocation;
453
454 assert(!m_grec);
455
456 CurrentWorld();
457 MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
458
459 if (m_unk0x48 == 8 && m_unk0x1d != 8) {
460 newLocation = 8;
461 }
462 else {
463 switch (m_unk0x1d) {
464 case 0:
465 if (randomVal == 1) {
466 newLocation = 3;
467 }
468 else {
469 newLocation = 7;
470 }
471 break;
472 case 1:
473 if (randomVal == 1) {
474 newLocation = 2;
475 }
476 else {
477 newLocation = 4;
478 }
479 break;
480 case 2:
481 if (randomVal == 1) {
482 newLocation = 3;
483 }
484 else {
485 newLocation = 6;
486 }
487 break;
488 case 3:
489 if (randomVal == 1) {
490 newLocation = 5;
491 }
492 else {
493 newLocation = 1;
494 }
495 break;
496 case 4:
497 if (randomVal == 1) {
498 newLocation = 7;
499 }
500 else {
501 newLocation = 0;
502 }
503 break;
504 case 5:
505 if (randomVal == 1) {
506 newLocation = 6;
507 }
508 else {
509 newLocation = 1;
510 }
511 break;
512 case 6:
513 if (randomVal == 1) {
514 newLocation = 0;
515 }
516 else {
517 newLocation = 4;
518 }
519 break;
520 case 7:
521 if (randomVal == 1) {
522 newLocation = 2;
523 }
524 else {
525 newLocation = 5;
526 }
527 break;
528 case 8:
529 if (randomVal == 1) {
530 newLocation = 0;
531 }
532 else {
533 newLocation = 4;
534 }
535 }
536 }
537
538 undefined4 firstChoice = newLocation;
539
540 if (m_unk0x48 < 7 || g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
541 while (g_brickstrLocations[newLocation].m_unk0x1c || m_unk0x1d == newLocation) {
542 if (newLocation == 7) {
543 newLocation = 0;
544 }
545 else {
546 newLocation++;
547 }
548
549 assert(newLocation != firstChoice);
550 }
551 }
552
553 m_unk0x1d = newLocation;
554 FUN_100192a0(newLocation);
555
556 if (m_grec) {
557 return SUCCESS;
558 }
559 else {
560 return FAILURE;
561 }
562}
563
564// FUNCTION: LEGO1 0x10019700
565// FUNCTION: BETA10 0x1000dd27
567{
568 if (!m_unk0x4c) {
570 m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
573 }
574
575 if (!m_unk0x4c) {
576 MxTrace("nothing left to destroy at location %d\n", m_unk0x1d);
577 m_unk0x1e = 1;
578
579 if (m_unk0x1d == 8) {
580 ((LegoAct2*) CurrentWorld())->BadEnding();
581 }
582
583 return TRUE;
584 }
585
586 if (!g_unk0x100f0f28 && m_unk0x30 < p_param) {
588 assert(SoundManager()->GetCacheSoundManager());
589 SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE);
590
591 if (g_unk0x100f0f20) {
592 BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE);
593 }
594 else {
595 PlantManager()->ScheduleAnimation(m_unk0x4c, 800);
596 }
597 }
598
599 if (m_unk0x2c < p_param) {
601 m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
602 m_unk0x2c = m_shootAnim->GetDuration() + p_param;
603 m_unk0x30 = m_unk0x2c - 1300.0f;
606 return FALSE;
607 }
608
609 m_lastTime = p_param;
610 LegoROI* brickstrROI = FindROI("brickstr");
611
612 MxMatrix matrix = m_roi->GetLocal2World();
613 matrix[3][1] += 1.0f;
614 brickstrROI->FUN_100a58f0(matrix);
615 brickstrROI->VTable0x14();
616
617 Vector3 col0(matrix[0]);
618 Vector3 col1(matrix[1]);
619 Vector3 col2(matrix[2]);
620 Vector3 col3(matrix[3]);
621
622 col2 = col3;
623 col2 -= m_unk0x4c->GetROI()->GetWorldPosition();
624 col2.Unitize();
625 col0.EqualsCross(col1, col2);
626 col0.Unitize();
627 col1.EqualsCross(col2, col0);
628
629 assert(!m_cameraFlag);
630
631 LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
632 MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration());
633
634 for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
635 LegoROI::FUN_100a8e80(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap());
636 }
637
638 return FALSE;
639}
640
641// FUNCTION: LEGO1 0x100199f0
642// FUNCTION: BETA10 0x1000e11a
644{
645 switch (p_param) {
646 case 0:
647 switch (g_nextHeadWavIndex) {
648 case 0:
650 ->FUN_10052560(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
651
653 break;
654 default:
656 ->FUN_10052560(Act2mainScript::c_VOhead1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
658 break;
659 }
660 break;
661 case 1:
662 switch (g_nextBehindWavIndex) {
663 case 0:
665 ->FUN_10052560(Act2mainScript::c_VObehind0_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
667 break;
668 case 1:
670 ->FUN_10052560(Act2mainScript::c_VObehind1_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
672 break;
673 case 2:
675 ->FUN_10052560(Act2mainScript::c_VObehind2_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
677 break;
678 default:
680 ->FUN_10052560(Act2mainScript::c_VObehind3_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
682 break;
683 }
684 break;
685 case 2:
686 switch (g_nextInterruptWavIndex) {
687 case 0:
689 ->FUN_10052560(Act2mainScript::c_VOinterrupt0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
691 break;
692 case 1:
694 ->FUN_10052560(Act2mainScript::c_VOinterrupt1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
696 break;
697 case 2:
699 ->FUN_10052560(Act2mainScript::c_VOinterrupt2_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
701 break;
702 default:
704 ->FUN_10052560(Act2mainScript::c_VOinterrupt3_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
706 break;
707 }
708 }
709}
710
711// FUNCTION: LEGO1 0x10019b90
712// FUNCTION: BETA10 0x1000e374
714{
715 MxS32 i;
716 LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i);
717 LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i);
718 LegoEntity* result = 0;
719
720 switch (m_unk0x1d) {
721 case 0:
722 if (buildingInfo[12].m_unk0x11) {
723 result = buildingInfo[12].m_entity;
724 *p_param = TRUE;
725 }
726 else if (buildingInfo[14].m_unk0x11) {
727 result = buildingInfo[14].m_entity;
728 *p_param = TRUE;
729 }
730 else {
731 for (i = 0; g_unk0x100f0f30[i] != -1; i++) {
732 if (plantInfo[g_unk0x100f0f30[i]].m_unk0x16) {
733 result = plantInfo[g_unk0x100f0f30[i]].m_entity;
734 break;
735 }
736 }
737 }
738 break;
739 case 1:
740 if (buildingInfo[13].m_unk0x11) {
741 result = buildingInfo[13].m_entity;
742 *p_param = TRUE;
743 }
744 else {
745 for (i = 0; g_unk0x100f0f50[i] != -1; i++) {
746 if (plantInfo[g_unk0x100f0f50[i]].m_unk0x16) {
747 result = plantInfo[g_unk0x100f0f50[i]].m_entity;
748 break;
749 }
750 }
751 }
752 break;
753 case 2:
754 if (buildingInfo[9].m_unk0x11) {
755 result = buildingInfo[9].m_entity;
756 *p_param = TRUE;
757 }
758 else if (buildingInfo[11].m_unk0x11) {
759 result = buildingInfo[11].m_entity;
760 *p_param = TRUE;
761 }
762 else {
763 for (i = 0; g_unk0x100f0f90[i] != -1; i++) {
764 if (plantInfo[g_unk0x100f0f90[i]].m_unk0x16) {
765 result = plantInfo[g_unk0x100f0f90[i]].m_entity;
766 break;
767 }
768 }
769 }
770 break;
771 case 3:
772 if (buildingInfo[7].m_unk0x11) {
773 result = buildingInfo[7].m_entity;
774 *p_param = TRUE;
775 }
776 else if (buildingInfo[8].m_unk0x11) {
777 result = buildingInfo[8].m_entity;
778 *p_param = TRUE;
779 }
780 else if (buildingInfo[3].m_unk0x11) {
781 result = buildingInfo[3].m_entity;
782 *p_param = TRUE;
783 }
784 else {
785 for (i = 0; g_unk0x100f0fa8[i] != -1; i++) {
786 if (plantInfo[g_unk0x100f0fa8[i]].m_unk0x16) {
787 result = plantInfo[g_unk0x100f0fa8[i]].m_entity;
788 break;
789 }
790 }
791 }
792 break;
793 case 4:
794 if (buildingInfo[5].m_unk0x11) {
795 result = buildingInfo[5].m_entity;
796 *p_param = TRUE;
797 }
798 else if (buildingInfo[10].m_unk0x11) {
799 result = buildingInfo[10].m_entity;
800 *p_param = TRUE;
801 }
802 else {
803 for (i = 0; g_unk0x100f0fb8[i] != -1; i++) {
804 if (plantInfo[g_unk0x100f0fb8[i]].m_unk0x16) {
805 result = plantInfo[g_unk0x100f0fb8[i]].m_entity;
806 break;
807 }
808 }
809 }
810 break;
811 case 5:
812 if (buildingInfo[4].m_unk0x11) {
813 result = buildingInfo[4].m_entity;
814 *p_param = TRUE;
815 }
816 else {
817 for (i = 0; g_unk0x100f0fe8[i] != -1; i++) {
818 if (plantInfo[g_unk0x100f0fe8[i]].m_unk0x16) {
819 result = plantInfo[g_unk0x100f0fe8[i]].m_entity;
820 break;
821 }
822 }
823 }
824 break;
825 case 6:
826 if (buildingInfo[2].m_unk0x11) {
827 result = buildingInfo[2].m_entity;
828 *p_param = TRUE;
829 }
830 else {
831 for (i = 0; g_unk0x100f1000[i] != -1; i++) {
832 if (plantInfo[g_unk0x100f1000[i]].m_unk0x16) {
833 result = plantInfo[g_unk0x100f1000[i]].m_entity;
834 break;
835 }
836 }
837 }
838 break;
839 case 7:
840 if (buildingInfo[6].m_unk0x11) {
841 result = buildingInfo[6].m_entity;
842 *p_param = TRUE;
843 }
844 else {
845 for (i = 0; g_unk0x100f1018[i] != -1; i++) {
846 if (plantInfo[g_unk0x100f1018[i]].m_unk0x16) {
847 result = plantInfo[g_unk0x100f1018[i]].m_entity;
848 break;
849 }
850 }
851 }
852 break;
853 case 8:
854 for (i = 0; g_unk0x100f1030[i] != -1; i++) {
855 if (plantInfo[g_unk0x100f1030[i]].m_unk0x16) {
856 result = plantInfo[g_unk0x100f1030[i]].m_entity;
857 break;
858 }
859 }
860
861 if (result) {
862 return result;
863 }
864
865 if (buildingInfo[15].m_unk0x11) {
866 result = buildingInfo[15].m_entity;
867 *p_param = TRUE;
868 }
869 break;
870 }
871
872 if (!result && !g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
874 m_unk0x48++;
875 }
876
877 return result;
878}
MxFloat g_unk0x100f0f1c
Definition: act2actor.cpp:43
undefined4 g_nextInterruptWavIndex
Definition: act2actor.cpp:106
MxS32 g_unk0x100f1018[]
Definition: act2actor.cpp:88
MxBool g_unk0x100f0f28
Definition: act2actor.cpp:54
MxS32 g_unk0x100f0fe8[]
Definition: act2actor.cpp:80
MxS32 g_unk0x100f0f50[]
Definition: act2actor.cpp:64
MxS32 g_unk0x100f0fa8[]
Definition: act2actor.cpp:72
undefined4 g_nextHeadWavIndex
Definition: act2actor.cpp:98
MxS32 g_unk0x100f0f30[]
Definition: act2actor.cpp:60
MxBool g_unk0x100f0f20
Definition: act2actor.cpp:47
Act2Actor::Location g_brickstrLocations[]
Definition: act2actor.cpp:28
MxS32 g_unk0x100f0f90[]
Definition: act2actor.cpp:68
MxS32 g_unk0x100f1000[]
Definition: act2actor.cpp:84
undefined4 g_nextBehindWavIndex
Definition: act2actor.cpp:102
MxS32 g_unk0x100f0fb8[]
Definition: act2actor.cpp:76
MxS32 g_unk0x100f1030[]
Definition: act2actor.cpp:92
MxBool g_unk0x100f0f24
Definition: act2actor.cpp:50
[AI] Act2 mission-specific actor class, with custom state and animation handling for Act 2 of the sto...
Definition: act2actor.h:17
void FUN_10018980()
[AI] Searches animation maps for a "shoot" animation, and prepares the mission audio effect.
Definition: act2actor.cpp:145
void FUN_10019250(MxFloat p_speed, MxFloat p_param2)
[AI] Sets current speed and schedules a timed speed change for mission event purposes.
Definition: act2actor.cpp:379
void FUN_10019520()
[AI] Triggers major mission state transition: switches to "escape" mode and moves to special location...
Definition: act2actor.cpp:433
MxResult HitActor(LegoPathActor *, MxBool) override
[AI] Handles being "hit" by another actor—used to trigger mission state transitions,...
Definition: act2actor.cpp:169
Act2Actor()
[AI] Constructs an Act2Actor and initializes all mission-related state.
Definition: act2actor.cpp:110
MxU32 FUN_10019700(MxFloat p_param)
[AI] Handles main shoot animation event and plant/building destruction, manages associated SFX and mi...
Definition: act2actor.cpp:566
void FUN_100192a0(undefined4 p_location)
[AI] Relocates actor to a selected location by generating a path container for new destination.
Definition: act2actor.cpp:396
void SetWorldSpeed(MxFloat p_worldSpeed) override
[AI] Sets the "world speed" (movement, animation, or activity speed) for the actor and resets speed t...
Definition: act2actor.cpp:388
void FUN_10019560()
[AI] Triggers mission state transition: switches to "destroyed" mode and moves to special location 9.
Definition: act2actor.cpp:441
MxS32 VTable0xa0() override
[AI] Selects and moves the actor to a new random, valid mission location.
Definition: act2actor.cpp:450
MxResult VTable0x9c() override
[AI] Handles per-frame mission resolution, cleanup, or ending logic for the Act2Actor.
Definition: act2actor.cpp:181
void FUN_100199f0(MxS8 p_param)
[AI] Plays a specific voice-over cue depending on context and mission state.
Definition: act2actor.cpp:643
LegoEntity * FUN_10019b90(MxBool *p_param)
[AI] Searches for the next building or plant entity to destroy for mission progression at current loc...
Definition: act2actor.cpp:713
void SetROI(LegoROI *p_roi, MxBool p_bool1, MxBool p_bool2) override
[AI] Sets the ROI (rendered object instance) for this actor and disables its visibility immediately.
Definition: act2actor.cpp:137
void Animate(float p_time) override
[AI] Orchestrates all Act2-specific animation logic and state switching each tick.
Definition: act2actor.cpp:206
Lego3DView * GetLego3DView()
[AI] Returns the encapsulated Lego3DView instance.
ViewManager * GetViewManager()
[AI] Returns the ViewManager responsible for managing scene objects and transformations.
Definition: lego3dview.h:154
Implements the world and game logic for Act 2.
Definition: legoact2.h:98
void SetROI(LegoROI *p_roi, MxBool p_bool1, MxBool p_bool2) override
[AI] Sets the Region of Interest (ROI, i.e.
Definition: legoactor.cpp:125
void SetWorldSpeed(MxFloat p_worldSpeed) override
[AI] Sets the current world speed and chooses which animation (from the animation map list) should be...
vector< LegoAnimActorStruct * > m_animMaps
[AI] List of animation structures, each representing a valid animation for different speed/phase rang...
void Animate(float p_time) override
[AI] Performs per-frame update; applies the appropriate animation to mesh ROIs based on speed and sta...
LegoBuildingInfo * GetInfoArray(MxS32 &p_length)
[AI] Returns the full set of LegoBuildingInfo entries, checks/initializes boundary data if needed.
void ScheduleAnimation(LegoEntity *p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28)
[AI] Schedules an animation bounce/effect for a given building entity (updates AnimEntry tracking and...
LegoCacheSound * FindSoundByKey(const char *p_key)
[AI] Attempts to find and return a cached sound by its key (case-insensitive).
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.
void SetDistance(MxS32 p_min, MxS32 p_max)
Sets minimum and maximum audible distances for 3D sound attenuation.
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
MxBool m_cameraFlag
[AI] Set to TRUE if this entity is currently the camera target. [AI]
Definition: legoentity.h:218
MxFloat m_worldSpeed
[AI] World-relative speed (can affect animation/movement logic). [AI]
Definition: legoentity.h:212
LegoROI * m_roi
[AI] Pointer to this entity's currently assigned ROI (3D instance in the world). [AI]
Definition: legoentity.h:215
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
LegoPathBoundary * m_boundary
[AI] Current boundary the actor is navigating on. [AI]
LegoPathController * m_pathController
[AI] Path controller/manages permitted boundaries for transitions. [AI]
virtual MxResult VTable0x9c()
[AI] Handles exit transition and next-edge search logic; also used for collision reaction and fallbac...
LegoPathEdgeContainer * m_grec
[AI] Edge/boundary helper for tracking transitions and stateful animation. [AI]
MxFloat m_lastTime
[AI] Time of last update (used for delta calculations). [AI]
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
LegoPathBoundary * GetPathBoundary(const char *p_name)
[AI] Searches for a path boundary by name among owned boundaries.
MxResult FUN_10048310(LegoPathEdgeContainer *p_grec, const Vector3 &p_oldPosition, const Vector3 &p_oldDirection, LegoPathBoundary *p_oldBoundary, const Vector3 &p_newPosition, const Vector3 &p_newDirection, LegoPathBoundary *p_newBoundary, LegoU8 p_mask, MxFloat *p_param9)
[AI] Complex function performing path transition resolution; computes possible edge transition sequen...
void ScheduleAnimation(LegoEntity *p_entity, MxLong p_length)
[AI] Schedules an animation for the given plant, adding an entry to the internal tickle array.
LegoPlantInfo * GetInfoArray(MxS32 &p_length)
[AI] Returns pointer to plant info array and populates its size.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
static void FUN_100a8e80(LegoTreeNode *p_node, Matrix4 &p_matrix, LegoTime p_time, LegoROI **p_roiMap)
[AI] [Static] Recursively evaluates animation nodes, updating the transformation matrices and visibil...
Definition: legoroi.cpp:414
LegoROI * FindChildROI(const LegoChar *p_name, LegoROI *p_roi)
[AI] Recursively searches for a child ROI by name, starting at the given ROI.
Definition: legoroi.cpp:349
LegoCacheSoundManager * GetCacheSoundManager()
[AI] Returns the cache sound manager used to cache and reuse sound effects.
[AI] Represents a node within a general, N-ary tree structure.
Definition: legotree.h:44
LegoU32 GetNumChildren()
[AI] Returns the number of direct children of this node. [AI]
Definition: legotree.h:63
LegoTreeNode * GetChild(LegoU32 p_i)
[AI] Gets the child node at the specified index (no bounds checking).
Definition: legotree.h:72
LegoTreeNode * GetRoot()
[AI] Returns a pointer to the root node of the tree. [AI]
Definition: legotree.h:112
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
void RemoveActor(LegoPathActor *p_actor)
Removes an actor from all known path controllers.
Definition: legoworld.cpp:325
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
const float * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
const float * GetWorldDirection() const
Returns a pointer to the world direction vector (forward axis) from the transformation matrix.
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.
void UpdateTransformationRelativeToParent(const Matrix4 &p_transform)
Calculates and updates the world transform relative to this object's parent, then calls UpdateWorldDa...
const BoundingBox & GetWorldBoundingBox() const override
Returns the object's bounding box in world coordinates.
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
Definition: roi.h:235
virtual float Dot(const float *p_a, const float *p_b) const
[AI] Compute the dot product of the two float arrays interpreted as vectors of 2 elements.
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.
[AI] Manages all ViewROI objects that are rendered in a given scene, handles frustum culling,...
Definition: viewmanager.h:16
unsigned int IsBoundingBoxInFrustum(const BoundingBox &p_bounding_box)
[AI] Determines if a bounding box is (partially) inside the camera's view frustum using frustum-plane...
Definition: viewmanager.cpp:64
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
unsigned int undefined4
Definition: decomp.h:28
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#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
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
Definition: misc.cpp:29
LegoBuildingManager * BuildingManager()
[AI] Accessor for the building manager, handles constructible buildings and structures....
Definition: misc.cpp:123
LegoSoundManager * SoundManager()
[AI] Accessor for the game's LegoSoundManager subsystem from the global LegoOmni instance....
Definition: misc.cpp:22
LegoPlantManager * PlantManager()
[AI] Accessor for the plant manager, handling in-game foliage and plants. [AI]
Definition: misc.cpp:115
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
Definition: misc.cpp:93
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
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
float MxFloat
[AI]
Definition: mxtypes.h:68
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
signed char MxS8
[AI]
Definition: mxtypes.h:14
MxFloat m_position[3]
[AI] 3D world position for the location (x, y, z). [AI]
Definition: act2actor.h:25
MxFloat m_direction[3]
[AI] Forward direction vector for the location. [AI]
Definition: act2actor.h:26
MxBool m_unk0x1c
[AI] Used to track whether a location has been previously used/marked. [AI]
Definition: act2actor.h:28
float GetDuration()
[AI] Gets the length, in seconds, of the animation (delegates to anim tree).
LegoAnim * GetAnimTreePtr()
[AI] Returns the root animation tree node for this mapping.
Definition: legoanimactor.h:32
LegoROI ** GetROIMap()
[AI] Returns the mapping of tree nodes to LegoROI pointers (array of pointers, one per mesh/node).
Definition: legoanimactor.h:35
[AI] Describes the state, configuration, and world placement of a single LEGO building entity,...
LegoEntity * m_entity
[AI] Associated entity in the world for this building [AI]
[AI] Container for path boundary edges, also stores position, direction, and flags.
MxU32 GetBit1()
[AI] Query if the c_bit1 flag is set.
[AI] Struct representing a single plant's static configuration on LEGO Island, including placement,...
Definition: legoplants.h:18
LegoEntity * m_entity
[AI] Pointer to the associated entity instance (initialized later at runtime) [AI]
Definition: legoplants.h:51
@ c_bit1
[AI] Bit flag 1 for face B connection/properties
#define DISTSQRD3(v, w)
Definition: vec.h:478