changeset 315:2a09e1d6fc8f

Some 0041D895 GameUI_DrawItemInfo overhaul
author Nomad
date Wed, 20 Feb 2013 01:17:13 +0200
parents e33f5a1cdc46
children 922a96fdcc86
files Indoor.cpp Items.cpp Items.h Mouse.cpp Player.cpp Render.cpp Render.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.h
diffstat 14 files changed, 178 insertions(+), 198 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/Indoor.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -1305,7 +1305,7 @@
 
   auto pFace = &pIndoor->pFaces[uFaceID];
 
-  if (pFace->uAttributes & 1)
+  if (pFace->TwoSided())
   {
     auto p = &field_FA8[a2];
     //v6 = (int)((char *)this + 2252 * a2);
@@ -1502,7 +1502,7 @@
   v3 = this;
   v4 = &pIndoor->pFaces[uFaceID];
   v21 = v4;
-  if ( v4->uAttributes & 1 )
+  if (v4->TwoSided())
   {
     v5 = (char *)this + 2252 * a2;
     v20 = v5;
--- a/Items.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/Items.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -19,7 +19,7 @@
 
 ItemGen *ptr_50C9A4;
 
-struct ItemsTable *pItemsTable;
+struct ItemsTable *pItemsTable; // 005D29E0
 
 
 
--- a/Items.h	Tue Feb 19 22:06:49 2013 +0200
+++ b/Items.h	Wed Feb 20 01:17:13 2013 +0200
@@ -81,7 +81,7 @@
   EQUIP_F = 0xF,
   EQUIP_BOOK = 0x10,
   EQUIP_11 = 0x11,
-  EQUIP_GOLD = 0x12,
+  EQUIP_GOLD = 18,
   EQUIP_GEM = 0x13,
 };
 
@@ -97,7 +97,10 @@
     Reset();
   }
 
-  inline bool Broken() {return uAttributes & ITEM_BROKEN;}
+  inline bool Broken()        {return uAttributes & ITEM_BROKEN;}
+  inline bool Identified()    {return uAttributes & ITEM_IDENTIFIED;}
+  inline void SetIdentified() {uAttributes |= ITEM_IDENTIFIED;}
+  inline bool Stolen()        {return uAttributes & ITEM_STOLEN;}
 
   bool GenerateArtifact();
   unsigned int GetValue();
@@ -152,7 +155,7 @@
 	char field_26;  //26   2A
 	char field_27; // 27   2b
 	union
-		{
+    {
 		unsigned __int8 uChanceByTreasureLvl[6];
 		struct {
 			unsigned __int8 uChanceByTreasureLvl1; // 28  2c
@@ -162,10 +165,10 @@
 			unsigned __int8 uChanceByTreasureLvl5;  // 2C  30
 			unsigned __int8 uChanceByTreasureLvl6;  // 2D  32
 			};
-		};
-	unsigned char uItemID_Rep_St; //2e 32
-	char field_2f;
-	};
+    };
+    unsigned char uItemID_Rep_St; //2e 32
+    char field_2f;
+};
 #pragma pack(pop)
 
 
@@ -251,6 +254,9 @@
   unsigned int pSpecialEnchantmentsSumm[24]; //11738h
   unsigned int pSpecialEnchantments_count; //11798h
   char field_1179C;
+  char field_1179D;
+  char field_1179E;
+  char field_1179F;
 };
 #pragma pack(pop)
 
--- a/Mouse.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/Mouse.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -518,17 +518,12 @@
         while ( v8 < v1->field_4C );
         v6 = v15;
       }
-      if ( pParty->pPickedItem.uAttributes & 2 )
-      {
-        pRenderer->_4A6776(a2, v6, v3);
-      }
+      if (pParty->pPickedItem.Broken())
+        pRenderer->DrawTransparentRedShade(a2, v6, v3);
+      else if (!pParty->pPickedItem.Identified())
+        pRenderer->DrawTransparentGreenShade(a2, v6, v3);
       else
-      {
-        if ( pParty->pPickedItem.uAttributes & 1 )
-          pRenderer->DrawTextureTransparent(a2, v6, v3);
-        else
-          pRenderer->DrawTransparentGreenShade(a2, v6, v3);
-      }
+        pRenderer->DrawTextureTransparent(a2, v6, v3);
     }
   }
   else
--- a/Player.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/Player.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -1859,7 +1859,7 @@
       return result;
   }
 LABEL_16:
-  if ( BYTE1(pItem->uAttributes) & 1 )
+  if (pItem->Stolen())
     return 6;
 LABEL_26:
   //v14 = &p2DEvents_minus1__20[13 * a4];
