isle-portable/LEGO1/lego/legoomni/include/legomodelpresenter.h
Christian Semmler 0c986aff2a
Add multi-world animation support (ACT2/ACT3)
Extend the multiplayer animation system to support animations from all
three game worlds (ACT1, ACT2, ACT3) while playing in the Isle world.

Catalog: Parse DTA files directly for all worlds instead of borrowing
from LegoAnimationManager. World-encoded animIndex (top 2 bits = world
slot) provides globally unique IDs without wire protocol changes.

Loader: Support multiple SI files (isle.si, act2main.si, act3.si) with
lazy opening and composite (worldId, objectId) cache keys.

WDB: Load missing model LODs from WORLD.WDB for all worlds during
catalog refresh, using LegoPartPresenter for parts and
LegoModelPresenter for compound models (ray, chptr).

Protocol: AnimCompleteMsg now carries animIndex instead of objectId.

Also fix pre-existing bugs:
- PhonemePlayer UAF when multiple tracks target the same ROI
- ModelDbModel buffer overflow on word-aligned strlcpy reads
- SIReader UBSan violation on uninitialized filetype enum

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 18:07:37 -07:00

75 lines
1.7 KiB
C++

#ifndef LEGOMODELPRESENTER_H
#define LEGOMODELPRESENTER_H
#include "extensions/fwd.h"
#include "lego1_export.h"
#include "mxvideopresenter.h"
class LegoROI;
class LegoWorld;
class LegoEntity;
class MxDSChunk;
// VTABLE: LEGO1 0x100d4e50
// VTABLE: BETA10 0x101bcd88
// SIZE 0x6c
class LegoModelPresenter : public MxVideoPresenter {
public:
LegoModelPresenter() { Reset(); }
// FUNCTION: LEGO1 0x10067a10
~LegoModelPresenter() override { Destroy(TRUE); }
// FUNCTION: LEGO1 0x1000cca0
void Destroy() override { Destroy(FALSE); } // vtable+0x38
LEGO1_EXPORT static void configureLegoModelPresenter(MxS32 p_modelPresenterConfig);
// FUNCTION: BETA10 0x100a7180
static const char* HandlerClassName()
{
// STRING: LEGO1 0x100f067c
return "LegoModelPresenter";
}
// FUNCTION: LEGO1 0x1000ccb0
// FUNCTION: BETA10 0x100a7150
const char* ClassName() const override // vtable+0x0c
{
return HandlerClassName();
}
// FUNCTION: LEGO1 0x1000ccc0
MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, ClassName()) || MxVideoPresenter::IsA(p_name);
}
void ReadyTickle() override; // vtable+0x18
void ParseExtra() override; // vtable+0x30
MxResult CreateROI(MxDSChunk& p_chunk, LegoEntity* p_entity, MxBool p_roiVisible, LegoWorld* p_world);
void Reset()
{
m_roi = NULL;
m_addedToView = FALSE;
}
// SYNTHETIC: LEGO1 0x1000cdd0
// LegoModelPresenter::`scalar deleting destructor'
protected:
void Destroy(MxBool p_fromDestructor);
private:
friend class Multiplayer::Animation::Catalog;
LegoROI* m_roi; // 0x64
MxBool m_addedToView; // 0x68
MxResult CreateROI(MxDSChunk* p_chunk);
};
#endif // LEGOMODELPRESENTER_H