Mercurial > mm7
comparison Events.cpp @ 501:6fa3ff8ef729
SubtractVariables
author | Ritor1 |
---|---|
date | Fri, 01 Mar 2013 17:37:47 +0600 |
parents | 4bd56919f075 |
children | dd5124185551 |
comparison
equal
deleted
inserted
replaced
500:63b171359be2 | 501:6fa3ff8ef729 |
---|---|
202 signed int pValue; // ebp@124 | 202 signed int pValue; // ebp@124 |
203 Player *pPlayer; // esi@125 | 203 Player *pPlayer; // esi@125 |
204 int v60; // eax@126 | 204 int v60; // eax@126 |
205 int v61; // edx@133 | 205 int v61; // edx@133 |
206 int v62; // eax@139 | 206 int v62; // eax@139 |
207 void *v63; // ebp@145 | 207 int v63; // ebp@145 |
208 signed int v64; // edi@146 | 208 signed int v64; // edi@146 |
209 unsigned int v65; // edx@148 | 209 unsigned int v65; // edx@148 |
210 Player *v66; // ecx@148 | 210 Player *v66; // ecx@148 |
211 int v67; // esi@148 | 211 int v67; // esi@148 |
212 signed int v68; // eax@151 | 212 signed int v68; // eax@151 |
219 int v75; // edx@172 | 219 int v75; // edx@172 |
220 Player *v76; // esi@173 | 220 Player *v76; // esi@173 |
221 signed int v77; // ebp@186 | 221 signed int v77; // ebp@186 |
222 int v78; // edx@186 | 222 int v78; // edx@186 |
223 Player *v79; // esi@187 | 223 Player *v79; // esi@187 |
224 signed int v80; // ebp@200 | 224 //signed int v80; // ebp@200 |
225 int v81; // edx@200 | 225 //int v81; // edx@200 |
226 Player *v82; // esi@201 | 226 Player *v82; // esi@201 |
227 int v83; // eax@212 | 227 int v83; // eax@212 |
228 int v84; // ebp@220 | 228 int v84; // ebp@220 |
229 signed int v85; // ebp@224 | 229 signed int v85; // ebp@224 |
230 char v86; // al@224 | 230 char v86; // al@224 |
264 int v120; // [sp-4h] [bp-4ACh]@278 | 264 int v120; // [sp-4h] [bp-4ACh]@278 |
265 int v121; // [sp-4h] [bp-4ACh]@294 | 265 int v121; // [sp-4h] [bp-4ACh]@294 |
266 int curr_seq_num; // [sp+10h] [bp-498h]@4 | 266 int curr_seq_num; // [sp+10h] [bp-498h]@4 |
267 //char *v123; // [sp+14h] [bp-494h]@0 | 267 //char *v123; // [sp+14h] [bp-494h]@0 |
268 signed int v124; // [sp+18h] [bp-490h]@7 | 268 signed int v124; // [sp+18h] [bp-490h]@7 |
269 signed int v125; // [sp+1Ch] [bp-48Ch]@155 | 269 //signed int v125; // [sp+1Ch] [bp-48Ch]@155 |
270 int v126; // [sp+1Ch] [bp-48Ch]@262 | 270 int v126; // [sp+1Ch] [bp-48Ch]@262 |
271 int player_choose; // [sp+20h] [bp-488h]@4 | 271 int player_choose; // [sp+20h] [bp-488h]@4 |
272 int v128; // [sp+24h] [bp-484h]@21 | 272 int v128; // [sp+24h] [bp-484h]@21 |
273 int v129; // [sp+24h] [bp-484h]@262 | 273 int v129; // [sp+24h] [bp-484h]@262 |
274 signed int v130; // [sp+28h] [bp-480h]@0 | 274 signed int v130; // [sp+28h] [bp-480h]@0 |
819 v4 = v124; | 819 v4 = v124; |
820 | 820 |
821 //v6 = v123; | 821 //v6 = v123; |
822 //v7 = ""; | 822 //v7 = ""; |
823 break; | 823 break; |
824 case EVENT_Compare://_evt->_e_type == 14 cmp in Global.evt event 6 | 824 case EVENT_Compare: |
825 pValue = EVT_DWORD(_evt->v7); | 825 pValue = EVT_DWORD(_evt->v7); |
826 if ( player_choose <= 3 ) | 826 if ( player_choose <= 3 ) |
827 { | 827 { |
828 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | 828 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
829 { | 829 { |
880 } | 880 } |
881 ++curr_seq_num; | 881 ++curr_seq_num; |
882 v4 = v124; | 882 v4 = v124; |
883 break; | 883 break; |
884 case EVENT_Substract: | 884 case EVENT_Substract: |
885 v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); | 885 pValue = EVT_DWORD(_evt->v7); |
886 if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) | 886 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) |
887 { | 887 { |
888 v64 = 0; | 888 v64 = 0; |
889 if ( (void *)pParty->pPickedItem.uItemID == v63 ) | 889 if ( pParty->pPickedItem.uItemID == pValue ) |
890 { | 890 { |
891 pMouse->RemoveHoldingItem(); | 891 pMouse->RemoveHoldingItem(); |
892 ++curr_seq_num; | 892 ++curr_seq_num; |
893 v4 = v124; | 893 v4 = v124; |
894 | 894 |
895 //v6 = v123; | 895 //v6 = v123; |
896 //v7 = ""; | 896 //v7 = ""; |
897 break; | 897 break; |
898 } | 898 } |
899 v65 = 0; | 899 v65 = 0; |
900 v66 = pPlayers[uActiveCharacter]; | 900 v66 = pPlayers[uActiveCharacter]; |
901 v67 = (int)v66->pInventoryIndices; | 901 v67 = (int)v66->pInventoryIndices; |
902 do | 902 do |
903 { | 903 { |
904 if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) | 904 if ( (int)&v66->pInventoryItems[v67] == pValue ) |
905 { | 905 { |
906 v66->RemoveItemAtInventoryIndex(v65); | 906 v66->RemoveItemAtInventoryIndex(v65); |
907 ++curr_seq_num; | 907 ++curr_seq_num; |
908 v4 = v124; | 908 v4 = v124; |
909 | 909 |
910 //v6 = v123; | 910 //v6 = v123; |
911 //v7 = ""; | 911 //v7 = ""; |
912 break; | 912 break; |
913 } | 913 } |
914 ++v65; | 914 ++v65; |
915 v67 += 4; | 915 v67 += 4; |
916 } | 916 } |
917 while ( (signed int)v65 < 126 ); | 917 while ( (signed int)v65 < 126 ); |
918 v68 = 0; | 918 v68 = 0; |
919 v69 = (int)&v66->pEquipment; | 919 v69 = (int)&v66->pEquipment; |
920 do | 920 do |
921 { | |
922 if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue ) | |
921 { | 923 { |
922 if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) | |
923 { | |
924 *(&v66->pEquipment.uOffHand + v68) = 0; | 924 *(&v66->pEquipment.uOffHand + v68) = 0; |
925 ++curr_seq_num; | 925 ++curr_seq_num; |
926 v4 = v124; | 926 v4 = v124; |
927 | 927 |
928 //v6 = v123; | 928 //v6 = v123; |
929 //v7 = ""; | 929 //v7 = ""; |
930 break; | 930 break; |
931 } | 931 } |
932 ++v68; | 932 ++v68; |
933 v69 += 4; | 933 v69 += 4; |
934 } | 934 } |
935 while ( v68 < 16 ); | 935 while ( v68 < 16 ); |
936 v125 = (signed int)&pPlayers[1]; | 936 pPlayer = pPlayers[1]; |
937 while ( 1 ) | 937 while ( 1 ) |
938 { | |
939 v70 = pPlayer; | |
940 if ( !v64 ) | |
938 { | 941 { |
939 v70 = *(Player **)v125; | |
940 if ( !v64 ) | |
941 { | |
942 v71 = 0; | 942 v71 = 0; |
943 v72 = (int)v70->pInventoryIndices; | 943 v72 = (int)v70->pInventoryIndices; |
944 do | 944 do |
945 { | |
946 if ( (int)&v70->pInventoryItems[v72] == pValue ) | |
945 { | 947 { |
946 if ( *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v72 + 5] == v63 ) | |
947 { | |
948 v70->RemoveItemAtInventoryIndex(v71); | 948 v70->RemoveItemAtInventoryIndex(v71); |
949 goto LABEL_169; | 949 goto LABEL_169; |
950 } | 950 } |
951 ++v71; | 951 ++v71; |
952 v72 += 4; | 952 v72 += 4; |
953 } | 953 } |
954 while ( (signed int)v71 < 126 ); | 954 while ( (signed int)v71 < 126 ); |
955 v73 = 0; | 955 v73 = 0; |
956 v74 = (int)&v70->pEquipment; | 956 v74 = (int)&v70->pEquipment; |
957 while ( !*(int *)v74 | 957 while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue ) |
958 || *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v74 + 5] != v63 ) | 958 { |
959 { | |
960 ++v73; | 959 ++v73; |
961 v74 += 4; | 960 v74 += 4; |
962 if ( v73 >= 16 ) | 961 if ( v73 >= 16 ) |
963 goto LABEL_170; | 962 goto LABEL_170; |
964 } | 963 } |
965 *(&v70->pEquipment.uOffHand + v73) = 0; | 964 *(&v70->pEquipment.uOffHand + v73) = 0; |
966 LABEL_169: | 965 LABEL_169: |
967 v64 = 1; | 966 v64 = 1; |
968 } | 967 } |
969 LABEL_170: | 968 LABEL_170: |
970 v125 += 4; | 969 pPlayer += 4; |
971 if ( v125 > (signed int)&pPlayers[4] ) | 970 if ( pPlayer > pPlayers[4] ) |
972 { | 971 { |
973 ++curr_seq_num; | 972 ++curr_seq_num; |
974 v4 = v124; | 973 v4 = v124; |
975 | 974 |
976 //v6 = v123; | 975 //v6 = v123; |
977 //v7 = ""; | 976 //v7 = ""; |
978 break; | 977 break; |
979 } | |
980 } | 978 } |
979 } | |
981 } | 980 } |
982 v75 = player_choose; | 981 v75 = player_choose; |
983 if ( player_choose != 5 ) | 982 if ( player_choose <= 3 ) |
984 { | 983 { |
984 pPlayer = &pParty->pPlayers[v75]; | |
985 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
986 ++curr_seq_num; | |
987 //v4 = v124; | |
988 break; | |
989 } | |
990 else if ( player_choose == 4 ) //active | |
991 { | |
992 if ( uActiveCharacter ) | |
993 { | |
994 pPlayer = pPlayers[uActiveCharacter]; | |
995 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
996 ++curr_seq_num; | |
997 v4 = v124; | |
998 break; | |
999 } | |
1000 } | |
1001 else if ( player_choose == 5 )//all | |
1002 { | |
1003 v130=0; | |
1004 for(int i=0; i<4; ++i) | |
1005 { | |
1006 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
1007 { | |
1008 ++curr_seq_num; | |
1009 break; | |
1010 } | |
1011 } | |
1012 ++v130; | |
1013 break; | |
1014 } | |
1015 else if ( player_choose == 6 ) //random | |
1016 { | |
1017 v75 = rand() % 4; | |
1018 pPlayer = &pParty->pPlayers[v75]; | |
1019 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1020 ++curr_seq_num; | |
1021 v4 = v124; | |
1022 break; | |
1023 } | |
1024 /* if ( player_choose != 5 ) | |
1025 { | |
985 if ( player_choose < 0 ) | 1026 if ( player_choose < 0 ) |
986 goto LABEL_183; | 1027 goto LABEL_183; |
987 if ( player_choose > 3 ) | 1028 //if ( player_choose > 3 ) |
988 { | 1029 //{ |
989 if ( player_choose != 4 ) | 1030 if ( player_choose != 4 ) |
990 { | 1031 { |
991 if ( player_choose == 6 ) | 1032 if ( player_choose == 6 ) |
992 goto LABEL_180; | 1033 goto LABEL_180; |
993 LABEL_183: | 1034 LABEL_183: |
994 ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); | 1035 ((Player *)v6)->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
995 ++curr_seq_num; | 1036 ++curr_seq_num; |
996 v4 = v124; | 1037 v4 = v124; |
997 | 1038 |
998 //v6 = v123; | 1039 //v6 = v123; |
999 //v7 = ""; | 1040 //v7 = ""; |
1000 break; | 1041 break; |
1001 } | 1042 } |
1002 if ( uActiveCharacter ) | 1043 if ( uActiveCharacter ) |
1003 { | 1044 { |
1004 v6 = pPlayers[uActiveCharacter]; | 1045 v6 = pPlayers[uActiveCharacter]; |
1005 goto LABEL_182; | 1046 goto LABEL_182; |
1006 } | 1047 } |
1007 LABEL_180: | 1048 LABEL_180: |
1008 v75 = rand() % 4; | 1049 v75 = rand() % 4; |
1009 | 1050 |
1010 } | 1051 //} |
1011 v6 = &pParty->pPlayers[v75]; | 1052 v6 = &pParty->pPlayers[v75]; |
1012 LABEL_182: | 1053 LABEL_182: |
1013 //v123 = v6; | 1054 //v123 = v6; |
1014 goto LABEL_183; | 1055 goto LABEL_183; |
1015 } | 1056 } |
1016 v76 = pParty->pPlayers; | 1057 v130=0; |
1017 v130 = 4; | 1058 for(int i=0; i<4; ++i) |
1018 do | 1059 { |
1019 { | 1060 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
1020 v76->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); | 1061 { |
1021 ++v76; | 1062 ++curr_seq_num; |
1022 } | 1063 break; |
1023 while ( (signed int)v76 < (signed int)pParty->pHirelings ); | 1064 } |
1024 ++curr_seq_num; | 1065 } |
1025 v4 = v124; | 1066 ++v130; |
1026 | 1067 break;*/ |
1027 //v6 = v123; | |
1028 //v7 = ""; | |
1029 break; | |
1030 case EVENT_Set: | 1068 case EVENT_Set: |
1031 v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | 1069 v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); |
1032 v78 = player_choose; | 1070 v78 = player_choose; |
1033 if ( player_choose != 5 ) | 1071 if ( player_choose != 5 ) |
1034 { | 1072 { |
1076 | 1114 |
1077 //v6 = v123; | 1115 //v6 = v123; |
1078 //v7 = ""; | 1116 //v7 = ""; |
1079 break; | 1117 break; |
1080 case EVENT_Add: | 1118 case EVENT_Add: |
1081 v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | 1119 pValue = EVT_DWORD(_evt->v7); |
1082 v81 = player_choose; | 1120 //v81 = player_choose; |
1083 if ( player_choose != 5 ) | 1121 if ( player_choose != 5 ) |
1084 { | 1122 { |
1085 if ( player_choose < 0 ) | 1123 if ( player_choose < 0 ) |
1086 goto LABEL_211; | 1124 goto LABEL_211; |
1087 if ( player_choose > 3 ) | 1125 if ( player_choose > 3 ) |
1089 if ( player_choose != 4 ) | 1127 if ( player_choose != 4 ) |
1090 { | 1128 { |
1091 if ( player_choose == 6 ) | 1129 if ( player_choose == 6 ) |
1092 goto LABEL_208; | 1130 goto LABEL_208; |
1093 LABEL_211: | 1131 LABEL_211: |
1094 ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); | 1132 ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); |
1095 goto LABEL_212; | 1133 goto LABEL_212; |
1096 } | 1134 } |
1097 if ( uActiveCharacter ) | 1135 if ( uActiveCharacter ) |
1098 { | 1136 { |
1099 v6 = pPlayers[uActiveCharacter]; | 1137 v6 = pPlayers[uActiveCharacter]; |
1100 goto LABEL_210; | 1138 goto LABEL_210; |
1101 } | 1139 } |
1102 LABEL_208: | 1140 LABEL_208: |
1103 v81 = rand() % 4; | 1141 player_choose = rand() % 4; |
1104 | 1142 |
1105 } | 1143 } |
1106 v6 = &pParty->pPlayers[v81]; | 1144 v6 = &pParty->pPlayers[player_choose]; |
1107 LABEL_210: | 1145 LABEL_210: |
1108 //v123 = v6; | 1146 //v123 = v6; |
1109 goto LABEL_211; | 1147 goto LABEL_211; |
1110 } | 1148 } |
1111 v82 = pParty->pPlayers; | 1149 v130 = 0; |
1112 v130 = 4; | 1150 for(int i=1; i<5; ++i) |
1113 do | 1151 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1114 { | |
1115 v82->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); | |
1116 ++v82; | |
1117 } | |
1118 while ( (signed int)v82 < (signed int)pParty->pHirelings ); | |
1119 LABEL_212: | 1152 LABEL_212: |
1120 v83 = _evt->v5 + ((uint)_evt->v6 << 8); | 1153 v83 = EVT_WORD(_evt->v5); |
1121 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) | 1154 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) |
1122 viewparams->bRedrawGameUI = 1; | 1155 viewparams->bRedrawGameUI = 1; |
1123 ++curr_seq_num; | 1156 ++curr_seq_num; |
1124 v4 = v124; | 1157 v4 = v124; |
1125 | |
1126 //v6 = v123; | |
1127 //v7 = ""; | |
1128 break; | 1158 break; |
1129 case EVENT_InputString: | 1159 case EVENT_InputString: |
1130 if ( !start_event_seq_number ) | 1160 if ( !start_event_seq_number ) |
1131 { | 1161 { |
1132 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); | 1162 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); |