@@ -1872,7 +1872,7 @@
     v23 = *v14;
     v24 = pItem->GetValue();
     v17 = v27->_4B8102(v24, v23);
-    if ( !(pItem->uAttributes & 2) )
+    if (!pItem->Broken())
       goto LABEL_39;
     goto LABEL_38;
   }
@@ -1895,7 +1895,7 @@
   v18 = *v14;
   v19 = pItem->GetValue();
   v17 = v27->_4B8102(v19, v18) / 2;
-  if ( pItem->uAttributes & 2 )
+  if (pItem->Broken())
     v17 = 1;
   if ( v17 >= 1 )
     goto LABEL_39;
@@ -2339,7 +2339,7 @@
   v20 = thos;
   v2 = pItem->uItemID;
   if ( !pItemsTable->pItems[v2].uItemID_Rep_St )
-    pItem->uAttributes |= 1u;
+    pItem->SetIdentified();
   ///v15 = 0;
   //v16 = 1;
   //v18 = 3;
@@ -3796,7 +3796,7 @@
       v13 = this->pInventoryItems;
       do
       {
-        if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !(v13->uAttributes & 2) )
+        if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken())
           v46[v4++] = v12;
         ++v12;
         ++v13;
--- a/Render.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/Render.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -10135,7 +10135,7 @@
 
 
 //----- (004A6776) --------------------------------------------------------
-void Render::_4A6776(unsigned int a2, unsigned int a3, Texture *a4)
+void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4)
 {
   Texture *v4; // edi@2
   unsigned int v5; // ebx@4
--- a/Render.h	Tue Feb 19 22:06:49 2013 +0200
+++ b/Render.h	Wed Feb 20 01:17:13 2013 +0200
@@ -348,7 +348,7 @@
   void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture);
   void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8);
   void _4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8);
-  void _4A6776(unsigned int a2, unsigned int a3, Texture *a4);
+  void DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4);
   void DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture);
   void _4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height);
   void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
