Mercurial > mm7
comparison Actor.cpp @ 2254:2e02c384c62b
Merge
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 23:35:46 +0100 |
parents | aff7a7b072b7 47bcb700b74b |
children | e2433db49428 |
comparison
equal
deleted
inserted
replaced
2253:aff7a7b072b7 | 2254:2e02c384c62b |
---|---|
95 v9 = uTextureID_mhp_yel; | 95 v9 = uTextureID_mhp_yel; |
96 else | 96 else |
97 v9 = uTextureID_mhp_grn; | 97 v9 = uTextureID_mhp_grn; |
98 | 98 |
99 if ( actor->sCurrentHP < (int)actor->pMonsterInfo.uHP ) | 99 if ( actor->sCurrentHP < (int)actor->pMonsterInfo.uHP ) |
100 { | |
101 v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP; | 100 v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP; |
102 } | |
103 | 101 |
104 uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2; | 102 uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2; |
105 | 103 |
106 pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52); | 104 pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52); |
107 pRenderer->DrawTextureIndexed(uX, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); | 105 pRenderer->DrawTextureIndexed(uX, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); |
117 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle) | 115 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle) |
118 { | 116 { |
119 if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) ) | 117 if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) ) |
120 { | 118 { |
121 if ( bToggle ) | 119 if ( bToggle ) |
122 { | |
123 pActors[uActorID].uAttributes |= uFlag; | 120 pActors[uActorID].uAttributes |= uFlag; |
124 } | |
125 else | 121 else |
126 { | 122 { |
127 if ( uFlag == 0x10000 ) | 123 if ( uFlag == 0x10000 ) |
128 { | 124 { |
129 if (pActors[uActorID].uAIState == Disabled ) | 125 if (pActors[uActorID].uAIState == Disabled ) |
138 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) | 134 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) |
139 { | 135 { |
140 for (uint i = 0; i < uNumActors; i++) | 136 for (uint i = 0; i < uNumActors; i++) |
141 { | 137 { |
142 if (pActors[uNumActors].sNPC_ID == npc) | 138 if (pActors[uNumActors].sNPC_ID == npc) |
143 { | |
144 Actor::GiveItem(i, item, a3); | 139 Actor::GiveItem(i, item, a3); |
145 } | |
146 } | 140 } |
147 } | 141 } |
148 | 142 |
149 //----- (004485A7) -------------------------------------------------------- | 143 //----- (004485A7) -------------------------------------------------------- |
150 void Actor::GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive) | 144 void Actor::GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive) |
151 { | 145 { |
152 if ( (uActorID >= 0) && (signed int)uActorID <= (signed int)(uNumActors - 1) ) | 146 if ( (uActorID >= 0) && (signed int)uActorID <= (signed int)(uNumActors - 1) ) |
153 { | 147 { |
154 Actor* currActor = &pActors[uActorID]; | |
155 if ( bGive ) | 148 if ( bGive ) |
156 { | 149 { |
157 if ( currActor->uCarriedItemID == 0) | 150 if ( pActors[uActorID].uCarriedItemID == 0) |
158 currActor->uCarriedItemID = uItemID; | 151 pActors[uActorID].uCarriedItemID = uItemID; |
159 else if ( currActor->array_000234[0].uItemID == 0) | 152 else if ( pActors[uActorID].array_000234[0].uItemID == 0) |
160 currActor->array_000234[0].uItemID = uItemID; | 153 pActors[uActorID].array_000234[0].uItemID = uItemID; |
161 else if ( currActor->array_000234[1].uItemID == 0) | 154 else if ( pActors[uActorID].array_000234[1].uItemID == 0) |
162 currActor->array_000234[1].uItemID = uItemID; | 155 pActors[uActorID].array_000234[1].uItemID = uItemID; |
163 } | 156 } |
164 else | 157 else |
165 { | 158 { |
166 if ( currActor->uCarriedItemID == uItemID ) | 159 if ( pActors[uActorID].uCarriedItemID == uItemID ) |
167 currActor->uCarriedItemID = 0; | 160 pActors[uActorID].uCarriedItemID = 0; |
168 else if ( currActor->array_000234[0].uItemID == uItemID ) | 161 else if ( pActors[uActorID].array_000234[0].uItemID == uItemID ) |
169 currActor->array_000234[0].Reset(); | 162 pActors[uActorID].array_000234[0].Reset(); |
170 else if ( currActor->array_000234[1].uItemID == uItemID ) | 163 else if ( pActors[uActorID].array_000234[1].uItemID == uItemID ) |
171 currActor->array_000234[1].Reset(); | 164 pActors[uActorID].array_000234[1].Reset(); |
172 } | 165 } |
173 } | 166 } |
174 } | 167 } |
175 | 168 |
176 //----- (0040894B) -------------------------------------------------------- | 169 //----- (0040894B) -------------------------------------------------------- |
177 bool Actor::CanAct() | 170 bool Actor::CanAct() |
178 { | 171 { |
179 bool isparalyzed; // esi@1 | 172 bool isparalyzed; // esi@1 |
180 bool isstoned; // edi@2 | 173 bool isstoned; // edi@2 |
181 AIState v3; // ax@6 | |
182 | 174 |
183 isstoned = (signed __int64)this->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0;// stoned | 175 isstoned = (signed __int64)this->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0;// stoned |
184 isparalyzed = (signed __int64)this->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0;// paralyzed | 176 isparalyzed = (signed __int64)this->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0;// paralyzed |
185 v3 = this->uAIState; | 177 return !(isstoned || isparalyzed || this->uAIState == Dying || this->uAIState == Dead |
186 return !(isstoned || isparalyzed || v3 == Dying || v3 == Dead || v3 == Removed || v3 == Summoned || v3 == Disabled); | 178 || this->uAIState == Removed || this->uAIState == Summoned || this->uAIState == Disabled); |
187 } | 179 } |
188 | 180 |
189 //----- (004089C7) -------------------------------------------------------- | 181 //----- (004089C7) -------------------------------------------------------- |
190 bool Actor::IsNotAlive() | 182 bool Actor::IsNotAlive() |
191 { | 183 { |
197 | 189 |
198 //----- (004086E9) -------------------------------------------------------- | 190 //----- (004086E9) -------------------------------------------------------- |
199 void Actor::SetRandomGoldIfTheresNoItem() | 191 void Actor::SetRandomGoldIfTheresNoItem() |
200 { | 192 { |
201 int v2; // edi@1 | 193 int v2; // edi@1 |
202 unsigned __int8 v4; // al@7 | |
203 | 194 |
204 v2 = 0; | 195 v2 = 0; |
205 if ( !this->array_000234[3].uItemID ) | 196 if ( !this->array_000234[3].uItemID ) |
206 { | 197 { |
207 if ( this->pMonsterInfo.uTreasureDiceRolls ) | 198 if ( this->pMonsterInfo.uTreasureDiceRolls ) |
208 { | 199 { |
209 for (int i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++) | 200 for (int i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++) |
210 { | |
211 v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; | 201 v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; |
212 } | |
213 if ( v2 ) | 202 if ( v2 ) |
214 { | 203 { |
215 this->array_000234[3].uItemID = 197; | 204 this->array_000234[3].uItemID = 197; |
216 this->array_000234[3].uSpecEnchantmentType = v2; //actual gold amount | 205 this->array_000234[3].uSpecEnchantmentType = v2; //actual gold amount |
217 } | 206 } |
218 } | 207 } |
219 } | 208 } |
220 if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance ) | 209 if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance ) |
221 { | 210 { |
222 v4 = this->pMonsterInfo.uTreasureLevel; | 211 if ( this->pMonsterInfo.uTreasureLevel ) |
223 if ( v4 ) | 212 pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->array_000234[2]); |
224 pItemsTable->GenerateItem(v4, this->pMonsterInfo.uTreasureType, &this->array_000234[2]); | |
225 } | 213 } |
226 this->uAttributes |= 0x800000; | 214 this->uAttributes |= 0x800000; |
227 } | 215 } |
228 | 216 |
229 //----- (00404AC7) -------------------------------------------------------- | 217 //----- (00404AC7) -------------------------------------------------------- |
246 int v42; // ecx@91 | 234 int v42; // ecx@91 |
247 int v44; // ecx@100 | 235 int v44; // ecx@100 |
248 int v48; // ecx@110 | 236 int v48; // ecx@110 |
249 int v51; // ecx@130 | 237 int v51; // ecx@130 |
250 int v54; // ecx@138 | 238 int v54; // ecx@138 |
251 Player *v57; // esi@145 | 239 //Player *v57; // esi@145 |
252 int v58; // eax@146 | 240 //int v58; // eax@146 |
253 int v59; // edi@146 | 241 int v59; // edi@146 |
254 int v60; // eax@146 | 242 //int v60; // eax@146 |
255 int v61; // edi@146 | 243 int v61; // edi@146 |
256 int v62; // eax@146 | 244 //int v62; // eax@146 |
257 signed int v63; // edi@146 | 245 signed int v63; // edi@146 |
258 int v68; // edi@168 | 246 int v68; // edi@168 |
259 signed int v70; // ecx@172 | 247 signed int v70; // ecx@172 |
260 int v79; // edx@185 | 248 int v79; // edx@185 |
261 int v80; // eax@185 | 249 int v80; // eax@185 |
262 signed int v89; // ecx@192 | 250 //signed int v89; // ecx@192 |
263 signed int v91; // eax@200 | 251 signed int v91; // eax@200 |
264 int v94; // ecx@208 | 252 int v94; // ecx@208 |
265 int v96; // ecx@217 | 253 int v96; // ecx@217 |
266 int pitch; // [sp+2Ch] [bp-A4h]@51 | 254 int pitch; // [sp+2Ch] [bp-A4h]@51 |
267 int v114; // [sp+48h] [bp-88h]@41 | 255 int v114; // [sp+48h] [bp-88h]@41 |
308 a1.vPosition.y = actorPtr->vPosition.y; | 296 a1.vPosition.y = actorPtr->vPosition.y; |
309 a1.vPosition.z = actorPtr->vPosition.z + ((signed int)actorPtr->uActorHeight >> 1); | 297 a1.vPosition.z = actorPtr->vPosition.z + ((signed int)actorPtr->uActorHeight >> 1); |
310 a1.uFacing = LOWORD(pDir->uYawAngle); | 298 a1.uFacing = LOWORD(pDir->uYawAngle); |
311 a1.uSoundID = 0; | 299 a1.uSoundID = 0; |
312 a1.uAttributes = 0; | 300 a1.uAttributes = 0; |
313 v89 = pDir->uDistance; | |
314 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | 301 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); |
315 a1.uSpriteFrameID = 0; | 302 a1.uSpriteFrameID = 0; |
316 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); | 303 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); |
317 a1.spell_target_pid = 0; | 304 a1.spell_target_pid = 0; |
318 if ((double)v89 < 307.2 ) | 305 if ((double)pDir->uDistance < 307.2 ) |
319 a1.field_60_distance_related_prolly_lod = 0; | 306 a1.field_60_distance_related_prolly_lod = 0; |
320 else if ( v89 < 1024 ) | 307 else if ( pDir->uDistance < 1024 ) |
321 a1.field_60_distance_related_prolly_lod = 1; | 308 a1.field_60_distance_related_prolly_lod = 1; |
322 else if ( v89 < 2560 ) | 309 else if ( pDir->uDistance < 2560 ) |
323 a1.field_60_distance_related_prolly_lod = 2; | 310 a1.field_60_distance_related_prolly_lod = 2; |
324 else | 311 else |
325 a1.field_60_distance_related_prolly_lod = 3; | 312 a1.field_60_distance_related_prolly_lod = 3; |
326 | 313 |
327 a1.field_61 = 2; | 314 a1.field_61 = 2; |
328 v91 = a1.Create( | 315 v91 = a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
329 pDir->uYawAngle, | |
330 pDir->uPitchAngle, | |
331 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
332 0); | |
333 if ( v91 != -1 ) | 316 if ( v91 != -1 ) |
334 { | 317 { |
335 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], PID(OBJECT_Item, v91), 0, -1, 0, 0, 0, 0); | 318 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], PID(OBJECT_Item, v91), 0, -1, 0, 0, 0, 0); |
336 return; | 319 return; |
337 } | 320 } |
345 v39 = 180 * (realPoints + 20); | 328 v39 = 180 * (realPoints + 20); |
346 else if (masteryLevel == 4 ) | 329 else if (masteryLevel == 4 ) |
347 v39 = 240 * (realPoints + 15); | 330 v39 = 240 * (realPoints + 15); |
348 else | 331 else |
349 v39 = 0; | 332 v39 = 0; |
350 actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply( | 333 actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), |
351 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), | 334 masteryLevel, 0, 0, 0); |
352 masteryLevel, | |
353 0, | |
354 0, | |
355 0); | |
356 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu); | 335 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu); |
357 pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 336 pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
358 return; | 337 return; |
359 | 338 |
360 case SPELL_FIRE_METEOR_SHOWER: | 339 case SPELL_FIRE_METEOR_SHOWER: |
411 else if ( pDir->uDistance < 2560 ) | 390 else if ( pDir->uDistance < 2560 ) |
412 a1.field_60_distance_related_prolly_lod = 2; | 391 a1.field_60_distance_related_prolly_lod = 2; |
413 else | 392 else |
414 a1.field_60_distance_related_prolly_lod = 3; | 393 a1.field_60_distance_related_prolly_lod = 3; |
415 a1.field_61 = 2; | 394 a1.field_61 = 2; |
416 v36 = a1.Create( | 395 v36 = a1.Create(v32, pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
417 v32, | |
418 pitch, | |
419 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
420 0); | |
421 if ( v36 != -1 ) | 396 if ( v36 != -1 ) |
422 { | |
423 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], PID(OBJECT_Item, v36), 0, -1, 0, 0, 0, 0); | 397 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], PID(OBJECT_Item, v36), 0, -1, 0, 0, 0, 0); |
424 } | |
425 spellnumb = rand() % 1024 - 512; | 398 spellnumb = rand() % 1024 - 512; |
426 v28 = rand() % 1024 - 512; | 399 v28 = rand() % 1024 - 512; |
427 } | 400 } |
428 return; | 401 return; |
429 break; | 402 break; |
458 a1.spell_target_pid = 0; | 431 a1.spell_target_pid = 0; |
459 a1.field_60_distance_related_prolly_lod = 3; | 432 a1.field_60_distance_related_prolly_lod = 3; |
460 v19 = spellnuma / -2; | 433 v19 = spellnuma / -2; |
461 a1a = spellnuma / 2; | 434 a1a = spellnuma / 2; |
462 if ( spellnuma / -2 > spellnuma / 2 ) | 435 if ( spellnuma / -2 > spellnuma / 2 ) |
463 { | |
464 v20 = spellnuma / 2; | 436 v20 = spellnuma / 2; |
465 } | |
466 else | 437 else |
467 { | 438 { |
468 do | 439 do |
469 { | 440 { |
470 a1.uFacing = v19 + LOWORD(pDir->uYawAngle); | 441 a1.uFacing = v19 + LOWORD(pDir->uYawAngle); |
471 v20 = a1.Create( | 442 v20 = a1.Create((signed __int16)a1.uFacing, pDir->uPitchAngle, |
472 (signed __int16)a1.uFacing, | 443 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
473 pDir->uPitchAngle, | |
474 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
475 0); | |
476 v19 += v118; | 444 v19 += v118; |
477 } | 445 } |
478 while ( v19 <= a1a ); | 446 while ( v19 <= a1a ); |
479 } | 447 } |
480 if ( v20 != -1 ) | 448 if ( v20 != -1 ) |
494 v8 = 3600 * (realPoints + 64); | 462 v8 = 3600 * (realPoints + 64); |
495 else | 463 else |
496 v8 = 0; | 464 v8 = 0; |
497 actorPtr->pActorBuffs[ACTOR_BUFF_SHIELD].Apply( | 465 actorPtr->pActorBuffs[ACTOR_BUFF_SHIELD].Apply( |
498 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335), | 466 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335), |
499 masteryLevel, | 467 masteryLevel, 0, 0, 0); |
500 0, | |
501 0, | |
502 0); | |
503 return; | 468 return; |
504 | 469 |
505 case SPELL_EARTH_STONESKIN: | 470 case SPELL_EARTH_STONESKIN: |
506 if (masteryLevel == 1 || masteryLevel == 2) | 471 if (masteryLevel == 1 || masteryLevel == 2) |
507 v44 = 300 * realPoints + 3840; | 472 v44 = 300 * realPoints + 3840; |
511 v44 = 3600 * (realPoints + 64); | 476 v44 = 3600 * (realPoints + 64); |
512 else | 477 else |
513 v44 = 0; | 478 v44 = 0; |
514 actorPtr->pActorBuffs[ACTOR_BUFF_STONESKIN].Apply( | 479 actorPtr->pActorBuffs[ACTOR_BUFF_STONESKIN].Apply( |
515 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335), | 480 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335), |
516 masteryLevel, | 481 masteryLevel, realPoints + 5, 0, 0); |
517 realPoints + 5, | |
518 0, | |
519 0); | |
520 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu); | 482 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu); |
521 pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); | 483 pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); |
522 return; | 484 return; |
523 | 485 |
524 case SPELL_SPIRIT_BLESS: | 486 case SPELL_SPIRIT_BLESS: |
530 v42 = 1200 * realPoints + 3840; | 492 v42 = 1200 * realPoints + 3840; |
531 else | 493 else |
532 v42 = 0; | 494 v42 = 0; |
533 actorPtr->pActorBuffs[ACTOR_BUFF_BLESS].Apply( | 495 actorPtr->pActorBuffs[ACTOR_BUFF_BLESS].Apply( |
534 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335), | 496 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335), |
535 masteryLevel, | 497 masteryLevel, realPoints + 5, 0, 0); |
536 realPoints + 5, | |
537 0, | |
538 0); | |
539 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); | 498 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); |
540 pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); | 499 pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); |
541 return; | 500 return; |
542 break; | 501 break; |
543 | 502 |
564 v54 = 1200 * realPoints + 3840; | 523 v54 = 1200 * realPoints + 3840; |
565 else | 524 else |
566 v54 = 0; | 525 v54 = 0; |
567 actorPtr->pActorBuffs[ACTOR_BUFF_HEROISM].Apply( | 526 actorPtr->pActorBuffs[ACTOR_BUFF_HEROISM].Apply( |
568 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335), | 527 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335), |
569 masteryLevel, | 528 masteryLevel, realPoints + 5, 0, 0); |
570 realPoints + 5, | |
571 0, | |
572 0); | |
573 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); | 529 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); |
574 pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); | 530 pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); |
575 return; | 531 return; |
576 | 532 |
577 case SPELL_BODY_HAMMERHANDS: | 533 case SPELL_BODY_HAMMERHANDS: |
597 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 553 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
598 return; | 554 return; |
599 | 555 |
600 case SPELL_LIGHT_DISPEL_MAGIC: | 556 case SPELL_LIGHT_DISPEL_MAGIC: |
601 for (int i = 0; i < 20; i++ ) | 557 for (int i = 0; i < 20; i++ ) |
602 { | |
603 pParty->pPartyBuffs[i].Reset(); | 558 pParty->pPartyBuffs[i].Reset(); |
604 } | |
605 for (int i = 1; i <= 4; i++) | 559 for (int i = 1; i <= 4; i++) |
606 { | 560 { |
607 v57 = pPlayers[i]; | 561 v59 = pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualWillpower()); |
608 v58 = v57->GetActualWillpower(); | 562 v61 = (pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualIntelligence()) + v59) / 2; |
609 v59 = v57->GetParameterBonus(v58); | 563 v63 = v61 + pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualLuck()) + 30; |
610 v60 = v57->GetActualIntelligence(); | |
611 v61 = (v57->GetParameterBonus(v60) + v59) / 2; | |
612 v62 = v57->GetActualLuck(); | |
613 v63 = v61 + v57->GetParameterBonus(v62) + 30; | |
614 if ( rand() % v63 < 30 ) | 564 if ( rand() % v63 < 30 ) |
615 { | 565 { |
616 for (uint k = 0; k < v57->pPlayerBuffs.size(); k++) | 566 for (uint k = 0; k < pPlayers[i]->pPlayerBuffs.size(); k++) |
617 { | 567 pPlayers[i]->pPlayerBuffs[k].Reset(); |
618 v57->pPlayerBuffs[k].Reset(); | |
619 } | |
620 pOtherOverlayList->_4418B1(11210, i + 99, 0, 65536); | 568 pOtherOverlayList->_4418B1(11210, i + 99, 0, 65536); |
621 } | 569 } |
622 } | 570 } |
623 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[80], PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 571 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[80], PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
624 return; | 572 return; |
625 | 573 |
626 case SPELL_LIGHT_DAY_OF_PROTECTION: | 574 case SPELL_LIGHT_DAY_OF_PROTECTION: |
627 if (masteryLevel == 1 || masteryLevel == 2) | 575 if (masteryLevel == 1 || masteryLevel == 2) |
628 { | |
629 v96 = 300 * realPoints + 3840; | 576 v96 = 300 * realPoints + 3840; |
630 } | |
631 else if (masteryLevel == 3 ) | 577 else if (masteryLevel == 3 ) |
632 { | 578 { |
633 LOWORD(realPoints) = 3 * realPoints; | 579 LOWORD(realPoints) = 3 * realPoints; |
634 v96 = 900 * (uSkillLevel & 0x3F) + 3840; | 580 v96 = 900 * (uSkillLevel & 0x3F) + 3840; |
635 } | 581 } |
643 LOWORD(realPoints) = uSkillLevel; | 589 LOWORD(realPoints) = uSkillLevel; |
644 v96 = 0; | 590 v96 = 0; |
645 } | 591 } |
646 actorPtr->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].Apply( | 592 actorPtr->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].Apply( |
647 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335), | 593 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335), |
648 masteryLevel, | 594 masteryLevel, realPoints, 0, 0); |
649 realPoints, | |
650 0, | |
651 0); | |
652 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); | 595 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); |
653 pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 596 pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
654 return; | 597 return; |
655 | 598 |
656 case SPELL_LIGHT_HOUR_OF_POWER: | 599 case SPELL_LIGHT_HOUR_OF_POWER: |
662 v94 = 1200 * realPoints + 3840; | 605 v94 = 1200 * realPoints + 3840; |
663 else | 606 else |
664 v94 = 0; | 607 v94 = 0; |
665 actorPtr->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].Apply( | 608 actorPtr->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].Apply( |
666 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335), | 609 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335), |
667 masteryLevel, | 610 masteryLevel, realPoints + 5, 0, 0); |
668 realPoints + 5, | |
669 0, | |
670 0); | |
671 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); | 611 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); |
672 pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 612 pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
673 return; | 613 return; |
674 | 614 |
675 case SPELL_DARK_SHARPMETAL: | 615 case SPELL_DARK_SHARPMETAL: |
701 a1.uSpriteFrameID = 0; | 641 a1.uSpriteFrameID = 0; |
702 a1.spell_target_pid = 0; | 642 a1.spell_target_pid = 0; |
703 a1.field_60_distance_related_prolly_lod = 3; | 643 a1.field_60_distance_related_prolly_lod = 3; |
704 a1c = spellnume / -2; | 644 a1c = spellnume / -2; |
705 if ( spellnume / -2 > spellnume / 2 ) | 645 if ( spellnume / -2 > spellnume / 2 ) |
706 { | |
707 v80 = spellnume / -2; | 646 v80 = spellnume / -2; |
708 } | |
709 else | 647 else |
710 { | 648 { |
711 do | 649 do |
712 { | 650 { |
713 v79 = pDir->uYawAngle; | 651 v79 = pDir->uYawAngle; |
714 a1.uFacing = a1c + LOWORD(pDir->uYawAngle); | 652 a1.uFacing = a1c + LOWORD(pDir->uYawAngle); |
715 v80 = a1.Create( | 653 v80 = a1.Create(v79, pDir->uPitchAngle, |
716 v79, | 654 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
717 pDir->uPitchAngle, | |
718 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
719 0); | |
720 a1c += v116; | 655 a1c += v116; |
721 } | 656 } |
722 while ( a1c <= spellnume / 2 ); | 657 while ( a1c <= spellnume / 2 ); |
723 } | 658 } |
724 if ( v80 != -1 ) | 659 if ( v80 != -1 ) |
736 v68 = 300 * realPoints + 3840; | 671 v68 = 300 * realPoints + 3840; |
737 else | 672 else |
738 v68 = 900 * realPoints + 3840; | 673 v68 = 900 * realPoints + 3840; |
739 actorPtr->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].Apply( | 674 actorPtr->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].Apply( |
740 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335), | 675 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335), |
741 masteryLevel, | 676 masteryLevel, 0, 0, 0); |
742 0, | |
743 0, | |
744 0); | |
745 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu); | 677 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu); |
746 pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 678 pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
747 return; | 679 return; |
748 } | 680 } |
749 } | 681 } |
750 | |
751 | 682 |
752 //----- (new func) -------------------------------------------------------- | 683 //----- (new func) -------------------------------------------------------- |
753 unsigned short Actor::GetObjDescId( int spellId ) | 684 unsigned short Actor::GetObjDescId( int spellId ) |
754 { | 685 { |
755 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++) | 686 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++) |
792 { | 723 { |
793 int v4; // ebx@8 | 724 int v4; // ebx@8 |
794 int v5; // ST1C_4@8 | 725 int v5; // ST1C_4@8 |
795 int v6; // eax@8 | 726 int v6; // eax@8 |
796 | 727 |
797 int x = 0; BYTE2(x) |= 8u; | 728 int x = 0; x |= 0x80000; |
798 int y = 0; y |= 0x80000; | 729 int y = 0; y |= 0x80000; |
799 Actor* victim = &pActors[uActorID]; | 730 Actor* victim = &pActors[uActorID]; |
800 if ( a2 == 1 ) | 731 if ( a2 == 1 ) |
801 victim->uAttributes |= 0x80000; | 732 victim->uAttributes |= 0x80000; |
802 | 733 |
823 } | 754 } |
824 | 755 |
825 //----- (00404874) -------------------------------------------------------- | 756 //----- (00404874) -------------------------------------------------------- |
826 void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 ) | 757 void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 ) |
827 { | 758 { |
828 Actor *actPtr; // esi@1 | 759 //Actor *actPtr; // esi@1 |
829 char specAb; // al@1 | 760 char specAb; // al@1 |
830 int v13; // edx@28 | 761 int v13; // edx@28 |
831 | 762 |
832 actPtr = &pActors[uActorID]; | 763 //actPtr = &pActors[uActorID]; |
833 | 764 |
834 SpriteObject a1; // [sp+Ch] [bp-74h]@1 | 765 SpriteObject a1; // [sp+Ch] [bp-74h]@1 |
835 | 766 |
836 switch ( type ) | 767 switch ( type ) |
837 { | 768 { |
888 { | 819 { |
889 Error("Item not found"); | 820 Error("Item not found"); |
890 return; | 821 return; |
891 } | 822 } |
892 a1.stru_24.Reset(); | 823 a1.stru_24.Reset(); |
893 a1.vPosition.x = actPtr->vPosition.x; | 824 a1.vPosition.x = pActors[uActorID].vPosition.x; |
894 a1.spell_id = 0; | 825 a1.spell_id = 0; |
895 a1.vPosition.y = actPtr->vPosition.y; | 826 a1.vPosition.y = pActors[uActorID].vPosition.y; |
896 a1.spell_level = 0; | 827 a1.spell_level = 0; |
897 a1.spell_skill = 0; | 828 a1.spell_skill = 0; |
898 a1.vPosition.z = actPtr->vPosition.z - (unsigned int)(actPtr->uActorHeight * -0.75); | 829 a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); |
899 a1.uFacing = pDir->uYawAngle; | 830 a1.uFacing = pDir->uYawAngle; |
900 a1.uSoundID = 0; | 831 a1.uSoundID = 0; |
901 a1.uAttributes = 0; | 832 a1.uAttributes = 0; |
902 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | 833 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); |
903 a1.uSpriteFrameID = 0; | 834 a1.uSpriteFrameID = 0; |
911 a1.field_60_distance_related_prolly_lod = 2; | 842 a1.field_60_distance_related_prolly_lod = 2; |
912 else | 843 else |
913 a1.field_60_distance_related_prolly_lod = 3; | 844 a1.field_60_distance_related_prolly_lod = 3; |
914 | 845 |
915 a1.field_61 = a4; | 846 a1.field_61 = a4; |
916 a1.Create( | 847 a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
917 pDir->uYawAngle, | 848 if ( pActors[uActorID].pMonsterInfo.uSpecialAbilityType == 1 ) |
918 pDir->uPitchAngle, | 849 { |
919 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | 850 specAb = pActors[uActorID].pMonsterInfo.uSpecialAbilityDamageDiceBonus; |
920 0); | |
921 if ( actPtr->pMonsterInfo.uSpecialAbilityType == 1 ) | |
922 { | |
923 specAb = actPtr->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | |
924 if ( specAb == 2 ) | 851 if ( specAb == 2 ) |
925 { | 852 { |
926 a1.vPosition.z += 40; | 853 a1.vPosition.z += 40; |
927 v13 = pDir->uYawAngle; | 854 v13 = pDir->uYawAngle; |
928 } | 855 } |
929 else | 856 else |
930 { | 857 { |
931 if ( specAb != 3 ) | 858 if ( specAb != 3 ) |
932 return; | 859 return; |
933 a1.Create( | 860 a1.Create(pDir->uYawAngle + 30, //TODO find out why the YawAngle change |
934 pDir->uYawAngle + 30, //TODO find out why the YawAngle change | 861 pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
935 pDir->uPitchAngle, | |
936 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
937 0); | |
938 v13 = pDir->uYawAngle - 30; | 862 v13 = pDir->uYawAngle - 30; |
939 } | 863 } |
940 a1.Create( | 864 a1.Create(v13, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); |
941 v13, | |
942 pDir->uPitchAngle, | |
943 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
944 0); | |
945 } | 865 } |
946 return; | 866 return; |
947 } | 867 } |
948 | 868 |
949 //----- (00404736) -------------------------------------------------------- | 869 //----- (00404736) -------------------------------------------------------- |
950 void Actor::Explode( unsigned int uActorID ) | 870 void Actor::Explode( unsigned int uActorID ) |
951 { | 871 { |
952 Actor *v1; // esi@1 | |
953 SpriteObject a1; // [sp+Ch] [bp-78h]@1 | 872 SpriteObject a1; // [sp+Ch] [bp-78h]@1 |
954 | 873 |
955 v1 = &pActors[uActorID]; | |
956 a1.uType = 600; | 874 a1.uType = 600; |
957 a1.uObjectDescID = GetObjDescId(a1.uType); | 875 a1.uObjectDescID = GetObjDescId(a1.uType); |
958 a1.stru_24.Reset(); | 876 a1.stru_24.Reset(); |
959 a1.vPosition.y = v1->vPosition.y; | |
960 a1.spell_id = 0; | 877 a1.spell_id = 0; |
961 a1.spell_level = 0; | 878 a1.spell_level = 0; |
962 a1.spell_skill = 0; | 879 a1.spell_skill = 0; |
963 a1.vPosition.x = v1->vPosition.x; | 880 a1.vPosition.x = pActors[uActorID].vPosition.x; |
881 a1.vPosition.y = pActors[uActorID].vPosition.y; | |
882 a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); | |
964 a1.uFacing = 0; | 883 a1.uFacing = 0; |
965 a1.vPosition.z = v1->vPosition.z - (unsigned int)(v1->uActorHeight * -0.75); | |
966 a1.uSoundID = 0; | 884 a1.uSoundID = 0; |
967 a1.uAttributes = 0; | 885 a1.uAttributes = 0; |
968 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | 886 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); |
969 a1.uSpriteFrameID = 0; | 887 a1.uSpriteFrameID = 0; |
970 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); | 888 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); |
1179 //----- (00404030) -------------------------------------------------------- | 1097 //----- (00404030) -------------------------------------------------------- |
1180 void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) | 1098 void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) |
1181 { | 1099 { |
1182 AIDirection *v7; // eax@3 | 1100 AIDirection *v7; // eax@3 |
1183 AIDirection v1; // eax@3 | 1101 AIDirection v1; // eax@3 |
1184 Actor *v9; // ebx@3 | 1102 //Actor *v9; // ebx@3 |
1185 AIDirection a3; // [sp+8h] [bp-38h]@4 | 1103 AIDirection a3; // [sp+8h] [bp-38h]@4 |
1186 | 1104 |
1187 if ( rand() % 100 >= 5 ) | 1105 if ( rand() % 100 >= 5 ) |
1188 { | 1106 { |
1189 v9 = &pActors[uActorID]; | 1107 //v9 = &pActors[uActorID]; |
1190 if ( !a4 ) | 1108 if ( !a4 ) |
1191 { | 1109 { |
1192 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), uObjID, &v1, 0); | 1110 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), uObjID, &v1, 0); |
1193 v7 = &v1; | 1111 v7 = &v1; |
1194 } | 1112 } |
1195 else | 1113 else |
1196 { | |
1197 v7 = a4; | 1114 v7 = a4; |
1198 } | 1115 pActors[uActorID].uYawAngle = v7->uYawAngle; |
1199 v9->uYawAngle = v7->uYawAngle; | 1116 pActors[uActorID].uCurrentActionTime = 0; |
1200 v9->uCurrentActionTime = 0; | 1117 pActors[uActorID].vVelocity.z = 0; |
1201 v9->vVelocity.z = 0; | 1118 pActors[uActorID].vVelocity.y = 0; |
1202 v9->vVelocity.y = 0; | 1119 pActors[uActorID].vVelocity.x = 0; |
1203 v9->vVelocity.x = 0; | 1120 pActors[uActorID].uPitchAngle = v7->uPitchAngle; |
1204 v9->uPitchAngle = v7->uPitchAngle; | 1121 pActors[uActorID].uCurrentActionLength = 256; |
1205 v9->uCurrentActionLength = 256; | 1122 pActors[uActorID].uAIState = Interacting; |
1206 v9->uAIState = Interacting; | 1123 pActors[uActorID].UpdateAnimation(); |
1207 v9->UpdateAnimation(); | |
1208 } | 1124 } |
1209 else | 1125 else |
1210 Actor::AI_Bored(uActorID, uObjID, a4); | 1126 Actor::AI_Bored(uActorID, uObjID, a4); |
1211 } | 1127 } |
1212 | 1128 |
1221 | 1137 |
1222 //----- (00403EB6) -------------------------------------------------------- | 1138 //----- (00403EB6) -------------------------------------------------------- |
1223 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) | 1139 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) |
1224 { | 1140 { |
1225 assert(uActorID < uNumActors); | 1141 assert(uActorID < uNumActors); |
1226 Actor* actor = &pActors[uActorID]; | 1142 // Actor* actor = &pActors[uActorID]; |
1227 | 1143 |
1228 AIDirection a3; | 1144 AIDirection a3; |
1229 if (!a4) | 1145 if (!a4) |
1230 { | 1146 { |
1231 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), object_to_face_pid, &a3, 0); | 1147 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), object_to_face_pid, &a3, 0); |
1232 a4 = &a3; | 1148 a4 = &a3; |
1233 } | 1149 } |
1234 | 1150 |
1235 actor->uAIState = Standing; | 1151 pActors[uActorID].uAIState = Standing; |
1236 if (!uActionLength) | 1152 if (!uActionLength) |
1237 actor->uCurrentActionLength = rand() % 256 + 256; | 1153 pActors[uActorID].uCurrentActionLength = rand() % 256 + 256; |
1238 else | 1154 else |
1239 actor->uCurrentActionLength = uActionLength; | 1155 pActors[uActorID].uCurrentActionLength = uActionLength; |
1240 actor->uCurrentActionTime = 0; | 1156 pActors[uActorID].uCurrentActionTime = 0; |
1241 actor->uYawAngle = a4->uYawAngle; | 1157 pActors[uActorID].uYawAngle = a4->uYawAngle; |
1242 actor->uPitchAngle = a4->uPitchAngle; | 1158 pActors[uActorID].uPitchAngle = a4->uPitchAngle; |
1243 actor->vVelocity.z = 0; | 1159 pActors[uActorID].vVelocity.z = 0; |
1244 actor->vVelocity.y = 0; | 1160 pActors[uActorID].vVelocity.y = 0; |
1245 actor->vVelocity.x = 0; | 1161 pActors[uActorID].vVelocity.x = 0; |
1246 actor->UpdateAnimation(); | 1162 pActors[uActorID].UpdateAnimation(); |
1247 } | 1163 } |
1248 | 1164 |
1249 //----- (00403E61) -------------------------------------------------------- | 1165 //----- (00403E61) -------------------------------------------------------- |
1250 void __fastcall Actor::StandAwhile(unsigned int uActorID) | 1166 void __fastcall Actor::StandAwhile(unsigned int uActorID) |
1251 { | 1167 { |
1302 v10.x = v3->vPosition.x; | 1218 v10.x = v3->vPosition.x; |
1303 | 1219 |
1304 if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) | 1220 if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) |
1305 { | 1221 { |
1306 if (arg0 != nullptr) | 1222 if (arg0 != nullptr) |
1307 { | |
1308 v12 = arg0; | 1223 v12 = arg0; |
1309 } | |
1310 else | 1224 else |
1311 { | 1225 { |
1312 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); | 1226 Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); |
1313 v12 = &a3; | 1227 v12 = &a3; |
1314 } | 1228 } |
1315 v3->uYawAngle = LOWORD(v12->uYawAngle); | 1229 v3->uYawAngle = LOWORD(v12->uYawAngle); |
1316 v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; | 1230 v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; |
1317 v3->uCurrentActionTime = 0; | 1231 v3->uCurrentActionTime = 0; |
1318 v3->uAIState = AttackingMelee; | 1232 v3->uAIState = AttackingMelee; |
1319 Actor::PlaySound(uActorID, 0); | 1233 Actor::PlaySound(uActorID, 0); |
1320 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 1234 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
1321 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) | 1235 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) |
1322 { | |
1323 v25 *= 2; | 1236 v25 *= 2; |
1324 } | |
1325 if ( pParty->bTurnBasedModeOn != 1 ) | 1237 if ( pParty->bTurnBasedModeOn != 1 ) |
1326 { | |
1327 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); | 1238 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); |
1328 } | |
1329 else | 1239 else |
1330 { | |
1331 v3->pMonsterInfo.uRecoveryTime = v25; | 1240 v3->pMonsterInfo.uRecoveryTime = v25; |
1332 } | |
1333 v3->vVelocity.z = 0; | 1241 v3->vVelocity.z = 0; |
1334 v3->vVelocity.y = 0; | 1242 v3->vVelocity.y = 0; |
1335 v3->vVelocity.x = 0; | 1243 v3->vVelocity.x = 0; |
1336 v3->UpdateAnimation(); | 1244 v3->UpdateAnimation(); |
1337 } | 1245 } |
1478 v5 = this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | 1386 v5 = this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; |
1479 default: | 1387 default: |
1480 return 0; | 1388 return 0; |
1481 } | 1389 } |
1482 for ( int i = 0; i < v3; i++) | 1390 for ( int i = 0; i < v3; i++) |
1483 { | |
1484 v11 += rand() % v4 + 1; | 1391 v11 += rand() % v4 + 1; |
1485 } | |
1486 return v11 + v5 + v2; | 1392 return v11 + v5 + v2; |
1487 } | 1393 } |
1488 | 1394 |
1489 //----- (00438B9B) -------------------------------------------------------- | 1395 //----- (00438B9B) -------------------------------------------------------- |
1490 bool Actor::IsPeasant() | 1396 bool Actor::IsPeasant() |
1578 { | 1484 { |
1579 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), a2, &a3, 0); | 1485 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), a2, &a3, 0); |
1580 v9 = &a3; | 1486 v9 = &a3; |
1581 } | 1487 } |
1582 else | 1488 else |
1583 { | |
1584 v9 = pDir; | 1489 v9 = pDir; |
1585 } | |
1586 v3->uYawAngle = LOWORD(v9->uYawAngle); | 1490 v3->uYawAngle = LOWORD(v9->uYawAngle); |
1587 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; | 1491 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
1588 v3->uCurrentActionLength = 8 * v13; | 1492 v3->uCurrentActionLength = 8 * v13; |
1589 v3->uCurrentActionTime = 0; | 1493 v3->uCurrentActionTime = 0; |
1590 v3->uAIState = AttackingRanged4; | 1494 v3->uAIState = AttackingRanged4; |
1591 Actor::PlaySound(uActorID, 0); | 1495 Actor::PlaySound(uActorID, 0); |
1592 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 1496 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
1593 if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) | 1497 if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) |
1594 { | |
1595 pDira *= 2; | 1498 pDira *= 2; |
1596 } | |
1597 if ( pParty->bTurnBasedModeOn == 1 ) | 1499 if ( pParty->bTurnBasedModeOn == 1 ) |
1598 v3->pMonsterInfo.uRecoveryTime = pDira; | 1500 v3->pMonsterInfo.uRecoveryTime = pDira; |
1599 else | 1501 else |
1600 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); | 1502 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); |
1601 v3->vVelocity.z = 0; | 1503 v3->vVelocity.z = 0; |
1662 { | 1564 { |
1663 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); | 1565 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); |
1664 v9 = &a3; | 1566 v9 = &a3; |
1665 } | 1567 } |
1666 else | 1568 else |
1667 { | |
1668 v9 = pDir; | 1569 v9 = pDir; |
1669 } | |
1670 v3->uYawAngle = LOWORD(v9->uYawAngle); | 1570 v3->uYawAngle = LOWORD(v9->uYawAngle); |
1671 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; | 1571 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
1672 v3->uCurrentActionLength = 8 * v13; | 1572 v3->uCurrentActionLength = 8 * v13; |
1673 v3->uCurrentActionTime = 0; | 1573 v3->uCurrentActionTime = 0; |
1674 v3->uAIState = AttackingRanged3; | 1574 v3->uAIState = AttackingRanged3; |
1675 Actor::PlaySound(uActorID, 0); | 1575 Actor::PlaySound(uActorID, 0); |
1676 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 1576 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
1677 if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) | 1577 if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) |
1678 { | |
1679 pDira *= 2; | 1578 pDira *= 2; |
1680 } | |
1681 if ( pParty->bTurnBasedModeOn == 1 ) | 1579 if ( pParty->bTurnBasedModeOn == 1 ) |
1682 v3->pMonsterInfo.uRecoveryTime = pDira; | 1580 v3->pMonsterInfo.uRecoveryTime = pDira; |
1683 else | 1581 else |
1684 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); | 1582 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); |
1685 v16 = v3->pMonsterInfo.uSpell1ID; | 1583 v16 = v3->pMonsterInfo.uSpell1ID; |
1746 { | 1644 { |
1747 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); | 1645 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); |
1748 v9 = &a3; | 1646 v9 = &a3; |
1749 } | 1647 } |
1750 else | 1648 else |
1751 { | |
1752 v9 = pDir; | 1649 v9 = pDir; |
1753 } | |
1754 v3->uYawAngle = LOWORD(v9->uYawAngle); | 1650 v3->uYawAngle = LOWORD(v9->uYawAngle); |
1755 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; | 1651 v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
1756 v3->uCurrentActionLength = 8 * v13; | 1652 v3->uCurrentActionLength = 8 * v13; |
1757 v3->uCurrentActionTime = 0; | 1653 v3->uCurrentActionTime = 0; |
1758 v3->uAIState = AttackingRanged2; | 1654 v3->uAIState = AttackingRanged2; |
1759 Actor::PlaySound(uActorID, 0); | 1655 Actor::PlaySound(uActorID, 0); |
1760 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 1656 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
1761 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) | 1657 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) |
1762 { | |
1763 pDira *= 2; | 1658 pDira *= 2; |
1764 } | |
1765 if ( pParty->bTurnBasedModeOn != 1 ) | 1659 if ( pParty->bTurnBasedModeOn != 1 ) |
1766 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); | 1660 v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); |
1767 else | 1661 else |
1768 { | |
1769 v3->pMonsterInfo.uRecoveryTime = pDira; | 1662 v3->pMonsterInfo.uRecoveryTime = pDira; |
1770 } | |
1771 v3->vVelocity.z = 0; | 1663 v3->vVelocity.z = 0; |
1772 v3->vVelocity.y = 0; | 1664 v3->vVelocity.y = 0; |
1773 v3->vVelocity.x = 0; | 1665 v3->vVelocity.x = 0; |
1774 v3->UpdateAnimation(); | 1666 v3->UpdateAnimation(); |
1775 } | 1667 } |
1827 { | 1719 { |
1828 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); | 1720 Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); |
1829 v10 = &a3; | 1721 v10 = &a3; |
1830 } | 1722 } |
1831 else | 1723 else |
1832 { | |
1833 v10 = pDir; | 1724 v10 = pDir; |
1834 } | |
1835 v3->uYawAngle = LOWORD(v10->uYawAngle); | 1725 v3->uYawAngle = LOWORD(v10->uYawAngle); |
1836 v14 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; | 1726 v14 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
1837 v3->uCurrentActionLength = 8 * v14; | 1727 v3->uCurrentActionLength = 8 * v14; |
1838 v3->uCurrentActionTime = 0; | 1728 v3->uCurrentActionTime = 0; |
1839 v3->uAIState = AttackingRanged1; | 1729 v3->uAIState = AttackingRanged1; |
1840 Actor::PlaySound(uActorID, 0); | 1730 Actor::PlaySound(uActorID, 0); |
1841 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 1731 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
1842 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) | 1732 if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) |
1843 { | |
1844 pDira *= 2; | 1733 pDira *= 2; |
1845 } | |
1846 if ( pParty->bTurnBasedModeOn == 1 ) | 1734 if ( pParty->bTurnBasedModeOn == 1 ) |
1847 v3->pMonsterInfo.uRecoveryTime = pDira; | 1735 v3->pMonsterInfo.uRecoveryTime = pDira; |
1848 else | 1736 else |
1849 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - (int)(flt_6BE3A8_debug_recmod2 * pDira * -2.133333333333333); | 1737 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - (int)(flt_6BE3A8_debug_recmod2 * pDira * -2.133333333333333); |
1850 v3->vVelocity.z = 0; | 1738 v3->vVelocity.z = 0; |
1910 else | 1798 else |
1911 v5->uCurrentActionLength = 0; | 1799 v5->uCurrentActionLength = 0; |
1912 v5->uCurrentActionTime = 0; | 1800 v5->uCurrentActionTime = 0; |
1913 v5->uAIState = Tethered; | 1801 v5->uAIState = Tethered; |
1914 if ( rand() % 100 < 2 ) | 1802 if ( rand() % 100 < 2 ) |
1915 Actor::PlaySound(uActor_id, 3u); | 1803 Actor::PlaySound(uActor_id, 3); |
1916 v5->UpdateAnimation(); | 1804 v5->UpdateAnimation(); |
1917 } | 1805 } |
1918 | 1806 |
1919 //----- (004031C1) -------------------------------------------------------- | 1807 //----- (004031C1) -------------------------------------------------------- |
1920 char __fastcall Actor::_4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3) //attempted to implement something like jobs for actors, but apparently was never finished | 1808 char __fastcall Actor::_4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3) //attempted to implement something like jobs for actors, but apparently was never finished |
2137 | 2025 |
2138 v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; | 2026 v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; |
2139 if ( v3 ) | 2027 if ( v3 ) |
2140 { | 2028 { |
2141 if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 ) | 2029 if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 ) |
2142 { | |
2143 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); | 2030 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
2144 } | |
2145 else | 2031 else |
2146 { | 2032 { |
2147 switch(pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uPower) | 2033 switch(pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uPower) |
2148 { | 2034 { |
2149 case 1: | 2035 case 1: |
2189 { | 2075 { |
2190 Actor::GetDirectionInfo(v8, a2, &a3, v6); | 2076 Actor::GetDirectionInfo(v8, a2, &a3, v6); |
2191 v10 = &a3; | 2077 v10 = &a3; |
2192 } | 2078 } |
2193 else | 2079 else |
2194 { | |
2195 v10 = pDir; | 2080 v10 = pDir; |
2196 } | |
2197 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | 2081 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) |
2198 { | 2082 { |
2199 if ( !uActionLength ) | 2083 if ( !uActionLength ) |
2200 uActionLength = 256; | 2084 uActionLength = 256; |
2201 Actor::AI_StandOrBored(uActorID, 4, uActionLength, v10); | 2085 Actor::AI_StandOrBored(uActorID, 4, uActionLength, v10); |
2379 if ( !uActionLength ) | 2263 if ( !uActionLength ) |
2380 uActionLength = 256; | 2264 uActionLength = 256; |
2381 return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4); | 2265 return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4); |
2382 } | 2266 } |
2383 if ( uActionLength ) | 2267 if ( uActionLength ) |
2384 { | |
2385 v6->uCurrentActionLength = uActionLength + rand() % uActionLength; | 2268 v6->uCurrentActionLength = uActionLength + rand() % uActionLength; |
2386 } | |
2387 else | 2269 else |
2388 { | 2270 { |
2389 v12 = v6->uMovementSpeed; | 2271 v12 = v6->uMovementSpeed; |
2390 if ( v12 ) | 2272 if ( v12 ) |
2391 v6->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v12; | 2273 v6->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v12; |
2510 // 4DF390: using guessed type int dword_4DF390; | 2392 // 4DF390: using guessed type int dword_4DF390; |
2511 | 2393 |
2512 //----- (0040104C) -------------------------------------------------------- | 2394 //----- (0040104C) -------------------------------------------------------- |
2513 signed int Actor::GetActorsRelation(Actor *otherActPtr) | 2395 signed int Actor::GetActorsRelation(Actor *otherActPtr) |
2514 { | 2396 { |
2515 unsigned int v5; // edx@15 | |
2516 unsigned int v6; // eax@16 | |
2517 unsigned int thisGroup; // ebp@19 | 2397 unsigned int thisGroup; // ebp@19 |
2518 int otherGroup; // eax@22 | 2398 int otherGroup; // eax@22 |
2519 unsigned int thisAlly; // edx@25 | 2399 unsigned int thisAlly; // edx@25 |
2520 unsigned int otherAlly; // edx@33 | 2400 unsigned int otherAlly; // edx@33 |
2521 | 2401 |
2522 if ( otherActPtr) | 2402 if ( otherActPtr) |
2523 { | 2403 { |
2524 v5 = otherActPtr->uGroup; | 2404 if ( otherActPtr->uGroup != 0 && this->uGroup != 0 && otherActPtr->uGroup == this->uGroup ) |
2525 v6 = this->uGroup; | |
2526 if ( v5 != 0 && v6 != 0 && v5 == v6 ) | |
2527 return 0; | 2405 return 0; |
2528 } | 2406 } |
2529 | 2407 |
2530 if (this->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) | 2408 if (this->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) |
2531 return 4; | 2409 return 4; |
2532 thisAlly = this->uAlly; | 2410 thisAlly = this->uAlly; |
2533 if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || thisAlly == 9999) | 2411 if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || thisAlly == 9999) |
2534 thisGroup = 0; | 2412 thisGroup = 0; |
2535 else if ( thisAlly > 0 ) | 2413 else if ( thisAlly > 0 ) |
2536 { | |
2537 thisGroup = thisAlly; | 2414 thisGroup = thisAlly; |
2538 } | |
2539 else | 2415 else |
2540 { | |
2541 thisGroup = (this->pMonsterInfo.uID - 1) / 3 + 1; | 2416 thisGroup = (this->pMonsterInfo.uID - 1) / 3 + 1; |
2542 } | |
2543 | 2417 |
2544 if ( otherActPtr ) | 2418 if ( otherActPtr ) |
2545 { | 2419 { |
2546 if (otherActPtr->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) | 2420 if (otherActPtr->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) |
2547 return 4; | 2421 return 4; |
2548 otherAlly = otherActPtr->uAlly; | 2422 otherAlly = otherActPtr->uAlly; |
2549 if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || otherAlly == 9999) | 2423 if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || otherAlly == 9999) |
2550 otherGroup = 0; | 2424 otherGroup = 0; |
2551 else if ( otherAlly > 0 ) | 2425 else if ( otherAlly > 0 ) |
2552 { | |
2553 otherGroup = otherAlly; | 2426 otherGroup = otherAlly; |
2554 } | |
2555 else | 2427 else |
2556 { | |
2557 otherGroup = (otherActPtr->pMonsterInfo.uID - 1) / 3 + 1; | 2428 otherGroup = (otherActPtr->pMonsterInfo.uID - 1) / 3 + 1; |
2558 } | |
2559 } | 2429 } |
2560 else | 2430 else |
2561 { | |
2562 otherGroup = 0; | 2431 otherGroup = 0; |
2563 } | |
2564 | 2432 |
2565 if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !otherGroup | 2433 if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !otherGroup |
2566 || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !thisGroup ) | 2434 || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !thisGroup ) |
2567 return 0; | 2435 return 0; |
2568 if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->uAttributes & 0x80000 && !otherGroup ) | 2436 if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->uAttributes & 0x80000 && !otherGroup ) |
2576 return pFactionTable->relations[0][otherGroup]; | 2444 return pFactionTable->relations[0][otherGroup]; |
2577 else | 2445 else |
2578 return 4; | 2446 return 4; |
2579 } | 2447 } |
2580 else | 2448 else |
2581 { | |
2582 return pFactionTable->relations[thisGroup][otherGroup]; | 2449 return pFactionTable->relations[thisGroup][otherGroup]; |
2583 } | |
2584 } | 2450 } |
2585 | 2451 |
2586 //----- (0045976D) -------------------------------------------------------- | 2452 //----- (0045976D) -------------------------------------------------------- |
2587 void Actor::UpdateAnimation() | 2453 void Actor::UpdateAnimation() |
2588 { | 2454 { |
2716 uActorHeight = v3->uMonsterHeight; | 2582 uActorHeight = v3->uMonsterHeight; |
2717 uActorRadius = v3->uMonsterRadius; | 2583 uActorRadius = v3->uMonsterRadius; |
2718 uMovementSpeed = v9->uBaseSpeed; | 2584 uMovementSpeed = v9->uBaseSpeed; |
2719 if ( !(load_sounds_if_bit1_set & 1) ) | 2585 if ( !(load_sounds_if_bit1_set & 1) ) |
2720 { | 2586 { |
2721 for (int i=0;i<4;++i ) | 2587 for ( int i = 0; i < 4; ++i ) |
2722 pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; | 2588 pSoundSampleIDs[i] = v3->pSoundSampleIDs[i]; |
2723 } | 2589 } |
2724 } | 2590 } |
2725 | 2591 |
2726 //----- (00459667) -------------------------------------------------------- | 2592 //----- (00459667) -------------------------------------------------------- |
2727 void Actor::Remove() | 2593 void Actor::Remove() |
2787 { | 2653 { |
2788 v5 = rand() % 100; | 2654 v5 = rand() % 100; |
2789 if ( v5 >= 90 ) | 2655 if ( v5 >= 90 ) |
2790 summonMonsterBaseType += 2; | 2656 summonMonsterBaseType += 2; |
2791 else if ( v5 >= 60 ) | 2657 else if ( v5 >= 60 ) |
2792 { | |
2793 summonMonsterBaseType += 1; | 2658 summonMonsterBaseType += 1; |
2794 } | |
2795 } | 2659 } |
2796 v7 = summonMonsterBaseType - 1; | 2660 v7 = summonMonsterBaseType - 1; |
2797 v8 = &pActors[uNumActors]; | 2661 v8 = &pActors[uNumActors]; |
2798 v9 = &pMonsterStats->pInfos[v7 + 1]; | 2662 v9 = &pMonsterStats->pInfos[v7 + 1]; |
2799 pActors[uNumActors].Reset(); | 2663 pActors[uNumActors].Reset(); |
2826 v8->UpdateAnimation(); | 2690 v8->UpdateAnimation(); |
2827 | 2691 |
2828 ++uNumActors; | 2692 ++uNumActors; |
2829 ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | 2693 ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; |
2830 if ( this->uAttributes & 0x80000 ) | 2694 if ( this->uAttributes & 0x80000 ) |
2831 v8->uAttributes |= 0x80000u; | 2695 v8->uAttributes |= 0x80000; |
2832 v8->uSummonerID = PID(OBJECT_Actor,summonerId); | 2696 v8->uSummonerID = PID(OBJECT_Actor,summonerId); |
2833 | 2697 |
2834 } | 2698 } |
2835 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | 2699 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); |
2836 //----- (0046DF1A) -------------------------------------------------------- | 2700 //----- (0046DF1A) -------------------------------------------------------- |
3352 | 3216 |
3353 uTotalActors = 0; | 3217 uTotalActors = 0; |
3354 if ( uType ) | 3218 if ( uType ) |
3355 { | 3219 { |
3356 if ( uType == 1 ) | 3220 if ( uType == 1 ) |
3357 { | |
3358 uAliveActors = SearchActorByGroup(&uTotalActors, uParam); | 3221 uAliveActors = SearchActorByGroup(&uTotalActors, uParam); |
3359 } | |
3360 else | 3222 else |
3361 { | 3223 { |
3362 if ( uType == 2 ) | 3224 if ( uType == 2 ) |
3363 { | |
3364 uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam); | 3225 uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam); |
3365 } | |
3366 else | 3226 else |
3367 { | 3227 { |
3368 if ( uType != 3 ) | 3228 if ( uType != 3 ) |
3369 return 0; | 3229 return 0; |
3370 uAliveActors = SearchActorByID(&uTotalActors, uParam); | 3230 uAliveActors = SearchActorByID(&uTotalActors, uParam); |
3371 } | 3231 } |
3372 } | 3232 } |
3373 } | 3233 } |
3374 else | 3234 else |
3375 { | |
3376 uAliveActors = SearchAliveActors(&uTotalActors); | 3235 uAliveActors = SearchAliveActors(&uTotalActors); |
3377 } | |
3378 | 3236 |
3379 if (uNumAlive) | 3237 if (uNumAlive) |
3380 return uAliveActors >= uNumAlive; | 3238 return uAliveActors >= uNumAlive; |
3381 else | 3239 else |
3382 return uTotalActors == uAliveActors; | 3240 return uTotalActors == uAliveActors; |
4040 itemFound = false; | 3898 itemFound = false; |
4041 v14 = 0; | 3899 v14 = 0; |
4042 if ( !( this->uAttributes & 0x800000 ) ) | 3900 if ( !( this->uAttributes & 0x800000 ) ) |
4043 { | 3901 { |
4044 for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ ) | 3902 for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ ) |
4045 { | |
4046 v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; | 3903 v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; |
4047 } | |
4048 if ( v14 != 0 ) | 3904 if ( v14 != 0 ) |
4049 { | 3905 { |
4050 pParty->PartyFindsGold(v14, 0); | 3906 pParty->PartyFindsGold(v14, 0); |
4051 viewparams->bRedrawGameUI = 1; | 3907 viewparams->bRedrawGameUI = 1; |
4052 } | 3908 } |
4158 itemFound = true; | 4014 itemFound = true; |
4159 } | 4015 } |
4160 this->array_000234[1].Reset(); | 4016 this->array_000234[1].Reset(); |
4161 } | 4017 } |
4162 if ( !itemFound || rand() % 100 < 90 ) | 4018 if ( !itemFound || rand() % 100 < 90 ) |
4163 { | |
4164 this->Remove(); | 4019 this->Remove(); |
4165 } | |
4166 } | 4020 } |
4167 | 4021 |
4168 | 4022 |
4169 //----- (00427102) -------------------------------------------------------- | 4023 //----- (00427102) -------------------------------------------------------- |
4170 bool Actor::_427102_IsOkToCastSpell( signed int a2 ) | 4024 bool Actor::_427102_IsOkToCastSpell( signed int a2 ) |
4180 case SPELL_LIGHT_DISPEL_MAGIC: | 4034 case SPELL_LIGHT_DISPEL_MAGIC: |
4181 { | 4035 { |
4182 for (int i = 0; i < 20; i++) | 4036 for (int i = 0; i < 20; i++) |
4183 { | 4037 { |
4184 if (pParty->pPartyBuffs[i].uExpireTime > 0) | 4038 if (pParty->pPartyBuffs[i].uExpireTime > 0) |
4185 { | |
4186 return true; | 4039 return true; |
4187 } | |
4188 } | 4040 } |
4189 for ( int i = 1; i <= 4; i++ ) | 4041 for ( int i = 1; i <= 4; i++ ) |
4190 { | 4042 { |
4191 for ( int j = 0; j < 22; j++ ) | 4043 for ( int j = 0; j < 22; j++ ) |
4192 { | 4044 { |
4193 if (pPlayers[i]->pPlayerBuffs[j].uExpireTime > 0) | 4045 if (pPlayers[i]->pPlayerBuffs[j].uExpireTime > 0) |
4194 { | |
4195 return true; | 4046 return true; |
4196 } | |
4197 } | 4047 } |
4198 } | 4048 } |
4199 return false; | 4049 return false; |
4200 } | 4050 } |
4201 case SPELL_LIGHT_DAY_OF_PROTECTION: | 4051 case SPELL_LIGHT_DAY_OF_PROTECTION: |
4247 { | 4097 { |
4248 return this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime <= 0; | 4098 return this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime <= 0; |
4249 break; | 4099 break; |
4250 } | 4100 } |
4251 default: | 4101 default: |
4252 { | |
4253 return true; | 4102 return true; |
4254 } | |
4255 } | 4103 } |
4256 } | 4104 } |
4257 | 4105 |
4258 | 4106 |
4259 //----- (0042704B) -------------------------------------------------------- | 4107 //----- (0042704B) -------------------------------------------------------- |
4261 { | 4109 { |
4262 signed int okToCastSpell1; // ebx@5 | 4110 signed int okToCastSpell1; // ebx@5 |
4263 signed int okToCastSpell2; // edi@5 | 4111 signed int okToCastSpell2; // edi@5 |
4264 | 4112 |
4265 if ( this->pMonsterInfo.uSpecialAbilityType == 2 | 4113 if ( this->pMonsterInfo.uSpecialAbilityType == 2 |
4266 && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | 4114 && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3 |
4267 && rand() % 100 < 5 ) | 4115 && rand() % 100 < 5 ) |
4268 this->SummonMinion(a2); | 4116 this->SummonMinion(a2); |
4269 okToCastSpell1 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell1ID); | 4117 okToCastSpell1 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell1ID); |
4270 okToCastSpell2 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell2ID); | 4118 okToCastSpell2 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell2ID); |
4271 if ( okToCastSpell1 && this->pMonsterInfo.uSpell1UseChance && rand() % 100 < this->pMonsterInfo.uSpell1UseChance ) | 4119 if ( okToCastSpell1 && this->pMonsterInfo.uSpell1UseChance && rand() % 100 < this->pMonsterInfo.uSpell1UseChance ) |