diff mm7_2.cpp @ 468:8822405efad2

Слияние
author Ritor1
date Mon, 25 Feb 2013 11:10:57 +0600
parents 5d2667144526 f7b91ef98ab2
children 0dbf780e247f
line wrap: on
line diff
--- a/mm7_2.cpp	Mon Feb 25 11:09:55 2013 +0600
+++ b/mm7_2.cpp	Mon Feb 25 11:10:57 2013 +0600
@@ -925,84 +925,6 @@
   }
 }
 
-//----- (004B8E3D) --------------------------------------------------------
-void *__cdecl GenerateShopItems()
-{
-  GUIWindow *v0; // eax@1
-  signed int v1; // edi@1
-  signed int v2; // esi@1
-  int v3; // ecx@3
-  int v4; // ebx@3
-  int v5; // ecx@3
-  bool v6; // ebp@5
-  int v7; // ecx@5
-  void *result; // eax@15
-  signed int v9; // [sp-Ch] [bp-14h]@7
-
-  v0 = window_SpeakInHouse;
-  v1 = 0;
-  v2 = (signed int)window_SpeakInHouse->ptr_1C;
-  //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
-  if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
-  {
-    while ( v2 > 14 )
-    {
-      if ( v2 <= 28 )
-      {
-        v6 = v1 > 3;
-        v7 = v6 + 2 * v2 - 30;
-        v2 = (signed int)v0->ptr_1C;
-        v4 = word_4F0498[5 * v7];
-        __debugbreak();
-        //things happen around word_4F0400 actually
-        //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10];
-        goto LABEL_13;
-      }
-      if ( v2 <= 41 )
-      {
-        v4 = word_4F0576[v2];
-        v9 = 22;  //misc
-        goto LABEL_12;
-      }
-      if ( v2 <= 53 )
-      {
-        if ( v1 >= 6 )
-        {
-          v4 = word_4F0578[v2];
-          v9 = 45;  //reagent
-LABEL_12:
-          v5 = v9;
-LABEL_13:
-          pItemsTable->GenerateItem(v4, v5, (ItemGen *)&pParty->field_777C[v2][v1]);//9 * (v1 + 12 * v2)]);
-          v0 = window_SpeakInHouse;
-          pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes = 1;  //identified
-          goto LABEL_14;
-        }
-        auto _t = (ItemGen *)&pParty->field_777C[v2][v1];
-        _t->Reset();
-        v0 = window_SpeakInHouse;
-        pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uItemID = 220;  //potion bottle
-      }
-LABEL_14:
-      v2 = (signed int)v0->ptr_1C;
-      ++v1;
-      //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v0->ptr_1C]] )
-      if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v0->ptr_1C - 1].uType] )
-        goto LABEL_15;
-    }
-    v3 = 5 * v2;
-    v2 = (signed int)v0->ptr_1C;
-    v4 = word_4F0404[v3 - 4];
-    v5 = word_4F0404[5 * v2 + rand() % 4 - 2];
-    goto LABEL_13;
-  }
-LABEL_15:
-  result = v0->ptr_1C;
-  *(int *)&pParty->field_16154[4 * (int)result] = 0;
-  return result;
-}
-
-
 
 //----- (004B910F) --------------------------------------------------------
 char *__cdecl WeaponShopDialog()
