changeset 156:6386d105011a

Слияние
author Ritor1
date Thu, 29 Nov 2012 22:00:58 +0600
parents 2cc68f234b29 (current diff) 60bb9d93c097 (diff)
children 9130272cdd48
files Party.cpp
diffstat 3 files changed, 212 insertions(+), 597 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.h	Tue Nov 27 23:07:29 2012 +0600
+++ b/AudioPlayer.h	Thu Nov 29 22:00:58 2012 +0600
@@ -108,6 +108,21 @@
     bPlayerReady(false), b3DSoundInitialized(false),
     hAILRedbook(nullptr), hStream(nullptr)
   {
+	/*AudioPlayer_3DSample *v0; //ecx@1
+	signed int v1; //edi@1
+
+	v0 = p3DSamples;
+	v1 = 32;
+	do
+	{
+		v0->field_4 = 0;
+		v0->field_8 = 0;
+		v0->field_C = 0;
+		v0->hSample = 0;
+		++v0;
+		--v1;
+	}
+	while (v1);*/
     uMixerChannels = 16;
     field_2D0_time_left = 256;
     uNumRedbookTracks = 0;
--- a/Party.cpp	Tue Nov 27 23:07:29 2012 +0600
+++ b/Party.cpp	Thu Nov 29 22:00:58 2012 +0600
@@ -377,7 +377,7 @@
     uSpellBookPageCount = 0;
     //pMagicSkills = pPlayers[uNumPlayers].pActiveSkills[12];// Skills
     //while ( !*(short *)pMagicSkills )         //player[i].skillFire
-	for (int i = 0; i < 9; i++)
+	for (int i = 0; i < 9; i++)//for Magic Book
     {
       //++uSpellBookPageCount;
       //pMagicSkills++;
--- a/mm7_4.cpp	Tue Nov 27 23:07:29 2012 +0600
+++ b/mm7_4.cpp	Thu Nov 29 22:00:58 2012 +0600
@@ -5276,7 +5276,7 @@
 void __cdecl PlayerCreationUI_Draw()
 {
   const char *uTitleText; // ST10_4@3
-  int v2; // eax@3
+  int pTextCenter; // eax@3
   IconFrame *v3; // eax@3
   int v4; // ecx@7
   GUIButton *uPosActiveItem; // edi@12
@@ -5295,8 +5295,6 @@
   enum CHARACTER_RACE uNumRace; // eax@35
   int v19; // eax@36
   int v20; // eax@37
-  int v21; // ST0C_4@44
-  int v22; // eax@44
   int uNumMight; // eax@44
   unsigned int v24; // eax@44
   int v25; // eax@44
@@ -5312,64 +5310,41 @@
   int v35; // eax@44
   unsigned int v36; // eax@44
   enum PLAYER_SKILL_TYPE v37; // eax@44
-  int v38; // eax@44
   enum PLAYER_SKILL_TYPE v39; // eax@44
-  int v40; // eax@44
   enum PLAYER_SKILL_TYPE v41; // eax@44
   const char *v42; // edx@44
   char *v43; // ST1C_4@44
-  int v44; // eax@44
   int v45; // eax@44
   enum PLAYER_SKILL_TYPE v46; // eax@46
   const char *v47; // edx@46
   char *v48; // ST1C_4@46
-  int v49; // eax@46
   int v50; // eax@46
   int v51; // eax@49
   char *v52; // edi@52
   char v53; // al@52
   int uClassType; // edi@53
   int v55; // ST0C_4@53
-  int v56; // eax@53
   int v57; // eax@53
-  int v60; // eax@55
   int v61; // ecx@55
   int v64; // ST08_4@57
-  int v65; // eax@57
   int v66; // ecx@57
-  int v69; // ST08_4@59
-  int v70; // eax@59
   int v71; // eax@59
-  int v74; // eax@61
   int v75; // eax@61
-  int v78; // ST08_4@63
-  int v79; // eax@63
   int v80; // eax@63
-  int v83; // ST08_4@65
-  int v84; // eax@65
   int v85; // eax@65
-  int v88; // eax@67
   int v89; // eax@67
-  int v92; // ST08_4@69
-  int v93; // eax@69
   int v94; // eax@69
-  int v97; // ST08_4@71
-  int v98; // eax@71
-  int v101; // eax@71
-  enum PLAYER_SKILL_TYPE v102; // edi@72
-  size_t v103; // eax@72
+  enum PLAYER_SKILL_TYPE pSkillId; // edi@72
+  size_t pLenText; // eax@72
   signed int v104; // ecx@72
-  int v105; // ecx@79
+  int pColorText; // ecx@79
   unsigned int v107; // ST0C_4@81
   int pTextY; // ST08_4@81
-  int v109; // eax@81
   int v111; // ST0C_4@82
-  int v112; // eax@82
   signed int v113; // edi@82
   int v114; // ST0C_4@82
-  int v115; // eax@82
   const char *uRaceName; // [sp+0h] [bp-170h]@39
-  char Str1[200]; // [sp+10h] [bp-160h]@14
+  char pText[200]; // [sp+10h] [bp-160h]@14
   GUIWindow pWindow; // [sp+D8h] [bp-98h]@83
   int v119; // [sp+12Ch] [bp-44h]@18
   size_t v120; // [sp+130h] [bp-40h]@25
@@ -5386,7 +5361,7 @@
   int uColorWhite; // [sp+15Ch] [bp-14h]@1
   int uX; // [sp+160h] [bp-10h]@18
   unsigned int v133; // [sp+164h] [bp-Ch]@25
-  int v134; // [sp+168h] [bp-8h]@14
+  int pOrder; // [sp+168h] [bp-8h]@14
   char *Str; // [sp+16Ch] [bp-4h]@18
   Player *pPlayer;
   const char *pSkillName;
@@ -5397,34 +5372,32 @@
   uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   pRenderer->BeginScene();
   pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
-
   uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20;
   pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY);
   pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - 640, 2, pTexture_MAKESKY);
   //if (uPlayerCreationUI_SkySliderPos > 640)
     //uPlayerCreationUI_SkySliderPos = 0;
   pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP);
