changeset 208:af624eaf2fc5 tip

14.01.13
author Ritor1
date Mon, 14 Jan 2013 10:39:01 +0600
parents 8e3fea954768
children
files GUIButton.cpp GUIButton.h GUIWindow.cpp GUIWindow.h GameUIs.cpp Keyboard.cpp Keyboard.h SaveLoad.cpp VideoPlayer.cpp mm7_2.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 13 files changed, 205 insertions(+), 226 deletions(-) [+]
line wrap: on
line diff
--- a/GUIButton.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/GUIButton.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -96,10 +96,10 @@
 struct GUIButton *pBtn_SliderLeft;
 
 
-struct GUIButton *ptr_69BD58;
-struct GUIButton *ptr_69BD5C;
-struct GUIButton *ptr_69BD60;
-struct GUIButton *ptr_69BD64;
+struct GUIButton *pBtnDownArrow;
+struct GUIButton *pBtnArrowUp;
+struct GUIButton *pBtnCancel;
+struct GUIButton *pBtnLoadSlot;
 
 
 GUIButton *pCreationUI_BtnPressRight2[4];
--- a/GUIButton.h	Thu Jan 10 18:03:33 2013 +0600
+++ b/GUIButton.h	Mon Jan 14 10:39:01 2013 +0600
@@ -122,10 +122,10 @@
 extern struct GUIButton *pBtn_SliderLeft;
 
 
-extern struct GUIButton *ptr_69BD58;
-extern struct GUIButton *ptr_69BD5C;
-extern struct GUIButton *ptr_69BD60;
-extern struct GUIButton *ptr_69BD64;
+extern struct GUIButton *pBtnDownArrow;
+extern struct GUIButton *pBtnArrowUp;
+extern struct GUIButton *pBtnCancel;
+extern struct GUIButton *pBtnLoadSlot;
 
 
 extern GUIButton *pCreationUI_BtnPressRight2[4];
--- a/GUIWindow.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/GUIWindow.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -2385,7 +2385,7 @@
           break;
         case WINDOW_13:
           dword_506978 = pCurrentScreen;
-          pKeyActionMap->_459E5A(0, 15, pWindow);
+          pKeyActionMap->EnterText(0, 15, pWindow);
           pCurrentScreen = 19;
           break;
       }
