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