Mercurial > mm7
annotate Player.cpp @ 1018:9ac94d00012e
Merge
author | Grumpy7 |
---|---|
date | Tue, 21 May 2013 02:24:31 +0200 |
parents | c45d51b3f4f4 a704435d3285 |
children | 3413ad40cc88 |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
1016 | 3 #include "stru6.h" |
4 | |
5 | |
0 | 6 #include "OSAPI.h" |
7 #include "Player.h" | |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
0 | 29 |
30 | |
31 | |
32 | |
33 | |
34 | |
35 /* 381 */ | |
36 #pragma pack(push, 1) | |
290 | 37 struct PlayerCreation_AttributeProps |
0 | 38 { |
39 unsigned __int8 uBaseValue; | |
40 char uMaxValue; | |
41 char uDroppedStep; | |
42 char uBaseStep; | |
43 }; | |
44 #pragma pack(pop) | |
45 | |
46 | |
47 #pragma pack(push, 1) | |
290 | 48 |
49 | |
50 | |
0 | 51 #pragma pack(pop) |
290 | 52 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
53 { | |
54 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
55 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
56 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
57 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 58 }; |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 // available skills per class ( 9 classes X 37 skills ) | |
66 // 0 - not available | |
67 // 1 - available | |
68 // 2 - primary skill | |
69 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
70 { | |
71 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
72 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
73 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
74 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
75 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
76 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
77 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
78 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
79 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
80 }; | |
81 | |
82 | |
83 | |
84 | |
85 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
86 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
87 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
88 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
89 | |
90 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
91 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
93 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
94 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
96 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
97 | |
98 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
99 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
101 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
102 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
104 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
105 | |
106 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
107 | |
108 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
109 | |
94 | 110 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 113 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 114 |
115 | |
1010 | 116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
117 | |
0 | 118 |
816 | 119 unsigned short base_recovery_times_per_weapon_type[12] = |
120 { | |
121 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
122 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
123 60, // PLAYER_SKILL_DAGGER | |
124 100, // PLAYER_SKILL_AXE | |
125 80, // PLAYER_SKILL_SPEAR | |
126 100, // PLAYER_SKILL_BOW | |
127 80, // PLAYER_SKILL_MACE | |
128 30, // PLAYER_SKILL_BLASTER | |
129 10, // PLAYER_SKILL_SHIELD | |
130 10, // PLAYER_SKILL_LEATHER | |
131 20, // PLAYER_SKILL_CHAIN | |
132 30 // PLAYER_SKILL_PLATE | |
133 }; | |
134 | |
135 | |
0 | 136 |
137 //----- (00490913) -------------------------------------------------------- | |
138 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
139 { | |
140 signed int v0; // edi@1 | |
141 signed int v1; // esi@1 | |
142 int v2; // ebx@2 | |
143 int v3; // ecx@17 | |
144 signed int v4; // eax@17 | |
145 int v5; // edx@18 | |
146 signed int v6; // ecx@18 | |
147 signed int v8; // [sp+Ch] [bp-8h]@1 | |
148 signed int v9; // [sp+10h] [bp-4h]@2 | |
149 | |
150 v8 = 50; | |
151 v0 = 50; | |
152 v1 = 0; | |
153 do | |
154 { | |
155 v9 = 0; | |
156 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
157 do | |
158 { | |
159 if ( v9 ) | |
160 { | |
161 switch ( v9 ) | |
162 { | |
163 case 1: | |
164 v0 = pParty->pPlayers[v1].uIntelligence; | |
165 break; | |
166 case 2: | |
167 v0 = pParty->pPlayers[v1].uWillpower; | |
168 break; | |
169 case 3: | |
170 v0 = pParty->pPlayers[v1].uEndurance; | |
171 break; | |
172 case 4: | |
173 v0 = pParty->pPlayers[v1].uAccuracy; | |
174 break; | |
175 case 5: | |
176 v0 = pParty->pPlayers[v1].uSpeed; | |
177 break; | |
178 case 6: | |
179 v0 = pParty->pPlayers[v1].uLuck; | |
180 break; | |
181 } | |
182 } | |
183 else | |
184 { | |
185 v0 = pParty->pPlayers[v1].uMight; | |
186 } | |
187 v3 = v2 + v9; | |
290 | 188 v4 = StatTable[0][v3].uBaseValue; |
0 | 189 if ( v0 >= v4 ) |
190 { | |
290 | 191 v5 = StatTable[0][v3].uDroppedStep; |
192 v6 = StatTable[0][v3].uBaseStep; | |
0 | 193 } |
194 else | |
195 { | |
290 | 196 v5 = StatTable[0][v3].uBaseStep; |
197 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 198 } |
199 v8 += v5 * (v4 - v0) / v6; | |
200 ++v9; | |
201 } | |
202 while ( v9 <= 6 ); | |
203 ++v1; | |
204 } | |
205 while ( v1 < 4 ); | |
206 return v8; | |
207 } | |
208 | |
209 | |
210 | |
211 //----- (00427730) -------------------------------------------------------- | |
212 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
213 { | |
488 | 214 if (sMana >= uRequiredMana) |
215 { | |
216 sMana -= uRequiredMana; | |
217 return true; | |
218 } | |
219 | |
220 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
221 return false; | |
0 | 222 } |
223 | |
224 | |
225 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 226 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
227 { | |
0 | 228 float v6; // ST04_4@1 |
1014 | 229 signed int item_value; // eax@1 |
230 signed int sell_price; // ebx@1 | |
231 | |
232 item_value =pOwnItems[item_index].GetValue(); | |
233 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
234 sell_price = GetPriceSell(item_value, v6); | |
235 if ( pOwnItems[item_index].Broken() ) | |
236 sell_price = 1; | |
237 if ( sell_price < 1 ) | |
238 sell_price = 1; | |
239 RemoveItemAtInventoryIndex(inventory_idnx); | |
240 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 241 } |
242 | |
243 | |
244 | |
245 //----- (0043EEF3) -------------------------------------------------------- | |
246 bool Player::_43EEF3() | |
247 { | |
1014 | 248 signed int item_idx; // esi@1 |
249 signed int item_id; // esi@1 | |
250 for (int i=0; i<16;++i) | |
251 { | |
252 item_idx=pEquipment.pIndices[i]; | |
253 if (item_idx) | |
254 { | |
255 item_id=pOwnItems[item_idx-1].uItemID; | |
256 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
257 return false; | |
258 } | |
259 } | |
260 return true; | |
261 } | |
262 | |
0 | 263 |
264 | |
265 | |
266 //----- (004B8040) -------------------------------------------------------- | |
267 int Player::_4B8040_condition_time(unsigned int uCondition) | |
268 { | |
269 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
270 } | |
271 | |
272 //----- (004B807C) -------------------------------------------------------- | |
273 int Player::_4B807C(float a2) | |
274 { | |
275 Player *v2; // edi@1 | |
276 unsigned int v3; // eax@1 | |
277 int v4; // esi@1 | |
278 unsigned int v5; // ebx@7 | |
279 int v6; // eax@8 | |
280 signed __int64 v7; // qax@13 | |
281 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
282 signed int v10; // [sp+8h] [bp-8h]@4 | |
283 int v11; // [sp+Ch] [bp-4h]@6 | |
284 | |
285 v2 = this; | |
286 v3 = GetMajorConditionIdx(); | |
287 v4 = 0; | |
288 if ( (signed int)v3 >= 14 ) | |
289 { | |
290 if ( (signed int)v3 <= 15 ) | |
291 { | |
292 v10 = 5; | |
293 v9 = v3; | |
294 goto LABEL_6; | |
295 } | |
296 if ( v3 == 16 ) | |
297 { | |
298 v10 = 10; | |
299 v9 = 16; | |
300 LABEL_6: | |
301 v11 = _4B8040_condition_time(v9); | |
302 goto LABEL_13; | |
303 } | |
304 } | |
305 v10 = 1; | |
306 v5 = 0; | |
307 do | |
308 { | |
309 v6 = _4B8040_condition_time(v5); | |
310 if ( v6 > v4 ) | |
311 v4 = v6; | |
312 ++v5; | |
313 } | |
314 while ( (signed int)v5 <= 13 ); | |
315 v11 = v4; | |
316 if ( !v4 ) | |
317 v11 = 1; | |
318 LABEL_13: | |
319 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
320 if ( (signed int)v7 < 1 ) | |
321 LODWORD(v7) = 1; | |
322 return v7; | |
323 } | |
324 | |
325 //----- (004B8102) -------------------------------------------------------- | |
917 | 326 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 327 { |
328 signed int v3; // esi@1 | |
329 signed int result; // eax@3 | |
330 | |
917 | 331 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
332 if ( v3 > uRealValue ) | |
333 v3 = uRealValue; | |
0 | 334 result = 1; |
335 if ( v3 >= 1 ) | |
336 result = v3; | |
337 return result; | |
338 } | |
339 | |
340 //----- (004B8142) -------------------------------------------------------- | |
749 | 341 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
342 { | |
343 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
344 assert (price > 0); | |
345 | |
346 if (price < uRealValue) | |
347 price = uRealValue; | |
348 return price; | |
0 | 349 } |
350 | |
351 //----- (004B8179) -------------------------------------------------------- | |
916 | 352 int Player::GetPriceIdentification(float a2) |
0 | 353 { |
354 signed int v2; // esi@1 | |
355 int v3; // ecx@1 | |
356 signed int result; // eax@3 | |
357 | |
358 v2 = (signed __int64)(a2 * 50.0); | |
359 v3 = v2 * (100 - GetMerchant()) / 100; | |
360 if ( v3 < v2 / 3 ) | |
361 v3 = v2 / 3; | |
362 result = 1; | |
363 if ( v3 >= 1 ) | |
364 result = v3; | |
365 return result; | |
366 } | |
367 | |
368 //----- (004B81C3) -------------------------------------------------------- | |
916 | 369 int Player::GetPriceRepair(int a2, float a3) |
0 | 370 { |
371 signed int v3; // esi@1 | |
372 int v4; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
376 v4 = v3 * (100 - GetMerchant()) / 100; | |
377 if ( v4 < v3 / 3 ) | |
378 v4 = v3 / 3; | |
379 result = 1; | |
380 if ( v4 >= 1 ) | |
381 result = v4; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B8213) -------------------------------------------------------- | |
386 int Player::_4B8213(int a2, float a3) | |
387 { | |
388 signed __int64 v3; // qax@1 | |
389 | |
390 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
391 if ( (signed int)v3 < 1 ) | |
392 LODWORD(v3) = 1; | |
393 return v3; | |
394 } | |
395 | |
396 //----- (004B8233) -------------------------------------------------------- | |
397 int Player::_4B8233(int a2, float a3) | |
398 { | |
399 signed __int64 v3; // qax@1 | |
400 | |
401 v3 = (signed __int64)((double)a2 * a3); | |
402 if ( (signed int)v3 < 1 ) | |
403 LODWORD(v3) = 1; | |
404 return v3; | |
405 } | |
406 | |
407 //----- (004B824B) -------------------------------------------------------- | |
408 int Player::_4B824B(float a2) | |
409 { | |
410 signed __int64 v2; // qax@1 | |
411 | |
412 v2 = (signed __int64)(a2 * 50.0); | |
413 if ( (signed int)v2 < 1 ) | |
414 LODWORD(v2) = 1; | |
415 return v2; | |
416 } | |
417 | |
418 //----- (004B8265) -------------------------------------------------------- | |
419 int Player::_4B8265(int a2, float a3) | |
420 { | |
421 signed __int64 v3; // qax@1 | |
422 | |
423 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
424 if ( (signed int)v3 < 1 ) | |
425 LODWORD(v3) = 1; | |
426 return v3; | |
427 } | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 //----- (004B6FF9) -------------------------------------------------------- | |
434 int Player::_4B6FF9() | |
435 { | |
436 Player *v1; // esi@1 | |
437 signed int v2; // eax@1 | |
438 char v3; // zf@4 | |
439 | |
440 v1 = this; | |
336 | 441 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 442 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 443 { |
444 if ( GetMajorConditionIdx() == 18 ) | |
445 goto LABEL_6; | |
446 v3 = GetMajorConditionIdx() == 17; | |
447 } | |
448 else | |
449 { | |
450 v3 = GetMajorConditionIdx() == 18; | |
451 } | |
452 if ( !v3 ) | |
453 return 1; | |
454 LABEL_6: | |
455 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
456 return 1; | |
457 return 0; | |
458 } | |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
468 item_idx = *pitem_index; | |
469 if ( item_idx >125 || item_idx < 0 ) | |
470 { | |
471 return 0; | |
472 } | |
473 | |
474 inv_index = this->pInventoryIndices[item_idx]; | |
475 if ( inv_index < 0 ) | |
476 { | |
477 *pitem_index = -1 - inv_index; | |
478 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
479 } | |
480 | |
481 return inv_index; | |
0 | 482 } |
483 | |
484 | |
485 | |
486 //----- (004160CA) -------------------------------------------------------- | |
1012 | 487 void Player::ItemsEnchant( int enchant_count ) |
488 { | |
489 int avalible_items; // ebx@1 | |
490 int i; // edx@8 | |
491 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
492 | |
493 avalible_items = 0; | |
494 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
495 | |
496 for (i=0; i<138; ++i) | |
497 { | |
498 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
499 item_index_tabl[avalible_items++] = i; | |
500 } | |
501 | |
502 if ( avalible_items ) | |
503 { | |
504 if ( enchant_count ) | |
505 { | |
506 for ( i = 0; i < enchant_count; ++i ) | |
0 | 507 { |
1012 | 508 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
509 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 510 } |
1012 | 511 |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
517 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
518 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
519 } | |
520 } | |
521 } | |
522 ; | |
0 | 523 } |
524 | |
525 //----- (004948B1) -------------------------------------------------------- | |
187 | 526 void Player::PlaySound(PlayerSpeech speech, int a3) |
527 { | |
528 //Player *pPlayer; // edi@1 | |
529 //int v4; // eax@4 | |
0 | 530 signed int v5; // esi@4 |
203 | 531 unsigned char *v6; // ebx@4 |
0 | 532 signed int v7; // ecx@5 |
533 unsigned __int8 v8; // al@6 | |
534 int v9; // eax@10 | |
187 | 535 //unsigned int pVoiceID; // ecx@10 |
0 | 536 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
537 //signed int v12; // eax@11 |
0 | 538 signed int v13; // esi@12 |
539 int v14; // eax@12 | |
187 | 540 //int v15; // eax@17 |
248 | 541 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 542 signed int v17; // ecx@19 |
543 char *pSoundID; // edi@20 | |
544 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 545 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 546 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
547 int pSoundId; // [sp+30h] [bp+8h]@4 | |
548 | |
187 | 549 //pPlayer = this; |
550 //pPlayer2 = this; | |
551 | |
0 | 552 pPlayerNum = 1; |
187 | 553 for (int i = 0; i < 4; ++i) |
554 if (&pParty->pPlayers[i] == this) | |
555 { | |
556 pPlayerNum = i + 1; | |
0 | 557 break; |
187 | 558 } |
559 | |
560 //v4 = a2;//102 | |
0 | 561 v5 = 0; |
562 pSoundId = 0; | |
203 | 563 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
564 if (uVoicesVolumeMultiplier) | |
0 | 565 { |
566 v7 = 0; | |
567 do | |
568 { | |
569 v8 = v6[v7]; | |
570 if ( v8 ) | |
571 v20[v5++] = v8; | |
572 ++v7; | |
573 } | |
574 while ( v7 < 2 ); | |
575 if ( v5 ) | |
576 { | |
577 v9 = rand(); | |
187 | 578 //pVoiceID = uVoiceID; |
0 | 579 v11 = v20[v9 % v5]; |
203 | 580 |
581 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
582 { | |
583 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
584 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 585 } |
586 } | |
587 } | |
203 | 588 |
0 | 589 v13 = 0; |
590 v14 = (int)(v6 + 3); | |
591 do | |
592 { | |
593 if ( *(char *)v14 ) | |
594 v20[v13++] = *(char *)v14; | |
595 ++v14; | |
596 } | |
597 while ( -3 - (signed int)v6 + v14 < 5 ); | |
598 if ( v13 ) | |
599 { | |
600 pPlayerNum = 0; | |
248 | 601 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
602 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 603 { |
604 v17 = 0; | |
764 | 605 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 606 { |
607 LABEL_23: | |
608 v17 = 0; | |
609 } | |
610 else | |
611 { | |
612 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
613 while ( *(int *)pSoundID != pSoundId ) | |
614 { | |
615 ++v17; | |
616 pSoundID += 120; | |
764 | 617 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 618 goto LABEL_23; |
619 } | |
620 } | |
621 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
622 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
623 } | |
248 | 624 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 625 } |
626 //return v14; | |
0 | 627 } |
628 // 4948B1: using guessed type int var_1C[5]; | |
629 | |
630 //----- (00494A25) -------------------------------------------------------- | |
187 | 631 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
632 { | |
633 //signed int v3; // eax@1 | |
634 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 635 signed int v5; // edi@15 |
636 PlayerFrame *v6; // esi@17 | |
637 signed int v7; // eax@20 | |
638 | |
187 | 639 //LOWORD(v3) = this->expression; |
640 //v4 = expr; | |
641 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
642 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
643 { | |
644 int v3 = (unsigned)expression; | |
0 | 645 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
646 { | |
647 if ( v3 <= 7 ) | |
648 goto LABEL_12; | |
649 if ( v3 > 8 ) | |
650 { | |
651 if ( v3 > 11 ) | |
652 { | |
1014 | 653 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 654 return; |
0 | 655 goto LABEL_15; |
656 } | |
657 LABEL_12: | |
187 | 658 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
659 return; | |
0 | 660 goto LABEL_15; |
661 } | |
662 } | |
663 } | |
664 LABEL_15: | |
187 | 665 //LOWORD(v3) = a3; |
0 | 666 v5 = 0; |
667 this->uExpressionTimeLength = a3; | |
668 this->uExpressionTimePassed = 0; | |
669 if ( !a3 ) | |
670 { | |
671 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
672 { | |
673 LABEL_20: | |
674 v7 = 0; | |
675 } | |
676 else | |
677 { | |
678 v6 = pPlayerFrameTable->pFrames; | |
187 | 679 while ( v6->expression != new_expression ) |
0 | 680 { |
681 ++v5; | |
682 ++v6; | |
683 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
684 goto LABEL_20; | |
685 } | |
686 v7 = v5; | |
687 } | |
187 | 688 //v4 = expr; |
689 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
690 } | |
691 expression = new_expression; | |
0 | 692 viewparams->bRedrawGameUI = 1; |
693 } | |
694 | |
695 //----- (0049327B) -------------------------------------------------------- | |
696 int Player::_49327B(unsigned int uClass, int a3) | |
697 { | |
698 Player *v3; // esi@1 | |
699 char v4; // zf@4 | |
700 __int16 v5; // dx@9 | |
701 signed int result; // eax@84 | |
702 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
703 int v8; // [sp-4h] [bp-Ch]@3 | |
704 | |
705 v3 = this; | |
135 | 706 if ( this->classType == uClass ) |
0 | 707 { |
708 LABEL_84: | |
709 result = 1; | |
710 } | |
711 else | |
712 { | |
713 switch ( uClass ) | |
714 { | |
715 case 0u: | |
716 v8 = a3; | |
717 v7 = 1; | |
718 goto LABEL_4; | |
719 case 1u: | |
484 | 720 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 721 || _49327B(2u, a3) ) |
722 goto LABEL_84; | |
723 v8 = a3; | |
724 v7 = 3; | |
725 goto LABEL_4; | |
726 case 2u: | |
727 v5 = 19; | |
728 goto LABEL_82; | |
729 case 3u: | |
730 v5 = 21; | |
731 goto LABEL_82; | |
732 case 4u: | |
733 v8 = a3; | |
734 v7 = 5; | |
735 goto LABEL_4; | |
736 case 5u: | |
484 | 737 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 738 || _49327B(6u, a3) ) |
739 goto LABEL_84; | |
740 v8 = a3; | |
741 v7 = 7; | |
742 goto LABEL_4; | |
743 case 6u: | |
744 if ( !a3 ) | |
745 break; | |
746 v5 = 13; | |
747 goto LABEL_82; | |
748 case 7u: | |
749 if ( !a3 ) | |
750 break; | |
751 v5 = 15; | |
752 goto LABEL_82; | |
753 case 8u: | |
754 v8 = a3; | |
755 v7 = 9; | |
756 goto LABEL_4; | |
757 case 9u: | |
484 | 758 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 759 || _49327B(0xAu, a3) ) |
760 goto LABEL_84; | |
761 v8 = a3; | |
762 v7 = 11; | |
763 goto LABEL_4; | |
764 case 0xAu: | |
765 if ( !a3 ) | |
766 break; | |
767 v5 = 25; | |
768 goto LABEL_82; | |
769 case 0xBu: | |
770 if ( !a3 ) | |
771 break; | |
772 v5 = 27; | |
773 goto LABEL_82; | |
774 case 0xCu: | |
775 v8 = a3; | |
776 v7 = 13; | |
777 goto LABEL_4; | |
778 case 0xDu: | |
484 | 779 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 780 || _49327B(0xEu, a3) ) |
781 goto LABEL_84; | |
782 v8 = a3; | |
783 v7 = 15; | |
784 goto LABEL_4; | |
785 case 0xEu: | |
786 if ( !a3 ) | |
787 break; | |
788 v5 = 43; | |
789 goto LABEL_82; | |
790 case 0xFu: | |
791 if ( !a3 ) | |
792 break; | |
793 v5 = 45; | |
794 goto LABEL_82; | |
795 case 0x10u: | |
796 v8 = a3; | |
797 v7 = 17; | |
798 goto LABEL_4; | |
799 case 0x11u: | |
484 | 800 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 801 || _49327B(0x12u, a3) ) |
802 goto LABEL_84; | |
803 v8 = a3; | |
804 v7 = 19; | |
805 goto LABEL_4; | |
806 case 0x12u: | |
807 if ( !a3 ) | |
808 break; | |
809 v5 = 37; | |
810 goto LABEL_82; | |
811 case 0x13u: | |
812 v5 = 39; | |
813 goto LABEL_82; | |
814 case 0x14u: | |
815 v8 = a3; | |
816 v7 = 21; | |
817 goto LABEL_4; | |
818 case 0x15u: | |
484 | 819 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 820 || _49327B(0x16u, a3) ) |
821 goto LABEL_84; | |
822 v8 = a3; | |
823 v7 = 23; | |
824 goto LABEL_4; | |
825 case 0x16u: | |
826 if ( !a3 ) | |
827 break; | |
828 v5 = 31; | |
829 goto LABEL_82; | |
830 case 0x17u: | |
831 if ( !a3 ) | |
832 break; | |
833 v5 = 33; | |
834 goto LABEL_82; | |
835 case 0x18u: | |
836 if ( !_49327B(0x19u, a3) ) | |
837 goto LABEL_56; | |
838 break; | |
839 case 0x19u: | |
840 LABEL_56: | |
484 | 841 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 842 || _49327B(0x1Au, a3) ) |
843 goto LABEL_84; | |
844 v8 = a3; | |
845 v7 = 27; | |
846 goto LABEL_4; | |
847 case 0x1Au: | |
848 if ( !a3 ) | |
849 break; | |
850 v5 = 65; | |
851 goto LABEL_82; | |
852 case 0x1Bu: | |
853 if ( !a3 ) | |
854 break; | |
855 v5 = 67; | |
856 goto LABEL_82; | |
857 case 0x1Cu: | |
858 v8 = a3; | |
859 v7 = 29; | |
860 goto LABEL_4; | |
861 case 0x1Du: | |
484 | 862 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 863 || _49327B(0x1Eu, a3) ) |
864 goto LABEL_84; | |
865 v8 = a3; | |
866 v7 = 31; | |
867 goto LABEL_4; | |
868 case 0x1Eu: | |
869 if ( !a3 ) | |
870 break; | |
871 v5 = 71; | |
872 goto LABEL_82; | |
873 case 0x1Fu: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 73; | |
877 goto LABEL_82; | |
878 case 0x20u: | |
879 v8 = a3; | |
880 v7 = 33; | |
881 goto LABEL_4; | |
882 case 0x21u: | |
484 | 883 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 884 || _49327B(0x22u, a3) ) |
885 goto LABEL_84; | |
886 v8 = a3; | |
887 v7 = 35; | |
888 LABEL_4: | |
889 v4 = _49327B(v7, v8) == 0; | |
890 goto LABEL_83; | |
891 case 0x22u: | |
892 if ( !a3 ) | |
893 break; | |
894 v5 = 77; | |
895 goto LABEL_82; | |
896 case 0x23u: | |
897 if ( a3 ) | |
898 { | |
899 v5 = 79; | |
900 LABEL_82: | |
484 | 901 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 902 LABEL_83: |
903 if ( !v4 ) | |
904 goto LABEL_84; | |
905 } | |
906 break; | |
907 default: | |
908 break; | |
909 } | |
910 result = 0; | |
911 } | |
912 return result; | |
913 } | |
914 | |
915 | |
916 //----- (00492C0B) -------------------------------------------------------- | |
917 bool Player::CanAct() | |
918 { | |
919 bool result; // eax@2 | |
920 | |
921 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
922 result = 0; | |
923 else | |
924 result = 1; | |
925 return result; | |
926 } | |
927 | |
928 //----- (00492C40) -------------------------------------------------------- | |
929 bool Player::CanSteal() | |
930 { | |
931 int v1; // eax@1 | |
932 | |
933 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
934 return v1 != 0; | |
935 } | |
936 | |
937 //----- (00492C4E) -------------------------------------------------------- | |
938 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
939 { | |
940 char v2; // zf@9 | |
941 __int16 v4; // dx@13 | |
942 char v5; // zf@15 | |
943 | |
944 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
945 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
946 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
947 { | |
948 if ( uItemID == 533 ) | |
949 { | |
950 v2 = GetRace() == 1; | |
951 } | |
952 else | |
953 { | |
954 if ( uItemID != 534 ) | |
955 { | |
956 if ( uItemID == 535 ) // | |
957 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
958 { | |
959 switch ( this->uVoiceID ) | |
960 { | |
961 default: | |
962 return 1; | |
963 case 4u: | |
964 case 5u: | |
965 case 6u: | |
966 case 7u: | |
967 case 0xAu: | |
968 case 0xBu: | |
969 case 0xEu: // | |
970 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
971 case 0xFu: | |
972 case 0x12u: | |
973 case 0x13u: | |
974 case 0x15u: | |
975 case 0x18u: | |
976 return 0; | |
977 } | |
978 return 0; | |
979 } | |
980 if ( uItemID == 536 ) // | |
981 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
982 { | |
983 switch ( this->uVoiceID ) | |
984 { | |
985 case 4u: | |
986 case 5u: | |
987 case 6u: | |
988 case 7u: | |
989 case 0xAu: | |
990 case 0xBu: | |
991 case 0xEu: | |
992 case 0xFu: | |
993 case 0x12u: | |
994 case 0x13u: | |
995 case 0x15u: | |
996 case 0x18u: | |
997 return 1; | |
998 default: | |
999 return 0; | |
1000 } | |
1001 return 0; | |
1002 } | |
1003 if ( uItemID != 604 ) // | |
1004 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1005 return 1; | |
1006 v5 = _43EEF3() == 0; | |
1007 goto LABEL_23; | |
1008 } | |
1009 v2 = GetRace() == 3; // | |
1010 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1011 } | |
1012 } | |
1013 else | |
1014 { | |
1015 if ( uItemID != 532 ) | |
1016 { | |
1017 if ( uItemID != 515 && uItemID != 517 ) // | |
1018 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1019 { | |
1020 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1021 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1022 { | |
1023 LABEL_13: | |
1024 v4 = 99; | |
1025 LABEL_15: | |
484 | 1026 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1027 LABEL_23: |
1028 if ( !v5 ) | |
1029 return 1; | |
1030 return 0; | |
1031 } | |
1032 if ( uItemID != 525 ) | |
1033 { | |
1034 if ( uItemID != 527 ) | |
1035 { | |
1036 if ( uItemID != 531 ) | |
1037 return 1; | |
1038 v2 = GetRace() == 2; | |
1039 goto LABEL_10; | |
1040 } | |
1041 goto LABEL_13; | |
1042 } | |
1043 } | |
1044 v4 = 100; | |
1045 goto LABEL_15; | |
1046 } | |
1047 v2 = GetRace() == 0; | |
1048 } | |
1049 LABEL_10: | |
1050 if ( v2 ) | |
1051 return 1; | |
1052 return 0; | |
1053 } | |
1054 | |
1055 //----- (00492D65) -------------------------------------------------------- | |
1056 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1057 { |
1058 | |
1059 signed int player_sex; // ecx@77 | |
1060 char zombi_face; // al@80 | |
1061 signed int remainig_player; // ebx@82 | |
1062 int players_before; // [sp+10h] [bp-4h]@2 | |
1063 int players_after; // [sp+20h] [bp+Ch]@82 | |
1064 | |
1065 if ( pConditions[uConditionIdx] ) | |
1066 return 0; | |
1067 players_before = 0; | |
1068 for (int i=1;i<5;++i) | |
1069 if ( pPlayers[i]->CanAct() ) | |
1070 ++players_before; | |
1071 | |
0 | 1072 switch ( uConditionIdx ) |
1014 | 1073 { |
1074 case Condition_Cursed: | |
1075 PlaySound((PlayerSpeech)30, 0); | |
1076 break; | |
1077 case Condition_Weak: | |
0 | 1078 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) |
1014 | 1079 {--pParty->pPartyBuffs[13].uPower; |
1080 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1081 pParty->pPartyBuffs[13].Reset(); | |
1082 return 0; | |
1083 } | |
1084 | |
1085 PlaySound((PlayerSpeech)25, 0); | |
1086 break; | |
1087 case Condition_Sleep: | |
1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) | |
1089 return 0; | |
1090 break; | |
1091 | |
1092 case Condition_Fear: | |
1093 PlaySound((PlayerSpeech)26, 0); | |
1094 break; | |
1095 case Condition_Drunk: | |
1096 PlaySound((PlayerSpeech)31, 0); | |
1097 break; | |
1098 | |
1099 case Condition_Insane: | |
0 | 1100 if ( a3 == 1 |
1014 | 1101 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) |
1102 return 0; | |
1103 | |
1104 PlaySound((PlayerSpeech)29, 0); | |
1105 break; | |
1106 case Condition_Poison1: | |
1107 case Condition_Poison2: | |
1108 case Condition_Poison3: | |
1109 if ( a3 == 1 ) | |
1110 { | |
1111 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1112 { | |
1113 --pParty->pPartyBuffs[13].uPower; | |
1114 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1115 pParty->pPartyBuffs[13].Reset(); | |
1116 } | |
1117 if ( HasEnchantedItemEquipped(21) | |
1118 || WearsItem(505, 3) | |
1119 || WearsItem(530, 6) ) | |
1120 //goto LABEL_76; | |
1121 return 0; | |
1122 } | |
1123 | |
1124 //v23 = 27; | |
1125 PlaySound((PlayerSpeech)27, 0); | |
1126 break; | |
1127 | |
1128 case Condition_Disease1: | |
1129 case Condition_Disease2: | |
1130 case Condition_Disease3: | |
0 | 1131 if ( a3 == 1 ) |
1014 | 1132 { |
1133 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1134 { | |
1135 --pParty->pPartyBuffs[13].uPower; | |
1136 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1137 pParty->pPartyBuffs[13].Reset(); | |
1138 return 0; | |
1139 } | |
1140 | |
1141 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) | |
1142 return 0; | |
1143 } | |
1144 PlaySound((PlayerSpeech)28, 0); | |
1145 break; | |
1146 case Condition_Paralyzed: | |
1147 if ( a3 == 1 ) | |
1148 { | |
1149 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1150 { | |
1151 --pParty->pPartyBuffs[13].uPower; | |
1152 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1153 pParty->pPartyBuffs[13].Reset(); | |
1154 return 0; | |
1155 } | |
1156 | |
1157 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) | |
1158 return 0; | |
1159 } | |
1160 break; | |
1161 case Condition_Unconcious: | |
1162 PlaySound(SPEECH_32, 0); | |
1163 if ( sHealth > 0 ) | |
1164 sHealth = 0; | |
1165 break; | |
1166 case Condition_Dead: | |
1167 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1168 { | |
0 | 1169 --pParty->pPartyBuffs[13].uPower; |
1170 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1014 | 1171 pParty->pPartyBuffs[13].Reset(); |
1172 } | |
1173 | |
1174 PlaySound((PlayerSpeech)33, 0); | |
1175 if ( sHealth > 0 ) | |
1176 sHealth = 0; | |
1177 if ( sMana > 0 ) | |
1178 sMana = 0; | |
1179 break; | |
1180 case Condition_Pertified: | |
0 | 1181 if ( a3 == 1 |
1014 | 1182 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) |
1183 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) | |
1184 | |
1185 return 0; | |
1186 PlaySound((PlayerSpeech)34, 0); | |
1187 break; | |
1188 case Condition_Eradicated: | |
1189 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u )) | |
1190 { | |
1191 --pParty->pPartyBuffs[13].uPower; | |
1192 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1193 pParty->pPartyBuffs[13].Reset(); | |
1194 return 0; | |
1195 } | |
1196 PlaySound(SPEECH_35, 0); | |
1197 if (sHealth > 0 ) | |
1198 sHealth = 0; | |
1199 if ( sMana > 0 ) | |
1200 sMana = 0; | |
1201 break; | |
1202 case Condition_Zombie: | |
1203 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1204 return 0; | |
1205 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1206 sHealth = GetMaxHealth(); | |
1207 sMana = 0; | |
1208 player_sex = 0; | |
1209 uPrevFace = uCurrentFace; | |
1210 uPrevVoiceID = uVoiceID; | |
1211 switch ( uVoiceID ) | |
1212 { | |
1213 case 0: | |
1214 case 1: | |
1215 case 2: | |
1216 case 3: | |
1217 case 8: | |
1218 case 9: | |
1219 case 12: | |
1220 case 13: | |
1221 case 16: | |
1222 case 17: | |
1223 case 20: | |
1224 case 23: | |
1225 player_sex = 0; | |
1226 break; | |
1227 case 4: | |
1228 case 5: | |
1229 case 6: | |
1230 case 7: | |
1231 case 10: | |
1232 case 11: | |
1233 case 14: | |
1234 case 15: | |
1235 case 18: | |
1236 case 19: | |
1237 case 21: | |
1238 case 24: | |
1239 player_sex = 1; | |
1240 break; | |
1241 default: | |
1242 break; | |
1243 } | |
1244 | |
1245 zombi_face = (player_sex != 0) + 23; | |
1246 uCurrentFace = zombi_face; | |
1247 uVoiceID = zombi_face; | |
1248 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1249 break; | |
0 | 1250 } |
1014 | 1251 |
1252 remainig_player = 0; | |
1253 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1254 players_after = 0; | |
1255 for (int i=1;i<5;++i) | |
0 | 1256 { |
1014 | 1257 |
1258 | |
1259 if ( pPlayers[i]->CanAct() ) | |
1260 { | |
1261 remainig_player=i; | |
1262 ++players_after; | |
1263 } | |
0 | 1264 } |
1014 | 1265 if (( players_before == 2 )&&( players_after == 1 )) |
1266 { | |
1267 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1268 } | |
1269 return 1; | |
1270 } | |
0 | 1271 |
1272 //----- (00492528) -------------------------------------------------------- | |
1273 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1274 { | |
973 | 1275 //unsigned int v3; // eax@1 |
0 | 1276 Texture *v4; // esi@1 |
1277 unsigned int v5; // ebx@1 | |
1278 signed int v6; // edi@5 | |
1279 int *v7; // ecx@6 | |
1280 signed int v8; // edx@7 | |
1281 int *v9; // eax@8 | |
973 | 1282 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1283 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1284 | |
973 | 1285 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1286 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1287 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1288 if ( !areWeLoadingTexture ) | |
1289 { | |
1290 v4->Release(); | |
1006 | 1291 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1292 } |
1293 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1294 { | |
1295 v6 = 0; | |
1296 if ( (signed int)uItemIDa <= 0 ) | |
1297 return 1; | |
973 | 1298 v7 = &pInventoryIndices[uSlot]; |
0 | 1299 while ( 1 ) |
1300 { | |
1301 v8 = 0; | |
1302 if ( (signed int)v5 > 0 ) | |
1303 break; | |
1304 LABEL_11: | |
1305 ++v6; | |
1306 v7 += 14; | |
1307 if ( v6 >= (signed int)uItemIDa ) | |
1308 return 1; | |
1309 } | |
1310 v9 = v7; | |
1311 while ( !*v9 ) | |
1312 { | |
1313 ++v8; | |
1314 ++v9; | |
1315 if ( v8 >= (signed int)v5 ) | |
1316 goto LABEL_11; | |
1317 } | |
1318 } | |
1319 return 0; | |
1320 } | |
1321 // 506128: using guessed type int areWeLoadingTexture; | |
1322 | |
1323 //----- (004925E6) -------------------------------------------------------- | |
1324 unsigned int Player::FindFreeInventorySlot() | |
1325 { | |
1326 unsigned int result; // eax@1 | |
1327 ItemGen *v2; // ecx@1 | |
1328 | |
1329 result = 0; | |
1330 v2 = this->pInventoryItems; | |
1331 while ( v2->uItemID ) | |
1332 { | |
1333 ++result; | |
1334 ++v2; | |
1335 if ( (signed int)result >= 126 ) | |
1336 return -1; | |
1337 } | |
1338 return result; | |
1339 } | |
1340 | |
1341 //----- (00492600) -------------------------------------------------------- | |
1342 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1343 { | |
1344 signed int v3; // edx@1 | |
1345 ItemGen *v4; // eax@1 | |
1346 int result; // eax@8 | |
1347 unsigned int v6; // ebx@10 | |
973 | 1348 //unsigned int v7; // eax@10 |
0 | 1349 Texture *v8; // esi@10 |
1350 void *v9; // esi@13 | |
1351 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1352 Player *v11; // [sp+4h] [bp-8h]@1 | |
1353 signed int v12; // [sp+8h] [bp-4h]@4 | |
1354 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1355 | |
1356 v11 = this; | |
1357 v3 = 0; | |
1358 v4 = this->pInventoryItems; | |
1359 while ( v4->uItemID ) | |
1360 { | |
1361 ++v3; | |
1362 ++v4; | |
1363 if ( v3 >= 126 ) | |
1364 { | |
1365 v12 = -1; | |
1366 goto LABEL_5; | |
1367 } | |
1368 } | |
1369 v12 = v3; | |
1370 LABEL_5: | |
1371 if ( v12 == -1 ) | |
1372 { | |
1373 if ( uActiveCharacter ) | |
201 | 1374 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1375 result = 0; |
1376 } | |
1377 else | |
1378 { | |
1379 v6 = uItemID; | |
973 | 1380 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1381 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1382 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1383 if ( !areWeLoadingTexture ) | |
1384 { | |
1385 v8->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1388 if ( (signed int)uItemIDa > 0 ) | |
1389 { | |
1390 v9 = &v11->pInventoryIndices[uSlot]; | |
1391 do | |
1392 { | |
1393 if ( (signed int)v10 > 0 ) | |
1394 memset32(v9, -1 - uSlot, v10); | |
1395 v9 = (char *)v9 + 56; | |
1396 --uItemIDa; | |
1397 } | |
1398 while ( uItemIDa ); | |
1399 } | |
1400 result = v12 + 1; | |
1401 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1402 v11->pInventoryItems[v12].uItemID = v6; | |
1403 } | |
1404 return result; | |
1405 } | |
1406 // 506128: using guessed type int areWeLoadingTexture; | |
1407 | |
1408 //----- (00492700) -------------------------------------------------------- | |
1409 int Player::HasSkill(unsigned int uSkillType) | |
1410 { | |
1411 signed int result; // eax@3 | |
1412 | |
1413 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1414 { | |
1415 result = 1; | |
1416 } | |
1417 else | |
1418 { | |
809 | 1419 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1420 ShowStatusBarString(pTmpBuf, 2u); |
1421 result = 0; | |
1422 } | |
1423 return result; | |
1424 } | |
1425 | |
1426 //----- (00492745) -------------------------------------------------------- | |
1427 int Player::WearItem(unsigned int uItemID) | |
1428 { | |
1010 | 1429 int item_body_anch; // edi@6 |
1430 int item_indx; | |
1431 //find empty slot | |
1432 for(item_indx=0;item_indx<126;++item_indx) | |
1433 if (pInventoryItems[item_indx].uItemID==0) | |
1434 break; | |
1435 if (item_indx==126) //not found | |
1436 item_indx=-1; | |
1437 | |
1438 if ( item_indx != -1 ) | |
1439 { | |
1440 | |
1441 pInventoryItems[item_indx].uItemID=uItemID; | |
1442 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1443 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1444 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1445 | |
0 | 1446 } |
1447 return 0; | |
1448 } | |
1449 | |
1450 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1451 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1452 { |
1453 signed int v3; // ebx@2 | |
1454 signed int v4; // edi@3 | |
1455 unsigned int v5; // esi@3 | |
1456 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1457 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1458 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1459 | |
1460 thisa = this; | |
1461 if ( uSlot == -1 ) | |
1462 { | |
1463 v3 = 0; | |
1014 | 1464 while ( true ) |
0 | 1465 { |
1466 v4 = 0; | |
1467 v5 = v3; | |
1468 do | |
1469 { | |
1470 if ( CanFitItem(v5, uItemID) ) | |
1471 { | |
1472 v8 = uItemID; | |
1473 v7 = v5; | |
1474 return CreateItemInInventory(v7, v8); | |
1475 } | |
1476 ++v4; | |
1477 v5 += 14; | |
1478 } | |
1479 while ( v4 < 9 ); | |
1480 ++v3; | |
1481 if ( v3 < 14 ) | |
1482 continue; | |
1483 break; | |
1484 } | |
1485 return 0; | |
1486 } | |
1487 if ( !CanFitItem(uSlot, uItemID) ) | |
1488 { | |
1489 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1490 return 0; | |
1491 } | |
1492 v8 = uItemID; | |
1493 v7 = uSlot; | |
1494 return CreateItemInInventory(v7, v8); | |
1495 } | |
1496 | |
1497 //----- (00492826) -------------------------------------------------------- | |
1014 | 1498 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1499 { |
1500 unsigned int v3; // ebx@1 | |
1501 unsigned int v4; // esi@3 | |
1502 signed int v5; // edi@3 | |
1503 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1504 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1505 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1506 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1507 | |
1508 thisa = this; | |
1509 v3 = Src->uItemID; | |
1510 pItemsTable->SetSpecialBonus(Src); | |
1511 if ( uSlot == -1 ) | |
1512 { | |
1513 uSlota = 0; | |
1014 | 1514 while ( true ) |
0 | 1515 { |
1516 v4 = uSlota; | |
1517 v5 = 0; | |
1518 do | |
1519 { | |
1520 if ( CanFitItem(v4, v3) ) | |
1521 { | |
1522 v8 = Src; | |
1523 v7 = v4; | |
1524 return CreateItemInInventory2(v7, v8); | |
1525 } | |
1526 ++v5; | |
1527 v4 += 14; | |
1528 } | |
1529 while ( v5 < 14 ); | |
1530 ++uSlota; | |
1531 if ( uSlota < 9 ) | |
1532 continue; | |
1533 break; | |
1534 } | |
1535 return 0; | |
1536 } | |
1537 if ( !CanFitItem(uSlot, v3) ) | |
1538 return 0; | |
1539 v8 = Src; | |
1540 v7 = uSlot; | |
1541 return CreateItemInInventory2(v7, v8); | |
1542 } | |
1543 | |
1544 //----- (0049289C) -------------------------------------------------------- | |
1545 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1546 { | |
1547 signed int v3; // ebx@1 | |
1548 ItemGen *v4; // eax@1 | |
1549 int result; // eax@6 | |
973 | 1550 //unsigned int v6; // eax@7 |
1014 | 1551 Texture *item_texture; // esi@7 |
0 | 1552 unsigned int v8; // edx@9 |
1014 | 1553 int *pInvPos; // esi@10 |
1554 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1555 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1556 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1557 |
0 | 1558 |
1559 v12 = this; | |
1560 v3 = 0; | |
1561 v4 = this->pInventoryItems; | |
1562 while ( v4->uItemID ) | |
1563 { | |
1564 ++v3; | |
1565 ++v4; | |
1566 if ( v3 >= 126 ) | |
1567 { | |
1568 v3 = -1; | |
1569 break; | |
1570 } | |
1571 } | |
1572 if ( v3 == -1 ) | |
1573 { | |
1574 result = 0; | |
1575 } | |
1576 else | |
1577 { | |
1014 | 1578 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1579 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1580 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1581 if ( !areWeLoadingTexture ) |
1582 { | |
1014 | 1583 item_texture->Release(); |
1006 | 1584 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1585 } |
1014 | 1586 if ( slot_height > 0 ) |
1587 { | |
1588 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1589 do |
1590 { | |
1014 | 1591 if ( slot_width > 0 ) |
1592 memset32(pInvPos, -1 - uSlot, slot_width); | |
1593 pInvPos +=14; | |
1594 --slot_height; | |
1595 } | |
1596 while ( slot_height ); | |
1597 } | |
1598 pInventoryIndices[uSlot] = v3 + 1; | |
1599 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1600 result = v3 + 1; |
1601 } | |
1602 return result; | |
1603 } | |
1604 // 506128: using guessed type int areWeLoadingTexture; | |
1605 | |
1606 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1607 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1608 { | |
973 | 1609 //Player *v4; // ebx@1 |
1610 //unsigned int v5; // eax@1 | |
1014 | 1611 Texture *item_texture; // esi@1 |
1612 int *pInvPos; // esi@4 | |
1613 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1614 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1615 | |
1616 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1617 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1618 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1619 if ( !areWeLoadingTexture ) |
1620 { | |
1014 | 1621 item_texture->Release(); |
1006 | 1622 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1623 } |
1014 | 1624 if ( (signed int)slot_height > 0 ) |
1625 { | |
1626 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1627 do |
1628 { | |
1014 | 1629 if ( (signed int)slot_width > 0 ) |
1630 memset32(pInvPos, -1 - uSlot, slot_width); | |
1631 pInvPos +=14; | |
1632 --slot_height; | |
1633 } | |
1634 while ( slot_height ); | |
1635 } | |
1636 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1637 return 1; |
1638 } | |
278 | 1639 |
0 | 1640 // 506128: using guessed type int areWeLoadingTexture; |
1641 | |
1642 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1643 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1644 { | |
1014 | 1645 |
1646 ItemGen *item_in_slot; // ecx@1 | |
1647 Texture *item_texture; // esi@1 | |
1648 unsigned int slot_height; // ebp@1 | |
1649 int *pInvPos; // edx@4 | |
1650 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1651 | |
1652 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1653 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1654 item_in_slot->Reset(); | |
1655 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1656 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1657 if ( !areWeLoadingTexture ) |
1658 { | |
1014 | 1659 item_texture->Release(); |
1006 | 1660 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1661 } |
1014 | 1662 if ( slot_height > 0 ) |
1663 { | |
1664 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1665 do |
1666 { | |
1014 | 1667 if (slot_width > 0 ) |
1668 memset32(pInvPos, 0, slot_width); | |
1669 pInvPos += 14; | |
1670 --slot_height; | |
1671 } | |
1672 while ( slot_height ); | |
0 | 1673 } |
1006 | 1674 |
0 | 1675 } |
1676 // 506128: using guessed type int areWeLoadingTexture; | |
1677 | |
436 | 1678 //identf |
0 | 1679 //----- (00490EEE) -------------------------------------------------------- |
917 | 1680 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1681 { | |
1682 int pSkillLevel; // eax@1 | |
1683 int NotBuy; // eax@1 | |
1684 int result; | |
1685 signed int pEquipType; // esi@1 | |
1686 float *pPriceMultiplier; // esi@26 | |
1687 int pPriceItemService; // edi@26 | |
1688 | |
1689 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1690 NotBuy = 4; | |
1691 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1692 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1693 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1694 return 5; |
917 | 1695 if ( building_type == BildingType_WeaponShop ) |
1696 { | |
1697 if ( pEquipType > EQUIP_BOW ) | |
1698 return NotBuy; | |
1699 if (pItem->Stolen()) | |
1700 return 6; | |
1701 } | |
1702 if ( building_type == BildingType_ArmorShop ) | |
1703 { | |
1704 if ( pEquipType < 3 && pEquipType > 9 ) | |
1705 return NotBuy; | |
1706 if (pItem->Stolen()) | |
1707 return 6; | |
1708 } | |
1709 if ( building_type == BildingType_MagicShop ) | |
1710 { | |
1711 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1712 { | |
1713 if (pItem->Stolen()) | |
1714 return 6; | |
1715 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1716 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1717 if ( ShopMenuType == 3 )//Sell | |
1718 { | |
1719 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1720 if (!pItem->Broken()) | |
1721 { | |
1722 if ( pSkillLevel ) | |
1723 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1724 else | |
1725 result = 1; | |
1726 return result; | |
1727 } | |
1728 pPriceItemService = 1; | |
1729 if ( pSkillLevel ) | |
1730 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1731 else | |
1732 result = 1; | |
1733 return result; | |
1734 } | |
1735 if ( ShopMenuType == 4 )//Identify | |
1736 { | |
1737 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1738 if ( pSkillLevel ) | |
1739 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1740 else | |
1741 result = 1; | |
1742 return result; | |
1743 } | |
1744 if ( ShopMenuType == 5 )//Repair | |
1745 { | |
1746 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1747 if ( pSkillLevel ) | |
1748 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1749 else | |
1750 result = 1; | |
1751 return result; | |
1752 } | |
1753 if ( ShopMenuType != 6 )//Buy and ??? | |
1754 { | |
1755 if ( pSkillLevel ) | |
1756 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1757 else | |
1758 result = 1; | |
1759 return result; | |
1760 } | |
1761 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1762 if (pItem->Broken()) | |
1763 pPriceItemService = 1; | |
1764 if ( pPriceItemService >= 1 ) | |
1765 { | |
1766 if ( pSkillLevel ) | |
1767 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1768 else | |
1769 result = 1; | |
1770 return result; | |
1771 } | |
1772 pPriceItemService = 1; | |
1773 if ( pSkillLevel ) | |
1774 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1775 else | |
1776 result = 1; | |
0 | 1777 return result; |
917 | 1778 } |
1779 if ( pEquipType != EQUIP_BOOK ) | |
1780 return NotBuy; | |
1781 } | |
1782 if ( building_type == BildingType_AlchemistShop ) | |
1783 { | |
1784 if ( pEquipType < EQUIP_REAGENT ) | |
1785 return NotBuy; | |
1786 if ( pEquipType > EQUIP_POTION ) | |
1787 { | |
1788 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1789 return NotBuy; | |
1790 } | |
1791 if (pItem->Stolen()) | |
1792 return 6; | |
1793 } | |
1794 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1795 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1796 if ( ShopMenuType == 3 )//Sell | |
1797 { | |
1798 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1799 if (!pItem->Broken()) | |
1800 { | |
1801 if ( pSkillLevel ) | |
1802 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1803 else | |
1804 result = 1; | |
0 | 1805 return result; |
917 | 1806 } |
1807 pPriceItemService = 1; | |
1808 if ( pSkillLevel ) | |
1809 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1810 else | |
1811 result = 1; | |
1812 return result; | |
1813 } | |
1814 if ( ShopMenuType == 4 )//Identify | |
1815 { | |
1816 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1817 if ( pSkillLevel ) | |
1818 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1819 else | |
1820 result = 1; | |
1821 return result; | |
1822 } | |
1823 if ( ShopMenuType == 5 )//Repair | |
1824 { | |
1825 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1826 if ( pSkillLevel ) | |
1827 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1828 else | |
1829 result = 1; | |
1830 return result; | |
1831 } | |
1832 if ( ShopMenuType != 6 )//Buy and ??? | |
1833 { | |
1834 if ( pSkillLevel ) | |
1835 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1836 else | |
1837 result = 1; | |
1838 return result; | |
1839 } | |
1840 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1841 if (pItem->Broken()) |
917 | 1842 pPriceItemService = 1; |
1843 if ( pPriceItemService >= 1 ) | |
1844 { | |
1845 if ( pSkillLevel ) | |
1846 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1847 else | |
1848 result = 1; | |
1849 return result; | |
1850 } | |
1851 pPriceItemService = 1; | |
1852 if ( pSkillLevel ) | |
1853 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1854 else |
1855 result = 1; | |
1856 return result; | |
1857 } | |
1858 | |
1859 //----- (0049107D) -------------------------------------------------------- | |
1860 int Player::GetBodybuilding() | |
1861 { | |
1010 | 1862 int v1; // al@1 |
0 | 1863 int v2; // ecx@1 |
1864 int v4; // eax@3 | |
1865 signed int v6; // [sp-4h] [bp-4h]@2 | |
1866 | |
1867 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1868 v2 = v1 & 0x3F; | |
1869 if ( v1 & 0x100 ) | |
1870 { | |
1871 v6 = 5; | |
1872 } | |
1873 else | |
1874 { | |
1008 | 1875 if ( (v1&0xFF) >= 0 ) |
0 | 1876 { |
1877 v4 = ((v1 & 0x40) != 0) + 1; | |
1878 return v2 * v4; | |
1879 } | |
1880 v6 = 3; | |
1881 } | |
1882 v4 = v6; | |
1883 return v2 * v4; | |
1884 } | |
1885 | |
1886 //----- (004910A8) -------------------------------------------------------- | |
607 | 1887 int Player::GetMeditation() |
0 | 1888 { |
1010 | 1889 int v1; // al@1 |
1008 | 1890 int base_level; // ecx@1 |
0 | 1891 int v4; // eax@3 |
1892 signed int v6; // [sp-4h] [bp-4h]@2 | |
1893 | |
1894 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1895 base_level = v1 & 0x3F; |
0 | 1896 if ( v1 & 0x100 ) |
1897 { | |
1898 v6 = 5; | |
1899 } | |
1900 else | |
1901 { | |
1008 | 1902 if ( (v1&0xFF) >= 0 ) |
0 | 1903 { |
1904 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1905 return base_level * v4; |
0 | 1906 } |
1907 v6 = 3; | |
1908 } | |
1909 v4 = v6; | |
1008 | 1910 return base_level * v4; |
0 | 1911 } |
1912 | |
1913 //----- (004910D3) -------------------------------------------------------- | |
1914 int Player::CanIdentify(ItemGen *pItem) | |
1915 { | |
1916 unsigned __int16 v2; // ax@1 | |
1917 unsigned __int16 v3; // bx@1 | |
1918 int uSkillMult; // eax@3 | |
1919 int v5; // edi@7 | |
1920 signed int v6; // ebp@7 | |
1921 char *v7; // esi@7 | |
1922 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1923 |
1924 if (CheckHiredNPCSpeciality(Scholar)) | |
1925 return true; | |
0 | 1926 |
179 | 1927 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1928 v3 = v2; |
179 | 1929 if ( v2 & 1 ) |
0 | 1930 { |
1931 uSkillMultiplier = 5; | |
1932 } | |
1933 else | |
1934 { | |
1935 if ( (v2 & 0x80u) == 0 ) | |
1936 { | |
1937 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1938 v5 = uSkillMult * (v3 & 0x3F); |
1939 v6 = 0; | |
1940 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1941 |
179 | 1942 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1943 v6 = 1; | |
1944 if ( v5 >= (unsigned __int8)v7[46] ) | |
1945 v6 = 1; | |
1946 return v6; | |
0 | 1947 } |
1948 uSkillMultiplier = 3; | |
1949 } | |
1950 uSkillMult = uSkillMultiplier; | |
1951 v5 = uSkillMult * (v3 & 0x3F); | |
1952 v6 = 0; | |
1953 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1954 |
0 | 1955 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1956 v6 = 1; | |
1957 if ( v5 >= (unsigned __int8)v7[46] ) | |
1958 v6 = 1; | |
1959 return v6; | |
1960 } | |
1961 | |
1962 //----- (00491151) -------------------------------------------------------- | |
1963 int Player::CanRepair(ItemGen *a2) | |
1964 { | |
1965 unsigned __int16 v2; // ax@1 | |
1966 unsigned __int16 v3; // bx@1 | |
1967 int v4; // eax@3 | |
1968 int v5; // edi@7 | |
1969 signed int v6; // ebp@7 | |
1970 signed int v10; // [sp-4h] [bp-14h]@2 | |
1971 | |
652 | 1972 |
1973 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1974 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1975 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1976 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1977 return true; | |
1978 | |
1010 | 1979 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1980 v3 = v2; |
1010 | 1981 if (v2 & 0x100 ) |
0 | 1982 { |
1983 v10 = 5; | |
1984 } | |
1985 else | |
1986 { | |
1987 if ( (v2 & 0x80u) == 0 ) | |
1988 { | |
1989 v4 = ((v2 & 0x40) != 0) + 1; | |
1990 goto LABEL_7; | |
1991 } | |
1992 v10 = 3; | |
1993 } | |
1994 v4 = v10; | |
1995 LABEL_7: | |
1996 v5 = v4 * (v3 & 0x3F); | |
1997 v6 = 0; | |
1998 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1999 return true; | |
2000 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2001 { | |
2002 __debugbreak(); // really odd | |
2003 return true; | |
2004 } | |
2005 return false; | |
2006 } | |
2007 | |
2008 //----- (004911F3) -------------------------------------------------------- | |
2009 int Player::GetMerchant() | |
2010 { | |
2011 Player *v1; // edi@1 | |
2012 unsigned __int16 v2; // ax@1 | |
2013 unsigned __int16 v3; // bx@1 | |
2014 int v4; // esi@1 | |
2015 int v5; // edi@1 | |
2016 int v7; // eax@3 | |
2017 int v8; // ecx@7 | |
2018 signed int v9; // [sp-4h] [bp-10h]@6 | |
2019 | |
2020 v1 = this; | |
607 | 2021 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2022 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2023 v4 = v2 & 0x003F; |
1010 | 2024 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2025 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2026 return 10000; | |
2027 v7 = GetPartyReputation(); | |
2028 if ( !v4 ) | |
2029 return -v7; | |
1010 | 2030 if ( v3 & 0x100 ) |
0 | 2031 { |
2032 v9 = 5; | |
2033 } | |
2034 else | |
2035 { | |
2036 if ( (v3 & 0x80u) == 0 ) | |
2037 { | |
2038 v8 = ((v3 & 0x40) != 0) + 1; | |
2039 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2040 } | |
2041 v9 = 3; | |
2042 } | |
2043 v8 = v9; | |
2044 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2045 } | |
2046 | |
2047 //----- (0049125A) -------------------------------------------------------- | |
2048 int Player::GetPerception() | |
2049 { | |
2050 Player *v1; // edi@1 | |
2051 unsigned __int16 v2; // ax@1 | |
2052 unsigned __int16 v3; // bx@1 | |
2053 int v4; // esi@1 | |
2054 int v5; // edi@1 | |
2055 int v7; // eax@5 | |
2056 signed int v8; // [sp-4h] [bp-10h]@4 | |
2057 | |
2058 v1 = this; | |
1010 | 2059 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2060 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2061 v4 = v2 & 0x3F; |
1010 | 2062 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2063 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2064 return 10000; | |
1010 | 2065 if ( v3 & 0x100 ) |
0 | 2066 { |
2067 v8 = 5; | |
2068 } | |
2069 else | |
2070 { | |
2071 if ( (v3 & 0x80u) == 0 ) | |
2072 { | |
2073 v7 = ((v3 & 0x40) != 0) + 1; | |
2074 return v4 + v5 * (v7 - 1); | |
2075 } | |
2076 v8 = 3; | |
2077 } | |
2078 v7 = v8; | |
2079 return v4 + v5 * (v7 - 1); | |
2080 } | |
2081 | |
2082 //----- (004912B0) -------------------------------------------------------- | |
2083 int Player::GetDisarmTrap() | |
2084 { | |
2085 Player *v1; // ebp@1 | |
2086 unsigned __int16 v2; // ax@1 | |
2087 unsigned __int16 v3; // bx@1 | |
2088 int v4; // esi@1 | |
2089 int v5; // edi@1 | |
2090 int v7; // eax@7 | |
2091 signed int v8; // [sp-4h] [bp-14h]@6 | |
2092 | |
2093 v1 = this; | |
1010 | 2094 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2095 v3 = v1->pActiveSkills[29]; |
2096 v4 = v2 & 0x3F; | |
2097 v5 = v1->pActiveSkills[29] & 0x3F; | |
2098 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2099 return 10000; | |
2100 if ( HasEnchantedItemEquipped(35) ) | |
2101 v4 *= 2; | |
1010 | 2102 if ( v3 & 0x100 ) |
0 | 2103 { |
2104 v8 = 5; | |
2105 } | |
2106 else | |
2107 { | |
2108 if ( (v3 & 0x80u) == 0 ) | |
2109 { | |
2110 v7 = ((v3 & 0x40) != 0) + 1; | |
2111 return v4 + v5 * (v7 - 1); | |
2112 } | |
2113 v8 = 3; | |
2114 } | |
2115 v7 = v8; | |
2116 return v4 + v5 * (v7 - 1); | |
2117 } | |
2118 | |
2119 //----- (00491317) -------------------------------------------------------- | |
2120 char Player::GetLearningPercent() | |
2121 { | |
2122 Player *v1; // esi@1 | |
2123 int v2; // eax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // ecx@1 | |
2126 int v5; // eax@4 | |
2127 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2128 | |
2129 v1 = this; | |
1010 | 2130 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2131 v3 = v1->pActiveSkills[36]; |
2132 v4 = v2 & 0x3F; | |
2133 if ( v2 ) | |
2134 { | |
1010 | 2135 if (v3 & 0x100 ) |
0 | 2136 { |
2137 v7 = 5; | |
2138 } | |
2139 else | |
2140 { | |
2141 if ( (v3 & 0x80u) == 0 ) | |
2142 { | |
2143 v5 = ((v3 & 0x40) != 0) + 1; | |
2144 goto LABEL_8; | |
2145 } | |
2146 v7 = 3; | |
2147 } | |
2148 v5 = v7; | |
2149 LABEL_8: | |
2150 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2151 } | |
2152 return v2; | |
2153 } | |
2154 | |
2155 //----- (0048C6AF) -------------------------------------------------------- | |
2156 Player::Player() | |
2157 { | |
2158 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2159 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2160 for (uint i = 0; i < 126; ++i) | |
2161 pInventoryItems[i].Reset(); | |
2162 for (uint i = 0; i < 12; ++i) | |
2163 pEquippedItems[i].Reset(); | |
2164 | |
2165 | |
2166 for (uint i = 0; i < 24; ++i) | |
2167 { | |
2168 pPlayerBuffs[i].uSkill = 0; | |
2169 pPlayerBuffs[i].uSkill = 0; | |
2170 pPlayerBuffs[i].uPower = 0; | |
2171 pPlayerBuffs[i].uExpireTime = 0; | |
2172 pPlayerBuffs[i].uCaster = 0; | |
2173 pPlayerBuffs[i].uFlags = 0; | |
2174 } | |
2175 | |
2176 pName[0] = 0; | |
1014 | 2177 uCurrentFace = 0; |
0 | 2178 uVoiceID = 0; |
2179 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2180 | |
2181 field_BB = 0; | |
2182 | |
2183 uMight = uMightBonus = 0; | |
2184 uIntelligence = uIntelligenceBonus = 0; | |
2185 uWillpower = uWillpowerBonus = 0; | |
2186 uEndurance = uEnduranceBonus = 0; | |
2187 uSpeed = uSpeedBonus = 0; | |
2188 uAccuracy = uAccuracyBonus = 0; | |
2189 uLuck = uLuckBonus = 0; | |
2190 uLevel = sLevelModifier = 0; | |
2191 sAgeModifier = 0; | |
2192 | |
2193 memset(field_1F5, 0, 30); | |
2194 | |
2195 sResFireBase = sResFireBonus = 0; | |
2196 sResAirBase = sResAirBonus = 0; | |
2197 sResWaterBase = sResWaterBonus = 0; | |
2198 sResEarthBase = sResEarthBonus = 0; | |
2199 sResMagicBase = sResMagicBonus = 0; | |
2200 sResSpiritBase = sResSpiritBonus = 0; | |
2201 sResMindBase = sResMindBonus = 0; | |
2202 sResBodyBase = sResBodyBonus = 0; | |
2203 sResLightBase = sResLightBonus = 0; | |
2204 sResDarkBase = sResDarkBonus = 0; | |
2205 | |
2206 uTimeToRecovery = 0; | |
2207 | |
2208 uSkillPoints = 0; | |
2209 | |
2210 sHealth = 0; | |
2211 uFullHealthBonus = 0; | |
2212 _health_related = 0; | |
2213 | |
2214 sMana = 0; | |
2215 uFullManaBonus = 0; | |
2216 _mana_related = 0; | |
2217 | |
2218 uQuickSpell = 0; | |
2219 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2220 | |
2221 _some_attack_bonus = 0; | |
2222 field_1A91 = 0; | |
2223 _melee_dmg_bonus = 0; | |
2224 field_1A93 = 0; | |
2225 _ranged_atk_bonus = 0; | |
2226 field_1A95 = 0; | |
2227 _ranged_dmg_bonus = 0; | |
2228 field_1A97 = 0; | |
2229 | |
130 | 2230 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2231 uExpressionTimePassed = 0; |
2232 uExpressionTimeLength = 0; | |
2233 | |
2234 uNumDivineInterventionCastsThisDay = 0; | |
2235 uNumArmageddonCasts = 0; | |
2236 uNumFireSpikeCasts = 0; | |
2237 | |
2238 memset(field_1988, 0, 49 * sizeof(int)); | |
2239 memset(field_1A50, 0, 64 * sizeof(char)); | |
2240 | |
2241 field_E0 = 0; | |
2242 field_E4 = 0; | |
2243 field_E8 = 0; | |
2244 field_EC = 0; | |
2245 field_F0 = 0; | |
2246 field_F4 = 0; | |
2247 field_F8 = 0; | |
2248 field_FC = 0; | |
2249 field_100 = 0; | |
2250 field_104 = 0; | |
198 | 2251 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2252 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2253 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2254 |
198 | 2255 lastOpenedSpellbookPage = 0; |
0 | 2256 } |
2257 | |
2258 //----- (0048C6F6) -------------------------------------------------------- | |
2259 bool Party::AddItem(ItemGen *pItem) | |
2260 { | |
2261 unsigned int v2; // eax@1 | |
2262 unsigned int v3; // ecx@4 | |
2263 signed int v4; // edx@4 | |
2264 char *v5; // eax@8 | |
973 | 2265 //unsigned int v6; // eax@10 |
0 | 2266 Texture *v7; // ebx@10 |
2267 signed int v8; // esi@10 | |
2268 Player *v9; // edi@11 | |
2269 int v10; // eax@11 | |
2270 bool result; // eax@15 | |
2271 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2272 |
2273 | |
188 | 2274 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2275 //int v16; // [sp+10h] [bp-18h]@3 | |
2276 //int v17; // [sp+14h] [bp-14h]@3 | |
2277 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2278 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2279 Party *v20; // [sp+20h] [bp-8h]@1 | |
2280 int v21; // [sp+24h] [bp-4h]@10 | |
2281 | |
2282 auto thos = this; | |
2283 | |
2284 v20 = thos; | |
2285 v2 = pItem->uItemID; | |
222 | 2286 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2287 pItem->SetIdentified(); |
188 | 2288 ///v15 = 0; |
2289 //v16 = 1; | |
2290 //v18 = 3; | |
2291 //v17 = 2; | |
0 | 2292 if ( uActiveCharacter ) |
2293 { | |
2294 v3 = uActiveCharacter - 1; | |
2295 v4 = 0; | |
2296 do | |
2297 { | |
188 | 2298 v15[v4++] = v3++; |
0 | 2299 if ( (signed int)v3 >= 4 ) |
2300 v3 = 0; | |
2301 } | |
2302 while ( v4 < 4 ); | |
2303 } | |
2304 v5 = pItemsTable->pItems[v2].pIconName; | |
2305 if ( v5 ) | |
2306 { | |
973 | 2307 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2308 v21 = areWeLoadingTexture; |
2309 v8 = 0; | |
2310 while ( 1 ) | |
2311 { | |
188 | 2312 v9 = &v20->pPlayers[v15[v8]]; |
2313 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2314 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2315 if ( v10 ) |
2316 break; | |
2317 ++v8; | |
2318 if ( v8 >= 4 ) | |
2319 { | |
2320 if ( !v21 ) | |
2321 { | |
2322 v7->Release(); | |
1006 | 2323 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2324 } |
2325 goto LABEL_15; | |
2326 } | |
2327 } | |
232 | 2328 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2329 pItem->Reset(); |
2330 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2331 v19->PlaySound(SPEECH_60, 0); |
0 | 2332 if ( !v21 ) |
2333 { | |
2334 v7->Release(); | |
1006 | 2335 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2336 } |
2337 result = 1; | |
2338 } | |
2339 else | |
2340 { | |
2341 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2342 LABEL_15: | |
2343 result = 0; | |
2344 } | |
2345 return result; | |
2346 } | |
2347 // 506128: using guessed type int areWeLoadingTexture; | |
2348 | |
2349 //----- (0048C855) -------------------------------------------------------- | |
2350 int Player::GetBaseStrength() | |
2351 { | |
2352 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2353 } | |
2354 | |
2355 //----- (0048C86C) -------------------------------------------------------- | |
2356 int Player::GetBaseIntelligence() | |
2357 { | |
2358 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2359 } | |
2360 | |
2361 //----- (0048C883) -------------------------------------------------------- | |
2362 int Player::GetBaseWillpower() | |
2363 { | |
2364 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2365 } | |
2366 | |
2367 //----- (0048C89A) -------------------------------------------------------- | |
2368 int Player::GetBaseEndurance() | |
2369 { | |
2370 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2371 } | |
2372 | |
2373 //----- (0048C8B1) -------------------------------------------------------- | |
2374 int Player::GetBaseAccuracy() | |
2375 { | |
2376 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2377 } | |
2378 | |
2379 //----- (0048C8C8) -------------------------------------------------------- | |
2380 int Player::GetBaseSpeed() | |
2381 { | |
2382 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2383 } | |
2384 | |
2385 //----- (0048C8DF) -------------------------------------------------------- | |
2386 int Player::GetBaseLuck() | |
2387 { | |
2388 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2389 } | |
2390 | |
2391 //----- (0048C8F6) -------------------------------------------------------- | |
2392 int Player::GetBaseLevel() | |
2393 { | |
2394 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2395 } | |
2396 | |
2397 //----- (0048C90D) -------------------------------------------------------- | |
2398 int Player::GetActualLevel() | |
2399 { | |
2400 return uLevel + sLevelModifier + | |
2401 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2402 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2403 } | |
2404 | |
2405 //----- (0048C93C) -------------------------------------------------------- | |
2406 int Player::GetActualMight() | |
2407 { | |
2408 Player *v1; // esi@1 | |
2409 unsigned int v2; // eax@1 | |
2410 signed int v3; // ecx@1 | |
2411 signed int v4; // ebx@4 | |
2412 int v5; // edi@5 | |
2413 int v6; // ST14_4@5 | |
2414 | |
2415 v1 = this; | |
2416 v2 = this->sAgeModifier + GetBaseAge(); | |
2417 v3 = 0; | |
2418 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2419 { | |
2420 ++v3; | |
2421 if ( v3 >= 4 ) | |
2422 { | |
2423 v4 = 100; | |
2424 goto LABEL_5; | |
2425 } | |
2426 } | |
2427 v4 = pAgeingStrengthMultiplier[v3]; | |
2428 LABEL_5: | |
2429 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2430 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2431 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2432 } | |
2433 | |
2434 //----- (0048C9C2) -------------------------------------------------------- | |
2435 int Player::GetActualIntelligence() | |
2436 { | |
2437 Player *v1; // esi@1 | |
2438 unsigned int sAge; // eax@1 | |
2439 signed int uAgeLevel; // ecx@1 | |
2440 signed int v4; // ebx@4 | |
2441 int v5; // edi@5 | |
2442 int v6; // ebp@5 | |
2443 | |
2444 v1 = this; | |
2445 sAge = this->sAgeModifier + GetBaseAge(); | |
2446 uAgeLevel = 0; | |
2447 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2448 { | |
2449 ++uAgeLevel; | |
2450 if ( uAgeLevel >= 4 ) | |
2451 { | |
2452 v4 = 100; | |
2453 goto LABEL_5; | |
2454 } | |
2455 } | |
2456 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2457 LABEL_5: | |
2458 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2459 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2460 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2461 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2462 + v6 | |
2463 + v1->uIntelligenceBonus; | |
2464 } | |
2465 | |
2466 //----- (0048CA3F) -------------------------------------------------------- | |
2467 int Player::GetActualWillpower() | |
2468 { | |
2469 int v5; // edi@5 | |
2470 | |
2471 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2472 uint uAgeingMultiplier = 100; | |
2473 for (uint i = 0; i < 4; ++i) | |
2474 if (uActualAge >= pAgeingTable[i]) | |
2475 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2476 else break; | |
2477 | |
2478 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2479 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2480 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2481 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2482 + uWillpowerBonus; | |
2483 } | |
2484 | |
2485 //----- (0048CABC) -------------------------------------------------------- | |
2486 int Player::GetActualEndurance() | |
2487 { | |
2488 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2489 uint uAgeingMultiplier = 100; | |
2490 for (uint i = 0; i < 4; ++i) | |
2491 if (uActualAge >= pAgeingTable[i]) | |
2492 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2493 else break; | |
2494 | |
2495 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2496 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2497 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2498 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2499 + uItemBonus | |
2500 + uEnduranceBonus; | |
2501 } | |
2502 | |
2503 //----- (0048CB39) -------------------------------------------------------- | |
2504 int Player::GetActualAccuracy() | |
2505 { | |
2506 Player *v1; // esi@1 | |
2507 unsigned int v2; // eax@1 | |
2508 signed int v3; // ecx@1 | |
2509 signed int v4; // ebx@4 | |
2510 int v5; // edi@5 | |
2511 int v6; // ebp@5 | |
2512 | |
2513 v1 = this; | |
2514 v2 = this->sAgeModifier + GetBaseAge(); | |
2515 v3 = 0; | |
2516 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2517 { | |
2518 ++v3; | |
2519 if ( v3 >= 4 ) | |
2520 { | |
2521 v4 = 100; | |
2522 goto LABEL_5; | |
2523 } | |
2524 } | |
2525 v4 = pAgeingAccuracyMultiplier[v3]; | |
2526 LABEL_5: | |
2527 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2528 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2529 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2530 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2531 + v6 | |
2532 + v1->uAccuracyBonus; | |
2533 } | |
2534 | |
2535 //----- (0048CBB6) -------------------------------------------------------- | |
2536 int Player::GetActualSpeed() | |
2537 { | |
2538 Player *v1; // esi@1 | |
2539 unsigned int v2; // eax@1 | |
2540 signed int v3; // ecx@1 | |
2541 signed int v4; // ebx@4 | |
2542 int v5; // edi@5 | |
2543 int v6; // ebp@5 | |
2544 | |
2545 v1 = this; | |
2546 v2 = this->sAgeModifier + GetBaseAge(); | |
2547 v3 = 0; | |
2548 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2549 { | |
2550 ++v3; | |
2551 if ( v3 >= 4 ) | |
2552 { | |
2553 v4 = 100; | |
2554 goto LABEL_5; | |
2555 } | |
2556 } | |
2557 v4 = pAgeingSpeedMultiplier[v3]; | |
2558 LABEL_5: | |
2559 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2560 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2561 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2562 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2563 + v6 | |
2564 + v1->uSpeedBonus; | |
2565 } | |
2566 | |
2567 //----- (0048CC33) -------------------------------------------------------- | |
2568 int Player::GetActualLuck() | |
2569 { | |
2570 Player *v1; // esi@1 | |
2571 unsigned int v2; // eax@7 | |
2572 signed int v3; // ecx@7 | |
2573 signed int v4; // ebx@10 | |
2574 int v5; // edi@11 | |
2575 int v6; // ebp@11 | |
2576 signed int v8; // [sp+10h] [bp-4h]@1 | |
2577 | |
2578 v8 = 0; | |
2579 v1 = this; | |
652 | 2580 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2581 v8 = 5; |
652 | 2582 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2583 v8 += 20; |
652 | 2584 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2585 v8 += 10; |
2586 v2 = v1->sAgeModifier + GetBaseAge(); | |
2587 v3 = 0; | |
2588 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2589 { | |
2590 ++v3; | |
2591 if ( v3 >= 4 ) | |
2592 { | |
2593 v4 = 100; | |
2594 goto LABEL_11; | |
2595 } | |
2596 } | |
2597 v4 = pAgeingLuckMultiplier[v3]; | |
2598 LABEL_11: | |
2599 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2600 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2601 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2602 + v6 | |
2603 + v8 | |
2604 + v5 * v4 * v1->uLuck / 100 / 100 | |
2605 + v1->uLuckBonus; | |
2606 } | |
2607 | |
2608 //----- (0048CCF5) -------------------------------------------------------- | |
2609 int Player::GetActualAttack(int a2) | |
2610 { | |
2611 Player *v2; // esi@1 | |
2612 int v3; // eax@1 | |
2613 int v4; // edi@1 | |
2614 int v5; // ebx@1 | |
2615 int v6; // ebp@1 | |
2616 | |
2617 v2 = this; | |
2618 v3 = GetActualAccuracy(); | |
2619 v4 = _48EA1B_get_static_effect(v3); | |
2620 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2621 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2622 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2623 } | |
2624 | |
2625 //----- (0048CD45) -------------------------------------------------------- | |
2626 int Player::GetMeleeDamageMinimal() | |
2627 { | |
2628 Player *v1; // edi@1 | |
2629 int v2; // eax@1 | |
2630 int v3; // esi@1 | |
2631 int v4; // esi@1 | |
2632 int v5; // esi@1 | |
2633 int v6; // esi@1 | |
2634 signed int result; // eax@1 | |
2635 | |
2636 v1 = this; | |
2637 v2 = GetActualMight(); | |
2638 v3 = _48EA1B_get_static_effect(v2); | |
2639 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2640 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2641 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2642 result = 1; | |
2643 if ( v6 >= 1 ) | |
2644 result = v6; | |
2645 return result; | |
2646 } | |
2647 | |
2648 //----- (0048CD90) -------------------------------------------------------- | |
2649 int Player::GetMeleeDamageMaximal() | |
2650 { | |
2651 Player *v1; // edi@1 | |
2652 int v2; // eax@1 | |
2653 int v3; // esi@1 | |
2654 int v4; // esi@1 | |
2655 int v5; // esi@1 | |
2656 int v6; // esi@1 | |
2657 signed int result; // eax@1 | |
2658 | |
2659 v1 = this; | |
2660 v2 = GetActualMight(); | |
2661 v3 = _48EA1B_get_static_effect(v2); | |
2662 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2663 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2664 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2665 result = 1; | |
2666 if ( v6 >= 1 ) | |
2667 result = v6; | |
2668 return result; | |
2669 } | |
2670 | |
2671 //----- (0048CDDB) -------------------------------------------------------- | |
2672 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2673 { | |
2674 int v4; // esi@1 | |
2675 Player *v5; // edi@1 | |
2676 ItemGen *v6; // ebx@4 | |
2677 unsigned int v7; // ebp@4 | |
2678 unsigned int v8; // esi@4 | |
2679 int v9; // eax@4 | |
2680 int v10; // eax@9 | |
2681 char v11; // zf@9 | |
2682 int v12; // esi@10 | |
2683 int v13; // eax@11 | |
2684 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2685 ItemGen *v15; // ebx@35 | |
2686 unsigned int v16; // ebp@35 | |
2687 unsigned int v17; // esi@35 | |
2688 int v18; // edx@38 | |
2689 int v19; // eax@40 | |
2690 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2691 int v21; // esi@62 | |
2692 int v22; // eax@63 | |
2693 int v23; // ebx@63 | |
2694 int v24; // ebx@63 | |
2695 signed int result; // eax@64 | |
2696 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2697 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2698 int v28; // [sp+10h] [bp-10h]@1 | |
2699 int v29; // [sp+10h] [bp-10h]@33 | |
2700 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2701 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2702 int v32; // [sp+18h] [bp-8h]@1 | |
2703 int v33; // [sp+18h] [bp-8h]@8 | |
2704 int v34; // [sp+1Ch] [bp-4h]@1 | |
2705 int v35; // [sp+28h] [bp+8h]@37 | |
2706 | |
2707 v4 = 0; | |
2708 v5 = this; | |
2709 v34 = 0; | |
2710 v32 = 0; | |
2711 v28 = 0; | |
2712 if ( IsUnarmed() == 1 ) | |
2713 { | |
2714 v32 = rand() % 3 + 1; | |
2715 LABEL_61: | |
2716 v34 = v4; | |
2717 goto LABEL_62; | |
2718 } | |
816 | 2719 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2720 { |
232 | 2721 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2722 v7 = v6->uItemID; |
2723 v8 = v6->uItemID; | |
2724 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2725 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2726 ++v9; |
2727 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2728 if ( v9 > 0 ) | |
2729 { | |
2730 v33 = v9; | |
2731 do | |
2732 { | |
2733 v10 = rand(); | |
2734 v11 = v33-- == 1; | |
2735 v28 += v10 % v30 + 1; | |
2736 } | |
2737 while ( !v11 ); | |
2738 } | |
2739 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2740 if ( !uTargetActorID ) | |
2741 goto LABEL_28; | |
377 | 2742 v13 = v6->uSpecEnchantmentType; |
0 | 2743 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2744 { | |
2745 v14 = (MONSTER_SUPERTYPE)1; | |
2746 } | |
2747 else | |
2748 { | |
2749 if ( v13 == 39 ) | |
2750 { | |
2751 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2752 } | |
2753 else | |
2754 { | |
2755 if ( v13 == 40 ) | |
2756 { | |
2757 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2758 } | |
2759 else | |
2760 { | |
2761 if ( v13 == 63 || v7 == 517 ) | |
2762 { | |
2763 v26 = MONSTER_SUPERTYPE_ELF; | |
2764 } | |
2765 else | |
2766 { | |
2767 if ( v13 != 65 ) | |
2768 { | |
2769 LABEL_28: | |
2770 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2771 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2772 && rand() % 100 < 10 ) | |
2773 v12 *= 3; | |
2774 v32 = v12; | |
2775 goto LABEL_33; | |
2776 } | |
2777 v26 = MONSTER_SUPERTYPE_TITAN; | |
2778 } | |
2779 } | |
2780 } | |
2781 v14 = v26; | |
2782 } | |
2783 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2784 v12 *= 2; | |
2785 goto LABEL_28; | |
2786 } | |
2787 LABEL_33: | |
2788 v29 = 0; | |
2789 if ( !a3 ) | |
2790 { | |
2791 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2792 { | |
898 | 2793 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2794 v16 = v15->uItemID; |
2795 v17 = v15->uItemID; | |
2796 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2797 { | |
2798 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2799 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2800 { | |
2801 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2802 do | |
2803 { | |
2804 v18 = rand() % v31; | |
2805 v11 = v35-- == 1; | |
2806 v29 += v18 + 1; | |
2807 } | |
2808 while ( !v11 ); | |
2809 } | |
2810 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2811 if ( !uTargetActorID ) | |
2812 goto LABEL_57; | |
377 | 2813 v19 = v15->uSpecEnchantmentType; |
0 | 2814 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2815 { | |
2816 v20 = (MONSTER_SUPERTYPE)1; | |
2817 } | |
2818 else | |
2819 { | |
2820 if ( v19 == 39 ) | |
2821 { | |
2822 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2823 } | |
2824 else | |
2825 { | |
2826 if ( v19 == 40 ) | |
2827 { | |
2828 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2829 } | |
2830 else | |
2831 { | |
2832 if ( v19 == 63 || v16 == 517 ) | |
2833 { | |
2834 v27 = MONSTER_SUPERTYPE_ELF; | |
2835 } | |
2836 else | |
2837 { | |
2838 if ( v19 != 65 ) | |
2839 { | |
2840 LABEL_57: | |
2841 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2842 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2843 && rand() % 100 < 10 ) | |
2844 v4 *= 3; | |
2845 goto LABEL_61; | |
2846 } | |
2847 v27 = MONSTER_SUPERTYPE_TITAN; | |
2848 } | |
2849 } | |
2850 } | |
2851 v20 = v27; | |
2852 } | |
2853 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2854 v4 *= 2; | |
2855 goto LABEL_57; | |
2856 } | |
2857 } | |
2858 } | |
2859 LABEL_62: | |
2860 v21 = v32 + v34; | |
2861 if ( !a2 ) | |
2862 { | |
2863 v22 = GetActualMight(); | |
2864 v23 = _48EA1B_get_static_effect(v22); | |
2865 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2866 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2867 } | |
2868 result = 1; | |
2869 if ( v21 >= 1 ) | |
2870 result = v21; | |
2871 return result; | |
2872 } | |
2873 | |
2874 //----- (0048D0B9) -------------------------------------------------------- | |
2875 int Player::GetRangedAttack() | |
2876 { | |
2877 Player *v1; // esi@1 | |
2878 int v2; // eax@1 | |
2879 int v3; // edi@3 | |
2880 int v4; // eax@4 | |
2881 int v5; // edi@4 | |
2882 int v6; // edi@4 | |
2883 int v7; // edi@4 | |
2884 | |
2885 v1 = this; | |
232 | 2886 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2887 if ( v2 < 64 || v2 > 65 ) |
2888 { | |
2889 v4 = GetActualAccuracy(); | |
2890 v5 = _48EA1B_get_static_effect(v4); | |
2891 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2892 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2893 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2894 } | |
2895 else | |
2896 { | |
2897 v3 = GetActualAttack(1); | |
2898 } | |
2899 return v3; | |
2900 } | |
2901 | |
2902 //----- (0048D124) -------------------------------------------------------- | |
2903 int Player::GetRangedDamageMin() | |
2904 { | |
2905 Player *v1; // esi@1 | |
2906 int v2; // edi@1 | |
2907 int v3; // edi@1 | |
2908 int v4; // edi@1 | |
2909 unsigned __int16 v5; // ax@1 | |
2910 int result; // eax@6 | |
2911 | |
2912 v1 = this; | |
2913 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2914 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2915 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2916 v5 = v1->pActiveSkills[5]; | |
2917 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2918 v4 += v1->pActiveSkills[5] & 0x3F; | |
2919 if ( v4 >= 1 ) | |
2920 result = v4; | |
2921 else | |
2922 result = 0; | |
2923 return result; | |
2924 } | |
2925 | |
2926 //----- (0048D191) -------------------------------------------------------- | |
2927 int Player::GetRangedDamageMax() | |
2928 { | |
2929 Player *v1; // esi@1 | |
2930 int v2; // edi@1 | |
2931 int v3; // edi@1 | |
2932 int v4; // edi@1 | |
2933 unsigned __int16 v5; // ax@1 | |
2934 int result; // eax@6 | |
2935 | |
2936 v1 = this; | |
2937 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
2938 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2939 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2940 v5 = v1->pActiveSkills[5]; | |
2941 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2942 v4 += v1->pActiveSkills[5] & 0x3F; | |
2943 if ( v4 >= 1 ) | |
2944 result = v4; | |
2945 else | |
2946 result = 0; | |
2947 return result; | |
2948 } | |
2949 | |
2950 //----- (0048D1FE) -------------------------------------------------------- | |
2951 bool Player::CalculateRangedDamageTo(int a2) | |
2952 { | |
2953 Player *v2; // ebx@1 | |
2954 bool result; // eax@1 | |
2955 ItemGen *v4; // ebx@2 | |
2956 unsigned int v5; // edi@2 | |
2957 unsigned int v6; // esi@2 | |
2958 int v7; // edx@4 | |
2959 char v8; // zf@4 | |
2960 int v9; // esi@5 | |
2961 int v10; // ebx@6 | |
2962 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2963 unsigned __int16 v12; // ax@19 | |
2964 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2965 Player *v14; // [sp+4h] [bp-10h]@1 | |
2966 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2967 int v16; // [sp+Ch] [bp-8h]@3 | |
2968 int v17; // [sp+10h] [bp-4h]@1 | |
2969 | |
2970 v17 = 0; | |
2971 v2 = this; | |
2972 v14 = this; | |
2973 result = HasItemEquipped(EQUIP_BOW); | |
2974 if ( !result ) | |
2975 return result; | |
232 | 2976 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2977 v5 = v4->uItemID; |
2978 v6 = v4->uItemID; | |
2979 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2980 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2981 { | |
2982 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2983 do | |
2984 { | |
2985 v7 = rand() % v15; | |
2986 v8 = v16-- == 1; | |
2987 v17 += v7 + 1; | |
2988 } | |
2989 while ( !v8 ); | |
2990 } | |
2991 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2992 if ( a2 ) | |
2993 { | |
377 | 2994 v10 = v4->uSpecEnchantmentType; |
0 | 2995 if ( v10 == 64 ) |
2996 { | |
2997 v11 = (MONSTER_SUPERTYPE)1; | |
2998 goto LABEL_17; | |
2999 } | |
3000 if ( v10 == 39 || v5 == 508 ) | |
3001 { | |
3002 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3003 goto LABEL_16; | |
3004 } | |
3005 if ( v10 == 40 ) | |
3006 { | |
3007 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3008 goto LABEL_16; | |
3009 } | |
3010 if ( v10 == 63 || v5 == 517 ) | |
3011 { | |
3012 v13 = MONSTER_SUPERTYPE_ELF; | |
3013 LABEL_16: | |
3014 v11 = v13; | |
3015 LABEL_17: | |
3016 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3017 v9 *= 2; | |
3018 goto LABEL_19; | |
3019 } | |
3020 } | |
3021 LABEL_19: | |
3022 v12 = v14->pActiveSkills[5]; | |
3023 if ( v12 ) | |
3024 { | |
3025 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3026 v9 += v14->pActiveSkills[5] & 0x3F; | |
3027 } | |
3028 return v9; | |
3029 } | |
3030 | |
3031 //----- (0048D2EA) -------------------------------------------------------- | |
3032 char *Player::GetMeleeDamageString() | |
3033 { | |
3034 Player *v1; // esi@1 | |
3035 signed int v2; // eax@1 | |
3036 signed int v3; // edi@3 | |
3037 signed int v4; // eax@3 | |
3038 signed int v5; // ST0C_4@6 | |
3039 char *v6; // edi@6 | |
3040 signed int v7; // ST08_4@7 | |
3041 unsigned int v8; // eax@8 | |
3042 signed int v9; // esi@9 | |
3043 | |
3044 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3045 | |
3046 v1 = this; | |
232 | 3047 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3048 if ( v2 < 64 || v2 > 65 ) |
3049 { | |
3050 v3 = GetMeleeDamageMinimal(); | |
3051 v4 = GetMeleeDamageMaximal(); | |
3052 } | |
3053 else | |
3054 { | |
3055 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3056 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3057 } | |
3058 if ( v3 == v4 ) | |
3059 { | |
3060 v5 = v3; | |
3061 v6 = player__getmeleedamagestring_static_buff; | |
3062 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3063 } | |
3064 else | |
3065 { | |
3066 v7 = v3; | |
3067 v6 = player__getmeleedamagestring_static_buff; | |
3068 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3069 } | |
3070 v8 = v1->pEquipment.uMainHand; | |
3071 if ( v8 ) | |
3072 { | |
232 | 3073 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3074 if ( v9 >= 135 ) |
3075 { | |
3076 if ( v9 <= 159 ) | |
3077 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3078 } | |
3079 } | |
3080 return v6; | |
3081 } | |
3082 | |
3083 //----- (0048D396) -------------------------------------------------------- | |
3084 char *Player::GetRangedDamageString() | |
3085 { | |
3086 Player *v1; // esi@1 | |
3087 signed int v2; // eax@1 | |
3088 int v3; // edi@3 | |
3089 int v4; // eax@3 | |
3090 char *v5; // edi@6 | |
3091 int v6; // ST0C_4@8 | |
3092 int v7; // ST08_4@9 | |
3093 unsigned int v8; // eax@10 | |
3094 signed int v9; // esi@11 | |
3095 | |
3096 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3097 | |
3098 v1 = this; | |
232 | 3099 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3100 if ( v2 < 64 || v2 > 65 ) |
3101 { | |
3102 v3 = GetRangedDamageMin(); | |
3103 v4 = GetRangedDamageMax(); | |
3104 } | |
3105 else | |
3106 { | |
3107 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3108 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3109 } | |
3110 if ( v4 ) | |
3111 { | |
3112 if ( v3 == v4 ) | |
3113 { | |
3114 v6 = v3; | |
3115 v5 = player__getrangeddamagestring_static_buff; | |
3116 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3117 } | |
3118 else | |
3119 { | |
3120 v7 = v3; | |
3121 v5 = player__getrangeddamagestring_static_buff; | |
3122 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3123 } | |
3124 } | |
3125 else | |
3126 { | |
3127 v5 = player__getrangeddamagestring_static_buff; | |
3128 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3129 } | |
3130 v8 = v1->pEquipment.uMainHand; | |
3131 if ( v8 ) | |
3132 { | |
232 | 3133 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3134 if ( v9 >= 135 ) |
3135 { | |
3136 if ( v9 <= 159 ) | |
3137 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3138 } | |
3139 } | |
3140 return v5; | |
3141 } | |
3142 | |
3143 //----- (0048D45A) -------------------------------------------------------- | |
3144 bool Player::CanTrainToNextLevel() | |
3145 { | |
3146 int v1; // edx@1 | |
3147 int v2; // eax@1 | |
3148 int i; // esi@1 | |
3149 | |
3150 v1 = this->uLevel; | |
3151 v2 = 0; | |
3152 for ( i = 0; i < v1; ++i ) | |
3153 v2 += i + 1; | |
3154 return (signed __int64)this->uExperience >= 1000 * v2; | |
3155 } | |
3156 | |
3157 //----- (0048D498) -------------------------------------------------------- | |
3158 unsigned int Player::GetExperienceDisplayColor() | |
3159 { | |
3160 unsigned int result; // eax@2 | |
3161 | |
3162 if ( CanTrainToNextLevel() ) | |
995 | 3163 result = ui_character_bonus_text_color; |
0 | 3164 else |
995 | 3165 result = ui_character_default_text_color; |
0 | 3166 return result; |
3167 } | |
3168 | |
3169 //----- (0048D4B3) -------------------------------------------------------- | |
3170 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3171 { | |
3172 Player *v3; // esi@1 | |
3173 int v4; // edi@8 | |
3174 int v6; // eax@21 | |
3175 signed int v7; // ebx@21 | |
3176 int v8; // eax@22 | |
3177 signed int v9; // ebx@22 | |
3178 int v10; // eax@23 | |
3179 signed int v11; // ebx@23 | |
3180 int v12; // eax@24 | |
3181 signed int v13; // edi@24 | |
3182 unsigned int v14; // eax@27 | |
3183 int v15; // eax@29 | |
3184 double v16; // st7@32 | |
3185 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3186 signed int v18; // [sp+8h] [bp-4h]@17 | |
3187 | |
3188 v3 = this; | |
3189 if ( !resistance ) | |
3190 { | |
3191 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3192 goto LABEL_16; | |
3193 } | |
3194 if ( resistance == 1 ) | |
3195 { | |
3196 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3197 goto LABEL_16; | |
3198 } | |
3199 if ( resistance == 2 ) | |
3200 { | |
3201 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3202 goto LABEL_16; | |
3203 } | |
3204 if ( resistance == 3 ) | |
3205 { | |
3206 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3207 goto LABEL_16; | |
3208 } | |
3209 if ( resistance == 6 ) | |
3210 { | |
3211 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3212 goto LABEL_16; | |
3213 } | |
3214 if ( resistance == 7 ) | |
3215 { | |
3216 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3217 goto LABEL_16; | |
3218 } | |
3219 if ( resistance == 8 ) | |
3220 { | |
3221 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3222 LABEL_16: | |
3223 v4 = GetActualResistance(v17); | |
3224 goto LABEL_17; | |
3225 } | |
3226 v4 = 0; | |
3227 LABEL_17: | |
3228 v18 = type; | |
135 | 3229 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3230 return 0; |
3231 if ( v4 ) | |
3232 { | |
3233 v6 = GetActualLuck(); | |
3234 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3235 if ( rand() % v7 >= 30 ) | |
3236 { | |
3237 v18 = type >> 1; | |
3238 v8 = GetActualLuck(); | |
3239 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3240 if ( rand() % v9 >= 30 ) | |
3241 { | |
3242 v18 = type >> 2; | |
3243 v10 = GetActualLuck(); | |
3244 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3245 if ( rand() % v11 >= 30 ) | |
3246 { | |
3247 v18 = type >> 3; | |
3248 v12 = GetActualLuck(); | |
3249 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3250 if ( rand() % v13 >= 30 ) | |
3251 v18 = type >> 4; | |
3252 } | |
3253 } | |
3254 } | |
3255 } | |
3256 if ( resistance == 4 ) | |
3257 { | |
898 | 3258 v14 = v3->pEquipment.uArmor; |
0 | 3259 if ( v14 ) |
3260 { | |
3261 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3262 { | |
3263 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3264 if ( v15 ) | |
3265 { | |
3266 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3267 return v18; | |
3268 v16 = (double)v18 * 0.5; | |
3269 return (signed __int64)v16; | |
3270 } | |
3271 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3272 { | |
3273 v16 = (double)v18 * 0.66670001; | |
3274 return (signed __int64)v16; | |
3275 } | |
3276 } | |
3277 } | |
3278 } | |
3279 return v18; | |
3280 } | |
3281 | |
3282 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3283 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3284 { | |
3285 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3286 } |
3287 | |
3288 //----- (0048D651) -------------------------------------------------------- | |
816 | 3289 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3290 { | |
3291 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3292 } |
3293 | |
3294 //----- (0048D676) -------------------------------------------------------- | |
3295 bool Player::IsUnarmed() | |
3296 { | |
816 | 3297 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3298 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3299 } |
3300 | |
3301 //----- (0048D6AA) -------------------------------------------------------- | |
3302 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3303 { | |
3304 auto i = pEquipment.pIndices[uEquipIndex]; | |
3305 if (i) | |
3306 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3307 else return false; | |
3308 } | |
3309 | |
3310 //----- (0048D6D0) -------------------------------------------------------- | |
3311 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3312 { | |
3313 for (uint i = 0; i < 16; ++i) | |
3314 { | |
3315 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3316 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3317 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3318 return true; | |
3319 } | |
3320 return false; | |
3321 } | |
3322 | |
3323 //----- (0048D709) -------------------------------------------------------- | |
3324 bool Player::WearsItem(int a1, signed int a2) | |
3325 { | |
1010 | 3326 |
0 | 3327 int v6; // esi@5 |
3328 | |
3329 if ( a2 >= 16 ) | |
3330 { | |
3331 v6 = 0; | |
3332 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3333 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3334 { |
3335 ++v6; | |
3336 if ( (signed int)v6 >= 16 ) | |
3337 return 0; | |
3338 } | |
3339 return 1; | |
3340 } | |
727 | 3341 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3342 return 1; |
3343 return 0; | |
3344 } | |
3345 | |
3346 //----- (0048D76C) -------------------------------------------------------- | |
3347 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3348 { | |
3349 unsigned __int16 v6; // cx@8 | |
3350 int v7; // edi@8 | |
3351 unsigned int v8; // ebx@8 | |
3352 unsigned int v9; // esi@8 | |
3353 int v10; // eax@8 | |
3354 int v11; // edi@12 | |
3355 bool result; // eax@13 | |
3356 | |
3357 if ( !a2 | |
3358 || this->pConditions[16] | |
3359 || this->pConditions[14] | |
3360 || this->pConditions[15] | |
3361 || this->pConditions[4] | |
3362 || this->pConditions[13] | |
3363 || this->pConditions[2] ) | |
3364 { | |
3365 result = 0; | |
3366 } | |
3367 else | |
3368 { | |
3369 v6 = this->pActiveSkills[34]; | |
3370 v7 = v6 & 0x3F; | |
3371 v8 = SkillToMastery(v6); | |
3372 v9 = a2->GetValue(); | |
3373 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3374 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3375 v9 *= 3; | |
3376 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3377 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3378 if ( rand() % 100 >= 5 ) | |
3379 { | |
3380 if ( *a6 > v11 ) | |
3381 result = *a6 - v11 < 500; | |
3382 else | |
3383 result = 2; | |
3384 } | |
3385 else | |
3386 { | |
3387 result = 0; | |
3388 } | |
3389 } | |
3390 return result; | |
3391 } | |
3392 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3393 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3394 | |
3395 //----- (0048D88B) -------------------------------------------------------- | |
3396 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3397 { | |
3398 Player *v4; // esi@1 | |
3399 Actor *v5; // edi@1 | |
3400 unsigned __int16 v6; // cx@10 | |
3401 int v7; // ebx@10 | |
3402 unsigned int v8; // esi@10 | |
3403 int v9; // eax@10 | |
3404 int v10; // esi@10 | |
3405 int v11; // eax@13 | |
3406 signed int v12; // ebx@15 | |
3407 signed int v13; // edx@15 | |
3408 int v14; // ecx@15 | |
3409 unsigned __int16 v15; // si@21 | |
3410 unsigned int v16; // ebx@24 | |
3411 int v17; // esi@24 | |
3412 const void *v18; // eax@29 | |
3413 unsigned int v19; // esi@31 | |
3414 int v20; // eax@34 | |
3415 char v21; // zf@36 | |
3416 unsigned int v22; // ST0C_4@39 | |
3417 char *v23; // esi@39 | |
3418 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3419 int v26; // [sp-8h] [bp-44h]@40 | |
3420 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3421 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3422 int v29; // [sp+30h] [bp-Ch]@10 | |
3423 int v30; // [sp+34h] [bp-8h]@10 | |
3424 Player *v31; // [sp+38h] [bp-4h]@1 | |
3425 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3426 | |
3427 v4 = this; | |
3428 v5 = &pActors[uActorID]; | |
3429 v31 = this; | |
3430 if ( &pActors[uActorID] | |
3431 && !this->pConditions[16] | |
3432 && !this->pConditions[14] | |
3433 && !this->pConditions[15] | |
3434 && !this->pConditions[4] | |
3435 && !this->pConditions[13] | |
3436 && !this->pConditions[2] ) | |
3437 { | |
3438 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3439 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3440 v6 = v4->pActiveSkills[34]; | |
3441 v7 = v6 & 0x3F; | |
3442 v8 = SkillToMastery(v6); | |
3443 v9 = rand(); | |
3444 v28 = 4 * v8; | |
3445 v30 = dword_4EDEA0[v8]; | |
3446 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3447 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3448 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3449 { | |
322 | 3450 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3451 _steal_perma = 0; |
3452 v26 = (int)v31->pName; | |
3453 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3454 } | |
3455 else | |
3456 { | |
3457 v11 = rand(); | |
3458 if ( v11 % 100 >= 40 ) | |
3459 { | |
3460 if ( v11 % 100 >= 70 ) | |
3461 { | |
3462 v19 = 0; | |
3463 if ( v7 > 0 ) | |
3464 { | |
3465 do | |
3466 { | |
3467 --v7; | |
3468 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3469 } | |
3470 while ( v7 ); | |
3471 } | |
3472 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3473 return _steal_perma; | |
377 | 3474 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3475 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3476 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3477 v21 = *(int *)v20 == v19; |
3478 *(int *)v20 -= v19; | |
3479 if ( v21 ) | |
3480 v5->array_000234[3].uItemID = 0; | |
3481 if ( v19 ) | |
3482 { | |
3483 party_finds_gold(v19, 2); | |
3484 v22 = v19; | |
3485 v23 = pTmpBuf2; | |
3486 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3487 LABEL_43: | |
3488 ShowStatusBarString(v23, 2u); | |
3489 return _steal_perma; | |
3490 } | |
3491 } | |
3492 else | |
3493 { | |
3494 v27.Reset(); | |
3495 v12 = 0; | |
3496 v13 = 0; | |
3497 v14 = (int)v5->array_000234; | |
3498 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3499 { | |
3500 ++v13; | |
3501 v14 += 36; | |
3502 if ( v13 >= 4 ) | |
3503 goto LABEL_21; | |
3504 } | |
3505 v12 = 1; | |
3506 LABEL_21: | |
3507 v15 = v5->uCarriedItemID; | |
3508 if ( v15 || v12 ) | |
3509 { | |
3510 v27.Reset(); | |
3511 if ( v15 ) | |
3512 { | |
3513 v16 = (signed __int16)v15; | |
3514 v5->uCarriedItemID = 0; | |
3515 v27.uItemID = (signed __int16)v15; | |
3516 v17 = (signed __int16)v15; | |
3517 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3518 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3519 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3520 { | |
3521 if ( v16 != 220 ) | |
570 | 3522 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3523 } |
3524 } | |
3525 else | |
3526 { | |
3527 v18 = &v5->array_000234[rand() % 4]; | |
3528 memcpy(&v27, v18, sizeof(v27)); | |
3529 ((ItemGen *)v18)->Reset(); | |
3530 v16 = v27.uItemID; | |
3531 } | |
3532 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3533 sprintf( | |
3534 pTmpBuf2, | |
3535 pGlobalTXT_LocalizationStrings[304], | |
3536 v31->pName, | |
3537 pItemsTable->pItems[v16].pUnidentifiedName); | |
3538 ShowStatusBarString(pTmpBuf2, 2u); | |
3539 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3540 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3541 pMouse->SetCursorBitmapFromItemID(v16); | |
3542 return _steal_perma; | |
3543 } | |
3544 } | |
3545 } | |
3546 v26 = (int)v31->pName; | |
3547 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3548 } | |
3549 v23 = pTmpBuf2; | |
809 | 3550 sprintfex(pTmpBuf2, v25, v26); |
0 | 3551 goto LABEL_43; |
3552 } | |
3553 return 0; | |
3554 } | |
3555 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3556 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3557 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3558 | |
3559 //----- (0048DBB9) -------------------------------------------------------- | |
3560 void Player::Heal(int amount) | |
3561 { | |
1010 | 3562 signed int max_health; // eax@3 |
3563 | |
3564 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3565 { | |
3566 max_health = GetMaxHealth(); | |
3567 if ( pConditions[Condition_Zombie] ) | |
3568 max_health /= 2; | |
3569 sHealth += amount; | |
3570 if ( sHealth > max_health ) | |
3571 sHealth = max_health; | |
3572 if ( pConditions[Condition_Unconcious] ) | |
3573 { | |
3574 if ( sHealth > 0 ) | |
3575 { | |
3576 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3577 } |
3578 } | |
3579 } | |
3580 } | |
3581 | |
3582 //----- (0048DC1E) -------------------------------------------------------- | |
3583 int Player::ReceiveDamage(signed int type, int resistance) | |
3584 { | |
3585 Player *v3; // esi@1 | |
3586 signed int v4; // eax@1 | |
3587 int v5; // eax@1 | |
3588 bool v6; // ebx@1 | |
3589 unsigned int v7; // eax@8 | |
3590 char *v8; // ecx@9 | |
3591 int v9; // eax@9 | |
187 | 3592 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3593 |
3594 v3 = this; | |
1010 | 3595 this->pConditions[Condition_Sleep] = 0i64; |
0 | 3596 v4 = CalculateIncommingDamage(resistance, type); |
3597 v3->sHealth -= v4; | |
187 | 3598 //typea = v4; |
0 | 3599 v5 = v3->sHealth; |
3600 v6 = v5 < -10; | |
3601 LOBYTE(v6) = v5 <= -10; | |
3602 if ( v5 < 1 ) | |
3603 { | |
3604 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
1010 | 3605 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
0 | 3606 { |
3607 SetCondition(0xDu, 0); | |
3608 } | |
3609 else | |
3610 { | |
3611 SetCondition(0xEu, 0); | |
3612 v6 = LODWORD(pParty->uTimePlayed); | |
3613 if ( v3->sHealth > 0 ) | |
3614 v3->sHealth = 0; | |
3615 } | |
3616 if ( v6 ) | |
3617 { | |
898 | 3618 v7 = v3->pEquipment.uArmor; |
0 | 3619 if ( v7 ) |
3620 { | |
3621 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3622 v9 = *(int *)v8; | |
3623 if ( !(BYTE1(v9) & 2) ) | |
3624 { | |
3625 LOBYTE(v9) = v9 | 2; | |
3626 *(int *)v8 = v9; | |
3627 } | |
3628 } | |
3629 } | |
3630 } | |
187 | 3631 if ( v4 && CanAct() ) |
3632 PlaySound(SPEECH_24, 0); | |
3633 return v4; | |
0 | 3634 } |
3635 | |
3636 //----- (0048DCF6) -------------------------------------------------------- | |
3637 int Player::_48DCF6(int a2, Actor *pActor) | |
3638 { | |
3639 signed int v3; // edi@1 | |
3640 signed int v4; // ebx@1 | |
3641 Player *v5; // esi@1 | |
3642 int v6; // eax@2 | |
3643 int v7; // eax@5 | |
3644 int v8; // eax@8 | |
3645 int v9; // ebx@8 | |
3646 int v10; // eax@8 | |
3647 int v11; // ebx@8 | |
3648 signed int v12; // edx@9 | |
3649 ItemGen *v13; // eax@9 | |
3650 int v14; // edx@16 | |
3651 unsigned int v15; // edx@17 | |
3652 int v16; // edx@26 | |
3653 unsigned int v17; // edx@27 | |
3654 signed int v19; // edx@38 | |
3655 int *v20; // ecx@38 | |
3656 signed int v21; // eax@40 | |
3657 int v22; // eax@49 | |
3658 signed int v23; // ebx@49 | |
3659 unsigned int v24; // eax@60 | |
3660 int v25; // ecx@61 | |
3661 int v26; // ebx@74 | |
3662 void *v27; // ecx@76 | |
3663 unsigned int v28; // ebx@78 | |
3664 signed int result; // eax@86 | |
3665 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3666 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3667 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3668 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3669 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3670 int v35; // [sp-Ch] [bp-ACh]@56 | |
3671 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3672 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3673 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3674 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3675 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3676 int v41; // [sp-4h] [bp-A4h]@51 | |
3677 int v42; // [sp-4h] [bp-A4h]@56 | |
3678 int v43; // [sp-4h] [bp-A4h]@57 | |
3679 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3680 int v45; // [sp-4h] [bp-A4h]@68 | |
3681 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3682 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3683 int v48; // [sp+9Ch] [bp-4h]@1 | |
3684 | |
3685 v3 = 0; | |
3686 v4 = 0; | |
3687 v5 = this; | |
3688 v47 = 0; | |
3689 v48 = 0; | |
3690 switch ( a2 ) | |
3691 { | |
3692 case 1: | |
3693 v6 = GetActualWillpower(); | |
3694 goto LABEL_46; | |
3695 case 2: | |
3696 case 3: | |
3697 case 4: | |
3698 case 9: | |
3699 case 10: | |
3700 case 11: | |
3701 case 13: | |
3702 case 21: | |
3703 v6 = GetActualEndurance(); | |
3704 goto LABEL_46; | |
3705 case 5: | |
3706 case 12: | |
3707 case 23: | |
3708 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3709 goto LABEL_5; | |
3710 case 15: | |
3711 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3712 goto LABEL_5; | |
3713 case 6: | |
3714 case 7: | |
3715 case 8: | |
3716 case 14: | |
3717 case 16: | |
3718 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3719 LABEL_5: | |
3720 v7 = GetActualResistance(v40); | |
3721 goto LABEL_47; | |
3722 case 22: | |
3723 v8 = GetActualWillpower(); | |
3724 v9 = _48EA1B_get_static_effect(v8); | |
3725 v10 = GetActualIntelligence(); | |
3726 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3727 break; | |
3728 case 17: | |
3729 v12 = 0; | |
3730 v13 = this->pInventoryItems; | |
3731 do | |
3732 { | |
315 | 3733 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3734 v46[v4++] = v12; |
3735 ++v12; | |
3736 ++v13; | |
3737 } | |
3738 while ( v12 < 138 ); | |
3739 goto LABEL_36; | |
3740 case 18: | |
3741 v14 = 0; | |
3742 do | |
3743 { | |
3744 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3745 { | |
816 | 3746 if ( v15 == EQUIP_ARMOUR ) |
898 | 3747 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3748 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3749 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3750 } |
3751 v14 = v15 + 1; | |
3752 } | |
3753 while ( v14 < 16 ); | |
3754 goto LABEL_36; | |
3755 case 19: | |
3756 v16 = 0; | |
3757 do | |
3758 { | |
3759 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3760 { | |
3761 if ( v17 == 2 ) | |
3762 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3763 if ( (!v17 || v17 == 1) | |
816 | 3764 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3765 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3766 } |
3767 v16 = v17 + 1; | |
3768 } | |
3769 while ( v16 < 16 ); | |
3770 LABEL_36: | |
3771 if ( !v4 ) | |
3772 goto LABEL_87; | |
3773 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3774 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3775 break; | |
3776 case 20: | |
3777 v19 = 0; | |
3778 v20 = this->pInventoryIndices; | |
3779 do | |
3780 { | |
3781 if ( *v20 > 0 ) | |
3782 { | |
232 | 3783 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3784 if ( v21 > 0 ) |
3785 { | |
3786 if ( v21 <= 134 ) | |
3787 v46[v4++] = v19; | |
3788 } | |
3789 } | |
3790 ++v19; | |
3791 ++v20; | |
3792 } | |
3793 while ( v19 < 126 ); | |
3794 if ( !v4 ) | |
3795 goto LABEL_87; | |
3796 v47 = (unsigned __int8)v46[rand() % v4]; | |
3797 v6 = GetActualAccuracy(); | |
3798 LABEL_46: | |
3799 v7 = _48EA1B_get_static_effect(v6); | |
3800 LABEL_47: | |
3801 v11 = v7; | |
3802 break; | |
3803 default: | |
3804 v11 = 0; | |
3805 break; | |
3806 } | |
3807 v22 = GetActualLuck(); | |
3808 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3809 if ( rand() % v23 >= 30 ) | |
3810 { | |
3811 LABEL_87: | |
3812 result = 0; | |
3813 } | |
3814 else | |
3815 { | |
3816 switch ( a2 ) | |
3817 { | |
3818 case 1: | |
3819 v41 = 1; | |
3820 v36 = 0; | |
3821 goto LABEL_56; | |
3822 case 2: | |
3823 v41 = 1; | |
3824 v36 = 1; | |
3825 goto LABEL_56; | |
3826 case 3: | |
3827 v41 = 1; | |
3828 v36 = 2; | |
3829 goto LABEL_56; | |
3830 case 23: | |
3831 v41 = 1; | |
3832 v36 = 3; | |
3833 goto LABEL_56; | |
3834 case 4: | |
3835 v41 = 1; | |
3836 v36 = 4; | |
3837 LABEL_56: | |
3838 SetCondition(v36, v41); | |
3839 v42 = 0; | |
3840 v37 = 0; | |
3841 v35 = 0; | |
3842 v34 = 0; | |
3843 v33 = -1; | |
3844 v32 = 0; | |
3845 v31 = 0; | |
3846 v30 = (SoundID)221; | |
3847 goto LABEL_83; | |
3848 case 5: | |
3849 v43 = 1; | |
3850 v38 = 5; | |
3851 goto LABEL_70; | |
3852 case 6: | |
3853 case 7: | |
3854 case 8: | |
3855 if ( a2 == 6 ) | |
3856 { | |
3857 v44 = 6; | |
3858 goto LABEL_60; | |
3859 } | |
3860 v25 = 2 * (a2 != 8) + 8; | |
3861 goto LABEL_65; | |
3862 case 9: | |
3863 if ( a2 == 6 ) | |
3864 { | |
3865 v44 = 7; | |
3866 LABEL_60: | |
3867 v24 = v44; | |
3868 } | |
3869 else | |
3870 { | |
3871 v25 = 2 * (a2 != 8) + 9; | |
3872 LABEL_65: | |
3873 v24 = v25; | |
3874 } | |
3875 SetCondition(v24, 1); | |
3876 v42 = 0; | |
3877 v37 = 0; | |
3878 v35 = 0; | |
3879 v34 = 0; | |
3880 v33 = -1; | |
3881 v32 = 0; | |
3882 v31 = 0; | |
3883 v30 = (SoundID)222; | |
3884 LABEL_83: | |
3885 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3886 do | |
3887 { | |
3888 LABEL_84: | |
3889 if ( v5 == pPlayers[v3 + 1] ) | |
3890 break; | |
3891 ++v3; | |
3892 } | |
3893 while ( v3 < 4 ); | |
3894 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3895 result = 1; | |
3896 break; | |
3897 case 12: | |
3898 v43 = 1; | |
3899 v38 = 12; | |
3900 goto LABEL_70; | |
3901 case 15: | |
3902 v45 = 1; | |
3903 v39 = 15; | |
3904 goto LABEL_73; | |
3905 case 13: | |
3906 v43 = 1; | |
3907 v38 = 13; | |
3908 LABEL_70: | |
3909 SetCondition(v38, v43); | |
3910 v42 = 0; | |
3911 v37 = 0; | |
3912 v35 = 0; | |
3913 v34 = 0; | |
3914 v33 = -1; | |
3915 v32 = 0; | |
3916 v31 = 0; | |
3917 v30 = (SoundID)224; | |
3918 goto LABEL_83; | |
3919 case 14: | |
3920 v45 = 1; | |
3921 v39 = 14; | |
3922 goto LABEL_73; | |
3923 case 16: | |
3924 v45 = 1; | |
3925 v39 = 16; | |
3926 LABEL_73: | |
3927 SetCondition(v39, v45); | |
3928 v42 = 0; | |
3929 v37 = 0; | |
3930 v35 = 0; | |
3931 v34 = 0; | |
3932 v33 = -1; | |
3933 v32 = 0; | |
3934 v31 = 0; | |
3935 v30 = (SoundID)225; | |
3936 goto LABEL_83; | |
3937 case 17: | |
3938 case 18: | |
3939 case 19: | |
3940 v26 = v48; | |
3941 if ( *(char *)(v48 + 21) & 2 ) | |
3942 goto LABEL_84; | |
187 | 3943 PlaySound(SPEECH_40, 0); |
0 | 3944 *(int *)(v26 + 20) |= 2u; |
3945 goto LABEL_79; | |
3946 case 20: | |
187 | 3947 PlaySound(SPEECH_40, 0); |
0 | 3948 v27 = pActor->array_000234; |
3949 if ( pActor->array_000234[0].uItemID ) | |
3950 { | |
3951 v27 = &pActor->array_000234[1]; | |
3952 if ( pActor->array_000234[1].uItemID ) | |
3953 goto LABEL_84; | |
3954 } | |
3955 v28 = v47; | |
654 | 3956 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3957 RemoveItemAtInventoryIndex(v28); |
3958 LABEL_79: | |
3959 v42 = 0; | |
3960 v37 = 0; | |
3961 v35 = 0; | |
3962 v34 = 0; | |
3963 v33 = -1; | |
3964 v32 = 0; | |
3965 v31 = 0; | |
3966 v30 = (SoundID)47; | |
3967 goto LABEL_83; | |
3968 case 21: | |
187 | 3969 PlaySound(SPEECH_42, 0); |
0 | 3970 ++v5->sAgeModifier; |
3971 goto LABEL_82; | |
3972 case 22: | |
187 | 3973 PlaySound(SPEECH_41, 0); |
0 | 3974 v5->sMana = 0; |
3975 LABEL_82: | |
3976 v42 = 0; | |
3977 v37 = 0; | |
3978 v35 = 0; | |
3979 v34 = 0; | |
3980 v33 = -1; | |
3981 v32 = 0; | |
3982 v31 = 0; | |
3983 v30 = (SoundID)226; | |
3984 goto LABEL_83; | |
3985 default: | |
3986 goto LABEL_87; | |
3987 } | |
3988 } | |
3989 return result; | |
3990 } | |
324 | 3991 |
0 | 3992 // 48DCF6: using guessed type char var_94[140]; |
3993 | |
3994 //----- (0048E1A3) -------------------------------------------------------- | |
3995 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3996 { | |
3997 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
3998 } | |
3999 | |
4000 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4001 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4002 { | |
4003 ItemGen *weapon = nullptr; | |
4004 ItemDesc *weapon_desc = nullptr; | |
4005 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4006 if (bRangedAttack) | |
0 | 4007 { |
4008 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4009 goto LABEL_17; | |
816 | 4010 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4011 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4012 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4013 goto LABEL_17; | |
4014 } | |
4015 else if ( IsUnarmed() == 1 ) | |
4016 { | |
4017 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4018 { | |
4019 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4020 goto LABEL_17; |
4021 } | |
4022 } | |
816 | 4023 |
4024 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4025 { | |
4026 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4027 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4028 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4029 { | |
4030 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4031 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4032 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4033 } | |
0 | 4034 else |
816 | 4035 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4036 } | |
1010 | 4037 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
4038 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 4039 { |
898 | 4040 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4041 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4042 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4043 { | |
898 | 4044 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4045 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4046 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4047 } | |
4048 } | |
4049 | |
0 | 4050 LABEL_17: |
816 | 4051 uint armour_recovery = 0; |
0 | 4052 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4053 { | |
898 | 4054 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4055 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4056 | |
4057 float armour_recovery_multipliers[4]; | |
4058 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4059 { | |
4060 armour_recovery_multipliers[0] = 1.0f; | |
4061 armour_recovery_multipliers[1] = 0; | |
4062 armour_recovery_multipliers[2] = 0; | |
4063 armour_recovery_multipliers[3] = 0; | |
4064 } | |
4065 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4066 { | |
4067 armour_recovery_multipliers[0] = 1.0f; | |
4068 armour_recovery_multipliers[1] = 0.5f; | |
4069 armour_recovery_multipliers[2] = 0; | |
4070 armour_recovery_multipliers[3] = 0; | |
4071 } | |
4072 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4073 { | |
4074 armour_recovery_multipliers[0] = 1.0f; | |
4075 armour_recovery_multipliers[1] = 0.5f; | |
4076 armour_recovery_multipliers[2] = 0.5f; | |
4077 armour_recovery_multipliers[3] = 0; | |
0 | 4078 } |
4079 else | |
4080 { | |
816 | 4081 assert(false && "Unknown armour type"); // what kind of armour is that? |
4082 armour_recovery_multipliers[0] = 1.0f; | |
4083 armour_recovery_multipliers[1] = 1.0f; | |
4084 armour_recovery_multipliers[2] = 1.0f; | |
4085 armour_recovery_multipliers[3] = 1.0f; | |
4086 } | |
4087 | |
4088 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4089 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4090 } | |
4091 | |
4092 uint shield_recovery = 0; | |
4093 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4094 { | |
4095 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4096 | |
898 | 4097 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4098 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4099 | |
4100 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4101 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4102 } | |
4103 | |
4104 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4105 sword_axe_bow_recovery_reduction = 0; | |
4106 bool shooting_laser = false; | |
4107 if (weapon_desc) | |
4108 { | |
4109 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4110 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4111 { | |
4112 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4113 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4114 } | |
4115 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4116 shooting_laser = true; | |
4117 } | |
4118 | |
4119 uint armsmaster_recovery_reduction = 0; | |
4120 if (!bRangedAttack && !shooting_laser) | |
4121 { | |
4122 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4123 { | |
4124 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4125 if (SkillToMastery(armsmaster_level) >= 4) | |
4126 armsmaster_recovery_reduction *= 2; | |
4127 } | |
4128 } | |
4129 | |
4130 uint v41 = 0; | |
4131 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4132 v41 = 25; |
816 | 4133 |
4134 uint weapon_enchantment_recovery_reduction = 0; | |
4135 if ( weapon ) | |
4136 { | |
4137 if (weapon->uSpecEnchantmentType == 59 || | |
4138 weapon->uSpecEnchantmentType == 41 || | |
4139 weapon->uSpecEnchantmentType == 500) | |
4140 weapon_enchantment_recovery_reduction = 20; | |
4141 } | |
4142 | |
4143 | |
4144 int recovery = weapon_recovery + | |
4145 armour_recovery + | |
4146 shield_recovery | |
4147 - armsmaster_recovery_reduction | |
4148 - weapon_enchantment_recovery_reduction | |
4149 - v41 | |
4150 - sword_axe_bow_recovery_reduction | |
4151 - player_speed_recovery_reduction; | |
4152 | |
4153 if (recovery < 0) | |
4154 recovery = 0; | |
4155 return recovery; | |
0 | 4156 } |
4157 | |
4158 //----- (0048E4F8) -------------------------------------------------------- | |
4159 int Player::GetMaxHealth() | |
4160 { | |
4161 int v3; // esi@1 | |
4162 int v4; // esi@1 | |
4163 int v6; // esi@1 | |
4164 | |
4165 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4166 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4167 v6 = uFullHealthBonus |
135 | 4168 + pBaseHealthByClass[classType / 4] |
0 | 4169 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4170 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4171 if (v6 <= 0) | |
4172 return 1; | |
4173 return v6; | |
4174 } | |
4175 | |
4176 //----- (0048E565) -------------------------------------------------------- | |
4177 int Player::GetMaxMana() | |
4178 { | |
4179 int v2; // eax@2 | |
4180 int v3; // esi@4 | |
4181 int v4; // eax@5 | |
4182 int v5; // esi@5 | |
4183 int v6; // eax@5 | |
4184 int v7; // esi@6 | |
4185 int v8; // esi@6 | |
4186 int v9; // esi@6 | |
4187 int result; // eax@7 | |
4188 | |
135 | 4189 switch (classType) |
0 | 4190 { |
4191 case 5u: | |
4192 case 6u: | |
4193 case 7u: | |
4194 case 0x10u: | |
4195 case 0x11u: | |
4196 case 0x12u: | |
4197 case 0x13u: | |
4198 case 0x20u: | |
4199 case 0x21u: | |
4200 case 0x22u: | |
4201 case 0x23u: | |
4202 v2 = GetActualIntelligence(); | |
4203 v3 = _48EA1B_get_static_effect(v2); | |
4204 goto LABEL_6; | |
4205 case 9u: | |
4206 case 0xAu: | |
4207 case 0xBu: | |
4208 case 0xCu: | |
4209 case 0xDu: | |
4210 case 0xEu: | |
4211 case 0xFu: | |
4212 case 0x18u: | |
4213 case 0x19u: | |
4214 case 0x1Au: | |
4215 case 0x1Bu: | |
4216 v2 = GetActualWillpower(); | |
4217 v3 = _48EA1B_get_static_effect(v2); | |
4218 goto LABEL_6; | |
4219 case 0x15u: | |
4220 case 0x16u: | |
4221 case 0x17u: | |
4222 case 0x1Cu: | |
4223 case 0x1Du: | |
4224 case 0x1Eu: | |
4225 case 0x1Fu: | |
4226 v4 = GetActualWillpower(); | |
4227 v5 = _48EA1B_get_static_effect(v4); | |
4228 v6 = GetActualIntelligence(); | |
4229 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4230 LABEL_6: | |
135 | 4231 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4232 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4233 v9 = uFullManaBonus | |
135 | 4234 + pBaseManaByClass[classType / 4] |
0 | 4235 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4236 + v8; | |
4237 if ( v9 < 1 ) | |
4238 goto LABEL_7; | |
4239 result = v9; | |
4240 break; | |
4241 default: | |
4242 LABEL_7: | |
4243 result = 0; | |
4244 break; | |
4245 } | |
4246 return result; | |
4247 } | |
4248 | |
4249 //----- (0048E656) -------------------------------------------------------- | |
4250 int Player::GetBaseAC() | |
4251 { | |
4252 Player *v1; // edi@1 | |
4253 int v2; // eax@1 | |
4254 int v3; // esi@1 | |
4255 int v4; // esi@1 | |
4256 int v5; // esi@1 | |
4257 int result; // eax@2 | |
4258 | |
4259 v1 = this; | |
4260 v2 = GetActualSpeed(); | |
4261 v3 = _48EA1B_get_static_effect(v2); | |
4262 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4263 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4264 if ( v5 >= 1 ) | |
4265 result = v5; | |
4266 else | |
4267 result = 0; | |
4268 return result; | |
4269 } | |
4270 | |
4271 //----- (0048E68F) -------------------------------------------------------- | |
4272 int Player::GetActualAC() | |
4273 { | |
4274 Player *v1; // edi@1 | |
4275 int v2; // eax@1 | |
4276 int v3; // esi@1 | |
4277 int v4; // esi@1 | |
4278 int v5; // esi@1 | |
4279 int v6; // esi@1 | |
4280 int result; // eax@2 | |
4281 | |
4282 v1 = this; | |
4283 v2 = GetActualSpeed(); | |
4284 v3 = _48EA1B_get_static_effect(v2); | |
4285 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4286 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4287 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4288 if ( v6 >= 1 ) | |
4289 result = v6; | |
4290 else | |
4291 result = 0; | |
4292 return result; | |
4293 } | |
4294 | |
4295 //----- (0048E6DC) -------------------------------------------------------- | |
4296 unsigned int Player::GetBaseAge() | |
4297 { | |
352 | 4298 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4299 } |
4300 | |
4301 //----- (0048E72C) -------------------------------------------------------- | |
4302 unsigned int Player::GetActualAge() | |
4303 { | |
4304 return this->sAgeModifier + GetBaseAge(); | |
4305 } | |
4306 | |
4307 //----- (0048E73F) -------------------------------------------------------- | |
4308 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4309 { | |
4310 Player *v2; // ebx@1 | |
4311 signed int v3; // esi@1 | |
4312 enum CHARACTER_RACE v4; // eax@1 | |
4313 signed int v5; // edi@8 | |
4314 char v6; // zf@9 | |
4315 int v7; // esi@20 | |
4316 int result; // eax@21 | |
4317 signed int v9; // [sp-4h] [bp-10h]@11 | |
4318 | |
4319 v2 = this; | |
4320 v3 = 0; | |
4321 v4 = GetRace(); | |
4322 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4323 { | |
4324 v5 = 0; | |
4325 goto LABEL_16; | |
4326 } | |
4327 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4328 { | |
4329 v5 = 1; | |
4330 LABEL_16: | |
4331 v6 = v4 == 2; | |
4332 goto LABEL_17; | |
4333 } | |
4334 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4335 { | |
4336 v6 = v4 == 3; | |
4337 v5 = 2; | |
4338 goto LABEL_17; | |
4339 } | |
4340 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4341 { | |
4342 v5 = 3; | |
4343 v6 = v4 == 3; | |
4344 goto LABEL_17; | |
4345 } | |
4346 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4347 { | |
4348 v5 = 7; | |
4349 if ( v4 != 1 ) | |
4350 goto LABEL_20; | |
4351 v9 = 10; | |
4352 LABEL_19: | |
4353 v3 = v9; | |
4354 goto LABEL_20; | |
4355 } | |
4356 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4357 { | |
4358 v5 = 8; | |
4359 v6 = v4 == 0; | |
4360 LABEL_17: | |
4361 if ( !v6 ) | |
4362 goto LABEL_20; | |
4363 v9 = 5; | |
4364 goto LABEL_19; | |
4365 } | |
4366 v5 = 0; | |
4367 LABEL_20: | |
4368 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4369 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4370 result = v7 + *(&v2->sResFireBase + v5); |
4371 return result; | |
4372 } | |
4373 | |
4374 //----- (0048E7D0) -------------------------------------------------------- | |
4375 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4376 { | |
4377 signed int v2; // edi@1 | |
4378 Player *v3; // esi@1 | |
4379 enum CHARACTER_RACE v4; // ebx@1 | |
4380 char v6; // zf@18 | |
4381 int v7; // ebx@28 | |
4382 int result; // eax@28 | |
4383 signed int v9; // [sp+10h] [bp-8h]@1 | |
4384 signed int v10; // [sp+14h] [bp-4h]@1 | |
4385 | |
4386 v2 = 0; | |
4387 v3 = this; | |
4388 v10 = 0; | |
4389 v9 = 0; | |
4390 v4 = GetRace(); | |
652 | 4391 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4392 v10 = 20; |
4393 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4394 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4395 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4396 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4397 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4398 && HasItemEquipped(EQUIP_ARMOUR) | |
4399 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4400 v10 += v3->pActiveSkills[9] & 0x3F; | |
4401 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4402 goto LABEL_25; | |
4403 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4404 { | |
4405 v2 = 1; | |
4406 LABEL_25: | |
4407 v6 = v4 == 2; | |
4408 LABEL_26: | |
4409 if ( v6 ) | |
4410 v9 = 5; | |
4411 goto LABEL_28; | |
4412 } | |
4413 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4414 { | |
4415 v6 = v4 == 3; | |
4416 v2 = 2; | |
4417 goto LABEL_26; | |
4418 } | |
4419 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4420 { | |
4421 v2 = 3; | |
4422 if ( v4 == 3 ) | |
4423 v10 += 5; | |
4424 } | |
4425 else | |
4426 { | |
4427 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4428 { | |
4429 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4430 goto LABEL_28; | |
4431 v2 = 8; | |
4432 v6 = v4 == 0; | |
4433 goto LABEL_26; | |
4434 } | |
4435 v2 = 7; | |
4436 if ( v4 == 1 ) | |
4437 v9 = 10; | |
4438 } | |
4439 LABEL_28: | |
4440 v7 = GetItemsBonus(a2, 0); | |
4441 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4442 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4443 { |
4444 if ( result > 200 ) | |
4445 result = 200; | |
4446 } | |
4447 return result; | |
4448 } | |
4449 | |
4450 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4451 bool Player::Recover(int dt) |
4452 { | |
4453 //Player *v2; // esi@1 | |
0 | 4454 signed __int64 v3; // qax@1 |
816 | 4455 //bool result; // eax@4 |
4456 | |
4457 //v2 = this; | |
4458 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4459 | |
4460 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4461 | |
4462 if (uTimeToRecovery > v3) | |
4463 { | |
4464 uTimeToRecovery -= v3; | |
4465 return true; | |
0 | 4466 } |
4467 else | |
4468 { | |
816 | 4469 uTimeToRecovery = 0; |
4470 viewparams->bRedrawGameUI = true; | |
4471 if (!uActiveCharacter) | |
0 | 4472 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4473 return false; |
4474 } | |
0 | 4475 } |
4476 | |
4477 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4478 void Player::SetRecoveryTime(signed int rec) |
4479 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4480 assert(rec >= 0); |
816 | 4481 |
4482 if (rec > uTimeToRecovery) | |
4483 uTimeToRecovery = rec; | |
4484 | |
4485 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4486 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4487 |
4488 viewparams->bRedrawGameUI = true; | |
0 | 4489 } |
4490 // 50C0C4: using guessed type int some_active_character; | |
4491 | |
4492 //----- (0048E9B7) -------------------------------------------------------- | |
4493 void Player::RandomizeName() | |
4494 { | |
4495 if (!uExpressionTimePassed) | |
4496 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4497 } | |
4498 | |
4499 //----- (0048E9F4) -------------------------------------------------------- | |
4500 unsigned int Player::GetMajorConditionIdx() | |
4501 { | |
4502 for (uint i = 0; i < 18; ++i) | |
4503 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4504 return pConditionImportancyTable[i]; | |
4505 | |
4506 return 18; | |
4507 } | |
4508 | |
4509 //----- (0048EA1B) -------------------------------------------------------- | |
4510 int Player::_48EA1B_get_static_effect(int a2) | |
4511 { | |
4512 __int16 v2; // cx@1 | |
4513 int v3; // eax@1 | |
4514 | |
4515 v2 = word_4EDFFC[0]; | |
4516 v3 = 0; | |
4517 while ( a2 < v2 && v2 ) | |
4518 v2 = word_4EDFFC[v3++ + 1]; | |
4519 return player_stat_bonuses[v3]; | |
4520 } | |
4521 | |
4522 //----- (0048EA46) -------------------------------------------------------- | |
4523 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4524 { | |
4525 int v3; // esi@1 | |
4526 int v4; // edx@2 | |
4527 int v5; // eax@3 | |
4528 char *v6; // eax@4 | |
4529 | |
4530 v3 = 0; | |
4531 while ( 1 ) | |
4532 { | |
4533 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4534 goto LABEL_11; | |
816 | 4535 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4536 if ( a2 != 17 ) |
816 | 4537 { |
4538 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4539 goto LABEL_11; | |
4540 return 5; | |
4541 } | |
0 | 4542 v6 = (char *)this + 36 * v5; |
4543 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4544 return 50; | |
4545 LABEL_11: | |
4546 ++v3; | |
4547 if ( (signed int)v3 >= 16 ) | |
816 | 4548 return 0; |
4549 } | |
0 | 4550 } |
4551 | |
4552 //----- (0048EAAE) -------------------------------------------------------- | |
4553 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4554 { | |
4555 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4556 signed int v4; // eax@1 | |
4557 int v5; // edi@1 | |
4558 Player *v6; // ebx@1 | |
4559 Player *v8; // ecx@48 | |
4560 int v9; // eax@49 | |
4561 int v10; // edx@49 | |
4562 Player *v11; // ecx@55 | |
4563 int v12; // eax@56 | |
4564 int v13; // edx@56 | |
4565 int v14; // ecx@58 | |
4566 int v15; // eax@58 | |
4567 Player *v16; // ecx@61 | |
4568 int v17; // eax@62 | |
4569 Player *v18; // ecx@66 | |
4570 int v19; // eax@67 | |
4571 int v20; // eax@69 | |
4572 Player *v21; // ecx@75 | |
4573 int v22; // eax@76 | |
4574 int v23; // edx@76 | |
4575 int v24; // eax@79 | |
4576 int v25; // ecx@80 | |
4577 int v26; // edi@80 | |
4578 Player *v27; // ecx@84 | |
4579 int v28; // eax@85 | |
4580 int v29; // edx@85 | |
4581 Player *v30; // ecx@96 | |
4582 int v31; // ebp@97 | |
4583 int v32; // eax@98 | |
4584 unsigned int v33; // eax@100 | |
4585 int v34; // eax@103 | |
4586 char v35; // zf@104 | |
4587 char v36; // zf@107 | |
4588 unsigned __int8 v37; // zf@119 | |
4589 char v38; // sf@119 | |
4590 unsigned __int8 v39; // of@119 | |
4591 char v40; // zf@122 | |
4592 char v41; // zf@145 | |
4593 char v42; // zf@164 | |
4594 char v43; // zf@173 | |
4595 char v44; // zf@189 | |
4596 char v45; // zf@198 | |
4597 char v46; // zf@239 | |
4598 int v47; // eax@268 | |
4599 int v48; // eax@269 | |
4600 int v49; // eax@291 | |
4601 char v50; // zf@295 | |
4602 int v51; // eax@306 | |
4603 int v52; // eax@307 | |
4604 char v53; // zf@312 | |
4605 char v54; // zf@336 | |
4606 char v55; // zf@348 | |
4607 int v56; // eax@365 | |
4608 int v57; // ebx@368 | |
4609 signed int v58; // [sp-4h] [bp-20h]@10 | |
4610 signed int v59; // [sp-4h] [bp-20h]@71 | |
4611 signed int v60; // [sp-4h] [bp-20h]@347 | |
4612 int v61; // [sp+10h] [bp-Ch]@1 | |
4613 int v62; // [sp+14h] [bp-8h]@1 | |
4614 int v63; // [sp+18h] [bp-4h]@101 | |
4615 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4616 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4617 | |
4618 v3 = attr; | |
4619 v4 = 36; | |
4620 v5 = 0; | |
4621 v6 = this; | |
4622 v62 = 0; | |
4623 v61 = 0; | |
4624 | |
4625 switch (attr) | |
4626 { | |
4627 case CHARACTER_ATTRIBUTE_LEVEL: | |
4628 if (HasEnchantedItemEquipped(25)) | |
4629 return 5; | |
4630 return 0; | |
4631 }; | |
4632 | |
4633 if ( (signed int)attr > 36 ) | |
4634 { | |
4635 switch ( attr ) | |
4636 { | |
4637 case 37: | |
4638 v58 = 15; | |
4639 goto LABEL_35; | |
4640 case 38: | |
4641 v58 = 16; | |
4642 goto LABEL_35; | |
4643 case 39: | |
4644 v58 = 17; | |
4645 goto LABEL_35; | |
4646 case 40: | |
4647 v58 = 18; | |
4648 goto LABEL_35; | |
4649 case 41: | |
4650 v58 = 19; | |
4651 goto LABEL_35; | |
4652 case 42: | |
4653 v58 = 20; | |
4654 goto LABEL_35; | |
4655 case 43: | |
4656 v58 = 25; | |
4657 goto LABEL_35; | |
4658 case 44: | |
4659 v58 = 5; | |
4660 goto LABEL_35; | |
4661 case 45: | |
4662 v58 = 8; | |
4663 goto LABEL_35; | |
4664 case 46: | |
4665 goto LABEL_36; | |
4666 default: | |
4667 break; | |
4668 } | |
4669 } | |
4670 else | |
4671 { | |
4672 if ( attr == 36 ) | |
4673 { | |
4674 v58 = 14; | |
4675 } | |
4676 else | |
4677 { | |
4678 if ( (signed int)attr > 21 ) | |
4679 { | |
4680 switch ( attr ) | |
4681 { | |
4682 case 22: | |
4683 v58 = 30; | |
4684 break; | |
4685 case 23: | |
4686 v58 = 31; | |
4687 break; | |
4688 case 34: | |
4689 v58 = 12; | |
4690 break; | |
4691 default: | |
4692 if ( attr != 35 ) | |
4693 goto LABEL_38; | |
4694 v58 = 13; | |
4695 break; | |
4696 } | |
4697 } | |
4698 else | |
4699 { | |
4700 switch ( attr ) | |
4701 { | |
4702 case 21: | |
4703 v58 = 33; | |
4704 break; | |
4705 case 16: | |
4706 v58 = 35; | |
4707 break; | |
4708 case 17: | |
4709 v58 = 34; | |
4710 break; | |
4711 case 18: | |
4712 v58 = 29; | |
4713 break; | |
4714 case 19: | |
4715 v58 = 21; | |
4716 break; | |
4717 default: | |
4718 if ( attr != 20 ) | |
4719 goto LABEL_38; | |
4720 v58 = 32; | |
4721 break; | |
4722 } | |
4723 } | |
4724 } | |
4725 LABEL_35: | |
4726 v4 = v58; | |
4727 LABEL_36: | |
4728 if ( !this->pActiveSkills[v4] ) | |
4729 return 0; | |
4730 } | |
4731 LABEL_38: | |
4732 if ( (signed int)attr > 28 ) | |
4733 { | |
4734 if ( (signed int)attr < 29 ) | |
4735 return v5 + v62 + v61; | |
4736 if ( (signed int)attr <= 30 ) | |
4737 { | |
4738 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4739 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4740 return v5 + v62 + v61; |
4741 } | |
4742 if ( attr == 31 ) | |
4743 { | |
4744 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4745 return v5 + v62 + v61; | |
232 | 4746 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4747 v5 = pItemsTable->pItems[v57].uDamageMod; |
4748 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4749 goto LABEL_366; | |
4750 } | |
4751 if ( attr == 32 ) | |
4752 { | |
4753 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4754 return v5 + v62 + v61; | |
232 | 4755 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4756 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4757 LABEL_365: | |
4758 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4759 LABEL_366: | |
4760 v5 += v56; | |
4761 return v5 + v62 + v61; | |
4762 } | |
4763 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4764 return v5 + v62 + v61; | |
4765 LABEL_95: | |
4766 v65 = 0; | |
4767 while ( 1 ) | |
4768 { | |
4769 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4770 goto LABEL_361; | |
898 | 4771 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4772 if ( v3 == 9 ) |
4773 { | |
816 | 4774 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4775 if ( v32 >= 3 ) |
4776 { | |
4777 if ( v32 <= 11 ) | |
4778 { | |
4779 v33 = v6->pInventoryItems[v31].uItemID; | |
4780 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4781 } | |
4782 } | |
4783 } | |
4784 v63 = (int)((char *)v6 + 36 * v31); | |
4785 attra = (ItemGen *)(v63 + 532); | |
377 | 4786 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4787 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4788 { |
4789 v34 = attra->uItemID; | |
4790 switch ( attra->uItemID ) | |
4791 { | |
4792 case 0x1F4u: | |
4793 v35 = v3 == 5; | |
4794 goto LABEL_105; | |
4795 case 0x1F5u: | |
4796 v36 = v3 == 0; | |
4797 goto LABEL_108; | |
4798 case 0x1F6u: | |
4799 if ( v3 == 21 ) | |
4800 v61 += 10; | |
4801 v36 = v3 == 2; | |
4802 goto LABEL_108; | |
4803 case 0x1F7u: | |
4804 if ( v3 == 17 ) | |
4805 v61 += 5; | |
4806 if ( v3 == 18 ) | |
4807 v61 += 5; | |
4808 v36 = v3 == 6; | |
4809 goto LABEL_108; | |
4810 case 0x1F8u: | |
4811 goto LABEL_118; | |
4812 case 0x1F9u: | |
4813 v40 = v3 == 3; | |
4814 goto LABEL_123; | |
4815 case 0x1FAu: | |
4816 v35 = v3 == 10; | |
4817 goto LABEL_105; | |
4818 case 0x1FEu: | |
4819 v35 = v3 == 4; | |
4820 goto LABEL_105; | |
4821 case 0x1FFu: | |
4822 if ( v3 == 23 ) | |
4823 v61 += 10; | |
4824 if ( v3 == 22 ) | |
4825 v61 += 10; | |
4826 goto LABEL_361; | |
4827 case 0x200u: | |
4828 if ( v3 == 36 ) | |
4829 { | |
4830 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4831 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4832 } | |
4833 v36 = v3 == 5; | |
4834 LABEL_108: | |
4835 if ( v36 ) | |
4836 v5 += 40; | |
4837 goto LABEL_361; | |
4838 case 0x201u: | |
4839 if ( v3 == 39 ) | |
4840 { | |
4841 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4842 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4843 v62 = v34; | |
4844 } | |
4845 goto LABEL_136; | |
4846 case 0x202u: | |
4847 if ( !v3 ) | |
4848 v5 += 150; | |
4849 if ( v3 == 1 ) | |
4850 v5 -= 40; | |
4851 if ( v3 == 2 ) | |
4852 v5 -= 40; | |
4853 goto LABEL_145; | |
4854 case 0x203u: | |
4855 if ( v3 == 42 ) | |
4856 { | |
4857 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4858 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4859 } | |
4860 if ( v3 == 43 ) | |
4861 v61 += 15; | |
4862 goto LABEL_361; | |
4863 case 0x204u: | |
4864 if ( v3 == 17 ) | |
4865 v61 += 5; | |
4866 if ( v3 == 18 ) | |
4867 v61 += 5; | |
4868 if ( v3 == 6 ) | |
4869 v5 += 50; | |
4870 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4871 goto LABEL_166; | |
4872 v42 = v3 == 15; | |
4873 goto LABEL_165; | |
4874 case 0x205u: | |
4875 if ( v3 == 18 ) | |
4876 v61 += 5; | |
4877 goto LABEL_361; | |
4878 case 0x206u: | |
4879 if ( !v3 ) | |
4880 v5 += 100; | |
4881 if ( v3 == 3 ) | |
4882 v5 += 100; | |
4883 v43 = v3 == 9; | |
4884 goto LABEL_174; | |
4885 case 0x207u: | |
4886 if ( v3 == 45 ) | |
4887 v61 += 5; | |
4888 if ( v3 == 15 ) | |
4889 v5 -= 10; | |
4890 v42 = v3 == 14; | |
4891 LABEL_165: | |
4892 if ( v42 ) | |
4893 LABEL_166: | |
4894 v5 -= 10; | |
4895 goto LABEL_361; | |
4896 case 0x208u: | |
4897 v35 = v3 == 3; | |
4898 goto LABEL_105; | |
4899 case 0x209u: | |
4900 if ( v3 == 2 ) | |
4901 v5 += 15; | |
4902 if ( !v3 ) | |
4903 v5 += 15; | |
4904 v41 = v3 == 6; | |
4905 goto LABEL_146; | |
4906 case 0x20Au: | |
4907 if ( v3 == 46 ) | |
4908 v61 += 15; | |
4909 v44 = v3 == 3; | |
4910 goto LABEL_190; | |
4911 case 0x20Bu: | |
4912 if ( v3 == 34 ) | |
4913 { | |
4914 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4915 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4916 } | |
4917 if ( v3 == 12 ) | |
4918 v5 += 50; | |
4919 if ( v3 == 2 ) | |
4920 v5 += 30; | |
4921 v45 = v3 == 9; | |
4922 goto LABEL_199; | |
4923 case 0x20Cu: | |
4924 if ( !v3 ) | |
4925 v5 += 75; | |
4926 goto LABEL_145; | |
4927 case 0x20Du: | |
4928 if ( v3 == 5 ) | |
4929 v5 += 50; | |
4930 if ( v3 == 6 ) | |
4931 v5 += 50; | |
4932 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4933 goto LABEL_374; | |
4934 v43 = v3 == 15; | |
4935 LABEL_174: | |
4936 if ( v43 ) | |
4937 LABEL_374: | |
4938 v5 -= 15; | |
4939 goto LABEL_361; | |
4940 case 0x20Eu: | |
4941 if ( v3 == 4 ) | |
4942 v5 += 150; | |
4943 if ( v3 == 44 ) | |
4944 v61 += 5; | |
4945 if ( v3 == 9 ) | |
4946 v5 -= 25; | |
4947 goto LABEL_361; | |
4948 case 0x20Fu: | |
4949 if ( v3 == 39 ) | |
4950 { | |
4951 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4952 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4953 v62 = v34; | |
4954 } | |
4955 if ( v3 == 40 ) | |
4956 { | |
4957 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4958 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4959 } | |
4960 LABEL_145: | |
4961 v41 = v3 == 5; | |
4962 LABEL_146: | |
4963 if ( v41 ) | |
4964 v5 -= 40; | |
4965 goto LABEL_361; | |
4966 case 0x210u: | |
4967 if ( v3 == 38 ) | |
4968 { | |
4969 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4970 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4971 } | |
4972 if ( !v3 ) | |
4973 v5 += 75; | |
4974 v44 = v3 == 11; | |
4975 LABEL_190: | |
4976 if ( v44 ) | |
4977 v5 -= 50; | |
4978 goto LABEL_361; | |
4979 case 0x211u: | |
4980 if ( v3 == 5 ) | |
4981 v5 += 100; | |
4982 if ( v3 == 4 ) | |
4983 v5 += 50; | |
4984 v35 = v3 == 11; | |
4985 LABEL_105: | |
4986 if ( v35 ) | |
4987 v5 += 50; | |
4988 goto LABEL_361; | |
4989 case 0x212u: | |
4990 if ( v3 == 1 ) | |
4991 v5 -= 20; | |
4992 v45 = v3 == 2; | |
4993 LABEL_199: | |
4994 if ( v45 ) | |
4995 v5 -= 20; | |
4996 goto LABEL_361; | |
4997 case 0x214u: | |
4998 if ( v3 == 1 ) | |
4999 v5 += 15; | |
5000 v46 = v3 == 2; | |
5001 goto LABEL_240; | |
5002 case 0x215u: | |
5003 if ( v3 == 5 ) | |
5004 v5 += 15; | |
5005 v46 = v3 == 4; | |
5006 goto LABEL_240; | |
5007 case 0x216u: | |
5008 if ( v3 == 10 ) | |
5009 v5 += 30; | |
5010 if ( !v3 ) | |
5011 v5 += 15; | |
5012 goto LABEL_315; | |
5013 case 0x217u: | |
5014 if ( v3 == 21 ) | |
5015 v61 += 5; | |
5016 if ( !v3 ) | |
5017 v5 += 15; | |
5018 goto LABEL_253; | |
5019 case 0x218u: | |
5020 goto LABEL_253; | |
5021 default: | |
5022 goto LABEL_361; | |
5023 } | |
5024 goto LABEL_361; | |
5025 } | |
5026 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5027 { | |
5028 if ( (signed int)v3 >= 0 ) | |
5029 { | |
5030 if ( (signed int)v3 <= 15 ) | |
5031 { | |
5032 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5033 } | |
5034 else | |
5035 { | |
5036 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5037 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5038 } | |
5039 } | |
5040 goto LABEL_361; | |
5041 } | |
5042 v34 = *(int *)(v63 + 544); | |
5043 if ( v34 > 48 ) | |
5044 { | |
5045 switch ( v34 ) | |
5046 { | |
5047 case 54: | |
5048 goto LABEL_315; | |
5049 case 49: | |
5050 if ( v3 == 6 ) | |
5051 goto LABEL_121; | |
5052 v50 = v3 == 1; | |
5053 goto LABEL_296; | |
5054 case 51: | |
5055 if ( v3 != 5 && v3 != 1 ) | |
5056 goto LABEL_309; | |
5057 goto LABEL_121; | |
5058 case 52: | |
5059 if ( v3 == 3 ) | |
5060 goto LABEL_121; | |
5061 v50 = v3 == 4; | |
5062 goto LABEL_296; | |
5063 case 53: | |
5064 if ( !v3 ) | |
5065 goto LABEL_121; | |
5066 v50 = v3 == 2; | |
5067 goto LABEL_296; | |
5068 case 55: | |
5069 v46 = v3 == 6; | |
5070 goto LABEL_240; | |
5071 case 56: | |
5072 if ( !v3 ) | |
5073 goto LABEL_351; | |
5074 v53 = v3 == 3; | |
5075 goto LABEL_350; | |
5076 case 57: | |
5077 if ( v3 == 1 ) | |
5078 goto LABEL_351; | |
5079 v53 = v3 == 2; | |
5080 goto LABEL_350; | |
5081 case 50: | |
5082 if ( v3 == 10 ) | |
5083 v5 += 30; | |
5084 goto LABEL_361; | |
5085 case 60: | |
5086 if ( v3 != 23 ) | |
5087 goto LABEL_336; | |
5088 if ( v5 >= 3 ) | |
5089 goto LABEL_361; | |
5090 v5 = 3; | |
5091 LABEL_336: | |
5092 v54 = v3 == 22; | |
5093 goto LABEL_345; | |
5094 case 61: | |
5095 if ( v3 != 17 ) | |
5096 goto LABEL_340; | |
5097 if ( v5 >= 3 ) | |
5098 goto LABEL_361; | |
5099 v5 = 3; | |
5100 LABEL_340: | |
5101 v54 = v3 == 18; | |
5102 goto LABEL_345; | |
5103 case 62: | |
5104 if ( v3 != 19 ) | |
5105 goto LABEL_344; | |
5106 if ( v5 >= 3 ) | |
5107 goto LABEL_361; | |
5108 v5 = 3; | |
5109 LABEL_344: | |
5110 v54 = v3 == 20; | |
5111 LABEL_345: | |
5112 if ( !v54 ) | |
5113 goto LABEL_361; | |
5114 if ( v5 >= 3 ) | |
5115 goto LABEL_361; | |
5116 v60 = 3; | |
5117 goto LABEL_360; | |
5118 case 67: | |
5119 v55 = v3 == 18; | |
5120 goto LABEL_357; | |
5121 case 68: | |
5122 v53 = v3 == 9; | |
5123 goto LABEL_350; | |
5124 case 69: | |
5125 if ( v3 == 11 ) | |
5126 v5 += 20; | |
5127 break; | |
5128 case 70: | |
5129 if ( v3 == 12 ) | |
5130 v5 += 10; | |
5131 v55 = v3 == 16; | |
5132 LABEL_357: | |
5133 if ( v55 && v5 < 2 ) | |
5134 { | |
5135 v60 = 2; | |
5136 LABEL_360: | |
5137 v5 = v60; | |
5138 } | |
5139 break; | |
5140 default: | |
5141 goto LABEL_361; | |
5142 } | |
5143 goto LABEL_361; | |
5144 } | |
5145 if ( v34 == 48 ) | |
5146 { | |
5147 if ( v3 == 9 ) | |
5148 v5 += 5; | |
5149 LABEL_315: | |
5150 v46 = v3 == 3; | |
5151 LABEL_240: | |
5152 if ( v46 ) | |
5153 v5 += 15; | |
5154 goto LABEL_361; | |
5155 } | |
5156 if ( v34 > 32 ) | |
5157 { | |
5158 if ( v34 > 44 ) | |
5159 { | |
5160 v51 = v34 - 45; | |
5161 if ( !v51 ) | |
5162 { | |
5163 if ( v3 == 5 ) | |
5164 goto LABEL_351; | |
5165 v53 = v3 == 4; | |
5166 LABEL_350: | |
5167 if ( v53 ) | |
5168 LABEL_351: | |
5169 v5 += 5; | |
5170 goto LABEL_361; | |
5171 } | |
5172 v52 = v51 - 1; | |
5173 if ( !v52 ) | |
5174 { | |
5175 v40 = v3 == 0; | |
5176 LABEL_123: | |
5177 if ( v40 ) | |
5178 v5 += 25; | |
5179 goto LABEL_361; | |
5180 } | |
5181 if ( v52 == 1 ) | |
5182 { | |
5183 LABEL_309: | |
5184 v50 = v3 == 8; | |
5185 goto LABEL_296; | |
5186 } | |
5187 } | |
5188 else | |
5189 { | |
5190 if ( v34 == 44 ) | |
5191 { | |
5192 v50 = v3 == 7; | |
5193 goto LABEL_296; | |
5194 } | |
5195 v34 -= 33; | |
5196 if ( !v34 ) | |
5197 { | |
5198 if ( v3 != 38 ) | |
5199 goto LABEL_361; | |
5200 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5201 goto LABEL_138; | |
5202 } | |
5203 --v34; | |
5204 if ( !v34 ) | |
5205 { | |
5206 if ( v3 != 36 ) | |
5207 goto LABEL_361; | |
5208 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5209 goto LABEL_138; | |
5210 } | |
5211 v49 = v34 - 8; | |
5212 if ( !v49 ) | |
5213 { | |
5214 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5215 ++v5; | |
5216 goto LABEL_361; | |
5217 } | |
5218 if ( v49 == 1 ) | |
5219 { | |
5220 if ( v3 != 3 && v3 != 7 ) | |
5221 { | |
5222 v50 = v3 == 9; | |
5223 LABEL_296: | |
5224 if ( !v50 ) | |
5225 goto LABEL_361; | |
5226 } | |
5227 LABEL_121: | |
5228 v5 += 10; | |
5229 goto LABEL_361; | |
5230 } | |
5231 } | |
5232 } | |
5233 else | |
5234 { | |
5235 if ( v34 == 32 ) | |
5236 { | |
5237 if ( v3 != 39 ) | |
5238 goto LABEL_361; | |
5239 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5240 goto LABEL_138; | |
5241 } | |
5242 if ( v34 > 28 ) | |
5243 { | |
5244 v34 -= 29; | |
5245 if ( v34 ) | |
5246 { | |
5247 --v34; | |
5248 if ( v34 ) | |
5249 { | |
5250 --v34; | |
5251 if ( v34 || v3 != 41 ) | |
5252 goto LABEL_361; | |
5253 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5254 } | |
5255 else | |
5256 { | |
5257 if ( v3 != 34 ) | |
5258 goto LABEL_361; | |
5259 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5260 } | |
5261 } | |
5262 else | |
5263 { | |
5264 if ( v3 != 37 ) | |
5265 goto LABEL_361; | |
5266 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5267 } | |
5268 goto LABEL_138; | |
5269 } | |
5270 if ( v34 == 28 ) | |
5271 { | |
5272 LABEL_136: | |
5273 if ( v3 == 42 ) | |
5274 { | |
5275 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5276 LABEL_138: | |
5277 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5278 goto LABEL_361; | |
5279 } | |
5280 } | |
5281 else | |
5282 { | |
5283 v47 = v34 - 1; | |
5284 if ( v47 ) | |
5285 { | |
5286 v48 = v47 - 1; | |
5287 if ( v48 ) | |
5288 { | |
5289 v34 = v48 - 24; | |
5290 if ( v34 ) | |
5291 { | |
5292 --v34; | |
5293 if ( v34 || v3 != 40 ) | |
5294 goto LABEL_361; | |
5295 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5296 } | |
5297 else | |
5298 { | |
5299 if ( v3 != 35 ) | |
5300 goto LABEL_361; | |
5301 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5302 } | |
5303 goto LABEL_138; | |
5304 } | |
5305 LABEL_118: | |
5306 if ( (signed int)v3 < 0 ) | |
5307 goto LABEL_361; | |
5308 v39 = __OFSUB__((int)v3, 6); | |
5309 v37 = v3 == 6; | |
5310 v38 = v3 - 6 < 0; | |
5311 } | |
5312 else | |
5313 { | |
5314 LABEL_253: | |
5315 if ( (signed int)v3 < 10 ) | |
5316 goto LABEL_361; | |
5317 v39 = __OFSUB__((int)v3, 15); | |
5318 v37 = v3 == 15; | |
5319 v38 = v3 - 15 < 0; | |
5320 } | |
5321 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5322 goto LABEL_121; | |
5323 } | |
5324 } | |
5325 LABEL_361: | |
5326 ++v65; | |
5327 if ( (signed int)v65 >= 16 ) | |
5328 return v5 + v62 + v61; | |
5329 } | |
5330 } | |
5331 if ( attr == 28 ) | |
5332 { | |
5333 if ( IsUnarmed() != 1 ) | |
5334 { | |
816 | 5335 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5336 { | |
5337 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5338 if ( v22 >= 0 ) |
5339 { | |
5340 if ( v22 <= 2 ) | |
5341 { | |
118 | 5342 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5343 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5344 { |
5345 v24 = v23; | |
5346 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5347 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5348 } | |
5349 else | |
5350 { | |
5351 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5352 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5353 } | |
5354 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5355 } | |
5356 } | |
5357 } | |
865 | 5358 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5359 return v5 + v62 + v61; |
5360 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5361 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5362 goto LABEL_88; | |
5363 } | |
5364 v59 = 3; | |
5365 LABEL_74: | |
5366 v5 = v59; | |
5367 return v5 + v62 + v61; | |
5368 } | |
5369 if ( (signed int)attr < 0 ) | |
5370 return v5 + v62 + v61; | |
5371 if ( (signed int)attr <= 23 ) | |
5372 goto LABEL_95; | |
5373 if ( (signed int)attr <= 24 ) | |
5374 return v5 + v62 + v61; | |
5375 if ( (signed int)attr <= 26 ) | |
5376 { | |
5377 if ( IsUnarmed() == 1 ) | |
5378 { | |
5379 v5 = 0; | |
5380 return v5 + v62 + v61; | |
5381 } | |
816 | 5382 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5383 { | |
5384 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5385 if ( v17 >= 0 ) |
5386 { | |
5387 if ( v17 <= 2 ) | |
232 | 5388 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5389 } |
5390 } | |
865 | 5391 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5392 return v5 + v62 + v61; |
898 | 5393 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5394 goto LABEL_365; |
5395 } | |
5396 if ( attr == 27 ) | |
5397 { | |
5398 if ( IsUnarmed() == 1 ) | |
5399 { | |
5400 v5 = 1; | |
5401 return v5 + v62 + v61; | |
5402 } | |
816 | 5403 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5404 { | |
5405 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5406 if ( v9 >= 0 ) |
5407 { | |
5408 if ( v9 <= 2 ) | |
5409 { | |
118 | 5410 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
898 | 5411 if ( !v6->pEquipment.uShield ) |
0 | 5412 { |
118 | 5413 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5414 ++v5; |
5415 } | |
5416 } | |
5417 } | |
5418 } | |
865 | 5419 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5420 return v5 + v62 + v61; |
898 | 5421 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5422 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5423 LABEL_88: |
5424 v5 += v15 + v14; | |
5425 } | |
5426 return v5 + v62 + v61; | |
5427 } | |
5428 | |
5429 //----- (0048F73C) -------------------------------------------------------- | |
5430 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5431 { | |
5432 int result; // eax@1 | |
5433 int v3; // eax@4 | |
5434 int v4; // ecx@5 | |
5435 | |
5436 switch (a2) | |
5437 { | |
5438 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5439 } | |
5440 | |
5441 result = 0; | |
5442 if ( (signed int)a2 > 10 ) | |
5443 { | |
5444 if ( (signed int)a2 <= 15 ) | |
5445 { | |
5446 switch ( a2 ) | |
5447 { | |
5448 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5449 v3 = this->pPlayerBuffs[2].uPower; | |
5450 v4 = pParty->pPartyBuffs[1].uPower; | |
5451 break; | |
5452 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5453 v3 = this->pPlayerBuffs[0].uPower; | |
5454 v4 = pParty->pPartyBuffs[0].uPower; | |
5455 break; | |
5456 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5457 v3 = this->pPlayerBuffs[22].uPower; | |
5458 v4 = pParty->pPartyBuffs[17].uPower; | |
5459 break; | |
5460 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5461 v3 = this->pPlayerBuffs[3].uPower; | |
5462 v4 = pParty->pPartyBuffs[4].uPower; | |
5463 break; | |
5464 default: | |
5465 if ( a2 != 14 ) | |
5466 return result; | |
5467 v3 = this->pPlayerBuffs[9].uPower; | |
5468 v4 = pParty->pPartyBuffs[12].uPower; | |
5469 break; | |
5470 } | |
5471 return v4 + v3; | |
5472 } | |
5473 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5474 { | |
5475 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5476 { | |
5477 v3 = this->pPlayerBuffs[8].uPower; | |
5478 v4 = pParty->pPartyBuffs[9].uPower; | |
5479 return v4 + v3; | |
5480 } | |
5481 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5482 return result; | |
5483 } | |
5484 return this->pPlayerBuffs[1].uPower; | |
5485 } | |
5486 if ( a2 == 10 ) | |
5487 { | |
5488 v3 = this->pPlayerBuffs[5].uPower; | |
5489 v4 = pParty->pPartyBuffs[6].uPower; | |
5490 return v4 + v3; | |
5491 } | |
5492 switch ( a2 ) | |
5493 { | |
5494 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5495 v3 = pPlayerBuffs[19].uPower; | |
5496 goto LABEL_5; | |
5497 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5498 v3 = pPlayerBuffs[17].uPower; | |
5499 goto LABEL_5; | |
5500 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5501 v3 = pPlayerBuffs[20].uPower; | |
5502 goto LABEL_5; | |
5503 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5504 v3 = pPlayerBuffs[16].uPower; | |
5505 goto LABEL_5; | |
5506 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5507 v3 = pPlayerBuffs[15].uPower; | |
5508 goto LABEL_5; | |
5509 case CHARACTER_ATTRIBUTE_SPEED: | |
5510 v3 = pPlayerBuffs[21].uPower; | |
5511 goto LABEL_5; | |
5512 case CHARACTER_ATTRIBUTE_LUCK: | |
5513 v3 = pPlayerBuffs[18].uPower; | |
5514 LABEL_5: | |
5515 v4 = pParty->pPartyBuffs[2].uPower; | |
5516 return v4 + v3; | |
5517 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5518 v3 = this->pPlayerBuffs[14].uPower; | |
5519 v4 = pParty->pPartyBuffs[15].uPower; | |
5520 return v4 + v3; | |
5521 default: | |
5522 return result; | |
5523 } | |
5524 return result; | |
5525 } | |
5526 | |
5527 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5528 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5529 { | |
0 | 5530 signed int v2; // esi@1 |
5531 unsigned __int16 v3; // ax@126 | |
5532 char result; // al@127 | |
5533 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5534 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5535 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5536 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5537 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5538 | |
0 | 5539 v2 = 0; |
353 | 5540 switch (uSkillType) |
5541 { | |
5542 case PLAYER_SKILL_MONSTER_ID: | |
5543 { | |
652 | 5544 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5545 v2 = 6; |
652 | 5546 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5547 v2 += 6; |
5548 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5549 v2 += GetItemsBonus(v8, 0); | |
5550 } | |
5551 break; | |
5552 | |
5553 case PLAYER_SKILL_ARMSMASTER: | |
5554 { | |
652 | 5555 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5556 v2 = 2; |
652 | 5557 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5558 v2 += 3; |
353 | 5559 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5560 v2 += GetItemsBonus(v8, 0); | |
5561 } | |
5562 break; | |
5563 | |
5564 case PLAYER_SKILL_STEALING: | |
5565 { | |
652 | 5566 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5567 v2 = 8; |
5568 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5569 v2 += GetItemsBonus(v8, 0); | |
5570 } | |
5571 break; | |
5572 | |
5573 | |
5574 case PLAYER_SKILL_ALCHEMY: | |
5575 { | |
652 | 5576 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5577 v2 = 4; |
652 | 5578 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5579 v2 += 8; |
5580 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5581 v2 += GetItemsBonus(v8, 0); | |
5582 } | |
5583 break; | |
5584 | |
5585 case PLAYER_SKILL_LEARNING: | |
5586 { | |
652 | 5587 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5588 v2 = 10; |
652 | 5589 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5590 v2 += 15; |
652 | 5591 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5592 v2 += 5; |
5593 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5594 v2 += GetItemsBonus(v8, 0); | |
5595 } | |
5596 break; | |
5597 | |
5598 case PLAYER_SKILL_UNARMED: | |
5599 { | |
652 | 5600 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5601 v2 = 2; |
5602 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5603 v2 += GetItemsBonus(v8, 0); | |
5604 } | |
5605 break; | |
5606 | |
5607 case PLAYER_SKILL_DODGE: | |
5608 { | |
652 | 5609 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5610 v2 = 2; |
5611 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5612 v2 += GetItemsBonus(v8, 0); | |
5613 } | |
5614 break; | |
5615 | |
5616 case PLAYER_SKILL_BOW: | |
5617 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5618 v2 += GetItemsBonus(v8, 0); | |
5619 break; | |
5620 case PLAYER_SKILL_SHIELD: | |
5621 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5622 v2 += GetItemsBonus(v8, 0); | |
5623 break; | |
5624 | |
5625 case PLAYER_SKILL_EARTH: | |
652 | 5626 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5627 v2 = 2; |
652 | 5628 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5629 v2 += 3; |
652 | 5630 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5631 v2 += 4; |
5632 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5633 v2 += 3; | |
5634 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5635 v2 += GetItemsBonus(v8, 0); | |
5636 break; | |
5637 case PLAYER_SKILL_FIRE: | |
652 | 5638 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5639 v2 = 2; |
652 | 5640 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5641 v2 += 3; |
652 | 5642 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5643 v2 += 4; |
5644 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5645 v2 += 3; | |
5646 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5647 v2 += GetItemsBonus(v8, 0); | |
5648 break; | |
5649 case PLAYER_SKILL_AIR: | |
652 | 5650 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5651 v2 = 2; |
652 | 5652 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5653 v2 += 3; |
652 | 5654 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5655 v2 += 4; |
5656 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5657 v2 += 3; | |
5658 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5659 v2 += GetItemsBonus(v8, 0); | |
5660 break; | |
5661 case PLAYER_SKILL_WATER: | |
652 | 5662 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5663 v2 = 2; |
652 | 5664 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5665 v2 += 3; |
652 | 5666 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5667 v2 += 4; |
5668 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5669 v2 += 3; | |
5670 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5671 v2 += GetItemsBonus(v8, 0); | |
5672 break; | |
5673 case PLAYER_SKILL_SPIRIT: | |
652 | 5674 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5675 v2 = 2; |
652 | 5676 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5677 v2 += 3; |
652 | 5678 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5679 v2 += 4; |
5680 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5681 v2 += GetItemsBonus(v8, 0); | |
5682 break; | |
5683 case PLAYER_SKILL_MIND: | |
652 | 5684 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5685 v2 = 2; |
652 | 5686 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5687 v2 += 3; |
652 | 5688 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5689 v2 += 4; |
5690 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5691 v2 += GetItemsBonus(v8, 0); | |
5692 break; | |
5693 case PLAYER_SKILL_BODY: | |
652 | 5694 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5695 v2 = 2; |
652 | 5696 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5697 v2 += 3; |
652 | 5698 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5699 v2 += 4; |
5700 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5701 v2 += GetItemsBonus(v8, 0); | |
5702 break; | |
5703 case PLAYER_SKILL_LIGHT: | |
5704 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5705 v2 += GetItemsBonus(v8, 0); | |
5706 break; | |
5707 case PLAYER_SKILL_DARK: | |
5708 { | |
5709 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5710 v2 += GetItemsBonus(v8, 0); | |
5711 } | |
5712 break; | |
5713 | |
5714 case PLAYER_SKILL_MERCHANT: | |
5715 { | |
652 | 5716 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5717 v2 = 4; |
652 | 5718 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5719 v2 += 6; |
652 | 5720 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5721 v2 += 3; |
652 | 5722 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5723 v2 += 8; |
5724 } | |
5725 break; | |
5726 | |
5727 case PLAYER_SKILL_PERCEPTION: | |
5728 { | |
652 | 5729 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5730 v2 = 6; |
652 | 5731 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5732 v2 += 5; |
5733 } | |
5734 break; | |
5735 | |
0 | 5736 case PLAYER_SKILL_ITEM_ID: |
5737 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5738 v2 += GetItemsBonus(v8, 0); |
0 | 5739 break; |
5740 case PLAYER_SKILL_MEDITATION: | |
5741 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5742 v2 += GetItemsBonus(v8, 0); |
5743 break; | |
0 | 5744 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5745 { |
652 | 5746 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5747 v2 = 4; |
652 | 5748 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5749 v2 += 6; |
652 | 5750 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5751 v2 += 8; |
0 | 5752 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5753 v2 += GetItemsBonus(v8, 0); |
5754 } | |
5755 break; | |
5756 } | |
5757 | |
5758 v3 = pActiveSkills[uSkillType]; | |
1008 | 5759 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5760 result = v2 + v3; |
5761 else | |
1008 | 5762 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5763 return result; |
5764 } | |
5765 | |
5766 //----- (0048FC00) -------------------------------------------------------- | |
5767 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5768 { | |
5769 Player *v2; // esi@1 | |
5770 int v3; // eax@1 | |
5771 char v4; // di@1 | |
5772 signed int v5; // ebx@1 | |
5773 unsigned int v6; // eax@2 | |
5774 unsigned __int8 v7; // sf@5 | |
5775 unsigned __int8 v8; // of@5 | |
5776 PlayerEquipment *v9; // ebx@19 | |
5777 Player *v10; // ecx@20 | |
821 | 5778 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5779 int v12; // eax@21 |
5780 int v13; // edi@21 | |
5781 char v14; // di@25 | |
5782 signed int v15; // esi@25 | |
5783 char v16; // al@32 | |
5784 int v18; // eax@36 | |
5785 unsigned int v19; // eax@37 | |
5786 ITEM_EQUIP_TYPE v20; // edi@40 | |
5787 int v21; // edx@41 | |
5788 int v22; // eax@42 | |
821 | 5789 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5790 unsigned __int16 v24; // ax@45 |
5791 unsigned __int16 v25; // bx@45 | |
5792 unsigned int v26; // eax@45 | |
5793 unsigned __int8 v27; // sf@50 | |
5794 unsigned __int8 v28; // of@50 | |
5795 unsigned int v29; // eax@52 | |
5796 int v30; // eax@55 | |
5797 int v31; // eax@58 | |
5798 unsigned int v32; // eax@59 | |
5799 int v33; // eax@65 | |
5800 char v34; // si@65 | |
5801 ITEM_EQUIP_TYPE v35; // edi@69 | |
5802 int v36; // edx@70 | |
5803 int v37; // eax@71 | |
821 | 5804 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5805 int v39; // eax@74 |
5806 int v40; // eax@89 | |
5807 char v41; // si@89 | |
5808 int v42; // eax@96 | |
821 | 5809 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5810 int v44; // eax@97 |
5811 int v45; // eax@98 | |
5812 int v46; // eax@99 | |
5813 int v47; // eax@100 | |
5814 int v48; // eax@101 | |
5815 int v49; // eax@102 | |
5816 unsigned __int16 v50; // ax@113 | |
5817 char v51; // di@113 | |
5818 unsigned int v52; // eax@113 | |
5819 int v53; // edi@113 | |
5820 signed int i; // ecx@113 | |
5821 unsigned __int16 v55; // ax@118 | |
5822 char v56; // si@118 | |
5823 unsigned int v57; // eax@118 | |
5824 int v58; // esi@121 | |
5825 signed int j; // ecx@121 | |
5826 int v60; // edi@126 | |
5827 int v61; // eax@126 | |
5828 signed int v62; // [sp-4h] [bp-30h]@26 | |
5829 signed int v63; // [sp-4h] [bp-30h]@80 | |
5830 int v64; // [sp+Ch] [bp-20h]@104 | |
5831 int v65; // [sp+10h] [bp-1Ch]@104 | |
5832 int v66; // [sp+14h] [bp-18h]@104 | |
5833 int v67; // [sp+18h] [bp-14h]@104 | |
5834 int v68; // [sp+1Ch] [bp-10h]@69 | |
5835 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5836 int v70; // [sp+24h] [bp-8h]@1 | |
5837 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5838 int a1; // [sp+34h] [bp+8h]@21 | |
5839 int a1a; // [sp+34h] [bp+8h]@74 | |
5840 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5841 | |
5842 v2 = this; | |
5843 v70 = 0; | |
5844 v69 = 0; | |
5845 v71 = (ITEM_EQUIP_TYPE)0; | |
5846 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5847 v4 = v3; | |
5848 v5 = 1; | |
5849 if ( v3 ) | |
5850 { | |
5851 v6 = SkillToMastery(v3); | |
5852 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5853 { | |
5854 if ( (signed int)v6 >= 4 ) | |
5855 goto LABEL_4; | |
5856 v8 = __OFSUB__(v6, 3); | |
5857 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5858 } | |
5859 else | |
5860 { | |
5861 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5862 goto LABEL_11; | |
5863 if ( (signed int)v6 >= 4 ) | |
5864 { | |
5865 LABEL_4: | |
5866 v71 = (ITEM_EQUIP_TYPE)2; | |
5867 LABEL_11: | |
5868 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5869 goto LABEL_12; | |
5870 } | |
5871 v8 = __OFSUB__(v6, 2); | |
5872 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5873 } | |
5874 if ( !(v7 ^ v8) ) | |
5875 v71 = (ITEM_EQUIP_TYPE)1; | |
5876 goto LABEL_11; | |
5877 } | |
5878 LABEL_12: | |
5879 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5880 { | |
135 | 5881 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5882 v61 = v2->GetBodybuilding(); |
5883 return v60 * v61; | |
5884 } | |
5885 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5886 { | |
135 | 5887 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5888 v61 = v2->GetMeditation(); |
0 | 5889 return v60 * v61; |
5890 } | |
5891 if ( a2 != 9 ) | |
5892 { | |
5893 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5894 { | |
5895 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5896 return v70; | |
5897 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5898 { | |
5899 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5900 return v70; | |
5901 v71 = (ITEM_EQUIP_TYPE)0; | |
5902 v9 = &v2->pEquipment; | |
5903 while ( 1 ) | |
5904 { | |
5905 if ( v2->HasItemEquipped(v71) ) | |
5906 { | |
118 | 5907 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5908 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5909 a1 = v12; |
5910 SkillToMastery(v12); | |
5911 v13 = v11 - 5; | |
5912 if ( !v13 ) | |
5913 return a1 & 0x3F; | |
5914 if ( v13 == 2 ) | |
5915 break; | |
5916 } | |
5917 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5918 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5919 if ( (signed int)v71 >= 16 ) | |
5920 return v70; | |
5921 } | |
5922 v14 = a1; | |
5923 v15 = 1; | |
5924 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5925 { | |
5926 v62 = 5; | |
5927 goto LABEL_31; | |
5928 } | |
5929 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5930 { | |
5931 v62 = 3; | |
5932 goto LABEL_31; | |
5933 } | |
5934 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5935 goto LABEL_32; | |
5936 goto LABEL_30; | |
5937 } | |
5938 if ( v2->IsUnarmed() ) | |
5939 { | |
5940 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5941 v14 = v18; | |
5942 if ( !v18 ) | |
5943 return v70; | |
5944 v15 = 0; | |
5945 v19 = SkillToMastery(v18); | |
5946 if ( (signed int)v19 < 3 ) | |
5947 { | |
5948 if ( (signed int)v19 >= 2 ) | |
5949 v15 = 1; | |
5950 LABEL_32: | |
5951 v16 = v14; | |
5952 return v15 * (v16 & 0x3F); | |
5953 } | |
5954 LABEL_30: | |
5955 v62 = 2; | |
5956 LABEL_31: | |
5957 v15 = v62; | |
5958 goto LABEL_32; | |
5959 } | |
5960 v20 = (ITEM_EQUIP_TYPE)0; | |
5961 while ( 1 ) | |
5962 { | |
5963 if ( v2->HasItemEquipped(v20) ) | |
5964 { | |
118 | 5965 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5966 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5967 break; | |
5968 } | |
5969 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5970 if ( (signed int)v20 >= 16 ) | |
5971 return v70; | |
5972 } | |
5973 v71 = (ITEM_EQUIP_TYPE)0; | |
5974 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5975 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5976 v25 = v24; | |
5977 v26 = SkillToMastery(v24); | |
5978 if ( !v23 ) | |
5979 { | |
5980 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5981 { | |
5982 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5983 LOBYTE(v25) = v31; | |
5984 if ( v31 ) | |
5985 { | |
5986 v15 = 0; | |
5987 v32 = SkillToMastery(v31); | |
5988 if ( (signed int)v32 < 3 ) | |
5989 { | |
5990 if ( (signed int)v32 >= 2 ) | |
5991 v15 = 1; | |
5992 } | |
5993 else | |
5994 { | |
5995 v15 = 2; | |
5996 } | |
5997 v16 = v25; | |
5998 return v15 * (v16 & 0x3F); | |
5999 } | |
6000 } | |
6001 goto LABEL_55; | |
6002 } | |
6003 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6004 { | |
6005 v29 = SkillToMastery(v25); | |
6006 v28 = __OFSUB__(v29, 4); | |
6007 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6008 } | |
6009 else | |
6010 { | |
6011 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6012 goto LABEL_55; | |
6013 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6014 { | |
6015 if ( v23 == PLAYER_SKILL_MACE ) | |
6016 { | |
6017 v28 = __OFSUB__(v26, 2); | |
118 | 6018 v27 = v26 - 2 < 0; |
0 | 6019 goto LABEL_53; |
6020 } | |
6021 LABEL_55: | |
6022 v30 = v71 * (v25 & 0x3F); | |
6023 return (int)((char *)v69 + v30); | |
6024 } | |
6025 v28 = __OFSUB__(v26, 3); | |
118 | 6026 v27 = v26 - 3 < 0; |
0 | 6027 } |
6028 LABEL_53: | |
6029 if ( !(v27 ^ v28) ) | |
6030 v71 = (ITEM_EQUIP_TYPE)1; | |
6031 goto LABEL_55; | |
6032 } | |
6033 if ( v2->IsUnarmed() == 1 ) | |
6034 { | |
6035 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6036 v34 = v33; | |
6037 if ( !v33 ) | |
6038 return v70; | |
6039 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6040 v5 = 2; | |
6041 v30 = v5 * (v34 & 0x3F); | |
6042 return (int)((char *)v69 + v30); | |
6043 } | |
6044 v35 = (ITEM_EQUIP_TYPE)0; | |
6045 v68 = 0; | |
6046 while ( 1 ) | |
6047 { | |
6048 if ( v2->HasItemEquipped(v35) ) | |
6049 { | |
118 | 6050 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6051 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6052 break; | |
6053 } | |
6054 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6055 if ( (signed int)v35 >= 16 ) | |
6056 return v70; | |
6057 } | |
6058 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6059 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6060 a1a = v39; | |
6061 SkillToMastery(v39); | |
6062 v71 = (ITEM_EQUIP_TYPE)0; | |
6063 if ( v38 ) | |
6064 { | |
6065 if ( (signed int)v38 > 0 ) | |
6066 { | |
6067 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6068 { | |
6069 v71 = (ITEM_EQUIP_TYPE)1; | |
6070 } | |
6071 else | |
6072 { | |
6073 if ( v38 == 7 ) | |
6074 { | |
6075 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6076 { | |
6077 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6078 { | |
6079 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6080 return v5 * (a1a & 0x3F); | |
6081 v63 = 2; | |
6082 } | |
6083 else | |
6084 { | |
6085 v63 = 3; | |
6086 } | |
6087 } | |
6088 else | |
6089 { | |
6090 v63 = 5; | |
6091 } | |
6092 v5 = v63; | |
6093 return v5 * (a1a & 0x3F); | |
6094 } | |
6095 } | |
6096 } | |
6097 } | |
6098 else | |
6099 { | |
6100 v71 = (ITEM_EQUIP_TYPE)1; | |
6101 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6102 { | |
6103 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6104 v41 = v40; | |
6105 if ( v40 ) | |
6106 { | |
6107 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6108 v5 = 2; | |
6109 v68 = v5 * (v41 & 0x3F); | |
6110 } | |
6111 } | |
6112 } | |
6113 v30 = v68 + v71 * (a1a & 0x3F); | |
6114 return (int)((char *)v69 + v30); | |
6115 } | |
6116 a1b = 0; | |
6117 v71 = (ITEM_EQUIP_TYPE)0; | |
6118 v68 = 16; | |
6119 v69 = &v2->pEquipment; | |
6120 do | |
6121 { | |
898 | 6122 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6123 goto LABEL_117; |
6124 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6125 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6126 if ( !v44 ) | |
6127 { | |
6128 v64 = 0; | |
6129 v65 = 1; | |
6130 LABEL_111: | |
6131 v66 = 0; | |
6132 goto LABEL_112; | |
6133 } | |
6134 v45 = v44 - 1; | |
6135 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6136 { | |
6137 v64 = 0; | |
6138 v65 = 0; | |
6139 v66 = 0; | |
6140 v67 = 1; | |
6141 goto LABEL_113; | |
6142 } | |
6143 v47 = v46 - 4; | |
6144 if ( v47 ) | |
6145 { | |
6146 v48 = v47 - 1; | |
6147 if ( v48 ) | |
6148 { | |
6149 v49 = v48 - 1; | |
6150 if ( v49 ) | |
6151 { | |
6152 if ( v49 != 1 ) | |
6153 goto LABEL_117; | |
6154 a1b = 1; | |
6155 v64 = 1; | |
6156 v65 = 0; | |
6157 v66 = 0; | |
6158 v67 = 0; | |
6159 goto LABEL_113; | |
6160 } | |
6161 a1b = 1; | |
6162 v64 = 1; | |
6163 v65 = 0; | |
6164 goto LABEL_111; | |
6165 } | |
6166 v71 = (ITEM_EQUIP_TYPE)1; | |
6167 } | |
6168 else | |
6169 { | |
6170 a1b = 1; | |
6171 } | |
6172 v64 = 1; | |
6173 v65 = 0; | |
6174 v66 = 1; | |
6175 LABEL_112: | |
6176 v67 = 0; | |
6177 LABEL_113: | |
6178 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6179 v51 = v50; | |
6180 v52 = SkillToMastery(v50); | |
6181 v53 = v51 & 0x3F; | |
6182 for ( i = 0; i < (signed int)v52; ++i ) | |
6183 { | |
6184 if ( *(&v64 + i) ) | |
6185 v70 += v53; | |
6186 } | |
6187 LABEL_117: | |
6188 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6189 --v68; | |
6190 } | |
6191 while ( v68 ); | |
6192 v64 = 1; | |
6193 v65 = 1; | |
6194 v66 = 1; | |
6195 v67 = 0; | |
6196 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6197 v56 = v55; | |
6198 v57 = SkillToMastery(v55); | |
6199 if ( !a1b && (!v71 || v57 == 4) ) | |
6200 { | |
6201 v58 = v56 & 0x3F; | |
6202 for ( j = 0; j < (signed int)v57; ++j ) | |
6203 { | |
6204 if ( *(&v64 + j) ) | |
6205 v70 += v58; | |
6206 } | |
6207 } | |
6208 return v70; | |
6209 } | |
6210 | |
6211 //----- (00490109) -------------------------------------------------------- | |
6212 // faces are: 0 1 2 3 human males | |
6213 // 4 5 6 7 human females | |
6214 // 8 9 elf males | |
6215 // 10 11 elf females | |
6216 // 12 13 dwarf males | |
6217 // 14 15 dwarf females | |
6218 // 16 17 goblin males | |
6219 // 18 19 goblin females | |
6220 // 20 lich male | |
6221 // 21 lich female | |
6222 // 22 underwater suits (unused) | |
6223 // 23 zombie male | |
6224 // 24 zombie female | |
6225 enum CHARACTER_RACE Player::GetRace() | |
6226 { | |
1014 | 6227 if ( uCurrentFace > 15 ) |
6228 { | |
6229 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6230 return CHARACTER_RACE_GOBLIN; |
6231 } | |
6232 else | |
6233 { | |
1014 | 6234 if ( uCurrentFace >= 12 ) |
0 | 6235 { |
6236 return CHARACTER_RACE_DWARF; | |
6237 } | |
6238 else | |
6239 { | |
1014 | 6240 |
6241 if ( uCurrentFace <= 7 ) | |
0 | 6242 { |
6243 return CHARACTER_RACE_HUMAN; | |
6244 } | |
6245 else | |
6246 { | |
1014 | 6247 if ( uCurrentFace <= 11 ) |
0 | 6248 return CHARACTER_RACE_ELF; |
6249 } | |
6250 } | |
6251 } | |
6252 return CHARACTER_RACE_HUMAN; | |
6253 } | |
6254 | |
6255 //----- (00490141) -------------------------------------------------------- | |
187 | 6256 PLAYER_SEX Player::GetSexByVoice() |
0 | 6257 { |
6258 signed int result; // eax@1 | |
6259 | |
6260 result = 0; | |
6261 switch ( this->uVoiceID ) | |
6262 { | |
6263 case 0u: | |
6264 case 1u: | |
6265 case 2u: | |
6266 case 3u: | |
6267 case 8u: | |
6268 case 9u: | |
6269 case 0xCu: | |
6270 case 0xDu: | |
6271 case 0x10u: | |
6272 case 0x11u: | |
6273 case 0x14u: | |
6274 case 0x17u: | |
187 | 6275 return SEX_MALE; |
6276 | |
0 | 6277 case 4u: |
6278 case 5u: | |
6279 case 6u: | |
6280 case 7u: | |
6281 case 0xAu: | |
6282 case 0xBu: | |
6283 case 0xEu: | |
6284 case 0xFu: | |
6285 case 0x12u: | |
6286 case 0x13u: | |
6287 case 0x15u: | |
6288 case 0x18u: | |
187 | 6289 return SEX_FEMALE; |
6290 | |
0 | 6291 default: |
187 | 6292 assert(false); |
6293 } | |
0 | 6294 } |
6295 | |
6296 //----- (00490188) -------------------------------------------------------- | |
6297 void Player::SetInitialStats() | |
6298 { | |
6299 auto v1 = GetRace(); | |
290 | 6300 uMight = StatTable[v1][0].uBaseValue; |
6301 uIntelligence = StatTable[v1][1].uBaseValue; | |
6302 uWillpower = StatTable[v1][2].uBaseValue; | |
6303 uEndurance = StatTable[v1][3].uBaseValue; | |
6304 uAccuracy = StatTable[v1][4].uBaseValue; | |
6305 uSpeed = StatTable[v1][5].uBaseValue; | |
6306 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6307 } |
6308 | |
6309 //----- (004901FC) -------------------------------------------------------- | |
6310 int Player::SetSexByVoice() | |
6311 { | |
6312 __int64 v1; // qax@1 | |
6313 | |
6314 v1 = this->uVoiceID; | |
6315 switch ( (int)v1 ) | |
6316 { | |
6317 case 0: | |
6318 case 1: | |
6319 case 2: | |
6320 case 3: | |
6321 case 8: | |
6322 case 9: | |
6323 case 0xC: | |
6324 case 0xD: | |
6325 case 0x10: | |
6326 case 0x11: | |
6327 case 0x14: | |
6328 case 0x17: | |
6329 BYTE4(v1) = 0; | |
6330 break; | |
6331 case 4: | |
6332 case 5: | |
6333 case 6: | |
6334 case 7: | |
6335 case 0xA: | |
6336 case 0xB: | |
6337 case 0xE: | |
6338 case 0xF: | |
6339 case 0x12: | |
6340 case 0x13: | |
6341 case 0x15: | |
6342 case 0x18: | |
6343 BYTE4(v1) = 1; | |
6344 break; | |
6345 default: | |
6346 break; | |
6347 } | |
6348 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6349 return v1; | |
6350 } | |
6351 | |
6352 //----- (0049024A) -------------------------------------------------------- | |
135 | 6353 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6354 { |
6355 sLevelModifier = 0; | |
6356 sAgeModifier = 0; | |
6357 | |
135 | 6358 classType = cls; |
0 | 6359 uLuckBonus = 0; |
6360 uSpeedBonus = 0; | |
6361 uAccuracyBonus = 0; | |
6362 uEnduranceBonus = 0; | |
6363 uWillpowerBonus = 0; | |
6364 uIntelligenceBonus = 0; | |
6365 uMightBonus = 0; | |
6366 uLevel = 1; | |
6367 uExperience = 251 + rand() % 100; | |
6368 uBirthYear = 1147 - rand() % 6; | |
6369 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6370 memset(_guilds_member_bits, 0, 64); |
0 | 6371 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6372 | |
6373 for (uint i = 0; i < 37; ++i) | |
6374 { | |
135 | 6375 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6376 continue; |
6377 | |
6378 pActiveSkills[i] = 1; | |
6379 | |
6380 switch (i) | |
6381 { | |
886 | 6382 case PLAYER_SKILL_FIRE: |
6383 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6384 |
6385 extern bool all_magic; | |
6386 if ( all_magic == true ) | |
6387 { | |
6388 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6389 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6390 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6391 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6392 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6393 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6394 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6395 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6396 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6397 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6398 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6399 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6400 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6401 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6402 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6403 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6404 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6405 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6406 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6407 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6408 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6409 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6410 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6411 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6412 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6413 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6414 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6415 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6416 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6417 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6418 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6419 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6420 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6421 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6422 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6423 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6424 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6425 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6426 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6427 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6428 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6429 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6430 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6431 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6432 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6433 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6434 } | |
486 | 6435 break; |
886 | 6436 case PLAYER_SKILL_AIR: |
6437 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6438 break; | |
6439 case PLAYER_SKILL_WATER: | |
6440 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6441 break; | |
6442 case PLAYER_SKILL_EARTH: | |
6443 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6444 break; | |
6445 case PLAYER_SKILL_SPIRIT: | |
6446 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6447 break; | |
6448 case PLAYER_SKILL_MIND: | |
6449 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6450 break; | |
6451 case PLAYER_SKILL_BODY: | |
6452 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6453 |
6454 if ( all_magic == true ) | |
6455 { | |
6456 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6457 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6458 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6459 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6460 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6461 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6462 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6463 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6464 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6465 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6466 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6467 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6468 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6469 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6470 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6471 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6472 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6473 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6474 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6475 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6476 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6477 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6478 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6479 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6480 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6481 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6482 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6483 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6484 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6485 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6486 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6487 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6488 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6489 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6490 } | |
569 | 6491 break; |
886 | 6492 case PLAYER_SKILL_LIGHT: |
6493 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6494 break; | |
6495 case PLAYER_SKILL_DARK: | |
6496 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6497 break; | |
0 | 6498 } |
6499 } | |
6500 | |
6501 sHealth = GetMaxHealth(); | |
6502 sMana = GetMaxMana(); | |
6503 } | |
6504 | |
6505 //----- (004903C9) -------------------------------------------------------- | |
821 | 6506 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6507 { | |
6508 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6509 int v3; // edx@5 |
6510 char *v4; // ecx@5 | |
6511 int v5; // esi@11 | |
6512 unsigned __int16 *v6; // edx@11 | |
6513 int v7; // esi@18 | |
6514 unsigned __int16 *pActiveSkill; // edx@18 | |
6515 | |
6516 if ( order >= 0 ) | |
6517 { | |
6518 if ( order <= 1 ) | |
6519 { | |
6520 result = (PLAYER_SKILL_TYPE)0; | |
6521 v7 = 0; | |
6522 pActiveSkill = this->pActiveSkills; | |
6523 do | |
6524 { | |
135 | 6525 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6526 { |
6527 if ( v7 == order ) | |
6528 return result; | |
6529 ++v7; | |
6530 } | |
6531 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6532 ++pActiveSkill; | |
6533 } | |
6534 while ( (signed int)result < 37 ); | |
6535 } | |
6536 else | |
6537 { | |
6538 if ( order <= 3 ) | |
6539 { | |
6540 result = (PLAYER_SKILL_TYPE)0; | |
6541 v5 = 0; | |
6542 pActiveSkill = this->pActiveSkills; | |
6543 do | |
6544 { | |
135 | 6545 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6546 { |
6547 if ( v5 == order - 2 ) | |
6548 return result; | |
6549 ++v5; | |
6550 } | |
6551 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6552 ++pActiveSkill; | |
6553 } | |
6554 while ( (signed int)result < 37 ); | |
6555 } | |
6556 else | |
6557 { | |
6558 if ( order <= 12 ) | |
6559 { | |
6560 result = (PLAYER_SKILL_TYPE)0; | |
6561 v3 = 0; | |
135 | 6562 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6563 do |
6564 { | |
6565 if ( *v4 == 1 ) | |
6566 { | |
6567 if ( v3 == order - 4 ) | |
6568 return result; | |
6569 ++v3; | |
6570 } | |
6571 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6572 ++v4; | |
6573 } | |
6574 while ( (signed int)result < 37 ); | |
6575 } | |
6576 } | |
6577 } | |
6578 } | |
6579 return (PLAYER_SKILL_TYPE)37; | |
6580 } | |
6581 | |
6582 | |
6583 | |
6584 //----- (0049048D) -------------------------------------------------------- | |
6585 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6586 void Player::DecreaseAttribute(int eAttribute) | |
6587 { | |
6588 int v2; // eax@1 | |
6589 int pBaseValue; // ecx@1 | |
6590 int pDroppedStep; // ebx@1 | |
6591 int pStep; // esi@1 | |
6592 unsigned __int16 result; // ax@7 | |
6593 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6594 | |
6595 v2 = eAttribute + 7 * GetRace(); | |
290 | 6596 pBaseValue = StatTable[0][v2].uBaseValue; |
6597 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6598 uMinValue = pBaseValue - 2; |
290 | 6599 pStep = StatTable[0][v2].uBaseStep; |
0 | 6600 switch ( eAttribute ) |
6601 { | |
6602 case CHARACTER_MIGHT: | |
6603 if ( this->uMight <= pBaseValue ) | |
6604 pStep = pDroppedStep; | |
6605 if ( this->uMight - pStep >= uMinValue ) | |
6606 this->uMight -= pStep; | |
6607 break; | |
6608 case CHARACTER_INTELLIGANCE: | |
6609 if ( this->uIntelligence <= pBaseValue ) | |
6610 pStep = pDroppedStep; | |
6611 if ( this->uIntelligence - pStep >= uMinValue ) | |
6612 this->uIntelligence -= pStep; | |
6613 break; | |
6614 case CHARACTER_WILLPOWER: | |
6615 if ( this->uWillpower <= pBaseValue ) | |
6616 pStep = pDroppedStep; | |
6617 if ( this->uWillpower - pStep >= uMinValue ) | |
6618 this->uWillpower -= pStep; | |
6619 break; | |
6620 case CHARACTER_ENDURANCE: | |
6621 if ( this->uEndurance <= pBaseValue ) | |
6622 pStep = pDroppedStep; | |
6623 if ( this->uEndurance - pStep >= uMinValue ) | |
6624 this->uEndurance -= pStep; | |
6625 break; | |
6626 case CHARACTER_ACCURACY: | |
6627 if ( this->uAccuracy <= pBaseValue ) | |
6628 pStep = pDroppedStep; | |
6629 if ( this->uAccuracy - pStep >= uMinValue ) | |
6630 this->uAccuracy -= pStep; | |
6631 break; | |
6632 case CHARACTER_SPEED: | |
6633 if ( this->uSpeed <= pBaseValue ) | |
6634 pStep = pDroppedStep; | |
6635 if ( this->uSpeed - pStep >= uMinValue ) | |
6636 this->uSpeed -= pStep; | |
6637 break; | |
6638 case CHARACTER_LUCK: | |
6639 if ( this->uLuck <= pBaseValue ) | |
6640 pStep = pDroppedStep; | |
6641 if ( this->uLuck - pStep >= uMinValue ) | |
6642 this->uLuck -= pStep; | |
6643 break; | |
6644 } | |
6645 } | |
6646 | |
6647 //----- (004905F5) -------------------------------------------------------- | |
6648 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6649 int Player::IncreaseAttribute(int eAttribute) | |
6650 { | |
6651 Player *v2; // esi@1 | |
6652 int v3; // eax@1 | |
6653 int v4; // ebx@1 | |
6654 signed int v5; // edi@1 | |
6655 int v6; // eax@8 | |
6656 signed int v7; // eax@17 | |
6657 signed int result; // eax@18 | |
6658 int v9; // [sp+Ch] [bp-8h]@1 | |
6659 signed int v10; // [sp+10h] [bp-4h]@1 | |
6660 | |
6661 v2 = this; | |
6662 v3 = eAttribute + 7 * GetRace(); | |
290 | 6663 v4 = StatTable[0][v3].uMaxValue; |
6664 v5 = StatTable[0][v3].uBaseStep; | |
6665 v9 = StatTable[0][v3].uBaseValue; | |
6666 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6667 PlayerCreation_ComputeAttributeBonus(); |
6668 if ( eAttribute ) | |
6669 { | |
6670 switch ( eAttribute ) | |
6671 { | |
6672 case 1: | |
6673 v6 = v2->uIntelligence; | |
6674 break; | |
6675 case 2: | |
6676 v6 = v2->uWillpower; | |
6677 break; | |
6678 case 3: | |
6679 v6 = v2->uEndurance; | |
6680 break; | |
6681 case 4: | |
6682 v6 = v2->uAccuracy; | |
6683 break; | |
6684 case 5: | |
6685 v6 = v2->uSpeed; | |
6686 break; | |
6687 case 6: | |
6688 v6 = v2->uLuck; | |
6689 break; | |
6690 default: | |
6691 v6 = eAttribute; | |
6692 break; | |
6693 } | |
6694 } | |
6695 else | |
6696 { | |
6697 v6 = v2->uMight; | |
6698 } | |
6699 if ( v6 < v9 ) | |
6700 { | |
6701 v7 = v5; | |
6702 v5 = v10; | |
6703 v10 = v7; | |
6704 } | |
6705 result = PlayerCreation_ComputeAttributeBonus(); | |
6706 if ( result >= v10 ) | |
6707 { | |
6708 if ( eAttribute ) | |
6709 { | |
6710 switch ( eAttribute ) | |
6711 { | |
6712 case 1: | |
6713 result = (signed int)&v2->uIntelligence; | |
6714 break; | |
6715 case 2: | |
6716 result = (signed int)&v2->uWillpower; | |
6717 break; | |
6718 case 3: | |
6719 result = (signed int)&v2->uEndurance; | |
6720 break; | |
6721 case 4: | |
6722 result = (signed int)&v2->uAccuracy; | |
6723 break; | |
6724 case 5: | |
6725 result = (signed int)&v2->uSpeed; | |
6726 break; | |
6727 default: | |
6728 result = eAttribute - 6; | |
6729 if ( eAttribute != 6 ) | |
6730 return result; | |
6731 result = (signed int)&v2->uLuck; | |
6732 break; | |
6733 } | |
6734 } | |
6735 else | |
6736 { | |
6737 result = (signed int)&v2->uMight; | |
6738 } | |
6739 if ( v5 + *(short *)result <= v4 ) | |
6740 *(short *)result += v5; | |
6741 } | |
6742 return result; | |
6743 } | |
6744 | |
6745 //----- (0049070F) -------------------------------------------------------- | |
6746 void Player::Zero() | |
6747 { | |
6748 Player *v1; // esi@1 | |
6749 | |
6750 v1 = this; | |
6751 this->sLevelModifier = 0; | |
6752 this->sACModifier = 0; | |
6753 this->uLuckBonus = 0; | |
6754 this->uAccuracyBonus = 0; | |
6755 this->uSpeedBonus = 0; | |
6756 this->uEnduranceBonus = 0; | |
6757 this->uWillpowerBonus = 0; | |
6758 this->uIntelligenceBonus = 0; | |
6759 this->uMightBonus = 0; | |
6760 this->field_100 = 0; | |
6761 this->field_FC = 0; | |
6762 this->field_F8 = 0; | |
6763 this->field_F4 = 0; | |
6764 this->field_F0 = 0; | |
6765 this->field_EC = 0; | |
6766 this->field_E8 = 0; | |
6767 this->field_E4 = 0; | |
6768 this->field_E0 = 0; | |
766 | 6769 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6770 v1->field_1A97 = 0; |
6771 v1->_ranged_dmg_bonus = 0; | |
6772 v1->field_1A95 = 0; | |
6773 v1->_ranged_atk_bonus = 0; | |
6774 v1->field_1A93 = 0; | |
6775 v1->_melee_dmg_bonus = 0; | |
6776 v1->field_1A91 = 0; | |
6777 v1->_some_attack_bonus = 0; | |
6778 v1->_mana_related = 0; | |
6779 v1->uFullManaBonus = 0; | |
6780 v1->_health_related = 0; | |
6781 v1->uFullHealthBonus = 0; | |
6782 } | |
6783 | |
6784 //----- (004907E7) -------------------------------------------------------- | |
299 | 6785 unsigned int Player::GetStatColor(int uStat) |
0 | 6786 { |
6787 __int16 uWhite; // si@1 | |
290 | 6788 int attribute_value; // edx@1 |
299 | 6789 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6790 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6791 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6792 | |
1014 | 6793 uRed = TargetColor(255, 35, 0); |
6794 uGreen = TargetColor(0, 255, 0); | |
6795 uWhite = TargetColor(255, 255, 255); | |
299 | 6796 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6797 |
0 | 6798 switch (uStat) |
6799 { | |
6800 case 0: attribute_value = uMight; break; | |
6801 case 1: attribute_value = uIntelligence; break; | |
6802 case 2: attribute_value = uWillpower; break; | |
6803 case 3: attribute_value = uEndurance; break; | |
290 | 6804 case 4: attribute_value = uAccuracy; break; |
6805 case 5: attribute_value = uSpeed; break; | |
0 | 6806 case 6: attribute_value = uLuck; break; |
6807 }; | |
6808 | |
299 | 6809 if ( attribute_value == pBaseAttrValue ) |
290 | 6810 return uWhite; |
299 | 6811 else if ( attribute_value > pBaseAttrValue ) |
290 | 6812 return uGreen; |
0 | 6813 else |
290 | 6814 return uRed; |
0 | 6815 } |
6816 | |
6817 //----- (004908A8) -------------------------------------------------------- | |
6818 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6819 { | |
1014 | 6820 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6821 { | |
6822 pConditions[uCondition]=0i64; | |
6823 return true; | |
0 | 6824 } |
6825 else | |
1014 | 6826 return false; |
0 | 6827 } |
6828 | |
6829 //----- (004680ED) -------------------------------------------------------- | |
6830 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6831 { | |
6832 Player *v3; // esi@1 | |
6833 unsigned int v4; // ebx@4 | |
6834 signed int v5; // eax@17 | |
6835 unsigned int v6; // eax@26 | |
6836 unsigned __int8 v7; // cf@37 | |
6837 int v8; // edx@39 | |
6838 int v9; // edx@40 | |
6839 int v10; // edx@41 | |
6840 int v11; // edx@42 | |
6841 int v12; // edx@43 | |
6842 char *v13; // eax@45 | |
6843 AudioPlayer *v14; // ecx@62 | |
6844 signed int v15; // edi@68 | |
6845 int v16; // edx@73 | |
6846 unsigned __int16 *v17; // edi@73 | |
6847 unsigned int v18; // eax@73 | |
6848 int v19; // eax@74 | |
6849 int v20; // eax@75 | |
6850 signed int v21; // eax@81 | |
6851 const char *v22; // eax@84 | |
6852 char *v23; // ecx@90 | |
6853 int v24; // esi@96 | |
6854 int v25; // eax@109 | |
6855 int v26; // eax@113 | |
6856 char *v27; // edi@114 | |
6857 signed __int64 v28; // qax@120 | |
6858 char *v29; // ecx@120 | |
6859 int v30; // edi@137 | |
6860 int v31; // ST30_4@137 | |
6861 int v32; // ST3C_4@137 | |
6862 int v33; // ST40_4@137 | |
6863 int v34; // ST34_4@137 | |
6864 int v35; // ST38_4@137 | |
6865 unsigned __int8 v36; // al@173 | |
6866 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6867 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6868 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6869 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6870 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6871 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6872 signed int v43; // [sp-14h] [bp-40h]@18 | |
6873 signed int v44; // [sp-14h] [bp-40h]@174 | |
6874 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6875 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6876 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6877 int v48; // [sp-Ch] [bp-38h]@18 | |
6878 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6879 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6880 int v51; // [sp-Ch] [bp-38h]@174 | |
6881 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6882 char *v53; // [sp-8h] [bp-34h]@33 | |
6883 int v54; // [sp-8h] [bp-34h]@34 | |
6884 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6885 int v56; // [sp-8h] [bp-34h]@66 | |
6886 const char *v57; // [sp-8h] [bp-34h]@69 | |
6887 const char *v58; // [sp-8h] [bp-34h]@89 | |
6888 int v59; // [sp-8h] [bp-34h]@120 | |
6889 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6890 int v61; // [sp-4h] [bp-30h]@18 | |
6891 char *v62; // [sp-4h] [bp-30h]@33 | |
6892 char *v63; // [sp-4h] [bp-30h]@34 | |
6893 int v64; // [sp-4h] [bp-30h]@60 | |
6894 int v65; // [sp-4h] [bp-30h]@66 | |
6895 const char *v66; // [sp-4h] [bp-30h]@69 | |
6896 signed int v67; // [sp-4h] [bp-30h]@77 | |
6897 const char *v68; // [sp-4h] [bp-30h]@89 | |
6898 int v69; // [sp-4h] [bp-30h]@110 | |
6899 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6900 int v71; // [sp-4h] [bp-30h]@174 | |
6901 char *v72; // [sp+20h] [bp-Ch]@68 | |
6902 signed int v73; // [sp+24h] [bp-8h]@1 | |
6903 char *v74; // [sp+24h] [bp-8h]@23 | |
6904 int v75; // [sp+24h] [bp-8h]@73 | |
6905 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6906 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6907 | |
6908 thisb = this; | |
243 | 6909 v3 = &pParty->pPlayers[a2-1]; |
0 | 6910 v73 = 1; |
6911 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6912 return; | |
6913 v4 = 0; | |
6914 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6915 { | |
6916 if ( pParty->pPickedItem.uItemID != 160 ) | |
6917 { | |
6918 if ( pParty->pPickedItem.uItemID == 161 ) | |
6919 { | |
6920 v27 = (char *)&v3->sMana; | |
6921 *(int *)v27 += 2; | |
6922 LABEL_170: | |
6923 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6924 *(int *)v27 = v3->GetMaxMana(); | |
6925 } | |
6926 else | |
6927 { | |
6928 if ( pParty->pPickedItem.uItemID != 162 ) | |
6929 { | |
6930 LABEL_167: | |
6931 v68 = pParty->pPickedItem.GetDisplayName(); | |
6932 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6933 goto LABEL_90; | |
6934 } | |
6935 v69 = 2; | |
6936 LABEL_111: | |
243 | 6937 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6938 } |
6939 LABEL_112: | |
187 | 6940 v3->PlaySound(SPEECH_36, 0); |
0 | 6941 goto LABEL_173; |
6942 } | |
6943 LABEL_172: | |
100 | 6944 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6945 goto LABEL_173; |
6946 } | |
6947 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6948 { | |
6949 switch ( pParty->pPickedItem.uItemID ) | |
6950 { | |
6951 case 0xDEu: | |
570 | 6952 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6953 goto LABEL_110; |
6954 case 0xDFu: | |
570 | 6955 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6956 goto LABEL_114; |
6957 case 0xE0u: | |
6958 LODWORD(v3->pConditions[1]) = 0; | |
6959 HIDWORD(v3->pConditions[1]) = 0; | |
6960 goto LABEL_112; | |
6961 case 0xE1u: | |
6962 LODWORD(v3->pConditions[11]) = 0; | |
6963 HIDWORD(v3->pConditions[11]) = 0; | |
6964 LODWORD(v3->pConditions[9]) = 0; | |
6965 HIDWORD(v3->pConditions[9]) = 0; | |
6966 LODWORD(v3->pConditions[7]) = 0; | |
6967 HIDWORD(v3->pConditions[7]) = 0; | |
6968 goto LABEL_112; | |
6969 case 0xE2u: | |
6970 LODWORD(v3->pConditions[10]) = 0; | |
6971 HIDWORD(v3->pConditions[10]) = 0; | |
6972 LODWORD(v3->pConditions[8]) = 0; | |
6973 HIDWORD(v3->pConditions[8]) = 0; | |
6974 LODWORD(v3->pConditions[6]) = 0; | |
6975 HIDWORD(v3->pConditions[6]) = 0; | |
6976 goto LABEL_112; | |
6977 case 0xE3u: | |
6978 LODWORD(v3->pConditions[2]) = 0; | |
6979 HIDWORD(v3->pConditions[2]) = 0; | |
6980 goto LABEL_112; | |
6981 case 0xE4u: | |
6982 if ( v3->pConditions[1] ) | |
6983 goto LABEL_173; | |
6984 v70 = 0; | |
6985 v59 = 0; | |
6986 v50 = 5; | |
6987 v46 = 3; | |
570 | 6988 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 6989 v29 = (char *)&v3->pPlayerBuffs[7]; |
6990 goto LABEL_147; | |
6991 case 0xE5u: | |
6992 v70 = 0; | |
6993 v59 = 0; | |
6994 v50 = 5; | |
6995 v46 = 3; | |
570 | 6996 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 6997 v29 = (char *)&v3->pPlayerBuffs[8]; |
6998 goto LABEL_147; | |
6999 case 0xE6u: | |
7000 v70 = 0; | |
7001 v59 = 0; | |
7002 v50 = 5; | |
7003 v46 = 3; | |
570 | 7004 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7005 v29 = (char *)&v3->pPlayerBuffs[1]; |
7006 goto LABEL_147; | |
7007 case 0xE7u: | |
7008 v70 = 0; | |
7009 v59 = 0; | |
570 | 7010 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7011 v46 = 0; |
570 | 7012 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7013 v29 = (char *)&v3->pPlayerBuffs[11]; |
7014 goto LABEL_147; | |
7015 case 0xE8u: | |
7016 v70 = 0; | |
7017 v59 = 0; | |
570 | 7018 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7019 v46 = 0; |
570 | 7020 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7021 v29 = (char *)&v3->pPlayerBuffs[13]; |
7022 goto LABEL_147; | |
7023 case 0xEAu: | |
7024 v70 = 0; | |
7025 v59 = 0; | |
7026 v50 = 5; | |
7027 v46 = 3; | |
570 | 7028 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7029 v29 = (char *)&v3->pPlayerBuffs[14]; |
7030 goto LABEL_147; | |
7031 case 0xEBu: | |
7032 v3->pPlayerBuffs[23].Apply( | |
570 | 7033 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7034 3u, |
7035 5u, | |
7036 0, | |
7037 0); | |
7038 goto LABEL_173; | |
7039 case 0xEDu: | |
7040 LODWORD(v3->pConditions[3]) = 0; | |
7041 HIDWORD(v3->pConditions[3]) = 0; | |
7042 goto LABEL_112; | |
7043 case 0xEEu: | |
7044 LODWORD(v3->pConditions[0]) = 0; | |
7045 HIDWORD(v3->pConditions[0]) = 0; | |
7046 goto LABEL_112; | |
7047 case 0xEFu: | |
7048 LODWORD(v3->pConditions[5]) = 0; | |
7049 HIDWORD(v3->pConditions[5]) = 0; | |
7050 goto LABEL_112; | |
7051 case 0xF0u: | |
7052 v70 = 0; | |
7053 v59 = 0; | |
570 | 7054 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7055 v46 = 0; |
570 | 7056 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7057 v29 = (char *)&v3->pPlayerBuffs[19]; |
7058 goto LABEL_147; | |
7059 case 0xF1u: | |
7060 v70 = 0; | |
7061 v59 = 0; | |
570 | 7062 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7063 v46 = 0; |
570 | 7064 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7065 v29 = (char *)&v3->pPlayerBuffs[17]; |
7066 goto LABEL_147; | |
7067 case 0xF2u: | |
7068 v70 = 0; | |
7069 v59 = 0; | |
570 | 7070 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7071 v46 = 0; |
570 | 7072 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7073 v29 = (char *)&v3->pPlayerBuffs[20]; |
7074 goto LABEL_147; | |
7075 case 0xF3u: | |
7076 v70 = 0; | |
7077 v59 = 0; | |
570 | 7078 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7079 v46 = 0; |
570 | 7080 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7081 v29 = (char *)&v3->pPlayerBuffs[16]; |
7082 goto LABEL_147; | |
7083 case 0xF4u: | |
7084 v70 = 0; | |
7085 v59 = 0; | |
570 | 7086 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7087 v46 = 0; |
570 | 7088 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7089 v29 = (char *)&v3->pPlayerBuffs[21]; |
7090 goto LABEL_147; | |
7091 case 0xF5u: | |
7092 v70 = 0; | |
7093 v59 = 0; | |
570 | 7094 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7095 v46 = 0; |
570 | 7096 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7097 v29 = (char *)&v3->pPlayerBuffs[15]; |
7098 goto LABEL_147; | |
7099 case 0xFBu: | |
7100 LODWORD(v3->pConditions[12]) = 0; | |
7101 HIDWORD(v3->pConditions[12]) = 0; | |
7102 goto LABEL_112; | |
7103 case 0xFCu: | |
7104 v30 = LODWORD(v3->pConditions[14]); | |
7105 v31 = HIDWORD(v3->pConditions[14]); | |
7106 v32 = LODWORD(v3->pConditions[15]); | |
7107 v33 = HIDWORD(v3->pConditions[15]); | |
7108 v34 = LODWORD(v3->pConditions[16]); | |
7109 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7110 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7111 HIDWORD(v3->pConditions[14]) = v31; |
7112 LODWORD(v3->pConditions[15]) = v32; | |
7113 HIDWORD(v3->pConditions[15]) = v33; | |
7114 LODWORD(v3->pConditions[16]) = v34; | |
7115 LODWORD(v3->pConditions[14]) = v30; | |
7116 HIDWORD(v3->pConditions[16]) = v35; | |
7117 goto LABEL_112; | |
7118 case 0xFDu: | |
570 | 7119 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7120 LABEL_110: |
7121 v69 = v25; | |
7122 goto LABEL_111; | |
7123 case 0xFEu: | |
570 | 7124 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7125 LABEL_114: |
7126 v27 = (char *)&v3->sMana; | |
7127 *(int *)v27 += v26; | |
7128 goto LABEL_170; | |
7129 case 0xFFu: | |
7130 v70 = 0; | |
7131 v59 = 0; | |
570 | 7132 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7133 v46 = 0; |
570 | 7134 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7135 v29 = (char *)&v3->pPlayerBuffs[18]; |
7136 goto LABEL_147; | |
7137 case 0x100u: | |
7138 v70 = 0; | |
7139 v59 = 0; | |
570 | 7140 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7141 v46 = 0; |
570 | 7142 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7143 v29 = (char *)&v3->pPlayerBuffs[5]; |
7144 goto LABEL_147; | |
7145 case 0x101u: | |
7146 v70 = 0; | |
7147 v59 = 0; | |
570 | 7148 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7149 v46 = 0; |
570 | 7150 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7151 v29 = (char *)v3->pPlayerBuffs; |
7152 goto LABEL_147; | |
7153 case 0x102u: | |
7154 v70 = 0; | |
7155 v59 = 0; | |
570 | 7156 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7157 v46 = 0; |
570 | 7158 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7159 v29 = (char *)&v3->pPlayerBuffs[22]; |
7160 goto LABEL_147; | |
7161 case 0x103u: | |
7162 v70 = 0; | |
7163 v59 = 0; | |
570 | 7164 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7165 v46 = 0; |
570 | 7166 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7167 v29 = (char *)&v3->pPlayerBuffs[3]; |
7168 goto LABEL_147; | |
7169 case 0x104u: | |
7170 v70 = 0; | |
7171 v59 = 0; | |
570 | 7172 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7173 v46 = 0; |
570 | 7174 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7175 v29 = (char *)&v3->pPlayerBuffs[9]; |
7176 goto LABEL_147; | |
7177 case 0x105u: | |
7178 v70 = 0; | |
7179 v59 = 0; | |
570 | 7180 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7181 v46 = 0; |
570 | 7182 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7183 v29 = (char *)&v3->pPlayerBuffs[2]; |
7184 LABEL_147: | |
7185 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7186 goto LABEL_112; | |
7187 case 0x106u: | |
7188 LODWORD(v3->pConditions[15]) = 0; | |
7189 HIDWORD(v3->pConditions[15]) = 0; | |
7190 goto LABEL_112; | |
7191 case 0x108u: | |
7192 if ( !*(int *)&v3->field_1F5[3] ) | |
7193 { | |
7194 v3->uLuck += 50; | |
7195 *(int *)&v3->field_1F5[3] = 1; | |
7196 } | |
7197 goto LABEL_112; | |
7198 case 0x109u: | |
7199 if ( !*(int *)&v3->field_1F5[7] ) | |
7200 { | |
7201 v3->uSpeed += 50; | |
7202 *(int *)&v3->field_1F5[7] = 1; | |
7203 } | |
7204 goto LABEL_112; | |
7205 case 0x10Au: | |
7206 if ( !*(int *)&v3->field_1F5[11] ) | |
7207 { | |
7208 v3->uIntelligence += 50; | |
7209 *(int *)&v3->field_1F5[11] = 1; | |
7210 } | |
7211 goto LABEL_112; | |
7212 case 0x10Bu: | |
7213 if ( !*(int *)&v3->field_1F5[15] ) | |
7214 { | |
7215 v3->uEndurance += 50; | |
7216 *(int *)&v3->field_1F5[15] = 1; | |
7217 } | |
7218 goto LABEL_112; | |
7219 case 0x10Cu: | |
7220 if ( !*(int *)&v3->field_1F5[19] ) | |
7221 { | |
7222 v3->uWillpower += 50; | |
7223 *(int *)&v3->field_1F5[19] = 1; | |
7224 } | |
7225 goto LABEL_112; | |
7226 case 0x10Du: | |
7227 if ( !*(int *)&v3->field_1F5[23] ) | |
7228 { | |
7229 v3->uAccuracy += 50; | |
7230 *(int *)&v3->field_1F5[23] = 1; | |
7231 } | |
7232 goto LABEL_112; | |
7233 case 0x10Eu: | |
7234 if ( !*(int *)&v3->field_1F5[27] ) | |
7235 { | |
7236 v3->uMight += 50; | |
7237 *(int *)&v3->field_1F5[27] = 1; | |
7238 } | |
7239 goto LABEL_112; | |
7240 case 0x10Fu: | |
7241 v3->sAgeModifier = 0; | |
7242 goto LABEL_112; | |
809 | 7243 case 0xDDu: |
7244 goto LABEL_172; | |
0 | 7245 default: |
7246 goto LABEL_167; | |
7247 } | |
7248 goto LABEL_172; | |
7249 } | |
7250 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7251 { | |
7252 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7253 { | |
7254 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7255 { | |
7256 if ( pParty->pPickedItem.uItemID == 616 ) | |
7257 { | |
7258 thisa = pParty->uCurrentMonthWeek + 1; | |
7259 if ( pParty->uCurrentMonth >= 7 ) | |
7260 v74 = 0; | |
7261 else | |
7262 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7263 switch ( pParty->uCurrentMonth ) | |
7264 { | |
7265 case 0u: | |
7266 v6 = pParty->uCurrentMonthWeek + 1; | |
7267 v3->uMight += thisa; | |
7268 goto LABEL_33; | |
7269 case 1u: | |
7270 v6 = pParty->uCurrentMonthWeek + 1; | |
7271 v3->uIntelligence += thisa; | |
7272 goto LABEL_33; | |
7273 case 2u: | |
7274 v6 = pParty->uCurrentMonthWeek + 1; | |
7275 v3->uWillpower += thisa; | |
7276 goto LABEL_33; | |
7277 case 3u: | |
7278 v6 = pParty->uCurrentMonthWeek + 1; | |
7279 v3->uEndurance += thisa; | |
7280 goto LABEL_33; | |
7281 case 4u: | |
7282 v6 = pParty->uCurrentMonthWeek + 1; | |
7283 v3->uAccuracy += thisa; | |
7284 goto LABEL_33; | |
7285 case 5u: | |
7286 v6 = pParty->uCurrentMonthWeek + 1; | |
7287 v3->uSpeed += thisa; | |
7288 goto LABEL_33; | |
7289 case 6u: | |
7290 v6 = pParty->uCurrentMonthWeek + 1; | |
7291 v3->uLuck += thisa; | |
7292 LABEL_33: | |
7293 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7294 v53 = v74; | |
7295 v49 = v6; | |
7296 goto LABEL_53; | |
7297 case 7u: | |
7298 party_finds_gold(1000 * thisa, 0); | |
7299 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7300 v54 = 1000 * thisa; | |
7301 goto LABEL_38; | |
7302 case 8u: | |
7303 Party::GiveFood(5 * thisa); | |
7304 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7305 v54 = 5 * thisa; | |
7306 goto LABEL_38; | |
7307 case 9u: | |
7308 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7309 v3->uSkillPoints += 2 * thisa; | |
7310 v54 = 2 * thisa; | |
7311 goto LABEL_38; | |
7312 case 0xAu: | |
7313 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7314 v54 = 2500 * thisa; | |
7315 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7316 LODWORD(v3->uExperience) += 2500 * thisa; | |
7317 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7318 LABEL_38: | |
7319 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7320 goto LABEL_54; | |
7321 case 0xBu: | |
7322 v8 = rand() % 6; | |
7323 if ( v8 ) | |
7324 { | |
7325 v9 = v8 - 1; | |
7326 if ( v9 ) | |
7327 { | |
7328 v10 = v9 - 1; | |
7329 if ( v10 ) | |
7330 { | |
7331 v11 = v10 - 1; | |
7332 if ( v11 ) | |
7333 { | |
7334 v12 = v11 - 1; | |
7335 if ( v12 ) | |
7336 { | |
7337 if ( v12 != 1 ) | |
7338 goto LABEL_52; | |
7339 v3->sResBodyBase += thisa; | |
7340 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7341 } | |
7342 else | |
7343 { | |
7344 v3->sResMindBase += thisa; | |
7345 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7346 } | |
7347 } | |
7348 else | |
7349 { | |
7350 v3->sResEarthBase += thisa; | |
7351 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7352 } | |
7353 } | |
7354 else | |
7355 { | |
7356 v3->sResWaterBase += thisa; | |
7357 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7358 } | |
7359 } | |
7360 else | |
7361 { | |
7362 v3->sResAirBase += thisa; | |
7363 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7364 } | |
7365 } | |
7366 else | |
7367 { | |
7368 v3->sResFireBase += thisa; | |
7369 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7370 } | |
7371 v74 = v13; | |
7372 LABEL_52: | |
7373 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7374 v53 = v74; | |
7375 v49 = thisa; | |
7376 LABEL_53: | |
7377 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7378 LABEL_54: | |
7379 ShowStatusBarString(pTmpBuf, 2u); | |
7380 pMouse->RemoveHoldingItem(); | |
7381 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7382 v3->PlaySound(SPEECH_93, 0); |
0 | 7383 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7384 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7385 { | |
7386 v64 = 0; | |
7387 v55 = 16; | |
7388 } | |
7389 else | |
7390 { | |
7391 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7392 { | |
7393 v64 = 0; | |
7394 v55 = 14; | |
7395 } | |
7396 else | |
7397 { | |
7398 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7399 return; | |
7400 v64 = 0; | |
7401 v55 = 15; | |
7402 } | |
7403 } | |
7404 v3->SetCondition(v55, v64); | |
7405 v61 = 0; | |
7406 v52 = 0; | |
7407 v48 = 0; | |
7408 v45 = 0; | |
7409 v43 = -1; | |
7410 v41 = 0; | |
7411 v39 = 0; | |
7412 v37 = (SoundID)215; | |
7413 v14 = pAudioPlayer; | |
7414 goto LABEL_63; | |
7415 default: | |
7416 goto LABEL_54; | |
7417 } | |
7418 } | |
7419 if ( pParty->pPickedItem.uItemID == 630 ) | |
7420 { | |
7421 Party::GiveFood(1u); | |
7422 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7423 } | |
7424 else | |
7425 { | |
7426 if ( pParty->pPickedItem.uItemID == 632 ) | |
7427 { | |
7428 v61 = 0; | |
7429 v52 = 0; | |
7430 v48 = 0; | |
7431 v45 = 0; | |
7432 v43 = -1; | |
7433 v41 = 0; | |
7434 v39 = 0; | |
7435 v37 = (SoundID)133; | |
7436 goto LABEL_93; | |
7437 } | |
7438 if ( pParty->pPickedItem.uItemID == 633 ) | |
7439 { | |
7440 v61 = 0; | |
7441 v52 = 0; | |
7442 v48 = 0; | |
7443 v45 = 0; | |
7444 v43 = -1; | |
7445 v41 = 0; | |
7446 v39 = 0; | |
7447 v37 = (SoundID)134; | |
7448 goto LABEL_93; | |
7449 } | |
7450 if ( pParty->pPickedItem.uItemID == 634 ) | |
7451 { | |
7452 v61 = 0; | |
7453 v52 = 0; | |
7454 v48 = 0; | |
7455 v45 = 0; | |
7456 v43 = -1; | |
7457 v41 = 0; | |
7458 v39 = 0; | |
7459 v37 = (SoundID)135; | |
7460 goto LABEL_93; | |
7461 } | |
7462 if ( pParty->pPickedItem.uItemID != 646 ) | |
7463 { | |
7464 if ( pParty->pPickedItem.uItemID == 650 ) | |
7465 { | |
7466 sub_44C28F_open_nwc_dungeon(); | |
7467 return; | |
7468 } | |
7469 goto LABEL_167; | |
7470 } | |
7471 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7472 v5 = 8 * a2 + 392; | |
862 | 7473 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7474 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7475 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7476 } | |
7477 LABEL_187: | |
7478 pMouse->RemoveHoldingItem(); | |
7479 return; | |
7480 } | |
243 | 7481 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7482 { |
7483 sub_467F48(pParty->pPickedItem.uItemID); | |
7484 v65 = 0; | |
187 | 7485 v56 = SPEECH_37; |
0 | 7486 LABEL_67: |
187 | 7487 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7488 return; |
7489 } | |
7490 LABEL_89: | |
7491 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7492 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7493 LABEL_90: | |
809 | 7494 sprintfex(pTmpBuf, v58, v68); |
0 | 7495 v23 = pTmpBuf; |
7496 LABEL_91: | |
7497 ShowStatusBarString(v23, 2u); | |
7498 v4 = 0; | |
7499 goto LABEL_92; | |
7500 } | |
7501 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7502 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7503 if ( *v72 ) |
7504 { | |
7505 v66 = pParty->pPickedItem.GetDisplayName(); | |
7506 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7507 LABEL_72: | |
7508 sprintf(pTmpBuf, v57, v66); | |
7509 ShowStatusBarString(pTmpBuf, 2u); | |
7510 LABEL_92: | |
7511 v61 = v4; | |
7512 v52 = v4; | |
7513 v48 = v4; | |
7514 v45 = v4; | |
7515 v43 = -1; | |
7516 v41 = v4; | |
7517 v39 = v4; | |
7518 v37 = (SoundID)27; | |
7519 LABEL_93: | |
7520 v14 = pAudioPlayer; | |
7521 LABEL_63: | |
7522 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7523 return; | |
7524 } | |
243 | 7525 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7526 { |
7527 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7528 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7529 goto LABEL_72; | |
7530 } | |
7531 v16 = v15 % 11 + 1; | |
7532 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7533 v75 = v16; | |
7534 v18 = SkillToMastery(*v17) - 1; | |
7535 if ( v18 ) | |
7536 { | |
7537 v19 = v18 - 1; | |
7538 if ( v19 ) | |
7539 { | |
7540 v20 = v19 - 1; | |
7541 if ( v20 ) | |
7542 { | |
7543 if ( v20 != 1 ) | |
7544 { | |
7545 v21 = a2; | |
7546 LABEL_83: | |
7547 if ( v75 > v21 || !*v17 ) | |
7548 { | |
7549 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7550 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7551 ShowStatusBarString(pTmpBuf, 2u); |
7552 v65 = 0; | |
7553 v56 = 20; | |
7554 goto LABEL_67; | |
7555 } | |
7556 *v72 = 1; | |
187 | 7557 v3->PlaySound(SPEECH_21, 0); |
0 | 7558 v73 = 0; |
7559 LABEL_173: | |
7560 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7561 if ( v36 == 14 ) | |
7562 { | |
7563 v71 = 0; | |
7564 v60 = 0; | |
7565 v51 = 0; | |
7566 v47 = 0; | |
7567 v44 = -1; | |
7568 v42 = 0; | |
7569 v40 = 0; | |
7570 v38 = (SoundID)210; | |
7571 } | |
7572 else | |
7573 { | |
7574 if ( v36 != 13 ) | |
7575 { | |
7576 LABEL_178: | |
7577 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7578 { | |
7579 if ( !v73 ) | |
7580 goto LABEL_187; | |
437 | 7581 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7582 { |
990 | 7583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7584 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7585 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7586 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7587 }*/ |
7588 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7589 } |
7590 if ( v73 ) | |
7591 { | |
7592 if ( pParty->bTurnBasedModeOn ) | |
7593 { | |
7594 *(&pParty->field_16140 + a2) = 100; | |
7595 thisb->SetRecoveryTime(100); | |
7596 pTurnEngine->_40471C(); | |
7597 } | |
7598 else | |
7599 { | |
7600 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7601 } | |
7602 } | |
7603 goto LABEL_187; | |
7604 } | |
7605 v71 = 0; | |
7606 v60 = 0; | |
7607 v51 = 0; | |
7608 v47 = 0; | |
7609 v44 = -1; | |
7610 v42 = 0; | |
7611 v40 = 0; | |
7612 v38 = (SoundID)211; | |
7613 } | |
7614 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7615 goto LABEL_178; | |
7616 } | |
7617 v67 = 11; | |
7618 } | |
7619 else | |
7620 { | |
7621 v67 = 10; | |
7622 } | |
7623 } | |
7624 else | |
7625 { | |
7626 v67 = 7; | |
7627 } | |
7628 } | |
7629 else | |
7630 { | |
7631 v67 = 4; | |
7632 } | |
7633 v21 = v67; | |
7634 goto LABEL_83; | |
7635 } | |
151 | 7636 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7637 return; |
243 | 7638 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7639 goto LABEL_89; |
7640 if ( bUnderwater == 1 ) | |
7641 { | |
7642 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7643 goto LABEL_91; | |
7644 } | |
7645 dword_50C9AC = 1; | |
7646 v24 = pParty->pPickedItem.uItemID - 299; | |
7647 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7648 { | |
7649 pMouse->RemoveHoldingItem(); | |
7650 pGUIWindow_CurrentMenu->Release(); | |
7651 pIcons_LOD->_4114F2(); | |
151 | 7652 pCurrentScreen = SCREEN_GAME; |
0 | 7653 viewparams->bRedrawGameUI = 1; |
7654 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7655 } | |
7656 else | |
7657 { | |
7658 _720984_unused = pParty->pPickedItem.uItemID; | |
7659 pMouse->RemoveHoldingItem(); | |
998 | 7660 /*if ( dword_50C9E8 < 40 ) |
0 | 7661 { |
7662 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7663 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7664 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7665 ++dword_50C9E8; |
998 | 7666 }*/ |
1012 | 7667 pMessageQueue_50C9E8->AddMessage(UIMSG_92, v24, a2 - 1); |
0 | 7668 if ( pCurrentScreen |
7669 && pGUIWindow_CurrentMenu | |
437 | 7670 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7671 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7672 { | |
990 | 7673 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7674 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7675 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7676 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7677 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7678 } | |
7679 } | |
7680 } | |
0 | 7681 |
7682 | |
7683 | |
7684 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7685 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7686 { | |
0 | 7687 Player *v3; // esi@1 |
7688 signed int v4; // edi@1 | |
7689 unsigned int v5; // eax@8 | |
7690 int v6; // eax@9 | |
7691 enum CHARACTER_RACE v7; // eax@11 | |
7692 signed int v8; // eax@17 | |
7693 unsigned __int8 v9; // sf@17 | |
7694 unsigned __int8 v10; // of@17 | |
7695 int v11; // eax@19 | |
7696 unsigned int v12; // eax@20 | |
484 | 7697 unsigned int test_bit_value; // eax@25 |
7698 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7699 signed int v15; // ecx@28 |
7700 ItemGen *v16; // eax@28 | |
7701 char v17; // zf@31 | |
7702 int v18; // edi@90 | |
7703 DDM_DLV_Header *v19; // eax@122 | |
7704 char v20; // cl@124 | |
7705 DDM_DLV_Header *v21; // eax@126 | |
7706 unsigned int v22; // edi@129 | |
100 | 7707 Player *v23; // esi@134 |
0 | 7708 ItemGen *v24; // ecx@135 |
7709 signed int v25; // edx@135 | |
7710 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7711 char *v27; // edi@155 | |
7712 int v28; // ebx@161 | |
7713 int v29; // eax@161 | |
7714 | |
469 | 7715 v6 = 0; |
0 | 7716 v3 = this; |
7717 v4 = -1; | |
469 | 7718 if ( VarNum > VAR_AutoNotes ) |
7719 { | |
7720 switch ( VarNum ) | |
0 | 7721 { |
7722 case VAR_Invisible: | |
484 | 7723 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7724 return true; |
484 | 7725 return false; |
0 | 7726 case VAR_NumDeaths: |
7727 v4 = pParty->uNumDeaths; | |
469 | 7728 return v4 >= pValue; |
0 | 7729 case VAR_NumBounties: |
7730 v4 = pParty->uNumBountiesCollected; | |
469 | 7731 return v4 >= pValue; |
0 | 7732 case VAR_PrisonTerms: |
7733 v4 = pParty->uNumPrisonTerms; | |
469 | 7734 return v4 >= pValue; |
0 | 7735 case VAR_ArenaWinsPage: |
7736 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7737 return v4 >= pValue; |
0 | 7738 case VAR_ArenaWinsSquire: |
7739 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7740 return v4 >= pValue; |
0 | 7741 case VAR_ArenaWinsKnight: |
7742 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7743 return v4 >= pValue; |
0 | 7744 case VAR_ArenaWinsLord: |
7745 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7746 return v4 >= pValue; |
0 | 7747 case VAR_ReputationInCurrentLocation: |
7748 v19 = &pOutdoor->ddm; | |
7749 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7750 v19 = &pIndoor->dlv; | |
469 | 7751 v6 = v19->uReputation >= pValue; |
7752 return v6; | |
0 | 7753 case VAR_History_28|VAR_Sex: |
7754 v21 = &pOutdoor->ddm; | |
7755 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7756 v21 = &pIndoor->dlv; | |
469 | 7757 v6 = v21->field_C_alert == pValue; |
0 | 7758 return v6; |
7759 case VAR_MonthEquals2|VAR_Sex: | |
7760 case VAR_MonthEquals2|VAR_Class: | |
7761 case VAR_Counter1: | |
7762 case VAR_Counter2: | |
7763 case VAR_Counter3: | |
7764 case VAR_Counter4: | |
7765 case VAR_Counter5: | |
7766 case VAR_Counter6: | |
7767 case VAR_Counter7: | |
7768 case VAR_Counter8: | |
469 | 7769 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7770 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7771 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7772 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7773 return true; | |
7774 return false; | |
0 | 7775 case VAR_NumSkillPoints: |
7776 v4 = this->uSkillPoints; | |
469 | 7777 return v4 >= pValue; |
0 | 7778 case VAR_CircusPrises: |
7779 v4 = 0; | |
100 | 7780 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7781 do |
7782 { | |
469 | 7783 v24 = v23->pInventoryItems; |
0 | 7784 v25 = 138; |
7785 do | |
7786 { | |
7787 switch ( v24->uItemID ) | |
7788 { | |
7789 case 0x1D6u: | |
7790 ++v4; | |
7791 break; | |
7792 case 0x1D7u: | |
7793 v4 += 3; | |
7794 break; | |
7795 case 0x1DDu: | |
7796 v4 += 5; | |
7797 break; | |
7798 } | |
7799 ++v24; | |
7800 --v25; | |
7801 } | |
7802 while ( v25 ); | |
100 | 7803 ++v23; |
0 | 7804 } |
100 | 7805 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7806 return v4 >= pValue; |
0 | 7807 case VAR_MonthEquals2: |
469 | 7808 v6 = pParty->uCurrentMonth == pValue; |
7809 return v6; | |
0 | 7810 case VAR_IsFlying: |
7811 if ( pParty->bFlying | |
484 | 7812 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7813 return true; |
7814 return false; | |
0 | 7815 case VAR_HiredNPCHasSpeciality: |
469 | 7816 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7817 return v6; |
7818 case VAR_NPCs2: | |
469 | 7819 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7820 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7821 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7822 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7823 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7824 return v4 >= pValue; |
7825 v4 = pValue; | |
7826 return v4 >= pValue; | |
0 | 7827 case VAR_ItemEquipped: |
7828 v26 = (ITEM_EQUIP_TYPE)0; | |
7829 v27 = (char *)&this->pEquipment; | |
7830 break; | |
7831 case VAR_GoldInBank: | |
7832 v4 = pParty->uNumGoldInBank; | |
469 | 7833 return v4 >= pValue; |
0 | 7834 case VAR_ThieverySkill|0x80: |
7835 v28 = GetActualMight(); | |
7836 v29 = v3->GetBaseStrength(); | |
7837 goto LABEL_168; | |
7838 case VAR_DisarmTrapSkill|0x80: | |
7839 v28 = GetActualIntelligence(); | |
7840 v29 = v3->GetBaseIntelligence(); | |
7841 goto LABEL_168; | |
7842 case VAR_MonthEquals: | |
7843 v28 = GetActualWillpower(); | |
7844 v29 = v3->GetBaseWillpower(); | |
7845 goto LABEL_168; | |
7846 case VAR_MonthEquals|VAR_Sex: | |
7847 v28 = GetActualEndurance(); | |
7848 v29 = v3->GetBaseEndurance(); | |
7849 goto LABEL_168; | |
7850 case VAR_IdentifyMonsterSkill|0x80: | |
7851 v28 = GetActualSpeed(); | |
7852 v29 = v3->GetBaseSpeed(); | |
7853 goto LABEL_168; | |
7854 case VAR_ArmsmasterSkill|0x80: | |
7855 v28 = GetActualAccuracy(); | |
7856 v29 = v3->GetBaseAccuracy(); | |
7857 goto LABEL_168; | |
7858 case VAR_MonthEquals|VAR_MaxHP: | |
7859 v28 = GetActualLuck(); | |
7860 v29 = v3->GetBaseLuck(); | |
7861 LABEL_168: | |
7862 v10 = __OFSUB__(v28, v29); | |
7863 v9 = v28 - v29 < 0; | |
7864 LABEL_169: | |
7865 if ( v9 ^ v10 ) | |
469 | 7866 return v4 >= pValue; |
7867 return true; | |
0 | 7868 default: |
469 | 7869 return v4 >= pValue; |
0 | 7870 } |
7871 while ( !v3->HasItemEquipped(v26) | |
654 | 7872 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7873 { |
7874 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7875 v27 += 4; | |
7876 if ( (signed int)v26 >= 16 ) | |
469 | 7877 return false; |
7878 } | |
7879 return true; | |
7880 } | |
7881 if ( VarNum == VAR_AutoNotes ) | |
0 | 7882 { |
484 | 7883 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7884 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7885 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7886 return false; | |
7887 return true; | |
469 | 7888 } |
7889 if ( VarNum <= VAR_BaseLuck ) | |
7890 { | |
7891 if ( VarNum != VAR_BaseLuck ) | |
7892 { | |
7893 switch ( VarNum ) | |
0 | 7894 { |
7895 case VAR_Hour: | |
469 | 7896 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7897 return true; | |
7898 return false; | |
0 | 7899 case VAR_DayOfYear: |
469 | 7900 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7901 v6 = v5 == pValue; | |
7902 return v6; | |
0 | 7903 case VAR_DayOfWeek: |
469 | 7904 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7905 v6 = v5 == pValue; | |
0 | 7906 return v6; |
7907 case VAR_Sex: | |
469 | 7908 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7909 return true; | |
7910 return v4 >= pValue; | |
0 | 7911 case VAR_Class: |
135 | 7912 v7 = (CHARACTER_RACE)this->classType; |
469 | 7913 if ( pValue == v7 ) |
7914 return true; | |
7915 return v4 >= pValue; | |
0 | 7916 case VAR_Race: |
7917 v7 = GetRace(); | |
469 | 7918 if ( pValue == v7 ) |
7919 return true; | |
7920 return v4 >= pValue; | |
0 | 7921 case VAR_CurrentHP: |
7922 v4 = this->sHealth; | |
469 | 7923 return v4 >= pValue; |
0 | 7924 case VAR_MaxHP: |
7925 v8 = GetMaxHealth(); | |
7926 v10 = __OFSUB__(v3->sHealth, v8); | |
7927 v9 = v3->sHealth - v8 < 0; | |
7928 goto LABEL_169; | |
7929 case VAR_CurrentSP: | |
7930 v4 = this->sMana; | |
469 | 7931 return v4 >= pValue; |
0 | 7932 case VAR_MaxSP: |
7933 v11 = GetMaxMana(); | |
7934 v10 = __OFSUB__(v3->sMana, v11); | |
7935 v9 = v3->sMana - v11 < 0; | |
7936 goto LABEL_169; | |
7937 case VAR_ActualAC: | |
7938 v12 = GetActualAC(); | |
7939 goto _j_cmp_against_arg; | |
7940 case VAR_ACModifier: | |
7941 v4 = this->sACModifier; | |
469 | 7942 return v4 >= pValue; |
0 | 7943 case VAR_BaseLevel: |
7944 v4 = this->uLevel; | |
469 | 7945 return v4 >= pValue; |
0 | 7946 case VAR_LevelModifier: |
7947 v4 = this->sLevelModifier; | |
469 | 7948 return v4 >= pValue; |
0 | 7949 case VAR_Age: |
7950 v12 = GetActualAge(); | |
7951 goto _j_cmp_against_arg; | |
7952 case VAR_Award: | |
484 | 7953 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7954 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7955 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7956 return true; | |
7957 return false; | |
0 | 7958 case VAR_Experience: |
7959 v4 = LODWORD(this->uExperience); | |
469 | 7960 return v4 >= pValue; |
0 | 7961 case VAR_QBits_QuestsDone: |
484 | 7962 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7963 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7964 if ( test_bit_value & our_bit_value ) | |
478 | 7965 return true; |
7966 return false; | |
0 | 7967 case VAR_PlayerItemInHands: |
7968 v15 = 0; | |
7969 v16 = v3->pInventoryItems; | |
7970 break; | |
7971 case VAR_FixedGold: | |
7972 v4 = pParty->uNumGold; | |
469 | 7973 return v4 >= pValue; |
0 | 7974 case VAR_MightBonus: |
7975 v4 = this->uMightBonus; | |
469 | 7976 return v4 >= pValue; |
0 | 7977 case VAR_IntellectBonus: |
7978 v4 = this->uIntelligenceBonus; | |
469 | 7979 return v4 >= pValue; |
0 | 7980 case VAR_PersonalityBonus: |
7981 v4 = this->uWillpowerBonus; | |
469 | 7982 return v4 >= pValue; |
0 | 7983 case VAR_EnduranceBonus: |
7984 v4 = this->uEnduranceBonus; | |
469 | 7985 return v4 >= pValue; |
0 | 7986 case VAR_SpeedBonus: |
7987 v4 = this->uSpeedBonus; | |
469 | 7988 return v4 >= pValue; |
0 | 7989 case VAR_AccuracyBonus: |
7990 v4 = this->uAccuracyBonus; | |
469 | 7991 return v4 >= pValue; |
0 | 7992 case VAR_LuckBonus: |
7993 v4 = this->uLuckBonus; | |
469 | 7994 return v4 >= pValue; |
0 | 7995 case VAR_BaseMight: |
7996 v4 = this->uMight; | |
469 | 7997 return v4 >= pValue; |
0 | 7998 case VAR_BaseIntellect: |
7999 v4 = this->uIntelligence; | |
469 | 8000 return v4 >= pValue; |
0 | 8001 case VAR_BasePersonality: |
8002 v4 = this->uWillpower; | |
469 | 8003 return v4 >= pValue; |
0 | 8004 case VAR_BaseEndurance: |
8005 v4 = this->uEndurance; | |
469 | 8006 return v4 >= pValue; |
0 | 8007 case VAR_BaseSpeed: |
8008 v4 = this->uSpeed; | |
469 | 8009 return v4 >= pValue; |
0 | 8010 case VAR_BaseAccuracy: |
8011 v4 = this->uAccuracy; | |
469 | 8012 return v4 >= pValue; |
0 | 8013 case VAR_FixedFood: |
8014 v4 = pParty->uNumFoodRations; | |
469 | 8015 return v4 >= pValue; |
0 | 8016 default: |
469 | 8017 return v4 >= pValue; |
8018 } | |
8019 while ( v16->uItemID != pValue ) | |
0 | 8020 { |
8021 ++v15; | |
8022 ++v16; | |
8023 if ( v15 >= 138 ) | |
8024 { | |
469 | 8025 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8026 return v6; |
8027 } | |
8028 } | |
469 | 8029 return true; |
0 | 8030 } |
8031 v4 = this->uLuck; | |
469 | 8032 return v4 >= pValue; |
8033 } | |
8034 if ( VarNum <= VAR_MagicResistance ) | |
8035 { | |
8036 if ( VarNum == VAR_MagicResistance ) | |
0 | 8037 { |
8038 v4 = this->sResMagicBase; | |
8039 } | |
8040 else | |
8041 { | |
469 | 8042 switch ( VarNum ) |
0 | 8043 { |
8044 case VAR_FireResistance: | |
8045 v4 = this->sResFireBase; | |
469 | 8046 return v4 >= pValue; |
0 | 8047 case VAR_AirResistance: |
8048 v4 = this->sResAirBase; | |
469 | 8049 return v4 >= pValue; |
0 | 8050 case VAR_WaterResistance: |
8051 v4 = this->sResWaterBase; | |
469 | 8052 return v4 >= pValue; |
0 | 8053 case VAR_EarthResistance: |
8054 v4 = this->sResEarthBase; | |
469 | 8055 return v4 >= pValue; |
0 | 8056 case VAR_SpiritResistance: |
8057 v4 = this->sResSpiritBase; | |
469 | 8058 return v4 >= pValue; |
0 | 8059 case VAR_MindResistance: |
8060 v4 = this->sResMindBase; | |
469 | 8061 return v4 >= pValue; |
0 | 8062 case VAR_BodyResistance: |
8063 v4 = this->sResBodyBase; | |
469 | 8064 return v4 >= pValue; |
0 | 8065 case VAR_LightResistance: |
8066 v4 = this->sResLightBase; | |
469 | 8067 return v4 >= pValue; |
0 | 8068 case VAR_DarkResistance: |
8069 v4 = this->sResDarkBase; | |
469 | 8070 return v4 >= pValue; |
0 | 8071 case VAR_ActualMight: |
8072 v12 = GetActualMight(); | |
8073 goto _j_cmp_against_arg; | |
8074 case VAR_ActualIntellect: | |
8075 v12 = GetActualIntelligence(); | |
8076 goto _j_cmp_against_arg; | |
8077 case VAR_ActualPersonality: | |
8078 v12 = GetActualWillpower(); | |
8079 goto _j_cmp_against_arg; | |
8080 case VAR_ActualEndurance: | |
8081 v12 = GetActualEndurance(); | |
8082 goto _j_cmp_against_arg; | |
8083 case VAR_ActualSpeed: | |
8084 v12 = GetActualSpeed(); | |
8085 goto _j_cmp_against_arg; | |
8086 case VAR_ActualAccuracy: | |
8087 v12 = GetActualAccuracy(); | |
8088 goto _j_cmp_against_arg; | |
8089 case VAR_ActualLuck: | |
8090 v12 = GetActualLuck(); | |
8091 _j_cmp_against_arg: | |
8092 v4 = v12; | |
8093 break; | |
8094 default: | |
469 | 8095 return v4 >= pValue; |
8096 } | |
8097 } | |
8098 return v4 >= pValue; | |
8099 } | |
8100 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8101 { | |
8102 if ( VarNum != VAR_DisarmTrapSkill ) | |
8103 { | |
8104 if ( VarNum <= VAR_MindResistanceBonus ) | |
8105 { | |
8106 switch ( VarNum ) | |
0 | 8107 { |
8108 case VAR_MindResistanceBonus: | |
8109 v4 = this->sResMindBonus; | |
8110 break; | |
8111 case VAR_FireResistanceBonus: | |
8112 v4 = this->sResFireBonus; | |
8113 break; | |
8114 case VAR_AirResistanceBonus: | |
8115 v4 = this->sResAirBonus; | |
8116 break; | |
8117 case VAR_WaterResistanceBonus: | |
8118 v4 = this->sResWaterBonus; | |
8119 break; | |
8120 case VAR_EarthResistanceBonus: | |
8121 v4 = this->sResEarthBonus; | |
8122 break; | |
8123 case VAR_SpiritResistanceBonus: | |
8124 v4 = this->sResSpiritBonus; | |
8125 break; | |
8126 } | |
469 | 8127 return v4 >= pValue; |
8128 } | |
8129 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8130 { |
8131 v4 = this->sResBodyBonus; | |
469 | 8132 return v4 >= pValue; |
8133 } | |
8134 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8135 { |
8136 v4 = this->sResLightBonus; | |
469 | 8137 return v4 >= pValue; |
8138 } | |
8139 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8140 { |
8141 v4 = this->sResDarkBonus; | |
469 | 8142 return v4 >= pValue; |
8143 } | |
8144 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8145 { |
8146 v4 = this->sResMagicBonus; | |
469 | 8147 return v4 >= pValue; |
8148 } | |
8149 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8150 return v4 >= pValue; | |
0 | 8151 } |
8152 LABEL_90: | |
469 | 8153 v18 = *((short *)&this->pConditions[16] + VarNum); |
8154 if ( pValue <= 63 ) | |
0 | 8155 v4 = v18 & 0x3F; |
8156 else | |
469 | 8157 v4 = pValue & v18; |
8158 return v4 >= pValue; | |
8159 } | |
8160 if ( VarNum == 104 ) | |
0 | 8161 goto LABEL_90; |
469 | 8162 if ( (signed int)VarNum <= 104 ) |
8163 return v4 >= pValue; | |
8164 if ( (signed int)VarNum > 0x79 ) | |
8165 { | |
8166 if ( VarNum != 122 ) | |
8167 { | |
8168 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8169 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8170 return v4 >= pValue; | |
0 | 8171 } |
8172 v4 = GetMajorConditionIdx(); | |
8173 if ( v4 != 18 ) | |
8174 { | |
469 | 8175 return v4 >= pValue; |
8176 } | |
8177 v4 = pValue; | |
8178 return v4 >= pValue; | |
8179 } | |
8180 return *((int *)this + 2 * VarNum - 210); | |
0 | 8181 } |
8182 | |
8183 | |
8184 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8185 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8186 { | |
8187 signed int currPlayerId; // ebx@1 | |
0 | 8188 Player *v4; // esi@1 |
8189 unsigned int v5; // edi@1 | |
8190 unsigned int v6; // esi@13 | |
8191 unsigned int v7; // esi@14 | |
8192 signed int v8; // eax@17 | |
8193 ItemGen *v9; // ecx@17 | |
8194 int v10; // eax@21 | |
8195 signed int v11; // eax@30 | |
8196 Player *v12; // ecx@44 | |
8197 char *v13; // ecx@45 | |
8198 Player *v14; // ecx@49 | |
8199 int v15; // ecx@86 | |
8200 int v16; // esi@106 | |
8201 char v17; // al@106 | |
8202 int v18; // eax@107 | |
8203 Player *v19; // ecx@112 | |
8204 Player *v20; // ecx@127 | |
8205 int v21; // eax@127 | |
8206 int v22; // eax@145 | |
8207 char v23; // zf@146 | |
8208 DDM_DLV_Header *v24; // ecx@148 | |
8209 signed int v25; // eax@172 | |
8210 int v26; // [sp-8h] [bp-3Ch]@84 | |
8211 signed int v27; // [sp-4h] [bp-38h]@4 | |
8212 int v28; // [sp-4h] [bp-38h]@84 | |
8213 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8214 char v30; // [sp+32h] [bp-2h]@1 | |
8215 char v31; // [sp+33h] [bp-1h]@1 | |
8216 | |
492 | 8217 currPlayerId = 0; |
0 | 8218 v30 = 0; |
8219 v31 = 0; | |
8220 v4 = this; | |
8221 v5 = 0; | |
8222 if ( this == pPlayers[2] ) | |
492 | 8223 currPlayerId = 1; |
8224 else if ( this == pPlayers[3] ) | |
8225 currPlayerId = 2; | |
757 | 8226 else if ( this == pPlayers[4] ) |
492 | 8227 currPlayerId = 3; |
8228 if ( var_type > VAR_AutoNotes ) | |
8229 { | |
8230 if ( var_type <= VAR_GoldInBank ) | |
8231 { | |
8232 if ( var_type == VAR_GoldInBank ) | |
8233 { | |
8234 pParty->uNumGoldInBank = var_value; | |
0 | 8235 return; |
8236 } | |
492 | 8237 if ( var_type <= VAR_Counter8 ) |
8238 { | |
8239 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8240 { |
492 | 8241 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8242 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8243 } |
8244 else | |
8245 { | |
492 | 8246 switch ( var_type ) |
0 | 8247 { |
8248 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8249 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8250 break; |
8251 case VAR_NPCs2: | |
8252 pParty->field_709 = 0; | |
492 | 8253 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8254 Party__CountHirelings(); |
0 | 8255 viewparams->bRedrawGameUI = 1; |
8256 break; | |
8257 case VAR_NumSkillPoints: | |
492 | 8258 this->uSkillPoints = var_value; |
0 | 8259 break; |
8260 } | |
8261 } | |
8262 return; | |
8263 } | |
492 | 8264 if ( var_type < VAR_Counter9 ) |
0 | 8265 return; |
492 | 8266 if ( (signed int)var_type <= 0x112 ) |
8267 { | |
8268 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8269 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8270 } |
8271 else | |
8272 { | |
492 | 8273 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8274 { |
8275 v24 = &pOutdoor->ddm; | |
8276 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8277 v24 = &pIndoor->dlv; | |
492 | 8278 v24->uReputation = var_value; |
8279 if ( var_value > 10000 ) | |
0 | 8280 v24->uReputation = 10000; |
8281 return; | |
8282 } | |
492 | 8283 if ( var_type <= VAR_ReputationInCurrentLocation |
8284 || var_type > VAR_History_28 | |
8285 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8286 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8287 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8288 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8289 v23) ) |
8290 return; | |
8291 bFlashHistoryBook = 1; | |
8292 } | |
8293 LABEL_172: | |
492 | 8294 v25 = 8 * currPlayerId + 400; |
862 | 8295 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8296 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8297 return; | |
8298 } | |
492 | 8299 if ( var_type != 307 ) |
8300 { | |
8301 switch ( var_type ) | |
0 | 8302 { |
8303 case 308: | |
492 | 8304 pParty->uNumBountiesCollected = var_value; |
0 | 8305 break; |
8306 case 309: | |
492 | 8307 pParty->uNumPrisonTerms = var_value; |
0 | 8308 break; |
8309 case 310: | |
492 | 8310 pParty->uNumArenaPageWins = var_value; |
0 | 8311 break; |
8312 case 311: | |
492 | 8313 pParty->uNumArenaSquireWins = var_value; |
0 | 8314 break; |
8315 case 312: | |
492 | 8316 pParty->uNumArenaKnightWins = var_value; |
0 | 8317 break; |
8318 case 313: | |
492 | 8319 pParty->uNumArenaLordWins = var_value; |
0 | 8320 break; |
8321 } | |
8322 return; | |
8323 } | |
492 | 8324 pParty->uNumDeaths = var_value; |
0 | 8325 LABEL_168: |
8326 if ( v30 != 1 ) | |
8327 { | |
8328 LABEL_170: | |
8329 if ( v31 != 1 ) | |
8330 return; | |
8331 v5 = 0; | |
8332 goto LABEL_172; | |
8333 } | |
8334 LABEL_169: | |
492 | 8335 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8336 goto LABEL_170; |
8337 } | |
492 | 8338 if ( var_type == VAR_AutoNotes ) |
8339 { | |
8340 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8341 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8342 && pAutonoteTxt[var_value-1].pText ) |
8343 { | |
8344 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8345 v30 = 1; |
187 | 8346 v20->PlaySound(SPEECH_96, 0); |
492 | 8347 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8348 bFlashAutonotesBook = 1; |
981 | 8349 _506568_autonote_type = v21; |
0 | 8350 } |
492 | 8351 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8352 v31 = 1; |
8353 goto LABEL_168; | |
8354 } | |
492 | 8355 if ( var_type <= VAR_ActualMight ) |
8356 { | |
8357 if ( var_type != VAR_ActualMight ) | |
8358 { | |
8359 switch ( var_type ) | |
0 | 8360 { |
8361 case VAR_RandomGold: | |
492 | 8362 v6 = rand() % var_value + 1; |
0 | 8363 Party::SetGold(v6); |
8364 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8365 ShowStatusBarString(pTmpBuf, 2u); | |
8366 GameUI_DrawFoodAndGold(); | |
8367 return; | |
8368 case VAR_RandomFood: | |
492 | 8369 v7 = rand() % var_value + 1; |
0 | 8370 Party::SetFood(v7); |
8371 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8372 ShowStatusBarString(pTmpBuf, 2u); | |
8373 GameUI_DrawFoodAndGold(); | |
8374 goto LABEL_124; | |
8375 case VAR_Sex: | |
492 | 8376 this->uSex = (PLAYER_SEX)var_value; |
0 | 8377 goto LABEL_124; |
8378 case VAR_Class: | |
492 | 8379 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8380 if ( (char)var_value != 35 ) | |
0 | 8381 goto LABEL_124; |
8382 v8 = 0; | |
8383 v9 = this->pInventoryItems; | |
8384 break; | |
8385 case VAR_CurrentHP: | |
492 | 8386 this->sHealth = var_value; |
0 | 8387 goto LABEL_124; |
8388 case VAR_MaxHP: | |
8389 this->sHealth = GetMaxHealth(); | |
8390 return; | |
8391 case VAR_CurrentSP: | |
492 | 8392 this->sMana = var_value; |
0 | 8393 goto LABEL_124; |
8394 case VAR_MaxSP: | |
8395 this->sMana = GetMaxMana(); | |
8396 return; | |
8397 case VAR_ACModifier: | |
492 | 8398 this->sACModifier = (unsigned __int8)var_value; |
0 | 8399 goto LABEL_124; |
8400 case VAR_BaseLevel: | |
492 | 8401 this->uLevel = (unsigned __int8)var_value; |
0 | 8402 goto LABEL_124; |
8403 case VAR_LevelModifier: | |
492 | 8404 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8405 goto LABEL_124; |
8406 case VAR_Age: | |
492 | 8407 this->sAgeModifier = var_value; |
0 | 8408 return; |
8409 case VAR_Award: | |
492 | 8410 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8411 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8412 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8413 && pAwards[var_value].pText ) |
0 | 8414 { |
8415 v30 = 1; | |
8416 v31 = 1; | |
492 | 8417 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8418 } |
492 | 8419 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8420 goto LABEL_168; | |
0 | 8421 case VAR_Experience: |
492 | 8422 this->uExperience = var_value; |
0 | 8423 goto LABEL_124; |
8424 case VAR_QBits_QuestsDone: | |
492 | 8425 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8426 // && (&dword_722F10)[4 * a3] ) |
492 | 8427 && pQuestTable[var_value-1] ) |
0 | 8428 { |
492 | 8429 v14 = pPlayers[currPlayerId + 1]; |
0 | 8430 bFlashQuestBook = 1; |
8431 v30 = 1; | |
8432 v31 = 1; | |
187 | 8433 v14->PlaySound(SPEECH_93, 0); |
0 | 8434 } |
484 | 8435 v13 = (char *)pParty->_quest_bits; |
0 | 8436 LABEL_51: |
492 | 8437 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8438 if (( v30 != 1 )&&( v31 != 1 )) | |
8439 return; | |
8440 else | |
8441 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8442 if ( v31 != 1 ) | |
8443 return; | |
8444 v25 = 8 * currPlayerId + 400; | |
862 | 8445 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8446 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8447 return; | |
0 | 8448 case VAR_PlayerItemInHands: |
8449 item.Reset(); | |
8450 item.Reset(); | |
492 | 8451 item.uItemID = var_value; |
0 | 8452 item.uAttributes = 1; |
8453 pParty->SetHoldingItem(&item); | |
492 | 8454 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8455 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8456 return; |
8457 case VAR_FixedGold: | |
492 | 8458 Party::SetGold(var_value); |
0 | 8459 return; |
8460 case VAR_BaseMight: | |
492 | 8461 this->uMight = (unsigned __int8)var_value; |
0 | 8462 goto LABEL_84; |
8463 case VAR_BaseIntellect: | |
492 | 8464 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8465 goto LABEL_84; |
8466 case VAR_BasePersonality: | |
492 | 8467 this->uWillpower = (unsigned __int8)var_value; |
0 | 8468 goto LABEL_84; |
8469 case VAR_BaseEndurance: | |
492 | 8470 this->uEndurance = (unsigned __int8)var_value; |
0 | 8471 goto LABEL_84; |
8472 case VAR_BaseSpeed: | |
492 | 8473 this->uSpeed = (unsigned __int8)var_value; |
0 | 8474 goto LABEL_84; |
8475 case VAR_BaseAccuracy: | |
492 | 8476 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8477 goto LABEL_84; |
8478 case VAR_BaseLuck: | |
492 | 8479 this->uLuck = (unsigned __int8)var_value; |
0 | 8480 goto LABEL_84; |
8481 case VAR_FixedFood: | |
492 | 8482 Party::SetFood(var_value); |
0 | 8483 goto LABEL_124; |
8484 case VAR_MightBonus: | |
8485 goto LABEL_64; | |
8486 case VAR_IntellectBonus: | |
8487 goto LABEL_68; | |
8488 case VAR_PersonalityBonus: | |
8489 goto LABEL_69; | |
8490 case VAR_EnduranceBonus: | |
8491 goto LABEL_70; | |
8492 case VAR_SpeedBonus: | |
8493 goto LABEL_71; | |
8494 case VAR_AccuracyBonus: | |
8495 goto LABEL_72; | |
8496 case VAR_LuckBonus: | |
8497 goto LABEL_73; | |
8498 default: | |
8499 return; | |
8500 } | |
8501 while ( v9->uItemID != 615 ) | |
8502 { | |
8503 ++v8; | |
8504 ++v9; | |
8505 if ( v8 >= 138 ) | |
8506 goto LABEL_22; | |
8507 } | |
8508 v10 = (int)((char *)v4 + 36 * v8); | |
8509 *(int *)(v10 + 532) = 601; | |
492 | 8510 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8511 LABEL_22: |
8512 if ( v4->sResFireBase < 20 ) | |
8513 v4->sResFireBase = 20; | |
8514 if ( v4->sResAirBase < 20 ) | |
8515 v4->sResAirBase = 20; | |
8516 if ( v4->sResWaterBase < 20 ) | |
8517 v4->sResWaterBase = 20; | |
8518 if ( v4->sResEarthBase < 20 ) | |
8519 v4->sResEarthBase = 20; | |
8520 v4->sResMindBase = 200; | |
8521 v4->sResBodyBase = 200; | |
8522 v11 = v4->GetSexByVoice(); | |
1014 | 8523 v4->uPrevVoiceID = v4->uVoiceID; |
8524 v4->uPrevFace = v4->uCurrentFace; | |
0 | 8525 if ( v11 ) |
8526 { | |
1014 | 8527 v4->uCurrentFace = 21; |
0 | 8528 v4->uVoiceID = 21; |
8529 } | |
8530 else | |
8531 { | |
1014 | 8532 v4->uCurrentFace = 20; |
0 | 8533 v4->uVoiceID = 20; |
8534 } | |
1014 | 8535 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
0 | 8536 goto LABEL_124; |
8537 } | |
8538 LABEL_64: | |
492 | 8539 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8540 LABEL_111: |
8541 v28 = 0; | |
187 | 8542 v26 = SPEECH_91; |
0 | 8543 LABEL_112: |
492 | 8544 v19 = pPlayers[currPlayerId + 1]; |
0 | 8545 v31 = 1; |
187 | 8546 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8547 goto LABEL_169; |
8548 } | |
492 | 8549 if ( var_type <= VAR_FireResistanceBonus ) |
8550 { | |
8551 if ( var_type == VAR_FireResistanceBonus ) | |
8552 { | |
8553 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8554 goto LABEL_111; |
8555 } | |
492 | 8556 switch ( var_type ) |
0 | 8557 { |
8558 case VAR_ActualIntellect: | |
8559 LABEL_68: | |
492 | 8560 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8561 goto LABEL_111; |
8562 case VAR_ActualPersonality: | |
8563 LABEL_69: | |
492 | 8564 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8565 goto LABEL_111; |
8566 case VAR_ActualEndurance: | |
8567 LABEL_70: | |
492 | 8568 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8569 goto LABEL_111; |
8570 case VAR_ActualSpeed: | |
8571 LABEL_71: | |
492 | 8572 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8573 goto LABEL_111; |
8574 case VAR_ActualAccuracy: | |
8575 LABEL_72: | |
492 | 8576 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8577 goto LABEL_111; |
8578 case VAR_ActualLuck: | |
8579 LABEL_73: | |
492 | 8580 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8581 goto LABEL_111; |
8582 case VAR_FireResistance: | |
492 | 8583 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8584 goto LABEL_84; |
8585 case VAR_AirResistance: | |
492 | 8586 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8587 goto LABEL_84; |
8588 case VAR_WaterResistance: | |
492 | 8589 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8590 goto LABEL_84; |
8591 case VAR_EarthResistance: | |
492 | 8592 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8593 goto LABEL_84; |
8594 case VAR_SpiritResistance: | |
492 | 8595 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8596 goto LABEL_84; |
8597 case VAR_MindResistance: | |
492 | 8598 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8599 goto LABEL_84; |
8600 case VAR_BodyResistance: | |
492 | 8601 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8602 goto LABEL_84; |
8603 case VAR_LightResistance: | |
492 | 8604 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8605 goto LABEL_84; |
8606 case VAR_DarkResistance: | |
492 | 8607 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8608 goto LABEL_84; |
8609 case VAR_MagicResistance: | |
492 | 8610 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8611 LABEL_84: |
8612 v28 = 0; | |
8613 v26 = 92; | |
8614 goto LABEL_112; | |
8615 default: | |
8616 return; | |
8617 } | |
8618 return; | |
8619 } | |
8620 HIWORD(v15) = 0; | |
492 | 8621 if ( var_type > VAR_DisarmTrapSkill ) |
8622 { | |
8623 if ( var_type != VAR_LearningSkill ) | |
8624 { | |
8625 if ( var_type <= VAR_LearningSkill ) | |
0 | 8626 return; |
492 | 8627 if ( var_type <= VAR_Eradicated ) |
8628 { | |
8629 v4->SetCondition(var_type - 105, 1); | |
0 | 8630 } |
8631 else | |
8632 { | |
492 | 8633 if ( var_type != VAR_MajorCondition ) |
0 | 8634 { |
492 | 8635 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8636 byte_5E4C15[var_type] = var_value; | |
0 | 8637 return; |
8638 } | |
8639 memset(v4, 0, 0xA0u); | |
8640 } | |
8641 LABEL_124: | |
8642 v31 = 1; | |
8643 goto LABEL_169; | |
8644 } | |
8645 LABEL_106: | |
492 | 8646 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8647 v17 = *(char *)v16; |
492 | 8648 if ( var_value <= VAR_BodyResistanceBonus ) |
8649 { | |
8650 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8651 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8652 } | |
8653 else | |
8654 { | |
492 | 8655 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8656 } |
8657 *(short *)v16 = v18; | |
8658 goto LABEL_124; | |
8659 } | |
492 | 8660 if ( var_type == VAR_DisarmTrapSkill ) |
8661 if ( v30 != 1 ) | |
8662 { | |
8663 if ( v31 != 1 ) | |
8664 return; | |
8665 v5 = 0; | |
8666 goto LABEL_172; | |
8667 } | |
8668 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8669 goto LABEL_170; | |
8670 if ( var_type <= VAR_BodyResistanceBonus ) | |
8671 { | |
8672 switch ( var_type ) | |
0 | 8673 { |
8674 case VAR_BodyResistanceBonus: | |
492 | 8675 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8676 break; |
8677 case VAR_AirResistanceBonus: | |
492 | 8678 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8679 break; |
8680 case VAR_WaterResistanceBonus: | |
492 | 8681 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8682 break; |
8683 case VAR_EarthResistanceBonus: | |
492 | 8684 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8685 break; |
8686 case VAR_SpiritResistanceBonus: | |
492 | 8687 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8688 break; |
8689 default: | |
492 | 8690 if ( var_type != 62 ) |
0 | 8691 return; |
492 | 8692 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8693 break; |
8694 } | |
8695 goto LABEL_111; | |
8696 } | |
492 | 8697 if ( var_type == VAR_LightResistanceBonus ) |
8698 { | |
8699 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8700 goto LABEL_111; |
8701 } | |
492 | 8702 if ( var_type == VAR_DarkResistanceBonus ) |
8703 { | |
8704 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8705 goto LABEL_111; | |
8706 } | |
8707 if ( var_type == VAR_MagicResistanceBonus ) | |
8708 { | |
8709 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8710 goto LABEL_111; |
8711 } | |
492 | 8712 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8713 if ( v30 != 1 ) | |
8714 { | |
8715 if ( v31 != 1 ) | |
8716 return; | |
8717 v5 = 0; | |
8718 v25 = 8 * currPlayerId + 400; | |
862 | 8719 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8720 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8721 return; | |
8722 } | |
8723 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8724 goto LABEL_170; | |
0 | 8725 } |
8726 | |
8727 | |
8728 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8729 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8730 { |
8731 char v3; // bl@1 | |
8732 Player *v4; // esi@1 | |
8733 signed int uPlayerIdx; // edi@1 | |
8734 int v6; // eax@15 | |
8735 unsigned int v7; // esi@18 | |
8736 int *v8; // ebx@21 | |
8737 int v9; // eax@22 | |
8738 signed int v10; // eax@24 | |
8739 int v11; // eax@27 | |
8740 __int16 *v12; // esi@28 | |
8741 Player *v13; // ecx@34 | |
8742 Player *v14; // ecx@36 | |
8743 char *v15; // ecx@37 | |
8744 unsigned __int8 v16; // cf@38 | |
8745 Player *v17; // ecx@42 | |
8746 __int16 *v18; // esi@53 | |
8747 __int16 *v19; // esi@62 | |
8748 char *v20; // esi@107 | |
8749 __int16 v21; // dx@107 | |
8750 int v22; // ecx@107 | |
8751 Player *v23; // ecx@132 | |
8752 int v24; // eax@132 | |
8753 int v25; // eax@150 | |
8754 char v26; // zf@151 | |
8755 DDM_DLV_Header *v27; // eax@153 | |
8756 signed int v28; // eax@176 | |
8757 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8758 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8759 int v31; // [sp-4h] [bp-3Ch]@84 |
8760 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8761 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8762 char v34; // [sp+37h] [bp-1h]@1 | |
8763 | |
8764 auto Dst = this; | |
8765 v3 = 0; | |
8766 v34 = 0; | |
8767 v4 = Dst; | |
8768 uPlayerIdx = 0; | |
8769 if ( Dst == pPlayers[2] ) | |
8770 uPlayerIdx = 1; | |
310 | 8771 else if ( Dst == pPlayers[3] ) |
8772 uPlayerIdx = 2; | |
8773 else if ( Dst == pPlayers[4] ) | |
8774 uPlayerIdx = 3; | |
8775 | |
8776 if ( var_type <= VAR_AutoNotes ) | |
8777 { | |
8778 if ( var_type != VAR_AutoNotes ) | |
8779 { | |
8780 if ( var_type <= VAR_ActualMight ) | |
8781 { | |
8782 if ( var_type != VAR_ActualMight ) | |
0 | 8783 { |
310 | 8784 switch ( var_type ) |
0 | 8785 { |
8786 case VAR_RandomGold: | |
8787 if ( !val ) | |
8788 val = 1; | |
8789 v6 = rand(); | |
8790 party_finds_gold(v6 % val + 1, 1); | |
8791 GameUI_DrawFoodAndGold(); | |
8792 return; | |
8793 case VAR_RandomFood: | |
8794 if ( !val ) | |
8795 val = 1; | |
8796 v7 = rand() % val + 1; | |
8797 Party::GiveFood(v7); | |
8798 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8799 ShowStatusBarString(pTmpBuf, 2u); | |
8800 GameUI_DrawFoodAndGold(); | |
8801 goto _play_sound; | |
8802 case VAR_Sex: | |
8803 Dst->uSex = (PLAYER_SEX)val; | |
8804 goto _play_anim_and_exit; | |
8805 case VAR_Class: | |
135 | 8806 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8807 goto _play_anim_and_exit; |
8808 case VAR_CurrentHP: | |
8809 v8 = &Dst->sHealth; | |
8810 *v8 += val; | |
8811 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8812 goto _play_anim_and_exit; | |
8813 v9 = v4->GetMaxHealth(); | |
8814 goto LABEL_23; | |
8815 case VAR_MaxHP: | |
8816 v10 = Dst->GetMaxHealth(); | |
8817 v4->_health_related = 0; | |
8818 v4->uFullHealthBonus = 0; | |
8819 v4->sHealth = v10; | |
8820 return; | |
8821 case VAR_CurrentSP: | |
8822 v8 = &Dst->sMana; | |
8823 *v8 += val; | |
8824 if ( Dst->sMana > GetMaxMana() ) | |
8825 { | |
8826 v9 = v4->GetMaxMana(); | |
8827 LABEL_23: | |
8828 *v8 = v9; | |
8829 } | |
8830 goto _play_anim_and_exit; | |
8831 case VAR_MaxSP: | |
8832 v11 = GetMaxMana(); | |
8833 v4->_mana_related = 0; | |
8834 v4->uFullManaBonus = 0; | |
8835 v4->sMana = v11; | |
8836 return; | |
8837 case VAR_ACModifier: | |
8838 v12 = &Dst->sACModifier; | |
8839 goto LABEL_29; | |
8840 case VAR_BaseLevel: | |
8841 v12 = (__int16 *)&Dst->uLevel; | |
8842 goto LABEL_29; | |
8843 case VAR_LevelModifier: | |
8844 v12 = &Dst->sLevelModifier; | |
8845 LABEL_29: | |
8846 *v12 += val; | |
8847 if ( *v12 > 255 ) | |
8848 *v12 = 255; | |
8849 goto _play_anim_and_exit; | |
8850 case VAR_Age: | |
8851 Dst->sAgeModifier += val; | |
8852 return; | |
8853 case VAR_Award: | |
8854 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8855 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8856 | |
492 | 8857 && pAwards[val].pText ) |
0 | 8858 { |
8859 v14 = pPlayers[uPlayerIdx + 1]; | |
8860 v34 = 1; | |
8861 v3 = 1; | |
187 | 8862 v14->PlaySound(SPEECH_96, 0); |
0 | 8863 } |
735 | 8864 v15 = (char *)v4->_guilds_member_bits; |
0 | 8865 goto LABEL_44; |
8866 case VAR_Experience: | |
8867 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8868 LODWORD(Dst->uExperience) += val; | |
8869 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8870 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8871 Dst->uExperience = 4000000000i64; | |
8872 goto _play_anim_and_exit; | |
8873 case VAR_QBits_QuestsDone: | |
484 | 8874 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_quest_bits[((signed __int16)val - 1) >> 3]) |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8875 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8876 && pQuestTable[val-1] ) |
0 | 8877 { |
501 | 8878 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8879 bFlashQuestBook = 1; |
8880 v34 = 1; | |
8881 v3 = 1; | |
501 | 8882 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8883 } |
484 | 8884 v15 = (char *)pParty->_quest_bits; |
0 | 8885 LABEL_44: |
8886 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8887 goto LABEL_173; | |
8888 case VAR_PlayerItemInHands: | |
8889 item.Reset(); | |
8890 item.Reset(); | |
8891 item.uAttributes = 1; | |
8892 item.uItemID = val; | |
8893 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8894 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8895 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8896 { | |
8897 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8898 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8899 } | |
8900 pParty->SetHoldingItem(&item); | |
8901 return; | |
8902 case VAR_FixedGold: | |
8903 party_finds_gold(val, 1); | |
8904 return; | |
8905 case VAR_BaseMight: | |
8906 v18 = (__int16 *)&Dst->uMight; | |
8907 goto LABEL_82; | |
8908 case VAR_BaseIntellect: | |
8909 v18 = (__int16 *)&Dst->uIntelligence; | |
8910 goto LABEL_82; | |
8911 case VAR_BasePersonality: | |
8912 v18 = (__int16 *)&Dst->uWillpower; | |
8913 goto LABEL_82; | |
8914 case VAR_BaseEndurance: | |
8915 v18 = (__int16 *)&Dst->uEndurance; | |
8916 goto LABEL_82; | |
8917 case VAR_BaseSpeed: | |
8918 v18 = (__int16 *)&Dst->uSpeed; | |
8919 goto LABEL_82; | |
8920 case VAR_BaseAccuracy: | |
8921 v18 = (__int16 *)&Dst->uAccuracy; | |
8922 goto LABEL_82; | |
8923 case VAR_BaseLuck: | |
8924 v18 = (__int16 *)&Dst->uLuck; | |
8925 goto LABEL_82; | |
8926 case VAR_FixedFood: | |
8927 Party::GiveFood(val); | |
715 | 8928 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8929 ShowStatusBarString(pTmpBuf, 2u); |
8930 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8931 Party::SetFood(0xFFFFu); | |
8932 goto _play_sound; | |
8933 case VAR_MightBonus: | |
8934 goto LABEL_62; | |
8935 case VAR_IntellectBonus: | |
8936 goto LABEL_66; | |
8937 case VAR_PersonalityBonus: | |
8938 goto LABEL_67; | |
8939 case VAR_EnduranceBonus: | |
8940 goto LABEL_68; | |
8941 case VAR_SpeedBonus: | |
8942 goto LABEL_69; | |
8943 case VAR_AccuracyBonus: | |
8944 goto LABEL_70; | |
8945 case VAR_LuckBonus: | |
8946 goto LABEL_71; | |
8947 default: | |
8948 return; | |
8949 } | |
8950 return; | |
8951 } | |
8952 LABEL_62: | |
8953 v19 = (__int16 *)&Dst->uMightBonus; | |
8954 goto LABEL_113; | |
8955 } | |
310 | 8956 if ( var_type <= VAR_FireResistanceBonus ) |
8957 { | |
8958 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8959 { |
310 | 8960 switch ( var_type ) |
0 | 8961 { |
8962 case VAR_ActualIntellect: | |
8963 LABEL_66: | |
8964 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8965 goto LABEL_113; | |
8966 case VAR_ActualPersonality: | |
8967 LABEL_67: | |
8968 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8969 goto LABEL_113; | |
8970 case VAR_ActualEndurance: | |
8971 LABEL_68: | |
8972 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8973 goto LABEL_113; | |
8974 case VAR_ActualSpeed: | |
8975 LABEL_69: | |
8976 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8977 goto LABEL_113; | |
8978 case VAR_ActualAccuracy: | |
8979 LABEL_70: | |
8980 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8981 goto LABEL_113; | |
8982 case VAR_ActualLuck: | |
8983 LABEL_71: | |
8984 v19 = (__int16 *)&Dst->uLuckBonus; | |
8985 goto LABEL_113; | |
8986 case VAR_FireResistance: | |
8987 v18 = &Dst->sResFireBase; | |
8988 goto LABEL_82; | |
8989 case VAR_AirResistance: | |
8990 v18 = &Dst->sResAirBase; | |
8991 goto LABEL_82; | |
8992 case VAR_WaterResistance: | |
8993 v18 = &Dst->sResWaterBase; | |
8994 goto LABEL_82; | |
8995 case VAR_EarthResistance: | |
8996 v18 = &Dst->sResEarthBase; | |
8997 goto LABEL_82; | |
8998 case VAR_SpiritResistance: | |
8999 v18 = &Dst->sResSpiritBase; | |
9000 goto LABEL_82; | |
9001 case VAR_MindResistance: | |
9002 v18 = &Dst->sResMindBase; | |
9003 goto LABEL_82; | |
9004 case VAR_BodyResistance: | |
9005 v18 = &Dst->sResBodyBase; | |
9006 goto LABEL_82; | |
9007 case VAR_LightResistance: | |
9008 v18 = &Dst->sResLightBase; | |
9009 goto LABEL_82; | |
9010 case VAR_DarkResistance: | |
9011 v18 = &Dst->sResDarkBase; | |
9012 goto LABEL_82; | |
9013 case VAR_MagicResistance: | |
9014 v18 = &Dst->sResMagicBase; | |
9015 LABEL_82: | |
9016 *v18 += val; | |
9017 if ( *v18 > 255 ) | |
9018 *v18 = 255; | |
9019 v31 = 0; | |
9020 v29 = 92; | |
9021 goto LABEL_116; | |
9022 default: | |
9023 return; | |
9024 } | |
9025 return; | |
9026 } | |
9027 v19 = &Dst->sResFireBonus; | |
9028 LABEL_113: | |
9029 *v19 += val; | |
9030 if ( *v19 > 255 ) | |
9031 *v19 = 255; | |
9032 v31 = 0; | |
187 | 9033 v29 = SPEECH_91; |
0 | 9034 LABEL_116: |
9035 v3 = 1; | |
187 | 9036 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9037 goto _play_anim_and_maybe_sound; |
9038 } | |
310 | 9039 if ( var_type <= VAR_DisarmTrapSkill ) |
9040 { | |
9041 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9042 { |
310 | 9043 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9044 { |
310 | 9045 switch ( var_type ) |
0 | 9046 { |
9047 case VAR_BodyResistanceBonus: | |
9048 v19 = &Dst->sResBodyBonus; | |
9049 break; | |
9050 case VAR_AirResistanceBonus: | |
9051 v19 = &Dst->sResAirBonus; | |
9052 break; | |
9053 case VAR_WaterResistanceBonus: | |
9054 v19 = &Dst->sResWaterBonus; | |
9055 break; | |
9056 case VAR_EarthResistanceBonus: | |
9057 v19 = &Dst->sResEarthBonus; | |
9058 break; | |
9059 case VAR_SpiritResistanceBonus: | |
9060 v19 = &Dst->sResSpiritBonus; | |
9061 break; | |
9062 default: | |
310 | 9063 if ( var_type != 62 ) |
0 | 9064 return; |
9065 v19 = &Dst->sResMindBonus; | |
9066 break; | |
9067 } | |
9068 goto LABEL_113; | |
9069 } | |
310 | 9070 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9071 { |
9072 v19 = &Dst->sResLightBonus; | |
9073 goto LABEL_113; | |
9074 } | |
310 | 9075 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9076 { |
9077 v19 = &Dst->sResDarkBonus; | |
9078 goto LABEL_113; | |
9079 } | |
310 | 9080 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9081 { |
9082 v19 = &Dst->sResMagicBonus; | |
9083 goto LABEL_113; | |
9084 } | |
310 | 9085 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9086 return; |
9087 } | |
9088 goto LABEL_106; | |
9089 } | |
310 | 9090 if ( var_type == VAR_LearningSkill ) |
0 | 9091 { |
9092 LABEL_106: | |
9093 if ( val <= VAR_BodyResistanceBonus ) | |
9094 { | |
310 | 9095 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9096 } |
9097 else | |
9098 { | |
310 | 9099 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9100 v21 = *(short *)v20; |
9101 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9102 if ( v22 > 60 ) | |
9103 LOWORD(v22) = 60; | |
9104 LOBYTE(v21) = v21 & 0xC0; | |
9105 *(short *)v20 = v22 | v21; | |
9106 } | |
9107 goto _play_anim_and_exit; | |
9108 } | |
310 | 9109 if ( var_type <= VAR_LearningSkill ) |
0 | 9110 return; |
310 | 9111 if ( var_type <= VAR_Eradicated ) |
9112 { | |
9113 Dst->SetCondition(var_type - 105, 0); | |
0 | 9114 } |
9115 else | |
9116 { | |
310 | 9117 if ( var_type != VAR_MajorCondition ) |
0 | 9118 { |
310 | 9119 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9120 { |
310 | 9121 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9122 byte_5E4C15[var_type] += val; | |
0 | 9123 else |
310 | 9124 byte_5E4C15[var_type] = -1; |
0 | 9125 } |
9126 return; | |
9127 } | |
9128 memset(Dst, 0, 0xA0u); | |
9129 } | |
9130 _play_anim_and_exit: | |
9131 v3 = 1; | |
9132 _play_anim_and_maybe_sound: | |
9133 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9134 _maybe_play_sound: | |
9135 if ( v3 != 1 ) | |
9136 return; | |
9137 goto _play_sound; | |
9138 } | |
9139 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3]) | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9140 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9141 && pAutonoteTxt[val-1].pText ) |
0 | 9142 { |
9143 v23 = pPlayers[uPlayerIdx + 1]; | |
9144 v34 = 1; | |
187 | 9145 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9146 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9147 bFlashAutonotesBook = 1; |
981 | 9148 _506568_autonote_type = v24; |
0 | 9149 } |
9150 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9151 v3 = 1; | |
9152 LABEL_173: | |
9153 if ( v34 != 1 ) | |
9154 goto _maybe_play_sound; | |
9155 goto _play_anim_and_maybe_sound; | |
9156 } | |
310 | 9157 if ( var_type > VAR_GoldInBank ) |
9158 { | |
9159 if ( var_type == 307 ) | |
0 | 9160 { |
9161 pParty->uNumDeaths += val; | |
9162 goto LABEL_173; | |
9163 } | |
310 | 9164 switch ( var_type ) |
0 | 9165 { |
9166 case 308: | |
9167 pParty->uNumBountiesCollected += val; | |
9168 break; | |
9169 case 309: | |
9170 pParty->uNumPrisonTerms += val; | |
9171 break; | |
9172 case 310: | |
9173 pParty->uNumArenaPageWins += val; | |
9174 break; | |
9175 case 311: | |
9176 pParty->uNumArenaSquireWins += val; | |
9177 break; | |
9178 case 312: | |
9179 pParty->uNumArenaKnightWins += val; | |
9180 break; | |
9181 case 313: | |
9182 pParty->uNumArenaLordWins += val; | |
9183 break; | |
9184 } | |
9185 } | |
9186 else | |
9187 { | |
310 | 9188 if ( var_type == VAR_GoldInBank ) |
0 | 9189 { |
9190 pParty->uNumGoldInBank += val; | |
9191 return; | |
9192 } | |
310 | 9193 if ( var_type <= VAR_Counter8 ) |
9194 { | |
9195 if ( (signed int)var_type >= 245 ) | |
9196 { | |
9197 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9198 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9199 } |
9200 else | |
9201 { | |
310 | 9202 switch ( var_type ) |
0 | 9203 { |
9204 case VAR_MonthEquals|VAR_CurrentSP: | |
9205 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9206 break; | |
9207 case VAR_NPCs2: | |
9208 pParty->field_709 = 0; | |
9209 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9210 Party__CountHirelings(); |
0 | 9211 viewparams->bRedrawGameUI = 1; |
9212 break; | |
9213 case VAR_NumSkillPoints: | |
9214 Dst->uSkillPoints += val; | |
9215 break; | |
9216 } | |
9217 } | |
9218 return; | |
9219 } | |
310 | 9220 if ( var_type < VAR_Counter9 ) |
0 | 9221 return; |
310 | 9222 if ( (signed int)var_type <= 274 ) |
9223 { | |
9224 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9225 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9226 goto _play_sound; |
9227 } | |
310 | 9228 if ( var_type != VAR_ReputationInCurrentLocation ) |
9229 { | |
9230 if ( var_type <= VAR_ReputationInCurrentLocation | |
9231 || var_type > VAR_History_28 | |
9232 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9233 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9234 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9235 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9236 v26) ) |
9237 return; | |
9238 bFlashHistoryBook = 1; | |
9239 _play_sound: | |
9240 v28 = 8 * uPlayerIdx + 400; | |
862 | 9241 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9242 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9243 return; | |
9244 } | |
9245 v27 = &pOutdoor->ddm; | |
9246 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9247 v27 = &pIndoor->dlv; | |
9248 v27->uReputation += val; | |
9249 if ( v27->uReputation > 10000 ) | |
9250 v27->uReputation = 10000; | |
9251 } | |
9252 } | |
9253 // 506568: using guessed type int dword_506568; | |
9254 // 507948: using guessed type char bFlashHistoryBook; | |
9255 // 507949: using guessed type char bFlashAutonotesBook; | |
9256 // 50794A: using guessed type char bFlashQuestBook; | |
9257 // 72371C: using guessed type int dword_72371C[]; | |
9258 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9259 | |
9260 | |
9261 | |
9262 | |
9263 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9264 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9265 { |
9266 unsigned int v3; // ebx@1 | |
9267 signed int v4; // esi@1 | |
501 | 9268 bool result; // eax@8 |
0 | 9269 int v6; // esi@11 |
9270 int v7; // edi@14 | |
9271 signed int v8; // eax@17 | |
9272 char *v9; // eax@20 | |
9273 char v10; // sf@20 | |
9274 char *v11; // ecx@26 | |
9275 char *v12; // ecx@27 | |
9276 __int64 v13; // qax@27 | |
9277 unsigned __int8 v14; // cf@27 | |
501 | 9278 int *v15; // edx@29 |
0 | 9279 char *v16; // eax@90 |
9280 char *v17; // ecx@94 | |
501 | 9281 int v18; // esi@97 |
0 | 9282 signed int v19; // edx@97 |
9283 char *v20; // ecx@98 | |
9284 int v21; // eax@100 | |
9285 __int16 v22; // dx@112 | |
9286 int v23; // [sp-8h] [bp-14h]@45 | |
9287 signed int v24; // [sp-4h] [bp-10h]@4 | |
9288 int v25; // [sp-4h] [bp-10h]@45 | |
9289 | |
9290 v3 = 0; | |
605 | 9291 v4 = uActiveCharacter - 1; |
501 | 9292 result = false; |
9293 if ( (signed int)VarNum > 222 ) | |
9294 { | |
9295 if ( (signed int)VarNum <= 307 ) | |
9296 { | |
9297 if ( VarNum == 307 ) | |
9298 { | |
9299 pParty->uNumDeaths -= (unsigned int)pValue; | |
9300 return pValue; | |
9301 } | |
9302 if ( VarNum == 223 ) | |
0 | 9303 { |
9304 v11 = (char *)pParty->_autonote_bits; | |
501 | 9305 v22 = (short)pValue - 1; |
0 | 9306 } |
9307 else | |
9308 { | |
501 | 9309 if ( VarNum != 231 ) |
0 | 9310 { |
501 | 9311 switch ( VarNum ) |
0 | 9312 { |
9313 case 232: | |
501 | 9314 VarNum = (VariableType)0; |
602 | 9315 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9316 result = (bool) pValue; |
9317 dword_5B65CC = 0; | |
9318 if ( (int)VarNum == pValue ) | |
0 | 9319 { |
501 | 9320 dword_5B65CC = (int)pValue; |
0 | 9321 } |
9322 else | |
9323 { | |
9324 pParty->field_709 = 0; | |
501 | 9325 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9326 Party__CountHirelings(); |
0 | 9327 viewparams->bRedrawGameUI = 1; |
9328 } | |
9329 break; | |
9330 case 241: | |
9331 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9332 { | |
9333 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9334 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9335 { |
605 | 9336 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9337 { |
9338 v21 = *(int *)v20; | |
9339 if ( (char)*(int *)v20 < 0 ) | |
9340 { | |
9341 LOBYTE(v21) = v21 & 0x7F; | |
9342 *(int *)v20 = v21; | |
9343 } | |
9344 } | |
9345 v20 += 76; | |
9346 } | |
9347 } | |
605 | 9348 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9349 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9350 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9351 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9352 pParty->field_709 = 0; | |
659 | 9353 Party__CountHirelings(); |
0 | 9354 break; |
9355 case 243: | |
9356 v17 = (char *)&this->uSkillPoints; | |
501 | 9357 result = *v17; |
9358 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9359 { | |
9360 *(int *)v17 -= (int)pValue; | |
9361 result = v17; | |
9362 } | |
0 | 9363 else |
9364 *(int *)v17 = 0; | |
9365 break; | |
9366 case 275: | |
9367 v16 = (char *)&pOutdoor->ddm; | |
9368 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9369 v16 = (char *)&pIndoor->dlv; | |
501 | 9370 *((int *)v16 + 2) -= (int)pValue; |
0 | 9371 if ( *((int *)v16 + 2) < -10000 ) |
9372 *((int *)v16 + 2) = -10000; | |
9373 break; | |
9374 case 306: | |
501 | 9375 result = VarNum - 306; |
9376 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9377 { | |
9378 result = (bool)pValue; | |
9379 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9380 } |
0 | 9381 else |
9382 LABEL_88: | |
9383 dword_5B65C4 = 1; | |
9384 break; | |
9385 } | |
501 | 9386 return result; |
0 | 9387 } |
9388 v11 = this->field_1A50; | |
501 | 9389 v22 = (signed __int16)pValue; |
0 | 9390 } |
9391 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9392 return result; |
9393 } | |
9394 switch ( VarNum ) | |
0 | 9395 { |
9396 case 308: | |
501 | 9397 result = (bool)pValue; |
9398 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9399 break; |
9400 case 309: | |
501 | 9401 result = (bool)pValue; |
9402 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9403 break; |
9404 case 310: | |
501 | 9405 result = (bool)pValue; |
9406 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9407 break; |
9408 case 311: | |
501 | 9409 result = (bool)pValue; |
9410 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9411 break; |
9412 case 312: | |
501 | 9413 result = (bool)pValue; |
9414 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9415 break; |
9416 case 313: | |
501 | 9417 result = (bool)pValue; |
9418 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9419 break; |
9420 } | |
9421 } | |
9422 else | |
9423 { | |
501 | 9424 if ( (signed int)VarNum >= 123 ) |
9425 { | |
9426 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9427 } |
9428 else | |
9429 { | |
501 | 9430 switch ( VarNum ) |
0 | 9431 { |
9432 case VAR_RandomGold: | |
501 | 9433 v6 = rand() % (signed int)pValue + 1; |
0 | 9434 if ( v6 > pParty->uNumGold ) |
9435 v6 = pParty->uNumGold; | |
9436 Party::TakeGold(v6); | |
9437 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9438 ShowStatusBarString(pTmpBuf, 2); |
0 | 9439 GameUI_DrawFoodAndGold(); |
501 | 9440 return result; |
0 | 9441 case VAR_RandomFood: |
501 | 9442 v7 = rand() % (signed int)pValue + 1; |
0 | 9443 if ( v7 > pParty->uNumFoodRations ) |
9444 v7 = pParty->uNumFoodRations; | |
9445 Party::TakeFood(v7); | |
9446 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9447 ShowStatusBarString(pTmpBuf, 2u); | |
9448 GameUI_DrawFoodAndGold(); | |
605 | 9449 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9450 v8 = 8 * v4 + 400; | |
862 | 9451 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9452 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9453 return result; |
0 | 9454 case VAR_CurrentHP: |
501 | 9455 ReceiveDamage((signed int)pValue, 4); |
605 | 9456 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9457 v8 = 8 * v4 + 400; | |
862 | 9458 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9459 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9460 return result; | |
0 | 9461 case VAR_CurrentSP: |
9462 v9 = (char *)&this->sMana; | |
501 | 9463 v10 = this->sMana - (signed int)pValue < 0; |
9464 *(int *)v9 -= (int)pValue; | |
0 | 9465 if ( v10 ) |
9466 *(int *)v9 = 0; | |
605 | 9467 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9468 v8 = 8 * v4 + 400; | |
862 | 9469 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9470 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9471 return result; | |
0 | 9472 case VAR_ACModifier: |
501 | 9473 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9474 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9475 v8 = 8 * v4 + 400; | |
862 | 9476 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9477 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9478 return result; | |
0 | 9479 case VAR_BaseLevel: |
501 | 9480 this->uLevel -= (unsigned __int8)pValue; |
605 | 9481 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9482 v8 = 8 * v4 + 400; | |
862 | 9483 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9484 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9485 return result; | |
0 | 9486 case VAR_LevelModifier: |
501 | 9487 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9488 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9489 v8 = 8 * v4 + 400; | |
862 | 9490 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9491 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9492 return result; | |
0 | 9493 case VAR_Age: |
501 | 9494 this->sAgeModifier -= (signed __int16)pValue; |
9495 return result; | |
0 | 9496 case VAR_Award: |
605 | 9497 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9498 return result; | |
0 | 9499 case VAR_Experience: |
9500 v12 = (char *)&this->uExperience; | |
501 | 9501 v13 = (signed int)pValue; |
9502 v14 = *(int *)v12 < (unsigned int)pValue; | |
9503 *(int *)v12 -= (int)pValue; | |
0 | 9504 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9505 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9506 v8 = 8 * v4 + 400; | |
862 | 9507 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9508 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9509 return result; | |
0 | 9510 case VAR_QBits_QuestsDone: |
501 | 9511 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9512 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9513 return true; |
0 | 9514 case VAR_PlayerItemInHands: |
501 | 9515 v15 = this->pInventoryIndices; |
0 | 9516 break; |
9517 case VAR_FixedGold: | |
501 | 9518 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9519 goto LABEL_88; |
501 | 9520 Party::TakeGold((unsigned int)pValue); |
9521 return result; | |
0 | 9522 case VAR_MightBonus: |
9523 case VAR_ActualMight: | |
501 | 9524 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9525 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9526 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9527 v8 = 8 * v4 + 400; | |
862 | 9528 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9529 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9530 return result; | |
0 | 9531 case VAR_IntellectBonus: |
9532 case VAR_ActualIntellect: | |
501 | 9533 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9534 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9535 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9536 v8 = 8 * v4 + 400; | |
862 | 9537 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9538 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9539 return result; | |
0 | 9540 case VAR_PersonalityBonus: |
9541 case VAR_ActualPersonality: | |
501 | 9542 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9543 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9544 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9545 v8 = 8 * v4 + 400; | |
862 | 9546 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9547 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9548 return result; | |
0 | 9549 case VAR_EnduranceBonus: |
9550 case VAR_ActualEndurance: | |
501 | 9551 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9552 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9553 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9554 v8 = 8 * v4 + 400; | |
862 | 9555 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9556 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9557 return result; | |
0 | 9558 case VAR_SpeedBonus: |
9559 case VAR_ActualSpeed: | |
501 | 9560 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9561 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9562 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9563 v8 = 8 * v4 + 400; | |
862 | 9564 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9565 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9566 return result; | |
0 | 9567 case VAR_AccuracyBonus: |
9568 case VAR_ActualAccuracy: | |
501 | 9569 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9570 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9571 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9572 v8 = 8 * v4 + 400; | |
862 | 9573 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9574 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9575 return result; | |
0 | 9576 case VAR_LuckBonus: |
9577 case VAR_ActualLuck: | |
501 | 9578 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9579 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9580 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9581 v8 = 8 * v4 + 400; | |
862 | 9582 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9583 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9584 return result; | |
0 | 9585 case VAR_BaseMight: |
501 | 9586 this->uMight -= (unsigned __int16)pValue; |
605 | 9587 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9588 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9589 v8 = 8 * v4 + 400; | |
862 | 9590 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9591 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9592 return result; | |
0 | 9593 case VAR_BaseIntellect: |
501 | 9594 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9595 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9596 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9597 v8 = 8 * v4 + 400; | |
862 | 9598 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9599 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9600 return result; | |
0 | 9601 case VAR_BasePersonality: |
501 | 9602 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9603 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9604 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9605 v8 = 8 * v4 + 400; | |
862 | 9606 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9607 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9608 return result; | |
0 | 9609 case VAR_BaseEndurance: |
501 | 9610 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9611 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9612 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9613 v8 = 8 * v4 + 400; | |
862 | 9614 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9615 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9616 return result; | |
0 | 9617 case VAR_BaseSpeed: |
501 | 9618 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9619 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9620 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9621 v8 = 8 * v4 + 400; | |
862 | 9622 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9623 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9624 return result; | |
0 | 9625 case VAR_BaseAccuracy: |
501 | 9626 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9627 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9628 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9629 v8 = 8 * v4 + 400; | |
862 | 9630 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9631 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9632 return result; | |
0 | 9633 case VAR_BaseLuck: |
501 | 9634 this->uLuck -= (unsigned __int16)pValue; |
605 | 9635 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9636 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9637 v8 = 8 * v4 + 400; | |
862 | 9638 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9639 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9640 return result; | |
0 | 9641 case VAR_FireResistance: |
501 | 9642 this->sResFireBase -= (signed __int16)pValue; |
605 | 9643 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9644 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9645 v8 = 8 * v4 + 400; | |
862 | 9646 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9647 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9648 return result; | |
0 | 9649 case VAR_AirResistance: |
501 | 9650 this->sResAirBase -= (signed __int16)pValue; |
605 | 9651 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9652 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9653 v8 = 8 * v4 + 400; | |
862 | 9654 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9655 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9656 return result; | |
0 | 9657 case VAR_WaterResistance: |
501 | 9658 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9659 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9660 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9661 v8 = 8 * v4 + 400; | |
862 | 9662 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9663 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9664 return result; | |
0 | 9665 case VAR_EarthResistance: |
501 | 9666 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9667 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9668 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9669 v8 = 8 * v4 + 400; | |
862 | 9670 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9671 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9672 return result; | |
0 | 9673 case VAR_SpiritResistance: |
501 | 9674 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9675 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9676 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9677 v8 = 8 * v4 + 400; | |
862 | 9678 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9679 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9680 return result; | |
0 | 9681 case VAR_MindResistance: |
501 | 9682 this->sResMindBase -= (signed __int16)pValue; |
605 | 9683 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9684 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9685 v8 = 8 * v4 + 400; | |
862 | 9686 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9687 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9688 return result; | |
0 | 9689 case VAR_BodyResistance: |
501 | 9690 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9691 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9692 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9693 v8 = 8 * v4 + 400; | |
862 | 9694 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9695 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9696 return result; | |
0 | 9697 case VAR_LightResistance: |
501 | 9698 this->sResLightBase -= (signed __int16)pValue; |
605 | 9699 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9700 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9701 v8 = 8 * v4 + 400; | |
862 | 9702 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9703 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9704 return result; | |
0 | 9705 case VAR_DarkResistance: |
501 | 9706 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9707 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9708 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9709 v8 = 8 * v4 + 400; | |
862 | 9710 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9711 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9712 return result; | |
0 | 9713 case VAR_MagicResistance: |
501 | 9714 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9715 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9716 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9717 v8 = 8 * v4 + 400; | |
862 | 9718 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9719 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9720 return result; | |
0 | 9721 case VAR_FireResistanceBonus: |
501 | 9722 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9723 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9724 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9725 v8 = 8 * v4 + 400; | |
862 | 9726 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9727 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9728 return result; | |
0 | 9729 case VAR_AirResistanceBonus: |
501 | 9730 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9731 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9732 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9733 v8 = 8 * v4 + 400; | |
862 | 9734 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9735 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9736 return result; | |
0 | 9737 case VAR_WaterResistanceBonus: |
501 | 9738 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9739 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9740 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9741 v8 = 8 * v4 + 400; | |
862 | 9742 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9743 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9744 return result; | |
0 | 9745 case VAR_EarthResistanceBonus: |
501 | 9746 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9747 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9748 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9749 v8 = 8 * v4 + 400; | |
862 | 9750 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9751 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9752 return result; | |
0 | 9753 case VAR_SpiritResistanceBonus: |
501 | 9754 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9755 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9756 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9757 v8 = 8 * v4 + 400; | |
862 | 9758 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9759 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9760 return result; | |
0 | 9761 case VAR_MindResistanceBonus: |
501 | 9762 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9763 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9764 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9765 v8 = 8 * v4 + 400; | |
862 | 9766 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9767 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9768 return result; | |
0 | 9769 case VAR_BodyResistanceBonus: |
501 | 9770 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9771 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9772 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9773 v8 = 8 * v4 + 400; | |
862 | 9774 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9775 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9776 return result; | |
0 | 9777 case VAR_LightResistanceBonus: |
501 | 9778 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9779 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9780 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9781 v8 = 8 * v4 + 400; | |
862 | 9782 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9783 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9784 return result; | |
0 | 9785 case VAR_DarkResistanceBonus: |
501 | 9786 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9787 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9788 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9789 v8 = 8 * v4 + 400; | |
862 | 9790 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9791 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9792 return result; | |
0 | 9793 case VAR_MagicResistanceBonus: |
501 | 9794 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9795 v25 = 0; |
187 | 9796 v23 = SPEECH_91; |
9797 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9798 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9799 v8 = 8 * v4 + 400; | |
862 | 9800 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9801 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9802 return result; | |
0 | 9803 case VAR_FixedFood: |
501 | 9804 Party::TakeFood((unsigned int)pValue); |
605 | 9805 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9806 v8 = 8 * v4 + 400; | |
862 | 9807 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9808 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9809 return result; | |
0 | 9810 case VAR_StaffSkill: |
9811 case VAR_SwordSkill: | |
9812 case VAR_DaggerSkill: | |
9813 case VAR_AxeSkill: | |
9814 case VAR_SpearSkill: | |
9815 case VAR_BowSkill: | |
9816 case VAR_MaceSkill: | |
9817 case VAR_BlasterSkill: | |
9818 case VAR_ShieldSkill: | |
9819 case VAR_LeatherSkill: | |
9820 case VAR_SkillChain: | |
9821 case VAR_PlateSkill: | |
9822 case VAR_FireSkill: | |
9823 case VAR_AirSkill: | |
9824 case VAR_WaterSkill: | |
9825 case VAR_EarthSkill: | |
9826 case VAR_SpiritSkill: | |
9827 case VAR_MindSkill: | |
9828 case VAR_BodySkill: | |
9829 case VAR_LightSkill: | |
9830 case VAR_DarkSkill: | |
9831 case VAR_IdentifyItemSkill: | |
9832 case VAR_MerchantSkill: | |
9833 case VAR_RepairSkill: | |
9834 case VAR_BodybuildingSkill: | |
9835 case VAR_MeditationSkill: | |
9836 case VAR_PerceptionSkill: | |
9837 case VAR_DiplomacySkill: | |
9838 case VAR_DisarmTrapSkill: | |
9839 case VAR_LearningSkill: | |
501 | 9840 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9841 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9842 v8 = 8 * v4 + 400; | |
862 | 9843 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9844 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9845 return result; | |
0 | 9846 case VAR_Cursed: |
9847 case VAR_Weak: | |
9848 case VAR_Asleep: | |
9849 case VAR_Afraid: | |
9850 case VAR_Drunk: | |
9851 case VAR_Insane: | |
9852 case VAR_PoisonedGreen: | |
9853 case VAR_DiseasedGreen: | |
9854 case VAR_PoisonedYellow: | |
9855 case VAR_DiseasedYellow: | |
9856 case VAR_PoisonedRed: | |
9857 case VAR_DiseasedRed: | |
9858 case VAR_Paralyzed: | |
9859 case VAR_Unconsious: | |
9860 case VAR_Dead: | |
9861 case VAR_Stoned: | |
9862 case VAR_Eradicated: | |
501 | 9863 *((int *)this + 2 * VarNum - 210) = 0; |
9864 *((int *)this + 2 * result - 209) = 0; | |
0 | 9865 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9866 v8 = 8 * v4 + 400; | |
862 | 9867 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9868 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9869 return result; |
605 | 9870 default: |
9871 return result; | |
9872 } | |
9873 for (v3 = 1; v3 < 126; v3++) | |
9874 { | |
9875 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9876 { |
605 | 9877 RemoveItemAtInventoryIndex(v3); |
501 | 9878 return true; |
0 | 9879 } |
605 | 9880 } |
501 | 9881 if ( pParty->pPickedItem.uItemID == pValue ) |
9882 { | |
605 | 9883 pMouse->RemoveHoldingItem(); |
9884 return true; | |
9885 } | |
9886 return false; | |
0 | 9887 } |
9888 } | |
9889 } | |
9890 // 5B65C4: using guessed type int dword_5B65C4; | |
9891 // 5B65CC: using guessed type int dword_5B65CC; |