mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
Implement/match LegoLoopingAnimPresenter (#924)
This commit is contained in:

committed by
GitHub

parent
29a0e32739
commit
9a05edd0a7
@@ -97,7 +97,7 @@ void LegoPathPresenter::StreamingTickle()
|
||||
MxStreamChunk* chunk = m_subscriber->PopData();
|
||||
|
||||
if (chunk) {
|
||||
if (chunk->GetFlags() & MxStreamChunk::c_end) {
|
||||
if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) {
|
||||
ProgressTickleState(e_repeating);
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ void LegoAnimPresenter::Init()
|
||||
m_unk0xa8.Clear();
|
||||
m_unk0xa4 = 0;
|
||||
m_currentWorld = NULL;
|
||||
m_unk0x95 = 0;
|
||||
m_unk0x95 = FALSE;
|
||||
m_worldId = -1;
|
||||
m_substMap = NULL;
|
||||
m_worldAtom.Clear();
|
||||
@@ -806,7 +806,7 @@ void LegoAnimPresenter::StreamingTickle()
|
||||
}
|
||||
else {
|
||||
if (m_action->GetElapsedTime() > m_anim->GetDuration() + m_action->GetStartTime()) {
|
||||
m_unk0x95 = 1;
|
||||
m_unk0x95 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +1,88 @@
|
||||
#include "legoloopinganimpresenter.h"
|
||||
|
||||
#include "anim/legoanim.h"
|
||||
#include "legocameracontroller.h"
|
||||
#include "legoworld.h"
|
||||
#include "mxcompositepresenter.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxdssubscriber.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoLoopingAnimPresenter, 0xc0)
|
||||
|
||||
// STUB: LEGO1 0x1006caa0
|
||||
// FUNCTION: LEGO1 0x1006caa0
|
||||
// FUNCTION: BETA10 0x1005223d
|
||||
void LegoLoopingAnimPresenter::StreamingTickle()
|
||||
{
|
||||
// TODO
|
||||
if (m_subscriber->PeekData()) {
|
||||
MxStreamChunk* chunk = m_subscriber->PopData();
|
||||
m_subscriber->FreeDataChunk(chunk);
|
||||
}
|
||||
|
||||
if (m_unk0x95) {
|
||||
ProgressTickleState(e_done);
|
||||
if (m_compositePresenter) {
|
||||
if (m_compositePresenter->IsA("LegoAnimMMPresenter")) {
|
||||
m_compositePresenter->VTable0x60(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_action->GetDuration() != -1) {
|
||||
if (m_action->GetElapsedTime() > m_action->GetDuration() + m_action->GetStartTime()) {
|
||||
m_unk0x95 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1006cb40
|
||||
// FUNCTION: LEGO1 0x1006cb40
|
||||
// FUNCTION: BETA10 0x1005239a
|
||||
void LegoLoopingAnimPresenter::PutFrame()
|
||||
{
|
||||
// TODO
|
||||
MxLong time;
|
||||
|
||||
if (m_action->GetStartTime() <= m_action->GetElapsedTime()) {
|
||||
time = (m_action->GetElapsedTime() - m_action->GetStartTime()) % m_anim->GetDuration();
|
||||
}
|
||||
else {
|
||||
time = 0;
|
||||
}
|
||||
|
||||
FUN_1006b9a0(m_anim, time, m_unk0x78);
|
||||
|
||||
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
|
||||
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
||||
if (m_unk0x8c[i] != NULL) {
|
||||
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
|
||||
|
||||
Vector3 pos(mat[0]);
|
||||
Vector3 dir(mat[1]);
|
||||
Vector3 up(mat[2]);
|
||||
Vector3 und(mat[3]);
|
||||
|
||||
float possqr = sqrt(pos.LenSquared());
|
||||
float dirsqr = sqrt(dir.LenSquared());
|
||||
float upsqr = sqrt(up.LenSquared());
|
||||
|
||||
up = und;
|
||||
|
||||
#ifdef COMPAT_MODE
|
||||
Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation();
|
||||
((Vector3&) up).Sub(&location);
|
||||
#else
|
||||
((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation());
|
||||
#endif
|
||||
((Vector3&) dir).Div(dirsqr);
|
||||
pos.EqualsCross(&dir, &up);
|
||||
pos.Unitize();
|
||||
up.EqualsCross(&pos, &dir);
|
||||
((Vector3&) pos).Mul(possqr);
|
||||
((Vector3&) dir).Mul(dirsqr);
|
||||
((Vector3&) up).Mul(upsqr);
|
||||
|
||||
m_unk0x8c[i]->FUN_100a58f0(mat);
|
||||
m_unk0x8c[i]->VTable0x14();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user