diff UICharacter.cpp @ 948:5a2dbb00c399

Code cleaning.
author Nomad
date Wed, 01 May 2013 17:31:10 +0200
parents 9be9afdbeac3
children c0d0656aa662
line wrap: on
line diff
--- a/UICharacter.cpp	Wed May 01 14:30:02 2013 +0200
+++ b/UICharacter.cpp	Wed May 01 17:31:10 2013 +0200
@@ -150,7 +150,7 @@
     v79 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
     pPlayer = &pParty->pPlayers[v1-1];
     v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE);
-    pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0));
+    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(v3));
     v4 = v79;
     if ( !pPlayer->uSkillPoints )
         v4 = 65535;
@@ -579,7 +579,7 @@
     //v1 = uPlayerID;
     v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
     award_texture_id = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
-    pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(award_texture_id != -1 ? &pIcons_LOD->pTextures[award_texture_id] : 0));
+    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(award_texture_id));
     sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], v2);
     sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
     strcat(pTmpBuf, Source);
@@ -771,11 +771,11 @@
         pPlayer = pPlayers[uPlayerID];
         v3 = a2;
         pPlayer2 = pPlayers[uPlayerID];
-        pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_507958 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507958] : 0));
+        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_507958));
         if ( v3 )
             {
             v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE);
-            pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0));
+            pRenderer->DrawTextureIndexed(8u, 0x131u, pIcons_LOD->GetTexture(v4));
             }
         uCellID = 0;
         v26 = (int)pPlayer->pInventoryIndices;
@@ -792,8 +792,8 @@
                     {
                     v6 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pItem->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
                     uTextureId = v6;
-                    v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
-                    v8 = (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24);
+                    v7 = pIcons_LOD->GetTexture(v6);
+                    v8 = v7->uTextureWidth;
                     v9 = v7->uTextureHeight;
                     v10 = v7->uTextureWidth;
                     v11 = v7->uTextureWidth;
@@ -837,7 +837,7 @@
                         if ( (unsigned __int8)(v16 & 0xF0) == 32 )
                             {
                             v20 = "sp28a";
-                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
+                            pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE);
                             dword_50C9A8 -= pEventTimer->uTimeElapsed;
                             if ( dword_50C9A8 <= 0 )
                                 {
@@ -857,7 +857,7 @@
                         if ( (unsigned __int8)(v16 & 0xF0) == 64 )
                             {
                             v20 = "sp30a";
-                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
+                            pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE);
                             dword_50C9A8 -= pEventTimer->uTimeElapsed;
                             if ( dword_50C9A8 <= 0 )
                                 {
@@ -877,7 +877,7 @@
                         if ( (unsigned __int8)(v16 & 0xF0) == 128 )
                             {
                             v20 = "sp91a";
-                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
+                            pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE);
                             dword_50C9A8 -= pEventTimer->uTimeElapsed;
                             if ( dword_50C9A8 <= 0 )
                                 {
@@ -896,7 +896,7 @@
                             }
                         }
                     v20 = "sptext01";
-                    pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
+                    pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE);
                     dword_50C9A8 -= pEventTimer->uTimeElapsed;
                     if ( dword_50C9A8 <= 0 )
                         {
@@ -1132,7 +1132,7 @@
         sub_419379();
         CharacterUI_StatsTab_Draw(uPlayerIdx);
         v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
-        pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
+        pTexture = pIcons_LOD->GetTexture(v7);
         pButton = pCharacterScreen_StatsBtn;
         pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
         break;
@@ -1145,7 +1145,7 @@
         sub_419379();
         CharacterUI_SkillsTab_Draw(uPlayerIdx);
         v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
-        pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
+        pTexture = pIcons_LOD->GetTexture(v6);
         pButton = pCharacterScreen_SkillsBtn;
         pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
         break;
@@ -1155,7 +1155,7 @@
         sub_419220();
         CharacterUI_AwardsTab_Draw(uPlayerIdx);
         v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
-        pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
+        pTexture = pIcons_LOD->GetTexture(v5);
         pButton = pCharacterScreen_AwardsBtn;
         pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
         break;
@@ -1164,7 +1164,7 @@
         sub_419379();
         CharacterUI_InventoryTab_Draw(uPlayerIdx, 0);
         v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
-        pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
+        pTexture = pIcons_LOD->GetTexture(v2);
         pButton = pCharacterScreen_InventoryBtn;
         pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
         break;
@@ -1347,17 +1347,14 @@
   pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Подложка
   if ( IsPlayerWearingWatersuit[uPlayerID] )//акваланг
   {
-    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,
-            (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0));
+    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
     if ( !bRingsShownInCharScreen )
-      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY,
-                 (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0),
-                 pPlayers[uPlayerID]->pEquipment.uArmor);
+      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), pPlayers[uPlayerID]->pEquipment.uArmor);
     v6 = pPlayers[uPlayerID]->pEquipment.uMainHand;
     if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1)
          && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
