20 MxS32 size = ((m_width * m_height) / 8) + 1;
21 m_bitmask =
new MxU8[size];
22 memset(m_bitmask, 0, size);
46 for (
MxS32 j = 0; j < m_height; j++) {
47 MxU8* tPtr = bitmapSrcPtr;
48 for (
MxS32 i = 0; i < m_width; i++) {
50 m_bitmask[offset / 8] |= (1 << (offset % 8));
56 bitmapSrcPtr += rowSeek;
64 m_width = p_alpha.m_width;
65 m_height = p_alpha.m_height;
67 MxS32 size = ((m_width * m_height) / 8) + 1;
68 m_bitmask =
new MxU8[size];
69 memcpy(m_bitmask, p_alpha.m_bitmask, size);
83 if (p_x >= m_width || p_y >= m_height) {
87 MxS32 pos = p_y * m_width + p_x;
88 return m_bitmask[pos / 8] & (1 << (pos % 8)) ? 1 : 0;
92void MxVideoPresenter::Init()
132 MxRect32 rect(x, y, x + width, y + height);
142 if (!p_fromDestructor) {
199 if (p_rectDest.top > 480 || p_rectDest.left > 640 || p_rectSrc.top > 480 || p_rectSrc.left > 640) {
203 if (p_rectDest.bottom > 480) {
204 p_rectDest.bottom = 480;
207 if (p_rectDest.right > 640) {
208 p_rectDest.right = 640;
211 if (p_rectSrc.bottom > 480) {
212 p_rectSrc.bottom = 480;
215 if (p_rectSrc.right > 640) {
216 p_rectSrc.right = 640;
220 if ((height = (p_rectDest.bottom - p_rectDest.top) + 1) <= 1 ||
221 (width = (p_rectDest.right - p_rectDest.left) + 1) <= 1) {
224 else if ((p_rectSrc.right - p_rectSrc.left + 1) == width && (p_rectSrc.bottom - p_rectSrc.top + 1) == height) {
228 p_rectSrc.right = (p_rectSrc.left + width) - 1;
229 p_rectSrc.bottom = (p_rectSrc.top + height) - 1;
253 dest.right = dest.left +
GetWidth();
281 while ((regionRect = cursor.
Next(rect))) {
288 src.right = src.left + regionRect->
GetWidth();
289 src.bottom = src.top + regionRect->
GetHeight();
291 dest.left = regionRect->
GetLeft();
292 dest.top = regionRect->
GetTop();
293 dest.right = dest.left + regionRect->
GetWidth();
294 dest.bottom = dest.top + regionRect->
GetHeight();
453 if (sustainTime != -1) {
496 MxRect32 rect(x, y, x + width, y + height);
[AI] Represents an 8bpp or high color device-independent bitmap (DIB) and provides operations for bit...
MxLong AlignToFourByte(MxLong p_value) const
[AI] Aligns a value up to the nearest multiple of four (stride alignment for DIBs).
MxLong GetBmiHeightAbs() const
[AI] Returns the absolute value of the bitmap's height.
MxLong GetBmiHeight() const
[AI] Fetches the height (could be negative if top-down) of the bitmap.
MxU8 * GetStart(MxS32 p_left, MxS32 p_top) const
[AI] Returns a pointer to the starting address of the pixel data at the specified coordinates.
BITMAPINFOHEADER * GetBmiHeader() const
[AI] Returns a pointer to the underlying BITMAPINFOHEADER.
MxLong GetBmiWidth() const
[AI] Fetches the width (in pixels) encoded in this bitmap's header.
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
MxU32 GetFlags()
[AI] Returns the flag field for this action (bitmask).
MxS32 GetLoopCount()
[AI] Returns the loop count for this action.
virtual MxLong GetElapsedTime()
[AI] Gets elapsed time for this action since the last time field 0x90 was set.
@ c_bit5
[AI] Unknown - possibly reserved [AI]
@ c_bit11
[AI] Unknown - possibly reserved [AI]
@ c_bit10
[AI] Unknown - possibly reserved [AI]
@ c_bit4
[AI] Unknown - possibly reserved [AI]
MxLong GetTime()
[AI] Returns the time (timestamp or tick) associated with this chunk. [AI]
MxU16 GetChunkFlags()
[AI] Returns the chunk's flag bitfield. [AI]
void FreeDataChunk(MxStreamChunk *p_chunk)
[AI] Frees (deletes) a data chunk if it's found in the consumed data list; also forcibly deletes sing...
Provides a DirectDraw-based drawing surface for blitting bitmaps, managing palette,...
LPDIRECTDRAWSURFACE GetDirectDrawSurface2()
[AI] Returns the secondary DirectDraw surface (back buffer).
virtual void VTable0x30(MxBitmap *p_bitmap, MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom, MxS32 p_width, MxS32 p_height, MxBool p_RLE)
[AI] Draws a bitmap with optional transparency (RLE), outputting to active back surface.
virtual void VTable0x28(MxBitmap *p_bitmap, MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom, MxS32 p_width, MxS32 p_height)
[AI] Draws a bitmap onto the back surface, specified by coordinates and output size.
[AI] 2D point with 32-bit signed integer coordinates.
T GetY() const
[AI] Get Y coordinate.
T GetX() const
[AI] Get X coordinate.
virtual void ParseExtra()
[AI] Parses additional data from the associated action for configuration or world interaction.
void ProgressTickleState(TickleState p_tickleState)
[AI] Helper for advancing the presenter's tickle state and updating transition history.
MxPoint32 GetLocation() const
[AI] Returns the presenter's screen location (in pixels).
MxBool IsEnabled()
[AI] Returns whether this presenter is logically enabled (based on the associated action's flags).
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
TickleState m_currentTickleState
[AI] Current state in the tickle lifecycle.
MxS32 GetX() const
[AI] Returns the X coordinate of screen location.
MxS32 GetY() const
[AI] Returns the Y coordinate of screen location.
@ e_repeating
[AI] Presentation is repeating (e.g., looping media).
@ e_done
[AI] Completed processing the current action.
@ e_freezing
[AI] Temporarily suspending updates or playback.
@ e_starting
[AI] In the process of starting playback/presentation.
@ e_streaming
[AI] Streaming or rendering actively.
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
MxPoint32 m_location
[AI] 2D display location for the presenter.
MxDSAction * GetAction() const
[AI] Returns the current action being presented.
[AI] Rectangle using 32-bit signed integer coordinates.
T GetTop() const
[AI] Get the top edge.
T GetWidth() const
[AI] Get the rectangle's width.
T GetRight() const
[AI] Get the right edge.
T GetHeight() const
[AI] Get the rectangle's height.
T GetLeft() const
[AI] Get the left edge.
T GetBottom() const
[AI] Get the bottom edge.
[AI] Cursor object suitable for traversing all rectangles covered by an MxRegion.
virtual MxRect32 * Next()
[AI] Advances to and returns the next rectangle in region sequence.
[AI] Represents a 2D region as a set of vertical spans each containing one or more horizontal segment...
[AI] Size with 32-bit signed integer width and height.
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
MxRegion * GetRegion()
[AI] Gets region-tracking structure managing currently invalidated rectangles.
virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
[AI] Updates the visible video sub-rectangle inside the overall frame; typically for sub-region blits...
void InvalidateRect(MxRect32 &p_rect)
[AI] Invalidates a rectangular region in the display; marks it for redraw on next tick.
MxDisplaySurface * GetDisplaySurface()
[AI] Returns the display surface used for video output; for direct drawing and palette operations.
Opaque mask used for efficient hit testing against video transparency.
MxS32 IsHit(MxU32 p_x, MxU32 p_y)
Checks whether the specified local coordinate is visible in the mask.
virtual ~AlphaMask()
Frees the bitmask memory.
AlphaMask(const MxBitmap &)
Creates an alpha mask from a bitmap, recording pixel presence in a bitmask.
Derived video presenter responsible for displaying video frames using DirectDraw surfaces.
virtual void LoadHeader(MxStreamChunk *p_chunk)
Loads and processes header information from a video stream chunk.
MxBool IsHit(MxS32 p_x, MxS32 p_y) override
Determines if a point is inside the non-transparent region of frame/alpha.
BYTE GetBit0()
Gets internal miscellaneous state flags (bits 0-4).
void StartingTickle() override
Advance logic for the "starting" tickle state (frame setup).
void FreezingTickle() override
Advance logic for the "freezing" tickle state (sustain after playback).
MxS32 PrepareRects(RECT &p_rectDest, RECT &p_rectSrc)
Utility function to adjust source/dest rectangles to stay within allowed bounds.
MxBitmap * m_frameBitmap
Bitmap for current video frame. [AI].
virtual MxS32 GetHeight()
Returns the height of the current bitmap or alpha mask in pixels.
void ReadyTickle() override
Advance logic for the "ready" tickle state.
virtual MxS32 GetWidth()
Returns the width of the current bitmap or alpha mask in pixels.
void EndAction() override
Signals the end of the current playback action.
virtual undefined VTable0x74()
Unknown/potentially format-specific method (VTable0x74).
MxLong m_unk0x60
Last freeze time/start of sustain interval. [AI].
virtual void NextFrame()
Advances video playback to the next frame, handling decoding and playback progression.
virtual void CreateBitmap()
Allocates and sets up the display bitmap for video frame data.
void SetBit0(BOOL p_e)
Sets internal miscellaneous state flags.
LPDIRECTDRAWSURFACE m_unk0x58
DirectDraw surface for hardware video rendering. [AI].
void StreamingTickle() override
Advance logic for the "streaming" tickle state (typical video playback).
virtual void PutFrame()
Presents the current frame using the chosen output mechanism (e.g., blitting to screen).
virtual void LoadFrame(MxStreamChunk *p_chunk)
Loads and processes frame data from a video stream chunk.
MxS16 m_unk0x5c
Loop/advance/frame decode counter. [AI].
void RepeatingTickle() override
Advance logic for the "repeating" tickle state (media looping).
MxResult PutData() override
Writes the frame to the display device if appropriate.
AlphaMask * m_alpha
Alpha mask for hit testing. May be null. [AI].
MxResult AddToManager() override
Adds this presenter to the global video manager.
void Destroy() override
Destroys internal resources for the presenter.
struct IDirectDrawSurface FAR * LPDIRECTDRAWSURFACE
#define DDBLTFAST_SRCCOLORKEY
#define DECOMP_SIZE_ASSERT(T, S)
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
#define BI_RGB_TOPDOWN
[AI] Non-standard biCompression value indicating top-down row order for uncompressed bitmaps.
#define DS_CHUNK_END_OF_STREAM
[AI] Flag bit indicating this chunk is the last in its stream.
MxVideoManager * MVideoManager()
[AI] Returns the video manager used for video/cutscene presenter management.