--- a/mm7_1.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_1.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -881,11 +881,10 @@
         v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)];
         if ( !(v16 & 0xF0) )
         {
-          if ( v16 & 1
-            || pCurrentScreen != SCREEN_HOUSE )
+          if (pItem->Identified() || pCurrentScreen != SCREEN_HOUSE )
           {
-            if ( v16 & 2 )
-              pRenderer->_4A6776(uCellX, uCellY, v7);
+            if (pItem->Broken())
+              pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
             else
               pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
           }
@@ -2305,31 +2304,31 @@
 
 
 //----- (0041D895) --------------------------------------------------------
-void __thiscall GameUI_DrawItemInfo(ItemGen *ecx0)
+void GameUI_DrawItemInfo(ItemGen *ecx0)
 {
   ItemGen *v1; // esi@1
   unsigned int v2; // eax@3
-  char *v3; // edi@5
-  unsigned int v4; // eax@5
-  unsigned int v5; // esi@5
+  //char *v3; // edi@5
+  //unsigned int v4; // eax@5
+  //unsigned int v5; // esi@5
   signed int v6; // eax@5
   int v7; // edx@5
   ItemGen *v8; // ecx@10
-  unsigned int v9; // eax@12
+  //unsigned int v9; // eax@12
   char v10; // zf@16
   ItemGen *v11; // eax@16
   ItemGen *v12; // eax@25
-  unsigned int v13; // ecx@32
-  unsigned int v14; // eax@32
-  Render *v15; // edi@33
+  //unsigned int v13; // ecx@32
+  //unsigned int v14; // eax@32
+  //Render *v15; // edi@33
   const char *v16; // eax@34
   int v17; // eax@36
   int v18; // esi@37
   unsigned __int16 v19; // ax@37
-  char v20; // al@40
+  //char v20; // al@40
   char v21; // al@44
-  char v22; // al@48
-  char v23; // al@51
+  //char v22; // al@48
+  //char v23; // al@51
   int v24; // eax@52
   int v25; // eax@57
   int v26; // eax@60
@@ -2349,28 +2348,28 @@
   GUIFont *v40; // edx@113
   signed int v41; // [sp-20h] [bp-298h]@113
   int v42; // [sp-1Ch] [bp-294h]@113
-  char *v43; // [sp-18h] [bp-290h]@46
+  //char *v43; // [sp-18h] [bp-290h]@46
   unsigned int v44; // [sp-18h] [bp-290h]@113
-  int v45; // [sp-14h] [bp-28Ch]@46
+  //int v45; // [sp-14h] [bp-28Ch]@46
   const char *v46; // [sp-14h] [bp-28Ch]@58
   char *v47; // [sp-14h] [bp-28Ch]@110
-  char *v48; // [sp-10h] [bp-288h]@46
+  //char *v48; // [sp-10h] [bp-288h]@46
   const char *v49; // [sp-10h] [bp-288h]@56
   char *v50; // [sp-10h] [bp-288h]@58
   int v51; // [sp-10h] [bp-288h]@110
   const char *v52; // [sp-Ch] [bp-284h]@36
-  int v53; // [sp-Ch] [bp-284h]@46
+  //int v53; // [sp-Ch] [bp-284h]@46
   char *v54; // [sp-Ch] [bp-284h]@56
   int v55; // [sp-Ch] [bp-284h]@58
   int v56; // [sp-Ch] [bp-284h]@110
   unsigned int v57; // [sp-8h] [bp-280h]@36
-  int v58; // [sp-8h] [bp-280h]@46
+  //int v58; // [sp-8h] [bp-280h]@46
   int v59; // [sp-8h] [bp-280h]@56
   int v60; // [sp-8h] [bp-280h]@58
   unsigned int v61; // [sp-8h] [bp-280h]@110
-  char a1[100]; // [sp+8h] [bp-270h]@40
-  char Dest[100]; // [sp+6Ch] [bp-20Ch]@40
-  char v64[100]; // [sp+D0h] [bp-1A8h]@40
+  char a1[300]; // [sp+8h] [bp-270h]@40
+  //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40
+  //char v64[100]; // [sp+D0h] [bp-1A8h]@40
   char v65[120]; // [sp+134h] [bp-144h]@92
   char Source[40]; // [sp+1ACh] [bp-CCh]@49
   int v67; // [sp+1D4h] [bp-A4h]@91
@@ -2381,8 +2380,8 @@
   int v72; // [sp+1ECh] [bp-8Ch]@91
   int var88; // [sp+1F0h] [bp-88h]@1
   Texture *v73; // [sp+1F4h] [bp-84h]@5
-  unsigned int v75; // [sp+1F8h] [bp-80h]@5
-  char *v76; // [sp+1FCh] [bp-7Ch]@5
+  //unsigned int v75; // [sp+1F8h] [bp-80h]@5
+  //char *v76; // [sp+1FCh] [bp-7Ch]@5
   int v77; // [sp+200h] [bp-78h]@12
   int v78; // [sp+204h] [bp-74h]@5
   GUIWindow v79; // [sp+208h] [bp-70h]@2
@@ -2409,14 +2408,16 @@
     else
       v2 = pMouse->GetCursorPos(&a2)->x - v79.uFrameWidth - 30;
     v79.uFrameX = v2;
-    v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName;
-    v76 = v3;
-    v4 = pIcons_LOD->LoadTexture(*(const char **)v3, TEXTURE_16BIT_PALETTE);
-    v5 = v4;
-    v4 *= 72;
-    v75 = v4;
-    v73 = (struct Texture *)((char *)pIcons_LOD->pTextures + v4);
-    v6 = 100 - *(unsigned __int16 *)((char *)&pIcons_LOD->pTextures[0].uTextureWidth + v4);
+    auto item_desc = &pItemsTable->pItems[_this->uItemID];
+    //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName;
+    //v76 = v3;
+    //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    //v5 = v4;
+    //v4 *= 72;
+    //v75 = v4;
+    //v73 = &pIcons_LOD->pTextures[v4];
+    v73 = pIcons_LOD->LoadTexturePtr(item_desc->pIconName, TEXTURE_16BIT_PALETTE);
+    v6 = 100 - v73->uTextureWidth;
     v7 = v73->uTextureHeight;
     v78 = v6;
     v81 = 144 - v7;
@@ -2427,22 +2428,22 @@
     else
       v81 >>= 1;
     v8 = _this;
-    if ( !v3[46] )
-      _this->uAttributes |= 1u;
-    v9 = v8->uAttributes;
+    if ( !item_desc->uItemID_Rep_St )
+      _this->SetIdentified();
+    //v9 = v8->uAttributes;
     v77 = 0;
-    a2.y = v9 & 2;
-    if ( pItemsTable->pItems[v8->uItemID].uEquipType == 18 )
+    //a2.y = v8->uAttributes & 2;
+    if (pItemsTable->pItems[v8->uItemID].uEquipType == EQUIP_GOLD)
       v77 = v8->uAdditionalValue;
     if ( uActiveCharacter )
     {
-      if ( !(v9 & 1) )
+      if (!v8->Identified())
       {
         v10 = pPlayers[uActiveCharacter]->CanIdentify(_this) == 1;
         v11 = _this;
         if ( v10 )
-          _this->uAttributes |= 1u;
-        v10 = (v11->uAttributes & 1) == 0;
+          _this->SetIdentified();
+        v10 = !v11->Identified();
         v83 = (char *)9;
         if ( v10 )
         {
@@ -2461,13 +2462,13 @@
         }
       }
       _this->UpdateTempBonus(pParty->uTimePlayed);
-      if ( a2.y )
+      if (v8->Broken())
       {
         v10 = pPlayers[uActiveCharacter]->CanRepair(_this) == 1;
         v12 = _this;
         if ( v10 )
           _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1;
-        v10 = (v12->uAttributes & 2) == 0;
+        v10 = !v12->Broken();
         v83 = (char *)SPEECH_11;
         if ( v10 )
           v83 = (char *)SPEECH_10;
@@ -2480,54 +2481,42 @@
         }
       }
     }
-    v13 = _this->uAttributes;
-    v14 = _this->uAttributes & 1;
-    a2.y = _this->uAttributes & 1;
-    if ( v13 & 2 )
+    //v13 = _this->uAttributes;
+    //v14 = _this->Identified();
+    a2.y = _this->Identified();
+    if (_this->Broken())
     {
       v79.DrawMessageBox(0);
       //v15 = &;
-      pRenderer->Clip(
-        v79.uFrameX + 12,
-        v79.uFrameY + 12,
-        v79.uFrameX + v79.uFrameWidth - 12,
-        v79.uFrameY + v79.uFrameHeight - 12);
+      pRenderer->Clip(v79.uFrameX + 12,                   v79.uFrameY + 12,
+                      v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12);
       v79.uFrameWidth -= 24;
       v79.uFrameHeight -= 12;
       v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1;
       v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1;
-      pRenderer->_4A6776(
-        v79.uFrameX + v78,
-        v81 + v79.uFrameY + 30,
-        (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0));
+      pRenderer->DrawTransparentRedShade(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73);
       if ( a2.y )
         v16 = _this->GetIdentifiedName();
       else
-        v16 = (const char *)*((int *)v76 + 2);
+        v16 = item_desc->pUnidentifiedName;
       v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u);
       v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &v79, 0, 0);
       v57 = 3;
       v52 = pGlobalTXT_LocalizationStrings[32];
       goto LABEL_37;
     }
