comparison Actor.cpp @ 1966:7840fe323f67

stru319::LootActor(struct Actor *pActor) to Actor::LootActor
author Grumpy7
date Fri, 25 Oct 2013 13:03:08 -0700
parents 182d49f28170
children 05787232b571
comparison
equal deleted inserted replaced
1965:182d49f28170 1966:7840fe323f67
31 #include "SpriteObject.h" 31 #include "SpriteObject.h"
32 #include "stru298.h" 32 #include "stru298.h"
33 #include "Log.h" 33 #include "Log.h"
34 #include "Texts.h" 34 #include "Texts.h"
35 #include "Level/Decoration.h" 35 #include "Level/Decoration.h"
36 #include "Viewport.h"
36 37
37 38
38 39
39 40
40 41
2954 } 2955 }
2955 for(int i = 1; i <= 4; i++) 2956 for(int i = 1; i <= 4; i++)
2956 { 2957 {
2957 pPlayer = pPlayers[i]; 2958 pPlayer = pPlayers[i];
2958 if ( !pPlayer->pConditions[Condition_Dead] && !pPlayer->pConditions[Condition_Pertified] && !pPlayer->pConditions[Condition_Eradicated] ) 2959 if ( !pPlayer->pConditions[Condition_Dead] && !pPlayer->pConditions[Condition_Pertified] && !pPlayer->pConditions[Condition_Eradicated] )
2959 pPlayer->ReceiveDamage(v4, DMGT_5); 2960 pPlayer->ReceiveDamage(v4, DMGT_MAGICAL);
2960 } 2961 }
2961 } 2962 }
2962 if (pTurnEngine->pending_actions) 2963 if (pTurnEngine->pending_actions)
2963 --pTurnEngine->pending_actions; 2964 --pTurnEngine->pending_actions;
2964 } 2965 }
4114 } 4115 }
4115 } 4116 }
4116 } 4117 }
4117 return false; 4118 return false;
4118 } 4119 }
4120
4121
4122 //----- (00426A5A) --------------------------------------------------------
4123 void Actor::LootActor()
4124 {
4125 signed int v2; // edi@1
4126 char v3; // zf@1
4127 unsigned int v4; // eax@13
4128 unsigned int v5; // esi@13
4129 int v6; // eax@14
4130 unsigned __int8 v7; // al@30
4131 Party *v8; // esi@34
4132 char *v9; // [sp-4h] [bp-3Ch]@10
4133 char *v10; // [sp-4h] [bp-3Ch]@31
4134 char *v11; // [sp-4h] [bp-3Ch]@38
4135 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
4136 int v13; // [sp+30h] [bp-8h]@1
4137 int v14; // [sp+34h] [bp-4h]@1
4138
4139 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4140 Dst.Reset();
4141 v2 = 0;
4142 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes) == 0;
4143 v13 = 0;
4144 v14 = 0;
4145 if ( v3 )
4146 {
4147 if ( this->pMonsterInfo.uTreasureDiceRolls )
4148 {
4149 do
4150 {
4151 ++v2;
4152 v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
4153 }
4154 while ( v2 < this->pMonsterInfo.uTreasureDiceRolls );
4155 if ( v14 )
4156 {
4157 pParty->PartyFindsGold(v14, 0);
4158 viewparams->bRedrawGameUI = 1;
4159 }
4160 }
4161 }
4162 else
4163 {
4164 if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == 18 )
4165 {
4166 v14 = this->array_000234[3].uSpecEnchantmentType;
4167 this->array_000234[3].Reset();
4168 if ( v14 )
4169 {
4170 pParty->PartyFindsGold(v14, 0);
4171 viewparams->bRedrawGameUI = 1;
4172 }
4173 }
4174 }
4175 if ( this->uCarriedItemID )
4176 {
4177 Dst.Reset();
4178 Dst.uItemID = this->uCarriedItemID;
4179 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
4180 if ( v14 )
4181 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9);
4182 else
4183 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9);
4184 ShowStatusBarString(pTmpBuf2.data(), 2u);
4185 v4 = Dst.uItemID;
4186 v5 = Dst.uItemID;
4187 if ( Dst.GetItemEquipType() == 12 )
4188 {
4189 v5 = Dst.uItemID;
4190 v6 = rand() % 6 + Dst.GetDamageMod() + 1;
4191 Dst.uNumCharges = v6;
4192 Dst.uMaxCharges = v6;
4193 v4 = Dst.uItemID;
4194 }
4195 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
4196 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
4197 pItemsTable->SetSpecialBonus(&Dst);
4198 if ( !pParty->AddItemToParty(&Dst) )
4199 pParty->SetHoldingItem(&Dst);
4200 this->uCarriedItemID = 0;
4201 if ( this->array_000234[0].uItemID )
4202 {
4203 if ( !pParty->AddItemToParty(this->array_000234) )
4204 {
4205 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4206 pParty->SetHoldingItem(this->array_000234);
4207 }
4208 this->array_000234[0].Reset();
4209 }
4210 if ( this->array_000234[1].uItemID )
4211 {
4212 if ( !pParty->AddItemToParty(&this->array_000234[1]) )
4213 {
4214 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4215 pParty->SetHoldingItem(&this->array_000234[1]);
4216 }
4217 this->array_000234[1].Reset();
4218 }
4219 this->Remove();
4220 return;
4221 }
4222 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes )
4223 {
4224 if ( this->array_000234[3].uItemID )
4225 {
4226 memcpy(&Dst, &this->array_000234[3], sizeof(Dst));
4227 this->array_000234[3].Reset();
4228 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
4229 if ( v14 )
4230 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
4231 else
4232 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
4233 ShowStatusBarString(pTmpBuf2.data(), 2u);
4234 if ( !pParty->AddItemToParty(&Dst) )
4235 pParty->SetHoldingItem(&Dst);
4236 v13 = 1;
4237 }
4238 v8 = pParty;
4239 goto LABEL_45;
4240 }
4241 if ( rand() % 100 >= this->pMonsterInfo.uTreasureDropChance || (v7 = this->pMonsterInfo.uTreasureLevel) == 0 )
4242 {
4243 v8 = pParty;
4244 goto LABEL_45;
4245 }
4246 pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst);
4247 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
4248 if ( v14 )
4249 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)!
4250 else
4251 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]!
4252 ShowStatusBarString(pTmpBuf2.data(), 2);
4253 v8 = pParty;
4254 if ( !pParty->AddItemToParty(&Dst) )
4255 pParty->SetHoldingItem(&Dst);
4256 v13 = 1;
4257 LABEL_45:
4258 if ( this->array_000234[0].uItemID )
4259 {
4260 if ( !v8->AddItemToParty(this->array_000234) )
4261 {
4262 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4263 v8->SetHoldingItem(this->array_000234);
4264 v13 = 1;
4265 }
4266 this->array_000234[0].Reset();
4267 }
4268 if ( this->array_000234[1].uItemID )
4269 {
4270 if ( !v8->AddItemToParty(&this->array_000234[1]) )
4271 {
4272 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
4273 v8->SetHoldingItem(&this->array_000234[1]);
4274 v13 = 1;
4275 }
4276 this->array_000234[1].Reset();
4277 }
4278 if ( !v13 || rand() % 100 < 90 )
4279 {
4280 this->Remove();
4281 }
4282 }