-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcollimator.pas
680 lines (572 loc) · 17 KB
/
collimator.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
unit collimator;
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
interface
function Init:boolean;
function IsCollimatorInstalled(wpn:pointer):boolean;stdcall;
function IsLensedScopeInstalled(wpn:pointer):boolean;stdcall;
function CanUseAlterScope(wpn:pointer):boolean;
function GetAlterScopeZoomFactor(wpn:pointer):single; stdcall;
function IsAlterZoom(wpn:pointer):boolean; stdcall;
function GetZoomLensVisibilityFactor(wpn:pointer):single; stdcall;
function IsLastZoomAlter(wpn:pointer):boolean; stdcall;
function GetAlterZoomDirectSwitchMixupFactor(wpn:pointer):single; stdcall;
function IsHudModelForceUnhide(wpn:pointer):boolean; stdcall;
function IsUIForceHiding(wpn:pointer): boolean;stdcall;
function IsUIForceUnhiding(wpn:pointer): boolean;stdcall;
implementation
uses BaseGameData, gunsl_config, HudItemUtils, sysutils, MatVectors, ActorUtils, strutils, messenger, WeaponAdditionalBuffer, windows, LensDoubleRender;
var
last_hud_data:pointer;
function GetAlterScopeZoomFactor(wpn:pointer):single; stdcall;
begin
if IsScopeAttached(wpn) then begin
result:=game_ini_r_single_def(GetCurrentScopeSection(wpn), 'alter_scope_zoom_factor', 1.0);
end else begin
result:=game_ini_r_single_def(GetSection(wpn), 'alter_scope_zoom_factor', 1.0)
end;
end;
function CanUseAlterScope(wpn:pointer):boolean;
begin
result:=false;
if IsGrenadeMode(wpn) then exit;
if IsScopeAttached(wpn) then begin
result:=game_ini_r_bool_def(GetCurrentScopeSection(wpn), 'alter_zoom_allowed', false);
end else begin
result:=game_ini_r_bool_def(GetHudSection(wpn), 'alter_zoom_allowed', false);
result:=FindBoolValueInUpgradesDef(wpn, 'alter_zoom_allowed', result, true);
end;
end;
function IsCollimatorInstalled(wpn:pointer):boolean;stdcall;
var
scope:PChar;
begin
result:=false;
if not IsScopeAttached(wpn) then exit;
scope:=GetCurrentScopeSection(wpn);
scope:=game_ini_read_string(scope, 'scope_name');
result:=game_ini_r_bool_def(scope, 'collimator', false)
end;
function IsLensedScopeInstalled(wpn:pointer):boolean;stdcall;
var
scope:PChar;
scopestatus:cardinal;
begin
result:=false;
scopestatus:=GetScopeStatus(wpn);
if (scopestatus = 2) then begin
if IsScopeAttached(wpn) then begin
scope:=GetCurrentScopeSection(wpn);
scope:=game_ini_read_string(scope, 'scope_name');
result:=game_ini_r_bool_def(scope, 'need_lens_frame', false)
end;
end else if (scopestatus = 1) then begin
result:=game_ini_r_bool_def(GetSection(wpn), 'need_lens_frame', false);
result:=FindBoolValueInUpgradesDef(wpn, 'need_lens_frame', result, true);
end;
end;
function IsHudModelForceUnhide(wpn:pointer):boolean; stdcall;
var
buf:WpnBuf;
begin
buf:=GetBuffer(wpn);
result:=IsCollimatorInstalled(wpn) or (IsLensedScopeInstalled(wpn) and IsLensEnabled()) or ((buf<>nil) and buf.IsAlterZoomMode());
end;
procedure PatchHudVisibility(); stdcall;
//CWeapon::need_renderable
asm
xor eax, eax
pushad
push esi
call IsHudModelForceUnhide;
test al, al
popad
je @finish
mov eax, 1
@finish:
pop edi
pop esi
ret
end;
procedure ChangeHudOffsets(wpn:pointer; hud_data:pointer); stdcall;
var
section:PChar;
pos_str, rot_str:string;
pos, rot, alt_pos, alt_rot, delta_pos, delta_rot, target_pos, target_rot, zerovec:FVector3;
rb:cardinal;
buf:WpnBuf;
is_alter:boolean;
mixup_factor:single;
const
EPS = 0.0001;
begin
if not IsCollimAimEnabled() then exit;
is_alter:=false;
last_hud_data:=nil;
v_zero(@zerovec);
section:=GetHudSection(wpn);
buf:=GetBuffer(wpn);
last_hud_data:=hud_data;
if (GetScopeStatus(wpn)=2) and IsScopeAttached(wpn) then begin
section:=GetCurrentScopeSection(wpn);
end;
if (buf<>nil) and CanUseAlterScope(wpn) then begin
if ((GetAimFactor(wpn)>0) and buf.IsLastZoomAlter()) then begin
//Óæå áûëè â àëüòåðíàòèâíîì ïðèöåëèâàíèè, îñòàåìñÿ â íåì äî âûõîäà
is_alter:=true;
end else if buf.IsAlterZoomMode() then begin
is_alter:=true;
end;
end;
if last_hud_data<>nil then begin
if IsGrenadeMode(wpn) then begin
pos_str := 'gl';
rot_str := 'gl';
end else begin
pos_str := 'aim';
rot_str := 'aim';
end;
pos_str:=pos_str+'_hud_offset_pos';
rot_str:=rot_str+'_hud_offset_rot';
if Is16x9() then begin
pos_str:=pos_str+'_16x9';
rot_str:=rot_str+'_16x9';
end;
pos:=game_ini_read_vector3_def(section, PChar(pos_str), @zerovec);
rot:=game_ini_read_vector3_def(section, PChar(rot_str), @zerovec);
if buf <> nil then begin
mixup_factor:=buf.GetAlterZoomDirectSwitchMixupFactor();
end else begin
mixup_factor:=0;
end;
alt_pos:=game_ini_read_vector3_def(section, PChar('alter_' + pos_str), @zerovec);
alt_rot:=game_ini_read_vector3_def(section, PChar('alter_' + rot_str), @zerovec);
if is_alter then begin
if (mixup_factor > EPS) then begin
//Ïåðåõîäèì â àëüòåðíàòèâíîå ïðèöåëèâàíèå èç îáû÷íîãî
delta_pos:=alt_pos;
v_sub(@delta_pos, @pos);
v_mul(@delta_pos, mixup_factor);
v_sub(@alt_pos, @delta_pos);
delta_rot:=alt_rot;
v_sub(@delta_rot, @rot);
v_mul(@delta_rot, mixup_factor);
v_sub(@alt_rot, @delta_rot);
end;
target_pos:=alt_pos;
target_rot:=alt_rot;
end else begin
if (mixup_factor > EPS) then begin
//Ïåðåõîäèì â îáû÷íîå ïðèöåëèâàíèå èç àëüòåðíàòèâíîãî
delta_pos:=pos;
v_sub(@delta_pos, @alt_pos);
v_mul(@delta_pos, mixup_factor);
v_sub(@pos, @delta_pos);
delta_rot:=rot;
v_sub(@delta_rot, @alt_rot);
v_mul(@delta_rot, mixup_factor);
v_sub(@rot, @delta_rot);
end;
target_pos:=pos;
target_rot:=rot;
end;
writeprocessmemory(hndl, PChar(last_hud_data)+$2b, @target_pos, 12, rb);
writeprocessmemory(hndl, PChar(last_hud_data)+$4f, @target_rot, 12, rb);
end;
end;
procedure RestoreHudOffsets(wpn:pointer); stdcall;
var
section:PChar;
pos_str, rot_str:string;
pos, rot, zerovec:FVector3;
rb:cardinal;
begin
if not IsCollimAimEnabled() or (last_hud_data=nil) then exit;
section:=GetHudSection(wpn);
v_zero(@zerovec);
if IsGrenadeMode(wpn) then begin
pos_str := 'gl';
rot_str := 'gl';
end else begin
pos_str := 'aim';
rot_str := 'aim';
end;
pos_str:=pos_str+'_hud_offset_pos';
rot_str:=pos_str+'_hud_offset_rot';
if Is16x9() then begin
pos_str:=pos_str+'_16x9';
rot_str:=rot_str+'_16x9';
end;
pos:=game_ini_read_vector3_def(section, PChar(pos_str), @zerovec);
rot:=game_ini_read_vector3_def(section, PChar(rot_str), @zerovec);
writeprocessmemory(hndl, PChar(last_hud_data)+$2b, @pos, 12, rb);
writeprocessmemory(hndl, PChar(last_hud_data)+$4f, @rot, 12, rb);
end;
procedure CWeapon_UpdateHudAdditional_savedata_patch(); stdcall;
asm
pushfd
pushad
movzx eax, bl
lea eax, [eax+eax*2]
lea eax, [edi+eax*4]
push eax
sub esi, $2e0
push esi
call ChangeHudOffsets
popad
popfd
movss xmm0, [esi+$1c8]
ret
end;
procedure CWeapon_UpdateHudAdditional_restoredata_patch(); stdcall;
asm
push eax
movss [esp], xmm1
pushad
sub esi, $2e0
push esi
call RestoreHudOffsets
popad
movss xmm1, [esp]
add esp, 4
cmp byte ptr [ebp+$5D4], 00
end;
function IsUIForceUnhiding(wpn:pointer): boolean;stdcall;
var
buf:WpnBuf;
begin
result:=IsHudModelForceUnhide(wpn);
//Äàëüíåéøèå ïðîâåðêè èìåþò ñìûñë òîëüêî åñëè õóäîâàÿ ìîäåëü îðóæèÿ íå ñêðûòà
if result then begin
buf:=GetBuffer(wpn);
if (buf<>nil) and buf.IsAlterZoomMode() then begin
//Ñòðåëüáà ñ ðåçåðâíûõ ïðèöåëüíûõ ïðèñïîñîáëåíèé. Íå ñêðûâàåì íè÷åãî
result:=true;
end else if (GetScopeStatus(wpn)=1) then begin
result:= not game_ini_r_bool_def(GetSection(wpn), 'zoom_hide_ui', false);
end else if (GetScopeStatus(wpn)=2) and IsScopeAttached(wpn) then begin
result:= not game_ini_r_bool_def(game_ini_read_string(GetCurrentScopeSection(wpn), 'scope_name'), 'zoom_hide_ui', false);
end;
end;
end;
function IsUIForceHiding(wpn:pointer): boolean;stdcall;
begin
if IsBino(wpn) and IsAimNow(wpn) then begin
result:=game_ini_r_bool_def(GetSection(wpn), 'zoom_hide_ui', false);
end else if (GetScopeStatus(wpn)=1) and IsAimNow(wpn) then begin
result:= game_ini_r_bool_def(GetSection(wpn), 'zoom_hide_ui', false);
end else if (GetScopeStatus(wpn)=2) and IsScopeAttached(wpn) and IsAimNow(wpn) then begin
result:= game_ini_r_bool_def(game_ini_read_string(GetCurrentScopeSection(wpn), 'scope_name'), 'zoom_hide_ui', false);
end else begin
result:=false;
end;
end;
procedure CWeapon_show_indicators_Patch(); stdcall;
asm
pushad
push esi
call IsUIForceHiding
cmp al, 0
popad
je @check_unhiding
add esp, 4
xor eax, eax
pop esi
ret
@check_unhiding:
pushad
push esi
call IsUIForceUnhiding
cmp al, 1
popad
je @finish
cmp byte ptr [esi+$496],00
@finish:
end;
function IsAlterZoom(wpn:pointer):boolean; stdcall;
var
buf:WpnBuf;
begin
buf := GetBuffer(wpn);
result:= (buf<>nil) and buf.IsAlterZoomMode();
end;
function GetZoomLensVisibilityFactor(wpn:pointer):single; stdcall;
var
buf:WpnBuf;
factor:single;
const
EPS:single = 0.0001;
begin
buf := GetBuffer(wpn);
result:=1;
if buf = nil then exit;
factor:=buf.GetAlterZoomDirectSwitchMixupFactor();
if factor > EPS then begin
if buf.IsAlterZoomMode() then begin
// Ïåðåõîäèì ê àëüòåðíàòèâíîìó ïðèöåëèâàíèþ
result:=factor;
end else begin
// Ïåðåõîäèì ê îáû÷íîìó ïðèöåëèâàíèþ
result:=1-factor;
end;
end else if not LensConditions(true) then begin
result:=0;
end;
end;
function IsLastZoomAlter(wpn:pointer):boolean; stdcall;
var
buf:WpnBuf;
begin
buf := GetBuffer(wpn);
result:= (buf<>nil) and buf.IsLastZoomAlter();
end;
function GetAlterZoomDirectSwitchMixupFactor(wpn:pointer):single; stdcall;
var
buf:WpnBuf;
begin
result:=0;
buf := GetBuffer(wpn);
if buf <> nil then begin
result:= buf.GetAlterZoomDirectSwitchMixupFactor();
end;
end;
procedure CWeapon__OnZoomIn_PreExit_Patch();
asm
pushad
push esi
call IsAlterZoom
cmp al, 0
popad
je @notneed
add esp, 4
pop edi
pop esi
ret
@notneed:
mov eax, [esi+$4B4]
end;
procedure CWeapon__ZoomTexture_Patch();
asm
pushad
push esi
call IsAlterZoom
cmp al, 1
popad
je @disable
mov eax, [esi+$4c4] // m_UIScope
ret
@disable:
xor eax, eax
end;
procedure CWeapon__render_item_ui_query_Patch();
asm
pushad
push esi
call IsAlterZoom
cmp al, 1
popad
je @finish
cmp [esi+$4c4], 0 // m_UIScope
@finish:
end;
procedure CWeapon__show_crosshair_Patch();
asm
pushad
push esi
call IsAlterZoom
cmp al, 0
popad
je @noalterzoom
xor eax, eax
cmp byte ptr [esi+$495], 01
je @exit
mov eax, 1
@exit:
add esp, 4
pop esi
ret
@noalterzoom:
cmp byte ptr [esi+$495], 00
end;
function CWeapon__render_item_ui_query_reimpl(wpn:pointer):boolean; stdcall;
begin
result:=false;
if (wpn=nil) or (wpn<>GetActorActiveItem()) then exit;
if IsGrenadeMode(wpn) then exit;
if not IsAimNow(wpn) then exit;
if IsAlterZoom(wpn) then exit;
if GetAimFactor(wpn) < 0.999 then exit;
// Åñëè ó íàñ ïðèöåë, äåòåêòÿùèé âñå æèâîå, òî UI â íåì íàäî îòðèñîâàòü ðàäè ðàìêè
if HasBinocularVision(wpn) then begin
if IsLensEnabled() then begin
result:=IsLensedScopeInstalled(wpn) and IsLensFrameNow();
end else begin
result:=true;
end;
exit;
end;
result:=true;
end;
function CWeapon__render_item_ui_query_reimpl_patch():boolean; stdcall;
begin
asm
pushad
push ecx
call CWeapon__render_item_ui_query_reimpl
mov @result, al
popad
end;
end;
function IsForceHideZoomTexture(wpn:pointer):boolean; stdcall;
begin
result:=false;
if IsLensEnabled() and IsLensedScopeInstalled(wpn) then begin
result:=true;
end;
end;
procedure CWeapon__render_item_ui__checkzoomtex_Patch(); stdcall;
asm
cmp ecx, 0
je @abandon_render_item_ui //Óõîäèì, åñëè ñåòêè íåò è ðåíäåðèòü íå÷åãî.
pushad
push esi
call IsForceHideZoomTexture
cmp al, 0
popad
je @finish_normal
@abandon_render_item_ui:
//Âûõîäèì èç CWeapon__render_item_ui
pop esi // ret_addr from patch
pop esi // saved var from render_item_ui
ret // from render_item_ui
@finish_normal:
mov eax, [ecx]
mov edx, [eax+$64]
end;
procedure UpdateWeaponZoomPpe(wpn:pointer); stdcall;
const
effNightvision:cardinal=55;
var
val:single;
buf:WpnBuf;
begin
buf:=GetBuffer(wpn);
if (buf<>nil) and (GetOwner(wpn)<>nil) and (GetOwner(wpn)=GetActor()) and (IsWeaponNightVisionPPExist(wpn)) then begin
val:=buf.GetNightPPEFactor();
if val >= 0 then begin
set_pp_effector_factor2(effNightvision, val);
end;
end;
end;
function NeedUpdateBinocVision(wpn:pointer):boolean; stdcall;
begin
// Îáíîâëÿåì òîëüêî êîãäà ó íàñ ÍÅ êàäð ëèíçû
result:=not IsLensFrameNow();
end;
procedure CWeapon__updateppe_and_needupdatebinocvision_Patch(); stdcall;
asm
pushad
push esi
call UpdateWeaponZoomPpe
popad
pushad
push esi
call NeedUpdateBinocVision
cmp al, 0
popad
je @finish
//original
mov ecx, [esi+$4b8]
test ecx, ecx
@finish:
end;
function SBinocVisibleObj__Update_check_target_position(target:pointer):boolean; stdcall;
var
act:pointer;
campos, camdir, targetpos:pFVector3;
targetvec:FVector3;
ang:single;
begin
result:=false;
act:=GetActor();
if (act = nil) or (target = nil) then exit;
campos:=CRenderDevice__GetCamPos();
camdir:=CRenderDevice__GetCamDir();
targetpos:=GetEntityPosition(target);
//Ïîëó÷àåì âåêòîð íà öåëü
targetvec:=FVector3_copyfromengine(targetpos);
v_sub(@targetvec, campos);
//Ñ÷èòàåì óãîë ìåæäó âåêòîðîì íà öåëü è âçãëÿäîì
ang:=GetAngleCos(camdir, @targetvec);
//Log('Target '+inttohex(cardinal(target), 8)+ '('+
// floattostr(targetpos.x)+', '+
// floattostr(targetpos.y)+', '+
// floattostr(targetpos.z)+') '+
// ', ang '+ floattostr(ang));
//Åñëè óãîë áîëüøå 90 - òàêóþ öåëü ìû òî÷íî íå äîëæíû ðèñîâàòü
if ang >0 then begin
result:=true;
end;
end;
procedure SBinocVisibleObj__Update_Patch(); stdcall;
asm
pushad
//â eax íàõîäèòñÿ óêàçàòåëü íà CObject öåëè, êîòîðûé íàäî ïðîâåðèòü íà ïðåäìåò âàëèäíîñòè äëÿ îòðèñîâêè
push eax
call SBinocVisibleObj__Update_check_target_position
test al, al
popad
je @finish
//Original code
mov eax, [eax+$90]
test eax, eax
@finish:
end;
procedure CWeaponBinoculars__render_item_ui_Patch(); stdcall;
asm
test ecx, ecx //m_binoc_vision
je @finish
mov esi, xrgame_addr
add esi, $2dcd50
call esi
@finish:
end;
function Init:boolean;
var
patch_addr:cardinal;
buf:pointer;
begin
result:=false;
patch_addr:=xrGame_addr+$2BCB01;
if not WriteJump(patch_addr, cardinal(@PatchHudVisibility), 0) then exit;
patch_addr:=xrGame_addr+$2C09A2;
if not WriteJump(patch_addr, cardinal(@CWeapon_UpdateHudAdditional_savedata_patch), 8, true) then exit;
patch_addr:=xrGame_addr+$2C0FDE;
if not WriteJump(patch_addr, cardinal(@CWeapon_UpdateHudAdditional_restoredata_patch), 7, true) then exit;
patch_addr:=xrGame_addr+$2BC773;
if not WriteJump(patch_addr, cardinal(@CWeapon_show_indicators_Patch), 7, true) then exit;
patch_addr:=xrGame_addr+$2C0802;
if not WriteJump(patch_addr, cardinal(@CWeapon__OnZoomIn_PreExit_Patch), 6, true) then exit;
patch_addr:=xrGame_addr+$2BC3D1;
if not WriteJump(patch_addr, cardinal(@CWeapon__ZoomTexture_Patch), 6, true) then exit;
patch_addr:=xrGame_addr+$2BD1C5;
if not WriteJump(patch_addr, cardinal(@CWeapon__show_crosshair_Patch), 7, true) then exit;
// Çàìåíÿåì ðåàëèçàöèþ ìåòîäà CWeapon::render_item_ui_query ñâîåé
patch_addr:=xrGame_addr+$2bd0d0;
if not WriteJump(patch_addr, cardinal(@CWeapon__render_item_ui_query_reimpl_patch), 9, false) then exit;
//â CWeapon::render_item_ui ïðîâåðÿåì: åñëè ZoomTexture() âåðíóëà NULL, òî íå ðåíäåðèì ñåòêó; åñëè ó íàñ 3ä-ïðèöåë ñ äåòåêòîðîì - òîæå
patch_addr:=xrGame_addr+$2bc73c;
if not WriteJump(patch_addr, cardinal(@CWeapon__render_item_ui__checkzoomtex_Patch), 5, true) then exit;
//â CWeapon::UpdateCL àïäåéòèì èíòåíñèâíîñòü ïîñòïðîöåññà ïðèöåëà, êîãäà òîò àêòèâåí è äîáàâëÿåì óñëîâèå íà àïäåéò ðàìêè UI òîëüêî â ñëó÷àå, åñëè ó íàñ ñåé÷àñ ÍÅ èäåò ðåíäåð êàäðà ëèíçû
patch_addr:=xrGame_addr+$2c0706;
if not WriteJump(patch_addr, cardinal(@CWeapon__updateppe_and_needupdatebinocvision_Patch), 8, true) then exit;
//Áàã îðèãèíàëà ñ ìåòêàìè àâòîçàõâàòà öåëè - ïîêàçûâàåò öåëè, êîòîðûå óæå ïîçàäè òåáÿ. Ïðàâèì â SBinocVisibleObj::Update
patch_addr:=xrGame_addr+$2dcf9f;
if not WriteJump(patch_addr, cardinal(@SBinocVisibleObj__Update_Patch), 8, true) then exit;
//  CWeaponBinoculars::render_item_ui_query óäàëÿåì ïðîâåðêó íà íàëè÷èå m_binoc_vision, ÷òîáû íîðìàëüíî îòðèñîâûâàëàñü ñåòêà áèíîêëÿ ïðè åãî îòñóòñòâèè
nop_code(xrgame_addr+$2dc041, 2);
// Â CWeaponBinoculars::render_item_ui äîáàâëÿåì ïðîâåðêó íà ñóùåñòâîâàíèå m_binoc_vision ïåðåä òåì, êàê âûçûâàòü Draw
patch_addr:=xrGame_addr+$2dc059;
if not WriteJump(patch_addr, cardinal(@CWeaponBinoculars__render_item_ui_Patch), 5, true) then exit;
result:=true;
end;
end.