annotate IO/Mouse.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
rev   line source
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
3 #include <stdlib.h>
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
4 #include <crtdbg.h>
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
5
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6 #include "Engine/Engine.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
7 #include "Engine/Party.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
8 #include "Engine/LOD.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
9 #include "Engine/TurnEngine/TurnEngine.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
10 #include "Engine/Graphics/Viewport.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
11 #include "Engine/Graphics/Vis.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
12 #include "Engine/Objects/Actor.h"
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
13
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
14 #include "IO/Mouse.h"
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
15
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
16 #include "GUI/GUIWindow.h"
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
17
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
18 #include "Media/Audio/AudioPlayer.h"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
19
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
20
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2544
diff changeset
21 Mouse *pMouse = nullptr;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
22
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
23
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
24
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
25
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
26
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
27 //----- (00469860) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
28 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
29 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
30 *pX = uMouseClickX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
31 *pY = uMouseClickY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
32 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
33
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
34 //----- (004698A6) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
35 void Mouse::RemoveHoldingItem()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
36 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
37 pParty->pPickedItem.Reset();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
38 if (_stricmp(pCurrentCursorName, "MICON2"))
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
39 SetCursorBitmap("MICON1");
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
40 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
41
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
42 //----- (004698D8) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
43 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
44 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
45 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
46 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
47
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
48 //----- (004698F6) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
49 void Mouse::SetCurrentCursorBitmap()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
50 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
51 SetCursorBitmap(pCurrentCursorName);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
52 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
53
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
54 //----- (00469903) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
55 void Mouse::SetCursorBitmap(const char *pName)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
56 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
57 // DDSURFACEDESC2 Dst;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
58
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
59 if ( !this->bInitialized || !pName )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
60 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
61 if ( _stricmp("MICON2", pName) )//если кусор не мишень
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
62 pEngine->uFlags2 &= 0xFFFFFFEF;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
63 else
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
64 pEngine->uFlags2 |= 0x10;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
65 if ( _stricmp(this->pCurrentCursorName, pName) )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
66 strcpy(this->pCurrentCursorName, pName);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
67 ClearCursor();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
68 if ( _strnicmp(pName, "MICON1", 5) )//for click to item / если курсор с вещью
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
69 {
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
70 //this->uCursorTextureID = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
71 //this->uCursorTextureID_2 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
72 uCursorTextureID = uCursorTextureID_2 = -1;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
73 this->AllocCursorSystemMem();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
74 this->field_C = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
75 this->bRedraw = true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
76 this->bActive = true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
77 if ( !areWeLoadingTexture )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
78 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
79 if (uCursorTextureID != -1)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
80 pIcons_LOD->pTextures[uCursorTextureID].Release();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
81 pIcons_LOD->SyncLoadedFilesCount();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
82 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
83 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
84 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
85 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
86 this->field_C = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
87 window->SetCursor(pName);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
88 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
89 // 506128: using guessed type int areWeLoadingTexture;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
90
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
91 //----- (00469AE4) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
92 LONG Mouse::_469AE4()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
93 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
94 LONG v2; // ecx@2
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
95 LONG result; // eax@2
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
96 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
97
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
98 this->field_8 = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
99 /*if (pAsyncMouse)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
100 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
101 v2 = *((int *)pAsyncMouse + 6);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
102 Point.x = *((int *)pAsyncMouse + 6);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
103 result = *((int *)pAsyncMouse + 7);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
104 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
105 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
106 {*/
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
107 GetCursorPos(&Point);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
108 //if ( pRenderer->bWindowMode )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
109 ScreenToClient(window->GetApiHandle(), &Point);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
110 result = Point.y;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
111 v2 = Point.x;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
112 //}
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
113 this->uMouseClickX = v2;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
114 this->uMouseClickY = result;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
115
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
116 /*
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
117 //This block has been commented out, because of the changed condition above "if(true)"
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
118 //Also the next condition and the first line has been commented out as well
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
119
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
120 // if (pRenderer->bWindowMode)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
121 if ( true )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
122 goto LABEL_16;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
123 //if (pAsyncMouse)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
124 // goto LABEL_24;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
125
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
126
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
127 if ( v2 < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
128 v2 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
129 if ( result < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
130 result = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
131 if ( v2 > window->GetWidth() - 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
132 v2 = window->GetWidth() - 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
133 */
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
134
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
135 // if ( result > window->GetHeight() - 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
136 // {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
137 // result = window->GetHeight() - 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
138 //LABEL_16:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
139 //if (pAsyncMouse)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
140 // goto LABEL_24;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
141 if (true/*pRenderer->bWindowMode*/ && (v2 < 0 || result < 0 || v2 > window->GetWidth() - 1 || result > window->GetHeight() - 1))
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
142 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
143 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
144 //LABEL_24:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
145 this->field_8 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
146 return result;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
147 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
148 //}
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
149
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
150 if ( this->field_C )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
151 //LABEL_23:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
152 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
153 //LABEL_24:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
154 this->field_8 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
155 return result;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
156 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
157
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
158 //----- (00469BA3) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
159 void Mouse::ClearCursor()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
160 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
161 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
162 free(this->pCursorBitmap_sysmem);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
163 this->pCursorBitmap_sysmem = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
164 free(this->pCursorBitmap2_sysmem);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
165 this->pCursorBitmap2_sysmem = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
166 free(this->ptr_90);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
167 this->ptr_90 = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
168 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
169
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
170 //----- (00469BE6) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
171 void Mouse::AllocCursorSystemMem()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
172 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
173 bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
174 if (!pCursorBitmap_sysmem)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
175 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
176 if (!pCursorBitmap2_sysmem)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
177 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
178 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
179
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
180 //----- (00469C0D) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
181 void *Mouse::DoAllocCursorMem()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
182 {
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
183 //Texture_MM7* tex = pIcons_LOD->GetTexture(uCursorTextureID);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
184 //return malloc(4 * tex->uTextureWidth * tex->uTextureHeight);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
185 return nullptr;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
186 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
187
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
188 //----- (00469C39) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
189 POINT *Mouse::GetCursorPos(POINT *a2)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
190 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
191 a2->x = this->uMouseClickX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
192 a2->y = this->uMouseClickY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
193 return a2;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
194 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
195
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
196 //----- (00469C65) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
197 void Mouse::Initialize(OSWindow *window)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
198 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
199 this->window = window;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
200 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
201 this->bInitialized = true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
202
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
203 //this->field_8 = 0;//Ritor1: result incorrect uMouseClickX, this->uMouseClickY in _469AE4()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
204 this->uCursorBitmapPitch = 0;//Ritor1: it's include
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
205 for ( uint i = 0; i < 13; i++ )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
206 this->field_5C[i] = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
207
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
208 this->pCursorBitmapPos.x = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
209 this->pCursorBitmapPos.y = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
210 this->uMouseClickX = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
211 this->uMouseClickY = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
212 this->pCursorBitmap_sysmem = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
213 this->field_34 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
214 this->pCursorBitmap2_sysmem = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
215
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
216 SetCursorBitmap("MICON3");
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
217 SetCursorBitmap("MICON2");
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
218 SetCursorBitmap("MICON1");
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
219 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
220
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
221 // inlined
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
222 //----- (0045FE00) mm6 chinese --------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
223 void Mouse::SetActive(bool active)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
224 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
225 bActive = active;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
226 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
227
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
228 //----- (00469CC2) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
229 void Mouse::Deactivate()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
230 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
231 if (bInitialized)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
232 SetActive(false);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
233 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
234
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
235 //----- (00469CCD) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
236 void Mouse::DrawCursor()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
237 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
238 unsigned int v9; // eax@31
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
239
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
240 if ( this->bInitialized )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
241 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
242 if ( !this->field_8 && this->bActive && !this->field_C ) //Uninitialized memory access(this->field_8)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
243 pMouse->_469AE4();//Ritor1: странная, непонятная функция
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
244 this->field_F4 = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
245 if ( this->field_C )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
246 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
247 this->field_F4 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
248 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
249 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
250
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
251 //if ( pRenderer->bWindowMode )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
252 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
253 if ( this->uMouseClickX < 0 || this->uMouseClickY < 0 || this->uMouseClickX > window->GetWidth() - 1 || this->uMouseClickY > window->GetHeight() - 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
254 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
255 this->field_F4 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
256 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
257 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
258 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
259 /*else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
260 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
261 if ( this->uMouseClickX < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
262 this->uMouseClickX = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
263 if ( this->uMouseClickY < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
264 this->uMouseClickY = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
265 if ( this->uMouseClickX > 639 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
266 this->uMouseClickX = 639;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
267 if ( this->uMouseClickY > 479 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
268 this->uMouseClickY = 479;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
269 }*/
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
270 this->pCursorBitmapRect.x = this->uMouseClickX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
271 this->pCursorBitmapRect.w = this->uMouseClickY + this->field_5C[0]; //Ritor1: Maybe this->field_5C[0] - cursor width
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
272 this->pCursorBitmapRect.y = this->uMouseClickY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
273 this->pCursorBitmapRect.z = this->uMouseClickX + this->uCursorBitmapPitch; //Ritor1: Maybe this->uCursorBitmapPitch - cursor height
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
274 if ( this->uMouseClickX < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
275 this->pCursorBitmapRect.x = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
276 if ( this->uMouseClickY < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
277 this->pCursorBitmapRect.y = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
278 if ( this->pCursorBitmapRect.z > window->GetWidth() )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
279 this->pCursorBitmapRect.z = window->GetWidth();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
280 if ( this->pCursorBitmapRect.w > window->GetHeight() )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
281 this->pCursorBitmapRect.w = window->GetHeight();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
282 this->bActive = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
283 this->uCursorBitmapWidth = this->pCursorBitmapRect.z - this->pCursorBitmapRect.x;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
284 this->uCursorBitmapHeight = this->pCursorBitmapRect.w - this->pCursorBitmapRect.y;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
285 if ( this->bRedraw )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
286 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
287 if ( pMouse->ptr_90 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
288 v9 = 2 * pMouse->uCursorBitmapPitch;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
289 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
290 v9 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
291 pRenderer->_4A6DF5( this->pCursorBitmap_sysmem, v9, &this->pCursorBitmapPos, pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
292 &this->pCursorBitmapRect);//срабатывает когда берём курсором вещь в инвенторе
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
293 this->bRedraw = false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
294 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
295 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
296 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
297
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
298 //----- (00469E1C) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
299 void Mouse::Activate()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
300 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
301 bActive = true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
302 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
303
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
304 //----- (00469E24) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
305 void Mouse::_469E24()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
306 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
307 free(pCursorBitmap3_sysmembits_16bit);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
308 pCursorBitmap3_sysmembits_16bit = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
309 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
310
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
311 //----- (00469E3B) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
312 void Mouse::DrawCursorToTarget()//??? DrawCursorWithItem
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
313 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
314 if (!pCursorBitmap3_sysmembits_16bit)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
315 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
316 //пишем на экран курсор с вещью
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
317 ushort* pSrc = pCursorBitmap3_sysmembits_16bit;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
318 for (int y = uCursorWithItemY; y < uCursorWithItemZ; ++y)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
319 for (int x = uCursorWithItemX; x < uCursorWithItemW; ++x)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
320 //pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
321 pRenderer->WritePixel16(x, y, *pSrc++);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
322 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
323
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
324 //----- (00469EA4) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
325 void Mouse::ReadCursorWithItem()
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
326 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
327 unsigned int pTextureID; // eax@2
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
328 Image *pTexture; // edi@2
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
329 // int v8; // ecx@25
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
330 // int v9; // ebx@26
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
331 // unsigned int v10; // eax@26
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
332 // int v11; // edx@27
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
333 int pTextureHeight; // [sp+20h] [bp-8h]@15
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
334 // unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
335 int pTextureWidth; // [sp+24h] [bp-4h]@12
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
336 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
337
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
338 if ( pParty->pPickedItem.uItemID )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
339 {
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
340 //pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
341 //pTexture = (Texture_MM7 *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0);
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
342 pTexture = assets->GetImage_16BitAlpha(pParty->pPickedItem.GetIconName());
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
343
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
344 if ( (signed int)pMouse->uMouseClickX <= window->GetWidth() - 1 && (signed int)pMouse->uMouseClickY <= window->GetHeight() - 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
345 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
346 /*if ( (v4 & 0x80000000u) != 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
347 a2 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
348 if ( (v5 & 0x80000000u) != 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
349 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
350 //v6 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
351 v15 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
352 } */
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
353 if ( (signed int)(pTexture->GetWidth() + pMouse->uMouseClickX) <= window->GetWidth() )
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
354 pTextureWidth = pTexture->GetWidth();
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
355 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
356 pTextureWidth = window->GetWidth() - pMouse->uMouseClickX;
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
357 if ( (signed int)(pTexture->GetHeight() + pMouse->uMouseClickY) <= window->GetHeight() )
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
358 pTextureHeight = pTexture->GetHeight();
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
359 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
360 pTextureHeight = window->GetHeight() - pMouse->uMouseClickY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
361 if ( !this->pCursorBitmap3_sysmembits_16bit
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
362 || pMouse->uMouseClickX != this->uCursorWithItemX
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
363 || pMouse->uMouseClickY != this->uCursorWithItemY
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
364 || pMouse->uMouseClickX + pTextureWidth != this->uCursorWithItemW
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
365 || pMouse->uMouseClickY + pTextureHeight != this->uCursorWithItemZ )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
366 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
367 free(this->pCursorBitmap3_sysmembits_16bit);
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
368 this->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)malloc(2 * pTexture->GetHeight() * pTexture->GetWidth());
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
369 this->uCursorWithItemX = pMouse->uMouseClickX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
370 this->uCursorWithItemW = pMouse->uMouseClickX + pTextureWidth;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
371 this->uCursorWithItemY = pMouse->uMouseClickY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
372 this->uCursorWithItemZ = pMouse->uMouseClickY + pTextureHeight;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
373 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
374 v22 = this->pCursorBitmap3_sysmembits_16bit;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
375
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
376 for (int y = this->uCursorWithItemY; y < this->uCursorWithItemZ; ++y)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
377 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
378 for (int x = this->uCursorWithItemX; x < this->uCursorWithItemW; ++x)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
379 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
380 *v22++ = pRenderer->ReadPixel16(x, y);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
381 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
382 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
383
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
384 if (pParty->pPickedItem.IsBroken())
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
385 pRenderer->DrawTransparentRedShade(pMouse->uMouseClickX/640.0f, pMouse->uMouseClickY/480.0f, pTexture);
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
386 else if (!pParty->pPickedItem.IsIdentified())
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
387 pRenderer->DrawTransparentGreenShade(pMouse->uMouseClickX/640.0f, pMouse->uMouseClickY/480.0f, pTexture);
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
388 else
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
389 pRenderer->DrawTextureAlphaNew(pMouse->uMouseClickX/640.0f, pMouse->uMouseClickY/480.0f, pTexture);
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
390 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
391 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
392 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
393 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
394 free(this->pCursorBitmap3_sysmembits_16bit);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
395 this->pCursorBitmap3_sysmembits_16bit = nullptr;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
396 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
397 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
398
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
399 //----- (0046A080) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
400 void Mouse::ChangeActivation(int a1)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
401 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
402 this->bActive = a1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
403 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
404
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
405 //----- (0046A08A) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
406 void Mouse::SetMouseClick(int x, int y)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
407 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
408 uMouseClickX = x;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
409 uMouseClickY = y;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
410 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
411 //----- (004175C0) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
412 void Mouse::UI_OnMouseLeftClick(int *pXY)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
413 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
414 signed int y; // eax@7
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
415 signed int x; // ecx@7
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
416 signed int v5; // eax@17
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
417 GUIButton *control; // esi@37
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
418 signed int v10; // eax@50
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
419 // int v11; // ecx@52
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
420 unsigned int pX; // [sp+14h] [bp-8h]@7
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
421 unsigned int pY; // [sp+18h] [bp-4h]@7
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
422
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
423 if ( current_screen_type == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
424 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
425 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
426 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
427 sub_4452BB();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
428 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
429 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
430 if ( pXY )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
431 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
432 x = *pXY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
433 y = pXY[1];
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
434 pX = *pXY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
435 pY = y;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
436 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
437 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
438 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
439 pMouse->GetClickPos(&pX, &pY);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
440 y = pY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
441 x = pX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
442 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
443
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
444 extern bool _507B98_ctrl_pressed;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
445 x = pX;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
446 if ( GetCurrentMenuID() != -1 || current_screen_type != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
447 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
448 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
449 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
450 y = pY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
451 for ( int i = uNumVisibleWindows; i >= 0; --i )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
452 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
453 if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameZ
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
454 && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameW )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
455 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
456 for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1]->pControlsHead; control; control = control->pNext )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
457 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
458 if ( control->uButtonType == 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
459 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
460 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
461 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
462 control->field_2C_is_pushed = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
463 v10 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
464 if ( pMessageQueue_50CBD0->uNumMessages )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
465 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
466 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
467 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
468 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
469 pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
470 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
471 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
472 continue;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
473 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
474 if ( control->uButtonType == 2 )//когда нажимаешь на партреты персов
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
475 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
476 if ( (signed int)(signed __int64)sqrt((double)((x - control->uX) * (x - control->uX) + (y - control->uY) * (y - control->uY))) < (signed int)control->uWidth )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
477 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
478 control->field_2C_is_pushed = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
479 v10 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
480 if ( pMessageQueue_50CBD0->uNumMessages )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
481 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
482 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
483 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
484 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
485 pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
486 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
487 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
488 continue;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
489 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
490 if ( control->uButtonType == 3 )//когда нажимаешь на скиллы
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
491 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
492 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
493 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
494 control->field_2C_is_pushed = 1;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
495 v10 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
496 if ( pMessageQueue_50CBD0->uNumMessages )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
497 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
498 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
499 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
500 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
501 pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
502 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
503 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
504 continue;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
505 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
506 y = pY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
507 x = pX;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
508 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
509 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
510 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
511 return;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
512 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
513 y = pY;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
514 //if ( pRenderer->pRenderD3D )
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
515 v5 = pEngine->pVisInstance->get_picked_object_zbuf_val();
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
516 /*else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
517 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
518
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
519 uint type = PID_TYPE((unsigned __int16)v5);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
520 if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
521 && pPlayers[uActiveCharacter]->CanAct() && pPlayers[uActiveCharacter]->CanSteal() )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
522 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
523 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
524 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
525 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
526 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
527 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
528 ++pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
529 }*/
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
530 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
531
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
532 if ( pParty->bTurnBasedModeOn == 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
533 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
534 if ( pTurnEngine->turn_stage == TE_MOVEMENT )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
535 pTurnEngine->field_18 |= TE_FLAG_8;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
536 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
537 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
538 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
539
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
540
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
541 //----- (0041CD4F) --------------------------------------------------------
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
542 bool Mouse::UI_OnKeyDown(unsigned int vkKey)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
543 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
544 //unsigned int v1; // edi@1
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
545 //unsigned int v2; // eax@2
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
546 int v3; // esi@3
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
547 int v4; // ecx@10
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
548 GUIButton *pButton; // eax@11
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
549 int v6; // edx@12
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
550 int v7; // ecx@20
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
551 char v8; // zf@21
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
552 //GUIButton *v9; // ecx@24
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
553 int v10; // esi@24
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
554 //int v11; // edx@26
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
555 int v12; // edx@28
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
556 int v13; // esi@32
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
557 //GUIButton *v14; // eax@37
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
558 int v15; // edx@38
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
559 int v17; // ecx@50
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
560 int v18; // edx@50
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
561 //GUIButton *v19; // ecx@54
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
562 int v20; // esi@54
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
563 //int v21; // edx@56
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
564 int v22; // ecx@59
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
565 int v23; // edx@59
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
566 int v24; // ecx@60
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
567 int v25; // esi@63
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
568 //unsigned int v26; // [sp+Ch] [bp-14h]@1
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
569 //int v27; // [sp+10h] [bp-10h]@1
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
570 int v28; // [sp+14h] [bp-Ch]@10
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
571 int v29; // [sp+14h] [bp-Ch]@36
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
572 unsigned int uClickX; // [sp+18h] [bp-8h]@10
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
573 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
574
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
575 //v1 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
576 //v27 = uNumVisibleWindows;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
577 if ( uNumVisibleWindows < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
578 return false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
579 //v2 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
580 for (int i = uNumVisibleWindows; i >= 0; --i)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
581 //while ( 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
582 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
583 v3 = pVisibleWindowsIdxs[i] - 1;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
584 if (!pWindowList[v3]->receives_keyboard_input)
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
585 continue;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
586
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
587 switch (vkKey)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
588 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
589 case VK_LEFT:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
590 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
591 v12 = pWindowList[v3]->field_34;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
592 if ( pWindowList[v3]->pCurrentPosActiveItem - pWindowList[v3]->pStartingPosActiveItem - v12 >= 0 )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
593 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
594 v8 = current_screen_type == SCREEN_PARTY_CREATION;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
595 pWindowList[v3]->pCurrentPosActiveItem -= v12;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
596 if ( v8 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
597 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2524
diff changeset
598 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
599 //v2 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
600 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
601 }
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
602 if ( pWindowList[v3]->field_30 != 0 )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
603 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
604 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
605 }
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
606 pButton = pWindowList[v3]->pControlsHead;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
607 v13 = pWindowList[v3]->pCurrentPosActiveItem;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
608 if ( v13 > 0)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
609 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
610 do
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
611 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
612 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
613 --v13;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
614 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
615 while ( v13 );
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
616 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
617 pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
618 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
619 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
620 case VK_RIGHT:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
621 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
622 v7 = pWindowList[v3]->pCurrentPosActiveItem + pWindowList[v3]->field_34;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
623 if ( v7 < pWindowList[v3]->pNumPresenceButton + pWindowList[v3]->pStartingPosActiveItem )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
624 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
625 v8 = current_screen_type == SCREEN_PARTY_CREATION;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
626 pWindowList[v3]->pCurrentPosActiveItem = v7;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
627 if ( v8 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
628 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2524
diff changeset
629 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
630 //v2 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
631 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
632 }
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
633 if ( pWindowList[v3]->field_30 != 0 )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
634 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
635 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
636 }
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
637 pButton = pWindowList[v3]->pControlsHead;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
638 v10 = pWindowList[v3]->pCurrentPosActiveItem;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
639 if ( v10 > 0)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
640 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
641 do
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
642 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
643 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
644 --v10;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
645 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
646 while ( v10 );
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
647 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
648 pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
649 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
650 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
651 case VK_DOWN:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
652 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
653 v17 = pWindowList[v3]->pStartingPosActiveItem;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
654 v18 = pWindowList[v3]->pCurrentPosActiveItem;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
655 if ( v18 >= pWindowList[v3]->pNumPresenceButton + v17 - 1 )
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
656 pWindowList[v3]->pCurrentPosActiveItem = v17;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
657 else
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
658 pWindowList[v3]->pCurrentPosActiveItem = v18 + 1;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
659 if ( pWindowList[v3]->field_30 != 0 )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
660 return true;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
661 pButton = pWindowList[v3]->pControlsHead;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
662 v20 = pWindowList[v3]->pCurrentPosActiveItem;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
663 if ( v20 > 0)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
664 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
665 do
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
666 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
667 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
668 --v20;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
669 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
670 while ( v20 );
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
671 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
672 pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
673 return true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
674 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
675 case VK_SELECT:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
676 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
677 pMouse->GetClickPos(&uClickX, &uClickY);
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
678 v4 = pWindowList[v3]->pStartingPosActiveItem;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
679 v28 = v4 + pWindowList[v3]->pNumPresenceButton;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
680 if ( v4 < v4 + pWindowList[v3]->pNumPresenceButton )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
681 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
682 while ( 1 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
683 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
684 pButton = pWindowList[v3]->pControlsHead;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
685 if ( v4 > 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
686 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
687 v6 = v4;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
688 do
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
689 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
690 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
691 --v6;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
692 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
693 while ( v6 );
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
694 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
695 if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
696 && (signed int)uClickX <= (signed int)pButton->uZ
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
697 && (signed int)uClickY >= (signed int)pButton->uY
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
698 && (signed int)uClickY <= (signed int)pButton->uW )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
699 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
700 ++v4;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
701 if ( v4 >= v28 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
702 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
703 //v1 = 0;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
704 //v2 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
705 //--i;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
706 //if ( i < 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
707 return false;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
708 //continue;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
709 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
710 }
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
711 pWindowList[v3]->pCurrentPosActiveItem = v4;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
712 return true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
713 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
714 //v2 = pMessageQueue_50CBD0->uNumMessages;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
715 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
716 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
717 case VK_UP:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
718 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
719 v22 = pWindowList[v3]->pCurrentPosActiveItem;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
720 v23 = pWindowList[v3]->pStartingPosActiveItem;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
721 if ( v22 <= v23 )
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
722 v24 = pWindowList[v3]->pNumPresenceButton + v23 - 1;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
723 else
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
724 v24 = v22 - 1;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
725 v8 = pWindowList[v3]->field_30 == 0;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
726 pWindowList[v3]->pCurrentPosActiveItem = v24;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
727 if ( !v8 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
728 return true;
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
729 pButton = pWindowList[v3]->pControlsHead;
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
730 v25 = pWindowList[v3]->pCurrentPosActiveItem;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
731 if ( v25 > 0)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
732 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
733 do
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
734 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
735 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
736 --v25;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
737 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
738 while ( v25 );
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
739 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
740 pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
741 return true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
742 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
743 case VK_NEXT:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
744 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
745 if ( pWindowList[v3]->field_30 != 0 ) //crashed at skill draw
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
746 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
747 pMouse->GetClickPos(&uClickX, &uClickY);
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
748 v29 = pWindowList[v3]->pStartingPosActiveItem + pWindowList[v3]->pNumPresenceButton; //num buttons more than buttons
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
749 for ( v4 = pWindowList[v3]->pStartingPosActiveItem; v4 < v29; ++v4 )
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
750 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
751 pButton = pWindowList[v3]->pControlsHead;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2548
diff changeset
752 if (!pButton)
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2548
diff changeset
753 continue;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
754 if ( v4 > 0 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
755 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
756 for ( v15 = v4; v15; --v15 )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
757 pButton = pButton->pNext;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
758 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
759 if ( (signed int)uClickX >= (signed int)pButton->uX && (signed int)uClickX <= (signed int)pButton->uZ
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
760 && (signed int)uClickY >= (signed int)pButton->uY && (signed int)uClickY <= (signed int)pButton->uW )
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
761 {
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
762 pWindowList[v3]->pCurrentPosActiveItem = v4;
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
763 return true;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
764 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
765 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
766 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
767 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
768 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
769 default:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
770 break;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
771 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
772 }
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
773 }