-    if ( !v14 )
+    if (!_this->Identified())
     {
       v79.DrawMessageBox(0);
-      v15 = pRenderer;
-      pRenderer->Clip(
-        v79.uFrameX + 12,
-        v79.uFrameY + 12,
-        v79.uFrameX + v79.uFrameWidth - 12,
-        v79.uFrameY + v79.uFrameHeight - 12);
+      //v15 = pRenderer;
+      pRenderer->Clip(v79.uFrameX + 12,                   v79.uFrameY + 12,
+                      v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12);
       v79.uFrameWidth -= 24;
       v79.uFrameHeight -= 12;
       v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1;
       v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1;
-      pRenderer->DrawTextureTransparent(
-        v79.uFrameX + v78,
-        v81 + v79.uFrameY + 30,
-        (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0));
-      v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, *((const char **)v76 + 2), 3u);
+      pRenderer->DrawTextureTransparent(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73);
+      v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u);
       v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &v79, 0, 0);
       v57 = 3;
       v52 = pGlobalTXT_LocalizationStrings[232];
@@ -2537,55 +2526,52 @@
       v79.DrawTitleText(pFontArrus, 0x64u, ((signed int)v79.uFrameHeight >> 1) - v18, v19, v52, v57);
       goto LABEL_116;
     }