-         (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0));
+         pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
     pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand;
     if ( pMainHandNum4 )
     {
@@ -1372,15 +1369,15 @@
       if ( !( item_MainHand4->uAttributes & 0xF0 ) )
       {
         v18 = v14 + 1;
-        v19 = (char *)&pIcons_LOD->pTextures[v14];
+        v19 = (char *)pIcons_LOD->GetTexture(v14);
         if ( item_MainHand4->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
+          pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
         else
         {
           if ( item_MainHand4->uAttributes & 1 )
-            pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
+            pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)v19);
           else
-            pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
+            pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
         }
       }
       if ( item_MainHand4->uAttributes & 0xF0 )
@@ -1393,7 +1390,7 @@
           v167 = "sp30a";
         if ( (item_MainHand4->uAttributes & 0xF0) == 128 )
           v167 = "sp91a";
-        v16 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v167, TEXTURE_16BIT_PALETTE)];
+        v16 = pIcons_LOD->LoadTexturePtr(v167, TEXTURE_16BIT_PALETTE);
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
@@ -1402,10 +1399,10 @@
           ptr_50C9A4 = 0;
         }
         v17 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0), v16, (signed __int64)v17, 0, 255);
+        pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, pIcons_LOD->GetTexture(v14), v16, (signed __int64)v17, 0, 255);
       }
       if ( !bRingsShownInCharScreen )
-        pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0), pMainHandNum4);
+        pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)v19, pMainHandNum4);
     }
   }
   else// без акваланга
@@ -1420,14 +1417,14 @@
       if ( !(itemBow->uAttributes & 0xF0) )// если не применён закл
       {
         if ( itemBow->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0));
+          pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum));
         else
         {
-          v30 = (char *)&pIcons_LOD->pTextures[pBowTextureNum];
+          v30 = (char *)pIcons_LOD->GetTexture(pBowTextureNum);
           if ( !(itemBow->uAttributes & 1) )//не опознанный лук зелёный
-            pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0));
+            pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)v30);
           else // опознанный лук
-            pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0));
+            pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)v30);
         }
       }
       else
@@ -1440,7 +1437,7 @@
           v168 = "sp30a";
         if ( (itemBow->uAttributes & 0xF0) == 128 )
           v168 = "sp91a";
-        a2b = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v168, TEXTURE_16BIT_PALETTE)];
+        a2b = pIcons_LOD->LoadTexturePtr(v168, TEXTURE_16BIT_PALETTE);
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
@@ -1449,10 +1446,10 @@
           ptr_50C9A4 = 0;
         }
         v28 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0), a2b, (signed __int64)v28, 0, 255);
+        pRenderer->_4A63E6(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), a2b, (signed __int64)v28, 0, 255);
       }
       if ( !bRingsShownInCharScreen )
-        pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0), pBowNum);
+        pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), pBowNum);
     }
     pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// потом плащ
     if ( pCloakNum )
@@ -1488,9 +1485,9 @@
         {
           v41 = v35 + 1;
           if ( item_Cloak->uAttributes & 2 )
-            pRenderer->DrawTransparentRedShade(pX_Cloak, pY_Cloak, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0));
+            pRenderer->DrawTransparentRedShade(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
           else
-            pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0));
+            pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
         }
         else
         {
@@ -1502,7 +1499,7 @@
             v169 = "sp30a";
           if ( (item_Cloak->uAttributes & 0xF0) == 128 )
             v169 = "sp91a";
-          v39 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v169, TEXTURE_16BIT_PALETTE)];
+          v39 = pIcons_LOD->LoadTexturePtr(v169, TEXTURE_16BIT_PALETTE);
           dword_50C9A8 -= pEventTimer->uTimeElapsed;
           if ( dword_50C9A8 <= 0 )
           {
@@ -1511,14 +1508,14 @@
             ptr_50C9A4 = 0;
           }
           v40 = (double)GetTickCount() * 0.1;
