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