diff mm7_5.cpp @ 20:980c34defdab

Слияние
author Ritor1
date Thu, 17 Jan 2013 22:59:03 +0600
parents 2127707df23f d5954a85577a
children 5070f4343e0e
line wrap: on
line diff
--- a/mm7_5.cpp	Thu Jan 17 22:58:41 2013 +0600
+++ b/mm7_5.cpp	Thu Jan 17 22:59:03 2013 +0600
@@ -7006,8 +7006,8 @@
 {
   Player **ppPlayer; // esi@1
   Player *pPlayer; // ebx@1
-  enum CHARACTER_RACE v3; // edi@1
-  signed int v4; // eax@1
+  enum CHARACTER_RACE pRace; // edi@1
+  signed int pSex; // eax@1
   int v5; // edi@4
   unsigned int v6; // ecx@9
   int v7; // ecx@10
@@ -7242,7 +7242,7 @@
   int v236; // [sp+20h] [bp-2Ch]@260
   int v237; // [sp+20h] [bp-2Ch]@298
   int v238; // [sp+20h] [bp-2Ch]@336
-  int v239; // [sp+24h] [bp-28h]@6
+  int pBodyComplection; // [sp+24h] [bp-28h]@6
   int v240; // [sp+28h] [bp-24h]@7
   unsigned int v241; // [sp+2Ch] [bp-20h]@38
   int v242; // [sp+2Ch] [bp-20h]@197
@@ -7251,7 +7251,7 @@
   signed int v245; // [sp+34h] [bp-18h]@361
   unsigned int uPlayerID_; // [sp+38h] [bp-14h]@1
   int uPlayerID_a; // [sp+38h] [bp-14h]@9
-  signed int v248; // [sp+40h] [bp-Ch]@4
+  signed int IsDwarf; // [sp+40h] [bp-Ch]@4
   int v249; // [sp+40h] [bp-Ch]@358
   signed int v250; // [sp+44h] [bp-8h]@1
 
@@ -7260,36 +7260,33 @@
   uPlayerID_ = uPlayerID;
   v217 = *ppPlayer;
   pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
-  v3 = pPlayer->GetRace();
-  v4 = pPlayer->GetSexByVoice();
-  v250 = v4;
-  if ( v3 && v3 != 1 && v3 != 2 )
-  {
-    v248 = 1;
-    v5 = (v4 != 0) + 2;
-  }
-  else
-  {
-    v248 = 0;
-    v5 = v4 != 0;
-  }
-  v239 = v5;
+  pRace = pPlayer->GetRace();
+  pSex = pPlayer->GetSexByVoice();
+  v250 = pSex;
+  if ( pRace && pRace != 1 && pRace != 2 )
+  {
+    IsDwarf = 1;
+    v5 = (pSex != 0) + 2;
+  }
+  else
+  {
+    IsDwarf = 0;
+    v5 = pSex != 0;
+  }
+  pBodyComplection = v5;
   v244 = (*ppPlayer)->uFace;
   pRenderer->ResetClip();
-  pRenderer->DrawTextureIndexed(
-    0x1D3u,
-    0,
-    (Texture *)(uTextureID_BACKDOLL != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BACKDOLL] : 0));
+  pRenderer->DrawTextureIndexed(0x1D3u, 0, (Texture *)(uTextureID_BACKDOLL != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BACKDOLL] : 0));//
   if ( !IsPlayerWearingWatersuit[uPlayerID_] )
   {
-    v21 = pPlayer->pEquipment.uBow;
+    v21 = pPlayer->pEquipment.uBow; //  
     if ( !v21 )
       goto LABEL_59;
     v230 = pPlayer->pEquipment.uBow;
     v22 = (int)&v217->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v21 + 5];
     v23 = *(int *)v22;
-    v24 = papredoll_4E4C28 + array_4E4C30[v239].equip_x - pItemsTable->pItems[v23].uEquipX;
-    a3b = paperdoll_4E4C2C + array_4E4C30[v239].equip_y - pItemsTable->pItems[v23].uEquipY;
+    v24 = papredoll_4E4C28 + array_4E4C30[pBodyComplection].equip_x - pItemsTable->pItems[v23].uEquipX;
+    a3b = paperdoll_4E4C2C + array_4E4C30[pBodyComplection].equip_y - pItemsTable->pItems[v23].uEquipY;
     v241 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v23].pIconName, TEXTURE_16BIT_PALETTE);
     v25 = *(int *)(v22 + 20);
     if ( !(*(int *)(v22 + 20) & 0xF0) )
