changeset 76:5b9ef61560cf

Слияние
author Ritor1
date Mon, 28 Jan 2013 14:52:18 +0600
parents 6ef241d53522 (current diff) 2c0260e09693 (diff)
children 7ad8eaa172c5 3b2fbcf8d9cc
files
diffstat 9 files changed, 141 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/BSPModel.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/BSPModel.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -12,19 +12,19 @@
   void *v4; // ST00_4@1
 
   v1 = this;
-  pAllocator->FreeChunk(*(void **)&this->pModelName[4]);
-  v2 = *(void **)&v1->pModelName[16];
-  *(int *)&v1->pModelName[4] = 0;
+  pAllocator->FreeChunk(*(void **)&this->pVertices.pVertices);
+  v2 = v1->pFaces;
+  v1->pVertices.pVertices = 0;
   pAllocator->FreeChunk(v2);
-  v3 = *(void **)&v1->pModelName[20];
-  *(int *)&v1->pModelName[16] = 0;
+  v3 = v1->pFacesOrdering;
+  v1->pFaces = 0;
   pAllocator->FreeChunk(v3);
-  v4 = *(void **)&v1->pModelName[28];
-  *(int *)&v1->pModelName[20] = 0;
+  v4 = v1->pNodes;
+  v1->pFacesOrdering = 0;
   pAllocator->FreeChunk(v4);
-  *(int *)&v1->pModelName[28] = 0;
-  *(int *)&v1->pModelName[24] = 0;
-  *(int *)&v1->pModelName[8] = 0;
-  *(int *)&v1->pModelName[0] = 0;
-  *(short *)&v1->pModelName[12] = 0;
+  v1->pNodes = 0;
+  v1->uNumNodes = 0;
+  v1->uNumFaces = 0;
+  v1->pVertices.uNumVertices = 0;
+  v1->uNumConvexFaces = 0;
 }
--- a/GUIFont.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/GUIFont.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -108,8 +108,8 @@
   unsigned int v15; // edx@9
   unsigned __int16 v16; // cx@12
   unsigned __int8 *v17; // eax@12
-  char Dest; // [sp+Ch] [bp-1Ch]@16
-  char v19; // [sp+11h] [bp-17h]@16
+  char Dest[20]; // [sp+Ch] [bp-1Ch]@16
+  //char v19; // [sp+11h] [bp-17h]@16
   size_t v20; // [sp+20h] [bp-8h]@2
   int v21; // [sp+24h] [bp-4h]@1
   int uXa; // [sp+30h] [bp+8h]@9
@@ -160,9 +160,9 @@
             }
             else
             {
-              strncpy(&Dest, &Str[v6 + 1], 5u);
-              v19 = 0;
-              v21 = atoi(&Dest);
+              strncpy(Dest, &Str[v6 + 1], 5u);
+              Dest[5] = 0;
+              v21 = atoi(Dest);
               ui_current_text_color = v21;
               v6 += 5;
             }
--- a/GUIWindow.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/GUIWindow.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -984,8 +984,8 @@
       v4 = 2 * (12 * pPlayer->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2431[12 * pPlayer->pNumSpellBookPage] + v3));
       pWindow->CreateButton(pViewport->uViewportX + dword_4E20D0[v4],
         pViewport->uViewportY + dword_4E20D0[v4 + 1],
-        *(short *)(dword_50640C[v3] + 24),
-        *(short *)(dword_50640C[v3] + 26),
+        dword_506408[v3 + 1]->uTextureWidth,
+        dword_506408[v3 + 1]->uTextureHeight,
         1, 79, 0x56u, v3, 0, "", 0);
       ++a2;
     }
--- a/Texture.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/Texture.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -48,14 +48,13 @@
 Texture *pTexture_TownPortalIsland;
 Texture *pTexture_TownPortalHeaven;
 Texture *pTexture_TownPortalHell;
-Texture *dword_5063D8[777];
-Texture *dword_506404[777];
-Texture *dword_506434[777];
+Texture *dword_5063D8[12];
+Texture *dword_506408[12];
 Texture *pTexture_50643C; // idb
 Texture *ptr_506440;
 Texture *pTexture_506444;
 Texture *pTexture_506448; // idb
