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