mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-26 09:54:18 +00:00
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy
* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def
* Add initial .clang-tidy and fixes
* fix file perms
* Comment out DESCRIPTION
* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def
* Looks like clang is allergic to the libs in the directx5 SDK
* Update .clang-tidy
* Fix typo in .clang-tidy
* Attempt to generate an action error
* Revert "Attempt to generate an action error"
This reverts commit 96c4c65fed.
* cmake: test with -Wparentheses + optionally with -Werror
* ci: -k0 is a Ninja argument
* Use -Werror only for msys2 builds
* cmake: only emit warnings for specific warnings
* cmake: and don't do -Werror/-WX anymore
* Fix warnings
* Fix mingw warnings
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
committed by
GitHub
parent
97d1ba7c71
commit
9e686e2a87
@@ -25,12 +25,15 @@ MxBitmap::MxBitmap()
|
||||
// FUNCTION: LEGO1 0x100bca10
|
||||
MxBitmap::~MxBitmap()
|
||||
{
|
||||
if (this->m_info)
|
||||
if (this->m_info) {
|
||||
delete m_info;
|
||||
if (this->m_data)
|
||||
}
|
||||
if (this->m_data) {
|
||||
delete m_data;
|
||||
if (this->m_palette)
|
||||
}
|
||||
if (this->m_palette) {
|
||||
delete m_palette;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bcaa0
|
||||
@@ -152,11 +155,13 @@ MxLong MxBitmap::Read(const char* p_filename)
|
||||
HANDLE handle =
|
||||
CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle))
|
||||
if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle)) {
|
||||
result = SUCCESS;
|
||||
}
|
||||
|
||||
if (handle)
|
||||
if (handle) {
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -280,8 +285,9 @@ void MxBitmap::BitBltTransparent(
|
||||
|
||||
for (MxS32 h = 0; h < p_height; h++) {
|
||||
for (MxS32 w = 0; w < p_width; w++) {
|
||||
if (*srcStart)
|
||||
if (*srcStart) {
|
||||
*dstStart = *srcStart;
|
||||
}
|
||||
srcStart++;
|
||||
dstStart++;
|
||||
}
|
||||
@@ -302,15 +308,17 @@ MxPalette* MxBitmap::CreatePalette()
|
||||
case FALSE:
|
||||
palette = new MxPalette(this->m_paletteData);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
break;
|
||||
case TRUE:
|
||||
palette = this->m_palette->Clone();
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
@@ -361,8 +369,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
|
||||
switch (p_isHighColor) {
|
||||
case FALSE:
|
||||
ImportColorsToPalette(m_paletteData, m_palette);
|
||||
if (m_palette)
|
||||
if (m_palette) {
|
||||
delete m_palette;
|
||||
}
|
||||
|
||||
m_palette = NULL;
|
||||
break;
|
||||
@@ -370,8 +379,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
|
||||
pal = NULL;
|
||||
pal = new MxPalette(m_paletteData);
|
||||
|
||||
if (!pal)
|
||||
if (!pal) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_palette = pal;
|
||||
|
||||
@@ -392,8 +402,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
|
||||
done:
|
||||
// If we were unsuccessful overall but did manage to alloc
|
||||
// the MxPalette, free it.
|
||||
if (ret && pal)
|
||||
if (ret && pal) {
|
||||
delete pal;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -438,13 +449,15 @@ MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palett
|
||||
PALETTEENTRY entries[256];
|
||||
|
||||
if (p_palette) {
|
||||
if (p_palette->GetEntries(entries))
|
||||
if (p_palette->GetEntries(entries)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
MxPalette palette;
|
||||
if (palette.GetEntries(entries))
|
||||
if (palette.GetEntries(entries)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
MxS32 i;
|
||||
|
||||
@@ -81,8 +81,9 @@ MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param)
|
||||
{
|
||||
MxU8 count = 0;
|
||||
|
||||
for (; p_param; p_param >>= 1)
|
||||
for (; p_param; p_param >>= 1) {
|
||||
count += ((MxU8) p_param & 1);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -92,8 +93,9 @@ MxU8 MxDisplaySurface::CountContiguousBitsSetTo1(MxU32 p_param)
|
||||
{
|
||||
MxU8 count = 0;
|
||||
|
||||
for (; (p_param & 1) == 0; p_param >>= 1)
|
||||
for (; (p_param & 1) == 0; p_param >>= 1) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -117,8 +119,9 @@ MxResult MxDisplaySurface::Init(
|
||||
memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc));
|
||||
this->m_surfaceDesc.dwSize = sizeof(this->m_surfaceDesc);
|
||||
|
||||
if (this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc))
|
||||
if (this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc)) {
|
||||
result = FAILURE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -134,8 +137,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
this->m_initialized = TRUE;
|
||||
this->m_videoParam = p_videoParam;
|
||||
|
||||
if (!this->m_videoParam.Flags().GetFullScreen())
|
||||
if (!this->m_videoParam.Flags().GetFullScreen()) {
|
||||
this->m_videoParam.Flags().SetFlipSurfaces(FALSE);
|
||||
}
|
||||
|
||||
if (!this->m_videoParam.Flags().GetFlipSurfaces()) {
|
||||
this->m_videoParam.SetBackBuffers(1);
|
||||
@@ -143,10 +147,12 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
else {
|
||||
MxU32 backBuffers = this->m_videoParam.GetBackBuffers();
|
||||
|
||||
if (backBuffers < 1)
|
||||
if (backBuffers < 1) {
|
||||
this->m_videoParam.SetBackBuffers(1);
|
||||
else if (backBuffers > 2)
|
||||
}
|
||||
else if (backBuffers > 2) {
|
||||
this->m_videoParam.SetBackBuffers(2);
|
||||
}
|
||||
|
||||
this->m_videoParam.Flags().SetBackBuffers(TRUE);
|
||||
}
|
||||
@@ -155,20 +161,23 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
MxS32 width = this->m_videoParam.GetRect().GetWidth();
|
||||
MxS32 height = this->m_videoParam.GetRect().GetHeight();
|
||||
|
||||
if (lpDirectDraw->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))
|
||||
if (lpDirectDraw->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
if (lpDirectDraw->GetDisplayMode(&ddsd))
|
||||
if (lpDirectDraw->GetDisplayMode(&ddsd)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
MxS32 bitdepth = !this->m_videoParam.Flags().Get16Bit() ? 8 : 16;
|
||||
|
||||
if (ddsd.dwWidth != width || ddsd.dwHeight != height || ddsd.ddpfPixelFormat.dwRGBBitCount != bitdepth) {
|
||||
if (lpDirectDraw->SetDisplayMode(width, height, bitdepth))
|
||||
if (lpDirectDraw->SetDisplayMode(width, height, bitdepth)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +188,15 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
|
||||
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL))
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
|
||||
|
||||
if (this->m_ddSurface1->GetAttachedSurface(&ddsd.ddsCaps, &this->m_ddSurface2))
|
||||
if (this->m_ddSurface1->GetAttachedSurface(&ddsd.ddsCaps, &this->m_ddSurface2)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
@@ -193,8 +204,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL))
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
@@ -203,11 +215,13 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
ddsd.dwHeight = this->m_videoParam.GetRect().GetHeight();
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
if (!this->m_videoParam.Flags().GetBackBuffers())
|
||||
if (!this->m_videoParam.Flags().GetBackBuffers()) {
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
|
||||
}
|
||||
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL))
|
||||
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc));
|
||||
@@ -215,8 +229,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
|
||||
|
||||
if (!this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc)) {
|
||||
if (!lpDirectDraw->CreateClipper(0, &this->m_ddClipper, NULL) && !this->m_ddClipper->SetHWnd(0, hWnd) &&
|
||||
!this->m_ddSurface1->SetClipper(this->m_ddClipper))
|
||||
!this->m_ddSurface1->SetClipper(this->m_ddClipper)) {
|
||||
result = SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -227,18 +242,22 @@ done:
|
||||
void MxDisplaySurface::Destroy()
|
||||
{
|
||||
if (this->m_initialized) {
|
||||
if (this->m_ddSurface2)
|
||||
if (this->m_ddSurface2) {
|
||||
this->m_ddSurface2->Release();
|
||||
}
|
||||
|
||||
if (this->m_ddSurface1)
|
||||
if (this->m_ddSurface1) {
|
||||
this->m_ddSurface1->Release();
|
||||
}
|
||||
|
||||
if (this->m_ddClipper)
|
||||
if (this->m_ddClipper) {
|
||||
this->m_ddClipper->Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_16bitPal)
|
||||
if (this->m_16bitPal) {
|
||||
delete[] this->m_16bitPal;
|
||||
}
|
||||
|
||||
this->Init();
|
||||
}
|
||||
@@ -273,8 +292,9 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette)
|
||||
}
|
||||
|
||||
if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount == 16) {
|
||||
if (!m_16bitPal)
|
||||
if (!m_16bitPal) {
|
||||
m_16bitPal = new MxU16[256];
|
||||
}
|
||||
|
||||
PALETTEENTRY palette[256];
|
||||
p_palette->GetEntries(palette);
|
||||
@@ -287,9 +307,9 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette)
|
||||
MxU8 totalBitsBlue = CountTotalBitsSetTo1(m_surfaceDesc.ddpfPixelFormat.dwBBitMask);
|
||||
|
||||
for (MxS32 i = 0; i < 256; i++) {
|
||||
m_16bitPal[i] = (((palette[i].peRed >> (8 - totalBitsRed & 0x1f)) << (contiguousBitsRed & 0x1f))) |
|
||||
(((palette[i].peGreen >> (8 - totalBitsGreen & 0x1f)) << (contiguousBitsGreen & 0x1f))) |
|
||||
(((palette[i].peBlue >> (8 - totalBitsBlue & 0x1f)) << (contiguousBitsBlue & 0x1f)));
|
||||
m_16bitPal[i] = (((palette[i].peRed >> ((8 - totalBitsRed) & 0x1f)) << (contiguousBitsRed & 0x1f))) |
|
||||
(((palette[i].peGreen >> ((8 - totalBitsGreen) & 0x1f)) << (contiguousBitsGreen & 0x1f))) |
|
||||
(((palette[i].peBlue >> ((8 - totalBitsBlue) & 0x1f)) << (contiguousBitsBlue & 0x1f)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,8 +548,9 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p
|
||||
// FUNCTION: LEGO1 0x100bbc10
|
||||
void MxDisplaySurface::GetDC(HDC* p_hdc)
|
||||
{
|
||||
if (this->m_ddSurface2 && !this->m_ddSurface2->GetDC(p_hdc))
|
||||
if (this->m_ddSurface2 && !this->m_ddSurface2->GetDC(p_hdc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
*p_hdc = NULL;
|
||||
}
|
||||
@@ -537,8 +558,9 @@ void MxDisplaySurface::GetDC(HDC* p_hdc)
|
||||
// FUNCTION: LEGO1 0x100bbc40
|
||||
void MxDisplaySurface::ReleaseDC(HDC p_hdc)
|
||||
{
|
||||
if (this->m_ddSurface2 && p_hdc)
|
||||
if (this->m_ddSurface2 && p_hdc) {
|
||||
this->m_ddSurface2->ReleaseDC(p_hdc);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bbc60
|
||||
@@ -557,8 +579,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
if (draw->GetDisplayMode(&ddsd))
|
||||
if (draw->GetDisplayMode(&ddsd)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
||||
ddsd.dwWidth = p_bitmap->GetBmiWidth();
|
||||
@@ -579,8 +602,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(
|
||||
surface = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
surface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (surface) {
|
||||
@@ -604,8 +628,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(
|
||||
|
||||
// TODO: Probably p_bitmap->GetAdjustedStride()
|
||||
MxS32 rowSeek = p_bitmap->GetBmiStride();
|
||||
if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0)
|
||||
if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0) {
|
||||
rowSeek = -rowSeek;
|
||||
}
|
||||
|
||||
MxLong newPitch = ddsd.lPitch;
|
||||
switch (ddsd.ddpfPixelFormat.dwRGBBitCount) {
|
||||
@@ -714,15 +739,17 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface()
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK)
|
||||
if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
if (newSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) != DD_OK)
|
||||
if (newSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
else {
|
||||
MxU16* surface = (MxU16*) ddsd.lpSurface;
|
||||
MxLong pitch = ddsd.lPitch;
|
||||
@@ -732,10 +759,12 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface()
|
||||
MxU16* surface2 = surface;
|
||||
for (MxS32 y = 0; y < 16; y++) {
|
||||
if ((y > 10 || x) && (x > 10 || y) && x + y != 10) {
|
||||
if (x + y > 10)
|
||||
if (x + y > 10) {
|
||||
*surface2 = 31775;
|
||||
else
|
||||
}
|
||||
else {
|
||||
*surface2 = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*surface2 = 0;
|
||||
|
||||
@@ -35,8 +35,9 @@ void MxFlcPresenter::LoadHeader(MxStreamChunk* p_chunk)
|
||||
// FUNCTION: LEGO1 0x100b34d0
|
||||
void MxFlcPresenter::CreateBitmap()
|
||||
{
|
||||
if (m_bitmap)
|
||||
if (m_bitmap) {
|
||||
delete m_bitmap;
|
||||
}
|
||||
|
||||
m_bitmap = new MxBitmap;
|
||||
m_bitmap->SetSize(m_flcHeader->width, m_flcHeader->height, NULL, FALSE);
|
||||
@@ -62,8 +63,9 @@ void MxFlcPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
&decodedColorMap
|
||||
);
|
||||
|
||||
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && decodedColorMap)
|
||||
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && decodedColorMap) {
|
||||
RealizePalette();
|
||||
}
|
||||
|
||||
for (MxS32 i = 0; i < rectCount; i++) {
|
||||
MxRect32 rect(rects[i]);
|
||||
|
||||
@@ -31,8 +31,9 @@ void MxLoopingFlcPresenter::Destroy(MxBool p_fromDestructor)
|
||||
Init();
|
||||
m_criticalSection.Leave();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxFlcPresenter::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b4470
|
||||
@@ -40,8 +41,9 @@ void MxLoopingFlcPresenter::NextFrame()
|
||||
{
|
||||
MxStreamChunk* chunk = NextChunk();
|
||||
|
||||
if (chunk->GetFlags() & MxDSChunk::c_end)
|
||||
if (chunk->GetFlags() & MxDSChunk::c_end) {
|
||||
ProgressTickleState(e_repeating);
|
||||
}
|
||||
else {
|
||||
LoadFrame(chunk);
|
||||
LoopChunk(chunk);
|
||||
@@ -54,8 +56,9 @@ void MxLoopingFlcPresenter::NextFrame()
|
||||
// FUNCTION: LEGO1 0x100b44c0
|
||||
void MxLoopingFlcPresenter::VTable0x88()
|
||||
{
|
||||
if (m_action->GetDuration() < m_elapsedDuration)
|
||||
if (m_action->GetDuration() < m_elapsedDuration) {
|
||||
ProgressTickleState(e_unk5);
|
||||
}
|
||||
else {
|
||||
MxStreamChunk* chunk;
|
||||
m_loopingChunkCursor->Current(chunk);
|
||||
@@ -81,8 +84,9 @@ void MxLoopingFlcPresenter::RepeatingTickle()
|
||||
time += m_flcHeader->speed;
|
||||
|
||||
cursor.Reset();
|
||||
while (cursor.Next(chunk))
|
||||
while (cursor.Next(chunk)) {
|
||||
chunk->SetTime(chunk->GetTime() + time);
|
||||
}
|
||||
|
||||
m_loopingChunkCursor->Next();
|
||||
}
|
||||
@@ -90,15 +94,17 @@ void MxLoopingFlcPresenter::RepeatingTickle()
|
||||
MxStreamChunk* chunk;
|
||||
m_loopingChunkCursor->Current(chunk);
|
||||
|
||||
if (m_action->GetElapsedTime() < chunk->GetTime())
|
||||
if (m_action->GetElapsedTime() < chunk->GetTime()) {
|
||||
break;
|
||||
}
|
||||
|
||||
VTable0x88();
|
||||
|
||||
m_loopingChunkCursor->Next(chunk);
|
||||
|
||||
if (m_currentTickleState != e_repeating)
|
||||
if (m_currentTickleState != e_repeating) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +120,9 @@ MxResult MxLoopingFlcPresenter::AddToManager()
|
||||
result = SUCCESS;
|
||||
}
|
||||
|
||||
if (locked)
|
||||
if (locked) {
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor)
|
||||
Init();
|
||||
m_criticalSection.Leave();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxSmkPresenter::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b4a00
|
||||
@@ -51,8 +52,9 @@ void MxLoopingSmkPresenter::NextFrame()
|
||||
{
|
||||
MxStreamChunk* chunk = NextChunk();
|
||||
|
||||
if (chunk->GetFlags() & MxDSChunk::c_end)
|
||||
if (chunk->GetFlags() & MxDSChunk::c_end) {
|
||||
ProgressTickleState(e_repeating);
|
||||
}
|
||||
else {
|
||||
LoadFrame(chunk);
|
||||
LoopChunk(chunk);
|
||||
@@ -65,8 +67,9 @@ void MxLoopingSmkPresenter::NextFrame()
|
||||
// FUNCTION: LEGO1 0x100b4a90
|
||||
void MxLoopingSmkPresenter::VTable0x8c()
|
||||
{
|
||||
if (m_action->GetDuration() < m_elapsedDuration)
|
||||
if (m_action->GetDuration() < m_elapsedDuration) {
|
||||
ProgressTickleState(e_unk5);
|
||||
}
|
||||
else {
|
||||
MxStreamChunk* chunk;
|
||||
m_loopingChunkCursor->Current(chunk);
|
||||
@@ -92,8 +95,9 @@ void MxLoopingSmkPresenter::RepeatingTickle()
|
||||
time += 1000 / ((MxDSMediaAction*) m_action)->GetFramesPerSecond();
|
||||
|
||||
cursor.Reset();
|
||||
while (cursor.Next(chunk))
|
||||
while (cursor.Next(chunk)) {
|
||||
chunk->SetTime(chunk->GetTime() + time);
|
||||
}
|
||||
|
||||
m_loopingChunkCursor->Next();
|
||||
}
|
||||
@@ -101,15 +105,17 @@ void MxLoopingSmkPresenter::RepeatingTickle()
|
||||
MxStreamChunk* chunk;
|
||||
m_loopingChunkCursor->Current(chunk);
|
||||
|
||||
if (m_action->GetElapsedTime() < chunk->GetTime())
|
||||
if (m_action->GetElapsedTime() < chunk->GetTime()) {
|
||||
break;
|
||||
}
|
||||
|
||||
VTable0x8c();
|
||||
|
||||
m_loopingChunkCursor->Next(chunk);
|
||||
|
||||
if (m_currentTickleState != e_repeating)
|
||||
if (m_currentTickleState != e_repeating) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,18 +110,23 @@ LPDIRECTDRAWPALETTE MxPalette::CreateNativePalette()
|
||||
{
|
||||
MxS32 i;
|
||||
if (this->m_palette == NULL) {
|
||||
for (i = 0; i < 10; i++)
|
||||
for (i = 0; i < 10; i++) {
|
||||
this->m_entries[i].peFlags = 0x80;
|
||||
for (i = 10; i < 136; i++)
|
||||
}
|
||||
for (i = 10; i < 136; i++) {
|
||||
this->m_entries[i].peFlags = 0x44;
|
||||
for (i = 136; i < 140; i++)
|
||||
}
|
||||
for (i = 136; i < 140; i++) {
|
||||
this->m_entries[i].peFlags = 0x84;
|
||||
}
|
||||
this->m_entries[140].peFlags = 0x84;
|
||||
this->m_entries[141].peFlags = 0x44;
|
||||
for (i = 142; i < 246; i++)
|
||||
for (i = 142; i < 246; i++) {
|
||||
this->m_entries[i].peFlags = 0x84;
|
||||
for (i = 246; i < 256; i++)
|
||||
}
|
||||
for (i = 246; i < 256; i++) {
|
||||
this->m_entries[i].peFlags = 0x80;
|
||||
}
|
||||
|
||||
if (MVideoManager() && MVideoManager()->GetDirectDraw()) {
|
||||
MVideoManager()->GetDirectDraw()->CreatePalette(4, this->m_entries, &this->m_palette, NULL);
|
||||
@@ -154,8 +159,9 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries)
|
||||
MxResult status = SUCCESS;
|
||||
|
||||
if (this->m_palette) {
|
||||
for (i = 0; i < 10; i++)
|
||||
for (i = 0; i < 10; i++) {
|
||||
this->m_entries[i].peFlags = 0x80;
|
||||
}
|
||||
for (i = 10; i < 136; i++) {
|
||||
this->m_entries[i].peFlags = 68;
|
||||
this->m_entries[i].peRed = p_entries[i].peRed;
|
||||
@@ -186,11 +192,13 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries)
|
||||
this->m_entries[i].peBlue = p_entries[i].peBlue;
|
||||
}
|
||||
|
||||
for (i = 246; i < 256; i++)
|
||||
for (i = 246; i < 256; i++) {
|
||||
this->m_entries[i].peFlags = 0x80;
|
||||
}
|
||||
|
||||
if (this->m_palette->SetEntries(0, 0, 256, this->m_entries))
|
||||
if (this->m_palette->SetEntries(0, 0, 256, this->m_entries)) {
|
||||
status = FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -222,12 +230,15 @@ void MxPalette::Detach()
|
||||
MxBool MxPalette::operator==(MxPalette& p_other)
|
||||
{
|
||||
for (MxS32 i = 0; i < 256; i++) {
|
||||
if (this->m_entries[i].peRed != p_other.m_entries[i].peRed)
|
||||
if (this->m_entries[i].peRed != p_other.m_entries[i].peRed) {
|
||||
return FALSE;
|
||||
if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen)
|
||||
}
|
||||
if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen) {
|
||||
return FALSE;
|
||||
if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue)
|
||||
}
|
||||
if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ MxBool MxRegion::VTable0x20()
|
||||
// FUNCTION: LEGO1 0x100c3690
|
||||
MxRegion::~MxRegion()
|
||||
{
|
||||
if (m_list)
|
||||
if (m_list) {
|
||||
delete m_list;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c3700
|
||||
@@ -88,17 +89,20 @@ void MxRegion::VTable0x18(MxRect32& p_rect)
|
||||
// FUNCTION: LEGO1 0x100c3e20
|
||||
MxBool MxRegion::VTable0x1c(MxRect32& p_rect)
|
||||
{
|
||||
if (!m_rect.IntersectsWith(p_rect))
|
||||
if (!m_rect.IntersectsWith(p_rect)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MxRegionTopBottomListCursor cursor(m_list);
|
||||
MxRegionTopBottom* topBottom;
|
||||
|
||||
while (cursor.Next(topBottom)) {
|
||||
if (topBottom->GetTop() >= p_rect.GetBottom())
|
||||
if (topBottom->GetTop() >= p_rect.GetBottom()) {
|
||||
return FALSE;
|
||||
if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->FUN_100c57b0(p_rect))
|
||||
}
|
||||
if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->FUN_100c57b0(p_rect)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -130,27 +134,31 @@ void MxRegionTopBottom::FUN_100c5280(MxS32 p_left, MxS32 p_right)
|
||||
MxRegionLeftRightListCursor b(m_leftRightList);
|
||||
|
||||
MxRegionLeftRight* leftRight;
|
||||
while (a.Next(leftRight) && leftRight->GetRight() < p_left)
|
||||
while (a.Next(leftRight) && leftRight->GetRight() < p_left) {
|
||||
;
|
||||
}
|
||||
|
||||
if (!a.HasMatch()) {
|
||||
MxRegionLeftRight* copy = new MxRegionLeftRight(p_left, p_right);
|
||||
m_leftRightList->Append(copy);
|
||||
}
|
||||
else {
|
||||
if (p_left > leftRight->GetLeft())
|
||||
if (p_left > leftRight->GetLeft()) {
|
||||
p_left = leftRight->GetLeft();
|
||||
}
|
||||
|
||||
while (leftRight->GetLeft() < p_right) {
|
||||
if (p_right < leftRight->GetRight())
|
||||
if (p_right < leftRight->GetRight()) {
|
||||
p_right = leftRight->GetRight();
|
||||
}
|
||||
|
||||
b = a;
|
||||
b.Next();
|
||||
a.Destroy();
|
||||
|
||||
if (!b.Current(leftRight))
|
||||
if (!b.Current(leftRight)) {
|
||||
break;
|
||||
}
|
||||
|
||||
a = b;
|
||||
}
|
||||
@@ -174,8 +182,9 @@ MxRegionTopBottom* MxRegionTopBottom::Clone()
|
||||
MxRegionLeftRightListCursor cursor(m_leftRightList);
|
||||
MxRegionLeftRight* leftRight;
|
||||
|
||||
while (cursor.Next(leftRight))
|
||||
while (cursor.Next(leftRight)) {
|
||||
clone->m_leftRightList->Append(leftRight->Clone());
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
@@ -187,10 +196,12 @@ MxBool MxRegionTopBottom::FUN_100c57b0(MxRect32& p_rect)
|
||||
MxRegionLeftRight* leftRight;
|
||||
|
||||
while (cursor.Next(leftRight)) {
|
||||
if (p_rect.GetRight() <= leftRight->GetLeft())
|
||||
if (p_rect.GetRight() <= leftRight->GetLeft()) {
|
||||
return FALSE;
|
||||
if (leftRight->GetRight() > p_rect.GetLeft())
|
||||
}
|
||||
if (leftRight->GetRight() > p_rect.GetLeft()) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -14,14 +14,17 @@ MxRegionCursor::MxRegionCursor(MxRegion* p_region)
|
||||
// FUNCTION: LEGO1 0x100c40b0
|
||||
MxRegionCursor::~MxRegionCursor()
|
||||
{
|
||||
if (m_rect)
|
||||
if (m_rect) {
|
||||
delete m_rect;
|
||||
}
|
||||
|
||||
if (m_topBottomCursor)
|
||||
if (m_topBottomCursor) {
|
||||
delete m_topBottomCursor;
|
||||
}
|
||||
|
||||
if (m_leftRightCursor)
|
||||
if (m_leftRightCursor) {
|
||||
delete m_leftRightCursor;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c4140
|
||||
@@ -38,8 +41,9 @@ MxRect32* MxRegionCursor::VTable0x18()
|
||||
|
||||
UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom());
|
||||
}
|
||||
else
|
||||
else {
|
||||
Reset();
|
||||
}
|
||||
|
||||
return m_rect;
|
||||
}
|
||||
@@ -58,8 +62,9 @@ MxRect32* MxRegionCursor::VTable0x20()
|
||||
|
||||
UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom());
|
||||
}
|
||||
else
|
||||
else {
|
||||
Reset();
|
||||
}
|
||||
|
||||
return m_rect;
|
||||
}
|
||||
@@ -144,11 +149,13 @@ MxRect32* MxRegionCursor::VTable0x24(MxRect32& p_rect)
|
||||
UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom());
|
||||
m_rect->Intersect(p_rect);
|
||||
}
|
||||
else
|
||||
else {
|
||||
FUN_100c4a20(p_rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
FUN_100c4a20(p_rect);
|
||||
}
|
||||
|
||||
return m_rect;
|
||||
}
|
||||
@@ -167,11 +174,13 @@ MxRect32* MxRegionCursor::VTable0x2c(MxRect32& p_rect)
|
||||
UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom());
|
||||
m_rect->Intersect(p_rect);
|
||||
}
|
||||
else
|
||||
else {
|
||||
FUN_100c4b50(p_rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
FUN_100c4b50(p_rect);
|
||||
}
|
||||
|
||||
return m_rect;
|
||||
}
|
||||
@@ -195,8 +204,9 @@ void MxRegionCursor::Reset()
|
||||
// FUNCTION: LEGO1 0x100c46c0
|
||||
void MxRegionCursor::FUN_100c46c0(MxRegionLeftRightList& p_leftRightList)
|
||||
{
|
||||
if (m_leftRightCursor)
|
||||
if (m_leftRightCursor) {
|
||||
delete m_leftRightCursor;
|
||||
}
|
||||
|
||||
m_leftRightCursor = new MxRegionLeftRightListCursor(&p_leftRightList);
|
||||
}
|
||||
@@ -204,8 +214,9 @@ void MxRegionCursor::FUN_100c46c0(MxRegionLeftRightList& p_leftRightList)
|
||||
// FUNCTION: LEGO1 0x100c4980
|
||||
void MxRegionCursor::UpdateRect(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom)
|
||||
{
|
||||
if (!m_rect)
|
||||
if (!m_rect) {
|
||||
m_rect = new MxRect32;
|
||||
}
|
||||
|
||||
m_rect->SetLeft(p_left);
|
||||
m_rect->SetTop(p_top);
|
||||
@@ -228,8 +239,9 @@ void MxRegionCursor::FUN_100c4a20(MxRect32& p_rect)
|
||||
|
||||
MxRegionLeftRight* leftRight;
|
||||
while (m_leftRightCursor->Next(leftRight)) {
|
||||
if (p_rect.GetRight() <= leftRight->GetLeft())
|
||||
if (p_rect.GetRight() <= leftRight->GetLeft()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (p_rect.GetLeft() < leftRight->GetRight()) {
|
||||
UpdateRect(
|
||||
@@ -263,8 +275,9 @@ void MxRegionCursor::FUN_100c4b50(MxRect32& p_rect)
|
||||
|
||||
MxRegionLeftRight* leftRight;
|
||||
while (m_leftRightCursor->Prev(leftRight)) {
|
||||
if (leftRight->GetRight() <= p_rect.GetLeft())
|
||||
if (leftRight->GetRight() <= p_rect.GetLeft()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (leftRight->GetLeft() < p_rect.GetRight()) {
|
||||
UpdateRect(
|
||||
|
||||
@@ -40,8 +40,9 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack)
|
||||
|
||||
// TODO
|
||||
for (MxU32 i = 0; i < FRAME_COUNT(p_mxSmack); i++) {
|
||||
if (p_mxSmack->m_maxFrameSize < frameSizes[i])
|
||||
if (p_mxSmack->m_maxFrameSize < frameSizes[i]) {
|
||||
p_mxSmack->m_maxFrameSize = frameSizes[i];
|
||||
}
|
||||
}
|
||||
|
||||
frameTypes = new MxU8[FRAME_COUNT(p_mxSmack)];
|
||||
@@ -54,8 +55,9 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack)
|
||||
p_data += FRAME_COUNT(p_mxSmack);
|
||||
|
||||
MxU32 treeSize = p_mxSmack->m_smackTag.tablesize + 0x1000;
|
||||
if (treeSize <= 0x2000)
|
||||
if (treeSize <= 0x2000) {
|
||||
treeSize = 0x2000;
|
||||
}
|
||||
|
||||
huffmanTrees = new MxU8[treeSize];
|
||||
|
||||
@@ -127,16 +129,21 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack)
|
||||
// FUNCTION: LEGO1 0x100c5d40
|
||||
void MxSmack::Destroy(MxSmack* p_mxSmack)
|
||||
{
|
||||
if (p_mxSmack->m_frameSizes)
|
||||
if (p_mxSmack->m_frameSizes) {
|
||||
delete[] p_mxSmack->m_frameSizes;
|
||||
if (p_mxSmack->m_frameTypes)
|
||||
}
|
||||
if (p_mxSmack->m_frameTypes) {
|
||||
delete[] p_mxSmack->m_frameTypes;
|
||||
if (p_mxSmack->m_huffmanTrees)
|
||||
}
|
||||
if (p_mxSmack->m_huffmanTrees) {
|
||||
delete[] p_mxSmack->m_huffmanTrees;
|
||||
if (p_mxSmack->m_huffmanTables)
|
||||
}
|
||||
if (p_mxSmack->m_huffmanTables) {
|
||||
delete[] p_mxSmack->m_huffmanTables;
|
||||
if (p_mxSmack->m_unk0x6b4)
|
||||
}
|
||||
if (p_mxSmack->m_unk0x6b4) {
|
||||
delete[] p_mxSmack->m_unk0x6b4;
|
||||
}
|
||||
}
|
||||
|
||||
// This should be refactored to somewhere else
|
||||
@@ -223,12 +230,14 @@ MxBool MxSmack::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect
|
||||
{
|
||||
u32 left, bottom, top, right;
|
||||
|
||||
if (!*p_und)
|
||||
if (!*p_und) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*p_und == 1) {
|
||||
if (!SmackGetRect(p_unk0x6b4, p_smackRect))
|
||||
if (!SmackGetRect(p_unk0x6b4, p_smackRect)) {
|
||||
return FALSE;
|
||||
}
|
||||
*p_und = 2;
|
||||
}
|
||||
|
||||
@@ -238,10 +247,12 @@ MxBool MxSmack::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect
|
||||
bottom = p_smackRect[3] + p_smackRect[1];
|
||||
|
||||
while (SmackGetRect(p_unk0x6b4, p_smackRect)) {
|
||||
if (left > p_smackRect[0])
|
||||
if (left > p_smackRect[0]) {
|
||||
left = p_smackRect[0];
|
||||
if (right < p_smackRect[0] + p_smackRect[2])
|
||||
}
|
||||
if (right < p_smackRect[0] + p_smackRect[2]) {
|
||||
right = p_smackRect[0] + p_smackRect[2];
|
||||
}
|
||||
|
||||
bottom = p_smackRect[1] + p_smackRect[3];
|
||||
}
|
||||
|
||||
@@ -51,8 +51,9 @@ void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk)
|
||||
// FUNCTION: LEGO1 0x100b3960
|
||||
void MxSmkPresenter::CreateBitmap()
|
||||
{
|
||||
if (m_bitmap)
|
||||
if (m_bitmap) {
|
||||
delete m_bitmap;
|
||||
}
|
||||
|
||||
m_bitmap = new MxBitmap;
|
||||
m_bitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE);
|
||||
@@ -72,8 +73,9 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
MxRectList list(TRUE);
|
||||
MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, &list);
|
||||
|
||||
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged)
|
||||
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) {
|
||||
RealizePalette();
|
||||
}
|
||||
|
||||
MxRect32 invalidateRect;
|
||||
MxRectListCursor cursor(&list);
|
||||
@@ -91,8 +93,9 @@ void MxSmkPresenter::VTable0x88()
|
||||
{
|
||||
if ((m_mxSmack.m_smackTag.SmackerType & 1) != 0) {
|
||||
MxU32 und = (m_currentFrame % m_mxSmack.m_smackTag.Frames);
|
||||
if (1 < m_currentFrame && und == 1)
|
||||
if (1 < m_currentFrame && und == 1) {
|
||||
m_currentFrame = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_mxSmack.m_smackTag.Frames == m_currentFrame) {
|
||||
|
||||
@@ -19,21 +19,24 @@ void MxStillPresenter::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_bitmapInfo)
|
||||
if (m_bitmapInfo) {
|
||||
delete m_bitmapInfo;
|
||||
}
|
||||
m_bitmapInfo = NULL;
|
||||
|
||||
m_criticalSection.Leave();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxVideoPresenter::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b9cc0
|
||||
void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk)
|
||||
{
|
||||
if (m_bitmapInfo)
|
||||
if (m_bitmapInfo) {
|
||||
delete m_bitmapInfo;
|
||||
}
|
||||
|
||||
MxU8* data = new MxU8[p_chunk->GetLength()];
|
||||
m_bitmapInfo = (MxBITMAPINFO*) data;
|
||||
@@ -43,8 +46,9 @@ void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk)
|
||||
// FUNCTION: LEGO1 0x100b9d10
|
||||
void MxStillPresenter::CreateBitmap()
|
||||
{
|
||||
if (m_bitmap)
|
||||
if (m_bitmap) {
|
||||
delete m_bitmap;
|
||||
}
|
||||
|
||||
m_bitmap = new MxBitmap;
|
||||
m_bitmap->ImportBitmapInfo(m_bitmapInfo);
|
||||
@@ -90,10 +94,12 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
delete m_bitmap;
|
||||
m_bitmap = NULL;
|
||||
|
||||
if (m_unk0x58 && und)
|
||||
if (m_unk0x58 && und) {
|
||||
SetBit2(TRUE);
|
||||
else
|
||||
}
|
||||
else {
|
||||
SetBit2(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +116,9 @@ void MxStillPresenter::StartingTickle()
|
||||
{
|
||||
MxVideoPresenter::StartingTickle();
|
||||
|
||||
if (m_currentTickleState == e_streaming && ((MxDSMediaAction*) m_action)->GetPaletteManagement())
|
||||
if (m_currentTickleState == e_streaming && ((MxDSMediaAction*) m_action)->GetPaletteManagement()) {
|
||||
RealizePalette();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b9f90
|
||||
@@ -124,8 +131,9 @@ void MxStillPresenter::StreamingTickle()
|
||||
NextFrame();
|
||||
ProgressTickleState(e_repeating);
|
||||
|
||||
if (m_action->GetDuration() == -1 && m_compositePresenter)
|
||||
if (m_action->GetDuration() == -1 && m_compositePresenter) {
|
||||
m_compositePresenter->VTable0x60(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +141,9 @@ void MxStillPresenter::StreamingTickle()
|
||||
void MxStillPresenter::RepeatingTickle()
|
||||
{
|
||||
if (m_action->GetDuration() != -1) {
|
||||
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration())
|
||||
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) {
|
||||
ProgressTickleState(e_unk5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,13 +194,15 @@ void MxStillPresenter::ParseExtra()
|
||||
{
|
||||
MxPresenter::ParseExtra();
|
||||
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit5)
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit5) {
|
||||
SetBit3(TRUE);
|
||||
}
|
||||
|
||||
MxU32 len = m_action->GetExtraLength();
|
||||
|
||||
if (len == 0)
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
len &= MAXWORD;
|
||||
|
||||
@@ -233,15 +244,18 @@ MxStillPresenter* MxStillPresenter::Clone()
|
||||
if (m_bitmap) {
|
||||
presenter->m_bitmap = new MxBitmap;
|
||||
|
||||
if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS)
|
||||
if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_unk0x58)
|
||||
if (m_unk0x58) {
|
||||
presenter->m_unk0x58 = MxDisplaySurface::FUN_100bbfb0(m_unk0x58);
|
||||
}
|
||||
|
||||
if (m_alpha)
|
||||
if (m_alpha) {
|
||||
presenter->m_alpha = new MxVideoPresenter::AlphaMask(*m_alpha);
|
||||
}
|
||||
|
||||
result = SUCCESS;
|
||||
}
|
||||
|
||||
@@ -42,32 +42,39 @@ void MxVideoManager::Destroy(MxBool p_fromDestructor)
|
||||
m_thread->Terminate();
|
||||
delete m_thread;
|
||||
}
|
||||
else
|
||||
else {
|
||||
TickleManager()->UnregisterClient(this);
|
||||
}
|
||||
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_displaySurface)
|
||||
if (m_displaySurface) {
|
||||
delete m_displaySurface;
|
||||
}
|
||||
|
||||
if (m_region)
|
||||
if (m_region) {
|
||||
delete m_region;
|
||||
}
|
||||
|
||||
if (m_videoParam.GetPalette())
|
||||
if (m_videoParam.GetPalette()) {
|
||||
delete m_videoParam.GetPalette();
|
||||
}
|
||||
|
||||
if (m_unk0x60) {
|
||||
if (m_pDirectDraw)
|
||||
if (m_pDirectDraw) {
|
||||
m_pDirectDraw->Release();
|
||||
if (m_pDirect3D)
|
||||
}
|
||||
if (m_pDirect3D) {
|
||||
m_pDirect3D->Release();
|
||||
}
|
||||
}
|
||||
|
||||
Init();
|
||||
m_criticalSection.Leave();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxMediaManager::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100be3e0
|
||||
@@ -85,8 +92,9 @@ void MxVideoManager::UpdateRegion()
|
||||
// FUNCTION: LEGO1 0x100be440
|
||||
void MxVideoManager::SortPresenterList()
|
||||
{
|
||||
if (this->m_presenters->GetCount() <= 1)
|
||||
if (this->m_presenters->GetCount() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
MxPresenterListCursor a(this->m_presenters);
|
||||
MxPresenterListCursor b(this->m_presenters);
|
||||
@@ -132,8 +140,9 @@ MxResult MxVideoManager::VTable0x28(
|
||||
|
||||
m_unk0x60 = FALSE;
|
||||
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS)
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
@@ -141,8 +150,9 @@ MxResult MxVideoManager::VTable0x28(
|
||||
m_videoParam = p_videoParam;
|
||||
m_region = new MxRegion();
|
||||
|
||||
if (!m_region)
|
||||
if (!m_region) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_pDirectDraw = p_pDirectDraw;
|
||||
m_pDirect3D = p_pDirect3D;
|
||||
@@ -152,15 +162,17 @@ MxResult MxVideoManager::VTable0x28(
|
||||
palette = new MxPalette();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
palette = p_videoParam.GetPalette()->Clone();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
m_displaySurface = new MxDisplaySurface();
|
||||
@@ -170,21 +182,25 @@ MxResult MxVideoManager::VTable0x28(
|
||||
if (p_createThread) {
|
||||
m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS)
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
}
|
||||
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != SUCCESS)
|
||||
if (status != SUCCESS) {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if (locked)
|
||||
if (locked) {
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -197,8 +213,9 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
|
||||
|
||||
m_unk0x60 = TRUE;
|
||||
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS)
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
@@ -206,29 +223,34 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
|
||||
m_videoParam = p_videoParam;
|
||||
m_region = new MxRegion();
|
||||
|
||||
if (!m_region)
|
||||
if (!m_region) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (DirectDrawCreate(NULL, &m_pDirectDraw, NULL) != DD_OK)
|
||||
if (DirectDrawCreate(NULL, &m_pDirectDraw, NULL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (m_pDirectDraw->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DDSCL_NORMAL) != DD_OK)
|
||||
if (m_pDirectDraw->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DDSCL_NORMAL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
MxPalette* palette;
|
||||
if (p_videoParam.GetPalette() == NULL) {
|
||||
palette = new MxPalette();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
palette = p_videoParam.GetPalette()->Clone();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
m_displaySurface = new MxDisplaySurface();
|
||||
@@ -238,21 +260,25 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
|
||||
if (p_createThread) {
|
||||
m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS)
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
}
|
||||
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != SUCCESS)
|
||||
if (status != SUCCESS) {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if (locked)
|
||||
if (locked) {
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -268,8 +294,9 @@ void MxVideoManager::InvalidateRect(MxRect32& p_rect)
|
||||
{
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_region)
|
||||
if (m_region) {
|
||||
m_region->VTable0x18(p_rect);
|
||||
}
|
||||
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
@@ -284,13 +311,15 @@ MxResult MxVideoManager::Tickle()
|
||||
MxPresenter* presenter;
|
||||
MxPresenterListCursor cursor(this->m_presenters);
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->Tickle();
|
||||
}
|
||||
|
||||
cursor.Reset();
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->PutData();
|
||||
}
|
||||
|
||||
UpdateRegion();
|
||||
m_region->Reset();
|
||||
|
||||
@@ -46,15 +46,17 @@ MxVideoParam::MxVideoParam(MxVideoParam& p_videoParam)
|
||||
// FUNCTION: LEGO1 0x100bed50
|
||||
MxVideoParam::~MxVideoParam()
|
||||
{
|
||||
if (this->m_deviceId != NULL)
|
||||
if (this->m_deviceId != NULL) {
|
||||
delete[] this->m_deviceId;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bed70
|
||||
void MxVideoParam::SetDeviceName(char* p_deviceId)
|
||||
{
|
||||
if (this->m_deviceId != NULL)
|
||||
if (this->m_deviceId != NULL) {
|
||||
delete[] this->m_deviceId;
|
||||
}
|
||||
|
||||
if (p_deviceId != NULL) {
|
||||
this->m_deviceId = new char[strlen(p_deviceId) + 1];
|
||||
|
||||
@@ -33,10 +33,12 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
|
||||
|
||||
switch (p_bitmap.GetBmiHeader()->biCompression) {
|
||||
case BI_RGB: {
|
||||
if (p_bitmap.GetBmiHeight() < 0)
|
||||
if (p_bitmap.GetBmiHeight() < 0) {
|
||||
rowsBeforeTop = 0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1;
|
||||
}
|
||||
bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
|
||||
break;
|
||||
}
|
||||
@@ -44,10 +46,12 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
|
||||
bitmapSrcPtr = p_bitmap.GetBitmapData();
|
||||
break;
|
||||
default: {
|
||||
if (p_bitmap.GetBmiHeight() < 0)
|
||||
if (p_bitmap.GetBmiHeight() < 0) {
|
||||
rowsBeforeTop = 0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1;
|
||||
}
|
||||
bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
|
||||
}
|
||||
}
|
||||
@@ -57,8 +61,9 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
|
||||
// If this is a bottom-up DIB, we will walk it in reverse.
|
||||
// TODO: Same rounding trick as in MxBitmap
|
||||
MxS32 rowSeek = ((m_width + 3) & -4);
|
||||
if (p_bitmap.GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap.GetBmiHeight() > 0)
|
||||
if (p_bitmap.GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap.GetBmiHeight() > 0) {
|
||||
rowSeek = -rowSeek;
|
||||
}
|
||||
|
||||
// The actual offset into the m_bitmask array. The two for-loops
|
||||
// are just for counting the pixels.
|
||||
@@ -95,15 +100,17 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxVideoPresenter::AlphaMask& p_alph
|
||||
// FUNCTION: LEGO1 0x100b26d0
|
||||
MxVideoPresenter::AlphaMask::~AlphaMask()
|
||||
{
|
||||
if (m_bitmask)
|
||||
if (m_bitmask) {
|
||||
delete[] m_bitmask;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b26f0
|
||||
MxS32 MxVideoPresenter::AlphaMask::IsHit(MxU32 p_x, MxU32 p_y)
|
||||
{
|
||||
if (p_x >= m_width || p_y >= m_height)
|
||||
if (p_x >= m_width || p_y >= m_height) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MxS32 pos = p_y * m_width + p_x;
|
||||
return m_bitmask[pos / 8] & (1 << abs(abs(pos) & 7)) ? 1 : 0;
|
||||
@@ -132,8 +139,9 @@ void MxVideoPresenter::Init()
|
||||
// FUNCTION: LEGO1 0x100b27b0
|
||||
void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
if (MVideoManager() != NULL)
|
||||
if (MVideoManager() != NULL) {
|
||||
MVideoManager()->UnregisterPresenter(*this);
|
||||
}
|
||||
|
||||
if (m_unk0x58) {
|
||||
m_unk0x58->Release();
|
||||
@@ -159,8 +167,9 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
|
||||
|
||||
Init();
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxMediaPresenter::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b28b0
|
||||
@@ -183,11 +192,13 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
|
||||
{
|
||||
MxDSAction* action = GetAction();
|
||||
if ((action == NULL) || (((action->GetFlags() & MxDSAction::c_bit11) == 0) && !IsEnabled()) ||
|
||||
(!m_bitmap && !m_alpha))
|
||||
(!m_bitmap && !m_alpha)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!m_bitmap)
|
||||
if (!m_bitmap) {
|
||||
return m_alpha->IsHit(p_x - m_location.GetX(), p_y - m_location.GetY());
|
||||
}
|
||||
|
||||
MxLong heightAbs = m_bitmap->GetBmiHeightAbs();
|
||||
|
||||
@@ -197,8 +208,9 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
|
||||
MxLong maxY = minY + heightAbs;
|
||||
MxLong maxX = minX + m_bitmap->GetBmiWidth();
|
||||
|
||||
if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY)
|
||||
if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MxU8* pixel;
|
||||
|
||||
@@ -230,11 +242,13 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
|
||||
pixel = m_bitmap->GetBmiStride() * height + m_bitmap->GetBitmapData();
|
||||
}
|
||||
|
||||
if (GetBit4())
|
||||
if (GetBit4()) {
|
||||
return (MxBool) *pixel;
|
||||
}
|
||||
|
||||
if ((GetAction()->GetFlags() & MxDSAction::c_bit4) && *pixel == 0)
|
||||
if ((GetAction()->GetFlags() & MxDSAction::c_bit4) && *pixel == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -242,32 +256,40 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
|
||||
inline MxS32 MxVideoPresenter::PrepareRects(MxRect32& p_rectDest, MxRect32& p_rectSrc)
|
||||
{
|
||||
if (p_rectDest.GetTop() > 480 || p_rectDest.GetLeft() > 640 || p_rectSrc.GetTop() > 480 ||
|
||||
p_rectSrc.GetLeft() > 640)
|
||||
p_rectSrc.GetLeft() > 640) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (p_rectDest.GetBottom() > 480)
|
||||
if (p_rectDest.GetBottom() > 480) {
|
||||
p_rectDest.SetBottom(480);
|
||||
}
|
||||
|
||||
if (p_rectDest.GetRight() > 640)
|
||||
if (p_rectDest.GetRight() > 640) {
|
||||
p_rectDest.SetRight(640);
|
||||
}
|
||||
|
||||
if (p_rectSrc.GetBottom() > 480)
|
||||
if (p_rectSrc.GetBottom() > 480) {
|
||||
p_rectSrc.SetBottom(480);
|
||||
}
|
||||
|
||||
if (p_rectSrc.GetRight() > 640)
|
||||
if (p_rectSrc.GetRight() > 640) {
|
||||
p_rectSrc.SetRight(640);
|
||||
}
|
||||
|
||||
MxS32 height = p_rectDest.GetHeight();
|
||||
if (height <= 1)
|
||||
if (height <= 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
MxS32 width = p_rectDest.GetWidth();
|
||||
if (width <= 1)
|
||||
if (width <= 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (p_rectSrc.GetRight() - width - p_rectSrc.GetLeft() == -1 &&
|
||||
p_rectSrc.GetBottom() - height - p_rectSrc.GetTop() == -1)
|
||||
p_rectSrc.GetBottom() - height - p_rectSrc.GetTop() == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
p_rectSrc.SetRight(p_rectSrc.GetLeft() + width - 1);
|
||||
p_rectSrc.SetBottom(p_rectSrc.GetTop() + height - 1);
|
||||
@@ -325,7 +347,7 @@ void MxVideoPresenter::PutFrame()
|
||||
MxRegionCursor cursor(region);
|
||||
MxRect32* regionRect;
|
||||
|
||||
while (regionRect = cursor.VTable0x24(rect)) {
|
||||
while ((regionRect = cursor.VTable0x24(rect))) {
|
||||
if (regionRect->GetWidth() >= 1 && regionRect->GetHeight() >= 1) {
|
||||
if (m_unk0x58) {
|
||||
rectSrc.SetLeft(regionRect->GetLeft() - m_location.GetX());
|
||||
@@ -341,8 +363,9 @@ void MxVideoPresenter::PutFrame()
|
||||
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit4) {
|
||||
if (m_unk0x58) {
|
||||
if (PrepareRects(rectDest, rectSrc) >= 0)
|
||||
if (PrepareRects(rectDest, rectSrc) >= 0) {
|
||||
ddSurface->Blt((LPRECT) &rectDest, m_unk0x58, (LPRECT) &rectSrc, DDBLT_KEYSRC, NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
displaySurface->VTable0x30(
|
||||
@@ -358,8 +381,9 @@ void MxVideoPresenter::PutFrame()
|
||||
}
|
||||
}
|
||||
else if (m_unk0x58) {
|
||||
if (PrepareRects(rectDest, rectSrc) >= 0)
|
||||
if (PrepareRects(rectDest, rectSrc) >= 0) {
|
||||
ddSurface->Blt((LPRECT) &rectDest, m_unk0x58, (LPRECT) &rectSrc, 0, NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
displaySurface->VTable0x28(
|
||||
@@ -405,8 +429,9 @@ void MxVideoPresenter::StartingTickle()
|
||||
void MxVideoPresenter::StreamingTickle()
|
||||
{
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit10) {
|
||||
if (!m_currentChunk)
|
||||
if (!m_currentChunk) {
|
||||
MxMediaPresenter::StreamingTickle();
|
||||
}
|
||||
|
||||
if (m_currentChunk) {
|
||||
LoadFrame(m_currentChunk);
|
||||
@@ -418,24 +443,28 @@ void MxVideoPresenter::StreamingTickle()
|
||||
if (!m_currentChunk) {
|
||||
MxMediaPresenter::StreamingTickle();
|
||||
|
||||
if (!m_currentChunk)
|
||||
if (!m_currentChunk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_action->GetElapsedTime() < m_currentChunk->GetTime())
|
||||
if (m_action->GetElapsedTime() < m_currentChunk->GetTime()) {
|
||||
break;
|
||||
}
|
||||
|
||||
LoadFrame(m_currentChunk);
|
||||
m_subscriber->DestroyChunk(m_currentChunk);
|
||||
m_currentChunk = NULL;
|
||||
SetBit0(TRUE);
|
||||
|
||||
if (m_currentTickleState != e_streaming)
|
||||
if (m_currentTickleState != e_streaming) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetBit0())
|
||||
if (GetBit0()) {
|
||||
m_unk0x5c = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,8 +473,9 @@ void MxVideoPresenter::RepeatingTickle()
|
||||
{
|
||||
if (IsEnabled()) {
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit10) {
|
||||
if (!m_currentChunk)
|
||||
if (!m_currentChunk) {
|
||||
MxMediaPresenter::RepeatingTickle();
|
||||
}
|
||||
|
||||
if (m_currentChunk) {
|
||||
LoadFrame(m_currentChunk);
|
||||
@@ -457,23 +487,27 @@ void MxVideoPresenter::RepeatingTickle()
|
||||
if (!m_currentChunk) {
|
||||
MxMediaPresenter::RepeatingTickle();
|
||||
|
||||
if (!m_currentChunk)
|
||||
if (!m_currentChunk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_action->GetElapsedTime() % m_action->GetLoopCount() < m_currentChunk->GetTime())
|
||||
if (m_action->GetElapsedTime() % m_action->GetLoopCount() < m_currentChunk->GetTime()) {
|
||||
break;
|
||||
}
|
||||
|
||||
LoadFrame(m_currentChunk);
|
||||
m_currentChunk = NULL;
|
||||
SetBit0(TRUE);
|
||||
|
||||
if (m_currentTickleState != e_repeating)
|
||||
if (m_currentTickleState != e_repeating) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetBit0())
|
||||
if (GetBit0()) {
|
||||
m_unk0x5c = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -485,14 +519,17 @@ void MxVideoPresenter::Unk5Tickle()
|
||||
|
||||
if (sustainTime != -1) {
|
||||
if (sustainTime) {
|
||||
if (m_unk0x60 == -1)
|
||||
if (m_unk0x60 == -1) {
|
||||
m_unk0x60 = m_action->GetElapsedTime();
|
||||
}
|
||||
|
||||
if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime())
|
||||
if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) {
|
||||
ProgressTickleState(e_done);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
ProgressTickleState(e_done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,8 +571,9 @@ MxResult MxVideoPresenter::PutData()
|
||||
{
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5)
|
||||
if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5) {
|
||||
PutFrame();
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user