annotate Mouse.cpp @ 2440:2b10278bc7ac

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