changeset 470:fcdaa804074f

Tables for shopgenerators
author Gloval
date Mon, 25 Feb 2013 17:58:00 +0400
parents 0dbf780e247f
children c43f156a95c9
files Items.cpp Party.h mm7_2.cpp mm7_4.cpp
diffstat 4 files changed, 78 insertions(+), 133 deletions(-) [+]
line wrap: on
line diff
--- a/Items.cpp	Mon Feb 25 17:27:27 2013 +0600
+++ b/Items.cpp	Mon Feb 25 17:58:00 2013 +0400
@@ -44,7 +44,7 @@
 	{ 2, { 30, 26, 26, 26 }},
 	{ 2, { 28, 25, 28, 29 }}};
 
-ITEM_VARIATION shopArmr_variation_ord[30] ={
+ITEM_VARIATION shopArmr_variation_ord[28] ={
 	{ 1, { 35, 35, 38, 38 }},
 	{ 1, { 31, 31, 31, 34 }},
 	{ 1, { 35, 35, 38, 38 }},
@@ -77,28 +77,58 @@
 
 
 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};
+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]={
 	{ 0, { 0, 0, 0, 0 }},
-{ 2, { 25, 30, 20, 20}},
-{ 2, { 23, 24, 28, 20}},
-{ 3, { 23, 24, 25, 20}},
-{ 3, { 27, 27, 26, 26}},
-{ 5, { 23, 26, 28, 27}},
-{ 5, { 23, 26, 28, 27}},
-{ 4, { 30, 24, 20, 20}},
-{ 3, { 20, 20, 20, 20}},
-{ 4, { 27, 27, 26, 26}},
-{ 4, { 28, 28, 25, 25}},
-{ 4, { 23, 23, 24, 24}},
-{ 4, { 24, 24, 27, 20}},
-{ 4, { 30, 26, 26, 26}},
-{ 4, { 28, 25, 28, 29}}};
+	{ 2, { 25, 30, 20, 20}},
+	{ 2, { 23, 24, 28, 20}},
+	{ 3, { 23, 24, 25, 20}},
+	{ 3, { 27, 27, 26, 26}},
+	{ 5, { 23, 26, 28, 27}},
+	{ 5, { 23, 26, 28, 27}},
+	{ 4, { 30, 24, 20, 20}},
+	{ 3, { 20, 20, 20, 20}},
+	{ 4, { 27, 27, 26, 26}},
+	{ 4, { 28, 28, 25, 25}},
+	{ 4, { 23, 23, 24, 24}},
+	{ 4, { 24, 24, 27, 20}},
+	{ 4, { 30, 26, 26, 26}},
+	{ 4, { 28, 25, 28, 29}}};
 
-
+ITEM_VARIATION shopArmr_variation_spc[28]={
+	{ 2, { 35, 35, 38, 38 }},
+	{ 2, { 31, 31, 31, 34 }},
+	{ 2, { 35, 35, 38, 38 }},
+	{ 2, { 31, 31, 32, 34 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 32, 32, 33 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 31, 32, 32 }},
+	{ 5, { 35, 35, 38, 38 }},
+	{ 5, { 31, 32, 33, 34 }},
+	{ 5, { 35, 35, 38, 38 }},
+	{ 5, { 31, 32, 33, 34 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 31, 31, 31, 31 }},
+	{ 3, { 35, 35, 38, 38 }},
+	{ 3, { 31, 32, 34, 34 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 31, 31, 32, 33 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 32, 32, 33, 34 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 31, 31, 31, 32 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 32, 32, 32, 32 }},
+	{ 4, { 35, 35, 38, 38 }},
+	{ 4, { 34, 34, 34, 34 }},
+	{ 5, { 35, 35, 38, 38 }},
+	{ 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 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};
 
 
 ItemGen *ptr_50C9A4;
@@ -1960,20 +1990,6 @@
 //----- (004B8F94) --------------------------------------------------------
 void  GenerateSpecialShopItems()
 	{
-	/*GUIWindow *v0; // edi@1
-	signed int v1; // ebp@1
-	int v2; // ebx@1
-	signed int v3; // esi@1
-	int v4; // eax@3
-	int v5; // ebx@3
-	int v6; // ecx@3
-	bool v7; // eax@5
-	bool v8; // ST1C_4@5
-	int v9; // eax@5
-	int v10; // eax@10
-	void *result; // eax@15
-	signed int v12; // [sp-4h] [bp-18h]@7*/
-
 	signed int item_count; 
 	signed int shop_index; 
 	int treasure_lvl; 
@@ -1995,8 +2011,8 @@
 				mdf =0;
 				if (item_count > 3)
 					++mdf;
-				treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level;
-				item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4];
+				treasure_lvl = shopArmr_variation_spc[2*(shop_index-15)+mdf].treasure_level;
+				item_class =shopArmr_variation_spc[2*(shop_index-15)+mdf].item_class[rand() % 4];
 				}
 			else if (shop_index<=41)  //magic shop
 				{
@@ -2007,92 +2023,21 @@
 				{
 				if (item_count<6)
 					{
-					pParty->SpecialItemsInShop[shop_index][item_count].Reset();
-					pParty->SpecialItemsInShop[shop_index][item_count].uItemID = rand() % 32 + 740;  //mscrool
+					pParty->SpecialItemsInShops[shop_index][item_count].Reset();
+					pParty->SpecialItemsInShops[shop_index][item_count].uItemID = rand() % 32 + 740;  //mscrool
 					continue;
 					}
 				else
 					{
-					treasure_lvl = shopAlch_treasure_lvl[shop_index-41];
+					treasure_lvl = shopAlchSpc_treasure_lvl[shop_index-41];
 					item_class = 44;  //potion
 					}
 				}
-			pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShop[shop_index][item_count]);
-			pParty->SpecialItemsInShop[shop_index][item_count].SetIdentified();  //identified
+			pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShops[shop_index][item_count]);
+			pParty->SpecialItemsInShops[shop_index][item_count].SetIdentified();  //identified
 			}
 		}
 	pParty->InTheShopFlags[shop_index] = 0;