-
   uTitleText = pGlobalTXT_LocalizationStrings[51];
   uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7;
-  v2 = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCChar, v2 + 1, 0, 0, uTitleText, 0, 0, 0);
-  pRenderer->DrawTextureTransparent(17u, 35u, pPlayerPortraits[pParty->pPlayers[0].uFace]);
-  pRenderer->DrawTextureTransparent(176u, 35u, pPlayerPortraits[pParty->pPlayers[1].uFace]);
-  pRenderer->DrawTextureTransparent(335u, 35u, pPlayerPortraits[pParty->pPlayers[2].uFace]);
-  pRenderer->DrawTextureTransparent(494u, 35u, pPlayerPortraits[pParty->pPlayers[3].uFace]);
+  pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, uTitleText, 0, 0, 0);
+  pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uFace]);
+  pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uFace]);
+  pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uFace]);
+  pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uFace]);
   v3 = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime);
   if ( uPlayerCreationUI_SelectedCharacter )
   {
     switch ( uPlayerCreationUI_SelectedCharacter )
     {
-      case 1u:
+      case 1:
         v4 = 171;
         break;
-      case 2u:
+      case 2:
         v4 = 329;
         break;
-      case 3u:
+      case 3:
         v4 = 488;
         break;
       default:
@@ -5439,57 +5412,44 @@
 
   pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]);
   uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
-
   uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25;
   pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]);
   pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]);
   //if (uPlayerCreationUI_ArrowAnim < 0)
   //  uPlayerCreationUI_ArrowAnim = 18;
-
   v6 = pFontCreate->uFontHeight - 2;
   v128 = pFontCreate->uFontHeight - 2;
-  strcpy(Str1, pGlobalTXT_LocalizationStrings[205]);// "Skills"
-  uNumLet = strlen(Str1) - 1;
-  v134 = uNumLet;
+  strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills"
+  uNumLet = strlen(pText) - 1;
+  pOrder = uNumLet;
   if ( uNumLet >= 0 )
   {
     while ( 1 )
     {
-      v8 = toupper((unsigned __int8)Str1[uNumLet]);
-      v9 = v134;
-      v10 = v134-- - 1 < 0;
-      Str1[v9] = v8;
+      v8 = toupper((unsigned __int8)pText[uNumLet]);
+      v9 = pOrder;
+      v10 = pOrder-- - 1 < 0;
+      pText[v9] = v8;
       if ( v10 )
         break;
-      uNumLet = v134;
-    }
-  }
-  v134 = 18;
+      uNumLet = pOrder;
+    }
+  }
+  pOrder = 18;
   v124 = 0;
   uX = 32;
   uY = 3 * v6 + 169;
   v122 = 5 * v6 + 169;
   v123 = 3 * v6 + 311;
   v129 = 493;
-  pPlayer = pParty->pPlayers;
+  //pPlayer = pParty->pPlayers;
   v119 = 6 * v6 + 169;
-  do
+  //do
+  for ( pPlayer = pParty->pPlayers; (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges; pPlayer++)
   {
     Str = pPlayer->pName;
-
-    pGUIWindow_CurrentMenu->DrawText(
-      pFontCreate,
-      v134 + 73,
-      100,
-      0,
-      pClassNames[(unsigned __int8)pPlayer->uClass],
-      0,
-      0,
-      0);
-    pRenderer->DrawTextureTransparent(
-      v134 + 77,
-      50u,
-      pTexture_IC_KNIGHT[pPlayer->uClass/4]);
+	pGUIWindow_CurrentMenu->DrawText(pFontCreate, pOrder + 73, 100, 0, pClassNames[(unsigned __int8)pPlayer->uClass], 0, 0, 0);
+    pRenderer->DrawTextureTransparent(pOrder + 77, 50u, pTexture_IC_KNIGHT[pPlayer->uClass/4]);
     v11 = pGUIWindow_CurrentMenu->field_40;
     if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) )
     {
@@ -5501,9 +5461,8 @@
         {
           if ( v14 == 1 )
           {
-            v15 = Str;
             pGUIWindow_CurrentMenu->field_40 = 0;
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 124u, 0, v15, 130, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 124, 0, Str, 130, 0);
             SetCurrentMenuID(MENU_7);
           }
         }
