Mercurial > mm7
diff Items.cpp @ 526:214d9d47cf1f
Chest working, but items are not laid correctly
author | Gloval |
---|---|
date | Sun, 03 Mar 2013 01:55:57 +0400 |
parents | 4bd56919f075 |
children | 09108e73f2f4 |
line wrap: on
line diff
--- a/Items.cpp Sat Mar 02 15:38:49 2013 +0400 +++ b/Items.cpp Sun Mar 03 01:55:57 2013 +0400 @@ -25,9 +25,9 @@ }; -char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12}; +const char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12}; -ITEM_VARIATION shopWeap_variation_ord[15] ={ +const ITEM_VARIATION shopWeap_variation_ord[15] ={ { 0, { 0, 0, 0, 0 }}, { 1, { 23, 27, 20, 20 }}, { 1, { 23, 24, 28, 20 }}, @@ -44,7 +44,7 @@ { 2, { 30, 26, 26, 26 }}, { 2, { 28, 25, 28, 29 }}}; -ITEM_VARIATION shopArmr_variation_ord[28] ={ +const ITEM_VARIATION shopArmr_variation_ord[28] ={ { 1, { 35, 35, 38, 38 }}, { 1, { 31, 31, 31, 34 }}, { 1, { 35, 35, 38, 38 }}, @@ -76,10 +76,10 @@ -unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2}; -unsigned __int16 shopAlch_treasure_lvl[13] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; +const unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2}; +const unsigned __int16 shopAlch_treasure_lvl[13] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; -ITEM_VARIATION shopWeap_variation_spc[15]={ +const ITEM_VARIATION shopWeap_variation_spc[15]={ { 0, { 0, 0, 0, 0 }}, { 2, { 25, 30, 20, 20}}, { 2, { 23, 24, 28, 20}}, @@ -96,7 +96,7 @@ { 4, { 30, 26, 26, 26}}, { 4, { 28, 25, 28, 29}}}; -ITEM_VARIATION shopArmr_variation_spc[28]={ +const ITEM_VARIATION shopArmr_variation_spc[28]={ { 2, { 35, 35, 38, 38 }}, { 2, { 31, 31, 31, 34 }}, { 2, { 35, 35, 38, 38 }}, @@ -127,8 +127,18 @@ { 5, { 33, 33, 33, 33 }} }; -unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; -unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2}; +const unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; +const unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2}; + + +char byte_4E8168[7][14]={ //byte_4E8178 + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4}, + { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}, + { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6}, + { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}; int sub_4BE571(int a1, int *a2, int a3, int a4); @@ -2043,8 +2053,8 @@ //----- (00450218) -------------------------------------------------------- -void __cdecl sub_450218_prolly_generate_chests_loot() - { +void sub_450218_prolly_generate_chests_loot() + { unsigned int v0; // eax@1 Chest *v1; // ebx@1 MapInfo *v2; // esi@1 @@ -2076,14 +2086,13 @@ v2 = &pMapStats->pInfos[v0]; v21 = pChests; v20 = &pMapStats->pInfos[v0]; - do + for(int i=0; i<20;++i) { - v3 = v1->mm7__vector_pItems; - v23 = 140; - do + for(int j=0; j<140;++j) { - if ( (v3->uItemID & 0x80000000u) == 0 ) - goto LABEL_56; + v3 = &pChests[i].igChestItems[j]; + if ( v3->uItemID < 0 ) + { v4 = rand() % 5 + 1; v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; @@ -2091,6 +2100,13 @@ v8 = v6 - v5 + 1; v9 = v5 + v7 % v8; v19 = v5 + v7 % v8; + /* switch (v9) + { + default: + + }*/ + + if ( v9 < 7 ) { if ( v18 < 20 ) @@ -2146,7 +2162,7 @@ v13 = v12; if ( v12 >= 140 ) goto LABEL_52; - v14 = &v21->mm7__vector_pItems[v12]; + v14 = &v21->igChestItems[v12]; while ( v14->uItemID ) { ++v13; @@ -2226,17 +2242,14 @@ goto LABEL_25; } v3->GenerateArtifact(); + LABEL_55: v2 = v20; -LABEL_56: - ++v3; - --v23; - } - while ( v23 ); - v1 = v21 + 1; - ++v21; +LABEL_56: ; + } + } } - while ( (signed int)v21 < (signed int)&uNumChests ); + }