changeset 439:6b8118542175

recipie item
author Gloval
date Sun, 24 Feb 2013 14:51:43 +0400
parents 17c90e543e28
children 4946b3ed74be
files Party.cpp Party.h mm7_2.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 6 files changed, 61 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Sun Feb 24 09:52:29 2013 +0200
+++ b/Party.cpp	Sun Feb 24 14:51:43 2013 +0400
@@ -398,7 +398,7 @@
     Dst.Reset();
     if ( bGiveItems )
     {
-      pItemsTable->GenerateItem(2, 40, &Dst);
+      pItemsTable->GenerateItem(2, 40, &Dst); //ring
       pCharacter->AddItem2(-1, &Dst);
       //uSkillIdx = 0;
       //v18 = 0;
--- a/Party.h	Sun Feb 24 09:52:29 2013 +0200
+++ b/Party.h	Sun Feb 24 14:51:43 2013 +0400
@@ -277,8 +277,9 @@
   int field_96BC[1000];
   int field_A65C[1000];
   int field_B5FC[1000];
-  int field_C59C[1000];
-  int field_D53C[1000];
+  char field_C59v[2896];
+  ItemGen Recipes_Item[9][12];   //D0EC
+  char field_E01C[1216];
   int field_E4DC[300];
   int field_E98C[13];
   int dword_E9C0;
@@ -296,7 +297,7 @@
   int armageddon_timer;
   int field_16140;
   int pTurnBasedPlayerRecoveryTimes[4];
-  char field_16154[212];
+  int field_16154[53];
   int uFine;
   float flt_TorchlightColorR;
   float flt_TorchlightColorG;
--- a/mm7_2.cpp	Sun Feb 24 09:52:29 2013 +0200
+++ b/mm7_2.cpp	Sun Feb 24 14:51:43 2013 +0400
@@ -1516,7 +1516,8 @@
     v108 = 0;
     do
     {
-      if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
+   //   if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
+	if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
       {
         v52 = word_F8B158[(signed int)v109] + 30;
         v53 = dword_F8B168[(signed int)v109];
@@ -1552,7 +1553,8 @@
     {
       do
       {
-        if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+       // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
           ++v106.x;
         ++v55;
       }
@@ -1584,7 +1586,7 @@
         v62 = 9 * (v60 + 12 * v61);
         v63 = (ItemGen *)&pParty->field_777C[v62];
         if ( dword_F8B19C != 2 )
-          v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
+          v63 = &pParty->Recipes_Item[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
         if ( !v56 || !Str )
         {
           v85 = 0;
@@ -2091,7 +2093,8 @@
     {
       do
       {
-        if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+        //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
         {
           v54 = dword_F8B168[v114];
           v55 = 152 - v54->uTextureHeight;
@@ -2121,7 +2124,8 @@
       v114 = 0;
       do
       {
-        if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )
+       // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )   //weak 
+	     if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
         {
           v58 = dword_F8B168[v114 + 6];
           v59 = 308 - v58->uTextureHeight;
@@ -2168,7 +2172,8 @@
       {
         do
         {
-          if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+          //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
             ++v109;
           ++v62;
         }
@@ -2204,7 +2209,7 @@
         v69 = 9 * (v67 + 12 * v68);
         v70 = (ItemGen *)&pParty->field_777C[v69];
         if ( dword_F8B19C != 2 )
-          v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
+          v70 = &pParty->Recipes_Item[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
         if ( !v63 || !Str )
         {
           v93 = 0;
@@ -2408,7 +2413,8 @@
       v93 = 0;
       do
       {
-        if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+       // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
           ++v149;
         ++v93;
       }
@@ -2423,9 +2429,9 @@
           --v149;
           v96 = window_SpeakInHouse->ptr_1C;
           v97 = uActiveCharacter - 1;
-          v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724];
+       //   v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724];
           v99 = _this->_490EEE(
-                  (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
+                 &pParty->Recipes_Item[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
                   2,
                   (int)window_SpeakInHouse->ptr_1C,
                   2);
@@ -2439,7 +2445,8 @@
         v153 = 0;
         do
         {
-          if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+          //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
           {
             v105 = dword_F8B168[v104];
             if ( v104 >= 4 )
@@ -2660,7 +2667,8 @@
       v153 = 0;
       do
       {
-        if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
+       // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
         {
           v62 = dword_F8B168[v61];
           if ( v61 >= 4 )
@@ -2706,7 +2714,8 @@
     {
       do
       {
-        if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
+       // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
           ++v149;
         ++v68;
       }
@@ -2738,7 +2747,7 @@
       if ( dword_F8B19C == 2 )
         v77 = (ItemGen *)&pParty->field_777C[v76];
       else
-        v77 = (ItemGen *)&pParty->field_C59C[v76 + 724];
+        v77 = &pParty->Recipes_Item[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
       if ( v69 == (short)v11 || Str == v11 )
       {
         v124 = (__int64 *)v11;
@@ -4258,7 +4267,8 @@
     {
       do
       {
-        v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
+        //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
+	  v50=pParty->Recipes_Item[(unsigned int)v42][(signed int)v43].uItemID;
         if ( v50 )
         {
           v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4281,7 +4291,8 @@
       {
         do
         {
-          if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
+         // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
+		if (pParty->Recipes_Item[(unsigned int)v52][v53].uItemID)
           {
             v54 = rand();
             v8 = window_SpeakInHouse;
@@ -4599,8 +4610,8 @@
     }
     else
     {
-      _this = (ItemGen *)&pParty->field_C59C[v31 + 724];
-      v32 = (ItemGen *)&pParty->field_C59C[v31 + 724];
+      _this =&pParty->Recipes_Item[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
+      v32 = &pParty->Recipes_Item[(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	Sun Feb 24 09:52:29 2013 +0200
+++ b/mm7_4.cpp	Sun Feb 24 14:51:43 2013 +0400
@@ -4915,7 +4915,7 @@
   NPCData *npc = nullptr;
   if ( dword_5C35D4 )
   {
-    __debugbreak(); // fix
+    __debugbreak(); // fix  
     npc = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
   }
   else
@@ -9112,7 +9112,8 @@
     v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
     v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
     if ( dword_F8B19C != 2 )
-      v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
+   //   v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
+		v7 =&pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
   if ( dword_F8B198 <= 16 && dword_F8B19C == 18 )
@@ -12271,7 +12272,8 @@
   {
     do
     {
-      if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+     // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
       {
         v58 = dword_F8B168[v49];
         v59 = 152 - v58->uTextureHeight;
@@ -12303,7 +12305,8 @@
     v122 = 0;
     do
     {
-      if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )
+      //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] )  //weak
+		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
       {
         v62 = dword_F8B168[v122 + 6];
         v63 = 306 - v62->uTextureHeight;
@@ -12350,7 +12353,8 @@
     {
       do
       {
-        if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+        //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
           ++v117;
         ++v66;
       }
@@ -12386,7 +12390,8 @@
       v73 = 9 * (v71 + 12 * v72);
       v74 = (ItemGen *)&pParty->field_777C[v73];
       if ( dword_F8B19C != 2 )
-        v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
+       // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
+	      v74 =&pParty->Recipes_Item[v72][v71];
       if ( v67 && Str )
       {
         v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
@@ -13483,7 +13488,7 @@
 
 
 //----- (004B8F94) --------------------------------------------------------
-void *__cdecl sub_4B8F94()
+void  sub_4B8F94()
 {
   GUIWindow *v0; // edi@1
   signed int v1; // ebp@1
@@ -13533,18 +13538,21 @@
 LABEL_12:
           v6 = v12;
 LABEL_13:
-          pItemsTable->GenerateItem(v5, v6, (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
+          pItemsTable->GenerateItem(v5, v6,&pParty->Recipes_Item[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->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
+		  pParty->Recipes_Item[(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 = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
+		 auto _a =&pParty->Recipes_Item[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;
+	//	v2 = (int)&v0->ptr_1C;
+		//v10 = rand();
+	//	v0 = window_SpeakInHouse;
+       // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
+		   pParty->Recipes_Item[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740;
       }
 LABEL_14:
       v3 = *(int *)v2;
@@ -13561,8 +13569,7 @@
   }
 LABEL_15:
   result = v0->ptr_1C;
-  *(int *)&pParty->field_16154[4 * (int)result] = 0;
-  return result;
+  pParty->field_16154[(int)v0->ptr_1C] = 0;
 }
 
 
--- a/mm7_data.cpp	Sun Feb 24 09:52:29 2013 +0200
+++ b/mm7_data.cpp	Sun Feb 24 14:51:43 2013 +0400
@@ -1660,7 +1660,9 @@
 
 __int16 word_4F0578[777]; // weak
 __int16 word_4F05AE[777]; // weak
-char _4F063C_smthn_by_2da_uType[777]; // weak
+char _4F063C_smthn_by_2da_uType[31]={ // weak
+0, 6, 8, 12, 12, 0, 0, 0, 0, 0, 0, 0, 2, 0, 25, 0, 30,
+0, 20, 0, 20, 0, 2, 0, 23, 0, 24, 0, 28, 0, 20};
 __int16 word_4F063E[290];
 __int16 word_4F06D8[22];
 __int16 word_4F0704[40];
--- a/mm7_data.h	Sun Feb 24 09:52:29 2013 +0200
+++ b/mm7_data.h	Sun Feb 24 14:51:43 2013 +0400
@@ -2330,7 +2330,7 @@
 void __cdecl _4B7D7E_bank();
 void __cdecl TavernDialog();
 void *__cdecl GenerateShopItems();
-void *__cdecl sub_4B8F94();
+void sub_4B8F94();
 char *__cdecl WeaponShopDialog();
 POINT *__cdecl AlchemistDialog();
 void __cdecl ArmorShopDialog();