Isle
Loading...
Searching...
No Matches
legovariables.cpp
Go to the documentation of this file.
1#include "legovariables.h"
2
4#include "legogamestate.h"
5#include "legonavcontroller.h"
6#include "legovideomanager.h"
7#include "misc.h"
8#include "roi/legoroi.h"
9
14
15// GLOBAL: LEGO1 0x100f7ab0
16// STRING: LEGO1 0x100f09c0
17const char* g_varJETSPEED = "jetSPEED";
18
19// GLOBAL: LEGO1 0x100f7ab4
20// STRING: LEGO1 0x100f7aa8
21const char* g_varJETFUEL = "jetFUEL";
22
23// GLOBAL: LEGO1 0x100f7658
24// STRING: LEGO1 0x100f764c
25const char* g_varDUNESPEED = "duneSPEED";
26
27// GLOBAL: LEGO1 0x100f765c
28// STRING: LEGO1 0x100f7640
29const char* g_varDUNEFUEL = "duneFUEL";
30
31// GLOBAL: LEGO1 0x100f3994
32// STRING: LEGO1 0x100f3988
33const char* g_varMOTOSPEED = "motoSPEED";
34
35// GLOBAL: LEGO1 0x100f3998
36// STRING: LEGO1 0x100f397c
37const char* g_varMOTOFUEL = "motoFUEL";
38
39// GLOBAL: LEGO1 0x100f39b8
40// STRING: LEGO1 0x100f39ac
41const char* g_varAMBULSPEED = "ambulSPEED";
42
43// GLOBAL: LEGO1 0x100f39bc
44// STRING: LEGO1 0x100f39a0
45const char* g_varAMBULFUEL = "ambulFUEL";
46
47// GLOBAL: LEGO1 0x100f43b0
48// STRING: LEGO1 0x100f43a4
49const char* g_varTOWSPEED = "towSPEED";
50
51// GLOBAL: LEGO1 0x100f43b4
52// STRING: LEGO1 0x100f439c
53const char* g_varTOWFUEL = "towFUEL";
54
55// the STRING is already declared for GLOBAL 0x101020cc
56// GLOBAL: LEGO1 0x100f3a40
57const char* g_varVISIBILITY = "VISIBILITY";
58
59// GLOBAL: LEGO1 0x100f3a44
60// STRING: LEGO1 0x100f3a30
61const char* g_varCAMERALOCATION = "CAMERA_LOCATION";
62
63// GLOBAL: LEGO1 0x100f3a48
64// STRING: LEGO1 0x100f3a28
65const char* g_varCURSOR = "CURSOR";
66
67// GLOBAL: LEGO1 0x100f3a4c
68// STRING: LEGO1 0x100f3a1c
69const char* g_varWHOAMI = "WHO_AM_I";
70
71// the STRING is already declared at LEGO1 0x100f3fb0
72// GLOBAL: LEGO1 0x100f3a50
73const char* g_delimiter2 = " \t";
74
75// GLOBAL: LEGO1 0x100f3a54
76// STRING: LEGO1 0x100f3a10
77const char* g_varHIDE = "HIDE";
78
79// GLOBAL: LEGO1 0x100f3a58
80// STRING: LEGO1 0x100f3a08
81const char* g_varSHOW = "SHOW";
82
83// GLOBAL: LEGO1 0x100f3a5c
84// STRING: LEGO1 0x100f3a00
85const char* g_papa = "Papa";
86
87// GLOBAL: LEGO1 0x100f3a60
88// STRING: LEGO1 0x100f39f8
89const char* g_mama = "Mama";
90
91// GLOBAL: LEGO1 0x100f3a64
92// STRING: LEGO1 0x100f39f0
93const char* g_pepper = "Pepper";
94
95// GLOBAL: LEGO1 0x100f3a68
96// STRING: LEGO1 0x100f39e8
97const char* g_nick = "Nick";
98
99// GLOBAL: LEGO1 0x100f3a6c
100// STRING: LEGO1 0x100f39e0
101const char* g_laura = "Laura";
102
103// FUNCTION: LEGO1 0x10037d00
104// FUNCTION: BETA10 0x100d5620
105void VisibilityVariable::SetValue(const char* p_value)
106{
107 MxVariable::SetValue(p_value);
108
109 if (p_value) {
110 char* instruction = strtok(m_value.GetData(), g_delimiter2);
111 char* name = strtok(NULL, g_delimiter2);
112 MxBool show;
113
114 if (!strcmpi(instruction, g_varHIDE)) {
115 show = FALSE;
116 }
117 else if (!strcmpi(instruction, g_varSHOW)) {
118 show = TRUE;
119 }
120 else {
121 return;
122 }
123
124 LegoROI* roi = FindROI(name);
125 if (roi) {
126 roi->SetVisibility(show);
127 }
128 }
129}
130
131// FUNCTION: LEGO1 0x10037d80
132void CameraLocationVariable::SetValue(const char* p_value)
133{
134 char buffer[256];
135 MxVariable::SetValue(p_value);
136
137 strcpy(buffer, p_value);
138
139 char* location = strtok(buffer, ",");
140 NavController()->UpdateLocation(location);
141
142 location = strtok(NULL, ",");
143 if (location) {
144 MxFloat pov = (MxFloat) atof(location);
145 VideoManager()->Get3DManager()->SetFrustrum(pov, 0.1f, 250.0f);
146 }
147}
148
149// FUNCTION: LEGO1 0x10037e30
150void CursorVariable::SetValue(const char* p_value)
151{
152}
153
154// FUNCTION: LEGO1 0x10037e40
155void WhoAmIVariable::SetValue(const char* p_value)
156{
157 MxVariable::SetValue(p_value);
158
159 if (!strcmpi(p_value, g_papa)) {
160 GameState()->SetActorId(3);
161 }
162 else if (!strcmpi(p_value, g_mama)) {
163 GameState()->SetActorId(2);
164 }
165 else if (!strcmpi(p_value, g_pepper)) {
166 GameState()->SetActorId(1);
167 }
168 else if (!strcmpi(p_value, g_nick)) {
169 GameState()->SetActorId(4);
170 }
171 else if (!strcmpi(p_value, g_laura)) {
172 GameState()->SetActorId(5);
173 }
174}
[AI] Variable for updating camera location and POV (field of view/frustum settings) for navigation an...
Definition: legovariables.h:81
void SetValue(const char *p_value) override
[AI] Sets the value of this variable, updating the navigation controller and 3D manager with camera c...
[AI] Variable to represent game cursor (pointer) state.
Definition: legovariables.h:96
void SetValue(const char *p_value) override
[AI] Sets the value of this variable—actual implementation is a stub.
int SetFrustrum(float p_fov, float p_front, float p_back)
[AI] Sets the 3D perspective frustum parameters for camera and view.
void SetActorId(MxU8 p_actorId)
Directly sets the current actor ID (preferred: use SetActor).
static MxResult UpdateLocation(MxU32 p_location)
[AI] Static: Changes the current world/camera location to the specified index in the location registr...
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
virtual void SetValue(const char *p_value)
[AI] Sets the variable's value.
Definition: mxvariable.h:59
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
Definition: roi.h:235
[AI] Variable to trigger show/hide operations on in-game 3D objects (ROIs) by parsing visibility comm...
Definition: legovariables.h:66
[AI] Variable representing the current player's character, allowing the game to switch the active act...
void SetValue(const char *p_value) override
[AI] Sets the current player actor in the game state based on the specified character.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
const char * g_mama
const char * g_varJETSPEED
[AI] Global variable key for the jet vehicle's speed.
const char * g_varAMBULSPEED
[AI] Global variable key for ambulance speed.
const char * g_varCURSOR
[AI] Global variable key for the cursor state.
const char * g_nick
const char * g_varMOTOSPEED
[AI] Global variable key for the motorcycle's speed.
const char * g_varVISIBILITY
[AI] Global variable key for controlling 3D object (ROI) visibility.
const char * g_delimiter2
const char * g_varMOTOFUEL
[AI] Global variable key for the motorcycle's fuel value.
const char * g_varCAMERALOCATION
[AI] Global variable key for the camera location.
const char * g_varTOWFUEL
[AI] Global variable key for tow truck fuel.
const char * g_varDUNEFUEL
[AI] Global variable key for the dune vehicle's fuel.
const char * g_varWHOAMI
[AI] Global variable key representing the player character identity ("who am I").
const char * g_varJETFUEL
[AI] Global variable key for the jet vehicle's fuel amount.
const char * g_pepper
const char * g_papa
const char * g_varAMBULFUEL
[AI] Global variable key for ambulance fuel.
const char * g_laura
const char * g_varTOWSPEED
[AI] Global variable key for tow truck speed.
const char * g_varSHOW
const char * g_varDUNESPEED
[AI] Global variable key for the dune vehicle's speed.
const char * g_varHIDE
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
LegoNavController * NavController()
[AI] Accessor for the navigation controller, managing player/camera navigation. [AI]
Definition: misc.cpp:77
LegoROI * FindROI(const char *p_name)
[AI] Looks up a LegoROI (Real-time Object Instance) by name in the current world or global registry.
Definition: misc.cpp:151
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
float MxFloat
[AI]
Definition: mxtypes.h:68