@@ -5513,7 +5472,7 @@
           v120 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
           v126 = 0;
           v133 = 0;
-          if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )
+          if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )//edit name
           {
             do
             {
@@ -5526,29 +5485,19 @@
           }
           if ( v120 && v126 != v120 )
             strcpy(Str, (const char *)pKeyActionMap->pPressedKeysBuffer);
-          pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 0x7Cu, 0, Str, 130, 0);
+          pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7Cu, 0, Str, 130, 0);
           *((short *)pPlayer->pName + 3323) = 1;
         }
       }
       else
       {
-        v17 = pGUIWindow_CurrentMenu->DrawTextInRect(
-                pFontCreate,
-                159 * (int)v12 + 18,
-                0x7Cu,
-                0,
-                (const char *)pKeyActionMap->pPressedKeysBuffer,
-                120,
-                1);
-        pGUIWindow_CurrentMenu->DrawFlashingInputCursor(
-          159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20,
-          124,
-          pFontCreate);
+        v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)v12 + 18, 0x7Cu, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1);
+        pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate);
       }
     }
     else
     {
-      pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 0x7Cu, 0, pPlayer->pName, 130, 0);
+      pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, pPlayer->pName, 130, 0);
     }
     uNumRace = pPlayer->GetRace();
      switch (uNumRace)
@@ -5559,201 +5508,175 @@
 	  case 3:  uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf"   
     }; 
 	strcpy(pTmpBuf, uRaceName);
-    pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134 + 72, v128 + 12, 0, pTmpBuf, 130, 0);
-    v21 = uColor1;
-    v22 = pFontCreate->AlignText_Center(0x96u, Str1);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, v22 + uX - 24, 291, v21, Str1, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder + 72, v128 + 12, 0, pTmpBuf, 130, 0);
+    pTextCenter = pFontCreate->AlignText_Center(0x96, pText);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, uColor1, pText, 0, 0, 0);
     uNumMight = pPlayer->GetActualMight();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], v129, uNumMight);// "Might"
     LOWORD(v24) = pPlayer->GetStatColor(0);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, v24, pTmpBuf, 0, 0, 0);
     v25 = pPlayer->GetActualIntelligence();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], v129, v25);// "Intellect"
-    LOWORD(v26) = pPlayer->GetStatColor(1u);
+    LOWORD(v26) = pPlayer->GetStatColor(1);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v128 + 169, v26, pTmpBuf, 0, 0, 0);
     v27 = pPlayer->GetActualWillpower();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], v129, v27);// "Personality"
-    LOWORD(v28) = pPlayer->GetStatColor(2u);
+    LOWORD(v28) = pPlayer->GetStatColor(2);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * v128 + 169, v28, pTmpBuf, 0, 0, 0);
     v29 = pPlayer->GetActualEndurance();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], v129, v29);// "Endurance"
-    LOWORD(v30) = pPlayer->GetStatColor(3u);
+    LOWORD(v30) = pPlayer->GetStatColor(3);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, uY, v30, pTmpBuf, 0, 0, 0);
     v31 = pPlayer->GetActualAccuracy();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], v129, v31);// "Accuracy"
-    LOWORD(v32) = pPlayer->GetStatColor(4u);
+    LOWORD(v32) = pPlayer->GetStatColor(4);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * v128 + 169, v32, pTmpBuf, 0, 0, 0);
     v33 = pPlayer->GetActualSpeed();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], v129, v33);// "Speed"
-    LOWORD(v34) = pPlayer->GetStatColor(5u);
+    LOWORD(v34) = pPlayer->GetStatColor(5);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v122, v34, pTmpBuf, 0, 0, 0);
     v35 = pPlayer->GetActualLuck();
     sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], v129, v35);// "Luck"
     LOWORD(v36) = pPlayer->GetStatColor(6u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v119, v36, pTmpBuf, 0, 0, 0);
     v37 = pPlayer->GetSkillIdxByOrder(0);
-	pSkillName = pSkillNames[v37];
-    v38 = pFontCreate->AlignText_Center(0x96u, pSkillName);
-    sprintf(pTmpBuf, "\t%03u%s", v38, pSkillName);
+    pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v37]);
+    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v37]);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0);
     v39 = pPlayer->GetSkillIdxByOrder(1);
-	pSkillName = pSkillNames[v39];
-    v40 = pFontCreate->AlignText_Center(0x96u, pSkillName);
-    sprintf(pTmpBuf, "\t%03u%s", v40, pSkillName);
+    pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v39]);
+    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v39]);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v128 + 311, uColorWhite, pTmpBuf, 0, 0, 0);
     v41 = pPlayer->GetSkillIdxByOrder(2);
