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