comparison mm7_3.cpp @ 1065:e86b4951da70

Merge
author Gloval
date Fri, 24 May 2013 08:17:05 +0400
parents 89422dd58318
children e23a79658fc5
comparison
equal deleted inserted replaced
1064:655fde266d96 1065:e86b4951da70
1176 //v34 = 0; 1176 //v34 = 0;
1177 if ( v0->pMonsterInfo.uHostilityType ) 1177 if ( v0->pMonsterInfo.uHostilityType )
1178 { 1178 {
1179 if ( v71 == 0 ) 1179 if ( v71 == 0 )
1180 { 1180 {
1181 Actor::Flee(v75, v38, 0, (AIDirection *)0); 1181 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
1182 } 1182 }
1183 else 1183 else
1184 { 1184 {
1185 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); 1185 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
1186 } 1186 }
1189 { 1189 {
1190 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); 1190 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
1191 } 1191 }
1192 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) 1192 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
1193 { 1193 {
1194 Actor::Flee(v75, v38, 0, (AIDirection *)0); 1194 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
1195 } 1195 }
1196 else 1196 else
1197 { 1197 {
1198 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); 1198 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
1199 } 1199 }
1200 } 1200 }
1201 break; 1201 break;
1202 case OBJECT_Player: 1202 case OBJECT_Player:
1203 if ( !v0->GetActorsRelation(0) ) 1203 if ( !v0->GetActorsRelation(0) )
1204 { 1204 {
1205 v38 = stru_721530.uFaceID; 1205 v38 = stru_721530.uFaceID;
1206 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); 1206 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
1207 break; 1207 break;
1208 } 1208 }
1209 //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; 1209 //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0;
1210 //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; 1210 //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0;
1211 v0->vVelocity.y = 0; 1211 v0->vVelocity.y = 0;
2228 v121 = pParty->uFallSpeed; 2228 v121 = pParty->uFallSpeed;
2229 pZ = pParty->vPosition.z; 2229 pZ = pParty->vPosition.z;
2230 v1 = 0; 2230 v1 = 0;
2231 v103 = 0; 2231 v103 = 0;
2232 v2 = 0; 2232 v2 = 0;
2233 *(float *)&v128 = 0.0; 2233 //*(float *)&v128 = 0.0;
2234 v128 = 0;
2235 v129 = 0;
2234 pX = pParty->vPosition.x; 2236 pX = pParty->vPosition.x;
2235 pY = pParty->vPosition.y; 2237 pY = pParty->vPosition.y;
2236 v113 = pParty->field_6F0; 2238 v113 = pParty->field_6F0;
2237 bJumping = 0; 2239 bJumping = 0;
2238 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); 2240 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
2646 pPartyActionQueue->uNumActions = 0; 2648 pPartyActionQueue->uNumActions = 0;
2647 break; 2649 break;
2648 } 2650 }
2649 } 2651 }
2650 2652
2651 LABEL_123: 2653 //LABEL_123:
2652 pParty->sRotationY = _angle_y; 2654 pParty->sRotationY = _angle_y;
2653 pParty->sRotationX = _angle_x; 2655 pParty->sRotationX = _angle_x;
2654 if ( pZ < v111 ) 2656 if ( pZ < v111 || pParty->bFlying)
2655 { 2657 {
2656 if ( pParty->bFlying ) 2658 if ( pParty->bFlying )
2657 { 2659 {
2658 LABEL_130: 2660 //LABEL_130:
2659 v31 = GetTickCount(); 2661 v31 = GetTickCount();
2660 v126 = stru_5C6E00->Cos(v31); 2662 v126 = stru_5C6E00->Cos(v31);
2661 v129 = (unsigned __int64)(4i64 * v126) >> 16; 2663 v129 = (unsigned __int64)(4i64 * v126) >> 16;
2662 pZ = v113 + v129; 2664 pZ = v113 + v129;
2663 if ( v127 ) 2665 if ( v127 )
2664 pZ = v113; 2666 pZ = v113;
2665 if (pParty->FlyActive()) 2667 if (pParty->FlyActive())
2666 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; 2668 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
2667 pParty->uFallStartY = pZ; 2669 pParty->uFallStartY = pZ;
2668 goto LABEL_141; 2670 //goto LABEL_141;
2669 } 2671 }
2670 if ( v130 && v121 ) 2672 else
2671 sub_42F960_create_object(pX, pY, v111); 2673 {
2672 v121 = 0; 2674 if ( v130 && v121 )
2673 pZ = v111; 2675 sub_42F960_create_object(pX, pY, v111);
2674 pParty->uFallStartY = v111; 2676 v121 = 0;
2675 } 2677 pZ = v111;
2676 if ( pParty->bFlying ) 2678 pParty->uFallStartY = v111;
2677 goto LABEL_130; 2679 v113 = pZ;
2678 v113 = pZ; 2680 if (pParty->FlyActive())
2679 if (pParty->FlyActive()) 2681 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
2680 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; 2682
2681 2683 }
2682 LABEL_141: 2684 }
2685 else
2686 {
2687 v113 = pZ;
2688 if (pParty->FlyActive())
2689 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
2690 }
2691 //LABEL_141:
2683 if (bJumping && !pParty->bFlying) 2692 if (bJumping && !pParty->bFlying)
2684 { 2693 {
2685 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); 2694 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
2686 v34 = v121 + 2 * v33; 2695 v34 = v121 + 2 * v33;
2687 v121 += 2 * v33; 2696 v121 += 2 * v33;
2688 goto LABEL_164; 2697 }
2689 } 2698 else if (!partyAtHighSlope)
2690 if (!partyAtHighSlope)
2691 { 2699 {
2692 v34 = v121; 2700 v34 = v121;
2693 if (!bJumping) 2701 }
2694 goto LABEL_150; 2702 else if (!bJumping)
2695 goto LABEL_164; 2703 {
2696 } 2704 if ( !v108 )
2697 if (!bJumping) 2705 {
2698 { 2706 // rolling down the hill
2699 if ( v108 ) 2707 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
2700 goto LABEL_150; 2708 // and falling to the gravity, gradually sliding downwards. nice trick
2701 2709 pZ = v111;
2702 // rolling down the hill 2710 ODM_GetTerrainNormalAt(pX, pY, &v98);
2703 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air 2711 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
2704 // and falling to the gravity, gradually sliding downwards. nice trick 2712 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
2705 pZ = v111; 2713 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
2706 ODM_GetTerrainNormalAt(pX, pY, &v98); 2714 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
2707 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); 2715 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
2708 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; 2716 v128 = v1;
2709 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; 2717 v121 = v34;
2710 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; 2718 }
2711 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); 2719 }
2712 v128 = v1; 2720 else
2713 v121 = v34; 2721 v34 = v121;
2714 if (!bJumping) 2722
2715 goto LABEL_150; 2723 //LABEL_164:
2716 goto LABEL_164; 2724 if ( !bUnderwater && v34 <= 0 && bJumping)
2717 }
2718 v34 = v121;
2719
2720 LABEL_164:
2721 if ( !bUnderwater && v34 <= 0)
2722 { 2725 {
2723 if ( v34 < -500 2726 if ( v34 < -500
2724 && !pParty->bFlying 2727 && !pParty->bFlying
2725 && pParty->vPosition.z - v111 > 1000 2728 && pParty->vPosition.z - v111 > 1000
2726 && !pParty->FeatherFallActive()) 2729 && !pParty->FeatherFallActive())
2733 } 2736 }
2734 } 2737 }
2735 } 2738 }
2736 else 2739 else
2737 { 2740 {
2738 LABEL_150: 2741 //LABEL_150:
2739 pParty->uFallStartY = pZ; 2742 pParty->uFallStartY = pZ;
2740 } 2743 }
2741 2744
2742 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) 2745 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
2743 { 2746 {
2799 if ( !v97 && !v110 && !v108 ) 2802 if ( !v97 && !v110 && !v108 )
2800 v107 = 1; 2803 v107 = 1;
2801 v43 = 1; 2804 v43 = 1;
2802 v44 = 1; 2805 v44 = 1;
2803 if ( bUnderwater || !v107 ) 2806 if ( bUnderwater || !v107 )
2804 goto LABEL_197; 2807 {
2805 if ( v127 && v129 > pZ ) 2808 pX = _angle_x;
2806 v44 = 0; 2809 if ( v43 )
2807 if ( v118 && v119 > pZ ) 2810 pY = _angle_y;
2808 v43 = 0; 2811 }
2809 if ( v44 ) 2812 else
2810 goto LABEL_197; 2813 {
2811 if ( v43 ) 2814 if ( v127 && v129 > pZ )
2812 goto LABEL_198; 2815 v44 = 0;
2813 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); 2816 if ( v118 && v119 > pZ )
2814 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) 2817 v43 = 0;
2815 { 2818 if ( v44 )
2816 v43 = 1; 2819 {
2817 LABEL_197: 2820 pX = _angle_x;
2818 pX = _angle_x; 2821 if ( v43 )
2819 if ( !v43 ) 2822 pY = _angle_y;
2820 goto LABEL_199; 2823 }
2821 LABEL_198: 2824 else if ( v43 )
2822 pY = _angle_y; 2825 pY = _angle_y;
2823 } 2826 else
2824 LABEL_199: 2827 {
2828 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
2829 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ )
2830 {
2831 v43 = 1;
2832 pX = _angle_x;
2833 if ( v43 )
2834 pY = _angle_y;
2835 }
2836 }
2837 }
2825 if ( stru_721530.field_7C >= stru_721530.field_6C ) 2838 if ( stru_721530.field_7C >= stru_721530.field_6C )
2826 { 2839 {
2827 if ( !v107 ) 2840 if ( !v107 )
2828 { 2841 {
2829 pX = stru_721530.normal2.x; 2842 pX = stru_721530.normal2.x;
2841 { 2854 {
2842 if (pParty->Invisible()) 2855 if (pParty->Invisible())
2843 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); 2856 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
2844 2857
2845 viewparams->bRedrawGameUI = 1; 2858 viewparams->bRedrawGameUI = 1;
2846 goto LABEL_234; 2859 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2847 } 2860 v127 = (BSPModel *)58500;
2861 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2862 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2863 ++v126;
2864 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
2865 continue;
2866 }
2848 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) 2867 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
2849 { 2868 {
2850 v56 = integer_sqrt(v2 * v2 + v128 * v128); 2869 v56 = integer_sqrt(v2 * v2 + v128 * v128);
2851 v118 = v56; 2870 v118 = v56;
2852 v57 = stru_5C6E00->Atan2( 2871 v57 = stru_5C6E00->Atan2(
2882 if ( bUnderwater == 1 ) 2901 if ( bUnderwater == 1 )
2883 v119 = 0; 2902 v119 = 0;
2884 v53 = v47->uPolygonType; 2903 v53 = v47->uPolygonType;
2885 if ( v53 == 3 ) 2904 if ( v53 == 3 )
2886 { 2905 {
2887 if ( v121 < 0 ) 2906 if ( v121 < 0 )
2888 v121 = 0; 2907 v121 = 0;
2889 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; 2908 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
2890 if ( v2 * v2 + v128 * v128 < 400 ) 2909 if ( v2 * v2 + v128 * v128 < 400 )
2891 { 2910 {
2892 v2 = 0; 2911 v2 = 0;
2893 *(float *)&v128 = 0.0; 2912 *(float *)&v128 = 0.0;
2894 } 2913 }
2895 goto LABEL_221; 2914 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
2915 {
2916 pParty->floor_face_pid = v45;
2917 v103 = v47->sCogTriggeredID;
2918 }
2919 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2920 v127 = (BSPModel *)58500;
2921 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2922 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2923 ++v126;
2924 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
2925 continue;
2896 } 2926 }
2897 if ( !v129 && (v53 != 4 || v119) ) 2927 if ( !v129 && (v53 != 4 || v119) )
2898 { 2928 {
2899 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; 2929 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
2900 if ( stru_721530.field_64 >> 3 > v118 ) 2930 if ( stru_721530.field_64 >> 3 > v118 )
2923 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); 2953 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16);
2924 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); 2954 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16);
2925 if ( !v119 ) 2955 if ( !v119 )
2926 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); 2956 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
2927 } 2957 }
2928 LABEL_220: 2958 //LABEL_220:
2929 v45 = stru_721530.uFaceID; 2959 v45 = stru_721530.uFaceID;
2930 LABEL_221: 2960 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
2931 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) 2961 {
2932 { 2962 pParty->floor_face_pid = v45;
2933 pParty->floor_face_pid = v45; 2963 v103 = v47->sCogTriggeredID;
2934 v103 = v47->sCogTriggeredID; 2964 }
2935 } 2965 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2936 goto LABEL_234; 2966 v127 = (BSPModel *)58500;
2967 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2968 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2969 ++v126;
2970 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
2971 continue;
2937 } 2972 }
2938 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; 2973 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
2939 if ( stru_721530.field_64 >> 3 > v118 ) 2974 if ( stru_721530.field_64 >> 3 > v118 )
2940 v118 = stru_721530.field_64 >> 3; 2975 v118 = stru_721530.field_64 >> 3;
2941 v122 = v47->pFacePlane.vNormal.x; 2976 v122 = v47->pFacePlane.vNormal.x;
2946 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; 2981 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
2947 v121 += v129; 2982 v121 += v129;
2948 v2 += v122; 2983 v2 += v122;
2949 v128 += (int)v127; 2984 v128 += (int)v127;
2950 if ( v2 * v2 + v128 * v128 >= 400 ) 2985 if ( v2 * v2 + v128 * v128 >= 400 )
2951 goto LABEL_220; 2986 {
2987 v45 = stru_721530.uFaceID;
2988 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
2989 {
2990 pParty->floor_face_pid = v45;
2991 v103 = v47->sCogTriggeredID;
2992 }
2993 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2994 v127 = (BSPModel *)58500;
2995 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2996 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2997 ++v126;
2998 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
2999 continue;
3000 }
2952 v2 = 0; 3001 v2 = 0;
2953 v121 = 0; 3002 v121 = 0;
2954 *(float *)&v128 = 0.0; 3003 *(float *)&v128 = 0.0;
2955 } 3004 }
2956 } 3005 }
2957 LABEL_234: 3006 //LABEL_234:
2958 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 3007 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2959 v127 = (BSPModel *)58500; 3008 v127 = (BSPModel *)58500;
2960 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 3009 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2961 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 3010 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2962 ++v126; 3011 ++v126;
2967 { 3016 {
2968 v122 = abs(pParty->vPosition.x - pX); 3017 v122 = abs(pParty->vPosition.x - pX);
2969 v126 = abs(pParty->vPosition.y - pY); 3018 v126 = abs(pParty->vPosition.y - pY);
2970 v62 = abs(pParty->vPosition.z - pZ); 3019 v62 = abs(pParty->vPosition.z - pZ);
2971 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) 3020 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
2972 goto LABEL_344; 3021 {
2973 if ( v114 && (!bJumping || v101) ) 3022 pAudioPlayer->_4AA258(804);
2974 { 3023 pParty->walk_sound_timer = 64;
2975 if ( !v107 3024 }
2976 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) 3025 else
2977 { 3026 {
3027 if ( v114 && (!bJumping || v101) )
3028 {
3029 if ( !v107
3030 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
3031 {
2978 3032
2979 v90 = -1; 3033 v90 = -1;
2980 v89 = 1; 3034 v89 = 1;
2981 v88 = 804; 3035 v88 = 804;
2982 v87 = 64; 3036 v87 = 64;
2983 goto LABEL_257; 3037 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
2984 } 3038 }
2985 3039 else
2986 v90 = -1; 3040 {
2987 v89 = 1; 3041 v90 = -1;
2988 v88 = 804; 3042 v89 = 1;
2989 v86 = 1; 3043 v88 = 804;
2990 LABEL_255: 3044 v86 = 1;
2991 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; 3045 //LABEL_255:
2992 v64 = WorldPosToGridCellX(pParty->vPosition.x); 3046 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
2993 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); 3047 v64 = WorldPosToGridCellX(pParty->vPosition.x);
2994 goto LABEL_257; 3048 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86);
2995 } 3049 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
2996 if ( v124 && (!bJumping || v101) ) 3050 }
2997 { 3051 }
2998 if ( v107 3052 else
2999 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) 3053 {
3000 { 3054 if ( v124 && (!bJumping || v101) )
3055 {
3056 if ( v107
3057 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
3058 {
3001 3059
3002 v90 = -1; 3060 v90 = -1;
3003 v89 = 1; 3061 v89 = 1;
3004 v88 = 804; 3062 v88 = 804;
3005 v86 = 0; 3063 v86 = 0;
3006 goto LABEL_255; 3064 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
3007 } 3065 v64 = WorldPosToGridCellX(pParty->vPosition.x);
3008 v90 = -1; 3066 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86);
3009 v89 = 1; 3067 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
3010 v88 = 804; 3068 }
3011 v87 = 103; 3069 else
3012 LABEL_257: 3070 {
3013 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); 3071 v90 = -1;
3014 } 3072 v89 = 1;
3015 else 3073 v88 = 804;
3016 { 3074 v87 = 103;
3017 LABEL_344: 3075 //LABEL_257:
3018 pAudioPlayer->_4AA258(804); 3076 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
3019 pParty->walk_sound_timer = 64; 3077 }
3078 }
3079 else
3080 {
3081 //LABEL_344:
3082 pAudioPlayer->_4AA258(804);
3083 pParty->walk_sound_timer = 64;
3084 }
3085 }
3020 } 3086 }
3021 } 3087 }
3022 if ( !bJumping || v101 ) 3088 if ( !bJumping || v101 )
3023 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; 3089 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
3024 else 3090 else
3111 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk ) 3177 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk )
3112 { 3178 {
3113 if ( v127 ) 3179 if ( v127 )
3114 { 3180 {
3115 v78 = v69 != 0; 3181 v78 = v69 != 0;
3116 goto LABEL_306; 3182 }
3117 } 3183 else
3118 v114 = 1; 3184 {
3119 } 3185 v114 = 1;
3120 v78 = 1; 3186 v78 = 1;
3121 LABEL_306: 3187 }
3188 }
3189 else
3190 v78 = 1;
3191 //LABEL_306:
3122 if ( v77 ) 3192 if ( v77 )
3123 { 3193 {
3124 pParty->vPosition.x = pX; 3194 pParty->vPosition.x = pX;
3125 if ( !v78 )
3126 goto LABEL_313;
3127 goto LABEL_312;
3128 } 3195 }
3129 if ( v78 ) 3196 if ( v78 )
3130 { 3197 {
3131 LABEL_312:
3132 pParty->vPosition.y = pY; 3198 pParty->vPosition.y = pY;
3133 LABEL_313: 3199 }
3200 if ( v78 || v77)
3201 {
3134 if ( bWaterWalk ) 3202 if ( bWaterWalk )
3135 { 3203 {
3136 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; 3204 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
3137 //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178; 3205 //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178;
3138 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; 3206 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
3146 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER; 3214 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER;
3147 *(short *)v79 = v80 & 0xFFFE; 3215 *(short *)v79 = v80 & 0xFFFE;
3148 } 3216 }
3149 } 3217 }
3150 } 3218 }
3151 goto LABEL_318; 3219 }
3152 } 3220 else if ( bWalkSound && pParty->walk_sound_timer <= 0 )
3153 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
3154 { 3221 {
3155 pAudioPlayer->_4AA258(804); 3222 pAudioPlayer->_4AA258(804);
3156 pParty->walk_sound_timer = 64; 3223 pParty->walk_sound_timer = 64;
3157 } 3224 }
3158 LABEL_318: 3225 //LABEL_318:
3159 v81 = pZ; 3226 v81 = pZ;
3160 v82 = pZ; 3227 v82 = pZ;
3161 pParty->vPosition.z = pZ; 3228 pParty->vPosition.z = pZ;
3162 if ( pZ > 8160 ) 3229 if ( pZ > 8160 )
3163 { 3230 {
14383 //----- (00401A91) -------------------------------------------------------- 14450 //----- (00401A91) --------------------------------------------------------
14384 void __cdecl UpdateActorAI() 14451 void __cdecl UpdateActorAI()
14385 { 14452 {
14386 //unsigned int v0; // esi@4 14453 //unsigned int v0; // esi@4
14387 int v1; // eax@7 14454 int v1; // eax@7
14388 int v2; // ecx@7 14455 //int v2; // ecx@7
14389 int v3; // eax@7 14456 //int v3; // eax@7
14390 signed int v4; // edi@10 14457 signed int v4; // edi@10
14391 Actor *v5; // esi@12 14458 Actor *v5; // esi@12
14392 signed int v6; // eax@14 14459 signed int sDmg; // eax@14
14393 __int16 v7; // cx@14 14460 __int16 v7; // cx@14
14394 Player **v8; // esi@20 14461 //Player **v8; // esi@20
14395 Player *pPlayer; // ecx@21 14462 Player *pPlayer; // ecx@21
14396 //Actor *pActor; // esi@34 14463 Actor *pActor; // esi@34
14397 //__int16 v11; // ax@34 14464 //__int16 v11; // ax@34
14398 //unsigned int v12; // eax@47 14465 //unsigned int v12; // eax@47
14399 //signed int v13; // edi@47 14466 //signed int v13; // edi@47
14400 //SpellBuff *v14; // ebx@47 14467 //SpellBuff *v14; // ebx@47
14401 //unsigned int v15; // edi@67 14468 //unsigned int v15; // edi@67
14402 //char *v16; // eax@67 14469 //char *v16; // eax@67
14403 //unsigned int v17; // edx@67 14470 //unsigned int v17; // edx@67
14404 //unsigned int v18; // ecx@67 14471 //unsigned int v18; // ecx@67
14405 //unsigned __int16 v19; // ax@72 14472 //unsigned __int16 v19; // ax@72
14406 //int *v20; // esi@80 14473 //int *v20; // esi@80
14407 Actor *v21; // ebx@80 14474 //Actor *v21; // ebx@80
14408 unsigned __int16 v22; // ax@86 14475 unsigned __int16 v22; // ax@86
14409 //signed int v23; // eax@94 14476 //signed int v23; // eax@94
14410 //unsigned int v24; // eax@102 14477 //unsigned int v24; // eax@102
14411 //signed int v25; // edi@102 14478 //signed int v25; // edi@102
14412 //SpellBuff *v26; // esi@102 14479 //SpellBuff *v26; // esi@102
14485 pParty->armageddon_timer = 0; 14552 pParty->armageddon_timer = 0;
14486 } 14553 }
14487 else 14554 else
14488 { 14555 {
14489 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); 14556 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8);
14490 v1 = rand(); 14557 pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8;
14491 v2 = 128; 14558 if ( pParty->sRotationX > 128)
14492 v3 = pParty->sRotationX + v1 % 16 - 8; 14559 pParty->sRotationX = 128;
14493 pParty->sRotationX = v3; 14560 else if ( pParty->sRotationX < -128 )
14494 if ( v3 > 128 || (v2 = -128, v3 < -128) ) 14561 pParty->sRotationX = -128;
14495 pParty->sRotationX = v2; 14562
14496 pParty->uFlags |= 2u; 14563 pParty->uFlags |= 2u;
14497 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; 14564 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed;
14498 v4 = pParty->field_16140 + 50; 14565 v4 = pParty->field_16140 + 50;
14499 if ( pParty->armageddon_timer <= 0 ) 14566 if ( pParty->armageddon_timer <= 0 )
14500 { 14567 {
14501 pParty->armageddon_timer = 0; 14568 pParty->armageddon_timer = 0;
14502 v84 = 0; 14569 for(int i = 0; i < uNumActors; i++)
14503 if ( (signed int)uNumActors > 0 )
14504 { 14570 {
14505 v5 = pActors;//[0].sCurrentHP; 14571 pActor=&pActors[i];
14506 do 14572 if ( pActor->CanAct() )
14507 { 14573 {
14508 if ( v5->CanAct() ) 14574 sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4);
14575 pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4);
14576 if ( sDmg )
14509 { 14577 {
14510 v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); 14578 if ( pActor->sCurrentHP >= 0 )
14511 v7 = v5->sCurrentHP - v6;
14512 v5->sCurrentHP = v7;
14513 if ( v6 )
14514 { 14579 {
14515 if ( v7 >= 0 ) 14580 Actor::AI_Stun(i, 4, 0);
14516 { 14581 }
14517 Actor::Stun(v84, 4, 0); 14582 else
14518 } 14583 {
14519 else 14584 Actor::Die(i);
14520 { 14585 if ( pActor->pMonsterInfo.uExp )
14521 Actor::Die(v84); 14586 GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp);
14522 if ( v5->pMonsterInfo.uExp )
14523 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp);
14524 }
14525 } 14587 }
14526 } 14588 }
14527 ++v84;
14528 ++v5;
14529 } 14589 }
14530 while ( (signed int)v84 < (signed int)uNumActors ); 14590 ++v84;
14591 ++v5;
14531 } 14592 }
14532 v8 = &pPlayers[1]; 14593 for(int i = 1; i <= 4; i++)
14533 do
14534 { 14594 {
14535 pPlayer = *v8; 14595 pPlayer = pPlayers[i];
14536 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) 14596 if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] )
14537 pPlayer->ReceiveDamage(v4, DMGT_5); 14597 pPlayer->ReceiveDamage(v4, DMGT_5);
14538 ++v8;
14539 } 14598 }
14540 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
14541 //v0 = 0;
14542 } 14599 }
14543 if (pTurnEngine->field_1C) 14600 if (pTurnEngine->field_1C)
14544 --pTurnEngine->field_1C; 14601 --pTurnEngine->field_1C;
14545 } 14602 }
14546 } 14603 }
14553 14610
14554 14611
14555 //uActorID = v0; 14612 //uActorID = v0;
14556 for (uint i = 0; i < uNumActors; ++i) 14613 for (uint i = 0; i < uNumActors; ++i)
14557 { 14614 {
14558 auto actor = pActors + i; 14615 pActor = &pActors[i];
14559 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState 14616 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState
14560 //do 14617 //do
14561 //{ 14618 //{
14562 //pActor = (Actor *)(LODWORD(v80) - 176); 14619 //pActor = (Actor *)(LODWORD(v80) - 176);
14563 //v11 = *(unsigned int *)LODWORD(v80); 14620 //v11 = *(unsigned int *)LODWORD(v80);
14564 //v49 = *(unsigned int *)LODWORD(v80) == 5; 14621 //v49 = *(unsigned int *)LODWORD(v80) == 5;
14565 ai_near_actors_targets_pid[i] = OBJECT_Player; 14622 ai_near_actors_targets_pid[i] = OBJECT_Player;
14566 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) 14623 if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400)
14567 continue; 14624 continue;
14568 14625
14569 if (!actor->sCurrentHP && actor->uAIState != Dying) 14626 if (!pActor->sCurrentHP && pActor->uAIState != Dying)
14570 Actor::Die(i); 14627 Actor::Die(i);
14571 14628
14572 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; 14629 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1;
14573 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; 14630 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1;
14574 //v12 = 0; 14631 //v12 = 0;
14575 //v13 = 0; 14632 //v13 = 0;
14576 //v14 = (SpellBuff *)(LODWORD(v80) + 36); 14633 //v14 = (SpellBuff *)(LODWORD(v80) + 36);
14577 for (uint j = 0; j < 22; ++j) 14634 for (uint j = 0; j < 22; ++j)
14578 { 14635 {
14579 if (j != 10) 14636 if (j != 10)
14580 actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); 14637 pActor->pActorBuffs[j]._4585CA(pParty->uTimePlayed);
14581 } 14638 }
14582 /*do 14639 /*do
14583 { 14640 {
14584 if ( v13 != 10 ) 14641 if ( v13 != 10 )
14585 { 14642 {
14588 } 14645 }
14589 ++v13; 14646 ++v13;
14590 ++v14; 14647 ++v14;
14591 } 14648 }
14592 while ( v13 < 22 );*/ 14649 while ( v13 < 22 );*/
14593 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) 14650 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
14594 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 14651 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
14595 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) 14652 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
14596 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; 14653 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight;
14597 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) 14654 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
14598 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 14655 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
14599 // not sure 14656 // not sure
14600 else if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) 14657 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
14601 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; 14658 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType;
14602 14659
14603 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 14660 if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0
14604 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) 14661 || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0)
14605 continue; 14662 continue;
14606 14663
14607 //v15 = pMiscTimer->uTimeElapsed; 14664 //v15 = pMiscTimer->uTimeElapsed;
14608 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; 14665 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
14609 //v17 = pActor->uCurrentActionTime; 14666 //v17 = pActor->uCurrentActionTime;
14610 //v18 = pActor->pMonsterInfo.uRecoveryTime; 14667 //v18 = pActor->pMonsterInfo.uRecoveryTime;
14611 if (actor->pMonsterInfo.uRecoveryTime) 14668 if (pActor->pMonsterInfo.uRecoveryTime)
14612 { 14669 {
14613 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) 14670 if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed)
14614 actor->pMonsterInfo.uRecoveryTime = 0; 14671 pActor->pMonsterInfo.uRecoveryTime = 0;
14615 else 14672 else
14616 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; 14673 pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed;
14617 } 14674 }
14618 14675
14619 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; 14676 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
14620 if (actor->uCurrentActionTime < actor->uCurrentActionLength) 14677 if (pActor->uCurrentActionTime < pActor->uCurrentActionLength)
14621 continue; 14678 continue;
14622 14679
14623 //v19 = actor->uAIState; 14680 //v19 = actor->uAIState;
14624 if (actor->uAIState == Dying) 14681 if (pActor->uAIState == Dying)
14625 actor->uAIState = Dead; 14682 pActor->uAIState = Dead;
14626 else 14683 else
14627 { 14684 {
14628 if (actor->uAIState != Summoned) 14685 if (pActor->uAIState != Summoned)
14629 { 14686 {
14630 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); 14687 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr);
14631 continue; 14688 continue;
14632 } 14689 }
14633 actor->uAIState = Standing; 14690 pActor->uAIState = Standing;
14634 } 14691 }
14635 14692
14636 actor->uCurrentActionTime = 0; 14693 pActor->uCurrentActionTime = 0;
14637 actor->uCurrentActionLength = 0; 14694 pActor->uCurrentActionLength = 0;
14638 actor->UpdateAnimation(); 14695 pActor->UpdateAnimation();
14639 //LABEL_78: 14696 //LABEL_78:
14640 //++uActorID; 14697 //++uActorID;
14641 //LODWORD(v80) += 836; 14698 //LODWORD(v80) += 836;
14642 //} 14699 //}
14643 //while ( (signed int)uActorID < (signed int)uNumActors ); 14700 //while ( (signed int)uActorID < (signed int)uNumActors );
14653 { 14710 {
14654 actor_id = ai_near_actors_ids[v78]; 14711 actor_id = ai_near_actors_ids[v78];
14655 assert(actor_id < uNumActors); 14712 assert(actor_id < uNumActors);
14656 14713
14657 //v20 = &ai_near_actors_targets_pid[actor_id]; 14714 //v20 = &ai_near_actors_targets_pid[actor_id];
14658 v21 = &pActors[actor_id]; 14715 pActor = &pActors[actor_id];
14659 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); 14716 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true);
14660 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) 14717 if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id])
14661 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 14718 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
14662 target_pid = ai_near_actors_targets_pid[actor_id]; 14719 target_pid = ai_near_actors_targets_pid[actor_id];
14663 target_pid_type = PID_TYPE(target_pid); 14720 target_pid_type = PID_TYPE(target_pid);
14664 if ( target_pid_type == OBJECT_Actor) 14721 if ( target_pid_type == OBJECT_Actor)
14665 v80 = 0.5; 14722 v80 = 0.5;
14666 else 14723 else
14667 v80 = 1.0; 14724 v80 = 1.0;
14668 v22 = v21->uAIState; 14725 v22 = pActor->uAIState;
14669 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) 14726 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
14670 { 14727 {
14671 continue; 14728 continue;
14672 } 14729 }
14673 if ( !v21->sCurrentHP ) 14730 if ( !pActor->sCurrentHP )
14674 Actor::Die(actor_id); 14731 Actor::Die(actor_id);
14675 for(int i=0;i<22;i++) 14732 for(int i=0;i<22;i++)
14676 { 14733 {
14677 if ( i != 10 ) 14734 if ( i != 10 )
14678 { 14735 {
14679 v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); 14736 pActor->pActorBuffs[i]._4585CA(pParty->uTimePlayed);
14680 } 14737 }
14681 } 14738 }
14682 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) 14739 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
14683 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; 14740 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight;
14684 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) 14741 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
14685 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 14742 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
14686 // not sure 14743 // not sure
14687 else if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) 14744 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
14688 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; 14745 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType;
14689 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) 14746 if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 )
14690 { 14747 {
14691 v21->uAIState = Removed; 14748 pActor->uAIState = Removed;
14692 continue; 14749 continue;
14693 } 14750 }
14694 if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 14751 if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0
14695 || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) 14752 || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0)
14696 { 14753 {
14697 continue; 14754 continue;
14698 } 14755 }
14699 v27 = pMiscTimer->uTimeElapsed; 14756 v27 = pMiscTimer->uTimeElapsed;
14700 v28 = v21->pMonsterInfo.uRecoveryTime; 14757 v28 = pActor->pMonsterInfo.uRecoveryTime;
14701 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; 14758 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
14702 if ( (signed int)v28 > 0 ) 14759 if ( (signed int)v28 > 0 )
14703 v21->pMonsterInfo.uRecoveryTime = v28 - v27; 14760 pActor->pMonsterInfo.uRecoveryTime = v28 - v27;
14704 if ( v21->pMonsterInfo.uRecoveryTime < 0 ) 14761 if ( pActor->pMonsterInfo.uRecoveryTime < 0 )
14705 v21->pMonsterInfo.uRecoveryTime = 0; 14762 pActor->pMonsterInfo.uRecoveryTime = 0;
14706 if ( !(v21->uAttributes & 0x8000) ) 14763 if ( !(pActor->uAttributes & 0x8000) )
14707 v21->uAttributes |= 0x8000; 14764 pActor->uAttributes |= 0x8000;
14708 a1 = PID(OBJECT_Actor,actor_id); 14765 a1 = PID(OBJECT_Actor,actor_id);
14709 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); 14766 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0);
14710 memcpy(&v75, v30, sizeof(v75)); 14767 memcpy(&v75, v30, sizeof(v75));
14711 memcpy(&pDir, &v75, sizeof(pDir)); 14768 memcpy(&pDir, &v75, sizeof(pDir));
14712 uAIState = v21->uAIState; 14769 uAIState = pActor->uAIState;
14713 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly 14770 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly
14714 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 14771 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0
14715 && v80 * 307.2 >= (double)(signed int)v75.uDistance 14772 && v80 * 307.2 >= (double)(signed int)v75.uDistance
14716 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) 14773 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting)
14717 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) 14774 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) )
14718 { 14775 {
14719 v32 = actor_id; 14776 v32 = actor_id;
14720 } 14777 }
14721 else 14778 else
14722 */ 14779 */
14723 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly 14780 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly
14724 || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 14781 || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0
14725 || v80 * 307.2 < (double)(signed int)v75.uDistance 14782 || v80 * 307.2 < (double)(signed int)v75.uDistance
14726 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting 14783 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting
14727 && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) 14784 && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned )
14728 { 14785 {
14729 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) 14786 if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength )
14730 { 14787 {
14731 continue; 14788 continue;
14732 } 14789 }
14733 else if ( v21->uAIState == AttackingMelee ) 14790 else if ( pActor->uAIState == AttackingMelee )
14734 { 14791 {
14735 v35 = stru_50C198.special_ability_use_check(v21, actor_id); 14792 v35 = stru_50C198.special_ability_use_check(pActor, actor_id);
14736 stru_50FE08.Add( 14793 stru_50FE08.Add(
14737 a1, 14794 a1,
14738 5120, 14795 5120,
14739 v21->vPosition.x, 14796 pActor->vPosition.x,
14740 v21->vPosition.y, 14797 pActor->vPosition.y,
14741 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), 14798 pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1),
14742 v35, 14799 v35,
14743 1 14800 1
14744 ); 14801 );
14745 } 14802 }
14746 else if ( v21->uAIState == AttackingRanged1 ) 14803 else if ( pActor->uAIState == AttackingRanged1 )
14747 { 14804 {
14748 v34 = v21->pMonsterInfo.uMissleAttack1Type; 14805 v34 = pActor->pMonsterInfo.uMissleAttack1Type;
14749 Actor::RangedAttack(actor_id, &pDir, v34, 0); 14806 Actor::AI_RangedAttack(actor_id, &pDir, v34, 0);
14750 } 14807 }
14751 else if ( v21->uAIState == AttackingRanged2 ) 14808 else if ( pActor->uAIState == AttackingRanged2 )
14752 { 14809 {
14753 v34 = v21->pMonsterInfo.uMissleAttack2Type; 14810 v34 = pActor->pMonsterInfo.uMissleAttack2Type;
14754 Actor::RangedAttack(actor_id, &pDir, v34, 1); 14811 Actor::AI_RangedAttack(actor_id, &pDir, v34, 1);
14755 } 14812 }
14756 else if ( v21->uAIState == AttackingRanged3 ) 14813 else if ( pActor->uAIState == AttackingRanged3 )
14757 { 14814 {
14758 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; 14815 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1;
14759 v33 = v21->pMonsterInfo.uSpell1ID; 14816 v33 = pActor->pMonsterInfo.uSpell1ID;
14760 Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); 14817 Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65);
14761 } 14818 }
14762 else if ( v21->uAIState == AttackingRanged4 ) 14819 else if ( pActor->uAIState == AttackingRanged4 )
14763 { 14820 {
14764 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; 14821 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2;
14765 v33 = v21->pMonsterInfo.uSpell2ID; 14822 v33 = pActor->pMonsterInfo.uSpell2ID;
14766 Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); 14823 Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65);
14767 } 14824 }
14768 } 14825 }
14769 14826
14770 v36 = v75.uDistance; 14827 v36 = v75.uDistance;
14771 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) 14828 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly)
14772 { 14829 {
14773 if ( target_pid_type == OBJECT_Actor ) 14830 if ( target_pid_type == OBJECT_Actor )
14774 { 14831 {
14775 v36 = v75.uDistance; 14832 v36 = v75.uDistance;
14776 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] 14833 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3]
14777 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); 14834 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3);
14778 } 14835 }
14779 else 14836 else
14780 { 14837 {
14781 v37 = 4; 14838 v37 = 4;
14798 //v39 = __OFSUB__(v36, 5120); 14855 //v39 = __OFSUB__(v36, 5120);
14799 //v38 = ((v36 - 5120) & 0x80000000u) != 0; 14856 //v38 = ((v36 - 5120) & 0x80000000u) != 0;
14800 v38 = 5120; 14857 v38 = 5120;
14801 } 14858 }
14802 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) 14859 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 )
14803 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; 14860 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
14804 } 14861 }
14805 14862
14806 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) 14863 if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 )
14807 { 14864 {
14808 if ( (signed int)v36 >= 10240 ) 14865 if ( (signed int)v36 >= 10240 )
14809 { 14866 {
14810 Actor::_4032B2(actor_id, target_pid, 1024, 0); 14867 Actor::AI_4032B2(actor_id, target_pid, 1024, 0);
14811 } 14868 }
14812 else 14869 else
14813 { 14870 {
14814 //peasents after attacked 14871 //peasents after attacked
14815 //guard after attacked 14872 //guard after attacked
14816 Actor::Flee(actor_id, target_pid, 0, &pDir); 14873 Actor::AI_Flee(actor_id, target_pid, 0, &pDir);
14817 } 14874 }
14818 continue; 14875 continue;
14819 } 14876 }
14820 14877
14821 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) 14878 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid )
14822 { 14879 {
14823 14880
14824 if ( v21->pMonsterInfo.uAIType == 1 ) 14881 if ( pActor->pMonsterInfo.uAIType == 1 )
14825 { 14882 {
14826 if ( v21->pMonsterInfo.uMovementType == 5 ) 14883 if ( pActor->pMonsterInfo.uMovementType == 5 )
14827 { 14884 {
14828 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); 14885 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir);
14829 } 14886 }
14830 else 14887 else
14831 { 14888 {
14832 Actor::Flee(actor_id, target_pid, 0, &pDir); 14889 Actor::AI_Flee(actor_id, target_pid, 0, &pDir);
14833 continue; 14890 continue;
14834 } 14891 }
14835 14892
14836 } 14893 }
14837 if ( !(v21->uAttributes & 0x020000) ) 14894 if ( !(pActor->uAttributes & 0x020000) )
14838 { 14895 {
14839 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3) 14896 if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3)
14840 { 14897 {
14841 if ( v21->pMonsterInfo.uAIType == 2 ) 14898 if ( pActor->pMonsterInfo.uAIType == 2 )
14842 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; 14899 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2;
14843 if ( v21->pMonsterInfo.uAIType == 3 ) 14900 if ( pActor->pMonsterInfo.uAIType == 3 )
14844 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; 14901 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1;
14845 v84 = v21->sCurrentHP; 14902 v84 = pActor->sCurrentHP;
14846 v42 = (double)(signed int)v84; 14903 v42 = (double)(signed int)v84;
14847 if ( v43 > v42 && (signed int)v36 < 10240 ) 14904 if ( v43 > v42 && (signed int)v36 < 10240 )
14848 { 14905 {
14849 Actor::Flee(actor_id, target_pid, 0, &pDir); 14906 Actor::AI_Flee(actor_id, target_pid, 0, &pDir);
14850 continue; 14907 continue;
14851 } 14908 }
14852 } 14909 }
14853 } 14910 }
14854 14911
14855 v81 = v36 - v21->uActorRadius; 14912 v81 = v36 - pActor->uActorRadius;
14856 if ( target_pid_type == OBJECT_Actor ) 14913 if ( target_pid_type == OBJECT_Actor )
14857 v81 -= pActors[PID_ID(target_pid)].uActorRadius; 14914 v81 -= pActors[PID_ID(target_pid)].uActorRadius;
14858 if ( v81 < 0 ) 14915 if ( v81 < 0 )
14859 v81 = 0; 14916 v81 = 0;
14860 rand(); 14917 rand();
14861 v21->uAttributes &= 0xFBFFFF; 14918 pActor->uAttributes &= 0xFBFFFF;
14862 if ( v81 < 5120 ) 14919 if ( v81 < 5120 )
14863 { 14920 {
14864 v45 = stru_50C198.special_ability_use_check(v21, actor_id); 14921 v45 = stru_50C198.special_ability_use_check(pActor, actor_id);
14865 if ( v45 == 0 ) 14922 if ( v45 == 0 )
14866 { 14923 {
14867 if ( v21->pMonsterInfo.uMissleAttack1Type ) 14924 if ( pActor->pMonsterInfo.uMissleAttack1Type )
14868 { 14925 {
14869 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) 14926 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 )
14870 { 14927 {
14871 Actor::MissileAttack1(actor_id, target_pid, &pDir); 14928 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir);
14872 } 14929 }
14873 else if ( v21->pMonsterInfo.uMovementType == 5 ) 14930 else if ( pActor->pMonsterInfo.uMovementType == 5 )
14874 { 14931 {
14875 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 14932 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14876 v64 = (signed __int64)v47; 14933 v64 = (signed __int64)v47;
14877 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 14934 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14878 } 14935 }
14879 else 14936 else
14880 { 14937 {
14881 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 14938 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14882 if ( v80 * 307.2 > (double)v81 ) 14939 if ( v80 * 307.2 > (double)v81 )
14883 { 14940 {
14884 v64 = (signed __int64)v47; 14941 v64 = (signed __int64)v47;
14885 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 14942 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14886 } 14943 }
14887 else 14944 else
14888 { 14945 {
14889 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); 14946 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
14890 } 14947 }
14891 } 14948 }
14892 } 14949 }
14893 else 14950 else
14894 { 14951 {
14895 if ( (double)v81 >= v80 * 307.2 ) 14952 if ( (double)v81 >= v80 * 307.2 )
14896 { 14953 {
14897 if ( v81 >= 1024 ) 14954 if ( v81 >= 1024 )
14898 { 14955 {
14899 if ( v21->pMonsterInfo.uMovementType == 5 ) 14956 if ( pActor->pMonsterInfo.uMovementType == 5 )
14900 { 14957 {
14901 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 14958 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14902 v64 = (signed __int64)v47; 14959 v64 = (signed __int64)v47;
14903 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 14960 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14904 } 14961 }
14905 else 14962 else
14906 { 14963 {
14907 //monsters 14964 //monsters
14908 Actor::Pursue3(actor_id, target_pid, 0, &pDir); 14965 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir);
14909 } 14966 }
14910 } 14967 }
14911 else if ( v21->pMonsterInfo.uMovementType == 5 ) 14968 else if ( pActor->pMonsterInfo.uMovementType == 5 )
14912 { 14969 {
14913 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 14970 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14914 v64 = (signed __int64)v47; 14971 v64 = (signed __int64)v47;
14915 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 14972 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14916 } 14973 }
14917 else 14974 else
14918 { 14975 {
14919 v70 = (signed __int64)v80 * 307.2; 14976 v70 = (signed __int64)v80 * 307.2;
14920 //monsters 14977 //monsters
14921 //guard after player runs away 14978 //guard after player runs away
14922 // follow player 14979 // follow player
14923 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); 14980 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
14924 } 14981 }
14925 } 14982 }
14926 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) 14983 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
14927 { 14984 {
14928 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 14985 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14929 v64 = (signed __int64)v47; 14986 v64 = (signed __int64)v47;
14930 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 14987 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14931 } 14988 }
14932 else 14989 else
14933 { 14990 {
14934 //monsters 14991 //monsters
14935 Actor::MeleeAttack(actor_id, target_pid, &pDir); 14992 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
14936 } 14993 }
14937 } 14994 }
14938 continue; 14995 continue;
14939 } 14996 }
14940 else if ( v45 == 2 || v45 == 3 ) 14997 else if ( v45 == 2 || v45 == 3 )
14941 { 14998 {
14942 if ( v45 == 2 ) 14999 if ( v45 == 2 )
14943 v46 = v21->pMonsterInfo.uSpell1ID; 15000 v46 = pActor->pMonsterInfo.uSpell1ID;
14944 else 15001 else
14945 v46 = v21->pMonsterInfo.uSpell2ID; 15002 v46 = pActor->pMonsterInfo.uSpell2ID;
14946 if ( v46 ) 15003 if ( v46 )
14947 { 15004 {
14948 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) 15005 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 )
14949 { 15006 {
14950 if ( v45 == 2 ) 15007 if ( v45 == 2 )
14951 Actor::SpellAttack1(actor_id, target_pid, &pDir); 15008 Actor::AI_SpellAttack1(actor_id, target_pid, &pDir);
14952 else 15009 else
14953 Actor::SpellAttack2(actor_id, target_pid, &pDir); 15010 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir);
14954 } 15011 }
14955 else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) 15012 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 )
14956 { 15013 {
14957 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15014 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14958 v64 = (signed __int64)v47; 15015 v64 = (signed __int64)v47;
14959 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15016 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14960 } 15017 }
14961 else 15018 else
14962 { 15019 {
14963 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15020 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14964 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); 15021 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
14965 } 15022 }
14966 } 15023 }
14967 else 15024 else
14968 { 15025 {
14969 if ( (double)v81 >= v80 * 307.2 ) 15026 if ( (double)v81 >= v80 * 307.2 )
14970 { 15027 {
14971 if ( v81 >= 1024 ) 15028 if ( v81 >= 1024 )
14972 { 15029 {
14973 if ( v21->pMonsterInfo.uMovementType == 5 ) 15030 if ( pActor->pMonsterInfo.uMovementType == 5 )
14974 { 15031 {
14975 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15032 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14976 v64 = (signed __int64)v47; 15033 v64 = (signed __int64)v47;
14977 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15034 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14978 } 15035 }
14979 else 15036 else
14980 { 15037 {
14981 Actor::Pursue3(actor_id, target_pid, 256, &pDir); 15038 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
14982 } 15039 }
14983 } 15040 }
14984 else if ( v21->pMonsterInfo.uMovementType == 5 ) 15041 else if ( pActor->pMonsterInfo.uMovementType == 5 )
14985 { 15042 {
14986 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15043 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14987 v64 = (signed __int64)v47; 15044 v64 = (signed __int64)v47;
14988 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15045 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
14989 } 15046 }
14990 else 15047 else
14991 { 15048 {
14992 v70 = (signed __int64)v80 * 307.2; 15049 v70 = (signed __int64)v80 * 307.2;
14993 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); 15050 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
14994 } 15051 }
14995 } 15052 }
14996 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) 15053 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
14997 { 15054 {
14998 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15055 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
14999 v64 = (signed __int64)v47; 15056 v64 = (signed __int64)v47;
15000 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15057 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
15001 } 15058 }
15002 else 15059 else
15003 { 15060 {
15004 Actor::MeleeAttack(actor_id, target_pid, &pDir); 15061 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
15005 } 15062 }
15006 } 15063 }
15007 continue; 15064 continue;
15008 } 15065 }
15009 } 15066 }
15010 } 15067 }
15011 15068
15012 if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) 15069 if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 )
15013 { 15070 {
15014 if ( !v21->pMonsterInfo.uMovementType ) 15071 if ( !pActor->pMonsterInfo.uMovementType )
15015 { 15072 {
15016 Actor::_4032B2(actor_id, 4, 1024, 0); 15073 Actor::AI_4032B2(actor_id, 4, 1024, 0);
15017 } 15074 }
15018 else if ( v21->pMonsterInfo.uMovementType == 1 ) 15075 else if ( pActor->pMonsterInfo.uMovementType == 1 )
15019 { 15076 {
15020 Actor::_4032B2(actor_id, 4, 2560, 0); 15077 Actor::AI_4032B2(actor_id, 4, 2560, 0);
15021 } 15078 }
15022 else if ( v21->pMonsterInfo.uMovementType == 2 ) 15079 else if ( pActor->pMonsterInfo.uMovementType == 2 )
15023 { 15080 {
15024 Actor::_4032B2(actor_id, 4, 5120, 0); 15081 Actor::AI_4032B2(actor_id, 4, 5120, 0);
15025 } 15082 }
15026 else if ( v21->pMonsterInfo.uMovementType == 4 ) 15083 else if ( pActor->pMonsterInfo.uMovementType == 4 )
15027 { 15084 {
15028 Actor::_4032B2(actor_id, 4, 10240, 0); 15085 Actor::AI_4032B2(actor_id, 4, 10240, 0);
15029 } 15086 }
15030 else if ( v21->pMonsterInfo.uMovementType == 5 ) 15087 else if ( pActor->pMonsterInfo.uMovementType == 5 )
15031 { 15088 {
15032 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); 15089 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
15033 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15090 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15034 memcpy(&v74, v57, sizeof(v74)); 15091 memcpy(&v74, v57, sizeof(v74));
15035 memcpy(&pDir, &v74, sizeof(pDir)); 15092 memcpy(&pDir, &v74, sizeof(pDir));
15036 v64 = (signed __int64)v58; 15093 v64 = (signed __int64)v58;
15037 Actor::AI_Stand(actor_id, 4, v64, &pDir); 15094 Actor::AI_Stand(actor_id, 4, v64, &pDir);
15038 } 15095 }
15039 } 15096 }
15040 else if ( !v21->pMonsterInfo.uMissleAttack2Type ) 15097 else if ( !pActor->pMonsterInfo.uMissleAttack2Type )
15041 { 15098 {
15042 if ( (double)v81 >= v80 * 307.2 ) 15099 if ( (double)v81 >= v80 * 307.2 )
15043 { 15100 {
15044 if ( v81 >= 1024 ) 15101 if ( v81 >= 1024 )
15045 { 15102 {
15046 if ( v21->pMonsterInfo.uMovementType == 5 ) 15103 if ( pActor->pMonsterInfo.uMovementType == 5 )
15047 { 15104 {
15048 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15105 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15049 v64 = (signed __int64)v47; 15106 v64 = (signed __int64)v47;
15050 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15107 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
15051 } 15108 }
15052 else 15109 else
15053 { 15110 {
15054 Actor::Pursue3(actor_id, target_pid, 256, &pDir); 15111 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
15055 } 15112 }
15056 } 15113 }
15057 else if ( v21->pMonsterInfo.uMovementType == 5 ) 15114 else if ( pActor->pMonsterInfo.uMovementType == 5 )
15058 { 15115 {
15059 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15116 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15060 v64 = (signed __int64)v47; 15117 v64 = (signed __int64)v47;
15061 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15118 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
15062 } 15119 }
15063 else 15120 else
15064 { 15121 {
15065 v70 = (signed __int64)v80 * 307.2; 15122 v70 = (signed __int64)v80 * 307.2;
15066 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); 15123 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70);
15067 } 15124 }
15068 } 15125 }
15069 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) 15126 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
15070 { 15127 {
15071 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15128 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15072 v64 = (signed __int64)v47; 15129 v64 = (signed __int64)v47;
15073 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15130 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
15074 } 15131 }
15075 else 15132 else
15076 { 15133 {
15077 Actor::MeleeAttack(actor_id, target_pid, &pDir); 15134 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir);
15078 } 15135 }
15079 } 15136 }
15080 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) 15137 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
15081 { 15138 {
15082 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15139 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15083 if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) 15140 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 )
15084 { 15141 {
15085 v64 = (signed __int64)v47; 15142 v64 = (signed __int64)v47;
15086 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); 15143 Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
15087 } 15144 }
15088 else 15145 else
15089 { 15146 {
15090 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); 15147 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
15091 } 15148 }
15092 } 15149 }
15093 else 15150 else
15094 { 15151 {
15095 Actor::MissileAttack2(actor_id, target_pid, &pDir); 15152 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir);
15096 } 15153 }
15097 } 15154 }
15098 } 15155 }
15099 } 15156 }
15100 15157
15101 //----- (0040261D) -------------------------------------------------------- 15158 //----- (0040261D) --------------------------------------------------------