Isle
Loading...
Searching...
No Matches
legocharactermanager.cpp
Go to the documentation of this file.
2
4#include "legoactors.h"
5#include "legoanimactor.h"
7#include "legoextraactor.h"
8#include "legogamestate.h"
9#include "legoplantmanager.h"
10#include "legovideomanager.h"
11#include "misc.h"
12#include "misc/legocontainer.h"
13#include "misc/legostorage.h"
14#include "mxmisc.h"
15#include "mxvariabletable.h"
16#include "realtime/realtime.h"
17#include "roi/legolod.h"
19
20#include <assert.h>
21#include <vec.h>
22
26
27// GLOBAL: LEGO1 0x100fc4d0
28MxU32 LegoCharacterManager::g_maxMove = 4;
29
30// GLOBAL: LEGO1 0x100fc4d4
31MxU32 LegoCharacterManager::g_maxSound = 9;
32
33// GLOBAL: LEGO1 0x100fc4e0
35
36// GLOBAL: LEGO1 0x100fc4e4
37char* LegoCharacterManager::g_customizeAnimFile = NULL;
38
39// GLOBAL: LEGO1 0x100fc4d8
41
42// GLOBAL: LEGO1 0x100fc4dc
44
45// GLOBAL: LEGO1 0x100fc4e8
47
48// GLOBAL: LEGO1 0x100fc4ec
50
51// GLOBAL: LEGO1 0x100fc4f0
53
54// GLOBAL: LEGO1 0x10104f20
56
57// FUNCTION: LEGO1 0x10082a20
58// FUNCTION: BETA10 0x10073c60
60{
61 m_characters = new LegoCharacterMap();
62 Init(); // DECOMP: inlined here in BETA10
63
64 m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE");
65 VariableTable()->SetVariable(m_customizeAnimFile);
66}
67
68// FUNCTION: LEGO1 0x10083180
69// FUNCTION: BETA10 0x10073dad
71{
72 LegoCharacter* character = NULL;
73 LegoCharacterMap::iterator it;
74
75 for (it = m_characters->begin(); it != m_characters->end(); it++) {
76 character = (*it).second;
77
78 RemoveROI(character->m_roi);
79
80 delete[] (*it).first;
81 delete (*it).second;
82 }
83
84 delete m_characters;
85 delete[] g_customizeAnimFile;
86}
87
88// FUNCTION: LEGO1 0x10083270
90{
91 for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
93 }
94}
95
96// FUNCTION: LEGO1 0x100832a0
98{
99 for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
100 LegoActorInfo* info = GetActorInfo(g_actorInfo[i].m_name);
101
102 if (info != NULL) {
103 LegoExtraActor* actor = info->m_actor;
104
105 if (actor != NULL && actor->IsA("LegoExtraActor")) {
106 LegoROI* roi = g_actorInfo[i].m_roi;
107 MxU32 refCount = GetRefCount(roi);
108
109 while (refCount != 0) {
110 ReleaseActor(roi);
111 refCount = GetRefCount(roi);
112 }
113 }
114 }
115 }
116}
117
118// FUNCTION: LEGO1 0x10083310
120{
121 MxResult result = FAILURE;
122
123 for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
124 LegoActorInfo* info = &g_actorInfo[i];
125
126 if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
127 goto done;
128 }
129 if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
130 goto done;
131 }
132 if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
133 goto done;
134 }
135 if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) !=
136 SUCCESS) {
137 goto done;
138 }
139 if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) !=
140 SUCCESS) {
141 goto done;
142 }
143 if (p_storage->Write(
145 sizeof(info->m_parts[c_infogronPart].m_unk0x14)
146 ) != SUCCESS) {
147 goto done;
148 }
149 if (p_storage->Write(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) !=
150 SUCCESS) {
151 goto done;
152 }
153 if (p_storage->Write(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) !=
154 SUCCESS) {
155 goto done;
156 }
157 if (p_storage->Write(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) !=
158 SUCCESS) {
159 goto done;
160 }
161 if (p_storage->Write(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) !=
162 SUCCESS) {
163 goto done;
164 }
165 }
166
167 result = SUCCESS;
168
169done:
170 return result;
171}
172
173// FUNCTION: LEGO1 0x100833f0
175{
176 MxResult result = FAILURE;
177
178 for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
179 LegoActorInfo* info = &g_actorInfo[i];
180
181 if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
182 goto done;
183 }
184 if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
185 goto done;
186 }
187 if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
188 goto done;
189 }
190 if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) !=
191 SUCCESS) {
192 goto done;
193 }
194 if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) !=
195 SUCCESS) {
196 goto done;
197 }
198 if (p_storage->Read(
200 sizeof(info->m_parts[c_infogronPart].m_unk0x14)
201 ) != SUCCESS) {
202 goto done;
203 }
204 if (p_storage->Read(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) !=
205 SUCCESS) {
206 goto done;
207 }
208 if (p_storage->Read(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) !=
209 SUCCESS) {
210 goto done;
211 }
212 if (p_storage->Read(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) !=
213 SUCCESS) {
214 goto done;
215 }
216 if (p_storage->Read(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) !=
217 SUCCESS) {
218 goto done;
219 }
220 }
221
222 result = SUCCESS;
223
224done:
225 return result;
226}
227
228// FUNCTION: LEGO1 0x100834d0
229// FUNCTION: BETA10 0x100742eb
231{
232 if (p_index < sizeOfArray(g_actorInfo)) {
233 return g_actorInfo[p_index].m_name;
234 }
235 else {
236 return NULL;
237 }
238}
239
240// FUNCTION: LEGO1 0x100834f0
241// FUNCTION: BETA10 0x1007432a
243{
244 return sizeOfArray(g_actorInfo);
245}
246
247// FUNCTION: LEGO1 0x10083500
248// FUNCTION: BETA10 0x10074345
249LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEntity)
250{
251 LegoCharacter* character = NULL;
252 LegoCharacterMap::const_iterator it = m_characters->find(const_cast<char*>(p_name));
253
254 if (!(it == m_characters->end())) {
255 character = (*it).second;
256 character->AddRef();
257 }
258
259 if (character == NULL) {
260 LegoROI* roi = CreateActorROI(p_name);
261
262 if (roi != NULL) {
263 roi->SetVisibility(FALSE);
264
265 character = new LegoCharacter(roi);
266 char* name = new char[strlen(p_name) + 1];
267
268 if (name != NULL) {
269 strcpy(name, p_name);
270 (*m_characters)[name] = character;
271 VideoManager()->Get3DManager()->Add(*roi);
272 }
273 }
274 }
275 else {
276 VideoManager()->Get3DManager()->Remove(*character->m_roi);
277 VideoManager()->Get3DManager()->Add(*character->m_roi);
278 }
279
280 if (character != NULL) {
281 if (p_createEntity && character->m_roi->GetEntity() == NULL) {
282 LegoExtraActor* actor = new LegoExtraActor();
283
284 actor->SetROI(character->m_roi, FALSE, FALSE);
287 GetActorInfo(p_name)->m_actor = actor;
288 }
289
290 return character->m_roi;
291 }
292 else {
293 return NULL;
294 }
295}
296
297// FUNCTION: LEGO1 0x10083b20
298// FUNCTION: BETA10 0x10074608
300{
301 LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
302
303 if (it != m_characters->end()) {
304 return TRUE;
305 }
306
307 return FALSE;
308}
309
310// FUNCTION: LEGO1 0x10083bc0
312{
313 LegoCharacterMap::iterator it;
314
315 for (it = m_characters->begin(); it != m_characters->end(); it++) {
316 LegoCharacter* character = (*it).second;
317 LegoROI* roi = character->m_roi;
318
319 if (roi == p_roi) {
320 return character->m_refCount;
321 }
322 }
323
324 return 0;
325}
326
327// FUNCTION: LEGO1 0x10083c30
328// FUNCTION: BETA10 0x10074701
330{
331 LegoCharacter* character = NULL;
332 LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
333
334 if (it != m_characters->end()) {
335 character = (*it).second;
336
337 if (character->RemoveRef() == 0) {
338 LegoActorInfo* info = GetActorInfo(p_name);
339 LegoEntity* entity = character->m_roi->GetEntity();
340
341 if (entity != NULL) {
342 entity->SetROI(NULL, FALSE, FALSE);
343 }
344
345 RemoveROI(character->m_roi);
346
347 delete[] (*it).first;
348 delete (*it).second;
349
350 m_characters->erase(it);
351
352 if (info != NULL) {
353 if (info->m_actor != NULL) {
355 delete info->m_actor;
356 }
357 else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
359 delete entity;
360 }
361
362 info->m_roi = NULL;
363 info->m_actor = NULL;
364 }
365 }
366 }
367}
368
369// FUNCTION: LEGO1 0x10083db0
371{
372 LegoCharacter* character = NULL;
373 LegoCharacterMap::iterator it;
374
375 for (it = m_characters->begin(); it != m_characters->end(); it++) {
376 character = (*it).second;
377
378 if (character->m_roi == p_roi) {
379 if (character->RemoveRef() == 0) {
380 LegoActorInfo* info = GetActorInfo(character->m_roi->GetName());
381 LegoEntity* entity = character->m_roi->GetEntity();
382
383 if (entity != NULL) {
384 entity->SetROI(NULL, FALSE, FALSE);
385 }
386
387 RemoveROI(character->m_roi);
388
389 delete[] (*it).first;
390 delete (*it).second;
391
392 m_characters->erase(it);
393
394 if (info != NULL) {
395 if (info->m_actor != NULL) {
397 delete info->m_actor;
398 }
399 else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
401 delete entity;
402 }
403
404 info->m_roi = NULL;
405 info->m_actor = NULL;
406 }
407 }
408
409 return;
410 }
411 }
412}
413
414// FUNCTION: LEGO1 0x10083f10
416{
417 LegoCharacter* character = NULL;
418 LegoCharacterMap::iterator it;
419
420 for (it = m_characters->begin(); it != m_characters->end(); it++) {
421 character = (*it).second;
422
423 if (character->m_roi == p_roi) {
424 if (character->RemoveRef() == 0) {
425 LegoEntity* entity = character->m_roi->GetEntity();
426
427 if (entity != NULL) {
428 entity->SetROI(NULL, FALSE, FALSE);
429 }
430
431 RemoveROI(character->m_roi);
432
433 delete[] (*it).first;
434 delete (*it).second;
435
436 m_characters->erase(it);
437
438 if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
440 delete entity;
441 }
442 }
443
444 return;
445 }
446 }
447}
448
449// FUNCTION: LEGO1 0x10084010
450// FUNCTION: BETA10 0x10074e20
451void LegoCharacterManager::RemoveROI(LegoROI* p_roi)
452{
453 VideoManager()->Get3DManager()->Remove(*p_roi);
454}
455
456// FUNCTION: LEGO1 0x10084030
457// FUNCTION: BETA10 0x10074e4f
458LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
459{
460 MxBool success = FALSE;
461 LegoROI* roi = NULL;
462 BoundingSphere boundingSphere;
463 BoundingBox boundingBox;
464 MxMatrix mat;
465 CompoundObject* comp;
466 MxS32 i;
467
468 Tgl::Renderer* renderer = VideoManager()->GetRenderer();
470 LegoTextureContainer* textureContainer = TextureContainer();
471 LegoActorInfo* info = GetActorInfo(p_key);
472
473 if (info == NULL) {
474 goto done;
475 }
476
477 if (!strcmpi(p_key, "pep")) {
478 LegoActorInfo* pepper = GetActorInfo("pepper");
479
480 info->m_sound = pepper->m_sound;
481 info->m_move = pepper->m_move;
482 info->m_mood = pepper->m_mood;
483
484 for (i = 0; i < sizeOfArray(info->m_parts); i++) {
485 info->m_parts[i] = pepper->m_parts[i];
486 }
487 }
488
489 roi = new LegoROI(renderer);
490 roi->SetName(p_key);
491
492 boundingSphere.Center()[0] = g_actorLODs[c_topLOD].m_boundingSphere[0];
493 boundingSphere.Center()[1] = g_actorLODs[c_topLOD].m_boundingSphere[1];
494 boundingSphere.Center()[2] = g_actorLODs[c_topLOD].m_boundingSphere[2];
495 boundingSphere.Radius() = g_actorLODs[c_topLOD].m_boundingSphere[3];
496 roi->SetBoundingSphere(boundingSphere);
497
498 boundingBox.Min()[0] = g_actorLODs[c_topLOD].m_boundingBox[0];
499 boundingBox.Min()[1] = g_actorLODs[c_topLOD].m_boundingBox[1];
500 boundingBox.Min()[2] = g_actorLODs[c_topLOD].m_boundingBox[2];
501 boundingBox.Max()[0] = g_actorLODs[c_topLOD].m_boundingBox[3];
502 boundingBox.Max()[1] = g_actorLODs[c_topLOD].m_boundingBox[4];
503 boundingBox.Max()[2] = g_actorLODs[c_topLOD].m_boundingBox[5];
504 roi->SetUnknown0x80(boundingBox);
505
506 comp = new CompoundObject();
507 roi->SetComp(comp);
508
509 for (i = 0; i < sizeOfArray(g_actorLODs) - 1; i++) {
510 char lodName[256];
511 LegoActorInfo::Part& part = info->m_parts[i];
512
513 const char* parentName;
514 if (i == 0 || i == 1) {
515 parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]];
516 }
517 else {
518 parentName = g_actorLODs[i + 1].m_parentName;
519 }
520
521 ViewLODList* lodList = lodManager->Lookup(parentName);
522 MxS32 lodSize = lodList->Size();
523 sprintf(lodName, "%s%d", p_key, i);
524 ViewLODList* dupLodList = lodManager->Create(lodName, lodSize);
525
526 for (MxS32 j = 0; j < lodSize; j++) {
527 LegoLOD* lod = (LegoLOD*) (*lodList)[j];
528 LegoLOD* clone = lod->Clone(renderer);
529 dupLodList->PushBack(clone);
530 }
531
532 lodList->Release();
533 lodList = dupLodList;
534
535 LegoROI* childROI = new LegoROI(renderer, lodList);
536 lodList->Release();
537
538 childROI->SetName(g_actorLODs[i + 1].m_name);
539 childROI->SetParentROI(roi);
540
541 BoundingSphere childBoundingSphere;
542 childBoundingSphere.Center()[0] = g_actorLODs[i + 1].m_boundingSphere[0];
543 childBoundingSphere.Center()[1] = g_actorLODs[i + 1].m_boundingSphere[1];
544 childBoundingSphere.Center()[2] = g_actorLODs[i + 1].m_boundingSphere[2];
545 childBoundingSphere.Radius() = g_actorLODs[i + 1].m_boundingSphere[3];
546 childROI->SetBoundingSphere(childBoundingSphere);
547
548 BoundingBox childBoundingBox;
549 childBoundingBox.Min()[0] = g_actorLODs[i + 1].m_boundingBox[0];
550 childBoundingBox.Min()[1] = g_actorLODs[i + 1].m_boundingBox[1];
551 childBoundingBox.Min()[2] = g_actorLODs[i + 1].m_boundingBox[2];
552 childBoundingBox.Max()[0] = g_actorLODs[i + 1].m_boundingBox[3];
553 childBoundingBox.Max()[1] = g_actorLODs[i + 1].m_boundingBox[4];
554 childBoundingBox.Max()[2] = g_actorLODs[i + 1].m_boundingBox[5];
555 childROI->SetUnknown0x80(childBoundingBox);
556
558 Mx3DPointFloat(g_actorLODs[i + 1].m_position),
559 Mx3DPointFloat(g_actorLODs[i + 1].m_direction),
560 Mx3DPointFloat(g_actorLODs[i + 1].m_up),
561 mat
562 );
563 childROI->WrappedSetLocalTransform(mat);
564
565 if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag1 && (i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) {
566
567 LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
568
569 if (textureInfo != NULL) {
570 childROI->SetTextureInfo(textureInfo);
571 childROI->SetLodColor(1.0F, 1.0F, 1.0F, 0.0F);
572 }
573 }
574 else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) {
575 LegoFloat red, green, blue, alpha;
576 childROI->GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
577 childROI->SetLodColor(red, green, blue, alpha);
578 }
579
580 comp->push_back(childROI);
581 }
582
585 Mx3DPointFloat(g_actorLODs[c_topLOD].m_direction),
587 mat
588 );
589 roi->WrappedSetLocalTransform(mat);
590
591 info->m_roi = roi;
592 success = TRUE;
593
594done:
595 if (!success && roi != NULL) {
596 delete roi;
597 roi = NULL;
598 }
599
600 return roi;
601}
602
603// FUNCTION: LEGO1 0x100849a0
604// FUNCTION: BETA10 0x10075b51
606{
607 LegoResult result = SUCCESS;
608 LegoROI* head = FindChildROI(p_roi, g_actorLODs[c_headLOD].m_name);
609
610 if (head != NULL) {
611 char lodName[256];
612
613 ViewLODList* lodList = GetViewLODListManager()->Lookup(g_actorLODs[c_headLOD].m_parentName);
614 assert(lodList);
615
616 MxS32 lodSize = lodList->Size();
617 sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++);
618 ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
619 assert(dupLodList);
620
621 Tgl::Renderer* renderer = VideoManager()->GetRenderer();
622
623 if (p_texture == NULL) {
624 LegoActorInfo* info = GetActorInfo(p_roi->GetName());
625 assert(info);
626
628 p_texture = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
629 assert(p_texture);
630 }
631
632 for (MxS32 i = 0; i < lodSize; i++) {
633 LegoLOD* lod = (LegoLOD*) (*lodList)[i];
634 LegoLOD* clone = lod->Clone(renderer);
635
636 if (p_texture != NULL) {
637 clone->FUN_100aad70(p_texture);
638 }
639
640 dupLodList->PushBack(clone);
641 }
642
643 lodList->Release();
644 lodList = dupLodList;
645
646 if (head->GetUnknown0xe0() >= 0) {
648 }
649
650 head->SetLODList(lodList);
651 lodList->Release();
652 }
653
654 return head != NULL;
655}
656
657// FUNCTION: LEGO1 0x10084c00
659{
660 for (MxU32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
661 if (!strcmpi(g_actorInfo[i].m_name, p_name)) {
662 return TRUE;
663 }
664 }
665
666 return FALSE;
667}
668
669// FUNCTION: LEGO1 0x10084c40
671{
672 LegoActorInfo* info = GetActorInfo(p_name);
673
674 if (info != NULL) {
675 return info->m_actor;
676 }
677
678 return NULL;
679}
680
681// FUNCTION: LEGO1 0x10084c60
682// FUNCTION: BETA10 0x10075ede
684{
685 MxU32 i;
686
687 for (i = 0; i < sizeOfArray(g_actorInfo); i++) {
688 if (!strcmpi(g_actorInfo[i].m_name, p_name)) {
689 break;
690 }
691 }
692
693 if (i < sizeOfArray(g_actorInfo)) {
694 return &g_actorInfo[i];
695 }
696 else {
697 return NULL;
698 }
699}
700
701// FUNCTION: LEGO1 0x10084cb0
702// FUNCTION: BETA10 0x10075f66
704{
705 MxU32 i;
706
707 for (i = 0; i < sizeOfArray(g_actorInfo); i++) {
708 if (g_actorInfo[i].m_roi == p_roi) {
709 break;
710 }
711 }
712
713 if (i < sizeOfArray(g_actorInfo)) {
714 return &g_actorInfo[i];
715 }
716 else {
717 return NULL;
718 }
719}
720
721// FUNCTION: LEGO1 0x10084cf0
722// FUNCTION: BETA10 0x10075fe2
723LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
724{
725#ifdef COMPAT_MODE
726 CompoundObject::const_iterator it;
727#else
728 CompoundObject::iterator it;
729#endif
730
731 const CompoundObject* comp = p_roi->GetComp();
732
733 for (it = comp->begin(); it != comp->end(); it++) {
734 LegoROI* roi = (LegoROI*) *it;
735
736 if (!strcmpi(p_name, roi->GetName())) {
737 return roi;
738 }
739 }
740
741 return NULL;
742}
743
744// FUNCTION: LEGO1 0x10084d50
745// FUNCTION: BETA10 0x10076223
747{
748 MxS32 numParts = 10;
749 const char* targetName = p_targetROI->GetName();
750
751 MxS32 partIndex;
752 for (partIndex = 0; partIndex < numParts; partIndex++) {
753 if (!strcmp(targetName, g_actorLODs[partIndex + 1].m_name)) {
754 break;
755 }
756 }
757
758 assert(partIndex < numParts);
759
760 MxBool findChild = TRUE;
761 if (partIndex == 6) {
762 partIndex = 4;
763 }
764 else if (partIndex == 7) {
765 partIndex = 5;
766 }
767 else if (partIndex == 3) {
768 partIndex = 1;
769 }
770 else if (partIndex == 0) {
771 partIndex = 2;
772 }
773 else {
774 findChild = FALSE;
775 }
776
777 if (!(g_actorLODs[partIndex + 1].m_flags & LegoActorLOD::c_flag2)) {
778 return FALSE;
779 }
780
781 LegoActorInfo* info = GetActorInfo(p_roi->GetName());
782
783 if (info == NULL) {
784 return FALSE;
785 }
786
787 if (findChild) {
788 p_targetROI = FindChildROI(p_roi, g_actorLODs[partIndex + 1].m_name);
789 }
790
791 LegoActorInfo::Part& part = info->m_parts[partIndex];
792
793 part.m_unk0x14++;
794 if (part.m_unk0x0c[part.m_unk0x14] == 0xff) {
795 part.m_unk0x14 = 0;
796 }
797
798 LegoFloat red, green, blue, alpha;
799 LegoROI::GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
800 p_targetROI->SetLodColor(red, green, blue, alpha);
801 return TRUE;
802}
803
804// FUNCTION: LEGO1 0x10084ec0
806{
807 LegoActorInfo* info = GetActorInfo(p_roi->GetName());
808
809 if (info == NULL) {
810 return FALSE;
811 }
812
814
815 part.m_unk0x08++;
816 MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08];
817
818 if (unk0x00 == 0xff) {
819 part.m_unk0x08 = 0;
820 unk0x00 = part.m_unk0x00[part.m_unk0x08];
821 }
822
823 LegoROI* childROI = FindChildROI(p_roi, g_actorLODs[c_infohatLOD].m_name);
824
825 if (childROI != NULL) {
826 char lodName[256];
827
828 ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_unk0x04[unk0x00]);
829 MxS32 lodSize = lodList->Size();
830 sprintf(lodName, "%s%d", p_roi->GetName(), g_unk0x100fc4ec++);
831 ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
832
833 Tgl::Renderer* renderer = VideoManager()->GetRenderer();
834 LegoFloat red, green, blue, alpha;
835 LegoROI::GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
836
837 for (MxS32 i = 0; i < lodSize; i++) {
838 LegoLOD* lod = (LegoLOD*) (*lodList)[i];
839 LegoLOD* clone = lod->Clone(renderer);
840 clone->SetColor(red, green, blue, alpha);
841 dupLodList->PushBack(clone);
842 }
843
844 lodList->Release();
845 lodList = dupLodList;
846
847 if (childROI->GetUnknown0xe0() >= 0) {
849 }
850
851 childROI->SetLODList(lodList);
852 lodList->Release();
853 }
854
855 return TRUE;
856}
857
858// FUNCTION: LEGO1 0x10085090
859// FUNCTION: BETA10 0x100766f6
861{
862 MxBool result = FALSE;
863 LegoActorInfo* info = GetActorInfo(p_roi);
864
865 if (info != NULL) {
866 info->m_sound++;
867
868 if (info->m_sound >= g_maxSound) {
869 info->m_sound = 0;
870 }
871
872 result = TRUE;
873 }
874
875 return result;
876}
877
878// FUNCTION: LEGO1 0x100850c0
879// FUNCTION: BETA10 0x10076754
881{
882 MxBool result = FALSE;
883 LegoActorInfo* info = GetActorInfo(p_roi);
884
885 if (info != NULL) {
886 info->m_move++;
887
888 if (info->m_move >= g_maxMove) {
889 info->m_move = 0;
890 }
891
892 result = TRUE;
893 }
894
895 return result;
896}
897
898// FUNCTION: LEGO1 0x100850f0
899// FUNCTION: BETA10 0x100767b2
901{
902 MxBool result = FALSE;
903 LegoActorInfo* info = GetActorInfo(p_roi);
904
905 if (info != NULL) {
906 info->m_mood++;
907
908 if (info->m_mood > 3) {
909 info->m_mood = 0;
910 }
911
912 result = TRUE;
913 }
914
915 return result;
916}
917
918// FUNCTION: LEGO1 0x10085120
919// FUNCTION: BETA10 0x1007680c
921{
922 LegoActorInfo* info = GetActorInfo(p_roi);
923
924 if (info != NULL) {
925 return info->m_move + g_characterAnimationId;
926 }
927 else {
928 return 0;
929 }
930}
931
932// FUNCTION: LEGO1 0x10085140
933// FUNCTION: BETA10 0x10076855
935{
936 LegoActorInfo* info = GetActorInfo(p_roi);
937
938 if (p_und) {
939 return info->m_mood + g_unk0x100fc4dc;
940 }
941
942 if (info != NULL) {
943 return info->m_sound + g_unk0x100fc4d8;
944 }
945 else {
946 return 0;
947 }
948}
949
950// FUNCTION: LEGO1 0x10085180
951// FUNCTION: BETA10 0x100768c5
953{
954 LegoActorInfo* info = GetActorInfo(p_roi);
955
956 if (info != NULL) {
957 return info->m_mood;
958 }
959 else {
960 return 0;
961 }
962}
963
964// FUNCTION: LEGO1 0x100851a0
966{
967 if (g_customizeAnimFile != NULL) {
968 delete[] g_customizeAnimFile;
969 }
970
971 if (p_value != NULL) {
972 g_customizeAnimFile = new char[strlen(p_value) + 1];
973
974 if (g_customizeAnimFile != NULL) {
975 strcpy(g_customizeAnimFile, p_value);
976 }
977 }
978 else {
979 g_customizeAnimFile = NULL;
980 }
981}
982
983// FUNCTION: LEGO1 0x10085210
984// FUNCTION: BETA10 0x10076995
985LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity)
986{
987 LegoROI* roi = NULL;
988
989 MxMatrix mat;
990 Tgl::Renderer* renderer = VideoManager()->GetRenderer();
992 LegoTextureContainer* textureContainer = TextureContainer();
993 ViewLODList* lodList = lodManager->Lookup(p_lodName);
994
995 if (lodList == NULL || lodList->Size() == 0) {
996 return NULL;
997 }
998
999 roi = new LegoROI(renderer, lodList);
1000
1001 const char* name;
1002 char buf[20];
1003
1004 if (p_name != NULL) {
1005 name = p_name;
1006 }
1007 else {
1008 sprintf(buf, "autoROI_%d", g_unk0x100fc4f0++);
1009 name = buf;
1010 }
1011
1012 roi->SetName(name);
1013 lodList->Release();
1014
1015 if (roi != NULL && FUN_10085870(roi) != SUCCESS) {
1016 delete roi;
1017 roi = NULL;
1018 }
1019
1020 if (roi != NULL) {
1021 roi->SetVisibility(FALSE);
1022
1023 LegoCharacter* character = new LegoCharacter(roi);
1024 char* key = new char[strlen(name) + 1];
1025
1026 if (key != NULL) {
1027 strcpy(key, name);
1028 (*m_characters)[key] = character;
1029 VideoManager()->Get3DManager()->Add(*roi);
1030
1031 if (p_createEntity && roi->GetEntity() == NULL) {
1032 LegoEntity* entity = new LegoEntity();
1033
1034 entity->SetROI(roi, FALSE, FALSE);
1037 }
1038 }
1039 }
1040
1041 return roi;
1042}
1043
1044// FUNCTION: LEGO1 0x10085870
1046{
1047 MxResult result = FAILURE;
1048
1049 BoundingSphere boundingSphere;
1050 BoundingBox boundingBox;
1051
1052 const Tgl::MeshBuilder* meshBuilder = ((ViewLOD*) p_roi->GetLOD(0))->GetMeshBuilder();
1053
1054 if (meshBuilder != NULL) {
1055 float min[3], max[3];
1056
1057 FILLVEC3(min, 88888.0);
1058 FILLVEC3(max, -88888.0);
1059 meshBuilder->GetBoundingBox(min, max);
1060
1061 float center[3];
1062 center[0] = (min[0] + max[0]) / 2.0f;
1063 center[1] = (min[1] + max[1]) / 2.0f;
1064 center[2] = (min[2] + max[2]) / 2.0f;
1065 SET3(boundingSphere.Center(), center);
1066
1067 float radius[3];
1068 VMV3(radius, max, min);
1069 boundingSphere.Radius() = sqrt(NORMSQRD3(radius)) / 2.0;
1070
1071 p_roi->SetBoundingSphere(boundingSphere);
1072
1073 SET3(boundingBox.Min(), min);
1074 SET3(boundingBox.Max(), max);
1075
1076 p_roi->SetUnknown0x80(boundingBox);
1077
1078 p_roi->VTable0x14();
1079
1080 result = SUCCESS;
1081 }
1082
1083 return result;
1084}
1085
1086// FUNCTION: LEGO1 0x10085a80
1087LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity)
1088{
1089 return CreateAutoROI(p_name, p_lodName, p_createEntity);
1090}
1091
1092// FUNCTION: LEGO1 0x10085aa0
1094{
1095 m_key = p_key;
1097}
1098
1099// FUNCTION: LEGO1 0x10085b50
1101{
1102 // STRING: LEGO1 0x100fc4f4
1103 if (strcmp(m_key.GetData(), "CUSTOMIZE_ANIM_FILE") == 0) {
1107 }
1108}
[AI] Represents an axis-aligned bounding box in 3D space, using minimum and maximum points.
Definition: roi.h:20
const Vector3 & Min() const
[AI] Const accessor for the minimum corner of the bounding box.
Definition: roi.h:26
const Vector3 & Max() const
[AI] Const accessor for the maximum corner of the bounding box.
Definition: roi.h:36
[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
const Vector3 & Center() const
[AI] Const accessor for the center of the sphere.
Definition: roi.h:62
[AI] MxVariable subclass used to represent and propagate changes to the character customization anima...
CustomizeAnimFileVariable(const char *p_key)
[AI] Constructs the variable and sets its key (converted to uppercase).
void SetValue(const char *p_value) override
[AI] Sets the variable value and propagates customization file changes to relevant managers.
size_t Size() const
[AI] Returns the current number of LODObject pointers contained.
Definition: lodlist.h:165
const T * PushBack(const T *)
[AI] Typed append.
Definition: lodlist.h:243
BOOL Add(ViewROI &rROI)
[AI] Adds a ViewROI (rendered object) to the scene.
Lego3DView * GetLego3DView()
[AI] Returns the encapsulated Lego3DView instance.
BOOL Remove(ViewROI &rROI)
[AI] Removes a ViewROI from the scene.
ViewManager * GetViewManager()
[AI] Returns the ViewManager responsible for managing scene objects and transformations.
Definition: lego3dview.h:154
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
static void SetCustomizeAnimFile(const char *p_value)
[AI] Sets the global filename for a custom "customize animation" SMK/FLC file.
[AI] Manages reference-counted characters and provides character creation, switching,...
MxBool SwitchMood(LegoROI *p_roi)
[AI] Cycles the mood type for the actor, updating the per-actor info.
LegoActorInfo * GetActorInfo(const char *p_name)
[AI] Returns the actor info struct for the character of the given name, or NULL if not found.
MxResult Write(LegoStorage *p_storage)
[AI] Writes the persistent character info data to a storage object.
void ReleaseAllActors()
[AI] Releases all actors associated with this manager, unregistering/releasing references until destr...
MxU32 GetNumActors()
[AI] Returns the number of actors registered in global g_actorInfo.
void Init()
[AI] Initializes all actor info structures based on their templates/defaults.
LegoExtraActor * GetExtraActor(const char *p_name)
[AI] Returns an extra actor associated with a given character name, or NULL if not found.
MxU32 GetSoundId(LegoROI *p_roi, MxBool p_und)
[AI] Returns the sound ID for the ROI's current sound/mood selection.
MxResult Read(LegoStorage *p_storage)
[AI] Reads character info data from a storage object.
LegoROI * CreateAutoROI(const char *p_name, const char *p_lodName, MxBool p_createEntity)
[AI] Creates an "auto" ROI object with the given name, LOD name, and optional entity creation.
static void SetCustomizeAnimFile(const char *p_value)
[AI] Sets the value of the customization animation file variable, propagating to all relevant subsyst...
MxU8 GetMood(LegoROI *p_roi)
[AI] Returns the current mood value (0-3) for the actor associated with the ROI.
MxResult FUN_10085870(LegoROI *p_roi)
[AI] Initializes auto-ROI with bounding volume and transformation.
MxU32 GetRefCount(LegoROI *p_roi)
[AI] Returns the reference count for a given LegoROI* tracked by the manager.
static MxBool IsActor(const char *p_name)
[AI] Checks if the given name matches an actor in the global actor table (case-insensitive).
~LegoCharacterManager()
[AI] Destroys the manager, cleaning up all managed characters and animation customization state.
void ReleaseActor(const char *p_name)
[AI] Releases a character/ROI by name, decrementing its reference count and deleting if zero.
LegoROI * GetActorROI(const char *p_name, MxBool p_createEntity)
[AI] Returns a LegoROI for the given character name, creating and registering the actor if necessary.
MxBool SwitchColor(LegoROI *p_roi, LegoROI *p_targetROI)
[AI] Changes the color of a part of a character's ROI, updating its part info index and updating ROI ...
MxBool SwitchSound(LegoROI *p_roi)
[AI] Cycles the sound type for the actor, updating the per-actor info.
MxBool FUN_100849a0(LegoROI *p_roi, LegoTextureInfo *p_texture)
[AI] Replaces the head LOD of a character ROI with a new LOD list built using the provided texture.
MxBool SwitchVariant(LegoROI *p_roi)
[AI] Cycles through part variants (e.g.
void ReleaseAutoROI(LegoROI *p_roi)
[AI] Releases an "auto" ROI, used for dynamically created ROI objects by this manager.
MxBool Exists(const char *p_name)
[AI] Returns whether a character with the given name exists in the manager.
LegoROI * FUN_10085a80(const char *p_name, const char *p_lodName, MxBool p_createEntity)
[AI] Helper function that delegates to CreateAutoROI.
MxBool SwitchMove(LegoROI *p_roi)
[AI] Cycles the move type for the actor, updating the per-actor info.
const char * GetActorName(MxS32 p_index)
[AI] Returns the actor name for the given actor index (lookup in global g_actorInfo table).
MxU32 GetAnimationId(LegoROI *p_roi)
[AI] Returns an animation ID corresponding to the ROI's move index.
T * Get(const char *p_name)
Retrieve the element mapped to the given name, or nullptr if missing.
Definition: legocontainer.h:92
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
void SetFlag(MxU8 p_flag)
[AI] Sets the given flag in the flags byte.
Definition: legoentity.h:175
virtual void SetROI(LegoROI *p_roi, MxBool p_bool1, MxBool p_bool2)
[AI] Assigns a 3D ROI (3D object instance) to this entity, controlling how it appears/acts in the wor...
Definition: legoentity.cpp:127
MxBool GetFlagsIsSet(MxU8 p_flag)
[AI] Checks if a flag is set in the primary flags byte (m_flags).
Definition: legoentity.h:152
void ClearFlag(MxU8 p_flag)
[AI] Clears the given flag in the flags byte.
Definition: legoentity.h:179
void SetType(MxU8 p_type)
[AI] Sets the entity's type (actor/plant/building/etc.) [AI]
Definition: legoentity.cpp:459
@ e_autoROI
[AI] Catchall for ROI-adapted/unknown entities [AI]
Definition: legoentity.h:24
@ e_actor
[AI] Standard character entity controlled by scripts or user [AI]
Definition: legoentity.h:20
@ c_managerOwned
[AI] Indicates this entity is managed/owned by an entity manager [AI]
Definition: legoentity.h:30
Represents a special actor in the world with additional animation state machines and complex interact...
MxBool IsA(const char *p_name) const override
Checks if the provided type name matches this class or any parent class.
[AI] Level-Of-Detail (LOD) object used for rendering and managing polygonal mesh data with LOD switch...
Definition: legolod.h:27
LegoResult FUN_100aad70(LegoTextureInfo *p_textureInfo)
[AI] Assigns the group texture to all textured meshes, but does NOT override mesh color.
Definition: legolod.cpp:354
LegoLOD * Clone(Tgl::Renderer *p_renderer)
[AI] Create an exact copy of this LOD, including cloned meshes, for another (or the same) renderer.
Definition: legolod.cpp:306
LegoResult SetColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
[AI] Overrides the color of all non-textured mesh parts for this LOD.
Definition: legolod.cpp:328
static void SetCustomizeAnimFile(const char *p_value)
[AI] Sets the global file path or name to use for plant customization animations.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
void SetUnknown0x80(const BoundingBox &p_unk0x80)
[AI] Sets the local bounding box from read data.
Definition: legoroi.h:323
void SetBoundingSphere(const BoundingSphere &p_sphere)
[AI] Sets the local and world bounding spheres.
Definition: legoroi.h:317
LegoResult SetTextureInfo(LegoTextureInfo *p_textureInfo)
[AI] Associates every LOD in this ROI (and sub-ROIs) with a given texture (palette/material informati...
Definition: legoroi.cpp:510
LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
[AI] Sets the RGBA color for all LODs and recursively for all children.
Definition: legoroi.cpp:484
void SetComp(CompoundObject *p_comp)
[AI] Attaches a new CompoundObject pointer (container for child ROIs).
Definition: legoroi.h:311
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
LegoEntity * GetEntity()
[AI] Gets the entity associated with this ROI (or NULL).
Definition: legoroi.h:293
void SetName(const LegoChar *p_name)
[AI] Sets this ROI's name, replacing the previous (converted to lower-case).
Definition: legoroi.cpp:814
static LegoBool GetRGBAColor(const LegoChar *p_name, float &p_red, float &p_green, float &p_blue, float &p_alpha)
[AI] [Static] Resolves a logical color alias into RGBA floats.
Definition: legoroi.cpp:758
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
virtual LegoResult Write(const void *p_buffer, LegoU32 p_size)=0
Write bytes from buffer into storage.
virtual LegoResult Read(void *p_buffer, LegoU32 p_size)=0
Read bytes from storage into buffer.
Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching.
[AI] Contains DirectDraw and Direct3DRM handles and metadata for a texture used in the LEGO Island re...
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
Tgl::Renderer * GetRenderer()
[AI] Returns the underlying renderer for this manager; normally a Direct3D Retained Mode wrapper.
[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
char * GetData() const
Returns a pointer to the internal character buffer.
Definition: mxstring.h:110
void ToUpperCase()
Converts the string contents to uppercase in-place.
Definition: mxstring.cpp:90
void SetVariable(const char *p_key, const char *p_value)
Sets a variable by key and value, replacing or updating if it exists.
MxString m_key
[AI] The variable's key (name), always stored in uppercase.
Definition: mxvariable.h:77
void WrappedSetLocalTransform(const Matrix4 &p_transform)
Wraps SetLocalTransform, for possible override or interface uniformity.
virtual void VTable0x14()
[AI] Calls VTable0x1c().
Definition: orientableroi.h:64
void SetParentROI(OrientableROI *p_parentROI)
Sets the parent ROI used for transformation hierarchy.
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
Definition: roi.h:235
const CompoundObject * GetComp() const
[AI] Returns the pointer to the compound object structure, or NULL if not present.
Definition: roi.h:222
const LODObject * GetLOD(int i) const
[AI] Returns the LODObject at the specified index.
Definition: roi.h:208
[AI] Builder class for assembling mesh data and extracting mesh objects.
Definition: tgl.h:768
virtual Result GetBoundingBox(float min[3], float max[3]) const =0
[AI] Gets the bounding box for the constructed mesh geometry.
[AI] Main interface/factory for rendering resources and scene graphs.
Definition: tgl.h:188
[AI] Manages the lifecycle, lookup, and sharing of ViewLODList instances for different ROI names.
Definition: viewlodlist.h:111
ViewLODList * Create(const ROIName &rROIName, int lodCount)
[AI] Creates and registers a new ViewLODList for a named ROI, with space for the specified number of ...
Definition: viewlodlist.cpp:67
ViewLODList * Lookup(const ROIName &) const
[AI] Looks up an existing ViewLODList by ROI name, incrementing its reference count.
[AI] Reference-counted list of Level-of-Detail (LOD) objects associated with a single ROI (Realtime O...
Definition: viewlodlist.h:30
int Release()
[AI] Decrements the reference count.
[AI] Represents a Level of Detail (LOD) object for rendering, implemented with a mesh builder and sup...
Definition: viewlod.h:20
void RemoveROIDetailFromScene(ViewROI *p_roi)
[AI] Removes the currently active LOD detail from the rendering scene for the given ROI and detaches ...
int GetUnknown0xe0()
[AI] Gets the value of an internal state field at offset 0xe0.
Definition: viewroi.h:108
void SetLODList(ViewLODList *lodList)
[AI] Sets the ViewLODList for this ROI, managing reference counting.
Definition: viewroi.h:44
#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
@ c_armrtPart
[AI] Right arm. [AI]
Definition: legoactors.h:78
@ c_leglftPart
[AI] Left leg. [AI]
Definition: legoactors.h:81
@ c_infohatPart
[AI] Info hat or top accessory slot. [AI]
Definition: legoactors.h:74
@ c_legrtPart
[AI] Right leg. [AI]
Definition: legoactors.h:82
@ c_infogronPart
[AI] Info/torso accent part. [AI]
Definition: legoactors.h:75
@ c_armlftPart
[AI] Left arm. [AI]
Definition: legoactors.h:77
@ c_headPart
[AI] Head slot. [AI]
Definition: legoactors.h:76
LegoActorInfo g_actorInfoInit[66]
[AI] Global initialization table for the 66 actor types in the game, each entry describing all key as...
Definition: legoactors.cpp:175
@ c_infohatLOD
[AI] Information hat or top-accessory. [AI]
Definition: legoactors.h:59
@ c_headLOD
Definition: legoactors.h:61
@ c_topLOD
[AI] Top/root of the actor LOD hierarchy (usually main body root). [AI]
Definition: legoactors.h:57
LegoActorLOD g_actorLODs[11]
[AI] Array of 11 LOD definitions which describe the conventions for actor part hierarchy and bounding...
Definition: legoactors.cpp:10
MxU32 g_unk0x100fc4e8
MxU32 g_unk0x100fc4f0
MxU32 g_unk0x100fc4ec
MxU32 g_characterAnimationId
MxU32 g_unk0x100fc4dc
LegoActorInfo g_actorInfo[66]
MxU32 g_unk0x100fc4d8
map< char *, LegoCharacter *, LegoCharacterComparator > LegoCharacterMap
[AI] Map from character name strings to LegoCharacter pointers.
#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
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
Definition: legotypes.h:101
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
float LegoFloat
[AI] Floating point type used throughout LEGO Island.
Definition: legotypes.h:77
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
Definition: misc.cpp:29
LegoCharacterManager * CharacterManager()
[AI] Accessor for the character manager, which manages in-game characters/NPCs. [AI]
Definition: misc.cpp:101
LegoBuildingManager * BuildingManager()
[AI] Accessor for the building manager, handles constructible buildings and structures....
Definition: misc.cpp:123
ViewLODListManager * GetViewLODListManager()
[AI] Returns the global ViewLODListManager for view LOD (Level of Detail) resources....
Definition: misc.cpp:136
LegoPlantManager * PlantManager()
[AI] Accessor for the plant manager, handling in-game foliage and plants. [AI]
Definition: misc.cpp:115
LegoTextureContainer * TextureContainer()
[AI] Accessor for the texture container used for global texture management. [AI]
Definition: misc.cpp:130
MxVariableTable * VariableTable()
[AI] Returns the variable table used for script variables and global key/value state.
Definition: mxmisc.cpp:73
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
void CalcLocalTransform(const Vector3 &p_posVec, const Vector3 &p_dirVec, const Vector3 &p_upVec, Matrix4 &p_outMatrix)
[AI] Computes a transformation matrix based on a position, direction, and up vector.
Definition: realtime.cpp:7
list< ROI * > CompoundObject
Definition: roi.h:135
[AI] Describes a part/slot of a LEGO actor (e.g.
Definition: legoactors.h:16
MxU8 m_unk0x08
[AI] Default part variant index (or count/selection index). [AI_SUGGESTED_NAME: m_defaultVariant]
Definition: legoactors.h:19
const char ** m_unk0x04
[AI] Pointer to array of strings representing the names/resources corresponding to the part's variant...
Definition: legoactors.h:18
MxU8 * m_unk0x00
[AI] Pointer to list of variant indices for this part (options for which sub-parts may be picked by t...
Definition: legoactors.h:17
MxU8 m_unk0x14
[AI] Default color/texture or palette index for the part. [AI_SUGGESTED_NAME: m_defaultPalette]
Definition: legoactors.h:22
MxU8 * m_unk0x0c
[AI] Pointer to a list of values (indices/colors), purpose is to map this part to a color/texture set...
Definition: legoactors.h:20
const char ** m_unk0x10
[AI] Pointer to palette or color array, typically strings with color names or filenames for textures....
Definition: legoactors.h:21
[AI] Contains information about a single LEGO actor/character, including its name,...
Definition: legoactors.h:13
MxS32 m_move
[AI] Movement profile, move type, or current move id. [AI]
Definition: legoactors.h:29
LegoExtraActor * m_actor
[AI] Pointer to the runtime logic/controller object for the actor (LegoExtraActor),...
Definition: legoactors.h:27
LegoROI * m_roi
[AI] Pointer to the runtime ROI (graphical representation/model) of the actor, assigned at runtime....
Definition: legoactors.h:26
MxS32 m_sound
[AI] Sound profile or current sound effect associated (index/id). [AI]
Definition: legoactors.h:28
MxU8 m_mood
[AI] Mood parameter for the actor (expressions/mouth shape/animation set). [AI]
Definition: legoactors.h:30
Part m_parts[10]
[AI] Table of body parts, each with their own variant/color selection and mappings (see Part struct)....
Definition: legoactors.h:31
const char * m_name
[AI] Unique name string for this actor type (used for lookup in runtime logic, e.g....
Definition: legoactors.h:25
const char * m_parentName
[AI] Name of parent part/Lod, forming hierarchy for placing in the model. [AI]
Definition: legoactors.h:45
float m_boundingSphere[4]
[AI] Defines center (x, y, z) and radius for the part's bounding sphere (collision and culling)....
Definition: legoactors.h:47
float m_boundingBox[6]
[AI] Defines axis-aligned bounding box: minX, minY, minZ, maxX, maxY, maxZ. Used for spatial culling....
Definition: legoactors.h:48
@ c_flag2
[AI] Used to denote a secondary special flag (usage determined by implementation)....
Definition: legoactors.h:41
@ c_flag1
[AI] Used to denote special processing/class of LOD part (see usage in creation routines)....
Definition: legoactors.h:40
[AI] Holds a LegoROI pointer and reference count for a character instance managed by LegoCharacterMan...
LegoROI * m_roi
[AI] Pointer to the character's ROI object.
MxU32 m_refCount
[AI] Reference count tracking how many owners the character ROI has.
void AddRef()
[AI] Increments the internal reference count for this character.
MxU32 RemoveRef()
[AI] Decrements the internal reference count.
#define NORMSQRD3(v)
Definition: vec.h:474
#define VMV3(to, v, w)
Definition: vec.h:374
#define SET3(to, from)
Definition: vec.h:310
#define FILLVEC3(v, s)
Definition: vec.h:326