@@ -7318,7 +7315,7 @@
       if ( !bRingsShownInCharScreen )
         pRenderer->_4A612A(v24, a3b, v27, v230);
 LABEL_59:
-      v31 = v217->pEquipment.uCloak;
+      v31 = v217->pEquipment.uCloak;//  
       if ( !v31 )
         goto LABEL_93;
       v231 = v217->pEquipment.uCloak;
@@ -7345,7 +7342,7 @@
               if ( v33 < 0 || v33 >= 10 )
                 goto LABEL_93;
 LABEL_74:
-              v34 = v33 + 10 * v239;
+              v34 = v33 + 10 * pBodyComplection;
               v35 = paperdoll_array_511828[0][v34];
               a2c = papredoll_4E4C28 + paperdoll_array_4E5570[0][v34][0];// TODO indexing
               v36 = paperdoll_4E4C2C + paperdoll_array_4E5570[0][v34][1];
@@ -7368,11 +7365,9 @@
                   pRenderer->_4A612A(a2c, a3c, v42, v231);
 LABEL_93:
                 v240 = 4 * uPlayerID_ - 4;
-                pRenderer->DrawTextureTransparent(
-                  papredoll_4E4C28,
-                  paperdoll_4E4C2C,
+                pRenderer->DrawTextureTransparent(papredoll_4E4C28, paperdoll_4E4C2C,
                   (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0));
-                v43 = v217->pEquipment.uBody;
+                v43 = v217->pEquipment.uBody;//  
                 if ( !v43 )
                   goto LABEL_127;
                 v232 = v217->pEquipment.uBody;
@@ -7399,7 +7394,7 @@
                         if ( v45 < 0 || v45 >= 17 )
                           goto LABEL_127;
 LABEL_106:
-                        v46 = 17 * v239 + v45;
+                        v46 = 17 * pBodyComplection + v45;
                         a2d = papredoll_4E4C28 + paperdoll_array_4E4E30[0][v46][0];// TODO indexing
                         v47 = paperdoll_4E4C2C + paperdoll_array_4E4E30[0][v46][1];
                         v48 = paperdoll_array_511290[0][v46][0];
@@ -7440,17 +7435,17 @@
                           v58 = *(int *)v57;
                           if ( *(int *)v57 == 529 )
                           {
-                            a3e = paperdoll_4E4C2C + paredoll_array_4E54B8[v239][1];
-                            a2e = papredoll_4E4C28 + paredoll_array_4E54B8[v239][0];
+                            a3e = paperdoll_4E4C2C + paredoll_array_4E54B8[pBodyComplection][1];
+                            a2e = papredoll_4E4C28 + paredoll_array_4E54B8[pBodyComplection][0];
                             v59 = papredoll_flying_feet[v244];
                           }
                           else
                           {
                             if ( v58 == 512 )
                             {
-                              a3e = paperdoll_4E4C2C + paredoll_array_4E54B8[v239][3];
-                              a2e = papredoll_4E4C28 + paredoll_array_4E54B8[v239][2];
-                              v59 = dword_511638[v239][5];
+                              a3e = paperdoll_4E4C2C + paredoll_array_4E54B8[pBodyComplection][3];
+                              a2e = papredoll_4E4C28 + paredoll_array_4E54B8[pBodyComplection][2];
+                              v59 = dword_511638[pBodyComplection][5];
                             }
                             else
                             {
@@ -7459,14 +7454,14 @@
                               {
                                 a2e = 0;
                                 a3e = 0;
-                                v59 = dword_511638[v239][0];
+                                v59 = dword_511638[pBodyComplection][0];
                               }
                               else
                               {
-                                v61 = v60 + 7 * v239;
+                                v61 = v60 + 7 * pBodyComplection;
                                 a3e = paperdoll_4E4C2C + dword_4E5490[0][v61][1];
                                 a2e = papredoll_4E4C28 + dword_4E5490[0][v61][0];
-                                v59 = dword_511638[0][v60 + 6 * v239];
+                                v59 = dword_511638[0][v60 + 6 * pBodyComplection];
                               }
                             }
                           }
@@ -7498,14 +7493,12 @@
 LABEL_155:
                             v68 = v217;
                             v69 = v217->pEquipment.uMainHand;
-                            uPlayerID_a = 2 * v239;
-                            if ( !v69
-                              || (v70 = *(int *)&v217->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v69 + 5],
+                            uPlayerID_a = 2 * pBodyComplection;
+                            if ( !v69 || (v70 = *(int *)&v217->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v69 + 5],
                                   pItemsTable->pItems[v70].uEquipType != 1)
                               && (pItemsTable->pItems[v70].uSkillType != 4 || v217->pEquipment.uOffHand) )
-                              pRenderer->DrawTextureTransparent(
-                                papredoll_4E4C28 + dword_4E5AE0[2 * v239],
-                                paperdoll_4E4C2C + dword_4E5AE0[2 * v239 + 1],
+                              pRenderer->DrawTextureTransparent(papredoll_4E4C28 + dword_4E5AE0[2 * pBodyComplection],
+                                paperdoll_4E4C2C + dword_4E5AE0[2 * pBodyComplection + 1],
                                 (Texture *)(*(unsigned int *)((char *)papredoll_dlads + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlads + v240)] : 0));
                             v71 = v217->pEquipment.uBelt;
                             if ( v71 )
@@ -7529,13 +7522,13 @@
                               if ( v73 >= 0 && v73 < 7 )
                               {
 LABEL_168:
-                                v74 = 7 * v239 + v73;
+                                v74 = 7 * pBodyComplection + v73;
                                 a2f = papredoll_4E4C28 + dword_4E57F0[0][v74][0];
                                 a3f = paperdoll_4E4C2C + dword_4E57F0[0][v74][1];
-                                if ( v248 != 1 || v73 == 5 )
+                                if ( IsDwarf != 1 || v73 == 5 )
                                   v75 = stru_511718.texids[v74];
                                 else
-                                  v75 = stru_511718.texids[v73 + 7 * (v239 - 2)];
+                                  v75 = stru_511718.texids[v73 + 7 * (pBodyComplection - 2)];
                                 v76 = *(int *)&v217->field_1F5[36 * v71 + 15];
                                 if ( !(*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) )
                                 {
@@ -7588,14 +7581,8 @@
                                       ptr_50C9A4 = 0;
                                     }
                                     v78 = (double)GetTickCount() * 0.1;
-                                    pRenderer->_4A63E6(
-                                      a2f,
-                                      a3f,
-                                      (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0),
-                                      v77,
-                                      (signed __int64)v78,
-                                      0,
-                                      255);
+                                    pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0),
+                                      v77, (signed __int64)v78, 0, 255);
 LABEL_191:
                                     v68 = v217;
                                     goto LABEL_192;
