-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDynamicWallmarks.pas
132 lines (109 loc) · 2.62 KB
/
DynamicWallmarks.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
unit DynamicWallmarks;
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
interface
uses MatVectors;
function Init():boolean; stdcall;
type
SBullet_Hit = packed record
power:single;
impulse:single;
end;
SBullet = packed record
init_frame_num:cardinal;
flags:word;
bullet_material_idx:word;
bullet_pos:FVector3;
dir:FVector3;
speed:single;
parent_id:word;
weapon_id:word;
fly_dist:single;
tracer_start_position:FVector3;
start_position:FVector3;
start_velocity:FVector3;
born_time:cardinal;
life_time:single;
change_rajectory_count:cardinal;
hit_param:SBullet_Hit;
air_resistance:single;
max_speed:single;
max_dist:single;
armor_piercing:single;
wallmark_size:single;
//to be continued...
end;
pSBullet=^SBullet;
implementation
uses BaseGameData, RayPick, ActorUtils, Misc, SysUtils;
var
RTTI_CKinematics:pointer;
function PKinematics(IRender_Visual:pointer):pointer; stdcall;
asm
pushad
mov eax, IRender_Visual
push eax
mov eax, [eax]
mov eax, [eax+$0C]
call eax
mov @result, eax
popad
end;
procedure add_SkeletonWallmark(xf:pointer; obj:pointer; wallmark_array:pointer; start:pFVector3; dir:pFVector3; size:single); stdcall;
asm
pushad
mov ecx, xrgame_addr
mov ecx, [ecx+$5124a8]
mov ecx, [ecx]
mov edx, [ecx]
mov edx, [edx+$70]
push size
push dir
push start
push wallmark_array
push obj
push xf
call edx
popad
end;
procedure AddDynamicShotmark (rqr:prq_result; m_pCollideMarks:pointer; particle_dir:pFVector3; bullet:pSBullet); stdcall;
var
dir, pos:FVector3;
begin
if rqr.O=nil then exit;
if m_pCollideMarks=nil then exit;
if (GetActor()<>nil) and (GetCObjectID(GetActor())=GetCObjectID(rqr.O)) then exit;
dir:=FVector3_copyfromengine(particle_dir);
v_mul(@dir, -1);
pos:=bullet.bullet_pos;
//log (floattostr(bullet.wallmark_size));
log(inttohex(cardinal(bullet), 8));
add_SkeletonWallmark(GetCObjectXForm(rqr.O), PKinematics(GetCObjectVisual(rqr.O)), m_pCollideMarks, @pos, @dir, bullet.wallmark_size);
end;
procedure CBulletManager__FireShotmark_Patch(); stdcall;
asm
cmp eax, 0
je @end
lea esi, [esp+$64]
pushad
push [esi+$4] //bullet
push [esi+$8] //vDir
mov eax, [eax+$48] //mtl_pair.m_pCollideMarks
push eax
push ebp
call AddDynamicShotmark
popad
@end:
cmp [ebp], 0
mov esi, eax
end;
function Init():boolean; stdcall;
var
jmp_addr:cardinal;
begin
result:=false;
//äîáàâëÿåì âîëëìàðêè îò õèòà íà äèíîáúåêòû
jmp_addr:=xrgame_addr+$250c29;
// if not WriteJump(jmp_addr, cardinal(@CBulletManager__FireShotmark_Patch), 6, true) then exit;
result:=true;
end;
end.