-Texture *pTextures_tabs[8][2];
+Texture *pTextures_tabs[9][2];
 Texture *pTexture_mapbordr; // idb
 Texture *pTexture_pagemask; // idb
 Texture *pTextures_5064A0[14];
@@ -1333,7 +1332,6 @@
 {
   RGBTexture *v3; // esi@1
   signed int result; // eax@2
-  FILE *v5; // edi@3
   char *v6; // eax@3
   int v7; // edx@3
   char v8; // cl@4
@@ -1353,18 +1351,9 @@
   unsigned __int16 *v22; // edi@71
   signed int v23; // eax@73
   int v24; // eax@78
-  char v25; // [sp+Ch] [bp-54h]@3
-  char DstBuf; // [sp+3Ch] [bp-24h]@3
-  char v27; // [sp+3Dh] [bp-23h]@3
-  char v28; // [sp+3Eh] [bp-22h]@3
-  char v29; // [sp+3Fh] [bp-21h]@3
-  int v30; // [sp+40h] [bp-20h]@3
-  int v31; // [sp+44h] [bp-1Ch]@3
-  char v32; // [sp+48h] [bp-18h]@3
-  char v33; // [sp+4Ah] [bp-16h]@3
-  char v34; // [sp+4Ch] [bp-14h]@3
-  char v35; // [sp+4Dh] [bp-13h]@3
-  unsigned __int16 v36; // [sp+4Eh] [bp-12h]@3
+  char v25[48]; // [sp+Ch] [bp-54h]@3
+  PCXHeader1 pcx_header1;
+  PCXHeader2 pcx_header2;
   int v37; // [sp+54h] [bp-Ch]@3
   int v38; // [sp+58h] [bp-8h]@57
   FILE *File; // [sp+5Ch] [bp-4h]@1
@@ -1373,21 +1362,11 @@
   File = fopen(Filename, "rb");
   if ( !File )
     return 1;
-  v5 = File;
-  fread(&DstBuf, 1u, 1u, File);
-  fread(&v27, 1u, 1u, v5);
-  fread(&v28, 1u, 1u, v5);
-  fread(&v29, 1u, 1u, v5);
-  fread(&v30, 2u, 1u, v5);
-  fread((char *)&v30 + 2, 2u, 1u, File);
-  fread(&v31, 2u, 1u, File);
-  fread((char *)&v31 + 2, 2u, 1u, File);
-  fread(&v32, 2u, 1u, File);
-  fread(&v33, 2u, 1u, File);
-  fread(&v25, 0x30u, 1u, File);
-  fread(&v34, 1u, 1u, File);
-  fread(&v35, 1u, 1u, File);
-  fread(&v36, 2u, 1u, File);
+  
+  fread(&pcx_header1, sizeof(pcx_header1), 1, File);
+  fread(&v25,48,1,File);
+  fread(&pcx_header2, 4, 1, File);
+
   v6 = (char *)Filename;
   v37 = 0;
   v7 = (char *)v3 - Filename;
@@ -1403,10 +1382,10 @@
   }
   while ( v37 < 15 );
   v3->pName[v37] = 0;
-  if ( v29 != 8 )
+  if ( pcx_header1.bpp != 8 )
     return 3;
-  v9 = v31 - (short)v30 + 1;
-  v10 = HIWORD(v31) - HIWORD(v30);
+  v9 = pcx_header1.right - pcx_header1.left + 1;
+  v10 = pcx_header1.bottom - pcx_header1.up;
   v3->uWidth = v9;
   ++v10;
   v3->uHeight = v10;
@@ -1525,9 +1504,9 @@
     }
     fseek(File, 128, 0);
     ftell(File);
-    if ( v35 == 1 )
+	if ( pcx_header2.planes == 1 )
       Abortf("24bit PCX Only!");
-    if ( v35 == 3 )
+    if ( pcx_header2.planes == 3 )
     {
       v37 = 0;
       if ( v3->uHeight > 0 )
@@ -1538,7 +1517,7 @@
           v17 = v3->pPixels;
           v38 = 0;
           v18 = &v17[v16];
-          if ( v36 )
+		  if ( pcx_header2.pitch )
           {
             do
             {
@@ -1573,10 +1552,10 @@
                 ++v18;
               }
             }
-            while ( v38 < v36 );
+			while ( v38 < (unsigned __int16)pcx_header2.pitch);
           }
           v20 = &v3->pPixels[v37 * v3->uWidth];