@@ -7612,8 +7599,7 @@
                               v83 = *(int *)&v68->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v82 + 5];
                               if ( pItemsTable->pItems[v83].uEquipType == 1
                                 || pItemsTable->pItems[v83].uSkillType == 4 && !v68->pEquipment.uOffHand )
-                                pRenderer->DrawTextureTransparent(
-                                  papredoll_4E4C28 + pPaperdollLeftHand[uPlayerID_a],
+                                pRenderer->DrawTextureTransparent(papredoll_4E4C28 + pPaperdollLeftHand[uPlayerID_a],
                                   paperdoll_4E4C2C + pPaperdollLeftHand[uPlayerID_a + 1],
                                   (Texture *)(*(unsigned int *)((char *)papredoll_dlaus + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlaus + v240)] : 0));
                             }
@@ -7666,7 +7652,7 @@
                                               if ( v114 < 0 || v114 >= 10 )
                                                 goto LABEL_293;
 LABEL_274:
-                                              v115 = v114 + 10 * v239;
+                                              v115 = v114 + 10 * pBodyComplection;
                                               v116 = dword_511788[v115];
                                               v115 *= 8;
                                               v117 = papredoll_4E4C28 + *(int *)((char *)&dword_4E56B0 + v115);
@@ -7719,10 +7705,10 @@
                                                   }
                                                   v125 = v192;
 LABEL_312:
