Mercurial > might-and-magic-trilogy
diff mm7_5.cpp @ 208:af624eaf2fc5 tip
14.01.13
author | Ritor1 |
---|---|
date | Mon, 14 Jan 2013 10:39:01 +0600 |
parents | 8e3fea954768 |
children |
line wrap: on
line diff
--- 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; } }