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