diff mm7_5.cpp @ 3:bf31c505f4d3

13.01.13(MainMenuMessageProc())
author Ritor1
date Sun, 13 Jan 2013 17:41:47 +0600
parents 89240115d392
children 8e33efd39355
line wrap: on
line diff
--- 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;
           }
         }