forked from Bad-Scientists/AF-Script-Packet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions_oCMobInter_engine.d
323 lines (236 loc) · 9.94 KB
/
functions_oCMobInter_engine.d
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
func void oCMobInter_SendStateChange (var int mobPtr, var int fromState, var int toState) {
//0x0067D8C0 protected: void __thiscall oCMobInter::SendStateChange(int,int)
const int oCMobInter__SendStateChange_G1 = 6805696;
//0x0071ED90 public: void __thiscall oCMobInter::SendStateChange(int,int)
const int oCMobInter__SendStateChange_G2 = 7466384;
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL_IntParam (_@ (toState));
CALL_IntParam (_@ (fromState));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__SendStateChange_G1, oCMobInter__SendStateChange_G2));
call = CALL_End();
};
};
func string oCMobInter_GetScemeName (var int mobPtr) {
//0x00684CA0 public: virtual class zSTRING __thiscall oCMobDoor::GetScemeName(void)
const int oCMobDoor__GetScemeName_G1 = 6835360;
//0x00726D60 public: virtual class zSTRING __thiscall oCMobDoor::GetScemeName(void)
const int oCMobDoor__GetScemeName_G2 = 7499104;
//Only G2A ... G1 does not have this function
//0x007232A0 public: virtual class zSTRING __thiscall oCMobBed::GetScemeName(void)
const int oCMobBed__GetScemeName_G2 = 7484064;
//0x0067C970 public: virtual class zSTRING __thiscall oCMobInter::GetScemeName(void)
const int oCMobInter__GetScemeName_G1 = 6801776;
//0x0071DBE0 public: virtual class zSTRING __thiscall oCMobInter::GetScemeName(void)
const int oCMobInter__GetScemeName_G2 = 7461856;
if (!Hlp_Is_oCMobInter (mobPtr)) { return ""; };
CALL_RetValIszString();
if (Hlp_Is_oCMobDoor (mobPtr)) {
CALL__thiscall (mobPtr, MEMINT_SwitchG1G2 (oCMobDoor__GetScemeName_G1, oCMobDoor__GetScemeName_G2));
} else
if (Hlp_Is_oCMobBed (mobPtr) && (MEMINT_SwitchG1G2 (0, 1))) {
CALL__thiscall (mobPtr, oCMobBed__GetScemeName_G2);
} else {
CALL__thiscall (mobPtr, MEMINT_SwitchG1G2 (oCMobInter__GetScemeName_G1, oCMobInter__GetScemeName_G2));
};
return CALL_RetValAszstring ();
};
func void oCMobInter_ScanIdealPositions (var int mobPtr) {
//0x0067C9C0 protected: void __thiscall oCMobInter::ScanIdealPositions(void)
const int oCMobInter__ScanIdealPositions_G1 = 6801856;
//0x0071DC30 public: void __thiscall oCMobInter::ScanIdealPositions(void)
const int oCMobInter__ScanIdealPositions_G2 = 7461936;
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__ScanIdealPositions_G1, oCMobInter__ScanIdealPositions_G2));
call = CALL_End();
};
};
func int oCMobInter_SearchFreePosition (var int mobPtr, var int slfInstance, var int rangeF) {
//0x0067CD60 protected: virtual struct TMobOptPos * __thiscall oCMobInter::SearchFreePosition(class oCNpc *)
const int oCMobInter__SearchFreePosition_G1 = 6802784;
//0x0071DFC0 public: virtual struct TMobOptPos * __thiscall oCMobInter::SearchFreePosition(class oCNpc *,float)
const int oCMobInter__SearchFreePosition_G2 = 7462848;
if (!Hlp_Is_oCMobInter (mobPtr)) { return 0; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
//G2A has 1 extra parameter - I assume range
if (MEMINT_SwitchG1G2 (0, 1)) {
CALL_PtrParam (_@ (rangeF));
};
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__SearchFreePosition_G1, oCMobInter__SearchFreePosition_G2));
call = CALL_End();
};
return CALL_RetValAsPtr ();
};
func int oCMobInter_GetFreePosition (var int mobPtr, var int slfInstance, var int posPtr) {
//0x0067CD00 public: int __thiscall oCMobInter::GetFreePosition(class oCNpc *,class zVEC3 &)
const int oCMobInter__GetFreePosition_G1 = 6802688;
//0x0071DF50 public: int __thiscall oCMobInter::GetFreePosition(class oCNpc *,class zVEC3 &)
const int oCMobInter__GetFreePosition_G2 = 7462736;
if (!Hlp_Is_oCMobInter (mobPtr)) { return 0; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (posPtr));
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__GetFreePosition_G1, oCMobInter__GetFreePosition_G2));
call = CALL_End();
};
return CALL_RetValAsInt ();
};
func void oCMobInter_SetIdealPosition (var int mobPtr, var int slfInstance) {
//0x0067CEF0 protected: void __thiscall oCMobInter::SetIdealPosition(class oCNpc *)
const int oCMobInter__SetIdealPosition_G1 = 6803184;
//0x0071E240 public: void __thiscall oCMobInter::SetIdealPosition(class oCNpc *)
const int oCMobInter__SetIdealPosition_G2 = 7463488;
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__SetIdealPosition_G1, oCMobInter__SetIdealPosition_G2));
call = CALL_End();
};
};
func void oCMobInter_SetHeading (var int mobPtr, var int slfInstance) {
//0x0067CEA0 protected: void __thiscall oCMobInter::SetHeading(class oCNpc *)
const int oCMobInter__SetHeading_G1 = 6803104;
//0x0071E1F0 public: void __thiscall oCMobInter::SetHeading(class oCNpc *)
const int oCMobInter__SetHeading_G2 = 7463408;
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__SetHeading_G1, oCMobInter__SetHeading_G2));
call = CALL_End();
};
};
func int oCMobInter_IsAvailable (var int mobPtr, var int slfInstance) {
//0x0067F570 public: int __thiscall oCMobInter::IsAvailable(class oCNpc *)
const int oCMobInter__IsAvailable_G1 = 6813040;
//0x00720EC0 public: int __thiscall oCMobInter::IsAvailable(class oCNpc *)
const int oCMobInter__IsAvailable_G2 = 7474880;
if (!Hlp_Is_oCMobInter (mobPtr)) { return 0; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__IsAvailable_G1, oCMobInter__IsAvailable_G2));
call = CALL_End();
};
return CALL_RetValAsInt ();
};
func void oCMobInter_MarkAsUsed (var int mobPtr, var int timeDeltaF, var int vobPtr) {
//0x0067F5D0 public: void __thiscall oCMobInter::MarkAsUsed(float,class zCVob *)
const int oCMobInter__MarkAsUsed_G1 = 6813136;
//0x00720F20 public: void __thiscall oCMobInter::MarkAsUsed(float,class zCVob *)
const int oCMobInter__MarkAsUsed_G2 = 7474976;
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (vobPtr));
CALL_FloatParam (_@ (timeDeltaF));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__MarkAsUsed_G1, oCMobInter__MarkAsUsed_G2));
call = CALL_End();
};
};
func int oCMobInter_GetFreeTrafo_ByNodeName (var int mobPtr, var string nodeName, var int trafoPtr) {
if (!Hlp_Is_oCMobInter (mobPtr)) { return FALSE; };
oCMobInter_ScanIdealPositions (mobPtr);
var oCMobInter mob; mob = _^ (mobPtr);
var int ptr;
var zCList list;
ptr = mob.optimalPosList_next;
while (ptr);
list = _^ (ptr);
ptr = list.data;
if (ptr) {
var TMobOptPos mobOptPos;
mobOptPos = _^ (ptr);
//ZS_POS0_FRONT, ZS_POS0_BACK
if (STR_EndsWith (mobOptPos.nodeName, nodeName)) {
MEM_CopyBytes (_@ (mobOptPos.trafo), trafoPtr, 64);
return TRUE;
};
};
ptr = list.next;
end;
return FALSE;
};
func void oCMobInter_SetInteractWith (var int mobPtr, var int npcPtr) {
if (!Hlp_Is_oCMobInter (mobPtr)) { return; };
oCMobInter_ScanIdealPositions (mobPtr);
var oCMobInter mob; mob = _^ (mobPtr);
var int ptr;
var zCList list;
ptr = mob.optimalPosList_next;
while (ptr);
list = _^ (ptr);
ptr = list.data;
if (ptr) {
var TMobOptPos mobOptPos;
mobOptPos = _^ (ptr);
//if (STR_StartsWith (mobOptPos.nodeName, "ZS_POS")) {
mobOptPos.npc = npcPtr;
//return;
//};
};
ptr = list.next;
end;
};
/*
const int oCMobInter__IsInteractingWith_G1 = 6814832;
CALL_PtrParam (_@ (hero));
CALL__thiscall (spell.spellTarget, oCMobInter__IsInteractingWith_G1);
var int retVal; retVal = CALL_RetValAsInt ();
*/
func int oCMobInter_IsInteractingWith (var int mobPtr, var int slfInstance) {
//0x0067FC70 public: virtual int __thiscall oCMobInter::IsInteractingWith(class oCNpc *)
const int oCMobInter__IsInteractingWith_G1 = 6814832;
//0x00721550 public: virtual int __thiscall oCMobInter::IsInteractingWith(class oCNpc *)
const int oCMobInter__IsInteractingWith_G2 = 7476560;
if (!Hlp_Is_oCMobInter (mobPtr)) { return 0; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__IsInteractingWith_G1, oCMobInter__IsInteractingWith_G2));
call = CALL_End();
};
return CALL_RetValAsInt ();
};
func int oCMobInter_CanInteractWith (var int mobPtr, var int slfInstance) {
//0x0067F5F0 public: virtual int __thiscall oCMobInter::CanInteractWith(class oCNpc *)
const int oCMobInter__CanInteractWith_G1 = 6813168;
//0x00720F40 public: virtual int __thiscall oCMobInter::CanInteractWith(class oCNpc *)
const int oCMobInter__CanInteractWith_G2 = 7475008;
if (!Hlp_Is_oCMobInter (mobPtr)) { return 0; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return 0; };
var int slfPtr; slfPtr = _@ (slf);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (slfPtr));
CALL__thiscall (_@ (mobPtr), MEMINT_SwitchG1G2 (oCMobInter__CanInteractWith_G1, oCMobInter__CanInteractWith_G2));
call = CALL_End();
};
return CALL_RetValAsInt ();
};