Isle
Loading...
Searching...
No Matches
act3actors.cpp
Go to the documentation of this file.
1#include "act3actors.h"
2
3#include "act3.h"
4#include "act3ammo.h"
5#include "anim/legoanim.h"
6#include "define.h"
11#include "legoplantmanager.h"
12#include "legoplants.h"
13#include "legosoundmanager.h"
14#include "misc.h"
15#include "mxdebug.h"
16#include "mxmisc.h"
17#include "mxtimer.h"
18#include "mxutilities.h"
19#include "roi/legoroi.h"
20
21#include <assert.h>
22
25DECOMP_SIZE_ASSERT(Act3Cop::Act3CopDest, 0x20)
28
29// name verified by BETA10 0x10018776
30// GLOBAL: LEGO1 0x100f4120
31// GLOBAL: BETA10 0x101dcdc8
32Act3Cop::Act3CopDest g_copDest[5] = {
33 {"INT38", NULL, {3.69, -1.31251, -59.231}, {-0.99601698, 0.0, -0.089166}},
34 {
35 "EDG02_08",
36 NULL,
37 {
38 -96.459999,
39 4.0,
40 11.22,
41 },
42 {
43 -0.9725,
44 0.0,
45 -0.23,
46 },
47 },
48 {
49 "INT18",
50 NULL,
51 {
52 28.076799,
53 2.0,
54 32.11,
55 },
56 {
57 -0.19769999,
58 0.0,
59 0.98,
60 },
61 },
62 {
63 "INT48",
64 NULL,
65 {
66 84.736,
67 9.0,
68 -1.965,
69 },
70 {
71 0.241,
72 0.0,
73 -0.97,
74 },
75 },
76 {"INT42",
77 NULL,
78 {
79 63.76178,
80 0.999993,
81 -77.739998,
82 },
83 {
84 0.47999999,
85 0.0,
86 -0.87699997,
87 }}
88};
89
90// Initialized at LEGO1 0x1003fa20
91// GLOBAL: LEGO1 0x10104ef0
92Mx3DPointFloat Act3Actor::g_unk0x10104ef0 = Mx3DPointFloat(0.0, 5.0, 0.0);
93
94// FUNCTION: LEGO1 0x1003fa50
95// FUNCTION: BETA10 0x10017fb8
97{
98 m_unk0x1c = 0;
99}
100
101// FUNCTION: LEGO1 0x1003fb70
102// FUNCTION: BETA10 0x100180ab
103MxU32 Act3Actor::VTable0x90(float p_time, Matrix4& p_transform)
104{
105 // Note: Code duplication with LegoExtraActor::VTable0x90
106 switch (m_actorState & c_maxState) {
107 case c_initial:
108 case c_one:
109 return TRUE;
110 case c_two:
111 m_unk0x1c = p_time + 2000.0f;
113 m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
114 m_lastTime = p_time;
115 return FALSE;
116 case c_three:
117 assert(!m_userNavFlag);
118 Vector3 positionRef(p_transform[3]);
119
120 p_transform = m_roi->GetLocal2World();
121
122 if (m_unk0x1c > p_time) {
123 Mx3DPointFloat position;
124
125 position = positionRef;
126 positionRef.Clear();
127 p_transform.RotateX(0.6);
128 positionRef = position;
129
130 m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
131 m_lastTime = p_time;
132
133 VTable0x74(p_transform);
134 return FALSE;
135 }
136 else {
138 m_unk0x1c = 0;
139
140 positionRef -= g_unk0x10104ef0;
141 m_roi->FUN_100a58f0(p_transform);
142 m_roi->VTable0x14();
143 return TRUE;
144 }
145 }
146
147 return FALSE;
148}
149
150// FUNCTION: LEGO1 0x1003fd90
151// FUNCTION: BETA10 0x10018328
153{
154 if (!p_actor->GetUserNavFlag() && p_bool) {
155 if (p_actor->GetActorState() != c_initial) {
156 return FAILURE;
157 }
158
159 LegoROI* roi = p_actor->GetROI();
160
161 MxMatrix local2world;
162 local2world = roi->GetLocal2World();
163
164 Vector3(local2world[3]) += g_unk0x10104ef0;
165
166 roi->FUN_100a58f0(local2world);
167 roi->VTable0x14();
168
169 p_actor->SetActorState(c_two | c_noCollide);
170 }
171
172 return SUCCESS;
173}
174
175// FUNCTION: LEGO1 0x1003fe30
176// FUNCTION: BETA10 0x10018412
178{
179 m_unk0x20 = -1.0f;
180 m_world = NULL;
182}
183
184// FUNCTION: LEGO1 0x1003ff70
185// FUNCTION: BETA10 0x10018526
187{
188 LegoROI* roi = p_actor->GetROI();
189
190 if (p_bool && !strncmp(roi->GetName(), "dammo", 5)) {
191 MxS32 index = -1;
192 if (sscanf(roi->GetName(), "dammo%d", &index) != 1) {
193 assert(0);
194 }
195
196 assert(m_world);
197 ((Act3*) m_world)->EatDonut(index);
198 m_unk0x20 = m_lastTime + 2000;
199 SetWorldSpeed(6.0);
200
201 assert(SoundManager()->GetCacheSoundManager());
203 FUN_10040360();
204 }
205 else {
206 if (((Act3*) m_world)->m_brickster->GetROI() != roi) {
207 if (p_bool) {
208 return Act3Actor::HitActor(p_actor, p_bool);
209 }
210 }
211 else {
212 ((Act3*) m_world)->GoodEnding(roi->GetLocal2World());
213 }
214 }
215
216 return SUCCESS;
217}
218
219// FUNCTION: LEGO1 0x10040060
220// FUNCTION: BETA10 0x100186fa
221void Act3Cop::ParseAction(char* p_extra)
222{
223 m_world = CurrentWorld();
225 ((Act3*) m_world)->AddCop(this);
226 Act3* world = (Act3*) m_world;
227 MxS32 i;
228
229 // The typecast is necessary for correct signedness
230 for (i = 0; i < (MxS32) sizeOfArray(g_copDest); i++) {
231 assert(g_copDest[i].m_bName);
232 g_copDest[i].m_boundary = world->FindPathBoundary(g_copDest[i].m_bName);
233 assert(g_copDest[i].m_boundary);
234
235 if (g_copDest[i].m_boundary) {
236 Mx3DPointFloat point(g_copDest[i].m_unk0x08[0], g_copDest[i].m_unk0x08[1], g_copDest[i].m_unk0x08[2]);
238
239 for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) {
240 Mx4DPointFloat* edgeNormal = boundary->GetEdgeNormal(j);
241 if (point.Dot(*edgeNormal, point) + edgeNormal->index_operator(3) < -0.001) {
242 MxTrace("Bad Act3 cop destination %d\n", i);
243 break;
244 }
245 }
246
247 Mx4DPointFloat* boundary0x14 = boundary->GetUnknown0x14();
248
249 if (point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) <= 0.001 &&
250 point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) >= -0.001) {
251 continue;
252 }
253
254 g_copDest[i].m_unk0x08[1] = -(boundary0x14->index_operator(3) + boundary0x14->index_operator(0) * point[0] +
255 boundary0x14->index_operator(2) * point[2]) /
256 boundary0x14->index_operator(1);
257
258 MxTrace(
259 "Act3 cop destination %d (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, %g, %g)\n",
260 i,
261 point[0],
262 point[1],
263 point[2],
264 boundary->GetName(),
265 point[0],
266 g_copDest[i].m_unk0x08[1],
267 point[2]
268 );
269 }
270 }
271
272 for (i = 0; i < m_animMaps.size(); i++) {
273 if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
274 m_eatAnim = m_animMaps[i];
275 }
276 }
277
278 assert(m_eatAnim);
279}
280
281// FUNCTION: LEGO1 0x100401f0
282// FUNCTION: BETA10 0x10018abf
283void Act3Cop::Animate(float p_time)
284{
285 Act3Actor::Animate(p_time);
286
287 if (m_unk0x20 > 0.0f && m_unk0x20 < m_lastTime) {
288 SetWorldSpeed(2.0f);
289 m_unk0x20 = -1.0f;
290 }
291
292 Act3Brickster* brickster = ((Act3*) m_world)->m_brickster;
293
294 if (brickster != NULL && brickster->GetROI() != NULL && m_roi != NULL) {
295 Mx3DPointFloat local34(brickster->GetROI()->GetLocal2World()[3]);
296 local34 -= m_roi->GetLocal2World()[3];
297
298 float distance = local34.LenSquared();
299
300 if (distance < 4.0f) {
301 ((Act3*) m_world)->GoodEnding(brickster->GetROI()->GetLocal2World());
302 return;
303 }
304
305 if (distance < 25.0f) {
306 brickster->SetActorState(c_disabled);
307 FUN_10040360();
308 return;
309 }
310 }
311
312 if (m_grec == NULL) {
313 FUN_10040360();
314 }
315}
316
317// FUNCTION: LEGO1 0x10040350
318// FUNCTION: BETA10 0x10018c4a
320{
321 return FUN_10040360();
322}
323
324// FUNCTION: LEGO1 0x10040360
325// FUNCTION: BETA10 0x10018c6a
327{
329 Act3* a3 = (Act3*) m_world;
330
331 MxMatrix local74(m_unk0xec);
332 Vector3 local2c(local74[3]);
333 Vector3 local20(local74[2]);
334
335 Mx3DPointFloat local7c;
336 local7c = a3->m_brickster->GetROI()->GetLocal2World()[3];
337 local7c -= local2c;
338
339 if (local7c.LenSquared() < 144.0f) {
340 local7c = a3->m_brickster->GetROI()->GetLocal2World()[3];
341 Mx3DPointFloat local5c(a3->m_brickster->GetROI()->GetLocal2World()[2]);
342 LegoPathBoundary* boundary = a3->m_brickster->GetBoundary();
343
344 grec = new LegoPathEdgeContainer();
345 assert(grec);
346
347 MxFloat local34;
349 grec,
350 local2c,
351 local20,
353 local7c,
354 local5c,
355 boundary,
357 &local34
358 ) != SUCCESS) {
359 delete grec;
360 grec = NULL;
361 }
362 }
363
364 if (grec == NULL) {
365 float local18;
366
367 for (MxS32 i = 0; i < MAX_DONUTS; i++) {
368 Act3Ammo* donut = &a3->m_donuts[i];
369 assert(donut);
370
371 if (donut->IsValid() && donut->GetActorState() == c_initial) {
372 LegoROI* proi = donut->GetROI();
373 assert(proi);
374
375 MxMatrix locald0 = proi->GetLocal2World();
376 Vector3 local88(locald0[3]);
377 Mx3DPointFloat localec(local88);
378 localec -= local88;
379
381 assert(r2);
382
383 MxFloat locald8;
384 LegoPathEdgeContainer *local138, *local134, *local140, *local13c; // unused
385
387 r2,
388 local2c,
389 local20,
391 local88,
392 localec,
393 donut->GetBoundary(),
395 &locald8
396 ) == SUCCESS &&
397 (grec == NULL || locald8 < local18)) {
398 if (grec != NULL) {
399 local134 = local138 = grec;
400 delete grec;
401 }
402
403 grec = r2;
404 local18 = locald8;
405 }
406
407 if (grec != r2) {
408 local13c = local140 = r2;
409 delete r2;
410 }
411 }
412 }
413
414 if (grec == NULL) {
415 MxS32 random = rand() % (MxS32) sizeOfArray(g_copDest);
416 Vector3 localf8(g_copDest[random].m_unk0x08);
417 Vector3 local108(g_copDest[random].m_unk0x14);
418
419 grec = new LegoPathEdgeContainer();
420 LegoPathBoundary* boundary = g_copDest[random].m_boundary;
421
422 if (boundary != NULL) {
423 MxFloat local100;
424 LegoPathEdgeContainer *local150, *local14c; // unused
425
427 grec,
428 local2c,
429 local20,
431 localf8,
432 local108,
433 boundary,
435 &local100
436 ) != SUCCESS) {
437 local14c = local150 = grec;
438 delete grec;
439 grec = NULL;
440 }
441 }
442 }
443 }
444
445 if (grec != NULL) {
446 LegoPathEdgeContainer *local158, *local154; // unused
447 if (m_grec != NULL) {
448 local154 = local158 = m_grec;
449 delete m_grec;
450 }
451
452 m_grec = grec;
453 Mx3DPointFloat vecUnk;
454
455 if (m_grec->size() == 0) {
456 vecUnk = m_grec->m_position;
458
460 m_grec->m_direction -= vecUnk;
461 }
462 else {
463 Mx3DPointFloat local128;
464 LegoEdge* edge = m_grec->back().m_edge;
465
466 Vector3* v1 = edge->CWVertex(*m_grec->m_boundary);
467 Vector3* v2 = edge->CCWVertex(*m_grec->m_boundary);
468 assert(v1 && v2);
469
470 local128 = *v2;
471 local128 -= *v1;
472 local128 *= m_unk0xe4;
473 local128 += *v1;
474 local128 *= -1.0f;
475 local128 += m_grec->m_position;
476 local128.Unitize();
477 m_grec->m_direction = local128;
478
479 edge = m_grec->front().m_edge;
480 LegoPathBoundary* boundary = m_grec->front().m_boundary;
481
482 v1 = edge->CWVertex(*boundary);
483 v2 = edge->CCWVertex(*boundary);
484
485 vecUnk = *v2;
486 vecUnk -= *v1;
487 vecUnk *= m_unk0xe4;
488 vecUnk += *v1;
489 }
490
491 Vector3 v1(m_unk0xec[0]);
492 Vector3 v2(m_unk0xec[1]);
493 Vector3 v3(m_unk0xec[2]);
494 Vector3 v4(m_unk0xec[3]);
495
496 v3 = v4;
497 v3 -= vecUnk;
498 v3.Unitize();
499 v1.EqualsCross(v2, v3);
500 v1.Unitize();
501 v2.EqualsCross(v3, v1);
502
503 VTable0x9c();
504 }
505
506 return SUCCESS;
507}
508
509// FUNCTION: LEGO1 0x10040d20
510// FUNCTION: BETA10 0x1001942c
512{
513 if (m_grec && !m_grec->GetBit1()) {
514 delete m_grec;
515 m_grec = NULL;
516 m_lastTime = Timer()->GetTime();
517 FUN_10040360();
518 return SUCCESS;
519 }
520
521 return Act3Actor::VTable0x9c();
522}
523
524// FUNCTION: LEGO1 0x10040e10
525// FUNCTION: BETA10 0x10019516
527{
528 m_world = NULL;
529 m_pInfo = NULL;
530 m_bInfo = NULL;
531 m_shootAnim = NULL;
532 m_unk0x38 = 0;
533 m_unk0x20 = 0.0f;
534 m_unk0x24 = 0.0f;
535 m_unk0x54 = 0.0f;
536
538 m_unk0x58 = 0;
539
540 m_unk0x3c.Clear();
541}
542
543// FUNCTION: LEGO1 0x10040f20
544// FUNCTION: BETA10 0x10019663
546{
547 // empty
548}
549
550// FUNCTION: LEGO1 0x10040ff0
551// FUNCTION: BETA10 0x100196ff
552void Act3Brickster::ParseAction(char* p_extra)
553{
554 m_world = CurrentWorld();
555
557
558 ((Act3*) m_world)->SetBrickster(this);
559
560 for (MxS32 i = 0; i < m_animMaps.size(); i++) {
561 if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
562 m_shootAnim = m_animMaps[i];
563 }
564 }
565
566 assert(m_shootAnim);
567}
568
569// FUNCTION: LEGO1 0x10041050
570// FUNCTION: BETA10 0x100197d7
571void Act3Brickster::Animate(float p_time)
572{
573 if (m_lastTime <= m_unk0x20 && m_unk0x20 <= p_time) {
574 SetWorldSpeed(5.0f);
575 }
576
577 if (m_unk0x38 != 3 && m_unk0x38 != 4) {
578 Act3Actor::Animate(p_time);
579 }
580
581 if (m_unk0x54 < p_time) {
582 ((Act3*) m_world)->FUN_10072ad0(5);
583 m_unk0x54 = p_time + 15000.0f;
584 }
585
586 switch (m_unk0x38) {
587 case 1:
588 FUN_100417c0();
589 break;
590 case 2:
591 m_unk0x58++;
592 m_unk0x20 = p_time + 2000.0f;
593 SetWorldSpeed(3.0f);
594
595 assert(SoundManager()->GetCacheSoundManager());
596
597 if (m_unk0x58 >= 8) {
598 ((Act3*) m_world)->FUN_10072ad0(6);
599 }
600 else {
602 }
603
604 FUN_100417c0();
605 break;
606 case 3:
607 assert(m_shootAnim && m_pInfo);
608
609 if (m_unk0x50 < p_time) {
610 while (m_pInfo->m_unk0x16) {
612 }
613
614 assert(SoundManager()->GetCacheSoundManager());
616 m_unk0x58 = 0;
617 FUN_100417c0();
618 }
619 else {
620 MxMatrix local70;
621 local70 = m_unk0xec;
622
623 Vector3 local14(local70[0]);
624 Vector3 local28(local70[1]);
625 Vector3 localc(local70[2]);
626 Vector3 local20(local70[3]);
627
628 localc = local20;
629 localc -= m_pInfo->m_position;
630 localc.Unitize();
631 local14.EqualsCross(local28, localc);
632 local14.Unitize();
633 local28.EqualsCross(localc, local14);
634
635 assert(!m_cameraFlag);
636
637 LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
638 float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration());
639
640 for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
641 LegoROI::FUN_100a8e80(root->GetChild(i), local70, time, m_shootAnim->GetROIMap());
642 }
643 }
644
645 m_lastTime = p_time;
646 break;
647 case 4:
648 assert(m_shootAnim && m_bInfo);
649
650 if (m_unk0x50 < p_time) {
651 ((Act3*) m_world)->FUN_10073a60();
652 m_unk0x58 = 0;
653 assert(SoundManager()->GetCacheSoundManager());
655
656 while (m_bInfo->m_unk0x11 > 0 || m_bInfo->m_unk0x11 == -1) {
657 if (!BuildingManager()->FUN_10030110(m_bInfo)) {
658 break;
659 }
660 }
661
662 FUN_100417c0();
663 }
664 else {
665 MxMatrix locale4;
666 locale4 = m_unk0xec;
667
668 Vector3 local88(locale4[0]);
669 Vector3 local9c(locale4[1]);
670 Vector3 local80(locale4[2]);
671 Vector3 local94(locale4[3]);
672
673 local80 = local94;
674 assert(m_bInfo->m_entity && m_bInfo->m_entity->GetROI());
675
676 local80 -= m_unk0x3c;
677 local80.Unitize();
678 local88.EqualsCross(local9c, local80);
679 local88.Unitize();
680 local9c.EqualsCross(local80, local88);
681
682 assert(!m_cameraFlag);
683
684 LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
685 float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration());
686
687 for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
688 LegoROI::FUN_100a8e80(root->GetChild(i), locale4, time, m_shootAnim->GetROIMap());
689 }
690 }
691
692 m_lastTime = p_time;
693 break;
694 case 5:
695 if (m_grec == NULL) {
696 assert(m_shootAnim && m_pInfo);
697 m_unk0x38 = 3;
698 m_unk0x50 = p_time + m_shootAnim->GetDuration();
699 assert(SoundManager()->GetCacheSoundManager());
701 }
702 else {
703 FUN_10042300();
704 }
705 break;
706 case 6:
707 if (m_grec == NULL) {
708 assert(m_shootAnim && m_bInfo);
709 m_unk0x38 = 4;
710 m_unk0x50 = p_time + m_shootAnim->GetDuration();
711 assert(SoundManager()->GetCacheSoundManager());
714 m_unk0x3c = m_bInfo->m_entity->GetROI()->GetLocal2World()[3];
715 }
716 else {
717 FUN_10042300();
718 }
719 break;
720 case 7:
721 default:
722 FUN_10042300();
723 break;
724 case 8:
725 m_unk0x24 = p_time + 10000.0f;
726 m_unk0x38 = 9;
727 break;
728 case 9:
729 if (m_unk0x24 < p_time) {
730 FUN_100417c0();
731 }
732 else if (m_unk0x24 - 9000.0f < p_time) {
733 FUN_10042300();
734 }
735 break;
736 }
737}
738
739// FUNCTION: LEGO1 0x100416b0
740// FUNCTION: BETA10 0x1001a299
742{
743 if (!p_bool) {
744 return FAILURE;
745 }
746
747 Act3* a3 = (Act3*) m_world;
748 LegoROI* r = p_actor->GetROI();
749 assert(r);
750
751 if (a3->m_cop1->GetROI() != r && a3->m_cop2->GetROI() != r) {
752 if (!strncmp(r->GetName(), "pammo", 5)) {
753 MxS32 index = -1;
754 if (sscanf(r->GetName(), "pammo%d", &index) != 1) {
755 assert(0);
756 }
757
758 assert(m_world);
759
760 if (a3->m_pizzas[index].IsValid() && !a3->m_pizzas[index].IsSharkFood()) {
761 a3->EatPizza(index);
762 }
763
764 m_unk0x38 = 2;
765 return SUCCESS;
766 }
767 else {
768 return Act3Actor::HitActor(p_actor, p_bool);
769 }
770 }
771
772 return SUCCESS;
773}
774
775// FUNCTION: LEGO1 0x100417a0
776// FUNCTION: BETA10 0x1001a3cf
778{
779 if (m_unk0x58 < 8) {
780 return FUN_100417c0();
781 }
782
783 return SUCCESS;
784}
785
786// FUNCTION: LEGO1 0x100417c0
787// FUNCTION: BETA10 0x1001a407
789{
790 m_pInfo = NULL;
791 m_bInfo = NULL;
792 m_unk0x38 = 0;
794 Act3* a3 = (Act3*) m_world;
795
796 MxMatrix local70(m_unk0xec);
797 Vector3 local28(local70[3]);
798 Vector3 local20(local70[2]);
799
800 if (m_unk0x58 < 8 && m_unk0x24 + 5000.0f < m_lastTime) {
801 float local18;
802
803 for (MxS32 i = 0; i < MAX_PIZZAS; i++) {
804 Act3Ammo* pizza = &a3->m_pizzas[i];
805 assert(pizza);
806
807 if (pizza->IsValid() && !pizza->IsSharkFood() && pizza->GetActorState() == c_initial) {
808 LegoROI* proi = pizza->GetROI();
809 assert(proi);
810
811 MxMatrix locald0 = proi->GetLocal2World();
812 Vector3 local88(locald0[3]);
813 Mx3DPointFloat localec(local88);
814 localec -= local28;
815
816 if (localec.LenSquared() > 1600.0f) {
817 ((Act3*) m_world)->m_shark->EatPizza(pizza);
818 }
819 else {
821 assert(r2);
822
823 MxFloat locald8;
824 LegoPathEdgeContainer *local16c, *local168, *local174, *local170; // unused
825
827 r2,
828 local28,
829 local20,
831 local88,
832 localec,
833 pizza->GetBoundary(),
835 &locald8
836 ) == SUCCESS &&
837 (grec == NULL || locald8 < local18)) {
838 if (grec != NULL) {
839 local168 = local16c = grec;
840 delete grec;
841 }
842
843 grec = r2;
844 local18 = locald8;
845 }
846
847 if (grec != r2) {
848 local170 = local174 = r2;
849 delete r2;
850 }
851 }
852 }
853 }
854 }
855
856 if (grec == NULL) {
857 MxS32 length = 0;
858 LegoPlantInfo* pInfo = PlantManager()->GetInfoArray(length);
859 Mx3DPointFloat local108;
860 Mx3DPointFloat local138;
861 MxS32 local120 = -1;
862 MxU32 local110 = FALSE;
863 LegoPathBoundary* localf4 = NULL;
865 float local124;
866
867 for (MxS32 i = 0; i < length; i++) {
868 if (bInfo[i].m_unk0x11 < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 &&
869 (local120 == -1 || i != 15)) {
870 Mx3DPointFloat local188(bInfo[i].m_x, bInfo[i].m_y, bInfo[i].m_z);
871
872 local138 = local188;
873 local138 -= local28;
874 float length = local138.LenSquared();
875
876 if (local120 < 0 || length < local124) {
877 local110 = TRUE;
878 local120 = i;
879 local124 = length;
880 }
881 }
882 }
883
884 if (local120 != -1) {
885 if (local110) {
886 m_bInfo = &bInfo[local120];
887 localf4 = m_bInfo->m_boundary;
888 Mx3DPointFloat local19c(m_bInfo->m_x, m_bInfo->m_y, m_bInfo->m_z);
889 local108 = local19c;
890 }
891 else {
892 m_pInfo = &pInfo[local120];
893 localf4 = m_pInfo->m_boundary;
894 Mx3DPointFloat local1b0(m_pInfo->m_x, m_pInfo->m_y, m_pInfo->m_z);
895 local108 = local1b0;
896 }
897 }
898
899 if (localf4 != NULL) {
900 assert(m_pInfo || m_bInfo);
901
902 grec = new LegoPathEdgeContainer();
903 local138 = local108;
904 local138 -= local28;
905 local138.Unitize();
906
907 MxFloat local13c;
908 LegoPathEdgeContainer *local1c0, *local1bc; // unused
909
911 grec,
912 local28,
913 local20,
915 local108,
916 local138,
917 localf4,
919 &local13c
920 ) != SUCCESS) {
921 local1bc = local1c0 = grec;
922
923 if (grec != NULL) {
924 delete grec;
925 }
926
927 grec = NULL;
928 assert(0);
929 }
930 }
931 else {
932 ((Act3*) m_world)->BadEnding(m_roi->GetLocal2World());
933 return SUCCESS;
934 }
935 }
936
937 if (grec != NULL) {
938 Mx3DPointFloat local150;
939
940 LegoPathEdgeContainer *local1c4, *local1c8; // unused
941 if (m_grec != NULL) {
942 local1c4 = local1c8 = m_grec;
943 delete m_grec;
944 }
945
946 m_grec = grec;
947 Mx3DPointFloat vecUnk;
948
949 if (m_grec->size() == 0) {
950 vecUnk = m_grec->m_position;
952
954 m_grec->m_direction -= vecUnk;
955
956 local150 = m_grec->m_direction;
957 }
958 else {
959 LegoEdge* edge = m_grec->back().m_edge;
960
961 Vector3* v1 = edge->CWVertex(*m_grec->m_boundary);
962 Vector3* v2 = edge->CCWVertex(*m_grec->m_boundary);
963 assert(v1 && v2);
964
965 local150 = *v2;
966 local150 -= *v1;
967 local150 *= m_unk0xe4;
968 local150 += *v1;
969 local150 *= -1.0f;
970 local150 += m_grec->m_position;
971 local150.Unitize();
972 m_grec->m_direction = local150;
973
974 edge = m_grec->front().m_edge;
975 LegoPathBoundary* boundary = m_grec->front().m_boundary;
976
977 v1 = edge->CWVertex(*boundary);
978 v2 = edge->CCWVertex(*boundary);
979
980 vecUnk = *v2;
981 vecUnk -= *v1;
982 vecUnk *= m_unk0xe4;
983 vecUnk += *v1;
984 }
985
986 Vector3 v1(m_unk0xec[0]);
987 Vector3 v2(m_unk0xec[1]);
988 Vector3 v3(m_unk0xec[2]);
989 Vector3 v4(m_unk0xec[3]);
990
991 v3 = v4;
992 v3 -= vecUnk;
993 v3.Unitize();
994 v1.EqualsCross(v2, v3);
995 v1.Unitize();
996 v2.EqualsCross(v3, v1);
997
998 VTable0x9c();
999
1000 if (m_pInfo != NULL) {
1001 m_unk0x38 = 5;
1002 }
1003 else if (m_bInfo != NULL) {
1004 m_unk0x38 = 6;
1005 }
1006 }
1007
1008 return SUCCESS;
1009}
1010
1011// FUNCTION: LEGO1 0x10042300
1012// FUNCTION: BETA10 0x1001b017
1013MxS32 Act3Brickster::FUN_10042300()
1014{
1015 Act3* a3 = (Act3*) m_world;
1016
1017 assert(a3 && a3->m_cop1 && a3->m_cop2);
1018 assert(a3->m_cop1->GetROI() && a3->m_cop2->GetROI() && GetROI());
1019
1020 Mx3DPointFloat local64[2];
1021 Mx3DPointFloat local38;
1022 Mx3DPointFloat local18;
1023
1024 MxS32 local1c = 0;
1025 float local24[2];
1026
1027 local64[0] = a3->m_cop1->GetROI()->GetLocal2World()[3];
1028 local64[1] = a3->m_cop2->GetROI()->GetLocal2World()[3];
1029 local38 = GetROI()->GetLocal2World()[3];
1030
1031 local18 = local64[0];
1032 local18 -= local38;
1033 local24[0] = local18.LenSquared();
1034
1035 local18 = local64[1];
1036 local18 -= local38;
1037 local24[1] = local18.LenSquared();
1038
1039 if (local24[1] < local24[0]) {
1040 local1c = 1;
1041 }
1042
1043 if (local24[local1c] < 225.0f) {
1044 m_unk0x38 = 8;
1045
1046 if (m_grec != NULL) {
1047 delete m_grec;
1048 m_grec = NULL;
1049 }
1050
1051 if (m_pInfo != NULL) {
1052 m_pInfo = NULL;
1053 }
1054
1055 assert(m_boundary && m_destEdge && m_roi);
1056
1057 LegoPathBoundary* boundaries[2];
1058 LegoUnknown100db7f4* maxE = NULL;
1059 boundaries[0] = m_boundary;
1060
1061 if (m_destEdge->FUN_10048c40(local38)) {
1062 boundaries[1] = (LegoPathBoundary*) m_destEdge->OtherFace(m_boundary);
1063 }
1064 else {
1065 boundaries[1] = NULL;
1066 }
1067
1068 float local78, local98;
1069 for (MxS32 i = 0; i < (MxS32) sizeOfArray(boundaries); i++) {
1070 if (boundaries[i] != NULL) {
1071 for (MxS32 j = 0; j < boundaries[i]->GetNumEdges(); j++) {
1072 LegoUnknown100db7f4* e = boundaries[i]->GetEdges()[j];
1073
1074 if (e->GetMask0x03()) {
1075 Mx3DPointFloat local94(*e->GetPointA());
1076 local94 += *e->GetPointB();
1077 local94 /= 2.0f;
1078
1079 local18 = local94;
1080 local18 -= local64[local1c];
1081 local98 = local18.LenSquared();
1082
1083 local94 -= local38;
1084 local18 = local64[local1c];
1085 local18 -= local38;
1086
1087 if (maxE == NULL || (local18.Dot(local94, local18) < 0.0f && local78 < local98)) {
1088 maxE = e;
1089 m_boundary = boundaries[i];
1090 local78 = local98;
1091 }
1092 }
1093 }
1094 }
1095 }
1096
1097 assert(maxE);
1098 m_destEdge = maxE;
1099
1100 if (m_boundary != boundaries[0]) {
1101 m_unk0xe4 = 1.0 - m_unk0xe4;
1102 }
1103
1104 VTable0x9c();
1105 }
1106
1107 return -1;
1108}
1109
1110// FUNCTION: LEGO1 0x10042990
1111// FUNCTION: BETA10 0x1001b6e2
1112void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
1113{
1114 if (m_unk0x38 != 8) {
1115 m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);
1116 }
1117}
1118
1119// FUNCTION: LEGO1 0x100429d0
1120// FUNCTION: BETA10 0x1001b75b
1122{
1123 if (m_grec && !m_grec->GetBit1()) {
1124 delete m_grec;
1125 m_grec = NULL;
1126 m_lastTime = Timer()->GetTime();
1127 return SUCCESS;
1128 }
1129
1130 return Act3Actor::VTable0x9c();
1131}
1132
1133// FUNCTION: LEGO1 0x10042ab0
1135{
1136 m_unk0x2c = 0.0f;
1137 m_nextPizza = NULL;
1138}
1139
1140// FUNCTION: LEGO1 0x10042ce0
1142{
1143 p_ammo->SetSharkFood(TRUE);
1144 m_eatPizzas.push_back(p_ammo);
1145 return SUCCESS;
1146}
1147
1148// FUNCTION: LEGO1 0x10042d40
1149void Act3Shark::Animate(float p_time)
1150{
1151 LegoROI** roiMap = m_unk0x34->GetROIMap();
1152
1153 if (m_nextPizza == NULL) {
1154 if (m_eatPizzas.size() > 0) {
1155 m_nextPizza = m_eatPizzas.front();
1156 m_eatPizzas.pop_front();
1157 m_unk0x2c = p_time;
1158 roiMap[1] = m_nextPizza->GetROI();
1159 m_unk0x3c = roiMap[1]->GetLocal2World()[3];
1160 roiMap[1]->SetVisibility(TRUE);
1161 roiMap[2]->SetVisibility(TRUE);
1162 }
1163
1164 if (m_nextPizza == NULL) {
1165 return;
1166 }
1167 }
1168
1169 float time = m_unk0x2c + m_unk0x34->GetDuration();
1170
1171 if (time > p_time) {
1172 float duration = p_time - m_unk0x2c;
1173
1174 if (duration < 0) {
1175 duration = 0;
1176 }
1177
1178 if (m_unk0x34->GetDuration() < duration) {
1179 duration = m_unk0x34->GetDuration();
1180 }
1181
1182 MxMatrix mat;
1183 mat.SetIdentity();
1184
1185 Vector3 vec(mat[3]);
1186 vec = m_unk0x3c;
1187
1188 LegoTreeNode* node = m_unk0x34->GetAnimTreePtr()->GetRoot();
1189 LegoROI::FUN_100a8e80(node, mat, duration, m_unk0x34->GetROIMap());
1190 }
1191 else {
1192 roiMap[1] = m_unk0x38;
1193 ((Act3*) m_world)->RemovePizza(*m_nextPizza);
1194 m_nextPizza = NULL;
1195 roiMap[1]->SetVisibility(FALSE);
1196 roiMap[2]->SetVisibility(FALSE);
1197 }
1198}
1199
1200// FUNCTION: LEGO1 0x10042f30
1201void Act3Shark::ParseAction(char* p_extra)
1202{
1204
1205 m_world = CurrentWorld();
1206
1207 char value[256];
1208 if (KeyValueStringParse(value, g_strANIMATION, p_extra)) {
1209 char* token = strtok(value, g_parseExtraTokens);
1210
1211 while (token != NULL) {
1212 LegoLocomotionAnimPresenter* presenter =
1213 (LegoLocomotionAnimPresenter*) m_world->Find("LegoAnimPresenter", token);
1214
1215 if (presenter != NULL) {
1216 token = strtok(NULL, g_parseExtraTokens);
1217
1218 if (token != NULL) {
1219 presenter->FUN_1006d680(this, atof(token));
1220 }
1221 }
1222
1223 token = strtok(NULL, g_parseExtraTokens);
1224 }
1225 }
1226
1227 ((Act3*) m_world)->SetShark(this);
1228 m_unk0x34 = m_animMaps[0];
1229 m_unk0x38 = m_unk0x34->m_roiMap[1];
1230 m_unk0x38->SetVisibility(FALSE);
1231 m_world->PlaceActor(this);
1232}
#define MAX_DONUTS
[AI] Maximum number of donuts that can be handled in Act 3 logic.
Definition: act3.h:27
#define MAX_PIZZAS
[AI] Maximum number of pizzas that can be handled in Act 3 logic.
Definition: act3.h:25
Act3Cop::Act3CopDest g_copDest[5]
Definition: act3actors.cpp:32
[AI] Represents a generic animatable actor in Act 3, supporting path following and custom animation t...
Definition: act3actors.h:93
Act3Actor()
[AI] Constructs a new Act3Actor, initializing state.
Definition: act3actors.cpp:96
MxResult HitActor(LegoPathActor *p_actor, MxBool p_bool) override
[AI] Called when this actor is hit/collided by another actor, such as a projectile or another charact...
Definition: act3actors.cpp:152
MxU32 VTable0x90(float p_time, Matrix4 &p_transform) override
[AI] Handles transformation updates for the actor.
Definition: act3actors.cpp:103
Represents an ammo object (pizza or donut) used in Act 3 gameplay sequence.
Definition: act3ammo.h:15
void SetSharkFood(MxBool p_sharkFood)
Sets the "shark food" flag if this ammo should become food for a shark.
Definition: act3ammo.h:112
MxU32 IsSharkFood()
Returns true if the ammo became "shark food".
Definition: act3ammo.h:125
MxU32 IsValid()
Returns true if the ammo is valid (active in game/world).
Definition: act3ammo.h:51
[AI] Represents the Brickster actor in Act 3, with AI and scene logic for stealing pizzas and causing...
Definition: act3actors.h:245
MxResult HitActor(LegoPathActor *p_actor, MxBool p_bool) override
[AI] Handles Brickster being hit by an actor (e.g., cop, pizza ammo), processes pizza counters and de...
Definition: act3actors.cpp:741
MxResult FUN_100417c0()
[AI] Recalculates Brickster's navigation to a new plant/building/target as dictated by AI logic.
Definition: act3actors.cpp:788
void Animate(float p_time) override
[AI] Main logic for Brickster's per-frame AI behavior: handles pizza seeking, plant/building attacks,...
Definition: act3actors.cpp:571
void ParseAction(char *p_extra) override
[AI] Parses Brickster-specific commands from action strings; sets its world reference and triggers th...
Definition: act3actors.cpp:552
~Act3Brickster() override
[AI] Frees Brickster resources, implemented for correct inheritance.
Definition: act3actors.cpp:545
Act3Brickster()
[AI] Constructs a Brickster character, setting default animation and navigation state.
Definition: act3actors.cpp:526
MxResult FUN_100417a0(Act3Ammo &p_ammo, const Vector3 &)
[AI] Triggers the Brickster to react to a thrown pizza.
Definition: act3actors.cpp:777
MxResult VTable0x9c() override
[AI] Handles AI updates post pathfinding/state transition recalculation.
void SwitchBoundary(LegoPathBoundary *&p_boundary, LegoUnknown100db7f4 *&p_edge, float &p_unk0xe4) override
[AI] Switches navigation/path boundary for Brickster and updates edge and offset (stateful for when e...
[AI] Represents a police officer actor in Act 3, supporting specific cop AI actions,...
Definition: act3actors.h:158
MxResult FUN_10040360()
[AI] Internal: recalculates cop movement/path container target.
Definition: act3actors.cpp:326
void Animate(float p_time) override
[AI] Per-frame animation update, handles cop AI state switching to seek donuts, interact with Brickst...
Definition: act3actors.cpp:283
Act3Cop()
[AI] Constructs a new police officer actor, initializing references and default patrol states.
Definition: act3actors.cpp:177
MxResult VTable0x9c() override
[AI] Performs path container recalculation for cop AI movement.
Definition: act3actors.cpp:511
MxResult HitActor(LegoPathActor *, MxBool) override
[AI] Processes collision with another actor, especially for handling donut pickups and Brickster inte...
Definition: act3actors.cpp:186
MxResult FUN_10040350(Act3Ammo &p_ammo, const Vector3 &)
[AI] Triggers the cop to attempt to intercept or react to a thrown donut.
Definition: act3actors.cpp:319
void ParseAction(char *p_extra) override
[AI] Parses incoming action command strings for cop-specific data and registers itself with the world...
Definition: act3actors.cpp:221
[AI] Represents the shark actor for Act 3 of the LEGO Island game.
Definition: act3actors.h:21
Act3Shark()
[AI] Constructs a new Act3Shark object, initializing internal state.
void Animate(float p_time) override
[AI] Handles per-frame animation updates for the shark, synchronizing animation with pizza consumptio...
virtual MxResult EatPizza(Act3Ammo *p_ammo)
[AI] Called when the shark "eats" a pizza.
void ParseAction(char *) override
[AI] Handles additional parsing logic for shark-specific actions, such as animation triggers.
[AI] Controls all main logic and progression of Act 3 in LEGO Island, including objects,...
Definition: act3.h:182
Act3Cop * m_cop2
[AI] Second cop, instantiated when both are present.
Definition: act3.h:436
void EatPizza(MxS32 p_index)
[AI] Simulates eating (removing) a pizza from the world at the given index.
Definition: act3.cpp:255
Act3Ammo m_pizzas[MAX_PIZZAS]
[AI] All possible pizza projectiles/instances in flight for this sequence.
Definition: act3.h:432
Act3Brickster * m_brickster
[AI] Main antagonist.
Definition: act3.h:437
Act3Ammo m_donuts[MAX_DONUTS]
[AI] All possible donuts in flight/active for Act3's special logic.
Definition: act3.h:433
Act3Cop * m_cop1
[AI] First cop involved in sequence (player/AI).
Definition: act3.h:435
void ParseAction(char *p_extra) override
[AI] Handles extra action strings, looks for animation assignments and delegates to presenters (overr...
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...
void VTable0x74(Matrix4 &p_transform) override
[AI] Applies the current animation's transforms to the provided matrix, propagates to mesh hierarchie...
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 * 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.
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] 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.
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
MxFloat m_actorTime
[AI] Animation time for current path segment. [AI]
MxU32 GetActorState()
[AI] Gets the current navigation/animation state of the actor.
LegoUnknown100db7f4 * m_destEdge
[AI] Current or target edge for path traversal. [AI]
virtual MxBool GetUserNavFlag()
[AI] Returns user navigation state (whether actor follows player input).
LegoPathBoundary * m_boundary
[AI] Current boundary the actor is navigating on. [AI]
MxU32 m_actorState
[AI] State and flags bitfield for path following logic. [AI]
MxFloat m_unk0xe4
[AI] Position scalar on destination edge (0-1 across the edge). [AI]
void ParseAction(char *p_extra) override
[AI] Parses a set of key-value action commands and configures path navigation and collision for this ...
LegoPathController * m_pathController
[AI] Path controller/manages permitted boundaries for transitions. [AI]
@ c_maxState
[AI] Max actor state (reserved for logic). [AI]
Definition: legopathactor.h:42
@ 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
@ c_noCollide
[AI] Disables collision for this actor (e.g. ghosts, debug). [AI]
Definition: legopathactor.h:45
virtual MxResult VTable0x9c()
[AI] Handles exit transition and next-edge search logic; also used for collision reaction and fallbac...
MxMatrix m_unk0xec
[AI] World-to-local transformation matrix for this actor/ROI. [AI]
MxBool m_userNavFlag
[AI] TRUE if this actor is currently user/player controlled. [AI]
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]
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,...
void SwitchBoundary(LegoPathActor *p_actor, LegoPathBoundary *&p_boundary, LegoUnknown100db7f4 *&p_edge, float &p_unk0xe4)
[AI] Switches the boundary that the actor is associated with based on edge traversal.
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...
MxBool FUN_10026c50(LegoEntity *p_entity)
[AI] Triggers a growth decrement or similar on a plant entity, and updates accordingly if possible.
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
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
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
LegoU8 GetNumEdges()
[AI] Returns the number of edge elements assigned to this face.
Definition: legoweedge.h:43
LegoUnknown100db7f4 ** GetEdges()
[AI] Gets the array of pointers to the edge objects that form this face.
Definition: legoweedge.h:49
const LegoChar * GetName()
[AI] Returns the name string of this edge, typically used for debugging and lookup.
Definition: legowegedge.h:79
Mx4DPointFloat * GetEdgeNormal(int index)
[AI] Returns a pointer to the 4D edge normal at the given sub-edge index.
Definition: legowegedge.h:75
Mx4DPointFloat * GetUnknown0x14()
[AI] Returns a pointer to the cached 4D normal or reference plane for the edge.
Definition: legowegedge.h:70
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
LegoPathBoundary * FindPathBoundary(const char *p_name)
Finds a path boundary in all path controllers by name.
Definition: legoworld.cpp:385
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
4x4 Matrix class with virtual interface for manipulation and transformation.
Definition: matrix.h:24
void RotateX(const float &p_angle)
Applies a rotation (in radians or degrees, depending on implementation) about the X axis.
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
[AI] 4D point class for floating point values.
Definition: mxgeometry4d.h:18
float & index_operator(int idx)
[AI] Explicit indexed access wrapper (alias for operator[]).
Definition: mxgeometry4d.h:73
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
Definition: mxtimer.h:50
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 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
void Clear() override
[AI] Sets every coordinate (x, y, z) to zero.
float LenSquared() const override
[AI] Computes the squared magnitude (x^2 + y^2 + z^2) of this vector.
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 char * g_strANIMATION
[AI] Keyword used for tagging animation properties, types, or script commands.
Definition: define.cpp:9
const char * g_parseExtraTokens
[AI] Delimiter tokens for parsing extra parameters in scripts or command strings.
Definition: define.cpp:141
#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
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
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
Definition: mxdebug.h:55
MxTimer * Timer()
[AI] Returns the global simulation timer.
Definition: mxmisc.cpp:33
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 int MxU32
[AI]
Definition: mxtypes.h:32
MxBool KeyValueStringParse(char *, const char *, const char *)
Searches p_string for a key command and copies its associated value to p_output.
Definition: mxutilities.cpp:85
LegoPathBoundary * m_boundary
[AI] Cached pointer to the boundary object after resolving m_bName
Definition: act3actors.h:165
MxFloat m_unk0x08[3]
[AI] World coordinates for the destination or checkpoint [AI_SUGGESTED_NAME: destinationPos]
Definition: act3actors.h:166
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 ** m_roiMap
[AI] Mapping of animation nodes to LEGO ROIs (meshes) [AI]
Definition: legoanimactor.h:40
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,...
float m_y
[AI] World Y coordinate for the building's ground placement [AI]
LegoEntity * m_entity
[AI] Associated entity in the world for this building [AI]
float m_x
[AI] World X coordinate for the building's ground placement [AI]
float m_z
[AI] World Z coordinate for the building's ground placement [AI]
LegoPathBoundary * m_boundary
[AI] Pointer to the world boundary (collision/trigger volume) [AI]
MxS8 m_unk0x11
[AI] Counter or state value for construction/demolition progress [AI]
[AI] Represents an edge in the LEGO world geometry graph.
Definition: legoedge.h:16
Vector3 * CWVertex(LegoWEEdge &p_face)
[AI] Returns the "clockwise" endpoint of this edge with respect to a given face.
Definition: legoedge.cpp:56
Vector3 * GetPointA()
[AI] Gets the first endpoint (A) of the edge.
Definition: legoedge.h:82
Vector3 * GetPointB()
[AI] Gets the second endpoint (B) of the edge.
Definition: legoedge.h:88
Vector3 * CCWVertex(LegoWEEdge &p_face)
[AI] Returns the "counterclockwise" endpoint of this edge with respect to a given face.
Definition: legoedge.cpp:69
[AI] Container for path boundary edges, also stores position, direction, and flags.
Mx3DPointFloat m_direction
[AI] 3D direction vector reference, e.g., average or intended facing. [AI]
LegoPathBoundary * m_boundary
[AI] Associated boundary for all contained edges; may be null if container is generic....
Mx3DPointFloat m_position
[AI] 3D position reference for the edge group, e.g., start or mean location. [AI]
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
MxS8 m_unk0x16
[AI] Unknown; appears to be a state variable, possibly animation frame or LOD index [AI]
Definition: legoplants.h:58
float m_z
[AI] World Z position (depth/axis in world) [AI]
Definition: legoplants.h:64
LegoPathBoundary * m_boundary
[AI] Pointer to a collision or path boundary for this plant, if any [AI]
Definition: legoplants.h:65
float m_y
[AI] World Y position (vertical/elevation) [AI]
Definition: legoplants.h:63
float m_x
[AI] World X position (center or reference) [AI]
Definition: legoplants.h:62
LegoEntity * m_entity
[AI] Pointer to the associated entity instance (initialized later at runtime) [AI]
Definition: legoplants.h:51
float m_position[3]
[AI] Alternate position array (likely for display, reference, or bounding computations) [AI]
Definition: legoplants.h:66
[AI] Represents an advanced edge in the LEGO Island geometry system, with direction,...
LegoU32 GetMask0x03()
[AI] Returns a mask of flags relevant to the two faces (bits 0 and 1: c_bit1, c_bit2).
@ c_bit1
[AI] Bit flag 1 for face B connection/properties
LegoU32 FUN_10048c40(const Vector3 &p_position)
[AI] Tests if a position is on this edge based on its direction and points, within a precision thresh...
LegoWEEdge * OtherFace(LegoWEEdge *p_other)
[AI] Returns the opposite face pointer to the one passed in.