changeset 17:fe0d9a98213f

17.01.13 (fix Hint error)
author Ritor1
date Thu, 17 Jan 2013 16:24:25 +0600
parents e1afcd54fddd
children d5954a85577a
files GUIWindow.cpp GUIWindow.h LOD.cpp Vis.cpp mm7_1.cpp mm7_5.cpp mm7_6.cpp mm7_data.h
diffstat 8 files changed, 226 insertions(+), 225 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/GUIWindow.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -121,9 +121,9 @@
   {
     v9 = LODWORD(v18->uExpireTime);
     v10 = HIDWORD(v18->uExpireTime);
-    if ( (v10 & 0x80000000u) == 0 && ((signed int)v10 > 0 || v9) )
+    if ( (v10 & 0x80000000u) == 0 && ((signed int)v10 > 0 || v9) )//!!!
     {
-      v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;
+      v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!!
       v12 = v20 * LOBYTE(v1->uFontHeight) + 40;
       v13 = *v16;
       ++v20;
@@ -950,7 +950,7 @@
                   v8 = v7 + 1;
                   if ( (signed int)v7 + 1 > 0 )
                   {
-                    memset32((void *)(4 * dword_506520 + 6043152), v24, v8);
+                    memset32((char *)&pStru179 + 4 * dword_506520 , v24, v8);
                     do
                     {
                       LODWORD(v7) = dword_506520++;
@@ -1947,66 +1947,66 @@
 //----- (0041D12F) --------------------------------------------------------
 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
 {
-  GUIButton *v12; // esi@1
+  GUIButton *pButton; // esi@1
   unsigned int v13; // eax@1
   unsigned int v14; // ebx@4
   unsigned int v15; // eax@4
-  unsigned int v16; // ebx@4
+  unsigned int pTextureNum; // ebx@4
   unsigned int v17; // eax@4
   Texture *v18; // eax@4
   Texture **v19; // ecx@5
   Texture **v20; // edx@5
   GUIButton *v21; // eax@7
 
-  v12 = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON");
-  v12->pParent = this;
-  v12->uX = uX + this->uFrameX;
+  pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON");
+  pButton->pParent = this;
+  pButton->uX = uX + this->uFrameX;
   v13 = uY + this->uFrameY;
-  v12->uHeight = uHeight;
-  v12->uY = v13;
-  v12->uWidth = uWidth;
+  pButton->uHeight = uHeight;
+  pButton->uY = v13;
+  pButton->uWidth = uWidth;
   if ( a6 == 2 && !uHeight )
-    v12->uHeight = uWidth;
-  v14 = v12->uX;
-  v12->uButtonType = a6;
+    pButton->uHeight = uWidth;
+  v14 = pButton->uX;
+  pButton->uButtonType = a6;
   v15 = v14 + uWidth - 1;
-  v16 = 0;
-  v12->uZ = v15;
-  v17 = v12->uY;
-  v12->field_2C = 0;
-  v12->uW = v17 + uHeight - 1;
-  v12->field_1C = a7;
-  v12->uControlID = uControlID;
-  v12->uControlParam = uControlParam;
-  v12->uHotkey = uHotkey;
+  pTextureNum = 0;
+  pButton->uZ = v15;
+  v17 = pButton->uY;
+  pButton->field_2C = 0;
+  pButton->uW = v17 + uHeight - 1;
+  pButton->field_1C = a7;
+  pButton->uControlID = uControlID;
+  pButton->uControlParam = uControlParam;
+  pButton->uHotkey = uHotkey;
   strlen(pName);
-  strcpy(v12->pButtonName, pName);
+  strcpy(pButton->pButtonName, pName);
   v18 = pTextures;
   if ( pTextures )
   {
     v19 = &pTextures;
-    v20 = v12->pTextures;
+    v20 = pButton->pTextures;
     do
     {
       ++v19;
       *v20 = v18;
-      ++v16;
+      ++pTextureNum;
       ++v20;
       v18 = *v19;
     }
     while ( *v19 );
   }
-  v12->uNumTextures = v16;
+  pButton->uNumTextures = pTextureNum;
   v21 = this->pControlsTail;
   if ( v21 )
-    v21->pNext = v12;
+    v21->pNext = pButton;
   else
-    this->pControlsHead = v12;
-  v12->pPrev = this->pControlsTail;
-  this->pControlsTail = v12;
-  v12->pNext = 0;
+    this->pControlsHead = pButton;
+  pButton->pPrev = this->pControlsTail;
+  this->pControlsTail = pButton;
+  pButton->pNext = 0;
   ++this->uNumControls;
-  return v12;
+  return pButton;
 }
 
 //----- (00459C2B) --------------------------------------------------------
--- a/GUIWindow.h	Thu Jan 17 09:24:40 2013 +0600
+++ b/GUIWindow.h	Thu Jan 17 16:24:25 2013 +0600
@@ -34,27 +34,50 @@
 {
   WINDOW_null = 0,
   WINDOW_MainMenu = 0x1,
+  WINDOW_3 = 0x3,
   WINDOW_CharacterRecord = 0x4,
   WINDOW_Options = 0x6,
   WINDOW_Book = 0x9,
-  WINDOW_A = 10,
-  WINDOW_ChangeLocation = 17,
-  WINDOW_SpellBook = 18,
-  WINDOW_GreetingNPC = 19,
+  WINDOW_A = 0xA, //10,
+  WINDOW_C = 0xC, //12,
+  WINDOW_10 = 0x10, //16,
+  WINDOW_ChangeLocation = 0x11, //17,
+  WINDOW_SpellBook = 0x12, //18,
+  WINDOW_GreetingNPC = 0x13, //19,
   WINDOW_Chest = 0x14,
+  WINDOW_17 = 0x17,
   WINDOW_MainMenu_Load = 0x18,
   WINDOW_HouseInterior = 0x19,
-  WINDOW_1A = 26,
-  WINDOW_1B = 27,
-  WINDOW_1E = 30,
-  WINDOW_1F = 31,
+  WINDOW_1A = 0x1A, //26,
+  WINDOW_1B = 0x1B, //27,
+  WINDOW_1E = 0x1E, //30,
+  WINDOW_1F = 0x1F, //31,
   WINDOW_FinalWindow = 0x46,
+  WINDOW_50 = 0x50,
+  WINDOW_59 = 0x59,
   WINDOW_5A = 0x5A,
+  WINDOW_5B = 0x5B,
+  WINDOW_5C = 0x5C,
+  WINDOW_5D = 0x5D,
   WINDOW_5E = 0x5E,
   WINDOW_5F = 0x5F,
   WINDOW_60 = 0x60,
+  WINDOW_61 = 0x61,
+  WINDOW_RestWindow = 0x62,
+  WINDOW_63 = 0x63,
+  WINDOW_CharacterWindow_Stats = 0x64,
+  WINDOW_CharacterWindow_Skills = 0x65,
+  WINDOW_CharacterWindow_Awards = 0x66,
+  WINDOW_CharacterWindow_Inventory = 0x67,
   WINDOW_KeyMappingOptions = 0x69,
-  WINDOW_VideoOptions = 0x6A
+  WINDOW_VideoOptions = 0x6A,
+  WINDOW_Lloyd = 0xB1,
+  WINDOW_TownPortal = 0xC3,
+  WINDOW_QuestBook = 0xC8,
+  WINDOW_AutonotesBook = 0xC9,
+  WINDOW_MapsBook = 0xCA,
+  WINDOW_CalendarBook = 0xCB,
+  WINDOW_HistoryBook = 0xCC,
 };
 
 /*  155 */
--- a/LOD.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/LOD.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -1691,7 +1691,7 @@
   if ( !this->pIOBuffer || !this->uIOBufferSize )
     return 3;
   v7 = this->uNumSubIndices == 0;
-  v8 = (this->uNumSubIndices & 0x80000000u) != 0;
+  v8 = this->uNumSubIndices != 0; // v8 = (this->uNumSubIndices & 0x80000000u) != 0;
   v36 = 0;
   v34 = 0;
   if ( v8 | v7 )
@@ -1720,7 +1720,7 @@
     v35 += 32;
     ++v5;
     v11 = v5 >= v4->uNumSubIndices;
-    v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
+    v8 = (v5 - v4->uNumSubIndices) != 0;//v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
     v34 = v5;
     if ( !(v8 ^ v11) )
       goto LABEL_22;
--- a/Vis.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/Vis.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -326,7 +326,7 @@
   v10 = v9 < v5;
   v11 = 0;
   v12 = v9 == v5;
-  BYTE1(result) = HIBYTE(v8);
+  BYTE1(result) = HIBYTE(v8);//crash
   if ( v9 >= v5
     && (v14 = x - 1.0, /*UNDEF(v13),*/ v15 = v14 < a1a, v16 = 0, v17 = v14 == a1a, BYTE1(result) = HIBYTE(v13), v15 | v17)
     && (v19 = y + 1.0, /*UNDEF(v18),*/ v20 = v19 < v29, v21 = 0, v22 = v19 == v29, BYTE1(result) = HIBYTE(v18), v19 >= v29)
--- a/mm7_1.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/mm7_1.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -1237,8 +1237,8 @@
 {
   unsigned int v1; // edi@1
   unsigned int v2; // eax@6
-  Texture *v3; // ecx@6
-  GUIButton *v4; // eax@6
+  Texture *pTexture; // ecx@6
+  GUIButton *pButton; // eax@6
   unsigned int v5; // eax@7
   unsigned int v6; // eax@10
   unsigned int v7; // eax@11
@@ -1249,15 +1249,15 @@
     pRenderer->ClearZBuffer(0, 479);
     switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] )
     {
-      case 0x64:                                // stats
+      case WINDOW_CharacterWindow_Stats:                                // stats
         sub_4196A0();
         sub_419379();
         CharacterUI_StatsTab_Draw(v1);
         v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
-        v3 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
-        v4 = pCharacterScreen_StatsBtn;
+        pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
+        pButton = pCharacterScreen_StatsBtn;
         break;
-      case 0x65:                                // skills
+      case WINDOW_CharacterWindow_Skills:                                // skills
         if ( dword_507CC0 != uActiveCharacter )
         {
           sub_4196A0();
@@ -1266,30 +1266,30 @@
         sub_419379();
         CharacterUI_SkillsTab_Draw(v1);
         v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
-        v3 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
-        v4 = pCharacterScreen_SkillsBtn;
+        pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
+        pButton = pCharacterScreen_SkillsBtn;
         break;
-      case 0x66:                                // awards
+      case WINDOW_CharacterWindow_Awards:                                // awards
         sub_4196A0();
         sub_419379();
         sub_419220();
         CharacterUI_AwardsTab_Draw(v1);
         v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
-        v3 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
-        v4 = pCharacterScreen_AwardsBtn;
+        pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
+        pButton = pCharacterScreen_AwardsBtn;
         break;
-      default:
+      default:                                                            // inventory and other
         if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 )
           goto LABEL_13;
         sub_4196A0();
         sub_419379();
         CharacterUI_InventoryTab_Draw(v1, 0);
         v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
-        v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
-        v4 = pCharacterScreen_InventoryBtn;
+        pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
+        pButton = pCharacterScreen_InventoryBtn;
         break;
     }
-    pRenderer->DrawTextureIndexed(v4->uX, v4->uY, v3);
+    pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
 LABEL_13:
     if ( bRingsShownInCharScreen )
       CharacterUI_DrawPaperdollWithRingOverlay(v1);
@@ -1704,7 +1704,6 @@
   //Texture *v18; // ST60_4@1
   unsigned int uTextureID_ib_td4_A; // eax@1
   Texture *v20; // ST78_4@1
-  const char *v21; // ST5C_4@1
   unsigned __int8 v22; // al@1
   //Texture *v23; // ST60_4@1
   Texture *v24; // eax@1
@@ -1773,82 +1772,31 @@
   pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0);
   uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE);
   v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0);
-  v7 = pGlobalTXT_LocalizationStrings[174];
+  v7 = pGlobalTXT_LocalizationStrings[174];//Quests
   v8 = pKeyActionMap->GetActionVKey(INPUT_Quest);
-  pBtn_Quests = pPrimaryWindow->CreateButton(
-                 0x1EBu,
-                 0x161u,
-                 v6->uTextureWidth,
-                 v6->uTextureHeight,
-                 1,
-                 0,
-                 0xC8u,
-                 0,
-                 v8,
-                 v7,
-                 v6, 0);
+  pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, v7, v6, 0);
   uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE);
   v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0);
