Mercurial > mm7
comparison Actor.cpp @ 1894:fe7182c30aad
Actor::_44FD29 cleanup 1
author | Grumpy7 |
---|---|
date | Sun, 20 Oct 2013 02:30:36 -0700 |
parents | 7293e7e8810b |
children | 6b4e14436ee8 |
comparison
equal
deleted
inserted
replaced
1893:7293e7e8810b | 1894:fe7182c30aad |
---|---|
2364 //----- (00401221) -------------------------------------------------------- | 2364 //----- (00401221) -------------------------------------------------------- |
2365 void Actor::_SelectTarget(unsigned int uActorID, int *a2, bool can_target_party) | 2365 void Actor::_SelectTarget(unsigned int uActorID, int *a2, bool can_target_party) |
2366 { | 2366 { |
2367 int v5; // ecx@1 | 2367 int v5; // ecx@1 |
2368 signed int v10; // eax@13 | 2368 signed int v10; // eax@13 |
2369 int v11; // ebx@16 | 2369 uint v11; // ebx@16 |
2370 int v12; // eax@16 | 2370 uint v12; // eax@16 |
2371 signed int v14; // eax@31 | 2371 signed int v14; // eax@31 |
2372 int v15; // edi@43 | 2372 uint v15; // edi@43 |
2373 int v16; // ebx@45 | 2373 uint v16; // ebx@45 |
2374 int v17; // eax@45 | 2374 uint v17; // eax@45 |
2375 signed int closestId; // [sp+14h] [bp-1Ch]@1 | 2375 signed int closestId; // [sp+14h] [bp-1Ch]@1 |
2376 int v23; // [sp+1Ch] [bp-14h]@16 | 2376 uint v23; // [sp+1Ch] [bp-14h]@16 |
2377 unsigned int lowestRadius; // [sp+24h] [bp-Ch]@1 | 2377 unsigned int lowestRadius; // [sp+24h] [bp-Ch]@1 |
2378 int v27; // [sp+2Ch] [bp-4h]@16 | 2378 uint v27; // [sp+2Ch] [bp-4h]@16 |
2379 int v28; // [sp+2Ch] [bp-4h]@45 | 2379 uint v28; // [sp+2Ch] [bp-4h]@45 |
2380 | 2380 |
2381 lowestRadius = UINT_MAX; | 2381 lowestRadius = UINT_MAX; |
2382 v5 = 0; | 2382 v5 = 0; |
2383 *a2 = 0; | 2383 *a2 = 0; |
2384 closestId = 0; | 2384 closestId = 0; |
2430 | 2430 |
2431 if ( lowestRadius != UINT_MAX ) | 2431 if ( lowestRadius != UINT_MAX ) |
2432 { | 2432 { |
2433 *a2 = PID(OBJECT_Actor, closestId); | 2433 *a2 = PID(OBJECT_Actor, closestId); |
2434 } | 2434 } |
2435 | 2435 |
2436 if (pParty->Invisible()) | 2436 if (can_target_party && !pParty->Invisible()) |
2437 can_target_party = false; | |
2438 | |
2439 if (can_target_party) | |
2440 { | 2437 { |
2441 if ( thisActor->uAttributes & 0x80000 | 2438 if ( thisActor->uAttributes & 0x80000 |
2442 && thisActor->pActorBuffs[12].uExpireTime <= 0 | 2439 && thisActor->pActorBuffs[12].uExpireTime <= 0 |
2443 && thisActor->pActorBuffs[1].uExpireTime <= 0 | 2440 && thisActor->pActorBuffs[1].uExpireTime <= 0 |
2444 && thisActor->pActorBuffs[2].uExpireTime <= 0 ) | 2441 && thisActor->pActorBuffs[2].uExpireTime <= 0 ) |
2683 { | 2680 { |
2684 this->uAIState = Removed; | 2681 this->uAIState = Removed; |
2685 } | 2682 } |
2686 | 2683 |
2687 //----- (0044FD29) -------------------------------------------------------- | 2684 //----- (0044FD29) -------------------------------------------------------- |
2688 int Actor::_44FD29(int a2) | 2685 void Actor::_44FD29( int a2 ) |
2689 { | 2686 { |
2690 Actor *v2; // edi@1 | |
2691 unsigned __int8 v3; // al@1 | 2687 unsigned __int8 v3; // al@1 |
2692 int v4; // esi@1 | 2688 int v4; // esi@1 |
2693 int v5; // edx@2 | 2689 int v5; // edx@2 |
2694 int v6; // eax@8 | |
2695 int v7; // edi@10 | 2690 int v7; // edi@10 |
2696 Actor *v8; // esi@10 | 2691 Actor *v8; // esi@10 |
2697 MonsterInfo *v9; // ebx@10 | 2692 MonsterInfo *v9; // ebx@10 |
2698 MonsterDesc *v10; // edi@10 | 2693 MonsterDesc *v10; // edi@10 |
2699 unsigned __int16 v11; // ax@10 | 2694 unsigned __int16 v11; // ax@10 |
2700 int v12; // eax@10 | |
2701 int v13; // ebx@10 | 2695 int v13; // ebx@10 |
2702 int v14; // eax@10 | |
2703 int v15; // edi@10 | 2696 int v15; // edi@10 |
2704 int v16; // eax@10 | |
2705 int v17; // ebx@10 | 2697 int v17; // ebx@10 |
2706 Actor *v18; // ecx@10 | 2698 unsigned int v19; // qax@10 |
2707 signed __int64 v19; // qax@10 | |
2708 unsigned int v20; // eax@12 | |
2709 int v21; // eax@13 | |
2710 int result; // eax@13 | 2699 int result; // eax@13 |
2711 Actor *v23; // eax@16 | 2700 unsigned int monsterId; // [sp+10h] [bp-18h]@8 |
2712 int v24; // [sp+Ch] [bp-1Ch]@1 | |
2713 unsigned int uFaceID; // [sp+10h] [bp-18h]@8 | |
2714 int v26; // [sp+14h] [bp-14h]@10 | |
2715 int v27; // [sp+18h] [bp-10h]@10 | 2701 int v27; // [sp+18h] [bp-10h]@10 |
2716 int v28; // [sp+1Ch] [bp-Ch]@8 | 2702 int actorSector; // [sp+1Ch] [bp-Ch]@8 |
2717 int v29; // [sp+20h] [bp-8h]@10 | 2703 |
2718 Actor *v30; // [sp+24h] [bp-4h]@1 | |
2719 | |
2720 v2 = this; | |
2721 v24 = a2; | |
2722 v30 = this; | |
2723 v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls; | 2704 v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls; |
2724 v4 = this->pMonsterInfo.field_3C_some_special_attack; | 2705 v4 = this->pMonsterInfo.field_3C_some_special_attack; |
2725 if ( v3 ) | 2706 if ( v3 ) |
2726 { | 2707 { |
2727 if ( v3 >= 1u && v3 <= 3u ) | 2708 if ( v3 >= 1u && v3 <= 3u ) |
2728 v4 = v4 + v3 - 1; | 2709 v4 = v4 + v3 - 1; |
2729 } | 2710 } |
2730 else | 2711 else |
2731 { | 2712 { |
2732 v5 = rand() % 100; | 2713 v5 = rand() % 100; |
2733 if ( v5 >= 60 ) | 2714 if ( v5 >= 90 ) |
2734 { | 2715 v4 += 2; |
2735 ++v4; | 2716 else if ( v5 >= 60 ) |
2736 if ( v5 >= 90 ) | 2717 { |
2737 ++v4; | 2718 v4 += 1; |
2738 } | 2719 } |
2739 } | 2720 } |
2740 v6 = v2->vPosition.z; | 2721 actorSector = 0; |
2741 v28 = 0; | |
2742 uFaceID = v6; | |
2743 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 2722 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
2744 v28 = pIndoor->GetSector(v2->vPosition.x, v2->vPosition.y, v6); | 2723 actorSector = pIndoor->GetSector(this->vPosition.x, this->vPosition.y, this->vPosition.z); |
2745 v7 = v4 - 1; | 2724 v7 = v4 - 1; |
2746 v8 = &pActors[uNumActors]; | 2725 v8 = &pActors[uNumActors]; |
2747 v27 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | 2726 v27 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; |
2748 v29 = v7; | |
2749 v9 = &pMonsterStats->pInfos[v7 + 1]; | 2727 v9 = &pMonsterStats->pInfos[v7 + 1]; |
2750 pActors[uNumActors].Reset(); | 2728 pActors[uNumActors].Reset(); |
2751 v10 = &pMonsterList->pMonsters[v7]; | 2729 v10 = &pMonsterList->pMonsters[v7]; |
2752 strcpy(v8->pActorName, v9->pName); | 2730 strcpy(v8->pActorName, v9->pName); |
2753 v8->sCurrentHP = LOWORD(v9->uHP); | 2731 v8->sCurrentHP = LOWORD(v9->uHP); |
2754 memcpy(&v8->pMonsterInfo, v9, 0x58u); | 2732 memcpy(&v8->pMonsterInfo, v9, sizeof(v8->pMonsterInfo)); |
2755 v8->word_000086_some_monster_id = v29 + 1; | 2733 v8->word_000086_some_monster_id = v4; |
2756 v8->uActorRadius = v10->uMonsterRadius; | 2734 v8->uActorRadius = v10->uMonsterRadius; |
2757 v8->uActorHeight = v10->uMonsterHeight; | 2735 v8->uActorHeight = v10->uMonsterHeight; |
2758 v11 = v10->uMovementSpeed; | 2736 v11 = v10->uMovementSpeed; |
2759 v8->pMonsterInfo.uTreasureDiceRolls = 0; | 2737 v8->pMonsterInfo.uTreasureDiceRolls = 0; |
2760 v8->pMonsterInfo.uTreasureType = 0; | 2738 v8->pMonsterInfo.uTreasureType = 0; |
2761 v8->pMonsterInfo.uExp = 0; | 2739 v8->pMonsterInfo.uExp = 0; |
2762 v8->uMovementSpeed = v11; | 2740 v8->uMovementSpeed = v11; |
2763 v12 = rand(); | 2741 v13 = rand() % 2048; |
2764 v13 = v12 % 2048; | 2742 v15 = ((stru_5C6E00->Cos(v13) * (signed __int64)v27) >> 16) + this->vPosition.x; |
2765 v14 = stru_5C6E00->Cos(v12 % 2048); | 2743 v17 = ((stru_5C6E00->Sin(v13) * (signed __int64)v27) >> 16) + this->vPosition.y; |
2766 v26 = v14; | 2744 v8->vInitialPosition.z = this->vPosition.z; |
2767 v15 = ((unsigned __int64)(v14 * (signed __int64)v27) >> 16) + v30->vPosition.x; | 2745 v8->vPosition.z = this->vPosition.z; |
2768 v16 = stru_5C6E00->Sin(v13); | |
2769 v26 = v16; | |
2770 v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16; | |
2771 LOWORD(v16) = uFaceID; | |
2772 v17 = v29 + v30->vPosition.y; | |
2773 v8->vInitialPosition.z = uFaceID; | |
2774 v8->vPosition.z = v16; | |
2775 LOWORD(v16) = v28; | |
2776 v8->vInitialPosition.x = v15; | 2746 v8->vInitialPosition.x = v15; |
2777 v8->vPosition.x = v15; | 2747 v8->vPosition.x = v15; |
2778 v8->vInitialPosition.y = v17; | 2748 v8->vInitialPosition.y = v17; |
2779 v8->vPosition.y = v17; | 2749 v8->vPosition.y = v17; |
2780 v8->uTetherDistance = 256; | 2750 v8->uTetherDistance = 256; |
2781 v8->uSectorID = v16; | 2751 v8->uSectorID = actorSector; |
2782 v8->PrepareSprites(0); | 2752 v8->PrepareSprites(0); |
2783 v18 = v30; | |
2784 v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 2753 v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
2785 LODWORD(v19) = v18->uAlly; | 2754 v19 = this->uAlly; |
2786 if ( !(uint)v19 ) | 2755 if ( !v19 ) |
2787 { | 2756 { |
2788 uFaceID = v18->pMonsterInfo.uID - 1; | 2757 monsterId = this->pMonsterInfo.uID - 1; |
2789 v19 = (signed __int64)((double)uFaceID * 0.33333334); | 2758 v19 = (uint)(monsterId * 0.33333334); |
2790 v18 = v30; | |
2791 } | 2759 } |
2792 v8->uAlly = v19; | 2760 v8->uAlly = v19; |
2793 v20 = v18->uGroup; | |
2794 v8->uCurrentActionTime = 0; | 2761 v8->uCurrentActionTime = 0; |
2795 v8->uGroup = v20; | 2762 v8->uGroup = this->uGroup; |
2796 v8->uAIState = Summoned; | 2763 v8->uAIState = Summoned; |
2797 v8->uCurrentActionLength = 256; | 2764 v8->uCurrentActionLength = 256; |
2798 v8->UpdateAnimation(); | 2765 v8->UpdateAnimation(); |
2799 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor | 2766 |
2800 || (v21 = v30->vPosition.z, | 2767 if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) |
2801 v27 = v30->vPosition.z, | 2768 { |
2802 result = pIndoor->GetSector(v15, v17, v21), | 2769 result = pIndoor->GetSector(v15, v17, this->vPosition.z); |
2803 result == v28) | 2770 if (result != actorSector) |
2804 && (result = BLV_GetFloorLevel(v15, v17, v27, result, &uFaceID), result != -30000) | 2771 return; |
2805 && (result = abs(result - v27), result <= 1024) ) | 2772 result = BLV_GetFloorLevel(v15, v17, v27, result, &monsterId); |
2806 { | 2773 if (result != -30000) |
2807 v23 = v30; | 2774 return; |
2808 ++uNumActors; | 2775 if (abs(result - v27) > 1024) |
2809 ++v23->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | 2776 return; |
2810 if ( v23->uAttributes & 0x80000 ) | 2777 } |
2811 v8->uAttributes |= 0x80000u; | 2778 |
2812 result = 8 * v24; | 2779 ++uNumActors; |
2813 LOBYTE(result) = PID(OBJECT_Actor,v24); | 2780 ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; |
2814 v8->uSummonerID = result; | 2781 if ( this->uAttributes & 0x80000 ) |
2815 } | 2782 v8->uAttributes |= 0x80000u; |
2816 return result; | 2783 v8->uSummonerID = PID(OBJECT_Actor,a2); |
2784 | |
2817 } | 2785 } |
2818 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | 2786 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); |
2819 //----- (0046DF1A) -------------------------------------------------------- | 2787 //----- (0046DF1A) -------------------------------------------------------- |
2820 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | 2788 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) |
2821 { | 2789 { |