-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmaterials.pas
More file actions
61 lines (52 loc) · 1.14 KB
/
materials.pas
File metadata and controls
61 lines (52 loc) · 1.14 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
unit materials;
interface
uses xr_strings;
type
CMaterialManager = packed record
vftable:pointer;
m_run_mode:byte;
_unused1:byte;
_unused2:word;
m_time_to_step:single;
m_step_id:cardinal;
m_my_material_idx:word;
_unused3:word;
m_step_sound:array[0..3] of pointer {ref_sound};
m_object:pointer;
m_movement_control:pointer;
m_last_material_idx:word;
end;
pCMaterialManager = ^CMaterialManager;
SGameMtl = packed record
id:cardinal;
m_Name:shared_str;
m_Desc:shared_str;
Flags:cardinal;
end;
pSGameMtl = ^SGameMtl;
function GetMaterialManager(CEntityAlive:pointer):pCMaterialManager; stdcall;
function GetMaterialByIdx(idx:cardinal):pSGameMtl; stdcall;
implementation
uses BaseGameData;
function GetMaterialManager(CEntityAlive:pointer):pCMaterialManager; stdcall;
begin
asm
mov eax, CEntityAlive
mov eax, dword ptr [eax+$270]
mov @result, eax
end;
end;
function GetMaterialByIdx(idx:cardinal):pSGameMtl; stdcall;
begin
asm
pushad
mov eax, xrgame_addr
mov ecx, [eax+$512bd4] // GMLib
push idx
add eax, $512bf4
call [eax]
mov @result, eax
popad
end;
end;
end.