annotate Mouse.cpp @ 1383:0a4254e80036

Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
author Grumpy7
date Tue, 16 Jul 2013 00:40:01 +0200
parents 22cb507446a4
children cc9a3a24d61d
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
4
0
Ritor1
parents:
diff changeset
5
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
6 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
7 #include "mm7_data.h"
1253
fac7751b2dc9 included header cleanup
Grumpy7
parents: 1165
diff changeset
8 #include "Render.h"
0
Ritor1
parents:
diff changeset
9 #include "Mouse.h"
Ritor1
parents:
diff changeset
10 #include "Items.h"
Ritor1
parents:
diff changeset
11 #include "Party.h"
Ritor1
parents:
diff changeset
12 #include "LOD.h"
Ritor1
parents:
diff changeset
13 #include "Game.h"
Ritor1
parents:
diff changeset
14
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 973
diff changeset
15 #include "stru11.h"
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
16 #include "TurnEngine.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
17 #include "Viewport.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
18 #include "GUIWindow.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
19 #include "Vis.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
20 #include "Actor.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
21 #include "MM7.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
22 #include "AudioPlayer.h"
0
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25 Mouse *pMouse;
Ritor1
parents:
diff changeset
26
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28
Ritor1
parents:
diff changeset
29
Ritor1
parents:
diff changeset
30
Ritor1
parents:
diff changeset
31 //----- (00469860) --------------------------------------------------------
Ritor1
parents:
diff changeset
32 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
Ritor1
parents:
diff changeset
33 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
34 *pX = uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
35 *pY = uMouseClickY;
0
Ritor1
parents:
diff changeset
36 }
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38 //----- (004698A6) --------------------------------------------------------
Ritor1
parents:
diff changeset
39 void Mouse::RemoveHoldingItem()
Ritor1
parents:
diff changeset
40 {
Ritor1
parents:
diff changeset
41 pParty->pPickedItem.Reset();
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
42 if (_stricmp(pCurrentCursorName, "MICON2"))
0
Ritor1
parents:
diff changeset
43 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
44 }
Ritor1
parents:
diff changeset
45
Ritor1
parents:
diff changeset
46 //----- (004698D8) --------------------------------------------------------
Ritor1
parents:
diff changeset
47 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
Ritor1
parents:
diff changeset
48 {
Ritor1
parents:
diff changeset
49 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
Ritor1
parents:
diff changeset
50 }
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52 //----- (004698F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
53 void Mouse::SetCurrentCursorBitmap()
Ritor1
parents:
diff changeset
54 {
Ritor1
parents:
diff changeset
55 SetCursorBitmap(pCurrentCursorName);
Ritor1
parents:
diff changeset
56 }
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58 //----- (00469903) --------------------------------------------------------
Ritor1
parents:
diff changeset
59 void Mouse::SetCursorBitmap(const char *pName)
Ritor1
parents:
diff changeset
60 {
Ritor1
parents:
diff changeset
61 Mouse *v2; // esi@1
Ritor1
parents:
diff changeset
62 HCURSOR v3; // eax@10
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
63 //int v4; // ecx@10
0
Ritor1
parents:
diff changeset
64 double v5; // st7@11
Ritor1
parents:
diff changeset
65 float v6; // ST04_4@12
Ritor1
parents:
diff changeset
66 LONG v7; // eax@14
Ritor1
parents:
diff changeset
67 LONG v8; // eax@17
Ritor1
parents:
diff changeset
68 unsigned int v9; // eax@21
Ritor1
parents:
diff changeset
69 float v10; // [sp+4h] [bp-18h]@11
Ritor1
parents:
diff changeset
70 struct tagPOINT Point; // [sp+14h] [bp-8h]@20
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72 v2 = this;
Ritor1
parents:
diff changeset
73 if ( !this->bInitialized || !pName )
Ritor1
parents:
diff changeset
74 return;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1068
diff changeset
75 if ( _stricmp("MICON2", pName) )
0
Ritor1
parents:
diff changeset
76 pGame->uFlags2 &= 0xFFFFFFEFu;
Ritor1
parents:
diff changeset
77 else
Ritor1
parents:
diff changeset
78 pGame->uFlags2 |= 0x10u;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1068
diff changeset
79 if ( _stricmp(v2->pCurrentCursorName, pName) )
0
Ritor1
parents:
diff changeset
80 strcpy(v2->pCurrentCursorName, pName);
Ritor1
parents:
diff changeset
81 ClearCursor();
Ritor1
parents:
diff changeset
82 if ( _strnicmp(pName, "MICON1", 5u) )
Ritor1
parents:
diff changeset
83 {
Ritor1
parents:
diff changeset
84 v9 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
85 v2->uCursorTextureID = v9;
Ritor1
parents:
diff changeset
86 v2->uCursorTextureID_2 = v9;
Ritor1
parents:
diff changeset
87 v2->AllocCursorSystemMem();
Ritor1
parents:
diff changeset
88 v2->field_C = 0;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
89 v2->bRedraw = 1;
0
Ritor1
parents:
diff changeset
90 v2->bActive = 1;
Ritor1
parents:
diff changeset
91 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
92 {
Ritor1
parents:
diff changeset
93 if (uCursorTextureID != -1)
Ritor1
parents:
diff changeset
94 pIcons_LOD->pTextures[uCursorTextureID].Release();
1006
e865f349aa41 ui cleanup
Gloval
parents: 973
diff changeset
95 pIcons_LOD->SyncLoadedFilesCount();
0
Ritor1
parents:
diff changeset
96 }
Ritor1
parents:
diff changeset
97 return;
Ritor1
parents:
diff changeset
98 }
Ritor1
parents:
diff changeset
99 v2->bActive = 0;
Ritor1
parents:
diff changeset
100 v2->field_C = 1;
Ritor1
parents:
diff changeset
101 if ( !strcmp(pName, "MICON1") )
Ritor1
parents:
diff changeset
102 {
Ritor1
parents:
diff changeset
103 v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow");
Ritor1
parents:
diff changeset
104 SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3);
Ritor1
parents:
diff changeset
105 }
1068
6cbf4eb0f953 Mouse jumps fixed
zipi
parents: 1038
diff changeset
106 else if ( !strcmp(pName, "MICON2") )
0
Ritor1
parents:
diff changeset
107 {
Ritor1
parents:
diff changeset
108 v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target");
Ritor1
parents:
diff changeset
109 SetClassLongA(hWnd, -12, v7);
Ritor1
parents:
diff changeset
110 }
1068
6cbf4eb0f953 Mouse jumps fixed
zipi
parents: 1038
diff changeset
111 else if ( !strcmp(pName, "MICON3") )
0
Ritor1
parents:
diff changeset
112 {
Ritor1
parents:
diff changeset
113 v8 = (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT);
Ritor1
parents:
diff changeset
114 SetClassLongA(hWnd, -12, v8);
Ritor1
parents:
diff changeset
115 }
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
116 //LABEL_18:
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
117
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
118 GetCursorPos(&Point);
1068
6cbf4eb0f953 Mouse jumps fixed
zipi
parents: 1038
diff changeset
119 ClientToScreen(hWnd,&Point);
779
2a3fd4d89ec2 Mouse::SetCursorBitmap clean, mouse jump fix
zipi
parents: 762
diff changeset
120 SetCursorPos(Point.x, Point.y);
0
Ritor1
parents:
diff changeset
121 }
Ritor1
parents:
diff changeset
122 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
123
Ritor1
parents:
diff changeset
124 //----- (00469AE4) --------------------------------------------------------
Ritor1
parents:
diff changeset
125 LONG Mouse::_469AE4()
Ritor1
parents:
diff changeset
126 {
Ritor1
parents:
diff changeset
127 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
128 LONG v2; // ecx@2
Ritor1
parents:
diff changeset
129 LONG result; // eax@2
Ritor1
parents:
diff changeset
130 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
131
Ritor1
parents:
diff changeset
132 v1 = this;
Ritor1
parents:
diff changeset
133 this->field_8 = 1;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
134 /*if (pAsyncMouse)
0
Ritor1
parents:
diff changeset
135 {
Ritor1
parents:
diff changeset
136 v2 = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
137 Point.x = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
138 result = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
139 }
Ritor1
parents:
diff changeset
140 else
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
141 {*/
0
Ritor1
parents:
diff changeset
142 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
143 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
144 ScreenToClient(hWnd, &Point);
Ritor1
parents:
diff changeset
145 result = Point.y;
Ritor1
parents:
diff changeset
146 v2 = Point.x;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
147 //}
0
Ritor1
parents:
diff changeset
148 v1->uMouseClickX = v2;
Ritor1
parents:
diff changeset
149 v1->uMouseClickY = result;
Ritor1
parents:
diff changeset
150 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
151 goto LABEL_16;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
152 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
153 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
154 if ( v2 < 0 )
Ritor1
parents:
diff changeset
155 v2 = 0;
Ritor1
parents:
diff changeset
156 if ( result < 0 )
Ritor1
parents:
diff changeset
157 result = 0;
Ritor1
parents:
diff changeset
158 if ( v2 > 639 )
Ritor1
parents:
diff changeset
159 v2 = 639;
Ritor1
parents:
diff changeset
160 if ( result > 479 )
Ritor1
parents:
diff changeset
161 {
Ritor1
parents:
diff changeset
162 result = 479;
Ritor1
parents:
diff changeset
163 LABEL_16:
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
164 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
165 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
166 if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) )
Ritor1
parents:
diff changeset
167 goto LABEL_23;
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169 if ( v1->field_C )
Ritor1
parents:
diff changeset
170 LABEL_23:
Ritor1
parents:
diff changeset
171 v1->bActive = 0;
Ritor1
parents:
diff changeset
172 LABEL_24:
Ritor1
parents:
diff changeset
173 v1->field_8 = 0;
Ritor1
parents:
diff changeset
174 return result;
Ritor1
parents:
diff changeset
175 }
Ritor1
parents:
diff changeset
176
Ritor1
parents:
diff changeset
177 //----- (00469BA3) --------------------------------------------------------
Ritor1
parents:
diff changeset
178 void Mouse::ClearCursor()
Ritor1
parents:
diff changeset
179 {
Ritor1
parents:
diff changeset
180 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
181 void *v2; // eax@1
Ritor1
parents:
diff changeset
182 void **v3; // esi@5
Ritor1
parents:
diff changeset
183
Ritor1
parents:
diff changeset
184 v1 = this;
Ritor1
parents:
diff changeset
185 v2 = this->pCursorBitmap_sysmem;
Ritor1
parents:
diff changeset
186 this->bActive = 0;
Ritor1
parents:
diff changeset
187 if ( v2 )
Ritor1
parents:
diff changeset
188 {
Ritor1
parents:
diff changeset
189 free(v2);
Ritor1
parents:
diff changeset
190 v1->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 if ( v1->pCursorBitmap2_sysmem )
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 free(v1->pCursorBitmap2_sysmem);
Ritor1
parents:
diff changeset
195 v1->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
196 }
Ritor1
parents:
diff changeset
197 v3 = &v1->ptr_90;
Ritor1
parents:
diff changeset
198 if ( *v3 )
Ritor1
parents:
diff changeset
199 free(*v3);
Ritor1
parents:
diff changeset
200 *v3 = 0;
Ritor1
parents:
diff changeset
201 }
Ritor1
parents:
diff changeset
202
Ritor1
parents:
diff changeset
203 //----- (00469BE6) --------------------------------------------------------
Ritor1
parents:
diff changeset
204 void Mouse::AllocCursorSystemMem()
Ritor1
parents:
diff changeset
205 {
Ritor1
parents:
diff changeset
206 bActive = 0;
Ritor1
parents:
diff changeset
207 if (!pCursorBitmap_sysmem)
Ritor1
parents:
diff changeset
208 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
209 if (!pCursorBitmap2_sysmem)
Ritor1
parents:
diff changeset
210 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
211 }
Ritor1
parents:
diff changeset
212
Ritor1
parents:
diff changeset
213 //----- (00469C0D) --------------------------------------------------------
Ritor1
parents:
diff changeset
214 void *Mouse::DoAllocCursorMem()
Ritor1
parents:
diff changeset
215 {
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
216 auto tex = pIcons_LOD->GetTexture(uCursorTextureID);
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
217 return malloc(4 * tex->uTextureWidth * tex->uTextureHeight);
0
Ritor1
parents:
diff changeset
218 }
Ritor1
parents:
diff changeset
219
Ritor1
parents:
diff changeset
220 //----- (00469C39) --------------------------------------------------------
Ritor1
parents:
diff changeset
221 POINT *Mouse::GetCursorPos(POINT *a2)
Ritor1
parents:
diff changeset
222 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
223 a2->x = this->uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
224 a2->y = this->uMouseClickY;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
225 return a2;
0
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227
Ritor1
parents:
diff changeset
228 //----- (00469C65) --------------------------------------------------------
Ritor1
parents:
diff changeset
229 void Mouse::Initialize(HWND hWnd)
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 this->hWnd = hWnd;
Ritor1
parents:
diff changeset
232 this->bActive = 0;
Ritor1
parents:
diff changeset
233 this->bInitialized = 1;
Ritor1
parents:
diff changeset
234 this->pCursorBitmapPos.x = 0;
Ritor1
parents:
diff changeset
235 this->pCursorBitmapPos.y = 0;
Ritor1
parents:
diff changeset
236 this->uMouseClickX = 0;
Ritor1
parents:
diff changeset
237 this->uMouseClickY = 0;
Ritor1
parents:
diff changeset
238 this->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
239 this->field_34 = 0;
Ritor1
parents:
diff changeset
240 this->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
241
Ritor1
parents:
diff changeset
242 SetCursorBitmap("MICON3");
Ritor1
parents:
diff changeset
243 SetCursorBitmap("MICON2");
Ritor1
parents:
diff changeset
244 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
245 }
Ritor1
parents:
diff changeset
246
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
247 // inlined
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
248 //----- (0045FE00) mm6 chinese --------------------------------------------
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
249 void Mouse::SetActive(bool active)
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
250 {
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
251 bActive = active;
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
252 }
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
253
0
Ritor1
parents:
diff changeset
254 //----- (00469CC2) --------------------------------------------------------
Ritor1
parents:
diff changeset
255 void Mouse::Deactivate()
Ritor1
parents:
diff changeset
256 {
Ritor1
parents:
diff changeset
257 if (bInitialized)
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
258 SetActive(false);
0
Ritor1
parents:
diff changeset
259 }
Ritor1
parents:
diff changeset
260
Ritor1
parents:
diff changeset
261 //----- (00469CCD) --------------------------------------------------------
Ritor1
parents:
diff changeset
262 void Mouse::DrawCursor()
Ritor1
parents:
diff changeset
263 {
Ritor1
parents:
diff changeset
264 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
265 char v11; // zf@6
Ritor1
parents:
diff changeset
266 signed int v3; // eax@6
Ritor1
parents:
diff changeset
267 signed int v4; // ecx@6
Ritor1
parents:
diff changeset
268 Vec4_int_ *v5; // edx@21
Ritor1
parents:
diff changeset
269 int v6; // edi@21
Ritor1
parents:
diff changeset
270 int v7; // ebx@21
Ritor1
parents:
diff changeset
271 int v8; // eax@29
Ritor1
parents:
diff changeset
272 unsigned int v9; // eax@31
Ritor1
parents:
diff changeset
273
Ritor1
parents:
diff changeset
274 v1 = this;
Ritor1
parents:
diff changeset
275 if ( this->bInitialized )
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 if ( !this->field_8 && this->bActive && !this->field_C )
Ritor1
parents:
diff changeset
278 pMouse->_469AE4();
Ritor1
parents:
diff changeset
279 v11 = v1->field_C == 0;
Ritor1
parents:
diff changeset
280 v3 = v1->uMouseClickX;
Ritor1
parents:
diff changeset
281 v4 = v1->uMouseClickY;
Ritor1
parents:
diff changeset
282 v1->field_F4 = 1;
Ritor1
parents:
diff changeset
283 if ( !v11 )
Ritor1
parents:
diff changeset
284 goto LABEL_12;
Ritor1
parents:
diff changeset
285 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
286 {
Ritor1
parents:
diff changeset
287 if ( v3 < 0 || v4 < 0 || v3 > 639 || v4 > 479 )
Ritor1
parents:
diff changeset
288 {
Ritor1
parents:
diff changeset
289 LABEL_12:
Ritor1
parents:
diff changeset
290 v1->field_F4 = 0;
Ritor1
parents:
diff changeset
291 return;
Ritor1
parents:
diff changeset
292 }
Ritor1
parents:
diff changeset
293 }
Ritor1
parents:
diff changeset
294 else
Ritor1
parents:
diff changeset
295 {
Ritor1
parents:
diff changeset
296 if ( v3 < 0 )
Ritor1
parents:
diff changeset
297 v3 = 0;
Ritor1
parents:
diff changeset
298 if ( v4 < 0 )
Ritor1
parents:
diff changeset
299 v4 = 0;
Ritor1
parents:
diff changeset
300 if ( v3 > 639 )
Ritor1
parents:
diff changeset
301 v3 = 639;
Ritor1
parents:
diff changeset
302 if ( v4 > 479 )
Ritor1
parents:
diff changeset
303 v4 = 479;
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305 v5 = &v1->pCursorBitmapRect;
Ritor1
parents:
diff changeset
306 v6 = v3 + v1->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
307 v7 = v4 + v1->field_5C[0];
Ritor1
parents:
diff changeset
308 v1->pCursorBitmapRect.y = v4;
Ritor1
parents:
diff changeset
309 v1->pCursorBitmapRect.x = v3;
Ritor1
parents:
diff changeset
310 v1->pCursorBitmapRect.z = v6;
Ritor1
parents:
diff changeset
311 v1->pCursorBitmapRect.w = v7;
Ritor1
parents:
diff changeset
312 if ( v3 < 0 )
Ritor1
parents:
diff changeset
313 v5->x = 0;
Ritor1
parents:
diff changeset
314 if ( v4 < 0 )
Ritor1
parents:
diff changeset
315 v1->pCursorBitmapRect.y = 0;
Ritor1
parents:
diff changeset
316 if ( v6 > 640 )
Ritor1
parents:
diff changeset
317 v1->pCursorBitmapRect.z = 640;
Ritor1
parents:
diff changeset
318 if ( v7 > 480 )
Ritor1
parents:
diff changeset
319 v1->pCursorBitmapRect.w = 480;
Ritor1
parents:
diff changeset
320 v8 = v1->pCursorBitmapRect.z;
Ritor1
parents:
diff changeset
321 v1->bActive = 0;
Ritor1
parents:
diff changeset
322 v1->uCursorBitmapWidth = v8 - v5->x;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
323 v11 = v1->bRedraw == 0;
0
Ritor1
parents:
diff changeset
324 v1->uCursorBitmapHeight = v1->pCursorBitmapRect.w - v1->pCursorBitmapRect.y;
Ritor1
parents:
diff changeset
325 if ( !v11 )
Ritor1
parents:
diff changeset
326 {
Ritor1
parents:
diff changeset
327 if ( pMouse->ptr_90 )
Ritor1
parents:
diff changeset
328 v9 = 2 * pMouse->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
329 else
Ritor1
parents:
diff changeset
330 v9 = 0;
Ritor1
parents:
diff changeset
331 pRenderer->_4A6DF5(
Ritor1
parents:
diff changeset
332 v1->pCursorBitmap_sysmem,
Ritor1
parents:
diff changeset
333 v9,
Ritor1
parents:
diff changeset
334 &v1->pCursorBitmapPos,
Ritor1
parents:
diff changeset
335 pRenderer->pTargetSurface,
Ritor1
parents:
diff changeset
336 pRenderer->uTargetSurfacePitch,
Ritor1
parents:
diff changeset
337 &v1->pCursorBitmapRect);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 779
diff changeset
338 v1->bRedraw = false;
0
Ritor1
parents:
diff changeset
339 }
Ritor1
parents:
diff changeset
340 }
Ritor1
parents:
diff changeset
341 }
Ritor1
parents:
diff changeset
342
Ritor1
parents:
diff changeset
343 //----- (00469E1C) --------------------------------------------------------
Ritor1
parents:
diff changeset
344 void Mouse::_469E1C()
Ritor1
parents:
diff changeset
345 {
Ritor1
parents:
diff changeset
346 bActive = true;
Ritor1
parents:
diff changeset
347 }
Ritor1
parents:
diff changeset
348
Ritor1
parents:
diff changeset
349 //----- (00469E24) --------------------------------------------------------
Ritor1
parents:
diff changeset
350 void Mouse::_469E24()
Ritor1
parents:
diff changeset
351 {
Ritor1
parents:
diff changeset
352 if (pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
353 {
Ritor1
parents:
diff changeset
354 free(pCursorBitmap3_sysmembits_16bit);
Ritor1
parents:
diff changeset
355 pCursorBitmap3_sysmembits_16bit = 0;
Ritor1
parents:
diff changeset
356 }
Ritor1
parents:
diff changeset
357 }
Ritor1
parents:
diff changeset
358
Ritor1
parents:
diff changeset
359 //----- (00469E3B) --------------------------------------------------------
Ritor1
parents:
diff changeset
360 void Mouse::DrawCursorToTarget()
Ritor1
parents:
diff changeset
361 {
Ritor1
parents:
diff changeset
362 if (!pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
363 return;
Ritor1
parents:
diff changeset
364
Ritor1
parents:
diff changeset
365 auto pSrc = pCursorBitmap3_sysmembits_16bit;
Ritor1
parents:
diff changeset
366 for (uint y = field_44; y < field_4C; ++y)
Ritor1
parents:
diff changeset
367 for (uint x = field_40; x < field_48; ++x)
Ritor1
parents:
diff changeset
368 pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
Ritor1
parents:
diff changeset
369 }
Ritor1
parents:
diff changeset
370
Ritor1
parents:
diff changeset
371 //----- (00469EA4) --------------------------------------------------------
Ritor1
parents:
diff changeset
372 void Mouse::_469EA4()
Ritor1
parents:
diff changeset
373 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
374 //Mouse *v1; // esi@1
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
375 unsigned int pTextureID; // eax@2
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
376 Texture *pTexture; // edi@2
0
Ritor1
parents:
diff changeset
377 unsigned int v4; // ecx@3
Ritor1
parents:
diff changeset
378 unsigned int v5; // eax@3
Ritor1
parents:
diff changeset
379 unsigned int v6; // ebx@5
Ritor1
parents:
diff changeset
380 int v7; // ecx@15
Ritor1
parents:
diff changeset
381 int v8; // ecx@25
Ritor1
parents:
diff changeset
382 int v9; // ebx@26
Ritor1
parents:
diff changeset
383 unsigned int v10; // eax@26
Ritor1
parents:
diff changeset
384 int v11; // edx@27
Ritor1
parents:
diff changeset
385 unsigned __int16 *v12; // edx@29
Ritor1
parents:
diff changeset
386 unsigned __int16 *v13; // ebx@29
Ritor1
parents:
diff changeset
387 unsigned int a2; // [sp+Ch] [bp-1Ch]@5
Ritor1
parents:
diff changeset
388 unsigned int v15; // [sp+10h] [bp-18h]@5
Ritor1
parents:
diff changeset
389 unsigned int v16; // [sp+14h] [bp-14h]@25
Ritor1
parents:
diff changeset
390 unsigned __int16 *v17; // [sp+18h] [bp-10h]@25
Ritor1
parents:
diff changeset
391 int v18; // [sp+1Ch] [bp-Ch]@27
Ritor1
parents:
diff changeset
392 int v19; // [sp+20h] [bp-8h]@15
Ritor1
parents:
diff changeset
393 unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
394 int pTextureWidth; // [sp+24h] [bp-4h]@12
0
Ritor1
parents:
diff changeset
395 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
Ritor1
parents:
diff changeset
396
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
397 //v1 = this;
0
Ritor1
parents:
diff changeset
398 if ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
399 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
400 pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
401 pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
402
0
Ritor1
parents:
diff changeset
403 v4 = pMouse->uMouseClickX;
Ritor1
parents:
diff changeset
404 v5 = pMouse->uMouseClickY;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
405
0
Ritor1
parents:
diff changeset
406 v6 = v5;
Ritor1
parents:
diff changeset
407 a2 = v4;
Ritor1
parents:
diff changeset
408 v15 = v5;
Ritor1
parents:
diff changeset
409 if ( (signed int)v4 <= 639 && (signed int)v5 <= 479 )
Ritor1
parents:
diff changeset
410 {
Ritor1
parents:
diff changeset
411 if ( (v4 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
412 a2 = 0;
Ritor1
parents:
diff changeset
413 if ( (v5 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
414 {
Ritor1
parents:
diff changeset
415 v6 = 0;
Ritor1
parents:
diff changeset
416 v15 = 0;
Ritor1
parents:
diff changeset
417 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
418 if ( (signed int)(pTexture->uTextureWidth + a2) <= 640 )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
419 pTextureWidth = pTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
420 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
421 pTextureWidth = 640 - a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
422 if ( (signed int)(pTexture->uTextureHeight + v6) <= 480 )
0
Ritor1
parents:
diff changeset
423 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
424 v19 = pTexture->uTextureHeight;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
425 v7 = pTexture->uTextureHeight;
0
Ritor1
parents:
diff changeset
426 }
Ritor1
parents:
diff changeset
427 else
Ritor1
parents:
diff changeset
428 {
Ritor1
parents:
diff changeset
429 v7 = 480 - v6;
Ritor1
parents:
diff changeset
430 v19 = 480 - v6;
Ritor1
parents:
diff changeset
431 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
432 if ( !this->pCursorBitmap3_sysmembits_16bit
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
433 || a2 != this->field_40
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
434 || v6 != this->field_44
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
435 || a2 + pTextureWidth != this->field_48
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
436 || v6 + v7 != this->field_4C )
0
Ritor1
parents:
diff changeset
437 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
438 if ( this->pCursorBitmap3_sysmembits_16bit )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
439 free(this->pCursorBitmap3_sysmembits_16bit);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
440 this->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)operator new(2 * pTexture->uTextureHeight * pTexture->uTextureWidth);
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
441 this->field_40 = a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
442 this->field_48 = a2 + pTextureWidth;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
443 this->field_44 = v6;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
444 this->field_4C = v6 + v19;
0
Ritor1
parents:
diff changeset
445 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
446 v8 = this->field_44;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
447 v22 = this->pCursorBitmap3_sysmembits_16bit;
0
Ritor1
parents:
diff changeset
448 v17 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
449 v16 = pRenderer->uTargetSurfacePitch;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
450 if ( v8 < this->field_4C )
0
Ritor1
parents:
diff changeset
451 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
452 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
453 v10 = pRenderer->uTargetSurfacePitch * v8;
Ritor1
parents:
diff changeset
454 do
Ritor1
parents:
diff changeset
455 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
456 v11 = this->field_40;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
457 v18 = this->field_40;
0
Ritor1
parents:
diff changeset
458 if ( v11 < v9 )
Ritor1
parents:
diff changeset
459 {
Ritor1
parents:
diff changeset
460 v20 = &v17[v10 + v11];
Ritor1
parents:
diff changeset
461 do
Ritor1
parents:
diff changeset
462 {
Ritor1
parents:
diff changeset
463 v12 = v20;
Ritor1
parents:
diff changeset
464 v13 = v22;
Ritor1
parents:
diff changeset
465 ++v18;
Ritor1
parents:
diff changeset
466 ++v20;
Ritor1
parents:
diff changeset
467 ++v22;
Ritor1
parents:
diff changeset
468 *v13 = *v12;
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
469 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
470 }
Ritor1
parents:
diff changeset
471 while ( v18 < v9 );
Ritor1
parents:
diff changeset
472 }
Ritor1
parents:
diff changeset
473 v10 += v16;
Ritor1
parents:
diff changeset
474 ++v8;
Ritor1
parents:
diff changeset
475 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
476 while ( v8 < this->field_4C );
0
Ritor1
parents:
diff changeset
477 v6 = v15;
Ritor1
parents:
diff changeset
478 }
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
479 if (pParty->pPickedItem.Broken())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
480 pRenderer->DrawTransparentRedShade(a2, v6, pTexture);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 194
diff changeset
481 else if (!pParty->pPickedItem.Identified())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
482 pRenderer->DrawTransparentGreenShade(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
483 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
484 pRenderer->DrawTextureTransparent(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
485 }
Ritor1
parents:
diff changeset
486 }
Ritor1
parents:
diff changeset
487 else
Ritor1
parents:
diff changeset
488 {
Ritor1
parents:
diff changeset
489 if ( this->pCursorBitmap3_sysmembits_16bit )
Ritor1
parents:
diff changeset
490 {
Ritor1
parents:
diff changeset
491 free(this->pCursorBitmap3_sysmembits_16bit);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
492 this->pCursorBitmap3_sysmembits_16bit = 0;
0
Ritor1
parents:
diff changeset
493 }
Ritor1
parents:
diff changeset
494 }
Ritor1
parents:
diff changeset
495 }
Ritor1
parents:
diff changeset
496
Ritor1
parents:
diff changeset
497 //----- (0046A080) --------------------------------------------------------
Ritor1
parents:
diff changeset
498 void Mouse::Activate(int bActive)
Ritor1
parents:
diff changeset
499 {
Ritor1
parents:
diff changeset
500 bActive = bActive;
Ritor1
parents:
diff changeset
501 }
Ritor1
parents:
diff changeset
502
Ritor1
parents:
diff changeset
503 //----- (0046A08A) --------------------------------------------------------
Ritor1
parents:
diff changeset
504 void Mouse::SetMouseClick(int x, int y)
Ritor1
parents:
diff changeset
505 {
Ritor1
parents:
diff changeset
506 uMouseClickX = x;
Ritor1
parents:
diff changeset
507 uMouseClickY = y;
Ritor1
parents:
diff changeset
508 }
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
509 //----- (004175C0) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
510 void UI_OnMouseLeftClick(int *pXY)
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
511 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
512 int *pXY_; // esi@1
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
513 signed int y; // eax@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
514 signed int x; // ecx@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
515 unsigned int v4; // eax@11
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
516 signed int v5; // eax@17
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
517 signed int v6; // esi@19
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
518 int v7; // esi@30
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
519 GUIWindow *v8; // edx@31
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
520 GUIButton *i; // esi@37
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
521 signed int v10; // eax@50
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
522 int v11; // ecx@52
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
523 unsigned int pX; // [sp+14h] [bp-8h]@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
524 unsigned int pY; // [sp+18h] [bp-4h]@7
0
Ritor1
parents:
diff changeset
525
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
526 pXY_ = pXY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
527 if ( pCurrentScreen == SCREEN_VIDEO
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
528 || sub_4637E0_is_there_popup_onscreen() )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
529 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
530 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
531 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
532 sub_4452BB();
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
533 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
534 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
535 if ( pXY_ )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
536 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
537 x = *pXY_;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
538 y = pXY_[1];
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
539 pX = *pXY_;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
540 pY = y;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
541 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
542 else
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
543 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
544 pMouse->GetClickPos(&pX, &pY);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
545 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
546 x = pX;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
547 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
548 if ( pCurrentScreen != SCREEN_GAME || !dword_507B98_ctrl_pressed )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
549 goto LABEL_30;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
550 v4 = GetCurrentMenuID();
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
551 x = pX;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
552 if ( (v4 & 0x80000000u) == 0
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
553 || (signed int)pX < (signed int)pViewport->uViewportTL_X
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
554 || (signed int)pX > (signed int)pViewport->uViewportBR_X )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
555 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
556 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
557 LABEL_30:
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
558 v7 = uNumVisibleWindows;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
559 if ( uNumVisibleWindows < 0 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
560 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
561 while ( 1 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
562 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
563 //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]];
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
564 v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1];
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
565 if ( x >= (signed int)v8->uFrameX )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
566 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
567 if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
568 break;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
569 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
570 --v7;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
571 if ( v7 < 0 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
572 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
573 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
574 for ( i = v8->pControlsHead; ; i = i->pNext )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
575 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
576 if ( !i )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
577 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
578 if ( i->uButtonType == 1 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
579 goto LABEL_41;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
580 if ( i->uButtonType != 2 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
581 break;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
582 if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
583 goto LABEL_50;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
584 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
585 x = pX;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
586 LABEL_45:
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
587 ;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
588 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
589 if ( i->uButtonType != 3 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
590 goto LABEL_45;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
591 LABEL_41:
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
592 if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
593 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
594 LABEL_50:
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
595 i->field_2C_is_pushed = 1;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
596 v10 = pMessageQueue_50CBD0->uNumMessages;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
597 if ( pMessageQueue_50CBD0->uNumMessages )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
598 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
599 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
600 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
601 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
602 //v11 = i->uControlParam;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
603 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
604 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
605 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
606 goto LABEL_45;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
607 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
608 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
609 if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
610 goto LABEL_30;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
611 if ( pRenderer->pRenderD3D )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
612 v5 = pGame->pVisInstance->get_picked_object_zbuf_val();
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
613 else
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
614 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
615 v6 = (unsigned __int16)v5;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
616 if (PID_TYPE(v5) == OBJECT_Actor
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
617 && uActiveCharacter
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
618 && v5 < 0x2000000
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
619 && pPlayers[uActiveCharacter]->CanAct()
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
620 && pPlayers[uActiveCharacter]->CanSteal() )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
621 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
622 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
623 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
624 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
625 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
626 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
627 ++pMessageQueue_50CBD0->uNumMessages;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
628 }*/
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
629 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, PID_ID(v6), 0);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
630
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
631 if ( pParty->bTurnBasedModeOn == 1 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
632 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
633 if ( pTurnEngine->turn_stage == 3 )
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1297
diff changeset
634 pTurnEngine->field_18 |= TE_FLAG_8;
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
635 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
636 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
637 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
638
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
639
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
640
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
641 //----- (00417871) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
642 void __thiscall sub_417871(int *pXY)
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
643 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
644 POINT v1; // [sp+0h] [bp-18h]@5
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
645 POINT a2; // [sp+8h] [bp-10h]@5
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
646 unsigned int pY; // [sp+10h] [bp-8h]@3
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
647 unsigned int pX; // [sp+14h] [bp-4h]@3
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
648
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
649 if ( !pRenderer->pRenderD3D )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
650 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
651 if ( pXY )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
652 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
653 pX = *pXY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
654 pY = pXY[1];
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
655 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
656 else
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
657 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
658 pMouse->GetClickPos(&pX, &pY);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
659 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
660 pMouse->GetCursorPos(&a2);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
661 pMouse->GetCursorPos(&v1);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
662 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
663 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
664 //----- (0041CD4F) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
665 bool UI_OnKeyDown(unsigned int vkKey)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
666 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
667 //unsigned int v1; // edi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
668 //unsigned int v2; // eax@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
669 int v3; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
670 int v4; // ecx@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
671 GUIButton *pButton; // eax@11
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
672 int v6; // edx@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
673 int v7; // ecx@20
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
674 char v8; // zf@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
675 //GUIButton *v9; // ecx@24
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
676 int v10; // esi@24
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
677 //int v11; // edx@26
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
678 int v12; // edx@28
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
679 int v13; // esi@32
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
680 //GUIButton *v14; // eax@37
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
681 int v15; // edx@38
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
682 int v17; // ecx@50
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
683 int v18; // edx@50
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
684 //GUIButton *v19; // ecx@54
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
685 int v20; // esi@54
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
686 //int v21; // edx@56
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
687 int v22; // ecx@59
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
688 int v23; // edx@59
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
689 int v24; // ecx@60
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
690 int v25; // esi@63
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
691 //unsigned int v26; // [sp+Ch] [bp-14h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
692 //int v27; // [sp+10h] [bp-10h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
693 int v28; // [sp+14h] [bp-Ch]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
694 int v29; // [sp+14h] [bp-Ch]@36
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
695 unsigned int uClickX; // [sp+18h] [bp-8h]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
696 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
697
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
698 //v1 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
699 //v27 = uNumVisibleWindows;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
700 if ( uNumVisibleWindows < 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
701 return false;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
702 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
703 for (int i = uNumVisibleWindows; i >= 0; --i)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
704 //while ( 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
705 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
706 v3 = pVisibleWindowsIdxs[i] - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
707 if (!pWindowList[v3].receives_keyboard_input)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
708 continue;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
709
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
710 switch (vkKey)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
711 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
712 case VK_LEFT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
713 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
714 v12 = pWindowList[v3].field_34;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
715 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
716 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
717 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
718 pWindowList[v3].pCurrentPosActiveItem -= v12;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
719 if ( v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
720 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
721 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
722 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
723 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
724 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
725 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
726 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
727 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
728 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
729 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
730 v13 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
731 if ( v13 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
732 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
733 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
734 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
735 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
736 --v13;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
737 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
738 while ( v13 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
739 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
740 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
741 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
742 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
743 case VK_RIGHT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
744 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
745 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
746 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
747 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
748 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
749 pWindowList[v3].pCurrentPosActiveItem = v7;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
750 if ( v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
751 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
752 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
753 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
754 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
755 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
756 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
757 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
758 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
759 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
760 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
761 v10 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
762 if ( v10 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
763 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
764 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
765 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
766 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
767 --v10;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
768 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
769 while ( v10 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
770 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
771 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
772 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
773 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
774 case VK_DOWN:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
775 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
776 v17 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
777 v18 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
778 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
779 pWindowList[v3].pCurrentPosActiveItem = v17;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
780 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
781 pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
782 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
783 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
784 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
785 v20 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
786 if ( v20 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
787 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
788 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
789 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
790 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
791 --v20;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
792 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
793 while ( v20 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
794 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
795 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
796 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
797 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
798 case VK_SELECT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
799 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
800 pMouse->GetClickPos(&uClickX, &uClickY);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
801 v4 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
802 v28 = v4 + pWindowList[v3].pNumPresenceButton;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
803 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
804 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
805 while ( 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
806 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
807 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
808 if ( v4 > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
809 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
810 v6 = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
811 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
812 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
813 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
814 --v6;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
815 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
816 while ( v6 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
817 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
818 if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
819 && (signed int)uClickX <= (signed int)pButton->uZ
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
820 && (signed int)uClickY >= (signed int)pButton->uY
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
821 && (signed int)uClickY <= (signed int)pButton->uW )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
822 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
823 ++v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
824 if ( v4 >= v28 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
825 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
826 //v1 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
827 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
828 //--i;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
829 //if ( i < 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
830 return false;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
831 //continue;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
832 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
833 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
834 pWindowList[v3].pCurrentPosActiveItem = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
835 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
836 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
837 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
838 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
839 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
840 case VK_UP:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
841 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
842 v22 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
843 v23 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
844 if ( v22 <= v23 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
845 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
846 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
847 v24 = v22 - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
848 v8 = pWindowList[v3].field_30 == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
849 pWindowList[v3].pCurrentPosActiveItem = v24;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
850 if ( !v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
851 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
852 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
853 v25 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
854 if ( v25 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
855 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
856 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
857 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
858 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
859 --v25;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
860 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
861 while ( v25 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
862 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
863 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
864 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
865 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
866 case VK_NEXT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
867 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
868 //if ( pWindowList[v3].field_30 != 0 ) //crashed at skill draw
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
869 //{
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
870 // pMouse->GetClickPos(&uClickX, &uClickY);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
871 // v4 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
872 // v29 = v4 + pWindowList[v3].pNumPresenceButton; //num buttons more than buttons
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
873 // if ( v4 < v29 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
874 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
875 // while ( 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
876 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
877 // pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
878 // if ( v4 > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
879 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
880 // v15 = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
881 // do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
882 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
883 // pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
884 // --v15;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
885 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
886 // while ( v15 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
887 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
888 // if ( (signed int)uClickX >= (signed int)pButton->uX
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
889 // && (signed int)uClickX <= (signed int)pButton->uZ
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
890 // && (signed int)uClickY >= (signed int)pButton->uY
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
891 // && (signed int)uClickY <= (signed int)pButton->uW )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
892 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
893 // pWindowList[v3].pCurrentPosActiveItem = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
894 // return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
895 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
896 // ++v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
897 // if ( v4 >= v29 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
898 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
899 // //v1 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
900 // //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
901 // break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
902 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
903 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
904 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
905 // else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
906 // {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
907 // //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
908 // }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
909 //}
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
910 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
911 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
912 default:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
913 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
914 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
915 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
916 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
917 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
918 }