# HG changeset patch # User Ritor1 # Date 1364876962 -21600 # Node ID 4004fb0bf60cd4c64af17261faf173207cd145e6 # Parent 7eb081d32614f559569cbfe75bbe89b2177f6257# Parent caa86b11dcddd05ed7f3a3abce03f382c0052922 Слияние diff -r 7eb081d32614 -r 4004fb0bf60c UIHouses.cpp --- a/UIHouses.cpp Tue Apr 02 10:29:15 2013 +0600 +++ b/UIHouses.cpp Tue Apr 02 10:29:22 2013 +0600 @@ -4591,15 +4591,15 @@ - //----- (004B5D7C) -------------------------------------------------------- - void GuildDialog() - { - GUIWindow *v0; // ebx@1 +//----- (004B5D7C) -------------------------------------------------------- +void GuildDialog() +{ + //GUIWindow *pWindow; // ebx@1 //Player *currPlayer; // edi@1 signed int base_teach_price; // ebx@1 int v3; // edi@6 int result; // eax@11 - unsigned int v5; // ebx@13 + //unsigned int v5; // ebx@13 int v6; // esi@13 signed int v7; // esi@17 int v8; // esi@22 @@ -4614,21 +4614,21 @@ int v17; // eax@31 char *v18; // edx@31 int v19; // eax@32 - GUIWindow *v20; // edi@35 - int v21; // esi@35 + //GUIWindow *v20; // edi@35 + int pActiveItem; // esi@35 int v22; // eax@35 unsigned int v23; // eax@36 int v24; // eax@39 int v25; // eax@40 int v26; // ecx@47 - GUIButton *v27; // eax@49 - GUIButton *v28; // esi@49 + GUIButton *pButton; // eax@49 + //GUIButton *v28; // esi@49 unsigned int v29; // eax@49 - char *v30; // eax@52 - int v31; // eax@55 + char *pText; // eax@52 + int pTextHeight; // eax@55 unsigned int v32; // ecx@55 int v33; // eax@55 - unsigned __int16 v34; // ax@55 + unsigned __int16 pTextColor; // ax@55 int v35; // eax@58 const char *v36; // ST20_4@61 unsigned __int16 v37; // ST1C_2@61 @@ -4649,281 +4649,264 @@ 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 v55; // [sp+2C8h] [bp-24h]@47 - int main_text_color; // [sp+2CCh] [bp-20h]@1 - int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 - //Player *v58; // [sp+2D4h] [bp-18h]@1 + //int v55; // [sp+2C8h] [bp-24h]@47 + int pColorWhite; // [sp+2CCh] [bp-20h]@1 + int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 + int v58; // [sp+2D4h] [bp-18h]@1 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 - char *Str; // [sp+2DCh] [bp-10h]@35 + bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 int v61; // [sp+2E0h] [bp-Ch]@35 + int pItemNum; unsigned int v62; // [sp+2E4h] [bp-8h]@13 int v63; // [sp+2E8h] [bp-4h]@1 - - v0 = window_SpeakInHouse;//Ritor1: in process - memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); - //v58 = pPlayers[uActiveCharacter]; - //currPlayer = pPlayers[uActiveCharacter]; - working_window.uFrameX = 483; - working_window.uFrameWidth = 148; - working_window.uFrameZ = 334; - main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); - base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); - v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v63 < base_teach_price / 3 ) - v63 = base_teach_price / 3; - strcpy(Dest, ""); - strcpy(v46, ""); - strcpy(v47, ""); - strcpy(v48, ""); - strcpy(v49, ""); - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) - { - if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill - if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf, 2u); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < v63 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(v63); - pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; - } - } - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v5 = 0; - v6 = 0; - v62 = 0; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - - { - pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); - //currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v6; - } - while ( v63 < 452 ); - - v62 = 1680; - v7 = 6; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - { - pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); - //currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v7; - } - while ( v63 < 452 ); - - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v8 = 0; - v9 = 12; - // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); - // v10 = - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) - ++v8; - // v10 += 36; - --v9; - } - while ( v9 ); + int pNumActivItem; + int all_text_height; - 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); - if ( !v8 ) - { - working_window.DrawCurrentTime( - __PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - - pParty->uTimePlayed); - return; - } - v12 = pMouse->GetCursorPos(&v51); - result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; - v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v14 = window_SpeakInHouse->ptr_1C; - v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); - v16 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v17 = pPlayers[uActiveCharacter]->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); - v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); - v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); - return; - } - } - return; - } - if ( !(unsigned __int16)_449B57_test_bit( - (unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, + //pWindow = window_SpeakInHouse;//Ritor1: in process + memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); + //v58 = pPlayers[uActiveCharacter]; + //currPlayer = pPlayers[uActiveCharacter]; + working_window.uFrameX = 483; + working_window.uFrameWidth = 148; + working_window.uFrameZ = 334; + pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); + base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); + v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v63 < base_teach_price / 3 ) + v63 = base_teach_price / 3; + strcpy(Dest, ""); + strcpy(v46, ""); + strcpy(v47, ""); + strcpy(v48, ""); + strcpy(v49, ""); + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill + if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" + ShowStatusBarString(pTmpBuf, 2); + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + } + else + { + if ( pParty->uNumGold < v63 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + } + else + { + Party::TakeGold(v63); + pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; + } + } + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + //v5 = 0; + v6 = 0; + v62 = 0; + v63 = 32; + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) + // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) + { + pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); + //currPlayer = v58; + } + v63 += 70; + v62 += 280; + ++v6; + } + while ( v63 < 452 ); + v62 = 1680; + v7 = 6; + v63 = 32; + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) + // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) + { + pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); + //currPlayer = v58; + } + v63 += 70; + v62 += 280; + ++v7; + } + while ( v63 < 452 ); + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v8 = 0; + v9 = 12; + // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); + // v10 = + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) + ++v8; + // v10 += 36; + --v9; + } + while ( v9 ); + 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); + if ( !v8 ) + { + working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed); + return; + } + v12 = pMouse->GetCursorPos(&v51); + result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; + v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; + if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + { + v14 = window_SpeakInHouse->ptr_1C; + v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); + v16 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v17 = pPlayers[uActiveCharacter]->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); + v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); + v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3); + return; + } + } + return; + } + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) - { //you must me member - v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v20 = pDialogueWindow; - v5 = 0; - v62 = 0; - Str = 0; - v21 = pDialogueWindow->pStartingPosActiveItem; - v22 = v21 + pDialogueWindow->pNumPresenceButton; - v61 = 0; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - do - { - v23 = v20->GetControl(v21)->msg_param; - if ( v23 == 18 ) - { - v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v62 += v25; - ++v61; - } - else - { - - if((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23-36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v23-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - { - v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); - v62 += v24; - ++v61; - ++Str; - } - } - ++v21; - } - while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); - if ( !v61 ) - { -LABEL_64: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - if ( Str ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - } - v63 = (signed int)(149 - v62) / v61; - if ( v63 > 32 ) - v63 = 32; - v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; - v62 = v20->pStartingPosActiveItem; - v55 = v26; - if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton ) - { - v61 = 2; - while ( 1 ) - { - v27 = v20->GetControl(v62); - v28 = v27; - v29 = v27->msg_param; - if ( v29 == 18 ) - break; - - // __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - if ((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v29-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - { - v30 = pClassNames[v29 -16]; -LABEL_55: - Str = v30; - v28->uY = v63 + v55; - v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0); - v32 = v28->uY; - v28->uHeight = v31; - v33 = v32 + v31 - 1; - v28->uW = v33; - v55 = v33; - v34 = hi_text_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v61 ) - v34 = main_text_color; - working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u); - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v28->uW = 0; - v28->uHeight = 0; - v28->uY = 0; -LABEL_58: - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" - goto LABEL_55; - } - return; - } - - + { //you must me member + v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + //v20 = pDialogueWindow; + //v5 = 0; + v61 = 0; + pSkillFlag = false; + pActiveItem = pDialogueWindow->pStartingPosActiveItem; + v22 = pActiveItem + pDialogueWindow->pNumPresenceButton; + pItemNum = 0; + if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3); + return; + } + all_text_height = 0; + do + { + v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param; + if ( v23 == 18 ) + { + all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" + v61++; + } + else + { + if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23-36] && !pPlayers[uActiveCharacter]->pActiveSkills[v23-36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0); + v61++; + pSkillFlag = true; + } + } + ++pActiveItem; + } + while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + if ( !v61 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3); + return; + } + if ( pSkillFlag ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" + working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + } + v58 = (149 - all_text_height) / v61; + if ( v58 > 32 ) + v58 = 32; + v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; + pNumActivItem = pDialogueWindow->pStartingPosActiveItem; + //v55 = v26; + if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pItemNum = 2; + do + { + pButton = pDialogueWindow->GetControl(pItemNum); + //v28 = v27; + v29 = pButton->msg_param; + if ( v29 == 18 ) + { + pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0); + v32 = pButton->uY; + pButton->uHeight = pTextHeight; + v33 = v32 + pTextHeight - 1; + pButton->uW = v33; + v26 = v33; + pTextColor = pColorYellow; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + pTextColor = pColorWhite; + working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3); + } + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[v29-36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0); + v32 = pButton->uY; + pButton->uHeight = pTextHeight; + v33 = v32 + pTextHeight - 1; + pButton->uW = v33; + v26 = v33; + pTextColor = pColorYellow; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + pTextColor = pColorWhite; + working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3); + } + ++pItemNum; + } + while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; +} //----- (004B705E) -------------------------------------------------------- void TempleDialog() diff -r 7eb081d32614 -r 4004fb0bf60c mm7_3.cpp --- a/mm7_3.cpp Tue Apr 02 10:29:15 2013 +0600 +++ b/mm7_3.cpp Tue Apr 02 10:29:22 2013 +0600 @@ -6086,8 +6086,8 @@ v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; - v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8; + v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, v18) / 8; + v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, v18) / 8; //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); @@ -15115,7 +15115,7 @@ bool v45; // eax@192 unsigned __int8 v46; // cl@197 double v47; // st7@206 - double v48; // st7@207 + //double v48; // st7@207 //char v49; // zf@208 //char v50; // zf@214 //signed int v51; // edx@219 @@ -15123,7 +15123,7 @@ __int16 v53; // fps@224 //unsigned __int8 v54; // c0@224 //unsigned __int8 v55; // c3@224 - double v56; // st7@226 + //double v56; // st7@226 AIDirection *v57; // eax@246 double v58; // st7@246 //signed int v59; // [sp-18h] [bp-C8h]@213 @@ -15576,8 +15576,7 @@ } else { - v56 = v80 * 307.2; - if ( (double)v81 >= v56 ) + if ( (double)v81 >= v80 * 307.2 ) { if ( v81 >= 1024 ) { @@ -15601,7 +15600,7 @@ } else { - v70 = (signed __int64)v56; + v70 = (signed __int64)v80 * 307.2; //monsters //guard after player runs away // follow player @@ -15651,8 +15650,7 @@ } else { - v48 = v80 * 307.2; - if ( (double)v81 >= v48 ) + if ( (double)v81 >= v80 * 307.2 ) { if ( v81 >= 1024 ) { @@ -15675,7 +15673,7 @@ } else { - v70 = (signed __int64)v48; + v70 = (signed __int64)v80 * 307.2; Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); } } @@ -15725,8 +15723,7 @@ } else if ( !v21->pMonsterInfo.uMissleAttack2Type ) { - v56 = v80 * 307.2; - if ( (double)v81 >= v56 ) + if ( (double)v81 >= v80 * 307.2 ) { if ( v81 >= 1024 ) { @@ -15749,7 +15746,7 @@ } else { - v70 = (signed __int64)v56; + v70 = (signed __int64)v80 * 307.2; Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); } }