-          while ( v38 < 2 * v36 )
+		  while ( v38 < 2 * (unsigned __int16)pcx_header2.pitch )
           {
             fread((char *)&Filename + 3, 1u, 1u, File);
             if ( (BYTE3(Filename) & 0xC0) == -64 )
@@ -1608,7 +1587,7 @@
             }
           }
           v22 = &v3->pPixels[v37 * v3->uWidth];
-          while ( v38 < 3 * v36 )
+		  while ( v38 < 3 * (unsigned __int16)pcx_header2.pitch )
           {
             fread((char *)&Filename + 3, 1u, 1u, File);
             if ( (BYTE3(Filename) & 0xC0) == -64 )
--- a/Texture.h	Mon Jan 28 14:52:05 2013 +0600
+++ b/Texture.h	Mon Jan 28 14:52:18 2013 +0600
@@ -151,13 +151,12 @@
 extern Texture *pTexture_TownPortalHeaven;
 extern Texture *pTexture_TownPortalHell;
 extern Texture *dword_5063D8[];
-extern Texture *dword_506404[];
-extern Texture *dword_506434[];
+extern Texture *dword_506408[];
 extern Texture *pTexture_50643C; // idb
 extern Texture *ptr_506440;
 extern Texture *pTexture_506444;
 extern Texture *pTexture_506448; // idb
-extern Texture *pTextures_tabs[8][2];
+extern Texture *pTextures_tabs[9][2];
 extern Texture *pTexture_mapbordr; // idb
 extern Texture *pTexture_pagemask; // idb
 extern Texture *pTextures_5064A0[14];
--- a/mm7_1.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/mm7_1.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -227,7 +227,7 @@
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0);
   v6 = pGUIWindow_CurrentMenu;
   v70 = 0;
-  v80 = dword_4E2A2C;
+  v80 = pWeaponSkills;
   do
   {
     v62 = *v80;
@@ -286,7 +286,9 @@
         if ( !(v87 & 0xC0) )
         {
           sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY);
-          goto LABEL_28;
+          pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
+		  v6 = pGUIWindow_CurrentMenu;
+		  continue;
         }
         v16 = pGlobalTXT_LocalizationStrings[432];
         if ( (v87 & 0x80u) == 0 )
@@ -299,13 +301,12 @@
         v46 = v88;
       }
       sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54);
-LABEL_28:
       pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
       v6 = pGUIWindow_CurrentMenu;
     }
     ++v80;
   }
-  while ( (signed int)v80 < (signed int)dword_4E2A50 );
+  while ( v80 <= &pWeaponSkills[8]);
   if ( !v70 )
   {
     v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3;
@@ -316,7 +317,7 @@
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0);
   v17 = pGUIWindow_CurrentMenu;
   v71 = 0;
-  v81 = _4E2A80_skills;
+  v81 = pMagicSkills;
   do
   {
     v18 = 0;
@@ -336,7 +337,10 @@
       }
       v20 = v19->field_1C;
       if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) )
-        goto LABEL_59;
+	  {
+        v18 = v67++ + 1;
+		continue;
+	  }
       ++v71;
       uYa = v19->uY;
       v21 = pPlayer->pActiveSkills[v63];
@@ -371,7 +375,10 @@
         if ( !(v21 & 0xC0) )
         {
           sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23);
-          goto LABEL_58;
+          pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
+		  v17 = pGUIWindow_CurrentMenu;
+		  v18 = v67++ + 1;
+		  continue;
         }
         v25 = (v21 & 0x80u) != 0;
         v26 = pGlobalTXT_LocalizationStrings[432];
@@ -385,15 +392,15 @@
         v47 = v89;
       }
       sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55);
-LABEL_58:
+//LABEL_58:
       pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
       v17 = pGUIWindow_CurrentMenu;
-LABEL_59:
+//LABEL_59:
       v18 = v67++ + 1;
     }
     ++v81;
   }
-  while ( (signed int)v81 < (signed int)pAwardsTextColors );
+  while ( v81 <= &pMagicSkills[8]);
   if ( !v71 )
     v17->DrawText(
       pFontLucida,
@@ -429,7 +436,10 @@
       }
       v31 = v30->field_1C;
       if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) )
