Mercurial > mm7
diff mm7_4.cpp @ 909:becbb0b11b7d
Слияние
author | Ritor1 |
---|---|
date | Mon, 22 Apr 2013 09:25:22 +0600 |
parents | e2c1cb9b46f6 f3ccfc765502 |
children | 897b10712a1a |
line wrap: on
line diff
--- a/mm7_4.cpp Mon Apr 22 09:25:05 2013 +0600 +++ b/mm7_4.cpp Mon Apr 22 09:25:22 2013 +0600 @@ -6265,11 +6265,9 @@ } // F8B1E0: using guessed type int dword_F8B1E0; -//view item details in shop? //----- (004B1A2D) -------------------------------------------------------- -void __cdecl sub_4B1A2D() +void __cdecl ShowPopupShopItem() { - //Player *v0; // edi@1 POINT *v1; // esi@5 unsigned int v2; // eax@5 int v3; // ecx@5 @@ -6287,9 +6285,7 @@ POINT v15; // [sp+30h] [bp-1Ch]@17 POINT v16; // [sp+38h] [bp-14h]@5 POINT a2; // [sp+40h] [bp-Ch]@5 - int v18; // [sp+48h] [bp-4h]@5 - - //v0 = pPlayers[uActiveCharacter]; + if ( in_current_building_type <= 0 ) return; if ( in_current_building_type <= BildingType_AlchemistShop ) @@ -6301,14 +6297,12 @@ if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) { v8 = pMouse->GetCursorPos(&v15)->x - 14; - v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); + v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); if ( pMouse->GetCursorPos(&v13)->x <= 13 || pMouse->GetCursorPos(&v12)->x >= 462 - || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) + || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) return; - v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; -LABEL_15: - GameUI_DrawItemInfo(v7); + GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); return; } if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) @@ -6316,23 +6310,22 @@ } v4 = pMouse->GetCursorPos(&v11); v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; - v18 = v5; if ( !v5 ) return; v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; - v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; - goto LABEL_15; + v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; + GameUI_DrawItemInfo(v7); + return; } if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) { v1 = pMouse->GetCursorPos(&a2); v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; - v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; - if ( v18 ) + v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; + if ( v5 ) sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); } } @@ -6406,7 +6399,6 @@ return; } v1 = (unsigned int)window_SpeakInHouse->ptr_1C; -LABEL_28: PlayHouseSound(v1, (HouseSoundID)v0); return; } @@ -6418,7 +6410,8 @@ if ( !dword_F8B1E4 ) return; v0 = 4; - goto LABEL_28; + PlayHouseSound(v1, (HouseSoundID)v0); + return; } PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); if ( !dword_F8B1E4 && !qword_A750D8 ) @@ -6437,7 +6430,8 @@ qword_A750D8 = 256i64; word_A750E0 = 80; v4 = LOWORD(v7[rand() % v5]); - goto LABEL_16; + word_A750E2 = v4; + return; } } } @@ -6459,7 +6453,6 @@ qword_A750D8 = 256i64; word_A750E0 = 80; v4 = LOWORD(v7[rand() % v2]); -LABEL_16: word_A750E2 = v4; return; } @@ -8243,12 +8236,8 @@ } //----- (004BDAAF) -------------------------------------------------------- -bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) +bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) { - int v2; // edx@1 - unsigned int v3; // esi@1 - unsigned int v4; // eax@1 - signed int v5; // edi@1 int v6; // edx@8 int v7; // edx@9 int v8; // edx@10 @@ -8257,45 +8246,39 @@ unsigned __int8 v11; // of@16 bool test; - auto a2 = _2da_idx; - //v2 = p2DEvents_minus1___00[26 * a2]; - v2 = p2DEvents[a2 - 1].uType; - v3 = a1->uItemID; - v4 = a1->uItemID; - v5 = pItemsTable->pItems[v4].uEquipType; - if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) - && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) + if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) + && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) return 0; - switch( p2DEvents[a2 - 1].uType ) - { - case BildingType_WeaponShop: - { - test = v5 <= 2; - break; - } - case BildingType_ArmorShop: - { - test = v5 >= 3; - break; - } - case BildingType_MagicShop: - { - test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; - break; - } - case BildingType_AlchemistShop: - { - __debugbreak(); // need to test - test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); - break; - } - default: - { - test = 0; - break; - } - } - + switch( p2DEvents[_2da_idx - 1].uType ) + { + case BildingType_WeaponShop: + { + test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; + break; + } + case BildingType_ArmorShop: + { + test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; + break; + } + case BildingType_MagicShop: + { + test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; + break; + } + case BildingType_AlchemistShop: + { + test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 + || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 + || (signed int)item->uItemID < 740) && item->uItemID != 771); + break; + } + default: + { + test = false; + break; + } + } return test; /* if ( p2DEvents[a2 - 1].uType == 1 )