comparison UIBooks.cpp @ 1018:9ac94d00012e

Merge
author Grumpy7
date Tue, 21 May 2013 02:24:31 +0200
parents c45d51b3f4f4 e865f349aa41
children 39f42990698f
comparison
equal deleted inserted replaced
1017:af20650a052f 1018:9ac94d00012e
34 switch (book) 34 switch (book)
35 { 35 {
36 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; 36 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
37 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; 37 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
38 case WINDOW_MapsBook: BookUI_Map_Draw(); break; 38 case WINDOW_MapsBook: BookUI_Map_Draw(); break;
39 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; 39 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
40 case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
41
40 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; 42 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
41 case WINDOW_TownPortal: DrawTownPortalScreen(); break; 43 case WINDOW_TownPortal: DrawTownPortalScreen(); break;
42 case WINDOW_HistoryBook: DrawBook_History(); break; 44 }
43 } 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"
44 } 60 }
45 61
46 62
47 63
48 //----- (00413D6F) -------------------------------------------------------- 64 //----- (00413D6F) --------------------------------------------------------
49 void BookUI_Calendar_Draw() 65 void BookUI_Calendar_Draw()
50 { 66 {
51 unsigned int v0; // esi@1 67 unsigned int v0; // esi@1
52 char *v1; // eax@5 68 //char *v1; // eax@5
53 int v2; // ecx@5 69 int v2; // ecx@5
54 char *v3; // eax@6 70 char *v3; // eax@6
55 GUIWindow a1; // [sp+Ch] [bp-60h]@5 71 GUIWindow a1; // [sp+Ch] [bp-60h]@5
56 unsigned int v6; // [sp+60h] [bp-Ch]@1 72 unsigned int v6; // [sp+60h] [bp-Ch]@1
57 int v7; // [sp+64h] [bp-8h]@1 73 //int v7; // [sp+64h] [bp-8h]@1
58 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
59 89
60 v0 = pParty->uCurrentHour; 90 v0 = pParty->uCurrentHour;
61 v6 = pMapStats->GetMapInfo(pCurrentMapName);
62 a5 = TargetColor(0x4Bu, 0x4Bu, 0x4Bu);
63 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); 91 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
64 v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed];
65 if ( (signed int)v0 <= 12 ) 92 if ( (signed int)v0 <= 12 )
66 { 93 {
67 if ( !v0 ) 94 if ( !v0 )
68 v0 = 12; 95 v0 = 12;
69 } 96 }
75 a1.uFrameY = game_viewport_y; 102 a1.uFrameY = game_viewport_y;
76 a1.uFrameWidth = game_viewport_width; 103 a1.uFrameWidth = game_viewport_width;
77 a1.uFrameHeight = game_viewport_height; 104 a1.uFrameHeight = game_viewport_height;
78 a1.uFrameZ = game_viewport_z; 105 a1.uFrameZ = game_viewport_z;
79 a1.uFrameW = game_viewport_w; 106 a1.uFrameW = game_viewport_w;
80 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;
81 if ( pParty->uCurrentHour >= 12 ) 110 if ( pParty->uCurrentHour >= 12 )
82 { 111 {
83 if ( pParty->uCurrentHour >= 24 ) 112 if ( pParty->uCurrentHour >= 24 )
84 v2=0; 113 v2=0;
85 else 114 else
86 v2=1; 115 v2=1;
87 } 116 }
88 else 117
89 v2=0; 118 sprintf(pTmpBuf, "%s\t100:\t110%d:%02d %s - %s",
90 v1 = GetDayPart(); 119 pGlobalTXT_LocalizationStrings[526], // "Time"
91 sprintf( 120 v0,
92 pTmpBuf, 121 pParty->uCurrentMinute,
93 "%s\t100:\t110%d:%02d %s - %s", 122 aAMPMNames[v2],
94 pGlobalTXT_LocalizationStrings[526], 123 GetDayPart());
95 v0, 124 a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf, 0, 0, 0);
96 pParty->uCurrentMinute, 125
97 aAMPMNames[v2], 126 sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
98 v1); 127 pGlobalTXT_LocalizationStrings[56], // "Day"
99 a1.DrawText(pBookFont, 70, 55, a5, pTmpBuf, 0, 0, 0); 128 pParty->uDaysPlayed + 1,
100 sprintf( 129 aDayNames[pParty->uDaysPlayed % 7]);
101 pTmpBuf, 130 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf, 0, 0, 0);
102 "%s\t100:\t110%d - %s", 131
103 pGlobalTXT_LocalizationStrings[56], 132 sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
104 pParty->uDaysPlayed + 1, 133 pGlobalTXT_LocalizationStrings[146], // "Month"
105 aDayNames[pParty->uDaysPlayed % 7]); 134 pParty->uCurrentMonth + 1,
106 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, a5, pTmpBuf, 0, 0, 0); 135 aMonthNames[pParty->uCurrentMonth]);
107 sprintf( 136 a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf, 0, 0, 0);
108 pTmpBuf, 137
109 "%s\t100:\t110%d - %s", 138 sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
110 pGlobalTXT_LocalizationStrings[146], 139 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf, 0, 0, 0);
111 pParty->uCurrentMonth + 1, 140
112 aMonthNames[pParty->uCurrentMonth]); 141 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
113 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);
114 sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); 143
115 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, a5, pTmpBuf, 0, 0, 0); 144 v6 = pMapStats->GetMapInfo(pCurrentMapName);
116 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[v7]);
117 a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, a5, pTmpBuf, 0, 0, 0);
118 if ( v6 ) 145 if ( v6 )
119 v3 = pMapStats->pInfos[v6].pName; 146 v3 = pMapStats->pInfos[v6].pName;
120 else 147 else
121 v3 = "Unknown"; 148 v3 = "Unknown";
122 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); 149 sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
123 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);
124 } 151 }
125 152
126 153
127 154
128 //----- (0041192C) -------------------------------------------------------- 155 //----- (0041192C) --------------------------------------------------------
135 162
136 ++pIcons_LOD->uTexturePacksCount; 163 ++pIcons_LOD->uTexturePacksCount;
137 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 164 if ( !pIcons_LOD->uNumPrevLoadedFiles )
138 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 165 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
139 166
140 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 167 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
141 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); 168 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
142 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); 169 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
143 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); 170 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
144 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); 171 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
145 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); 172 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
146 //v0 = 1; 173 //v0 = 1;
147 174
148 static const char *texNames[9] = 175 static const char *texNames[9] = // 004E24EC
149 { 176 {
150 "SBFB00", "SBAB00", "SBWB00", "SBEB00", 177 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
151 "SBSB00", "SBMB00", "SBBB00", "SBLB00", 178 "SBSB00", "SBMB00", "SBBB00", "SBLB00",
152 }; 179 };
153 180
167 194
168 //----- (00411AAA) -------------------------------------------------------- 195 //----- (00411AAA) --------------------------------------------------------
169 void InitializeBookFonts() 196 void InitializeBookFonts()
170 { 197 {
171 pAudioPlayer->StopChannels(-1, -1); 198 pAudioPlayer->StopChannels(-1, -1);
199
172 ++pIcons_LOD->uTexturePacksCount; 200 ++pIcons_LOD->uTexturePacksCount;
173 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 201 if ( !pIcons_LOD->uNumPrevLoadedFiles )
174 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 202 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
175 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 203
204 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
176 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); 205 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
177 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); 206 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
178 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); 207 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
179 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); 208 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
180 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); 209 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
219 } 248 }
220 } 249 }
221 } 250 }
222 251
223 //----- (0041140B) -------------------------------------------------------- 252 //----- (0041140B) --------------------------------------------------------
224 GUIWindow *sub_41140B() 253 void sub_41140B()
225 { 254 {
226 signed int v0; // esi@1 255 signed int v0; // esi@1
227 GUIButton *v1; // eax@3 256 GUIButton *v1; // eax@3
228 GUIButton *v2; // esi@4 257 GUIButton *v2; // esi@4
229 GUIWindow *result; // eax@5
230 258
231 v0 = 0; 259 v0 = 0;
232 do 260 do
233 { 261 {
234 dword_5063D8[11+v0]->Release(); 262 dword_5063D8[11+v0]->Release();
235 dword_506408[11+v0]->Release(); 263 dword_506408[11+v0]->Release();
236 --v0; 264 --v0;
237 } 265 }
238 while ( v0 >= -11 ); 266 while ( v0 >= -11 );
239 pIcons_LOD->_40F9C5(); 267 pIcons_LOD->SyncLoadedFilesCount();
240 v1 = pGUIWindow_CurrentMenu->pControlsHead; 268 v1 = pGUIWindow_CurrentMenu->pControlsHead;
241 if ( v1 ) 269 if ( v1 )
242 { 270 {
243 do 271 do
244 { 272 {
248 } 276 }
249 while ( v2 ); 277 while ( v2 );
250 } 278 }
251 pGUIWindow_CurrentMenu->pControlsHead = 0; 279 pGUIWindow_CurrentMenu->pControlsHead = 0;
252 pGUIWindow_CurrentMenu->pControlsTail = 0; 280 pGUIWindow_CurrentMenu->pControlsTail = 0;
253 result = pGUIWindow_CurrentMenu;
254 pGUIWindow_CurrentMenu->uNumControls = 0; 281 pGUIWindow_CurrentMenu->uNumControls = 0;
255 return result;
256 } 282 }
257 283
258 //----- (00411473) -------------------------------------------------------- 284 //----- (00411473) --------------------------------------------------------
259 void sub_411473() 285 void sub_411473()
260 { 286 {
265 { 291 {
266 pSpellBookPagesTextr[i]->Release(); 292 pSpellBookPagesTextr[i]->Release();
267 pTextures_tabs[i][0]->Release(); 293 pTextures_tabs[i][0]->Release();
268 pTextures_tabs[i][1]->Release(); 294 pTextures_tabs[i][1]->Release();
269 } 295 }
270 pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); 296 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
271 pIcons_LOD->_4114F2(); 297 pIcons_LOD->_4114F2();
272 } 298 }
273 299
274 300
275 //----- (00411597) -------------------------------------------------------- 301 //----- (00411597) --------------------------------------------------------
276 void OnCloseSpellBook() 302 void OnCloseSpellBook()
277 { 303 {
278 pAllocator->FreeChunk(pSpellFont); 304 pAllocator->FreeChunk(pSpellFont);
279 pSpellFont = 0; 305 pSpellFont = nullptr;
280 pAllocator->FreeChunk(pBookFont); 306 pAllocator->FreeChunk(pBookFont);
281 pBookFont = 0; 307 pBookFont = nullptr;
282 pAllocator->FreeChunk(pBook2Font); 308 pAllocator->FreeChunk(pBook2Font);
283 pBook2Font = 0; 309 pBook2Font = nullptr;
284 pAllocator->FreeChunk(pAutonoteFont); 310 pAllocator->FreeChunk(pAutonoteFont);
285 pAutonoteFont = 0; 311 pAutonoteFont = nullptr;
286 pTexture_mapbordr->Release(); 312 pTexture_mapbordr->Release();
287 pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); 313 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
288 pIcons_LOD->_4114F2(); 314 pIcons_LOD->_4114F2();
289 dword_506364 = 0; 315 dword_506364 = 0;
290 } 316 }
291 // 506364: using guessed type int dword_506364; 317
292 318
293 319
294 320
295 321
296 322
297
298
299 //----- (00412AF9) --------------------------------------------------------
300 void sub_412AF9()
301 {
302 int v0; // ecx@1
303
304 v0 = 0;
305 if ( uActiveCharacter )
306 v0 = pParty->pPlayers[uActiveCharacter-1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2);
307 pRenderer->DrawTextureIndexed(8u, 8u, pSpellBookPagesTextr[v0]);
308 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C);
309 pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448);
310 }
311
312 //----- (00412B58) --------------------------------------------------------
313 void DrawSpellBookContent()
314 {
315 Player *v0; // ebx@1
316 int v1; // ebp@1
317 unsigned int v2; // eax@1
318 Texture *v3; // edi@1
319 int v4; // esi@1
320 Texture *v5; // eax@3
321 Texture *v6; // edx@5
322 int v7; // eax@8
323 int v8; // eax@11
324 POINT *v9; // esi@13
325 int v10; // eax@13
326 Texture *v11; // edx@14
327 int v12; // eax@15
328 signed int v13; // ecx@18
329 unsigned int v14; // esi@18
330 unsigned int v15; // edi@18
331 Texture *pPageTexture; // eax@21
332 unsigned int v17; // [sp-Ch] [bp-2Ch]@8
333 unsigned int v18; // [sp-Ch] [bp-2Ch]@15
334 unsigned int v19; // [sp-8h] [bp-28h]@8
335 unsigned int v20; // [sp-8h] [bp-28h]@15
336 Texture *v21; // [sp-4h] [bp-24h]@15
337 signed int v22; // [sp-4h] [bp-24h]@22
338 Texture *v23; // [sp+10h] [bp-10h]@5
339 POINT a2; // [sp+18h] [bp-8h]@13
340 POINT v24;
341 int v25;
342
343 sub_412AF9();
344 v0 = pPlayers[uActiveCharacter];
345 v1 = 11 * v0->lastOpenedSpellbookPage;
346 v2 = pIcons_LOD->FindTextureByName("Pending");
347 v3 = pIcons_LOD->GetTexture(v2);
348 pRenderer->ClearZBuffer(0, 479);
349 v4 = 1;
350 if ( __OFSUB__(v1, v1 + 11) ^ 1 )
351 {
352 do
353 {
354 if ( *(&v0->_guilds_member_bits[v1 + 63] + v4) )
355 {
356 v5 = (Texture *)dword_506408[v4];
357 if ( v5 != v3 )
358 {
359 if ( quick_spell_at_page == v4 )
360 {
361 v6 = dword_5063D8[v4];
362 v23 = dword_5063D8[v4];
363 }
364 else
365 {
366 v23 = dword_506408[v4];
367 v6 = v5;
368 }
369 if ( v6->pLevelOfDetail0_prolly_alpha_mask )
370 {
371 v7 = v0->lastOpenedSpellbookPage;
372 // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
373 v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
374 v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
375 if ( BYTE1(v6->pBits) & 2 )
376 pRenderer->DrawTextureTransparent(v17, v19, v6);
377 else
378 pRenderer->DrawTextureIndexed(v17, v19, v6);
379 pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos,
380 pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4);
381 }
382 }
383 }
384 ++v4;
385 }
386 while ( v4 + v1 - 1 < v1 + 11 );
387 }
388 v9 = pMouse->GetCursorPos(&a2);
389 v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
390 if ( v10 )
391 {
392 v11 = dword_5063D8[v10];
393 if ( v11->pLevelOfDetail0_prolly_alpha_mask )
394 {
395 v21 = dword_5063D8[v10];
396 v12 = v0->lastOpenedSpellbookPage;
397 // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
398 v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
399 v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
400 if ( BYTE1(v11->pBits) & 2 )
401 pRenderer->DrawTextureTransparent(v18, v20, v21);
402 else
403 pRenderer->DrawTextureIndexed(v18, v20, v21);
404 }
405 }
406 v13 = 0;
407 a2.x = (LONG)&v0->pActiveSkills[12];
408 v14 = (unsigned int)&v0->pActiveSkills[12];
409 v15 = (unsigned int)&v0->pActiveSkills[12];
410 v25 = 0;
411 do
412 {
413 if ( *(short *)a2.x )
414 {
415 if ( v0->lastOpenedSpellbookPage == v13 )
416 {
417 pPageTexture = pTextures_tabs[v13][1];
418 switch ( v13 )
419 {
420 case 0:
421 v14 = 406;
422 v22 = 9;
423 goto LABEL_27;
424 case 1:
425 v14 = 406;
426 goto LABEL_38;
427 case 2:
428 v14 = 406;
429 v22 = 84;
430 goto LABEL_27;
431 case 3:
432 v14 = 406;
433 goto LABEL_26;
434 case 4:
435 v14 = 407;
436 goto LABEL_29;
437 case 5:
438 v15 = 196;
439 goto LABEL_34;
440 case 6:
441 v15 = 234;
442 goto LABEL_34;
443 case 7:
444 v15 = 272;
445 goto LABEL_34;
446 case 8:
447 v15 = 309;
448 LABEL_34:
449 v14 = 405;
450 break;
451 default:
452 break;
453 }
454 }
455 else
456 {
457 pPageTexture = pTextures_tabs[v13][0];
458 switch ( v13 )
459 {
460 case 0:
461 v14 = 415;
462 v22 = 10;
463 goto LABEL_27;
464 case 1:
465 v14 = 415;
466 LABEL_38:
467 v22 = 46;
468 goto LABEL_27;
469 case 2:
470 v14 = 415;
471 v22 = 83;
472 goto LABEL_27;
473 case 3:
474 v14 = 415;
475 LABEL_26:
476 v22 = 121;
477 LABEL_27:
478 v15 = v22;
479 break;
480 case 4:
481 v14 = 415;
482 LABEL_29:
483 v15 = 158;
484 break;
485 case 5:
486 v15 = 196;
487 goto LABEL_46;
488 case 6:
489 v15 = 234;
490 goto LABEL_46;
491 case 7:
492 v15 = 271;
493 goto LABEL_46;
494 case 8:
495 v15 = 307;
496 LABEL_46:
497 v14 = 416;
498 break;
499 default:
500 break;
501 }
502 }
503 pRenderer->DrawTextureTransparent(v14, v15, pPageTexture);
504 v13 = v25;
505 }
506 a2.x += 2;
507 ++v13;
508 v25 = v13;
509 }
510 while ( v13 < 9 );
511 }
512 // 506408: using guessed type int dword_506408[];
513 // 50654C: using guessed type int dword_50654C;
514 323
515 //----- (00412E85) -------------------------------------------------------- 324 //----- (00412E85) --------------------------------------------------------
516 void DrawBook_History() 325 void BookUI_Journal_Draw()
517 { 326 {
518 unsigned int v0; // eax@3 327 unsigned int v0; // eax@3
519 unsigned int v1; // eax@7 328 unsigned int v1; // eax@7
520 int v2; // eax@10 329 int v2; // eax@10
521 const char *v3; // eax@10 330 const char *v3; // eax@10
543 v13 = pTex_tab_an_6b__zoom_on; 352 v13 = pTex_tab_an_6b__zoom_on;
544 v11 = pViewport->uViewportTL_Y + 1; 353 v11 = pViewport->uViewportTL_Y + 1;
545 v0 = pViewport->uViewportTL_X + 398; 354 v0 = pViewport->uViewportTL_X + 398;
546 } 355 }
547 pRenderer->DrawTextureTransparent(v0, v11, v13); 356 pRenderer->DrawTextureTransparent(v0, v11, v13);
357
548 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 )
549 { 359 {
550 v14 = pTex_tab_an_7a__zoot_off; 360 v14 = pTex_tab_an_7a__zoot_off;
551 v12 = pViewport->uViewportTL_Y + 38; 361 v12 = pViewport->uViewportTL_Y + 38;
552 v1 = pViewport->uViewportTL_X + 407; 362 v1 = pViewport->uViewportTL_X + 407;
556 v14 = pTex_tab_an_7b__zoot_on; 366 v14 = pTex_tab_an_7b__zoot_on;
557 v12 = pViewport->uViewportTL_Y + 38; 367 v12 = pViewport->uViewportTL_Y + 38;
558 v1 = pViewport->uViewportTL_X + 398; 368 v1 = pViewport->uViewportTL_X + 398;
559 } 369 }
560 pRenderer->DrawTextureTransparent(v1, v12, v14); 370 pRenderer->DrawTextureTransparent(v1, v12, v14);
371
561 if ( !byte_5C6D50[dword_506528] ) 372 if ( !byte_5C6D50[dword_506528] )
562 { 373 {
563 v2 = achieved_awards[dword_506528]; 374 v2 = achieved_awards[dword_506528];
564 a1.uFrameWidth = game_viewport_width; 375 a1.uFrameWidth = game_viewport_width;
565 a1.uFrameX = game_viewport_x; 376 a1.uFrameX = game_viewport_x;
567 a1.uFrameHeight = game_viewport_height; 378 a1.uFrameHeight = game_viewport_height;
568 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; 379 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[];
569 a1.uFrameZ = game_viewport_z; 380 a1.uFrameZ = game_viewport_z;
570 a1.uFrameW = game_viewport_w; 381 a1.uFrameW = game_viewport_w;
571 if ( v3 ) 382 if ( v3 )
572 a1.DrawTitleText(pBook2Font, 0, 22, 0, v3, 3); 383 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3);
573 } 384 }
385
574 a1.uFrameX = 48; 386 a1.uFrameX = 48;
575 a1.uFrameY = 70; 387 a1.uFrameY = 70;
576 a1.uFrameWidth = 360; 388 a1.uFrameWidth = 360;
577 a1.uFrameHeight = 264; 389 a1.uFrameHeight = 264;
578 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3; 390 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
579 a1.uFrameZ = 407; 391 a1.uFrameZ = 407;
580 a1.uFrameHeight = v4 * 264 / v4; 392 a1.uFrameHeight = v4 * 264 / v4;
581 a1.uFrameW = a1.uFrameHeight + 69; 393 a1.uFrameW = a1.uFrameHeight + 69;
582 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 )
583 { 395 {
584 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 396 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
585 v5 = dword_50651C++; 397 v5 = dword_50651C++;
586 dword_506528 += num_achieved_awards; 398 dword_506528 += num_achieved_awards;
587 byte_506130[v5] = num_achieved_awards; 399 byte_506130[v5] = num_achieved_awards;
588 } 400 }
589 if ( BtnUp_flag && dword_50651C ) 401 if ( BtnUp_flag && dword_50651C )
590 { 402 {
591 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 403 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
592 --dword_50651C; 404 --dword_50651C;
593 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 405 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
594 } 406 }
595 if ( !num_achieved_awards || dword_506528 < 1 ) 407 if ( !num_achieved_awards || dword_506528 < 1 )
596 { 408 {
611 0, 423 0,
612 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); 424 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
613 if ( v7 ) 425 if ( v7 )
614 { 426 {
615 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]);
616 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);
617 ++num_achieved_awards; 429 ++num_achieved_awards;
618 } 430 }
619 } 431 }
620 432
621 433
677 a1.uFrameHeight = 264; 489 a1.uFrameHeight = 264;
678 a1.uFrameZ = 407; 490 a1.uFrameZ = 407;
679 a1.uFrameW = 333; 491 a1.uFrameW = 333;
680 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 )
681 { 493 {
682 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 494 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
683 v2 = dword_50651C++; 495 v2 = dword_50651C++;
684 dword_506528 += num_achieved_awards; 496 dword_506528 += num_achieved_awards;
685 byte_506130[v2] = num_achieved_awards; 497 byte_506130[v2] = num_achieved_awards;
686 } 498 }
687 if ( BtnUp_flag && dword_50651C ) 499 if ( BtnUp_flag && dword_50651C )
688 { 500 {
689 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 501 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
690 --dword_50651C; 502 --dword_50651C;
691 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 503 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
692 } 504 }
693 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) ) 505 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) )
694 { 506 {
978 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 ) 790 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 )
979 { 791 {
980 v11 = dword_50651C++; 792 v11 = dword_50651C++;
981 byte_506130[v11] = num_achieved_awards; 793 byte_506130[v11] = num_achieved_awards;
982 dword_506528 = v10; 794 dword_506528 = v10;
983 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 795 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
984 } 796 }
985 } 797 }
986 if ( BtnUp_flag && dword_50651C ) 798 if ( BtnUp_flag && dword_50651C )
987 { 799 {
988 --dword_50651C; 800 --dword_50651C;
989 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 801 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
990 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 802 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
991 } 803 }
992 if ( !num_achieved_awards || dword_506528 < 1 ) 804 if ( !num_achieved_awards || dword_506528 < 1 )
993 { 805 {
994 dword_506528 = 0; 806 dword_506528 = 0;
995 dword_50651C = 0; 807 dword_50651C = 0;
1653 } 1465 }
1654 } 1466 }
1655 1467
1656 1468
1657 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 }