Mercurial > mm7
annotate GUIButton.cpp @ 2403:069018761f96
Слияние
author | Ritor1 |
---|---|
date | Mon, 14 Jul 2014 10:04:14 +0600 |
parents | 7ebc07cd6c53 |
children | f4af3b203f65 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2215
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
2349 | 2 #include "GUIButton.h" |
0 | 3 #include "GUIWindow.h" |
4 #include "GUIFont.h" | |
5 | |
1296 | 6 #include "mm7_data.h" |
7 #include "LOD.h" | |
1297 | 8 #include "Texts.h" |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
1458
diff
changeset
|
9 #include "OSWindow.h" |
0 | 10 |
11 | |
12 | |
13 struct GUIButton *pBtn_CloseBook; | |
14 struct GUIButton *pBtn_InstallRemoveSpell; | |
15 struct GUIButton *pBtn_Autonotes_Instructors; | |
16 struct GUIButton *pBtn_Autonotes_Misc; | |
17 struct GUIButton *pBtn_Book_6; | |
18 struct GUIButton *pBtn_Book_5; | |
19 struct GUIButton *pBtn_Book_4; | |
20 struct GUIButton *pBtn_Book_3; | |
21 struct GUIButton *pBtn_Book_2; | |
22 struct GUIButton *pBtn_Book_1; | |
23 | |
24 | |
25 struct GUIButton *pPlayerCreationUI_BtnReset; | |
26 struct GUIButton *pPlayerCreationUI_BtnOK; | |
27 struct GUIButton *pBtn_ExitCancel; | |
28 struct GUIButton *pBtn_YES; | |
29 struct GUIButton *pPlayerCreationUI_BtnPlus; | |
30 struct GUIButton *pPlayerCreationUI_BtnMinus; | |
31 | |
32 | |
33 struct GUIButton *pButton_RestUI_Main; | |
34 struct GUIButton *pButton_RestUI_Exit; | |
35 struct GUIButton *pButton_RestUI_Wait5Minutes; | |
36 struct GUIButton *pButton_RestUI_WaitUntilDawn; | |
37 struct GUIButton *pButton_RestUI_Wait1Hour; | |
38 | |
39 | |
40 struct GUIButton *pCharacterScreen_ExitBtn; | |
41 struct GUIButton *pCharacterScreen_AwardsBtn; | |
42 struct GUIButton *pCharacterScreen_InventoryBtn; | |
43 struct GUIButton *pCharacterScreen_SkillsBtn; | |
44 struct GUIButton *pCharacterScreen_StatsBtn; | |
45 struct GUIButton *pCharacterScreen_DollBtn; | |
46 struct GUIButton *pCharacterScreen_DetalizBtn; | |
47 | |
48 | |
49 struct GUIButton *pBtn_NPCRight; | |
50 struct GUIButton *pBtn_NPCLeft; | |
51 struct GUIButton *pBtn_GameSettings; | |
52 struct GUIButton *pBtn_QuickReference; | |
53 struct GUIButton *pBtn_CastSpell; | |
54 struct GUIButton *pBtn_Rest; | |
55 struct GUIButton *pBtn_History; | |
56 struct GUIButton *pBtn_Calendar; | |
57 struct GUIButton *pBtn_Maps; | |
58 struct GUIButton *pBtn_Autonotes; | |
59 struct GUIButton *pBtn_Quests; | |
60 | |
61 | |
2278 | 62 struct GUIButton *pMMT_MainMenu_BtnMM6; |
63 struct GUIButton *pMMT_MainMenu_BtnMM7; | |
64 struct GUIButton *pMMT_MainMenu_BtnMM8; | |
65 struct GUIButton *pMMT_MainMenu_BtnContinue; | |
66 struct GUIButton *pMMT_MainMenu_BtnExit; | |
67 | |
68 | |
0 | 69 struct GUIButton *pMainMenu_BtnExit; |
70 struct GUIButton *pMainMenu_BtnCredits; | |
71 struct GUIButton *pMainMenu_BtnLoad; | |
72 struct GUIButton *pMainMenu_BtnNew; | |
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; | |
336 | 83 struct GUIWindow *window_SpeakInHouse; |
0 | 84 struct GUIWindow *pGUIWindow_ScrollWindow; |
85 struct GUIWindow *ptr_507BC8; | |
86 struct GUIWindow *pGUIWindow_CurrentMenu; | |
87 struct GUIWindow *ptr_507BD0; | |
88 struct GUIWindow *pGUIWindow_Settings; | |
1458 | 89 struct GUIWindow *pModalWindow; |
0 | 90 struct GUIWindow *pGUIWindow_EscMessageWindow; |
91 struct GUIWindow *pBooksWindow; | |
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 | |
2 | 106 struct GUIButton *pBtnDownArrow; |
107 struct GUIButton *pBtnArrowUp; | |
108 struct GUIButton *pBtnCancel; | |
109 struct GUIButton *pBtnLoadSlot; | |
0 | 110 |
111 | |
1202 | 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; | |
0 | 116 |
117 | |
118 | |
119 | |
120 | |
121 | |
122 //----- (0041D0D8) -------------------------------------------------------- | |
697 | 123 void GUIButton::Release() |
0 | 124 { |
2268 | 125 if ( this ) |
0 | 126 { |
2268 | 127 if ( this == this->pParent->pControlsHead ) |
0 | 128 { |
2268 | 129 if ( this->pNext ) |
0 | 130 { |
2268 | 131 this->pParent->pControlsHead = this->pNext; |
132 this->pNext->pPrev = 0; | |
0 | 133 } |
134 else | |
135 { | |
2268 | 136 this->pParent->pControlsHead = 0; |
137 this->pParent->pControlsTail = 0; | |
0 | 138 } |
139 } | |
140 else | |
141 { | |
2268 | 142 if ( this->pNext ) |
0 | 143 { |
2268 | 144 this->pPrev->pNext = this->pNext; |
145 this->pNext->pPrev = this->pPrev; | |
0 | 146 } |
147 else | |
148 { | |
2268 | 149 this->pPrev->pNext = 0; |
150 this->pParent->pControlsTail = this->pPrev; | |
0 | 151 } |
152 } | |
2268 | 153 --this->pParent->uNumControls; |
0 | 154 } |
155 } | |
156 | |
157 //----- (00415180) -------------------------------------------------------- | |
1006 | 158 void GUIButton::DrawLabel( const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor ) |
2268 | 159 { |
0 | 160 //strlen(edx0); |
2268 | 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); | |
0 | 165 } |
1295 | 166 //----- (004B36CC) -------------------------------------------------------- |
167 void CreateButtonInColumn( int column_pos, unsigned int control_id ) | |
168 { | |
2268 | 169 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
1296 | 170 } |
171 //----- (00419379) -------------------------------------------------------- | |
1458 | 172 void ReleaseAwardsScrollBar() |
1296 | 173 { |
174 GUIButton *pButton; // esi@2 | |
175 | |
1458 | 176 if ( awards_scroll_bar_created ) |
1296 | 177 { |
1458 | 178 awards_scroll_bar_created = false; |
1296 | 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) -------------------------------------------------------- | |
1458 | 198 void CreateAwardsScrollBar() |
1296 | 199 { |
1455 | 200 GUIButton *pButton; // eax@2 |
1296 | 201 |
1458 | 202 if ( !awards_scroll_bar_created ) |
1296 | 203 { |
1458 | 204 awards_scroll_bar_created = 1; |
1455 | 205 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) |
1296 | 206 { |
1455 | 207 if ( pButton->msg == UIMSG_InventoryLeftClick ) |
1296 | 208 { |
1455 | 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; | |
1296 | 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 } | |
1297 | 233 } |
234 //----- (004BCA33) -------------------------------------------------------- | |
235 void UI_CreateEndConversationButton() | |
236 { | |
237 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
1458
diff
changeset
|
238 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1297 | 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); | |
1295 | 243 } |