-          pRenderer->_4A63E6(pX_Cloak, pY_Cloak, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255);
+          pRenderer->_4A63E6(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), v39, (signed __int64)v40, 0, 255);
         }
         if ( !bRingsShownInCharScreen )
-          pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0), pCloakNum);
+          pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), pCloakNum);
       }
     }
     pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,//рисуется кукла
-            (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0));
+            pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
     pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// потом броня
     if ( pArmorNum )
     {
@@ -1550,14 +1547,14 @@
         {
           v53 = v48 + 1;
           if ( item_Armor->uAttributes & 2 )
-            pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0));
+            pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48));
           else
           {
             v55 = (char *)&pIcons_LOD->pTextures[v48];
             if ( !(item_Armor->uAttributes & 1) )
-              pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0));
+              pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)v55);
             else
-              pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0));
+              pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)v55);
           }
         }
         else
@@ -1570,7 +1567,7 @@
             v170 = "sp30a";
           if ( (item_Armor->uAttributes & 0xF0) == 128 )
             v170 = "sp91a";
-          v51 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v170, TEXTURE_16BIT_PALETTE)];
+          v51 = pIcons_LOD->LoadTexturePtr(v170, TEXTURE_16BIT_PALETTE);
           dword_50C9A8 -= pEventTimer->uTimeElapsed;
           if ( dword_50C9A8 <= 0 )
           {
@@ -1579,7 +1576,7 @@
             ptr_50C9A4 = 0;
           }
           v52 = (double)GetTickCount() * 0.1;
-          pRenderer->_4A63E6(pX_Armor, pY_Armor, (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0), v51, (signed __int64)v52, 0, 255);
+          pRenderer->_4A63E6(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48), v51, (signed __int64)v52, 0, 255);
         }
         if ( pPlayers[uPlayerID]->pEquipment.uMainHand //далее плечи брони
           && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND ||
@@ -1601,15 +1598,15 @@
           if ( !(item_Armor->uAttributes & 0xF0) )
           {
             v98 = v94 + 1;
-            v99 = (char *)&pIcons_LOD->pTextures[v94];
+            v99 = (char *)pIcons_LOD->GetTexture(v94);
             if ( item_Armor->uAttributes & 2 )
-              pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
+              pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)v99);
             else
             {
               if ( item_Armor->uAttributes & 1 )
-                pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
+                pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)v99);
               else
-                pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
+                pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)v99);
             }
           }
           else
@@ -1626,7 +1623,7 @@
                   v173 = "sp30a";
                 if ( (item_Armor->uAttributes & 0xF0) == 128 )
                   v173 = "sp91a";
-                v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v173, TEXTURE_16BIT_PALETTE)];
+                v96 = (char *)pIcons_LOD->LoadTexturePtr(v173, TEXTURE_16BIT_PALETTE);
                 dword_50C9A8 -= pEventTimer->uTimeElapsed;
                 if ( dword_50C9A8 <= 0 )
                 {
@@ -1635,7 +1632,7 @@
                   ptr_50C9A4 = 0;
                 }
                 v97 = (double)GetTickCount();
-                pRenderer->_4A63E6(pX_shoulder, pY_shoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
+                pRenderer->_4A63E6(pX_shoulder, pY_shoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
               }
             }
           }
@@ -1650,15 +1647,15 @@
             if ( !(item_Armor->uAttributes & 0xF0) )
             {
               v109 = v94 + 1;
-              v110 = (char *)&pIcons_LOD->pTextures[v94];
+              v110 = (char *)pIcons_LOD->GetTexture(v94);
               if ( item_Armor->uAttributes & 2 )
-                pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
+                pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
               else
               {
                 if ( item_Armor->uAttributes & 1 )
-                  pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
+                  pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
                 else
-                  pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
+                  pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
               }
             }
             else
@@ -1671,7 +1668,7 @@
                 v178 = "sp30a";
               if ( (item_Armor->uAttributes & 0xF0) == 128 )
                 v178 = "sp91a";
