mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-26 17:36:12 -05:00
Finish LegoPalettePresenter (#377)
* LegoPalettePresenter implementation * Update legopalettepresenter.cpp * Update legopalettepresenter.h --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
306d08c581
commit
dfad323880
2 changed files with 55 additions and 2 deletions
|
@ -1,5 +1,10 @@
|
||||||
#include "legopalettepresenter.h"
|
#include "legopalettepresenter.h"
|
||||||
|
|
||||||
|
#include "legoomni.h"
|
||||||
|
#include "legostream.h"
|
||||||
|
#include "legovideomanager.h"
|
||||||
|
#include "mxstreamchunk.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoPalettePresenter, 0x68)
|
DECOMP_SIZE_ASSERT(LegoPalettePresenter, 0x68)
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10079e50
|
// FUNCTION: LEGO1 0x10079e50
|
||||||
|
@ -39,3 +44,48 @@ void LegoPalettePresenter::Destroy()
|
||||||
{
|
{
|
||||||
Destroy(FALSE);
|
Destroy(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1007a130
|
||||||
|
MxResult LegoPalettePresenter::ParsePallete(MxStreamChunk* p_chunk)
|
||||||
|
{
|
||||||
|
MxU8 buffer[40];
|
||||||
|
RGBQUAD palleteData[256];
|
||||||
|
MxResult result = FAILURE;
|
||||||
|
LegoMemoryStream stream((char*) p_chunk->GetData());
|
||||||
|
if (stream.Read(buffer, 40) == SUCCESS) {
|
||||||
|
if (stream.Read(palleteData, sizeof(RGBQUAD) * 256) == SUCCESS) {
|
||||||
|
m_palette = new MxPalette(palleteData);
|
||||||
|
if (m_palette) {
|
||||||
|
result = SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != SUCCESS && m_palette) {
|
||||||
|
delete m_palette;
|
||||||
|
m_palette = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1007a230
|
||||||
|
void LegoPalettePresenter::ReadyTickle()
|
||||||
|
{
|
||||||
|
MxStreamChunk* chunk = m_subscriber->FUN_100b8360();
|
||||||
|
if (chunk) {
|
||||||
|
if (chunk->GetTime() <= m_action->GetElapsedTime()) {
|
||||||
|
ParseExtra();
|
||||||
|
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
|
||||||
|
m_currentTickleState = TickleState_Starting;
|
||||||
|
chunk = m_subscriber->FUN_100b8250();
|
||||||
|
MxResult result = ParsePallete(chunk);
|
||||||
|
m_subscriber->FUN_100b8390(chunk);
|
||||||
|
|
||||||
|
if (result == SUCCESS) {
|
||||||
|
VideoManager()->RealizePalette(m_palette);
|
||||||
|
}
|
||||||
|
EndAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,13 +25,16 @@ class LegoPalettePresenter : public MxVideoPresenter {
|
||||||
return !strcmp(p_name, ClassName()) || MxVideoPresenter::IsA(p_name);
|
return !strcmp(p_name, ClassName()) || MxVideoPresenter::IsA(p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void ReadyTickle() override; // vtable+0x18
|
||||||
virtual void Destroy() override; // vtable+0x38
|
virtual void Destroy() override; // vtable+0x38
|
||||||
|
|
||||||
|
MxResult ParsePallete(MxStreamChunk* p_chunk);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void Destroy(MxBool p_fromDestructor);
|
void Destroy(MxBool p_fromDestructor);
|
||||||
|
|
||||||
MxPalette* m_palette;
|
MxPalette* m_palette; // 0x64
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOPALETTEPRESENTER_H
|
#endif // LEGOPALETTEPRESENTER_H
|
||||||
|
|
Loading…
Reference in a new issue