annotate Mouse.cpp @ 1029:c94d6a37d298

Pointing a face with mouse fixed.
author Nomad
date Tue, 21 May 2013 12:10:08 +0200
parents 9ac94d00012e
children 39f42990698f
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "OSAPI.h"
Ritor1
parents:
diff changeset
2
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 973
diff changeset
3 #include "VideoPlayer.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 973
diff changeset
4 #include "Vis.h"
0
Ritor1
parents:
diff changeset
5 #include "Mouse.h"
Ritor1
parents:
diff changeset
6 #include "Items.h"
Ritor1
parents:
diff changeset
7 #include "Party.h"
Ritor1
parents:
diff changeset
8 #include "LOD.h"
Ritor1
parents:
diff changeset
9 #include "Game.h"
Ritor1
parents:
diff changeset
10
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 973
diff changeset
11 #include "stru11.h"
0
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17 Mouse *pMouse;
Ritor1
parents:
diff changeset
18 AsyncMouse *pAsyncMouse;
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24 //----- (00469860) --------------------------------------------------------
Ritor1
parents:
diff changeset
25 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
Ritor1
parents:
diff changeset
26 {
Ritor1
parents:
diff changeset
27 unsigned int v3; // eax@2
Ritor1
parents:
diff changeset
28
Ritor1
parents:
diff changeset
29 if (pAsyncMouse)
Ritor1
parents:
diff changeset
30 {
Ritor1
parents:
diff changeset
31 *pX = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
32 v3 = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
33 }
Ritor1
parents:
diff changeset
34 else
Ritor1
parents:
diff changeset
35 {
Ritor1
parents:
diff changeset
36 *pX = this->uMouseClickX;
Ritor1
parents:
diff changeset
37 v3 = this->uMouseClickY;
Ritor1
parents:
diff changeset
38 }
Ritor1
parents:
diff changeset
39 *pY = v3;
Ritor1
parents:
diff changeset
40 }
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 //----- (004698A6) --------------------------------------------------------
Ritor1
parents:
diff changeset
43 void Mouse::RemoveHoldingItem()
Ritor1
parents:
diff changeset
44 {
Ritor1
parents:
diff changeset
45 pParty->pPickedItem.Reset();
Ritor1
parents:
diff changeset
46 if (strcmpi(pCurrentCursorName, "MICON2"))
Ritor1
parents:
diff changeset
47 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
48 }
Ritor1
parents:
diff changeset
49
Ritor1
parents:
diff changeset
50 //----- (004698D8) --------------------------------------------------------
Ritor1
parents:
diff changeset
51 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
Ritor1
parents:
diff changeset
52 {
Ritor1
parents:
diff changeset
53 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
Ritor1
parents:
diff changeset
54 }
Ritor1
parents:
diff changeset
55
Ritor1
parents:
diff changeset
56 //----- (004698F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
57 void Mouse::SetCurrentCursorBitmap()
Ritor1
parents:
diff changeset
58 {
Ritor1
parents:
diff changeset
59 SetCursorBitmap(pCurrentCursorName);
Ritor1
parents:
diff changeset
60 }
Ritor1
parents:
diff changeset
61
Ritor1
parents:
diff changeset
62 //----- (00469903) --------------------------------------------------------
Ritor1
parents:
diff changeset
63 void Mouse::SetCursorBitmap(const char *pName)
Ritor1
parents:
diff changeset
64 {
Ritor1
parents:
diff changeset
65 Mouse *v2; // esi@1
Ritor1
parents:
diff changeset
66 HCURSOR v3; // eax@10
Ritor1
parents:
diff changeset
67 int v4; // ecx@10
Ritor1
parents:
diff changeset
68 double v5; // st7@11
Ritor1
parents:
diff changeset
69 float v6; // ST04_4@12
Ritor1
parents:
diff changeset
70 LONG v7; // eax@14
Ritor1
parents:
diff changeset
71 LONG v8; // eax@17
Ritor1
parents:
diff changeset
72 unsigned int v9; // eax@21
Ritor1
parents:
diff changeset
73 float v10; // [sp+4h] [bp-18h]@11
Ritor1
parents:
diff changeset
74 struct tagPOINT Point; // [sp+14h] [bp-8h]@20
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76 v2 = this;
Ritor1
parents:
diff changeset
77 if ( !this->bInitialized || !pName )
Ritor1
parents:
diff changeset
78 return;
Ritor1
parents:
diff changeset
79 if ( _strcmpi("MICON2", pName) )
Ritor1
parents:
diff changeset
80 pGame->uFlags2 &= 0xFFFFFFEFu;
Ritor1
parents:
diff changeset
81 else
Ritor1
parents:
diff changeset
82 pGame->uFlags2 |= 0x10u;
Ritor1
parents:
diff changeset
83 if ( _strcmpi(v2->pCurrentCursorName, pName) )
Ritor1
parents:
diff changeset
84 strcpy(v2->pCurrentCursorName, pName);
Ritor1
parents:
diff changeset
85 ClearCursor();
Ritor1
parents:
diff changeset
86 if ( _strnicmp(pName, "MICON1", 5u) )
Ritor1
parents:
diff changeset
87 {
Ritor1
parents:
diff changeset
88 v9 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
89 v2->uCursorTextureID = v9;
Ritor1
parents:
diff changeset
90 v2->uCursorTextureID_2 = v9;
Ritor1
parents:
diff changeset
91 v2->AllocCursorSystemMem();
Ritor1
parents:
diff changeset
92 v2->field_C = 0;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
93 v2->bRedraw = 1;
0
Ritor1
parents:
diff changeset
94 v2->bActive = 1;
Ritor1
parents:
diff changeset
95 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 if (uCursorTextureID != -1)
Ritor1
parents:
diff changeset
98 pIcons_LOD->pTextures[uCursorTextureID].Release();
1006
e865f349aa41 ui cleanup
Gloval
parents: 973
diff changeset
99 pIcons_LOD->SyncLoadedFilesCount();
0
Ritor1
parents:
diff changeset
100 }
Ritor1
parents:
diff changeset
101 return;
Ritor1
parents:
diff changeset
102 }
Ritor1
parents:
diff changeset
103 v2->bActive = 0;
Ritor1
parents:
diff changeset
104 v2->field_C = 1;
Ritor1
parents:
diff changeset
105 if ( !strcmp(pName, "MICON1") )
Ritor1
parents:
diff changeset
106 {
Ritor1
parents:
diff changeset
107 v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow");
Ritor1
parents:
diff changeset
108 SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3);
Ritor1
parents:
diff changeset
109 v4 = (int)pAsyncMouse;
Ritor1
parents:
diff changeset
110 if (pAsyncMouse)
Ritor1
parents:
diff changeset
111 {
Ritor1
parents:
diff changeset
112 v10 = 0.0;
Ritor1
parents:
diff changeset
113 v5 = 0.0;
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
114 //LABEL_12:
0
Ritor1
parents:
diff changeset
115 v6 = v5;
Ritor1
parents:
diff changeset
116 pAsyncMouse->SetHotspot(v6, v10);
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
117 if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) )
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
118 {
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
119 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
120 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
121 }
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
122 return;
0
Ritor1
parents:
diff changeset
123 }
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
124 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
125 ClientToScreen(hWnd,&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
126 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
127 return;
0
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129 if ( !strcmp(pName, "MICON2") )
Ritor1
parents:
diff changeset
130 {
Ritor1
parents:
diff changeset
131 v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target");
Ritor1
parents:
diff changeset
132 SetClassLongA(hWnd, -12, v7);
Ritor1
parents:
diff changeset
133 v4 = (int)pAsyncMouse;
Ritor1
parents:
diff changeset
134 if (pAsyncMouse)
Ritor1
parents:
diff changeset
135 {
Ritor1
parents:
diff changeset
136 v10 = 14.0;
Ritor1
parents:
diff changeset
137 v5 = 14.0;
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
138 v6 = v5;
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
139 pAsyncMouse->SetHotspot(v6, v10);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
140 if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) )
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
141 {
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
142 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
143 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
144 }
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
145 return;
0
Ritor1
parents:
diff changeset
146 }
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
147 //LABEL_20:
0
Ritor1
parents:
diff changeset
148 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
149 SetCursorPos(Point.x, Point.y);
Ritor1
parents:
diff changeset
150 return;
Ritor1
parents:
diff changeset
151 }
Ritor1
parents:
diff changeset
152 if ( !strcmp(pName, "MICON3") )
Ritor1
parents:
diff changeset
153 {
Ritor1
parents:
diff changeset
154 v8 = (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT);
Ritor1
parents:
diff changeset
155 SetClassLongA(hWnd, -12, v8);
Ritor1
parents:
diff changeset
156 }
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
157 //LABEL_18:
0
Ritor1
parents:
diff changeset
158 if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) )
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
159 {
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
160 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
161 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
162 }
0
Ritor1
parents:
diff changeset
163 }
Ritor1
parents:
diff changeset
164 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
165
Ritor1
parents:
diff changeset
166 //----- (00469AE4) --------------------------------------------------------
Ritor1
parents:
diff changeset
167 LONG Mouse::_469AE4()
Ritor1
parents:
diff changeset
168 {
Ritor1
parents:
diff changeset
169 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
170 LONG v2; // ecx@2
Ritor1
parents:
diff changeset
171 LONG result; // eax@2
Ritor1
parents:
diff changeset
172 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
173
Ritor1
parents:
diff changeset
174 v1 = this;
Ritor1
parents:
diff changeset
175 this->field_8 = 1;
Ritor1
parents:
diff changeset
176 if (pAsyncMouse)
Ritor1
parents:
diff changeset
177 {
Ritor1
parents:
diff changeset
178 v2 = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
179 Point.x = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
180 result = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
181 }
Ritor1
parents:
diff changeset
182 else
Ritor1
parents:
diff changeset
183 {
Ritor1
parents:
diff changeset
184 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
185 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
186 ScreenToClient(hWnd, &Point);
Ritor1
parents:
diff changeset
187 result = Point.y;
Ritor1
parents:
diff changeset
188 v2 = Point.x;
Ritor1
parents:
diff changeset
189 }
Ritor1
parents:
diff changeset
190 v1->uMouseClickX = v2;
Ritor1
parents:
diff changeset
191 v1->uMouseClickY = result;
Ritor1
parents:
diff changeset
192 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
193 goto LABEL_16;
Ritor1
parents:
diff changeset
194 if (pAsyncMouse)
Ritor1
parents:
diff changeset
195 goto LABEL_24;
Ritor1
parents:
diff changeset
196 if ( v2 < 0 )
Ritor1
parents:
diff changeset
197 v2 = 0;
Ritor1
parents:
diff changeset
198 if ( result < 0 )
Ritor1
parents:
diff changeset
199 result = 0;
Ritor1
parents:
diff changeset
200 if ( v2 > 639 )
Ritor1
parents:
diff changeset
201 v2 = 639;
Ritor1
parents:
diff changeset
202 if ( result > 479 )
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 result = 479;
Ritor1
parents:
diff changeset
205 LABEL_16:
Ritor1
parents:
diff changeset
206 if (pAsyncMouse)
Ritor1
parents:
diff changeset
207 goto LABEL_24;
Ritor1
parents:
diff changeset
208 if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) )
Ritor1
parents:
diff changeset
209 goto LABEL_23;
Ritor1
parents:
diff changeset
210 }
Ritor1
parents:
diff changeset
211 if ( v1->field_C )
Ritor1
parents:
diff changeset
212 LABEL_23:
Ritor1
parents:
diff changeset
213 v1->bActive = 0;
Ritor1
parents:
diff changeset
214 LABEL_24:
Ritor1
parents:
diff changeset
215 v1->field_8 = 0;
Ritor1
parents:
diff changeset
216 return result;
Ritor1
parents:
diff changeset
217 }
Ritor1
parents:
diff changeset
218
Ritor1
parents:
diff changeset
219 //----- (00469BA3) --------------------------------------------------------
Ritor1
parents:
diff changeset
220 void Mouse::ClearCursor()
Ritor1
parents:
diff changeset
221 {
Ritor1
parents:
diff changeset
222 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
223 void *v2; // eax@1
Ritor1
parents:
diff changeset
224 void **v3; // esi@5
Ritor1
parents:
diff changeset
225
Ritor1
parents:
diff changeset
226 v1 = this;
Ritor1
parents:
diff changeset
227 v2 = this->pCursorBitmap_sysmem;
Ritor1
parents:
diff changeset
228 this->bActive = 0;
Ritor1
parents:
diff changeset
229 if ( v2 )
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 free(v2);
Ritor1
parents:
diff changeset
232 v1->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
233 }
Ritor1
parents:
diff changeset
234 if ( v1->pCursorBitmap2_sysmem )
Ritor1
parents:
diff changeset
235 {
Ritor1
parents:
diff changeset
236 free(v1->pCursorBitmap2_sysmem);
Ritor1
parents:
diff changeset
237 v1->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
238 }
Ritor1
parents:
diff changeset
239 v3 = &v1->ptr_90;
Ritor1
parents:
diff changeset
240 if ( *v3 )
Ritor1
parents:
diff changeset
241 free(*v3);
Ritor1
parents:
diff changeset
242 *v3 = 0;
Ritor1
parents:
diff changeset
243 }
Ritor1
parents:
diff changeset
244
Ritor1
parents:
diff changeset
245 //----- (00469BE6) --------------------------------------------------------
Ritor1
parents:
diff changeset
246 void Mouse::AllocCursorSystemMem()
Ritor1
parents:
diff changeset
247 {
Ritor1
parents:
diff changeset
248 bActive = 0;
Ritor1
parents:
diff changeset
249 if (!pCursorBitmap_sysmem)
Ritor1
parents:
diff changeset
250 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
251 if (!pCursorBitmap2_sysmem)
Ritor1
parents:
diff changeset
252 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
253 }
Ritor1
parents:
diff changeset
254
Ritor1
parents:
diff changeset
255 //----- (00469C0D) --------------------------------------------------------
Ritor1
parents:
diff changeset
256 void *Mouse::DoAllocCursorMem()
Ritor1
parents:
diff changeset
257 {
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
258 auto tex = pIcons_LOD->GetTexture(uCursorTextureID);
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
259 return malloc(4 * tex->uTextureWidth * tex->uTextureHeight);
0
Ritor1
parents:
diff changeset
260 }
Ritor1
parents:
diff changeset
261
Ritor1
parents:
diff changeset
262 //----- (00469C39) --------------------------------------------------------
Ritor1
parents:
diff changeset
263 POINT *Mouse::GetCursorPos(POINT *a2)
Ritor1
parents:
diff changeset
264 {
Ritor1
parents:
diff changeset
265 void *v2; // edx@1
Ritor1
parents:
diff changeset
266 POINT *result; // eax@1
Ritor1
parents:
diff changeset
267 unsigned int v4; // ecx@2
Ritor1
parents:
diff changeset
268 unsigned int v5; // edx@3
Ritor1
parents:
diff changeset
269
Ritor1
parents:
diff changeset
270 v2 = pAsyncMouse;
Ritor1
parents:
diff changeset
271 result = a2;
Ritor1
parents:
diff changeset
272 if (pAsyncMouse)
Ritor1
parents:
diff changeset
273 {
Ritor1
parents:
diff changeset
274 a2->x = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
275 v4 = *((int *)v2 + 7);
Ritor1
parents:
diff changeset
276 }
Ritor1
parents:
diff changeset
277 else
Ritor1
parents:
diff changeset
278 {
Ritor1
parents:
diff changeset
279 v5 = this->uMouseClickX;
Ritor1
parents:
diff changeset
280 v4 = this->uMouseClickY;
Ritor1
parents:
diff changeset
281 a2->x = v5;
Ritor1
parents:
diff changeset
282 }
Ritor1
parents:
diff changeset
283 a2->y = v4;
Ritor1
parents:
diff changeset
284 return result;
Ritor1
parents:
diff changeset
285 }
Ritor1
parents:
diff changeset
286
Ritor1
parents:
diff changeset
287 //----- (00469C65) --------------------------------------------------------
Ritor1
parents:
diff changeset
288 void Mouse::Initialize(HWND hWnd)
Ritor1
parents:
diff changeset
289 {
Ritor1
parents:
diff changeset
290 this->hWnd = hWnd;
Ritor1
parents:
diff changeset
291 this->bActive = 0;
Ritor1
parents:
diff changeset
292 this->bInitialized = 1;
Ritor1
parents:
diff changeset
293 this->pCursorBitmapPos.x = 0;
Ritor1
parents:
diff changeset
294 this->pCursorBitmapPos.y = 0;
Ritor1
parents:
diff changeset
295 this->uMouseClickX = 0;
Ritor1
parents:
diff changeset
296 this->uMouseClickY = 0;
Ritor1
parents:
diff changeset
297 this->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
298 this->field_34 = 0;
Ritor1
parents:
diff changeset
299 this->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
300
Ritor1
parents:
diff changeset
301 SetCursorBitmap("MICON3");
Ritor1
parents:
diff changeset
302 SetCursorBitmap("MICON2");
Ritor1
parents:
diff changeset
303 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
306 // inlined
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
307 //----- (0045FE00) mm6 chinese --------------------------------------------
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
308 void Mouse::SetActive(bool active)
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
309 {
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
310 bActive = active;
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
311 }
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
312
0
Ritor1
parents:
diff changeset
313 //----- (00469CC2) --------------------------------------------------------
Ritor1
parents:
diff changeset
314 void Mouse::Deactivate()
Ritor1
parents:
diff changeset
315 {
Ritor1
parents:
diff changeset
316 if (bInitialized)
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
317 SetActive(false);
0
Ritor1
parents:
diff changeset
318 }
Ritor1
parents:
diff changeset
319
Ritor1
parents:
diff changeset
320 //----- (00469CCD) --------------------------------------------------------
Ritor1
parents:
diff changeset
321 void Mouse::DrawCursor()
Ritor1
parents:
diff changeset
322 {
Ritor1
parents:
diff changeset
323 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
324 char v11; // zf@6
Ritor1
parents:
diff changeset
325 signed int v3; // eax@6
Ritor1
parents:
diff changeset
326 signed int v4; // ecx@6
Ritor1
parents:
diff changeset
327 Vec4_int_ *v5; // edx@21
Ritor1
parents:
diff changeset
328 int v6; // edi@21
Ritor1
parents:
diff changeset
329 int v7; // ebx@21
Ritor1
parents:
diff changeset
330 int v8; // eax@29
Ritor1
parents:
diff changeset
331 unsigned int v9; // eax@31
Ritor1
parents:
diff changeset
332
Ritor1
parents:
diff changeset
333 v1 = this;
Ritor1
parents:
diff changeset
334 if ( this->bInitialized )
Ritor1
parents:
diff changeset
335 {
Ritor1
parents:
diff changeset
336 if ( !this->field_8 && this->bActive && !this->field_C )
Ritor1
parents:
diff changeset
337 pMouse->_469AE4();
Ritor1
parents:
diff changeset
338 v11 = v1->field_C == 0;
Ritor1
parents:
diff changeset
339 v3 = v1->uMouseClickX;
Ritor1
parents:
diff changeset
340 v4 = v1->uMouseClickY;
Ritor1
parents:
diff changeset
341 v1->field_F4 = 1;
Ritor1
parents:
diff changeset
342 if ( !v11 )
Ritor1
parents:
diff changeset
343 goto LABEL_12;
Ritor1
parents:
diff changeset
344 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
345 {
Ritor1
parents:
diff changeset
346 if ( v3 < 0 || v4 < 0 || v3 > 639 || v4 > 479 )
Ritor1
parents:
diff changeset
347 {
Ritor1
parents:
diff changeset
348 LABEL_12:
Ritor1
parents:
diff changeset
349 v1->field_F4 = 0;
Ritor1
parents:
diff changeset
350 return;
Ritor1
parents:
diff changeset
351 }
Ritor1
parents:
diff changeset
352 }
Ritor1
parents:
diff changeset
353 else
Ritor1
parents:
diff changeset
354 {
Ritor1
parents:
diff changeset
355 if ( v3 < 0 )
Ritor1
parents:
diff changeset
356 v3 = 0;
Ritor1
parents:
diff changeset
357 if ( v4 < 0 )
Ritor1
parents:
diff changeset
358 v4 = 0;
Ritor1
parents:
diff changeset
359 if ( v3 > 639 )
Ritor1
parents:
diff changeset
360 v3 = 639;
Ritor1
parents:
diff changeset
361 if ( v4 > 479 )
Ritor1
parents:
diff changeset
362 v4 = 479;
Ritor1
parents:
diff changeset
363 }
Ritor1
parents:
diff changeset
364 v5 = &v1->pCursorBitmapRect;
Ritor1
parents:
diff changeset
365 v6 = v3 + v1->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
366 v7 = v4 + v1->field_5C[0];
Ritor1
parents:
diff changeset
367 v1->pCursorBitmapRect.y = v4;
Ritor1
parents:
diff changeset
368 v1->pCursorBitmapRect.x = v3;
Ritor1
parents:
diff changeset
369 v1->pCursorBitmapRect.z = v6;
Ritor1
parents:
diff changeset
370 v1->pCursorBitmapRect.w = v7;
Ritor1
parents:
diff changeset
371 if ( v3 < 0 )
Ritor1
parents:
diff changeset
372 v5->x = 0;
Ritor1
parents:
diff changeset
373 if ( v4 < 0 )
Ritor1
parents:
diff changeset
374 v1->pCursorBitmapRect.y = 0;
Ritor1
parents:
diff changeset
375 if ( v6 > 640 )
Ritor1
parents:
diff changeset
376 v1->pCursorBitmapRect.z = 640;
Ritor1
parents:
diff changeset
377 if ( v7 > 480 )
Ritor1
parents:
diff changeset
378 v1->pCursorBitmapRect.w = 480;
Ritor1
parents:
diff changeset
379 v8 = v1->pCursorBitmapRect.z;
Ritor1
parents:
diff changeset
380 v1->bActive = 0;
Ritor1
parents:
diff changeset
381 v1->uCursorBitmapWidth = v8 - v5->x;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
382 v11 = v1->bRedraw == 0;
0
Ritor1
parents:
diff changeset
383 v1->uCursorBitmapHeight = v1->pCursorBitmapRect.w - v1->pCursorBitmapRect.y;
Ritor1
parents:
diff changeset
384 if ( !v11 )
Ritor1
parents:
diff changeset
385 {
Ritor1
parents:
diff changeset
386 if ( pMouse->ptr_90 )
Ritor1
parents:
diff changeset
387 v9 = 2 * pMouse->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
388 else
Ritor1
parents:
diff changeset
389 v9 = 0;
Ritor1
parents:
diff changeset
390 pRenderer->_4A6DF5(
Ritor1
parents:
diff changeset
391 v1->pCursorBitmap_sysmem,
Ritor1
parents:
diff changeset
392 v9,
Ritor1
parents:
diff changeset
393 &v1->pCursorBitmapPos,
Ritor1
parents:
diff changeset
394 pRenderer->pTargetSurface,
Ritor1
parents:
diff changeset
395 pRenderer->uTargetSurfacePitch,
Ritor1
parents:
diff changeset
396 &v1->pCursorBitmapRect);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
397 v1->bRedraw = false;
0
Ritor1
parents:
diff changeset
398 }
Ritor1
parents:
diff changeset
399 }
Ritor1
parents:
diff changeset
400 }
Ritor1
parents:
diff changeset
401
Ritor1
parents:
diff changeset
402 //----- (00469E1C) --------------------------------------------------------
Ritor1
parents:
diff changeset
403 void Mouse::_469E1C()
Ritor1
parents:
diff changeset
404 {
Ritor1
parents:
diff changeset
405 bActive = true;
Ritor1
parents:
diff changeset
406 }
Ritor1
parents:
diff changeset
407
Ritor1
parents:
diff changeset
408 //----- (00469E24) --------------------------------------------------------
Ritor1
parents:
diff changeset
409 void Mouse::_469E24()
Ritor1
parents:
diff changeset
410 {
Ritor1
parents:
diff changeset
411 if (pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
412 {
Ritor1
parents:
diff changeset
413 free(pCursorBitmap3_sysmembits_16bit);
Ritor1
parents:
diff changeset
414 pCursorBitmap3_sysmembits_16bit = 0;
Ritor1
parents:
diff changeset
415 }
Ritor1
parents:
diff changeset
416 }
Ritor1
parents:
diff changeset
417
Ritor1
parents:
diff changeset
418 //----- (00469E3B) --------------------------------------------------------
Ritor1
parents:
diff changeset
419 void Mouse::DrawCursorToTarget()
Ritor1
parents:
diff changeset
420 {
Ritor1
parents:
diff changeset
421 if (!pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
422 return;
Ritor1
parents:
diff changeset
423
Ritor1
parents:
diff changeset
424 auto pSrc = pCursorBitmap3_sysmembits_16bit;
Ritor1
parents:
diff changeset
425 for (uint y = field_44; y < field_4C; ++y)
Ritor1
parents:
diff changeset
426 for (uint x = field_40; x < field_48; ++x)
Ritor1
parents:
diff changeset
427 pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
Ritor1
parents:
diff changeset
428 }
Ritor1
parents:
diff changeset
429
Ritor1
parents:
diff changeset
430 //----- (00469EA4) --------------------------------------------------------
Ritor1
parents:
diff changeset
431 void Mouse::_469EA4()
Ritor1
parents:
diff changeset
432 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
433 //Mouse *v1; // esi@1
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
434 unsigned int pTextureID; // eax@2
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
435 Texture *pTexture; // edi@2
0
Ritor1
parents:
diff changeset
436 unsigned int v4; // ecx@3
Ritor1
parents:
diff changeset
437 unsigned int v5; // eax@3
Ritor1
parents:
diff changeset
438 unsigned int v6; // ebx@5
Ritor1
parents:
diff changeset
439 int v7; // ecx@15
Ritor1
parents:
diff changeset
440 int v8; // ecx@25
Ritor1
parents:
diff changeset
441 int v9; // ebx@26
Ritor1
parents:
diff changeset
442 unsigned int v10; // eax@26
Ritor1
parents:
diff changeset
443 int v11; // edx@27
Ritor1
parents:
diff changeset
444 unsigned __int16 *v12; // edx@29
Ritor1
parents:
diff changeset
445 unsigned __int16 *v13; // ebx@29
Ritor1
parents:
diff changeset
446 unsigned int a2; // [sp+Ch] [bp-1Ch]@5
Ritor1
parents:
diff changeset
447 unsigned int v15; // [sp+10h] [bp-18h]@5
Ritor1
parents:
diff changeset
448 unsigned int v16; // [sp+14h] [bp-14h]@25
Ritor1
parents:
diff changeset
449 unsigned __int16 *v17; // [sp+18h] [bp-10h]@25
Ritor1
parents:
diff changeset
450 int v18; // [sp+1Ch] [bp-Ch]@27
Ritor1
parents:
diff changeset
451 int v19; // [sp+20h] [bp-8h]@15
Ritor1
parents:
diff changeset
452 unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
453 int pTextureWidth; // [sp+24h] [bp-4h]@12
0
Ritor1
parents:
diff changeset
454 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
Ritor1
parents:
diff changeset
455
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
456 //v1 = this;
0
Ritor1
parents:
diff changeset
457 if ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
458 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
459 pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
460 pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0);
0
Ritor1
parents:
diff changeset
461 if (pAsyncMouse)
Ritor1
parents:
diff changeset
462 {
Ritor1
parents:
diff changeset
463 v4 = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
464 v5 = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
465 }
Ritor1
parents:
diff changeset
466 else
Ritor1
parents:
diff changeset
467 {
Ritor1
parents:
diff changeset
468 v4 = pMouse->uMouseClickX;
Ritor1
parents:
diff changeset
469 v5 = pMouse->uMouseClickY;
Ritor1
parents:
diff changeset
470 }
Ritor1
parents:
diff changeset
471 v6 = v5;
Ritor1
parents:
diff changeset
472 a2 = v4;
Ritor1
parents:
diff changeset
473 v15 = v5;
Ritor1
parents:
diff changeset
474 if ( (signed int)v4 <= 639 && (signed int)v5 <= 479 )
Ritor1
parents:
diff changeset
475 {
Ritor1
parents:
diff changeset
476 if ( (v4 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
477 a2 = 0;
Ritor1
parents:
diff changeset
478 if ( (v5 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
479 {
Ritor1
parents:
diff changeset
480 v6 = 0;
Ritor1
parents:
diff changeset
481 v15 = 0;
Ritor1
parents:
diff changeset
482 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
483 if ( (signed int)(pTexture->uTextureWidth + a2) <= 640 )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
484 pTextureWidth = pTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
485 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
486 pTextureWidth = 640 - a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
487 if ( (signed int)(pTexture->uTextureHeight + v6) <= 480 )
0
Ritor1
parents:
diff changeset
488 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
489 v19 = pTexture->uTextureHeight;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
490 v7 = pTexture->uTextureHeight;
0
Ritor1
parents:
diff changeset
491 }
Ritor1
parents:
diff changeset
492 else
Ritor1
parents:
diff changeset
493 {
Ritor1
parents:
diff changeset
494 v7 = 480 - v6;
Ritor1
parents:
diff changeset
495 v19 = 480 - v6;
Ritor1
parents:
diff changeset
496 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
497 if ( !this->pCursorBitmap3_sysmembits_16bit
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
498 || a2 != this->field_40
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
499 || v6 != this->field_44
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
500 || a2 + pTextureWidth != this->field_48
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
501 || v6 + v7 != this->field_4C )
0
Ritor1
parents:
diff changeset
502 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
503 if ( this->pCursorBitmap3_sysmembits_16bit )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
504 free(this->pCursorBitmap3_sysmembits_16bit);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
505 this->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)operator new(2 * pTexture->uTextureHeight * pTexture->uTextureWidth);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
506 this->field_40 = a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
507 this->field_48 = a2 + pTextureWidth;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
508 this->field_44 = v6;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
509 this->field_4C = v6 + v19;
0
Ritor1
parents:
diff changeset
510 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
511 v8 = this->field_44;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
512 v22 = this->pCursorBitmap3_sysmembits_16bit;
0
Ritor1
parents:
diff changeset
513 v17 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
514 v16 = pRenderer->uTargetSurfacePitch;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
515 if ( v8 < this->field_4C )
0
Ritor1
parents:
diff changeset
516 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
517 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
518 v10 = pRenderer->uTargetSurfacePitch * v8;
Ritor1
parents:
diff changeset
519 do
Ritor1
parents:
diff changeset
520 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
521 v11 = this->field_40;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
522 v18 = this->field_40;
0
Ritor1
parents:
diff changeset
523 if ( v11 < v9 )
Ritor1
parents:
diff changeset
524 {
Ritor1
parents:
diff changeset
525 v20 = &v17[v10 + v11];
Ritor1
parents:
diff changeset
526 do
Ritor1
parents:
diff changeset
527 {
Ritor1
parents:
diff changeset
528 v12 = v20;
Ritor1
parents:
diff changeset
529 v13 = v22;
Ritor1
parents:
diff changeset
530 ++v18;
Ritor1
parents:
diff changeset
531 ++v20;
Ritor1
parents:
diff changeset
532 ++v22;
Ritor1
parents:
diff changeset
533 *v13 = *v12;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
534 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
535 }
Ritor1
parents:
diff changeset
536 while ( v18 < v9 );
Ritor1
parents:
diff changeset
537 }
Ritor1
parents:
diff changeset
538 v10 += v16;
Ritor1
parents:
diff changeset
539 ++v8;
Ritor1
parents:
diff changeset
540 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
541 while ( v8 < this->field_4C );
0
Ritor1
parents:
diff changeset
542 v6 = v15;
Ritor1
parents:
diff changeset
543 }
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
544 if (pParty->pPickedItem.Broken())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
545 pRenderer->DrawTransparentRedShade(a2, v6, pTexture);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
546 else if (!pParty->pPickedItem.Identified())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
547 pRenderer->DrawTransparentGreenShade(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
548 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
549 pRenderer->DrawTextureTransparent(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
550 }
Ritor1
parents:
diff changeset
551 }
Ritor1
parents:
diff changeset
552 else
Ritor1
parents:
diff changeset
553 {
Ritor1
parents:
diff changeset
554 if ( this->pCursorBitmap3_sysmembits_16bit )
Ritor1
parents:
diff changeset
555 {
Ritor1
parents:
diff changeset
556 free(this->pCursorBitmap3_sysmembits_16bit);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
557 this->pCursorBitmap3_sysmembits_16bit = 0;
0
Ritor1
parents:
diff changeset
558 }
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560 }
Ritor1
parents:
diff changeset
561
Ritor1
parents:
diff changeset
562 //----- (0046A080) --------------------------------------------------------
Ritor1
parents:
diff changeset
563 void Mouse::Activate(int bActive)
Ritor1
parents:
diff changeset
564 {
Ritor1
parents:
diff changeset
565 bActive = bActive;
Ritor1
parents:
diff changeset
566 }
Ritor1
parents:
diff changeset
567
Ritor1
parents:
diff changeset
568 //----- (0046A08A) --------------------------------------------------------
Ritor1
parents:
diff changeset
569 void Mouse::SetMouseClick(int x, int y)
Ritor1
parents:
diff changeset
570 {
Ritor1
parents:
diff changeset
571 uMouseClickX = x;
Ritor1
parents:
diff changeset
572 uMouseClickY = y;
Ritor1
parents:
diff changeset
573 }
Ritor1
parents:
diff changeset
574
Ritor1
parents:
diff changeset
575
Ritor1
parents:
diff changeset
576 //----- (00409E3D) --------------------------------------------------------
Ritor1
parents:
diff changeset
577 void AsyncMouse::_409E3D(char a2)
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 if ( *((unsigned char *)this + 128) & 1 )
Ritor1
parents:
diff changeset
580 *((unsigned char *)this + 103) = 1;
Ritor1
parents:
diff changeset
581 else
Ritor1
parents:
diff changeset
582 *((unsigned char *)this + 103) = 0;
Ritor1
parents:
diff changeset
583 if ( a2 )
Ritor1
parents:
diff changeset
584 *((unsigned int *)this + 32) |= 1u;
Ritor1
parents:
diff changeset
585 else
Ritor1
parents:
diff changeset
586 *((unsigned int *)this + 32) &= 0xFFFFFFFEu;
Ritor1
parents:
diff changeset
587 }
Ritor1
parents:
diff changeset
588
Ritor1
parents:
diff changeset
589 //----- (00465C2C) --------------------------------------------------------
Ritor1
parents:
diff changeset
590 void AsyncMouse::Release()
Ritor1
parents:
diff changeset
591 {
Ritor1
parents:
diff changeset
592 if (pAsyncMouse)
Ritor1
parents:
diff changeset
593 {
Ritor1
parents:
diff changeset
594 pAsyncMouse->Suspend();
Ritor1
parents:
diff changeset
595 if (pAsyncMouse)
Ritor1
parents:
diff changeset
596 (**(void (__stdcall ***)(int))pAsyncMouse)(1);
Ritor1
parents:
diff changeset
597 }
Ritor1
parents:
diff changeset
598 pAsyncMouse = 0;
Ritor1
parents:
diff changeset
599 }
Ritor1
parents:
diff changeset
600
Ritor1
parents:
diff changeset
601
Ritor1
parents:
diff changeset
602
Ritor1
parents:
diff changeset
603
Ritor1
parents:
diff changeset
604 //----- (0046ACA9) --------------------------------------------------------
Ritor1
parents:
diff changeset
605 AsyncMouse::AsyncMouse(IDirectDrawSurface *a2)
Ritor1
parents:
diff changeset
606 {
Ritor1
parents:
diff changeset
607 IDirectDrawSurface *v2; // eax@1
Ritor1
parents:
diff changeset
608 void *v3; // esi@1
Ritor1
parents:
diff changeset
609 char *v4; // edi@1
Ritor1
parents:
diff changeset
610 double v5; // ST14_8@3
Ritor1
parents:
diff changeset
611 double v6; // ST14_8@3
Ritor1
parents:
diff changeset
612
Ritor1
parents:
diff changeset
613 v2 = a2;
Ritor1
parents:
diff changeset
614 v3 = this;
Ritor1
parents:
diff changeset
615 *((int *)this + 16) = -1;
Ritor1
parents:
diff changeset
616 *((int *)this + 3) = (int)v2;
Ritor1
parents:
diff changeset
617 LOBYTE(v2) = BYTE3(a2);
Ritor1
parents:
diff changeset
618 v4 = (char *)this + 104;
Ritor1
parents:
diff changeset
619 *((int *)this + 1) = 0;
Ritor1
parents:
diff changeset
620 *((char *)this + 20) = 0;
Ritor1
parents:
diff changeset
621 *((int *)this + 17) = 0;
Ritor1
parents:
diff changeset
622 *((int *)this + 18) = 0;
Ritor1
parents:
diff changeset
623 *((char *)this + 88) = 1;
Ritor1
parents:
diff changeset
624 *((char *)this + 91) = 0;
Ritor1
parents:
diff changeset
625 *((char *)this + 93) = 0;
Ritor1
parents:
diff changeset
626 *((char *)this + 94) = 0;
Ritor1
parents:
diff changeset
627 *((char *)this + 95) = 0;
Ritor1
parents:
diff changeset
628 *((char *)this + 96) = 0;
Ritor1
parents:
diff changeset
629 *((char *)this + 97) = 0;
Ritor1
parents:
diff changeset
630 *((char *)this + 98) = 0;
Ritor1
parents:
diff changeset
631 *((char *)this + 99) = 0;
Ritor1
parents:
diff changeset
632 *((char *)this + 100) = 0;
Ritor1
parents:
diff changeset
633 *((char *)this + 101) = 0;
Ritor1
parents:
diff changeset
634 *((char *)this + 102) = 0;
Ritor1
parents:
diff changeset
635 *((char *)this + 104) = (char)v2;
Ritor1
parents:
diff changeset
636 *((int *)this + 27) = (int)AsyncMouse::unk_46BD09(0, 0);
Ritor1
parents:
diff changeset
637 *((int *)v4 + 2) = 0;
Ritor1
parents:
diff changeset
638 *((char *)v3 + 116) = BYTE3(a2);
Ritor1
parents:
diff changeset
639 *((int *)v3 + 30) = (int)AsyncMouse::unk_46BD09(0, 0);
Ritor1
parents:
diff changeset
640 *((int *)v3 + 31) = 0;
Ritor1
parents:
diff changeset
641 *((int *)v3 + 32) = 0;
Ritor1
parents:
diff changeset
642 *((int *)v3 + 33) = 0;
Ritor1
parents:
diff changeset
643 *(int *)v3 = 5080880;
Ritor1
parents:
diff changeset
644 if ( !Initialize(this) )
Ritor1
parents:
diff changeset
645 {
Ritor1
parents:
diff changeset
646 MessageBoxW(nullptr, L"Could not initialize CMouseAsync object", nullptr, 0);
Ritor1
parents:
diff changeset
647 }
Ritor1
parents:
diff changeset
648 *((int *)v3 + 12) = 0;
Ritor1
parents:
diff changeset
649 *((int *)v3 + 13) = 0;
Ritor1
parents:
diff changeset
650 *((int *)v3 + 14) = 0;
Ritor1
parents:
diff changeset
651 *((int *)v3 + 15) = 0;
Ritor1
parents:
diff changeset
652 v5 = (float)0.0 + 6.7553994e15;
Ritor1
parents:
diff changeset
653 *((int *)v3 + 10) = LODWORD(v5);
Ritor1
parents:
diff changeset
654 v6 = (float)0.0 + 6.7553994e15;
Ritor1
parents:
diff changeset
655 a2 = (IDirectDrawSurface *)LODWORD(v6);
Ritor1
parents:
diff changeset
656 *((int *)v3 + 32) |= 1u;
Ritor1
parents:
diff changeset
657 *((int *)v3 + 11) = LODWORD(v6);
Ritor1
parents:
diff changeset
658 *((char *)v3 + 103) = 1;
Ritor1
parents:
diff changeset
659 }
Ritor1
parents:
diff changeset
660 // 4DBD94: using guessed type int dword_4DBD94;
Ritor1
parents:
diff changeset
661
Ritor1
parents:
diff changeset
662
Ritor1
parents:
diff changeset
663
Ritor1
parents:
diff changeset
664 //----- (0046ADE2) --------------------------------------------------------
Ritor1
parents:
diff changeset
665 AsyncMouse::~AsyncMouse()
Ritor1
parents:
diff changeset
666 {
Ritor1
parents:
diff changeset
667 void *v1; // esi@1
Ritor1
parents:
diff changeset
668 char *v2; // edi@1
Ritor1
parents:
diff changeset
669 int v3; // ecx@1
Ritor1
parents:
diff changeset
670
Ritor1
parents:
diff changeset
671 v1 = this;
Ritor1
parents:
diff changeset
672 //*(int *)this = AsyncMouse_pvdtor;
Ritor1
parents:
diff changeset
673 v2 = (char *)this + 132;
Ritor1
parents:
diff changeset
674 v3 = *((int *)this + 33);
Ritor1
parents:
diff changeset
675 if ( v3 )
Ritor1
parents:
diff changeset
676 (**(void (__stdcall ***)(int))v3)(1);
Ritor1
parents:
diff changeset
677 *(int *)v2 = 0;
Ritor1
parents:
diff changeset
678 TerminateThread(*((HANDLE *)v1 + 4), 0xFAu);
Ritor1
parents:
diff changeset
679 SetWindowPos(hWnd, (HWND)0xFFFFFFFE, uWindowX, uWindowY, 640, 480, 0);
Ritor1
parents:
diff changeset
680 //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 116));
Ritor1
parents:
diff changeset
681 //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 104));
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683 // 4D8730: using guessed type int (__stdcall *AsyncMouse_pvdtor[2])(char);
Ritor1
parents:
diff changeset
684
Ritor1
parents:
diff changeset
685
Ritor1
parents:
diff changeset
686
Ritor1
parents:
diff changeset
687
Ritor1
parents:
diff changeset
688
Ritor1
parents:
diff changeset
689
Ritor1
parents:
diff changeset
690
Ritor1
parents:
diff changeset
691
Ritor1
parents:
diff changeset
692
Ritor1
parents:
diff changeset
693
Ritor1
parents:
diff changeset
694
Ritor1
parents:
diff changeset
695
Ritor1
parents:
diff changeset
696
Ritor1
parents:
diff changeset
697 //----- (0046AE6E) --------------------------------------------------------
Ritor1
parents:
diff changeset
698 char AsyncMouse::Initialize(LPVOID lpParameter)
Ritor1
parents:
diff changeset
699 {
Ritor1
parents:
diff changeset
700 void *v1; // esi@1
Ritor1
parents:
diff changeset
701 char result; // al@2
Ritor1
parents:
diff changeset
702
Ritor1
parents:
diff changeset
703 v1 = lpParameter;
Ritor1
parents:
diff changeset
704 if ( LoadCursorImage() && _46B072() )
Ritor1
parents:
diff changeset
705 result = CreateDisrectInputMouse() != 0;
Ritor1
parents:
diff changeset
706 else
Ritor1
parents:
diff changeset
707 result = 0;
Ritor1
parents:
diff changeset
708 return result;
Ritor1
parents:
diff changeset
709 }
Ritor1
parents:
diff changeset
710
Ritor1
parents:
diff changeset
711 //----- (0046AE97) --------------------------------------------------------
Ritor1
parents:
diff changeset
712 char AsyncMouse::LoadCursor(const char *pContainer)
Ritor1
parents:
diff changeset
713 {
Ritor1
parents:
diff changeset
714 __debugbreak();
Ritor1
parents:
diff changeset
715 return 0;
Ritor1
parents:
diff changeset
716 /*
Ritor1
parents:
diff changeset
717 void *v2; // esi@1
Ritor1
parents:
diff changeset
718 int v3; // eax@1
Ritor1
parents:
diff changeset
719 HRESULT v4; // eax@1
Ritor1
parents:
diff changeset
720 char result; // al@3
Ritor1
parents:
diff changeset
721 HRESULT a2; // [sp+8h] [bp-B0h]@1
Ritor1
parents:
diff changeset
722 int v7; // [sp+58h] [bp-60h]@1
Ritor1
parents:
diff changeset
723 char v9; // [sp+B4h] [bp-4h]@1
Ritor1
parents:
diff changeset
724
Ritor1
parents:
diff changeset
725 v2 = this;
Ritor1
parents:
diff changeset
726 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
Ritor1
parents:
diff changeset
727 v3 = *((int *)v2 + 1);
Ritor1
parents:
diff changeset
728 a2 = 100;
Ritor1
parents:
diff changeset
729 v7 = 0;
Ritor1
parents:
diff changeset
730 v4 = (*(int (__stdcall **)(int, int, int, int, signed int, HRESULT *))(*(int *)v3 + 20))(
Ritor1
parents:
diff changeset
731 v3,
Ritor1
parents:
diff changeset
732 0,
Ritor1
parents:
diff changeset
733 0,
Ritor1
parents:
diff changeset
734 0,
Ritor1
parents:
diff changeset
735 1024,
Ritor1
parents:
diff changeset
736 &a2);
Ritor1
parents:
diff changeset
737 ErrHR(v4, "DirectInput", __FUNCTION__, __FILE__, __LINE__);
Ritor1
parents:
diff changeset
738
Ritor1
parents:
diff changeset
739 Texture thisa; // [sp+6Ch] [bp-4Ch]@1
Ritor1
parents:
diff changeset
740 //Texture::Texture(&thisa);
Ritor1
parents:
diff changeset
741
Ritor1
parents:
diff changeset
742 if ( pIcons_LOD->LoadTextureFromLOD(&thisa, pContainer, TEXTURE_16BIT_PALETTE) != -1
Ritor1
parents:
diff changeset
743 && DrawCursor(&thisa, *((IDirectDrawSurface4 **)v2 + 1), 0) )
Ritor1
parents:
diff changeset
744 {
Ritor1
parents:
diff changeset
745 thisa.Release();
Ritor1
parents:
diff changeset
746 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);
Ritor1
parents:
diff changeset
747 result = 1;
Ritor1
parents:
diff changeset
748 }
Ritor1
parents:
diff changeset
749 else
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 result = 0;
Ritor1
parents:
diff changeset
752 }
Ritor1
parents:
diff changeset
753 return result;*/
Ritor1
parents:
diff changeset
754 }
Ritor1
parents:
diff changeset
755
Ritor1
parents:
diff changeset
756 //----- (0046AF50) --------------------------------------------------------
Ritor1
parents:
diff changeset
757 char AsyncMouse::LoadCursorImage()
Ritor1
parents:
diff changeset
758 {
Ritor1
parents:
diff changeset
759 void *v1; // ebx@1
Ritor1
parents:
diff changeset
760 int v2; // eax@2
Ritor1
parents:
diff changeset
761 int v3; // esi@4
Ritor1
parents:
diff changeset
762 char result; // al@5
Ritor1
parents:
diff changeset
763 //const char *v5; // eax@6
Ritor1
parents:
diff changeset
764 //std::string v6; // [sp-18h] [bp-12Ch]@9
Ritor1
parents:
diff changeset
765 const char *v7; // [sp-8h] [bp-11Ch]@9
Ritor1
parents:
diff changeset
766 int v8; // [sp-4h] [bp-118h]@9
Ritor1
parents:
diff changeset
767 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-108h]@1
Ritor1
parents:
diff changeset
768 int v10; // [sp+88h] [bp-8Ch]@2
Ritor1
parents:
diff changeset
769 int v11; // [sp+8Ch] [bp-88h]@2
Ritor1
parents:
diff changeset
770 int v12; // [sp+90h] [bp-84h]@2
Ritor1
parents:
diff changeset
771 int v13; // [sp+94h] [bp-80h]@2
Ritor1
parents:
diff changeset
772 char v14; // [sp+D0h] [bp-44h]@2
Ritor1
parents:
diff changeset
773 int v15; // [sp+F0h] [bp-24h]@2
Ritor1
parents:
diff changeset
774 int v16; // [sp+104h] [bp-10h]@4
Ritor1
parents:
diff changeset
775 int v17; // [sp+108h] [bp-Ch]@4
Ritor1
parents:
diff changeset
776 std::string *v18; // [sp+10Ch] [bp-8h]@9
Ritor1
parents:
diff changeset
777 int a3; // [sp+113h] [bp-1h]@9
Ritor1
parents:
diff changeset
778
Ritor1
parents:
diff changeset
779 v1 = this;
Ritor1
parents:
diff changeset
780 memset(&Dst, 0, 0x7Cu);
Ritor1
parents:
diff changeset
781 Dst.dwSize = 124;
Ritor1
parents:
diff changeset
782 if ( pRenderer->pDirectDraw4->GetDisplayMode(&Dst)
Ritor1
parents:
diff changeset
783 || (memset(&v10, 0, 0x7Cu),
Ritor1
parents:
diff changeset
784 v10 = 124,
Ritor1
parents:
diff changeset
785 v11 = 4103,
Ritor1
parents:
diff changeset
786 v15 = 2112,
Ritor1
parents:
diff changeset
787 v12 = 32,
Ritor1
parents:
diff changeset
788 v13 = 32,
Ritor1
parents:
diff changeset
789 v2 = *((int *)v1 + 3),
Ritor1
parents:
diff changeset
790 memcpy(&v14, &Dst.ddpfPixelFormat, 0x20u),
Ritor1
parents:
diff changeset
791 (*(int (__stdcall **)(int, int *, char *, int))(**(int **)v2 + 24))(
Ritor1
parents:
diff changeset
792 *(int *)v2,
Ritor1
parents:
diff changeset
793 &v10,
Ritor1
parents:
diff changeset
794 (char *)v1 + 4,
Ritor1
parents:
diff changeset
795 0))
Ritor1
parents:
diff changeset
796 || (*(int (__stdcall **)(int, int *, char *, int))(***((int ***)v1 + 3) + 24))(
Ritor1
parents:
diff changeset
797 **((int **)v1 + 3),
Ritor1
parents:
diff changeset
798 &v10,
Ritor1
parents:
diff changeset
799 (char *)v1 + 8,
Ritor1
parents:
diff changeset
800 0)
Ritor1
parents:
diff changeset
801 || (v3 = *((int *)v1 + 1),
Ritor1
parents:
diff changeset
802 v16 = 0,
Ritor1
parents:
diff changeset
803 v17 = 0,
Ritor1
parents:
diff changeset
804 (*(int (__stdcall **)(int, signed int, int *))(*(int *)v3 + 116))(v3, 8, &v16)) )
Ritor1
parents:
diff changeset
805 {
Ritor1
parents:
diff changeset
806 result = 0;
Ritor1
parents:
diff changeset
807 return false;
Ritor1
parents:
diff changeset
808 }
Ritor1
parents:
diff changeset
809 else
Ritor1
parents:
diff changeset
810 {
Ritor1
parents:
diff changeset
811 if ( !LoadCursor("micon1") )
Ritor1
parents:
diff changeset
812 {
Ritor1
parents:
diff changeset
813 MessageBoxW(nullptr, L"Could not load async mouse cursor image", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:182", 0);
Ritor1
parents:
diff changeset
814 }
Ritor1
parents:
diff changeset
815 result = 1;
Ritor1
parents:
diff changeset
816 return true;
Ritor1
parents:
diff changeset
817 }
Ritor1
parents:
diff changeset
818 return result;
Ritor1
parents:
diff changeset
819 }
Ritor1
parents:
diff changeset
820 // 4D86F0: using guessed type int dword_4D86F0;
Ritor1
parents:
diff changeset
821
Ritor1
parents:
diff changeset
822 //----- (0046B072) --------------------------------------------------------
Ritor1
parents:
diff changeset
823 char AsyncMouse::_46B072()
Ritor1
parents:
diff changeset
824 {
Ritor1
parents:
diff changeset
825 DWORD v1; // esi@1
Ritor1
parents:
diff changeset
826 HANDLE v2; // eax@1
Ritor1
parents:
diff changeset
827 char result; // al@2
Ritor1
parents:
diff changeset
828 DWORD ThreadId; // [sp+0h] [bp-4h]@1
Ritor1
parents:
diff changeset
829
Ritor1
parents:
diff changeset
830 ThreadId = (DWORD)this;
Ritor1
parents:
diff changeset
831 v1 = (DWORD)this;
Ritor1
parents:
diff changeset
832 v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncMouseThread, this, 4u, &ThreadId);
Ritor1
parents:
diff changeset
833 *(int *)(v1 + 16) = (int)v2;
Ritor1
parents:
diff changeset
834 if ( v2 )
Ritor1
parents:
diff changeset
835 result = SetThreadPriority(v2, 15) != 0;
Ritor1
parents:
diff changeset
836 else
Ritor1
parents:
diff changeset
837 result = 0;
Ritor1
parents:
diff changeset
838 return result;
Ritor1
parents:
diff changeset
839 }
Ritor1
parents:
diff changeset
840
Ritor1
parents:
diff changeset
841 //----- (0046B0A9) --------------------------------------------------------
Ritor1
parents:
diff changeset
842 char AsyncMouse::CreateDisrectInputMouse()
Ritor1
parents:
diff changeset
843 {
Ritor1
parents:
diff changeset
844 __debugbreak();
Ritor1
parents:
diff changeset
845 /*
Ritor1
parents:
diff changeset
846 void *v1; // esi@1
Ritor1
parents:
diff changeset
847 DirectInputMouse *v2; // ecx@1
Ritor1
parents:
diff changeset
848 DirectInputMouse *v3; // eax@2
Ritor1
parents:
diff changeset
849
Ritor1
parents:
diff changeset
850 v1 = this;
Ritor1
parents:
diff changeset
851 v2 = (DirectInputMouse *)operator new(0x2Cu);
Ritor1
parents:
diff changeset
852 if ( v2 )
Ritor1
parents:
diff changeset
853 v3 = DirectInputMouse::DirectInputMouse(v2);
Ritor1
parents:
diff changeset
854 else
Ritor1
parents:
diff changeset
855 v3 = 0;
Ritor1
parents:
diff changeset
856 *((int *)v1 + 33) = v3;
Ritor1
parents:
diff changeset
857 return v3 != 0;*/
Ritor1
parents:
diff changeset
858 return 0;
Ritor1
parents:
diff changeset
859 }
Ritor1
parents:
diff changeset
860
Ritor1
parents:
diff changeset
861 //----- (0046B0ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
862 int AsyncMouse::_46B0ED()
Ritor1
parents:
diff changeset
863 {
Ritor1
parents:
diff changeset
864 __debugbreak();
Ritor1
parents:
diff changeset
865 /*
Ritor1
parents:
diff changeset
866 int v1; // esi@1
Ritor1
parents:
diff changeset
867 int v2; // ecx@1
Ritor1
parents:
diff changeset
868 int result; // eax@2
Ritor1
parents:
diff changeset
869
Ritor1
parents:
diff changeset
870 v1 = this + 132;
Ritor1
parents:
diff changeset
871 v2 = *(int *)(this + 132);
Ritor1
parents:
diff changeset
872 if ( v2 )
Ritor1
parents:
diff changeset
873 result = (**(int (__stdcall ***)(int))v2)(1);
Ritor1
parents:
diff changeset
874 *(int *)v1 = 0;
Ritor1
parents:
diff changeset
875 return result;*/
Ritor1
parents:
diff changeset
876 return 0;
Ritor1
parents:
diff changeset
877 }
Ritor1
parents:
diff changeset
878 // 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int);
Ritor1
parents:
diff changeset
879
Ritor1
parents:
diff changeset
880 //----- (0046B105) --------------------------------------------------------
Ritor1
parents:
diff changeset
881 void AsyncMouse::Resume()
Ritor1
parents:
diff changeset
882 {
Ritor1
parents:
diff changeset
883 __debugbreak();
Ritor1
parents:
diff changeset
884 /*
Ritor1
parents:
diff changeset
885 void *v1; // esi@1
Ritor1
parents:
diff changeset
886
Ritor1
parents:
diff changeset
887 v1 = this;
Ritor1
parents:
diff changeset
888 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
Ritor1
parents:
diff changeset
889 AsyncMouse::CreateDisrectInputMouse(v1);
Ritor1
parents:
diff changeset
890 AsyncMouse::Clip();
Ritor1
parents:
diff changeset
891 ResumeThread(*((HANDLE *)v1 + 4));
Ritor1
parents:
diff changeset
892 *((char *)v1 + 88) = 0;
Ritor1
parents:
diff changeset
893 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);*/
Ritor1
parents:
diff changeset
894 }
Ritor1
parents:
diff changeset
895
Ritor1
parents:
diff changeset
896 //----- (0046B14F) --------------------------------------------------------
Ritor1
parents:
diff changeset
897 void AsyncMouse::Suspend()
Ritor1
parents:
diff changeset
898 {
Ritor1
parents:
diff changeset
899 void *v1; // esi@1
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 168
diff changeset
900 //Vis *v2; // eax@3
0
Ritor1
parents:
diff changeset
901 std::string v3; // [sp-18h] [bp-24h]@2
Ritor1
parents:
diff changeset
902 const char *v4; // [sp-8h] [bp-14h]@2
Ritor1
parents:
diff changeset
903 int v5; // [sp-4h] [bp-10h]@2
Ritor1
parents:
diff changeset
904 std::string *v6; // [sp+4h] [bp-8h]@2
Ritor1
parents:
diff changeset
905 int a3; // [sp+Bh] [bp-1h]@2
Ritor1
parents:
diff changeset
906
Ritor1
parents:
diff changeset
907 v1 = this;
Ritor1
parents:
diff changeset
908 if ( *((int *)this + 33) )
Ritor1
parents:
diff changeset
909 {
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 168
diff changeset
910 //v2 = pGame->pVisInstance;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 168
diff changeset
911 if (pGame->pVisInstance)
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 168
diff changeset
912 pGame->pVisInstance->default_list.uNumPointers = 0;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 168
diff changeset
913
0
Ritor1
parents:
diff changeset
914 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
Ritor1
parents:
diff changeset
915 SuspendThread(*((HANDLE *)v1 + 4));
Ritor1
parents:
diff changeset
916 _46B0ED();
Ritor1
parents:
diff changeset
917 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);
Ritor1
parents:
diff changeset
918 }
Ritor1
parents:
diff changeset
919 else
Ritor1
parents:
diff changeset
920 {
Ritor1
parents:
diff changeset
921 MessageBoxW(nullptr, L"DI_Mouse pointer invalid; bailing out from suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:233", 0);
Ritor1
parents:
diff changeset
922 }
Ritor1
parents:
diff changeset
923 }
Ritor1
parents:
diff changeset
924 // 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int);
Ritor1
parents:
diff changeset
925
Ritor1
parents:
diff changeset
926 //----- (0046B1DD) --------------------------------------------------------
Ritor1
parents:
diff changeset
927 char AsyncMouse::_46B1DD()
Ritor1
parents:
diff changeset
928 {
Ritor1
parents:
diff changeset
929 *((char *)this + 20) = 1;
Ritor1
parents:
diff changeset
930 Sleep(118);
Ritor1
parents:
diff changeset
931 return 1;
Ritor1
parents:
diff changeset
932 }
Ritor1
parents:
diff changeset
933
Ritor1
parents:
diff changeset
934 //----- (0046B1EC) --------------------------------------------------------
Ritor1
parents:
diff changeset
935 bool AsyncMouse::DrawCursor(Texture *a1, IDirectDrawSurface4 *a2, int a3)
Ritor1
parents:
diff changeset
936 {
Ritor1
parents:
diff changeset
937 __debugbreak();
Ritor1
parents:
diff changeset
938 /*
Ritor1
parents:
diff changeset
939 bool result; // eax@1
Ritor1
parents:
diff changeset
940 unsigned __int16 *v5; // ebx@2
Ritor1
parents:
diff changeset
941 unsigned __int8 *v6; // edx@2
Ritor1
parents:
diff changeset
942 int v7; // esi@2
Ritor1
parents:
diff changeset
943 int v8; // ecx@2
Ritor1
parents:
diff changeset
944 LPVOID v9; // edi@2
Ritor1
parents:
diff changeset
945 int v10; // ecx@5
Ritor1
parents:
diff changeset
946 DDSURFACEDESC2 Dst; // [sp+0h] [bp-84h]@1
Ritor1
parents:
diff changeset
947 __int32 v12; // [sp+7Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
948 int v13; // [sp+80h] [bp-4h]@3
Ritor1
parents:
diff changeset
949
Ritor1
parents:
diff changeset
950 Dst.dwSize = 124;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 0
diff changeset
951 result = pRenderer->LockSurface_DDraw4(a2, &Dst, DDLOCK_WAIT);
0
Ritor1
parents:
diff changeset
952 if ( result )
Ritor1
parents:
diff changeset
953 {
Ritor1
parents:
diff changeset
954 v5 = a1->pPalette16;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 315
diff changeset
955 v6 = a1->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
956 v7 = a1->uTextureWidth;
Ritor1
parents:
diff changeset
957 v8 = a1->uTextureHeight;
Ritor1
parents:
diff changeset
958 v9 = Dst.lpSurface;
Ritor1
parents:
diff changeset
959 if ( v8 > 0 )
Ritor1
parents:
diff changeset
960 {
Ritor1
parents:
diff changeset
961 v12 = 2 * (Dst.lPitch / 2 - v7);
Ritor1
parents:
diff changeset
962 v13 = v8;
Ritor1
parents:
diff changeset
963 do
Ritor1
parents:
diff changeset
964 {
Ritor1
parents:
diff changeset
965 if ( v7 > 0 )
Ritor1
parents:
diff changeset
966 {
Ritor1
parents:
diff changeset
967 v10 = v7;
Ritor1
parents:
diff changeset
968 do
Ritor1
parents:
diff changeset
969 {
Ritor1
parents:
diff changeset
970 if ( v5[*v6] )
Ritor1
parents:
diff changeset
971 *(short *)v9 = v5[*v6];
Ritor1
parents:
diff changeset
972 v9 = (char *)v9 + 2;
Ritor1
parents:
diff changeset
973 ++v6;
Ritor1
parents:
diff changeset
974 --v10;
Ritor1
parents:
diff changeset
975 }
Ritor1
parents:
diff changeset
976 while ( v10 );
Ritor1
parents:
diff changeset
977 }
Ritor1
parents:
diff changeset
978 v9 = (char *)v9 + v12;
Ritor1
parents:
diff changeset
979 --v13;
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981 while ( v13 );
Ritor1
parents:
diff changeset
982 }
Ritor1
parents:
diff changeset
983 result = a2->Unlock(
Ritor1
parents:
diff changeset
984 v6,
Ritor1
parents:
diff changeset
985 a2,
Ritor1
parents:
diff changeset
986 a3);
Ritor1
parents:
diff changeset
987 }
Ritor1
parents:
diff changeset
988 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
989 return result;*/
Ritor1
parents:
diff changeset
990 return 0;
Ritor1
parents:
diff changeset
991 }
Ritor1
parents:
diff changeset
992
Ritor1
parents:
diff changeset
993 //----- (0046B289) --------------------------------------------------------
Ritor1
parents:
diff changeset
994 bool AsyncMouse::_46B289(int a2, char a3)
Ritor1
parents:
diff changeset
995 {
Ritor1
parents:
diff changeset
996 char v3; // dl@1
Ritor1
parents:
diff changeset
997 bool result; // eax@33
Ritor1
parents:
diff changeset
998 char v5; // [sp+2h] [bp-2h]@1
Ritor1
parents:
diff changeset
999 char v6; // [sp+3h] [bp-1h]@1
Ritor1
parents:
diff changeset
1000
Ritor1
parents:
diff changeset
1001 v3 = *((char *)this + 93);
Ritor1
parents:
diff changeset
1002 v6 = *((char *)this + 94);
Ritor1
parents:
diff changeset
1003 v5 = *((char *)this + 95);
Ritor1
parents:
diff changeset
1004 if ( a3 & 1 )
Ritor1
parents:
diff changeset
1005 {
Ritor1
parents:
diff changeset
1006 *((char *)this + 93) = 1;
Ritor1
parents:
diff changeset
1007 }
Ritor1
parents:
diff changeset
1008 else
Ritor1
parents:
diff changeset
1009 {
Ritor1
parents:
diff changeset
1010 if ( v3 )
Ritor1
parents:
diff changeset
1011 *((char *)this + 99) = 1;
Ritor1
parents:
diff changeset
1012 else
Ritor1
parents:
diff changeset
1013 *((char *)this + 99) = 0;
Ritor1
parents:
diff changeset
1014 *((char *)this + 93) = 0;
Ritor1
parents:
diff changeset
1015 }
Ritor1
parents:
diff changeset
1016 if ( a3 & 2 )
Ritor1
parents:
diff changeset
1017 {
Ritor1
parents:
diff changeset
1018 *((char *)this + 94) = 1;
Ritor1
parents:
diff changeset
1019 }
Ritor1
parents:
diff changeset
1020 else
Ritor1
parents:
diff changeset
1021 {
Ritor1
parents:
diff changeset
1022 if ( v6 )
Ritor1
parents:
diff changeset
1023 *((char *)this + 100) = 1;
Ritor1
parents:
diff changeset
1024 else
Ritor1
parents:
diff changeset
1025 *((char *)this + 100) = 0;
Ritor1
parents:
diff changeset
1026 *((char *)this + 94) = 0;
Ritor1
parents:
diff changeset
1027 }
Ritor1
parents:
diff changeset
1028 if ( a3 & 4 )
Ritor1
parents:
diff changeset
1029 {
Ritor1
parents:
diff changeset
1030 *((char *)this + 95) = 1;
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032 else
Ritor1
parents:
diff changeset
1033 {
Ritor1
parents:
diff changeset
1034 if ( v5 )
Ritor1
parents:
diff changeset
1035 *((char *)this + 101) = 1;
Ritor1
parents:
diff changeset
1036 else
Ritor1
parents:
diff changeset
1037 *((char *)this + 101) = 0;
Ritor1
parents:
diff changeset
1038 *((char *)this + 95) = 0;
Ritor1
parents:
diff changeset
1039 }
Ritor1
parents:
diff changeset
1040 *((char *)this + 96) = v3 != *((char *)this + 93);
Ritor1
parents:
diff changeset
1041 *((char *)this + 97) = v6 != *((char *)this + 94);
Ritor1
parents:
diff changeset
1042 *((char *)this + 98) = v5 != *((char *)this + 95);
Ritor1
parents:
diff changeset
1043 if ( *((char *)this + 99) && *((char *)this + 96) || *((char *)this + 100) && *((char *)this + 97) )
Ritor1
parents:
diff changeset
1044 *((char *)this + 102) = 1;
Ritor1
parents:
diff changeset
1045 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
1046 return result;
Ritor1
parents:
diff changeset
1047 }
Ritor1
parents:
diff changeset
1048
Ritor1
parents:
diff changeset
1049 //----- (0046B342) --------------------------------------------------------
Ritor1
parents:
diff changeset
1050 void AsyncMouse::SetHotspot(float hotspotx, float hotspoty)
Ritor1
parents:
diff changeset
1051 {
Ritor1
parents:
diff changeset
1052 double v3; // ST00_8@1
Ritor1
parents:
diff changeset
1053 double v4; // ST00_8@1
Ritor1
parents:
diff changeset
1054
Ritor1
parents:
diff changeset
1055 v3 = hotspotx + 6.7553994e15;
Ritor1
parents:
diff changeset
1056 *(int *)(this + 40) = LODWORD(v3);
Ritor1
parents:
diff changeset
1057 v4 = hotspoty + 6.7553994e15;
Ritor1
parents:
diff changeset
1058 *(int *)(this + 44) = LODWORD(v4);
Ritor1
parents:
diff changeset
1059 }
Ritor1
parents:
diff changeset
1060
Ritor1
parents:
diff changeset
1061 //----- (0046B37C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1062 int AsyncMouse::UpdateData(int a2)
Ritor1
parents:
diff changeset
1063 {
Ritor1
parents:
diff changeset
1064 __debugbreak();
Ritor1
parents:
diff changeset
1065 /*
Ritor1
parents:
diff changeset
1066 void *v2; // edi@1
Ritor1
parents:
diff changeset
1067 int result; // eax@2
Ritor1
parents:
diff changeset
1068 int v4; // eax@3
Ritor1
parents:
diff changeset
1069 int v5; // esi@3
Ritor1
parents:
diff changeset
1070 std::string v6; // [sp-18h] [bp-28h]@2
Ritor1
parents:
diff changeset
1071 const char *v7; // [sp-8h] [bp-18h]@2
Ritor1
parents:
diff changeset
1072 int v8; // [sp-4h] [bp-14h]@2
Ritor1
parents:
diff changeset
1073 std::string *v9; // [sp+8h] [bp-8h]@2
Ritor1
parents:
diff changeset
1074 int a3; // [sp+Fh] [bp-1h]@2
Ritor1
parents:
diff changeset
1075
Ritor1
parents:
diff changeset
1076 v2 = this;
Ritor1
parents:
diff changeset
1077 if ( *((int *)this + 33) )
Ritor1
parents:
diff changeset
1078 {
Ritor1
parents:
diff changeset
1079 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
Ritor1
parents:
diff changeset
1080 DirectInputMouse::_43BB89(*((DirectInputMouse **)v2 + 33));
Ritor1
parents:
diff changeset
1081 v4 = *((int *)v2 + 33);
Ritor1
parents:
diff changeset
1082 v5 = v4 + 32;
Ritor1
parents:
diff changeset
1083 _46B289(v4 + 32, *(int *)(v4 + 40));
Ritor1
parents:
diff changeset
1084 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);
Ritor1
parents:
diff changeset
1085 result = a2;
Ritor1
parents:
diff changeset
1086 *(int *)a2 = *(int *)v5;
Ritor1
parents:
diff changeset
1087 *(int *)(a2 + 4) = *(int *)(v5 + 4);
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089 else
Ritor1
parents:
diff changeset
1090 {
Ritor1
parents:
diff changeset
1091 MessageBoxW(nullptr, L"DI_Mouse pointer invalid bailing out from update_mouse_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:446", 0);
Ritor1
parents:
diff changeset
1092 result = a2;
Ritor1
parents:
diff changeset
1093 *(int *)a2 = 0;
Ritor1
parents:
diff changeset
1094 *(int *)(a2 + 4) = 0;
Ritor1
parents:
diff changeset
1095 }
Ritor1
parents:
diff changeset
1096 return result;*/
Ritor1
parents:
diff changeset
1097 return 0;
Ritor1
parents:
diff changeset
1098 }
Ritor1
parents:
diff changeset
1099
Ritor1
parents:
diff changeset
1100 //----- (0046B420) --------------------------------------------------------
Ritor1
parents:
diff changeset
1101 char AsyncMouse::Thread()
Ritor1
parents:
diff changeset
1102 {
Ritor1
parents:
diff changeset
1103 void *v1; // esi@1
Ritor1
parents:
diff changeset
1104 char result; // al@2
Ritor1
parents:
diff changeset
1105 int v3; // eax@3
Ritor1
parents:
diff changeset
1106 int v4; // ecx@3
Ritor1
parents:
diff changeset
1107 int v5; // eax@3
Ritor1
parents:
diff changeset
1108 int v6; // ecx@3
Ritor1
parents:
diff changeset
1109 int v7; // [sp+4h] [bp-8h]@3
Ritor1
parents:
diff changeset
1110 int v8; // [sp+8h] [bp-4h]@3
Ritor1
parents:
diff changeset
1111
Ritor1
parents:
diff changeset
1112 v1 = this;
Ritor1
parents:
diff changeset
1113 if ( *((char *)this + 20) )
Ritor1
parents:
diff changeset
1114 {
Ritor1
parents:
diff changeset
1115 result = 0;
Ritor1
parents:
diff changeset
1116 }
Ritor1
parents:
diff changeset
1117 else
Ritor1
parents:
diff changeset
1118 {
Ritor1
parents:
diff changeset
1119 UpdateData((int)&v7);
Ritor1
parents:
diff changeset
1120 _46BA8D(v7, v8);
Ritor1
parents:
diff changeset
1121 _46B958(v7 - *((int *)v1 + 10), v8 - *((int *)v1 + 11));
Ritor1
parents:
diff changeset
1122 _46B492((int)&v7);
Ritor1
parents:
diff changeset
1123 _46B5D5((int)&v7);
Ritor1
parents:
diff changeset
1124 v3 = v7;
Ritor1
parents:
diff changeset
1125 v4 = v8;
Ritor1
parents:
diff changeset
1126 *((int *)v1 + 6) = v7;
Ritor1
parents:
diff changeset
1127 v5 = v3 - *((int *)v1 + 10);
Ritor1
parents:
diff changeset
1128 *((int *)v1 + 7) = v4;
Ritor1
parents:
diff changeset
1129 v6 = v4 - *((int *)v1 + 11);
Ritor1
parents:
diff changeset
1130 *((int *)v1 + 8) = v5;
Ritor1
parents:
diff changeset
1131 result = 1;
Ritor1
parents:
diff changeset
1132 *((int *)v1 + 9) = v6;
Ritor1
parents:
diff changeset
1133 }
Ritor1
parents:
diff changeset
1134 return result;
Ritor1
parents:
diff changeset
1135 }
Ritor1
parents:
diff changeset
1136
Ritor1
parents:
diff changeset
1137 //----- (0046B492) --------------------------------------------------------
Ritor1
parents:
diff changeset
1138 void AsyncMouse::_46B492(int a2)
Ritor1
parents:
diff changeset
1139 {
Ritor1
parents:
diff changeset
1140 __debugbreak();
Ritor1
parents:
diff changeset
1141 /*
Ritor1
parents:
diff changeset
1142 void *v2; // edi@1
Ritor1
parents:
diff changeset
1143 int v3; // esi@3
Ritor1
parents:
diff changeset
1144 int v4; // eax@5
Ritor1
parents:
diff changeset
1145 int v5; // ecx@5
Ritor1
parents:
diff changeset
1146 int v6; // eax@8
Ritor1
parents:
diff changeset
1147 int v7; // ecx@8
Ritor1
parents:
diff changeset
1148 int v8; // eax@11
Ritor1
parents:
diff changeset
1149 int v9; // esi@11
Ritor1
parents:
diff changeset
1150 int v10; // [sp+Ch] [bp-1Ch]@5
Ritor1
parents:
diff changeset
1151 int v11; // [sp+10h] [bp-18h]@5
Ritor1
parents:
diff changeset
1152 int v12; // [sp+14h] [bp-14h]@5
Ritor1
parents:
diff changeset
1153 int v13; // [sp+18h] [bp-10h]@5
Ritor1
parents:
diff changeset
1154 int v14; // [sp+24h] [bp-4h]@5
Ritor1
parents:
diff changeset
1155
Ritor1
parents:
diff changeset
1156 v2 = this;
Ritor1
parents:
diff changeset
1157 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
Ritor1
parents:
diff changeset
1158 if ( *((int *)v2 + 28) > 0x80u )
Ritor1
parents:
diff changeset
1159 _46BCAB((char *)v2 + 104);
Ritor1
parents:
diff changeset
1160 v3 = a2;
Ritor1
parents:
diff changeset
1161 if ( *((char *)v2 + 93) && *((char *)v2 + 96) )
Ritor1
parents:
diff changeset
1162 {
Ritor1
parents:
diff changeset
1163 v4 = *(int *)a2;
Ritor1
parents:
diff changeset
1164 v5 = *(int *)(a2 + 4);
Ritor1
parents:
diff changeset
1165 v13 = 1;
Ritor1
parents:
diff changeset
1166 v10 = 5080884;
Ritor1
parents:
diff changeset
1167 v11 = v4;
Ritor1
parents:
diff changeset
1168 v12 = v5;
Ritor1
parents:
diff changeset
1169 v14 = 0;
Ritor1
parents:
diff changeset
1170 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
Ritor1
parents:
diff changeset
1171 v14 = -1;
Ritor1
parents:
diff changeset
1172 }
Ritor1
parents:
diff changeset
1173 if ( *((char *)v2 + 94) && *((char *)v2 + 97) )
Ritor1
parents:
diff changeset
1174 {
Ritor1
parents:
diff changeset
1175 v6 = *(int *)v3;
Ritor1
parents:
diff changeset
1176 v7 = *(int *)(v3 + 4);
Ritor1
parents:
diff changeset
1177 v13 = 2;
Ritor1
parents:
diff changeset
1178 v10 = 5080884;
Ritor1
parents:
diff changeset
1179 v11 = v6;
Ritor1
parents:
diff changeset
1180 v12 = v7;
Ritor1
parents:
diff changeset
1181 v14 = 1;
Ritor1
parents:
diff changeset
1182 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
Ritor1
parents:
diff changeset
1183 v14 = -1;
Ritor1
parents:
diff changeset
1184 }
Ritor1
parents:
diff changeset
1185 if ( *((char *)v2 + 95) && *((char *)v2 + 98) )
Ritor1
parents:
diff changeset
1186 {
Ritor1
parents:
diff changeset
1187 v8 = *(int *)v3;
Ritor1
parents:
diff changeset
1188 v9 = *(int *)(v3 + 4);
Ritor1
parents:
diff changeset
1189 v13 = 4;
Ritor1
parents:
diff changeset
1190 v10 = 5080884;
Ritor1
parents:
diff changeset
1191 v11 = v8;
Ritor1
parents:
diff changeset
1192 v12 = v9;
Ritor1
parents:
diff changeset
1193 v14 = 2;
Ritor1
parents:
diff changeset
1194 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
Ritor1
parents:
diff changeset
1195 }
Ritor1
parents:
diff changeset
1196 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
Ritor1
parents:
diff changeset
1197 }
Ritor1
parents:
diff changeset
1198
Ritor1
parents:
diff changeset
1199 //----- (0046B5D5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1200 void AsyncMouse::_46B5D5(int a2)
Ritor1
parents:
diff changeset
1201 {
Ritor1
parents:
diff changeset
1202 __debugbreak();
Ritor1
parents:
diff changeset
1203 /*
Ritor1
parents:
diff changeset
1204 void *v2; // esi@1
Ritor1
parents:
diff changeset
1205 DWORD v3; // eax@3
Ritor1
parents:
diff changeset
1206 char v4; // zf@3
Ritor1
parents:
diff changeset
1207 int v5; // edi@3
Ritor1
parents:
diff changeset
1208 int v6; // eax@6
Ritor1
parents:
diff changeset
1209 int v7; // ecx@6
Ritor1
parents:
diff changeset
1210 int v8; // eax@11
Ritor1
parents:
diff changeset
1211 int v9; // ecx@11
Ritor1
parents:
diff changeset
1212 int v10; // eax@16
Ritor1
parents:
diff changeset
1213 int v11; // edi@16
Ritor1
parents:
diff changeset
1214 int (__stdcall **v12)(char); // [sp+Ch] [bp-20h]@6
Ritor1
parents:
diff changeset
1215 int v13; // [sp+10h] [bp-1Ch]@6
Ritor1
parents:
diff changeset
1216 int v14; // [sp+14h] [bp-18h]@6
Ritor1
parents:
diff changeset
1217 int v15; // [sp+18h] [bp-14h]@6
Ritor1
parents:
diff changeset
1218 DWORD v16; // [sp+1Ch] [bp-10h]@3
Ritor1
parents:
diff changeset
1219 int v17; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
1220
Ritor1
parents:
diff changeset
1221 v2 = this;
Ritor1
parents:
diff changeset
1222 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
Ritor1
parents:
diff changeset
1223 if ( *((int *)v2 + 31) > 0x80u )
Ritor1
parents:
diff changeset
1224 _46BCAB((char *)v2 + 116);
Ritor1
parents:
diff changeset
1225 v3 = timeGetTime();
Ritor1
parents:
diff changeset
1226 v4 = *((char *)v2 + 93) == 0;
Ritor1
parents:
diff changeset
1227 v5 = a2;
Ritor1
parents:
diff changeset
1228 v16 = v3;
Ritor1
parents:
diff changeset
1229 if ( !v4 && *((char *)v2 + 96) )
Ritor1
parents:
diff changeset
1230 {
Ritor1
parents:
diff changeset
1231 if ( v3 - *((int *)v2 + 19) < 0xFA )
Ritor1
parents:
diff changeset
1232 {
Ritor1
parents:
diff changeset
1233 v6 = *(int *)a2;
Ritor1
parents:
diff changeset
1234 v7 = *(int *)(a2 + 4);
Ritor1
parents:
diff changeset
1235 v15 = 1;
Ritor1
parents:
diff changeset
1236 v12 = &AsyncMouse::unk::vdtor_ptr;
Ritor1
parents:
diff changeset
1237 v13 = v6;
Ritor1
parents:
diff changeset
1238 v14 = v7;
Ritor1
parents:
diff changeset
1239 v17 = 0;
Ritor1
parents:
diff changeset
1240 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
Ritor1
parents:
diff changeset
1241 v17 = -1;
Ritor1
parents:
diff changeset
1242 v3 = v16;
Ritor1
parents:
diff changeset
1243 }
Ritor1
parents:
diff changeset
1244 *((int *)v2 + 19) = v3;
Ritor1
parents:
diff changeset
1245 }
Ritor1
parents:
diff changeset
1246 if ( *((char *)v2 + 94) && *((char *)v2 + 97) )
Ritor1
parents:
diff changeset
1247 {
Ritor1
parents:
diff changeset
1248 if ( v3 - *((int *)v2 + 20) < 0xFA )
Ritor1
parents:
diff changeset
1249 {
Ritor1
parents:
diff changeset
1250 v8 = *(int *)v5;
Ritor1
parents:
diff changeset
1251 v9 = *(int *)(v5 + 4);
Ritor1
parents:
diff changeset
1252 v15 = 2;
Ritor1
parents:
diff changeset
1253 //v12 = &AsyncMouse::unk::vdtor_ptr;
Ritor1
parents:
diff changeset
1254 v13 = v8;
Ritor1
parents:
diff changeset
1255 v14 = v9;
Ritor1
parents:
diff changeset
1256 v17 = 1;
Ritor1
parents:
diff changeset
1257 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
Ritor1
parents:
diff changeset
1258 v17 = -1;
Ritor1
parents:
diff changeset
1259 v3 = v16;
Ritor1
parents:
diff changeset
1260 }
Ritor1
parents:
diff changeset
1261 *((int *)v2 + 20) = v3;
Ritor1
parents:
diff changeset
1262 }
Ritor1
parents:
diff changeset
1263 if ( *((char *)v2 + 95) && *((char *)v2 + 98) )
Ritor1
parents:
diff changeset
1264 {
Ritor1
parents:
diff changeset
1265 if ( v3 - *((int *)v2 + 21) < 0xFA )
Ritor1
parents:
diff changeset
1266 {
Ritor1
parents:
diff changeset
1267 v10 = *(int *)v5;
Ritor1
parents:
diff changeset
1268 v11 = *(int *)(v5 + 4);
Ritor1
parents:
diff changeset
1269 v15 = 4;
Ritor1
parents:
diff changeset
1270 //v12 = &AsyncMouse::unk::vdtor_ptr;
Ritor1
parents:
diff changeset
1271 v13 = v10;
Ritor1
parents:
diff changeset
1272 v14 = v11;
Ritor1
parents:
diff changeset
1273 v17 = 2;
Ritor1
parents:
diff changeset
1274 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
Ritor1
parents:
diff changeset
1275 v3 = v16;
Ritor1
parents:
diff changeset
1276 }
Ritor1
parents:
diff changeset
1277 *((int *)v2 + 21) = v3;
Ritor1
parents:
diff changeset
1278 }
Ritor1
parents:
diff changeset
1279 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
Ritor1
parents:
diff changeset
1280 }
Ritor1
parents:
diff changeset
1281
Ritor1
parents:
diff changeset
1282 //----- (0046B736) --------------------------------------------------------
Ritor1
parents:
diff changeset
1283 void AsyncMouse::_46B736_consume_click_lists(char a2)
Ritor1
parents:
diff changeset
1284 {
Ritor1
parents:
diff changeset
1285 __debugbreak();
Ritor1
parents:
diff changeset
1286 /*
Ritor1
parents:
diff changeset
1287 void *v2; // esi@1
Ritor1
parents:
diff changeset
1288
Ritor1
parents:
diff changeset
1289 v2 = this;
Ritor1
parents:
diff changeset
1290 _46B76F();
Ritor1
parents:
diff changeset
1291 _46B879();
Ritor1
parents:
diff changeset
1292 if ( a2 )
Ritor1
parents:
diff changeset
1293 {
Ritor1
parents:
diff changeset
1294 _46BCAB((char *)v2 + 104);
Ritor1
parents:
diff changeset
1295 _46BCAB((char *)v2 + 116);
Ritor1
parents:
diff changeset
1296 }
Ritor1
parents:
diff changeset
1297 if ( *((char *)v2 + 102) )
Ritor1
parents:
diff changeset
1298 {
Ritor1
parents:
diff changeset
1299 back_to_game();
Ritor1
parents:
diff changeset
1300 *((char *)v2 + 102) = 0;
Ritor1
parents:
diff changeset
1301 }*/
Ritor1
parents:
diff changeset
1302 }
Ritor1
parents:
diff changeset
1303
Ritor1
parents:
diff changeset
1304 //----- (0046B76F) --------------------------------------------------------
Ritor1
parents:
diff changeset
1305 void AsyncMouse::_46B76F()
Ritor1
parents:
diff changeset
1306 {
Ritor1
parents:
diff changeset
1307 __debugbreak();
Ritor1
parents:
diff changeset
1308 /*
Ritor1
parents:
diff changeset
1309 char *v0; // ebx@1
Ritor1
parents:
diff changeset
1310 int v1; // eax@1
Ritor1
parents:
diff changeset
1311 int v2; // edi@1
Ritor1
parents:
diff changeset
1312 int v3; // eax@2
Ritor1
parents:
diff changeset
1313 unsigned int *v4; // esi@2
Ritor1
parents:
diff changeset
1314 unsigned int v5; // ST08_4@7
Ritor1
parents:
diff changeset
1315 unsigned int v6; // ST04_4@7
Ritor1
parents:
diff changeset
1316 float v7; // ST00_4@7
Ritor1
parents:
diff changeset
1317 unsigned int v8; // ST08_4@9
Ritor1
parents:
diff changeset
1318 unsigned int v9; // ST04_4@9
Ritor1
parents:
diff changeset
1319 float v10; // ST00_4@9
Ritor1
parents:
diff changeset
1320
Ritor1
parents:
diff changeset
1321 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
Ritor1
parents:
diff changeset
1322 v0 = (char *)pAsyncMouse + 108;
Ritor1
parents:
diff changeset
1323 v1 = *((int *)pAsyncMouse + 27);
Ritor1
parents:
diff changeset
1324 v2 = *(int *)v1;
Ritor1
parents:
diff changeset
1325 if ( *(int *)v1 != v1 )
Ritor1
parents:
diff changeset
1326 {
Ritor1
parents:
diff changeset
1327 do
Ritor1
parents:
diff changeset
1328 {
Ritor1
parents:
diff changeset
1329 v3 = *(int *)(v2 + 20);
Ritor1
parents:
diff changeset
1330 v4 = (unsigned int *)(v2 + 12);
Ritor1
parents:
diff changeset
1331 if ( v3 & 1 )
Ritor1
parents:
diff changeset
1332 {
Ritor1
parents:
diff changeset
1333 pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4);
Ritor1
parents:
diff changeset
1334 if ( GetCurrentMenuID() == 6 )
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 920
diff changeset
1335 UI_OnKeyDown(VK_SELECT);
0
Ritor1
parents:
diff changeset
1336 UI_OnMouseLeftClick((int *)(v2 + 12));
Ritor1
parents:
diff changeset
1337 }
Ritor1
parents:
diff changeset
1338 else
Ritor1
parents:
diff changeset
1339 {
Ritor1
parents:
diff changeset
1340 if ( v3 & 2 )
Ritor1
parents:
diff changeset
1341 {
Ritor1
parents:
diff changeset
1342 v5 = *(int *)(v2 + 16);
Ritor1
parents:
diff changeset
1343 v6 = *v4;
Ritor1
parents:
diff changeset
1344 v7 = GetPickDepth();
Ritor1
parents:
diff changeset
1345 pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a5);
Ritor1
parents:
diff changeset
1346 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62((Vec2_int_ *)(v2 + 12));
Ritor1
parents:
diff changeset
1347 }
Ritor1
parents:
diff changeset
1348 else
Ritor1
parents:
diff changeset
1349 {
Ritor1
parents:
diff changeset
1350 if ( v3 & 4 )
Ritor1
parents:
diff changeset
1351 {
Ritor1
parents:
diff changeset
1352 v8 = *(int *)(v2 + 16);
Ritor1
parents:
diff changeset
1353 v9 = *v4;
Ritor1
parents:
diff changeset
1354 v10 = GetPickDepth();
Ritor1
parents:
diff changeset
1355 pGame->PickMouse(v10, v9, v8, 1, &a3, &a5);
Ritor1
parents:
diff changeset
1356 }
Ritor1
parents:
diff changeset
1357 }
Ritor1
parents:
diff changeset
1358 }
Ritor1
parents:
diff changeset
1359 v2 = *(int *)v2;
Ritor1
parents:
diff changeset
1360 }
Ritor1
parents:
diff changeset
1361 while ( v2 != *(int *)v0 );
Ritor1
parents:
diff changeset
1362 }
Ritor1
parents:
diff changeset
1363 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
Ritor1
parents:
diff changeset
1364 }
Ritor1
parents:
diff changeset
1365
Ritor1
parents:
diff changeset
1366 //----- (0046B879) --------------------------------------------------------
Ritor1
parents:
diff changeset
1367 void AsyncMouse::_46B879()
Ritor1
parents:
diff changeset
1368 {
Ritor1
parents:
diff changeset
1369 __debugbreak();
Ritor1
parents:
diff changeset
1370 /*
Ritor1
parents:
diff changeset
1371 char *v0; // ebx@1
Ritor1
parents:
diff changeset
1372 int v1; // eax@1
Ritor1
parents:
diff changeset
1373 int v2; // edi@1
Ritor1
parents:
diff changeset
1374 int v3; // eax@2
Ritor1
parents:
diff changeset
1375 unsigned int *v4; // esi@2
Ritor1
parents:
diff changeset
1376 unsigned int v5; // ST08_4@5
Ritor1
parents:
diff changeset
1377 unsigned int v6; // ST04_4@5
Ritor1
parents:
diff changeset
1378 float v7; // ST00_4@5
Ritor1
parents:
diff changeset
1379
Ritor1
parents:
diff changeset
1380 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
Ritor1
parents:
diff changeset
1381 v0 = (char *)pAsyncMouse + 120;
Ritor1
parents:
diff changeset
1382 v1 = *((int *)pAsyncMouse + 30);
Ritor1
parents:
diff changeset
1383 v2 = *(int *)v1;
Ritor1
parents:
diff changeset
1384 if ( *(int *)v1 != v1 )
Ritor1
parents:
diff changeset
1385 {
Ritor1
parents:
diff changeset
1386 do
Ritor1
parents:
diff changeset
1387 {
Ritor1
parents:
diff changeset
1388 v3 = *(int *)(v2 + 20);
Ritor1
parents:
diff changeset
1389 v4 = (unsigned int *)(v2 + 12);
Ritor1
parents:
diff changeset
1390 if ( v3 & 1 )
Ritor1
parents:
diff changeset
1391 {
Ritor1
parents:
diff changeset
1392 pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4);
Ritor1
parents:
diff changeset
1393 sub_4178C4();
Ritor1
parents:
diff changeset
1394 }
Ritor1
parents:
diff changeset
1395 else
Ritor1
parents:
diff changeset
1396 {
Ritor1
parents:
diff changeset
1397 if ( v3 & 2 )
Ritor1
parents:
diff changeset
1398 {
Ritor1
parents:
diff changeset
1399 v5 = *(int *)(v2 + 16);
Ritor1
parents:
diff changeset
1400 v6 = *v4;
Ritor1
parents:
diff changeset
1401 v7 = GetPickDepth();
Ritor1
parents:
diff changeset
1402 pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a4);
Ritor1
parents:
diff changeset
1403 sub_4178E1();
Ritor1
parents:
diff changeset
1404 }
Ritor1
parents:
diff changeset
1405 else
Ritor1
parents:
diff changeset
1406 {
Ritor1
parents:
diff changeset
1407 if ( v3 & 4 )
Ritor1
parents:
diff changeset
1408 nullsub_1();
Ritor1
parents:
diff changeset
1409 }
Ritor1
parents:
diff changeset
1410 }
Ritor1
parents:
diff changeset
1411 v2 = *(int *)v2;
Ritor1
parents:
diff changeset
1412 }
Ritor1
parents:
diff changeset
1413 while ( v2 != *(int *)v0 );
Ritor1
parents:
diff changeset
1414 }
Ritor1
parents:
diff changeset
1415 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
Ritor1
parents:
diff changeset
1416 }
Ritor1
parents:
diff changeset
1417
Ritor1
parents:
diff changeset
1418 //----- (0046B944) --------------------------------------------------------
Ritor1
parents:
diff changeset
1419 int AsyncMouse::_46B944()
Ritor1
parents:
diff changeset
1420 {
Ritor1
parents:
diff changeset
1421 __debugbreak();
Ritor1
parents:
diff changeset
1422 /*
Ritor1
parents:
diff changeset
1423 void *v1; // esi@1
Ritor1
parents:
diff changeset
1424
Ritor1
parents:
diff changeset
1425 v1 = this;
Ritor1
parents:
diff changeset
1426 _46BCAB((char *)this + 104);
Ritor1
parents:
diff changeset
1427 return _46BCAB((char *)v1 + 116);*/
Ritor1
parents:
diff changeset
1428 return 0;
Ritor1
parents:
diff changeset
1429 }
Ritor1
parents:
diff changeset
1430 // 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int);
Ritor1
parents:
diff changeset
1431
Ritor1
parents:
diff changeset
1432 //----- (0046B958) --------------------------------------------------------
Ritor1
parents:
diff changeset
1433 char AsyncMouse::_46B958(int a2, int a3)
Ritor1
parents:
diff changeset
1434 {
Ritor1
parents:
diff changeset
1435 __debugbreak();
Ritor1
parents:
diff changeset
1436 /*
Ritor1
parents:
diff changeset
1437 void *v3; // esi@1
Ritor1
parents:
diff changeset
1438 char result; // al@3
Ritor1
parents:
diff changeset
1439 int v5; // edx@6
Ritor1
parents:
diff changeset
1440 int v6; // eax@6
Ritor1
parents:
diff changeset
1441 int v7; // eax@12
Ritor1
parents:
diff changeset
1442 int v8; // edi@13
Ritor1
parents:
diff changeset
1443 int v9; // eax@19
Ritor1
parents:
diff changeset
1444 struct IDirectDrawSurface4 *v10; // ST08_4@21
Ritor1
parents:
diff changeset
1445 DDBLTFX v11; // [sp+4h] [bp-74h]@21
Ritor1
parents:
diff changeset
1446 RECT v12; // [sp+68h] [bp-10h]@19
Ritor1
parents:
diff changeset
1447
Ritor1
parents:
diff changeset
1448 v3 = this;
Ritor1
parents:
diff changeset
1449 if ( pRenderer->pFrontBuffer4 && !pRenderer->pFrontBuffer4->IsLost() )
Ritor1
parents:
diff changeset
1450 {
Ritor1
parents:
diff changeset
1451 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
Ritor1
parents:
diff changeset
1452 if ( *((char *)v3 + 88) )
Ritor1
parents:
diff changeset
1453 pRenderer->pFrontBuffer4->BltFast(
Ritor1
parents:
diff changeset
1454 *((int *)v3 + 8),
Ritor1
parents:
diff changeset
1455 *((int *)v3 + 9),
Ritor1
parents:
diff changeset
1456 (LPDIRECTDRAWSURFACE4)*((int *)v3 + 2),
Ritor1
parents:
diff changeset
1457 (LPRECT)((char *)v3 + 48),
Ritor1
parents:
diff changeset
1458 16u);
Ritor1
parents:
diff changeset
1459 v5 = 640 - a2;
Ritor1
parents:
diff changeset
1460 v6 = 640 - a2;
Ritor1
parents:
diff changeset
1461 if ( 640 - a2 >= 31 )
Ritor1
parents:
diff changeset
1462 v6 = 31;
Ritor1
parents:
diff changeset
1463 if ( v6 >= 0 )
Ritor1
parents:
diff changeset
1464 {
Ritor1
parents:
diff changeset
1465 if ( v5 >= 31 )
Ritor1
parents:
diff changeset
1466 v5 = 31;
Ritor1
parents:
diff changeset
1467 }
Ritor1
parents:
diff changeset
1468 else
Ritor1
parents:
diff changeset
1469 {
Ritor1
parents:
diff changeset
1470 v5 = 0;
Ritor1
parents:
diff changeset
1471 }
Ritor1
parents:
diff changeset
1472 v7 = 480 - a3;
Ritor1
parents:
diff changeset
1473 if ( 480 - a3 >= 31 )
Ritor1
parents:
diff changeset
1474 v8 = 31;
Ritor1
parents:
diff changeset
1475 else
Ritor1
parents:
diff changeset
1476 v8 = 480 - a3;
Ritor1
parents:
diff changeset
1477 if ( v8 >= 0 )
Ritor1
parents:
diff changeset
1478 {
Ritor1
parents:
diff changeset
1479 if ( v7 >= 31 )
Ritor1
parents:
diff changeset
1480 v7 = 31;
Ritor1
parents:
diff changeset
1481 }
Ritor1
parents:
diff changeset
1482 else
Ritor1
parents:
diff changeset
1483 {
Ritor1
parents:
diff changeset
1484 v7 = 0;
Ritor1
parents:
diff changeset
1485 }
Ritor1
parents:
diff changeset
1486 *((int *)v3 + 13) = 0;
Ritor1
parents:
diff changeset
1487 *((int *)v3 + 14) = v5;
Ritor1
parents:
diff changeset
1488 v12.right = a2 + v5;
Ritor1
parents:
diff changeset
1489 *((int *)v3 + 12) = 0;
Ritor1
parents:
diff changeset
1490 *((int *)v3 + 15) = v7;
Ritor1
parents:
diff changeset
1491 v12.left = a2;
Ritor1
parents:
diff changeset
1492 v12.bottom = a3 + v7;
Ritor1
parents:
diff changeset
1493 v9 = *((int *)v3 + 2);
Ritor1
parents:
diff changeset
1494 v12.top = a3;
Ritor1
parents:
diff changeset
1495 (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, RECT *, signed int))(*(int *)v9 + 28))(
Ritor1
parents:
diff changeset
1496 v9,
Ritor1
parents:
diff changeset
1497 0,
Ritor1
parents:
diff changeset
1498 0,
Ritor1
parents:
diff changeset
1499 pRenderer->pFrontBuffer4,
Ritor1
parents:
diff changeset
1500 &v12,
Ritor1
parents:
diff changeset
1501 16);
Ritor1
parents:
diff changeset
1502 if ( !*((char *)v3 + 90) || *((char *)v3 + 128) & 1 )
Ritor1
parents:
diff changeset
1503 {
Ritor1
parents:
diff changeset
1504 v10 = (struct IDirectDrawSurface4 *)*((int *)v3 + 1);
Ritor1
parents:
diff changeset
1505 v11.dwSize = 100;
Ritor1
parents:
diff changeset
1506 v11.dwDDFX = 8;
Ritor1
parents:
diff changeset
1507 pRenderer->pFrontBuffer4->Blt(
Ritor1
parents:
diff changeset
1508 &v12,
Ritor1
parents:
diff changeset
1509 v10,
Ritor1
parents:
diff changeset
1510 (LPRECT)((char *)v3 + 48),
Ritor1
parents:
diff changeset
1511 16812032u,
Ritor1
parents:
diff changeset
1512 &v11);
Ritor1
parents:
diff changeset
1513 }
Ritor1
parents:
diff changeset
1514 *((char *)v3 + 88) = 1;
Ritor1
parents:
diff changeset
1515 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);
Ritor1
parents:
diff changeset
1516 result = 1;
Ritor1
parents:
diff changeset
1517 }
Ritor1
parents:
diff changeset
1518 else
Ritor1
parents:
diff changeset
1519 {
Ritor1
parents:
diff changeset
1520 result = 0;
Ritor1
parents:
diff changeset
1521 }
Ritor1
parents:
diff changeset
1522 return result;*/
Ritor1
parents:
diff changeset
1523 return 0;
Ritor1
parents:
diff changeset
1524 }
Ritor1
parents:
diff changeset
1525
Ritor1
parents:
diff changeset
1526 //----- (0046BA8D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1527 char AsyncMouse::_46BA8D(int a2, int a3)
Ritor1
parents:
diff changeset
1528 {
Ritor1
parents:
diff changeset
1529 __debugbreak();
Ritor1
parents:
diff changeset
1530 /*
Ritor1
parents:
diff changeset
1531 void *v3; // esi@1
Ritor1
parents:
diff changeset
1532 DWORD v4; // eax@1
Ritor1
parents:
diff changeset
1533
Ritor1
parents:
diff changeset
1534 v3 = this;
Ritor1
parents:
diff changeset
1535 v4 = timeGetTime();
Ritor1
parents:
diff changeset
1536 if ( v4 - *((int *)v3 + 16) <= 0x32 )
Ritor1
parents:
diff changeset
1537 {
Ritor1
parents:
diff changeset
1538 *((char *)v3 + 91) = *((char *)v3 + 90) == 1;
Ritor1
parents:
diff changeset
1539 *((char *)v3 + 90) = 0;
Ritor1
parents:
diff changeset
1540 }
Ritor1
parents:
diff changeset
1541 else
Ritor1
parents:
diff changeset
1542 {
Ritor1
parents:
diff changeset
1543 if ( *((char *)v3 + 90) )
Ritor1
parents:
diff changeset
1544 *((char *)v3 + 91) = 0;
Ritor1
parents:
diff changeset
1545 else
Ritor1
parents:
diff changeset
1546 *((char *)v3 + 91) = 1;
Ritor1
parents:
diff changeset
1547 *((char *)v3 + 90) = 1;
Ritor1
parents:
diff changeset
1548 }
Ritor1
parents:
diff changeset
1549 if ( a2 != *((int *)v3 + 17) || a3 != *((int *)v3 + 18) )
Ritor1
parents:
diff changeset
1550 {
Ritor1
parents:
diff changeset
1551 *((int *)v3 + 16) = v4;
Ritor1
parents:
diff changeset
1552 *((int *)v3 + 17) = a2;
Ritor1
parents:
diff changeset
1553 *((int *)v3 + 18) = a3;
Ritor1
parents:
diff changeset
1554 }
Ritor1
parents:
diff changeset
1555 return *((char *)v3 + 90);*/
Ritor1
parents:
diff changeset
1556 return 0;
Ritor1
parents:
diff changeset
1557 }
Ritor1
parents:
diff changeset
1558
Ritor1
parents:
diff changeset
1559 //----- (0046BAEC) --------------------------------------------------------
Ritor1
parents:
diff changeset
1560 void AsyncMouse::_46BAEC()
Ritor1
parents:
diff changeset
1561 {
Ritor1
parents:
diff changeset
1562 void *v1; // esi@1
Ritor1
parents:
diff changeset
1563
Ritor1
parents:
diff changeset
1564 v1 = this;
Ritor1
parents:
diff changeset
1565 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
Ritor1
parents:
diff changeset
1566 *((char *)v1 + 88) = 0;
Ritor1
parents:
diff changeset
1567 }
Ritor1
parents:
diff changeset
1568
Ritor1
parents:
diff changeset
1569 //----- (0046BB0A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1570 void AsyncMouse::_46BB0A()
Ritor1
parents:
diff changeset
1571 {
Ritor1
parents:
diff changeset
1572 __debugbreak();
Ritor1
parents:
diff changeset
1573 /*
Ritor1
parents:
diff changeset
1574 void *v1; // esi@1
Ritor1
parents:
diff changeset
1575 int v2; // eax@1
Ritor1
parents:
diff changeset
1576 int v3; // edx@1
Ritor1
parents:
diff changeset
1577 int v4; // ecx@1
Ritor1
parents:
diff changeset
1578 int v5; // edx@1
Ritor1
parents:
diff changeset
1579 int v6; // eax@1
Ritor1
parents:
diff changeset
1580 char v7; // zf@1
Ritor1
parents:
diff changeset
1581 struct IDirectDrawSurface4 *v8; // ST08_4@8
Ritor1
parents:
diff changeset
1582 int v9; // [sp+8h] [bp-74h]@8
Ritor1
parents:
diff changeset
1583 int v10; // [sp+Ch] [bp-70h]@8
Ritor1
parents:
diff changeset
1584 int v11; // [sp+6Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
1585 int v12; // [sp+70h] [bp-Ch]@1
Ritor1
parents:
diff changeset
1586 int v13; // [sp+74h] [bp-8h]@1
Ritor1
parents:
diff changeset
1587 int v14; // [sp+78h] [bp-4h]@1
Ritor1
parents:
diff changeset
1588
Ritor1
parents:
diff changeset
1589 v1 = this;
Ritor1
parents:
diff changeset
1590 v2 = *((int *)this + 17) - *((int *)this + 10);
Ritor1
parents:
diff changeset
1591 v3 = *((int *)this + 14);
Ritor1
parents:
diff changeset
1592 v4 = *((int *)this + 18) - *((int *)this + 11);
Ritor1
parents:
diff changeset
1593 v11 = v2;
Ritor1
parents:
diff changeset
1594 v5 = v2 + v3;
Ritor1
parents:
diff changeset
1595 v6 = *((int *)v1 + 15);
Ritor1
parents:
diff changeset
1596 v12 = v4;
Ritor1
parents:
diff changeset
1597 v7 = *((char *)v1 + 90) == 0;
Ritor1
parents:
diff changeset
1598 v13 = v5;
Ritor1
parents:
diff changeset
1599 v14 = v4 + v6;
Ritor1
parents:
diff changeset
1600 if ( v7 || *((char *)v1 + 128) & 1 )
Ritor1
parents:
diff changeset
1601 {
Ritor1
parents:
diff changeset
1602 if ( *((char *)v1 + 88) )
Ritor1
parents:
diff changeset
1603 pRenderer->pFrontBuffer4->BltFast(
Ritor1
parents:
diff changeset
1604 *((int *)v1 + 8),
Ritor1
parents:
diff changeset
1605 *((int *)v1 + 9),
Ritor1
parents:
diff changeset
1606 (LPDIRECTDRAWSURFACE4)*((int *)v1 + 2),
Ritor1
parents:
diff changeset
1607 (LPRECT)((char *)v1 + 48),
Ritor1
parents:
diff changeset
1608 16u);
Ritor1
parents:
diff changeset
1609 (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, int *, signed int))(**((int **)v1 + 2) + 28))(
Ritor1
parents:
diff changeset
1610 *((int *)v1 + 2),
Ritor1
parents:
diff changeset
1611 0,
Ritor1
parents:
diff changeset
1612 0,
Ritor1
parents:
diff changeset
1613 pRenderer->pFrontBuffer4,
Ritor1
parents:
diff changeset
1614 &v11,
Ritor1
parents:
diff changeset
1615 16);
Ritor1
parents:
diff changeset
1616 }
Ritor1
parents:
diff changeset
1617 if ( *((char *)v1 + 90) && !(*((char *)v1 + 128) & 1) )
Ritor1
parents:
diff changeset
1618 {
Ritor1
parents:
diff changeset
1619 v8 = (struct IDirectDrawSurface4 *)*((int *)v1 + 1);
Ritor1
parents:
diff changeset
1620 v9 = 100;
Ritor1
parents:
diff changeset
1621 v10 = 8;
Ritor1
parents:
diff changeset
1622 pRenderer->pFrontBuffer4->Blt(
Ritor1
parents:
diff changeset
1623 (LPRECT)&v11,
Ritor1
parents:
diff changeset
1624 v8,
Ritor1
parents:
diff changeset
1625 (LPRECT)((char *)v1 + 48),
Ritor1
parents:
diff changeset
1626 16812032u,
Ritor1
parents:
diff changeset
1627 (LPDDBLTFX)&v9);
Ritor1
parents:
diff changeset
1628 }
Ritor1
parents:
diff changeset
1629 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);*/
Ritor1
parents:
diff changeset
1630 }
Ritor1
parents:
diff changeset
1631
Ritor1
parents:
diff changeset
1632 //----- (0046BBD0) --------------------------------------------------------
Ritor1
parents:
diff changeset
1633 void *AsyncMouse::Clip()
Ritor1
parents:
diff changeset
1634 {
Ritor1
parents:
diff changeset
1635 __debugbreak();
Ritor1
parents:
diff changeset
1636 /*
Ritor1
parents:
diff changeset
1637 void *result; // eax@1
Ritor1
parents:
diff changeset
1638 std::string v1; // [sp-18h] [bp-30h]@2
Ritor1
parents:
diff changeset
1639 const char *v2; // [sp-8h] [bp-20h]@2
Ritor1
parents:
diff changeset
1640 int v3; // [sp-4h] [bp-1Ch]@2
Ritor1
parents:
diff changeset
1641 RECT Rect; // [sp+0h] [bp-18h]@1
Ritor1
parents:
diff changeset
1642 std::string *v5; // [sp+10h] [bp-8h]@2
Ritor1
parents:
diff changeset
1643 int a3; // [sp+17h] [bp-1h]@2
Ritor1
parents:
diff changeset
1644
Ritor1
parents:
diff changeset
1645 SetWindowPos(hWnd, HWND_MESSAGE|0x2, 320, 240, 640, 480, 0);
Ritor1
parents:
diff changeset
1646 Rect.left = 325;
Ritor1
parents:
diff changeset
1647 Rect.top = 245;
Ritor1
parents:
diff changeset
1648 Rect.right = 326;
Ritor1
parents:
diff changeset
1649 Rect.bottom = 246;
Ritor1
parents:
diff changeset
1650 result = (void *)ClipCursor(&Rect);
Ritor1
parents:
diff changeset
1651 if ( !result )
Ritor1
parents:
diff changeset
1652 {
Ritor1
parents:
diff changeset
1653 MessageBoxW(nullptr, L"Could not clip cursor to screen!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:827", 0);
Ritor1
parents:
diff changeset
1654 }
Ritor1
parents:
diff changeset
1655 return result;*/
Ritor1
parents:
diff changeset
1656 return 0;
Ritor1
parents:
diff changeset
1657 }
Ritor1
parents:
diff changeset
1658
Ritor1
parents:
diff changeset
1659 //----- (0046BC4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1660 void __stdcall AsyncMouse::AsyncMouseThread(int a1)
Ritor1
parents:
diff changeset
1661 {
Ritor1
parents:
diff changeset
1662 __debugbreak();
Ritor1
parents:
diff changeset
1663 /*
Ritor1
parents:
diff changeset
1664 while ( 1 )
Ritor1
parents:
diff changeset
1665 {
Ritor1
parents:
diff changeset
1666 while ( !pAsyncMouse )
Ritor1
parents:
diff changeset
1667 Sleep(1);
Ritor1
parents:
diff changeset
1668 if ( !AsyncMouse::Thread(pAsyncMouse) )
Ritor1
parents:
diff changeset
1669 ExitThread(0);
Ritor1
parents:
diff changeset
1670 Sleep(18);
Ritor1
parents:
diff changeset
1671 }*/
Ritor1
parents:
diff changeset
1672 }
Ritor1
parents:
diff changeset
1673
Ritor1
parents:
diff changeset
1674 //----- (0046BC73) --------------------------------------------------------
Ritor1
parents:
diff changeset
1675 void AsyncMouse::dtor_sub_46BC73()
Ritor1
parents:
diff changeset
1676 {
Ritor1
parents:
diff changeset
1677 __debugbreak();
Ritor1
parents:
diff changeset
1678 /*
Ritor1
parents:
diff changeset
1679 int v1; // edi@1
Ritor1
parents:
diff changeset
1680 void **v2; // ebx@1
Ritor1
parents:
diff changeset
1681 void *v3; // esi@1
Ritor1
parents:
diff changeset
1682 void *v4; // eax@2
Ritor1
parents:
diff changeset
1683 int v5; // [sp+0h] [bp-4h]@1
Ritor1
parents:
diff changeset
1684
Ritor1
parents:
diff changeset
1685 v5 = this;
Ritor1
parents:
diff changeset
1686 v1 = this;
Ritor1
parents:
diff changeset
1687 v2 = *(void ***)(this + 4);
Ritor1
parents:
diff changeset
1688 v3 = *v2;
Ritor1
parents:
diff changeset
1689 while ( v3 != v2 )
Ritor1
parents:
diff changeset
1690 {
Ritor1
parents:
diff changeset
1691 v4 = v3;
Ritor1
parents:
diff changeset
1692 v3 = *(void **)v3;
Ritor1
parents:
diff changeset
1693 AsyncMouse::unk_46BD2D((void *)v1, (int)&v5, v4);
Ritor1
parents:
diff changeset
1694 }
Ritor1
parents:
diff changeset
1695 free(*(void **)(v1 + 4));
Ritor1
parents:
diff changeset
1696 *(int *)(v1 + 4) = 0;
Ritor1
parents:
diff changeset
1697 *(int *)(v1 + 8) = 0;*/
Ritor1
parents:
diff changeset
1698 }
Ritor1
parents:
diff changeset
1699
Ritor1
parents:
diff changeset
1700 //----- (0046BCAB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1701 int AsyncMouse::_46BCAB()
Ritor1
parents:
diff changeset
1702 {
Ritor1
parents:
diff changeset
1703 __debugbreak();
Ritor1
parents:
diff changeset
1704 /*
Ritor1
parents:
diff changeset
1705 void *v1; // ebx@1
Ritor1
parents:
diff changeset
1706 void **v2; // edi@1
Ritor1
parents:
diff changeset
1707 void *v3; // esi@1
Ritor1
parents:
diff changeset
1708 void *v4; // eax@2
Ritor1
parents:
diff changeset
1709 int result; // eax@2
Ritor1
parents:
diff changeset
1710 int v6; // [sp+0h] [bp-4h]@1
Ritor1
parents:
diff changeset
1711
Ritor1
parents:
diff changeset
1712 v6 = this;
Ritor1
parents:
diff changeset
1713 v1 = (void *)this;
Ritor1
parents:
diff changeset
1714 v2 = *(void ***)(this + 4);
Ritor1
parents:
diff changeset
1715 v3 = *v2;
Ritor1
parents:
diff changeset
1716 while ( v3 != v2 )
Ritor1
parents:
diff changeset
1717 {
Ritor1
parents:
diff changeset
1718 v4 = v3;
Ritor1
parents:
diff changeset
1719 v3 = *(void **)v3;
Ritor1
parents:
diff changeset
1720 result = AsyncMouse::unk_46BD2D(v1, (int)&v6, v4);
Ritor1
parents:
diff changeset
1721 }
Ritor1
parents:
diff changeset
1722 return result;*/
Ritor1
parents:
diff changeset
1723 return 0;
Ritor1
parents:
diff changeset
1724 }
Ritor1
parents:
diff changeset
1725 // 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int);
Ritor1
parents:
diff changeset
1726
Ritor1
parents:
diff changeset
1727 //----- (0046BCD2) --------------------------------------------------------
Ritor1
parents:
diff changeset
1728 int AsyncMouse::unk_46BCD2(int a2, int a3, int a4)
Ritor1
parents:
diff changeset
1729 {
Ritor1
parents:
diff changeset
1730 __debugbreak();
Ritor1
parents:
diff changeset
1731 /*
Ritor1
parents:
diff changeset
1732 void *v4; // edi@1
Ritor1
parents:
diff changeset
1733 void *v5; // eax@1
Ritor1
parents:
diff changeset
1734 void *v6; // esi@1
Ritor1
parents:
diff changeset
1735 int result; // eax@1
Ritor1
parents:
diff changeset
1736
Ritor1
parents:
diff changeset
1737 v4 = this;
Ritor1
parents:
diff changeset
1738 v5 = AsyncMouse::unk_46BD09((void *)a3, *(void **)(a3 + 4));
Ritor1
parents:
diff changeset
1739 v6 = v5;
Ritor1
parents:
diff changeset
1740 *(int *)(a3 + 4) = v5;
Ritor1
parents:
diff changeset
1741 **((int **)v5 + 1) = v5;
Ritor1
parents:
diff changeset
1742 AsyncMouse::unk_46BD66((char *)v5 + 8, a4);
Ritor1
parents:
diff changeset
1743 result = a2;
Ritor1
parents:
diff changeset
1744 ++*((int *)v4 + 2);
Ritor1
parents:
diff changeset
1745 *(int *)a2 = v6;
Ritor1
parents:
diff changeset
1746 return result;*/
Ritor1
parents:
diff changeset
1747 return 0;
Ritor1
parents:
diff changeset
1748 }
Ritor1
parents:
diff changeset
1749 // 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int);
Ritor1
parents:
diff changeset
1750
Ritor1
parents:
diff changeset
1751 //----- (0046BD09) --------------------------------------------------------
Ritor1
parents:
diff changeset
1752 void *AsyncMouse::unk_46BD09(void *a1, void *a2)
Ritor1
parents:
diff changeset
1753 {
Ritor1
parents:
diff changeset
1754 __debugbreak();
Ritor1
parents:
diff changeset
1755 /*
Ritor1
parents:
diff changeset
1756 void *result; // eax@1
Ritor1
parents:
diff changeset
1757 void *v3; // ecx@1
Ritor1
parents:
diff changeset
1758 void *v4; // ecx@3
Ritor1
parents:
diff changeset
1759
Ritor1
parents:
diff changeset
1760 result = operator new(0x18u);
Ritor1
parents:
diff changeset
1761 v3 = a1;
Ritor1
parents:
diff changeset
1762 if ( !a1 )
Ritor1
parents:
diff changeset
1763 v3 = result;
Ritor1
parents:
diff changeset
1764 *(int *)result = v3;
Ritor1
parents:
diff changeset
1765 v4 = a2;
Ritor1
parents:
diff changeset
1766 if ( !a2 )
Ritor1
parents:
diff changeset
1767 v4 = result;
Ritor1
parents:
diff changeset
1768 *((int *)result + 1) = v4;
Ritor1
parents:
diff changeset
1769 return result;*/
Ritor1
parents:
diff changeset
1770 return 0;
Ritor1
parents:
diff changeset
1771 }
Ritor1
parents:
diff changeset
1772
Ritor1
parents:
diff changeset
1773 //----- (0046BD2D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1774 int AsyncMouse::unk_46BD2D(int a2, void *a3)
Ritor1
parents:
diff changeset
1775 {
Ritor1
parents:
diff changeset
1776 __debugbreak();
Ritor1
parents:
diff changeset
1777 /*
Ritor1
parents:
diff changeset
1778 void *v3; // edi@1
Ritor1
parents:
diff changeset
1779 int v4; // ebx@1
Ritor1
parents:
diff changeset
1780 int result; // eax@1
Ritor1
parents:
diff changeset
1781
Ritor1
parents:
diff changeset
1782 v3 = this;
Ritor1
parents:
diff changeset
1783 v4 = *(int *)a3;
Ritor1
parents:
diff changeset
1784 **((int **)a3 + 1) = *(int *)a3;
Ritor1
parents:
diff changeset
1785 *(int *)(*(int *)a3 + 4) = *((int *)a3 + 1);
Ritor1
parents:
diff changeset
1786 (**((void (__stdcall ***)(int))a3 + 2))(0);
Ritor1
parents:
diff changeset
1787 free(a3);
Ritor1
parents:
diff changeset
1788 result = a2;
Ritor1
parents:
diff changeset
1789 --*((int *)v3 + 2);
Ritor1
parents:
diff changeset
1790 *(int *)a2 = v4;
Ritor1
parents:
diff changeset
1791 return result;*/
Ritor1
parents:
diff changeset
1792 return 0;
Ritor1
parents:
diff changeset
1793 }
Ritor1
parents:
diff changeset
1794
Ritor1
parents:
diff changeset
1795 //----- (0046BD66) --------------------------------------------------------
Ritor1
parents:
diff changeset
1796 int AsyncMouse::unk_46BD66(int a1, int a2)
Ritor1
parents:
diff changeset
1797 {
Ritor1
parents:
diff changeset
1798 int result; // eax@2
Ritor1
parents:
diff changeset
1799
Ritor1
parents:
diff changeset
1800 if ( a1 )
Ritor1
parents:
diff changeset
1801 {
Ritor1
parents:
diff changeset
1802 *(int *)(a1 + 4) = *(int *)(a2 + 4);
Ritor1
parents:
diff changeset
1803 *(int *)(a1 + 8) = *(int *)(a2 + 8);
Ritor1
parents:
diff changeset
1804 result = *(int *)(a2 + 12);
Ritor1
parents:
diff changeset
1805 *(int *)(a1 + 12) = result;
Ritor1
parents:
diff changeset
1806 //*(int *)a1 = &AsyncMouse::unk::vdtor_ptr;
Ritor1
parents:
diff changeset
1807 }
Ritor1
parents:
diff changeset
1808 return result;
Ritor1
parents:
diff changeset
1809 }
Ritor1
parents:
diff changeset
1810 // 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int);
Ritor1
parents:
diff changeset
1811 // 4D8734: using guessed type int (__stdcall *AsyncMouse__unk__vdtor_ptr)(char);
Ritor1
parents:
diff changeset
1812
Ritor1
parents:
diff changeset
1813
Ritor1
parents:
diff changeset
1814
Ritor1
parents:
diff changeset
1815
Ritor1
parents:
diff changeset
1816
Ritor1
parents:
diff changeset
1817
Ritor1
parents:
diff changeset
1818
Ritor1
parents:
diff changeset
1819
Ritor1
parents:
diff changeset
1820
Ritor1
parents:
diff changeset
1821
Ritor1
parents:
diff changeset
1822
Ritor1
parents:
diff changeset
1823
Ritor1
parents:
diff changeset
1824
Ritor1
parents:
diff changeset
1825
Ritor1
parents:
diff changeset
1826
Ritor1
parents:
diff changeset
1827
Ritor1
parents:
diff changeset
1828
Ritor1
parents:
diff changeset
1829
Ritor1
parents:
diff changeset
1830
Ritor1
parents:
diff changeset
1831 /*
Ritor1
parents:
diff changeset
1832 //----- (0043B9FF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1833 DirectInputMouse *__thiscall DirectInputMouse::DirectInputMouse(DirectInputMouse *this)
Ritor1
parents:
diff changeset
1834 {
Ritor1
parents:
diff changeset
1835 DirectInputMouse *v1; // esi@1
Ritor1
parents:
diff changeset
1836 HRESULT v2; // eax@5
Ritor1
parents:
diff changeset
1837 signed int v4; // [sp-18h] [bp-24h]@3
Ritor1
parents:
diff changeset
1838 char *v5; // [sp-14h] [bp-20h]@3
Ritor1
parents:
diff changeset
1839 int v6; // [sp-10h] [bp-1Ch]@3
Ritor1
parents:
diff changeset
1840 const char *v7; // [sp-Ch] [bp-18h]@3
Ritor1
parents:
diff changeset
1841 int v8; // [sp-8h] [bp-14h]@3
Ritor1
parents:
diff changeset
1842 unsigned int v9; // [sp-4h] [bp-10h]@3
Ritor1
parents:
diff changeset
1843 CheckHRESULT_stru0 v10; // [sp+8h] [bp-4h]@5
Ritor1
parents:
diff changeset
1844
Ritor1
parents:
diff changeset
1845 v1 = this;
Ritor1
parents:
diff changeset
1846 this->field_8 = 0;
Ritor1
parents:
diff changeset
1847 LOBYTE(this->field_1C) = 0;
Ritor1
parents:
diff changeset
1848 this->field_28 = 0;
Ritor1
parents:
diff changeset
1849 this->vdestructor_ptr = (int)&DirectInputMouse_pvdtor;
Ritor1
parents:
diff changeset
1850 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
Ritor1
parents:
diff changeset
1851 {
Ritor1
parents:
diff changeset
1852 v9 = 1;
Ritor1
parents:
diff changeset
1853 v8 = 30;
Ritor1
parents:
diff changeset
1854 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp";
Ritor1
parents:
diff changeset
1855 v6 = 0;
Ritor1
parents:
diff changeset
1856 v5 = (char *)&this->pDirectInput;
Ritor1
parents:
diff changeset
1857 v4 = 1280;
Ritor1
parents:
diff changeset
1858 }
Ritor1
parents:
diff changeset
1859 else
Ritor1
parents:
diff changeset
1860 {
Ritor1
parents:
diff changeset
1861 v9 = 1;
Ritor1
parents:
diff changeset
1862 v8 = 28;
Ritor1
parents:
diff changeset
1863 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp";
Ritor1
parents:
diff changeset
1864 v6 = 0;
Ritor1
parents:
diff changeset
1865 v5 = (char *)&this->pDirectInput;
Ritor1
parents:
diff changeset
1866 v4 = 768;
Ritor1
parents:
diff changeset
1867 }
Ritor1
parents:
diff changeset
1868 v2 = DirectInputCreateA(hInstance, v4, v5, v6);
Ritor1
parents:
diff changeset
1869 CheckHRESULT(&v10, v2, v7, v8, v9);
Ritor1
parents:
diff changeset
1870 DirectInputMouse::CreateDevice(v1);
Ritor1
parents:
diff changeset
1871 DirectInputMouse::43BB18(v1);
Ritor1
parents:
diff changeset
1872 v1->field_20 = 0;
Ritor1
parents:
diff changeset
1873 v1->field_24 = 0;
Ritor1
parents:
diff changeset
1874 return v1;
Ritor1
parents:
diff changeset
1875 }
Ritor1
parents:
diff changeset
1876 // 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int);
Ritor1
parents:
diff changeset
1877 // 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char);
Ritor1
parents:
diff changeset
1878
Ritor1
parents:
diff changeset
1879 //----- (0043BA80) --------------------------------------------------------
Ritor1
parents:
diff changeset
1880 void *__thiscall DirectInputMouse::vdtor(void *this, bool a2)
Ritor1
parents:
diff changeset
1881 {
Ritor1
parents:
diff changeset
1882 void *v2; // esi@1
Ritor1
parents:
diff changeset
1883
Ritor1
parents:
diff changeset
1884 v2 = this;
Ritor1
parents:
diff changeset
1885 DirectInputMouse::dtor(this);
Ritor1
parents:
diff changeset
1886 if ( a2 & 1 )
Ritor1
parents:
diff changeset
1887 free(v2);
Ritor1
parents:
diff changeset
1888 return v2;
Ritor1
parents:
diff changeset
1889 }
Ritor1
parents:
diff changeset
1890
Ritor1
parents:
diff changeset
1891 //----- (0043BA9C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1892 int __thiscall DirectInputMouse::dtor(void *this)
Ritor1
parents:
diff changeset
1893 {
Ritor1
parents:
diff changeset
1894 void *v1; // esi@1
Ritor1
parents:
diff changeset
1895 int v2; // eax@1
Ritor1
parents:
diff changeset
1896 int result; // eax@3
Ritor1
parents:
diff changeset
1897
Ritor1
parents:
diff changeset
1898 v1 = this;
Ritor1
parents:
diff changeset
1899 v2 = *((int *)this + 2);
Ritor1
parents:
diff changeset
1900 *(int *)this = &DirectInputMouse_pvdtor;
Ritor1
parents:
diff changeset
1901 if ( v2 )
Ritor1
parents:
diff changeset
1902 {
Ritor1
parents:
diff changeset
1903 (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2);
Ritor1
parents:
diff changeset
1904 (*(void (__stdcall **)(int))(**((int **)v1 + 2) + 8))(*((int *)v1 + 2));
Ritor1
parents:
diff changeset
1905 *((int *)v1 + 2) = 0;
Ritor1
parents:
diff changeset
1906 }
Ritor1
parents:
diff changeset
1907 result = (*(int (__stdcall **)(int))(**((int **)v1 + 1) + 8))(*((int *)v1 + 1));
Ritor1
parents:
diff changeset
1908 *((int *)v1 + 1) = 0;
Ritor1
parents:
diff changeset
1909 return result;
Ritor1
parents:
diff changeset
1910 }
Ritor1
parents:
diff changeset
1911 // 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char);
Ritor1
parents:
diff changeset
1912
Ritor1
parents:
diff changeset
1913 //----- (0043BACE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1914 void __thiscall DirectInputMouse::CreateDevice(DirectInputMouse *this)
Ritor1
parents:
diff changeset
1915 {
Ritor1
parents:
diff changeset
1916 DirectInputMouse *v1; // esi@1
Ritor1
parents:
diff changeset
1917 HRESULT v2; // eax@1
Ritor1
parents:
diff changeset
1918 CheckHRESULT_stru0 v3; // [sp+4h] [bp-4h]@1
Ritor1
parents:
diff changeset
1919
Ritor1
parents:
diff changeset
1920 v1 = this;
Ritor1
parents:
diff changeset
1921 v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_10)(
Ritor1
parents:
diff changeset
1922 this->pDirectInput,
Ritor1
parents:
diff changeset
1923 2,
Ritor1
parents:
diff changeset
1924 DirectInputMouse_enumerator,
Ritor1
parents:
diff changeset
1925 this,
Ritor1
parents:
diff changeset
1926 1);
Ritor1
parents:
diff changeset
1927 CheckHRESULT(&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 57, 1u);
Ritor1
parents:
diff changeset
1928 if ( !LOBYTE(v1->field_1C) )
Ritor1
parents:
diff changeset
1929 {
Ritor1
parents:
diff changeset
1930 v3.vdestructor_ptr = (void (__thiscall ***)(CheckHRESULT_stru0 *, bool))"Error: No mouse found";
Ritor1
parents:
diff changeset
1931 _CxxThrowException((int)&v3, (int)&dword_4DBD94);
Ritor1
parents:
diff changeset
1932 }
Ritor1
parents:
diff changeset
1933 }
Ritor1
parents:
diff changeset
1934 // 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int);
Ritor1
parents:
diff changeset
1935 // 4DBD94: using guessed type int dword_4DBD94;
Ritor1
parents:
diff changeset
1936
Ritor1
parents:
diff changeset
1937 //----- (0043BB18) --------------------------------------------------------
Ritor1
parents:
diff changeset
1938 int __thiscall DirectInputMouse::43BB18(DirectInputMouse *this)
Ritor1
parents:
diff changeset
1939 {
Ritor1
parents:
diff changeset
1940 char *v1; // esi@1
Ritor1
parents:
diff changeset
1941 HRESULT v2; // eax@1
Ritor1
parents:
diff changeset
1942 HRESULT v3; // eax@1
Ritor1
parents:
diff changeset
1943 HRESULT v4; // eax@1
Ritor1
parents:
diff changeset
1944 unsigned int v6; // [sp+0h] [bp-Ch]@0
Ritor1
parents:
diff changeset
1945 CheckHRESULT_stru0 v7; // [sp+8h] [bp-4h]@1
Ritor1
parents:
diff changeset
1946
Ritor1
parents:
diff changeset
1947 v1 = (char *)&this->field_8;
Ritor1
parents:
diff changeset
1948 v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_C)(
Ritor1
parents:
diff changeset
1949 this->pDirectInput,
Ritor1
parents:
diff changeset
1950 &this->field_C,
Ritor1
parents:
diff changeset
1951 &this->field_8,
Ritor1
parents:
diff changeset
1952 0,
Ritor1
parents:
diff changeset
1953 "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp");
Ritor1
parents:
diff changeset
1954 CheckHRESULT(&v7, v2, (const char *)0x40, 1, v6);
Ritor1
parents:
diff changeset
1955 v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9920);
Ritor1
parents:
diff changeset
1956 CheckHRESULT(&v7, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 65, 1u);
Ritor1
parents:
diff changeset
1957 v4 = (*(int (__stdcall **)(int, int, int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6);
Ritor1
parents:
diff changeset
1958 CheckHRESULT(&v7, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 66, 1u);
Ritor1
parents:
diff changeset
1959 return (*(int (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1);
Ritor1
parents:
diff changeset
1960 }
Ritor1
parents:
diff changeset
1961 // 4C9920: using guessed type int dword_4C9920[16];
Ritor1
parents:
diff changeset
1962
Ritor1
parents:
diff changeset
1963 //----- (0043BB89) --------------------------------------------------------
Ritor1
parents:
diff changeset
1964 bool __thiscall DirectInputMouse::43BB89(DirectInputMouse *this)
Ritor1
parents:
diff changeset
1965 {
Ritor1
parents:
diff changeset
1966 DirectInputMouse *v1; // esi@1
Ritor1
parents:
diff changeset
1967 bool result; // eax@1
Ritor1
parents:
diff changeset
1968 HRESULT v3; // eax@5
Ritor1
parents:
diff changeset
1969 __int32 v4; // ecx@6
Ritor1
parents:
diff changeset
1970 __int32 v5; // eax@6
Ritor1
parents:
diff changeset
1971 __int32 v6; // edx@6
Ritor1
parents:
diff changeset
1972 int v7; // ecx@12
Ritor1
parents:
diff changeset
1973 bool v8; // ecx@12
Ritor1
parents:
diff changeset
1974 signed int v9; // edx@12
Ritor1
parents:
diff changeset
1975 HRESULT a2; // [sp+4h] [bp-14h]@3
Ritor1
parents:
diff changeset
1976 int v11; // [sp+8h] [bp-10h]@12
Ritor1
parents:
diff changeset
1977 char v12; // [sp+10h] [bp-8h]@18
Ritor1
parents:
diff changeset
1978 char v13; // [sp+11h] [bp-7h]@20
Ritor1
parents:
diff changeset
1979 char v14; // [sp+12h] [bp-6h]@22
Ritor1
parents:
diff changeset
1980 char v15; // [sp+13h] [bp-5h]@24
Ritor1
parents:
diff changeset
1981 char v18; // [sp+14h] [bp-4h]@5
Ritor1
parents:
diff changeset
1982
Ritor1
parents:
diff changeset
1983 v1 = this;
Ritor1
parents:
diff changeset
1984 result = this->field_8;
Ritor1
parents:
diff changeset
1985 if ( result )
Ritor1
parents:
diff changeset
1986 {
Ritor1
parents:
diff changeset
1987 if ( (*(int (__stdcall **)(bool, signed int, HRESULT *))(*(int *)result + 36))(result, 16, &a2) == -2147024866
Ritor1
parents:
diff changeset
1988 && !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) )
Ritor1
parents:
diff changeset
1989 {
Ritor1
parents:
diff changeset
1990 v3 = (*(int (__stdcall **)(int, signed int, HRESULT *))(*(int *)v1->field_8 + 36))(v1->field_8, 16, &a2);
Ritor1
parents:
diff changeset
1991 CheckHRESULT((CheckHRESULT_stru0 *)&v18, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 80, 1u);
Ritor1
parents:
diff changeset
1992 }
Ritor1
parents:
diff changeset
1993 v4 = v1->field_20 + a2;
Ritor1
parents:
diff changeset
1994 v5 = 640;
Ritor1
parents:
diff changeset
1995 v6 = v1->field_20 + a2;
Ritor1
parents:
diff changeset
1996 if ( v4 >= 640 )
Ritor1
parents:
diff changeset
1997 v6 = 640;
Ritor1
parents:
diff changeset
1998 if ( v6 >= 0 )
Ritor1
parents:
diff changeset
1999 {
Ritor1
parents:
diff changeset
2000 if ( v4 < 640 )
Ritor1
parents:
diff changeset
2001 v5 = v1->field_20 + a2;
Ritor1
parents:
diff changeset
2002 }
Ritor1
parents:
diff changeset
2003 else
Ritor1
parents:
diff changeset
2004 {
Ritor1
parents:
diff changeset
2005 v5 = 0;
Ritor1
parents:
diff changeset
2006 }
Ritor1
parents:
diff changeset
2007 v7 = v11;
Ritor1
parents:
diff changeset
2008 v1->field_20 = v5;
Ritor1
parents:
diff changeset
2009 v8 = v1->field_24 + v7;
Ritor1
parents:
diff changeset
2010 result = 480;
Ritor1
parents:
diff changeset
2011 v9 = v8;
Ritor1
parents:
diff changeset
2012 if ( v8 >= 480 )
Ritor1
parents:
diff changeset
2013 v9 = 480;
Ritor1
parents:
diff changeset
2014 if ( v9 >= 0 )
Ritor1
parents:
diff changeset
2015 {
Ritor1
parents:
diff changeset
2016 if ( v8 < 480 )
Ritor1
parents:
diff changeset
2017 result = v8;
Ritor1
parents:
diff changeset
2018 }
Ritor1
parents:
diff changeset
2019 else
Ritor1
parents:
diff changeset
2020 {
Ritor1
parents:
diff changeset
2021 result = 0;
Ritor1
parents:
diff changeset
2022 }
Ritor1
parents:
diff changeset
2023 v1->field_28 = 0;
Ritor1
parents:
diff changeset
2024 v1->field_24 = result;
Ritor1
parents:
diff changeset
2025 if ( v12 & 0x80 )
Ritor1
parents:
diff changeset
2026 v1->field_28 = 1;
Ritor1
parents:
diff changeset
2027 if ( v13 & 0x80 )
Ritor1
parents:
diff changeset
2028 v1->field_28 |= 2u;
Ritor1
parents:
diff changeset
2029 if ( v14 & 0x80 )
Ritor1
parents:
diff changeset
2030 v1->field_28 |= 4u;
Ritor1
parents:
diff changeset
2031 if ( v15 & 0x80 )
Ritor1
parents:
diff changeset
2032 v1->field_28 |= 8u;
Ritor1
parents:
diff changeset
2033 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
2034 }
Ritor1
parents:
diff changeset
2035 else
Ritor1
parents:
diff changeset
2036 {
Ritor1
parents:
diff changeset
2037 LOBYTE(result) = 0;
Ritor1
parents:
diff changeset
2038 }
Ritor1
parents:
diff changeset
2039 return result;
Ritor1
parents:
diff changeset
2040 }
Ritor1
parents:
diff changeset
2041
Ritor1
parents:
diff changeset
2042 //----- (0043BC61) --------------------------------------------------------
Ritor1
parents:
diff changeset
2043 signed int __stdcall DirectInputMouse_enumerator(int a1, int a2)
Ritor1
parents:
diff changeset
2044 {
Ritor1
parents:
diff changeset
2045 signed int result; // eax@2
Ritor1
parents:
diff changeset
2046
Ritor1
parents:
diff changeset
2047 if ( *(char *)(a1 + 36) & 2 )
Ritor1
parents:
diff changeset
2048 {
Ritor1
parents:
diff changeset
2049 *(int *)(a2 + 12) = *(int *)(a1 + 4);
Ritor1
parents:
diff changeset
2050 *(int *)(a2 + 16) = *(int *)(a1 + 8);
Ritor1
parents:
diff changeset
2051 *(int *)(a2 + 20) = *(int *)(a1 + 12);
Ritor1
parents:
diff changeset
2052 *(int *)(a2 + 24) = *(int *)(a1 + 16);
Ritor1
parents:
diff changeset
2053 *(char *)(a2 + 28) = 1;
Ritor1
parents:
diff changeset
2054 result = 0;
Ritor1
parents:
diff changeset
2055 }
Ritor1
parents:
diff changeset
2056 else
Ritor1
parents:
diff changeset
2057 {
Ritor1
parents:
diff changeset
2058 result = 1;
Ritor1
parents:
diff changeset
2059 }
Ritor1
parents:
diff changeset
2060 return result;
Ritor1
parents:
diff changeset
2061 }
Ritor1
parents:
diff changeset
2062 // 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int);
Ritor1
parents:
diff changeset
2063 */