# HG changeset patch # User Ritor1 # Date 1380281585 -21600 # Node ID 4b0e19d91505633ed127d18ae6465163c75c57f2 # Parent 0155fb9254dd54c9530c81d22481045cac657f06 ArmorShop cleaning(continue) diff -r 0155fb9254dd -r 4b0e19d91505 UI/UIShops.cpp --- a/UI/UIShops.cpp Fri Sep 27 15:19:46 2013 +0600 +++ b/UI/UIShops.cpp Fri Sep 27 17:33:05 2013 +0600 @@ -54,7 +54,7 @@ v103 = (174 - all_text_height) / 4; v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; pNumString = 0; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { pButton = pDialogueWindow->GetControl(i); pButton->uY = v103 + v19; @@ -94,11 +94,7 @@ if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет else - { pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - pText = pGlobalTXT_LocalizationStrings[196];//Выберите особый предмет для покупки - } DrawTextAtStatusBar(pText, 0); if ( item_num ) { @@ -149,11 +145,7 @@ if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) pText = pGlobalTXT_LocalizationStrings[185]; else - { - pText = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) pText = pGlobalTXT_LocalizationStrings[196]; - } DrawTextAtStatusBar(pText, 0); if ( item_num ) { @@ -264,7 +256,7 @@ v103 = (174 - all_text_height) / 3; v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; pNumString = 0; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { pButton = pDialogueWindow->GetControl(i); pButton->uY = v103 + v19; @@ -290,7 +282,7 @@ pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( pPrice < v32 / 3 ) pPrice = v32 / 3; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] @@ -403,7 +395,7 @@ int v66; // eax@76 int v67; // edi@77 signed int v68; // ecx@81 - const char *pStatusText; // ecx@91 + const char *pText; // ecx@91 void *v72; // eax@95 POINT *v73; // esi@97 int v74; // ecx@97 @@ -458,7 +450,7 @@ POINT v133; // [sp+34h] [bp-D0h]@17 POINT v134; // [sp+3Ch] [bp-C8h]@97 POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT mouse; // [sp+4Ch] [bp-B8h]@97 POINT v137; // [sp+54h] [bp-B0h]@17 POINT v138; // [sp+5Ch] [bp-A8h]@32 POINT v139; // [sp+64h] [bp-A0h]@17 @@ -468,23 +460,19 @@ POINT v143; // [sp+84h] [bp-80h]@9 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 int v146; // [sp+E4h] [bp-20h]@24 - int pYellowColor; // [sp+E8h] [bp-1Ch]@1 - int pWhiteColor; // [sp+ECh] [bp-18h]@1 + //int pYellowColor; // [sp+E8h] [bp-1Ch]@1 + //int pWhiteColor; // [sp+ECh] [bp-18h]@1 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 + int item_x; // [sp+100h] [bp-4h]@44 int th; short text_color; int pActiveButton; - //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used - //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; - pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); - pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); switch (dialog_menu_id) { case HOUSE_DIALOGUE_MAIN: @@ -501,52 +489,44 @@ v146 = ( 174 - all_text_height ) / 4; v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; pNumString = 0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) + for (int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) { - for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) - { - pButton = pDialogueWindow->GetControl(pActiveButton); - pButton->uY = v146 + v23; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v23 = pButton->uY + pButton->uHeight - 1; - pButton->uW = v23; - pTextColor = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - } + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v146 + v23; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v23; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; } } break; + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка - textureW = 0; - v153 = 0; + item_x = 0; for ( int i = 0; i < 8; ++i )// разместить вещи { if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; if ( i >= 4 ) //low row { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; + pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); + v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; } else { - pY_item = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * pY_item; + pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); } ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); } - v153 += 105; + item_x += 105; } if ( !HouseUI_CheckIfPlayerCanInteract() ) return; @@ -557,63 +537,62 @@ ++pItemCount; } if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" else - pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" - DrawTextAtStatusBar(pStatusText, 0); - if ( pItemCount != 0 ) + pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" + DrawTextAtStatusBar(pText, 0); + if ( pItemCount ) { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) return; - pItemCount = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) - v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) + { + pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], + uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); + } else - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); + } return; } dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); return; } break; + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v11 = 0; - v61 = 0; - v153 = 0; - do + item_x = 0; + for ( int i = 0; i < 8; ++i ) { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) + if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) + //v62 = ItemsInShopTexture[i]; + if ( i >= 4 ) { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; + //v67 = 90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); + pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); + v66 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; } else { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; + //v63 = 98 - ItemsInShopTexture[i]->uTextureHeight; + //v64 = ItemsInShopTexture[i]; + //v65 = 98 - ItemsInShopTexture[i]->uTextureHeight; + //v152 = 86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); + pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v66 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[i], i + 1); } - v153 += 105; - ++v61; + item_x += 105; } - while ( v61 < 8 ); if ( !HouseUI_CheckIfPlayerCanInteract() ) return; v68 = 0; @@ -626,28 +605,27 @@ } while ( v68 < 6 ); if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" else - pStatusText = pGlobalTXT_LocalizationStrings[185]; - DrawTextAtStatusBar(pStatusText, 0); + pText = pGlobalTXT_LocalizationStrings[185]; + DrawTextAtStatusBar(pText, 0); if ( (char *)pItemCount != 0 ) { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) return; - pItemCount = v74 - 1; + pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; else v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); @@ -680,9 +658,9 @@ pButton->uHeight = pTextHeight; v86 = v90 + pTextHeight - 1; pButton->uW = v86; - pTextColor = pYellowColor; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); ++pNumString; ++pActiveButton; @@ -708,7 +686,7 @@ v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } break; @@ -738,7 +716,7 @@ } v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v6, 3); return; } } @@ -766,7 +744,7 @@ v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } break; @@ -793,10 +771,10 @@ v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v100, 3); } v104 = 0; - v153 = 0; + int v153 = 0; do { //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) @@ -842,7 +820,7 @@ pActiveButton = v38 / 3; v39 = pDialogueWindow->pStartingPosActiveItem; v40 = pDialogueWindow->pNumPresenceButton; - v153 = 0; + int v153 = 0; if ( (signed int)v39 < (signed int)(v39 + v40) ) { do @@ -889,9 +867,9 @@ v51 = v49 + pTextHeight - 1; pButton->uW = v51; v146 = v51; - pTextColor = pYellowColor; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) - pTextColor = pWhiteColor; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); } v53 = pDialogueWindow->pStartingPosActiveItem; @@ -908,7 +886,7 @@ strcat(pTmpBuf.data(), "\n \n"); strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); return; } break;