Isle
Loading...
Searching...
No Matches
legophonemepresenter.cpp
Go to the documentation of this file.
2
4#include "legovideomanager.h"
5#include "misc.h"
8#include "mxdsaction.h"
9
11
12// FUNCTION: LEGO1 0x1004e180
14{
15 Init();
16}
17
18// FUNCTION: LEGO1 0x1004e340
20{
21}
22
23// FUNCTION: LEGO1 0x1004e3b0
24void LegoPhonemePresenter::Init()
25{
26 m_rectCount = 0;
27 m_textureInfo = NULL;
28 m_unk0x70 = FALSE;
29 m_unk0x84 = FALSE;
30}
31
32// FUNCTION: LEGO1 0x1004e3d0
33// FUNCTION: BETA10 0x100c3646
35{
37
38 if (m_textureInfo == NULL) {
39 MxU16 extraLength;
40 char* extraData;
41
42 m_action->GetExtra(extraLength, extraData);
43
44 if (extraData != NULL) {
45 m_roiName = extraData;
46 m_roiName.ToUpperCase();
47
48 LegoROI *entityROI, *head;
49
50 if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) {
51 entityROI = FindROI(m_roiName.GetData());
52 m_unk0x84 = TRUE;
53 }
54 else {
55 entityROI = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE);
56 }
57
58 head = entityROI->FindChildROI("head", entityROI);
59 head->GetTextureInfo(m_textureInfo);
60
62 LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1);
63
64 LegoPhonemeListCursor cursor(phonemeList);
65
66 if (!cursor.Find(phoneme)) {
67 LegoTextureInfo* textureInfo = TextureContainer()->GetCached(m_textureInfo);
68
69 CharacterManager()->FUN_100849a0(entityROI, textureInfo);
70
71 phoneme->VTable0x0c(m_textureInfo);
72 phoneme->VTable0x14(textureInfo);
73 phonemeList->Append(phoneme);
74 m_textureInfo = textureInfo;
75 }
76 else {
77 LegoPhoneme* newPhoneme = phoneme;
78 cursor.Current(phoneme);
79 delete newPhoneme;
80
81 phoneme->VTable0x04(phoneme->VTable0x00() + 1);
82 cursor.SetValue(phoneme);
83
84 m_unk0x70 = TRUE;
85 }
86 }
87 }
88}
89
90// FUNCTION: LEGO1 0x1004e800
91// FUNCTION: BETA10 0x100c3ac9
93{
94 MxU8* data = p_chunk->GetData();
95
96 m_rectCount = *(MxS32*) data;
97 data += sizeof(MxS32);
98
99 MxRect32* rects = (MxRect32*) data;
100 data += m_rectCount * sizeof(MxRect32);
101
102 MxBool decodedColorMap;
107 (FLIC_FRAME*) data,
108 &decodedColorMap
109 );
110}
111
112// FUNCTION: LEGO1 0x1004e840
113// FUNCTION: BETA10 0x100c3b5d
115{
116 if (m_textureInfo != NULL && m_rectCount != 0) {
117 m_textureInfo->FUN_10066010(m_frameBitmap->GetImage());
118 m_rectCount = 0;
119 }
120}
121
122// FUNCTION: LEGO1 0x1004e870
123// FUNCTION: BETA10 0x100c3c24
125{
126 if (m_action != NULL) {
128
129 LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList();
130 LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1);
131
132 LegoPhonemeListCursor cursor(phonemeList);
133
134 if (cursor.Find(phoneme)) {
135 LegoPhoneme* newPhoneme = phoneme;
136 cursor.Current(phoneme);
137 delete newPhoneme;
138
139 if (phoneme->VTable0x00() == 1) {
140 LegoROI* roi;
141
142 if (m_unk0x84) {
143 roi = FindROI(m_roiName.GetData());
144 }
145 else {
146 roi = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE);
147 }
148
149 if (roi != NULL) {
151 }
152
153 if (!m_unk0x84) {
154 CharacterManager()->ReleaseActor(m_roiName.GetData());
155 }
156
159 cursor.Destroy();
160 }
161 else {
162 phoneme->VTable0x04(phoneme->VTable0x00() - 1);
163 cursor.SetValue(phoneme);
164 }
165
166 if (!m_unk0x84) {
167 CharacterManager()->ReleaseActor(m_roiName.GetData());
168 }
169 }
170 }
171}
void ReleaseActor(const char *p_name)
[AI] Releases a character/ROI by name, decrementing its reference count and deleting if zero.
LegoROI * GetActorROI(const char *p_name, MxBool p_createEntity)
[AI] Returns a LegoROI for the given character name, creating and registering the actor if necessary.
MxBool FUN_100849a0(LegoROI *p_roi, LegoTextureInfo *p_texture)
[AI] Replaces the head LOD of a character ROI with a new LOD list built using the provided texture.
Cursor class for iterating over LegoPhonemeList.
Specialized list class for managing LegoPhoneme objects.
Class responsible for presenting lip-synced ("phoneme") mouth animations on LEGO character head textu...
void EndAction() override
Called when the associated action concludes.
void PutFrame() override
Applies the loaded frame data to the cached texture, updating the target ROI's mouth/phoneme region.
~LegoPhonemePresenter() override
Destructor.
void StartingTickle() override
Called on media/actor action start.
void LoadFrame(MxStreamChunk *p_chunk) override
Loads FLC frame data describing mouth region updates and decodes frame information for use in texture...
[AI] Represents a single phoneme (mouth shape) used for character lip-sync and speech animation.
Definition: legophoneme.h:19
virtual void VTable0x14(LegoTextureInfo *p_unk0x1c)
[AI] Sets the alternate texture info for this phoneme.
Definition: legophoneme.cpp:41
virtual LegoTextureInfo * VTable0x08()
[AI] Retrieves the primary texture info associated with this phoneme.
Definition: legophoneme.cpp:23
virtual void VTable0x0c(LegoTextureInfo *p_unk0x18)
[AI] Sets the primary texture info for this phoneme.
Definition: legophoneme.cpp:29
virtual undefined4 VTable0x00()
[AI] Retrieves the value of the unknown property at offset 0x14.
Definition: legophoneme.cpp:11
virtual LegoTextureInfo * VTable0x10()
[AI] Retrieves an alternate texture info for this phoneme.
Definition: legophoneme.cpp:35
virtual void VTable0x04(undefined4 p_unk0x14)
[AI] Sets the value of the unknown property at offset 0x14.
Definition: legophoneme.cpp:17
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
LegoResult GetTextureInfo(LegoTextureInfo *&p_textureInfo)
[AI] Attempts to retrieve a texture info pointer used by any LOD in this ROI or its children.
Definition: legoroi.cpp:537
LegoROI * FindChildROI(const LegoChar *p_name, LegoROI *p_roi)
[AI] Recursively searches for a child ROI by name, starting at the given ROI.
Definition: legoroi.cpp:349
void EraseCached(LegoTextureInfo *p_textureInfo)
Mark a cached texture as unused and release its Direct3D/DirectDraw resources if its reference count ...
LegoTextureInfo * GetCached(LegoTextureInfo *p_textureInfo)
Attempt to find and return a cached LegoTextureInfo with the same properties as p_textureInfo,...
[AI] Contains DirectDraw and Direct3DRM handles and metadata for a texture used in the LEGO Island re...
LegoResult FUN_10066010(const LegoU8 *p_bits)
[AI] Updates the pixel bits for the current surface/texture with the provided bitmap data.
virtual LegoPhonemeList * GetPhonemeList()
[AI] Returns the currently installed phoneme list for in-game speech synchronization.
MxBITMAPINFO * GetBitmapInfo() const
[AI] Retrieves the pointer to the underlying MxBITMAPINFO struct (header and palette).
Definition: mxbitmap.h:254
MxU8 * GetImage() const
[AI] Retrieves the pointer to the image pixel data.
Definition: mxbitmap.h:248
MxBool IsA(const char *p_name) const override
[AI] Runtime type checking for presenter class hierarchy, supporting parent/child class checks.
void GetExtra(MxU16 &p_extraLength, char *&p_extraData)
[AI] Retrieves the extra data and its length for this action.
Definition: mxdsaction.h:168
MxU8 * GetData()
[AI] Returns a pointer to the start of the data payload. [AI]
Definition: mxdschunk.h:108
FLIC_HEADER * m_flcHeader
[AI] Internal cached FLIC header for video decoding and playback.
MxBool Current(T &p_obj)
[AI]
void SetValue(T p_obj)
[AI]
MxBool Find(T p_obj)
[AI]
void Destroy()
[AI]
void Append(T p_obj)
[AI]
Definition: mxlist.h:100
void EndAction() override
[AI] Ends the media playback action, releasing all resources, notifying listeners if necessary.
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
Definition: mxpresenter.h:211
virtual void StartingTickle()
[AI] Handles actions required when first starting presentation. Advances to streaming state.
Definition: mxpresenter.h:52
MxCompositePresenter * m_compositePresenter
[AI] Owner composite presenter, if any.
Definition: mxpresenter.h:217
[AI] Rectangle using 32-bit signed integer coordinates.
Definition: mxgeometry.h:706
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
char * GetData() const
Returns a pointer to the internal character buffer.
Definition: mxstring.h:110
void ToUpperCase()
Converts the string contents to uppercase in-place.
Definition: mxstring.cpp:90
MxBitmap * m_frameBitmap
Bitmap for current video frame. [AI].
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
void DecodeFLCFrame(LPBITMAPINFOHEADER p_bitmapHeader, BYTE *p_pixelData, FLIC_HEADER *p_flcHeader, FLIC_FRAME *p_flcFrame, BYTE *p_decodedColorMap)
[AI] Decodes a single FLIC (FLI/FLC) animation frame and updates the pixel data and palette.
Definition: flic.cpp:457
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
Definition: misc.cpp:29
LegoCharacterManager * CharacterManager()
[AI] Accessor for the character manager, which manages in-game characters/NPCs. [AI]
Definition: misc.cpp:101
LegoTextureContainer * TextureContainer()
[AI] Accessor for the texture container used for global texture management. [AI]
Definition: misc.cpp:130
LegoROI * FindROI(const char *p_name)
[AI] Looks up a LegoROI (Real-time Object Instance) by name in the current world or global registry.
Definition: misc.cpp:151
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
[AI] Structure describing the header of a FLIC animation frame, used to organize frame subchunks and ...
Definition: flic.h:58
BITMAPINFOHEADER m_bmiHeader
[AI] Standard DIB bitmap header (size 0x28 bytes).
Definition: mxbitmap.h:26