Isle
Loading...
Searching...
No Matches
legogamestate.cpp
Go to the documentation of this file.
1#include "legogamestate.h"
2
4#include "act2main_actions.h"
5#include "act3_actions.h"
6#include "ambulance.h"
7#include "carrace.h"
8#include "carrace_actions.h"
9#include "carracer_actions.h"
10#include "copter_actions.h"
11#include "define.h"
12#include "dunebuggy.h"
13#include "dunecar_actions.h"
14#include "elevbott_actions.h"
15#include "garage_actions.h"
16#include "helicopter.h"
17#include "histbook_actions.h"
18#include "hospital_actions.h"
19#include "infocenter.h"
20#include "infodoor_actions.h"
21#include "infomain_actions.h"
22#include "infoscor_actions.h"
23#include "isle.h"
24#include "isle_actions.h"
25#include "islepathactor.h"
26#include "jetrace_actions.h"
27#include "jetracer_actions.h"
28#include "jetski.h"
29#include "jetski_actions.h"
30#include "jetskirace.h"
31#include "jukebox_actions.h"
32#include "jukeboxw_actions.h"
34#include "legobuildingmanager.h"
36#include "legomain.h"
37#include "legonavcontroller.h"
38#include "legoplantmanager.h"
39#include "legostate.h"
40#include "legoutils.h"
41#include "legovideomanager.h"
42#include "legoworld.h"
43#include "misc.h"
45#include "mxmisc.h"
47#include "mxnotificationparam.h"
48#include "mxobjectfactory.h"
49#include "mxstring.h"
50#include "mxutilities.h"
51#include "mxvariabletable.h"
52#include "pizza.h"
53#include "police_actions.h"
54#include "racecar.h"
55#include "racecar_actions.h"
56#include "regbook_actions.h"
57#include "roi/legoroi.h"
58#include "scripts.h"
59#include "sndanim_actions.h"
60#include "towtrack.h"
61
62#include <assert.h>
63#include <stdio.h>
64
66DECOMP_SIZE_ASSERT(LegoGameState::ScoreItem, 0x2c)
67DECOMP_SIZE_ASSERT(LegoGameState::History, 0x374)
72
73// GLOBAL: LEGO1 0x100f3e40
74// STRING: LEGO1 0x100f3e3c
75const char* g_fileExtensionGS = ".GS";
76
77// GLOBAL: LEGO1 0x100f3e44
78// STRING: LEGO1 0x100f3e30
79const char* g_playersGSI = "Players.gsi";
80
81// GLOBAL: LEGO1 0x100f3e48
82// STRING: LEGO1 0x100f3e24
83const char* g_historyGSI = "History.gsi";
84
85// This is a pointer to the end of the global variable name table, which has
86// the text "END_OF_VARIABLES" in it.
87// TODO: make g_endOfVariables reference the actual end of the variable array.
88// GLOBAL: LEGO1 0x100f3e50
89// STRING: LEGO1 0x100f3e00
90// GLOBAL: BETA10 0x101ed5dc
91// STRING: BETA10 0x101ed768
92const char* g_endOfVariables = "END_OF_VARIABLES";
93
94// GLOBAL: LEGO1 0x100f3e58
96 {"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, // dunebuggy back fender, dunebuggy back axle
97 {"c_chbasey0", "lego black"}, {"c_chbacky0", "lego black"}, // copter base, copter back
98 {"c_chdishy0", "lego white"}, {"c_chhorny0", "lego black"}, // copter dish, copter horn
99 {"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, // copter left jet, copter right jet
100 {"c_chmidly0", "lego black"}, {"c_chmotry0", "lego blue"}, // copter middle, copter motor
101 {"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"}, // copter side left, copter side right
102 {"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, // copter ???, copter tail
103 {"c_chwindy1", "lego black"}, {"c_dbfbrdy0", "lego red"}, // copter ???, dunebuggy ???
104 {"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"}, // dunebuggy flag, dunebuggy front fender
105 {"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, // dunebuggy front axle, dunebuggy handlebar
106 {"c_dbltbry0", "lego white"}, {"c_jsdashy0", "lego white"}, // dunebuggy ???, jetski dash
107 {"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"}, // jetski exhaust, jetski front
108 {"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, // jetski handlebar, jetski left side
109 {"c_jsrsidy0", "lego black"}, {"c_jsskiby0", "lego red"}, // jetski right side, jetski ???
110 {"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"}, // jetski windshield, racecar back
111 {"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, // racecar edge, racecar frame
112 {"c_rcfrnty6", "lego green"}, {"c_rcmotry0", "lego white"}, // racecar front, racecar motor
113 {"c_rcsidey0", "lego green"}, {"c_rcstery0", "lego white"}, // racecar side, racecar steering wheel
114 {"c_rcstrpy0", "lego yellow"}, {"c_rctailya", "lego white"}, // racecar stripe, racecar tail
115 {"c_rcwhl1y0", "lego white"}, {"c_rcwhl2y0", "lego white"}, // racecar wheels 1, racecar wheels 2
116 {"c_jsbasey0", "lego white"}, {"c_chblady0", "lego black"}, // jetski base, copter blades
117 {"c_chseaty0", "lego white"}, // copter seat
118};
119
120// NOTE: This offset = the end of the variables table, the last entry
121// in that table is a special entry, the string "END_OF_VARIABLES"
122extern const char* g_endOfVariables;
123
124// GLOBAL: LEGO1 0x100f3fb0
125// STRING: LEGO1 0x100f3a18
126const char* g_delimiter = " \t";
127
128// GLOBAL: LEGO1 0x100f3fb4
129// STRING: LEGO1 0x100f3bf0
130const char* g_set = "set";
131
132// GLOBAL: LEGO1 0x100f3fb8
133// STRING: LEGO1 0x100f0cdc
134const char* g_reset = "reset";
135
136// GLOBAL: LEGO1 0x100f3fbc
137// STRING: LEGO1 0x100f3be8
138const char* g_strEnable = "enable";
139
140// GLOBAL: LEGO1 0x100f3fc0
141// STRING: LEGO1 0x100f3bf4
142const char* g_strDisable = "disable";
143
144// FUNCTION: LEGO1 0x10039550
146{
147 SetColors();
148 SetROIColorOverride();
149
150 m_stateCount = 0;
151 m_actorId = 0;
152 m_savePath = NULL;
153 m_stateArray = NULL;
158 m_playerCount = 0;
160 m_loadedAct = e_actNotFound;
162
163 m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68");
164 VariableTable()->SetVariable(m_backgroundColor);
165
166 m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundColor", "set 56 54 68");
167 VariableTable()->SetVariable(m_tempBackgroundColor);
168
169 m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable");
170 VariableTable()->SetVariable(m_fullScreenMovie);
171
172 VariableTable()->SetVariable("lightposition", "2");
174}
175
176// FUNCTION: LEGO1 0x10039720
178{
180
181 if (m_stateCount) {
182 for (MxS16 i = 0; i < m_stateCount; i++) {
183 LegoState* state = m_stateArray[i];
184 if (state) {
185 delete state;
186 }
187 }
188
189 delete[] m_stateArray;
190 }
191
192 delete[] m_savePath;
193}
194
195// FUNCTION: LEGO1 0x10039780
196// FUNCTION: BETA10 0x10083d43
198{
199 if (p_actorId) {
200 m_actorId = p_actorId;
201 }
202
203 LegoPathActor* oldActor = UserActor();
205
206 IslePathActor* newActor = new IslePathActor();
207 const char* actorName = LegoActor::GetActorName(m_actorId);
208 LegoROI* roi = CharacterManager()->GetActorROI(actorName, FALSE);
209 MxDSAction action;
210
211 action.SetAtomId(*g_isleScript);
212 action.SetObjectId(100000);
213 newActor->Create(action);
214 newActor->SetActorId(p_actorId);
215 newActor->SetROI(roi, FALSE, FALSE);
216
217 if (oldActor) {
218 newActor->GetROI()->FUN_100a58f0(oldActor->GetROI()->GetLocal2World());
219 newActor->SetBoundary(oldActor->GetBoundary());
220 delete oldActor;
221 }
222
224 SetUserActor(newActor);
225}
226
227// FUNCTION: LEGO1 0x10039910
229{
230 LegoPathActor* actor = UserActor();
232 delete actor;
233 m_actorId = 0;
234}
235
236// FUNCTION: LEGO1 0x10039940
237// FUNCTION: BETA10 0x10084069
239{
240 if (m_actorId) {
241 LegoPathActor* actor = UserActor();
242
243 if (actor) {
244 LegoROI* roi = actor->GetROI();
245
246 if (roi) {
247 VideoManager()->Get3DManager()->Remove(*roi);
248 VideoManager()->Get3DManager()->Add(*roi);
249 }
250 }
251 }
252}
253
254// FUNCTION: LEGO1 0x10039980
255// FUNCTION: BETA10 0x100840e4
257{
258 InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
259
260 if (!infocenterState || !infocenterState->HasRegistered()) {
261 return SUCCESS;
262 }
263
264 MxResult result = FAILURE;
265 LegoFile storage;
266 MxVariableTable* variableTable = VariableTable();
267 MxS16 count = 0;
268 MxU32 i;
269 MxS32 j;
270 MxU16 area;
271
272 MxString savePath;
273 GetFileSavePath(&savePath, p_slot);
274
275 if (storage.Open(savePath.GetData(), LegoFile::c_write) == FAILURE) {
276 goto done;
277 }
278
279 storage.WriteS32(0x1000c);
280 storage.WriteS16(m_unk0x24);
281 storage.WriteU16(m_currentAct);
282 storage.WriteU8(m_actorId);
283
284 for (i = 0; i < sizeOfArray(g_colorSaveData); i++) {
285 if (WriteVariable(&storage, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) {
286 goto done;
287 }
288 }
289
290 if (WriteVariable(&storage, variableTable, "backgroundcolor") == FAILURE) {
291 goto done;
292 }
293 if (WriteVariable(&storage, variableTable, "lightposition") == FAILURE) {
294 goto done;
295 }
296
297 WriteEndOfVariables(&storage);
298 CharacterManager()->Write(&storage);
299 PlantManager()->Write(&storage);
300 result = BuildingManager()->Write(&storage);
301
302 for (j = 0; j < m_stateCount; j++) {
303 if (m_stateArray[j]->IsSerializable()) {
304 count++;
305 }
306 }
307
308 storage.WriteS16(count);
309
310 for (j = 0; j < m_stateCount; j++) {
311 if (m_stateArray[j]->IsSerializable()) {
312 m_stateArray[j]->Serialize(&storage);
313 }
314 }
315
316 area = m_unk0x42c;
317 storage.WriteU16(area);
320
321done:
322 return result;
323}
324
325// FUNCTION: LEGO1 0x10039bf0
327{
328 MxS16 stateCount = m_stateCount;
329 LegoState** stateArray = m_stateArray;
330
331 m_stateCount = 0;
332 m_stateArray = NULL;
333
334 for (MxS32 count = 0; count < stateCount; count++) {
335 if (!stateArray[count]->Reset() && stateArray[count]->IsSerializable()) {
336 delete stateArray[count];
337 }
338 else {
339 RegisterState(stateArray[count]);
340 stateArray[count] = NULL;
341 }
342 }
343
344 delete[] stateArray;
345 return SUCCESS;
346}
347
348// FUNCTION: LEGO1 0x10039c60
349// FUNCTION: BETA10 0x10084329
351{
352 MxResult result = FAILURE;
353 LegoFile storage;
354 MxVariableTable* variableTable = VariableTable();
355
356 MxString savePath;
357 GetFileSavePath(&savePath, p_slot);
358
359 if (storage.Open(savePath.GetData(), LegoFile::c_read) == FAILURE) {
360 goto done;
361 }
362
363 MxS32 version;
364 MxU32 status;
365 MxS16 count, actArea;
366 const char* lightPosition;
367
368 storage.ReadS32(version);
369
370 if (version != 0x1000c) {
371 OmniError("Saved game version mismatch", 0);
372 goto done;
373 }
374
375 storage.ReadS16(m_unk0x24);
376 storage.ReadS16(actArea);
377
378 SetCurrentAct((Act) actArea);
379 storage.ReadU8(m_actorId);
380 if (m_actorId) {
381 SetActor(m_actorId);
382 }
383
384 do {
385 status = ReadVariable(&storage, variableTable);
386 if (status == 1) {
387 goto done;
388 }
389 } while (status != 2);
390
391 m_backgroundColor->SetLightColor();
392 lightPosition = VariableTable()->GetVariable("lightposition");
393
394 if (lightPosition) {
395 SetLightPosition(atoi(lightPosition));
396 }
397
398 if (CharacterManager()->Read(&storage) == FAILURE) {
399 goto done;
400 }
401 if (PlantManager()->Read(&storage) == FAILURE) {
402 goto done;
403 }
404 if (BuildingManager()->Read(&storage) == FAILURE) {
405 goto done;
406 }
407 if (DeleteState() != SUCCESS) {
408 goto done;
409 }
410
411 char stateName[80];
412 storage.ReadS16(count);
413
414 if (count) {
415 for (MxS16 i = 0; i < count; i++) {
416 storage.ReadString(stateName);
417
418 LegoState* state = GetState(stateName);
419 if (!state) {
420 state = CreateState(stateName);
421
422 if (!state) {
423 goto done;
424 }
425 }
426
427 state->Serialize(&storage);
428 }
429 }
430
431 storage.ReadS16(actArea);
432
433 if (m_currentAct == e_act1) {
435 }
436 else {
437 m_unk0x42c = (Area) actArea;
438 }
439
440 result = SUCCESS;
442
443done:
444 if (result != SUCCESS) {
445 OmniError("Game state loading was not successful!", 0);
446 }
447
448 return result;
449}
450
451// FUNCTION: LEGO1 0x10039f00
452void LegoGameState::SetSavePath(char* p_savePath)
453{
454 if (m_savePath != NULL) {
455 delete[] m_savePath;
456 }
457
458 if (p_savePath) {
459 m_savePath = new char[strlen(p_savePath) + 1];
460 strcpy(m_savePath, p_savePath);
461 }
462 else {
463 m_savePath = NULL;
464 }
465}
466
467// FUNCTION: LEGO1 0x10039f70
468// FUNCTION: BETA10 0x1008483b
469MxResult LegoGameState::WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName)
470{
471 MxResult result = FAILURE;
472 const char* variableValue = p_from->GetVariable(p_variableName);
473
474 if (variableValue) {
475 MxU8 length = strlen(p_variableName);
476 if (p_storage->Write(&length, sizeof(length)) != SUCCESS) {
477 goto done;
478 }
479
480 if (p_storage->Write(p_variableName, length) != SUCCESS) {
481 goto done;
482 }
483
484 length = strlen(variableValue);
485 if (p_storage->Write(&length, sizeof(length)) != SUCCESS) {
486 goto done;
487 }
488
489 result = p_storage->Write(variableValue, length);
490 }
491
492done:
493 return result;
494}
495
496// FUNCTION: LEGO1 0x1003a020
497// FUNCTION: BETA10 0x10084928
498MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_storage)
499{
500 MxU8 len = strlen(g_endOfVariables);
501
502 if (p_storage->Write(&len, sizeof(len)) == SUCCESS) {
503 return p_storage->Write(g_endOfVariables, len);
504 }
505
506 return FAILURE;
507}
508
509// FUNCTION: LEGO1 0x1003a080
510// FUNCTION: BETA10 0x1008498b
511MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to)
512{
513 MxS32 result = 1;
514 MxU8 len;
515
516 if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
517 goto done;
518 }
519
520 char varName[256];
521 assert(len < sizeof(varName));
522
523 if (p_storage->Read(varName, len) != SUCCESS) {
524 goto done;
525 }
526
527 varName[len] = '\0';
528 if (strcmp(varName, g_endOfVariables) == 0) {
529 // 2 -> "This was the last entry, done reading."
530 result = 2;
531 goto done;
532 }
533
534 if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
535 goto done;
536 }
537
538 char value[256];
539 assert(len < sizeof(value));
540
541 if (p_storage->Read(value, len) != SUCCESS) {
542 goto done;
543 }
544
545 value[len] = '\0';
546 p_to->SetVariable(varName, value);
547 result = SUCCESS;
548
549done:
550 return result;
551}
552
553// FUNCTION: LEGO1 0x1003a170
554// FUNCTION: BETA10 0x10084b45
556{
557 char baseForSlot[2] = "0";
558 char path[1024] = "";
559
560 // Save path base
561 if (m_savePath != NULL) {
562 strcpy(path, m_savePath);
563 }
564
565 // Slot: "G0", "G1", ...
566 strcat(path, "\\G");
567 baseForSlot[0] += p_slotn;
568 strcat(path, baseForSlot);
569
570 // Extension: ".GS"
571 strcat(path, g_fileExtensionGS);
572 *p_outPath = MxString(path);
573}
574
575// FUNCTION: LEGO1 0x1003a2e0
577{
578 LegoFile storage;
579 MxString playersGSI = MxString(m_savePath);
580
581 playersGSI += "\\";
582 playersGSI += g_playersGSI;
583
584 if (storage.Open(playersGSI.GetData(), p_flags) == SUCCESS) {
585 if (storage.IsReadMode()) {
586 storage.ReadS16(m_playerCount);
587 }
588 else if (storage.IsWriteMode()) {
589 storage.WriteS16(m_playerCount);
590 }
591
592 for (MxS16 i = 0; i < m_playerCount; i++) {
593 m_players[i].Serialize(&storage);
594 }
595 }
596}
597
598// FUNCTION: LEGO1 0x1003a3f0
600{
601 MxString from, to;
602
603 if (m_playerCount == 9) {
604 GetFileSavePath(&from, 8);
605 DeleteFile(from.GetData());
607 }
608
609 for (MxS16 i = m_playerCount; i > 0; i--) {
610 m_players[i] = m_players[i - 1];
611 GetFileSavePath(&from, i - 1);
612 GetFileSavePath(&to, i);
613 MoveFile(from.GetData(), to.GetData());
614 }
615
617 m_players[0].Set(p_player);
622
623 return DeleteState();
624}
625
626// FUNCTION: LEGO1 0x1003a540
627// FUNCTION: BETA10 0x10084fc4
629{
630 if (p_playerId > 0) {
631 MxString from, temp, to;
632
633 GetFileSavePath(&from, p_playerId);
634 GetFileSavePath(&temp, 36);
635
636 Username selectedName(m_players[p_playerId]);
637
638 MoveFile(from.GetData(), temp.GetData());
639
640 for (MxS16 i = p_playerId; i > 0; i--) {
641 m_players[i] = m_players[i - 1];
642 GetFileSavePath(&from, i - 1);
643 GetFileSavePath(&to, i);
644 MoveFile(from.GetData(), to.GetData());
645 }
646
647 m_players[0] = selectedName;
648 GetFileSavePath(&from, 0);
649 MoveFile(temp.GetData(), from.GetData());
650 }
651
652 if (Load(0) != SUCCESS) {
653 Init();
654 }
655}
656
657// FUNCTION: LEGO1 0x1003a6e0
659{
660 for (MxS16 i = 0; i < m_playerCount; i++) {
661 if (memcmp(&m_players[i], &p_player, sizeof(p_player)) == 0) {
662 return i;
663 }
664 }
665
666 return -1;
667}
668
669// FUNCTION: LEGO1 0x1003a720
670// FUNCTION: BETA10 0x10085211
672{
673 if (p_area == e_previousArea) {
674 p_area = m_previousArea;
675 }
676
677 switch (p_area) {
678 case e_isle:
682 break;
683 case e_infomain:
686 break;
687 case e_infodoor:
690 break;
691 case e_elevbott:
694 break;
695 case e_elevride:
696 case e_elevride2:
708 break;
709 case e_elevopen:
713 break;
714 case e_seaview:
718 break;
719 case e_observe:
740 break;
741 case e_elevdown:
746 break;
747 case e_regbook:
750 break;
751 case e_infoscor:
754 break;
755 case e_jetrace:
759 break;
760 case e_carrace:
764 break;
765 case e_garage:
769 break;
770 case e_garadoor:
775 break;
776 case e_hospital:
779 break;
780 case e_police:
783 break;
784 case e_polidoor:
789 break;
790 case e_copterbuild:
794 break;
795 case e_dunecarbuild:
799 break;
800 case e_jetskibuild:
804 break;
805 case e_racecarbuild:
809 break;
810 case e_act2main:
811 if (m_currentArea != e_infomain) {
814 }
815 break;
816 case e_act3script:
817 if (m_currentArea != e_infomain) {
820 }
821 break;
822 case e_jukeboxw:
825 break;
826 case e_histbook:
830 break;
831 }
832}
833
834inline void LoadIsle()
835{
837 if (world != NULL) {
838 if (!world->GetUnknown0xd0Empty()) {
840 }
841 }
842 else {
844 }
845}
846
847// FUNCTION: LEGO1 0x1003b060
848// FUNCTION: BETA10 0x10085adf
850{
852 m_currentArea = p_area;
853
858
859 switch (p_area) {
860 case e_isle:
862 break;
863 case e_infomain:
866 break;
867 case e_infodoor:
870 break;
871 case e_unk4:
872 case e_jetrace2:
874 case e_unk17:
876 case e_unk20:
877 case e_unk21:
879 case e_garageExterior:
881 case e_unk31:
882 case e_policeExterior:
883 case e_bike:
884 case e_dunecar:
885 case e_motocycle:
886 case e_copter:
887 case e_skateboard:
888 case e_jetski:
889 case e_unk66:
890 LoadIsle();
891 break;
892 case e_elevbott:
894 break;
895 case e_elevride:
896 case e_elevride2:
897 LoadIsle();
899 break;
900 case e_elevopen:
903 break;
904 case e_seaview:
906 break;
907 case e_observe:
909 break;
910 case e_elevdown:
912 break;
913 case e_regbook:
916 break;
917 case e_infoscor:
920 break;
921 case e_jetrace:
922 if (m_previousArea == e_infomain) {
924 LoadIsle();
925 }
926 else {
928 }
929 break;
930 case e_carrace:
931 if (m_previousArea == e_infomain) {
933 LoadIsle();
934 }
935 else {
937 }
938 break;
939 case e_garage:
942 break;
943 case e_garadoor:
944 LoadIsle();
945 VariableTable()->SetVariable("VISIBILITY", "Hide Gas");
947 NavController()->UpdateLocation(59); // LCAMZG1 in g_cameraLocations
948 VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f);
950 break;
951 case e_unk28: {
952 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
953 LoadIsle();
954
955 if (state->GetUnknown18() == 7) {
956 VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f);
957 }
958 else {
962 }
963
965 ->SpawnPlayer(
966 p_area,
967 TRUE,
969 );
970 break;
971 }
972 case e_hospital:
975 break;
976 case e_unk33:
977 LoadIsle();
982 ->SpawnPlayer(
983 p_area,
984 TRUE,
986 );
987 break;
988 case e_police:
991 break;
992 case e_polidoor:
993 LoadIsle();
995 break;
996 case e_copterbuild:
999 break;
1000 case e_dunecarbuild:
1003 break;
1004 case e_jetskibuild:
1007 break;
1008 case e_racecarbuild:
1011 break;
1012 case e_act2main: {
1014
1015 if (act2main == NULL) {
1017 }
1018 else {
1019 act2main->Enable(TRUE);
1020 }
1021
1022 break;
1023 }
1024 case e_act3script: {
1026
1027 if (act3 == NULL) {
1029 }
1030 else {
1031 act3->Enable(TRUE);
1032 }
1033
1034 break;
1035 }
1036 case e_jukeboxw:
1039 break;
1040 case e_jukeboxExterior:
1041 LoadIsle();
1042 break;
1043 case e_histbook:
1046 break;
1047 default:
1048 break;
1049 }
1050}
1051
1052// FUNCTION: LEGO1 0x1003ba90
1053void LegoGameState::SetColors()
1054{
1055 MxVariableTable* variableTable = VariableTable();
1056
1057 for (MxS32 i = 0; i < sizeOfArray(g_colorSaveData); i++) {
1058 variableTable->SetVariable(g_colorSaveData[i].m_targetName, g_colorSaveData[i].m_colorName);
1059 }
1060}
1061
1062// FUNCTION: LEGO1 0x1003bac0
1063void LegoGameState::SetROIColorOverride()
1064{
1066}
1067
1068// FUNCTION: LEGO1 0x1003bad0
1069MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen)
1070{
1071 if (p_output != NULL && p_copyLen != 0 &&
1072 (strnicmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||
1073 strnicmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
1074
1075 char buf[256];
1076 sprintf(buf, "c_%s", &p_input[strlen("INDIR-F-")]);
1077
1078 const char* value = VariableTable()->GetVariable(buf);
1079 if (value != NULL) {
1080 strncpy(p_output, value, p_copyLen);
1081 p_output[p_copyLen - 1] = '\0';
1082 return TRUE;
1083 }
1084 }
1085
1086 return FALSE;
1087}
1088
1089// FUNCTION: LEGO1 0x1003bbb0
1090// FUNCTION: BETA10 0x10086280
1091LegoState* LegoGameState::GetState(const char* p_stateName)
1092{
1093 for (MxS32 i = 0; i < m_stateCount; ++i) {
1094 if (m_stateArray[i]->IsA(p_stateName)) {
1095 return m_stateArray[i];
1096 }
1097 }
1098 return NULL;
1099}
1100
1101// FUNCTION: LEGO1 0x1003bc00
1102// FUNCTION: BETA10 0x100862fc
1103LegoState* LegoGameState::CreateState(const char* p_stateName)
1104{
1105 // variable name verified by BETA10 0x10086341
1106 LegoState* state = (LegoState*) ObjectFactory()->Create(p_stateName);
1107 assert(state);
1108
1109 RegisterState(state);
1110
1111 return state;
1112}
1113
1114// FUNCTION: LEGO1 0x1003bc30
1115// FUNCTION: BETA10 0x1008636e
1117{
1118 MxS32 targetIndex;
1119 for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex) {
1120 if (m_stateArray[targetIndex]->IsA(p_state->ClassName())) {
1121 break;
1122 }
1123 }
1124
1125 if (targetIndex == m_stateCount) {
1126 LegoState** newBuffer = new LegoState*[m_stateCount + 1];
1127
1128 if (m_stateCount != 0) {
1129 memcpy(newBuffer, m_stateArray, m_stateCount * sizeof(LegoState*));
1130 delete[] m_stateArray;
1131 }
1132
1133 newBuffer[m_stateCount++] = p_state;
1134 m_stateArray = newBuffer;
1135 }
1136 else {
1137 delete m_stateArray[targetIndex];
1138 m_stateArray[targetIndex] = p_state;
1139 }
1140}
1141
1142// FUNCTION: LEGO1 0x1003bd00
1144{
1145 m_backgroundColor->SetValue("set 56 54 68");
1146 m_backgroundColor->SetLightColor();
1147 m_tempBackgroundColor->SetValue("set 56 54 68");
1148 VariableTable()->SetVariable("lightposition", "2");
1150 PlantManager()->Init();
1151 BuildingManager()->Init();
1154 SetColors();
1155 RemoveActor();
1156 DeleteState();
1157 m_isDirty = FALSE;
1158 FindLoadedAct();
1160
1161 if (m_loadedAct == e_act1) {
1163
1165 if (copter) {
1166 isle->RemoveActor(copter);
1167 isle->VTable0x6c(copter);
1168 delete copter;
1169 }
1170
1172 if (dunebuggy) {
1173 isle->RemoveActor(dunebuggy);
1174 isle->VTable0x6c(dunebuggy);
1175 delete dunebuggy;
1176 }
1177
1179 if (jetski) {
1180 isle->RemoveActor(jetski);
1181 isle->VTable0x6c(jetski);
1182 delete jetski;
1183 }
1184
1186 if (racecar) {
1187 isle->RemoveActor(racecar);
1188 isle->VTable0x6c(racecar);
1189 delete racecar;
1190 }
1191 }
1192
1194}
1195
1196// FUNCTION: BETA10 0x10086510
1198{
1199 m_h = 0.0f;
1200 m_s = 0.0f;
1201 m_v = 0.0f;
1202}
1203
1204// FUNCTION: LEGO1 0x1003bfb0
1205// FUNCTION: BETA10 0x1008659d
1206LegoBackgroundColor::LegoBackgroundColor(const char* p_key, const char* p_value)
1207{
1208 m_key = p_key;
1210 SetValue(p_value);
1211}
1212
1213// FUNCTION: LEGO1 0x1003c070
1214// FUNCTION: BETA10 0x10086634
1215void LegoBackgroundColor::SetValue(const char* p_colorString)
1216{
1217 m_value = p_colorString;
1219
1220 LegoVideoManager* videomanager = VideoManager();
1221 if (!videomanager || !p_colorString) {
1222 return;
1223 }
1224
1225 float convertedR, convertedG, convertedB;
1226 char* colorStringCopy = strcpy(new char[strlen(p_colorString) + 1], p_colorString);
1227 char* colorStringSplit = strtok(colorStringCopy, g_delimiter);
1228
1229 if (!strcmp(colorStringSplit, g_set)) {
1230 colorStringSplit = strtok(0, g_delimiter);
1231 if (colorStringSplit) {
1232 m_h = (float) (atoi(colorStringSplit) * 0.01);
1233 }
1234 colorStringSplit = strtok(0, g_delimiter);
1235 if (colorStringSplit) {
1236 m_s = (float) (atoi(colorStringSplit) * 0.01);
1237 }
1238 colorStringSplit = strtok(0, g_delimiter);
1239 if (colorStringSplit) {
1240 m_v = (float) (atoi(colorStringSplit) * 0.01);
1241 }
1242
1243 ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
1244 videomanager->SetSkyColor(convertedR, convertedG, convertedB);
1245 }
1246 else if (!strcmp(colorStringSplit, g_reset)) {
1247 ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
1248 videomanager->SetSkyColor(convertedR, convertedG, convertedB);
1249 }
1250
1251 delete[] colorStringCopy;
1252}
1253
1254// FUNCTION: LEGO1 0x1003c230
1255// FUNCTION: BETA10 0x100867f9
1257{
1258 char buffer[30];
1259
1260 if (p_sun) {
1261 m_s += 0.1;
1262 if (m_s > 0.9) {
1263 m_s = 1.0;
1264 }
1265 }
1266 else {
1267 m_s -= 0.1;
1268 if (m_s < 0.1) {
1269 m_s = 0.1;
1270 }
1271 }
1272
1273 sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
1274 m_value = buffer;
1275
1276 float convertedR, convertedG, convertedB;
1277 ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
1278 VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
1279 SetLightColor(convertedR, convertedG, convertedB);
1280}
1281
1282// FUNCTION: LEGO1 0x1003c330
1283// FUNCTION: BETA10 0x100868de
1285{
1286 char buffer[30];
1287
1288 m_h += 0.05;
1289 if (m_h > 1.0) {
1290 m_h -= 1.0;
1291 }
1292
1293 sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
1294 m_value = buffer;
1295
1296 float convertedR, convertedG, convertedB;
1297 ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
1298 VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
1299 SetLightColor(convertedR, convertedG, convertedB);
1300}
1301
1302// FUNCTION: LEGO1 0x1003c400
1303// FUNCTION: BETA10 0x10086984
1304void LegoBackgroundColor::SetLightColor(float p_r, float p_g, float p_b)
1305{
1306 if (!VideoManager()->GetVideoParam().Flags().GetF2bit0()) {
1307 // TODO: Computed constants based on what?
1308 p_r *= 1. / 0.23;
1309 p_g *= 1. / 0.63;
1310 p_b *= 1. / 0.85;
1311
1312 if (p_r > 1.0) {
1313 p_r = 1.0;
1314 }
1315
1316 if (p_g > 1.0) {
1317 p_g = 1.0;
1318 }
1319
1320 if (p_b > 1.0) {
1321 p_b = 1.0;
1322 }
1323
1325 VideoManager()->Get3DManager()->GetLego3DView()->SetLightColor(TRUE, p_r, p_g, p_b);
1326 }
1327}
1328
1329// FUNCTION: LEGO1 0x1003c4b0
1331{
1332 float convertedR, convertedG, convertedB;
1333 ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
1334 SetLightColor(convertedR, convertedG, convertedB);
1335}
1336
1337// FUNCTION: LEGO1 0x1003c500
1338// FUNCTION: BETA10 0x10086af6
1339LegoFullScreenMovie::LegoFullScreenMovie(const char* p_key, const char* p_value)
1340{
1341 m_key = p_key;
1343 SetValue(p_value);
1344}
1345
1346// FUNCTION: LEGO1 0x1003c5c0
1347// FUNCTION: BETA10 0x10086b8d
1348void LegoFullScreenMovie::SetValue(const char* p_option)
1349{
1350 m_value = p_option;
1352
1353 LegoVideoManager* videomanager = VideoManager();
1354 if (videomanager) {
1355 if (!strcmp(m_value.GetData(), g_strEnable)) {
1356 videomanager->EnableFullScreenMovie(TRUE);
1357 }
1358 else if (!strcmp(m_value.GetData(), g_strDisable)) {
1359 videomanager->EnableFullScreenMovie(FALSE);
1360 }
1361 }
1362}
1363
1364// FUNCTION: LEGO1 0x1003c670
1366{
1367 memset(m_letters, -1, sizeof(m_letters));
1368}
1369
1370// FUNCTION: LEGO1 0x1003c690
1371// FUNCTION: BETA10 0x10086c57
1373{
1374 if (p_storage->IsReadMode()) {
1375 for (MxS16 i = 0; i < (MxS16) sizeOfArray(m_letters); i++) {
1376 p_storage->ReadS16(m_letters[i]);
1377 }
1378 }
1379 else if (p_storage->IsWriteMode()) {
1380 for (MxS16 i = 0; i < (MxS16) sizeOfArray(m_letters); i++) {
1381 p_storage->WriteS16(m_letters[i]);
1382 }
1383 }
1384
1385 return SUCCESS;
1386}
1387
1388// FUNCTION: LEGO1 0x1003c710
1389// FUNCTION: BETA10 0x10086d0c
1391{
1392 memcpy(m_letters, p_other.m_letters, sizeof(m_letters));
1393 return *this;
1394}
1395
1396// FUNCTION: LEGO1 0x1003c740
1397// FUNCTION: BETA10 0x10086d39
1399{
1400 if (p_storage->IsReadMode()) {
1401 p_storage->ReadS16(m_totalScore);
1402
1403 for (MxS32 i = 0; i < 5; i++) {
1404 for (MxS32 j = 0; j < 5; j++) {
1405 p_storage->ReadU8(m_scores[i][j]);
1406 }
1407 }
1408
1409 m_name.Serialize(p_storage);
1410 p_storage->ReadS16(m_unk0x2a);
1411 }
1412 else if (p_storage->IsWriteMode()) {
1413 p_storage->WriteS16(m_totalScore);
1414
1415 for (MxS32 i = 0; i < 5; i++) {
1416 for (MxS32 j = 0; j < 5; j++) {
1417 p_storage->WriteU8(m_scores[i][j]);
1418 }
1419 }
1420
1421 m_name.Serialize(p_storage);
1422 p_storage->WriteS16(m_unk0x2a);
1423 }
1424
1425 return SUCCESS;
1426}
1427
1428// FUNCTION: LEGO1 0x1003c830
1429// FUNCTION: BETA10 0x10086e87
1431{
1432 m_count = 0;
1433 m_unk0x372 = 0;
1434}
1435
1436// FUNCTION: LEGO1 0x1003c870
1437// FUNCTION: BETA10 0x10086ec9
1439{
1440 MxS16 totalScore = 0;
1441 MxU8 scores[5][5];
1442
1443 InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
1444 if (state->m_letters[0]) {
1445 JetskiRaceState* jetskiRaceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
1446 CarRaceState* carRaceState = (CarRaceState*) GameState()->GetState("CarRaceState");
1447 TowTrackMissionState* towTrackMissionState =
1448 (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
1449 PizzaMissionState* pizzaMissionState = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
1450 AmbulanceMissionState* ambulanceMissionState =
1451 (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
1452
1453 for (MxS32 actor = 1; actor <= 5; actor++) {
1454 scores[0][actor - 1] = carRaceState ? carRaceState->GetState(actor)->GetHighScore() : 0;
1455 totalScore += scores[0][actor - 1];
1456
1457 scores[1][actor - 1] = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetHighScore() : 0;
1458 totalScore += scores[1][actor - 1];
1459
1460 scores[2][actor - 1] = pizzaMissionState ? pizzaMissionState->GetHighScore(actor) : 0;
1461 totalScore += scores[2][actor - 1];
1462
1463 scores[3][actor - 1] = towTrackMissionState ? towTrackMissionState->GetHighScore(actor) : 0;
1464 totalScore += scores[3][actor - 1];
1465
1466 scores[4][actor - 1] = ambulanceMissionState ? ambulanceMissionState->GetHighScore(actor) : 0;
1467 totalScore += scores[4][actor - 1];
1468 }
1469
1470 MxS32 unk0x2c;
1471 ScoreItem* p_scorehist = FUN_1003cc90(&GameState()->m_players[0], GameState()->m_unk0x24, unk0x2c);
1472
1473 if (p_scorehist != NULL) {
1474 p_scorehist->m_totalScore = totalScore;
1475 memcpy(p_scorehist->m_scores, scores, sizeof(p_scorehist->m_scores));
1476 }
1477 else {
1478 if (m_count < (MxS16) sizeOfArray(m_scores)) {
1479 m_scores[m_count].m_totalScore = totalScore;
1480 memcpy(m_scores[m_count].m_scores, scores, sizeof(m_scores[m_count].m_scores));
1481 m_scores[m_count].m_name = GameState()->m_players[0];
1482 m_scores[m_count].m_unk0x2a = GameState()->m_unk0x24;
1483 m_count++;
1484 }
1485 else if (m_scores[19].m_totalScore <= totalScore) {
1486 m_scores[19].m_totalScore = totalScore;
1487 memcpy(m_scores[19].m_scores, scores, sizeof(m_scores[19].m_scores));
1488 m_scores[19].m_name = GameState()->m_players[0];
1489 m_scores[19].m_unk0x2a = GameState()->m_unk0x24;
1490 }
1491 }
1492
1493 MxU8 tmpScores[5][5];
1494 Username tmpPlayer;
1495 MxS16 tmpUnk0x2a;
1496
1497 // TODO: Match bubble sort loops
1498 for (MxS32 i = m_count - 1; i > 0; i--) {
1499 for (MxS32 j = 1; j <= i; j++) {
1500 if (m_scores[j - 1].m_totalScore < m_scores[j].m_totalScore) {
1501 memcpy(tmpScores, m_scores[j - 1].m_scores, sizeof(tmpScores));
1502 tmpPlayer = m_scores[j - 1].m_name;
1503 tmpUnk0x2a = m_scores[j - 1].m_unk0x2a;
1504
1505 memcpy(m_scores[j - 1].m_scores, m_scores[j].m_scores, sizeof(m_scores[j - 1].m_scores));
1506 m_scores[j - 1].m_name = m_scores[j].m_name;
1507 m_scores[j - 1].m_unk0x2a = m_scores[j].m_unk0x2a;
1508
1509 memcpy(m_scores[j].m_scores, tmpScores, sizeof(m_scores[j].m_scores));
1510 m_scores[j].m_name = tmpPlayer;
1511 m_scores[j].m_unk0x2a = tmpUnk0x2a;
1512 }
1513 }
1514 }
1515 }
1516}
1517
1518// FUNCTION: LEGO1 0x1003cc90
1519// FUNCTION: BETA10 0x1008732a
1521 LegoGameState::Username* p_player,
1522 MxS16 p_unk0x24,
1523 MxS32& p_unk0x2c
1524)
1525{
1526 MxS32 i = 0;
1527 for (; i < m_count; i++) {
1528 if (!memcmp(p_player, &m_scores[i].m_name, sizeof(*p_player)) && m_scores[i].m_unk0x2a == p_unk0x24) {
1529 break;
1530 }
1531 }
1532
1533 p_unk0x2c = i;
1534
1535 if (i >= m_count) {
1536 return NULL;
1537 }
1538
1539 return &m_scores[i];
1540}
1541
1542// FUNCTION: LEGO1 0x1003ccf0
1543// FUNCTION: BETA10 0x100873e7
1545{
1546 if (p_storage->IsReadMode()) {
1547 p_storage->ReadS16(m_unk0x372);
1548 p_storage->ReadS16(m_count);
1549
1550 for (MxS16 i = 0; i < m_count; i++) {
1551 MxS16 j;
1552 p_storage->ReadS16(j);
1553 m_scores[i].Serialize(p_storage);
1554 }
1555 }
1556 else if (p_storage->IsWriteMode()) {
1557 p_storage->WriteS16(m_unk0x372);
1558 p_storage->WriteS16(m_count);
1559
1560 for (MxS16 i = 0; i < m_count; i++) {
1561 p_storage->WriteS16(i);
1562 m_scores[i].Serialize(p_storage);
1563 }
1564 }
1565
1566 return SUCCESS;
1567}
1568
1569// FUNCTION: LEGO1 0x1003cdd0
1571{
1572 LegoFile storage;
1573 MxString savePath(m_savePath);
1574 savePath += "\\";
1575 savePath += g_historyGSI;
1576
1577 if (p_flags == LegoFile::c_write) {
1579 }
1580
1581 if (storage.Open(savePath.GetData(), p_flags) == SUCCESS) {
1582 m_history.Serialize(&storage);
1583 }
1584}
1585
1586// FUNCTION: LEGO1 0x1003cea0
1588{
1589 m_currentAct = p_currentAct;
1590}
1591
1592// FUNCTION: LEGO1 0x1003ceb0
1594{
1596 m_loadedAct = e_act1;
1597 }
1599 m_loadedAct = e_act2;
1600 }
1602 m_loadedAct = e_act3;
1603 }
1604 else {
1605 m_loadedAct = e_actNotFound;
1606 }
1607}
[AI] Defines enumerated script action identifiers for Act 3 of LEGO Island scripting system.
[AI] Holds state and transient gameplay data for the first act on Lego Island.
Definition: isle.h:29
MxU32 GetUnknown18()
[AI] Retrieves the internal state variable at offset 0x018 (purpose: current major state,...
Definition: isle.h:68
Holds state and scoring information for the Ambulance mission.
Definition: ambulance.h:12
MxS16 GetHighScore(MxU8 p_actorId)
[AI] Retrieves the highest score achieved by a specified actor.
The state object used for the car race mini-game.
Definition: carrace.h:16
[AI] Represents the player-controllable dune buggy vehicle in LEGO Island, inheriting movement and in...
Definition: dunebuggy.h:16
[AI] Represents the flyable helicopter vehicle/path actor in the game, handling all in-game behaviors...
Definition: helicopter.h:57
[AI] Represents the state of the Infocenter area, storing scripts, dialogue playlists and UI letter p...
Definition: infocenter.h:23
MxStillPresenter * m_letters[7]
[AI] UI presenters for each slot in the 7-letter name entry field (could be player's registered name)...
Definition: infocenter.h:154
MxBool HasRegistered()
[AI] True if any letter slot is filled (indicating the player has registered).
Definition: infocenter.h:83
Derived path actor type for handling player transitions and activities on LEGO Island.
Definition: islepathactor.h:23
@ c_spawnBit1
[AI] Bit flag to trigger additional camera/animation sequence during spawn. [AI]
Definition: islepathactor.h:30
@ c_playMusic
[AI] Bit flag to trigger background music playback on spawn. [AI]
Definition: islepathactor.h:31
@ c_spawnBit3
[AI] Unused/reserved extra spawn bit in flag set. [AI]
Definition: islepathactor.h:32
MxResult Create(MxDSAction &p_dsAction) override
[AI] Initialize this actor from a DSAction.
[AI] Represents the main overworld (LEGO Island) in the game, acting as the central hub and state mac...
Definition: isle.h:179
virtual void VTable0x6c(LegoPathActor *p_actor)
[AI] Removes a path-based actor (vehicle, etc.) from the Isle world and unbinds pointers as needed.
Definition: isle.cpp:1146
[AI] Per-race state data and logic holder for JetskiRace, used for tracking player and AI standings,...
Definition: jetskirace.h:107
[AI] Represents the jetski vehicle placed in the 3D world of LEGO Island.
Definition: jetski.h:19
int SetFrustrum(float p_fov, float p_front, float p_back)
[AI] Sets the 3D perspective frustum parameters for camera and view.
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.
static const char * GetActorName(MxU8 p_id)
[AI] Gets the static display name of an actor by ID.
Definition: legoactor.cpp:119
virtual void SetActorId(MxU8 p_actorId)
[AI] Sets the actor's numeric ID.
Definition: legoactor.h:81
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 Reset(MxBool p_und)
[AI] Resets all internal state; optionally resets animation state too.
void Resume()
[AI] Resumes animation manager from suspension, restoring all previously suspended state.
void Suspend()
[AI] Suspends all activity, saving out transition/animation state, and disables extra processing.
Variable controlling the sky background color (HSV) and related light color in the game.
Definition: legogamestate.h:30
void SetLightColor()
Sets the light color according to the current HSV parameters. [AI].
void SetValue(const char *p_colorString) override
Sets the value of the background color using a command string.
void SetLightColor(float p_r, float p_g, float p_b)
Sets the global scene light color based on RGB values.
void ToggleSkyColor()
Rotates hue to cycle sky color (e.g. progressing through the day), updating all visuals....
void ToggleDayNight(MxBool p_sun)
Adjusts the saturation (day/night) and updates sky color and light accordingly.
void Init()
[AI] Initializes all manager fields, resets animation tracking, and loads the default building info a...
MxResult Write(LegoStorage *p_storage)
[AI] Serializes current building state to the given storage.
MxResult Write(LegoStorage *p_storage)
[AI] Writes the persistent character info data to a storage object.
void Init()
[AI] Initializes all actor info structures based on their templates/defaults.
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.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
void ClearFlag(MxU8 p_flag)
[AI] Clears the given flag in the flags byte.
Definition: legoentity.h:179
virtual void ResetWorldTransform(MxBool p_cameraFlag)
[AI] Resets the transformation for this entity (e.g., used with camera transitions).
Definition: legoentity.cpp:41
@ c_managerOwned
[AI] Indicates this entity is managed/owned by an entity manager [AI]
Definition: legoentity.h:30
Implementation of LegoStorage for file-backed storage using stdio FILE*.
Definition: legostorage.h:387
LegoResult Open(const char *p_name, LegoU32 p_mode)
Opens a file with given name and mode, closing existing file if needed.
Variable controlling full screen movie playback in the video manager.
Definition: legogamestate.h:65
LegoFullScreenMovie(const char *p_key, const char *p_value)
Construct with variable name and value ("fsmovie", "disable"/"enable"). [AI].
void SetValue(const char *p_option) override
Sets the option to enable or disable fullscreen movies.
Comprehensive persistent game state manager: handles save/load, player selection, area switching,...
Definition: legogamestate.h:78
void GetFileSavePath(MxString *p_outPath, MxS16 p_slotn)
Writes the full save path for the given slot to the output string object.
MxS16 m_playerCount
Number of player usernames registered. [AI].
void SwitchPlayer(MxS16 p_playerId)
Make the specified player (by ID/index) the current player.
void SerializeScoreHistory(MxS16 p_flags)
Serializes the score history table to score file.
MxS16 m_unk0x24
Serial/generation marker used for score records. [AI].
void SwitchArea(Area p_area)
Switches the whole game state into a new area/world; manages transitions/scene loads.
JukeboxScript::Script m_jukeboxMusic
Which jukebox music is currently set to play. [AI].
History m_history
High score table/history for current game. [AI].
void SetCurrentAct(Act p_currentAct)
Sets the current game act.
void Init()
Re-initializes all world/variable state to the current act's defaults. [AI].
void ResetROI()
Re-applies the current actor's ROI to the 3D world (remove/add for update). [AI].
Area m_currentArea
Area/world the player is presently in. [AI].
MxBool m_isDirty
TRUE if unsaved changes present. [AI].
Area m_unk0x42c
Used for act area storage on save/load. [AI].
void SetSavePath(char *p_savePath)
Sets the path for current save slot directory; creates a copy of input string.
LegoState * CreateState(const char *p_stateName)
Creates an instance of given state, registers it, and returns pointer.
Act
Indicates which main storyline section (Act 1/2/3) is currently active.
Definition: legogamestate.h:82
@ e_act3
Act 3: final main story segment. [AI].
Definition: legogamestate.h:86
@ e_act1
Act 1: the first main segment of the game. [AI].
Definition: legogamestate.h:84
@ e_actNotFound
No act currently loaded (does not correspond to valid play). [AI].
Definition: legogamestate.h:83
@ e_act2
Act 2: main story segment two. [AI].
Definition: legogamestate.h:85
void StopArea(Area p_area)
Calls cleanup logic for the specified area (removes actors, VMs, closes handles, etc....
void RegisterState(LegoState *p_state)
Registers a state object, replacing by class if already present.
MxResult DeleteState()
Destroys and removes all current state objects, freeing memory and unregistering. [AI].
void SerializePlayersInfo(MxS16 p_flags)
Serializes all player info (usernames, player count) to the appropriate storage.
Area m_previousArea
Where player was before last area switch. [AI].
Username m_players[9]
Array of all known player usernames (max 9, ranked). [AI].
MxResult Save(MxULong p_slot)
Saves persistent game state (world variables, actor, etc.) to a file slot.
void RemoveActor()
Removes (and deletes) the current user actor from the world.
void FindLoadedAct()
Analyses the loaded Lego worlds to determine which act is present. [AI].
LegoState * GetState(const char *p_stateName)
Find an existing state (LegoState-derived) object by its registered script/class name.
MxS16 FindPlayer(Username &p_player)
Finds the player index for a username; returns -1 if not found.
Area
Enumeration of all major in-game locations ("areas") for area/scene management and serialization.
Definition: legogamestate.h:92
@ e_infomain
Information Center, main screen. [AI].
Definition: legogamestate.h:96
@ e_unk20
Unknown [AI].
@ e_previousArea
Alias: go to previous area. [AI].
Definition: legogamestate.h:94
@ e_unk31
Unknown [AI].
@ e_motocycle
Motorcycle (vehicle, spawn). [AI].
@ e_dunecarbuild
Vehicle construction: dune buggy. [AI].
@ e_racecarbuild
Vehicle construction: racecar. [AI].
@ e_bike
Bike minigame (spawns). [AI].
@ e_police
Police Station interior. [AI].
@ e_elevdown
Elevator moving down (animated). [AI].
@ e_copter
Helicopter (vehicle, spawn). [AI].
@ e_unk66
Used for some spawn locations. [AI].
@ e_hospitalExterior
Hospital, seen from outside. [AI].
@ e_dunecar
Dune buggy (vehicle, for spawn). [AI].
@ e_act3script
Act 3 world/script main. [AI].
@ e_act2main
Act 2 world main screen. [AI].
@ e_jetraceExterior
Jetski race transition? [AI].
@ e_carrace
Car race (track, main). [AI].
@ e_elevride2
Elevator ride/cab down (animated). [AI].
@ e_garageExterior
Garage (vehicle construction) exterior. [AI].
@ e_garage
Garage (build vehicle) interior. [AI].
@ e_garadoor
Garage door or doorway. [AI].
@ e_copterbuild
Vehicle construction: helicopter. [AI].
@ e_jetrace
Jetski race area, "interior"/main. [AI].
@ e_polidoor
Police Station door. [AI].
@ e_jukeboxw
Western Jukebox (special minigame). [AI].
@ e_isle
Open world (LEGO Island main map). [AI].
Definition: legogamestate.h:95
@ e_regbook
Registration book "new game" area. [AI].
@ e_histbook
History book (scoreboard). [AI].
@ e_jetrace2
Jetski race (exterior). [AI].
@ e_pizzeriaExterior
Pizzeria, seen from outside. [AI].
@ e_unk28
Used for certain spawn locations. [AI].
@ e_infoscor
Info Center hi-score area. [AI].
@ e_undefined
Undefined or unset area. [AI].
Definition: legogamestate.h:93
@ e_unk33
Used for certain player spawns. [AI].
@ e_skateboard
Skateboard (vehicle, spawn). [AI].
@ e_elevride
Elevator ride/cab up (animated). [AI].
@ e_jetskibuild
Vehicle construction: jetski. [AI].
@ e_unk4
Unknown / possibly reserved. [AI].
Definition: legogamestate.h:98
@ e_jukeboxExterior
Jukebox, seen from outside. [AI].
@ e_elevbott
Elevator bottom. [AI].
Definition: legogamestate.h:99
@ e_unk21
Unknown [AI].
@ e_observe
Observatory interior. [AI].
@ e_hospital
Hospital interior. [AI].
@ e_policeExterior
Police Station, from outside. [AI].
@ e_carraceExterior
Car race exterior/transition. [AI].
@ e_infodoor
Info Center door/title view. [AI].
Definition: legogamestate.h:97
@ e_seaview
Ocean-side view at observatory. [AI].
@ e_elevopen
Elevator doors open. [AI].
@ e_unk17
Unknown. [AI].
@ e_jetski
Jetski (vehicle, spawn). [AI].
MxResult Load(MxULong p_slot)
Loads persistent game state from specified save slot.
void SetActor(MxU8 p_actorId)
Change the player character in the world to the given actor ID.
MxResult AddPlayer(Username &p_player)
Adds a new player (username), moves others down, manages slot files.
static MxResult UpdateLocation(MxU32 p_location)
[AI] Static: Changes the current world/camera location to the specified index in the location registr...
void RemoveWorld(const MxAtomId &p_atom, MxLong p_objectId)
[AI] Removes worlds by Atom and/or id, deleting matching entries from the world list and freeing reso...
Definition: legomain.cpp:335
@ c_disable3d
[AI] When set, disables 3D rendering. [AI]
Definition: legomain.h:48
@ c_disableInput
[AI] When set, disables input processing. [AI]
Definition: legomain.h:47
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
void SetBoundary(LegoPathBoundary *p_boundary)
[AI] Assigns a new boundary for the actor (for path switching).
LegoPathBoundary * GetBoundary()
[AI] Retrieves the current path boundary associated with this actor.
MxResult Write(LegoStorage *p_storage)
[AI] Serializes persistent plant state (color, variant, mood, animation, etc) to storage for save gam...
void Init()
[AI] Zeroes out state, resets world ID, and copies default plant info to runtime plant info array.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
static void SetColorOverride(ColorOverride p_colorOverride)
[AI] [Static] Sets the global color override callback function to allow palette remapping or customiz...
Definition: legoroi.cpp:808
[AI] Base class for game state blocks which encapsulate serializable and/or resettable aspects of the...
Definition: legostate.h:17
virtual MxResult Serialize(LegoStorage *p_storage)
[AI] Serialize state to a storage (for save/load).
Definition: legostate.h:141
const char * ClassName() const override
[AI] Gets this class's name for RTTI/IsA functionality.
Definition: legostate.h:155
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.
LegoStorage * WriteU8(LegoU8 p_data)
Writes an 8-bit unsigned value to storage.
Definition: legostorage.h:99
virtual LegoBool IsWriteMode()
Returns TRUE if object was opened in write mode.
Definition: legostorage.h:72
LegoStorage * ReadU8(LegoU8 &p_data)
Reads an 8-bit unsigned value from storage.
Definition: legostorage.h:206
LegoStorage * WriteS16(LegoS16 p_data)
Writes a 16-bit signed value to storage.
Definition: legostorage.h:110
LegoStorage * ReadS16(LegoS16 &p_data)
Reads a 16-bit signed value from storage.
Definition: legostorage.h:217
LegoStorage * ReadS32(MxS32 &p_data)
Reads a 32-bit signed value from storage.
Definition: legostorage.h:240
virtual LegoResult Read(void *p_buffer, LegoU32 p_size)=0
Read bytes from storage into buffer.
virtual LegoBool IsReadMode()
Returns TRUE if object was opened in read mode.
Definition: legostorage.h:78
LegoStorage * ReadString(char *p_data)
Reads a length-prefixed string from storage.
Definition: legostorage.h:192
LegoStorage * WriteU16(LegoU16 p_data)
Writes a 16-bit unsigned value to storage.
Definition: legostorage.h:121
@ c_read
Open for read operations. [AI].
Definition: legostorage.h:23
@ c_write
Open for write operations. [AI].
Definition: legostorage.h:24
LegoStorage * WriteS32(MxS32 p_data)
Writes a 32-bit signed value to storage.
Definition: legostorage.h:133
[AI] Extends the functionality of MxVideoManager to provide LEGO Island–specific video and 3D graphic...
void EnableFullScreenMovie(MxBool p_enable)
[AI] Convenience method to enable or disable fullscreen movie playback with default scaling.
void SetUnk0x554(MxBool p_unk0x554)
[AI] Used to control a non-interactive, non-main rendering update (PutData only).
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
void SetSkyColor(float p_red, float p_green, float p_blue)
[AI] Sets the RGB color for the sky/background in the 3D view and updates the palette accordingly.
void SetLightColor(BOOL bDirectionalLight, float red, float green, float blue)
[AI] Sets the RGB color for either the sun or directional light.
Definition: legoview1.cpp:223
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
virtual void Enable(MxBool p_enable)
Enables or disables (pauses) the world and its main components.
Definition: legoworld.cpp:684
MxBool GetUnknown0xd0Empty()
Checks if the 'set0xd0' set is empty.
Definition: legoworld.h:295
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
void RemoveActor(LegoPathActor *p_actor)
Removes an actor from all known path controllers.
Definition: legoworld.cpp:325
void Stop()
[AI] Immediately stops all background music, clears all actions and presenters, and resets tickle sta...
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
Definition: mxdsobject.h:118
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
Definition: mxdsobject.h:147
MxResult Send(MxCore *p_listener, const MxNotificationParam &p_param)
[AI] Queues a notification to be sent to a specific registered listener.
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
virtual MxCore * Create(const char *p_name)
[AI] Creates a new instance of the class matching the provided string name.
Mindscape custom string class for managing dynamic C-strings within the game engine.
Definition: mxstring.h:14
char * GetData() const
Returns a pointer to the internal character buffer.
Definition: mxstring.h:110
void ToLowerCase()
Converts the string contents to lowercase in-place.
Definition: mxstring.cpp:97
void ToUpperCase()
Converts the string contents to uppercase in-place.
Definition: mxstring.cpp:90
MxVariableTable is a specialized hash table for storing key/value string variables used by the LEGO I...
const char * GetVariable(const char *p_key)
Returns the value for the variable with a given key, or an empty string if not found.
void SetVariable(const char *p_key, const char *p_value)
Sets a variable by key and value, replacing or updating if it exists.
MxString m_key
[AI] The variable's key (name), always stored in uppercase.
Definition: mxvariable.h:77
MxString m_value
[AI] The variable's value.
Definition: mxvariable.h:82
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
void FUN_100a58f0(const Matrix4 &p_transform)
Assigns the given matrix as the local-to-world transformation and enables some internal flags.
Pizza mission state for the pizza delivery minigame and related characters.
Definition: pizza.h:21
MxS16 GetHighScore(MxU8 p_actorId)
Retrieves the historical best (high) score for a given actor's pizza mission.
Definition: pizza.h:220
[AI] Represents the drivable race car entity in the LEGO Island world.
Definition: racecar.h:24
Entry * GetState(MxU8 p_id)
[AI] Fetches a race state entry matching the given entry ID, or NULL if not found in the array.
Definition: legorace.cpp:151
[AI] State class for the TowTrack mini-game, storing scores by character and handling their serializa...
Definition: towtrack.h:17
MxS16 GetHighScore(MxU8 p_actorId)
[AI] Retrieves the highscore for a given actor in the Tow Track mini-game.
#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
[AI] Contains enumeration of script actions for ElevbottScript.
[AI] Enumerates all script elements used in the "Garage" sequence of LEGO Island.
const char * g_strDisable
void LoadIsle()
const char * g_strEnable
ColorStringStruct g_colorSaveData[43]
const char * g_endOfVariables
const char * g_historyGSI
const char * g_fileExtensionGS
const char * g_reset
MxBool ROIColorOverride(const char *p_input, char *p_output, MxU32 p_copyLen)
Helper for ROI color override mechanism, mapping special part labels to variable table values.
const char * g_delimiter
const char * g_set
const char * g_playersGSI
MxBool ROIColorOverride(const char *p_input, char *p_output, MxU32 p_copyLen)
Helper for ROI color override mechanism, mapping special part labels to variable table values.
#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
void InvokeAction(Extra::ActionType p_actionId, const MxAtomId &p_pAtom, MxS32 p_streamId, LegoEntity *p_sender)
[AI] Dispatches and triggers a game action on the given script or object.
Definition: legoutils.cpp:271
MxBool RemoveFromWorld(MxAtomId &p_entityAtom, MxS32 p_entityId, MxAtomId &p_worldAtom, MxS32 p_worldEntityId)
[AI] Removes a game object referenced by atom/id from a specific world, handling presenters and EndAc...
Definition: legoutils.cpp:524
void SetCameraControllerFromIsle()
[AI] Updates the current camera controller to the main ISLE camera specified in the global script.
Definition: legoutils.cpp:382
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float *p_rOut, float *p_bOut, float *p_gOut)
[AI] Converts HSV color (hue/saturation/value) to RGB (red/green/blue).
Definition: legoutils.cpp:388
MxAtomId * g_isleScript
[AI] Node used in hierarchical scene graphs and animation trees. [AI]
Definition: scripts.cpp:32
void SetLightPosition(MxS32 p_index)
[AI] Sets the world space position and direction of the in-game directional light,...
Definition: legoutils.cpp:628
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
Definition: misc.cpp:61
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
LegoAnimationManager * AnimationManager()
[AI] Accessor for the animation manager, which controls Lego character/world animation state....
Definition: misc.cpp:69
LegoBuildingManager * BuildingManager()
[AI] Accessor for the building manager, handles constructible buildings and structures....
Definition: misc.cpp:123
MxBackgroundAudioManager * BackgroundAudioManager()
[AI] Accessor for the background audio manager. Used for background music and ambient sounds....
Definition: misc.cpp:37
void SetUserActor(LegoPathActor *p_userActor)
[AI] Sets the user-controlled LegoPathActor in the engine.
Definition: misc.cpp:168
LegoPlantManager * PlantManager()
[AI] Accessor for the plant manager, handling in-game foliage and plants. [AI]
Definition: misc.cpp:115
LegoWorld * FindWorld(const MxAtomId &p_atom, MxS32 p_entityid)
[AI] Searches for or retrieves a LegoWorld instance based on an atom id and entity id.
Definition: misc.cpp:188
void FUN_10015820(MxBool p_disable, MxU16 p_flags)
[AI] Utility for enabling or disabling functionality in LegoOmni based on certain flags.
Definition: misc.cpp:143
LegoNavController * NavController()
[AI] Accessor for the navigation controller, managing player/camera navigation. [AI]
Definition: misc.cpp:77
LegoOmni * Lego()
[AI] Retrieves the global LegoOmni singleton instance, providing access to core subsystems.
Definition: misc.cpp:16
LegoPathActor * UserActor()
[AI] Accessor for the user (player-controllable) LegoPathActor. [AI]
Definition: misc.cpp:85
MxVariableTable * VariableTable()
[AI] Returns the variable table used for script variables and global key/value state.
Definition: mxmisc.cpp:73
MxObjectFactory * ObjectFactory()
[AI] Returns the factory for creating core engine objects from atom/type ids.
Definition: mxmisc.cpp:9
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
@ c_notificationType20
[AI] Unspecified notification type [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
signed short MxS16
[AI]
Definition: mxtypes.h:26
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxULong
[AI]
Definition: mxtypes.h:93
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
void OmniError(const char *p_message, MxS32 p_status)
Displays or logs an error message using the current user message handler, or aborts on error status i...
@ c__Act2Main
[AI] Root script or entry point for Act2Main actions.
@ c__Act3
[AI] Reserved or unnamed root action for Act 3 scripting context. [AI]
Definition: act3_actions.h:31
@ c__CarRace_World
[AI] Root node/world object for the Car Race script instance.
@ c_nrt002pz_Anim
[AI] Triggers the animation sequence for "nrt002pz".
@ c_Helicopter_Actor
[AI] Main helicopter actor logic entry/action.
@ c__StartUp
[AI] Start-up/initialization logic for the copter script context.
@ c__StartUp
[AI] Startup or initial script event.
@ c_DuneBugy_Actor
[AI] ID for the main Dune Buggy actor instance.
@ c__StartUp
[AI] Action for system or scene startup logic in the Elevbott context.
@ c__StartUp
[AI] Triggers Garage start-up logic or animation. [AI]
@ c__StartUp
[AI] Script ID for Histbook startup/init routine.
@ c__StartUp
[AI] Corresponds to the startup/initialization event. [SI file: StartUp]
@ c__InfoMain
[AI] Root script or entrypoint for InfoMain. Used to identify the main script file/context for scene ...
@ c_ElevDown_LeftArrow_Ctl
@ c_ElevOpen_RightArrow_Ctl
@ c_Observe_GlobeRArrow_Ctl
@ c_Observe_SkyColor_Ctl
@ c_Observe_Globe4_Bitmap
@ c_SeaView_Background_Bitmap
@ c_ElevRide_Three_Ctl
@ c_Observe_Background_Bitmap
@ c_PoliDoor_LeftArrow_Ctl
@ c_PoliDoor_RightArrow_Ctl
@ c_ElevDown_Background_Bitmap
@ c_GaraDoor_Background_Bitmap
@ c_Observe_Globe2_Bitmap
@ c_Observe_RightArrow_Ctl
@ c_PoliDoor_Background_Bitmap
@ c_Observe_Globe5_Bitmap
@ c_Observe_Globe1_Bitmap
@ c_GaraDoor_RightArrow_Ctl
@ c_ElevRide_Background_Bitmap
@ c_Observe_Globe3_Bitmap
@ c_ElevOpen_LeftArrow_Ctl
@ c_Observe_LeftArrow_Ctl
@ c_Observe_Globe6_Bitmap
@ c_ElevDown_RightArrow_Ctl
@ c_ElevOpen_Background_Bitmap
@ c_GaraDoor_LeftArrow_Ctl
@ c_Observe_GlobeLArrow_Ctl
@ c_SeaView_RightArrow_Ctl
@ c_ElevDown_Elevator_Ctl
@ c_SeaView_LeftArrow_Ctl
@ c__JetRace_World
[AI] Root world scene object for JetRace area.
@ c__StartUp
[AI] Start-up/bootstrapping script, likely called at initialization. [AI]
@ c_Jetski_Actor
[AI] Main jetski actor entity script. [AI]
@ c_DuneCarBuild_Movie
[AI] Movie/cutscene for Dune Car build sequence.
@ c_JetskiBuild_Movie
[AI] Movie/cutscene for Jetski build sequence.
@ c_RaceCarBuild_Movie
[AI] Movie/cutscene for Race Car build sequence.
@ c_noneJukebox
[AI] Special value representing that no Jukebox script is selected or active.
@ c_HelicopterBuild_Movie
[AI] Movie/cutscene that plays during the helicopter build.
@ c__StartUp
[AI] Start-up action for the Jukeboxw component, usually for initialization sequence....
@ c__StartUp
[AI] Startup/init action for the Racecar script context. Should be first action executed.
@ c_RaceCar_Actor
[AI] Script action corresponding to the main interactive racecar actor.
@ c__StartUp
[AI] Initial startup action/script. [AI]
@ c_SoundAndAnim_Action
[AI] Main action combining sound and animation. [AI]
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_infoscorScript
[AI] Script AtomId for the Info Center scoring/stat script.
Definition: scripts.cpp:45
MxAtomId * g_act3Script
[AI] Script AtomId for Act 3 (endgame/helicopter chase) scripting.
Definition: scripts.cpp:66
MxAtomId * g_policeScript
[AI] Script AtomId for the police station script logic.
Definition: scripts.cpp:57
MxAtomId * g_regbookScript
[AI] Script AtomId for the registration book script (name entry).
Definition: scripts.cpp:48
MxAtomId * g_histbookScript
[AI] Script AtomId for the history book script (view records).
Definition: scripts.cpp:51
MxAtomId * g_jukeboxScript
[AI] Script AtomId for the Jukebox entity/event script.
Definition: scripts.cpp:70
MxAtomId * g_infodoorScript
[AI] Script AtomId for the Info Center door logic script.
Definition: scripts.cpp:38
MxAtomId * g_carracerScript
[AI] Script AtomId for the car racer entity or race logic.
Definition: scripts.cpp:22
MxAtomId * g_infomainScript
[AI] Script AtomId for the main Info Center world/event script.
Definition: scripts.cpp:42
MxAtomId * g_racecarScript
[AI] Script AtomId for the build/race car SI file.
Definition: scripts.cpp:15
MxAtomId * g_garageScript
[AI] Script AtomId for the vehicle garage/world logic.
Definition: scripts.cpp:60
MxAtomId * g_sndAnimScript
[AI] Script AtomId for sound animation or related cutscenes.
Definition: scripts.cpp:85
MxAtomId * g_copterScript
[AI] Script AtomId for the helicopter ("copter") build or activity.
Definition: scripts.cpp:6
MxAtomId * g_jetskiScript
[AI] Script AtomId for the jet ski-related script.
Definition: scripts.cpp:12
MxAtomId * g_jetraceScript
[AI] Script AtomId for jet racing-related scripts.
Definition: scripts.cpp:25
MxAtomId * g_elevbottScript
[AI] Script AtomId for the elevator bottom script in Info Center.
Definition: scripts.cpp:35
MxAtomId * g_hospitalScript
[AI] Script AtomId for the hospital SI logic.
Definition: scripts.cpp:54
MxAtomId * g_act2mainScript
[AI] Script AtomId for main script of Act 2 (island event progression).
Definition: scripts.cpp:63
MxAtomId * g_dunecarScript
[AI] Script AtomId for the dune car building or mission script.
Definition: scripts.cpp:9
MxAtomId * g_jetracerScript
[AI] Script AtomId for a jet racer entity or event.
Definition: scripts.cpp:28
MxAtomId * g_carraceScript
[AI] Script AtomId for the car racing event script.
Definition: scripts.cpp:19
MxAtomId * g_jukeboxwScript
[AI] Script AtomId for the JukeboxW (alternate or special jukebox) script.
Definition: scripts.cpp:82
Key-value pair tying a ROI color key name to a LEGO color string.
Definition: legogamestate.h:22
@ e_opendisk
[AI] Open resource from disk [AI]
Definition: extra.h:27
@ e_stop
[AI] Stop an activity or playback [AI]
Definition: extra.h:31
@ e_start
[AI] Start an activity or playback [AI]
Definition: extra.h:30
@ e_close
[AI] Close the resource or action [AI]
Definition: extra.h:29
@ e_disable
[AI] Disable a capability or flag [AI]
Definition: extra.h:35
ScoreItem * FUN_1003cc90(Username *p_player, MxS16 p_unk0x24, MxS32 &p_unk0x2c)
Looks up a score entry for player and attempt index, or returns NULL if not found.
MxS16 m_unk0x372
Serial/sequence field incremented for each player. [AI].
void WriteScoreHistory()
Rebuilds the high score table from current state objects, sorts it descending. [AI].
MxResult Serialize(LegoStorage *p_storage)
Serializes whole history, including all score item slots, to the provided storage/backend....
Single score record for a player, including high score grids for all major games.
MxResult Serialize(LegoStorage *p_storage)
Reads/writes the ScoreItem to/from storage.
MxS16 m_totalScore
The total score calculated from all minigames. [AI].
MxU8 m_scores[5][5]
Scores by (minigame,row,column): custom packed format for all 5 game types. [AI].
Player "username", stored as 7 short integers (character codes).
MxS16 m_letters[7]
Array of 7 wide characters: player name (filled by registration). [AI].
void Set(Username &p_other)
Set this username by copying another.
Username & operator=(const Username &p_other)
Assignment, deep-copy of letter buffer [AI].
MxResult Serialize(LegoStorage *p_storage)
Reads or writes username as S16 array to/from the given storage.
MxS16 GetHighScore()
[AI] Retrieves the race entry's current high score.
Definition: legorace.h:57