changeset 600:db4a23580e6c

Chest item view fixed, gold can be taken
author Gloval
date Thu, 07 Mar 2013 00:35:10 +0400
parents deb559e4fe47
children d59398528e4f
files Chest.cpp mm7_1.cpp mm7_5.cpp
diffstat 3 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Wed Mar 06 22:47:21 2013 +0400
+++ b/Chest.cpp	Thu Mar 07 00:35:10 2013 +0400
@@ -302,9 +302,9 @@
             v13 = v12 + 32;
             if ( itemPixelHeght < 14 )
                 itemPixelHeght = 14;
-            itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + ((v13 - itemPixelWidth) >> 1);
+            itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + ((signed int)(v13 - itemPixelWidth)/2);
             itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) +
-                ((((itemPixelHeght - 14) & 0xFFFFFFE0) - item_texture->uTextureHeight + 32) >> 1);
+                ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32- item_texture->uTextureHeight ) /2);
             pRenderer->DrawTextureTransparent(  itemPixelPosX,   itemPixelPosY,  item_texture);
             sub_40F92A(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
             }
--- a/mm7_1.cpp	Wed Mar 06 22:47:21 2013 +0400
+++ b/mm7_1.cpp	Thu Mar 07 00:35:10 2013 +0400
@@ -2510,19 +2510,22 @@
         if (item_desc->uDamageDice) //"Armor"	
           sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
       break;
-      case EQUIP_POTION:
-          if ( inspect_item->uEnchantmentType )
-              sprintf(out_text + 200,  "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
-          break;
-      case EQUIP_REAGENT:
-         sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
-         break;
+      
     }
 
     if ( !v77 )
 	{
-    //v23 = item_desc->uEquipType;
-		if ( inspect_item->uEnchantmentType )
+       if (item_desc->uEquipType ==EQUIP_POTION)  //this is CORRECT! do not move to switch!
+           {
+           if ( inspect_item->uEnchantmentType )
+              sprintf(out_text + 200,  "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
+          }
+       else if (item_desc->uEquipType == EQUIP_REAGENT)
+          {
+          sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
+          }
+
+		else if ( inspect_item->uEnchantmentType )
 		 {
 			sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
 				 pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
@@ -3984,9 +3987,9 @@
       else
         v3 = -1;
       v4 = pChests[chest_id].pInventoryIndices[v3] - 1;
-      if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == 18 )
+      if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == EQUIP_GOLD )
       {
-        party_finds_gold(pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uValue, 0); //recheck
+        party_finds_gold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); 
         viewparams->bRedrawGameUI = 1;
       }
       else
--- a/mm7_5.cpp	Wed Mar 06 22:47:21 2013 +0400
+++ b/mm7_5.cpp	Thu Mar 07 00:35:10 2013 +0400
@@ -15979,9 +15979,11 @@
 			if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF )
 			{
 
-              __debugbreak(); // invalid indexing will result in invalid object ptr
-				v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime
-								+ (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
+            //  __debugbreak(); // invalid indexing will result in invalid object ptr
+			//	v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime
+			//					+ (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
+                v10=pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[v9] & 0xFFFF)-1];
+                v8 =&pChests[pChestWindow->par1C].igChestItems[v10-1];
 				GameUI_DrawItemInfo(v8);
 			}
 		}