-    sprintf(a1, pGlobalTXT_LocalizationStrings[463], *((int *)v3 + 2));
-    strcpy(Dest, "");
-    strcpy(v64, "");
-    v20 = v3[28];
-    if ( (unsigned __int8)v20 <= 1u )
-    {
-      v58 = (unsigned __int8)v3[31];
-      v53 = (unsigned __int8)v3[30];
-      v48 = pGlobalTXT_LocalizationStrings[53];
-      v45 = (unsigned __int8)v3[32];
-      v43 = pGlobalTXT_LocalizationStrings[18];
-    }
-    else
-    {
-      if ( v20 != 2 )
-      {
-        if ( (unsigned __int8)v20 > 2u )
+
+    sprintfex(a1, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName);
+    a1[100] = 0;
+    a1[200] = 0;
+    //v20 = item_desc->uEquipType;
+    switch (item_desc->uEquipType)
+    {
+      case EQUIP_ONE_OR_TWO_HANDS:
+      case EQUIP_TWO_HANDED:
+        sprintfex(a1 + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[18], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll);
+        if (item_desc->uDamageMod)
         {
-          if ( (unsigned __int8)v20 <= 0xBu )
-          {
-            v21 = v3[30];
-            if ( v21 )
-              sprintf(
-                Dest,
-                "%s: +%d",
-                pGlobalTXT_LocalizationStrings[11],
-                (unsigned __int8)v21 + (unsigned __int8)v3[32]);
-          }
+          char mod[16];
+          sprintf(mod, "+%d", (int)item_desc->uDamageMod);
+          strcat(a1 + 100, mod);
+        }
+      break;
+
+      case EQUIP_BOW:
+        sprintfex(a1 + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[203], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll);
+        if (item_desc->uDamageMod)
+        {
+          char mod[16];
+          sprintf(mod, "+%d", (int)item_desc->uDamageMod);
+          strcat(a1 + 100, mod);
         }
-        goto LABEL_50;
-      }
-      v58 = (unsigned __int8)v3[31];
-      v53 = (unsigned __int8)v3[30];
-      v48 = pGlobalTXT_LocalizationStrings[53];
-      v45 = (unsigned __int8)v3[32];
-      v43 = pGlobalTXT_LocalizationStrings[203];
-    }
-    sprintf(Dest, "%s: +%d   %s: %dd%d", v43, v45, v48, v53, v58);
-    v22 = v3[32];
-    if ( v22 )
-    {
-      sprintf(Source, " +%d", (unsigned __int8)v22);
-      strcat(Dest, Source);
-    }
-LABEL_50:
+      break;
+
+      case EQUIP_ARMOUR:
+      case EQUIP_SHIELD:
+      case EQUIP_HELMET:
+      case EQUIP_BELT:
+      case EQUIP_CLOAK:
+      case EQUIP_GAUNTLETS:
+      case EQUIP_BOOTS:
+      case EQUIP_RING:
+      case EQUIP_AMULET:
+        if (item_desc->uDamageDice)
+          sprintfex(a1 + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
+      break;
+    }
+
     if ( v77 )
       goto LABEL_65;
-    v23 = v3[28];
-    if ( v23 == 14 )
+    //v23 = item_desc->uEquipType;
+    if (item_desc->uEquipType == 14)
     {
       v24 = _this->_bonus_type;
       if ( v24 )
@@ -2608,7 +2594,7 @@
         --a2.y;
       }
       while ( a2.y );
-      v28 = (const char *)*((int *)v3 + 3);
+      v28 = item_desc->pDescription;
       if ( *v28 )
       {
         v29 = pFontSmallnum->CalcTextHeight(v28, &v79, 100, 0);
@@ -2634,12 +2620,9 @@
       v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1;
       v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1;
       v79.DrawMessageBox(0);
-      v15 = pRenderer;
-      pRenderer->Clip(
-        v79.uFrameX + 12,
-        v79.uFrameY + 12,
-        v79.uFrameX + v79.uFrameWidth - 12,
-        v79.uFrameY + v79.uFrameHeight - 12);
+      //v15 = pRenderer;
+      pRenderer->Clip(v79.uFrameX + 12,                   v79.uFrameY + 12,
+                      v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12);
       v79.uFrameWidth -= 12;
       v32 = v73->uTextureHeight;
       v33 = v79.uFrameHeight;
@@ -2649,7 +2632,7 @@
       pRenderer->DrawTextureTransparent(
         v79.uFrameX + v78,
         v79.uFrameY + (signed int)(v33 - v32) / 2,
-        (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0));
+        v73);
       a2.y = 3;
       v34 = (int)(v83 + 35);
       Str = a1;
@@ -2664,7 +2647,7 @@
         --a2.y;
       }
       while ( a2.y );
-      v35 = (const char *)*((int *)v76 + 3);
+      v35 = item_desc->pDescription;
       if ( *v35 )
         v79.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0);
       v79.uFrameX += 12;
@@ -2745,7 +2728,7 @@
       }
       return;
     }
-    if ( v23 == 13 )
+    if (item_desc->uEquipType == 13)
     {
       v24 = pItemsTable->pItems[_this->uItemID].uDamageDice;
 LABEL_56:
@@ -2753,7 +2736,7 @@
       v54 = pGlobalTXT_LocalizationStrings[449];
       v49 = "%s: %d";
 LABEL_64:
-      sprintf(v64, v49, v54, v59);
+      sprintf(a1 + 200, v49, v54, v59);
       goto LABEL_65;
     }
     v25 = _this->_bonus_type;
@@ -2783,7 +2766,7 @@
       v50 = pGlobalTXT_LocalizationStrings[210];
       v46 = "%s: %s";
     }
-    sprintf(v64, v46, v50, v55, v60);
+    sprintf(a1 + 200, v46, v50, v55, v60);
     goto LABEL_65;
 }
 // 4E455C: using guessed type int dword_4E455C;
@@ -4279,7 +4262,7 @@
 		{
 			Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10);
 			if ( pChests[v3].uFlags & 4 )
