Mercurial > mm7
changeset 2223:17bc3a1eb037
LoadCursor fix
author | Ritor1 |
---|---|
date | Wed, 19 Feb 2014 13:01:36 +0600 |
parents | 66bd74aa9f5e |
children | 080fd5a5433d |
files | Mouse.cpp OSWindow.cpp VideoPlayer.cpp |
diffstat | 3 files changed, 16 insertions(+), 147 deletions(-) [+] |
line wrap: on
line diff
--- a/Mouse.cpp Tue Feb 18 19:43:54 2014 +0600 +++ b/Mouse.cpp Wed Feb 19 13:01:36 2014 +0600 @@ -25,16 +25,8 @@ //----- (00469860) -------------------------------------------------------- void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY) { - if ( !_stricmp(this->pCurrentCursorName, "MICON2") )//смещение для курсора-мишени - { - *pX = uMouseClickX + 14; - *pY = uMouseClickY + 14; - } - else - { - *pX = uMouseClickX; - *pY = uMouseClickY; - } + *pX = uMouseClickX; + *pY = uMouseClickY; } //----- (004698A6) -------------------------------------------------------- @@ -87,37 +79,6 @@ } return; } - if ( !_strnicmp(pName, "MICON", 4) ) - { - this->uCursorTextureID = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); - this->uCursorTextureID_2 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); - if ( this->uCursorTextureID != pIcons_LOD->FindTextureByName("pending") ) - { - memset(&Dst, 0, sizeof(Dst)); - Texture texture = pIcons_LOD->pTextures[this->uCursorTextureID]; - Dst.dwSize = 124; - - if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) - { - unsigned __int8 *v6 = pIcons_LOD->pTextures[this->uCursorTextureID].pLevelOfDetail0_prolly_alpha_mask; - void *surface = Dst.lpSurface; - __int32 v12 = 2 * (Dst.lPitch / 2 - texture.uTextureWidth); - - for ( uint y = 0; y < texture.uTextureHeight; y++ ) - { - for ( uint x = 0; x < texture.uTextureWidth; x++ ) - { - if ( texture.pPalette16[*v6] ) - *(_WORD *)surface = texture.pPalette16[*v6]; - surface = (char *)surface + 2; - ++v6; - } - surface = (char *)surface + v12; - } - ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); - } - } - } this->bActive = false; this->field_C = 1; window->SetCursor(pName); @@ -338,7 +299,7 @@ } //----- (00469E3B) -------------------------------------------------------- -void Mouse::DrawCursorToTarget()//??? +void Mouse::DrawCursorToTarget()//??? DrawCursorWithItem { if (!pCursorBitmap3_sysmembits_16bit) return; @@ -827,92 +788,3 @@ } } } - -//-----(0046AE97)------------------------------------------------------------------ -/*char AsyncMouse::LoadCursor(const char *pContainer) -{ - int v3; // eax@1 - HRESULT v4; // eax@1 - char result; // al@3 - HRESULT a2; // [sp+8h] [bp-B0h]@1 - int v7; // [sp+58h] [bp-60h]@1 - Texture texture; // [sp+6Ch] [bp-4Ch]@1 - char v9; // [sp+B4h] [bp-4h]@1 - - EnterCriticalSection(&pGame->pThreadWardInstance->cs2); - v3 = *((_DWORD *)this + 1); - a2 = 100; - v7 = 0; - v4 = (*(int (__stdcall **)(int, _DWORD, _DWORD, _DWORD, signed int, HRESULT *))(*(_DWORD *)v3 + 20))( - v3, - 0, - 0, - 0, - 1024, - &a2); - CheckHRESULT((CheckHRESULT_stru0 *)&v9, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp", 129, 0); - Texture::Texture(&texture); - if ( LODFile_IconsBitmaps::LoadTextureFromLOD(&texture, pContainer, TEXTURE_16BIT_PALETTE) != -1 - && AsyncMouse::DrawCursor(&texture, *((IDirectDrawSurface4 **)this + 1), 0) ) - { - Texture::Release(&thisa); - LeaveCriticalSection(&pGame->pThreadWardInstance->cs2); - result = 1; - } - else - result = 0; - return result; -}*/ - -/*bool Mouse::Draw_MICON_Cursor(texture_id, IDirectDrawSurface4 *a2, int a3) -{ - bool result; // eax@1 - unsigned __int16 *v5; // ebx@2 - unsigned __int8 *v6; // edx@2 - int v7; // esi@2 - int v8; // ecx@2 - LPVOID v9; // edi@2 - int v10; // ecx@5 - DDSURFACEDESC2 Dst; // [sp+0h] [bp-84h]@1 - __int32 v12; // [sp+7Ch] [bp-8h]@3 - int v13; // [sp+80h] [bp-4h]@3 - - Dst.dwSize = 124; - result = Render::LockSurface_DDraw4(&pRenderer, a2, &Dst, 1); - if ( result ) - { - //v5 = texture->pPalette16; - v6 = texture->pLevelOfDetail0_prolly_alpha_mask; - v7 = texture->uTextureWidth; - v8 = texture->uTextureHeight; - v9 = Dst.lpSurface; - if ( v8 > 0 ) - { - v12 = 2 * (Dst.lPitch / 2 - v7); - v13 = v8; - do - { - if ( v7 > 0 ) - { - v10 = v7; - do - { - if ( v5[*v6] ) - *(_WORD *)v9 = texture->pPalette16[*v6]; - v9 = (char *)v9 + 2; - ++v6; - --v10; - } - while ( v10 ); - } - v9 = (char *)v9 + v12; - --v13; - } - while ( v13 ); - } - result = ((int (__fastcall *)(IDirectDrawSurface4Vtbl *, unsigned __int8 *, IDirectDrawSurface4 *, int))a2->lpVtbl->Unlock)(a2->lpVtbl, v6, a2, a3); - } - LOBYTE(result) = 1; - return result; -}*/ -
--- a/OSWindow.cpp Tue Feb 18 19:43:54 2014 +0600 +++ b/OSWindow.cpp Wed Feb 19 13:01:36 2014 +0600 @@ -18,6 +18,7 @@ #include "Bink_Smacker.h" #include "ErrorHandling.h" #include "Log.h" +#include "LOD.h" bool OSWindow::OnMouseLeftClick(int x, int y) @@ -473,17 +474,21 @@ GetCursorPos(&cursor_pos); if (!strcmp(cursor_name, "MICON1") ) - { - SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), IDC_ARROW)); - //AsyncMouse::LoadCursor(cursor_name) - } + //SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), IDC_ARROW)); + SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(NULL, IDC_ARROW)); else if (!strcmp(cursor_name, "MICON2") ) { - SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), L"Target")); - //AsyncMouse::LoadCursor(cursor_name) + //HCURSOR hCurs1; // дескриптор курсора + + // Создаем курсор в виде мишени. + + //pMouse->uCursorTextureID = pIcons_LOD->LoadTexture(cursor_name, TEXTURE_16BIT_PALETTE);//есть альфа маска + //hCurs1 = LoadCursor(NULL, L"Target");//неверно, наверно нужно загрузить/создать курсор + SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(NULL, IDC_CROSS)); + } else if (!strcmp(cursor_name, "MICON3") ) - SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), IDC_WAIT)); + SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(NULL, IDC_WAIT)); //ClientToScreen(api_handle, &cursor_pos); //кидает курсор в другую часть экрана SetCursorPos(cursor_pos.x, cursor_pos.y);
--- a/VideoPlayer.cpp Tue Feb 18 19:43:54 2014 +0600 +++ b/VideoPlayer.cpp Wed Feb 19 13:01:36 2014 +0600 @@ -869,14 +869,9 @@ void VideoPlayer::UpdatePalette() { - //unsigned __int16 *v3; // ebx@1 - //unsigned int v4; // edi@1 - //unsigned int v5; // eax@1 - Log::Warning(L"smacker"); pRenderer->BeginScene(); - if (pMovie->Stopped())//видео завершено/перезагрузка { int width = game_viewport_width; @@ -889,14 +884,12 @@ } else { - char *image = pPlayer->DoFrame(); int image_array[460 * 344];//game_viewport_width * game_viewport_height - if (image) { memcpy(image_array, image, sizeof (image_array)); - for (unsigned int y = 8; y < 8 + game_viewport_height; ++y) + for (unsigned int y = 8; y < 8 + game_viewport_height; ++y)//координаты местоположения видеоролика { for (unsigned int x = 8; x < 8 + game_viewport_width; ++x) { @@ -907,7 +900,6 @@ delete[] image; } } - pRenderer->EndScene(); } /*