--- a/GUIWindow.h	Thu Jan 10 18:03:33 2013 +0600
+++ b/GUIWindow.h	Mon Jan 14 10:39:01 2013 +0600
@@ -111,12 +111,14 @@
 {
   UIMSG_00 = 0x0,
   UIMSG_ChangeGameState = 0x5,
+  UIMSG_11 = 0x11,
   UIMSG_PlayArcomage = 0x1D,
   UIMSG_MainMenu_ShowPartyCreationWnd = 0x36,
   UIMSG_MainMenu_ShowLoadWindow = 0x37,
   UIMSG_ShowCredits = 0x38,
   UIMSG_ExitToWindows = 0x39,
-  UIMSG_3C = 0x3C,
+  UIMSG_3A = 0x3A,
+  UIMSG_PlayerCreationChangeName = 0x3C,
   UIMSG_PlayerCreationClickPlus = 0x3E,
   UIMSG_PlayerCreationClickMinus = 0x3F,
   UIMSG_PlayerCreationSelectActiveSkill = 0x40,
@@ -137,7 +139,7 @@
   UIMSG_SelectCharacter = 0x6E,
   UIMSG_ChangeSoundVolume = 0x6F,
   UIMSG_ChangeMusicVolume = 0x70,
-  UIMSG_CloseBook = 0x71,
+  UIMSG_Escape = 0x71,
   UIMSG_PlayerCreationSelectQuality = 0x76,
   UIMSG_SkillUp = 0x79,
   UIMSG_StartNewGame = 0x7C,
@@ -148,11 +150,11 @@
   UIMSG_PlayerCreationVoiceBack = 0x90,
   UIMSG_PlayerCreationVoiceForward = 0x91,
   UIMSG_StartNPCDialogue = 0xA1,
-  UIMSG_A2 = 0xA2,
-  UIMSG_A3 = 0xA3,
-  UIMSG_A4 = 0xA4,
-  UIMSG_A5 = 0xA5,
-  UIMSG_A6 = 0xA6,
+  UIMSG_ArrowUp = 0xA2,
+  UIMSG_DownArrow = 0xA3,
+  UIMSG_LoadSlot = 0xA4,
+  UIMSG_SelectLoadSlot = 0xA5,
+  UIMSG_Cancel = 0xA6,
   UIMSG_A7 = 0xA7,
   UIMSG_A8 = 0xA8,
   UIMSG_A9 = 0xA9,
--- a/GameUIs.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/GameUIs.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -71,9 +71,9 @@
   pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..."
   pRenderer->Present();
   pSavegameList->Initialize(0);
-  if ( dword_6A0C9C > (signed int)uNumSavegameFiles )
+  if ( pSaveListPosition > (signed int)uNumSavegameFiles )
   {
-    dword_6A0C9C = 0;
+    pSaveListPosition = 0;
     uLoadGameUI_SelectedSlot = 0;
   }
   pLODFile.AllocSubIndicesAndIO(0x12C, 0);
@@ -99,7 +99,7 @@
       fread(&pSavegameHeader[i], 0x64, 1, v4);
     if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
       strcpy(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[16]);// "Autosave"
-	v5 = pLODFile.FindContainer("image.pcx", true);
+    v5 = pLODFile.FindContainer("image.pcx", true);
     if ( !v5 )
     {
       pSavegameUsedSlots[i] = 0;
@@ -147,13 +147,13 @@
   pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, 0xA5, 4, 0, "", 0);
   pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, 0xA5, 5, 0, "", 0);
   pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, 0xA5, 6, 0, "", 0);
-  ptr_69BD64 = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, 0xA4, 0, 0, "",
+  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, 0xA4, 0, 0, "",
                  (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
-  ptr_69BD60 = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, 0xA6, 0, 0, "",
+  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, 0xA6, 0, 0, "",
                  (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
-  ptr_69BD5C = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, 0xA2, 0, 0, "",
+  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, 0xA2, 0, 0, "",
                  (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
-  ptr_69BD58 = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "",
+  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "",
          (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
   v16 = -1;
   //ptr_69BD58 = v7;
@@ -264,58 +264,13 @@
   pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, 0xA5u, 4u, 0, "", 0);
   pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, 0xA5u, 5u, 0, "", 0);
   pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, 0xA5u, 6u, 0, "", 0);
-  ptr_69BD64 = pGUIWindow_CurrentMenu->CreateButton(
-                 0xF1u,
-                 0x12Eu,
-                 0x69u,
-                 0x28u,
-                 1,
-                 0,
-                 0xA4u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0),
-                 0);
-  ptr_69BD60 = pGUIWindow_CurrentMenu->CreateButton(
-                 0x15Eu,
-                 0x12Eu,
-                 0x69u,
-                 0x28u,
-                 1,
-                 0,
-                 0xA6u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0),
-                 0);
-  ptr_69BD5C = pGUIWindow_CurrentMenu->CreateButton(
-                 0xD7u,
-                 0xC7u,
-                 0x11u,
-                 0x11u,
-                 1,
-                 0,
-                 0xA2u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0),
-                 0);
-  v7 = pGUIWindow_CurrentMenu->CreateButton(
-         0xD7u,
-         0x143u,
-         0x11u,
-         0x11u,
-         1,
-         0,
-         0xA3u,
-         0x22u,
-         0,
-         "",
-         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0),
-         0);
+  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, 0xA4u, 0, 0, "",
+                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
+  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, 0xA6u, 0, 0, "",
+                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
+  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, 0xA2u, 0, 0, "",
+         (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
+  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, 0xA3u, 0x22u, 0, "",
+         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
   v12 = -1;
-  ptr_69BD58 = v7;
 }
\ No newline at end of file
--- a/Keyboard.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/Keyboard.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -111,7 +111,7 @@
 }
 
 //----- (00459E5A) --------------------------------------------------------
