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