comparison UIBooks.cpp @ 1026:6afa77761a00

Слияние
author Ritor1
date Tue, 21 May 2013 12:43:08 +0600
parents 9ac94d00012e
children 39f42990698f
comparison
equal deleted inserted replaced
1025:8b492d4722d4 1026:6afa77761a00
1 #include <assert.h> 1 #include <assert.h>
2 2
3 #include "MM7.h" 3 #include "MM7.h"
4 4
5 #include "Mouse.h"
6
5 #include "MapInfo.h" 7 #include "MapInfo.h"
6 #include "Game.h"
7 #include "GUIWindow.h" 8 #include "GUIWindow.h"
8 #include "GUIFont.h" 9 #include "GUIFont.h"
9 #include "GUIProgressBar.h"
10 #include "Party.h" 10 #include "Party.h"
11 #include "AudioPlayer.h" 11 #include "AudioPlayer.h"
12 #include "Outdoor.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" 13 #include "LOD.h"
18 #include "Actor.h"
19 #include "Allocator.h" 14 #include "Allocator.h"
20 #include "Events.h"
21 #include "Viewport.h" 15 #include "Viewport.h"
22 #include "FrameTableInc.h"
23 #include "Math.h" 16 #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" 17 #include "Awards.h"
34 #include "Autonotes.h" 18 #include "Autonotes.h"
35 #include "stru160.h"
36 #include "TurnEngine.h"
37 #include "CastSpellInfo.h"
38 #include "Weather.h"
39 #include "stru298.h"
40 #include "StorylineTextTable.h" 19 #include "StorylineTextTable.h"
41 #include "Events2D.h"
42 #include "texts.h" 20 #include "texts.h"
43 21
44 #include "mm7_data.h" 22 #include "mm7_data.h"
45 23
46 24
56 switch (book) 34 switch (book)
57 { 35 {
58 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; 36 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
59 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; 37 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
60 case WINDOW_MapsBook: BookUI_Map_Draw(); break; 38 case WINDOW_MapsBook: BookUI_Map_Draw(); break;
61 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; 39 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
40 case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
41
62 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; 42 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
63 case WINDOW_TownPortal: DrawTownPortalScreen(); break; 43 case WINDOW_TownPortal: DrawTownPortalScreen(); break;
64 case WINDOW_HistoryBook: DrawBook_History(); break; 44 }
65 } 45 }
46
47
48
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"
66 } 60 }
67 61
68 62
69 63
70 //----- (00413D6F) -------------------------------------------------------- 64 //----- (00413D6F) --------------------------------------------------------
71 void BookUI_Calendar_Draw() 65 void BookUI_Calendar_Draw()
72 { 66 {
73 unsigned int v0; // esi@1 67 unsigned int v0; // esi@1
74 char *v1; // eax@5 68 //char *v1; // eax@5
75 int v2; // ecx@5 69 int v2; // ecx@5
76 char *v3; // eax@6 70 char *v3; // eax@6
77 GUIWindow a1; // [sp+Ch] [bp-60h]@5 71 GUIWindow a1; // [sp+Ch] [bp-60h]@5
78 unsigned int v6; // [sp+60h] [bp-Ch]@1 72 unsigned int v6; // [sp+60h] [bp-Ch]@1
79 int v7; // [sp+64h] [bp-8h]@1 73 //int v7; // [sp+64h] [bp-8h]@1
80 int a5; // [sp+68h] [bp-4h]@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
81 89
82 v0 = pParty->uCurrentHour; 90 v0 = pParty->uCurrentHour;
83 v6 = pMapStats->GetMapInfo(pCurrentMapName);
84 a5 = TargetColor(0x4Bu, 0x4Bu, 0x4Bu);
85 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); 91 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
86 v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed];
87 if ( (signed int)v0 <= 12 ) 92 if ( (signed int)v0 <= 12 )
88 { 93 {
89 if ( !v0 ) 94 if ( !v0 )
90 v0 = 12; 95 v0 = 12;
91 } 96 }
97 a1.uFrameY = game_viewport_y; 102 a1.uFrameY = game_viewport_y;
98 a1.uFrameWidth = game_viewport_width; 103 a1.uFrameWidth = game_viewport_width;
99 a1.uFrameHeight = game_viewport_height; 104 a1.uFrameHeight = game_viewport_height;
100 a1.uFrameZ = game_viewport_z; 105 a1.uFrameZ = game_viewport_z;
101 a1.uFrameW = game_viewport_w; 106 a1.uFrameW = game_viewport_w;
102 a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[186], 3u); 107 a1.DrawTitleText(pBook2Font, 0, 0x16u, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia"
108
109 v2 = 0;
103 if ( pParty->uCurrentHour >= 12 ) 110 if ( pParty->uCurrentHour >= 12 )
104 { 111 {
105 if ( pParty->uCurrentHour >= 24 ) 112 if ( pParty->uCurrentHour >= 24 )
106 v2=0; 113 v2=0;
107 else 114 else
108 v2=1; 115 v2=1;
109 } 116 }
110 else 117
111 v2=0; 118 sprintf(pTmpBuf, "%s\t100:\t110%d:%02d %s - %s",
112 v1 = GetDayPart(); 119 pGlobalTXT_LocalizationStrings[526], // "Time"
113 sprintf( 120 v0,
114 pTmpBuf, 121 pParty->uCurrentMinute,
115 "%s\t100:\t110%d:%02d %s - %s", 122 aAMPMNames[v2],
116 pGlobalTXT_LocalizationStrings[526], 123 GetDayPart());
117 v0, 124 a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf, 0, 0, 0);
118 pParty->uCurrentMinute, 125
119 aAMPMNames[v2], 126 sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
120 v1); 127 pGlobalTXT_LocalizationStrings[56], // "Day"
121 a1.DrawText(pBookFont, 70, 55, a5, pTmpBuf, 0, 0, 0); 128 pParty->uDaysPlayed + 1,
122 sprintf( 129 aDayNames[pParty->uDaysPlayed % 7]);
123 pTmpBuf, 130 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf, 0, 0, 0);
124 "%s\t100:\t110%d - %s", 131
125 pGlobalTXT_LocalizationStrings[56], 132 sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
126 pParty->uDaysPlayed + 1, 133 pGlobalTXT_LocalizationStrings[146], // "Month"
127 aDayNames[pParty->uDaysPlayed % 7]); 134 pParty->uCurrentMonth + 1,
128 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, a5, pTmpBuf, 0, 0, 0); 135 aMonthNames[pParty->uCurrentMonth]);
129 sprintf( 136 a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf, 0, 0, 0);
130 pTmpBuf, 137
131 "%s\t100:\t110%d - %s", 138 sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
132 pGlobalTXT_LocalizationStrings[146], 139 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf, 0, 0, 0);
133 pParty->uCurrentMonth + 1, 140
134 aMonthNames[pParty->uCurrentMonth]); 141 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
135 a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, a5, pTmpBuf, 0, 0, 0); 142 a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf, 0, 0, 0);
136 sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); 143
137 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, a5, pTmpBuf, 0, 0, 0); 144 v6 = pMapStats->GetMapInfo(pCurrentMapName);
138 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[v7]);
139 a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, a5, pTmpBuf, 0, 0, 0);
140 if ( v6 ) 145 if ( v6 )
141 v3 = pMapStats->pInfos[v6].pName; 146 v3 = pMapStats->pInfos[v6].pName;
142 else 147 else
143 v3 = "Unknown"; 148 v3 = "Unknown";
144 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); 149 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
145 a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, a5, pTmpBuf, 0, 0, 0); 150 a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf, 0, 0, 0);
146 } 151 }
147 152
148 153
149 154
150 //----- (0041192C) -------------------------------------------------------- 155 //----- (0041192C) --------------------------------------------------------
157 162
158 ++pIcons_LOD->uTexturePacksCount; 163 ++pIcons_LOD->uTexturePacksCount;
159 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 164 if ( !pIcons_LOD->uNumPrevLoadedFiles )
160 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 165 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
161 166
162 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 167 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
163 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); 168 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
164 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); 169 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
165 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); 170 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
166 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); 171 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
167 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); 172 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
168 //v0 = 1; 173 //v0 = 1;
169 174
170 static const char *texNames[9] = 175 static const char *texNames[9] = // 004E24EC
171 { 176 {
172 "SBFB00", "SBAB00", "SBWB00", "SBEB00", 177 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
173 "SBSB00", "SBMB00", "SBBB00", "SBLB00", 178 "SBSB00", "SBMB00", "SBBB00", "SBLB00",
174 }; 179 };
175 180
189 194
190 //----- (00411AAA) -------------------------------------------------------- 195 //----- (00411AAA) --------------------------------------------------------
191 void InitializeBookFonts() 196 void InitializeBookFonts()
192 { 197 {
193 pAudioPlayer->StopChannels(-1, -1); 198 pAudioPlayer->StopChannels(-1, -1);
199
194 ++pIcons_LOD->uTexturePacksCount; 200 ++pIcons_LOD->uTexturePacksCount;
195 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 201 if ( !pIcons_LOD->uNumPrevLoadedFiles )
196 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 202 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
197 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 203
204 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
198 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); 205 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
199 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); 206 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
200 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); 207 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
201 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); 208 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
202 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); 209 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
241 } 248 }
242 } 249 }
243 } 250 }
244 251
245 //----- (0041140B) -------------------------------------------------------- 252 //----- (0041140B) --------------------------------------------------------
246 GUIWindow *sub_41140B() 253 void sub_41140B()
247 { 254 {
248 signed int v0; // esi@1 255 signed int v0; // esi@1
249 GUIButton *v1; // eax@3 256 GUIButton *v1; // eax@3
250 GUIButton *v2; // esi@4 257 GUIButton *v2; // esi@4
251 GUIWindow *result; // eax@5
252 258
253 v0 = 0; 259 v0 = 0;
254 do 260 do
255 { 261 {
256 dword_5063D8[11+v0]->Release(); 262 dword_5063D8[11+v0]->Release();
257 dword_506408[11+v0]->Release(); 263 dword_506408[11+v0]->Release();
258 --v0; 264 --v0;
259 } 265 }
260 while ( v0 >= -11 ); 266 while ( v0 >= -11 );
261 pIcons_LOD->_40F9C5(); 267 pIcons_LOD->SyncLoadedFilesCount();
262 v1 = pGUIWindow_CurrentMenu->pControlsHead; 268 v1 = pGUIWindow_CurrentMenu->pControlsHead;
263 if ( v1 ) 269 if ( v1 )
264 { 270 {
265 do 271 do
266 { 272 {
270 } 276 }
271 while ( v2 ); 277 while ( v2 );
272 } 278 }
273 pGUIWindow_CurrentMenu->pControlsHead = 0; 279 pGUIWindow_CurrentMenu->pControlsHead = 0;
274 pGUIWindow_CurrentMenu->pControlsTail = 0; 280 pGUIWindow_CurrentMenu->pControlsTail = 0;
275 result = pGUIWindow_CurrentMenu;
276 pGUIWindow_CurrentMenu->uNumControls = 0; 281 pGUIWindow_CurrentMenu->uNumControls = 0;
277 return result;
278 } 282 }
279 283
280 //----- (00411473) -------------------------------------------------------- 284 //----- (00411473) --------------------------------------------------------
281 void sub_411473() 285 void sub_411473()
282 { 286 {
287 { 291 {
288 pSpellBookPagesTextr[i]->Release(); 292 pSpellBookPagesTextr[i]->Release();
289 pTextures_tabs[i][0]->Release(); 293 pTextures_tabs[i][0]->Release();
290 pTextures_tabs[i][1]->Release(); 294 pTextures_tabs[i][1]->Release();
291 } 295 }
292 pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); 296 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
293 pIcons_LOD->_4114F2(); 297 pIcons_LOD->_4114F2();
294 } 298 }
295 299
296 300
297 //----- (00411597) -------------------------------------------------------- 301 //----- (00411597) --------------------------------------------------------
298 void OnCloseSpellBook() 302 void OnCloseSpellBook()
299 { 303 {
300 pAllocator->FreeChunk(pSpellFont); 304 pAllocator->FreeChunk(pSpellFont);
301 pSpellFont = 0; 305 pSpellFont = nullptr;
302 pAllocator->FreeChunk(pBookFont); 306 pAllocator->FreeChunk(pBookFont);
303 pBookFont = 0; 307 pBookFont = nullptr;
304 pAllocator->FreeChunk(pBook2Font); 308 pAllocator->FreeChunk(pBook2Font);
305 pBook2Font = 0; 309 pBook2Font = nullptr;
306 pAllocator->FreeChunk(pAutonoteFont); 310 pAllocator->FreeChunk(pAutonoteFont);
307 pAutonoteFont = 0; 311 pAutonoteFont = nullptr;
308 pTexture_mapbordr->Release(); 312 pTexture_mapbordr->Release();
309 pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); 313 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
310 pIcons_LOD->_4114F2(); 314 pIcons_LOD->_4114F2();
311 dword_506364 = 0; 315 dword_506364 = 0;
312 } 316 }
313 // 506364: using guessed type int dword_506364; 317
314 318
315 319
316 320
317 321
318 322
319
320
321 //----- (00412AF9) --------------------------------------------------------
322 void sub_412AF9()
323 {
324 int v0; // ecx@1
325
326 v0 = 0;
327 if ( uActiveCharacter )
328 v0 = pParty->pPlayers[uActiveCharacter-1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2);
329 pRenderer->DrawTextureIndexed(8u, 8u, pSpellBookPagesTextr[v0]);
330 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C);
331 pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448);
332 }
333
334 //----- (00412B58) --------------------------------------------------------
335 void DrawSpellBookContent()
336 {
337 Player *v0; // ebx@1
338 int v1; // ebp@1
339 unsigned int v2; // eax@1
340 Texture *v3; // edi@1
341 int v4; // esi@1
342 Texture *v5; // eax@3
343 Texture *v6; // edx@5
344 int v7; // eax@8
345 int v8; // eax@11
346 POINT *v9; // esi@13
347 int v10; // eax@13
348 Texture *v11; // edx@14
349 int v12; // eax@15
350 signed int v13; // ecx@18
351 unsigned int v14; // esi@18
352 unsigned int v15; // edi@18
353 Texture *pPageTexture; // eax@21
354 unsigned int v17; // [sp-Ch] [bp-2Ch]@8
355 unsigned int v18; // [sp-Ch] [bp-2Ch]@15
356 unsigned int v19; // [sp-8h] [bp-28h]@8
357 unsigned int v20; // [sp-8h] [bp-28h]@15
358 Texture *v21; // [sp-4h] [bp-24h]@15
359 signed int v22; // [sp-4h] [bp-24h]@22
360 Texture *v23; // [sp+10h] [bp-10h]@5
361 POINT a2; // [sp+18h] [bp-8h]@13
362 POINT v24;
363 int v25;
364
365 sub_412AF9();
366 v0 = pPlayers[uActiveCharacter];
367 v1 = 11 * v0->lastOpenedSpellbookPage;
368 v2 = pIcons_LOD->FindTextureByName("Pending");
369 v3 = pIcons_LOD->GetTexture(v2);
370 pRenderer->ClearZBuffer(0, 479);
371 v4 = 1;
372 if ( __OFSUB__(v1, v1 + 11) ^ 1 )
373 {
374 do
375 {
376 if ( *(&v0->_guilds_member_bits[v1 + 63] + v4) )
377 {
378 v5 = (Texture *)dword_506408[v4];
379 if ( v5 != v3 )
380 {
381 if ( quick_spell_at_page == v4 )
382 {
383 v6 = dword_5063D8[v4];
384 v23 = dword_5063D8[v4];
385 }
386 else
387 {
388 v23 = dword_506408[v4];
389 v6 = v5;
390 }
391 if ( v6->pLevelOfDetail0_prolly_alpha_mask )
392 {
393 v7 = v0->lastOpenedSpellbookPage;
394 // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
395 v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
396 v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
397 if ( BYTE1(v6->pBits) & 2 )
398 pRenderer->DrawTextureTransparent(v17, v19, v6);
399 else
400 pRenderer->DrawTextureIndexed(v17, v19, v6);
401 pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos,
402 pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4);
403 }
404 }
405 }
406 ++v4;
407 }
408 while ( v4 + v1 - 1 < v1 + 11 );
409 }
410 v9 = pMouse->GetCursorPos(&a2);
411 v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
412 if ( v10 )
413 {
414 v11 = dword_5063D8[v10];
415 if ( v11->pLevelOfDetail0_prolly_alpha_mask )
416 {
417 v21 = dword_5063D8[v10];
418 v12 = v0->lastOpenedSpellbookPage;
419 // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
420 v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
421 v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
422 if ( BYTE1(v11->pBits) & 2 )
423 pRenderer->DrawTextureTransparent(v18, v20, v21);
424 else
425 pRenderer->DrawTextureIndexed(v18, v20, v21);
426 }
427 }
428 v13 = 0;
429 a2.x = (LONG)&v0->pActiveSkills[12];
430 v14 = (unsigned int)&v0->pActiveSkills[12];
431 v15 = (unsigned int)&v0->pActiveSkills[12];
432 v25 = 0;
433 do
434 {
435 if ( *(short *)a2.x )
436 {
437 if ( v0->lastOpenedSpellbookPage == v13 )
438 {
439 pPageTexture = pTextures_tabs[v13][1];
440 switch ( v13 )
441 {
442 case 0:
443 v14 = 406;
444 v22 = 9;
445 goto LABEL_27;
446 case 1:
447 v14 = 406;
448 goto LABEL_38;
449 case 2:
450 v14 = 406;
451 v22 = 84;
452 goto LABEL_27;
453 case 3:
454 v14 = 406;
455 goto LABEL_26;
456 case 4:
457 v14 = 407;
458 goto LABEL_29;
459 case 5:
460 v15 = 196;
461 goto LABEL_34;
462 case 6:
463 v15 = 234;
464 goto LABEL_34;
465 case 7:
466 v15 = 272;
467 goto LABEL_34;
468 case 8:
469 v15 = 309;
470 LABEL_34:
471 v14 = 405;
472 break;
473 default:
474 break;
475 }
476 }
477 else
478 {
479 pPageTexture = pTextures_tabs[v13][0];
480 switch ( v13 )
481 {
482 case 0:
483 v14 = 415;
484 v22 = 10;
485 goto LABEL_27;
486 case 1:
487 v14 = 415;
488 LABEL_38:
489 v22 = 46;
490 goto LABEL_27;
491 case 2:
492 v14 = 415;
493 v22 = 83;
494 goto LABEL_27;
495 case 3:
496 v14 = 415;
497 LABEL_26:
498 v22 = 121;
499 LABEL_27:
500 v15 = v22;
501 break;
502 case 4:
503 v14 = 415;
504 LABEL_29:
505 v15 = 158;
506 break;
507 case 5:
508 v15 = 196;
509 goto LABEL_46;
510 case 6:
511 v15 = 234;
512 goto LABEL_46;
513 case 7:
514 v15 = 271;
515 goto LABEL_46;
516 case 8:
517 v15 = 307;
518 LABEL_46:
519 v14 = 416;
520 break;
521 default:
522 break;
523 }
524 }
525 pRenderer->DrawTextureTransparent(v14, v15, pPageTexture);
526 v13 = v25;
527 }
528 a2.x += 2;
529 ++v13;
530 v25 = v13;
531 }
532 while ( v13 < 9 );
533 }
534 // 506408: using guessed type int dword_506408[];
535 // 50654C: using guessed type int dword_50654C;
536 323
537 //----- (00412E85) -------------------------------------------------------- 324 //----- (00412E85) --------------------------------------------------------
538 void DrawBook_History() 325 void BookUI_Journal_Draw()
539 { 326 {
540 unsigned int v0; // eax@3 327 unsigned int v0; // eax@3
541 unsigned int v1; // eax@7 328 unsigned int v1; // eax@7
542 int v2; // eax@10 329 int v2; // eax@10
543 const char *v3; // eax@10 330 const char *v3; // eax@10
565 v13 = pTex_tab_an_6b__zoom_on; 352 v13 = pTex_tab_an_6b__zoom_on;
566 v11 = pViewport->uViewportTL_Y + 1; 353 v11 = pViewport->uViewportTL_Y + 1;
567 v0 = pViewport->uViewportTL_X + 398; 354 v0 = pViewport->uViewportTL_X + 398;
568 } 355 }
569 pRenderer->DrawTextureTransparent(v0, v11, v13); 356 pRenderer->DrawTextureTransparent(v0, v11, v13);
357
570 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) 358 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
571 { 359 {
572 v14 = pTex_tab_an_7a__zoot_off; 360 v14 = pTex_tab_an_7a__zoot_off;
573 v12 = pViewport->uViewportTL_Y + 38; 361 v12 = pViewport->uViewportTL_Y + 38;
574 v1 = pViewport->uViewportTL_X + 407; 362 v1 = pViewport->uViewportTL_X + 407;
578 v14 = pTex_tab_an_7b__zoot_on; 366 v14 = pTex_tab_an_7b__zoot_on;
579 v12 = pViewport->uViewportTL_Y + 38; 367 v12 = pViewport->uViewportTL_Y + 38;
580 v1 = pViewport->uViewportTL_X + 398; 368 v1 = pViewport->uViewportTL_X + 398;
581 } 369 }
582 pRenderer->DrawTextureTransparent(v1, v12, v14); 370 pRenderer->DrawTextureTransparent(v1, v12, v14);
371
583 if ( !byte_5C6D50[dword_506528] ) 372 if ( !byte_5C6D50[dword_506528] )
584 { 373 {
585 v2 = achieved_awards[dword_506528]; 374 v2 = achieved_awards[dword_506528];
586 a1.uFrameWidth = game_viewport_width; 375 a1.uFrameWidth = game_viewport_width;
587 a1.uFrameX = game_viewport_x; 376 a1.uFrameX = game_viewport_x;
589 a1.uFrameHeight = game_viewport_height; 378 a1.uFrameHeight = game_viewport_height;
590 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; 379 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[];
591 a1.uFrameZ = game_viewport_z; 380 a1.uFrameZ = game_viewport_z;
592 a1.uFrameW = game_viewport_w; 381 a1.uFrameW = game_viewport_w;
593 if ( v3 ) 382 if ( v3 )
594 a1.DrawTitleText(pBook2Font, 0, 22, 0, v3, 3); 383 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3);
595 } 384 }
385
596 a1.uFrameX = 48; 386 a1.uFrameX = 48;
597 a1.uFrameY = 70; 387 a1.uFrameY = 70;
598 a1.uFrameWidth = 360; 388 a1.uFrameWidth = 360;
599 a1.uFrameHeight = 264; 389 a1.uFrameHeight = 264;
600 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3; 390 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
601 a1.uFrameZ = 407; 391 a1.uFrameZ = 407;
602 a1.uFrameHeight = v4 * 264 / v4; 392 a1.uFrameHeight = v4 * 264 / v4;
603 a1.uFrameW = a1.uFrameHeight + 69; 393 a1.uFrameW = a1.uFrameHeight + 69;
604 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) 394 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
605 { 395 {
606 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 396 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
607 v5 = dword_50651C++; 397 v5 = dword_50651C++;
608 dword_506528 += num_achieved_awards; 398 dword_506528 += num_achieved_awards;
609 byte_506130[v5] = num_achieved_awards; 399 byte_506130[v5] = num_achieved_awards;
610 } 400 }
611 if ( BtnUp_flag && dword_50651C ) 401 if ( BtnUp_flag && dword_50651C )
612 { 402 {
613 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 403 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
614 --dword_50651C; 404 --dword_50651C;
615 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 405 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
616 } 406 }
617 if ( !num_achieved_awards || dword_506528 < 1 ) 407 if ( !num_achieved_awards || dword_506528 < 1 )
618 { 408 {
633 0, 423 0,
634 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); 424 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
635 if ( v7 ) 425 if ( v7 )
636 { 426 {
637 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]); 427 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
638 a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); 428 a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow);
639 ++num_achieved_awards; 429 ++num_achieved_awards;
640 } 430 }
641 } 431 }
642 432
643 433
699 a1.uFrameHeight = 264; 489 a1.uFrameHeight = 264;
700 a1.uFrameZ = 407; 490 a1.uFrameZ = 407;
701 a1.uFrameW = 333; 491 a1.uFrameW = 333;
702 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) 492 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
703 { 493 {
704 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 494 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
705 v2 = dword_50651C++; 495 v2 = dword_50651C++;
706 dword_506528 += num_achieved_awards; 496 dword_506528 += num_achieved_awards;
707 byte_506130[v2] = num_achieved_awards; 497 byte_506130[v2] = num_achieved_awards;
708 } 498 }
709 if ( BtnUp_flag && dword_50651C ) 499 if ( BtnUp_flag && dword_50651C )
710 { 500 {
711 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 501 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
712 --dword_50651C; 502 --dword_50651C;
713 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 503 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
714 } 504 }
715 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) ) 505 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) )
716 { 506 {
1000 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 ) 790 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 )
1001 { 791 {
1002 v11 = dword_50651C++; 792 v11 = dword_50651C++;
1003 byte_506130[v11] = num_achieved_awards; 793 byte_506130[v11] = num_achieved_awards;
1004 dword_506528 = v10; 794 dword_506528 = v10;
1005 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 795 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
1006 } 796 }
1007 } 797 }
1008 if ( BtnUp_flag && dword_50651C ) 798 if ( BtnUp_flag && dword_50651C )
1009 { 799 {
1010 --dword_50651C; 800 --dword_50651C;
1011 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 801 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
1012 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 802 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
1013 } 803 }
1014 if ( !num_achieved_awards || dword_506528 < 1 ) 804 if ( !num_achieved_awards || dword_506528 < 1 )
1015 { 805 {
1016 dword_506528 = 0; 806 dword_506528 = 0;
1017 dword_50651C = 0; 807 dword_50651C = 0;
1675 } 1465 }
1676 } 1466 }
1677 1467
1678 1468
1679 1469
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 }