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