-void KeyboardActionMapping::_459E5A(int a2, int a3, GUIWindow *pWindow)
+void KeyboardActionMapping::EnterText(int a2, int pNumWord, GUIWindow *pWindow)
 {
   KeyboardActionMapping *v4; // esi@1
 
@@ -122,7 +122,7 @@
     v4->field_204 = 2;
   else
     v4->field_204 = 1;
-  v4->field_FC = a3;
+  v4->field_FC = pNumWord;
   v4->pWindow = pWindow;
   pWindow->field_40 = 1;
   if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) )
--- a/Keyboard.h	Thu Jan 10 18:03:33 2013 +0600
+++ b/Keyboard.h	Mon Jan 14 10:39:01 2013 +0600
@@ -57,7 +57,7 @@
   void StoreMappings();
   bool _459F10(unsigned int a2);
   void _459ED1(int a2);
-  void _459E5A(int a2, int a3, struct GUIWindow *pWindow);
+  void EnterText(int a2, int a3, struct GUIWindow *pWindow);
   void ResetKeys();
   void SetDefaultMapping();
 
--- a/SaveLoad.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/SaveLoad.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -670,11 +670,11 @@
 void SavegameList::Initialize(unsigned int bHideEmptySlots)
 {
     memset(pSavegameList, 0, 0x3138);
-	uNumSavegameFiles = 0;
+    uNumSavegameFiles = 0;
 
   _chdir("saves");
   {
-    if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 )
+    if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 ) // AutoSave.MM7
       strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]);
 
     for (uint i = 0; i < 40; ++i)
--- a/VideoPlayer.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/VideoPlayer.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -334,7 +334,7 @@
 
 
 //----- (004BE70E) --------------------------------------------------------
-void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4)
+void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int uGameState)
 {
   int v4; // ebp@1
   const char *pName; // edi@1
@@ -418,8 +418,8 @@
         }
       }
     }
-    if ( a4 == 1 )
-      pCurrentScreen = 0;
+    if ( uGameState == GAME_FINISHED )
+      pCurrentScreen = 0;//MainMenuScreen
     pVideoPlayer->bPlayingMovie = 0;
     ShowCursor(1);
     if ( pCurrentScreen == 16 )//окно видео ролика 
--- a/mm7_2.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/mm7_2.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -3852,7 +3852,7 @@
     if ( v3 == 22 )
     {
       if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 )
-        pKeyActionMap->_459E5A(1, 10, v8);
+        pKeyActionMap->EnterText(1, 10, v8);
       return;
     }
     if ( v3 != 23 && v3 != 30 )
@@ -4106,7 +4106,7 @@
         }
         if ( v55 == 100 )
         {
-          pKeyActionMap->_459E5A(1, 10, v8);
+          pKeyActionMap->EnterText(1, 10, v8);
           goto LABEL_196;
         }
       }
@@ -11572,8 +11572,8 @@
     else
       pSaveFiles = uNumSavegameFiles;
     a4 = 199;
-    pFilesID = dword_6A0C9C;
-    pSlotName = (const char *)(&pSavegameHeader[dword_6A0C9C]);//draw name for save slot
+    pFilesID = pSaveListPosition;
+    pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot
     do
     {
       if ( pFilesID >= (signed int)pSaveFiles )
@@ -14033,10 +14033,9 @@
          break;
         }
         if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD) //??? неизвестно что это
-          __debugbreak();
-        /*{
+        {
           uGameState = 0;
-        }*/
+        }
         else
          __debugbreak();
         /*{
@@ -14067,10 +14066,10 @@
             pAsyncMouse->Resume();
           if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
             pAsyncKeyboard->Resume();
-        }
+        }*/
 //LABEL_48:
