Mercurial > mm7
annotate GUIButton.cpp @ 2332:defd2526c94c
m
author | Ritor1 |
---|---|
date | Wed, 02 Apr 2014 20:53:35 +0600 |
parents | 0cd17b0d36c2 |
children | 7ebc07cd6c53 |
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 | |
2278 | 61 struct GUIButton *pMMT_MainMenu_BtnMM6; |
62 struct GUIButton *pMMT_MainMenu_BtnMM7; | |
63 struct GUIButton *pMMT_MainMenu_BtnMM8; | |
64 struct GUIButton *pMMT_MainMenu_BtnContinue; | |
65 struct GUIButton *pMMT_MainMenu_BtnExit; | |
66 | |
67 | |
0 | 68 struct GUIButton *pMainMenu_BtnExit; |
69 struct GUIButton *pMainMenu_BtnCredits; | |
70 struct GUIButton *pMainMenu_BtnLoad; | |
71 struct GUIButton *pMainMenu_BtnNew; | |
72 | |
73 | |
74 struct GUIButton *pBtn_Up; | |
75 struct GUIButton *pBtn_Down; | |
76 struct GUIButton *ptr_507BA4; | |
77 | |
78 | |
79 struct GUIWindow *pPrimaryWindow; | |
80 struct GUIWindow *pChestWindow; | |
81 struct GUIWindow *pDialogueWindow; | |
336 | 82 struct GUIWindow *window_SpeakInHouse; |
0 | 83 struct GUIWindow *pGUIWindow_ScrollWindow; |
84 struct GUIWindow *ptr_507BC8; | |
85 struct GUIWindow *pGUIWindow_CurrentMenu; | |
86 struct GUIWindow *ptr_507BD0; | |
87 struct GUIWindow *pGUIWindow_Settings; | |
1458 | 88 struct GUIWindow *pModalWindow; |
0 | 89 struct GUIWindow *pGUIWindow_EscMessageWindow; |
90 struct GUIWindow *pBooksWindow; | |
91 struct GUIWindow *pGUIWindow2; | |
92 | |
93 | |
94 struct GUIButton *pBtn_Resume; | |
95 struct GUIButton *pBtn_QuitGame; | |
96 struct GUIButton *pBtn_GameControls; | |
97 struct GUIButton *pBtn_LoadGame; | |
98 struct GUIButton *pBtn_SaveGame; | |
99 struct GUIButton *pBtn_NewGame; | |
100 | |
101 struct GUIButton *pBtn_SliderRight; | |
102 struct GUIButton *pBtn_SliderLeft; | |
103 | |
104 | |
2 | 105 struct GUIButton *pBtnDownArrow; |
106 struct GUIButton *pBtnArrowUp; | |
107 struct GUIButton *pBtnCancel; | |
108 struct GUIButton *pBtnLoadSlot; | |
0 | 109 |
110 | |
1202 | 111 std::array<GUIButton*, 4> pCreationUI_BtnPressRight2; |
112 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft2; | |
113 std::array<GUIButton*, 4> pCreationUI_BtnPressLeft; | |
114 std::array<GUIButton*, 4> pCreationUI_BtnPressRight; | |
0 | 115 |
116 | |
117 | |
118 | |
119 | |
120 | |
121 //----- (0041D0D8) -------------------------------------------------------- | |
697 | 122 void GUIButton::Release() |
0 | 123 { |
2268 | 124 if ( this ) |
0 | 125 { |
2268 | 126 if ( this == this->pParent->pControlsHead ) |
0 | 127 { |
2268 | 128 if ( this->pNext ) |
0 | 129 { |
2268 | 130 this->pParent->pControlsHead = this->pNext; |
131 this->pNext->pPrev = 0; | |
0 | 132 } |
133 else | |
134 { | |
2268 | 135 this->pParent->pControlsHead = 0; |
136 this->pParent->pControlsTail = 0; | |
0 | 137 } |
138 } | |
139 else | |
140 { | |
2268 | 141 if ( this->pNext ) |
0 | 142 { |
2268 | 143 this->pPrev->pNext = this->pNext; |
144 this->pNext->pPrev = this->pPrev; | |
0 | 145 } |
146 else | |
147 { | |
2268 | 148 this->pPrev->pNext = 0; |
149 this->pParent->pControlsTail = this->pPrev; | |
0 | 150 } |
151 } | |
2268 | 152 --this->pParent->uNumControls; |
0 | 153 } |
154 } | |
155 | |
156 //----- (00415180) -------------------------------------------------------- | |
1006 | 157 void GUIButton::DrawLabel( const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor ) |
2268 | 158 { |
0 | 159 //strlen(edx0); |
2268 | 160 return pParent->DrawText(pFont, |
161 this->uX + (signed int)(this->uWidth - pFont->GetLineWidth(label_text)) / 2, | |
162 this->uY + (signed int)(this->uHeight - pFont->uFontHeight) / 2, | |
163 a5, label_text, 0, 0, uFontShadowColor); | |
0 | 164 } |
1295 | 165 //----- (004B36CC) -------------------------------------------------------- |
166 void CreateButtonInColumn( int column_pos, unsigned int control_id ) | |
167 { | |
2268 | 168 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
1296 | 169 } |
170 //----- (00419379) -------------------------------------------------------- | |
1458 | 171 void ReleaseAwardsScrollBar() |
1296 | 172 { |
173 GUIButton *pButton; // esi@2 | |
174 | |
1458 | 175 if ( awards_scroll_bar_created ) |
1296 | 176 { |
1458 | 177 awards_scroll_bar_created = false; |
1296 | 178 ptr_507BA4->Release(); |
179 pBtn_Up->Release(); | |
180 pBtn_Down->Release(); | |
181 pBtn_Down = 0; | |
182 pBtn_Up = 0; | |
183 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) | |
184 { | |
185 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
186 { | |
187 pButton->uX = dword_50698C_uX; | |
188 pButton->uY = dword_506988_uY; | |
189 pButton->uZ = dword_506984_uZ; | |
190 pButton->uW = dword_506980_uW; | |
191 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); | |
192 } | |
193 } | |
194 } | |
195 } | |
196 //----- (00419220) -------------------------------------------------------- | |
1458 | 197 void CreateAwardsScrollBar() |
1296 | 198 { |
1455 | 199 GUIButton *pButton; // eax@2 |
1296 | 200 |
1458 | 201 if ( !awards_scroll_bar_created ) |
1296 | 202 { |
1458 | 203 awards_scroll_bar_created = 1; |
1455 | 204 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) |
1296 | 205 { |
1455 | 206 if ( pButton->msg == UIMSG_InventoryLeftClick ) |
1296 | 207 { |
1455 | 208 dword_50698C_uX = pButton->uX; |
209 dword_506988_uY = pButton->uY; | |
210 dword_506984_uZ = pButton->uZ; | |
211 dword_506980_uW = pButton->uW; | |
212 pButton->uW = 0; | |
213 pButton->uZ = 0; | |
214 pButton->uY = 0; | |
215 pButton->uX = 0; | |
1296 | 216 } |
217 } | |
218 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, | |
219 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, | |
220 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, | |
221 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", | |
222 pIcons_LOD->GetTexture(uTextureID_ar_up_up), | |
223 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); | |
224 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, | |
225 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, | |
226 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, | |
227 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", | |
228 pIcons_LOD->GetTexture(uTextureID_ar_dn_up), | |
229 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); | |
230 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_ClickAwardScrollBar, 0, 0, "", 0); | |
231 } | |
1297 | 232 } |
233 //----- (004BCA33) -------------------------------------------------------- | |
234 void UI_CreateEndConversationButton() | |
235 { | |
236 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
1458
diff
changeset
|
237 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1297 | 238 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, |
239 pGlobalTXT_LocalizationStrings[74], //"End Conversation" | |
240 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
241 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
1295 | 242 } |