1298
|
1 #ifdef _MSC_VER
|
|
2 #define _CRT_SECURE_NO_WARNINGS
|
|
3 #endif
|
|
4
|
|
5 #include <assert.h>
|
|
6
|
|
7 #include "MM7.h"
|
|
8
|
|
9 #include "Mouse.h"
|
|
10
|
|
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 "Awards.h"
|
|
22 #include "Autonotes.h"
|
|
23 #include "StorylineTextTable.h"
|
|
24 #include "texts.h"
|
|
25
|
|
26 #include "mm7_data.h"
|
|
27
|
|
28
|
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
|
34 //----- (00411150) --------------------------------------------------------
|
|
35 void BookUI_DrawTownPortalMap()
|
|
36 {
|
|
37 //signed int v0; // edi@1
|
|
38 //__int16 v1; // dx@8
|
|
39 //POINT *v2; // edi@17
|
|
40 int v3; // edi@17
|
|
41 //__int16 v4; // dx@24
|
|
42 GUIWindow v6; // [sp+Ch] [bp-64h]@1
|
|
43 //POINT v7; // [sp+60h] [bp-10h]@17
|
|
44 POINT a2; // [sp+68h] [bp-8h]@17
|
|
45
|
|
46 pRenderer->ClearZBuffer(0, 479);
|
|
47 pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook);
|
|
48 pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
|
|
49
|
|
50 v6.uFrameX = game_viewport_x;
|
|
51 v6.uFrameY = game_viewport_y;
|
|
52 v6.uFrameWidth = game_viewport_width;
|
|
53 v6.uFrameHeight = game_viewport_height;
|
|
54 v6.uFrameZ = game_viewport_z;
|
|
55 v6.uFrameW = game_viewport_w;
|
|
56
|
|
57 const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
|
|
58 PARTY_QUEST_FOUNTAIN_PIERPONT,
|
|
59 PARTY_QUEST_FOUNTAIN_NIGHON,
|
|
60 PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
|
|
61 PARTY_QUEST_FOUNTAIN_CELESTIA,
|
|
62 PARTY_QUEST_FOUNTAIN_THE_PIT};
|
|
63 for (uint i = 0; i < 6; ++i)
|
|
64 {
|
|
65
|
|
66 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
|
|
67 pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i],
|
|
68 pTownPortalBook_ys[i],
|
|
69 pTexture_TownPortalIcons[i], i + 1);
|
|
70 }
|
|
71
|
|
72 /* v0 = 0;
|
|
73 do
|
|
74 {
|
|
75 if ( !v0 )
|
|
76 {
|
|
77 v1 = 206;
|
|
78 LABEL_14:
|
|
79 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) )
|
|
80 goto LABEL_16;
|
|
81 goto LABEL_15;
|
|
82 }
|
|
83 if ( v0 == 1 )
|
|
84 {
|
|
85 v1 = 208;
|
|
86 goto LABEL_14;
|
|
87 }
|
|
88 if ( v0 == 2 )
|
|
89 {
|
|
90 v1 = 207;
|
|
91 goto LABEL_14;
|
|
92 }
|
|
93 if ( v0 == 3 )
|
|
94 {
|
|
95 v1 = 211;
|
|
96 goto LABEL_14;
|
|
97 }
|
|
98 if ( v0 == 4 )
|
|
99 {
|
|
100 v1 = 209;
|
|
101 goto LABEL_14;
|
|
102 }
|
|
103 if ( v0 == 5 )
|
|
104 {
|
|
105 v1 = 210;
|
|
106 goto LABEL_14;
|
|
107 }
|
|
108 LABEL_15:
|
|
109 pRenderer->DrawMaskToZBuffer(
|
|
110 pTownPortalBook_xs[v0],
|
|
111 pTownPortalBook_ys[v0],
|
|
112 *(&pTexture_TownPortalHarmn + v0),
|
|
113 v0 + 1);
|
|
114 LABEL_16:
|
|
115 ++v0;
|
|
116 }
|
|
117 while ( v0 < 6 );*/
|
|
118
|
|
119 pMouse->GetCursorPos(&a2);
|
|
120 //v2 = pMouse->GetCursorPos(&a2);
|
|
121 v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
|
|
122
|
|
123 if (v3)
|
|
124 {
|
|
125 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
|
|
126 pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
|
|
127 }
|
|
128 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);
|
|
129
|
|
130
|
|
131 /* if ( !v3 ) // Town Portal
|
|
132 {
|
|
133 v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal"
|
|
134 return;
|
|
135 }
|
|
136 if ( v3 == 1 )
|
|
137 {
|
|
138 v4 = 206;
|
|
139 LABEL_30:
|
|
140 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) )
|
|
141 goto LABEL_31;
|
|
142 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal"
|
|
143 return;
|
|
144 }
|
|
145 if ( v3 == 2 )
|
|
146 {
|
|
147 v4 = 208;
|
|
148 goto LABEL_30;
|
|
149 }
|
|
150 if ( v3 == 3 )
|
|
151 {
|
|
152 v4 = 207;
|
|
153 goto LABEL_30;
|
|
154 }
|
|
155 if ( v3 == 4 )
|
|
156 {
|
|
157 v4 = 211;
|
|
158 goto LABEL_30;
|
|
159 }
|
|
160 if ( v3 == 5 )
|
|
161 {
|
|
162 v4 = 209;
|
|
163 goto LABEL_30;
|
|
164 }
|
|
165 if ( v3 == 6 )
|
|
166 {
|
|
167 v4 = 210;
|
|
168 goto LABEL_30;
|
|
169 }
|
|
170 LABEL_31:
|
|
171 pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3));
|
|
172 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/
|
|
173 }
|
|
174 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179 //----- (00413CC6) --------------------------------------------------------
|
|
180 void BookUI_Draw(WindowType book)
|
|
181 {
|
|
182 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
|
|
183 switch (book)
|
|
184 {
|
|
185 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
|
|
186 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
|
|
187 case WINDOW_MapsBook: BookUI_Map_Draw(); break;
|
|
188 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
|
|
189 case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
|
|
190
|
|
191 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
|
|
192 case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break;
|
|
193 }
|
|
194 }
|
|
195
|
|
196
|
|
197
|
|
198 //----- (00413D3C) --------------------------------------------------------
|
|
199 static const char *GetDayPart()
|
|
200 {
|
|
201 if (pParty->uCurrentHour <= 4)
|
|
202 return pGlobalTXT_LocalizationStrings[567]; // "Night"
|
|
203 else if (pParty->uCurrentHour == 5)
|
|
204 return pGlobalTXT_LocalizationStrings[55]; // "Dawn"
|
|
205 else if (pParty->uCurrentHour == 20)
|
|
206 return pGlobalTXT_LocalizationStrings[566]; // "Dusk"
|
|
207 else
|
|
208 return pGlobalTXT_LocalizationStrings[56]; // "Day"
|
|
209 }
|
|
210
|
|
211
|
|
212
|
|
213 //----- (00413D6F) --------------------------------------------------------
|
|
214 void BookUI_Calendar_Draw()
|
|
215 {
|
|
216 unsigned int v0; // esi@1
|
|
217 //char *v1; // eax@5
|
|
218 int v2; // ecx@5
|
|
219 char *v3; // eax@6
|
|
220 GUIWindow a1; // [sp+Ch] [bp-60h]@5
|
|
221 unsigned int v6; // [sp+60h] [bp-Ch]@1
|
|
222 //int v7; // [sp+64h] [bp-8h]@1
|
|
223 //int a5; // [sp+68h] [bp-4h]@1
|
|
224
|
|
225
|
|
226 static unsigned int pDayMoonPhase[28] = // 4E1B18
|
|
227 {
|
|
228 0, 0, 0,
|
|
229 1, 1, 1, 1,
|
|
230 2, 2, 2,
|
|
231 3, 3, 3, 3,
|
|
232 4, 4, 4,
|
|
233 3, 3, 3, 3,
|
|
234 2, 2, 2,
|
|
235 1, 1, 1, 1
|
|
236 };
|
|
237
|
|
238
|
|
239 v0 = pParty->uCurrentHour;
|
|
240 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
|
|
241 if ( (signed int)v0 <= 12 )
|
|
242 {
|
|
243 if ( !v0 )
|
|
244 v0 = 12;
|
|
245 }
|
|
246 else
|
|
247 {
|
|
248 v0 -= 12;
|
|
249 }
|
|
250 a1.uFrameX = game_viewport_x;
|
|
251 a1.uFrameY = game_viewport_y;
|
|
252 a1.uFrameWidth = game_viewport_width;
|
|
253 a1.uFrameHeight = game_viewport_height;
|
|
254 a1.uFrameZ = game_viewport_z;
|
|
255 a1.uFrameW = game_viewport_w;
|
|
256 a1.DrawTitleText(pBook2Font, 0, 0x16u, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia"
|
|
257
|
|
258 v2 = 0;
|
|
259 if ( pParty->uCurrentHour >= 12 )
|
|
260 {
|
|
261 if ( pParty->uCurrentHour >= 24 )
|
|
262 v2=0;
|
|
263 else
|
|
264 v2=1;
|
|
265 }
|
|
266
|
|
267 sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s",
|
|
268 pGlobalTXT_LocalizationStrings[526], // "Time"
|
|
269 v0,
|
|
270 pParty->uCurrentMinute,
|
|
271 aAMPMNames[v2],
|
|
272 GetDayPart());
|
|
273 a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0);
|
|
274
|
|
275 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
|
|
276 pGlobalTXT_LocalizationStrings[56], // "Day"
|
|
277 pParty->uDaysPlayed + 1,
|
|
278 aDayNames[pParty->uDaysPlayed % 7]);
|
|
279 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0);
|
|
280
|
|
281 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
|
|
282 pGlobalTXT_LocalizationStrings[146], // "Month"
|
|
283 pParty->uCurrentMonth + 1,
|
|
284 aMonthNames[pParty->uCurrentMonth]);
|
|
285 a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0);
|
|
286
|
|
287 sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
|
|
288 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0);
|
|
289
|
|
290 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
|
|
291 a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
|
|
292
|
|
293 v6 = pMapStats->GetMapInfo(pCurrentMapName.data());
|
|
294 if ( v6 )
|
|
295 v3 = pMapStats->pInfos[v6].pName;
|
|
296 else
|
|
297 v3 = "Unknown";
|
|
298 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
|
|
299 a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0);
|
|
300 }
|
|
301
|
|
302
|
|
303
|
|
304 //----- (0041192C) --------------------------------------------------------
|
|
305 void InitializeBookTextures()
|
|
306 {
|
|
307 //signed int v0; // ebp@3
|
|
308 //Texture **v1; // ebx@3
|
|
309
|
|
310 pAudioPlayer->StopChannels(-1, -1);
|
|
311
|
|
312 ++pIcons_LOD->uTexturePacksCount;
|
|
313 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
314 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
315
|
|
316 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
317 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
|
|
318 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
|
|
319 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
|
|
320 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
|
|
321 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
|
|
322 //v0 = 1;
|
|
323
|
|
324 static const char *texNames[9] = // 004E24EC
|
|
325 {
|
|
326 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
|
|
327 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00"
|
|
328 };
|
|
329
|
|
330 pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
|
|
331 for (uint i = 0; i < 9; ++i)
|
|
332 {
|
|
333 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
|
|
334
|
|
335 sprintf(pTmpBuf.data(), "tab%da", i+1);
|
|
336 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
337 sprintf(pTmpBuf.data(), "tab%db", i+1);
|
|
338 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
339 }
|
|
340 }
|
|
341
|
|
342
|
|
343
|
|
344 //----- (00411AAA) --------------------------------------------------------
|
|
345 void InitializeBookFonts()
|
|
346 {
|
|
347 pAudioPlayer->StopChannels(-1, -1);
|
|
348
|
|
349 ++pIcons_LOD->uTexturePacksCount;
|
|
350 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
351 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
352
|
|
353 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
354 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
|
|
355 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
|
|
356 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
|
|
357 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
|
|
358 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
|
|
359 }
|
|
360
|
|
361
|
|
362
|
|
363 //----- (00411300) --------------------------------------------------------
|
|
364 void LoadSpellbook(unsigned int spell_school)
|
|
365 {
|
|
366 //unsigned int v1; // esi@1
|
|
367 Player *pPlayer; // ecx@1
|
|
368 char v3; // al@1
|
|
369 //int v4; // edi@5
|
|
370 //Texture *result; // eax@6
|
|
371 //unsigned char *v6; // edi@7
|
|
372 //unsigned int v7; // eax@7
|
|
373 //unsigned __int8 v8; // sf@8
|
|
374 //unsigned __int8 v9; // of@8
|
|
375 char pContainer[20]; // [sp+Ch] [bp-1Ch]@7
|
|
376 //Texture *v11; // [sp+20h] [bp-8h]@5
|
|
377 //int v12; // [sp+24h] [bp-4h]@5
|
|
378
|
|
379 byte_506550 = 0;
|
|
380 //v1 = uID;
|
|
381 pPlayer = pPlayers[uActiveCharacter];
|
|
382 v3 = pPlayer->uQuickSpell;
|
|
383 if ( v3 && (unsigned __int8)v3 / 11 == spell_school )
|
|
384 quick_spell_at_page = (unsigned __int8)v3 - 11 * spell_school;
|
|
385 else
|
|
386 quick_spell_at_page = 0;
|
|
387
|
|
388 for (uint i = 1; i < 12; ++i)
|
|
389 {
|
|
390 if (pPlayer->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1])
|
|
391 {
|
|
392 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]);
|
|
393 dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
|
|
394
|
|
395 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]);
|
|
396 dword_5063D8[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
|
|
397 }
|
|
398 }
|
|
399 }
|
|
400
|
|
401 //----- (0041140B) --------------------------------------------------------
|
|
402 void sub_41140B()
|
|
403 {
|
|
404 signed int v0; // esi@1
|
|
405 GUIButton *v1; // eax@3
|
|
406 GUIButton *v2; // esi@4
|
|
407
|
|
408 v0 = 0;
|
|
409 do
|
|
410 {
|
|
411 dword_5063D8[11+v0]->Release();
|
|
412 dword_506408[11+v0]->Release();
|
|
413 --v0;
|
|
414 }
|
|
415 while ( v0 >= -11 );
|
|
416 pIcons_LOD->SyncLoadedFilesCount();
|
|
417 v1 = pGUIWindow_CurrentMenu->pControlsHead;
|
|
418 if ( v1 )
|
|
419 {
|
|
420 do
|
|
421 {
|
|
422 v2 = v1->pNext;
|
|
423 pAllocator->FreeChunk(v1);
|
|
424 v1 = v2;
|
|
425 }
|
|
426 while ( v2 );
|
|
427 }
|
|
428 pGUIWindow_CurrentMenu->pControlsHead = 0;
|
|
429 pGUIWindow_CurrentMenu->pControlsTail = 0;
|
|
430 pGUIWindow_CurrentMenu->uNumControls = 0;
|
|
431 }
|
|
432
|
|
433 //----- (00411473) --------------------------------------------------------
|
|
434 void sub_411473()
|
|
435 {
|
|
436 pTexture_pagemask->Release();
|
|
437 pTexture_506448->Release();
|
|
438 pTexture_50643C->Release();
|
|
439 for (uint i = 0; i < 9; ++i)
|
|
440 {
|
|
441 pSpellBookPagesTextr[i]->Release();
|
|
442 pTextures_tabs[i][0]->Release();
|
|
443 pTextures_tabs[i][1]->Release();
|
|
444 }
|
|
445 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
|
|
446 pIcons_LOD->_4114F2();
|
|
447 }
|
|
448
|
|
449
|
|
450 //----- (00411597) --------------------------------------------------------
|
|
451 void OnCloseSpellBook()
|
|
452 {
|
|
453 pAllocator->FreeChunk(pSpellFont);
|
|
454 pSpellFont = nullptr;
|
|
455 pAllocator->FreeChunk(pBookFont);
|
|
456 pBookFont = nullptr;
|
|
457 pAllocator->FreeChunk(pBook2Font);
|
|
458 pBook2Font = nullptr;
|
|
459 pAllocator->FreeChunk(pAutonoteFont);
|
|
460 pAutonoteFont = nullptr;
|
|
461 pTexture_mapbordr->Release();
|
|
462 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
|
|
463 pIcons_LOD->_4114F2();
|
|
464 dword_506364 = 0;
|
|
465 }
|
|
466
|
|
467
|
|
468
|
|
469
|
|
470
|
|
471
|
|
472
|
|
473 //----- (00412E85) --------------------------------------------------------
|
|
474 void BookUI_Journal_Draw()
|
|
475 {
|
|
476 unsigned int v0; // eax@3
|
|
477 unsigned int v1; // eax@7
|
|
478 int v2; // eax@10
|
|
479 const char *v3; // eax@10
|
|
480 signed int v4; // ecx@12
|
|
481 int v5; // ecx@14
|
|
482 int v6; // eax@21
|
|
483 int v7; // esi@21
|
|
484 char *v8; // eax@21
|
|
485 char* v9; // eax@22
|
|
486 unsigned int v11; // [sp-8h] [bp-64h]@3
|
|
487 unsigned int v12; // [sp-8h] [bp-64h]@7
|
|
488 Texture *v13; // [sp-4h] [bp-60h]@3
|
|
489 Texture *v14; // [sp-4h] [bp-60h]@7
|
|
490 GUIWindow a1; // [sp+8h] [bp-54h]@10
|
|
491
|
|
492 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11);
|
|
493 if ( BtnUp_flag || !dword_506528 )
|
|
494 {
|
|
495 v13 = pTex_tab_an_6a__zoom_off;
|
|
496 v11 = pViewport->uViewportTL_Y + 2;
|
|
497 v0 = pViewport->uViewportTL_X + 407;
|
|
498 }
|
|
499 else
|
|
500 {
|
|
501 v13 = pTex_tab_an_6b__zoom_on;
|
|
502 v11 = pViewport->uViewportTL_Y + 1;
|
|
503 v0 = pViewport->uViewportTL_X + 398;
|
|
504 }
|
|
505 pRenderer->DrawTextureTransparent(v0, v11, v13);
|
|
506
|
|
507 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
|
|
508 {
|
|
509 v14 = pTex_tab_an_7a__zoot_off;
|
|
510 v12 = pViewport->uViewportTL_Y + 38;
|
|
511 v1 = pViewport->uViewportTL_X + 407;
|
|
512 }
|
|
513 else
|
|
514 {
|
|
515 v14 = pTex_tab_an_7b__zoot_on;
|
|
516 v12 = pViewport->uViewportTL_Y + 38;
|
|
517 v1 = pViewport->uViewportTL_X + 398;
|
|
518 }
|
|
519 pRenderer->DrawTextureTransparent(v1, v12, v14);
|
|
520
|
|
521 if ( !byte_5C6D50[dword_506528] )
|
|
522 {
|
|
523 v2 = achieved_awards[dword_506528];
|
|
524 a1.uFrameWidth = game_viewport_width;
|
|
525 a1.uFrameX = game_viewport_x;
|
|
526 a1.uFrameY = game_viewport_y;
|
|
527 a1.uFrameHeight = game_viewport_height;
|
|
528 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[];
|
|
529 a1.uFrameZ = game_viewport_z;
|
|
530 a1.uFrameW = game_viewport_w;
|
|
531 if ( v3 )
|
|
532 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3);
|
|
533 }
|
|
534
|
|
535 a1.uFrameX = 48;
|
|
536 a1.uFrameY = 70;
|
|
537 a1.uFrameWidth = 360;
|
|
538 a1.uFrameHeight = 264;
|
|
539 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
|
|
540 a1.uFrameZ = 407;
|
|
541 a1.uFrameHeight = v4 * 264 / v4;
|
|
542 a1.uFrameW = a1.uFrameHeight + 69;
|
|
543 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
|
|
544 {
|
|
545 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
546 v5 = dword_50651C++;
|
|
547 dword_506528 += num_achieved_awards;
|
|
548 byte_506130[v5] = num_achieved_awards;
|
|
549 }
|
|
550 if ( BtnUp_flag && dword_50651C )
|
|
551 {
|
|
552 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
553 --dword_50651C;
|
|
554 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
|
|
555 }
|
|
556 if ( !num_achieved_awards || dword_506528 < 1 )
|
|
557 {
|
|
558 dword_506528 = 0;
|
|
559 dword_50651C = 0;
|
|
560 }
|
|
561 BtnDown_flag = 0;
|
|
562 v6 = achieved_awards[dword_506528];
|
|
563 BtnUp_flag = 0;
|
|
564 num_achieved_awards = 0;
|
|
565 //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
|
|
566 v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
|
|
567 v8 = BuilDialogueString(
|
|
568 pStorylineText->StoreLine[v6].pText,
|
|
569 uActiveCharacter - 1,
|
|
570 0,
|
|
571 0,
|
|
572 0,
|
|
573 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
|
|
574 if ( v7 )
|
|
575 {
|
|
576 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
|
|
577 a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow);
|
|
578 ++num_achieved_awards;
|
|
579 }
|
|
580 }
|
|
581
|
|
582
|
|
583 //----- (00413126) --------------------------------------------------------
|
|
584 void BookUI_Questbook_Draw()
|
|
585 {
|
|
586 unsigned int v0; // eax@3
|
|
587 unsigned int v1; // eax@7
|
|
588 int v2; // ecx@11
|
|
589 int v3; // ebx@16
|
|
590 int v4; // eax@19
|
|
591 const char *v5; // edi@19
|
|
592 int v6; // eax@19
|
|
593 unsigned int v7; // edi@19
|
|
594 unsigned int v8; // [sp-8h] [bp-68h]@3
|
|
595 unsigned int v9; // [sp-8h] [bp-68h]@7
|
|
596 Texture *v10; // [sp-4h] [bp-64h]@3
|
|
597 Texture *v11; // [sp-4h] [bp-64h]@7
|
|
598 GUIWindow a1; // [sp+Ch] [bp-54h]@9
|
|
599
|
|
600 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook);
|
|
601 if ( BtnUp_flag || !dword_506528 )
|
|
602 {
|
|
603 v10 = pTex_tab_an_6a__zoom_off;
|
|
604 v8 = pViewport->uViewportTL_Y + 2;
|
|
605 v0 = pViewport->uViewportTL_X + 407;
|
|
606 }
|
|
607 else
|
|
608 {
|
|
609 v10 = pTex_tab_an_6b__zoom_on;
|
|
610 v8 = pViewport->uViewportTL_Y + 1;
|
|
611 v0 = pViewport->uViewportTL_X + 398;
|
|
612 }
|
|
613 pRenderer->DrawTextureTransparent(v0, v8, v10);
|
|
614 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
|
|
615 {
|
|
616 v11 = pTex_tab_an_7a__zoot_off;
|
|
617 v9 = pViewport->uViewportTL_Y + 38;
|
|
618 v1 = pViewport->uViewportTL_X + 407;
|
|
619 }
|
|
620 else
|
|
621 {
|
|
622 v11 = pTex_tab_an_7b__zoot_on;
|
|
623 v9 = pViewport->uViewportTL_Y + 38;
|
|
624 v1 = pViewport->uViewportTL_X + 398;
|
|
625 }
|
|
626 pRenderer->DrawTextureTransparent(v1, v9, v11);
|
|
627 a1.uFrameWidth = game_viewport_width;
|
|
628 a1.uFrameHeight = game_viewport_height;
|
|
629 a1.uFrameX = game_viewport_x;
|
|
630 a1.uFrameY = game_viewport_y;
|
|
631 a1.uFrameZ = game_viewport_z;
|
|
632 a1.uFrameW = game_viewport_w;
|
|
633 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests"
|
|
634
|
|
635 a1.uFrameX = 48;
|
|
636 a1.uFrameY = 70;
|
|
637 a1.uFrameWidth = 360;
|
|
638 a1.uFrameHeight = 264;
|
|
639 a1.uFrameZ = 407;
|
|
640 a1.uFrameW = 333;
|
|
641 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
|
|
642 {
|
|
643 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
644 v2 = dword_50651C++;
|
|
645 dword_506528 += num_achieved_awards;
|
|
646 byte_506130[v2] = num_achieved_awards;
|
|
647 }
|
|
648 if ( BtnUp_flag && dword_50651C )
|
|
649 {
|
|
650 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
651 --dword_50651C;
|
|
652 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
|
|
653 }
|
|
654 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) )
|
|
655 {
|
|
656 v3 = 0;
|
|
657 dword_50651C = 0;
|
|
658 dword_506528 = 0;
|
|
659 }
|
|
660 BtnDown_flag = 0;
|
|
661 BtnUp_flag = 0;
|
|
662 num_achieved_awards = 0;
|
|
663 while ( v3 < num_achieved_awards_2 )
|
|
664 {
|
|
665 v4 = achieved_awards[v3];
|
|
666 ++num_achieved_awards;
|
|
667 v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4];
|
|
668 a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
|
|
669 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
|
|
670 v7 = a1.uFrameY + v6;
|
|
671 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
|
|
672 break;
|
|
673 pRenderer->DrawTextureTransparent(100, v7 + 12, pSpellBookPagesTextr_10);
|
|
674 ++v3;
|
|
675 a1.uFrameY = v7 + 24;
|
|
676 }
|
|
677 }
|
|
678
|
|
679
|
|
680 //----- (0041338E) --------------------------------------------------------
|
|
681 void BookUI_Autonotes_Draw()
|
|
682 {
|
|
683 unsigned int v0; // eax@3
|
|
684 unsigned int v1; // eax@7
|
|
685 signed int v2; // ebp@11
|
|
686 unsigned int v3; // eax@18
|
|
687 unsigned int v4; // eax@24
|
|
688 unsigned int v5; // eax@30
|
|
689 unsigned int v6; // eax@36
|
|
690 unsigned int v7; // eax@42
|
|
691 signed int v8; // ebp@47
|
|
692 int v9; // eax@52
|
|
693 int v10; // eax@56
|
|
694 int v11; // edx@57
|
|
695 int v12; // ebp@64
|
|
696 int v13; // eax@65
|
|
697 const char *v14; // edi@65
|
|
698 int v15; // eax@65
|
|
699 unsigned int v16; // edi@65
|
|
700 unsigned int v17; // [sp-8h] [bp-70h]@3
|
|
701 unsigned int v18; // [sp-8h] [bp-70h]@7
|
|
702 unsigned int v19; // [sp-8h] [bp-70h]@18
|
|
703 unsigned int v20; // [sp-8h] [bp-70h]@24
|
|
704 unsigned int v21; // [sp-8h] [bp-70h]@30
|
|
705 unsigned int v22; // [sp-8h] [bp-70h]@36
|
|
706 unsigned int v23; // [sp-8h] [bp-70h]@42
|
|
707 Texture *v24; // [sp-4h] [bp-6Ch]@3
|
|
708 Texture *v25; // [sp-4h] [bp-6Ch]@7
|
|
709 Texture *v26; // [sp-4h] [bp-6Ch]@18
|
|
710 Texture *v27; // [sp-4h] [bp-6Ch]@24
|
|
711 Texture *v28; // [sp-4h] [bp-6Ch]@30
|
|
712 Texture *v29; // [sp-4h] [bp-6Ch]@36
|
|
713 Texture *v30; // [sp-4h] [bp-6Ch]@42
|
|
714 signed __int16 v31; // [sp+10h] [bp-58h]@1
|
|
715 char *v32; // [sp+10h] [bp-58h]@49
|
|
716 GUIWindow a1; // [sp+14h] [bp-54h]@46
|
|
717
|
|
718 v31 = 0;
|
|
719 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook);
|
|
720 if ( BtnUp_flag || !dword_506528 )
|
|
721 {
|
|
722 v24 = pTex_tab_an_6a__zoom_off;
|
|
723 v17 = pViewport->uViewportTL_Y + 2;
|
|
724 v0 = pViewport->uViewportTL_X + 407;
|
|
725 }
|
|
726 else
|
|
727 {
|
|
728 v24 = pTex_tab_an_6b__zoom_on;
|
|
729 v17 = pViewport->uViewportTL_Y + 1;
|
|
730 v0 = pViewport->uViewportTL_X + 398;
|
|
731 }
|
|
732 pRenderer->DrawTextureTransparent(v0, v17, v24);
|
|
733 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
|
|
734 {
|
|
735 v25 = pTex_tab_an_7a__zoot_off;
|
|
736 v18 = pViewport->uViewportTL_Y + 38;
|
|
737 v1 = pViewport->uViewportTL_X + 407;
|
|
738 }
|
|
739 else
|
|
740 {
|
|
741 v25 = pTex_tab_an_7b__zoot_on;
|
|
742 v18 = pViewport->uViewportTL_Y + 38;
|
|
743 v1 = pViewport->uViewportTL_X + 398;
|
|
744 }
|
|
745 pRenderer->DrawTextureTransparent(v1, v18, v25);
|
|
746 if ( !Book_PageBtn3_flag )//Potions_page_flag
|
|
747 {
|
|
748 if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE)
|
|
749 {
|
|
750 pRenderer->DrawTextureTransparent(
|
|
751 pViewport->uViewportTL_X + 408,
|
|
752 pViewport->uViewportTL_Y + 113,
|
|
753 pTexture_506390);
|
|
754 v2 = 1;
|
|
755 goto LABEL_16;
|
|
756 }
|
|
757 goto LABEL_14;
|
|
758 }
|
|
759 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)
|
|
760 {
|
|
761 LABEL_14:
|
|
762 v2 = 1;
|
|
763 goto LABEL_15;
|
|
764 }
|
|
765 v2 = 1;
|
|
766 v31 = 1;
|
|
767 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
768 LABEL_15:
|
|
769 _506568_autonote_type = AUTONOTE_POTION_RECEPIE;
|
|
770 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394);
|
|
771 LABEL_16:
|
|
772 if ( Book_PageBtn4_flag )//Fontains_page_flag
|
|
773 {
|
|
774 if ( _506568_autonote_type != v2 )
|
|
775 {
|
|
776 v31 = v2;
|
|
777 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
778 }
|
|
779 }
|
|
780 else
|
|
781 {
|
|
782 if ( _506568_autonote_type != v2 )
|
|
783 {
|
|
784 v26 = pTexture_506388;
|
|
785 v19 = pViewport->uViewportTL_Y + 150;
|
|
786 v3 = pViewport->uViewportTL_X + 408;
|
|
787 goto LABEL_22;
|
|
788 }
|
|
789 }
|
|
790 v26 = pTexture_50638C;
|
|
791 _506568_autonote_type = v2;
|
|
792 v19 = pViewport->uViewportTL_Y + 150;
|
|
793 v3 = pViewport->uViewportTL_X + 399;
|
|
794 LABEL_22:
|
|
795 pRenderer->DrawTextureTransparent(v3, v19, v26);
|
|
796 if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag
|
|
797 {
|
|
798 if ( _506568_autonote_type != AUTONOTE_OBELISK)
|
|
799 {
|
|
800 v31 = v2;
|
|
801 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
802 }
|
|
803 }
|
|
804 else
|
|
805 {
|
|
806 if ( _506568_autonote_type != AUTONOTE_OBELISK)
|
|
807 {
|
|
808 v27 = pTexture_506380;
|
|
809 v20 = pViewport->uViewportTL_Y + 188;
|
|
810 v4 = pViewport->uViewportTL_X + 408;
|
|
811 goto LABEL_28;
|
|
812 }
|
|
813 }
|
|
814 v27 = pTexture_506384;
|
|
815 _506568_autonote_type = AUTONOTE_OBELISK;
|
|
816 v20 = pViewport->uViewportTL_Y + 188;
|
|
817 v4 = pViewport->uViewportTL_X + 397;
|
|
818 LABEL_28:
|
|
819 pRenderer->DrawTextureTransparent(v4, v20, v27);
|
|
820 if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag
|
|
821 {
|
|
822 if ( _506568_autonote_type != AUTONOTE_SEER)
|
|
823 {
|
|
824 v31 = v2;
|
|
825 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
826 }
|
|
827 }
|
|
828 else
|
|
829 {
|
|
830 if ( _506568_autonote_type != AUTONOTE_SEER)
|
|
831 {
|
|
832 v28 = pTexture_506378;
|
|
833 v21 = pViewport->uViewportTL_Y + 226;
|
|
834 v5 = pViewport->uViewportTL_X + 408;
|
|
835 goto LABEL_34;
|
|
836 }
|
|
837 }
|
|
838 v28 = pTexture_50637C;
|
|
839 _506568_autonote_type = AUTONOTE_SEER;
|
|
840 v21 = pViewport->uViewportTL_Y + 226;
|
|
841 v5 = pViewport->uViewportTL_X + 397;
|
|
842 LABEL_34:
|
|
843 pRenderer->DrawTextureTransparent(v5, v21, v28);
|
|
844 if ( Autonotes_Misc_page_flag )
|
|
845 {
|
|
846 if ( _506568_autonote_type != AUTONOTE_MISC)
|
|
847 {
|
|
848 v31 = v2;
|
|
849 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
850 }
|
|
851 }
|
|
852 else
|
|
853 {
|
|
854 if ( _506568_autonote_type != AUTONOTE_MISC)
|
|
855 {
|
|
856 v29 = pTexture_506370;
|
|
857 v22 = pViewport->uViewportTL_Y + 263;
|
|
858 v6 = pViewport->uViewportTL_X + 408;
|
|
859 goto LABEL_40;
|
|
860 }
|
|
861 }
|
|
862 v29 = pTexture_506374;
|
|
863 _506568_autonote_type = AUTONOTE_MISC;
|
|
864 v22 = pViewport->uViewportTL_Y + 264;
|
|
865 v6 = pViewport->uViewportTL_X + 397;
|
|
866 LABEL_40:
|
|
867 pRenderer->DrawTextureTransparent(v6, v22, v29);
|
|
868 if ( Autonotes_Instructors_page_flag )
|
|
869 {
|
|
870 if ( _506568_autonote_type != AUTONOTE_TEACHER)
|
|
871 {
|
|
872 v31 = v2;
|
|
873 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
874 }
|
|
875 }
|
|
876 else
|
|
877 {
|
|
878 if ( _506568_autonote_type != AUTONOTE_TEACHER)
|
|
879 {
|
|
880 v30 = pTexture_506368;
|
|
881 v23 = pViewport->uViewportTL_Y + 302;
|
|
882 v7 = pViewport->uViewportTL_X + 408;
|
|
883 goto LABEL_46;
|
|
884 }
|
|
885 }
|
|
886 v30 = pTexture_50636C;
|
|
887 _506568_autonote_type = AUTONOTE_TEACHER;
|
|
888 v23 = pViewport->uViewportTL_Y + 302;
|
|
889 v7 = pViewport->uViewportTL_X + 397;
|
|
890 LABEL_46:
|
|
891 pRenderer->DrawTextureTransparent(v7, v23, v30);
|
|
892 a1.uFrameWidth = game_viewport_width;
|
|
893 a1.uFrameHeight = game_viewport_height;
|
|
894 a1.uFrameX = game_viewport_x;
|
|
895 a1.uFrameY = game_viewport_y;
|
|
896 a1.uFrameZ = game_viewport_z;
|
|
897 a1.uFrameW = game_viewport_w;
|
|
898 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes"
|
|
899
|
|
900 a1.uFrameX = 48;
|
|
901 a1.uFrameY = 70;
|
|
902 a1.uFrameWidth = 360;
|
|
903 a1.uFrameHeight = 264;
|
|
904 a1.uFrameZ = 407;
|
|
905 a1.uFrameW = 333;
|
|
906 if ( v31 )
|
|
907 {
|
|
908 num_achieved_awards_2 = 0;
|
|
909 dword_506528 = 0;
|
|
910 dword_50651C = 0;
|
|
911 num_achieved_awards = 0;
|
|
912 v8 = 0;
|
|
913 do
|
|
914 {
|
|
915 //if ( dword_72371C[2 * v8] == dword_506568 )
|
|
916 if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type )
|
|
917 {
|
|
918 //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
|
|
919 v32 = (char *)pAutonoteTxt[v8-1].pText;
|
|
920 if ( (short)v8 )
|
|
921 {
|
|
922 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
|
|
923 {
|
|
924 v9 = num_achieved_awards++;
|
|
925 achieved_awards[v9] = (AwardType)v8;
|
|
926 }
|
|
927 }
|
|
928 }
|
|
929 ++v8;
|
|
930 }
|
|
931 while ( v8 < 196 );
|
|
932 num_achieved_awards_2 = num_achieved_awards;
|
|
933 }
|
|
934 else
|
|
935 {
|
|
936 if ( BtnDown_flag )
|
|
937 {
|
|
938 v10 = num_achieved_awards + dword_506528;
|
|
939 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 )
|
|
940 {
|
|
941 v11 = dword_50651C++;
|
|
942 byte_506130[v11] = num_achieved_awards;
|
|
943 dword_506528 = v10;
|
|
944 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
945 }
|
|
946 }
|
|
947 if ( BtnUp_flag && dword_50651C )
|
|
948 {
|
|
949 --dword_50651C;
|
|
950 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
|
|
951 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
952 }
|
|
953 if ( !num_achieved_awards || dword_506528 < 1 )
|
|
954 {
|
|
955 dword_506528 = 0;
|
|
956 dword_50651C = 0;
|
|
957 }
|
|
958 }
|
|
959 v12 = dword_506528;
|
|
960 Autonotes_Instructors_page_flag = 0;
|
|
961 BtnDown_flag = 0;
|
|
962 BtnUp_flag = 0;
|
|
963 num_achieved_awards = 0;
|
|
964 Autonotes_Misc_page_flag = 0;
|
|
965 Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag
|
|
966 Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag
|
|
967 Book_PageBtn4_flag = 0;//Fontains_page_flag
|
|
968 Book_PageBtn3_flag = 0;//Potions_page_flag
|
|
969 while ( v12 < num_achieved_awards_2 )
|
|
970 {
|
|
971 v13 = achieved_awards[v12];
|
|
972 ++num_achieved_awards;
|
|
973 //v14 = (&dword_723718_autonote_related)[8 * v13];
|
|
974 v14 = pAutonoteTxt[v13-1].pText;
|
|
975 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
|
|
976 a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13-1].pText, 0, 0, 0);
|
|
977 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
|
|
978 v16 = a1.uFrameY + v15;
|
|
979 if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight )
|
|
980 break;
|
|
981 pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10);
|
|
982 ++v12;
|
|
983 a1.uFrameY = v16 + 24;
|
|
984 }
|
|
985 }
|
|
986
|
|
987
|
|
988 //----- (00413980) --------------------------------------------------------
|
|
989 void BookUI_Map_Draw()
|
|
990 {
|
|
991 int v6; // eax@31
|
|
992 unsigned int map_id; // eax@35
|
|
993 Texture *buttnTxtr; // [sp-4h] [bp-DCh]@3
|
|
994 char party_coord[120]; // [sp+Ch] [bp-CCh]@37
|
|
995 GUIWindow map_window; // [sp+84h] [bp-54h]@35
|
|
996 unsigned int textrX, textrY;
|
|
997
|
|
998 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
|
|
999 if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )
|
|
1000 {
|
|
1001 buttnTxtr = pTex_tab_an_6a__zoom_off;
|
|
1002 textrY = pViewport->uViewportTL_Y + 2;
|
|
1003 textrX = pViewport->uViewportTL_X + 408;
|
|
1004 }
|
|
1005 else
|
|
1006 {
|
|
1007 buttnTxtr = pTex_tab_an_6b__zoom_on;
|
|
1008 textrY = pViewport->uViewportTL_Y + 1;
|
|
1009 textrX = pViewport->uViewportTL_X + 398;
|
|
1010 }
|
|
1011 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1012 if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )
|
|
1013 {
|
|
1014 buttnTxtr = pTex_tab_an_7a__zoot_off;
|
|
1015 textrY = pViewport->uViewportTL_Y + 38;
|
|
1016 textrX = pViewport->uViewportTL_X + 408;
|
|
1017 }
|
|
1018 else
|
|
1019 {
|
|
1020 buttnTxtr = pTex_tab_an_7b__zoot_on;
|
|
1021 textrY = pViewport->uViewportTL_Y + 38;
|
|
1022 textrX = pViewport->uViewportTL_X + 398;
|
|
1023 }
|
|
1024 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1025 if ( Book_PageBtn3_flag )
|
|
1026 {
|
|
1027 buttnTxtr = pTexture_506390;
|
|
1028 textrY = pViewport->uViewportTL_Y + 113;
|
|
1029 textrX = pViewport->uViewportTL_X + 408;
|
|
1030 }
|
|
1031 else
|
|
1032 {
|
|
1033 buttnTxtr = pTexture_506394;
|
|
1034 textrY = pViewport->uViewportTL_Y + 113;
|
|
1035 textrX = pViewport->uViewportTL_X + 398;
|
|
1036 }
|
|
1037 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1038 if ( Book_PageBtn4_flag )
|
|
1039 {
|
|
1040 buttnTxtr = pTexture_506388;
|
|
1041 textrY = pViewport->uViewportTL_X + 150;
|
|
1042 textrX = pViewport->uViewportTL_Y + 408;
|
|
1043 }
|
|
1044 else
|
|
1045 {
|
|
1046 buttnTxtr = pTexture_50638C;
|
|
1047 textrY = pViewport->uViewportTL_X + 150;
|
|
1048 textrX = pViewport->uViewportTL_Y + 399;
|
|
1049 }
|
|
1050 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1051 if ( Book_PageBtn5_flag )
|
|
1052 {
|
|
1053 buttnTxtr = pTexture_506380;
|
|
1054 textrY = pViewport->uViewportTL_Y + 188;
|
|
1055 textrX = pViewport->uViewportTL_X + 408;
|
|
1056 }
|
|
1057 else
|
|
1058 {
|
|
1059 buttnTxtr = pTexture_506384;
|
|
1060 textrY = pViewport->uViewportTL_Y + 188;
|
|
1061 textrX = pViewport->uViewportTL_X + 397;
|
|
1062 }
|
|
1063 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1064 if ( Book_PageBtn6_flag )
|
|
1065 {
|
|
1066 buttnTxtr = pTexture_506378;
|
|
1067 textrY = pViewport->uViewportTL_Y + 226;
|
|
1068 textrX = pViewport->uViewportTL_X + 408;
|
|
1069 }
|
|
1070 else
|
|
1071 {
|
|
1072 buttnTxtr = pTexture_50637C;
|
|
1073 textrY = pViewport->uViewportTL_Y + 226;
|
|
1074 textrX = pViewport->uViewportTL_X + 397;
|
|
1075 }
|
|
1076 pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr);
|
|
1077 if ( BtnDown_flag )
|
|
1078 viewparams->CenterOnParty2();
|
|
1079 if ( BtnUp_flag )
|
|
1080 viewparams->CenterOnParty();
|
|
1081 if ( Book_PageBtn3_flag )
|
|
1082 viewparams->_443219();
|
|
1083 if ( Book_PageBtn4_flag )
|
|
1084 viewparams->_443231();
|
|
1085 if ( Book_PageBtn5_flag )
|
|
1086 viewparams->_44323D();
|
|
1087 if ( Book_PageBtn6_flag )
|
|
1088 viewparams->_443225();
|
|
1089
|
|
1090 if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag )
|
|
1091 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
1092 BtnUp_flag = 0;
|
|
1093 BtnDown_flag = 0;
|
|
1094 Book_PageBtn6_flag = 0;
|
|
1095 Book_PageBtn5_flag = 0;
|
|
1096 Book_PageBtn4_flag = 0;
|
|
1097 Book_PageBtn3_flag = 0;
|
|
1098 DrawBook_Map_sub(97, 49, 361, 313, 0);
|
|
1099 pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr);
|
|
1100 map_window.uFrameWidth = game_viewport_width;
|
|
1101 map_window.uFrameHeight = game_viewport_height;
|
|
1102 map_window.uFrameX = game_viewport_x;
|
|
1103 map_window.uFrameY = game_viewport_y;
|
|
1104 map_window.uFrameZ = game_viewport_z;
|
|
1105 map_window.uFrameW = game_viewport_w;
|
|
1106 map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
|
|
1107 if ( map_id )
|
|
1108 map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
|
|
1109
|
|
1110 map_window.uFrameX = 0;
|
|
1111 sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d"
|
|
1112 map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0);
|
|
1113 }
|
|
1114
|
|
1115 //----- (00442955) --------------------------------------------------------
|
|
1116 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
|
|
1117 {
|
|
1118 int v5; // ebx@1
|
|
1119 int v6; // edi@1
|
|
1120 BLVMapOutlines *v7; // eax@8
|
|
1121 unsigned __int8 v8; // zf@8
|
|
1122 unsigned __int8 v9; // sf@8
|
|
1123 int v10; // esi@10
|
|
1124 unsigned int v11; // edx@11
|
|
1125 __int16 v12; // cx@12
|
|
1126 signed int v13; // eax@15
|
|
1127 int v14; // eax@16
|
|
1128 Vec3_short_ *v15; // ecx@16
|
|
1129 int v16; // edx@16
|
|
1130 int v17; // ecx@16
|
|
1131 Vec3_short_ *v18; // eax@16
|
|
1132 int v19; // ecx@16
|
|
1133 int v20; // eax@16
|
|
1134 signed int v21; // esi@18
|
|
1135 int v22; // ecx@21
|
|
1136 BLVMapOutline *v23; // ecx@21
|
|
1137 Vec3_short_ *v24; // edx@21
|
|
1138 Vec3_short_ *v25; // eax@21
|
|
1139 int v26; // ecx@21
|
|
1140 unsigned __int16 *v27; // edi@21
|
|
1141 int v28; // edx@21
|
|
1142 int v29; // eax@21
|
|
1143 double v30; // st7@23
|
|
1144 signed __int64 v31; // qax@23
|
|
1145 unsigned short *v32; // edx@23
|
|
1146 int textr_width; // esi@23
|
|
1147 signed int v34; // eax@23
|
|
1148 signed int v35; // ecx@23
|
|
1149 int v36; // esi@27
|
|
1150 int v37; // ecx@27
|
|
1151 int v38; // edx@31
|
|
1152 unsigned int v39; // eax@33
|
|
1153 short *v40; // esi@33
|
|
1154 short *v41; // edi@33
|
|
1155 unsigned __int8 v42; // cf@33
|
|
1156 unsigned int v43; // ecx@33
|
|
1157 short *v44; // edi@33
|
|
1158 short *v45; // esi@33
|
|
1159 int v46; // ecx@33
|
|
1160 signed int v47; // esi@38
|
|
1161 signed int v48; // ecx@38
|
|
1162 int v49; // eax@38
|
|
1163 signed int v50; // edx@55
|
|
1164 unsigned int v51; // ecx@55
|
|
1165 int result; // eax@72
|
|
1166 int v53; // eax@75
|
|
1167 int v54; // esi@75
|
|
1168 int v55; // eax@75
|
|
1169 __int16 v56; // si@85
|
|
1170 double v57; // st7@85
|
|
1171 int v58; // ebx@85
|
|
1172 signed __int64 v59; // qax@85
|
|
1173 signed int v60; // edi@85
|
|
1174 signed __int64 v61; // qax@85
|
|
1175 signed int v62; // ebx@85
|
|
1176 signed int v63; // esi@85
|
|
1177 int v64; // eax@87
|
|
1178 unsigned int v65; // ebx@95
|
|
1179 unsigned short *v66; // edx@95
|
|
1180 unsigned __int16 *v67; // esi@96
|
|
1181 int v68; // edi@98
|
|
1182 unsigned __int16 v69; // cx@99
|
|
1183 unsigned int v70; // [sp-10h] [bp-48074h]@80
|
|
1184 unsigned int v71; // [sp-Ch] [bp-48070h]@80
|
|
1185 unsigned int v72; // [sp-8h] [bp-4806Ch]@80
|
|
1186 signed int v73; // [sp-4h] [bp-48068h]@59
|
|
1187 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
|
|
1188 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23
|
|
1189 int v76; // [sp+4800Ch] [bp-58h]@23
|
|
1190 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
|
|
1191 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
|
|
1192 unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1
|
|
1193
|
|
1194 int v81; // [sp+48020h] [bp-44h]@23
|
|
1195 unsigned __int16* render16_data;
|
|
1196 unsigned char* texture8_data;
|
|
1197 unsigned char* curr_line;
|
|
1198 int scale_increment;
|
|
1199 int scaled_posX;
|
|
1200 int scaled_posY;
|
|
1201 int stepX_r;
|
|
1202 int stepY_r;
|
|
1203
|
|
1204
|
|
1205 unsigned int teal; // [sp+48028h] [bp-3Ch]@8
|
|
1206 int v84; // [sp+4802Ch] [bp-38h]@1
|
|
1207 int screenCenter_X; // [sp+48030h] [bp-34h]@1
|
|
1208 int v86; // [sp+48034h] [bp-30h]@1
|
|
1209 int v87; // [sp+48038h] [bp-2Ch]@16
|
|
1210 unsigned int v88; // [sp+4803Ch] [bp-28h]@16
|
|
1211 int black; // [sp+48040h] [bp-24h]@8
|
|
1212 int screenCenterY; // [sp+48044h] [bp-20h]@1
|
|
1213 unsigned int i; // [sp+48048h] [bp-1Ch]@9
|
|
1214 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
|
|
1215 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
|
|
1216 signed int screenWidth; // [sp+48054h] [bp-10h]@8
|
|
1217 unsigned int v95; // [sp+48058h] [bp-Ch]@16
|
|
1218 int v96; // [sp+4805Ch] [bp-8h]@10
|
|
1219 const void *v97; // [sp+48060h] [bp-4h]@16
|
|
1220 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
|
|
1221 int a5a; // [sp+48070h] [bp+Ch]@86
|
|
1222
|
|
1223 tl_x = tl_x;
|
|
1224 tl_y = tl_y;
|
|
1225 screenCenter_X = (signed int)(tl_x + br_x) >> 1;
|
|
1226 screenCenterY = (signed int)(tl_y + br_y) >> 1;
|
|
1227 surfPitch = pRenderer->uTargetSurfacePitch;
|
|
1228 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
|
|
1229 v5 = viewparams->field_2C;
|
|
1230 v6 = viewparams->sViewCenterX;
|
|
1231 v86 = viewparams->sViewCenterX;
|
|
1232 v84 = viewparams->sViewCenterY;
|
|
1233 if ( viewparams->field_2C != 384 )
|
|
1234 {
|
|
1235 if ( viewparams->field_2C == 768 )
|
|
1236 {
|
|
1237 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
1238 v5 = 680;
|
|
1239 }
|
|
1240 }
|
|
1241 else
|
|
1242 {
|
|
1243 v6 = viewparams->indoor_center_x;
|
|
1244 v86 = viewparams->indoor_center_x;
|
|
1245 v84 = viewparams->indoor_center_y;
|
|
1246 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
1247 v5 = viewparams->field_2C - 34;
|
|
1248 }
|
|
1249 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
|
|
1250 {
|
|
1251 screenWidth = br_x - tl_x + 1;
|
|
1252 screenHeight = br_y - tl_y + 1;
|
|
1253 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
|
|
1254 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
|
|
1255 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
|
|
1256 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5;
|
|
1257
|
|
1258 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
|
|
1259
|
|
1260
|
|
1261 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
|
|
1262 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
|
|
1263
|
|
1264 v32 = map_texture_16;
|
|
1265 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
|
|
1266 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16;
|
|
1267 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
|
|
1268 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
|
|
1269
|
|
1270 v76 = textr_width;
|
|
1271 scaled_posY = stepY_r >> 16;
|
|
1272 //nearest neiborhood scaling
|
|
1273 if ( texture8_data)
|
|
1274 {
|
|
1275 for(uint i=0; i<screenHeight;++i)
|
|
1276 {
|
|
1277 curr_line=&texture8_data[scaled_posY*textr_width];
|
|
1278 stepX_r=teal;
|
|
1279 for(uint j=0; j<screenWidth;++j)
|
|
1280 {
|
|
1281 scaled_posX=stepX_r>>16;
|
|
1282 map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
|
|
1283 stepX_r+=scale_increment;
|
|
1284 }
|
|
1285 stepY_r+=scale_increment;
|
|
1286 scaled_posY=stepY_r>>16;
|
|
1287 }
|
|
1288 }
|
|
1289 //move visible square to render
|
|
1290 for(uint i=0; i<screenHeight;++i)
|
|
1291 {
|
|
1292 if ( screenWidth > 0 )
|
|
1293 {
|
|
1294 memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
|
|
1295 }
|
|
1296 }
|
|
1297 }
|
|
1298 else
|
|
1299 {
|
|
1300 black = TargetColor(0, 0, 0);
|
|
1301 teal = TargetColor(0, 0xFFu, 0xFFu);
|
|
1302 v7 = pIndoor->pMapOutlines;
|
|
1303 uNumBlueFacesInBLVMinimap = 0;
|
|
1304 v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
|
|
1305 v9 = pIndoor->pMapOutlines->uNumOutlines < 0;
|
|
1306 screenWidth = 0;
|
|
1307 if ( !(v9 | v8) )
|
|
1308 {
|
|
1309 i = 0;
|
|
1310 do
|
|
1311 {
|
|
1312 v10 = (int)((char *)v7 + i + 4);
|
|
1313 v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes;
|
|
1314 if ( !(BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) ))
|
|
1315 {
|
|
1316 v12 = *(short *)((char *)v7 + i + 14);
|
|
1317 if ( !(v12 & 1) )
|
|
1318 {
|
|
1319 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 ))
|
|
1320 {
|
|
1321 v96 = (signed int)screenWidth >> 3;
|
|
1322 v13 = screenWidth;
|
|
1323 *(short *)(v10 + 10) = v12 | 1;
|
|
1324 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8);
|
|
1325 }
|
|
1326 }
|
|
1327 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1)
|
|
1328 {
|
|
1329 v14 = *(short *)v10;
|
|
1330 v88 = v5;
|
|
1331 v15 = &pIndoor->pVertices[v14];
|
|
1332 v16 = v15->x;
|
|
1333 v17 = v15->y - v84;
|
|
1334 v93 = (unsigned __int16 *)(v16 - v6);
|
|
1335 screenHeight = v17;
|
|
1336 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)];
|
|
1337 v19 = v18->x;
|
|
1338 v20 = v18->y - v84;
|
|
1339 v95 = v19 - v6;
|
|
1340 v97 = (const void *)v20;
|
|
1341 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16;
|
|
1342 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16;
|
|
1343 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16);
|
|
1344 screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16;
|
|
1345 pRenderer->RasterLine2D(
|
|
1346 screenCenter_X + v88,
|
|
1347 screenCenterY - v87,
|
|
1348 screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16),
|
|
1349 screenCenterY - screenHeight,
|
|
1350 black);
|
|
1351 v7 = pIndoor->pMapOutlines;
|
|
1352 }
|
|
1353 }
|
|
1354 ++screenWidth;
|
|
1355 i += 12;
|
|
1356 }
|
|
1357 while ( screenWidth < (signed int)v7->uNumOutlines );
|
|
1358 }
|
|
1359 v21 = 0;
|
|
1360 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
|
|
1361 {
|
|
1362 while ( 1 )
|
|
1363 {
|
|
1364 v22 = pBlueFacesInBLVMinimapIDs[v21];
|
|
1365 v87 = v5;
|
|
1366 v23 = &v7->pOutlines[v22];
|
|
1367 v24 = &pIndoor->pVertices[v23->uVertex1ID];
|
|
1368 v25 = &pIndoor->pVertices[v23->uVertex2ID];
|
|
1369 v26 = v25->x;
|
|
1370 v27 = (unsigned __int16 *)(v24->x - v86);
|
|
1371 v28 = v24->y - v84;
|
|
1372 v29 = v25->y - v84;
|
|
1373 v93 = v27;
|
|
1374 screenHeight = v28;
|
|
1375 v97 = (const void *)v29;
|
|
1376 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16;
|
|
1377 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16;
|
|
1378 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16;
|
|
1379 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16;
|
|
1380 pRenderer->RasterLine2D(
|
|
1381 screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16),
|
|
1382 screenCenterY - v88,
|
|
1383 screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16),
|
|
1384 screenCenterY - v95,
|
|
1385 teal);
|
|
1386 ++v21;
|
|
1387 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
|
|
1388 break;
|
|
1389 v7 = pIndoor->pMapOutlines;
|
|
1390 }
|
|
1391 v6 = v86;
|
|
1392 }
|
|
1393 }
|
|
1394 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3;
|
|
1395 v81 = pParty->vPosition.y - v84;
|
|
1396 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16);
|
|
1397 v48 = 1;
|
|
1398 v49 = screenCenterY - (int)v97 - 3;
|
|
1399 if ( v47 >= (signed int)tl_x )
|
|
1400 {
|
|
1401 if ( v47 > (signed int)br_x )
|
|
1402 {
|
|
1403 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x )
|
|
1404 v48 = 0;
|
|
1405 v47 = br_x;
|
|
1406 }
|
|
1407 }
|
|
1408 else
|
|
1409 {
|
|
1410 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x )
|
|
1411 v48 = 0;
|
|
1412 v47 = tl_x;
|
|
1413 }
|
|
1414 if ( v49 >= (signed int)tl_y )
|
|
1415 {
|
|
1416 if ( v49 > br_y )
|
|
1417 {
|
|
1418 if ( screenCenterY - (signed int)v97 - 6 > br_y )
|
|
1419 v48 = 0;
|
|
1420 v49 = br_y;
|
|
1421 }
|
|
1422 }
|
|
1423 else
|
|
1424 {
|
|
1425 if ( screenCenterY - (signed int)v97 < (signed int)tl_y )
|
|
1426 v48 = 0;
|
|
1427 v49 = tl_y;
|
|
1428 }
|
|
1429 if ( v48 == 1 )
|
|
1430 {
|
|
1431 v50 = 0;
|
|
1432 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
|
|
1433 if ( (signed int)(pParty->sRotationY & stru_5C6E00->uDoublePiMask) >= 128 )
|
|
1434 {
|
|
1435 if ( (signed int)v51 > 384 )
|
|
1436 {
|
|
1437 if ( (signed int)v51 >= 640 )
|
|
1438 {
|
|
1439 if ( (signed int)v51 > 896 )
|
|
1440 {
|
|
1441 if ( (signed int)v51 >= 1152 )
|
|
1442 {
|
|
1443 if ( (signed int)v51 > 1408 )
|
|
1444 {
|
|
1445 if ( (signed int)v51 >= 1664 )
|
|
1446 {
|
|
1447 if ( (signed int)v51 <= 1920 )
|
|
1448 v73 = 7;
|
|
1449 }
|
|
1450 else
|
|
1451 {
|
|
1452 v73 = 6;
|
|
1453 }
|
|
1454 }
|
|
1455 else
|
|
1456 {
|
|
1457 v73 = 5;
|
|
1458 }
|
|
1459 }
|
|
1460 else
|
|
1461 {
|
|
1462 v73 = 4;
|
|
1463 }
|
|
1464 }
|
|
1465 else
|
|
1466 {
|
|
1467 v73 = 3;
|
|
1468 }
|
|
1469 }
|
|
1470 else
|
|
1471 {
|
|
1472 v73 = 2;
|
|
1473 }
|
|
1474 if( (signed int)v51 <=1920)
|
|
1475 v50 = v73;
|
|
1476 }
|
|
1477 else
|
|
1478 v50 = 1;
|
|
1479 }
|
|
1480 pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
|
|
1481 }
|
|
1482 result = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
1483 v95 = 0;
|
|
1484 v86 = result;
|
|
1485 if ( (signed int)uNumLevelDecorations > 0 )
|
|
1486 {
|
|
1487 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition;
|
|
1488 do
|
|
1489 {
|
|
1490 if ( *(char *)(screenWidth - 2) & 8 )
|
|
1491 {
|
|
1492 v53 = *(int *)(screenWidth + 4) - v84;
|
|
1493 v93 = (unsigned __int16 *)(*(int *)screenWidth - v6);
|
|
1494 screenHeight = v53;
|
|
1495 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
|
|
1496 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16);
|
|
1497 v55 = screenCenterY - (int)v97;
|
|
1498 if ( v54 >= pRenderer->raster_clip_x )
|
|
1499 {
|
|
1500 if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
|
|
1501 {
|
|
1502 v74 = v86;
|
|
1503 if ( v5 > 512 )
|
|
1504 {
|
|
1505 v96 = v55 + 1;
|
|
1506 black = v55 - 1;
|
|
1507 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86);
|
|
1508 pRenderer->RasterLine2D(v54, black, v54, v96, v86);
|
|
1509 ++v54;
|
|
1510 v74 = v86;
|
|
1511 v72 = v96;
|
|
1512 v71 = v54;
|
|
1513 v70 = black;
|
|
1514 }
|
|
1515 else
|
|
1516 {
|
|
1517 v72 = screenCenterY - (int)v97;
|
|
1518 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
|
|
1519 v70 = screenCenterY - (int)v97;
|
|
1520 }
|
|
1521 pRenderer->RasterLine2D(v54, v70, v71, v72, v74);
|
|
1522 }
|
|
1523 }
|
|
1524 }
|
|
1525 ++v95;
|
|
1526 result = v95;
|
|
1527 screenWidth += 32;
|
|
1528 }
|
|
1529 while ( (signed int)v95 < (signed int)uNumLevelDecorations );
|
|
1530 }
|
|
1531 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
|
|
1532 {
|
|
1533 screenCenterY = br_x - tl_x + 1;
|
|
1534 v95 = br_y - tl_y + 1;
|
|
1535 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
|
|
1536 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
|
|
1537 black = (1 << (v56 + 16)) / v5;
|
|
1538 v57 = (double)(1 << (16 - v56));
|
|
1539 v58 = 22528 / (v5 / 384);
|
|
1540 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57);
|
|
1541 v60 = (int)v59 << 16;
|
|
1542 v97 = (const void *)((int)v59 << 16);
|
|
1543 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57);
|
|
1544 pPalette_16 = (unsigned __int16 *)(v60 >> 16);
|
|
1545 v62 = (int)v61 << 16;
|
|
1546 teal = v60 >> 16;
|
|
1547 v63 = (signed __int16)v61;
|
|
1548 a4a = map_texture_16;
|
|
1549 result = TargetColor(0xCu, 0xCu, 0xCu);
|
|
1550 screenCenter_X = 0;
|
|
1551 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X )
|
|
1552 {
|
|
1553 a5a = 0;
|
|
1554 if ( screenCenterY > 0 )
|
|
1555 {
|
|
1556 v96 = (v63 - 80) / 4;
|
|
1557 v64 = teal;
|
|
1558 do
|
|
1559 {
|
|
1560 v81 = (v64 - 80) / 4;
|
|
1561 if ( !pOutdoor->_47F04C(v81, v96) )
|
|
1562 {
|
|
1563 if ( pOutdoor->_47F097(v81, v96) )
|
|
1564 {
|
|
1565 if ( !((a5a + screenCenter_X) % 2) )
|
|
1566 *a4a = i;
|
|
1567 }
|
|
1568 else
|
|
1569 {
|
|
1570 *a4a = 0;
|
|
1571 }
|
|
1572 }
|
|
1573 ++a4a;
|
|
1574 v97 = (char *)v97 + black;
|
|
1575 v64 = (signed int)v97 >> 16;
|
|
1576 ++a5a;
|
|
1577 }
|
|
1578 while ( a5a < screenCenterY );
|
|
1579 }
|
|
1580 v62 += black;
|
|
1581 v97 = (const void *)v60;
|
|
1582 a4a += screenCenterY - a5a;
|
|
1583 v63 = v62 >> 16;
|
|
1584 ++screenCenter_X;
|
|
1585 teal = (unsigned int)pPalette_16;
|
|
1586 }
|
|
1587 v65 = v95;
|
|
1588 v66 = map_texture_16;
|
|
1589 if ( (signed int)v95 > 0 )
|
|
1590 {
|
|
1591 v67 = v77;
|
|
1592 result = 2 * (surfPitch - screenCenterY);
|
|
1593 do
|
|
1594 {
|
|
1595 if ( screenCenterY > 0 )
|
|
1596 {
|
|
1597 v68 = screenCenterY;
|
|
1598 do
|
|
1599 {
|
|
1600 v69 = *(short *)v66;
|
|
1601 if ( !*(short *)v66 || v69 == (short)i )
|
|
1602 *v67 = v69;
|
|
1603 ++v66;
|
|
1604 ++v67;
|
|
1605 --v68;
|
|
1606 }
|
|
1607 while ( v68 );
|
|
1608 }
|
|
1609 v67 = (unsigned __int16 *)((char *)v67 + result);
|
|
1610 --v65;
|
|
1611 }
|
|
1612 while ( v65 );
|
|
1613 }
|
|
1614 }
|
|
1615 }
|
|
1616
|
|
1617
|
|
1618
|
|
1619
|
|
1620
|
|
1621 //----- (00412AF9) --------------------------------------------------------
|
|
1622 static void BookUI_Spellbook_DrawCurrentSchoolBackground()
|
|
1623 {
|
|
1624 int v0; // ecx@1
|
|
1625
|
|
1626 v0 = 0;
|
|
1627 if ( uActiveCharacter )
|
|
1628 v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2);
|
|
1629 pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]);
|
|
1630 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C);
|
|
1631 pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448);
|
|
1632 }
|
|
1633
|
|
1634
|
|
1635
|
|
1636
|
|
1637
|
|
1638 //----- (00412B58) --------------------------------------------------------
|
|
1639 void DrawSpellBookContent(Player *player)
|
|
1640 {
|
|
1641 //Player *v0; // ebx@1
|
|
1642 int v1; // ebp@1
|
|
1643 //unsigned int v2; // eax@1
|
|
1644 Texture *v3; // edi@1
|
|
1645 int v4; // esi@1
|
|
1646 Texture *v5; // eax@3
|
|
1647 Texture *v6; // edx@5
|
|
1648 int v7; // eax@8
|
|
1649 int v8; // eax@11
|
|
1650 POINT *v9; // esi@13
|
|
1651 int v10; // eax@13
|
|
1652 Texture *v11; // edx@14
|
|
1653 int v12; // eax@15
|
|
1654 signed int v13; // ecx@18
|
|
1655 unsigned int v14; // esi@18
|
|
1656 unsigned int v15; // edi@18
|
|
1657 Texture *pPageTexture; // eax@21
|
|
1658 unsigned int v17; // [sp-Ch] [bp-2Ch]@8
|
|
1659 unsigned int v18; // [sp-Ch] [bp-2Ch]@15
|
|
1660 unsigned int v19; // [sp-8h] [bp-28h]@8
|
|
1661 unsigned int v20; // [sp-8h] [bp-28h]@15
|
|
1662 Texture *v21; // [sp-4h] [bp-24h]@15
|
|
1663 signed int v22; // [sp-4h] [bp-24h]@22
|
|
1664 Texture *v23; // [sp+10h] [bp-10h]@5
|
|
1665 POINT a2; // [sp+18h] [bp-8h]@13
|
|
1666 POINT v24;
|
|
1667 int v25;
|
|
1668
|
|
1669 static unsigned int texture_tab_coord1[9][2]=
|
|
1670 {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} };
|
|
1671
|
|
1672 static unsigned int texture_tab_coord0[9][2]=
|
|
1673 {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} };
|
|
1674
|
|
1675 BookUI_Spellbook_DrawCurrentSchoolBackground();
|
|
1676
|
|
1677 //v0 = pPlayers[uActiveCharacter];
|
|
1678 v1 = 11 * player->lastOpenedSpellbookPage;
|
|
1679 //v2 = pIcons_LOD->FindTextureByName("Pending");
|
|
1680 v3 = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending"));
|
|
1681 pRenderer->ClearZBuffer(0, 479);
|
|
1682 v4 = 1;
|
|
1683 if ( __OFSUB__(v1, v1 + 11) ^ 1 )
|
|
1684 {
|
|
1685 do
|
|
1686 {
|
|
1687 if ( *(&player->_guilds_member_bits[v1 + 63] + v4) )
|
|
1688 {
|
|
1689 v5 = (Texture *)dword_506408[v4];
|
|
1690 if ( v5 != v3 )
|
|
1691 {
|
|
1692 if ( quick_spell_at_page == v4 )
|
|
1693 {
|
|
1694 v6 = dword_5063D8[v4];
|
|
1695 v23 = dword_5063D8[v4];
|
|
1696 }
|
|
1697 else
|
|
1698 {
|
|
1699 v23 = dword_506408[v4];
|
|
1700 v6 = v5;
|
|
1701 }
|
|
1702 if ( v6->pLevelOfDetail0_prolly_alpha_mask )
|
|
1703 {
|
|
1704 v7 = player->lastOpenedSpellbookPage;
|
|
1705 // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
|
|
1706 v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
|
|
1707 v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
|
|
1708 if ( BYTE1(v6->pBits) & 2 )
|
|
1709 pRenderer->DrawTextureTransparent(v17, v19, v6);
|
|
1710 else
|
|
1711 pRenderer->DrawTextureIndexed(v17, v19, v6);
|
|
1712 pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos,
|
|
1713 pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4);
|
|
1714 }
|
|
1715 }
|
|
1716 }
|
|
1717 ++v4;
|
|
1718 }
|
|
1719 while ( v4 - 1 < 11 );
|
|
1720 }
|
|
1721
|
|
1722
|
|
1723 v9 = pMouse->GetCursorPos(&a2);
|
|
1724 v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
|
|
1725 if ( v10 )
|
|
1726 {
|
|
1727 v11 = dword_5063D8[v10];
|
|
1728 if ( v11->pLevelOfDetail0_prolly_alpha_mask )
|
|
1729 {
|
|
1730 v21 = dword_5063D8[v10];
|
|
1731 v12 = player->lastOpenedSpellbookPage;
|
|
1732 // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
|
|
1733 v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
|
|
1734 v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
|
|
1735 if ( BYTE1(v11->pBits) & 2 )
|
|
1736 pRenderer->DrawTextureTransparent(v18, v20, v21);
|
|
1737 else
|
|
1738 pRenderer->DrawTextureIndexed(v18, v20, v21);
|
|
1739 }
|
|
1740 }
|
|
1741 v13 = 0;
|
|
1742 a2.x = (LONG)&player->pActiveSkills[12];
|
|
1743 v14 = (unsigned int)&player->pActiveSkills[12];
|
|
1744 v15 = (unsigned int)&player->pActiveSkills[12];
|
|
1745 v25 = 0;
|
|
1746 do
|
|
1747 {
|
|
1748 if ( *(short *)a2.x )
|
|
1749 {
|
|
1750 if ( player->lastOpenedSpellbookPage == v13 )
|
|
1751 {
|
|
1752 pPageTexture = pTextures_tabs[v13][1];
|
|
1753 v14=texture_tab_coord1[v13][0];
|
|
1754 v15=texture_tab_coord1[v13][1];
|
|
1755 }
|
|
1756 else
|
|
1757 {
|
|
1758 pPageTexture = pTextures_tabs[v13][0];
|
|
1759 v14=texture_tab_coord0[v13][0];
|
|
1760 v15=texture_tab_coord0[v13][1];
|
|
1761 }
|
|
1762 pRenderer->DrawTextureTransparent(v14, v15, pPageTexture);
|
|
1763 v13 = v25;
|
|
1764 }
|
|
1765 a2.x += 2;
|
|
1766 ++v13;
|
|
1767 v25 = v13;
|
|
1768 }
|
|
1769 while ( v13 < 9 );
|
|
1770 } |