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