comparison mm7_5.cpp @ 960:9a5db2cf999a

UIMSG and WINDOW_Type
author Ritor1
date Sat, 04 May 2013 17:45:17 +0600
parents f8dd764fb7d7
children 5a12082c803d
comparison
equal deleted inserted replaced
959:f8dd764fb7d7 960:9a5db2cf999a
436 dword_6BE138 = 132; 436 dword_6BE138 = 132;
437 } 437 }
438 stru_506E40.Release(); 438 stru_506E40.Release();
439 continue; 439 continue;
440 case UIMSG_80: 440 case UIMSG_80:
441 __debugbreak;
442 pIcons_LOD->_40F9C5(); 441 pIcons_LOD->_40F9C5();
443 pIcons_LOD->_4114F2(); 442 pIcons_LOD->_4114F2();
444 pGUIWindow_CurrentMenu->Release(); 443 pGUIWindow_CurrentMenu->Release();
445 pCurrentScreen = SCREEN_OPTIONS; 444 pCurrentScreen = SCREEN_OPTIONS;
446 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); 445 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0);
921 if ( pCurrentScreen ) 920 if ( pCurrentScreen )
922 pGUIWindow_CurrentMenu->Release(); 921 pGUIWindow_CurrentMenu->Release();
923 pEventTimer->Pause(); 922 pEventTimer->Pause();
924 pAudioPlayer->StopChannels(-1, -1); 923 pAudioPlayer->StopChannels(-1, -1);
925 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); 924 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0);
926 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_63, (int)pBtn_Quests, 0); 925 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0);
927 bFlashQuestBook = 0; 926 bFlashQuestBook = 0;
928 continue; 927 continue;
929 case UIMSG_OpenAutonotes: 928 case UIMSG_OpenAutonotes:
930 if ( pMessageQueue_50CBD0->uNumMessages ) 929 if ( pMessageQueue_50CBD0->uNumMessages )
931 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 930 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
932 if ( pCurrentScreen ) 931 if ( pCurrentScreen )
933 pGUIWindow_CurrentMenu->Release(); 932 pGUIWindow_CurrentMenu->Release();
934 pEventTimer->Pause(); 933 pEventTimer->Pause();
935 pAudioPlayer->StopChannels(-1, -1); 934 pAudioPlayer->StopChannels(-1, -1);
936 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); 935 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0);
937 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_63, (int)pBtn_Autonotes, 0); 936 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0);
938 bFlashAutonotesBook = 0; 937 bFlashAutonotesBook = 0;
939 continue; 938 continue;
940 case UIMSG_OpenMapBook: 939 case UIMSG_OpenMapBook:
941 if ( pMessageQueue_50CBD0->uNumMessages ) 940 if ( pMessageQueue_50CBD0->uNumMessages )
942 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 941 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
944 pGUIWindow_CurrentMenu->Release(); 943 pGUIWindow_CurrentMenu->Release();
945 pEventTimer->Pause(); 944 pEventTimer->Pause();
946 viewparams->sViewCenterX = pParty->vPosition.x; 945 viewparams->sViewCenterX = pParty->vPosition.x;
947 viewparams->sViewCenterY = pParty->vPosition.y; 946 viewparams->sViewCenterY = pParty->vPosition.y;
948 pAudioPlayer->StopChannels(-1, -1); 947 pAudioPlayer->StopChannels(-1, -1);
949 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); 948 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0);
950 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0); 949 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0);
951 continue; 950 continue;
952 case UIMSG_OpenCalendar: 951 case UIMSG_OpenCalendar:
953 if ( pMessageQueue_50CBD0->uNumMessages ) 952 if ( pMessageQueue_50CBD0->uNumMessages )
954 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 953 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
955 if ( pCurrentScreen ) 954 if ( pCurrentScreen )
956 pGUIWindow_CurrentMenu->Release(); 955 pGUIWindow_CurrentMenu->Release();
957 pEventTimer->Pause(); 956 pEventTimer->Pause();
958 pAudioPlayer->StopChannels(-1, -1); 957 pAudioPlayer->StopChannels(-1, -1);
959 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); 958 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0);
960 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_63, (int)pBtn_Calendar, 0); 959 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0);
961 continue; 960 continue;
962 case UIMSG_OpenHistoryBook: 961 case UIMSG_OpenHistoryBook:
963 if ( pMessageQueue_50CBD0->uNumMessages ) 962 if ( pMessageQueue_50CBD0->uNumMessages )
964 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 963 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
965 if ( pCurrentScreen ) 964 if ( pCurrentScreen )
966 pGUIWindow_CurrentMenu->Release(); 965 pGUIWindow_CurrentMenu->Release();
967 pEventTimer->Pause(); 966 pEventTimer->Pause();
968 pAudioPlayer->StopChannels(-1, -1); 967 pAudioPlayer->StopChannels(-1, -1);
969 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); 968 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0);
970 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_63, (int)pBtn_History, 0); 969 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0);
971 bFlashHistoryBook = 0; 970 bFlashHistoryBook = 0;
972 continue; 971 continue;
973 case UIMSG_Escape:// нажатие Escape and return to game 972 case UIMSG_Escape:// нажатие Escape and return to game
974 back_to_game(); 973 back_to_game();
975 if ( pMessageQueue_50CBD0->uNumMessages ) 974 if ( pMessageQueue_50CBD0->uNumMessages )
1282 pCurrentScreen = SCREEN_GAME; 1281 pCurrentScreen = SCREEN_GAME;
1283 viewparams->bRedrawGameUI = v0; 1282 viewparams->bRedrawGameUI = v0;
1284 pIcons_LOD->_4355F7(); 1283 pIcons_LOD->_4355F7();
1285 continue; 1284 continue;
1286 case SCREEN_E: 1285 case SCREEN_E:
1287 __debugbreak;
1288 pGUIWindow_CurrentMenu->Release(); 1286 pGUIWindow_CurrentMenu->Release();
1289 pCurrentScreen = SCREEN_HOUSE; 1287 pCurrentScreen = SCREEN_HOUSE;
1290 pIcons_LOD->_4114F2(); 1288 pIcons_LOD->_4114F2();
1291 continue; 1289 continue;
1292 case SCREEN_HOUSE: 1290 case SCREEN_HOUSE:
1551 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1549 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1552 dword_50CDC8 = v0; 1550 dword_50CDC8 = v0;
1553 sub_42FBDD(); 1551 sub_42FBDD();
1554 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); 1552 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful);
1555 pVideoPlayer->Unload(); 1553 pVideoPlayer->Unload();
1556 sub_44603D(); 1554 DialogueEnding();
1557 viewparams->bRedrawGameUI = v0; 1555 viewparams->bRedrawGameUI = v0;
1558 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) 1556 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz )
1559 { 1557 {
1560 if ( dword_59117C_teleportx ) 1558 if ( dword_59117C_teleportx )
1561 { 1559 {
1605 } 1603 }
1606 start_event_seq_number = 0; 1604 start_event_seq_number = 0;
1607 if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) 1605 if ( !_strcmpi(byte_6BE3B0, "d05.blv") )
1608 pParty->uTimePlayed += 1474560i64; 1606 pParty->uTimePlayed += 1474560i64;
1609 continue; 1607 continue;
1610 case UIMSG_19C: 1608 case UIMSG_TransitionWindowCloseBtn:
1611 CloseWindowBackground(); 1609 CloseWindowBackground();
1612 pVideoPlayer->Unload(); 1610 pVideoPlayer->Unload();
1613 sub_44603D(); 1611 DialogueEnding();
1614 start_event_seq_number = 0; 1612 start_event_seq_number = 0;
1615 viewparams->bRedrawGameUI = v0; 1613 viewparams->bRedrawGameUI = v0;
1616 continue; 1614 continue;
1617 case UIMSG_CycleCharacters: 1615 case UIMSG_CycleCharacters:
1618 v39 = GetAsyncKeyState(VK_SHIFT); 1616 v39 = GetAsyncKeyState(VK_SHIFT);
1639 if ( pParty->vPosition.y < -22528 ) 1637 if ( pParty->vPosition.y < -22528 )
1640 pParty->vPosition.y = -22528; 1638 pParty->vPosition.y = -22528;
1641 if ( pParty->vPosition.y > 22528 ) 1639 if ( pParty->vPosition.y > 22528 )
1642 pParty->vPosition.y = 22528; 1640 pParty->vPosition.y = 22528;
1643 LABEL_317: 1641 LABEL_317:
1644 sub_44603D(); 1642 DialogueEnding();
1645 pCurrentScreen = SCREEN_GAME; 1643 pCurrentScreen = SCREEN_GAME;
1646 } 1644 }
1647 else 1645 else
1648 { 1646 {
1649 pParty->field_6E4 = 0; 1647 pParty->field_6E4 = 0;
1650 pParty->field_6E0 = 0; 1648 pParty->field_6E0 = 0;
1651 pCastSpellInfo->_427D48(v0); 1649 pCastSpellInfo->_427D48(v0);
1652 sub_44603D(); 1650 DialogueEnding();
1653 pEventTimer->Pause(); 1651 pEventTimer->Pause();
1654 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); 1652 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
1655 ++pGameLoadingUI_ProgressBar->uProgressMax; 1653 ++pGameLoadingUI_ProgressBar->uProgressMax;
1656 SaveGame(v0, 0); 1654 SaveGame(v0, 0);
1657 pGameLoadingUI_ProgressBar->Progress(); 1655 pGameLoadingUI_ProgressBar->Progress();
1909 pAudioPlayer->StopChannels(-1, -1); 1907 pAudioPlayer->StopChannels(-1, -1);
1910 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, 117, 0); 1908 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, 117, 0);
1911 continue; 1909 continue;
1912 1910
1913 case UIMSG_B2: 1911 case UIMSG_B2:
1914 __debugbreak;//UIMSG_B2 -???
1915 bRecallingBeacon = uMessageParam; 1912 bRecallingBeacon = uMessageParam;
1916 v127 = uMessageParam + 204; 1913 v127 = uMessageParam + 204;
1917 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); 1914 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
1918 continue; 1915 continue;
1919 case UIMSG_B4: 1916 case UIMSG_B4:
1944 v158 = (unsigned int)thise; 1941 v158 = (unsigned int)thise;
1945 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" 1942 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
1946 sub_41C0B8_set_status_string(pTmpBuf); 1943 sub_41C0B8_set_status_string(pTmpBuf);
1947 continue; 1944 continue;
1948 case UIMSG_B5: 1945 case UIMSG_B5:
1949 __debugbreak;//UIMSG_B5 - ???
1950 dword_50CDC8 = v0; 1946 dword_50CDC8 = v0;
1951 //goto LABEL_453; 1947 //goto LABEL_453;
1952 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 1948 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1953 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) 1949 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
1954 continue; 1950 continue;
2237 __debugbreak; 2233 __debugbreak;
2238 uGameState = 0; 2234 uGameState = 0;
2239 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); 2235 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
2240 goto LABEL_524; 2236 goto LABEL_524;
2241 case UIMSG_DD: 2237 case UIMSG_DD:
2242 __debugbreak;
2243 LABEL_524: 2238 LABEL_524:
2244 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); 2239 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer);
2245 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); 2240 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
2246 if ( v216.uPropCount == 1 ) 2241 if ( v216.uPropCount == 1 )
2247 { 2242 {
2478 if ( !(pTurnEngine->field_18 & 2) ) 2473 if ( !(pTurnEngine->field_18 & 2) )
2479 //LABEL_577: 2474 //LABEL_577:
2480 _42ECB5_PlayerAttacksActor(); 2475 _42ECB5_PlayerAttacksActor();
2481 continue; 2476 continue;
2482 case UIMSG_ExitRest: 2477 case UIMSG_ExitRest:
2483 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (WindowType)96, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" 2478 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_ExitRestWindow, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
2484 continue; 2479 continue;
2485 case UIMSG_Wait5Minutes: 2480 case UIMSG_Wait5Minutes:
2486 if ( dword_506F14 == 2 ) 2481 if ( dword_506F14 == 2 )
2487 { 2482 {
2488 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" 2483 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
2651 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" 2646 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
2652 v97 = _494820_training_time(pParty->uCurrentHour); 2647 v97 = _494820_training_time(pParty->uCurrentHour);
2653 dword_506F14 = v0; 2648 dword_506F14 = v0;
2654 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; 2649 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute;
2655 continue; 2650 continue;
2656 case UIMSG_4E: 2651 case UIMSG_HintSelectRemoveQuickSpellBtn:
2657 __debugbreak;//UIMSG_4E -???
2658 if ( quick_spell_at_page && byte_506550 ) 2652 if ( quick_spell_at_page && byte_506550 )
2659 { 2653 {
2660 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; 2654 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
2661 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173); 2655 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173);
2662 } 2656 }
2689 } 2683 }
2690 sprintfex(pTmpBuf, v161, v178); 2684 sprintfex(pTmpBuf, v161, v178);
2691 sub_41C0B8_set_status_string(pTmpBuf); 2685 sub_41C0B8_set_status_string(pTmpBuf);
2692 v0 = 1; 2686 v0 = 1;
2693 continue; 2687 continue;
2694 case UIMSG_58: 2688 case UIMSG_ClickInstallRemoveQuickSpellBtn:
2695 __debugbreak;//UIMSG_58 - ???
2696 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_5A, (int)pBtn_InstallRemoveSpell, 0); 2689 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_5A, (int)pBtn_InstallRemoveSpell, 0);
2697 if ( !uActiveCharacter ) 2690 if ( !uActiveCharacter )
2698 continue; 2691 continue;
2699 pPlayer10 = pPlayers[uActiveCharacter]; 2692 pPlayer10 = pPlayers[uActiveCharacter];
2700 if ( !byte_506550 || !quick_spell_at_page ) 2693 if ( !byte_506550 || !quick_spell_at_page )
2710 if ( uActiveCharacter ) 2703 if ( uActiveCharacter )
2711 pPlayer10->PlaySound(SPEECH_12, 0); 2704 pPlayer10->PlaySound(SPEECH_12, 0);
2712 byte_506550 = 0; 2705 byte_506550 = 0;
2713 continue; 2706 continue;
2714 case UIMSG_33: 2707 case UIMSG_33:
2715 __debugbreak;//UIMSG_33 - ???
2716 if ( !uActiveCharacter ) 2708 if ( !uActiveCharacter )
2717 continue; 2709 continue;
2718 pPlayer3 = pPlayers[uActiveCharacter]; 2710 pPlayer3 = pPlayers[uActiveCharacter];
2719 pNPCData4 = 0; 2711 pNPCData4 = 0;
2720 uAction = 0; 2712 uAction = 0;
2808 if ( pTurnEngine->field_4 != 3 ) 2800 if ( pTurnEngine->field_4 != 3 )
2809 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); 2801 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
2810 continue; 2802 continue;
2811 2803
2812 case UIMSG_92: 2804 case UIMSG_92:
2813 __debugbreak;//UIMSG_92 - ???
2814 if ( pTurnEngine->field_4 != 3 ) 2805 if ( pTurnEngine->field_4 != 3 )
2815 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0); 2806 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0);
2816 continue; 2807 continue;
2817 case UIMSG_SpellBookWindow: 2808 case UIMSG_SpellBookWindow:
2818 if ( pTurnEngine->field_4 == 3 ) 2809 if ( pTurnEngine->field_4 == 3 )
2887 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); 2878 uNumSeconds = (unsigned int)MakeScreenshot(155, 117);
2888 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); 2879 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117);
2889 free((void *)uNumSeconds); 2880 free((void *)uNumSeconds);
2890 stru_506E40._40E55E("gamma.pcx", 0); 2881 stru_506E40._40E55E("gamma.pcx", 0);
2891 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); 2882 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0);
2892 uNumVisibleWindows = uNumVisibleWindows - 1; //Ritor1: Insert
2893 //LABEL_453: 2883 //LABEL_453:
2894 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) 2884 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
2895 continue; 2885 continue;
2896 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 2886 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
2897 //goto LABEL_770; 2887 //goto LABEL_770;
2899 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 2889 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
2900 ++pMessageQueue_50CBD0->uNumMessages;*/ 2890 ++pMessageQueue_50CBD0->uNumMessages;*/
2901 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 2891 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
2902 continue; 2892 continue;
2903 case UIMSG_C0: 2893 case UIMSG_C0:
2904 __debugbreak;//UIMSG_C0 - ???
2905 dword_50651C = v0; 2894 dword_50651C = v0;
2906 if ( pMouse->GetCursorPos(&v211)->y > 178 ) 2895 if ( pMouse->GetCursorPos(&v211)->y > 178 )
2907 dword_50651C = -1; 2896 dword_50651C = -1;
2908 continue; 2897 continue;
2909 case UIMSG_A9: 2898 case UIMSG_A9:
2910 __debugbreak;
2911 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_5B, (int)pBtn_Up, 0); 2899 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_5B, (int)pBtn_Up, 0);
2912 dword_506548 = v0; 2900 dword_506548 = v0;
2913 continue; 2901 continue;
2914 case UIMSG_AA: 2902 case UIMSG_AA:
2915 __debugbreak;
2916 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_5B, (int)pBtn_Down, 0); 2903 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_5B, (int)pBtn_Down, 0);
2917 dword_506544 = v0; 2904 dword_506544 = v0;
2918 continue; 2905 continue;
2919 case UIMSG_ChangeDetaliz: 2906 case UIMSG_ChangeDetaliz:
2920 bRingsShownInCharScreen ^= v0; 2907 bRingsShownInCharScreen ^= v0;
2941 viewparams->bRedrawGameUI = v0; 2928 viewparams->bRedrawGameUI = v0;
2942 continue; 2929 continue;
2943 case UIMSG_ClickPaperdoll: 2930 case UIMSG_ClickPaperdoll:
2944 OnPaperdollLeftClick(); 2931 OnPaperdollLeftClick();
2945 continue; 2932 continue;
2946 case UIMSG_73: 2933 case UIMSG_ClickStatsBtn:
2947 __debugbreak;
2948 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; 2934 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
2949 sub_4196A0(); 2935 sub_4196A0();
2950 sub_419379(); 2936 sub_419379();
2951 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_StatsBtn, 0); 2937 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_StatsBtn, 0);
2952 continue; 2938 continue;
2953 case UIMSG_72: 2939 case UIMSG_ClickSkillsBtn:
2954 __debugbreak;
2955 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; 2940 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
2956 sub_4196A0(); 2941 sub_4196A0();
2957 sub_419379(); 2942 sub_419379();
2958 CharacterUI_SkillScreen_Draw(); 2943 CharacterUI_SkillScreen_Draw();
2959 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_SkillsBtn, 0); 2944 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_SkillsBtn, 0);
2960 continue; 2945 continue;
2961 case UIMSG_SkillUp: 2946 case UIMSG_SkillUp:
2962 pPlayer4 = pPlayers[uActiveCharacter]; 2947 pPlayer4 = pPlayers[uActiveCharacter];
2963 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; 2948 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam];
2964 LOWORD(v2) = *(short *)v105; 2949 LOWORD(v2) = *(short *)v105;
2979 } 2964 }
2980 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" 2965 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!"
2981 } 2966 }
2982 ShowStatusBarString(v87, 2); 2967 ShowStatusBarString(v87, 2);
2983 continue; 2968 continue;
2984 case UIMSG_74: 2969 case UIMSG_ClickInventoryBtn:
2985 __debugbreak;
2986 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 2970 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
2987 sub_419379(); 2971 sub_419379();
2988 sub_4196A0(); 2972 sub_4196A0();
2989 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_InventoryBtn, 0); 2973 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_InventoryBtn, 0);
2990 continue; 2974 continue;
2991 case UIMSG_A8: 2975 case UIMSG_ClickExitCharacterWindowBtn:
2992 __debugbreak; 2976 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
2993 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (WindowType)97, (int)pCharacterScreen_ExitBtn, 0);
2994 continue; 2977 continue;
2995 case UIMSG_75: 2978 case UIMSG_ClickAwardsBtn:
2996 __debugbreak;
2997 sub_419379(); 2979 sub_419379();
2998 sub_4196A0(); 2980 sub_4196A0();
2999 sub_419220(); 2981 sub_419220();
3000 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; 2982 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
3001 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (WindowType)(WINDOW_HouseInterior|0x42), 2983 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_AwardsBtn, 0);
3002 (int)pCharacterScreen_AwardsBtn, 0);
3003 FillAwardsData(); 2984 FillAwardsData();
3004 continue; 2985 continue;
3005 case UIMSG_AutonotesBook: 2986 case UIMSG_AutonotesBook:
3006 switch ( uMessageParam ) 2987 switch ( uMessageParam )
3007 { 2988 {
3052 case 7: 3033 case 7:
3053 pButton = pBtn_Autonotes_Instructors; 3034 pButton = pBtn_Autonotes_Instructors;
3054 dword_50652C = v0; 3035 dword_50652C = v0;
3055 break; 3036 break;
3056 } 3037 }
3057 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (WindowType)92, (int)pButton, v0); 3038 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, v0);
3058 continue; 3039 continue;
3059 case UIMSG_SelectCharacter: 3040 case UIMSG_SelectCharacter:
3060 if ( pMessageQueue_50CBD0->uNumMessages ) 3041 if ( pMessageQueue_50CBD0->uNumMessages )
3061 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 3042 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
3062 GameUI_OnPlayerPortraitLeftClick(uMessageParam); 3043 GameUI_OnPlayerPortraitLeftClick(uMessageParam);
3108 v114 = v110->GetMaxHealth(); 3089 v114 = v110->GetMaxHealth();
3109 sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); 3090 sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109);
3110 sub_41C0B8_set_status_string(pTmpBuf); 3091 sub_41C0B8_set_status_string(pTmpBuf);
3111 continue; 3092 continue;
3112 case UIMSG_C: 3093 case UIMSG_C:
3113 __debugbreak;
3114 if ( pCurrentScreen == SCREEN_F ) 3094 if ( pCurrentScreen == SCREEN_F )
3115 { 3095 {
3116 sub_421EA6_OnInventoryLeftClick(); 3096 sub_421EA6_OnInventoryLeftClick();
3117 continue; 3097 continue;
3118 } 3098 }
3119 sub_420E01(); 3099 sub_420E01();
3120 continue; 3100 continue;
3121 case UIMSG_InventoryLeftClick: 3101 case UIMSG_InventoryLeftClick:
3122 sub_421EA6_OnInventoryLeftClick(); 3102 sub_421EA6_OnInventoryLeftClick();
3123 continue; 3103 continue;
3124 case UIMSG_A: 3104 case UIMSG_MouseLeftClickInGame:
3125 __debugbreak;
3126 if ( !pRenderer->pRenderD3D ) 3105 if ( !pRenderer->pRenderD3D )
3127 { 3106 {
3128 if ( pMessageQueue_50CBD0->uNumMessages ) 3107 if ( pMessageQueue_50CBD0->uNumMessages )
3129 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 3108 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
3130 OnGameViewportClick(); 3109 OnGameViewportClick();
3170 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 3149 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
3171 ++pMessageQueue_50CBD0->uNumMessages; 3150 ++pMessageQueue_50CBD0->uNumMessages;
3172 continue; 3151 continue;
3173 }*/ 3152 }*/
3174 continue; 3153 continue;
3175 case UIMSG_E: 3154 case UIMSG_E://срабатывает при нажатии на правую кнопку мыши после UIMSG_MouseLeftClickInGame
3176 __debugbreak;
3177 if ( pMessageQueue_50CBD0->uNumMessages ) 3155 if ( pMessageQueue_50CBD0->uNumMessages )
3178 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 3156 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
3179 OnGameViewportClick(); 3157 OnGameViewportClick();
3180 continue; 3158 continue;
3181 case UIMSG_F: 3159 case UIMSG_F:
3182 __debugbreak;
3183 if ( pRenderer->pRenderD3D ) 3160 if ( pRenderer->pRenderD3D )
3184 { 3161 {
3185 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); 3162 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
3186 } 3163 }
3187 else 3164 else
3189 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); 3166 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209);
3190 pPoint3 = pMouse->GetCursorPos(&v204); 3167 pPoint3 = pMouse->GetCursorPos(&v204);
3191 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; 3168 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]];
3192 } 3169 }
3193 pButton2 = (GUIButton *)(unsigned __int16)v116; 3170 pButton2 = (GUIButton *)(unsigned __int16)v116;
3194 GUIWindow::Create(0, 0, 0, 0, (WindowType)15, (int)pButton2, 0); 3171 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
3195 continue; 3172 continue;
3196 case UIMSG_54: 3173 case UIMSG_54:
3197 __debugbreak;
3198 pButton2 = (GUIButton *)uMessageParam; 3174 pButton2 = (GUIButton *)uMessageParam;
3199 GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0); 3175 GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0);
3200 continue; 3176 continue;
3201 case UIMSG_Game_Action: 3177 case UIMSG_Game_Action:
3202 if ( pMessageQueue_50CBD0->uNumMessages ) 3178 if ( pMessageQueue_50CBD0->uNumMessages )
3203 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 3179 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
3204 OnPressSpace(); 3180 OnPressSpace();
3205 continue; 3181 continue;
3206 case UIMSG_16F: 3182 case UIMSG_ClickZoomOutBtn:
3207 __debugbreak;
3208 if ( pCurrentScreen ) 3183 if ( pCurrentScreen )
3209 continue; 3184 continue;
3210 pParty->uFlags |= 2u; 3185 pParty->uFlags |= 2u;
3211 GUIWindow::Create(0x207u, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomOut, 0); 3186 GUIWindow::Create(0x207u, 0x88u, 0, 0, WINDOW_5A, (int)pBtn_ZoomOut, 0);
3212 uNumSeconds = 131072; 3187 uNumSeconds = 131072;
3213 v118 = 2 * viewparams->uMinimapZoom; 3188 v118 = 2 * viewparams->uMinimapZoom;
3214 ++viewparams->field_28; 3189 ++viewparams->field_28;
3215 viewparams->uMinimapZoom *= 2; 3190 viewparams->uMinimapZoom *= 2;
3216 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) 3191 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
3222 } 3197 }
3223 continue; 3198 continue;
3224 } 3199 }
3225 v119 = 2048; 3200 v119 = 2048;
3226 if ( (signed int)v118 <= 2048 ) 3201 if ( (signed int)v118 <= 2048 )
3227 goto LABEL_789; 3202 {
3203 dword_576E2C = v118;
3204 dword_576E28 = viewparams->field_28;
3205 break;
3206 }
3228 viewparams->field_28 = 11; 3207 viewparams->field_28 = 11;
3229 goto LABEL_788; 3208 viewparams->uMinimapZoom = v119;
3230 case UIMSG_170: 3209 dword_576E2C = v119;
3231 __debugbreak; 3210 dword_576E28 = viewparams->field_28;
3211 break;
3212 case UIMSG_ClickZoomInBtn:
3232 if ( pCurrentScreen ) 3213 if ( pCurrentScreen )
3233 continue; 3214 continue;
3234 pParty->uFlags |= 2u; 3215 pParty->uFlags |= 2u;
3235 GUIWindow::Create(0x23Eu, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomIn, 0); 3216 GUIWindow::Create(0x23Eu, 0x88u, 0, 0, WINDOW_5A, (int)pBtn_ZoomIn, 0);
3236 uNumSeconds = 32768; 3217 uNumSeconds = 32768;
3237 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; 3218 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
3238 --viewparams->field_28; 3219 --viewparams->field_28;
3239 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; 3220 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
3240 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 3221 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
3241 { 3222 {
3242 v119 = 512; 3223 v119 = 512;
3243 if ( (signed int)v118 < 512 ) 3224 if ( (signed int)v118 < 512 )
3244 { 3225 {
3245 viewparams->field_28 = 9; 3226 viewparams->field_28 = 9;
3246 LABEL_788:
3247 v118 = v119; 3227 v118 = v119;
3248 viewparams->uMinimapZoom = v119; 3228 viewparams->uMinimapZoom = v119;
3249 } 3229 }
3250 LABEL_789:
3251 dword_576E2C = v118; 3230 dword_576E2C = v118;
3252 dword_576E28 = viewparams->field_28; 3231 dword_576E28 = viewparams->field_28;
3253 } 3232 }
3254 else 3233 else
3255 { 3234 {
3364 //int pSex; // [sp+Ch] [bp-4h]@3 3343 //int pSex; // [sp+Ch] [bp-4h]@3
3365 Player *pPlayer; 3344 Player *pPlayer;
3366 3345
3367 if ( pMessageQueue_50CBD0->uNumMessages ) 3346 if ( pMessageQueue_50CBD0->uNumMessages )
3368 { 3347 {
3369 //v0 = pAudioPlayer;
3370 //pPlayer1 = pParty->pPlayers;
3371 pPlayer = pParty->pPlayers; 3348 pPlayer = pParty->pPlayers;
3372 do 3349 do
3373 { 3350 {
3374 int param2; 3351 int param2;
3375 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &param2); 3352 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &param2);
3353 auto player = &pParty->pPlayers[uNum];
3354 auto sex = player->GetSexByVoice();
3376 3355
3377 switch (pUIMessageType) // For buttons of window MainMenu 3356 switch (pUIMessageType) // For buttons of window MainMenu
3378 { 3357 {
3379 case UIMSG_MainMenu_ShowPartyCreationWnd: 3358 case UIMSG_MainMenu_ShowPartyCreationWnd:
3380 {
3381 GUIWindow::Create(495, 172, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0); 3359 GUIWindow::Create(495, 172, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0);
3382 SetCurrentMenuID(MENU_NEWGAME); 3360 SetCurrentMenuID(MENU_NEWGAME);
3383 } 3361 break;
3384 continue;
3385 case UIMSG_MainMenu_ShowLoadWindow: 3362 case UIMSG_MainMenu_ShowLoadWindow:
3386 {
3387 GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0); 3363 GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0);
3388 SetCurrentMenuID(MENU_SAVELOAD); 3364 SetCurrentMenuID(MENU_SAVELOAD);
3389 } 3365 break;
3390 continue;
3391 case UIMSG_ShowCredits: 3366 case UIMSG_ShowCredits:
3392 {
3393 GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0); 3367 GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0);
3394 SetCurrentMenuID(MENU_CREDITS); 3368 SetCurrentMenuID(MENU_CREDITS);
3395 } 3369 break;
3396 continue;
3397 case UIMSG_ExitToWindows: 3370 case UIMSG_ExitToWindows:
3398 {
3399 GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); 3371 GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0);
3400 SetCurrentMenuID(MENU_FINISHED); 3372 SetCurrentMenuID(MENU_FINISHED);
3401 } 3373 break;
3402 continue;
3403 }
3404
3405
3406 switch (pUIMessageType) // For buttons of Party Creation Window
3407 {
3408 case UIMSG_PlayerCreation_SelectAttribute: 3374 case UIMSG_PlayerCreation_SelectAttribute:
3409 { 3375 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
3410 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) 3376 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
3411 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; 3377 uPlayerCreationUI_SelectedCharacter = uNum;
3412 uPlayerCreationUI_SelectedCharacter = uNum; 3378 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3413 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 3379 break;
3414 }
3415 continue;
3416
3417 case UIMSG_PlayerCreation_VoicePrev: 3380 case UIMSG_PlayerCreation_VoicePrev:
3418 { 3381 do
3419 auto player = &pParty->pPlayers[uNum]; 3382 {
3420 auto sex = player->GetSexByVoice(); 3383 if (player->uVoiceID == 0)
3421 do 3384 player->uVoiceID = 19;
3422 { 3385 else --player->uVoiceID;
3423 if (player->uVoiceID == 0) 3386 }
3424 player->uVoiceID = 19; 3387 while (player->GetSexByVoice() != sex);
3425 else --player->uVoiceID; 3388 pButton = pCreationUI_BtnPressLeft2[uNum];
3426 } 3389 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1);
3427 while (player->GetSexByVoice() != sex); 3390 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3428 3391 player->PlaySound(SPEECH_PickMe, 0);
3429 pButton = pCreationUI_BtnPressLeft2[uNum]; 3392 break;
3430 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1);
3431 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3432 player->PlaySound(SPEECH_PickMe, 0);
3433 }
3434 continue;
3435
3436 case UIMSG_PlayerCreation_VoiceNext: 3393 case UIMSG_PlayerCreation_VoiceNext:
3437 { 3394 {
3438 auto player = &pParty->pPlayers[uNum]; 3395 //auto player = &pParty->pPlayers[uNum];
3439 auto sex = player->GetSexByVoice(); 3396 //auto sex = player->GetSexByVoice();
3440 do 3397 do
3441 { 3398 {
3442 player->uVoiceID = (player->uVoiceID + 1) % 20; 3399 player->uVoiceID = (player->uVoiceID + 1) % 20;
3443 } 3400 }
3444 while (player->GetSexByVoice() != sex); 3401 while (player->GetSexByVoice() != sex);
3445
3446 pButton = pCreationUI_BtnPressRight2[uNum]; 3402 pButton = pCreationUI_BtnPressRight2[uNum];
3447 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); 3403 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1);
3448 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 3404 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3449 player->PlaySound(SPEECH_PickMe, 0); 3405 player->PlaySound(SPEECH_PickMe, 0);
3450 } 3406 break;
3451 continue; 3407 }
3452
3453 case UIMSG_PlayerCreation_FacePrev: 3408 case UIMSG_PlayerCreation_FacePrev:
3454 { 3409 pPlayer = &pParty->pPlayers[uNum];
3455 pPlayer = &pParty->pPlayers[uNum]; 3410 if (!pPlayer->uFace)
3456 if (!pPlayer->uFace) 3411 pPlayer->uFace = 19;
3457 pPlayer->uFace = 19; 3412 else
3458 else 3413 pPlayer->uFace -= 1;
3459 pPlayer->uFace -= 1; 3414 pPlayer->uVoiceID = pPlayer->uFace;
3460 pPlayer->uVoiceID = pPlayer->uFace; 3415 pPlayer->SetInitialStats();
3461 pPlayer->SetInitialStats(); 3416 pPlayer->SetSexByVoice();
3462 pPlayer->SetSexByVoice(); 3417 pPlayer->RandomizeName();
3463 pPlayer->RandomizeName(); 3418 v25 = uNum;
3464 v25 = uNum; 3419 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
3465 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) 3420 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
3466 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; 3421 uPlayerCreationUI_SelectedCharacter = v25;
3467 uPlayerCreationUI_SelectedCharacter = v25; 3422 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1);
3468 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1); 3423 //v0 = pAudioPlayer;
3469 //v0 = pAudioPlayer; 3424 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0);
3470 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); 3425 pPlayer->PlaySound(SPEECH_PickMe, 0);
3471 pPlayer->PlaySound(SPEECH_PickMe, 0); 3426 //v1 = (char *)pParty->pPlayers;
3472 //v1 = (char *)pParty->pPlayers; 3427 break;
3473 }
3474 continue;
3475
3476 case UIMSG_PlayerCreation_FaceNext: 3428 case UIMSG_PlayerCreation_FaceNext:
3477 { 3429 pPlayer = &pParty->pPlayers[uNum];
3478 pPlayer = &pParty->pPlayers[uNum]; 3430 v20 = (char)((int)pPlayer->uFace + 1) % 20;
3479 v20 = (char)((int)pPlayer->uFace + 1) % 20; 3431 pPlayer->uFace = v20;
3480 pPlayer->uFace = v20; 3432 pPlayer->uVoiceID = v20;
3481 pPlayer->uVoiceID = v20; 3433 pPlayer->SetInitialStats();
3482 pPlayer->SetInitialStats(); 3434 pPlayer->SetSexByVoice();
3483 pPlayer->SetSexByVoice(); 3435 pPlayer->RandomizeName();
3484 pPlayer->RandomizeName(); 3436 v21 = uNum;
3485 v21 = uNum; 3437 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
3486 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) 3438 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
3487 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; 3439 uPlayerCreationUI_SelectedCharacter = v21;
3488 uPlayerCreationUI_SelectedCharacter = v21; 3440 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1);
3489 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1); 3441 //v0 = pAudioPlayer;
3490 //v0 = pAudioPlayer; 3442 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3491 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 3443 pPlayer->PlaySound(SPEECH_PickMe, 0);
3492 pPlayer->PlaySound(SPEECH_PickMe, 0); 3444 //v1 = (char *)pParty->pPlayers;
3493 //v1 = (char *)pParty->pPlayers; 3445 break;
3494 } 3446 case UIMSG_PlayerCreationClickPlus:
3495 continue; 3447 GUIWindow::Create(613, 393, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnPlus, 1);
3496 } 3448 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
3497 3449 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0);
3498 switch (pUIMessageType) // For buttons of window LoadGame 3450 break;
3499 { 3451 case UIMSG_PlayerCreationClickMinus:
3452 GUIWindow::Create(523, 393, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnMinus, 1);
3453 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
3454 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0);
3455 break;
3456 case UIMSG_PlayerCreationSelectActiveSkill:
3457 {
3458 auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter];
3459 v6 = _t->GetSkillIdxByOrder(uNum + 4);
3460 if ( _t->GetSkillIdxByOrder(3) == 37 )
3461 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1;
3462 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
3463 break;
3464 }
3465 case UIMSG_PlayerCreationSelectClass:
3466 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum);
3467 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3468 break;
3469 case UIMSG_PlayerCreationClickOK:
3470 GUIWindow::Create(580, 431, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnOK, 0);
3471 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() )
3472 GameUI_Footer_TimeLeft = GetTickCount() + 4000;
3473 else
3474 uGameState = 6;
3475 break;
3476 case UIMSG_PlayerCreationClickReset:
3477 GUIWindow::Create(527, 431, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnReset, 0);
3478 pParty->Reset();
3479 break;
3480 case UIMSG_PlayerCreationRemoveUpSkill:
3481 uPlayerCreationUI_SelectedCharacter = uNum;
3482 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
3483 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem;
3484 v41 = 2;
3485 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
3486 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5;
3487 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41)
3488 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
3489 break;
3490 case UIMSG_PlayerCreationChangeName:
3491 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
3492 v3 = (void *)uNum;
3493 uPlayerCreationUI_SelectedCharacter = uNum;
3494 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
3495 pGUIWindow_CurrentMenu->ptr_1C = v3;
3496 break;
3497 case UIMSG_ChangeGameState:
3498 uGameState = 1;
3499 break;
3500 case UIMSG_11:
3501 pMouse->SetCursorBitmap("MICON2");
3502 break;
3503 case UIMSG_3A:
3504 SetCurrentMenuID(MENU_10);
3505 break;
3500 case UIMSG_LoadGame: 3506 case UIMSG_LoadGame:
3501 {
3502 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) 3507 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
3503 continue; 3508 break;
3504 SetCurrentMenuID(MENU_LOADINGPROC); 3509 SetCurrentMenuID(MENU_LOADINGPROC);
3505 continue; 3510 break;
3506 }
3507 case UIMSG_SelectLoadSlot: 3511 case UIMSG_SelectLoadSlot:
3508 {
3509 //main menu save/load wnd clicking on savegame lines 3512 //main menu save/load wnd clicking on savegame lines
3510 if (pGUIWindow_CurrentMenu->field_40 == 1) 3513 if (pGUIWindow_CurrentMenu->field_40 == 1)
3511 pKeyActionMap->_459ED1(0); 3514 pKeyActionMap->_459ED1(0);
3512 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != uNum + pSaveListPosition ) 3515 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != uNum + pSaveListPosition )
3513 { 3516 {
3526 //typing in the line 3529 //typing in the line
3527 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); 3530 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
3528 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); 3531 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
3529 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); 3532 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
3530 } 3533 }
3531 continue; 3534 break;
3532 }
3533 case UIMSG_LoadSlot: 3535 case UIMSG_LoadSlot:
3534 {
3535 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0); 3536 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0);
3536 continue; 3537 break;
3537 }
3538 case UIMSG_DownArrow: 3538 case UIMSG_DownArrow:
3539 {
3540 ++pSaveListPosition; 3539 ++pSaveListPosition;
3541 if ( pSaveListPosition >= uNum ) 3540 if ( pSaveListPosition >= uNum )
3542 pSaveListPosition = uNum - 1; 3541 pSaveListPosition = uNum - 1;
3543 if ( pSaveListPosition < 1 ) 3542 if ( pSaveListPosition < 1 )
3544 pSaveListPosition = 0; 3543 pSaveListPosition = 0;
3545 pWindow = pGUIWindow_CurrentMenu; 3544 pWindow = pGUIWindow_CurrentMenu;
3546 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); 3545 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_5A, (int)pBtnDownArrow, 0);
3547 continue; 3546 break;
3548 }
3549 case UIMSG_Cancel: 3547 case UIMSG_Cancel:
3550 { 3548 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0);
3551 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0); 3549 break;
3552 continue;
3553 }
3554 case UIMSG_ArrowUp: 3550 case UIMSG_ArrowUp:
3555 {
3556 --pSaveListPosition; 3551 --pSaveListPosition;
3557 if ( pSaveListPosition < 0 ) 3552 if ( pSaveListPosition < 0 )
3558 pSaveListPosition = 0; 3553 pSaveListPosition = 0;
3559 pWindow = pGUIWindow_CurrentMenu; 3554 pWindow = pGUIWindow_CurrentMenu;
3560 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0); 3555 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_5A, (int)pBtnArrowUp, 0);
3561 continue; 3556 break;
3562 } 3557 case UIMSG_AD:
3563 } 3558 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0);
3564 3559 SetCurrentMenuID(MENU_LOADINGPROC);
3565 if ( (signed int)pUIMessageType > UIMSG_PlayerCreationRemoveDownSkill )// For button of window PlayerCreation 3560 break;
3566 { 3561 case UIMSG_AE:
3567 if ( pUIMessageType > UIMSG_DownArrow ) 3562 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0);
3568 {
3569 if ( pUIMessageType == UIMSG_AD )//unknow
3570 {
3571 __debugbreak();
3572 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0);
3573 SetCurrentMenuID(MENU_LOADINGPROC);
3574 continue;
3575 }
3576 if ( pUIMessageType != UIMSG_AE )//unknow
3577 {
3578 __debugbreak();
3579 continue;
3580 }
3581 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0);
3582 SetCurrentMenuID(MENU_10); 3563 SetCurrentMenuID(MENU_10);
3583 continue; 3564 break;
3584 } 3565 case UIMSG_Escape:
3585 if ( pUIMessageType == UIMSG_GameMenuButton )//unknow
3586 {
3587 __debugbreak();
3588 if ( pCurrentScreen )
3589 {
3590 pGUIWindow_CurrentMenu->Release();
3591 pEventTimer->Resume();
3592 pCurrentScreen = SCREEN_GAME;
3593 viewparams->bRedrawGameUI = 1;
3594 }
3595 GUIWindow::Create(602, 450, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0);
3596 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
3597 continue;
3598 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
3599 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
3600 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
3601 ++pMessageQueue_50CBD0->uNumMessages;*/
3602 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
3603 continue;
3604 }
3605 if ( pUIMessageType == UIMSG_Escape )
3606 {
3607 if ( ptr_507BDC ) 3566 if ( ptr_507BDC )
3608 { 3567 {
3609 sub_41426F(); 3568 sub_41426F();
3610 continue; 3569 break;
3611 } 3570 }
3612 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) 3571 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) )
3613 continue; 3572 break;
3614 v15 = 1; 3573 v15 = 1;
3615 pVideoPlayer->bStopBeforeSchedule = 1; 3574 pVideoPlayer->bStopBeforeSchedule = 1;
3616 viewparams->bRedrawGameUI = 1; 3575 viewparams->bRedrawGameUI = 1;
3617 viewparams->field_48 = 1; 3576 viewparams->field_48 = 1;
3618 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) 3577 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC )
3621 if ( pCurrentScreen == SCREEN_VIDEO ) 3580 if ( pCurrentScreen == SCREEN_VIDEO )
3622 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); 3581 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
3623 if (GetCurrentMenuID() == MENU_NAMEPANELESC) 3582 if (GetCurrentMenuID() == MENU_NAMEPANELESC)
3624 { 3583 {
3625 SetCurrentMenuID(MENU_CREATEPARTY); 3584 SetCurrentMenuID(MENU_CREATEPARTY);
3626 continue; 3585 break;
3627 } 3586 }
3628 if (GetCurrentMenuID() == MENU_CREDITSPROC) 3587 if (GetCurrentMenuID() == MENU_CREDITSPROC)
3629 { 3588 {
3630 SetCurrentMenuID(MENU_CREDITSCLOSE); 3589 SetCurrentMenuID(MENU_CREDITSCLOSE);
3631 continue; 3590 break;
3632 } 3591 }
3633 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 3592 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
3634 { 3593 {
3635 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)5; 3594 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)5;
3636 //LABEL_93: 3595 //LABEL_93:
3638 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 3597 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
3639 ++pMessageQueue_50CBD0->uNumMessages; 3598 ++pMessageQueue_50CBD0->uNumMessages;
3640 continue; 3599 continue;
3641 }*/ 3600 }*/
3642 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); 3601 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0);
3643 continue; 3602 break;
3644 } 3603 }
3645 v16 = GetCurrentMenuID() == 8; 3604 v16 = GetCurrentMenuID() == 8;
3646 if ( v16 && !pCurrentScreen ) 3605 if ( v16 && !pCurrentScreen )
3647 goto LABEL_83; 3606 goto LABEL_83;
3648 if ( pCurrentScreen == SCREEN_LOADGAME ) 3607 if ( pCurrentScreen == SCREEN_LOADGAME )
3658 pGUIWindow2->Release(); 3617 pGUIWindow2->Release();
3659 pGUIWindow2 = 0; 3618 pGUIWindow2 = 0;
3660 pEventTimer->Resume(); 3619 pEventTimer->Resume();
3661 pCurrentScreen = SCREEN_GAME; 3620 pCurrentScreen = SCREEN_GAME;
3662 viewparams->bRedrawGameUI = v15; 3621 viewparams->bRedrawGameUI = v15;
3663 continue; 3622 break;
3664 } 3623 }
3665 if ( pCurrentScreen == SCREEN_VIDEO ) 3624 if ( pCurrentScreen == SCREEN_VIDEO )
3666 { 3625 {
3667 pVideoPlayer->Unload(); 3626 pVideoPlayer->Unload();
3668 } 3627 }
3675 pGUIWindow2->Release(); 3634 pGUIWindow2->Release();
3676 pGUIWindow2 = 0; 3635 pGUIWindow2 = 0;
3677 pEventTimer->Resume(); 3636 pEventTimer->Resume();
3678 pCurrentScreen = SCREEN_GAME; 3637 pCurrentScreen = SCREEN_GAME;
3679 viewparams->bRedrawGameUI = v15; 3638 viewparams->bRedrawGameUI = v15;
3680 continue; 3639 break;
3681 } 3640 }
3682 //VideoPlayer::dtor(); 3641 //VideoPlayer::dtor();
3683 } 3642 }
3684 } 3643 break;
3685 } 3644 case UIMSG_PlayerCreationRemoveDownSkill:
3686 else
3687 {
3688 if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill )
3689 {
3690 uPlayerCreationUI_SelectedCharacter = uNum; 3645 uPlayerCreationUI_SelectedCharacter = uNum;
3691 //v41 = 3; 3646 //v41 = 3;
3692 //v1 = (char *)pParty->pPlayers; 3647 //v1 = (char *)pParty->pPlayers;
3693 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 3648 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7
3694 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; 3649 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
3695 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) 3650 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3)
3696 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; 3651 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
3697 continue; 3652 break;
3698 } 3653 default:
3699 if ( (signed int)pUIMessageType > UIMSG_PlayerCreationChangeName ) 3654 break;
3700 {
3701 if ( pUIMessageType == UIMSG_PlayerCreationClickPlus )
3702 {
3703 GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1);
3704 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
3705 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0);
3706 continue;
3707 }
3708 if ( pUIMessageType == UIMSG_PlayerCreationClickMinus )
3709 {
3710 GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1);
3711 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
3712 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0);
3713 continue;
3714 }
3715 if ( pUIMessageType == UIMSG_PlayerCreationSelectActiveSkill )
3716 {
3717 auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter];
3718 v6 = _t->GetSkillIdxByOrder(uNum + 4);
3719 if ( _t->GetSkillIdxByOrder(3) == 37 )
3720 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1;
3721 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
3722 continue;
3723 }
3724 if ( pUIMessageType == UIMSG_PlayerCreationSelectClass )
3725 {
3726 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum);
3727 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3728 continue;
3729 }
3730 if ( pUIMessageType == UIMSG_PlayerCreationClickOK )
3731 {
3732 GUIWindow::Create(580, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0);
3733 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() )
3734 GameUI_Footer_TimeLeft = GetTickCount() + 4000;
3735 else
3736 uGameState = 6;
3737 continue;
3738 }
3739 if ( pUIMessageType == UIMSG_PlayerCreationClickReset )
3740 {
3741 GUIWindow::Create(527, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0);
3742 pParty->Reset();
3743 }
3744 else
3745 {
3746 if ( pUIMessageType == UIMSG_PlayerCreationRemoveUpSkill )
3747 {
3748 uPlayerCreationUI_SelectedCharacter = uNum;
3749 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
3750 int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem;
3751 v41 = 2;
3752 v5 = v4 % 7 + pSex + 7 * uNum;
3753 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5;
3754 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41)
3755 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
3756 continue;
3757 }
3758 }
3759 }
3760 else
3761 {
3762 switch ( pUIMessageType )
3763 {
3764 case UIMSG_PlayerCreationChangeName:
3765 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
3766 v3 = (void *)uNum;
3767 uPlayerCreationUI_SelectedCharacter = uNum;
3768 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
3769 pGUIWindow_CurrentMenu->ptr_1C = v3;
3770 break;
3771 case UIMSG_ChangeGameState:
3772 uGameState = 1;
3773 break;
3774 case UIMSG_11://unknow
3775 __debugbreak();
3776 pMouse->SetCursorBitmap("MICON2");
3777 break;
3778 case UIMSG_3A://unknow
3779 __debugbreak();
3780 SetCurrentMenuID(MENU_10);
3781 break;
3782 }
3783 }
3784 } 3655 }
3785 } 3656 }
3786 while ( pMessageQueue_50CBD0->uNumMessages ); 3657 while ( pMessageQueue_50CBD0->uNumMessages );
3787 } 3658 }
3788 } 3659 }
10440 { 10311 {
10441 GameUI_MainMenu_DrawLoad(); 10312 GameUI_MainMenu_DrawLoad();
10442 break; 10313 break;
10443 } 10314 }
10444 case WINDOW_5E: // window that initiates savegame loading 10315 case WINDOW_5E: // window that initiates savegame loading
10445 __debugbreak;
10446 { 10316 {
10447 if (pWindow->Hint != (char *)1) 10317 if (pWindow->Hint != (char *)1)
10448 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); 10318 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
10449 auto pGUIButton3 = (GUIButton *)pWindow->ptr_1C; 10319 auto pGUIButton3 = (GUIButton *)pWindow->ptr_1C;
10450 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton3->pTextures[0]); 10320 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton3->pTextures[0]);
10538 GameMenuUI_DrawKeyBindings(); 10408 GameMenuUI_DrawKeyBindings();
10539 break; 10409 break;
10540 } 10410 }
10541 case WINDOW_17: 10411 case WINDOW_17:
10542 { 10412 {
10543 __debugbreak;
10544 sub_4606FE(); 10413 sub_4606FE();
10545 break; 10414 break;
10546 } 10415 }
10547 case WINDOW_CastSpell_InInventory: 10416 case WINDOW_CastSpell_InInventory:
10548 { 10417 {
10600 pWindow->Release(); 10469 pWindow->Release();
10601 pNumMessages = pMessageQueue_50CBD0->uNumMessages; 10470 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
10602 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10471 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10603 break; 10472 break;
10604 } 10473 }
10605 case WINDOW_63: 10474 case WINDOW_BooksWindow:
10606 { 10475 {
10607 pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99 (0x63) WINDOW_63 10476 pButton = (GUIButton *)pWindow->ptr_1C;
10608 pY = pWindow->uFrameY; 10477 pY = pWindow->uFrameY;
10609 pX = pWindow->uFrameX; 10478 pX = pWindow->uFrameX;
10610 pRenderer->DrawTextureIndexed(pX, pY, pTexture); 10479 pRenderer->DrawTextureIndexed(pX, pY, pButton->pTextures[0]);
10611 viewparams->bRedrawGameUI = 1; 10480 viewparams->bRedrawGameUI = 1;
10612 break; 10481 break;
10613 } 10482 }
10614 case WINDOW_CharacterWindow_Inventory: 10483 case WINDOW_CharacterWindow_Inventory:
10615 { 10484 {
11646 11515
11647 11516
11648 //----- (00419379) -------------------------------------------------------- 11517 //----- (00419379) --------------------------------------------------------
11649 void __cdecl sub_419379() 11518 void __cdecl sub_419379()
11650 { 11519 {
11651 GUIButton *i; // esi@2 11520 GUIButton *pButton; // esi@2
11652 11521
11653 if ( dword_507CBC ) 11522 if ( dword_507CBC )
11654 { 11523 {
11655 dword_507CBC = 0; 11524 dword_507CBC = 0;
11656 ptr_507BA4->Release(); 11525 ptr_507BA4->Release();
11657 pBtn_Up->Release(); 11526 pBtn_Up->Release();
11658 pBtn_Down->Release(); 11527 pBtn_Down->Release();
11659 pBtn_Down = 0; 11528 pBtn_Down = 0;
11660 pBtn_Up = 0; 11529 pBtn_Up = 0;
11661 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) 11530 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
11662 { 11531 {
11663 if ( i->msg == UIMSG_InventoryLeftClick ) 11532 if ( pButton->msg == UIMSG_InventoryLeftClick )
11664 { 11533 {
11665 i->uX = dword_50698C; 11534 pButton->uX = dword_50698C;
11666 i->uY = dword_506988; 11535 pButton->uY = dword_506988;
11667 i->uZ = dword_506984; 11536 pButton->uZ = dword_506984;
11668 i->uW = dword_506980; 11537 pButton->uW = dword_506980;
11669 pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); 11538 pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0);
11670 } 11539 }
11671 } 11540 }
11672 } 11541 }
11673 } 11542 }