-  v11 = pGlobalTXT_LocalizationStrings[154];
+  v11 = pGlobalTXT_LocalizationStrings[154];//Autonotes
   v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes);
-  pBtn_Autonotes = pPrimaryWindow->CreateButton(
-                 0x20Fu,
-                 0x161u,
-                 v10->uTextureWidth,
-                 v10->uTextureHeight,
-                 1,
-                 0,
-                 0xC9u,
-                 0,
-                 v12,
-                 v11,
-                 v10);
+  pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, v11, v10, 0);
   v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE);
   v15 = (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0);
-  v16 = pGlobalTXT_LocalizationStrings[139];
+  v16 = pGlobalTXT_LocalizationStrings[139];//Maps
   v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook);
-  pBtn_Maps = pPrimaryWindow->CreateButton(
-                 0x222u,
-                 0x161u,
-                 v15->uTextureWidth,
-                 v15->uTextureHeight,
-                 1,
-                 0,
-                 0xCAu,
-                 0,
-                 v17,
-                 v16,
-                 v15);
+  pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, v16, v15, 0);
   uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE);
   v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0);
-  v21 = pGlobalTXT_LocalizationStrings[78];
   v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal);
-  pBtn_Calendar = pPrimaryWindow->CreateButton(
-                   0x23Au,
-                   0x161u,
-                   v20->uTextureWidth,
-                   v20->uTextureHeight,
-                   1,
-                   0,
-                   0xCBu,
-                   0,
-                   v22,
-                   v21,
-                   v20);
+  pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22,
+                                                pGlobalTXT_LocalizationStrings[78],//Calendar
+                                                 v20, 0);
   uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE);
