Mercurial > mm7
diff UI/UIGuilds.cpp @ 1920:05b433b8cb37
GuildDialog fix and cleared
author | Ritor1 |
---|---|
date | Wed, 23 Oct 2013 12:49:25 +0600 |
parents | 2e6d3cd052e0 |
children | 259df09dfb50 |
line wrap: on
line diff
--- a/UI/UIGuilds.cpp Wed Oct 23 10:24:38 2013 +0600 +++ b/UI/UIGuilds.cpp Wed Oct 23 12:49:25 2013 +0600 @@ -16,46 +16,20 @@ void GuildDialog() { signed int base_teach_price; // ebx@1 - int v3; // edi@6 - int result; // eax@11 int v6; // esi@13 signed int v7; // esi@17 int v8; // esi@22 - signed int v9; // ecx@22 - char *v10; // eax@22 const char *statusbar_string; // ecx@26 - POINT *v12; // esi@30 int v13; // ecx@30 ItemGen *v15; // ST18_4@31 int v17; // eax@31 char *v18; // edx@31 - int pActiveItem; // esi@35 - int v24; // eax@39 - int v25; // eax@40 int v26; // ecx@47 GUIButton *pButton; // eax@49 int pTextHeight; // eax@55 unsigned __int16 pTextColor; // ax@55 - int v35; // eax@58 - const char *v36; // ST20_4@61 - unsigned __int16 v37; // ST1C_2@61 - int v40; // [sp-14h] [bp-300h]@31 - int v41; // [sp-10h] [bp-2FCh]@31 - unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 - char *v43; // [sp-8h] [bp-2F4h]@31 - unsigned int v44; // [sp-4h] [bp-2F0h]@31 - char Dest[100]; // [sp+Ch] [bp-2E0h]@3 - char v46[100]; // [sp+70h] [bp-27Ch]@3 - char v47[100]; // [sp+D4h] [bp-218h]@3 - char v48[100]; // [sp+138h] [bp-1B4h]@3 - char v49[100]; // [sp+19Ch] [bp-150h]@3 - POINT v50; // [sp+264h] [bp-88h]@30 - POINT v51; // [sp+26Ch] [bp-80h]@30 + POINT cursor; // [sp+26Ch] [bp-80h]@30 GUIWindow working_window; // [sp+274h] [bp-78h]@1 - signed int v53; // [sp+27Ch] [bp-70h]@1 - signed int v54; // [sp+284h] [bp-68h]@1 - int pColorWhite; // [sp+2CCh] [bp-20h]@1 - int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 int v58; // [sp+2D4h] [bp-18h]@1 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 int v61; // [sp+2E0h] [bp-Ch]@35 @@ -68,24 +42,17 @@ working_window.uFrameX = 483; working_window.uFrameWidth = 148; working_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu); base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( pPrice < base_teach_price / 3 ) pPrice = base_teach_price / 3; - strcpy(Dest, ""); - strcpy(v46, ""); - strcpy(v47, ""); - strcpy(v48, ""); - strcpy(v49, ""); if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) { if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) + guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) ) { //you must me member pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); + working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3); pDialogueWindow->pNumPresenceButton = 0; return; } @@ -97,7 +64,7 @@ strcat(pTmpBuf.data(), "\n \n"); strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); return; } v61 = 0; @@ -128,7 +95,7 @@ strcat(pTmpBuf.data(), "\n \n"); strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); return; } if ( pSkillFlag ) @@ -151,9 +118,9 @@ pButton->uHeight = pTextHeight; v26 = pButton->uY + pTextHeight - 1; pButton->uW = v26; - pTextColor = pColorYellow; + pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = pColorWhite; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" } else @@ -166,9 +133,9 @@ pButton->uHeight = pTextHeight; v26 = pButton->uY + pTextHeight - 1; pButton->uW = v26; - pTextColor = pColorYellow; + pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = pColorWhite; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); } else @@ -211,63 +178,56 @@ if ( HouseUI_CheckIfPlayerCanInteract() ) { v8 = 0; - for ( v9 = 12; v9; --v9 ) + for ( uint i = 0; i < 12; ++i ) { - if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID > 0 ) + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 ) ++v8; } GetAsyncKeyState(17); - statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" - DrawTextAtStatusBar(statusbar_string, 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy" if ( !v8 ) { - working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//"Приходите через 14 дней" + working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней" return; } - v12 = pMouse->GetCursorPos(&v51); - result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; - v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + pMouse->GetCursorPos(&cursor); + v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; + if ( v13 ) { v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C)); v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0); pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v18, 3); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v18, 3); return; } } return; } - if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) + if ( HouseUI_CheckIfPlayerCanInteract() ) { - if ( HouseUI_CheckIfPlayerCanInteract() ) + if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) { - if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill" + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + } + else + { + if ( pParty->uNumGold < pPrice ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); } else { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(pPrice); - pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; - } + Party::TakeGold(pPrice); + pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; } } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; } //----- (004BC8D5) -------------------------------------------------------- void SpellBookGenerator()//for GuildDialogs