Mercurial > mm7
comparison GUI/UI/Books/MapBook.cpp @ 2548:87e5590d034b
All Books windows are refactored into respective classes
author | a.parshin |
---|---|
date | Tue, 12 May 2015 03:24:19 +0200 |
parents | |
children | d87bfbd3bb3b |
comparison
equal
deleted
inserted
replaced
2547:fed97f15d1e1 | 2548:87e5590d034b |
---|---|
1 #include "Engine/Engine.h" | |
2 #include "Engine/LOD.h" | |
3 #include "Engine/Party.h" | |
4 #include "Engine/Timer.h" | |
5 #include "Engine/Events.h" | |
6 #include "Engine/OurMath.h" | |
7 #include "Engine/texts.h" | |
8 #include "Engine/Graphics/IRender.h" | |
9 #include "Engine/Graphics/Viewport.h" | |
10 #include "Engine/Graphics/Outdoor.h" | |
11 #include "Engine/Graphics/Indoor.h" | |
12 #include "Engine/Graphics/Level/Decoration.h" | |
13 | |
14 #include "IO/Mouse.h" | |
15 | |
16 #include "GUI/GUIFont.h" | |
17 #include "GUI/UI/Books/MapBook.h" | |
18 | |
19 #include "Media/Audio/AudioPlayer.h" | |
20 | |
21 void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb | |
22 | |
23 | |
24 GUIWindow_MapBook::GUIWindow_MapBook() : | |
25 GUIWindow_Book() | |
26 { | |
27 this->ptr_1C = (void *)WINDOW_MapsBook; // inherited from GUIWindow::GUIWindow | |
28 BasicBookInitialization(); | |
29 | |
30 // ---------------------------------------------- | |
31 // 00411BFC GUIWindow::InitializeBookView -- part | |
32 pEventTimer->Pause(); | |
33 viewparams->sViewCenterX = pParty->vPosition.x; | |
34 viewparams->sViewCenterY = pParty->vPosition.y; | |
35 pAudioPlayer->StopChannels(-1, -1); | |
36 pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(546, 353, 0, 0, (int)pBtn_Maps, 0); | |
37 | |
38 // ---------------------------------------------- | |
39 // 00411BFC GUIWindow::InitializeBookView -- part | |
40 dword_506364 = 1; | |
41 pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
42 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); | |
43 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); | |
44 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); | |
45 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); | |
46 pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); | |
47 pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); | |
48 pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); | |
49 pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); | |
50 pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); | |
51 pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); | |
52 pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); | |
53 pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); | |
54 | |
55 pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, | |
56 UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_book_button1_on, 0);// "Zoom In" | |
57 pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, | |
58 UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_book_button2_on, 0);// "Zoom Out" | |
59 pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, | |
60 UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up | |
61 pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, | |
62 UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down | |
63 pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, | |
64 UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" | |
65 pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, | |
66 UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" | |
67 } | |
68 | |
69 | |
70 | |
71 | |
72 void GUIWindow_MapBook::Update() | |
73 { | |
74 // ----------------------------------- | |
75 // 004156F0 GUI_UpdateWindows --- part | |
76 // { | |
77 // BookUI_Draw((WindowType)(int)ptr_1C); | |
78 // } | |
79 | |
80 // ----- (00413CC6) -------------------------------------------------------- | |
81 // void BookUI_Draw(WindowType book) --- part | |
82 // { | |
83 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); | |
84 // BookUI_Map_Draw(); | |
85 | |
86 // ----- (00413980) -------------------------------------------------------- | |
87 // void BookUI_Map_Draw() | |
88 // { | |
89 unsigned int map_id; // eax@35 | |
90 char party_coord[120]; // [sp+Ch] [bp-CCh]@37 | |
91 GUIWindow map_window; // [sp+84h] [bp-54h]@35 | |
92 | |
93 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); | |
94 if (BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12)//Button 1 | |
95 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); | |
96 else | |
97 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); | |
98 | |
99 if (BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3)//Button 2 | |
100 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); | |
101 else | |
102 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); | |
103 | |
104 if (Book_PageBtn3_flag)//Button 3 | |
105 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); | |
106 else | |
107 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); | |
108 | |
109 if (Book_PageBtn4_flag)//Button 4 | |
110 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); | |
111 else | |
112 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); | |
113 | |
114 if (Book_PageBtn5_flag)//Button 5 | |
115 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); | |
116 else | |
117 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); | |
118 | |
119 if (Book_PageBtn6_flag)//Button 6 | |
120 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); | |
121 else | |
122 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); | |
123 | |
124 if (BtnDown_flag) | |
125 viewparams->CenterOnParty2(); | |
126 if (BtnUp_flag) | |
127 viewparams->CenterOnParty(); | |
128 if (Book_PageBtn3_flag) | |
129 viewparams->_443219(); | |
130 if (Book_PageBtn4_flag) | |
131 viewparams->_443231(); | |
132 if (Book_PageBtn5_flag) | |
133 viewparams->_44323D(); | |
134 if (Book_PageBtn6_flag) | |
135 viewparams->_443225(); | |
136 | |
137 if (BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag) | |
138 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
139 BtnUp_flag = 0; | |
140 BtnDown_flag = 0; | |
141 Book_PageBtn6_flag = 0; | |
142 Book_PageBtn5_flag = 0; | |
143 Book_PageBtn4_flag = 0; | |
144 Book_PageBtn3_flag = 0; | |
145 DrawBook_Map_sub(97, 49, 361, 313, 0); | |
146 pRenderer->DrawTextureIndexedAlpha(75, 22, pTexture_mapbordr); | |
147 map_window.uFrameWidth = game_viewport_width; | |
148 map_window.uFrameHeight = game_viewport_height; | |
149 map_window.uFrameX = game_viewport_x; | |
150 map_window.uFrameY = game_viewport_y; | |
151 map_window.uFrameZ = game_viewport_z; | |
152 map_window.uFrameW = game_viewport_w; | |
153 map_id = pMapStats->GetMapInfo(pCurrentMapName); | |
154 if (map_id) | |
155 map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3); | |
156 | |
157 map_window.uFrameX = 0; | |
158 sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d" | |
159 map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0); | |
160 } | |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | |
173 //----- (00442955) -------------------------------------------------------- | |
174 void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074) | |
175 { | |
176 int v20; // eax@16 | |
177 int v26; // ecx@21 | |
178 unsigned __int16 *v27; // edi@21 | |
179 int v28; // edx@21 | |
180 int v29; // eax@21 | |
181 double v30; // st7@23 | |
182 int textr_width; // esi@23 | |
183 signed int v47; // esi@38 | |
184 signed int v48; // ecx@38 | |
185 int v49; // eax@38 | |
186 signed int v50; // edx@55 | |
187 unsigned int v51; // ecx@55 | |
188 int v54; // esi@75 | |
189 int v55; // eax@75 | |
190 double v57; // st7@85 | |
191 signed int v60; // edi@85 | |
192 signed int v62; // ebx@85 | |
193 signed int v63; // esi@85 | |
194 int v64; // eax@87 | |
195 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 | |
196 int map_tile_X; // [sp+48020h] [bp-44h]@23 | |
197 unsigned char* texture8_data; | |
198 unsigned char* curr_line; | |
199 int scale_increment; | |
200 int scaled_posX; | |
201 int scaled_posY; | |
202 int stepX_r; | |
203 int stepY_r; | |
204 unsigned int teal; // [sp+48028h] [bp-3Ch]@8 | |
205 int pCenterY; // [sp+4802Ch] [bp-38h]@1 | |
206 int screenCenter_X; // [sp+48030h] [bp-34h]@1 | |
207 int pCenterX; // [sp+48034h] [bp-30h]@1 | |
208 int v87; // [sp+48038h] [bp-2Ch]@16 | |
209 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 | |
210 int black; // [sp+48040h] [bp-24h]@8 | |
211 int screenCenterY; // [sp+48044h] [bp-20h]@1 | |
212 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 | |
213 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 | |
214 signed int screenWidth; // [sp+48054h] [bp-10h]@8 | |
215 unsigned int v95; // [sp+48058h] [bp-Ch]@16 | |
216 int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 | |
217 const void *v97; // [sp+48060h] [bp-4h]@16 | |
218 | |
219 screenCenter_X = (signed int)(tl_x + br_x) / 2; | |
220 screenCenterY = (signed int)(tl_y + br_y) / 2; | |
221 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); | |
222 pCenterX = viewparams->sViewCenterX; | |
223 pCenterY = viewparams->sViewCenterY; | |
224 if (viewparams->uMapBookMapZoom != 384) | |
225 { | |
226 if (viewparams->uMapBookMapZoom == 768) | |
227 { | |
228 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
229 viewparams->uMapBookMapZoom = 680; | |
230 } | |
231 } | |
232 else | |
233 { | |
234 viewparams->sViewCenterX = viewparams->indoor_center_x; | |
235 pCenterX = viewparams->indoor_center_x; | |
236 pCenterY = viewparams->indoor_center_y; | |
237 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
238 viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34; | |
239 } | |
240 if (uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
241 { | |
242 screenWidth = br_x - tl_x + 1; | |
243 screenHeight = br_y - tl_y + 1; | |
244 //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; | |
245 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; | |
246 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; | |
247 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; | |
248 | |
249 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); | |
250 | |
251 teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; | |
252 | |
253 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; | |
254 stepY_r = (int)(signed __int64)((double)(-pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; | |
255 black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30); | |
256 | |
257 scaled_posY = stepY_r >> 16; | |
258 //nearest neiborhood scaling | |
259 if (texture8_data) | |
260 { | |
261 for (uint i = 0; i < screenHeight; ++i) | |
262 { | |
263 curr_line = &texture8_data[scaled_posY*textr_width]; | |
264 stepX_r = teal; | |
265 for (uint j = 0; j < screenWidth; ++j) | |
266 { | |
267 scaled_posX = stepX_r >> 16; | |
268 //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; | |
269 pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line + scaled_posX)]); | |
270 stepX_r += scale_increment; | |
271 } | |
272 stepY_r += scale_increment; | |
273 scaled_posY = stepY_r >> 16; | |
274 } | |
275 } | |
276 | |
277 /*//move visible square to render | |
278 for( uint i = 0; i < screenHeight; ++i ) | |
279 { | |
280 if ( screenWidth > 0 ) | |
281 memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); | |
282 }*/ | |
283 } | |
284 else | |
285 { | |
286 black = Color16(0, 0, 0); | |
287 teal = Color16(0, 0xFF, 0xFF); | |
288 uNumBlueFacesInBLVMinimap = 0; | |
289 if (pIndoor->pMapOutlines->uNumOutlines) | |
290 { | |
291 for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) | |
292 { | |
293 if (!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible() | |
294 || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible()))) | |
295 { | |
296 if (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)) | |
297 { | |
298 if (!(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7) | |
299 && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7))) | |
300 { | |
301 pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1; | |
302 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); | |
303 } | |
304 } | |
305 if ((!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) | |
306 && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7) | |
307 && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7))) | |
308 || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) | |
309 { | |
310 v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX); | |
311 screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; | |
312 v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; | |
313 v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; | |
314 | |
315 v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom); | |
316 v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom); | |
317 v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)); | |
318 screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom); | |
319 pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, | |
320 screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black); | |
321 } | |
322 } | |
323 } | |
324 } | |
325 if ((signed int)uNumBlueFacesInBLVMinimap > 0) | |
326 { | |
327 for (uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j) | |
328 { | |
329 v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x; | |
330 v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX); | |
331 v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY; | |
332 v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY; | |
333 | |
334 v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom); | |
335 v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom); | |
336 uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom); | |
337 v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom); | |
338 pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)), | |
339 screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal); | |
340 } | |
341 viewparams->sViewCenterX = pCenterX; | |
342 } | |
343 } | |
344 v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3; | |
345 v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom)); | |
346 v48 = 1; | |
347 v49 = screenCenterY - (int)v97 - 3; | |
348 if (v47 >= (signed int)tl_x) | |
349 { | |
350 if (v47 > (signed int)br_x) | |
351 { | |
352 if ((signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x) | |
353 v48 = 0; | |
354 v47 = br_x; | |
355 } | |
356 } | |
357 else | |
358 { | |
359 if ((signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x) | |
360 v48 = 0; | |
361 v47 = tl_x; | |
362 } | |
363 if (v49 >= (signed int)tl_y) | |
364 { | |
365 if (v49 > br_y) | |
366 { | |
367 if (screenCenterY - (signed int)v97 - 6 > br_y) | |
368 v48 = 0; | |
369 v49 = br_y; | |
370 } | |
371 } | |
372 else | |
373 { | |
374 if (screenCenterY - (signed int)v97 < (signed int)tl_y) | |
375 v48 = 0; | |
376 v49 = tl_y; | |
377 } | |
378 if (v48 == 1) | |
379 { | |
380 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; | |
381 if ((signed int)v51 <= 1920) | |
382 v50 = 6; | |
383 if ((signed int)v51 < 1664) | |
384 v50 = 5; | |
385 if ((signed int)v51 <= 1408) | |
386 v50 = 4; | |
387 if ((signed int)v51 < 1152) | |
388 v50 = 3; | |
389 if ((signed int)v51 <= 896) | |
390 v50 = 2; | |
391 if ((signed int)v51 < 640) | |
392 v50 = 1; | |
393 if ((signed int)v51 <= 384) | |
394 v50 = 0; | |
395 if ((signed int)v51 < 128 || (signed int)v51 > 1920) | |
396 v50 = 7; | |
397 pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); | |
398 } | |
399 if ((signed int)uNumLevelDecorations > 0) | |
400 { | |
401 for (uint i = 0; i < (signed int)uNumLevelDecorations; ++i) | |
402 { | |
403 if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP) | |
404 { | |
405 screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; | |
406 v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); | |
407 v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X; | |
408 v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom)); | |
409 v55 = screenCenterY - (int)v97; | |
410 //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z | |
411 // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) | |
412 { | |
413 if (viewparams->uMapBookMapZoom > 512) | |
414 { | |
415 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); | |
416 pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); | |
417 pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); | |
418 } | |
419 else | |
420 pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, | |
421 (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X, | |
422 screenCenterY - (int)v97, Color16(0xFF, 0xFF, 0xFF)); | |
423 } | |
424 } | |
425 } | |
426 } | |
427 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
428 { | |
429 screenCenterY = br_x - tl_x + 1; | |
430 v95 = br_y - tl_y + 1; | |
431 //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; | |
432 black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; | |
433 v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); | |
434 v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16; | |
435 teal = v60 >> 16; | |
436 pPalette_16 = (unsigned __int16 *)(v60 >> 16); | |
437 v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16); | |
438 v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16; | |
439 v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)); | |
440 | |
441 | |
442 for (int y = 0; y < (signed int)v95; ++y) | |
443 { | |
444 map_tile_Y = (v63 - 80) / 4; | |
445 v64 = teal; | |
446 for (int x = 0; x < screenCenterY; ++x) | |
447 { | |
448 map_tile_X = (v64 - 80) / 4; | |
449 if (!pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y)) | |
450 { | |
451 if (pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y)) | |
452 { | |
453 if (!((x + screenCenter_X) % 2)) | |
454 //*a4a = Color16(12, 12, 12); | |
455 pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12)); | |
456 } | |
457 else | |
458 //*a4a = 0; | |
459 pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0)); | |
460 } | |
461 v97 = (char *)v97 + black; | |
462 v64 = (signed int)v97 >> 16; | |
463 } | |
464 | |
465 v62 += black; | |
466 v97 = (const void *)v60; | |
467 v63 = v62 >> 16; | |
468 teal = (unsigned int)pPalette_16; | |
469 } | |
470 /*a4a = map_texture_16; | |
471 for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X ) | |
472 { | |
473 if ( screenCenterY > 0 ) | |
474 { | |
475 map_tile_Y = (v63 - 80) / 4; | |
476 v64 = teal; | |
477 for ( a5a = 0; a5a < screenCenterY; ++a5a ) | |
478 { | |
479 map_tile_X = (v64 - 80) / 4; | |
480 if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) ) | |
481 { | |
482 if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) ) | |
483 { | |
484 if ( !((a5a + screenCenter_X) % 2) ) | |
485 *a4a = Color16(0xCu, 0xCu, 0xCu); | |
486 } | |
487 else | |
488 *a4a = 0; | |
489 } | |
490 ++a4a; | |
491 v97 = (char *)v97 + black; | |
492 v64 = (signed int)v97 >> 16; | |
493 } | |
494 } | |
495 v62 += black; | |
496 v97 = (const void *)v60; | |
497 a4a += screenCenterY - a5a; | |
498 v63 = v62 >> 16; | |
499 teal = (unsigned int)pPalette_16; | |
500 } | |
501 | |
502 v66 = map_texture_16; | |
503 if ( (signed int)v95 > 0 ) | |
504 { | |
505 v67 = v77; | |
506 result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY); | |
507 for ( v65 = v95; v65; --v65 ) | |
508 { | |
509 if ( screenCenterY > 0 ) | |
510 { | |
511 for ( v68 = screenCenterY; v68; --v68 ) | |
512 { | |
513 v69 = *(short *)v66; | |
514 if ( !*(short *)v66 || v69 == (short)result ) | |
515 *v67 = v69; | |
516 ++v66; | |
517 ++v67; | |
518 } | |
519 } | |
520 v67 = (unsigned __int16 *)((char *)v67 + result); | |
521 } | |
522 }*/ | |
523 } | |
524 } | |
525 | |
526 //----- (00444564) -------------------------------------------------------- | |
527 const char * GetMapBookHintText() | |
528 { | |
529 int v20; | |
530 int v21; // [sp+14h] [bp-Ch]@1 | |
531 double v0; // st7@3 | |
532 unsigned int pX; // [sp+1Ch] [bp-4h]@3 | |
533 unsigned int pY; // [sp+8h] [bp-18h]@3 | |
534 int global_coord_X; // ebx@3 | |
535 int global_coord_Y; | |
536 int map_tile_X; // edi@3 | |
537 int map_tile_Y; // eax@3 | |
538 const char *result; // eax@15 | |
539 | |
540 v20 = viewparams->sViewCenterX; | |
541 v21 = viewparams->sViewCenterY; | |
542 if (viewparams->uMapBookMapZoom == 384) | |
543 { | |
544 v20 = viewparams->indoor_center_x; | |
545 v21 = viewparams->indoor_center_y; | |
546 } | |
547 pMouse->GetClickPos(&pX, &pY); | |
548 v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789); | |
549 | |
550 global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20); | |
551 global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0); | |
552 | |
553 result = 0; | |
554 map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме) | |
555 map_tile_Y = abs(global_coord_Y - 22528) / 512; | |
556 if (pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0) | |
557 { | |
558 for (int i = 0; i < pOutdoor->uNumBModels && !result; i++) | |
559 { | |
560 if (int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X), | |
561 abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius) | |
562 { | |
563 if (pOutdoor->pBModels[i].uNumFaces > 0) | |
564 { | |
565 for (int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) | |
566 { | |
567 if (pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) | |
568 { | |
569 if (!(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT)) | |
570 { | |
571 if (GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID)) | |
572 { | |
573 if (_stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "")) | |
574 result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID); | |
575 } | |
576 } | |
577 } | |
578 } | |
579 } | |
580 } | |
581 } | |
582 } | |
583 return result; | |
584 } |