comparison mm7_1.cpp @ 979:8b46828a64f4

Knight error fix
author Ritor1
date Thu, 09 May 2013 13:04:27 +0600
parents c8a0f6d89c70
children 1462a5f12b65
comparison
equal deleted inserted replaced
978:9334a8c59c8d 979:8b46828a64f4
110 { 110 {
111 //unsigned int v1; // edi@1 111 //unsigned int v1; // edi@1
112 //unsigned int v2; // eax@2 112 //unsigned int v2; // eax@2
113 int v3; // esi@3 113 int v3; // esi@3
114 int v4; // ecx@10 114 int v4; // ecx@10
115 GUIButton *v5; // eax@11 115 GUIButton *pButton; // eax@11
116 int v6; // edx@12 116 int v6; // edx@12
117 int v7; // ecx@20 117 int v7; // ecx@20
118 char v8; // zf@21 118 char v8; // zf@21
119 GUIButton *v9; // ecx@24 119 //GUIButton *v9; // ecx@24
120 int v10; // esi@24 120 int v10; // esi@24
121 //int v11; // edx@26 121 //int v11; // edx@26
122 int v12; // edx@28 122 int v12; // edx@28
123 int v13; // esi@32 123 int v13; // esi@32
124 GUIButton *v14; // eax@37 124 //GUIButton *v14; // eax@37
125 int v15; // edx@38 125 int v15; // edx@38
126 int v17; // ecx@50 126 int v17; // ecx@50
127 int v18; // edx@50 127 int v18; // edx@50
128 GUIButton *v19; // ecx@54 128 //GUIButton *v19; // ecx@54
129 int v20; // esi@54 129 int v20; // esi@54
130 //int v21; // edx@56 130 //int v21; // edx@56
131 int v22; // ecx@59 131 int v22; // ecx@59
132 int v23; // edx@59 132 int v23; // edx@59
133 int v24; // ecx@60 133 int v24; // ecx@60
140 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 140 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10
141 141
142 //v1 = 0; 142 //v1 = 0;
143 //v27 = uNumVisibleWindows; 143 //v27 = uNumVisibleWindows;
144 if ( uNumVisibleWindows < 0 ) 144 if ( uNumVisibleWindows < 0 )
145 return 0; 145 return false;
146 //v2 = pMessageQueue_50CBD0->uNumMessages; 146 //v2 = pMessageQueue_50CBD0->uNumMessages;
147 for (int i = uNumVisibleWindows; i >= 0; --i) 147 for (int i = uNumVisibleWindows; i >= 0; --i)
148 //while ( 1 ) 148 //while ( 1 )
149 { 149 {
150 v3 = pVisibleWindowsIdxs[i] - 1; 150 v3 = pVisibleWindowsIdxs[i] - 1;
151 if (!pWindowList[v3].receives_keyboard_input) 151 if (!pWindowList[v3].receives_keyboard_input)
152 continue; 152 continue;
153 153
154 switch (vkKey) 154 switch (vkKey)
155 { 155 {
156 case VK_LEFT: 156 case VK_LEFT:
157 { 157 {
158 v12 = pWindowList[v3].field_34; 158 v12 = pWindowList[v3].field_34;
159 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) 159 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
160 { 160 {
161 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; 161 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
162 pWindowList[v3].pCurrentPosActiveItem -= v12; 162 pWindowList[v3].pCurrentPosActiveItem -= v12;
163 if ( v8 ) 163 if ( v8 )
164 { 164 {
165 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 165 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
166 //v2 = pMessageQueue_50CBD0->uNumMessages; 166 //v2 = pMessageQueue_50CBD0->uNumMessages;
167 } 167 }
168 } 168 }
169 if ( pWindowList[v3].field_30 != 0 ) 169 if ( pWindowList[v3].field_30 != 0 )
170 { 170 {
171 break; 171 break;
172 } 172 }
173 v9 = pWindowList[v3].pControlsHead; 173 pButton = pWindowList[v3].pControlsHead;
174 v13 = pWindowList[v3].pCurrentPosActiveItem; 174 v13 = pWindowList[v3].pCurrentPosActiveItem;
175 if ( v13 > 0) 175 if ( v13 > 0)
176 { 176 {
177 do 177 do
178 { 178 {
179 v9 = v9->pNext; 179 pButton = pButton->pNext;
180 --v13; 180 --v13;
181 } 181 }
182 while ( v13 ); 182 while ( v13 );
183 } 183 }
184 184 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
185 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, 0); 185 break;
186 break; 186 }
187 } 187 case VK_RIGHT:
188 case VK_RIGHT: 188 {
189 { 189 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
190 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; 190 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
191 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) 191 {
192 { 192 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
193 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; 193 pWindowList[v3].pCurrentPosActiveItem = v7;
194 pWindowList[v3].pCurrentPosActiveItem = v7; 194 if ( v8 )
195 if ( v8 ) 195 {
196 { 196 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
197 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 197 //v2 = pMessageQueue_50CBD0->uNumMessages;
198 //v2 = pMessageQueue_50CBD0->uNumMessages; 198 }
199 } 199 }
200 } 200 if ( pWindowList[v3].field_30 != 0 )
201 if ( pWindowList[v3].field_30 != 0 ) 201 {
202 { 202 break;
203 break; 203 }
204 } 204 pButton = pWindowList[v3].pControlsHead;
205 v9 = pWindowList[v3].pControlsHead; 205 v10 = pWindowList[v3].pCurrentPosActiveItem;
206 v10 = pWindowList[v3].pCurrentPosActiveItem; 206 if ( v10 > 0)
207 if ( v10 > 0) 207 {
208 { 208 do
209 do 209 {
210 { 210 pButton = pButton->pNext;
211 v9 = v9->pNext; 211 --v10;
212 --v10; 212 }
213 } 213 while ( v10 );
214 while ( v10 ); 214 }
215 } 215 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
216 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, 0); 216 break;
217 break; 217 }
218 } 218 case VK_DOWN:
219 case VK_DOWN: 219 {
220 { 220 v17 = pWindowList[v3].pStartingPosActiveItem;
221 v17 = pWindowList[v3].pStartingPosActiveItem; 221 v18 = pWindowList[v3].pCurrentPosActiveItem;
222 v18 = pWindowList[v3].pCurrentPosActiveItem; 222 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
223 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) 223 pWindowList[v3].pCurrentPosActiveItem = v17;
224 pWindowList[v3].pCurrentPosActiveItem = v17; 224 else
225 else 225 pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
226 pWindowList[v3].pCurrentPosActiveItem = v18 + 1; 226 if ( pWindowList[v3].field_30 != 0 )
227 if ( pWindowList[v3].field_30 != 0 ) 227 return true;
228 return 1; 228 pButton = pWindowList[v3].pControlsHead;
229 v19 = pWindowList[v3].pControlsHead; 229 v20 = pWindowList[v3].pCurrentPosActiveItem;
230 v20 = pWindowList[v3].pCurrentPosActiveItem; 230 if ( v20 > 0)
231 if ( v20 > 0) 231 {
232 { 232 do
233 do 233 {
234 { 234 pButton = pButton->pNext;
235 v19 = v19->pNext; 235 --v20;
236 --v20; 236 }
237 } 237 while ( v20 );
238 while ( v20 ); 238 }
239 } 239 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
240 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, 0); 240 return true;
241 return 1; 241 }
242 } 242 case VK_SELECT:
243 case VK_SELECT: 243 {
244 { 244 pMouse->GetClickPos(&uClickX, &uClickY);
245 pMouse->GetClickPos(&uClickX, &uClickY); 245 v4 = pWindowList[v3].pStartingPosActiveItem;
246 v4 = pWindowList[v3].pStartingPosActiveItem; 246 v28 = v4 + pWindowList[v3].pNumPresenceButton;
247 v28 = v4 + pWindowList[v3].pNumPresenceButton; 247 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
248 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) 248 {
249 { 249 while ( 1 )
250 while ( 1 ) 250 {
251 { 251 pButton = pWindowList[v3].pControlsHead;
252 v5 = pWindowList[v3].pControlsHead; 252 if ( v4 > 0 )
253 if ( v4 > 0 ) 253 {
254 { 254 v6 = v4;
255 v6 = v4; 255 do
256 do 256 {
257 { 257 pButton = pButton->pNext;
258 v5 = v5->pNext; 258 --v6;
259 --v6; 259 }
260 } 260 while ( v6 );
261 while ( v6 ); 261 }
262 } 262 if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window
263 if ( (signed int)uClickX >= (signed int)v5->uX 263 && (signed int)uClickX <= (signed int)pButton->uZ
264 && (signed int)uClickX <= (signed int)v5->uZ 264 && (signed int)uClickY >= (signed int)pButton->uY
265 && (signed int)uClickY >= (signed int)v5->uY 265 && (signed int)uClickY <= (signed int)pButton->uW )
266 && (signed int)uClickY <= (signed int)v5->uW ) 266 break;
267 break; 267 ++v4;
268 ++v4; 268 if ( v4 >= v28 )
269 if ( v4 >= v28 ) 269 {
270 { 270 //v1 = 0;
271 //v1 = 0; 271 //v2 = pMessageQueue_50CBD0->uNumMessages;
272 //v2 = pMessageQueue_50CBD0->uNumMessages; 272 //--i;
273 --i; 273 //if ( i < 0 )
274 if ( i < 0 ) 274 return false;
275 return 0; 275 //continue;
276 continue; 276 }
277 } 277 }
278 } 278 pWindowList[v3].pCurrentPosActiveItem = v4;
279 pWindowList[v3].pCurrentPosActiveItem = v4; 279 return true;
280 return 1; 280 }
281 } 281 //v2 = pMessageQueue_50CBD0->uNumMessages;
282 //v2 = pMessageQueue_50CBD0->uNumMessages; 282 break;
283 break; 283 }
284 } 284 case VK_UP:
285 case VK_UP: 285 {
286 { 286 v22 = pWindowList[v3].pCurrentPosActiveItem;
287 v22 = pWindowList[v3].pCurrentPosActiveItem; 287 v23 = pWindowList[v3].pStartingPosActiveItem;
288 v23 = pWindowList[v3].pStartingPosActiveItem; 288 if ( v22 <= v23 )
289 if ( v22 <= v23 ) 289 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
290 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; 290 else
291 else 291 v24 = v22 - 1;
292 v24 = v22 - 1; 292 v8 = pWindowList[v3].field_30 == 0;
293 v8 = pWindowList[v3].field_30 == 0; 293 pWindowList[v3].pCurrentPosActiveItem = v24;
294 pWindowList[v3].pCurrentPosActiveItem = v24; 294 if ( !v8 )
295 if ( !v8 ) 295 return true;
296 return 1; 296 pButton = pWindowList[v3].pControlsHead;
297 v19 = pWindowList[v3].pControlsHead; 297 v25 = pWindowList[v3].pCurrentPosActiveItem;
298 v25 = pWindowList[v3].pCurrentPosActiveItem; 298 if ( v25 > 0)
299 if ( v25 > 0) 299 {
300 { 300 do
301 do 301 {
302 { 302 pButton = pButton->pNext;
303 v19 = v19->pNext; 303 --v25;
304 --v25; 304 }
305 } 305 while ( v25 );
306 while ( v25 ); 306 }
307 } 307 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
308 308 return true;
309 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, 0); 309 }
310 return 1; 310 case VK_NEXT:
311 } 311 {
312 case VK_NEXT: 312 if ( pWindowList[v3].field_30 != 0 )
313 { 313 {
314 if ( pWindowList[v3].field_30 != 0 ) 314 pMouse->GetClickPos(&uClickX, &uClickY);
315 { 315 v4 = pWindowList[v3].pStartingPosActiveItem;
316 pMouse->GetClickPos(&uClickX, &uClickY); 316 v29 = v4 + pWindowList[v3].pNumPresenceButton;
317 v4 = pWindowList[v3].pStartingPosActiveItem; 317 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
318 v29 = v4 + pWindowList[v3].pNumPresenceButton; 318 {
319 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) 319 while ( 1 )
320 { 320 {
321 while ( 1 ) 321 pButton = pWindowList[v3].pControlsHead;
322 { 322 if ( v4 > 0 )
323 v14 = pWindowList[v3].pControlsHead; 323 {
324 if ( v4 > 0 ) 324 v15 = v4;
325 { 325 do
326 v15 = v4; 326 {
327 do 327 pButton = pButton->pNext;
328 { 328 --v15;
329 v14 = v14->pNext; 329 }
330 --v15; 330 while ( v15 );
331 } 331 }
332 while ( v15 ); 332 if ( (signed int)uClickX >= (signed int)pButton->uX
333 } 333 && (signed int)uClickX <= (signed int)pButton->uZ
334 if ( (signed int)uClickX >= (signed int)v14->uX 334 && (signed int)uClickY >= (signed int)pButton->uY
335 && (signed int)uClickX <= (signed int)v14->uZ 335 && (signed int)uClickY <= (signed int)pButton->uW )
336 && (signed int)uClickY >= (signed int)v14->uY 336 {
337 && (signed int)uClickY <= (signed int)v14->uW ) 337 pWindowList[v3].pCurrentPosActiveItem = v4;
338 { 338 return true;
339 pWindowList[v3].pCurrentPosActiveItem = v4; 339 }
340 return 1; 340 ++v4;
341 } 341 if ( v4 >= v29 )
342 ++v4; 342 {
343 if ( v4 >= v29 ) 343 //v1 = 0;
344 { 344 //v2 = pMessageQueue_50CBD0->uNumMessages;
345 //v1 = 0; 345 break;
346 //v2 = pMessageQueue_50CBD0->uNumMessages; 346 }
347 break; 347 }
348 } 348 }
349 } 349 else
350 } 350 {
351 else 351 //v2 = pMessageQueue_50CBD0->uNumMessages;
352 { 352 }
353 //v2 = pMessageQueue_50CBD0->uNumMessages; 353 }
354 } 354 break;
355 } 355 }
356 break; 356 default:
357 } 357 {
358 default: 358 break;
359 { 359 }
360 break; 360 }
361 } 361 }
362
363 }
364 }
365
366 } 362 }
367 363
368 //----- (0041D20D) -------------------------------------------------------- 364 //----- (0041D20D) --------------------------------------------------------
369 char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2) 365 char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2)
370 { 366 {