comparison GUI/UI/Books/UIMapBook.cpp @ 2501:0ff6a9e9bf7f

GUI folger
author Ritor1
date Fri, 19 Sep 2014 04:21:12 +0600
parents
children a77c34acdbc9
comparison
equal deleted inserted replaced
2500:952025b157aa 2501:0ff6a9e9bf7f
1 #define _CRT_SECURE_NO_WARNINGS
2 #include "UIMapBook.h"
3 #include "..\..\..\Engine/Events.h"
4 #include "..\..\..\Engine/MM7.h"
5 #include "..\..\..\Engine/Graphics/Render.h"
6 #include "..\..\..\Mouse.h"
7 #include "..\UIBooks.h"
8 #include "..\..\..\Engine/MapInfo.h"
9 #include "..\..\..\GUIWindow.h"
10 #include "..\..\..\GUIFont.h"
11 #include "..\..\..\Engine/Party.h"
12 #include "..\..\..\AudioPlayer.h"
13 #include "..\..\..\Engine/Graphics/Outdoor.h"
14 #include "..\..\..\Engine/LOD.h"
15 #include "..\..\..\Engine/Graphics/Viewport.h"
16 #include "..\..\..\Engine/OurMath.h"
17 #include "..\..\..\Engine/texts.h"
18 #include "..\..\..\Engine/Graphics/Level/Decoration.h"
19 //
20 #include "..\..\..\Engine/mm7_data.h"
21
22
23
24 std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390, 19}};
25 std::array<__int16, 6> pTownPortalBook_ys = {{206, 84, 182, 239, 17, 283}};
26
27 std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281, 61, 281, 171}}; // 004E249C
28 std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84, 84, 228, 228, 155}};
29 std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}};
30 std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}};
31
32
33
34
35 //----- (00411150) --------------------------------------------------------
36 void BookUI_DrawTownPortalMap()
37 {
38 int v3; // edi@17
39 GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1
40 POINT a2; // [sp+68h] [bp-8h]@17
41
42 pRenderer->ClearZBuffer(0, 479);
43 pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook);
44 pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
45
46 TownPortalWindow.uFrameX = game_viewport_x;
47 TownPortalWindow.uFrameY = game_viewport_y;
48 TownPortalWindow.uFrameWidth = game_viewport_width;
49 TownPortalWindow.uFrameHeight = game_viewport_height;
50 TownPortalWindow.uFrameZ = game_viewport_z;
51 TownPortalWindow.uFrameW = game_viewport_w;
52
53 const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
54 PARTY_QUEST_FOUNTAIN_PIERPONT,
55 PARTY_QUEST_FOUNTAIN_NIGHON,
56 PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
57 PARTY_QUEST_FOUNTAIN_CELESTIA,
58 PARTY_QUEST_FOUNTAIN_THE_PIT};
59 for (uint i = 0; i < 6; ++i)
60 {
61
62 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
63 pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i],
64 pTownPortalBook_ys[i],
65 pTexture_TownPortalIcons[i], i + 1);
66 }
67
68 pMouse->GetCursorPos(&a2);
69 v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
70
71 if (v3)
72 {
73 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
74 pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
75 }
76 TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3);
77 }
78
79 //----- (00410DEC) --------------------------------------------------------
80 unsigned int DrawLloydBeaconsScreen()
81 {
82 Player *pPlayer; // esi@1
83 const char *pText; // eax@1
84 int pTextHeight; // eax@14
85 int RemainingTime; // kr08_8@14
86 unsigned int pHours; // esi@14
87 unsigned int pDays; // eax@14
88 const char *pSelectionText; // eax@19
89 Texture *v19; // [sp-4h] [bp-8Ch]@4
90 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
91 char *Str; // [sp+74h] [bp-14h]@14
92 int BeaconID; // [sp+78h] [bp-10h]@11
93 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
94
95 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
96 pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
97 pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon
98 pWindow.uFrameX = game_viewport_x;
99 pWindow.uFrameY = game_viewport_y;
100 pWindow.uFrameWidth = 428;
101 pWindow.uFrameHeight = game_viewport_height;
102 pWindow.uFrameZ = 435;
103 pWindow.uFrameW = game_viewport_w;
104 if ( !bRecallingBeacon )
105 pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon
106 sprintf(pTmpBuf.data(), "%s", pText);
107 pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3);
108 if ( bRecallingBeacon )
109 {
110 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on);
111 v19 = pTex_book_button1_off;
112 }
113 else
114 {
115 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off);
116 v19 = pTex_book_button1_on;
117 }
118 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
119 uNumMaxBeacons = 1;
120 if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 )
121 {
122 uNumMaxBeacons = 5;
123 }
124 else
125 {
126 if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 )
127 uNumMaxBeacons = 3;
128 }
129 if ( uNumMaxBeacons > 0 )
130 {
131 for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ )
132 {
133 pWindow.uFrameWidth = 92;
134 pWindow.uFrameHeight = 68;
135 pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID];
136 pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID];
137 pWindow.uFrameW = pWindow.uFrameY + 67;
138 pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91;
139 //if ( pSavegameThumbnails[BeaconID].pPixels != 0 )
140 if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 )
141 {
142 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
143 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]);
144 Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName;
145 pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
146 pWindow.uFrameY += -6 - pTextHeight;
147 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3);
148 RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed;
149 pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60;
150 pDays = pHours / 24;
151 if ( pDays )
152 {
153 sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days
154 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
155 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
156 continue;
157 }
158 else
159 {
160 if ( pHours + 1 <= 23 )
161 {
162 if ( pHours < 1 )
163 pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour
164 else
165 pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours
166 sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText);
167 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
168 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
169 continue;
170 }
171 }
172 sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day
173 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
174 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
175 continue;
176 }
177 if ( !bRecallingBeacon )
178 {
179 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
180 pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
181 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно
182 }
183 }
184 }
185 if ( byte_506360 )
186 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
187 return BeaconID;
188 }
189
190 //----- (00413980) --------------------------------------------------------
191 void BookUI_Map_Draw()
192 {
193 unsigned int map_id; // eax@35
194 char party_coord[120]; // [sp+Ch] [bp-CCh]@37
195 GUIWindow map_window; // [sp+84h] [bp-54h]@35
196
197 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
198 if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1
199 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
200 else
201 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
202
203 if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2
204 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
205 else
206 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
207
208 if ( Book_PageBtn3_flag )//Button 3
209 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off);
210 else
211 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
212
213 if ( Book_PageBtn4_flag )//Button 4
214 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off);
215 else
216 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
217
218 if ( Book_PageBtn5_flag )//Button 5
219 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off);
220 else
221 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
222
223 if ( Book_PageBtn6_flag )//Button 6
224 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off);
225 else
226 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
227
228 if ( BtnDown_flag )
229 viewparams->CenterOnParty2();
230 if ( BtnUp_flag )
231 viewparams->CenterOnParty();
232 if ( Book_PageBtn3_flag )
233 viewparams->_443219();
234 if ( Book_PageBtn4_flag )
235 viewparams->_443231();
236 if ( Book_PageBtn5_flag )
237 viewparams->_44323D();
238 if ( Book_PageBtn6_flag )
239 viewparams->_443225();
240
241 if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag )
242 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
243 BtnUp_flag = 0;
244 BtnDown_flag = 0;
245 Book_PageBtn6_flag = 0;
246 Book_PageBtn5_flag = 0;
247 Book_PageBtn4_flag = 0;
248 Book_PageBtn3_flag = 0;
249 DrawBook_Map_sub(97, 49, 361, 313, 0);
250 pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr);
251 map_window.uFrameWidth = game_viewport_width;
252 map_window.uFrameHeight = game_viewport_height;
253 map_window.uFrameX = game_viewport_x;
254 map_window.uFrameY = game_viewport_y;
255 map_window.uFrameZ = game_viewport_z;
256 map_window.uFrameW = game_viewport_w;
257 map_id = pMapStats->GetMapInfo(pCurrentMapName);
258 if ( map_id )
259 map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
260
261 map_window.uFrameX = 0;
262 sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d"
263 map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0);
264 }
265
266 //----- (00442955) --------------------------------------------------------
267 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
268 {
269 int v20; // eax@16
270 int v26; // ecx@21
271 unsigned __int16 *v27; // edi@21
272 int v28; // edx@21
273 int v29; // eax@21
274 double v30; // st7@23
275 // signed __int64 v31; // qax@23
276 // unsigned short *v32; // edx@23
277 int textr_width; // esi@23
278 // signed int v34; // eax@23
279 // signed int v35; // ecx@23
280 // int v36; // esi@27
281 // int v37; // ecx@27
282 // int v38; // edx@31
283 // unsigned int v39; // eax@33
284 // short *v40; // esi@33
285 // short *v41; // edi@33
286 // unsigned __int8 v42; // cf@33
287 // unsigned int v43; // ecx@33
288 // short *v44; // edi@33
289 // short *v45; // esi@33
290 // int v46; // ecx@33
291 signed int v47; // esi@38
292 signed int v48; // ecx@38
293 int v49; // eax@38
294 signed int v50; // edx@55
295 unsigned int v51; // ecx@55
296 // int result; // eax@72
297 int v54; // esi@75
298 int v55; // eax@75
299 // __int16 v56; // si@85
300 double v57; // st7@85
301 // int v58; // ebx@85
302 // signed __int64 v59; // qax@85
303 signed int v60; // edi@85
304 // signed __int64 v61; // qax@85
305 signed int v62; // ebx@85
306 signed int v63; // esi@85
307 int v64; // eax@87
308 // unsigned int v65; // ebx@95
309 // unsigned short *v66; // edx@95
310 // unsigned __int16 *v67; // esi@96
311 // int v68; // edi@98
312 // unsigned __int16 v69; // cx@99
313 // signed int v73; // [sp-4h] [bp-48068h]@59
314 // unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
315 //unsigned short map_texture_16[320 * 460 + 256]; // [sp+Ch] [bp-48058h]@23
316 // int v76; // [sp+4800Ch] [bp-58h]@23
317 //unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
318 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
319 int map_tile_X; // [sp+48020h] [bp-44h]@23
320 //unsigned __int16* render16_data;
321 unsigned char* texture8_data;
322 unsigned char* curr_line;
323 int scale_increment;
324 int scaled_posX;
325 int scaled_posY;
326 int stepX_r;
327 int stepY_r;
328 unsigned int teal; // [sp+48028h] [bp-3Ch]@8
329 int pCenterY; // [sp+4802Ch] [bp-38h]@1
330 int screenCenter_X; // [sp+48030h] [bp-34h]@1
331 int pCenterX; // [sp+48034h] [bp-30h]@1
332 int v87; // [sp+48038h] [bp-2Ch]@16
333 unsigned int v88; // [sp+4803Ch] [bp-28h]@16
334 int black; // [sp+48040h] [bp-24h]@8
335 int screenCenterY; // [sp+48044h] [bp-20h]@1
336 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
337 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
338 signed int screenWidth; // [sp+48054h] [bp-10h]@8
339 unsigned int v95; // [sp+48058h] [bp-Ch]@16
340 int map_tile_Y; // [sp+4805Ch] [bp-8h]@10
341 const void *v97; // [sp+48060h] [bp-4h]@16
342 // unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
343 //int a5a; // [sp+48070h] [bp+Ch]@86
344
345 screenCenter_X = (signed int)(tl_x + br_x) / 2;
346 screenCenterY = (signed int)(tl_y + br_y) / 2;
347 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
348 pCenterX = viewparams->sViewCenterX;
349 pCenterY = viewparams->sViewCenterY;
350 if ( viewparams->uMapBookMapZoom != 384 )
351 {
352 if ( viewparams->uMapBookMapZoom == 768 )
353 {
354 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
355 viewparams->uMapBookMapZoom = 680;
356 }
357 }
358 else
359 {
360 viewparams->sViewCenterX = viewparams->indoor_center_x;
361 pCenterX = viewparams->indoor_center_x;
362 pCenterY = viewparams->indoor_center_y;
363 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
364 viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34;
365 }
366 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
367 {
368 screenWidth = br_x - tl_x + 1;
369 screenHeight = br_y - tl_y + 1;
370 //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
371 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
372 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
373 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
374
375 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
376
377 teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
378
379 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
380 stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16;
381 black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30);
382
383 scaled_posY = stepY_r >> 16;
384 //nearest neiborhood scaling
385 if ( texture8_data)
386 {
387 for( uint i = 0; i < screenHeight; ++i )
388 {
389 curr_line = &texture8_data[scaled_posY*textr_width];
390 stepX_r = teal;
391 for( uint j = 0; j < screenWidth; ++j )
392 {
393 scaled_posX = stepX_r>>16;
394 //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
395 pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]);
396 stepX_r += scale_increment;
397 }
398 stepY_r+=scale_increment;
399 scaled_posY=stepY_r>>16;
400 }
401 }
402
403 /*//move visible square to render
404 for( uint i = 0; i < screenHeight; ++i )
405 {
406 if ( screenWidth > 0 )
407 memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
408 }*/
409 }
410 else
411 {
412 black = Color16(0, 0, 0);
413 teal = Color16(0, 0xFFu, 0xFFu);
414 uNumBlueFacesInBLVMinimap = 0;
415 if ( pIndoor->pMapOutlines->uNumOutlines )
416 {
417 for ( uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i )
418 {
419 if ( !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible()
420 || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible()) ))
421 {
422 if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) )
423 {
424 if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4)
425 && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) ))
426 {
427 pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1;
428 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
429 }
430 }
431 if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
432 && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4)
433 && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) ))
434 || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
435 {
436 v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX);
437 screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY;
438 v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY;
439 v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX;
440
441 v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom);
442 v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom);
443 v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom));
444 screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom);
445 pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87,
446 screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black);
447 }
448 }
449 }
450 }
451 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
452 {
453 for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j )
454 {
455 v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x;
456 v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX);
457 v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY;
458 v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY;
459
460 v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom);
461 v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom);
462 uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom);
463 v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom);
464 pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)),
465 screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal);
466 }
467 viewparams->sViewCenterX = pCenterX;
468 }
469 }
470 v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3;
471 v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom));
472 v48 = 1;
473 v49 = screenCenterY - (int)v97 - 3;
474 if ( v47 >= (signed int)tl_x )
475 {
476 if ( v47 > (signed int)br_x )
477 {
478 if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x )
479 v48 = 0;
480 v47 = br_x;
481 }
482 }
483 else
484 {
485 if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x )
486 v48 = 0;
487 v47 = tl_x;
488 }
489 if ( v49 >= (signed int)tl_y )
490 {
491 if ( v49 > br_y )
492 {
493 if ( screenCenterY - (signed int)v97 - 6 > br_y )
494 v48 = 0;
495 v49 = br_y;
496 }
497 }
498 else
499 {
500 if ( screenCenterY - (signed int)v97 < (signed int)tl_y )
501 v48 = 0;
502 v49 = tl_y;
503 }
504 if ( v48 == 1 )
505 {
506 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
507 if ( (signed int)v51 <= 1920 )
508 v50 = 6;
509 if ( (signed int)v51 < 1664 )
510 v50 = 5;
511 if ( (signed int)v51 <= 1408 )
512 v50 = 4;
513 if ( (signed int)v51 < 1152 )
514 v50 = 3;
515 if ( (signed int)v51 <= 896 )
516 v50 = 2;
517 if ( (signed int)v51 < 640 )
518 v50 = 1;
519 if ( (signed int)v51 <= 384 )
520 v50 = 0;
521 if ( (signed int)v51 < 128 || (signed int)v51 > 1920 )
522 v50 = 7;
523 pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
524 }
525 if ( (signed int)uNumLevelDecorations > 0 )
526 {
527 for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )
528 {
529 if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP)
530 {
531 screenHeight = pLevelDecorations[i].vPosition.y - pCenterY;
532 v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
533 v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X;
534 v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom));
535 v55 = screenCenterY - (int)v97;
536 //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z
537 // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
538 {
539 if ( viewparams->uMapBookMapZoom > 512 )
540 {
541 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
542 pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
543 pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
544 }
545 else
546 pRenderer->RasterLine2D(v54, screenCenterY - (int)v97,
547 (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X,
548 screenCenterY - (int)v97, Color16(0xFFu, 0xFFu, 0xFFu));
549 }
550 }
551 }
552 }
553 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
554 {
555 screenCenterY = br_x - tl_x + 1;
556 v95 = br_y - tl_y + 1;
557 //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
558 black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
559 v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
560 v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16;
561 teal = v60 >> 16;
562 pPalette_16 = (unsigned __int16 *)(v60 >> 16);
563 v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16);
564 v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16;
565 v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57));
566
567
568 for (int y = 0; y < (signed int)v95; ++y)
569 {
570 map_tile_Y = (v63 - 80) / 4;
571 v64 = teal;
572 for (int x = 0; x < screenCenterY; ++x)
573 {
574 map_tile_X = (v64 - 80) / 4;
575 if ( !pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) )
576 {
577 if ( pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y) )
578 {
579 if ( !((x + screenCenter_X) % 2) )
580 //*a4a = Color16(12, 12, 12);
581 pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12));
582 }
583 else
584 //*a4a = 0;
585 pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0));
586 }
587 v97 = (char *)v97 + black;
588 v64 = (signed int)v97 >> 16;
589 }
590
591 v62 += black;
592 v97 = (const void *)v60;
593 v63 = v62 >> 16;
594 teal = (unsigned int)pPalette_16;
595 }
596 /*a4a = map_texture_16;
597 for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X )
598 {
599 if ( screenCenterY > 0 )
600 {
601 map_tile_Y = (v63 - 80) / 4;
602 v64 = teal;
603 for ( a5a = 0; a5a < screenCenterY; ++a5a )
604 {
605 map_tile_X = (v64 - 80) / 4;
606 if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) )
607 {
608 if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
609 {
610 if ( !((a5a + screenCenter_X) % 2) )
611 *a4a = Color16(0xCu, 0xCu, 0xCu);
612 }
613 else
614 *a4a = 0;
615 }
616 ++a4a;
617 v97 = (char *)v97 + black;
618 v64 = (signed int)v97 >> 16;
619 }
620 }
621 v62 += black;
622 v97 = (const void *)v60;
623 a4a += screenCenterY - a5a;
624 v63 = v62 >> 16;
625 teal = (unsigned int)pPalette_16;
626 }
627
628 v66 = map_texture_16;
629 if ( (signed int)v95 > 0 )
630 {
631 v67 = v77;
632 result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY);
633 for ( v65 = v95; v65; --v65 )
634 {
635 if ( screenCenterY > 0 )
636 {
637 for ( v68 = screenCenterY; v68; --v68 )
638 {
639 v69 = *(short *)v66;
640 if ( !*(short *)v66 || v69 == (short)result )
641 *v67 = v69;
642 ++v66;
643 ++v67;
644 }
645 }
646 v67 = (unsigned __int16 *)((char *)v67 + result);
647 }
648 }*/
649 }
650 }
651
652 //----- (00444564) --------------------------------------------------------
653 const char * GetMapBookHintText()
654 {
655 int v20;
656 int v21; // [sp+14h] [bp-Ch]@1
657 double v0; // st7@3
658 unsigned int pX; // [sp+1Ch] [bp-4h]@3
659 unsigned int pY; // [sp+8h] [bp-18h]@3
660 int global_coord_X; // ebx@3
661 int global_coord_Y;
662 int map_tile_X; // edi@3
663 int map_tile_Y; // eax@3
664 const char *result; // eax@15
665
666 v20 = viewparams->sViewCenterX;
667 v21 = viewparams->sViewCenterY;
668 if ( viewparams->uMapBookMapZoom == 384 )
669 {
670 v20 = viewparams->indoor_center_x;
671 v21 = viewparams->indoor_center_y;
672 }
673 pMouse->GetClickPos(&pX, &pY);
674 v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789);
675
676 global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
677 global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0);
678
679 result = 0;
680 map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме)
681 map_tile_Y = abs(global_coord_Y - 22528) / 512;
682 if ( pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 )
683 {
684 for(int i = 0; i < pOutdoor->uNumBModels && !result; i++)
685 {
686 if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X),
687 abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius )
688 {
689 if ( pOutdoor->pBModels[i].uNumFaces > 0 )
690 {
691 for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ )
692 {
693 if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID )
694 {
695 if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT) )
696 {
697 if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) )
698 {
699 if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") )
700 result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID);
701 }
702 }
703 }
704 }
705 }
706 }
707 }
708 }
709 return result;
710 }