2023-06-29 04:10:08 -04:00
|
|
|
#include "legostate.h"
|
|
|
|
|
2024-02-02 14:09:45 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2024-01-29 13:54:47 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
2024-02-02 14:09:45 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoState::Playlist, 0x0c)
|
2024-01-30 13:57:20 -05:00
|
|
|
|
2024-02-02 14:09:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10014d00
|
|
|
|
MxU32 LegoState::Playlist::Next()
|
2024-01-30 13:57:20 -05:00
|
|
|
{
|
2024-02-02 14:09:45 -05:00
|
|
|
MxU32 objectId;
|
|
|
|
|
|
|
|
switch (m_mode) {
|
|
|
|
case e_loop:
|
|
|
|
objectId = m_objectIds[m_nextIndex];
|
|
|
|
if (m_nextIndex - m_length == -1) {
|
|
|
|
m_nextIndex = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_nextIndex++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case e_once:
|
|
|
|
objectId = m_objectIds[m_nextIndex];
|
|
|
|
if (m_length > m_nextIndex + 1) {
|
|
|
|
m_nextIndex++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case e_random:
|
|
|
|
m_nextIndex = rand() % m_length;
|
|
|
|
objectId = m_objectIds[m_nextIndex];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case e_loopSkipFirst:
|
|
|
|
objectId = m_objectIds[m_nextIndex];
|
|
|
|
if (m_nextIndex - m_length == -1) {
|
|
|
|
m_nextIndex = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
m_nextIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectId;
|
2024-01-30 13:57:20 -05:00
|
|
|
}
|
|
|
|
|
2024-02-02 14:09:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10014de0
|
|
|
|
MxBool LegoState::Playlist::Contains(MxU32 p_objectId)
|
2024-01-30 13:57:20 -05:00
|
|
|
{
|
2024-02-02 14:09:45 -05:00
|
|
|
for (MxS16 i = 0; i < m_length; i++) {
|
|
|
|
if (m_objectIds[i] == p_objectId) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-30 13:57:20 -05:00
|
|
|
return FALSE;
|
|
|
|
}
|