Mercurial > mm7
comparison Mouse.cpp @ 2223:17bc3a1eb037
LoadCursor fix
author | Ritor1 |
---|---|
date | Wed, 19 Feb 2014 13:01:36 +0600 |
parents | c69013c186c7 |
children | c4f87fb3cfee |
comparison
equal
deleted
inserted
replaced
2222:66bd74aa9f5e | 2223:17bc3a1eb037 |
---|---|
23 | 23 |
24 | 24 |
25 //----- (00469860) -------------------------------------------------------- | 25 //----- (00469860) -------------------------------------------------------- |
26 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY) | 26 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY) |
27 { | 27 { |
28 if ( !_stricmp(this->pCurrentCursorName, "MICON2") )//смещение для курсора-мишени | 28 *pX = uMouseClickX; |
29 { | 29 *pY = uMouseClickY; |
30 *pX = uMouseClickX + 14; | |
31 *pY = uMouseClickY + 14; | |
32 } | |
33 else | |
34 { | |
35 *pX = uMouseClickX; | |
36 *pY = uMouseClickY; | |
37 } | |
38 } | 30 } |
39 | 31 |
40 //----- (004698A6) -------------------------------------------------------- | 32 //----- (004698A6) -------------------------------------------------------- |
41 void Mouse::RemoveHoldingItem() | 33 void Mouse::RemoveHoldingItem() |
42 { | 34 { |
84 if (uCursorTextureID != -1) | 76 if (uCursorTextureID != -1) |
85 pIcons_LOD->pTextures[uCursorTextureID].Release(); | 77 pIcons_LOD->pTextures[uCursorTextureID].Release(); |
86 pIcons_LOD->SyncLoadedFilesCount(); | 78 pIcons_LOD->SyncLoadedFilesCount(); |
87 } | 79 } |
88 return; | 80 return; |
89 } | |
90 if ( !_strnicmp(pName, "MICON", 4) ) | |
91 { | |
92 this->uCursorTextureID = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); | |
93 this->uCursorTextureID_2 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); | |
94 if ( this->uCursorTextureID != pIcons_LOD->FindTextureByName("pending") ) | |
95 { | |
96 memset(&Dst, 0, sizeof(Dst)); | |
97 Texture texture = pIcons_LOD->pTextures[this->uCursorTextureID]; | |
98 Dst.dwSize = 124; | |
99 | |
100 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) | |
101 { | |
102 unsigned __int8 *v6 = pIcons_LOD->pTextures[this->uCursorTextureID].pLevelOfDetail0_prolly_alpha_mask; | |
103 void *surface = Dst.lpSurface; | |
104 __int32 v12 = 2 * (Dst.lPitch / 2 - texture.uTextureWidth); | |
105 | |
106 for ( uint y = 0; y < texture.uTextureHeight; y++ ) | |
107 { | |
108 for ( uint x = 0; x < texture.uTextureWidth; x++ ) | |
109 { | |
110 if ( texture.pPalette16[*v6] ) | |
111 *(_WORD *)surface = texture.pPalette16[*v6]; | |
112 surface = (char *)surface + 2; | |
113 ++v6; | |
114 } | |
115 surface = (char *)surface + v12; | |
116 } | |
117 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
118 } | |
119 } | |
120 } | 81 } |
121 this->bActive = false; | 82 this->bActive = false; |
122 this->field_C = 1; | 83 this->field_C = 1; |
123 window->SetCursor(pName); | 84 window->SetCursor(pName); |
124 } | 85 } |
336 pCursorBitmap3_sysmembits_16bit = 0; | 297 pCursorBitmap3_sysmembits_16bit = 0; |
337 } | 298 } |
338 } | 299 } |
339 | 300 |
340 //----- (00469E3B) -------------------------------------------------------- | 301 //----- (00469E3B) -------------------------------------------------------- |
341 void Mouse::DrawCursorToTarget()//??? | 302 void Mouse::DrawCursorToTarget()//??? DrawCursorWithItem |
342 { | 303 { |
343 if (!pCursorBitmap3_sysmembits_16bit) | 304 if (!pCursorBitmap3_sysmembits_16bit) |
344 return; | 305 return; |
345 //пишем на экран курсор с вещью | 306 //пишем на экран курсор с вещью |
346 ushort* pSrc = pCursorBitmap3_sysmembits_16bit; | 307 ushort* pSrc = pCursorBitmap3_sysmembits_16bit; |
825 default: | 786 default: |
826 break; | 787 break; |
827 } | 788 } |
828 } | 789 } |
829 } | 790 } |
830 | |
831 //-----(0046AE97)------------------------------------------------------------------ | |
832 /*char AsyncMouse::LoadCursor(const char *pContainer) | |
833 { | |
834 int v3; // eax@1 | |
835 HRESULT v4; // eax@1 | |
836 char result; // al@3 | |
837 HRESULT a2; // [sp+8h] [bp-B0h]@1 | |
838 int v7; // [sp+58h] [bp-60h]@1 | |
839 Texture texture; // [sp+6Ch] [bp-4Ch]@1 | |
840 char v9; // [sp+B4h] [bp-4h]@1 | |
841 | |
842 EnterCriticalSection(&pGame->pThreadWardInstance->cs2); | |
843 v3 = *((_DWORD *)this + 1); | |
844 a2 = 100; | |
845 v7 = 0; | |
846 v4 = (*(int (__stdcall **)(int, _DWORD, _DWORD, _DWORD, signed int, HRESULT *))(*(_DWORD *)v3 + 20))( | |
847 v3, | |
848 0, | |
849 0, | |
850 0, | |
851 1024, | |
852 &a2); | |
853 CheckHRESULT((CheckHRESULT_stru0 *)&v9, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp", 129, 0); | |
854 Texture::Texture(&texture); | |
855 if ( LODFile_IconsBitmaps::LoadTextureFromLOD(&texture, pContainer, TEXTURE_16BIT_PALETTE) != -1 | |
856 && AsyncMouse::DrawCursor(&texture, *((IDirectDrawSurface4 **)this + 1), 0) ) | |
857 { | |
858 Texture::Release(&thisa); | |
859 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2); | |
860 result = 1; | |
861 } | |
862 else | |
863 result = 0; | |
864 return result; | |
865 }*/ | |
866 | |
867 /*bool Mouse::Draw_MICON_Cursor(texture_id, IDirectDrawSurface4 *a2, int a3) | |
868 { | |
869 bool result; // eax@1 | |
870 unsigned __int16 *v5; // ebx@2 | |
871 unsigned __int8 *v6; // edx@2 | |
872 int v7; // esi@2 | |
873 int v8; // ecx@2 | |
874 LPVOID v9; // edi@2 | |
875 int v10; // ecx@5 | |
876 DDSURFACEDESC2 Dst; // [sp+0h] [bp-84h]@1 | |
877 __int32 v12; // [sp+7Ch] [bp-8h]@3 | |
878 int v13; // [sp+80h] [bp-4h]@3 | |
879 | |
880 Dst.dwSize = 124; | |
881 result = Render::LockSurface_DDraw4(&pRenderer, a2, &Dst, 1); | |
882 if ( result ) | |
883 { | |
884 //v5 = texture->pPalette16; | |
885 v6 = texture->pLevelOfDetail0_prolly_alpha_mask; | |
886 v7 = texture->uTextureWidth; | |
887 v8 = texture->uTextureHeight; | |
888 v9 = Dst.lpSurface; | |
889 if ( v8 > 0 ) | |
890 { | |
891 v12 = 2 * (Dst.lPitch / 2 - v7); | |
892 v13 = v8; | |
893 do | |
894 { | |
895 if ( v7 > 0 ) | |
896 { | |
897 v10 = v7; | |
898 do | |
899 { | |
900 if ( v5[*v6] ) | |
901 *(_WORD *)v9 = texture->pPalette16[*v6]; | |
902 v9 = (char *)v9 + 2; | |
903 ++v6; | |
904 --v10; | |
905 } | |
906 while ( v10 ); | |
907 } | |
908 v9 = (char *)v9 + v12; | |
909 --v13; | |
910 } | |
911 while ( v13 ); | |
912 } | |
913 result = ((int (__fastcall *)(IDirectDrawSurface4Vtbl *, unsigned __int8 *, IDirectDrawSurface4 *, int))a2->lpVtbl->Unlock)(a2->lpVtbl, v6, a2, a3); | |
914 } | |
915 LOBYTE(result) = 1; | |
916 return result; | |
917 }*/ | |
918 |