-                                                  v126 = 2 * (v125 + 16 * v239);
+                                                  v126 = 2 * (v125 + 16 * pBodyComplection);
                                                   a2j = papredoll_4E4C28 + dword_4E58D0[v126];
                                                   a3i = paperdoll_4E4C2C + dword_4E58D4[v126];
-                                                  if ( v248 != 1 || *(int *)v124 != 92 )
+                                                  if ( IsDwarf != 1 || *(int *)v124 != 92 )
                                                     v127 = stru_511698.texids[v125 + 16 * v250];
                                                   else
                                                     v127 = papredoll_dbrds[11];
@@ -7800,10 +7786,10 @@
                                                   v136 = *(int *)v135;
                                                   v137 = *(int *)v135;
                                                   a2k = papredoll_4E4C28
-                                                      + array_4E4C30[v239].field_8
+                                                      + array_4E4C30[pBodyComplection].field_8
                                                       - pItemsTable->pItems[v137].uEquipX;
                                                   a3j = paperdoll_4E4C2C
-                                                      + array_4E4C30[v239].field_C
+                                                      + array_4E4C30[pBodyComplection].field_C
                                                       - pItemsTable->pItems[v137].uEquipY;
                                                   if ( v136 == 64 )
                                                     v181 = "item64v1";
@@ -7850,10 +7836,10 @@
                                                       v245 = 0;
 LABEL_362:
                                                       v150 = papredoll_4E4C28
-                                                           + array_4E4C30[v239].field_0
+                                                           + array_4E4C30[pBodyComplection].field_0
                                                            - pItemsTable->pItems[v148].uEquipX;
                                                       a3k = paperdoll_4E4C2C
-                                                          + LODWORD(array_4E4C30[v239].field_4)
+                                                          + LODWORD(array_4E4C30[pBodyComplection].field_4)
                                                           - pItemsTable->pItems[v148].uEquipY;
                                                       goto LABEL_370;
                                                     }
@@ -7941,11 +7927,9 @@
                                                                   255);
 LABEL_391:
                                                                 if ( v245 )
-                                                                  pRenderer->DrawTextureTransparent(
-                                                                    papredoll_4E4C28
+                                                                  pRenderer->DrawTextureTransparent(papredoll_4E4C28
                                                                   + pPaperdollLeftEmptyHand[uPlayerID_a],
-                                                                    paperdoll_4E4C2C
-                                                                  + pPaperdollLeftEmptyHand[uPlayerID_a + 1],
+                                                                    paperdoll_4E4C2C + pPaperdollLeftEmptyHand[uPlayerID_a + 1],
                                                                     (Texture *)(*(unsigned int *)((char *)papredoll_dlhs
                                                                                                 + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlhs + v240)] : 0));
                                                                 goto LABEL_393;
@@ -7996,14 +7980,8 @@
                                                         ptr_50C9A4 = 0;
                                                       }
                                                       v141 = (double)GetTickCount() * 0.1;
-                                                      pRenderer->_4A63E6(
-                                                        a2k,
-                                                        a3j,
-                                                        (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0),
-                                                        v140,
-                                                        (signed __int64)v141,
-                                                        0,
-                                                        255);
+                                                      pRenderer->_4A63E6(a2k, a3j, (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0),
+                                                        v140, (signed __int64)v141, 0, 255);
                                                       goto LABEL_358;
                                                     }
                                                   }
@@ -8085,7 +8063,7 @@
                                        || v68->GetEquippedItemSkillType(EQUIP_TWO_HANDED) == 4
                                        && !v68->pEquipment.uOffHand) )
                                     {
-                                      v91 = 17 * v239 + v90;
+                                      v91 = 17 * pBodyComplection + v90;
                                       v92 = v91;
                                       v223 = paperdoll_array_511290[0][v91][2];
                                       if ( v223 == pIcons_LOD->FindTextureByName("pending") )
@@ -8134,14 +8112,8 @@
                                             v174 = 0;
                                             v97 = (double)GetTickCount();
 LABEL_249:
-                                            pRenderer->_4A63E6(
-                                              a2g,
-                                              a3g,
-                                              (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0),
-                                              (Texture *)v96,
-                                              (signed __int64)(v97 * 0.1),
-                                              v174,
-                                              v187);
+                                            pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0),
+                                              (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187);
                                             goto LABEL_258;
                                           }
                                         }
