Mercurial > mm7
comparison Items.cpp @ 1231:182b910c528d
Слияние
author | Ritor1 |
---|---|
date | Sun, 09 Jun 2013 10:18:51 +0600 |
parents | 42b41aaecd87 8c02e6f74b29 |
children | 5450af4f57ef |
comparison
equal
deleted
inserted
replaced
1230:513a7893aa29 | 1231:182b910c528d |
---|---|
26 unsigned __int16 treasure_level; | 26 unsigned __int16 treasure_level; |
27 unsigned __int16 item_class[4]; | 27 unsigned __int16 item_class[4]; |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 const char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12}; | 31 std::array<const char, 5> uItemsAmountPerShopType={ 0, 6, 8, 12, 12}; |
32 | 32 |
33 const ITEM_VARIATION shopWeap_variation_ord[15] ={ | 33 const ITEM_VARIATION shopWeap_variation_ord[15] ={ |
34 { 0, { 0, 0, 0, 0 }}, | 34 { 0, { 0, 0, 0, 0 }}, |
35 { 1, { 23, 27, 20, 20 }}, | 35 { 1, { 23, 27, 20, 20 }}, |
36 { 1, { 23, 24, 28, 20 }}, | 36 { 1, { 23, 24, 28, 20 }}, |
132 | 132 |
133 const unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; | 133 const unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; |
134 const unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2}; | 134 const unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2}; |
135 | 135 |
136 | 136 |
137 char byte_4E8168[7][14]={ //byte_4E8178 | 137 std::array< std::array<char, 14>, 7> byte_4E8168={{ //byte_4E8178 |
138 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | 138 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, |
139 { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, | 139 { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, |
140 { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}, | 140 { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}, |
141 { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4}, | 141 { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4}, |
142 { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}, | 142 { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}, |
143 { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6}, | 143 { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6}, |
144 { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}; | 144 { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}}; |
145 | 145 |
146 int sub_4BE571(int a1, int *a2, int a3, int a4); | 146 int sub_4BE571(int a1, int *a2, int a3, int a4); |
147 | 147 |
148 ItemGen *ptr_50C9A4; | 148 ItemGen *ptr_50C9A4; |
149 | 149 |
1475 const char *format_str; | 1475 const char *format_str; |
1476 | 1476 |
1477 equip_type = pItemsTable->pItems[uItemID].uEquipType; | 1477 equip_type = pItemsTable->pItems[uItemID].uEquipType; |
1478 if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) ) | 1478 if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) ) |
1479 { | 1479 { |
1480 sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName); | 1480 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName); |
1481 return item__getname_buffer; | 1481 return item__getname_buffer.data(); |
1482 } | 1482 } |
1483 sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName); | 1483 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName); |
1484 if ( uItemID == ITEM_LICH_JAR ) //Lich Jar | 1484 if ( uItemID == ITEM_LICH_JAR ) //Lich Jar |
1485 { | 1485 { |
1486 if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) ) | 1486 if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) ) |
1487 { | 1487 { |
1488 player_name = pPlayers[uHolderPlayer]->pName; | 1488 player_name = pPlayers[uHolderPlayer]->pName; |
1489 strlen(player_name); | 1489 strlen(player_name); |
1490 if ( player_name[strlen(player_name) - 1] == 's' ) | 1490 if ( player_name[strlen(player_name) - 1] == 's' ) |
1491 format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar" | 1491 format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar" |
1492 else | 1492 else |
1493 format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar" | 1493 format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar" |
1494 sprintf(item__getname_buffer, format_str, pPlayers[uHolderPlayer]->pName); | 1494 sprintf(item__getname_buffer.data(), format_str, pPlayers[uHolderPlayer]->pName); |
1495 return item__getname_buffer; | 1495 return item__getname_buffer.data(); |
1496 } | 1496 } |
1497 } | 1497 } |
1498 if ( !pItemsTable->IsMaterialNonCommon(this) ) | 1498 if ( !pItemsTable->IsMaterialNonCommon(this) ) |
1499 { | 1499 { |
1500 if ( uEnchantmentType ) | 1500 if ( uEnchantmentType ) |
1501 { | 1501 { |
1502 strcat(item__getname_buffer, " "); | 1502 strcat(item__getname_buffer.data(), " "); |
1503 nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName; | 1503 nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName; |
1504 } | 1504 } |
1505 else | 1505 else |
1506 { | 1506 { |
1507 if ( !uSpecEnchantmentType ) | 1507 if ( !uSpecEnchantmentType ) |
1508 return item__getname_buffer; | 1508 return item__getname_buffer.data(); |
1509 if ( uSpecEnchantmentType == 16 //Drain Hit Points from target. | 1509 if ( uSpecEnchantmentType == 16 //Drain Hit Points from target. |
1510 || uSpecEnchantmentType == 39 //Double damage vs Demons. | 1510 || uSpecEnchantmentType == 39 //Double damage vs Demons. |
1511 || uSpecEnchantmentType == 40 //Double damage vs Dragons | 1511 || uSpecEnchantmentType == 40 //Double damage vs Dragons |
1512 || uSpecEnchantmentType == 45 //+5 Speed and Accuracy | 1512 || uSpecEnchantmentType == 45 //+5 Speed and Accuracy |
1513 || uSpecEnchantmentType == 56 //+5 Might and Endurance. | 1513 || uSpecEnchantmentType == 56 //+5 Might and Endurance. |
1519 || uSpecEnchantmentType == 63 //Double Damage vs. Elves. | 1519 || uSpecEnchantmentType == 63 //Double Damage vs. Elves. |
1520 || uSpecEnchantmentType == 64 //Double Damage vs. Undead. | 1520 || uSpecEnchantmentType == 64 //Double Damage vs. Undead. |
1521 || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill. | 1521 || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill. |
1522 || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class. | 1522 || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class. |
1523 { //enchantment and name positions inverted! | 1523 { //enchantment and name positions inverted! |
1524 sprintf( item__getname_buffer, "%s %s", | 1524 sprintf( item__getname_buffer.data(), "%s %s", |
1525 pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd, | 1525 pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd, |
1526 pItemsTable->pItems[uItemID].pName); | 1526 pItemsTable->pItems[uItemID].pName); |
1527 return item__getname_buffer; | 1527 return item__getname_buffer.data(); |
1528 } | 1528 } |
1529 strcat(item__getname_buffer, " "); | 1529 strcat(item__getname_buffer.data(), " "); |
1530 nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd; | 1530 nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd; |
1531 } | 1531 } |
1532 strcat(item__getname_buffer, nameModificator); | 1532 strcat(item__getname_buffer.data(), nameModificator); |
1533 } | 1533 } |
1534 return item__getname_buffer; | 1534 return item__getname_buffer.data(); |
1535 } | 1535 } |
1536 | 1536 |
1537 | 1537 |
1538 //----- (00456620) -------------------------------------------------------- | 1538 //----- (00456620) -------------------------------------------------------- |
1539 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) | 1539 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) |
2051 Chest *v21; // [sp+1Ch] [bp-Ch]@1 | 2051 Chest *v21; // [sp+1Ch] [bp-Ch]@1 |
2052 int v22; // [sp+20h] [bp-8h]@26 | 2052 int v22; // [sp+20h] [bp-8h]@26 |
2053 signed int v23; // [sp+24h] [bp-4h]@2 | 2053 signed int v23; // [sp+24h] [bp-4h]@2 |
2054 | 2054 |
2055 v18 = rand() % 100; //main random | 2055 v18 = rand() % 100; //main random |
2056 v0 = pMapStats->GetMapInfo(pCurrentMapName); | 2056 v0 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
2057 // v1 = pChests; | 2057 // v1 = pChests; |
2058 v2 = &pMapStats->pInfos[v0]; | 2058 v2 = &pMapStats->pInfos[v0]; |
2059 //v21 = pChests; | 2059 //v21 = pChests; |
2060 //v20 = &pMapStats->pInfos[v0]; | 2060 //v20 = &pMapStats->pInfos[v0]; |
2061 for(int i=1; i<20;++i) | 2061 for(int i=1; i<20;++i) |