-//        pGame->Loop(); //game
-LABEL_49:*/
+        pGame->Loop(); //game
+LABEL_49:
         if ( uGameState == 3 )
           __debugbreak();
         /*{
--- a/mm7_5.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/mm7_5.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -456,57 +456,57 @@
           v148 = 0;
           pWindowType = (WindowType)8;
           goto LABEL_439;
-        case UIMSG_A2:
-          --dword_6A0C9C;
-          if ( dword_6A0C9C < 0 )
-            dword_6A0C9C = 0;
+        case UIMSG_ArrowUp:
+          --pSaveListPosition;
+          if ( pSaveListPosition < 0 )
+            pSaveListPosition = 0;
           v163 = 0;
           v8 = 199;
-          pButton2 = ptr_69BD5C;
+          pButton2 = pBtnArrowUp;
           //goto LABEL_60;
-		  pWindowType1 = (WindowType)90;
+          pWindowType1 = (WindowType)90;
           v137 = 17;
           v133 = 17;
           v9 = 215;
           goto LABEL_733;
-        case UIMSG_A3:
-          ++dword_6A0C9C;
-          if ( dword_6A0C9C >= uMessageParam )
-            dword_6A0C9C = uMessageParam - 1;
+        case UIMSG_DownArrow:
+          ++pSaveListPosition;
+          if ( pSaveListPosition >= uMessageParam )
+            pSaveListPosition = uMessageParam - 1;
           v163 = 0;
           v8 = 323;
-          pButton2 = ptr_69BD58;
+          pButton2 = pBtnDownArrow;
 //LABEL_60:
           pWindowType1 = (WindowType)90;
           v137 = 17;
           v133 = 17;
           v9 = 215;
           goto LABEL_733;
-        case UIMSG_A6:
+        case UIMSG_Cancel:
           v163 = 0;
           v8 = 302;
-          pButton2 = ptr_69BD60;
+          pButton2 = pBtnCancel;
           v9 = 350;
           pWindowType1 = (WindowType)96;
           v137 = 42;
           v133 = 106;
           goto LABEL_733;
-        case UIMSG_A4:
+        case UIMSG_LoadSlot:
           v163 = 0;
           v8 = 302;
-          pButton2 = ptr_69BD64;
+          pButton2 = pBtnLoadSlot;
           v9 = 241;
           pWindowType1 = (WindowType)94;
           v137 = 42;
           v133 = 106;
           goto LABEL_733;
-        case UIMSG_A5:
+        case UIMSG_SelectLoadSlot:
           if ( pGUIWindow_CurrentMenu->field_40 == v0 )
             pKeyActionMap->_459ED1(0);
-          if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != dword_6A0C9C + uMessageParam )
-          {
-            v10 = dword_6A0C9C + uMessageParam;
-            if ( dword_6BE138 == dword_6A0C9C + uMessageParam )
+          if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
+          {
+            v10 = pSaveListPosition + uMessageParam;
+            if ( dword_6BE138 == pSaveListPosition + uMessageParam )
             {
               if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
               {
@@ -514,7 +514,7 @@
                 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
                 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
                 v11 = pMessageQueue_50CBD0->uNumMessages + 1;
-                v13 = __OFSUB__(pMessageQueue_50CBD0->uNumMessages + 1, 40);
+                v13 = pMessageQueue_50CBD0->uNumMessages + 1 > 40;
                 v12 = (signed int)pMessageQueue_50CBD0->uNumMessages - 39 < 0;
                 ++pMessageQueue_50CBD0->uNumMessages;
                 if ( v12 ^ v13 )
@@ -531,7 +531,7 @@
           }
           else
           {
-            pKeyActionMap->_459E5A(0, 19, pGUIWindow_CurrentMenu);
+            pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
             if ( strcmp((const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pGlobalTXT_LocalizationStrings[72]) )// "Empty"
               strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
             pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
@@ -691,7 +691,7 @@
           if ( dword_506F08 != v0 )
             v14 = uMessageParam + 14;
           dword_506E68 = v14;
-          pKeyActionMap->_459E5A(0, v0, pGUIWindow_CurrentMenu);
+          pKeyActionMap->EnterText(0, v0, pGUIWindow_CurrentMenu);
           goto _continue;
         case UIMSG_ResetKeyMapping:
           v197 = 1;
@@ -1073,7 +1073,7 @@
           pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, (enum WindowType)99, (int)pBtn_History, 0);
           bFlashHistoryBook = 0;
           goto _continue;
-        case UIMSG_CloseBook:
+        case UIMSG_Escape:
           back_to_game();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -2723,7 +2723,7 @@
         case UIMSG_Quit|0x1:
           OnPaperdollLeftClick();
           goto _continue;
-        case UIMSG_CloseBook|0x2:
+        case UIMSG_Escape|0x2:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
           sub_4196A0();
           sub_419379();
@@ -2783,7 +2783,7 @@
           pButton2 = pCharacterScreen_ExitBtn;
           pWindowType1 = (WindowType)97;
           goto LABEL_731;
-        case UIMSG_CloseBook|0x4:
+        case UIMSG_Escape|0x4:
           sub_419379();
           sub_4196A0();
           sub_419220();
@@ -2792,7 +2792,7 @@
             (int)pCharacterScreen_AwardsBtn, 0);
           sub_419100();
           goto _continue;
-		case 71://0x47:
+        case 71://0x47:
           switch ( uMessageParam )
           {
             default:
@@ -3081,7 +3081,7 @@
 void __cdecl GUI_MainMenuMessageProc()
 {
   //AudioPlayer *v0; // ebp@2
-  char *v1; // ebx@2
+  //Player *pPlayer1; // ebx@2
   unsigned int v2; // ecx@18
   void *v3; // edi@21
   signed int v4; // eax@29
@@ -3128,59 +3128,60 @@
   if ( pMessageQueue_50CBD0->uNumMessages )
   {
     //v0 = pAudioPlayer;
-    v1 = (char *)pParty->pPlayers;
-	pPlayer = pParty->pPlayers;
+    //pPlayer1 = pParty->pPlayers;
+    pPlayer = pParty->pPlayers;
     do
     {
       pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex);
-      switch (pUIMessageType)
-      {
-        case UIMSG_MainMenu_ShowPartyCreationWnd:
+      switch (pUIMessageType) // For buttons of window MainMenu
+      {
+        case UIMSG_MainMenu_ShowPartyCreationWnd:// Окно создания группы
         {
           GUIWindow::Create(495, 172, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0);
           SetCurrentMenuID(MENU_NEWGAME);
         }
         continue;
-        case UIMSG_MainMenu_ShowLoadWindow:
+        case UIMSG_MainMenu_ShowLoadWindow:// Окно Загрузка
         {
           GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0);
           SetCurrentMenuID(MENU_SAVELOAD);
         }
         continue;
-        case UIMSG_ShowCredits:
+        case UIMSG_ShowCredits:// Окно Создатели
         {
           GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0);
           SetCurrentMenuID(MENU_CREDITS);
         }
         continue;
-        case UIMSG_ExitToWindows:
+        case UIMSG_ExitToWindows:// Окно Выход
         {
           GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0);
           SetCurrentMenuID(MENU_FINISHED);
         }
         continue;
-        case UIMSG_LoadGame:
+      }
+
+      switch (pUIMessageType) // For buttons of window LoadGame
+      {
+        case UIMSG_LoadGame:// Процесс загрузки
         {
           if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
             continue;
           SetCurrentMenuID(MENU_LOAD);
-        }
-        continue;
-      }
-      switch (pUIMessageType)
-      {
-        case UIMSG_A5:   // WINDOW_5A
+          continue;
+        }
+        case UIMSG_SelectLoadSlot:   // Выбранный слот сохранёнки
         {
             //main menu save/load wnd   clicking on savegame lines
           if (pGUIWindow_CurrentMenu->field_40 == 1)
             pKeyActionMap->_459ED1(0);
-          if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != uNum + dword_6A0C9C )
+          if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != uNum + pSaveListPosition )
           {
             //load clicked line
-              v26 = uNum + dword_6A0C9C;
-              if ( dword_6BE138 == uNum + dword_6A0C9C )
+              v26 = uNum + pSaveListPosition;
+              if ( dword_6BE138 == uNum + pSaveListPosition )
               {
-                pMessageQueue_50CBD0->SendMessage(UIMSG_A4, 0, 0);
+                pMessageQueue_50CBD0->SendMessage(UIMSG_LoadSlot, 0, 0);
                 pMessageQueue_50CBD0->SendMessage(UIMSG_LoadGame, 0, 0);
               }
               uLoadGameUI_SelectedSlot = v26;
@@ -3189,28 +3190,51 @@
           else
           {
             //typing in the line
-              pKeyActionMap->_459E5A(0, 19, pGUIWindow_CurrentMenu);
+              pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
               strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
               pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
           }
-        }
-        continue;
-        case UIMSG_A4:
-        {
-          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)ptr_69BD64, 0);
-        }
+          continue;
+        }
+        case UIMSG_LoadSlot: // Нажатие на слот в окне Загрузка
+        {
+          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0);
         continue;
-      }
-      if ( (signed int)pUIMessageType > UIMSG_PlayerCreationRemoveDownSkill )
-      {
-        if ( pUIMessageType > UIMSG_A3 )
-        {
-          if ( pUIMessageType == UIMSG_A6 )
-          {
-            GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)ptr_69BD60, 0);
-            continue;
-          }
-          if ( pUIMessageType == UIMSG_SelectFacePlayerBack )
+        }
+        case UIMSG_DownArrow://нажатие стрелки вниз
+        {
+          ++pSaveListPosition;
+          if ( pSaveListPosition >= uNum )
+            pSaveListPosition = uNum - 1;
+          if ( pSaveListPosition < 1 )
+            pSaveListPosition = 0;
+          pWindow = pGUIWindow_CurrentMenu;
+          v8 = pGUIWindow_CurrentMenu->uFrameY + 323;
+          GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0);
+          continue;
+        }
+        case UIMSG_Cancel:// Нажатие кнопки Отмена
+        {
+          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0);
+          continue;
+        }
+        case UIMSG_ArrowUp:// Кнопка Вверх
+        {
+          --pSaveListPosition;
+          if ( pSaveListPosition < 0 )
+            pSaveListPosition = 0;
+          pWindow = pGUIWindow_CurrentMenu;
+          v8 = pGUIWindow_CurrentMenu->uFrameY + 197;
+          GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0);
+          continue;
+        }
+      }
+
+      if ( (signed int)pUIMessageType > UIMSG_PlayerCreationRemoveDownSkill )// For button of window PlayerCreation
+      {
+        if ( pUIMessageType > UIMSG_DownArrow )
+        {
+          if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) // Выбор лица персонажа кнопка назад
           {
             pPlayer = &pParty->pPlayers[uNum];
             v12 = (char)((int)pPlayer->uFace - 1) < 0;
@@ -3229,15 +3253,14 @@
               (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1);
             //v0 = pAudioPlayer;
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0.0, 0);
-            v22 = pPlayer;
-            v22->PlaySound(102, 0);
-            v1 = (char *)pParty->pPlayers;
+            pPlayer->PlaySound(102, 0);
+            //v1 = (char *)pParty->pPlayers;
             continue;
           }
-          if ( pUIMessageType == UIMSG_SelectFacePlayerForward )
+          if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) // выбор лица персонажа кнопка вперёд
           {
             pPlayer = &pParty->pPlayers[uNum];
-			v20 = (char)((int)pPlayer->uFace + 1) % 20;
+            v20 = (char)((int)pPlayer->uFace + 1) % 20;
             pPlayer->uFace = v20;
             pPlayer->uVoiceID = v20;
             pPlayer->SetInitialStats();
@@ -3248,45 +3271,36 @@
                                                       % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
             uPlayerCreationUI_SelectedCharacter = v21;
             GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (enum WindowType)92,
-			  (int)pCreationUI_BtnPressRight[v21], 1);
+            (int)pCreationUI_BtnPressRight[v21], 1);
             //v0 = pAudioPlayer;
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0);
-            v22 = pPlayer;
-            v22->PlaySound(102, 0);
-            v1 = (char *)pParty->pPlayers;
+            pPlayer->PlaySound(102, 0);
+            //v1 = (char *)pParty->pPlayers;
             continue;
           }
-          if ( pUIMessageType == UIMSG_AD )
-          {
+          if ( pUIMessageType == UIMSG_AD )//unknow
+          {
+            __debugbreak();
             GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0);
-          SetCurrentMenuID(MENU_LOAD);
-          continue;
-          }
-          if ( pUIMessageType != UIMSG_AE )
+            SetCurrentMenuID(MENU_LOAD);
             continue;
+          }
+          if ( pUIMessageType != UIMSG_AE )//unknow
+          {
+            __debugbreak();
+            continue;
+          }
           GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0);
-LABEL_114:
+//LABEL_114:
           v40 = 10;
-LABEL_89:
+//LABEL_89:
           v2 = v40;
           SetCurrentMenuID((MENU_STATE)v2);
           continue;
         }
-        if ( pUIMessageType == UIMSG_A3 )
-        {
-          ++dword_6A0C9C;
-          if ( dword_6A0C9C >= uNum )
-            dword_6A0C9C = uNum - 1;
-          if ( dword_6A0C9C < 1 )
-            dword_6A0C9C = 0;
-          pWindow = pGUIWindow_CurrentMenu;
-          v43 = 0;
-          v39 = (int)ptr_69BD58;
-          v8 = pGUIWindow_CurrentMenu->uFrameY + 323;
-          goto LABEL_105;
-        }
-        if ( pUIMessageType == UIMSG_6B )
-        {
+        if ( pUIMessageType == UIMSG_6B )//unknow
+        {
+          __debugbreak();
           if ( pCurrentScreen )
           {
             pGUIWindow_CurrentMenu->Release();
@@ -3297,10 +3311,14 @@
           GUIWindow::Create(602, 450, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0);
           if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
             continue;
-          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseBook;
-          goto LABEL_93;
-        }
-        if ( pUIMessageType == UIMSG_CloseBook )
+          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
+          //goto LABEL_93;
+          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+          *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+          ++pMessageQueue_50CBD0->uNumMessages;
+          continue;
+        }
+        if ( pUIMessageType == UIMSG_Escape )
         {
           if ( ptr_507BDC )
           {
@@ -3322,17 +3340,23 @@
             if (GetCurrentMenuID() == MENU_7)
             {
               v40 = 6;
-              goto LABEL_89;
+              //goto LABEL_89;
+              v2 = v40;
+              SetCurrentMenuID((MENU_STATE)v2);
+              continue;
             }
             if (GetCurrentMenuID() == MENU_Credits)
             {
               v40 = 11;
-              goto LABEL_89;
+              //goto LABEL_89;
+              v2 = v40;
+              SetCurrentMenuID((MENU_STATE)v2);
+              continue;
             }
             if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
             {
               pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)5;
-LABEL_93:
+//LABEL_93:
               pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
               *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
               ++pMessageQueue_50CBD0->uNumMessages;
@@ -3352,7 +3376,7 @@
             pTexture_PCX.Load("title.pcx", 0);
             SetCurrentMenuID(MENU_MAIN);
             v15 = 1;
-LABEL_81:
+//LABEL_81:
             pGUIWindow_CurrentMenu->Release();
             pGUIWindow2->Release();
             pGUIWindow2 = 0;
@@ -3368,7 +3392,16 @@
           else
           {
             if ( pCurrentScreen != 27 )
-              goto LABEL_81;
+              //goto LABEL_81;
+            {
+              pGUIWindow_CurrentMenu->Release();
+              pGUIWindow2->Release();
+              pGUIWindow2 = 0;
+              pEventTimer->Resume();
+              pCurrentScreen = 0;
+              viewparams->bRedrawGameUI = v15;
+              continue;
+            }
             //VideoPlayer::dtor();
           }
         }
@@ -3382,13 +3415,13 @@
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
-          if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack )
+          if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack )// есть проблема со звуками
           {
             pCurrentPlayer = &pPlayer[uNum];
             pSex = pCurrentPlayer->GetSexByVoice();
             do
             {
-              v12 = (/*(*/pCurrentPlayer->uVoiceID-- - 1/*) & 0x80000000u */) != 0;
+              v12 = (pCurrentPlayer->uVoiceID-- - 1) == 0;
               if ( v12 )
                 pCurrentPlayer->uVoiceID = 19;
               v13 = pCurrentPlayer->GetSexByVoice();
