Isle
Loading...
Searching...
No Matches
mxsmkpresenter.cpp
Go to the documentation of this file.
1#include "mxsmkpresenter.h"
2
3#include "decomp.h"
4#include "mxdsmediaaction.h"
5#include "mxmisc.h"
6#include "mxpalette.h"
7#include "mxvideomanager.h"
8
10
11// FUNCTION: LEGO1 0x100b3650
13{
14 Init();
15}
16
17// FUNCTION: LEGO1 0x100b3870
19{
21}
22
23// FUNCTION: LEGO1 0x100b38d0
24void MxSmkPresenter::Init()
25{
27 memset(&m_mxSmk, 0, sizeof(m_mxSmk));
30}
31
32// FUNCTION: LEGO1 0x100b3900
33void MxSmkPresenter::Destroy(MxBool p_fromDestructor)
34{
36
38 Init();
39
41
42 if (!p_fromDestructor) {
44 }
45}
46
47// FUNCTION: LEGO1 0x100b3940
49{
50 MxSmk::LoadHeader(p_chunk->GetData(), &m_mxSmk);
51}
52
53// FUNCTION: LEGO1 0x100b3960
55{
56 if (m_frameBitmap) {
57 delete m_frameBitmap;
58 }
59
62}
63
64// FUNCTION: LEGO1 0x100b3a00
66{
68 MxU8* bitmapData = m_frameBitmap->GetImage();
69 MxU8* chunkData = p_chunk->GetData();
70
71 MxBool paletteChanged = m_mxSmk.m_frameTypes[m_currentFrame] & 1;
73 VTable0x88();
74
75 MxRect32List rects(TRUE);
76 MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, &rects);
77
78 if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) {
80 }
81
82 MxRect32 invalidateRect;
83 MxRect32ListCursor cursor(&rects);
84 MxRect32* rect;
85
86 while (cursor.Next(rect)) {
87 invalidateRect = *rect;
88 invalidateRect += GetLocation();
89 MVideoManager()->InvalidateRect(invalidateRect);
90 }
91}
92
93// FUNCTION: LEGO1 0x100b4260
95{
96 if ((m_mxSmk.m_smackTag.SmackerType & 1) != 0) {
98 if (1 < m_currentFrame && und == 1) {
100 }
101 }
102 else {
104 m_currentFrame = 0;
105 // TODO: struct incorrect, Palette at wrong offset?
106 memset(&m_mxSmk.m_smackTag.Palette[4], 0, sizeof(m_mxSmk.m_smackTag.Palette));
107 }
108 }
109}
110
111// FUNCTION: LEGO1 0x100b42c0
113{
115 MVideoManager()->RealizePalette(palette);
116 delete palette;
117}
118
119// FUNCTION: LEGO1 0x100b42f0
121{
123}
124
125// FUNCTION: LEGO1 0x100b4300
127{
128 Destroy(FALSE);
129}
[AI] Represents an 8bpp or high color device-independent bitmap (DIB) and provides operations for bit...
Definition: mxbitmap.h:55
MxBITMAPINFO * GetBitmapInfo() const
[AI] Retrieves the pointer to the underlying MxBITMAPINFO struct (header and palette).
Definition: mxbitmap.h:254
virtual MxPalette * CreatePalette()
[AI] Allocates or clones the current palette for the bitmap.
Definition: mxbitmap.cpp:352
virtual MxResult SetSize(MxS32 p_width, MxS32 p_height, MxPalette *p_palette, MxBool)
[AI] Allocates the bitmap to a specified width and height, attaches a palette, and configures bit dep...
Definition: mxbitmap.cpp:43
MxU8 * GetImage() const
[AI] Retrieves the pointer to the image pixel data.
Definition: mxbitmap.h:248
void Enter()
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available.
void Leave()
[AI] Releases/leaves the critical section or mutex.
MxU8 * GetData()
[AI] Returns a pointer to the start of the data payload. [AI]
Definition: mxdschunk.h:108
MxDSMediaAction extends MxDSAction to add media-specific playback properties and management.
MxBool Next()
[AI]
[AI] Encapsulates a DirectDraw 8-bit (256 color) palette for use with DirectX rendering.
Definition: mxpalette.h:17
MxPoint32 GetLocation() const
[AI] Returns the presenter's screen location (in pixels).
Definition: mxpresenter.h:163
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
Definition: mxpresenter.h:211
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
Definition: mxpresenter.h:214
[AI] Cursor for iterating lists of MxRect32 pointers.
Definition: mxgeometry.h:761
[AI] List for pointers to MxRect32 rectangles.
Definition: mxgeometry.h:749
[AI] Rectangle using 32-bit signed integer coordinates.
Definition: mxgeometry.h:706
[AI] Presenter for rendering .SMK (Smacker) video media within the game engine.
~MxSmkPresenter() override
[AI] Destructor.
MxSmk m_mxSmk
[AI] Smacker file decoding context holding header, palette, frame types, and decode buffers.
MxSmkPresenter()
[AI] Constructs an MxSmkPresenter and initializes member variables.
void LoadFrame(MxStreamChunk *p_chunk) override
[AI] Loads and renders a Smacker video frame from a stream chunk.
void CreateBitmap() override
[AI] Allocates and prepares the bitmap for a Smacker video frame.
void LoadHeader(MxStreamChunk *p_chunk) override
[AI] Loads the Smacker header information from a stream chunk.
MxResult AddToManager() override
[AI] Registers this presenter instance with the video presentation manager.
virtual void VTable0x88()
[AI] Virtual function for custom frame or looping logic for Smacker video playback.
void RealizePalette() override
[AI] Realizes (uploads) the color palette for the current frame bitmap.
void Destroy() override
[AI] Cleans up and destroys the resources used by this presenter.
MxU32 m_currentFrame
[AI] Current frame index within the Smacker stream.
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
virtual MxResult RealizePalette(MxPalette *p_palette)
[AI] Applies (realizes) the palette to both MxVideoParam and hardware palette, and updates the displa...
void InvalidateRect(MxRect32 &p_rect)
[AI] Invalidates a rectangular region in the display; marks it for redraw on next tick.
void SetBit2(BOOL p_e)
MxBitmap * m_frameBitmap
Bitmap for current video frame. [AI].
void SetBit1(BOOL p_e)
MxResult AddToManager() override
Adds this presenter to the global video manager.
void Destroy() override
Destroys internal resources for the presenter.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
MxVideoManager * MVideoManager()
[AI] Returns the video manager used for video/cutscene presenter management.
Definition: mxmisc.cpp:65
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
[AI] Represents a bitmap information header plus a 256-color palette, matching the layout for 8-bit D...
Definition: mxbitmap.h:25
static MxResult LoadFrame(MxBITMAPINFO *p_bitmapInfo, MxU8 *p_bitmapData, MxSmk *p_mxSmk, MxU8 *p_chunkData, MxBool p_paletteChanged, MxRect32List *p_list)
[AI] Decompresses and loads a single Smacker frame into a bitmap buffer, updating palette if needed.
Definition: mxsmk.cpp:162
MxU8 * m_frameTypes
[AI] Array of frame types, one entry per frame.
Definition: mxsmk.h:81
static void Destroy(MxSmk *p_mxSmk)
[AI] Cleans up and deallocates all resources associated with this MxSmk.
Definition: mxsmk.cpp:141
static MxResult LoadHeader(MxU8 *p_data, MxSmk *p_mxSmk)
[AI] Loads the SMK header and initializes decoding structures for a Smacker video.
Definition: mxsmk.cpp:12
SmackTag m_smackTag
[AI] Metadata block from the Smacker file header.
Definition: mxsmk.h:78
u32 Width
Definition: smack.h:35
u32 Height
Definition: smack.h:36
u32 SmackerType
Definition: smack.h:39
u8 Palette[772]
Definition: smack.h:49
u32 Frames
Definition: smack.h:37