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