comparison Actor.cpp @ 1545:c4ab816fcc5e

assert, Abortf, AbortWithError -> Assert, Error refactors here and there
author Nomad
date Sat, 07 Sep 2013 20:05:20 +0200
parents 61458df2cb4f
children 9a6567c6c76c
comparison
equal deleted inserted replaced
1544:499761153844 1545:c4ab816fcc5e
1 #ifdef _MSC_VER 1 #ifdef _MSC_VER
2 #define _CRT_SECURE_NO_WARNINGS 2 #define _CRT_SECURE_NO_WARNINGS
3 #endif 3 #endif
4
5 #include <assert.h>
6
7 4
8 #include "mm7_data.h" 5 #include "mm7_data.h"
9 #include "DecalBuilder.h" 6 #include "DecalBuilder.h"
10 7
11 #include "Sprites.h" 8 #include "Sprites.h"
1824 { 1821 {
1825 v41.vDirection.x = (signed __int64)(1.0 / v33 * v42 * 65536.0); 1822 v41.vDirection.x = (signed __int64)(1.0 / v33 * v42 * 65536.0);
1826 v41.vDirection.y = (signed __int64)(1.0 / v33 * v43 * 65536.0); 1823 v41.vDirection.y = (signed __int64)(1.0 / v33 * v43 * 65536.0);
1827 v41.vDirection.z = (signed __int64)(1.0 / v33 * a4a * 65536.0); 1824 v41.vDirection.z = (signed __int64)(1.0 / v33 * a4a * 65536.0);
1828 v41.uDistance = (signed __int64)v33; 1825 v41.uDistance = (signed __int64)v33;
1829 v41.uDistanceXZ = (signed __int64)sqrt(outy2 + outx2); 1826 v41.uDistanceXZ = sqrt(outy2 + outx2);
1830 v41.uYawAngle = stru_5C6E00->Atan2((signed __int64)v42, (signed __int64)v43); 1827 v41.uYawAngle = stru_5C6E00->Atan2((signed __int64)v42, (signed __int64)v43);
1831 v41.uPitchAngle = stru_5C6E00->Atan2(v41.uDistanceXZ, (signed __int64)a4a); 1828 v41.uPitchAngle = stru_5C6E00->Atan2(v41.uDistanceXZ, (signed __int64)a4a);
1832 } 1829 }
1833 result = pOut; 1830 result = pOut;
1834 memcpy(pOut, &v41, sizeof(AIDirection)); 1831 memcpy(pOut, &v41, sizeof(AIDirection));
4061 //signed int v59; // [sp-18h] [bp-C8h]@213 4058 //signed int v59; // [sp-18h] [bp-C8h]@213
4062 //int v60; // [sp-14h] [bp-C4h]@144 4059 //int v60; // [sp-14h] [bp-C4h]@144
4063 //int v61; // [sp-14h] [bp-C4h]@168 4060 //int v61; // [sp-14h] [bp-C4h]@168
4064 //AIDirection *v62; // [sp-14h] [bp-C4h]@213 4061 //AIDirection *v62; // [sp-14h] [bp-C4h]@213
4065 //signed int v63; // [sp-14h] [bp-C4h]@216 4062 //signed int v63; // [sp-14h] [bp-C4h]@216
4066 unsigned int v64; // [sp-14h] [bp-C4h]@219 4063 //unsigned int v64; // [sp-14h] [bp-C4h]@219
4067 unsigned int v65; // [sp-10h] [bp-C0h]@144 4064 unsigned int v65; // [sp-10h] [bp-C0h]@144
4068 char v66; // [sp-10h] [bp-C0h]@147 4065 char v66; // [sp-10h] [bp-C0h]@147
4069 //AIDirection *v67; // [sp-10h] [bp-C0h]@167 4066 //AIDirection *v67; // [sp-10h] [bp-C0h]@167
4070 //int v68; // [sp-10h] [bp-C0h]@168 4067 //int v68; // [sp-10h] [bp-C0h]@168
4071 //AIDirection *v69; // [sp-10h] [bp-C0h]@206 4068 //AIDirection *v69; // [sp-10h] [bp-C0h]@206
4192 } 4189 }
4193 ++v13; 4190 ++v13;
4194 ++v14; 4191 ++v14;
4195 } 4192 }
4196 while ( v13 < 22 );*/ 4193 while ( v13 < 22 );*/
4197 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) 4194 if (pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0)
4198 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 4195 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
4199 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) 4196 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
4200 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; 4197 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight;
4201 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) 4198 if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0)
4202 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 4199 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
4203 // not sure 4200 // not sure
4204 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) 4201 else if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0)
4205 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; 4202 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType;
4206 4203
4207 if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 4204 if (pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 ||
4208 || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) 4205 pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0)
4209 continue; 4206 continue;
4210 4207
4211 //v15 = pMiscTimer->uTimeElapsed; 4208 //v15 = pMiscTimer->uTimeElapsed;
4212 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; 4209 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
4213 //v17 = pActor->uCurrentActionTime; 4210 //v17 = pActor->uCurrentActionTime;
4214 //v18 = pActor->pMonsterInfo.uRecoveryTime; 4211 //v18 = pActor->pMonsterInfo.uRecoveryTime;
4406 } 4403 }
4407 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) 4404 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 )
4408 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; 4405 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
4409 } 4406 }
4410 4407
4411 if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 ) 4408 if (pActor->pActorBuffs[4].uExpireTime > 0)
4412 { 4409 {
4413 if ( (signed int)v36 >= 10240 ) 4410 if ( (signed int)v36 >= 10240 )
4414 { 4411 {
4415 Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); 4412 Actor::AI_RandomMove(actor_id, target_pid, 1024, 0);
4416 } 4413 }
4428 4425
4429 if ( pActor->pMonsterInfo.uAIType == 1 ) 4426 if ( pActor->pMonsterInfo.uAIType == 1 )
4430 { 4427 {
4431 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4428 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4432 { 4429 {
4433 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); 4430 Actor::AI_Stand(actor_id, target_pid, pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333, &pDir);
4434 } 4431 }
4435 else 4432 else
4436 { 4433 {
4437 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); 4434 Actor::AI_Flee(actor_id, target_pid, 0, &pDir);
4438 continue; 4435 continue;
4475 { 4472 {
4476 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); 4473 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir);
4477 } 4474 }
4478 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4475 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4479 { 4476 {
4480 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4477 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4481 v64 = (signed __int64)v47; 4478 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4482 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4483 } 4479 }
4484 else 4480 else
4485 { 4481 {
4486 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4482 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4487 if ( v80 * 307.2 > (double)v81 ) 4483 if ( v80 * 307.2 > (double)v81 )
4488 { 4484 {
4489 v64 = (signed __int64)v47; 4485 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4490 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4491 } 4486 }
4492 else 4487 else
4493 { 4488 {
4494 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); 4489 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir);
4495 } 4490 }
4496 } 4491 }
4497 } 4492 }
4498 else 4493 else
4499 { 4494 {
4501 { 4496 {
4502 if ( v81 >= 1024 ) 4497 if ( v81 >= 1024 )
4503 { 4498 {
4504 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4499 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4505 { 4500 {
4506 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4501 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4507 v64 = (signed __int64)v47; 4502 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4508 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4509 } 4503 }
4510 else 4504 else
4511 { 4505 {
4512 //monsters 4506 //monsters
4513 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); 4507 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir);
4514 } 4508 }
4515 } 4509 }
4516 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4510 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4517 { 4511 {
4518 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4512 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4519 v64 = (signed __int64)v47; 4513 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4520 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4521 } 4514 }
4522 else 4515 else
4523 { 4516 {
4524 v70 = (signed __int64)v80 * 307.2; 4517 v70 = (signed __int64)v80 * 307.2;
4525 //monsters 4518 //monsters
4528 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); 4521 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
4529 } 4522 }
4530 } 4523 }
4531 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) 4524 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
4532 { 4525 {
4533 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4526 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4534 v64 = (signed __int64)v47; 4527 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4535 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4536 } 4528 }
4537 else 4529 else
4538 { 4530 {
4539 //monsters 4531 //monsters
4540 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); 4532 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
4557 else 4549 else
4558 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); 4550 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir);
4559 } 4551 }
4560 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4552 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4561 { 4553 {
4562 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4554 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4563 v64 = (signed __int64)v47; 4555 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4564 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4565 } 4556 }
4566 else 4557 else
4567 { 4558 {
4568 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4559 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4569 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); 4560 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir);
4570 } 4561 }
4571 } 4562 }
4572 else 4563 else
4573 { 4564 {
4574 if ( (double)v81 >= v80 * 307.2 ) 4565 if ( (double)v81 >= v80 * 307.2 )
4575 { 4566 {
4576 if ( v81 >= 1024 ) 4567 if ( v81 >= 1024 )
4577 { 4568 {
4578 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4569 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4579 { 4570 {
4580 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4571 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4581 v64 = (signed __int64)v47; 4572 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4582 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4583 } 4573 }
4584 else 4574 else
4585 { 4575 {
4586 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); 4576 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
4587 } 4577 }
4588 } 4578 }
4589 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4579 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4590 { 4580 {
4591 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4581 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4592 v64 = (signed __int64)v47; 4582 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4593 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4594 } 4583 }
4595 else 4584 else
4596 { 4585 {
4597 v70 = (signed __int64)v80 * 307.2; 4586 v70 = (signed __int64)v80 * 307.2;
4598 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); 4587 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
4599 } 4588 }
4600 } 4589 }
4601 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) 4590 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
4602 { 4591 {
4603 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4592 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4604 v64 = (signed __int64)v47; 4593 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4605 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4606 } 4594 }
4607 else 4595 else
4608 { 4596 {
4609 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); 4597 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
4610 } 4598 }
4636 { 4624 {
4637 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); 4625 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
4638 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4626 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4639 memcpy(&v74, v57, sizeof(v74)); 4627 memcpy(&v74, v57, sizeof(v74));
4640 memcpy(&pDir, &v74, sizeof(pDir)); 4628 memcpy(&pDir, &v74, sizeof(pDir));
4641 v64 = (signed __int64)v58; 4629 Actor::AI_Stand(actor_id, 4, v58, &pDir);
4642 Actor::AI_Stand(actor_id, 4, v64, &pDir);
4643 } 4630 }
4644 } 4631 }
4645 else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) 4632 else if ( !pActor->pMonsterInfo.uMissleAttack2Type )
4646 { 4633 {
4647 if ( (double)v81 >= v80 * 307.2 ) 4634 if ( (double)v81 >= v80 * 307.2 )
4648 { 4635 {
4649 if ( v81 >= 1024 ) 4636 if ( v81 >= 1024 )
4650 { 4637 {
4651 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4638 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4652 { 4639 {
4653 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4640 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4654 v64 = (signed __int64)v47; 4641 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4655 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4656 } 4642 }
4657 else 4643 else
4658 { 4644 {
4659 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); 4645 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
4660 } 4646 }
4661 } 4647 }
4662 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4648 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4663 { 4649 {
4664 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4650 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4665 v64 = (signed __int64)v47; 4651 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4666 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4667 } 4652 }
4668 else 4653 else
4669 { 4654 {
4670 v70 = (signed __int64)v80 * 307.2; 4655 v70 = (signed __int64)v80 * 307.2;
4671 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); 4656 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
4672 } 4657 }
4673 } 4658 }
4674 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) 4659 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
4675 { 4660 {
4676 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4661 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4677 v64 = (signed __int64)v47; 4662 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4678 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4679 } 4663 }
4680 else 4664 else
4681 { 4665 {
4682 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); 4666 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
4683 } 4667 }
4684 } 4668 }
4685 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) 4669 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
4686 { 4670 {
4687 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; 4671 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
4688 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) 4672 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
4689 { 4673 Actor::AI_Stand(actor_id, target_pid, v47, &pDir);
4690 v64 = (signed __int64)v47;
4691 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
4692 }
4693 else 4674 else
4694 { 4675 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir);
4695 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
4696 }
4697 } 4676 }
4698 else 4677 else
4699 { 4678 {
4700 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); 4679 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir);
4701 } 4680 }
4709 // 3 -> uParam is ActorID 4688 // 3 -> uParam is ActorID
4710 // uNumAlive: 0 -> all must be alive 4689 // uNumAlive: 0 -> all must be alive
4711 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive) 4690 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive)
4712 { 4691 {
4713 unsigned int uAliveActors; // eax@6 4692 unsigned int uAliveActors; // eax@6
4714 int v5; // ecx@10
4715 unsigned int uTotalActors; // [sp+0h] [bp-4h]@1 4693 unsigned int uTotalActors; // [sp+0h] [bp-4h]@1
4716 4694
4717 uTotalActors = 0; 4695 uTotalActors = 0;
4718 if ( uType ) 4696 if ( uType )
4719 { 4697 {
4737 } 4715 }
4738 else 4716 else
4739 { 4717 {
4740 uAliveActors = SearchAliveActors(&uTotalActors); 4718 uAliveActors = SearchAliveActors(&uTotalActors);
4741 } 4719 }
4742 v5 = 0; 4720
4743 if ( uNumAlive ) 4721 if (uNumAlive)
4744 LOBYTE(v5) = (signed int)uAliveActors >= (signed int)uNumAlive; 4722 return uAliveActors >= uNumAlive;
4745 else 4723 else
4746 LOBYTE(v5) = uTotalActors == uAliveActors; 4724 return uTotalActors == uAliveActors;
4747 return v5;
4748 } 4725 }
4749 //----- (00408B54) -------------------------------------------------------- 4726 //----- (00408B54) --------------------------------------------------------
4750 unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2) 4727 unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2)
4751 { 4728 {
4752 unsigned int v2; // edi@1 4729 unsigned int v2; // edi@1
5027 pMonster = &pActors[uActorID_Monster_]; 5004 pMonster = &pActors[uActorID_Monster_];
5028 //uPlayerID = pMonster->IsAlive(); 5005 //uPlayerID = pMonster->IsAlive();
5029 if (pMonster->IsNotAlive()) 5006 if (pMonster->IsNotAlive())
5030 return; 5007 return;
5031 5008
5032 BYTE1(pMonster->uAttributes) |= 0xC0u; 5009 pMonster->uAttributes |= 0xC000;
5033 if ( pMonster->uAIState == Fleeing ) 5010 if ( pMonster->uAIState == Fleeing )
5034 pMonster->uAttributes |= 0x20000u; 5011 pMonster->uAttributes |= 0x20000u;
5035 //v57 = 0; 5012 //v57 = 0;
5036 //v53 = 0; 5013 //v53 = 0;
5037 //v58 = 0; 5014 //v58 = 0;
5422 5399
5423 v4 = uNumActors; 5400 v4 = uNumActors;
5424 monster_id = a1; 5401 monster_id = a1;
5425 x_ = x; 5402 x_ = x;
5426 v15 = a1; 5403 v15 = a1;
5427 if ( (signed int)uNumActors < 500 5404 if (uNumActors < 500
5428 && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 ) 5405 && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 )
5429 { 5406 {
5430 v16 = 0; 5407 v16 = 0;
5431 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 5408 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
5432 { 5409 {