annotate Mouse.cpp @ 1049:efe228ab5003

IntersectBModel_sub
author Ritor1
date Thu, 23 May 2013 13:00:29 +0600
parents 39f42990698f
children 6cbf4eb0f953
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
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 //----- (00469860) --------------------------------------------------------
Ritor1
parents:
diff changeset
24 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
Ritor1
parents:
diff changeset
25 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
26 *pX = uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
27 *pY = uMouseClickY;
0
Ritor1
parents:
diff changeset
28 }
Ritor1
parents:
diff changeset
29
Ritor1
parents:
diff changeset
30 //----- (004698A6) --------------------------------------------------------
Ritor1
parents:
diff changeset
31 void Mouse::RemoveHoldingItem()
Ritor1
parents:
diff changeset
32 {
Ritor1
parents:
diff changeset
33 pParty->pPickedItem.Reset();
Ritor1
parents:
diff changeset
34 if (strcmpi(pCurrentCursorName, "MICON2"))
Ritor1
parents:
diff changeset
35 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
36 }
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38 //----- (004698D8) --------------------------------------------------------
Ritor1
parents:
diff changeset
39 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
Ritor1
parents:
diff changeset
40 {
Ritor1
parents:
diff changeset
41 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
Ritor1
parents:
diff changeset
42 }
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 //----- (004698F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
45 void Mouse::SetCurrentCursorBitmap()
Ritor1
parents:
diff changeset
46 {
Ritor1
parents:
diff changeset
47 SetCursorBitmap(pCurrentCursorName);
Ritor1
parents:
diff changeset
48 }
Ritor1
parents:
diff changeset
49
Ritor1
parents:
diff changeset
50 //----- (00469903) --------------------------------------------------------
Ritor1
parents:
diff changeset
51 void Mouse::SetCursorBitmap(const char *pName)
Ritor1
parents:
diff changeset
52 {
Ritor1
parents:
diff changeset
53 Mouse *v2; // esi@1
Ritor1
parents:
diff changeset
54 HCURSOR v3; // eax@10
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
55 //int v4; // ecx@10
0
Ritor1
parents:
diff changeset
56 double v5; // st7@11
Ritor1
parents:
diff changeset
57 float v6; // ST04_4@12
Ritor1
parents:
diff changeset
58 LONG v7; // eax@14
Ritor1
parents:
diff changeset
59 LONG v8; // eax@17
Ritor1
parents:
diff changeset
60 unsigned int v9; // eax@21
Ritor1
parents:
diff changeset
61 float v10; // [sp+4h] [bp-18h]@11
Ritor1
parents:
diff changeset
62 struct tagPOINT Point; // [sp+14h] [bp-8h]@20
Ritor1
parents:
diff changeset
63
Ritor1
parents:
diff changeset
64 v2 = this;
Ritor1
parents:
diff changeset
65 if ( !this->bInitialized || !pName )
Ritor1
parents:
diff changeset
66 return;
Ritor1
parents:
diff changeset
67 if ( _strcmpi("MICON2", pName) )
Ritor1
parents:
diff changeset
68 pGame->uFlags2 &= 0xFFFFFFEFu;
Ritor1
parents:
diff changeset
69 else
Ritor1
parents:
diff changeset
70 pGame->uFlags2 |= 0x10u;
Ritor1
parents:
diff changeset
71 if ( _strcmpi(v2->pCurrentCursorName, pName) )
Ritor1
parents:
diff changeset
72 strcpy(v2->pCurrentCursorName, pName);
Ritor1
parents:
diff changeset
73 ClearCursor();
Ritor1
parents:
diff changeset
74 if ( _strnicmp(pName, "MICON1", 5u) )
Ritor1
parents:
diff changeset
75 {
Ritor1
parents:
diff changeset
76 v9 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
77 v2->uCursorTextureID = v9;
Ritor1
parents:
diff changeset
78 v2->uCursorTextureID_2 = v9;
Ritor1
parents:
diff changeset
79 v2->AllocCursorSystemMem();
Ritor1
parents:
diff changeset
80 v2->field_C = 0;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
81 v2->bRedraw = 1;
0
Ritor1
parents:
diff changeset
82 v2->bActive = 1;
Ritor1
parents:
diff changeset
83 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
84 {
Ritor1
parents:
diff changeset
85 if (uCursorTextureID != -1)
Ritor1
parents:
diff changeset
86 pIcons_LOD->pTextures[uCursorTextureID].Release();
1006
e865f349aa41 ui cleanup
Gloval
parents: 973
diff changeset
87 pIcons_LOD->SyncLoadedFilesCount();
0
Ritor1
parents:
diff changeset
88 }
Ritor1
parents:
diff changeset
89 return;
Ritor1
parents:
diff changeset
90 }
Ritor1
parents:
diff changeset
91 v2->bActive = 0;
Ritor1
parents:
diff changeset
92 v2->field_C = 1;
Ritor1
parents:
diff changeset
93 if ( !strcmp(pName, "MICON1") )
Ritor1
parents:
diff changeset
94 {
Ritor1
parents:
diff changeset
95 v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow");
Ritor1
parents:
diff changeset
96 SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
97 /*if (pAsyncMouse)
0
Ritor1
parents:
diff changeset
98 {
Ritor1
parents:
diff changeset
99 v10 = 0.0;
Ritor1
parents:
diff changeset
100 v5 = 0.0;
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
101 //LABEL_12:
0
Ritor1
parents:
diff changeset
102 v6 = v5;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
103
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
104 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
105 SetCursorPos(Point.x, Point.y);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
106
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
107 return;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
108 }*/
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
109 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
110 ClientToScreen(hWnd,&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
111 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
112 return;
0
Ritor1
parents:
diff changeset
113 }
Ritor1
parents:
diff changeset
114 if ( !strcmp(pName, "MICON2") )
Ritor1
parents:
diff changeset
115 {
Ritor1
parents:
diff changeset
116 v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target");
Ritor1
parents:
diff changeset
117 SetClassLongA(hWnd, -12, v7);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
118 /*if (pAsyncMouse)
0
Ritor1
parents:
diff changeset
119 {
Ritor1
parents:
diff changeset
120 v10 = 14.0;
Ritor1
parents:
diff changeset
121 v5 = 14.0;
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
122 v6 = v5;
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
123 pAsyncMouse->SetHotspot(v6, v10);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
124 if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) )
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
125 {
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
126 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
127 SetCursorPos(Point.x, Point.y);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
128 }
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
129 return;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
130 }*/
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
131 //LABEL_20:
0
Ritor1
parents:
diff changeset
132 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
133 SetCursorPos(Point.x, Point.y);
Ritor1
parents:
diff changeset
134 return;
Ritor1
parents:
diff changeset
135 }
Ritor1
parents:
diff changeset
136 if ( !strcmp(pName, "MICON3") )
Ritor1
parents:
diff changeset
137 {
Ritor1
parents:
diff changeset
138 v8 = (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT);
Ritor1
parents:
diff changeset
139 SetClassLongA(hWnd, -12, v8);
Ritor1
parents:
diff changeset
140 }
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
141 //LABEL_18:
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
142
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
143 GetCursorPos(&Point);
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
144 SetCursorPos(Point.x, Point.y);
0
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
147
Ritor1
parents:
diff changeset
148 //----- (00469AE4) --------------------------------------------------------
Ritor1
parents:
diff changeset
149 LONG Mouse::_469AE4()
Ritor1
parents:
diff changeset
150 {
Ritor1
parents:
diff changeset
151 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
152 LONG v2; // ecx@2
Ritor1
parents:
diff changeset
153 LONG result; // eax@2
Ritor1
parents:
diff changeset
154 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
155
Ritor1
parents:
diff changeset
156 v1 = this;
Ritor1
parents:
diff changeset
157 this->field_8 = 1;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
158 /*if (pAsyncMouse)
0
Ritor1
parents:
diff changeset
159 {
Ritor1
parents:
diff changeset
160 v2 = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
161 Point.x = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
162 result = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
163 }
Ritor1
parents:
diff changeset
164 else
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
165 {*/
0
Ritor1
parents:
diff changeset
166 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
167 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
168 ScreenToClient(hWnd, &Point);
Ritor1
parents:
diff changeset
169 result = Point.y;
Ritor1
parents:
diff changeset
170 v2 = Point.x;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
171 //}
0
Ritor1
parents:
diff changeset
172 v1->uMouseClickX = v2;
Ritor1
parents:
diff changeset
173 v1->uMouseClickY = result;
Ritor1
parents:
diff changeset
174 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
175 goto LABEL_16;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
176 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
177 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
178 if ( v2 < 0 )
Ritor1
parents:
diff changeset
179 v2 = 0;
Ritor1
parents:
diff changeset
180 if ( result < 0 )
Ritor1
parents:
diff changeset
181 result = 0;
Ritor1
parents:
diff changeset
182 if ( v2 > 639 )
Ritor1
parents:
diff changeset
183 v2 = 639;
Ritor1
parents:
diff changeset
184 if ( result > 479 )
Ritor1
parents:
diff changeset
185 {
Ritor1
parents:
diff changeset
186 result = 479;
Ritor1
parents:
diff changeset
187 LABEL_16:
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
188 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
189 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
190 if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) )
Ritor1
parents:
diff changeset
191 goto LABEL_23;
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193 if ( v1->field_C )
Ritor1
parents:
diff changeset
194 LABEL_23:
Ritor1
parents:
diff changeset
195 v1->bActive = 0;
Ritor1
parents:
diff changeset
196 LABEL_24:
Ritor1
parents:
diff changeset
197 v1->field_8 = 0;
Ritor1
parents:
diff changeset
198 return result;
Ritor1
parents:
diff changeset
199 }
Ritor1
parents:
diff changeset
200
Ritor1
parents:
diff changeset
201 //----- (00469BA3) --------------------------------------------------------
Ritor1
parents:
diff changeset
202 void Mouse::ClearCursor()
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
205 void *v2; // eax@1
Ritor1
parents:
diff changeset
206 void **v3; // esi@5
Ritor1
parents:
diff changeset
207
Ritor1
parents:
diff changeset
208 v1 = this;
Ritor1
parents:
diff changeset
209 v2 = this->pCursorBitmap_sysmem;
Ritor1
parents:
diff changeset
210 this->bActive = 0;
Ritor1
parents:
diff changeset
211 if ( v2 )
Ritor1
parents:
diff changeset
212 {
Ritor1
parents:
diff changeset
213 free(v2);
Ritor1
parents:
diff changeset
214 v1->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
215 }
Ritor1
parents:
diff changeset
216 if ( v1->pCursorBitmap2_sysmem )
Ritor1
parents:
diff changeset
217 {
Ritor1
parents:
diff changeset
218 free(v1->pCursorBitmap2_sysmem);
Ritor1
parents:
diff changeset
219 v1->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 v3 = &v1->ptr_90;
Ritor1
parents:
diff changeset
222 if ( *v3 )
Ritor1
parents:
diff changeset
223 free(*v3);
Ritor1
parents:
diff changeset
224 *v3 = 0;
Ritor1
parents:
diff changeset
225 }
Ritor1
parents:
diff changeset
226
Ritor1
parents:
diff changeset
227 //----- (00469BE6) --------------------------------------------------------
Ritor1
parents:
diff changeset
228 void Mouse::AllocCursorSystemMem()
Ritor1
parents:
diff changeset
229 {
Ritor1
parents:
diff changeset
230 bActive = 0;
Ritor1
parents:
diff changeset
231 if (!pCursorBitmap_sysmem)
Ritor1
parents:
diff changeset
232 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
233 if (!pCursorBitmap2_sysmem)
Ritor1
parents:
diff changeset
234 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
235 }
Ritor1
parents:
diff changeset
236
Ritor1
parents:
diff changeset
237 //----- (00469C0D) --------------------------------------------------------
Ritor1
parents:
diff changeset
238 void *Mouse::DoAllocCursorMem()
Ritor1
parents:
diff changeset
239 {
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
240 auto tex = pIcons_LOD->GetTexture(uCursorTextureID);
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
241 return malloc(4 * tex->uTextureWidth * tex->uTextureHeight);
0
Ritor1
parents:
diff changeset
242 }
Ritor1
parents:
diff changeset
243
Ritor1
parents:
diff changeset
244 //----- (00469C39) --------------------------------------------------------
Ritor1
parents:
diff changeset
245 POINT *Mouse::GetCursorPos(POINT *a2)
Ritor1
parents:
diff changeset
246 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
247 a2->x = this->uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
248 a2->y = this->uMouseClickY;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
249 return a2;
0
Ritor1
parents:
diff changeset
250 }
Ritor1
parents:
diff changeset
251
Ritor1
parents:
diff changeset
252 //----- (00469C65) --------------------------------------------------------
Ritor1
parents:
diff changeset
253 void Mouse::Initialize(HWND hWnd)
Ritor1
parents:
diff changeset
254 {
Ritor1
parents:
diff changeset
255 this->hWnd = hWnd;
Ritor1
parents:
diff changeset
256 this->bActive = 0;
Ritor1
parents:
diff changeset
257 this->bInitialized = 1;
Ritor1
parents:
diff changeset
258 this->pCursorBitmapPos.x = 0;
Ritor1
parents:
diff changeset
259 this->pCursorBitmapPos.y = 0;
Ritor1
parents:
diff changeset
260 this->uMouseClickX = 0;
Ritor1
parents:
diff changeset
261 this->uMouseClickY = 0;
Ritor1
parents:
diff changeset
262 this->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
263 this->field_34 = 0;
Ritor1
parents:
diff changeset
264 this->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
265
Ritor1
parents:
diff changeset
266 SetCursorBitmap("MICON3");
Ritor1
parents:
diff changeset
267 SetCursorBitmap("MICON2");
Ritor1
parents:
diff changeset
268 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
269 }
Ritor1
parents:
diff changeset
270
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
271 // inlined
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
272 //----- (0045FE00) mm6 chinese --------------------------------------------
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
273 void Mouse::SetActive(bool active)
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
274 {
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
275 bActive = active;
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
276 }
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
277
0
Ritor1
parents:
diff changeset
278 //----- (00469CC2) --------------------------------------------------------
Ritor1
parents:
diff changeset
279 void Mouse::Deactivate()
Ritor1
parents:
diff changeset
280 {
Ritor1
parents:
diff changeset
281 if (bInitialized)
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
282 SetActive(false);
0
Ritor1
parents:
diff changeset
283 }
Ritor1
parents:
diff changeset
284
Ritor1
parents:
diff changeset
285 //----- (00469CCD) --------------------------------------------------------
Ritor1
parents:
diff changeset
286 void Mouse::DrawCursor()
Ritor1
parents:
diff changeset
287 {
Ritor1
parents:
diff changeset
288 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
289 char v11; // zf@6
Ritor1
parents:
diff changeset
290 signed int v3; // eax@6
Ritor1
parents:
diff changeset
291 signed int v4; // ecx@6
Ritor1
parents:
diff changeset
292 Vec4_int_ *v5; // edx@21
Ritor1
parents:
diff changeset
293 int v6; // edi@21
Ritor1
parents:
diff changeset
294 int v7; // ebx@21
Ritor1
parents:
diff changeset
295 int v8; // eax@29
Ritor1
parents:
diff changeset
296 unsigned int v9; // eax@31
Ritor1
parents:
diff changeset
297
Ritor1
parents:
diff changeset
298 v1 = this;
Ritor1
parents:
diff changeset
299 if ( this->bInitialized )
Ritor1
parents:
diff changeset
300 {
Ritor1
parents:
diff changeset
301 if ( !this->field_8 && this->bActive && !this->field_C )
Ritor1
parents:
diff changeset
302 pMouse->_469AE4();
Ritor1
parents:
diff changeset
303 v11 = v1->field_C == 0;
Ritor1
parents:
diff changeset
304 v3 = v1->uMouseClickX;
Ritor1
parents:
diff changeset
305 v4 = v1->uMouseClickY;
Ritor1
parents:
diff changeset
306 v1->field_F4 = 1;
Ritor1
parents:
diff changeset
307 if ( !v11 )
Ritor1
parents:
diff changeset
308 goto LABEL_12;
Ritor1
parents:
diff changeset
309 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
310 {
Ritor1
parents:
diff changeset
311 if ( v3 < 0 || v4 < 0 || v3 > 639 || v4 > 479 )
Ritor1
parents:
diff changeset
312 {
Ritor1
parents:
diff changeset
313 LABEL_12:
Ritor1
parents:
diff changeset
314 v1->field_F4 = 0;
Ritor1
parents:
diff changeset
315 return;
Ritor1
parents:
diff changeset
316 }
Ritor1
parents:
diff changeset
317 }
Ritor1
parents:
diff changeset
318 else
Ritor1
parents:
diff changeset
319 {
Ritor1
parents:
diff changeset
320 if ( v3 < 0 )
Ritor1
parents:
diff changeset
321 v3 = 0;
Ritor1
parents:
diff changeset
322 if ( v4 < 0 )
Ritor1
parents:
diff changeset
323 v4 = 0;
Ritor1
parents:
diff changeset
324 if ( v3 > 639 )
Ritor1
parents:
diff changeset
325 v3 = 639;
Ritor1
parents:
diff changeset
326 if ( v4 > 479 )
Ritor1
parents:
diff changeset
327 v4 = 479;
Ritor1
parents:
diff changeset
328 }
Ritor1
parents:
diff changeset
329 v5 = &v1->pCursorBitmapRect;
Ritor1
parents:
diff changeset
330 v6 = v3 + v1->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
331 v7 = v4 + v1->field_5C[0];
Ritor1
parents:
diff changeset
332 v1->pCursorBitmapRect.y = v4;
Ritor1
parents:
diff changeset
333 v1->pCursorBitmapRect.x = v3;
Ritor1
parents:
diff changeset
334 v1->pCursorBitmapRect.z = v6;
Ritor1
parents:
diff changeset
335 v1->pCursorBitmapRect.w = v7;
Ritor1
parents:
diff changeset
336 if ( v3 < 0 )
Ritor1
parents:
diff changeset
337 v5->x = 0;
Ritor1
parents:
diff changeset
338 if ( v4 < 0 )
Ritor1
parents:
diff changeset
339 v1->pCursorBitmapRect.y = 0;
Ritor1
parents:
diff changeset
340 if ( v6 > 640 )
Ritor1
parents:
diff changeset
341 v1->pCursorBitmapRect.z = 640;
Ritor1
parents:
diff changeset
342 if ( v7 > 480 )
Ritor1
parents:
diff changeset
343 v1->pCursorBitmapRect.w = 480;
Ritor1
parents:
diff changeset
344 v8 = v1->pCursorBitmapRect.z;
Ritor1
parents:
diff changeset
345 v1->bActive = 0;
Ritor1
parents:
diff changeset
346 v1->uCursorBitmapWidth = v8 - v5->x;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
347 v11 = v1->bRedraw == 0;
0
Ritor1
parents:
diff changeset
348 v1->uCursorBitmapHeight = v1->pCursorBitmapRect.w - v1->pCursorBitmapRect.y;
Ritor1
parents:
diff changeset
349 if ( !v11 )
Ritor1
parents:
diff changeset
350 {
Ritor1
parents:
diff changeset
351 if ( pMouse->ptr_90 )
Ritor1
parents:
diff changeset
352 v9 = 2 * pMouse->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
353 else
Ritor1
parents:
diff changeset
354 v9 = 0;
Ritor1
parents:
diff changeset
355 pRenderer->_4A6DF5(
Ritor1
parents:
diff changeset
356 v1->pCursorBitmap_sysmem,
Ritor1
parents:
diff changeset
357 v9,
Ritor1
parents:
diff changeset
358 &v1->pCursorBitmapPos,
Ritor1
parents:
diff changeset
359 pRenderer->pTargetSurface,
Ritor1
parents:
diff changeset
360 pRenderer->uTargetSurfacePitch,
Ritor1
parents:
diff changeset
361 &v1->pCursorBitmapRect);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
362 v1->bRedraw = false;
0
Ritor1
parents:
diff changeset
363 }
Ritor1
parents:
diff changeset
364 }
Ritor1
parents:
diff changeset
365 }
Ritor1
parents:
diff changeset
366
Ritor1
parents:
diff changeset
367 //----- (00469E1C) --------------------------------------------------------
Ritor1
parents:
diff changeset
368 void Mouse::_469E1C()
Ritor1
parents:
diff changeset
369 {
Ritor1
parents:
diff changeset
370 bActive = true;
Ritor1
parents:
diff changeset
371 }
Ritor1
parents:
diff changeset
372
Ritor1
parents:
diff changeset
373 //----- (00469E24) --------------------------------------------------------
Ritor1
parents:
diff changeset
374 void Mouse::_469E24()
Ritor1
parents:
diff changeset
375 {
Ritor1
parents:
diff changeset
376 if (pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
377 {
Ritor1
parents:
diff changeset
378 free(pCursorBitmap3_sysmembits_16bit);
Ritor1
parents:
diff changeset
379 pCursorBitmap3_sysmembits_16bit = 0;
Ritor1
parents:
diff changeset
380 }
Ritor1
parents:
diff changeset
381 }
Ritor1
parents:
diff changeset
382
Ritor1
parents:
diff changeset
383 //----- (00469E3B) --------------------------------------------------------
Ritor1
parents:
diff changeset
384 void Mouse::DrawCursorToTarget()
Ritor1
parents:
diff changeset
385 {
Ritor1
parents:
diff changeset
386 if (!pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
387 return;
Ritor1
parents:
diff changeset
388
Ritor1
parents:
diff changeset
389 auto pSrc = pCursorBitmap3_sysmembits_16bit;
Ritor1
parents:
diff changeset
390 for (uint y = field_44; y < field_4C; ++y)
Ritor1
parents:
diff changeset
391 for (uint x = field_40; x < field_48; ++x)
Ritor1
parents:
diff changeset
392 pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
Ritor1
parents:
diff changeset
393 }
Ritor1
parents:
diff changeset
394
Ritor1
parents:
diff changeset
395 //----- (00469EA4) --------------------------------------------------------
Ritor1
parents:
diff changeset
396 void Mouse::_469EA4()
Ritor1
parents:
diff changeset
397 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
398 //Mouse *v1; // esi@1
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
399 unsigned int pTextureID; // eax@2
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
400 Texture *pTexture; // edi@2
0
Ritor1
parents:
diff changeset
401 unsigned int v4; // ecx@3
Ritor1
parents:
diff changeset
402 unsigned int v5; // eax@3
Ritor1
parents:
diff changeset
403 unsigned int v6; // ebx@5
Ritor1
parents:
diff changeset
404 int v7; // ecx@15
Ritor1
parents:
diff changeset
405 int v8; // ecx@25
Ritor1
parents:
diff changeset
406 int v9; // ebx@26
Ritor1
parents:
diff changeset
407 unsigned int v10; // eax@26
Ritor1
parents:
diff changeset
408 int v11; // edx@27
Ritor1
parents:
diff changeset
409 unsigned __int16 *v12; // edx@29
Ritor1
parents:
diff changeset
410 unsigned __int16 *v13; // ebx@29
Ritor1
parents:
diff changeset
411 unsigned int a2; // [sp+Ch] [bp-1Ch]@5
Ritor1
parents:
diff changeset
412 unsigned int v15; // [sp+10h] [bp-18h]@5
Ritor1
parents:
diff changeset
413 unsigned int v16; // [sp+14h] [bp-14h]@25
Ritor1
parents:
diff changeset
414 unsigned __int16 *v17; // [sp+18h] [bp-10h]@25
Ritor1
parents:
diff changeset
415 int v18; // [sp+1Ch] [bp-Ch]@27
Ritor1
parents:
diff changeset
416 int v19; // [sp+20h] [bp-8h]@15
Ritor1
parents:
diff changeset
417 unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
418 int pTextureWidth; // [sp+24h] [bp-4h]@12
0
Ritor1
parents:
diff changeset
419 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
Ritor1
parents:
diff changeset
420
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
421 //v1 = this;
0
Ritor1
parents:
diff changeset
422 if ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
423 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
424 pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
425 pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
426
0
Ritor1
parents:
diff changeset
427 v4 = pMouse->uMouseClickX;
Ritor1
parents:
diff changeset
428 v5 = pMouse->uMouseClickY;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
429
0
Ritor1
parents:
diff changeset
430 v6 = v5;
Ritor1
parents:
diff changeset
431 a2 = v4;
Ritor1
parents:
diff changeset
432 v15 = v5;
Ritor1
parents:
diff changeset
433 if ( (signed int)v4 <= 639 && (signed int)v5 <= 479 )
Ritor1
parents:
diff changeset
434 {
Ritor1
parents:
diff changeset
435 if ( (v4 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
436 a2 = 0;
Ritor1
parents:
diff changeset
437 if ( (v5 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
438 {
Ritor1
parents:
diff changeset
439 v6 = 0;
Ritor1
parents:
diff changeset
440 v15 = 0;
Ritor1
parents:
diff changeset
441 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
442 if ( (signed int)(pTexture->uTextureWidth + a2) <= 640 )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
443 pTextureWidth = pTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
444 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
445 pTextureWidth = 640 - a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
446 if ( (signed int)(pTexture->uTextureHeight + v6) <= 480 )
0
Ritor1
parents:
diff changeset
447 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
448 v19 = pTexture->uTextureHeight;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
449 v7 = pTexture->uTextureHeight;
0
Ritor1
parents:
diff changeset
450 }
Ritor1
parents:
diff changeset
451 else
Ritor1
parents:
diff changeset
452 {
Ritor1
parents:
diff changeset
453 v7 = 480 - v6;
Ritor1
parents:
diff changeset
454 v19 = 480 - v6;
Ritor1
parents:
diff changeset
455 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
456 if ( !this->pCursorBitmap3_sysmembits_16bit
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
457 || a2 != this->field_40
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
458 || v6 != this->field_44
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
459 || a2 + pTextureWidth != this->field_48
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
460 || v6 + v7 != this->field_4C )
0
Ritor1
parents:
diff changeset
461 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
462 if ( this->pCursorBitmap3_sysmembits_16bit )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
463 free(this->pCursorBitmap3_sysmembits_16bit);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
464 this->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)operator new(2 * pTexture->uTextureHeight * pTexture->uTextureWidth);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
465 this->field_40 = a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
466 this->field_48 = a2 + pTextureWidth;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
467 this->field_44 = v6;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
468 this->field_4C = v6 + v19;
0
Ritor1
parents:
diff changeset
469 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
470 v8 = this->field_44;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
471 v22 = this->pCursorBitmap3_sysmembits_16bit;
0
Ritor1
parents:
diff changeset
472 v17 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
473 v16 = pRenderer->uTargetSurfacePitch;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
474 if ( v8 < this->field_4C )
0
Ritor1
parents:
diff changeset
475 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
476 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
477 v10 = pRenderer->uTargetSurfacePitch * v8;
Ritor1
parents:
diff changeset
478 do
Ritor1
parents:
diff changeset
479 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
480 v11 = this->field_40;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
481 v18 = this->field_40;
0
Ritor1
parents:
diff changeset
482 if ( v11 < v9 )
Ritor1
parents:
diff changeset
483 {
Ritor1
parents:
diff changeset
484 v20 = &v17[v10 + v11];
Ritor1
parents:
diff changeset
485 do
Ritor1
parents:
diff changeset
486 {
Ritor1
parents:
diff changeset
487 v12 = v20;
Ritor1
parents:
diff changeset
488 v13 = v22;
Ritor1
parents:
diff changeset
489 ++v18;
Ritor1
parents:
diff changeset
490 ++v20;
Ritor1
parents:
diff changeset
491 ++v22;
Ritor1
parents:
diff changeset
492 *v13 = *v12;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
493 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
494 }
Ritor1
parents:
diff changeset
495 while ( v18 < v9 );
Ritor1
parents:
diff changeset
496 }
Ritor1
parents:
diff changeset
497 v10 += v16;
Ritor1
parents:
diff changeset
498 ++v8;
Ritor1
parents:
diff changeset
499 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
500 while ( v8 < this->field_4C );
0
Ritor1
parents:
diff changeset
501 v6 = v15;
Ritor1
parents:
diff changeset
502 }
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
503 if (pParty->pPickedItem.Broken())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
504 pRenderer->DrawTransparentRedShade(a2, v6, pTexture);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
505 else if (!pParty->pPickedItem.Identified())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
506 pRenderer->DrawTransparentGreenShade(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
507 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
508 pRenderer->DrawTextureTransparent(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
509 }
Ritor1
parents:
diff changeset
510 }
Ritor1
parents:
diff changeset
511 else
Ritor1
parents:
diff changeset
512 {
Ritor1
parents:
diff changeset
513 if ( this->pCursorBitmap3_sysmembits_16bit )
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 free(this->pCursorBitmap3_sysmembits_16bit);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
516 this->pCursorBitmap3_sysmembits_16bit = 0;
0
Ritor1
parents:
diff changeset
517 }
Ritor1
parents:
diff changeset
518 }
Ritor1
parents:
diff changeset
519 }
Ritor1
parents:
diff changeset
520
Ritor1
parents:
diff changeset
521 //----- (0046A080) --------------------------------------------------------
Ritor1
parents:
diff changeset
522 void Mouse::Activate(int bActive)
Ritor1
parents:
diff changeset
523 {
Ritor1
parents:
diff changeset
524 bActive = bActive;
Ritor1
parents:
diff changeset
525 }
Ritor1
parents:
diff changeset
526
Ritor1
parents:
diff changeset
527 //----- (0046A08A) --------------------------------------------------------
Ritor1
parents:
diff changeset
528 void Mouse::SetMouseClick(int x, int y)
Ritor1
parents:
diff changeset
529 {
Ritor1
parents:
diff changeset
530 uMouseClickX = x;
Ritor1
parents:
diff changeset
531 uMouseClickY = y;
Ritor1
parents:
diff changeset
532 }
Ritor1
parents:
diff changeset
533