Isle
Loading...
Searching...
No Matches
legostate.cpp
Go to the documentation of this file.
1#include "legostate.h"
2
3#include <stdlib.h>
4
6DECOMP_SIZE_ASSERT(LegoState::Playlist, 0x0c)
7
8// FUNCTION: LEGO1 0x10014d00
9// FUNCTION: BETA10 0x10022580
11{
12 MxU32 objectId;
13
14 switch (m_mode) {
15 case e_loop:
16 objectId = m_objectIds[m_nextIndex];
17 if (m_nextIndex - m_length == -1) {
18 m_nextIndex = 0;
19 }
20 else {
21 m_nextIndex++;
22 }
23 break;
24
25 case e_once:
26 objectId = m_objectIds[m_nextIndex];
27 if (m_length > m_nextIndex + 1) {
28 m_nextIndex++;
29 }
30 break;
31
32 case e_random:
33 m_nextIndex = rand() % m_length;
34 objectId = m_objectIds[m_nextIndex];
35 break;
36
37 case e_loopSkipFirst:
38 objectId = m_objectIds[m_nextIndex];
39 if (m_nextIndex - m_length == -1) {
40 m_nextIndex = 1;
41 }
42 else {
43 m_nextIndex++;
44 }
45 }
46
47 return objectId;
48}
49
50// FUNCTION: LEGO1 0x10014de0
52{
53 for (MxS16 i = 0; i < m_length; i++) {
54 if (m_objectIds[i] == p_objectId) {
55 return TRUE;
56 }
57 }
58
59 return FALSE;
60}
[AI] Base class for game state blocks which encapsulate serializable and/or resettable aspects of the...
Definition: legostate.h:17
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
signed short MxS16
[AI]
Definition: mxtypes.h:26
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
[AI] Playlist structure representing an indexed list of object IDs with next-item selection strategie...
Definition: legostate.h:36
MxBool Contains(MxU32 p_objectId)
[AI] Checks if playlist contains an object ID.
Definition: legostate.cpp:51
MxS16 m_length
[AI] Number of IDs in the playlist. [AI]
Definition: legostate.h:108
MxU32 * m_objectIds
[AI] Pointer to array of object IDs. Not owned; just used for lookup. [AI]
Definition: legostate.h:107