-  pBtn_History = pPrimaryWindow->CreateButton(
-                 0x258u,
-                 0x169u,
+  pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u,
                  (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24),
                  (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26),
-                 1,
-                 0,
-                 0xE0u,
-                 0,
-                 0x48u,
-                 pGlobalTXT_LocalizationStrings[602],
-                 (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0),
-                 0);
+                 1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History
+                 (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0);
   v24 = &pIcons_LOD->pTextures[uTextureID_507980];
   v25 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0);
   bFlashHistoryBook = 0;
@@ -5311,7 +5259,7 @@
   if ( uNumVisibleWindows <= 0 )
   {
 LABEL_38:
-    if ( pCurrentScreen == 10 )
+    if ( pCurrentScreen == 10 ) // ChestScreen
     {
       sub_42038D();
       //goto _return;
@@ -5326,7 +5274,7 @@
       uLastPointedObjectID = pMouse->uPointingObjectID;
       return;
     }
-    if ( pCurrentScreen == 13 )
+    if ( pCurrentScreen == 13 ) // HouseScreen
     {
       if ( dword_F8B19C != 2
         || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0)
@@ -5411,7 +5359,7 @@
             && (signed int)pY <= (signed int)pButton->uW )
           {
             pMessageType3 = (UIMessageType)pButton->field_1C;
-            if ( pMessageType3 == 0 )
+            if ( pMessageType3 == 0 ) // For books
               //goto LABEL_28;
             {
               v13 = pButton->pButtonName;
--- a/mm7_5.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/mm7_5.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -13552,7 +13552,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
@@ -13659,7 +13659,7 @@
 
 
 //----- (00413126) --------------------------------------------------------
-void __cdecl DrawSpellbook_Quests()
+void __cdecl DrawBook_Quests()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -13755,7 +13755,7 @@
 
 
 //----- (0041338E) --------------------------------------------------------
-void __cdecl DrawSpellbook_Autonotes()
+void __cdecl DrawBook_Autonotes()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -14058,7 +14058,7 @@
 
 
 //----- (00413980) --------------------------------------------------------
-char *__cdecl DrawSpellbook_Map()
+char *__cdecl DrawBook_Maps()
 {
   unsigned int v0; // eax@3
   unsigned int v1; // eax@7
@@ -14204,37 +14204,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;
   }
 }
@@ -14255,7 +14252,7 @@
 }
 
 //----- (00413D6F) --------------------------------------------------------
-char __cdecl DrawSpellbook_Calendar()
+char __cdecl DrawBook_Calendar()
 {
   unsigned int v0; // esi@1
   char *v1; // eax@5
@@ -15008,7 +15005,7 @@
 
 
 //----- (004156F0) --------------------------------------------------------
-void __cdecl GUI_UpdateWindows()
+void __cdecl GUI_UpdateWindows() // Нужно всё преобразовать в кейсы
 {
   GUIWindow *pWindow; // esi@4
   unsigned int pWindowType; // eax@4
@@ -15143,7 +15140,7 @@
                   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);
@@ -15165,7 +15162,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:
@@ -15174,7 +15171,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;
@@ -15193,7 +15190,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));
@@ -15244,7 +15241,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);
@@ -15281,17 +15278,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 )
                 {
@@ -15332,7 +15329,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);
@@ -15357,7 +15354,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);
@@ -15377,7 +15374,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);
@@ -15390,7 +15387,7 @@
           continue;
         }
       }
