Mercurial > mm7
comparison mm7_3.cpp @ 872:2db21a810d48
Merge
author | Nomad |
---|---|
date | Mon, 01 Apr 2013 13:39:39 +0200 |
parents | 710cf848ad24 a0ae8d36c2d6 |
children | 726f9c2ff381 84c8119c366a |
comparison
equal
deleted
inserted
replaced
871:710cf848ad24 | 872:2db21a810d48 |
---|---|
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 unsigned int v39; // edi@71 |
904 BSPModel *v40; // eax@75 | 904 BSPModel *v40; // eax@75 |
905 ODMFace *v41; // edi@75 | 905 ODMFace *v41; // edi@75 |
906 int v42; // ebx@76 | 906 int v42; // ebx@76 |
907 int v43; // ecx@77 | 907 int v43; // ecx@77 |
908 int v44; // edx@77 | 908 int v44; // edx@77 |
911 signed int v47; // ebx@85 | 911 signed int v47; // ebx@85 |
912 int v48; // edi@85 | 912 int v48; // edi@85 |
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; |
1123 _46E889_collide_against_bmodels(1u); | 1112 _46E889_collide_against_bmodels(1u); |
1124 v29 = WorldPosToGridCellZ(v0->vPosition.y); | 1113 v29 = WorldPosToGridCellZ(v0->vPosition.y); |
1125 v30 = WorldPosToGridCellX(v0->vPosition.x); | 1114 v30 = WorldPosToGridCellX(v0->vPosition.x); |
1126 _46E26D_collide_against_sprites(v30, v29); | 1115 _46E26D_collide_against_sprites(v30, v29); |
1127 _46EF01_collision_chech_player(0); | 1116 _46EF01_collision_chech_player(0); |
1128 _46ED8A_collide_against_sprite_objects(8 * v75 | OBJECT_Actor); | 1117 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75)); |
1129 v31 = 0; | 1118 v31 = 0; |
1130 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | 1119 for ( i = 0; v31 < ai_arrays_size; ++v31 ) |
1131 { | 1120 { |
1132 v33 = ai_near_actors_ids[v31]; | 1121 v33 = ai_near_actors_ids[v31]; |
1133 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) | 1122 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) |
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 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled ) |
1154 if ( v37 == 5 || v37 == 4 || v37 == 11 || v37 == 19 ) | |
1155 { | 1143 { |
1156 if ( v64 ) | 1144 if ( v64 ) |
1157 v61 = v36 + 30; | 1145 v61 = v36 + 30; |
1158 else | 1146 else |
1159 v61 = v68 + 60; | 1147 v61 = v5 + 60; |
1160 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); | 1148 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); |
1161 v0->uAIState = Removed; | 1149 v0->uAIState = Removed; |
1162 return; | 1150 return; |
1163 } | 1151 } |
1164 } | 1152 } |
1168 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | 1156 v0->vPosition.x = LOWORD(stru_721530.normal2.x); |
1169 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | 1157 v0->vPosition.y = LOWORD(stru_721530.normal2.y); |
1170 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | 1158 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; |
1171 break; | 1159 break; |
1172 } | 1160 } |
1173 v72 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | 1161 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; | 1162 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; | 1163 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; | 1164 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; | 1165 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1178 v38 = stru_721530.uFaceID; | 1166 v38 = stru_721530.uFaceID; |
1179 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; | 1167 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; |
1180 stru_721530.field_70 += stru_721530.field_7C; | 1168 stru_721530.field_70 += stru_721530.field_7C; |
1181 v39 = v38 >> 3; | 1169 v39 = PID_ID(v38); |
1182 switch ( v38 & 7 ) | 1170 switch ( PID_TYPE(v38) ) |
1183 { | 1171 { |
1184 case 3: | 1172 case OBJECT_Actor: |
1185 if ( pParty->bTurnBasedModeOn != 1 ) | 1173 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 { | 1174 { |
1189 v34 = 0; | 1175 //if(pParty->bTurnBasedModeOn == 1) |
1190 LABEL_97: | 1176 //v34 = 0; |
1191 if ( v0->pMonsterInfo.uHostilityType ) | 1177 if ( v0->pMonsterInfo.uHostilityType ) |
1192 { | 1178 { |
1193 if ( v71 == v34 ) | 1179 if ( v71 == 0 ) |
1194 goto LABEL_99; | 1180 { |
1195 LABEL_101: | 1181 Actor::Flee(v75, v38, 0, (AIDirection *)0); |
1196 Actor::AI_StandOrBored(v75, 4, v34, (AIDirection *)v34); | 1182 } |
1197 break; | 1183 else |
1184 { | |
1185 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1186 } | |
1198 } | 1187 } |
1199 if ( v71 != v34 ) | 1188 else if ( v71 != 0 ) |
1200 goto LABEL_101; | 1189 { |
1201 if ( pActors[v39].pMonsterInfo.uHostilityType ) | 1190 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); |
1191 } | |
1192 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | |
1202 { | 1193 { |
1203 LABEL_99: | 1194 Actor::Flee(v75, v38, 0, (AIDirection *)0); |
1204 Actor::_402968(v75, v38, v34, (AIDirection *)v34); | |
1205 break; | |
1206 } | 1195 } |
1207 LABEL_103: | 1196 else |
1208 Actor::FaceObject(v75, v38, v34, (AIDirection *)v34); | 1197 { |
1209 break; | 1198 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); |
1199 } | |
1210 } | 1200 } |
1211 break; | 1201 break; |
1212 case 4: | 1202 case OBJECT_Player: |
1213 if ( !v0->GetActorsRelation(0) ) | 1203 if ( !v0->GetActorsRelation(0) ) |
1214 { | 1204 { |
1215 v38 = stru_721530.uFaceID; | 1205 v38 = stru_721530.uFaceID; |
1216 goto LABEL_103; | 1206 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); |
1207 break; | |
1217 } | 1208 } |
1218 v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; | 1209 //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; |
1219 v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; | 1210 //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; |
1220 v0->vVelocity.y = 0; | 1211 v0->vVelocity.y = 0; |
1221 v0->vVelocity.x = 0; | 1212 v0->vVelocity.x = 0; |
1222 if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) | 1213 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) |
1214 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime < 0) | |
1223 pParty->pPartyBuffs[11].Reset(); | 1215 pParty->pPartyBuffs[11].Reset(); |
1224 viewparams->bRedrawGameUI = 1; | 1216 viewparams->bRedrawGameUI = 1; |
1225 break; | 1217 break; |
1226 case 5: | 1218 case OBJECT_Decoration: |
1227 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); | 1219 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
1228 v48 = stru_5C6E00->Atan2( | 1220 v48 = stru_5C6E00->Atan2( |
1229 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, | 1221 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, |
1230 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); | 1222 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); |
1231 v71 = stru_5C6E00->Cos(v48); | 1223 v71 = stru_5C6E00->Cos(v48); |
1236 v71 = v50; | 1228 v71 = v50; |
1237 v51 = v50 * (signed __int64)v47; | 1229 v51 = v50 * (signed __int64)v47; |
1238 v70 = v51 >> 16; | 1230 v70 = v51 >> 16; |
1239 v0->vVelocity.y = WORD1(v51); | 1231 v0->vVelocity.y = WORD1(v51); |
1240 break; | 1232 break; |
1241 case 6: | 1233 case OBJECT_BModel: |
1242 v40 = &pOutdoor->pBModels[v38 >> 9]; | 1234 v40 = &pOutdoor->pBModels[v38 >> 9]; |
1243 v41 = &v40->pFaces[v39 & 0x3F]; | 1235 v41 = &v40->pFaces[v39 & 0x3F]; |
1244 if ( !(BYTE3(v41->uAttributes) & 0x20) ) | 1236 if ( !(BYTE3(v41->uAttributes) & 0x20) ) |
1245 { | 1237 { |
1246 v42 = v41->uPolygonType; | 1238 v42 = v41->uPolygonType; |
1256 v0->vVelocity.x = 0; | 1248 v0->vVelocity.x = 0; |
1257 } | 1249 } |
1258 } | 1250 } |
1259 else | 1251 else |
1260 { | 1252 { |
1261 v72 = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z | 1253 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; | 1254 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; |
1263 if ( stru_721530.field_64 >> 3 > v72 ) | 1255 if ( stru_721530.field_64 >> 3 > v72b ) |
1264 v72 = stru_721530.field_64 >> 3; | 1256 v72b = stru_721530.field_64 >> 3; |
1265 v73 = v41->pFacePlane.vNormal.x; | 1257 v73 = v41->pFacePlane.vNormal.x; |
1266 v73 = (unsigned __int64)(v72 * (signed __int64)v73) >> 16; | 1258 v73 = (unsigned __int64)(v72b * (signed __int64)v73) >> 16; |
1267 v71 = v41->pFacePlane.vNormal.y; | 1259 v71 = v41->pFacePlane.vNormal.y; |
1268 v71 = (unsigned __int64)(v72 * (signed __int64)v71) >> 16; | 1260 v71 = (unsigned __int64)(v72b * (signed __int64)v71) >> 16; |
1269 v70 = v41->pFacePlane.vNormal.z; | 1261 v70 = v41->pFacePlane.vNormal.z; |
1270 v70 = (unsigned __int64)(v72 * (signed __int64)(signed int)v70) >> 16; | 1262 v70 = (unsigned __int64)(v72b * (signed __int64)(signed int)v70) >> 16; |
1271 v0->vVelocity.x += v73; | 1263 v0->vVelocity.x += v73; |
1272 v0->vVelocity.y += v71; | 1264 v0->vVelocity.y += v71; |
1273 v0->vVelocity.z += v70; | 1265 v0->vVelocity.z += v70; |
1274 if ( v42 != 4 ) | 1266 if ( v42 != 4 ) |
1275 { | 1267 { |
1300 v71 = 58500; | 1292 v71 = 58500; |
1301 v0->vVelocity.y = v70; | 1293 v0->vVelocity.y = v70; |
1302 v70 = v0->vVelocity.z; | 1294 v70 = v0->vVelocity.z; |
1303 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; | 1295 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; |
1304 ++v69; | 1296 ++v69; |
1305 v54 = v69 < 100; | 1297 //v54 = v69 < 100; |
1306 v10 = (v69 - 100) < 0; | 1298 //v10 = (v69 - 100) < 0; |
1307 v0->vVelocity.z = v70; | 1299 v0->vVelocity.z = v70; |
1308 if ( !(v10 ^ v54) ) | 1300 if ( v69 >= 100 ) |
1309 break; | 1301 break; |
1310 v26 = stru_721530.prolly_normal_d; | 1302 v26 = stru_721530.prolly_normal_d; |
1311 } | 1303 } |
1312 v69 = WorldPosToGridCellX(v66); | 1304 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1; |
1313 v55 = WorldPosToGridCellZ(v65); | 1305 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1; |
1314 v56 = v55 - 1; | 1306 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x) |
1315 v57 = v0->vPosition.x; | 1307 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y) |
1316 v71 = v55 - 1; | 1308 && v58 |
1317 v68 = WorldPosToGridCellX(v57); | 1309 || 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 { | 1310 { |
1328 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | 1311 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
1329 { | 1312 { |
1330 v58 = v58 == 0; | 1313 v58 = v58 == 0; |
1331 v59 = v59 == 0; | 1314 v59 = v59 == 0; |
1332 } | 1315 } |
1333 if ( !v74 && v58 && !v59 ) | 1316 if ( !uIsFlying && v58 && !v59 ) |
1334 { | 1317 { |
1335 v0->vPosition.x = v66; | 1318 v0->vPosition.x = v66; |
1336 v0->vPosition.y = v65; | 1319 v0->vPosition.y = v65; |
1337 if ( v0->CanAct() ) | 1320 if ( v0->CanAct() ) |
1338 { | 1321 { |
1341 v0->uCurrentActionLength = 128; | 1324 v0->uCurrentActionLength = 128; |
1342 v0->uAIState = Fleeing; | 1325 v0->uAIState = Fleeing; |
1343 } | 1326 } |
1344 } | 1327 } |
1345 } | 1328 } |
1346 LABEL_121: | 1329 } |
1347 ++v75; | |
1348 } | |
1349 while ( (signed int)v75 < (signed int)uNumActors ); | |
1350 } | 1330 } |
1351 | 1331 |
1352 //----- (0047253E) -------------------------------------------------------- | 1332 //----- (0047253E) -------------------------------------------------------- |
1353 void UpdateObjects() | 1333 void UpdateObjects() |
1354 { | 1334 { |
1389 { | 1369 { |
1390 //v3 = item->uObjectDescID; | 1370 //v3 = item->uObjectDescID; |
1391 v4 = &pObjectList->pObjects[item->uObjectDescID]; | 1371 v4 = &pObjectList->pObjects[item->uObjectDescID]; |
1392 if (item->AttachedToActor()) | 1372 if (item->AttachedToActor()) |
1393 { | 1373 { |
1394 v5 = item->spell_target_pid >> 3; | 1374 v5 = PID_ID(item->spell_target_pid); |
1395 *(int *)(v2 - 26) = pActors[v5].vPosition.x; | 1375 *(int *)(v2 - 26) = pActors[v5].vPosition.x; |
1396 *(int *)(v2 - 22) = pActors[v5].vPosition.y; | 1376 *(int *)(v2 - 22) = pActors[v5].vPosition.y; |
1397 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | 1377 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; |
1398 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) | 1378 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) |
1399 goto LABEL_36; | 1379 goto LABEL_36; |
1465 goto LABEL_35; | 1445 goto LABEL_35; |
1466 } | 1446 } |
1467 v10 = i; | 1447 v10 = i; |
1468 if ( !(v9 & 0x40) ) | 1448 if ( !(v9 & 0x40) ) |
1469 goto LABEL_35; | 1449 goto LABEL_35; |
1470 _46BFFA_check_object_intercept(i, 8 * i | OBJECT_Item); | 1450 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); |
1471 } | 1451 } |
1472 } | 1452 } |
1473 LABEL_36: | 1453 LABEL_36: |
1474 ; | 1454 ; |
1475 //v2 += 112; | 1455 //v2 += 112; |
1932 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | 1912 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; |
1933 v43 = stru_721530.uFaceID; | 1913 v43 = stru_721530.uFaceID; |
1934 uSectorID = stru_721530.uSectorID; | 1914 uSectorID = stru_721530.uSectorID; |
1935 stru_721530.field_70 += stru_721530.field_7C; | 1915 stru_721530.field_70 += stru_721530.field_7C; |
1936 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; | 1916 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; |
1937 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) | 1917 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
1938 { | 1918 { |
1939 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 | 1919 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 |
1940 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) | 1920 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) |
1941 pParty->pPartyBuffs[11].Reset(); | 1921 pParty->pPartyBuffs[11].Reset(); |
1942 viewparams->bRedrawGameUI = 1; | 1922 viewparams->bRedrawGameUI = 1; |
1943 goto LABEL_152; | 1923 goto LABEL_152; |
1944 } | 1924 } |
1945 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) | 1925 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
1946 { | 1926 { |
1947 v53 = integer_sqrt(v2 * v2 + v1 * v1); | 1927 v53 = integer_sqrt(v2 * v2 + v1 * v1); |
1948 v80 = v53; | 1928 v80 = v53; |
1949 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, | 1929 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, |
1950 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); | 1930 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); |
1952 v55 = stru_5C6E00->Sin(v54); | 1932 v55 = stru_5C6E00->Sin(v54); |
1953 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; | 1933 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; |
1954 } | 1934 } |
1955 else | 1935 else |
1956 { | 1936 { |
1957 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) | 1937 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
1958 { | 1938 { |
1959 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; | 1939 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; |
1960 v45 = v44->uPolygonType; | 1940 v45 = v44->uPolygonType; |
1961 if ( v45 == 3 ) | 1941 if ( v45 == 3 ) |
1962 { | 1942 { |
2361 { | 2341 { |
2362 v7 = pOutdoor->pBModels[v108 >> 6].pFaces; | 2342 v7 = pOutdoor->pBModels[v108 >> 6].pFaces; |
2363 v6 = v108 & 0x3F; | 2343 v6 = v108 & 0x3F; |
2364 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) | 2344 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) |
2365 { | 2345 { |
2366 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; | 2346 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108); |
2367 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); | 2347 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); |
2368 }*/ | 2348 }*/ |
2369 if ( BYTE3(v7[v6].uAttributes) & 4 ) | 2349 if ( BYTE3(v7[v6].uAttributes) & 4 ) |
2370 { | 2350 { |
2371 pParty->floor_face_pid = PID(OBJECT_BModel, v108); | 2351 pParty->floor_face_pid = PID(OBJECT_BModel, v108); |
2856 stru_721530.field_70 += stru_721530.field_7C; | 2836 stru_721530.field_70 += stru_721530.field_7C; |
2857 pX = _angle_x; | 2837 pX = _angle_x; |
2858 pY = _angle_y; | 2838 pY = _angle_y; |
2859 v45 = stru_721530.uFaceID; | 2839 v45 = stru_721530.uFaceID; |
2860 pZ = v40; | 2840 pZ = v40; |
2861 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) | 2841 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
2862 { | 2842 { |
2863 if (pParty->Invisible()) | 2843 if (pParty->Invisible()) |
2864 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 2844 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
2865 | 2845 |
2866 viewparams->bRedrawGameUI = 1; | 2846 viewparams->bRedrawGameUI = 1; |
2867 goto LABEL_234; | 2847 goto LABEL_234; |
2868 } | 2848 } |
2869 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) | 2849 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
2870 { | 2850 { |
2871 v56 = integer_sqrt(v2 * v2 + v128 * v128); | 2851 v56 = integer_sqrt(v2 * v2 + v128 * v128); |
2872 v118 = v56; | 2852 v118 = v56; |
2873 v57 = stru_5C6E00->Atan2( | 2853 v57 = stru_5C6E00->Atan2( |
2874 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, | 2854 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, |
2885 v122 = v61 >> 16; | 2865 v122 = v61 >> 16; |
2886 v128 = v61 >> 16; | 2866 v128 = v61 >> 16; |
2887 } | 2867 } |
2888 else | 2868 else |
2889 { | 2869 { |
2890 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) | 2870 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
2891 { | 2871 { |
2892 pParty->bFlying = 0; | 2872 pParty->bFlying = 0; |
2893 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | 2873 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; |
2894 v127 = v46; | 2874 v127 = v46; |
2895 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; | 2875 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; |
4786 v31->std__vector_000004_size = 0; | 4766 v31->std__vector_000004_size = 0; |
4787 LOBYTE(v31) = 0; | 4767 LOBYTE(v31) = 0; |
4788 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 4768 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
4789 { | 4769 { |
4790 v31 = (LightmapBuilder *)(v50 ? 3 : v49 != 0 ? 5 : 0); | 4770 v31 = (LightmapBuilder *)(v50 ? 3 : v49 != 0 ? 5 : 0); |
4791 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, (BSPVertexBuffer *)v56 - 1); | 4771 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices); |
4792 if ( pDecalBuilder->uNumDecals > 0 ) | 4772 if ( pDecalBuilder->uNumDecals > 0 ) |
4793 { | 4773 { |
4794 v40 = -1; | 4774 v40 = -1; |
4795 v39 = v31; | 4775 v39 = v31; |
4796 v38 = 0; | 4776 v38 = 0; |
6033 | 6013 |
6034 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; | 6014 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; |
6035 array_50AC10[1].vWorldViewProjY = v38; | 6015 array_50AC10[1].vWorldViewProjY = v38; |
6036 | 6016 |
6037 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; | 6017 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; |
6038 array_50AC10[2].vWorldViewProjY = pViewport->uViewportTL_Y; | 6018 array_50AC10[2].vWorldViewProjY = v38; |
6039 | 6019 |
6040 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; | 6020 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; |
6041 array_50AC10[3].vWorldViewProjY = v38; | 6021 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; |
6042 | 6022 |
6043 /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; | 6023 v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; |
6044 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); | 6024 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); |
6045 | 6025 |
6046 for (int i = 0; i < _this.uNumVertices; ++i) | 6026 for (int i = 0; i < _this.uNumVertices; ++i) |
6047 { | 6027 { |
6048 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); | 6028 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); |
6058 if ( _this.v_18.x + v9 > 0 ) | 6038 if ( _this.v_18.x + v9 > 0 ) |
6059 { | 6039 { |
6060 v10 = 0; | 6040 v10 = 0; |
6061 v39 = 0; | 6041 v39 = 0; |
6062 } | 6042 } |
6063 v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; | 6043 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; |
6064 v38 = v10; | 6044 v38 = v10; |
6065 v12 = array_50AC10[i].vWorldViewProjY - 1.0; | 6045 v12 = array_50AC10[i].vWorldViewProjY - 1.0; |
6066 v13 = v33 * (pViewport->uScreenCenterX - v11); | 6046 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); |
6067 v34 = -_this.field_24; | 6047 v34 = -_this.field_24; |
6068 v32 = (signed __int64)v12; | 6048 v32 = (signed __int64)v12; |
6069 v14 = v33 * (v30 - v32); | 6049 v14 = v33 * (v30 - v32); |
6070 while ( 1 ) | 6050 while ( 1 ) |
6071 { | 6051 { |
6081 v38 = _this.v_18.x + v16; | 6061 v38 = _this.v_18.x + v16; |
6082 break; | 6062 break; |
6083 } | 6063 } |
6084 v37 = abs(v34 >> 14); | 6064 v37 = abs(v34 >> 14); |
6085 v15 = abs(v10); | 6065 v15 = abs(v10); |
6086 if ( v37 <= v15 || v32 <= pViewport->uViewportY ) | 6066 if ( v37 <= v15 || v32 <= pViewport->uViewportTL_Y ) |
6087 { | 6067 { |
6088 if ( v39 <= 0 ) | 6068 if ( v39 <= 0 ) |
6089 break; | 6069 break; |
6090 } | 6070 } |
6091 //v14 = v40; | 6071 //v14 = v40; |
6104 if ( v18 < 0 ) | 6084 if ( v18 < 0 ) |
6105 v18 = pOutdoorCamera->shading_dist_mist; | 6085 v18 = pOutdoorCamera->shading_dist_mist; |
6106 | 6086 |
6107 v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); | 6087 v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); |
6108 v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); | 6088 v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); |
6109 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8; | 6089 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; |
6110 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8; | 6090 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; |
6111 */ | 6091 |
6112 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | 6092 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; |
6113 //array_50AC10[i]._rhw = 1; | 6093 //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); |
6114 //array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); | 6094 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); |
6115 //array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); | 6095 //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); |
6116 //} | 6096 array_50AC10[i]._rhw = 1.0;// / (pOutdoorCamera->shading_dist_mist >> 16); |
6117 if ( _this.uNumVertices > 0) | 6097 //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth); |
6118 { | 6098 //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight); |
6119 float t = (GetTickCount() % 96000) / 96000.0f; | 6099 float t = (GetTickCount() % 96000) / 96000.0f; |
6120 | 6100 array_50AC10[i].u += t; |
6121 array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | 6101 array_50AC10[i].v += t; |
6122 array_50AC10[0]._rhw = 1; | 6102 if ( i == _this.uNumVertices - 1 ) |
6123 array_50AC10[0].u = 0; | 6103 { |
6124 array_50AC10[0].v = 0 + t; | 6104 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); |
6125 | 6105 |
6126 array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | 6106 array_50AC10[0].vWorldViewProjY = v38; |
6127 array_50AC10[1]._rhw = 1; | 6107 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; |
6128 array_50AC10[1].u = 0; | 6108 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; |
6129 array_50AC10[1].v = 1 + t; | 6109 array_50AC10[3].vWorldViewProjY = v38; |
6130 | 6110 |
6131 array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | 6111 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); |
6132 array_50AC10[2]._rhw = 1; | |
6133 array_50AC10[2].u = 1; | |
6134 array_50AC10[2].v = 0 + t; | |
6135 | |
6136 array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | |
6137 array_50AC10[3]._rhw = 1; | |
6138 array_50AC10[3].u = 1; | |
6139 array_50AC10[3].v = 1 + t; | |
6140 pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); | |
6141 return; | 6112 return; |
6142 //} | 6113 } |
6143 } | 6114 } |
6144 } | 6115 } |
6145 | 6116 |
6146 //----- (00479A53) -------------------------------------------------------- | 6117 //----- (00479A53) -------------------------------------------------------- |
6147 void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID) | 6118 void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID) |
6252 } | 6223 } |
6253 while ( !v44 ); | 6224 while ( !v44 ); |
6254 uFaceID = v65; | 6225 uFaceID = v65; |
6255 } | 6226 } |
6256 v56 = 8 * uFaceID; | 6227 v56 = 8 * uFaceID; |
6257 LOBYTE(v56) = 8 * uFaceID | 6; | 6228 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); |
6258 v57 = v56; | 6229 v57 = v56; |
6259 v58 = pFace->GetTexture(); | 6230 v58 = pFace->GetTexture(); |
6260 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); | 6231 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); |
6261 return; | 6232 return; |
6262 } | 6233 } |
11179 v15->world_y = a2; | 11150 v15->world_y = a2; |
11180 v15->world_z = a3; | 11151 v15->world_z = a3; |
11181 v15->uScreenSpaceX = a5; | 11152 v15->uScreenSpaceX = a5; |
11182 v15->uScreenSpaceY = a6; | 11153 v15->uScreenSpaceY = a6; |
11183 //v23 = 8 * uDecorationID; | 11154 //v23 = 8 * uDecorationID; |
11184 //LOBYTE(v23) = 8 * uDecorationID | OBJECT_Decoration; | 11155 //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID); |
11185 | 11156 |
11186 //v15->sZValue = v22 + v23; | 11157 //v15->sZValue = v22 + v23; |
11187 v15->actual_z = HIWORD(x); | 11158 v15->actual_z = HIWORD(x); |
11188 v15->object_pid = 8 * uDecorationID | OBJECT_Decoration; | 11159 v15->object_pid = PID(OBJECT_Decoration,uDecorationID); |
11189 | 11160 |
11190 v15->uTintColor = 0; | 11161 v15->uTintColor = 0; |
11191 v15->pSpriteFrame = v12; | 11162 v15->pSpriteFrame = v12; |
11192 } | 11163 } |
11193 } | 11164 } |
11336 v3->uScreenSpaceX = v36; | 11307 v3->uScreenSpaceX = v36; |
11337 v22 = v35; | 11308 v22 = v35; |
11338 v3->uTintColor = 0; | 11309 v3->uTintColor = 0; |
11339 v3->uScreenSpaceY = v22; | 11310 v3->uScreenSpaceY = v22; |
11340 //v23 = 8 * i; | 11311 //v23 = 8 * i; |
11341 //LOBYTE(v23) = 8 * i | OBJECT_Item; | 11312 //LOBYTE(v23) = PID(OBJECT_Item,i); |
11342 v3->pSpriteFrame = v24; | 11313 v3->pSpriteFrame = v24; |
11343 //v12 = (p->uAttributes & 0x20) == 0; | 11314 //v12 = (p->uAttributes & 0x20) == 0; |
11344 //v3->sZValue = v21 + v23; | 11315 //v3->sZValue = v21 + v23; |
11345 v3->actual_z = HIWORD(x); | 11316 v3->actual_z = HIWORD(x); |
11346 v3->object_pid = 8 * i | OBJECT_Item; | 11317 v3->object_pid = PID(OBJECT_Item,i); |
11347 if (p->uAttributes & 0x20) | 11318 if (p->uAttributes & 0x20) |
11348 { | 11319 { |
11349 if ( !pRenderer->pRenderD3D ) | 11320 if ( !pRenderer->pRenderD3D ) |
11350 v3->sZValue = 0; | 11321 v3->sZValue = 0; |
11351 } | 11322 } |
12815 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || | 12786 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || |
12816 pActors[i].uAIState == Disabled) | 12787 pActors[i].uAIState == Disabled) |
12817 ++num_dead_actors; | 12788 ++num_dead_actors; |
12818 else | 12789 else |
12819 { | 12790 { |
12820 int sumonner_type = pActors[i].uSummonerID & 7;; | 12791 int sumonner_type = PID_TYPE(pActors[i].uSummonerID); |
12821 if (sumonner_type == OBJECT_Player) | 12792 if (sumonner_type == OBJECT_Player) |
12822 ++num_dead_actors; | 12793 ++num_dead_actors; |
12823 } | 12794 } |
12824 } | 12795 } |
12825 if (num_dead_actors == uNumActors) | 12796 if (num_dead_actors == uNumActors) |
14998 v19 = 0; | 14969 v19 = 0; |
14999 for ( i = 0; v18 < v45; i = v18 ) | 14970 for ( i = 0; v18 < v45; i = v18 ) |
15000 { | 14971 { |
15001 v20 = &pActors[ai_near_actors_ids[v18]]; | 14972 v20 = &pActors[ai_near_actors_ids[v18]]; |
15002 if ( v20->uAttributes & 0x8000 | 14973 if ( v20->uAttributes & 0x8000 |
15003 || (v21 = sub_4070EF_prolly_collide_objects(8 * ai_near_actors_ids[v18] | 3, 4u), v18 = i, v21) ) | 14974 || (v21 = sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) |
15004 { | 14975 { |
15005 v22 = ai_near_actors_ids[v18]; | 14976 v22 = ai_near_actors_ids[v18]; |
15006 v20->uAttributes |= 0x8000u; | 14977 v20->uAttributes |= 0x8000u; |
15007 ai_array_4F6638_actor_ids[v19] = v22; | 14978 ai_array_4F6638_actor_ids[v19] = v22; |
15008 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; | 14979 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; |
15119 //int *v20; // esi@80 | 15090 //int *v20; // esi@80 |
15120 Actor *v21; // ebx@80 | 15091 Actor *v21; // ebx@80 |
15121 unsigned __int16 v22; // ax@86 | 15092 unsigned __int16 v22; // ax@86 |
15122 //signed int v23; // eax@94 | 15093 //signed int v23; // eax@94 |
15123 //unsigned int v24; // eax@102 | 15094 //unsigned int v24; // eax@102 |
15124 signed int v25; // edi@102 | 15095 //signed int v25; // edi@102 |
15125 SpellBuff *v26; // esi@102 | 15096 //SpellBuff *v26; // esi@102 |
15126 unsigned int v27; // ecx@123 | 15097 unsigned int v27; // ecx@123 |
15127 unsigned int v28; // eax@123 | 15098 unsigned int v28; // eax@123 |
15128 unsigned int v29; // eax@127 | 15099 //unsigned int v29; // eax@127 |
15129 AIDirection *v30; // eax@129 | 15100 AIDirection *v30; // eax@129 |
15130 unsigned __int16 v31; // ax@132 | 15101 unsigned __int16 v31; // ax@132 |
15131 unsigned int v32; // esi@142 | 15102 //unsigned int v32; // esi@142 |
15132 int v33; // eax@144 | 15103 int v33; // eax@144 |
15133 int v34; // eax@147 | 15104 int v34; // eax@147 |
15134 char v35; // al@150 | 15105 char v35; // al@150 |
15135 unsigned int v36; // edi@152 | 15106 unsigned int v36; // edi@152 |
15136 signed int v37; // eax@154 | 15107 signed int v37; // eax@154 |
15137 unsigned __int8 v38; // sf@158 | 15108 //unsigned __int8 v38; // sf@158 |
15138 unsigned __int8 v39; // of@158 | 15109 //unsigned __int8 v39; // of@158 |
15139 signed int v40; // edx@166 | 15110 //signed int v40; // edx@166 |
15140 unsigned int v41; // ecx@166 | 15111 //unsigned int v41; // ecx@166 |
15141 double v42; // st7@176 | 15112 double v42; // st7@176 |
15142 double v43; // st6@176 | 15113 double v43; // st6@176 |
15143 bool v44; // eax@189 | 15114 //bool v44; // eax@189 |
15144 bool v45; // eax@192 | 15115 bool v45; // eax@192 |
15145 unsigned __int8 v46; // cl@197 | 15116 unsigned __int8 v46; // cl@197 |
15146 double v47; // st7@206 | 15117 double v47; // st7@206 |
15147 double v48; // st7@207 | 15118 double v48; // st7@207 |
15148 char v49; // zf@208 | 15119 //char v49; // zf@208 |
15149 char v50; // zf@214 | 15120 //char v50; // zf@214 |
15150 signed int v51; // edx@219 | 15121 //signed int v51; // edx@219 |
15151 unsigned int v52; // ecx@219 | 15122 //unsigned int v52; // ecx@219 |
15152 __int16 v53; // fps@224 | 15123 __int16 v53; // fps@224 |
15153 unsigned __int8 v54; // c0@224 | 15124 //unsigned __int8 v54; // c0@224 |
15154 unsigned __int8 v55; // c3@224 | 15125 //unsigned __int8 v55; // c3@224 |
15155 double v56; // st7@226 | 15126 double v56; // st7@226 |
15156 AIDirection *v57; // eax@246 | 15127 AIDirection *v57; // eax@246 |
15157 double v58; // st7@246 | 15128 double v58; // st7@246 |
15158 signed int v59; // [sp-18h] [bp-C8h]@213 | 15129 //signed int v59; // [sp-18h] [bp-C8h]@213 |
15159 int v60; // [sp-14h] [bp-C4h]@144 | 15130 //int v60; // [sp-14h] [bp-C4h]@144 |
15160 int v61; // [sp-14h] [bp-C4h]@168 | 15131 //int v61; // [sp-14h] [bp-C4h]@168 |
15161 AIDirection *v62; // [sp-14h] [bp-C4h]@213 | 15132 //AIDirection *v62; // [sp-14h] [bp-C4h]@213 |
15162 signed int v63; // [sp-14h] [bp-C4h]@216 | 15133 //signed int v63; // [sp-14h] [bp-C4h]@216 |
15163 unsigned int v64; // [sp-14h] [bp-C4h]@219 | 15134 unsigned int v64; // [sp-14h] [bp-C4h]@219 |
15164 unsigned int v65; // [sp-10h] [bp-C0h]@144 | 15135 unsigned int v65; // [sp-10h] [bp-C0h]@144 |
15165 char v66; // [sp-10h] [bp-C0h]@147 | 15136 char v66; // [sp-10h] [bp-C0h]@147 |
15166 AIDirection *v67; // [sp-10h] [bp-C0h]@167 | 15137 //AIDirection *v67; // [sp-10h] [bp-C0h]@167 |
15167 int v68; // [sp-10h] [bp-C0h]@168 | 15138 //int v68; // [sp-10h] [bp-C0h]@168 |
15168 AIDirection *v69; // [sp-10h] [bp-C0h]@206 | 15139 //AIDirection *v69; // [sp-10h] [bp-C0h]@206 |
15169 int v70; // [sp-10h] [bp-C0h]@213 | 15140 int v70; // [sp-10h] [bp-C0h]@213 |
15170 AIDirection *v71; // [sp-10h] [bp-C0h]@216 | 15141 //AIDirection *v71; // [sp-10h] [bp-C0h]@216 |
15171 AIDirection v72; // [sp+0h] [bp-B0h]@246 | 15142 AIDirection v72; // [sp+0h] [bp-B0h]@246 |
15172 AIDirection a3; // [sp+1Ch] [bp-94h]@129 | 15143 AIDirection a3; // [sp+1Ch] [bp-94h]@129 |
15173 AIDirection v74; // [sp+38h] [bp-78h]@246 | 15144 AIDirection v74; // [sp+38h] [bp-78h]@246 |
15174 AIDirection v75; // [sp+54h] [bp-5Ch]@129 | 15145 AIDirection v75; // [sp+54h] [bp-5Ch]@129 |
15175 int v76; // [sp+70h] [bp-40h]@83 | 15146 int target_pid_type; // [sp+70h] [bp-40h]@83 |
15176 signed int a1; // [sp+74h] [bp-3Ch]@129 | 15147 signed int a1; // [sp+74h] [bp-3Ch]@129 |
15177 int v78; // [sp+78h] [bp-38h]@79 | 15148 int v78; // [sp+78h] [bp-38h]@79 |
15178 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 | 15149 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 |
15179 float v80; // [sp+98h] [bp-18h]@33 | 15150 float v80; // [sp+98h] [bp-18h]@33 |
15180 int v81; // [sp+9Ch] [bp-14h]@100 | 15151 int v81; // [sp+9Ch] [bp-14h]@100 |
15181 int v82; // [sp+A0h] [bp-10h]@45 | 15152 //int v82; // [sp+A0h] [bp-10h]@45 |
15182 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 | 15153 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 |
15183 unsigned int v84; // [sp+A8h] [bp-8h]@11 | 15154 unsigned int v84; // [sp+A8h] [bp-8h]@11 |
15184 signed int a2; // [sp+ACh] [bp-4h]@83 | 15155 signed int target_pid; // [sp+ACh] [bp-4h]@83 |
15156 AIState uAIState; | |
15157 int v38; | |
15185 | 15158 |
15186 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 15159 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
15187 MakeActorAIList_ODM(); | 15160 MakeActorAIList_ODM(); |
15188 else | 15161 else |
15189 MakeActorAIList_BLV(); | 15162 MakeActorAIList_BLV(); |
15190 | 15163 |
15191 //v0 = 0; | 15164 //v0 = 0; |
15192 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) | 15165 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) |
15193 { | 15166 { |
15194 if ( pParty->armageddon_timer > 417 ) | 15167 if ( pParty->armageddon_timer > 417 ) |
15201 v1 = rand(); | 15174 v1 = rand(); |
15202 v2 = 128; | 15175 v2 = 128; |
15203 v3 = pParty->sRotationX + v1 % 16 - 8; | 15176 v3 = pParty->sRotationX + v1 % 16 - 8; |
15204 pParty->sRotationX = v3; | 15177 pParty->sRotationX = v3; |
15205 if ( v3 > 128 || (v2 = -128, v3 < -128) ) | 15178 if ( v3 > 128 || (v2 = -128, v3 < -128) ) |
15206 pParty->sRotationX = v2; | 15179 pParty->sRotationX = v2; |
15207 pParty->uFlags |= 2u; | 15180 pParty->uFlags |= 2u; |
15208 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | 15181 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; |
15209 v4 = pParty->field_16140 + 50; | 15182 v4 = pParty->field_16140 + 50; |
15210 if ( pParty->armageddon_timer <= 0 ) | 15183 if ( pParty->armageddon_timer <= 0 ) |
15211 { | 15184 { |
15223 v5->sCurrentHP = v7; | 15196 v5->sCurrentHP = v7; |
15224 if ( v6 ) | 15197 if ( v6 ) |
15225 { | 15198 { |
15226 if ( v7 >= 0 ) | 15199 if ( v7 >= 0 ) |
15227 { | 15200 { |
15228 Actor::_4030AD(v84, 4, 0); | 15201 Actor::Stun(v84, 4, 0); |
15229 } | 15202 } |
15230 else | 15203 else |
15231 { | 15204 { |
15232 Actor::Die(v84); | 15205 Actor::Die(v84); |
15233 if ( v5->pMonsterInfo.uExp ) | 15206 if ( v5->pMonsterInfo.uExp ) |
15234 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); | 15207 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); |
15235 } | 15208 } |
15236 } | 15209 } |
15237 } | 15210 } |
15238 ++v84; | 15211 ++v84; |
15239 ++v5; | 15212 ++v5; |
15243 v8 = &pPlayers[1]; | 15216 v8 = &pPlayers[1]; |
15244 do | 15217 do |
15245 { | 15218 { |
15246 pPlayer = *v8; | 15219 pPlayer = *v8; |
15247 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | 15220 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) |
15248 pPlayer->ReceiveDamage(v4, 5); | 15221 pPlayer->ReceiveDamage(v4, 5); |
15249 ++v8; | 15222 ++v8; |
15250 } | 15223 } |
15251 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | 15224 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); |
15252 //v0 = 0; | 15225 //v0 = 0; |
15253 } | 15226 } |
15254 if (pTurnEngine->field_1C) | 15227 if (pTurnEngine->field_1C) |
15255 --pTurnEngine->field_1C; | 15228 --pTurnEngine->field_1C; |
15256 } | 15229 } |
15257 } | 15230 } |
15258 | 15231 |
15259 if (pParty->bTurnBasedModeOn) | 15232 if (pParty->bTurnBasedModeOn) |
15260 { | 15233 { |
15273 //pActor = (Actor *)(LODWORD(v80) - 176); | 15246 //pActor = (Actor *)(LODWORD(v80) - 176); |
15274 //v11 = *(unsigned int *)LODWORD(v80); | 15247 //v11 = *(unsigned int *)LODWORD(v80); |
15275 //v49 = *(unsigned int *)LODWORD(v80) == 5; | 15248 //v49 = *(unsigned int *)LODWORD(v80) == 5; |
15276 ai_near_actors_targets_pid[i] = OBJECT_Player; | 15249 ai_near_actors_targets_pid[i] = OBJECT_Player; |
15277 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) |
15278 continue; | 15251 continue; |
15279 | 15252 |
15280 if (!actor->sCurrentHP && actor->uAIState != Dying) | 15253 if (!actor->sCurrentHP && actor->uAIState != Dying) |
15281 Actor::Die(i); | 15254 Actor::Die(i); |
15282 | 15255 |
15283 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | 15256 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; |
15284 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | 15257 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; |
15285 //v12 = 0; | 15258 //v12 = 0; |
15286 //v13 = 0; | 15259 //v13 = 0; |
15299 } | 15272 } |
15300 ++v13; | 15273 ++v13; |
15301 ++v14; | 15274 ++v14; |
15302 } | 15275 } |
15303 while ( v13 < 22 );*/ | 15276 while ( v13 < 22 );*/ |
15304 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) | 15277 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) |
15305 //&& 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 |
15306 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | 15279 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) |
15307 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; | 15280 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; |
15308 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) | 15281 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
15309 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15282 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15310 else | 15283 // not sure |
15311 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; | 15284 else if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) |
15285 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; | |
15312 | 15286 |
15313 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || | 15287 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 |
15314 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) | 15288 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) |
15315 continue; | 15289 continue; |
15316 | 15290 |
15317 //v15 = pMiscTimer->uTimeElapsed; | 15291 //v15 = pMiscTimer->uTimeElapsed; |
15318 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | 15292 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; |
15319 //v17 = pActor->uCurrentActionTime; | 15293 //v17 = pActor->uCurrentActionTime; |
15320 //v18 = pActor->pMonsterInfo.uRecoveryTime; | 15294 //v18 = pActor->pMonsterInfo.uRecoveryTime; |
15321 if (actor->pMonsterInfo.uRecoveryTime) | 15295 if (actor->pMonsterInfo.uRecoveryTime) |
15322 { | 15296 { |
15323 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | 15297 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) |
15324 actor->pMonsterInfo.uRecoveryTime = 0; | 15298 actor->pMonsterInfo.uRecoveryTime = 0; |
15325 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | 15299 else |
15300 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | |
15326 } | 15301 } |
15327 | 15302 |
15328 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15303 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
15329 if (actor->uCurrentActionTime < actor->uCurrentActionLength) | 15304 if (actor->uCurrentActionTime < actor->uCurrentActionLength) |
15330 continue; | 15305 continue; |
15331 | 15306 |
15332 //v19 = actor->uAIState; | 15307 //v19 = actor->uAIState; |
15333 if (actor->uAIState == Dying) | 15308 if (actor->uAIState == Dying) |
15334 actor->uAIState = Dead; | 15309 actor->uAIState = Dead; |
15335 else | 15310 else |
15336 { | 15311 { |
15337 if (actor->uAIState != Summoned) | 15312 if (actor->uAIState != Summoned) |
15338 { | 15313 { |
15339 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | 15314 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); |
15365 | 15340 |
15366 //v20 = &ai_near_actors_targets_pid[actor_id]; | 15341 //v20 = &ai_near_actors_targets_pid[actor_id]; |
15367 v21 = &pActors[actor_id]; | 15342 v21 = &pActors[actor_id]; |
15368 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); |
15369 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | 15344 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) |
15370 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15345 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15371 a2 = ai_near_actors_targets_pid[actor_id]; | 15346 target_pid = ai_near_actors_targets_pid[actor_id]; |
15372 v76 = a2 & 7; | 15347 target_pid_type = PID_TYPE(target_pid); |
15373 if ( (a2 & 7) == OBJECT_Actor) | 15348 if ( target_pid_type == OBJECT_Actor) |
15374 v80 = 0.5; | 15349 v80 = 0.5; |
15375 else | 15350 else |
15376 v80 = 1.0; | 15351 v80 = 1.0; |
15377 v22 = v21->uAIState; | 15352 v22 = v21->uAIState; |
15378 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | 15353 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) |
15379 { | 15354 { |
15380 continue; | 15355 continue; |
15381 } | 15356 } |
15357 if ( !v21->sCurrentHP ) | |
15358 Actor::Die(actor_id); | |
15359 for(int i=0;i<22;i++) | |
15360 { | |
15361 if ( i != 10 ) | |
15362 { | |
15363 v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); | |
15364 } | |
15365 } | |
15366 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | |
15367 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | |
15368 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | |
15369 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
15370 // not sure | |
15371 else if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | |
15372 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | |
15373 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) | |
15374 { | |
15375 v21->uAIState = Removed; | |
15376 continue; | |
15377 } | |
15378 if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 | |
15379 || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) | |
15380 { | |
15381 continue; | |
15382 } | |
15383 v27 = pMiscTimer->uTimeElapsed; | |
15384 v28 = v21->pMonsterInfo.uRecoveryTime; | |
15385 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
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 = PID(OBJECT_Actor,actor_id); | |
15393 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_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 } | |
15382 else | 15405 else |
15406 */ | |
15407 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly | |
15408 || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 | |
15409 || v80 * 307.2 < (double)(signed int)v75.uDistance | |
15410 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting | |
15411 && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) | |
15383 { | 15412 { |
15384 if ( !v21->sCurrentHP ) | 15413 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) |
15385 Actor::Die(actor_id); | |
15386 v25 = 0; | |
15387 v26 = v21->pActorBuffs; | |
15388 do | |
15389 { | |
15390 if ( v25 != 10 ) | |
15391 { | |
15392 v26->_4585CA(pParty->uTimePlayed); | |
15393 //v24 = 0; | |
15394 } | |
15395 ++v25; | |
15396 ++v26; | |
15397 } | |
15398 while ( v25 < 22 ); | |
15399 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 | |
15400 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0 | |
15401 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0 | |
15402 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) ) | |
15403 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | |
15404 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) | |
15405 { | |
15406 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
15407 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) | |
15408 { | |
15409 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 | |
15410 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) | |
15411 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | |
15412 } | |
15413 } | |
15414 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 | |
15415 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 | |
15416 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 | |
15417 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) | |
15418 { | |
15419 v21->uAIState = Removed; | |
15420 continue; | |
15421 } | |
15422 else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) | |
15423 { | 15414 { |
15424 continue; | 15415 continue; |
15425 } | 15416 } |
15426 else | 15417 else if ( v21->uAIState == AttackingMelee ) |
15427 { | 15418 { |
15428 v27 = pMiscTimer->uTimeElapsed; | 15419 v35 = stru_50C198.special_ability_use_check(v21, actor_id); |
15429 v28 = v21->pMonsterInfo.uRecoveryTime; | 15420 stru_50FE08.Add( |
15430 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15421 a1, |
15431 if ( (signed int)v28 > 0 ) | 15422 5120, |
15432 v21->pMonsterInfo.uRecoveryTime = v28 - v27; | 15423 v21->vPosition.x, |
15433 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) | 15424 v21->vPosition.y, |
15434 v21->pMonsterInfo.uRecoveryTime = 0; | 15425 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), |
15435 v29 = v21->uAttributes; | 15426 v35, |
15436 if ( !(v29 & 0x8000) ) | 15427 1 |
15437 v21->uAttributes = v29 | 0x8000; | 15428 ); |
15438 a1 = 8 * actor_id | OBJECT_Actor; | 15429 } |
15439 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0); | 15430 else if ( v21->uAIState == AttackingRanged1 ) |
15440 v49 = v21->pMonsterInfo.uHostilityType == 0; | 15431 { |
15441 memcpy(&v75, v30, sizeof(v75)); | 15432 v34 = v21->pMonsterInfo.uMissleAttack1Type; |
15442 memcpy(&pDir, &v75, sizeof(pDir)); | 15433 Actor::RangedAttack(actor_id, &pDir, v34, 0); |
15443 if ( !v49 | 15434 } |
15444 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 | 15435 else if ( v21->uAIState == AttackingRanged2 ) |
15445 && v80 * 307.2 >= (double)(signed int)v75.uDistance | 15436 { |
15446 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9) | 15437 v34 = v21->pMonsterInfo.uMissleAttack2Type; |
15447 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 ) | 15438 Actor::RangedAttack(actor_id, &pDir, v34, 1); |
15448 { | 15439 } |
15449 v32 = actor_id; | 15440 else if ( v21->uAIState == AttackingRanged3 ) |
15450 } | 15441 { |
15451 else | 15442 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; |
15452 { | 15443 v33 = v21->pMonsterInfo.uSpell1ID; |
15453 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) | 15444 Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); |
15454 { | 15445 } |
15455 continue; | 15446 else if ( v21->uAIState == AttackingRanged4 ) |
15456 } | 15447 { |
15457 else if ( v21->uAIState == 2 ) | 15448 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; |
15458 { | 15449 v33 = v21->pMonsterInfo.uSpell2ID; |
15459 v32 = actor_id; | 15450 Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); |
15460 v35 = stru_50C198.special_ability_use_check(v21, actor_id); | |
15461 stru_50FE08.Add( | |
15462 a1, | |
15463 5120, | |
15464 v21->vPosition.x, | |
15465 v21->vPosition.y, | |
15466 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), | |
15467 v35, | |
15468 1 | |
15469 ); | |
15470 } | |
15471 else if ( v21->uAIState == 3 ) | |
15472 { | |
15473 v34 = v21->pMonsterInfo.uMissleAttack1Type; | |
15474 v66 = 0; | |
15475 v32 = actor_id; | |
15476 Actor::_404874(actor_id, &pDir, v34, v66); | |
15477 } | |
15478 else if ( v21->uAIState == 12 ) | |
15479 { | |
15480 v34 = v21->pMonsterInfo.uMissleAttack2Type; | |
15481 v66 = 1; | |
15482 v32 = actor_id; | |
15483 Actor::_404874(actor_id, &pDir, v34, v66); | |
15484 } | |
15485 else | |
15486 { | |
15487 v32 = actor_id; | |
15488 if ( v21->uAIState == 13 ) | |
15489 { | |
15490 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; | |
15491 v60 = 2; | |
15492 v33 = v21->pMonsterInfo.uSpell1ID; | |
15493 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); | |
15494 } | |
15495 else if ( v21->uAIState == 18 ) | |
15496 { | |
15497 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; | |
15498 v60 = 3; | |
15499 v33 = v21->pMonsterInfo.uSpell2ID; | |
15500 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); | |
15501 } | |
15502 } | |
15503 } | |
15504 } | 15451 } |
15505 } | 15452 } |
15453 | |
15506 v36 = v75.uDistance; | 15454 v36 = v75.uDistance; |
15507 if ( !v21->pMonsterInfo.uHostilityType ) | 15455 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) |
15508 { | 15456 { |
15509 if ( v76 == 3 ) | 15457 if ( target_pid_type == OBJECT_Actor ) |
15510 { | 15458 { |
15511 v36 = v75.uDistance; | 15459 v36 = v75.uDistance; |
15512 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] | 15460 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] |
15513 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); | 15461 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); |
15514 } | 15462 } |
15515 else | 15463 else |
15516 { | 15464 { |
15517 v37 = 4; | 15465 v37 = 4; |
15518 } | 15466 } |
15467 v38=0; | |
15519 if ( v37 == 2 ) | 15468 if ( v37 == 2 ) |
15520 { | 15469 { |
15521 v39 = __OFSUB__(v36, 1024); | 15470 //v39 = __OFSUB__(v36, 1024); |
15522 v38 = ((v36 - 1024) & 0x80000000u) != 0; | 15471 //v38 = ((v36 - 1024) & 0x80000000u) != 0; |
15472 v38 = 1024; | |
15523 } | 15473 } |
15524 else if ( v37 == 3 ) | 15474 else if ( v37 == 3 ) |
15525 { | 15475 { |
15526 v39 = __OFSUB__(v36, 2560); | 15476 //v39 = __OFSUB__(v36, 2560); |
15527 v38 = ((v36 - 2560) & 0x80000000u) != 0; | 15477 //v38 = ((v36 - 2560) & 0x80000000u) != 0; |
15478 v38 = 2560; | |
15528 } | 15479 } |
15529 else if ( v37 == 4 ) | 15480 else if ( v37 == 4 ) |
15530 { | 15481 { |
15531 v39 = __OFSUB__(v36, 5120); | 15482 //v39 = __OFSUB__(v36, 5120); |
15532 v38 = ((v36 - 5120) & 0x80000000u) != 0; | 15483 //v38 = ((v36 - 5120) & 0x80000000u) != 0; |
15484 v38 = 5120; | |
15533 } | 15485 } |
15534 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) | 15486 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) |
15535 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | 15487 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
15536 } | 15488 } |
15489 | |
15537 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) | 15490 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) |
15538 { | 15491 { |
15539 v40 = a2; | |
15540 v41 = v32; | |
15541 if ( (signed int)v36 >= 10240 ) | 15492 if ( (signed int)v36 >= 10240 ) |
15542 { | 15493 { |
15543 v68 = 0; | 15494 Actor::_4032B2(actor_id, target_pid, 1024, 0); |
15544 v61 = 1024; | |
15545 Actor::_4032B2(v41, v40, v61, v68); | |
15546 continue; | |
15547 } | 15495 } |
15548 v67 = &pDir; | 15496 else |
15549 Actor::_402968(v41, v40, 0, v67); | 15497 { |
15498 //peasents after attacked | |
15499 //guard after attacked | |
15500 Actor::Flee(actor_id, target_pid, 0, &pDir); | |
15501 } | |
15550 continue; | 15502 continue; |
15551 } | 15503 } |
15552 if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) | 15504 |
15505 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) | |
15553 { | 15506 { |
15554 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) | 15507 |
15508 if ( v21->pMonsterInfo.uAIType == 1 ) | |
15555 { | 15509 { |
15556 if ( v21->pMonsterInfo.uAIType == 1 ) | 15510 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15557 { | 15511 { |
15558 v67 = &pDir; | 15512 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); |
15559 if ( v21->pMonsterInfo.uMovementType != 5 ) | |
15560 { | |
15561 v40 = a2; | |
15562 v41 = v32; | |
15563 Actor::_402968(v41, v40, 0, v67); | |
15564 continue; | |
15565 } | |
15566 Actor::AI_Stand( | |
15567 v32, | |
15568 a2, | |
15569 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), | |
15570 &pDir); | |
15571 } | 15513 } |
15572 else | 15514 else |
15573 { | 15515 { |
15516 Actor::Flee(actor_id, target_pid, 0, &pDir); | |
15517 continue; | |
15518 } | |
15519 | |
15520 } | |
15521 if ( !(v21->uAttributes & 0x020000) ) | |
15522 { | |
15523 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3) | |
15524 { | |
15574 if ( v21->pMonsterInfo.uAIType == 2 ) | 15525 if ( v21->pMonsterInfo.uAIType == 2 ) |
15575 { | |
15576 v84 = v21->sCurrentHP; | |
15577 v42 = (double)(signed int)v84; | |
15578 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; | 15526 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; |
15579 } | 15527 if ( v21->pMonsterInfo.uAIType == 3 ) |
15580 else | |
15581 { | |
15582 v84 = v21->sCurrentHP; | |
15583 v42 = (double)(signed int)v84; | |
15584 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; | 15528 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; |
15585 } | 15529 v84 = v21->sCurrentHP; |
15586 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) | 15530 v42 = (double)(signed int)v84; |
15587 if ( v43 > v42 && (signed int)v36 < 10240 ) | 15531 if ( v43 > v42 && (signed int)v36 < 10240 ) |
15588 { | 15532 { |
15589 v67 = &pDir; | 15533 Actor::Flee(actor_id, target_pid, 0, &pDir); |
15590 v40 = a2; | |
15591 v41 = v32; | |
15592 Actor::_402968(v41, v40, 0, v67); | |
15593 continue; | 15534 continue; |
15594 } | 15535 } |
15595 } | 15536 } |
15596 } | 15537 } |
15538 | |
15597 v81 = v36 - v21->uActorRadius; | 15539 v81 = v36 - v21->uActorRadius; |
15598 if ( v76 == 3 ) | 15540 if ( target_pid_type == OBJECT_Actor ) |
15599 v81 -= pActors[a2 >> 3].uActorRadius; | 15541 v81 -= pActors[PID_ID(target_pid)].uActorRadius; |
15600 if ( v81 < 0 ) | 15542 if ( v81 < 0 ) |
15601 v81 = 0; | 15543 v81 = 0; |
15602 rand(); | 15544 rand(); |
15603 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0; | |
15604 v21->uAttributes &= 0xFBFFFF; | 15545 v21->uAttributes &= 0xFBFFFF; |
15605 v82 = 0; | |
15606 v49 = v21->pMonsterInfo.uMovementType == 5; | |
15607 v84 = v44; | |
15608 if ( v49 ) | |
15609 v82 = 1; | |
15610 if ( v81 < 5120 ) | 15546 if ( v81 < 5120 ) |
15611 { | 15547 { |
15612 v45 = stru_50C198.special_ability_use_check(v21, v32); | 15548 v45 = stru_50C198.special_ability_use_check(v21, actor_id); |
15613 if ( !v45 ) | 15549 if ( v45 == 0 ) |
15614 { | 15550 { |
15615 if ( v21->pMonsterInfo.uMissleAttack1Type ) | 15551 if ( v21->pMonsterInfo.uMissleAttack1Type ) |
15616 { | 15552 { |
15617 if ( v84 ) | 15553 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) |
15618 { | 15554 { |
15619 Actor::_403476(v32, a2, &pDir); | 15555 Actor::MissileAttack1(actor_id, target_pid, &pDir); |
15620 continue; | |
15621 | |
15622 } | 15556 } |
15623 if ( v82 ) | 15557 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15624 { | 15558 { |
15625 v69 = &pDir; | |
15626 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15559 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15627 v51 = a2; | |
15628 v64 = (signed __int64)v47; | 15560 v64 = (signed __int64)v47; |
15629 v52 = v32; | 15561 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15630 Actor::AI_Stand(v52, v51, v64, v69); | |
15631 continue; | |
15632 } | 15562 } |
15633 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15563 else |
15634 //UNDEF(v53); | |
15635 v69 = &pDir; | |
15636 if ( !(v54 | v55) ) | |
15637 { | 15564 { |
15638 v51 = a2; | 15565 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15566 if ( v80 * 307.2 > (double)v81 ) | |
15567 { | |
15568 v64 = (signed __int64)v47; | |
15569 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15570 } | |
15571 else | |
15572 { | |
15573 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | |
15574 } | |
15575 } | |
15576 } | |
15577 else | |
15578 { | |
15579 v56 = v80 * 307.2; | |
15580 if ( (double)v81 >= v56 ) | |
15581 { | |
15582 if ( v81 >= 1024 ) | |
15583 { | |
15584 if ( v21->pMonsterInfo.uMovementType == 5 ) | |
15585 { | |
15586 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15587 v64 = (signed __int64)v47; | |
15588 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15589 } | |
15590 else | |
15591 { | |
15592 //monsters | |
15593 Actor::Pursue3(actor_id, target_pid, 0, &pDir); | |
15594 } | |
15595 } | |
15596 else if ( v21->pMonsterInfo.uMovementType == 5 ) | |
15597 { | |
15598 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15599 v64 = (signed __int64)v47; | |
15600 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15601 } | |
15602 else | |
15603 { | |
15604 v70 = (signed __int64)v56; | |
15605 //monsters | |
15606 //guard after player runs away | |
15607 // follow player | |
15608 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
15609 } | |
15610 } | |
15611 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) | |
15612 { | |
15613 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15639 v64 = (signed __int64)v47; | 15614 v64 = (signed __int64)v47; |
15640 v52 = v32; | 15615 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15641 Actor::AI_Stand(v52, v51, v64, v69); | |
15642 continue; | |
15643 } | 15616 } |
15644 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | 15617 else |
15645 continue; | 15618 { |
15619 //monsters | |
15620 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15621 } | |
15646 } | 15622 } |
15647 v56 = v80 * 307.2; | |
15648 if ( (double)v81 >= v56 ) | |
15649 { | |
15650 if ( v81 >= 1024 ) | |
15651 { | |
15652 if ( v82 ) | |
15653 { | |
15654 v69 = &pDir; | |
15655 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15656 v51 = a2; | |
15657 v64 = (signed __int64)v47; | |
15658 v52 = v32; | |
15659 Actor::AI_Stand(v52, v51, v64, v69); | |
15660 continue; | |
15661 } | |
15662 v71 = &pDir; | |
15663 v63 = 0; | |
15664 | |
15665 Actor::_402686(v32, a2, v63, v71); | |
15666 continue; | |
15667 } | |
15668 if ( v82 ) | |
15669 { | |
15670 v69 = &pDir; | |
15671 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15672 v51 = a2; | |
15673 v64 = (signed __int64)v47; | |
15674 v52 = v32; | |
15675 Actor::AI_Stand(v52, v51, v64, v69); | |
15676 continue; | |
15677 } | |
15678 v70 = (signed __int64)v56; | |
15679 v62 = &pDir; | |
15680 v59 = 0; | |
15681 Actor::_40281C(v32, a2, v59, v62, v70); | |
15682 continue; | |
15683 } | |
15684 v49 = v84 == 0; | |
15685 v69 = &pDir; | |
15686 if ( v49 ) | |
15687 { | |
15688 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15689 v51 = a2; | |
15690 v64 = (signed __int64)v47; | |
15691 v52 = v32; | |
15692 Actor::AI_Stand(v52, v51, v64, v69); | |
15693 continue; | |
15694 } | |
15695 Actor::_403C6C(v32, a2, &pDir); | |
15696 continue; | 15623 continue; |
15697 } | 15624 } |
15698 if ( v45 != 1 ) | 15625 else if ( v45 == 2 || v45 == 3 ) |
15699 { | 15626 { |
15700 if ( v45 > 1 && v45 <= 3 ) | 15627 if ( v45 == 2 ) |
15628 v46 = v21->pMonsterInfo.uSpell1ID; | |
15629 else | |
15630 v46 = v21->pMonsterInfo.uSpell2ID; | |
15631 if ( v46 ) | |
15701 { | 15632 { |
15702 if ( v45 == 2 ) | 15633 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) |
15703 v46 = v21->pMonsterInfo.uSpell1ID; | 15634 { |
15635 if ( v45 == 2 ) | |
15636 Actor::SpellAttack1(actor_id, target_pid, &pDir); | |
15637 else | |
15638 Actor::SpellAttack2(actor_id, target_pid, &pDir); | |
15639 } | |
15640 else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) | |
15641 { | |
15642 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15643 v64 = (signed __int64)v47; | |
15644 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15645 } | |
15704 else | 15646 else |
15705 v46 = v21->pMonsterInfo.uSpell2ID; | |
15706 if ( v46 ) | |
15707 { | 15647 { |
15708 if ( v84 ) | |
15709 { | |
15710 if ( v45 == 2 ) | |
15711 Actor::_403854(v32, a2, &pDir); | |
15712 else | |
15713 Actor::_403A60(v32, a2, &pDir); | |
15714 continue; | |
15715 } | |
15716 if ( v80 * 307.2 > (double)v81 || v82 ) | |
15717 { | |
15718 v69 = &pDir; | |
15719 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15720 v51 = a2; | |
15721 v64 = (signed __int64)v47; | |
15722 v52 = v32; | |
15723 Actor::AI_Stand(v52, v51, v64, v69); | |
15724 continue; | |
15725 | |
15726 } | |
15727 v69 = &pDir; | |
15728 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15648 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15729 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | 15649 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
15730 continue; | |
15731 } | 15650 } |
15651 } | |
15652 else | |
15653 { | |
15732 v48 = v80 * 307.2; | 15654 v48 = v80 * 307.2; |
15733 if ( (double)v81 >= v48 ) | 15655 if ( (double)v81 >= v48 ) |
15734 { | 15656 { |
15735 if ( v81 >= 1024 ) | 15657 if ( v81 >= 1024 ) |
15736 { | 15658 { |
15737 v50 = v82 == 0; | 15659 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15738 if ( !v50 ) | |
15739 { | 15660 { |
15740 v69 = &pDir; | |
15741 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15661 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15742 v51 = a2; | |
15743 v64 = (signed __int64)v47; | 15662 v64 = (signed __int64)v47; |
15744 v52 = v32; | 15663 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15745 Actor::AI_Stand(v52, v51, v64, v69); | |
15746 continue; | |
15747 } | 15664 } |
15748 v71 = &pDir; | 15665 else |
15749 v63 = 256; | 15666 { |
15750 Actor::_402686(v32, a2, v63, v71); | 15667 Actor::Pursue3(actor_id, target_pid, 256, &pDir); |
15751 continue; | 15668 } |
15752 | |
15753 } | 15669 } |
15754 if ( v82 ) | 15670 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15755 { | 15671 { |
15756 v69 = &pDir; | |
15757 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15672 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15758 v51 = a2; | |
15759 v64 = (signed __int64)v47; | 15673 v64 = (signed __int64)v47; |
15760 v52 = v32; | 15674 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15761 Actor::AI_Stand(v52, v51, v64, v69); | |
15762 continue; | |
15763 } | 15675 } |
15764 v70 = (signed __int64)v48; | 15676 else |
15765 v62 = &pDir; | 15677 { |
15766 v59 = 0; | 15678 v70 = (signed __int64)v48; |
15767 Actor::_40281C(v32, a2, v59, v62, v70); | 15679 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); |
15768 continue; | 15680 } |
15769 } | 15681 } |
15770 v49 = v84 == 0; | 15682 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15771 v69 = &pDir; | |
15772 if ( v49 ) | |
15773 { | 15683 { |
15774 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15684 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15775 v51 = a2; | |
15776 v64 = (signed __int64)v47; | 15685 v64 = (signed __int64)v47; |
15777 v52 = v32; | 15686 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15778 Actor::AI_Stand(v52, v51, v64, v69); | |
15779 continue; | |
15780 } | 15687 } |
15781 Actor::_403C6C(v32, a2, &pDir); | 15688 else |
15782 continue; | 15689 { |
15690 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15691 } | |
15783 } | 15692 } |
15693 continue; | |
15784 } | 15694 } |
15785 } | 15695 } |
15786 } | 15696 } |
15787 if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 || v81 >= 5120 || v45 != 1 ) | 15697 |
15698 if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) | |
15788 { | 15699 { |
15789 if ( !v21->pMonsterInfo.uMovementType ) | 15700 if ( !v21->pMonsterInfo.uMovementType ) |
15790 { | 15701 { |
15791 v68 = 0; | 15702 Actor::_4032B2(actor_id, 4, 1024, 0); |
15792 v61 = 1024; | |
15793 v41 = v32; | |
15794 v40 = 4; | |
15795 Actor::_4032B2(v41, v40, v61, v68); | |
15796 continue; | |
15797 | |
15798 } | 15703 } |
15799 if ( v21->pMonsterInfo.uMovementType == 1 ) | 15704 else if ( v21->pMonsterInfo.uMovementType == 1 ) |
15800 { | 15705 { |
15801 v68 = 0; | 15706 Actor::_4032B2(actor_id, 4, 2560, 0); |
15802 v61 = 2560; | |
15803 v41 = v32; | |
15804 v40 = 4; | |
15805 Actor::_4032B2(v41, v40, v61, v68); | |
15806 continue; | |
15807 } | 15707 } |
15808 if ( v21->pMonsterInfo.uMovementType == 2 ) | 15708 else if ( v21->pMonsterInfo.uMovementType == 2 ) |
15809 { | 15709 { |
15810 v68 = 0; | 15710 Actor::_4032B2(actor_id, 4, 5120, 0); |
15811 v61 = 5120; | |
15812 v41 = v32; | |
15813 v40 = 4; | |
15814 Actor::_4032B2(v41, v40, v61, v68); | |
15815 continue; | |
15816 } | 15711 } |
15817 if ( v21->pMonsterInfo.uMovementType == 4 ) | 15712 else if ( v21->pMonsterInfo.uMovementType == 4 ) |
15818 { | 15713 { |
15819 v68 = 0; | 15714 Actor::_4032B2(actor_id, 4, 10240, 0); |
15820 v61 = 10240; | |
15821 v41 = v32; | |
15822 v40 = 4; | |
15823 Actor::_4032B2(v41, v40, v61, v68); | |
15824 continue; | |
15825 } | 15715 } |
15826 if ( v21->pMonsterInfo.uMovementType == 5 ) | 15716 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15827 { | 15717 { |
15828 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | 15718 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); |
15829 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15719 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15830 memcpy(&v74, v57, sizeof(v74)); | 15720 memcpy(&v74, v57, sizeof(v74)); |
15831 memcpy(&pDir, &v74, sizeof(pDir)); | 15721 memcpy(&pDir, &v74, sizeof(pDir)); |
15832 v69 = &pDir; | |
15833 v52 = actor_id; | |
15834 v64 = (signed __int64)v58; | 15722 v64 = (signed __int64)v58; |
15835 v51 = 4; | 15723 Actor::AI_Stand(actor_id, 4, v64, &pDir); |
15836 Actor::AI_Stand(v52, v51, v64, v69); | 15724 } |
15837 continue; | |
15838 } | |
15839 continue; | |
15840 | |
15841 } | 15725 } |
15842 if ( !v21->pMonsterInfo.uMissleAttack2Type ) | 15726 else if ( !v21->pMonsterInfo.uMissleAttack2Type ) |
15843 { | 15727 { |
15844 v56 = v80 * 307.2; | 15728 v56 = v80 * 307.2; |
15845 if ( (double)v81 >= v56 ) | 15729 if ( (double)v81 >= v56 ) |
15846 { | 15730 { |
15847 if ( v81 >= 1024 ) | 15731 if ( v81 >= 1024 ) |
15848 { | 15732 { |
15849 v50 = v82 == 0; | 15733 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15850 if ( !v50 ) | |
15851 { | 15734 { |
15852 v69 = &pDir; | |
15853 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15735 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15854 v51 = a2; | |
15855 v64 = (signed __int64)v47; | 15736 v64 = (signed __int64)v47; |
15856 v52 = v32; | 15737 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15857 Actor::AI_Stand(v52, v51, v64, v69); | |
15858 continue; | |
15859 } | 15738 } |
15860 v71 = &pDir; | 15739 else |
15861 v63 = 256; | 15740 { |
15862 Actor::_402686(v32, a2, v63, v71); | 15741 Actor::Pursue3(actor_id, target_pid, 256, &pDir); |
15863 continue; | 15742 } |
15864 } | 15743 } |
15865 if ( v82 ) | 15744 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15866 { | 15745 { |
15867 v69 = &pDir; | |
15868 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15746 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15869 v51 = a2; | |
15870 v64 = (signed __int64)v47; | 15747 v64 = (signed __int64)v47; |
15871 v52 = v32; | 15748 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15872 Actor::AI_Stand(v52, v51, v64, v69); | |
15873 continue; | |
15874 } | 15749 } |
15875 v70 = (signed __int64)v56; | 15750 else |
15876 v62 = &pDir; | 15751 { |
15877 v59 = 0; | 15752 v70 = (signed __int64)v56; |
15878 Actor::_40281C(v32, a2, v59, v62, v70); | 15753 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); |
15879 continue; | 15754 } |
15880 | |
15881 } | 15755 } |
15882 v49 = v84 == 0; | 15756 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15883 v69 = &pDir; | |
15884 if ( v49 ) | |
15885 { | 15757 { |
15886 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15758 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15887 v51 = a2; | |
15888 v64 = (signed __int64)v47; | 15759 v64 = (signed __int64)v47; |
15889 v52 = v32; | 15760 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15890 Actor::AI_Stand(v52, v51, v64, v69); | |
15891 continue; | |
15892 } | 15761 } |
15893 Actor::_403C6C(v32, a2, &pDir); | 15762 else |
15894 continue; | 15763 { |
15764 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15765 } | |
15895 } | 15766 } |
15896 if ( !v84 ) | 15767 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15897 { | 15768 { |
15898 if ( v82 ) | 15769 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15770 if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) | |
15899 { | 15771 { |
15900 v69 = &pDir; | |
15901 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15902 v51 = a2; | |
15903 v64 = (signed __int64)v47; | 15772 v64 = (signed __int64)v47; |
15904 v52 = v32; | 15773 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15905 Actor::AI_Stand(v52, v51, v64, v69); | |
15906 continue; | |
15907 } | 15774 } |
15908 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15775 else |
15909 //UNDEF(v53); | |
15910 v69 = &pDir; | |
15911 if ( !(v54 | v55) ) | |
15912 { | 15776 { |
15913 v51 = a2; | 15777 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
15914 v64 = (signed __int64)v47; | |
15915 v52 = v32; | |
15916 Actor::AI_Stand(v52, v51, v64, v69); | |
15917 continue; | |
15918 } | 15778 } |
15919 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | |
15920 continue; | |
15921 } | 15779 } |
15922 Actor::_40368B(v32, a2, &pDir); | 15780 else |
15781 { | |
15782 Actor::MissileAttack2(actor_id, target_pid, &pDir); | |
15783 } | |
15923 } | 15784 } |
15924 } | 15785 } |
15925 } | 15786 } |
15926 | 15787 |
15927 //----- (0040261D) -------------------------------------------------------- | 15788 //----- (0040261D) -------------------------------------------------------- |
15994 if ( this->uActorQueueSize > 0 ) | 15855 if ( this->uActorQueueSize > 0 ) |
15995 { | 15856 { |
15996 v2 = this->pQueue; | 15857 v2 = this->pQueue; |
15997 do | 15858 do |
15998 { | 15859 { |
15999 if ( (v2->uPackedID & 7) == OBJECT_Actor ) | 15860 if ( PID_TYPE(v2->uPackedID) == OBJECT_Actor ) |
16000 { | 15861 { |
16001 v3 = &pActors[v2->uPackedID >> 3]; | 15862 v3 = &pActors[PID_ID(v2->uPackedID)]; |
16002 v4 = &pActors[v2->uPackedID >> 3]; | 15863 v4 = &pActors[PID_ID(v2->uPackedID)]; |
16003 LOBYTE(v4->uAttributes) |= 0x80u; | 15864 LOBYTE(v4->uAttributes) |= 0x80u; |
16004 if ( !v4->CanAct() ) | 15865 if ( !v4->CanAct() ) |
16005 { | 15866 { |
16006 --v19; | 15867 --v19; |
16007 v2->field_4 = 1001; | 15868 v2->field_4 = 1001; |
16008 LOBYTE(v3->uAttributes) &= 0x7Fu; | 15869 LOBYTE(v3->uAttributes) &= 0x7Fu; |
16009 } | 15870 } |
16010 } | 15871 } |
16011 if ( (v2->uPackedID & 7) == OBJECT_Player) | 15872 if ( PID_TYPE(v2->uPackedID) == OBJECT_Player) |
16012 { | 15873 { |
16013 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; | 15874 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; |
16014 if ( v5->pConditions[14] | 15875 if ( v5->pConditions[14] |
16015 || v5->pConditions[16] | 15876 || v5->pConditions[16] |
16016 || v5->pConditions[15] | 15877 || v5->pConditions[15] |
16042 { | 15903 { |
16043 v9 = v8->field_4; | 15904 v9 = v8->field_4; |
16044 v10 = v7->field_4; | 15905 v10 = v7->field_4; |
16045 if ( v9 < v10 | 15906 if ( v9 < v10 |
16046 || v9 == v10 | 15907 || v9 == v10 |
16047 && ((v11 = v8->uPackedID & 7, v11 == OBJECT_Player) && (v7->uPackedID & 7) == OBJECT_Actor | 15908 && ((v11 = PID_TYPE(v8->uPackedID), v11 == OBJECT_Player) && PID_TYPE(v7->uPackedID) == OBJECT_Actor |
16048 || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) | 15909 || v11 == PID_TYPE(v7->uPackedID) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) |
16049 { | 15910 { |
16050 v12 = v7->uPackedID; | 15911 v12 = v7->uPackedID; |
16051 v13 = v7->field_4; | 15912 v13 = v7->field_4; |
16052 v14 = v7->uActionLength; | 15913 v14 = v7->uActionLength; |
16053 v15 = v7->field_C; | 15914 v15 = v7->field_C; |
16071 } | 15932 } |
16072 while ( v21 - 1 < v6 ); | 15933 while ( v21 - 1 < v6 ); |
16073 } | 15934 } |
16074 v1->uActorQueueSize = v19; | 15935 v1->uActorQueueSize = v19; |
16075 result = v1->pQueue[0].uPackedID; | 15936 result = v1->pQueue[0].uPackedID; |
16076 if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) | 15937 if ( PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
16077 { | 15938 { |
16078 result = (result >> 3) + 1; | 15939 result = PID_ID(result) + 1; |
16079 uActiveCharacter = result; | 15940 uActiveCharacter = result; |
16080 v1->field_18 |= 4u; | 15941 v1->field_18 |= 4u; |
16081 } | 15942 } |
16082 else | 15943 else |
16083 { | 15944 { |
16088 if ( v1->uActorQueueSize > 0 ) | 15949 if ( v1->uActorQueueSize > 0 ) |
16089 { | 15950 { |
16090 v17 = v1->pQueue; | 15951 v17 = v1->pQueue; |
16091 do | 15952 do |
16092 { | 15953 { |
16093 if ( (v17->uPackedID & 7) == OBJECT_Player) | 15954 if ( PID_TYPE(v17->uPackedID) == OBJECT_Player) |
16094 pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875); | 15955 pParty->pPlayers[PID_ID(v17->uPackedID)].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875); |
16095 ++v22; | 15956 ++v22; |
16096 ++v17; | 15957 ++v17; |
16097 result = v22; | 15958 result = v22; |
16098 } | 15959 } |
16099 while ( v22 < v1->uActorQueueSize ); | 15960 while ( v22 < v1->uActorQueueSize ); |
16169 v3 = 0; | 16030 v3 = 0; |
16170 do | 16031 do |
16171 { | 16032 { |
16172 if ( v40->CanAct() ) | 16033 if ( v40->CanAct() ) |
16173 { | 16034 { |
16174 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = 8 * v3 | OBJECT_Player; | 16035 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(OBJECT_Player,v3); |
16175 v1->pQueue[v1->uActorQueueSize].field_C = 2; | 16036 v1->pQueue[v1->uActorQueueSize].field_C = 2; |
16176 v1->pQueue[v1->uActorQueueSize].uActionLength = 0; | 16037 v1->pQueue[v1->uActorQueueSize].uActionLength = 0; |
16177 pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; | 16038 pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; |
16178 } | 16039 } |
16179 ++v40; | 16040 ++v40; |
16199 if ( v7 & 0x8000 < 0 ) | 16060 if ( v7 & 0x8000 < 0 ) |
16200 { | 16061 { |
16201 v8 = ai_near_actors_targets_pid[v5]; | 16062 v8 = ai_near_actors_targets_pid[v5]; |
16202 LOBYTE(v7) = v7 | 0x80; | 16063 LOBYTE(v7) = v7 | 0x80; |
16203 v6->uAttributes = v7; | 16064 v6->uAttributes = v7; |
16204 v33 = 8 * v5 | OBJECT_Actor; | 16065 v33 = PID(OBJECT_Actor,v5); |
16205 memcpy(&v31, Actor::GetDirectionInfo(8 * v5 | OBJECT_Actor, v8, &a3, 0), sizeof(v31)); | 16066 memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31)); |
16206 memcpy(&v30, &v31, sizeof(v30)); | 16067 memcpy(&v30, &v31, sizeof(v30)); |
16207 Actor::AI_StandOrBored(v37, 4, 32, &v30); | 16068 Actor::AI_StandOrBored(v37, 4, 32, &v30); |
16208 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33; | 16069 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33; |
16209 v1->pQueue[v1->uActorQueueSize].field_C = 2; | 16070 v1->pQueue[v1->uActorQueueSize].field_C = 2; |
16210 v1->pQueue[v1->uActorQueueSize++].uActionLength = 0; | 16071 v1->pQueue[v1->uActorQueueSize++].uActionLength = 0; |
16226 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) | 16087 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
16227 { | 16088 { |
16228 v12 = (char *)&v1->pQueue[0].field_4; | 16089 v12 = (char *)&v1->pQueue[0].field_4; |
16229 while ( 1 ) | 16090 while ( 1 ) |
16230 { | 16091 { |
16231 v13 = *((int *)v12 - 1) & 7; | 16092 v13 = PID_TYPE(*((int *)v12 - 1)); |
16232 if ( v13 != OBJECT_Player ) | 16093 if ( v13 != OBJECT_Player ) |
16233 break; | 16094 break; |
16234 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; | 16095 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; |
16235 if ( v14 != (short)v2 ) | 16096 if ( v14 != (short)v2 ) |
16236 { | 16097 { |