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