comparison UIHouses.cpp @ 874:231523a39203

Buy books(first)
author Ritor1
date Mon, 01 Apr 2013 17:37:32 +0600
parents aa0172fd88c6
children 1d7e7d61485b
comparison
equal deleted inserted replaced
873:aa0172fd88c6 874:231523a39203
4593 4593
4594 //----- (004B5D7C) -------------------------------------------------------- 4594 //----- (004B5D7C) --------------------------------------------------------
4595 void GuildDialog() 4595 void GuildDialog()
4596 { 4596 {
4597 GUIWindow *v0; // ebx@1 4597 GUIWindow *v0; // ebx@1
4598 Player *currPlayer; // edi@1 4598 //Player *currPlayer; // edi@1
4599 signed int base_teach_price; // ebx@1 4599 signed int base_teach_price; // ebx@1
4600 int v3; // edi@6 4600 int v3; // edi@6
4601 int result; // eax@11 4601 int result; // eax@11
4602 unsigned int v5; // ebx@13 4602 unsigned int v5; // ebx@13
4603 int v6; // esi@13 4603 int v6; // esi@13
4650 signed int v53; // [sp+27Ch] [bp-70h]@1 4650 signed int v53; // [sp+27Ch] [bp-70h]@1
4651 signed int v54; // [sp+284h] [bp-68h]@1 4651 signed int v54; // [sp+284h] [bp-68h]@1
4652 int v55; // [sp+2C8h] [bp-24h]@47 4652 int v55; // [sp+2C8h] [bp-24h]@47
4653 int main_text_color; // [sp+2CCh] [bp-20h]@1 4653 int main_text_color; // [sp+2CCh] [bp-20h]@1
4654 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 4654 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
4655 Player *v58; // [sp+2D4h] [bp-18h]@1 4655 //Player *v58; // [sp+2D4h] [bp-18h]@1
4656 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 4656 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
4657 char *Str; // [sp+2DCh] [bp-10h]@35 4657 char *Str; // [sp+2DCh] [bp-10h]@35
4658 int v61; // [sp+2E0h] [bp-Ch]@35 4658 int v61; // [sp+2E0h] [bp-Ch]@35
4659 unsigned int v62; // [sp+2E4h] [bp-8h]@13 4659 unsigned int v62; // [sp+2E4h] [bp-8h]@13
4660 int v63; // [sp+2E8h] [bp-4h]@1 4660 int v63; // [sp+2E8h] [bp-4h]@1
4661 4661
4662 v0 = window_SpeakInHouse; 4662 v0 = window_SpeakInHouse;//Ritor1: in process
4663 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); 4663 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
4664 v58 = pPlayers[uActiveCharacter]; 4664 //v58 = pPlayers[uActiveCharacter];
4665 currPlayer = v58; 4665 //currPlayer = pPlayers[uActiveCharacter];
4666 working_window.uFrameX = 483; 4666 working_window.uFrameX = 483;
4667 working_window.uFrameWidth = 148; 4667 working_window.uFrameWidth = 148;
4668 working_window.uFrameZ = 334; 4668 working_window.uFrameZ = 334;
4669 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 4669 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
4670 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 4670 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
4671 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); 4671 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
4672 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); 4672 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
4673 v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100; 4673 v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
4674 if ( v63 < base_teach_price / 3 ) 4674 if ( v63 < base_teach_price / 3 )
4675 v63 = base_teach_price / 3; 4675 v63 = base_teach_price / 3;
4676 strcpy(Dest, ""); 4676 strcpy(Dest, "");
4677 strcpy(v46, ""); 4677 strcpy(v46, "");
4678 strcpy(v47, ""); 4678 strcpy(v47, "");
4679 strcpy(v48, ""); 4679 strcpy(v48, "");
4680 strcpy(v49, ""); 4680 strcpy(v49, "");
4681 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 4681 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
4682 { 4682 {
4683 if ( dialog_menu_id != HOUSE_DIALOGUE_GULD_BUY_BOOKS ) //buy skill 4683 if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
4684 { 4684 {
4685 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4685 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4686 { 4686 {
4687 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill 4687 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
4688 if ( v58->pActiveSkills[dialog_menu_id-36] ) 4688 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
4689 { 4689 {
4690 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" 4690 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
4691 ShowStatusBarString(pTmpBuf, 2u); 4691 ShowStatusBarString(pTmpBuf, 2u);
4692 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 4692 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
4693 } 4693 }
4699 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 4699 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
4700 } 4700 }
4701 else 4701 else
4702 { 4702 {
4703 Party::TakeGold(v63); 4703 Party::TakeGold(v63);
4704 v58->pActiveSkills[dialog_menu_id-36] = 1; 4704 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
4705 } 4705 }
4706 } 4706 }
4707 } 4707 }
4708 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 4708 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
4709 return; 4709 return;
4719 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) 4719 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
4720 4720
4721 { 4721 {
4722 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); 4722 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
4723 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); 4723 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
4724 currPlayer = v58; 4724 //currPlayer = v58;
4725 } 4725 }
4726 v63 += 70; 4726 v63 += 70;
4727 v62 += 280; 4727 v62 += 280;
4728 ++v6; 4728 ++v6;
4729 } 4729 }
4737 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) 4737 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
4738 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) 4738 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
4739 { 4739 {
4740 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); 4740 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
4741 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); 4741 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
4742 currPlayer = v58; 4742 //currPlayer = v58;
4743 } 4743 }
4744 v63 += 70; 4744 v63 += 70;
4745 v62 += 280; 4745 v62 += 280;
4746 ++v7; 4746 ++v7;
4747 } 4747 }
4783 { 4783 {
4784 v14 = window_SpeakInHouse->ptr_1C; 4784 v14 = window_SpeakInHouse->ptr_1C;
4785 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); 4785 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
4786 v16 = (int)window_SpeakInHouse->ptr_1C; 4786 v16 = (int)window_SpeakInHouse->ptr_1C;
4787 uPlayerID = uActiveCharacter - 1; 4787 uPlayerID = uActiveCharacter - 1;
4788 v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); 4788 v17 = pPlayers[uActiveCharacter]->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2);
4789 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); 4789 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
4790 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); 4790 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
4791 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); 4791 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3);
4792 return; 4792 return;
4793 } 4793 }
4794 } 4794 }
4795 return; 4795 return;
4796 } 4796 }
4797 if ( !(unsigned __int16)_449B57_test_bit( 4797 if ( !(unsigned __int16)_449B57_test_bit(
4798 (unsigned __int8 *)currPlayer->_guilds_member_bits, 4798 (unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits,
4799 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) 4799 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
4800 { //you must me member 4800 { //you must me member
4801 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); 4801 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
4802 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); 4802 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
4803 pDialogueWindow->pNumPresenceButton = 0; 4803 pDialogueWindow->pNumPresenceButton = 0;
4832 ++v61; 4832 ++v61;
4833 } 4833 }
4834 else 4834 else
4835 { 4835 {
4836 4836
4837 if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36])) 4837 if((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23-36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v23-36]))
4838 // or 4838 // or
4839 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] 4839 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
4840 { 4840 {
4841 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); 4841 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0);
4842 v62 += v24; 4842 v62 += v24;
4848 } 4848 }
4849 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); 4849 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem );
4850 if ( !v61 ) 4850 if ( !v61 )
4851 { 4851 {
4852 LABEL_64: 4852 LABEL_64:
4853 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s" 4853 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
4854 strcat(pTmpBuf, "\n \n"); 4854 strcat(pTmpBuf, "\n \n");
4855 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." 4855 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
4856 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); 4856 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
4857 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); 4857 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
4858 return; 4858 return;
4880 break; 4880 break;
4881 4881
4882 // __debugbreak(); 4882 // __debugbreak();
4883 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] 4883 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
4884 // or 4884 // or
4885 if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36])) 4885 if ((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v29-36]))
4886 // or 4886 // or
4887 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] 4887 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
4888 4888
4889 { 4889 {
4890 v30 = pClassNames[v29 -16]; 4890 v30 = pClassNames[v29 -16];