diff UI/UIPopup.cpp @ 1709:8251e59fd7c1

ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
author Grumpy7
date Tue, 24 Sep 2013 07:29:55 +0200
parents 33c7cc2d48d5
children 0f6cd60ca987
line wrap: on
line diff
--- a/UI/UIPopup.cpp	Mon Sep 23 07:07:06 2013 +0200
+++ b/UI/UIPopup.cpp	Tue Sep 24 07:29:55 2013 +0200
@@ -135,8 +135,8 @@
   else
     v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30;
   iteminfo_window.uFrameX = v2;
-  v78 = 100 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureWidth;
-  v81 = 144 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight;
+  v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth;
+  v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight;
   if ( v78 > 0 )
     v78 = v78 / 2;
   if ( v81 <= 0 )
@@ -146,7 +146,7 @@
   if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St )
     inspect_item->SetIdentified();
   v77 = 0;
-  if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD)
+  if (inspect_item->GetItemEquipType() == EQUIP_GOLD)
     v77 = inspect_item->uSpecEnchantmentType;
   if ( uActiveCharacter )
   {
@@ -198,7 +198,7 @@
     iteminfo_window.uFrameHeight -= 12;
     iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
     iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
-    pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE));
+    pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
     if ( inspect_item->IsIdentified())
       pText = (char *)inspect_item->GetIdentifiedName();
     else
@@ -209,7 +209,7 @@
     pRenderer->ResetTextureClipRect();
     if ( !areWeLoadingTexture )
     {
-      pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release();
+      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
       pIcons_LOD->SyncLoadedFilesCount();
     }
     return;
@@ -223,14 +223,14 @@
     iteminfo_window.uFrameHeight -= 12;
     iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
     iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
-    pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE));
+    pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
     iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
     iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
                         TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
     pRenderer->ResetTextureClipRect();
     if ( !areWeLoadingTexture )
     {
-      pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release();
+      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
       pIcons_LOD->SyncLoadedFilesCount();
     }
     return;
@@ -238,29 +238,29 @@
   sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s"
   out_text[100] = 0;
   out_text[200] = 0;
-  switch (pItemsTable->pItems[inspect_item->uItemID].uEquipType)
+  switch (inspect_item->GetItemEquipType())
   {
     case EQUIP_OFF_HAND:
     case EQUIP_MAIN_HAND:
       sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
-          (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53],
-          (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll); //"Damage"
-      if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod)
+          (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53],
+          (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage"
+      if (inspect_item->GetDamageMod())
       {
         char mod[16];
-        sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod);
+        sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
         strcat(out_text + 100, mod);
       }
       break;
 
     case EQUIP_BOW:
       sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
-          (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage"
-          (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll);
-      if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod)
+          (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage"
+          (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll());
+      if (inspect_item->GetDamageMod())
       {
         char mod[16];
-        sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod);
+        sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
         strcat(out_text + 100, mod);
       }
       break;
@@ -274,21 +274,21 @@
     case EQUIP_BOOTS:
     case EQUIP_RING:
     case EQUIP_AMULET:
-      if (pItemsTable->pItems[inspect_item->uItemID].uDamageDice) //"Armor"	
+      if (inspect_item->GetDamageDice()) //"Armor"	
           sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11],
-                    pItemsTable->pItems[inspect_item->uItemID].uDamageDice + pItemsTable->pItems[inspect_item->uItemID].uDamageMod);
+                    inspect_item->GetDamageDice() + inspect_item->GetDamageMod());
       break;
   }
 
   if ( !v77 )
   {
-    if (pItemsTable->pItems[inspect_item->uItemID].uEquipType ==EQUIP_POTION)  //this is CORRECT! do not move to switch!
+    if (inspect_item->GetItemEquipType() ==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 (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_REAGENT)
-      sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
+    else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT)
+      sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"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->m_enchantmentStrength); //"Special"
     else  if ( inspect_item->uSpecEnchantmentType )
@@ -310,7 +310,7 @@
   v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription;
   if ( *v28 )
     Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0);
-  iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName,
+  iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(),
                                      TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54;
   if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight )
     iteminfo_window.uFrameHeight = (unsigned int)Str;
@@ -337,8 +337,8 @@
   iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
   iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
   pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78,
-      iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
-      pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE));
+      iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
+      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
 
   v34 = (int)(v85 + 35);
   Str = out_text;
@@ -403,7 +403,7 @@
         pRenderer->ResetTextureClipRect();
         if ( !areWeLoadingTexture )
         {
-          pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release();
+          pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
           pIcons_LOD->SyncLoadedFilesCount();
         }
         return;
@@ -417,7 +417,7 @@
   }
   if ( !areWeLoadingTexture )
   {
-    pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release();
+    pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
     pIcons_LOD->SyncLoadedFilesCount();
   }
   return;