@@ -8177,7 +8149,7 @@
                                       v165 = a2g;
                                       goto LABEL_255;
                                     }
-                                    v102 = 17 * v239 + v90;
+                                    v102 = 17 * pBodyComplection + v90;
                                     v94 = paperdoll_array_511290[0][v102][1];
                                     if ( v94 == pIcons_LOD->FindTextureByName("pending") )
                                     {
@@ -8341,14 +8313,8 @@
                                   ptr_50C9A4 = 0;
                                 }
                                 v52 = (double)GetTickCount() * 0.1;
-                                pRenderer->_4A63E6(
-                                  a2d,
-                                  a3d,
-                                  (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0),
-                                  v51,
-                                  (signed __int64)v52,
-                                  0,
-                                  255);
+                                pRenderer->_4A63E6(a2d, a3d, (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0),
+                                  v51, (signed __int64)v52, 0, 255);
                                 goto LABEL_127;
                               }
 LABEL_116:
@@ -13534,7 +13500,7 @@
 // 50654C: using guessed type int dword_50654C;
 
 //----- (00412E85) --------------------------------------------------------
-char __cdecl sub_412E85()
+char __cdecl DrawBook_History()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -13641,7 +13607,7 @@
 
 
 //----- (00413126) --------------------------------------------------------
-void __cdecl DrawSpellbook_Quests()
+void __cdecl DrawBook_Quests()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -13737,7 +13703,7 @@
 
 
 //----- (0041338E) --------------------------------------------------------
-void __cdecl DrawSpellbook_Autonotes()
+void __cdecl DrawBook_Autonotes()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -14040,7 +14006,7 @@
 
 
 //----- (00413980) --------------------------------------------------------
-char *__cdecl DrawSpellbook_Map()
+char *__cdecl DrawBook_Maps()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -14186,37 +14152,34 @@
 
 
 //----- (00413CC6) --------------------------------------------------------
-void __thiscall DrawSpellbook(unsigned int uBook)
-{
-  unsigned int v1; // esi@1
-
-  v1 = uBook;
-  pRenderer->DrawTextureIndexed(
-    471u,
-    445u,
-    (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0));
-  switch ( v1 )
-  {
-    case 0xB1u:
+void __thiscall SellectDrawBook(unsigned int uBook)
+{
+  enum WindowType pWindowType; // esi@1
+
+  pWindowType = (enum WindowType)uBook;
+  pRenderer->DrawTextureIndexed(471u, 445u, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0));
+  switch ( pWindowType )
+  {
+    case WINDOW_Lloyd: // 177
       DrawLloydBeaconsScreen();
       break;
-    case 0xC3u:
+    case WINDOW_TownPortal: //195
       DrawTownPortalScreen();
       break;
-    case 0xC8u:
-      DrawSpellbook_Quests();
+    case WINDOW_QuestBook: //200
+      DrawBook_Quests();
       break;
-    case 0xC9u:
-      DrawSpellbook_Autonotes();
+    case WINDOW_AutonotesBook: //201
+      DrawBook_Autonotes();
       break;
-    case 0xCAu:
-      DrawSpellbook_Map();
+    case WINDOW_MapsBook://202
+      DrawBook_Maps();
       break;
-    case 0xCBu:
-      DrawSpellbook_Calendar();
+    case WINDOW_CalendarBook://203
+      DrawBook_Calendar();
       break;
-    case 0xE0u:
-      sub_412E85();
+    case WINDOW_HistoryBook://224
+      DrawBook_History();
       break;
   }
 }
@@ -14237,7 +14200,7 @@
 }
 
 //----- (00413D6F) --------------------------------------------------------