-    v42 = pSkillNames[v41];
-    v43 = pSkillNames[v41];
-    v133 = v41;
-    v44 = pFontCreate->AlignText_Center(150u, v42);
-    sprintf(pTmpBuf, "\t%03u%s", v44, v43);
+    pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v41]);
+    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v41]);
     v45 = uColorGreen;
-    if ( (signed int)v133 >= 37 )
+    if ( (signed int)v41 >= 37 )
       v45 = uColorTeal;
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * v128 + 311, v45, pTmpBuf, 0, 0, 0);
     v46 = pPlayer->GetSkillIdxByOrder(3);
-    v47 = pSkillNames[v46];
-    v48 = pSkillNames[v46];
-    v133 = v46;
-    v49 = pFontCreate->AlignText_Center(150u, v47);
-    sprintf(pTmpBuf, "\t%03u%s", v49, v48);
+    pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v46]);
+    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v46]);
     v50 = uColorGreen;
-    if ( (signed int)v133 >= 37 )
+    if ( (signed int)v46 >= 37 )
       v50 = uColorTeal;
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v123, v50, pTmpBuf, 0, 0, 0);
-    pPlayer++;
+    //pPlayer++;
     v124 = (char *)v124 + 1;
-    v134 += 159;
+    pOrder += 159;
     v129 -= 158;
     uX += 158;
   }
-  while ( (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges );
-  strcpy(Str1, pGlobalTXT_LocalizationStrings[41]);// "Class"
-  v51 = strlen(Str1) - 1;
-  v134 = v51;
+  //while ( (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges );
+  strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class"
+  v51 = strlen(pText) - 1;
+  pOrder = v51;
   if ( v51 >= 0 )
   {
     while ( 1 )
     {
-      v52 = &Str1[v51];
-      v53 = toupper((unsigned __int8)Str1[v51]);
-      v10 = v134-- - 1 < 0;
+      v52 = &pText[v51];
+      v53 = toupper((unsigned __int8)pText[v51]);
+      v10 = pOrder-- - 1 < 0;
       *v52 = v53;
       if ( v10 )
         break;
-      v51 = v134;
+      v51 = pOrder;
     }
   }
   uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].uClass;
-  v55 = uColor1;
-  v56 = pFontCreate->AlignText_Center(193u, Str1);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v56 + 324, 395, v55, Str1, 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(193u, pText);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, uColor1, pText, 0, 0, 0);
   v57 = uColorTeal;
   if ( uClassType )
     v57 = uColorWhite;
-  v60 = pFontCreate->AlignText_Center(65u, pClassNames[0]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v60 + 323, 417, v57, pClassNames[0], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, v57, pClassNames[0], 0, 0, 0);
   v61 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_PALADIN )
     v61 = uColorWhite;
-  v64 = v128 + 417;
   uColorGreen = v128 + 417;
-  v65 = pFontCreate->AlignText_Center(65u, pClassNames[12]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v65 + 323, v64, v61, pClassNames[12], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, v128 + 417, v61, pClassNames[12], 0, 0, 0);
   v66 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_DRUID )
     v66 = uColorWhite;
-  v69 = 2 * v128 + 417;
-  v126 = 2 * v128 + 417;
-  v70 = pFontCreate->AlignText_Center(65u, pClassNames[20]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v70 + 323, v69, v66, pClassNames[20], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * v128 + 417, v66, pClassNames[20], 0, 0, 0);
   v71 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_CLERIC )
     v71 = uColorWhite;
-  v74 = pFontCreate->AlignText_Center(65u, pClassNames[24]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v74 + 388, 417, v71, pClassNames[24], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, v71, pClassNames[24], 0, 0, 0);
   v75 = uColorTeal;
   if ( uClassType != 28 )
     v75 = uColorWhite;
-  v78 = uColorGreen;
-  v79 = pFontCreate->AlignText_Center(65u, pClassNames[28]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v79 + 388, v78, v75, pClassNames[28], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, uColorGreen, v75, pClassNames[28], 0, 0, 0);
   v80 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_SORCERER )
     v80 = uColorWhite;
-  v83 = v126;
-  v84 = pFontCreate->AlignText_Center(65u, pClassNames[32]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v84 + 388, v83, v80, pClassNames[32], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * v128 + 417, v80, pClassNames[32], 0, 0, 0);
   v85 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_SHOOTER )
     v85 = uColorWhite;
-  v88 = pFontCreate->AlignText_Center(65u, pClassNames[16]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v88 + 453, 417, v85, pClassNames[16], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, v85, pClassNames[16], 0, 0, 0);
   v89 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_MONK )
     v89 = uColorWhite;
-  v92 = uColorGreen;
-  v93 = pFontCreate->AlignText_Center(65u, pClassNames[8]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v93 + 453, v92, v89, pClassNames[8], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, uColorGreen, v89, pClassNames[8], 0, 0, 0);
   v94 = uColorTeal;
   if ( uClassType != PLAYER_CLASS_THEIF )
     v94 = uColorWhite;
