Mercurial > mm7
changeset 1967:05787232b571
Actor::LootActor cleaned up, fixed item looting not working
author | Grumpy7 |
---|---|
date | Fri, 25 Oct 2013 23:09:04 -0700 |
parents | 7840fe323f67 |
children | 7d2c5fa98584 |
files | Actor.cpp |
diffstat | 1 files changed, 25 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri Oct 25 13:03:08 2013 -0700 +++ b/Actor.cpp Fri Oct 25 23:09:04 2013 -0700 @@ -3830,7 +3830,7 @@ { if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { - v33 = byte_4D864C && pGame->uFlags & 80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; + v33 = byte_4D864C && pGame->uFlags & 0x80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0); } } @@ -4128,40 +4128,33 @@ unsigned int v5; // esi@13 int v6; // eax@14 unsigned __int8 v7; // al@30 - Party *v8; // esi@34 char *v9; // [sp-4h] [bp-3Ch]@10 char *v10; // [sp-4h] [bp-3Ch]@31 char *v11; // [sp-4h] [bp-3Ch]@38 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 - int v13; // [sp+30h] [bp-8h]@1 + bool itemFound; // [sp+30h] [bp-8h]@1 int v14; // [sp+34h] [bp-4h]@1 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); Dst.Reset(); v2 = 0; - v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes) == 0; - v13 = 0; + itemFound = false; v14 = 0; - if ( v3 ) + if ( !( this->uAttributes & 0x800000 ) ) { - if ( this->pMonsterInfo.uTreasureDiceRolls ) + for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ ) { - do - { - ++v2; v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; } - while ( v2 < this->pMonsterInfo.uTreasureDiceRolls ); - if ( v14 ) + if ( v14 != 0 ) { pParty->PartyFindsGold(v14, 0); viewparams->bRedrawGameUI = 1; } } - } else { - if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == 18 ) + if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == EQUIP_GOLD ) { v14 = this->array_000234[3].uSpecEnchantmentType; this->array_000234[3].Reset(); @@ -4182,17 +4175,12 @@ else sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9); ShowStatusBarString(pTmpBuf2.data(), 2u); - v4 = Dst.uItemID; - v5 = Dst.uItemID; if ( Dst.GetItemEquipType() == 12 ) { - v5 = Dst.uItemID; - v6 = rand() % 6 + Dst.GetDamageMod() + 1; - Dst.uNumCharges = v6; - Dst.uMaxCharges = v6; - v4 = Dst.uItemID; + Dst.uNumCharges = rand() % 6 + Dst.GetDamageMod() + 1; + Dst.uMaxCharges = Dst.uNumCharges; } - if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) + if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 14 && Dst.uItemID != 220 ) Dst.uEnchantmentType = 2 * rand() % 4 + 2; pItemsTable->SetSpecialBonus(&Dst); if ( !pParty->AddItemToParty(&Dst) ) @@ -4219,7 +4207,7 @@ this->Remove(); return; } - if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes ) + if ( ( this->uAttributes & 0x800000 ) ) { if ( this->array_000234[3].uItemID ) { @@ -4233,16 +4221,13 @@ ShowStatusBarString(pTmpBuf2.data(), 2u); if ( !pParty->AddItemToParty(&Dst) ) pParty->SetHoldingItem(&Dst); - v13 = 1; + itemFound = true; } - v8 = pParty; - goto LABEL_45; } - if ( rand() % 100 >= this->pMonsterInfo.uTreasureDropChance || (v7 = this->pMonsterInfo.uTreasureLevel) == 0 ) + else { - v8 = pParty; - goto LABEL_45; - } + if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance && (v7 = this->pMonsterInfo.uTreasureLevel) != 0 ) + { pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst); v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; if ( v14 ) @@ -4250,32 +4235,32 @@ else sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]! ShowStatusBarString(pTmpBuf2.data(), 2); - v8 = pParty; if ( !pParty->AddItemToParty(&Dst) ) pParty->SetHoldingItem(&Dst); - v13 = 1; -LABEL_45: + itemFound = true; + } + } if ( this->array_000234[0].uItemID ) { - if ( !v8->AddItemToParty(this->array_000234) ) + if ( !pParty->AddItemToParty(this->array_000234) ) { pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); - v8->SetHoldingItem(this->array_000234); - v13 = 1; + pParty->SetHoldingItem(this->array_000234); + itemFound = true; } this->array_000234[0].Reset(); } if ( this->array_000234[1].uItemID ) { - if ( !v8->AddItemToParty(&this->array_000234[1]) ) + if ( !pParty->AddItemToParty(&this->array_000234[1]) ) { pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); - v8->SetHoldingItem(&this->array_000234[1]); - v13 = 1; + pParty->SetHoldingItem(&this->array_000234[1]); + itemFound = true; } this->array_000234[1].Reset(); } - if ( !v13 || rand() % 100 < 90 ) + if ( !itemFound || rand() % 100 < 90 ) { this->Remove(); }