-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamic_caster.pas
More file actions
49 lines (33 loc) · 870 Bytes
/
dynamic_caster.pas
File metadata and controls
49 lines (33 loc) · 870 Bytes
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
unit dynamic_caster;
interface
function dynamic_cast(inptr:pointer; vfdelta:cardinal; srctype:cardinal; targettype:cardinal; isreference:boolean):pointer; stdcall;
const
//all xrGame-based
RTTI_CHudItem:cardinal = $5FAA20;
RTTI_CWeapon:cardinal = $5FBD04;
RTTI_CShootingObject:cardinal = $5F2728;
RTTI_CWeaponMagazined:cardinal = $5FAA00;
RTTI_CInventoryItem:cardinal = $5D0D70;
implementation
uses BaseGameData;
function dynamic_cast(inptr:pointer; vfdelta:cardinal; srctype:cardinal; targettype:cardinal; isreference:boolean):pointer; stdcall;
asm
pushad
movzx eax, isreference
push eax
mov eax, xrgame_addr
add eax, targettype
push eax
mov eax, xrgame_addr
add eax, srctype
push eax
push vfdelta
push inptr
mov eax, xrgame_addr
add eax, $4D563C
call eax
mov @result, eax
add esp, $14
popad
end;
end.