-
-
-
-/*
-
-	v0 = window_SpeakInHouse;
-	v1 = 0;
-	v2 = (int)&window_SpeakInHouse->ptr_1C;
-	v3 = (signed int)window_SpeakInHouse->ptr_1C;
-	//if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
-	if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
-		{
-		while ( v3 > 14 )
-			{
-			if ( v3 <= 28 )
-				{
-				v7 = v1 > 3;
-				v8 = v7;
-				v9 = 5 * (v7 + 2 * v3 - 30);
-				v3 = (signed int)v0->ptr_1C;
-				v5 = word_4F06D8[v9];
-				v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4];
-				goto LABEL_13;
-				}
-			if ( v3 <= 41 )
-				{
-				v5 = word_4F07B6[v3];
-				v12 = 22;
-				goto LABEL_12;
-				}
-			if ( v3 <= 53 )
-				{
-				if ( v1 >= 6 )
-					{
-					v5 = word_4F07B6[v3 + 1];
-					v12 = 44;
-LABEL_12:
-					v6 = v12;
-LABEL_13:
-					pItemsTable->GenerateItem(v5, v6,&pParty->SpecialItemsInShop[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
-					v0 = window_SpeakInHouse;
-					v2 = (int)&window_SpeakInHouse->ptr_1C;
-					// pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
-					pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1;
-					goto LABEL_14;
-					}
-				// auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
-				auto _a =&pParty->SpecialItemsInShop[v3][v1];
-				_a->Reset();
-				//	v2 = (int)&v0->ptr_1C;
-				//v10 = rand();
-				//	v0 = window_SpeakInHouse;
-				// pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
-				pParty->SpecialItemsInShop[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740;
-				}
-LABEL_14:
-			v3 = *(int *)v2;
-			++v1;
-			//if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] )
-			if ( v1 >= (unsigned __int8)uItemsAmountPerShopType[p2DEvents[*(int *)v2 - 1].uType] )
-				goto LABEL_15;
-			}
-		v4 = 5 * v3;
-		v3 = (signed int)v0->ptr_1C;
-		v5 = word_4F063E[v4];
-		v6 = word_4F063E[5 * v3 + rand() % 4 + 1];
-		goto LABEL_13;
-		}
-LABEL_15:
-	result = v0->ptr_1C;
-	pParty->InTheShopFlags[(int)v0->ptr_1C] = 0;*/
 	}
 
 
--- a/Party.h	Mon Feb 25 17:27:27 2013 +0600
+++ b/Party.h	Mon Feb 25 17:58:00 2013 +0400
@@ -273,7 +273,7 @@
   ItemGen pPickedItem;
   unsigned int uFlags;
   ItemGen StandartItemsInShops[53][12];
-  ItemGen SpecialItemsInShop[53][12];   //D0EC
+  ItemGen SpecialItemsInShops[53][12];   //D0EC
   int field_12A5C[2117];
   char field_14B70[5000];
   char field_15EF8[250];
