comparison UI/UIShops.cpp @ 1754:421c29d4ab3e

UITransition.cpp cleaning(continue)
author Ritor1
date Mon, 30 Sep 2013 17:29:27 +0600
parents 999bf8c99514
children 24e756a50073
comparison
equal deleted inserted replaced
1753:999bf8c99514 1754:421c29d4ab3e
1486 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); 1486 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
1487 return; 1487 return;
1488 } 1488 }
1489 if ( !HouseUI_CheckIfPlayerCanInteract() ) 1489 if ( !HouseUI_CheckIfPlayerCanInteract() )
1490 { 1490 {
1491 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 1491 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1492 return; 1492 return;
1493 } 1493 }
1494 1494
1495 switch(dialog_menu_id) 1495 switch(dialog_menu_id)
1496 { 1496 {
1500 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); 1500 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
1501 break; 1501 break;
1502 } 1502 }
1503 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: 1503 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
1504 { 1504 {
1505 pCursorPos = pMouse->GetCursorPos(&cursor); 1505 pMouse->GetCursorPos(&cursor);
1506 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; 1506 v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
1507 if ( !v18 ) 1507 if ( !v18 )
1508 return; 1508 return;
1509 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); 1509 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
1510 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 1510 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1511 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); 1511 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier);
1548 pRenderer->ClearZBuffer(0, 479); 1548 pRenderer->ClearZBuffer(0, 479);
1549 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); 1549 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
1550 return; 1550 return;
1551 } 1551 }
1552 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); 1552 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
1553 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 1553 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1554 break; 1554 break;
1555 } 1555 }
1556 case HOUSE_DIALOGUE_SHOP_IDENTIFY: 1556 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
1557 { 1557 {
1558 pMouse->GetCursorPos(&cursor); 1558 pMouse->GetCursorPos(&cursor);
1578 return; 1578 return;
1579 } 1579 }
1580 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); 1580 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1581 return; 1581 return;
1582 } 1582 }
1583 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 1583 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1584 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); 1584 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1585 return; 1585 return;
1586 } 1586 }
1587 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); 1587 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1588 return; 1588 return;
1620 return; 1620 return;
1621 } 1621 }
1622 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); 1622 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1623 return; 1623 return;
1624 } 1624 }
1625 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 1625 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1626 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); 1626 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1627 return; 1627 return;
1628 } 1628 }
1629 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); 1629 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1630 return; 1630 return;
1641 if ( !v18 ) 1641 if ( !v18 )
1642 return; 1642 return;
1643 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1643 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1644 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; 1644 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
1645 else 1645 else
1646 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; 1646 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
1647 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); 1647 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1648 uNumSeconds = 0; 1648 uNumSeconds = 0;
1649 a3 = 0; 1649 a3 = 0;
1650 if ( pMapStats->GetMapInfo(pCurrentMapName) ) 1650 if ( pMapStats->GetMapInfo(pCurrentMapName) )
1651 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; 1651 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
1746 } 1746 }
1747 } 1747 }
1748 //----- (004B1A2D) -------------------------------------------------------- 1748 //----- (004B1A2D) --------------------------------------------------------
1749 void ShowPopupShopItem() 1749 void ShowPopupShopItem()
1750 { 1750 {
1751 POINT *v1; // esi@5
1752 unsigned int v2; // eax@5
1753 int v3; // ecx@5 1751 int v3; // ecx@5
1754 POINT *v4; // esi@12
1755 int v5; // eax@12
1756 unsigned int v6; // eax@13 1752 unsigned int v6; // eax@13
1757 ItemGen *v7; // ecx@13 1753 ItemGen *v7; // ecx@13
1758 signed int v8; // esi@17 1754 POINT cursor; // [sp+30h] [bp-1Ch]@17
1759 unsigned int v9; // eax@19
1760 POINT v10; // [sp+8h] [bp-44h]@12
1761 POINT v11; // [sp+10h] [bp-3Ch]@12
1762 POINT v12; // [sp+18h] [bp-34h]@18
1763 POINT v13; // [sp+20h] [bp-2Ch]@17
1764 POINT v14; // [sp+28h] [bp-24h]@17
1765 POINT v15; // [sp+30h] [bp-1Ch]@17
1766 POINT v16; // [sp+38h] [bp-14h]@5
1767 POINT a2; // [sp+40h] [bp-Ch]@5
1768 1755
1769 if ( in_current_building_type <= 0 ) 1756 if ( in_current_building_type <= 0 )
1757 return;
1758 if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1770 return; 1759 return;
1771 if ( in_current_building_type <= BuildingType_AlchemistShop ) 1760 if ( in_current_building_type <= BuildingType_AlchemistShop )
1772 { 1761 {
1773 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1762 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
1774 { 1763 {
1775 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1764 pMouse->GetCursorPos(&cursor);
1776 return; 1765 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
1777 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) 1766 if ( !v3 )
1778 { 1767 return;
1779 v8 = pMouse->GetCursorPos(&v15)->x - 14; 1768 v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
1780 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); 1769 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
1781 if ( pMouse->GetCursorPos(&v13)->x <= 13 1770 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
1782 || pMouse->GetCursorPos(&v12)->x >= 462 1771 GameUI_DrawItemInfo(v7);
1783 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) 1772 return;
1784 return; 1773 }
1785 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[v9 - 1]); 1774
1786 return; 1775 if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR
1787 } 1776 || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
1788 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) 1777 {
1789 return; 1778 pMouse->GetCursorPos(&cursor);
1790 } 1779 v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
1791 v4 = pMouse->GetCursorPos(&v11); 1780 if ( cursor.x <= 13 || cursor.x >= 462
1792 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; 1781 || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) )
1793 if ( !v5 ) 1782 return;
1794 return; 1783 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]);
1795 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); 1784 return;
1796 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); 1785 }
1797 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1798 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1];
1799 GameUI_DrawItemInfo(v7);
1800 return;
1801 } 1786 }
1802 if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) 1787 if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
1803 { 1788 {
1804 v1 = pMouse->GetCursorPos(&a2); 1789 pMouse->GetCursorPos(&cursor);
1805 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; 1790 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
1806 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; 1791 if ( v3 )
1807 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
1808 if ( v5 )
1809 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); 1792 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
1810 } 1793 }
1811 } 1794 }
1812 //----- (004B1D27) -------------------------------------------------------- 1795 //----- (004B1D27) --------------------------------------------------------
1813 void GetHouseGoodbyeSpeech() 1796 void GetHouseGoodbyeSpeech()