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