-      else//pWindowType == 80
+      else//pWindowType == 80 (0x50) WINDOW_50
       {
         v27 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
         if ( ptr_507BD0->field_40 == 1 )
@@ -15433,7 +15430,7 @@
     }
     else
     {
-      if ( pWindowType == 70 )
+      if ( pWindowType == 70 ) // 0x46 WINDOW_FinalWindow
       {
         sub_41420D_press_esc();
         continue;
@@ -15448,7 +15445,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();
@@ -15458,12 +15455,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();
           }
@@ -15480,15 +15477,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 )
               {
@@ -15507,7 +15504,7 @@
               }
             }
           }
-          else//pWindowType == 19
+          else//pWindowType == 19 (0x13) WINDOW_GreetingNPC
           {
             DrawBranchlessDialogueUI();
           }
@@ -15544,7 +15541,7 @@
         }
         continue;
       }
-      if ( pWindowType == 18 )
+      if ( pWindowType == 18 ) //(0x12) WINDOW_SpellBook
       {
         sub_412B58();
       }
@@ -15558,15 +15555,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();
           }
@@ -15583,21 +15580,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;
--- a/mm7_6.cpp	Thu Jan 17 09:24:40 2013 +0600
+++ b/mm7_6.cpp	Thu Jan 17 16:24:25 2013 +0600
@@ -8939,15 +8939,23 @@
             }
             break;
           case INPUT_MoveBackwards:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (!pParty->bTurnBasedModeOn)
