comparison mm7_1.cpp @ 526:214d9d47cf1f

Chest working, but items are not laid correctly
author Gloval
date Sun, 03 Mar 2013 01:55:57 +0400
parents 5196a51cc9ec
children f146781c5c2d
comparison
equal deleted inserted replaced
525:e7b3fa10d58d 526:214d9d47cf1f
3815 v0 = pMouse->GetCursorPos(&a2); 3815 v0 = pMouse->GetCursorPos(&a2);
3816 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; 3816 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]];
3817 if ( v1 ) 3817 if ( v1 )
3818 { 3818 {
3819 auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C 3819 auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C
3820 + 18 * *((short *)&pChests[0].mm7__vector_pItems[139].uExpireTime 3820 + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime
3821 + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); 3821 + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
3822 v2 = _w->GetDisplayName(); 3822 v2 = _w->GetDisplayName();
3823 sub_41C0B8_set_status_string(v2); 3823 sub_41C0B8_set_status_string(v2);
3824 } 3824 }
3825 } 3825 }
3826 } 3826 }
3827 3827
3828 //----- (00420B13) --------------------------------------------------------
3829 void __fastcall sub_420B13(int a1, int a2)
3830 {
3831 void *v2; // eax@1
3832 ItemGen *v3; // ebx@1
3833 unsigned int v4; // eax@1
3834 Texture *v5; // ecx@1
3835 signed int v6; // eax@1
3836 signed int v7; // edi@3
3837 signed int v8; // eax@3
3838 int v9; // edi@3
3839 int v10; // eax@5
3840 int v11; // esi@8
3841 unsigned int v12; // ecx@10
3842 void *v13; // edi@10
3843 unsigned __int8 v14; // cf@10
3844 int v15; // edi@10
3845 int i; // ecx@10
3846 int v17; // [sp+Ch] [bp-14h]@1
3847 int v18; // [sp+10h] [bp-10h]@3
3848 int v19; // [sp+14h] [bp-Ch]@1
3849 void *v20; // [sp+18h] [bp-8h]@1
3850 int v21; // [sp+1Ch] [bp-4h]@5
3851 int v22; // [sp+1Ch] [bp-4h]@8
3852
3853 v19 = a2;
3854 v2 = pChestWindow->ptr_1C;
3855 v20 = v2;
3856 v2 = (void *)(5324 * (int)v2);
3857 v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4));
3858 v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)];
3859 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
3860 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0);
3861 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24);
3862 if ( v6 < 14 )
3863 v6 = 14;
3864 v7 = v6 - 14;
3865 v8 = v5->uTextureHeight;
3866 v9 = (v7 >> 5) + 1;
3867 v18 = v9;
3868 if ( v8 < 14 )
3869 v8 = 14;
3870 v10 = ((v8 - 14) >> 5) + 1;
3871 v21 = v10;
3872 if ( !areWeLoadingTexture )
3873 {
3874 v5->Release();
3875 pIcons_LOD->_40F9C5();
3876 v10 = v21;
3877 }
3878 if ( v10 > 0 )
3879 {
3880 v11 = 0;
3881 v22 = v10;
3882 do
3883 {
3884 if ( v9 > 0 )
3885 {
3886 v12 = v9;
3887 v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20];
3888 v14 = v12 & 1;
3889 v12 >>= 1;
3890 memset(v13, 0, 4 * v12);
3891 v15 = (int)((char *)v13 + 4 * v12);
3892 for ( i = v14; i; --i )
3893 {
3894 *(short *)v15 = 0;
3895 v15 += 2;
3896 }
3897 v9 = v18;
3898 }
3899 v11 += v17;
3900 --v22;
3901 }
3902 while ( v22 );
3903 }
3904 v3->Reset();
3905 }
3906 // 506128: using guessed type int areWeLoadingTexture;
3907 3828
3908 //----- (00420C05) -------------------------------------------------------- 3829 //----- (00420C05) --------------------------------------------------------
3909 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) 3830 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
3910 { 3831 {
3911 unsigned int v2; // edi@1 3832 unsigned int v2; // edi@1
4015 } 3936 }
4016 3937
4017 //----- (00420E01) -------------------------------------------------------- 3938 //----- (00420E01) --------------------------------------------------------
4018 void __cdecl sub_420E01() 3939 void __cdecl sub_420E01()
4019 { 3940 {
4020 void *v0; // edi@1 3941 int chest_id; // edi@1
4021 POINT *v1; // esi@2 3942 POINT *v1; // esi@2
4022 int v2; // eax@2 3943 int v2; // eax@2
4023 int v3; // ebx@4 3944 int v3; // ebx@4
4024 int v4; // esi@6 3945 int v4; // esi@6
4025 int v5; // ecx@6 3946 int v5; // ecx@6
4026 //SpriteObject v6; // [sp+Ch] [bp-80h]@1 3947 //SpriteObject v6; // [sp+Ch] [bp-80h]@1
4027 char v7; // [sp+7Ch] [bp-10h]@2 3948 POINT v7; // [sp+7Ch] [bp-10h]@2
4028 POINT a2; // [sp+84h] [bp-8h]@2 3949 POINT a2; // [sp+84h] [bp-8h]@2
4029 3950
4030 SpriteObject v6; // [sp+Ch] [bp-80h]@1 3951 SpriteObject v6; // [sp+Ch] [bp-80h]@1
4031 //SpriteObject::SpriteObject(&v6); 3952 //SpriteObject::SpriteObject(&v6);
4032 3953
4033 v0 = pGUIWindow_CurrentMenu->ptr_1C; 3954 chest_id = pGUIWindow_CurrentMenu->par1C;
4034 if ( pParty->pPickedItem.uItemID ) 3955 if ( pParty->pPickedItem.uItemID )
4035 { 3956 {
4036 if ( Chest::_41FFA2(-1, &pParty->pPickedItem, (unsigned int)pGUIWindow_CurrentMenu->ptr_1C) ) 3957 if ( Chest::PutItemInChest(-1, &pParty->pPickedItem, pGUIWindow_CurrentMenu->par1C) )
4037 pMouse->RemoveHoldingItem(); 3958 pMouse->RemoveHoldingItem();
4038 } 3959 }
4039 else 3960 else
4040 { 3961 {
4041 v1 = pMouse->GetCursorPos(&a2); 3962 v1 = pMouse->GetCursorPos(&a2);
4044 { 3965 {
4045 if ( v2 ) 3966 if ( v2 )
4046 v3 = v2 - 1; 3967 v3 = v2 - 1;
4047 else 3968 else
4048 v3 = -1; 3969 v3 = -1;
4049 v4 = pChests[0].pInventoryIndices[v3 + 2662 * (int)v0] - 1; 3970 v4 = pChests[chest_id].pInventoryIndices[v3] - 1;
4050 v5 = 5324 * (int)v0 + 36 * v4; 3971 if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == 18 )
4051 if ( pItemsTable->pItems[*(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v5)].uEquipType == 18 ) 3972 {
4052 { 3973 party_finds_gold(pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uValue, 0); //recheck
4053 party_finds_gold(*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uSpecEnchantmentType + v5), 0);
4054 viewparams->bRedrawGameUI = 1; 3974 viewparams->bRedrawGameUI = 1;
4055 } 3975 }
4056 else 3976 else
4057 { 3977 {
4058 pParty->SetHoldingItem((ItemGen *)((char *)pChests[0].mm7__vector_pItems + v5)); 3978 pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]);
4059 } 3979 }
4060 sub_420B13(v4, v3); 3980 sub_420B13(v4, v3);
4061 } 3981 }
4062 } 3982 }
4063 } 3983 }
5466 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-c", 2); 5386 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-c", 2);
5467 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); 5387 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
5468 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); 5388 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
5469 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); 5389 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
5470 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); 5390 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
5471 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-c", 2); 5391 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
5472 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); 5392 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
5473 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); 5393 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2);
5474 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); 5394 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
5475 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); 5395 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
5476 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); 5396 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
5502 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); 5422 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
5503 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); 5423 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
5504 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); 5424 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE);
5505 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); 5425 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE);
5506 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); 5426 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE);
5507 uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); 5427 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE);
5508 dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); 5428 dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE);
5509 dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); 5429 dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE);
5510 dword_507964 = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); 5430 dword_507964 = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
5511 dword_507960 = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); 5431 dword_507960 = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
5512 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); 5432 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
5551 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-a", 2); 5471 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-a", 2);
5552 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); 5472 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
5553 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); 5473 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
5554 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); 5474 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
5555 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); 5475 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
5556 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-a", 2); 5476 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
5557 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); 5477 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
5558 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2); 5478 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2);
5559 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); 5479 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
5560 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); 5480 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
5561 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); 5481 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
5587 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); 5507 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
5588 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); 5508 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
5589 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); 5509 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
5590 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); 5510 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
5591 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); 5511 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
5592 uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); 5512 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
5593 dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); 5513 dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
5594 dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); 5514 dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE);
5595 dword_507964 = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); 5515 dword_507964 = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
5596 dword_507960 = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); 5516 dword_507960 = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
5597 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); 5517 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
5647 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-b", 2); 5567 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-b", 2);
5648 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); 5568 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB");
5649 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); 5569 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
5650 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); 5570 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB");
5651 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); 5571 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
5652 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-b", 2); 5572 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2);
5653 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); 5573 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2);
5654 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2); 5574 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2);
5655 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); 5575 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
5656 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); 5576 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2);
5657 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2); 5577 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);