annotate Mouse.cpp @ 2122:5b654c03a11e

for snow in house
author Ritor1
date Wed, 25 Dec 2013 17:42:19 +0600
parents 7edf389d49fc
children d28d3c006077
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
4
0
Ritor1
parents:
diff changeset
5
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
6 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1253
diff changeset
7 #include "mm7_data.h"
1253
fac7751b2dc9 included header cleanup
Grumpy7
parents: 1165
diff changeset
8 #include "Render.h"
0
Ritor1
parents:
diff changeset
9 #include "Mouse.h"
Ritor1
parents:
diff changeset
10 #include "Items.h"
Ritor1
parents:
diff changeset
11 #include "Party.h"
Ritor1
parents:
diff changeset
12 #include "LOD.h"
Ritor1
parents:
diff changeset
13 #include "Game.h"
Ritor1
parents:
diff changeset
14
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
15 #include "TurnEngine.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
16 #include "Viewport.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
17 #include "GUIWindow.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
18 #include "Vis.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
19 #include "Actor.h"
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
20 #include "MM7.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
21 #include "AudioPlayer.h"
0
Ritor1
parents:
diff changeset
22
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24 Mouse *pMouse;
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28
Ritor1
parents:
diff changeset
29
Ritor1
parents:
diff changeset
30 //----- (00469860) --------------------------------------------------------
Ritor1
parents:
diff changeset
31 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
Ritor1
parents:
diff changeset
32 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
33 *pX = uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
34 *pY = uMouseClickY;
0
Ritor1
parents:
diff changeset
35 }
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37 //----- (004698A6) --------------------------------------------------------
Ritor1
parents:
diff changeset
38 void Mouse::RemoveHoldingItem()
Ritor1
parents:
diff changeset
39 {
Ritor1
parents:
diff changeset
40 pParty->pPickedItem.Reset();
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
41 if (_stricmp(pCurrentCursorName, "MICON2"))
0
Ritor1
parents:
diff changeset
42 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
43 }
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45 //----- (004698D8) --------------------------------------------------------
Ritor1
parents:
diff changeset
46 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
Ritor1
parents:
diff changeset
47 {
Ritor1
parents:
diff changeset
48 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
Ritor1
parents:
diff changeset
49 }
Ritor1
parents:
diff changeset
50
Ritor1
parents:
diff changeset
51 //----- (004698F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
52 void Mouse::SetCurrentCursorBitmap()
Ritor1
parents:
diff changeset
53 {
Ritor1
parents:
diff changeset
54 SetCursorBitmap(pCurrentCursorName);
Ritor1
parents:
diff changeset
55 }
Ritor1
parents:
diff changeset
56
Ritor1
parents:
diff changeset
57 //----- (00469903) --------------------------------------------------------
Ritor1
parents:
diff changeset
58 void Mouse::SetCursorBitmap(const char *pName)
Ritor1
parents:
diff changeset
59 {
Ritor1
parents:
diff changeset
60 if ( !this->bInitialized || !pName )
Ritor1
parents:
diff changeset
61 return;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1068
diff changeset
62 if ( _stricmp("MICON2", pName) )
0
Ritor1
parents:
diff changeset
63 pGame->uFlags2 &= 0xFFFFFFEFu;
Ritor1
parents:
diff changeset
64 else
Ritor1
parents:
diff changeset
65 pGame->uFlags2 |= 0x10u;
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
66 if ( _stricmp(this->pCurrentCursorName, pName) )
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
67 strcpy(this->pCurrentCursorName, pName);
0
Ritor1
parents:
diff changeset
68 ClearCursor();
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
69 if ( _strnicmp(pName, "MICON1", 5) )
0
Ritor1
parents:
diff changeset
70 {
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
71 this->uCursorTextureID = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
72 this->uCursorTextureID_2 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
73 this->AllocCursorSystemMem();
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
74 this->field_C = 0;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
75 this->bRedraw = 1;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
76 this->bActive = 1;
0
Ritor1
parents:
diff changeset
77 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
78 {
Ritor1
parents:
diff changeset
79 if (uCursorTextureID != -1)
Ritor1
parents:
diff changeset
80 pIcons_LOD->pTextures[uCursorTextureID].Release();
1006
e865f349aa41 ui cleanup
Gloval
parents: 973
diff changeset
81 pIcons_LOD->SyncLoadedFilesCount();
0
Ritor1
parents:
diff changeset
82 }
Ritor1
parents:
diff changeset
83 return;
Ritor1
parents:
diff changeset
84 }
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
85 this->bActive = false;
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1391
diff changeset
86 this->field_C = 1;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
87 window->SetCursor(pName);
0
Ritor1
parents:
diff changeset
88 }
Ritor1
parents:
diff changeset
89 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
90
Ritor1
parents:
diff changeset
91 //----- (00469AE4) --------------------------------------------------------
Ritor1
parents:
diff changeset
92 LONG Mouse::_469AE4()
Ritor1
parents:
diff changeset
93 {
Ritor1
parents:
diff changeset
94 Mouse *v1; // esi@1
Ritor1
parents:
diff changeset
95 LONG v2; // ecx@2
Ritor1
parents:
diff changeset
96 LONG result; // eax@2
Ritor1
parents:
diff changeset
97 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
98
Ritor1
parents:
diff changeset
99 v1 = this;
Ritor1
parents:
diff changeset
100 this->field_8 = 1;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
101 /*if (pAsyncMouse)
0
Ritor1
parents:
diff changeset
102 {
Ritor1
parents:
diff changeset
103 v2 = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
104 Point.x = *((int *)pAsyncMouse + 6);
Ritor1
parents:
diff changeset
105 result = *((int *)pAsyncMouse + 7);
Ritor1
parents:
diff changeset
106 }
Ritor1
parents:
diff changeset
107 else
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
108 {*/
0
Ritor1
parents:
diff changeset
109 GetCursorPos(&Point);
Ritor1
parents:
diff changeset
110 if ( pRenderer->bWindowMode )
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
111 ScreenToClient(window->GetApiHandle(), &Point);
0
Ritor1
parents:
diff changeset
112 result = Point.y;
Ritor1
parents:
diff changeset
113 v2 = Point.x;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
114 //}
0
Ritor1
parents:
diff changeset
115 v1->uMouseClickX = v2;
Ritor1
parents:
diff changeset
116 v1->uMouseClickY = result;
Ritor1
parents:
diff changeset
117 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
118 goto LABEL_16;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
119 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
120 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
121 if ( v2 < 0 )
Ritor1
parents:
diff changeset
122 v2 = 0;
Ritor1
parents:
diff changeset
123 if ( result < 0 )
Ritor1
parents:
diff changeset
124 result = 0;
Ritor1
parents:
diff changeset
125 if ( v2 > 639 )
Ritor1
parents:
diff changeset
126 v2 = 639;
Ritor1
parents:
diff changeset
127 if ( result > 479 )
Ritor1
parents:
diff changeset
128 {
Ritor1
parents:
diff changeset
129 result = 479;
Ritor1
parents:
diff changeset
130 LABEL_16:
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
131 //if (pAsyncMouse)
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
132 // goto LABEL_24;
0
Ritor1
parents:
diff changeset
133 if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) )
Ritor1
parents:
diff changeset
134 goto LABEL_23;
Ritor1
parents:
diff changeset
135 }
Ritor1
parents:
diff changeset
136 if ( v1->field_C )
Ritor1
parents:
diff changeset
137 LABEL_23:
Ritor1
parents:
diff changeset
138 v1->bActive = 0;
Ritor1
parents:
diff changeset
139 LABEL_24:
Ritor1
parents:
diff changeset
140 v1->field_8 = 0;
Ritor1
parents:
diff changeset
141 return result;
Ritor1
parents:
diff changeset
142 }
Ritor1
parents:
diff changeset
143
Ritor1
parents:
diff changeset
144 //----- (00469BA3) --------------------------------------------------------
Ritor1
parents:
diff changeset
145 void Mouse::ClearCursor()
Ritor1
parents:
diff changeset
146 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
147 //Mouse *v1; // esi@1
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
148 //void *v2; // eax@1
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
149 //void **v3; // esi@5
0
Ritor1
parents:
diff changeset
150
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
151 //v1 = this;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
152 //v2 = this->pCursorBitmap_sysmem;
0
Ritor1
parents:
diff changeset
153 this->bActive = 0;
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
154 if ( this->pCursorBitmap_sysmem )
0
Ritor1
parents:
diff changeset
155 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
156 free(this->pCursorBitmap_sysmem);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
157 this->pCursorBitmap_sysmem = 0;
0
Ritor1
parents:
diff changeset
158 }
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
159 if ( this->pCursorBitmap2_sysmem )
0
Ritor1
parents:
diff changeset
160 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
161 free(this->pCursorBitmap2_sysmem);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
162 this->pCursorBitmap2_sysmem = 0;
0
Ritor1
parents:
diff changeset
163 }
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
164 //v3 = &this->ptr_90;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
165 if ( this->ptr_90 )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
166 free(this->ptr_90);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
167 this->ptr_90 = 0;
0
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169
Ritor1
parents:
diff changeset
170 //----- (00469BE6) --------------------------------------------------------
Ritor1
parents:
diff changeset
171 void Mouse::AllocCursorSystemMem()
Ritor1
parents:
diff changeset
172 {
Ritor1
parents:
diff changeset
173 bActive = 0;
Ritor1
parents:
diff changeset
174 if (!pCursorBitmap_sysmem)
Ritor1
parents:
diff changeset
175 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
176 if (!pCursorBitmap2_sysmem)
Ritor1
parents:
diff changeset
177 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
Ritor1
parents:
diff changeset
178 }
Ritor1
parents:
diff changeset
179
Ritor1
parents:
diff changeset
180 //----- (00469C0D) --------------------------------------------------------
Ritor1
parents:
diff changeset
181 void *Mouse::DoAllocCursorMem()
Ritor1
parents:
diff changeset
182 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1830
diff changeset
183 Texture* tex = pIcons_LOD->GetTexture(uCursorTextureID);
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
184 return malloc(4 * tex->uTextureWidth * tex->uTextureHeight);
0
Ritor1
parents:
diff changeset
185 }
Ritor1
parents:
diff changeset
186
Ritor1
parents:
diff changeset
187 //----- (00469C39) --------------------------------------------------------
Ritor1
parents:
diff changeset
188 POINT *Mouse::GetCursorPos(POINT *a2)
Ritor1
parents:
diff changeset
189 {
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
190 a2->x = this->uMouseClickX;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
191 a2->y = this->uMouseClickY;
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
192 return a2;
0
Ritor1
parents:
diff changeset
193 }
Ritor1
parents:
diff changeset
194
Ritor1
parents:
diff changeset
195 //----- (00469C65) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
196 void Mouse::Initialize(OSWindow *window)
0
Ritor1
parents:
diff changeset
197 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
198 this->window = window;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
199 this->bActive = false;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1709
diff changeset
200 this->bInitialized = true;
0
Ritor1
parents:
diff changeset
201 this->pCursorBitmapPos.x = 0;
Ritor1
parents:
diff changeset
202 this->pCursorBitmapPos.y = 0;
Ritor1
parents:
diff changeset
203 this->uMouseClickX = 0;
Ritor1
parents:
diff changeset
204 this->uMouseClickY = 0;
Ritor1
parents:
diff changeset
205 this->pCursorBitmap_sysmem = 0;
Ritor1
parents:
diff changeset
206 this->field_34 = 0;
Ritor1
parents:
diff changeset
207 this->pCursorBitmap2_sysmem = 0;
Ritor1
parents:
diff changeset
208
Ritor1
parents:
diff changeset
209 SetCursorBitmap("MICON3");
Ritor1
parents:
diff changeset
210 SetCursorBitmap("MICON2");
Ritor1
parents:
diff changeset
211 SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
212 }
Ritor1
parents:
diff changeset
213
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
214 // inlined
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
215 //----- (0045FE00) mm6 chinese --------------------------------------------
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
216 void Mouse::SetActive(bool active)
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
217 {
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
218 bActive = active;
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
219 }
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
220
0
Ritor1
parents:
diff changeset
221 //----- (00469CC2) --------------------------------------------------------
Ritor1
parents:
diff changeset
222 void Mouse::Deactivate()
Ritor1
parents:
diff changeset
223 {
Ritor1
parents:
diff changeset
224 if (bInitialized)
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 710
diff changeset
225 SetActive(false);
0
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227
Ritor1
parents:
diff changeset
228 //----- (00469CCD) --------------------------------------------------------
Ritor1
parents:
diff changeset
229 void Mouse::DrawCursor()
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 unsigned int v9; // eax@31
Ritor1
parents:
diff changeset
232
Ritor1
parents:
diff changeset
233 if ( this->bInitialized )
Ritor1
parents:
diff changeset
234 {
Ritor1
parents:
diff changeset
235 if ( !this->field_8 && this->bActive && !this->field_C )
Ritor1
parents:
diff changeset
236 pMouse->_469AE4();
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
237 this->field_F4 = 1;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
238 if ( this->field_C )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
239 {
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
240 this->field_F4 = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
241 return;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
242 }
0
Ritor1
parents:
diff changeset
243 if ( pRenderer->bWindowMode )
Ritor1
parents:
diff changeset
244 {
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
245 if ( this->uMouseClickX < 0 || this->uMouseClickY < 0 || this->uMouseClickX > 639 || this->uMouseClickY > 479 )
0
Ritor1
parents:
diff changeset
246 {
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
247 this->field_F4 = 0;
0
Ritor1
parents:
diff changeset
248 return;
Ritor1
parents:
diff changeset
249 }
Ritor1
parents:
diff changeset
250 }
Ritor1
parents:
diff changeset
251 else
Ritor1
parents:
diff changeset
252 {
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
253 if ( this->uMouseClickX < 0 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
254 this->uMouseClickX = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
255 if ( this->uMouseClickY < 0 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
256 this->uMouseClickY = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
257 if ( this->uMouseClickX > 639 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
258 this->uMouseClickX = 639;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
259 if ( this->uMouseClickY > 479 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
260 this->uMouseClickY = 479;
0
Ritor1
parents:
diff changeset
261 }
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
262 this->pCursorBitmapRect.x = this->uMouseClickX;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
263 this->pCursorBitmapRect.w = this->uMouseClickY + this->field_5C[0];
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
264 this->pCursorBitmapRect.y = this->uMouseClickY;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
265 this->pCursorBitmapRect.z = this->uMouseClickX + this->uCursorBitmapPitch;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
266 if ( this->uMouseClickX < 0 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
267 this->pCursorBitmapRect.x = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
268 if ( this->uMouseClickY < 0 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
269 this->pCursorBitmapRect.y = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
270 if ( this->pCursorBitmapRect.z > 640 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
271 this->pCursorBitmapRect.z = 640;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
272 if ( this->pCursorBitmapRect.w > 480 )
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
273 this->pCursorBitmapRect.w = 480;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
274 this->bActive = 0;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
275 this->uCursorBitmapWidth = this->pCursorBitmapRect.z - this->pCursorBitmapRect.x;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
276 this->uCursorBitmapHeight = this->pCursorBitmapRect.w - this->pCursorBitmapRect.y;
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
277 if ( this->bRedraw )
0
Ritor1
parents:
diff changeset
278 {
Ritor1
parents:
diff changeset
279 if ( pMouse->ptr_90 )
Ritor1
parents:
diff changeset
280 v9 = 2 * pMouse->uCursorBitmapPitch;
Ritor1
parents:
diff changeset
281 else
Ritor1
parents:
diff changeset
282 v9 = 0;
2093
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
283 pRenderer->_4A6DF5( this->pCursorBitmap_sysmem, v9, &this->pCursorBitmapPos, pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch,
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
284 &this->pCursorBitmapRect);//ñðàáàòûâàåò êîãäà áåð¸ì êóðñîðîì âåùü â èíâåíòîðå
52415f8bf7c2 RasterLine2D (continue)
Ritor1
parents: 2069
diff changeset
285 this->bRedraw = false;
0
Ritor1
parents:
diff changeset
286 }
Ritor1
parents:
diff changeset
287 }
Ritor1
parents:
diff changeset
288 }
Ritor1
parents:
diff changeset
289
Ritor1
parents:
diff changeset
290 //----- (00469E1C) --------------------------------------------------------
Ritor1
parents:
diff changeset
291 void Mouse::_469E1C()
Ritor1
parents:
diff changeset
292 {
Ritor1
parents:
diff changeset
293 bActive = true;
Ritor1
parents:
diff changeset
294 }
Ritor1
parents:
diff changeset
295
Ritor1
parents:
diff changeset
296 //----- (00469E24) --------------------------------------------------------
Ritor1
parents:
diff changeset
297 void Mouse::_469E24()
Ritor1
parents:
diff changeset
298 {
Ritor1
parents:
diff changeset
299 if (pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
300 {
Ritor1
parents:
diff changeset
301 free(pCursorBitmap3_sysmembits_16bit);
Ritor1
parents:
diff changeset
302 pCursorBitmap3_sysmembits_16bit = 0;
Ritor1
parents:
diff changeset
303 }
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305
Ritor1
parents:
diff changeset
306 //----- (00469E3B) --------------------------------------------------------
Ritor1
parents:
diff changeset
307 void Mouse::DrawCursorToTarget()
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 if (!pCursorBitmap3_sysmembits_16bit)
Ritor1
parents:
diff changeset
310 return;
Ritor1
parents:
diff changeset
311
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1830
diff changeset
312 ushort* pSrc = pCursorBitmap3_sysmembits_16bit;
0
Ritor1
parents:
diff changeset
313 for (uint y = field_44; y < field_4C; ++y)
Ritor1
parents:
diff changeset
314 for (uint x = field_40; x < field_48; ++x)
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
315 //pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
316 pRenderer->WritePixel16(x, y, *pSrc++);
0
Ritor1
parents:
diff changeset
317 }
Ritor1
parents:
diff changeset
318
Ritor1
parents:
diff changeset
319 //----- (00469EA4) --------------------------------------------------------
Ritor1
parents:
diff changeset
320 void Mouse::_469EA4()
Ritor1
parents:
diff changeset
321 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
322 //Mouse *v1; // esi@1
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
323 unsigned int pTextureID; // eax@2
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
324 Texture *pTexture; // edi@2
0
Ritor1
parents:
diff changeset
325 unsigned int v4; // ecx@3
Ritor1
parents:
diff changeset
326 unsigned int v5; // eax@3
Ritor1
parents:
diff changeset
327 unsigned int v6; // ebx@5
Ritor1
parents:
diff changeset
328 int v7; // ecx@15
Ritor1
parents:
diff changeset
329 int v8; // ecx@25
Ritor1
parents:
diff changeset
330 int v9; // ebx@26
Ritor1
parents:
diff changeset
331 unsigned int v10; // eax@26
Ritor1
parents:
diff changeset
332 int v11; // edx@27
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
333 //unsigned __int16 *v12; // edx@29
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
334 //unsigned __int16 *v13; // ebx@29
0
Ritor1
parents:
diff changeset
335 unsigned int a2; // [sp+Ch] [bp-1Ch]@5
Ritor1
parents:
diff changeset
336 unsigned int v15; // [sp+10h] [bp-18h]@5
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
337 //unsigned int v16; // [sp+14h] [bp-14h]@25
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
338 //unsigned __int16 *v17; // [sp+18h] [bp-10h]@25
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
339 //int v18; // [sp+1Ch] [bp-Ch]@27
0
Ritor1
parents:
diff changeset
340 int v19; // [sp+20h] [bp-8h]@15
Ritor1
parents:
diff changeset
341 unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
342 int pTextureWidth; // [sp+24h] [bp-4h]@12
0
Ritor1
parents:
diff changeset
343 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
Ritor1
parents:
diff changeset
344
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
345 //v1 = this;
0
Ritor1
parents:
diff changeset
346 if ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
347 {
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1687
diff changeset
348 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
349 pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0);
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
350
0
Ritor1
parents:
diff changeset
351 v4 = pMouse->uMouseClickX;
Ritor1
parents:
diff changeset
352 v5 = pMouse->uMouseClickY;
1038
39f42990698f Cleanings
Nomad
parents: 1018
diff changeset
353
0
Ritor1
parents:
diff changeset
354 v6 = v5;
Ritor1
parents:
diff changeset
355 a2 = v4;
Ritor1
parents:
diff changeset
356 v15 = v5;
Ritor1
parents:
diff changeset
357 if ( (signed int)v4 <= 639 && (signed int)v5 <= 479 )
Ritor1
parents:
diff changeset
358 {
Ritor1
parents:
diff changeset
359 if ( (v4 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
360 a2 = 0;
Ritor1
parents:
diff changeset
361 if ( (v5 & 0x80000000u) != 0 )
Ritor1
parents:
diff changeset
362 {
Ritor1
parents:
diff changeset
363 v6 = 0;
Ritor1
parents:
diff changeset
364 v15 = 0;
Ritor1
parents:
diff changeset
365 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
366 if ( (signed int)(pTexture->uTextureWidth + a2) <= 640 )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
367 pTextureWidth = pTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
368 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
369 pTextureWidth = 640 - a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
370 if ( (signed int)(pTexture->uTextureHeight + v6) <= 480 )
0
Ritor1
parents:
diff changeset
371 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
372 v19 = pTexture->uTextureHeight;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
373 v7 = pTexture->uTextureHeight;
0
Ritor1
parents:
diff changeset
374 }
Ritor1
parents:
diff changeset
375 else
Ritor1
parents:
diff changeset
376 {
Ritor1
parents:
diff changeset
377 v7 = 480 - v6;
Ritor1
parents:
diff changeset
378 v19 = 480 - v6;
Ritor1
parents:
diff changeset
379 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
380 if ( !this->pCursorBitmap3_sysmembits_16bit
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
381 || a2 != this->field_40
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
382 || v6 != this->field_44
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
383 || a2 + pTextureWidth != this->field_48
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
384 || v6 + v7 != this->field_4C )
0
Ritor1
parents:
diff changeset
385 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
386 if ( this->pCursorBitmap3_sysmembits_16bit )
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
387 free(this->pCursorBitmap3_sysmembits_16bit);
1631
8094f1706b1f operator new() -> malloc
Nomad
parents: 1567
diff changeset
388 this->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)malloc(2 * pTexture->uTextureHeight * pTexture->uTextureWidth);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
389 this->field_40 = a2;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
390 this->field_48 = a2 + pTextureWidth;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
391 this->field_44 = v6;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
392 this->field_4C = v6 + v19;
0
Ritor1
parents:
diff changeset
393 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
394 v8 = this->field_44;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
395 v22 = this->pCursorBitmap3_sysmembits_16bit;
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
396 //v17 = pRenderer->pTargetSurface;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
397 //v16 = pRenderer->uTargetSurfacePitch;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
398
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
399 v10 = pRenderer->uTargetSurfacePitch * v8;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
400 v11 = this->field_40;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
401 for (int y = this->field_44; y < this->field_4C; ++y)
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
402 {
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
403 //v20 = &v17[v10 + v11];
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
404 for (int x = this->field_40; x < this->field_48; ++x)
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
405 {
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
406 //++v18;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
407 *v22++ = pRenderer->ReadPixel16(x, y);
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
408 }
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
409 }
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
410 /*if ( v8 < this->field_4C )
0
Ritor1
parents:
diff changeset
411 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
412 v9 = this->field_48;
0
Ritor1
parents:
diff changeset
413 v10 = pRenderer->uTargetSurfacePitch * v8;
Ritor1
parents:
diff changeset
414 do
Ritor1
parents:
diff changeset
415 {
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
416 v11 = this->field_40;
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
417 v18 = this->field_40;
0
Ritor1
parents:
diff changeset
418 if ( v11 < v9 )
Ritor1
parents:
diff changeset
419 {
Ritor1
parents:
diff changeset
420 v20 = &v17[v10 + v11];
Ritor1
parents:
diff changeset
421 do
Ritor1
parents:
diff changeset
422 {
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
423 //v12 = v20;
0
Ritor1
parents:
diff changeset
424 ++v18;
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
425 //++v20;
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
426 *v22++ = *v20++;
0
Ritor1
parents:
diff changeset
427 }
Ritor1
parents:
diff changeset
428 while ( v18 < v9 );
Ritor1
parents:
diff changeset
429 }
Ritor1
parents:
diff changeset
430 v10 += v16;
Ritor1
parents:
diff changeset
431 ++v8;
Ritor1
parents:
diff changeset
432 }
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
433 while ( v8 < this->field_4C );
0
Ritor1
parents:
diff changeset
434 v6 = v15;
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
435 }*/
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
436
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
437 v6 = v15;
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1458
diff changeset
438 if (pParty->pPickedItem.IsBroken())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
439 pRenderer->DrawTransparentRedShade(a2, v6, pTexture);
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1458
diff changeset
440 else if (!pParty->pPickedItem.IsIdentified())
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
441 pRenderer->DrawTransparentGreenShade(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
442 else
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
443 pRenderer->DrawTextureTransparent(a2, v6, pTexture);
0
Ritor1
parents:
diff changeset
444 }
Ritor1
parents:
diff changeset
445 }
Ritor1
parents:
diff changeset
446 else
Ritor1
parents:
diff changeset
447 {
Ritor1
parents:
diff changeset
448 if ( this->pCursorBitmap3_sysmembits_16bit )
Ritor1
parents:
diff changeset
449 {
Ritor1
parents:
diff changeset
450 free(this->pCursorBitmap3_sysmembits_16bit);
920
34ed2d5e7cfb MagicShopDialog clean and other
Ritor1
parents: 791
diff changeset
451 this->pCursorBitmap3_sysmembits_16bit = 0;
0
Ritor1
parents:
diff changeset
452 }
Ritor1
parents:
diff changeset
453 }
Ritor1
parents:
diff changeset
454 }
Ritor1
parents:
diff changeset
455
Ritor1
parents:
diff changeset
456 //----- (0046A080) --------------------------------------------------------
Ritor1
parents:
diff changeset
457 void Mouse::Activate(int bActive)
Ritor1
parents:
diff changeset
458 {
Ritor1
parents:
diff changeset
459 bActive = bActive;
Ritor1
parents:
diff changeset
460 }
Ritor1
parents:
diff changeset
461
Ritor1
parents:
diff changeset
462 //----- (0046A08A) --------------------------------------------------------
Ritor1
parents:
diff changeset
463 void Mouse::SetMouseClick(int x, int y)
Ritor1
parents:
diff changeset
464 {
Ritor1
parents:
diff changeset
465 uMouseClickX = x;
Ritor1
parents:
diff changeset
466 uMouseClickY = y;
Ritor1
parents:
diff changeset
467 }
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
468 //----- (004175C0) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
469 void UI_OnMouseLeftClick(int *pXY)
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
470 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
471 signed int y; // eax@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
472 signed int x; // ecx@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
473 signed int v5; // eax@17
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
474 GUIButton *control; // esi@37
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
475 signed int v10; // eax@50
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
476 int v11; // ecx@52
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
477 unsigned int pX; // [sp+14h] [bp-8h]@7
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
478 unsigned int pY; // [sp+18h] [bp-4h]@7
0
Ritor1
parents:
diff changeset
479
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
480 if ( pCurrentScreen == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() )
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
481 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
482 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
483 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
484 sub_4452BB();
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
485 return;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
486 }
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
487 if ( pXY )
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
488 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
489 x = *pXY;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
490 y = pXY[1];
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
491 pX = *pXY;
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
492 pY = y;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
493 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
494 else
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
495 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
496 pMouse->GetClickPos(&pX, &pY);
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
497 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
498 x = pX;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
499 }
1830
5ea627a263dd Clicking works again
Nomad
parents: 1802
diff changeset
500
5ea627a263dd Clicking works again
Nomad
parents: 1802
diff changeset
501 extern bool _507B98_ctrl_pressed;
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
502 x = pX;
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
503 if ( GetCurrentMenuID() != -1 || pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
504 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
505 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y)
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
506 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
507 y = pY;
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
508 for ( int i = uNumVisibleWindows; i >= 0; --i )
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
509 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
510 if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameZ
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
511 && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameW )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
512 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
513 for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; control; control = control->pNext )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
514 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
515 if ( control->uButtonType == 1 )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
516 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
517 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
518 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
519 control->field_2C_is_pushed = 1;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
520 v10 = pMessageQueue_50CBD0->uNumMessages;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
521 if ( pMessageQueue_50CBD0->uNumMessages )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
522 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
523 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
524 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
525 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
526 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
527 return;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
528 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
529 continue;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
530 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
531 if ( control->uButtonType == 2 )//êîãäà íàæèìàåøü íà ïàðòðåòû ïåðñîâ
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
532 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
533 if ( (signed int)(signed __int64)sqrt((double)((x - control->uX) * (x - control->uX) + (y - control->uY) * (y - control->uY))) < (signed int)control->uWidth )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
534 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
535 control->field_2C_is_pushed = 1;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
536 v10 = pMessageQueue_50CBD0->uNumMessages;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
537 if ( pMessageQueue_50CBD0->uNumMessages )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
538 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
539 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
540 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
541 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
542 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
543 return;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
544 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
545 continue;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
546 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
547 if ( control->uButtonType == 3 )//êîãäà íàæèìàåøü íà ñêèëëû
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
548 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
549 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
550 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
551 control->field_2C_is_pushed = 1;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
552 v10 = pMessageQueue_50CBD0->uNumMessages;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
553 if ( pMessageQueue_50CBD0->uNumMessages )
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
554 {
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
555 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
556 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
557 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
558 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
559 return;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
560 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
561 continue;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
562 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
563 y = pY;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
564 x = pX;
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
565 }
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
566 }
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
567 }
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
568 return;
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
569 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
570 y = pY;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
571 if ( pRenderer->pRenderD3D )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
572 v5 = pGame->pVisInstance->get_picked_object_zbuf_val();
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
573 else
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
574 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
1830
5ea627a263dd Clicking works again
Nomad
parents: 1802
diff changeset
575
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
576 uint type = PID_TYPE((unsigned __int16)v5);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
577 if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
578 && pPlayers[uActiveCharacter]->CanAct() && pPlayers[uActiveCharacter]->CanSteal() )
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
579 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
580 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
581 {
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
582 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
584 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
585 ++pMessageQueue_50CBD0->uNumMessages;
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
586 }*/
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 2093
diff changeset
587 pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0);
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
588
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
589 if ( pParty->bTurnBasedModeOn == 1 )
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
590 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1332
diff changeset
591 if ( pTurnEngine->turn_stage == 3 )
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1297
diff changeset
592 pTurnEngine->field_18 |= TE_FLAG_8;
1296
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
593 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
594 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
595 }
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
596
c423f946dc99 moving files continue
Ritor1
parents: 1262
diff changeset
597
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
598 //----- (0041CD4F) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
599 bool UI_OnKeyDown(unsigned int vkKey)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
600 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
601 //unsigned int v1; // edi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
602 //unsigned int v2; // eax@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
603 int v3; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
604 int v4; // ecx@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
605 GUIButton *pButton; // eax@11
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
606 int v6; // edx@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
607 int v7; // ecx@20
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
608 char v8; // zf@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
609 //GUIButton *v9; // ecx@24
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
610 int v10; // esi@24
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
611 //int v11; // edx@26
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
612 int v12; // edx@28
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
613 int v13; // esi@32
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
614 //GUIButton *v14; // eax@37
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
615 int v15; // edx@38
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
616 int v17; // ecx@50
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
617 int v18; // edx@50
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
618 //GUIButton *v19; // ecx@54
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
619 int v20; // esi@54
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
620 //int v21; // edx@56
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
621 int v22; // ecx@59
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
622 int v23; // edx@59
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
623 int v24; // ecx@60
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
624 int v25; // esi@63
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
625 //unsigned int v26; // [sp+Ch] [bp-14h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
626 //int v27; // [sp+10h] [bp-10h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
627 int v28; // [sp+14h] [bp-Ch]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
628 int v29; // [sp+14h] [bp-Ch]@36
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
629 unsigned int uClickX; // [sp+18h] [bp-8h]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
630 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
631
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
632 //v1 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
633 //v27 = uNumVisibleWindows;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
634 if ( uNumVisibleWindows < 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
635 return false;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
636 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
637 for (int i = uNumVisibleWindows; i >= 0; --i)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
638 //while ( 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
639 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
640 v3 = pVisibleWindowsIdxs[i] - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
641 if (!pWindowList[v3].receives_keyboard_input)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
642 continue;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
643
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
644 switch (vkKey)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
645 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
646 case VK_LEFT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
647 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
648 v12 = pWindowList[v3].field_34;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
649 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
650 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
651 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
652 pWindowList[v3].pCurrentPosActiveItem -= v12;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
653 if ( v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
654 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
655 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
656 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
657 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
658 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
659 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
660 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
661 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
662 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
663 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
664 v13 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
665 if ( v13 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
666 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
667 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
668 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
669 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
670 --v13;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
671 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
672 while ( v13 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
673 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
674 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
675 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
676 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
677 case VK_RIGHT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
678 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
679 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
680 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
681 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
682 v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
683 pWindowList[v3].pCurrentPosActiveItem = v7;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
684 if ( v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
685 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
686 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
687 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
688 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
689 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
690 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
691 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
692 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
693 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
694 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
695 v10 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
696 if ( v10 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
697 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
698 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
699 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
700 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
701 --v10;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
702 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
703 while ( v10 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
704 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
705 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
706 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
707 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
708 case VK_DOWN:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
709 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
710 v17 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
711 v18 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
712 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
713 pWindowList[v3].pCurrentPosActiveItem = v17;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
714 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
715 pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
716 if ( pWindowList[v3].field_30 != 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
717 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
718 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
719 v20 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
720 if ( v20 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
721 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
722 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
723 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
724 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
725 --v20;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
726 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
727 while ( v20 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
728 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
729 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
730 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
731 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
732 case VK_SELECT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
733 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
734 pMouse->GetClickPos(&uClickX, &uClickY);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
735 v4 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
736 v28 = v4 + pWindowList[v3].pNumPresenceButton;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
737 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
738 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
739 while ( 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
740 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
741 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
742 if ( v4 > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
743 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
744 v6 = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
745 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
746 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
747 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
748 --v6;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
749 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
750 while ( v6 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
751 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
752 if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
753 && (signed int)uClickX <= (signed int)pButton->uZ
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
754 && (signed int)uClickY >= (signed int)pButton->uY
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
755 && (signed int)uClickY <= (signed int)pButton->uW )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
756 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
757 ++v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
758 if ( v4 >= v28 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
759 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
760 //v1 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
761 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
762 //--i;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
763 //if ( i < 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
764 return false;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
765 //continue;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
766 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
767 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
768 pWindowList[v3].pCurrentPosActiveItem = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
769 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
770 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
771 //v2 = pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
772 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
773 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
774 case VK_UP:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
775 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
776 v22 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
777 v23 = pWindowList[v3].pStartingPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
778 if ( v22 <= v23 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
779 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
780 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
781 v24 = v22 - 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
782 v8 = pWindowList[v3].field_30 == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
783 pWindowList[v3].pCurrentPosActiveItem = v24;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
784 if ( !v8 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
785 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
786 pButton = pWindowList[v3].pControlsHead;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
787 v25 = pWindowList[v3].pCurrentPosActiveItem;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
788 if ( v25 > 0)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
789 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
790 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
791 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
792 pButton = pButton->pNext;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
793 --v25;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
794 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
795 while ( v25 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
796 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
797 pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
798 return true;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
799 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
800 case VK_NEXT:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
801 {
2099
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
802 if ( pWindowList[v3].field_30 != 0 ) //crashed at skill draw
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
803 {
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
804 pMouse->GetClickPos(&uClickX, &uClickY);
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
805 v29 = pWindowList[v3].pStartingPosActiveItem + pWindowList[v3].pNumPresenceButton; //num buttons more than buttons
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
806 for ( v4 = pWindowList[v3].pStartingPosActiveItem; v4 < v29; ++v4 )
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
807 {
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
808 pButton = pWindowList[v3].pControlsHead;
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
809 if ( v4 > 0 )
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
810 {
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
811 for ( v15 = v4; v15; --v15 )
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
812 pButton = pButton->pNext;
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
813 }
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
814 if ( (signed int)uClickX >= (signed int)pButton->uX && (signed int)uClickX <= (signed int)pButton->uZ
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
815 && (signed int)uClickY >= (signed int)pButton->uY && (signed int)uClickY <= (signed int)pButton->uW )
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
816 {
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
817 pWindowList[v3].pCurrentPosActiveItem = v4;
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
818 return true;
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
819 }
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
820 }
7edf389d49fc pCurrentPosActiveItem
Ritor1
parents: 2098
diff changeset
821 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
822 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
823 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
824 default:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
825 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
826 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
827 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
828 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
829 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1296
diff changeset
830 }