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