-              goto _do_move_backwards;
+              //goto _do_move_backwards;
+            {
+              v5 = pActionQueue;
+              if ( pParty->uFlags2 & 2 )
+                partyAction = PARTY_RunBackward;
+              else
+                partyAction = PARTY_WalkBackward;
+              goto _add_action_and_continue;
+            }
             if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 )
             {
               pTurnEngine->uActionPointsLeft -= 26;
-_do_move_backwards:
+//_do_move_backwards:
               v5 = pActionQueue;
               if ( pParty->uFlags2 & 2 )
                 partyAction = PARTY_RunBackward;
@@ -8957,27 +8965,35 @@
             }
             break;
           case INPUT_StrafeLeft:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (!pParty->bTurnBasedModeOn)
-              goto _do_strafe_left;
+              //goto _do_strafe_left;
+            {
+              partyAction = PARTY_StrafeLeft;
+              goto _add_action_and_continue_;
+            }
             if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
               break;
             pTurnEngine->uActionPointsLeft -= 26;
-_do_strafe_left:
+//_do_strafe_left:
             partyAction = PARTY_StrafeLeft;
             goto _add_action_and_continue_;
           case INPUT_StrafeRight:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (!pParty->bTurnBasedModeOn)
-              goto _do_strafe_right;
+              //goto _do_strafe_right;
+            {
+              partyAction = PARTY_StrafeRight;
+              goto _add_action_and_continue_;
+            }
             if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
               break;
             pTurnEngine->uActionPointsLeft -= 26;
-_do_strafe_right:
+//_do_strafe_right:
             partyAction = PARTY_StrafeRight;
             goto _add_action_and_continue_;
           case INPUT_TurnLeft:
@@ -9036,14 +9052,14 @@
             }
             break;
           case INPUT_Jump:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen
               || pParty->bTurnBasedModeOn)
               break;
             partyAction = (PartyAction)12;
             goto _add_action_and_continue_;
           case INPUT_Yell:
-            __debugbreak();
+            //__debugbreak();
             if ( !pCurrentScreen
               && uActiveCharacter )
             {
@@ -9052,11 +9068,15 @@
             }
             break;
           case INPUT_Pass:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
-              goto LABEL_118;
+              //goto LABEL_118;
+            {
+              pTurnEngine->field_18 |= 8u;
+              break;
+            }
             if ( uActiveCharacter )
             {
               v6 = pPlayers[uActiveCharacter];
@@ -9072,7 +9092,7 @@
             }
             break;
           case INPUT_Combat:
-            __debugbreak();
+            //__debugbreak();
             if ( !pCurrentScreen )
             {
               if (pParty->bTurnBasedModeOn)
@@ -9091,11 +9111,15 @@
             }
             break;
           case INPUT_CastReady:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
-              goto LABEL_118;
+              //goto LABEL_118;
+            {
+              pTurnEngine->field_18 |= 8u;
+              break;
+            }
             if ( !uActiveCharacter )
               break;
             v7 = pPlayers[uActiveCharacter];
