0
|
1 #include "Actor.h"
|
|
2 #include "LayingItem.h"
|
|
3 #include "Math.h"
|
|
4 #include "Party.h"
|
|
5 #include "Outdoor.h"
|
|
6 #include "AudioPlayer.h"
|
|
7 #include "Game.h"
|
|
8 #include "ObjectList.h"
|
|
9 #include "Overlays.h"
|
|
10 #include "Events.h"
|
|
11 #include "IndoorCamera.h"
|
|
12 #include "FactionTable.h"
|
|
13 #include "TurnEngine.h"
|
|
14 #include "MapInfo.h"
|
|
15 #include "stru277.h"
|
|
16 #include "Time.h"
|
|
17 #include "LOD.h"
|
|
18 #include "Party.h"
|
|
19 #include "GUIWindow.h"
|
|
20 #include "GUIFont.h"
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25 Actor pActors[500];
|
|
26 size_t uNumActors;
|
|
27
|
|
28 stru319 stru_50C198; // idb
|
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
|
34 //----- (00448518) --------------------------------------------------------
|
|
35 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3)
|
|
36 {
|
|
37 signed int v3; // eax@1
|
|
38 int *v4; // edi@2
|
|
39 signed int v5; // eax@6
|
|
40 char *v6; // ecx@6
|
|
41 char *v7; // eax@11
|
|
42 ItemGen *v8; // ecx@15
|
|
43
|
|
44 v3 = 0;
|
|
45 if ( (signed int)uNumActors > 0 )
|
|
46 {
|
|
47 v4 = (int *)&pActors[0].uNPC_ID;
|
|
48 while ( *(short *)v4 != npc )
|
|
49 {
|
|
50 ++v3;
|
|
51 v4 += 209;
|
|
52 if ( v3 >= (signed int)uNumActors )
|
|
53 return;
|
|
54 }
|
|
55 v5 = v3;
|
|
56 v6 = (char *)&pActors[v5].uCarriedItemID;
|
|
57 if ( a3 )
|
|
58 {
|
|
59 if ( *(short *)v6 )
|
|
60 {
|
|
61 if ( pActors[v5].array_000234[0].uItemID )
|
|
62 {
|
|
63 v7 = (char *)&pActors[v5].array_000234[1];
|
|
64 if ( !*(int *)v7 )
|
|
65 *(int *)v7 = item;
|
|
66 }
|
|
67 else
|
|
68 {
|
|
69 pActors[v5].array_000234[0].uItemID = item;
|
|
70 }
|
|
71 }
|
|
72 else
|
|
73 {
|
|
74 *(short *)v6 = item;
|
|
75 }
|
|
76 }
|
|
77 else
|
|
78 {
|
|
79 if ( *(short *)v6 == item )
|
|
80 {
|
|
81 *(short *)v6 = 0;
|
|
82 }
|
|
83 else
|
|
84 {
|
|
85 v8 = pActors[v5].array_000234;
|
|
86 if ( pActors[v5].array_000234[0].uItemID == item
|
|
87 || (v8 = &pActors[v5].array_000234[1], pActors[v5].array_000234[1].uItemID == item) )
|
|
88 v8->Reset();
|
|
89 }
|
|
90 }
|
|
91 }
|
|
92 }
|
|
93
|
|
94 //----- (004485A7) --------------------------------------------------------
|
|
95 void Actor::GiveItem(unsigned int uActorID, unsigned int uItemID, unsigned int bGive)
|
|
96 {
|
|
97 unsigned int v3; // eax@3
|
|
98 char *v4; // ecx@3
|
|
99 unsigned int *v5; // eax@8
|
|
100 ItemGen *v6; // ecx@12
|
|
101
|
|
102 if ( (uActorID & 0x80000000u) == 0 && (signed int)uActorID <= (signed int)(uNumActors - 1) )
|
|
103 {
|
|
104 v3 = uActorID;
|
|
105 v4 = (char *)&pActors[uActorID].uCarriedItemID;
|
|
106 if ( bGive )
|
|
107 {
|
|
108 if ( *(short *)v4 )
|
|
109 {
|
|
110 if ( pActors[v3].array_000234[0].uItemID )
|
|
111 {
|
|
112 v5 = &pActors[v3].array_000234[1].uItemID;
|
|
113 if ( !*v5 )
|
|
114 *v5 = uItemID;
|
|
115 }
|
|
116 else
|
|
117 {
|
|
118 pActors[v3].array_000234[0].uItemID = uItemID;
|
|
119 }
|
|
120 }
|
|
121 else
|
|
122 {
|
|
123 *(short *)v4 = uItemID;
|
|
124 }
|
|
125 }
|
|
126 else
|
|
127 {
|
|
128 if ( *(short *)v4 == uItemID )
|
|
129 {
|
|
130 *(short *)v4 = 0;
|
|
131 }
|
|
132 else
|
|
133 {
|
|
134 v6 = pActors[v3].array_000234;
|
|
135 if ( pActors[v3].array_000234[0].uItemID == uItemID
|
|
136 || (v6 = &pActors[v3].array_000234[1], pActors[v3].array_000234[1].uItemID == uItemID) )
|
|
137 v6->Reset();
|
|
138 }
|
|
139 }
|
|
140 }
|
|
141 }
|
|
142
|
|
143
|
|
144 //----- (00445D4A) --------------------------------------------------------
|
|
145 void Actor::InitializeDialogue(int bPlayerSaysHello)
|
|
146 {
|
|
147 Actor *v2; // esi@1
|
|
148 unsigned int v3; // ecx@1
|
|
149 NPCData *v4; // eax@1
|
|
150 NPCData *v5; // ebp@1
|
|
151 unsigned int v6; // eax@1
|
|
152 signed int v7; // eax@3
|
|
153 unsigned int v8; // eax@8
|
|
154 int v9; // esi@8
|
|
155 int v10; // eax@11
|
|
156 GUIWindow *v11; // ecx@19
|
|
157 signed int v12; // eax@21
|
|
158 int v13; // [sp-8h] [bp-44h]@34
|
|
159 const char *v14; // [sp-4h] [bp-40h]@4
|
|
160 int v15; // [sp-4h] [bp-40h]@34
|
|
161 signed int v16; // [sp-4h] [bp-40h]@35
|
|
162 int v17; // [sp+10h] [bp-2Ch]@1
|
|
163 char pContainer[32]; // [sp+14h] [bp-28h]@3
|
|
164
|
|
165 auto a1 = this;
|
|
166 v2 = a1;
|
|
167 v17 = bPlayerSaysHello;
|
|
168 dword_A74CDC = -1;
|
|
169 dword_AE336C = -1;
|
|
170 pEventTimer->Pause();
|
|
171 pMiscTimer->Pause();
|
|
172 pAudioPlayer->StopChannels(-1, -1);
|
|
173 uDialogueType = 0;
|
|
174 v3 = v2->uNPC_ID;
|
|
175 uDialogue_SpeakingActorNPC_ID = v2->uNPC_ID;
|
|
176 pDialogue_SpeakingActor = v2;
|
|
177 v4 = GetNPCData(v3);
|
|
178 v5 = v4;
|
|
179 v6 = v4->uFlags;
|
|
180 if ( (v6 & 3) != 2 )
|
|
181 v5->uFlags = v6 + 1;
|
|
182 v7 = const_2();
|
|
183 sprintfex(pContainer, "evt%02d", v7);
|
|
184 if ( !pParty->uAlignment )
|
|
185 {
|
|
186 v14 = "-b";
|
|
187 LABEL_7:
|
|
188 strcat(pContainer, v14);
|
|
189 goto LABEL_8;
|
|
190 }
|
|
191 if ( pParty->uAlignment == 2 )
|
|
192 {
|
|
193 v14 = "-c";
|
|
194 goto LABEL_7;
|
|
195 }
|
|
196 LABEL_8:
|
|
197 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
198 array_5913D8[6] = 0;
|
|
199 uNumDialogueNPCPortraits = 1;
|
|
200 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v8];
|
|
201 sprintfex(pContainer, "npc%03u", v5->uPortraitID);
|
|
202 v9 = 0;
|
|
203 pDialogueNPCPortraits[0] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
|
|
204 dword_591084 = areWeLoadingTexture;
|
|
205 uTextureID_507B04 = uTextureID_right_panel;
|
|
206 if ( !(v5->uFlags & 0x80) && v5->house >= 0 )
|
|
207 {
|
|
208 if ( (signed int)pParty->GetPartyFame() <= v5->fame
|
|
209 || (v10 = v5->uFlags & 0xFFFFFF7F, (v5->uFlags & 0xFFFFFF7F & 0x80000000u) != 0) )
|
|
210 {
|
|
211 LABEL_16:
|
|
212 v9 = 1;
|
|
213 goto LABEL_17;
|
|
214 }
|
|
215 if ( v10 > 1 )
|
|
216 {
|
|
217 if ( v10 == 2 )
|
|
218 {
|
|
219 v16 = 3;
|
|
220 goto LABEL_36;
|
|
221 }
|
|
222 if ( v10 != 3 )
|
|
223 {
|
|
224 if ( v10 == 4 )
|
|
225 goto LABEL_17;
|
|
226 goto LABEL_16;
|
|
227 }
|
|
228 LABEL_35:
|
|
229 v16 = 2;
|
|
230 LABEL_36:
|
|
231 v9 = v16;
|
|
232 goto LABEL_17;
|
|
233 }
|
|
234 if ( v5->rep )
|
|
235 goto LABEL_35;
|
|
236 }
|
|
237 LABEL_17:
|
|
238 if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 )
|
|
239 v9 = 4;
|
2
|
240 v11 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)10, v9, 0);
|
0
|
241 pDialogueWindow = v11;
|
|
242 if ( v5->uFlags & 0x80 )
|
|
243 {
|
|
244 if ( !v5->bHasUsedTheAbility )
|
|
245 {
|
|
246 v12 = v5->uProfession;
|
|
247 if ( v12 >= 10 )
|
|
248 {
|
|
249 if ( v12 <= 12 || v12 > 32 && (v12 <= 34 || v12 > 38 && (v12 <= 43 || v12 == 52)) )
|
|
250 {
|
|
251 v11->CreateButton(
|
|
252 0x1E0u,
|
|
253 0xFAu,
|
|
254 0x8Cu,
|
|
255 LOBYTE(pFontArrus->uFontHeight) - 3,
|
|
256 1,
|
|
257 0,
|
|
258 0x88u,
|
|
259 9u,
|
|
260 0,
|
59
|
261 "",
|
0
|
262 0);
|
|
263 pDialogueWindow->_41D08F(4, 1, 0, 1);
|
|
264 }
|
|
265 }
|
|
266 }
|
|
267 }
|
59
|
268 pDialogueWindow->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
|
|
269 pDialogueWindow->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
|
|
270 pDialogueWindow->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
|
|
271 pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
|
0
|
272 if ( v17 && uActiveCharacter && !(v5->uFlags & 0x80) )
|
|
273 {
|
|
274 if ( pParty->uCurrentHour < 5 || pParty->uCurrentHour > 0x15 )
|
|
275 {
|
|
276 v15 = 0;
|
|
277 v13 = 23;
|
|
278 }
|
|
279 else
|
|
280 {
|
|
281 v15 = 0;
|
|
282 v13 = 22;
|
|
283 }
|
|
284 pPlayers[uActiveCharacter]->PlaySound(v13, v15);
|
|
285 }
|
|
286 }
|
|
287
|
|
288
|
|
289 //----- (0040894B) --------------------------------------------------------
|
|
290 bool Actor::CanAct()
|
|
291 {
|
|
292 signed int v1; // esi@1
|
|
293 bool v2; // edi@2
|
|
294 unsigned __int16 v3; // ax@6
|
|
295
|
|
296 v1 = 0;
|
|
297 v2 = (signed __int64)this->pActorBuffs[5].uExpireTime > 0;// stoned
|
|
298 if ( (signed __int64)this->pActorBuffs[6].uExpireTime > 0 )// paralyzed
|
|
299 v1 = 1;
|
|
300 v3 = this->uAIState;
|
|
301 return (v2 | v1 | v3 == Dying | v3 == Dead | v3 == Removed | v3 == Summoned | v3 == Disabled) == 0;
|
|
302 }
|
|
303
|
|
304 //----- (004089C7) --------------------------------------------------------
|
|
305 bool Actor::IsAlive()
|
|
306 {
|
|
307 signed int v1; // esi@1
|
|
308 unsigned __int16 v2; // ax@3
|
|
309
|
|
310 v1 = 0;
|
|
311 if ( (signed __int64)this->pActorBuffs[5].uExpireTime > 0 )
|
|
312 v1 = 1;
|
|
313 v2 = this->uAIState;
|
|
314 return (v1 | (v2 == Dying) | (v2 == Dead) | (v2 == Removed) | (v2 == Summoned) | (v2 == Disabled)) != 0;
|
|
315 }
|
|
316
|
|
317 //----- (004086E9) --------------------------------------------------------
|
|
318 void Actor::SetRandomGoldIfTheresNoItem()
|
|
319 {
|
|
320 Actor *v1; // esi@1
|
|
321 int v2; // edi@1
|
|
322 signed int v3; // ebx@2
|
|
323 unsigned __int8 v4; // al@7
|
|
324
|
|
325 v1 = this;
|
|
326 v2 = 0;
|
|
327 if ( !this->array_000234[3].uItemID )
|
|
328 {
|
|
329 v3 = 0;
|
|
330 if ( this->pMonsterInfo.uTreasureDiceRolls )
|
|
331 {
|
|
332 do
|
|
333 {
|
|
334 ++v3;
|
|
335 v2 += rand() % v1->pMonsterInfo.uTreasureDiceSides + 1;
|
|
336 }
|
|
337 while ( v3 < v1->pMonsterInfo.uTreasureDiceRolls );
|
|
338 if ( v2 )
|
|
339 {
|
|
340 v1->array_000234[3].uItemID = 197;
|
|
341 v1->array_000234[3].uAdditionalValue = v2;
|
|
342 }
|
|
343 }
|
|
344 }
|
|
345 if ( rand() % 100 < v1->pMonsterInfo.uTreasureDropChance )
|
|
346 {
|
|
347 v4 = v1->pMonsterInfo.uTreasureLevel;
|
|
348 if ( v4 )
|
|
349 pItemsTable->GenerateItem(v4, v1->pMonsterInfo.uTreasureType, &v1->array_000234[2]);
|
|
350 }
|
|
351 v1->uAttributes |= 0x800000;
|
|
352 }
|
|
353
|
|
354 //----- (00404AC7) --------------------------------------------------------
|
|
355 void __fastcall Actor::_404AC7(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel)
|
|
356 {
|
|
357 Actor *v5; // esi@1
|
|
358 unsigned int v6; // edi@1
|
|
359 unsigned int v7; // eax@1
|
|
360 int v8; // edi@16
|
|
361 int v9; // edi@17
|
|
362 signed int v10; // ecx@22
|
|
363 signed int v11; // eax@29
|
|
364 __int16 *v12; // edi@30
|
|
365 int v13; // ecx@34
|
|
366 int v14; // edx@34
|
|
367 int v15; // eax@34
|
|
368 AIDirection *v16; // esi@34
|
|
369 unsigned __int16 v17; // di@34
|
|
370 int v18; // eax@34
|
|
371 int v19; // edi@34
|
|
372 int v20; // eax@35
|
|
373 int v21; // eax@39
|
|
374 SoundID v22; // eax@39
|
|
375 signed int v23; // eax@41
|
|
376 double v24; // st7@49
|
|
377 float v25; // ST5C_4@50
|
|
378 int v26; // eax@50
|
|
379 double v27; // st7@50
|
|
380 double v28; // st6@50
|
|
381 float v29; // ST4C_4@51
|
|
382 int v30; // esi@50
|
|
383 int v31; // ST3C_4@51
|
|
384 unsigned int v32; // edi@51
|
|
385 char *v33; // eax@54
|
|
386 unsigned __int16 v34; // ax@57
|
|
387 signed int v35; // ecx@58
|
|
388 signed int v36; // eax@67
|
|
389 signed int v37; // eax@68
|
|
390 signed __int64 v38; // qtt@69
|
|
391 int v39; // ecx@75
|
|
392 int v40; // eax@79
|
|
393 int v41; // ecx@90
|
|
394 int v42; // ecx@91
|
|
395 int v43; // eax@95
|
|
396 int v44; // ecx@100
|
|
397 int v45; // ecx@101
|
|
398 int v46; // eax@105
|
|
399 unsigned int v47; // ebx@106
|
|
400 int v48; // ecx@110
|
|
401 char v49; // zf@123
|
|
402 int v50; // eax@127
|
|
403 int v51; // ecx@130
|
|
404 int v52; // eax@132
|
|
405 int v53; // ecx@137
|
|
406 int v54; // ecx@138
|
|
407 int v55; // eax@142
|
|
408 SpellBuff *v56; // esi@143
|
|
409 Player **v57; // esi@145
|
|
410 int v58; // eax@146
|
|
411 int v59; // edi@146
|
|
412 int v60; // eax@146
|
|
413 int v61; // edi@146
|
|
414 int v62; // eax@146
|
|
415 signed int v63; // edi@146
|
|
416 signed int v64; // edi@147
|
|
417 int v65; // eax@151
|
|
418 char *v66; // eax@160
|
|
419 int v67; // edi@167
|
|
420 int v68; // edi@168
|
|
421 int v69; // eax@171
|
|
422 signed int v70; // ecx@172
|
|
423 signed int v71; // eax@179
|
|
424 __int16 *v72; // edi@180
|
|
425 int v73; // ecx@184
|
|
426 int v74; // edx@184
|
|
427 int v75; // eax@184
|
|
428 AIDirection *v76; // esi@184
|
|
429 unsigned __int16 v77; // di@184
|
|
430 int v78; // eax@184
|
|
431 int v79; // edx@185
|
|
432 int v80; // eax@185
|
|
433 int v81; // eax@189
|
|
434 unsigned __int16 v82; // ax@190
|
|
435 int v83; // ecx@192
|
|
436 int v84; // edx@192
|
|
437 int v85; // eax@192
|
|
438 AIDirection *v86; // esi@192
|
|
439 unsigned __int16 v87; // di@192
|
|
440 __int16 v88; // ax@192
|
|
441 signed int v89; // ecx@192
|
|
442 int v90; // eax@192
|
|
443 signed int v91; // eax@200
|
|
444 int v92; // eax@201
|
|
445 int v93; // ecx@207
|
|
446 int v94; // ecx@208
|
|
447 int v95; // eax@212
|
|
448 int v96; // ecx@217
|
|
449 int v97; // eax@221
|
|
450 SoundID v98; // [sp-18h] [bp-E8h]@79
|
|
451 signed int v99; // [sp-14h] [bp-E4h]@39
|
|
452 unsigned int v100; // [sp-10h] [bp-E0h]@39
|
|
453 signed int v101; // [sp-Ch] [bp-DCh]@39
|
|
454 signed int v102; // [sp-8h] [bp-D8h]@39
|
|
455 int v103; // [sp-4h] [bp-D4h]@39
|
|
456 unsigned int v104; // [sp+0h] [bp-D0h]@39
|
|
457 signed int v105; // [sp+4h] [bp-CCh]@23
|
|
458 int v106; // [sp+4h] [bp-CCh]@39
|
|
459 signed int v107; // [sp+4h] [bp-CCh]@42
|
|
460 signed int v108; // [sp+4h] [bp-CCh]@173
|
|
461 int pitch; // [sp+2Ch] [bp-A4h]@51
|
|
462 float v110; // [sp+30h] [bp-A0h]@50
|
|
463 int v111; // [sp+38h] [bp-98h]@41
|
|
464 float v112; // [sp+3Ch] [bp-94h]@49
|
|
465 int v113; // [sp+40h] [bp-90h]@41
|
|
466 int v114; // [sp+48h] [bp-88h]@41
|
|
467 LayingItem a1; // [sp+4Ch] [bp-84h]@1
|
|
468 int v116; // [sp+BCh] [bp-14h]@49
|
|
469 AIDirection *v117; // [sp+C0h] [bp-10h]@1
|
|
470 int v118; // [sp+C4h] [bp-Ch]@29
|
|
471 float v119; // [sp+C8h] [bp-8h]@48
|
|
472 float v120; // [sp+CCh] [bp-4h]@1
|
|
473 int spellnuma; // [sp+D8h] [bp+8h]@29
|
|
474 int spellnumb; // [sp+D8h] [bp+8h]@48
|
|
475 float spellnumc; // [sp+D8h] [bp+8h]@50
|
|
476 signed int spellnumd; // [sp+D8h] [bp+8h]@53
|
|
477 int spellnume; // [sp+D8h] [bp+8h]@179
|
|
478 int a1a; // [sp+E0h] [bp+10h]@34
|
|
479 signed int a1b; // [sp+E0h] [bp+10h]@145
|
|
480 int a1c; // [sp+E0h] [bp+10h]@184
|
|
481
|
|
482 LODWORD(v120) = uActorID;
|
|
483 v5 = &pActors[uActorID];
|
|
484 v117 = pDir;
|
|
485 v6 = uSkillLevel & 0x3F;
|
|
486 v7 = SkillToMastery(uSkillLevel);
|
|
487 if ( spellnum <= 47 )
|
|
488 {
|
|
489 if ( spellnum != 47 )
|
|
490 {
|
|
491 if ( spellnum <= 18 )
|
|
492 {
|
|
493 if ( spellnum == 18 || spellnum == 2 )
|
|
494 goto LABEL_159;
|
|
495 if ( spellnum != 5 )
|
|
496 {
|
|
497 if ( spellnum == 6 )
|
|
498 goto LABEL_159;
|
|
499 if ( spellnum != 9 )
|
|
500 {
|
|
501 if ( spellnum != 11 )
|
|
502 {
|
|
503 if ( spellnum != 15 )
|
|
504 {
|
|
505 if ( spellnum != 17 )
|
|
506 return;
|
|
507 if ( (signed int)v7 <= 0 )
|
|
508 goto LABEL_20;
|
|
509 if ( (signed int)v7 <= 2 )
|
|
510 {
|
|
511 v9 = 300 * v6;
|
|
512 }
|
|
513 else
|
|
514 {
|
|
515 if ( v7 != 3 )
|
|
516 {
|
|
517 if ( v7 == 4 )
|
|
518 {
|
|
519 v8 = 3600 * (v6 + 64);
|
|
520 LABEL_21:
|
|
521 v5->pActorBuffs[15].Apply(
|
|
522 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
|
|
523 v7,
|
|
524 0,
|
|
525 0,
|
|
526 0);
|
|
527 return;
|
|
528 }
|
|
529 LABEL_20:
|
|
530 v8 = 0;
|
|
531 goto LABEL_21;
|
|
532 }
|
|
533 v9 = 900 * v6;
|
|
534 }
|
|
535 v8 = v9 + 3840;
|
|
536 goto LABEL_21;
|
|
537 }
|
|
538 v10 = 3;
|
|
539 if ( uSkillLevel & 0x0100 )
|
|
540 {
|
|
541 v105 = 9;
|
|
542 }
|
|
543 else
|
|
544 {
|
|
545 if ( (uSkillLevel & 0x80u) == 0 )
|
|
546 {
|
|
547 if ( !(uSkillLevel & 0x40) )
|
|
548 goto LABEL_29;
|
|
549 v105 = 5;
|
|
550 }
|
|
551 else
|
|
552 {
|
|
553 v105 = 7;
|
|
554 }
|
|
555 }
|
|
556 v10 = v105;
|
|
557 LABEL_29:
|
|
558 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
|
|
559 a1.uItemType = stru_4E3ACC[15].uItemType;
|
|
560 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1);
|
|
561 v11 = 0;
|
|
562 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
563 {
|
|
564 LABEL_33:
|
|
565 LOWORD(v11) = 0;
|
|
566 }
|
|
567 else
|
|
568 {
|
|
569 v12 = &pObjectList->pObjects->uObjectID;
|
|
570 while ( stru_4E3ACC[15].uItemType != *v12 )
|
|
571 {
|
|
572 ++v11;
|
|
573 v12 += 28;
|
|
574 if ( v11 >= (signed int)pObjectList->uNumObjects )
|
|
575 goto LABEL_33;
|
|
576 }
|
|
577 }
|
|
578 a1.uObjectDescID = v11;
|
|
579 a1.stru_24.Reset();
|
|
580 a1.field_48 = 15;
|
|
581 v13 = v5->vPosition.x;
|
|
582 v14 = v5->vPosition.y;
|
|
583 a1.field_4C = uSkillLevel;
|
|
584 a1.vPosition.x = v13;
|
|
585 v15 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
|
|
586 v16 = v117;
|
|
587 v17 = LOWORD(v117->uYawAngle);
|
|
588 a1.field_50 = 0;
|
|
589 a1.vPosition.y = v14;
|
|
590 a1.vPosition.z = v15;
|
|
591 a1.uFacing = v17;
|
|
592 a1.uSoundID = 0;
|
|
593 a1.uAttributes = 0;
|
|
594 a1.uSectorID = pIndoor->GetSector(v13, v14, v15);
|
|
595 v18 = 8 * LODWORD(v120);
|
|
596 LOBYTE(v18) = 8 * LOBYTE(v120) | AI_OBJECT_ACTOR;
|
|
597 a1.field_58 = v18;
|
|
598 a1.uSpriteFrameID = 0;
|
|
599 a1.field_5C = 0;
|
|
600 a1.field_60_distance_related_prolly_lod = 3;
|
|
601 v19 = spellnuma / -2;
|
|
602 a1a = spellnuma / 2;
|
|
603 if ( spellnuma / -2 > spellnuma / 2 )
|
|
604 {
|
|
605 v20 = spellnuma / 2;
|
|
606 }
|
|
607 else
|
|
608 {
|
|
609 do
|
|
610 {
|
|
611 a1.uFacing = v19 + LOWORD(v16->uYawAngle);
|
|
612 v20 = a1.Create(
|
|
613 (signed __int16)a1.uFacing,
|
|
614 v16->uPitchAngle,
|
|
615 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
616 0);
|
|
617 v19 += v118;
|
|
618 }
|
|
619 while ( v19 <= a1a );
|
|
620 }
|
|
621 if ( v20 != -1 )
|
|
622 {
|
|
623 v106 = 0;
|
|
624 v104 = 0;
|
|
625 v103 = 0;
|
|
626 v102 = 0;
|
|
627 v21 = 8 * v20;
|
|
628 v101 = -1;
|
|
629 LOBYTE(v21) = v21 | 2;
|
|
630 v100 = 0;
|
|
631 v99 = v21;
|
31
|
632 v22 = (SoundID)word_4EE088_sound_ids[15];
|
0
|
633 LABEL_202:
|
|
634 v98 = v22;
|
|
635 goto LABEL_222;
|
|
636 }
|
|
637 return;
|
|
638 }
|
|
639 LABEL_159:
|
|
640 a1.uItemType = stru_4E3ACC[spellnum].uItemType;
|
|
641 v119 = 0.0;
|
|
642 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
643 {
|
|
644 LABEL_191:
|
|
645 v82 = 0;
|
|
646 }
|
|
647 else
|
|
648 {
|
|
649 v66 = (char *)&pObjectList->pObjects->uObjectID;
|
|
650 while ( (short)a1.uItemType != *(short *)v66 )
|
|
651 {
|
|
652 ++LODWORD(v119);
|
|
653 v66 += 56;
|
|
654 if ( SLODWORD(v119) >= (signed int)pObjectList->uNumObjects )
|
|
655 goto LABEL_191;
|
|
656 }
|
|
657 v82 = LOWORD(v119);
|
|
658 }
|
|
659 a1.uObjectDescID = v82;
|
|
660 a1.stru_24.Reset();
|
|
661 a1.field_48 = spellnum;
|
|
662 v83 = v5->vPosition.x;
|
|
663 v84 = v5->vPosition.y;
|
|
664 a1.field_4C = uSkillLevel;
|
|
665 a1.vPosition.x = v83;
|
|
666 v85 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
|
|
667 v86 = v117;
|
|
668 v87 = LOWORD(v117->uYawAngle);
|
|
669 a1.field_50 = 0;
|
|
670 a1.vPosition.y = v84;
|
|
671 a1.vPosition.z = v85;
|
|
672 a1.uFacing = v87;
|
|
673 a1.uSoundID = 0;
|
|
674 a1.uAttributes = 0;
|
|
675 v88 = pIndoor->GetSector(v83, v84, v85);
|
|
676 v89 = v86->uDistance;
|
|
677 a1.uSectorID = v88;
|
|
678 LODWORD(v119) = v89;
|
|
679 v90 = 8 * LODWORD(v120);
|
|
680 LOBYTE(v90) = 8 * LOBYTE(v120) | 3;
|
|
681 a1.uSpriteFrameID = 0;
|
|
682 a1.field_58 = v90;
|
|
683 a1.field_5C = 0;
|
|
684 a1.field_60_distance_related_prolly_lod = 3;
|
|
685 if ( (double)v89 >= 307.2 )
|
|
686 {
|
|
687 if ( v89 >= 1024 )
|
|
688 {
|
|
689 if ( v89 >= 2560 )
|
|
690 {
|
|
691 if ( v89 < 5120 )
|
|
692 a1.field_60_distance_related_prolly_lod = 3;
|
|
693 }
|
|
694 else
|
|
695 {
|
|
696 a1.field_60_distance_related_prolly_lod = 2;
|
|
697 }
|
|
698 }
|
|
699 else
|
|
700 {
|
|
701 a1.field_60_distance_related_prolly_lod = 1;
|
|
702 }
|
|
703 }
|
|
704 else
|
|
705 {
|
|
706 a1.field_60_distance_related_prolly_lod = 0;
|
|
707 }
|
|
708 a1.field_61 = 2;
|
|
709 v91 = a1.Create(
|
|
710 v86->uYawAngle,
|
|
711 v86->uPitchAngle,
|
|
712 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
713 0);
|
|
714 if ( v91 != -1 )
|
|
715 {
|
|
716 v106 = 0;
|
|
717 v104 = 0;
|
|
718 v103 = 0;
|
|
719 v102 = 0;
|
|
720 v92 = 8 * v91;
|
|
721 v101 = -1;
|
|
722 LOBYTE(v92) = v92 | 2;
|
|
723 v100 = 0;
|
|
724 v99 = v92;
|
|
725 v22 = (SoundID)word_4EE088_sound_ids[spellnum];
|
|
726 goto LABEL_202;
|
|
727 }
|
|
728 return;
|
|
729 }
|
|
730 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
731 return;
|
58
|
732 v118 = pParty->vPosition.z;
|
0
|
733 v111 = pParty->vPosition.x;
|
58
|
734 v114 = pParty->vPosition.z + 2500;
|
|
735 v113 = pParty->vPosition.y;
|
0
|
736 v23 = 8;
|
|
737 if ( uSkillLevel & 0x0100 )
|
|
738 {
|
|
739 v107 = 14;
|
|
740 }
|
|
741 else
|
|
742 {
|
|
743 if ( (uSkillLevel & 0x80u) == 0 )
|
|
744 {
|
|
745 if ( !(uSkillLevel & 0x40) )
|
|
746 goto LABEL_48;
|
|
747 v107 = 10;
|
|
748 }
|
|
749 else
|
|
750 {
|
|
751 v107 = 12;
|
|
752 }
|
|
753 }
|
|
754 v23 = v107;
|
|
755 LABEL_48:
|
|
756 v119 = 0.0;
|
|
757 spellnumb = 0;
|
|
758 if ( v23 > 0 )
|
|
759 {
|
|
760 v24 = (double)v118;
|
|
761 v118 = v23;
|
|
762 v112 = v24;
|
|
763 v116 = 8 * LODWORD(v120) | 3;
|
|
764 do
|
|
765 {
|
|
766 v26 = rand();
|
|
767 v27 = (double)spellnumb;
|
|
768 v110 = v27;
|
|
769 v28 = (double)SLODWORD(v119);
|
|
770 v30 = v26 % 1000;
|
|
771 v25 = (double)v114;
|
|
772 spellnumc = (double)(v26 % 1000) + v112 - v25;
|
|
773 v120 = v28 * v28;
|
|
774 v119 = v27 * v27;
|
|
775 if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 )
|
|
776 {
|
|
777 v32 = 0;
|
|
778 pitch = 0;
|
|
779 }
|
|
780 else
|
|
781 {
|
|
782 v31 = (signed __int64)sqrt(v119 + v120);
|
|
783 v29 = v28;
|
|
784 v32 = stru_5C6E00->Atan2((signed __int64)v110, (signed __int64)v29);
|
|
785 pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc);
|
|
786 }
|
|
787 a1.stru_24.Reset();
|
|
788 a1.uItemType = stru_4E3ACC[9].uItemType;
|
|
789 spellnumd = 0;
|
|
790 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
791 {
|
|
792 LABEL_57:
|
|
793 v34 = 0;
|
|
794 }
|
|
795 else
|
|
796 {
|
|
797 v33 = (char *)&pObjectList->pObjects->uObjectID;
|
|
798 while ( (short)a1.uItemType != *(short *)v33 )
|
|
799 {
|
|
800 ++spellnumd;
|
|
801 v33 += 56;
|
|
802 if ( spellnumd >= (signed int)pObjectList->uNumObjects )
|
|
803 goto LABEL_57;
|
|
804 }
|
|
805 v34 = spellnumd;
|
|
806 }
|
|
807 a1.uObjectDescID = v34;
|
|
808 a1.field_4C = uSkillLevel;
|
|
809 a1.vPosition.x = v111;
|
|
810 a1.vPosition.y = v113;
|
|
811 a1.vPosition.z = v30 + v114;
|
|
812 a1.field_48 = 9;
|
|
813 a1.field_50 = 0;
|
|
814 a1.uAttributes = 0;
|
|
815 a1.uSectorID = 0;
|
|
816 a1.uSpriteFrameID = 0;
|
|
817 a1.field_58 = v116;
|
|
818 a1.field_5C = 0;
|
|
819 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500);
|
|
820 a1.uFacing = v32;
|
|
821 a1.uSoundID = 0;
|
|
822 v35 = v117->uDistance;
|
|
823 LODWORD(v119) = v117->uDistance;
|
|
824 if ( (double)SLODWORD(v119) >= 307.2 )
|
|
825 {
|
|
826 if ( v35 >= 1024 )
|
|
827 {
|
|
828 if ( v35 >= 2560 )
|
|
829 {
|
|
830 if ( v35 < 5120 )
|
|
831 a1.field_60_distance_related_prolly_lod = 3;
|
|
832 }
|
|
833 else
|
|
834 {
|
|
835 a1.field_60_distance_related_prolly_lod = 2;
|
|
836 }
|
|
837 }
|
|
838 else
|
|
839 {
|
|
840 a1.field_60_distance_related_prolly_lod = 1;
|
|
841 }
|
|
842 }
|
|
843 else
|
|
844 {
|
|
845 a1.field_60_distance_related_prolly_lod = 0;
|
|
846 }
|
|
847 a1.field_61 = 2;
|
|
848 v36 = a1.Create(
|
|
849 v32,
|
|
850 pitch,
|
|
851 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
852 0);
|
|
853 if ( v36 != -1 )
|
|
854 {
|
|
855 v37 = 8 * v36;
|
|
856 LOBYTE(v37) = v37 | 2;
|
31
|
857 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], v37, 0, -1, 0, 0, 0, 0);
|
0
|
858 }
|
|
859 spellnumb = rand() % 1024 - 512;
|
|
860 v38 = rand();
|
|
861 v49 = v118-- == 1;
|
|
862 LODWORD(v119) = (unsigned __int64)(v38 % 1024) - 512;
|
|
863 }
|
|
864 while ( !v49 );
|
|
865 }
|
|
866 return;
|
|
867 }
|
|
868 if ( (signed int)v7 > 0 )
|
|
869 {
|
|
870 if ( (signed int)v7 <= 2 )
|
|
871 {
|
|
872 v39 = 60 * (v6 + 60);
|
|
873 goto LABEL_79;
|
|
874 }
|
|
875 if ( v7 == 3 )
|
|
876 {
|
|
877 v39 = 180 * (v6 + 20);
|
|
878 goto LABEL_79;
|
|
879 }
|
|
880 if ( v7 == 4 )
|
|
881 {
|
|
882 v39 = 240 * (v6 + 15);
|
|
883 LABEL_79:
|
|
884 v5->pActorBuffs[19].Apply(
|
|
885 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
|
|
886 v7,
|
|
887 0,
|
|
888 0,
|
|
889 0);
|
|
890 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
|
|
891 v106 = 0;
|
|
892 v104 = 0;
|
|
893 v103 = 0;
|
|
894 v102 = 0;
|
|
895 v40 = 8 * LODWORD(v120);
|
|
896 v101 = -1;
|
|
897 LOBYTE(v40) = 8 * LOBYTE(v120) | 3;
|
|
898 v100 = 0;
|
|
899 v99 = v40;
|
|
900 v98 = (SoundID)10040;
|
|
901 LABEL_222:
|
|
902 pAudioPlayer->PlaySound(v98, v99, v100, v101, v102, v103, v104, v106);
|
|
903 return;
|
|
904 }
|
|
905 }
|
|
906 v39 = 0;
|
|
907 goto LABEL_79;
|
|
908 }
|
|
909 if ( spellnum == 26 || spellnum == 29 )
|
|
910 goto LABEL_159;
|
|
911 if ( spellnum != 38 )
|
|
912 {
|
|
913 if ( spellnum == 39 || spellnum == 41 )
|
|
914 goto LABEL_159;
|
|
915 if ( spellnum != 46 )
|
|
916 return;
|
|
917 if ( (signed int)v7 > 0 )
|
|
918 {
|
|
919 if ( (signed int)v7 <= 2 )
|
|
920 {
|
|
921 v41 = 300 * v6;
|
|
922 goto LABEL_91;
|
|
923 }
|
|
924 if ( v7 == 3 )
|
|
925 {
|
|
926 v41 = 900 * v6;
|
|
927 goto LABEL_91;
|
|
928 }
|
|
929 if ( v7 == 4 )
|
|
930 {
|
|
931 v41 = 1200 * v6;
|
|
932 LABEL_91:
|
|
933 v42 = v41 + 3840;
|
|
934 LABEL_95:
|
|
935 v5->pActorBuffs[17].Apply(
|
|
936 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
|
|
937 v7,
|
|
938 v6 + 5,
|
|
939 0,
|
|
940 0);
|
|
941 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
|
|
942 v5,
|
|
943 (unsigned int)((char *)&pDecalBuilder->std__vector_pDecals[557].pVertices[57].vWorldPosition.x + 1));
|
|
944 v106 = 0;
|
|
945 v104 = 0;
|
|
946 v103 = 0;
|
|
947 v102 = 0;
|
|
948 v43 = 8 * LODWORD(v120);
|
|
949 v101 = -1;
|
|
950 LOBYTE(v43) = 8 * LOBYTE(v120) | 3;
|
|
951 v100 = 0;
|
|
952 v99 = v43;
|
|
953 v98 = (SoundID)14010;
|
|
954 goto LABEL_222;
|
|
955 }
|
|
956 }
|
|
957 v42 = 0;
|
|
958 goto LABEL_95;
|
|
959 }
|
|
960 if ( (signed int)v7 <= 0 )
|
|
961 goto LABEL_104;
|
|
962 if ( (signed int)v7 <= 2 )
|
|
963 {
|
|
964 v45 = 300 * v6;
|
|
965 }
|
|
966 else
|
|
967 {
|
|
968 if ( v7 != 3 )
|
|
969 {
|
|
970 if ( v7 == 4 )
|
|
971 {
|
|
972 v44 = 3600 * (v6 + 64);
|
|
973 LABEL_105:
|
|
974 v5->pActorBuffs[16].Apply(
|
|
975 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
|
|
976 v7,
|
|
977 v6 + 5,
|
|
978 0,
|
|
979 0);
|
|
980 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
|
|
981 v5,
|
|
982 (unsigned int)((char *)&pLevelEVT_Events[4335].uEventID + 2));
|
|
983 v106 = 0;
|
|
984 v104 = 0;
|
|
985 v103 = 0;
|
|
986 v102 = 0;
|
|
987 v46 = 8 * LODWORD(v120);
|
|
988 v101 = -1;
|
|
989 LOBYTE(v46) = 8 * LOBYTE(v120) | 3;
|
|
990 v100 = 0;
|
|
991 v99 = v46;
|
|
992 v98 = (SoundID)13040;
|
|
993 goto LABEL_222;
|
|
994 }
|
|
995 LABEL_104:
|
|
996 v44 = 0;
|
|
997 goto LABEL_105;
|
|
998 }
|
|
999 v45 = 900 * v6;
|
|
1000 }
|
|
1001 v44 = v45 + 3840;
|
|
1002 goto LABEL_105;
|
|
1003 }
|
|
1004 v47 = 0;
|
|
1005 if ( (signed int)v7 > 0 )
|
|
1006 {
|
|
1007 if ( (signed int)v7 <= 2 )
|
|
1008 {
|
|
1009 v48 = 2 * v6 + 40;
|
|
1010 goto LABEL_114;
|
|
1011 }
|
|
1012 if ( v7 == 3 )
|
|
1013 {
|
|
1014 v48 = 3 * v6 + 60;
|
|
1015 goto LABEL_114;
|
|
1016 }
|
|
1017 if ( v7 == 4 )
|
|
1018 {
|
|
1019 LOWORD(v48) = 2 * (3 * v6 + 60);
|
|
1020 LABEL_114:
|
|
1021 v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, v7, v48, 0, 0);
|
|
1022 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
|
|
1023 v5,
|
|
1024 (unsigned int)((char *)&pDecalBuilder->std__vector_pDecals[557].pVertices[57].vWorldPosition.x + 1));
|
|
1025 LABEL_127:
|
|
1026 v106 = v47;
|
|
1027 v104 = v47;
|
|
1028 v103 = v47;
|
|
1029 v50 = 8 * LODWORD(v120);
|
|
1030 v102 = v47;
|
|
1031 v101 = -1;
|
|
1032 LOBYTE(v50) = 8 * LOBYTE(v120) | 3;
|
|
1033 v100 = v47;
|
|
1034 v99 = v50;
|
|
1035 v98 = (SoundID)14020;
|
|
1036 goto LABEL_222;
|
|
1037 }
|
|
1038 }
|
|
1039 LOWORD(v48) = 0;
|
|
1040 goto LABEL_114;
|
|
1041 }
|
|
1042 if ( spellnum <= 80 )
|
|
1043 {
|
|
1044 if ( spellnum == 80 )
|
|
1045 {
|
|
1046 v56 = pParty->pPartyBuffs;
|
|
1047 do
|
|
1048 {
|
|
1049 v56->Reset();
|
|
1050 ++v56;
|
|
1051 }
|
|
1052 while ( (signed int)v56 < (signed int)pParty->pPlayers );
|
|
1053 a1b = 1;
|
|
1054 v57 = &pPlayers[1];
|
|
1055 do
|
|
1056 {
|
|
1057 v58 = (*v57)->GetActualWillpower();
|
|
1058 v59 = (*v57)->_48EA1B_get_static_effect(v58);
|
|
1059 v60 = (*v57)->GetActualIntelligence();
|
|
1060 v61 = ((*v57)->_48EA1B_get_static_effect(v60) + v59) >> 1;
|
|
1061 v62 = (*v57)->GetActualLuck();
|
|
1062 v63 = v61 + (*v57)->_48EA1B_get_static_effect(v62) + 30;
|
|
1063 if ( rand() % v63 < 30 )
|
|
1064 {
|
|
1065 v64 = 6048;
|
|
1066 do
|
|
1067 {
|
|
1068 ((SpellBuff *)((char *)*v57 + v64))->Reset();
|
|
1069 v64 += 16;
|
|
1070 }
|
|
1071 while ( v64 < 6432 );
|
|
1072 pOtherOverlayList->_4418B1(11210, a1b + 99, 0, 65536);
|
|
1073 }
|
|
1074 ++a1b;
|
|
1075 ++v57;
|
|
1076 }
|
|
1077 while ( (signed int)v57 <= (signed int)&pPlayers[4] );
|
|
1078 v106 = 0;
|
|
1079 v104 = 0;
|
|
1080 v103 = 0;
|
|
1081 v65 = 8 * LODWORD(v120);
|
|
1082 v102 = 0;
|
|
1083 v101 = -1;
|
|
1084 LOBYTE(v65) = 8 * LOBYTE(v120) | 3;
|
|
1085 v100 = 0;
|
|
1086 v99 = v65;
|
31
|
1087 v22 = (SoundID)word_4EE088_sound_ids[80];
|
0
|
1088 goto LABEL_202;
|
|
1089 }
|
|
1090 if ( spellnum != 51 )
|
|
1091 {
|
|
1092 if ( spellnum == 57 || spellnum == 65 || spellnum == 70 )
|
|
1093 goto LABEL_159;
|
|
1094 if ( spellnum == 73 )
|
|
1095 {
|
|
1096 if ( (signed int)v7 <= 0 || (signed int)v7 > 4 )
|
|
1097 v51 = 0;
|
|
1098 else
|
|
1099 v51 = 3600 * v6;
|
|
1100 v5->pActorBuffs[21].Apply(
|
|
1101 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335),
|
|
1102 v7,
|
|
1103 v6,
|
|
1104 0,
|
|
1105 0);
|
|
1106 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
|
|
1107 v106 = 0;
|
|
1108 v104 = 0;
|
|
1109 v103 = 0;
|
|
1110 v102 = 0;
|
|
1111 v52 = 8 * LODWORD(v120);
|
|
1112 v101 = -1;
|
|
1113 LOBYTE(v52) = 8 * LOBYTE(v120) | 3;
|
|
1114 v100 = 0;
|
|
1115 v99 = v52;
|
|
1116 v98 = (SoundID)16060;
|
|
1117 goto LABEL_222;
|
|
1118 }
|
|
1119 if ( spellnum == 77 )
|
|
1120 {
|
|
1121 v5->sCurrentHP += 5 * v6 + 10;
|
|
1122 if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP )
|
|
1123 v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP);
|
|
1124 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
|
|
1125 v47 = 0;
|
|
1126 goto LABEL_127;
|
|
1127 }
|
|
1128 v49 = spellnum == 78;
|
|
1129 LABEL_158:
|
|
1130 if ( !v49 )
|
|
1131 return;
|
|
1132 goto LABEL_159;
|
|
1133 }
|
|
1134 if ( (signed int)v7 > 0 )
|
|
1135 {
|
|
1136 if ( (signed int)v7 <= 2 )
|
|
1137 {
|
|
1138 v53 = 300 * v6;
|
|
1139 goto LABEL_138;
|
|
1140 }
|
|
1141 if ( v7 == 3 )
|
|
1142 {
|
|
1143 v53 = 900 * v6;
|
|
1144 goto LABEL_138;
|
|
1145 }
|
|
1146 if ( v7 == 4 )
|
|
1147 {
|
|
1148 v53 = 1200 * v6;
|
|
1149 LABEL_138:
|
|
1150 v54 = v53 + 3840;
|
|
1151 LABEL_142:
|
|
1152 v5->pActorBuffs[18].Apply(
|
|
1153 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
|
|
1154 v7,
|
|
1155 v6 + 5,
|
|
1156 0,
|
|
1157 0);
|
|
1158 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
|
|
1159 v5,
|
|
1160 (unsigned int)((char *)&pDecalBuilder->std__vector_pDecals[557].pVertices[57].vWorldPosition.x + 1));
|
|
1161 v106 = 0;
|
|
1162 v104 = 0;
|
|
1163 v103 = 0;
|
|
1164 v102 = 0;
|
|
1165 v55 = 8 * LODWORD(v120);
|
|
1166 v101 = -1;
|
|
1167 LOBYTE(v55) = 8 * LOBYTE(v120) | 3;
|
|
1168 v100 = 0;
|
|
1169 v99 = v55;
|
|
1170 v98 = (SoundID)14060;
|
|
1171 goto LABEL_222;
|
|
1172 }
|
|
1173 }
|
|
1174 v54 = 0;
|
|
1175 goto LABEL_142;
|
|
1176 }
|
|
1177 if ( spellnum == 85 )
|
|
1178 {
|
|
1179 if ( (signed int)v7 > 0 )
|
|
1180 {
|
|
1181 if ( (signed int)v7 <= 2 )
|
|
1182 {
|
|
1183 v96 = 300 * v6 + 3840;
|
|
1184 goto LABEL_221;
|
|
1185 }
|
|
1186 if ( v7 == 3 )
|
|
1187 {
|
|
1188 LOWORD(v6) = 3 * v6;
|
|
1189 v96 = 900 * (uSkillLevel & 0x3F) + 3840;
|
|
1190 goto LABEL_221;
|
|
1191 }
|
|
1192 if ( v7 == 4 )
|
|
1193 {
|
|
1194 v96 = 1200 * v6 + 3840;
|
|
1195 LOWORD(v6) = 4 * v6;
|
|
1196 LABEL_221:
|
|
1197 v5->pActorBuffs[13].Apply(
|
|
1198 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
|
|
1199 v7,
|
|
1200 v6,
|
|
1201 0,
|
|
1202 0);
|
|
1203 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
|
|
1204 v106 = 0;
|
|
1205 v104 = 0;
|
|
1206 v103 = 0;
|
|
1207 v102 = 0;
|
|
1208 v97 = 8 * LODWORD(v120);
|
|
1209 v101 = -1;
|
|
1210 LOBYTE(v97) = 8 * LOBYTE(v120) | 3;
|
|
1211 v100 = 0;
|
|
1212 v99 = v97;
|
|
1213 v98 = (SoundID)17070;
|
|
1214 goto LABEL_222;
|
|
1215 }
|
|
1216 }
|
|
1217 LOWORD(v6) = uSkillLevel;
|
|
1218 v96 = 0;
|
|
1219 goto LABEL_221;
|
|
1220 }
|
|
1221 if ( spellnum == 86 )
|
|
1222 {
|
|
1223 if ( (signed int)v7 > 0 )
|
|
1224 {
|
|
1225 if ( (signed int)v7 <= 2 )
|
|
1226 {
|
|
1227 v93 = 300 * v6;
|
|
1228 goto LABEL_208;
|
|
1229 }
|
|
1230 if ( v7 == 3 )
|
|
1231 {
|
|
1232 v93 = 900 * v6;
|
|
1233 goto LABEL_208;
|
|
1234 }
|
|
1235 if ( v7 == 4 )
|
|
1236 {
|
|
1237 v93 = 1200 * v6;
|
|
1238 LABEL_208:
|
|
1239 v94 = v93 + 3840;
|
|
1240 LABEL_212:
|
|
1241 v5->pActorBuffs[14].Apply(
|
|
1242 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
|
|
1243 v7,
|
|
1244 v6 + 5,
|
|
1245 0,
|
|
1246 0);
|
|
1247 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
|
|
1248 v106 = 0;
|
|
1249 v104 = 0;
|
|
1250 v103 = 0;
|
|
1251 v102 = 0;
|
|
1252 v95 = 8 * LODWORD(v120);
|
|
1253 v101 = -1;
|
|
1254 LOBYTE(v95) = 8 * LOBYTE(v120) | 3;
|
|
1255 v100 = 0;
|
|
1256 v99 = v95;
|
|
1257 v98 = (SoundID)17080;
|
|
1258 goto LABEL_222;
|
|
1259 }
|
|
1260 }
|
|
1261 v94 = 0;
|
|
1262 goto LABEL_212;
|
|
1263 }
|
|
1264 if ( spellnum == 90 )
|
|
1265 goto LABEL_159;
|
|
1266 if ( spellnum != 93 )
|
|
1267 {
|
|
1268 if ( spellnum != 95 )
|
|
1269 {
|
|
1270 v49 = spellnum == 97;
|
|
1271 goto LABEL_158;
|
|
1272 }
|
|
1273 if ( (signed int)v7 > 0 )
|
|
1274 {
|
|
1275 if ( (signed int)v7 <= 3 )
|
|
1276 {
|
|
1277 v67 = 300 * v6;
|
|
1278 goto LABEL_168;
|
|
1279 }
|
|
1280 if ( v7 == 4 )
|
|
1281 {
|
|
1282 v67 = 900 * v6;
|
|
1283 LABEL_168:
|
|
1284 v68 = v67 + 3840;
|
|
1285 LABEL_171:
|
|
1286 v5->pActorBuffs[20].Apply(
|
|
1287 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
|
|
1288 v7,
|
|
1289 0,
|
|
1290 0,
|
|
1291 0);
|
|
1292 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
|
|
1293 v5,
|
|
1294 (unsigned int)((char *)&array_77EC08[1607].v_18.z + 2));
|
|
1295 v106 = 0;
|
|
1296 v104 = 0;
|
|
1297 v103 = 0;
|
|
1298 v102 = 0;
|
|
1299 v69 = 8 * LODWORD(v120);
|
|
1300 v101 = -1;
|
|
1301 LOBYTE(v69) = 8 * LOBYTE(v120) | 3;
|
|
1302 v100 = 0;
|
|
1303 v99 = v69;
|
|
1304 v98 = (SoundID)18060;
|
|
1305 goto LABEL_222;
|
|
1306 }
|
|
1307 }
|
|
1308 v68 = 0;
|
|
1309 goto LABEL_171;
|
|
1310 }
|
|
1311 v70 = 3;
|
|
1312 if ( uSkillLevel & 0x100 )
|
|
1313 {
|
|
1314 v108 = 9;
|
|
1315 }
|
|
1316 else
|
|
1317 {
|
|
1318 if ( (uSkillLevel & 0x80u) == 0 )
|
|
1319 {
|
|
1320 if ( !(uSkillLevel & 0x40) )
|
|
1321 goto LABEL_179;
|
|
1322 v108 = 5;
|
|
1323 }
|
|
1324 else
|
|
1325 {
|
|
1326 v108 = 7;
|
|
1327 }
|
|
1328 }
|
|
1329 v70 = v108;
|
|
1330 LABEL_179:
|
|
1331 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
|
|
1332 a1.uItemType = stru_4E3ACC[93].uItemType;
|
|
1333 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1);
|
|
1334 v71 = 0;
|
|
1335 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
1336 {
|
|
1337 LABEL_183:
|
|
1338 LOWORD(v71) = 0;
|
|
1339 }
|
|
1340 else
|
|
1341 {
|
|
1342 v72 = &pObjectList->pObjects->uObjectID;
|
|
1343 while ( stru_4E3ACC[93].uItemType != *v72 )
|
|
1344 {
|
|
1345 ++v71;
|
|
1346 v72 += 28;
|
|
1347 if ( v71 >= (signed int)pObjectList->uNumObjects )
|
|
1348 goto LABEL_183;
|
|
1349 }
|
|
1350 }
|
|
1351 a1.uObjectDescID = v71;
|
|
1352 a1.stru_24.Reset();
|
|
1353 a1.field_48 = 93;
|
|
1354 v73 = v5->vPosition.x;
|
|
1355 v74 = v5->vPosition.y;
|
|
1356 a1.field_4C = uSkillLevel;
|
|
1357 a1.vPosition.x = v73;
|
|
1358 v75 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
|
|
1359 v76 = v117;
|
|
1360 v77 = LOWORD(v117->uYawAngle);
|
|
1361 a1.field_50 = 0;
|
|
1362 a1.vPosition.y = v74;
|
|
1363 a1.vPosition.z = v75;
|
|
1364 a1.uFacing = v77;
|
|
1365 a1.uSoundID = 0;
|
|
1366 a1.uAttributes = 0;
|
|
1367 a1.uSectorID = pIndoor->GetSector(v73, v74, v75);
|
|
1368 v78 = 8 * LODWORD(v120);
|
|
1369 LOBYTE(v78) = 8 * LOBYTE(v120) | 3;
|
|
1370 a1.field_58 = v78;
|
|
1371 a1.uSpriteFrameID = 0;
|
|
1372 a1.field_5C = 0;
|
|
1373 a1.field_60_distance_related_prolly_lod = 3;
|
|
1374 a1c = spellnume / -2;
|
|
1375 if ( spellnume / -2 > spellnume / 2 )
|
|
1376 {
|
|
1377 v80 = spellnume / -2;
|
|
1378 }
|
|
1379 else
|
|
1380 {
|
|
1381 do
|
|
1382 {
|
|
1383 v79 = v76->uYawAngle;
|
|
1384 a1.uFacing = a1c + LOWORD(v76->uYawAngle);
|
|
1385 v80 = a1.Create(
|
|
1386 v79,
|
|
1387 v76->uPitchAngle,
|
|
1388 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
1389 0);
|
|
1390 a1c += v116;
|
|
1391 }
|
|
1392 while ( a1c <= spellnume / 2 );
|
|
1393 }
|
|
1394 if ( v80 != -1 )
|
|
1395 {
|
|
1396 v106 = 0;
|
|
1397 v104 = 0;
|
|
1398 v103 = 0;
|
|
1399 v102 = 0;
|
|
1400 v81 = 8 * v80;
|
|
1401 v101 = -1;
|
|
1402 LOBYTE(v81) = v81 | 2;
|
|
1403 v100 = 0;
|
|
1404 v99 = v81;
|
31
|
1405 v22 = (SoundID)word_4EE088_sound_ids[93];
|
0
|
1406 goto LABEL_202;
|
|
1407 }
|
|
1408 }
|
|
1409
|
|
1410
|
|
1411 //----- (0043ABB0) --------------------------------------------------------
|
|
1412 bool Actor::_43ABB0(Actor *a1, Actor *a2)
|
|
1413 {
|
|
1414 unsigned int v2; // esi@1
|
|
1415 unsigned int v3; // edi@1
|
|
1416 bool result; // eax@9
|
|
1417
|
|
1418 v2 = a1->uAlly;
|
|
1419 v3 = a2->uAlly;
|
|
1420 if ( !v2 )
|
|
1421 v2 = (a1->pMonsterInfo.uID - 1) / 3 + 1;
|
|
1422 if ( !v3 )
|
|
1423 v3 = (a2->pMonsterInfo.uID - 1) / 3 + 1;
|
|
1424 if ( (signed int)v2 >= 39 && (signed int)v2 <= 44 && (signed int)v3 >= 39 && (signed int)v3 <= 44
|
|
1425 || (signed int)v2 >= 45 && (signed int)v2 <= 50 && (signed int)v3 >= 45 && (signed int)v3 <= 50
|
|
1426 || (signed int)v2 >= 51 && (signed int)v2 <= 62 && (signed int)v3 >= 51 && (signed int)v3 <= 62
|
|
1427 || (signed int)v2 >= 78 && (signed int)v2 <= 83 && (signed int)v3 >= 78 && (signed int)v3 <= 83 )
|
|
1428 result = 1;
|
|
1429 else
|
|
1430 result = v2 == v3;
|
|
1431 return result;
|
|
1432 }
|
|
1433
|
|
1434 //----- (0043AC45) --------------------------------------------------------
|
|
1435 void Actor::_43AC45(unsigned int uActorID, int a2)
|
|
1436 {
|
|
1437 Actor *v2; // esi@1
|
|
1438 char *v3; // edi@4
|
|
1439 int v4; // ebx@8
|
|
1440 int v5; // ST1C_4@8
|
|
1441 int v6; // eax@8
|
|
1442 int v7; // [sp+4h] [bp-10h]@1
|
|
1443 unsigned int uActorID_; // [sp+Ch] [bp-8h]@1
|
|
1444 signed int v9; // [sp+10h] [bp-4h]@3
|
|
1445
|
|
1446 uActorID_ = uActorID;
|
|
1447 v2 = &pActors[uActorID];
|
|
1448 v7 = a2;
|
|
1449 if ( a2 == 1 )
|
|
1450 BYTE2(v2->uAttributes) |= 8u;
|
|
1451 v9 = 0;
|
|
1452 if ( (signed int)uNumActors > 0 )
|
|
1453 {
|
|
1454 v3 = (char *)&pActors[0].vPosition.y;
|
|
1455 do
|
|
1456 {
|
|
1457 if ( ((Actor *)(v3 - 144))->CanAct() )
|
|
1458 {
|
|
1459 if ( v9 != uActorID_ )
|
|
1460 {
|
|
1461 if ( Actor::_43ABB0(v2, (Actor *)(v3 - 144)) )
|
|
1462 {
|
|
1463 v4 = abs(*((short *)v3 - 1) - v2->vPosition.x);
|
|
1464 v5 = abs(*(short *)v3 - v2->vPosition.y);
|
|
1465 v6 = abs(*((short *)v3 + 1) - v2->vPosition.z);
|
|
1466 if ( (double)sub_4621DA(v4, v5, v6) < 4096.0 )
|
|
1467 {
|
|
1468 *(v3 - 83) = 4;
|
|
1469 if ( v7 == 1 )
|
|
1470 *(v3 - 106) |= 8u;
|
|
1471 }
|
|
1472 }
|
|
1473 }
|
|
1474 }
|
|
1475 ++v9;
|
|
1476 v3 += 836;
|
|
1477 }
|
|
1478 while ( v9 < (signed int)uNumActors );
|
|
1479 }
|
|
1480 }
|
|
1481
|
|
1482
|
|
1483 //----- (00404874) --------------------------------------------------------
|
|
1484 char __fastcall Actor::_404874(unsigned int uActorID, AIDirection *a2, int a3, char a4)
|
|
1485 {
|
|
1486 AIDirection *v4; // edi@1
|
|
1487 Actor *v5; // esi@1
|
|
1488 char result; // al@1
|
|
1489 char *v7; // eax@15
|
|
1490 unsigned __int16 v8; // ax@18
|
|
1491 unsigned __int16 v9; // ax@19
|
|
1492 __int16 v10; // ax@19
|
|
1493 signed int v11; // ecx@19
|
|
1494 int v12; // eax@19
|
|
1495 int v13; // edx@28
|
|
1496 //LayingItem a1; // [sp+Ch] [bp-74h]@1
|
|
1497 unsigned int v15; // [sp+7Ch] [bp-4h]@1
|
|
1498 signed int v16; // [sp+88h] [bp+8h]@14
|
|
1499 signed int v17; // [sp+88h] [bp+8h]@19
|
|
1500
|
|
1501 v15 = uActorID;
|
|
1502 v4 = a2;
|
|
1503 v5 = &pActors[uActorID];
|
|
1504
|
|
1505 LayingItem a1; // [sp+Ch] [bp-74h]@1
|
|
1506 //LayingItem::LayingItem(&a1);
|
|
1507
|
|
1508 result = a3 - 1;
|
|
1509 switch ( a3 )
|
|
1510 {
|
|
1511 case 1:
|
|
1512 a1.uItemType = 545;
|
|
1513 goto LABEL_14;
|
|
1514 case 2:
|
|
1515 a1.uItemType = 550;
|
|
1516 goto LABEL_14;
|
|
1517 case 3:
|
|
1518 a1.uItemType = 510;
|
|
1519 goto LABEL_14;
|
|
1520 case 4:
|
|
1521 a1.uItemType = 500;
|
|
1522 goto LABEL_14;
|
|
1523 case 5:
|
|
1524 a1.uItemType = 515;
|
|
1525 goto LABEL_14;
|
|
1526 case 6:
|
|
1527 a1.uItemType = 505;
|
|
1528 goto LABEL_14;
|
|
1529 case 7:
|
|
1530 a1.uItemType = 530;
|
|
1531 goto LABEL_14;
|
|
1532 case 8:
|
|
1533 a1.uItemType = 525;
|
|
1534 goto LABEL_14;
|
|
1535 case 9:
|
|
1536 a1.uItemType = 520;
|
|
1537 goto LABEL_14;
|
|
1538 case 10:
|
|
1539 a1.uItemType = 535;
|
|
1540 goto LABEL_14;
|
|
1541 case 11:
|
|
1542 a1.uItemType = 540;
|
|
1543 goto LABEL_14;
|
|
1544 case 13:
|
|
1545 a1.uItemType = 555;
|
|
1546 LABEL_14:
|
|
1547 v16 = 0;
|
|
1548 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
1549 goto LABEL_18;
|
|
1550 v7 = (char *)&pObjectList->pObjects->uObjectID;
|
|
1551 break;
|
|
1552 default:
|
|
1553 return result;
|
|
1554 }
|
|
1555 while ( (short)a1.uItemType != *(short *)v7 )
|
|
1556 {
|
|
1557 ++v16;
|
|
1558 v7 += 56;
|
|
1559 if ( v16 >= (signed int)pObjectList->uNumObjects )
|
|
1560 {
|
|
1561 LABEL_18:
|
|
1562 v8 = 0;
|
|
1563 goto LABEL_19;
|
|
1564 }
|
|
1565 }
|
|
1566 v8 = v16;
|
|
1567 LABEL_19:
|
|
1568 a1.uObjectDescID = v8;
|
|
1569 a1.stru_24.Reset();
|
|
1570 a1.vPosition.x = v5->vPosition.x;
|
|
1571 a1.field_48 = 0;
|
|
1572 a1.vPosition.y = v5->vPosition.y;
|
|
1573 a1.field_4C = 0;
|
|
1574 v17 = v5->uActorHeight;
|
|
1575 a1.field_50 = 0;
|
|
1576 v9 = LOWORD(v4->uYawAngle);
|
|
1577 a1.vPosition.z = v5->vPosition.z - (unsigned int)(signed __int64)((double)v17 * -0.75);
|
|
1578 a1.uFacing = v9;
|
|
1579 a1.uSoundID = 0;
|
|
1580 a1.uAttributes = 0;
|
|
1581 v10 = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
|
|
1582 v11 = v4->uDistance;
|
|
1583 a1.uSectorID = v10;
|
|
1584 v12 = 8 * v15;
|
|
1585 LOBYTE(v12) = 8 * v15 | AI_OBJECT_ACTOR;
|
|
1586 a1.uSpriteFrameID = 0;
|
|
1587 a1.field_58 = v12;
|
|
1588 a1.field_5C = 0;
|
|
1589 if ( (double)v11 >= 307.2 )
|
|
1590 {
|
|
1591 if ( v11 >= 1024 )
|
|
1592 {
|
|
1593 a1.field_60_distance_related_prolly_lod = 2;
|
|
1594 if ( v11 >= 2560 )
|
|
1595 a1.field_60_distance_related_prolly_lod = 3;
|
|
1596 }
|
|
1597 else
|
|
1598 {
|
|
1599 a1.field_60_distance_related_prolly_lod = 1;
|
|
1600 }
|
|
1601 }
|
|
1602 else
|
|
1603 {
|
|
1604 a1.field_60_distance_related_prolly_lod = 0;
|
|
1605 }
|
|
1606 a1.field_61 = a4;
|
|
1607 result = a1.Create(
|
|
1608 v4->uYawAngle,
|
|
1609 v4->uPitchAngle,
|
|
1610 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
1611 0);
|
|
1612 if ( v5->pMonsterInfo.uSpecialAbilityType == 1 )
|
|
1613 {
|
|
1614 result = v5->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
|
|
1615 if ( result == 2 )
|
|
1616 {
|
|
1617 a1.vPosition.z += 40;
|
|
1618 v13 = v4->uYawAngle;
|
|
1619 }
|
|
1620 else
|
|
1621 {
|
|
1622 if ( result != 3 )
|
|
1623 return result;
|
|
1624 a1.Create(
|
|
1625 v4->uYawAngle + 30,
|
|
1626 v4->uPitchAngle,
|
|
1627 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
1628 0);
|
|
1629 v13 = v4->uYawAngle - 30;
|
|
1630 }
|
|
1631 result = a1.Create(
|
|
1632 v13,
|
|
1633 v4->uPitchAngle,
|
|
1634 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
|
|
1635 0);
|
|
1636 }
|
|
1637 return result;
|
|
1638 }
|
|
1639
|
|
1640 //----- (00404736) --------------------------------------------------------
|
|
1641 signed int __fastcall Actor::Explode(unsigned int uActorID)
|
|
1642 {
|
|
1643 Actor *v1; // esi@1
|
|
1644 signed int v2; // edx@1
|
|
1645 char *v3; // ecx@2
|
|
1646 unsigned __int16 v4; // ax@5
|
|
1647 int v5; // ebx@6
|
|
1648 int v6; // ecx@6
|
|
1649 int v7; // eax@6
|
|
1650 LayingItem a1; // [sp+Ch] [bp-78h]@1
|
|
1651 unsigned int v10; // [sp+7Ch] [bp-8h]@1
|
|
1652 int v11; // [sp+80h] [bp-4h]@6
|
|
1653
|
|
1654 v10 = uActorID;
|
|
1655 v1 = &pActors[uActorID];
|
|
1656 v2 = 0;
|
|
1657 a1.uItemType = 600;
|
|
1658 if ( (signed int)pObjectList->uNumObjects <= 0 )
|
|
1659 {
|
|
1660 LABEL_5:
|
|
1661 v4 = 0;
|
|
1662 }
|
|
1663 else
|
|
1664 {
|
|
1665 v3 = (char *)&pObjectList->pObjects->uObjectID;
|
|
1666 while ( *(short *)v3 != 600 )
|
|
1667 {
|
|
1668 ++v2;
|
|
1669 v3 += 56;
|
|
1670 if ( v2 >= (signed int)pObjectList->uNumObjects )
|
|
1671 goto LABEL_5;
|
|
1672 }
|
|
1673 v4 = v2;
|
|
1674 }
|
|
1675 a1.uObjectDescID = v4;
|
|
1676 a1.stru_24.Reset();
|
|
1677 a1.vPosition.y = v1->vPosition.y;
|
|
1678 a1.field_48 = 0;
|
|
1679 v5 = v1->vPosition.x;
|
|
1680 v11 = v1->uActorHeight;
|
|
1681 a1.field_4C = 0;
|
|
1682 a1.field_50 = 0;
|
|
1683 a1.vPosition.x = v5;
|
|
1684 v6 = v1->vPosition.z - (unsigned int)(signed __int64)((double)v11 * -0.75);
|
|
1685 a1.uFacing = 0;
|
|
1686 a1.vPosition.z = v6;
|
|
1687 a1.uSoundID = 0;
|
|
1688 a1.uAttributes = 0;
|
|
1689 a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6);
|
|
1690 v7 = 8 * v10;
|
|
1691 LOBYTE(v7) = 8 * v10 | 3;
|
|
1692 a1.uSpriteFrameID = 0;
|
|
1693 a1.field_58 = v7;
|
|
1694 a1.field_5C = 0;
|
|
1695 a1.field_60_distance_related_prolly_lod = 3;
|
|
1696 a1.field_61 = 4;
|
|
1697 return a1.Create(0, 0, 0, 0);
|
|
1698 }
|
|
1699
|
|
1700 //----- (004040E9) --------------------------------------------------------
|
|
1701 // // Get direction vector from object1 to object2,
|
|
1702 // // distance from object1 to object2 and Euler angles of the direction vector
|
|
1703 // //
|
|
1704 // //
|
|
1705 // // object1 & object2 format : objectType | (objectID << 3)
|
|
1706 // // objectType == 2 - LayingItem
|
|
1707 // // objectType == 3 - Actor
|
|
1708 // // objectType == 4 - Party
|
|
1709 // // objectType == 5 - Decoration
|
|
1710 // //
|
|
1711 // // originally this function had following prototype:
|
|
1712 // // struct DirectionInfo GetDirectionInfo(signed int object1, signed int object2, signed int a4)
|
|
1713 // // but compiler converts functions returning structures by value in the such way
|
|
1714 AIDirection *__fastcall Actor::GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, AIDirection *pOut, int a4)
|
|
1715 {
|
|
1716 signed int v4; // eax@1
|
|
1717 unsigned int v5; // ecx@1
|
|
1718 unsigned int v6; // ebx@1
|
|
1719 int v7; // ecx@2
|
|
1720 int v8; // ecx@3
|
|
1721 int v9; // ecx@4
|
|
1722 BLVFace *v10; // eax@8
|
|
1723 unsigned int v11; // ecx@8
|
|
1724 signed int v12; // eax@9
|
|
1725 int v13; // ecx@9
|
|
1726 int v14; // eax@9
|
|
1727 int v15; // eax@11
|
|
1728 int v16; // eax@12
|
|
1729 int v17; // eax@13
|
|
1730 int v18; // edx@15
|
|
1731 signed int v19; // eax@25
|
|
1732 signed int v20; // eax@28
|
|
1733 int v21; // ebx@28
|
|
1734 signed int v22; // eax@28
|
|
1735 BLVFace *v23; // eax@35
|
|
1736 int v24; // edx@35
|
|
1737 unsigned int v25; // ecx@35
|
|
1738 signed int v26; // eax@36
|
|
1739 int v27; // ecx@36
|
|
1740 int v28; // eax@36
|
|
1741 int v29; // eax@37
|
|
1742 signed int v30; // eax@42
|
|
1743 double v31; // st7@45
|
|
1744 double v32; // st6@45
|
|
1745 double v33; // st7@45
|
|
1746 AIDirection *result; // eax@48
|
|
1747 int v35; // [sp-18h] [bp-64h]@17
|
|
1748 int v36; // [sp-14h] [bp-60h]@17
|
|
1749 Vec3_int_ v37; // [sp-10h] [bp-5Ch]@15
|
|
1750 int *v38; // [sp-4h] [bp-50h]@15
|
|
1751 int *v39; // [sp+0h] [bp-4Ch]@15
|
|
1752 int *v40; // [sp+4h] [bp-48h]@15
|
|
1753 AIDirection v41; // [sp+14h] [bp-38h]@46
|
|
1754 float v42; // [sp+30h] [bp-1Ch]@23
|
|
1755 float v43; // [sp+34h] [bp-18h]@45
|
|
1756 float v44; // [sp+38h] [bp-14h]@33
|
|
1757 float v45; // [sp+3Ch] [bp-10h]@33
|
|
1758 int outz; // [sp+40h] [bp-Ch]@6
|
|
1759 int outy; // [sp+44h] [bp-8h]@6
|
|
1760 int outx; // [sp+48h] [bp-4h]@6
|
|
1761 float a4a; // [sp+58h] [bp+Ch]@45
|
|
1762
|
|
1763 v4 = (signed int)uObj1ID >> 3;
|
|
1764 v5 = (uObj1ID & 7) - 2;
|
|
1765 v6 = uObj2ID;
|
|
1766 if ( !v5 )
|
|
1767 {
|
|
1768 v19 = v4;
|
|
1769 outx = pLayingItems[v19].vPosition.x;
|
|
1770 v13 = pLayingItems[v19].vPosition.y;
|
|
1771 v14 = pLayingItems[v19].vPosition.z;
|
|
1772 goto LABEL_26;
|
|
1773 }
|
|
1774 v7 = v5 - 1;
|
|
1775 if ( !v7 )
|
|
1776 {
|
|
1777 outx = pActors[v4].vPosition.x;
|
|
1778 outy = pActors[v4].vPosition.y;
|
|
1779 LODWORD(v42) = pActors[v4].uActorHeight;
|
|
1780 v11 = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)SLODWORD(v42) * -0.75);
|
|
1781 goto LABEL_24;
|
|
1782 }
|
|
1783 v8 = v7 - 1;
|
|
1784 if ( !v8 )
|
|
1785 {
|
|
1786 if ( !v4 )
|
|
1787 {
|
|
1788 outx = pParty->vPosition.x;
|
58
|
1789 outy = pParty->vPosition.y;
|
|
1790 v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
|
0
|
1791 LABEL_27:
|
|
1792 outz = v14;
|
|
1793 goto LABEL_28;
|
|
1794 }
|
|
1795 v15 = v4 - 1;
|
|
1796 if ( v15 )
|
|
1797 {
|
|
1798 v16 = v15 - 1;
|
|
1799 if ( v16 )
|
|
1800 {
|
|
1801 v17 = v16 - 1;
|
|
1802 if ( v17 )
|
|
1803 {
|
|
1804 if ( v17 != 1 )
|
|
1805 goto LABEL_28;
|
|
1806 v40 = &outz;
|
|
1807 v39 = &outy;
|
|
1808 v38 = &outx;
|
|
1809 v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
|
58
|
1810 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
|
0
|
1811 goto LABEL_20;
|
|
1812 }
|
|
1813 v40 = &outz;
|
|
1814 v39 = &outy;
|
|
1815 v38 = &outx;
|
|
1816 v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
|
58
|
1817 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
|
0
|
1818 }
|
|
1819 else
|
|
1820 {
|
|
1821 v40 = &outz;
|
|
1822 v39 = &outy;
|
|
1823 v38 = &outx;
|
58
|
1824 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
|
0
|
1825 v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
|
|
1826 }
|
|
1827 *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x;
|
|
1828 v36 = 0;
|
|
1829 v35 = 8;
|
|
1830 LABEL_21:
|
|
1831 Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
|
|
1832 goto LABEL_28;
|
|
1833 }
|
|
1834 v40 = &outz;
|
|
1835 v39 = &outy;
|
|
1836 v38 = &outx;
|
58
|
1837 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
|
0
|
1838 v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
|
|
1839 LABEL_20:
|
|
1840 *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x;
|
|
1841 v36 = 0;
|
|
1842 v35 = 24;
|
|
1843 goto LABEL_21;
|
|
1844 }
|
|
1845 v9 = v8 - 1;
|
|
1846 if ( !v9 )
|
|
1847 {
|
|
1848 v12 = v4;
|
|
1849 outx = pLevelDecorations[v12].vPosition.x;
|
|
1850 v13 = pLevelDecorations[v12].vPosition.y;
|
|
1851 v14 = pLevelDecorations[v12].vPosition.z;
|
|
1852 LABEL_26:
|
|
1853 outy = v13;
|
|
1854 goto LABEL_27;
|
|
1855 }
|
|
1856 if ( v9 != 1 )
|
|
1857 {
|
|
1858 outz = 0;
|
|
1859 outy = 0;
|
|
1860 outx = 0;
|
|
1861 goto LABEL_28;
|
|
1862 }
|
|
1863 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
1864 {
|
|
1865 v10 = &pIndoor->pFaces[v4];
|
|
1866 outx = (v10->pBounding.x1 + v10->pBounding.x2) >> 1;
|
|
1867 outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1;
|
|
1868 v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1;
|
|
1869 LABEL_24:
|
|
1870 outz = v11;
|
|
1871 }
|
|
1872 LABEL_28:
|
|
1873 v20 = v6;
|
|
1874 v21 = v6 & 7;
|
|
1875 v22 = v20 >> 3;
|
|
1876 if ( v21 == 2 )
|
|
1877 {
|
|
1878 v30 = v22;
|
|
1879 LODWORD(v45) = pLayingItems[v30].vPosition.x;
|
|
1880 v27 = pLayingItems[v30].vPosition.y;
|
|
1881 v28 = pLayingItems[v30].vPosition.z;
|
|
1882 goto LABEL_43;
|
|
1883 }
|
|
1884 if ( v21 == 3 )
|
|
1885 {
|
|
1886 LODWORD(v45) = pActors[v22].vPosition.x;
|
|
1887 LODWORD(v44) = pActors[v22].vPosition.y;
|
|
1888 v25 = pActors[v22].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v22].uActorHeight * -0.75);
|
|
1889 goto LABEL_41;
|
|
1890 }
|
|
1891 if ( v21 == 4 )
|
|
1892 {
|
|
1893 LODWORD(v45) = pParty->vPosition.x;
|
58
|
1894 LODWORD(v44) = pParty->vPosition.y;
|
0
|
1895 v29 = a4;
|
|
1896 if ( !a4 )
|
|
1897 v29 = pParty->sEyelevel;
|
58
|
1898 v28 = pParty->vPosition.z + v29;
|
0
|
1899 goto LABEL_44;
|
|
1900 }
|
|
1901 if ( v21 == 5 )
|
|
1902 {
|
|
1903 v26 = v22;
|
|
1904 LODWORD(v45) = pLevelDecorations[v26].vPosition.x;
|
|
1905 v27 = pLevelDecorations[v26].vPosition.y;
|
|
1906 v28 = pLevelDecorations[v26].vPosition.z;
|
|
1907 LABEL_43:
|
|
1908 LODWORD(v44) = v27;
|
|
1909 LABEL_44:
|
|
1910 a4 = v28;
|
|
1911 goto LABEL_45;
|
|
1912 }
|
|
1913 if ( v21 != 6 )
|
|
1914 {
|
|
1915 a4 = 0;
|
|
1916 v44 = 0.0;
|
|
1917 v45 = 0.0;
|
|
1918 goto LABEL_45;
|
|
1919 }
|
|
1920 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
1921 {
|
|
1922 v23 = &pIndoor->pFaces[v22];
|
|
1923 v24 = v23->pBounding.y1;
|
|
1924 LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1;
|
|
1925 LODWORD(v44) = (v24 + v23->pBounding.y2) >> 1;
|
|
1926 v25 = (v23->pBounding.z1 + v23->pBounding.z2) >> 1;
|
|
1927 LABEL_41:
|
|
1928 a4 = v25;
|
|
1929 }
|
|
1930 LABEL_45:
|
|
1931 v31 = (double)SLODWORD(v45) - (double)outx;
|
|
1932 v42 = v31;
|
|
1933 v32 = (double)SLODWORD(v44) - (double)outy;
|
|
1934 v43 = v32;
|
|
1935 a4a = (double)a4 - (double)outz;
|
|
1936 v45 = v32 * v32;
|
|
1937 v44 = v31 * v31;
|
|
1938 v33 = sqrt(a4a * a4a + v44 + v45);
|
|
1939 if ( v33 <= 1.0 )
|
|
1940 {
|
|
1941 v41.vDirection.x = 65536;
|
|
1942 v41.vDirection.y = 0;
|
|
1943 v41.vDirection.z = 0;
|
|
1944 v41.uDistance = 1;
|
|
1945 v41.uDistanceXZ = 1;
|
|
1946 v41.uYawAngle = 0;
|
|
1947 v41.uPitchAngle = 0;
|
|
1948 }
|
|
1949 else
|
|
1950 {
|
|
1951 v41.vDirection.x = (signed __int64)(1.0 / v33 * v42 * 65536.0);
|
|
1952 v41.vDirection.y = (signed __int64)(1.0 / v33 * v43 * 65536.0);
|
|
1953 v41.vDirection.z = (signed __int64)(1.0 / v33 * a4a * 65536.0);
|
|
1954 v41.uDistance = (signed __int64)v33;
|
|
1955 v41.uDistanceXZ = (signed __int64)sqrt(v44 + v45);
|
|
1956 v41.uYawAngle = stru_5C6E00->Atan2((signed __int64)v42, (signed __int64)v43);
|
|
1957 v41.uPitchAngle = stru_5C6E00->Atan2(v41.uDistanceXZ, (signed __int64)a4a);
|
|
1958 }
|
|
1959 result = pOut;
|
|
1960 memcpy(pOut, &v41, 0x1Cu);
|
|
1961 return result;
|
|
1962 }
|
|
1963
|
|
1964
|
|
1965 //----- (00404030) --------------------------------------------------------
|
|
1966 unsigned int __fastcall Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4)
|
|
1967 {
|
|
1968 unsigned int v4; // edi@1
|
|
1969 unsigned int v5; // esi@1
|
|
1970 unsigned int result; // eax@2
|
|
1971 AIDirection *v7; // eax@3
|
|
1972 unsigned int v8; // ecx@3
|
|
1973 Actor *v9; // ebx@3
|
|
1974 AIDirection *v10; // esi@4
|
|
1975 unsigned __int16 v11; // ax@5
|
|
1976 AIDirection a3; // [sp+8h] [bp-38h]@4
|
|
1977 AIDirection v13; // [sp+24h] [bp-1Ch]@4
|
|
1978
|
|
1979 v4 = uObjID;
|
|
1980 v5 = uActorID;
|
|
1981 if ( rand() % 100 >= 5 )
|
|
1982 {
|
|
1983 v7 = a4;
|
|
1984 v8 = 0;
|
|
1985 v9 = &pActors[v5];
|
|
1986 if ( !a4 )
|
|
1987 {
|
|
1988 v10 = Actor::GetDirectionInfo(8 * v5 | AI_OBJECT_ACTOR, v4, &a3, 0);
|
|
1989 v7 = &v13;
|
|
1990 memcpy(&v13, v10, sizeof(v13));
|
|
1991 v8 = 0;
|
|
1992 }
|
|
1993 v9->uYawAngle = LOWORD(v7->uYawAngle);
|
|
1994 v11 = LOWORD(v7->uPitchAngle);
|
|
1995 v9->uCurrentActionTime = v8;
|
|
1996 v9->vVelocity.z = v8;
|
|
1997 v9->vVelocity.y = v8;
|
|
1998 v9->vVelocity.x = v8;
|
|
1999 v9->uPitchAngle = v11;
|
|
2000 v9->uCurrentActionLength = 256;
|
|
2001 v9->uAIState = Interacting;
|
|
2002 result = v9->UpdateAnimation();
|
|
2003 }
|
|
2004 else
|
|
2005 {
|
|
2006 result = Actor::_402F87(v5, v4, a4);
|
|
2007 }
|
|
2008 return result;
|
|
2009 }
|
|
2010
|
|
2011 //----- (00403F58) --------------------------------------------------------
|
|
2012 unsigned int __fastcall Actor::_403F58(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4)
|
|
2013 {
|
|
2014 unsigned int v4; // esi@1
|
|
2015 unsigned int result; // eax@2
|
|
2016 AIDirection *v6; // eax@3
|
|
2017 unsigned int v7; // edi@3
|
|
2018 Actor *v8; // ebx@3
|
|
2019 AIDirection *v9; // esi@4
|
|
2020 AIDirection a3; // [sp+4h] [bp-3Ch]@4
|
|
2021 AIDirection v11; // [sp+20h] [bp-20h]@4
|
|
2022 signed int a2; // [sp+3Ch] [bp-4h]@1
|
|
2023
|
|
2024 a2 = uObjID;
|
|
2025 v4 = uActorID;
|
|
2026 if ( rand() % 2 )
|
|
2027 {
|
|
2028 result = Actor::_402F87(v4, a2, a4);
|
|
2029 }
|
|
2030 else
|
|
2031 {
|
|
2032 v6 = a4;
|
|
2033 v7 = 0;
|
|
2034 v8 = &pActors[v4];
|
|
2035 if ( !a4 )
|
|
2036 {
|
|
2037 v9 = Actor::GetDirectionInfo(8 * v4 | 3, a2, &a3, 0);
|
|
2038 v6 = &v11;
|
|
2039 memcpy(&v11, v9, sizeof(v11));
|
|
2040 v7 = 0;
|
|
2041 }
|
|
2042 v8->uYawAngle = LOWORD(v6->uYawAngle);
|
|
2043 v8->uPitchAngle = LOWORD(v6->uPitchAngle);
|
|
2044 if ( uActionLength == v7 )
|
|
2045 v8->uCurrentActionLength = rand() % 256 + 256;
|
|
2046 else
|
|
2047 v8->uCurrentActionLength = uActionLength;
|
|
2048 v8->uCurrentActionTime = v7;
|
45
|
2049 v8->uAIState = Standing;
|
0
|
2050 v8->vVelocity.z = v7;
|
|
2051 v8->vVelocity.y = v7;
|
|
2052 v8->vVelocity.x = v7;
|
|
2053 result = v8->UpdateAnimation();
|
|
2054 }
|
|
2055 return result;
|
|
2056 }
|
|
2057
|
|
2058
|
|
2059
|
|
2060 //----- (00403EB6) --------------------------------------------------------
|
|
2061 unsigned int __fastcall Actor::_403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, AIDirection *a4)
|
|
2062 {
|
|
2063 AIDirection *v4; // eax@1
|
|
2064 unsigned int v5; // esi@1
|
|
2065 Actor *v6; // ebx@1
|
|
2066 AIDirection *v7; // esi@2
|
|
2067 AIDirection a3; // [sp+Ch] [bp-38h]@2
|
|
2068 AIDirection v10; // [sp+28h] [bp-1Ch]@2
|
|
2069
|
|
2070 v4 = a4;
|
|
2071 v5 = 0;
|
|
2072 v6 = &pActors[uActorID];
|
|
2073 if ( !a4 )
|
|
2074 {
|
|
2075 v7 = Actor::GetDirectionInfo(8 * uActorID | 3, a2, &a3, 0);
|
|
2076 v4 = &v10;
|
|
2077 memcpy(&v10, v7, sizeof(v10));
|
|
2078 v5 = 0;
|
|
2079 }
|
|
2080 v6->uYawAngle = LOWORD(v4->uYawAngle);
|
|
2081 if ( uActionLength == v5 )
|
|
2082 v6->uCurrentActionLength = rand() % 256 + 256;
|
|
2083 else
|
|
2084 v6->uCurrentActionLength = uActionLength;
|
|
2085 v6->uCurrentActionTime = v5;
|
45
|
2086 v6->uAIState = Standing;
|
0
|
2087 v6->vVelocity.z = v5;
|
|
2088 v6->vVelocity.y = v5;
|
|
2089 v6->vVelocity.x = v5;
|
|
2090 return v6->UpdateAnimation();
|
|
2091 }
|
|
2092
|
|
2093
|
|
2094 //----- (00403E61) --------------------------------------------------------
|
|
2095 void __fastcall Actor::StandAwhile(unsigned int uActorID)
|
|
2096 {
|
|
2097 Actor *v1; // esi@1
|
|
2098
|
|
2099 v1 = &pActors[uActorID];
|
|
2100 v1->uCurrentActionLength = rand() % 128 + 128;
|
|
2101 v1->uCurrentActionTime = 0;
|
45
|
2102 v1->uAIState = Standing;
|
0
|
2103 v1->vVelocity.z = 0;
|
|
2104 v1->vVelocity.y = 0;
|
|
2105 v1->vVelocity.x = 0;
|
|
2106 v1->UpdateAnimation();
|
|
2107 }
|
|
2108
|
|
2109 //----- (00403C6C) --------------------------------------------------------
|
|
2110 unsigned int __fastcall Actor::_403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0)
|
|
2111 {
|
|
2112 Actor *v3; // ebx@1
|
|
2113 char v4; // zf@1
|
|
2114 unsigned int result; // eax@3
|
|
2115 AIDirection *v6; // esi@6
|
|
2116 AIDirection *v7; // edi@6
|
|
2117 signed int v8; // eax@7
|
|
2118 double v9; // st7@9
|
|
2119 Vec3_int_ v10; // ST04_12@9
|
|
2120 int v11; // eax@10
|
|
2121 AIDirection *v12; // eax@11
|
|
2122 unsigned int v13; // esi@11
|
|
2123 AIDirection *v14; // esi@12
|
|
2124 SpriteFrame *v15; // ecx@13
|
|
2125 __int16 v16; // ax@13
|
|
2126 unsigned int v17; // ecx@13
|
|
2127 signed __int64 v18; // qax@13
|
|
2128 AIDirection a3; // [sp+Ch] [bp-48h]@12
|
|
2129 AIDirection v20; // [sp+28h] [bp-2Ch]@12
|
|
2130 unsigned int v21; // [sp+44h] [bp-10h]@9
|
|
2131 signed int a2; // [sp+48h] [bp-Ch]@1
|
|
2132 int v23; // [sp+4Ch] [bp-8h]@6
|
|
2133 unsigned int v24; // [sp+50h] [bp-4h]@1
|
|
2134 unsigned int v25; // [sp+5Ch] [bp+8h]@13
|
|
2135
|
|
2136 v3 = &pActors[uActorID];
|
|
2137 a2 = edx0;
|
|
2138 v4 = v3->pMonsterInfo.uMovementType == 5;
|
|
2139 v24 = uActorID;
|
|
2140 if ( v4 && v3->pMonsterInfo.uAIType == 1 )
|
|
2141 {
|
|
2142 result = Actor::_403EB6(uActorID, edx0, 0, arg0);
|
|
2143 }
|
|
2144 else
|
|
2145 {
|
|
2146 if ( (edx0 & 7) == 3 )
|
|
2147 {
|
|
2148 v8 = edx0 >> 3;
|
|
2149 v6 = (AIDirection *)pActors[v8].vPosition.x;
|
|
2150 v7 = (AIDirection *)pActors[v8].vPosition.y;
|
|
2151 v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z);
|
|
2152 }
|
|
2153 else
|
|
2154 {
|
|
2155 if ( (edx0 & 7) == 4 )
|
|
2156 {
|
|
2157 v6 = (AIDirection *)pParty->vPosition.x;
|
58
|
2158 v7 = (AIDirection *)pParty->vPosition.y;
|
|
2159 v23 = pParty->vPosition.z + pParty->sEyelevel;
|
0
|
2160 }
|
|
2161 else
|
|
2162 {
|
|
2163 v6 = arg0;
|
|
2164 v7 = arg0;
|
|
2165 }
|
|
2166 }
|
|
2167 v21 = v3->uActorHeight;
|
|
2168 v9 = (double)(signed int)v21 * 0.75;
|
|
2169 v21 = v3->vPosition.z;
|
|
2170 v10.z = (signed __int64)(v9 + (double)(signed int)v21);
|
|
2171 v10.y = v3->vPosition.y;
|
|
2172 v10.x = v3->vPosition.x;
|
|
2173 if ( sub_407A1C((int)v6, (int)v7, v23, v10) )
|
|
2174 {
|
|
2175 v12 = arg0;
|
|
2176 v13 = 0;
|
|
2177 if ( !arg0 )
|
|
2178 {
|
|
2179 v14 = Actor::GetDirectionInfo(8 * v24 | 3, a2, &a3, 0);
|
|
2180 v12 = &v20;
|
|
2181 memcpy(&v20, v14, sizeof(v20));
|
|
2182 v13 = 0;
|
|
2183 }
|
|
2184 v15 = pSpriteFrameTable->pSpriteSFrames;
|
|
2185 v3->uYawAngle = LOWORD(v12->uYawAngle);
|
|
2186 v16 = v15[v3->pSpriteIDs[2]].uAnimLength;
|
|
2187 v17 = v24;
|
|
2188 v3->uCurrentActionLength = 8 * v16;
|
|
2189 v3->uCurrentActionTime = v13;
|
45
|
2190 v3->uAIState = AttackingMelee;
|
0
|
2191 Actor::PlaySound(v17, 0);
|
|
2192 LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2193 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2194 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13
|
|
2195 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) )
|
|
2196 {
|
|
2197 LODWORD(v18) = 2 * v18;
|
|
2198 v25 = v18;
|
|
2199 }
|
|
2200 if ( pParty->bTurnBasedModeOn != 1 )
|
|
2201 v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333);
|
|
2202 v3->pMonsterInfo.uRecoveryTime = v18;
|
|
2203 v3->vVelocity.z = v13;
|
|
2204 v3->vVelocity.y = v13;
|
|
2205 v3->vVelocity.x = v13;
|
|
2206 result = v3->UpdateAnimation();
|
|
2207 }
|
|
2208 else
|
|
2209 {
|
|
2210 v11 = rand();
|
|
2211 result = Actor::_402AD7(v24, a2, v11 % 2, 64, arg0);
|
|
2212 }
|
|
2213 }
|
|
2214 return result;
|
|
2215 }
|
|
2216
|
|
2217
|
|
2218 //----- (00438CF3) --------------------------------------------------------
|
|
2219 void Actor::_438CF3(unsigned int uActorID)
|
|
2220 {
|
|
2221 unsigned int v1; // esi@1
|
|
2222 unsigned int v2; // edi@2
|
|
2223 char v3; // bl@3
|
|
2224 char *v4; // ecx@16
|
|
2225 signed int v5; // eax@18
|
|
2226 Player **ppPlayers; // esi@20
|
|
2227
|
|
2228 v1 = uLevelMapStatsID;
|
|
2229 if ( !uLevelMapStatsID || (v2 = uActorID, !pActors[uActorID]._438B9B()) )
|
|
2230 return;
|
|
2231 v3 = 1;
|
|
2232 if ( v1 != 5 )
|
|
2233 {
|
|
2234 if ( v1 == 6 || v1 == 7 )
|
|
2235 {
|
|
2236 _449B57_test_bit(pParty->_award_bits, 99);
|
|
2237 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 100) )
|
|
2238 return;
|
|
2239 goto LABEL_12;
|
|
2240 }
|
|
2241 if ( v1 != 8 )
|
|
2242 goto LABEL_12;
|
|
2243 }
|
|
2244 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 99) )
|
|
2245 v3 = 0;
|
|
2246 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 100) )
|
|
2247 v3 = 1;
|
|
2248 if ( v3 )
|
|
2249 {
|
|
2250 LABEL_12:
|
|
2251 pParty->uFine += 100
|
|
2252 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm
|
|
2253 + pActors[v2].pMonsterInfo.uLevel
|
|
2254 + GetPartyReputation());
|
|
2255 if ( pParty->uFine < 0 )
|
|
2256 pParty->uFine = 0;
|
|
2257 if ( pParty->uFine > 4000000 )
|
|
2258 pParty->uFine = 4000000;
|
|
2259 v4 = (char *)&pOutdoor->ddm;
|
|
2260 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
2261 v4 = (char *)&pIndoor->dlv;
|
|
2262 v5 = *((int *)v4 + 2);
|
|
2263 if ( v5 < 10000 )
|
|
2264 *((int *)v4 + 2) = v5 + 1;
|
|
2265 ppPlayers = &pPlayers[1];
|
|
2266 do
|
|
2267 {
|
|
2268 if ( pParty->uFine )
|
|
2269 {
|
|
2270 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->field_152, 1) )
|
26
|
2271 _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->field_152, 1, 1u);
|
0
|
2272 }
|
|
2273 ++ppPlayers;
|
|
2274 }
|
|
2275 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] );
|
|
2276 }
|
|
2277 }
|
|
2278
|
|
2279
|
|
2280 //----- (0043AE80) --------------------------------------------------------
|
|
2281 int Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3)
|
|
2282 {
|
|
2283 int result; // eax@1
|
|
2284 unsigned int v4; // esi@1
|
|
2285 int v5; // [sp-14h] [bp-18h]@3
|
|
2286 unsigned int v6; // [sp-10h] [bp-14h]@3
|
|
2287 int v7; // [sp-Ch] [bp-10h]@3
|
|
2288 int v8; // [sp-8h] [bp-Ch]@3
|
|
2289 __int16 v9; // [sp-4h] [bp-8h]@3
|
|
2290
|
|
2291 result = a2 - 1;
|
|
2292 v4 = 8 * uActorID | 3;
|
|
2293 switch ( a2 )
|
|
2294 {
|
|
2295 case 1:
|
|
2296 if ( a3 )
|
|
2297 {
|
|
2298 v9 = 0;
|
|
2299 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0);
|
|
2300 v7 = 0;
|
|
2301 LOWORD(v6) = v4;
|
|
2302 v5 = 904;
|
|
2303 goto LABEL_16;
|
|
2304 }
|
|
2305 return result;
|
|
2306 case 2:
|
|
2307 if ( a3 )
|
|
2308 {
|
|
2309 v9 = 0;
|
|
2310 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0);
|
|
2311 v7 = 0;
|
|
2312 LOWORD(v6) = v4;
|
|
2313 v5 = 905;
|
|
2314 goto LABEL_16;
|
|
2315 }
|
|
2316 return result;
|
|
2317 case 3:
|
|
2318 if ( a3 )
|
|
2319 {
|
|
2320 v9 = 0;
|
|
2321 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0);
|
|
2322 v7 = 0;
|
|
2323 LOWORD(v6) = v4;
|
|
2324 v5 = 906;
|
|
2325 goto LABEL_16;
|
|
2326 }
|
|
2327 return result;
|
|
2328 case 4:
|
|
2329 if ( a3 )
|
|
2330 {
|
|
2331 v9 = 0;
|
|
2332 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0);
|
|
2333 v7 = 0;
|
|
2334 LOWORD(v6) = v4;
|
|
2335 v5 = 907;
|
|
2336 goto LABEL_16;
|
|
2337 }
|
|
2338 return result;
|
|
2339 case 5:
|
|
2340 v9 = 4;
|
|
2341 v8 = 65536;
|
|
2342 v7 = 0;
|
|
2343 v6 = 8 * uActorID | 3;
|
|
2344 v5 = 901;
|
|
2345 goto LABEL_16;
|
|
2346 case 6:
|
|
2347 v9 = 4;
|
|
2348 v8 = 65536;
|
|
2349 v7 = 0;
|
|
2350 v6 = 8 * uActorID | 3;
|
|
2351 v5 = 902;
|
|
2352 goto LABEL_16;
|
|
2353 case 7:
|
|
2354 v9 = 4;
|
|
2355 v8 = 65536;
|
|
2356 v7 = 0;
|
|
2357 v6 = 8 * uActorID | 3;
|
|
2358 v5 = 903;
|
|
2359 goto LABEL_16;
|
|
2360 case 8:
|
|
2361 v9 = 4;
|
|
2362 v8 = 65536;
|
|
2363 v7 = 0;
|
|
2364 v6 = 8 * uActorID | 3;
|
|
2365 v5 = 900;
|
|
2366 goto LABEL_16;
|
|
2367 case 9:
|
|
2368 v9 = 4;
|
|
2369 v8 = 65536;
|
|
2370 v7 = 0;
|
|
2371 v6 = 8 * uActorID | 3;
|
|
2372 v5 = 909;
|
|
2373 goto LABEL_16;
|
|
2374 case 10:
|
|
2375 v9 = 4;
|
|
2376 v8 = 65536;
|
|
2377 v7 = 0;
|
|
2378 v6 = 8 * uActorID | 3;
|
|
2379 v5 = 908;
|
|
2380 LABEL_16:
|
|
2381 result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9);
|
|
2382 break;
|
|
2383 default:
|
|
2384 return result;
|
|
2385 }
|
|
2386 return result;
|
|
2387 }
|
|
2388
|
|
2389
|
|
2390 //----- (0043B3E0) --------------------------------------------------------
|
|
2391 int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2)
|
|
2392 {
|
|
2393 signed int v2; // ebp@1
|
|
2394 int v3; // eax@9
|
|
2395 signed int v4; // edi@9
|
|
2396 int v5; // esi@9
|
|
2397 int v6; // ebx@11
|
|
2398 unsigned __int16 v8; // si@21
|
|
2399 int v9; // edi@21
|
|
2400 signed int v10; // eax@23
|
|
2401 int v11; // [sp+10h] [bp-4h]@1
|
|
2402
|
|
2403 v2 = 0;
|
|
2404 v11 = 0;
|
|
2405 if ( a2 )
|
|
2406 {
|
|
2407 if ( a2 == 1 )
|
|
2408 {
|
|
2409 v3 = a1->pMonsterInfo.uAttack2DamageDiceRolls;
|
|
2410 v4 = a1->pMonsterInfo.uAttack2DamageDiceSides;
|
|
2411 v5 = a1->pMonsterInfo.uAttack2DamageBonus;
|
|
2412 }
|
|
2413 else
|
|
2414 {
|
|
2415 if ( a2 <= 1 )
|
|
2416 return 0;
|
|
2417 if ( a2 <= 3 )
|
|
2418 {
|
|
2419 if ( a2 == 2 )
|
|
2420 {
|
|
2421 v8 = a1->pMonsterInfo.uSpellSkillAndMastery1;
|
|
2422 v9 = a1->pMonsterInfo.uSpell1ID;
|
|
2423 }
|
|
2424 else
|
|
2425 {
|
|
2426 v8 = a1->pMonsterInfo.uSpellSkillAndMastery2;
|
|
2427 v9 = a1->pMonsterInfo.uSpell2ID;
|
|
2428 }
|
|
2429 v10 = SkillToMastery(v8);
|
|
2430 return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0);
|
|
2431 }
|
|
2432 if ( a2 != 4 )
|
|
2433 return 0;
|
|
2434 v3 = a1->pMonsterInfo.uSpecialAbilityDamageDiceRolls;
|
|
2435 v4 = a1->pMonsterInfo.uSpecialAbilityDamageDiceSides;
|
|
2436 v5 = a1->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
|
|
2437 }
|
|
2438 }
|
|
2439 else
|
|
2440 {
|
|
2441 if ( (signed __int64)a1->pActorBuffs[14].uExpireTime > 0 )
|
|
2442 v2 = a1->pActorBuffs[14].uPower;
|
|
2443 if ( (signed __int64)a1->pActorBuffs[18].uExpireTime > 0 && a1->pActorBuffs[18].uPower > v2 )
|
|
2444 v2 = a1->pActorBuffs[18].uPower;
|
|
2445 if ( (signed __int64)a1->pActorBuffs[21].uExpireTime > 0 )
|
|
2446 v2 += a1->pActorBuffs[21].uPower;
|
|
2447 v3 = a1->pMonsterInfo.uAttack1DamageDiceRolls;
|
|
2448 v4 = a1->pMonsterInfo.uAttack1DamageDiceSides;
|
|
2449 v5 = a1->pMonsterInfo.uAttack1DamageBonus;
|
|
2450 }
|
|
2451 if ( v3 > 0 )
|
|
2452 {
|
|
2453 v6 = v3;
|
|
2454 do
|
|
2455 {
|
|
2456 --v6;
|
|
2457 v11 += rand() % v4 + 1;
|
|
2458 }
|
|
2459 while ( v6 );
|
|
2460 }
|
|
2461 return v11 + v5 + v2;
|
|
2462 }
|
|
2463
|
|
2464 //----- (00438B9B) --------------------------------------------------------
|
|
2465 char Actor::_438B9B()
|
|
2466 {
|
|
2467 unsigned int v1; // eax@1
|
|
2468
|
|
2469 v1 = this->uAlly;
|
|
2470 if ( !v1 )
|
|
2471 v1 = (this->pMonsterInfo.uID - 1) / 3 + 1;
|
|
2472 return (signed int)v1 >= 39 && (signed int)v1 <= 44
|
|
2473 || (signed int)v1 >= 45 && (signed int)v1 <= 50
|
|
2474 || (signed int)v1 >= 51 && (signed int)v1 <= 62
|
|
2475 || (signed int)v1 >= 78 && (signed int)v1 <= 83;
|
|
2476 }
|
|
2477
|
|
2478 //----- (0042EBEE) --------------------------------------------------------
|
|
2479 bool Actor::StealFrom(unsigned int uActorID)
|
|
2480 {
|
|
2481 unsigned int v1; // esi@1
|
|
2482 Player *pPlayer; // edi@1
|
|
2483 bool result; // eax@1
|
|
2484 int v4; // ebx@2
|
|
2485 unsigned int v5; // eax@2
|
|
2486 DDM_DLV_Header *v6; // esi@4
|
|
2487 unsigned int v7; // [sp+8h] [bp-4h]@1
|
|
2488 int v8; // [sp+8h] [bp-4h]@6
|
|
2489
|
|
2490 v1 = uActiveCharacter;
|
|
2491 v7 = uActorID;
|
|
2492 pPlayer = (Player *)&stru_AA1058[3].pSounds[6972 * uActiveCharacter + 40552];
|
|
2493 result = pPlayer->CanAct();
|
|
2494 if ( result )
|
|
2495 {
|
|
2496 pStru277->_427D48(v1);
|
|
2497 v4 = 0;
|
|
2498 v5 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
2499 if ( v5 )
|
|
2500 v4 = pMapStats->pInfos[v5]._steal_perm;
|
|
2501 v6 = &pOutdoor->ddm;
|
|
2502 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
|
|
2503 v6 = &pIndoor->dlv;
|
|
2504 pPlayer->StealFromActor(v7, v4, v6->uReputation++);
|
|
2505 v8 = pPlayer->GetAttackRecoveryTime(0);
|
|
2506 if ( v8 < 30 )
|
|
2507 v8 = 30;
|
|
2508 if ( !pParty->bTurnBasedModeOn )
|
|
2509 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v8 * 2.133333333333333));
|
|
2510 pTurnEngine->_40471C();
|
|
2511 result = 1;
|
|
2512 }
|
|
2513 return result;
|
|
2514 }
|
|
2515
|
|
2516
|
|
2517 //----- (00403A60) --------------------------------------------------------
|
|
2518 unsigned int __fastcall Actor::_403A60(unsigned int uActorID, signed int edx0, AIDirection *pDir)
|
|
2519 {
|
|
2520 Actor *v3; // ebx@1
|
|
2521 AIDirection *v4; // esi@3
|
|
2522 AIDirection *v5; // edi@3
|
|
2523 signed int v6; // eax@4
|
|
2524 Vec3_int_ v7; // ST04_12@6
|
|
2525 unsigned int result; // eax@7
|
|
2526 AIDirection *v9; // eax@8
|
|
2527 unsigned int v10; // esi@8
|
|
2528 AIDirection *v11; // esi@9
|
|
2529 SpriteFrame *v12; // ecx@10
|
|
2530 __int16 v13; // ax@10
|
|
2531 unsigned int v14; // ecx@10
|
|
2532 unsigned int v15; // eax@10
|
|
2533 signed int v16; // ecx@17
|
|
2534 AIDirection a3; // [sp+Ch] [bp-48h]@9
|
|
2535 AIDirection v18; // [sp+28h] [bp-2Ch]@9
|
|
2536 int v19; // [sp+44h] [bp-10h]@6
|
|
2537 signed int a2; // [sp+48h] [bp-Ch]@1
|
|
2538 int v21; // [sp+4Ch] [bp-8h]@3
|
|
2539 unsigned int v22; // [sp+50h] [bp-4h]@1
|
|
2540 unsigned int pDira; // [sp+5Ch] [bp+8h]@10
|
|
2541
|
|
2542 v22 = uActorID;
|
|
2543 v3 = &pActors[uActorID];
|
|
2544 a2 = edx0;
|
|
2545 if ( (edx0 & 7) == 3 )
|
|
2546 {
|
|
2547 v6 = edx0 >> 3;
|
|
2548 v4 = (AIDirection *)pActors[v6].vPosition.x;
|
|
2549 v5 = (AIDirection *)pActors[v6].vPosition.y;
|
|
2550 v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z);
|
|
2551 }
|
|
2552 else
|
|
2553 {
|
|
2554 if ( (edx0 & 7) == 4 )
|
|
2555 {
|
|
2556 v4 = (AIDirection *)pParty->vPosition.x;
|
58
|
2557 v5 = (AIDirection *)pParty->vPosition.y;
|
|
2558 v21 = pParty->vPosition.z + pParty->sEyelevel;
|
0
|
2559 }
|
|
2560 else
|
|
2561 {
|
|
2562 v4 = pDir;
|
|
2563 v5 = pDir;
|
|
2564 }
|
|
2565 }
|
|
2566 v19 = v3->uActorHeight;
|
|
2567 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75);
|
|
2568 v7.y = v3->vPosition.y;
|
|
2569 v7.x = v3->vPosition.x;
|
|
2570 if ( sub_407A1C((int)v4, (int)v5, v21, v7) )
|
|
2571 {
|
|
2572 v9 = pDir;
|
|
2573 v10 = 0;
|
|
2574 if ( !pDir )
|
|
2575 {
|
|
2576 v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0);
|
|
2577 v9 = &v18;
|
|
2578 memcpy(&v18, v11, sizeof(v18));
|
|
2579 v10 = 0;
|
|
2580 }
|
|
2581 v12 = pSpriteFrameTable->pSpriteSFrames;
|
|
2582 v3->uYawAngle = LOWORD(v9->uYawAngle);
|
|
2583 v13 = v12[v3->pSpriteIDs[3]].uAnimLength;
|
|
2584 v14 = v22;
|
|
2585 v3->uCurrentActionLength = 8 * v13;
|
|
2586 v3->uCurrentActionTime = v10;
|
45
|
2587 v3->uAIState = AttackingRanged4;
|
0
|
2588 Actor::PlaySound(v14, 0);
|
|
2589 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2590 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2591 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10
|
|
2592 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) )
|
|
2593 {
|
|
2594 v15 *= 2;
|
|
2595 pDira = v15;
|
|
2596 }
|
|
2597 if ( pParty->bTurnBasedModeOn == 1 )
|
|
2598 v3->pMonsterInfo.uRecoveryTime = v15;
|
|
2599 else
|
|
2600 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength
|
|
2601 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2
|
|
2602 * (double)(signed int)pDira
|
|
2603 * -2.133333333333333);
|
|
2604 v16 = v3->pMonsterInfo.uSpell2ID;
|
|
2605 v3->vVelocity.z = v10;
|
|
2606 v3->vVelocity.y = v10;
|
|
2607 v3->vVelocity.x = v10;
|
|
2608 if ( sub_42FB5C(v16) )
|
|
2609 {
|
|
2610 v3->uCurrentActionLength = 64;
|
|
2611 v3->uCurrentActionTime = v10;
|
45
|
2612 v3->uAIState = Fidgeting;
|
0
|
2613 result = v3->UpdateAnimation();
|
45
|
2614 v3->uAIState = AttackingRanged4;
|
0
|
2615 }
|
|
2616 else
|
|
2617 {
|
|
2618 result = v3->UpdateAnimation();
|
|
2619 }
|
|
2620 }
|
|
2621 else
|
|
2622 {
|
|
2623 result = Actor::_402AD7(v22, a2, v22, 64, pDir);
|
|
2624 }
|
|
2625 return result;
|
|
2626 }
|
|
2627
|
|
2628
|
|
2629 //----- (00403854) --------------------------------------------------------
|
|
2630 unsigned int __fastcall Actor::_403854(unsigned int uActorID, signed int edx0, AIDirection *pDir)
|
|
2631 {
|
|
2632 Actor *v3; // ebx@1
|
|
2633 AIDirection *v4; // esi@3
|
|
2634 AIDirection *v5; // edi@3
|
|
2635 signed int v6; // eax@4
|
|
2636 Vec3_int_ v7; // ST04_12@6
|
|
2637 unsigned int result; // eax@7
|
|
2638 AIDirection *v9; // eax@8
|
|
2639 unsigned int v10; // esi@8
|
|
2640 AIDirection *v11; // esi@9
|
|
2641 SpriteFrame *v12; // ecx@10
|
|
2642 __int16 v13; // ax@10
|
|
2643 unsigned int v14; // ecx@10
|
|
2644 unsigned int v15; // eax@10
|
|
2645 signed int v16; // ecx@17
|
|
2646 AIDirection a3; // [sp+Ch] [bp-48h]@9
|
|
2647 AIDirection v18; // [sp+28h] [bp-2Ch]@9
|
|
2648 int v19; // [sp+44h] [bp-10h]@6
|
|
2649 signed int a2; // [sp+48h] [bp-Ch]@1
|
|
2650 int v21; // [sp+4Ch] [bp-8h]@3
|
|
2651 unsigned int v22; // [sp+50h] [bp-4h]@1
|
|
2652 unsigned int pDira; // [sp+5Ch] [bp+8h]@10
|
|
2653
|
|
2654 v22 = uActorID;
|
|
2655 v3 = &pActors[uActorID];
|
|
2656 a2 = edx0;
|
|
2657 if ( (edx0 & 7) == 3 )
|
|
2658 {
|
|
2659 v6 = edx0 >> 3;
|
|
2660 v4 = (AIDirection *)pActors[v6].vPosition.x;
|
|
2661 v5 = (AIDirection *)pActors[v6].vPosition.y;
|
|
2662 v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z);
|
|
2663 }
|
|
2664 else
|
|
2665 {
|
|
2666 if ( (edx0 & 7) == 4 )
|
|
2667 {
|
|
2668 v4 = (AIDirection *)pParty->vPosition.x;
|
58
|
2669 v5 = (AIDirection *)pParty->vPosition.y;
|
|
2670 v21 = pParty->vPosition.z + pParty->sEyelevel;
|
0
|
2671 }
|
|
2672 else
|
|
2673 {
|
|
2674 v4 = pDir;
|
|
2675 v5 = pDir;
|
|
2676 }
|
|
2677 }
|
|
2678 v19 = v3->uActorHeight;
|
|
2679 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75);
|
|
2680 v7.y = v3->vPosition.y;
|
|
2681 v7.x = v3->vPosition.x;
|
|
2682 if ( sub_407A1C((int)v4, (int)v5, v21, v7) )
|
|
2683 {
|
|
2684 v9 = pDir;
|
|
2685 v10 = 0;
|
|
2686 if ( !pDir )
|
|
2687 {
|
|
2688 v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0);
|
|
2689 v9 = &v18;
|
|
2690 memcpy(&v18, v11, sizeof(v18));
|
|
2691 v10 = 0;
|
|
2692 }
|
|
2693 v12 = pSpriteFrameTable->pSpriteSFrames;
|
|
2694 v3->uYawAngle = LOWORD(v9->uYawAngle);
|
|
2695 v13 = v12[v3->pSpriteIDs[3]].uAnimLength;
|
|
2696 v14 = v22;
|
|
2697 v3->uCurrentActionLength = 8 * v13;
|
|
2698 v3->uCurrentActionTime = v10;
|
45
|
2699 v3->uAIState = AttackingRanged3;
|
0
|
2700 Actor::PlaySound(v14, 0);
|
|
2701 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2702 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2703 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10
|
|
2704 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) )
|
|
2705 {
|
|
2706 v15 *= 2;
|
|
2707 pDira = v15;
|
|
2708 }
|
|
2709 if ( pParty->bTurnBasedModeOn == 1 )
|
|
2710 v3->pMonsterInfo.uRecoveryTime = v15;
|
|
2711 else
|
|
2712 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength
|
|
2713 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2
|
|
2714 * (double)(signed int)pDira
|
|
2715 * -2.133333333333333);
|
|
2716 v16 = v3->pMonsterInfo.uSpell1ID;
|
|
2717 v3->vVelocity.z = v10;
|
|
2718 v3->vVelocity.y = v10;
|
|
2719 v3->vVelocity.x = v10;
|
|
2720 if ( sub_42FB5C(v16) )
|
|
2721 {
|
|
2722 v3->uCurrentActionLength = 64;
|
|
2723 v3->uCurrentActionTime = v10;
|
45
|
2724 v3->uAIState = Fidgeting;
|
0
|
2725 result = v3->UpdateAnimation();
|
45
|
2726 v3->uAIState = AttackingRanged3;
|
0
|
2727 }
|
|
2728 else
|
|
2729 {
|
|
2730 result = v3->UpdateAnimation();
|
|
2731 }
|
|
2732 }
|
|
2733 else
|
|
2734 {
|
|
2735 result = Actor::_402AD7(v22, a2, v22, 64, pDir);
|
|
2736 }
|
|
2737 return result;
|
|
2738 }
|
|
2739
|
|
2740
|
|
2741 //----- (0040368B) --------------------------------------------------------
|
|
2742 unsigned int __fastcall Actor::_40368B(unsigned int uActorID, signed int edx0, AIDirection *pDir)
|
|
2743 {
|
|
2744 Actor *v3; // ebx@1
|
|
2745 AIDirection *v4; // esi@3
|
|
2746 AIDirection *v5; // edi@3
|
|
2747 signed int v6; // eax@4
|
|
2748 Vec3_int_ v7; // ST04_12@6
|
|
2749 unsigned int result; // eax@7
|
|
2750 AIDirection *v9; // eax@8
|
|
2751 unsigned int v10; // esi@8
|
|
2752 AIDirection *v11; // esi@9
|
|
2753 SpriteFrame *v12; // ecx@10
|
|
2754 __int16 v13; // ax@10
|
|
2755 unsigned int v14; // ecx@10
|
|
2756 signed __int64 v15; // qax@10
|
|
2757 AIDirection a3; // [sp+Ch] [bp-48h]@9
|
|
2758 AIDirection v17; // [sp+28h] [bp-2Ch]@9
|
|
2759 int v18; // [sp+44h] [bp-10h]@6
|
|
2760 signed int a2; // [sp+48h] [bp-Ch]@1
|
|
2761 int v20; // [sp+4Ch] [bp-8h]@3
|
|
2762 unsigned int v21; // [sp+50h] [bp-4h]@1
|
|
2763 unsigned int pDira; // [sp+5Ch] [bp+8h]@10
|
|
2764
|
|
2765 v21 = uActorID;
|
|
2766 v3 = &pActors[uActorID];
|
|
2767 a2 = edx0;
|
|
2768 if ( (edx0 & 7) == 3 )
|
|
2769 {
|
|
2770 v6 = edx0 >> 3;
|
|
2771 v4 = (AIDirection *)pActors[v6].vPosition.x;
|
|
2772 v5 = (AIDirection *)pActors[v6].vPosition.y;
|
|
2773 v20 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z);
|
|
2774 }
|
|
2775 else
|
|
2776 {
|
|
2777 if ( (edx0 & 7) == 4 )
|
|
2778 {
|
|
2779 v4 = (AIDirection *)pParty->vPosition.x;
|
58
|
2780 v5 = (AIDirection *)pParty->vPosition.y;
|
|
2781 v20 = pParty->vPosition.z + pParty->sEyelevel;
|
0
|
2782 }
|
|
2783 else
|
|
2784 {
|
|
2785 v4 = pDir;
|
|
2786 v5 = pDir;
|
|
2787 }
|
|
2788 }
|
|
2789 v18 = v3->uActorHeight;
|
|
2790 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v18 * -0.75);
|
|
2791 v7.y = v3->vPosition.y;
|
|
2792 v7.x = v3->vPosition.x;
|
|
2793 if ( sub_407A1C((int)v4, (int)v5, v20, v7) )
|
|
2794 {
|
|
2795 v9 = pDir;
|
|
2796 v10 = 0;
|
|
2797 if ( !pDir )
|
|
2798 {
|
|
2799 v11 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0);
|
|
2800 v9 = &v17;
|
|
2801 memcpy(&v17, v11, sizeof(v17));
|
|
2802 v10 = 0;
|
|
2803 }
|
|
2804 v12 = pSpriteFrameTable->pSpriteSFrames;
|
|
2805 v3->uYawAngle = LOWORD(v9->uYawAngle);
|
|
2806 v13 = v12[v3->pSpriteIDs[3]].uAnimLength;
|
|
2807 v14 = v21;
|
|
2808 v3->uCurrentActionLength = 8 * v13;
|
|
2809 v3->uCurrentActionTime = v10;
|
45
|
2810 v3->uAIState = AttackingRanged2;
|
0
|
2811 Actor::PlaySound(v14, 0);
|
|
2812 LODWORD(v15) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2813 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2814 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10
|
|
2815 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) )
|
|
2816 {
|
|
2817 LODWORD(v15) = 2 * v15;
|
|
2818 pDira = v15;
|
|
2819 }
|
|
2820 if ( pParty->bTurnBasedModeOn != 1 )
|
|
2821 v15 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)pDira * 2.133333333333333);
|
|
2822 v3->pMonsterInfo.uRecoveryTime = v15;
|
|
2823 v3->vVelocity.z = v10;
|
|
2824 v3->vVelocity.y = v10;
|
|
2825 v3->vVelocity.x = v10;
|
|
2826 result = v3->UpdateAnimation();
|
|
2827 }
|
|
2828 else
|
|
2829 {
|
|
2830 result = Actor::_402AD7(v21, a2, v21, 64, pDir);
|
|
2831 }
|
|
2832 return result;
|
|
2833 }
|
|
2834
|
|
2835
|
|
2836 //----- (00403476) --------------------------------------------------------
|
|
2837 unsigned int __fastcall Actor::_403476(unsigned int uActorID, signed int edx0, AIDirection *pDir)
|
|
2838 {
|
|
2839 Actor *v3; // ebx@1
|
|
2840 int v4; // esi@3
|
|
2841 int v5; // edi@3
|
|
2842 signed int v6; // eax@4
|
|
2843 Vec3_int_ v7; // ST04_12@6
|
|
2844 unsigned char v8[12]; // ST04_12@7
|
|
2845 unsigned int result; // eax@8
|
|
2846 AIDirection *v10; // eax@9
|
|
2847 unsigned int v11; // esi@9
|
|
2848 AIDirection *v12; // esi@10
|
|
2849 SpriteFrame *v13; // ecx@11
|
|
2850 __int16 v14; // ax@11
|
|
2851 unsigned int v15; // ecx@11
|
|
2852 unsigned int v16; // eax@11
|
|
2853 AIDirection a3; // [sp+Ch] [bp-48h]@10
|
|
2854 AIDirection v18; // [sp+28h] [bp-2Ch]@10
|
|
2855 int v19; // [sp+44h] [bp-10h]@6
|
|
2856 signed int a2; // [sp+48h] [bp-Ch]@1
|
|
2857 unsigned int v21; // [sp+4Ch] [bp-8h]@1
|
|
2858 int v22; // [sp+50h] [bp-4h]@3
|
|
2859 unsigned int pDira; // [sp+5Ch] [bp+8h]@11
|
|
2860
|
|
2861 v21 = uActorID;
|
|
2862 v3 = &pActors[uActorID];
|
|
2863 a2 = edx0;
|
|
2864 if ( (edx0 & 7) == 3 )
|
|
2865 {
|
|
2866 v6 = edx0 >> 3;
|
|
2867 v4 = pActors[v6].vPosition.x;
|
|
2868 v5 = pActors[v6].vPosition.y;
|
|
2869 v22 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z);
|
|
2870 }
|
|
2871 else
|
|
2872 {
|
|
2873 if ( (edx0 & 7) == 4 )
|
|
2874 {
|
|
2875 v4 = pParty->vPosition.x;
|
58
|
2876 v5 = pParty->vPosition.y;
|
|
2877 v22 = pParty->vPosition.z + pParty->sEyelevel;
|
0
|
2878 }
|
|
2879 else
|
|
2880 {
|
|
2881 v4 = (int)pDir;
|
|
2882 v5 = (int)pDir;
|
|
2883 }
|
|
2884 }
|
|
2885 v19 = v3->uActorHeight;
|
|
2886 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75);
|
|
2887 v7.y = v3->vPosition.y;
|
|
2888 v7.x = v3->vPosition.x;
|
|
2889 if ( sub_407A1C(v4, v5, v22, v7)
|
|
2890 || (*(unsigned int *)&v8[8] = v22,
|
|
2891 v19 = v3->uActorHeight,
|
|
2892 *(_QWORD *)v8 = __PAIR__(v5, v4),
|
|
2893 sub_407A1C(
|
|
2894 v3->vPosition.x,
|
|
2895 v3->vPosition.y,
|
|
2896 v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75),
|
|
2897 *(Vec3_int_ *)v8)) )
|
|
2898 {
|
|
2899 v10 = pDir;
|
|
2900 v11 = 0;
|
|
2901 if ( !pDir )
|
|
2902 {
|
|
2903 v12 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0);
|
|
2904 v10 = &v18;
|
|
2905 memcpy(&v18, v12, sizeof(v18));
|
|
2906 v11 = 0;
|
|
2907 }
|
|
2908 v13 = pSpriteFrameTable->pSpriteSFrames;
|
|
2909 v3->uYawAngle = LOWORD(v10->uYawAngle);
|
|
2910 v14 = v13[v3->pSpriteIDs[3]].uAnimLength;
|
|
2911 v15 = v21;
|
|
2912 v3->uCurrentActionLength = 8 * v14;
|
|
2913 v3->uCurrentActionTime = v11;
|
45
|
2914 v3->uAIState = AttackingRanged1;
|
0
|
2915 Actor::PlaySound(v15, 0);
|
|
2916 v16 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2917 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
|
|
2918 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v11
|
|
2919 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v11 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v11) )
|
|
2920 {
|
|
2921 v16 *= 2;
|
|
2922 pDira = v16;
|
|
2923 }
|
|
2924 if ( pParty->bTurnBasedModeOn == 1 )
|
|
2925 v3->pMonsterInfo.uRecoveryTime = v16;
|
|
2926 else
|
|
2927 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength
|
|
2928 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2
|
|
2929 * (double)(signed int)pDira
|
|
2930 * -2.133333333333333);
|
|
2931 v3->vVelocity.z = v11;
|
|
2932 v3->vVelocity.y = v11;
|
|
2933 v3->vVelocity.x = v11;
|
|
2934 result = v3->UpdateAnimation();
|
|
2935 }
|
|
2936 else
|
|
2937 {
|
|
2938 result = Actor::_402AD7(v21, a2, v21, 64, pDir);
|
|
2939 }
|
|
2940 return result;
|
|
2941 }
|
|
2942
|
|
2943 //----- (004032B2) --------------------------------------------------------
|
|
2944 void __fastcall Actor::_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength)
|
|
2945 {
|
|
2946 unsigned int v4; // edi@1
|
|
2947 Actor *v5; // esi@1
|
|
2948 int v6; // ebx@1
|
|
2949 int v7; // ST08_4@1
|
|
2950 int v8; // eax@1
|
|
2951 unsigned int v9; // ebx@11
|
|
2952 int v10; // ebx@13
|
|
2953 signed __int16 v11; // cx@17
|
|
2954 unsigned int v12; // [sp-8h] [bp-44h]@10
|
|
2955 AIDirection *v13; // [sp-4h] [bp-40h]@10
|
|
2956 AIDirection v14; // [sp+Ch] [bp-30h]@7
|
|
2957 int v15; // [sp+28h] [bp-14h]@11
|
|
2958 unsigned int v16; // [sp+2Ch] [bp-10h]@1
|
|
2959 int y; // [sp+30h] [bp-Ch]@1
|
|
2960 unsigned int uActorID; // [sp+34h] [bp-8h]@1
|
|
2961 int v19; // [sp+38h] [bp-4h]@1
|
|
2962
|
|
2963 uActorID = a1;
|
|
2964 v4 = a1;
|
|
2965 v5 = &pActors[a1];
|
|
2966 v16 = a2;
|
|
2967 v6 = v5->vInitialPosition.x - v5->vPosition.x;
|
|
2968 v7 = v5->vInitialPosition.x - v5->vPosition.x;
|
|
2969 y = v5->vInitialPosition.y - v5->vPosition.y;
|
|
2970 v19 = abs(v7);
|
|
2971 v8 = abs(y);
|
|
2972 if ( v19 <= v8 )
|
|
2973 v19 = v8 + (v19 >> 1);
|
|
2974 else
|
|
2975 v19 += v8 >> 1;
|
|
2976 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
|
|
2977 {
|
|
2978 if ( !uActionLength )
|
|
2979 uActionLength = 256;
|
|
2980 Actor::_403F58(uActorID, 4, uActionLength, &v14);
|
|
2981 return;
|
|
2982 }
|
|
2983 if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 )
|
|
2984 {
|
|
2985 v13 = &v14;
|
|
2986 v12 = 256;
|
|
2987 LABEL_16:
|
|
2988 Actor::_403EB6(uActorID, v16, v12, v13);
|
|
2989 return;
|
|
2990 }
|
|
2991 v15 = (rand() & 0xF) << 12;
|
|
2992 v19 += (unsigned __int64)(v15 * (signed __int64)a3) >> 16;
|
|
2993 v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(v6, y);
|
|
2994 if ( rand() % 100 < 25 )
|
|
2995 {
|
|
2996 Actor::StandAwhile(uActorID);
|
|
2997 return;
|
|
2998 }
|
|
2999 v10 = v9 + rand() % 256 - 128;
|
|
3000 if ( abs(v10 - v5->uYawAngle) > 256 && !(BYTE2(v5->uAttributes) & 0x20) )
|
|
3001 {
|
|
3002 v13 = &v14;
|
|
3003 v12 = 256;
|
|
3004 goto LABEL_16;
|
|
3005 }
|
|
3006 v11 = v5->uMovementSpeed;
|
|
3007 v5->uYawAngle = v10;
|
|
3008 if ( v11 )
|
|
3009 v5->uCurrentActionLength = 32 * v19 / v11;
|
|
3010 else
|
|
3011 v5->uCurrentActionLength = 0;
|
|
3012 v5->uCurrentActionTime = 0;
|
45
|
3013 v5->uAIState = Tethered;
|
0
|
3014 if ( rand() % 100 < 2 )
|
|
3015 Actor::PlaySound(uActorID, 3u);
|
|
3016 v5->UpdateAnimation();
|
|
3017 }
|
|
3018
|
|
3019
|
|
3020 //----- (004031C1) --------------------------------------------------------
|
|
3021 char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3)
|
|
3022 {
|
|
3023 unsigned int v3; // edi@1
|
|
3024 Actor *v4; // esi@1
|
|
3025 ActorJob *v5; // eax@1
|
|
3026 signed int v6; // edx@2
|
|
3027 ActorJob *v7; // eax@2
|
|
3028 signed int v8; // edi@2
|
|
3029 char *v9; // ecx@2
|
|
3030 __int16 v10; // cx@15
|
|
3031 signed int v12; // [sp+8h] [bp-4h]@1
|
|
3032
|
|
3033 v3 = uActorID;
|
|
3034 v12 = a2;
|
|
3035 v4 = &pActors[uActorID];
|
|
3036 v5 = (ActorJob *)pActors[uActorID].CanAct();
|
|
3037 if ( v5 )
|
|
3038 {
|
|
3039 v6 = 65535;
|
|
3040 v7 = &v4->pScheduledJobs[v3];
|
|
3041 v8 = 7;
|
|
3042 v9 = (char *)&v7[7].uHour;
|
|
3043 while ( !(*(v9 - 3) & 1) || (unsigned __int8)*v9 > v12 )
|
|
3044 {
|
|
3045 --v8;
|
|
3046 v9 -= 12;
|
|
3047 if ( v8 < 0 )
|
|
3048 goto LABEL_8;
|
|
3049 }
|
|
3050 v6 = v8;
|
|
3051 LABEL_8:
|
|
3052 if ( !v8 && v6 == 65535 )
|
|
3053 v6 = 7;
|
|
3054 v5 = &v7[v6];
|
|
3055 if ( v4->vInitialPosition.x != v5->vPos.x
|
|
3056 || v4->vInitialPosition.y != v5->vPos.y
|
|
3057 || v4->vInitialPosition.z != v5->vPos.z
|
|
3058 || v4->pMonsterInfo.uMovementType != v5->uAction )
|
|
3059 {
|
|
3060 v4->vInitialPosition.x = v5->vPos.x;
|
|
3061 v4->vInitialPosition.y = v5->vPos.y;
|
|
3062 v10 = v5->vPos.z;
|
|
3063 v4->vInitialPosition.z = v10;
|
|
3064 LOBYTE(v5) = v5->uAction;
|
|
3065 v4->pMonsterInfo.uMovementType = (unsigned __int8)v5;
|
|
3066 if ( a3 == 1 )
|
|
3067 {
|
|
3068 v4->vPosition.x = v4->vInitialPosition.x;
|
|
3069 v4->vPosition.y = v4->vInitialPosition.y;
|
|
3070 LOBYTE(v5) = v10;
|
|
3071 v4->vPosition.z = v10;
|
|
3072 }
|
|
3073 }
|
|
3074 }
|
|
3075 return (char)v5;
|
|
3076 }
|
|
3077
|
|
3078
|
|
3079 //----- (004030AD) --------------------------------------------------------
|
|
3080 __int16 __fastcall Actor::_4030AD(unsigned int uActorID, signed int edx0, int arg0)
|
|
3081 {
|
|
3082 unsigned int v3; // edi@1
|
|
3083 Actor *v4; // ebx@1
|
|
3084 __int16 result; // ax@10
|
|
3085 SpriteFrame *v6; // ecx@16
|
|
3086 __int16 v7; // ax@16
|
|
3087 unsigned int v8; // ecx@16
|
|
3088 AIDirection a3; // [sp+Ch] [bp-40h]@16
|
|
3089 AIDirection v10; // [sp+28h] [bp-24h]@16
|
|
3090 unsigned int v11; // [sp+44h] [bp-8h]@1
|
|
3091 signed int a2; // [sp+48h] [bp-4h]@1
|
|
3092
|
|
3093 v3 = uActorID;
|
|
3094 a2 = edx0;
|
|
3095 v4 = &pActors[uActorID];
|
|
3096 v11 = uActorID;
|
|
3097 if ( v4->uAIState == 7 )
|
|
3098 BYTE2(v4->uAttributes) |= 2u;
|
|
3099 if ( v4->pMonsterInfo.uHostilityType != 4 )
|
|
3100 {
|
|
3101 v4->uAttributes &= 0xFFFFFFFBu;
|
29
|
3102 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
|
0
|
3103 }
|
|
3104 if ( (signed __int64)v4->pActorBuffs[1].uExpireTime > 0 )
|
|
3105 v4->pActorBuffs[1].Reset();
|
|
3106 if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 )
|
|
3107 v4->pActorBuffs[4].Reset();
|
|
3108 if ( arg0
|
|
3109 || (result = v4->uAIState, result != 8)
|
|
3110 && result != 3
|
|
3111 && result != 12
|
|
3112 && result != 13
|
|
3113 && result != 18
|
|
3114 && result != 2 )
|
|
3115 {
|
|
3116 memcpy(&v10, Actor::GetDirectionInfo(8 * v3 | 3, a2, &a3, 0), sizeof(v10));
|
|
3117 v6 = pSpriteFrameTable->pSpriteSFrames;
|
|
3118 v4->uYawAngle = LOWORD(v10.uYawAngle);
|
|
3119 v7 = v6[v4->pSpriteIDs[4]].uAnimLength;
|
|
3120 v8 = v11;
|
|
3121 v4->uCurrentActionTime = 0;
|
45
|
3122 v4->uAIState = Stunned;
|
0
|
3123 v4->uCurrentActionLength = 8 * v7;
|
|
3124 Actor::PlaySound(v8, 2u);
|
|
3125 result = v4->UpdateAnimation();
|
|
3126 }
|
|
3127 return result;
|
|
3128 }
|
|
3129
|
|
3130 //----- (00402F87) --------------------------------------------------------
|
|
3131 int __fastcall Actor::_402F87(unsigned int uActorID, unsigned int uObjID, AIDirection *a4)
|
|
3132 {
|
|
3133 int v3; // edi@1
|
|
3134 AIDirection *v4; // esi@1
|
|
3135 Actor *v5; // ebx@1
|
|
3136 SpriteFrame *v6; // ecx@3
|
|
3137 unsigned int v7; // eax@3
|
|
3138 int v8; // edx@3
|
|
3139 unsigned int v9; // eax@3
|
|
3140 int result; // eax@4
|
|
3141 AIDirection a3; // [sp+Ch] [bp-5Ch]@2
|
|
3142 AIDirection v12; // [sp+28h] [bp-40h]@2
|
|
3143 AIDirection v13; // [sp+44h] [bp-24h]@2
|
|
3144 unsigned int v14; // [sp+60h] [bp-8h]@1
|
|
3145 unsigned int v15; // [sp+64h] [bp-4h]@1
|
|
3146
|
|
3147 v3 = uActorID;
|
|
3148 v4 = a4;
|
|
3149 v5 = &pActors[uActorID];
|
|
3150 v14 = uObjID;
|
|
3151 v15 = uActorID;
|
|
3152 if ( !a4 )
|
|
3153 {
|
|
3154 memcpy(&v13, Actor::GetDirectionInfo(8 * uActorID | AI_OBJECT_ACTOR, uObjID, &a3, (int)a4), sizeof(v13));
|
|
3155 memcpy(&v12, &v13, sizeof(v12));
|
|
3156 v3 = v15;
|
|
3157 v4 = &v12;
|
|
3158 }
|
|
3159 v6 = pSpriteFrameTable->pSpriteSFrames;
|
|
3160 v5->uYawAngle = LOWORD(v4->uYawAngle);
|
|
3161 v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[7]].uAnimLength;
|
|
3162 v7 = stru_5C6E00->Atan2(v5->vPosition.x - pIndoorCamera->pos.x, v5->vPosition.y - pIndoorCamera->pos.y);
|
|
3163 LOWORD(v8) = v5->uYawAngle;
|
|
3164 v9 = stru_5C6E00->uIntegerPi + v8 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7;
|
|
3165 if ( BYTE1(v9) & 7 )
|
|
3166 {
|
|
3167 result = Actor::_403EB6(v3, v14, v5->uCurrentActionLength, v4);
|
|
3168 }
|
|
3169 else
|
|
3170 {
|
|
3171 v5->uAIState = Fidgeting;
|
|
3172 v5->uCurrentActionTime = 0;
|
|
3173 v5->vVelocity.z = 0;
|
|
3174 v5->vVelocity.y = 0;
|
|
3175 v5->vVelocity.x = 0;
|
|
3176 if ( rand() % 100 < 5 )
|
|
3177 Actor::PlaySound(v3, 3u);
|
|
3178 result = v5->UpdateAnimation();
|
|
3179 }
|
|
3180 return result;
|
|
3181 }
|
|
3182
|
|
3183 //----- (00402F27) --------------------------------------------------------
|
|
3184 unsigned int __fastcall Actor::Resurrect(unsigned int uActorID)
|
|
3185 {
|
|
3186 Actor *pActor; // esi@1
|
|
3187 SpriteFrame *v2; // edx@1
|
|
3188 int v3; // eax@1
|
|
3189
|
|
3190 pActor = &pActors[uActorID];
|
|
3191 v2 = pSpriteFrameTable->pSpriteSFrames;
|
|
3192 v3 = pActor->pSpriteIDs[5];
|
|
3193 pActor->uCurrentActionTime = 0;
|
|
3194 pActor->uAIState = Resurrected;
|
|
3195 pActor->uCurrentActionAnimation = ANIM_Dying;
|
|
3196 pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength;
|
|
3197 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP);
|
|
3198 Actor::PlaySound(uActorID, 1u);
|
|
3199 return pActor->UpdateAnimation();
|
|
3200 }
|
|
3201
|
|
3202
|
|
3203 //----- (00402D6E) --------------------------------------------------------
|
|
3204 void __fastcall Actor::Die(unsigned int uActorID)
|
|
3205 {
|
|
3206 Actor *v1; // esi@1
|
|
3207 SpriteFrame *v2; // ecx@1
|
|
3208 int v3; // eax@1
|
|
3209 int v4; // ecx@1
|
|
3210 char *v5; // eax@1
|
|
3211 SpellBuff *v6; // edi@5
|
|
3212 signed int v7; // ebx@5
|
|
3213 MONSTER_TYPE v8; // eax@7
|
|
3214 int v9; // eax@23
|
|
3215 ItemGen _this; // [sp+8h] [bp-28h]@7
|
|
3216 unsigned int v11; // [sp+2Ch] [bp-4h]@1
|
|
3217
|
|
3218 v1 = &pActors[uActorID];
|
|
3219 v11 = uActorID;
|
|
3220 v2 = pSpriteFrameTable->pSpriteSFrames;
|
|
3221 v3 = 60 * v1->pSpriteIDs[5];
|
|
3222 v1->uCurrentActionTime = 0;
|
45
|
3223 v1->uAIState = Dying;
|
0
|
3224 v1->uCurrentActionAnimation = 5;
|
|
3225 LOWORD(v3) = *(__int16 *)((char *)&v2->uAnimLength + v3);
|
|
3226 v1->sCurrentHP = 0;
|
|
3227 v1->uCurrentActionLength = 8 * v3;
|
|
3228 v1->pActorBuffs[6].Reset();
|
|
3229 v1->pActorBuffs[5].Reset();
|
|
3230 Actor::PlaySound(v11, 1u);
|
|
3231 v1->UpdateAnimation();
|
|
3232 v4 = v1->pMonsterInfo.uID;
|
|
3233 v5 = (char *)pParty->field_75A;
|
|
3234 do
|
|
3235 {
|
|
3236 if ( v4 == *((short *)v5 - 5) )
|
|
3237 *(short *)v5 = 1;
|
|
3238 v5 += 2;
|
|
3239 }
|
|
3240 while ( (signed int)v5 < (signed int)&pParty->field_764 );
|
|
3241 v6 = v1->pActorBuffs;
|
|
3242 v7 = 22;
|
|
3243 do
|
|
3244 {
|
|
3245 v6->Reset();
|
|
3246 ++v6;
|
|
3247 --v7;
|
|
3248 }
|
|
3249 while ( v7 );
|
|
3250 _this.Reset();
|
|
3251 v8 = (MONSTER_TYPE)v1->pMonsterInfo.uID;
|
|
3252 if ( v8 > MONSTER_HARPY_3 )
|
|
3253 {
|
|
3254 if ( v8 < MONSTER_OOZE_1 )
|
|
3255 goto LABEL_21;
|
|
3256 if ( v8 <= MONSTER_OOZE_3 )
|
|
3257 {
|
|
3258 _this.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE;
|
|
3259 goto LABEL_21;
|
|
3260 }
|
|
3261 if ( v8 <= MONSTER_PEASANT_GOBLIN_MALE_3_3 || v8 > MONSTER_TROLL_3 )
|
|
3262 {
|
|
3263 LABEL_21:
|
|
3264 if ( !_this.uItemID )
|
|
3265 goto LABEL_24;
|
|
3266 goto LABEL_22;
|
|
3267 }
|
|
3268 _this.uItemID = ITEM_TROLL_BLOOD;
|
|
3269 }
|
|
3270 else
|
|
3271 {
|
|
3272 if ( v8 >= MONSTER_HARPY_1 )
|
|
3273 {
|
|
3274 _this.uItemID = ITEM_HARPY_FEATHER;
|
|
3275 }
|
|
3276 else
|
|
3277 {
|
|
3278 if ( v8 < MONSTER_DEVIL_1 )
|
|
3279 goto LABEL_21;
|
|
3280 if ( v8 > MONSTER_DEVIL_3 )
|
|
3281 {
|
|
3282 if ( v8 <= MONSTER_DRAGON_3 )
|
|
3283 {
|
|
3284 _this.uItemID = ITEM_DRAGON_EYE;
|
|
3285 goto LABEL_22;
|
|
3286 }
|
|
3287 goto LABEL_21;
|
|
3288 }
|
|
3289 _this.uItemID = ITEM_DEVIL_ICHOR;
|
|
3290 }
|
|
3291 }
|
|
3292 LABEL_22:
|
|
3293 if ( rand() % 100 < 20 )
|
|
3294 {
|
|
3295 v9 = rand();
|
|
3296 sub_42F7EB_DropItemAt(
|
|
3297 pItemsTable->pItems[_this.uItemID].uSpriteID,
|
|
3298 v1->vPosition.x,
|
|
3299 v1->vPosition.y,
|
|
3300 v1->vPosition.z + 16,
|
|
3301 v9 % 200 + 200,
|
|
3302 1,
|
|
3303 1,
|
|
3304 0,
|
|
3305 &_this);
|
|
3306 }
|
|
3307 LABEL_24:
|
|
3308 if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE )
|
|
3309 Actor::Explode(v11);
|
|
3310 }
|
|
3311
|
|
3312 //----- (00402CED) --------------------------------------------------------
|
|
3313 void __fastcall Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID)
|
|
3314 {
|
|
3315 Actor *v2; // eax@1
|
|
3316 unsigned __int16 v3; // dx@1
|
|
3317 int v4; // eax@3
|
|
3318 int v5; // eax@4
|
|
3319 unsigned int v6; // eax@6
|
|
3320 signed int v7; // eax@12
|
|
3321 signed int v8; // [sp-18h] [bp-1Ch]@10
|
|
3322 signed int v9; // [sp-14h] [bp-18h]@10
|
|
3323 int v10; // [sp-10h] [bp-14h]@10
|
|
3324 unsigned int v11; // [sp-Ch] [bp-10h]@10
|
|
3325 int v12; // [sp-8h] [bp-Ch]@10
|
|
3326
|
|
3327 v2 = &pActors[uActorID];
|
|
3328 v3 = v2->pSoundSampleIDs[uSoundID];
|
|
3329 if ( v3 )
|
|
3330 {
|
|
3331 if ( (signed __int64)v2->pActorBuffs[3].uExpireTime <= 0 )
|
|
3332 {
|
|
3333 v12 = 0;
|
|
3334 v11 = 0;
|
|
3335 v10 = 0;
|
|
3336 v9 = 0;
|
|
3337 v8 = -1;
|
|
3338 }
|
|
3339 else
|
|
3340 {
|
|
3341 v4 = v2->pActorBuffs[3].uPower - 2;
|
|
3342 if ( v4 )
|
|
3343 {
|
|
3344 v5 = v4 - 1;
|
|
3345 if ( v5 )
|
|
3346 {
|
|
3347 if ( v5 == 1 )
|
|
3348 v6 = 55125;
|
|
3349 else
|
|
3350 v6 = uActorID;
|
|
3351 }
|
|
3352 else
|
|
3353 {
|
|
3354 v6 = 44100;
|
|
3355 }
|
|
3356 }
|
|
3357 else
|
|
3358 {
|
|
3359 v6 = 33075;
|
|
3360 }
|
|
3361 v12 = v6;
|
|
3362 v11 = 0;
|
|
3363 v10 = 0;
|
|
3364 v9 = 0;
|
|
3365 v8 = 0;
|
|
3366 }
|
|
3367 v7 = 8 * uActorID;
|
|
3368 LOBYTE(v7) = 8 * uActorID | 3;
|
|
3369 pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, v7, 0, v8, v9, v10, v11, v12);
|
|
3370 }
|
|
3371 }
|
|
3372
|
|
3373
|
|
3374 //----- (00402AD7) --------------------------------------------------------
|
|
3375 unsigned int __fastcall Actor::_402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir)
|
|
3376 {
|
|
3377 unsigned int v5; // edi@1
|
|
3378 int v6; // eax@1
|
|
3379 Actor *v7; // ebx@1
|
|
3380 unsigned int v8; // ecx@1
|
|
3381 char v9; // zf@1
|
|
3382 AIDirection *v10; // esi@6
|
|
3383 int v12; // ecx@19
|
|
3384 unsigned int v13; // eax@19
|
|
3385 AIDirection a3; // [sp+Ch] [bp-5Ch]@7
|
|
3386 AIDirection v15; // [sp+28h] [bp-40h]@7
|
|
3387 AIDirection v16; // [sp+44h] [bp-24h]@7
|
|
3388 unsigned int v17; // [sp+60h] [bp-8h]@1
|
|
3389 unsigned int v18; // [sp+64h] [bp-4h]@1
|
|
3390 int v19; // [sp+70h] [bp+8h]@19
|
|
3391
|
|
3392 v5 = uActorID;
|
|
3393 v6 = 0;
|
|
3394 v7 = &pActors[uActorID];
|
|
3395 v18 = a2;
|
|
3396 v8 = 8 * uActorID | 3;
|
|
3397 v9 = v7->pMonsterInfo.uFlying == 0;
|
|
3398 v17 = v5;
|
|
3399 if ( !v9 && !pParty->bFlying )
|
|
3400 {
|
|
3401 if ( v7->pMonsterInfo.uMissleAttack1Type )
|
|
3402 v6 = v7->uActorRadius + 512;
|
|
3403 else
|
|
3404 v6 = pParty->uPartyHeight;
|
|
3405 }
|
|
3406 v10 = pDir;
|
|
3407 if ( !pDir )
|
|
3408 {
|
|
3409 memcpy(&v15, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v15));
|
|
3410 memcpy(&v16, &v15, sizeof(v16));
|
|
3411 v5 = v17;
|
|
3412 v10 = &v16;
|
|
3413 }
|
|
3414 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
|
|
3415 {
|
|
3416 if ( !uActionLength )
|
|
3417 uActionLength = 256;
|
|
3418 return Actor::_403F58(v5, 4, uActionLength, v10);
|
|
3419 }
|
|
3420 if ( (double)(signed int)v10->uDistance < 307.2 )
|
|
3421 {
|
|
3422 if ( !uActionLength )
|
|
3423 uActionLength = 256;
|
|
3424 return Actor::_403EB6(v5, v18, uActionLength, v10);
|
|
3425 }
|
|
3426 if ( !v7->uMovementSpeed )
|
|
3427 return Actor::_403EB6(v5, v18, uActionLength, v10);
|
|
3428 v18 = 16;
|
|
3429 if ( arg0 % 2 )
|
|
3430 v18 = -16;
|
|
3431 v12 = ((unsigned __int64)(stru_5C6E00->SinCos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle)
|
|
3432 * (signed __int64)v10->uDistanceXZ) >> 16)
|
|
3433 + pParty->vPosition.x;
|
|
3434 v13 = stru_5C6E00->uIntegerPi + v10->uYawAngle;
|
|
3435 v17 = v12;
|
|
3436 v19 = stru_5C6E00->SinCos(v18 + v13 - stru_5C6E00->uIntegerHalfPi);
|
|
3437 v7->uYawAngle = stru_5C6E00->Atan2(
|
|
3438 v17 - v7->vPosition.x,
|
58
|
3439 pParty->vPosition.y
|
0
|
3440 + ((unsigned __int64)(v19 * (signed __int64)v10->uDistanceXZ) >> 16)
|
|
3441 - v7->vPosition.y);
|
|
3442 if ( uActionLength )
|
|
3443 v7->uCurrentActionLength = uActionLength;
|
|
3444 else
|
|
3445 v7->uCurrentActionLength = 128;
|
|
3446 v7->uPitchAngle = LOWORD(v10->uPitchAngle);
|
45
|
3447 v7->uAIState = Pursuing;
|
0
|
3448 return v7->UpdateAnimation();
|
|
3449 }
|
|
3450
|
|
3451 //----- (00402968) --------------------------------------------------------
|
|
3452 unsigned int __fastcall Actor::_402968(unsigned int uActorID, signed int edx0, int uActionLength, AIDirection *a4)
|
|
3453 {
|
|
3454 unsigned int v4; // esi@1
|
|
3455 Actor *v5; // ebx@1
|
|
3456 unsigned int result; // eax@1
|
|
3457 int v7; // ecx@2
|
|
3458 signed __int16 v8; // cx@10
|
|
3459 unsigned __int16 v9; // ax@15
|
|
3460 AIDirection v10; // [sp+8h] [bp-7Ch]@4
|
|
3461 AIDirection a3; // [sp+24h] [bp-60h]@3
|
|
3462 AIDirection v12; // [sp+40h] [bp-44h]@3
|
|
3463 AIDirection v13; // [sp+5Ch] [bp-28h]@4
|
|
3464 signed int a1; // [sp+78h] [bp-Ch]@2
|
|
3465 unsigned int v15; // [sp+7Ch] [bp-8h]@1
|
|
3466 signed int a2; // [sp+80h] [bp-4h]@1
|
|
3467
|
|
3468 v4 = uActorID;
|
|
3469 a2 = edx0;
|
|
3470 v15 = uActorID;
|
|
3471 v5 = &pActors[uActorID];
|
|
3472 result = pActors[uActorID].CanAct();
|
|
3473 if ( result )
|
|
3474 {
|
|
3475 v7 = 8 * v4 | 3;
|
|
3476 a1 = 8 * v4 | 3;
|
|
3477 if ( !a4 )
|
|
3478 {
|
|
3479 a4 = &v12;
|
|
3480 memcpy(&v12, Actor::GetDirectionInfo(v7, a2, &a3, v5->pMonsterInfo.uFlying), sizeof(v12));
|
|
3481 v7 = a1;
|
|
3482 }
|
|
3483 memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3));
|
|
3484 memcpy(&v13, &a3, sizeof(v13));
|
|
3485 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT)
|
|
3486 || (a2 & 7) == 3 && (double)(signed int)v13.uDistance < 307.2 )
|
|
3487 {
|
|
3488 if ( !uActionLength )
|
|
3489 uActionLength = 256;
|
|
3490 result = Actor::_403F58(v15, 4, uActionLength, &v13);
|
|
3491 }
|
|
3492 else
|
|
3493 {
|
|
3494 v8 = v5->uMovementSpeed;
|
|
3495 if ( v8 )
|
|
3496 v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v8;
|
|
3497 else
|
|
3498 v5->uCurrentActionLength = 0;
|
|
3499 if ( v5->uCurrentActionLength > 256 )
|
|
3500 v5->uCurrentActionLength = 256;
|
|
3501 v5->uYawAngle = LOWORD(stru_5C6E00->uIntegerHalfPi) + LOWORD(a4->uYawAngle);
|
|
3502 v5->uYawAngle = LOWORD(stru_5C6E00->uDoublePiMask) & (v5->uYawAngle + rand() % (signed int)stru_5C6E00->uIntegerPi);
|
|
3503 v9 = LOWORD(a4->uPitchAngle);
|
|
3504 v5->uCurrentActionTime = 0;
|
|
3505 v5->uPitchAngle = v9;
|
45
|
3506 v5->uAIState = Fleeing;
|
0
|
3507 result = v5->UpdateAnimation();
|
|
3508 }
|
|
3509 }
|
|
3510 return result;
|
|
3511 }
|
|
3512
|
|
3513
|
|
3514 //----- (0040281C) --------------------------------------------------------
|
|
3515 int __fastcall Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5)
|
|
3516 {
|
|
3517 unsigned int v5; // edi@1
|
|
3518 int v6; // eax@1
|
|
3519 Actor *v7; // ebx@1
|
|
3520 unsigned int v8; // ecx@1
|
|
3521 char v9; // zf@1
|
|
3522 AIDirection *v10; // esi@7
|
|
3523 signed int v11; // edx@12
|
|
3524 signed __int16 v13; // cx@19
|
|
3525 unsigned __int16 v14; // ax@25
|
|
3526 int v15; // [sp-8h] [bp-54h]@12
|
|
3527 AIDirection *v16; // [sp-4h] [bp-50h]@12
|
|
3528 AIDirection a3; // [sp+Ch] [bp-40h]@8
|
|
3529 AIDirection v18; // [sp+28h] [bp-24h]@8
|
|
3530 unsigned int v19; // [sp+44h] [bp-8h]@1
|
|
3531 unsigned int v20; // [sp+48h] [bp-4h]@1
|
|
3532
|
|
3533 v5 = uActorID;
|
|
3534 v6 = 0;
|
|
3535 v7 = &pActors[uActorID];
|
|
3536 v19 = a2;
|
|
3537 v8 = 8 * uActorID | 3;
|
|
3538 v9 = v7->pMonsterInfo.uFlying == 0;
|
|
3539 v20 = v5;
|
|
3540 if ( !v9 && !pParty->bFlying )
|
|
3541 {
|
|
3542 if ( v7->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
3543 v6 = v7->uActorRadius + 512;
|
|
3544 else
|
|
3545 v6 = pParty->uPartyHeight;
|
|
3546 }
|
|
3547 v10 = pDir;
|
|
3548 if ( !pDir )
|
|
3549 {
|
|
3550 memcpy(&v18, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v18));
|
|
3551 memcpy(0, &v18, 0x1Cu);
|
|
3552 v10 = 0;
|
|
3553 v5 = v20;
|
|
3554 }
|
|
3555 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
|
|
3556 {
|
|
3557 if ( !uActionLength )
|
|
3558 uActionLength = 256;
|
|
3559 v16 = v10;
|
|
3560 v15 = uActionLength;
|
|
3561 v11 = 4;
|
|
3562 return Actor::_403F58(v5, v11, v15, v16);
|
|
3563 }
|
|
3564 if ( (signed int)v10->uDistance < a5 )
|
|
3565 {
|
|
3566 if ( !uActionLength )
|
|
3567 uActionLength = 256;
|
|
3568 v11 = v19;
|
|
3569 v16 = v10;
|
|
3570 v15 = uActionLength;
|
|
3571 return Actor::_403F58(v5, v11, v15, v16);
|
|
3572 }
|
|
3573 if ( uActionLength )
|
|
3574 {
|
|
3575 v7->uCurrentActionLength = uActionLength;
|
|
3576 }
|
|
3577 else
|
|
3578 {
|
|
3579 v13 = v7->uMovementSpeed;
|
|
3580 if ( v13 )
|
|
3581 v7->uCurrentActionLength = (signed int)(v10->uDistanceXZ << 7) / v13;
|
|
3582 else
|
|
3583 v7->uCurrentActionLength = 0;
|
|
3584 if ( v7->uCurrentActionLength > 32 )
|
|
3585 v7->uCurrentActionLength = 32;
|
|
3586 }
|
|
3587 v7->uYawAngle = LOWORD(v10->uYawAngle);
|
|
3588 v14 = LOWORD(v10->uPitchAngle);
|
|
3589 v7->uCurrentActionTime = 0;
|
|
3590 v7->uPitchAngle = v14;
|
45
|
3591 v7->uAIState = Pursuing;
|
0
|
3592 return v7->UpdateAnimation();
|
|
3593 }
|
|
3594
|
|
3595
|
|
3596 //----- (00402686) --------------------------------------------------------
|
|
3597 unsigned int __fastcall Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4)
|
|
3598 {
|
|
3599 unsigned int v4; // edi@1
|
|
3600 int v5; // eax@1
|
|
3601 Actor *v6; // ebx@1
|
|
3602 int v7; // ecx@1
|
|
3603 char v8; // zf@1
|
|
3604 AIDirection *v9; // esi@7
|
|
3605 signed int v10; // edx@12
|
|
3606 signed __int16 v12; // cx@19
|
|
3607 int v13; // edx@25
|
|
3608 __int16 v14; // ax@25
|
|
3609 unsigned __int16 v15; // ax@26
|
|
3610 unsigned __int16 v16; // ax@28
|
|
3611 int v17; // [sp-8h] [bp-54h]@12
|
|
3612 AIDirection *v18; // [sp-4h] [bp-50h]@12
|
|
3613 AIDirection a3; // [sp+Ch] [bp-40h]@8
|
|
3614 AIDirection v20; // [sp+28h] [bp-24h]@8
|
|
3615 int v21; // [sp+44h] [bp-8h]@1
|
|
3616 unsigned int v22; // [sp+48h] [bp-4h]@1
|
|
3617
|
|
3618 v4 = uActorID;
|
|
3619 v5 = 0;
|
|
3620 v6 = &pActors[uActorID];
|
|
3621 v21 = a2;
|
|
3622 v7 = 8 * uActorID | 3;
|
|
3623 v8 = v6->pMonsterInfo.uFlying == 0;
|
|
3624 v22 = v4;
|
|
3625 if ( !v8 && !pParty->bFlying )
|
|
3626 {
|
|
3627 if ( v6->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
3628 v5 = v6->uActorRadius + 512;
|
|
3629 else
|
|
3630 v5 = pParty->uPartyHeight;
|
|
3631 }
|
|
3632 v9 = a4;
|
|
3633 if ( !a4 )
|
|
3634 {
|
|
3635 memcpy(&v20, Actor::GetDirectionInfo(v7, a2, &a3, v5), sizeof(v20));
|
|
3636 memcpy(0, &v20, 0x1Cu);
|
|
3637 v9 = 0;
|
|
3638 v4 = v22;
|
|
3639 }
|
|
3640 if ( MonsterStats::BelongsToSupertype(v6->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
|
|
3641 {
|
|
3642 if ( !uActionLength )
|
|
3643 uActionLength = 256;
|
|
3644 v18 = v9;
|
|
3645 v17 = uActionLength;
|
|
3646 v10 = 4;
|
|
3647 return Actor::_403F58(v4, v10, v17, v18);
|
|
3648 }
|
|
3649 if ( (double)(signed int)v9->uDistance < 307.2 )
|
|
3650 {
|
|
3651 if ( !uActionLength )
|
|
3652 uActionLength = 256;
|
|
3653 v10 = v21;
|
|
3654 v18 = v9;
|
|
3655 v17 = uActionLength;
|
|
3656 return Actor::_403F58(v4, v10, v17, v18);
|
|
3657 }
|
|
3658 if ( uActionLength )
|
|
3659 {
|
|
3660 v6->uCurrentActionLength = uActionLength + rand() % uActionLength;
|
|
3661 }
|
|
3662 else
|
|
3663 {
|
|
3664 v12 = v6->uMovementSpeed;
|
|
3665 if ( v12 )
|
|
3666 v6->uCurrentActionLength = (signed int)(v9->uDistanceXZ << 7) / v12;
|
|
3667 else
|
|
3668 v6->uCurrentActionLength = 0;
|
|
3669 if ( v6->uCurrentActionLength > 128 )
|
|
3670 v6->uCurrentActionLength = 128;
|
|
3671 }
|
|
3672 v13 = rand() % 2;
|
|
3673 v14 = LOWORD(v9->uYawAngle);
|
|
3674 if ( v13 )
|
|
3675 v15 = v14 + 256;
|
|
3676 else
|
|
3677 v15 = v14 - 256;
|
|
3678 v6->uYawAngle = v15;
|
|
3679 v16 = LOWORD(v9->uPitchAngle);
|
|
3680 v6->uCurrentActionTime = 0;
|
|
3681 v6->uPitchAngle = v16;
|
45
|
3682 v6->uAIState = Pursuing;
|
0
|
3683 if ( rand() % 100 < 2 )
|
|
3684 Actor::PlaySound(v4, 2u);
|
|
3685 return v6->UpdateAnimation();
|
|
3686 }
|
|
3687
|
|
3688 //----- (00401221) --------------------------------------------------------
|
|
3689 void __fastcall Actor::_401221(unsigned int uActorID, int *a2, unsigned int a3)
|
|
3690 {
|
|
3691 Actor *v3; // esi@1
|
|
3692 unsigned int v4; // ebx@1
|
|
3693 int v5; // ecx@1
|
|
3694 unsigned int v6; // eax@1
|
|
3695 char *v7; // edi@2
|
|
3696 __int16 v8; // ax@3
|
|
3697 int v9; // eax@10
|
|
3698 signed int v10; // eax@13
|
|
3699 int v11; // ebx@16
|
|
3700 int v12; // eax@16
|
|
3701 int v13; // eax@25
|
|
3702 signed int v14; // eax@31
|
|
3703 int v15; // edi@43
|
|
3704 int v16; // ebx@45
|
|
3705 int v17; // eax@45
|
|
3706 int v18; // eax@51
|
|
3707 int v19; // [sp+Ch] [bp-24h]@16
|
|
3708 int *v20; // [sp+10h] [bp-20h]@1
|
|
3709 signed int v21; // [sp+14h] [bp-1Ch]@1
|
|
3710 unsigned int v22; // [sp+18h] [bp-18h]@1
|
|
3711 int v23; // [sp+1Ch] [bp-14h]@16
|
|
3712 unsigned int v24; // [sp+20h] [bp-10h]@1
|
|
3713 int v25; // [sp+24h] [bp-Ch]@1
|
|
3714 signed int v26; // [sp+28h] [bp-8h]@1
|
|
3715 int v27; // [sp+2Ch] [bp-4h]@16
|
|
3716 int v28; // [sp+2Ch] [bp-4h]@45
|
|
3717
|
|
3718 v25 = -1;
|
|
3719 v22 = uActorID;
|
|
3720 v3 = &pActors[uActorID];
|
|
3721 v4 = 0;
|
|
3722 v5 = 0;
|
|
3723 v6 = v3->uLastCharacterIDToHit;
|
|
3724 *a2 = 0;
|
|
3725 v20 = a2;
|
|
3726 v21 = 0;
|
|
3727 v24 = v6;
|
|
3728 v26 = 0;
|
|
3729 if ( (signed int)uNumActors <= 0 )
|
|
3730 goto LABEL_26;
|
|
3731 v7 = (char *)&pActors[0].uAIState;
|
|
3732 do
|
|
3733 {
|
|
3734 v8 = *(short *)v7;
|
|
3735 if ( *(short *)v7 == 5 || v8 == 4 || v8 == 11 || v8 == 17 || v8 == 19 || v22 == v5 )
|
|
3736 goto LABEL_23;
|
|
3737 if ( v24 == v4 || (v9 = 8 * v5, LOBYTE(v9) = 8 * v5 | 3, v24 != v9) )
|
|
3738 goto LABEL_13;
|
|
3739 if ( ((Actor *)(v7 - 176))->IsAlive() == 1 )
|
|
3740 {
|
|
3741 v24 = v4;
|
|
3742 v3->uLastCharacterIDToHit = v4;
|
|
3743 LABEL_13:
|
|
3744 v10 = v3->GetActorsRelation((Actor *)(v7 - 176));
|
|
3745 if ( v10 == v4 )
|
|
3746 goto LABEL_23;
|
|
3747 goto LABEL_14;
|
|
3748 }
|
|
3749 v18 = *((unsigned int *)v7 + 133);
|
|
3750 if ( (v18 != v4 || v3->uGroup != v4) && v18 == v3->uGroup )
|
|
3751 goto LABEL_23;
|
|
3752 v10 = 4;
|
|
3753 LABEL_14:
|
|
3754 if ( v3->pMonsterInfo.uHostilityType )
|
|
3755 v10 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uHostilityType;
|
|
3756 v11 = dword_4DF380[v10];
|
|
3757 v23 = abs(v3->vPosition.x - *((short *)v7 - 17));
|
|
3758 v27 = abs(v3->vPosition.y - *((short *)v7 - 16));
|
|
3759 v12 = abs(v3->vPosition.z - *((short *)v7 - 15));
|
|
3760 v19 = v12;
|
|
3761 if ( v23 <= v11
|
|
3762 && v27 <= v11
|
|
3763 && v12 <= v11
|
|
3764 && sub_4070EF_prolly_collide_objects(8 * v26 | 3, 8 * v22 | 3)
|
|
3765 && v23 * v23 + v27 * v27 + v19 * v19 < (unsigned int)v25 )
|
|
3766 {
|
|
3767 v25 = v23 * v23 + v27 * v27 + v19 * v19;
|
|
3768 v21 = v26;
|
|
3769 }
|
|
3770 v4 = 0;
|
|
3771 LABEL_23:
|
|
3772 v7 += 836;
|
|
3773 v5 = v26++ + 1;
|
|
3774 }
|
|
3775 while ( v26 < (signed int)uNumActors );
|
|
3776 if ( v25 != -1 )
|
|
3777 {
|
|
3778 v13 = 8 * v21;
|
|
3779 LOBYTE(v13) = 8 * v21 | 3;
|
|
3780 *v20 = v13;
|
|
3781 }
|
|
3782 LABEL_26:
|
|
3783 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= (signed int)v4
|
|
3784 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > (signed int)v4 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > v4) )
|
|
3785 a3 = v4;
|
|
3786 if ( a3 != v4 )
|
|
3787 {
|
|
3788 v14 = v3->GetActorsRelation(0);
|
|
3789 if ( BYTE2(v3->uAttributes) & 8
|
|
3790 && SHIDWORD(v3->pActorBuffs[12].uExpireTime) <= (signed int)v4
|
|
3791 && (SHIDWORD(v3->pActorBuffs[12].uExpireTime) < (signed int)v4 || LODWORD(v3->pActorBuffs[12].uExpireTime) <= v4)
|
|
3792 && SHIDWORD(v3->pActorBuffs[1].uExpireTime) <= (signed int)v4
|
|
3793 && (SHIDWORD(v3->pActorBuffs[1].uExpireTime) < (signed int)v4 || LODWORD(v3->pActorBuffs[1].uExpireTime) <= v4)
|
|
3794 && SHIDWORD(v3->pActorBuffs[2].uExpireTime) <= (signed int)v4
|
|
3795 && (SHIDWORD(v3->pActorBuffs[2].uExpireTime) < (signed int)v4 || LODWORD(v3->pActorBuffs[2].uExpireTime) <= v4) )
|
|
3796 v14 = 4;
|
|
3797 if ( v14 != v4 )
|
|
3798 {
|
|
3799 v15 = dword_4DF390;
|
|
3800 if ( !v3->pMonsterInfo.uHostilityType )
|
|
3801 v15 = dword_4DF380[v14];
|
|
3802 v16 = abs(v3->vPosition.x - pParty->vPosition.x);
|
58
|
3803 v28 = abs(v3->vPosition.y - pParty->vPosition.y);
|
|
3804 v17 = abs(v3->vPosition.z - pParty->vPosition.z);
|
0
|
3805 if ( v16 <= v15 && v28 <= v15 && v17 <= v15 )
|
|
3806 {
|
|
3807 if ( v16 * v16 + v28 * v28 + v17 * v17 < (unsigned int)v25 )
|
|
3808 *v20 = 4;
|
|
3809 }
|
|
3810 }
|
|
3811 }
|
|
3812 }
|
|
3813 // 4DF380: using guessed type int dword_4DF380[];
|
|
3814 // 4DF390: using guessed type int dword_4DF390;
|
|
3815
|
|
3816 //----- (0040104C) --------------------------------------------------------
|
|
3817 signed int Actor::GetActorsRelation(Actor *a2)
|
|
3818 {
|
|
3819 Actor *v2; // esi@1
|
|
3820 int v3; // ebp@5
|
|
3821 int v4; // edi@11
|
|
3822 unsigned int v5; // edx@15
|
|
3823 unsigned int v6; // eax@16
|
|
3824 unsigned int v7; // ebp@19
|
|
3825 int v8; // eax@22
|
|
3826 unsigned int v9; // edx@25
|
|
3827 unsigned int v10; // edx@33
|
|
3828
|
|
3829 auto a1 = this;
|
|
3830 v2 = a2;
|
|
3831 if ( a1 )
|
|
3832 {
|
|
3833 if ( SHIDWORD(a1->pActorBuffs[9].uExpireTime) >= 0
|
|
3834 && (SHIDWORD(a1->pActorBuffs[9].uExpireTime) > 0 || LODWORD(a1->pActorBuffs[9].uExpireTime) > 0) )
|
|
3835 return 4;
|
|
3836 v3 = a1->pMonsterInfo.uID;
|
|
3837 }
|
|
3838 else
|
|
3839 {
|
|
3840 v3 = 0;
|
|
3841 }
|
|
3842 if ( a2 )
|
|
3843 {
|
|
3844 if ( SHIDWORD(a2->pActorBuffs[9].uExpireTime) >= 0
|
|
3845 && (SHIDWORD(a2->pActorBuffs[9].uExpireTime) > 0 || LODWORD(a2->pActorBuffs[9].uExpireTime) > 0) )
|
|
3846 return 4;
|
|
3847 v4 = a2->pMonsterInfo.uID;
|
|
3848 }
|
|
3849 else
|
|
3850 {
|
|
3851 v4 = 0;
|
|
3852 }
|
|
3853 if ( a2 )
|
|
3854 {
|
|
3855 if ( a1 )
|
|
3856 {
|
|
3857 v5 = a2->uGroup;
|
|
3858 if ( v5 )
|
|
3859 {
|
|
3860 v6 = a1->uGroup;
|
|
3861 if ( v6 )
|
|
3862 {
|
|
3863 if ( v5 == v6 )
|
|
3864 return 0;
|
|
3865 }
|
|
3866 }
|
|
3867 }
|
|
3868 }
|
|
3869 if ( v3 )
|
|
3870 v7 = (v3 - 1) / 3 + 1;
|
|
3871 else
|
|
3872 v7 = 0;
|
|
3873 if ( v4 )
|
|
3874 v8 = (v4 - 1) / 3 + 1;
|
|
3875 else
|
|
3876 v8 = 0;
|
|
3877 if ( a1 )
|
|
3878 {
|
|
3879 v9 = a1->uAlly;
|
|
3880 if ( (signed int)v9 <= 0 )
|
|
3881 {
|
|
3882 if ( v9 != 9999 )
|
|
3883 goto LABEL_30;
|
|
3884 }
|
|
3885 else
|
|
3886 {
|
|
3887 if ( v9 != 9999 )
|
|
3888 {
|
|
3889 v7 = a1->uAlly;
|
|
3890 goto LABEL_30;
|
|
3891 }
|
|
3892 }
|
|
3893 v7 = 0;
|
|
3894 LABEL_30:
|
|
3895 if ( (signed __int64)a1->pActorBuffs[12].uExpireTime > 0 )
|
|
3896 v7 = 0;
|
|
3897 }
|
|
3898 if ( !v2 )
|
|
3899 goto LABEL_40;
|
|
3900 v10 = v2->uAlly;
|
|
3901 if ( (signed int)v10 <= 0 )
|
|
3902 {
|
|
3903 if ( v10 != 9999 )
|
|
3904 goto LABEL_38;
|
|
3905 }
|
|
3906 else
|
|
3907 {
|
|
3908 if ( v10 != 9999 )
|
|
3909 {
|
|
3910 v8 = v2->uAlly;
|
|
3911 goto LABEL_38;
|
|
3912 }
|
|
3913 }
|
|
3914 v8 = 0;
|
|
3915 LABEL_38:
|
|
3916 if ( (signed __int64)v2->pActorBuffs[12].uExpireTime > 0 )
|
|
3917 v8 = 0;
|
|
3918 LABEL_40:
|
|
3919 if ( a1 && (signed __int64)a1->pActorBuffs[1].uExpireTime > 0 && !v8
|
|
3920 || v2 && (signed __int64)v2->pActorBuffs[1].uExpireTime > 0 && !v7 )
|
|
3921 return 0;
|
|
3922 if ( a1 && (signed __int64)a1->pActorBuffs[12].uExpireTime <= 0 && a1->uAttributes & 0x80000 && !v8 )
|
|
3923 return 4;
|
|
3924 if ( v2 && a1 && (signed __int64)a1->pActorBuffs[12].uExpireTime <= 0 && v2->uAttributes & 0x80000 )
|
|
3925 {
|
|
3926 if ( v7 )
|
|
3927 goto LABEL_55;
|
|
3928 return 4;
|
|
3929 }
|
|
3930 if ( !v7 )
|
|
3931 {
|
|
3932 if ( (!v2 || (signed __int64)v2->pActorBuffs[12].uExpireTime > 0 || !(v2->uAttributes & 0x80000))
|
|
3933 && !*((unsigned char *)&pFactionTable->relations + 89 * v8) )
|
|
3934 {
|
|
3935 LABEL_56:
|
|
3936 if ( v8 < 89 )
|
|
3937 return *((unsigned char *)&pFactionTable->relations + 89 * v7 + v8);
|
|
3938 return 0;
|
|
3939 }
|
|
3940 return 4;
|
|
3941 }
|
|
3942 LABEL_55:
|
|
3943 if ( (signed int)v7 < 89 )
|
|
3944 goto LABEL_56;
|
|
3945 return 0;
|
|
3946 }
|
|
3947
|
|
3948
|
|
3949 //----- (0045976D) --------------------------------------------------------
|
|
3950 unsigned int Actor::UpdateAnimation()
|
|
3951 {
|
45
|
3952 AIState state; // edx@1
|
0
|
3953 unsigned int result; // eax@1
|
|
3954
|
|
3955 state = (AIState)this->uAIState;
|
|
3956 BYTE2(this->uAttributes) &= 0xDFu;
|
|
3957 result = this->uAttributes;
|
|
3958 switch ( state )
|
|
3959 {
|
|
3960 case Tethered:
|
|
3961 this->uCurrentActionAnimation = ANIM_Walking;
|
|
3962 return result;
|
|
3963 case AttackingMelee:
|
|
3964 this->uCurrentActionAnimation = ANIM_AtkMelee;
|
|
3965 goto LABEL_10;
|
|
3966 case AttackingRanged1:
|
|
3967 case AttackingRanged2:
|
|
3968 case AttackingRanged3:
|
|
3969 case AttackingRanged4:
|
|
3970 this->uCurrentActionAnimation = ANIM_AtkRanged;
|
|
3971 goto LABEL_10;
|
|
3972 case Dying:
|
|
3973 case Resurrected:
|
|
3974 this->uCurrentActionAnimation = ANIM_Dying;
|
|
3975 goto LABEL_10;
|
|
3976 case Pursuing:
|
|
3977 case Fleeing:
|
|
3978 this->uCurrentActionAnimation = ANIM_Walking;
|
|
3979 goto LABEL_10;
|
|
3980 case Stunned:
|
|
3981 this->uCurrentActionAnimation = ANIM_GotHit;
|
|
3982 goto LABEL_10;
|
|
3983 case Fidgeting:
|
|
3984 this->uCurrentActionAnimation = ANIM_Bored;
|
|
3985 goto LABEL_10;
|
|
3986 case Standing:
|
|
3987 case Interacting:
|
|
3988 case Summoned:
|
|
3989 this->uCurrentActionAnimation = ANIM_Standing;
|
|
3990 LABEL_10:
|
|
3991 result |= 0x200000u;
|
|
3992 this->uAttributes = result;
|
|
3993 break;
|
|
3994 case Dead:
|
|
3995 result = 60 * this->pSpriteIDs[6];
|
|
3996 if ( *(__int16 *)((char *)pSpriteFrameTable->pSpriteSFrames->pHwSpriteIDs + result) <= 0 )
|
|
3997 this->uAIState = Removed;
|
|
3998 else
|
|
3999 this->uCurrentActionAnimation = ANIM_Dead;
|
|
4000 break;
|
|
4001 default:
|
|
4002 return result;
|
|
4003 }
|
|
4004 return result;
|
|
4005 }
|
|
4006
|
|
4007 //----- (00459671) --------------------------------------------------------
|
|
4008 void Actor::Reset()
|
|
4009 {
|
|
4010 this->pActorName[0] = 0;
|
|
4011 this->word_000086_some_monster_id = 0;
|
|
4012 this->uNPC_ID = 0;
|
|
4013 this->vPosition.z = 0;
|
|
4014 this->vPosition.y = 0;
|
|
4015 this->vPosition.x = 0;
|
|
4016 this->vVelocity.z = 0;
|
|
4017 this->vVelocity.y = 0;
|
|
4018 this->vVelocity.x = 0;
|
|
4019 this->uYawAngle = 0;
|
|
4020 this->uPitchAngle = 0;
|
|
4021 this->uAttributes = 0;
|
|
4022 this->uSectorID = 0;
|
|
4023 this->uCurrentActionTime = 0;
|
|
4024 this->vInitialPosition.z = 0;
|
|
4025 this->vInitialPosition.y = 0;
|
|
4026 this->vInitialPosition.x = 0;
|
|
4027 this->vGuardingPosition.z = 0;
|
|
4028 this->vGuardingPosition.y = 0;
|
|
4029 this->vGuardingPosition.x = 0;
|
|
4030 this->uTetherDistance = 256;
|
|
4031 this->uActorRadius = 32;
|
|
4032 this->uActorHeight = 128;
|
45
|
4033 this->uAIState = Standing;
|
0
|
4034 this->uCurrentActionAnimation = 0;
|
|
4035 this->uMovementSpeed = 200;
|
|
4036 this->uCarriedItemID = 0;
|
|
4037 this->uGroup = 0;
|
|
4038 this->uAlly = 0;
|
|
4039 this->uSummonerID = 0;
|
|
4040 this->uLastCharacterIDToHit = 0;
|
|
4041 this->dword_000334_unique_name = 0;
|
|
4042 memset(this->pSpriteIDs, 0, sizeof(pSpriteIDs));
|
|
4043 memset(this->pActorBuffs, 0, 0x160u);
|
|
4044 }
|
|
4045
|
|
4046 //----- (0045959A) --------------------------------------------------------
|
|
4047 void Actor::PrepareSprites(char load_sounds_if_bit1_set)
|
|
4048 {
|
29
|
4049 //Actor *v2; // edi@1
|
0
|
4050 MonsterDesc *v3; // esi@1
|
29
|
4051 //__int16 v4; // ax@2
|
0
|
4052 unsigned __int16 *v5; // ecx@4
|
|
4053 unsigned __int16 *v6; // eax@4
|
|
4054 signed int v7; // edx@4
|
29
|
4055 //char pSpriteName[120]; // [sp+Ch] [bp-88h]@2
|
0
|
4056 MonsterInfo *v9; // [sp+84h] [bp-10h]@1
|
29
|
4057 //int v10; // [sp+88h] [bp-Ch]@1
|
|
4058 //char *Source; // [sp+8Ch] [bp-8h]@1
|
|
4059 //unsigned __int16 *v12; // [sp+90h] [bp-4h]@1
|
0
|
4060
|
29
|
4061 //v2 = this;
|
|
4062 //v10 = 8;
|
|
4063 v3 = &pMonsterList->pMonsters[pMonsterInfo.uID - 1];
|
|
4064 v9 = &pMonsterStats->pInfos[pMonsterInfo.uID - 1 + 1];
|
|
4065 //v12 = pSpriteIDs;
|
|
4066 //Source = (char *)v3->pSpriteNames;
|
|
4067 //do
|
|
4068 for (uint i = 0; i < 8; ++i)
|
0
|
4069 {
|
29
|
4070 //strcpy(pSpriteName, v3->pSpriteNames[i]);
|
|
4071 pSpriteIDs[i] = pSpriteFrameTable->FastFindSprite(v3->pSpriteNames[i]);
|
|
4072 //*v12 = v4;
|
|
4073 pSpriteFrameTable->InitializeSprite(pSpriteIDs[i]);
|
|
4074 //++v12;
|
|
4075 //Source += 10;
|
|
4076 //--v10;
|
0
|
4077 }
|
29
|
4078 //while ( v10 );
|
|
4079 uActorHeight = v3->uMonsterHeight;
|
|
4080 uActorRadius = v3->uMonsterRadius;
|
|
4081 uMovementSpeed = LOWORD(v9->uBaseSpeed);
|
0
|
4082 if ( !(load_sounds_if_bit1_set & 1) )
|
|
4083 {
|
29
|
4084 v5 = pSoundSampleIDs;
|
0
|
4085 v6 = v3->pSoundSampleIDs;
|
|
4086 v7 = 4;
|
|
4087 do
|
|
4088 {
|
|
4089 *v5 = *v6;
|
|
4090 ++v6;
|
|
4091 ++v5;
|
|
4092 --v7;
|
|
4093 }
|
|
4094 while ( v7 );
|
|
4095 }
|
|
4096 }
|
|
4097
|
|
4098
|
|
4099 //----- (00459667) --------------------------------------------------------
|
|
4100 void Actor::Remove()
|
|
4101 {
|
|
4102 this->uAIState = Removed;
|
|
4103 }
|
|
4104
|
|
4105
|
|
4106 //----- (0044FD29) --------------------------------------------------------
|
|
4107 int Actor::_44FD29(int a2)
|
|
4108 {
|
|
4109 Actor *v2; // edi@1
|
|
4110 unsigned __int8 v3; // al@1
|
|
4111 int v4; // esi@1
|
|
4112 int v5; // edx@2
|
|
4113 int v6; // eax@8
|
|
4114 int v7; // edi@10
|
|
4115 Actor *v8; // esi@10
|
|
4116 MonsterInfo *v9; // ebx@10
|
|
4117 MonsterDesc *v10; // edi@10
|
|
4118 unsigned __int16 v11; // ax@10
|
|
4119 int v12; // eax@10
|
|
4120 int v13; // ebx@10
|
|
4121 int v14; // eax@10
|
|
4122 int v15; // edi@10
|
|
4123 int v16; // eax@10
|
|
4124 int v17; // ebx@10
|
|
4125 Actor *v18; // ecx@10
|
|
4126 signed __int64 v19; // qax@10
|
|
4127 unsigned int v20; // eax@12
|
|
4128 int v21; // eax@13
|
|
4129 int result; // eax@13
|
|
4130 Actor *v23; // eax@16
|
|
4131 int v24; // [sp+Ch] [bp-1Ch]@1
|
71
|
4132 unsigned int uFaceID; // [sp+10h] [bp-18h]@8
|
0
|
4133 int v26; // [sp+14h] [bp-14h]@10
|
|
4134 int v27; // [sp+18h] [bp-10h]@10
|
|
4135 int v28; // [sp+1Ch] [bp-Ch]@8
|
|
4136 int v29; // [sp+20h] [bp-8h]@10
|
|
4137 Actor *v30; // [sp+24h] [bp-4h]@1
|
|
4138
|
|
4139 v2 = this;
|
|
4140 v24 = a2;
|
|
4141 v30 = this;
|
|
4142 v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls;
|
|
4143 v4 = this->pMonsterInfo.field_3C_some_special_attack;
|
|
4144 if ( v3 )
|
|
4145 {
|
|
4146 if ( v3 >= 1u && v3 <= 3u )
|
|
4147 v4 = v4 + v3 - 1;
|
|
4148 }
|
|
4149 else
|
|
4150 {
|
|
4151 v5 = rand() % 100;
|
|
4152 if ( v5 >= 60 )
|
|
4153 {
|
|
4154 ++v4;
|
|
4155 if ( v5 >= 90 )
|
|
4156 ++v4;
|
|
4157 }
|
|
4158 }
|
|
4159 v6 = v2->vPosition.z;
|
|
4160 v28 = 0;
|
71
|
4161 uFaceID = v6;
|
0
|
4162 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
4163 v28 = pIndoor->GetSector(v2->vPosition.x, v2->vPosition.y, v6);
|
|
4164 v7 = v4 - 1;
|
|
4165 v8 = &pActors[uNumActors];
|
|
4166 v27 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
|
|
4167 v29 = v7;
|
|
4168 v9 = &pMonsterStats->pInfos[v7 + 1];
|
|
4169 pActors[uNumActors].Reset();
|
|
4170 v10 = &pMonsterList->pMonsters[v7];
|
|
4171 strcpy(v8->pActorName, v9->pName);
|
|
4172 v8->sCurrentHP = LOWORD(v9->uHP);
|
|
4173 memcpy(&v8->pMonsterInfo, v9, 0x58u);
|
|
4174 v8->word_000086_some_monster_id = v29 + 1;
|
|
4175 v8->uActorRadius = v10->uMonsterRadius;
|
|
4176 v8->uActorHeight = v10->uMonsterHeight;
|
|
4177 v11 = v10->uMovementSpeed;
|
|
4178 v8->pMonsterInfo.uTreasureDiceRolls = 0;
|
|
4179 v8->pMonsterInfo.uTreasureType = 0;
|
|
4180 v8->pMonsterInfo.uExp = 0;
|
|
4181 v8->uMovementSpeed = v11;
|
|
4182 v12 = rand();
|
|
4183 v13 = v12 % 2048;
|
|
4184 v14 = stru_5C6E00->SinCos(v12 % 2048);
|
|
4185 v26 = v14;
|
|
4186 v15 = ((unsigned __int64)(v14 * (signed __int64)v27) >> 16) + v30->vPosition.x;
|
|
4187 v16 = stru_5C6E00->SinCos(v13 - stru_5C6E00->uIntegerHalfPi);
|
|
4188 v26 = v16;
|
|
4189 v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16;
|
71
|
4190 LOWORD(v16) = uFaceID;
|
0
|
4191 v17 = v29 + v30->vPosition.y;
|
71
|
4192 v8->vInitialPosition.z = uFaceID;
|
0
|
4193 v8->vPosition.z = v16;
|
|
4194 LOWORD(v16) = v28;
|
|
4195 v8->vInitialPosition.x = v15;
|
|
4196 v8->vPosition.x = v15;
|
|
4197 v8->vInitialPosition.y = v17;
|
|
4198 v8->vPosition.y = v17;
|
|
4199 v8->uTetherDistance = 256;
|
|
4200 v8->uSectorID = v16;
|
|
4201 v8->PrepareSprites(0);
|
|
4202 v18 = v30;
|
29
|
4203 v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
|
0
|
4204 LODWORD(v19) = v18->uAlly;
|
|
4205 if ( !(uint)v19 )
|
|
4206 {
|
71
|
4207 uFaceID = v18->pMonsterInfo.uID - 1;
|
|
4208 v19 = (signed __int64)((double)uFaceID * 0.33333334);
|
0
|
4209 v18 = v30;
|
|
4210 }
|
|
4211 v8->uAlly = v19;
|
|
4212 v20 = v18->uGroup;
|
|
4213 v8->uCurrentActionTime = 0;
|
|
4214 v8->uGroup = v20;
|
45
|
4215 v8->uAIState = Summoned;
|
0
|
4216 v8->uCurrentActionLength = 256;
|
|
4217 v8->UpdateAnimation();
|
|
4218 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor
|
|
4219 || (v21 = v30->vPosition.z,
|
|
4220 v27 = v30->vPosition.z,
|
|
4221 result = pIndoor->GetSector(v15, v17, v21),
|
|
4222 result == v28)
|
71
|
4223 && (result = _46CEC3_get_floor_level(v15, v17, v27, result, &uFaceID), result != -30000)
|
0
|
4224 && (result = abs(result - v27), result <= 1024) )
|
|
4225 {
|
|
4226 v23 = v30;
|
|
4227 ++uNumActors;
|
|
4228 ++v23->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
|
|
4229 if ( v23->uAttributes & 0x80000 )
|
|
4230 v8->uAttributes |= 0x80000u;
|
|
4231 result = 8 * v24;
|
|
4232 LOBYTE(result) = 8 * v24 | 3;
|
|
4233 v8->uSummonerID = result;
|
|
4234 }
|
|
4235 return result;
|
|
4236 } |