Mercurial > mm7
annotate GUI/GUIButton.cpp @ 2555:67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
author | a.parshin |
---|---|
date | Thu, 14 May 2015 10:34:40 +0200 |
parents | f2a8ed07e921 |
children | dd36326a9994 |
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" | |
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 *pBtn_Up; | |
76 struct GUIButton *pBtn_Down; | |
77 struct GUIButton *ptr_507BA4; | |
78 | |
79 | |
80 struct GUIWindow *pPrimaryWindow; | |
81 struct GUIWindow *pChestWindow; | |
82 struct GUIWindow *pDialogueWindow; | |
83 struct GUIWindow *window_SpeakInHouse; | |
84 struct GUIWindow *pGUIWindow_ScrollWindow; | |
85 struct GUIWindow *ptr_507BC8; | |
86 struct GUIWindow *pGUIWindow_CurrentMenu; | |
87 struct GUIWindow *ptr_507BD0; | |
2554 | 88 struct GUIWindow *pGUIWindow_CastTargetedSpell; |
2502 | 89 struct GUIWindow *pModalWindow; |
90 struct GUIWindow *pGUIWindow_EscMessageWindow; | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
91 struct GUIWindow *pBooksButtonOverlay; |
2502 | 92 struct GUIWindow *pGUIWindow2; |
93 | |
94 | |
95 struct GUIButton *pBtn_Resume; | |
96 struct GUIButton *pBtn_QuitGame; | |
97 struct GUIButton *pBtn_GameControls; | |
98 struct GUIButton *pBtn_LoadGame; | |
99 struct GUIButton *pBtn_SaveGame; | |
100 struct GUIButton *pBtn_NewGame; | |
101 | |
102 struct GUIButton *pBtn_SliderRight; | |
103 struct GUIButton *pBtn_SliderLeft; | |
104 | |
105 | |
106 struct GUIButton *pBtnDownArrow; | |
107 struct GUIButton *pBtnArrowUp; | |
108 struct GUIButton *pBtnCancel; | |
109 struct GUIButton *pBtnLoadSlot; | |
110 | |
111 | |
112 std::array<GUIButton*, 4> pCreationUI_BtnPressRight2; | |
113 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft2; | |
114 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft; | |
115 std::array<GUIButton*, 4> pCreationUI_BtnPressRight; | |
116 | |
117 | |
118 | |
119 | |
120 | |
121 | |
122 //----- (0041D0D8) -------------------------------------------------------- | |
123 void GUIButton::Release() | |
124 { | |
125 if ( this ) | |
126 { | |
127 if ( this == this->pParent->pControlsHead ) | |
128 { | |
129 if ( this->pNext ) | |
130 { | |
131 this->pParent->pControlsHead = this->pNext; | |
132 this->pNext->pPrev = 0; | |
133 } | |
134 else | |
135 { | |
136 this->pParent->pControlsHead = 0; | |
137 this->pParent->pControlsTail = 0; | |
138 } | |
139 } | |
140 else | |
141 { | |
142 if ( this->pNext ) | |
143 { | |
144 this->pPrev->pNext = this->pNext; | |
145 this->pNext->pPrev = this->pPrev; | |
146 } | |
147 else | |
148 { | |
149 this->pPrev->pNext = 0; | |
150 this->pParent->pControlsTail = this->pPrev; | |
151 } | |
152 } | |
153 --this->pParent->uNumControls; | |
154 } | |
155 } | |
156 | |
157 //----- (00415180) -------------------------------------------------------- | |
158 void GUIButton::DrawLabel( const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor ) | |
159 { | |
160 //strlen(edx0); | |
161 return pParent->DrawText(pFont, | |
162 this->uX + (signed int)(this->uWidth - pFont->GetLineWidth(label_text)) / 2, | |
163 this->uY + (signed int)(this->uHeight - pFont->uFontHeight) / 2, | |
164 a5, label_text, 0, 0, uFontShadowColor); | |
165 } | |
166 //----- (004B36CC) -------------------------------------------------------- | |
167 void CreateButtonInColumn( int column_pos, unsigned int control_id ) | |
168 { | |
169 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); | |
170 } | |
171 //----- (00419379) -------------------------------------------------------- | |
172 void ReleaseAwardsScrollBar() | |
173 { | |
174 GUIButton *pButton; // esi@2 | |
175 | |
176 if ( awards_scroll_bar_created ) | |
177 { | |
178 awards_scroll_bar_created = false; | |
179 ptr_507BA4->Release(); | |
180 pBtn_Up->Release(); | |
181 pBtn_Down->Release(); | |
182 pBtn_Down = 0; | |
183 pBtn_Up = 0; | |
184 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) | |
185 { | |
186 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
187 { | |
188 pButton->uX = dword_50698C_uX; | |
189 pButton->uY = dword_506988_uY; | |
190 pButton->uZ = dword_506984_uZ; | |
191 pButton->uW = dword_506980_uW; | |
192 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); | |
193 } | |
194 } | |
195 } | |
196 } | |
197 //----- (00419220) -------------------------------------------------------- | |
198 void CreateAwardsScrollBar() | |
199 { | |
200 GUIButton *pButton; // eax@2 | |
201 | |
202 if ( !awards_scroll_bar_created ) | |
203 { | |
204 awards_scroll_bar_created = 1; | |
205 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) | |
206 { | |
207 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
208 { | |
209 dword_50698C_uX = pButton->uX; | |
210 dword_506988_uY = pButton->uY; | |
211 dword_506984_uZ = pButton->uZ; | |
212 dword_506980_uW = pButton->uW; | |
213 pButton->uW = 0; | |
214 pButton->uZ = 0; | |
215 pButton->uY = 0; | |
216 pButton->uX = 0; | |
217 } | |
218 } | |
219 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, | |
220 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, | |
221 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, | |
222 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", | |
223 pIcons_LOD->GetTexture(uTextureID_ar_up_up), | |
224 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); | |
225 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, | |
226 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, | |
227 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, | |
228 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", | |
229 pIcons_LOD->GetTexture(uTextureID_ar_dn_up), | |
230 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); | |
231 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_ClickAwardScrollBar, 0, 0, "", 0); | |
232 } | |
233 } | |
234 //----- (004BCA33) -------------------------------------------------------- | |
235 void UI_CreateEndConversationButton() | |
236 { | |
237 pDialogueWindow->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
238 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 345, 0, 0); |
2502 | 239 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, |
240 pGlobalTXT_LocalizationStrings[74], //"End Conversation" | |
241 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
242 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
243 } |