changeset 3:bf31c505f4d3

13.01.13(MainMenuMessageProc())
author Ritor1
date Sun, 13 Jan 2013 17:41:47 +0600
parents 89240115d392
children 8e33efd39355 07b2770e7891
files GUIWindow.cpp GUIWindow.h Keyboard.cpp Keyboard.h MM7.sdf MM7.suo VideoPlayer.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp
diffstat 10 files changed, 99 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sun Jan 13 01:47:51 2013 +0600
+++ b/GUIWindow.cpp	Sun Jan 13 17:41:47 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	Sun Jan 13 01:47:51 2013 +0600
+++ b/GUIWindow.h	Sun Jan 13 17:41:47 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,
@@ -151,7 +153,7 @@
   UIMSG_ArrowUp = 0xA2,
   UIMSG_DownArrow = 0xA3,
   UIMSG_LoadSlot = 0xA4,
-  UIMSG_A5 = 0xA5,
+  UIMSG_SelectLoadSlot = 0xA5,
   UIMSG_Cancel = 0xA6,
   UIMSG_A7 = 0xA7,
   UIMSG_A8 = 0xA8,
--- a/Keyboard.cpp	Sun Jan 13 01:47:51 2013 +0600
+++ b/Keyboard.cpp	Sun Jan 13 17:41:47 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	Sun Jan 13 01:47:51 2013 +0600
+++ b/Keyboard.h	Sun Jan 13 17:41:47 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();
 
Binary file MM7.sdf has changed
Binary file MM7.suo has changed
--- a/VideoPlayer.cpp	Sun Jan 13 01:47:51 2013 +0600
+++ b/VideoPlayer.cpp	Sun Jan 13 17:41:47 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
@@ -409,7 +409,7 @@
               TranslateMessage(&Msg);
               DispatchMessageW(&Msg);
             }
-            GUI_MainMenuMessageProc();
+            GUI_MainMenuMessageProc();// проверка внешних сообщений
             if ( !pVideoPlayer->pSmackerMovie )
               break;
             if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule )
@@ -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	Sun Jan 13 01:47:51 2013 +0600
+++ b/mm7_2.cpp	Sun Jan 13 17:41:47 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;
         }
       }
--- a/mm7_4.cpp	Sun Jan 13 01:47:51 2013 +0600
+++ b/mm7_4.cpp	Sun Jan 13 17:41:47 2013 +0600
@@ -5899,7 +5899,7 @@
       do
       {
         if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ 
-			&& uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
+            && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
         {
           pControlParam = pControlsHead->uControlParam;
           if ( (signed int)pNumMessage < 40 )
@@ -6234,7 +6234,7 @@
       if ( a5 >= (signed __int16)pTexture2.uHeight )
         SetCurrentMenuID(MENU_MAIN);
       pRenderer->Present();
-	  pCurrentScreen = 0;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc()
+      pCurrentScreen = 0;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc()
       GUI_MainMenuMessageProc();
     }
   }
--- a/mm7_5.cpp	Sun Jan 13 01:47:51 2013 +0600
+++ b/mm7_5.cpp	Sun Jan 13 17:41:47 2013 +0600
@@ -500,7 +500,7 @@
           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 != pSaveListPosition + uMessageParam )
@@ -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:
@@ -3133,7 +3133,7 @@
     do
     {
       pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex);
-      switch (pUIMessageType) //создание окон из главного меню
+      switch (pUIMessageType) // For buttons of window MainMenu
       {
         case UIMSG_MainMenu_ShowPartyCreationWnd:// Окно создания группы
         {
@@ -3159,17 +3159,18 @@
           SetCurrentMenuID(MENU_FINISHED);
         }
         continue;
+      }
+
+      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)
@@ -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;
+          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 )
+        }
+        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_Cancel )// Нажатие кнопки Отмена
-          {
-            GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0);
-            continue;
-          }
-          if ( pUIMessageType == UIMSG_SelectFacePlayerBack )
+          if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) // Выбор лица персонажа кнопка назад
           {
             pPlayer = &pParty->pPlayers[uNum];
             v12 = (char)((int)pPlayer->uFace - 1) < 0;
@@ -3229,12 +3253,11 @@
               (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);
+            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;
@@ -3251,19 +3274,22 @@
             (int)pCreationUI_BtnPressRight[v21], 1);
             //v0 = pAudioPlayer;
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0);
-            v22 = pPlayer;
-            v22->PlaySound(102, 0);
+            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:
           v40 = 10;
@@ -3272,20 +3298,9 @@
           SetCurrentMenuID((MENU_STATE)v2);
           continue;
         }
-        if ( pUIMessageType == 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;
-        }
-        if ( pUIMessageType == UIMSG_6B )
-        {
+        if ( pUIMessageType == UIMSG_6B )//unknow
+        {
+          __debugbreak();
           if ( pCurrentScreen )
           {
             pGUIWindow_CurrentMenu->Release();
@@ -3296,14 +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;
+          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_CloseBook )
+        if ( pUIMessageType == UIMSG_Escape )
         {
           if ( ptr_507BDC )
           {
@@ -3400,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();
@@ -3434,16 +3449,6 @@
             pCurrentPlayer->PlaySound(102, 0);
             continue;
           }
-          if ( pUIMessageType == 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;
-          }
         }
       }
       else
@@ -3460,7 +3465,7 @@
                                              + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
           continue;
         }
-        if ( (signed int)pUIMessageType > UIMSG_3C )
+        if ( (signed int)pUIMessageType > UIMSG_PlayerCreationChangeName )
         {
           if ( pUIMessageType == UIMSG_PlayerCreationClickPlus )
           {
@@ -3527,28 +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;
-              {
-                v40 = 10;
-                v2 = v40;
-                SetCurrentMenuID((MENU_STATE)v2);
-                continue;
-              }
+            case UIMSG_3A://unknow
+              __debugbreak();
+              v40 = 10;
+              v2 = v40;
+              SetCurrentMenuID((MENU_STATE)v2);
               break;
           }
         }