comparison mm7_6.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 7d2c5fa98584
comparison
equal deleted inserted replaced
1965:182d49f28170 1966:7840fe323f67
40 40
41 #include "mm7_data.h" 41 #include "mm7_data.h"
42 42
43 43
44 44
45 //----- (00426A5A) --------------------------------------------------------
46 void stru319::LootActor(Actor *pActor)
47 {
48 signed int v2; // edi@1
49 char v3; // zf@1
50 unsigned int v4; // eax@13
51 unsigned int v5; // esi@13
52 int v6; // eax@14
53 unsigned __int8 v7; // al@30
54 Party *v8; // esi@34
55 char *v9; // [sp-4h] [bp-3Ch]@10
56 char *v10; // [sp-4h] [bp-3Ch]@31
57 char *v11; // [sp-4h] [bp-3Ch]@38
58 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
59 int v13; // [sp+30h] [bp-8h]@1
60 int v14; // [sp+34h] [bp-4h]@1
61
62 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
63 Dst.Reset();
64 v2 = 0;
65 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0;
66 v13 = 0;
67 v14 = 0;
68 if ( v3 )
69 {
70 if ( pActor->pMonsterInfo.uTreasureDiceRolls )
71 {
72 do
73 {
74 ++v2;
75 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1;
76 }
77 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls );
78 if ( v14 )
79 {
80 pParty->PartyFindsGold(v14, 0);
81 viewparams->bRedrawGameUI = 1;
82 }
83 }
84 }
85 else
86 {
87 if ( pActor->array_000234[3].uItemID != 0 && pActor->array_000234[3].GetItemEquipType() == 18 )
88 {
89 v14 = pActor->array_000234[3].uSpecEnchantmentType;
90 pActor->array_000234[3].Reset();
91 if ( v14 )
92 {
93 pParty->PartyFindsGold(v14, 0);
94 viewparams->bRedrawGameUI = 1;
95 }
96 }
97 }
98 if ( pActor->uCarriedItemID )
99 {
100 Dst.Reset();
101 Dst.uItemID = pActor->uCarriedItemID;
102 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
103 if ( v14 )
104 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9);
105 else
106 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9);
107 ShowStatusBarString(pTmpBuf2.data(), 2u);
108 v4 = Dst.uItemID;
109 v5 = Dst.uItemID;
110 if ( Dst.GetItemEquipType() == 12 )
111 {
112 v5 = Dst.uItemID;
113 v6 = rand() % 6 + Dst.GetDamageMod() + 1;
114 Dst.uNumCharges = v6;
115 Dst.uMaxCharges = v6;
116 v4 = Dst.uItemID;
117 }
118 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
119 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
120 pItemsTable->SetSpecialBonus(&Dst);
121 if ( !pParty->AddItemToParty(&Dst) )
122 pParty->SetHoldingItem(&Dst);
123 pActor->uCarriedItemID = 0;
124 if ( pActor->array_000234[0].uItemID )
125 {
126 if ( !pParty->AddItemToParty(pActor->array_000234) )
127 {
128 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
129 pParty->SetHoldingItem(pActor->array_000234);
130 }
131 pActor->array_000234[0].Reset();
132 }
133 if ( pActor->array_000234[1].uItemID )
134 {
135 if ( !pParty->AddItemToParty(&pActor->array_000234[1]) )
136 {
137 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
138 pParty->SetHoldingItem(&pActor->array_000234[1]);
139 }
140 pActor->array_000234[1].Reset();
141 }
142 pActor->Remove();
143 return;
144 }
145 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes )
146 {
147 if ( pActor->array_000234[3].uItemID )
148 {
149 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst));
150 pActor->array_000234[3].Reset();
151 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
152 if ( v14 )
153 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
154 else
155 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
156 ShowStatusBarString(pTmpBuf2.data(), 2u);
157 if ( !pParty->AddItemToParty(&Dst) )
158 pParty->SetHoldingItem(&Dst);
159 v13 = 1;
160 }
161 v8 = pParty;
162 goto LABEL_45;
163 }
164 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 )
165 {
166 v8 = pParty;
167 goto LABEL_45;
168 }
169 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
170 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
171 if ( v14 )
172 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)!
173 else
174 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]!
175 ShowStatusBarString(pTmpBuf2.data(), 2);
176 v8 = pParty;
177 if ( !pParty->AddItemToParty(&Dst) )
178 pParty->SetHoldingItem(&Dst);
179 v13 = 1;
180 LABEL_45:
181 if ( pActor->array_000234[0].uItemID )
182 {
183 if ( !v8->AddItemToParty(pActor->array_000234) )
184 {
185 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
186 v8->SetHoldingItem(pActor->array_000234);
187 v13 = 1;
188 }
189 pActor->array_000234[0].Reset();
190 }
191 if ( pActor->array_000234[1].uItemID )
192 {
193 if ( !v8->AddItemToParty(&pActor->array_000234[1]) )
194 {
195 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
196 v8->SetHoldingItem(&pActor->array_000234[1]);
197 v13 = 1;
198 }
199 pActor->array_000234[1].Reset();
200 }
201 if ( !v13 || rand() % 100 < 90 )
202 {
203 pActor->Remove();
204 }
205 }
206 //----- (0042704B) -------------------------------------------------------- 45 //----- (0042704B) --------------------------------------------------------
207 int stru319::special_ability_use_check( struct Actor *pActor, int a2 ) 46 int stru319::special_ability_use_check( struct Actor *pActor, int a2 )
208 { 47 {
209 stru319 *v3; // edi@1 48 stru319 *v3; // edi@1
210 signed int v4; // ebx@5 49 signed int v4; // ebx@5