comparison mm7_3.cpp @ 853:7ada14f991f5

Слияние
author Ritor1
date Sat, 30 Mar 2013 09:40:15 +0600
parents e3609dd06c15 39503542470c
children 06fc66ceecd6
comparison
equal deleted inserted replaced
852:e3609dd06c15 853:7ada14f991f5
860 860
861 //----- (004706C6) -------------------------------------------------------- 861 //----- (004706C6) --------------------------------------------------------
862 void __cdecl UpdateActors_ODM() 862 void __cdecl UpdateActors_ODM()
863 { 863 {
864 Actor *v0; // esi@2 864 Actor *v0; // esi@2
865 unsigned __int16 v1; // ax@2 865 AIState uAIState; // ax@2
866 unsigned int v2; // ecx@6 866 //unsigned int v2; // ecx@6
867 int v3; // ebx@6 867 int v3; // ebx@6
868 int v4; // eax@8 868 //int v4; // eax@8
869 int v5; // eax@10 869 int v5; // eax@10
870 int v6; // ecx@10 870 int v6; // ecx@10
871 signed int v7; // ebx@10 871 //signed int v7; // ebx@10
872 signed int v8; // ebx@17 872 signed int v8; // ebx@17
873 unsigned __int8 v9; // zf@17 873 //unsigned __int8 v9; // zf@17
874 unsigned __int8 v10; // sf@17 874 unsigned __int8 v10; // sf@17
875 unsigned __int16 v11; // ax@21 875 unsigned __int16 v11; // ax@21
876 int v12; // eax@29 876 int v12; // eax@29
877 unsigned __int64 v13; // qax@29 877 unsigned __int64 v13; // qax@29
878 int v14; // eax@30 878 int v14; // eax@30
879 unsigned __int64 v15; // qax@30 879 unsigned __int64 v15; // qax@30
880 int v16; // eax@33 880 int v16; // eax@33
881 int v17; // edi@34 881 //int v17; // edi@34
882 int v18; // edx@42 882 int v18; // edx@42
883 int v19; // ecx@42 883 int v19; // ecx@42
884 __int16 v20; // ax@42 884 __int16 v20; // ax@42
885 int v21; // ebx@42 885 int v21; // ebx@42
886 int v22; // edi@42 886 int v22; // edi@42
893 signed int v29; // ebx@57 893 signed int v29; // ebx@57
894 signed int v30; // eax@57 894 signed int v30; // eax@57
895 int v31; // edi@57 895 int v31; // edi@57
896 signed int i; // ebx@57 896 signed int i; // ebx@57
897 unsigned int v33; // ecx@58 897 unsigned int v33; // ecx@58
898 int v34; // ebx@64 898 //int v34; // ebx@64
899 int v35; // edi@64 899 int v35; // edi@64
900 int v36; // eax@64 900 int v36; // eax@64
901 unsigned __int16 v37; // cx@66 901 unsigned __int16 v37; // cx@66
902 signed int v38; // edx@71 902 signed int v38; // edx@71
903 signed int v39; // edi@71 903 signed int v39; // edi@71
913 int v49; // edi@85 913 int v49; // edi@85
914 int v50; // eax@85 914 int v50; // eax@85
915 unsigned __int64 v51; // qax@85 915 unsigned __int64 v51; // qax@85
916 unsigned __int8 v52; // zf@87 916 unsigned __int8 v52; // zf@87
917 unsigned __int8 v53; // sf@87 917 unsigned __int8 v53; // sf@87
918 unsigned __int8 v54; // of@104 918 // unsigned __int8 v54; // of@104
919 int v55; // eax@107 919 int v55; // eax@107
920 unsigned int v56; // edi@107 920 unsigned int v56; // edi@107
921 int v57; // ST10_4@107 921 int v57; // ST10_4@107
922 unsigned int v58; // edi@107 922 unsigned int v58; // edi@107
923 unsigned int v59; // ebx@107 923 unsigned int v59; // ebx@107
927 int v63; // [sp+18h] [bp-38h]@64 927 int v63; // [sp+18h] [bp-38h]@64
928 int v64; // [sp+1Ch] [bp-34h]@64 928 int v64; // [sp+1Ch] [bp-34h]@64
929 int v65; // [sp+20h] [bp-30h]@2 929 int v65; // [sp+20h] [bp-30h]@2
930 int v66; // [sp+24h] [bp-2Ch]@2 930 int v66; // [sp+24h] [bp-2Ch]@2
931 bool v67; // [sp+28h] [bp-28h]@10 931 bool v67; // [sp+28h] [bp-28h]@10
932 unsigned int v68; // [sp+2Ch] [bp-24h]@10 932 //unsigned int v68; // [sp+2Ch] [bp-24h]@10
933 unsigned int v69; // [sp+30h] [bp-20h]@6 933 unsigned int v69; // [sp+30h] [bp-20h]@6
934 unsigned int v70; // [sp+34h] [bp-1Ch]@10 934 unsigned int v70; // [sp+34h] [bp-1Ch]@10
935 int v71; // [sp+38h] [bp-18h]@62 935 int v71; // [sp+38h] [bp-18h]@62
936 int v72; // [sp+3Ch] [bp-14h]@10 936 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10
937 int v72b;
937 int v73; // [sp+40h] [bp-10h]@17 938 int v73; // [sp+40h] [bp-10h]@17
938 int v74; // [sp+44h] [bp-Ch]@8 939 int uIsFlying; // [sp+44h] [bp-Ch]@8
939 unsigned int v75; // [sp+48h] [bp-8h]@1 940 unsigned int v75; // [sp+48h] [bp-8h]@1
940 int v76; // [sp+4Ch] [bp-4h]@10 941 int uIsOnWater; // [sp+4Ch] [bp-4h]@10
941 942
942 v75 = 0; 943 for(v75=0;(signed int)v75 < (signed int)uNumActors;++v75)
943 if ( (signed int)uNumActors <= 0 )
944 return;
945 do
946 { 944 {
947 v0 = &pActors[v75]; 945 v0 = &pActors[v75];
948 v66 = v0->vPosition.x; 946 v66 = v0->vPosition.x;
949 v65 = v0->vPosition.y; 947 v65 = v0->vPosition.y;
950 v1 = v0->uAIState; 948 uAIState = v0->uAIState;
951 if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed ) 949 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed )
952 goto LABEL_121; 950 {
953 v2 = v0->pMonsterInfo.uID; 951 continue;
952 }
954 v3 = 0; 953 v3 = 0;
955 v69 = 0; 954 v69 = 0;
956 if ( MonsterStats::BelongsToSupertype(v2, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) 955 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
957 v3 = 1; 956 v3 = 1;
958 v4 = v0->pMonsterInfo.uFlying;
959 v0->uSectorID = 0; 957 v0->uSectorID = 0;
960 v74 = v4; 958 uIsFlying = v0->pMonsterInfo.uFlying;
961 if ( !v0->CanAct() ) 959 if ( !v0->CanAct() )
962 v74 = 0; 960 uIsFlying = 0;
963 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); 961 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y);
964 v5 = ODM_GetFloorLevel( 962 v5 = ODM_GetFloorLevel(
965 v0->vPosition.x, 963 v0->vPosition.x,
966 v0->vPosition.y, 964 v0->vPosition.y,
967 v0->vPosition.z, 965 v0->vPosition.z,
968 v0->uActorHeight, 966 v0->uActorHeight,
969 &v76, 967 &uIsOnWater,
970 (int *)&v69, 968 (int *)&v69,
971 v3); 969 v3);
972 v6 = v0->vPosition.z; 970 v6 = v0->vPosition.z;
973 v7 = v5; 971 uIsAboveFloor = 0;
974 v68 = v5;
975 v72 = 0;
976 v67 = v69 == 0; 972 v67 = v69 == 0;
977 if ( v6 > v5 + 1 ) 973 if ( v6 > v5 + 1 )
978 v72 = 1; 974 uIsAboveFloor = 1;
979 if ( v0->uAIState == 5 && v76 && !v72 ) 975 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor )
980 { 976 {
981 v0->uAIState = Removed; 977 v0->uAIState = Removed;
982 goto LABEL_121; 978 continue;
983 } 979 }
984 if ( v0->uCurrentActionAnimation == ANIM_Walking ) 980 if ( v0->uCurrentActionAnimation == ANIM_Walking )
985 { 981 {
986 v8 = v0->uMovementSpeed; 982 v8 = v0->uMovementSpeed;
987 v9 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0;
988 v10 = SHIDWORD(v0->pActorBuffs[7].uExpireTime) < 0;
989 v73 = v0->uMovementSpeed; 983 v73 = v0->uMovementSpeed;
990 if ( !v10 && (!(v10 | v9) || LODWORD(v0->pActorBuffs[7].uExpireTime) > 0) ) 984 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 )
991 { 985 {
992 v8 = (signed __int64)((double)v73 * 0.5); 986 v8 = (signed __int64)((double)v73 * 0.5);
993 v73 = (signed __int64)((double)v73 * 0.5); 987 v73 = (signed __int64)((double)v73 * 0.5);
994 } 988 }
995 v11 = v0->uAIState; 989 if ( uAIState == Fleeing || uAIState == Pursuing )
996 if ( v11 == 7 || v11 == 6 )
997 { 990 {
998 v8 *= 2; 991 v8 *= 2;
999 v73 = v8; 992 v73 = v8;
1000 } 993 }
1001 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 ) 994 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 )
1002 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); 995 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6);
1003 if ( v8 > 1000 ) 996 if ( v8 > 1000 )
1004 v8 = 1000; 997 v8 = 1000;
1005 v12 = stru_5C6E00->Cos(v0->uYawAngle); 998 v12 = stru_5C6E00->Cos(v0->uYawAngle);
1006 v69 = v12;
1007 v13 = v12 * (signed __int64)v8; 999 v13 = v12 * (signed __int64)v8;
1008 v73 = v13 >> 16; 1000 v73 = v13 >> 16;
1009 v0->vVelocity.x = WORD1(v13); 1001 v0->vVelocity.x = WORD1(v13);
1010 v69 = stru_5C6E00->Sin(v0->uYawAngle); 1002 v69 = stru_5C6E00->Sin(v0->uYawAngle);
1011 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; 1003 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16;
1012 v9 = v74 == 0;
1013 v0->vVelocity.y = v69 * v8 >> 16; 1004 v0->vVelocity.y = v69 * v8 >> 16;
1014 if ( !v9 ) 1005 if ( uIsFlying )
1015 { 1006 {
1016 v14 = stru_5C6E00->Sin(v0->uPitchAngle); 1007 v14 = stru_5C6E00->Sin(v0->uPitchAngle);
1017 v69 = v14; 1008 v69 = v14;
1018 v15 = v14 * (signed __int64)v8; 1009 v15 = v14 * (signed __int64)v8;
1019 v73 = v15 >> 16; 1010 v73 = v15 >> 16;
1020 v0->vVelocity.z = WORD1(v15); 1011 v0->vVelocity.z = WORD1(v15);
1021 } 1012 }
1022 v7 = v68; 1013 //v7 = v68;
1023 } 1014 }
1024 else 1015 else
1025 { 1016 {
1026 v73 = v0->vVelocity.x; 1017 v73 = v0->vVelocity.x;
1027 v69 = 55000; 1018 v69 = 55000;
1028 v73 = (unsigned __int64)(55000i64 * v73) >> 16; 1019 v73 = (unsigned __int64)(55000i64 * v73) >> 16;
1029 v0->vVelocity.x = v73; 1020 v0->vVelocity.x = v73;
1030 v73 = v0->vVelocity.y; 1021 v73 = v0->vVelocity.y;
1031 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16; 1022 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16;
1032 v9 = v74 == 0;
1033 v0->vVelocity.y = v73; 1023 v0->vVelocity.y = v73;
1034 if ( !v9 ) 1024 if ( uIsFlying )
1035 { 1025 {
1036 v69 = 55000; 1026 v69 = 55000;
1037 v73 = v0->vVelocity.z; 1027 v73 = v0->vVelocity.z;
1038 v73 = (unsigned __int64)(55000i64 * v73) >> 16; 1028 v73 = (unsigned __int64)(55000i64 * v73) >> 16;
1039 v0->vVelocity.z = v73; 1029 v0->vVelocity.z = v73;
1040 } 1030 }
1041 } 1031 }
1042 if ( v0->vPosition.z < v7 ) 1032 if ( v0->vPosition.z < v5 )
1043 { 1033 {
1044 v16 = v74; 1034 v16 = uIsFlying;
1045 v0->vPosition.z = v7; 1035 v0->vPosition.z = v5;
1046 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; 1036 v0->vVelocity.z = v16 != 0 ? 0x14 : 0;
1047 } 1037 }
1048 v17 = 0; 1038 //v17 = 0;
1049 if ( !v72 || v74 ) 1039 if ( !uIsAboveFloor || uIsFlying )
1050 { 1040 {
1051 if ( v70 && !v72 && v67 ) 1041 if ( v70 && !uIsAboveFloor && v67 )
1052 { 1042 {
1053 v18 = v0->vPosition.y; 1043 v18 = v0->vPosition.y;
1054 v19 = v0->vPosition.x; 1044 v19 = v0->vPosition.x;
1055 v0->vPosition.z = v7; 1045 v0->vPosition.z = v5;
1056 ODM_GetTerrainNormalAt(v19, v18, &v62); 1046 ODM_GetTerrainNormalAt(v19, v18, &v62);
1057 v20 = GetGravityStrength(); 1047 v20 = GetGravityStrength();
1058 v21 = v62.y; 1048 v21 = v62.y;
1059 v22 = v62.z; 1049 v22 = v62.z;
1060 v23 = v62.y * v0->vVelocity.y; 1050 v23 = v62.y * v0->vVelocity.y;
1061 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; 1051 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
1062 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16; 1052 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16;
1063 v72 = v21; 1053 v72b = v21;
1064 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16; 1054 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16;
1065 v72 = (unsigned __int64)(v73 * (signed __int64)v72) >> 16; 1055 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16;
1066 v24 = v72; 1056 v24 = v72b;
1067 v72 = v22; 1057 v72b = v22;
1068 v0->vVelocity.y += v24; 1058 v0->vVelocity.y += v24;
1069 v72 = (unsigned __int64)(v73 * (signed __int64)v72) >> 16; 1059 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16;
1070 v0->vVelocity.z += v72; 1060 v0->vVelocity.z += v72b;
1071 v17 = 0; 1061 //v17 = 0;
1072 } 1062 }
1073 } 1063 }
1074 else 1064 else
1075 { 1065 {
1076 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); 1066 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
1077 } 1067 }
1078 if ( pParty->armageddon_timer != v17 && v0->CanAct() ) 1068 if ( pParty->armageddon_timer != 0 && v0->CanAct() )
1079 { 1069 {
1080 v0->vVelocity.x += rand() % 100 - 50; 1070 v0->vVelocity.x += rand() % 100 - 50;
1081 v0->vVelocity.y += rand() % 100 - 50; 1071 v0->vVelocity.y += rand() % 100 - 50;
1082 v0->vVelocity.z += rand() % 100 - 20; 1072 v0->vVelocity.z += rand() % 100 - 20;
1083 v25 = rand(); 1073 v25 = rand();
1084 v0->uAIState = Stunned; 1074 v0->uAIState = Stunned;
1085 v0->uYawAngle += v25 % 32 - 16; 1075 v0->uYawAngle += v25 % 32 - 16;
1086 v0->UpdateAnimation(); 1076 v0->UpdateAnimation();
1087 } 1077 }
1088 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == v17 ) 1078 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == 0 )
1089 { 1079 {
1090 v0->vVelocity.y = v17; 1080 v0->vVelocity.y = 0;
1091 v0->vVelocity.x = v17; 1081 v0->vVelocity.x = 0;
1092 } 1082 }
1093 v9 = v0->pMonsterInfo.uFlying == 0;
1094 stru_721530.field_0 = 1; 1083 stru_721530.field_0 = 1;
1095 if ( v9 ) 1084 if ( !uIsFlying )
1096 v26 = 40; 1085 v26 = 40;
1097 else 1086 else
1098 v26 = v0->uActorRadius; 1087 v26 = v0->uActorRadius;
1099 v27 = v0->uActorHeight; 1088 v27 = v0->uActorHeight;
1100 stru_721530.field_84 = -1; 1089 stru_721530.field_84 = -1;
1101 stru_721530.field_8 = v26; 1090 stru_721530.field_8 = v26;
1102 stru_721530.prolly_normal_d = v26; 1091 stru_721530.prolly_normal_d = v26;
1103 stru_721530.field_C = v27; 1092 stru_721530.field_C = v27;
1104 stru_721530.field_70 = v17; 1093 stru_721530.field_70 = 0;
1105 v69 = v17; 1094 v69 = 0;
1106 while ( 1 ) 1095 while ( 1 )
1107 { 1096 {
1108 stru_721530.field_34.x = v0->vPosition.x; 1097 stru_721530.field_34.x = v0->vPosition.x;
1109 stru_721530.normal.x = stru_721530.field_34.x; 1098 stru_721530.normal.x = stru_721530.field_34.x;
1110 stru_721530.field_34.y = v0->vPosition.y; 1099 stru_721530.field_34.y = v0->vPosition.y;
1134 ++i; 1123 ++i;
1135 } 1124 }
1136 v71 = i > 1; 1125 v71 = i > 1;
1137 if ( stru_721530.field_7C < stru_721530.field_6C ) 1126 if ( stru_721530.field_7C < stru_721530.field_6C )
1138 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 1127 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
1139 v34 = 0; 1128 //v34 = 0;
1140 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; 1129 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
1141 v36 = ODM_GetFloorLevel( 1130 v36 = ODM_GetFloorLevel(
1142 stru_721530.normal2.x, 1131 stru_721530.normal2.x,
1143 stru_721530.normal2.y, 1132 stru_721530.normal2.y,
1144 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, 1133 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
1145 v0->uActorHeight, 1134 v0->uActorHeight,
1146 (int *)&v63, 1135 (int *)&v63,
1147 &v64, 1136 &v64,
1148 0); 1137 0);
1149 if ( v76 ) 1138 if ( uIsOnWater )
1150 { 1139 {
1151 if ( v35 < v36 + 60 ) 1140 if ( v35 < v36 + 60 )
1152 { 1141 {
1153 v37 = v0->uAIState; 1142 v37 = v0->uAIState;
1154 if ( v37 == 5 || v37 == 4 || v37 == 11 || v37 == 19 ) 1143 if ( v37 == 5 || v37 == 4 || v37 == 11 || v37 == 19 )
1155 { 1144 {
1156 if ( v64 ) 1145 if ( v64 )
1157 v61 = v36 + 30; 1146 v61 = v36 + 30;
1158 else 1147 else
1159 v61 = v68 + 60; 1148 v61 = v5 + 60;
1160 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); 1149 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61);
1161 v0->uAIState = Removed; 1150 v0->uAIState = Removed;
1162 return; 1151 return;
1163 } 1152 }
1164 } 1153 }
1168 v0->vPosition.x = LOWORD(stru_721530.normal2.x); 1157 v0->vPosition.x = LOWORD(stru_721530.normal2.x);
1169 v0->vPosition.y = LOWORD(stru_721530.normal2.y); 1158 v0->vPosition.y = LOWORD(stru_721530.normal2.y);
1170 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; 1159 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
1171 break; 1160 break;
1172 } 1161 }
1173 v72 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 1162 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
1174 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16; 1163 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16;
1175 v72 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 1164 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
1176 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16; 1165 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16;
1177 v72 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 1166 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
1178 v38 = stru_721530.uFaceID; 1167 v38 = stru_721530.uFaceID;
1179 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; 1168 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16;
1180 stru_721530.field_70 += stru_721530.field_7C; 1169 stru_721530.field_70 += stru_721530.field_7C;
1181 v39 = v38 >> 3; 1170 v39 = v38 >> 3;
1182 switch ( v38 & 7 ) 1171 switch ( PID_TYPE(v38) )
1183 { 1172 {
1184 case 3: 1173 case OBJECT_Actor:
1185 if ( pParty->bTurnBasedModeOn != 1 ) 1174 if ( pTurnEngine->field_4 != 2 && pTurnEngine->field_4 != 3 || pParty->bTurnBasedModeOn != 1 )
1186 goto LABEL_97;
1187 if ( pTurnEngine->field_4 != 2 && pTurnEngine->field_4 != 3 )
1188 { 1175 {
1189 v34 = 0; 1176 //if(pParty->bTurnBasedModeOn == 1)
1190 LABEL_97: 1177 //v34 = 0;
1191 if ( v0->pMonsterInfo.uHostilityType ) 1178 if ( v0->pMonsterInfo.uHostilityType )
1192 { 1179 {
1193 if ( v71 == v34 ) 1180 if ( v71 == 0 )
1194 goto LABEL_99; 1181 {
1195 LABEL_101: 1182 Actor::_402968(v75, v38, 0, (AIDirection *)0);
1196 Actor::AI_StandOrBored(v75, 4, v34, (AIDirection *)v34); 1183 }
1197 break; 1184 else
1185 {
1186 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
1187 }
1198 } 1188 }
1199 if ( v71 != v34 ) 1189 else if ( v71 != 0 )
1200 goto LABEL_101; 1190 {
1201 if ( pActors[v39].pMonsterInfo.uHostilityType ) 1191 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
1192 }
1193 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
1202 { 1194 {
1203 LABEL_99: 1195 Actor::_402968(v75, v38, 0, (AIDirection *)0);
1204 Actor::_402968(v75, v38, v34, (AIDirection *)v34);
1205 break;
1206 } 1196 }
1207 LABEL_103: 1197 else
1208 Actor::FaceObject(v75, v38, v34, (AIDirection *)v34); 1198 {
1209 break; 1199 Actor::FaceObject(v75, v38, 0, (AIDirection *)0);
1200 }
1210 } 1201 }
1211 break; 1202 break;
1212 case 4: 1203 case OBJECT_Player:
1213 if ( !v0->GetActorsRelation(0) ) 1204 if ( !v0->GetActorsRelation(0) )
1214 { 1205 {
1215 v38 = stru_721530.uFaceID; 1206 v38 = stru_721530.uFaceID;
1216 goto LABEL_103; 1207 Actor::FaceObject(v75, v38, 0, (AIDirection *)0);
1208 break;
1217 } 1209 }
1218 v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; 1210 v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0;
1219 v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; 1211 v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0;
1220 v0->vVelocity.y = 0; 1212 v0->vVelocity.y = 0;
1221 v0->vVelocity.x = 0; 1213 v0->vVelocity.x = 0;
1222 if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) 1214 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) )
1215 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime < 0)
1223 pParty->pPartyBuffs[11].Reset(); 1216 pParty->pPartyBuffs[11].Reset();
1224 viewparams->bRedrawGameUI = 1; 1217 viewparams->bRedrawGameUI = 1;
1225 break; 1218 break;
1226 case 5: 1219 case OBJECT_Decoration:
1227 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); 1220 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
1228 v48 = stru_5C6E00->Atan2( 1221 v48 = stru_5C6E00->Atan2(
1229 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, 1222 v0->vPosition.x - pLevelDecorations[v39].vPosition.x,
1230 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); 1223 v0->vPosition.y - pLevelDecorations[v39].vPosition.y);
1231 v71 = stru_5C6E00->Cos(v48); 1224 v71 = stru_5C6E00->Cos(v48);
1236 v71 = v50; 1229 v71 = v50;
1237 v51 = v50 * (signed __int64)v47; 1230 v51 = v50 * (signed __int64)v47;
1238 v70 = v51 >> 16; 1231 v70 = v51 >> 16;
1239 v0->vVelocity.y = WORD1(v51); 1232 v0->vVelocity.y = WORD1(v51);
1240 break; 1233 break;
1241 case 6: 1234 case OBJECT_BModel:
1242 v40 = &pOutdoor->pBModels[v38 >> 9]; 1235 v40 = &pOutdoor->pBModels[v38 >> 9];
1243 v41 = &v40->pFaces[v39 & 0x3F]; 1236 v41 = &v40->pFaces[v39 & 0x3F];
1244 if ( !(BYTE3(v41->uAttributes) & 0x20) ) 1237 if ( !(BYTE3(v41->uAttributes) & 0x20) )
1245 { 1238 {
1246 v42 = v41->uPolygonType; 1239 v42 = v41->uPolygonType;
1256 v0->vVelocity.x = 0; 1249 v0->vVelocity.x = 0;
1257 } 1250 }
1258 } 1251 }
1259 else 1252 else
1260 { 1253 {
1261 v72 = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z 1254 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z
1262 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; 1255 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16;
1263 if ( stru_721530.field_64 >> 3 > v72 ) 1256 if ( stru_721530.field_64 >> 3 > v72b )
1264 v72 = stru_721530.field_64 >> 3; 1257 v72b = stru_721530.field_64 >> 3;
1265 v73 = v41->pFacePlane.vNormal.x; 1258 v73 = v41->pFacePlane.vNormal.x;
1266 v73 = (unsigned __int64)(v72 * (signed __int64)v73) >> 16; 1259 v73 = (unsigned __int64)(v72b * (signed __int64)v73) >> 16;
1267 v71 = v41->pFacePlane.vNormal.y; 1260 v71 = v41->pFacePlane.vNormal.y;
1268 v71 = (unsigned __int64)(v72 * (signed __int64)v71) >> 16; 1261 v71 = (unsigned __int64)(v72b * (signed __int64)v71) >> 16;
1269 v70 = v41->pFacePlane.vNormal.z; 1262 v70 = v41->pFacePlane.vNormal.z;
1270 v70 = (unsigned __int64)(v72 * (signed __int64)(signed int)v70) >> 16; 1263 v70 = (unsigned __int64)(v72b * (signed __int64)(signed int)v70) >> 16;
1271 v0->vVelocity.x += v73; 1264 v0->vVelocity.x += v73;
1272 v0->vVelocity.y += v71; 1265 v0->vVelocity.y += v71;
1273 v0->vVelocity.z += v70; 1266 v0->vVelocity.z += v70;
1274 if ( v42 != 4 ) 1267 if ( v42 != 4 )
1275 { 1268 {
1300 v71 = 58500; 1293 v71 = 58500;
1301 v0->vVelocity.y = v70; 1294 v0->vVelocity.y = v70;
1302 v70 = v0->vVelocity.z; 1295 v70 = v0->vVelocity.z;
1303 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; 1296 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16;
1304 ++v69; 1297 ++v69;
1305 v54 = v69 < 100; 1298 //v54 = v69 < 100;
1306 v10 = (v69 - 100) < 0; 1299 //v10 = (v69 - 100) < 0;
1307 v0->vVelocity.z = v70; 1300 v0->vVelocity.z = v70;
1308 if ( !(v10 ^ v54) ) 1301 if ( v69 >= 100 )
1309 break; 1302 break;
1310 v26 = stru_721530.prolly_normal_d; 1303 v26 = stru_721530.prolly_normal_d;
1311 } 1304 }
1312 v69 = WorldPosToGridCellX(v66); 1305 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1;
1313 v55 = WorldPosToGridCellZ(v65); 1306 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1;
1314 v56 = v55 - 1; 1307 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x)
1315 v57 = v0->vPosition.x; 1308 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y)
1316 v71 = v55 - 1; 1309 && v58
1317 v68 = WorldPosToGridCellX(v57); 1310 || v67 != 0 )
1318 v70 = WorldPosToGridCellZ(v0->vPosition.y) - 1;
1319 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v69, v56) >> 1) & 1;
1320 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v68, v70) >> 1) & 1;
1321 v60 = 0;
1322 if ( v69 == v68 && v71 == v70 && v58 )
1323 v60 = 1;
1324 if ( !v67 )
1325 v60 = 1;
1326 if ( !v60 )
1327 { 1311 {
1328 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) 1312 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
1329 { 1313 {
1330 v58 = v58 == 0; 1314 v58 = v58 == 0;
1331 v59 = v59 == 0; 1315 v59 = v59 == 0;
1332 } 1316 }
1333 if ( !v74 && v58 && !v59 ) 1317 if ( !uIsFlying && v58 && !v59 )
1334 { 1318 {
1335 v0->vPosition.x = v66; 1319 v0->vPosition.x = v66;
1336 v0->vPosition.y = v65; 1320 v0->vPosition.y = v65;
1337 if ( v0->CanAct() ) 1321 if ( v0->CanAct() )
1338 { 1322 {
1341 v0->uCurrentActionLength = 128; 1325 v0->uCurrentActionLength = 128;
1342 v0->uAIState = Fleeing; 1326 v0->uAIState = Fleeing;
1343 } 1327 }
1344 } 1328 }
1345 } 1329 }
1346 LABEL_121: 1330 }
1347 ++v75;
1348 }
1349 while ( (signed int)v75 < (signed int)uNumActors );
1350 } 1331 }
1351 1332
1352 //----- (0047253E) -------------------------------------------------------- 1333 //----- (0047253E) --------------------------------------------------------
1353 void UpdateObjects() 1334 void UpdateObjects()
1354 { 1335 {
15110 //int *v20; // esi@80 15091 //int *v20; // esi@80
15111 Actor *v21; // ebx@80 15092 Actor *v21; // ebx@80
15112 unsigned __int16 v22; // ax@86 15093 unsigned __int16 v22; // ax@86
15113 //signed int v23; // eax@94 15094 //signed int v23; // eax@94
15114 //unsigned int v24; // eax@102 15095 //unsigned int v24; // eax@102
15115 signed int v25; // edi@102 15096 //signed int v25; // edi@102
15116 SpellBuff *v26; // esi@102 15097 //SpellBuff *v26; // esi@102
15117 unsigned int v27; // ecx@123 15098 unsigned int v27; // ecx@123
15118 unsigned int v28; // eax@123 15099 unsigned int v28; // eax@123
15119 unsigned int v29; // eax@127 15100 //unsigned int v29; // eax@127
15120 AIDirection *v30; // eax@129 15101 AIDirection *v30; // eax@129
15121 unsigned __int16 v31; // ax@132 15102 unsigned __int16 v31; // ax@132
15122 unsigned int v32; // esi@142 15103 //unsigned int v32; // esi@142
15123 int v33; // eax@144 15104 int v33; // eax@144
15124 int v34; // eax@147 15105 int v34; // eax@147
15125 char v35; // al@150 15106 char v35; // al@150
15126 unsigned int v36; // edi@152 15107 unsigned int v36; // edi@152
15127 signed int v37; // eax@154 15108 signed int v37; // eax@154
15128 unsigned __int8 v38; // sf@158 15109 unsigned __int8 v38; // sf@158
15129 unsigned __int8 v39; // of@158 15110 unsigned __int8 v39; // of@158
15130 signed int v40; // edx@166 15111 //signed int v40; // edx@166
15131 unsigned int v41; // ecx@166 15112 //unsigned int v41; // ecx@166
15132 double v42; // st7@176 15113 double v42; // st7@176
15133 double v43; // st6@176 15114 double v43; // st6@176
15134 bool v44; // eax@189 15115 //bool v44; // eax@189
15135 bool v45; // eax@192 15116 bool v45; // eax@192
15136 unsigned __int8 v46; // cl@197 15117 unsigned __int8 v46; // cl@197
15137 double v47; // st7@206 15118 double v47; // st7@206
15138 double v48; // st7@207 15119 double v48; // st7@207
15139 char v49; // zf@208 15120 //char v49; // zf@208
15140 char v50; // zf@214 15121 //char v50; // zf@214
15141 signed int v51; // edx@219 15122 //signed int v51; // edx@219
15142 unsigned int v52; // ecx@219 15123 //unsigned int v52; // ecx@219
15143 __int16 v53; // fps@224 15124 __int16 v53; // fps@224
15144 unsigned __int8 v54; // c0@224 15125 unsigned __int8 v54; // c0@224
15145 unsigned __int8 v55; // c3@224 15126 unsigned __int8 v55; // c3@224
15146 double v56; // st7@226 15127 double v56; // st7@226
15147 AIDirection *v57; // eax@246 15128 AIDirection *v57; // eax@246
15148 double v58; // st7@246 15129 double v58; // st7@246
15149 signed int v59; // [sp-18h] [bp-C8h]@213 15130 //signed int v59; // [sp-18h] [bp-C8h]@213
15150 int v60; // [sp-14h] [bp-C4h]@144 15131 //int v60; // [sp-14h] [bp-C4h]@144
15151 int v61; // [sp-14h] [bp-C4h]@168 15132 //int v61; // [sp-14h] [bp-C4h]@168
15152 AIDirection *v62; // [sp-14h] [bp-C4h]@213 15133 //AIDirection *v62; // [sp-14h] [bp-C4h]@213
15153 signed int v63; // [sp-14h] [bp-C4h]@216 15134 //signed int v63; // [sp-14h] [bp-C4h]@216
15154 unsigned int v64; // [sp-14h] [bp-C4h]@219 15135 unsigned int v64; // [sp-14h] [bp-C4h]@219
15155 unsigned int v65; // [sp-10h] [bp-C0h]@144 15136 unsigned int v65; // [sp-10h] [bp-C0h]@144
15156 char v66; // [sp-10h] [bp-C0h]@147 15137 char v66; // [sp-10h] [bp-C0h]@147
15157 AIDirection *v67; // [sp-10h] [bp-C0h]@167 15138 //AIDirection *v67; // [sp-10h] [bp-C0h]@167
15158 int v68; // [sp-10h] [bp-C0h]@168 15139 //int v68; // [sp-10h] [bp-C0h]@168
15159 AIDirection *v69; // [sp-10h] [bp-C0h]@206 15140 //AIDirection *v69; // [sp-10h] [bp-C0h]@206
15160 int v70; // [sp-10h] [bp-C0h]@213 15141 int v70; // [sp-10h] [bp-C0h]@213
15161 AIDirection *v71; // [sp-10h] [bp-C0h]@216 15142 //AIDirection *v71; // [sp-10h] [bp-C0h]@216
15162 AIDirection v72; // [sp+0h] [bp-B0h]@246 15143 AIDirection v72; // [sp+0h] [bp-B0h]@246
15163 AIDirection a3; // [sp+1Ch] [bp-94h]@129 15144 AIDirection a3; // [sp+1Ch] [bp-94h]@129
15164 AIDirection v74; // [sp+38h] [bp-78h]@246 15145 AIDirection v74; // [sp+38h] [bp-78h]@246
15165 AIDirection v75; // [sp+54h] [bp-5Ch]@129 15146 AIDirection v75; // [sp+54h] [bp-5Ch]@129
15166 int v76; // [sp+70h] [bp-40h]@83 15147 int actor_pid_type; // [sp+70h] [bp-40h]@83
15167 signed int a1; // [sp+74h] [bp-3Ch]@129 15148 signed int a1; // [sp+74h] [bp-3Ch]@129
15168 int v78; // [sp+78h] [bp-38h]@79 15149 int v78; // [sp+78h] [bp-38h]@79
15169 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 15150 AIDirection pDir; // [sp+7Ch] [bp-34h]@129
15170 float v80; // [sp+98h] [bp-18h]@33 15151 float v80; // [sp+98h] [bp-18h]@33
15171 int v81; // [sp+9Ch] [bp-14h]@100 15152 int v81; // [sp+9Ch] [bp-14h]@100
15172 int v82; // [sp+A0h] [bp-10h]@45 15153 //int v82; // [sp+A0h] [bp-10h]@45
15173 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 15154 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32
15174 unsigned int v84; // [sp+A8h] [bp-8h]@11 15155 unsigned int v84; // [sp+A8h] [bp-8h]@11
15175 signed int a2; // [sp+ACh] [bp-4h]@83 15156 signed int actor_pid; // [sp+ACh] [bp-4h]@83
15157 AIState uAIState;
15176 15158
15177 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 15159 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
15178 MakeActorAIList_ODM(); 15160 MakeActorAIList_ODM();
15179 else 15161 else
15180 MakeActorAIList_BLV(); 15162 MakeActorAIList_BLV();
15181 15163
15182 //v0 = 0; 15164 //v0 = 0;
15183 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) 15165 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 )
15184 { 15166 {
15185 if ( pParty->armageddon_timer > 417 ) 15167 if ( pParty->armageddon_timer > 417 )
15192 v1 = rand(); 15174 v1 = rand();
15193 v2 = 128; 15175 v2 = 128;
15194 v3 = pParty->sRotationX + v1 % 16 - 8; 15176 v3 = pParty->sRotationX + v1 % 16 - 8;
15195 pParty->sRotationX = v3; 15177 pParty->sRotationX = v3;
15196 if ( v3 > 128 || (v2 = -128, v3 < -128) ) 15178 if ( v3 > 128 || (v2 = -128, v3 < -128) )
15197 pParty->sRotationX = v2; 15179 pParty->sRotationX = v2;
15198 pParty->uFlags |= 2u; 15180 pParty->uFlags |= 2u;
15199 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; 15181 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed;
15200 v4 = pParty->field_16140 + 50; 15182 v4 = pParty->field_16140 + 50;
15201 if ( pParty->armageddon_timer <= 0 ) 15183 if ( pParty->armageddon_timer <= 0 )
15202 { 15184 {
15220 } 15202 }
15221 else 15203 else
15222 { 15204 {
15223 Actor::Die(v84); 15205 Actor::Die(v84);
15224 if ( v5->pMonsterInfo.uExp ) 15206 if ( v5->pMonsterInfo.uExp )
15225 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); 15207 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp);
15226 } 15208 }
15227 } 15209 }
15228 } 15210 }
15229 ++v84; 15211 ++v84;
15230 ++v5; 15212 ++v5;
15234 v8 = &pPlayers[1]; 15216 v8 = &pPlayers[1];
15235 do 15217 do
15236 { 15218 {
15237 pPlayer = *v8; 15219 pPlayer = *v8;
15238 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) 15220 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] )
15239 pPlayer->ReceiveDamage(v4, 5); 15221 pPlayer->ReceiveDamage(v4, 5);
15240 ++v8; 15222 ++v8;
15241 } 15223 }
15242 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); 15224 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
15243 //v0 = 0; 15225 //v0 = 0;
15244 } 15226 }
15245 if (pTurnEngine->field_1C) 15227 if (pTurnEngine->field_1C)
15246 --pTurnEngine->field_1C; 15228 --pTurnEngine->field_1C;
15247 } 15229 }
15248 } 15230 }
15249 15231
15250 if (pParty->bTurnBasedModeOn) 15232 if (pParty->bTurnBasedModeOn)
15251 { 15233 {
15264 //pActor = (Actor *)(LODWORD(v80) - 176); 15246 //pActor = (Actor *)(LODWORD(v80) - 176);
15265 //v11 = *(unsigned int *)LODWORD(v80); 15247 //v11 = *(unsigned int *)LODWORD(v80);
15266 //v49 = *(unsigned int *)LODWORD(v80) == 5; 15248 //v49 = *(unsigned int *)LODWORD(v80) == 5;
15267 ai_near_actors_targets_pid[i] = OBJECT_Player; 15249 ai_near_actors_targets_pid[i] = OBJECT_Player;
15268 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) 15250 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400)
15269 continue; 15251 continue;
15270 15252
15271 if (!actor->sCurrentHP && actor->uAIState != Dying) 15253 if (!actor->sCurrentHP && actor->uAIState != Dying)
15272 Actor::Die(i); 15254 Actor::Die(i);
15273 15255
15274 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; 15256 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1;
15275 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; 15257 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1;
15276 //v12 = 0; 15258 //v12 = 0;
15277 //v13 = 0; 15259 //v13 = 0;
15290 } 15272 }
15291 ++v13; 15273 ++v13;
15292 ++v14; 15274 ++v14;
15293 } 15275 }
15294 while ( v13 < 22 );*/ 15276 while ( v13 < 22 );*/
15295 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) 15277 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
15296 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 15278 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
15297 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) 15279 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
15298 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; 15280 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight;
15299 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) 15281 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
15300 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15282 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15301 else 15283 // not sure
15302 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; 15284 else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
15285 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType;
15303 15286
15304 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || 15287 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0
15305 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) 15288 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0)
15306 continue; 15289 continue;
15307 15290
15308 //v15 = pMiscTimer->uTimeElapsed; 15291 //v15 = pMiscTimer->uTimeElapsed;
15309 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; 15292 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
15310 //v17 = pActor->uCurrentActionTime; 15293 //v17 = pActor->uCurrentActionTime;
15311 //v18 = pActor->pMonsterInfo.uRecoveryTime; 15294 //v18 = pActor->pMonsterInfo.uRecoveryTime;
15312 if (actor->pMonsterInfo.uRecoveryTime) 15295 if (actor->pMonsterInfo.uRecoveryTime)
15313 { 15296 {
15314 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) 15297 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed)
15315 actor->pMonsterInfo.uRecoveryTime = 0; 15298 actor->pMonsterInfo.uRecoveryTime = 0;
15316 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; 15299 else
15300 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed;
15317 } 15301 }
15318 15302
15319 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; 15303 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15320 if (actor->uCurrentActionTime < actor->uCurrentActionLength) 15304 if (actor->uCurrentActionTime < actor->uCurrentActionLength)
15321 continue; 15305 continue;
15322 15306
15323 //v19 = actor->uAIState; 15307 //v19 = actor->uAIState;
15324 if (actor->uAIState == Dying) 15308 if (actor->uAIState == Dying)
15325 actor->uAIState = Dead; 15309 actor->uAIState = Dead;
15326 else 15310 else
15327 { 15311 {
15328 if (actor->uAIState != Summoned) 15312 if (actor->uAIState != Summoned)
15329 { 15313 {
15330 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); 15314 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr);
15356 15340
15357 //v20 = &ai_near_actors_targets_pid[actor_id]; 15341 //v20 = &ai_near_actors_targets_pid[actor_id];
15358 v21 = &pActors[actor_id]; 15342 v21 = &pActors[actor_id];
15359 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); 15343 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true);
15360 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) 15344 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id])
15361 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15345 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15362 a2 = ai_near_actors_targets_pid[actor_id]; 15346 actor_pid = ai_near_actors_targets_pid[actor_id];
15363 v76 = a2 & 7; 15347 actor_pid_type = PID_TYPE(actor_pid);
15364 if ( (a2 & 7) == OBJECT_Actor) 15348 if ( actor_pid_type == OBJECT_Actor)
15365 v80 = 0.5; 15349 v80 = 0.5;
15366 else 15350 else
15367 v80 = 1.0; 15351 v80 = 1.0;
15368 v22 = v21->uAIState; 15352 v22 = v21->uAIState;
15369 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) 15353 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
15370 { 15354 {
15371 continue; 15355 continue;
15372 } 15356 }
15373 else 15357 if ( !v21->sCurrentHP )
15358 Actor::Die(actor_id);
15359 for(int i=0;i<22;i++)
15374 { 15360 {
15375 if ( !v21->sCurrentHP ) 15361 if ( i != 10 )
15376 Actor::Die(actor_id);
15377 v25 = 0;
15378 v26 = v21->pActorBuffs;
15379 do
15380 { 15362 {
15381 if ( v25 != 10 ) 15363 v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed);
15382 {
15383 v26->_4585CA(pParty->uTimePlayed);
15384 //v24 = 0;
15385 }
15386 ++v25;
15387 ++v26;
15388 } 15364 }
15389 while ( v25 < 22 ); 15365 }
15390 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 15366 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
15391 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0
15392 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0
15393 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) )
15394 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; 15367 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight;
15395 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) 15368 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
15396 { 15369 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15397 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15370 // not sure
15398 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) 15371 else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
15399 { 15372 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType;
15400 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 15373 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 )
15401 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) 15374 {
15402 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; 15375 v21->uAIState = Removed;
15403 } 15376 continue;
15404 } 15377 }
15405 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 15378 if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0
15406 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 15379 || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0)
15407 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 15380 {
15408 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) 15381 continue;
15409 { 15382 }
15410 v21->uAIState = Removed; 15383 v27 = pMiscTimer->uTimeElapsed;
15411 continue; 15384 v28 = v21->pMonsterInfo.uRecoveryTime;
15412 } 15385 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15413 else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) 15386 if ( (signed int)v28 > 0 )
15387 v21->pMonsterInfo.uRecoveryTime = v28 - v27;
15388 if ( v21->pMonsterInfo.uRecoveryTime< 0 )
15389 v21->pMonsterInfo.uRecoveryTime = 0;
15390 if ( !(v21->uAttributes & 0x8000) )
15391 v21->uAttributes |= 0x8000;
15392 a1 = 8 * actor_id | OBJECT_Actor;
15393 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, actor_pid, &a3, 0);
15394 memcpy(&v75, v30, sizeof(v75));
15395 memcpy(&pDir, &v75, sizeof(pDir));
15396 uAIState = v21->uAIState;
15397 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly
15398 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0
15399 && v80 * 307.2 >= (double)(signed int)v75.uDistance
15400 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting)
15401 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) )
15402 {
15403 v32 = actor_id;
15404 }*/
15405 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly
15406 || (signed int)v21->pMonsterInfo.uRecoveryTime > 0
15407 || v80 * 307.2 < (double)(signed int)v75.uDistance
15408 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting
15409 && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned )
15410 //else
15411 {
15412 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength )
15414 { 15413 {
15415 continue; 15414 continue;
15416 } 15415 }
15416 else if ( v21->uAIState == AttackingMelee )
15417 {
15418 v35 = stru_50C198.special_ability_use_check(v21, actor_id);
15419 stru_50FE08.Add(
15420 a1,
15421 5120,
15422 v21->vPosition.x,
15423 v21->vPosition.y,
15424 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1),
15425 v35,
15426 1
15427 );
15428 }
15429 else if ( v21->uAIState == AttackingRanged1 )
15430 {
15431 v34 = v21->pMonsterInfo.uMissleAttack1Type;
15432 Actor::_404874(actor_id, &pDir, v34, 0);
15433 }
15434 else if ( v21->uAIState == AttackingRanged2 )
15435 {
15436 v34 = v21->pMonsterInfo.uMissleAttack2Type;
15437 Actor::_404874(actor_id, &pDir, v34, 1);
15438 }
15417 else 15439 else
15418 { 15440 {
15419 v27 = pMiscTimer->uTimeElapsed; 15441 if ( v21->uAIState == AttackingRanged3 )
15420 v28 = v21->pMonsterInfo.uRecoveryTime;
15421 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15422 if ( (signed int)v28 > 0 )
15423 v21->pMonsterInfo.uRecoveryTime = v28 - v27;
15424 if ( v21->pMonsterInfo.uRecoveryTime< 0 )
15425 v21->pMonsterInfo.uRecoveryTime = 0;
15426 v29 = v21->uAttributes;
15427 if ( !(v29 & 0x8000) )
15428 v21->uAttributes = v29 | 0x8000;
15429 a1 = 8 * actor_id | OBJECT_Actor;
15430 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0);
15431 v49 = v21->pMonsterInfo.uHostilityType == 0;
15432 memcpy(&v75, v30, sizeof(v75));
15433 memcpy(&pDir, &v75, sizeof(pDir));
15434 if ( !v49
15435 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0
15436 && v80 * 307.2 >= (double)(signed int)v75.uDistance
15437 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9)
15438 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 )
15439 { 15442 {
15440 v32 = actor_id; 15443 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1;
15444 v33 = v21->pMonsterInfo.uSpell1ID;
15445 Actor::_404AC7(actor_id, &pDir, v33, 2, v65);
15441 } 15446 }
15442 else 15447 else if ( v21->uAIState == AttackingRanged4 )
15443 { 15448 {
15444 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) 15449 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2;
15445 { 15450 v33 = v21->pMonsterInfo.uSpell2ID;
15446 continue; 15451 Actor::_404AC7(actor_id, &pDir, v33, 3, v65);
15447 }
15448 else if ( v21->uAIState == 2 )
15449 {
15450 v32 = actor_id;
15451 v35 = stru_50C198.special_ability_use_check(v21, actor_id);
15452 stru_50FE08.Add(
15453 a1,
15454 5120,
15455 v21->vPosition.x,
15456 v21->vPosition.y,
15457 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1),
15458 v35,
15459 1
15460 );
15461 }
15462 else if ( v21->uAIState == 3 )
15463 {
15464 v34 = v21->pMonsterInfo.uMissleAttack1Type;
15465 v66 = 0;
15466 v32 = actor_id;
15467 Actor::_404874(actor_id, &pDir, v34, v66);
15468 }
15469 else if ( v21->uAIState == 12 )
15470 {
15471 v34 = v21->pMonsterInfo.uMissleAttack2Type;
15472 v66 = 1;
15473 v32 = actor_id;
15474 Actor::_404874(actor_id, &pDir, v34, v66);
15475 }
15476 else
15477 {
15478 v32 = actor_id;
15479 if ( v21->uAIState == 13 )
15480 {
15481 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1;
15482 v60 = 2;
15483 v33 = v21->pMonsterInfo.uSpell1ID;
15484 Actor::_404AC7(actor_id, &pDir, v33, v60, v65);
15485 }
15486 else if ( v21->uAIState == 18 )
15487 {
15488 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2;
15489 v60 = 3;
15490 v33 = v21->pMonsterInfo.uSpell2ID;
15491 Actor::_404AC7(actor_id, &pDir, v33, v60, v65);
15492 }
15493 }
15494 } 15452 }
15495 } 15453 }
15496 } 15454 }
15455
15497 v36 = v75.uDistance; 15456 v36 = v75.uDistance;
15498 if ( !v21->pMonsterInfo.uHostilityType ) 15457 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly)
15499 { 15458 {
15500 if ( v76 == 3 ) 15459 if ( actor_pid_type == OBJECT_Actor )
15501 { 15460 {
15502 v36 = v75.uDistance; 15461 v36 = v75.uDistance;
15503 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] 15462 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3]
15504 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); 15463 + (pActors[actor_pid >> 3].pMonsterInfo.uID - 1) / 3);
15505 } 15464 }
15506 else 15465 else
15507 { 15466 {
15508 v37 = 4; 15467 v37 = 4;
15509 } 15468 }
15521 { 15480 {
15522 v39 = __OFSUB__(v36, 5120); 15481 v39 = __OFSUB__(v36, 5120);
15523 v38 = ((v36 - 5120) & 0x80000000u) != 0; 15482 v38 = ((v36 - 5120) & 0x80000000u) != 0;
15524 } 15483 }
15525 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) 15484 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 )
15526 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; 15485 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
15527 } 15486 }
15487
15528 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) 15488 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 )
15529 { 15489 {
15530 v40 = a2;
15531 v41 = v32;
15532 if ( (signed int)v36 >= 10240 ) 15490 if ( (signed int)v36 >= 10240 )
15533 { 15491 {
15534 v68 = 0; 15492 Actor::_4032B2(actor_id, actor_pid, 1024, 0);
15535 v61 = 1024;
15536 Actor::_4032B2(v41, v40, v61, v68);
15537 continue;
15538 } 15493 }
15539 v67 = &pDir; 15494 else
15540 Actor::_402968(v41, v40, 0, v67); 15495 {
15496 //peasents after attacked
15497 //guard after attacked
15498 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15499 }
15541 continue; 15500 continue;
15542 } 15501 }
15543 if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) 15502
15503 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && actor_pid )
15544 { 15504 {
15545 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) 15505
15506 if ( v21->pMonsterInfo.uAIType == 1 )
15546 { 15507 {
15547 if ( v21->pMonsterInfo.uAIType == 1 ) 15508 if ( v21->pMonsterInfo.uMovementType == 5 )
15548 { 15509 {
15549 v67 = &pDir; 15510 Actor::AI_Stand(actor_id, actor_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir);
15550 if ( v21->pMonsterInfo.uMovementType != 5 )
15551 {
15552 v40 = a2;
15553 v41 = v32;
15554 Actor::_402968(v41, v40, 0, v67);
15555 continue;
15556 }
15557 Actor::AI_Stand(
15558 v32,
15559 a2,
15560 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333),
15561 &pDir);
15562 } 15511 }
15563 else 15512 else
15564 { 15513 {
15514 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15515 continue;
15516 }
15517
15518 }
15519 if ( !(v21->uAttributes & 0x020000) )
15520 {
15521 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3)
15522 {
15565 if ( v21->pMonsterInfo.uAIType == 2 ) 15523 if ( v21->pMonsterInfo.uAIType == 2 )
15566 {
15567 v84 = v21->sCurrentHP;
15568 v42 = (double)(signed int)v84;
15569 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; 15524 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2;
15570 } 15525 if ( v21->pMonsterInfo.uAIType == 3 )
15571 else
15572 {
15573 v84 = v21->sCurrentHP;
15574 v42 = (double)(signed int)v84;
15575 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; 15526 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1;
15576 } 15527 v84 = v21->sCurrentHP;
15577 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) 15528 v42 = (double)(signed int)v84;
15578 if ( v43 > v42 && (signed int)v36 < 10240 ) 15529 if ( v43 > v42 && (signed int)v36 < 10240 )
15579 { 15530 {
15580 v67 = &pDir; 15531 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15581 v40 = a2;
15582 v41 = v32;
15583 Actor::_402968(v41, v40, 0, v67);
15584 continue; 15532 continue;
15585 } 15533 }
15586 } 15534 }
15587 } 15535 }
15536
15588 v81 = v36 - v21->uActorRadius; 15537 v81 = v36 - v21->uActorRadius;
15589 if ( v76 == 3 ) 15538 if ( actor_pid_type == OBJECT_Actor )
15590 v81 -= pActors[a2 >> 3].uActorRadius; 15539 v81 -= pActors[actor_pid >> 3].uActorRadius;
15591 if ( v81 < 0 ) 15540 if ( v81 < 0 )
15592 v81 = 0; 15541 v81 = 0;
15593 rand(); 15542 rand();
15594 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0;
15595 v21->uAttributes &= 0xFBFFFF; 15543 v21->uAttributes &= 0xFBFFFF;
15596 v82 = 0;
15597 v49 = v21->pMonsterInfo.uMovementType == 5;
15598 v84 = v44;
15599 if ( v49 )
15600 v82 = 1;
15601 if ( v81 < 5120 ) 15544 if ( v81 < 5120 )
15602 { 15545 {
15603 v45 = stru_50C198.special_ability_use_check(v21, v32); 15546 v45 = stru_50C198.special_ability_use_check(v21, actor_id);
15604 if ( !v45 ) 15547 if ( v45 == 0 )
15605 { 15548 {
15606 if ( v21->pMonsterInfo.uMissleAttack1Type ) 15549 if ( v21->pMonsterInfo.uMissleAttack1Type )
15607 { 15550 {
15608 if ( v84 ) 15551 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
15609 { 15552 {
15610 Actor::_403476(v32, a2, &pDir); 15553 Actor::_403476(actor_id, actor_pid, &pDir);
15611 continue;
15612
15613 } 15554 }
15614 if ( v82 ) 15555 else if ( v21->pMonsterInfo.uMovementType == 5 )
15615 { 15556 {
15616 v69 = &pDir;
15617 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15557 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15618 v51 = a2;
15619 v64 = (signed __int64)v47; 15558 v64 = (signed __int64)v47;
15620 v52 = v32; 15559 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15621 Actor::AI_Stand(v52, v51, v64, v69);
15622 continue;
15623 } 15560 }
15624 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15561 else
15625 //UNDEF(v53);
15626 v69 = &pDir;
15627 if ( !(v54 | v55) )
15628 { 15562 {
15629 v51 = a2; 15563 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15630 v64 = (signed __int64)v47; 15564 if ( !(v54 | v55) )
15631 v52 = v32;
15632 Actor::AI_Stand(v52, v51, v64, v69);
15633 continue;
15634 }
15635 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69);
15636 continue;
15637 }
15638 v56 = v80 * 307.2;
15639 if ( (double)v81 >= v56 )
15640 {
15641 if ( v81 >= 1024 )
15642 {
15643 if ( v82 )
15644 { 15565 {
15645 v69 = &pDir;
15646 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15647 v51 = a2;
15648 v64 = (signed __int64)v47; 15566 v64 = (signed __int64)v47;
15649 v52 = v32; 15567 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15650 Actor::AI_Stand(v52, v51, v64, v69);
15651 continue; 15568 continue;
15652 } 15569 }
15653 v71 = &pDir; 15570 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15654 v63 = 0;
15655
15656 Actor::_402686(v32, a2, v63, v71);
15657 continue;
15658 } 15571 }
15659 if ( v82 ) 15572 }
15573 else
15574 {
15575 v56 = v80 * 307.2;
15576 if ( (double)v81 >= v56 )
15660 { 15577 {
15661 v69 = &pDir; 15578 if ( v81 >= 1024 )
15579 {
15580 if ( v21->pMonsterInfo.uMovementType == 5 )
15581 {
15582 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15583 v64 = (signed __int64)v47;
15584 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15585 }
15586 else
15587 {
15588 //monsters
15589 Actor::_402686(actor_id, actor_pid, 0, &pDir);
15590 }
15591 }
15592 else if ( v21->pMonsterInfo.uMovementType == 5 )
15593 {
15594 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15595 v64 = (signed __int64)v47;
15596 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15597 }
15598 else
15599 {
15600 v70 = (signed __int64)v56;
15601 //monsters
15602 //guard after player runs away
15603 // follow player
15604 Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
15605 }
15606 }
15607 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15608 {
15662 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15609 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15663 v51 = a2;
15664 v64 = (signed __int64)v47; 15610 v64 = (signed __int64)v47;
15665 v52 = v32; 15611 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15666 Actor::AI_Stand(v52, v51, v64, v69);
15667 continue;
15668 } 15612 }
15669 v70 = (signed __int64)v56; 15613 else
15670 v62 = &pDir; 15614 {
15671 v59 = 0; 15615 //monsters
15672 Actor::_40281C(v32, a2, v59, v62, v70); 15616 Actor::_403C6C(actor_id, actor_pid, &pDir);
15673 continue; 15617 }
15674 } 15618 }
15675 v49 = v84 == 0;
15676 v69 = &pDir;
15677 if ( v49 )
15678 {
15679 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15680 v51 = a2;
15681 v64 = (signed __int64)v47;
15682 v52 = v32;
15683 Actor::AI_Stand(v52, v51, v64, v69);
15684 continue;
15685 }
15686 Actor::_403C6C(v32, a2, &pDir);
15687 continue; 15619 continue;
15688 } 15620 }
15689 if ( v45 != 1 ) 15621 else if ( v45 == 2 || v45 == 3 )
15690 { 15622 {
15691 if ( v45 > 1 && v45 <= 3 ) 15623 if ( v45 == 2 )
15624 v46 = v21->pMonsterInfo.uSpell1ID;
15625 else
15626 v46 = v21->pMonsterInfo.uSpell2ID;
15627 if ( v46 )
15692 { 15628 {
15693 if ( v45 == 2 ) 15629 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
15694 v46 = v21->pMonsterInfo.uSpell1ID; 15630 {
15631 if ( v45 == 2 )
15632 Actor::_403854(actor_id, actor_pid, &pDir);
15633 else
15634 Actor::_403A60(actor_id, actor_pid, &pDir);
15635 }
15636 else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 )
15637 {
15638 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15639 v64 = (signed __int64)v47;
15640 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15641 }
15695 else 15642 else
15696 v46 = v21->pMonsterInfo.uSpell2ID;
15697 if ( v46 )
15698 { 15643 {
15699 if ( v84 )
15700 {
15701 if ( v45 == 2 )
15702 Actor::_403854(v32, a2, &pDir);
15703 else
15704 Actor::_403A60(v32, a2, &pDir);
15705 continue;
15706 }
15707 if ( v80 * 307.2 > (double)v81 || v82 )
15708 {
15709 v69 = &pDir;
15710 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15711 v51 = a2;
15712 v64 = (signed __int64)v47;
15713 v52 = v32;
15714 Actor::AI_Stand(v52, v51, v64, v69);
15715 continue;
15716
15717 }
15718 v69 = &pDir;
15719 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15644 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15720 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); 15645 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15721 continue;
15722 } 15646 }
15647 }
15648 else
15649 {
15723 v48 = v80 * 307.2; 15650 v48 = v80 * 307.2;
15724 if ( (double)v81 >= v48 ) 15651 if ( (double)v81 >= v48 )
15725 { 15652 {
15726 if ( v81 >= 1024 ) 15653 if ( v81 >= 1024 )
15727 { 15654 {
15728 v50 = v82 == 0; 15655 if ( v21->pMonsterInfo.uMovementType == 5 )
15729 if ( !v50 )
15730 { 15656 {
15731 v69 = &pDir;
15732 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15657 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15733 v51 = a2;
15734 v64 = (signed __int64)v47; 15658 v64 = (signed __int64)v47;
15735 v52 = v32; 15659 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15736 Actor::AI_Stand(v52, v51, v64, v69);
15737 continue;
15738 } 15660 }
15739 v71 = &pDir; 15661 else
15740 v63 = 256; 15662 {
15741 Actor::_402686(v32, a2, v63, v71); 15663 Actor::_402686(actor_id, actor_pid, 256, &pDir);
15742 continue; 15664 }
15743
15744 } 15665 }
15745 if ( v82 ) 15666 else if ( v21->pMonsterInfo.uMovementType == 5 )
15746 { 15667 {
15747 v69 = &pDir;
15748 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15668 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15749 v51 = a2;
15750 v64 = (signed __int64)v47; 15669 v64 = (signed __int64)v47;
15751 v52 = v32; 15670 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15752 Actor::AI_Stand(v52, v51, v64, v69);
15753 continue;
15754 } 15671 }
15755 v70 = (signed __int64)v48; 15672 else
15756 v62 = &pDir; 15673 {
15757 v59 = 0; 15674 v70 = (signed __int64)v48;
15758 Actor::_40281C(v32, a2, v59, v62, v70); 15675 Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
15759 continue; 15676 }
15760 } 15677 }
15761 v49 = v84 == 0; 15678 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15762 v69 = &pDir;
15763 if ( v49 )
15764 { 15679 {
15765 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15680 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15766 v51 = a2;
15767 v64 = (signed __int64)v47; 15681 v64 = (signed __int64)v47;
15768 v52 = v32; 15682 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15769 Actor::AI_Stand(v52, v51, v64, v69);
15770 continue;
15771 } 15683 }
15772 Actor::_403C6C(v32, a2, &pDir); 15684 else
15773 continue; 15685 {
15686 Actor::_403C6C(actor_id, actor_pid, &pDir);
15687 }
15774 } 15688 }
15689 continue;
15775 } 15690 }
15776 } 15691 }
15777 } 15692 }
15778 if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 || v81 >= 5120 || v45 != 1 ) 15693
15694 if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !actor_pid || v81 >= 5120 || v45 != 1 )
15779 { 15695 {
15780 if ( !v21->pMonsterInfo.uMovementType ) 15696 if ( !v21->pMonsterInfo.uMovementType )
15781 { 15697 {
15782 v68 = 0; 15698 Actor::_4032B2(actor_id, 4, 1024, 0);
15783 v61 = 1024;
15784 v41 = v32;
15785 v40 = 4;
15786 Actor::_4032B2(v41, v40, v61, v68);
15787 continue;
15788
15789 } 15699 }
15790 if ( v21->pMonsterInfo.uMovementType == 1 ) 15700 else if ( v21->pMonsterInfo.uMovementType == 1 )
15791 { 15701 {
15792 v68 = 0; 15702 Actor::_4032B2(actor_id, 4, 2560, 0);
15793 v61 = 2560;
15794 v41 = v32;
15795 v40 = 4;
15796 Actor::_4032B2(v41, v40, v61, v68);
15797 continue;
15798 } 15703 }
15799 if ( v21->pMonsterInfo.uMovementType == 2 ) 15704 else if ( v21->pMonsterInfo.uMovementType == 2 )
15800 { 15705 {
15801 v68 = 0; 15706 Actor::_4032B2(actor_id, 4, 5120, 0);
15802 v61 = 5120;
15803 v41 = v32;
15804 v40 = 4;
15805 Actor::_4032B2(v41, v40, v61, v68);
15806 continue;
15807 } 15707 }
15808 if ( v21->pMonsterInfo.uMovementType == 4 ) 15708 else if ( v21->pMonsterInfo.uMovementType == 4 )
15809 { 15709 {
15810 v68 = 0; 15710 Actor::_4032B2(actor_id, 4, 10240, 0);
15811 v61 = 10240;
15812 v41 = v32;
15813 v40 = 4;
15814 Actor::_4032B2(v41, v40, v61, v68);
15815 continue;
15816 } 15711 }
15817 if ( v21->pMonsterInfo.uMovementType == 5 ) 15712 else if ( v21->pMonsterInfo.uMovementType == 5 )
15818 { 15713 {
15819 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); 15714 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
15820 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15715 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15821 memcpy(&v74, v57, sizeof(v74)); 15716 memcpy(&v74, v57, sizeof(v74));
15822 memcpy(&pDir, &v74, sizeof(pDir)); 15717 memcpy(&pDir, &v74, sizeof(pDir));
15823 v69 = &pDir;
15824 v52 = actor_id;
15825 v64 = (signed __int64)v58; 15718 v64 = (signed __int64)v58;
15826 v51 = 4; 15719 Actor::AI_Stand(actor_id, 4, v64, &pDir);
15827 Actor::AI_Stand(v52, v51, v64, v69); 15720 }
15828 continue;
15829 }
15830 continue;
15831
15832 } 15721 }
15833 if ( !v21->pMonsterInfo.uMissleAttack2Type ) 15722 else if ( !v21->pMonsterInfo.uMissleAttack2Type )
15834 { 15723 {
15835 v56 = v80 * 307.2; 15724 v56 = v80 * 307.2;
15836 if ( (double)v81 >= v56 ) 15725 if ( (double)v81 >= v56 )
15837 { 15726 {
15838 if ( v81 >= 1024 ) 15727 if ( v81 >= 1024 )
15839 { 15728 {
15840 v50 = v82 == 0; 15729 if ( v21->pMonsterInfo.uMovementType == 5 )
15841 if ( !v50 )
15842 { 15730 {
15843 v69 = &pDir;
15844 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15731 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15845 v51 = a2;
15846 v64 = (signed __int64)v47; 15732 v64 = (signed __int64)v47;
15847 v52 = v32; 15733 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15848 Actor::AI_Stand(v52, v51, v64, v69);
15849 continue;
15850 } 15734 }
15851 v71 = &pDir; 15735 else
15852 v63 = 256; 15736 {
15853 Actor::_402686(v32, a2, v63, v71); 15737 Actor::_402686(actor_id, actor_pid, 256, &pDir);
15854 continue; 15738 }
15855 } 15739 }
15856 if ( v82 ) 15740 else if ( v21->pMonsterInfo.uMovementType == 5 )
15857 { 15741 {
15858 v69 = &pDir;
15859 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15742 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15860 v51 = a2;
15861 v64 = (signed __int64)v47; 15743 v64 = (signed __int64)v47;
15862 v52 = v32; 15744 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15863 Actor::AI_Stand(v52, v51, v64, v69);
15864 continue;
15865 } 15745 }
15866 v70 = (signed __int64)v56; 15746 else
15867 v62 = &pDir; 15747 {
15868 v59 = 0; 15748 v70 = (signed __int64)v56;
15869 Actor::_40281C(v32, a2, v59, v62, v70); 15749 Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
15870 continue; 15750 }
15871
15872 } 15751 }
15873 v49 = v84 == 0; 15752 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15874 v69 = &pDir;
15875 if ( v49 )
15876 { 15753 {
15877 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15754 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15878 v51 = a2;
15879 v64 = (signed __int64)v47; 15755 v64 = (signed __int64)v47;
15880 v52 = v32; 15756 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15881 Actor::AI_Stand(v52, v51, v64, v69);
15882 continue;
15883 } 15757 }
15884 Actor::_403C6C(v32, a2, &pDir); 15758 else
15885 continue; 15759 {
15760 Actor::_403C6C(actor_id, actor_pid, &pDir);
15761 }
15886 } 15762 }
15887 if ( !v84 ) 15763 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15888 { 15764 {
15889 if ( v82 ) 15765 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15766 if ( !(v54 | v55) || v21->pMonsterInfo.uMovementType == 5 )
15890 { 15767 {
15891 v69 = &pDir;
15892 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15893 v51 = a2;
15894 v64 = (signed __int64)v47; 15768 v64 = (signed __int64)v47;
15895 v52 = v32; 15769 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15896 Actor::AI_Stand(v52, v51, v64, v69);
15897 continue;
15898 } 15770 }
15899 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15771 else
15900 //UNDEF(v53);
15901 v69 = &pDir;
15902 if ( !(v54 | v55) )
15903 { 15772 {
15904 v51 = a2; 15773 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15905 v64 = (signed __int64)v47;
15906 v52 = v32;
15907 Actor::AI_Stand(v52, v51, v64, v69);
15908 continue;
15909 } 15774 }
15910 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69);
15911 continue;
15912 } 15775 }
15913 Actor::_40368B(v32, a2, &pDir); 15776 else
15777 {
15778 Actor::_40368B(actor_id, actor_pid, &pDir);
15779 }
15914 } 15780 }
15915 } 15781 }
15916 } 15782 }
15917 15783
15918 //----- (0040261D) -------------------------------------------------------- 15784 //----- (0040261D) --------------------------------------------------------