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