-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathxr_ScriptParticles.pas
More file actions
127 lines (98 loc) · 2.48 KB
/
Copy pathxr_ScriptParticles.pas
File metadata and controls
127 lines (98 loc) · 2.48 KB
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
unit xr_ScriptParticles;
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
interface
uses MatVectors;
type CScriptParticles = packed record
vftable:pointer;
m_particles:pointer;
end;
function CScriptParticles__constructor(this:pointer; name:PChar):pointer; stdcall;
procedure CScriptParticles__destructor(this:pointer);stdcall;
procedure CScriptParticles__PlayAtPos(this:pointer; Fvector_position:pointer);stdcall;
procedure CScriptParticles__MoveTo(this:pointer; Fvector_pos:pointer; Fvector_vel:pointer);stdcall;
function CScriptParticles__IsPlaying(this:pointer):boolean;stdcall;
procedure CScriptParticles__Stop(this:pointer);stdcall;
function PlayCScriptParticleAtPosSafe(this:pointer; pos:pointer):boolean;stdcall;
procedure InitCScriptParticles(var this:CScriptParticles);
implementation
uses BaseGameData;
function CScriptParticles__constructor(this:pointer; name:PChar):pointer; stdcall;
asm
pushad
mov ecx, this
push name
mov eax, xrgame_addr
add eax, $21ad40
call eax
mov @result, eax
popad
end;
procedure CScriptParticles__destructor(this:pointer);stdcall;
asm
pushad
mov ecx, this
push 00 //ãîâîðèì, ÷òî ïàìÿòü îñâîáîæäàòü íå íàäî
mov eax, xrgame_addr
add eax, $21ADE0
call eax
popad
end;
procedure CScriptParticles__PlayAtPos(this:pointer; Fvector_position:pointer);stdcall;
asm
pushad
mov ecx, this
push Fvector_position
mov eax, xrgame_addr
add eax, $21AA90
call eax
popad
end;
procedure CScriptParticles__MoveTo(this:pointer; Fvector_pos:pointer; Fvector_vel:pointer);stdcall;
asm
pushad
mov ecx, this
push Fvector_vel
push Fvector_pos
mov eax, xrgame_addr
add eax, $21AE10
call eax
popad
end;
function PlayCScriptParticleAtPosSafe(this:pointer; pos:pointer):boolean;stdcall;
var
zerovec:FVector3;
begin
if CScriptParticles__IsPlaying(this) then begin
zerovec.x:=0;
zerovec.y:=0;
zerovec.z:=0;
CScriptParticles__MoveTo(this, pos, @zerovec);
end else begin
CScriptParticles__PlayAtPos(this, pos);
end;
end;
function CScriptParticles__IsPlaying(this:pointer):boolean;stdcall;
asm
pushad
mov ecx, this
mov eax, xrgame_addr
add eax, $21AAD0
call eax
mov @result, al
popad
end;
procedure InitCScriptParticles(var this:CScriptParticles);
begin
this.vftable:=nil;
this.m_particles:=nil;
end;
procedure CScriptParticles__Stop(this:pointer);stdcall;
asm
pushad
mov ecx, this
mov eax, xrgame_addr
add eax, $21AAB0
call eax
popad
end;
end.