Mercurial > might-and-magic-trilogy
comparison GUIButton.cpp @ 0:8b8875f5b359
Initial commit
author | Nomad |
---|---|
date | Fri, 05 Oct 2012 16:07:14 +0200 |
parents | |
children | 87c503d426e0 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8b8875f5b359 |
---|---|
1 #include "GUIButton.h" | |
2 #include "GUIWindow.h" | |
3 #include "GUIFont.h" | |
4 #include "Allocator.h" | |
5 | |
6 #include "mm7_data.h" | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 struct GUIButton *ptr_5064F4; | |
14 struct GUIButton *ptr_5064F8; | |
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 *ptr_5076F4; | |
28 struct GUIButton *ptr_5076FC; | |
29 struct GUIButton *pPlayerCreationUI_BtnPlus; | |
30 struct GUIButton *pPlayerCreationUI_BtnMinus; | |
31 | |
32 | |
33 struct GUIButton *pButton_RestUI_507634; | |
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 *ptr_50767C; | |
41 struct GUIButton *pCharacterScreen_AwardsBtn; | |
42 struct GUIButton *pCharacterScreen_InventoryBtn; | |
43 struct GUIButton *pCharacterScreen_SkillsBtn; | |
44 struct GUIButton *pCharacterScreen_StatsBtn; | |
45 struct GUIButton *ptr_507690; | |
46 struct GUIButton *ptr_507694; | |
47 | |
48 | |
49 struct GUIButton *ptr_5079E8; | |
50 struct GUIButton *ptr_5079EC; | |
51 struct GUIButton *ptr_5079F0; | |
52 struct GUIButton *ptr_5079F4; | |
53 struct GUIButton *ptr_5079F8; | |
54 struct GUIButton *ptr_5079FC; | |
55 struct GUIButton *ptr_507A00; | |
56 struct GUIButton *dword_507A04; | |
57 struct GUIButton *ptr_507A08; | |
58 struct GUIButton *ptr_507A0C; | |
59 struct GUIButton *ptr_507A10; | |
60 | |
61 | |
62 struct GUIButton *pMainMenu_BtnExit; | |
63 struct GUIButton *pMainMenu_BtnCredits; | |
64 struct GUIButton *pMainMenu_BtnLoad; | |
65 struct GUIButton *pMainMenu_BtnNew; | |
66 | |
67 | |
68 struct GUIButton *ptr_507B9C; | |
69 struct GUIButton *ptr_507BA0; | |
70 struct GUIButton *ptr_507BA4; | |
71 | |
72 | |
73 struct GUIWindow *pGUIWindow0; | |
74 struct GUIWindow *ptr_507BB8; | |
75 struct GUIWindow *pDialogueWindow; | |
76 struct GUIWindow *ptr_507BC0; | |
77 struct GUIWindow *ptr_507BC4; | |
78 struct GUIWindow *ptr_507BC8; | |
79 struct GUIWindow *pGUIWindow_CurrentMenu; | |
80 struct GUIWindow *ptr_507BD0; | |
81 struct GUIWindow *ptr_507BD4; | |
82 struct GUIWindow *ptr_507BDC; | |
83 struct GUIWindow *ptr_507BE0; | |
84 struct GUIWindow *pGUIWindow2; | |
85 | |
86 | |
87 struct GUIButton *ptr_50C9B0; | |
88 struct GUIButton *ptr_50C9B4; | |
89 struct GUIButton *pyt_50C9B8; | |
90 struct GUIButton *ptr_50C9BC; | |
91 struct GUIButton *ptr_50C9C0; | |
92 struct GUIButton *ptr_50C9C4; | |
93 struct GUIButton *ptr_50C9C8; | |
94 struct GUIButton *ptr_50C9CC; | |
95 | |
96 | |
97 struct GUIButton *ptr_69BD58; | |
98 struct GUIButton *ptr_69BD5C; | |
99 struct GUIButton *ptr_69BD60; | |
100 struct GUIButton *ptr_69BD64; | |
101 | |
102 | |
103 GUIButton *pCreationUI_BtnPressRight2[4]; | |
104 GUIButton *pCreationUI_BtnPressLeft2[4]; | |
105 GUIButton *pCreationUI_BtnPressLeft[4]; | |
106 GUIButton *pCreationUI_BtnPressRight[4]; | |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | |
113 //----- (0041D0D8) -------------------------------------------------------- | |
114 void GUIButton::_41D0D8(GUIButton *ptr) | |
115 { | |
116 GUIWindow *v1; // eax@2 | |
117 GUIButton *v2; // edx@2 | |
118 GUIButton *v3; // eax@6 | |
119 | |
120 if ( ptr ) | |
121 { | |
122 v1 = ptr->pParent; | |
123 v2 = ptr->pNext; | |
124 if ( ptr == v1->pControlsHead ) | |
125 { | |
126 if ( v2 ) | |
127 { | |
128 v1->pControlsHead = v2; | |
129 ptr->pNext->pPrev = 0; | |
130 } | |
131 else | |
132 { | |
133 v1->pControlsHead = 0; | |
134 ptr->pParent->pControlsTail = 0; | |
135 } | |
136 } | |
137 else | |
138 { | |
139 v3 = ptr->pPrev; | |
140 if ( v2 ) | |
141 { | |
142 v3->pNext = v2; | |
143 ptr->pNext->pPrev = v3; | |
144 } | |
145 else | |
146 { | |
147 v3->pNext = 0; | |
148 ptr->pParent->pControlsTail = v3; | |
149 } | |
150 } | |
151 --ptr->pParent->uNumControls; | |
152 pAllocator->FreeChunk(ptr); | |
153 } | |
154 } | |
155 | |
156 | |
157 //----- (00415180) -------------------------------------------------------- | |
158 char GUIButton::DrawLabel(const char *edx0, GUIFont *pFont, int a5, int *a9) | |
159 { | |
160 const char *v5; // ebx@1 | |
161 GUIButton *v6; // esi@1 | |
162 int v7; // eax@1 | |
163 | |
164 v5 = edx0; | |
165 v6 = this; | |
166 //strlen(edx0); | |
167 v7 = pFont->GetLineWidth(edx0); | |
168 return pParent->DrawText( | |
169 pFont, | |
170 v6->uX + (signed int)(v6->uWidth - v7) / 2, | |
171 v6->uY + (signed int)(v6->uHeight - LOBYTE(pFont->uFontHeight)) / 2, | |
172 a5, | |
173 v5, | |
174 0, | |
175 0, | |
176 (unsigned int)a9); | |
177 } |