-        goto LABEL_89;
+	  {
+		  v29 = v68++ + 1;
+		  continue;
+	  }
       v27 = v30->uY;
       ++v72;
       v60 = 0;
@@ -465,7 +475,10 @@
         if ( !(v90 & 0xC0) )
         {
           sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb);
-          goto LABEL_88;
+		  pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
+		  v28 = pGUIWindow_CurrentMenu;
+		  v29 = v68++ + 1;
+		  continue;
         }
         v35 = pGlobalTXT_LocalizationStrings[432];
         if ( (v90 & 0x80u) == 0 )
@@ -478,15 +491,15 @@
         v48 = v91;
       }
       sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56);
-LABEL_88:
+//LABEL_88:
       pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
       v28 = pGUIWindow_CurrentMenu;
-LABEL_89:
+//LABEL_89:
       v29 = v68++ + 1;
     }
     ++v82;
   }
-  while ( (signed int)v82 < (signed int)dword_4E2A2C );
+  while ( v82 <= &pArmorSkills[4]);
   if ( !v72 )
   {
     v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3;
@@ -497,7 +510,7 @@
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0);
   v36 = pGUIWindow_CurrentMenu;
   v73 = 0;
-  v83 = dword_4E2A50;
+  v83 = pMiscSkills;
   do
   {
     v37 = 0;
@@ -518,7 +531,11 @@
       }
       v39 = v38->field_1C;
       if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) )
-        goto LABEL_119;
+	  {
+        //goto LABEL_119;
+		v37 = v69++ + 1;
+		continue;
+	  }
       ++v73;
       uYc = v38->uY;
       v40 = pPlayer->pActiveSkills[v65];
@@ -553,7 +570,10 @@
         if ( !(v40 & 0xC0) )
         {
           sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42);
-          goto LABEL_118;
+          LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
+		  v36 = pGUIWindow_CurrentMenu;
+		  v37 = v69++ + 1;
+		  continue;
         }
         v25 = (v40 & 0x80u) != 0;
         v44 = pGlobalTXT_LocalizationStrings[432];
@@ -567,15 +587,13 @@
         v49 = v92;
       }
       sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57);
-LABEL_118:
       LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
       v36 = pGUIWindow_CurrentMenu;
-LABEL_119:
       v37 = v69++ + 1;
     }
     ++v83;
   }
-  while ( (signed int)v83 < (signed int)_4E2A80_skills );
+  while ( v83 <= &pMiscSkills[11]);
   if ( !v73 )
     LOBYTE(v38) = v36->DrawText(
                     pFontLucida,
@@ -619,12 +637,12 @@
   v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
   v3 = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
   pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0));
-  sprintf(pTmpBuf, "%s ", pGlobalTXT_LocalizationStrings[23], v2);// TODO check args
+  sprintf(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[23], v2);// TODO check args
   sprintf(
     Source,
     pGlobalTXT_LocalizationStrings[429],
 	&pParty->pPlayers[v1-1].pName,//&stru_AA1058[3].pSounds[6972 * v1 + 40720],
-	&pClassNames[pParty->pPlayers[v1-1].uClass]);//&pClassNames[stru_AA1058[3].pSounds[6972 * v1 + 40737]]);
+	pClassNames[pParty->pPlayers[v1-1].uClass]);//&pClassNames[stru_AA1058[3].pSounds[6972 * v1 + 40737]]);
   strcat(pTmpBuf, Source);
   strcat(pTmpBuf, "\xC" "00000");
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
@@ -814,9 +832,9 @@
   int v24; // [sp+20h] [bp-18h]@5
   ItemGen *pItem2; // [sp+24h] [bp-14h]@5
   int v26; // [sp+28h] [bp-10h]@3
-  signed int v27; // [sp+2Ch] [bp-Ch]@3
-  int a2a; // [sp+30h] [bp-8h]@5
-  int a3; // [sp+34h] [bp-4h]@5
+  unsigned int uCellID; // [sp+2Ch] [bp-Ch]@3
+  unsigned int uCellX; // [sp+30h] [bp-8h]@5
+  unsigned int uCellY; // [sp+34h] [bp-4h]@5
 
   v23 = pRenderer->pActiveZBuffer;
   pPlayer = pPlayers[uPlayerID];
