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