comparison UI/UIGuilds.cpp @ 1572:19f1735fca80

Слияние
author Ritor1
date Sun, 08 Sep 2013 17:07:58 +0600
parents 5cc08e71a308 9f8b3e904e14
children e1d1fe32c194
comparison
equal deleted inserted replaced
1571:ef20d4608b1a 1572:19f1735fca80
38 int v24; // eax@39 38 int v24; // eax@39
39 int v25; // eax@40 39 int v25; // eax@40
40 int v26; // ecx@47 40 int v26; // ecx@47
41 GUIButton *pButton; // eax@49 41 GUIButton *pButton; // eax@49
42 unsigned int v29; // eax@49 42 unsigned int v29; // eax@49
43 char *pText; // eax@52
44 int pTextHeight; // eax@55 43 int pTextHeight; // eax@55
45 unsigned int v32; // ecx@55 44 unsigned int v32; // ecx@55
46 int v33; // eax@55 45 int v33; // eax@55
47 unsigned __int16 pTextColor; // ax@55 46 unsigned __int16 pTextColor; // ax@55
48 int v35; // eax@58 47 int v35; // eax@58
70 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 69 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
71 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 70 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
72 int v61; // [sp+2E0h] [bp-Ch]@35 71 int v61; // [sp+2E0h] [bp-Ch]@35
73 int pItemNum; 72 int pItemNum;
74 unsigned int v62; // [sp+2E4h] [bp-8h]@13 73 unsigned int v62; // [sp+2E4h] [bp-8h]@13
75 int v63; // [sp+2E8h] [bp-4h]@1 74 int pPrice; // [sp+2E8h] [bp-4h]@1
76 int pNumActivItem; 75 int pNumActivItem;
77 int all_text_height; 76 int all_text_height;
77 int pX;
78 78
79 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); 79 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
80 working_window.uFrameX = 483; 80 working_window.uFrameX = 483;
81 working_window.uFrameWidth = 148; 81 working_window.uFrameWidth = 148;
82 working_window.uFrameZ = 334; 82 working_window.uFrameZ = 334;
83 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); 83 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
84 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu); 84 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
85 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); 85 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
86 v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 86 pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
87 if ( v63 < base_teach_price / 3 ) 87 if ( pPrice < base_teach_price / 3 )
88 v63 = base_teach_price / 3; 88 pPrice = base_teach_price / 3;
89 strcpy(Dest, ""); 89 strcpy(Dest, "");
90 strcpy(v46, ""); 90 strcpy(v46, "");
91 strcpy(v47, ""); 91 strcpy(v47, "");
92 strcpy(v48, ""); 92 strcpy(v48, "");
93 strcpy(v49, ""); 93 strcpy(v49, "");
103 ShowStatusBarString(pTmpBuf.data(), 2); 103 ShowStatusBarString(pTmpBuf.data(), 2);
104 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 104 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
105 } 105 }
106 else 106 else
107 { 107 {
108 if ( pParty->uNumGold < v63 ) 108 if ( pParty->uNumGold < pPrice )
109 { 109 {
110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" 110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
111 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 111 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
112 } 112 }
113 else 113 else
114 { 114 {
115 Party::TakeGold(v63); 115 Party::TakeGold(pPrice);
116 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; 116 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
117 } 117 }
118 } 118 }
119 } 119 }
120 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 120 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
121 return; 121 return;
122 } 122 }
123 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 123 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
124 v6 = 0; 124 v6 = 0;
125 v62 = 0; 125 v62 = 0;
126 v63 = 32; 126 for ( pX = 32; pX < 452; pX += 70 )//
127 do 127 {
128 { 128 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID )
129 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) 129 {
130 { 130 pRenderer->DrawTextureTransparent(pX, 90, ItemsInShopTexture[v6]);
131 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
132 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); 131 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
133 } 132 }
134 v63 += 70;
135 v62 += 280; 133 v62 += 280;
136 ++v6; 134 ++v6;
137 } 135 }
138 while ( v63 < 452 );
139 v62 = 1680; 136 v62 = 1680;
140 v7 = 6; 137 v7 = 6;
141 v63 = 32; 138 for ( pX = 32; pX < 452; pX += 70 )//
142 do
143 { 139 {
144 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) 140 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
145 { 141 {
146 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); 142 pRenderer->DrawTextureTransparent(pX, 250, ItemsInShopTexture[v7]);
147 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); 143 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
148 } 144 }
149 v63 += 70;
150 v62 += 280; 145 v62 += 280;
151 ++v7; 146 ++v7;
152 } 147 }
153 while ( v63 < 452 );
154 if ( HouseUI_CheckIfPlayerCanInteract() ) 148 if ( HouseUI_CheckIfPlayerCanInteract() )
155 { 149 {
156 v8 = 0; 150 v8 = 0;
157 for ( v9 = 12; v9; --v9 ) 151 for ( v9 = 12; v9; --v9 )
158 { 152 {
159 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) 153 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID > 0 )
160 ++v8; 154 ++v8;
161 } 155 }
162 GetAsyncKeyState(17); 156 GetAsyncKeyState(17);
163 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" 157 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
164 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 158 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
165 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" 159 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
166 DrawTextAtStatusBar(statusbar_string, 0); 160 DrawTextAtStatusBar(statusbar_string, 0);
167 if ( !v8 ) 161 if ( !v8 )
168 { 162 {
169 working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], 163 working_window.DrawCurrentTime(pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//" 14 "
170 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed);
171 return; 164 return;
172 } 165 }
173 v12 = pMouse->GetCursorPos(&v51); 166 v12 = pMouse->GetCursorPos(&v51);
174 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; 167 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
175 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; 168 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
178 v14 = window_SpeakInHouse->ptr_1C; 171 v14 = window_SpeakInHouse->ptr_1C;
179 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); 172 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
180 v16 = (int)window_SpeakInHouse->ptr_1C; 173 v16 = (int)window_SpeakInHouse->ptr_1C;
181 uPlayerID = uActiveCharacter - 1; 174 uPlayerID = uActiveCharacter - 1;
182 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2); 175 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2);
183 v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); 176 v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
184 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); 177 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
185 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3); 178 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3);
186 return; 179 return;
187 } 180 }
188 } 181 }
190 } 183 }
191 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, 184 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
192 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) 185 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
193 { //you must me member 186 { //you must me member
194 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); 187 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
195 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u); 188 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3);
196 pDialogueWindow->pNumPresenceButton = 0; 189 pDialogueWindow->pNumPresenceButton = 0;
197 return; 190 return;
198 } 191 }
199 if ( !HouseUI_CheckIfPlayerCanInteract() ) 192 if ( !HouseUI_CheckIfPlayerCanInteract() )
200 return; 193 return;
243 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); 236 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
244 return; 237 return;
245 } 238 }
246 if ( pSkillFlag ) 239 if ( pSkillFlag )
247 { 240 {
248 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" 241 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
249 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); 242 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
250 } 243 }
251 v58 = (149 - all_text_height) / v61; 244 v58 = (149 - all_text_height) / v61;
252 if ( v58 > 32 ) 245 if ( v58 > 32 )
253 v58 = 32; 246 v58 = 32;
260 { 253 {
261 pButton = pDialogueWindow->GetControl(pItemNum); 254 pButton = pDialogueWindow->GetControl(pItemNum);
262 v29 = pButton->msg_param; 255 v29 = pButton->msg_param;
263 if ( v29 == 18 ) 256 if ( v29 == 18 )
264 { 257 {
265 pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
266 pButton->uY = v58 + v26; 258 pButton->uY = v58 + v26;
267 pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0); 259 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
268 v32 = pButton->uY; 260 v32 = pButton->uY;
269 pButton->uHeight = pTextHeight; 261 pButton->uHeight = pTextHeight;
270 v33 = v32 + pTextHeight - 1; 262 v33 = v32 + pTextHeight - 1;
271 pButton->uW = v33; 263 pButton->uW = v33;
272 v26 = v33; 264 v26 = v33;
273 pTextColor = pColorYellow; 265 pTextColor = pColorYellow;
274 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) 266 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
275 pTextColor = pColorWhite; 267 pTextColor = pColorWhite;
276 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3); 268 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
277 } 269 }
278 else 270 else
279 { 271 {
280 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36] 272 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36]
281 && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] ) 273 && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] )
335 pItemNum = 486; 327 pItemNum = 486;
336 } 328 }
337 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; 329 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i];
338 item_spellbook->Reset(); 330 item_spellbook->Reset();
339 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; 331 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
340 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); 332 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].IsIdentified();
341 ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); 333 ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE);
342 } 334 }
343 return; 335 return;
344 } 336 }