@@ -828,16 +846,16 @@
     v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE);
     pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0));
   }
-  v27 = 0;
+  uCellID = 0;
   v26 = (int)pPlayer->pInventoryIndices;
   do
   {
     if ( *(int *)v26 > 0 )
     {
       v24 = *(int *)v26 - 1;
-      a3 = 32 * v27 / 14 + 17;
+      uCellY = 32 * (uCellID / 14) + 17;
       pItem = &pPlayer->pInventoryItems[v24];
-      a2a = 32 * v27 % 14 + 14;
+      uCellX = 32 * (uCellID % 14) + 14;
       pItem2 = pItem;
       if ( pItem->uItemID )
       {
@@ -851,7 +869,7 @@
         if ( v10 < 14 )
           v11 = 14;
         if ( (v11 - 14) >> 5 == 0 && v8 < 32 )
-          a2a += (32 - v10) / 2;
+          uCellX += (32 - v10) / 2;
         v12 = v7->uTextureWidth;
         if ( v10 < 14 )
           v12 = 14;
@@ -862,27 +880,27 @@
         if ( v9 < 14 )
           v14 = 14;
         v16 = pItem->uAttributes;
-        v17 = a2a + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[a3 + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)];
+        v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)];
         if ( !(v16 & 0xF0) )
         {
           if ( v16 & 1
             || pCurrentScreen != 13 )
           {
             if ( v16 & 2 )
-              pRenderer->_4A6776(a2a, a3, v7);
+              pRenderer->_4A6776(uCellX, uCellY, v7);
             else
-              pRenderer->DrawTextureTransparent(a2a, a3, v7);
+              pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
           }
           else
           {
-            pRenderer->DrawTransparentGreenShade(a2a, a3, v7);
+            pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
           }
           ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
           pPlayer = pPlayer2;
           //goto LABEL_34;
-          ++v27;
+          ++uCellID;
           v26 += 4;
-          break;
+          continue;
         }
         if ( (unsigned __int8)(v16 & 0xF0) != 16 )
         {
@@ -898,13 +916,13 @@
               ptr_50C9A4 = 0;
             }
             v19 = (double)GetTickCount() * 0.1;
-            pRenderer->_4A63E6(a2a, a3, v7, pTexture, (signed __int64)v19, 0, 255);
+            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
             ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
             pPlayer = pPlayer2;
             //goto LABEL_34;
-            ++v27;
+            ++uCellID;
             v26 += 4;
-            break;
+            continue;
           }
           if ( (unsigned __int8)(v16 & 0xF0) == 64 )
           {
@@ -918,13 +936,13 @@
               ptr_50C9A4 = 0;
             }
             v19 = (double)GetTickCount() * 0.1;
-            pRenderer->_4A63E6(a2a, a3, v7, pTexture, (signed __int64)v19, 0, 255);
+            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
             ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
             pPlayer = pPlayer2;
             //goto LABEL_34;
-            ++v27;
+            ++uCellID;
             v26 += 4;
-            break;
+            continue;
           }
           if ( (unsigned __int8)(v16 & 0xF0) == 128 )
           {
@@ -938,13 +956,13 @@
               ptr_50C9A4 = 0;
             }
             v19 = (double)GetTickCount() * 0.1;
-            pRenderer->_4A63E6(a2a, a3, v7, pTexture, (signed __int64)v19, 0, 255);
+            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
             ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
             pPlayer = pPlayer2;
             //goto LABEL_34;
-            ++v27;
+            ++uCellID;
             v26 += 4;
-            break;
+            continue;
           }
         }
         v20 = "sptext01";
@@ -957,16 +975,16 @@
           ptr_50C9A4 = 0;
         }
         v19 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(a2a, a3, v7, pTexture, (signed __int64)v19, 0, 255);
+        pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
         ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
         pPlayer = pPlayer2;
       }
     }
 //LABEL_34:
-    ++v27;
+    ++uCellID;
     v26 += 4;
   }
-  while ( v27 < 126 );
+  while ( uCellID < 126 );
 }
 // 4E28F8: using guessed type int pCurrentScreen;
 // 507958: using guessed type int uTextureID_507958;
