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
|
|
212 //----- (00413980) --------------------------------------------------------
|
|
213 void BookUI_Map_Draw()
|
|
214 {
|
|
215 int v6; // eax@31
|
|
216 unsigned int map_id; // eax@35
|
|
217 Texture *buttnTxtr; // [sp-4h] [bp-DCh]@3
|
|
218 char party_coord[120]; // [sp+Ch] [bp-CCh]@37
|
|
219 GUIWindow map_window; // [sp+84h] [bp-54h]@35
|
|
220 unsigned int textrX, textrY;
|
|
221
|
|
222 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
|
|
223 if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )
|
|
224 {
|
|
225 buttnTxtr = pTex_tab_an_6a__zoom_off;
|
|
226 textrY = pViewport->uViewportTL_Y + 2;
|
|
227 textrX = pViewport->uViewportTL_X + 408;
|
|
228 }
|
|
229 else
|
|
230 {
|
|
231 buttnTxtr = pTex_tab_an_6b__zoom_on;
|
|
232 textrY = pViewport->uViewportTL_Y + 1;
|
|
233 textrX = pViewport->uViewportTL_X + 398;
|
|
234 }
|
|
235 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
236 if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )
|
|
237 {
|
|
238 buttnTxtr = pTex_tab_an_7a__zoot_off;
|
|
239 textrY = pViewport->uViewportTL_Y + 38;
|
|
240 textrX = pViewport->uViewportTL_X + 408;
|
|
241 }
|
|
242 else
|
|
243 {
|
|
244 buttnTxtr = pTex_tab_an_7b__zoot_on;
|
|
245 textrY = pViewport->uViewportTL_Y + 38;
|
|
246 textrX = pViewport->uViewportTL_X + 398;
|
|
247 }
|
|
248 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
249 if ( Book_PageBtn3_flag )
|
|
250 {
|
|
251 buttnTxtr = pTexture_506390;
|
|
252 textrY = pViewport->uViewportTL_Y + 113;
|
|
253 textrX = pViewport->uViewportTL_X + 408;
|
|
254 }
|
|
255 else
|
|
256 {
|
|
257 buttnTxtr = pTexture_506394;
|
|
258 textrY = pViewport->uViewportTL_Y + 113;
|
|
259 textrX = pViewport->uViewportTL_X + 398;
|
|
260 }
|
|
261 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
262 if ( Book_PageBtn4_flag )
|
|
263 {
|
|
264 buttnTxtr = pTexture_506388;
|
|
265 textrY = pViewport->uViewportTL_X + 150;
|
|
266 textrX = pViewport->uViewportTL_Y + 408;
|
|
267 }
|
|
268 else
|
|
269 {
|
|
270 buttnTxtr = pTexture_50638C;
|
|
271 textrY = pViewport->uViewportTL_X + 150;
|
|
272 textrX = pViewport->uViewportTL_Y + 399;
|
|
273 }
|
|
274 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
275 if ( Book_PageBtn5_flag )
|
|
276 {
|
|
277 buttnTxtr = pTexture_506380;
|
|
278 textrY = pViewport->uViewportTL_Y + 188;
|
|
279 textrX = pViewport->uViewportTL_X + 408;
|
|
280 }
|
|
281 else
|
|
282 {
|
|
283 buttnTxtr = pTexture_506384;
|
|
284 textrY = pViewport->uViewportTL_Y + 188;
|
|
285 textrX = pViewport->uViewportTL_X + 397;
|
|
286 }
|
|
287 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
288 if ( Book_PageBtn6_flag )
|
|
289 {
|
|
290 buttnTxtr = pTexture_506378;
|
|
291 textrY = pViewport->uViewportTL_Y + 226;
|
|
292 textrX = pViewport->uViewportTL_X + 408;
|
|
293 }
|
|
294 else
|
|
295 {
|
|
296 buttnTxtr = pTexture_50637C;
|
|
297 textrY = pViewport->uViewportTL_Y + 226;
|
|
298 textrX = pViewport->uViewportTL_X + 397;
|
|
299 }
|
|
300 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
301 if ( BtnDown_flag )
|
|
302 viewparams->CenterOnParty2();
|
|
303 if ( BtnUp_flag )
|
|
304 viewparams->CenterOnParty();
|
|
305 if ( Book_PageBtn3_flag )
|
|
306 viewparams->_443219();
|
|
307 if ( Book_PageBtn4_flag )
|
|
308 viewparams->_443231();
|
|
309 if ( Book_PageBtn5_flag )
|
|
310 viewparams->_44323D();
|
|
311 if ( Book_PageBtn6_flag )
|
|
312 viewparams->_443225();
|
|
313
|
|
314 if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag )
|
|
315 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
316 BtnUp_flag = 0;
|
|
317 BtnDown_flag = 0;
|
|
318 Book_PageBtn6_flag = 0;
|
|
319 Book_PageBtn5_flag = 0;
|
|
320 Book_PageBtn4_flag = 0;
|
|
321 Book_PageBtn3_flag = 0;
|
|
322 DrawBook_Map_sub(97, 49, 361, 313, 0);
|
|
323 pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr);
|
|
324 map_window.uFrameWidth = game_viewport_width;
|
|
325 map_window.uFrameHeight = game_viewport_height;
|
|
326 map_window.uFrameX = game_viewport_x;
|
|
327 map_window.uFrameY = game_viewport_y;
|
|
328 map_window.uFrameZ = game_viewport_z;
|
|
329 map_window.uFrameW = game_viewport_w;
|
|
330 map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
|
|
331 if ( map_id )
|
|
332 map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
|
|
333
|
|
334 map_window.uFrameX = 0;
|
|
335 sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d"
|
|
336 map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0);
|
|
337 }
|
|
338
|
|
339 //----- (00442955) --------------------------------------------------------
|
|
340 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
|
|
341 {
|
|
342 int v5; // ebx@1
|
|
343 int v6; // edi@1
|
|
344 BLVMapOutlines *v7; // eax@8
|
|
345 unsigned __int8 v8; // zf@8
|
|
346 unsigned __int8 v9; // sf@8
|
|
347 int v10; // esi@10
|
|
348 unsigned int v11; // edx@11
|
|
349 __int16 v12; // cx@12
|
|
350 signed int v13; // eax@15
|
|
351 int v14; // eax@16
|
|
352 Vec3_short_ *v15; // ecx@16
|
|
353 int v16; // edx@16
|
|
354 int v17; // ecx@16
|
|
355 Vec3_short_ *v18; // eax@16
|
|
356 int v19; // ecx@16
|
|
357 int v20; // eax@16
|
|
358 signed int v21; // esi@18
|
|
359 int v22; // ecx@21
|
|
360 BLVMapOutline *v23; // ecx@21
|
|
361 Vec3_short_ *v24; // edx@21
|
|
362 Vec3_short_ *v25; // eax@21
|
|
363 int v26; // ecx@21
|
|
364 unsigned __int16 *v27; // edi@21
|
|
365 int v28; // edx@21
|
|
366 int v29; // eax@21
|
|
367 double v30; // st7@23
|
|
368 signed __int64 v31; // qax@23
|
|
369 unsigned short *v32; // edx@23
|
|
370 int textr_width; // esi@23
|
|
371 signed int v34; // eax@23
|
|
372 signed int v35; // ecx@23
|
|
373 int v36; // esi@27
|
|
374 int v37; // ecx@27
|
|
375 int v38; // edx@31
|
|
376 unsigned int v39; // eax@33
|
|
377 short *v40; // esi@33
|
|
378 short *v41; // edi@33
|
|
379 unsigned __int8 v42; // cf@33
|
|
380 unsigned int v43; // ecx@33
|
|
381 short *v44; // edi@33
|
|
382 short *v45; // esi@33
|
|
383 int v46; // ecx@33
|
|
384 signed int v47; // esi@38
|
|
385 signed int v48; // ecx@38
|
|
386 int v49; // eax@38
|
|
387 signed int v50; // edx@55
|
|
388 unsigned int v51; // ecx@55
|
|
389 int result; // eax@72
|
|
390 int v53; // eax@75
|
|
391 int v54; // esi@75
|
|
392 int v55; // eax@75
|
|
393 __int16 v56; // si@85
|
|
394 double v57; // st7@85
|
|
395 int v58; // ebx@85
|
|
396 signed __int64 v59; // qax@85
|
|
397 signed int v60; // edi@85
|
|
398 signed __int64 v61; // qax@85
|
|
399 signed int v62; // ebx@85
|
|
400 signed int v63; // esi@85
|
|
401 int v64; // eax@87
|
|
402 unsigned int v65; // ebx@95
|
|
403 unsigned short *v66; // edx@95
|
|
404 unsigned __int16 *v67; // esi@96
|
|
405 int v68; // edi@98
|
|
406 unsigned __int16 v69; // cx@99
|
|
407 unsigned int v70; // [sp-10h] [bp-48074h]@80
|
|
408 unsigned int v71; // [sp-Ch] [bp-48070h]@80
|
|
409 unsigned int v72; // [sp-8h] [bp-4806Ch]@80
|
|
410 signed int v73; // [sp-4h] [bp-48068h]@59
|
|
411 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
|
|
412 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23
|
|
413 int v76; // [sp+4800Ch] [bp-58h]@23
|
|
414 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
|
|
415 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
|
|
416 unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1
|
|
417
|
|
418 int v81; // [sp+48020h] [bp-44h]@23
|
|
419 unsigned __int16* render16_data;
|
|
420 unsigned char* texture8_data;
|
|
421 unsigned char* curr_line;
|
|
422 int scale_increment;
|
|
423 int scaled_posX;
|
|
424 int scaled_posY;
|
|
425 int stepX_r;
|
|
426 int stepY_r;
|
|
427
|
|
428
|
|
429 unsigned int teal; // [sp+48028h] [bp-3Ch]@8
|
|
430 int v84; // [sp+4802Ch] [bp-38h]@1
|
|
431 int screenCenter_X; // [sp+48030h] [bp-34h]@1
|
|
432 int v86; // [sp+48034h] [bp-30h]@1
|
|
433 int v87; // [sp+48038h] [bp-2Ch]@16
|
|
434 unsigned int v88; // [sp+4803Ch] [bp-28h]@16
|
|
435 int black; // [sp+48040h] [bp-24h]@8
|
|
436 int screenCenterY; // [sp+48044h] [bp-20h]@1
|
|
437 unsigned int i; // [sp+48048h] [bp-1Ch]@9
|
|
438 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
|
|
439 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
|
|
440 signed int screenWidth; // [sp+48054h] [bp-10h]@8
|
|
441 unsigned int v95; // [sp+48058h] [bp-Ch]@16
|
|
442 int v96; // [sp+4805Ch] [bp-8h]@10
|
|
443 const void *v97; // [sp+48060h] [bp-4h]@16
|
|
444 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
|
|
445 int a5a; // [sp+48070h] [bp+Ch]@86
|
|
446
|
|
447 tl_x = tl_x;
|
|
448 tl_y = tl_y;
|
|
449 screenCenter_X = (signed int)(tl_x + br_x) >> 1;
|
|
450 screenCenterY = (signed int)(tl_y + br_y) >> 1;
|
|
451 surfPitch = pRenderer->uTargetSurfacePitch;
|
|
452 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
|
|
453 v5 = viewparams->field_2C;
|
|
454 v6 = viewparams->sViewCenterX;
|
|
455 v86 = viewparams->sViewCenterX;
|
|
456 v84 = viewparams->sViewCenterY;
|
|
457 if ( viewparams->field_2C != 384 )
|
|
458 {
|
|
459 if ( viewparams->field_2C == 768 )
|
|
460 {
|
|
461 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
462 v5 = 680;
|
|
463 }
|
|
464 }
|
|
465 else
|
|
466 {
|
|
467 v6 = viewparams->indoor_center_x;
|
|
468 v86 = viewparams->indoor_center_x;
|
|
469 v84 = viewparams->indoor_center_y;
|
|
470 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
471 v5 = viewparams->field_2C - 34;
|
|
472 }
|
|
473 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
|
|
474 {
|
|
475 screenWidth = br_x - tl_x + 1;
|
|
476 screenHeight = br_y - tl_y + 1;
|
|
477 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
|
|
478 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
|
|
479 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
|
|
480 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5;
|
|
481
|
|
482 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
|
|
483
|
|
484
|
|
485 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
|
|
486 // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
|
|
487
|
|
488 // v32 = map_texture_16;
|
|
489 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
|
|
490 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16;
|
|
491 // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
|
|
492 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
|
|
493
|
|
494 // v76 = textr_width;
|
|
495 scaled_posY = stepY_r >> 16;
|
|
496 //nearest neiborhood scaling
|
|
497 if ( texture8_data)
|
|
498 {
|
|
499 for(uint i=0; i<screenHeight;++i)
|
|
500 {
|
|
501 curr_line=&texture8_data[scaled_posY*textr_width];
|
|
502 stepX_r=teal;
|
|
503 for(uint j=0; j<screenWidth;++j)
|
|
504 {
|
|
505 scaled_posX=stepX_r>>16;
|
|
506 map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
|
|
507 stepX_r+=scale_increment;
|
|
508 }
|
|
509 stepY_r+=scale_increment;
|
|
510 scaled_posY=stepY_r>>16;
|
|
511 }
|
|
512 }
|
|
513 //move visible square to render
|
|
514 for(uint i=0; i<screenHeight;++i)
|
|
515 {
|
|
516 if ( screenWidth > 0 )
|
|
517 {
|
|
518 memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
|
|
519 }
|
|
520 }
|
|
521 }
|
|
522 else
|
|
523 {
|
|
524 black = TargetColor(0, 0, 0);
|
|
525 teal = TargetColor(0, 0xFFu, 0xFFu);
|
|
526 v7 = pIndoor->pMapOutlines;
|
|
527 uNumBlueFacesInBLVMinimap = 0;
|
|
528 v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
|
|
529 v9 = pIndoor->pMapOutlines->uNumOutlines < 0;
|
|
530 screenWidth = 0;
|
|
531 if ( !(v9 | v8) )
|
|
532 {
|
|
533 i = 0;
|
|
534 do
|
|
535 {
|
|
536 v10 = (int)((char *)v7 + i + 4);
|
|
537 v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes;
|
|
538 if ( !(BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) ))
|
|
539 {
|
|
540 v12 = *(short *)((char *)v7 + i + 14);
|
|
541 if ( !(v12 & 1) )
|
|
542 {
|
|
543 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 ))
|
|
544 {
|
|
545 v96 = (signed int)screenWidth >> 3;
|
|
546 v13 = screenWidth;
|
|
547 *(short *)(v10 + 10) = v12 | 1;
|
|
548 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8);
|
|
549 }
|
|
550 }
|
|
551 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1)
|
|
552 {
|
|
553 v14 = *(short *)v10;
|
|
554 v88 = v5;
|
|
555 v15 = &pIndoor->pVertices[v14];
|
|
556 v16 = v15->x;
|
|
557 v17 = v15->y - v84;
|
|
558 v93 = (unsigned __int16 *)(v16 - v6);
|
|
559 screenHeight = v17;
|
|
560 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)];
|
|
561 v19 = v18->x;
|
|
562 v20 = v18->y - v84;
|
|
563 v95 = v19 - v6;
|
|
564 v97 = (const void *)v20;
|
|
565 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16;
|
|
566 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16;
|
|
567 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16);
|
|
568 screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16;
|
|
569 pRenderer->RasterLine2D(
|
|
570 screenCenter_X + v88,
|
|
571 screenCenterY - v87,
|
|
572 screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16),
|
|
573 screenCenterY - screenHeight,
|
|
574 black);
|
|
575 v7 = pIndoor->pMapOutlines;
|
|
576 }
|
|
577 }
|
|
578 ++screenWidth;
|
|
579 i += 12;
|
|
580 }
|
|
581 while ( screenWidth < (signed int)v7->uNumOutlines );
|
|
582 }
|
|
583 v21 = 0;
|
|
584 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
|
|
585 {
|
|
586 while ( 1 )
|
|
587 {
|
|
588 v22 = pBlueFacesInBLVMinimapIDs[v21];
|
|
589 v87 = v5;
|
|
590 v23 = &v7->pOutlines[v22];
|
|
591 v24 = &pIndoor->pVertices[v23->uVertex1ID];
|
|
592 v25 = &pIndoor->pVertices[v23->uVertex2ID];
|
|
593 v26 = v25->x;
|
|
594 v27 = (unsigned __int16 *)(v24->x - v86);
|
|
595 v28 = v24->y - v84;
|
|
596 v29 = v25->y - v84;
|
|
597 v93 = v27;
|
|
598 screenHeight = v28;
|
|
599 v97 = (const void *)v29;
|
|
600 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16;
|
|
601 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16;
|
|
602 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16;
|
|
603 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16;
|
|
604 pRenderer->RasterLine2D(
|
|
605 screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16),
|
|
606 screenCenterY - v88,
|
|
607 screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16),
|
|
608 screenCenterY - v95,
|
|
609 teal);
|
|
610 ++v21;
|
|
611 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
|
|
612 break;
|
|
613 v7 = pIndoor->pMapOutlines;
|
|
614 }
|
|
615 v6 = v86;
|
|
616 }
|
|
617 }
|
|
618 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3;
|
|
619 v81 = pParty->vPosition.y - v84;
|
|
620 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16);
|
|
621 v48 = 1;
|
|
622 v49 = screenCenterY - (int)v97 - 3;
|
|
623 if ( v47 >= (signed int)tl_x )
|
|
624 {
|
|
625 if ( v47 > (signed int)br_x )
|
|
626 {
|
|
627 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x )
|
|
628 v48 = 0;
|
|
629 v47 = br_x;
|
|
630 }
|
|
631 }
|
|
632 else
|
|
633 {
|
|
634 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x )
|
|
635 v48 = 0;
|
|
636 v47 = tl_x;
|
|
637 }
|
|
638 if ( v49 >= (signed int)tl_y )
|
|
639 {
|
|
640 if ( v49 > br_y )
|
|
641 {
|
|
642 if ( screenCenterY - (signed int)v97 - 6 > br_y )
|
|
643 v48 = 0;
|
|
644 v49 = br_y;
|
|
645 }
|
|
646 }
|
|
647 else
|
|
648 {
|
|
649 if ( screenCenterY - (signed int)v97 < (signed int)tl_y )
|
|
650 v48 = 0;
|
|
651 v49 = tl_y;
|
|
652 }
|
|
653 if ( v48 == 1 )
|
|
654 {
|
|
655 v50 = 0;
|
|
656 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
|
|
657 if ( (signed int)(pParty->sRotationY & stru_5C6E00->uDoublePiMask) >= 128 )
|
|
658 {
|
|
659 if ( (signed int)v51 > 384 )
|
|
660 {
|
|
661 if ( (signed int)v51 >= 640 )
|
|
662 {
|
|
663 if ( (signed int)v51 > 896 )
|
|
664 {
|
|
665 if ( (signed int)v51 >= 1152 )
|
|
666 {
|
|
667 if ( (signed int)v51 > 1408 )
|
|
668 {
|
|
669 if ( (signed int)v51 >= 1664 )
|
|
670 {
|
|
671 if ( (signed int)v51 <= 1920 )
|
|
672 v73 = 7;
|
|
673 }
|
|
674 else
|
|
675 {
|
|
676 v73 = 6;
|
|
677 }
|
|
678 }
|
|
679 else
|
|
680 {
|
|
681 v73 = 5;
|
|
682 }
|
|
683 }
|
|
684 else
|
|
685 {
|
|
686 v73 = 4;
|
|
687 }
|
|
688 }
|
|
689 else
|
|
690 {
|
|
691 v73 = 3;
|
|
692 }
|
|
693 }
|
|
694 else
|
|
695 {
|
|
696 v73 = 2;
|
|
697 }
|
|
698 if( (signed int)v51 <=1920)
|
|
699 v50 = v73;
|
|
700 }
|
|
701 else
|
|
702 v50 = 1;
|
|
703 }
|
|
704 pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
|
|
705 }
|
|
706 result = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
707 v95 = 0;
|
|
708 v86 = result;
|
|
709 if ( (signed int)uNumLevelDecorations > 0 )
|
|
710 {
|
|
711 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition;
|
|
712 do
|
|
713 {
|
|
714 if ( *(char *)(screenWidth - 2) & 8 )
|
|
715 {
|
|
716 v53 = *(int *)(screenWidth + 4) - v84;
|
|
717 v93 = (unsigned __int16 *)(*(int *)screenWidth - v6);
|
|
718 screenHeight = v53;
|
|
719 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
|
|
720 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16);
|
|
721 v55 = screenCenterY - (int)v97;
|
|
722 if ( v54 >= pRenderer->raster_clip_x )
|
|
723 {
|
|
724 if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
|
|
725 {
|
|
726 v74 = v86;
|
|
727 if ( v5 > 512 )
|
|
728 {
|
|
729 v96 = v55 + 1;
|
|
730 black = v55 - 1;
|
|
731 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86);
|
|
732 pRenderer->RasterLine2D(v54, black, v54, v96, v86);
|
|
733 ++v54;
|
|
734 v74 = v86;
|
|
735 v72 = v96;
|
|
736 v71 = v54;
|
|
737 v70 = black;
|
|
738 }
|
|
739 else
|
|
740 {
|
|
741 v72 = screenCenterY - (int)v97;
|
|
742 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
|
|
743 v70 = screenCenterY - (int)v97;
|
|
744 }
|
|
745 pRenderer->RasterLine2D(v54, v70, v71, v72, v74);
|
|
746 }
|
|
747 }
|
|
748 }
|
|
749 ++v95;
|
|
750 result = v95;
|
|
751 screenWidth += 32;
|
|
752 }
|
|
753 while ( (signed int)v95 < (signed int)uNumLevelDecorations );
|
|
754 }
|
|
755 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
756 {
|
|
757 screenCenterY = br_x - tl_x + 1;
|
|
758 v95 = br_y - tl_y + 1;
|
|
759 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
|
|
760 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
|
|
761 black = (1 << (v56 + 16)) / v5;
|
|
762 v57 = (double)(1 << (16 - v56));
|
|
763 v58 = 22528 / (v5 / 384);
|
|
764 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57);
|
|
765 v60 = (int)v59 << 16;
|
|
766 v97 = (const void *)((int)v59 << 16);
|
|
767 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57);
|
|
768 pPalette_16 = (unsigned __int16 *)(v60 >> 16);
|
|
769 v62 = (int)v61 << 16;
|
|
770 teal = v60 >> 16;
|
|
771 v63 = (signed __int16)v61;
|
|
772 a4a = map_texture_16;
|
|
773 result = TargetColor(0xCu, 0xCu, 0xCu);
|
|
774 screenCenter_X = 0;
|
|
775 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X )
|
|
776 {
|
|
777 a5a = 0;
|
|
778 if ( screenCenterY > 0 )
|
|
779 {
|
|
780 v96 = (v63 - 80) / 4;
|
|
781 v64 = teal;
|
|
782 do
|
|
783 {
|
|
784 v81 = (v64 - 80) / 4;
|
|
785 if ( !pOutdoor->_47F04C(v81, v96) )
|
|
786 {
|
|
787 if ( pOutdoor->_47F097(v81, v96) )
|
|
788 {
|
|
789 if ( !((a5a + screenCenter_X) % 2) )
|
|
790 *a4a = i;
|
|
791 }
|
|
792 else
|
|
793 {
|
|
794 *a4a = 0;
|
|
795 }
|
|
796 }
|
|
797 ++a4a;
|
|
798 v97 = (char *)v97 + black;
|
|
799 v64 = (signed int)v97 >> 16;
|
|
800 ++a5a;
|
|
801 }
|
|
802 while ( a5a < screenCenterY );
|
|
803 }
|
|
804 v62 += black;
|
|
805 v97 = (const void *)v60;
|
|
806 a4a += screenCenterY - a5a;
|
|
807 v63 = v62 >> 16;
|
|
808 ++screenCenter_X;
|
|
809 teal = (unsigned int)pPalette_16;
|
|
810 }
|
|
811 v65 = v95;
|
|
812 v66 = map_texture_16;
|
|
813 if ( (signed int)v95 > 0 )
|
|
814 {
|
|
815 v67 = v77;
|
|
816 result = 2 * (surfPitch - screenCenterY);
|
|
817 do
|
|
818 {
|
|
819 if ( screenCenterY > 0 )
|
|
820 {
|
|
821 v68 = screenCenterY;
|
|
822 do
|
|
823 {
|
|
824 v69 = *(short *)v66;
|
|
825 if ( !*(short *)v66 || v69 == (short)i )
|
|
826 *v67 = v69;
|
|
827 ++v66;
|
|
828 ++v67;
|
|
829 --v68;
|
|
830 }
|
|
831 while ( v68 );
|
|
832 }
|
|
833 v67 = (unsigned __int16 *)((char *)v67 + result);
|
|
834 --v65;
|
|
835 }
|
|
836 while ( v65 );
|
|
837 }
|
|
838 }
|
|
839 }
|
|
840
|
|
841
|