Mercurial > mm7
annotate Player.cpp @ 821:5e3f4bf3b8e6
* UpdateActorAI clean
* VS 2010 fixes
author | zipi |
---|---|
date | Tue, 26 Mar 2013 15:21:03 +0000 |
parents | cfc65feef029 |
children | 0f56abdcce94 |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
0 | 3 #include "OSAPI.h" |
4 #include "Player.h" | |
5 #include "PlayerFrameTable.h" | |
6 #include "Texture.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Party.h" | |
9 #include "GUIButton.h" | |
816 | 10 #include "Log.h" |
0 | 11 #include "LOD.h" |
12 #include "Monsters.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" |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 /* 381 */ | |
35 #pragma pack(push, 1) | |
290 | 36 struct PlayerCreation_AttributeProps |
0 | 37 { |
38 unsigned __int8 uBaseValue; | |
39 char uMaxValue; | |
40 char uDroppedStep; | |
41 char uBaseStep; | |
42 }; | |
43 #pragma pack(pop) | |
44 | |
45 | |
46 #pragma pack(push, 1) | |
290 | 47 |
48 | |
49 | |
0 | 50 #pragma pack(pop) |
290 | 51 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
52 { | |
53 {{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},}, | |
54 {{ 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},}, | |
55 {{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},}, | |
56 {{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 | 57 }; |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 // available skills per class ( 9 classes X 37 skills ) | |
65 // 0 - not available | |
66 // 1 - available | |
67 // 2 - primary skill | |
68 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
69 { | |
70 {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}, | |
71 {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}, | |
72 {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}, | |
73 {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}, | |
74 {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}, | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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 | |
79 }; | |
80 | |
81 | |
82 | |
83 | |
84 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
85 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
86 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}; | |
87 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}; | |
88 | |
89 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
90 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
91 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
93 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
94 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
96 | |
97 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
98 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
99 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
101 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
102 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
104 | |
105 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
106 | |
107 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
108 | |
94 | 109 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 110 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 111 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 112 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 | 113 |
114 | |
115 | |
816 | 116 unsigned short base_recovery_times_per_weapon_type[12] = |
117 { | |
118 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
119 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
120 60, // PLAYER_SKILL_DAGGER | |
121 100, // PLAYER_SKILL_AXE | |
122 80, // PLAYER_SKILL_SPEAR | |
123 100, // PLAYER_SKILL_BOW | |
124 80, // PLAYER_SKILL_MACE | |
125 30, // PLAYER_SKILL_BLASTER | |
126 10, // PLAYER_SKILL_SHIELD | |
127 10, // PLAYER_SKILL_LEATHER | |
128 20, // PLAYER_SKILL_CHAIN | |
129 30 // PLAYER_SKILL_PLATE | |
130 }; | |
131 | |
132 | |
0 | 133 |
134 //----- (00490913) -------------------------------------------------------- | |
135 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
136 { | |
137 signed int v0; // edi@1 | |
138 signed int v1; // esi@1 | |
139 int v2; // ebx@2 | |
140 int v3; // ecx@17 | |
141 signed int v4; // eax@17 | |
142 int v5; // edx@18 | |
143 signed int v6; // ecx@18 | |
144 signed int v8; // [sp+Ch] [bp-8h]@1 | |
145 signed int v9; // [sp+10h] [bp-4h]@2 | |
146 | |
147 v8 = 50; | |
148 v0 = 50; | |
149 v1 = 0; | |
150 do | |
151 { | |
152 v9 = 0; | |
153 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
154 do | |
155 { | |
156 if ( v9 ) | |
157 { | |
158 switch ( v9 ) | |
159 { | |
160 case 1: | |
161 v0 = pParty->pPlayers[v1].uIntelligence; | |
162 break; | |
163 case 2: | |
164 v0 = pParty->pPlayers[v1].uWillpower; | |
165 break; | |
166 case 3: | |
167 v0 = pParty->pPlayers[v1].uEndurance; | |
168 break; | |
169 case 4: | |
170 v0 = pParty->pPlayers[v1].uAccuracy; | |
171 break; | |
172 case 5: | |
173 v0 = pParty->pPlayers[v1].uSpeed; | |
174 break; | |
175 case 6: | |
176 v0 = pParty->pPlayers[v1].uLuck; | |
177 break; | |
178 } | |
179 } | |
180 else | |
181 { | |
182 v0 = pParty->pPlayers[v1].uMight; | |
183 } | |
184 v3 = v2 + v9; | |
290 | 185 v4 = StatTable[0][v3].uBaseValue; |
0 | 186 if ( v0 >= v4 ) |
187 { | |
290 | 188 v5 = StatTable[0][v3].uDroppedStep; |
189 v6 = StatTable[0][v3].uBaseStep; | |
0 | 190 } |
191 else | |
192 { | |
290 | 193 v5 = StatTable[0][v3].uBaseStep; |
194 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 195 } |
196 v8 += v5 * (v4 - v0) / v6; | |
197 ++v9; | |
198 } | |
199 while ( v9 <= 6 ); | |
200 ++v1; | |
201 } | |
202 while ( v1 < 4 ); | |
203 return v8; | |
204 } | |
205 | |
206 | |
207 | |
208 //----- (00427730) -------------------------------------------------------- | |
209 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
210 { | |
488 | 211 if (sMana >= uRequiredMana) |
212 { | |
213 sMana -= uRequiredMana; | |
214 return true; | |
215 } | |
216 | |
217 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
218 return false; | |
0 | 219 } |
220 | |
221 | |
222 //----- (004BE2DD) -------------------------------------------------------- | |
223 void Player::_4BE2DD(unsigned int a2, int a3, int _2devent_idx) | |
224 { | |
225 Player *v4; // edi@1 | |
226 char *v5; // esi@1 | |
227 float v6; // ST04_4@1 | |
228 signed int v7; // eax@1 | |
229 signed int v8; // ebx@1 | |
230 | |
231 auto a4 = _2devent_idx; | |
232 v4 = this; | |
233 v5 = (char *)this + 36 * a3; | |
234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
235 //v6 = p2DEvents_minus1__20[13 * a4]; | |
236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
237 v8 = _4B8102(v7, v6); | |
238 if ( v5[552] & 2 ) | |
239 v8 = 1; | |
240 if ( v8 < 1 ) | |
241 v8 = 1; | |
242 RemoveItemAtInventoryIndex(a2); | |
243 Party::SetGold(pParty->uNumGold + v8); | |
244 } | |
245 | |
246 | |
247 | |
248 //----- (0043EEF3) -------------------------------------------------------- | |
249 bool Player::_43EEF3() | |
250 { | |
251 signed int v1; // esi@1 | |
252 PlayerEquipment *v2; // edx@1 | |
253 bool result; // eax@2 | |
254 | |
255 v1 = 0; | |
256 v2 = &this->pEquipment; | |
257 while ( 1 ) | |
258 { | |
259 result = v2->uOffHand; | |
260 if ( v2->uOffHand ) | |
261 { | |
232 | 262 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 263 if ( result ) |
264 { | |
265 if ( result != 64 && result != 65 ) | |
266 break; | |
267 } | |
268 } | |
269 ++v1; | |
270 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
271 if ( v1 >= 16 ) | |
272 { | |
273 LOBYTE(result) = 1; | |
274 return result; | |
275 } | |
276 } | |
277 LOBYTE(result) = 0; | |
278 return result; | |
279 } | |
280 | |
281 | |
282 | |
283 //----- (004B8040) -------------------------------------------------------- | |
284 int Player::_4B8040_condition_time(unsigned int uCondition) | |
285 { | |
286 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
287 } | |
288 | |
289 //----- (004B807C) -------------------------------------------------------- | |
290 int Player::_4B807C(float a2) | |
291 { | |
292 Player *v2; // edi@1 | |
293 unsigned int v3; // eax@1 | |
294 int v4; // esi@1 | |
295 unsigned int v5; // ebx@7 | |
296 int v6; // eax@8 | |
297 signed __int64 v7; // qax@13 | |
298 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
299 signed int v10; // [sp+8h] [bp-8h]@4 | |
300 int v11; // [sp+Ch] [bp-4h]@6 | |
301 | |
302 v2 = this; | |
303 v3 = GetMajorConditionIdx(); | |
304 v4 = 0; | |
305 if ( (signed int)v3 >= 14 ) | |
306 { | |
307 if ( (signed int)v3 <= 15 ) | |
308 { | |
309 v10 = 5; | |
310 v9 = v3; | |
311 goto LABEL_6; | |
312 } | |
313 if ( v3 == 16 ) | |
314 { | |
315 v10 = 10; | |
316 v9 = 16; | |
317 LABEL_6: | |
318 v11 = _4B8040_condition_time(v9); | |
319 goto LABEL_13; | |
320 } | |
321 } | |
322 v10 = 1; | |
323 v5 = 0; | |
324 do | |
325 { | |
326 v6 = _4B8040_condition_time(v5); | |
327 if ( v6 > v4 ) | |
328 v4 = v6; | |
329 ++v5; | |
330 } | |
331 while ( (signed int)v5 <= 13 ); | |
332 v11 = v4; | |
333 if ( !v4 ) | |
334 v11 = 1; | |
335 LABEL_13: | |
336 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
337 if ( (signed int)v7 < 1 ) | |
338 LODWORD(v7) = 1; | |
339 return v7; | |
340 } | |
341 | |
342 //----- (004B8102) -------------------------------------------------------- | |
343 int Player::_4B8102(int a2, float a3) | |
344 { | |
345 signed int v3; // esi@1 | |
346 signed int result; // eax@3 | |
347 | |
348 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; | |
349 if ( v3 > a2 ) | |
350 v3 = a2; | |
351 result = 1; | |
352 if ( v3 >= 1 ) | |
353 result = v3; | |
354 return result; | |
355 } | |
356 | |
357 //----- (004B8142) -------------------------------------------------------- | |
749 | 358 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
359 { | |
360 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
361 assert (price > 0); | |
362 | |
363 if (price < uRealValue) | |
364 price = uRealValue; | |
365 return price; | |
0 | 366 } |
367 | |
368 //----- (004B8179) -------------------------------------------------------- | |
369 int Player::_4B8179(float a2) | |
370 { | |
371 signed int v2; // esi@1 | |
372 int v3; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v2 = (signed __int64)(a2 * 50.0); | |
376 v3 = v2 * (100 - GetMerchant()) / 100; | |
377 if ( v3 < v2 / 3 ) | |
378 v3 = v2 / 3; | |
379 result = 1; | |
380 if ( v3 >= 1 ) | |
381 result = v3; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B81C3) -------------------------------------------------------- | |
386 int Player::_4B81C3(int a2, float a3) | |
387 { | |
388 signed int v3; // esi@1 | |
389 int v4; // ecx@1 | |
390 signed int result; // eax@3 | |
391 | |
392 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
393 v4 = v3 * (100 - GetMerchant()) / 100; | |
394 if ( v4 < v3 / 3 ) | |
395 v4 = v3 / 3; | |
396 result = 1; | |
397 if ( v4 >= 1 ) | |
398 result = v4; | |
399 return result; | |
400 } | |
401 | |
402 //----- (004B8213) -------------------------------------------------------- | |
403 int Player::_4B8213(int a2, float a3) | |
404 { | |
405 signed __int64 v3; // qax@1 | |
406 | |
407 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
408 if ( (signed int)v3 < 1 ) | |
409 LODWORD(v3) = 1; | |
410 return v3; | |
411 } | |
412 | |
413 //----- (004B8233) -------------------------------------------------------- | |
414 int Player::_4B8233(int a2, float a3) | |
415 { | |
416 signed __int64 v3; // qax@1 | |
417 | |
418 v3 = (signed __int64)((double)a2 * a3); | |
419 if ( (signed int)v3 < 1 ) | |
420 LODWORD(v3) = 1; | |
421 return v3; | |
422 } | |
423 | |
424 //----- (004B824B) -------------------------------------------------------- | |
425 int Player::_4B824B(float a2) | |
426 { | |
427 signed __int64 v2; // qax@1 | |
428 | |
429 v2 = (signed __int64)(a2 * 50.0); | |
430 if ( (signed int)v2 < 1 ) | |
431 LODWORD(v2) = 1; | |
432 return v2; | |
433 } | |
434 | |
435 //----- (004B8265) -------------------------------------------------------- | |
436 int Player::_4B8265(int a2, float a3) | |
437 { | |
438 signed __int64 v3; // qax@1 | |
439 | |
440 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
441 if ( (signed int)v3 < 1 ) | |
442 LODWORD(v3) = 1; | |
443 return v3; | |
444 } | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 //----- (004B6FF9) -------------------------------------------------------- | |
451 int Player::_4B6FF9() | |
452 { | |
453 Player *v1; // esi@1 | |
454 signed int v2; // eax@1 | |
455 char v3; // zf@4 | |
456 | |
457 v1 = this; | |
336 | 458 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 459 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
460 { | |
461 if ( GetMajorConditionIdx() == 18 ) | |
462 goto LABEL_6; | |
463 v3 = GetMajorConditionIdx() == 17; | |
464 } | |
465 else | |
466 { | |
467 v3 = GetMajorConditionIdx() == 18; | |
468 } | |
469 if ( !v3 ) | |
470 return 1; | |
471 LABEL_6: | |
472 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
473 return 1; | |
474 return 0; | |
475 } | |
476 | |
477 | |
478 | |
479 //----- (00421E75) -------------------------------------------------------- | |
480 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
481 { | |
482 int v2; // eax@1 | |
483 unsigned int result; // eax@3 | |
484 | |
485 v2 = *a2; | |
486 if ( *a2 >= 126 || v2 < 0 ) | |
487 { | |
488 result = 0; | |
489 } | |
490 else | |
491 { | |
492 result = this->pInventoryIndices[v2]; | |
493 if ( (result & 0x80000000u) != 0 ) | |
494 { | |
495 *a2 = -1 - result; | |
496 result = this->pInventoryIndices[-1 - result]; | |
497 } | |
498 } | |
499 return result; | |
500 } | |
501 | |
502 | |
503 | |
504 //----- (004160CA) -------------------------------------------------------- | |
505 char Player::_4160CA(int a2) | |
506 { | |
507 Player *v2; // esi@1 | |
508 signed int v3; // edx@1 | |
509 signed int v4; // ebx@1 | |
510 ItemGen *v5; // eax@1 | |
511 int v6; // edi@2 | |
512 signed int i; // edx@8 | |
513 ItemGen **v8; // ecx@9 | |
514 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
515 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
516 int v12; // [sp+120h] [bp-4h]@1 | |
517 | |
518 auto a1 = this; | |
519 | |
520 v12 = a2; | |
521 v2 = a1; | |
522 v3 = 0; | |
523 v10[0] = 0; | |
524 v4 = 0; | |
525 memset(&v10[1], 0, 0x110u); | |
526 v11 = 0; | |
527 v5 = a1->pInventoryItems; | |
528 do | |
529 { | |
530 v6 = 0; | |
531 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
532 v10[v4++] = v3; | |
533 ++v3; | |
534 ++v5; | |
535 } | |
536 while ( v3 < 138 ); | |
537 if ( v4 ) | |
538 { | |
539 if ( v12 ) | |
540 { | |
541 if ( v12 > 0 ) | |
542 { | |
543 do | |
544 { | |
545 LOWORD(v5) = 9 * v10[v6]; | |
546 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
547 { | |
548 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
549 v5->uItemID |= 2u; | |
550 } | |
551 ++v6; | |
552 } | |
553 while ( v6 < v12 ); | |
554 } | |
555 } | |
556 else | |
557 { | |
558 for ( i = 0; i < v4; ++i ) | |
559 { | |
560 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
561 v5 = *v8; | |
562 if ( !(BYTE1(v5) & 2) ) | |
563 { | |
564 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
565 *v8 = v5; | |
566 } | |
567 } | |
568 } | |
569 } | |
570 return (char)v5; | |
571 } | |
572 | |
573 //----- (004948B1) -------------------------------------------------------- | |
187 | 574 void Player::PlaySound(PlayerSpeech speech, int a3) |
575 { | |
576 //Player *pPlayer; // edi@1 | |
577 //int v4; // eax@4 | |
0 | 578 signed int v5; // esi@4 |
203 | 579 unsigned char *v6; // ebx@4 |
0 | 580 signed int v7; // ecx@5 |
581 unsigned __int8 v8; // al@6 | |
582 int v9; // eax@10 | |
187 | 583 //unsigned int pVoiceID; // ecx@10 |
0 | 584 int v11; // esi@10 |
585 signed int v12; // eax@11 | |
586 signed int v13; // esi@12 | |
587 int v14; // eax@12 | |
187 | 588 //int v15; // eax@17 |
248 | 589 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 590 signed int v17; // ecx@19 |
591 char *pSoundID; // edi@20 | |
592 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 593 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 594 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
595 int pSoundId; // [sp+30h] [bp+8h]@4 | |
596 | |
187 | 597 //pPlayer = this; |
598 //pPlayer2 = this; | |
599 | |
0 | 600 pPlayerNum = 1; |
187 | 601 for (int i = 0; i < 4; ++i) |
602 if (&pParty->pPlayers[i] == this) | |
603 { | |
604 pPlayerNum = i + 1; | |
0 | 605 break; |
187 | 606 } |
607 | |
608 //v4 = a2;//102 | |
0 | 609 v5 = 0; |
610 pSoundId = 0; | |
203 | 611 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
612 if (uVoicesVolumeMultiplier) | |
0 | 613 { |
614 v7 = 0; | |
615 do | |
616 { | |
617 v8 = v6[v7]; | |
618 if ( v8 ) | |
619 v20[v5++] = v8; | |
620 ++v7; | |
621 } | |
622 while ( v7 < 2 ); | |
623 if ( v5 ) | |
624 { | |
625 v9 = rand(); | |
187 | 626 //pVoiceID = uVoiceID; |
0 | 627 v11 = v20[v9 % v5]; |
203 | 628 |
629 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
630 { | |
631 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
632 v12 = (8 * pPlayerNum + 312) | OBJECT_Player; | |
328 | 633 pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 634 } |
635 } | |
636 } | |
203 | 637 |
0 | 638 v13 = 0; |
639 v14 = (int)(v6 + 3); | |
640 do | |
641 { | |
642 if ( *(char *)v14 ) | |
643 v20[v13++] = *(char *)v14; | |
644 ++v14; | |
645 } | |
646 while ( -3 - (signed int)v6 + v14 < 5 ); | |
647 if ( v13 ) | |
648 { | |
649 pPlayerNum = 0; | |
248 | 650 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
651 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 652 { |
653 v17 = 0; | |
764 | 654 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 655 { |
656 LABEL_23: | |
657 v17 = 0; | |
658 } | |
659 else | |
660 { | |
661 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
662 while ( *(int *)pSoundID != pSoundId ) | |
663 { | |
664 ++v17; | |
665 pSoundID += 120; | |
764 | 666 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 667 goto LABEL_23; |
668 } | |
669 } | |
670 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
671 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
672 } | |
248 | 673 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 674 } |
675 //return v14; | |
0 | 676 } |
677 // 4948B1: using guessed type int var_1C[5]; | |
678 | |
679 //----- (00494A25) -------------------------------------------------------- | |
187 | 680 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
681 { | |
682 //signed int v3; // eax@1 | |
683 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 684 signed int v5; // edi@15 |
685 PlayerFrame *v6; // esi@17 | |
686 signed int v7; // eax@20 | |
687 | |
187 | 688 //LOWORD(v3) = this->expression; |
689 //v4 = expr; | |
690 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
691 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
692 { | |
693 int v3 = (unsigned)expression; | |
0 | 694 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
695 { | |
696 if ( v3 <= 7 ) | |
697 goto LABEL_12; | |
698 if ( v3 > 8 ) | |
699 { | |
700 if ( v3 > 11 ) | |
701 { | |
187 | 702 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
703 return; | |
0 | 704 goto LABEL_15; |
705 } | |
706 LABEL_12: | |
187 | 707 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
708 return; | |
0 | 709 goto LABEL_15; |
710 } | |
711 } | |
712 } | |
713 LABEL_15: | |
187 | 714 //LOWORD(v3) = a3; |
0 | 715 v5 = 0; |
716 this->uExpressionTimeLength = a3; | |
717 this->uExpressionTimePassed = 0; | |
718 if ( !a3 ) | |
719 { | |
720 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
721 { | |
722 LABEL_20: | |
723 v7 = 0; | |
724 } | |
725 else | |
726 { | |
727 v6 = pPlayerFrameTable->pFrames; | |
187 | 728 while ( v6->expression != new_expression ) |
0 | 729 { |
730 ++v5; | |
731 ++v6; | |
732 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
733 goto LABEL_20; | |
734 } | |
735 v7 = v5; | |
736 } | |
187 | 737 //v4 = expr; |
738 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
739 } | |
740 expression = new_expression; | |
0 | 741 viewparams->bRedrawGameUI = 1; |
742 } | |
743 | |
744 //----- (0049327B) -------------------------------------------------------- | |
745 int Player::_49327B(unsigned int uClass, int a3) | |
746 { | |
747 Player *v3; // esi@1 | |
748 char v4; // zf@4 | |
749 __int16 v5; // dx@9 | |
750 signed int result; // eax@84 | |
751 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
752 int v8; // [sp-4h] [bp-Ch]@3 | |
753 | |
754 v3 = this; | |
135 | 755 if ( this->classType == uClass ) |
0 | 756 { |
757 LABEL_84: | |
758 result = 1; | |
759 } | |
760 else | |
761 { | |
762 switch ( uClass ) | |
763 { | |
764 case 0u: | |
765 v8 = a3; | |
766 v7 = 1; | |
767 goto LABEL_4; | |
768 case 1u: | |
484 | 769 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 770 || _49327B(2u, a3) ) |
771 goto LABEL_84; | |
772 v8 = a3; | |
773 v7 = 3; | |
774 goto LABEL_4; | |
775 case 2u: | |
776 v5 = 19; | |
777 goto LABEL_82; | |
778 case 3u: | |
779 v5 = 21; | |
780 goto LABEL_82; | |
781 case 4u: | |
782 v8 = a3; | |
783 v7 = 5; | |
784 goto LABEL_4; | |
785 case 5u: | |
484 | 786 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 787 || _49327B(6u, a3) ) |
788 goto LABEL_84; | |
789 v8 = a3; | |
790 v7 = 7; | |
791 goto LABEL_4; | |
792 case 6u: | |
793 if ( !a3 ) | |
794 break; | |
795 v5 = 13; | |
796 goto LABEL_82; | |
797 case 7u: | |
798 if ( !a3 ) | |
799 break; | |
800 v5 = 15; | |
801 goto LABEL_82; | |
802 case 8u: | |
803 v8 = a3; | |
804 v7 = 9; | |
805 goto LABEL_4; | |
806 case 9u: | |
484 | 807 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 808 || _49327B(0xAu, a3) ) |
809 goto LABEL_84; | |
810 v8 = a3; | |
811 v7 = 11; | |
812 goto LABEL_4; | |
813 case 0xAu: | |
814 if ( !a3 ) | |
815 break; | |
816 v5 = 25; | |
817 goto LABEL_82; | |
818 case 0xBu: | |
819 if ( !a3 ) | |
820 break; | |
821 v5 = 27; | |
822 goto LABEL_82; | |
823 case 0xCu: | |
824 v8 = a3; | |
825 v7 = 13; | |
826 goto LABEL_4; | |
827 case 0xDu: | |
484 | 828 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 829 || _49327B(0xEu, a3) ) |
830 goto LABEL_84; | |
831 v8 = a3; | |
832 v7 = 15; | |
833 goto LABEL_4; | |
834 case 0xEu: | |
835 if ( !a3 ) | |
836 break; | |
837 v5 = 43; | |
838 goto LABEL_82; | |
839 case 0xFu: | |
840 if ( !a3 ) | |
841 break; | |
842 v5 = 45; | |
843 goto LABEL_82; | |
844 case 0x10u: | |
845 v8 = a3; | |
846 v7 = 17; | |
847 goto LABEL_4; | |
848 case 0x11u: | |
484 | 849 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 850 || _49327B(0x12u, a3) ) |
851 goto LABEL_84; | |
852 v8 = a3; | |
853 v7 = 19; | |
854 goto LABEL_4; | |
855 case 0x12u: | |
856 if ( !a3 ) | |
857 break; | |
858 v5 = 37; | |
859 goto LABEL_82; | |
860 case 0x13u: | |
861 v5 = 39; | |
862 goto LABEL_82; | |
863 case 0x14u: | |
864 v8 = a3; | |
865 v7 = 21; | |
866 goto LABEL_4; | |
867 case 0x15u: | |
484 | 868 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 869 || _49327B(0x16u, a3) ) |
870 goto LABEL_84; | |
871 v8 = a3; | |
872 v7 = 23; | |
873 goto LABEL_4; | |
874 case 0x16u: | |
875 if ( !a3 ) | |
876 break; | |
877 v5 = 31; | |
878 goto LABEL_82; | |
879 case 0x17u: | |
880 if ( !a3 ) | |
881 break; | |
882 v5 = 33; | |
883 goto LABEL_82; | |
884 case 0x18u: | |
885 if ( !_49327B(0x19u, a3) ) | |
886 goto LABEL_56; | |
887 break; | |
888 case 0x19u: | |
889 LABEL_56: | |
484 | 890 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 891 || _49327B(0x1Au, a3) ) |
892 goto LABEL_84; | |
893 v8 = a3; | |
894 v7 = 27; | |
895 goto LABEL_4; | |
896 case 0x1Au: | |
897 if ( !a3 ) | |
898 break; | |
899 v5 = 65; | |
900 goto LABEL_82; | |
901 case 0x1Bu: | |
902 if ( !a3 ) | |
903 break; | |
904 v5 = 67; | |
905 goto LABEL_82; | |
906 case 0x1Cu: | |
907 v8 = a3; | |
908 v7 = 29; | |
909 goto LABEL_4; | |
910 case 0x1Du: | |
484 | 911 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 912 || _49327B(0x1Eu, a3) ) |
913 goto LABEL_84; | |
914 v8 = a3; | |
915 v7 = 31; | |
916 goto LABEL_4; | |
917 case 0x1Eu: | |
918 if ( !a3 ) | |
919 break; | |
920 v5 = 71; | |
921 goto LABEL_82; | |
922 case 0x1Fu: | |
923 if ( !a3 ) | |
924 break; | |
925 v5 = 73; | |
926 goto LABEL_82; | |
927 case 0x20u: | |
928 v8 = a3; | |
929 v7 = 33; | |
930 goto LABEL_4; | |
931 case 0x21u: | |
484 | 932 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 933 || _49327B(0x22u, a3) ) |
934 goto LABEL_84; | |
935 v8 = a3; | |
936 v7 = 35; | |
937 LABEL_4: | |
938 v4 = _49327B(v7, v8) == 0; | |
939 goto LABEL_83; | |
940 case 0x22u: | |
941 if ( !a3 ) | |
942 break; | |
943 v5 = 77; | |
944 goto LABEL_82; | |
945 case 0x23u: | |
946 if ( a3 ) | |
947 { | |
948 v5 = 79; | |
949 LABEL_82: | |
484 | 950 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 951 LABEL_83: |
952 if ( !v4 ) | |
953 goto LABEL_84; | |
954 } | |
955 break; | |
956 default: | |
957 break; | |
958 } | |
959 result = 0; | |
960 } | |
961 return result; | |
962 } | |
963 | |
964 | |
965 //----- (00492C0B) -------------------------------------------------------- | |
966 bool Player::CanAct() | |
967 { | |
968 bool result; // eax@2 | |
969 | |
970 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
971 result = 0; | |
972 else | |
973 result = 1; | |
974 return result; | |
975 } | |
976 | |
977 //----- (00492C40) -------------------------------------------------------- | |
978 bool Player::CanSteal() | |
979 { | |
980 int v1; // eax@1 | |
981 | |
982 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
983 return v1 != 0; | |
984 } | |
985 | |
986 //----- (00492C4E) -------------------------------------------------------- | |
987 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
988 { | |
989 char v2; // zf@9 | |
990 __int16 v4; // dx@13 | |
991 char v5; // zf@15 | |
992 | |
993 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
994 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
995 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
996 { | |
997 if ( uItemID == 533 ) | |
998 { | |
999 v2 = GetRace() == 1; | |
1000 } | |
1001 else | |
1002 { | |
1003 if ( uItemID != 534 ) | |
1004 { | |
1005 if ( uItemID == 535 ) // | |
1006 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
1007 { | |
1008 switch ( this->uVoiceID ) | |
1009 { | |
1010 default: | |
1011 return 1; | |
1012 case 4u: | |
1013 case 5u: | |
1014 case 6u: | |
1015 case 7u: | |
1016 case 0xAu: | |
1017 case 0xBu: | |
1018 case 0xEu: // | |
1019 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
1020 case 0xFu: | |
1021 case 0x12u: | |
1022 case 0x13u: | |
1023 case 0x15u: | |
1024 case 0x18u: | |
1025 return 0; | |
1026 } | |
1027 return 0; | |
1028 } | |
1029 if ( uItemID == 536 ) // | |
1030 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
1031 { | |
1032 switch ( this->uVoiceID ) | |
1033 { | |
1034 case 4u: | |
1035 case 5u: | |
1036 case 6u: | |
1037 case 7u: | |
1038 case 0xAu: | |
1039 case 0xBu: | |
1040 case 0xEu: | |
1041 case 0xFu: | |
1042 case 0x12u: | |
1043 case 0x13u: | |
1044 case 0x15u: | |
1045 case 0x18u: | |
1046 return 1; | |
1047 default: | |
1048 return 0; | |
1049 } | |
1050 return 0; | |
1051 } | |
1052 if ( uItemID != 604 ) // | |
1053 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1054 return 1; | |
1055 v5 = _43EEF3() == 0; | |
1056 goto LABEL_23; | |
1057 } | |
1058 v2 = GetRace() == 3; // | |
1059 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1060 } | |
1061 } | |
1062 else | |
1063 { | |
1064 if ( uItemID != 532 ) | |
1065 { | |
1066 if ( uItemID != 515 && uItemID != 517 ) // | |
1067 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1068 { | |
1069 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1070 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1071 { | |
1072 LABEL_13: | |
1073 v4 = 99; | |
1074 LABEL_15: | |
484 | 1075 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1076 LABEL_23: |
1077 if ( !v5 ) | |
1078 return 1; | |
1079 return 0; | |
1080 } | |
1081 if ( uItemID != 525 ) | |
1082 { | |
1083 if ( uItemID != 527 ) | |
1084 { | |
1085 if ( uItemID != 531 ) | |
1086 return 1; | |
1087 v2 = GetRace() == 2; | |
1088 goto LABEL_10; | |
1089 } | |
1090 goto LABEL_13; | |
1091 } | |
1092 } | |
1093 v4 = 100; | |
1094 goto LABEL_15; | |
1095 } | |
1096 v2 = GetRace() == 0; | |
1097 } | |
1098 LABEL_10: | |
1099 if ( v2 ) | |
1100 return 1; | |
1101 return 0; | |
1102 } | |
1103 | |
1104 //----- (00492D65) -------------------------------------------------------- | |
1105 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1106 { | |
1107 Player *v3; // esi@1 | |
1108 Player **v4; // ebx@2 | |
1109 Player *v5; // ecx@21 | |
1110 Player *v6; // ecx@22 | |
1111 Player *v7; // ecx@29 | |
1112 Player *v8; // ecx@30 | |
1113 Player *v9; // ecx@37 | |
1114 Player *v10; // ecx@38 | |
1115 Player *v11; // ecx@45 | |
1116 Player *v12; // ecx@46 | |
1117 char *v13; // eax@49 | |
1118 Player *v14; // ecx@58 | |
1119 Player *v15; // ecx@59 | |
1120 Player *v16; // ecx@60 | |
1121 signed int result; // eax@76 | |
1122 signed int v18; // ecx@77 | |
1123 int v19; // eax@77 | |
1124 char v20; // al@80 | |
1125 signed int v21; // ebx@82 | |
1126 signed int v22; // esi@82 | |
1127 int v23; // [sp-8h] [bp-1Ch]@7 | |
1128 int v24; // [sp-8h] [bp-1Ch]@15 | |
1129 int v25; // [sp-8h] [bp-1Ch]@53 | |
1130 int v26; // [sp-4h] [bp-18h]@7 | |
1131 signed int v27; // [sp-4h] [bp-18h]@15 | |
1132 int v28; // [sp-4h] [bp-18h]@53 | |
1133 char *v29; // [sp+Ch] [bp-8h]@1 | |
1134 int v30; // [sp+10h] [bp-4h]@2 | |
1135 int v31; // [sp+20h] [bp+Ch]@82 | |
1136 | |
1137 v3 = this; | |
1138 v29 = (char *)this + 8 * uConditionIdx; | |
1139 if ( *(_QWORD *)v29 ) | |
1140 { | |
1141 LABEL_76: | |
1142 result = 0; | |
1143 } | |
1144 else | |
1145 { | |
1146 v4 = &pPlayers[1]; | |
1147 v30 = 0; | |
1148 do | |
1149 { | |
1150 if ( (*v4)->CanAct() ) | |
1151 ++v30; | |
1152 ++v4; | |
1153 } | |
1154 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1155 switch ( uConditionIdx ) | |
1156 { | |
1157 case 0u: | |
1158 v26 = 0; | |
1159 v23 = 30; | |
1160 goto LABEL_81; | |
1161 case 1u: | |
1162 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1163 goto LABEL_10; | |
1164 v26 = 0; | |
1165 v23 = 25; | |
1166 goto LABEL_81; | |
1167 case 2u: | |
1168 if ( a3 != 1 ) | |
1169 goto LABEL_82; | |
1170 if ( v3->HasEnchantedItemEquipped(22) ) | |
1171 goto LABEL_76; | |
1172 v27 = 3; | |
1173 v24 = 505; | |
1174 goto LABEL_16; | |
1175 case 3u: | |
1176 v26 = 0; | |
1177 v23 = 26; | |
1178 goto LABEL_81; | |
1179 case 4u: | |
1180 v26 = 0; | |
1181 v23 = 31; | |
1182 goto LABEL_81; | |
1183 case 5u: | |
1184 if ( a3 == 1 | |
1185 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1186 goto LABEL_76; | |
1187 v26 = 0; | |
1188 v23 = 29; | |
1189 goto LABEL_81; | |
1190 case 6u: | |
1191 case 8u: | |
1192 case 0xAu: | |
1193 if ( a3 == 1 ) | |
1194 { | |
1195 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1196 { | |
1197 --pParty->pPartyBuffs[13].uPower; | |
1198 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1199 pParty->pPartyBuffs[13].Reset(); | |
1200 } | |
1201 if ( v3->HasEnchantedItemEquipped(21) | |
1202 || v7->WearsItem(505, 3) | |
1203 || v8->WearsItem(530, 6) ) | |
1204 goto LABEL_76; | |
1205 } | |
1206 v26 = 0; | |
1207 v23 = 27; | |
1208 goto LABEL_81; | |
1209 case 7u: | |
1210 case 9u: | |
1211 case 0xBu: | |
1212 if ( a3 != 1 ) | |
1213 goto LABEL_40; | |
1214 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1215 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1216 goto LABEL_10; | |
1217 if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) | |
1218 goto LABEL_76; | |
1219 LABEL_40: | |
1220 v26 = 0; | |
1221 v23 = 28; | |
1222 goto LABEL_81; | |
1223 case 0xCu: | |
1224 if ( a3 != 1 ) | |
1225 goto LABEL_82; | |
1226 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1227 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1228 goto LABEL_10; | |
1229 if ( v3->HasEnchantedItemEquipped(20) | |
1230 || v11->WearsItem(505, 3) | |
1231 || v12->WearsItem(507, 16) ) | |
1232 goto LABEL_76; | |
1233 v27 = 6; | |
1234 v24 = 530; | |
1235 LABEL_16: | |
1236 if ( v3->WearsItem(v24, v27) ) | |
1237 goto LABEL_76; | |
1238 goto LABEL_82; | |
1239 case 0xDu: | |
187 | 1240 v3->PlaySound(SPEECH_32, 0); |
0 | 1241 v13 = (char *)&v3->sHealth; |
1242 goto LABEL_70; | |
1243 case 0xEu: | |
1244 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1245 goto LABEL_10; | |
1246 v28 = 0; | |
1247 v25 = 33; | |
1248 goto LABEL_67; | |
1249 case 0xFu: | |
1250 if ( a3 == 1 | |
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1252 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1253 || v3->HasEnchantedItemEquipped(23) | |
1254 || v14->WearsItem(520, 16) | |
1255 || v15->WearsItem(505, 3) | |
1256 || v16->WearsItem(530, 6)) ) | |
1257 goto LABEL_76; | |
1258 v26 = 0; | |
1259 v23 = 34; | |
1260 goto LABEL_81; | |
1261 case 0x10u: | |
1262 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1263 { | |
1264 LABEL_10: | |
1265 --pParty->pPartyBuffs[13].uPower; | |
1266 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1267 pParty->pPartyBuffs[13].Reset(); | |
1268 goto LABEL_76; | |
1269 } | |
1270 v28 = 0; | |
187 | 1271 v25 = SPEECH_35; |
0 | 1272 LABEL_67: |
187 | 1273 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1274 if ( v3->sHealth > 0 ) |
1275 v3->sHealth = 0; | |
1276 v13 = (char *)&v3->sMana; | |
1277 LABEL_70: | |
1278 if ( *(int *)v13 > 0 ) | |
1279 *(int *)v13 = 0; | |
1280 LABEL_82: | |
1281 v21 = 0; | |
1282 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1283 v31 = 0; | |
1284 v22 = 1; | |
1285 do | |
1286 { | |
1287 if ( pPlayers[v22]->CanAct() ) | |
1288 { | |
1289 ++v31; | |
1290 v21 = v22; | |
1291 } | |
1292 ++v22; | |
1293 } | |
1294 while ( v22 <= 4 ); | |
1295 if ( v30 == 2 ) | |
1296 { | |
1297 if ( v31 == 1 ) | |
187 | 1298 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1299 } |
1300 result = 1; | |
1301 break; | |
1302 case 0x11u: | |
135 | 1303 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1304 v3->Zombie() || !v3->Dead()) | |
0 | 1305 goto LABEL_76; |
1306 memset(v3, 0, 0xA0u); | |
1307 v3->sHealth = v3->GetMaxHealth(); | |
1308 v18 = 0; | |
1309 v3->field_1928 = v3->uFace; | |
1310 v19 = v3->uVoiceID; | |
1311 v3->sMana = 0; | |
1312 v3->field_1924 = v19; | |
1313 switch ( v19 ) | |
1314 { | |
1315 case 0: | |
1316 case 1: | |
1317 case 2: | |
1318 case 3: | |
1319 case 8: | |
1320 case 9: | |
1321 case 12: | |
1322 case 13: | |
1323 case 16: | |
1324 case 17: | |
1325 case 20: | |
1326 case 23: | |
1327 v18 = 0; | |
1328 break; | |
1329 case 4: | |
1330 case 5: | |
1331 case 6: | |
1332 case 7: | |
1333 case 10: | |
1334 case 11: | |
1335 case 14: | |
1336 case 15: | |
1337 case 18: | |
1338 case 19: | |
1339 case 21: | |
1340 case 24: | |
1341 v18 = 1; | |
1342 break; | |
1343 default: | |
1344 break; | |
1345 } | |
1346 v26 = 0; | |
1347 v20 = (v18 != 0) + 23; | |
187 | 1348 v23 = SPEECH_99; |
0 | 1349 v3->uFace = v20; |
1350 v3->uVoiceID = v20; | |
1351 LABEL_81: | |
187 | 1352 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1353 goto LABEL_82; |
1354 default: | |
1355 goto LABEL_82; | |
1356 } | |
1357 } | |
1358 return result; | |
1359 } | |
1360 | |
1361 //----- (00492528) -------------------------------------------------------- | |
1362 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1363 { | |
1364 unsigned int v3; // eax@1 | |
1365 Texture *v4; // esi@1 | |
1366 unsigned int v5; // ebx@1 | |
1367 signed int v6; // edi@5 | |
1368 int *v7; // ecx@6 | |
1369 signed int v8; // edx@7 | |
1370 int *v9; // eax@8 | |
1371 Player *v11; // [sp+Ch] [bp-4h]@1 | |
1372 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 | |
1373 | |
1374 v11 = this; | |
1375 v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
203 | 1376 v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0); |
0 | 1377 v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24); |
1378 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); | |
1379 if ( !areWeLoadingTexture ) | |
1380 { | |
1381 v4->Release(); | |
1382 pIcons_LOD->_40F9C5(); | |
1383 } | |
1384 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1385 { | |
1386 v6 = 0; | |
1387 if ( (signed int)uItemIDa <= 0 ) | |
1388 return 1; | |
1389 v7 = &v11->pInventoryIndices[uSlot]; | |
1390 while ( 1 ) | |
1391 { | |
1392 v8 = 0; | |
1393 if ( (signed int)v5 > 0 ) | |
1394 break; | |
1395 LABEL_11: | |
1396 ++v6; | |
1397 v7 += 14; | |
1398 if ( v6 >= (signed int)uItemIDa ) | |
1399 return 1; | |
1400 } | |
1401 v9 = v7; | |
1402 while ( !*v9 ) | |
1403 { | |
1404 ++v8; | |
1405 ++v9; | |
1406 if ( v8 >= (signed int)v5 ) | |
1407 goto LABEL_11; | |
1408 } | |
1409 } | |
1410 return 0; | |
1411 } | |
1412 // 506128: using guessed type int areWeLoadingTexture; | |
1413 | |
1414 //----- (004925E6) -------------------------------------------------------- | |
1415 unsigned int Player::FindFreeInventorySlot() | |
1416 { | |
1417 unsigned int result; // eax@1 | |
1418 ItemGen *v2; // ecx@1 | |
1419 | |
1420 result = 0; | |
1421 v2 = this->pInventoryItems; | |
1422 while ( v2->uItemID ) | |
1423 { | |
1424 ++result; | |
1425 ++v2; | |
1426 if ( (signed int)result >= 126 ) | |
1427 return -1; | |
1428 } | |
1429 return result; | |
1430 } | |
1431 | |
1432 //----- (00492600) -------------------------------------------------------- | |
1433 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1434 { | |
1435 signed int v3; // edx@1 | |
1436 ItemGen *v4; // eax@1 | |
1437 int result; // eax@8 | |
1438 unsigned int v6; // ebx@10 | |
1439 unsigned int v7; // eax@10 | |
1440 Texture *v8; // esi@10 | |
1441 void *v9; // esi@13 | |
1442 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1443 Player *v11; // [sp+4h] [bp-8h]@1 | |
1444 signed int v12; // [sp+8h] [bp-4h]@4 | |
1445 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1446 | |
1447 v11 = this; | |
1448 v3 = 0; | |
1449 v4 = this->pInventoryItems; | |
1450 while ( v4->uItemID ) | |
1451 { | |
1452 ++v3; | |
1453 ++v4; | |
1454 if ( v3 >= 126 ) | |
1455 { | |
1456 v12 = -1; | |
1457 goto LABEL_5; | |
1458 } | |
1459 } | |
1460 v12 = v3; | |
1461 LABEL_5: | |
1462 if ( v12 == -1 ) | |
1463 { | |
1464 if ( uActiveCharacter ) | |
201 | 1465 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1466 result = 0; |
1467 } | |
1468 else | |
1469 { | |
1470 v6 = uItemID; | |
1471 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1472 v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); | |
1473 v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
1474 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); | |
1475 if ( !areWeLoadingTexture ) | |
1476 { | |
1477 v8->Release(); | |
1478 pIcons_LOD->_40F9C5(); | |
1479 } | |
1480 if ( (signed int)uItemIDa > 0 ) | |
1481 { | |
1482 v9 = &v11->pInventoryIndices[uSlot]; | |
1483 do | |
1484 { | |
1485 if ( (signed int)v10 > 0 ) | |
1486 memset32(v9, -1 - uSlot, v10); | |
1487 v9 = (char *)v9 + 56; | |
1488 --uItemIDa; | |
1489 } | |
1490 while ( uItemIDa ); | |
1491 } | |
1492 result = v12 + 1; | |
1493 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1494 v11->pInventoryItems[v12].uItemID = v6; | |
1495 } | |
1496 return result; | |
1497 } | |
1498 // 506128: using guessed type int areWeLoadingTexture; | |
1499 | |
1500 //----- (00492700) -------------------------------------------------------- | |
1501 int Player::HasSkill(unsigned int uSkillType) | |
1502 { | |
1503 signed int result; // eax@3 | |
1504 | |
1505 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1506 { | |
1507 result = 1; | |
1508 } | |
1509 else | |
1510 { | |
809 | 1511 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1512 ShowStatusBarString(pTmpBuf, 2u); |
1513 result = 0; | |
1514 } | |
1515 return result; | |
1516 } | |
1517 | |
1518 //----- (00492745) -------------------------------------------------------- | |
1519 int Player::WearItem(unsigned int uItemID) | |
1520 { | |
1521 signed int v2; // eax@1 | |
1522 ItemGen *v3; // edx@1 | |
1523 int v4; // edi@6 | |
1524 char *v5; // eax@6 | |
1525 char *v6; // esi@6 | |
1526 | |
1527 v2 = 0; | |
1528 v3 = this->pInventoryItems; | |
1529 while ( v3->uItemID ) | |
1530 { | |
1531 ++v2; | |
1532 ++v3; | |
1533 if ( v2 >= 126 ) | |
1534 { | |
1535 v2 = -1; | |
1536 break; | |
1537 } | |
1538 } | |
1539 if ( v2 != -1 ) | |
1540 { | |
1541 v4 = v2 + 1; | |
1542 v5 = (char *)this + 36 * v2; | |
1543 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; | |
1544 *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; | |
1545 *((int *)v5 + 133) = uItemID; | |
1546 v5[556] = *v6 + 1; | |
1547 } | |
1548 return 0; | |
1549 } | |
1550 | |
1551 //----- (004927A8) -------------------------------------------------------- | |
1552 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1553 { | |
1554 signed int v3; // ebx@2 | |
1555 signed int v4; // edi@3 | |
1556 unsigned int v5; // esi@3 | |
1557 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1558 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1559 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1560 | |
1561 thisa = this; | |
1562 if ( uSlot == -1 ) | |
1563 { | |
1564 v3 = 0; | |
1565 while ( 2 ) | |
1566 { | |
1567 v4 = 0; | |
1568 v5 = v3; | |
1569 do | |
1570 { | |
1571 if ( CanFitItem(v5, uItemID) ) | |
1572 { | |
1573 v8 = uItemID; | |
1574 v7 = v5; | |
1575 return CreateItemInInventory(v7, v8); | |
1576 } | |
1577 ++v4; | |
1578 v5 += 14; | |
1579 } | |
1580 while ( v4 < 9 ); | |
1581 ++v3; | |
1582 if ( v3 < 14 ) | |
1583 continue; | |
1584 break; | |
1585 } | |
1586 return 0; | |
1587 } | |
1588 if ( !CanFitItem(uSlot, uItemID) ) | |
1589 { | |
1590 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1591 return 0; | |
1592 } | |
1593 v8 = uItemID; | |
1594 v7 = uSlot; | |
1595 return CreateItemInInventory(v7, v8); | |
1596 } | |
1597 | |
1598 //----- (00492826) -------------------------------------------------------- | |
1599 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1600 { | |
1601 unsigned int v3; // ebx@1 | |
1602 unsigned int v4; // esi@3 | |
1603 signed int v5; // edi@3 | |
1604 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1605 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1606 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1607 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1608 | |
1609 thisa = this; | |
1610 v3 = Src->uItemID; | |
1611 pItemsTable->SetSpecialBonus(Src); | |
1612 if ( uSlot == -1 ) | |
1613 { | |
1614 uSlota = 0; | |
1615 while ( 2 ) | |
1616 { | |
1617 v4 = uSlota; | |
1618 v5 = 0; | |
1619 do | |
1620 { | |
1621 if ( CanFitItem(v4, v3) ) | |
1622 { | |
1623 v8 = Src; | |
1624 v7 = v4; | |
1625 return CreateItemInInventory2(v7, v8); | |
1626 } | |
1627 ++v5; | |
1628 v4 += 14; | |
1629 } | |
1630 while ( v5 < 14 ); | |
1631 ++uSlota; | |
1632 if ( uSlota < 9 ) | |
1633 continue; | |
1634 break; | |
1635 } | |
1636 return 0; | |
1637 } | |
1638 if ( !CanFitItem(uSlot, v3) ) | |
1639 return 0; | |
1640 v8 = Src; | |
1641 v7 = uSlot; | |
1642 return CreateItemInInventory2(v7, v8); | |
1643 } | |
1644 | |
1645 //----- (0049289C) -------------------------------------------------------- | |
1646 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1647 { | |
1648 signed int v3; // ebx@1 | |
1649 ItemGen *v4; // eax@1 | |
1650 int result; // eax@6 | |
1651 unsigned int v6; // eax@7 | |
1652 Texture *v7; // esi@7 | |
1653 unsigned int v8; // edx@9 | |
1654 void *v9; // esi@10 | |
1655 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1656 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1657 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1658 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1659 | |
1660 v12 = this; | |
1661 v3 = 0; | |
1662 v4 = this->pInventoryItems; | |
1663 while ( v4->uItemID ) | |
1664 { | |
1665 ++v3; | |
1666 ++v4; | |
1667 if ( v3 >= 126 ) | |
1668 { | |
1669 v3 = -1; | |
1670 break; | |
1671 } | |
1672 } | |
1673 if ( v3 == -1 ) | |
1674 { | |
1675 result = 0; | |
1676 } | |
1677 else | |
1678 { | |
1679 v6 = pIcons_LOD->LoadTexture( | |
1680 pItemsTable->pItems[Src->uItemID].pIconName, | |
1681 TEXTURE_16BIT_PALETTE); | |
1682 v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); | |
1683 v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); | |
1684 v11 = GetSizeInInventorySlots(v7->uTextureHeight); | |
1685 if ( !areWeLoadingTexture ) | |
1686 { | |
1687 v7->Release(); | |
1688 pIcons_LOD->_40F9C5(); | |
1689 } | |
1690 v8 = uSlot; | |
1691 if ( (signed int)v11 > 0 ) | |
1692 { | |
1693 uSlota = v11; | |
1694 v9 = &v12->pInventoryIndices[v8]; | |
1695 do | |
1696 { | |
1697 if ( (signed int)v10 > 0 ) | |
1698 memset32(v9, -1 - v8, v10); | |
1699 v9 = (char *)v9 + 56; | |
1700 --uSlota; | |
1701 } | |
1702 while ( uSlota ); | |
1703 } | |
1704 v12->pInventoryIndices[v8] = v3 + 1; | |
1705 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1706 result = v3 + 1; | |
1707 } | |
1708 return result; | |
1709 } | |
1710 // 506128: using guessed type int areWeLoadingTexture; | |
1711 | |
1712 //----- (0049298B) -------------------------------------------------------- | |
1713 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1714 { | |
1715 Player *v4; // ebx@1 | |
1716 unsigned int v5; // eax@1 | |
1717 Texture *v6; // esi@1 | |
1718 void *v7; // esi@4 | |
1719 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1720 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1721 | |
1722 v4 = this; | |
1723 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1724 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1725 v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1726 a2a = GetSizeInInventorySlots(v6->uTextureHeight); | |
1727 if ( !areWeLoadingTexture ) | |
1728 { | |
1729 v6->Release(); | |
1730 pIcons_LOD->_40F9C5(); | |
1731 } | |
1732 if ( (signed int)a2a > 0 ) | |
1733 { | |
1734 v7 = &v4->pInventoryIndices[a4]; | |
1735 do | |
1736 { | |
1737 if ( (signed int)v9 > 0 ) | |
1738 memset32(v7, -1 - a4, v9); | |
1739 v7 = (char *)v7 + 56; | |
1740 --a2a; | |
1741 } | |
1742 while ( a2a ); | |
1743 } | |
1744 v4->pInventoryIndices[a4] = a3 + 1; | |
1745 return 1; | |
1746 } | |
278 | 1747 |
0 | 1748 // 506128: using guessed type int areWeLoadingTexture; |
1749 | |
1750 //----- (00492A36) -------------------------------------------------------- | |
1751 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) | |
1752 { | |
1753 int *pIndices; // edi@1 | |
1754 ItemGen *v3; // ecx@1 | |
1755 unsigned int v4; // esi@1 | |
1756 unsigned int v5; // eax@1 | |
1757 Texture *v6; // esi@1 | |
1758 unsigned int result; // eax@1 | |
1759 unsigned int v8; // ebp@1 | |
1760 void *v9; // edx@4 | |
1761 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1762 | |
1763 pIndices = &this->pInventoryIndices[uSlot]; | |
232 | 1764 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1765 v4 = v3->uItemID; |
1766 v3->Reset(); | |
1767 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); | |
1768 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1769 uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1770 result = GetSizeInInventorySlots(v6->uTextureHeight); | |
1771 v8 = result; | |
1772 if ( !areWeLoadingTexture ) | |
1773 { | |
1774 v6->Release(); | |
1775 result = pIcons_LOD->_40F9C5(); | |
1776 } | |
1777 if ( (signed int)v8 > 0 ) | |
1778 { | |
1779 v9 = pIndices; | |
1780 do | |
1781 { | |
1782 if ( (signed int)uSlota > 0 ) | |
1783 { | |
1784 result = 0; | |
1785 memset(v9, 0, 4 * uSlota); | |
1786 } | |
1787 v9 = (char *)v9 + 56; | |
1788 --v8; | |
1789 } | |
1790 while ( v8 ); | |
1791 } | |
1792 return result; | |
1793 } | |
1794 // 506128: using guessed type int areWeLoadingTexture; | |
1795 | |
436 | 1796 //identf |
0 | 1797 //----- (00490EEE) -------------------------------------------------------- |
1798 int Player::_490EEE(ItemGen *pItem, int a3, int a4, int a5) | |
1799 { | |
1800 int v5; // eax@1 | |
1801 int result; // eax@1 | |
1802 unsigned int v7; // edx@1 | |
1803 unsigned int v8; // ecx@1 | |
1804 signed int v9; // esi@1 | |
1805 char v10; // zf@14 | |
1806 unsigned __int8 v11; // zf@22 | |
1807 char v12; // sf@22 | |
1808 unsigned __int8 v13; // of@22 | |
1809 float *v14; // esi@26 | |
1810 float v15; // ST04_4@26 | |
1811 signed int v16; // eax@26 | |
1812 int v17; // edi@26 | |
1813 float v18; // ST04_4@30 | |
1814 signed int v19; // eax@30 | |
1815 float v20; // ST04_4@34 | |
1816 signed int v21; // eax@34 | |
1817 signed int v22; // eax@34 | |
1818 float v23; // ST04_4@37 | |
1819 signed int v24; // eax@37 | |
1820 int v26; // [sp+10h] [bp-8h]@1 | |
1821 Player *v27; // [sp+14h] [bp-4h]@1 | |
1822 | |
1823 v27 = this; | |
607 | 1824 v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 1825 v26 = v5; |
1826 result = 4; | |
1827 v7 = pItem->uItemID; | |
1828 v8 = pItem->uItemID; | |
1829 v9 = pItemsTable->pItems[v8].uEquipType; | |
1830 if ( (a3 != 4 || (signed int)v7 < 740 || (signed int)v7 > 771) | |
1831 && ((signed int)v7 >= 600 || (signed int)v7 >= 529 && (signed int)v7 <= 599) ) | |
1832 return 5; | |
1833 if ( a3 == 1 ) | |
1834 { | |
1835 v13 = __OFSUB__(v9, 2); | |
1836 v11 = v9 == 2; | |
1837 v12 = v9 - 2 < 0; | |
1838 goto LABEL_24; | |
1839 } | |
1840 if ( a3 == 2 ) | |
1841 { | |
1842 if ( v9 < 3 ) | |
1843 return result; | |
1844 v13 = __OFSUB__(v9, 9); | |
1845 v11 = v9 == 9; | |
1846 v12 = v9 - 9 < 0; | |
1847 LABEL_24: | |
1848 if ( !((unsigned __int8)(v12 ^ v13) | v11) ) | |
1849 return result; | |
1850 goto LABEL_16; | |
1851 } | |
1852 if ( a3 == 3 ) | |
1853 { | |
1854 if ( pItemsTable->pItems[v8].uSkillType == 38 ) | |
1855 goto LABEL_16; | |
1856 v10 = v9 == 16; | |
1857 goto LABEL_15; | |
1858 } | |
1859 if ( a3 != 4 ) | |
1860 goto LABEL_26; | |
1861 if ( v9 < 13 ) | |
1862 return result; | |
1863 if ( v9 > 14 ) | |
1864 { | |
1865 v10 = v9 == 17; | |
1866 LABEL_15: | |
1867 if ( !v10 ) | |
1868 return result; | |
1869 } | |
1870 LABEL_16: | |
315 | 1871 if (pItem->Stolen()) |
0 | 1872 return 6; |
1873 LABEL_26: | |
1874 //v14 = &p2DEvents_minus1__20[13 * a4]; | |
1875 v14 = &p2DEvents[a4 - 1].fPriceMultiplier; | |
1876 v15 = *v14; | |
1877 v16 = pItem->GetValue(); | |
749 | 1878 v17 = GetBuyingPrice(v16, v15); |
0 | 1879 if ( a5 == 3 ) |
1880 { | |
1881 v23 = *v14; | |
1882 v24 = pItem->GetValue(); | |
1883 v17 = v27->_4B8102(v24, v23); | |
315 | 1884 if (!pItem->Broken()) |
0 | 1885 goto LABEL_39; |
1886 goto LABEL_38; | |
1887 } | |
1888 if ( a5 == 4 ) | |
1889 { | |
1890 v22 = v27->_4B8179(*v14); | |
1891 goto LABEL_35; | |
1892 } | |
1893 if ( a5 == 5 ) | |
1894 { | |
1895 v20 = *v14; | |
1896 v21 = pItem->GetValue(); | |
1897 v22 = v27->_4B81C3(v21, v20); | |
1898 LABEL_35: | |
1899 v17 = v22; | |
1900 goto LABEL_39; | |
1901 } | |
1902 if ( a5 != 6 ) | |
1903 goto LABEL_39; | |
1904 v18 = *v14; | |
1905 v19 = pItem->GetValue(); | |
1906 v17 = v27->_4B8102(v19, v18) / 2; | |
315 | 1907 if (pItem->Broken()) |
0 | 1908 v17 = 1; |
1909 if ( v17 >= 1 ) | |
1910 goto LABEL_39; | |
1911 LABEL_38: | |
1912 v17 = 1; | |
1913 LABEL_39: | |
1914 if ( v26 ) | |
1915 result = (v17 == pItem->GetValue()) + 2; | |
1916 else | |
1917 result = 1; | |
1918 return result; | |
1919 } | |
1920 | |
1921 //----- (0049107D) -------------------------------------------------------- | |
1922 int Player::GetBodybuilding() | |
1923 { | |
1924 char v1; // al@1 | |
1925 int v2; // ecx@1 | |
1926 int v4; // eax@3 | |
1927 signed int v6; // [sp-4h] [bp-4h]@2 | |
1928 | |
1929 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1930 v2 = v1 & 0x3F; | |
1931 if ( v1 & 0x100 ) | |
1932 { | |
1933 v6 = 5; | |
1934 } | |
1935 else | |
1936 { | |
1937 if ( v1 >= 0 ) | |
1938 { | |
1939 v4 = ((v1 & 0x40) != 0) + 1; | |
1940 return v2 * v4; | |
1941 } | |
1942 v6 = 3; | |
1943 } | |
1944 v4 = v6; | |
1945 return v2 * v4; | |
1946 } | |
1947 | |
1948 //----- (004910A8) -------------------------------------------------------- | |
607 | 1949 int Player::GetMeditation() |
0 | 1950 { |
1951 char v1; // al@1 | |
1952 int v2; // ecx@1 | |
1953 int v4; // eax@3 | |
1954 signed int v6; // [sp-4h] [bp-4h]@2 | |
1955 | |
1956 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1957 v2 = v1 & 0x3F; | |
1958 if ( v1 & 0x100 ) | |
1959 { | |
1960 v6 = 5; | |
1961 } | |
1962 else | |
1963 { | |
1964 if ( v1 >= 0 ) | |
1965 { | |
1966 v4 = ((v1 & 0x40) != 0) + 1; | |
1967 return v2 * v4; | |
1968 } | |
1969 v6 = 3; | |
1970 } | |
1971 v4 = v6; | |
1972 return v2 * v4; | |
1973 } | |
1974 | |
1975 //----- (004910D3) -------------------------------------------------------- | |
1976 int Player::CanIdentify(ItemGen *pItem) | |
1977 { | |
1978 unsigned __int16 v2; // ax@1 | |
1979 unsigned __int16 v3; // bx@1 | |
1980 int uSkillMult; // eax@3 | |
1981 int v5; // edi@7 | |
1982 signed int v6; // ebp@7 | |
1983 char *v7; // esi@7 | |
1984 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1985 |
1986 if (CheckHiredNPCSpeciality(Scholar)) | |
1987 return true; | |
0 | 1988 |
179 | 1989 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1990 v3 = v2; |
179 | 1991 if ( v2 & 1 ) |
0 | 1992 { |
1993 uSkillMultiplier = 5; | |
1994 } | |
1995 else | |
1996 { | |
1997 if ( (v2 & 0x80u) == 0 ) | |
1998 { | |
1999 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 2000 v5 = uSkillMult * (v3 & 0x3F); |
2001 v6 = 0; | |
2002 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2003 |
179 | 2004 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2005 v6 = 1; | |
2006 if ( v5 >= (unsigned __int8)v7[46] ) | |
2007 v6 = 1; | |
2008 return v6; | |
0 | 2009 } |
2010 uSkillMultiplier = 3; | |
2011 } | |
2012 uSkillMult = uSkillMultiplier; | |
2013 v5 = uSkillMult * (v3 & 0x3F); | |
2014 v6 = 0; | |
2015 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2016 |
0 | 2017 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2018 v6 = 1; | |
2019 if ( v5 >= (unsigned __int8)v7[46] ) | |
2020 v6 = 1; | |
2021 return v6; | |
2022 } | |
2023 | |
2024 //----- (00491151) -------------------------------------------------------- | |
2025 int Player::CanRepair(ItemGen *a2) | |
2026 { | |
2027 unsigned __int16 v2; // ax@1 | |
2028 unsigned __int16 v3; // bx@1 | |
2029 int v4; // eax@3 | |
2030 int v5; // edi@7 | |
2031 signed int v6; // ebp@7 | |
2032 char v8; // al@10 | |
2033 signed int v10; // [sp-4h] [bp-14h]@2 | |
2034 | |
652 | 2035 |
2036 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2037 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2038 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2039 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2040 return true; | |
2041 | |
0 | 2042 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
2043 v3 = v2; | |
2044 if ( HIBYTE(v2) & 1 ) | |
2045 { | |
2046 v10 = 5; | |
2047 } | |
2048 else | |
2049 { | |
2050 if ( (v2 & 0x80u) == 0 ) | |
2051 { | |
2052 v4 = ((v2 & 0x40) != 0) + 1; | |
2053 goto LABEL_7; | |
2054 } | |
2055 v10 = 3; | |
2056 } | |
2057 v4 = v10; | |
2058 LABEL_7: | |
2059 v5 = v4 * (v3 & 0x3F); | |
2060 v6 = 0; | |
2061 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2062 return true; | |
2063 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2064 { | |
2065 __debugbreak(); // really odd | |
2066 return true; | |
2067 } | |
2068 return false; | |
2069 } | |
2070 | |
2071 //----- (004911F3) -------------------------------------------------------- | |
2072 int Player::GetMerchant() | |
2073 { | |
2074 Player *v1; // edi@1 | |
2075 unsigned __int16 v2; // ax@1 | |
2076 unsigned __int16 v3; // bx@1 | |
2077 int v4; // esi@1 | |
2078 int v5; // edi@1 | |
2079 int v7; // eax@3 | |
2080 int v8; // ecx@7 | |
2081 signed int v9; // [sp-4h] [bp-10h]@6 | |
2082 | |
2083 v1 = this; | |
607 | 2084 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 2085 v3 = v1->pActiveSkills[22]; |
607 | 2086 v4 = v2 & 0x003F; |
0 | 2087 v5 = v1->pActiveSkills[22] & 0x3F; |
2088 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2089 return 10000; | |
2090 v7 = GetPartyReputation(); | |
2091 if ( !v4 ) | |
2092 return -v7; | |
2093 if ( HIBYTE(v3) & 1 ) | |
2094 { | |
2095 v9 = 5; | |
2096 } | |
2097 else | |
2098 { | |
2099 if ( (v3 & 0x80u) == 0 ) | |
2100 { | |
2101 v8 = ((v3 & 0x40) != 0) + 1; | |
2102 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2103 } | |
2104 v9 = 3; | |
2105 } | |
2106 v8 = v9; | |
2107 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2108 } | |
2109 | |
2110 //----- (0049125A) -------------------------------------------------------- | |
2111 int Player::GetPerception() | |
2112 { | |
2113 Player *v1; // edi@1 | |
2114 unsigned __int16 v2; // ax@1 | |
2115 unsigned __int16 v3; // bx@1 | |
2116 int v4; // esi@1 | |
2117 int v5; // edi@1 | |
2118 int v7; // eax@5 | |
2119 signed int v8; // [sp-4h] [bp-10h]@4 | |
2120 | |
2121 v1 = this; | |
2122 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); | |
2123 v3 = v1->pActiveSkills[26]; | |
2124 v4 = v2 & 0x3F; | |
2125 v5 = v1->pActiveSkills[26] & 0x3F; | |
2126 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2127 return 10000; | |
2128 if ( HIBYTE(v3) & 1 ) | |
2129 { | |
2130 v8 = 5; | |
2131 } | |
2132 else | |
2133 { | |
2134 if ( (v3 & 0x80u) == 0 ) | |
2135 { | |
2136 v7 = ((v3 & 0x40) != 0) + 1; | |
2137 return v4 + v5 * (v7 - 1); | |
2138 } | |
2139 v8 = 3; | |
2140 } | |
2141 v7 = v8; | |
2142 return v4 + v5 * (v7 - 1); | |
2143 } | |
2144 | |
2145 //----- (004912B0) -------------------------------------------------------- | |
2146 int Player::GetDisarmTrap() | |
2147 { | |
2148 Player *v1; // ebp@1 | |
2149 unsigned __int16 v2; // ax@1 | |
2150 unsigned __int16 v3; // bx@1 | |
2151 int v4; // esi@1 | |
2152 int v5; // edi@1 | |
2153 int v7; // eax@7 | |
2154 signed int v8; // [sp-4h] [bp-14h]@6 | |
2155 | |
2156 v1 = this; | |
2157 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2158 v3 = v1->pActiveSkills[29]; | |
2159 v4 = v2 & 0x3F; | |
2160 v5 = v1->pActiveSkills[29] & 0x3F; | |
2161 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2162 return 10000; | |
2163 if ( HasEnchantedItemEquipped(35) ) | |
2164 v4 *= 2; | |
2165 if ( HIBYTE(v3) & 1 ) | |
2166 { | |
2167 v8 = 5; | |
2168 } | |
2169 else | |
2170 { | |
2171 if ( (v3 & 0x80u) == 0 ) | |
2172 { | |
2173 v7 = ((v3 & 0x40) != 0) + 1; | |
2174 return v4 + v5 * (v7 - 1); | |
2175 } | |
2176 v8 = 3; | |
2177 } | |
2178 v7 = v8; | |
2179 return v4 + v5 * (v7 - 1); | |
2180 } | |
2181 | |
2182 //----- (00491317) -------------------------------------------------------- | |
2183 char Player::GetLearningPercent() | |
2184 { | |
2185 Player *v1; // esi@1 | |
2186 int v2; // eax@1 | |
2187 unsigned __int16 v3; // bx@1 | |
2188 int v4; // ecx@1 | |
2189 int v5; // eax@4 | |
2190 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2191 | |
2192 v1 = this; | |
2193 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2194 v3 = v1->pActiveSkills[36]; | |
2195 v4 = v2 & 0x3F; | |
2196 if ( v2 ) | |
2197 { | |
2198 if ( HIBYTE(v3) & 1 ) | |
2199 { | |
2200 v7 = 5; | |
2201 } | |
2202 else | |
2203 { | |
2204 if ( (v3 & 0x80u) == 0 ) | |
2205 { | |
2206 v5 = ((v3 & 0x40) != 0) + 1; | |
2207 goto LABEL_8; | |
2208 } | |
2209 v7 = 3; | |
2210 } | |
2211 v5 = v7; | |
2212 LABEL_8: | |
2213 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2214 } | |
2215 return v2; | |
2216 } | |
2217 | |
2218 //----- (0048C6AF) -------------------------------------------------------- | |
2219 Player::Player() | |
2220 { | |
2221 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2222 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2223 for (uint i = 0; i < 126; ++i) | |
2224 pInventoryItems[i].Reset(); | |
2225 for (uint i = 0; i < 12; ++i) | |
2226 pEquippedItems[i].Reset(); | |
2227 | |
2228 | |
2229 for (uint i = 0; i < 24; ++i) | |
2230 { | |
2231 pPlayerBuffs[i].uSkill = 0; | |
2232 pPlayerBuffs[i].uSkill = 0; | |
2233 pPlayerBuffs[i].uPower = 0; | |
2234 pPlayerBuffs[i].uExpireTime = 0; | |
2235 pPlayerBuffs[i].uCaster = 0; | |
2236 pPlayerBuffs[i].uFlags = 0; | |
2237 } | |
2238 | |
2239 pName[0] = 0; | |
2240 uFace = 0; | |
2241 uVoiceID = 0; | |
2242 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2243 | |
2244 field_BB = 0; | |
2245 | |
2246 uMight = uMightBonus = 0; | |
2247 uIntelligence = uIntelligenceBonus = 0; | |
2248 uWillpower = uWillpowerBonus = 0; | |
2249 uEndurance = uEnduranceBonus = 0; | |
2250 uSpeed = uSpeedBonus = 0; | |
2251 uAccuracy = uAccuracyBonus = 0; | |
2252 uLuck = uLuckBonus = 0; | |
2253 uLevel = sLevelModifier = 0; | |
2254 sAgeModifier = 0; | |
2255 | |
2256 memset(field_1F5, 0, 30); | |
2257 | |
2258 sResFireBase = sResFireBonus = 0; | |
2259 sResAirBase = sResAirBonus = 0; | |
2260 sResWaterBase = sResWaterBonus = 0; | |
2261 sResEarthBase = sResEarthBonus = 0; | |
2262 sResMagicBase = sResMagicBonus = 0; | |
2263 sResSpiritBase = sResSpiritBonus = 0; | |
2264 sResMindBase = sResMindBonus = 0; | |
2265 sResBodyBase = sResBodyBonus = 0; | |
2266 sResLightBase = sResLightBonus = 0; | |
2267 sResDarkBase = sResDarkBonus = 0; | |
2268 | |
2269 uTimeToRecovery = 0; | |
2270 | |
2271 uSkillPoints = 0; | |
2272 | |
2273 sHealth = 0; | |
2274 uFullHealthBonus = 0; | |
2275 _health_related = 0; | |
2276 | |
2277 sMana = 0; | |
2278 uFullManaBonus = 0; | |
2279 _mana_related = 0; | |
2280 | |
2281 uQuickSpell = 0; | |
2282 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2283 | |
2284 _some_attack_bonus = 0; | |
2285 field_1A91 = 0; | |
2286 _melee_dmg_bonus = 0; | |
2287 field_1A93 = 0; | |
2288 _ranged_atk_bonus = 0; | |
2289 field_1A95 = 0; | |
2290 _ranged_dmg_bonus = 0; | |
2291 field_1A97 = 0; | |
2292 | |
130 | 2293 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2294 uExpressionTimePassed = 0; |
2295 uExpressionTimeLength = 0; | |
2296 | |
2297 uNumDivineInterventionCastsThisDay = 0; | |
2298 uNumArmageddonCasts = 0; | |
2299 uNumFireSpikeCasts = 0; | |
2300 | |
2301 memset(field_1988, 0, 49 * sizeof(int)); | |
2302 memset(field_1A50, 0, 64 * sizeof(char)); | |
2303 | |
2304 field_E0 = 0; | |
2305 field_E4 = 0; | |
2306 field_E8 = 0; | |
2307 field_EC = 0; | |
2308 field_F0 = 0; | |
2309 field_F4 = 0; | |
2310 field_F8 = 0; | |
2311 field_FC = 0; | |
2312 field_100 = 0; | |
2313 field_104 = 0; | |
198 | 2314 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2315 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2316 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2317 |
198 | 2318 lastOpenedSpellbookPage = 0; |
0 | 2319 } |
2320 | |
2321 //----- (0048C6F6) -------------------------------------------------------- | |
2322 bool Party::AddItem(ItemGen *pItem) | |
2323 { | |
2324 unsigned int v2; // eax@1 | |
2325 unsigned int v3; // ecx@4 | |
2326 signed int v4; // edx@4 | |
2327 char *v5; // eax@8 | |
2328 unsigned int v6; // eax@10 | |
2329 Texture *v7; // ebx@10 | |
2330 signed int v8; // esi@10 | |
2331 Player *v9; // edi@11 | |
2332 int v10; // eax@11 | |
2333 bool result; // eax@15 | |
2334 std::string v12; // [sp-18h] [bp-40h]@9 | |
2335 const char *v13; // [sp-8h] [bp-30h]@9 | |
2336 int v14; // [sp-4h] [bp-2Ch]@9 | |
188 | 2337 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2338 //int v16; // [sp+10h] [bp-18h]@3 | |
2339 //int v17; // [sp+14h] [bp-14h]@3 | |
2340 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2341 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2342 Party *v20; // [sp+20h] [bp-8h]@1 | |
2343 int v21; // [sp+24h] [bp-4h]@10 | |
2344 | |
2345 auto thos = this; | |
2346 | |
2347 v20 = thos; | |
2348 v2 = pItem->uItemID; | |
222 | 2349 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2350 pItem->SetIdentified(); |
188 | 2351 ///v15 = 0; |
2352 //v16 = 1; | |
2353 //v18 = 3; | |
2354 //v17 = 2; | |
0 | 2355 if ( uActiveCharacter ) |
2356 { | |
2357 v3 = uActiveCharacter - 1; | |
2358 v4 = 0; | |
2359 do | |
2360 { | |
188 | 2361 v15[v4++] = v3++; |
0 | 2362 if ( (signed int)v3 >= 4 ) |
2363 v3 = 0; | |
2364 } | |
2365 while ( v4 < 4 ); | |
2366 } | |
2367 v5 = pItemsTable->pItems[v2].pIconName; | |
2368 if ( v5 ) | |
2369 { | |
2370 v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); | |
188 | 2371 v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); |
0 | 2372 v21 = areWeLoadingTexture; |
2373 v8 = 0; | |
2374 while ( 1 ) | |
2375 { | |
188 | 2376 v9 = &v20->pPlayers[v15[v8]]; |
2377 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2378 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2379 if ( v10 ) | |
2380 break; | |
2381 ++v8; | |
2382 if ( v8 >= 4 ) | |
2383 { | |
2384 if ( !v21 ) | |
2385 { | |
2386 v7->Release(); | |
2387 pIcons_LOD->_40F9C5(); | |
2388 } | |
2389 goto LABEL_15; | |
2390 } | |
2391 } | |
232 | 2392 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2393 pItem->Reset(); |
2394 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2395 v19->PlaySound(SPEECH_60, 0); |
0 | 2396 if ( !v21 ) |
2397 { | |
2398 v7->Release(); | |
2399 pIcons_LOD->_40F9C5(); | |
2400 } | |
2401 result = 1; | |
2402 } | |
2403 else | |
2404 { | |
2405 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2406 LABEL_15: | |
2407 result = 0; | |
2408 } | |
2409 return result; | |
2410 } | |
2411 // 506128: using guessed type int areWeLoadingTexture; | |
2412 | |
2413 //----- (0048C855) -------------------------------------------------------- | |
2414 int Player::GetBaseStrength() | |
2415 { | |
2416 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2417 } | |
2418 | |
2419 //----- (0048C86C) -------------------------------------------------------- | |
2420 int Player::GetBaseIntelligence() | |
2421 { | |
2422 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2423 } | |
2424 | |
2425 //----- (0048C883) -------------------------------------------------------- | |
2426 int Player::GetBaseWillpower() | |
2427 { | |
2428 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2429 } | |
2430 | |
2431 //----- (0048C89A) -------------------------------------------------------- | |
2432 int Player::GetBaseEndurance() | |
2433 { | |
2434 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2435 } | |
2436 | |
2437 //----- (0048C8B1) -------------------------------------------------------- | |
2438 int Player::GetBaseAccuracy() | |
2439 { | |
2440 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2441 } | |
2442 | |
2443 //----- (0048C8C8) -------------------------------------------------------- | |
2444 int Player::GetBaseSpeed() | |
2445 { | |
2446 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2447 } | |
2448 | |
2449 //----- (0048C8DF) -------------------------------------------------------- | |
2450 int Player::GetBaseLuck() | |
2451 { | |
2452 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2453 } | |
2454 | |
2455 //----- (0048C8F6) -------------------------------------------------------- | |
2456 int Player::GetBaseLevel() | |
2457 { | |
2458 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2459 } | |
2460 | |
2461 //----- (0048C90D) -------------------------------------------------------- | |
2462 int Player::GetActualLevel() | |
2463 { | |
2464 return uLevel + sLevelModifier + | |
2465 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2466 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2467 } | |
2468 | |
2469 //----- (0048C93C) -------------------------------------------------------- | |
2470 int Player::GetActualMight() | |
2471 { | |
2472 Player *v1; // esi@1 | |
2473 unsigned int v2; // eax@1 | |
2474 signed int v3; // ecx@1 | |
2475 signed int v4; // ebx@4 | |
2476 int v5; // edi@5 | |
2477 int v6; // ST14_4@5 | |
2478 | |
2479 v1 = this; | |
2480 v2 = this->sAgeModifier + GetBaseAge(); | |
2481 v3 = 0; | |
2482 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2483 { | |
2484 ++v3; | |
2485 if ( v3 >= 4 ) | |
2486 { | |
2487 v4 = 100; | |
2488 goto LABEL_5; | |
2489 } | |
2490 } | |
2491 v4 = pAgeingStrengthMultiplier[v3]; | |
2492 LABEL_5: | |
2493 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2494 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2495 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2496 } | |
2497 | |
2498 //----- (0048C9C2) -------------------------------------------------------- | |
2499 int Player::GetActualIntelligence() | |
2500 { | |
2501 Player *v1; // esi@1 | |
2502 unsigned int sAge; // eax@1 | |
2503 signed int uAgeLevel; // ecx@1 | |
2504 signed int v4; // ebx@4 | |
2505 int v5; // edi@5 | |
2506 int v6; // ebp@5 | |
2507 | |
2508 v1 = this; | |
2509 sAge = this->sAgeModifier + GetBaseAge(); | |
2510 uAgeLevel = 0; | |
2511 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2512 { | |
2513 ++uAgeLevel; | |
2514 if ( uAgeLevel >= 4 ) | |
2515 { | |
2516 v4 = 100; | |
2517 goto LABEL_5; | |
2518 } | |
2519 } | |
2520 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2521 LABEL_5: | |
2522 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2523 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2524 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2525 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2526 + v6 | |
2527 + v1->uIntelligenceBonus; | |
2528 } | |
2529 | |
2530 //----- (0048CA3F) -------------------------------------------------------- | |
2531 int Player::GetActualWillpower() | |
2532 { | |
2533 int v5; // edi@5 | |
2534 | |
2535 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2536 uint uAgeingMultiplier = 100; | |
2537 for (uint i = 0; i < 4; ++i) | |
2538 if (uActualAge >= pAgeingTable[i]) | |
2539 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2540 else break; | |
2541 | |
2542 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2543 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2544 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2545 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2546 + uWillpowerBonus; | |
2547 } | |
2548 | |
2549 //----- (0048CABC) -------------------------------------------------------- | |
2550 int Player::GetActualEndurance() | |
2551 { | |
2552 int v6; // ebp@5 | |
2553 | |
2554 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2555 uint uAgeingMultiplier = 100; | |
2556 for (uint i = 0; i < 4; ++i) | |
2557 if (uActualAge >= pAgeingTable[i]) | |
2558 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2559 else break; | |
2560 | |
2561 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2562 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2563 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2564 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2565 + uItemBonus | |
2566 + uEnduranceBonus; | |
2567 } | |
2568 | |
2569 //----- (0048CB39) -------------------------------------------------------- | |
2570 int Player::GetActualAccuracy() | |
2571 { | |
2572 Player *v1; // esi@1 | |
2573 unsigned int v2; // eax@1 | |
2574 signed int v3; // ecx@1 | |
2575 signed int v4; // ebx@4 | |
2576 int v5; // edi@5 | |
2577 int v6; // ebp@5 | |
2578 | |
2579 v1 = this; | |
2580 v2 = this->sAgeModifier + GetBaseAge(); | |
2581 v3 = 0; | |
2582 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2583 { | |
2584 ++v3; | |
2585 if ( v3 >= 4 ) | |
2586 { | |
2587 v4 = 100; | |
2588 goto LABEL_5; | |
2589 } | |
2590 } | |
2591 v4 = pAgeingAccuracyMultiplier[v3]; | |
2592 LABEL_5: | |
2593 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2594 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2595 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2596 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2597 + v6 | |
2598 + v1->uAccuracyBonus; | |
2599 } | |
2600 | |
2601 //----- (0048CBB6) -------------------------------------------------------- | |
2602 int Player::GetActualSpeed() | |
2603 { | |
2604 Player *v1; // esi@1 | |
2605 unsigned int v2; // eax@1 | |
2606 signed int v3; // ecx@1 | |
2607 signed int v4; // ebx@4 | |
2608 int v5; // edi@5 | |
2609 int v6; // ebp@5 | |
2610 | |
2611 v1 = this; | |
2612 v2 = this->sAgeModifier + GetBaseAge(); | |
2613 v3 = 0; | |
2614 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2615 { | |
2616 ++v3; | |
2617 if ( v3 >= 4 ) | |
2618 { | |
2619 v4 = 100; | |
2620 goto LABEL_5; | |
2621 } | |
2622 } | |
2623 v4 = pAgeingSpeedMultiplier[v3]; | |
2624 LABEL_5: | |
2625 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2626 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2627 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2628 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2629 + v6 | |
2630 + v1->uSpeedBonus; | |
2631 } | |
2632 | |
2633 //----- (0048CC33) -------------------------------------------------------- | |
2634 int Player::GetActualLuck() | |
2635 { | |
2636 Player *v1; // esi@1 | |
2637 unsigned int v2; // eax@7 | |
2638 signed int v3; // ecx@7 | |
2639 signed int v4; // ebx@10 | |
2640 int v5; // edi@11 | |
2641 int v6; // ebp@11 | |
2642 signed int v8; // [sp+10h] [bp-4h]@1 | |
2643 | |
2644 v8 = 0; | |
2645 v1 = this; | |
652 | 2646 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2647 v8 = 5; |
652 | 2648 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2649 v8 += 20; |
652 | 2650 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2651 v8 += 10; |
2652 v2 = v1->sAgeModifier + GetBaseAge(); | |
2653 v3 = 0; | |
2654 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2655 { | |
2656 ++v3; | |
2657 if ( v3 >= 4 ) | |
2658 { | |
2659 v4 = 100; | |
2660 goto LABEL_11; | |
2661 } | |
2662 } | |
2663 v4 = pAgeingLuckMultiplier[v3]; | |
2664 LABEL_11: | |
2665 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2666 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2667 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2668 + v6 | |
2669 + v8 | |
2670 + v5 * v4 * v1->uLuck / 100 / 100 | |
2671 + v1->uLuckBonus; | |
2672 } | |
2673 | |
2674 //----- (0048CCF5) -------------------------------------------------------- | |
2675 int Player::GetActualAttack(int a2) | |
2676 { | |
2677 Player *v2; // esi@1 | |
2678 int v3; // eax@1 | |
2679 int v4; // edi@1 | |
2680 int v5; // ebx@1 | |
2681 int v6; // ebp@1 | |
2682 | |
2683 v2 = this; | |
2684 v3 = GetActualAccuracy(); | |
2685 v4 = _48EA1B_get_static_effect(v3); | |
2686 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2687 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2688 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2689 } | |
2690 | |
2691 //----- (0048CD45) -------------------------------------------------------- | |
2692 int Player::GetMeleeDamageMinimal() | |
2693 { | |
2694 Player *v1; // edi@1 | |
2695 int v2; // eax@1 | |
2696 int v3; // esi@1 | |
2697 int v4; // esi@1 | |
2698 int v5; // esi@1 | |
2699 int v6; // esi@1 | |
2700 signed int result; // eax@1 | |
2701 | |
2702 v1 = this; | |
2703 v2 = GetActualMight(); | |
2704 v3 = _48EA1B_get_static_effect(v2); | |
2705 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2706 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2707 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2708 result = 1; | |
2709 if ( v6 >= 1 ) | |
2710 result = v6; | |
2711 return result; | |
2712 } | |
2713 | |
2714 //----- (0048CD90) -------------------------------------------------------- | |
2715 int Player::GetMeleeDamageMaximal() | |
2716 { | |
2717 Player *v1; // edi@1 | |
2718 int v2; // eax@1 | |
2719 int v3; // esi@1 | |
2720 int v4; // esi@1 | |
2721 int v5; // esi@1 | |
2722 int v6; // esi@1 | |
2723 signed int result; // eax@1 | |
2724 | |
2725 v1 = this; | |
2726 v2 = GetActualMight(); | |
2727 v3 = _48EA1B_get_static_effect(v2); | |
2728 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2729 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2730 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2731 result = 1; | |
2732 if ( v6 >= 1 ) | |
2733 result = v6; | |
2734 return result; | |
2735 } | |
2736 | |
2737 //----- (0048CDDB) -------------------------------------------------------- | |
2738 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2739 { | |
2740 int v4; // esi@1 | |
2741 Player *v5; // edi@1 | |
2742 ItemGen *v6; // ebx@4 | |
2743 unsigned int v7; // ebp@4 | |
2744 unsigned int v8; // esi@4 | |
2745 int v9; // eax@4 | |
2746 int v10; // eax@9 | |
2747 char v11; // zf@9 | |
2748 int v12; // esi@10 | |
2749 int v13; // eax@11 | |
2750 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2751 ItemGen *v15; // ebx@35 | |
2752 unsigned int v16; // ebp@35 | |
2753 unsigned int v17; // esi@35 | |
2754 int v18; // edx@38 | |
2755 int v19; // eax@40 | |
2756 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2757 int v21; // esi@62 | |
2758 int v22; // eax@63 | |
2759 int v23; // ebx@63 | |
2760 int v24; // ebx@63 | |
2761 signed int result; // eax@64 | |
2762 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2763 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2764 int v28; // [sp+10h] [bp-10h]@1 | |
2765 int v29; // [sp+10h] [bp-10h]@33 | |
2766 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2767 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2768 int v32; // [sp+18h] [bp-8h]@1 | |
2769 int v33; // [sp+18h] [bp-8h]@8 | |
2770 int v34; // [sp+1Ch] [bp-4h]@1 | |
2771 int v35; // [sp+28h] [bp+8h]@37 | |
2772 | |
2773 v4 = 0; | |
2774 v5 = this; | |
2775 v34 = 0; | |
2776 v32 = 0; | |
2777 v28 = 0; | |
2778 if ( IsUnarmed() == 1 ) | |
2779 { | |
2780 v32 = rand() % 3 + 1; | |
2781 LABEL_61: | |
2782 v34 = v4; | |
2783 goto LABEL_62; | |
2784 } | |
816 | 2785 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2786 { |
232 | 2787 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2788 v7 = v6->uItemID; |
2789 v8 = v6->uItemID; | |
2790 v9 = pItemsTable->pItems[v8].uDamageDice; | |
2791 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) | |
2792 ++v9; | |
2793 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2794 if ( v9 > 0 ) | |
2795 { | |
2796 v33 = v9; | |
2797 do | |
2798 { | |
2799 v10 = rand(); | |
2800 v11 = v33-- == 1; | |
2801 v28 += v10 % v30 + 1; | |
2802 } | |
2803 while ( !v11 ); | |
2804 } | |
2805 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2806 if ( !uTargetActorID ) | |
2807 goto LABEL_28; | |
377 | 2808 v13 = v6->uSpecEnchantmentType; |
0 | 2809 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2810 { | |
2811 v14 = (MONSTER_SUPERTYPE)1; | |
2812 } | |
2813 else | |
2814 { | |
2815 if ( v13 == 39 ) | |
2816 { | |
2817 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2818 } | |
2819 else | |
2820 { | |
2821 if ( v13 == 40 ) | |
2822 { | |
2823 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2824 } | |
2825 else | |
2826 { | |
2827 if ( v13 == 63 || v7 == 517 ) | |
2828 { | |
2829 v26 = MONSTER_SUPERTYPE_ELF; | |
2830 } | |
2831 else | |
2832 { | |
2833 if ( v13 != 65 ) | |
2834 { | |
2835 LABEL_28: | |
2836 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2837 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2838 && rand() % 100 < 10 ) | |
2839 v12 *= 3; | |
2840 v32 = v12; | |
2841 goto LABEL_33; | |
2842 } | |
2843 v26 = MONSTER_SUPERTYPE_TITAN; | |
2844 } | |
2845 } | |
2846 } | |
2847 v14 = v26; | |
2848 } | |
2849 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2850 v12 *= 2; | |
2851 goto LABEL_28; | |
2852 } | |
2853 LABEL_33: | |
2854 v29 = 0; | |
2855 if ( !a3 ) | |
2856 { | |
2857 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2858 { | |
232 | 2859 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1]; |
0 | 2860 v16 = v15->uItemID; |
2861 v17 = v15->uItemID; | |
2862 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2863 { | |
2864 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2865 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2866 { | |
2867 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2868 do | |
2869 { | |
2870 v18 = rand() % v31; | |
2871 v11 = v35-- == 1; | |
2872 v29 += v18 + 1; | |
2873 } | |
2874 while ( !v11 ); | |
2875 } | |
2876 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2877 if ( !uTargetActorID ) | |
2878 goto LABEL_57; | |
377 | 2879 v19 = v15->uSpecEnchantmentType; |
0 | 2880 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2881 { | |
2882 v20 = (MONSTER_SUPERTYPE)1; | |
2883 } | |
2884 else | |
2885 { | |
2886 if ( v19 == 39 ) | |
2887 { | |
2888 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2889 } | |
2890 else | |
2891 { | |
2892 if ( v19 == 40 ) | |
2893 { | |
2894 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2895 } | |
2896 else | |
2897 { | |
2898 if ( v19 == 63 || v16 == 517 ) | |
2899 { | |
2900 v27 = MONSTER_SUPERTYPE_ELF; | |
2901 } | |
2902 else | |
2903 { | |
2904 if ( v19 != 65 ) | |
2905 { | |
2906 LABEL_57: | |
2907 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2908 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2909 && rand() % 100 < 10 ) | |
2910 v4 *= 3; | |
2911 goto LABEL_61; | |
2912 } | |
2913 v27 = MONSTER_SUPERTYPE_TITAN; | |
2914 } | |
2915 } | |
2916 } | |
2917 v20 = v27; | |
2918 } | |
2919 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2920 v4 *= 2; | |
2921 goto LABEL_57; | |
2922 } | |
2923 } | |
2924 } | |
2925 LABEL_62: | |
2926 v21 = v32 + v34; | |
2927 if ( !a2 ) | |
2928 { | |
2929 v22 = GetActualMight(); | |
2930 v23 = _48EA1B_get_static_effect(v22); | |
2931 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2932 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2933 } | |
2934 result = 1; | |
2935 if ( v21 >= 1 ) | |
2936 result = v21; | |
2937 return result; | |
2938 } | |
2939 | |
2940 //----- (0048D0B9) -------------------------------------------------------- | |
2941 int Player::GetRangedAttack() | |
2942 { | |
2943 Player *v1; // esi@1 | |
2944 int v2; // eax@1 | |
2945 int v3; // edi@3 | |
2946 int v4; // eax@4 | |
2947 int v5; // edi@4 | |
2948 int v6; // edi@4 | |
2949 int v7; // edi@4 | |
2950 | |
2951 v1 = this; | |
232 | 2952 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2953 if ( v2 < 64 || v2 > 65 ) |
2954 { | |
2955 v4 = GetActualAccuracy(); | |
2956 v5 = _48EA1B_get_static_effect(v4); | |
2957 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2958 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2959 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2960 } | |
2961 else | |
2962 { | |
2963 v3 = GetActualAttack(1); | |
2964 } | |
2965 return v3; | |
2966 } | |
2967 | |
2968 //----- (0048D124) -------------------------------------------------------- | |
2969 int Player::GetRangedDamageMin() | |
2970 { | |
2971 Player *v1; // esi@1 | |
2972 int v2; // edi@1 | |
2973 int v3; // edi@1 | |
2974 int v4; // edi@1 | |
2975 unsigned __int16 v5; // ax@1 | |
2976 int result; // eax@6 | |
2977 | |
2978 v1 = this; | |
2979 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2980 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2981 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2982 v5 = v1->pActiveSkills[5]; | |
2983 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2984 v4 += v1->pActiveSkills[5] & 0x3F; | |
2985 if ( v4 >= 1 ) | |
2986 result = v4; | |
2987 else | |
2988 result = 0; | |
2989 return result; | |
2990 } | |
2991 | |
2992 //----- (0048D191) -------------------------------------------------------- | |
2993 int Player::GetRangedDamageMax() | |
2994 { | |
2995 Player *v1; // esi@1 | |
2996 int v2; // edi@1 | |
2997 int v3; // edi@1 | |
2998 int v4; // edi@1 | |
2999 unsigned __int16 v5; // ax@1 | |
3000 int result; // eax@6 | |
3001 | |
3002 v1 = this; | |
3003 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
3004 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3005 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3006 v5 = v1->pActiveSkills[5]; | |
3007 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3008 v4 += v1->pActiveSkills[5] & 0x3F; | |
3009 if ( v4 >= 1 ) | |
3010 result = v4; | |
3011 else | |
3012 result = 0; | |
3013 return result; | |
3014 } | |
3015 | |
3016 //----- (0048D1FE) -------------------------------------------------------- | |
3017 bool Player::CalculateRangedDamageTo(int a2) | |
3018 { | |
3019 Player *v2; // ebx@1 | |
3020 bool result; // eax@1 | |
3021 ItemGen *v4; // ebx@2 | |
3022 unsigned int v5; // edi@2 | |
3023 unsigned int v6; // esi@2 | |
3024 int v7; // edx@4 | |
3025 char v8; // zf@4 | |
3026 int v9; // esi@5 | |
3027 int v10; // ebx@6 | |
3028 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3029 unsigned __int16 v12; // ax@19 | |
3030 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3031 Player *v14; // [sp+4h] [bp-10h]@1 | |
3032 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3033 int v16; // [sp+Ch] [bp-8h]@3 | |
3034 int v17; // [sp+10h] [bp-4h]@1 | |
3035 | |
3036 v17 = 0; | |
3037 v2 = this; | |
3038 v14 = this; | |
3039 result = HasItemEquipped(EQUIP_BOW); | |
3040 if ( !result ) | |
3041 return result; | |
232 | 3042 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3043 v5 = v4->uItemID; |
3044 v6 = v4->uItemID; | |
3045 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3046 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3047 { | |
3048 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3049 do | |
3050 { | |
3051 v7 = rand() % v15; | |
3052 v8 = v16-- == 1; | |
3053 v17 += v7 + 1; | |
3054 } | |
3055 while ( !v8 ); | |
3056 } | |
3057 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3058 if ( a2 ) | |
3059 { | |
377 | 3060 v10 = v4->uSpecEnchantmentType; |
0 | 3061 if ( v10 == 64 ) |
3062 { | |
3063 v11 = (MONSTER_SUPERTYPE)1; | |
3064 goto LABEL_17; | |
3065 } | |
3066 if ( v10 == 39 || v5 == 508 ) | |
3067 { | |
3068 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3069 goto LABEL_16; | |
3070 } | |
3071 if ( v10 == 40 ) | |
3072 { | |
3073 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3074 goto LABEL_16; | |
3075 } | |
3076 if ( v10 == 63 || v5 == 517 ) | |
3077 { | |
3078 v13 = MONSTER_SUPERTYPE_ELF; | |
3079 LABEL_16: | |
3080 v11 = v13; | |
3081 LABEL_17: | |
3082 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3083 v9 *= 2; | |
3084 goto LABEL_19; | |
3085 } | |
3086 } | |
3087 LABEL_19: | |
3088 v12 = v14->pActiveSkills[5]; | |
3089 if ( v12 ) | |
3090 { | |
3091 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3092 v9 += v14->pActiveSkills[5] & 0x3F; | |
3093 } | |
3094 return v9; | |
3095 } | |
3096 | |
3097 //----- (0048D2EA) -------------------------------------------------------- | |
3098 char *Player::GetMeleeDamageString() | |
3099 { | |
3100 Player *v1; // esi@1 | |
3101 signed int v2; // eax@1 | |
3102 signed int v3; // edi@3 | |
3103 signed int v4; // eax@3 | |
3104 signed int v5; // ST0C_4@6 | |
3105 char *v6; // edi@6 | |
3106 signed int v7; // ST08_4@7 | |
3107 unsigned int v8; // eax@8 | |
3108 signed int v9; // esi@9 | |
3109 | |
3110 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3111 | |
3112 v1 = this; | |
232 | 3113 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3114 if ( v2 < 64 || v2 > 65 ) |
3115 { | |
3116 v3 = GetMeleeDamageMinimal(); | |
3117 v4 = GetMeleeDamageMaximal(); | |
3118 } | |
3119 else | |
3120 { | |
3121 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3122 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3123 } | |
3124 if ( v3 == v4 ) | |
3125 { | |
3126 v5 = v3; | |
3127 v6 = player__getmeleedamagestring_static_buff; | |
3128 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3129 } | |
3130 else | |
3131 { | |
3132 v7 = v3; | |
3133 v6 = player__getmeleedamagestring_static_buff; | |
3134 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3135 } | |
3136 v8 = v1->pEquipment.uMainHand; | |
3137 if ( v8 ) | |
3138 { | |
232 | 3139 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3140 if ( v9 >= 135 ) |
3141 { | |
3142 if ( v9 <= 159 ) | |
3143 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3144 } | |
3145 } | |
3146 return v6; | |
3147 } | |
3148 | |
3149 //----- (0048D396) -------------------------------------------------------- | |
3150 char *Player::GetRangedDamageString() | |
3151 { | |
3152 Player *v1; // esi@1 | |
3153 signed int v2; // eax@1 | |
3154 int v3; // edi@3 | |
3155 int v4; // eax@3 | |
3156 char *v5; // edi@6 | |
3157 int v6; // ST0C_4@8 | |
3158 int v7; // ST08_4@9 | |
3159 unsigned int v8; // eax@10 | |
3160 signed int v9; // esi@11 | |
3161 | |
3162 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3163 | |
3164 v1 = this; | |
232 | 3165 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3166 if ( v2 < 64 || v2 > 65 ) |
3167 { | |
3168 v3 = GetRangedDamageMin(); | |
3169 v4 = GetRangedDamageMax(); | |
3170 } | |
3171 else | |
3172 { | |
3173 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3174 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3175 } | |
3176 if ( v4 ) | |
3177 { | |
3178 if ( v3 == v4 ) | |
3179 { | |
3180 v6 = v3; | |
3181 v5 = player__getrangeddamagestring_static_buff; | |
3182 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3183 } | |
3184 else | |
3185 { | |
3186 v7 = v3; | |
3187 v5 = player__getrangeddamagestring_static_buff; | |
3188 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3189 } | |
3190 } | |
3191 else | |
3192 { | |
3193 v5 = player__getrangeddamagestring_static_buff; | |
3194 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3195 } | |
3196 v8 = v1->pEquipment.uMainHand; | |
3197 if ( v8 ) | |
3198 { | |
232 | 3199 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3200 if ( v9 >= 135 ) |
3201 { | |
3202 if ( v9 <= 159 ) | |
3203 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3204 } | |
3205 } | |
3206 return v5; | |
3207 } | |
3208 | |
3209 //----- (0048D45A) -------------------------------------------------------- | |
3210 bool Player::CanTrainToNextLevel() | |
3211 { | |
3212 int v1; // edx@1 | |
3213 int v2; // eax@1 | |
3214 int i; // esi@1 | |
3215 | |
3216 v1 = this->uLevel; | |
3217 v2 = 0; | |
3218 for ( i = 0; i < v1; ++i ) | |
3219 v2 += i + 1; | |
3220 return (signed __int64)this->uExperience >= 1000 * v2; | |
3221 } | |
3222 | |
3223 //----- (0048D498) -------------------------------------------------------- | |
3224 unsigned int Player::GetExperienceDisplayColor() | |
3225 { | |
3226 unsigned int result; // eax@2 | |
3227 | |
3228 if ( CanTrainToNextLevel() ) | |
3229 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
3230 else | |
3231 result = 0; | |
3232 return result; | |
3233 } | |
3234 | |
3235 //----- (0048D4B3) -------------------------------------------------------- | |
3236 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3237 { | |
3238 Player *v3; // esi@1 | |
3239 int v4; // edi@8 | |
3240 int v6; // eax@21 | |
3241 signed int v7; // ebx@21 | |
3242 int v8; // eax@22 | |
3243 signed int v9; // ebx@22 | |
3244 int v10; // eax@23 | |
3245 signed int v11; // ebx@23 | |
3246 int v12; // eax@24 | |
3247 signed int v13; // edi@24 | |
3248 unsigned int v14; // eax@27 | |
3249 int v15; // eax@29 | |
3250 double v16; // st7@32 | |
3251 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3252 signed int v18; // [sp+8h] [bp-4h]@17 | |
3253 | |
3254 v3 = this; | |
3255 if ( !resistance ) | |
3256 { | |
3257 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3258 goto LABEL_16; | |
3259 } | |
3260 if ( resistance == 1 ) | |
3261 { | |
3262 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3263 goto LABEL_16; | |
3264 } | |
3265 if ( resistance == 2 ) | |
3266 { | |
3267 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3268 goto LABEL_16; | |
3269 } | |
3270 if ( resistance == 3 ) | |
3271 { | |
3272 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3273 goto LABEL_16; | |
3274 } | |
3275 if ( resistance == 6 ) | |
3276 { | |
3277 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3278 goto LABEL_16; | |
3279 } | |
3280 if ( resistance == 7 ) | |
3281 { | |
3282 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3283 goto LABEL_16; | |
3284 } | |
3285 if ( resistance == 8 ) | |
3286 { | |
3287 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3288 LABEL_16: | |
3289 v4 = GetActualResistance(v17); | |
3290 goto LABEL_17; | |
3291 } | |
3292 v4 = 0; | |
3293 LABEL_17: | |
3294 v18 = type; | |
135 | 3295 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3296 return 0; |
3297 if ( v4 ) | |
3298 { | |
3299 v6 = GetActualLuck(); | |
3300 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3301 if ( rand() % v7 >= 30 ) | |
3302 { | |
3303 v18 = type >> 1; | |
3304 v8 = GetActualLuck(); | |
3305 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3306 if ( rand() % v9 >= 30 ) | |
3307 { | |
3308 v18 = type >> 2; | |
3309 v10 = GetActualLuck(); | |
3310 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3311 if ( rand() % v11 >= 30 ) | |
3312 { | |
3313 v18 = type >> 3; | |
3314 v12 = GetActualLuck(); | |
3315 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3316 if ( rand() % v13 >= 30 ) | |
3317 v18 = type >> 4; | |
3318 } | |
3319 } | |
3320 } | |
3321 } | |
3322 if ( resistance == 4 ) | |
3323 { | |
3324 v14 = v3->pEquipment.uBody; | |
3325 if ( v14 ) | |
3326 { | |
3327 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3328 { | |
3329 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3330 if ( v15 ) | |
3331 { | |
3332 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3333 return v18; | |
3334 v16 = (double)v18 * 0.5; | |
3335 return (signed __int64)v16; | |
3336 } | |
3337 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3338 { | |
3339 v16 = (double)v18 * 0.66670001; | |
3340 return (signed __int64)v16; | |
3341 } | |
3342 } | |
3343 } | |
3344 } | |
3345 return v18; | |
3346 } | |
3347 | |
3348 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3349 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3350 { | |
3351 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3352 } |
3353 | |
3354 //----- (0048D651) -------------------------------------------------------- | |
816 | 3355 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3356 { | |
3357 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3358 } |
3359 | |
3360 //----- (0048D676) -------------------------------------------------------- | |
3361 bool Player::IsUnarmed() | |
3362 { | |
816 | 3363 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3364 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3365 } |
3366 | |
3367 //----- (0048D6AA) -------------------------------------------------------- | |
3368 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3369 { | |
3370 auto i = pEquipment.pIndices[uEquipIndex]; | |
3371 if (i) | |
3372 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3373 else return false; | |
3374 } | |
3375 | |
3376 //----- (0048D6D0) -------------------------------------------------------- | |
3377 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3378 { | |
3379 for (uint i = 0; i < 16; ++i) | |
3380 { | |
3381 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3382 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3383 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3384 return true; | |
3385 } | |
3386 return false; | |
3387 } | |
3388 | |
3389 //----- (0048D709) -------------------------------------------------------- | |
3390 bool Player::WearsItem(int a1, signed int a2) | |
3391 { | |
3392 int v3; // edx@2 | |
3393 Player *v4; // ecx@2 | |
3394 int v6; // esi@5 | |
3395 int v7; // edx@6 | |
3396 | |
3397 if ( a2 >= 16 ) | |
3398 { | |
3399 v6 = 0; | |
3400 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3401 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3402 { |
3403 ++v6; | |
3404 if ( (signed int)v6 >= 16 ) | |
3405 return 0; | |
3406 } | |
3407 return 1; | |
3408 } | |
727 | 3409 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3410 return 1; |
3411 return 0; | |
3412 } | |
3413 | |
3414 //----- (0048D76C) -------------------------------------------------------- | |
3415 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3416 { | |
3417 unsigned __int16 v6; // cx@8 | |
3418 int v7; // edi@8 | |
3419 unsigned int v8; // ebx@8 | |
3420 unsigned int v9; // esi@8 | |
3421 int v10; // eax@8 | |
3422 int v11; // edi@12 | |
3423 bool result; // eax@13 | |
3424 | |
3425 if ( !a2 | |
3426 || this->pConditions[16] | |
3427 || this->pConditions[14] | |
3428 || this->pConditions[15] | |
3429 || this->pConditions[4] | |
3430 || this->pConditions[13] | |
3431 || this->pConditions[2] ) | |
3432 { | |
3433 result = 0; | |
3434 } | |
3435 else | |
3436 { | |
3437 v6 = this->pActiveSkills[34]; | |
3438 v7 = v6 & 0x3F; | |
3439 v8 = SkillToMastery(v6); | |
3440 v9 = a2->GetValue(); | |
3441 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3442 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3443 v9 *= 3; | |
3444 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3445 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3446 if ( rand() % 100 >= 5 ) | |
3447 { | |
3448 if ( *a6 > v11 ) | |
3449 result = *a6 - v11 < 500; | |
3450 else | |
3451 result = 2; | |
3452 } | |
3453 else | |
3454 { | |
3455 result = 0; | |
3456 } | |
3457 } | |
3458 return result; | |
3459 } | |
3460 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3461 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3462 | |
3463 //----- (0048D88B) -------------------------------------------------------- | |
3464 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3465 { | |
3466 Player *v4; // esi@1 | |
3467 Actor *v5; // edi@1 | |
3468 unsigned __int16 v6; // cx@10 | |
3469 int v7; // ebx@10 | |
3470 unsigned int v8; // esi@10 | |
3471 int v9; // eax@10 | |
3472 int v10; // esi@10 | |
3473 int v11; // eax@13 | |
3474 signed int v12; // ebx@15 | |
3475 signed int v13; // edx@15 | |
3476 int v14; // ecx@15 | |
3477 unsigned __int16 v15; // si@21 | |
3478 unsigned int v16; // ebx@24 | |
3479 int v17; // esi@24 | |
3480 const void *v18; // eax@29 | |
3481 unsigned int v19; // esi@31 | |
3482 int v20; // eax@34 | |
3483 char v21; // zf@36 | |
3484 unsigned int v22; // ST0C_4@39 | |
3485 char *v23; // esi@39 | |
3486 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3487 int v26; // [sp-8h] [bp-44h]@40 | |
3488 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3489 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3490 int v29; // [sp+30h] [bp-Ch]@10 | |
3491 int v30; // [sp+34h] [bp-8h]@10 | |
3492 Player *v31; // [sp+38h] [bp-4h]@1 | |
3493 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3494 | |
3495 v4 = this; | |
3496 v5 = &pActors[uActorID]; | |
3497 v31 = this; | |
3498 if ( &pActors[uActorID] | |
3499 && !this->pConditions[16] | |
3500 && !this->pConditions[14] | |
3501 && !this->pConditions[15] | |
3502 && !this->pConditions[4] | |
3503 && !this->pConditions[13] | |
3504 && !this->pConditions[2] ) | |
3505 { | |
3506 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3507 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3508 v6 = v4->pActiveSkills[34]; | |
3509 v7 = v6 & 0x3F; | |
3510 v8 = SkillToMastery(v6); | |
3511 v9 = rand(); | |
3512 v28 = 4 * v8; | |
3513 v30 = dword_4EDEA0[v8]; | |
3514 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3515 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3516 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3517 { | |
322 | 3518 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3519 _steal_perma = 0; |
3520 v26 = (int)v31->pName; | |
3521 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3522 } | |
3523 else | |
3524 { | |
3525 v11 = rand(); | |
3526 if ( v11 % 100 >= 40 ) | |
3527 { | |
3528 if ( v11 % 100 >= 70 ) | |
3529 { | |
3530 v19 = 0; | |
3531 if ( v7 > 0 ) | |
3532 { | |
3533 do | |
3534 { | |
3535 --v7; | |
3536 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3537 } | |
3538 while ( v7 ); | |
3539 } | |
3540 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3541 return _steal_perma; | |
377 | 3542 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3543 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3544 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3545 v21 = *(int *)v20 == v19; |
3546 *(int *)v20 -= v19; | |
3547 if ( v21 ) | |
3548 v5->array_000234[3].uItemID = 0; | |
3549 if ( v19 ) | |
3550 { | |
3551 party_finds_gold(v19, 2); | |
3552 v22 = v19; | |
3553 v23 = pTmpBuf2; | |
3554 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3555 LABEL_43: | |
3556 ShowStatusBarString(v23, 2u); | |
3557 return _steal_perma; | |
3558 } | |
3559 } | |
3560 else | |
3561 { | |
3562 v27.Reset(); | |
3563 v12 = 0; | |
3564 v13 = 0; | |
3565 v14 = (int)v5->array_000234; | |
3566 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3567 { | |
3568 ++v13; | |
3569 v14 += 36; | |
3570 if ( v13 >= 4 ) | |
3571 goto LABEL_21; | |
3572 } | |
3573 v12 = 1; | |
3574 LABEL_21: | |
3575 v15 = v5->uCarriedItemID; | |
3576 if ( v15 || v12 ) | |
3577 { | |
3578 v27.Reset(); | |
3579 if ( v15 ) | |
3580 { | |
3581 v16 = (signed __int16)v15; | |
3582 v5->uCarriedItemID = 0; | |
3583 v27.uItemID = (signed __int16)v15; | |
3584 v17 = (signed __int16)v15; | |
3585 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3586 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3587 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3588 { | |
3589 if ( v16 != 220 ) | |
570 | 3590 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3591 } |
3592 } | |
3593 else | |
3594 { | |
3595 v18 = &v5->array_000234[rand() % 4]; | |
3596 memcpy(&v27, v18, sizeof(v27)); | |
3597 ((ItemGen *)v18)->Reset(); | |
3598 v16 = v27.uItemID; | |
3599 } | |
3600 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3601 sprintf( | |
3602 pTmpBuf2, | |
3603 pGlobalTXT_LocalizationStrings[304], | |
3604 v31->pName, | |
3605 pItemsTable->pItems[v16].pUnidentifiedName); | |
3606 ShowStatusBarString(pTmpBuf2, 2u); | |
3607 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3608 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3609 pMouse->SetCursorBitmapFromItemID(v16); | |
3610 return _steal_perma; | |
3611 } | |
3612 } | |
3613 } | |
3614 v26 = (int)v31->pName; | |
3615 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3616 } | |
3617 v23 = pTmpBuf2; | |
809 | 3618 sprintfex(pTmpBuf2, v25, v26); |
0 | 3619 goto LABEL_43; |
3620 } | |
3621 return 0; | |
3622 } | |
3623 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3624 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3625 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3626 | |
3627 //----- (0048DBB9) -------------------------------------------------------- | |
3628 void Player::Heal(int amount) | |
3629 { | |
3630 Player *v2; // esi@1 | |
3631 signed int v3; // eax@3 | |
3632 | |
3633 v2 = this; | |
3634 if ( !this->pConditions[16] && !this->pConditions[14] ) | |
3635 { | |
3636 v3 = GetMaxHealth(); | |
3637 if ( v2->pConditions[17] ) | |
3638 v3 /= 2; | |
3639 v2->sHealth += amount; | |
3640 if ( v2->sHealth > v3 ) | |
3641 v2->sHealth = v3; | |
3642 if ( v2->pConditions[13] ) | |
3643 { | |
3644 if ( v2->sHealth > 0 ) | |
3645 { | |
3646 LODWORD(v2->pConditions[13]) = 0; | |
3647 HIDWORD(v2->pConditions[13]) = 0; | |
3648 } | |
3649 } | |
3650 } | |
3651 } | |
3652 | |
3653 //----- (0048DC1E) -------------------------------------------------------- | |
3654 int Player::ReceiveDamage(signed int type, int resistance) | |
3655 { | |
3656 Player *v3; // esi@1 | |
3657 signed int v4; // eax@1 | |
3658 int v5; // eax@1 | |
3659 bool v6; // ebx@1 | |
3660 unsigned int v7; // eax@8 | |
3661 char *v8; // ecx@9 | |
3662 int v9; // eax@9 | |
187 | 3663 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3664 |
3665 v3 = this; | |
3666 this->pConditions[2] = 0i64; | |
3667 v4 = CalculateIncommingDamage(resistance, type); | |
3668 v3->sHealth -= v4; | |
187 | 3669 //typea = v4; |
0 | 3670 v5 = v3->sHealth; |
3671 v6 = v5 < -10; | |
3672 LOBYTE(v6) = v5 <= -10; | |
3673 if ( v5 < 1 ) | |
3674 { | |
3675 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3676 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) | |
3677 { | |
3678 SetCondition(0xDu, 0); | |
3679 } | |
3680 else | |
3681 { | |
3682 SetCondition(0xEu, 0); | |
3683 v6 = LODWORD(pParty->uTimePlayed); | |
3684 if ( v3->sHealth > 0 ) | |
3685 v3->sHealth = 0; | |
3686 } | |
3687 if ( v6 ) | |
3688 { | |
3689 v7 = v3->pEquipment.uBody; | |
3690 if ( v7 ) | |
3691 { | |
3692 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3693 v9 = *(int *)v8; | |
3694 if ( !(BYTE1(v9) & 2) ) | |
3695 { | |
3696 LOBYTE(v9) = v9 | 2; | |
3697 *(int *)v8 = v9; | |
3698 } | |
3699 } | |
3700 } | |
3701 } | |
187 | 3702 if ( v4 && CanAct() ) |
3703 PlaySound(SPEECH_24, 0); | |
3704 return v4; | |
0 | 3705 } |
3706 | |
3707 //----- (0048DCF6) -------------------------------------------------------- | |
3708 int Player::_48DCF6(int a2, Actor *pActor) | |
3709 { | |
3710 signed int v3; // edi@1 | |
3711 signed int v4; // ebx@1 | |
3712 Player *v5; // esi@1 | |
3713 int v6; // eax@2 | |
3714 int v7; // eax@5 | |
3715 int v8; // eax@8 | |
3716 int v9; // ebx@8 | |
3717 int v10; // eax@8 | |
3718 int v11; // ebx@8 | |
3719 signed int v12; // edx@9 | |
3720 ItemGen *v13; // eax@9 | |
3721 int v14; // edx@16 | |
3722 unsigned int v15; // edx@17 | |
3723 int v16; // edx@26 | |
3724 unsigned int v17; // edx@27 | |
3725 Player *v18; // ecx@32 | |
3726 signed int v19; // edx@38 | |
3727 int *v20; // ecx@38 | |
3728 signed int v21; // eax@40 | |
3729 int v22; // eax@49 | |
3730 signed int v23; // ebx@49 | |
3731 unsigned int v24; // eax@60 | |
3732 int v25; // ecx@61 | |
3733 int v26; // ebx@74 | |
3734 void *v27; // ecx@76 | |
3735 unsigned int v28; // ebx@78 | |
3736 signed int result; // eax@86 | |
3737 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3738 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3739 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3740 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3741 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3742 int v35; // [sp-Ch] [bp-ACh]@56 | |
3743 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3744 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3745 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3746 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3747 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3748 int v41; // [sp-4h] [bp-A4h]@51 | |
3749 int v42; // [sp-4h] [bp-A4h]@56 | |
3750 int v43; // [sp-4h] [bp-A4h]@57 | |
3751 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3752 int v45; // [sp-4h] [bp-A4h]@68 | |
3753 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3754 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3755 int v48; // [sp+9Ch] [bp-4h]@1 | |
3756 | |
3757 v3 = 0; | |
3758 v4 = 0; | |
3759 v5 = this; | |
3760 v47 = 0; | |
3761 v48 = 0; | |
3762 switch ( a2 ) | |
3763 { | |
3764 case 1: | |
3765 v6 = GetActualWillpower(); | |
3766 goto LABEL_46; | |
3767 case 2: | |
3768 case 3: | |
3769 case 4: | |
3770 case 9: | |
3771 case 10: | |
3772 case 11: | |
3773 case 13: | |
3774 case 21: | |
3775 v6 = GetActualEndurance(); | |
3776 goto LABEL_46; | |
3777 case 5: | |
3778 case 12: | |
3779 case 23: | |
3780 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3781 goto LABEL_5; | |
3782 case 15: | |
3783 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3784 goto LABEL_5; | |
3785 case 6: | |
3786 case 7: | |
3787 case 8: | |
3788 case 14: | |
3789 case 16: | |
3790 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3791 LABEL_5: | |
3792 v7 = GetActualResistance(v40); | |
3793 goto LABEL_47; | |
3794 case 22: | |
3795 v8 = GetActualWillpower(); | |
3796 v9 = _48EA1B_get_static_effect(v8); | |
3797 v10 = GetActualIntelligence(); | |
3798 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3799 break; | |
3800 case 17: | |
3801 v12 = 0; | |
3802 v13 = this->pInventoryItems; | |
3803 do | |
3804 { | |
315 | 3805 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3806 v46[v4++] = v12; |
3807 ++v12; | |
3808 ++v13; | |
3809 } | |
3810 while ( v12 < 138 ); | |
3811 goto LABEL_36; | |
3812 case 18: | |
3813 v14 = 0; | |
3814 do | |
3815 { | |
3816 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3817 { | |
816 | 3818 if ( v15 == EQUIP_ARMOUR ) |
0 | 3819 v46[v4++] = LOBYTE(v5->pEquipment.uBody) - 1; |
816 | 3820 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
0 | 3821 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v15) - 1; |
3822 } | |
3823 v14 = v15 + 1; | |
3824 } | |
3825 while ( v14 < 16 ); | |
3826 goto LABEL_36; | |
3827 case 19: | |
3828 v16 = 0; | |
3829 do | |
3830 { | |
3831 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3832 { | |
3833 if ( v17 == 2 ) | |
3834 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3835 if ( (!v17 || v17 == 1) | |
816 | 3836 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
0 | 3837 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v17) - 1; |
3838 } | |
3839 v16 = v17 + 1; | |
3840 } | |
3841 while ( v16 < 16 ); | |
3842 LABEL_36: | |
3843 if ( !v4 ) | |
3844 goto LABEL_87; | |
3845 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3846 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3847 break; | |
3848 case 20: | |
3849 v19 = 0; | |
3850 v20 = this->pInventoryIndices; | |
3851 do | |
3852 { | |
3853 if ( *v20 > 0 ) | |
3854 { | |
232 | 3855 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3856 if ( v21 > 0 ) |
3857 { | |
3858 if ( v21 <= 134 ) | |
3859 v46[v4++] = v19; | |
3860 } | |
3861 } | |
3862 ++v19; | |
3863 ++v20; | |
3864 } | |
3865 while ( v19 < 126 ); | |
3866 if ( !v4 ) | |
3867 goto LABEL_87; | |
3868 v47 = (unsigned __int8)v46[rand() % v4]; | |
3869 v6 = GetActualAccuracy(); | |
3870 LABEL_46: | |
3871 v7 = _48EA1B_get_static_effect(v6); | |
3872 LABEL_47: | |
3873 v11 = v7; | |
3874 break; | |
3875 default: | |
3876 v11 = 0; | |
3877 break; | |
3878 } | |
3879 v22 = GetActualLuck(); | |
3880 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3881 if ( rand() % v23 >= 30 ) | |
3882 { | |
3883 LABEL_87: | |
3884 result = 0; | |
3885 } | |
3886 else | |
3887 { | |
3888 switch ( a2 ) | |
3889 { | |
3890 case 1: | |
3891 v41 = 1; | |
3892 v36 = 0; | |
3893 goto LABEL_56; | |
3894 case 2: | |
3895 v41 = 1; | |
3896 v36 = 1; | |
3897 goto LABEL_56; | |
3898 case 3: | |
3899 v41 = 1; | |
3900 v36 = 2; | |
3901 goto LABEL_56; | |
3902 case 23: | |
3903 v41 = 1; | |
3904 v36 = 3; | |
3905 goto LABEL_56; | |
3906 case 4: | |
3907 v41 = 1; | |
3908 v36 = 4; | |
3909 LABEL_56: | |
3910 SetCondition(v36, v41); | |
3911 v42 = 0; | |
3912 v37 = 0; | |
3913 v35 = 0; | |
3914 v34 = 0; | |
3915 v33 = -1; | |
3916 v32 = 0; | |
3917 v31 = 0; | |
3918 v30 = (SoundID)221; | |
3919 goto LABEL_83; | |
3920 case 5: | |
3921 v43 = 1; | |
3922 v38 = 5; | |
3923 goto LABEL_70; | |
3924 case 6: | |
3925 case 7: | |
3926 case 8: | |
3927 if ( a2 == 6 ) | |
3928 { | |
3929 v44 = 6; | |
3930 goto LABEL_60; | |
3931 } | |
3932 v25 = 2 * (a2 != 8) + 8; | |
3933 goto LABEL_65; | |
3934 case 9: | |
3935 if ( a2 == 6 ) | |
3936 { | |
3937 v44 = 7; | |
3938 LABEL_60: | |
3939 v24 = v44; | |
3940 } | |
3941 else | |
3942 { | |
3943 v25 = 2 * (a2 != 8) + 9; | |
3944 LABEL_65: | |
3945 v24 = v25; | |
3946 } | |
3947 SetCondition(v24, 1); | |
3948 v42 = 0; | |
3949 v37 = 0; | |
3950 v35 = 0; | |
3951 v34 = 0; | |
3952 v33 = -1; | |
3953 v32 = 0; | |
3954 v31 = 0; | |
3955 v30 = (SoundID)222; | |
3956 LABEL_83: | |
3957 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3958 do | |
3959 { | |
3960 LABEL_84: | |
3961 if ( v5 == pPlayers[v3 + 1] ) | |
3962 break; | |
3963 ++v3; | |
3964 } | |
3965 while ( v3 < 4 ); | |
3966 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3967 result = 1; | |
3968 break; | |
3969 case 12: | |
3970 v43 = 1; | |
3971 v38 = 12; | |
3972 goto LABEL_70; | |
3973 case 15: | |
3974 v45 = 1; | |
3975 v39 = 15; | |
3976 goto LABEL_73; | |
3977 case 13: | |
3978 v43 = 1; | |
3979 v38 = 13; | |
3980 LABEL_70: | |
3981 SetCondition(v38, v43); | |
3982 v42 = 0; | |
3983 v37 = 0; | |
3984 v35 = 0; | |
3985 v34 = 0; | |
3986 v33 = -1; | |
3987 v32 = 0; | |
3988 v31 = 0; | |
3989 v30 = (SoundID)224; | |
3990 goto LABEL_83; | |
3991 case 14: | |
3992 v45 = 1; | |
3993 v39 = 14; | |
3994 goto LABEL_73; | |
3995 case 16: | |
3996 v45 = 1; | |
3997 v39 = 16; | |
3998 LABEL_73: | |
3999 SetCondition(v39, v45); | |
4000 v42 = 0; | |
4001 v37 = 0; | |
4002 v35 = 0; | |
4003 v34 = 0; | |
4004 v33 = -1; | |
4005 v32 = 0; | |
4006 v31 = 0; | |
4007 v30 = (SoundID)225; | |
4008 goto LABEL_83; | |
4009 case 17: | |
4010 case 18: | |
4011 case 19: | |
4012 v26 = v48; | |
4013 if ( *(char *)(v48 + 21) & 2 ) | |
4014 goto LABEL_84; | |
187 | 4015 PlaySound(SPEECH_40, 0); |
0 | 4016 *(int *)(v26 + 20) |= 2u; |
4017 goto LABEL_79; | |
4018 case 20: | |
187 | 4019 PlaySound(SPEECH_40, 0); |
0 | 4020 v27 = pActor->array_000234; |
4021 if ( pActor->array_000234[0].uItemID ) | |
4022 { | |
4023 v27 = &pActor->array_000234[1]; | |
4024 if ( pActor->array_000234[1].uItemID ) | |
4025 goto LABEL_84; | |
4026 } | |
4027 v28 = v47; | |
654 | 4028 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 4029 RemoveItemAtInventoryIndex(v28); |
4030 LABEL_79: | |
4031 v42 = 0; | |
4032 v37 = 0; | |
4033 v35 = 0; | |
4034 v34 = 0; | |
4035 v33 = -1; | |
4036 v32 = 0; | |
4037 v31 = 0; | |
4038 v30 = (SoundID)47; | |
4039 goto LABEL_83; | |
4040 case 21: | |
187 | 4041 PlaySound(SPEECH_42, 0); |
0 | 4042 ++v5->sAgeModifier; |
4043 goto LABEL_82; | |
4044 case 22: | |
187 | 4045 PlaySound(SPEECH_41, 0); |
0 | 4046 v5->sMana = 0; |
4047 LABEL_82: | |
4048 v42 = 0; | |
4049 v37 = 0; | |
4050 v35 = 0; | |
4051 v34 = 0; | |
4052 v33 = -1; | |
4053 v32 = 0; | |
4054 v31 = 0; | |
4055 v30 = (SoundID)226; | |
4056 goto LABEL_83; | |
4057 default: | |
4058 goto LABEL_87; | |
4059 } | |
4060 } | |
4061 return result; | |
4062 } | |
324 | 4063 |
0 | 4064 // 48DCF6: using guessed type char var_94[140]; |
4065 | |
4066 //----- (0048E1A3) -------------------------------------------------------- | |
4067 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4068 { | |
4069 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4070 } | |
4071 | |
4072 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4073 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4074 { | |
4075 ItemGen *weapon = nullptr; | |
4076 ItemDesc *weapon_desc = nullptr; | |
4077 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4078 if (bRangedAttack) | |
0 | 4079 { |
4080 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4081 goto LABEL_17; | |
816 | 4082 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4083 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4084 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4085 goto LABEL_17; | |
4086 } | |
4087 else if ( IsUnarmed() == 1 ) | |
4088 { | |
4089 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4090 { | |
4091 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4092 goto LABEL_17; |
4093 } | |
4094 } | |
816 | 4095 |
4096 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4097 { | |
4098 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4099 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4100 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4101 { | |
4102 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4103 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4104 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4105 } | |
0 | 4106 else |
816 | 4107 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4108 } | |
4109 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
4110 { | |
4111 auto v12 = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4112 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; | |
4113 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4114 { | |
4115 weapon = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4116 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4117 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4118 } | |
4119 } | |
4120 | |
0 | 4121 LABEL_17: |
816 | 4122 uint armour_recovery = 0; |
0 | 4123 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4124 { | |
816 | 4125 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uBody - 1].uItemID].uSkillType; |
4126 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; | |
4127 | |
4128 float armour_recovery_multipliers[4]; | |
4129 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4130 { | |
4131 armour_recovery_multipliers[0] = 1.0f; | |
4132 armour_recovery_multipliers[1] = 0; | |
4133 armour_recovery_multipliers[2] = 0; | |
4134 armour_recovery_multipliers[3] = 0; | |
4135 } | |
4136 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4137 { | |
4138 armour_recovery_multipliers[0] = 1.0f; | |
4139 armour_recovery_multipliers[1] = 0.5f; | |
4140 armour_recovery_multipliers[2] = 0; | |
4141 armour_recovery_multipliers[3] = 0; | |
4142 } | |
4143 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4144 { | |
4145 armour_recovery_multipliers[0] = 1.0f; | |
4146 armour_recovery_multipliers[1] = 0.5f; | |
4147 armour_recovery_multipliers[2] = 0.5f; | |
4148 armour_recovery_multipliers[3] = 0; | |
0 | 4149 } |
4150 else | |
4151 { | |
816 | 4152 assert(false && "Unknown armour type"); // what kind of armour is that? |
4153 armour_recovery_multipliers[0] = 1.0f; | |
4154 armour_recovery_multipliers[1] = 1.0f; | |
4155 armour_recovery_multipliers[2] = 1.0f; | |
4156 armour_recovery_multipliers[3] = 1.0f; | |
4157 } | |
4158 | |
4159 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4160 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4161 } | |
4162 | |
4163 uint shield_recovery = 0; | |
4164 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4165 { | |
4166 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4167 | |
4168 auto shield = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4169 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; | |
4170 | |
4171 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4172 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4173 } | |
4174 | |
4175 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4176 sword_axe_bow_recovery_reduction = 0; | |
4177 bool shooting_laser = false; | |
4178 if (weapon_desc) | |
4179 { | |
4180 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4181 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4182 { | |
4183 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4184 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4185 } | |
4186 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4187 shooting_laser = true; | |
4188 } | |
4189 | |
4190 uint armsmaster_recovery_reduction = 0; | |
4191 if (!bRangedAttack && !shooting_laser) | |
4192 { | |
4193 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4194 { | |
4195 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4196 if (SkillToMastery(armsmaster_level) >= 4) | |
4197 armsmaster_recovery_reduction *= 2; | |
4198 } | |
4199 } | |
4200 | |
4201 uint v41 = 0; | |
4202 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4203 v41 = 25; |
816 | 4204 |
4205 uint weapon_enchantment_recovery_reduction = 0; | |
4206 if ( weapon ) | |
4207 { | |
4208 if (weapon->uSpecEnchantmentType == 59 || | |
4209 weapon->uSpecEnchantmentType == 41 || | |
4210 weapon->uSpecEnchantmentType == 500) | |
4211 weapon_enchantment_recovery_reduction = 20; | |
4212 } | |
4213 | |
4214 | |
4215 int recovery = weapon_recovery + | |
4216 armour_recovery + | |
4217 shield_recovery | |
4218 - armsmaster_recovery_reduction | |
4219 - weapon_enchantment_recovery_reduction | |
4220 - v41 | |
4221 - sword_axe_bow_recovery_reduction | |
4222 - player_speed_recovery_reduction; | |
4223 | |
4224 if (recovery < 0) | |
4225 recovery = 0; | |
4226 return recovery; | |
0 | 4227 } |
4228 | |
4229 //----- (0048E4F8) -------------------------------------------------------- | |
4230 int Player::GetMaxHealth() | |
4231 { | |
4232 int v3; // esi@1 | |
4233 int v4; // esi@1 | |
4234 int v6; // esi@1 | |
4235 | |
4236 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4237 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4238 v6 = uFullHealthBonus |
135 | 4239 + pBaseHealthByClass[classType / 4] |
0 | 4240 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4241 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4242 if (v6 <= 0) | |
4243 return 1; | |
4244 return v6; | |
4245 } | |
4246 | |
4247 //----- (0048E565) -------------------------------------------------------- | |
4248 int Player::GetMaxMana() | |
4249 { | |
4250 int v2; // eax@2 | |
4251 int v3; // esi@4 | |
4252 int v4; // eax@5 | |
4253 int v5; // esi@5 | |
4254 int v6; // eax@5 | |
4255 int v7; // esi@6 | |
4256 int v8; // esi@6 | |
4257 int v9; // esi@6 | |
4258 int result; // eax@7 | |
4259 | |
135 | 4260 switch (classType) |
0 | 4261 { |
4262 case 5u: | |
4263 case 6u: | |
4264 case 7u: | |
4265 case 0x10u: | |
4266 case 0x11u: | |
4267 case 0x12u: | |
4268 case 0x13u: | |
4269 case 0x20u: | |
4270 case 0x21u: | |
4271 case 0x22u: | |
4272 case 0x23u: | |
4273 v2 = GetActualIntelligence(); | |
4274 v3 = _48EA1B_get_static_effect(v2); | |
4275 goto LABEL_6; | |
4276 case 9u: | |
4277 case 0xAu: | |
4278 case 0xBu: | |
4279 case 0xCu: | |
4280 case 0xDu: | |
4281 case 0xEu: | |
4282 case 0xFu: | |
4283 case 0x18u: | |
4284 case 0x19u: | |
4285 case 0x1Au: | |
4286 case 0x1Bu: | |
4287 v2 = GetActualWillpower(); | |
4288 v3 = _48EA1B_get_static_effect(v2); | |
4289 goto LABEL_6; | |
4290 case 0x15u: | |
4291 case 0x16u: | |
4292 case 0x17u: | |
4293 case 0x1Cu: | |
4294 case 0x1Du: | |
4295 case 0x1Eu: | |
4296 case 0x1Fu: | |
4297 v4 = GetActualWillpower(); | |
4298 v5 = _48EA1B_get_static_effect(v4); | |
4299 v6 = GetActualIntelligence(); | |
4300 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4301 LABEL_6: | |
135 | 4302 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4303 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4304 v9 = uFullManaBonus | |
135 | 4305 + pBaseManaByClass[classType / 4] |
0 | 4306 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4307 + v8; | |
4308 if ( v9 < 1 ) | |
4309 goto LABEL_7; | |
4310 result = v9; | |
4311 break; | |
4312 default: | |
4313 LABEL_7: | |
4314 result = 0; | |
4315 break; | |
4316 } | |
4317 return result; | |
4318 } | |
4319 | |
4320 //----- (0048E656) -------------------------------------------------------- | |
4321 int Player::GetBaseAC() | |
4322 { | |
4323 Player *v1; // edi@1 | |
4324 int v2; // eax@1 | |
4325 int v3; // esi@1 | |
4326 int v4; // esi@1 | |
4327 int v5; // esi@1 | |
4328 int result; // eax@2 | |
4329 | |
4330 v1 = this; | |
4331 v2 = GetActualSpeed(); | |
4332 v3 = _48EA1B_get_static_effect(v2); | |
4333 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4334 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4335 if ( v5 >= 1 ) | |
4336 result = v5; | |
4337 else | |
4338 result = 0; | |
4339 return result; | |
4340 } | |
4341 | |
4342 //----- (0048E68F) -------------------------------------------------------- | |
4343 int Player::GetActualAC() | |
4344 { | |
4345 Player *v1; // edi@1 | |
4346 int v2; // eax@1 | |
4347 int v3; // esi@1 | |
4348 int v4; // esi@1 | |
4349 int v5; // esi@1 | |
4350 int v6; // esi@1 | |
4351 int result; // eax@2 | |
4352 | |
4353 v1 = this; | |
4354 v2 = GetActualSpeed(); | |
4355 v3 = _48EA1B_get_static_effect(v2); | |
4356 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4357 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4358 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4359 if ( v6 >= 1 ) | |
4360 result = v6; | |
4361 else | |
4362 result = 0; | |
4363 return result; | |
4364 } | |
4365 | |
4366 //----- (0048E6DC) -------------------------------------------------------- | |
4367 unsigned int Player::GetBaseAge() | |
4368 { | |
352 | 4369 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4370 } |
4371 | |
4372 //----- (0048E72C) -------------------------------------------------------- | |
4373 unsigned int Player::GetActualAge() | |
4374 { | |
4375 return this->sAgeModifier + GetBaseAge(); | |
4376 } | |
4377 | |
4378 //----- (0048E73F) -------------------------------------------------------- | |
4379 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4380 { | |
4381 Player *v2; // ebx@1 | |
4382 signed int v3; // esi@1 | |
4383 enum CHARACTER_RACE v4; // eax@1 | |
4384 signed int v5; // edi@8 | |
4385 char v6; // zf@9 | |
4386 int v7; // esi@20 | |
4387 int result; // eax@21 | |
4388 signed int v9; // [sp-4h] [bp-10h]@11 | |
4389 | |
4390 v2 = this; | |
4391 v3 = 0; | |
4392 v4 = GetRace(); | |
4393 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4394 { | |
4395 v5 = 0; | |
4396 goto LABEL_16; | |
4397 } | |
4398 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4399 { | |
4400 v5 = 1; | |
4401 LABEL_16: | |
4402 v6 = v4 == 2; | |
4403 goto LABEL_17; | |
4404 } | |
4405 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4406 { | |
4407 v6 = v4 == 3; | |
4408 v5 = 2; | |
4409 goto LABEL_17; | |
4410 } | |
4411 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4412 { | |
4413 v5 = 3; | |
4414 v6 = v4 == 3; | |
4415 goto LABEL_17; | |
4416 } | |
4417 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4418 { | |
4419 v5 = 7; | |
4420 if ( v4 != 1 ) | |
4421 goto LABEL_20; | |
4422 v9 = 10; | |
4423 LABEL_19: | |
4424 v3 = v9; | |
4425 goto LABEL_20; | |
4426 } | |
4427 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4428 { | |
4429 v5 = 8; | |
4430 v6 = v4 == 0; | |
4431 LABEL_17: | |
4432 if ( !v6 ) | |
4433 goto LABEL_20; | |
4434 v9 = 5; | |
4435 goto LABEL_19; | |
4436 } | |
4437 v5 = 0; | |
4438 LABEL_20: | |
4439 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4440 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4441 result = v7 + *(&v2->sResFireBase + v5); |
4442 return result; | |
4443 } | |
4444 | |
4445 //----- (0048E7D0) -------------------------------------------------------- | |
4446 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4447 { | |
4448 signed int v2; // edi@1 | |
4449 Player *v3; // esi@1 | |
4450 enum CHARACTER_RACE v4; // ebx@1 | |
4451 Player *v5; // ecx@8 | |
4452 char v6; // zf@18 | |
4453 int v7; // ebx@28 | |
4454 int result; // eax@28 | |
4455 signed int v9; // [sp+10h] [bp-8h]@1 | |
4456 signed int v10; // [sp+14h] [bp-4h]@1 | |
4457 | |
4458 v2 = 0; | |
4459 v3 = this; | |
4460 v10 = 0; | |
4461 v9 = 0; | |
4462 v4 = GetRace(); | |
652 | 4463 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4464 v10 = 20; |
4465 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4466 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4467 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4468 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4469 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4470 && HasItemEquipped(EQUIP_ARMOUR) | |
4471 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4472 v10 += v3->pActiveSkills[9] & 0x3F; | |
4473 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4474 goto LABEL_25; | |
4475 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4476 { | |
4477 v2 = 1; | |
4478 LABEL_25: | |
4479 v6 = v4 == 2; | |
4480 LABEL_26: | |
4481 if ( v6 ) | |
4482 v9 = 5; | |
4483 goto LABEL_28; | |
4484 } | |
4485 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4486 { | |
4487 v6 = v4 == 3; | |
4488 v2 = 2; | |
4489 goto LABEL_26; | |
4490 } | |
4491 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4492 { | |
4493 v2 = 3; | |
4494 if ( v4 == 3 ) | |
4495 v10 += 5; | |
4496 } | |
4497 else | |
4498 { | |
4499 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4500 { | |
4501 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4502 goto LABEL_28; | |
4503 v2 = 8; | |
4504 v6 = v4 == 0; | |
4505 goto LABEL_26; | |
4506 } | |
4507 v2 = 7; | |
4508 if ( v4 == 1 ) | |
4509 v9 = 10; | |
4510 } | |
4511 LABEL_28: | |
4512 v7 = GetItemsBonus(a2, 0); | |
4513 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4514 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4515 { |
4516 if ( result > 200 ) | |
4517 result = 200; | |
4518 } | |
4519 return result; | |
4520 } | |
4521 | |
4522 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4523 bool Player::Recover(int dt) |
4524 { | |
4525 //Player *v2; // esi@1 | |
0 | 4526 signed __int64 v3; // qax@1 |
816 | 4527 //bool result; // eax@4 |
4528 | |
4529 //v2 = this; | |
4530 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4531 | |
4532 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4533 | |
4534 if (uTimeToRecovery > v3) | |
4535 { | |
4536 uTimeToRecovery -= v3; | |
4537 return true; | |
0 | 4538 } |
4539 else | |
4540 { | |
816 | 4541 uTimeToRecovery = 0; |
4542 viewparams->bRedrawGameUI = true; | |
4543 if (!uActiveCharacter) | |
0 | 4544 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4545 return false; |
4546 } | |
0 | 4547 } |
4548 | |
4549 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4550 void Player::SetRecoveryTime(signed int rec) |
4551 { | |
4552 assert(rec > 0); | |
4553 | |
4554 if (rec > uTimeToRecovery) | |
4555 uTimeToRecovery = rec; | |
4556 | |
4557 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4558 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4559 |
4560 viewparams->bRedrawGameUI = true; | |
0 | 4561 } |
4562 // 50C0C4: using guessed type int some_active_character; | |
4563 | |
4564 //----- (0048E9B7) -------------------------------------------------------- | |
4565 void Player::RandomizeName() | |
4566 { | |
4567 if (!uExpressionTimePassed) | |
4568 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4569 } | |
4570 | |
4571 //----- (0048E9F4) -------------------------------------------------------- | |
4572 unsigned int Player::GetMajorConditionIdx() | |
4573 { | |
4574 for (uint i = 0; i < 18; ++i) | |
4575 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4576 return pConditionImportancyTable[i]; | |
4577 | |
4578 return 18; | |
4579 } | |
4580 | |
4581 //----- (0048EA1B) -------------------------------------------------------- | |
4582 int Player::_48EA1B_get_static_effect(int a2) | |
4583 { | |
4584 __int16 v2; // cx@1 | |
4585 int v3; // eax@1 | |
4586 | |
4587 v2 = word_4EDFFC[0]; | |
4588 v3 = 0; | |
4589 while ( a2 < v2 && v2 ) | |
4590 v2 = word_4EDFFC[v3++ + 1]; | |
4591 return player_stat_bonuses[v3]; | |
4592 } | |
4593 | |
4594 //----- (0048EA46) -------------------------------------------------------- | |
4595 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4596 { | |
4597 int v3; // esi@1 | |
4598 int v4; // edx@2 | |
4599 int v5; // eax@3 | |
4600 char *v6; // eax@4 | |
4601 | |
4602 v3 = 0; | |
4603 while ( 1 ) | |
4604 { | |
4605 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4606 goto LABEL_11; | |
816 | 4607 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4608 if ( a2 != 17 ) |
816 | 4609 { |
4610 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4611 goto LABEL_11; | |
4612 return 5; | |
4613 } | |
0 | 4614 v6 = (char *)this + 36 * v5; |
4615 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4616 return 50; | |
4617 LABEL_11: | |
4618 ++v3; | |
4619 if ( (signed int)v3 >= 16 ) | |
816 | 4620 return 0; |
4621 } | |
0 | 4622 } |
4623 | |
4624 //----- (0048EAAE) -------------------------------------------------------- | |
4625 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4626 { | |
4627 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4628 signed int v4; // eax@1 | |
4629 int v5; // edi@1 | |
4630 Player *v6; // ebx@1 | |
4631 Player *v8; // ecx@48 | |
4632 int v9; // eax@49 | |
4633 int v10; // edx@49 | |
4634 Player *v11; // ecx@55 | |
4635 int v12; // eax@56 | |
4636 int v13; // edx@56 | |
4637 int v14; // ecx@58 | |
4638 int v15; // eax@58 | |
4639 Player *v16; // ecx@61 | |
4640 int v17; // eax@62 | |
4641 Player *v18; // ecx@66 | |
4642 int v19; // eax@67 | |
4643 int v20; // eax@69 | |
4644 Player *v21; // ecx@75 | |
4645 int v22; // eax@76 | |
4646 int v23; // edx@76 | |
4647 int v24; // eax@79 | |
4648 int v25; // ecx@80 | |
4649 int v26; // edi@80 | |
4650 Player *v27; // ecx@84 | |
4651 int v28; // eax@85 | |
4652 int v29; // edx@85 | |
4653 Player *v30; // ecx@96 | |
4654 int v31; // ebp@97 | |
4655 int v32; // eax@98 | |
4656 unsigned int v33; // eax@100 | |
4657 int v34; // eax@103 | |
4658 char v35; // zf@104 | |
4659 char v36; // zf@107 | |
4660 unsigned __int8 v37; // zf@119 | |
4661 char v38; // sf@119 | |
4662 unsigned __int8 v39; // of@119 | |
4663 char v40; // zf@122 | |
4664 char v41; // zf@145 | |
4665 char v42; // zf@164 | |
4666 char v43; // zf@173 | |
4667 char v44; // zf@189 | |
4668 char v45; // zf@198 | |
4669 char v46; // zf@239 | |
4670 int v47; // eax@268 | |
4671 int v48; // eax@269 | |
4672 int v49; // eax@291 | |
4673 char v50; // zf@295 | |
4674 int v51; // eax@306 | |
4675 int v52; // eax@307 | |
4676 char v53; // zf@312 | |
4677 char v54; // zf@336 | |
4678 char v55; // zf@348 | |
4679 int v56; // eax@365 | |
4680 int v57; // ebx@368 | |
4681 signed int v58; // [sp-4h] [bp-20h]@10 | |
4682 signed int v59; // [sp-4h] [bp-20h]@71 | |
4683 signed int v60; // [sp-4h] [bp-20h]@347 | |
4684 int v61; // [sp+10h] [bp-Ch]@1 | |
4685 int v62; // [sp+14h] [bp-8h]@1 | |
4686 int v63; // [sp+18h] [bp-4h]@101 | |
4687 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4688 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4689 | |
4690 v3 = attr; | |
4691 v4 = 36; | |
4692 v5 = 0; | |
4693 v6 = this; | |
4694 v62 = 0; | |
4695 v61 = 0; | |
4696 | |
4697 switch (attr) | |
4698 { | |
4699 case CHARACTER_ATTRIBUTE_LEVEL: | |
4700 if (HasEnchantedItemEquipped(25)) | |
4701 return 5; | |
4702 return 0; | |
4703 }; | |
4704 | |
4705 if ( (signed int)attr > 36 ) | |
4706 { | |
4707 switch ( attr ) | |
4708 { | |
4709 case 37: | |
4710 v58 = 15; | |
4711 goto LABEL_35; | |
4712 case 38: | |
4713 v58 = 16; | |
4714 goto LABEL_35; | |
4715 case 39: | |
4716 v58 = 17; | |
4717 goto LABEL_35; | |
4718 case 40: | |
4719 v58 = 18; | |
4720 goto LABEL_35; | |
4721 case 41: | |
4722 v58 = 19; | |
4723 goto LABEL_35; | |
4724 case 42: | |
4725 v58 = 20; | |
4726 goto LABEL_35; | |
4727 case 43: | |
4728 v58 = 25; | |
4729 goto LABEL_35; | |
4730 case 44: | |
4731 v58 = 5; | |
4732 goto LABEL_35; | |
4733 case 45: | |
4734 v58 = 8; | |
4735 goto LABEL_35; | |
4736 case 46: | |
4737 goto LABEL_36; | |
4738 default: | |
4739 break; | |
4740 } | |
4741 } | |
4742 else | |
4743 { | |
4744 if ( attr == 36 ) | |
4745 { | |
4746 v58 = 14; | |
4747 } | |
4748 else | |
4749 { | |
4750 if ( (signed int)attr > 21 ) | |
4751 { | |
4752 switch ( attr ) | |
4753 { | |
4754 case 22: | |
4755 v58 = 30; | |
4756 break; | |
4757 case 23: | |
4758 v58 = 31; | |
4759 break; | |
4760 case 34: | |
4761 v58 = 12; | |
4762 break; | |
4763 default: | |
4764 if ( attr != 35 ) | |
4765 goto LABEL_38; | |
4766 v58 = 13; | |
4767 break; | |
4768 } | |
4769 } | |
4770 else | |
4771 { | |
4772 switch ( attr ) | |
4773 { | |
4774 case 21: | |
4775 v58 = 33; | |
4776 break; | |
4777 case 16: | |
4778 v58 = 35; | |
4779 break; | |
4780 case 17: | |
4781 v58 = 34; | |
4782 break; | |
4783 case 18: | |
4784 v58 = 29; | |
4785 break; | |
4786 case 19: | |
4787 v58 = 21; | |
4788 break; | |
4789 default: | |
4790 if ( attr != 20 ) | |
4791 goto LABEL_38; | |
4792 v58 = 32; | |
4793 break; | |
4794 } | |
4795 } | |
4796 } | |
4797 LABEL_35: | |
4798 v4 = v58; | |
4799 LABEL_36: | |
4800 if ( !this->pActiveSkills[v4] ) | |
4801 return 0; | |
4802 } | |
4803 LABEL_38: | |
4804 if ( (signed int)attr > 28 ) | |
4805 { | |
4806 if ( (signed int)attr < 29 ) | |
4807 return v5 + v62 + v61; | |
4808 if ( (signed int)attr <= 30 ) | |
4809 { | |
4810 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4811 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4812 return v5 + v62 + v61; |
4813 } | |
4814 if ( attr == 31 ) | |
4815 { | |
4816 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4817 return v5 + v62 + v61; | |
232 | 4818 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4819 v5 = pItemsTable->pItems[v57].uDamageMod; |
4820 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4821 goto LABEL_366; | |
4822 } | |
4823 if ( attr == 32 ) | |
4824 { | |
4825 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4826 return v5 + v62 + v61; | |
232 | 4827 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4828 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4829 LABEL_365: | |
4830 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4831 LABEL_366: | |
4832 v5 += v56; | |
4833 return v5 + v62 + v61; | |
4834 } | |
4835 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4836 return v5 + v62 + v61; | |
4837 LABEL_95: | |
4838 v65 = 0; | |
4839 while ( 1 ) | |
4840 { | |
4841 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4842 goto LABEL_361; | |
4843 v31 = *(&v6->pEquipment.uOffHand + v65) - 1; | |
4844 if ( v3 == 9 ) | |
4845 { | |
816 | 4846 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4847 if ( v32 >= 3 ) |
4848 { | |
4849 if ( v32 <= 11 ) | |
4850 { | |
4851 v33 = v6->pInventoryItems[v31].uItemID; | |
4852 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4853 } | |
4854 } | |
4855 } | |
4856 v63 = (int)((char *)v6 + 36 * v31); | |
4857 attra = (ItemGen *)(v63 + 532); | |
377 | 4858 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4859 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4860 { |
4861 v34 = attra->uItemID; | |
4862 switch ( attra->uItemID ) | |
4863 { | |
4864 case 0x1F4u: | |
4865 v35 = v3 == 5; | |
4866 goto LABEL_105; | |
4867 case 0x1F5u: | |
4868 v36 = v3 == 0; | |
4869 goto LABEL_108; | |
4870 case 0x1F6u: | |
4871 if ( v3 == 21 ) | |
4872 v61 += 10; | |
4873 v36 = v3 == 2; | |
4874 goto LABEL_108; | |
4875 case 0x1F7u: | |
4876 if ( v3 == 17 ) | |
4877 v61 += 5; | |
4878 if ( v3 == 18 ) | |
4879 v61 += 5; | |
4880 v36 = v3 == 6; | |
4881 goto LABEL_108; | |
4882 case 0x1F8u: | |
4883 goto LABEL_118; | |
4884 case 0x1F9u: | |
4885 v40 = v3 == 3; | |
4886 goto LABEL_123; | |
4887 case 0x1FAu: | |
4888 v35 = v3 == 10; | |
4889 goto LABEL_105; | |
4890 case 0x1FEu: | |
4891 v35 = v3 == 4; | |
4892 goto LABEL_105; | |
4893 case 0x1FFu: | |
4894 if ( v3 == 23 ) | |
4895 v61 += 10; | |
4896 if ( v3 == 22 ) | |
4897 v61 += 10; | |
4898 goto LABEL_361; | |
4899 case 0x200u: | |
4900 if ( v3 == 36 ) | |
4901 { | |
4902 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4903 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4904 } | |
4905 v36 = v3 == 5; | |
4906 LABEL_108: | |
4907 if ( v36 ) | |
4908 v5 += 40; | |
4909 goto LABEL_361; | |
4910 case 0x201u: | |
4911 if ( v3 == 39 ) | |
4912 { | |
4913 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4914 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4915 v62 = v34; | |
4916 } | |
4917 goto LABEL_136; | |
4918 case 0x202u: | |
4919 if ( !v3 ) | |
4920 v5 += 150; | |
4921 if ( v3 == 1 ) | |
4922 v5 -= 40; | |
4923 if ( v3 == 2 ) | |
4924 v5 -= 40; | |
4925 goto LABEL_145; | |
4926 case 0x203u: | |
4927 if ( v3 == 42 ) | |
4928 { | |
4929 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4930 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4931 } | |
4932 if ( v3 == 43 ) | |
4933 v61 += 15; | |
4934 goto LABEL_361; | |
4935 case 0x204u: | |
4936 if ( v3 == 17 ) | |
4937 v61 += 5; | |
4938 if ( v3 == 18 ) | |
4939 v61 += 5; | |
4940 if ( v3 == 6 ) | |
4941 v5 += 50; | |
4942 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4943 goto LABEL_166; | |
4944 v42 = v3 == 15; | |
4945 goto LABEL_165; | |
4946 case 0x205u: | |
4947 if ( v3 == 18 ) | |
4948 v61 += 5; | |
4949 goto LABEL_361; | |
4950 case 0x206u: | |
4951 if ( !v3 ) | |
4952 v5 += 100; | |
4953 if ( v3 == 3 ) | |
4954 v5 += 100; | |
4955 v43 = v3 == 9; | |
4956 goto LABEL_174; | |
4957 case 0x207u: | |
4958 if ( v3 == 45 ) | |
4959 v61 += 5; | |
4960 if ( v3 == 15 ) | |
4961 v5 -= 10; | |
4962 v42 = v3 == 14; | |
4963 LABEL_165: | |
4964 if ( v42 ) | |
4965 LABEL_166: | |
4966 v5 -= 10; | |
4967 goto LABEL_361; | |
4968 case 0x208u: | |
4969 v35 = v3 == 3; | |
4970 goto LABEL_105; | |
4971 case 0x209u: | |
4972 if ( v3 == 2 ) | |
4973 v5 += 15; | |
4974 if ( !v3 ) | |
4975 v5 += 15; | |
4976 v41 = v3 == 6; | |
4977 goto LABEL_146; | |
4978 case 0x20Au: | |
4979 if ( v3 == 46 ) | |
4980 v61 += 15; | |
4981 v44 = v3 == 3; | |
4982 goto LABEL_190; | |
4983 case 0x20Bu: | |
4984 if ( v3 == 34 ) | |
4985 { | |
4986 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4987 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4988 } | |
4989 if ( v3 == 12 ) | |
4990 v5 += 50; | |
4991 if ( v3 == 2 ) | |
4992 v5 += 30; | |
4993 v45 = v3 == 9; | |
4994 goto LABEL_199; | |
4995 case 0x20Cu: | |
4996 if ( !v3 ) | |
4997 v5 += 75; | |
4998 goto LABEL_145; | |
4999 case 0x20Du: | |
5000 if ( v3 == 5 ) | |
5001 v5 += 50; | |
5002 if ( v3 == 6 ) | |
5003 v5 += 50; | |
5004 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5005 goto LABEL_374; | |
5006 v43 = v3 == 15; | |
5007 LABEL_174: | |
5008 if ( v43 ) | |
5009 LABEL_374: | |
5010 v5 -= 15; | |
5011 goto LABEL_361; | |
5012 case 0x20Eu: | |
5013 if ( v3 == 4 ) | |
5014 v5 += 150; | |
5015 if ( v3 == 44 ) | |
5016 v61 += 5; | |
5017 if ( v3 == 9 ) | |
5018 v5 -= 25; | |
5019 goto LABEL_361; | |
5020 case 0x20Fu: | |
5021 if ( v3 == 39 ) | |
5022 { | |
5023 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5024 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5025 v62 = v34; | |
5026 } | |
5027 if ( v3 == 40 ) | |
5028 { | |
5029 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5030 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5031 } | |
5032 LABEL_145: | |
5033 v41 = v3 == 5; | |
5034 LABEL_146: | |
5035 if ( v41 ) | |
5036 v5 -= 40; | |
5037 goto LABEL_361; | |
5038 case 0x210u: | |
5039 if ( v3 == 38 ) | |
5040 { | |
5041 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5042 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5043 } | |
5044 if ( !v3 ) | |
5045 v5 += 75; | |
5046 v44 = v3 == 11; | |
5047 LABEL_190: | |
5048 if ( v44 ) | |
5049 v5 -= 50; | |
5050 goto LABEL_361; | |
5051 case 0x211u: | |
5052 if ( v3 == 5 ) | |
5053 v5 += 100; | |
5054 if ( v3 == 4 ) | |
5055 v5 += 50; | |
5056 v35 = v3 == 11; | |
5057 LABEL_105: | |
5058 if ( v35 ) | |
5059 v5 += 50; | |
5060 goto LABEL_361; | |
5061 case 0x212u: | |
5062 if ( v3 == 1 ) | |
5063 v5 -= 20; | |
5064 v45 = v3 == 2; | |
5065 LABEL_199: | |
5066 if ( v45 ) | |
5067 v5 -= 20; | |
5068 goto LABEL_361; | |
5069 case 0x214u: | |
5070 if ( v3 == 1 ) | |
5071 v5 += 15; | |
5072 v46 = v3 == 2; | |
5073 goto LABEL_240; | |
5074 case 0x215u: | |
5075 if ( v3 == 5 ) | |
5076 v5 += 15; | |
5077 v46 = v3 == 4; | |
5078 goto LABEL_240; | |
5079 case 0x216u: | |
5080 if ( v3 == 10 ) | |
5081 v5 += 30; | |
5082 if ( !v3 ) | |
5083 v5 += 15; | |
5084 goto LABEL_315; | |
5085 case 0x217u: | |
5086 if ( v3 == 21 ) | |
5087 v61 += 5; | |
5088 if ( !v3 ) | |
5089 v5 += 15; | |
5090 goto LABEL_253; | |
5091 case 0x218u: | |
5092 goto LABEL_253; | |
5093 default: | |
5094 goto LABEL_361; | |
5095 } | |
5096 goto LABEL_361; | |
5097 } | |
5098 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5099 { | |
5100 if ( (signed int)v3 >= 0 ) | |
5101 { | |
5102 if ( (signed int)v3 <= 15 ) | |
5103 { | |
5104 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5105 } | |
5106 else | |
5107 { | |
5108 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5109 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5110 } | |
5111 } | |
5112 goto LABEL_361; | |
5113 } | |
5114 v34 = *(int *)(v63 + 544); | |
5115 if ( v34 > 48 ) | |
5116 { | |
5117 switch ( v34 ) | |
5118 { | |
5119 case 54: | |
5120 goto LABEL_315; | |
5121 case 49: | |
5122 if ( v3 == 6 ) | |
5123 goto LABEL_121; | |
5124 v50 = v3 == 1; | |
5125 goto LABEL_296; | |
5126 case 51: | |
5127 if ( v3 != 5 && v3 != 1 ) | |
5128 goto LABEL_309; | |
5129 goto LABEL_121; | |
5130 case 52: | |
5131 if ( v3 == 3 ) | |
5132 goto LABEL_121; | |
5133 v50 = v3 == 4; | |
5134 goto LABEL_296; | |
5135 case 53: | |
5136 if ( !v3 ) | |
5137 goto LABEL_121; | |
5138 v50 = v3 == 2; | |
5139 goto LABEL_296; | |
5140 case 55: | |
5141 v46 = v3 == 6; | |
5142 goto LABEL_240; | |
5143 case 56: | |
5144 if ( !v3 ) | |
5145 goto LABEL_351; | |
5146 v53 = v3 == 3; | |
5147 goto LABEL_350; | |
5148 case 57: | |
5149 if ( v3 == 1 ) | |
5150 goto LABEL_351; | |
5151 v53 = v3 == 2; | |
5152 goto LABEL_350; | |
5153 case 50: | |
5154 if ( v3 == 10 ) | |
5155 v5 += 30; | |
5156 goto LABEL_361; | |
5157 case 60: | |
5158 if ( v3 != 23 ) | |
5159 goto LABEL_336; | |
5160 if ( v5 >= 3 ) | |
5161 goto LABEL_361; | |
5162 v5 = 3; | |
5163 LABEL_336: | |
5164 v54 = v3 == 22; | |
5165 goto LABEL_345; | |
5166 case 61: | |
5167 if ( v3 != 17 ) | |
5168 goto LABEL_340; | |
5169 if ( v5 >= 3 ) | |
5170 goto LABEL_361; | |
5171 v5 = 3; | |
5172 LABEL_340: | |
5173 v54 = v3 == 18; | |
5174 goto LABEL_345; | |
5175 case 62: | |
5176 if ( v3 != 19 ) | |
5177 goto LABEL_344; | |
5178 if ( v5 >= 3 ) | |
5179 goto LABEL_361; | |
5180 v5 = 3; | |
5181 LABEL_344: | |
5182 v54 = v3 == 20; | |
5183 LABEL_345: | |
5184 if ( !v54 ) | |
5185 goto LABEL_361; | |
5186 if ( v5 >= 3 ) | |
5187 goto LABEL_361; | |
5188 v60 = 3; | |
5189 goto LABEL_360; | |
5190 case 67: | |
5191 v55 = v3 == 18; | |
5192 goto LABEL_357; | |
5193 case 68: | |
5194 v53 = v3 == 9; | |
5195 goto LABEL_350; | |
5196 case 69: | |
5197 if ( v3 == 11 ) | |
5198 v5 += 20; | |
5199 break; | |
5200 case 70: | |
5201 if ( v3 == 12 ) | |
5202 v5 += 10; | |
5203 v55 = v3 == 16; | |
5204 LABEL_357: | |
5205 if ( v55 && v5 < 2 ) | |
5206 { | |
5207 v60 = 2; | |
5208 LABEL_360: | |
5209 v5 = v60; | |
5210 } | |
5211 break; | |
5212 default: | |
5213 goto LABEL_361; | |
5214 } | |
5215 goto LABEL_361; | |
5216 } | |
5217 if ( v34 == 48 ) | |
5218 { | |
5219 if ( v3 == 9 ) | |
5220 v5 += 5; | |
5221 LABEL_315: | |
5222 v46 = v3 == 3; | |
5223 LABEL_240: | |
5224 if ( v46 ) | |
5225 v5 += 15; | |
5226 goto LABEL_361; | |
5227 } | |
5228 if ( v34 > 32 ) | |
5229 { | |
5230 if ( v34 > 44 ) | |
5231 { | |
5232 v51 = v34 - 45; | |
5233 if ( !v51 ) | |
5234 { | |
5235 if ( v3 == 5 ) | |
5236 goto LABEL_351; | |
5237 v53 = v3 == 4; | |
5238 LABEL_350: | |
5239 if ( v53 ) | |
5240 LABEL_351: | |
5241 v5 += 5; | |
5242 goto LABEL_361; | |
5243 } | |
5244 v52 = v51 - 1; | |
5245 if ( !v52 ) | |
5246 { | |
5247 v40 = v3 == 0; | |
5248 LABEL_123: | |
5249 if ( v40 ) | |
5250 v5 += 25; | |
5251 goto LABEL_361; | |
5252 } | |
5253 if ( v52 == 1 ) | |
5254 { | |
5255 LABEL_309: | |
5256 v50 = v3 == 8; | |
5257 goto LABEL_296; | |
5258 } | |
5259 } | |
5260 else | |
5261 { | |
5262 if ( v34 == 44 ) | |
5263 { | |
5264 v50 = v3 == 7; | |
5265 goto LABEL_296; | |
5266 } | |
5267 v34 -= 33; | |
5268 if ( !v34 ) | |
5269 { | |
5270 if ( v3 != 38 ) | |
5271 goto LABEL_361; | |
5272 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5273 goto LABEL_138; | |
5274 } | |
5275 --v34; | |
5276 if ( !v34 ) | |
5277 { | |
5278 if ( v3 != 36 ) | |
5279 goto LABEL_361; | |
5280 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5281 goto LABEL_138; | |
5282 } | |
5283 v49 = v34 - 8; | |
5284 if ( !v49 ) | |
5285 { | |
5286 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5287 ++v5; | |
5288 goto LABEL_361; | |
5289 } | |
5290 if ( v49 == 1 ) | |
5291 { | |
5292 if ( v3 != 3 && v3 != 7 ) | |
5293 { | |
5294 v50 = v3 == 9; | |
5295 LABEL_296: | |
5296 if ( !v50 ) | |
5297 goto LABEL_361; | |
5298 } | |
5299 LABEL_121: | |
5300 v5 += 10; | |
5301 goto LABEL_361; | |
5302 } | |
5303 } | |
5304 } | |
5305 else | |
5306 { | |
5307 if ( v34 == 32 ) | |
5308 { | |
5309 if ( v3 != 39 ) | |
5310 goto LABEL_361; | |
5311 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5312 goto LABEL_138; | |
5313 } | |
5314 if ( v34 > 28 ) | |
5315 { | |
5316 v34 -= 29; | |
5317 if ( v34 ) | |
5318 { | |
5319 --v34; | |
5320 if ( v34 ) | |
5321 { | |
5322 --v34; | |
5323 if ( v34 || v3 != 41 ) | |
5324 goto LABEL_361; | |
5325 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5326 } | |
5327 else | |
5328 { | |
5329 if ( v3 != 34 ) | |
5330 goto LABEL_361; | |
5331 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5332 } | |
5333 } | |
5334 else | |
5335 { | |
5336 if ( v3 != 37 ) | |
5337 goto LABEL_361; | |
5338 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5339 } | |
5340 goto LABEL_138; | |
5341 } | |
5342 if ( v34 == 28 ) | |
5343 { | |
5344 LABEL_136: | |
5345 if ( v3 == 42 ) | |
5346 { | |
5347 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5348 LABEL_138: | |
5349 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5350 goto LABEL_361; | |
5351 } | |
5352 } | |
5353 else | |
5354 { | |
5355 v47 = v34 - 1; | |
5356 if ( v47 ) | |
5357 { | |
5358 v48 = v47 - 1; | |
5359 if ( v48 ) | |
5360 { | |
5361 v34 = v48 - 24; | |
5362 if ( v34 ) | |
5363 { | |
5364 --v34; | |
5365 if ( v34 || v3 != 40 ) | |
5366 goto LABEL_361; | |
5367 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5368 } | |
5369 else | |
5370 { | |
5371 if ( v3 != 35 ) | |
5372 goto LABEL_361; | |
5373 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5374 } | |
5375 goto LABEL_138; | |
5376 } | |
5377 LABEL_118: | |
5378 if ( (signed int)v3 < 0 ) | |
5379 goto LABEL_361; | |
5380 v39 = __OFSUB__((int)v3, 6); | |
5381 v37 = v3 == 6; | |
5382 v38 = v3 - 6 < 0; | |
5383 } | |
5384 else | |
5385 { | |
5386 LABEL_253: | |
5387 if ( (signed int)v3 < 10 ) | |
5388 goto LABEL_361; | |
5389 v39 = __OFSUB__((int)v3, 15); | |
5390 v37 = v3 == 15; | |
5391 v38 = v3 - 15 < 0; | |
5392 } | |
5393 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5394 goto LABEL_121; | |
5395 } | |
5396 } | |
5397 LABEL_361: | |
5398 ++v65; | |
5399 if ( (signed int)v65 >= 16 ) | |
5400 return v5 + v62 + v61; | |
5401 } | |
5402 } | |
5403 if ( attr == 28 ) | |
5404 { | |
5405 if ( IsUnarmed() != 1 ) | |
5406 { | |
816 | 5407 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5408 { | |
5409 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5410 if ( v22 >= 0 ) |
5411 { | |
5412 if ( v22 <= 2 ) | |
5413 { | |
118 | 5414 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
5415 if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) | |
0 | 5416 { |
5417 v24 = v23; | |
5418 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5419 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5420 } | |
5421 else | |
5422 { | |
5423 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5424 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5425 } | |
5426 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5427 } | |
5428 } | |
5429 } | |
816 | 5430 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v27->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5431 return v5 + v62 + v61; |
5432 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5433 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5434 goto LABEL_88; | |
5435 } | |
5436 v59 = 3; | |
5437 LABEL_74: | |
5438 v5 = v59; | |
5439 return v5 + v62 + v61; | |
5440 } | |
5441 if ( (signed int)attr < 0 ) | |
5442 return v5 + v62 + v61; | |
5443 if ( (signed int)attr <= 23 ) | |
5444 goto LABEL_95; | |
5445 if ( (signed int)attr <= 24 ) | |
5446 return v5 + v62 + v61; | |
5447 if ( (signed int)attr <= 26 ) | |
5448 { | |
5449 if ( IsUnarmed() == 1 ) | |
5450 { | |
5451 v5 = 0; | |
5452 return v5 + v62 + v61; | |
5453 } | |
816 | 5454 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5455 { | |
5456 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5457 if ( v17 >= 0 ) |
5458 { | |
5459 if ( v17 <= 2 ) | |
232 | 5460 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5461 } |
5462 } | |
816 | 5463 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v18->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5464 return v5 + v62 + v61; |
232 | 5465 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1]; |
0 | 5466 goto LABEL_365; |
5467 } | |
5468 if ( attr == 27 ) | |
5469 { | |
5470 if ( IsUnarmed() == 1 ) | |
5471 { | |
5472 v5 = 1; | |
5473 return v5 + v62 + v61; | |
5474 } | |
816 | 5475 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5476 { | |
5477 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5478 if ( v9 >= 0 ) |
5479 { | |
5480 if ( v9 <= 2 ) | |
5481 { | |
118 | 5482 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
0 | 5483 if ( !v6->pEquipment.uOffHand ) |
5484 { | |
118 | 5485 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5486 ++v5; |
5487 } | |
5488 } | |
5489 } | |
5490 } | |
816 | 5491 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v11->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5492 return v5 + v62 + v61; |
118 | 5493 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; |
5494 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; | |
0 | 5495 LABEL_88: |
5496 v5 += v15 + v14; | |
5497 } | |
5498 return v5 + v62 + v61; | |
5499 } | |
5500 | |
5501 //----- (0048F73C) -------------------------------------------------------- | |
5502 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5503 { | |
5504 int result; // eax@1 | |
5505 int v3; // eax@4 | |
5506 int v4; // ecx@5 | |
5507 | |
5508 switch (a2) | |
5509 { | |
5510 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5511 } | |
5512 | |
5513 result = 0; | |
5514 if ( (signed int)a2 > 10 ) | |
5515 { | |
5516 if ( (signed int)a2 <= 15 ) | |
5517 { | |
5518 switch ( a2 ) | |
5519 { | |
5520 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5521 v3 = this->pPlayerBuffs[2].uPower; | |
5522 v4 = pParty->pPartyBuffs[1].uPower; | |
5523 break; | |
5524 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5525 v3 = this->pPlayerBuffs[0].uPower; | |
5526 v4 = pParty->pPartyBuffs[0].uPower; | |
5527 break; | |
5528 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5529 v3 = this->pPlayerBuffs[22].uPower; | |
5530 v4 = pParty->pPartyBuffs[17].uPower; | |
5531 break; | |
5532 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5533 v3 = this->pPlayerBuffs[3].uPower; | |
5534 v4 = pParty->pPartyBuffs[4].uPower; | |
5535 break; | |
5536 default: | |
5537 if ( a2 != 14 ) | |
5538 return result; | |
5539 v3 = this->pPlayerBuffs[9].uPower; | |
5540 v4 = pParty->pPartyBuffs[12].uPower; | |
5541 break; | |
5542 } | |
5543 return v4 + v3; | |
5544 } | |
5545 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5546 { | |
5547 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5548 { | |
5549 v3 = this->pPlayerBuffs[8].uPower; | |
5550 v4 = pParty->pPartyBuffs[9].uPower; | |
5551 return v4 + v3; | |
5552 } | |
5553 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5554 return result; | |
5555 } | |
5556 return this->pPlayerBuffs[1].uPower; | |
5557 } | |
5558 if ( a2 == 10 ) | |
5559 { | |
5560 v3 = this->pPlayerBuffs[5].uPower; | |
5561 v4 = pParty->pPartyBuffs[6].uPower; | |
5562 return v4 + v3; | |
5563 } | |
5564 switch ( a2 ) | |
5565 { | |
5566 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5567 v3 = pPlayerBuffs[19].uPower; | |
5568 goto LABEL_5; | |
5569 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5570 v3 = pPlayerBuffs[17].uPower; | |
5571 goto LABEL_5; | |
5572 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5573 v3 = pPlayerBuffs[20].uPower; | |
5574 goto LABEL_5; | |
5575 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5576 v3 = pPlayerBuffs[16].uPower; | |
5577 goto LABEL_5; | |
5578 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5579 v3 = pPlayerBuffs[15].uPower; | |
5580 goto LABEL_5; | |
5581 case CHARACTER_ATTRIBUTE_SPEED: | |
5582 v3 = pPlayerBuffs[21].uPower; | |
5583 goto LABEL_5; | |
5584 case CHARACTER_ATTRIBUTE_LUCK: | |
5585 v3 = pPlayerBuffs[18].uPower; | |
5586 LABEL_5: | |
5587 v4 = pParty->pPartyBuffs[2].uPower; | |
5588 return v4 + v3; | |
5589 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5590 v3 = this->pPlayerBuffs[14].uPower; | |
5591 v4 = pParty->pPartyBuffs[15].uPower; | |
5592 return v4 + v3; | |
5593 default: | |
5594 return result; | |
5595 } | |
5596 return result; | |
5597 } | |
5598 | |
5599 //----- (0048F882) -------------------------------------------------------- | |
353 | 5600 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
0 | 5601 { |
5602 signed int v2; // esi@1 | |
5603 unsigned __int16 v3; // ax@126 | |
5604 char result; // al@127 | |
5605 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5606 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5607 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5608 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5609 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5610 | |
0 | 5611 v2 = 0; |
353 | 5612 switch (uSkillType) |
5613 { | |
5614 case PLAYER_SKILL_MONSTER_ID: | |
5615 { | |
652 | 5616 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5617 v2 = 6; |
652 | 5618 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5619 v2 += 6; |
5620 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5621 v2 += GetItemsBonus(v8, 0); | |
5622 } | |
5623 break; | |
5624 | |
5625 case PLAYER_SKILL_ARMSMASTER: | |
5626 { | |
652 | 5627 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5628 v2 = 2; |
652 | 5629 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5630 v2 += 3; |
353 | 5631 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5632 v2 += GetItemsBonus(v8, 0); | |
5633 } | |
5634 break; | |
5635 | |
5636 case PLAYER_SKILL_STEALING: | |
5637 { | |
652 | 5638 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5639 v2 = 8; |
5640 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5641 v2 += GetItemsBonus(v8, 0); | |
5642 } | |
5643 break; | |
5644 | |
5645 | |
5646 case PLAYER_SKILL_ALCHEMY: | |
5647 { | |
652 | 5648 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5649 v2 = 4; |
652 | 5650 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5651 v2 += 8; |
5652 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5653 v2 += GetItemsBonus(v8, 0); | |
5654 } | |
5655 break; | |
5656 | |
5657 case PLAYER_SKILL_LEARNING: | |
5658 { | |
652 | 5659 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5660 v2 = 10; |
652 | 5661 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5662 v2 += 15; |
652 | 5663 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5664 v2 += 5; |
5665 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5666 v2 += GetItemsBonus(v8, 0); | |
5667 } | |
5668 break; | |
5669 | |
5670 case PLAYER_SKILL_UNARMED: | |
5671 { | |
652 | 5672 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5673 v2 = 2; |
5674 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5675 v2 += GetItemsBonus(v8, 0); | |
5676 } | |
5677 break; | |
5678 | |
5679 case PLAYER_SKILL_DODGE: | |
5680 { | |
652 | 5681 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5682 v2 = 2; |
5683 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5684 v2 += GetItemsBonus(v8, 0); | |
5685 } | |
5686 break; | |
5687 | |
5688 case PLAYER_SKILL_BOW: | |
5689 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5690 v2 += GetItemsBonus(v8, 0); | |
5691 break; | |
5692 case PLAYER_SKILL_SHIELD: | |
5693 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5694 v2 += GetItemsBonus(v8, 0); | |
5695 break; | |
5696 | |
5697 case PLAYER_SKILL_EARTH: | |
652 | 5698 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5699 v2 = 2; |
652 | 5700 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5701 v2 += 3; |
652 | 5702 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5703 v2 += 4; |
5704 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5705 v2 += 3; | |
5706 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5707 v2 += GetItemsBonus(v8, 0); | |
5708 break; | |
5709 case PLAYER_SKILL_FIRE: | |
652 | 5710 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5711 v2 = 2; |
652 | 5712 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5713 v2 += 3; |
652 | 5714 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5715 v2 += 4; |
5716 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5717 v2 += 3; | |
5718 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5719 v2 += GetItemsBonus(v8, 0); | |
5720 break; | |
5721 case PLAYER_SKILL_AIR: | |
652 | 5722 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5723 v2 = 2; |
652 | 5724 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5725 v2 += 3; |
652 | 5726 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5727 v2 += 4; |
5728 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5729 v2 += 3; | |
5730 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5731 v2 += GetItemsBonus(v8, 0); | |
5732 break; | |
5733 case PLAYER_SKILL_WATER: | |
652 | 5734 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5735 v2 = 2; |
652 | 5736 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5737 v2 += 3; |
652 | 5738 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5739 v2 += 4; |
5740 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5741 v2 += 3; | |
5742 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5743 v2 += GetItemsBonus(v8, 0); | |
5744 break; | |
5745 case PLAYER_SKILL_SPIRIT: | |
652 | 5746 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5747 v2 = 2; |
652 | 5748 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5749 v2 += 3; |
652 | 5750 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5751 v2 += 4; |
5752 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5753 v2 += GetItemsBonus(v8, 0); | |
5754 break; | |
5755 case PLAYER_SKILL_MIND: | |
652 | 5756 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5757 v2 = 2; |
652 | 5758 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5759 v2 += 3; |
652 | 5760 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5761 v2 += 4; |
5762 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5763 v2 += GetItemsBonus(v8, 0); | |
5764 break; | |
5765 case PLAYER_SKILL_BODY: | |
652 | 5766 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5767 v2 = 2; |
652 | 5768 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5769 v2 += 3; |
652 | 5770 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5771 v2 += 4; |
5772 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5773 v2 += GetItemsBonus(v8, 0); | |
5774 break; | |
5775 case PLAYER_SKILL_LIGHT: | |
5776 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5777 v2 += GetItemsBonus(v8, 0); | |
5778 break; | |
5779 case PLAYER_SKILL_DARK: | |
5780 { | |
5781 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5782 v2 += GetItemsBonus(v8, 0); | |
5783 } | |
5784 break; | |
5785 | |
5786 case PLAYER_SKILL_MERCHANT: | |
5787 { | |
652 | 5788 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5789 v2 = 4; |
652 | 5790 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5791 v2 += 6; |
652 | 5792 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5793 v2 += 3; |
652 | 5794 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5795 v2 += 8; |
5796 } | |
5797 break; | |
5798 | |
5799 case PLAYER_SKILL_PERCEPTION: | |
5800 { | |
652 | 5801 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5802 v2 = 6; |
652 | 5803 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5804 v2 += 5; |
5805 } | |
5806 break; | |
5807 | |
0 | 5808 case PLAYER_SKILL_ITEM_ID: |
5809 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5810 v2 += GetItemsBonus(v8, 0); |
0 | 5811 break; |
5812 case PLAYER_SKILL_MEDITATION: | |
5813 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5814 v2 += GetItemsBonus(v8, 0); |
5815 break; | |
0 | 5816 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5817 { |
652 | 5818 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5819 v2 = 4; |
652 | 5820 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5821 v2 += 6; |
652 | 5822 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5823 v2 += 8; |
0 | 5824 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5825 v2 += GetItemsBonus(v8, 0); |
5826 } | |
5827 break; | |
5828 } | |
5829 | |
5830 v3 = pActiveSkills[uSkillType]; | |
5831 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
0 | 5832 result = v2 + v3; |
5833 else | |
5834 result = v3 & 0xFC | 0x3C; | |
5835 return result; | |
5836 } | |
5837 | |
5838 //----- (0048FC00) -------------------------------------------------------- | |
5839 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5840 { | |
5841 Player *v2; // esi@1 | |
5842 int v3; // eax@1 | |
5843 char v4; // di@1 | |
5844 signed int v5; // ebx@1 | |
5845 unsigned int v6; // eax@2 | |
5846 unsigned __int8 v7; // sf@5 | |
5847 unsigned __int8 v8; // of@5 | |
5848 PlayerEquipment *v9; // ebx@19 | |
5849 Player *v10; // ecx@20 | |
821 | 5850 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5851 int v12; // eax@21 |
5852 int v13; // edi@21 | |
5853 char v14; // di@25 | |
5854 signed int v15; // esi@25 | |
5855 char v16; // al@32 | |
5856 int v18; // eax@36 | |
5857 unsigned int v19; // eax@37 | |
5858 ITEM_EQUIP_TYPE v20; // edi@40 | |
5859 int v21; // edx@41 | |
5860 int v22; // eax@42 | |
821 | 5861 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5862 unsigned __int16 v24; // ax@45 |
5863 unsigned __int16 v25; // bx@45 | |
5864 unsigned int v26; // eax@45 | |
5865 unsigned __int8 v27; // sf@50 | |
5866 unsigned __int8 v28; // of@50 | |
5867 unsigned int v29; // eax@52 | |
5868 int v30; // eax@55 | |
5869 int v31; // eax@58 | |
5870 unsigned int v32; // eax@59 | |
5871 int v33; // eax@65 | |
5872 char v34; // si@65 | |
5873 ITEM_EQUIP_TYPE v35; // edi@69 | |
5874 int v36; // edx@70 | |
5875 int v37; // eax@71 | |
821 | 5876 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5877 int v39; // eax@74 |
5878 int v40; // eax@89 | |
5879 char v41; // si@89 | |
5880 int v42; // eax@96 | |
821 | 5881 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5882 int v44; // eax@97 |
5883 int v45; // eax@98 | |
5884 int v46; // eax@99 | |
5885 int v47; // eax@100 | |
5886 int v48; // eax@101 | |
5887 int v49; // eax@102 | |
5888 unsigned __int16 v50; // ax@113 | |
5889 char v51; // di@113 | |
5890 unsigned int v52; // eax@113 | |
5891 int v53; // edi@113 | |
5892 signed int i; // ecx@113 | |
5893 unsigned __int16 v55; // ax@118 | |
5894 char v56; // si@118 | |
5895 unsigned int v57; // eax@118 | |
5896 int v58; // esi@121 | |
5897 signed int j; // ecx@121 | |
5898 int v60; // edi@126 | |
5899 int v61; // eax@126 | |
5900 signed int v62; // [sp-4h] [bp-30h]@26 | |
5901 signed int v63; // [sp-4h] [bp-30h]@80 | |
5902 int v64; // [sp+Ch] [bp-20h]@104 | |
5903 int v65; // [sp+10h] [bp-1Ch]@104 | |
5904 int v66; // [sp+14h] [bp-18h]@104 | |
5905 int v67; // [sp+18h] [bp-14h]@104 | |
5906 int v68; // [sp+1Ch] [bp-10h]@69 | |
5907 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5908 int v70; // [sp+24h] [bp-8h]@1 | |
5909 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5910 int a1; // [sp+34h] [bp+8h]@21 | |
5911 int a1a; // [sp+34h] [bp+8h]@74 | |
5912 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5913 | |
5914 v2 = this; | |
5915 v70 = 0; | |
5916 v69 = 0; | |
5917 v71 = (ITEM_EQUIP_TYPE)0; | |
5918 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5919 v4 = v3; | |
5920 v5 = 1; | |
5921 if ( v3 ) | |
5922 { | |
5923 v6 = SkillToMastery(v3); | |
5924 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5925 { | |
5926 if ( (signed int)v6 >= 4 ) | |
5927 goto LABEL_4; | |
5928 v8 = __OFSUB__(v6, 3); | |
5929 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5930 } | |
5931 else | |
5932 { | |
5933 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5934 goto LABEL_11; | |
5935 if ( (signed int)v6 >= 4 ) | |
5936 { | |
5937 LABEL_4: | |
5938 v71 = (ITEM_EQUIP_TYPE)2; | |
5939 LABEL_11: | |
5940 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5941 goto LABEL_12; | |
5942 } | |
5943 v8 = __OFSUB__(v6, 2); | |
5944 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5945 } | |
5946 if ( !(v7 ^ v8) ) | |
5947 v71 = (ITEM_EQUIP_TYPE)1; | |
5948 goto LABEL_11; | |
5949 } | |
5950 LABEL_12: | |
5951 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5952 { | |
135 | 5953 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5954 v61 = v2->GetBodybuilding(); |
5955 return v60 * v61; | |
5956 } | |
5957 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5958 { | |
135 | 5959 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5960 v61 = v2->GetMeditation(); |
0 | 5961 return v60 * v61; |
5962 } | |
5963 if ( a2 != 9 ) | |
5964 { | |
5965 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5966 { | |
5967 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5968 return v70; | |
5969 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5970 { | |
5971 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5972 return v70; | |
5973 v71 = (ITEM_EQUIP_TYPE)0; | |
5974 v9 = &v2->pEquipment; | |
5975 while ( 1 ) | |
5976 { | |
5977 if ( v2->HasItemEquipped(v71) ) | |
5978 { | |
118 | 5979 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5980 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5981 a1 = v12; |
5982 SkillToMastery(v12); | |
5983 v13 = v11 - 5; | |
5984 if ( !v13 ) | |
5985 return a1 & 0x3F; | |
5986 if ( v13 == 2 ) | |
5987 break; | |
5988 } | |
5989 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5990 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5991 if ( (signed int)v71 >= 16 ) | |
5992 return v70; | |
5993 } | |
5994 v14 = a1; | |
5995 v15 = 1; | |
5996 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5997 { | |
5998 v62 = 5; | |
5999 goto LABEL_31; | |
6000 } | |
6001 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6002 { | |
6003 v62 = 3; | |
6004 goto LABEL_31; | |
6005 } | |
6006 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6007 goto LABEL_32; | |
6008 goto LABEL_30; | |
6009 } | |
6010 if ( v2->IsUnarmed() ) | |
6011 { | |
6012 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6013 v14 = v18; | |
6014 if ( !v18 ) | |
6015 return v70; | |
6016 v15 = 0; | |
6017 v19 = SkillToMastery(v18); | |
6018 if ( (signed int)v19 < 3 ) | |
6019 { | |
6020 if ( (signed int)v19 >= 2 ) | |
6021 v15 = 1; | |
6022 LABEL_32: | |
6023 v16 = v14; | |
6024 return v15 * (v16 & 0x3F); | |
6025 } | |
6026 LABEL_30: | |
6027 v62 = 2; | |
6028 LABEL_31: | |
6029 v15 = v62; | |
6030 goto LABEL_32; | |
6031 } | |
6032 v20 = (ITEM_EQUIP_TYPE)0; | |
6033 while ( 1 ) | |
6034 { | |
6035 if ( v2->HasItemEquipped(v20) ) | |
6036 { | |
118 | 6037 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6038 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6039 break; | |
6040 } | |
6041 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6042 if ( (signed int)v20 >= 16 ) | |
6043 return v70; | |
6044 } | |
6045 v71 = (ITEM_EQUIP_TYPE)0; | |
6046 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6047 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6048 v25 = v24; | |
6049 v26 = SkillToMastery(v24); | |
6050 if ( !v23 ) | |
6051 { | |
6052 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6053 { | |
6054 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6055 LOBYTE(v25) = v31; | |
6056 if ( v31 ) | |
6057 { | |
6058 v15 = 0; | |
6059 v32 = SkillToMastery(v31); | |
6060 if ( (signed int)v32 < 3 ) | |
6061 { | |
6062 if ( (signed int)v32 >= 2 ) | |
6063 v15 = 1; | |
6064 } | |
6065 else | |
6066 { | |
6067 v15 = 2; | |
6068 } | |
6069 v16 = v25; | |
6070 return v15 * (v16 & 0x3F); | |
6071 } | |
6072 } | |
6073 goto LABEL_55; | |
6074 } | |
6075 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6076 { | |
6077 v29 = SkillToMastery(v25); | |
6078 v28 = __OFSUB__(v29, 4); | |
6079 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6080 } | |
6081 else | |
6082 { | |
6083 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6084 goto LABEL_55; | |
6085 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6086 { | |
6087 if ( v23 == PLAYER_SKILL_MACE ) | |
6088 { | |
6089 v28 = __OFSUB__(v26, 2); | |
118 | 6090 v27 = v26 - 2 < 0; |
0 | 6091 goto LABEL_53; |
6092 } | |
6093 LABEL_55: | |
6094 v30 = v71 * (v25 & 0x3F); | |
6095 return (int)((char *)v69 + v30); | |
6096 } | |
6097 v28 = __OFSUB__(v26, 3); | |
118 | 6098 v27 = v26 - 3 < 0; |
0 | 6099 } |
6100 LABEL_53: | |
6101 if ( !(v27 ^ v28) ) | |
6102 v71 = (ITEM_EQUIP_TYPE)1; | |
6103 goto LABEL_55; | |
6104 } | |
6105 if ( v2->IsUnarmed() == 1 ) | |
6106 { | |
6107 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6108 v34 = v33; | |
6109 if ( !v33 ) | |
6110 return v70; | |
6111 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6112 v5 = 2; | |
6113 v30 = v5 * (v34 & 0x3F); | |
6114 return (int)((char *)v69 + v30); | |
6115 } | |
6116 v35 = (ITEM_EQUIP_TYPE)0; | |
6117 v68 = 0; | |
6118 while ( 1 ) | |
6119 { | |
6120 if ( v2->HasItemEquipped(v35) ) | |
6121 { | |
118 | 6122 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6123 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6124 break; | |
6125 } | |
6126 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6127 if ( (signed int)v35 >= 16 ) | |
6128 return v70; | |
6129 } | |
6130 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6131 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6132 a1a = v39; | |
6133 SkillToMastery(v39); | |
6134 v71 = (ITEM_EQUIP_TYPE)0; | |
6135 if ( v38 ) | |
6136 { | |
6137 if ( (signed int)v38 > 0 ) | |
6138 { | |
6139 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6140 { | |
6141 v71 = (ITEM_EQUIP_TYPE)1; | |
6142 } | |
6143 else | |
6144 { | |
6145 if ( v38 == 7 ) | |
6146 { | |
6147 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6148 { | |
6149 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6150 { | |
6151 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6152 return v5 * (a1a & 0x3F); | |
6153 v63 = 2; | |
6154 } | |
6155 else | |
6156 { | |
6157 v63 = 3; | |
6158 } | |
6159 } | |
6160 else | |
6161 { | |
6162 v63 = 5; | |
6163 } | |
6164 v5 = v63; | |
6165 return v5 * (a1a & 0x3F); | |
6166 } | |
6167 } | |
6168 } | |
6169 } | |
6170 else | |
6171 { | |
6172 v71 = (ITEM_EQUIP_TYPE)1; | |
6173 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6174 { | |
6175 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6176 v41 = v40; | |
6177 if ( v40 ) | |
6178 { | |
6179 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6180 v5 = 2; | |
6181 v68 = v5 * (v41 & 0x3F); | |
6182 } | |
6183 } | |
6184 } | |
6185 v30 = v68 + v71 * (a1a & 0x3F); | |
6186 return (int)((char *)v69 + v30); | |
6187 } | |
6188 a1b = 0; | |
6189 v71 = (ITEM_EQUIP_TYPE)0; | |
6190 v68 = 16; | |
6191 v69 = &v2->pEquipment; | |
6192 do | |
6193 { | |
6194 if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) | |
6195 goto LABEL_117; | |
6196 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6197 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6198 if ( !v44 ) | |
6199 { | |
6200 v64 = 0; | |
6201 v65 = 1; | |
6202 LABEL_111: | |
6203 v66 = 0; | |
6204 goto LABEL_112; | |
6205 } | |
6206 v45 = v44 - 1; | |
6207 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6208 { | |
6209 v64 = 0; | |
6210 v65 = 0; | |
6211 v66 = 0; | |
6212 v67 = 1; | |
6213 goto LABEL_113; | |
6214 } | |
6215 v47 = v46 - 4; | |
6216 if ( v47 ) | |
6217 { | |
6218 v48 = v47 - 1; | |
6219 if ( v48 ) | |
6220 { | |
6221 v49 = v48 - 1; | |
6222 if ( v49 ) | |
6223 { | |
6224 if ( v49 != 1 ) | |
6225 goto LABEL_117; | |
6226 a1b = 1; | |
6227 v64 = 1; | |
6228 v65 = 0; | |
6229 v66 = 0; | |
6230 v67 = 0; | |
6231 goto LABEL_113; | |
6232 } | |
6233 a1b = 1; | |
6234 v64 = 1; | |
6235 v65 = 0; | |
6236 goto LABEL_111; | |
6237 } | |
6238 v71 = (ITEM_EQUIP_TYPE)1; | |
6239 } | |
6240 else | |
6241 { | |
6242 a1b = 1; | |
6243 } | |
6244 v64 = 1; | |
6245 v65 = 0; | |
6246 v66 = 1; | |
6247 LABEL_112: | |
6248 v67 = 0; | |
6249 LABEL_113: | |
6250 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6251 v51 = v50; | |
6252 v52 = SkillToMastery(v50); | |
6253 v53 = v51 & 0x3F; | |
6254 for ( i = 0; i < (signed int)v52; ++i ) | |
6255 { | |
6256 if ( *(&v64 + i) ) | |
6257 v70 += v53; | |
6258 } | |
6259 LABEL_117: | |
6260 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6261 --v68; | |
6262 } | |
6263 while ( v68 ); | |
6264 v64 = 1; | |
6265 v65 = 1; | |
6266 v66 = 1; | |
6267 v67 = 0; | |
6268 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6269 v56 = v55; | |
6270 v57 = SkillToMastery(v55); | |
6271 if ( !a1b && (!v71 || v57 == 4) ) | |
6272 { | |
6273 v58 = v56 & 0x3F; | |
6274 for ( j = 0; j < (signed int)v57; ++j ) | |
6275 { | |
6276 if ( *(&v64 + j) ) | |
6277 v70 += v58; | |
6278 } | |
6279 } | |
6280 return v70; | |
6281 } | |
6282 | |
6283 //----- (00490109) -------------------------------------------------------- | |
6284 // faces are: 0 1 2 3 human males | |
6285 // 4 5 6 7 human females | |
6286 // 8 9 elf males | |
6287 // 10 11 elf females | |
6288 // 12 13 dwarf males | |
6289 // 14 15 dwarf females | |
6290 // 16 17 goblin males | |
6291 // 18 19 goblin females | |
6292 // 20 lich male | |
6293 // 21 lich female | |
6294 // 22 underwater suits (unused) | |
6295 // 23 zombie male | |
6296 // 24 zombie female | |
6297 enum CHARACTER_RACE Player::GetRace() | |
6298 { | |
6299 if ( uFace > 15 ) | |
6300 { | |
6301 if ( uFace >= 16 && uFace <= 19 ) | |
6302 return CHARACTER_RACE_GOBLIN; | |
6303 } | |
6304 else | |
6305 { | |
6306 if ( uFace >= 12 ) | |
6307 { | |
6308 return CHARACTER_RACE_DWARF; | |
6309 } | |
6310 else | |
6311 { | |
6312 if ( uFace >= 0 ) | |
6313 { | |
6314 if ( uFace <= 7 ) | |
6315 { | |
6316 return CHARACTER_RACE_HUMAN; | |
6317 } | |
6318 else | |
6319 { | |
6320 if ( uFace <= 11 ) | |
6321 return CHARACTER_RACE_ELF; | |
6322 } | |
6323 } | |
6324 } | |
6325 } | |
6326 return CHARACTER_RACE_HUMAN; | |
6327 } | |
6328 | |
6329 //----- (00490141) -------------------------------------------------------- | |
187 | 6330 PLAYER_SEX Player::GetSexByVoice() |
0 | 6331 { |
6332 signed int result; // eax@1 | |
6333 | |
6334 result = 0; | |
6335 switch ( this->uVoiceID ) | |
6336 { | |
6337 case 0u: | |
6338 case 1u: | |
6339 case 2u: | |
6340 case 3u: | |
6341 case 8u: | |
6342 case 9u: | |
6343 case 0xCu: | |
6344 case 0xDu: | |
6345 case 0x10u: | |
6346 case 0x11u: | |
6347 case 0x14u: | |
6348 case 0x17u: | |
187 | 6349 return SEX_MALE; |
6350 | |
0 | 6351 case 4u: |
6352 case 5u: | |
6353 case 6u: | |
6354 case 7u: | |
6355 case 0xAu: | |
6356 case 0xBu: | |
6357 case 0xEu: | |
6358 case 0xFu: | |
6359 case 0x12u: | |
6360 case 0x13u: | |
6361 case 0x15u: | |
6362 case 0x18u: | |
187 | 6363 return SEX_FEMALE; |
6364 | |
0 | 6365 default: |
187 | 6366 assert(false); |
6367 } | |
0 | 6368 } |
6369 | |
6370 //----- (00490188) -------------------------------------------------------- | |
6371 void Player::SetInitialStats() | |
6372 { | |
6373 auto v1 = GetRace(); | |
290 | 6374 uMight = StatTable[v1][0].uBaseValue; |
6375 uIntelligence = StatTable[v1][1].uBaseValue; | |
6376 uWillpower = StatTable[v1][2].uBaseValue; | |
6377 uEndurance = StatTable[v1][3].uBaseValue; | |
6378 uAccuracy = StatTable[v1][4].uBaseValue; | |
6379 uSpeed = StatTable[v1][5].uBaseValue; | |
6380 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6381 } |
6382 | |
6383 //----- (004901FC) -------------------------------------------------------- | |
6384 int Player::SetSexByVoice() | |
6385 { | |
6386 __int64 v1; // qax@1 | |
6387 | |
6388 v1 = this->uVoiceID; | |
6389 switch ( (int)v1 ) | |
6390 { | |
6391 case 0: | |
6392 case 1: | |
6393 case 2: | |
6394 case 3: | |
6395 case 8: | |
6396 case 9: | |
6397 case 0xC: | |
6398 case 0xD: | |
6399 case 0x10: | |
6400 case 0x11: | |
6401 case 0x14: | |
6402 case 0x17: | |
6403 BYTE4(v1) = 0; | |
6404 break; | |
6405 case 4: | |
6406 case 5: | |
6407 case 6: | |
6408 case 7: | |
6409 case 0xA: | |
6410 case 0xB: | |
6411 case 0xE: | |
6412 case 0xF: | |
6413 case 0x12: | |
6414 case 0x13: | |
6415 case 0x15: | |
6416 case 0x18: | |
6417 BYTE4(v1) = 1; | |
6418 break; | |
6419 default: | |
6420 break; | |
6421 } | |
6422 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6423 return v1; | |
6424 } | |
6425 | |
6426 //----- (0049024A) -------------------------------------------------------- | |
135 | 6427 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6428 { |
6429 sLevelModifier = 0; | |
6430 sAgeModifier = 0; | |
6431 | |
135 | 6432 classType = cls; |
0 | 6433 uLuckBonus = 0; |
6434 uSpeedBonus = 0; | |
6435 uAccuracyBonus = 0; | |
6436 uEnduranceBonus = 0; | |
6437 uWillpowerBonus = 0; | |
6438 uIntelligenceBonus = 0; | |
6439 uMightBonus = 0; | |
6440 uLevel = 1; | |
6441 uExperience = 251 + rand() % 100; | |
6442 uBirthYear = 1147 - rand() % 6; | |
6443 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6444 memset(_guilds_member_bits, 0, 64); |
0 | 6445 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6446 | |
6447 for (uint i = 0; i < 37; ++i) | |
6448 { | |
135 | 6449 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6450 continue; |
6451 | |
6452 pActiveSkills[i] = 1; | |
6453 | |
6454 switch (i) | |
6455 { | |
486 | 6456 case PLAYER_SKILL_FIRE: spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; |
6457 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6458 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6459 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
569 | 6460 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; |
6461 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6462 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6463 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6464 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; | |
6465 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6466 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6467 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6468 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6469 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6470 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6471 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6472 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6473 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6474 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6475 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6476 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6477 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6478 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6479 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6480 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6481 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6482 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6483 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
486 | 6484 break; |
198 | 6485 case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; break; |
6486 case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; break; | |
6487 case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; break; | |
6488 case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break; | |
6489 case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; break; | |
569 | 6490 case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; |
6491 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6492 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6493 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6494 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6495 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6496 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6497 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6498 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6499 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6500 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6501 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; | |
6502 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6503 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6504 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6505 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6506 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6507 break; | |
198 | 6508 case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; break; |
6509 case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; break; | |
0 | 6510 } |
6511 } | |
6512 | |
6513 sHealth = GetMaxHealth(); | |
6514 sMana = GetMaxMana(); | |
6515 } | |
6516 | |
6517 //----- (004903C9) -------------------------------------------------------- | |
821 | 6518 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6519 { | |
6520 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6521 int v3; // edx@5 |
6522 char *v4; // ecx@5 | |
6523 int v5; // esi@11 | |
6524 unsigned __int16 *v6; // edx@11 | |
6525 int v7; // esi@18 | |
6526 unsigned __int16 *pActiveSkill; // edx@18 | |
6527 | |
6528 if ( order >= 0 ) | |
6529 { | |
6530 if ( order <= 1 ) | |
6531 { | |
6532 result = (PLAYER_SKILL_TYPE)0; | |
6533 v7 = 0; | |
6534 pActiveSkill = this->pActiveSkills; | |
6535 do | |
6536 { | |
135 | 6537 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6538 { |
6539 if ( v7 == order ) | |
6540 return result; | |
6541 ++v7; | |
6542 } | |
6543 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6544 ++pActiveSkill; | |
6545 } | |
6546 while ( (signed int)result < 37 ); | |
6547 } | |
6548 else | |
6549 { | |
6550 if ( order <= 3 ) | |
6551 { | |
6552 result = (PLAYER_SKILL_TYPE)0; | |
6553 v5 = 0; | |
6554 pActiveSkill = this->pActiveSkills; | |
6555 do | |
6556 { | |
135 | 6557 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6558 { |
6559 if ( v5 == order - 2 ) | |
6560 return result; | |
6561 ++v5; | |
6562 } | |
6563 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6564 ++pActiveSkill; | |
6565 } | |
6566 while ( (signed int)result < 37 ); | |
6567 } | |
6568 else | |
6569 { | |
6570 if ( order <= 12 ) | |
6571 { | |
6572 result = (PLAYER_SKILL_TYPE)0; | |
6573 v3 = 0; | |
135 | 6574 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6575 do |
6576 { | |
6577 if ( *v4 == 1 ) | |
6578 { | |
6579 if ( v3 == order - 4 ) | |
6580 return result; | |
6581 ++v3; | |
6582 } | |
6583 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6584 ++v4; | |
6585 } | |
6586 while ( (signed int)result < 37 ); | |
6587 } | |
6588 } | |
6589 } | |
6590 } | |
6591 return (PLAYER_SKILL_TYPE)37; | |
6592 } | |
6593 | |
6594 | |
6595 | |
6596 //----- (0049048D) -------------------------------------------------------- | |
6597 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6598 void Player::DecreaseAttribute(int eAttribute) | |
6599 { | |
6600 int v2; // eax@1 | |
6601 int pBaseValue; // ecx@1 | |
6602 int pDroppedStep; // ebx@1 | |
6603 int pStep; // esi@1 | |
6604 unsigned __int16 result; // ax@7 | |
6605 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6606 | |
6607 v2 = eAttribute + 7 * GetRace(); | |
290 | 6608 pBaseValue = StatTable[0][v2].uBaseValue; |
6609 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6610 uMinValue = pBaseValue - 2; |
290 | 6611 pStep = StatTable[0][v2].uBaseStep; |
0 | 6612 switch ( eAttribute ) |
6613 { | |
6614 case CHARACTER_MIGHT: | |
6615 if ( this->uMight <= pBaseValue ) | |
6616 pStep = pDroppedStep; | |
6617 if ( this->uMight - pStep >= uMinValue ) | |
6618 this->uMight -= pStep; | |
6619 break; | |
6620 case CHARACTER_INTELLIGANCE: | |
6621 if ( this->uIntelligence <= pBaseValue ) | |
6622 pStep = pDroppedStep; | |
6623 if ( this->uIntelligence - pStep >= uMinValue ) | |
6624 this->uIntelligence -= pStep; | |
6625 break; | |
6626 case CHARACTER_WILLPOWER: | |
6627 if ( this->uWillpower <= pBaseValue ) | |
6628 pStep = pDroppedStep; | |
6629 if ( this->uWillpower - pStep >= uMinValue ) | |
6630 this->uWillpower -= pStep; | |
6631 break; | |
6632 case CHARACTER_ENDURANCE: | |
6633 if ( this->uEndurance <= pBaseValue ) | |
6634 pStep = pDroppedStep; | |
6635 if ( this->uEndurance - pStep >= uMinValue ) | |
6636 this->uEndurance -= pStep; | |
6637 break; | |
6638 case CHARACTER_ACCURACY: | |
6639 if ( this->uAccuracy <= pBaseValue ) | |
6640 pStep = pDroppedStep; | |
6641 if ( this->uAccuracy - pStep >= uMinValue ) | |
6642 this->uAccuracy -= pStep; | |
6643 break; | |
6644 case CHARACTER_SPEED: | |
6645 if ( this->uSpeed <= pBaseValue ) | |
6646 pStep = pDroppedStep; | |
6647 if ( this->uSpeed - pStep >= uMinValue ) | |
6648 this->uSpeed -= pStep; | |
6649 break; | |
6650 case CHARACTER_LUCK: | |
6651 if ( this->uLuck <= pBaseValue ) | |
6652 pStep = pDroppedStep; | |
6653 if ( this->uLuck - pStep >= uMinValue ) | |
6654 this->uLuck -= pStep; | |
6655 break; | |
6656 } | |
6657 } | |
6658 | |
6659 //----- (004905F5) -------------------------------------------------------- | |
6660 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6661 int Player::IncreaseAttribute(int eAttribute) | |
6662 { | |
6663 Player *v2; // esi@1 | |
6664 int v3; // eax@1 | |
6665 int v4; // ebx@1 | |
6666 signed int v5; // edi@1 | |
6667 int v6; // eax@8 | |
6668 signed int v7; // eax@17 | |
6669 signed int result; // eax@18 | |
6670 int v9; // [sp+Ch] [bp-8h]@1 | |
6671 signed int v10; // [sp+10h] [bp-4h]@1 | |
6672 | |
6673 v2 = this; | |
6674 v3 = eAttribute + 7 * GetRace(); | |
290 | 6675 v4 = StatTable[0][v3].uMaxValue; |
6676 v5 = StatTable[0][v3].uBaseStep; | |
6677 v9 = StatTable[0][v3].uBaseValue; | |
6678 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6679 PlayerCreation_ComputeAttributeBonus(); |
6680 if ( eAttribute ) | |
6681 { | |
6682 switch ( eAttribute ) | |
6683 { | |
6684 case 1: | |
6685 v6 = v2->uIntelligence; | |
6686 break; | |
6687 case 2: | |
6688 v6 = v2->uWillpower; | |
6689 break; | |
6690 case 3: | |
6691 v6 = v2->uEndurance; | |
6692 break; | |
6693 case 4: | |
6694 v6 = v2->uAccuracy; | |
6695 break; | |
6696 case 5: | |
6697 v6 = v2->uSpeed; | |
6698 break; | |
6699 case 6: | |
6700 v6 = v2->uLuck; | |
6701 break; | |
6702 default: | |
6703 v6 = eAttribute; | |
6704 break; | |
6705 } | |
6706 } | |
6707 else | |
6708 { | |
6709 v6 = v2->uMight; | |
6710 } | |
6711 if ( v6 < v9 ) | |
6712 { | |
6713 v7 = v5; | |
6714 v5 = v10; | |
6715 v10 = v7; | |
6716 } | |
6717 result = PlayerCreation_ComputeAttributeBonus(); | |
6718 if ( result >= v10 ) | |
6719 { | |
6720 if ( eAttribute ) | |
6721 { | |
6722 switch ( eAttribute ) | |
6723 { | |
6724 case 1: | |
6725 result = (signed int)&v2->uIntelligence; | |
6726 break; | |
6727 case 2: | |
6728 result = (signed int)&v2->uWillpower; | |
6729 break; | |
6730 case 3: | |
6731 result = (signed int)&v2->uEndurance; | |
6732 break; | |
6733 case 4: | |
6734 result = (signed int)&v2->uAccuracy; | |
6735 break; | |
6736 case 5: | |
6737 result = (signed int)&v2->uSpeed; | |
6738 break; | |
6739 default: | |
6740 result = eAttribute - 6; | |
6741 if ( eAttribute != 6 ) | |
6742 return result; | |
6743 result = (signed int)&v2->uLuck; | |
6744 break; | |
6745 } | |
6746 } | |
6747 else | |
6748 { | |
6749 result = (signed int)&v2->uMight; | |
6750 } | |
6751 if ( v5 + *(short *)result <= v4 ) | |
6752 *(short *)result += v5; | |
6753 } | |
6754 return result; | |
6755 } | |
6756 | |
6757 //----- (0049070F) -------------------------------------------------------- | |
6758 void Player::Zero() | |
6759 { | |
6760 Player *v1; // esi@1 | |
6761 | |
6762 v1 = this; | |
6763 this->sLevelModifier = 0; | |
6764 this->sACModifier = 0; | |
6765 this->uLuckBonus = 0; | |
6766 this->uAccuracyBonus = 0; | |
6767 this->uSpeedBonus = 0; | |
6768 this->uEnduranceBonus = 0; | |
6769 this->uWillpowerBonus = 0; | |
6770 this->uIntelligenceBonus = 0; | |
6771 this->uMightBonus = 0; | |
6772 this->field_100 = 0; | |
6773 this->field_FC = 0; | |
6774 this->field_F8 = 0; | |
6775 this->field_F4 = 0; | |
6776 this->field_F0 = 0; | |
6777 this->field_EC = 0; | |
6778 this->field_E8 = 0; | |
6779 this->field_E4 = 0; | |
6780 this->field_E0 = 0; | |
766 | 6781 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6782 v1->field_1A97 = 0; |
6783 v1->_ranged_dmg_bonus = 0; | |
6784 v1->field_1A95 = 0; | |
6785 v1->_ranged_atk_bonus = 0; | |
6786 v1->field_1A93 = 0; | |
6787 v1->_melee_dmg_bonus = 0; | |
6788 v1->field_1A91 = 0; | |
6789 v1->_some_attack_bonus = 0; | |
6790 v1->_mana_related = 0; | |
6791 v1->uFullManaBonus = 0; | |
6792 v1->_health_related = 0; | |
6793 v1->uFullHealthBonus = 0; | |
6794 } | |
6795 | |
6796 //----- (004907E7) -------------------------------------------------------- | |
299 | 6797 unsigned int Player::GetStatColor(int uStat) |
0 | 6798 { |
6799 __int16 uWhite; // si@1 | |
290 | 6800 int attribute_value; // edx@1 |
299 | 6801 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6802 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6803 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6804 | |
6805 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6806 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6807 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
299 | 6808 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6809 |
0 | 6810 switch (uStat) |
6811 { | |
6812 case 0: attribute_value = uMight; break; | |
6813 case 1: attribute_value = uIntelligence; break; | |
6814 case 2: attribute_value = uWillpower; break; | |
6815 case 3: attribute_value = uEndurance; break; | |
290 | 6816 case 4: attribute_value = uAccuracy; break; |
6817 case 5: attribute_value = uSpeed; break; | |
0 | 6818 case 6: attribute_value = uLuck; break; |
6819 }; | |
6820 | |
299 | 6821 if ( attribute_value == pBaseAttrValue ) |
290 | 6822 return uWhite; |
299 | 6823 else if ( attribute_value > pBaseAttrValue ) |
290 | 6824 return uGreen; |
0 | 6825 else |
290 | 6826 return uRed; |
0 | 6827 } |
6828 | |
6829 //----- (004908A8) -------------------------------------------------------- | |
6830 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6831 { | |
6832 unsigned __int64 *result; // eax@1 | |
6833 | |
6834 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6835 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6836 { | |
6837 *(int *)result = 0; | |
6838 *((int *)result + 1) = 0; | |
6839 LOBYTE(result) = 1; | |
6840 } | |
6841 else | |
6842 { | |
6843 LOBYTE(result) = 0; | |
6844 } | |
6845 return (bool)result; | |
6846 } | |
6847 | |
6848 //----- (004680ED) -------------------------------------------------------- | |
6849 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6850 { | |
6851 Player *v3; // esi@1 | |
6852 unsigned int v4; // ebx@4 | |
6853 signed int v5; // eax@17 | |
6854 unsigned int v6; // eax@26 | |
6855 unsigned __int8 v7; // cf@37 | |
6856 int v8; // edx@39 | |
6857 int v9; // edx@40 | |
6858 int v10; // edx@41 | |
6859 int v11; // edx@42 | |
6860 int v12; // edx@43 | |
6861 char *v13; // eax@45 | |
6862 AudioPlayer *v14; // ecx@62 | |
6863 signed int v15; // edi@68 | |
6864 int v16; // edx@73 | |
6865 unsigned __int16 *v17; // edi@73 | |
6866 unsigned int v18; // eax@73 | |
6867 int v19; // eax@74 | |
6868 int v20; // eax@75 | |
6869 signed int v21; // eax@81 | |
6870 const char *v22; // eax@84 | |
6871 char *v23; // ecx@90 | |
6872 int v24; // esi@96 | |
6873 int v25; // eax@109 | |
6874 int v26; // eax@113 | |
6875 char *v27; // edi@114 | |
6876 signed __int64 v28; // qax@120 | |
6877 char *v29; // ecx@120 | |
6878 int v30; // edi@137 | |
6879 int v31; // ST30_4@137 | |
6880 int v32; // ST3C_4@137 | |
6881 int v33; // ST40_4@137 | |
6882 int v34; // ST34_4@137 | |
6883 int v35; // ST38_4@137 | |
6884 unsigned __int8 v36; // al@173 | |
6885 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6886 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6887 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6888 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6889 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6890 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6891 signed int v43; // [sp-14h] [bp-40h]@18 | |
6892 signed int v44; // [sp-14h] [bp-40h]@174 | |
6893 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6894 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6895 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6896 int v48; // [sp-Ch] [bp-38h]@18 | |
6897 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6898 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6899 int v51; // [sp-Ch] [bp-38h]@174 | |
6900 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6901 char *v53; // [sp-8h] [bp-34h]@33 | |
6902 int v54; // [sp-8h] [bp-34h]@34 | |
6903 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6904 int v56; // [sp-8h] [bp-34h]@66 | |
6905 const char *v57; // [sp-8h] [bp-34h]@69 | |
6906 const char *v58; // [sp-8h] [bp-34h]@89 | |
6907 int v59; // [sp-8h] [bp-34h]@120 | |
6908 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6909 int v61; // [sp-4h] [bp-30h]@18 | |
6910 char *v62; // [sp-4h] [bp-30h]@33 | |
6911 char *v63; // [sp-4h] [bp-30h]@34 | |
6912 int v64; // [sp-4h] [bp-30h]@60 | |
6913 int v65; // [sp-4h] [bp-30h]@66 | |
6914 const char *v66; // [sp-4h] [bp-30h]@69 | |
6915 signed int v67; // [sp-4h] [bp-30h]@77 | |
6916 const char *v68; // [sp-4h] [bp-30h]@89 | |
6917 int v69; // [sp-4h] [bp-30h]@110 | |
6918 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6919 int v71; // [sp-4h] [bp-30h]@174 | |
6920 char *v72; // [sp+20h] [bp-Ch]@68 | |
6921 signed int v73; // [sp+24h] [bp-8h]@1 | |
6922 char *v74; // [sp+24h] [bp-8h]@23 | |
6923 int v75; // [sp+24h] [bp-8h]@73 | |
6924 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6925 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6926 | |
6927 thisb = this; | |
243 | 6928 v3 = &pParty->pPlayers[a2-1]; |
0 | 6929 v73 = 1; |
6930 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6931 return; | |
6932 v4 = 0; | |
6933 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6934 { | |
6935 if ( pParty->pPickedItem.uItemID != 160 ) | |
6936 { | |
6937 if ( pParty->pPickedItem.uItemID == 161 ) | |
6938 { | |
6939 v27 = (char *)&v3->sMana; | |
6940 *(int *)v27 += 2; | |
6941 LABEL_170: | |
6942 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6943 *(int *)v27 = v3->GetMaxMana(); | |
6944 } | |
6945 else | |
6946 { | |
6947 if ( pParty->pPickedItem.uItemID != 162 ) | |
6948 { | |
6949 LABEL_167: | |
6950 v68 = pParty->pPickedItem.GetDisplayName(); | |
6951 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6952 goto LABEL_90; | |
6953 } | |
6954 v69 = 2; | |
6955 LABEL_111: | |
243 | 6956 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6957 } |
6958 LABEL_112: | |
187 | 6959 v3->PlaySound(SPEECH_36, 0); |
0 | 6960 goto LABEL_173; |
6961 } | |
6962 LABEL_172: | |
100 | 6963 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6964 goto LABEL_173; |
6965 } | |
6966 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6967 { | |
6968 switch ( pParty->pPickedItem.uItemID ) | |
6969 { | |
6970 case 0xDEu: | |
570 | 6971 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6972 goto LABEL_110; |
6973 case 0xDFu: | |
570 | 6974 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6975 goto LABEL_114; |
6976 case 0xE0u: | |
6977 LODWORD(v3->pConditions[1]) = 0; | |
6978 HIDWORD(v3->pConditions[1]) = 0; | |
6979 goto LABEL_112; | |
6980 case 0xE1u: | |
6981 LODWORD(v3->pConditions[11]) = 0; | |
6982 HIDWORD(v3->pConditions[11]) = 0; | |
6983 LODWORD(v3->pConditions[9]) = 0; | |
6984 HIDWORD(v3->pConditions[9]) = 0; | |
6985 LODWORD(v3->pConditions[7]) = 0; | |
6986 HIDWORD(v3->pConditions[7]) = 0; | |
6987 goto LABEL_112; | |
6988 case 0xE2u: | |
6989 LODWORD(v3->pConditions[10]) = 0; | |
6990 HIDWORD(v3->pConditions[10]) = 0; | |
6991 LODWORD(v3->pConditions[8]) = 0; | |
6992 HIDWORD(v3->pConditions[8]) = 0; | |
6993 LODWORD(v3->pConditions[6]) = 0; | |
6994 HIDWORD(v3->pConditions[6]) = 0; | |
6995 goto LABEL_112; | |
6996 case 0xE3u: | |
6997 LODWORD(v3->pConditions[2]) = 0; | |
6998 HIDWORD(v3->pConditions[2]) = 0; | |
6999 goto LABEL_112; | |
7000 case 0xE4u: | |
7001 if ( v3->pConditions[1] ) | |
7002 goto LABEL_173; | |
7003 v70 = 0; | |
7004 v59 = 0; | |
7005 v50 = 5; | |
7006 v46 = 3; | |
570 | 7007 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7008 v29 = (char *)&v3->pPlayerBuffs[7]; |
7009 goto LABEL_147; | |
7010 case 0xE5u: | |
7011 v70 = 0; | |
7012 v59 = 0; | |
7013 v50 = 5; | |
7014 v46 = 3; | |
570 | 7015 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7016 v29 = (char *)&v3->pPlayerBuffs[8]; |
7017 goto LABEL_147; | |
7018 case 0xE6u: | |
7019 v70 = 0; | |
7020 v59 = 0; | |
7021 v50 = 5; | |
7022 v46 = 3; | |
570 | 7023 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7024 v29 = (char *)&v3->pPlayerBuffs[1]; |
7025 goto LABEL_147; | |
7026 case 0xE7u: | |
7027 v70 = 0; | |
7028 v59 = 0; | |
570 | 7029 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7030 v46 = 0; |
570 | 7031 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7032 v29 = (char *)&v3->pPlayerBuffs[11]; |
7033 goto LABEL_147; | |
7034 case 0xE8u: | |
7035 v70 = 0; | |
7036 v59 = 0; | |
570 | 7037 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7038 v46 = 0; |
570 | 7039 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7040 v29 = (char *)&v3->pPlayerBuffs[13]; |
7041 goto LABEL_147; | |
7042 case 0xEAu: | |
7043 v70 = 0; | |
7044 v59 = 0; | |
7045 v50 = 5; | |
7046 v46 = 3; | |
570 | 7047 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7048 v29 = (char *)&v3->pPlayerBuffs[14]; |
7049 goto LABEL_147; | |
7050 case 0xEBu: | |
7051 v3->pPlayerBuffs[23].Apply( | |
570 | 7052 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7053 3u, |
7054 5u, | |
7055 0, | |
7056 0); | |
7057 goto LABEL_173; | |
7058 case 0xEDu: | |
7059 LODWORD(v3->pConditions[3]) = 0; | |
7060 HIDWORD(v3->pConditions[3]) = 0; | |
7061 goto LABEL_112; | |
7062 case 0xEEu: | |
7063 LODWORD(v3->pConditions[0]) = 0; | |
7064 HIDWORD(v3->pConditions[0]) = 0; | |
7065 goto LABEL_112; | |
7066 case 0xEFu: | |
7067 LODWORD(v3->pConditions[5]) = 0; | |
7068 HIDWORD(v3->pConditions[5]) = 0; | |
7069 goto LABEL_112; | |
7070 case 0xF0u: | |
7071 v70 = 0; | |
7072 v59 = 0; | |
570 | 7073 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7074 v46 = 0; |
570 | 7075 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7076 v29 = (char *)&v3->pPlayerBuffs[19]; |
7077 goto LABEL_147; | |
7078 case 0xF1u: | |
7079 v70 = 0; | |
7080 v59 = 0; | |
570 | 7081 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7082 v46 = 0; |
570 | 7083 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7084 v29 = (char *)&v3->pPlayerBuffs[17]; |
7085 goto LABEL_147; | |
7086 case 0xF2u: | |
7087 v70 = 0; | |
7088 v59 = 0; | |
570 | 7089 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7090 v46 = 0; |
570 | 7091 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7092 v29 = (char *)&v3->pPlayerBuffs[20]; |
7093 goto LABEL_147; | |
7094 case 0xF3u: | |
7095 v70 = 0; | |
7096 v59 = 0; | |
570 | 7097 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7098 v46 = 0; |
570 | 7099 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7100 v29 = (char *)&v3->pPlayerBuffs[16]; |
7101 goto LABEL_147; | |
7102 case 0xF4u: | |
7103 v70 = 0; | |
7104 v59 = 0; | |
570 | 7105 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7106 v46 = 0; |
570 | 7107 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7108 v29 = (char *)&v3->pPlayerBuffs[21]; |
7109 goto LABEL_147; | |
7110 case 0xF5u: | |
7111 v70 = 0; | |
7112 v59 = 0; | |
570 | 7113 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7114 v46 = 0; |
570 | 7115 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7116 v29 = (char *)&v3->pPlayerBuffs[15]; |
7117 goto LABEL_147; | |
7118 case 0xFBu: | |
7119 LODWORD(v3->pConditions[12]) = 0; | |
7120 HIDWORD(v3->pConditions[12]) = 0; | |
7121 goto LABEL_112; | |
7122 case 0xFCu: | |
7123 v30 = LODWORD(v3->pConditions[14]); | |
7124 v31 = HIDWORD(v3->pConditions[14]); | |
7125 v32 = LODWORD(v3->pConditions[15]); | |
7126 v33 = HIDWORD(v3->pConditions[15]); | |
7127 v34 = LODWORD(v3->pConditions[16]); | |
7128 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7129 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7130 HIDWORD(v3->pConditions[14]) = v31; |
7131 LODWORD(v3->pConditions[15]) = v32; | |
7132 HIDWORD(v3->pConditions[15]) = v33; | |
7133 LODWORD(v3->pConditions[16]) = v34; | |
7134 LODWORD(v3->pConditions[14]) = v30; | |
7135 HIDWORD(v3->pConditions[16]) = v35; | |
7136 goto LABEL_112; | |
7137 case 0xFDu: | |
570 | 7138 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7139 LABEL_110: |
7140 v69 = v25; | |
7141 goto LABEL_111; | |
7142 case 0xFEu: | |
570 | 7143 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7144 LABEL_114: |
7145 v27 = (char *)&v3->sMana; | |
7146 *(int *)v27 += v26; | |
7147 goto LABEL_170; | |
7148 case 0xFFu: | |
7149 v70 = 0; | |
7150 v59 = 0; | |
570 | 7151 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7152 v46 = 0; |
570 | 7153 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7154 v29 = (char *)&v3->pPlayerBuffs[18]; |
7155 goto LABEL_147; | |
7156 case 0x100u: | |
7157 v70 = 0; | |
7158 v59 = 0; | |
570 | 7159 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7160 v46 = 0; |
570 | 7161 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7162 v29 = (char *)&v3->pPlayerBuffs[5]; |
7163 goto LABEL_147; | |
7164 case 0x101u: | |
7165 v70 = 0; | |
7166 v59 = 0; | |
570 | 7167 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7168 v46 = 0; |
570 | 7169 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7170 v29 = (char *)v3->pPlayerBuffs; |
7171 goto LABEL_147; | |
7172 case 0x102u: | |
7173 v70 = 0; | |
7174 v59 = 0; | |
570 | 7175 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7176 v46 = 0; |
570 | 7177 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7178 v29 = (char *)&v3->pPlayerBuffs[22]; |
7179 goto LABEL_147; | |
7180 case 0x103u: | |
7181 v70 = 0; | |
7182 v59 = 0; | |
570 | 7183 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7184 v46 = 0; |
570 | 7185 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7186 v29 = (char *)&v3->pPlayerBuffs[3]; |
7187 goto LABEL_147; | |
7188 case 0x104u: | |
7189 v70 = 0; | |
7190 v59 = 0; | |
570 | 7191 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7192 v46 = 0; |
570 | 7193 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7194 v29 = (char *)&v3->pPlayerBuffs[9]; |
7195 goto LABEL_147; | |
7196 case 0x105u: | |
7197 v70 = 0; | |
7198 v59 = 0; | |
570 | 7199 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7200 v46 = 0; |
570 | 7201 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7202 v29 = (char *)&v3->pPlayerBuffs[2]; |
7203 LABEL_147: | |
7204 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7205 goto LABEL_112; | |
7206 case 0x106u: | |
7207 LODWORD(v3->pConditions[15]) = 0; | |
7208 HIDWORD(v3->pConditions[15]) = 0; | |
7209 goto LABEL_112; | |
7210 case 0x108u: | |
7211 if ( !*(int *)&v3->field_1F5[3] ) | |
7212 { | |
7213 v3->uLuck += 50; | |
7214 *(int *)&v3->field_1F5[3] = 1; | |
7215 } | |
7216 goto LABEL_112; | |
7217 case 0x109u: | |
7218 if ( !*(int *)&v3->field_1F5[7] ) | |
7219 { | |
7220 v3->uSpeed += 50; | |
7221 *(int *)&v3->field_1F5[7] = 1; | |
7222 } | |
7223 goto LABEL_112; | |
7224 case 0x10Au: | |
7225 if ( !*(int *)&v3->field_1F5[11] ) | |
7226 { | |
7227 v3->uIntelligence += 50; | |
7228 *(int *)&v3->field_1F5[11] = 1; | |
7229 } | |
7230 goto LABEL_112; | |
7231 case 0x10Bu: | |
7232 if ( !*(int *)&v3->field_1F5[15] ) | |
7233 { | |
7234 v3->uEndurance += 50; | |
7235 *(int *)&v3->field_1F5[15] = 1; | |
7236 } | |
7237 goto LABEL_112; | |
7238 case 0x10Cu: | |
7239 if ( !*(int *)&v3->field_1F5[19] ) | |
7240 { | |
7241 v3->uWillpower += 50; | |
7242 *(int *)&v3->field_1F5[19] = 1; | |
7243 } | |
7244 goto LABEL_112; | |
7245 case 0x10Du: | |
7246 if ( !*(int *)&v3->field_1F5[23] ) | |
7247 { | |
7248 v3->uAccuracy += 50; | |
7249 *(int *)&v3->field_1F5[23] = 1; | |
7250 } | |
7251 goto LABEL_112; | |
7252 case 0x10Eu: | |
7253 if ( !*(int *)&v3->field_1F5[27] ) | |
7254 { | |
7255 v3->uMight += 50; | |
7256 *(int *)&v3->field_1F5[27] = 1; | |
7257 } | |
7258 goto LABEL_112; | |
7259 case 0x10Fu: | |
7260 v3->sAgeModifier = 0; | |
7261 goto LABEL_112; | |
809 | 7262 case 0xDDu: |
7263 goto LABEL_172; | |
0 | 7264 default: |
7265 goto LABEL_167; | |
7266 } | |
7267 goto LABEL_172; | |
7268 } | |
7269 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7270 { | |
7271 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7272 { | |
7273 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7274 { | |
7275 if ( pParty->pPickedItem.uItemID == 616 ) | |
7276 { | |
7277 thisa = pParty->uCurrentMonthWeek + 1; | |
7278 if ( pParty->uCurrentMonth >= 7 ) | |
7279 v74 = 0; | |
7280 else | |
7281 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7282 switch ( pParty->uCurrentMonth ) | |
7283 { | |
7284 case 0u: | |
7285 v6 = pParty->uCurrentMonthWeek + 1; | |
7286 v3->uMight += thisa; | |
7287 goto LABEL_33; | |
7288 case 1u: | |
7289 v6 = pParty->uCurrentMonthWeek + 1; | |
7290 v3->uIntelligence += thisa; | |
7291 goto LABEL_33; | |
7292 case 2u: | |
7293 v6 = pParty->uCurrentMonthWeek + 1; | |
7294 v3->uWillpower += thisa; | |
7295 goto LABEL_33; | |
7296 case 3u: | |
7297 v6 = pParty->uCurrentMonthWeek + 1; | |
7298 v3->uEndurance += thisa; | |
7299 goto LABEL_33; | |
7300 case 4u: | |
7301 v6 = pParty->uCurrentMonthWeek + 1; | |
7302 v3->uAccuracy += thisa; | |
7303 goto LABEL_33; | |
7304 case 5u: | |
7305 v6 = pParty->uCurrentMonthWeek + 1; | |
7306 v3->uSpeed += thisa; | |
7307 goto LABEL_33; | |
7308 case 6u: | |
7309 v6 = pParty->uCurrentMonthWeek + 1; | |
7310 v3->uLuck += thisa; | |
7311 LABEL_33: | |
7312 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7313 v53 = v74; | |
7314 v49 = v6; | |
7315 goto LABEL_53; | |
7316 case 7u: | |
7317 party_finds_gold(1000 * thisa, 0); | |
7318 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7319 v54 = 1000 * thisa; | |
7320 goto LABEL_38; | |
7321 case 8u: | |
7322 Party::GiveFood(5 * thisa); | |
7323 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7324 v54 = 5 * thisa; | |
7325 goto LABEL_38; | |
7326 case 9u: | |
7327 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7328 v3->uSkillPoints += 2 * thisa; | |
7329 v54 = 2 * thisa; | |
7330 goto LABEL_38; | |
7331 case 0xAu: | |
7332 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7333 v54 = 2500 * thisa; | |
7334 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7335 LODWORD(v3->uExperience) += 2500 * thisa; | |
7336 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7337 LABEL_38: | |
7338 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7339 goto LABEL_54; | |
7340 case 0xBu: | |
7341 v8 = rand() % 6; | |
7342 if ( v8 ) | |
7343 { | |
7344 v9 = v8 - 1; | |
7345 if ( v9 ) | |
7346 { | |
7347 v10 = v9 - 1; | |
7348 if ( v10 ) | |
7349 { | |
7350 v11 = v10 - 1; | |
7351 if ( v11 ) | |
7352 { | |
7353 v12 = v11 - 1; | |
7354 if ( v12 ) | |
7355 { | |
7356 if ( v12 != 1 ) | |
7357 goto LABEL_52; | |
7358 v3->sResBodyBase += thisa; | |
7359 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7360 } | |
7361 else | |
7362 { | |
7363 v3->sResMindBase += thisa; | |
7364 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7365 } | |
7366 } | |
7367 else | |
7368 { | |
7369 v3->sResEarthBase += thisa; | |
7370 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7371 } | |
7372 } | |
7373 else | |
7374 { | |
7375 v3->sResWaterBase += thisa; | |
7376 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7377 } | |
7378 } | |
7379 else | |
7380 { | |
7381 v3->sResAirBase += thisa; | |
7382 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7383 } | |
7384 } | |
7385 else | |
7386 { | |
7387 v3->sResFireBase += thisa; | |
7388 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7389 } | |
7390 v74 = v13; | |
7391 LABEL_52: | |
7392 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7393 v53 = v74; | |
7394 v49 = thisa; | |
7395 LABEL_53: | |
7396 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7397 LABEL_54: | |
7398 ShowStatusBarString(pTmpBuf, 2u); | |
7399 pMouse->RemoveHoldingItem(); | |
7400 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7401 v3->PlaySound(SPEECH_93, 0); |
0 | 7402 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7403 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7404 { | |
7405 v64 = 0; | |
7406 v55 = 16; | |
7407 } | |
7408 else | |
7409 { | |
7410 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7411 { | |
7412 v64 = 0; | |
7413 v55 = 14; | |
7414 } | |
7415 else | |
7416 { | |
7417 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7418 return; | |
7419 v64 = 0; | |
7420 v55 = 15; | |
7421 } | |
7422 } | |
7423 v3->SetCondition(v55, v64); | |
7424 v61 = 0; | |
7425 v52 = 0; | |
7426 v48 = 0; | |
7427 v45 = 0; | |
7428 v43 = -1; | |
7429 v41 = 0; | |
7430 v39 = 0; | |
7431 v37 = (SoundID)215; | |
7432 v14 = pAudioPlayer; | |
7433 goto LABEL_63; | |
7434 default: | |
7435 goto LABEL_54; | |
7436 } | |
7437 } | |
7438 if ( pParty->pPickedItem.uItemID == 630 ) | |
7439 { | |
7440 Party::GiveFood(1u); | |
7441 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7442 } | |
7443 else | |
7444 { | |
7445 if ( pParty->pPickedItem.uItemID == 632 ) | |
7446 { | |
7447 v61 = 0; | |
7448 v52 = 0; | |
7449 v48 = 0; | |
7450 v45 = 0; | |
7451 v43 = -1; | |
7452 v41 = 0; | |
7453 v39 = 0; | |
7454 v37 = (SoundID)133; | |
7455 goto LABEL_93; | |
7456 } | |
7457 if ( pParty->pPickedItem.uItemID == 633 ) | |
7458 { | |
7459 v61 = 0; | |
7460 v52 = 0; | |
7461 v48 = 0; | |
7462 v45 = 0; | |
7463 v43 = -1; | |
7464 v41 = 0; | |
7465 v39 = 0; | |
7466 v37 = (SoundID)134; | |
7467 goto LABEL_93; | |
7468 } | |
7469 if ( pParty->pPickedItem.uItemID == 634 ) | |
7470 { | |
7471 v61 = 0; | |
7472 v52 = 0; | |
7473 v48 = 0; | |
7474 v45 = 0; | |
7475 v43 = -1; | |
7476 v41 = 0; | |
7477 v39 = 0; | |
7478 v37 = (SoundID)135; | |
7479 goto LABEL_93; | |
7480 } | |
7481 if ( pParty->pPickedItem.uItemID != 646 ) | |
7482 { | |
7483 if ( pParty->pPickedItem.uItemID == 650 ) | |
7484 { | |
7485 sub_44C28F_open_nwc_dungeon(); | |
7486 return; | |
7487 } | |
7488 goto LABEL_167; | |
7489 } | |
7490 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7491 v5 = 8 * a2 + 392; | |
7492 LOBYTE(v5) = (8 * a2 - 120) | 4; | |
7493 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); | |
7494 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7495 } | |
7496 LABEL_187: | |
7497 pMouse->RemoveHoldingItem(); | |
7498 return; | |
7499 } | |
243 | 7500 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7501 { |
7502 sub_467F48(pParty->pPickedItem.uItemID); | |
7503 v65 = 0; | |
187 | 7504 v56 = SPEECH_37; |
0 | 7505 LABEL_67: |
187 | 7506 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7507 return; |
7508 } | |
7509 LABEL_89: | |
7510 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7511 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7512 LABEL_90: | |
809 | 7513 sprintfex(pTmpBuf, v58, v68); |
0 | 7514 v23 = pTmpBuf; |
7515 LABEL_91: | |
7516 ShowStatusBarString(v23, 2u); | |
7517 v4 = 0; | |
7518 goto LABEL_92; | |
7519 } | |
7520 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7521 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7522 if ( *v72 ) |
7523 { | |
7524 v66 = pParty->pPickedItem.GetDisplayName(); | |
7525 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7526 LABEL_72: | |
7527 sprintf(pTmpBuf, v57, v66); | |
7528 ShowStatusBarString(pTmpBuf, 2u); | |
7529 LABEL_92: | |
7530 v61 = v4; | |
7531 v52 = v4; | |
7532 v48 = v4; | |
7533 v45 = v4; | |
7534 v43 = -1; | |
7535 v41 = v4; | |
7536 v39 = v4; | |
7537 v37 = (SoundID)27; | |
7538 LABEL_93: | |
7539 v14 = pAudioPlayer; | |
7540 LABEL_63: | |
7541 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7542 return; | |
7543 } | |
243 | 7544 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7545 { |
7546 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7547 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7548 goto LABEL_72; | |
7549 } | |
7550 v16 = v15 % 11 + 1; | |
7551 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7552 v75 = v16; | |
7553 v18 = SkillToMastery(*v17) - 1; | |
7554 if ( v18 ) | |
7555 { | |
7556 v19 = v18 - 1; | |
7557 if ( v19 ) | |
7558 { | |
7559 v20 = v19 - 1; | |
7560 if ( v20 ) | |
7561 { | |
7562 if ( v20 != 1 ) | |
7563 { | |
7564 v21 = a2; | |
7565 LABEL_83: | |
7566 if ( v75 > v21 || !*v17 ) | |
7567 { | |
7568 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7569 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7570 ShowStatusBarString(pTmpBuf, 2u); |
7571 v65 = 0; | |
7572 v56 = 20; | |
7573 goto LABEL_67; | |
7574 } | |
7575 *v72 = 1; | |
187 | 7576 v3->PlaySound(SPEECH_21, 0); |
0 | 7577 v73 = 0; |
7578 LABEL_173: | |
7579 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7580 if ( v36 == 14 ) | |
7581 { | |
7582 v71 = 0; | |
7583 v60 = 0; | |
7584 v51 = 0; | |
7585 v47 = 0; | |
7586 v44 = -1; | |
7587 v42 = 0; | |
7588 v40 = 0; | |
7589 v38 = (SoundID)210; | |
7590 } | |
7591 else | |
7592 { | |
7593 if ( v36 != 13 ) | |
7594 { | |
7595 LABEL_178: | |
7596 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7597 { | |
7598 if ( !v73 ) | |
7599 goto LABEL_187; | |
437 | 7600 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7601 { |
7602 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7603 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7604 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7605 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7606 }*/ |
7607 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7608 } |
7609 if ( v73 ) | |
7610 { | |
7611 if ( pParty->bTurnBasedModeOn ) | |
7612 { | |
7613 *(&pParty->field_16140 + a2) = 100; | |
7614 thisb->SetRecoveryTime(100); | |
7615 pTurnEngine->_40471C(); | |
7616 } | |
7617 else | |
7618 { | |
7619 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7620 } | |
7621 } | |
7622 goto LABEL_187; | |
7623 } | |
7624 v71 = 0; | |
7625 v60 = 0; | |
7626 v51 = 0; | |
7627 v47 = 0; | |
7628 v44 = -1; | |
7629 v42 = 0; | |
7630 v40 = 0; | |
7631 v38 = (SoundID)211; | |
7632 } | |
7633 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7634 goto LABEL_178; | |
7635 } | |
7636 v67 = 11; | |
7637 } | |
7638 else | |
7639 { | |
7640 v67 = 10; | |
7641 } | |
7642 } | |
7643 else | |
7644 { | |
7645 v67 = 7; | |
7646 } | |
7647 } | |
7648 else | |
7649 { | |
7650 v67 = 4; | |
7651 } | |
7652 v21 = v67; | |
7653 goto LABEL_83; | |
7654 } | |
151 | 7655 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7656 return; |
243 | 7657 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7658 goto LABEL_89; |
7659 if ( bUnderwater == 1 ) | |
7660 { | |
7661 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7662 goto LABEL_91; | |
7663 } | |
7664 dword_50C9AC = 1; | |
7665 v24 = pParty->pPickedItem.uItemID - 299; | |
7666 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7667 { | |
7668 pMouse->RemoveHoldingItem(); | |
7669 pGUIWindow_CurrentMenu->Release(); | |
7670 pIcons_LOD->_4114F2(); | |
151 | 7671 pCurrentScreen = SCREEN_GAME; |
0 | 7672 viewparams->bRedrawGameUI = 1; |
7673 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7674 } | |
7675 else | |
7676 { | |
7677 _720984_unused = pParty->pPickedItem.uItemID; | |
7678 pMouse->RemoveHoldingItem(); | |
7679 if ( dword_50C9E8 < 40 ) | |
7680 { | |
7681 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7682 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7683 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7684 ++dword_50C9E8; |
7685 } | |
7686 if ( pCurrentScreen | |
7687 && pGUIWindow_CurrentMenu | |
437 | 7688 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7689 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7690 { | |
7691 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
0 | 7692 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7693 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7694 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7695 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7696 } | |
7697 } | |
7698 } | |
0 | 7699 |
7700 | |
7701 | |
7702 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7703 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7704 { | |
0 | 7705 Player *v3; // esi@1 |
7706 signed int v4; // edi@1 | |
7707 unsigned int v5; // eax@8 | |
7708 int v6; // eax@9 | |
7709 enum CHARACTER_RACE v7; // eax@11 | |
7710 signed int v8; // eax@17 | |
7711 unsigned __int8 v9; // sf@17 | |
7712 unsigned __int8 v10; // of@17 | |
7713 int v11; // eax@19 | |
7714 unsigned int v12; // eax@20 | |
484 | 7715 unsigned int test_bit_value; // eax@25 |
7716 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7717 signed int v15; // ecx@28 |
7718 ItemGen *v16; // eax@28 | |
7719 char v17; // zf@31 | |
7720 int v18; // edi@90 | |
7721 DDM_DLV_Header *v19; // eax@122 | |
7722 char v20; // cl@124 | |
7723 DDM_DLV_Header *v21; // eax@126 | |
7724 unsigned int v22; // edi@129 | |
100 | 7725 Player *v23; // esi@134 |
0 | 7726 ItemGen *v24; // ecx@135 |
7727 signed int v25; // edx@135 | |
7728 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7729 char *v27; // edi@155 | |
7730 int v28; // ebx@161 | |
7731 int v29; // eax@161 | |
7732 | |
469 | 7733 v6 = 0; |
0 | 7734 v3 = this; |
7735 v4 = -1; | |
469 | 7736 if ( VarNum > VAR_AutoNotes ) |
7737 { | |
7738 switch ( VarNum ) | |
0 | 7739 { |
7740 case VAR_Invisible: | |
484 | 7741 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7742 return true; |
484 | 7743 return false; |
0 | 7744 case VAR_NumDeaths: |
7745 v4 = pParty->uNumDeaths; | |
469 | 7746 return v4 >= pValue; |
0 | 7747 case VAR_NumBounties: |
7748 v4 = pParty->uNumBountiesCollected; | |
469 | 7749 return v4 >= pValue; |
0 | 7750 case VAR_PrisonTerms: |
7751 v4 = pParty->uNumPrisonTerms; | |
469 | 7752 return v4 >= pValue; |
0 | 7753 case VAR_ArenaWinsPage: |
7754 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7755 return v4 >= pValue; |
0 | 7756 case VAR_ArenaWinsSquire: |
7757 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7758 return v4 >= pValue; |
0 | 7759 case VAR_ArenaWinsKnight: |
7760 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7761 return v4 >= pValue; |
0 | 7762 case VAR_ArenaWinsLord: |
7763 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7764 return v4 >= pValue; |
0 | 7765 case VAR_ReputationInCurrentLocation: |
7766 v19 = &pOutdoor->ddm; | |
7767 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7768 v19 = &pIndoor->dlv; | |
469 | 7769 v6 = v19->uReputation >= pValue; |
7770 return v6; | |
0 | 7771 case VAR_History_28|VAR_Sex: |
7772 v21 = &pOutdoor->ddm; | |
7773 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7774 v21 = &pIndoor->dlv; | |
469 | 7775 v6 = v21->field_C_alert == pValue; |
0 | 7776 return v6; |
7777 case VAR_MonthEquals2|VAR_Sex: | |
7778 case VAR_MonthEquals2|VAR_Class: | |
7779 case VAR_Counter1: | |
7780 case VAR_Counter2: | |
7781 case VAR_Counter3: | |
7782 case VAR_Counter4: | |
7783 case VAR_Counter5: | |
7784 case VAR_Counter6: | |
7785 case VAR_Counter7: | |
7786 case VAR_Counter8: | |
469 | 7787 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7788 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7789 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7790 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7791 return true; | |
7792 return false; | |
0 | 7793 case VAR_NumSkillPoints: |
7794 v4 = this->uSkillPoints; | |
469 | 7795 return v4 >= pValue; |
0 | 7796 case VAR_CircusPrises: |
7797 v4 = 0; | |
100 | 7798 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7799 do |
7800 { | |
469 | 7801 v24 = v23->pInventoryItems; |
0 | 7802 v25 = 138; |
7803 do | |
7804 { | |
7805 switch ( v24->uItemID ) | |
7806 { | |
7807 case 0x1D6u: | |
7808 ++v4; | |
7809 break; | |
7810 case 0x1D7u: | |
7811 v4 += 3; | |
7812 break; | |
7813 case 0x1DDu: | |
7814 v4 += 5; | |
7815 break; | |
7816 } | |
7817 ++v24; | |
7818 --v25; | |
7819 } | |
7820 while ( v25 ); | |
100 | 7821 ++v23; |
0 | 7822 } |
100 | 7823 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7824 return v4 >= pValue; |
0 | 7825 case VAR_MonthEquals2: |
469 | 7826 v6 = pParty->uCurrentMonth == pValue; |
7827 return v6; | |
0 | 7828 case VAR_IsFlying: |
7829 if ( pParty->bFlying | |
484 | 7830 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7831 return true; |
7832 return false; | |
0 | 7833 case VAR_HiredNPCHasSpeciality: |
469 | 7834 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7835 return v6; |
7836 case VAR_NPCs2: | |
469 | 7837 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7838 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7839 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7840 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7841 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7842 return v4 >= pValue; |
7843 v4 = pValue; | |
7844 return v4 >= pValue; | |
0 | 7845 case VAR_ItemEquipped: |
7846 v26 = (ITEM_EQUIP_TYPE)0; | |
7847 v27 = (char *)&this->pEquipment; | |
7848 break; | |
7849 case VAR_GoldInBank: | |
7850 v4 = pParty->uNumGoldInBank; | |
469 | 7851 return v4 >= pValue; |
0 | 7852 case VAR_ThieverySkill|0x80: |
7853 v28 = GetActualMight(); | |
7854 v29 = v3->GetBaseStrength(); | |
7855 goto LABEL_168; | |
7856 case VAR_DisarmTrapSkill|0x80: | |
7857 v28 = GetActualIntelligence(); | |
7858 v29 = v3->GetBaseIntelligence(); | |
7859 goto LABEL_168; | |
7860 case VAR_MonthEquals: | |
7861 v28 = GetActualWillpower(); | |
7862 v29 = v3->GetBaseWillpower(); | |
7863 goto LABEL_168; | |
7864 case VAR_MonthEquals|VAR_Sex: | |
7865 v28 = GetActualEndurance(); | |
7866 v29 = v3->GetBaseEndurance(); | |
7867 goto LABEL_168; | |
7868 case VAR_IdentifyMonsterSkill|0x80: | |
7869 v28 = GetActualSpeed(); | |
7870 v29 = v3->GetBaseSpeed(); | |
7871 goto LABEL_168; | |
7872 case VAR_ArmsmasterSkill|0x80: | |
7873 v28 = GetActualAccuracy(); | |
7874 v29 = v3->GetBaseAccuracy(); | |
7875 goto LABEL_168; | |
7876 case VAR_MonthEquals|VAR_MaxHP: | |
7877 v28 = GetActualLuck(); | |
7878 v29 = v3->GetBaseLuck(); | |
7879 LABEL_168: | |
7880 v10 = __OFSUB__(v28, v29); | |
7881 v9 = v28 - v29 < 0; | |
7882 LABEL_169: | |
7883 if ( v9 ^ v10 ) | |
469 | 7884 return v4 >= pValue; |
7885 return true; | |
0 | 7886 default: |
469 | 7887 return v4 >= pValue; |
0 | 7888 } |
7889 while ( !v3->HasItemEquipped(v26) | |
654 | 7890 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7891 { |
7892 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7893 v27 += 4; | |
7894 if ( (signed int)v26 >= 16 ) | |
469 | 7895 return false; |
7896 } | |
7897 return true; | |
7898 } | |
7899 if ( VarNum == VAR_AutoNotes ) | |
0 | 7900 { |
484 | 7901 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7902 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7903 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7904 return false; | |
7905 return true; | |
469 | 7906 } |
7907 if ( VarNum <= VAR_BaseLuck ) | |
7908 { | |
7909 if ( VarNum != VAR_BaseLuck ) | |
7910 { | |
7911 switch ( VarNum ) | |
0 | 7912 { |
7913 case VAR_Hour: | |
469 | 7914 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7915 return true; | |
7916 return false; | |
0 | 7917 case VAR_DayOfYear: |
469 | 7918 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7919 v6 = v5 == pValue; | |
7920 return v6; | |
0 | 7921 case VAR_DayOfWeek: |
469 | 7922 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7923 v6 = v5 == pValue; | |
0 | 7924 return v6; |
7925 case VAR_Sex: | |
469 | 7926 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7927 return true; | |
7928 return v4 >= pValue; | |
0 | 7929 case VAR_Class: |
135 | 7930 v7 = (CHARACTER_RACE)this->classType; |
469 | 7931 if ( pValue == v7 ) |
7932 return true; | |
7933 return v4 >= pValue; | |
0 | 7934 case VAR_Race: |
7935 v7 = GetRace(); | |
469 | 7936 if ( pValue == v7 ) |
7937 return true; | |
7938 return v4 >= pValue; | |
0 | 7939 case VAR_CurrentHP: |
7940 v4 = this->sHealth; | |
469 | 7941 return v4 >= pValue; |
0 | 7942 case VAR_MaxHP: |
7943 v8 = GetMaxHealth(); | |
7944 v10 = __OFSUB__(v3->sHealth, v8); | |
7945 v9 = v3->sHealth - v8 < 0; | |
7946 goto LABEL_169; | |
7947 case VAR_CurrentSP: | |
7948 v4 = this->sMana; | |
469 | 7949 return v4 >= pValue; |
0 | 7950 case VAR_MaxSP: |
7951 v11 = GetMaxMana(); | |
7952 v10 = __OFSUB__(v3->sMana, v11); | |
7953 v9 = v3->sMana - v11 < 0; | |
7954 goto LABEL_169; | |
7955 case VAR_ActualAC: | |
7956 v12 = GetActualAC(); | |
7957 goto _j_cmp_against_arg; | |
7958 case VAR_ACModifier: | |
7959 v4 = this->sACModifier; | |
469 | 7960 return v4 >= pValue; |
0 | 7961 case VAR_BaseLevel: |
7962 v4 = this->uLevel; | |
469 | 7963 return v4 >= pValue; |
0 | 7964 case VAR_LevelModifier: |
7965 v4 = this->sLevelModifier; | |
469 | 7966 return v4 >= pValue; |
0 | 7967 case VAR_Age: |
7968 v12 = GetActualAge(); | |
7969 goto _j_cmp_against_arg; | |
7970 case VAR_Award: | |
484 | 7971 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7972 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7973 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7974 return true; | |
7975 return false; | |
0 | 7976 case VAR_Experience: |
7977 v4 = LODWORD(this->uExperience); | |
469 | 7978 return v4 >= pValue; |
0 | 7979 case VAR_QBits_QuestsDone: |
484 | 7980 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7981 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7982 if ( test_bit_value & our_bit_value ) | |
478 | 7983 return true; |
7984 return false; | |
0 | 7985 case VAR_PlayerItemInHands: |
7986 v15 = 0; | |
7987 v16 = v3->pInventoryItems; | |
7988 break; | |
7989 case VAR_FixedGold: | |
7990 v4 = pParty->uNumGold; | |
469 | 7991 return v4 >= pValue; |
0 | 7992 case VAR_MightBonus: |
7993 v4 = this->uMightBonus; | |
469 | 7994 return v4 >= pValue; |
0 | 7995 case VAR_IntellectBonus: |
7996 v4 = this->uIntelligenceBonus; | |
469 | 7997 return v4 >= pValue; |
0 | 7998 case VAR_PersonalityBonus: |
7999 v4 = this->uWillpowerBonus; | |
469 | 8000 return v4 >= pValue; |
0 | 8001 case VAR_EnduranceBonus: |
8002 v4 = this->uEnduranceBonus; | |
469 | 8003 return v4 >= pValue; |
0 | 8004 case VAR_SpeedBonus: |
8005 v4 = this->uSpeedBonus; | |
469 | 8006 return v4 >= pValue; |
0 | 8007 case VAR_AccuracyBonus: |
8008 v4 = this->uAccuracyBonus; | |
469 | 8009 return v4 >= pValue; |
0 | 8010 case VAR_LuckBonus: |
8011 v4 = this->uLuckBonus; | |
469 | 8012 return v4 >= pValue; |
0 | 8013 case VAR_BaseMight: |
8014 v4 = this->uMight; | |
469 | 8015 return v4 >= pValue; |
0 | 8016 case VAR_BaseIntellect: |
8017 v4 = this->uIntelligence; | |
469 | 8018 return v4 >= pValue; |
0 | 8019 case VAR_BasePersonality: |
8020 v4 = this->uWillpower; | |
469 | 8021 return v4 >= pValue; |
0 | 8022 case VAR_BaseEndurance: |
8023 v4 = this->uEndurance; | |
469 | 8024 return v4 >= pValue; |
0 | 8025 case VAR_BaseSpeed: |
8026 v4 = this->uSpeed; | |
469 | 8027 return v4 >= pValue; |
0 | 8028 case VAR_BaseAccuracy: |
8029 v4 = this->uAccuracy; | |
469 | 8030 return v4 >= pValue; |
0 | 8031 case VAR_FixedFood: |
8032 v4 = pParty->uNumFoodRations; | |
469 | 8033 return v4 >= pValue; |
0 | 8034 default: |
469 | 8035 return v4 >= pValue; |
8036 } | |
8037 while ( v16->uItemID != pValue ) | |
0 | 8038 { |
8039 ++v15; | |
8040 ++v16; | |
8041 if ( v15 >= 138 ) | |
8042 { | |
469 | 8043 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8044 return v6; |
8045 } | |
8046 } | |
469 | 8047 return true; |
0 | 8048 } |
8049 v4 = this->uLuck; | |
469 | 8050 return v4 >= pValue; |
8051 } | |
8052 if ( VarNum <= VAR_MagicResistance ) | |
8053 { | |
8054 if ( VarNum == VAR_MagicResistance ) | |
0 | 8055 { |
8056 v4 = this->sResMagicBase; | |
8057 } | |
8058 else | |
8059 { | |
469 | 8060 switch ( VarNum ) |
0 | 8061 { |
8062 case VAR_FireResistance: | |
8063 v4 = this->sResFireBase; | |
469 | 8064 return v4 >= pValue; |
0 | 8065 case VAR_AirResistance: |
8066 v4 = this->sResAirBase; | |
469 | 8067 return v4 >= pValue; |
0 | 8068 case VAR_WaterResistance: |
8069 v4 = this->sResWaterBase; | |
469 | 8070 return v4 >= pValue; |
0 | 8071 case VAR_EarthResistance: |
8072 v4 = this->sResEarthBase; | |
469 | 8073 return v4 >= pValue; |
0 | 8074 case VAR_SpiritResistance: |
8075 v4 = this->sResSpiritBase; | |
469 | 8076 return v4 >= pValue; |
0 | 8077 case VAR_MindResistance: |
8078 v4 = this->sResMindBase; | |
469 | 8079 return v4 >= pValue; |
0 | 8080 case VAR_BodyResistance: |
8081 v4 = this->sResBodyBase; | |
469 | 8082 return v4 >= pValue; |
0 | 8083 case VAR_LightResistance: |
8084 v4 = this->sResLightBase; | |
469 | 8085 return v4 >= pValue; |
0 | 8086 case VAR_DarkResistance: |
8087 v4 = this->sResDarkBase; | |
469 | 8088 return v4 >= pValue; |
0 | 8089 case VAR_ActualMight: |
8090 v12 = GetActualMight(); | |
8091 goto _j_cmp_against_arg; | |
8092 case VAR_ActualIntellect: | |
8093 v12 = GetActualIntelligence(); | |
8094 goto _j_cmp_against_arg; | |
8095 case VAR_ActualPersonality: | |
8096 v12 = GetActualWillpower(); | |
8097 goto _j_cmp_against_arg; | |
8098 case VAR_ActualEndurance: | |
8099 v12 = GetActualEndurance(); | |
8100 goto _j_cmp_against_arg; | |
8101 case VAR_ActualSpeed: | |
8102 v12 = GetActualSpeed(); | |
8103 goto _j_cmp_against_arg; | |
8104 case VAR_ActualAccuracy: | |
8105 v12 = GetActualAccuracy(); | |
8106 goto _j_cmp_against_arg; | |
8107 case VAR_ActualLuck: | |
8108 v12 = GetActualLuck(); | |
8109 _j_cmp_against_arg: | |
8110 v4 = v12; | |
8111 break; | |
8112 default: | |
469 | 8113 return v4 >= pValue; |
8114 } | |
8115 } | |
8116 return v4 >= pValue; | |
8117 } | |
8118 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8119 { | |
8120 if ( VarNum != VAR_DisarmTrapSkill ) | |
8121 { | |
8122 if ( VarNum <= VAR_MindResistanceBonus ) | |
8123 { | |
8124 switch ( VarNum ) | |
0 | 8125 { |
8126 case VAR_MindResistanceBonus: | |
8127 v4 = this->sResMindBonus; | |
8128 break; | |
8129 case VAR_FireResistanceBonus: | |
8130 v4 = this->sResFireBonus; | |
8131 break; | |
8132 case VAR_AirResistanceBonus: | |
8133 v4 = this->sResAirBonus; | |
8134 break; | |
8135 case VAR_WaterResistanceBonus: | |
8136 v4 = this->sResWaterBonus; | |
8137 break; | |
8138 case VAR_EarthResistanceBonus: | |
8139 v4 = this->sResEarthBonus; | |
8140 break; | |
8141 case VAR_SpiritResistanceBonus: | |
8142 v4 = this->sResSpiritBonus; | |
8143 break; | |
8144 } | |
469 | 8145 return v4 >= pValue; |
8146 } | |
8147 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8148 { |
8149 v4 = this->sResBodyBonus; | |
469 | 8150 return v4 >= pValue; |
8151 } | |
8152 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8153 { |
8154 v4 = this->sResLightBonus; | |
469 | 8155 return v4 >= pValue; |
8156 } | |
8157 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8158 { |
8159 v4 = this->sResDarkBonus; | |
469 | 8160 return v4 >= pValue; |
8161 } | |
8162 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8163 { |
8164 v4 = this->sResMagicBonus; | |
469 | 8165 return v4 >= pValue; |
8166 } | |
8167 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8168 return v4 >= pValue; | |
0 | 8169 } |
8170 LABEL_90: | |
469 | 8171 v18 = *((short *)&this->pConditions[16] + VarNum); |
8172 if ( pValue <= 63 ) | |
0 | 8173 v4 = v18 & 0x3F; |
8174 else | |
469 | 8175 v4 = pValue & v18; |
8176 return v4 >= pValue; | |
8177 } | |
8178 if ( VarNum == 104 ) | |
0 | 8179 goto LABEL_90; |
469 | 8180 if ( (signed int)VarNum <= 104 ) |
8181 return v4 >= pValue; | |
8182 if ( (signed int)VarNum > 0x79 ) | |
8183 { | |
8184 if ( VarNum != 122 ) | |
8185 { | |
8186 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8187 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8188 return v4 >= pValue; | |
0 | 8189 } |
8190 v4 = GetMajorConditionIdx(); | |
8191 if ( v4 != 18 ) | |
8192 { | |
469 | 8193 return v4 >= pValue; |
8194 } | |
8195 v4 = pValue; | |
8196 return v4 >= pValue; | |
8197 } | |
8198 return *((int *)this + 2 * VarNum - 210); | |
0 | 8199 } |
8200 | |
8201 | |
8202 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8203 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8204 { | |
8205 signed int currPlayerId; // ebx@1 | |
0 | 8206 Player *v4; // esi@1 |
8207 unsigned int v5; // edi@1 | |
8208 unsigned int v6; // esi@13 | |
8209 unsigned int v7; // esi@14 | |
8210 signed int v8; // eax@17 | |
8211 ItemGen *v9; // ecx@17 | |
8212 int v10; // eax@21 | |
8213 signed int v11; // eax@30 | |
8214 Player *v12; // ecx@44 | |
8215 char *v13; // ecx@45 | |
8216 Player *v14; // ecx@49 | |
8217 int v15; // ecx@86 | |
8218 int v16; // esi@106 | |
8219 char v17; // al@106 | |
8220 int v18; // eax@107 | |
8221 Player *v19; // ecx@112 | |
8222 Player *v20; // ecx@127 | |
8223 int v21; // eax@127 | |
8224 int v22; // eax@145 | |
8225 char v23; // zf@146 | |
8226 DDM_DLV_Header *v24; // ecx@148 | |
8227 signed int v25; // eax@172 | |
8228 int v26; // [sp-8h] [bp-3Ch]@84 | |
8229 signed int v27; // [sp-4h] [bp-38h]@4 | |
8230 int v28; // [sp-4h] [bp-38h]@84 | |
8231 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8232 char v30; // [sp+32h] [bp-2h]@1 | |
8233 char v31; // [sp+33h] [bp-1h]@1 | |
8234 | |
492 | 8235 currPlayerId = 0; |
0 | 8236 v30 = 0; |
8237 v31 = 0; | |
8238 v4 = this; | |
8239 v5 = 0; | |
8240 if ( this == pPlayers[2] ) | |
492 | 8241 currPlayerId = 1; |
8242 else if ( this == pPlayers[3] ) | |
8243 currPlayerId = 2; | |
757 | 8244 else if ( this == pPlayers[4] ) |
492 | 8245 currPlayerId = 3; |
8246 if ( var_type > VAR_AutoNotes ) | |
8247 { | |
8248 if ( var_type <= VAR_GoldInBank ) | |
8249 { | |
8250 if ( var_type == VAR_GoldInBank ) | |
8251 { | |
8252 pParty->uNumGoldInBank = var_value; | |
0 | 8253 return; |
8254 } | |
492 | 8255 if ( var_type <= VAR_Counter8 ) |
8256 { | |
8257 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8258 { |
492 | 8259 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8260 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8261 } |
8262 else | |
8263 { | |
492 | 8264 switch ( var_type ) |
0 | 8265 { |
8266 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8267 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8268 break; |
8269 case VAR_NPCs2: | |
8270 pParty->field_709 = 0; | |
492 | 8271 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8272 Party__CountHirelings(); |
0 | 8273 viewparams->bRedrawGameUI = 1; |
8274 break; | |
8275 case VAR_NumSkillPoints: | |
492 | 8276 this->uSkillPoints = var_value; |
0 | 8277 break; |
8278 } | |
8279 } | |
8280 return; | |
8281 } | |
492 | 8282 if ( var_type < VAR_Counter9 ) |
0 | 8283 return; |
492 | 8284 if ( (signed int)var_type <= 0x112 ) |
8285 { | |
8286 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8287 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8288 } |
8289 else | |
8290 { | |
492 | 8291 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8292 { |
8293 v24 = &pOutdoor->ddm; | |
8294 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8295 v24 = &pIndoor->dlv; | |
492 | 8296 v24->uReputation = var_value; |
8297 if ( var_value > 10000 ) | |
0 | 8298 v24->uReputation = 10000; |
8299 return; | |
8300 } | |
492 | 8301 if ( var_type <= VAR_ReputationInCurrentLocation |
8302 || var_type > VAR_History_28 | |
8303 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8304 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8305 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8306 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8307 v23) ) |
8308 return; | |
8309 bFlashHistoryBook = 1; | |
8310 } | |
8311 LABEL_172: | |
492 | 8312 v25 = 8 * currPlayerId + 400; |
8313 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
0 | 8314 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8315 return; | |
8316 } | |
492 | 8317 if ( var_type != 307 ) |
8318 { | |
8319 switch ( var_type ) | |
0 | 8320 { |
8321 case 308: | |
492 | 8322 pParty->uNumBountiesCollected = var_value; |
0 | 8323 break; |
8324 case 309: | |
492 | 8325 pParty->uNumPrisonTerms = var_value; |
0 | 8326 break; |
8327 case 310: | |
492 | 8328 pParty->uNumArenaPageWins = var_value; |
0 | 8329 break; |
8330 case 311: | |
492 | 8331 pParty->uNumArenaSquireWins = var_value; |
0 | 8332 break; |
8333 case 312: | |
492 | 8334 pParty->uNumArenaKnightWins = var_value; |
0 | 8335 break; |
8336 case 313: | |
492 | 8337 pParty->uNumArenaLordWins = var_value; |
0 | 8338 break; |
8339 } | |
8340 return; | |
8341 } | |
492 | 8342 pParty->uNumDeaths = var_value; |
0 | 8343 LABEL_168: |
8344 if ( v30 != 1 ) | |
8345 { | |
8346 LABEL_170: | |
8347 if ( v31 != 1 ) | |
8348 return; | |
8349 v5 = 0; | |
8350 goto LABEL_172; | |
8351 } | |
8352 LABEL_169: | |
492 | 8353 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8354 goto LABEL_170; |
8355 } | |
492 | 8356 if ( var_type == VAR_AutoNotes ) |
8357 { | |
8358 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
|
8359 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8360 && pAutonoteTxt[var_value-1].pText ) |
8361 { | |
8362 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8363 v30 = 1; |
187 | 8364 v20->PlaySound(SPEECH_96, 0); |
492 | 8365 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8366 bFlashAutonotesBook = 1; |
8367 dword_506568 = v21; | |
8368 } | |
492 | 8369 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8370 v31 = 1; |
8371 goto LABEL_168; | |
8372 } | |
492 | 8373 if ( var_type <= VAR_ActualMight ) |
8374 { | |
8375 if ( var_type != VAR_ActualMight ) | |
8376 { | |
8377 switch ( var_type ) | |
0 | 8378 { |
8379 case VAR_RandomGold: | |
492 | 8380 v6 = rand() % var_value + 1; |
0 | 8381 Party::SetGold(v6); |
8382 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8383 ShowStatusBarString(pTmpBuf, 2u); | |
8384 GameUI_DrawFoodAndGold(); | |
8385 return; | |
8386 case VAR_RandomFood: | |
492 | 8387 v7 = rand() % var_value + 1; |
0 | 8388 Party::SetFood(v7); |
8389 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8390 ShowStatusBarString(pTmpBuf, 2u); | |
8391 GameUI_DrawFoodAndGold(); | |
8392 goto LABEL_124; | |
8393 case VAR_Sex: | |
492 | 8394 this->uSex = (PLAYER_SEX)var_value; |
0 | 8395 goto LABEL_124; |
8396 case VAR_Class: | |
492 | 8397 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8398 if ( (char)var_value != 35 ) | |
0 | 8399 goto LABEL_124; |
8400 v8 = 0; | |
8401 v9 = this->pInventoryItems; | |
8402 break; | |
8403 case VAR_CurrentHP: | |
492 | 8404 this->sHealth = var_value; |
0 | 8405 goto LABEL_124; |
8406 case VAR_MaxHP: | |
8407 this->sHealth = GetMaxHealth(); | |
8408 return; | |
8409 case VAR_CurrentSP: | |
492 | 8410 this->sMana = var_value; |
0 | 8411 goto LABEL_124; |
8412 case VAR_MaxSP: | |
8413 this->sMana = GetMaxMana(); | |
8414 return; | |
8415 case VAR_ACModifier: | |
492 | 8416 this->sACModifier = (unsigned __int8)var_value; |
0 | 8417 goto LABEL_124; |
8418 case VAR_BaseLevel: | |
492 | 8419 this->uLevel = (unsigned __int8)var_value; |
0 | 8420 goto LABEL_124; |
8421 case VAR_LevelModifier: | |
492 | 8422 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8423 goto LABEL_124; |
8424 case VAR_Age: | |
492 | 8425 this->sAgeModifier = var_value; |
0 | 8426 return; |
8427 case VAR_Award: | |
492 | 8428 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8429 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
|
8430 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8431 && pAwards[var_value].pText ) |
0 | 8432 { |
8433 v30 = 1; | |
8434 v31 = 1; | |
492 | 8435 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8436 } |
492 | 8437 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8438 goto LABEL_168; | |
0 | 8439 case VAR_Experience: |
492 | 8440 this->uExperience = var_value; |
0 | 8441 goto LABEL_124; |
8442 case VAR_QBits_QuestsDone: | |
492 | 8443 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
|
8444 // && (&dword_722F10)[4 * a3] ) |
492 | 8445 && pQuestTable[var_value-1] ) |
0 | 8446 { |
492 | 8447 v14 = pPlayers[currPlayerId + 1]; |
0 | 8448 bFlashQuestBook = 1; |
8449 v30 = 1; | |
8450 v31 = 1; | |
187 | 8451 v14->PlaySound(SPEECH_93, 0); |
0 | 8452 } |
484 | 8453 v13 = (char *)pParty->_quest_bits; |
0 | 8454 LABEL_51: |
492 | 8455 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8456 if (( v30 != 1 )&&( v31 != 1 )) | |
8457 return; | |
8458 else | |
8459 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8460 if ( v31 != 1 ) | |
8461 return; | |
8462 v25 = 8 * currPlayerId + 400; | |
8463 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
8464 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | |
8465 return; | |
0 | 8466 case VAR_PlayerItemInHands: |
8467 item.Reset(); | |
8468 item.Reset(); | |
492 | 8469 item.uItemID = var_value; |
0 | 8470 item.uAttributes = 1; |
8471 pParty->SetHoldingItem(&item); | |
492 | 8472 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8473 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8474 return; |
8475 case VAR_FixedGold: | |
492 | 8476 Party::SetGold(var_value); |
0 | 8477 return; |
8478 case VAR_BaseMight: | |
492 | 8479 this->uMight = (unsigned __int8)var_value; |
0 | 8480 goto LABEL_84; |
8481 case VAR_BaseIntellect: | |
492 | 8482 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8483 goto LABEL_84; |
8484 case VAR_BasePersonality: | |
492 | 8485 this->uWillpower = (unsigned __int8)var_value; |
0 | 8486 goto LABEL_84; |
8487 case VAR_BaseEndurance: | |
492 | 8488 this->uEndurance = (unsigned __int8)var_value; |
0 | 8489 goto LABEL_84; |
8490 case VAR_BaseSpeed: | |
492 | 8491 this->uSpeed = (unsigned __int8)var_value; |
0 | 8492 goto LABEL_84; |
8493 case VAR_BaseAccuracy: | |
492 | 8494 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8495 goto LABEL_84; |
8496 case VAR_BaseLuck: | |
492 | 8497 this->uLuck = (unsigned __int8)var_value; |
0 | 8498 goto LABEL_84; |
8499 case VAR_FixedFood: | |
492 | 8500 Party::SetFood(var_value); |
0 | 8501 goto LABEL_124; |
8502 case VAR_MightBonus: | |
8503 goto LABEL_64; | |
8504 case VAR_IntellectBonus: | |
8505 goto LABEL_68; | |
8506 case VAR_PersonalityBonus: | |
8507 goto LABEL_69; | |
8508 case VAR_EnduranceBonus: | |
8509 goto LABEL_70; | |
8510 case VAR_SpeedBonus: | |
8511 goto LABEL_71; | |
8512 case VAR_AccuracyBonus: | |
8513 goto LABEL_72; | |
8514 case VAR_LuckBonus: | |
8515 goto LABEL_73; | |
8516 default: | |
8517 return; | |
8518 } | |
8519 while ( v9->uItemID != 615 ) | |
8520 { | |
8521 ++v8; | |
8522 ++v9; | |
8523 if ( v8 >= 138 ) | |
8524 goto LABEL_22; | |
8525 } | |
8526 v10 = (int)((char *)v4 + 36 * v8); | |
8527 *(int *)(v10 + 532) = 601; | |
492 | 8528 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8529 LABEL_22: |
8530 if ( v4->sResFireBase < 20 ) | |
8531 v4->sResFireBase = 20; | |
8532 if ( v4->sResAirBase < 20 ) | |
8533 v4->sResAirBase = 20; | |
8534 if ( v4->sResWaterBase < 20 ) | |
8535 v4->sResWaterBase = 20; | |
8536 if ( v4->sResEarthBase < 20 ) | |
8537 v4->sResEarthBase = 20; | |
8538 v4->sResMindBase = 200; | |
8539 v4->sResBodyBase = 200; | |
8540 v11 = v4->GetSexByVoice(); | |
8541 v4->field_1924 = v4->uVoiceID; | |
8542 v4->field_1928 = v4->uFace; | |
8543 if ( v11 ) | |
8544 { | |
8545 v4->uFace = 21; | |
8546 v4->uVoiceID = 21; | |
8547 } | |
8548 else | |
8549 { | |
8550 v4->uFace = 20; | |
8551 v4->uVoiceID = 20; | |
8552 } | |
492 | 8553 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8554 goto LABEL_124; |
8555 } | |
8556 LABEL_64: | |
492 | 8557 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8558 LABEL_111: |
8559 v28 = 0; | |
187 | 8560 v26 = SPEECH_91; |
0 | 8561 LABEL_112: |
492 | 8562 v19 = pPlayers[currPlayerId + 1]; |
0 | 8563 v31 = 1; |
187 | 8564 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8565 goto LABEL_169; |
8566 } | |
492 | 8567 if ( var_type <= VAR_FireResistanceBonus ) |
8568 { | |
8569 if ( var_type == VAR_FireResistanceBonus ) | |
8570 { | |
8571 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8572 goto LABEL_111; |
8573 } | |
492 | 8574 switch ( var_type ) |
0 | 8575 { |
8576 case VAR_ActualIntellect: | |
8577 LABEL_68: | |
492 | 8578 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8579 goto LABEL_111; |
8580 case VAR_ActualPersonality: | |
8581 LABEL_69: | |
492 | 8582 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8583 goto LABEL_111; |
8584 case VAR_ActualEndurance: | |
8585 LABEL_70: | |
492 | 8586 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8587 goto LABEL_111; |
8588 case VAR_ActualSpeed: | |
8589 LABEL_71: | |
492 | 8590 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8591 goto LABEL_111; |
8592 case VAR_ActualAccuracy: | |
8593 LABEL_72: | |
492 | 8594 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8595 goto LABEL_111; |
8596 case VAR_ActualLuck: | |
8597 LABEL_73: | |
492 | 8598 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8599 goto LABEL_111; |
8600 case VAR_FireResistance: | |
492 | 8601 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8602 goto LABEL_84; |
8603 case VAR_AirResistance: | |
492 | 8604 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8605 goto LABEL_84; |
8606 case VAR_WaterResistance: | |
492 | 8607 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8608 goto LABEL_84; |
8609 case VAR_EarthResistance: | |
492 | 8610 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8611 goto LABEL_84; |
8612 case VAR_SpiritResistance: | |
492 | 8613 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8614 goto LABEL_84; |
8615 case VAR_MindResistance: | |
492 | 8616 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8617 goto LABEL_84; |
8618 case VAR_BodyResistance: | |
492 | 8619 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8620 goto LABEL_84; |
8621 case VAR_LightResistance: | |
492 | 8622 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8623 goto LABEL_84; |
8624 case VAR_DarkResistance: | |
492 | 8625 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8626 goto LABEL_84; |
8627 case VAR_MagicResistance: | |
492 | 8628 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8629 LABEL_84: |
8630 v28 = 0; | |
8631 v26 = 92; | |
8632 goto LABEL_112; | |
8633 default: | |
8634 return; | |
8635 } | |
8636 return; | |
8637 } | |
8638 HIWORD(v15) = 0; | |
492 | 8639 if ( var_type > VAR_DisarmTrapSkill ) |
8640 { | |
8641 if ( var_type != VAR_LearningSkill ) | |
8642 { | |
8643 if ( var_type <= VAR_LearningSkill ) | |
0 | 8644 return; |
492 | 8645 if ( var_type <= VAR_Eradicated ) |
8646 { | |
8647 v4->SetCondition(var_type - 105, 1); | |
0 | 8648 } |
8649 else | |
8650 { | |
492 | 8651 if ( var_type != VAR_MajorCondition ) |
0 | 8652 { |
492 | 8653 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8654 byte_5E4C15[var_type] = var_value; | |
0 | 8655 return; |
8656 } | |
8657 memset(v4, 0, 0xA0u); | |
8658 } | |
8659 LABEL_124: | |
8660 v31 = 1; | |
8661 goto LABEL_169; | |
8662 } | |
8663 LABEL_106: | |
492 | 8664 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8665 v17 = *(char *)v16; |
492 | 8666 if ( var_value <= VAR_BodyResistanceBonus ) |
8667 { | |
8668 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8669 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8670 } | |
8671 else | |
8672 { | |
492 | 8673 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8674 } |
8675 *(short *)v16 = v18; | |
8676 goto LABEL_124; | |
8677 } | |
492 | 8678 if ( var_type == VAR_DisarmTrapSkill ) |
8679 if ( v30 != 1 ) | |
8680 { | |
8681 if ( v31 != 1 ) | |
8682 return; | |
8683 v5 = 0; | |
8684 goto LABEL_172; | |
8685 } | |
8686 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8687 goto LABEL_170; | |
8688 if ( var_type <= VAR_BodyResistanceBonus ) | |
8689 { | |
8690 switch ( var_type ) | |
0 | 8691 { |
8692 case VAR_BodyResistanceBonus: | |
492 | 8693 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8694 break; |
8695 case VAR_AirResistanceBonus: | |
492 | 8696 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8697 break; |
8698 case VAR_WaterResistanceBonus: | |
492 | 8699 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8700 break; |
8701 case VAR_EarthResistanceBonus: | |
492 | 8702 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8703 break; |
8704 case VAR_SpiritResistanceBonus: | |
492 | 8705 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8706 break; |
8707 default: | |
492 | 8708 if ( var_type != 62 ) |
0 | 8709 return; |
492 | 8710 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8711 break; |
8712 } | |
8713 goto LABEL_111; | |
8714 } | |
492 | 8715 if ( var_type == VAR_LightResistanceBonus ) |
8716 { | |
8717 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8718 goto LABEL_111; |
8719 } | |
492 | 8720 if ( var_type == VAR_DarkResistanceBonus ) |
8721 { | |
8722 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8723 goto LABEL_111; | |
8724 } | |
8725 if ( var_type == VAR_MagicResistanceBonus ) | |
8726 { | |
8727 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8728 goto LABEL_111; |
8729 } | |
492 | 8730 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8731 if ( v30 != 1 ) | |
8732 { | |
8733 if ( v31 != 1 ) | |
8734 return; | |
8735 v5 = 0; | |
8736 v25 = 8 * currPlayerId + 400; | |
8737 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
8738 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | |
8739 return; | |
8740 } | |
8741 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8742 goto LABEL_170; | |
0 | 8743 } |
8744 | |
8745 | |
8746 | |
8747 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8748 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8749 { |
8750 char v3; // bl@1 | |
8751 Player *v4; // esi@1 | |
8752 signed int uPlayerIdx; // edi@1 | |
8753 int v6; // eax@15 | |
8754 unsigned int v7; // esi@18 | |
8755 int *v8; // ebx@21 | |
8756 int v9; // eax@22 | |
8757 signed int v10; // eax@24 | |
8758 int v11; // eax@27 | |
8759 __int16 *v12; // esi@28 | |
8760 Player *v13; // ecx@34 | |
8761 Player *v14; // ecx@36 | |
8762 char *v15; // ecx@37 | |
8763 unsigned __int8 v16; // cf@38 | |
8764 Player *v17; // ecx@42 | |
8765 __int16 *v18; // esi@53 | |
8766 __int16 *v19; // esi@62 | |
8767 char *v20; // esi@107 | |
8768 __int16 v21; // dx@107 | |
8769 int v22; // ecx@107 | |
8770 Player *v23; // ecx@132 | |
8771 int v24; // eax@132 | |
8772 int v25; // eax@150 | |
8773 char v26; // zf@151 | |
8774 DDM_DLV_Header *v27; // eax@153 | |
8775 signed int v28; // eax@176 | |
8776 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8777 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8778 int v31; // [sp-4h] [bp-3Ch]@84 |
8779 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8780 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8781 char v34; // [sp+37h] [bp-1h]@1 | |
8782 | |
8783 auto Dst = this; | |
8784 v3 = 0; | |
8785 v34 = 0; | |
8786 v4 = Dst; | |
8787 uPlayerIdx = 0; | |
8788 if ( Dst == pPlayers[2] ) | |
8789 uPlayerIdx = 1; | |
310 | 8790 else if ( Dst == pPlayers[3] ) |
8791 uPlayerIdx = 2; | |
8792 else if ( Dst == pPlayers[4] ) | |
8793 uPlayerIdx = 3; | |
8794 | |
8795 if ( var_type <= VAR_AutoNotes ) | |
8796 { | |
8797 if ( var_type != VAR_AutoNotes ) | |
8798 { | |
8799 if ( var_type <= VAR_ActualMight ) | |
8800 { | |
8801 if ( var_type != VAR_ActualMight ) | |
0 | 8802 { |
310 | 8803 switch ( var_type ) |
0 | 8804 { |
8805 case VAR_RandomGold: | |
8806 if ( !val ) | |
8807 val = 1; | |
8808 v6 = rand(); | |
8809 party_finds_gold(v6 % val + 1, 1); | |
8810 GameUI_DrawFoodAndGold(); | |
8811 return; | |
8812 case VAR_RandomFood: | |
8813 if ( !val ) | |
8814 val = 1; | |
8815 v7 = rand() % val + 1; | |
8816 Party::GiveFood(v7); | |
8817 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8818 ShowStatusBarString(pTmpBuf, 2u); | |
8819 GameUI_DrawFoodAndGold(); | |
8820 goto _play_sound; | |
8821 case VAR_Sex: | |
8822 Dst->uSex = (PLAYER_SEX)val; | |
8823 goto _play_anim_and_exit; | |
8824 case VAR_Class: | |
135 | 8825 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8826 goto _play_anim_and_exit; |
8827 case VAR_CurrentHP: | |
8828 v8 = &Dst->sHealth; | |
8829 *v8 += val; | |
8830 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8831 goto _play_anim_and_exit; | |
8832 v9 = v4->GetMaxHealth(); | |
8833 goto LABEL_23; | |
8834 case VAR_MaxHP: | |
8835 v10 = Dst->GetMaxHealth(); | |
8836 v4->_health_related = 0; | |
8837 v4->uFullHealthBonus = 0; | |
8838 v4->sHealth = v10; | |
8839 return; | |
8840 case VAR_CurrentSP: | |
8841 v8 = &Dst->sMana; | |
8842 *v8 += val; | |
8843 if ( Dst->sMana > GetMaxMana() ) | |
8844 { | |
8845 v9 = v4->GetMaxMana(); | |
8846 LABEL_23: | |
8847 *v8 = v9; | |
8848 } | |
8849 goto _play_anim_and_exit; | |
8850 case VAR_MaxSP: | |
8851 v11 = GetMaxMana(); | |
8852 v4->_mana_related = 0; | |
8853 v4->uFullManaBonus = 0; | |
8854 v4->sMana = v11; | |
8855 return; | |
8856 case VAR_ACModifier: | |
8857 v12 = &Dst->sACModifier; | |
8858 goto LABEL_29; | |
8859 case VAR_BaseLevel: | |
8860 v12 = (__int16 *)&Dst->uLevel; | |
8861 goto LABEL_29; | |
8862 case VAR_LevelModifier: | |
8863 v12 = &Dst->sLevelModifier; | |
8864 LABEL_29: | |
8865 *v12 += val; | |
8866 if ( *v12 > 255 ) | |
8867 *v12 = 255; | |
8868 goto _play_anim_and_exit; | |
8869 case VAR_Age: | |
8870 Dst->sAgeModifier += val; | |
8871 return; | |
8872 case VAR_Award: | |
8873 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8874 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8875 | |
492 | 8876 && pAwards[val].pText ) |
0 | 8877 { |
8878 v14 = pPlayers[uPlayerIdx + 1]; | |
8879 v34 = 1; | |
8880 v3 = 1; | |
187 | 8881 v14->PlaySound(SPEECH_96, 0); |
0 | 8882 } |
735 | 8883 v15 = (char *)v4->_guilds_member_bits; |
0 | 8884 goto LABEL_44; |
8885 case VAR_Experience: | |
8886 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8887 LODWORD(Dst->uExperience) += val; | |
8888 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8889 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8890 Dst->uExperience = 4000000000i64; | |
8891 goto _play_anim_and_exit; | |
8892 case VAR_QBits_QuestsDone: | |
484 | 8893 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
|
8894 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8895 && pQuestTable[val-1] ) |
0 | 8896 { |
501 | 8897 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8898 bFlashQuestBook = 1; |
8899 v34 = 1; | |
8900 v3 = 1; | |
501 | 8901 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8902 } |
484 | 8903 v15 = (char *)pParty->_quest_bits; |
0 | 8904 LABEL_44: |
8905 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8906 goto LABEL_173; | |
8907 case VAR_PlayerItemInHands: | |
8908 item.Reset(); | |
8909 item.Reset(); | |
8910 item.uAttributes = 1; | |
8911 item.uItemID = val; | |
8912 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8913 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8914 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8915 { | |
8916 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8917 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8918 } | |
8919 pParty->SetHoldingItem(&item); | |
8920 return; | |
8921 case VAR_FixedGold: | |
8922 party_finds_gold(val, 1); | |
8923 return; | |
8924 case VAR_BaseMight: | |
8925 v18 = (__int16 *)&Dst->uMight; | |
8926 goto LABEL_82; | |
8927 case VAR_BaseIntellect: | |
8928 v18 = (__int16 *)&Dst->uIntelligence; | |
8929 goto LABEL_82; | |
8930 case VAR_BasePersonality: | |
8931 v18 = (__int16 *)&Dst->uWillpower; | |
8932 goto LABEL_82; | |
8933 case VAR_BaseEndurance: | |
8934 v18 = (__int16 *)&Dst->uEndurance; | |
8935 goto LABEL_82; | |
8936 case VAR_BaseSpeed: | |
8937 v18 = (__int16 *)&Dst->uSpeed; | |
8938 goto LABEL_82; | |
8939 case VAR_BaseAccuracy: | |
8940 v18 = (__int16 *)&Dst->uAccuracy; | |
8941 goto LABEL_82; | |
8942 case VAR_BaseLuck: | |
8943 v18 = (__int16 *)&Dst->uLuck; | |
8944 goto LABEL_82; | |
8945 case VAR_FixedFood: | |
8946 Party::GiveFood(val); | |
715 | 8947 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8948 ShowStatusBarString(pTmpBuf, 2u); |
8949 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8950 Party::SetFood(0xFFFFu); | |
8951 goto _play_sound; | |
8952 case VAR_MightBonus: | |
8953 goto LABEL_62; | |
8954 case VAR_IntellectBonus: | |
8955 goto LABEL_66; | |
8956 case VAR_PersonalityBonus: | |
8957 goto LABEL_67; | |
8958 case VAR_EnduranceBonus: | |
8959 goto LABEL_68; | |
8960 case VAR_SpeedBonus: | |
8961 goto LABEL_69; | |
8962 case VAR_AccuracyBonus: | |
8963 goto LABEL_70; | |
8964 case VAR_LuckBonus: | |
8965 goto LABEL_71; | |
8966 default: | |
8967 return; | |
8968 } | |
8969 return; | |
8970 } | |
8971 LABEL_62: | |
8972 v19 = (__int16 *)&Dst->uMightBonus; | |
8973 goto LABEL_113; | |
8974 } | |
310 | 8975 if ( var_type <= VAR_FireResistanceBonus ) |
8976 { | |
8977 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8978 { |
310 | 8979 switch ( var_type ) |
0 | 8980 { |
8981 case VAR_ActualIntellect: | |
8982 LABEL_66: | |
8983 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8984 goto LABEL_113; | |
8985 case VAR_ActualPersonality: | |
8986 LABEL_67: | |
8987 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8988 goto LABEL_113; | |
8989 case VAR_ActualEndurance: | |
8990 LABEL_68: | |
8991 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8992 goto LABEL_113; | |
8993 case VAR_ActualSpeed: | |
8994 LABEL_69: | |
8995 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8996 goto LABEL_113; | |
8997 case VAR_ActualAccuracy: | |
8998 LABEL_70: | |
8999 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9000 goto LABEL_113; | |
9001 case VAR_ActualLuck: | |
9002 LABEL_71: | |
9003 v19 = (__int16 *)&Dst->uLuckBonus; | |
9004 goto LABEL_113; | |
9005 case VAR_FireResistance: | |
9006 v18 = &Dst->sResFireBase; | |
9007 goto LABEL_82; | |
9008 case VAR_AirResistance: | |
9009 v18 = &Dst->sResAirBase; | |
9010 goto LABEL_82; | |
9011 case VAR_WaterResistance: | |
9012 v18 = &Dst->sResWaterBase; | |
9013 goto LABEL_82; | |
9014 case VAR_EarthResistance: | |
9015 v18 = &Dst->sResEarthBase; | |
9016 goto LABEL_82; | |
9017 case VAR_SpiritResistance: | |
9018 v18 = &Dst->sResSpiritBase; | |
9019 goto LABEL_82; | |
9020 case VAR_MindResistance: | |
9021 v18 = &Dst->sResMindBase; | |
9022 goto LABEL_82; | |
9023 case VAR_BodyResistance: | |
9024 v18 = &Dst->sResBodyBase; | |
9025 goto LABEL_82; | |
9026 case VAR_LightResistance: | |
9027 v18 = &Dst->sResLightBase; | |
9028 goto LABEL_82; | |
9029 case VAR_DarkResistance: | |
9030 v18 = &Dst->sResDarkBase; | |
9031 goto LABEL_82; | |
9032 case VAR_MagicResistance: | |
9033 v18 = &Dst->sResMagicBase; | |
9034 LABEL_82: | |
9035 *v18 += val; | |
9036 if ( *v18 > 255 ) | |
9037 *v18 = 255; | |
9038 v31 = 0; | |
9039 v29 = 92; | |
9040 goto LABEL_116; | |
9041 default: | |
9042 return; | |
9043 } | |
9044 return; | |
9045 } | |
9046 v19 = &Dst->sResFireBonus; | |
9047 LABEL_113: | |
9048 *v19 += val; | |
9049 if ( *v19 > 255 ) | |
9050 *v19 = 255; | |
9051 v31 = 0; | |
187 | 9052 v29 = SPEECH_91; |
0 | 9053 LABEL_116: |
9054 v3 = 1; | |
187 | 9055 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9056 goto _play_anim_and_maybe_sound; |
9057 } | |
310 | 9058 if ( var_type <= VAR_DisarmTrapSkill ) |
9059 { | |
9060 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9061 { |
310 | 9062 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9063 { |
310 | 9064 switch ( var_type ) |
0 | 9065 { |
9066 case VAR_BodyResistanceBonus: | |
9067 v19 = &Dst->sResBodyBonus; | |
9068 break; | |
9069 case VAR_AirResistanceBonus: | |
9070 v19 = &Dst->sResAirBonus; | |
9071 break; | |
9072 case VAR_WaterResistanceBonus: | |
9073 v19 = &Dst->sResWaterBonus; | |
9074 break; | |
9075 case VAR_EarthResistanceBonus: | |
9076 v19 = &Dst->sResEarthBonus; | |
9077 break; | |
9078 case VAR_SpiritResistanceBonus: | |
9079 v19 = &Dst->sResSpiritBonus; | |
9080 break; | |
9081 default: | |
310 | 9082 if ( var_type != 62 ) |
0 | 9083 return; |
9084 v19 = &Dst->sResMindBonus; | |
9085 break; | |
9086 } | |
9087 goto LABEL_113; | |
9088 } | |
310 | 9089 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9090 { |
9091 v19 = &Dst->sResLightBonus; | |
9092 goto LABEL_113; | |
9093 } | |
310 | 9094 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9095 { |
9096 v19 = &Dst->sResDarkBonus; | |
9097 goto LABEL_113; | |
9098 } | |
310 | 9099 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9100 { |
9101 v19 = &Dst->sResMagicBonus; | |
9102 goto LABEL_113; | |
9103 } | |
310 | 9104 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9105 return; |
9106 } | |
9107 goto LABEL_106; | |
9108 } | |
310 | 9109 if ( var_type == VAR_LearningSkill ) |
0 | 9110 { |
9111 LABEL_106: | |
9112 if ( val <= VAR_BodyResistanceBonus ) | |
9113 { | |
310 | 9114 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9115 } |
9116 else | |
9117 { | |
310 | 9118 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9119 v21 = *(short *)v20; |
9120 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9121 if ( v22 > 60 ) | |
9122 LOWORD(v22) = 60; | |
9123 LOBYTE(v21) = v21 & 0xC0; | |
9124 *(short *)v20 = v22 | v21; | |
9125 } | |
9126 goto _play_anim_and_exit; | |
9127 } | |
310 | 9128 if ( var_type <= VAR_LearningSkill ) |
0 | 9129 return; |
310 | 9130 if ( var_type <= VAR_Eradicated ) |
9131 { | |
9132 Dst->SetCondition(var_type - 105, 0); | |
0 | 9133 } |
9134 else | |
9135 { | |
310 | 9136 if ( var_type != VAR_MajorCondition ) |
0 | 9137 { |
310 | 9138 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9139 { |
310 | 9140 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9141 byte_5E4C15[var_type] += val; | |
0 | 9142 else |
310 | 9143 byte_5E4C15[var_type] = -1; |
0 | 9144 } |
9145 return; | |
9146 } | |
9147 memset(Dst, 0, 0xA0u); | |
9148 } | |
9149 _play_anim_and_exit: | |
9150 v3 = 1; | |
9151 _play_anim_and_maybe_sound: | |
9152 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9153 _maybe_play_sound: | |
9154 if ( v3 != 1 ) | |
9155 return; | |
9156 goto _play_sound; | |
9157 } | |
9158 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
|
9159 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9160 && pAutonoteTxt[val-1].pText ) |
0 | 9161 { |
9162 v23 = pPlayers[uPlayerIdx + 1]; | |
9163 v34 = 1; | |
187 | 9164 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9165 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9166 bFlashAutonotesBook = 1; |
9167 dword_506568 = v24; | |
9168 } | |
9169 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9170 v3 = 1; | |
9171 LABEL_173: | |
9172 if ( v34 != 1 ) | |
9173 goto _maybe_play_sound; | |
9174 goto _play_anim_and_maybe_sound; | |
9175 } | |
310 | 9176 if ( var_type > VAR_GoldInBank ) |
9177 { | |
9178 if ( var_type == 307 ) | |
0 | 9179 { |
9180 pParty->uNumDeaths += val; | |
9181 goto LABEL_173; | |
9182 } | |
310 | 9183 switch ( var_type ) |
0 | 9184 { |
9185 case 308: | |
9186 pParty->uNumBountiesCollected += val; | |
9187 break; | |
9188 case 309: | |
9189 pParty->uNumPrisonTerms += val; | |
9190 break; | |
9191 case 310: | |
9192 pParty->uNumArenaPageWins += val; | |
9193 break; | |
9194 case 311: | |
9195 pParty->uNumArenaSquireWins += val; | |
9196 break; | |
9197 case 312: | |
9198 pParty->uNumArenaKnightWins += val; | |
9199 break; | |
9200 case 313: | |
9201 pParty->uNumArenaLordWins += val; | |
9202 break; | |
9203 } | |
9204 } | |
9205 else | |
9206 { | |
310 | 9207 if ( var_type == VAR_GoldInBank ) |
0 | 9208 { |
9209 pParty->uNumGoldInBank += val; | |
9210 return; | |
9211 } | |
310 | 9212 if ( var_type <= VAR_Counter8 ) |
9213 { | |
9214 if ( (signed int)var_type >= 245 ) | |
9215 { | |
9216 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9217 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9218 } |
9219 else | |
9220 { | |
310 | 9221 switch ( var_type ) |
0 | 9222 { |
9223 case VAR_MonthEquals|VAR_CurrentSP: | |
9224 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9225 break; | |
9226 case VAR_NPCs2: | |
9227 pParty->field_709 = 0; | |
9228 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9229 Party__CountHirelings(); |
0 | 9230 viewparams->bRedrawGameUI = 1; |
9231 break; | |
9232 case VAR_NumSkillPoints: | |
9233 Dst->uSkillPoints += val; | |
9234 break; | |
9235 } | |
9236 } | |
9237 return; | |
9238 } | |
310 | 9239 if ( var_type < VAR_Counter9 ) |
0 | 9240 return; |
310 | 9241 if ( (signed int)var_type <= 274 ) |
9242 { | |
9243 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9244 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9245 goto _play_sound; |
9246 } | |
310 | 9247 if ( var_type != VAR_ReputationInCurrentLocation ) |
9248 { | |
9249 if ( var_type <= VAR_ReputationInCurrentLocation | |
9250 || var_type > VAR_History_28 | |
9251 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9252 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9253 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9254 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9255 v26) ) |
9256 return; | |
9257 bFlashHistoryBook = 1; | |
9258 _play_sound: | |
9259 v28 = 8 * uPlayerIdx + 400; | |
9260 LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; | |
9261 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); | |
9262 return; | |
9263 } | |
9264 v27 = &pOutdoor->ddm; | |
9265 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9266 v27 = &pIndoor->dlv; | |
9267 v27->uReputation += val; | |
9268 if ( v27->uReputation > 10000 ) | |
9269 v27->uReputation = 10000; | |
9270 } | |
9271 } | |
9272 // 506568: using guessed type int dword_506568; | |
9273 // 507948: using guessed type char bFlashHistoryBook; | |
9274 // 507949: using guessed type char bFlashAutonotesBook; | |
9275 // 50794A: using guessed type char bFlashQuestBook; | |
9276 // 72371C: using guessed type int dword_72371C[]; | |
9277 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9278 | |
9279 | |
9280 | |
9281 | |
9282 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9283 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9284 { |
9285 unsigned int v3; // ebx@1 | |
9286 signed int v4; // esi@1 | |
501 | 9287 bool result; // eax@8 |
0 | 9288 int v6; // esi@11 |
9289 int v7; // edi@14 | |
9290 signed int v8; // eax@17 | |
9291 char *v9; // eax@20 | |
9292 char v10; // sf@20 | |
9293 char *v11; // ecx@26 | |
9294 char *v12; // ecx@27 | |
9295 __int64 v13; // qax@27 | |
9296 unsigned __int8 v14; // cf@27 | |
501 | 9297 int *v15; // edx@29 |
0 | 9298 char *v16; // eax@90 |
9299 char *v17; // ecx@94 | |
501 | 9300 int v18; // esi@97 |
0 | 9301 signed int v19; // edx@97 |
9302 char *v20; // ecx@98 | |
9303 int v21; // eax@100 | |
9304 __int16 v22; // dx@112 | |
9305 int v23; // [sp-8h] [bp-14h]@45 | |
9306 signed int v24; // [sp-4h] [bp-10h]@4 | |
9307 int v25; // [sp-4h] [bp-10h]@45 | |
9308 | |
9309 v3 = 0; | |
605 | 9310 v4 = uActiveCharacter - 1; |
501 | 9311 result = false; |
9312 if ( (signed int)VarNum > 222 ) | |
9313 { | |
9314 if ( (signed int)VarNum <= 307 ) | |
9315 { | |
9316 if ( VarNum == 307 ) | |
9317 { | |
9318 pParty->uNumDeaths -= (unsigned int)pValue; | |
9319 return pValue; | |
9320 } | |
9321 if ( VarNum == 223 ) | |
0 | 9322 { |
9323 v11 = (char *)pParty->_autonote_bits; | |
501 | 9324 v22 = (short)pValue - 1; |
0 | 9325 } |
9326 else | |
9327 { | |
501 | 9328 if ( VarNum != 231 ) |
0 | 9329 { |
501 | 9330 switch ( VarNum ) |
0 | 9331 { |
9332 case 232: | |
501 | 9333 VarNum = (VariableType)0; |
602 | 9334 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9335 result = (bool) pValue; |
9336 dword_5B65CC = 0; | |
9337 if ( (int)VarNum == pValue ) | |
0 | 9338 { |
501 | 9339 dword_5B65CC = (int)pValue; |
0 | 9340 } |
9341 else | |
9342 { | |
9343 pParty->field_709 = 0; | |
501 | 9344 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9345 Party__CountHirelings(); |
0 | 9346 viewparams->bRedrawGameUI = 1; |
9347 } | |
9348 break; | |
9349 case 241: | |
9350 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9351 { | |
9352 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9353 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9354 { |
605 | 9355 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9356 { |
9357 v21 = *(int *)v20; | |
9358 if ( (char)*(int *)v20 < 0 ) | |
9359 { | |
9360 LOBYTE(v21) = v21 & 0x7F; | |
9361 *(int *)v20 = v21; | |
9362 } | |
9363 } | |
9364 v20 += 76; | |
9365 } | |
9366 } | |
605 | 9367 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9368 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9369 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9370 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9371 pParty->field_709 = 0; | |
659 | 9372 Party__CountHirelings(); |
0 | 9373 break; |
9374 case 243: | |
9375 v17 = (char *)&this->uSkillPoints; | |
501 | 9376 result = *v17; |
9377 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9378 { | |
9379 *(int *)v17 -= (int)pValue; | |
9380 result = v17; | |
9381 } | |
0 | 9382 else |
9383 *(int *)v17 = 0; | |
9384 break; | |
9385 case 275: | |
9386 v16 = (char *)&pOutdoor->ddm; | |
9387 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9388 v16 = (char *)&pIndoor->dlv; | |
501 | 9389 *((int *)v16 + 2) -= (int)pValue; |
0 | 9390 if ( *((int *)v16 + 2) < -10000 ) |
9391 *((int *)v16 + 2) = -10000; | |
9392 break; | |
9393 case 306: | |
501 | 9394 result = VarNum - 306; |
9395 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9396 { | |
9397 result = (bool)pValue; | |
9398 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9399 } |
0 | 9400 else |
9401 LABEL_88: | |
9402 dword_5B65C4 = 1; | |
9403 break; | |
9404 } | |
501 | 9405 return result; |
0 | 9406 } |
9407 v11 = this->field_1A50; | |
501 | 9408 v22 = (signed __int16)pValue; |
0 | 9409 } |
9410 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9411 return result; |
9412 } | |
9413 switch ( VarNum ) | |
0 | 9414 { |
9415 case 308: | |
501 | 9416 result = (bool)pValue; |
9417 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9418 break; |
9419 case 309: | |
501 | 9420 result = (bool)pValue; |
9421 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9422 break; |
9423 case 310: | |
501 | 9424 result = (bool)pValue; |
9425 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9426 break; |
9427 case 311: | |
501 | 9428 result = (bool)pValue; |
9429 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9430 break; |
9431 case 312: | |
501 | 9432 result = (bool)pValue; |
9433 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9434 break; |
9435 case 313: | |
501 | 9436 result = (bool)pValue; |
9437 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9438 break; |
9439 } | |
9440 } | |
9441 else | |
9442 { | |
501 | 9443 if ( (signed int)VarNum >= 123 ) |
9444 { | |
9445 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9446 } |
9447 else | |
9448 { | |
501 | 9449 switch ( VarNum ) |
0 | 9450 { |
9451 case VAR_RandomGold: | |
501 | 9452 v6 = rand() % (signed int)pValue + 1; |
0 | 9453 if ( v6 > pParty->uNumGold ) |
9454 v6 = pParty->uNumGold; | |
9455 Party::TakeGold(v6); | |
9456 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9457 ShowStatusBarString(pTmpBuf, 2); |
0 | 9458 GameUI_DrawFoodAndGold(); |
501 | 9459 return result; |
0 | 9460 case VAR_RandomFood: |
501 | 9461 v7 = rand() % (signed int)pValue + 1; |
0 | 9462 if ( v7 > pParty->uNumFoodRations ) |
9463 v7 = pParty->uNumFoodRations; | |
9464 Party::TakeFood(v7); | |
9465 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9466 ShowStatusBarString(pTmpBuf, 2u); | |
9467 GameUI_DrawFoodAndGold(); | |
605 | 9468 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9469 v8 = 8 * v4 + 400; | |
9470 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9471 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
501 | 9472 return result; |
0 | 9473 case VAR_CurrentHP: |
501 | 9474 ReceiveDamage((signed int)pValue, 4); |
605 | 9475 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9476 v8 = 8 * v4 + 400; | |
9477 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9478 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9479 return result; | |
0 | 9480 case VAR_CurrentSP: |
9481 v9 = (char *)&this->sMana; | |
501 | 9482 v10 = this->sMana - (signed int)pValue < 0; |
9483 *(int *)v9 -= (int)pValue; | |
0 | 9484 if ( v10 ) |
9485 *(int *)v9 = 0; | |
605 | 9486 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9487 v8 = 8 * v4 + 400; | |
9488 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9489 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9490 return result; | |
0 | 9491 case VAR_ACModifier: |
501 | 9492 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9493 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9494 v8 = 8 * v4 + 400; | |
9495 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9496 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9497 return result; | |
0 | 9498 case VAR_BaseLevel: |
501 | 9499 this->uLevel -= (unsigned __int8)pValue; |
605 | 9500 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9501 v8 = 8 * v4 + 400; | |
9502 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9503 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9504 return result; | |
0 | 9505 case VAR_LevelModifier: |
501 | 9506 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9507 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9508 v8 = 8 * v4 + 400; | |
9509 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9510 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9511 return result; | |
0 | 9512 case VAR_Age: |
501 | 9513 this->sAgeModifier -= (signed __int16)pValue; |
9514 return result; | |
0 | 9515 case VAR_Award: |
605 | 9516 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9517 return result; | |
0 | 9518 case VAR_Experience: |
9519 v12 = (char *)&this->uExperience; | |
501 | 9520 v13 = (signed int)pValue; |
9521 v14 = *(int *)v12 < (unsigned int)pValue; | |
9522 *(int *)v12 -= (int)pValue; | |
0 | 9523 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9524 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9525 v8 = 8 * v4 + 400; | |
9526 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9527 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9528 return result; | |
0 | 9529 case VAR_QBits_QuestsDone: |
501 | 9530 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9531 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9532 return true; |
0 | 9533 case VAR_PlayerItemInHands: |
501 | 9534 v15 = this->pInventoryIndices; |
0 | 9535 break; |
9536 case VAR_FixedGold: | |
501 | 9537 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9538 goto LABEL_88; |
501 | 9539 Party::TakeGold((unsigned int)pValue); |
9540 return result; | |
0 | 9541 case VAR_MightBonus: |
9542 case VAR_ActualMight: | |
501 | 9543 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9544 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9545 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9546 v8 = 8 * v4 + 400; | |
9547 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9548 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9549 return result; | |
0 | 9550 case VAR_IntellectBonus: |
9551 case VAR_ActualIntellect: | |
501 | 9552 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9553 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9554 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9555 v8 = 8 * v4 + 400; | |
9556 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9557 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9558 return result; | |
0 | 9559 case VAR_PersonalityBonus: |
9560 case VAR_ActualPersonality: | |
501 | 9561 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9562 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9563 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9564 v8 = 8 * v4 + 400; | |
9565 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9566 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9567 return result; | |
0 | 9568 case VAR_EnduranceBonus: |
9569 case VAR_ActualEndurance: | |
501 | 9570 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9571 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9572 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9573 v8 = 8 * v4 + 400; | |
9574 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9575 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9576 return result; | |
0 | 9577 case VAR_SpeedBonus: |
9578 case VAR_ActualSpeed: | |
501 | 9579 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9580 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9581 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9582 v8 = 8 * v4 + 400; | |
9583 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9584 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9585 return result; | |
0 | 9586 case VAR_AccuracyBonus: |
9587 case VAR_ActualAccuracy: | |
501 | 9588 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9589 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9590 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9591 v8 = 8 * v4 + 400; | |
9592 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9593 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9594 return result; | |
0 | 9595 case VAR_LuckBonus: |
9596 case VAR_ActualLuck: | |
501 | 9597 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9598 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9599 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9600 v8 = 8 * v4 + 400; | |
9601 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9602 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9603 return result; | |
0 | 9604 case VAR_BaseMight: |
501 | 9605 this->uMight -= (unsigned __int16)pValue; |
605 | 9606 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9607 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9608 v8 = 8 * v4 + 400; | |
9609 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9610 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9611 return result; | |
0 | 9612 case VAR_BaseIntellect: |
501 | 9613 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9614 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9615 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9616 v8 = 8 * v4 + 400; | |
9617 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9618 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9619 return result; | |
0 | 9620 case VAR_BasePersonality: |
501 | 9621 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9622 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9623 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9624 v8 = 8 * v4 + 400; | |
9625 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9626 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9627 return result; | |
0 | 9628 case VAR_BaseEndurance: |
501 | 9629 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9630 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9631 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9632 v8 = 8 * v4 + 400; | |
9633 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9634 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9635 return result; | |
0 | 9636 case VAR_BaseSpeed: |
501 | 9637 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9638 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9639 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9640 v8 = 8 * v4 + 400; | |
9641 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9642 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9643 return result; | |
0 | 9644 case VAR_BaseAccuracy: |
501 | 9645 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9646 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9647 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9648 v8 = 8 * v4 + 400; | |
9649 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9650 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9651 return result; | |
0 | 9652 case VAR_BaseLuck: |
501 | 9653 this->uLuck -= (unsigned __int16)pValue; |
605 | 9654 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9655 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9656 v8 = 8 * v4 + 400; | |
9657 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9658 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9659 return result; | |
0 | 9660 case VAR_FireResistance: |
501 | 9661 this->sResFireBase -= (signed __int16)pValue; |
605 | 9662 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9663 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9664 v8 = 8 * v4 + 400; | |
9665 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9666 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9667 return result; | |
0 | 9668 case VAR_AirResistance: |
501 | 9669 this->sResAirBase -= (signed __int16)pValue; |
605 | 9670 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9671 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9672 v8 = 8 * v4 + 400; | |
9673 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9674 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9675 return result; | |
0 | 9676 case VAR_WaterResistance: |
501 | 9677 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9678 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9679 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9680 v8 = 8 * v4 + 400; | |
9681 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9682 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9683 return result; | |
0 | 9684 case VAR_EarthResistance: |
501 | 9685 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9686 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9687 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9688 v8 = 8 * v4 + 400; | |
9689 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9690 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9691 return result; | |
0 | 9692 case VAR_SpiritResistance: |
501 | 9693 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9694 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9695 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9696 v8 = 8 * v4 + 400; | |
9697 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9698 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9699 return result; | |
0 | 9700 case VAR_MindResistance: |
501 | 9701 this->sResMindBase -= (signed __int16)pValue; |
605 | 9702 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9703 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9704 v8 = 8 * v4 + 400; | |
9705 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9706 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9707 return result; | |
0 | 9708 case VAR_BodyResistance: |
501 | 9709 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9710 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9711 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9712 v8 = 8 * v4 + 400; | |
9713 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9714 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9715 return result; | |
0 | 9716 case VAR_LightResistance: |
501 | 9717 this->sResLightBase -= (signed __int16)pValue; |
605 | 9718 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9719 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9720 v8 = 8 * v4 + 400; | |
9721 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9722 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9723 return result; | |
0 | 9724 case VAR_DarkResistance: |
501 | 9725 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9726 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9727 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9728 v8 = 8 * v4 + 400; | |
9729 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9730 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9731 return result; | |
0 | 9732 case VAR_MagicResistance: |
501 | 9733 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9734 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9735 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9736 v8 = 8 * v4 + 400; | |
9737 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9738 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9739 return result; | |
0 | 9740 case VAR_FireResistanceBonus: |
501 | 9741 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9742 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9743 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9744 v8 = 8 * v4 + 400; | |
9745 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9746 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9747 return result; | |
0 | 9748 case VAR_AirResistanceBonus: |
501 | 9749 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9750 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9751 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9752 v8 = 8 * v4 + 400; | |
9753 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9754 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9755 return result; | |
0 | 9756 case VAR_WaterResistanceBonus: |
501 | 9757 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9758 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9759 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9760 v8 = 8 * v4 + 400; | |
9761 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9762 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9763 return result; | |
0 | 9764 case VAR_EarthResistanceBonus: |
501 | 9765 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9766 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9767 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9768 v8 = 8 * v4 + 400; | |
9769 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9770 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9771 return result; | |
0 | 9772 case VAR_SpiritResistanceBonus: |
501 | 9773 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9774 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9775 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9776 v8 = 8 * v4 + 400; | |
9777 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9778 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9779 return result; | |
0 | 9780 case VAR_MindResistanceBonus: |
501 | 9781 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9782 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9783 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9784 v8 = 8 * v4 + 400; | |
9785 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9786 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9787 return result; | |
0 | 9788 case VAR_BodyResistanceBonus: |
501 | 9789 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9790 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9791 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9792 v8 = 8 * v4 + 400; | |
9793 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9794 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9795 return result; | |
0 | 9796 case VAR_LightResistanceBonus: |
501 | 9797 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9798 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9799 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9800 v8 = 8 * v4 + 400; | |
9801 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9802 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9803 return result; | |
0 | 9804 case VAR_DarkResistanceBonus: |
501 | 9805 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9806 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9807 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9808 v8 = 8 * v4 + 400; | |
9809 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9810 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9811 return result; | |
0 | 9812 case VAR_MagicResistanceBonus: |
501 | 9813 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9814 v25 = 0; |
187 | 9815 v23 = SPEECH_91; |
9816 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9817 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9818 v8 = 8 * v4 + 400; | |
9819 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9820 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9821 return result; | |
0 | 9822 case VAR_FixedFood: |
501 | 9823 Party::TakeFood((unsigned int)pValue); |
605 | 9824 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9825 v8 = 8 * v4 + 400; | |
9826 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9827 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9828 return result; | |
0 | 9829 case VAR_StaffSkill: |
9830 case VAR_SwordSkill: | |
9831 case VAR_DaggerSkill: | |
9832 case VAR_AxeSkill: | |
9833 case VAR_SpearSkill: | |
9834 case VAR_BowSkill: | |
9835 case VAR_MaceSkill: | |
9836 case VAR_BlasterSkill: | |
9837 case VAR_ShieldSkill: | |
9838 case VAR_LeatherSkill: | |
9839 case VAR_SkillChain: | |
9840 case VAR_PlateSkill: | |
9841 case VAR_FireSkill: | |
9842 case VAR_AirSkill: | |
9843 case VAR_WaterSkill: | |
9844 case VAR_EarthSkill: | |
9845 case VAR_SpiritSkill: | |
9846 case VAR_MindSkill: | |
9847 case VAR_BodySkill: | |
9848 case VAR_LightSkill: | |
9849 case VAR_DarkSkill: | |
9850 case VAR_IdentifyItemSkill: | |
9851 case VAR_MerchantSkill: | |
9852 case VAR_RepairSkill: | |
9853 case VAR_BodybuildingSkill: | |
9854 case VAR_MeditationSkill: | |
9855 case VAR_PerceptionSkill: | |
9856 case VAR_DiplomacySkill: | |
9857 case VAR_DisarmTrapSkill: | |
9858 case VAR_LearningSkill: | |
501 | 9859 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9860 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9861 v8 = 8 * v4 + 400; | |
9862 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9863 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9864 return result; | |
0 | 9865 case VAR_Cursed: |
9866 case VAR_Weak: | |
9867 case VAR_Asleep: | |
9868 case VAR_Afraid: | |
9869 case VAR_Drunk: | |
9870 case VAR_Insane: | |
9871 case VAR_PoisonedGreen: | |
9872 case VAR_DiseasedGreen: | |
9873 case VAR_PoisonedYellow: | |
9874 case VAR_DiseasedYellow: | |
9875 case VAR_PoisonedRed: | |
9876 case VAR_DiseasedRed: | |
9877 case VAR_Paralyzed: | |
9878 case VAR_Unconsious: | |
9879 case VAR_Dead: | |
9880 case VAR_Stoned: | |
9881 case VAR_Eradicated: | |
501 | 9882 *((int *)this + 2 * VarNum - 210) = 0; |
9883 *((int *)this + 2 * result - 209) = 0; | |
0 | 9884 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9885 v8 = 8 * v4 + 400; | |
9886 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9887 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
501 | 9888 return result; |
605 | 9889 default: |
9890 return result; | |
9891 } | |
9892 for (v3 = 1; v3 < 126; v3++) | |
9893 { | |
9894 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9895 { |
605 | 9896 RemoveItemAtInventoryIndex(v3); |
501 | 9897 return true; |
0 | 9898 } |
605 | 9899 } |
501 | 9900 if ( pParty->pPickedItem.uItemID == pValue ) |
9901 { | |
605 | 9902 pMouse->RemoveHoldingItem(); |
9903 return true; | |
9904 } | |
9905 return false; | |
0 | 9906 } |
9907 } | |
9908 } | |
9909 // 5B65C4: using guessed type int dword_5B65C4; | |
9910 // 5B65CC: using guessed type int dword_5B65CC; |