annotate GUIButton.cpp @ 204:22730e77fa32

7.01.13(SoundVolumeLevel)
author Ritor1
date Mon, 07 Jan 2013 14:16:50 +0600
parents 90a9c828c2a6
children af624eaf2fc5
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include "GUIButton.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "GUIWindow.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "GUIFont.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "Allocator.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
13 struct GUIButton *pBtn_CloseBook;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
14 struct GUIButton *pBtn_InstallRemoveSpell;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15 struct GUIButton *pBtn_Autonotes_Instructors;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 struct GUIButton *pBtn_Autonotes_Misc;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 struct GUIButton *pBtn_Book_6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 struct GUIButton *pBtn_Book_5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 struct GUIButton *pBtn_Book_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 struct GUIButton *pBtn_Book_3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 struct GUIButton *pBtn_Book_2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 struct GUIButton *pBtn_Book_1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25 struct GUIButton *pPlayerCreationUI_BtnReset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 struct GUIButton *pPlayerCreationUI_BtnOK;
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
27 struct GUIButton *pBtn_ExitCancel;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
28 struct GUIButton *pBtn_YES;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 struct GUIButton *pPlayerCreationUI_BtnPlus;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 struct GUIButton *pPlayerCreationUI_BtnMinus;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
33 struct GUIButton *pButton_RestUI_Main;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 struct GUIButton *pButton_RestUI_Exit;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 struct GUIButton *pButton_RestUI_Wait5Minutes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 struct GUIButton *pButton_RestUI_WaitUntilDawn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 struct GUIButton *pButton_RestUI_Wait1Hour;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
40 struct GUIButton *pCharacterScreen_ExitBtn;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 struct GUIButton *pCharacterScreen_AwardsBtn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 struct GUIButton *pCharacterScreen_InventoryBtn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 struct GUIButton *pCharacterScreen_SkillsBtn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 struct GUIButton *pCharacterScreen_StatsBtn;
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
45 struct GUIButton *pCharacterScreen_DollBtn;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
46 struct GUIButton *pCharacterScreen_DetalizBtn;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
49 struct GUIButton *pBtn_NPCRight;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
50 struct GUIButton *pBtn_NPCLeft;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
51 struct GUIButton *pBtn_GameSettings;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
52 struct GUIButton *pBtn_QuickReference;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
53 struct GUIButton *pBtn_CastSpell;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
54 struct GUIButton *pBtn_Rest;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
55 struct GUIButton *pBtn_History;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
56 struct GUIButton *pBtn_Calendar;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
57 struct GUIButton *pBtn_Maps;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
58 struct GUIButton *pBtn_Autonotes;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
59 struct GUIButton *pBtn_Quests;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 struct GUIButton *pMainMenu_BtnExit;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 struct GUIButton *pMainMenu_BtnCredits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 struct GUIButton *pMainMenu_BtnLoad;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 struct GUIButton *pMainMenu_BtnNew;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
68 struct GUIButton *pBtn_Up;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
69 struct GUIButton *pBtn_Down;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 struct GUIButton *ptr_507BA4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
73 struct GUIWindow *pPrimaryWindow;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
74 struct GUIWindow *pChestWindow;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 struct GUIWindow *pDialogueWindow;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 struct GUIWindow *ptr_507BC0;
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
77 struct GUIWindow *pGUIWindow_ScrollWindow;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 struct GUIWindow *ptr_507BC8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 struct GUIWindow *pGUIWindow_CurrentMenu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 struct GUIWindow *ptr_507BD0;
166
87c503d426e0 11.12.2012
Ritor1
parents: 0
diff changeset
81 struct GUIWindow *pGUIWindow_Settings;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 struct GUIWindow *ptr_507BDC;
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
83 struct GUIWindow *pGUIWindow_EscMessageWindow;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
84 struct GUIWindow *pBooksWindow;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 struct GUIWindow *pGUIWindow2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87
167
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
88 struct GUIButton *pBtn_Resume;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
89 struct GUIButton *pBtn_QuitGame;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
90 struct GUIButton *pBtn_GameControls;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
91 struct GUIButton *pBtn_LoadGame;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
92 struct GUIButton *pBtn_SaveGame;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
93 struct GUIButton *pBtn_NewGame;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
94
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
95 struct GUIButton *pBtn_SliderRight;
90a9c828c2a6 pWindow and pBtn
Ritor1
parents: 166
diff changeset
96 struct GUIButton *pBtn_SliderLeft;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 struct GUIButton *ptr_69BD58;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 struct GUIButton *ptr_69BD5C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 struct GUIButton *ptr_69BD60;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 struct GUIButton *ptr_69BD64;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 GUIButton *pCreationUI_BtnPressRight2[4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 GUIButton *pCreationUI_BtnPressLeft2[4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 GUIButton *pCreationUI_BtnPressLeft[4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 GUIButton *pCreationUI_BtnPressRight[4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 //----- (0041D0D8) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116 void GUIButton::_41D0D8(GUIButton *ptr)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 GUIWindow *v1; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 GUIButton *v2; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 GUIButton *v3; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 if ( ptr )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 v1 = ptr->pParent;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 v2 = ptr->pNext;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 if ( ptr == v1->pControlsHead )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128 if ( v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 v1->pControlsHead = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 ptr->pNext->pPrev = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 v1->pControlsHead = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 ptr->pParent->pControlsTail = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 v3 = ptr->pPrev;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 if ( v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 v3->pNext = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 ptr->pNext->pPrev = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 v3->pNext = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 ptr->pParent->pControlsTail = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 --ptr->pParent->uNumControls;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 pAllocator->FreeChunk(ptr);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 //----- (00415180) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 char GUIButton::DrawLabel(const char *edx0, GUIFont *pFont, int a5, int *a9)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 const char *v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 GUIButton *v6; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164 int v7; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 v5 = edx0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 v6 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 //strlen(edx0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 v7 = pFont->GetLineWidth(edx0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 return pParent->DrawText(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 pFont,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 v6->uX + (signed int)(v6->uWidth - v7) / 2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 v6->uY + (signed int)(v6->uHeight - LOBYTE(pFont->uFontHeight)) / 2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 a5,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 v5,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178 (unsigned int)a9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179 }