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