@@ -1492,7 +1414,7 @@
     do
     {
     //  if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
-	if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
+	if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
       {
         v49 = word_F8B158[(signed int)v48];
         v50 = dword_F8B168[(signed int)v48];
@@ -1518,7 +1440,7 @@
     do
     {
    //   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)
+	if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
       {
         v52 = word_F8B158[(signed int)v109] + 30;
         v53 = dword_F8B168[(signed int)v109];
@@ -1544,7 +1466,7 @@
       v106.x = 0;
       do
       {
-        if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+        if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
           ++v106.x;
         ++v55;
       }
@@ -1555,7 +1477,7 @@
       do
       {
        // 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)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
           ++v106.x;
         ++v55;
       }
@@ -1585,9 +1507,9 @@
         v106.x = v60;
         v61 = (int)window_SpeakInHouse->ptr_1C;
       //  v62 = 9 * (v60 + 12 * v61);
-        v63 = (ItemGen *)&pParty->field_777C[(int)v61][v60];
+        v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
         if ( dword_F8B19C != 2 )
-          v63 = &pParty->Recipes_Item[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
+          v63 = &pParty->SpecialItemsInShop[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
         if ( !v56 || !Str )
         {
           v85 = 0;
@@ -2033,7 +1955,7 @@
       do
       {
        // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
         {
           v46 = dword_F8B168[v114];
           v47 = 152 - v46->uTextureHeight;
@@ -2064,7 +1986,7 @@
       do
       {
       //  if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
         {
           v50 = dword_F8B168[v114 + 6];
           v51 = 308 - v50->uTextureHeight;
@@ -2097,7 +2019,7 @@
       do
       {
         //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)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
         {
           v54 = dword_F8B168[v114];
           v55 = 152 - v54->uTextureHeight;
@@ -2128,7 +2050,7 @@
       do
       {
        // 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
+	     if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
         {
           v58 = dword_F8B168[v114 + 6];
           v59 = 308 - v58->uTextureHeight;
@@ -2166,7 +2088,7 @@
         do
         {
          // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-		if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
+		if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
             ++v109;
           ++v62;
         }
@@ -2177,7 +2099,7 @@
         do
         {
           //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)
+		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
             ++v109;
           ++v62;
         }
@@ -2211,9 +2133,9 @@
         v109 = v67;
         v68 = (int)window_SpeakInHouse->ptr_1C;
       //  v69 = 9 * (v67 + 12 * v68);
-        v70 = (ItemGen *)&pParty->field_777C[v68][v67];
+        v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
         if ( dword_F8B19C != 2 )
-          v70 = &pParty->Recipes_Item[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
+          v70 = &pParty->SpecialItemsInShop[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
         if ( !v63 || !Str )
         {
           v93 = 0;
@@ -2418,7 +2340,7 @@
       do
       {
        // 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)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID)
           ++v149;
         ++v93;
       }
@@ -2435,7 +2357,7 @@
           v97 = uActiveCharacter - 1;
        //   v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724];
           v99 = _this->_490EEE(
-                 &pParty->Recipes_Item[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
+                 &pParty->SpecialItemsInShop[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724],
                   2,
                   (int)window_SpeakInHouse->ptr_1C,
                   2);
@@ -2450,7 +2372,7 @@
         do
         {
           //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)
+		if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID)
           {
             v105 = dword_F8B168[v104];
             if ( v104 >= 4 )
@@ -2638,7 +2560,7 @@
       do
       {
       //  if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);
         {
           v56 = dword_F8B168[v55];
           if ( v55 >= 4 )
@@ -2673,7 +2595,7 @@
       do
       {
        // 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)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID)
         {
           v62 = dword_F8B168[v61];
           if ( v61 >= 4 )
@@ -2710,7 +2632,7 @@
       do
       {
        // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 )
-	  if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID);
+	  if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID);
           ++v149;
         ++v68;
       }
@@ -2721,7 +2643,7 @@
       do
       {
        // 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)
+	  if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID)
           ++v149;
         ++v68;
       }
@@ -2751,9 +2673,9 @@
       v75 = (int)window_SpeakInHouse->ptr_1C;
       v76 = 9 * (v74 - 1 + 12 * v75);
       if ( dword_F8B19C == 2 )
-        v77 = (ItemGen *)&pParty->field_777C[v76];
+        v77 = (ItemGen *)&pParty->StandartItemsInShops[v76];
       else
-        v77 = &pParty->Recipes_Item[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
+        v77 = &pParty->SpecialItemsInShop[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
       if ( v69 == (short)v11 || Str == v11 )
       {
         v124 = (__int64 *)v11;
@@ -4100,7 +4022,7 @@
       case 96:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
         UI_CreateEndConversationButton();
-        sub_4B3703((void *)dword_F8B198);
+        sub_4B3703(dword_F8B198);
         break;
       case 101:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
@@ -4208,8 +4130,8 @@
                          pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C + 1],
                          pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C]) < (signed __int64)pParty->uTimePlayed )
   {
-    GenerateShopItems();
-    sub_4B8F94();
+    GenerateStandartShopItems();
+    GenerateSpecialShopItems();
     v8 = window_SpeakInHouse;
     v40 = window_SpeakInHouse->ptr_1C;
     //v3 = dword_F8B198;
@@ -4226,11 +4148,11 @@
   v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
   if ( uMessageParam == 2 )
   {
-    if ( _4F063C_smthn_by_2da_uType[v44] )
+    if ( uItemsAmountPerShopType[v44] )
     {
       do
       {
-        v45 = pParty->field_777C[(int)v42][v43].uItemID;
+        v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
         if ( v45 )
         {
           v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4242,19 +4164,19 @@
         ++v43;
       }
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
     if ( dword_F8B198 == 1 )
     {
       v47 = v8->ptr_1C;
       v48 = 0;
       //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
+      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
       {
         do
         {
          // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
-		 if ( pParty->field_777C[(int)v47][v48].uItemID);
+		 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
           {
             v49 = rand();
             v8 = window_SpeakInHouse;
@@ -4264,18 +4186,18 @@
           ++v48;
         }
         //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+        while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
       }
     }
   }
   else
   {
-    if ( _4F063C_smthn_by_2da_uType[v44] )
+    if ( uItemsAmountPerShopType[v44] )
     {
       do
       {
         //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
-	  v50=pParty->Recipes_Item[(unsigned int)v42][(signed int)v43].uItemID;
+	  v50=pParty->SpecialItemsInShop[(unsigned int)v42][(signed int)v43].uItemID;
         if ( v50 )
         {
           v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
@@ -4287,19 +4209,19 @@
         ++v43;
       }
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
+      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
     if ( dword_F8B198 == 1 )
     {
       v52 = v8->ptr_1C;
       v53 = 0;
       //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
+      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
       {
         do
         {
          // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
-		if (pParty->Recipes_Item[(unsigned int)v52][v53].uItemID)
+		if (pParty->SpecialItemsInShop[(unsigned int)v52][v53].uItemID)
           {
             v54 = rand();
             v8 = window_SpeakInHouse;
@@ -4309,7 +4231,7 @@
           ++v53;
         }
         //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
+        while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
       }
     }
   }
@@ -4612,13 +4534,13 @@
    // v31 = 9 * (v29 - 1 + 12 * (int)v30);
     if ( dword_F8B19C == 2 )
     {
-      v32 = (ItemGen *)&pParty->field_777C[(int)v30][v29];
-      _this = (ItemGen *)&pParty->field_777C[(int)v30][v29];
+      v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
+      _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
     }
     else
     {
-      _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];
+      _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];
     }
     //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
     v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
@@ -8071,202 +7993,6 @@
   return a1a.Create(0, 0, 0, 0);
 }
 
-//----- (00450218) --------------------------------------------------------
-void __cdecl sub_450218_prolly_generate_chests_loot()
-{
-  unsigned int v0; // eax@1
-  Chest *v1; // ebx@1
-  MapInfo *v2; // esi@1
-  ItemGen *v3; // ebx@2
-  int v4; // ebp@4
-  int v5; // edi@4
-  int v6; // esi@4
-  int v7; // eax@4
-  signed int v8; // esi@4
-  int v9; // edx@4
-  int v10; // esi@8
-  int v11; // ebp@25
-  int v12; // esi@25
-  signed int v13; // ebp@27
-  ItemGen *v14; // edi@28
-  signed int v15; // edx@32
-  signed __int64 v16; // qtt@32
-  int v17; // esi@34
-  signed int v18; // [sp+10h] [bp-18h]@1
-  int v19; // [sp+14h] [bp-14h]@4
-  MapInfo *v20; // [sp+18h] [bp-10h]@1
-  Chest *v21; // [sp+1Ch] [bp-Ch]@1
-  int v22; // [sp+20h] [bp-8h]@26
-  signed int v23; // [sp+24h] [bp-4h]@2
-
-  v18 = rand() % 100;
-  v0 = pMapStats->GetMapInfo(pCurrentMapName);
-  v1 = pChests;
-  v2 = &pMapStats->pInfos[v0];
-  v21 = pChests;
-  v20 = &pMapStats->pInfos[v0];
-  do
-  {
-    v3 = v1->mm7__vector_pItems;
-    v23 = 140;
-    do
-    {
-      if ( (v3->uItemID & 0x80000000u) == 0 )
-        goto LABEL_56;
-      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];
-      v7 = rand();
-      v8 = v6 - v5 + 1;
-      v9 = v5 + v7 % v8;
-      v19 = v5 + v7 % v8;
-      if ( v9 < 7 )
-      {
-        if ( v18 < 20 )
-        {
-          v3->Reset();
-          goto LABEL_25;
-        }
-        if ( v18 < 60 )
-        {
-          v10 = 0;
-          v3->Reset();
-          if ( v19 == 1 )
-          {
-            v10 = rand() % 51 + 50;
-          }
-          else
-          {
-            if ( v19 != 2 )
-            {
-              if ( v19 == 3 )
-              {
-                v10 = rand() % 301 + 200;
-              }
-              else
-              {
-                if ( v19 != 4 )
-                {
-                  if ( v19 == 5 )
-                  {
-                    v10 = rand() % 1001 + 1000;
-LABEL_15:
-                    v3->uItemID = 199;
-                  }
-                  else
-                  {
-                    if ( v19 == 6 )
-                    {
-                      v10 = rand() % 3001 + 2000;
-                      goto LABEL_15;
-                    }
-                  }
-LABEL_23:
-                  v3->SetIdentified();
-                  v3->uSpecEnchantmentType = v10;
-LABEL_25:
-                  v11 = v4 - 1;
-                  v12 = 0;
-                  if ( v11 > 0 )
-                  {
-                    v22 = v11;
-                    while ( 1 )
-                    {
-                      v13 = v12;
-                      if ( v12 >= 140 )
-                        goto LABEL_52;
-                      v14 = &v21->mm7__vector_pItems[v12];
-                      while ( v14->uItemID )
-                      {
-                        ++v13;
-                        ++v14;
-                        if ( v13 >= 140 )
-                          goto LABEL_52;
-                      }
-                      v16 = rand();
-                      v15 = v16 % 100;
-                      v18 = v16 % 100;
-                      if ( v15 < 20 )
-                        goto LABEL_52;
-                      if ( v15 >= 60 )
-                      {
-                        pItemsTable->GenerateItem(v19, 0, v14);
-                        goto LABEL_51;
-                      }
-                      v17 = 0;
-                      v14->Reset();
-                      if ( v19 == 1 )
-                      {
-                        v17 = rand() % 51 + 50;
-                        goto LABEL_48;
-                      }
-                      if ( v19 == 2 )
-                      {
-                        v17 = rand() % 101 + 100;
-LABEL_48:
-                        v14->uItemID = 197;
-                        goto LABEL_49;
-                      }
-                      if ( v19 == 3 )
-                      {
-                        v17 = rand() % 301 + 200;
-                        goto LABEL_44;
-                      }
-                      if ( v19 == 4 )
-                      {
-                        v17 = rand() % 501 + 500;
-LABEL_44:
-                        v14->uItemID = 198;
-                        goto LABEL_49;
-                      }
-                      if ( v19 == 5 )
-                        break;
-                      if ( v19 == 6 )
-                      {
-                        v17 = rand() % 3001 + 2000;
-LABEL_41:
-                        v14->uItemID = 199;
-                      }
-LABEL_49:
-                      v14->uSpecEnchantmentType = v17;
-LABEL_51:
-                      v12 = v13 + 1;
-LABEL_52:
-                      --v22;
-                      if ( !v22 )
-                        goto LABEL_55;
-                    }
-                    v17 = rand() % 1001 + 1000;
-                    goto LABEL_41;
-                  }
-                  goto LABEL_55;
-                }
-                v10 = rand() % 501 + 500;
-              }
-              v3->uItemID = 198;
-              goto LABEL_23;
-            }
-            v10 = rand() % 101 + 100;
-          }
-          v3->uItemID = 197;
-          goto LABEL_23;
-        }
-        pItemsTable->GenerateItem(v9, 0, v3);
-        goto LABEL_25;
-      }
-      v3->GenerateArtifact();
-LABEL_55:
-      v2 = v20;
-LABEL_56:
-      ++v3;
-      --v23;
-    }
-    while ( v23 );
-    v1 = v21 + 1;
-    ++v21;
-  }
-  while ( (signed int)v21 < (signed int)&uNumChests );
-}
 
 //----- (00450521) --------------------------------------------------------
 signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)