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