comparison mm7_2.cpp @ 1439:468f434a8d8a

Слияние
author Ritor1
date Mon, 22 Jul 2013 18:00:58 +0600
parents bc99e1a48bea c0b273d33338
children b67a3e0d6fc3
comparison
equal deleted inserted replaced
1438:bc99e1a48bea 1439:468f434a8d8a
823 pWindow.uFrameWidth = 469; 823 pWindow.uFrameWidth = 469;
824 pWindow.uFrameHeight = 338; 824 pWindow.uFrameHeight = 338;
825 pWindow.uFrameZ = 543; 825 pWindow.uFrameZ = 543;
826 pWindow.uFrameW = 397; 826 pWindow.uFrameW = 397;
827 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL); 827 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
828 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 99) ) 828 if ( pParty->IsPartyGood() )
829 { 829 {
830 v1 = pGlobalTXT_LocalizationStrings[675]; 830 v1 = pGlobalTXT_LocalizationStrings[675];
831 } 831 }
832 else 832 else
833 { 833 {
834 result = _449B57_test_bit(pParty->_quest_bits, 100); 834 result = pParty->IsPartyEvil();
835 if ( !(short)result ) 835 if ( !(short)result )
836 return result; 836 return result;
837 v1 = pGlobalTXT_LocalizationStrings[676]; 837 v1 = pGlobalTXT_LocalizationStrings[676];
838 } 838 }
839 pInString = v1; 839 pInString = v1;
967 LABEL_43: 967 LABEL_43:
968 bGameoverLoop = 0; 968 bGameoverLoop = 0;
969 return result; 969 return result;
970 } 970 }
971 971
972 //----- (004D6FB0) -------------------------------------------------------- 972
973 int /*__usercall*/ sr_sub_4D6FB0/*<eax>*/(stru315 *a1/*<ebp>*/) 973
974 { 974
975 int v1; // ebp@1
976 unsigned int v2; // esi@1
977 unsigned int v3; // edi@1
978 int result; // eax@1
979 int v5; // ebx@2
980 int v6; // edx@2
981 int v7; // ebx@3
982 __int16 v8; // cx@3
983 int v9; // ebx@4
984 unsigned __int8 v10; // sf@5
985 unsigned __int8 v11; // of@5
986
987 v1 = a1->field_8;
988 v2 = *(int *)(v1 + 48);
989 v3 = *(int *)(v1 + 44);
990 result = *(int *)(v1 + 64);
991 if ( !(*(int *)(v1 + 40) & 1) )
992 goto LABEL_5;
993 --*(int *)(v1 + 40);
994 result -= 2;
995 v5 = *(int *)(v1 + 60);
996 v6 = *(int *)(v1 + 36);
997 *(int *)(v1 + 60) += 4;
998 while ( 1 )
999 {
1000 *(int *)v5 = v6;
1001 v9 = *(char *)(*(int *)(v1 + 56)
1002 + (*(int *)(v1 + 12) & (v2 >> 16))
1003 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16)));
1004 result += 4;
1005 v2 += *(int *)(v1 + 4);
1006 v3 += *(int *)v1;
1007 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) + 2 * v9);
1008 LABEL_5:
1009 v11 = __OFSUB__(*(int *)(v1 + 40), 2);
1010 v10 = *(int *)(v1 + 40) - 2 < 0;
1011 *(int *)(v1 + 40) -= 2;
1012 if ( v10 ^ v11 )
1013 break;
1014 v7 = *(char *)(*(int *)(v1 + 56)
1015 + (*(int *)(v1 + 12) & (v2 >> 16))
1016 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16)));
1017 v2 += *(int *)(v1 + 4);
1018 v8 = *(short *)(*(int *)(v1 + 52) + 2 * v7);
1019 v3 += *(int *)v1;
1020 v5 = *(int *)(v1 + 60);
1021 v6 = *(int *)(v1 + 36);
1022 *(short *)result = v8;
1023 *(int *)(v1 + 60) += 8;
1024 *(int *)(v5 + 4) = v6;
1025 }
1026 *(int *)(v1 + 64) = result;
1027 *(int *)(v1 + 48) = v2;
1028 *(int *)(v1 + 44) = v3;
1029 return result;
1030 }
1031
1032 //----- (004D705A) --------------------------------------------------------
1033 int /*__usercall*/ sr_sub_4D705A/*<eax>*/(stru315 *a1/*<ebp>*/)
1034 {
1035 int v1; // ebp@1
1036 unsigned int v2; // esi@1
1037 unsigned int v3; // edi@1
1038 int result; // eax@1
1039 int v5; // ebx@2
1040 int v6; // edx@2
1041 unsigned int v7; // ebx@3
1042 unsigned int v8; // edx@3
1043 __int16 v9; // cx@11
1044 unsigned int v10; // ebx@12
1045 unsigned int v11; // edx@12
1046 unsigned __int8 v12; // sf@21
1047 unsigned __int8 v13; // of@21
1048
1049 v1 = a1->field_8;
1050 v2 = *(int *)(v1 + 48);
1051 v3 = *(int *)(v1 + 44);
1052 result = *(int *)(v1 + 64);
1053 if ( !(*(int *)(v1 + 40) & 1) )
1054 goto LABEL_21;
1055 --*(int *)(v1 + 40);
1056 result -= 2;
1057 v5 = *(int *)(v1 + 60);
1058 v6 = *(int *)(v1 + 36);
1059 *(int *)(v1 + 60) += 4;
1060 while ( 1 )
1061 {
1062 *(int *)v5 = v6;
1063 v10 = v3;
1064 v11 = v2;
1065 if ( (signed int)v2 < *(int *)(v1 + 20) )
1066 v11 = *(int *)(v1 + 20);
1067 if ( (signed int)v3 < *(int *)(v1 + 28) )
1068 v10 = *(int *)(v1 + 28);
1069 if ( (signed int)v11 > *(int *)(v1 + 24) )
1070 v11 = *(int *)(v1 + 24);
1071 if ( (signed int)v10 > *(int *)(v1 + 32) )
1072 v10 = *(int *)(v1 + 32);
1073 result += 4;
1074 v2 += *(int *)(v1 + 4);
1075 v3 += *(int *)v1;
1076 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52)
1077 + 2
1078 * *(char *)(*(int *)(v1 + 56)
1079 + (*(int *)(v1 + 12) & (v11 >> 16))
1080 + ((*(int *)(v1 + 8) & v10) >> *(char *)(v1 + 16))));
1081 LABEL_21:
1082 v13 = __OFSUB__(*(int *)(v1 + 40), 2);
1083 v12 = *(int *)(v1 + 40) - 2 < 0;
1084 *(int *)(v1 + 40) -= 2;
1085 if ( v12 ^ v13 )
1086 break;
1087 v7 = v3;
1088 v8 = v2;
1089 if ( (signed int)v2 < *(int *)(v1 + 20) )
1090 v8 = *(int *)(v1 + 20);
1091 if ( (signed int)v3 < *(int *)(v1 + 28) )
1092 v7 = *(int *)(v1 + 28);
1093 if ( (signed int)v8 > *(int *)(v1 + 24) )
1094 v8 = *(int *)(v1 + 24);
1095 if ( (signed int)v7 > *(int *)(v1 + 32) )
1096 v7 = *(int *)(v1 + 32);
1097 v2 += *(int *)(v1 + 4);
1098 v9 = *(short *)(*(int *)(v1 + 52)
1099 + 2
1100 * *(char *)(*(int *)(v1 + 56)
1101 + (*(int *)(v1 + 12) & (v8 >> 16))
1102 + ((*(int *)(v1 + 8) & v7) >> *(char *)(v1 + 16))));
1103 v3 += *(int *)v1;
1104 v5 = *(int *)(v1 + 60);
1105 v6 = *(int *)(v1 + 36);
1106 *(short *)result = v9;
1107 *(int *)(v1 + 60) += 8;
1108 *(int *)(v5 + 4) = v6;
1109 }
1110 *(int *)(v1 + 64) = result;
1111 *(int *)(v1 + 48) = v2;
1112 *(int *)(v1 + 44) = v3;
1113 return result;
1114 }
1115
1116 //----- (004D714C) --------------------------------------------------------
1117 int __cdecl sr_sub_4D714C(stru315 *a1)
1118 {
1119 stru315 *v1; // ebp@0
1120 stru315 *v2; // ebp@1
1121 unsigned int v3; // esi@1
1122 int v4; // edi@1
1123 int result; // eax@1
1124 unsigned int *v6; // ebx@2
1125 int v7; // edx@2
1126 int v8; // ebx@3
1127 unsigned __int16 v9; // cx@3
1128 unsigned int *v10; // ebx@3
1129 int v11; // edx@3
1130 int v12; // ebx@4
1131 unsigned __int8 v13; // sf@5
1132 unsigned __int8 v14; // of@5
1133
1134 v2 = (stru315 *)v1->field_8;
1135 v3 = v2->field_30;
1136 v4 = v2->field_2C;
1137 result = (int)v2->pColorBuffer;
1138 if ( !(v2->field_28 & 1) )
1139 goto LABEL_5;
1140 --v2->field_28;
1141 result += 2;
1142 v6 = v2->pDepthBuffer;
1143 v7 = v2->field_24;
1144 --v2->pDepthBuffer;
1145 *v6 = v7;
1146 while ( 1 )
1147 {
1148 v12 = *((char *)v2->pTextureLOD
1149 + (v2->field_C & (v3 >> 16))
1150 + ((v2->field_8 & (unsigned int)v4) >> LOBYTE(v2->field_10)));
1151 result -= 4;
1152 v3 += v2->field_4;
1153 v4 += v2->field_0;
1154 *(short *)(result + 2) = v2->field_34_palette[v12];
1155 LABEL_5:
1156 v14 = __OFSUB__(v2->field_28, 2);
1157 v13 = v2->field_28 - 2 < 0;
1158 v2->field_28 -= 2;
1159 if ( v13 ^ v14 )
1160 break;
1161 v8 = *((char *)v2->pTextureLOD
1162 + (v2->field_C & (v3 >> 16))
1163 + ((v2->field_8 & (unsigned int)v4) >> LOBYTE(v2->field_10)));
1164 v3 += v2->field_4;
1165 v9 = v2->field_34_palette[v8];
1166 v4 += v2->field_0;
1167 v10 = v2->pDepthBuffer;
1168 v11 = v2->field_24;
1169 *(short *)result = v9;
1170 v2->pDepthBuffer -= 2;
1171 *v10 = v11;
1172 *(v10 - 1) = v11;
1173 }
1174 v2->pColorBuffer = (unsigned __int16 *)result;
1175 v2->field_30 = v3;
1176 v2->field_2C = v4;
1177 return result;
1178 }
1179 // 4D714C: inconsistent function type and number of purged bytes
1180
1181 //----- (004D71F8) --------------------------------------------------------
1182 int __cdecl sr_sub_4D71F8(stru315 *a1)
1183 {
1184 stru315 *v1; // ebp@0
1185 stru315 *v2; // ebp@1
1186 int v3; // esi@1
1187 int v4; // edi@1
1188 int result; // eax@1
1189 unsigned int *v6; // ebx@2
1190 int v7; // edx@2
1191 int v8; // ebx@3
1192 unsigned int v9; // edx@3
1193 unsigned __int16 v10; // cx@11
1194 unsigned int *v11; // ebx@11
1195 int v12; // edx@11
1196 int v13; // ebx@12
1197 unsigned int v14; // edx@12
1198 unsigned __int8 v15; // sf@21
1199 unsigned __int8 v16; // of@21
1200
1201 v2 = (stru315 *)v1->field_8;
1202 v3 = v2->field_30;
1203 v4 = v2->field_2C;
1204 result = (int)v2->pColorBuffer;
1205 if ( !(v2->field_28 & 1) )
1206 goto LABEL_21;
1207 --v2->field_28;
1208 result += 2;
1209 v6 = v2->pDepthBuffer;
1210 v7 = v2->field_24;
1211 --v2->pDepthBuffer;
1212 *v6 = v7;
1213 while ( 1 )
1214 {
1215 v13 = v4;
1216 v14 = v3;
1217 if ( v3 < v2->field_14 )
1218 v14 = v2->field_14;
1219 if ( v4 < v2->field_1C )
1220 v13 = v2->field_1C;
1221 if ( (signed int)v14 > v2->field_18 )
1222 v14 = v2->field_18;
1223 if ( v13 > v2->field_20 )
1224 v13 = v2->field_20;
1225 result -= 4;
1226 v3 += v2->field_4;
1227 v4 += v2->field_0;
1228 *(short *)(result + 2) = v2->field_34_palette[*((char *)v2->pTextureLOD
1229 + (v2->field_C & (v14 >> 16))
1230 + ((v2->field_8 & (unsigned int)v13) >> LOBYTE(v2->field_10)))];
1231 LABEL_21:
1232 v16 = __OFSUB__(v2->field_28, 2);
1233 v15 = v2->field_28 - 2 < 0;
1234 v2->field_28 -= 2;
1235 if ( v15 ^ v16 )
1236 break;
1237 v8 = v4;
1238 v9 = v3;
1239 if ( v3 < v2->field_14 )
1240 v9 = v2->field_14;
1241 if ( v4 < v2->field_1C )
1242 v8 = v2->field_1C;
1243 if ( (signed int)v9 > v2->field_18 )
1244 v9 = v2->field_18;
1245 if ( v8 > v2->field_20 )
1246 v8 = v2->field_20;
1247 v3 += v2->field_4;
1248 v10 = v2->field_34_palette[*((char *)v2->pTextureLOD
1249 + (v2->field_C & (v9 >> 16))
1250 + ((v2->field_8 & (unsigned int)v8) >> LOBYTE(v2->field_10)))];
1251 v4 += v2->field_0;
1252 v11 = v2->pDepthBuffer;
1253 v12 = v2->field_24;
1254 *(short *)result = v10;
1255 v2->pDepthBuffer -= 2;
1256 *v11 = v12;
1257 *(v11 - 1) = v12;
1258 }
1259 v2->pColorBuffer = (unsigned __int16 *)result;
1260 v2->field_30 = v3;
1261 v2->field_2C = v4;
1262 return result;
1263 }
1264 // 4D71F8: inconsistent function type and number of purged bytes
1265
1266 //----- (004D72EC) --------------------------------------------------------
1267 int /*__usercall*/ sr_sub_4D72EC/*<eax>*/(int a1/*<ebp>*/)
1268 {
1269 int v1; // ebp@1
1270 unsigned int v2; // esi@1
1271 unsigned int v3; // edi@1
1272 int result; // eax@1
1273 int v5; // ebx@2
1274 int v6; // edx@2
1275 unsigned int v7; // edx@3
1276 unsigned int v8; // ebx@3
1277 int v9; // ebx@11
1278 unsigned int v10; // edx@14
1279 unsigned int v11; // ebx@14
1280 int v12; // ebx@22
1281 unsigned __int8 v13; // sf@25
1282 unsigned __int8 v14; // of@25
1283
1284 v1 = *(int *)(a1 + 8);
1285 v2 = *(int *)(v1 + 48);
1286 v3 = *(int *)(v1 + 44);
1287 result = *(int *)(v1 + 64);
1288 if ( !(*(int *)(v1 + 40) & 1) )
1289 goto LABEL_25;
1290 --*(int *)(v1 + 40);
1291 result -= 2;
1292 v5 = *(int *)(v1 + 60);
1293 v6 = *(int *)(v1 + 36);
1294 *(int *)(v1 + 60) += 4;
1295 while ( 1 )
1296 {
1297 *(int *)v5 = v6;
1298 v10 = v2;
1299 v11 = v3;
1300 if ( (signed int)v2 < *(int *)(v1 + 20) )
1301 v10 = *(int *)(v1 + 20);
1302 if ( (signed int)v3 < *(int *)(v1 + 28) )
1303 v11 = *(int *)(v1 + 28);
1304 if ( (signed int)v10 > *(int *)(v1 + 24) )
1305 v10 = *(int *)(v1 + 24);
1306 if ( (signed int)v11 > *(int *)(v1 + 32) )
1307 v11 = *(int *)(v1 + 32);
1308 v12 = *(char *)(*(int *)(v1 + 56)
1309 + (*(int *)(v1 + 12) & (v10 >> 16))
1310 + ((*(int *)(v1 + 8) & v11) >> *(char *)(v1 + 16)));
1311 result += 4;
1312 v2 += *(int *)(v1 + 4);
1313 if ( v12 )
1314 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) + 2 * v12);
1315 v3 += *(int *)v1;
1316 LABEL_25:
1317 v14 = __OFSUB__(*(int *)(v1 + 40), 2);
1318 v13 = *(int *)(v1 + 40) - 2 < 0;
1319 *(int *)(v1 + 40) -= 2;
1320 if ( v13 ^ v14 )
1321 break;
1322 v7 = v2;
1323 v8 = v3;
1324 if ( (signed int)v2 < *(int *)(v1 + 20) )
1325 v7 = *(int *)(v1 + 20);
1326 if ( (signed int)v3 < *(int *)(v1 + 28) )
1327 v8 = *(int *)(v1 + 28);
1328 if ( (signed int)v7 > *(int *)(v1 + 24) )
1329 v7 = *(int *)(v1 + 24);
1330 if ( (signed int)v8 > *(int *)(v1 + 32) )
1331 v8 = *(int *)(v1 + 32);
1332 v9 = *(char *)(*(int *)(v1 + 56)
1333 + (*(int *)(v1 + 12) & (v7 >> 16))
1334 + ((*(int *)(v1 + 8) & v8) >> *(char *)(v1 + 16)));
1335 v2 += *(int *)(v1 + 4);
1336 if ( v9 )
1337 *(short *)result = *(short *)(*(int *)(v1 + 52) + 2 * v9);
1338 v3 += *(int *)v1;
1339 v5 = *(int *)(v1 + 60);
1340 v6 = *(int *)(v1 + 36);
1341 *(int *)(v1 + 60) += 8;
1342 *(int *)(v5 + 4) = v6;
1343 }
1344 return result;
1345 }
1346
1347 //----- (004D73DF) --------------------------------------------------------
1348 int /*__usercall*/ sr_sub_4D73DF/*<eax>*/(int a1/*<ebp>*/)
1349 {
1350 int v1; // ebp@1
1351 unsigned int v2; // esi@1
1352 unsigned int v3; // edi@1
1353 int result; // eax@1
1354 int v5; // ebx@2
1355 int v6; // edx@2
1356 int v7; // edx@3
1357 int v8; // edx@6
1358 unsigned __int8 v9; // sf@9
1359 unsigned __int8 v10; // of@9
1360
1361 v1 = *(int *)(a1 + 8);
1362 v2 = *(int *)(v1 + 48);
1363 v3 = *(int *)(v1 + 44);
1364 result = *(int *)(v1 + 64);
1365 if ( !(*(int *)(v1 + 40) & 1) )
1366 goto LABEL_9;
1367 --*(int *)(v1 + 40);
1368 result -= 2;
1369 v5 = *(int *)(v1 + 60);
1370 v6 = *(int *)(v1 + 36);
1371 *(int *)(v1 + 60) += 4;
1372 while ( 1 )
1373 {
1374 *(int *)v5 = v6;
1375 v8 = *(int *)(v1 + 12) & (v2 >> 16);
1376 result += 4;
1377 v2 += *(int *)(v1 + 4);
1378 if ( *(char *)(*(int *)(v1 + 56) + v8 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))) )
1379 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52)
1380 + 2
1381 * *(char *)(*(int *)(v1 + 56)
1382 + v8
1383 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))));
1384 v3 += *(int *)v1;
1385 LABEL_9:
1386 v10 = __OFSUB__(*(int *)(v1 + 40), 2);
1387 v9 = *(int *)(v1 + 40) - 2 < 0;
1388 *(int *)(v1 + 40) -= 2;
1389 if ( v9 ^ v10 )
1390 break;
1391 v7 = *(int *)(v1 + 12) & (v2 >> 16);
1392 v2 += *(int *)(v1 + 4);
1393 if ( *(char *)(*(int *)(v1 + 56) + v7 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))) )
1394 *(short *)result = *(short *)(*(int *)(v1 + 52)
1395 + 2
1396 * *(char *)(*(int *)(v1 + 56)
1397 + v7
1398 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))));
1399 v3 += *(int *)v1;
1400 v5 = *(int *)(v1 + 60);
1401 v6 = *(int *)(v1 + 36);
1402 *(int *)(v1 + 60) += 8;
1403 *(int *)(v5 + 4) = v6;
1404 }
1405 return result;
1406 }
1407
1408 //----- (004D754B) --------------------------------------------------------
1409 void __cdecl sr_sub_4D754B(stru315 *a1, stru316 *a2)
1410 {
1411 int v2; // ecx@1
1412 unsigned int v3; // eax@2
1413 int v4; // ecx@2
1414 int v5; // eax@10
1415 unsigned __int16 *v6; // edx@10
1416 int v7; // ebx@11
1417 int v8; // ecx@13
1418 unsigned __int16 v9; // bx@16
1419 int v10; // ecx@16
1420 unsigned __int16 *v11; // eax@16
1421 unsigned int *v12; // edx@16
1422 int v13; // ecx@16
1423 int v14; // eax@16
1424 int v15; // ebx@16
1425 int v16; // [sp-4h] [bp-Ch]@2
1426
1427 v2 = a1->field_28;
1428 if ( v2 )
1429 {
1430 do
1431 {
1432 v16 = v2;
1433 v3 = a1->field_30;
1434 v4 = a1->field_2C;
1435 if ( (signed int)v3 >= a1->field_18 )
1436 v3 = a1->field_18;
1437 if ( (signed int)v3 <= a1->field_14 )
1438 v3 = a1->field_14;
1439 if ( v4 >= a1->field_20 )
1440 v4 = a1->field_20;
1441 if ( v4 <= a1->field_1C )
1442 v4 = a1->field_1C;
1443 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10));
1444 v6 = a1->field_34_palette;
1445 if ( a2->field_20 )
1446 {
1447 v7 = (unsigned int)a2->field_10 >> 16;
1448 if ( v7 >= a2->field_C )
1449 v7 = a2->field_C;
1450 v8 = 0;
1451 if ( a2->field_8 - v7 >= 0 )
1452 v8 = a2->field_8 - v7;
1453 v5 += v8 << 8;
1454 v6 = a2->field_24_palette;
1455 }
1456 v9 = v6[v5];
1457 v10 = a1->field_24;
1458 v11 = a1->pColorBuffer;
1459 v12 = a1->pDepthBuffer;
1460 *v11 = v9;
1461 *v12 = v10;
1462 a1->pColorBuffer = v11 + 1;
1463 a1->pDepthBuffer = v12 + 1;
1464 v13 = a1->field_30;
1465 a2->field_10 += a2->field_18;
1466 v14 = a1->field_2C;
1467 v15 = a1->field_0;
1468 a1->field_30 = a1->field_4 + v13;
1469 a1->field_2C = v15 + v14;
1470 v2 = v16 - 1;
1471 }
1472 while ( v16 != 1 );
1473 }
1474 }
1475
1476 //----- (004D7630) --------------------------------------------------------
1477 void __cdecl sr_sub_4D7630(stru315 *a1, stru316 *a2)
1478 {
1479 int v2; // ecx@1
1480 int v3; // eax@2
1481 unsigned __int16 *v4; // edx@2
1482 int v5; // ebx@3
1483 int v6; // ecx@5
1484 unsigned __int16 v7; // bx@8
1485 int v8; // ecx@8
1486 unsigned __int16 *v9; // eax@8
1487 unsigned int *v10; // edx@8
1488 int v11; // ecx@8
1489 int v12; // eax@8
1490 int v13; // ebx@8
1491 int v14; // [sp-4h] [bp-Ch]@2
1492
1493 v2 = a1->field_28;
1494 if ( v2 )
1495 {
1496 do
1497 {
1498 v14 = v2;
1499 v3 = *((char *)a1->pTextureLOD
1500 + (a1->field_C & ((unsigned int)a1->field_30 >> 16))
1501 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10));
1502 v4 = a1->field_34_palette;
1503 if ( a2->field_20 )
1504 {
1505 v5 = (unsigned int)a2->field_14 >> 16;
1506 if ( v5 >= a2->field_C )
1507 v5 = a2->field_C;
1508 v6 = 0;
1509 if ( a2->field_8 - v5 >= 0 )
1510 v6 = a2->field_8 - v5;
1511 v3 += v6 << 8;
1512 v4 = a2->field_24_palette;
1513 }
1514 v7 = v4[v3];
1515 v8 = a1->field_24;
1516 v9 = a1->pColorBuffer;
1517 v10 = a1->pDepthBuffer;
1518 *v9 = v7;
1519 *v10 = v8;
1520 a1->pColorBuffer = v9 - 1;
1521 a1->pDepthBuffer = v10 - 1;
1522 v11 = a1->field_30;
1523 a2->field_14 -= a2->field_18;
1524 v12 = a1->field_2C;
1525 v13 = a1->field_0;
1526 a1->field_30 = a1->field_4 + v11;
1527 a1->field_2C = v13 + v12;
1528 v2 = v14 - 1;
1529 }
1530 while ( v14 != 1 );
1531 }
1532 }
1533
1534 //----- (004D76ED) --------------------------------------------------------
1535 void __cdecl sr_sub_4D76ED(stru315 *a1, stru316 *a2)
1536 {
1537 int v2; // ecx@1
1538 unsigned int v3; // eax@2
1539 int v4; // ecx@2
1540 int v5; // eax@10
1541 unsigned __int16 *v6; // edx@10
1542 int v7; // ebx@11
1543 int v8; // ecx@13
1544 unsigned __int16 v9; // bx@16
1545 int v10; // ecx@16
1546 unsigned __int16 *v11; // eax@16
1547 unsigned int *v12; // edx@16
1548 int v13; // ecx@16
1549 int v14; // eax@16
1550 int v15; // ebx@16
1551 int v16; // [sp-4h] [bp-Ch]@2
1552
1553 v2 = a1->field_28;
1554 if ( v2 )
1555 {
1556 do
1557 {
1558 v16 = v2;
1559 v3 = a1->field_30;
1560 v4 = a1->field_2C;
1561 if ( (signed int)v3 >= a1->field_18 )
1562 v3 = a1->field_18;
1563 if ( (signed int)v3 <= a1->field_14 )
1564 v3 = a1->field_14;
1565 if ( v4 >= a1->field_20 )
1566 v4 = a1->field_20;
1567 if ( v4 <= a1->field_1C )
1568 v4 = a1->field_1C;
1569 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10));
1570 v6 = a1->field_34_palette;
1571 if ( a2->field_20 )
1572 {
1573 v7 = (unsigned int)a2->field_14 >> 16;
1574 if ( v7 >= a2->field_C )
1575 v7 = a2->field_C;
1576 v8 = 0;
1577 if ( a2->field_8 - v7 >= 0 )
1578 v8 = a2->field_8 - v7;
1579 v5 += v8 << 8;
1580 v6 = a2->field_24_palette;
1581 }
1582 v9 = v6[v5];
1583 v10 = a1->field_24;
1584 v11 = a1->pColorBuffer;
1585 v12 = a1->pDepthBuffer;
1586 *v11 = v9;
1587 *v12 = v10;
1588 a1->pColorBuffer = v11 - 1;
1589 a1->pDepthBuffer = v12 - 1;
1590 v13 = a1->field_30;
1591 a2->field_14 -= a2->field_18;
1592 v14 = a1->field_2C;
1593 v15 = a1->field_0;
1594 a1->field_30 = a1->field_4 + v13;
1595 a1->field_2C = v15 + v14;
1596 v2 = v16 - 1;
1597 }
1598 while ( v16 != 1 );
1599 }
1600 }
1601
1602 //----- (004D77D2) --------------------------------------------------------
1603 void __cdecl sr_sub_4D77D2(stru315 *a1, stru316 *a2)
1604 {
1605 int v2; // ecx@1
1606 unsigned __int16 *v3; // ebx@2
1607 int v4; // eax@2
1608 unsigned __int16 *v5; // edx@2
1609 int v6; // ebx@4
1610 int v7; // ecx@6
1611 unsigned __int16 v8; // bx@9
1612 int v9; // ecx@9
1613 unsigned int *v10; // edx@9
1614 unsigned int *v11; // edx@10
1615 int v12; // ecx@10
1616 int v13; // eax@10
1617 int v14; // ebx@10
1618 int v15; // [sp-4h] [bp-Ch]@2
1619
1620 v2 = a1->field_28;
1621 if ( v2 )
1622 {
1623 do
1624 {
1625 v15 = v2;
1626 v3 = a1->pTextureLOD;
1627 v4 = *((char *)v3
1628 + (a1->field_C & ((unsigned int)a1->field_30 >> 16))
1629 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10));
1630 v5 = a1->field_34_palette;
1631 if ( *((char *)v3
1632 + (a1->field_C & ((unsigned int)a1->field_30 >> 16))
1633 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10)) )
1634 {
1635 if ( a2->field_20 )
1636 {
1637 v6 = (unsigned int)a2->field_10 >> 16;
1638 if ( v6 >= a2->field_C )
1639 v6 = a2->field_C;
1640 v7 = 0;
1641 if ( a2->field_8 - v6 >= 0 )
1642 v7 = a2->field_8 - v6;
1643 v4 += v7 << 8;
1644 v5 = a2->field_24_palette;
1645 }
1646 v8 = v5[v4];
1647 v9 = a1->field_24;
1648 v10 = a1->pDepthBuffer;
1649 *a1->pColorBuffer = v8;
1650 *v10 = v9;
1651 }
1652 v11 = a1->pDepthBuffer + 1;
1653 ++a1->pColorBuffer;
1654 a1->pDepthBuffer = v11;
1655 v12 = a1->field_30;
1656 a2->field_10 += a2->field_18;
1657 v13 = a1->field_2C;
1658 v14 = a1->field_0;
1659 a1->field_30 = a1->field_4 + v12;
1660 a1->field_2C = v14 + v13;
1661 v2 = v15 - 1;
1662 }
1663 while ( v15 != 1 );
1664 }
1665 }
1666
1667 //----- (004D789A) --------------------------------------------------------
1668 void __cdecl sr_sub_4D789A(stru315 *a1, stru316 *a2)
1669 {
1670 int v2; // ecx@1
1671 unsigned int v3; // eax@2
1672 int v4; // ecx@2
1673 int v5; // eax@10
1674 unsigned __int16 *v6; // edx@10
1675 int v7; // ebx@12
1676 int v8; // ecx@14
1677 unsigned __int16 v9; // bx@17
1678 int v10; // ecx@17
1679 unsigned int *v11; // edx@17
1680 unsigned int *v12; // edx@18
1681 int v13; // ecx@18
1682 int v14; // eax@18
1683 int v15; // ebx@18
1684 int v16; // [sp-4h] [bp-Ch]@2
1685
1686 v2 = a1->field_28;
1687 if ( v2 )
1688 {
1689 do
1690 {
1691 v16 = v2;
1692 v3 = a1->field_30;
1693 v4 = a1->field_2C;
1694 if ( (signed int)v3 >= a1->field_18 )
1695 v3 = a1->field_18;
1696 if ( (signed int)v3 <= a1->field_14 )
1697 v3 = a1->field_14;
1698 if ( v4 >= a1->field_20 )
1699 v4 = a1->field_20;
1700 if ( v4 <= a1->field_1C )
1701 v4 = a1->field_1C;
1702 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10));
1703 v6 = a1->field_34_palette;
1704 if ( v5 )
1705 {
1706 if ( a2->field_20 )
1707 {
1708 v7 = (unsigned int)a2->field_10 >> 16;
1709 if ( v7 >= a2->field_C )
1710 v7 = a2->field_C;
1711 v8 = 0;
1712 if ( a2->field_8 - v7 >= 0 )
1713 v8 = a2->field_8 - v7;
1714 v5 += v8 << 8;
1715 v6 = a2->field_24_palette;
1716 }
1717 v9 = v6[v5];
1718 v10 = a1->field_24;
1719 v11 = a1->pDepthBuffer;
1720 *a1->pColorBuffer = v9;
1721 *v11 = v10;
1722 }
1723 v12 = a1->pDepthBuffer + 1;
1724 ++a1->pColorBuffer;
1725 a1->pDepthBuffer = v12;
1726 v13 = a1->field_30;
1727 a2->field_10 += a2->field_18;
1728 v14 = a1->field_2C;
1729 v15 = a1->field_0;
1730 a1->field_30 = a1->field_4 + v13;
1731 a1->field_2C = v15 + v14;
1732 v2 = v16 - 1;
1733 }
1734 while ( v16 != 1 );
1735 }
1736 }
1737 975
1738 //----- (00451007) -------------------------------------------------------- 976 //----- (00451007) --------------------------------------------------------
1739 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea 977 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea
1740 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, 978 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch,
1741 int a10, int a11) 979 int a10, int a11)
4235 3473
4236 if (GetCurrentMenuID() != MENU_MAIN) 3474 if (GetCurrentMenuID() != MENU_MAIN)
4237 { 3475 {
4238 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) 3476 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
4239 { 3477 {
4240 pIcons_LOD->_4114F2(); 3478 pIcons_LOD->RemoveTexturesPackFromTextureList();
4241 pGUIWindow_CurrentMenu->Release(); 3479 pGUIWindow_CurrentMenu->Release();
4242 pGUIWindow_CurrentMenu = 0; 3480 pGUIWindow_CurrentMenu = 0;
4243 pCurrentScreen = SCREEN_GAME; 3481 pCurrentScreen = SCREEN_GAME;
4244 viewparams->bRedrawGameUI = 1; 3482 viewparams->bRedrawGameUI = 1;
4245 } 3483 }
4294 { 3532 {
4295 pGUIWindow2->Release(); 3533 pGUIWindow2->Release();
4296 pGUIWindow2 = 0; 3534 pGUIWindow2 = 0;
4297 } 3535 }
4298 pWindow_MainMenu->Release(); 3536 pWindow_MainMenu->Release();
4299 pIcons_LOD->_4114F2(); 3537 pIcons_LOD->RemoveTexturesPackFromTextureList();
4300 } 3538 }
4301 3539
4302 //----- (004637EB) -------------------------------------------------------- 3540 //----- (004637EB) --------------------------------------------------------
4303 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) 3541 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
4304 { 3542 {
6245 { 5483 {
6246 Log::Warning(L"MM init: failed"); 5484 Log::Warning(L"MM init: failed");
6247 pGame->Deinitialize(); 5485 pGame->Deinitialize();
6248 return 1; 5486 return 1;
6249 } 5487 }
6250
6251
6252 Log::Warning(L"MM init: ok"); 5488 Log::Warning(L"MM init: ok");
6253 5489
6254 pEventTimer->Pause(); 5490 pEventTimer->Pause();
6255 if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) 5491
6256 {
6257 SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE|0x2), 320, 240, 640, 480, 0);
6258 Rect.left = 325;
6259 Rect.top = 245;
6260 Rect.right = 326;
6261 Rect.bottom = 246;
6262 ClipCursor(&Rect);
6263 }
6264 SetUserInterface(PartyAlignment_Neutral, false); 5492 SetUserInterface(PartyAlignment_Neutral, false);
6265 ShowIntroVideo_and_LoadingScreen(); 5493 ShowIntroVideo_and_LoadingScreen();
6266 WriteWindowsRegistryInt("Ran once", 1); 5494 WriteWindowsRegistryInt("Ran once", 1);
6267 dword_6BE364_game_settings_1 |= 0x4000; 5495 dword_6BE364_game_settings_1 |= 0x4000;
6268 pGame->InitializeGammaController(); 5496 pGame->InitializeGammaController();
6300 DeleteCCharFont(); 5528 DeleteCCharFont();
6301 break; 5529 break;
6302 } 5530 }
6303 DeleteCCharFont(); 5531 DeleteCCharFont();
6304 bFlashQuestBook = true; 5532 bFlashQuestBook = true;
6305 pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); 5533 PlayFullscreenMovie(MOVIE_Emerald);
5534 //pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
6306 SaveNewGame(); 5535 SaveNewGame();
6307 5536
6308 if (bNoMargareth) 5537 if (bNoMargareth)
6309 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); 5538 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1);
6310 pGame->Loop(); 5539 pGame->Loop();