-              v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v178, TEXTURE_16BIT_PALETTE)];
+              v96 = (char *)pIcons_LOD->LoadTexturePtr(v178, TEXTURE_16BIT_PALETTE);
               dword_50C9A8 -= pEventTimer->uTimeElapsed;
               if ( dword_50C9A8 <= 0 )
               {
@@ -1680,12 +1677,12 @@
                 ptr_50C9A4 = 0;
               }
               v97 = (double)GetTickCount();
-              pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
+              pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
             }
           }
         }
         if ( !bRingsShownInCharScreen )
-          pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0), pArmorNum);
+          pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)v55, pArmorNum);
       }
     }
     pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;//далее обувь
@@ -1714,15 +1711,15 @@
         if ( !(item_Boot->uAttributes & 0xF0) )
         {
           v65 = v59 + 1;
-          v66 = (char *)&pIcons_LOD->pTextures[v59];
+          v66 = (char *)pIcons_LOD->GetTexture(v59);
           if ( item_Boot->uAttributes & 2 )
-            pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
+            pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)v66);
           else
           {
             if ( item_Boot->uAttributes & 1 )
-              pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
+              pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)v66);
             else
-              pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
+              pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)v66);
           }
         }
         else
@@ -1735,7 +1732,7 @@
             v171 = "sp30a";
           if ( (item_Boot->uAttributes & 0xF0) == 128 )
             v171 = "sp91a";
-          v63 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v171, TEXTURE_16BIT_PALETTE)];
+          v63 = pIcons_LOD->LoadTexturePtr(v171, TEXTURE_16BIT_PALETTE);
           dword_50C9A8 -= pEventTimer->uTimeElapsed;
           if ( dword_50C9A8 <= 0 )
           {
@@ -1744,10 +1741,10 @@
             ptr_50C9A4 = 0;
           }
           v64 = (double)GetTickCount() * 0.1;
-          pRenderer->_4A63E6(pX_Boot, pY_Boot, (Texture *)(v59 != -1 ? (int)&pIcons_LOD->pTextures[v59] : 0), v63, (signed __int64)v64, 0, 255);
+          pRenderer->_4A63E6(pX_Boot, pY_Boot, pIcons_LOD->GetTexture(v59), v63, (signed __int64)v64, 0, 255);
         }
         if ( !bRingsShownInCharScreen )
-          pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0), pBootNum);
+          pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)v66, pBootNum);
       }
     }
     pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand;
@@ -1755,7 +1752,7 @@
         && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0],
             pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
-                     (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0));
+                     pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
         pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// далее пояс
         if ( pBeltNum )
         {
@@ -1783,18 +1780,18 @@
           if ( !(item_Belt->uAttributes & 0xF0) )
           {
             v79 = v75 + 1;
-            v80 = (char *)&pIcons_LOD->pTextures[v75];
+            v80 = (char *)pIcons_LOD->GetTexture(v75);
             if ( item_Belt->uAttributes & 2 )
-              pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
+              pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)v80);
             else
             {
               if ( item_Belt->uAttributes & 1 )
-                pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
+                pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)v80);
               else
-                pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
+                pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)v80);
             }
             if ( !bRingsShownInCharScreen )
-              pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0), pBeltNum);
+              pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)v80, pBeltNum);
           }
           else
           {
@@ -1806,7 +1803,7 @@
               v172 = "sp30a";
             if ( (item_Belt->uAttributes & 0xF0) == 128 )
               v172 = "sp91a";
-            v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)];
+            v77 = pIcons_LOD->LoadTexturePtr(v172, TEXTURE_16BIT_PALETTE);
             dword_50C9A8 -= pEventTimer->uTimeElapsed;
             if ( dword_50C9A8 <= 0 )
             {
@@ -1815,7 +1812,7 @@
               ptr_50C9A4 = 0;
             }
             v78 = (double)GetTickCount() * 0.1;
-            pRenderer->_4A63E6(pX_Belt, pY_Belt, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255);
+            pRenderer->_4A63E6(pX_Belt, pY_Belt, pIcons_LOD->GetTexture(v75), v77, (signed __int64)v78, 0, 255);
           }
         }
       }
