comparison UIRest.cpp @ 956:e9292c58644a

Слияние
author Ritor1
date Thu, 02 May 2013 11:03:26 +0600
parents 21cc2b274220 c0d0656aa662
children 9a5db2cf999a
comparison
equal deleted inserted replaced
955:21cc2b274220 956:e9292c58644a
31 #include "Time.h" 31 #include "Time.h"
32 #include "IconFrameTable.h" 32 #include "IconFrameTable.h"
33 #include "Awards.h" 33 #include "Awards.h"
34 #include "Autonotes.h" 34 #include "Autonotes.h"
35 #include "stru160.h" 35 #include "stru160.h"
36 #include "stru279.h"
37 #include "TurnEngine.h" 36 #include "TurnEngine.h"
38 #include "stru277.h" 37 #include "CastSpellInfo.h"
39 #include "Weather.h" 38 #include "Weather.h"
40 #include "stru272.h"
41 #include "stru298.h" 39 #include "stru298.h"
42 #include "StorylineTextTable.h" 40 #include "StorylineTextTable.h"
43 #include "Events2D.h" 41 #include "Events2D.h"
44 #include "texts.h" 42 #include "texts.h"
45 #include "stru351.h"
46 43
47 #include "mm7_data.h" 44 #include "mm7_data.h"
48 45
49 46
50 47
51 //----- (0041F6C1) -------------------------------------------------------- 48 //----- (0041F6C1) --------------------------------------------------------
52 void __cdecl RestUI_Initialize() 49 void __cdecl RestUI_Initialize()
53 { 50 {
54 Player *pPlayer; // eax@10 51 Player *v0; // eax@10
55 52
56 if ( !dword_506F14 ) 53 if ( !dword_506F14 )
57 pAudioPlayer->StopChannels(-1, -1); 54 pAudioPlayer->StopChannels(-1, -1);
58 if ( pCurrentScreen ) 55 if ( pCurrentScreen )
59 { 56 {
60 pGUIWindow_CurrentMenu->Release(); 57 pGUIWindow_CurrentMenu->Release();
61 pCurrentScreen = SCREEN_GAME; 58 pCurrentScreen = SCREEN_GAME;
62 viewparams->bRedrawGameUI = 1; 59 viewparams->bRedrawGameUI = 1;
63 } 60 }
64 pEventTimer->Pause(); 61 pEventTimer->Pause();
65 if ( dword_506F14 != 2 ) 62 if ( dword_506F14 != 2 )
66 GUIWindow::Create(518, 450, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0); 63 GUIWindow::Create(518u, 450u, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0);
67 _506F18_num_hours_to_sleep = 0; 64 _506F18_num_hours_to_sleep = 0;
68 dword_506F14 = 0; 65 dword_506F14 = 0;
69 uRestUI_FoodRequiredToRest = 2; 66 uRestUI_FoodRequiredToRest = 2;
70 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 67 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
71 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 68 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(
72 if ( PartyHasDragon() ) 69 pParty->vPosition.x,
73 { 70 pParty->vPosition.y,
74 pPlayer = pParty->pPlayers;//[0].uClass; this incorrect 71 pParty->vPosition.z);
75 while ( pPlayer <= &pParty->pPlayers[3] ) 72 if ( PartyHasDragon() )
76 { 73 {
77 ++pPlayer; 74 v0 = pParty->pPlayers;//[0].uClass;
78 if ( pPlayer > &pParty->pPlayers[3] ) 75 while ( v0 <= &pParty->pPlayers[3] )
79 break; 76 {
80 } 77 ++v0;
81 if (pPlayer->classType == PLAYER_CLASS_WARLOCK) 78 if ( v0 > &pParty->pPlayers[3] )
82 ++uRestUI_FoodRequiredToRest; 79 break;
83 } 80 }
84 if ( CheckHiredNPCSpeciality(Porter) ) 81 if(v0->classType == PLAYER_CLASS_WARLOCK)
85 --uRestUI_FoodRequiredToRest; 82 ++uRestUI_FoodRequiredToRest;
86 if ( CheckHiredNPCSpeciality(QuarterMaster) ) 83 }
87 uRestUI_FoodRequiredToRest -= 2; 84 if ( CheckHiredNPCSpeciality(Porter) )
88 if ( CheckHiredNPCSpeciality(Gypsy) ) 85 --uRestUI_FoodRequiredToRest;
89 --uRestUI_FoodRequiredToRest; 86 if ( CheckHiredNPCSpeciality(QuarterMaster) )
90 if ( uRestUI_FoodRequiredToRest < 1 ) 87 uRestUI_FoodRequiredToRest -= 2;
91 uRestUI_FoodRequiredToRest = 1; 88 if ( CheckHiredNPCSpeciality(Gypsy) )
92 if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) ) 89 --uRestUI_FoodRequiredToRest;
93 uRestUI_FoodRequiredToRest = 0; 90 if ( uRestUI_FoodRequiredToRest < 1 )
94 ++pIcons_LOD->uTexturePacksCount; 91 uRestUI_FoodRequiredToRest = 1;
95 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 92 if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) )
96 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 93 uRestUI_FoodRequiredToRest = 0;
97 pCurrentScreen = SCREEN_REST; 94 ++pIcons_LOD->uTexturePacksCount;
98 _507CD4_RestUI_hourglass_anim_controller = 0; 95 if ( !pIcons_LOD->uNumPrevLoadedFiles )
99 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); 96 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
100 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); 97 pCurrentScreen = SCREEN_REST;
101 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); 98 _507CD4_RestUI_hourglass_anim_controller = 0;
102 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); 99 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE);
103 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); 100 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
104 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); 101 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE);
105 LoadActualSkyFrame(); 102 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
106 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0); 103 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
107 pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", 104 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
108 (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0), 0); 105
109 pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton(24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 0x52u, "", 106 LoadActualSkyFrame();
110 (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0), 0); 107
111 pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton(61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 0x44u, "", 108 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Rest, 0, 0);
112 (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0), 0); 109 pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
113 pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton(61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 0x48u, "", 110 pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 0x52u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
114 (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0), 0); 111 pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 0x44u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
115 pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton(61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 0x4Du, "", 112 pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 0x48u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
116 (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0), 0); 113 pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 0x4Du, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
117 } 114 }
118 115
119 //----- (0041FA01) -------------------------------------------------------- 116 //----- (0041FA01) --------------------------------------------------------
120 void __cdecl RestUI_Draw() 117 void __cdecl RestUI_Draw()
121 { 118 {
132 unsigned int v10; // [sp+D8h] [bp-Ch]@9 129 unsigned int v10; // [sp+D8h] [bp-Ch]@9
133 __int16 a9[2]; // [sp+DCh] [bp-8h]@1 130 __int16 a9[2]; // [sp+DCh] [bp-8h]@1
134 int a5; // [sp+E0h] [bp-4h]@1 131 int a5; // [sp+E0h] [bp-4h]@1
135 132
136 v0 = 0; 133 v0 = 0;
137 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); 134 a5 = TargetColor(0xAu, 0, 0);
138 *(int *)a9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE6u, 0xD6u, 0xC1u); 135 *(int *)a9 = TargetColor(0xE6u, 0xD6u, 0xC1u);
139 ppPlayers = &pPlayers[1]; 136 ppPlayers = &pPlayers[1];
140 do 137 do
141 { 138 {
142 pPlayer = *ppPlayers; 139 pPlayer = *ppPlayers;
143 if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 ) 140 if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 )
145 ++ppPlayers; 142 ++ppPlayers;
146 } 143 }
147 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); 144 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] );
148 if ( v0 ) 145 if ( v0 )
149 { 146 {
150 pRenderer->DrawTextureIndexed( 147 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain));
151 8u,
152 8u,
153 (Texture *)(uTextureID_RestUI_restmain != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restmain] : 0));
154 v10 = pParty->uCurrentHour; 148 v10 = pParty->uCurrentHour;
155 dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; 149 dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
156 if ( (signed int)pParty->uCurrentHour <= 12 ) 150 if ( (signed int)pParty->uCurrentHour <= 12 )
157 { 151 {
158 if ( !v10 ) 152 if ( !v10 )