comparison Actor.cpp @ 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
comparison
equal deleted inserted replaced
1966:7840fe323f67 1967:05787232b571
3828 { 3828 {
3829 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) 3829 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 )
3830 { 3830 {
3831 if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) 3831 if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
3832 { 3832 {
3833 v33 = byte_4D864C && pGame->uFlags & 80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; 3833 v33 = byte_4D864C && pGame->uFlags & 0x80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
3834 pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0); 3834 pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0);
3835 } 3835 }
3836 } 3836 }
3837 Actor::Die(uActorID_Monster); 3837 Actor::Die(uActorID_Monster);
3838 Actor::ApplyFineForKillingPeasant(uActorID_Monster); 3838 Actor::ApplyFineForKillingPeasant(uActorID_Monster);
4126 char v3; // zf@1 4126 char v3; // zf@1
4127 unsigned int v4; // eax@13 4127 unsigned int v4; // eax@13
4128 unsigned int v5; // esi@13 4128 unsigned int v5; // esi@13
4129 int v6; // eax@14 4129 int v6; // eax@14
4130 unsigned __int8 v7; // al@30 4130 unsigned __int8 v7; // al@30
4131 Party *v8; // esi@34
4132 char *v9; // [sp-4h] [bp-3Ch]@10 4131 char *v9; // [sp-4h] [bp-3Ch]@10
4133 char *v10; // [sp-4h] [bp-3Ch]@31 4132 char *v10; // [sp-4h] [bp-3Ch]@31
4134 char *v11; // [sp-4h] [bp-3Ch]@38 4133 char *v11; // [sp-4h] [bp-3Ch]@38
4135 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 4134 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
4136 int v13; // [sp+30h] [bp-8h]@1 4135 bool itemFound; // [sp+30h] [bp-8h]@1
4137 int v14; // [sp+34h] [bp-4h]@1 4136 int v14; // [sp+34h] [bp-4h]@1
4138 4137
4139 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); 4138 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4140 Dst.Reset(); 4139 Dst.Reset();
4141 v2 = 0; 4140 v2 = 0;
4142 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes) == 0; 4141 itemFound = false;
4143 v13 = 0;
4144 v14 = 0; 4142 v14 = 0;
4145 if ( v3 ) 4143 if ( !( this->uAttributes & 0x800000 ) )
4146 { 4144 {
4147 if ( this->pMonsterInfo.uTreasureDiceRolls ) 4145 for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ )
4148 { 4146 {
4149 do
4150 {
4151 ++v2;
4152 v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; 4147 v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
4153 } 4148 }
4154 while ( v2 < this->pMonsterInfo.uTreasureDiceRolls ); 4149 if ( v14 != 0 )
4155 if ( v14 )
4156 { 4150 {
4157 pParty->PartyFindsGold(v14, 0); 4151 pParty->PartyFindsGold(v14, 0);
4158 viewparams->bRedrawGameUI = 1; 4152 viewparams->bRedrawGameUI = 1;
4159 } 4153 }
4160 } 4154 }
4161 }
4162 else 4155 else
4163 { 4156 {
4164 if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == 18 ) 4157 if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == EQUIP_GOLD )
4165 { 4158 {
4166 v14 = this->array_000234[3].uSpecEnchantmentType; 4159 v14 = this->array_000234[3].uSpecEnchantmentType;
4167 this->array_000234[3].Reset(); 4160 this->array_000234[3].Reset();
4168 if ( v14 ) 4161 if ( v14 )
4169 { 4162 {
4180 if ( v14 ) 4173 if ( v14 )
4181 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9); 4174 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9);
4182 else 4175 else
4183 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9); 4176 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9);
4184 ShowStatusBarString(pTmpBuf2.data(), 2u); 4177 ShowStatusBarString(pTmpBuf2.data(), 2u);
4185 v4 = Dst.uItemID;
4186 v5 = Dst.uItemID;
4187 if ( Dst.GetItemEquipType() == 12 ) 4178 if ( Dst.GetItemEquipType() == 12 )
4188 { 4179 {
4189 v5 = Dst.uItemID; 4180 Dst.uNumCharges = rand() % 6 + Dst.GetDamageMod() + 1;
4190 v6 = rand() % 6 + Dst.GetDamageMod() + 1; 4181 Dst.uMaxCharges = Dst.uNumCharges;
4191 Dst.uNumCharges = v6; 4182 }
4192 Dst.uMaxCharges = v6; 4183 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 14 && Dst.uItemID != 220 )
4193 v4 = Dst.uItemID;
4194 }
4195 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
4196 Dst.uEnchantmentType = 2 * rand() % 4 + 2; 4184 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
4197 pItemsTable->SetSpecialBonus(&Dst); 4185 pItemsTable->SetSpecialBonus(&Dst);
4198 if ( !pParty->AddItemToParty(&Dst) ) 4186 if ( !pParty->AddItemToParty(&Dst) )
4199 pParty->SetHoldingItem(&Dst); 4187 pParty->SetHoldingItem(&Dst);
4200 this->uCarriedItemID = 0; 4188 this->uCarriedItemID = 0;
4217 this->array_000234[1].Reset(); 4205 this->array_000234[1].Reset();
4218 } 4206 }
4219 this->Remove(); 4207 this->Remove();
4220 return; 4208 return;
4221 } 4209 }
4222 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes ) 4210 if ( ( this->uAttributes & 0x800000 ) )
4223 { 4211 {
4224 if ( this->array_000234[3].uItemID ) 4212 if ( this->array_000234[3].uItemID )
4225 { 4213 {
4226 memcpy(&Dst, &this->array_000234[3], sizeof(Dst)); 4214 memcpy(&Dst, &this->array_000234[3], sizeof(Dst));
4227 this->array_000234[3].Reset(); 4215 this->array_000234[3].Reset();
4231 else 4219 else
4232 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); 4220 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
4233 ShowStatusBarString(pTmpBuf2.data(), 2u); 4221 ShowStatusBarString(pTmpBuf2.data(), 2u);
4234 if ( !pParty->AddItemToParty(&Dst) ) 4222 if ( !pParty->AddItemToParty(&Dst) )
4235 pParty->SetHoldingItem(&Dst); 4223 pParty->SetHoldingItem(&Dst);
4236 v13 = 1; 4224 itemFound = true;
4237 } 4225 }
4238 v8 = pParty; 4226 }
4239 goto LABEL_45; 4227 else
4240 } 4228 {
4241 if ( rand() % 100 >= this->pMonsterInfo.uTreasureDropChance || (v7 = this->pMonsterInfo.uTreasureLevel) == 0 ) 4229 if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance && (v7 = this->pMonsterInfo.uTreasureLevel) != 0 )
4242 { 4230 {
4243 v8 = pParty;
4244 goto LABEL_45;
4245 }
4246 pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst); 4231 pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst);
4247 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; 4232 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
4248 if ( v14 ) 4233 if ( v14 )
4249 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)! 4234 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)!
4250 else 4235 else
4251 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]! 4236 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]!
4252 ShowStatusBarString(pTmpBuf2.data(), 2); 4237 ShowStatusBarString(pTmpBuf2.data(), 2);
4253 v8 = pParty;
4254 if ( !pParty->AddItemToParty(&Dst) ) 4238 if ( !pParty->AddItemToParty(&Dst) )
4255 pParty->SetHoldingItem(&Dst); 4239 pParty->SetHoldingItem(&Dst);
4256 v13 = 1; 4240 itemFound = true;
4257 LABEL_45: 4241 }
4242 }
4258 if ( this->array_000234[0].uItemID ) 4243 if ( this->array_000234[0].uItemID )
4259 { 4244 {
4260 if ( !v8->AddItemToParty(this->array_000234) ) 4245 if ( !pParty->AddItemToParty(this->array_000234) )
4261 { 4246 {
4262 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); 4247 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4263 v8->SetHoldingItem(this->array_000234); 4248 pParty->SetHoldingItem(this->array_000234);
4264 v13 = 1; 4249 itemFound = true;
4265 } 4250 }
4266 this->array_000234[0].Reset(); 4251 this->array_000234[0].Reset();
4267 } 4252 }
4268 if ( this->array_000234[1].uItemID ) 4253 if ( this->array_000234[1].uItemID )
4269 { 4254 {
4270 if ( !v8->AddItemToParty(&this->array_000234[1]) ) 4255 if ( !pParty->AddItemToParty(&this->array_000234[1]) )
4271 { 4256 {
4272 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); 4257 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4273 v8->SetHoldingItem(&this->array_000234[1]); 4258 pParty->SetHoldingItem(&this->array_000234[1]);
4274 v13 = 1; 4259 itemFound = true;
4275 } 4260 }
4276 this->array_000234[1].Reset(); 4261 this->array_000234[1].Reset();
4277 } 4262 }
4278 if ( !v13 || rand() % 100 < 90 ) 4263 if ( !itemFound || rand() % 100 < 90 )
4279 { 4264 {
4280 this->Remove(); 4265 this->Remove();
4281 } 4266 }
4282 } 4267 }