diff UI/UICharacter.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 5cbd88f8a2eb
children bc0fa6153fe1
line wrap: on
line diff
--- a/UI/UICharacter.cpp	Mon Sep 23 07:07:06 2013 +0200
+++ b/UI/UICharacter.cpp	Tue Sep 24 07:29:55 2013 +0200
@@ -777,8 +777,8 @@
       pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor);
     //Рука не занята или ...
     if ( !player->pEquipment.uMainHand
-         || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uEquipType != EQUIP_MAIN_HAND)
-         && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uSkillType != PLAYER_SKILL_SPEAR
+         || ( pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != EQUIP_MAIN_HAND)
+         && (pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != PLAYER_SKILL_SPEAR
          || pPlayers[uPlayerID]->pEquipment.uShield) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
                                         pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
@@ -791,7 +791,7 @@
       if ( item->uItemID == 64 )  //blaster
         v166 = "item64v1";
       else
-        v166 = pItemsTable->pItems[item->uItemID].pIconName;
+        v166 = item->GetIconName();
       if ( !( item->uAttributes & 0xF0 ) )
       {
         if ( item->uAttributes & 2 )
@@ -839,13 +839,13 @@
       if ( !(item->uAttributes & 0xF0) )// если не применён закл
       {
         if ( item->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)));
+          pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)));
         else
         {
           if ( !(item->uAttributes & 1) )//не опознанный лук зелёный
-            pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)));
+            pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)));
           else // опознанный лук
-            pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)));
+            pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)));
         }
       }
       else
@@ -865,12 +865,12 @@
           item->uAttributes &= 0xFFFFFF0Fu;
           ptr_50C9A4_ItemToEnchant = 0;
         }
-        pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)),
+        pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)),
                   pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE),
                            GetTickCount() * 0.1, 0, 255);
       }
       if ( !bRingsShownInCharScreen )
-        pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)),
+        pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)),
                 pPlayers[uPlayerID]->pEquipment.uBow);
     }
     //-----------------------------(Cloak/Плащ)---------------------------------------------------------
@@ -1062,8 +1062,8 @@
     }
     //--------------------------------------------(Hand/Рука)------------------------------------------------------
     if ( !pPlayers[uPlayerID]->pEquipment.uMainHand
-        || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uEquipType != EQUIP_MAIN_HAND)
-        && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uSkillType != PLAYER_SKILL_SPEAR
+        || ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != EQUIP_MAIN_HAND)
+        && (pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != PLAYER_SKILL_SPEAR
         || pPlayers[uPlayerID]->pEquipment.uShield) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0],
                             pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
@@ -1130,8 +1130,8 @@
       //---------------------------------------------(Hand2/Рука2)--------------------------------------------------
       if ( pPlayers[uPlayerID]->pEquipment.uMainHand )
       {
-        if ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uEquipType == EQUIP_MAIN_HAND
-             || pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uSkillType == PLAYER_SKILL_SPEAR
+        if ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == EQUIP_MAIN_HAND
+             || pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == PLAYER_SKILL_SPEAR
              && !pPlayers[uPlayerID]->pEquipment.uShield )
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
                      pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1]));
@@ -1407,7 +1407,7 @@
       if ( item->uItemID == 64 )
         v181 = "item64v1";
       else
-        v181 = pItemsTable->pItems[item->uItemID].pIconName;
+        v181 = item->GetIconName();
       if ( !(item->uAttributes & 0xF0) )
       {
         if ( item->uAttributes & 2 )
@@ -1448,8 +1448,8 @@
     if ( pPlayers[uPlayerID]->pEquipment.uShield )
     {
       item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uShield - 1];
-      if ( pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_DAGGER
-        || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SWORD )
+      if ( item->GetPlayerSkillType() == PLAYER_SKILL_DAGGER
+        || item->GetPlayerSkillType() == PLAYER_SKILL_SWORD )
       {
         //v151 = item->uItemID - 400;
         item_X = 596;
@@ -1478,7 +1478,7 @@
         item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX;
         item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY;
       }
-      v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+      v153 = pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE);
       if ( !(item->uAttributes & 0xF0) )
       {
         if ( item->uAttributes & 2 )
@@ -1525,8 +1525,8 @@
   if ( pPlayers[uPlayerID]->pEquipment.uMainHand )
   {
     item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1];
-    if ( pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_MAIN_HAND
-        || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SPEAR
+    if ( item->GetItemEquipType() == EQUIP_MAIN_HAND
+        || item->GetItemEquipType() == PLAYER_SKILL_SPEAR
         && !pPlayers[uPlayerID]->pEquipment.uShield )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], 
                                         pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], 
@@ -1558,7 +1558,7 @@
       continue;
     uCellY = 32 * (i / 14) + 17;
     uCellX = 32 * (i % 14) + 14;
-    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    uint item_texture_id = pIcons_LOD->LoadTexture(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].GetIconName(), TEXTURE_16BIT_PALETTE);
     pTexture = pIcons_LOD->GetTexture(item_texture_id);
     if (pTexture->uTextureWidth < 14)
       pTexture->uTextureWidth = 14;
@@ -1608,7 +1608,7 @@
 
 static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id)
 {
-  auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  auto item_texture = pIcons_LOD->LoadTexturePtr(item->GetIconName(), TEXTURE_16BIT_PALETTE);
 
   if (item->uAttributes & 0xF0) // enchant animation
   {
@@ -2342,13 +2342,13 @@
   _this.Reset();
   v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand;
   v2 = pPlayers[uActiveCharacter]->pEquipment.uShield;
-  if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == EQUIP_MAIN_HAND )
+  if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_MAIN_HAND )
     v51 = v1;
   v3 = pParty->pPickedItem.uItemID;
   if ( pParty->pPickedItem.uItemID )
   {
-    pEquipType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
-    pSkillType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType;
+    pEquipType = pParty->pPickedItem.GetItemEquipType();
+    pSkillType = pParty->pPickedItem.GetItemEquipType();
     if ( pSkillType == 4 )
     {
       if ( v2 )
@@ -2366,7 +2366,7 @@
     {
       if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2)
         && v1
-        && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uSkillType == 4 )
+        && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetPlayerSkillType() == 4 )
       {
         LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
         if ( (signed int)SkillToMastery(v5) < 3 )
@@ -2672,7 +2672,7 @@
   {
     v36 = v34 - 1;
     v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v36];
-    pEquipType = pItemsTable->pItems[v38->uItemID].uEquipType;
+    pEquipType = v38->GetItemEquipType();
     if ( v38->uItemID == ITEM_WETSUIT )
     {
       if ( bUnderwater )