-char __cdecl DrawSpellbook_Calendar()
+char __cdecl DrawBook_Calendar()
 {
   unsigned int v0; // esi@1
   char *v1; // eax@5
@@ -14990,7 +14953,7 @@
 
 
 //----- (004156F0) --------------------------------------------------------
-void __cdecl GUI_UpdateWindows()
+void __cdecl GUI_UpdateWindows() //     
 {
   GUIWindow *pWindow; // esi@4
   unsigned int pWindowType; // eax@4
@@ -15120,12 +15083,12 @@
                   if ( v38 == 1 )//pWindowType == 106 (0x6A) WINDOW_VideoOptions
                     GameMenuUI_DrawVideoOptions();
                 }
-                else//pWindowType == 105
+                else//pWindowType == 105 (0x69) WINDOW_KeyMappingOptions
                 {
                   GameMenuUI_DrawKeyBindings();
                 }
               }
-              else//pWindowType == 103
+              else//pWindowType == 103 (0x67) WINDOW_67
               {
                 pWindow->DrawMessageBox(0);
                 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
@@ -15147,7 +15110,7 @@
               }
               continue;
             }
-            pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99
+            pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99 (0x63) WINDOW_63
             pY = pWindow->uFrameY;
             pX = pWindow->uFrameX;
 //LABEL_18:
@@ -15156,7 +15119,7 @@
             viewparams->bRedrawGameUI = 1;
             continue;
           }
-          memset(&GUIButton2, 0, 0xBCu);//pWindowType == 98
+          memset(&GUIButton2, 0, 0xBCu);//pWindowType == 98 (0x62) WINDOW_RestWindow
           GUIButton2.uZ = 197;
           GUIButton2.uW = 197;
           GUIButton2.uX = 27;
@@ -15175,7 +15138,7 @@
           pGUIWindow2->Release();
           continue;
         }
-        if ( pWindow->Hint != (char *)1 )//pWindowType == 97
+        if ( pWindow->Hint != (char *)1 )//pWindowType == 97 (0x61) WINDOW_61
           pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
         v32 = pWindow->ptr_1C;
         pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16));