-				v12->uAttributes |= 1u;
+				v12->SetIdentified();
 		}
       }
       ++v11;
@@ -6649,7 +6632,7 @@
   else
   {
     dword_50B700 = 0;
-    if ( !(v1->uAttributes & 1) )
+    if ( !v1->TwoSided() )
       return 0;
   }
   //v66 = v1->uNumVertices;
--- a/mm7_2.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_2.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -1446,7 +1446,7 @@
                   v85 = 0;
                   v83 = 4;
                   v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
-                  if ( !(v4->uAttributes & 1) )
+                  if (!v4->Identified())
                   {
                     v81 = ptr_507BC0->ptr_1C;
                     v79 = v4;
@@ -1845,7 +1845,7 @@
         v93 = 0;
         v91 = 4;
         v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
-        if ( !(v37->uAttributes & 1) )
+        if (!v37->Identified())
         {
           v89 = ptr_507BC0->ptr_1C;
           v87 = v37;
@@ -2894,7 +2894,7 @@
           if ( v2 )
           {
             v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
-            if ( v3->uAttributes & 1 )
+            if (v3->Identified())
             {
               v118 = ptr_507BC0->ptr_1C;
               v4 = uActiveCharacter - 1;
@@ -4595,7 +4595,7 @@
     if ( v25 )
     {
       v26 = 1;
-      v20->uAttributes |= 1u;
+      v20->SetIdentified();
       memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
       goto LABEL_42;
     }
@@ -4663,7 +4663,7 @@
     v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
     if ( v39 )
     {
-      v32->uAttributes |= 1u;
+      v32->SetIdentified();
       v7 = v73 == 1;
       v40 = (int)((char *)v0 + 36 * v39);
       memcpy((void *)(v40 + 496), v32, 0x24u);
@@ -8003,7 +8003,7 @@
                   }
                   v18 = v15;
                 }
-                a1a.stru_24.uAttributes |= 1u;
+                a1a.stru_24.SetIdentified();
                 a1a.uObjectDescID = v18;
                 a1a.stru_24.uAdditionalValue = v34;
                 goto LABEL_35;
@@ -8162,7 +8162,7 @@
                     }
                   }
 LABEL_23:
-                  v3->uAttributes |= 1u;
+                  v3->SetIdentified();
                   v3->uAdditionalValue = v10;
 LABEL_25:
                   v11 = v4 - 1;
--- a/mm7_3.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_3.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -138,7 +138,7 @@
     {
       v11 = v9->pFloors[v10];
       v12 = &pIndoor->pFaces[v11];
-      if ( v12->uAttributes & 1
+      if ( v12->TwoSided()
         || stru_721530.sMaxX > v12->pBounding.x2
         || stru_721530.sMinX < v12->pBounding.x1
         || stru_721530.sMaxY > v12->pBounding.y2
@@ -2257,7 +2257,7 @@
             goto LABEL_36;
           }
           v11 = v4->uLifetime;
-          if ( item->uAttributes & 2 )
+          if (item->uAttributes & 2)
             v11 = *((short *)v2 + 1);
           if ( v8 < v11 )
           {
@@ -4596,7 +4596,7 @@
         v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16,
         v7 = v5 + v6 + a4b,
         (v16 = v5 + v6 + a4b) == 0)
-    || v7 > 0 && !(v4->uAttributes & 1) )
+    || v7 > 0 && !v4->TwoSided())
     return 0;
   v8 = v4->pFacePlane_old.vNormal.z * a1->z;
   v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x);
@@ -4656,7 +4656,7 @@
         v14 = v10 + v12 + v11,
         v22 = v10 + v12 + v11,
         v13)
-    || v14 > 0 && !(a2->uAttributes & 1) )
+    || v14 > 0 && !a2->TwoSided())
     return 0;
   v15 = a4 * a2->pFacePlane_old.vNormal.y;
   v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z);
@@ -12384,7 +12384,7 @@
        + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
        + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
        + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z;
-    if ( v4->uAttributes & 1 && v4->uSectorID != v12->uSectorID )
+    if (v4->TwoSided() && v4->uSectorID != v12->uSectorID )
       v5 = -v5;
     v11 = v5 > 0;
     if ( v5 <= 0 )
@@ -13599,10 +13599,7 @@
 	  else
         v50 = 1;
     }
-    pRenderer->_4A6776(
-      v47,
-      v49,
-      (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0));
+    pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0));
   }
   result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   v95 = 0;
--- a/mm7_4.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_4.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -5178,7 +5178,7 @@
           v35 = *v26;
           v36 = a3->GetValue();
           v29 = pPlayer->_4B8102(v36, v35);