--- a/mm7_5.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/mm7_5.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -13169,7 +13169,7 @@
       v6 = &byte_4E2430[12 * v1] + v4;
       sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
       v7 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      dword_506408[v12] = 72 * v7 + 7145548;
+      dword_506408[v12] = &pIcons_LOD->pTextures[v7];
       sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
       result = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
       dword_5063D8[v12] = result;
@@ -13197,8 +13197,8 @@
   v0 = 0;
   do
   {
-    dword_506404[v0]->Release();
-    dword_506434[v0]->Release();
+	dword_5063D8[11+v0]->Release();
+	dword_506408[11+v0]->Release();
     --v0;
   }
   while ( v0 >= -11 );
@@ -13237,15 +13237,15 @@
   do
   {
     (*v1)->Release();
-    v2 = (Texture *)*((int *)v0 - 1);
+    v2 = *(v0 - 1);
     *v1 = 0;
     v2->Release();
-    v3 = *(Texture **)v0;
-    *((int *)v0 - 1) = 0;
+    v3 = *v0;
+    *(v0 - 1) = 0;
     v3->Release();
-    *(int *)v0 = 0;
+    *v0 = 0;
     ++v1;
-    v0 += 8;
+    v0 += 2;
   }
   while ( (signed int)v1 < (signed int)&pTextures_5064A0[9] );
   pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0);
@@ -13316,8 +13316,10 @@
   unsigned int v20; // [sp-8h] [bp-28h]@15
   Texture *v21; // [sp-4h] [bp-24h]@15
   signed int v22; // [sp-4h] [bp-24h]@22
-  int v23[2]; // [sp+10h] [bp-10h]@5
+  Texture *v23; // [sp+10h] [bp-10h]@5
   POINT a2; // [sp+18h] [bp-8h]@13
+  POINT v24;
+  int v25;
 
   sub_412AF9();
   v0 = pPlayers[uActiveCharacter];
@@ -13338,11 +13340,11 @@
           if ( dword_50654C == v4 )
           {
             v6 = dword_5063D8[v4];
-            v23[0] = (int)dword_5063D8[v4];
+            v23 = dword_5063D8[v4];
           }
           else
           {
-            v23[0] = dword_506408[v4];
+            v23 = dword_506408[v4];
             v6 = v5;
           }
           if ( v6->pLevelOfDetail0 )
@@ -13355,7 +13357,7 @@
             else
               pRenderer->DrawTextureIndexed(v17, v19, v6);
             v8 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v4));
-            pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], (Texture *)v23[0], v4);
+            pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], v23, v4);
           }
         }
       }
@@ -13364,7 +13366,7 @@
     while ( v4 + v1 - 1 < v1 + 11 );
   }
   v9 = pMouse->GetCursorPos(&a2);
-  v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)v23)->y]] & 0xFFFF;
+  v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
   if ( v10 )
   {
     v11 = dword_5063D8[v10];
@@ -13384,7 +13386,7 @@
   a2.x = (LONG)&v0->pActiveSkills[12];
   v14 = (unsigned int)&v0->pActiveSkills[12];
   v15 = (unsigned int)&v0->pActiveSkills[12];
-  v23[0] = 0;
+  v25 = 0;
   do
   {
     if ( *(short *)a2.x )
@@ -13478,11 +13480,11 @@
         }
       }
       pRenderer->DrawTextureTransparent(v14, v15, v16);
-      v13 = v23[0];
+      v13 = v25;
     }
     a2.x += 2;
     ++v13;
-    v23[0] = v13;
+    v25 = v13;
   }
   while ( v13 < 9 );
 }
@@ -17836,7 +17838,7 @@
   a5 = pGUIWindow_CurrentMenu->uNumControls;
   v18 = &pParty->pPlayers[v0-1];	  //&stru_AA1058[3].pSounds[6972 * v0 + 40552];
   v2 = pFontLucida;
-  v14 = dword_4E2A2C;
+  v14 = pWeaponSkills;
   v3 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
   do
   {
@@ -17851,10 +17853,10 @@
     }
     ++v14;
   }
-  while ( v14 <= &dword_4E2A2C[8] );
+  while ( v14 <= &pWeaponSkills[8] );
   if ( !v12 )
     v3 = v3 + LOBYTE(v2->uFontHeight) - 3;