@@ -1827,7 +1824,7 @@
              || pItemsTable->pItems[v83].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield )
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
              pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1],
-             (Texture *)(papredoll_dlaus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlaus[uPlayerID - 1]] : 0));
+             pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1]));
       }
       pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;//далее воротник плаща
       if ( pCloakCollarNum )
@@ -1863,13 +1860,13 @@
             if ( !(item_CloakCollar->uAttributes & 0xF0) )
             {
               v119 = v116 + 1;
-              v120 = (char *)&pIcons_LOD->pTextures[v116];
+              v120 = (char *)pIcons_LOD->GetTexture(v116);
               if ( item_CloakCollar->uAttributes & 2 )
-                pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0));
+                pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
               else
-                pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0));
+                pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
               if ( !bRingsShownInCharScreen )
-                pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0), pCloakCollarNum);
+                pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)v120, pCloakCollarNum);
             }
             else
             {
@@ -1881,7 +1878,7 @@
                 v179 = "sp30a";
               if ( (item_CloakCollar->uAttributes & 0xF0) == 128 )
                 v179 = "sp91a";
-              a2i = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v179, TEXTURE_16BIT_PALETTE)];
+              a2i = pIcons_LOD->LoadTexturePtr(v179, TEXTURE_16BIT_PALETTE);
               dword_50C9A8 -= pEventTimer->uTimeElapsed;
               if ( dword_50C9A8 <= 0 )
               {
@@ -1890,7 +1887,7 @@
                 ptr_50C9A4 = 0;
               }
               v118 = (double)GetTickCount() * 0.1;
-              pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, (Texture *)(v116 != -1 ? (int)&pIcons_LOD->pTextures[v116] : 0), a2i, (signed __int64)v118, 0, 255);
+              pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, pIcons_LOD->GetTexture(v116), a2i, (signed __int64)v118, 0, 255);
             }
           }
         }
@@ -1901,7 +1898,7 @@
         if ( v122 != pIcons_LOD->FindTextureByName("Pending") )
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 24],
                      pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 23],
-                     (Texture *)(v122 != -1 ? (int)&pIcons_LOD->pTextures[v122] : 0));
+                     pIcons_LOD->GetTexture(v122));
       }
     pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;//далее шлем
     if ( pHelmNum )
@@ -1945,7 +1942,7 @@
             v180 = "sp30a";
           if ( (item_Helm->uAttributes & 0xF0) == 128 )
             v180 = "sp91a";
-          v129 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v180, TEXTURE_16BIT_PALETTE)];
+          v129 = pIcons_LOD->LoadTexturePtr(v180, TEXTURE_16BIT_PALETTE);
           dword_50C9A8 -= pEventTimer->uTimeElapsed;
           if ( dword_50C9A8 <= 0 )
           {
@@ -1954,24 +1951,24 @@
             ptr_50C9A4 = 0;
           }
           v130 = (double)GetTickCount() * 0.1;
-          pRenderer->_4A63E6(pX_Helm, pY_Helm, (Texture *)(v127 != -1 ? (int)&pIcons_LOD->pTextures[v127] : 0), v129, (signed __int64)v130, 0, 255);
+          pRenderer->_4A63E6(pX_Helm, pY_Helm, pIcons_LOD->GetTexture(v127), v129, (signed __int64)v130, 0, 255);
         }
         else
         {
           v131 = v127 + 1;
-          v132 = (char *)&pIcons_LOD->pTextures[v127];
+          v132 = (char *)pIcons_LOD->GetTexture(v127);
           if ( item_Helm->uAttributes & 2 )
-            pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
+            pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)v132);
           else
           {
             if ( item_Helm->uAttributes & 1 )
-              pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
+              pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)v132);
             else
-              pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
+              pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)v132);
           }
         }
         if ( !bRingsShownInCharScreen )
-          pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0), pHelmNum);
+          pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)v132, pHelmNum);
       }
     }
     pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand
@@ -1988,15 +1985,15 @@
       if ( !(item_MainHand3->uAttributes & 0xF0) )
       {
         v142 = v138 + 1;
-        v143 = (char *)&pIcons_LOD->pTextures[v138];
+        v143 = (char *)pIcons_LOD->GetTexture(v138);
         if ( item_MainHand3->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
+          pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
         else
         {
           if ( item_MainHand3->uAttributes & 1 )
-            pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
+            pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)v143);
           else
-            pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
+            pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
         }
       }
       else