-          if ( a3->uAttributes & 2 )
+          if (a3->Broken())
             v29 = 1;
           goto _continue_sprintf;
         }
@@ -5197,7 +5197,7 @@
               v30 = *v26;
               v31 = a3->GetValue();
               v29 = pPlayer->_4B8102(v31, v30) / 2;
-              if ( a3->uAttributes & 2 )
+              if (a3->Broken())
                 v29 = 1;
               if (!v29)
                 v29 = 1;
@@ -6097,7 +6097,7 @@
       for (uint k = 0; k < 138; k++)
       {
         if (&player->pInventoryItems[k])
-          player->pInventoryItems[k].uAttributes |= 1;
+          player->pInventoryItems[k].SetIdentified();
       }
     }
   }
@@ -12815,8 +12815,7 @@
   v4 = a1->uItemID;
   v5 = pItemsTable->pItems[v4].uEquipType;
   if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771)
-    && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599)
-    || BYTE1(a1->uAttributes) & 1 )
+    && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen())
     return 0;
   v6 = v2 - 1;
   if ( !v6 )
--- a/mm7_5.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_5.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -7311,7 +7311,7 @@
       if ( v25 & 2 )
       {
         v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0);
-        pRenderer->_4A6776(v24, a3b, v27);
+        pRenderer->DrawTransparentRedShade(v24, a3b, v27);
       }
       else
       {
@@ -7371,7 +7371,7 @@
                 if ( v37 & 2 )
                 {
                   v42 = (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0);
-                  pRenderer->_4A6776(a2c, v36, v42);
+                  pRenderer->DrawTransparentRedShade(a2c, v36, v42);
                 }
                 else
                 {
@@ -7423,7 +7423,7 @@
                           if ( v49 & 2 )
                           {
                             v54 = (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0);
-                            pRenderer->_4A6776(a2d, v47, v54);
+                            pRenderer->DrawTransparentRedShade(a2d, v47, v54);
                           }
                           else
                           {
@@ -7490,7 +7490,7 @@
                             if ( v62 & 2 )
                             {
                               v67 = (Texture *)(v65 != 0 ? (int)v66 : 0);
-                              pRenderer->_4A6776(a2e, a3e, v67);
+                              pRenderer->DrawTransparentRedShade(a2e, a3e, v67);
                             }
                             else
                             {
@@ -7553,7 +7553,7 @@
                                   if ( v76 & 2 )
                                   {
                                     v81 = (Texture *)(v79 != 0 ? (int)v80 : 0);
-                                    pRenderer->_4A6776(a2f, a3f, v81);
+                                    pRenderer->DrawTransparentRedShade(a2f, a3f, v81);
                                   }
                                   else
                                   {
@@ -7830,7 +7830,7 @@
                                                   if ( v128 & 2 )
                                                   {
                                                     v133 = (Texture *)(v131 != 0 ? (int)v132 : 0);
-                                                    pRenderer->_4A6776(a2j, a3i, v133);
+                                                    pRenderer->DrawTransparentRedShade(a2j, a3i, v133);
                                                   }
                                                   else
                                                   {
@@ -7871,7 +7871,7 @@
                                                     if ( v139 & 2 )
                                                     {
                                                       v144 = (Texture *)(v142 != 0 ? (int)v143 : 0);
-                                                      pRenderer->_4A6776(a2k, a3j, v144);
+                                                      pRenderer->DrawTransparentRedShade(a2k, a3j, v144);
                                                     }
                                                     else
                                                     {
@@ -7930,7 +7930,7 @@
                                                           if ( v155 & 2 )
                                                           {
                                                             v159 = (Texture *)(v243 != -1 ? (int)&pIcons_LOD->pTextures[v243] : 0);
-                                                            pRenderer->_4A6776(v150, a3k, v159);
+                                                            pRenderer->DrawTransparentRedShade(v150, a3k, v159);
                                                           }
                                                           else
                                                           {
@@ -8134,7 +8134,7 @@
                                                 if ( *(int *)(v225 + 20) & 2 )
                                                 {
                                                   v121 = (Texture *)(v119 != 0 ? (int)v120 : 0);
-                                                  pRenderer->_4A6776(a2h, a3h, v121);
+                                                  pRenderer->DrawTransparentRedShade(a2h, a3h, v121);
                                                 }
                                                 else
                                                 {
@@ -8335,7 +8335,7 @@
                                         v188 = v101;
                                         v175 = a3g;
                                         v163 = a2g;
-                                        v100->_4A6776(v163, v175, v188);
+                                        v100->DrawTransparentRedShade(v163, v175, v188);
                                         if ( !bRingsShownInCharScreen )
                                           pRenderer->_4A612A(a2g, a3g, v101, v235);
                                         v68 = v217;
@@ -8387,7 +8387,7 @@
                                         v175 = v104;
                                         v163 = v103;
                                         v100 = pRenderer;
-                                        v100->_4A6776(v163, v175, v188);
+                                        v100->DrawTransparentRedShade(v163, v175, v188);
                                         if ( !bRingsShownInCharScreen )
                                           pRenderer->_4A612A(a2g, a3g, v101, v235);
                                         v68 = v217;
@@ -8919,7 +8919,7 @@
     if ( v15 & 2 )
     {
       v20 = (Texture *)(v18 != 0 ? (int)v19 : 0);
-      pRenderer->_4A6776(a2a, a3a, v20);
+      pRenderer->DrawTransparentRedShade(a2a, a3a, v20);
     }
     else
     {
@@ -9079,7 +9079,7 @@
     if ( v6 & 2 )
     {
       v10 = (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[v5] : 0);
-      pRenderer->_4A6776(a2, a3, v10);
+      pRenderer->DrawTransparentRedShade(a2, a3, v10);
     }
     else
     {
@@ -9123,7 +9123,7 @@
       v21 = 9 * v16;
       v22 = 493;
       v23 = (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0);
-      pRenderer->_4A6776(0x1EDu, 0x5Bu, v23);
+      pRenderer->DrawTransparentRedShade(0x1EDu, 0x5Bu, v23);
     }
     else
     {
@@ -9203,7 +9203,7 @@
     if ( v29 & 2 )
     {
       v34 = v33 != 0 ? (int)&pIcons_LOD->pTextures[v28] : 0;
-      pRenderer->_4A6776(0x24Au, 0x58u, (Texture *)v34);
+      pRenderer->DrawTransparentRedShade(0x24Au, 0x58u, (Texture *)v34);
     }
     else
     {
@@ -11857,7 +11857,7 @@
             ++sDepthb )
       {
         v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]];
-        if ( v62->uAttributes & 1
+        if ( v62->TwoSided()
           || v119 > v62->pBounding.x2
           || v123 < v62->pBounding.x1
           || v127 > v62->pBounding.y2
@@ -12023,7 +12023,7 @@
     while ( 1 )
     {
       v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]];
-      if ( v90->uAttributes & 1
+      if ( v90->TwoSided()
         || v120 > v90->pBounding.x2
         || v124 < v90->pBounding.x1
         || v128 > v90->pBounding.y2
@@ -15578,7 +15578,7 @@
             {
               if ( v26 < 800 )
               {
-                pItemGen.uAttributes |= 1u;
+                pItemGen.SetIdentified();
                 pItemGen.uItemID = v26;
                 if ( pItemsTable->pItems[v26].uEquipType == 12 )
                 {
--- a/mm7_6.cpp	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_6.cpp	Wed Feb 20 01:17:13 2013 +0200
@@ -4011,7 +4011,7 @@
         v730c->UpdateTempBonus(pParty->uTimePlayed);
         if ( v730c->uItemID < 64 || v730c->uItemID > 65 )
         {
-          if ( !(v730c->uAttributes & 2) )
+          if (!v730c->Broken())
           {
             if ( v730c->uAdditionalValue == v1 )
             {
@@ -5425,7 +5425,7 @@
               || v726->pInventoryItems[a2].uAdditionalValue != v1
               || v726->pInventoryItems[a2]._bonus_type != v1
               || v726->pInventoryItems[a2]._bonus_strength != v1
-              || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].uAttributes & 2) )
+              || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) )
               goto LABEL_616;
             v247 = (char *)&pItemsTable->pItems[v246].pIconName;
             LODWORD(v725) = (int)v247;
@@ -5533,7 +5533,7 @@
           || (v291 = pItemsTable->pItems[v290].uEquipType) == 0
           || v291 == 1
           || v291 == 2
-          || _this->uAttributes & 2 )
+          || _this->Broken())
           goto LABEL_616;
         if ( _this->GetValue() < 0x1C2 )
           uRequiredMana = 1;
--- a/mm7_data.h	Tue Feb 19 22:06:49 2013 +0200
+++ b/mm7_data.h	Wed Feb 20 01:17:13 2013 +0200
@@ -1893,7 +1893,7 @@
 void __cdecl GameUI_DrawStatusBar();
 bool __thiscall sub_41CD4F(unsigned int _this);
 char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2);
-void __thiscall GameUI_DrawItemInfo(struct ItemGen *_this); // idb
+void GameUI_DrawItemInfo(struct ItemGen *_this); // idb
 char *__fastcall MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0);
 void __cdecl nullsub_3(); // idb
 void __cdecl LoadActualSkyFrame();