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