Mercurial > mm7
comparison GUI/GUIWindow.cpp @ 2541:a902abdfc7f2
1. Renamed class Game to class Engine.
2. Separated game logic as state of FSM from game logic as engine.
3. Found out that many UI screen initializers were optimized away, intially
they all returned newly created window as separate object like it is done
in CharacterUI_Initialize.
author | a.parshin |
---|---|
date | Sun, 10 May 2015 01:29:11 +0200 |
parents | 9ec6b8be16fe |
children | bacf9809126a |
comparison
equal
deleted
inserted
replaced
2540:abc6a9d079b9 | 2541:a902abdfc7f2 |
---|---|
1 #define _CRTDBG_MAP_ALLOC | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <crtdbg.h> | 3 #include <crtdbg.h> |
4 | 4 |
5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 #include "Engine/ErrorHandling.h" | 6 #include "Engine/Engine.h" |
7 | 7 |
8 #include "GUIWindow.h" | 8 #include "GUIWindow.h" |
9 #include "GUIFont.h" | 9 #include "GUIFont.h" |
10 #include "Engine/Party.h" | 10 #include "Engine/Party.h" |
11 #include "Engine/LOD.h" | 11 #include "Engine/LOD.h" |
21 #include "Engine/texts.h" | 21 #include "Engine/texts.h" |
22 #include "Engine/Autonotes.h" | 22 #include "Engine/Autonotes.h" |
23 #include "Engine/Awards.h" | 23 #include "Engine/Awards.h" |
24 #include "Engine/Objects/Chest.h" | 24 #include "Engine/Objects/Chest.h" |
25 #include "Engine/Graphics/Outdoor.h" | 25 #include "Engine/Graphics/Outdoor.h" |
26 #include "Engine/Game.h" | |
27 #include "Engine/Tables/IconFrameTable.h" | 26 #include "Engine/Tables/IconFrameTable.h" |
28 #include "Engine/Objects/Actor.h" | 27 #include "Engine/Objects/Actor.h" |
29 | 28 |
30 #include "GUI\UI\UIArena.h" | 29 #include "GUI\UI\UIArena.h" |
31 #include "Engine/Events.h" | 30 #include "Engine/Events.h" |
256 switch( this->eWindowType ) | 255 switch( this->eWindowType ) |
257 { | 256 { |
258 case WINDOW_GreetingNPC: | 257 case WINDOW_GreetingNPC: |
259 { | 258 { |
260 pIcons_LOD->SyncLoadedFilesCount(); | 259 pIcons_LOD->SyncLoadedFilesCount(); |
261 pCurrentScreen = pMainScreenNum; | 260 current_screen_type = prev_screen_type; |
262 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); | 261 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
263 break; | 262 break; |
264 } | 263 } |
265 case WINDOW_HouseInterior: | 264 case WINDOW_HouseInterior: |
266 { | 265 { |
273 pIcons_LOD->RemoveTexturesPackFromTextureList(); | 272 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
274 dword_5C35D4 = 0; | 273 dword_5C35D4 = 0; |
275 if ( bFlipOnExit ) | 274 if ( bFlipOnExit ) |
276 { | 275 { |
277 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); | 276 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); |
278 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; | 277 pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
279 } | 278 } |
280 pParty->uFlags |= 2u; | 279 pParty->uFlags |= 2u; |
281 break; | 280 break; |
282 } | 281 } |
283 case WINDOW_Transition: | 282 case WINDOW_Transition: |
284 { | 283 { |
285 //pVideoPlayer->Unload(); | 284 //pVideoPlayer->Unload(); |
286 pTexture_outside->Release(); | 285 pTexture_outside->Release(); |
287 pTexture_Dialogue_Background->Release(); | 286 pTexture_Dialogue_Background->Release(); |
288 pIcons_LOD->SyncLoadedFilesCount(); | 287 pIcons_LOD->SyncLoadedFilesCount(); |
289 pCurrentScreen = pMainScreenNum; | 288 current_screen_type = prev_screen_type; |
290 break; | 289 break; |
291 } | 290 } |
292 case WINDOW_SpellBook: | 291 case WINDOW_SpellBook: |
293 { | 292 { |
294 OnCloseSpellBookPage(); | 293 OnCloseSpellBookPage(); |
303 case WINDOW_ChangeLocation: | 302 case WINDOW_ChangeLocation: |
304 { | 303 { |
305 pTexture_outside->Release(); | 304 pTexture_outside->Release(); |
306 pTexture_Dialogue_Background->Release(); | 305 pTexture_Dialogue_Background->Release(); |
307 pIcons_LOD->SyncLoadedFilesCount(); | 306 pIcons_LOD->SyncLoadedFilesCount(); |
308 pCurrentScreen = pMainScreenNum; | 307 current_screen_type = prev_screen_type; |
309 break; | 308 break; |
310 } | 309 } |
311 case WINDOW_Dialogue: | 310 case WINDOW_Dialogue: |
312 { | 311 { |
313 if ( !dword_591084 ) | 312 if ( !dword_591084 ) |
314 pDialogueNPCPortraits[0]->Release(); | 313 pDialogueNPCPortraits[0]->Release(); |
315 uNumDialogueNPCPortraits = 0; | 314 uNumDialogueNPCPortraits = 0; |
316 pTexture_Dialogue_Background->Release(); | 315 pTexture_Dialogue_Background->Release(); |
317 | 316 |
318 pIcons_LOD->SyncLoadedFilesCount(); | 317 pIcons_LOD->SyncLoadedFilesCount(); |
319 pCurrentScreen = pMainScreenNum; | 318 current_screen_type = prev_screen_type; |
320 break; | 319 break; |
321 } | 320 } |
322 case WINDOW_null: | 321 case WINDOW_null: |
323 return; | 322 return; |
324 default: | 323 default: |
373 GUIWindow journal_window; // [sp+18h] [bp-54h]@8 | 372 GUIWindow journal_window; // [sp+18h] [bp-54h]@8 |
374 | 373 |
375 pAudioPlayer->StopChannels(-1, -1); | 374 pAudioPlayer->StopChannels(-1, -1); |
376 InitializeBookFonts(); | 375 InitializeBookFonts(); |
377 this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close | 376 this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close |
378 pCurrentScreen = SCREEN_BOOKS; | 377 current_screen_type = SCREEN_BOOKS; |
379 full_num_items_in_book = 0; | 378 full_num_items_in_book = 0; |
380 books_primary_item_per_page = 0; | 379 books_primary_item_per_page = 0; |
381 books_page_number = 0; | 380 books_page_number = 0; |
382 num_achieved_awards = 0; | 381 num_achieved_awards = 0; |
383 switch (this->par1C) | 382 switch (this->par1C) |
894 return; | 893 return; |
895 } | 894 } |
896 v4 = (char *)pDialogueNPCCount - 1; | 895 v4 = (char *)pDialogueNPCCount - 1; |
897 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); | 896 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
898 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); | 897 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); |
899 if ( pCurrentScreen == SCREEN_E ) | 898 if ( current_screen_type == SCREEN_E ) |
900 { | 899 { |
901 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 900 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
902 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | 901 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
903 { | 902 { |
904 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | 903 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1436 case WINDOW_Book: { | 1435 case WINDOW_Book: { |
1437 pWindow->InitializeBookView(); | 1436 pWindow->InitializeBookView(); |
1438 break; | 1437 break; |
1439 } | 1438 } |
1440 case WINDOW_Dialogue: { | 1439 case WINDOW_Dialogue: { |
1441 pMainScreenNum = pCurrentScreen; | 1440 prev_screen_type = current_screen_type; |
1442 pCurrentScreen = SCREEN_NPC_DIALOGUE; | 1441 current_screen_type = SCREEN_NPC_DIALOGUE; |
1443 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" | 1442 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" |
1444 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | 1443 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
1445 if ( pWindow->par1C != 1 ) | 1444 if ( pWindow->par1C != 1 ) |
1446 { | 1445 { |
1447 num_menu_buttons = 0; | 1446 num_menu_buttons = 0; |
1528 } | 1527 } |
1529 break; | 1528 break; |
1530 } | 1529 } |
1531 case WINDOW_ChangeLocation: | 1530 case WINDOW_ChangeLocation: |
1532 { | 1531 { |
1533 pMainScreenNum = pCurrentScreen; | 1532 prev_screen_type = current_screen_type; |
1534 pCurrentScreen = SCREEN_CHANGE_LOCATION; | 1533 current_screen_type = SCREEN_CHANGE_LOCATION; |
1535 pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области | 1534 pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области |
1536 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | 1535 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1537 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); | 1536 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); |
1538 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); | 1537 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); |
1539 break; | 1538 break; |
1542 InitializeBookTextures(); | 1541 InitializeBookTextures(); |
1543 pWindow->OpenSpellBook(); | 1542 pWindow->OpenSpellBook(); |
1544 break; | 1543 break; |
1545 } | 1544 } |
1546 case WINDOW_GreetingNPC: {// окно приветствия НПС | 1545 case WINDOW_GreetingNPC: {// окно приветствия НПС |
1547 pMainScreenNum = pCurrentScreen; | 1546 prev_screen_type = current_screen_type; |
1548 pKeyActionMap->EnterText(0, 15, pWindow); | 1547 pKeyActionMap->EnterText(0, 15, pWindow); |
1549 pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; | 1548 current_screen_type = SCREEN_BRANCHLESS_NPC_DIALOG; |
1550 break; | 1549 break; |
1551 } | 1550 } |
1552 | 1551 |
1553 } | 1552 } |
1554 return pWindow; | 1553 return pWindow; |
1561 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0); | 1560 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0); |
1562 return pWindow; | 1561 return pWindow; |
1563 } | 1562 } |
1564 if (eWindowType == WINDOW_HouseInterior) | 1563 if (eWindowType == WINDOW_HouseInterior) |
1565 { | 1564 { |
1566 pCurrentScreen = SCREEN_HOUSE; | 1565 current_screen_type = SCREEN_HOUSE; |
1567 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания | 1566 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания |
1568 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | 1567 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
1569 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) | 1568 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) |
1570 { | 1569 { |
1571 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) | 1570 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
1595 } | 1594 } |
1596 else | 1595 else |
1597 { | 1596 { |
1598 if (eWindowType == WINDOW_Transition) | 1597 if (eWindowType == WINDOW_Transition) |
1599 { | 1598 { |
1600 pMainScreenNum = pCurrentScreen; | 1599 prev_screen_type = current_screen_type; |
1601 pCurrentScreen = SCREEN_INPUT_BLV; | 1600 current_screen_type = SCREEN_INPUT_BLV; |
1602 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена | 1601 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена |
1603 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | 1602 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1604 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); | 1603 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); |
1605 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); | 1604 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); |
1606 return pWindow; | 1605 return pWindow; |
1628 pBtn_ExitCancel = pWindow->CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена | 1627 pBtn_ExitCancel = pWindow->CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена |
1629 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | 1628 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); |
1630 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель | 1629 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель |
1631 ++pIcons_LOD->uTexturePacksCount; | 1630 ++pIcons_LOD->uTexturePacksCount; |
1632 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | 1631 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
1633 pCurrentScreen = SCREEN_CASTING; | 1632 current_screen_type = SCREEN_CASTING; |
1634 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | 1633 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
1635 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | 1634 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
1636 } | 1635 } |
1637 } | 1636 } |
1638 return pWindow; | 1637 return pWindow; |
1746 GameUI_DrawBranchlessDialogue(); | 1745 GameUI_DrawBranchlessDialogue(); |
1747 continue; | 1746 continue; |
1748 } | 1747 } |
1749 case WINDOW_Chest: | 1748 case WINDOW_Chest: |
1750 { | 1749 { |
1751 if ( pCurrentScreen == SCREEN_CHEST ) | 1750 if ( current_screen_type == SCREEN_CHEST ) |
1752 { | 1751 { |
1753 Chest::DrawChestUI(pWindow->par1C); | 1752 Chest::DrawChestUI(pWindow->par1C); |
1754 } | 1753 } |
1755 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | 1754 else if ( current_screen_type == SCREEN_CHEST_INVENTORY ) |
1756 { | 1755 { |
1757 pRenderer->ClearZBuffer(0, 479); | 1756 pRenderer->ClearZBuffer(0, 479); |
1758 draw_leather(); | 1757 draw_leather(); |
1759 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 1758 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1760 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); | 1759 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); |
1827 { | 1826 { |
1828 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 1827 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
1829 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); | 1828 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); |
1830 pEventTimer->Resume(); | 1829 pEventTimer->Resume(); |
1831 ptr_507BD0->Release(); | 1830 ptr_507BD0->Release(); |
1832 pCurrentScreen = SCREEN_GAME; | 1831 current_screen_type = SCREEN_GAME; |
1833 viewparams->bRedrawGameUI = true; | 1832 viewparams->bRedrawGameUI = true; |
1834 continue; | 1833 continue; |
1835 } | 1834 } |
1836 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | 1835 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
1837 { | 1836 { |
1849 if ( !pKeyActionMap->field_204 ) | 1848 if ( !pKeyActionMap->field_204 ) |
1850 { | 1849 { |
1851 ItemGen2.Reset(); | 1850 ItemGen2.Reset(); |
1852 pWindow->Release(); | 1851 pWindow->Release(); |
1853 pEventTimer->Resume(); | 1852 pEventTimer->Resume(); |
1854 pCurrentScreen = 0; | 1853 current_screen_type = SCREEN_GAME; |
1855 viewparams->bRedrawGameUI = true; | 1854 viewparams->bRedrawGameUI = true; |
1856 v26 = atoi(pKeyActionMap->pPressedKeysBuffer); | 1855 v26 = atoi(pKeyActionMap->pPressedKeysBuffer); |
1857 if ( v26 > 0 ) | 1856 if ( v26 > 0 ) |
1858 { | 1857 { |
1859 if ( v26 < 800 ) | 1858 if ( v26 < 800 ) |
1955 pHint = pWindow->Hint; | 1954 pHint = pWindow->Hint; |
1956 viewparams->bRedrawGameUI = 1; | 1955 viewparams->bRedrawGameUI = 1; |
1957 if ( pHint && pHint != (char *)1 ) | 1956 if ( pHint && pHint != (char *)1 ) |
1958 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | 1957 pButton->DrawLabel(pHint, pFontCreate, 0, 0); |
1959 pWindow->Release(); | 1958 pWindow->Release(); |
1960 if (pCurrentScreen == SCREEN_SAVEGAME) | 1959 if (current_screen_type == SCREEN_SAVEGAME) |
1961 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); | 1960 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); |
1962 else | 1961 else |
1963 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | 1962 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); |
1964 continue; | 1963 continue; |
1965 } | 1964 } |
2040 if ( !pKeyActionMap->field_204 ) | 2039 if ( !pKeyActionMap->field_204 ) |
2041 { | 2040 { |
2042 ItemGen2.Reset(); | 2041 ItemGen2.Reset(); |
2043 pWindow->Release(); | 2042 pWindow->Release(); |
2044 pEventTimer->Resume(); | 2043 pEventTimer->Resume(); |
2045 pCurrentScreen = SCREEN_GAME; | 2044 current_screen_type = SCREEN_GAME; |
2046 viewparams->bRedrawGameUI = 1; | 2045 viewparams->bRedrawGameUI = 1; |
2047 v39 = atoi(pKeyActionMap->pPressedKeysBuffer); | 2046 v39 = atoi(pKeyActionMap->pPressedKeysBuffer); |
2048 if ( v39 > 0 ) | 2047 if ( v39 > 0 ) |
2049 { | 2048 { |
2050 if ( v39 < 800 ) | 2049 if ( v39 < 800 ) |
2103 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | 2102 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; |
2104 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | 2103 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; |
2105 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); | 2104 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); |
2106 } | 2105 } |
2107 | 2106 |
2108 int modal_window_prev_screen; | 2107 enum CURRENT_SCREEN modal_window_prev_screen_type; |
2109 | 2108 |
2110 //----- (004141CA) -------------------------------------------------------- | 2109 //----- (004141CA) -------------------------------------------------------- |
2111 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) | 2110 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) |
2112 { | 2111 { |
2113 pEventTimer->Pause(); | 2112 pEventTimer->Pause(); |
2114 modal_window_prev_screen = pCurrentScreen; | 2113 modal_window_prev_screen_type = current_screen_type; |
2115 pModalWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ModalWindow, OnRelease_message, pStrHint); | 2114 pModalWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ModalWindow, OnRelease_message, pStrHint); |
2116 pCurrentScreen = SCREEN_MODAL_WINDOW; | 2115 current_screen_type = SCREEN_MODAL_WINDOW; |
2117 } | 2116 } |
2118 | 2117 |
2119 //----- (0041420D) -------------------------------------------------------- | 2118 //----- (0041420D) -------------------------------------------------------- |
2120 void ModalWindow_ShowHint() | 2119 void ModalWindow_ShowHint() |
2121 { | 2120 { |
2138 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0); | 2137 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0); |
2139 | 2138 |
2140 pModalWindow->Release(); | 2139 pModalWindow->Release(); |
2141 pModalWindow = nullptr; | 2140 pModalWindow = nullptr; |
2142 | 2141 |
2143 pCurrentScreen = modal_window_prev_screen; | 2142 current_screen_type = modal_window_prev_screen_type; |
2144 pEventTimer->Resume(); | 2143 pEventTimer->Resume(); |
2145 } | 2144 } |
2146 | 2145 |
2147 //----- (00467FB6) -------------------------------------------------------- | 2146 //----- (00467FB6) -------------------------------------------------------- |
2148 void CreateScrollWindow() | 2147 void CreateScrollWindow() |
2585 free(v4); | 2584 free(v4); |
2586 } | 2585 } |
2587 } | 2586 } |
2588 | 2587 |
2589 | 2588 |
2590 // 4E28F8: using guessed type int pCurrentScreen; | 2589 // 4E28F8: using guessed type int current_screen_type; |
2591 | 2590 |
2592 //----- (0040F82D) -------------------------------------------------------- | 2591 //----- (0040F82D) -------------------------------------------------------- |
2593 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | 2592 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) |
2594 { | 2593 { |
2595 assert(uTextureId != -1); | 2594 assert(uTextureId != -1); |
2682 dialogue_show_profession_details = false; | 2681 dialogue_show_profession_details = false; |
2683 uDialogueType = 13; | 2682 uDialogueType = 13; |
2684 if (uActiveCharacter) | 2683 if (uActiveCharacter) |
2685 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | 2684 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
2686 if (!dword_7241C8) | 2685 if (!dword_7241C8) |
2687 pGame->Draw(); | 2686 pEngine->Draw(); |
2688 dword_7241C8 = 0; | 2687 dword_7241C8 = 0; |
2689 return; | 2688 return; |
2690 } | 2689 } |
2691 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice); | 2690 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice); |
2692 } | 2691 } |
2792 break; | 2791 break; |
2793 } | 2792 } |
2794 } | 2793 } |
2795 } | 2794 } |
2796 if (!dword_7241C8) | 2795 if (!dword_7241C8) |
2797 pGame->Draw(); | 2796 pEngine->Draw(); |
2798 dword_7241C8 = 0; | 2797 dword_7241C8 = 0; |
2799 } | 2798 } |
2800 | 2799 |
2801 //----- (004B3E1E) -------------------------------------------------------- | 2800 //----- (004B3E1E) -------------------------------------------------------- |
2802 void sub_4B3E1E() | 2801 void sub_4B3E1E() |