@@ -2009,7 +2006,7 @@
            v182 = "sp30a";
         if ( (item_MainHand3->uAttributes & 0xF0) == 128 )
           v182 = "sp91a";
-        v140 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v182, TEXTURE_16BIT_PALETTE)];
+        v140 = pIcons_LOD->LoadTexturePtr(v182, TEXTURE_16BIT_PALETTE);
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
@@ -2018,10 +2015,10 @@
           ptr_50C9A4 = 0;
         }
         v141 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0), v140, (signed __int64)v141, 0, 255);
+        pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, pIcons_LOD->GetTexture(v138), v140, (signed __int64)v141, 0, 255);
       }
       if ( !bRingsShownInCharScreen )
-        pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0), pMainHandNum3);
+        pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)v143, pMainHandNum3);
     }
     pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// далее щит
     if ( pShieldNum )
@@ -2061,14 +2058,14 @@
       if ( !(item_Shield->uAttributes & 0xF0) )
       {
         if ( item_Shield->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0));
+          pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153));
         else
         {
-          v160 = (char *)&pIcons_LOD->pTextures[v153];
+          v160 = (char *)pIcons_LOD->GetTexture(v153);
           if ( !(item_Shield->uAttributes & 1) )
-          pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0));
+          pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)v160);
           else
-            pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0));
+            pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)v160);
         }
       }
       else
@@ -2081,7 +2078,7 @@
           v183 = "sp30a";
         if ( (item_Shield->uAttributes & 0xF0) == 128 )
           v183 = "sp91a";
-        v157 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v183, TEXTURE_16BIT_PALETTE)];
+        v157 = pIcons_LOD->LoadTexturePtr(v183, TEXTURE_16BIT_PALETTE);
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
@@ -2090,29 +2087,26 @@
           ptr_50C9A4 = 0;
         }
         v158 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), v157, (signed __int64)v158, 0, 255);
+        pRenderer->_4A63E6(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), v157, (signed __int64)v158, 0, 255);
         if ( v245 )
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0],
-                 pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1],
-                 (Texture *)(papredoll_dlhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhs[uPlayerID - 1]] : 0));
+                 pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1]));
       }
       if ( !bRingsShownInCharScreen )
-        pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), pShieldNum);
+        pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), pShieldNum);
     }
   }
-  pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1],
-             (Texture *)(papredoll_drhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_drhs[uPlayerID - 1]] : 0));
+  pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1]));
   pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand;
   if ( pMainHandNum5 )
   {
     item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1];
     if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield )
-      pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1],
-                 (Texture *)(papredoll_dlhus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhus[uPlayerID - 1]] : 0));
+      pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1]));
   }
   if ( !bRingsShownInCharScreen )//рисование лупы
-    pRenderer->DrawTextureTransparent(603, 299, (Texture *)(uTextureID_MAGNIF_B != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_MAGNIF_B] : 0));
-  pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0));//обрамление
+    pRenderer->DrawTextureTransparent(603, 299, pIcons_LOD->GetTexture(uTextureID_MAGNIF_B));
+  pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//обрамление
 }
 
 //----- (0043E825) --------------------------------------------------------
@@ -2120,13 +2114,13 @@
 {
   int v3; // ecx@1
   unsigned int pItemTextureNum; // ebx@3
-  int v9; // edi@17
+  //int v9; // edi@17
   char v13; // sf@24
   unsigned __int8 v14; // of@24
   unsigned int pItemNum; // eax@25
-  int v20; // edi@40
-  int v21; // eax@41
-  int v33; // esi@61
+  //int v20; // edi@40
+  //int v21; // eax@41
+  //int v33; // esi@61
   const char *spell_texture_name; // [sp-8h] [bp-38h]@8
   Texture *spell_texture; // [sp+10h] [bp-20h]@14
   int v41; // [sp+10h] [bp-20h]@26
@@ -2137,10 +2131,9 @@
 
   pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
   CharacterUI_DrawPaperdoll(uPlayerID);
-  pRenderer->DrawTextureTransparent(0x1D9u, 0, (Texture *)(uTextureID_BACKHAND != -1 ? &pIcons_LOD->pTextures[uTextureID_BACKHAND] : 0));
-  pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0));
-  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY,
-     (Texture *)(uTextureID_detaliz_close_button != -1 ? &pIcons_LOD->pTextures[uTextureID_detaliz_close_button] : 0));
+  pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND));
+  pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));
+  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));
   v3 = 0;
   v48 = 0;
   do
