Mercurial > mm7
comparison mm7_1.cpp @ 972:c8a0f6d89c70
Some inqury on selecting Knight bug.
author | Nomad |
---|---|
date | Wed, 08 May 2013 19:54:19 +0200 |
parents | 5a12082c803d |
children | 8b46828a64f4 |
comparison
equal
deleted
inserted
replaced
971:35f2e900618e | 972:c8a0f6d89c70 |
---|---|
97 { | 97 { |
98 j->uX = dword_50698C; | 98 j->uX = dword_50698C; |
99 j->uY = dword_506988; | 99 j->uY = dword_506988; |
100 j->uZ = dword_506984; | 100 j->uZ = dword_506984; |
101 j->uW = dword_506980; | 101 j->uW = dword_506980; |
102 pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); | 102 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); |
103 } | 103 } |
104 } | 104 } |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 //----- (0041CD4F) -------------------------------------------------------- | 108 //----- (0041CD4F) -------------------------------------------------------- |
109 bool __thiscall sub_41CD4F(unsigned int _this) | 109 bool UI_OnKeyDown(unsigned int vkKey) |
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 *v5; // eax@11 |
116 int v6; // edx@12 | 116 int v6; // edx@12 |
117 int v7; // ecx@20 | 117 int v7; // ecx@20 |
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 |
134 int v25; // esi@63 | 134 int v25; // esi@63 |
135 unsigned int v26; // [sp+Ch] [bp-14h]@1 | 135 //unsigned int v26; // [sp+Ch] [bp-14h]@1 |
136 int v27; // [sp+10h] [bp-10h]@1 | 136 //int v27; // [sp+10h] [bp-10h]@1 |
137 int v28; // [sp+14h] [bp-Ch]@10 | 137 int v28; // [sp+14h] [bp-Ch]@10 |
138 int v29; // [sp+14h] [bp-Ch]@36 | 138 int v29; // [sp+14h] [bp-Ch]@36 |
139 unsigned int uClickX; // [sp+18h] [bp-8h]@10 | 139 unsigned int uClickX; // [sp+18h] [bp-8h]@10 |
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 v26 = _this; | 143 //v27 = uNumVisibleWindows; |
144 v27 = uNumVisibleWindows; | |
145 if ( uNumVisibleWindows < 0 ) | 144 if ( uNumVisibleWindows < 0 ) |
146 return 0; | 145 return 0; |
147 v2 = pMessageQueue_50CBD0->uNumMessages; | 146 //v2 = pMessageQueue_50CBD0->uNumMessages; |
148 while ( 1 ) | 147 for (int i = uNumVisibleWindows; i >= 0; --i) |
149 { | 148 //while ( 1 ) |
150 v3 = pVisibleWindowsIdxs[v27] - 1; | 149 { |
151 if ( pWindowList[v3].field_44 != v1 ) | 150 v3 = pVisibleWindowsIdxs[i] - 1; |
152 { | 151 if (!pWindowList[v3].receives_keyboard_input) |
153 switch(v26) | 152 continue; |
153 | |
154 switch (vkKey) | |
154 { | 155 { |
155 case VK_LEFT: | 156 case VK_LEFT: |
156 { | 157 { |
157 v12 = pWindowList[v3].field_34; | 158 v12 = pWindowList[v3].field_34; |
158 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) | 159 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) |
159 { | 160 { |
160 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; | 161 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; |
161 pWindowList[v3].pCurrentPosActiveItem -= v12; | 162 pWindowList[v3].pCurrentPosActiveItem -= v12; |
162 if ( v8 ) | 163 if ( v8 ) |
163 { | 164 { |
164 pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); | 165 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
165 v2 = pMessageQueue_50CBD0->uNumMessages; | 166 //v2 = pMessageQueue_50CBD0->uNumMessages; |
166 } | 167 } |
167 } | 168 } |
168 if ( pWindowList[v3].field_30 != v1 ) | 169 if ( pWindowList[v3].field_30 != 0 ) |
169 { | 170 { |
170 break; | 171 break; |
171 } | 172 } |
172 v9 = pWindowList[v3].pControlsHead; | 173 v9 = pWindowList[v3].pControlsHead; |
173 v13 = pWindowList[v3].pCurrentPosActiveItem; | 174 v13 = pWindowList[v3].pCurrentPosActiveItem; |
174 if ( v13 > (signed int)v1 ) | 175 if ( v13 > 0) |
175 { | 176 { |
176 do | 177 do |
177 { | 178 { |
178 v9 = v9->pNext; | 179 v9 = v9->pNext; |
179 --v13; | 180 --v13; |
180 } | 181 } |
181 while ( v13 ); | 182 while ( v13 ); |
182 } | 183 } |
183 | 184 |
184 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); | 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; |
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, v1, v1, -1, v1, v1, v1, v1); | 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 != v1 ) | 201 if ( pWindowList[v3].field_30 != 0 ) |
201 { | 202 { |
202 break; | 203 break; |
203 } | 204 } |
204 v9 = pWindowList[v3].pControlsHead; | 205 v9 = pWindowList[v3].pControlsHead; |
205 v10 = pWindowList[v3].pCurrentPosActiveItem; | 206 v10 = pWindowList[v3].pCurrentPosActiveItem; |
206 if ( v10 > (signed int)v1 ) | 207 if ( v10 > 0) |
207 { | 208 { |
208 do | 209 do |
209 { | 210 { |
210 v9 = v9->pNext; | 211 v9 = v9->pNext; |
211 --v10; | 212 --v10; |
212 } | 213 } |
213 while ( v10 ); | 214 while ( v10 ); |
214 } | 215 } |
215 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); | 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 != v1 ) | 227 if ( pWindowList[v3].field_30 != 0 ) |
227 return 1; | 228 return 1; |
228 v19 = pWindowList[v3].pControlsHead; | 229 v19 = pWindowList[v3].pControlsHead; |
229 v20 = pWindowList[v3].pCurrentPosActiveItem; | 230 v20 = pWindowList[v3].pCurrentPosActiveItem; |
230 if ( v20 > (signed int)v1 ) | 231 if ( v20 > 0) |
231 { | 232 { |
232 do | 233 do |
233 { | 234 { |
234 v19 = v19->pNext; | 235 v19 = v19->pNext; |
235 --v20; | 236 --v20; |
236 } | 237 } |
237 while ( v20 ); | 238 while ( v20 ); |
238 } | 239 } |
239 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); | 240 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, 0); |
240 return 1; | 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); |
265 && (signed int)uClickY <= (signed int)v5->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 --v27; | 273 --i; |
273 if ( v27 < 0 ) | 274 if ( i < 0 ) |
274 return 0; | 275 return 0; |
275 continue; | 276 continue; |
276 } | 277 } |
277 } | 278 } |
278 pWindowList[v3].pCurrentPosActiveItem = v4; | 279 pWindowList[v3].pCurrentPosActiveItem = v4; |
279 return 1; | 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 == v1; | 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 1; | 296 return 1; |
296 v19 = pWindowList[v3].pControlsHead; | 297 v19 = pWindowList[v3].pControlsHead; |
297 v25 = pWindowList[v3].pCurrentPosActiveItem; | 298 v25 = pWindowList[v3].pCurrentPosActiveItem; |
298 if ( v25 > (signed int)v1 ) | 299 if ( v25 > 0) |
299 { | 300 { |
300 do | 301 do |
301 { | 302 { |
302 v19 = v19->pNext; | 303 v19 = v19->pNext; |
303 --v25; | 304 --v25; |
304 } | 305 } |
305 while ( v25 ); | 306 while ( v25 ); |
306 } | 307 } |
307 | 308 |
308 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); | 309 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, 0); |
309 return 1; | 310 return 1; |
310 } | 311 } |
311 case VK_NEXT: | 312 case VK_NEXT: |
312 { | 313 { |
313 if ( pWindowList[v3].field_30 != v1 ) | 314 if ( pWindowList[v3].field_30 != 0 ) |
314 { | 315 { |
315 pMouse->GetClickPos(&uClickX, &uClickY); | 316 pMouse->GetClickPos(&uClickX, &uClickY); |
316 v4 = pWindowList[v3].pStartingPosActiveItem; | 317 v4 = pWindowList[v3].pStartingPosActiveItem; |
317 v29 = v4 + pWindowList[v3].pNumPresenceButton; | 318 v29 = v4 + pWindowList[v3].pNumPresenceButton; |
318 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) | 319 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) |
339 return 1; | 340 return 1; |
340 } | 341 } |
341 ++v4; | 342 ++v4; |
342 if ( v4 >= v29 ) | 343 if ( v4 >= v29 ) |
343 { | 344 { |
344 v1 = 0; | 345 //v1 = 0; |
345 v2 = pMessageQueue_50CBD0->uNumMessages; | 346 //v2 = pMessageQueue_50CBD0->uNumMessages; |
346 break; | 347 break; |
347 } | 348 } |
348 } | 349 } |
349 } | 350 } |
350 else | 351 else |
351 { | 352 { |
352 v2 = pMessageQueue_50CBD0->uNumMessages; | 353 //v2 = pMessageQueue_50CBD0->uNumMessages; |
353 } | 354 } |
354 } | 355 } |
355 break; | 356 break; |
356 } | 357 } |
357 default: | 358 default: |
358 { | 359 { |
359 break; | 360 break; |
360 } | 361 } |
361 | 362 |
362 } | 363 } |
363 } | |
364 --v27; | |
365 if ( v27 < 0 ) | |
366 return 0; | |
367 } | 364 } |
368 | 365 |
369 } | 366 } |
370 | 367 |
371 //----- (0041D20D) -------------------------------------------------------- | 368 //----- (0041D20D) -------------------------------------------------------- |