comparison UI/UIGuilds.cpp @ 1920:05b433b8cb37

GuildDialog fix and cleared
author Ritor1
date Wed, 23 Oct 2013 12:49:25 +0600
parents 2e6d3cd052e0
children 259df09dfb50
comparison
equal deleted inserted replaced
1919:140ca8123384 1920:05b433b8cb37
14 14
15 //----- (004B5D7C) -------------------------------------------------------- 15 //----- (004B5D7C) --------------------------------------------------------
16 void GuildDialog() 16 void GuildDialog()
17 { 17 {
18 signed int base_teach_price; // ebx@1 18 signed int base_teach_price; // ebx@1
19 int v3; // edi@6
20 int result; // eax@11
21 int v6; // esi@13 19 int v6; // esi@13
22 signed int v7; // esi@17 20 signed int v7; // esi@17
23 int v8; // esi@22 21 int v8; // esi@22
24 signed int v9; // ecx@22
25 char *v10; // eax@22
26 const char *statusbar_string; // ecx@26 22 const char *statusbar_string; // ecx@26
27 POINT *v12; // esi@30
28 int v13; // ecx@30 23 int v13; // ecx@30
29 ItemGen *v15; // ST18_4@31 24 ItemGen *v15; // ST18_4@31
30 int v17; // eax@31 25 int v17; // eax@31
31 char *v18; // edx@31 26 char *v18; // edx@31
32 int pActiveItem; // esi@35
33 int v24; // eax@39
34 int v25; // eax@40
35 int v26; // ecx@47 27 int v26; // ecx@47
36 GUIButton *pButton; // eax@49 28 GUIButton *pButton; // eax@49
37 int pTextHeight; // eax@55 29 int pTextHeight; // eax@55
38 unsigned __int16 pTextColor; // ax@55 30 unsigned __int16 pTextColor; // ax@55
39 int v35; // eax@58 31 POINT cursor; // [sp+26Ch] [bp-80h]@30
40 const char *v36; // ST20_4@61
41 unsigned __int16 v37; // ST1C_2@61
42 int v40; // [sp-14h] [bp-300h]@31
43 int v41; // [sp-10h] [bp-2FCh]@31
44 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
45 char *v43; // [sp-8h] [bp-2F4h]@31
46 unsigned int v44; // [sp-4h] [bp-2F0h]@31
47 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
48 char v46[100]; // [sp+70h] [bp-27Ch]@3
49 char v47[100]; // [sp+D4h] [bp-218h]@3
50 char v48[100]; // [sp+138h] [bp-1B4h]@3
51 char v49[100]; // [sp+19Ch] [bp-150h]@3
52 POINT v50; // [sp+264h] [bp-88h]@30
53 POINT v51; // [sp+26Ch] [bp-80h]@30
54 GUIWindow working_window; // [sp+274h] [bp-78h]@1 32 GUIWindow working_window; // [sp+274h] [bp-78h]@1
55 signed int v53; // [sp+27Ch] [bp-70h]@1
56 signed int v54; // [sp+284h] [bp-68h]@1
57 int pColorWhite; // [sp+2CCh] [bp-20h]@1
58 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1
59 int v58; // [sp+2D4h] [bp-18h]@1 33 int v58; // [sp+2D4h] [bp-18h]@1
60 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 34 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
61 int v61; // [sp+2E0h] [bp-Ch]@35 35 int v61; // [sp+2E0h] [bp-Ch]@35
62 unsigned int v62; // [sp+2E4h] [bp-8h]@13 36 unsigned int v62; // [sp+2E4h] [bp-8h]@13
63 int pPrice; // [sp+2E8h] [bp-4h]@1 37 int pPrice; // [sp+2E8h] [bp-4h]@1
66 40
67 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); 41 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
68 working_window.uFrameX = 483; 42 working_window.uFrameX = 483;
69 working_window.uFrameWidth = 148; 43 working_window.uFrameWidth = 148;
70 working_window.uFrameZ = 334; 44 working_window.uFrameZ = 334;
71 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
72 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
73 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); 45 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
74 pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 46 pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
75 if ( pPrice < base_teach_price / 3 ) 47 if ( pPrice < base_teach_price / 3 )
76 pPrice = base_teach_price / 3; 48 pPrice = base_teach_price / 3;
77 strcpy(Dest, "");
78 strcpy(v46, "");
79 strcpy(v47, "");
80 strcpy(v48, "");
81 strcpy(v49, "");
82 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) 49 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
83 { 50 {
84 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, 51 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
85 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) 52 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) )
86 { //you must me member 53 { //you must me member
87 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); 54 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
88 working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); 55 working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3);
89 pDialogueWindow->pNumPresenceButton = 0; 56 pDialogueWindow->pNumPresenceButton = 0;
90 return; 57 return;
91 } 58 }
92 if ( !HouseUI_CheckIfPlayerCanInteract() ) 59 if ( !HouseUI_CheckIfPlayerCanInteract() )
93 return; 60 return;
95 { 62 {
96 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" 63 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
97 strcat(pTmpBuf.data(), "\n \n"); 64 strcat(pTmpBuf.data(), "\n \n");
98 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." 65 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
99 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); 66 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
100 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); 67 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
101 return; 68 return;
102 } 69 }
103 v61 = 0; 70 v61 = 0;
104 pSkillFlag = false; 71 pSkillFlag = false;
105 all_text_height = 0; 72 all_text_height = 0;
126 { 93 {
127 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" 94 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
128 strcat(pTmpBuf.data(), "\n \n"); 95 strcat(pTmpBuf.data(), "\n \n");
129 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." 96 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
130 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); 97 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
131 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); 98 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
132 return; 99 return;
133 } 100 }
134 if ( pSkillFlag ) 101 if ( pSkillFlag )
135 { 102 {
136 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu" 103 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
149 pButton->uY = v58 + v26; 116 pButton->uY = v58 + v26;
150 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); 117 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
151 pButton->uHeight = pTextHeight; 118 pButton->uHeight = pTextHeight;
152 v26 = pButton->uY + pTextHeight - 1; 119 v26 = pButton->uY + pTextHeight - 1;
153 pButton->uW = v26; 120 pButton->uW = v26;
154 pTextColor = pColorYellow; 121 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
155 if ( pDialogueWindow->pCurrentPosActiveItem != i ) 122 if ( pDialogueWindow->pCurrentPosActiveItem != i )
156 pTextColor = pColorWhite; 123 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
157 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" 124 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
158 } 125 }
159 else 126 else
160 { 127 {
161 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] 128 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
164 pButton->uY = v58 + v26; 131 pButton->uY = v58 + v26;
165 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0); 132 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0);
166 pButton->uHeight = pTextHeight; 133 pButton->uHeight = pTextHeight;
167 v26 = pButton->uY + pTextHeight - 1; 134 v26 = pButton->uY + pTextHeight - 1;
168 pButton->uW = v26; 135 pButton->uW = v26;
169 pTextColor = pColorYellow; 136 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
170 if ( pDialogueWindow->pCurrentPosActiveItem != i ) 137 if ( pDialogueWindow->pCurrentPosActiveItem != i )
171 pTextColor = pColorWhite; 138 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
172 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); 139 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
173 } 140 }
174 else 141 else
175 { 142 {
176 pButton->uW = 0; 143 pButton->uW = 0;
209 ++v7; 176 ++v7;
210 } 177 }
211 if ( HouseUI_CheckIfPlayerCanInteract() ) 178 if ( HouseUI_CheckIfPlayerCanInteract() )
212 { 179 {
213 v8 = 0; 180 v8 = 0;
214 for ( v9 = 12; v9; --v9 ) 181 for ( uint i = 0; i < 12; ++i )
215 { 182 {
216 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID > 0 ) 183 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 )
217 ++v8; 184 ++v8;
218 } 185 }
219 GetAsyncKeyState(17); 186 GetAsyncKeyState(17);
220 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" 187 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy"
221 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
222 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
223 DrawTextAtStatusBar(statusbar_string, 0);
224 if ( !v8 ) 188 if ( !v8 )
225 { 189 {
226 working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//"Приходите через 14 дней" 190 working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней"
227 return; 191 return;
228 } 192 }
229 v12 = pMouse->GetCursorPos(&v51); 193 pMouse->GetCursorPos(&cursor);
230 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; 194 v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
231 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; 195 if ( v13 )
232 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
233 { 196 {
234 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C)); 197 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C));
235 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); 198 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
236 v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0); 199 v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
237 pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); 200 pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
238 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v18, 3); 201 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v18, 3);
239 return; 202 return;
240 } 203 }
241 } 204 }
242 return; 205 return;
243 } 206 }
244 if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) 207 if ( HouseUI_CheckIfPlayerCanInteract() )
245 { 208 {
246 if ( HouseUI_CheckIfPlayerCanInteract() ) 209 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
247 { 210 {
248 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) 211 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill"
249 { 212 ShowStatusBarString(pTmpBuf.data(), 2);
250 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" 213 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
251 ShowStatusBarString(pTmpBuf.data(), 2); 214 }
252 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); 215 else
253 } 216 {
254 else 217 if ( pParty->uNumGold < pPrice )
255 { 218 {
256 if ( pParty->uNumGold < pPrice ) 219 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
257 { 220 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
258 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" 221 }
259 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 222 else
260 } 223 {
261 else 224 Party::TakeGold(pPrice);
262 { 225 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
263 Party::TakeGold(pPrice); 226 }
264 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; 227 }
265 } 228 }
266 } 229 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
267 } 230 return;
268 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
269 return;
270 }
271 } 231 }
272 //----- (004BC8D5) -------------------------------------------------------- 232 //----- (004BC8D5) --------------------------------------------------------
273 void SpellBookGenerator()//for GuildDialogs 233 void SpellBookGenerator()//for GuildDialogs
274 { 234 {
275 int pItemNum; // esi@1 235 int pItemNum; // esi@1