-  v97 = v126;
-  v98 = pFontCreate->AlignText_Center(65u, pClassNames[4]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v98 + 453, v97, v94, pClassNames[4], 0, 0, 0);
-  v101 = pFontCreate->AlignText_Center(0xECu, pGlobalTXT_LocalizationStrings[20]); // "Available Skills"
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v101 + 37, 395, uColor1, pGlobalTXT_LocalizationStrings[20], 0, 0, 0);
-  v134 = 0;
-  do
-  {
-    v102 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(v134 + 4);
-    strcpy(Str1, pSkillNames[v102]);
-    v103 = strlen(Str1);
+  pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * v128 + 417, v94, pClassNames[4], 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(0xECu, pGlobalTXT_LocalizationStrings[20]); // "Available Skills"
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, uColor1, pGlobalTXT_LocalizationStrings[20], 0, 0, 0);
+  //pOrder = 0;
+  //do
+  for (pOrder = 0; pOrder < 9; ++pOrder)
+  {
+    pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pOrder + 4);
+    strcpy(pText, pSkillNames[pSkillId]);
+    pLenText = strlen(pText);
     v104 = 0;
-    if ( (signed int)v103 > 0 )
-    {
-	  if ( Str1[v104] == 32 )
+    if ( (signed int)pLenText > 0 )
+    {
+	  if ( pText[v104] == 32 )
 	  {
-		Str1[v104] = 0;
+		pText[v104] = 0;
 	  }
 	  else
 	  {
-		while ( Str1[v104] != 32 )
+		//while ( pText[v104] != 32 )
+		for (v104 = 0; v104 < (signed int)pLenText || pText[v104] != 32; ++v104)
 		{
-		  ++v104;
-		  if ( v104 >= (signed int)v103 )
-		   break;
+		  //++v104;
+		  //if ( v104 >= (signed int)v103 )
+		   //break;
 		}
 	  }
     }
     uColorGreen = -5;
-    if ( (signed int)v124 <= 3 )
+    if ( (signed int)v124 > 2 )
       uColorGreen = 0;
-    v105 = uColorTeal;
-    if ( !pParty->pPlayers[0].pActiveSkills[v102 + 3486 * uPlayerCreationUI_SelectedCharacter] )
-      v105 = uColorWhite;
-    v107 = v105;
-	v109 = pFontCreate->AlignText_Center(100u, Str1);
-    pGUIWindow_CurrentMenu->DrawText(
-      pFontCreate,
-      100 * (v134 / 3) + v109 + uColorGreen + 17,
-      v128 * (v134 % 3) + 417,
-      v107,
-      Str1,
-      0,
-      0,
-      0);
-    ++v134;
-  }
-  while ( v134 < 9 );
-  v111 = uColor1;
-  v112 = pFontCreate->AlignText_Center(0x5Cu, pGlobalTXT_LocalizationStrings[30]);// "Bonus"
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v112 + 533, 394, v111, pGlobalTXT_LocalizationStrings[30], 0, 0, 0);
+    pColorText = uColorTeal;
+    if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] )
+      pColorText = uColorWhite;
+	pTextCenter = pFontCreate->AlignText_Center(100, pText);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (pOrder / 3) + pTextCenter + uColorGreen + 17, v128 * (pOrder % 3) + 417, pColorText, pText, 0, 0, 0);
+    //++pOrder;
+  }
+  //while ( pOrder < 9 );
+  pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus"
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0);
   v113 = PlayerCreation_ComputeAttributeBonus();
   sprintf(pTmpBuf, "%d", v113);
-  v114 = uColorWhite;
-  v115 = pFontCreate->AlignText_Center(84u, pTmpBuf);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, v115 + 530, 410, v114, pTmpBuf, 0, 0, 0);
+  pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf);
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf, 0, 0, 0);
   if ( GameUI_StatusBar_TimedStringTimeLeft > GetTickCount() )
   {
     pWindow.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
@@ -5791,7 +5714,7 @@
 
   if ( pMessageQueue_50CBD0->uNumMessages )
     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-  pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+  pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));// ??
   ++pIcons_LOD->uTexturePacksCount;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
@@ -5812,7 +5735,7 @@
   pTexture_MAKETOP   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("MAKETOP", TEXTURE_16BIT_PALETTE)];
   uX = 0;
   pTexture_MAKESKY = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("MAKESKY", TEXTURE_16BIT_PALETTE)];
-  do
+  do // load PlayerPortraits texture
   {
     sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]);
     v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
@@ -5847,231 +5770,30 @@
     ++uControlParama;
   }
   while ( (signed int)uXa < 640 );
