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