comparison GUI/UI/UIRest.cpp @ 2543:b6140dfeac27

GameOver h/cpp
author a.parshin
date Sun, 10 May 2015 03:21:14 +0200
parents a902abdfc7f2
children c674d547cc7c
comparison
equal deleted inserted replaced
2542:bacf9809126a 2543:b6140dfeac27
16 #include "..\../Engine/Timer.h" 16 #include "..\../Engine/Timer.h"
17 #include "..\../Engine/texts.h" 17 #include "..\../Engine/texts.h"
18 18
19 19
20 20
21 void PrepareToLoadRestUI()
22 {
23 if (!_506F14_resting_stage)
24 pAudioPlayer->StopChannels(-1, -1);
25 if (current_screen_type != SCREEN_GAME)
26 {
27 pGUIWindow_CurrentMenu->Release();
28 current_screen_type = SCREEN_GAME;
29 viewparams->bRedrawGameUI = true;
30 }
31 pEventTimer->Pause();
32 if (_506F14_resting_stage != 2)
33 GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
34 _506F18_num_minutes_to_sleep = 0;
35 _506F14_resting_stage = 0;
36 uRestUI_FoodRequiredToRest = 2;
37 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
38 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
39 if (PartyHasDragon())
40 {
41 for (uint i = 0; i < 4; ++i)
42 {
43 if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK)
44 ++uRestUI_FoodRequiredToRest;
45 }
46 }
47 if (CheckHiredNPCSpeciality(Porter))
48 --uRestUI_FoodRequiredToRest;
49 if (CheckHiredNPCSpeciality(QuarterMaster))
50 uRestUI_FoodRequiredToRest -= 2;
51 if (CheckHiredNPCSpeciality(Gypsy))
52 --uRestUI_FoodRequiredToRest;
53 if (uRestUI_FoodRequiredToRest < 1)
54 uRestUI_FoodRequiredToRest = 1;
55 if (!_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98))//Замок Хармондейл
56 uRestUI_FoodRequiredToRest = 0;
57
58 ++pIcons_LOD->uTexturePacksCount;
59 if (!pIcons_LOD->uNumPrevLoadedFiles)
60 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
61 }
21 //----- (0041F6C1) -------------------------------------------------------- 62 //----- (0041F6C1) --------------------------------------------------------
22 void RestUI_Load() 63 GUIWindow *RestUI_Load()
23 { 64 {
24 if ( !dword_506F14 )
25 pAudioPlayer->StopChannels(-1, -1);
26 if ( current_screen_type != SCREEN_GAME)
27 {
28 pGUIWindow_CurrentMenu->Release();
29 current_screen_type = SCREEN_GAME;
30 viewparams->bRedrawGameUI = true;
31 }
32 pEventTimer->Pause();
33 if ( dword_506F14 != 2 )
34 GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
35 _506F18_num_minutes_to_sleep = 0;
36 dword_506F14 = 0;
37 uRestUI_FoodRequiredToRest = 2;
38 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
39 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
40 if ( PartyHasDragon() )
41 {
42 for ( uint i = 0; i < 4; ++i )
43 {
44 if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK)
45 ++uRestUI_FoodRequiredToRest;
46 }
47 }
48 if ( CheckHiredNPCSpeciality(Porter) )
49 --uRestUI_FoodRequiredToRest;
50 if ( CheckHiredNPCSpeciality(QuarterMaster) )
51 uRestUI_FoodRequiredToRest -= 2;
52 if ( CheckHiredNPCSpeciality(Gypsy) )
53 --uRestUI_FoodRequiredToRest;
54 if ( uRestUI_FoodRequiredToRest < 1 )
55 uRestUI_FoodRequiredToRest = 1;
56 if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )//Замок Хармондейл
57 uRestUI_FoodRequiredToRest = 0;
58
59 ++pIcons_LOD->uTexturePacksCount;
60 if ( !pIcons_LOD->uNumPrevLoadedFiles )
61 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
62
63 current_screen_type = SCREEN_REST;
64 _507CD4_RestUI_hourglass_anim_controller = 0; 65 _507CD4_RestUI_hourglass_anim_controller = 0;
65 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); 66 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE);
66 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); 67 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
67 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); 68 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE);
68 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); 69 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
69 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); 70 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
70 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); 71 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
72
71 OutdoorLocation::LoadActualSkyFrame(); 73 OutdoorLocation::LoadActualSkyFrame();
72 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0); 74
73 pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); 75 auto wnd = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0);
74 pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); 76 pButton_RestUI_Exit = wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
75 pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); 77 pButton_RestUI_Main = wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
76 pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); 78 pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
77 pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); 79 pButton_RestUI_Wait1Hour = wnd->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
80 pButton_RestUI_Wait5Minutes = wnd->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
81
82 return wnd;
78 } 83 }
79 84
80 //----- (0041FA01) -------------------------------------------------------- 85 //----- (0041FA01) --------------------------------------------------------
81 void RestUI_Draw() 86 void RestUI_Draw()
82 { 87 {
159 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); 164 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
160 sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);//Месяц 165 sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);//Месяц
161 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); 166 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
162 sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);//Год 167 sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);//Год
163 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); 168 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
164 if ( dword_506F14 ) 169 if ( _506F14_resting_stage )
165 Party::Sleep6Hours(); 170 Party::Sleep6Hours();
166 } 171 }
167 else 172 else
168 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, 173 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn,
169 (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" 174 (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"