mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 09:24:17 +00:00
Implement LegoState::Playlist (#517)
This commit is contained in:
committed by
GitHub
parent
558bda4dd2
commit
b7e274f902
@@ -1,18 +1,59 @@
|
||||
#include "legostate.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoState::Shuffle, 0x0c)
|
||||
#include <stdlib.h>
|
||||
|
||||
// STUB: LEGO1 0x10014d00
|
||||
MxU32 LegoState::Shuffle::FUN_10014d00()
|
||||
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoState::Playlist, 0x0c)
|
||||
|
||||
// FUNCTION: LEGO1 0x10014d00
|
||||
MxU32 LegoState::Playlist::Next()
|
||||
{
|
||||
// TODO
|
||||
return m_objectIds[0];
|
||||
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;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10014de0
|
||||
MxBool LegoState::Shuffle::FUN_10014de0(MxU32 p_objectId)
|
||||
// FUNCTION: LEGO1 0x10014de0
|
||||
MxBool LegoState::Playlist::Contains(MxU32 p_objectId)
|
||||
{
|
||||
// TODO
|
||||
for (MxS16 i = 0; i < m_length; i++) {
|
||||
if (m_objectIds[i] == p_objectId) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user