Mercurial > mm7
diff mm7_5.cpp @ 964:d7f0572335ec
Слияние
author | Ritor1 |
---|---|
date | Sat, 04 May 2013 18:19:08 +0600 |
parents | 9a5db2cf999a |
children | 5a12082c803d |
line wrap: on
line diff
--- a/mm7_5.cpp Sat May 04 18:18:47 2013 +0600 +++ b/mm7_5.cpp Sat May 04 18:19:08 2013 +0600 @@ -457,7 +457,7 @@ GUIWindow::Create(215, 323, 17, 17, WINDOW_5A, (int)pBtnDownArrow, 0); continue; case UIMSG_Cancel: - GUIWindow::Create(350, 302, 106, 42, WINDOW_60, (int)pBtnCancel, 0); + GUIWindow::Create(350, 302, 106, 42, WINDOW_ExitRestWindow, (int)pBtnCancel, 0); continue; case UIMSG_LoadSlot: GUIWindow::Create(241, 302, 106, 42, WINDOW_5E, (int)pBtnLoadSlot, 0); @@ -922,7 +922,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); - pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_63, (int)pBtn_Quests, 0); + pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0); bFlashQuestBook = 0; continue; case UIMSG_OpenAutonotes: @@ -933,7 +933,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); - pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_63, (int)pBtn_Autonotes, 0); + pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0); bFlashAutonotesBook = 0; continue; case UIMSG_OpenMapBook: @@ -945,8 +945,8 @@ viewparams->sViewCenterX = pParty->vPosition.x; viewparams->sViewCenterY = pParty->vPosition.y; pAudioPlayer->StopChannels(-1, -1); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); - pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); + pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0); continue; case UIMSG_OpenCalendar: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -956,7 +956,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); - pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_63, (int)pBtn_Calendar, 0); + pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0); continue; case UIMSG_OpenHistoryBook: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -966,7 +966,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); - pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_63, (int)pBtn_History, 0); + pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0); bFlashHistoryBook = 0; continue; case UIMSG_Escape:// Escape and return to game @@ -1551,7 +1551,7 @@ sub_42FBDD(); PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); pVideoPlayer->Unload(); - sub_44603D(); + DialogueEnding(); viewparams->bRedrawGameUI = v0; if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) { @@ -1605,10 +1605,10 @@ if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) pParty->uTimePlayed += 1474560i64; continue; - case UIMSG_19C: + case UIMSG_TransitionWindowCloseBtn: CloseWindowBackground(); pVideoPlayer->Unload(); - sub_44603D(); + DialogueEnding(); start_event_seq_number = 0; viewparams->bRedrawGameUI = v0; continue; @@ -1639,7 +1639,7 @@ if ( pParty->vPosition.y > 22528 ) pParty->vPosition.y = 22528; LABEL_317: - sub_44603D(); + DialogueEnding(); pCurrentScreen = SCREEN_GAME; } else @@ -1647,7 +1647,7 @@ pParty->field_6E4 = 0; pParty->field_6E0 = 0; pCastSpellInfo->_427D48(v0); - sub_44603D(); + DialogueEnding(); pEventTimer->Pause(); pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); ++pGameLoadingUI_ProgressBar->uProgressMax; @@ -1909,7 +1909,6 @@ continue; case UIMSG_B2: - __debugbreak;//UIMSG_B2 -??? bRecallingBeacon = uMessageParam; v127 = uMessageParam + 204; pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); @@ -1944,7 +1943,6 @@ sub_41C0B8_set_status_string(pTmpBuf); continue; case UIMSG_B5: - __debugbreak;//UIMSG_B5 - ??? dword_50CDC8 = v0; //goto LABEL_453; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); @@ -2237,7 +2235,6 @@ strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); goto LABEL_524; case UIMSG_DD: - __debugbreak; LABEL_524: sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); @@ -2478,7 +2475,7 @@ _42ECB5_PlayerAttacksActor(); continue; case UIMSG_ExitRest: - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (WindowType)96, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_ExitRestWindow, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" continue; case UIMSG_Wait5Minutes: if ( dword_506F14 == 2 ) @@ -2651,8 +2648,7 @@ dword_506F14 = v0; _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; continue; - case UIMSG_4E: - __debugbreak;//UIMSG_4E -??? + case UIMSG_HintSelectRemoveQuickSpellBtn: if ( quick_spell_at_page && byte_506550 ) { v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; @@ -2689,8 +2685,7 @@ sub_41C0B8_set_status_string(pTmpBuf); v0 = 1; continue; - case UIMSG_58: - __debugbreak;//UIMSG_58 - ??? + case UIMSG_ClickInstallRemoveQuickSpellBtn: GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_5A, (int)pBtn_InstallRemoveSpell, 0); if ( !uActiveCharacter ) continue; @@ -2710,7 +2705,6 @@ byte_506550 = 0; continue; case UIMSG_33: - __debugbreak;//UIMSG_33 - ??? if ( !uActiveCharacter ) continue; pPlayer3 = pPlayers[uActiveCharacter]; @@ -2808,7 +2802,6 @@ continue; case UIMSG_92: - __debugbreak;//UIMSG_92 - ??? if ( pTurnEngine->field_4 != 3 ) _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0); continue; @@ -2887,7 +2880,6 @@ free((void *)uNumSeconds); stru_506E40._40E55E("gamma.pcx", 0); GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); - uNumVisibleWindows = uNumVisibleWindows - 1; //Ritor1: Insert //LABEL_453: /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -2899,18 +2891,15 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); continue; case UIMSG_C0: - __debugbreak;//UIMSG_C0 - ??? dword_50651C = v0; if ( pMouse->GetCursorPos(&v211)->y > 178 ) dword_50651C = -1; continue; case UIMSG_A9: - __debugbreak; GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_5B, (int)pBtn_Up, 0); dword_506548 = v0; continue; case UIMSG_AA: - __debugbreak; GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_5B, (int)pBtn_Down, 0); dword_506544 = v0; continue; @@ -2941,20 +2930,18 @@ case UIMSG_ClickPaperdoll: OnPaperdollLeftClick(); continue; - case UIMSG_73: - __debugbreak; + case UIMSG_ClickStatsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; sub_4196A0(); sub_419379(); - GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_StatsBtn, 0); - continue; - case UIMSG_72: - __debugbreak; + GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_StatsBtn, 0); + continue; + case UIMSG_ClickSkillsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; sub_4196A0(); sub_419379(); CharacterUI_SkillScreen_Draw(); - GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_SkillsBtn, 0); + GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_SkillsBtn, 0); continue; case UIMSG_SkillUp: pPlayer4 = pPlayers[uActiveCharacter]; @@ -2979,25 +2966,21 @@ } ShowStatusBarString(v87, 2); continue; - case UIMSG_74: - __debugbreak; + case UIMSG_ClickInventoryBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; sub_419379(); sub_4196A0(); - GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_InventoryBtn, 0); - continue; - case UIMSG_A8: - __debugbreak; - GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (WindowType)97, (int)pCharacterScreen_ExitBtn, 0); - continue; - case UIMSG_75: - __debugbreak; + GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_InventoryBtn, 0); + continue; + case UIMSG_ClickExitCharacterWindowBtn: + GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); + continue; + case UIMSG_ClickAwardsBtn: sub_419379(); sub_4196A0(); sub_419220(); pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; - GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (WindowType)(WINDOW_HouseInterior|0x42), - (int)pCharacterScreen_AwardsBtn, 0); + GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_5B, (int)pCharacterScreen_AwardsBtn, 0); FillAwardsData(); continue; case UIMSG_AutonotesBook: @@ -3052,7 +3035,7 @@ dword_50652C = v0; break; } - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (WindowType)92, (int)pButton, v0); + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, v0); continue; case UIMSG_SelectCharacter: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3108,7 +3091,6 @@ sub_41C0B8_set_status_string(pTmpBuf); continue; case UIMSG_C: - __debugbreak; if ( pCurrentScreen == SCREEN_F ) { sub_421EA6_OnInventoryLeftClick(); @@ -3119,8 +3101,7 @@ case UIMSG_InventoryLeftClick: sub_421EA6_OnInventoryLeftClick(); continue; - case UIMSG_A: - __debugbreak; + case UIMSG_MouseLeftClickInGame: if ( !pRenderer->pRenderD3D ) { if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3170,14 +3151,12 @@ continue; }*/ continue; - case UIMSG_E: - __debugbreak; + case UIMSG_E:// UIMSG_MouseLeftClickInGame if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnGameViewportClick(); continue; case UIMSG_F: - __debugbreak; if ( pRenderer->pRenderD3D ) { LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -3189,10 +3168,9 @@ v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; } pButton2 = (GUIButton *)(unsigned __int16)v116; - GUIWindow::Create(0, 0, 0, 0, (WindowType)15, (int)pButton2, 0); + GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); continue; case UIMSG_54: - __debugbreak; pButton2 = (GUIButton *)uMessageParam; GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0); continue; @@ -3201,12 +3179,11 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnPressSpace(); continue; - case UIMSG_16F: - __debugbreak; + case UIMSG_ClickZoomOutBtn: if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x207u, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomOut, 0); + GUIWindow::Create(0x207u, 0x88u, 0, 0, WINDOW_5A, (int)pBtn_ZoomOut, 0); uNumSeconds = 131072; v118 = 2 * viewparams->uMinimapZoom; ++viewparams->field_28; @@ -3222,15 +3199,21 @@ } v119 = 2048; if ( (signed int)v118 <= 2048 ) - goto LABEL_789; + { + dword_576E2C = v118; + dword_576E28 = viewparams->field_28; + break; + } viewparams->field_28 = 11; - goto LABEL_788; - case UIMSG_170: - __debugbreak; + viewparams->uMinimapZoom = v119; + dword_576E2C = v119; + dword_576E28 = viewparams->field_28; + break; + case UIMSG_ClickZoomInBtn: if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x23Eu, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomIn, 0); + GUIWindow::Create(0x23Eu, 0x88u, 0, 0, WINDOW_5A, (int)pBtn_ZoomIn, 0); uNumSeconds = 32768; v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; --viewparams->field_28; @@ -3241,11 +3224,9 @@ if ( (signed int)v118 < 512 ) { viewparams->field_28 = 9; -LABEL_788: v118 = v119; viewparams->uMinimapZoom = v119; } -LABEL_789: dword_576E2C = v118; dword_576E28 = viewparams->field_28; } @@ -3364,146 +3345,170 @@ if ( pMessageQueue_50CBD0->uNumMessages ) { - //v0 = pAudioPlayer; - //pPlayer1 = pParty->pPlayers; pPlayer = pParty->pPlayers; do { int param2; pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, ¶m2); + auto player = &pParty->pPlayers[uNum]; + auto sex = player->GetSexByVoice(); 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; + break; case UIMSG_MainMenu_ShowLoadWindow: - { GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0); SetCurrentMenuID(MENU_SAVELOAD); - } - continue; + break; case UIMSG_ShowCredits: - { GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0); SetCurrentMenuID(MENU_CREDITS); - } - continue; + break; case UIMSG_ExitToWindows: - { GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); SetCurrentMenuID(MENU_FINISHED); - } - continue; - } - - - switch (pUIMessageType) // For buttons of Party Creation Window - { + break; case UIMSG_PlayerCreation_SelectAttribute: - { - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = uNum; - pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); - } - continue; - + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = uNum; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + break; case UIMSG_PlayerCreation_VoicePrev: - { - auto player = &pParty->pPlayers[uNum]; - auto sex = player->GetSexByVoice(); - do - { - if (player->uVoiceID == 0) - player->uVoiceID = 19; - else --player->uVoiceID; - } - while (player->GetSexByVoice() != sex); - - pButton = pCreationUI_BtnPressLeft2[uNum]; - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); - pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); - player->PlaySound(SPEECH_PickMe, 0); - } - continue; - + do + { + if (player->uVoiceID == 0) + player->uVoiceID = 19; + else --player->uVoiceID; + } + while (player->GetSexByVoice() != sex); + pButton = pCreationUI_BtnPressLeft2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + player->PlaySound(SPEECH_PickMe, 0); + break; case UIMSG_PlayerCreation_VoiceNext: - { - auto player = &pParty->pPlayers[uNum]; - auto sex = player->GetSexByVoice(); + { + //auto player = &pParty->pPlayers[uNum]; + //auto sex = player->GetSexByVoice(); do { player->uVoiceID = (player->uVoiceID + 1) % 20; } while (player->GetSexByVoice() != sex); - pButton = pCreationUI_BtnPressRight2[uNum]; GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); player->PlaySound(SPEECH_PickMe, 0); - } - continue; - + break; + } case UIMSG_PlayerCreation_FacePrev: - { - pPlayer = &pParty->pPlayers[uNum]; - if (!pPlayer->uFace) - pPlayer->uFace = 19; - else - pPlayer->uFace -= 1; - pPlayer->uVoiceID = pPlayer->uFace; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v25 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v25; - GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); - pPlayer->PlaySound(SPEECH_PickMe, 0); - //v1 = (char *)pParty->pPlayers; - } - continue; - + pPlayer = &pParty->pPlayers[uNum]; + if (!pPlayer->uFace) + pPlayer->uFace = 19; + else + pPlayer->uFace -= 1; + pPlayer->uVoiceID = pPlayer->uFace; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v25 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v25; + GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + break; case UIMSG_PlayerCreation_FaceNext: - { - pPlayer = &pParty->pPlayers[uNum]; - v20 = (char)((int)pPlayer->uFace + 1) % 20; - pPlayer->uFace = v20; - pPlayer->uVoiceID = v20; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v21 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v21; - GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); - pPlayer->PlaySound(SPEECH_PickMe, 0); - //v1 = (char *)pParty->pPlayers; - } - continue; - } - - switch (pUIMessageType) // For buttons of window LoadGame - { + pPlayer = &pParty->pPlayers[uNum]; + v20 = (char)((int)pPlayer->uFace + 1) % 20; + pPlayer->uFace = v20; + pPlayer->uVoiceID = v20; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v21 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v21; + GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + break; + case UIMSG_PlayerCreationClickPlus: + GUIWindow::Create(613, 393, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnPlus, 1); + pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); + pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); + break; + case UIMSG_PlayerCreationClickMinus: + GUIWindow::Create(523, 393, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnMinus, 1); + pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); + pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); + break; + case UIMSG_PlayerCreationSelectActiveSkill: + { + auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter]; + v6 = _t->GetSkillIdxByOrder(uNum + 4); + if ( _t->GetSkillIdxByOrder(3) == 37 ) + pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; + pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); + break; + } + case UIMSG_PlayerCreationSelectClass: + pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + break; + case UIMSG_PlayerCreationClickOK: + GUIWindow::Create(580, 431, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnOK, 0); + if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) + GameUI_Footer_TimeLeft = GetTickCount() + 4000; + else + uGameState = 6; + break; + case UIMSG_PlayerCreationClickReset: + GUIWindow::Create(527, 431, 0, 0, WINDOW_5A, (int)pPlayerCreationUI_BtnReset, 0); + pParty->Reset(); + break; + case UIMSG_PlayerCreationRemoveUpSkill: + uPlayerCreationUI_SelectedCharacter = uNum; + v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; + //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; + v41 = 2; + v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; + pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; + break; + case UIMSG_PlayerCreationChangeName: + pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); + v3 = (void *)uNum; + uPlayerCreationUI_SelectedCharacter = uNum; + pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); + pGUIWindow_CurrentMenu->ptr_1C = v3; + break; + case UIMSG_ChangeGameState: + uGameState = 1; + break; + case UIMSG_11: + pMouse->SetCursorBitmap("MICON2"); + break; + case UIMSG_3A: + SetCurrentMenuID(MENU_10); + break; case UIMSG_LoadGame: - { if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) - continue; + break; SetCurrentMenuID(MENU_LOADINGPROC); - continue; - } + break; case UIMSG_SelectLoadSlot: - { //main menu save/load wnd clicking on savegame lines if (pGUIWindow_CurrentMenu->field_40 == 1) pKeyActionMap->_459ED1(0); @@ -3526,89 +3531,45 @@ strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); } - continue; - } + break; case UIMSG_LoadSlot: - { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0); - continue; - } + break; case UIMSG_DownArrow: - { ++pSaveListPosition; if ( pSaveListPosition >= uNum ) pSaveListPosition = uNum - 1; if ( pSaveListPosition < 1 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); - continue; - } + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_5A, (int)pBtnDownArrow, 0); + break; case UIMSG_Cancel: - { - GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0); - continue; - } + GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); + break; case UIMSG_ArrowUp: - { --pSaveListPosition; if ( pSaveListPosition < 0 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 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_AD )//unknow - { - __debugbreak(); - GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0); - SetCurrentMenuID(MENU_LOADINGPROC); - 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); + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_5A, (int)pBtnArrowUp, 0); + break; + case UIMSG_AD: + GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0); + SetCurrentMenuID(MENU_LOADINGPROC); + break; + case UIMSG_AE: + GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); SetCurrentMenuID(MENU_10); - continue; - } - if ( pUIMessageType == UIMSG_GameMenuButton )//unknow - { - __debugbreak(); - if ( pCurrentScreen ) - { - pGUIWindow_CurrentMenu->Release(); - pEventTimer->Resume(); - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - } - GUIWindow::Create(602, 450, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) - continue; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_Escape ) - { + break; + case UIMSG_Escape: if ( ptr_507BDC ) { sub_41426F(); - continue; + break; } if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) - continue; + break; v15 = 1; pVideoPlayer->bStopBeforeSchedule = 1; viewparams->bRedrawGameUI = 1; @@ -3621,12 +3582,12 @@ if (GetCurrentMenuID() == MENU_NAMEPANELESC) { SetCurrentMenuID(MENU_CREATEPARTY); - continue; + break; } if (GetCurrentMenuID() == MENU_CREDITSPROC) { SetCurrentMenuID(MENU_CREDITSCLOSE); - continue; + break; } /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -3638,7 +3599,7 @@ continue; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); - continue; + break; } v16 = GetCurrentMenuID() == 8; if ( v16 && !pCurrentScreen ) @@ -3658,7 +3619,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v15; - continue; + break; } if ( pCurrentScreen == SCREEN_VIDEO ) { @@ -3675,16 +3636,12 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v15; - continue; + break; } //VideoPlayer::dtor(); } - } - } - else - { - if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill ) - { + break; + case UIMSG_PlayerCreationRemoveDownSkill: uPlayerCreationUI_SelectedCharacter = uNum; //v41 = 3; //v1 = (char *)pParty->pPlayers; @@ -3692,93 +3649,9 @@ + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; - continue; - } - if ( (signed int)pUIMessageType > UIMSG_PlayerCreationChangeName ) - { - if ( pUIMessageType == UIMSG_PlayerCreationClickPlus ) - { - GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1); - pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationClickMinus ) - { - GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1); - pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationSelectActiveSkill ) - { - auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter]; - v6 = _t->GetSkillIdxByOrder(uNum + 4); - if ( _t->GetSkillIdxByOrder(3) == 37 ) - pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; - pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationSelectClass ) - { - pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum); - pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) - { - GUIWindow::Create(580, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0); - if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) - GameUI_Footer_TimeLeft = GetTickCount() + 4000; - else - uGameState = 6; - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationClickReset ) - { - GUIWindow::Create(527, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0); - pParty->Reset(); - } - else - { - if ( pUIMessageType == UIMSG_PlayerCreationRemoveUpSkill ) - { - uPlayerCreationUI_SelectedCharacter = uNum; - v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; - int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; - v41 = 2; - v5 = v4 % 7 + pSex + 7 * uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; - pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) - + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; - continue; - } - } - } - else - { - switch ( pUIMessageType ) - { - case UIMSG_PlayerCreationChangeName: - pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); - v3 = (void *)uNum; - uPlayerCreationUI_SelectedCharacter = uNum; - pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); - pGUIWindow_CurrentMenu->ptr_1C = v3; - break; - case UIMSG_ChangeGameState: - uGameState = 1; - break; - case UIMSG_11://unknow - __debugbreak(); - pMouse->SetCursorBitmap("MICON2"); - break; - case UIMSG_3A://unknow - __debugbreak(); - SetCurrentMenuID(MENU_10); - break; - } - } + break; + default: + break; } } while ( pMessageQueue_50CBD0->uNumMessages ); @@ -10404,7 +10277,7 @@ unsigned int v29; // eax@111 GUIFont *pGUIFont; // ST1C_4@115 int v31; // eax@115 - void *v32; // ebp@118 + GUIButton *pButton; // ebp@118 int v33; // eax@119 int v34; // eax@120 int v35; // eax@121 @@ -10569,7 +10442,7 @@ pGUIWindow2->Release(); break; } - case WINDOW_60: + case WINDOW_ExitRestWindow: { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -10583,27 +10456,27 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); break; } - case WINDOW_61: + case WINDOW_ExitCharacterWindow: { - if ( pWindow->Hint != (char *)1 )//pWindowType == WINDOW_61 + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - v32 = pWindow->ptr_1C; - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16)); + pButton = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); pHint = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( pHint && pHint != (char *)1 ) - ((GUIButton *)v32)->DrawLabel(pHint, pFontCreate, 0, 0); + pButton->DrawLabel(pHint, pFontCreate, 0, 0); pWindow->Release(); pNumMessages = pMessageQueue_50CBD0->uNumMessages; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); break; } - case WINDOW_63: + case WINDOW_BooksWindow: { - pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99 (0x63) WINDOW_63 + pButton = (GUIButton *)pWindow->ptr_1C; pY = pWindow->uFrameY; pX = pWindow->uFrameX; - pRenderer->DrawTextureIndexed(pX, pY, pTexture); + pRenderer->DrawTextureIndexed(pX, pY, pButton->pTextures[0]); viewparams->bRedrawGameUI = 1; break; } @@ -11644,7 +11517,7 @@ //----- (00419379) -------------------------------------------------------- void __cdecl sub_419379() { - GUIButton *i; // esi@2 + GUIButton *pButton; // esi@2 if ( dword_507CBC ) { @@ -11654,14 +11527,14 @@ pBtn_Down->Release(); pBtn_Down = 0; pBtn_Up = 0; - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) - { - if ( i->msg == UIMSG_InventoryLeftClick ) - { - i->uX = dword_50698C; - i->uY = dword_506988; - i->uZ = dword_506984; - i->uW = dword_506980; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_InventoryLeftClick ) + { + pButton->uX = dword_50698C; + pButton->uY = dword_506988; + pButton->uZ = dword_506984; + pButton->uW = dword_506980; pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); } }