-  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10u, 32u, 11u, 13u, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169u, 32u, 11u, 13u, 1, 0, 0xABu, 1u, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(
-                                  327u,
-                                  32u,
-                                  11u,
-                                  13u,
-                                  1,
-                                  0,
-                                  0xABu,
-                                  2u,
-                                  0,
-                                  "",
-                                  pTexture_presleft,
-                                  0);
-  pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(
-                                  486u,
-                                  32u,
-                                  11u,
-                                  13u,
-                                  1,
-                                  0,
-                                  0xABu,
-                                  3u,
-                                  0,
-                                  "",
-                                  pTexture_presleft,
-                                  0);
-  pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(
-                                   74u,
-                                   32u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0xACu,
-                                   0,
-                                   0,
-                                   "",
-                                   pTexture_pressrigh,
-                                   0);
-  pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(
-                                   233u,
-                                   32u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0xACu,
-                                   1u,
-                                   0,
-                                   "",
-                                   pTexture_pressrigh,
-                                   0);
-  pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(
-                                   391u,
-                                   32u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0xACu,
-                                   2u,
-                                   0,
-                                   "",
-                                   pTexture_pressrigh,
-                                   0);
-  pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(
-                                   549u,
-                                   32u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0xACu,
-                                   3u,
-                                   0,
-                                   "",
-                                   pTexture_pressrigh,
-                                   0);
-  pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(
-                                   10u,
-                                   103u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0x90u,
-                                   0,
-                                   0,
-                                   "",
-                                   pTexture_presleft,
-                                   0);
-  pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(
-                                   169u,
-                                   103u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0x90u,
-                                   1u,
-                                   0,
-                                   "",
-                                   pTexture_presleft,
-                                   0);
-  pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(
-                                   327u,
-                                   103u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0x90u,
-                                   2u,
-                                   0,
-                                   "",
-                                   pTexture_presleft,
-                                   0);
-  pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(
-                                   486u,
-                                   103u,
-                                   11u,
-                                   13u,
-                                   1,
-                                   0,
-                                   0x90u,
-                                   3u,
-                                   0,
-                                   "",
-                                   pTexture_presleft,
-                                   0);
-  pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(
-                                    74u,
-                                    103u,
-                                    11u,
-                                    13u,
-                                    1,
-                                    0,
-                                    0x91u,
-                                    0,
-                                    0,
-                                    "",
-                                    pTexture_pressrigh,
-                                    0);
-  pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(
-                                    233u,
-                                    103u,
-                                    11u,
-                                    13u,
-                                    1,
-                                    0,
-                                    0x91u,
-                                    1u,
-                                    0,
-                                    "",
-                                    pTexture_pressrigh,
-                                    0);
-  pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(
-                                    391u,
-                                    103u,
-                                    11u,
-                                    13u,
-                                    1,
-                                    0,
-                                    0x91u,
-                                    2u,
-                                    0,
-                                    "",
-                                    pTexture_pressrigh,
-                                    0);
-  pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(
-                                    549u,
-                                    103u,
-                                    11u,
-                                    13u,
-                                    1,
-                                    0,
-                                    0x91u,
-                                    3u,
-                                    0,
-                                    "",
-                                    pTexture_pressrigh,
-                                    0);
+  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10, 32, 11, 13, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, 0xABu, 1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, 0xABu, 2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, 0xABu, 3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(74, 32, 11, 13, 1, 0, 0xACu, 0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, 0xACu, 1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, 0xACu, 2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, 0xACu, 3, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(10, 103, 11, 13, 1, 0, 0x90u, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, 0x90u, 1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, 0x90u, 2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, 0x90u, 3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(74, 103, 11, 13, 1, 0, 0x91u, 0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, 0x91u, 1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, 0x91u, 2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, 0x91u, 3, 0, "", pTexture_pressrigh, 0);
   uControlParamb = 0;
   uXb = 8;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uXb, 308u, 150u, v0, 1, 0, 0x48u, uControlParamb, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXb,
-      v0 + 308,
-      150u,
-      v0,
-      1,
-      0,
-      0x49u,
-      uControlParamb,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXb,
-      2 * v0 + 308,
-      150u,
-      v0,
-      1,
-      0,
-      0x4Au,
-      uControlParamb,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXb,
-      3 * v0 + 308,
-      150u,
-      v0,
-      1,
-      0,
-      0x4Bu,
-      uControlParamb,
-      0,
-      "",
-      0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, 0x48u, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, 0x49u, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150u, v0, 1, 0, 0x4Au, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150u, v0, 1, 0, 0x4Bu, uControlParamb, 0, "", 0);
     uXb += 158;
     ++uControlParamb;
   }
@@ -6084,166 +5806,44 @@
   uControlParamc = 2;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 169u, 120u, 20u, 1, 0, 0, uControlParamc - 2, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc - 1,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      2 * v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      3 * v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc + 1,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      4 * v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc + 2,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      5 * v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc + 3,
-      0,
-      "",
-      0);
-    pGUIWindow_CurrentMenu->CreateButton(
-      uXc,
-      6 * v0 + 169,
-      120u,
-      20u,
-      1,
-      0,
-      0,
-      uControlParamc + 4,
-      0,
-      "",
-      0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, 0, uControlParamc - 2, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, 0, uControlParamc - 1, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 1, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 2, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 3, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 4, 0, "", 0);
     uControlParamc += 7;
     uXc += 158;
   }
   while ( (signed int)uControlParamc < 30 );
   pGUIWindow_CurrentMenu->_41D08F(28, 0, 7, 40);
