comparison mm7_2.cpp @ 749:f39fbeb65b28

Fixed bought items not disappearing from Armourer.
author Nomad
date Fri, 22 Mar 2013 23:26:01 +0200
parents daecb0225226
children e13ce1b0930d
comparison
equal deleted inserted replaced
748:daecb0225226 749:f39fbeb65b28
887 //v55 = a1; 887 //v55 = a1;
888 if ( !pDialogueWindow->pNumPresenceButton ) 888 if ( !pDialogueWindow->pNumPresenceButton )
889 return; 889 return;
890 pRenderer->ClearZBuffer(0, 479); 890 pRenderer->ClearZBuffer(0, 479);
891 //v3 = dword_F8B198; 891 //v3 = dword_F8B198;
892 if ( dialog_menu_id != 1 ) 892 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
893 { 893 {
894 v8 = window_SpeakInHouse; 894 v8 = window_SpeakInHouse;
895 } 895 }
896 //else 896 //else
897 if ( dialog_menu_id == 1 ) 897 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
898 { 898 {
899 if ( in_current_building_type == BildingType_Training ) 899 if ( in_current_building_type == BildingType_Training )
900 { 900 {
901 if ( uMessageParam == 17 ) 901 if ( uMessageParam == 17 )
902 { 902 {
1916 activeLevelDecoration = NULL; 1916 activeLevelDecoration = NULL;
1917 ptr_F8B1E8 = 0; 1917 ptr_F8B1E8 = 0;
1918 if ( pDialogueNPCCount ) 1918 if ( pDialogueNPCCount )
1919 { 1919 {
1920 v0 = dialog_menu_id; 1920 v0 = dialog_menu_id;
1921 if ( dialog_menu_id != 2 1921 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
1922 && dialog_menu_id != 3 1922 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
1923 && dialog_menu_id != 97 1923 && dialog_menu_id != HOUSE_DIALOGUE_97
1924 && dialog_menu_id != 5 1924 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR
1925 && dialog_menu_id != 4 1925 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY
1926 && ShopTexture ) 1926 && ShopTexture )
1927 { 1927 {
1928 ShopTexture->Release(); 1928 ShopTexture->Release();
1929 v0 = dialog_menu_id; 1929 v0 = dialog_menu_id;
1930 ShopTexture = 0; 1930 ShopTexture = 0;
2037 POINT *v28; // esi@49 2037 POINT *v28; // esi@49
2038 int v29; // ecx@49 2038 int v29; // ecx@49
2039 void *v30; // eax@50 2039 void *v30; // eax@50
2040 int v31; // ecx@50 2040 int v31; // ecx@50
2041 ItemGen *v32; // esi@51 2041 ItemGen *v32; // esi@51
2042 float v33; // ST1C_4@53 2042 //float v33; // ST1C_4@53
2043 signed int v34; // eax@53 2043 //signed int v34; // eax@53
2044 int v35; // eax@53 2044 //int v35; // eax@53
2045 bool v36; // eax@53 2045 //bool v36; // eax@53
2046 unsigned int v37; // eax@53 2046 unsigned int v37; // eax@53
2047 int v38; // eax@55 2047 int v38; // eax@55
2048 int v39; // eax@63 2048 int v39; // eax@63
2049 int v40; // eax@64 2049 //int v40; // eax@64
2050 int v41; // edx@66 2050 int v41; // edx@66
2051 int v42; // esi@74 2051 int v42; // esi@74
2052 signed int v43; // ebx@74 2052 signed int v43; // ebx@74
2053 int v44; // ecx@74 2053 int v44; // ecx@74
2054 unsigned __int16 *pSkill; // esi@77 2054 unsigned __int16 *pSkill; // esi@77
2061 unsigned int v52; // [sp-4h] [bp-B8h]@36 2061 unsigned int v52; // [sp-4h] [bp-B8h]@36
2062 int v53; // [sp+0h] [bp-B4h]@16 2062 int v53; // [sp+0h] [bp-B4h]@16
2063 unsigned int v54; // [sp+0h] [bp-B4h]@25 2063 unsigned int v54; // [sp+0h] [bp-B4h]@25
2064 int v55; // [sp+0h] [bp-B4h]@26 2064 int v55; // [sp+0h] [bp-B4h]@26
2065 int v56; // [sp+0h] [bp-B4h]@36 2065 int v56; // [sp+0h] [bp-B4h]@36
2066 POINT v57; // [sp+10h] [bp-A4h]@49 2066 //POINT v57; // [sp+10h] [bp-A4h]@49
2067 //POINT v58; // [sp+18h] [bp-9Ch]@18 2067 //POINT v58; // [sp+18h] [bp-9Ch]@18
2068 POINT v59; // [sp+20h] [bp-94h]@49 2068 POINT v59; // [sp+20h] [bp-94h]@49
2069 POINT v60; // [sp+28h] [bp-8Ch]@9 2069 POINT v60; // [sp+28h] [bp-8Ch]@9
2070 POINT v61; // [sp+30h] [bp-84h]@37 2070 POINT v61; // [sp+30h] [bp-84h]@37
2071 POINT v62; // [sp+38h] [bp-7Ch]@18 2071 POINT v62; // [sp+38h] [bp-7Ch]@18
2077 POINT a2; // [sp+68h] [bp-4Ch]@9 2077 POINT a2; // [sp+68h] [bp-4Ch]@9
2078 POINT v69; // [sp+70h] [bp-44h]@31 2078 POINT v69; // [sp+70h] [bp-44h]@31
2079 POINT v70; // [sp+78h] [bp-3Ch]@9 2079 POINT v70; // [sp+78h] [bp-3Ch]@9
2080 POINT v71; // [sp+80h] [bp-34h]@31 2080 POINT v71; // [sp+80h] [bp-34h]@31
2081 POINT v72; // [sp+88h] [bp-2Ch]@10 2081 POINT v72; // [sp+88h] [bp-2Ch]@10
2082 bool v73; // [sp+90h] [bp-24h]@53 2082 //bool v73; // [sp+90h] [bp-24h]@53
2083 int v74; // [sp+94h] [bp-20h]@53 2083 int v74; // [sp+94h] [bp-20h]@53
2084 int a6; // [sp+98h] [bp-1Ch]@57 2084 int a6; // [sp+98h] [bp-1Ch]@57
2085 int a3; // [sp+9Ch] [bp-18h]@53 2085 int a3; // [sp+9Ch] [bp-18h]@53
2086 Player *v77; // [sp+A0h] [bp-14h]@1 2086 Player *v77; // [sp+A0h] [bp-14h]@1
2087 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 2087 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
2127 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19)); 2127 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19));
2128 //v21 = p2DEvents_minus1__20[13 * (signed int)v19]; 2128 //v21 = p2DEvents_minus1__20[13 * (signed int)v19];
2129 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier; 2129 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
2130 _this = v20; 2130 _this = v20;
2131 v22 = v20->GetValue(); 2131 v22 = v20->GetValue();
2132 v23 = v0->_4B8142(v22, v21); 2132 v23 = v0->GetBuyingPrice(v22, v21);
2133 v80 = v23; 2133 v80 = v23;
2134 GetAsyncKeyState(VK_CONTROL); 2134 GetAsyncKeyState(VK_CONTROL);
2135 if ( pParty->uNumGold < v23 ) 2135 if ( pParty->uNumGold < v23 )
2136 { 2136 {
2137 v24 = 2; 2137 v24 = 2;
2325 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: 2325 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
2326 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: 2326 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
2327 { 2327 {
2328 //LABEL_49: 2328 //LABEL_49:
2329 v28 = pMouse->GetCursorPos(&v59); 2329 v28 = pMouse->GetCursorPos(&v59);
2330 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; 2330 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[v28->y]] & 0xFFFF;
2331 if ( !v29 ) 2331 if ( !v29 )
2332 return; 2332 return;
2333 v30 = window_SpeakInHouse->ptr_1C; 2333 v30 = window_SpeakInHouse->ptr_1C;
2334 // v31 = 9 * (v29 - 1 + 12 * (int)v30); 2334 // v31 = 9 * (v29 - 1 + 12 * (int)v30);
2335 if ( dialog_menu_id == 2 ) 2335 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
2336 { 2336 {
2337 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; 2337 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
2338 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; 2338 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
2339 } 2339 }
2340 else 2340 else
2341 { 2341 {
2342 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; 2342 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
2343 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; 2343 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
2344 } 2344 }
2345 //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; 2345 //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
2346 v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; 2346 //v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
2347 v34 = v32->GetValue(); 2347 //v34 = v32->GetValue();
2348 v80 = v0->_4B8142(v34, v33); 2348 v80 = v0->GetBuyingPrice(v32->GetValue(), p2DEvents[(unsigned int)v30 - 1].fPriceMultiplier);
2349 LOWORD(v35) = GetAsyncKeyState(VK_CONTROL); 2349 //LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
2350 v74 = v35; 2350 v74 = GetAsyncKeyState(VK_CONTROL);
2351 v36 = v0->CanSteal(); 2351 //v36 = v0->CanSteal();
2352 uNumSeconds = 0; 2352 uNumSeconds = 0;
2353 a3 = 0; 2353 a3 = 0;
2354 v73 = v36; 2354 //v73 = v0->CanSteal();
2355 v37 = pMapStats->GetMapInfo(pCurrentMapName); 2355 v37 = pMapStats->GetMapInfo(pCurrentMapName);
2356 if ( v37 ) 2356 if ( v37 )
2357 a3 = pMapStats->pInfos[v37]._steal_perm; 2357 a3 = pMapStats->pInfos[v37]._steal_perm;
2358 v38 = GetPartyReputation(); 2358 v38 = GetPartyReputation();
2359 v26 = 1; 2359 v26 = 1;
2360 if ( v73 == 1 ) 2360 if (v0->CanSteal())
2361 { 2361 {
2362 if ( (short)v74 ) 2362 if ( v74 )
2363 { 2363 {
2364 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6); 2364 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6);
2365 if ( !uNumSeconds ) 2365 if ( !uNumSeconds )
2366 { 2366 {
2367 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); 2367 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
2375 if ( uNumSeconds != 2 ) 2375 if ( uNumSeconds != 2 )
2376 { 2376 {
2377 if ( uNumSeconds != 1 ) 2377 if ( uNumSeconds != 1 )
2378 { 2378 {
2379 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24); 2379 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24);
2380 v9 = pGlobalTXT_LocalizationStrings[155]; 2380 v9 = pGlobalTXT_LocalizationStrings[155]; // "You don't have enough gold"
2381 v54 = 2; 2381 v54 = 2;
2382 ShowStatusBarString(v9, v54); 2382 ShowStatusBarString(v9, v54);
2383 return; 2383 return;
2384 } 2384 }
2385 } 2385 }
2386 } 2386 }
2387 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); 2387 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
2388 if ( v39 ) 2388 if ( v39 )
2389 { 2389 {
2390 v32->SetIdentified(); 2390 v32->SetIdentified();
2391 v7 = v73 == 1; 2391 v7 = v0->CanSteal();
2392 v40 = (int)((char *)v0 + 36 * v39); 2392 //v40 = (int)((char *)v0 + 36 * v39);
2393 memcpy((void *)(v40 + 496), v32, 0x24u); 2393 //memcpy((void *)(v40 + 496), v32, 0x24u);
2394 memcpy(&v0->pInventoryItems[v39 - 1], v32, sizeof(ItemGen));
2394 if ( v7 ) 2395 if ( v7 )
2395 { 2396 {
2396 if ( (short)v74 ) 2397 if ( v74 )
2397 { 2398 {
2398 v41 = uNumSeconds; 2399 v41 = uNumSeconds;
2399 if ( uNumSeconds == 1 || uNumSeconds == 2 ) 2400 if ( uNumSeconds == 1 || uNumSeconds == 2 )
2400 { 2401 {
2401 *(char *)(v40 + 517) |= 1u; 2402 //*(char *)(v40 + 517) |= 1u;
2403 v0->pInventoryItems[v39 - 1].SetStolen();
2402 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); 2404 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
2403 viewparams->bRedrawGameUI = v26; 2405 viewparams->bRedrawGameUI = v26;
2404 _this->Reset(); 2406 _this->Reset();
2405 pRenderer->ClearZBuffer(0, 479); 2407 pRenderer->ClearZBuffer(0, 479);
2406 v27 = v77; 2408 v27 = v77;