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