-  pGUIWindow_CurrentMenu->CreateButton(323u, 417u, 65u, v0, 1, 0, 0x41u, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323u, v0 + 417, 65u, v0, 1, 0, 0x41u, 0xCu, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323u, 2 * v0 + 417, 65u, v0, 1, 0, 0x41u, 0x14u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388u, 417u, 65u, v0, 1, 0, 0x41u, 0x18u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388u, v0 + 417, 65u, v0, 1, 0, 0x41u, 0x1Cu, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388u, 2 * v0 + 417, 65u, v0, 1, 0, 0x41u, 0x20u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453u, 417u, 65u, v0, 1, 0, 0x41u, 0x10u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453u, v0 + 417, 65u, v0, 1, 0, 0x41u, 8u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453u, 2 * v0 + 417, 65u, v0, 1, 0, 0x41u, 4u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, 0x41, 0, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, 0x41, 0xC, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x14, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, 0x41, 0x18, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, 0x41, 0x1C, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x20, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, 0x41, 0x10, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, 0x41, 8, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 4, 0, "", 0);
   uControlParamd = 0;
   do
   {
     uXd = -5;
     if ( uControlParamd <= 3 )
       uXd = 0;
-    pGUIWindow_CurrentMenu->CreateButton(
-      100 * (uControlParamd / 3) + uXd + 17,
-      v0 * (uControlParamd % 3) + 417,
-      100u,
-      v0,
-      1,
-      0,
-      0x40u,
-      uControlParamd,
-      0,
-      "",
-      0);
+    pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, 0x40,
+      uControlParamd, 0, "", 0);
     ++uControlParamd;
   }
   while ( uControlParamd < 9 );
-  pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(
-                              580u,
-                              431u,
-                              51u,
-                              39u,
-                              1,
-                              0,
-                              0x42u,
-                              0,
-                              0xDu,
-                              "",
-                              (Texture *)(uTextureID_BUTTMAKE != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTMAKE] : 0),
-                              0);
-  pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(
-                                 527u,
-                                 431u,
-                                 51u,
-                                 39u,
-                                 1,
-                                 0,
-                                 0x43u,
-                                 0,
-                                 0x43u,
-                                 "",
-                                 (Texture *)(uTextureID_BUTTMAKE2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0),
-                                 0);
-  pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(
-                                 523u,
-                                 393u,
-                                 20u,
-                                 35u,
-                                 1,
-                                 0,
-                                 0x3Fu,
-                                 0,
-                                 0x2Du,
-                                 "",
-                                 pTexture_buttminu,
-                                 0);
-  pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(
-                                613u,
-                                393u,
-                                20u,
-                                35u,
-                                1,
-                                0,
-                                0x3Eu,
-                                1u,
-                                0x2Bu,
-                                "",
-                                pTexture_buttplus,
-                                0);
+  pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, 0x42, 0, 0xD, "",
+                              (Texture *)(uTextureID_BUTTMAKE != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTMAKE] : 0), 0);
+  pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, 0x43, 0, 0x43, "",
+                                 (Texture *)(uTextureID_BUTTMAKE2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0), 0);
+  pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, 0x3F, 0, 0x2D, "", pTexture_buttminu, 0);
+  pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, 0x3E, 1, 0x2B, "", pTexture_buttplus, 0);
   pFontCChar = LoadFont("cchar.fnt", "FONTPAL", 0);
 }
 // 4E28F8: using guessed type int pCurrentScreen;
@@ -6263,13 +5863,13 @@
   unsigned int v2; // ecx@3
   LONG uMouseX; // edi@6
   LONG uMouseY; // eax@6
-  GUIButton *v5; // edx@6
+  GUIButton *pControlsHead; // edx@6
   unsigned int v6; // ecx@7
   int v7; // esi@12
   signed int v8; // edi@30
   int v9; // edx@31
   char *v10; // ebx@37
-  int v11; // esi@38
+  Player *v11; // esi@38
   signed int v12; // ecx@40
   int v13; // eax@40
   signed int v14; // eax@45
@@ -6285,6 +5885,7 @@
   POINT v25; // [sp+6Ch] [bp-14h]@6
   bool v26; // [sp+74h] [bp-Ch]@1
   POINT v24; // [sp+78h] [bp-8h]@6
+  Player *pPlayer;
 
   v0 = &pTexture_PCX;
   v1 = 0;
@@ -6303,21 +5904,18 @@
       pAsyncMouse->_46B736_consume_click_lists(1);
     uMouseX = pMouse->GetCursorPos(&v24)->x;
     uMouseY = pMouse->GetCursorPos(&v25)->y;
