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