Mercurial > mm7
annotate Keyboard.cpp @ 2156:eaaaa50d34e9
GetItemBonusEnchantment
author | Ritor1 |
---|---|
date | Fri, 10 Jan 2014 17:42:37 +0600 |
parents | d28d3c006077 |
children | 9bd7522cdbbb |
rev | line source |
---|---|
0 | 1 #include "Keyboard.h" |
2 #include "GUIWindow.h" | |
3 #include "Game.h" | |
4 | |
5 #include "mm7_data.h" | |
2152 | 6 #include "mm7_unsorted_subs.h" |
1297 | 7 #include "Vis.h" |
8 #include "MM7.h" | |
9 #include "Actor.h" | |
10 #include "DecorationList.h" | |
11 #include "Indoor.h" | |
12 #include "viewport.h" | |
13 #include "AudioPlayer.h" | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1459
diff
changeset
|
14 #include "Level/Decoration.h" |
0 | 15 |
16 | |
17 struct KeyboardActionMapping *pKeyActionMap; | |
18 struct AsyncKeyboard *pAsyncKeyboard; | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 //----- (00459C68) -------------------------------------------------------- | |
25 void KeyboardActionMapping::SetKeyMapping(int uAction, int vKey, KeyToggleType type) | |
26 { | |
27 pVirtualKeyCodesMapping[uAction] = vKey; | |
28 pToggleTypes[uAction] = type; | |
29 } | |
30 | |
31 //----- (00459C82) -------------------------------------------------------- | |
32 unsigned int KeyboardActionMapping::GetActionVKey(enum InputAction eAction) | |
33 { | |
34 return this->pVirtualKeyCodesMapping[eAction]; | |
35 } | |
36 | |
37 //----- (00459C8D) -------------------------------------------------------- | |
38 KeyboardActionMapping::KeyboardActionMapping() | |
39 { | |
40 uLastKeyPressed = 0; | |
271 | 41 field_204 = 0; |
323 | 42 pWindow = nullptr; |
0 | 43 |
44 SetDefaultMapping(); | |
45 ReadMappings(); | |
46 | |
47 ResetKeys(); | |
48 | |
1031 | 49 uGameMenuUI_CurentlySelectedKeyIdx = -1; |
0 | 50 } |
1031 | 51 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx; |
0 | 52 |
53 //----- (00459CC4) -------------------------------------------------------- | |
54 void KeyboardActionMapping::SetDefaultMapping() | |
55 { | |
56 pVirtualKeyCodesMapping[0] = VK_UP; | |
57 pToggleTypes[0] = TOGGLE_Continuously; | |
58 pVirtualKeyCodesMapping[1] = VK_DOWN; | |
59 pToggleTypes[1] = TOGGLE_Continuously; | |
60 pVirtualKeyCodesMapping[2] = VK_LEFT; | |
61 pToggleTypes[2] = TOGGLE_Continuously; | |
62 pVirtualKeyCodesMapping[3] = VK_RIGHT; | |
63 pToggleTypes[3] = TOGGLE_Continuously; | |
64 pVirtualKeyCodesMapping[8] = 'A'; | |
65 pToggleTypes[8] = TOGGLE_OneTimePress; | |
66 pVirtualKeyCodesMapping[7] = 'S'; | |
67 pToggleTypes[7] = TOGGLE_OneTimePress; | |
68 pVirtualKeyCodesMapping[4] = 'Y'; | |
69 pToggleTypes[4] = TOGGLE_OneTimePress; | |
70 pVirtualKeyCodesMapping[5] = 'X'; | |
71 pToggleTypes[5] = TOGGLE_OneTimePress; | |
72 pVirtualKeyCodesMapping[6] = VK_RETURN; | |
73 pToggleTypes[6] = TOGGLE_OneTimePress; | |
74 pVirtualKeyCodesMapping[9] = VK_SPACE; | |
75 pToggleTypes[9] = TOGGLE_OneTimePress; | |
76 pVirtualKeyCodesMapping[10] = 'C'; | |
77 pToggleTypes[10] = TOGGLE_OneTimePress; | |
78 pVirtualKeyCodesMapping[11] = 'B'; | |
79 pToggleTypes[11] = TOGGLE_OneTimePress; | |
80 pVirtualKeyCodesMapping[12] = VK_TAB; | |
81 pToggleTypes[12] = TOGGLE_OneTimePress; | |
82 pVirtualKeyCodesMapping[13] = 'Q'; | |
83 pToggleTypes[13] = TOGGLE_OneTimePress; | |
84 pVirtualKeyCodesMapping[14] = 'Z'; | |
85 pToggleTypes[14] = TOGGLE_OneTimePress; | |
86 pVirtualKeyCodesMapping[15] = 'R'; | |
87 pToggleTypes[15] = TOGGLE_OneTimePress; | |
88 pVirtualKeyCodesMapping[16] = 'T'; | |
89 pToggleTypes[16] = TOGGLE_OneTimePress; | |
90 pVirtualKeyCodesMapping[17] = 'N'; | |
91 pToggleTypes[17] = TOGGLE_OneTimePress; | |
92 pVirtualKeyCodesMapping[18] = 'M'; | |
93 pToggleTypes[18] = TOGGLE_OneTimePress; | |
94 pVirtualKeyCodesMapping[20] = VK_NEXT; | |
95 pToggleTypes[20] = TOGGLE_Continuously; | |
96 pVirtualKeyCodesMapping[21] = VK_DELETE; | |
97 pToggleTypes[21] = TOGGLE_Continuously; | |
98 | |
99 SetKeyMapping(INPUT_CenterView, VK_END, TOGGLE_Continuously); | |
100 SetKeyMapping(INPUT_ZoomIn, VK_ADD, TOGGLE_OneTimePress); | |
101 SetKeyMapping(INPUT_ZoomOut, VK_SUBTRACT, TOGGLE_OneTimePress); | |
102 SetKeyMapping(INPUT_FlyUp, VK_PRIOR, TOGGLE_Continuously); | |
103 SetKeyMapping(INPUT_FlyDown, VK_INSERT, TOGGLE_Continuously); | |
104 SetKeyMapping(INPUT_Land, VK_HOME, TOGGLE_OneTimePress); | |
105 SetKeyMapping(INPUT_AlwaysRun, 'U', TOGGLE_OneTimePress); | |
106 SetKeyMapping(INPUT_StrafeLeft, VK_OEM_4, TOGGLE_Continuously); | |
107 SetKeyMapping(INPUT_StrafeRight, VK_OEM_6, TOGGLE_Continuously); | |
108 } | |
109 | |
110 //----- (00459E3F) -------------------------------------------------------- | |
111 void KeyboardActionMapping::ResetKeys() | |
112 { | |
113 for (uint i = 0; i < 30; ++i) | |
114 GetAsyncKeyState(pVirtualKeyCodesMapping[i]); | |
115 } | |
116 | |
117 //----- (00459E5A) -------------------------------------------------------- | |
1038 | 118 void KeyboardActionMapping::EnterText(int a2, int max_string_len, GUIWindow *pWindow) |
0 | 119 { |
120 KeyboardActionMapping *v4; // esi@1 | |
121 | |
122 v4 = this; | |
123 memset(this->pPressedKeysBuffer, 0, 0x101u); | |
124 v4->uNumKeysPressed = 0; | |
125 if ( a2 ) | |
126 v4->field_204 = 2; | |
127 else | |
128 v4->field_204 = 1; | |
1038 | 129 v4->max_input_string_len = max_string_len; |
0 | 130 v4->pWindow = pWindow; |
1038 | 131 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_IN_PROGRESS; |
0 | 132 } |
133 | |
134 //----- (00459ED1) -------------------------------------------------------- | |
1038 | 135 void KeyboardActionMapping::SetWindowInputStatus(int a2) |
0 | 136 { |
1038 | 137 field_204 = 0; |
138 if ( pWindow ) | |
139 pWindow->receives_keyboard_input_2 = a2; | |
0 | 140 } |
141 | |
142 //----- (00459F10) -------------------------------------------------------- | |
143 bool KeyboardActionMapping::_459F10(unsigned int a2) | |
144 { | |
145 int v3; // [sp-4h] [bp-4h]@3 | |
146 | |
147 pKeyActionMap->uLastKeyPressed = a2; | |
1031 | 148 if ( uGameMenuUI_CurentlySelectedKeyIdx == -1 ) |
0 | 149 { |
150 if ( pKeyActionMap->field_204 == 1 ) | |
151 { | |
152 if ( a2 != 8 ) | |
153 { | |
154 if ( a2 == 9 ) | |
155 return 1; | |
156 if ( a2 == 13 ) | |
157 goto LABEL_3; | |
158 if ( a2 == 27 ) | |
159 goto LABEL_15; | |
1038 | 160 if ( this->uNumKeysPressed >= this->max_input_string_len ) |
0 | 161 return 1; |
162 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; | |
163 ++pKeyActionMap->uNumKeysPressed; | |
164 LABEL_24: | |
165 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0; | |
166 return 1; | |
167 } | |
168 } | |
169 else | |
170 { | |
171 if ( pKeyActionMap->field_204 != 2 ) | |
172 return 0; | |
173 if ( a2 != 8 ) | |
174 { | |
175 if ( a2 == 13 ) | |
176 goto LABEL_3; | |
177 if ( a2 != 27 ) | |
178 { | |
179 if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 ) | |
180 { | |
1038 | 181 if ( pKeyActionMap->uNumKeysPressed < this->max_input_string_len ) |
0 | 182 { |
183 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; | |
184 ++pKeyActionMap->uNumKeysPressed; | |
185 } | |
186 } | |
187 return 1; | |
188 } | |
189 LABEL_15: | |
1459 | 190 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
191 return 1; | |
0 | 192 } |
193 } | |
194 if ( !pKeyActionMap->uNumKeysPressed ) | |
195 return 1; | |
196 --pKeyActionMap->uNumKeysPressed; | |
197 goto LABEL_24; | |
198 } | |
199 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; | |
200 ++pKeyActionMap->uNumKeysPressed; | |
201 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0; | |
1459 | 202 |
0 | 203 LABEL_3: |
1459 | 204 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CONFIRMED); |
0 | 205 return 1; |
206 } | |
1031 | 207 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx; |
0 | 208 |
209 //----- (00459FFC) -------------------------------------------------------- | |
210 void KeyboardActionMapping::ReadMappings() | |
211 { | |
212 //KeyboardActionMapping *v1; // esi@1 | |
213 int v2; // eax@2 | |
214 unsigned int v3; // eax@3 | |
215 int v4; // eax@6 | |
216 unsigned int v5; // eax@7 | |
217 int v6; // eax@10 | |
218 unsigned int v7; // eax@11 | |
219 int v8; // eax@14 | |
220 unsigned int v9; // eax@15 | |
221 int v10; // eax@18 | |
222 unsigned int v11; // eax@19 | |
223 int v12; // eax@22 | |
224 //unsigned int v13; // eax@23 | |
225 int v14; // eax@26 | |
226 //unsigned int v15; // eax@27 | |
227 int v16; // eax@30 | |
228 //unsigned int v17; // eax@31 | |
229 int v18; // eax@34 | |
230 //unsigned int v19; // eax@35 | |
231 int v20; // eax@38 | |
232 //unsigned int v21; // eax@39 | |
233 int v22; // eax@42 | |
234 //unsigned int v23; // eax@43 | |
235 int v24; // eax@46 | |
236 //unsigned int v25; // eax@47 | |
237 int v26; // eax@50 | |
238 //unsigned int v27; // eax@51 | |
239 int v28; // eax@54 | |
240 //unsigned int v29; // eax@55 | |
241 int v30; // eax@58 | |
242 //unsigned int v31; // eax@59 | |
243 int v32; // eax@62 | |
244 //unsigned int v33; // eax@63 | |
245 int v34; // eax@66 | |
246 //unsigned int v35; // eax@67 | |
247 int v36; // eax@70 | |
248 //unsigned int v37; // eax@71 | |
249 int v38; // eax@74 | |
250 //unsigned int v39; // eax@75 | |
251 int v40; // eax@78 | |
252 //unsigned int v41; // eax@79 | |
253 int v42; // eax@82 | |
254 //unsigned int v43; // eax@83 | |
255 int v44; // eax@86 | |
256 //unsigned int v45; // eax@87 | |
257 int v46; // eax@90 | |
258 //unsigned int v47; // eax@91 | |
259 int v48; // eax@94 | |
260 //unsigned int v49; // eax@95 | |
261 int v50; // eax@98 | |
262 //unsigned int v51; // eax@99 | |
263 int v52; // eax@102 | |
264 //unsigned int v53; // eax@103 | |
265 int v54; // eax@106 | |
266 //unsigned int v55; // eax@107 | |
267 int v56; // eax@110 | |
268 unsigned int v57; // eax@111 | |
269 int v58; // eax@114 | |
270 unsigned int v59; // eax@115 | |
271 int v60; // eax@118 | |
272 unsigned int v61; // eax@119 | |
273 //char str[32]; // [sp+Ch] [bp-20h]@1 | |
274 | |
275 char str[32]; | |
276 | |
277 ReadWindowsRegistryString("KEY_FORWARD", str, 32, "DEFAULT"); | |
278 if ( strcmp(str, "DEFAULT") && (LOBYTE(v2) = GetActionDefaultVKey(str), v2 != -1) ) | |
279 { | |
280 pVirtualKeyCodesMapping[0] = GetActionDefaultVKey(str); | |
281 } | |
282 else | |
283 { | |
284 pVirtualKeyCodesMapping[0] = VK_UP; | |
285 } | |
286 pToggleTypes[0] = TOGGLE_Continuously; | |
287 ReadWindowsRegistryString("KEY_BACKWARD", str, 0x20u, "DEFAULT"); | |
288 if ( strcmp(str, "DEFAULT") && (LOBYTE(v4) = GetActionDefaultVKey(str), v4 != -1) ) | |
289 { | |
290 pVirtualKeyCodesMapping[1] = GetActionDefaultVKey(str); | |
291 } | |
292 else | |
293 { | |
294 pVirtualKeyCodesMapping[1] = VK_DOWN; | |
295 } | |
296 pToggleTypes[1] = TOGGLE_Continuously; | |
297 | |
298 ReadWindowsRegistryString("KEY_LEFT", str, 0x20u, "DEFAULT"); | |
299 if ( strcmp(str, "DEFAULT") && (LOBYTE(v6) = GetActionDefaultVKey(str), v6 != -1) ) | |
300 { | |
301 pVirtualKeyCodesMapping[2] = GetActionDefaultVKey(str); | |
302 } | |
303 else | |
304 { | |
305 pVirtualKeyCodesMapping[2] = VK_LEFT; | |
306 } | |
307 pToggleTypes[2] = TOGGLE_Continuously; | |
308 | |
309 ReadWindowsRegistryString("KEY_RIGHT", str, 0x20u, "DEFAULT"); | |
310 if ( strcmp(str, "DEFAULT") && (LOBYTE(v8) = GetActionDefaultVKey(str), v8 != -1) ) | |
311 { | |
312 pVirtualKeyCodesMapping[3] = GetActionDefaultVKey(str); | |
313 } | |
314 else | |
315 { | |
316 pVirtualKeyCodesMapping[3] = VK_RIGHT; | |
317 } | |
318 pToggleTypes[3] = TOGGLE_Continuously; | |
319 | |
320 ReadWindowsRegistryString("KEY_ATTACK", str, 0x20u, "DEFAULT"); | |
321 if ( strcmp(str, "DEFAULT") && (LOBYTE(v10) = GetActionDefaultVKey(str), v10 != -1) ) | |
322 { | |
323 pVirtualKeyCodesMapping[8] = GetActionDefaultVKey(str); | |
324 } | |
325 else | |
326 { | |
327 pVirtualKeyCodesMapping[8] = 'A'; | |
328 } | |
329 pToggleTypes[8] = TOGGLE_OneTimePress; | |
330 | |
331 ReadWindowsRegistryString("KEY_CASTREADY", str, 0x20u, "DEFAULT"); | |
332 if ( strcmp(str, "DEFAULT") && (LOBYTE(v12) = GetActionDefaultVKey(str), v12 != -1) ) | |
333 { | |
334 pVirtualKeyCodesMapping[7] = GetActionDefaultVKey(str); | |
335 } | |
336 else | |
337 { | |
338 pVirtualKeyCodesMapping[7] = 'S'; | |
339 } | |
340 pToggleTypes[7] = TOGGLE_OneTimePress; | |
341 | |
342 ReadWindowsRegistryString("KEY_YELL", str, 0x20u, "DEFAULT"); | |
343 if ( strcmp(str, "DEFAULT") && (LOBYTE(v14) = GetActionDefaultVKey(str), v14 != -1) ) | |
344 { | |
345 pVirtualKeyCodesMapping[4] = GetActionDefaultVKey(str); | |
346 } | |
347 else | |
348 { | |
349 pVirtualKeyCodesMapping[4] = 'Y'; | |
350 } | |
351 pToggleTypes[4] = TOGGLE_OneTimePress; | |
352 | |
353 ReadWindowsRegistryString("KEY_JUMP", str, 0x20u, "DEFAULT"); | |
354 if ( strcmp(str, "DEFAULT") && (LOBYTE(v16) = GetActionDefaultVKey(str), v16 != -1) ) | |
355 { | |
356 pVirtualKeyCodesMapping[5] = GetActionDefaultVKey(str); | |
357 } | |
358 else | |
359 { | |
360 pVirtualKeyCodesMapping[5] = 'X'; | |
361 } | |
362 pToggleTypes[5] = TOGGLE_OneTimePress; | |
363 | |
364 ReadWindowsRegistryString("KEY_COMBAT", str, 0x20u, "DEFAULT"); | |
365 if ( strcmp(str, "DEFAULT") && (LOBYTE(v18) = GetActionDefaultVKey(str), v18 != -1) ) | |
366 { | |
367 pVirtualKeyCodesMapping[6] = GetActionDefaultVKey(str); | |
368 } | |
369 else | |
370 { | |
371 pVirtualKeyCodesMapping[6] = VK_RETURN; | |
372 } | |
373 pToggleTypes[6] = TOGGLE_OneTimePress; | |
374 | |
375 ReadWindowsRegistryString("KEY_EVENTTRIGGER", str, 0x20u, "DEFAULT"); | |
376 if ( strcmp(str, "DEFAULT") && (LOBYTE(v20) = GetActionDefaultVKey(str), v20 != -1) ) | |
377 { | |
378 pVirtualKeyCodesMapping[9] = GetActionDefaultVKey(str); | |
379 } | |
380 else | |
381 { | |
382 pVirtualKeyCodesMapping[9] = VK_SPACE; | |
383 } | |
384 pToggleTypes[9] = TOGGLE_OneTimePress; | |
385 | |
386 ReadWindowsRegistryString("KEY_CAST", str, 0x20u, "DEFAULT"); | |
387 if ( strcmp(str, "DEFAULT") && (LOBYTE(v22) = GetActionDefaultVKey(str), v22 != -1) ) | |
388 { | |
389 pVirtualKeyCodesMapping[10] = GetActionDefaultVKey(str); | |
390 } | |
391 else | |
392 { | |
393 pVirtualKeyCodesMapping[10] = 'C'; | |
394 } | |
395 pToggleTypes[10] = TOGGLE_OneTimePress; | |
396 | |
397 ReadWindowsRegistryString("KEY_PASS", str, 0x20u, "DEFAULT"); | |
398 if ( strcmp(str, "DEFAULT") && (LOBYTE(v24) = GetActionDefaultVKey(str), v24 != -1) ) | |
399 { | |
400 pVirtualKeyCodesMapping[11] = GetActionDefaultVKey(str); | |
401 } | |
402 else | |
403 { | |
404 pVirtualKeyCodesMapping[11] = 'B'; | |
405 } | |
406 pToggleTypes[11] = TOGGLE_OneTimePress; | |
407 | |
408 ReadWindowsRegistryString("KEY_CHARCYCLE", str, 0x20u, "DEFAULT"); | |
409 if ( strcmp(str, "DEFAULT") && (LOBYTE(v26) = GetActionDefaultVKey(str), v26 != -1) ) | |
410 { | |
411 pVirtualKeyCodesMapping[12] = GetActionDefaultVKey(str); | |
412 } | |
413 else | |
414 { | |
415 pVirtualKeyCodesMapping[12] = VK_TAB; | |
416 } | |
417 pToggleTypes[12] = TOGGLE_OneTimePress; | |
418 | |
419 ReadWindowsRegistryString("KEY_QUEST", str, 0x20u, "DEFAULT"); | |
420 if ( strcmp(str, "DEFAULT") && (LOBYTE(v28) = GetActionDefaultVKey(str), v28 != -1) ) | |
421 { | |
422 pVirtualKeyCodesMapping[13] = GetActionDefaultVKey(str); | |
423 } | |
424 else | |
425 { | |
426 pVirtualKeyCodesMapping[13] = 'Q'; | |
427 } | |
428 pToggleTypes[13] = TOGGLE_OneTimePress; | |
429 | |
430 ReadWindowsRegistryString("KEY_QUICKREF", str, 0x20u, "DEFAULT"); | |
431 if ( strcmp(str, "DEFAULT") && (LOBYTE(v30) = GetActionDefaultVKey(str), v30 != -1) ) | |
432 { | |
433 pVirtualKeyCodesMapping[14] = GetActionDefaultVKey(str); | |
434 } | |
435 else | |
436 { | |
437 pVirtualKeyCodesMapping[14] = 'Z'; | |
438 } | |
439 pToggleTypes[14] = TOGGLE_OneTimePress; | |
440 | |
441 ReadWindowsRegistryString("KEY_REST", str, 0x20u, "DEFAULT"); | |
442 if ( strcmp(str, "DEFAULT") && (LOBYTE(v32) = GetActionDefaultVKey(str), v32 != -1) ) | |
443 { | |
444 pVirtualKeyCodesMapping[15] = GetActionDefaultVKey(str); | |
445 } | |
446 else | |
447 { | |
448 pVirtualKeyCodesMapping[15] = 'R'; | |
449 } | |
450 pToggleTypes[15] = TOGGLE_OneTimePress; | |
451 | |
452 ReadWindowsRegistryString("KEY_TIMECAL", str, 0x20u, "DEFAULT"); | |
453 if ( strcmp(str, "DEFAULT") && (LOBYTE(v34) = GetActionDefaultVKey(str), v34 != -1) ) | |
454 { | |
455 pVirtualKeyCodesMapping[16] = GetActionDefaultVKey(str); | |
456 } | |
457 else | |
458 { | |
459 pVirtualKeyCodesMapping[16] = 'T'; | |
460 } | |
461 pToggleTypes[16] = TOGGLE_OneTimePress; | |
462 | |
463 ReadWindowsRegistryString("KEY_AUTONOTES", str, 0x20u, "DEFAULT"); | |
464 if ( strcmp(str, "DEFAULT") && (LOBYTE(v36) = GetActionDefaultVKey(str), v36 != -1) ) | |
465 { | |
466 pVirtualKeyCodesMapping[17] = GetActionDefaultVKey(str); | |
467 } | |
468 else | |
469 { | |
470 pVirtualKeyCodesMapping[17] = 'N'; | |
471 } | |
472 pToggleTypes[17] = TOGGLE_OneTimePress; | |
473 | |
474 ReadWindowsRegistryString("KEY_MAPBOOK", str, 0x20u, "DEFAULT"); | |
475 if ( strcmp(str, "DEFAULT") && (LOBYTE(v38) = GetActionDefaultVKey(str), v38 != -1) ) | |
476 { | |
477 pVirtualKeyCodesMapping[18] = GetActionDefaultVKey(str); | |
478 } | |
479 else | |
480 { | |
481 pVirtualKeyCodesMapping[18] = 'M'; | |
482 } | |
483 pToggleTypes[18] = TOGGLE_OneTimePress; | |
484 | |
485 ReadWindowsRegistryString("KEY_LOOKUP", str, 0x20u, "DEFAULT"); | |
486 if ( strcmp(str, "DEFAULT") && (LOBYTE(v40) = GetActionDefaultVKey(str), v40 != -1) ) | |
487 { | |
488 pVirtualKeyCodesMapping[20] = GetActionDefaultVKey(str); | |
489 } | |
490 else | |
491 { | |
492 pVirtualKeyCodesMapping[20] = VK_NEXT; | |
493 } | |
494 pToggleTypes[20] = TOGGLE_OneTimePress; | |
495 | |
496 ReadWindowsRegistryString("KEY_LOOKDOWN", str, 0x20u, "DEFAULT"); | |
497 if ( strcmp(str, "DEFAULT") && (LOBYTE(v42) = GetActionDefaultVKey(str), v42 != -1) ) | |
498 { | |
499 pVirtualKeyCodesMapping[21] = GetActionDefaultVKey(str); | |
500 } | |
501 else | |
502 { | |
503 pVirtualKeyCodesMapping[21] = VK_DELETE; | |
504 } | |
505 pToggleTypes[21] = TOGGLE_OneTimePress; | |
506 | |
507 ReadWindowsRegistryString("KEY_CENTERVIEWPT", str, 0x20u, "DEFAULT"); | |
508 if ( strcmp(str, "DEFAULT") && (LOBYTE(v44) = GetActionDefaultVKey(str), v44 != -1) ) | |
509 { | |
510 pVirtualKeyCodesMapping[22] = GetActionDefaultVKey(str); | |
511 } | |
512 else | |
513 { | |
514 pVirtualKeyCodesMapping[22] = VK_END; | |
515 } | |
516 pToggleTypes[22] = TOGGLE_OneTimePress; | |
517 | |
518 ReadWindowsRegistryString("KEY_ZOOMIN", str, 0x20u, "DEFAULT"); | |
519 if ( strcmp(str, "DEFAULT") && (LOBYTE(v46) = GetActionDefaultVKey(str), v46 != -1) ) | |
520 { | |
521 pVirtualKeyCodesMapping[23] = GetActionDefaultVKey(str); | |
522 } | |
523 else | |
524 { | |
525 pVirtualKeyCodesMapping[23] = VK_ADD; | |
526 } | |
527 pToggleTypes[23] = TOGGLE_OneTimePress; | |
528 | |
529 ReadWindowsRegistryString("KEY_ZOOMOUT", str, 0x20u, "DEFAULT"); | |
530 if ( strcmp(str, "DEFAULT") && (LOBYTE(v48) = GetActionDefaultVKey(str), v48 != -1) ) | |
531 { | |
532 pVirtualKeyCodesMapping[24] = GetActionDefaultVKey(str); | |
533 } | |
534 else | |
535 { | |
536 pVirtualKeyCodesMapping[24] = VK_SUBTRACT; | |
537 } | |
538 pToggleTypes[24] = TOGGLE_OneTimePress; | |
539 | |
540 ReadWindowsRegistryString("KEY_FLYUP", str, 0x20u, "DEFAULT"); | |
541 if ( strcmp(str, "DEFAULT") && (LOBYTE(v50) = GetActionDefaultVKey(str), v50 != -1) ) | |
542 { | |
543 pVirtualKeyCodesMapping[25] = GetActionDefaultVKey(str); | |
544 } | |
545 else | |
546 { | |
547 pVirtualKeyCodesMapping[25] = VK_PRIOR; | |
548 } | |
549 pToggleTypes[25] = TOGGLE_Continuously; | |
550 | |
551 ReadWindowsRegistryString("KEY_FLYDOWN", str, 0x20u, "DEFAULT"); | |
552 if ( strcmp(str, "DEFAULT") && (LOBYTE(v52) = GetActionDefaultVKey(str), v52 != -1) ) | |
553 { | |
554 pVirtualKeyCodesMapping[26] = GetActionDefaultVKey(str); | |
555 } | |
556 else | |
557 { | |
558 pVirtualKeyCodesMapping[26] = VK_INSERT; | |
559 } | |
560 pToggleTypes[26] = TOGGLE_Continuously; | |
561 | |
562 ReadWindowsRegistryString("KEY_LAND", str, 0x20u, "DEFAULT"); | |
563 if ( strcmp(str, "DEFAULT") && (LOBYTE(v54) = GetActionDefaultVKey(str), v54 != -1) ) | |
564 { | |
565 pVirtualKeyCodesMapping[27] = GetActionDefaultVKey(str); | |
566 } | |
567 else | |
568 { | |
569 pVirtualKeyCodesMapping[27] = VK_HOME; | |
570 } | |
571 pToggleTypes[27] = TOGGLE_OneTimePress; | |
572 | |
573 ReadWindowsRegistryString("KEY_ALWAYSRUN", str, 0x20u, "DEFAULT"); | |
574 if ( strcmp(str, "DEFAULT") && (LOBYTE(v56) = GetActionDefaultVKey(str), v56 != -1) ) | |
575 { | |
576 pVirtualKeyCodesMapping[19] = GetActionDefaultVKey(str); | |
577 } | |
578 else | |
579 { | |
580 pVirtualKeyCodesMapping[19] = 'U'; | |
581 } | |
582 pToggleTypes[19] = TOGGLE_OneTimePress; | |
583 | |
584 bAlwaysRun = ReadWindowsRegistryInt("valAlwaysRun", 0) != 0; | |
585 bFlipOnExit = ReadWindowsRegistryInt("FlipOnExit", 0) != 0; | |
586 ReadWindowsRegistryString("KEY_STEPLEFT", str, 0x20u, "DEFAULT"); | |
587 if ( strcmp(str, "DEFAULT") && (LOBYTE(v58) = GetActionDefaultVKey(str), v58 != -1) ) | |
588 { | |
589 pVirtualKeyCodesMapping[28] = GetActionDefaultVKey(str); | |
590 pToggleTypes[28] = TOGGLE_OneTimePress; | |
591 } | |
592 else | |
593 { | |
594 pToggleTypes[28] = TOGGLE_Continuously; | |
595 pVirtualKeyCodesMapping[28] = VK_OEM_4; | |
596 } | |
597 | |
598 ReadWindowsRegistryString("KEY_STEPRIGHT", str, 0x20u, "DEFAULT"); | |
599 if ( strcmp(str, "DEFAULT") && (LOBYTE(v60) = GetActionDefaultVKey(str), v60 != -1) ) | |
600 { | |
601 pVirtualKeyCodesMapping[29] = GetActionDefaultVKey(str); | |
602 pToggleTypes[29] = TOGGLE_OneTimePress; | |
603 } | |
604 else | |
605 { | |
606 pToggleTypes[29] = TOGGLE_Continuously; | |
607 pVirtualKeyCodesMapping[29] = VK_OEM_6; | |
608 } | |
609 } | |
610 | |
611 //----- (0045A960) -------------------------------------------------------- | |
612 void KeyboardActionMapping::StoreMappings() | |
613 { | |
614 const char *v2; // eax@1 | |
615 const char *v3; // eax@1 | |
616 const char *v4; // eax@1 | |
617 const char *v5; // eax@1 | |
618 const char *v6; // eax@1 | |
619 const char *v7; // eax@1 | |
620 const char *v8; // eax@1 | |
621 const char *v9; // eax@1 | |
622 const char *v10; // eax@1 | |
623 const char *v11; // eax@1 | |
624 const char *v12; // eax@1 | |
625 const char *v13; // eax@1 | |
626 const char *v14; // eax@1 | |
627 const char *v15; // eax@1 | |
628 const char *v16; // eax@1 | |
629 const char *v17; // eax@1 | |
630 const char *v18; // eax@1 | |
631 const char *v19; // eax@1 | |
632 const char *v20; // eax@1 | |
633 const char *v21; // eax@1 | |
634 const char *v22; // eax@1 | |
635 const char *v23; // eax@1 | |
636 const char *v24; // eax@1 | |
637 const char *v25; // eax@1 | |
638 const char *v26; // eax@1 | |
639 const char *v27; // eax@1 | |
640 const char *v28; // eax@1 | |
641 const char *v29; // eax@1 | |
642 | |
1038 | 643 v2 = GetVKeyDisplayName(pVirtualKeyCodesMapping[0]); |
0 | 644 WriteWindowsRegistryString("KEY_FORWARD", v2); |
645 v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]); | |
646 WriteWindowsRegistryString("KEY_BACKWARD", v3); | |
647 v4 = GetVKeyDisplayName(pVirtualKeyCodesMapping[2]); | |
648 WriteWindowsRegistryString("KEY_LEFT", v4); | |
649 v5 = GetVKeyDisplayName(pVirtualKeyCodesMapping[3]); | |
650 WriteWindowsRegistryString("KEY_RIGHT", v5); | |
651 v6 = GetVKeyDisplayName(pVirtualKeyCodesMapping[8]); | |
652 WriteWindowsRegistryString("KEY_ATTACK", v6); | |
653 v7 = GetVKeyDisplayName(pVirtualKeyCodesMapping[7]); | |
654 WriteWindowsRegistryString("KEY_CASTREADY", v7); | |
655 v8 = GetVKeyDisplayName(pVirtualKeyCodesMapping[4]); | |
656 WriteWindowsRegistryString("KEY_YELL", v8); | |
657 v9 = GetVKeyDisplayName(pVirtualKeyCodesMapping[5]); | |
658 WriteWindowsRegistryString("KEY_JUMP", v9); | |
659 v10 = GetVKeyDisplayName(pVirtualKeyCodesMapping[6]); | |
660 WriteWindowsRegistryString("KEY_COMBAT", v10); | |
661 v11 = GetVKeyDisplayName(pVirtualKeyCodesMapping[9]); | |
662 WriteWindowsRegistryString("KEY_EVENTTRIGGER", v11); | |
663 v12 = GetVKeyDisplayName(pVirtualKeyCodesMapping[10]); | |
664 WriteWindowsRegistryString("KEY_CAST", v12); | |
665 v13 = GetVKeyDisplayName(pVirtualKeyCodesMapping[11]); | |
666 WriteWindowsRegistryString("KEY_PASS", v13); | |
667 v14 = GetVKeyDisplayName(pVirtualKeyCodesMapping[12]); | |
668 WriteWindowsRegistryString("KEY_CHARCYCLE", v14); | |
669 v15 = GetVKeyDisplayName(pVirtualKeyCodesMapping[13]); | |
670 WriteWindowsRegistryString("KEY_QUEST", v15); | |
671 v16 = GetVKeyDisplayName(pVirtualKeyCodesMapping[14]); | |
672 WriteWindowsRegistryString("KEY_QUICKREF", v16); | |
673 v17 = GetVKeyDisplayName(pVirtualKeyCodesMapping[15]); | |
674 WriteWindowsRegistryString("KEY_REST", v17); | |
675 v18 = GetVKeyDisplayName(pVirtualKeyCodesMapping[16]); | |
676 WriteWindowsRegistryString("KEY_TIMECAL", v18); | |
677 v19 = GetVKeyDisplayName(pVirtualKeyCodesMapping[17]); | |
678 WriteWindowsRegistryString("KEY_AUTONOTES", v19); | |
679 v20 = GetVKeyDisplayName(pVirtualKeyCodesMapping[18]); | |
680 WriteWindowsRegistryString("KEY_MAPBOOK", v20); | |
681 v21 = GetVKeyDisplayName(pVirtualKeyCodesMapping[20]); | |
682 WriteWindowsRegistryString("KEY_LOOKUP", v21); | |
683 v22 = GetVKeyDisplayName(pVirtualKeyCodesMapping[21]); | |
684 WriteWindowsRegistryString("KEY_LOOKDOWN", v22); | |
685 v23 = GetVKeyDisplayName(pVirtualKeyCodesMapping[22]); | |
686 WriteWindowsRegistryString("KEY_CENTERVIEWPT", v23); | |
687 v24 = GetVKeyDisplayName(pVirtualKeyCodesMapping[23]); | |
688 WriteWindowsRegistryString("KEY_ZOOMIN", v24); | |
689 v25 = GetVKeyDisplayName(pVirtualKeyCodesMapping[24]); | |
690 WriteWindowsRegistryString("KEY_ZOOMOUT", v25); | |
691 v26 = GetVKeyDisplayName(pVirtualKeyCodesMapping[25]); | |
692 WriteWindowsRegistryString("KEY_FLYUP", v26); | |
693 v27 = GetVKeyDisplayName(pVirtualKeyCodesMapping[26]); | |
694 WriteWindowsRegistryString("KEY_FLYDOWN", v27); | |
695 v28 = GetVKeyDisplayName(pVirtualKeyCodesMapping[27]); | |
696 WriteWindowsRegistryString("KEY_LAND", v28); | |
697 v29 = GetVKeyDisplayName(pVirtualKeyCodesMapping[19]); | |
698 WriteWindowsRegistryString("KEY_ALWAYSRUN", v29); | |
699 } | |
700 | |
701 //----- (0045ABCA) -------------------------------------------------------- | |
702 const unsigned __int8 KeyboardActionMapping::GetActionDefaultVKey(const char *Str) | |
703 { | |
704 unsigned __int8 result; // al@3 | |
705 | |
706 if ( !strcmp(Str, "UP") ) | |
707 return VK_UP; | |
708 if ( !strcmp(Str, "DOWN") ) | |
709 return VK_DOWN; | |
710 if (!strcmp(Str, "ÂËÅÂÎ") || !strcmp(Str, "LEFT")) | |
711 return VK_LEFT; | |
712 if (!strcmp(Str, "ÂÏÐÀÂÎ") || !strcmp(Str, "RIGHT")) | |
713 return VK_RIGHT; | |
714 if ( !strcmp(Str, "RETURN") ) | |
715 return VK_RETURN; | |
716 if ( !strcmp(Str, "SPACE") ) | |
717 return VK_SPACE; | |
718 if ( !strcmp(Str, "PAGE_DOWN") ) | |
719 return VK_NEXT; | |
720 if ( !strcmp(Str, "PAGE_UP") ) | |
721 return VK_PRIOR; | |
722 if ( !strcmp(Str, "TAB") ) | |
723 return VK_TAB; | |
724 if ( !strcmp(Str, "SUBTRACT") ) | |
725 return VK_SUBTRACT; | |
726 if ( !strcmp(Str, "ADD") ) | |
727 return VK_ADD; | |
728 if ( !strcmp(Str, "END") ) | |
729 return VK_END; | |
730 if ( !strcmp(Str, "DELETE") ) | |
731 return VK_DELETE; | |
732 if ( !strcmp(Str, "HOME") ) | |
733 return VK_HOME; | |
734 if ( !strcmp(Str, "INSERT") ) | |
735 return VK_INSERT; | |
736 if ( strcmp(Str, "COMMA") ) | |
737 { | |
738 if ( !strcmp(Str, "DECIMAL") ) | |
739 return VK_DECIMAL; | |
740 if ( strcmp(Str, "SEMICOLON") ) | |
741 { | |
742 if ( strcmp(Str, "PERIOD") ) | |
743 { | |
744 if ( strcmp(Str, "SLASH") ) | |
745 { | |
746 if ( strcmp(Str, "SQUOTE") ) | |
747 { | |
748 if ( strcmp(Str, "BACKSLASH") ) | |
749 { | |
750 if ( !strcmp(Str, "BACKSPACE") ) | |
751 return VK_BACK; | |
752 if ( !strcmp(Str, "CONTROL") ) | |
753 return VK_CONTROL; | |
754 if ( strlen(Str) != 1 || (result = *Str, (unsigned __int8)*Str < 0x41u) || result > 0x5Au ) | |
755 result = -1; | |
756 } | |
757 else | |
758 { | |
759 result = -36; | |
760 } | |
761 } | |
762 else | |
763 { | |
764 result = -34; | |
765 } | |
766 } | |
767 else | |
768 { | |
769 result = -65; | |
770 } | |
771 } | |
772 else | |
773 { | |
774 result = -66; | |
775 } | |
776 } | |
777 else | |
778 { | |
779 result = -70; | |
780 } | |
781 } | |
782 else | |
783 { | |
784 result = -68; | |
785 } | |
786 return result; | |
787 } | |
788 | |
789 //----- (0045AE2C) -------------------------------------------------------- | |
790 const char *KeyboardActionMapping::GetVKeyDisplayName(signed int a1) | |
791 { | |
792 char *v3; // [sp-4h] [bp-8h]@2 | |
793 | |
794 static char static_sub_45AE2C_string_69ADE0[32]; | |
795 | |
796 if ( a1 == VK_UP ) | |
797 { | |
798 v3 = "UP"; | |
799 LABEL_53: | |
800 strcpy(static_sub_45AE2C_string_69ADE0, v3); | |
801 return static_sub_45AE2C_string_69ADE0; | |
802 } | |
803 if ( a1 == VK_DOWN ) | |
804 { | |
805 v3 = "DOWN"; | |
806 goto LABEL_53; | |
807 } | |
808 if ( a1 == VK_LEFT ) | |
809 { | |
159 | 810 v3 = "LEFT"; |
0 | 811 goto LABEL_53; |
812 } | |
813 if ( a1 == VK_RIGHT ) | |
814 { | |
159 | 815 v3 = "RIGHT"; |
0 | 816 goto LABEL_53; |
817 } | |
818 if ( a1 == VK_RETURN ) | |
819 { | |
820 v3 = "RETURN"; | |
821 goto LABEL_53; | |
822 } | |
823 if ( a1 == VK_SPACE ) | |
824 { | |
825 v3 = "SPACE"; | |
826 goto LABEL_53; | |
827 } | |
828 if ( a1 == VK_NEXT ) | |
829 { | |
830 v3 = "PAGE_DOWN"; | |
831 goto LABEL_53; | |
832 } | |
833 if ( a1 == VK_PRIOR ) | |
834 { | |
835 v3 = "PAGE_UP"; | |
836 goto LABEL_53; | |
837 } | |
838 if ( a1 == VK_TAB ) | |
839 { | |
840 v3 = "TAB"; | |
841 goto LABEL_53; | |
842 } | |
843 if ( a1 == 'm' ) | |
844 { | |
845 v3 = "SUBTRACT"; | |
846 goto LABEL_53; | |
847 } | |
848 if ( a1 == 'k' ) | |
849 { | |
850 v3 = "ADD"; | |
851 goto LABEL_53; | |
852 } | |
853 if ( a1 == VK_END ) | |
854 { | |
855 v3 = "END"; | |
856 goto LABEL_53; | |
857 } | |
858 if ( a1 == VK_DELETE ) | |
859 { | |
860 v3 = "DELETE"; | |
861 goto LABEL_53; | |
862 } | |
863 if ( a1 == VK_HOME ) | |
864 { | |
865 v3 = "HOME"; | |
866 goto LABEL_53; | |
867 } | |
868 if ( a1 == VK_INSERT ) | |
869 { | |
870 v3 = "INSERT"; | |
871 goto LABEL_53; | |
872 } | |
873 if ( a1 == VK_DECIMAL ) | |
874 { | |
875 v3 = "DECIMAL"; | |
876 goto LABEL_53; | |
877 } | |
878 if ( a1 == VK_OEM_COMMA ) | |
879 { | |
880 v3 = "COMMA"; | |
881 goto LABEL_53; | |
882 } | |
883 if ( a1 == VK_OEM_1 ) | |
884 { | |
885 v3 = "SEMICOLON"; | |
886 goto LABEL_53; | |
887 } | |
888 if ( a1 == VK_OEM_PERIOD ) | |
889 { | |
890 v3 = "PERIOD"; | |
891 goto LABEL_53; | |
892 } | |
893 if ( a1 == VK_OEM_2 ) | |
894 { | |
895 v3 = "SLASH"; | |
896 goto LABEL_53; | |
897 } | |
898 if ( a1 == VK_OEM_7 ) | |
899 { | |
900 v3 = "SQUOTE"; | |
901 goto LABEL_53; | |
902 } | |
903 if ( a1 == VK_OEM_5 ) | |
904 { | |
905 v3 = "BACKSLASH"; | |
906 goto LABEL_53; | |
907 } | |
908 if ( a1 == VK_CONTROL ) | |
909 { | |
910 v3 = "CONTROL"; | |
911 goto LABEL_53; | |
912 } | |
913 if ( a1 == VK_BACK ) | |
914 { | |
915 v3 = "BACKSPACE"; | |
916 goto LABEL_53; | |
917 } | |
918 if ( a1 < 65 || a1 > 90 ) | |
919 { | |
920 v3 = "-ÍÅÒ -"; | |
921 goto LABEL_53; | |
922 } | |
923 *(unsigned short *)static_sub_45AE2C_string_69ADE0 = (unsigned __int8)a1; | |
924 return static_sub_45AE2C_string_69ADE0; | |
925 } | |
926 | |
927 | |
928 //----- (0045B019) -------------------------------------------------------- | |
929 void Keyboard::EnterCriticalSection() | |
930 { | |
931 } | |
932 | |
933 //----- (0045B06E) -------------------------------------------------------- | |
934 bool Keyboard::IsShiftHeld() | |
935 { | |
1038 | 936 return GetAsyncKeyState(VK_SHIFT); |
0 | 937 } |
938 | |
939 //----- (0045B0A9) -------------------------------------------------------- | |
940 bool Keyboard::IsKeyBeingHeld(int vKey) | |
941 { | |
1038 | 942 return GetAsyncKeyState(vKey) & 0x8001; |
0 | 943 } |
944 | |
945 //----- (0045B0CE) -------------------------------------------------------- | |
946 bool Keyboard::WasKeyPressed(int vKey) | |
947 { | |
1038 | 948 return GetAsyncKeyState(vKey) & 1; |
0 | 949 } |
1297 | 950 //----- (0046A14B) -------------------------------------------------------- |
951 void OnPressSpace() | |
952 { | |
953 //SHORT v0; // ax@2 | |
954 int *v1; // eax@2 | |
955 char *v2; // ebx@5 | |
956 unsigned int v3; // esi@5 | |
957 signed int v4; // edi@7 | |
958 unsigned int v5; // edx@7 | |
959 int v6; // ecx@8 | |
960 int v7; // eax@8 | |
961 int v8; // ecx@17 | |
962 int *v9; // esi@22 | |
963 signed int v10; // ebx@22 | |
964 int i; // edi@23 | |
965 int v12; // edx@24 | |
966 int v13; // ecx@24 | |
967 int j; // esi@28 | |
968 int v16; // [sp+4h] [bp-1Ch]@0 | |
969 char *v17; // [sp+8h] [bp-18h]@5 | |
970 unsigned int v18; // [sp+Ch] [bp-14h]@5 | |
971 int v19; // [sp+10h] [bp-10h]@8 | |
972 int *v20; // [sp+14h] [bp-Ch]@5 | |
973 int *v21; // [sp+18h] [bp-8h]@7 | |
974 int v22; // [sp+1Ch] [bp-4h]@4 | |
975 | |
976 if ( pRenderer->pRenderD3D ) | |
977 { | |
978 pGame->PickKeyboard(GetAsyncKeyState(VK_CONTROL) & 0x8001, &vis_sprite_filter_3, &vis_door_filter); | |
1980 | 979 int pid = pGame->pVisInstance->get_picked_object_zbuf_val(); |
1297 | 980 if ( pid != -1 ) |
981 DoInteractionWithTopmostZObject(pid & 0xFFFF, PID_ID(pid)); | |
982 return; | |
983 } | |
984 | |
985 | |
986 // software render stuff following | |
987 | |
988 static int dword_720660[100]; // 720660 | |
989 static int dword_7207F0[100]; // 7207F0 | |
990 | |
991 v22 = 0; | |
992 v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer | |
993 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
994 { | |
995 v2 = (char *)v1 - 50; | |
996 v1 = (int *)((char *)v1 + 50); | |
997 v3 = 640 * viewparams->uScreen_topL_Y; | |
998 v17 = v2; | |
999 v20 = v1; | |
1000 v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; | |
1001 do | |
1002 { | |
1003 if ( (signed int)v2 < (signed int)v20 ) | |
1004 { | |
1005 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; | |
1006 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; | |
1007 v4 = v22; | |
1008 v5 = (((char *)v20 - v2 - 1) >> 1) + 1; | |
1009 do | |
1010 { | |
1011 v6 = 0; | |
1012 v7 = *v1 & 0xFFFF; | |
1013 v19 = 0; | |
1014 if ( v4 > 0 ) | |
1015 { | |
1016 do | |
1017 { | |
1018 if ( dword_7207F0[v6] == v7 ) | |
1019 break; | |
1020 ++v6; | |
1021 v19 = v6; | |
1022 } | |
1023 while ( v6 < v22 ); | |
1024 } | |
1025 if ( PID_TYPE(v7) == OBJECT_Decoration) | |
1026 { | |
1027 v16 = (unsigned int)PID_ID(v7); | |
1028 if ( (signed int)(((unsigned int)*v21 >> 16) | |
1029 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)PID_ID(v7)].uDecorationDescID].uRadius) <= 512 ) | |
1030 if ( v19 == v22 && v4 < 100 ) | |
1031 { | |
1032 ++v22; | |
1033 ++v4; | |
1034 v8 = *v21; | |
1035 dword_7207F0[v4 - 1] = v7; | |
1036 dword_720660[v4 - 1] = v8; | |
1037 } | |
1038 } | |
1039 else if ( (unsigned int)*v21 <= 0x2000000 ) | |
1040 { | |
1041 if ( v19 == v22 && v4 < 100 ) | |
1042 { | |
1043 ++v22; | |
1044 ++v4; | |
1045 v8 = *v21; | |
1046 dword_7207F0[v4 - 1] = v7; | |
1047 dword_720660[v4 - 1] = v8; | |
1048 } | |
1049 } | |
1050 v1 = v21 + 2; | |
1051 --v5; | |
1052 v21 += 2; | |
1053 } | |
1054 while ( v5 ); | |
1055 v2 = v17; | |
1056 } | |
1057 v3 += 1280; | |
1058 --v18; | |
1059 } | |
1060 while ( v18 ); | |
1061 } | |
1062 if ( v22 > 0 ) | |
1063 { | |
1064 v9 = dword_720660; | |
1065 v10 = 1; | |
1066 do | |
1067 { | |
1068 for ( i = v10; i < v22; ++i ) | |
1069 { | |
1070 v12 = *v9; | |
1071 v13 = dword_720660[i]; | |
1072 if ( v13 < *v9 ) | |
1073 { | |
1074 *v9 = v13; | |
1075 dword_720660[i] = v12; | |
1076 } | |
1077 } | |
1078 ++v10; | |
1079 ++v9; | |
1080 LOBYTE(v1) = v10 - 1; | |
1081 } | |
1082 while ( v10 - 1 < v22 ); | |
1083 } | |
1084 for ( j = 0; j < v22; ++j ) | |
1085 { | |
1086 LOBYTE(v1) = DoInteractionWithTopmostZObject(dword_720660[j] & 0xFFFF, v16); | |
1087 if ( !(char)v1 ) | |
1088 break; | |
1089 } | |
1090 } |