@@ -15226,7 +15189,7 @@
       if ( v14 )//pWindowType > 80
       {
         v15 = v14 - 9;
-        if ( !v15 )//pWindowType == 89
+        if ( !v15 )//pWindowType == 89 (0x59) WINDOW_59
         {
           pWindow->DrawMessageBox(0);
           pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
@@ -15263,17 +15226,17 @@
           continue;
         }
         v16 = v15 - 1;
-        if ( !v16 )// pWindowType == 90
+        if ( !v16 )// pWindowType == 90 (0x5A) WINDOW_5A
         {
           if ( pWindow->Hint != (char *)1 )
             pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
           pButtonPtr_1C = (GUIButton *)pWindow->ptr_1C;
-          if ( (pButtonPtr_1C->uX /*& 0x80000000u*/) == 0 )
+          if ( pButtonPtr_1C->uX >= 0 )//if ( (pButtonPtr_1C->uX & 0x80000000u) == 0 )
           {
             if ( (signed int)pButtonPtr_1C->uX <= 640 )
             {
               //v25 = pButtonPtr_1C->uY;
-              if ( (pButtonPtr_1C->uY /*& 0x80000000u*/) == 0 )
+              if ( pButtonPtr_1C->uY >= 0 ) //if ( (pButtonPtr_1C->uY & 0x80000000u) == 0 )
               {
                 if ( (signed int)pButtonPtr_1C->uY <= 480 )
                 {
@@ -15314,7 +15277,7 @@
           continue;
         }
         v17 = v16 - 1;
-        if ( !v17 )//pWindowType == 91
+        if ( !v17 )//pWindowType == 91 (0x5B) WINDOW_5B
         {
           if ( pWindow->Hint != (char *)1 )
             pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
@@ -15339,7 +15302,7 @@
           continue;
         }
         v18 = v17 - 1;
-        if ( !v18 )//pWindowType == 92
+        if ( !v18 )//pWindowType == 92 (0x5C) WINDOW_5C
         {
           if ( pWindow->Hint != (char *)1 )
             pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
@@ -15359,7 +15322,7 @@
           continue;
         }
         v19 = v18 - 1;
-        if ( !v19 )//pWindowType == 93
+        if ( !v19 )//pWindowType == 93 (0x5D) WINDOW_5D
         {
           if ( pWindow->Hint != (char *)1 )
             pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
@@ -15372,7 +15335,7 @@
           continue;
         }
       }
-      else//pWindowType == 80
+      else//pWindowType == 80 (0x50) WINDOW_50
       {
         v27 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
         if ( ptr_507BD0->field_40 == 1 )
@@ -15415,7 +15378,7 @@
     }
     else
     {
-      if ( pWindowType == 70 )
+      if ( pWindowType == 70 ) // 0x46 WINDOW_FinalWindow
       {
         sub_41420D_press_esc();
         continue;
@@ -15430,7 +15393,7 @@
             v13 = v12 - 4;
             if ( v13 )//pWindowType > 30
             {
-              if ( v13 == 1 ) //pWindowType == 31
+              if ( v13 == 1 ) //pWindowType == 31 (0x1F) WINDOW_1F
               {
                 pRenderer->ClearZBuffer(0, 479);
                 draw_leather();
@@ -15440,12 +15403,12 @@
                   (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
               }
             }
-            else// pWindowType == 30
+            else// pWindowType == 30 (0x1E) WINDOW_1E
             {
               sub_467FB6();
             }
           }
-          else //pWindowType == 26
+          else //pWindowType == 26 (0x1A) WINDOW_1A
           {
             TransitionUI_Draw();
           }
@@ -15462,15 +15425,15 @@
               v9 = v8 - 3;
               if ( v9 )//pWindowType > 23
               {
-                //if ( v9 == 1 ) //pWindowType == 24
+                //if ( v9 == 1 ) //pWindowType == 24 (0x18) WINDOW_MainMenu_Load
                 //  sub_4606F7();
               }
-              else//pWindowType == 23
+              else//pWindowType == 23 (0x17) WINDOW_17
               {
                 sub_4606FE();
               }
             }
-            else//pWindowType == 20
+            else//pWindowType == 20 (0x14) WINDOW_Chest
             {
               if ( pCurrentScreen == 10 )
               {
@@ -15489,7 +15452,7 @@
               }
             }
           }
-          else//pWindowType == 19
+          else//pWindowType == 19 (0x13) WINDOW_GreetingNPC
           {
             DrawBranchlessDialogueUI();
           }
@@ -15526,7 +15489,7 @@
         }
         continue;
       }
-      if ( pWindowType == 18 )
+      if ( pWindowType == 18 ) //(0x12) WINDOW_SpellBook
       {
         sub_412B58();
       }
@@ -15540,15 +15503,15 @@
             v6 = v5 - 4;
             if ( v6 )//pWindowType > 16
             {
-              if ( v6 == 1 )//pWindowType == 17
+              if ( v6 == 1 )//pWindowType == 17 (0x11) WINDOW_ChangeLocation
                 TravelUI_Draw();
             }
-            else//pWindowType == 16
+            else//pWindowType == 16 (0x10) WINDOW_10
             {
               RestUI_Draw();
             }
           }
-          else// pWindowType == 12
+          else// pWindowType == 12 (0xC) WINDOW_C
           {
             QuickRefDraw();
           }
@@ -15565,21 +15528,21 @@
               v4 = v3 - 2;
               if ( v4 )//pWindowType > 6
               {
-                if ( v4 == 3 )//pWindowType == 9
-                  DrawSpellbook((unsigned int)pWindow->ptr_1C);
+                if ( v4 == 3 )//pWindowType == 9 (0x9) WINDOW_Book
+                  SellectDrawBook((unsigned int)pWindow->ptr_1C);
               }
-              else//pWindowType == 6
+              else//pWindowType == 6 (0x6) WINDOW_Options
               {
                 sub_414F82_DrawGameOptions();
               }
             }
-            else//pWindowType == 4
+            else//pWindowType == 4 (0x4) WINDOW_CharacterRecord
             {
               CharacterUI_CharacterScreen_Draw(uActiveCharacter);
             }
             continue;
           }
-          pTexture = (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0);//pWindowType == 3
+          pTexture = (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0);//pWindowType == 3 (0x3)
           pY = pViewport->uViewportY;
           pX = pViewport->uViewportX;
           //goto LABEL_18;
