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