Mercurial > mm7
comparison mm7_3.cpp @ 869:715064ae1792
Слияние
author | Ritor1 |
---|---|
date | Mon, 01 Apr 2013 09:05:51 +0600 |
parents | 6759478c2f14 7bd9beae3b8d |
children | a0ae8d36c2d6 |
comparison
equal
deleted
inserted
replaced
868:6759478c2f14 | 869:715064ae1792 |
---|---|
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; |
5986 //double v26; // [sp+120h] [bp-44h]@4 | 5966 //double v26; // [sp+120h] [bp-44h]@4 |
5987 //float v27; // [sp+128h] [bp-3Ch]@4 | 5967 //float v27; // [sp+128h] [bp-3Ch]@4 |
5988 float v28; // [sp+12Ch] [bp-38h]@2 | 5968 float v28; // [sp+12Ch] [bp-38h]@2 |
5989 int v29; // [sp+130h] [bp-34h]@4 | 5969 int v29; // [sp+130h] [bp-34h]@4 |
5990 int v30; // [sp+134h] [bp-30h]@1 | 5970 int v30; // [sp+134h] [bp-30h]@1 |
5991 float v31; // [sp+138h] [bp-2Ch]@2 | 5971 //int v31; // [sp+138h] [bp-2Ch]@2 |
5992 int v32; // [sp+13Ch] [bp-28h]@6 | 5972 int v32; // [sp+13Ch] [bp-28h]@6 |
5993 int v33; // [sp+140h] [bp-24h]@2 | 5973 int v33; // [sp+140h] [bp-24h]@2 |
5994 int v34; // [sp+144h] [bp-20h]@1 | 5974 int v34; // [sp+144h] [bp-20h]@1 |
5995 int v35; // [sp+148h] [bp-1Ch]@4 | 5975 int v35; // [sp+148h] [bp-1Ch]@4 |
5996 int v36; // [sp+14Ch] [bp-18h]@2 | 5976 int v36; // [sp+14Ch] [bp-18h]@2 |
5997 int v37; // [sp+154h] [bp-10h]@8 | 5977 int v37; // [sp+154h] [bp-10h]@8 |
5998 int v38; // [sp+158h] [bp-Ch]@1 | 5978 int v38; // [sp+158h] [bp-Ch]@1 |
5999 int v39; // [sp+15Ch] [bp-8h]@4 | 5979 int v39; // [sp+15Ch] [bp-8h]@4 |
6000 int v40; // [sp+160h] [bp-4h]@7 | 5980 int v40; // [sp+160h] [bp-4h]@7 |
6001 float v41; | |
6002 | 5981 |
6003 extern bool new_sky; | 5982 extern bool new_sky; |
6004 if (new_sky) | 5983 if (new_sky) |
6005 { | 5984 { |
6006 if (DrawSkyD3D_Skybox()) | 5985 if (DrawSkyD3D_Skybox()) |
6040 | 6019 |
6041 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; | 6020 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; |
6042 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; | 6021 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; |
6043 | 6022 |
6044 v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; | 6023 v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; |
6045 v31 = (signed int)(v36 / tan(0.6457717418670654) + 0.5); | 6024 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); |
6046 //v41 = v31 + 6.7553994e15; | |
6047 v33 = 65536 / v31; | |
6048 | 6025 |
6049 for (int i = 0; i < _this.uNumVertices; ++i) | 6026 for (int i = 0; i < _this.uNumVertices; ++i) |
6050 { | 6027 { |
6051 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); | 6028 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); |
6052 v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; | 6029 v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; |
6107 if ( v18 < 0 ) | 6084 if ( v18 < 0 ) |
6108 v18 = pOutdoorCamera->shading_dist_mist; | 6085 v18 = pOutdoorCamera->shading_dist_mist; |
6109 | 6086 |
6110 v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); | 6087 v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); |
6111 v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); | 6088 v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); |
6112 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; | 6089 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8; |
6113 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; | 6090 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8; |
6114 | 6091 |
6115 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; | 6092 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; |
6116 //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); | 6093 //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); |
6117 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); | 6094 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); |
6118 //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); | 6095 //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); |
6119 array_50AC10[i]._rhw = 1; | 6096 array_50AC10[i]._rhw = 1.0;// / (pOutdoorCamera->shading_dist_mist >> 16); |
6120 array_50AC10[i].u += 1.0 / 224 * pMiscTimer->uTotalGameTimeElapsed; | 6097 //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth); |
6121 array_50AC10[i].v += 1.0 / 224 * pMiscTimer->uTotalGameTimeElapsed; | 6098 //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight); |
6122 //float t = (GetTickCount() % 96000) / 96000.0f; | 6099 float t = (GetTickCount() % 96000) / 96000.0f; |
6123 //array_50AC10[i].u += t; | 6100 array_50AC10[i].u += t; |
6101 array_50AC10[i].v += t; | |
6124 if ( i == _this.uNumVertices - 1 ) | 6102 if ( i == _this.uNumVertices - 1 ) |
6125 { | 6103 { |
6126 pRenderer->DrawFan(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); | 6104 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); |
6127 | 6105 |
6128 //array_50AC10[0].vWorldViewProjY = v38; | 6106 array_50AC10[0].vWorldViewProjY = v38; |
6129 //array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; | 6107 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; |
6130 //array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; | 6108 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; |
6131 //array_50AC10[3].vWorldViewProjY = v38; | 6109 array_50AC10[3].vWorldViewProjY = v38; |
6132 | 6110 |
6133 pRenderer->DrawFan(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); | 6111 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); |
6134 return; | 6112 return; |
6135 } | 6113 } |
6136 } | 6114 } |
6137 } | 6115 } |
6138 | 6116 |
6245 } | 6223 } |
6246 while ( !v44 ); | 6224 while ( !v44 ); |
6247 uFaceID = v65; | 6225 uFaceID = v65; |
6248 } | 6226 } |
6249 v56 = 8 * uFaceID; | 6227 v56 = 8 * uFaceID; |
6250 LOBYTE(v56) = 8 * uFaceID | 6; | 6228 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); |
6251 v57 = v56; | 6229 v57 = v56; |
6252 v58 = pFace->GetTexture(); | 6230 v58 = pFace->GetTexture(); |
6253 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); |
6254 return; | 6232 return; |
6255 } | 6233 } |
11172 v15->world_y = a2; | 11150 v15->world_y = a2; |
11173 v15->world_z = a3; | 11151 v15->world_z = a3; |
11174 v15->uScreenSpaceX = a5; | 11152 v15->uScreenSpaceX = a5; |
11175 v15->uScreenSpaceY = a6; | 11153 v15->uScreenSpaceY = a6; |
11176 //v23 = 8 * uDecorationID; | 11154 //v23 = 8 * uDecorationID; |
11177 //LOBYTE(v23) = 8 * uDecorationID | OBJECT_Decoration; | 11155 //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID); |
11178 | 11156 |
11179 //v15->sZValue = v22 + v23; | 11157 //v15->sZValue = v22 + v23; |
11180 v15->actual_z = HIWORD(x); | 11158 v15->actual_z = HIWORD(x); |
11181 v15->object_pid = 8 * uDecorationID | OBJECT_Decoration; | 11159 v15->object_pid = PID(OBJECT_Decoration,uDecorationID); |
11182 | 11160 |
11183 v15->uTintColor = 0; | 11161 v15->uTintColor = 0; |
11184 v15->pSpriteFrame = v12; | 11162 v15->pSpriteFrame = v12; |
11185 } | 11163 } |
11186 } | 11164 } |
11329 v3->uScreenSpaceX = v36; | 11307 v3->uScreenSpaceX = v36; |
11330 v22 = v35; | 11308 v22 = v35; |
11331 v3->uTintColor = 0; | 11309 v3->uTintColor = 0; |
11332 v3->uScreenSpaceY = v22; | 11310 v3->uScreenSpaceY = v22; |
11333 //v23 = 8 * i; | 11311 //v23 = 8 * i; |
11334 //LOBYTE(v23) = 8 * i | OBJECT_Item; | 11312 //LOBYTE(v23) = PID(OBJECT_Item,i); |
11335 v3->pSpriteFrame = v24; | 11313 v3->pSpriteFrame = v24; |
11336 //v12 = (p->uAttributes & 0x20) == 0; | 11314 //v12 = (p->uAttributes & 0x20) == 0; |
11337 //v3->sZValue = v21 + v23; | 11315 //v3->sZValue = v21 + v23; |
11338 v3->actual_z = HIWORD(x); | 11316 v3->actual_z = HIWORD(x); |
11339 v3->object_pid = 8 * i | OBJECT_Item; | 11317 v3->object_pid = PID(OBJECT_Item,i); |
11340 if (p->uAttributes & 0x20) | 11318 if (p->uAttributes & 0x20) |
11341 { | 11319 { |
11342 if ( !pRenderer->pRenderD3D ) | 11320 if ( !pRenderer->pRenderD3D ) |
11343 v3->sZValue = 0; | 11321 v3->sZValue = 0; |
11344 } | 11322 } |
12808 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || | 12786 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || |
12809 pActors[i].uAIState == Disabled) | 12787 pActors[i].uAIState == Disabled) |
12810 ++num_dead_actors; | 12788 ++num_dead_actors; |
12811 else | 12789 else |
12812 { | 12790 { |
12813 int sumonner_type = pActors[i].uSummonerID & 7;; | 12791 int sumonner_type = PID_TYPE(pActors[i].uSummonerID); |
12814 if (sumonner_type == OBJECT_Player) | 12792 if (sumonner_type == OBJECT_Player) |
12815 ++num_dead_actors; | 12793 ++num_dead_actors; |
12816 } | 12794 } |
12817 } | 12795 } |
12818 if (num_dead_actors == uNumActors) | 12796 if (num_dead_actors == uNumActors) |
14991 v19 = 0; | 14969 v19 = 0; |
14992 for ( i = 0; v18 < v45; i = v18 ) | 14970 for ( i = 0; v18 < v45; i = v18 ) |
14993 { | 14971 { |
14994 v20 = &pActors[ai_near_actors_ids[v18]]; | 14972 v20 = &pActors[ai_near_actors_ids[v18]]; |
14995 if ( v20->uAttributes & 0x8000 | 14973 if ( v20->uAttributes & 0x8000 |
14996 || (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) ) |
14997 { | 14975 { |
14998 v22 = ai_near_actors_ids[v18]; | 14976 v22 = ai_near_actors_ids[v18]; |
14999 v20->uAttributes |= 0x8000u; | 14977 v20->uAttributes |= 0x8000u; |
15000 ai_array_4F6638_actor_ids[v19] = v22; | 14978 ai_array_4F6638_actor_ids[v19] = v22; |
15001 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; | 14979 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; |
15112 //int *v20; // esi@80 | 15090 //int *v20; // esi@80 |
15113 Actor *v21; // ebx@80 | 15091 Actor *v21; // ebx@80 |
15114 unsigned __int16 v22; // ax@86 | 15092 unsigned __int16 v22; // ax@86 |
15115 //signed int v23; // eax@94 | 15093 //signed int v23; // eax@94 |
15116 //unsigned int v24; // eax@102 | 15094 //unsigned int v24; // eax@102 |
15117 signed int v25; // edi@102 | 15095 //signed int v25; // edi@102 |
15118 SpellBuff *v26; // esi@102 | 15096 //SpellBuff *v26; // esi@102 |
15119 unsigned int v27; // ecx@123 | 15097 unsigned int v27; // ecx@123 |
15120 unsigned int v28; // eax@123 | 15098 unsigned int v28; // eax@123 |
15121 unsigned int v29; // eax@127 | 15099 //unsigned int v29; // eax@127 |
15122 AIDirection *v30; // eax@129 | 15100 AIDirection *v30; // eax@129 |
15123 unsigned __int16 v31; // ax@132 | 15101 unsigned __int16 v31; // ax@132 |
15124 unsigned int v32; // esi@142 | 15102 //unsigned int v32; // esi@142 |
15125 int v33; // eax@144 | 15103 int v33; // eax@144 |
15126 int v34; // eax@147 | 15104 int v34; // eax@147 |
15127 char v35; // al@150 | 15105 char v35; // al@150 |
15128 unsigned int v36; // edi@152 | 15106 unsigned int v36; // edi@152 |
15129 signed int v37; // eax@154 | 15107 signed int v37; // eax@154 |
15130 unsigned __int8 v38; // sf@158 | 15108 //unsigned __int8 v38; // sf@158 |
15131 unsigned __int8 v39; // of@158 | 15109 //unsigned __int8 v39; // of@158 |
15132 signed int v40; // edx@166 | 15110 //signed int v40; // edx@166 |
15133 unsigned int v41; // ecx@166 | 15111 //unsigned int v41; // ecx@166 |
15134 double v42; // st7@176 | 15112 double v42; // st7@176 |
15135 double v43; // st6@176 | 15113 double v43; // st6@176 |
15136 bool v44; // eax@189 | 15114 //bool v44; // eax@189 |
15137 bool v45; // eax@192 | 15115 bool v45; // eax@192 |
15138 unsigned __int8 v46; // cl@197 | 15116 unsigned __int8 v46; // cl@197 |
15139 double v47; // st7@206 | 15117 double v47; // st7@206 |
15140 double v48; // st7@207 | 15118 double v48; // st7@207 |
15141 char v49; // zf@208 | 15119 //char v49; // zf@208 |
15142 char v50; // zf@214 | 15120 //char v50; // zf@214 |
15143 signed int v51; // edx@219 | 15121 //signed int v51; // edx@219 |
15144 unsigned int v52; // ecx@219 | 15122 //unsigned int v52; // ecx@219 |
15145 __int16 v53; // fps@224 | 15123 __int16 v53; // fps@224 |
15146 unsigned __int8 v54; // c0@224 | 15124 //unsigned __int8 v54; // c0@224 |
15147 unsigned __int8 v55; // c3@224 | 15125 //unsigned __int8 v55; // c3@224 |
15148 double v56; // st7@226 | 15126 double v56; // st7@226 |
15149 AIDirection *v57; // eax@246 | 15127 AIDirection *v57; // eax@246 |
15150 double v58; // st7@246 | 15128 double v58; // st7@246 |
15151 signed int v59; // [sp-18h] [bp-C8h]@213 | 15129 //signed int v59; // [sp-18h] [bp-C8h]@213 |
15152 int v60; // [sp-14h] [bp-C4h]@144 | 15130 //int v60; // [sp-14h] [bp-C4h]@144 |
15153 int v61; // [sp-14h] [bp-C4h]@168 | 15131 //int v61; // [sp-14h] [bp-C4h]@168 |
15154 AIDirection *v62; // [sp-14h] [bp-C4h]@213 | 15132 //AIDirection *v62; // [sp-14h] [bp-C4h]@213 |
15155 signed int v63; // [sp-14h] [bp-C4h]@216 | 15133 //signed int v63; // [sp-14h] [bp-C4h]@216 |
15156 unsigned int v64; // [sp-14h] [bp-C4h]@219 | 15134 unsigned int v64; // [sp-14h] [bp-C4h]@219 |
15157 unsigned int v65; // [sp-10h] [bp-C0h]@144 | 15135 unsigned int v65; // [sp-10h] [bp-C0h]@144 |
15158 char v66; // [sp-10h] [bp-C0h]@147 | 15136 char v66; // [sp-10h] [bp-C0h]@147 |
15159 AIDirection *v67; // [sp-10h] [bp-C0h]@167 | 15137 //AIDirection *v67; // [sp-10h] [bp-C0h]@167 |
15160 int v68; // [sp-10h] [bp-C0h]@168 | 15138 //int v68; // [sp-10h] [bp-C0h]@168 |
15161 AIDirection *v69; // [sp-10h] [bp-C0h]@206 | 15139 //AIDirection *v69; // [sp-10h] [bp-C0h]@206 |
15162 int v70; // [sp-10h] [bp-C0h]@213 | 15140 int v70; // [sp-10h] [bp-C0h]@213 |
15163 AIDirection *v71; // [sp-10h] [bp-C0h]@216 | 15141 //AIDirection *v71; // [sp-10h] [bp-C0h]@216 |
15164 AIDirection v72; // [sp+0h] [bp-B0h]@246 | 15142 AIDirection v72; // [sp+0h] [bp-B0h]@246 |
15165 AIDirection a3; // [sp+1Ch] [bp-94h]@129 | 15143 AIDirection a3; // [sp+1Ch] [bp-94h]@129 |
15166 AIDirection v74; // [sp+38h] [bp-78h]@246 | 15144 AIDirection v74; // [sp+38h] [bp-78h]@246 |
15167 AIDirection v75; // [sp+54h] [bp-5Ch]@129 | 15145 AIDirection v75; // [sp+54h] [bp-5Ch]@129 |
15168 int v76; // [sp+70h] [bp-40h]@83 | 15146 int target_pid_type; // [sp+70h] [bp-40h]@83 |
15169 signed int a1; // [sp+74h] [bp-3Ch]@129 | 15147 signed int a1; // [sp+74h] [bp-3Ch]@129 |
15170 int v78; // [sp+78h] [bp-38h]@79 | 15148 int v78; // [sp+78h] [bp-38h]@79 |
15171 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 | 15149 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 |
15172 float v80; // [sp+98h] [bp-18h]@33 | 15150 float v80; // [sp+98h] [bp-18h]@33 |
15173 int v81; // [sp+9Ch] [bp-14h]@100 | 15151 int v81; // [sp+9Ch] [bp-14h]@100 |
15174 int v82; // [sp+A0h] [bp-10h]@45 | 15152 //int v82; // [sp+A0h] [bp-10h]@45 |
15175 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 | 15153 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 |
15176 unsigned int v84; // [sp+A8h] [bp-8h]@11 | 15154 unsigned int v84; // [sp+A8h] [bp-8h]@11 |
15177 signed int a2; // [sp+ACh] [bp-4h]@83 | 15155 signed int target_pid; // [sp+ACh] [bp-4h]@83 |
15156 AIState uAIState; | |
15157 int v38; | |
15178 | 15158 |
15179 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 15159 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
15180 MakeActorAIList_ODM(); | 15160 MakeActorAIList_ODM(); |
15181 else | 15161 else |
15182 MakeActorAIList_BLV(); | 15162 MakeActorAIList_BLV(); |
15183 | 15163 |
15184 //v0 = 0; | 15164 //v0 = 0; |
15185 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) | 15165 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) |
15186 { | 15166 { |
15187 if ( pParty->armageddon_timer > 417 ) | 15167 if ( pParty->armageddon_timer > 417 ) |
15194 v1 = rand(); | 15174 v1 = rand(); |
15195 v2 = 128; | 15175 v2 = 128; |
15196 v3 = pParty->sRotationX + v1 % 16 - 8; | 15176 v3 = pParty->sRotationX + v1 % 16 - 8; |
15197 pParty->sRotationX = v3; | 15177 pParty->sRotationX = v3; |
15198 if ( v3 > 128 || (v2 = -128, v3 < -128) ) | 15178 if ( v3 > 128 || (v2 = -128, v3 < -128) ) |
15199 pParty->sRotationX = v2; | 15179 pParty->sRotationX = v2; |
15200 pParty->uFlags |= 2u; | 15180 pParty->uFlags |= 2u; |
15201 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | 15181 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; |
15202 v4 = pParty->field_16140 + 50; | 15182 v4 = pParty->field_16140 + 50; |
15203 if ( pParty->armageddon_timer <= 0 ) | 15183 if ( pParty->armageddon_timer <= 0 ) |
15204 { | 15184 { |
15216 v5->sCurrentHP = v7; | 15196 v5->sCurrentHP = v7; |
15217 if ( v6 ) | 15197 if ( v6 ) |
15218 { | 15198 { |
15219 if ( v7 >= 0 ) | 15199 if ( v7 >= 0 ) |
15220 { | 15200 { |
15221 Actor::_4030AD(v84, 4, 0); | 15201 Actor::Stun(v84, 4, 0); |
15222 } | 15202 } |
15223 else | 15203 else |
15224 { | 15204 { |
15225 Actor::Die(v84); | 15205 Actor::Die(v84); |
15226 if ( v5->pMonsterInfo.uExp ) | 15206 if ( v5->pMonsterInfo.uExp ) |
15227 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); | 15207 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); |
15228 } | 15208 } |
15229 } | 15209 } |
15230 } | 15210 } |
15231 ++v84; | 15211 ++v84; |
15232 ++v5; | 15212 ++v5; |
15236 v8 = &pPlayers[1]; | 15216 v8 = &pPlayers[1]; |
15237 do | 15217 do |
15238 { | 15218 { |
15239 pPlayer = *v8; | 15219 pPlayer = *v8; |
15240 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | 15220 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) |
15241 pPlayer->ReceiveDamage(v4, 5); | 15221 pPlayer->ReceiveDamage(v4, 5); |
15242 ++v8; | 15222 ++v8; |
15243 } | 15223 } |
15244 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | 15224 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); |
15245 //v0 = 0; | 15225 //v0 = 0; |
15246 } | 15226 } |
15247 if (pTurnEngine->field_1C) | 15227 if (pTurnEngine->field_1C) |
15248 --pTurnEngine->field_1C; | 15228 --pTurnEngine->field_1C; |
15249 } | 15229 } |
15250 } | 15230 } |
15251 | 15231 |
15252 if (pParty->bTurnBasedModeOn) | 15232 if (pParty->bTurnBasedModeOn) |
15253 { | 15233 { |
15266 //pActor = (Actor *)(LODWORD(v80) - 176); | 15246 //pActor = (Actor *)(LODWORD(v80) - 176); |
15267 //v11 = *(unsigned int *)LODWORD(v80); | 15247 //v11 = *(unsigned int *)LODWORD(v80); |
15268 //v49 = *(unsigned int *)LODWORD(v80) == 5; | 15248 //v49 = *(unsigned int *)LODWORD(v80) == 5; |
15269 ai_near_actors_targets_pid[i] = OBJECT_Player; | 15249 ai_near_actors_targets_pid[i] = OBJECT_Player; |
15270 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) |
15271 continue; | 15251 continue; |
15272 | 15252 |
15273 if (!actor->sCurrentHP && actor->uAIState != Dying) | 15253 if (!actor->sCurrentHP && actor->uAIState != Dying) |
15274 Actor::Die(i); | 15254 Actor::Die(i); |
15275 | 15255 |
15276 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | 15256 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; |
15277 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | 15257 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; |
15278 //v12 = 0; | 15258 //v12 = 0; |
15279 //v13 = 0; | 15259 //v13 = 0; |
15292 } | 15272 } |
15293 ++v13; | 15273 ++v13; |
15294 ++v14; | 15274 ++v14; |
15295 } | 15275 } |
15296 while ( v13 < 22 );*/ | 15276 while ( v13 < 22 );*/ |
15297 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) | 15277 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) |
15298 //&& 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 |
15299 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | 15279 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) |
15300 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; | 15280 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; |
15301 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) | 15281 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
15302 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15282 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15303 else | 15283 // not sure |
15304 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; | |
15305 | 15286 |
15306 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || | 15287 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 |
15307 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) | 15288 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) |
15308 continue; | 15289 continue; |
15309 | 15290 |
15310 //v15 = pMiscTimer->uTimeElapsed; | 15291 //v15 = pMiscTimer->uTimeElapsed; |
15311 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | 15292 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; |
15312 //v17 = pActor->uCurrentActionTime; | 15293 //v17 = pActor->uCurrentActionTime; |
15313 //v18 = pActor->pMonsterInfo.uRecoveryTime; | 15294 //v18 = pActor->pMonsterInfo.uRecoveryTime; |
15314 if (actor->pMonsterInfo.uRecoveryTime) | 15295 if (actor->pMonsterInfo.uRecoveryTime) |
15315 { | 15296 { |
15316 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | 15297 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) |
15317 actor->pMonsterInfo.uRecoveryTime = 0; | 15298 actor->pMonsterInfo.uRecoveryTime = 0; |
15318 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | 15299 else |
15300 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | |
15319 } | 15301 } |
15320 | 15302 |
15321 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15303 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
15322 if (actor->uCurrentActionTime < actor->uCurrentActionLength) | 15304 if (actor->uCurrentActionTime < actor->uCurrentActionLength) |
15323 continue; | 15305 continue; |
15324 | 15306 |
15325 //v19 = actor->uAIState; | 15307 //v19 = actor->uAIState; |
15326 if (actor->uAIState == Dying) | 15308 if (actor->uAIState == Dying) |
15327 actor->uAIState = Dead; | 15309 actor->uAIState = Dead; |
15328 else | 15310 else |
15329 { | 15311 { |
15330 if (actor->uAIState != Summoned) | 15312 if (actor->uAIState != Summoned) |
15331 { | 15313 { |
15332 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | 15314 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); |
15358 | 15340 |
15359 //v20 = &ai_near_actors_targets_pid[actor_id]; | 15341 //v20 = &ai_near_actors_targets_pid[actor_id]; |
15360 v21 = &pActors[actor_id]; | 15342 v21 = &pActors[actor_id]; |
15361 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); |
15362 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | 15344 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) |
15363 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15345 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15364 a2 = ai_near_actors_targets_pid[actor_id]; | 15346 target_pid = ai_near_actors_targets_pid[actor_id]; |
15365 v76 = a2 & 7; | 15347 target_pid_type = PID_TYPE(target_pid); |
15366 if ( (a2 & 7) == OBJECT_Actor) | 15348 if ( target_pid_type == OBJECT_Actor) |
15367 v80 = 0.5; | 15349 v80 = 0.5; |
15368 else | 15350 else |
15369 v80 = 1.0; | 15351 v80 = 1.0; |
15370 v22 = v21->uAIState; | 15352 v22 = v21->uAIState; |
15371 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | 15353 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) |
15372 { | 15354 { |
15373 continue; | 15355 continue; |
15374 } | 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 } | |
15375 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 ) | |
15376 { | 15412 { |
15377 if ( !v21->sCurrentHP ) | 15413 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) |
15378 Actor::Die(actor_id); | |
15379 v25 = 0; | |
15380 v26 = v21->pActorBuffs; | |
15381 do | |
15382 { | |
15383 if ( v25 != 10 ) | |
15384 { | |
15385 v26->_4585CA(pParty->uTimePlayed); | |
15386 //v24 = 0; | |
15387 } | |
15388 ++v25; | |
15389 ++v26; | |
15390 } | |
15391 while ( v25 < 22 ); | |
15392 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 | |
15393 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0 | |
15394 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0 | |
15395 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) ) | |
15396 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | |
15397 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) | |
15398 { | |
15399 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
15400 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) | |
15401 { | |
15402 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 | |
15403 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) | |
15404 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | |
15405 } | |
15406 } | |
15407 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 | |
15408 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 | |
15409 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 | |
15410 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) | |
15411 { | |
15412 v21->uAIState = Removed; | |
15413 continue; | |
15414 } | |
15415 else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) | |
15416 { | 15414 { |
15417 continue; | 15415 continue; |
15418 } | 15416 } |
15419 else | 15417 else if ( v21->uAIState == AttackingMelee ) |
15420 { | 15418 { |
15421 v27 = pMiscTimer->uTimeElapsed; | 15419 v35 = stru_50C198.special_ability_use_check(v21, actor_id); |
15422 v28 = v21->pMonsterInfo.uRecoveryTime; | 15420 stru_50FE08.Add( |
15423 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15421 a1, |
15424 if ( (signed int)v28 > 0 ) | 15422 5120, |
15425 v21->pMonsterInfo.uRecoveryTime = v28 - v27; | 15423 v21->vPosition.x, |
15426 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) | 15424 v21->vPosition.y, |
15427 v21->pMonsterInfo.uRecoveryTime = 0; | 15425 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), |
15428 v29 = v21->uAttributes; | 15426 v35, |
15429 if ( !(v29 & 0x8000) ) | 15427 1 |
15430 v21->uAttributes = v29 | 0x8000; | 15428 ); |
15431 a1 = 8 * actor_id | OBJECT_Actor; | 15429 } |
15432 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0); | 15430 else if ( v21->uAIState == AttackingRanged1 ) |
15433 v49 = v21->pMonsterInfo.uHostilityType == 0; | 15431 { |
15434 memcpy(&v75, v30, sizeof(v75)); | 15432 v34 = v21->pMonsterInfo.uMissleAttack1Type; |
15435 memcpy(&pDir, &v75, sizeof(pDir)); | 15433 Actor::RangedAttack(actor_id, &pDir, v34, 0); |
15436 if ( !v49 | 15434 } |
15437 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 | 15435 else if ( v21->uAIState == AttackingRanged2 ) |
15438 && v80 * 307.2 >= (double)(signed int)v75.uDistance | 15436 { |
15439 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9) | 15437 v34 = v21->pMonsterInfo.uMissleAttack2Type; |
15440 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 ) | 15438 Actor::RangedAttack(actor_id, &pDir, v34, 1); |
15441 { | 15439 } |
15442 v32 = actor_id; | 15440 else if ( v21->uAIState == AttackingRanged3 ) |
15443 } | 15441 { |
15444 else | 15442 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; |
15445 { | 15443 v33 = v21->pMonsterInfo.uSpell1ID; |
15446 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) | 15444 Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); |
15447 { | 15445 } |
15448 continue; | 15446 else if ( v21->uAIState == AttackingRanged4 ) |
15449 } | 15447 { |
15450 else if ( v21->uAIState == 2 ) | 15448 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; |
15451 { | 15449 v33 = v21->pMonsterInfo.uSpell2ID; |
15452 v32 = actor_id; | 15450 Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); |
15453 v35 = stru_50C198.special_ability_use_check(v21, actor_id); | |
15454 stru_50FE08.Add( | |
15455 a1, | |
15456 5120, | |
15457 v21->vPosition.x, | |
15458 v21->vPosition.y, | |
15459 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), | |
15460 v35, | |
15461 1 | |
15462 ); | |
15463 } | |
15464 else if ( v21->uAIState == 3 ) | |
15465 { | |
15466 v34 = v21->pMonsterInfo.uMissleAttack1Type; | |
15467 v66 = 0; | |
15468 v32 = actor_id; | |
15469 Actor::_404874(actor_id, &pDir, v34, v66); | |
15470 } | |
15471 else if ( v21->uAIState == 12 ) | |
15472 { | |
15473 v34 = v21->pMonsterInfo.uMissleAttack2Type; | |
15474 v66 = 1; | |
15475 v32 = actor_id; | |
15476 Actor::_404874(actor_id, &pDir, v34, v66); | |
15477 } | |
15478 else | |
15479 { | |
15480 v32 = actor_id; | |
15481 if ( v21->uAIState == 13 ) | |
15482 { | |
15483 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; | |
15484 v60 = 2; | |
15485 v33 = v21->pMonsterInfo.uSpell1ID; | |
15486 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); | |
15487 } | |
15488 else if ( v21->uAIState == 18 ) | |
15489 { | |
15490 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; | |
15491 v60 = 3; | |
15492 v33 = v21->pMonsterInfo.uSpell2ID; | |
15493 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); | |
15494 } | |
15495 } | |
15496 } | |
15497 } | 15451 } |
15498 } | 15452 } |
15453 | |
15499 v36 = v75.uDistance; | 15454 v36 = v75.uDistance; |
15500 if ( !v21->pMonsterInfo.uHostilityType ) | 15455 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) |
15501 { | 15456 { |
15502 if ( v76 == 3 ) | 15457 if ( target_pid_type == OBJECT_Actor ) |
15503 { | 15458 { |
15504 v36 = v75.uDistance; | 15459 v36 = v75.uDistance; |
15505 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] | 15460 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] |
15506 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); | 15461 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); |
15507 } | 15462 } |
15508 else | 15463 else |
15509 { | 15464 { |
15510 v37 = 4; | 15465 v37 = 4; |
15511 } | 15466 } |
15467 v38=0; | |
15512 if ( v37 == 2 ) | 15468 if ( v37 == 2 ) |
15513 { | 15469 { |
15514 v39 = __OFSUB__(v36, 1024); | 15470 //v39 = __OFSUB__(v36, 1024); |
15515 v38 = ((v36 - 1024) & 0x80000000u) != 0; | 15471 //v38 = ((v36 - 1024) & 0x80000000u) != 0; |
15472 v38 = 1024; | |
15516 } | 15473 } |
15517 else if ( v37 == 3 ) | 15474 else if ( v37 == 3 ) |
15518 { | 15475 { |
15519 v39 = __OFSUB__(v36, 2560); | 15476 //v39 = __OFSUB__(v36, 2560); |
15520 v38 = ((v36 - 2560) & 0x80000000u) != 0; | 15477 //v38 = ((v36 - 2560) & 0x80000000u) != 0; |
15478 v38 = 2560; | |
15521 } | 15479 } |
15522 else if ( v37 == 4 ) | 15480 else if ( v37 == 4 ) |
15523 { | 15481 { |
15524 v39 = __OFSUB__(v36, 5120); | 15482 //v39 = __OFSUB__(v36, 5120); |
15525 v38 = ((v36 - 5120) & 0x80000000u) != 0; | 15483 //v38 = ((v36 - 5120) & 0x80000000u) != 0; |
15484 v38 = 5120; | |
15526 } | 15485 } |
15527 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) | 15486 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) |
15528 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | 15487 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
15529 } | 15488 } |
15489 | |
15530 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) | 15490 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) |
15531 { | 15491 { |
15532 v40 = a2; | |
15533 v41 = v32; | |
15534 if ( (signed int)v36 >= 10240 ) | 15492 if ( (signed int)v36 >= 10240 ) |
15535 { | 15493 { |
15536 v68 = 0; | 15494 Actor::_4032B2(actor_id, target_pid, 1024, 0); |
15537 v61 = 1024; | |
15538 Actor::_4032B2(v41, v40, v61, v68); | |
15539 continue; | |
15540 } | 15495 } |
15541 v67 = &pDir; | 15496 else |
15542 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 } | |
15543 continue; | 15502 continue; |
15544 } | 15503 } |
15545 if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) | 15504 |
15505 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) | |
15546 { | 15506 { |
15547 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) | 15507 |
15508 if ( v21->pMonsterInfo.uAIType == 1 ) | |
15548 { | 15509 { |
15549 if ( v21->pMonsterInfo.uAIType == 1 ) | 15510 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15550 { | 15511 { |
15551 v67 = &pDir; | 15512 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); |
15552 if ( v21->pMonsterInfo.uMovementType != 5 ) | |
15553 { | |
15554 v40 = a2; | |
15555 v41 = v32; | |
15556 Actor::_402968(v41, v40, 0, v67); | |
15557 continue; | |
15558 } | |
15559 Actor::AI_Stand( | |
15560 v32, | |
15561 a2, | |
15562 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), | |
15563 &pDir); | |
15564 } | 15513 } |
15565 else | 15514 else |
15566 { | 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 { | |
15567 if ( v21->pMonsterInfo.uAIType == 2 ) | 15525 if ( v21->pMonsterInfo.uAIType == 2 ) |
15568 { | |
15569 v84 = v21->sCurrentHP; | |
15570 v42 = (double)(signed int)v84; | |
15571 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; | 15526 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; |
15572 } | 15527 if ( v21->pMonsterInfo.uAIType == 3 ) |
15573 else | |
15574 { | |
15575 v84 = v21->sCurrentHP; | |
15576 v42 = (double)(signed int)v84; | |
15577 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; | 15528 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; |
15578 } | 15529 v84 = v21->sCurrentHP; |
15579 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) | 15530 v42 = (double)(signed int)v84; |
15580 if ( v43 > v42 && (signed int)v36 < 10240 ) | 15531 if ( v43 > v42 && (signed int)v36 < 10240 ) |
15581 { | 15532 { |
15582 v67 = &pDir; | 15533 Actor::Flee(actor_id, target_pid, 0, &pDir); |
15583 v40 = a2; | |
15584 v41 = v32; | |
15585 Actor::_402968(v41, v40, 0, v67); | |
15586 continue; | 15534 continue; |
15587 } | 15535 } |
15588 } | 15536 } |
15589 } | 15537 } |
15538 | |
15590 v81 = v36 - v21->uActorRadius; | 15539 v81 = v36 - v21->uActorRadius; |
15591 if ( v76 == 3 ) | 15540 if ( target_pid_type == OBJECT_Actor ) |
15592 v81 -= pActors[a2 >> 3].uActorRadius; | 15541 v81 -= pActors[PID_ID(target_pid)].uActorRadius; |
15593 if ( v81 < 0 ) | 15542 if ( v81 < 0 ) |
15594 v81 = 0; | 15543 v81 = 0; |
15595 rand(); | 15544 rand(); |
15596 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0; | |
15597 v21->uAttributes &= 0xFBFFFF; | 15545 v21->uAttributes &= 0xFBFFFF; |
15598 v82 = 0; | |
15599 v49 = v21->pMonsterInfo.uMovementType == 5; | |
15600 v84 = v44; | |
15601 if ( v49 ) | |
15602 v82 = 1; | |
15603 if ( v81 < 5120 ) | 15546 if ( v81 < 5120 ) |
15604 { | 15547 { |
15605 v45 = stru_50C198.special_ability_use_check(v21, v32); | 15548 v45 = stru_50C198.special_ability_use_check(v21, actor_id); |
15606 if ( !v45 ) | 15549 if ( v45 == 0 ) |
15607 { | 15550 { |
15608 if ( v21->pMonsterInfo.uMissleAttack1Type ) | 15551 if ( v21->pMonsterInfo.uMissleAttack1Type ) |
15609 { | 15552 { |
15610 if ( v84 ) | 15553 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) |
15611 { | 15554 { |
15612 Actor::_403476(v32, a2, &pDir); | 15555 Actor::MissileAttack1(actor_id, target_pid, &pDir); |
15613 continue; | |
15614 | |
15615 } | 15556 } |
15616 if ( v82 ) | 15557 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15617 { | 15558 { |
15618 v69 = &pDir; | |
15619 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15559 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15620 v51 = a2; | |
15621 v64 = (signed __int64)v47; | 15560 v64 = (signed __int64)v47; |
15622 v52 = v32; | 15561 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15623 Actor::AI_Stand(v52, v51, v64, v69); | |
15624 continue; | |
15625 } | 15562 } |
15626 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15563 else |
15627 //UNDEF(v53); | |
15628 v69 = &pDir; | |
15629 if ( !(v54 | v55) ) | |
15630 { | 15564 { |
15631 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; | |
15632 v64 = (signed __int64)v47; | 15614 v64 = (signed __int64)v47; |
15633 v52 = v32; | 15615 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15634 Actor::AI_Stand(v52, v51, v64, v69); | |
15635 continue; | |
15636 } | 15616 } |
15637 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | 15617 else |
15638 continue; | 15618 { |
15619 //monsters | |
15620 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15621 } | |
15639 } | 15622 } |
15640 v56 = v80 * 307.2; | |
15641 if ( (double)v81 >= v56 ) | |
15642 { | |
15643 if ( v81 >= 1024 ) | |
15644 { | |
15645 if ( v82 ) | |
15646 { | |
15647 v69 = &pDir; | |
15648 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15649 v51 = a2; | |
15650 v64 = (signed __int64)v47; | |
15651 v52 = v32; | |
15652 Actor::AI_Stand(v52, v51, v64, v69); | |
15653 continue; | |
15654 } | |
15655 v71 = &pDir; | |
15656 v63 = 0; | |
15657 | |
15658 Actor::_402686(v32, a2, v63, v71); | |
15659 continue; | |
15660 } | |
15661 if ( v82 ) | |
15662 { | |
15663 v69 = &pDir; | |
15664 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15665 v51 = a2; | |
15666 v64 = (signed __int64)v47; | |
15667 v52 = v32; | |
15668 Actor::AI_Stand(v52, v51, v64, v69); | |
15669 continue; | |
15670 } | |
15671 v70 = (signed __int64)v56; | |
15672 v62 = &pDir; | |
15673 v59 = 0; | |
15674 Actor::_40281C(v32, a2, v59, v62, v70); | |
15675 continue; | |
15676 } | |
15677 v49 = v84 == 0; | |
15678 v69 = &pDir; | |
15679 if ( v49 ) | |
15680 { | |
15681 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15682 v51 = a2; | |
15683 v64 = (signed __int64)v47; | |
15684 v52 = v32; | |
15685 Actor::AI_Stand(v52, v51, v64, v69); | |
15686 continue; | |
15687 } | |
15688 Actor::_403C6C(v32, a2, &pDir); | |
15689 continue; | 15623 continue; |
15690 } | 15624 } |
15691 if ( v45 != 1 ) | 15625 else if ( v45 == 2 || v45 == 3 ) |
15692 { | 15626 { |
15693 if ( v45 > 1 && v45 <= 3 ) | 15627 if ( v45 == 2 ) |
15628 v46 = v21->pMonsterInfo.uSpell1ID; | |
15629 else | |
15630 v46 = v21->pMonsterInfo.uSpell2ID; | |
15631 if ( v46 ) | |
15694 { | 15632 { |
15695 if ( v45 == 2 ) | 15633 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) |
15696 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 } | |
15697 else | 15646 else |
15698 v46 = v21->pMonsterInfo.uSpell2ID; | |
15699 if ( v46 ) | |
15700 { | 15647 { |
15701 if ( v84 ) | |
15702 { | |
15703 if ( v45 == 2 ) | |
15704 Actor::_403854(v32, a2, &pDir); | |
15705 else | |
15706 Actor::_403A60(v32, a2, &pDir); | |
15707 continue; | |
15708 } | |
15709 if ( v80 * 307.2 > (double)v81 || v82 ) | |
15710 { | |
15711 v69 = &pDir; | |
15712 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15713 v51 = a2; | |
15714 v64 = (signed __int64)v47; | |
15715 v52 = v32; | |
15716 Actor::AI_Stand(v52, v51, v64, v69); | |
15717 continue; | |
15718 | |
15719 } | |
15720 v69 = &pDir; | |
15721 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15648 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15722 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | 15649 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
15723 continue; | |
15724 } | 15650 } |
15651 } | |
15652 else | |
15653 { | |
15725 v48 = v80 * 307.2; | 15654 v48 = v80 * 307.2; |
15726 if ( (double)v81 >= v48 ) | 15655 if ( (double)v81 >= v48 ) |
15727 { | 15656 { |
15728 if ( v81 >= 1024 ) | 15657 if ( v81 >= 1024 ) |
15729 { | 15658 { |
15730 v50 = v82 == 0; | 15659 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15731 if ( !v50 ) | |
15732 { | 15660 { |
15733 v69 = &pDir; | |
15734 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15661 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15735 v51 = a2; | |
15736 v64 = (signed __int64)v47; | 15662 v64 = (signed __int64)v47; |
15737 v52 = v32; | 15663 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15738 Actor::AI_Stand(v52, v51, v64, v69); | |
15739 continue; | |
15740 } | 15664 } |
15741 v71 = &pDir; | 15665 else |
15742 v63 = 256; | 15666 { |
15743 Actor::_402686(v32, a2, v63, v71); | 15667 Actor::Pursue3(actor_id, target_pid, 256, &pDir); |
15744 continue; | 15668 } |
15745 | |
15746 } | 15669 } |
15747 if ( v82 ) | 15670 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15748 { | 15671 { |
15749 v69 = &pDir; | |
15750 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15672 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15751 v51 = a2; | |
15752 v64 = (signed __int64)v47; | 15673 v64 = (signed __int64)v47; |
15753 v52 = v32; | 15674 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15754 Actor::AI_Stand(v52, v51, v64, v69); | |
15755 continue; | |
15756 } | 15675 } |
15757 v70 = (signed __int64)v48; | 15676 else |
15758 v62 = &pDir; | 15677 { |
15759 v59 = 0; | 15678 v70 = (signed __int64)v48; |
15760 Actor::_40281C(v32, a2, v59, v62, v70); | 15679 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); |
15761 continue; | 15680 } |
15762 } | 15681 } |
15763 v49 = v84 == 0; | 15682 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15764 v69 = &pDir; | |
15765 if ( v49 ) | |
15766 { | 15683 { |
15767 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15684 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15768 v51 = a2; | |
15769 v64 = (signed __int64)v47; | 15685 v64 = (signed __int64)v47; |
15770 v52 = v32; | 15686 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15771 Actor::AI_Stand(v52, v51, v64, v69); | |
15772 continue; | |
15773 } | 15687 } |
15774 Actor::_403C6C(v32, a2, &pDir); | 15688 else |
15775 continue; | 15689 { |
15690 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15691 } | |
15776 } | 15692 } |
15693 continue; | |
15777 } | 15694 } |
15778 } | 15695 } |
15779 } | 15696 } |
15780 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 ) | |
15781 { | 15699 { |
15782 if ( !v21->pMonsterInfo.uMovementType ) | 15700 if ( !v21->pMonsterInfo.uMovementType ) |
15783 { | 15701 { |
15784 v68 = 0; | 15702 Actor::_4032B2(actor_id, 4, 1024, 0); |
15785 v61 = 1024; | |
15786 v41 = v32; | |
15787 v40 = 4; | |
15788 Actor::_4032B2(v41, v40, v61, v68); | |
15789 continue; | |
15790 | |
15791 } | 15703 } |
15792 if ( v21->pMonsterInfo.uMovementType == 1 ) | 15704 else if ( v21->pMonsterInfo.uMovementType == 1 ) |
15793 { | 15705 { |
15794 v68 = 0; | 15706 Actor::_4032B2(actor_id, 4, 2560, 0); |
15795 v61 = 2560; | |
15796 v41 = v32; | |
15797 v40 = 4; | |
15798 Actor::_4032B2(v41, v40, v61, v68); | |
15799 continue; | |
15800 } | 15707 } |
15801 if ( v21->pMonsterInfo.uMovementType == 2 ) | 15708 else if ( v21->pMonsterInfo.uMovementType == 2 ) |
15802 { | 15709 { |
15803 v68 = 0; | 15710 Actor::_4032B2(actor_id, 4, 5120, 0); |
15804 v61 = 5120; | |
15805 v41 = v32; | |
15806 v40 = 4; | |
15807 Actor::_4032B2(v41, v40, v61, v68); | |
15808 continue; | |
15809 } | 15711 } |
15810 if ( v21->pMonsterInfo.uMovementType == 4 ) | 15712 else if ( v21->pMonsterInfo.uMovementType == 4 ) |
15811 { | 15713 { |
15812 v68 = 0; | 15714 Actor::_4032B2(actor_id, 4, 10240, 0); |
15813 v61 = 10240; | |
15814 v41 = v32; | |
15815 v40 = 4; | |
15816 Actor::_4032B2(v41, v40, v61, v68); | |
15817 continue; | |
15818 } | 15715 } |
15819 if ( v21->pMonsterInfo.uMovementType == 5 ) | 15716 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15820 { | 15717 { |
15821 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | 15718 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); |
15822 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15719 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15823 memcpy(&v74, v57, sizeof(v74)); | 15720 memcpy(&v74, v57, sizeof(v74)); |
15824 memcpy(&pDir, &v74, sizeof(pDir)); | 15721 memcpy(&pDir, &v74, sizeof(pDir)); |
15825 v69 = &pDir; | |
15826 v52 = actor_id; | |
15827 v64 = (signed __int64)v58; | 15722 v64 = (signed __int64)v58; |
15828 v51 = 4; | 15723 Actor::AI_Stand(actor_id, 4, v64, &pDir); |
15829 Actor::AI_Stand(v52, v51, v64, v69); | 15724 } |
15830 continue; | |
15831 } | |
15832 continue; | |
15833 | |
15834 } | 15725 } |
15835 if ( !v21->pMonsterInfo.uMissleAttack2Type ) | 15726 else if ( !v21->pMonsterInfo.uMissleAttack2Type ) |
15836 { | 15727 { |
15837 v56 = v80 * 307.2; | 15728 v56 = v80 * 307.2; |
15838 if ( (double)v81 >= v56 ) | 15729 if ( (double)v81 >= v56 ) |
15839 { | 15730 { |
15840 if ( v81 >= 1024 ) | 15731 if ( v81 >= 1024 ) |
15841 { | 15732 { |
15842 v50 = v82 == 0; | 15733 if ( v21->pMonsterInfo.uMovementType == 5 ) |
15843 if ( !v50 ) | |
15844 { | 15734 { |
15845 v69 = &pDir; | |
15846 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15735 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15847 v51 = a2; | |
15848 v64 = (signed __int64)v47; | 15736 v64 = (signed __int64)v47; |
15849 v52 = v32; | 15737 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15850 Actor::AI_Stand(v52, v51, v64, v69); | |
15851 continue; | |
15852 } | 15738 } |
15853 v71 = &pDir; | 15739 else |
15854 v63 = 256; | 15740 { |
15855 Actor::_402686(v32, a2, v63, v71); | 15741 Actor::Pursue3(actor_id, target_pid, 256, &pDir); |
15856 continue; | 15742 } |
15857 } | 15743 } |
15858 if ( v82 ) | 15744 else if ( v21->pMonsterInfo.uMovementType == 5 ) |
15859 { | 15745 { |
15860 v69 = &pDir; | |
15861 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15746 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15862 v51 = a2; | |
15863 v64 = (signed __int64)v47; | 15747 v64 = (signed __int64)v47; |
15864 v52 = v32; | 15748 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15865 Actor::AI_Stand(v52, v51, v64, v69); | |
15866 continue; | |
15867 } | 15749 } |
15868 v70 = (signed __int64)v56; | 15750 else |
15869 v62 = &pDir; | 15751 { |
15870 v59 = 0; | 15752 v70 = (signed __int64)v56; |
15871 Actor::_40281C(v32, a2, v59, v62, v70); | 15753 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); |
15872 continue; | 15754 } |
15873 | |
15874 } | 15755 } |
15875 v49 = v84 == 0; | 15756 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15876 v69 = &pDir; | |
15877 if ( v49 ) | |
15878 { | 15757 { |
15879 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15758 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15880 v51 = a2; | |
15881 v64 = (signed __int64)v47; | 15759 v64 = (signed __int64)v47; |
15882 v52 = v32; | 15760 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15883 Actor::AI_Stand(v52, v51, v64, v69); | |
15884 continue; | |
15885 } | 15761 } |
15886 Actor::_403C6C(v32, a2, &pDir); | 15762 else |
15887 continue; | 15763 { |
15764 Actor::MeleeAttack(actor_id, target_pid, &pDir); | |
15765 } | |
15888 } | 15766 } |
15889 if ( !v84 ) | 15767 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) |
15890 { | 15768 { |
15891 if ( v82 ) | 15769 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15770 if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) | |
15892 { | 15771 { |
15893 v69 = &pDir; | |
15894 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15895 v51 = a2; | |
15896 v64 = (signed __int64)v47; | 15772 v64 = (signed __int64)v47; |
15897 v52 = v32; | 15773 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15898 Actor::AI_Stand(v52, v51, v64, v69); | |
15899 continue; | |
15900 } | 15774 } |
15901 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15775 else |
15902 //UNDEF(v53); | |
15903 v69 = &pDir; | |
15904 if ( !(v54 | v55) ) | |
15905 { | 15776 { |
15906 v51 = a2; | 15777 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
15907 v64 = (signed __int64)v47; | |
15908 v52 = v32; | |
15909 Actor::AI_Stand(v52, v51, v64, v69); | |
15910 continue; | |
15911 } | 15778 } |
15912 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | |
15913 continue; | |
15914 } | 15779 } |
15915 Actor::_40368B(v32, a2, &pDir); | 15780 else |
15781 { | |
15782 Actor::MissileAttack2(actor_id, target_pid, &pDir); | |
15783 } | |
15916 } | 15784 } |
15917 } | 15785 } |
15918 } | 15786 } |
15919 | 15787 |
15920 //----- (0040261D) -------------------------------------------------------- | 15788 //----- (0040261D) -------------------------------------------------------- |
15987 if ( this->uActorQueueSize > 0 ) | 15855 if ( this->uActorQueueSize > 0 ) |
15988 { | 15856 { |
15989 v2 = this->pQueue; | 15857 v2 = this->pQueue; |
15990 do | 15858 do |
15991 { | 15859 { |
15992 if ( (v2->uPackedID & 7) == OBJECT_Actor ) | 15860 if ( PID_TYPE(v2->uPackedID) == OBJECT_Actor ) |
15993 { | 15861 { |
15994 v3 = &pActors[v2->uPackedID >> 3]; | 15862 v3 = &pActors[PID_ID(v2->uPackedID)]; |
15995 v4 = &pActors[v2->uPackedID >> 3]; | 15863 v4 = &pActors[PID_ID(v2->uPackedID)]; |
15996 LOBYTE(v4->uAttributes) |= 0x80u; | 15864 LOBYTE(v4->uAttributes) |= 0x80u; |
15997 if ( !v4->CanAct() ) | 15865 if ( !v4->CanAct() ) |
15998 { | 15866 { |
15999 --v19; | 15867 --v19; |
16000 v2->field_4 = 1001; | 15868 v2->field_4 = 1001; |
16001 LOBYTE(v3->uAttributes) &= 0x7Fu; | 15869 LOBYTE(v3->uAttributes) &= 0x7Fu; |
16002 } | 15870 } |
16003 } | 15871 } |
16004 if ( (v2->uPackedID & 7) == OBJECT_Player) | 15872 if ( PID_TYPE(v2->uPackedID) == OBJECT_Player) |
16005 { | 15873 { |
16006 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; | 15874 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; |
16007 if ( v5->pConditions[14] | 15875 if ( v5->pConditions[14] |
16008 || v5->pConditions[16] | 15876 || v5->pConditions[16] |
16009 || v5->pConditions[15] | 15877 || v5->pConditions[15] |
16035 { | 15903 { |
16036 v9 = v8->field_4; | 15904 v9 = v8->field_4; |
16037 v10 = v7->field_4; | 15905 v10 = v7->field_4; |
16038 if ( v9 < v10 | 15906 if ( v9 < v10 |
16039 || v9 == v10 | 15907 || v9 == v10 |
16040 && ((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 |
16041 || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) | 15909 || v11 == PID_TYPE(v7->uPackedID) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) |
16042 { | 15910 { |
16043 v12 = v7->uPackedID; | 15911 v12 = v7->uPackedID; |
16044 v13 = v7->field_4; | 15912 v13 = v7->field_4; |
16045 v14 = v7->uActionLength; | 15913 v14 = v7->uActionLength; |
16046 v15 = v7->field_C; | 15914 v15 = v7->field_C; |
16064 } | 15932 } |
16065 while ( v21 - 1 < v6 ); | 15933 while ( v21 - 1 < v6 ); |
16066 } | 15934 } |
16067 v1->uActorQueueSize = v19; | 15935 v1->uActorQueueSize = v19; |
16068 result = v1->pQueue[0].uPackedID; | 15936 result = v1->pQueue[0].uPackedID; |
16069 if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) | 15937 if ( PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
16070 { | 15938 { |
16071 result = (result >> 3) + 1; | 15939 result = PID_ID(result) + 1; |
16072 uActiveCharacter = result; | 15940 uActiveCharacter = result; |
16073 v1->field_18 |= 4u; | 15941 v1->field_18 |= 4u; |
16074 } | 15942 } |
16075 else | 15943 else |
16076 { | 15944 { |
16081 if ( v1->uActorQueueSize > 0 ) | 15949 if ( v1->uActorQueueSize > 0 ) |
16082 { | 15950 { |
16083 v17 = v1->pQueue; | 15951 v17 = v1->pQueue; |
16084 do | 15952 do |
16085 { | 15953 { |
16086 if ( (v17->uPackedID & 7) == OBJECT_Player) | 15954 if ( PID_TYPE(v17->uPackedID) == OBJECT_Player) |
16087 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); |
16088 ++v22; | 15956 ++v22; |
16089 ++v17; | 15957 ++v17; |
16090 result = v22; | 15958 result = v22; |
16091 } | 15959 } |
16092 while ( v22 < v1->uActorQueueSize ); | 15960 while ( v22 < v1->uActorQueueSize ); |
16162 v3 = 0; | 16030 v3 = 0; |
16163 do | 16031 do |
16164 { | 16032 { |
16165 if ( v40->CanAct() ) | 16033 if ( v40->CanAct() ) |
16166 { | 16034 { |
16167 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = 8 * v3 | OBJECT_Player; | 16035 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(OBJECT_Player,v3); |
16168 v1->pQueue[v1->uActorQueueSize].field_C = 2; | 16036 v1->pQueue[v1->uActorQueueSize].field_C = 2; |
16169 v1->pQueue[v1->uActorQueueSize].uActionLength = 0; | 16037 v1->pQueue[v1->uActorQueueSize].uActionLength = 0; |
16170 pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; | 16038 pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; |
16171 } | 16039 } |
16172 ++v40; | 16040 ++v40; |
16192 if ( v7 & 0x8000 < 0 ) | 16060 if ( v7 & 0x8000 < 0 ) |
16193 { | 16061 { |
16194 v8 = ai_near_actors_targets_pid[v5]; | 16062 v8 = ai_near_actors_targets_pid[v5]; |
16195 LOBYTE(v7) = v7 | 0x80; | 16063 LOBYTE(v7) = v7 | 0x80; |
16196 v6->uAttributes = v7; | 16064 v6->uAttributes = v7; |
16197 v33 = 8 * v5 | OBJECT_Actor; | 16065 v33 = PID(OBJECT_Actor,v5); |
16198 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)); |
16199 memcpy(&v30, &v31, sizeof(v30)); | 16067 memcpy(&v30, &v31, sizeof(v30)); |
16200 Actor::AI_StandOrBored(v37, 4, 32, &v30); | 16068 Actor::AI_StandOrBored(v37, 4, 32, &v30); |
16201 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33; | 16069 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33; |
16202 v1->pQueue[v1->uActorQueueSize].field_C = 2; | 16070 v1->pQueue[v1->uActorQueueSize].field_C = 2; |
16203 v1->pQueue[v1->uActorQueueSize++].uActionLength = 0; | 16071 v1->pQueue[v1->uActorQueueSize++].uActionLength = 0; |
16219 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) | 16087 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
16220 { | 16088 { |
16221 v12 = (char *)&v1->pQueue[0].field_4; | 16089 v12 = (char *)&v1->pQueue[0].field_4; |
16222 while ( 1 ) | 16090 while ( 1 ) |
16223 { | 16091 { |
16224 v13 = *((int *)v12 - 1) & 7; | 16092 v13 = PID_TYPE(*((int *)v12 - 1)); |
16225 if ( v13 != OBJECT_Player ) | 16093 if ( v13 != OBJECT_Player ) |
16226 break; | 16094 break; |
16227 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; | 16095 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; |
16228 if ( v14 != (short)v2 ) | 16096 if ( v14 != (short)v2 ) |
16229 { | 16097 { |