@@ -17839,7 +17802,7 @@
 void __cdecl sub_419401()
 {
   unsigned int v0; // ecx@3
-  GUIButton *i; // eax@3
+  GUIButton *pButton; // eax@3
   GUIFont *v2; // eax@8
   unsigned int v3; // esi@8
   int v4; // eax@10
@@ -17864,18 +17827,18 @@
     sub_4196A0();
   v0 = uActiveCharacter;
   dword_507CC0 = uActiveCharacter;
-  for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
-  {
-    if ( i->uControlID == 120 )
-    {
-      dword_50698C = i->uX;
-      dword_506988 = i->uY;
-      dword_506984 = i->uZ;
-      dword_506980 = i->uW;
-      i->uW = 0;
-      i->uZ = 0;
-      i->uY = 0;
-      i->uX = 0;
+  for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
+  {
+    if ( pButton->uControlID == 120 )
+    {
+      dword_50698C = pButton->uX;
+      dword_506988 = pButton->uY;
+      dword_506984 = pButton->uZ;
+      dword_506980 = pButton->uW;
+      pButton->uW = 0;
+      pButton->uZ = 0;
+      pButton->uY = 0;
+      pButton->uX = 0;
       v0 = uActiveCharacter;
     }
   }
@@ -17887,24 +17850,13 @@
   v3 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
   do
   {
-    if ( v18[2 * *v14 + 264] & 0x3F )
+    if ( v18[2 * *v14 + 264] & 0x3F )//crash
     {
       v4 = LOBYTE(v2->uFontHeight);
       v3 = v3 + v4 - 3;
       ++a2;
       ++v12;
-      pGUIWindow_CurrentMenu->CreateButton(
-        0x18u,
-        v3,
-        0xCCu,
-        v4 - 3,
-        3,
-        *v14 | 0x8000,
-        0x79u,
-        *v14,
-        0,
-        "",
-        0);
+      pGUIWindow_CurrentMenu->CreateButton(0x18u, v3, 0xCCu, v4 - 3, 3, *v14 | 0x8000, 0x79u, *v14, 0, "", 0, 0);
       v2 = pFontLucida;
     }
     ++v14;
@@ -17921,18 +17873,7 @@
       v6 = LOBYTE(v2->uFontHeight);
       v5 = v5 + v6 - 3;
       ++a2;
-      pGUIWindow_CurrentMenu->CreateButton(
-        0x18u,
-        v5,
-        0xCCu,
-        v6 - 3,
-        3,
-        *v15 | 0x8000,
-        0x79u,
-        *v15,
-        0,
-        "",
-        0);
+      pGUIWindow_CurrentMenu->CreateButton(0x18u, v5, 0xCCu, v6 - 3, 3, *v15 | 0x8000, 0x79u, *v15, 0, "", 0, 0);
       v2 = pFontLucida;
     }
     ++v15;
@@ -17949,18 +17890,7 @@
       v7 = v7 + v8 - 3;
       ++a2;
       ++v13;
-      pGUIWindow_CurrentMenu->CreateButton(
-        0xF6u,
-        v7,
-        0xCCu,
-        v8 - 3,
-        3,
-        *v16 | 0x8000,
-        0x79u,
-        *v16,
-        0,
-        "",
-        0);
+      pGUIWindow_CurrentMenu->CreateButton(0xF6u, v7, 0xCCu, v8 - 3, 3, *v16 | 0x8000, 0x79u, *v16, 0, "", 0, 0);
       v2 = pFontLucida;
     }
     ++v16;
@@ -17977,18 +17907,7 @@
       v10 = LOBYTE(v2->uFontHeight);
       v9 = v9 + v10 - 3;
       ++a2;
-      pGUIWindow_CurrentMenu->CreateButton(
-        0xF6u,
-        v9,
-        0xCCu,
-        v10 - 3,
-        3,
-        *v17 | 0x8000,
-        0x79u,
-        *v17,
-        0,
-        "",
-        0);
+      pGUIWindow_CurrentMenu->CreateButton(0xF6u, v9, 0xCCu, v10 - 3, 3, *v17 | 0x8000, 0x79u, *v17, 0, "", 0, 0);
       v2 = pFontLucida;
     }
     ++v17;