Mercurial > mm7
comparison mm7_3.cpp @ 845:8f135b689262
UpdateActors_ODM cleaning
author | zipi |
---|---|
date | Fri, 29 Mar 2013 16:13:32 +0000 |
parents | d593ca75c366 |
children | 39503542470c |
comparison
equal
deleted
inserted
replaced
844:d593ca75c366 | 845:8f135b689262 |
---|---|
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 |
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 |
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 { |
951 continue; | |
952 } | |
953 v2 = v0->pMonsterInfo.uID; | 953 v2 = v0->pMonsterInfo.uID; |
954 v3 = 0; | 954 v3 = 0; |
955 v69 = 0; | 955 v69 = 0; |
956 if ( MonsterStats::BelongsToSupertype(v2, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | 956 if ( MonsterStats::BelongsToSupertype(v2, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
957 v3 = 1; | 957 v3 = 1; |
958 v4 = v0->pMonsterInfo.uFlying; | |
959 v0->uSectorID = 0; | 958 v0->uSectorID = 0; |
960 v74 = v4; | 959 uIsFlying = v0->pMonsterInfo.uFlying; |
961 if ( !v0->CanAct() ) | 960 if ( !v0->CanAct() ) |
962 v74 = 0; | 961 uIsFlying = 0; |
963 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); | 962 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); |
964 v5 = ODM_GetFloorLevel( | 963 v5 = ODM_GetFloorLevel( |
965 v0->vPosition.x, | 964 v0->vPosition.x, |
966 v0->vPosition.y, | 965 v0->vPosition.y, |
967 v0->vPosition.z, | 966 v0->vPosition.z, |
968 v0->uActorHeight, | 967 v0->uActorHeight, |
969 &v76, | 968 &uIsOnWater, |
970 (int *)&v69, | 969 (int *)&v69, |
971 v3); | 970 v3); |
972 v6 = v0->vPosition.z; | 971 v6 = v0->vPosition.z; |
973 v7 = v5; | 972 v7 = v5; |
974 v68 = v5; | 973 v68 = v5; |
975 v72 = 0; | 974 uIsAboveFloor = 0; |
976 v67 = v69 == 0; | 975 v67 = v69 == 0; |
977 if ( v6 > v5 + 1 ) | 976 if ( v6 > v5 + 1 ) |
978 v72 = 1; | 977 uIsAboveFloor = 1; |
979 if ( v0->uAIState == 5 && v76 && !v72 ) | 978 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor ) |
980 { | 979 { |
981 v0->uAIState = Removed; | 980 v0->uAIState = Removed; |
982 goto LABEL_121; | 981 continue; |
983 } | 982 } |
984 if ( v0->uCurrentActionAnimation == ANIM_Walking ) | 983 if ( v0->uCurrentActionAnimation == ANIM_Walking ) |
985 { | 984 { |
986 v8 = v0->uMovementSpeed; | 985 v8 = v0->uMovementSpeed; |
987 v9 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0; | |
988 v10 = SHIDWORD(v0->pActorBuffs[7].uExpireTime) < 0; | |
989 v73 = v0->uMovementSpeed; | 986 v73 = v0->uMovementSpeed; |
990 if ( !v10 && (!(v10 | v9) || LODWORD(v0->pActorBuffs[7].uExpireTime) > 0) ) | 987 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 ) |
991 { | 988 { |
992 v8 = (signed __int64)((double)v73 * 0.5); | 989 v8 = (signed __int64)((double)v73 * 0.5); |
993 v73 = (signed __int64)((double)v73 * 0.5); | 990 v73 = (signed __int64)((double)v73 * 0.5); |
994 } | 991 } |
995 v11 = v0->uAIState; | 992 if ( uAIState == Fleeing || uAIState == Pursuing ) |
996 if ( v11 == 7 || v11 == 6 ) | |
997 { | 993 { |
998 v8 *= 2; | 994 v8 *= 2; |
999 v73 = v8; | 995 v73 = v8; |
1000 } | 996 } |
1001 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 ) | 997 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 ) |
1002 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); | 998 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); |
1003 if ( v8 > 1000 ) | 999 if ( v8 > 1000 ) |
1004 v8 = 1000; | 1000 v8 = 1000; |
1005 v12 = stru_5C6E00->Cos(v0->uYawAngle); | 1001 v12 = stru_5C6E00->Cos(v0->uYawAngle); |
1006 v69 = v12; | |
1007 v13 = v12 * (signed __int64)v8; | 1002 v13 = v12 * (signed __int64)v8; |
1008 v73 = v13 >> 16; | 1003 v73 = v13 >> 16; |
1009 v0->vVelocity.x = WORD1(v13); | 1004 v0->vVelocity.x = WORD1(v13); |
1010 v69 = stru_5C6E00->Sin(v0->uYawAngle); | 1005 v69 = stru_5C6E00->Sin(v0->uYawAngle); |
1011 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; | 1006 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; |
1012 v9 = v74 == 0; | |
1013 v0->vVelocity.y = v69 * v8 >> 16; | 1007 v0->vVelocity.y = v69 * v8 >> 16; |
1014 if ( !v9 ) | 1008 if ( uIsFlying ) |
1015 { | 1009 { |
1016 v14 = stru_5C6E00->Sin(v0->uPitchAngle); | 1010 v14 = stru_5C6E00->Sin(v0->uPitchAngle); |
1017 v69 = v14; | 1011 v69 = v14; |
1018 v15 = v14 * (signed __int64)v8; | 1012 v15 = v14 * (signed __int64)v8; |
1019 v73 = v15 >> 16; | 1013 v73 = v15 >> 16; |
1027 v69 = 55000; | 1021 v69 = 55000; |
1028 v73 = (unsigned __int64)(55000i64 * v73) >> 16; | 1022 v73 = (unsigned __int64)(55000i64 * v73) >> 16; |
1029 v0->vVelocity.x = v73; | 1023 v0->vVelocity.x = v73; |
1030 v73 = v0->vVelocity.y; | 1024 v73 = v0->vVelocity.y; |
1031 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16; | 1025 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16; |
1032 v9 = v74 == 0; | |
1033 v0->vVelocity.y = v73; | 1026 v0->vVelocity.y = v73; |
1034 if ( !v9 ) | 1027 if ( uIsFlying ) |
1035 { | 1028 { |
1036 v69 = 55000; | 1029 v69 = 55000; |
1037 v73 = v0->vVelocity.z; | 1030 v73 = v0->vVelocity.z; |
1038 v73 = (unsigned __int64)(55000i64 * v73) >> 16; | 1031 v73 = (unsigned __int64)(55000i64 * v73) >> 16; |
1039 v0->vVelocity.z = v73; | 1032 v0->vVelocity.z = v73; |
1040 } | 1033 } |
1041 } | 1034 } |
1042 if ( v0->vPosition.z < v7 ) | 1035 if ( v0->vPosition.z < v7 ) |
1043 { | 1036 { |
1044 v16 = v74; | 1037 v16 = uIsFlying; |
1045 v0->vPosition.z = v7; | 1038 v0->vPosition.z = v7; |
1046 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; | 1039 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; |
1047 } | 1040 } |
1048 v17 = 0; | 1041 v17 = 0; |
1049 if ( !v72 || v74 ) | 1042 if ( !uIsAboveFloor || uIsFlying ) |
1050 { | 1043 { |
1051 if ( v70 && !v72 && v67 ) | 1044 if ( v70 && !uIsAboveFloor && v67 ) |
1052 { | 1045 { |
1053 v18 = v0->vPosition.y; | 1046 v18 = v0->vPosition.y; |
1054 v19 = v0->vPosition.x; | 1047 v19 = v0->vPosition.x; |
1055 v0->vPosition.z = v7; | 1048 v0->vPosition.z = v7; |
1056 ODM_GetTerrainNormalAt(v19, v18, &v62); | 1049 ODM_GetTerrainNormalAt(v19, v18, &v62); |
1058 v21 = v62.y; | 1051 v21 = v62.y; |
1059 v22 = v62.z; | 1052 v22 = v62.z; |
1060 v23 = v62.y * v0->vVelocity.y; | 1053 v23 = v62.y * v0->vVelocity.y; |
1061 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; | 1054 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; |
1062 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16; | 1055 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16; |
1063 v72 = v21; | 1056 v72b = v21; |
1064 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16; | 1057 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16; |
1065 v72 = (unsigned __int64)(v73 * (signed __int64)v72) >> 16; | 1058 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16; |
1066 v24 = v72; | 1059 v24 = v72b; |
1067 v72 = v22; | 1060 v72b = v22; |
1068 v0->vVelocity.y += v24; | 1061 v0->vVelocity.y += v24; |
1069 v72 = (unsigned __int64)(v73 * (signed __int64)v72) >> 16; | 1062 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16; |
1070 v0->vVelocity.z += v72; | 1063 v0->vVelocity.z += v72b; |
1071 v17 = 0; | 1064 v17 = 0; |
1072 } | 1065 } |
1073 } | 1066 } |
1074 else | 1067 else |
1075 { | 1068 { |
1088 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == v17 ) | 1081 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == v17 ) |
1089 { | 1082 { |
1090 v0->vVelocity.y = v17; | 1083 v0->vVelocity.y = v17; |
1091 v0->vVelocity.x = v17; | 1084 v0->vVelocity.x = v17; |
1092 } | 1085 } |
1093 v9 = v0->pMonsterInfo.uFlying == 0; | |
1094 stru_721530.field_0 = 1; | 1086 stru_721530.field_0 = 1; |
1095 if ( v9 ) | 1087 if ( !uIsFlying ) |
1096 v26 = 40; | 1088 v26 = 40; |
1097 else | 1089 else |
1098 v26 = v0->uActorRadius; | 1090 v26 = v0->uActorRadius; |
1099 v27 = v0->uActorHeight; | 1091 v27 = v0->uActorHeight; |
1100 stru_721530.field_84 = -1; | 1092 stru_721530.field_84 = -1; |
1134 ++i; | 1126 ++i; |
1135 } | 1127 } |
1136 v71 = i > 1; | 1128 v71 = i > 1; |
1137 if ( stru_721530.field_7C < stru_721530.field_6C ) | 1129 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; | 1130 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1139 v34 = 0; | 1131 //v34 = 0; |
1140 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | 1132 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
1141 v36 = ODM_GetFloorLevel( | 1133 v36 = ODM_GetFloorLevel( |
1142 stru_721530.normal2.x, | 1134 stru_721530.normal2.x, |
1143 stru_721530.normal2.y, | 1135 stru_721530.normal2.y, |
1144 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, | 1136 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, |
1145 v0->uActorHeight, | 1137 v0->uActorHeight, |
1146 (int *)&v63, | 1138 (int *)&v63, |
1147 &v64, | 1139 &v64, |
1148 0); | 1140 0); |
1149 if ( v76 ) | 1141 if ( uIsOnWater ) |
1150 { | 1142 { |
1151 if ( v35 < v36 + 60 ) | 1143 if ( v35 < v36 + 60 ) |
1152 { | 1144 { |
1153 v37 = v0->uAIState; | 1145 v37 = v0->uAIState; |
1154 if ( v37 == 5 || v37 == 4 || v37 == 11 || v37 == 19 ) | 1146 if ( v37 == 5 || v37 == 4 || v37 == 11 || v37 == 19 ) |
1168 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | 1160 v0->vPosition.x = LOWORD(stru_721530.normal2.x); |
1169 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | 1161 v0->vPosition.y = LOWORD(stru_721530.normal2.y); |
1170 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | 1162 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; |
1171 break; | 1163 break; |
1172 } | 1164 } |
1173 v72 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | 1165 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; | 1166 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; | 1167 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; | 1168 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; | 1169 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1178 v38 = stru_721530.uFaceID; | 1170 v38 = stru_721530.uFaceID; |
1179 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; | 1171 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; |
1180 stru_721530.field_70 += stru_721530.field_7C; | 1172 stru_721530.field_70 += stru_721530.field_7C; |
1181 v39 = v38 >> 3; | 1173 v39 = v38 >> 3; |
1182 switch ( v38 & 7 ) | 1174 switch ( PID_TYPE(v38) ) |
1183 { | 1175 { |
1184 case 3: | 1176 case OBJECT_Actor: |
1185 if ( pParty->bTurnBasedModeOn != 1 ) | 1177 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 { | 1178 { |
1189 v34 = 0; | 1179 //if(pParty->bTurnBasedModeOn == 1) |
1190 LABEL_97: | 1180 //v34 = 0; |
1191 if ( v0->pMonsterInfo.uHostilityType ) | 1181 if ( v0->pMonsterInfo.uHostilityType ) |
1192 { | 1182 { |
1193 if ( v71 == v34 ) | 1183 if ( v71 == 0 ) |
1194 goto LABEL_99; | 1184 { |
1195 LABEL_101: | 1185 Actor::_402968(v75, v38, 0, (AIDirection *)0); |
1196 Actor::AI_StandOrBored(v75, 4, v34, (AIDirection *)v34); | 1186 } |
1197 break; | 1187 else |
1188 { | |
1189 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1190 } | |
1198 } | 1191 } |
1199 if ( v71 != v34 ) | 1192 else if ( v71 != 0 ) |
1200 goto LABEL_101; | 1193 { |
1201 if ( pActors[v39].pMonsterInfo.uHostilityType ) | 1194 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); |
1195 } | |
1196 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | |
1202 { | 1197 { |
1203 LABEL_99: | 1198 Actor::_402968(v75, v38, 0, (AIDirection *)0); |
1204 Actor::_402968(v75, v38, v34, (AIDirection *)v34); | |
1205 break; | |
1206 } | 1199 } |
1207 LABEL_103: | 1200 else |
1208 Actor::FaceObject(v75, v38, v34, (AIDirection *)v34); | 1201 { |
1209 break; | 1202 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); |
1203 } | |
1210 } | 1204 } |
1211 break; | 1205 break; |
1212 case 4: | 1206 case OBJECT_Player: |
1213 if ( !v0->GetActorsRelation(0) ) | 1207 if ( !v0->GetActorsRelation(0) ) |
1214 { | 1208 { |
1215 v38 = stru_721530.uFaceID; | 1209 v38 = stru_721530.uFaceID; |
1216 goto LABEL_103; | 1210 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); |
1211 break; | |
1217 } | 1212 } |
1218 v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; | 1213 v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; |
1219 v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; | 1214 v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; |
1220 v0->vVelocity.y = 0; | 1215 v0->vVelocity.y = 0; |
1221 v0->vVelocity.x = 0; | 1216 v0->vVelocity.x = 0; |
1222 if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) | 1217 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) |
1218 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime < 0) | |
1223 pParty->pPartyBuffs[11].Reset(); | 1219 pParty->pPartyBuffs[11].Reset(); |
1224 viewparams->bRedrawGameUI = 1; | 1220 viewparams->bRedrawGameUI = 1; |
1225 break; | 1221 break; |
1226 case 5: | 1222 case OBJECT_Decoration: |
1227 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); | 1223 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
1228 v48 = stru_5C6E00->Atan2( | 1224 v48 = stru_5C6E00->Atan2( |
1229 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, | 1225 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, |
1230 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); | 1226 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); |
1231 v71 = stru_5C6E00->Cos(v48); | 1227 v71 = stru_5C6E00->Cos(v48); |
1236 v71 = v50; | 1232 v71 = v50; |
1237 v51 = v50 * (signed __int64)v47; | 1233 v51 = v50 * (signed __int64)v47; |
1238 v70 = v51 >> 16; | 1234 v70 = v51 >> 16; |
1239 v0->vVelocity.y = WORD1(v51); | 1235 v0->vVelocity.y = WORD1(v51); |
1240 break; | 1236 break; |
1241 case 6: | 1237 case OBJECT_BModel: |
1242 v40 = &pOutdoor->pBModels[v38 >> 9]; | 1238 v40 = &pOutdoor->pBModels[v38 >> 9]; |
1243 v41 = &v40->pFaces[v39 & 0x3F]; | 1239 v41 = &v40->pFaces[v39 & 0x3F]; |
1244 if ( !(BYTE3(v41->uAttributes) & 0x20) ) | 1240 if ( !(BYTE3(v41->uAttributes) & 0x20) ) |
1245 { | 1241 { |
1246 v42 = v41->uPolygonType; | 1242 v42 = v41->uPolygonType; |
1256 v0->vVelocity.x = 0; | 1252 v0->vVelocity.x = 0; |
1257 } | 1253 } |
1258 } | 1254 } |
1259 else | 1255 else |
1260 { | 1256 { |
1261 v72 = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z | 1257 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; | 1258 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; |
1263 if ( stru_721530.field_64 >> 3 > v72 ) | 1259 if ( stru_721530.field_64 >> 3 > v72b ) |
1264 v72 = stru_721530.field_64 >> 3; | 1260 v72b = stru_721530.field_64 >> 3; |
1265 v73 = v41->pFacePlane.vNormal.x; | 1261 v73 = v41->pFacePlane.vNormal.x; |
1266 v73 = (unsigned __int64)(v72 * (signed __int64)v73) >> 16; | 1262 v73 = (unsigned __int64)(v72b * (signed __int64)v73) >> 16; |
1267 v71 = v41->pFacePlane.vNormal.y; | 1263 v71 = v41->pFacePlane.vNormal.y; |
1268 v71 = (unsigned __int64)(v72 * (signed __int64)v71) >> 16; | 1264 v71 = (unsigned __int64)(v72b * (signed __int64)v71) >> 16; |
1269 v70 = v41->pFacePlane.vNormal.z; | 1265 v70 = v41->pFacePlane.vNormal.z; |
1270 v70 = (unsigned __int64)(v72 * (signed __int64)(signed int)v70) >> 16; | 1266 v70 = (unsigned __int64)(v72b * (signed __int64)(signed int)v70) >> 16; |
1271 v0->vVelocity.x += v73; | 1267 v0->vVelocity.x += v73; |
1272 v0->vVelocity.y += v71; | 1268 v0->vVelocity.y += v71; |
1273 v0->vVelocity.z += v70; | 1269 v0->vVelocity.z += v70; |
1274 if ( v42 != 4 ) | 1270 if ( v42 != 4 ) |
1275 { | 1271 { |
1300 v71 = 58500; | 1296 v71 = 58500; |
1301 v0->vVelocity.y = v70; | 1297 v0->vVelocity.y = v70; |
1302 v70 = v0->vVelocity.z; | 1298 v70 = v0->vVelocity.z; |
1303 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; | 1299 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; |
1304 ++v69; | 1300 ++v69; |
1305 v54 = v69 < 100; | 1301 //v54 = v69 < 100; |
1306 v10 = (v69 - 100) < 0; | 1302 //v10 = (v69 - 100) < 0; |
1307 v0->vVelocity.z = v70; | 1303 v0->vVelocity.z = v70; |
1308 if ( !(v10 ^ v54) ) | 1304 if ( v69 >= 100 ) |
1309 break; | 1305 break; |
1310 v26 = stru_721530.prolly_normal_d; | 1306 v26 = stru_721530.prolly_normal_d; |
1311 } | 1307 } |
1312 v69 = WorldPosToGridCellX(v66); | 1308 v69 = WorldPosToGridCellX(v66); |
1313 v55 = WorldPosToGridCellZ(v65); | 1309 v55 = WorldPosToGridCellZ(v65); |
1314 v56 = v55 - 1; | |
1315 v57 = v0->vPosition.x; | 1310 v57 = v0->vPosition.x; |
1316 v71 = v55 - 1; | |
1317 v68 = WorldPosToGridCellX(v57); | 1311 v68 = WorldPosToGridCellX(v57); |
1318 v70 = WorldPosToGridCellZ(v0->vPosition.y) - 1; | 1312 v70 = WorldPosToGridCellZ(v0->vPosition.y) - 1; |
1319 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v69, v56) >> 1) & 1; | 1313 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v69, v56) >> 1) & 1; |
1320 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v68, v70) >> 1) & 1; | 1314 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v68, v70) >> 1) & 1; |
1321 v60 = 0; | 1315 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v57) |
1322 if ( v69 == v68 && v71 == v70 && v58 ) | 1316 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y) |
1323 v60 = 1; | 1317 && v58 |
1324 if ( !v67 ) | 1318 || v67 != 0 ) |
1325 v60 = 1; | |
1326 if ( !v60 ) | |
1327 { | 1319 { |
1328 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | 1320 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
1329 { | 1321 { |
1330 v58 = v58 == 0; | 1322 v58 = v58 == 0; |
1331 v59 = v59 == 0; | 1323 v59 = v59 == 0; |
1332 } | 1324 } |
1333 if ( !v74 && v58 && !v59 ) | 1325 if ( !uIsFlying && v58 && !v59 ) |
1334 { | 1326 { |
1335 v0->vPosition.x = v66; | 1327 v0->vPosition.x = v66; |
1336 v0->vPosition.y = v65; | 1328 v0->vPosition.y = v65; |
1337 if ( v0->CanAct() ) | 1329 if ( v0->CanAct() ) |
1338 { | 1330 { |
1341 v0->uCurrentActionLength = 128; | 1333 v0->uCurrentActionLength = 128; |
1342 v0->uAIState = Fleeing; | 1334 v0->uAIState = Fleeing; |
1343 } | 1335 } |
1344 } | 1336 } |
1345 } | 1337 } |
1346 LABEL_121: | 1338 } |
1347 ++v75; | |
1348 } | |
1349 while ( (signed int)v75 < (signed int)uNumActors ); | |
1350 } | 1339 } |
1351 | 1340 |
1352 //----- (0047253E) -------------------------------------------------------- | 1341 //----- (0047253E) -------------------------------------------------------- |
1353 void UpdateObjects() | 1342 void UpdateObjects() |
1354 { | 1343 { |
15109 //int *v20; // esi@80 | 15098 //int *v20; // esi@80 |
15110 Actor *v21; // ebx@80 | 15099 Actor *v21; // ebx@80 |
15111 unsigned __int16 v22; // ax@86 | 15100 unsigned __int16 v22; // ax@86 |
15112 //signed int v23; // eax@94 | 15101 //signed int v23; // eax@94 |
15113 //unsigned int v24; // eax@102 | 15102 //unsigned int v24; // eax@102 |
15114 signed int v25; // edi@102 | 15103 //signed int v25; // edi@102 |
15115 SpellBuff *v26; // esi@102 | 15104 //SpellBuff *v26; // esi@102 |
15116 unsigned int v27; // ecx@123 | 15105 unsigned int v27; // ecx@123 |
15117 unsigned int v28; // eax@123 | 15106 unsigned int v28; // eax@123 |
15118 unsigned int v29; // eax@127 | 15107 //unsigned int v29; // eax@127 |
15119 AIDirection *v30; // eax@129 | 15108 AIDirection *v30; // eax@129 |
15120 unsigned __int16 v31; // ax@132 | 15109 unsigned __int16 v31; // ax@132 |
15121 //unsigned int v32; // esi@142 | 15110 //unsigned int v32; // esi@142 |
15122 int v33; // eax@144 | 15111 int v33; // eax@144 |
15123 int v34; // eax@147 | 15112 int v34; // eax@147 |
15290 } | 15279 } |
15291 ++v13; | 15280 ++v13; |
15292 ++v14; | 15281 ++v14; |
15293 } | 15282 } |
15294 while ( v13 < 22 );*/ | 15283 while ( v13 < 22 );*/ |
15295 if ( actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | 15284 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 | 15285 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 |
15297 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | 15286 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) |
15298 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; | 15287 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; |
15299 if ( actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | 15288 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
15300 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15289 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15301 // not sure | 15290 // not sure |
15302 else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | 15291 else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) |
15303 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; | 15292 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; |
15304 | 15293 |
15305 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) | 15294 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 |
15295 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) | |
15306 continue; | 15296 continue; |
15307 | 15297 |
15308 //v15 = pMiscTimer->uTimeElapsed; | 15298 //v15 = pMiscTimer->uTimeElapsed; |
15309 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | 15299 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; |
15310 //v17 = pActor->uCurrentActionTime; | 15300 //v17 = pActor->uCurrentActionTime; |
15371 { | 15361 { |
15372 continue; | 15362 continue; |
15373 } | 15363 } |
15374 if ( !v21->sCurrentHP ) | 15364 if ( !v21->sCurrentHP ) |
15375 Actor::Die(actor_id); | 15365 Actor::Die(actor_id); |
15376 v25 = 0; | 15366 for(int i=0;i<22;i++) |
15377 v26 = v21->pActorBuffs; | |
15378 do | |
15379 { | 15367 { |
15380 if ( v25 != 10 ) | 15368 if ( i != 10 ) |
15381 { | 15369 { |
15382 v26->_4585CA(pParty->uTimePlayed); | 15370 v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); |
15383 //v24 = 0; | |
15384 } | 15371 } |
15385 ++v25; | |
15386 ++v26; | |
15387 } | 15372 } |
15388 while ( v25 < 22 ); | 15373 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) |
15389 if ( v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | |
15390 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | 15374 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; |
15391 if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | 15375 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
15392 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15376 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15393 // not sure | 15377 // not sure |
15394 else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | 15378 else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) |
15395 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | 15379 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; |
15396 if ( v21->pActorBuffs[2].uExpireTime < 0 ) | 15380 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) |
15397 { | 15381 { |
15398 v21->uAIState = Removed; | 15382 v21->uAIState = Removed; |
15399 continue; | 15383 continue; |
15400 } | 15384 } |
15401 if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) | 15385 if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 |
15386 || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) | |
15402 { | 15387 { |
15403 continue; | 15388 continue; |
15404 } | 15389 } |
15405 v27 = pMiscTimer->uTimeElapsed; | 15390 v27 = pMiscTimer->uTimeElapsed; |
15406 v28 = v21->pMonsterInfo.uRecoveryTime; | 15391 v28 = v21->pMonsterInfo.uRecoveryTime; |
15407 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15392 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
15408 if ( (signed int)v28 > 0 ) | 15393 if ( (signed int)v28 > 0 ) |
15409 v21->pMonsterInfo.uRecoveryTime = v28 - v27; | 15394 v21->pMonsterInfo.uRecoveryTime = v28 - v27; |
15410 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) | 15395 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) |
15411 v21->pMonsterInfo.uRecoveryTime = 0; | 15396 v21->pMonsterInfo.uRecoveryTime = 0; |
15412 v29 = v21->uAttributes; | 15397 if ( !(v21->uAttributes & 0x8000) ) |
15413 if ( !(v29 & 0x8000) ) | 15398 v21->uAttributes |= 0x8000; |
15414 v21->uAttributes = v29 | 0x8000; | |
15415 a1 = 8 * actor_id | OBJECT_Actor; | 15399 a1 = 8 * actor_id | OBJECT_Actor; |
15416 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, actor_pid, &a3, 0); | 15400 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, actor_pid, &a3, 0); |
15417 memcpy(&v75, v30, sizeof(v75)); | 15401 memcpy(&v75, v30, sizeof(v75)); |
15418 memcpy(&pDir, &v75, sizeof(pDir)); | 15402 memcpy(&pDir, &v75, sizeof(pDir)); |
15419 uAIState = v21->uAIState; | 15403 uAIState = v21->uAIState; |