@@ -3416,19 +3449,6 @@
             pCurrentPlayer->PlaySound(102, 0);
             continue;
           }
-          if ( pUIMessageType == UIMSG_A2 )
-          {
-            --dword_6A0C9C;
-            if ( dword_6A0C9C < 0 )
-              dword_6A0C9C = 0;
-            pWindow = pGUIWindow_CurrentMenu;
-            v43 = 0;
-            v39 = (int)ptr_69BD5C;
-            v8 = pGUIWindow_CurrentMenu->uFrameY + 197;
-LABEL_105:
-            GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, v39, v43);
-            continue;
-          }
         }
       }
       else
@@ -3437,7 +3457,7 @@
         {
           uPlayerCreationUI_SelectedCharacter = uNum;
           v41 = 3;
-          v1 = (char *)pParty->pPlayers;
+          //v1 = (char *)pParty->pPlayers;
           v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7
              + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5;
@@ -3445,7 +3465,7 @@
                                              + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
           continue;
         }
-        if ( (signed int)pUIMessageType > UIMSG_3C )
+        if ( (signed int)pUIMessageType > UIMSG_PlayerCreationChangeName )
         {
           if ( pUIMessageType == UIMSG_PlayerCreationClickPlus )
           {
@@ -3512,22 +3532,25 @@
         {
           switch ( pUIMessageType )
           {
-            case 60:
+            case UIMSG_PlayerCreationChangeName:
               pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
               v3 = (void *)uNum;
               uPlayerCreationUI_SelectedCharacter = uNum;
-              pKeyActionMap->_459E5A(0, 15, pGUIWindow_CurrentMenu);
+              pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
               pGUIWindow_CurrentMenu->ptr_1C = v3;
               break;
-            case 5:
+            case UIMSG_ChangeGameState:
               uGameState = 1;
               break;
-            case 17:
+            case UIMSG_11://unknow
+              __debugbreak();
               pMouse->SetCursorBitmap("MICON2");
               break;
-            default:
-              if ( pUIMessageType == 58 )
-                goto LABEL_114;
+            case UIMSG_3A://unknow
+              __debugbreak();
+              v40 = 10;
+              v2 = v40;
+              SetCurrentMenuID((MENU_STATE)v2);
               break;
           }
         }
--- a/mm7_data.cpp	Thu Jan 10 18:03:33 2013 +0600
+++ b/mm7_data.cpp	Mon Jan 14 10:39:01 2013 +0600
@@ -1555,7 +1555,7 @@
 unsigned int uTextureID_loadsave;
 _UNKNOWN _69FBB4_ptr_iterator_end; // weak
 _UNKNOWN unk_6A0758; // weak
-int dword_6A0C9C; // weak
+int pSaveListPosition; // weak
 unsigned int uLoadGameUI_SelectedSlot;
 HWND hInsertCDWindow; // idb
 int uCPUSpeed; // weak
--- a/mm7_data.h	Thu Jan 10 18:03:33 2013 +0600
+++ b/mm7_data.h	Mon Jan 14 10:39:01 2013 +0600
@@ -1447,7 +1447,7 @@
 extern unsigned int uTextureID_loadsave;
 extern _UNKNOWN _69FBB4_ptr_iterator_end; // weak
 extern _UNKNOWN unk_6A0758; // weak
-extern int dword_6A0C9C; // weak
+extern int pSaveListPosition; // weak
 extern unsigned int uLoadGameUI_SelectedSlot;
 extern HWND hInsertCDWindow; // idb
 extern int uCPUSpeed; // weak