-    v5 = pGUIWindow_CurrentMenu->pControlsHead;
-    if ( v5 != (GUIButton *)v1 )
+    pControlsHead = pGUIWindow_CurrentMenu->pControlsHead;
+    if ( pControlsHead != (GUIButton *)v1 )
     {
       v6 = pMessageQueue_50CBD0->uNumMessages;
       do
       {
-        if ( uMouseX >= (signed int)v5->uX //mouse movement
-          && uMouseX <= (signed int)v5->uZ
-          && uMouseY >= (signed int)v5->uY
-          && uMouseY <= (signed int)v5->uW )
-        {
-          v7 = v5->uControlParam;
+        if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
+        {
+          v7 = pControlsHead->uControlParam;
           if ( (signed int)v6 < 40 )
           {
-            pMessageQueue_50CBD0->pMessages[v6].eType = (UIMessageType)v5->field_1C;
+            pMessageQueue_50CBD0->pMessages[v6].eType = (UIMessageType)pControlsHead->field_1C;
             v0 = &pTexture_PCX;
             pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v7;
             *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
@@ -6326,9 +5924,9 @@
           }
           v1 = 0;
         }
-        v5 = v5->pNext;
-      }
-      while ( v5 != (GUIButton *)v1 );
+        pControlsHead = pControlsHead->pNext;
+      }
+      while ( pControlsHead != (GUIButton *)v1 );
     }
     while ( PeekMessageA(&Msg, (HWND)v1, v1, v1, PM_REMOVE) )
     {
@@ -6397,9 +5995,10 @@
   while ( (signed int)v1 < 32 );
   item.Reset();
   v10 = (char *)&pParty->pPlayers[0].sResMagicBase;
-  do
-  {
-    v11 = (int)(v10 - 6014);
+  //do
+  for ( pPlayer = &pParty->pPlayers[0];  (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2); pPlayer++)
+  {
+    v11 = pPlayer;
     if ( !*(v10 - 5829) )
       *(short *)v10 = 10;
     *((short *)v10 + 400) = 0;
@@ -6412,10 +6011,10 @@
       if ( v12 >= 9 )
         goto LABEL_45;
     }
-    *(char *)(v11 + 6734) = v12;
+    *(char *)(pPlayer->pNumSpellBookPage) = v12;
 LABEL_45:
     pItemsTable->GenerateItem(2, 40, &item);
-    ((Player *)(v10 - 6014))->AddItem2(0xFFFFFFFFu, &item);
+    pPlayer->AddItem2(0xFFFFFFFFu, &item);
     v14 = 0;
     v24.y = 0;
     do
@@ -6458,31 +6057,31 @@
             v18 = 76;
             goto LABEL_69;
           case 12:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x191u);
-            *(char *)(v11 + 402) = 1;
+            pPlayer->AddItem(0xFFFFFFFFu, 0x191u);
+            *(char *)(v11 + 402) = 1; // pFireSpellBook
             break;
           case 13:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x19Cu);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x19Cu);
             *(char *)(v11 + 413) = 1;
             break;
           case 14:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x1A7u);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x1A7u);
             *(char *)(v11 + 424) = 1;
             break;
           case 15:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x1B2u);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x1B2u);
             *(char *)(v11 + 435) = 1;
             break;
           case 16:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x1BDu);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x1BDu);
             *(char *)(v11 + 446) = 1;
             break;
           case 17:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x1C8u);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x1C8u);
             *(char *)(v11 + 457) = 1;
             break;
           case 18:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0x1D3u);
+            pPlayer->AddItem(0xFFFFFFFFu, 0x1D3u);
             *(char *)(v11 + 468) = 1;
             break;
           case 21:
@@ -6491,7 +6090,7 @@
           case 26:
           case 29:
           case 36:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, 0xDCu);
+            pPlayer->AddItem(0xFFFFFFFFu, 0xDCu);
             v18 = 5 * (rand() % 3 + 40);
             goto LABEL_69;
           case 30:
@@ -6500,12 +6099,12 @@
           case 31:
             v18 = 110;
 LABEL_69:
-            ((Player *)(v10 - 6014))->AddItem(0xFFFFFFFFu, v18);
+            pPlayer->AddItem(0xFFFFFFFFu, v18);
             break;
           default:
             break;
         }
-        v15 = v11 + 552;
+        v15 = (int)v11 + 552;
         v16 = 138;
         do
         {
@@ -6515,8 +6114,8 @@
           --v16;
         }
         while ( v16 );
-        *(int *)(v11 + 6460) = ((Player *)(v10 - 6014))->GetMaxHealth();
-        *(int *)(v11 + 6464) = ((Player *)(v10 - 6014))->GetMaxMana();
+        *(int *)(v11 + 6460) = pPlayer->GetMaxHealth();
+        *(int *)(v11 + 6464) = pPlayer->GetMaxMana();
         v14 = v24.y;
       }
       ++v14;
@@ -6524,8 +6123,9 @@
     }
     while ( v14 < 37 );
     v10 += 6972;
-  }
-  while ( (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2) );
+	//pPlayer++;
+  }
+  //while ( (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2) );
   pAudioPlayer->StopChannels(-1, -1);
   if (pAsyncMouse)
     pAsyncMouse->Suspend();