--- a/mm7_2.cpp	Mon Feb 25 17:27:27 2013 +0600
+++ b/mm7_2.cpp	Mon Feb 25 17:58:00 2013 +0400
@@ -1440,7 +1440,7 @@
     do
     {
    //   if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
-	if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
+	if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
       {
         v52 = word_F8B158[(signed int)v109] + 30;
         v53 = dword_F8B168[(signed int)v109];
@@ -1477,7 +1477,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
           ++v106.x;
         ++v55;
       }
@@ -1509,7 +1509,7 @@
       //  v62 = 9 * (v60 + 12 * v61);
         v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
         if ( dword_F8B19C != 2 )
-          v63 = &pParty->SpecialItemsInShop[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
+          v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
         if ( !v56 || !Str )
         {
           v85 = 0;
@@ -2019,7 +2019,7 @@
       do
       {
         //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
         {
           v54 = dword_F8B168[v114];
           v55 = 152 - v54->uTextureHeight;
@@ -2050,7 +2050,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )   //weak 
-	     if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
+	     if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
         {
           v58 = dword_F8B168[v114 + 6];
           v59 = 308 - v58->uTextureHeight;
@@ -2099,7 +2099,7 @@
         do
         {
           //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
+		if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
             ++v109;
           ++v62;
         }
@@ -2135,7 +2135,7 @@
       //  v69 = 9 * (v67 + 12 * v68);
         v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
         if ( dword_F8B19C != 2 )
-          v70 = &pParty->SpecialItemsInShop[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
+          v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
         if ( !v63 || !Str )
         {
           v93 = 0;
@@ -2340,7 +2340,7 @@
       do
       {
        // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
           ++v149;
         ++v93;
       }
@@ -2357,7 +2357,7 @@
           v97 = uActiveCharacter - 1;
        //   v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724];
           v99 = _this->_490EEE(
-                 &pParty->SpecialItemsInShop[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
+                 &pParty->SpecialItemsInShops[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
                   2,
                   (int)window_SpeakInHouse->ptr_1C,
                   2);
@@ -2372,7 +2372,7 @@
         do
         {
           //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
+		if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
           {
             v105 = dword_F8B168[v104];
             if ( v104 >= 4 )
@@ -2595,7 +2595,7 @@
       do
       {
        // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
         {
           v62 = dword_F8B168[v61];
           if ( v61 >= 4 )
@@ -2643,7 +2643,7 @@
       do
       {
        // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
           ++v149;
         ++v68;
       }
@@ -2675,7 +2675,7 @@
       if ( dword_F8B19C == 2 )
         v77 = (ItemGen *)&pParty->StandartItemsInShops[v76];
       else
-        v77 = &pParty->SpecialItemsInShop[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
+        v77 = &pParty->SpecialItemsInShops[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
       if ( v69 == (short)v11 || Str == v11 )
       {
         v124 = (__int64 *)v11;
@@ -4197,7 +4197,7 @@
       do
       {
         //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
-	  v50=pParty->SpecialItemsInShop[(unsigned int)v42][(signed int)v43].uItemID;
+	  v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
         if ( v50 )
         {
           v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4221,7 +4221,7 @@
         do
         {
          // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
-		if (pParty->SpecialItemsInShop[(unsigned int)v52][v53].uItemID)
+		if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
           {
             v54 = rand();
             v8 = window_SpeakInHouse;
@@ -4539,8 +4539,8 @@
     }
     else
     {
-      _this =&pParty->SpecialItemsInShop[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
-      v32 = &pParty->SpecialItemsInShop[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
+      _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
+      v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
     }
     //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
     v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
--- a/mm7_4.cpp	Mon Feb 25 17:27:27 2013 +0600
+++ b/mm7_4.cpp	Mon Feb 25 17:58:00 2013 +0400
@@ -9113,7 +9113,7 @@
     v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
     if ( dword_F8B19C != 2 )
    //   v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
-		v7 =&pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
+		v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
   if ( dword_F8B198 <= 16 && dword_F8B19C == 18 )
@@ -11846,7 +11846,7 @@
     do
     {
      // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
+	if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
       {
         v58 = dword_F8B168[v49];
         v59 = 152 - v58->uTextureHeight;
@@ -11879,7 +11879,7 @@
     do
     {
       //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] )  //weak
-		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
+		if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
       {
         v62 = dword_F8B168[v122 + 6];
         v63 = 306 - v62->uTextureHeight;
@@ -11927,7 +11927,7 @@
       do
       {
         //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
-	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
+	  if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
           ++v117;
         ++v66;
       }
@@ -11964,7 +11964,7 @@
       v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
       if ( dword_F8B19C != 2 )
        // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
-	      v74 =&pParty->SpecialItemsInShop[v72][v71];
+	      v74 =&pParty->SpecialItemsInShops[v72][v71];
       if ( v67 && Str )
       {
         v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"