@@ -2162,7 +2155,7 @@
           spell_texture_name = "sp30a";
         if ( (item->uAttributes & 0xF0) == 128 )
           spell_texture_name = "sp91a";
-        spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
+        spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
@@ -2170,21 +2163,18 @@
           item->uAttributes &= 0xFu;
           ptr_50C9A4 = 0;
         }
-        pRenderer->_4A63E6(pX_Ring, pY_Ring, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
+        pRenderer->_4A63E6(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
       }
       else
       {
-        v9 = pItemTextureNum + 1;
-        if ( item->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
+        if (item->Broken())
+          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
+        else if (!item->Identified())
+          pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
         else
-        {
-          if ( (item->uAttributes & 1) == 0 )
-            pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
-          else
-            pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
-        }
-        pRenderer->_4A601E(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
+          pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
+
+        pRenderer->_4A601E(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
       }
     }
     v3++;
@@ -2210,7 +2200,7 @@
         spell_texture_name = "sp30a";
       if ( (item->uAttributes & 0xF0) == 128 )
         spell_texture_name = "sp91a";
-      spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
+      spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
       dword_50C9A8 -= pEventTimer->uTimeElapsed;
       if ( dword_50C9A8 <= 0 )
       {
@@ -2218,25 +2208,18 @@
         item->uAttributes &= 0xFu;
         ptr_50C9A4 = 0;
       }
-      pRenderer->_4A63E6(493, 91, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
+      pRenderer->_4A63E6(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
     }
     else
     {
-      v20 = pItemTextureNum + 1;
-      if ( item->uAttributes & 2 )
-      {
-        v21 = 9 * pItemTextureNum;
-        pRenderer->DrawTransparentRedShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
-      }
+      if (item->Broken())
+        pRenderer->DrawTransparentRedShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+      else if (!item->Identified())
+        pRenderer->DrawTransparentGreenShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
       else
-      {
-        v21 = 9 * pItemTextureNum;
-        if ( !(item->uAttributes & 1) )
-          pRenderer->DrawTransparentGreenShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
-        else
-          pRenderer->DrawTextureTransparent(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
-      }
-      pRenderer->_4A601E(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0), v41);
+        pRenderer->DrawTextureTransparent(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+
+      pRenderer->_4A601E(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), v41);
     }
   }
   pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove;
@@ -2246,17 +2229,14 @@
   pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
   if ( !(item->uAttributes & 0xF0) )
   {
-    v33 = pItemTextureNum + 1;
-    if ( item->uAttributes & 2 )
-      pRenderer->DrawTransparentRedShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
+    if (item->Broken())
+      pRenderer->DrawTransparentRedShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
+    else if (!item->Identified())
+      pRenderer->DrawTransparentGreenShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
     else
-    {
-      if ( !(item->uAttributes & 1) )
-        pRenderer->DrawTransparentGreenShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
-      else
-        pRenderer->DrawTextureTransparent(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
-    }
-    pRenderer->_4A601E(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
+      pRenderer->DrawTextureTransparent(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
+
+    pRenderer->_4A601E(586, 88,pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
   }
   else
   {
@@ -2268,7 +2248,7 @@
       spell_texture_name = "sp30a";
     if ( (item->uAttributes & 0xF0) == 128 )
       spell_texture_name = "sp91a";
-    spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
+    spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
     dword_50C9A8 -= pEventTimer->uTimeElapsed;
     if ( dword_50C9A8 <= 0 )
     {
@@ -2797,7 +2777,7 @@
 
         pPlayer = &pParty->pPlayers[uPlayerID-1];
         v2 = pIcons_LOD->LoadTexture("fr_stats", TEXTURE_16BIT_PALETTE);
-        pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
+        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(v2));
         v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
         sprintf(pTmpBuf, "\f%05d", v3);
         sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s