# HG changeset patch
# User a.parshin
# Date 1431393859 -7200
# Node ID 87e5590d034bf4581847fded019782950548b23d
# Parent fed97f15d1e1560d1c507fad242c181b419efc98
All Books windows are refactored into respective classes
diff -r fed97f15d1e1 -r 87e5590d034b Build/Visual Studio 2013/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj Tue May 12 01:45:31 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj Tue May 12 03:24:19 2015 +0200
@@ -160,8 +160,13 @@
-
-
+
+
+
+
+
+
+
@@ -333,8 +338,13 @@
-
-
+
+
+
+
+
+
+
diff -r fed97f15d1e1 -r 87e5590d034b Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Tue May 12 01:45:31 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Tue May 12 03:24:19 2015 +0200
@@ -490,12 +490,6 @@
GUI\UI\Books
-
- GUI\UI\Books
-
-
- GUI\UI\Books
-
GUI\UI
@@ -583,6 +577,27 @@
GUI\UI
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
@@ -1237,12 +1252,6 @@
GUI\UI\Books
-
- GUI\UI\Books
-
-
- GUI\UI\Books
-
GUI\UI
@@ -1333,6 +1342,27 @@
GUI\UI
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
+
+ GUI\UI\Books
+
diff -r fed97f15d1e1 -r 87e5590d034b GUI/GUIButton.cpp
--- a/GUI/GUIButton.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/GUIButton.cpp Tue May 12 03:24:19 2015 +0200
@@ -88,7 +88,7 @@
struct GUIWindow *pGUIWindow_Settings;
struct GUIWindow *pModalWindow;
struct GUIWindow *pGUIWindow_EscMessageWindow;
-struct GUIWindow *pBooksWindow;
+struct GUIWindow *pBooksButtonOverlay;
struct GUIWindow *pGUIWindow2;
diff -r fed97f15d1e1 -r 87e5590d034b GUI/GUIWindow.cpp
--- a/GUI/GUIWindow.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/GUIWindow.cpp Tue May 12 03:24:19 2015 +0200
@@ -219,7 +219,7 @@
GUIWindow_Spellbook::GUIWindow_Spellbook(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
GUIWindow(x, y, width, height, button, hint)
{
- InitializeBookTextures();
+ InitializeSpellBookTextures();
OpenSpellBook();
}
@@ -398,12 +398,6 @@
-void GUIWindow_Book::Release()
-{
- OnCloseBook();
-
- GUIWindow::Release();
-}
void GUIWindow_Dialogue::Release()
{
@@ -507,259 +501,6 @@
return result;
}
-//----- (00411BFC) --------------------------------------------------------
-void GUIWindow::InitializeBookView()
-{
- char *pString; // eax@12
- int pTextHeight; // eax@12
- //__int64 page_count; // qax@12
- unsigned int page_count; // esi@12
- unsigned __int16 v18; // ax@38
- signed int max_beacons; // [sp+10h] [bp-5Ch]@38
- GUIWindow journal_window; // [sp+18h] [bp-54h]@8
-
- pAudioPlayer->StopChannels(-1, -1);
- InitializeBookFonts();
- this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
- current_screen_type = SCREEN_BOOKS;
- full_num_items_in_book = 0;
- books_primary_item_per_page = 0;
- books_page_number = 0;
- num_achieved_awards = 0;
- switch (this->par1C)
- {
- case WINDOW_LloydsBeacon:
- {
- byte_506360 = 0;
- pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE);
- pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
- pTexture_LloydBeacons[1] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
-
- pBtn_Book_1 = this->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon
- pBtn_Book_2 = this->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon
-
- max_beacons = 1;
- v18 = pParty->pPlayers[_506348_current_lloyd_playerid].pActiveSkills[PLAYER_SKILL_WATER];
- if ( v18 & 0x100 || (v18 & 0x80) )
- max_beacons = 5;
- else if ( v18 & 0x40 )
- max_beacons = 3;
-
- for ( int i = 0; i < max_beacons; ++i )
- CreateButton(pLloydsBeaconsPreviewXs[i], pLloydsBeaconsPreviewYs[i],
- 92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0);
-
- for ( int i = 0; i < 5; ++i )
- {
- if (pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed)
- LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1);
- else
- memset(&pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i], 0, sizeof(LloydBeacon));
- }
- }
- break;
-
- case WINDOW_TownPortal:
- {
- pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE);
- pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE);
-
- static int pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74};
- static int pTownPortalBook_hs[6] = { 55, 56, 65, 67, 67, 59};
- for ( uint i = 0; i < 6; ++i )
- this->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr);
-
- }
- break;
-
- case WINDOW_QuestBook:
- {
- pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE);
- pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
- pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
- pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight,
- 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up"
- pTex_book_button1_on, 0);
- pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38,
- pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight,
- 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
- pTex_book_button2_on, 0);
- num_achieved_awards = 0;
- memset(achieved_awards.data(), 0, 4000);
- for ( uint i = books_primary_item_per_page; i < 512; ++i )
- {
- if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] )
- {
- achieved_awards[num_achieved_awards] = (AwardType)i;
- ++num_achieved_awards;
- }
- }
- full_num_items_in_book = num_achieved_awards;
- num_achieved_awards = 0;
- }
- break;
-
- case WINDOW_AutonotesBook:
- {
- pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE);
- pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
- pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE);
- pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE);
- pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE);
- pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE);
- pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE);
- pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE);
- pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE);
- pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE);
- pTex_book_button7_on = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE);
- pTex_book_button7_off = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE);
- pTex_book_button8_on = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE);
- pTex_book_button8_off = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE);
-
- pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_book_button1_on, 0);
- pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button2_on, 0);
- pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTex_book_button3_on, 0); // "Potion Notes"
- pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTex_book_button4_on, 0); // "Fountain Notes"
- pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTex_book_button5_on, 0); // "Obelisk Notes"
- pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTex_book_button6_on, 0); // "Seer Notes"
- pBtn_Autonotes_Misc = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTex_book_button7_on, 0); // "Miscellaneous Notes"
- pBtn_Autonotes_Instructors = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTex_book_button8_on, 0); // "Instructors"
-
- num_achieved_awards = 0;
- for ( uint i = books_primary_item_per_page; i < 196; ++i )
- {
- if ( _506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] )
- {
- if ( i )
- {
- if ( _449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText )
- {
- achieved_awards[num_achieved_awards] = (AwardType)i;
- ++num_achieved_awards;
- }
- }
- }
- }
- full_num_items_in_book = num_achieved_awards;
- num_achieved_awards = 0;
- }
- break;
-
- case WINDOW_MapsBook:
- {
- dword_506364 = 1;
- pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE);
- pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE);
- pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE);
- pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE);
- pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE);
- pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE);
- pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE);
- pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE);
- pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE);
-
- pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_book_button1_on, 0);// "Zoom In"
- pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_book_button2_on, 0);// "Zoom Out"
- pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up
- pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down
- pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right"
- pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
- UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left"
- }
- break;
-
- case WINDOW_CalendarBook:
- {
- pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE);
- pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE);
- pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE);
- pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
- pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
- pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE);
- }
- break;
-
- case WINDOW_JournalBook:
- {
- pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
- pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
- pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
-
- pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
- pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0,
- UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button1_on, 0);
- pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on->uTextureHeight,
- pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0,
- pGlobalTXT_LocalizationStrings[193], pTex_book_button2_on, 0);
-
- num_achieved_awards = 0;
- journal_window.uFrameX = 48;
- journal_window.uFrameY = 70;
- journal_window.uFrameWidth = 360;
- journal_window.uFrameHeight = 264;
- journal_window.uFrameZ = 407;
- journal_window.uFrameHeight = (LOBYTE(pAutonoteFont->uFontHeight) - 3) * 264 / LOBYTE(pAutonoteFont->uFontHeight) - 3;
- journal_window.uFrameW = journal_window.uFrameHeight + 69;
- memset(&achieved_awards, 0, 4000);
- memset(Journal_limitation_factor.data(), 0, 100);
- if ( books_primary_item_per_page < 29 )
- {
- for ( int i = books_primary_item_per_page; i < books_primary_item_per_page + 29; i++ )
- {
- if ( pParty->PartyTimes.HistoryEventTimes[i] > 0 )
- {
- if ( pStorylineText->StoreLine[i + 1].pText )
- {
- pString = BuildDialogueString(pStorylineText->StoreLine[i + 1].pText, uActiveCharacter - 1, 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[i]);
- pTextHeight = pAutonoteFont->CalcTextHeight(pString, &journal_window, 1, 0);
- page_count = ((pTextHeight - (pAutonoteFont->uFontHeight - 3)) / (signed int)journal_window.uFrameHeight) + 1;
- memset32((char *)&achieved_awards[num_achieved_awards] , i + 1, page_count);
- for ( uint j = 0; j <= page_count - 1; ++j )
- Journal_limitation_factor[num_achieved_awards++] = j;
- }
- }
- }
- }
- full_num_items_in_book = num_achieved_awards;
- num_achieved_awards = 0;
- }
- break;
- }
-}
//----- (00415551) --------------------------------------------------------
void GUIWindow::DrawMessageBox(int arg0)
@@ -1614,15 +1355,7 @@
}
-
-void GUIWindow_Book::Update()
-{
-// -----------------------------------
-// 004156F0 GUI_UpdateWindows --- part
- BookUI_Draw((WindowType)(int)ptr_1C);
-}
-
-void GUIWindow_BooksWindow::Update()
+void GUIWindow_BooksButtonOverlay::Update()
{
// -----------------------------------
// 004156F0 GUI_UpdateWindows --- part
diff -r fed97f15d1e1 -r 87e5590d034b GUI/GUIWindow.h
--- a/GUI/GUIWindow.h Tue May 12 01:45:31 2015 +0200
+++ b/GUI/GUIWindow.h Tue May 12 03:24:19 2015 +0200
@@ -300,7 +300,7 @@
WINDOW_CloseRestWindowBtn = 96,
WINDOW_ExitCharacterWindow = 97, // OnCancel2
WINDOW_RestWindow = 0x62,
- WINDOW_BooksWindow = 99,
+ WINDOW_BooksButtonOverlay = 99,
WINDOW_CharacterWindow_Stats = 0x64,
WINDOW_CharacterWindow_Skills = 0x65,
WINDOW_CharacterWindow_Awards = 0x66,
@@ -343,7 +343,6 @@
void DrawShops_next_generation_time_string(__int64 next_generation_time);
void HouseDialogManager();
void OpenSpellBook();
- void InitializeBookView();
void DrawMessageBox(int arg0);
GUIButton *GetControl(unsigned int uID);
void _41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5);
@@ -380,24 +379,13 @@
#pragma pack(pop)
-struct GUIWindow_Book : public GUIWindow
+
+struct GUIWindow_BooksButtonOverlay : public GUIWindow
{
- GUIWindow_Book(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
- GUIWindow(x, y, width, height, button, hint)
- {
- InitializeBookView();
- }
- virtual ~GUIWindow_Book() {}
-
- virtual void Update();
- virtual void Release();
-};
-struct GUIWindow_BooksWindow : public GUIWindow
-{
- GUIWindow_BooksWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
+ GUIWindow_BooksButtonOverlay(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
GUIWindow(x, y, width, height, button, hint)
{}
- virtual ~GUIWindow_BooksWindow() {}
+ virtual ~GUIWindow_BooksButtonOverlay() {}
virtual void Update();
};
@@ -709,19 +697,8 @@
// book ui
-void BookUI_Draw(WindowType book);
-void BookUI_Questbook_Draw();
-void BookUI_Autonotes_Draw();
-void BookUI_Map_Draw();
-void BookUI_Calendar_Draw();
-void BookUI_Journal_Draw();
-
-void OnCloseBook();
-void InitializeBookTextures();
-void InitializeBookFonts();
+void InitializeSpellBookTextures();
void DrawSpellBookContent(Player *player);
-unsigned int DrawLloydBeaconsScreen();
-void BookUI_DrawTownPortalMap();
void LoadSpellbook(unsigned int uID); // idb
void DrawSpellDescriptionPopup(int spell_index);
void OnCloseSpellBookPage();
@@ -902,7 +879,7 @@
extern struct GUIWindow *pGUIWindow_Settings;
extern struct GUIWindow *pModalWindow;
extern struct GUIWindow *pGUIWindow_EscMessageWindow;
-extern struct GUIWindow *pBooksWindow;
+extern struct GUIWindow *pBooksButtonOverlay;
extern struct GUIWindow *pGUIWindow2;
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/AutonotesBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/AutonotesBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,331 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/Autonotes.h"
+#include "Engine/Awards.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/AutonotesBook.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+GUIWindow_AutonotesBook::GUIWindow_AutonotesBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_AutonotesBook; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// --------------------------------
+// 004304E7 Game_EventLoop --- part
+ pEventTimer->Pause();
+ pAudioPlayer->StopChannels(-1, -1);
+ pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(527, 353, 0, 0, (int)pBtn_Autonotes, 0);
+ bFlashAutonotesBook = 0;
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE);
+ pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button7_on = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button7_off = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button8_on = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button8_off = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE);
+
+ pBtn_Book_1 = CreateButton(
+ pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_book_button1_on, 0
+ );
+ pBtn_Book_2 = CreateButton(
+ pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button2_on, 0
+ );
+ pBtn_Book_3 = CreateButton(
+ pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTex_book_button3_on, 0
+ ); // "Potion Notes"
+ pBtn_Book_4 = CreateButton(
+ pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTex_book_button4_on, 0
+ ); // "Fountain Notes"
+ pBtn_Book_5 = CreateButton(
+ pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTex_book_button5_on, 0
+ ); // "Obelisk Notes"
+ pBtn_Book_6 = CreateButton(
+ pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTex_book_button6_on, 0
+ ); // "Seer Notes"
+ pBtn_Autonotes_Misc = CreateButton(
+ pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTex_book_button7_on, 0
+ ); // "Miscellaneous Notes"
+ pBtn_Autonotes_Instructors = CreateButton(
+ pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTex_book_button8_on, 0
+ ); // "Instructors"
+
+ int num_achieved_awards = 0;
+ for (uint i = books_primary_item_per_page; i < 196; ++i)
+ {
+ if (_506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] )
+ {
+ if (i)
+ {
+ if (_449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText)
+ {
+ achieved_awards[num_achieved_awards] = (AwardType)i;
+ ++num_achieved_awards;
+ }
+ }
+ }
+ }
+ full_num_items_in_book = num_achieved_awards;
+ num_achieved_awards = 0;
+}
+
+
+
+void GUIWindow_AutonotesBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_Autonotes_Draw();
+
+// ----- (0041338E) --------------------------------------------------------
+// void BookUI_Autonotes_Draw()
+// {
+ int pTextHeight; // eax@65
+ bool change_flag; // [sp+10h] [bp-58h]@1
+ GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46
+
+ change_flag = false;
+ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook);
+ if (BtnUp_flag || !books_primary_item_per_page)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
+
+ if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
+
+ if (Book_PageBtn3_flag)//Potions_page_flag
+ {
+ if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
+ else//press(нажатие)
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_POTION_RECEPIE;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
+ else//Potions_page not active(вкладка снадобья не активна)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off);
+ }
+
+ if (Book_PageBtn4_flag)//Fontains_page_flag
+ {
+ if (_506568_autonote_type == AUTONOTE_STAT_HINT)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
+ else
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_STAT_HINT;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_STAT_HINT)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off);
+ }
+
+ if (Book_PageBtn5_flag)//Autonotes_Obelisks_page_flag
+ {
+ if (_506568_autonote_type == AUTONOTE_OBELISK)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
+ else
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_OBELISK;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_OBELISK)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off);
+ }
+
+ if (Book_PageBtn6_flag)//Autonotes_Seer_page_flag
+ {
+ if (_506568_autonote_type == AUTONOTE_SEER)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
+ else
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_SEER;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_SEER)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off);
+ }
+
+ if (Autonotes_Misc_page_flag)
+ {
+ if (_506568_autonote_type == AUTONOTE_MISC)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
+ else
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_MISC;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_MISC)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off);
+ }
+
+ if (Autonotes_Instructors_page_flag)
+ {
+ if (_506568_autonote_type == AUTONOTE_TEACHER)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
+ else
+ {
+ change_flag = true;
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ _506568_autonote_type = AUTONOTE_TEACHER;
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
+ }
+ }
+ else
+ {
+ if (_506568_autonote_type == AUTONOTE_TEACHER)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off);
+ }
+
+ //for title
+ autonotes_window.uFrameWidth = game_viewport_width;
+ autonotes_window.uFrameHeight = game_viewport_height;
+ autonotes_window.uFrameX = game_viewport_x;
+ autonotes_window.uFrameY = game_viewport_y;
+ autonotes_window.uFrameZ = game_viewport_z;
+ autonotes_window.uFrameW = game_viewport_w;
+ autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes"
+
+ //for other text
+ autonotes_window.uFrameX = 48;
+ autonotes_window.uFrameY = 70;
+ autonotes_window.uFrameWidth = 360;
+ autonotes_window.uFrameHeight = 264;
+ autonotes_window.uFrameZ = 407;
+ autonotes_window.uFrameW = 333;
+ if (change_flag)//change bookmark(смена закладки)
+ {
+ full_num_items_in_book = 0;
+ books_primary_item_per_page = 0;
+ books_page_number = 0;
+ num_achieved_awards = 0;
+ for (uint i = 1; i <= 195; ++i)
+ {
+ if (pAutonoteTxt[i].eType == _506568_autonote_type)
+ {
+ if ((unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText)
+ achieved_awards[num_achieved_awards++] = (AwardType)i;
+ }
+ }
+ full_num_items_in_book = num_achieved_awards;
+ }
+ else//not change bookmark(не меняется закладка)
+ {
+ if (BtnDown_flag)// press Down bookmark(нажатие закладки пролистать дальше)
+ {
+ if (num_achieved_awards + books_primary_item_per_page < full_num_items_in_book)
+ {
+ books_num_items_per_page[books_page_number++] = num_achieved_awards;
+ books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page;
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ }
+ }
+ if (BtnUp_flag && books_page_number)// press Up bookmark(нажатие закладки пролистать назад)
+ {
+ --books_page_number;
+ books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ }
+ if (!num_achieved_awards || !books_primary_item_per_page)//количество записей 0 или номер первой страницы 0
+ {
+ books_primary_item_per_page = 0;
+ books_page_number = 0;
+ }
+ }
+ BtnUp_flag = 0;
+ BtnDown_flag = 0;
+ Book_PageBtn3_flag = 0;//Potions_page_flag
+ Book_PageBtn4_flag = 0;//Fontains_page_flag
+ Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag
+ Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag
+ Autonotes_Misc_page_flag = 0;
+ Autonotes_Instructors_page_flag = 0;
+ num_achieved_awards = 0;
+ for (uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i)
+ {
+ ++num_achieved_awards;
+ autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0);
+ pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0);
+ if ((signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight)
+ break;
+ pRenderer->DrawTextureIndexedAlpha(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10);
+ autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24;
+ }
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/AutonotesBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/AutonotesBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_AutonotesBook : public GUIWindow_Book
+{
+ GUIWindow_AutonotesBook();
+ virtual ~GUIWindow_AutonotesBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/CalendarBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/CalendarBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,135 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/CalendarBook.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+
+
+GUIWindow_CalendarBook::GUIWindow_CalendarBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_CalendarBook; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// --------------------------------
+// 004304E7 Game_EventLoop --- part
+ pEventTimer->Pause();
+ pAudioPlayer->StopChannels(-1, -1);
+ pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(570, 354, 0, 0, (int)pBtn_Calendar, 0);
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE);
+ pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE);
+ pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE);
+ pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
+ pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
+ pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE);
+}
+
+
+
+//----- (00413D3C) --------------------------------------------------------
+static const char *GetDayPart()
+{
+ if (pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20)
+ return pGlobalTXT_LocalizationStrings[56]; // "Day"
+ else if (pParty->uCurrentHour == 5)
+ return pGlobalTXT_LocalizationStrings[55]; // "Dawn"
+ else if (pParty->uCurrentHour == 20)
+ return pGlobalTXT_LocalizationStrings[566]; // "Dusk"
+ else
+ return pGlobalTXT_LocalizationStrings[567]; // "Night"
+}
+
+
+
+void GUIWindow_CalendarBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_Calendar_Draw();
+
+// ----- (00413D6F) --------------------------------------------------------
+// void BookUI_Calendar_Draw()
+// {
+ int am; // ecx@5
+ char *pMapName; // eax@6
+ GUIWindow calendar_window; // [sp+Ch] [bp-60h]@5
+ unsigned int pMapID; // [sp+60h] [bp-Ch]@1
+ unsigned int pHour;
+
+ static unsigned int pDayMoonPhase[28] = // 4E1B18
+ {
+ 0, 0, 0,
+ 1, 1, 1, 1,
+ 2, 2, 2,
+ 3, 3, 3, 3,
+ 4, 4, 4,
+ 3, 3, 3, 3,
+ 2, 2, 2,
+ 1, 1, 1, 1
+ };
+
+ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
+ pHour = pParty->uCurrentHour;
+ if ((signed int)pHour >= 12)
+ {
+ pHour -= 12;
+ if (!pHour)
+ pHour = 12;
+ am = 1;
+ }
+ else
+ am = 0;
+
+ calendar_window.uFrameX = game_viewport_x;
+ calendar_window.uFrameY = game_viewport_y;
+ calendar_window.uFrameWidth = game_viewport_width;
+ calendar_window.uFrameHeight = game_viewport_height;
+ calendar_window.uFrameZ = game_viewport_z;
+ calendar_window.uFrameW = game_viewport_w;
+ calendar_window.DrawTitleText(pBook2Font, 0, 22, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia"
+
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time"
+ pHour, pParty->uCurrentMinute, aAMPMNames[am], GetDayPart());
+ calendar_window.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0);
+
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day"
+ pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]);
+ calendar_window.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0);
+
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month"
+ pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]);
+ calendar_window.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0);
+
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
+ calendar_window.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0);
+
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
+ calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
+
+ pMapID = pMapStats->GetMapInfo(pCurrentMapName);
+ if (pMapID)
+ pMapName = pMapStats->pInfos[pMapID].pName;
+ else
+ pMapName = "Unknown";
+ sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], pMapName); // "Location"
+ calendar_window.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0);
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/CalendarBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/CalendarBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_CalendarBook : public GUIWindow_Book
+{
+ GUIWindow_CalendarBook();
+ virtual ~GUIWindow_CalendarBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/JournalBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/JournalBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,166 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/Awards.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+#include "Engine/Tables/StorylineTextTable.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/JournalBook.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+
+
+GUIWindow_JournalBook::GUIWindow_JournalBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_JournalBook; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// --------------------------------
+// 004304E7 Game_EventLoop --- part
+ pEventTimer->Pause();
+ pAudioPlayer->StopChannels(-1, -1);
+ pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(0x258u, 0x169u, 0, 0, (int)pBtn_History, 0);
+ bFlashHistoryBook = 0;
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ char *pString; // eax@12
+ int pTextHeight; // eax@12
+ unsigned int page_count; // esi@12
+ GUIWindow journal_window; // [sp+18h] [bp-54h]@8
+
+ pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
+
+ pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
+ pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0,
+ UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button1_on, 0);
+ pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on->uTextureHeight,
+ pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0,
+ pGlobalTXT_LocalizationStrings[193], pTex_book_button2_on, 0);
+
+ num_achieved_awards = 0;
+ journal_window.uFrameX = 48;
+ journal_window.uFrameY = 70;
+ journal_window.uFrameWidth = 360;
+ journal_window.uFrameHeight = 264;
+ journal_window.uFrameZ = 407;
+ journal_window.uFrameHeight = (LOBYTE(pAutonoteFont->uFontHeight) - 3) * 264 / LOBYTE(pAutonoteFont->uFontHeight) - 3;
+ journal_window.uFrameW = journal_window.uFrameHeight + 69;
+ memset(&achieved_awards, 0, 4000);
+ memset(Journal_limitation_factor.data(), 0, 100);
+ if (books_primary_item_per_page < 29)
+ {
+ for (int i = books_primary_item_per_page; i < books_primary_item_per_page + 29; i++)
+ {
+ if (pParty->PartyTimes.HistoryEventTimes[i] > 0)
+ {
+ if (pStorylineText->StoreLine[i + 1].pText)
+ {
+ pString = BuildDialogueString(pStorylineText->StoreLine[i + 1].pText, uActiveCharacter - 1, 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[i]);
+ pTextHeight = pAutonoteFont->CalcTextHeight(pString, &journal_window, 1, 0);
+ page_count = ((pTextHeight - (pAutonoteFont->uFontHeight - 3)) / (signed int)journal_window.uFrameHeight) + 1;
+ memset32((char *)&achieved_awards[num_achieved_awards], i + 1, page_count);
+ for (uint j = 0; j <= page_count - 1; ++j)
+ Journal_limitation_factor[num_achieved_awards++] = j;
+ }
+ }
+ }
+ }
+ full_num_items_in_book = num_achieved_awards;
+ num_achieved_awards = 0;
+}
+
+
+
+void GUIWindow_JournalBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_Journal_Draw();
+
+// ----- (00412E85) --------------------------------------------------------
+// void BookUI_Journal_Draw()
+// {
+ char *pDialogueString; // eax@21
+ char* pStringOnPage; // eax@22
+ GUIWindow journal_window; // [sp+8h] [bp-54h]@10
+
+ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11);
+ if (BtnUp_flag || !books_primary_item_per_page)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
+
+ if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
+
+ if (!Journal_limitation_factor[books_primary_item_per_page])//for title
+ {
+ journal_window.uFrameWidth = game_viewport_width;
+ journal_window.uFrameX = game_viewport_x;
+ journal_window.uFrameY = game_viewport_y;
+ journal_window.uFrameHeight = game_viewport_height;
+ journal_window.uFrameZ = game_viewport_z;
+ journal_window.uFrameW = game_viewport_w;
+ if (pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle)
+ journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3);
+ }
+
+ //for other text
+ journal_window.uFrameX = 48;
+ journal_window.uFrameY = 70;
+ journal_window.uFrameWidth = 360;
+ journal_window.uFrameHeight = 264;
+ journal_window.uFrameZ = 407;
+ journal_window.uFrameW = journal_window.uFrameHeight + 69;
+ if (BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book)//Press bookmark next page
+ {
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ books_primary_item_per_page += num_achieved_awards;
+ books_num_items_per_page[books_page_number++] = num_achieved_awards;
+ }
+ if (BtnUp_flag && books_page_number)//Press bookmark previous page
+ {
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ --books_page_number;
+ books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
+ }
+ if (!num_achieved_awards || books_primary_item_per_page < 1)
+ {
+ books_primary_item_per_page = 0;
+ books_page_number = 0;
+ }
+ BtnDown_flag = 0;
+ BtnUp_flag = 0;
+ num_achieved_awards = 0;
+ if (achieved_awards[books_primary_item_per_page])
+ {
+ int index = ((int)achieved_awards[books_primary_item_per_page] - 1);
+ pDialogueString = BuildDialogueString(pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1,
+ 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]);
+ pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]);
+ journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0,
+ journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow);
+ ++num_achieved_awards;
+ }
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/JournalBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/JournalBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_JournalBook : public GUIWindow_Book
+{
+ GUIWindow_JournalBook();
+ virtual ~GUIWindow_JournalBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/LloydsBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/LloydsBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,179 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/LloydsBook.h"
+
+
+std::array pLloydsBeaconsPreviewXs = { { 61, 281, 61, 281, 171 } }; // 004E249C
+std::array pLloydsBeaconsPreviewYs = { { 84, 84, 228, 228, 155 } };
+std::array pLloydsBeacons_SomeXs = { { 59, 279, 59, 279, 169 } };
+std::array pLloydsBeacons_SomeYs = { { 82, 82, 226, 226, 153 } };
+
+GUIWindow_LloydsBook::GUIWindow_LloydsBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_LloydsBeacon; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ byte_506360 = 0;
+ pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE);
+ pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
+ pTexture_LloydBeacons[1] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
+
+ pBtn_Book_1 = CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon
+ pBtn_Book_2 = CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon
+
+ int max_beacons = 1;
+ int v18 = pParty->pPlayers[_506348_current_lloyd_playerid].pActiveSkills[PLAYER_SKILL_WATER];
+ if (v18 & 0x100 || (v18 & 0x80))
+ max_beacons = 5;
+ else if (v18 & 0x40)
+ max_beacons = 3;
+
+ for (int i = 0; i < max_beacons; ++i)
+ CreateButton(
+ pLloydsBeaconsPreviewXs[i], pLloydsBeaconsPreviewYs[i],
+ 92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0
+ );
+
+ for (int i = 0; i < 5; ++i)
+ {
+ if (pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed)
+ LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1);
+ else
+ memset(&pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i], 0, sizeof(LloydBeacon));
+ }
+}
+
+
+void GUIWindow_LloydsBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// DrawLloydBeaconsScreen();
+
+// ----- (00410DEC) --------------------------------------------------------
+// unsigned int DrawLloydBeaconsScreen()
+// {
+ Player *pPlayer; // esi@1
+ const char *pText; // eax@1
+ int pTextHeight; // eax@14
+ int RemainingTime; // kr08_8@14
+ unsigned int pHours; // esi@14
+ unsigned int pDays; // eax@14
+ const char *pSelectionText; // eax@19
+ Texture *v19; // [sp-4h] [bp-8Ch]@4
+ GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
+ char *Str; // [sp+74h] [bp-14h]@14
+ int BeaconID; // [sp+78h] [bp-10h]@11
+ int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
+
+ pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
+ pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
+ pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon
+ pWindow.uFrameX = game_viewport_x;
+ pWindow.uFrameY = game_viewport_y;
+ pWindow.uFrameWidth = 428;
+ pWindow.uFrameHeight = game_viewport_height;
+ pWindow.uFrameZ = 435;
+ pWindow.uFrameW = game_viewport_w;
+ if (!bRecallingBeacon)
+ pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon
+ sprintf(pTmpBuf.data(), "%s", pText);
+ pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3);
+ if (bRecallingBeacon)
+ {
+ pRenderer->DrawTextureIndexedAlpha(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on);
+ v19 = pTex_book_button1_off;
+ }
+ else
+ {
+ pRenderer->DrawTextureIndexedAlpha(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off);
+ v19 = pTex_book_button1_on;
+ }
+ pRenderer->DrawTextureIndexedAlpha(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
+ uNumMaxBeacons = 1;
+ if (HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0)
+ {
+ uNumMaxBeacons = 5;
+ }
+ else
+ {
+ if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40)
+ uNumMaxBeacons = 3;
+ }
+ if (uNumMaxBeacons > 0)
+ {
+ for (BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++)
+ {
+ pWindow.uFrameWidth = 92;
+ pWindow.uFrameHeight = 68;
+ pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID];
+ pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID];
+ pWindow.uFrameW = pWindow.uFrameY + 67;
+ pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91;
+ //if ( pSavegameThumbnails[BeaconID].pPixels != 0 )
+ if (pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0)
+ {
+ pRenderer->DrawTextureIndexedAlpha(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
+ pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]);
+ Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName;
+ pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
+ pWindow.uFrameY += -6 - pTextHeight;
+ pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3);
+ RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed;
+ pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60;
+ pDays = pHours / 24;
+ if (pDays)
+ {
+ sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days
+ pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+ pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+ continue;
+ }
+ else
+ {
+ if (pHours + 1 <= 23)
+ {
+ if (pHours < 1)
+ pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour
+ else
+ pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours
+ sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText);
+ pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+ pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+ continue;
+ }
+ }
+ sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day
+ pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
+ pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+ continue;
+ }
+ if (!bRecallingBeacon)
+ {
+ pRenderer->DrawTextureIndexedAlpha(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
+ pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
+ pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно
+ }
+ }
+ }
+ if (byte_506360)
+ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/LloydsBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/LloydsBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_LloydsBook : public GUIWindow_Book
+{
+ GUIWindow_LloydsBook();
+ virtual ~GUIWindow_LloydsBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/MapBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/MapBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,584 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/Events.h"
+#include "Engine/OurMath.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+#include "Engine/Graphics/Outdoor.h"
+#include "Engine/Graphics/Indoor.h"
+#include "Engine/Graphics/Level/Decoration.h"
+
+#include "IO/Mouse.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/MapBook.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb
+
+
+GUIWindow_MapBook::GUIWindow_MapBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_MapsBook; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ pEventTimer->Pause();
+ viewparams->sViewCenterX = pParty->vPosition.x;
+ viewparams->sViewCenterY = pParty->vPosition.y;
+ pAudioPlayer->StopChannels(-1, -1);
+ pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(546, 353, 0, 0, (int)pBtn_Maps, 0);
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ dword_506364 = 1;
+ pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE);
+ pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE);
+ pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE);
+ pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE);
+ pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE);
+ pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE);
+ pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE);
+ pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE);
+ pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE);
+
+ pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_book_button1_on, 0);// "Zoom In"
+ pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_book_button2_on, 0);// "Zoom Out"
+ pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up
+ pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down
+ pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right"
+ pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
+ UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left"
+}
+
+
+
+
+void GUIWindow_MapBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_Map_Draw();
+
+// ----- (00413980) --------------------------------------------------------
+// void BookUI_Map_Draw()
+// {
+ unsigned int map_id; // eax@35
+ char party_coord[120]; // [sp+Ch] [bp-CCh]@37
+ GUIWindow map_window; // [sp+84h] [bp-54h]@35
+
+ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
+ if (BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12)//Button 1
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
+
+ if (BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3)//Button 2
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
+
+ if (Book_PageBtn3_flag)//Button 3
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
+
+ if (Book_PageBtn4_flag)//Button 4
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
+
+ if (Book_PageBtn5_flag)//Button 5
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
+
+ if (Book_PageBtn6_flag)//Button 6
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
+
+ if (BtnDown_flag)
+ viewparams->CenterOnParty2();
+ if (BtnUp_flag)
+ viewparams->CenterOnParty();
+ if (Book_PageBtn3_flag)
+ viewparams->_443219();
+ if (Book_PageBtn4_flag)
+ viewparams->_443231();
+ if (Book_PageBtn5_flag)
+ viewparams->_44323D();
+ if (Book_PageBtn6_flag)
+ viewparams->_443225();
+
+ if (BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag)
+ pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+ BtnUp_flag = 0;
+ BtnDown_flag = 0;
+ Book_PageBtn6_flag = 0;
+ Book_PageBtn5_flag = 0;
+ Book_PageBtn4_flag = 0;
+ Book_PageBtn3_flag = 0;
+ DrawBook_Map_sub(97, 49, 361, 313, 0);
+ pRenderer->DrawTextureIndexedAlpha(75, 22, pTexture_mapbordr);
+ map_window.uFrameWidth = game_viewport_width;
+ map_window.uFrameHeight = game_viewport_height;
+ map_window.uFrameX = game_viewport_x;
+ map_window.uFrameY = game_viewport_y;
+ map_window.uFrameZ = game_viewport_z;
+ map_window.uFrameW = game_viewport_w;
+ map_id = pMapStats->GetMapInfo(pCurrentMapName);
+ if (map_id)
+ map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
+
+ map_window.uFrameX = 0;
+ sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d"
+ map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+//----- (00442955) --------------------------------------------------------
+void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074)
+{
+ int v20; // eax@16
+ int v26; // ecx@21
+ unsigned __int16 *v27; // edi@21
+ int v28; // edx@21
+ int v29; // eax@21
+ double v30; // st7@23
+ int textr_width; // esi@23
+ signed int v47; // esi@38
+ signed int v48; // ecx@38
+ int v49; // eax@38
+ signed int v50; // edx@55
+ unsigned int v51; // ecx@55
+ int v54; // esi@75
+ int v55; // eax@75
+ double v57; // st7@85
+ signed int v60; // edi@85
+ signed int v62; // ebx@85
+ signed int v63; // esi@85
+ int v64; // eax@87
+ unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
+ int map_tile_X; // [sp+48020h] [bp-44h]@23
+ unsigned char* texture8_data;
+ unsigned char* curr_line;
+ int scale_increment;
+ int scaled_posX;
+ int scaled_posY;
+ int stepX_r;
+ int stepY_r;
+ unsigned int teal; // [sp+48028h] [bp-3Ch]@8
+ int pCenterY; // [sp+4802Ch] [bp-38h]@1
+ int screenCenter_X; // [sp+48030h] [bp-34h]@1
+ int pCenterX; // [sp+48034h] [bp-30h]@1
+ int v87; // [sp+48038h] [bp-2Ch]@16
+ unsigned int v88; // [sp+4803Ch] [bp-28h]@16
+ int black; // [sp+48040h] [bp-24h]@8
+ int screenCenterY; // [sp+48044h] [bp-20h]@1
+ unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
+ unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
+ signed int screenWidth; // [sp+48054h] [bp-10h]@8
+ unsigned int v95; // [sp+48058h] [bp-Ch]@16
+ int map_tile_Y; // [sp+4805Ch] [bp-8h]@10
+ const void *v97; // [sp+48060h] [bp-4h]@16
+
+ screenCenter_X = (signed int)(tl_x + br_x) / 2;
+ screenCenterY = (signed int)(tl_y + br_y) / 2;
+ pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
+ pCenterX = viewparams->sViewCenterX;
+ pCenterY = viewparams->sViewCenterY;
+ if (viewparams->uMapBookMapZoom != 384)
+ {
+ if (viewparams->uMapBookMapZoom == 768)
+ {
+ if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+ viewparams->uMapBookMapZoom = 680;
+ }
+ }
+ else
+ {
+ viewparams->sViewCenterX = viewparams->indoor_center_x;
+ pCenterX = viewparams->indoor_center_x;
+ pCenterY = viewparams->indoor_center_y;
+ if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+ viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34;
+ }
+ if (uCurrentlyLoadedLevelType != LEVEL_Indoor)
+ {
+ screenWidth = br_x - tl_x + 1;
+ screenHeight = br_y - tl_y + 1;
+ //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
+ texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
+ pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
+ scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
+
+ v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
+
+ teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
+
+ textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
+ stepY_r = (int)(signed __int64)((double)(-pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
+ black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30);
+
+ scaled_posY = stepY_r >> 16;
+ //nearest neiborhood scaling
+ if (texture8_data)
+ {
+ for (uint i = 0; i < screenHeight; ++i)
+ {
+ curr_line = &texture8_data[scaled_posY*textr_width];
+ stepX_r = teal;
+ for (uint j = 0; j < screenWidth; ++j)
+ {
+ scaled_posX = stepX_r >> 16;
+ //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
+ pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line + scaled_posX)]);
+ stepX_r += scale_increment;
+ }
+ stepY_r += scale_increment;
+ scaled_posY = stepY_r >> 16;
+ }
+ }
+
+ /*//move visible square to render
+ for( uint i = 0; i < screenHeight; ++i )
+ {
+ if ( screenWidth > 0 )
+ memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
+ }*/
+ }
+ else
+ {
+ black = Color16(0, 0, 0);
+ teal = Color16(0, 0xFF, 0xFF);
+ uNumBlueFacesInBLVMinimap = 0;
+ if (pIndoor->pMapOutlines->uNumOutlines)
+ {
+ for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i)
+ {
+ if (!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible()
+ || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible())))
+ {
+ if (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1))
+ {
+ if (!(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7)
+ && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7)))
+ {
+ pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1;
+ pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
+ }
+ }
+ if ((!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
+ && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7)
+ && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7)))
+ || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
+ {
+ v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX);
+ screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY;
+ v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY;
+ v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX;
+
+ v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom);
+ v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom);
+ v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom));
+ screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom);
+ pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87,
+ screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black);
+ }
+ }
+ }
+ }
+ if ((signed int)uNumBlueFacesInBLVMinimap > 0)
+ {
+ for (uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j)
+ {
+ v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x;
+ v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX);
+ v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY;
+ v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY;
+
+ v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom);
+ v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom);
+ uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom);
+ v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom);
+ pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)),
+ screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal);
+ }
+ viewparams->sViewCenterX = pCenterX;
+ }
+ }
+ v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3;
+ v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom));
+ v48 = 1;
+ v49 = screenCenterY - (int)v97 - 3;
+ if (v47 >= (signed int)tl_x)
+ {
+ if (v47 > (signed int)br_x)
+ {
+ if ((signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x)
+ v48 = 0;
+ v47 = br_x;
+ }
+ }
+ else
+ {
+ if ((signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x)
+ v48 = 0;
+ v47 = tl_x;
+ }
+ if (v49 >= (signed int)tl_y)
+ {
+ if (v49 > br_y)
+ {
+ if (screenCenterY - (signed int)v97 - 6 > br_y)
+ v48 = 0;
+ v49 = br_y;
+ }
+ }
+ else
+ {
+ if (screenCenterY - (signed int)v97 < (signed int)tl_y)
+ v48 = 0;
+ v49 = tl_y;
+ }
+ if (v48 == 1)
+ {
+ v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
+ if ((signed int)v51 <= 1920)
+ v50 = 6;
+ if ((signed int)v51 < 1664)
+ v50 = 5;
+ if ((signed int)v51 <= 1408)
+ v50 = 4;
+ if ((signed int)v51 < 1152)
+ v50 = 3;
+ if ((signed int)v51 <= 896)
+ v50 = 2;
+ if ((signed int)v51 < 640)
+ v50 = 1;
+ if ((signed int)v51 <= 384)
+ v50 = 0;
+ if ((signed int)v51 < 128 || (signed int)v51 > 1920)
+ v50 = 7;
+ pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
+ }
+ if ((signed int)uNumLevelDecorations > 0)
+ {
+ for (uint i = 0; i < (signed int)uNumLevelDecorations; ++i)
+ {
+ if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP)
+ {
+ screenHeight = pLevelDecorations[i].vPosition.y - pCenterY;
+ v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
+ v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X;
+ v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom));
+ v55 = screenCenterY - (int)v97;
+ //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z
+ // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
+ {
+ if (viewparams->uMapBookMapZoom > 512)
+ {
+ pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
+ pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
+ pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
+ }
+ else
+ pRenderer->RasterLine2D(v54, screenCenterY - (int)v97,
+ (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X,
+ screenCenterY - (int)v97, Color16(0xFF, 0xFF, 0xFF));
+ }
+ }
+ }
+ }
+ if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+ {
+ screenCenterY = br_x - tl_x + 1;
+ v95 = br_y - tl_y + 1;
+ //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
+ black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
+ v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
+ v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16;
+ teal = v60 >> 16;
+ pPalette_16 = (unsigned __int16 *)(v60 >> 16);
+ v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16);
+ v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16;
+ v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57));
+
+
+ for (int y = 0; y < (signed int)v95; ++y)
+ {
+ map_tile_Y = (v63 - 80) / 4;
+ v64 = teal;
+ for (int x = 0; x < screenCenterY; ++x)
+ {
+ map_tile_X = (v64 - 80) / 4;
+ if (!pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y))
+ {
+ if (pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y))
+ {
+ if (!((x + screenCenter_X) % 2))
+ //*a4a = Color16(12, 12, 12);
+ pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12));
+ }
+ else
+ //*a4a = 0;
+ pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0));
+ }
+ v97 = (char *)v97 + black;
+ v64 = (signed int)v97 >> 16;
+ }
+
+ v62 += black;
+ v97 = (const void *)v60;
+ v63 = v62 >> 16;
+ teal = (unsigned int)pPalette_16;
+ }
+ /*a4a = map_texture_16;
+ for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X )
+ {
+ if ( screenCenterY > 0 )
+ {
+ map_tile_Y = (v63 - 80) / 4;
+ v64 = teal;
+ for ( a5a = 0; a5a < screenCenterY; ++a5a )
+ {
+ map_tile_X = (v64 - 80) / 4;
+ if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) )
+ {
+ if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
+ {
+ if ( !((a5a + screenCenter_X) % 2) )
+ *a4a = Color16(0xCu, 0xCu, 0xCu);
+ }
+ else
+ *a4a = 0;
+ }
+ ++a4a;
+ v97 = (char *)v97 + black;
+ v64 = (signed int)v97 >> 16;
+ }
+ }
+ v62 += black;
+ v97 = (const void *)v60;
+ a4a += screenCenterY - a5a;
+ v63 = v62 >> 16;
+ teal = (unsigned int)pPalette_16;
+ }
+
+ v66 = map_texture_16;
+ if ( (signed int)v95 > 0 )
+ {
+ v67 = v77;
+ result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY);
+ for ( v65 = v95; v65; --v65 )
+ {
+ if ( screenCenterY > 0 )
+ {
+ for ( v68 = screenCenterY; v68; --v68 )
+ {
+ v69 = *(short *)v66;
+ if ( !*(short *)v66 || v69 == (short)result )
+ *v67 = v69;
+ ++v66;
+ ++v67;
+ }
+ }
+ v67 = (unsigned __int16 *)((char *)v67 + result);
+ }
+ }*/
+ }
+}
+
+//----- (00444564) --------------------------------------------------------
+const char * GetMapBookHintText()
+{
+ int v20;
+ int v21; // [sp+14h] [bp-Ch]@1
+ double v0; // st7@3
+ unsigned int pX; // [sp+1Ch] [bp-4h]@3
+ unsigned int pY; // [sp+8h] [bp-18h]@3
+ int global_coord_X; // ebx@3
+ int global_coord_Y;
+ int map_tile_X; // edi@3
+ int map_tile_Y; // eax@3
+ const char *result; // eax@15
+
+ v20 = viewparams->sViewCenterX;
+ v21 = viewparams->sViewCenterY;
+ if (viewparams->uMapBookMapZoom == 384)
+ {
+ v20 = viewparams->indoor_center_x;
+ v21 = viewparams->indoor_center_y;
+ }
+ pMouse->GetClickPos(&pX, &pY);
+ v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789);
+
+ global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
+ global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0);
+
+ result = 0;
+ map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме)
+ map_tile_Y = abs(global_coord_Y - 22528) / 512;
+ if (pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0)
+ {
+ for (int i = 0; i < pOutdoor->uNumBModels && !result; i++)
+ {
+ if (int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X),
+ abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius)
+ {
+ if (pOutdoor->pBModels[i].uNumFaces > 0)
+ {
+ for (int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++)
+ {
+ if (pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID)
+ {
+ if (!(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT))
+ {
+ if (GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID))
+ {
+ if (_stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), ""))
+ result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return result;
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/MapBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/MapBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,14 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+
+const char *GetMapBookHintText();//sub_444564
+
+
+struct GUIWindow_MapBook : public GUIWindow_Book
+{
+ GUIWindow_MapBook();
+ virtual ~GUIWindow_MapBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/QuestBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/QuestBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,141 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/Awards.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/QuestBook.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+GUIWindow_QuestBook::GUIWindow_QuestBook() :
+ GUIWindow_Book()
+{
+ this->ptr_1C = (void *)WINDOW_QuestBook; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// --------------------------------
+// 004304E7 Game_EventLoop --- part
+ pEventTimer->Pause();
+ pAudioPlayer->StopChannels(-1, -1);
+ pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(493u, 355u, 0, 0, (int)pBtn_Quests, 0);
+ bFlashQuestBook = 0;
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE);
+ pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
+ pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
+ pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
+ pBtn_Book_1 = CreateButton(
+ pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
+ pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight,
+ 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up"
+ pTex_book_button1_on, 0
+ );
+ pBtn_Book_2 = CreateButton(
+ pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38,
+ pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight,
+ 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
+ pTex_book_button2_on, 0
+ );
+ num_achieved_awards = 0;
+ memset(achieved_awards.data(), 0, 4000);
+ for (uint i = books_primary_item_per_page; i < 512; ++i)
+ {
+ if (_449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i])
+ {
+ achieved_awards[num_achieved_awards] = (AwardType)i;
+ ++num_achieved_awards;
+ }
+ }
+ full_num_items_in_book = num_achieved_awards;
+ num_achieved_awards = 0;
+}
+
+
+
+void GUIWindow_QuestBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_Questbook_Draw();
+
+// ----- (00413126) --------------------------------------------------------
+// void BookUI_Questbook_Draw()
+// {
+ int pTextHeight; // eax@19
+ GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9
+
+ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook);
+ if (BtnUp_flag || !books_primary_item_per_page)//Bookmark Up(Закладка вверх)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
+
+ if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)//Bookmark Down(Закладка вниз)
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
+ else
+ pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
+
+ //for title
+ questbook_window.uFrameWidth = game_viewport_width;
+ questbook_window.uFrameHeight = game_viewport_height;
+ questbook_window.uFrameX = game_viewport_x;
+ questbook_window.uFrameY = game_viewport_y;
+ questbook_window.uFrameZ = game_viewport_z;
+ questbook_window.uFrameW = game_viewport_w;
+ questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests"
+
+ //for other text
+ questbook_window.uFrameX = 48;
+ questbook_window.uFrameY = 70;
+ questbook_window.uFrameWidth = 360;
+ questbook_window.uFrameHeight = 264;
+ questbook_window.uFrameZ = 407;
+ questbook_window.uFrameW = 333;
+ if (BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book)//Click Bookmark Down(нажатие закладки вниз)
+ {
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ books_primary_item_per_page += num_achieved_awards;
+ books_num_items_per_page[books_page_number++] = num_achieved_awards;
+ }
+ if (BtnUp_flag && books_page_number)//Click Bookmark Up(Нажатие закладки вверх)
+ {
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ --books_page_number;
+ books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
+ }
+ if (!num_achieved_awards || !books_primary_item_per_page)
+ {
+ books_page_number = 0;
+ books_primary_item_per_page = 0;
+ }
+ BtnDown_flag = 0;
+ BtnUp_flag = 0;
+ num_achieved_awards = 0;
+ for (uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i)
+ {
+ ++num_achieved_awards;
+ questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0);
+ pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0);
+ if ((signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight)
+ break;
+ pRenderer->DrawTextureIndexedAlpha(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10);
+ questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24;
+ }
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/QuestBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/QuestBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_QuestBook : public GUIWindow_Book
+{
+ GUIWindow_QuestBook();
+ virtual ~GUIWindow_QuestBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/TownPortalBook.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/TownPortalBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,106 @@
+#include "Engine/Engine.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+
+#include "GUI/GUIFont.h"
+#include "GUI/UI/Books/TownPortalBook.h"
+
+#include "IO/Mouse.h"
+
+static int pTownPortalBook_xs[6] = { 260, 324, 147, 385, 390, 19 };
+static int pTownPortalBook_ys[6] = { 206, 84, 182, 239, 17, 283 };
+static int pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74 };
+static int pTownPortalBook_hs[6] = { 55, 56, 65, 67, 67, 59 };
+
+GUIWindow_TownPortalBook::GUIWindow_TownPortalBook(const char *a1) :
+ GUIWindow_Book()
+{
+ this->Hint = a1; // inherited from GUIWindow::GUIWindow
+ this->ptr_1C = (void *)WINDOW_TownPortal; // inherited from GUIWindow::GUIWindow
+ BasicBookInitialization();
+
+// ----------------------------------------------
+// 00411BFC GUIWindow::InitializeBookView -- part
+ pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE);
+ pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE);
+
+ for (uint i = 0; i < 6; ++i)
+ CreateButton(
+ pTownPortalBook_xs[i],
+ pTownPortalBook_ys[i],
+ pTownPortalBook_ws[i],
+ pTownPortalBook_hs[i],
+ 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr
+ );
+}
+
+
+void GUIWindow_TownPortalBook::Update()
+{
+// -----------------------------------
+// 004156F0 GUI_UpdateWindows --- part
+// {
+// BookUI_Draw((WindowType)(int)ptr_1C);
+// }
+
+// ----- (00413CC6) --------------------------------------------------------
+// void BookUI_Draw(WindowType book) --- part
+// {
+ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+// BookUI_DrawTownPortalMap();
+
+// ----- (00411150) --------------------------------------------------------
+// void BookUI_DrawTownPortalMap()
+// {
+ int v3; // edi@17
+ GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1
+ POINT a2; // [sp+68h] [bp-8h]@17
+
+ pRenderer->ClearZBuffer(0, 479);
+ pRenderer->DrawTextureIndexedAlpha(8, 8, pTexture_CurrentBook);
+ pRenderer->DrawTextureIndexedAlpha(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
+
+ TownPortalWindow.uFrameX = game_viewport_x;
+ TownPortalWindow.uFrameY = game_viewport_y;
+ TownPortalWindow.uFrameWidth = game_viewport_width;
+ TownPortalWindow.uFrameHeight = game_viewport_height;
+ TownPortalWindow.uFrameZ = game_viewport_z;
+ TownPortalWindow.uFrameW = game_viewport_w;
+
+ const uint fountain_bits_lut[] =
+ {
+ PARTY_QUEST_FOUNTAIN_HARMONDALE,
+ PARTY_QUEST_FOUNTAIN_PIERPONT,
+ PARTY_QUEST_FOUNTAIN_NIGHON,
+ PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
+ PARTY_QUEST_FOUNTAIN_CELESTIA,
+ PARTY_QUEST_FOUNTAIN_THE_PIT
+ };
+ for (uint i = 0; i < 6; ++i)
+ {
+
+ if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
+ pRenderer->DrawMaskToZBuffer(
+ pTownPortalBook_xs[i],
+ pTownPortalBook_ys[i],
+ pTexture_TownPortalIcons[i], i + 1
+ );
+ }
+
+ pMouse->GetCursorPos(&a2);
+ v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
+
+ if (v3)
+ {
+ if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
+ pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
+ }
+ TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3);
+}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/TownPortalBook.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GUI/UI/Books/TownPortalBook.h Tue May 12 03:24:19 2015 +0200
@@ -0,0 +1,10 @@
+#pragma once
+#include "GUI/UI/UIBooks.h"
+
+struct GUIWindow_TownPortalBook : public GUIWindow_Book
+{
+ GUIWindow_TownPortalBook(const char *a1);
+ virtual ~GUIWindow_TownPortalBook() {}
+
+ virtual void Update();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/UIMapBook.cpp
--- a/GUI/UI/Books/UIMapBook.cpp Tue May 12 01:45:31 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,677 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#include "Engine/Engine.h"
-
-#include "UIMapBook.h"
-#include "..\..\..\Engine/Events.h"
-#include "..\..\..\Engine/Graphics/Render.h"
-#include "..\..\..\IO/Mouse.h"
-#include "..\UIBooks.h"
-#include "..\..\..\Engine/MapInfo.h"
-#include "..\..\..\GUI/GUIWindow.h"
-#include "..\..\..\GUI/GUIFont.h"
-#include "..\..\..\Engine/Party.h"
-#include "..\..\..\Media/Audio/AudioPlayer.h"
-#include "..\..\..\Engine/Graphics/Outdoor.h"
-#include "..\..\..\Engine/LOD.h"
-#include "..\..\..\Engine/Graphics/Viewport.h"
-#include "..\..\..\Engine/OurMath.h"
-#include "..\..\..\Engine/texts.h"
-#include "..\..\..\Engine/Graphics/Level/Decoration.h"
-
-
-
-std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390, 19}};
-std::array<__int16, 6> pTownPortalBook_ys = {{206, 84, 182, 239, 17, 283}};
-
-std::array pLloydsBeaconsPreviewXs = {{61, 281, 61, 281, 171}}; // 004E249C
-std::array pLloydsBeaconsPreviewYs = {{84, 84, 228, 228, 155}};
-std::array pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}};
-std::array pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}};
-
-
-
-
-//----- (00411150) --------------------------------------------------------
-void BookUI_DrawTownPortalMap()
-{
- int v3; // edi@17
- GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1
- POINT a2; // [sp+68h] [bp-8h]@17
-
- pRenderer->ClearZBuffer(0, 479);
- pRenderer->DrawTextureIndexedAlpha(8, 8, pTexture_CurrentBook);
- pRenderer->DrawTextureIndexedAlpha(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
-
- TownPortalWindow.uFrameX = game_viewport_x;
- TownPortalWindow.uFrameY = game_viewport_y;
- TownPortalWindow.uFrameWidth = game_viewport_width;
- TownPortalWindow.uFrameHeight = game_viewport_height;
- TownPortalWindow.uFrameZ = game_viewport_z;
- TownPortalWindow.uFrameW = game_viewport_w;
-
- const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
- PARTY_QUEST_FOUNTAIN_PIERPONT,
- PARTY_QUEST_FOUNTAIN_NIGHON,
- PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
- PARTY_QUEST_FOUNTAIN_CELESTIA,
- PARTY_QUEST_FOUNTAIN_THE_PIT};
- for (uint i = 0; i < 6; ++i)
- {
-
- if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
- pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i],
- pTownPortalBook_ys[i],
- pTexture_TownPortalIcons[i], i + 1);
- }
-
- pMouse->GetCursorPos(&a2);
- v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
-
- if (v3)
- {
- if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
- pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
- }
- TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3);
-}
-
-//----- (00410DEC) --------------------------------------------------------
-unsigned int DrawLloydBeaconsScreen()
-{
- Player *pPlayer; // esi@1
- const char *pText; // eax@1
- int pTextHeight; // eax@14
- int RemainingTime; // kr08_8@14
- unsigned int pHours; // esi@14
- unsigned int pDays; // eax@14
- const char *pSelectionText; // eax@19
- Texture *v19; // [sp-4h] [bp-8Ch]@4
- GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
- char *Str; // [sp+74h] [bp-14h]@14
- int BeaconID; // [sp+78h] [bp-10h]@11
- int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
-
- pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
- pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
- pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon
- pWindow.uFrameX = game_viewport_x;
- pWindow.uFrameY = game_viewport_y;
- pWindow.uFrameWidth = 428;
- pWindow.uFrameHeight = game_viewport_height;
- pWindow.uFrameZ = 435;
- pWindow.uFrameW = game_viewport_w;
- if ( !bRecallingBeacon )
- pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon
- sprintf(pTmpBuf.data(), "%s", pText);
- pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3);
- if ( bRecallingBeacon )
- {
- pRenderer->DrawTextureIndexedAlpha(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on);
- v19 = pTex_book_button1_off;
- }
- else
- {
- pRenderer->DrawTextureIndexedAlpha(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off);
- v19 = pTex_book_button1_on;
- }
- pRenderer->DrawTextureIndexedAlpha(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
- uNumMaxBeacons = 1;
- if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 )
- {
- uNumMaxBeacons = 5;
- }
- else
- {
- if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 )
- uNumMaxBeacons = 3;
- }
- if ( uNumMaxBeacons > 0 )
- {
- for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ )
- {
- pWindow.uFrameWidth = 92;
- pWindow.uFrameHeight = 68;
- pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID];
- pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID];
- pWindow.uFrameW = pWindow.uFrameY + 67;
- pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91;
- //if ( pSavegameThumbnails[BeaconID].pPixels != 0 )
- if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 )
- {
- pRenderer->DrawTextureIndexedAlpha(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
- pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]);
- Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName;
- pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
- pWindow.uFrameY += -6 - pTextHeight;
- pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3);
- RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed;
- pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60;
- pDays = pHours / 24;
- if ( pDays )
- {
- sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days
- pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
- pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
- continue;
- }
- else
- {
- if ( pHours + 1 <= 23 )
- {
- if ( pHours < 1 )
- pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour
- else
- pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours
- sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText);
- pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
- pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
- continue;
- }
- }
- sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day
- pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
- pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
- continue;
- }
- if ( !bRecallingBeacon )
- {
- pRenderer->DrawTextureIndexedAlpha(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
- pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
- pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно
- }
- }
- }
- if ( byte_506360 )
- pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
- return BeaconID;
-}
-
-//----- (00413980) --------------------------------------------------------
-void BookUI_Map_Draw()
-{
- unsigned int map_id; // eax@35
- char party_coord[120]; // [sp+Ch] [bp-CCh]@37
- GUIWindow map_window; // [sp+84h] [bp-54h]@35
-
- pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
- if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
-
- if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
-
- if ( Book_PageBtn3_flag )//Button 3
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
-
- if ( Book_PageBtn4_flag )//Button 4
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
-
- if ( Book_PageBtn5_flag )//Button 5
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
-
- if ( Book_PageBtn6_flag )//Button 6
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
-
- if ( BtnDown_flag )
- viewparams->CenterOnParty2();
- if ( BtnUp_flag )
- viewparams->CenterOnParty();
- if ( Book_PageBtn3_flag )
- viewparams->_443219();
- if ( Book_PageBtn4_flag )
- viewparams->_443231();
- if ( Book_PageBtn5_flag )
- viewparams->_44323D();
- if ( Book_PageBtn6_flag )
- viewparams->_443225();
-
- if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag )
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- BtnUp_flag = 0;
- BtnDown_flag = 0;
- Book_PageBtn6_flag = 0;
- Book_PageBtn5_flag = 0;
- Book_PageBtn4_flag = 0;
- Book_PageBtn3_flag = 0;
- DrawBook_Map_sub(97, 49, 361, 313, 0);
- pRenderer->DrawTextureIndexedAlpha(75, 22, pTexture_mapbordr);
- map_window.uFrameWidth = game_viewport_width;
- map_window.uFrameHeight = game_viewport_height;
- map_window.uFrameX = game_viewport_x;
- map_window.uFrameY = game_viewport_y;
- map_window.uFrameZ = game_viewport_z;
- map_window.uFrameW = game_viewport_w;
- map_id = pMapStats->GetMapInfo(pCurrentMapName);
- if ( map_id )
- map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
-
- map_window.uFrameX = 0;
- sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d"
- map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0);
-}
-
-//----- (00442955) --------------------------------------------------------
-void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
-{
- int v20; // eax@16
- int v26; // ecx@21
- unsigned __int16 *v27; // edi@21
- int v28; // edx@21
- int v29; // eax@21
- double v30; // st7@23
- int textr_width; // esi@23
- signed int v47; // esi@38
- signed int v48; // ecx@38
- int v49; // eax@38
- signed int v50; // edx@55
- unsigned int v51; // ecx@55
- int v54; // esi@75
- int v55; // eax@75
- double v57; // st7@85
- signed int v60; // edi@85
- signed int v62; // ebx@85
- signed int v63; // esi@85
- int v64; // eax@87
- unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
- int map_tile_X; // [sp+48020h] [bp-44h]@23
- unsigned char* texture8_data;
- unsigned char* curr_line;
- int scale_increment;
- int scaled_posX;
- int scaled_posY;
- int stepX_r;
- int stepY_r;
- unsigned int teal; // [sp+48028h] [bp-3Ch]@8
- int pCenterY; // [sp+4802Ch] [bp-38h]@1
- int screenCenter_X; // [sp+48030h] [bp-34h]@1
- int pCenterX; // [sp+48034h] [bp-30h]@1
- int v87; // [sp+48038h] [bp-2Ch]@16
- unsigned int v88; // [sp+4803Ch] [bp-28h]@16
- int black; // [sp+48040h] [bp-24h]@8
- int screenCenterY; // [sp+48044h] [bp-20h]@1
- unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
- unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
- signed int screenWidth; // [sp+48054h] [bp-10h]@8
- unsigned int v95; // [sp+48058h] [bp-Ch]@16
- int map_tile_Y; // [sp+4805Ch] [bp-8h]@10
- const void *v97; // [sp+48060h] [bp-4h]@16
-
- screenCenter_X = (signed int)(tl_x + br_x) / 2;
- screenCenterY = (signed int)(tl_y + br_y) / 2;
- pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
- pCenterX = viewparams->sViewCenterX;
- pCenterY = viewparams->sViewCenterY;
- if ( viewparams->uMapBookMapZoom != 384 )
- {
- if ( viewparams->uMapBookMapZoom == 768 )
- {
- if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
- viewparams->uMapBookMapZoom = 680;
- }
- }
- else
- {
- viewparams->sViewCenterX = viewparams->indoor_center_x;
- pCenterX = viewparams->indoor_center_x;
- pCenterY = viewparams->indoor_center_y;
- if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
- viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34;
- }
- if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
- {
- screenWidth = br_x - tl_x + 1;
- screenHeight = br_y - tl_y + 1;
- //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
- texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
- pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
- scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
-
- v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
-
- teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
-
- textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
- stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16;
- black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30);
-
- scaled_posY = stepY_r >> 16;
- //nearest neiborhood scaling
- if ( texture8_data)
- {
- for( uint i = 0; i < screenHeight; ++i )
- {
- curr_line = &texture8_data[scaled_posY*textr_width];
- stepX_r = teal;
- for( uint j = 0; j < screenWidth; ++j )
- {
- scaled_posX = stepX_r>>16;
- //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
- pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]);
- stepX_r += scale_increment;
- }
- stepY_r+=scale_increment;
- scaled_posY=stepY_r>>16;
- }
- }
-
- /*//move visible square to render
- for( uint i = 0; i < screenHeight; ++i )
- {
- if ( screenWidth > 0 )
- memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
- }*/
- }
- else
- {
- black = Color16(0, 0, 0);
- teal = Color16(0, 0xFF, 0xFF);
- uNumBlueFacesInBLVMinimap = 0;
- if ( pIndoor->pMapOutlines->uNumOutlines )
- {
- for ( uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i )
- {
- if ( !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible()
- || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible()) ))
- {
- if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) )
- {
- if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7)
- && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7) ))
- {
- pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1;
- pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
- }
- }
- if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
- && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7)
- && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7) ))
- || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1)
- {
- v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX);
- screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY;
- v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY;
- v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX;
-
- v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom);
- v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom);
- v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom));
- screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom);
- pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87,
- screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black);
- }
- }
- }
- }
- if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
- {
- for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j )
- {
- v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x;
- v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX);
- v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY;
- v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY;
-
- v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom);
- v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom);
- uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom);
- v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom);
- pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)),
- screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal);
- }
- viewparams->sViewCenterX = pCenterX;
- }
- }
- v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3;
- v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom));
- v48 = 1;
- v49 = screenCenterY - (int)v97 - 3;
- if ( v47 >= (signed int)tl_x )
- {
- if ( v47 > (signed int)br_x )
- {
- if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x )
- v48 = 0;
- v47 = br_x;
- }
- }
- else
- {
- if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x )
- v48 = 0;
- v47 = tl_x;
- }
- if ( v49 >= (signed int)tl_y )
- {
- if ( v49 > br_y )
- {
- if ( screenCenterY - (signed int)v97 - 6 > br_y )
- v48 = 0;
- v49 = br_y;
- }
- }
- else
- {
- if ( screenCenterY - (signed int)v97 < (signed int)tl_y )
- v48 = 0;
- v49 = tl_y;
- }
- if ( v48 == 1 )
- {
- v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
- if ( (signed int)v51 <= 1920 )
- v50 = 6;
- if ( (signed int)v51 < 1664 )
- v50 = 5;
- if ( (signed int)v51 <= 1408 )
- v50 = 4;
- if ( (signed int)v51 < 1152 )
- v50 = 3;
- if ( (signed int)v51 <= 896 )
- v50 = 2;
- if ( (signed int)v51 < 640 )
- v50 = 1;
- if ( (signed int)v51 <= 384 )
- v50 = 0;
- if ( (signed int)v51 < 128 || (signed int)v51 > 1920 )
- v50 = 7;
- pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
- }
- if ( (signed int)uNumLevelDecorations > 0 )
- {
- for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )
- {
- if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP)
- {
- screenHeight = pLevelDecorations[i].vPosition.y - pCenterY;
- v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
- v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X;
- v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom));
- v55 = screenCenterY - (int)v97;
- //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z
- // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
- {
- if ( viewparams->uMapBookMapZoom > 512 )
- {
- pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
- pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
- pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
- }
- else
- pRenderer->RasterLine2D(v54, screenCenterY - (int)v97,
- (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X,
- screenCenterY - (int)v97, Color16(0xFF, 0xFF, 0xFF));
- }
- }
- }
- }
- if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
- {
- screenCenterY = br_x - tl_x + 1;
- v95 = br_y - tl_y + 1;
- //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
- black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
- v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
- v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16;
- teal = v60 >> 16;
- pPalette_16 = (unsigned __int16 *)(v60 >> 16);
- v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16);
- v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16;
- v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57));
-
-
- for (int y = 0; y < (signed int)v95; ++y)
- {
- map_tile_Y = (v63 - 80) / 4;
- v64 = teal;
- for (int x = 0; x < screenCenterY; ++x)
- {
- map_tile_X = (v64 - 80) / 4;
- if ( !pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) )
- {
- if ( pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y) )
- {
- if ( !((x + screenCenter_X) % 2) )
- //*a4a = Color16(12, 12, 12);
- pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12));
- }
- else
- //*a4a = 0;
- pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0));
- }
- v97 = (char *)v97 + black;
- v64 = (signed int)v97 >> 16;
- }
-
- v62 += black;
- v97 = (const void *)v60;
- v63 = v62 >> 16;
- teal = (unsigned int)pPalette_16;
- }
- /*a4a = map_texture_16;
- for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X )
- {
- if ( screenCenterY > 0 )
- {
- map_tile_Y = (v63 - 80) / 4;
- v64 = teal;
- for ( a5a = 0; a5a < screenCenterY; ++a5a )
- {
- map_tile_X = (v64 - 80) / 4;
- if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) )
- {
- if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
- {
- if ( !((a5a + screenCenter_X) % 2) )
- *a4a = Color16(0xCu, 0xCu, 0xCu);
- }
- else
- *a4a = 0;
- }
- ++a4a;
- v97 = (char *)v97 + black;
- v64 = (signed int)v97 >> 16;
- }
- }
- v62 += black;
- v97 = (const void *)v60;
- a4a += screenCenterY - a5a;
- v63 = v62 >> 16;
- teal = (unsigned int)pPalette_16;
- }
-
- v66 = map_texture_16;
- if ( (signed int)v95 > 0 )
- {
- v67 = v77;
- result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY);
- for ( v65 = v95; v65; --v65 )
- {
- if ( screenCenterY > 0 )
- {
- for ( v68 = screenCenterY; v68; --v68 )
- {
- v69 = *(short *)v66;
- if ( !*(short *)v66 || v69 == (short)result )
- *v67 = v69;
- ++v66;
- ++v67;
- }
- }
- v67 = (unsigned __int16 *)((char *)v67 + result);
- }
- }*/
- }
-}
-
-//----- (00444564) --------------------------------------------------------
-const char * GetMapBookHintText()
-{
- int v20;
- int v21; // [sp+14h] [bp-Ch]@1
- double v0; // st7@3
- unsigned int pX; // [sp+1Ch] [bp-4h]@3
- unsigned int pY; // [sp+8h] [bp-18h]@3
- int global_coord_X; // ebx@3
- int global_coord_Y;
- int map_tile_X; // edi@3
- int map_tile_Y; // eax@3
- const char *result; // eax@15
-
- v20 = viewparams->sViewCenterX;
- v21 = viewparams->sViewCenterY;
- if ( viewparams->uMapBookMapZoom == 384 )
- {
- v20 = viewparams->indoor_center_x;
- v21 = viewparams->indoor_center_y;
- }
- pMouse->GetClickPos(&pX, &pY);
- v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789);
-
- global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
- global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0);
-
- result = 0;
- map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме)
- map_tile_Y = abs(global_coord_Y - 22528) / 512;
- if ( pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 )
- {
- for(int i = 0; i < pOutdoor->uNumBModels && !result; i++)
- {
- if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X),
- abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius )
- {
- if ( pOutdoor->pBModels[i].uNumFaces > 0 )
- {
- for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ )
- {
- if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID )
- {
- if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT) )
- {
- if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) )
- {
- if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") )
- result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID);
- }
- }
- }
- }
- }
- }
- }
- }
- return result;
-}
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/UIMapBook.h
--- a/GUI/UI/Books/UIMapBook.h Tue May 12 01:45:31 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-
-void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb
-const char *GetMapBookHintText();//sub_444564
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/UINotesBooks.cpp
--- a/GUI/UI/Books/UINotesBooks.cpp Tue May 12 01:45:31 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#include "Engine/Engine.h"
-
-#include "..\..\..\Engine/Graphics/Render.h"
-#include "..\..\..\IO/Mouse.h"
-#include "..\UIBooks.h"
-#include "..\..\..\Engine/MapInfo.h"
-#include "..\..\..\GUI/GUIWindow.h"
-#include "..\..\..\GUI/GUIFont.h"
-#include "..\..\..\Engine/Party.h"
-#include "..\..\..\Media/Audio/AudioPlayer.h"
-#include "..\..\..\Engine/LOD.h"
-#include "..\..\..\Engine/Graphics/Viewport.h"
-#include "..\..\..\Engine/Awards.h"
-#include "..\..\..\Engine/Autonotes.h"
-#include "..\..\..\Engine/Tables/StorylineTextTable.h"
-#include "..\..\..\Engine/texts.h"
-
-//----- (00413D3C) --------------------------------------------------------
-static const char *GetDayPart()
-{
- if ( pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20 )
- return pGlobalTXT_LocalizationStrings[56]; // "Day"
- else if ( pParty->uCurrentHour == 5 )
- return pGlobalTXT_LocalizationStrings[55]; // "Dawn"
- else if ( pParty->uCurrentHour == 20 )
- return pGlobalTXT_LocalizationStrings[566]; // "Dusk"
- else
- return pGlobalTXT_LocalizationStrings[567]; // "Night"
-}
-
-//----- (00413D6F) --------------------------------------------------------
-void BookUI_Calendar_Draw()
-{
- int am; // ecx@5
- char *pMapName; // eax@6
- GUIWindow calendar_window; // [sp+Ch] [bp-60h]@5
- unsigned int pMapID; // [sp+60h] [bp-Ch]@1
- unsigned int pHour;
-
- static unsigned int pDayMoonPhase[28] = // 4E1B18
- {
- 0, 0, 0,
- 1, 1, 1, 1,
- 2, 2, 2,
- 3, 3, 3, 3,
- 4, 4, 4,
- 3, 3, 3, 3,
- 2, 2, 2,
- 1, 1, 1, 1
- };
-
- pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
- pHour = pParty->uCurrentHour;
- if ( (signed int)pHour >= 12 )
- {
- pHour -= 12;
- if ( !pHour )
- pHour = 12;
- am = 1;
- }
- else
- am = 0;
-
- calendar_window.uFrameX = game_viewport_x;
- calendar_window.uFrameY = game_viewport_y;
- calendar_window.uFrameWidth = game_viewport_width;
- calendar_window.uFrameHeight = game_viewport_height;
- calendar_window.uFrameZ = game_viewport_z;
- calendar_window.uFrameW = game_viewport_w;
- calendar_window.DrawTitleText(pBook2Font, 0, 22, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia"
-
- sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time"
- pHour, pParty->uCurrentMinute, aAMPMNames[am], GetDayPart());
- calendar_window.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0);
-
- sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day"
- pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]);
- calendar_window.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0);
-
- sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month"
- pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]);
- calendar_window.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0);
-
- sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
- calendar_window.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0);
-
- sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
- calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
-
- pMapID = pMapStats->GetMapInfo(pCurrentMapName);
- if ( pMapID )
- pMapName = pMapStats->pInfos[pMapID].pName;
- else
- pMapName = "Unknown";
- sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], pMapName); // "Location"
- calendar_window.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0);
-}
-
-//----- (00413126) --------------------------------------------------------
-void BookUI_Questbook_Draw()
-{
- int pTextHeight; // eax@19
- GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9
-
- pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook);
- if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
-
- if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down(Закладка вниз)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
-
- //for title
- questbook_window.uFrameWidth = game_viewport_width;
- questbook_window.uFrameHeight = game_viewport_height;
- questbook_window.uFrameX = game_viewport_x;
- questbook_window.uFrameY = game_viewport_y;
- questbook_window.uFrameZ = game_viewport_z;
- questbook_window.uFrameW = game_viewport_w;
- questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests"
-
- //for other text
- questbook_window.uFrameX = 48;
- questbook_window.uFrameY = 70;
- questbook_window.uFrameWidth = 360;
- questbook_window.uFrameHeight = 264;
- questbook_window.uFrameZ = 407;
- questbook_window.uFrameW = 333;
- if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down(нажатие закладки вниз)
- {
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- books_primary_item_per_page += num_achieved_awards;
- books_num_items_per_page[books_page_number++] = num_achieved_awards;
- }
- if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх)
- {
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- --books_page_number;
- books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
- }
- if ( !num_achieved_awards || !books_primary_item_per_page )
- {
- books_page_number = 0;
- books_primary_item_per_page = 0;
- }
- BtnDown_flag = 0;
- BtnUp_flag = 0;
- num_achieved_awards = 0;
- for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i )
- {
- ++num_achieved_awards;
- questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0);
- pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0);
- if ( (signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight )
- break;
- pRenderer->DrawTextureIndexedAlpha(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10);
- questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24;
- }
-}
-
-//----- (0041338E) --------------------------------------------------------
-void BookUI_Autonotes_Draw()
-{
- int pTextHeight; // eax@65
- bool change_flag; // [sp+10h] [bp-58h]@1
- GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46
-
- change_flag = false;
- pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook);
- if ( BtnUp_flag || !books_primary_item_per_page )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
-
- if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
-
- if ( Book_PageBtn3_flag )//Potions_page_flag
- {
- if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
- else//press(нажатие)
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_POTION_RECEPIE;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
- }
- }
- else
- {
- if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on);
- else//Potions_page not active(вкладка снадобья не активна)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off);
- }
-
- if ( Book_PageBtn4_flag )//Fontains_page_flag
- {
- if ( _506568_autonote_type == AUTONOTE_STAT_HINT )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
- else
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_STAT_HINT;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
- }
- }
- else
- {
- if ( _506568_autonote_type == AUTONOTE_STAT_HINT )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off);
- }
-
- if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag
- {
- if ( _506568_autonote_type == AUTONOTE_OBELISK)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
- else
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_OBELISK;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
- }
- }
- else
- {
- if ( _506568_autonote_type == AUTONOTE_OBELISK)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off);
- }
-
- if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag
- {
- if ( _506568_autonote_type == AUTONOTE_SEER)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
- else
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_SEER;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
- }
- }
- else
- {
- if ( _506568_autonote_type == AUTONOTE_SEER)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off);
- }
-
- if ( Autonotes_Misc_page_flag )
- {
- if ( _506568_autonote_type == AUTONOTE_MISC)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
- else
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_MISC;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
- }
- }
- else
- {
- if ( _506568_autonote_type == AUTONOTE_MISC)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off);
- }
-
- if ( Autonotes_Instructors_page_flag )
- {
- if ( _506568_autonote_type == AUTONOTE_TEACHER)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
- else
- {
- change_flag = true;
- pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
- _506568_autonote_type = AUTONOTE_TEACHER;
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
- }
- }
- else
- {
- if ( _506568_autonote_type == AUTONOTE_TEACHER)
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off);
- }
-
- //for title
- autonotes_window.uFrameWidth = game_viewport_width;
- autonotes_window.uFrameHeight = game_viewport_height;
- autonotes_window.uFrameX = game_viewport_x;
- autonotes_window.uFrameY = game_viewport_y;
- autonotes_window.uFrameZ = game_viewport_z;
- autonotes_window.uFrameW = game_viewport_w;
- autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes"
-
- //for other text
- autonotes_window.uFrameX = 48;
- autonotes_window.uFrameY = 70;
- autonotes_window.uFrameWidth = 360;
- autonotes_window.uFrameHeight = 264;
- autonotes_window.uFrameZ = 407;
- autonotes_window.uFrameW = 333;
- if ( change_flag )//change bookmark(смена закладки)
- {
- full_num_items_in_book = 0;
- books_primary_item_per_page = 0;
- books_page_number = 0;
- num_achieved_awards = 0;
- for ( uint i = 1; i <= 195; ++i )
- {
- if ( pAutonoteTxt[i].eType == _506568_autonote_type )
- {
- if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText )
- achieved_awards[num_achieved_awards++] = (AwardType)i;
- }
- }
- full_num_items_in_book = num_achieved_awards;
- }
- else//not change bookmark(не меняется закладка)
- {
- if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше)
- {
- if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book )
- {
- books_num_items_per_page[books_page_number++] = num_achieved_awards;
- books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page;
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- }
- }
- if ( BtnUp_flag && books_page_number )// press Up bookmark(нажатие закладки пролистать назад)
- {
- --books_page_number;
- books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- }
- if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0
- {
- books_primary_item_per_page = 0;
- books_page_number = 0;
- }
- }
- BtnUp_flag = 0;
- BtnDown_flag = 0;
- Book_PageBtn3_flag = 0;//Potions_page_flag
- Book_PageBtn4_flag = 0;//Fontains_page_flag
- Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag
- Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag
- Autonotes_Misc_page_flag = 0;
- Autonotes_Instructors_page_flag = 0;
- num_achieved_awards = 0;
- for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i )
- {
- ++num_achieved_awards;
- autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0);
- pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0);
- if ( (signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight )
- break;
- pRenderer->DrawTextureIndexedAlpha(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10);
- autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24;
- }
-}
-
- //----- (00412E85) --------------------------------------------------------
-void BookUI_Journal_Draw()
-{
- char *pDialogueString; // eax@21
- char* pStringOnPage; // eax@22
- GUIWindow journal_window; // [sp+8h] [bp-54h]@10
-
- pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11);
- if ( BtnUp_flag || !books_primary_item_per_page )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
-
- if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
- else
- pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
-
- if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title
- {
- journal_window.uFrameWidth = game_viewport_width;
- journal_window.uFrameX = game_viewport_x;
- journal_window.uFrameY = game_viewport_y;
- journal_window.uFrameHeight = game_viewport_height;
- journal_window.uFrameZ = game_viewport_z;
- journal_window.uFrameW = game_viewport_w;
- if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle )
- journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3);
- }
-
- //for other text
- journal_window.uFrameX = 48;
- journal_window.uFrameY = 70;
- journal_window.uFrameWidth = 360;
- journal_window.uFrameHeight = 264;
- journal_window.uFrameZ = 407;
- journal_window.uFrameW = journal_window.uFrameHeight + 69;
- if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Press bookmark next page
- {
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- books_primary_item_per_page += num_achieved_awards;
- books_num_items_per_page[books_page_number++] = num_achieved_awards;
- }
- if ( BtnUp_flag && books_page_number )//Press bookmark previous page
- {
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- --books_page_number;
- books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number];
- }
- if ( !num_achieved_awards || books_primary_item_per_page < 1 )
- {
- books_primary_item_per_page = 0;
- books_page_number = 0;
- }
- BtnDown_flag = 0;
- BtnUp_flag = 0;
- num_achieved_awards = 0;
- if ( achieved_awards[books_primary_item_per_page] )
- {
- int index = ((int)achieved_awards[books_primary_item_per_page] - 1);
- pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1,
- 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]);
- pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]);
- journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0,
- journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow);
- ++num_achieved_awards;
- }
-}
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/UINotesBooks.h
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/Books/UISpellBook.cpp
--- a/GUI/UI/Books/UISpellBook.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/UI/Books/UISpellBook.cpp Tue May 12 03:24:19 2015 +0200
@@ -39,23 +39,6 @@
}
}
-//----- (00411597) --------------------------------------------------------
-void OnCloseBook()
-{
- free(pSpellFont);
- pSpellFont = nullptr;
- free(pBookFont);
- pBookFont = nullptr;
- free(pBook2Font);
- pBook2Font = nullptr;
- free(pAutonoteFont);
- pAutonoteFont = nullptr;
- pTexture_mapbordr->Release();
- pAudioPlayer->PlaySound(SOUND_closebook, 0, 0, -1, 0, 0, 0, 0);
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- dword_506364 = 0;
-}
-
//----- (00412AF9) --------------------------------------------------------
static void BookUI_Spellbook_DrawCurrentSchoolBackground()
{
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/UIBooks.cpp
--- a/GUI/UI/UIBooks.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/UI/UIBooks.cpp Tue May 12 03:24:19 2015 +0200
@@ -1,37 +1,78 @@
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-#define _CRT_SECURE_NO_WARNINGS
+#include "Engine/Engine.h"
+#include "Engine/Graphics/Render.h"
+#include "Engine/LOD.h"
+#include "Engine/texts.h"
+#include "Engine/Awards.h"
-#include "Engine/Engine.h"
+#include "GUI/GUIFont.h"
+#include "GUI/UI/UIBooks.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+
-#include "UIBooks.h"
-#include "..\../Engine/Graphics/Render.h"
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/LOD.h"
+//----- (00411597) --------------------------------------------------------
+void GUIWindow_Book::Release()
+{
+ free(pSpellFont);
+ pSpellFont = nullptr;
+ free(pBookFont);
+ pBookFont = nullptr;
+ free(pBook2Font);
+ pBook2Font = nullptr;
+ free(pAutonoteFont);
+ pAutonoteFont = nullptr;
+ pTexture_mapbordr->Release();
+ pAudioPlayer->PlaySound(SOUND_closebook, 0, 0, -1, 0, 0, 0, 0);
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ dword_506364 = 0;
+
+ GUIWindow::Release();
+}
+
-//----- (00413CC6) --------------------------------------------------------
-void BookUI_Draw(WindowType book)
+GUIWindow_Book::GUIWindow_Book() :
+ GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
+{
+}
+
+void GUIWindow_Book::BasicBookInitialization()
{
- pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
- switch (book)
- {
- case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
- case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
- case WINDOW_MapsBook: BookUI_Map_Draw(); break;
- case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
- case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
+// ----- (00411BFC) --------------------------------------------------------
+// void GUIWindow::InitializeBookView() --- part
+// {
+ pAudioPlayer->StopChannels(-1, -1);
+ InitializeFonts();
+ CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
+ current_screen_type = SCREEN_BOOKS;
+ full_num_items_in_book = 0;
+ books_primary_item_per_page = 0;
+ books_page_number = 0;
+ num_achieved_awards = 0;
+}
- case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
- case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break;
- }
+//----- (00411AAA) --------------------------------------------------------
+void GUIWindow_Book::InitializeFonts()
+{
+ pAudioPlayer->StopChannels(-1, -1);
+ ++pIcons_LOD->uTexturePacksCount;
+ if (!pIcons_LOD->uNumPrevLoadedFiles)
+ pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
+ pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
+ pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
+ pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
+ pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
+ pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
+ pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
}
//----- (0041192C) --------------------------------------------------------
-void InitializeBookTextures()
+void InitializeSpellBookTextures()
{
pAudioPlayer->StopChannels(-1, -1);
++pIcons_LOD->uTexturePacksCount;
@@ -61,21 +102,6 @@
}
}
-//----- (00411AAA) --------------------------------------------------------
-void InitializeBookFonts()
-{
- pAudioPlayer->StopChannels(-1, -1);
- ++pIcons_LOD->uTexturePacksCount;
- if ( !pIcons_LOD->uNumPrevLoadedFiles )
- pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
- pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
- pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
- pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
- pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
- pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
- pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
-}
-
//----- (0041140B) --------------------------------------------------------
void OnCloseSpellBookPage()
{
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/UIBooks.h
--- a/GUI/UI/UIBooks.h Tue May 12 01:45:31 2015 +0200
+++ b/GUI/UI/UIBooks.h Tue May 12 03:24:19 2015 +0200
@@ -1,12 +1,19 @@
#pragma once
+#include "GUI/GUIWindow.h"
+extern std::array, 9> pSpellbookSpellIndices; // 4E2430 from pSpellbookSpellIndices[9][12]
-extern std::array<__int16, 6> pTownPortalBook_xs;
-extern std::array<__int16, 6> pTownPortalBook_ys;
+struct GUIWindow_Book : public GUIWindow
+{
+ GUIWindow_Book();
+ virtual ~GUIWindow_Book() {}
+
+ virtual void Release();
-extern std::array, 9> pSpellbookSpellIndices; // 4E2430 from pSpellbookSpellIndices[9][12]
-extern std::array pLloydsBeaconsPreviewXs; // 004E249C
-extern std::array pLloydsBeaconsPreviewYs;
-extern std::array pLloydsBeacons_SomeXs;
-extern std::array pLloydsBeacons_SomeYs; // idb
\ No newline at end of file
+ protected:
+ void BasicBookInitialization();
+
+ private:
+ void InitializeFonts();
+};
\ No newline at end of file
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/UIMainMenu.cpp
--- a/GUI/UI/UIMainMenu.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/UI/UIMainMenu.cpp Tue May 12 03:24:19 2015 +0200
@@ -127,29 +127,39 @@
pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0);
uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE);
- pBtn_Quests = pPrimaryWindow->CreateButton(491, 353, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureWidth,
+ pBtn_Quests = pPrimaryWindow->CreateButton(
+ 491, 353, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, pKeyActionMap->GetActionVKey(INPUT_Quest),
- pGlobalTXT_LocalizationStrings[174], pIcons_LOD->GetTexture(uTextureID_ib_td1_A), 0); //Quests
+ pGlobalTXT_LocalizationStrings[174], pIcons_LOD->GetTexture(uTextureID_ib_td1_A), 0
+ ); //Quests
uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE);
- pBtn_Autonotes = pPrimaryWindow->CreateButton(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureWidth,
+ pBtn_Autonotes = pPrimaryWindow->CreateButton(527, 353, pIcons_LOD->GetTexture(
+ uTextureID_ib_td2_A)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, pKeyActionMap->GetActionVKey(INPUT_Autonotes),
- pGlobalTXT_LocalizationStrings[154], pIcons_LOD->GetTexture(uTextureID_ib_td2_A), 0);//Autonotes
+ pGlobalTXT_LocalizationStrings[154], pIcons_LOD->GetTexture(uTextureID_ib_td2_A), 0
+ );//Autonotes
uTextureID_ib_td3_A = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE);
- pBtn_Maps = pPrimaryWindow->CreateButton(546, 353, pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureWidth,
+ pBtn_Maps = pPrimaryWindow->CreateButton(
+ 546, 353, pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, pKeyActionMap->GetActionVKey(INPUT_Mapbook),
- pGlobalTXT_LocalizationStrings[139], pIcons_LOD->GetTexture(uTextureID_ib_td3_A), 0); //Maps
+ pGlobalTXT_LocalizationStrings[139], pIcons_LOD->GetTexture(uTextureID_ib_td3_A), 0
+ ); //Maps
uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE);
- pBtn_Calendar = pPrimaryWindow->CreateButton(570, 353, pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureWidth,
+ pBtn_Calendar = pPrimaryWindow->CreateButton(
+ 570, 353, pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, pKeyActionMap->GetActionVKey(INPUT_TimeCal),
- pGlobalTXT_LocalizationStrings[78], pIcons_LOD->GetTexture(uTextureID_ib_td4_A), 0);//Calendar
+ pGlobalTXT_LocalizationStrings[78], pIcons_LOD->GetTexture(uTextureID_ib_td4_A), 0
+ );//Calendar
uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE);
- pBtn_History = pPrimaryWindow->CreateButton(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth,
+ pBtn_History = pPrimaryWindow->CreateButton(
+ 600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureHeight, 1, 0, UIMSG_OpenHistoryBook, 0, 72,//ascii
- pGlobalTXT_LocalizationStrings[602], pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0);//History
+ pGlobalTXT_LocalizationStrings[602], pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0
+ );//History
bFlashAutonotesBook = 0;
bFlashQuestBook = 0;
diff -r fed97f15d1e1 -r 87e5590d034b GUI/UI/UIPopup.cpp
--- a/GUI/UI/UIPopup.cpp Tue May 12 01:45:31 2015 +0200
+++ b/GUI/UI/UIPopup.cpp Tue May 12 03:24:19 2015 +0200
@@ -1,34 +1,33 @@
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-#define _CRT_SECURE_NO_WARNINGS
+#include "Engine/Engine.h"
+#include "Engine/Graphics/Sprites.h"
+#include "Engine/Graphics/Vis.h"
+#include "Engine/Party.h"
+#include "Engine/LOD.h"
+#include "Engine/Objects/Actor.h"
+#include "Engine/Graphics/Viewport.h"
+#include "Engine/Objects/SpriteObject.h"
+#include "Engine/Objects/ObjectList.h"
+#include "Engine/Objects/Chest.h"
+#include "Engine/Graphics/PaletteManager.h"
+#include "Engine/Timer.h"
+#include "Engine/texts.h"
+#include "Engine/Events.h"
-#include "Engine/Engine.h"
+#include "IO/Mouse.h"
+
+#include "GUI/UI/Books/MapBook.h"
+#include "GUI/GUIFont.h"
+
+#include "Media/Audio/AudioPlayer.h"
#include "UIPopup.h"
-#include "Books\UIMapBook.h"
#include "UIShops.h"
-#include "..\../IO/Mouse.h"
-
-#include "..\../Engine/Graphics/Sprites.h"
-#include "..\../Engine/Graphics/Vis.h"
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../Engine/Party.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/LOD.h"
-#include "..\../Engine/Objects/Actor.h"
-#include "..\../Engine/Graphics/Viewport.h"
-#include "..\../Engine/Objects/SpriteObject.h"
-#include "..\../Engine/Objects/ObjectList.h"
-#include "..\../Engine/Objects/Chest.h"
-#include "..\../Engine/Graphics/PaletteManager.h"
-#include "..\../Engine/Timer.h"
-#include "..\../Engine/texts.h"
-#include "..\../Engine/Events.h"
-
static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually
diff -r fed97f15d1e1 -r 87e5590d034b Game/Game.cpp
--- a/Game/Game.cpp Tue May 12 01:45:31 2015 +0200
+++ b/Game/Game.cpp Tue May 12 03:24:19 2015 +0200
@@ -41,6 +41,14 @@
#include "GUI/UI/UIQuickReference.h"
#include "GUI/UI/UISaveLoad.h"
#include "GUI/UI/UIModal.h"
+#include "GUI/UI/UIBooks.h"
+#include "GUI/UI/Books/LloydsBook.h"
+#include "GUI/UI/Books/TownPortalBook.h"
+#include "GUI/UI/Books/QuestBook.h"
+#include "GUI/UI/Books/AutonotesBook.h"
+#include "GUI/UI/Books/MapBook.h"
+#include "GUI/UI/Books/CalendarBook.h"
+#include "GUI/UI/Books/JournalBook.h"
#include "Game/Game.h"
@@ -690,51 +698,31 @@
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
pGUIWindow_CurrentMenu->Release();
- pEventTimer->Pause();
- pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0);
- pBooksWindow = new GUIWindow_BooksWindow(493u, 355u, 0, 0, (int)pBtn_Quests, 0);
- bFlashQuestBook = 0;
+ pGUIWindow_CurrentMenu = new GUIWindow_QuestBook();
continue;
case UIMSG_OpenAutonotes:
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
pGUIWindow_CurrentMenu->Release();
- pEventTimer->Pause();
- pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0);
- pBooksWindow = new GUIWindow_BooksWindow(527u, 353u, 0, 0, (int)pBtn_Autonotes, 0);
- bFlashAutonotesBook = 0;
+ pGUIWindow_CurrentMenu = new GUIWindow_AutonotesBook();
continue;
case UIMSG_OpenMapBook:
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
pGUIWindow_CurrentMenu->Release();
- pEventTimer->Pause();
- viewparams->sViewCenterX = pParty->vPosition.x;
- viewparams->sViewCenterY = pParty->vPosition.y;
- pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0);
- pBooksWindow = new GUIWindow_BooksWindow(546, 353, 0, 0, (int)pBtn_Maps, 0);
+ pGUIWindow_CurrentMenu = new GUIWindow_MapBook();
continue;
case UIMSG_OpenCalendar:
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
pGUIWindow_CurrentMenu->Release();
- pEventTimer->Pause();
- pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0);
- pBooksWindow = new GUIWindow_BooksWindow(570, 354, 0, 0, (int)pBtn_Calendar, 0);
+ pGUIWindow_CurrentMenu = new GUIWindow_CalendarBook();
continue;
case UIMSG_OpenHistoryBook:
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
pGUIWindow_CurrentMenu->Release();
- pEventTimer->Pause();
- pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), uMessage, 0);
- pBooksWindow = new GUIWindow_BooksWindow(0x258u, 0x169u, 0, 0, (int)pBtn_History, 0);
- bFlashHistoryBook = 0;
+ pGUIWindow_CurrentMenu = new GUIWindow_JournalBook();
continue;
case UIMSG_Escape:// нажатие Escape and return to game
back_to_game();
@@ -853,9 +841,9 @@
pIcons_LOD->RemoveTexturesFromTextureList();
continue;
case SCREEN_BOOKS:
- pBooksWindow->Release();
+ pBooksButtonOverlay->Release();
//crt_deconstruct_ptr_6A0118();
- pBooksWindow = 0;
+ pBooksButtonOverlay = 0;
pEventTimer->Resume();
if (pGUIWindow_Settings)
{
@@ -1651,25 +1639,17 @@
dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57;
}
HouseDialogPressCloseBtn();
- //goto LABEL_434;
- /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
- {
- pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
- pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
- *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
- ++pMessageQueue_50CBD0->uNumMessages;
- }*/
pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
continue;
case UIMSG_OnCastTownPortal:
pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_TownPortal, (char *)uMessageParam);
+ pGUIWindow_CurrentMenu = new GUIWindow_TownPortalBook((char *)uMessageParam);
continue;
case UIMSG_OnCastLloydsBeacon:
pAudioPlayer->StopChannels(-1, -1);
- pGUIWindow_CurrentMenu = new GUIWindow_Book(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_LloydsBeacon, 0);
+ pGUIWindow_CurrentMenu = new GUIWindow_LloydsBook();
continue;
case UIMSG_LloydsBeacon_FlippingBtn:
@@ -1708,12 +1688,6 @@
case UIMSG_CloseAfterInstallBeacon:
dword_50CDC8 = 1;
pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
- /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
- continue;
- pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
- pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
- *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
- ++pMessageQueue_50CBD0->uNumMessages;*/
continue;
case UIMSG_InstallBeacon:
pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1];
@@ -1759,9 +1733,9 @@
pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
}
pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
- pBooksWindow->Release();
+ pBooksButtonOverlay->Release();
pGUIWindow_CurrentMenu->Release();
- pBooksWindow = 0;
+ pBooksButtonOverlay = 0;
pGUIWindow_CurrentMenu = 0;
}
else
diff -r fed97f15d1e1 -r 87e5590d034b IO/Keyboard.cpp
--- a/IO/Keyboard.cpp Tue May 12 01:45:31 2015 +0200
+++ b/IO/Keyboard.cpp Tue May 12 03:24:19 2015 +0200
@@ -1,23 +1,22 @@
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-#define _CRT_SECURE_NO_WARNINGS
-
#include "Engine/Engine.h"
-
-#include "Keyboard.h"
-#include "GUI/GUIWindow.h"
-
-#include "Engine/Graphics/Vis.h"
-#include "Engine/Objects/Actor.h"
#include "Engine/Party.h"
#include "Engine/Timer.h"
+#include "Engine/Registry.h"
#include "Engine/TurnEngine/TurnEngine.h"
+#include "Engine/Graphics/Vis.h"
#include "Engine/Graphics/Weather.h"
+#include "Engine/Graphics/Indoor.h"
#include "Engine/Spells/CastSpellInfo.h"
-#include "Engine/Graphics/Indoor.h"
-#include "Engine/Registry.h"
+#include "Engine/Objects/Actor.h"
+
+#include "IO/Keyboard.h"
+
+#include "GUI/GUIWindow.h"
#include
#include
diff -r fed97f15d1e1 -r 87e5590d034b IO/Mouse.cpp
--- a/IO/Mouse.cpp Tue May 12 01:45:31 2015 +0200
+++ b/IO/Mouse.cpp Tue May 12 03:24:19 2015 +0200
@@ -1,24 +1,24 @@
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-#define _CRT_SECURE_NO_WARNINGS
-
#include "Engine/Engine.h"
-
-#include "Mouse.h"
#include "Engine/Party.h"
#include "Engine/LOD.h"
-
#include "Engine/TurnEngine/TurnEngine.h"
#include "Engine/Graphics/Viewport.h"
-#include "GUI/GUIWindow.h"
#include "Engine/Graphics/Vis.h"
#include "Engine/Objects/Actor.h"
+
+#include "IO/Mouse.h"
+
+#include "GUI/GUIWindow.h"
+
#include "Media/Audio/AudioPlayer.h"
-Mouse *pMouse;
+Mouse *pMouse = nullptr;