2502
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
2541
|
6
|
|
7 #include "Engine/Engine.h"
|
|
8
|
2502
|
9 #include "GUIButton.h"
|
|
10 #include "GUIWindow.h"
|
|
11 #include "GUIFont.h"
|
|
12
|
|
13 #include "Engine/LOD.h"
|
|
14 #include "Engine/Texts.h"
|
|
15 #include "OSWindow.h"
|
|
16
|
|
17
|
|
18
|
|
19 struct GUIButton *pBtn_CloseBook;
|
|
20 struct GUIButton *pBtn_InstallRemoveSpell;
|
|
21 struct GUIButton *pBtn_Autonotes_Instructors;
|
|
22 struct GUIButton *pBtn_Autonotes_Misc;
|
|
23 struct GUIButton *pBtn_Book_6;
|
|
24 struct GUIButton *pBtn_Book_5;
|
|
25 struct GUIButton *pBtn_Book_4;
|
|
26 struct GUIButton *pBtn_Book_3;
|
|
27 struct GUIButton *pBtn_Book_2;
|
|
28 struct GUIButton *pBtn_Book_1;
|
|
29
|
|
30
|
|
31 struct GUIButton *pPlayerCreationUI_BtnReset;
|
|
32 struct GUIButton *pPlayerCreationUI_BtnOK;
|
|
33 struct GUIButton *pBtn_ExitCancel;
|
|
34 struct GUIButton *pBtn_YES;
|
|
35 struct GUIButton *pPlayerCreationUI_BtnPlus;
|
|
36 struct GUIButton *pPlayerCreationUI_BtnMinus;
|
|
37
|
|
38
|
|
39 struct GUIButton *pButton_RestUI_Main;
|
|
40 struct GUIButton *pButton_RestUI_Exit;
|
|
41 struct GUIButton *pButton_RestUI_Wait5Minutes;
|
|
42 struct GUIButton *pButton_RestUI_WaitUntilDawn;
|
|
43 struct GUIButton *pButton_RestUI_Wait1Hour;
|
|
44
|
|
45
|
|
46 struct GUIButton *pCharacterScreen_ExitBtn;
|
|
47 struct GUIButton *pCharacterScreen_AwardsBtn;
|
|
48 struct GUIButton *pCharacterScreen_InventoryBtn;
|
|
49 struct GUIButton *pCharacterScreen_SkillsBtn;
|
|
50 struct GUIButton *pCharacterScreen_StatsBtn;
|
|
51 struct GUIButton *pCharacterScreen_DollBtn;
|
|
52 struct GUIButton *pCharacterScreen_DetalizBtn;
|
|
53
|
|
54
|
|
55 struct GUIButton *pBtn_NPCRight;
|
|
56 struct GUIButton *pBtn_NPCLeft;
|
|
57 struct GUIButton *pBtn_GameSettings;
|
|
58 struct GUIButton *pBtn_QuickReference;
|
|
59 struct GUIButton *pBtn_CastSpell;
|
|
60 struct GUIButton *pBtn_Rest;
|
|
61 struct GUIButton *pBtn_History;
|
|
62 struct GUIButton *pBtn_Calendar;
|
|
63 struct GUIButton *pBtn_Maps;
|
|
64 struct GUIButton *pBtn_Autonotes;
|
|
65 struct GUIButton *pBtn_Quests;
|
|
66
|
|
67
|
|
68 struct GUIButton *pMMT_MainMenu_BtnMM6;
|
|
69 struct GUIButton *pMMT_MainMenu_BtnMM7;
|
|
70 struct GUIButton *pMMT_MainMenu_BtnMM8;
|
|
71 struct GUIButton *pMMT_MainMenu_BtnContinue;
|
|
72 struct GUIButton *pMMT_MainMenu_BtnExit;
|
|
73
|
|
74
|
|
75 struct GUIButton *pMainMenu_BtnExit;
|
|
76 struct GUIButton *pMainMenu_BtnCredits;
|
|
77 struct GUIButton *pMainMenu_BtnLoad;
|
|
78 struct GUIButton *pMainMenu_BtnNew;
|
|
79
|
|
80
|
|
81 struct GUIButton *pBtn_Up;
|
|
82 struct GUIButton *pBtn_Down;
|
|
83 struct GUIButton *ptr_507BA4;
|
|
84
|
|
85
|
|
86 struct GUIWindow *pPrimaryWindow;
|
|
87 struct GUIWindow *pChestWindow;
|
|
88 struct GUIWindow *pDialogueWindow;
|
|
89 struct GUIWindow *window_SpeakInHouse;
|
|
90 struct GUIWindow *pGUIWindow_ScrollWindow;
|
|
91 struct GUIWindow *ptr_507BC8;
|
|
92 struct GUIWindow *pGUIWindow_CurrentMenu;
|
|
93 struct GUIWindow *ptr_507BD0;
|
|
94 struct GUIWindow *pGUIWindow_Settings;
|
|
95 struct GUIWindow *pModalWindow;
|
|
96 struct GUIWindow *pGUIWindow_EscMessageWindow;
|
|
97 struct GUIWindow *pBooksWindow;
|
|
98 struct GUIWindow *pGUIWindow2;
|
|
99
|
|
100
|
|
101 struct GUIButton *pBtn_Resume;
|
|
102 struct GUIButton *pBtn_QuitGame;
|
|
103 struct GUIButton *pBtn_GameControls;
|
|
104 struct GUIButton *pBtn_LoadGame;
|
|
105 struct GUIButton *pBtn_SaveGame;
|
|
106 struct GUIButton *pBtn_NewGame;
|
|
107
|
|
108 struct GUIButton *pBtn_SliderRight;
|
|
109 struct GUIButton *pBtn_SliderLeft;
|
|
110
|
|
111
|
|
112 struct GUIButton *pBtnDownArrow;
|
|
113 struct GUIButton *pBtnArrowUp;
|
|
114 struct GUIButton *pBtnCancel;
|
|
115 struct GUIButton *pBtnLoadSlot;
|
|
116
|
|
117
|
|
118 std::array<GUIButton*, 4> pCreationUI_BtnPressRight2;
|
|
119 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft2;
|
|
120 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft;
|
|
121 std::array<GUIButton*, 4> pCreationUI_BtnPressRight;
|
|
122
|
|
123
|
|
124
|
|
125
|
|
126
|
|
127
|
|
128 //----- (0041D0D8) --------------------------------------------------------
|
|
129 void GUIButton::Release()
|
|
130 {
|
|
131 if ( this )
|
|
132 {
|
|
133 if ( this == this->pParent->pControlsHead )
|
|
134 {
|
|
135 if ( this->pNext )
|
|
136 {
|
|
137 this->pParent->pControlsHead = this->pNext;
|
|
138 this->pNext->pPrev = 0;
|
|
139 }
|
|
140 else
|
|
141 {
|
|
142 this->pParent->pControlsHead = 0;
|
|
143 this->pParent->pControlsTail = 0;
|
|
144 }
|
|
145 }
|
|
146 else
|
|
147 {
|
|
148 if ( this->pNext )
|
|
149 {
|
|
150 this->pPrev->pNext = this->pNext;
|
|
151 this->pNext->pPrev = this->pPrev;
|
|
152 }
|
|
153 else
|
|
154 {
|
|
155 this->pPrev->pNext = 0;
|
|
156 this->pParent->pControlsTail = this->pPrev;
|
|
157 }
|
|
158 }
|
|
159 --this->pParent->uNumControls;
|
|
160 }
|
|
161 }
|
|
162
|
|
163 //----- (00415180) --------------------------------------------------------
|
|
164 void GUIButton::DrawLabel( const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor )
|
|
165 {
|
|
166 //strlen(edx0);
|
|
167 return pParent->DrawText(pFont,
|
|
168 this->uX + (signed int)(this->uWidth - pFont->GetLineWidth(label_text)) / 2,
|
|
169 this->uY + (signed int)(this->uHeight - pFont->uFontHeight) / 2,
|
|
170 a5, label_text, 0, 0, uFontShadowColor);
|
|
171 }
|
|
172 //----- (004B36CC) --------------------------------------------------------
|
|
173 void CreateButtonInColumn( int column_pos, unsigned int control_id )
|
|
174 {
|
|
175 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0);
|
|
176 }
|
|
177 //----- (00419379) --------------------------------------------------------
|
|
178 void ReleaseAwardsScrollBar()
|
|
179 {
|
|
180 GUIButton *pButton; // esi@2
|
|
181
|
|
182 if ( awards_scroll_bar_created )
|
|
183 {
|
|
184 awards_scroll_bar_created = false;
|
|
185 ptr_507BA4->Release();
|
|
186 pBtn_Up->Release();
|
|
187 pBtn_Down->Release();
|
|
188 pBtn_Down = 0;
|
|
189 pBtn_Up = 0;
|
|
190 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
|
|
191 {
|
|
192 if ( pButton->msg == UIMSG_InventoryLeftClick )
|
|
193 {
|
|
194 pButton->uX = dword_50698C_uX;
|
|
195 pButton->uY = dword_506988_uY;
|
|
196 pButton->uZ = dword_506984_uZ;
|
|
197 pButton->uW = dword_506980_uW;
|
|
198 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0);
|
|
199 }
|
|
200 }
|
|
201 }
|
|
202 }
|
|
203 //----- (00419220) --------------------------------------------------------
|
|
204 void CreateAwardsScrollBar()
|
|
205 {
|
|
206 GUIButton *pButton; // eax@2
|
|
207
|
|
208 if ( !awards_scroll_bar_created )
|
|
209 {
|
|
210 awards_scroll_bar_created = 1;
|
|
211 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
|
|
212 {
|
|
213 if ( pButton->msg == UIMSG_InventoryLeftClick )
|
|
214 {
|
|
215 dword_50698C_uX = pButton->uX;
|
|
216 dword_506988_uY = pButton->uY;
|
|
217 dword_506984_uZ = pButton->uZ;
|
|
218 dword_506980_uW = pButton->uW;
|
|
219 pButton->uW = 0;
|
|
220 pButton->uZ = 0;
|
|
221 pButton->uY = 0;
|
|
222 pButton->uX = 0;
|
|
223 }
|
|
224 }
|
|
225 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46,
|
|
226 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth,
|
|
227 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight,
|
|
228 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "",
|
|
229 pIcons_LOD->GetTexture(uTextureID_ar_up_up),
|
|
230 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0);
|
|
231 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292,
|
|
232 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth,
|
|
233 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight,
|
|
234 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "",
|
|
235 pIcons_LOD->GetTexture(uTextureID_ar_dn_up),
|
|
236 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0);
|
|
237 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_ClickAwardScrollBar, 0, 0, "", 0);
|
|
238 }
|
|
239 }
|
|
240 //----- (004BCA33) --------------------------------------------------------
|
|
241 void UI_CreateEndConversationButton()
|
|
242 {
|
|
243 pDialogueWindow->Release();
|
|
244 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0);
|
|
245 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
|
|
246 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
|
|
247 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
248 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
249 } |