Mercurial > mm7
comparison Items.cpp @ 2267:6532bbac1a9e
Слияние
author | Ritor1 |
---|---|
date | Sat, 08 Mar 2014 23:53:09 +0600 |
parents | 3d644efae786 |
children | b13ab8114e5d |
comparison
equal
deleted
inserted
replaced
2266:01489aec3cb0 | 2267:6532bbac1a9e |
---|---|
371 materialMap["artifact"] = MATERIAL_ARTEFACT; | 371 materialMap["artifact"] = MATERIAL_ARTEFACT; |
372 materialMap["relic"] = MATERIAL_RELIC; | 372 materialMap["relic"] = MATERIAL_RELIC; |
373 materialMap["special"] = MATERIAL_SPECIAL; | 373 materialMap["special"] = MATERIAL_SPECIAL; |
374 | 374 |
375 int i,j; | 375 int i,j; |
376 char* test_string; | 376 char* test_string; |
377 unsigned char c; | 377 int item_counter; |
378 bool break_loop; | |
379 unsigned int temp_str_len; | |
380 char* tmp_pos; | |
381 int decode_step; | |
382 int item_counter; | |
383 | 378 |
384 pMapStats = new MapStats; | 379 pMapStats = new MapStats; |
385 pMapStats->Initialize(); | 380 pMapStats->Initialize(); |
386 | 381 |
387 pMonsterStats = new MonsterStats; | 382 pMonsterStats = new MonsterStats; |
453 test_string = strtok(NULL, "\r") + 1; | 448 test_string = strtok(NULL, "\r") + 1; |
454 auto tokens = Tokenize(test_string, '\t'); | 449 auto tokens = Tokenize(test_string, '\t'); |
455 Assert(tokens.size() >= 17, "Invalid number of tokens"); | 450 Assert(tokens.size() >= 17, "Invalid number of tokens"); |
456 pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(tokens[0]); | 451 pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(tokens[0]); |
457 pSpecialEnchantments[i].pNameAdd= RemoveQuotes(tokens[1]); | 452 pSpecialEnchantments[i].pNameAdd= RemoveQuotes(tokens[1]); |
458 for (int i = 0; i < 12; i++) | 453 for (int j = 0; j < 12; j++) |
459 { | 454 { |
460 pSpecialEnchantments[i].to_item_apply[i]=atoi(tokens[i+2]); | 455 pSpecialEnchantments[i].to_item_apply[j]=atoi(tokens[j+2]); |
461 } | 456 } |
462 int res; | 457 int res; |
463 res=atoi(tokens[14]); | 458 res=atoi(tokens[14]); |
464 if(!res) | 459 if(!res) |
465 { | 460 { |
474 | 469 |
475 pSpecialEnchantments_count = 71; | 470 pSpecialEnchantments_count = 71; |
476 memset(&pSpecialEnchantmentsSumm, 0, 96); | 471 memset(&pSpecialEnchantmentsSumm, 0, 96); |
477 for(i=0;i<12;++i) | 472 for(i=0;i<12;++i) |
478 { | 473 { |
479 for (j=0;j<=pSpecialEnchantments_count;++j) | 474 for (unsigned int j=0;j<=pSpecialEnchantments_count;++j) |
480 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; | 475 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; |
481 } | 476 } |
482 | 477 |
483 Initialize2DA(); | 478 Initialize2DA(); |
484 | 479 |
498 pItems[item_counter].pName = RemoveQuotes(tokens[2]); | 493 pItems[item_counter].pName = RemoveQuotes(tokens[2]); |
499 pItems[item_counter].uValue=atoi(tokens[3]); | 494 pItems[item_counter].uValue=atoi(tokens[3]); |
500 auto findResult = equipStatMap.find(tokens[4]); | 495 auto findResult = equipStatMap.find(tokens[4]); |
501 pItems[item_counter].uEquipType = findResult == equipStatMap.end() ? EQUIP_NONE : findResult->second; | 496 pItems[item_counter].uEquipType = findResult == equipStatMap.end() ? EQUIP_NONE : findResult->second; |
502 auto findResult2 = equipSkillMap.find(tokens[5]); | 497 auto findResult2 = equipSkillMap.find(tokens[5]); |
503 pItems[item_counter].uSkillType = findResult2 == equipSkillMap.end() ? PLAYER_SKILL_MISC : findResult->second; | 498 pItems[item_counter].uSkillType = findResult2 == equipSkillMap.end() ? PLAYER_SKILL_MISC : findResult2->second; |
504 auto tokens2 = Tokenize(tokens[6], 'd'); | 499 auto tokens2 = Tokenize(tokens[6], 'd'); |
505 if (tokens2.size() == 2) | 500 if (tokens2.size() == 2) |
506 { | 501 { |
507 pItems[item_counter].uDamageDice=atoi(tokens2[0]); | 502 pItems[item_counter].uDamageDice=atoi(tokens2[0]); |
508 pItems[item_counter].uDamageRoll=atoi(tokens2[1]); | 503 pItems[item_counter].uDamageRoll=atoi(tokens2[1]); |
517 pItems[item_counter].uDamageDice=0; | 512 pItems[item_counter].uDamageDice=0; |
518 pItems[item_counter].uDamageRoll=0; | 513 pItems[item_counter].uDamageRoll=0; |
519 } | 514 } |
520 pItems[item_counter].uDamageMod=atoi(tokens[7]); | 515 pItems[item_counter].uDamageMod=atoi(tokens[7]); |
521 auto findResult3 = materialMap.find(tokens[8]); | 516 auto findResult3 = materialMap.find(tokens[8]); |
522 pItems[item_counter].uSkillType = findResult3 == materialMap.end() ? MATERIAL_COMMON : findResult->second; | 517 pItems[item_counter].uMaterial = findResult3 == materialMap.end() ? MATERIAL_COMMON : findResult->second; |
523 pItems[item_counter].uItemID_Rep_St=atoi(tokens[9]); | 518 pItems[item_counter].uItemID_Rep_St=atoi(tokens[9]); |
524 pItems[item_counter].pUnidentifiedName = RemoveQuotes(tokens[10]); | 519 pItems[item_counter].pUnidentifiedName = RemoveQuotes(tokens[10]); |
525 pItems[item_counter].uSpriteID=atoi(tokens[11]); | 520 pItems[item_counter].uSpriteID=atoi(tokens[11]); |
526 | 521 |
527 pItems[item_counter]._additional_value=0; | 522 pItems[item_counter]._additional_value=0; |
1041 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) | 1036 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) |
1042 { | 1037 { |
1043 | 1038 |
1044 ItemsTable *v5; // edi@1 | 1039 ItemsTable *v5; // edi@1 |
1045 int v6; // ebx@3 | 1040 int v6; // ebx@3 |
1046 int *v7; // ecx@33 | 1041 //int *v7; // ecx@33 |
1047 //int v8; // eax@34 | 1042 //int v8; // eax@34 |
1048 //int v9; // eax@39 | 1043 //int v9; // eax@39 |
1049 int current_chance; // ebx@43 | 1044 int current_chance; // ebx@43 |
1050 int tmp_chance; // ecx@47 | 1045 int tmp_chance; // ecx@47 |
1051 unsigned int *v12; // edx@48 | |
1052 unsigned int v13; // eax@49 | |
1053 signed int v14; // ebx@52 | |
1054 int v15; // eax@53 | |
1055 signed int v16; // eax@55 | |
1056 int v17; // ebx@57 | 1046 int v17; // ebx@57 |
1057 int v18; // edx@62 | 1047 int v18; // edx@62 |
1058 signed int v19; // ebx@70 | 1048 unsigned int special_chance; // edx@86 |
1059 unsigned __int8 v20; // al@81 | 1049 unsigned int v26; // edx@89 |
1060 int v21; // eax@84 | |
1061 int v22; // ebx@85 | |
1062 int v23; // eax@86 | |
1063 int v24; // ebx@86 | |
1064 int special_chance; // edx@86 | |
1065 int v26; // edx@89 | |
1066 unsigned int v27; // eax@89 | 1050 unsigned int v27; // eax@89 |
1067 int i; // ebx@89 | |
1068 unsigned int v29; // ecx@90 | |
1069 int v30; // ebx@91 | |
1070 int v31; // eax@91 | |
1071 int v32; // ecx@91 | 1051 int v32; // ecx@91 |
1072 int v33; // eax@91 | 1052 int v33; // eax@91 |
1073 int v34; // eax@97 | 1053 unsigned int v34; // eax@97 |
1074 unsigned __int8 v35; // sf@97 | |
1075 unsigned __int8 v36; // of@97 | |
1076 int v37; // ebx@98 | |
1077 int v38; // edx@99 | |
1078 signed int v39; // ebx@101 | |
1079 int v40; // ecx@102 | |
1080 char v41; // zf@107 | |
1081 char v42; // al@108 | |
1082 char v43; // al@111 | |
1083 int *v44; // edx@118 | |
1084 int v45; // eax@120 | 1054 int v45; // eax@120 |
1085 int v46; // edx@120 | 1055 int v46; // edx@120 |
1086 int j; // eax@121 | 1056 int j; // eax@121 |
1087 unsigned int v48; // ecx@123 | |
1088 int v49; // eax@123 | |
1089 int v50; // eax@123 | |
1090 int val_list[800]; // [sp+Ch] [bp-C88h]@33 | 1057 int val_list[800]; // [sp+Ch] [bp-C88h]@33 |
1091 int total_chance; // [sp+C8Ch] [bp-8h]@33 | 1058 int total_chance; // [sp+C8Ch] [bp-8h]@33 |
1092 int v53; // [sp+C90h] [bp-4h]@1 | |
1093 int v54; // [sp+C9Ch] [bp+8h]@3 | 1059 int v54; // [sp+C9Ch] [bp+8h]@3 |
1094 //int v55; // [sp+CA0h] [bp+Ch]@34 | 1060 //int v55; // [sp+CA0h] [bp+Ch]@34 |
1095 signed int v56; // [sp+CA0h] [bp+Ch]@55 | 1061 signed int v56; // [sp+CA0h] [bp+Ch]@55 |
1096 int v57; // [sp+CA0h] [bp+Ch]@62 | 1062 int v57; // [sp+CA0h] [bp+Ch]@62 |
1097 int *v58; // [sp+CA0h] [bp+Ch]@102 | |
1098 int v59; // [sp+CA0h] [bp+Ch]@123 | |
1099 //signed int a2a; // [sp+CA4h] [bp+10h]@33 | |
1100 int a2b; // [sp+CA4h] [bp+10h]@101 | |
1101 int a2c; // [sp+CA4h] [bp+10h]@120 | |
1102 | 1063 |
1103 v5 = this; | 1064 v5 = this; |
1104 if (!out_item) | 1065 if (!out_item) |
1105 out_item = (ItemGen *)malloc(sizeof(ItemGen)); | 1066 out_item = (ItemGen *)malloc(sizeof(ItemGen)); |
1106 memset(out_item, 0, sizeof(*out_item)); | 1067 memset(out_item, 0, sizeof(*out_item)); |
1268 case EQUIP_SINGLE_HANDED: | 1229 case EQUIP_SINGLE_HANDED: |
1269 case EQUIP_TWO_HANDED : | 1230 case EQUIP_TWO_HANDED : |
1270 case EQUIP_BOW : | 1231 case EQUIP_BOW : |
1271 if ( !uBonusChanceWpSpecial[v6] ) | 1232 if ( !uBonusChanceWpSpecial[v6] ) |
1272 return; | 1233 return; |
1273 if ((rand() % 100)>=uBonusChanceWpSpecial[v6]) | 1234 if ((uint)(rand() % 100)>=uBonusChanceWpSpecial[v6]) |
1274 return; | 1235 return; |
1275 break; | 1236 break; |
1276 case EQUIP_ARMOUR : | 1237 case EQUIP_ARMOUR : |
1277 case EQUIP_SHIELD : | 1238 case EQUIP_SHIELD : |
1278 case EQUIP_HELMET : | 1239 case EQUIP_HELMET : |
1325 | 1286 |
1326 j=0; | 1287 j=0; |
1327 int spc_sum=0; | 1288 int spc_sum=0; |
1328 int spc; | 1289 int spc; |
1329 memset(&val_list, 0, 3200); | 1290 memset(&val_list, 0, 3200); |
1330 for (int i=0; i<pSpecialEnchantments_count;++i) | 1291 for (unsigned int i=0; i<pSpecialEnchantments_count;++i) |
1331 { | 1292 { |
1332 int tr_lv= pSpecialEnchantments[i].iTreasureLevel; | 1293 int tr_lv= pSpecialEnchantments[i].iTreasureLevel; |
1333 switch ( treasure_level - 1 ) | 1294 switch ( treasure_level - 1 ) |
1334 { | 1295 { |
1335 case 2: | 1296 case 2: |
2032 | 1993 |
2033 //----- (00450218) -------------------------------------------------------- | 1994 //----- (00450218) -------------------------------------------------------- |
2034 void GenerateItemsInChest() | 1995 void GenerateItemsInChest() |
2035 { | 1996 { |
2036 unsigned int v0; // eax@1 | 1997 unsigned int v0; // eax@1 |
2037 Chest *v1; // ebx@1 | |
2038 MapInfo *v2; // esi@1 | 1998 MapInfo *v2; // esi@1 |
2039 ItemGen *v3; // ebx@2 | 1999 ItemGen *v3; // ebx@2 |
2040 int v4; // ebp@4 | 2000 int v4; // ebp@4 |
2041 int v5; // edi@4 | 2001 int v5; // edi@4 |
2042 int v6; // esi@4 | 2002 int v6; // esi@4 |
2043 int v7; // eax@4 | |
2044 signed int v8; // esi@4 | 2003 signed int v8; // esi@4 |
2045 int v9; // edx@4 | 2004 int v9; // edx@4 |
2046 int v10; // esi@8 | 2005 int v10; // esi@8 |
2047 int v11; // ebp@25 | 2006 int v11; // ebp@25 |
2048 int v12; // esi@25 | 2007 int v12; // esi@25 |
2049 signed int v13; // ebp@27 | |
2050 ItemGen *v14; // edi@28 | 2008 ItemGen *v14; // edi@28 |
2051 signed int v15; // edx@32 | |
2052 signed __int64 v16; // qtt@32 | |
2053 int v17; // esi@34 | |
2054 signed int v18; // [sp+10h] [bp-18h]@1 | 2009 signed int v18; // [sp+10h] [bp-18h]@1 |
2055 int v19; // [sp+14h] [bp-14h]@4 | |
2056 MapInfo *v20; // [sp+18h] [bp-10h]@1 | |
2057 Chest *v21; // [sp+1Ch] [bp-Ch]@1 | |
2058 int v22; // [sp+20h] [bp-8h]@26 | |
2059 signed int v23; // [sp+24h] [bp-4h]@2 | |
2060 | 2010 |
2061 v18 = rand() % 100; //main random | 2011 v18 = rand() % 100; //main random |
2062 v0 = pMapStats->GetMapInfo(pCurrentMapName); | 2012 v0 = pMapStats->GetMapInfo(pCurrentMapName); |
2063 // v1 = pChests; | 2013 // v1 = pChests; |
2064 v2 = &pMapStats->pInfos[v0]; | 2014 v2 = &pMapStats->pInfos[v0]; |
2357 //----- (0043C91D) -------------------------------------------------------- | 2307 //----- (0043C91D) -------------------------------------------------------- |
2358 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) | 2308 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) |
2359 { | 2309 { |
2360 int result; // eax@2 | 2310 int result; // eax@2 |
2361 char v5; // zf@3 | 2311 char v5; // zf@3 |
2362 const char *v6; // [sp-Ch] [bp-18h]@88 | |
2363 signed int v7; // [sp-8h] [bp-14h]@61 | |
2364 int v8; // [sp-4h] [bp-10h]@61 | |
2365 signed int v9; // [sp-4h] [bp-10h]@69 | |
2366 | 2312 |
2367 result = 0; //BUG fn is void | 2313 result = 0; //BUG fn is void |
2368 if ( item_id <= 500 ) | 2314 if ( item_id <= 500 ) |
2369 { | 2315 { |
2370 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; | 2316 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; |