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