Mercurial > mm7
diff Engine/Party.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
line wrap: on
line diff
--- a/Engine/Party.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Party.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -37,6 +37,29 @@ +struct +{ + struct UIAnimation _pUIAnim_Food; + struct UIAnimation _pUIAnim_Gold; + struct UIAnimation _pUIAnum_Torchlight; + struct UIAnimation _pUIAnim_WizardEye; +} _uianim; + +struct UIAnimation *pUIAnim_Food = &_uianim._pUIAnim_Food; +struct UIAnimation *pUIAnim_Gold = &_uianim._pUIAnim_Gold; +struct UIAnimation *pUIAnum_Torchlight = &_uianim._pUIAnum_Torchlight; +struct UIAnimation *pUIAnim_WizardEye = &_uianim._pUIAnim_WizardEye; + +std::array<struct UIAnimation *, 4> pUIAnims = +{ + &_uianim._pUIAnim_Food, + &_uianim._pUIAnim_Gold, + &_uianim._pUIAnum_Torchlight, + &_uianim._pUIAnim_WizardEye +}; + + + //----- (0044A56A) -------------------------------------------------------- void Party::CountHirelings() { @@ -218,7 +241,7 @@ { pUIAnim_Food->uAnimTime = 0; pParty->uNumFoodRations = uNumFood; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B03) -------------------------------------------------------- @@ -230,7 +253,7 @@ pParty->uNumFoodRations -= uNumFood; pUIAnim_Food->uAnimTime = 0; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B42) -------------------------------------------------------- @@ -238,7 +261,7 @@ { pParty->uNumFoodRations += _this; pUIAnim_Food->uAnimTime = 0; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B70) -------------------------------------------------------- @@ -246,7 +269,7 @@ { pParty->uNumGold = uNumGold; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); } @@ -258,7 +281,7 @@ else pParty->uNumGold = 0; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); } @@ -1015,7 +1038,7 @@ } this->uNumGold += goldToGain - hirelingSalaries; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2.data(), 2u); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); @@ -1023,24 +1046,26 @@ //----- (00421B2C) -------------------------------------------------------- void Party::sub_421B2C_PlaceInInventory_or_DropPickedItem() { - unsigned int v0; // eax@2 - Texture_MM7 *v1; // ebx@2 + //unsigned int v0; // eax@2 + //Texture_MM7 *v1; // ebx@2 int v2; // eax@3 int v4; // eax@6 unsigned __int16 v5; // dx@11 signed int v6; // eax@11 __int16 v8; // ax@16 SpriteObject a1; // [sp+4h] [bp-78h]@11 - int v11; // [sp+74h] [bp-8h]@2 + //int v11; // [sp+74h] [bp-8h]@2 int v12; // [sp+78h] [bp-4h]@5 if ( !pParty->pPickedItem.uItemID ) return; - v0 = pIcons_LOD->LoadTexture( - pParty->pPickedItem.GetIconName(), - TEXTURE_16BIT_PALETTE); - v1 = pIcons_LOD->GetTexture(v0); - v11 = areWeLoadingTexture; + + auto texture = assets->GetImage_16BitColorKey(pParty->pPickedItem.GetIconName(), 0x7FF); + //v0 = pIcons_LOD->LoadTexture( + // pParty->pPickedItem.GetIconName(), + // TEXTURE_16BIT_PALETTE); + //v1 = pIcons_LOD->GetTexture(v0); + //v11 = areWeLoadingTexture; if ( uActiveCharacter && (v2 = ::pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) { @@ -1091,12 +1116,12 @@ pMouse->RemoveHoldingItem(); } } - if ( !v11 ) + + if (texture) { - v1->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } - return; } @@ -1105,11 +1130,11 @@ { unsigned int v2; // eax@1 char *v5; // eax@8 - Texture_MM7 *v7; // ebx@10 + //Texture_MM7 *v7; // ebx@10 signed int v8; // esi@10 Player *v9; // edi@11 int v10; // eax@11 - int v21; // [sp+24h] [bp-4h]@10 + //int v21; // [sp+24h] [bp-4h]@10 v2 = pItem->uItemID; if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) @@ -1118,8 +1143,9 @@ v5 = pItemsTable->pItems[v2].pIconName; if ( v5 ) { - v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); - v21 = areWeLoadingTexture; + auto texture = assets->GetImage_16BitColorKey(v5, 0x7FF); + //v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); + //v21 = areWeLoadingTexture; v8 = 0; uint current_player = uActiveCharacter; for (int i = 0; i < 4; i++) @@ -1135,28 +1161,28 @@ pItem->Reset(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); v9->PlaySound(SPEECH_60, 0); - if ( !v21 ) + + if (texture) { - v7->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } return true; } } - if ( !v21 ) + if (texture) { - v7->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } - return false; } else { MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); - return false; } + return false; } -// 506128: using guessed type int areWeLoadingTexture; + bool Party::IsPartyEvil() {