Mercurial > might-and-magic-trilogy
comparison Actor.cpp @ 45:bcc051713d20
BLV render & seffects
author | Nomad |
---|---|
date | Mon, 22 Oct 2012 20:45:14 +0200 |
parents | f4450ff595fe |
children | 41cbaabde2cb |
comparison
equal
deleted
inserted
replaced
43:484492a6dd28 | 45:bcc051713d20 |
---|---|
2044 if ( uActionLength == v7 ) | 2044 if ( uActionLength == v7 ) |
2045 v8->uCurrentActionLength = rand() % 256 + 256; | 2045 v8->uCurrentActionLength = rand() % 256 + 256; |
2046 else | 2046 else |
2047 v8->uCurrentActionLength = uActionLength; | 2047 v8->uCurrentActionLength = uActionLength; |
2048 v8->uCurrentActionTime = v7; | 2048 v8->uCurrentActionTime = v7; |
2049 v8->uAIState = v7; | 2049 v8->uAIState = Standing; |
2050 v8->vVelocity.z = v7; | 2050 v8->vVelocity.z = v7; |
2051 v8->vVelocity.y = v7; | 2051 v8->vVelocity.y = v7; |
2052 v8->vVelocity.x = v7; | 2052 v8->vVelocity.x = v7; |
2053 result = v8->UpdateAnimation(); | 2053 result = v8->UpdateAnimation(); |
2054 } | 2054 } |
2081 if ( uActionLength == v5 ) | 2081 if ( uActionLength == v5 ) |
2082 v6->uCurrentActionLength = rand() % 256 + 256; | 2082 v6->uCurrentActionLength = rand() % 256 + 256; |
2083 else | 2083 else |
2084 v6->uCurrentActionLength = uActionLength; | 2084 v6->uCurrentActionLength = uActionLength; |
2085 v6->uCurrentActionTime = v5; | 2085 v6->uCurrentActionTime = v5; |
2086 v6->uAIState = v5; | 2086 v6->uAIState = Standing; |
2087 v6->vVelocity.z = v5; | 2087 v6->vVelocity.z = v5; |
2088 v6->vVelocity.y = v5; | 2088 v6->vVelocity.y = v5; |
2089 v6->vVelocity.x = v5; | 2089 v6->vVelocity.x = v5; |
2090 return v6->UpdateAnimation(); | 2090 return v6->UpdateAnimation(); |
2091 } | 2091 } |
2097 Actor *v1; // esi@1 | 2097 Actor *v1; // esi@1 |
2098 | 2098 |
2099 v1 = &pActors[uActorID]; | 2099 v1 = &pActors[uActorID]; |
2100 v1->uCurrentActionLength = rand() % 128 + 128; | 2100 v1->uCurrentActionLength = rand() % 128 + 128; |
2101 v1->uCurrentActionTime = 0; | 2101 v1->uCurrentActionTime = 0; |
2102 v1->uAIState = 0; | 2102 v1->uAIState = Standing; |
2103 v1->vVelocity.z = 0; | 2103 v1->vVelocity.z = 0; |
2104 v1->vVelocity.y = 0; | 2104 v1->vVelocity.y = 0; |
2105 v1->vVelocity.x = 0; | 2105 v1->vVelocity.x = 0; |
2106 v1->UpdateAnimation(); | 2106 v1->UpdateAnimation(); |
2107 } | 2107 } |
2185 v3->uYawAngle = LOWORD(v12->uYawAngle); | 2185 v3->uYawAngle = LOWORD(v12->uYawAngle); |
2186 v16 = v15[v3->pSpriteIDs[2]].uAnimLength; | 2186 v16 = v15[v3->pSpriteIDs[2]].uAnimLength; |
2187 v17 = v24; | 2187 v17 = v24; |
2188 v3->uCurrentActionLength = 8 * v16; | 2188 v3->uCurrentActionLength = 8 * v16; |
2189 v3->uCurrentActionTime = v13; | 2189 v3->uCurrentActionTime = v13; |
2190 v3->uAIState = 2; | 2190 v3->uAIState = AttackingMelee; |
2191 Actor::PlaySound(v17, 0); | 2191 Actor::PlaySound(v17, 0); |
2192 LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2192 LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2193 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2193 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2194 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 | 2194 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 |
2195 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) | 2195 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) |
2582 v3->uYawAngle = LOWORD(v9->uYawAngle); | 2582 v3->uYawAngle = LOWORD(v9->uYawAngle); |
2583 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; | 2583 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; |
2584 v14 = v22; | 2584 v14 = v22; |
2585 v3->uCurrentActionLength = 8 * v13; | 2585 v3->uCurrentActionLength = 8 * v13; |
2586 v3->uCurrentActionTime = v10; | 2586 v3->uCurrentActionTime = v10; |
2587 v3->uAIState = 18; | 2587 v3->uAIState = AttackingRanged4; |
2588 Actor::PlaySound(v14, 0); | 2588 Actor::PlaySound(v14, 0); |
2589 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2589 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2590 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2590 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2591 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | 2591 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 |
2592 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | 2592 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) |
2607 v3->vVelocity.x = v10; | 2607 v3->vVelocity.x = v10; |
2608 if ( sub_42FB5C(v16) ) | 2608 if ( sub_42FB5C(v16) ) |
2609 { | 2609 { |
2610 v3->uCurrentActionLength = 64; | 2610 v3->uCurrentActionLength = 64; |
2611 v3->uCurrentActionTime = v10; | 2611 v3->uCurrentActionTime = v10; |
2612 v3->uAIState = 9; | 2612 v3->uAIState = Fidgeting; |
2613 result = v3->UpdateAnimation(); | 2613 result = v3->UpdateAnimation(); |
2614 v3->uAIState = 18; | 2614 v3->uAIState = AttackingRanged4; |
2615 } | 2615 } |
2616 else | 2616 else |
2617 { | 2617 { |
2618 result = v3->UpdateAnimation(); | 2618 result = v3->UpdateAnimation(); |
2619 } | 2619 } |
2694 v3->uYawAngle = LOWORD(v9->uYawAngle); | 2694 v3->uYawAngle = LOWORD(v9->uYawAngle); |
2695 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; | 2695 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; |
2696 v14 = v22; | 2696 v14 = v22; |
2697 v3->uCurrentActionLength = 8 * v13; | 2697 v3->uCurrentActionLength = 8 * v13; |
2698 v3->uCurrentActionTime = v10; | 2698 v3->uCurrentActionTime = v10; |
2699 v3->uAIState = 13; | 2699 v3->uAIState = AttackingRanged3; |
2700 Actor::PlaySound(v14, 0); | 2700 Actor::PlaySound(v14, 0); |
2701 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2701 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2702 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2702 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2703 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | 2703 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 |
2704 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | 2704 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) |
2719 v3->vVelocity.x = v10; | 2719 v3->vVelocity.x = v10; |
2720 if ( sub_42FB5C(v16) ) | 2720 if ( sub_42FB5C(v16) ) |
2721 { | 2721 { |
2722 v3->uCurrentActionLength = 64; | 2722 v3->uCurrentActionLength = 64; |
2723 v3->uCurrentActionTime = v10; | 2723 v3->uCurrentActionTime = v10; |
2724 v3->uAIState = 9; | 2724 v3->uAIState = Fidgeting; |
2725 result = v3->UpdateAnimation(); | 2725 result = v3->UpdateAnimation(); |
2726 v3->uAIState = 13; | 2726 v3->uAIState = AttackingRanged3; |
2727 } | 2727 } |
2728 else | 2728 else |
2729 { | 2729 { |
2730 result = v3->UpdateAnimation(); | 2730 result = v3->UpdateAnimation(); |
2731 } | 2731 } |
2805 v3->uYawAngle = LOWORD(v9->uYawAngle); | 2805 v3->uYawAngle = LOWORD(v9->uYawAngle); |
2806 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; | 2806 v13 = v12[v3->pSpriteIDs[3]].uAnimLength; |
2807 v14 = v21; | 2807 v14 = v21; |
2808 v3->uCurrentActionLength = 8 * v13; | 2808 v3->uCurrentActionLength = 8 * v13; |
2809 v3->uCurrentActionTime = v10; | 2809 v3->uCurrentActionTime = v10; |
2810 v3->uAIState = 12; | 2810 v3->uAIState = AttackingRanged2; |
2811 Actor::PlaySound(v14, 0); | 2811 Actor::PlaySound(v14, 0); |
2812 LODWORD(v15) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2812 LODWORD(v15) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2813 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2813 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2814 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | 2814 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 |
2815 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | 2815 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) |
2909 v3->uYawAngle = LOWORD(v10->uYawAngle); | 2909 v3->uYawAngle = LOWORD(v10->uYawAngle); |
2910 v14 = v13[v3->pSpriteIDs[3]].uAnimLength; | 2910 v14 = v13[v3->pSpriteIDs[3]].uAnimLength; |
2911 v15 = v21; | 2911 v15 = v21; |
2912 v3->uCurrentActionLength = 8 * v14; | 2912 v3->uCurrentActionLength = 8 * v14; |
2913 v3->uCurrentActionTime = v11; | 2913 v3->uCurrentActionTime = v11; |
2914 v3->uAIState = 3; | 2914 v3->uAIState = AttackingRanged1; |
2915 Actor::PlaySound(v15, 0); | 2915 Actor::PlaySound(v15, 0); |
2916 v16 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2916 v16 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2917 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | 2917 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; |
2918 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v11 | 2918 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v11 |
2919 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v11 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v11) ) | 2919 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v11 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v11) ) |
3008 if ( v11 ) | 3008 if ( v11 ) |
3009 v5->uCurrentActionLength = 32 * v19 / v11; | 3009 v5->uCurrentActionLength = 32 * v19 / v11; |
3010 else | 3010 else |
3011 v5->uCurrentActionLength = 0; | 3011 v5->uCurrentActionLength = 0; |
3012 v5->uCurrentActionTime = 0; | 3012 v5->uCurrentActionTime = 0; |
3013 v5->uAIState = 1; | 3013 v5->uAIState = Tethered; |
3014 if ( rand() % 100 < 2 ) | 3014 if ( rand() % 100 < 2 ) |
3015 Actor::PlaySound(uActorID, 3u); | 3015 Actor::PlaySound(uActorID, 3u); |
3016 v5->UpdateAnimation(); | 3016 v5->UpdateAnimation(); |
3017 } | 3017 } |
3018 | 3018 |
3117 v6 = pSpriteFrameTable->pSpriteSFrames; | 3117 v6 = pSpriteFrameTable->pSpriteSFrames; |
3118 v4->uYawAngle = LOWORD(v10.uYawAngle); | 3118 v4->uYawAngle = LOWORD(v10.uYawAngle); |
3119 v7 = v6[v4->pSpriteIDs[4]].uAnimLength; | 3119 v7 = v6[v4->pSpriteIDs[4]].uAnimLength; |
3120 v8 = v11; | 3120 v8 = v11; |
3121 v4->uCurrentActionTime = 0; | 3121 v4->uCurrentActionTime = 0; |
3122 v4->uAIState = 8; | 3122 v4->uAIState = Stunned; |
3123 v4->uCurrentActionLength = 8 * v7; | 3123 v4->uCurrentActionLength = 8 * v7; |
3124 Actor::PlaySound(v8, 2u); | 3124 Actor::PlaySound(v8, 2u); |
3125 result = v4->UpdateAnimation(); | 3125 result = v4->UpdateAnimation(); |
3126 } | 3126 } |
3127 return result; | 3127 return result; |
3218 v1 = &pActors[uActorID]; | 3218 v1 = &pActors[uActorID]; |
3219 v11 = uActorID; | 3219 v11 = uActorID; |
3220 v2 = pSpriteFrameTable->pSpriteSFrames; | 3220 v2 = pSpriteFrameTable->pSpriteSFrames; |
3221 v3 = 60 * v1->pSpriteIDs[5]; | 3221 v3 = 60 * v1->pSpriteIDs[5]; |
3222 v1->uCurrentActionTime = 0; | 3222 v1->uCurrentActionTime = 0; |
3223 v1->uAIState = 4; | 3223 v1->uAIState = Dying; |
3224 v1->uCurrentActionAnimation = 5; | 3224 v1->uCurrentActionAnimation = 5; |
3225 LOWORD(v3) = *(__int16 *)((char *)&v2->uAnimLength + v3); | 3225 LOWORD(v3) = *(__int16 *)((char *)&v2->uAnimLength + v3); |
3226 v1->sCurrentHP = 0; | 3226 v1->sCurrentHP = 0; |
3227 v1->uCurrentActionLength = 8 * v3; | 3227 v1->uCurrentActionLength = 8 * v3; |
3228 v1->pActorBuffs[6].Reset(); | 3228 v1->pActorBuffs[6].Reset(); |
3442 if ( uActionLength ) | 3442 if ( uActionLength ) |
3443 v7->uCurrentActionLength = uActionLength; | 3443 v7->uCurrentActionLength = uActionLength; |
3444 else | 3444 else |
3445 v7->uCurrentActionLength = 128; | 3445 v7->uCurrentActionLength = 128; |
3446 v7->uPitchAngle = LOWORD(v10->uPitchAngle); | 3446 v7->uPitchAngle = LOWORD(v10->uPitchAngle); |
3447 v7->uAIState = 6; | 3447 v7->uAIState = Pursuing; |
3448 return v7->UpdateAnimation(); | 3448 return v7->UpdateAnimation(); |
3449 } | 3449 } |
3450 | 3450 |
3451 //----- (00402968) -------------------------------------------------------- | 3451 //----- (00402968) -------------------------------------------------------- |
3452 unsigned int __fastcall Actor::_402968(unsigned int uActorID, signed int edx0, int uActionLength, AIDirection *a4) | 3452 unsigned int __fastcall Actor::_402968(unsigned int uActorID, signed int edx0, int uActionLength, AIDirection *a4) |
3501 v5->uYawAngle = LOWORD(stru_5C6E00->uIntegerHalfPi) + LOWORD(a4->uYawAngle); | 3501 v5->uYawAngle = LOWORD(stru_5C6E00->uIntegerHalfPi) + LOWORD(a4->uYawAngle); |
3502 v5->uYawAngle = LOWORD(stru_5C6E00->uDoublePiMask) & (v5->uYawAngle + rand() % (signed int)stru_5C6E00->uIntegerPi); | 3502 v5->uYawAngle = LOWORD(stru_5C6E00->uDoublePiMask) & (v5->uYawAngle + rand() % (signed int)stru_5C6E00->uIntegerPi); |
3503 v9 = LOWORD(a4->uPitchAngle); | 3503 v9 = LOWORD(a4->uPitchAngle); |
3504 v5->uCurrentActionTime = 0; | 3504 v5->uCurrentActionTime = 0; |
3505 v5->uPitchAngle = v9; | 3505 v5->uPitchAngle = v9; |
3506 v5->uAIState = 7; | 3506 v5->uAIState = Fleeing; |
3507 result = v5->UpdateAnimation(); | 3507 result = v5->UpdateAnimation(); |
3508 } | 3508 } |
3509 } | 3509 } |
3510 return result; | 3510 return result; |
3511 } | 3511 } |
3586 } | 3586 } |
3587 v7->uYawAngle = LOWORD(v10->uYawAngle); | 3587 v7->uYawAngle = LOWORD(v10->uYawAngle); |
3588 v14 = LOWORD(v10->uPitchAngle); | 3588 v14 = LOWORD(v10->uPitchAngle); |
3589 v7->uCurrentActionTime = 0; | 3589 v7->uCurrentActionTime = 0; |
3590 v7->uPitchAngle = v14; | 3590 v7->uPitchAngle = v14; |
3591 v7->uAIState = 6; | 3591 v7->uAIState = Pursuing; |
3592 return v7->UpdateAnimation(); | 3592 return v7->UpdateAnimation(); |
3593 } | 3593 } |
3594 | 3594 |
3595 | 3595 |
3596 //----- (00402686) -------------------------------------------------------- | 3596 //----- (00402686) -------------------------------------------------------- |
3677 v15 = v14 - 256; | 3677 v15 = v14 - 256; |
3678 v6->uYawAngle = v15; | 3678 v6->uYawAngle = v15; |
3679 v16 = LOWORD(v9->uPitchAngle); | 3679 v16 = LOWORD(v9->uPitchAngle); |
3680 v6->uCurrentActionTime = 0; | 3680 v6->uCurrentActionTime = 0; |
3681 v6->uPitchAngle = v16; | 3681 v6->uPitchAngle = v16; |
3682 v6->uAIState = 6; | 3682 v6->uAIState = Pursuing; |
3683 if ( rand() % 100 < 2 ) | 3683 if ( rand() % 100 < 2 ) |
3684 Actor::PlaySound(v4, 2u); | 3684 Actor::PlaySound(v4, 2u); |
3685 return v6->UpdateAnimation(); | 3685 return v6->UpdateAnimation(); |
3686 } | 3686 } |
3687 | 3687 |
3947 | 3947 |
3948 | 3948 |
3949 //----- (0045976D) -------------------------------------------------------- | 3949 //----- (0045976D) -------------------------------------------------------- |
3950 unsigned int Actor::UpdateAnimation() | 3950 unsigned int Actor::UpdateAnimation() |
3951 { | 3951 { |
3952 enum AIState state; // edx@1 | 3952 AIState state; // edx@1 |
3953 unsigned int result; // eax@1 | 3953 unsigned int result; // eax@1 |
3954 | 3954 |
3955 state = (AIState)this->uAIState; | 3955 state = (AIState)this->uAIState; |
3956 BYTE2(this->uAttributes) &= 0xDFu; | 3956 BYTE2(this->uAttributes) &= 0xDFu; |
3957 result = this->uAttributes; | 3957 result = this->uAttributes; |
4028 this->vGuardingPosition.y = 0; | 4028 this->vGuardingPosition.y = 0; |
4029 this->vGuardingPosition.x = 0; | 4029 this->vGuardingPosition.x = 0; |
4030 this->uTetherDistance = 256; | 4030 this->uTetherDistance = 256; |
4031 this->uActorRadius = 32; | 4031 this->uActorRadius = 32; |
4032 this->uActorHeight = 128; | 4032 this->uActorHeight = 128; |
4033 this->uAIState = 0; | 4033 this->uAIState = Standing; |
4034 this->uCurrentActionAnimation = 0; | 4034 this->uCurrentActionAnimation = 0; |
4035 this->uMovementSpeed = 200; | 4035 this->uMovementSpeed = 200; |
4036 this->uCarriedItemID = 0; | 4036 this->uCarriedItemID = 0; |
4037 this->uGroup = 0; | 4037 this->uGroup = 0; |
4038 this->uAlly = 0; | 4038 this->uAlly = 0; |
4210 } | 4210 } |
4211 v8->uAlly = v19; | 4211 v8->uAlly = v19; |
4212 v20 = v18->uGroup; | 4212 v20 = v18->uGroup; |
4213 v8->uCurrentActionTime = 0; | 4213 v8->uCurrentActionTime = 0; |
4214 v8->uGroup = v20; | 4214 v8->uGroup = v20; |
4215 v8->uAIState = 17; | 4215 v8->uAIState = Summoned; |
4216 v8->uCurrentActionLength = 256; | 4216 v8->uCurrentActionLength = 256; |
4217 v8->UpdateAnimation(); | 4217 v8->UpdateAnimation(); |
4218 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor | 4218 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor |
4219 || (v21 = v30->vPosition.z, | 4219 || (v21 = v30->vPosition.z, |
4220 v27 = v30->vPosition.z, | 4220 v27 = v30->vPosition.z, |