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