@@ -9125,16 +9149,13 @@
               }
             }
             break;
-          default:
-            __debugbreak();
-            break;
           case INPUT_Attack:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3)
               goto LABEL_120;
-LABEL_118:
+//LABEL_118:
             pTurnEngine->field_18 |= 8u;
             break;
           case INPUT_EventTrigger:
@@ -9170,46 +9191,46 @@
             }
             break;
           case INPUT_CharCycle:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen == 8
               || dword_50C9E8 >= 40 )
               break;
             dword_50C9EC[3 * dword_50C9E8] = 176;
             goto LABEL_155;
           case INPUT_LookUp:
-            __debugbreak();
+            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)7;
             goto _add_action_and_continue_;
           case INPUT_CenterView:
-            __debugbreak();
+            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)9;
             goto _add_action_and_continue_;
           case INPUT_LookDown:
-            __debugbreak();
+            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)8;
             goto _add_action_and_continue_;
           case INPUT_FlyUp:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen
               || pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)13;
             goto _add_action_and_continue_;
           case INPUT_Land:
-            __debugbreak();
+            //__debugbreak();
             if ( pCurrentScreen
               || pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)15;
             goto _add_action_and_continue_;
           case INPUT_FlyDown:
-            __debugbreak();
+            //__debugbreak();
             if ( !pCurrentScreen
               && !pEventTimer->bPaused )
             {
@@ -9221,13 +9242,13 @@
             }
             break;
           case INPUT_ZoomIn:
-            __debugbreak();
+            //__debugbreak();
             if ( dword_50C9E8 >= 40 )
               break;
             dword_50C9EC[3 * dword_50C9E8] = 367;
             goto LABEL_155;
           case INPUT_ZoomOut:
-            __debugbreak();
+            //__debugbreak();
             if ( dword_50C9E8 < 40 )
             {
               dword_50C9EC[3 * dword_50C9E8] = 368;
@@ -9240,6 +9261,9 @@
           case INPUT_AlwaysRun:
             bAlwaysRun = bAlwaysRun == 0;
             break;
+          default:
+            //__debugbreak();
+            break;
         }
       }
       inputAction = (InputAction)((int)inputAction + 1);
@@ -9263,7 +9287,11 @@
         if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
           goto LABEL_175;
         pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404;
-        goto LABEL_174;
+        //goto LABEL_174;
+        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+        ++pMessageQueue_50CBD0->uNumMessages;
+        goto LABEL_175;
       }
       if ( pCurrentScreen == 4
         || pCurrentScreen == 19 )
@@ -9276,15 +9304,20 @@
           {
             v15 = 1;
             pMessageQueue_50CBD0->uNumMessages = 1;
-            goto LABEL_173;
+            //goto LABEL_173;
+            pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113;
+            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+            ++pMessageQueue_50CBD0->uNumMessages;
+            goto LABEL_175;
           }
           pMessageQueue_50CBD0->uNumMessages = 0;
         }
         if ( (signed int)v15 >= 40 )
           goto LABEL_175;
-LABEL_173:
+//LABEL_173:
         pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113;
-LABEL_174:
+//LABEL_174:
         pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
         *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
         ++pMessageQueue_50CBD0->uNumMessages;
--- a/mm7_data.h	Thu Jan 17 09:24:40 2013 +0600
+++ b/mm7_data.h	Thu Jan 17 16:24:25 2013 +0600
@@ -1823,13 +1823,13 @@
 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer);
 void __cdecl sub_412AF9();
 void __cdecl sub_412B58();
-char __cdecl sub_412E85();
-void __cdecl DrawSpellbook_Quests();
-void __cdecl DrawSpellbook_Autonotes();
-char *__cdecl DrawSpellbook_Map();
-void __thiscall DrawSpellbook(unsigned int uBook); // idb
+char __cdecl DrawBook_History();
+void __cdecl DrawBook_Quests();
+void __cdecl DrawBook_Autonotes();
+char *__cdecl DrawBook_Maps();
+void __thiscall SellectDrawBook(unsigned int uBook); // idb
 char *__cdecl GetDayPart();
-char __cdecl DrawSpellbook_Calendar();
+char __cdecl DrawBook_Calendar();
 void __cdecl SetAttributeNames();
 void __cdecl uGameUIFontMain_initialize();
 void __cdecl uGameUIFontShadow_initialize();