-  v15 = _4E2A80_skills;
+  v15 = pMagicSkills;
   v5 = v3 + 2 * LOBYTE(v2->uFontHeight) - 6;
   do
   {
@@ -17868,7 +17870,7 @@
     }
     ++v15;
   }
-  while ( v15 <= &_4E2A80_skills[8] );
+  while ( v15 <= &pMagicSkills[8] );
   v13 = 0;
   v16 = pArmorSkills;
   v7 = 2 * LOBYTE(v2->uFontHeight) + 13;
@@ -17888,7 +17890,7 @@
   while ( v16 <= &pArmorSkills[4] );
   if ( !v13 )
     v7 = v7 + LOBYTE(v2->uFontHeight) - 3;
-  v17 = dword_4E2A50;
+  v17 = pMiscSkills;
   v9 = v7 + 2 * LOBYTE(v2->uFontHeight) - 6;
   do
   {
@@ -17902,7 +17904,7 @@
     }
     ++v17;
   }
-  while ( v17 <= &dword_4E2A50[11] );
+  while ( v17 <= &pMiscSkills[11] );
   if ( a2 )
     pGUIWindow_CurrentMenu->_41D08F(a2, 1, 0, a5);
 }
\ No newline at end of file
--- a/mm7_data.cpp	Mon Jan 28 14:52:05 2013 +0600
+++ b/mm7_data.cpp	Mon Jan 28 14:52:18 2013 +0600
@@ -477,9 +477,9 @@
 __int16 RightClickPortraitXmax[4];
 void *off_4E2A12; // weak
 int pArmorSkills[5]={ 9, 10, 11, 8, 30};
-int dword_4E2A2C[9]={3, 5, 2, 6, 4, 0, 1, 31, 7};
-int dword_4E2A50[12]={35, 33, 24, 21, 32, 36, 29, 25, 22, 26, 23, 34};
-int _4E2A80_skills[9]={12, 13, 14, 15, 16, 17, 18, 19, 20};
+int pWeaponSkills[9]={3, 5, 2, 6, 4, 0, 1, 31, 7};
+int pMiscSkills[12]={35, 33, 24, 21, 32, 36, 29, 25, 22, 26, 23, 34};
+int pMagicSkills[9]={12, 13, 14, 15, 16, 17, 18, 19, 20};
 unsigned __int8 pAwardsTextColors[20];
 unsigned int pHealthBarPos[4] = {22, 137, 251, 366};
 unsigned int pManaBarPos[4] = {102, 217, 331, 447};
@@ -1278,8 +1278,8 @@
 __int64 qword_506350; // weak
 char byte_506360; // weak
 int dword_506364; // weak
-int dword_506408[777]; // weak
-int dword_50640C[777]; // weak
+Texture *dword_506404[12]; // weak
+Texture *dword_50640C[12]; // weak
 unsigned int uTextureID_506438;
 int dword_50651C; // weak
 int dword_506520; // weak
--- a/mm7_data.h	Mon Jan 28 14:52:05 2013 +0600
+++ b/mm7_data.h	Mon Jan 28 14:52:18 2013 +0600
@@ -465,9 +465,9 @@
 extern __int16 RightClickPortraitXmax[4];
 extern void *off_4E2A12; // weak
 extern int pArmorSkills[5];
-extern int dword_4E2A2C[9];
-extern int dword_4E2A50[12];
-extern int _4E2A80_skills[9];
+extern int pWeaponSkills[9];
+extern int pMiscSkills[12];
+extern int pMagicSkills[9];
 extern unsigned __int8 pAwardsTextColors[20];
 extern unsigned int pHealthBarPos[4];
 extern unsigned int pManaBarPos[4];
@@ -1154,8 +1154,8 @@
 extern __int64 qword_506350; // weak
 extern char byte_506360; // weak
 extern int dword_506364; // weak
-extern int dword_506408[]; // weak
-extern int dword_50640C[]; // weak
+extern Texture *dword_506408[]; // weak
+extern Texture *dword_50640C[]; // weak
 extern unsigned int uTextureID_506438;
 extern int dword_50651C; // weak
 extern int dword_506520; // weak