# HG changeset patch # User Ritor1 # Date 1375958059 -21600 # Node ID dfc9484ed94cafcca89ce544d91da9dfb9f154e5 # Parent 9add223260ce16c6a117b150e712f27fdb56d5a2 GetDayPart and Journal_Draw diff -r 9add223260ce -r dfc9484ed94c GUIFont.cpp --- a/GUIFont.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/GUIFont.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -385,11 +385,10 @@ //----- (0044C6C2) -------------------------------------------------------- -char* GUIFont::_44C6C2( const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5 ) - { +char* GUIFont::GetPageTop( const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5 ) +{ int text_height; // edi@1 char *text_str; // ebx@3 - int i; unsigned char c; // cl@4 int text_length; @@ -399,35 +398,33 @@ return 0; text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0); text_length = strlen(text_str); - for (i=0; i= (signed int)(a5 * pWindow->uFrameHeight) ) - return &text_str[i+1]; - break; - case '\f': //Form Feed, page eject 0C 12 - i += 5; - break; - case '\t': // Horizontal tab 09 - case '\r': //Carriage Return 0D 13 - i += 3; - break; - } - if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) - break; - } + case '\n': //Line Feed 0A 10: + text_height = text_height + (uFontHeight - 3); + if ( text_height >= (signed int)(a5 * (pWindow->uFrameHeight - (uFontHeight - 3))) ) + return &text_str[i]; + break; + case '\f': //Form Feed, page eject 0C 12 + i += 5; + break; + case '\t': // Horizontal tab 09 + case '\r': //Carriage Return 0D 13 + i += 3; + break; } - return &text_str[i]; + if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) + break; + } + } + return &text_str[0]; } - - //----- (0044C62E) -------------------------------------------------------- int GUIFont::GetStringHeight2( GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, int a6 ) { @@ -469,41 +466,40 @@ //----- (0044C59D) -------------------------------------------------------- int GUIFont::CalcTextHeight( const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5 ) - { - int uAllHeght; - int uStringLen; - unsigned char c; - char *test_string; +{ + int uAllHeght; + int uStringLen; + unsigned char c; + char *test_string; - if (!pString) - return 0; - uAllHeght = uFontHeight - 3; - test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0); - uStringLen = strlen(pString); - for (int i = 0; i < uStringLen; ++i) - { - c = test_string[i]; - if (IsCharValid(c)) - { - switch (c) - { - case '\n': //Line Feed 0A 10: - uAllHeght+= uFontHeight - 3; - break; - case '\f': //Form Feed, page eject 0C 12 - i += 5; - break; - case '\t': // Horizontal tab 09 - case '\r': //Carriage Return 0D 13 - if (a5 != 1) - i += 3; - break; - } - } - } - return uAllHeght; - } - + if (!pString) + return 0; + uAllHeght = uFontHeight - 6; + test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0); + uStringLen = strlen(pString); + for (int i = 0; i < uStringLen; ++i) + { + c = test_string[i]; + if (IsCharValid(c)) + { + switch (c) + { + case '\n': //Line Feed 0A 10: + uAllHeght += uFontHeight - 3; + break; + case '\f': //Form Feed, page eject 0C 12 + i += 5; + break; + case '\t': // Horizontal tab 09 + case '\r': //Carriage Return 0D 13 + if (a5 != 1) + i += 3; + break; + } + } + } + return uAllHeght; +} //----- (0044C51E) -------------------------------------------------------- int GUIFont::GetLineWidth(const char *pString) @@ -553,106 +549,103 @@ return position; else return 0; - } //----- (0044C768) -------------------------------------------------------- char * FitTextInAWindow( const char *pInString, GUIFont *pFont, GUIWindow *pWindow, signed int uX, int a5 ) - { - unsigned char c; - int uInStrLen; - char digits[4]; - int possible_transition_point; - int string_pixel_Width; - int start_pixel_offset; +{ + unsigned char c; + int uInStrLen; + char digits[4]; + int possible_transition_point; + int string_pixel_Width; + int start_pixel_offset; - if (!pInString) - { - MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); - return 0; - } - uInStrLen = strlen(pInString); - strcpy(&temp_string[0], pInString); - if (uInStrLen==0) - return &temp_string[0]; + if (!pInString) + { + MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); + return 0; + } + uInStrLen = strlen(pInString); + strcpy(&temp_string[0], pInString); + if (uInStrLen == 0) + return &temp_string[0]; - start_pixel_offset=string_pixel_Width=uX; - possible_transition_point=0; - for(int i=0; iIsCharValid(c)) - { - switch (c) - { - case '\t': // Horizontal tab 09 - { - strncpy(digits, &temp_string[i+1],3); - digits[3]=0; - string_pixel_Width= atoi(digits)+uX; - i+=3; - break; - } - case '\n': //Line Feed 0A 10 - { - string_pixel_Width=start_pixel_offset; - possible_transition_point=i; - break; - } - case '\f': //Form Feed, page eject 0C 12 - { - i+=5; - break; - } - case '\r': //Carriage Return 0D 13 - { - if (!a5) - return (char*)pInString; - break; - } - case ' ' : - { - string_pixel_Width+=pFont->pMetrics[c].uWidth; - possible_transition_point=i; - break; - } - default: - - if ((string_pixel_Width+pFont->pMetrics[c].uWidth+ pFont->pMetrics[c].uLeftSpacing+ - pFont->pMetrics[c].uRightSpacing)uFrameWidth) - { - if(i>possible_transition_point) - string_pixel_Width+=pFont->pMetrics[c].uLeftSpacing; - string_pixel_Width+=pFont->pMetrics[c].uWidth; - if (ipMetrics[c].uRightSpacing; - } - else - { - temp_string[possible_transition_point]='\n'; - string_pixel_Width=start_pixel_offset; - if (i>possible_transition_point) - { - for(int j=possible_transition_point;jIsCharValid(c)) - { - if(j>possible_transition_point) - string_pixel_Width+=pFont->pMetrics[c].uLeftSpacing; - string_pixel_Width+=pFont->pMetrics[c].uWidth; - if (jpMetrics[c].uRightSpacing; - - } - } - } - } - } - } - } - return &temp_string[0]; - } + start_pixel_offset = string_pixel_Width=uX; + possible_transition_point = 0; + for ( int i = 0; i < uInStrLen; ++i ) + { + c = temp_string[i]; + if (pFont->IsCharValid(c)) + { + switch (c) + { + case '\t': // Horizontal tab 09 + { + strncpy(digits, &temp_string[i + 1],3); + digits[3] = 0; + string_pixel_Width = atoi(digits)+uX; + i += 3; + break; + } + case '\n': //Line Feed 0A 10 (конец строки) + { + string_pixel_Width = start_pixel_offset; + possible_transition_point = i; + break; + } + case '\f': //Form Feed, page eject 0C 12 + { + i += 5; + break; + } + case '\r': //Carriage Return 0D 13 + { + if ( !a5 ) + return (char*)pInString; + break; + } + case ' '://пробел + { + string_pixel_Width += pFont->pMetrics[c].uWidth; + possible_transition_point = i; + break; + } + default: + if ((string_pixel_Width + pFont->pMetrics[c].uWidth + pFont->pMetrics[c].uLeftSpacing + + pFont->pMetrics[c].uRightSpacing) < pWindow->uFrameWidth )//наращивание длины строки или перенос + { + if ( i > possible_transition_point ) + string_pixel_Width += pFont->pMetrics[c].uLeftSpacing; + string_pixel_Width += pFont->pMetrics[c].uWidth; + if (i < uInStrLen) + string_pixel_Width += pFont->pMetrics[c].uRightSpacing; + } + else//перенос строки и слова + { + temp_string[possible_transition_point] ='\n'; + string_pixel_Width = start_pixel_offset; + if ( i > possible_transition_point ) + { + for ( int j = possible_transition_point; j < i; ++j ) + { + c = temp_string[j]; + if (pFont->IsCharValid(c)) + { + if ( j > possible_transition_point ) + string_pixel_Width += pFont->pMetrics[c].uLeftSpacing; + string_pixel_Width += pFont->pMetrics[c].uWidth; + if ( j < i ) + string_pixel_Width += pFont->pMetrics[c].uRightSpacing; + } + } + } + } + } + } + } + return &temp_string[0]; +} //----- (00414162) -------------------------------------------------------- void uGameUIFontMain_initialize() { diff -r 9add223260ce -r dfc9484ed94c GUIFont.h --- a/GUIFont.h Tue Aug 06 09:26:17 2013 +0600 +++ b/GUIFont.h Thu Aug 08 16:34:19 2013 +0600 @@ -24,7 +24,7 @@ int GetLineWidth(const char *pString); int CalcTextHeight(const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5); int GetStringHeight2(GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, int a6); - char* _44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5); + char* GetPageTop(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5); void DrawTextLineToBuff(int uColor, int a3, unsigned short* uX_buff_pos, const char *text, int line_width); void DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *text, int max_len_pix); void _44D2FD_prolly_draw_credits_entry(GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, diff -r 9add223260ce -r dfc9484ed94c GUIWindow.cpp --- a/GUIWindow.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/GUIWindow.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -403,77 +403,56 @@ //----- (00411BFC) -------------------------------------------------------- void GUIWindow::InitializeBookView() { - GUIWindow *v1; // ebp@1 - signed int v2; // ecx@8 - __int64 *v3; // ebp@9 - char *v4; // ecx@10 - char *v5; // eax@12 - int v6; // eax@12 - __int64 v7; // qax@12 - unsigned int v8; // esi@12 - GUIButton *v9; // eax@19 - signed int v10; // esi@19 - int v11; // eax@24 - int v12; // eax@27 - int i; // esi@28 - char *v14; // ebp@29 - int v15; // eax@31 - //unsigned int v16; // esi@35 - Player *v17; // esi@38 + char *pString; // eax@12 + int pTextHeight; // eax@12 + //__int64 page_count; // qax@12 + unsigned int page_count; // esi@12 unsigned __int16 v18; // ax@38 - unsigned int v19; // edi@43 - unsigned int v20; // edi@45 - void *v21; // esi@45 signed int max_beacons; // [sp+10h] [bp-5Ch]@38 - char *v25; // [sp+14h] [bp-58h]@21 - GUIWindow v26; // [sp+18h] [bp-54h]@8 + GUIWindow journal_window; // [sp+18h] [bp-54h]@8 - v1 = this; pAudioPlayer->StopChannels(-1, -1); InitializeBookFonts(); - v1->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close + this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close pCurrentScreen = SCREEN_BOOKS; full_num_items_in_book = 0; books_primary_item_per_page = 0; books_page_number = 0; num_achieved_awards = 0; - switch (v1->par1C) - { - case WINDOW_LloydsBeacon:{ + 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_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", 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 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon - pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon - - v17 = &pParty->pPlayers[_506348_current_lloyd_playerid]; + 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 = v17->pActiveSkills[PLAYER_SKILL_WATER]; + 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; - - //__debugbreak(); // warning C4700: uninitialized local variable 'v19' used - for (int i =0; i< max_beacons; ++i) + 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 (v17->pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed) - LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1); - else - memset(&v17->pInstalledBeacons[i], 0, sizeof(LloydBeacon)); - } - } - break; + 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: { @@ -487,8 +466,8 @@ 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) - v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); + 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; @@ -497,202 +476,184 @@ { pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, - pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, + 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_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, - pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, + 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_tab_an_7b__zoot_on, 0); + pTex_book_button2_on, 0); num_achieved_awards = 0; memset(achieved_awards.data(), 0, 4000); - for ( i = books_primary_item_per_page; i < 512; ++i ) - { - // v14 = (char *)pQuestTable[i];//(&dword_722F10)[4 * i]; - if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] ) - { - achieved_awards[num_achieved_awards] = (AwardType)i; - ++num_achieved_awards; - } - } - v12 = num_achieved_awards; + 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; - full_num_items_in_book = v12; - } - break; + } + break; - - case WINDOW_AutonotesBook: - { + case WINDOW_AutonotesBook: + { pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pTexture_506394 = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); - pTexture_506390 = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); - pTexture_50638C = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); - pTexture_506388 = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); - pTexture_506384 = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); - pTexture_506380 = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); - pTexture_50637C = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); - pTexture_506378 = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); - pTexture_506374 = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); - pTexture_506370 = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); - pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); - pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", 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 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" - pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" - pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" + 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 ( 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 ) - { + 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; - achieved_awards[num_achieved_awards] = (AwardType)i; - ++num_achieved_awards; - } - } - } - - } - break; - - case WINDOW_MapsBook: - { + case WINDOW_MapsBook: + { dword_506364 = 1; pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); - pTexture_506394 = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); - pTexture_506390 = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); - pTexture_50638C = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); - pTexture_506388 = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); - pTexture_506384 = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); - pTexture_506380 = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); - pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); - pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", 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 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, + 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 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, + 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 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, + 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 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, + 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; + } + break; - case WINDOW_CalendarBook: - { + 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; + } + break; - case WINDOW_JournalBook: - { + case WINDOW_JournalBook: + { pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", 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 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, - pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, - UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, - pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, - pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); + 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; - v26.uFrameX = 48; - v26.uFrameY = 70; - v26.uFrameWidth = 360; - v26.uFrameHeight = 264; - v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; - v26.uFrameZ = 407; - v26.uFrameHeight = v2 * 264 / v2; - v26.uFrameW = v26.uFrameHeight + 69; + 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(byte_5C6D50.data(), 0, 0x64u); + 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 + 31; i++ ) + { + if ( pParty->field_3C.field_4F0[2 * i] > 0 ) { - v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * books_primary_item_per_page]; - for(int i = books_primary_item_per_page+1; i < books_primary_item_per_page + 31; i++) - { - v4 = pStorylineText->StoreLine[i].pText; - if ( *v3 ) - { - if ( v4 ) - { - v5 = BuildDialogueString(v4, uActiveCharacter - 1, 0, 0, 0, v3); - v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); - v7 = (v6 - 3) / (signed int)v26.uFrameHeight; - v8 = v7 + 1; - if ( (signed int)v7 + 1 > 0 ) - { - memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8); - do - { - LODWORD(v7) = num_achieved_awards++; - byte_5C6D50[(int)v7] = BYTE4(v7); - ++HIDWORD(v7); - } - while ( SHIDWORD(v7) < (signed int)v8 ); - } - } - } - ++i; - ++v3; - } + if ( pStorylineText->StoreLine[i + 1].pText ) + { + pString = BuildDialogueString(pStorylineText->StoreLine[i + 1].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C.field_4F0[2 * 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; + } } - - } - break; + } } - + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + } + break; + } } - - - //----- (00415551) -------------------------------------------------------- void GUIWindow::DrawMessageBox(int arg0) { diff -r 9add223260ce -r dfc9484ed94c Player.cpp --- a/Player.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/Player.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -7092,12 +7092,12 @@ { v20 = pPlayers[currPlayerId + 1]; v20->PlaySound(SPEECH_96, 0); - v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; + //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; - _506568_autonote_type = v21; + _506568_autonote_type = pAutonoteTxt[var_value].eType; DrawPlayerBuffAnimBasedOnCondition(currPlayerId); } - _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); + _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1); PlaySoundBasedOnCondition(currPlayerId); return; } @@ -7890,11 +7890,11 @@ v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; v23->PlaySound(SPEECH_96, 0); - v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; + //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; - _506568_autonote_type = v24; - } - _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); + _506568_autonote_type = pAutonoteTxt[val].eType; + } + _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); v3 = 1; LABEL_173: if ( v34 != 1 ) diff -r 9add223260ce -r dfc9484ed94c Texture.cpp --- a/Texture.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/Texture.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -30,22 +30,22 @@ std::array pTexture_LloydBeacons; Texture *pTexture_50635C; -Texture *pTexture_506368; -Texture *pTexture_50636C; -Texture *pTexture_506370; -Texture *pTexture_506374; -Texture *pTexture_506378; -Texture *pTexture_50637C; -Texture *pTexture_506380; -Texture *pTexture_506384; -Texture *pTexture_506388; -Texture *pTexture_50638C; -Texture *pTexture_506390; -Texture *pTexture_506394; -Texture *pTex_tab_an_7a__zoot_off; -Texture *pTex_tab_an_6a__zoom_off; -Texture *pTex_tab_an_7b__zoot_on; -Texture *pTex_tab_an_6b__zoom_on; +Texture *pTex_book_button8_off; +Texture *pTex_book_button8_on; +Texture *pTex_book_button7_off; +Texture *pTex_book_button7_on; +Texture *pTex_book_button6_off; +Texture *pTex_book_button6_on; +Texture *pTex_book_button5_off; +Texture *pTex_book_button5_on; +Texture *pTex_book_button4_off; +Texture *pTex_book_button4_on; +Texture *pTex_book_button3_off; +Texture *pTex_book_button3_on; +Texture *pTex_book_button2_off; +Texture *pTex_book_button1_off; +Texture *pTex_book_button2_on; +Texture *pTex_book_button1_on; std::array pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit std::array SBPageCSpellsTextureList; std::array SBPageSSpellsTextureList; diff -r 9add223260ce -r dfc9484ed94c Texture.h --- a/Texture.h Tue Aug 06 09:26:17 2013 +0600 +++ b/Texture.h Thu Aug 08 16:34:19 2013 +0600 @@ -128,22 +128,22 @@ extern std::array pSavegameThumbnails; extern std::array pTexture_LloydBeacons; extern struct Texture *pTexture_50635C; -extern struct Texture *pTexture_506368; -extern struct Texture *pTexture_50636C; -extern struct Texture *pTexture_506370; -extern struct Texture *pTexture_506374; -extern struct Texture *pTexture_506378; -extern struct Texture *pTexture_50637C; -extern struct Texture *pTexture_506380; -extern struct Texture *pTexture_506384; -extern struct Texture *pTexture_506388; -extern struct Texture *pTexture_50638C; -extern struct Texture *pTexture_506390; -extern struct Texture *pTexture_506394; -extern struct Texture *pTex_tab_an_7a__zoot_off; -extern struct Texture *pTex_tab_an_6a__zoom_off; -extern struct Texture *pTex_tab_an_7b__zoot_on; -extern struct Texture *pTex_tab_an_6b__zoom_on; +extern struct Texture *pTex_book_button8_off; +extern struct Texture *pTex_book_button8_on; +extern struct Texture *pTex_book_button7_off; +extern struct Texture *pTex_book_button7_on; +extern struct Texture *pTex_book_button6_off; +extern struct Texture *pTex_book_button6_on; +extern struct Texture *pTex_book_button5_off; +extern struct Texture *pTex_book_button5_on; +extern struct Texture *pTex_book_button4_off; +extern struct Texture *pTex_book_button4_on; +extern struct Texture *pTex_book_button3_off; +extern struct Texture *pTex_book_button3_on; +extern struct Texture *pTex_book_button2_off; +extern struct Texture *pTex_book_button1_off; +extern struct Texture *pTex_book_button2_on; +extern struct Texture *pTex_book_button1_on; extern std::array pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit extern std::array SBPageCSpellsTextureList; diff -r 9add223260ce -r dfc9484ed94c UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -108,13 +108,13 @@ pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3); if ( bRecallingBeacon ) { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); - v19 = pTex_tab_an_6a__zoom_off; + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on); + v19 = pTex_book_button1_off; } else { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); - v19 = pTex_tab_an_6b__zoom_on; + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off); + v19 = pTex_book_button1_on; } pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); uNumMaxBeacons = 1; @@ -192,90 +192,40 @@ void BookUI_Map_Draw() { unsigned int map_id; // eax@35 - Texture *buttnTxtr; // [sp-4h] [bp-DCh]@3 char party_coord[120]; // [sp+Ch] [bp-CCh]@37 GUIWindow map_window; // [sp+84h] [bp-54h]@35 - unsigned int textrX, textrY; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 ) - { - buttnTxtr = pTex_tab_an_6a__zoom_off; - textrY = pViewport->uViewportTL_Y + 2; - textrX = pViewport->uViewportTL_X + 408; - } + if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - { - buttnTxtr = pTex_tab_an_6b__zoom_on; - textrY = pViewport->uViewportTL_Y + 1; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 ) - { - buttnTxtr = pTex_tab_an_7a__zoot_off; - textrY = pViewport->uViewportTL_Y + 38; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - { - buttnTxtr = pTex_tab_an_7b__zoot_on; - textrY = pViewport->uViewportTL_Y + 38; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn3_flag ) - { - buttnTxtr = pTexture_506390; - textrY = pViewport->uViewportTL_Y + 113; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + if ( Book_PageBtn3_flag )//Button 3 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); else - { - buttnTxtr = pTexture_506394; - textrY = pViewport->uViewportTL_Y + 113; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn4_flag ) - { - buttnTxtr = pTexture_506388; - textrY = pViewport->uViewportTL_X + 150; - textrX = pViewport->uViewportTL_Y + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + + if ( Book_PageBtn4_flag )//Button 4 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); else - { - buttnTxtr = pTexture_50638C; - textrY = pViewport->uViewportTL_X + 150; - textrX = pViewport->uViewportTL_Y + 399; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn5_flag ) - { - buttnTxtr = pTexture_506380; - textrY = pViewport->uViewportTL_Y + 188; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + + if ( Book_PageBtn5_flag )//Button 5 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); else - { - buttnTxtr = pTexture_506384; - textrY = pViewport->uViewportTL_Y + 188; - textrX = pViewport->uViewportTL_X + 397; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn6_flag ) - { - buttnTxtr = pTexture_506378; - textrY = pViewport->uViewportTL_Y + 226; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + + if ( Book_PageBtn6_flag )//Button 6 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); else - { - buttnTxtr = pTexture_50637C; - textrY = pViewport->uViewportTL_Y + 226; - textrX = pViewport->uViewportTL_X + 397; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + if ( BtnDown_flag ) viewparams->CenterOnParty2(); if ( BtnUp_flag ) diff -r 9add223260ce -r dfc9484ed94c UI/Books/UINotesBooks.cpp --- a/UI/Books/UINotesBooks.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/UI/Books/UINotesBooks.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -4,7 +4,6 @@ #endif #include - #include "..\..\MM7.h" #include "..\..\Render.h" #include "..\..\Mouse.h" @@ -14,33 +13,27 @@ #include "..\..\GUIFont.h" #include "..\..\Party.h" #include "..\..\AudioPlayer.h" -//#include "..\Outdoor.h" #include "..\..\LOD.h" #include "..\..\Allocator.h" #include "..\..\Viewport.h" -//#include "..\Math.h" #include "..\..\Awards.h" #include "..\..\Autonotes.h" #include "..\..\StorylineTextTable.h" #include "..\..\texts.h" -// #include "..\..\mm7_data.h" - - - //----- (00413D3C) -------------------------------------------------------- static const char *GetDayPart() - { - if (pParty->uCurrentHour <= 4) - return pGlobalTXT_LocalizationStrings[567]; // "Night" - else if (pParty->uCurrentHour == 5) - return pGlobalTXT_LocalizationStrings[55]; // "Dawn" - else if (pParty->uCurrentHour == 20) - return pGlobalTXT_LocalizationStrings[566]; // "Dusk" - else - return pGlobalTXT_LocalizationStrings[56]; // "Day" - } +{ + 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() @@ -118,15 +111,16 @@ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_tab_an_6a__zoom_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_tab_an_7a__zoot_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on); + pRenderer->DrawTextureTransparent(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; @@ -135,19 +129,20 @@ 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 + 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 + if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --books_page_number; @@ -164,8 +159,7 @@ for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) { ++num_achieved_awards; - //v5 = pQuestTable[achieved_awards[v3]];//(&dword_722F10)[4 * v4]; - questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); + 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; @@ -177,166 +171,143 @@ //----- (0041338E) -------------------------------------------------------- void BookUI_Autonotes_Draw() { - unsigned int v3; // eax@18 - unsigned int v4; // eax@24 - unsigned int v5; // eax@30 - unsigned int v6; // eax@36 - unsigned int v7; // eax@42 - signed int v8; // ebp@47 - int v9; // eax@52 - int v10; // eax@56 - int v11; // edx@57 - int v12; // ebp@64 - int v13; // eax@65 - const char *v14; // edi@65 - int v15; // eax@65 - unsigned int v16; // edi@65 - unsigned int v19; // [sp-8h] [bp-70h]@18 - unsigned int v20; // [sp-8h] [bp-70h]@24 - unsigned int v21; // [sp-8h] [bp-70h]@30 - unsigned int v22; // [sp-8h] [bp-70h]@36 - unsigned int v23; // [sp-8h] [bp-70h]@42 - Texture *v26; // [sp-4h] [bp-6Ch]@18 - Texture *v27; // [sp-4h] [bp-6Ch]@24 - Texture *v28; // [sp-4h] [bp-6Ch]@30 - Texture *v29; // [sp-4h] [bp-6Ch]@36 - Texture *v30; // [sp-4h] [bp-6Ch]@42 - signed __int16 v31; // [sp+10h] [bp-58h]@1 - char *v32; // [sp+10h] [bp-58h]@49 + int pTextHeight; // eax@65 + bool change_flag; // [sp+10h] [bp-58h]@1 GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 - v31 = 0; + change_flag = false; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); if ( BtnUp_flag || !books_primary_item_per_page ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_tab_an_6a__zoom_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_tab_an_7a__zoot_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); else//press(нажатие) { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_POTION_RECEPIE; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); } } else { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); else//Potions_page not active(вкладка снадобья не активна) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTexture_506390); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_STAT_HINT; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); } } else { if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTexture_506388); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_OBELISK; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); } } else { if ( _506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTexture_506380); + pRenderer->DrawTextureTransparent(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->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_SEER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); } } else { if ( _506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTexture_506378); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); } if ( Autonotes_Misc_page_flag ) { if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_MISC; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); } } else { if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTexture_506370); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); } if ( Autonotes_Instructors_page_flag ) { if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_TEACHER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); } } else { if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTexture_506368); + pRenderer->DrawTextureTransparent(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; @@ -345,171 +316,117 @@ 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 ( v31 ) + 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; - v8 = 0; - do + for ( uint i = 1; i <= 195; ++i ) { - //if ( dword_72371C[2 * v8] == dword_506568 ) - if ( pAutonoteTxt[v8].eType == _506568_autonote_type ) + if ( pAutonoteTxt[i].eType == _506568_autonote_type ) { - //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; - v32 = (char *)pAutonoteTxt[v8].pText; - if ( (short)v8 ) - { - if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) - { - v9 = num_achieved_awards++; - achieved_awards[v9] = (AwardType)v8; - } - } + if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) + achieved_awards[num_achieved_awards++] = (AwardType)i; } - ++v8; } - while ( v8 < 196 ); full_num_items_in_book = num_achieved_awards; } - else + else//not change bookmark(не меняется закладка) { - if ( BtnDown_flag ) + if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше) { - v10 = num_achieved_awards + books_primary_item_per_page; if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) { - v11 = books_page_number++; - books_num_items_per_page[v11] = num_achieved_awards; - books_primary_item_per_page = v10; + 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 ) + 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 < 1 ) + if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0 { books_primary_item_per_page = 0; books_page_number = 0; } } - v12 = books_primary_item_per_page; - Autonotes_Instructors_page_flag = 0; + BtnUp_flag = 0; BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 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; - Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag - Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag - Book_PageBtn4_flag = 0;//Fontains_page_flag - Book_PageBtn3_flag = 0;//Potions_page_flag - while ( v12 < full_num_items_in_book ) + Autonotes_Instructors_page_flag = 0; + num_achieved_awards = 0; + for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) { - v13 = achieved_awards[v12]; ++num_achieved_awards; - //v14 = (&dword_723718_autonote_related)[8 * v13]; - v14 = pAutonoteTxt[v13].pText; - //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); - autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13].pText, 0, 0, 0); - v15 = pAutonoteFont->CalcTextHeight(v14, &autonotes_window, 1, 0); - v16 = autonotes_window.uFrameY + v15; - if ( (signed int)(autonotes_window.uFrameY + v15) > (signed int)autonotes_window.uFrameHeight ) + 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->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10); - ++v12; - autonotes_window.uFrameY = v16 + 24; + pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); + autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; } } //----- (00412E85) -------------------------------------------------------- void BookUI_Journal_Draw() { - unsigned int v0; // eax@3 - unsigned int v1; // eax@7 - int v2; // eax@10 - const char *v3; // eax@10 - signed int v4; // ecx@12 - int v5; // ecx@14 - int v6; // eax@21 - int v7; // esi@21 - char *v8; // eax@21 - char* v9; // eax@22 - unsigned int v11; // [sp-8h] [bp-64h]@3 - unsigned int v12; // [sp-8h] [bp-64h]@7 - Texture *v13; // [sp-4h] [bp-60h]@3 - Texture *v14; // [sp-4h] [bp-60h]@7 - GUIWindow a1; // [sp+8h] [bp-54h]@10 + 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 ) - { - v13 = pTex_tab_an_6a__zoom_off; - v11 = pViewport->uViewportTL_Y + 2; - v0 = pViewport->uViewportTL_X + 407; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - { - v13 = pTex_tab_an_6b__zoom_on; - v11 = pViewport->uViewportTL_Y + 1; - v0 = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(v0, v11, v13); + pRenderer->DrawTextureTransparent(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 ) - { - v14 = pTex_tab_an_7a__zoot_off; - v12 = pViewport->uViewportTL_Y + 38; - v1 = pViewport->uViewportTL_X + 407; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - { - v14 = pTex_tab_an_7b__zoot_on; - v12 = pViewport->uViewportTL_Y + 38; - v1 = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(v1, v12, v14); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - if ( !byte_5C6D50[books_primary_item_per_page] ) + if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title { - v2 = achieved_awards[books_primary_item_per_page]; - a1.uFrameWidth = game_viewport_width; - a1.uFrameX = game_viewport_x; - a1.uFrameY = game_viewport_y; - a1.uFrameHeight = game_viewport_height; - v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; - a1.uFrameZ = game_viewport_z; - a1.uFrameW = game_viewport_w; - if ( v3 ) - a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3); + 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, (const char *)pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); } - a1.uFrameX = 48; - a1.uFrameY = 70; - a1.uFrameWidth = 360; - a1.uFrameHeight = 264; - v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3; - a1.uFrameZ = 407; - a1.uFrameHeight = v4 * 264 / v4; - a1.uFrameW = a1.uFrameHeight + 69; - if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book ) + //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); - v5 = books_page_number++; books_primary_item_per_page += num_achieved_awards; - books_num_items_per_page[v5] = num_achieved_awards; + books_num_items_per_page[books_page_number++] = num_achieved_awards; } - if ( BtnUp_flag && books_page_number ) + if ( BtnUp_flag && books_page_number )//Press bookmark previous page { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --books_page_number; @@ -521,17 +438,15 @@ books_page_number = 0; } BtnDown_flag = 0; - v6 = achieved_awards[books_primary_item_per_page]; BtnUp_flag = 0; num_achieved_awards = 0; - //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); - v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); - v8 = BuildDialogueString(pStorylineText->StoreLine[v6].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); - if ( v7 ) + pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, + 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[achieved_awards[books_primary_item_per_page] + 21]); + if ( achieved_awards[books_primary_item_per_page] ) { - v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[books_primary_item_per_page]); - a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow); + 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, (const char *)pStringOnPage, 0, + journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); ++num_achieved_awards; } } - diff -r 9add223260ce -r dfc9484ed94c mm7_4.cpp --- a/mm7_4.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/mm7_4.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -1906,459 +1906,378 @@ //----- (00495461) -------------------------------------------------------- char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) { - unsigned __int8 v6; // bl@1 Player *pPlayer; // ebx@3 - //NPCData *v9; // eax@4 - //size_t v10; // eax@6 - char *v11; // esi@7 - //int v12; // edx@7 - //ItemGen *v13; // edi@7 - //char v14; // cl@8 - //char *v15; // ecx@10 - //int v16; // edx@10 + char *pText; // esi@7 int v17; // eax@10 signed __int64 v18; // qax@18 - unsigned int v19; // edi@32 unsigned __int8 *v20; // ebx@32 int v21; // ecx@34 - __int16 v22; // ax@34 - int v23; // edx@39 - int v24; // eax@39 - int v25; // eax@45 - float *v26; // esi@68 - float v27; // ST18_4@68 - signed int v28; // eax@68 + int pReputation; // eax@45 int v29; // eax@68 - float v30; // ST18_4@72 - signed int v31; // eax@72 - float v32; // ST18_4@74 - signed int v33; // eax@74 - double v34; // st7@75 - float v35; // ST18_4@76 - signed int v36; // eax@76 - float *v37; // esi@78 - float v38; // ST18_4@78 - int v39; // eax@78 - float v40; // ST18_4@82 - int v41; // eax@82 - float v42; // ST18_4@83 - int v43; // eax@83 - float v44; // ST18_4@85 - int v45; // eax@85 - const char *v46; // eax@86 - unsigned int v47; // eax@87 - float v48; // ST18_4@97 - __int64 v49; // ST14_8@107 - int v50; // eax@107 - int v51; // eax@108 - Player *v52; // eax@109 - int v53; // [sp-4h] [bp-13Ch]@107 - int v54; // [sp+0h] [bp-138h]@107 __int16 v55[56]; // [sp+10h] [bp-128h]@34 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 - stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 char a1[100]; // [sp+B8h] [bp-80h]@3 - unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 - //size_t v60; // [sp+120h] [bp-18h]@3 - //Player *v61; // [sp+124h] [bp-14h]@3 - //char *Str; // [sp+128h] [bp-10h]@1 int v63; // [sp+12Ch] [bp-Ch]@32 - //int v64; // [sp+130h] [bp-8h]@6 - //NPCData *v65; // [sp+134h] [bp-4h]@6 - //int packed; - - - v6 = uPlayerID; - //Str = lpsz; - if ( IsBadStringPtrA(lpsz, 1u) ) + if ( IsBadStringPtrA(lpsz, 1) ) return "Invalid String Passed"; a1[0] = 0; - pPlayer = &pParty->pPlayers[v6]; - v59 = TargetColor(255, 255, 155); - //v61 = pPlayer; + pPlayer = &pParty->pPlayers[uPlayerID]; memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); NPCData *npc = nullptr; if ( dword_5C35D4 ) - { - //__debugbreak(); // fix npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1 - } else npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); - //v65 = v9; - //v10 = 0; - //v64 = 0; - //int i = 0; - //if ( (signed int)v60 > 0 ) - v11 = a4; - + //pText = a4; auto len = strlen(lpsz); for (int i = 0, dst = 0; i < len; ++i) { - //v12 = v64; - //v13 = a3; - //while ( 1 ) - //{ char c = lpsz[i]; if (c != '%') pTmpBuf2[dst++] = c; else { - //v15 = &lpsz[v12 + 1]; - //v16 = (unsigned __int8)lpsz[v12 + 2]; - //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; - //v17 = packed - 528;// 10 * '0' + '0' v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; switch ( v17 ) { - case 1: - v11 = npc->pName; - goto _continue_strcat; - case 2: - v11 = pPlayer->pName; - goto _continue_strcat; - case 3: - case 4: - v11 = a1; - goto _continue_strcat; - case 5: - v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; - v11 = pGlobalTXT_LocalizationStrings[397];// "evening" - if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) - { - if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) - { - if ( v18 < 20 ) - v11 = pGlobalTXT_LocalizationStrings[396];// "day" - } - else - { - v11 = pGlobalTXT_LocalizationStrings[395];// "morning" - } - } - goto _continue_strcat; - case 6: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[387];// "lady" - else - v11 = pGlobalTXT_LocalizationStrings[385];// "sir" - goto _continue_strcat; - case 7: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" - else - v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" - goto _continue_strcat; - case 8: - v19 = 0; - v63 = 0; - v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; - do - { - if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) - { - v21 = v63; - v22 = word_4EE150[v19]; - ++v63; - v55[v21] = v22; - } - ++v19; - } - while ( v19 < 28 ); - if ( v63 ) + case 1://Подробнее + strcat(pTmpBuf2.data(), npc->pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 2: + strcat(pTmpBuf2.data(), pPlayer->pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 3: + case 4: + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 5: + v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; + pText = pGlobalTXT_LocalizationStrings[397];// "evening" + if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) + { + if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) { - v23 = rand() % v63; - v24 = dword_A74CDC; - if ( dword_A74CDC == -1 ) - { - v24 = v23; - dword_A74CDC = v23; - } - v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; - } - else - { - v11 = (char *)pNPCTopics[55].pText; - } - //pPlayer = v61; - //v13 = a3; - goto _continue_strcat; - case 9: - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[384];// "her" - else - v11 = pGlobalTXT_LocalizationStrings[383];// "his" - goto _continue_strcat; - case 10: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" - else - v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" - goto _continue_strcat; - case 11: - v25 = GetPartyReputation(); - if ( v25 >= 25 ) - { - v11 = pGlobalTXT_LocalizationStrings[379]; - } - else - { - if ( v25 < 6 ) - { - if ( v25 >= -5 ) - { - v11 = pGlobalTXT_LocalizationStrings[399]; - } - else - { - if ( v25 < -24 ) - v11 = pGlobalTXT_LocalizationStrings[434]; - else - v11 = pGlobalTXT_LocalizationStrings[402]; - } - } - else - { - v11 = pGlobalTXT_LocalizationStrings[392]; - } - } - goto _continue_strcat; - case 12: - v25 = npc->rep; - if ( v25 >= 25 ) - { - v11 = pGlobalTXT_LocalizationStrings[379]; + if ( v18 < 20 ) + pText = pGlobalTXT_LocalizationStrings[396];// "day" } else { - if ( v25 < 6 ) + pText = pGlobalTXT_LocalizationStrings[395];// "morning" + } + } + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 6: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[387];// "lady" + else + pText = pGlobalTXT_LocalizationStrings[385];// "sir" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 7: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[389];// "Lady" + else + pText = pGlobalTXT_LocalizationStrings[386];// "Sir" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 8: + v63 = 0; + v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; + for ( uint i = 0; i < 28; ++i ) + { + if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) + { + v21 = v63; + ++v63; + v55[v63] = word_4EE150[i]; + } + } + if ( v63 ) + { + if ( dword_A74CDC == -1 ) + dword_A74CDC = rand() % v63; + pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; + } + else + pText = (char *)pNPCTopics[55].pText; + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 9: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[384];// "her" + else + pText = pGlobalTXT_LocalizationStrings[383];// "his" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 10: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[389];// "Lady" + else + pText = pGlobalTXT_LocalizationStrings[388];// "Lord" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 11: + pReputation = GetPartyReputation(); + if ( pReputation >= 25 ) + pText = pGlobalTXT_LocalizationStrings[379]; + else//v25 < 25 + { + if ( pReputation < 6 ) + { + if ( pReputation >= -5 )//6 >= v25 >= -5 + pText = pGlobalTXT_LocalizationStrings[399]; + else// v25 < -5 { - if ( v25 >= -5 ) - { - v11 = pGlobalTXT_LocalizationStrings[399]; - } - else - { - if ( v25 < -24 ) - v11 = pGlobalTXT_LocalizationStrings[434]; - else - v11 = pGlobalTXT_LocalizationStrings[402]; - } + if ( pReputation < -24 )//-24 > v25 + pText = pGlobalTXT_LocalizationStrings[434]; + else// -5 > v25 > -24 + pText = pGlobalTXT_LocalizationStrings[402]; } + } + else//25 > v25 > 6 + pText = pGlobalTXT_LocalizationStrings[392]; + } + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 12: + pReputation = npc->rep; + if ( pReputation >= 25 ) + pText = pGlobalTXT_LocalizationStrings[379]; + else + { + if ( pReputation < 6 ) + { + if ( pReputation >= -5 ) + pText = pGlobalTXT_LocalizationStrings[399]; else { - v11 = pGlobalTXT_LocalizationStrings[392]; + if ( pReputation < -24 ) + pText = pGlobalTXT_LocalizationStrings[434]; + else + pText = pGlobalTXT_LocalizationStrings[402]; } } - goto _continue_strcat; - case 13: - v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); - goto _continue_strcat; - case 14: - { - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[391];// "sister" - else - v11 = pGlobalTXT_LocalizationStrings[390];// "brother" - goto _continue_strcat; - } - - case 15: - { - v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" -_continue_strcat: - strcat(pTmpBuf2.data(), v11); - dst = strlen(pTmpBuf2.data()); - //v64 += 2; - i += 2; - } - break; - - case 16: - { - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[391];// "sister" else - v11 = pGlobalTXT_LocalizationStrings[390];// "brother" - goto _continue_strcat; - } - case 17: - { - auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; - if (!pay_percentage) - pay_percentage = 1; - - sprintf(a1, "%lu", pay_percentage); - v11 = a1; - goto _continue_strcat; + pText = pGlobalTXT_LocalizationStrings[392]; } - - case 18: - case 19: - case 20: - case 21: - case 22: - case 26: -_continue_strncpy: - strncpy(a1, lpsz + i + 1, 2); - v51 = atoi(a1); - sprintf(a1, "%lu", v51); - v11 = a1; - goto _continue_strcat; - - case 23: - { - v47 = pMapStats->GetMapInfo(pCurrentMapName.data()); - if ( v47 ) - v11 = pMapStats->pInfos[v47].pName; - else - v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" - goto _continue_strcat; - } - case 24: - { - v46 = a3->GetDisplayName(); - sprintfex(a1, format_4E2D80, v59, v46); - v11 = a1; - goto _continue_strcat; - } - - - case 25: - { - v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v38 = *v37; - v39 = a3->GetValue(); - v29 = pPlayer->GetBaseBuyingPrice(v39, v38); + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 13: + strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 14: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[391];// "sister" + else + pText = pGlobalTXT_LocalizationStrings[390];// "brother" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 15: + strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 16: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[391];// "sister" + else + pText = pGlobalTXT_LocalizationStrings[390];// "brother" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 17://текст наёмного НПС + { + auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; + if ( !pay_percentage ) + pay_percentage = 1; + sprintf(a1, "%lu", pay_percentage); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + case 18: + case 19: + case 20: + case 21: + case 22: + case 26: + strncpy(a1, lpsz + i + 1, 2); + sprintf(a1, "%lu", atoi(a1)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 23: + if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) + pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())].pName; + else + pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 24://название товара в продаже + sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 25: + v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); switch ( a5 ) - { - case 3: - v44 = *v37; - v45 = a3->GetValue(); - v29 = pPlayer->GetBaseSellingPrice(v45, v44); - break; - case 4: - v29 = pPlayer->GetBaseIdentifyPrice(*v37); - break; - case 5: - v42 = *v37; - v43 = a3->GetValue(); - v29 = pPlayer->GetBaseRepairPrice(v43, v42); - break; - case 6: - v40 = *v37; - v41 = a3->GetValue(); - v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2; + { + case 3: + v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 4: + v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 5: + v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 6: + v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; + break; + } + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 27://текст продажи + v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + if ( a5 == 3 ) + { + v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + if (a3->Broken()) + v29 = 1; + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; break; } - goto _continue_sprintf; - } - - case 27: - { - v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v27 = *v26; - v28 = a3->GetValue(); - v29 = pPlayer->GetBuyingPrice(v28, v27); - if ( a5 == 3 ) - { - v35 = *v26; - v36 = a3->GetValue(); - v29 = pPlayer->GetPriceSell(v36, v35); - if (a3->Broken()) - v29 = 1; - goto _continue_sprintf; - } - if ( a5 != 4 ) - { - if ( a5 == 5 ) - { - v32 = *v26; - v33 = a3->GetValue(); - v29 = pPlayer->GetPriceRepair(v33, v32); - } - else - { - if ( a5 == 6 ) + if ( a5 != 4 ) { - v30 = *v26; - v31 = a3->GetValue(); - v29 = pPlayer->GetPriceSell(v31, v30) / 2; - if (a3->Broken()) - v29 = 1; - if (!v29) - v29 = 1; - goto _continue_sprintf; + if ( a5 == 5 ) + v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + else + { + if ( a5 == 6 ) + { + v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; + if (a3->Broken()) + v29 = 1; + if (!v29) + v29 = 1; + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + } + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; } - } -_continue_sprintf: - sprintfex(a1, "%lu", v29); - v11 = a1; - goto _continue_strcat; - } - v34 = *v26; - - v48 = v34; - v29 = pPlayer->GetPriceIdentification(v48); - goto _continue_sprintf; - } - - case 28: - { - //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; - v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; - goto _continue_strcat; - } - + sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 28://профессия + strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 29: - { - //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; - v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v48 = v34; - v29 = pPlayer->GetPriceIdentification(v48); - goto _continue_sprintf; - } - + sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 30: - { - if ( !a6 ) - goto _continue_strcat; - sub_493F79(&v57, *a6); - v54 = v57.field_18_expire_year; - v53 = v57.field_C_expire_day + 1; - v50 = v57.field_14_exprie_month; - sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); - v11 = a1; - goto _continue_strcat; - } - + if ( !a6 ) + { + strcat(pTmpBuf2.data(), a4); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + sub_493F79(&v56, *a6); + sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 31: case 32: case 33: case 34: - v52 = &pParty->pPlayers[v17 - 31]; - v11 = v52->pName; - goto _continue_strcat; - + strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; default: if ( v17 <= 50 || v17 > 70 ) - goto _continue_strncpy; + { + strncpy(a1, lpsz + i + 1, 2); + sprintf(a1, "%lu", atoi(a1)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } if ( v17 - 51 >= 20 ) - goto _continue_strcat; - v49 = pParty->field_3C._s_times[v17-51]; - - sub_493F79(&v56, v49); - v54 = v56.field_18_expire_year; - v53 = v56.field_C_expire_day + 1; - v50 = v56.field_14_exprie_month; - sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); - v11 = a1; - goto _continue_strcat; + { + strcat(pTmpBuf2.data(), a4); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + sub_493F79(&v56, pParty->field_3C._s_times[v17-51]); + sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; } } } diff -r 9add223260ce -r dfc9484ed94c mm7_data.cpp --- a/mm7_data.cpp Tue Aug 06 09:26:17 2013 +0600 +++ b/mm7_data.cpp Thu Aug 08 16:34:19 2013 +0600 @@ -1086,7 +1086,7 @@ std::array pFinalMessage; // idb std::array pTmpBuf; std::array pTmpBuf2; -std::array byte_5C6D50; // weak +std::array Journal_limitation_factor; // weak int ui_current_text_color; // weak __int64 qword_5C6DF0; // weak int dword_5C6DF8; // weak diff -r 9add223260ce -r dfc9484ed94c mm7_data.h --- a/mm7_data.h Tue Aug 06 09:26:17 2013 +0600 +++ b/mm7_data.h Thu Aug 08 16:34:19 2013 +0600 @@ -734,7 +734,7 @@ extern std::array pFinalMessage; // idb extern std::array pTmpBuf; extern std::array pTmpBuf2; -extern std::array byte_5C6D50; // weak +extern std::array Journal_limitation_factor; // weak extern int ui_current_text_color; // weak extern __int64 qword_5C6DF0; // weak extern int dword_5C6DF8; // weak