Mercurial > mm7
annotate Player.cpp @ 484:4bd56919f075
avard quest guild bits
author | Gloval |
---|---|
date | Wed, 27 Feb 2013 02:25:31 +0400 |
parents | d4ea2d382004 |
children | 7887a9cf9e7b 00ce82758c72 |
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" | |
10 #include "LOD.h" | |
11 #include "Monsters.h" | |
12 #include "GUIWindow.h" | |
13 #include "Viewport.h" | |
14 #include "Actor.h" | |
15 #include "Game.h" | |
16 #include "Mouse.h" | |
17 #include "TurnEngine.h" | |
18 #include "Events.h" | |
19 #include "Events2D.h" | |
20 #include "Outdoor.h" | |
21 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Awards.h" |
189 | 24 #include "texts.h" |
0 | 25 #include "mm7_data.h" |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 /* 381 */ | |
33 #pragma pack(push, 1) | |
290 | 34 struct PlayerCreation_AttributeProps |
0 | 35 { |
36 unsigned __int8 uBaseValue; | |
37 char uMaxValue; | |
38 char uDroppedStep; | |
39 char uBaseStep; | |
40 }; | |
41 #pragma pack(pop) | |
42 | |
43 | |
44 #pragma pack(push, 1) | |
290 | 45 |
46 | |
47 | |
0 | 48 #pragma pack(pop) |
290 | 49 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
50 { | |
51 {{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},}, | |
52 {{ 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},}, | |
53 {{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},}, | |
54 {{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 | 55 }; |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | |
62 // available skills per class ( 9 classes X 37 skills ) | |
63 // 0 - not available | |
64 // 1 - available | |
65 // 2 - primary skill | |
66 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
67 { | |
68 {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}, | |
69 {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}, | |
70 {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}, | |
71 {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}, | |
72 {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}, | |
73 {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}, | |
74 {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}, | |
75 {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}, | |
76 {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 | |
77 }; | |
78 | |
79 | |
80 | |
81 | |
82 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
83 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
84 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}; | |
85 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}; | |
86 | |
87 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
88 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
89 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
90 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
91 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
92 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
93 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
94 | |
95 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
96 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
97 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
98 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
99 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
100 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
101 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
102 | |
103 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
104 | |
105 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
106 | |
94 | 107 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 108 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 109 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 110 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 | 111 |
112 | |
113 | |
114 | |
115 //----- (00490913) -------------------------------------------------------- | |
116 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
117 { | |
118 signed int v0; // edi@1 | |
119 signed int v1; // esi@1 | |
120 int v2; // ebx@2 | |
121 int v3; // ecx@17 | |
122 signed int v4; // eax@17 | |
123 int v5; // edx@18 | |
124 signed int v6; // ecx@18 | |
125 signed int v8; // [sp+Ch] [bp-8h]@1 | |
126 signed int v9; // [sp+10h] [bp-4h]@2 | |
127 | |
128 v8 = 50; | |
129 v0 = 50; | |
130 v1 = 0; | |
131 do | |
132 { | |
133 v9 = 0; | |
134 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
135 do | |
136 { | |
137 if ( v9 ) | |
138 { | |
139 switch ( v9 ) | |
140 { | |
141 case 1: | |
142 v0 = pParty->pPlayers[v1].uIntelligence; | |
143 break; | |
144 case 2: | |
145 v0 = pParty->pPlayers[v1].uWillpower; | |
146 break; | |
147 case 3: | |
148 v0 = pParty->pPlayers[v1].uEndurance; | |
149 break; | |
150 case 4: | |
151 v0 = pParty->pPlayers[v1].uAccuracy; | |
152 break; | |
153 case 5: | |
154 v0 = pParty->pPlayers[v1].uSpeed; | |
155 break; | |
156 case 6: | |
157 v0 = pParty->pPlayers[v1].uLuck; | |
158 break; | |
159 } | |
160 } | |
161 else | |
162 { | |
163 v0 = pParty->pPlayers[v1].uMight; | |
164 } | |
165 v3 = v2 + v9; | |
290 | 166 v4 = StatTable[0][v3].uBaseValue; |
0 | 167 if ( v0 >= v4 ) |
168 { | |
290 | 169 v5 = StatTable[0][v3].uDroppedStep; |
170 v6 = StatTable[0][v3].uBaseStep; | |
0 | 171 } |
172 else | |
173 { | |
290 | 174 v5 = StatTable[0][v3].uBaseStep; |
175 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 176 } |
177 v8 += v5 * (v4 - v0) / v6; | |
178 ++v9; | |
179 } | |
180 while ( v9 <= 6 ); | |
181 ++v1; | |
182 } | |
183 while ( v1 < 4 ); | |
184 return v8; | |
185 } | |
186 | |
187 | |
188 | |
189 //----- (00427730) -------------------------------------------------------- | |
190 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
191 { | |
192 int v2; // eax@1 | |
193 bool result; // eax@2 | |
194 | |
195 v2 = this->sMana; | |
196 if ( v2 >= (signed int)uRequiredMana ) | |
197 { | |
198 this->sMana = v2 - uRequiredMana; | |
199 result = 1; | |
200 } | |
201 else | |
202 { | |
203 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
204 result = 0; | |
205 } | |
206 return result; | |
207 } | |
208 | |
209 | |
210 //----- (004BE2DD) -------------------------------------------------------- | |
211 void Player::_4BE2DD(unsigned int a2, int a3, int _2devent_idx) | |
212 { | |
213 Player *v4; // edi@1 | |
214 char *v5; // esi@1 | |
215 float v6; // ST04_4@1 | |
216 signed int v7; // eax@1 | |
217 signed int v8; // ebx@1 | |
218 | |
219 auto a4 = _2devent_idx; | |
220 v4 = this; | |
221 v5 = (char *)this + 36 * a3; | |
222 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
223 //v6 = p2DEvents_minus1__20[13 * a4]; | |
224 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
225 v8 = _4B8102(v7, v6); | |
226 if ( v5[552] & 2 ) | |
227 v8 = 1; | |
228 if ( v8 < 1 ) | |
229 v8 = 1; | |
230 RemoveItemAtInventoryIndex(a2); | |
231 Party::SetGold(pParty->uNumGold + v8); | |
232 } | |
233 | |
234 | |
235 | |
236 //----- (0043EEF3) -------------------------------------------------------- | |
237 bool Player::_43EEF3() | |
238 { | |
239 signed int v1; // esi@1 | |
240 PlayerEquipment *v2; // edx@1 | |
241 bool result; // eax@2 | |
242 | |
243 v1 = 0; | |
244 v2 = &this->pEquipment; | |
245 while ( 1 ) | |
246 { | |
247 result = v2->uOffHand; | |
248 if ( v2->uOffHand ) | |
249 { | |
232 | 250 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 251 if ( result ) |
252 { | |
253 if ( result != 64 && result != 65 ) | |
254 break; | |
255 } | |
256 } | |
257 ++v1; | |
258 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
259 if ( v1 >= 16 ) | |
260 { | |
261 LOBYTE(result) = 1; | |
262 return result; | |
263 } | |
264 } | |
265 LOBYTE(result) = 0; | |
266 return result; | |
267 } | |
268 | |
269 | |
270 | |
271 //----- (004B8040) -------------------------------------------------------- | |
272 int Player::_4B8040_condition_time(unsigned int uCondition) | |
273 { | |
274 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
275 } | |
276 | |
277 //----- (004B807C) -------------------------------------------------------- | |
278 int Player::_4B807C(float a2) | |
279 { | |
280 Player *v2; // edi@1 | |
281 unsigned int v3; // eax@1 | |
282 int v4; // esi@1 | |
283 unsigned int v5; // ebx@7 | |
284 int v6; // eax@8 | |
285 signed __int64 v7; // qax@13 | |
286 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
287 signed int v10; // [sp+8h] [bp-8h]@4 | |
288 int v11; // [sp+Ch] [bp-4h]@6 | |
289 | |
290 v2 = this; | |
291 v3 = GetMajorConditionIdx(); | |
292 v4 = 0; | |
293 if ( (signed int)v3 >= 14 ) | |
294 { | |
295 if ( (signed int)v3 <= 15 ) | |
296 { | |
297 v10 = 5; | |
298 v9 = v3; | |
299 goto LABEL_6; | |
300 } | |
301 if ( v3 == 16 ) | |
302 { | |
303 v10 = 10; | |
304 v9 = 16; | |
305 LABEL_6: | |
306 v11 = _4B8040_condition_time(v9); | |
307 goto LABEL_13; | |
308 } | |
309 } | |
310 v10 = 1; | |
311 v5 = 0; | |
312 do | |
313 { | |
314 v6 = _4B8040_condition_time(v5); | |
315 if ( v6 > v4 ) | |
316 v4 = v6; | |
317 ++v5; | |
318 } | |
319 while ( (signed int)v5 <= 13 ); | |
320 v11 = v4; | |
321 if ( !v4 ) | |
322 v11 = 1; | |
323 LABEL_13: | |
324 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
325 if ( (signed int)v7 < 1 ) | |
326 LODWORD(v7) = 1; | |
327 return v7; | |
328 } | |
329 | |
330 //----- (004B8102) -------------------------------------------------------- | |
331 int Player::_4B8102(int a2, float a3) | |
332 { | |
333 signed int v3; // esi@1 | |
334 signed int result; // eax@3 | |
335 | |
336 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; | |
337 if ( v3 > a2 ) | |
338 v3 = a2; | |
339 result = 1; | |
340 if ( v3 >= 1 ) | |
341 result = v3; | |
342 return result; | |
343 } | |
344 | |
345 //----- (004B8142) -------------------------------------------------------- | |
346 int Player::_4B8142(int a2, float a3) | |
347 { | |
348 int result; // eax@1 | |
349 | |
350 result = (int)((100 - GetMerchant()) * (unsigned __int64)(signed __int64)((double)a2 * a3)) / 100; | |
351 if ( result < a2 ) | |
352 result = a2; | |
353 if ( result < 1 ) | |
354 result = 1; | |
355 return result; | |
356 } | |
357 | |
358 //----- (004B8179) -------------------------------------------------------- | |
359 int Player::_4B8179(float a2) | |
360 { | |
361 signed int v2; // esi@1 | |
362 int v3; // ecx@1 | |
363 signed int result; // eax@3 | |
364 | |
365 v2 = (signed __int64)(a2 * 50.0); | |
366 v3 = v2 * (100 - GetMerchant()) / 100; | |
367 if ( v3 < v2 / 3 ) | |
368 v3 = v2 / 3; | |
369 result = 1; | |
370 if ( v3 >= 1 ) | |
371 result = v3; | |
372 return result; | |
373 } | |
374 | |
375 //----- (004B81C3) -------------------------------------------------------- | |
376 int Player::_4B81C3(int a2, float a3) | |
377 { | |
378 signed int v3; // esi@1 | |
379 int v4; // ecx@1 | |
380 signed int result; // eax@3 | |
381 | |
382 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
383 v4 = v3 * (100 - GetMerchant()) / 100; | |
384 if ( v4 < v3 / 3 ) | |
385 v4 = v3 / 3; | |
386 result = 1; | |
387 if ( v4 >= 1 ) | |
388 result = v4; | |
389 return result; | |
390 } | |
391 | |
392 //----- (004B8213) -------------------------------------------------------- | |
393 int Player::_4B8213(int a2, float a3) | |
394 { | |
395 signed __int64 v3; // qax@1 | |
396 | |
397 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
398 if ( (signed int)v3 < 1 ) | |
399 LODWORD(v3) = 1; | |
400 return v3; | |
401 } | |
402 | |
403 //----- (004B8233) -------------------------------------------------------- | |
404 int Player::_4B8233(int a2, float a3) | |
405 { | |
406 signed __int64 v3; // qax@1 | |
407 | |
408 v3 = (signed __int64)((double)a2 * a3); | |
409 if ( (signed int)v3 < 1 ) | |
410 LODWORD(v3) = 1; | |
411 return v3; | |
412 } | |
413 | |
414 //----- (004B824B) -------------------------------------------------------- | |
415 int Player::_4B824B(float a2) | |
416 { | |
417 signed __int64 v2; // qax@1 | |
418 | |
419 v2 = (signed __int64)(a2 * 50.0); | |
420 if ( (signed int)v2 < 1 ) | |
421 LODWORD(v2) = 1; | |
422 return v2; | |
423 } | |
424 | |
425 //----- (004B8265) -------------------------------------------------------- | |
426 int Player::_4B8265(int a2, float a3) | |
427 { | |
428 signed __int64 v3; // qax@1 | |
429 | |
430 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
431 if ( (signed int)v3 < 1 ) | |
432 LODWORD(v3) = 1; | |
433 return v3; | |
434 } | |
435 | |
436 | |
437 | |
438 | |
439 | |
440 //----- (004B6FF9) -------------------------------------------------------- | |
441 int Player::_4B6FF9() | |
442 { | |
443 Player *v1; // esi@1 | |
444 signed int v2; // eax@1 | |
445 char v3; // zf@4 | |
446 | |
447 v1 = this; | |
336 | 448 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 449 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
450 { | |
451 if ( GetMajorConditionIdx() == 18 ) | |
452 goto LABEL_6; | |
453 v3 = GetMajorConditionIdx() == 17; | |
454 } | |
455 else | |
456 { | |
457 v3 = GetMajorConditionIdx() == 18; | |
458 } | |
459 if ( !v3 ) | |
460 return 1; | |
461 LABEL_6: | |
462 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
463 return 1; | |
464 return 0; | |
465 } | |
466 | |
467 | |
468 | |
469 //----- (00421E75) -------------------------------------------------------- | |
470 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
471 { | |
472 int v2; // eax@1 | |
473 unsigned int result; // eax@3 | |
474 | |
475 v2 = *a2; | |
476 if ( *a2 >= 126 || v2 < 0 ) | |
477 { | |
478 result = 0; | |
479 } | |
480 else | |
481 { | |
482 result = this->pInventoryIndices[v2]; | |
483 if ( (result & 0x80000000u) != 0 ) | |
484 { | |
485 *a2 = -1 - result; | |
486 result = this->pInventoryIndices[-1 - result]; | |
487 } | |
488 } | |
489 return result; | |
490 } | |
491 | |
492 | |
493 | |
494 //----- (004160CA) -------------------------------------------------------- | |
495 char Player::_4160CA(int a2) | |
496 { | |
497 Player *v2; // esi@1 | |
498 signed int v3; // edx@1 | |
499 signed int v4; // ebx@1 | |
500 ItemGen *v5; // eax@1 | |
501 int v6; // edi@2 | |
502 signed int i; // edx@8 | |
503 ItemGen **v8; // ecx@9 | |
504 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
505 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
506 int v12; // [sp+120h] [bp-4h]@1 | |
507 | |
508 auto a1 = this; | |
509 | |
510 v12 = a2; | |
511 v2 = a1; | |
512 v3 = 0; | |
513 v10[0] = 0; | |
514 v4 = 0; | |
515 memset(&v10[1], 0, 0x110u); | |
516 v11 = 0; | |
517 v5 = a1->pInventoryItems; | |
518 do | |
519 { | |
520 v6 = 0; | |
521 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
522 v10[v4++] = v3; | |
523 ++v3; | |
524 ++v5; | |
525 } | |
526 while ( v3 < 138 ); | |
527 if ( v4 ) | |
528 { | |
529 if ( v12 ) | |
530 { | |
531 if ( v12 > 0 ) | |
532 { | |
533 do | |
534 { | |
535 LOWORD(v5) = 9 * v10[v6]; | |
536 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
537 { | |
538 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
539 v5->uItemID |= 2u; | |
540 } | |
541 ++v6; | |
542 } | |
543 while ( v6 < v12 ); | |
544 } | |
545 } | |
546 else | |
547 { | |
548 for ( i = 0; i < v4; ++i ) | |
549 { | |
550 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
551 v5 = *v8; | |
552 if ( !(BYTE1(v5) & 2) ) | |
553 { | |
554 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
555 *v8 = v5; | |
556 } | |
557 } | |
558 } | |
559 } | |
560 return (char)v5; | |
561 } | |
562 | |
563 //----- (004948B1) -------------------------------------------------------- | |
187 | 564 void Player::PlaySound(PlayerSpeech speech, int a3) |
565 { | |
566 //Player *pPlayer; // edi@1 | |
567 //int v4; // eax@4 | |
0 | 568 signed int v5; // esi@4 |
203 | 569 unsigned char *v6; // ebx@4 |
0 | 570 signed int v7; // ecx@5 |
571 unsigned __int8 v8; // al@6 | |
572 int v9; // eax@10 | |
187 | 573 //unsigned int pVoiceID; // ecx@10 |
0 | 574 int v11; // esi@10 |
575 signed int v12; // eax@11 | |
576 signed int v13; // esi@12 | |
577 int v14; // eax@12 | |
187 | 578 //int v15; // eax@17 |
248 | 579 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 580 signed int v17; // ecx@19 |
581 char *pSoundID; // edi@20 | |
582 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 583 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 584 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
585 int pSoundId; // [sp+30h] [bp+8h]@4 | |
586 | |
187 | 587 //pPlayer = this; |
588 //pPlayer2 = this; | |
589 | |
0 | 590 pPlayerNum = 1; |
187 | 591 for (int i = 0; i < 4; ++i) |
592 if (&pParty->pPlayers[i] == this) | |
593 { | |
594 pPlayerNum = i + 1; | |
0 | 595 break; |
187 | 596 } |
597 | |
598 //v4 = a2;//102 | |
0 | 599 v5 = 0; |
600 pSoundId = 0; | |
203 | 601 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
602 if (uVoicesVolumeMultiplier) | |
0 | 603 { |
604 v7 = 0; | |
605 do | |
606 { | |
607 v8 = v6[v7]; | |
608 if ( v8 ) | |
609 v20[v5++] = v8; | |
610 ++v7; | |
611 } | |
612 while ( v7 < 2 ); | |
613 if ( v5 ) | |
614 { | |
615 v9 = rand(); | |
187 | 616 //pVoiceID = uVoiceID; |
0 | 617 v11 = v20[v9 % v5]; |
203 | 618 |
619 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
620 { | |
621 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
622 v12 = (8 * pPlayerNum + 312) | OBJECT_Player; | |
328 | 623 pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 624 } |
625 } | |
626 } | |
203 | 627 |
0 | 628 v13 = 0; |
629 v14 = (int)(v6 + 3); | |
630 do | |
631 { | |
632 if ( *(char *)v14 ) | |
633 v20[v13++] = *(char *)v14; | |
634 ++v14; | |
635 } | |
636 while ( -3 - (signed int)v6 + v14 < 5 ); | |
637 if ( v13 ) | |
638 { | |
639 pPlayerNum = 0; | |
248 | 640 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
641 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 642 { |
643 v17 = 0; | |
644 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
645 { | |
646 LABEL_23: | |
647 v17 = 0; | |
648 } | |
649 else | |
650 { | |
651 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
652 while ( *(int *)pSoundID != pSoundId ) | |
653 { | |
654 ++v17; | |
655 pSoundID += 120; | |
656 if ( v17 >= (signed int)pSoundList->uNumSounds ) | |
657 goto LABEL_23; | |
658 } | |
659 } | |
660 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
661 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
662 } | |
248 | 663 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 664 } |
665 //return v14; | |
0 | 666 } |
667 // 4948B1: using guessed type int var_1C[5]; | |
668 | |
669 //----- (00494A25) -------------------------------------------------------- | |
187 | 670 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
671 { | |
672 //signed int v3; // eax@1 | |
673 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 674 signed int v5; // edi@15 |
675 PlayerFrame *v6; // esi@17 | |
676 signed int v7; // eax@20 | |
677 | |
187 | 678 //LOWORD(v3) = this->expression; |
679 //v4 = expr; | |
680 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
681 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
682 { | |
683 int v3 = (unsigned)expression; | |
0 | 684 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
685 { | |
686 if ( v3 <= 7 ) | |
687 goto LABEL_12; | |
688 if ( v3 > 8 ) | |
689 { | |
690 if ( v3 > 11 ) | |
691 { | |
187 | 692 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
693 return; | |
0 | 694 goto LABEL_15; |
695 } | |
696 LABEL_12: | |
187 | 697 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
698 return; | |
0 | 699 goto LABEL_15; |
700 } | |
701 } | |
702 } | |
703 LABEL_15: | |
187 | 704 //LOWORD(v3) = a3; |
0 | 705 v5 = 0; |
706 this->uExpressionTimeLength = a3; | |
707 this->uExpressionTimePassed = 0; | |
708 if ( !a3 ) | |
709 { | |
710 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
711 { | |
712 LABEL_20: | |
713 v7 = 0; | |
714 } | |
715 else | |
716 { | |
717 v6 = pPlayerFrameTable->pFrames; | |
187 | 718 while ( v6->expression != new_expression ) |
0 | 719 { |
720 ++v5; | |
721 ++v6; | |
722 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
723 goto LABEL_20; | |
724 } | |
725 v7 = v5; | |
726 } | |
187 | 727 //v4 = expr; |
728 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
729 } | |
730 expression = new_expression; | |
0 | 731 viewparams->bRedrawGameUI = 1; |
732 } | |
733 | |
734 //----- (0049327B) -------------------------------------------------------- | |
735 int Player::_49327B(unsigned int uClass, int a3) | |
736 { | |
737 Player *v3; // esi@1 | |
738 char v4; // zf@4 | |
739 __int16 v5; // dx@9 | |
740 signed int result; // eax@84 | |
741 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
742 int v8; // [sp-4h] [bp-Ch]@3 | |
743 | |
744 v3 = this; | |
135 | 745 if ( this->classType == uClass ) |
0 | 746 { |
747 LABEL_84: | |
748 result = 1; | |
749 } | |
750 else | |
751 { | |
752 switch ( uClass ) | |
753 { | |
754 case 0u: | |
755 v8 = a3; | |
756 v7 = 1; | |
757 goto LABEL_4; | |
758 case 1u: | |
484 | 759 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 760 || _49327B(2u, a3) ) |
761 goto LABEL_84; | |
762 v8 = a3; | |
763 v7 = 3; | |
764 goto LABEL_4; | |
765 case 2u: | |
766 v5 = 19; | |
767 goto LABEL_82; | |
768 case 3u: | |
769 v5 = 21; | |
770 goto LABEL_82; | |
771 case 4u: | |
772 v8 = a3; | |
773 v7 = 5; | |
774 goto LABEL_4; | |
775 case 5u: | |
484 | 776 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 777 || _49327B(6u, a3) ) |
778 goto LABEL_84; | |
779 v8 = a3; | |
780 v7 = 7; | |
781 goto LABEL_4; | |
782 case 6u: | |
783 if ( !a3 ) | |
784 break; | |
785 v5 = 13; | |
786 goto LABEL_82; | |
787 case 7u: | |
788 if ( !a3 ) | |
789 break; | |
790 v5 = 15; | |
791 goto LABEL_82; | |
792 case 8u: | |
793 v8 = a3; | |
794 v7 = 9; | |
795 goto LABEL_4; | |
796 case 9u: | |
484 | 797 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 798 || _49327B(0xAu, a3) ) |
799 goto LABEL_84; | |
800 v8 = a3; | |
801 v7 = 11; | |
802 goto LABEL_4; | |
803 case 0xAu: | |
804 if ( !a3 ) | |
805 break; | |
806 v5 = 25; | |
807 goto LABEL_82; | |
808 case 0xBu: | |
809 if ( !a3 ) | |
810 break; | |
811 v5 = 27; | |
812 goto LABEL_82; | |
813 case 0xCu: | |
814 v8 = a3; | |
815 v7 = 13; | |
816 goto LABEL_4; | |
817 case 0xDu: | |
484 | 818 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 819 || _49327B(0xEu, a3) ) |
820 goto LABEL_84; | |
821 v8 = a3; | |
822 v7 = 15; | |
823 goto LABEL_4; | |
824 case 0xEu: | |
825 if ( !a3 ) | |
826 break; | |
827 v5 = 43; | |
828 goto LABEL_82; | |
829 case 0xFu: | |
830 if ( !a3 ) | |
831 break; | |
832 v5 = 45; | |
833 goto LABEL_82; | |
834 case 0x10u: | |
835 v8 = a3; | |
836 v7 = 17; | |
837 goto LABEL_4; | |
838 case 0x11u: | |
484 | 839 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 840 || _49327B(0x12u, a3) ) |
841 goto LABEL_84; | |
842 v8 = a3; | |
843 v7 = 19; | |
844 goto LABEL_4; | |
845 case 0x12u: | |
846 if ( !a3 ) | |
847 break; | |
848 v5 = 37; | |
849 goto LABEL_82; | |
850 case 0x13u: | |
851 v5 = 39; | |
852 goto LABEL_82; | |
853 case 0x14u: | |
854 v8 = a3; | |
855 v7 = 21; | |
856 goto LABEL_4; | |
857 case 0x15u: | |
484 | 858 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 859 || _49327B(0x16u, a3) ) |
860 goto LABEL_84; | |
861 v8 = a3; | |
862 v7 = 23; | |
863 goto LABEL_4; | |
864 case 0x16u: | |
865 if ( !a3 ) | |
866 break; | |
867 v5 = 31; | |
868 goto LABEL_82; | |
869 case 0x17u: | |
870 if ( !a3 ) | |
871 break; | |
872 v5 = 33; | |
873 goto LABEL_82; | |
874 case 0x18u: | |
875 if ( !_49327B(0x19u, a3) ) | |
876 goto LABEL_56; | |
877 break; | |
878 case 0x19u: | |
879 LABEL_56: | |
484 | 880 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 881 || _49327B(0x1Au, a3) ) |
882 goto LABEL_84; | |
883 v8 = a3; | |
884 v7 = 27; | |
885 goto LABEL_4; | |
886 case 0x1Au: | |
887 if ( !a3 ) | |
888 break; | |
889 v5 = 65; | |
890 goto LABEL_82; | |
891 case 0x1Bu: | |
892 if ( !a3 ) | |
893 break; | |
894 v5 = 67; | |
895 goto LABEL_82; | |
896 case 0x1Cu: | |
897 v8 = a3; | |
898 v7 = 29; | |
899 goto LABEL_4; | |
900 case 0x1Du: | |
484 | 901 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 902 || _49327B(0x1Eu, a3) ) |
903 goto LABEL_84; | |
904 v8 = a3; | |
905 v7 = 31; | |
906 goto LABEL_4; | |
907 case 0x1Eu: | |
908 if ( !a3 ) | |
909 break; | |
910 v5 = 71; | |
911 goto LABEL_82; | |
912 case 0x1Fu: | |
913 if ( !a3 ) | |
914 break; | |
915 v5 = 73; | |
916 goto LABEL_82; | |
917 case 0x20u: | |
918 v8 = a3; | |
919 v7 = 33; | |
920 goto LABEL_4; | |
921 case 0x21u: | |
484 | 922 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 923 || _49327B(0x22u, a3) ) |
924 goto LABEL_84; | |
925 v8 = a3; | |
926 v7 = 35; | |
927 LABEL_4: | |
928 v4 = _49327B(v7, v8) == 0; | |
929 goto LABEL_83; | |
930 case 0x22u: | |
931 if ( !a3 ) | |
932 break; | |
933 v5 = 77; | |
934 goto LABEL_82; | |
935 case 0x23u: | |
936 if ( a3 ) | |
937 { | |
938 v5 = 79; | |
939 LABEL_82: | |
484 | 940 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 941 LABEL_83: |
942 if ( !v4 ) | |
943 goto LABEL_84; | |
944 } | |
945 break; | |
946 default: | |
947 break; | |
948 } | |
949 result = 0; | |
950 } | |
951 return result; | |
952 } | |
953 | |
954 | |
955 //----- (00492C0B) -------------------------------------------------------- | |
956 bool Player::CanAct() | |
957 { | |
958 bool result; // eax@2 | |
959 | |
960 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
961 result = 0; | |
962 else | |
963 result = 1; | |
964 return result; | |
965 } | |
966 | |
967 //----- (00492C40) -------------------------------------------------------- | |
968 bool Player::CanSteal() | |
969 { | |
970 int v1; // eax@1 | |
971 | |
972 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
973 return v1 != 0; | |
974 } | |
975 | |
976 //----- (00492C4E) -------------------------------------------------------- | |
977 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
978 { | |
979 char v2; // zf@9 | |
980 __int16 v4; // dx@13 | |
981 char v5; // zf@15 | |
982 | |
983 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
984 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
985 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
986 { | |
987 if ( uItemID == 533 ) | |
988 { | |
989 v2 = GetRace() == 1; | |
990 } | |
991 else | |
992 { | |
993 if ( uItemID != 534 ) | |
994 { | |
995 if ( uItemID == 535 ) // | |
996 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
997 { | |
998 switch ( this->uVoiceID ) | |
999 { | |
1000 default: | |
1001 return 1; | |
1002 case 4u: | |
1003 case 5u: | |
1004 case 6u: | |
1005 case 7u: | |
1006 case 0xAu: | |
1007 case 0xBu: | |
1008 case 0xEu: // | |
1009 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
1010 case 0xFu: | |
1011 case 0x12u: | |
1012 case 0x13u: | |
1013 case 0x15u: | |
1014 case 0x18u: | |
1015 return 0; | |
1016 } | |
1017 return 0; | |
1018 } | |
1019 if ( uItemID == 536 ) // | |
1020 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
1021 { | |
1022 switch ( this->uVoiceID ) | |
1023 { | |
1024 case 4u: | |
1025 case 5u: | |
1026 case 6u: | |
1027 case 7u: | |
1028 case 0xAu: | |
1029 case 0xBu: | |
1030 case 0xEu: | |
1031 case 0xFu: | |
1032 case 0x12u: | |
1033 case 0x13u: | |
1034 case 0x15u: | |
1035 case 0x18u: | |
1036 return 1; | |
1037 default: | |
1038 return 0; | |
1039 } | |
1040 return 0; | |
1041 } | |
1042 if ( uItemID != 604 ) // | |
1043 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1044 return 1; | |
1045 v5 = _43EEF3() == 0; | |
1046 goto LABEL_23; | |
1047 } | |
1048 v2 = GetRace() == 3; // | |
1049 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1050 } | |
1051 } | |
1052 else | |
1053 { | |
1054 if ( uItemID != 532 ) | |
1055 { | |
1056 if ( uItemID != 515 && uItemID != 517 ) // | |
1057 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1058 { | |
1059 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1060 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1061 { | |
1062 LABEL_13: | |
1063 v4 = 99; | |
1064 LABEL_15: | |
484 | 1065 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1066 LABEL_23: |
1067 if ( !v5 ) | |
1068 return 1; | |
1069 return 0; | |
1070 } | |
1071 if ( uItemID != 525 ) | |
1072 { | |
1073 if ( uItemID != 527 ) | |
1074 { | |
1075 if ( uItemID != 531 ) | |
1076 return 1; | |
1077 v2 = GetRace() == 2; | |
1078 goto LABEL_10; | |
1079 } | |
1080 goto LABEL_13; | |
1081 } | |
1082 } | |
1083 v4 = 100; | |
1084 goto LABEL_15; | |
1085 } | |
1086 v2 = GetRace() == 0; | |
1087 } | |
1088 LABEL_10: | |
1089 if ( v2 ) | |
1090 return 1; | |
1091 return 0; | |
1092 } | |
1093 | |
1094 //----- (00492D65) -------------------------------------------------------- | |
1095 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1096 { | |
1097 Player *v3; // esi@1 | |
1098 Player **v4; // ebx@2 | |
1099 Player *v5; // ecx@21 | |
1100 Player *v6; // ecx@22 | |
1101 Player *v7; // ecx@29 | |
1102 Player *v8; // ecx@30 | |
1103 Player *v9; // ecx@37 | |
1104 Player *v10; // ecx@38 | |
1105 Player *v11; // ecx@45 | |
1106 Player *v12; // ecx@46 | |
1107 char *v13; // eax@49 | |
1108 Player *v14; // ecx@58 | |
1109 Player *v15; // ecx@59 | |
1110 Player *v16; // ecx@60 | |
1111 signed int result; // eax@76 | |
1112 signed int v18; // ecx@77 | |
1113 int v19; // eax@77 | |
1114 char v20; // al@80 | |
1115 signed int v21; // ebx@82 | |
1116 signed int v22; // esi@82 | |
1117 int v23; // [sp-8h] [bp-1Ch]@7 | |
1118 int v24; // [sp-8h] [bp-1Ch]@15 | |
1119 int v25; // [sp-8h] [bp-1Ch]@53 | |
1120 int v26; // [sp-4h] [bp-18h]@7 | |
1121 signed int v27; // [sp-4h] [bp-18h]@15 | |
1122 int v28; // [sp-4h] [bp-18h]@53 | |
1123 char *v29; // [sp+Ch] [bp-8h]@1 | |
1124 int v30; // [sp+10h] [bp-4h]@2 | |
1125 int v31; // [sp+20h] [bp+Ch]@82 | |
1126 | |
1127 v3 = this; | |
1128 v29 = (char *)this + 8 * uConditionIdx; | |
1129 if ( *(_QWORD *)v29 ) | |
1130 { | |
1131 LABEL_76: | |
1132 result = 0; | |
1133 } | |
1134 else | |
1135 { | |
1136 v4 = &pPlayers[1]; | |
1137 v30 = 0; | |
1138 do | |
1139 { | |
1140 if ( (*v4)->CanAct() ) | |
1141 ++v30; | |
1142 ++v4; | |
1143 } | |
1144 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1145 switch ( uConditionIdx ) | |
1146 { | |
1147 case 0u: | |
1148 v26 = 0; | |
1149 v23 = 30; | |
1150 goto LABEL_81; | |
1151 case 1u: | |
1152 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1153 goto LABEL_10; | |
1154 v26 = 0; | |
1155 v23 = 25; | |
1156 goto LABEL_81; | |
1157 case 2u: | |
1158 if ( a3 != 1 ) | |
1159 goto LABEL_82; | |
1160 if ( v3->HasEnchantedItemEquipped(22) ) | |
1161 goto LABEL_76; | |
1162 v27 = 3; | |
1163 v24 = 505; | |
1164 goto LABEL_16; | |
1165 case 3u: | |
1166 v26 = 0; | |
1167 v23 = 26; | |
1168 goto LABEL_81; | |
1169 case 4u: | |
1170 v26 = 0; | |
1171 v23 = 31; | |
1172 goto LABEL_81; | |
1173 case 5u: | |
1174 if ( a3 == 1 | |
1175 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1176 goto LABEL_76; | |
1177 v26 = 0; | |
1178 v23 = 29; | |
1179 goto LABEL_81; | |
1180 case 6u: | |
1181 case 8u: | |
1182 case 0xAu: | |
1183 if ( a3 == 1 ) | |
1184 { | |
1185 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1186 { | |
1187 --pParty->pPartyBuffs[13].uPower; | |
1188 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1189 pParty->pPartyBuffs[13].Reset(); | |
1190 } | |
1191 if ( v3->HasEnchantedItemEquipped(21) | |
1192 || v7->WearsItem(505, 3) | |
1193 || v8->WearsItem(530, 6) ) | |
1194 goto LABEL_76; | |
1195 } | |
1196 v26 = 0; | |
1197 v23 = 27; | |
1198 goto LABEL_81; | |
1199 case 7u: | |
1200 case 9u: | |
1201 case 0xBu: | |
1202 if ( a3 != 1 ) | |
1203 goto LABEL_40; | |
1204 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1205 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1206 goto LABEL_10; | |
1207 if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) | |
1208 goto LABEL_76; | |
1209 LABEL_40: | |
1210 v26 = 0; | |
1211 v23 = 28; | |
1212 goto LABEL_81; | |
1213 case 0xCu: | |
1214 if ( a3 != 1 ) | |
1215 goto LABEL_82; | |
1216 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1217 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1218 goto LABEL_10; | |
1219 if ( v3->HasEnchantedItemEquipped(20) | |
1220 || v11->WearsItem(505, 3) | |
1221 || v12->WearsItem(507, 16) ) | |
1222 goto LABEL_76; | |
1223 v27 = 6; | |
1224 v24 = 530; | |
1225 LABEL_16: | |
1226 if ( v3->WearsItem(v24, v27) ) | |
1227 goto LABEL_76; | |
1228 goto LABEL_82; | |
1229 case 0xDu: | |
187 | 1230 v3->PlaySound(SPEECH_32, 0); |
0 | 1231 v13 = (char *)&v3->sHealth; |
1232 goto LABEL_70; | |
1233 case 0xEu: | |
1234 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1235 goto LABEL_10; | |
1236 v28 = 0; | |
1237 v25 = 33; | |
1238 goto LABEL_67; | |
1239 case 0xFu: | |
1240 if ( a3 == 1 | |
1241 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1242 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1243 || v3->HasEnchantedItemEquipped(23) | |
1244 || v14->WearsItem(520, 16) | |
1245 || v15->WearsItem(505, 3) | |
1246 || v16->WearsItem(530, 6)) ) | |
1247 goto LABEL_76; | |
1248 v26 = 0; | |
1249 v23 = 34; | |
1250 goto LABEL_81; | |
1251 case 0x10u: | |
1252 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1253 { | |
1254 LABEL_10: | |
1255 --pParty->pPartyBuffs[13].uPower; | |
1256 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1257 pParty->pPartyBuffs[13].Reset(); | |
1258 goto LABEL_76; | |
1259 } | |
1260 v28 = 0; | |
187 | 1261 v25 = SPEECH_35; |
0 | 1262 LABEL_67: |
187 | 1263 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1264 if ( v3->sHealth > 0 ) |
1265 v3->sHealth = 0; | |
1266 v13 = (char *)&v3->sMana; | |
1267 LABEL_70: | |
1268 if ( *(int *)v13 > 0 ) | |
1269 *(int *)v13 = 0; | |
1270 LABEL_82: | |
1271 v21 = 0; | |
1272 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1273 v31 = 0; | |
1274 v22 = 1; | |
1275 do | |
1276 { | |
1277 if ( pPlayers[v22]->CanAct() ) | |
1278 { | |
1279 ++v31; | |
1280 v21 = v22; | |
1281 } | |
1282 ++v22; | |
1283 } | |
1284 while ( v22 <= 4 ); | |
1285 if ( v30 == 2 ) | |
1286 { | |
1287 if ( v31 == 1 ) | |
187 | 1288 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1289 } |
1290 result = 1; | |
1291 break; | |
1292 case 0x11u: | |
135 | 1293 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1294 v3->Zombie() || !v3->Dead()) | |
0 | 1295 goto LABEL_76; |
1296 memset(v3, 0, 0xA0u); | |
1297 v3->sHealth = v3->GetMaxHealth(); | |
1298 v18 = 0; | |
1299 v3->field_1928 = v3->uFace; | |
1300 v19 = v3->uVoiceID; | |
1301 v3->sMana = 0; | |
1302 v3->field_1924 = v19; | |
1303 switch ( v19 ) | |
1304 { | |
1305 case 0: | |
1306 case 1: | |
1307 case 2: | |
1308 case 3: | |
1309 case 8: | |
1310 case 9: | |
1311 case 12: | |
1312 case 13: | |
1313 case 16: | |
1314 case 17: | |
1315 case 20: | |
1316 case 23: | |
1317 v18 = 0; | |
1318 break; | |
1319 case 4: | |
1320 case 5: | |
1321 case 6: | |
1322 case 7: | |
1323 case 10: | |
1324 case 11: | |
1325 case 14: | |
1326 case 15: | |
1327 case 18: | |
1328 case 19: | |
1329 case 21: | |
1330 case 24: | |
1331 v18 = 1; | |
1332 break; | |
1333 default: | |
1334 break; | |
1335 } | |
1336 v26 = 0; | |
1337 v20 = (v18 != 0) + 23; | |
187 | 1338 v23 = SPEECH_99; |
0 | 1339 v3->uFace = v20; |
1340 v3->uVoiceID = v20; | |
1341 LABEL_81: | |
187 | 1342 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1343 goto LABEL_82; |
1344 default: | |
1345 goto LABEL_82; | |
1346 } | |
1347 } | |
1348 return result; | |
1349 } | |
1350 | |
1351 //----- (00492528) -------------------------------------------------------- | |
1352 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1353 { | |
1354 unsigned int v3; // eax@1 | |
1355 Texture *v4; // esi@1 | |
1356 unsigned int v5; // ebx@1 | |
1357 signed int v6; // edi@5 | |
1358 int *v7; // ecx@6 | |
1359 signed int v8; // edx@7 | |
1360 int *v9; // eax@8 | |
1361 Player *v11; // [sp+Ch] [bp-4h]@1 | |
1362 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 | |
1363 | |
1364 v11 = this; | |
1365 v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
203 | 1366 v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0); |
0 | 1367 v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24); |
1368 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); | |
1369 if ( !areWeLoadingTexture ) | |
1370 { | |
1371 v4->Release(); | |
1372 pIcons_LOD->_40F9C5(); | |
1373 } | |
1374 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1375 { | |
1376 v6 = 0; | |
1377 if ( (signed int)uItemIDa <= 0 ) | |
1378 return 1; | |
1379 v7 = &v11->pInventoryIndices[uSlot]; | |
1380 while ( 1 ) | |
1381 { | |
1382 v8 = 0; | |
1383 if ( (signed int)v5 > 0 ) | |
1384 break; | |
1385 LABEL_11: | |
1386 ++v6; | |
1387 v7 += 14; | |
1388 if ( v6 >= (signed int)uItemIDa ) | |
1389 return 1; | |
1390 } | |
1391 v9 = v7; | |
1392 while ( !*v9 ) | |
1393 { | |
1394 ++v8; | |
1395 ++v9; | |
1396 if ( v8 >= (signed int)v5 ) | |
1397 goto LABEL_11; | |
1398 } | |
1399 } | |
1400 return 0; | |
1401 } | |
1402 // 506128: using guessed type int areWeLoadingTexture; | |
1403 | |
1404 //----- (004925E6) -------------------------------------------------------- | |
1405 unsigned int Player::FindFreeInventorySlot() | |
1406 { | |
1407 unsigned int result; // eax@1 | |
1408 ItemGen *v2; // ecx@1 | |
1409 | |
1410 result = 0; | |
1411 v2 = this->pInventoryItems; | |
1412 while ( v2->uItemID ) | |
1413 { | |
1414 ++result; | |
1415 ++v2; | |
1416 if ( (signed int)result >= 126 ) | |
1417 return -1; | |
1418 } | |
1419 return result; | |
1420 } | |
1421 | |
1422 //----- (00492600) -------------------------------------------------------- | |
1423 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1424 { | |
1425 signed int v3; // edx@1 | |
1426 ItemGen *v4; // eax@1 | |
1427 int result; // eax@8 | |
1428 unsigned int v6; // ebx@10 | |
1429 unsigned int v7; // eax@10 | |
1430 Texture *v8; // esi@10 | |
1431 void *v9; // esi@13 | |
1432 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1433 Player *v11; // [sp+4h] [bp-8h]@1 | |
1434 signed int v12; // [sp+8h] [bp-4h]@4 | |
1435 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1436 | |
1437 v11 = this; | |
1438 v3 = 0; | |
1439 v4 = this->pInventoryItems; | |
1440 while ( v4->uItemID ) | |
1441 { | |
1442 ++v3; | |
1443 ++v4; | |
1444 if ( v3 >= 126 ) | |
1445 { | |
1446 v12 = -1; | |
1447 goto LABEL_5; | |
1448 } | |
1449 } | |
1450 v12 = v3; | |
1451 LABEL_5: | |
1452 if ( v12 == -1 ) | |
1453 { | |
1454 if ( uActiveCharacter ) | |
201 | 1455 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1456 result = 0; |
1457 } | |
1458 else | |
1459 { | |
1460 v6 = uItemID; | |
1461 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1462 v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); | |
1463 v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
1464 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); | |
1465 if ( !areWeLoadingTexture ) | |
1466 { | |
1467 v8->Release(); | |
1468 pIcons_LOD->_40F9C5(); | |
1469 } | |
1470 if ( (signed int)uItemIDa > 0 ) | |
1471 { | |
1472 v9 = &v11->pInventoryIndices[uSlot]; | |
1473 do | |
1474 { | |
1475 if ( (signed int)v10 > 0 ) | |
1476 memset32(v9, -1 - uSlot, v10); | |
1477 v9 = (char *)v9 + 56; | |
1478 --uItemIDa; | |
1479 } | |
1480 while ( uItemIDa ); | |
1481 } | |
1482 result = v12 + 1; | |
1483 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1484 v11->pInventoryItems[v12].uItemID = v6; | |
1485 } | |
1486 return result; | |
1487 } | |
1488 // 506128: using guessed type int areWeLoadingTexture; | |
1489 | |
1490 //----- (00492700) -------------------------------------------------------- | |
1491 int Player::HasSkill(unsigned int uSkillType) | |
1492 { | |
1493 signed int result; // eax@3 | |
1494 | |
1495 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1496 { | |
1497 result = 1; | |
1498 } | |
1499 else | |
1500 { | |
1501 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); | |
1502 ShowStatusBarString(pTmpBuf, 2u); | |
1503 result = 0; | |
1504 } | |
1505 return result; | |
1506 } | |
1507 | |
1508 //----- (00492745) -------------------------------------------------------- | |
1509 int Player::WearItem(unsigned int uItemID) | |
1510 { | |
1511 signed int v2; // eax@1 | |
1512 ItemGen *v3; // edx@1 | |
1513 int v4; // edi@6 | |
1514 char *v5; // eax@6 | |
1515 char *v6; // esi@6 | |
1516 | |
1517 v2 = 0; | |
1518 v3 = this->pInventoryItems; | |
1519 while ( v3->uItemID ) | |
1520 { | |
1521 ++v2; | |
1522 ++v3; | |
1523 if ( v2 >= 126 ) | |
1524 { | |
1525 v2 = -1; | |
1526 break; | |
1527 } | |
1528 } | |
1529 if ( v2 != -1 ) | |
1530 { | |
1531 v4 = v2 + 1; | |
1532 v5 = (char *)this + 36 * v2; | |
1533 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; | |
1534 *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; | |
1535 *((int *)v5 + 133) = uItemID; | |
1536 v5[556] = *v6 + 1; | |
1537 } | |
1538 return 0; | |
1539 } | |
1540 | |
1541 //----- (004927A8) -------------------------------------------------------- | |
1542 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1543 { | |
1544 signed int v3; // ebx@2 | |
1545 signed int v4; // edi@3 | |
1546 unsigned int v5; // esi@3 | |
1547 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1548 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1549 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1550 | |
1551 thisa = this; | |
1552 if ( uSlot == -1 ) | |
1553 { | |
1554 v3 = 0; | |
1555 while ( 2 ) | |
1556 { | |
1557 v4 = 0; | |
1558 v5 = v3; | |
1559 do | |
1560 { | |
1561 if ( CanFitItem(v5, uItemID) ) | |
1562 { | |
1563 v8 = uItemID; | |
1564 v7 = v5; | |
1565 return CreateItemInInventory(v7, v8); | |
1566 } | |
1567 ++v4; | |
1568 v5 += 14; | |
1569 } | |
1570 while ( v4 < 9 ); | |
1571 ++v3; | |
1572 if ( v3 < 14 ) | |
1573 continue; | |
1574 break; | |
1575 } | |
1576 return 0; | |
1577 } | |
1578 if ( !CanFitItem(uSlot, uItemID) ) | |
1579 { | |
1580 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1581 return 0; | |
1582 } | |
1583 v8 = uItemID; | |
1584 v7 = uSlot; | |
1585 return CreateItemInInventory(v7, v8); | |
1586 } | |
1587 | |
1588 //----- (00492826) -------------------------------------------------------- | |
1589 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1590 { | |
1591 unsigned int v3; // ebx@1 | |
1592 unsigned int v4; // esi@3 | |
1593 signed int v5; // edi@3 | |
1594 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1595 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1596 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1597 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1598 | |
1599 thisa = this; | |
1600 v3 = Src->uItemID; | |
1601 pItemsTable->SetSpecialBonus(Src); | |
1602 if ( uSlot == -1 ) | |
1603 { | |
1604 uSlota = 0; | |
1605 while ( 2 ) | |
1606 { | |
1607 v4 = uSlota; | |
1608 v5 = 0; | |
1609 do | |
1610 { | |
1611 if ( CanFitItem(v4, v3) ) | |
1612 { | |
1613 v8 = Src; | |
1614 v7 = v4; | |
1615 return CreateItemInInventory2(v7, v8); | |
1616 } | |
1617 ++v5; | |
1618 v4 += 14; | |
1619 } | |
1620 while ( v5 < 14 ); | |
1621 ++uSlota; | |
1622 if ( uSlota < 9 ) | |
1623 continue; | |
1624 break; | |
1625 } | |
1626 return 0; | |
1627 } | |
1628 if ( !CanFitItem(uSlot, v3) ) | |
1629 return 0; | |
1630 v8 = Src; | |
1631 v7 = uSlot; | |
1632 return CreateItemInInventory2(v7, v8); | |
1633 } | |
1634 | |
1635 //----- (0049289C) -------------------------------------------------------- | |
1636 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1637 { | |
1638 signed int v3; // ebx@1 | |
1639 ItemGen *v4; // eax@1 | |
1640 int result; // eax@6 | |
1641 unsigned int v6; // eax@7 | |
1642 Texture *v7; // esi@7 | |
1643 unsigned int v8; // edx@9 | |
1644 void *v9; // esi@10 | |
1645 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1646 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1647 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1648 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1649 | |
1650 v12 = this; | |
1651 v3 = 0; | |
1652 v4 = this->pInventoryItems; | |
1653 while ( v4->uItemID ) | |
1654 { | |
1655 ++v3; | |
1656 ++v4; | |
1657 if ( v3 >= 126 ) | |
1658 { | |
1659 v3 = -1; | |
1660 break; | |
1661 } | |
1662 } | |
1663 if ( v3 == -1 ) | |
1664 { | |
1665 result = 0; | |
1666 } | |
1667 else | |
1668 { | |
1669 v6 = pIcons_LOD->LoadTexture( | |
1670 pItemsTable->pItems[Src->uItemID].pIconName, | |
1671 TEXTURE_16BIT_PALETTE); | |
1672 v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); | |
1673 v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); | |
1674 v11 = GetSizeInInventorySlots(v7->uTextureHeight); | |
1675 if ( !areWeLoadingTexture ) | |
1676 { | |
1677 v7->Release(); | |
1678 pIcons_LOD->_40F9C5(); | |
1679 } | |
1680 v8 = uSlot; | |
1681 if ( (signed int)v11 > 0 ) | |
1682 { | |
1683 uSlota = v11; | |
1684 v9 = &v12->pInventoryIndices[v8]; | |
1685 do | |
1686 { | |
1687 if ( (signed int)v10 > 0 ) | |
1688 memset32(v9, -1 - v8, v10); | |
1689 v9 = (char *)v9 + 56; | |
1690 --uSlota; | |
1691 } | |
1692 while ( uSlota ); | |
1693 } | |
1694 v12->pInventoryIndices[v8] = v3 + 1; | |
1695 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1696 result = v3 + 1; | |
1697 } | |
1698 return result; | |
1699 } | |
1700 // 506128: using guessed type int areWeLoadingTexture; | |
1701 | |
1702 //----- (0049298B) -------------------------------------------------------- | |
1703 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1704 { | |
1705 Player *v4; // ebx@1 | |
1706 unsigned int v5; // eax@1 | |
1707 Texture *v6; // esi@1 | |
1708 void *v7; // esi@4 | |
1709 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1710 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1711 | |
1712 v4 = this; | |
1713 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1714 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1715 v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1716 a2a = GetSizeInInventorySlots(v6->uTextureHeight); | |
1717 if ( !areWeLoadingTexture ) | |
1718 { | |
1719 v6->Release(); | |
1720 pIcons_LOD->_40F9C5(); | |
1721 } | |
1722 if ( (signed int)a2a > 0 ) | |
1723 { | |
1724 v7 = &v4->pInventoryIndices[a4]; | |
1725 do | |
1726 { | |
1727 if ( (signed int)v9 > 0 ) | |
1728 memset32(v7, -1 - a4, v9); | |
1729 v7 = (char *)v7 + 56; | |
1730 --a2a; | |
1731 } | |
1732 while ( a2a ); | |
1733 } | |
1734 v4->pInventoryIndices[a4] = a3 + 1; | |
1735 return 1; | |
1736 } | |
278 | 1737 |
0 | 1738 // 506128: using guessed type int areWeLoadingTexture; |
1739 | |
1740 //----- (00492A36) -------------------------------------------------------- | |
1741 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) | |
1742 { | |
1743 int *pIndices; // edi@1 | |
1744 ItemGen *v3; // ecx@1 | |
1745 unsigned int v4; // esi@1 | |
1746 unsigned int v5; // eax@1 | |
1747 Texture *v6; // esi@1 | |
1748 unsigned int result; // eax@1 | |
1749 unsigned int v8; // ebp@1 | |
1750 void *v9; // edx@4 | |
1751 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1752 | |
1753 pIndices = &this->pInventoryIndices[uSlot]; | |
198 | 1754 |
232 | 1755 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1756 v4 = v3->uItemID; |
1757 v3->Reset(); | |
1758 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); | |
1759 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1760 uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1761 result = GetSizeInInventorySlots(v6->uTextureHeight); | |
1762 v8 = result; | |
1763 if ( !areWeLoadingTexture ) | |
1764 { | |
1765 v6->Release(); | |
1766 result = pIcons_LOD->_40F9C5(); | |
1767 } | |
1768 if ( (signed int)v8 > 0 ) | |
1769 { | |
1770 v9 = pIndices; | |
1771 do | |
1772 { | |
1773 if ( (signed int)uSlota > 0 ) | |
1774 { | |
1775 result = 0; | |
1776 memset(v9, 0, 4 * uSlota); | |
1777 } | |
1778 v9 = (char *)v9 + 56; | |
1779 --v8; | |
1780 } | |
1781 while ( v8 ); | |
1782 } | |
1783 return result; | |
1784 } | |
1785 // 506128: using guessed type int areWeLoadingTexture; | |
1786 | |
436 | 1787 //identf |
0 | 1788 //----- (00490EEE) -------------------------------------------------------- |
1789 int Player::_490EEE(ItemGen *pItem, int a3, int a4, int a5) | |
1790 { | |
1791 int v5; // eax@1 | |
1792 int result; // eax@1 | |
1793 unsigned int v7; // edx@1 | |
1794 unsigned int v8; // ecx@1 | |
1795 signed int v9; // esi@1 | |
1796 char v10; // zf@14 | |
1797 unsigned __int8 v11; // zf@22 | |
1798 char v12; // sf@22 | |
1799 unsigned __int8 v13; // of@22 | |
1800 float *v14; // esi@26 | |
1801 float v15; // ST04_4@26 | |
1802 signed int v16; // eax@26 | |
1803 int v17; // edi@26 | |
1804 float v18; // ST04_4@30 | |
1805 signed int v19; // eax@30 | |
1806 float v20; // ST04_4@34 | |
1807 signed int v21; // eax@34 | |
1808 signed int v22; // eax@34 | |
1809 float v23; // ST04_4@37 | |
1810 signed int v24; // eax@37 | |
1811 int v26; // [sp+10h] [bp-8h]@1 | |
1812 Player *v27; // [sp+14h] [bp-4h]@1 | |
1813 | |
1814 v27 = this; | |
1815 LOBYTE(v5) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1816 v26 = v5; | |
1817 result = 4; | |
1818 v7 = pItem->uItemID; | |
1819 v8 = pItem->uItemID; | |
1820 v9 = pItemsTable->pItems[v8].uEquipType; | |
1821 if ( (a3 != 4 || (signed int)v7 < 740 || (signed int)v7 > 771) | |
1822 && ((signed int)v7 >= 600 || (signed int)v7 >= 529 && (signed int)v7 <= 599) ) | |
1823 return 5; | |
1824 if ( a3 == 1 ) | |
1825 { | |
1826 v13 = __OFSUB__(v9, 2); | |
1827 v11 = v9 == 2; | |
1828 v12 = v9 - 2 < 0; | |
1829 goto LABEL_24; | |
1830 } | |
1831 if ( a3 == 2 ) | |
1832 { | |
1833 if ( v9 < 3 ) | |
1834 return result; | |
1835 v13 = __OFSUB__(v9, 9); | |
1836 v11 = v9 == 9; | |
1837 v12 = v9 - 9 < 0; | |
1838 LABEL_24: | |
1839 if ( !((unsigned __int8)(v12 ^ v13) | v11) ) | |
1840 return result; | |
1841 goto LABEL_16; | |
1842 } | |
1843 if ( a3 == 3 ) | |
1844 { | |
1845 if ( pItemsTable->pItems[v8].uSkillType == 38 ) | |
1846 goto LABEL_16; | |
1847 v10 = v9 == 16; | |
1848 goto LABEL_15; | |
1849 } | |
1850 if ( a3 != 4 ) | |
1851 goto LABEL_26; | |
1852 if ( v9 < 13 ) | |
1853 return result; | |
1854 if ( v9 > 14 ) | |
1855 { | |
1856 v10 = v9 == 17; | |
1857 LABEL_15: | |
1858 if ( !v10 ) | |
1859 return result; | |
1860 } | |
1861 LABEL_16: | |
315 | 1862 if (pItem->Stolen()) |
0 | 1863 return 6; |
1864 LABEL_26: | |
1865 //v14 = &p2DEvents_minus1__20[13 * a4]; | |
1866 v14 = &p2DEvents[a4 - 1].fPriceMultiplier; | |
1867 v15 = *v14; | |
1868 v16 = pItem->GetValue(); | |
1869 v17 = _4B8142(v16, v15); | |
1870 if ( a5 == 3 ) | |
1871 { | |
1872 v23 = *v14; | |
1873 v24 = pItem->GetValue(); | |
1874 v17 = v27->_4B8102(v24, v23); | |
315 | 1875 if (!pItem->Broken()) |
0 | 1876 goto LABEL_39; |
1877 goto LABEL_38; | |
1878 } | |
1879 if ( a5 == 4 ) | |
1880 { | |
1881 v22 = v27->_4B8179(*v14); | |
1882 goto LABEL_35; | |
1883 } | |
1884 if ( a5 == 5 ) | |
1885 { | |
1886 v20 = *v14; | |
1887 v21 = pItem->GetValue(); | |
1888 v22 = v27->_4B81C3(v21, v20); | |
1889 LABEL_35: | |
1890 v17 = v22; | |
1891 goto LABEL_39; | |
1892 } | |
1893 if ( a5 != 6 ) | |
1894 goto LABEL_39; | |
1895 v18 = *v14; | |
1896 v19 = pItem->GetValue(); | |
1897 v17 = v27->_4B8102(v19, v18) / 2; | |
315 | 1898 if (pItem->Broken()) |
0 | 1899 v17 = 1; |
1900 if ( v17 >= 1 ) | |
1901 goto LABEL_39; | |
1902 LABEL_38: | |
1903 v17 = 1; | |
1904 LABEL_39: | |
1905 if ( v26 ) | |
1906 result = (v17 == pItem->GetValue()) + 2; | |
1907 else | |
1908 result = 1; | |
1909 return result; | |
1910 } | |
1911 | |
1912 //----- (0049107D) -------------------------------------------------------- | |
1913 int Player::GetBodybuilding() | |
1914 { | |
1915 char v1; // al@1 | |
1916 int v2; // ecx@1 | |
1917 int v4; // eax@3 | |
1918 signed int v6; // [sp-4h] [bp-4h]@2 | |
1919 | |
1920 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1921 v2 = v1 & 0x3F; | |
1922 if ( v1 & 0x100 ) | |
1923 { | |
1924 v6 = 5; | |
1925 } | |
1926 else | |
1927 { | |
1928 if ( v1 >= 0 ) | |
1929 { | |
1930 v4 = ((v1 & 0x40) != 0) + 1; | |
1931 return v2 * v4; | |
1932 } | |
1933 v6 = 3; | |
1934 } | |
1935 v4 = v6; | |
1936 return v2 * v4; | |
1937 } | |
1938 | |
1939 //----- (004910A8) -------------------------------------------------------- | |
1940 int Player::GetMediatation() | |
1941 { | |
1942 char v1; // al@1 | |
1943 int v2; // ecx@1 | |
1944 int v4; // eax@3 | |
1945 signed int v6; // [sp-4h] [bp-4h]@2 | |
1946 | |
1947 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1948 v2 = v1 & 0x3F; | |
1949 if ( v1 & 0x100 ) | |
1950 { | |
1951 v6 = 5; | |
1952 } | |
1953 else | |
1954 { | |
1955 if ( v1 >= 0 ) | |
1956 { | |
1957 v4 = ((v1 & 0x40) != 0) + 1; | |
1958 return v2 * v4; | |
1959 } | |
1960 v6 = 3; | |
1961 } | |
1962 v4 = v6; | |
1963 return v2 * v4; | |
1964 } | |
1965 | |
1966 //----- (004910D3) -------------------------------------------------------- | |
1967 int Player::CanIdentify(ItemGen *pItem) | |
1968 { | |
1969 unsigned __int16 v2; // ax@1 | |
1970 unsigned __int16 v3; // bx@1 | |
1971 int uSkillMult; // eax@3 | |
1972 int v5; // edi@7 | |
1973 signed int v6; // ebp@7 | |
1974 char *v7; // esi@7 | |
1975 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
1976 | |
179 | 1977 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1978 v3 = v2; |
179 | 1979 if ( v2 & 1 ) |
0 | 1980 { |
1981 uSkillMultiplier = 5; | |
1982 } | |
1983 else | |
1984 { | |
1985 if ( (v2 & 0x80u) == 0 ) | |
1986 { | |
1987 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1988 v5 = uSkillMult * (v3 & 0x3F); |
1989 v6 = 0; | |
1990 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
1991 if ( CheckHiredNPCSpeciality(4) ) | |
1992 { | |
1993 v6 = 1; | |
1994 return v6; | |
1995 } | |
1996 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1997 v6 = 1; | |
1998 if ( v5 >= (unsigned __int8)v7[46] ) | |
1999 v6 = 1; | |
2000 return v6; | |
0 | 2001 } |
2002 uSkillMultiplier = 3; | |
2003 } | |
2004 uSkillMult = uSkillMultiplier; | |
2005 v5 = uSkillMult * (v3 & 0x3F); | |
2006 v6 = 0; | |
2007 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
179 | 2008 if ( CheckHiredNPCSpeciality(4) ) |
2009 { | |
2010 v6 = 1; | |
2011 return v6; | |
2012 } | |
0 | 2013 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2014 v6 = 1; | |
2015 if ( v5 >= (unsigned __int8)v7[46] ) | |
2016 v6 = 1; | |
2017 return v6; | |
2018 } | |
2019 | |
2020 //----- (00491151) -------------------------------------------------------- | |
2021 int Player::CanRepair(ItemGen *a2) | |
2022 { | |
2023 unsigned __int16 v2; // ax@1 | |
2024 unsigned __int16 v3; // bx@1 | |
2025 int v4; // eax@3 | |
2026 int v5; // edi@7 | |
2027 signed int v6; // ebp@7 | |
2028 char v8; // al@10 | |
2029 signed int v10; // [sp-4h] [bp-14h]@2 | |
2030 | |
2031 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); | |
2032 v3 = v2; | |
2033 if ( HIBYTE(v2) & 1 ) | |
2034 { | |
2035 v10 = 5; | |
2036 } | |
2037 else | |
2038 { | |
2039 if ( (v2 & 0x80u) == 0 ) | |
2040 { | |
2041 v4 = ((v2 & 0x40) != 0) + 1; | |
2042 goto LABEL_7; | |
2043 } | |
2044 v10 = 3; | |
2045 } | |
2046 v4 = v10; | |
2047 LABEL_7: | |
2048 v5 = v4 * (v3 & 0x3F); | |
2049 v6 = 0; | |
2050 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2051 if (CheckHiredNPCSpeciality(1) && v7->uEquipType <= 2 || | |
2052 CheckHiredNPCSpeciality(2) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2053 CheckHiredNPCSpeciality(3) && v7->uEquipType >= 9 ) | |
2054 return true; | |
2055 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2056 return true; | |
2057 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2058 { | |
2059 __debugbreak(); // really odd | |
2060 return true; | |
2061 } | |
2062 return false; | |
2063 } | |
2064 | |
2065 //----- (004911F3) -------------------------------------------------------- | |
2066 int Player::GetMerchant() | |
2067 { | |
2068 Player *v1; // edi@1 | |
2069 unsigned __int16 v2; // ax@1 | |
2070 unsigned __int16 v3; // bx@1 | |
2071 int v4; // esi@1 | |
2072 int v5; // edi@1 | |
2073 int v7; // eax@3 | |
2074 int v8; // ecx@7 | |
2075 signed int v9; // [sp-4h] [bp-10h]@6 | |
2076 | |
2077 v1 = this; | |
2078 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
2079 v3 = v1->pActiveSkills[22]; | |
2080 v4 = v2 & 0x3F; | |
2081 v5 = v1->pActiveSkills[22] & 0x3F; | |
2082 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2083 return 10000; | |
2084 v7 = GetPartyReputation(); | |
2085 if ( !v4 ) | |
2086 return -v7; | |
2087 if ( HIBYTE(v3) & 1 ) | |
2088 { | |
2089 v9 = 5; | |
2090 } | |
2091 else | |
2092 { | |
2093 if ( (v3 & 0x80u) == 0 ) | |
2094 { | |
2095 v8 = ((v3 & 0x40) != 0) + 1; | |
2096 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2097 } | |
2098 v9 = 3; | |
2099 } | |
2100 v8 = v9; | |
2101 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2102 } | |
2103 | |
2104 //----- (0049125A) -------------------------------------------------------- | |
2105 int Player::GetPerception() | |
2106 { | |
2107 Player *v1; // edi@1 | |
2108 unsigned __int16 v2; // ax@1 | |
2109 unsigned __int16 v3; // bx@1 | |
2110 int v4; // esi@1 | |
2111 int v5; // edi@1 | |
2112 int v7; // eax@5 | |
2113 signed int v8; // [sp-4h] [bp-10h]@4 | |
2114 | |
2115 v1 = this; | |
2116 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); | |
2117 v3 = v1->pActiveSkills[26]; | |
2118 v4 = v2 & 0x3F; | |
2119 v5 = v1->pActiveSkills[26] & 0x3F; | |
2120 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2121 return 10000; | |
2122 if ( HIBYTE(v3) & 1 ) | |
2123 { | |
2124 v8 = 5; | |
2125 } | |
2126 else | |
2127 { | |
2128 if ( (v3 & 0x80u) == 0 ) | |
2129 { | |
2130 v7 = ((v3 & 0x40) != 0) + 1; | |
2131 return v4 + v5 * (v7 - 1); | |
2132 } | |
2133 v8 = 3; | |
2134 } | |
2135 v7 = v8; | |
2136 return v4 + v5 * (v7 - 1); | |
2137 } | |
2138 | |
2139 //----- (004912B0) -------------------------------------------------------- | |
2140 int Player::GetDisarmTrap() | |
2141 { | |
2142 Player *v1; // ebp@1 | |
2143 unsigned __int16 v2; // ax@1 | |
2144 unsigned __int16 v3; // bx@1 | |
2145 int v4; // esi@1 | |
2146 int v5; // edi@1 | |
2147 int v7; // eax@7 | |
2148 signed int v8; // [sp-4h] [bp-14h]@6 | |
2149 | |
2150 v1 = this; | |
2151 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2152 v3 = v1->pActiveSkills[29]; | |
2153 v4 = v2 & 0x3F; | |
2154 v5 = v1->pActiveSkills[29] & 0x3F; | |
2155 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2156 return 10000; | |
2157 if ( HasEnchantedItemEquipped(35) ) | |
2158 v4 *= 2; | |
2159 if ( HIBYTE(v3) & 1 ) | |
2160 { | |
2161 v8 = 5; | |
2162 } | |
2163 else | |
2164 { | |
2165 if ( (v3 & 0x80u) == 0 ) | |
2166 { | |
2167 v7 = ((v3 & 0x40) != 0) + 1; | |
2168 return v4 + v5 * (v7 - 1); | |
2169 } | |
2170 v8 = 3; | |
2171 } | |
2172 v7 = v8; | |
2173 return v4 + v5 * (v7 - 1); | |
2174 } | |
2175 | |
2176 //----- (00491317) -------------------------------------------------------- | |
2177 char Player::GetLearningPercent() | |
2178 { | |
2179 Player *v1; // esi@1 | |
2180 int v2; // eax@1 | |
2181 unsigned __int16 v3; // bx@1 | |
2182 int v4; // ecx@1 | |
2183 int v5; // eax@4 | |
2184 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2185 | |
2186 v1 = this; | |
2187 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2188 v3 = v1->pActiveSkills[36]; | |
2189 v4 = v2 & 0x3F; | |
2190 if ( v2 ) | |
2191 { | |
2192 if ( HIBYTE(v3) & 1 ) | |
2193 { | |
2194 v7 = 5; | |
2195 } | |
2196 else | |
2197 { | |
2198 if ( (v3 & 0x80u) == 0 ) | |
2199 { | |
2200 v5 = ((v3 & 0x40) != 0) + 1; | |
2201 goto LABEL_8; | |
2202 } | |
2203 v7 = 3; | |
2204 } | |
2205 v5 = v7; | |
2206 LABEL_8: | |
2207 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2208 } | |
2209 return v2; | |
2210 } | |
2211 | |
2212 //----- (0048C6AF) -------------------------------------------------------- | |
2213 Player::Player() | |
2214 { | |
2215 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2216 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2217 for (uint i = 0; i < 126; ++i) | |
2218 pInventoryItems[i].Reset(); | |
2219 for (uint i = 0; i < 12; ++i) | |
2220 pEquippedItems[i].Reset(); | |
2221 | |
2222 | |
2223 for (uint i = 0; i < 24; ++i) | |
2224 { | |
2225 pPlayerBuffs[i].uSkill = 0; | |
2226 pPlayerBuffs[i].uSkill = 0; | |
2227 pPlayerBuffs[i].uPower = 0; | |
2228 pPlayerBuffs[i].uExpireTime = 0; | |
2229 pPlayerBuffs[i].uCaster = 0; | |
2230 pPlayerBuffs[i].uFlags = 0; | |
2231 } | |
2232 | |
2233 pName[0] = 0; | |
2234 uFace = 0; | |
2235 uVoiceID = 0; | |
2236 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2237 | |
2238 field_BB = 0; | |
2239 | |
2240 uMight = uMightBonus = 0; | |
2241 uIntelligence = uIntelligenceBonus = 0; | |
2242 uWillpower = uWillpowerBonus = 0; | |
2243 uEndurance = uEnduranceBonus = 0; | |
2244 uSpeed = uSpeedBonus = 0; | |
2245 uAccuracy = uAccuracyBonus = 0; | |
2246 uLuck = uLuckBonus = 0; | |
2247 uLevel = sLevelModifier = 0; | |
2248 sAgeModifier = 0; | |
2249 | |
2250 memset(field_1F5, 0, 30); | |
2251 | |
2252 sResFireBase = sResFireBonus = 0; | |
2253 sResAirBase = sResAirBonus = 0; | |
2254 sResWaterBase = sResWaterBonus = 0; | |
2255 sResEarthBase = sResEarthBonus = 0; | |
2256 sResMagicBase = sResMagicBonus = 0; | |
2257 sResSpiritBase = sResSpiritBonus = 0; | |
2258 sResMindBase = sResMindBonus = 0; | |
2259 sResBodyBase = sResBodyBonus = 0; | |
2260 sResLightBase = sResLightBonus = 0; | |
2261 sResDarkBase = sResDarkBonus = 0; | |
2262 | |
2263 uTimeToRecovery = 0; | |
2264 | |
2265 uSkillPoints = 0; | |
2266 | |
2267 sHealth = 0; | |
2268 uFullHealthBonus = 0; | |
2269 _health_related = 0; | |
2270 | |
2271 sMana = 0; | |
2272 uFullManaBonus = 0; | |
2273 _mana_related = 0; | |
2274 | |
2275 uQuickSpell = 0; | |
2276 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2277 | |
2278 _some_attack_bonus = 0; | |
2279 field_1A91 = 0; | |
2280 _melee_dmg_bonus = 0; | |
2281 field_1A93 = 0; | |
2282 _ranged_atk_bonus = 0; | |
2283 field_1A95 = 0; | |
2284 _ranged_dmg_bonus = 0; | |
2285 field_1A97 = 0; | |
2286 | |
130 | 2287 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2288 uExpressionTimePassed = 0; |
2289 uExpressionTimeLength = 0; | |
2290 | |
2291 uNumDivineInterventionCastsThisDay = 0; | |
2292 uNumArmageddonCasts = 0; | |
2293 uNumFireSpikeCasts = 0; | |
2294 | |
2295 memset(field_1988, 0, 49 * sizeof(int)); | |
2296 memset(field_1A50, 0, 64 * sizeof(char)); | |
2297 | |
2298 field_E0 = 0; | |
2299 field_E4 = 0; | |
2300 field_E8 = 0; | |
2301 field_EC = 0; | |
2302 field_F0 = 0; | |
2303 field_F4 = 0; | |
2304 field_F8 = 0; | |
2305 field_FC = 0; | |
2306 field_100 = 0; | |
2307 field_104 = 0; | |
198 | 2308 |
2309 lastOpenedSpellbookPage = 0; | |
0 | 2310 } |
2311 | |
2312 //----- (0048C6F6) -------------------------------------------------------- | |
2313 bool Party::AddItem(ItemGen *pItem) | |
2314 { | |
2315 unsigned int v2; // eax@1 | |
2316 unsigned int v3; // ecx@4 | |
2317 signed int v4; // edx@4 | |
2318 char *v5; // eax@8 | |
2319 unsigned int v6; // eax@10 | |
2320 Texture *v7; // ebx@10 | |
2321 signed int v8; // esi@10 | |
2322 Player *v9; // edi@11 | |
2323 int v10; // eax@11 | |
2324 bool result; // eax@15 | |
2325 std::string v12; // [sp-18h] [bp-40h]@9 | |
2326 const char *v13; // [sp-8h] [bp-30h]@9 | |
2327 int v14; // [sp-4h] [bp-2Ch]@9 | |
188 | 2328 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2329 //int v16; // [sp+10h] [bp-18h]@3 | |
2330 //int v17; // [sp+14h] [bp-14h]@3 | |
2331 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2332 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2333 Party *v20; // [sp+20h] [bp-8h]@1 | |
2334 int v21; // [sp+24h] [bp-4h]@10 | |
2335 | |
2336 auto thos = this; | |
2337 | |
2338 v20 = thos; | |
2339 v2 = pItem->uItemID; | |
222 | 2340 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2341 pItem->SetIdentified(); |
188 | 2342 ///v15 = 0; |
2343 //v16 = 1; | |
2344 //v18 = 3; | |
2345 //v17 = 2; | |
0 | 2346 if ( uActiveCharacter ) |
2347 { | |
2348 v3 = uActiveCharacter - 1; | |
2349 v4 = 0; | |
2350 do | |
2351 { | |
188 | 2352 v15[v4++] = v3++; |
0 | 2353 if ( (signed int)v3 >= 4 ) |
2354 v3 = 0; | |
2355 } | |
2356 while ( v4 < 4 ); | |
2357 } | |
2358 v5 = pItemsTable->pItems[v2].pIconName; | |
2359 if ( v5 ) | |
2360 { | |
2361 v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); | |
188 | 2362 v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); |
0 | 2363 v21 = areWeLoadingTexture; |
2364 v8 = 0; | |
2365 while ( 1 ) | |
2366 { | |
188 | 2367 v9 = &v20->pPlayers[v15[v8]]; |
2368 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2369 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2370 if ( v10 ) | |
2371 break; | |
2372 ++v8; | |
2373 if ( v8 >= 4 ) | |
2374 { | |
2375 if ( !v21 ) | |
2376 { | |
2377 v7->Release(); | |
2378 pIcons_LOD->_40F9C5(); | |
2379 } | |
2380 goto LABEL_15; | |
2381 } | |
2382 } | |
232 | 2383 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2384 pItem->Reset(); |
2385 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2386 v19->PlaySound(SPEECH_60, 0); |
0 | 2387 if ( !v21 ) |
2388 { | |
2389 v7->Release(); | |
2390 pIcons_LOD->_40F9C5(); | |
2391 } | |
2392 result = 1; | |
2393 } | |
2394 else | |
2395 { | |
2396 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2397 LABEL_15: | |
2398 result = 0; | |
2399 } | |
2400 return result; | |
2401 } | |
2402 // 506128: using guessed type int areWeLoadingTexture; | |
2403 | |
2404 //----- (0048C855) -------------------------------------------------------- | |
2405 int Player::GetBaseStrength() | |
2406 { | |
2407 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2408 } | |
2409 | |
2410 //----- (0048C86C) -------------------------------------------------------- | |
2411 int Player::GetBaseIntelligence() | |
2412 { | |
2413 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2414 } | |
2415 | |
2416 //----- (0048C883) -------------------------------------------------------- | |
2417 int Player::GetBaseWillpower() | |
2418 { | |
2419 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2420 } | |
2421 | |
2422 //----- (0048C89A) -------------------------------------------------------- | |
2423 int Player::GetBaseEndurance() | |
2424 { | |
2425 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2426 } | |
2427 | |
2428 //----- (0048C8B1) -------------------------------------------------------- | |
2429 int Player::GetBaseAccuracy() | |
2430 { | |
2431 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2432 } | |
2433 | |
2434 //----- (0048C8C8) -------------------------------------------------------- | |
2435 int Player::GetBaseSpeed() | |
2436 { | |
2437 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2438 } | |
2439 | |
2440 //----- (0048C8DF) -------------------------------------------------------- | |
2441 int Player::GetBaseLuck() | |
2442 { | |
2443 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2444 } | |
2445 | |
2446 //----- (0048C8F6) -------------------------------------------------------- | |
2447 int Player::GetBaseLevel() | |
2448 { | |
2449 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2450 } | |
2451 | |
2452 //----- (0048C90D) -------------------------------------------------------- | |
2453 int Player::GetActualLevel() | |
2454 { | |
2455 return uLevel + sLevelModifier + | |
2456 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2457 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2458 } | |
2459 | |
2460 //----- (0048C93C) -------------------------------------------------------- | |
2461 int Player::GetActualMight() | |
2462 { | |
2463 Player *v1; // esi@1 | |
2464 unsigned int v2; // eax@1 | |
2465 signed int v3; // ecx@1 | |
2466 signed int v4; // ebx@4 | |
2467 int v5; // edi@5 | |
2468 int v6; // ST14_4@5 | |
2469 | |
2470 v1 = this; | |
2471 v2 = this->sAgeModifier + GetBaseAge(); | |
2472 v3 = 0; | |
2473 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2474 { | |
2475 ++v3; | |
2476 if ( v3 >= 4 ) | |
2477 { | |
2478 v4 = 100; | |
2479 goto LABEL_5; | |
2480 } | |
2481 } | |
2482 v4 = pAgeingStrengthMultiplier[v3]; | |
2483 LABEL_5: | |
2484 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2485 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2486 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2487 } | |
2488 | |
2489 //----- (0048C9C2) -------------------------------------------------------- | |
2490 int Player::GetActualIntelligence() | |
2491 { | |
2492 Player *v1; // esi@1 | |
2493 unsigned int sAge; // eax@1 | |
2494 signed int uAgeLevel; // ecx@1 | |
2495 signed int v4; // ebx@4 | |
2496 int v5; // edi@5 | |
2497 int v6; // ebp@5 | |
2498 | |
2499 v1 = this; | |
2500 sAge = this->sAgeModifier + GetBaseAge(); | |
2501 uAgeLevel = 0; | |
2502 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2503 { | |
2504 ++uAgeLevel; | |
2505 if ( uAgeLevel >= 4 ) | |
2506 { | |
2507 v4 = 100; | |
2508 goto LABEL_5; | |
2509 } | |
2510 } | |
2511 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2512 LABEL_5: | |
2513 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2514 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2515 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2516 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2517 + v6 | |
2518 + v1->uIntelligenceBonus; | |
2519 } | |
2520 | |
2521 //----- (0048CA3F) -------------------------------------------------------- | |
2522 int Player::GetActualWillpower() | |
2523 { | |
2524 int v5; // edi@5 | |
2525 | |
2526 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2527 uint uAgeingMultiplier = 100; | |
2528 for (uint i = 0; i < 4; ++i) | |
2529 if (uActualAge >= pAgeingTable[i]) | |
2530 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2531 else break; | |
2532 | |
2533 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2534 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2535 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2536 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2537 + uWillpowerBonus; | |
2538 } | |
2539 | |
2540 //----- (0048CABC) -------------------------------------------------------- | |
2541 int Player::GetActualEndurance() | |
2542 { | |
2543 int v6; // ebp@5 | |
2544 | |
2545 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2546 uint uAgeingMultiplier = 100; | |
2547 for (uint i = 0; i < 4; ++i) | |
2548 if (uActualAge >= pAgeingTable[i]) | |
2549 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2550 else break; | |
2551 | |
2552 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2553 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2554 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2555 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2556 + uItemBonus | |
2557 + uEnduranceBonus; | |
2558 } | |
2559 | |
2560 //----- (0048CB39) -------------------------------------------------------- | |
2561 int Player::GetActualAccuracy() | |
2562 { | |
2563 Player *v1; // esi@1 | |
2564 unsigned int v2; // eax@1 | |
2565 signed int v3; // ecx@1 | |
2566 signed int v4; // ebx@4 | |
2567 int v5; // edi@5 | |
2568 int v6; // ebp@5 | |
2569 | |
2570 v1 = this; | |
2571 v2 = this->sAgeModifier + GetBaseAge(); | |
2572 v3 = 0; | |
2573 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2574 { | |
2575 ++v3; | |
2576 if ( v3 >= 4 ) | |
2577 { | |
2578 v4 = 100; | |
2579 goto LABEL_5; | |
2580 } | |
2581 } | |
2582 v4 = pAgeingAccuracyMultiplier[v3]; | |
2583 LABEL_5: | |
2584 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2585 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2586 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2587 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2588 + v6 | |
2589 + v1->uAccuracyBonus; | |
2590 } | |
2591 | |
2592 //----- (0048CBB6) -------------------------------------------------------- | |
2593 int Player::GetActualSpeed() | |
2594 { | |
2595 Player *v1; // esi@1 | |
2596 unsigned int v2; // eax@1 | |
2597 signed int v3; // ecx@1 | |
2598 signed int v4; // ebx@4 | |
2599 int v5; // edi@5 | |
2600 int v6; // ebp@5 | |
2601 | |
2602 v1 = this; | |
2603 v2 = this->sAgeModifier + GetBaseAge(); | |
2604 v3 = 0; | |
2605 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2606 { | |
2607 ++v3; | |
2608 if ( v3 >= 4 ) | |
2609 { | |
2610 v4 = 100; | |
2611 goto LABEL_5; | |
2612 } | |
2613 } | |
2614 v4 = pAgeingSpeedMultiplier[v3]; | |
2615 LABEL_5: | |
2616 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2617 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2618 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2619 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2620 + v6 | |
2621 + v1->uSpeedBonus; | |
2622 } | |
2623 | |
2624 //----- (0048CC33) -------------------------------------------------------- | |
2625 int Player::GetActualLuck() | |
2626 { | |
2627 Player *v1; // esi@1 | |
2628 unsigned int v2; // eax@7 | |
2629 signed int v3; // ecx@7 | |
2630 signed int v4; // ebx@10 | |
2631 int v5; // edi@11 | |
2632 int v6; // ebp@11 | |
2633 signed int v8; // [sp+10h] [bp-4h]@1 | |
2634 | |
2635 v8 = 0; | |
2636 v1 = this; | |
2637 if ( CheckHiredNPCSpeciality(0x1Bu) ) | |
2638 v8 = 5; | |
2639 if ( CheckHiredNPCSpeciality(0x1Cu) ) | |
2640 v8 += 20; | |
2641 if ( CheckHiredNPCSpeciality(0x2Fu) ) | |
2642 v8 += 10; | |
2643 v2 = v1->sAgeModifier + GetBaseAge(); | |
2644 v3 = 0; | |
2645 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2646 { | |
2647 ++v3; | |
2648 if ( v3 >= 4 ) | |
2649 { | |
2650 v4 = 100; | |
2651 goto LABEL_11; | |
2652 } | |
2653 } | |
2654 v4 = pAgeingLuckMultiplier[v3]; | |
2655 LABEL_11: | |
2656 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2657 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2658 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2659 + v6 | |
2660 + v8 | |
2661 + v5 * v4 * v1->uLuck / 100 / 100 | |
2662 + v1->uLuckBonus; | |
2663 } | |
2664 | |
2665 //----- (0048CCF5) -------------------------------------------------------- | |
2666 int Player::GetActualAttack(int a2) | |
2667 { | |
2668 Player *v2; // esi@1 | |
2669 int v3; // eax@1 | |
2670 int v4; // edi@1 | |
2671 int v5; // ebx@1 | |
2672 int v6; // ebp@1 | |
2673 | |
2674 v2 = this; | |
2675 v3 = GetActualAccuracy(); | |
2676 v4 = _48EA1B_get_static_effect(v3); | |
2677 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2678 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2679 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2680 } | |
2681 | |
2682 //----- (0048CD45) -------------------------------------------------------- | |
2683 int Player::GetMeleeDamageMinimal() | |
2684 { | |
2685 Player *v1; // edi@1 | |
2686 int v2; // eax@1 | |
2687 int v3; // esi@1 | |
2688 int v4; // esi@1 | |
2689 int v5; // esi@1 | |
2690 int v6; // esi@1 | |
2691 signed int result; // eax@1 | |
2692 | |
2693 v1 = this; | |
2694 v2 = GetActualMight(); | |
2695 v3 = _48EA1B_get_static_effect(v2); | |
2696 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2697 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2698 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2699 result = 1; | |
2700 if ( v6 >= 1 ) | |
2701 result = v6; | |
2702 return result; | |
2703 } | |
2704 | |
2705 //----- (0048CD90) -------------------------------------------------------- | |
2706 int Player::GetMeleeDamageMaximal() | |
2707 { | |
2708 Player *v1; // edi@1 | |
2709 int v2; // eax@1 | |
2710 int v3; // esi@1 | |
2711 int v4; // esi@1 | |
2712 int v5; // esi@1 | |
2713 int v6; // esi@1 | |
2714 signed int result; // eax@1 | |
2715 | |
2716 v1 = this; | |
2717 v2 = GetActualMight(); | |
2718 v3 = _48EA1B_get_static_effect(v2); | |
2719 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2720 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2721 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2722 result = 1; | |
2723 if ( v6 >= 1 ) | |
2724 result = v6; | |
2725 return result; | |
2726 } | |
2727 | |
2728 //----- (0048CDDB) -------------------------------------------------------- | |
2729 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2730 { | |
2731 int v4; // esi@1 | |
2732 Player *v5; // edi@1 | |
2733 ItemGen *v6; // ebx@4 | |
2734 unsigned int v7; // ebp@4 | |
2735 unsigned int v8; // esi@4 | |
2736 int v9; // eax@4 | |
2737 int v10; // eax@9 | |
2738 char v11; // zf@9 | |
2739 int v12; // esi@10 | |
2740 int v13; // eax@11 | |
2741 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2742 ItemGen *v15; // ebx@35 | |
2743 unsigned int v16; // ebp@35 | |
2744 unsigned int v17; // esi@35 | |
2745 int v18; // edx@38 | |
2746 int v19; // eax@40 | |
2747 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2748 int v21; // esi@62 | |
2749 int v22; // eax@63 | |
2750 int v23; // ebx@63 | |
2751 int v24; // ebx@63 | |
2752 signed int result; // eax@64 | |
2753 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2754 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2755 int v28; // [sp+10h] [bp-10h]@1 | |
2756 int v29; // [sp+10h] [bp-10h]@33 | |
2757 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2758 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2759 int v32; // [sp+18h] [bp-8h]@1 | |
2760 int v33; // [sp+18h] [bp-8h]@8 | |
2761 int v34; // [sp+1Ch] [bp-4h]@1 | |
2762 int v35; // [sp+28h] [bp+8h]@37 | |
2763 | |
2764 v4 = 0; | |
2765 v5 = this; | |
2766 v34 = 0; | |
2767 v32 = 0; | |
2768 v28 = 0; | |
2769 if ( IsUnarmed() == 1 ) | |
2770 { | |
2771 v32 = rand() % 3 + 1; | |
2772 LABEL_61: | |
2773 v34 = v4; | |
2774 goto LABEL_62; | |
2775 } | |
2776 if ( HasItemEquipped(EQUIP_TWO_HANDED) ) | |
2777 { | |
232 | 2778 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2779 v7 = v6->uItemID; |
2780 v8 = v6->uItemID; | |
2781 v9 = pItemsTable->pItems[v8].uDamageDice; | |
2782 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) | |
2783 ++v9; | |
2784 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2785 if ( v9 > 0 ) | |
2786 { | |
2787 v33 = v9; | |
2788 do | |
2789 { | |
2790 v10 = rand(); | |
2791 v11 = v33-- == 1; | |
2792 v28 += v10 % v30 + 1; | |
2793 } | |
2794 while ( !v11 ); | |
2795 } | |
2796 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2797 if ( !uTargetActorID ) | |
2798 goto LABEL_28; | |
377 | 2799 v13 = v6->uSpecEnchantmentType; |
0 | 2800 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2801 { | |
2802 v14 = (MONSTER_SUPERTYPE)1; | |
2803 } | |
2804 else | |
2805 { | |
2806 if ( v13 == 39 ) | |
2807 { | |
2808 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2809 } | |
2810 else | |
2811 { | |
2812 if ( v13 == 40 ) | |
2813 { | |
2814 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2815 } | |
2816 else | |
2817 { | |
2818 if ( v13 == 63 || v7 == 517 ) | |
2819 { | |
2820 v26 = MONSTER_SUPERTYPE_ELF; | |
2821 } | |
2822 else | |
2823 { | |
2824 if ( v13 != 65 ) | |
2825 { | |
2826 LABEL_28: | |
2827 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2828 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2829 && rand() % 100 < 10 ) | |
2830 v12 *= 3; | |
2831 v32 = v12; | |
2832 goto LABEL_33; | |
2833 } | |
2834 v26 = MONSTER_SUPERTYPE_TITAN; | |
2835 } | |
2836 } | |
2837 } | |
2838 v14 = v26; | |
2839 } | |
2840 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2841 v12 *= 2; | |
2842 goto LABEL_28; | |
2843 } | |
2844 LABEL_33: | |
2845 v29 = 0; | |
2846 if ( !a3 ) | |
2847 { | |
2848 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2849 { | |
232 | 2850 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1]; |
0 | 2851 v16 = v15->uItemID; |
2852 v17 = v15->uItemID; | |
2853 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2854 { | |
2855 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2856 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2857 { | |
2858 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2859 do | |
2860 { | |
2861 v18 = rand() % v31; | |
2862 v11 = v35-- == 1; | |
2863 v29 += v18 + 1; | |
2864 } | |
2865 while ( !v11 ); | |
2866 } | |
2867 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2868 if ( !uTargetActorID ) | |
2869 goto LABEL_57; | |
377 | 2870 v19 = v15->uSpecEnchantmentType; |
0 | 2871 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2872 { | |
2873 v20 = (MONSTER_SUPERTYPE)1; | |
2874 } | |
2875 else | |
2876 { | |
2877 if ( v19 == 39 ) | |
2878 { | |
2879 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2880 } | |
2881 else | |
2882 { | |
2883 if ( v19 == 40 ) | |
2884 { | |
2885 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2886 } | |
2887 else | |
2888 { | |
2889 if ( v19 == 63 || v16 == 517 ) | |
2890 { | |
2891 v27 = MONSTER_SUPERTYPE_ELF; | |
2892 } | |
2893 else | |
2894 { | |
2895 if ( v19 != 65 ) | |
2896 { | |
2897 LABEL_57: | |
2898 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2899 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2900 && rand() % 100 < 10 ) | |
2901 v4 *= 3; | |
2902 goto LABEL_61; | |
2903 } | |
2904 v27 = MONSTER_SUPERTYPE_TITAN; | |
2905 } | |
2906 } | |
2907 } | |
2908 v20 = v27; | |
2909 } | |
2910 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2911 v4 *= 2; | |
2912 goto LABEL_57; | |
2913 } | |
2914 } | |
2915 } | |
2916 LABEL_62: | |
2917 v21 = v32 + v34; | |
2918 if ( !a2 ) | |
2919 { | |
2920 v22 = GetActualMight(); | |
2921 v23 = _48EA1B_get_static_effect(v22); | |
2922 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2923 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2924 } | |
2925 result = 1; | |
2926 if ( v21 >= 1 ) | |
2927 result = v21; | |
2928 return result; | |
2929 } | |
2930 | |
2931 //----- (0048D0B9) -------------------------------------------------------- | |
2932 int Player::GetRangedAttack() | |
2933 { | |
2934 Player *v1; // esi@1 | |
2935 int v2; // eax@1 | |
2936 int v3; // edi@3 | |
2937 int v4; // eax@4 | |
2938 int v5; // edi@4 | |
2939 int v6; // edi@4 | |
2940 int v7; // edi@4 | |
2941 | |
2942 v1 = this; | |
232 | 2943 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2944 if ( v2 < 64 || v2 > 65 ) |
2945 { | |
2946 v4 = GetActualAccuracy(); | |
2947 v5 = _48EA1B_get_static_effect(v4); | |
2948 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2949 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2950 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2951 } | |
2952 else | |
2953 { | |
2954 v3 = GetActualAttack(1); | |
2955 } | |
2956 return v3; | |
2957 } | |
2958 | |
2959 //----- (0048D124) -------------------------------------------------------- | |
2960 int Player::GetRangedDamageMin() | |
2961 { | |
2962 Player *v1; // esi@1 | |
2963 int v2; // edi@1 | |
2964 int v3; // edi@1 | |
2965 int v4; // edi@1 | |
2966 unsigned __int16 v5; // ax@1 | |
2967 int result; // eax@6 | |
2968 | |
2969 v1 = this; | |
2970 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2971 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2972 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2973 v5 = v1->pActiveSkills[5]; | |
2974 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2975 v4 += v1->pActiveSkills[5] & 0x3F; | |
2976 if ( v4 >= 1 ) | |
2977 result = v4; | |
2978 else | |
2979 result = 0; | |
2980 return result; | |
2981 } | |
2982 | |
2983 //----- (0048D191) -------------------------------------------------------- | |
2984 int Player::GetRangedDamageMax() | |
2985 { | |
2986 Player *v1; // esi@1 | |
2987 int v2; // edi@1 | |
2988 int v3; // edi@1 | |
2989 int v4; // edi@1 | |
2990 unsigned __int16 v5; // ax@1 | |
2991 int result; // eax@6 | |
2992 | |
2993 v1 = this; | |
2994 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
2995 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2996 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2997 v5 = v1->pActiveSkills[5]; | |
2998 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2999 v4 += v1->pActiveSkills[5] & 0x3F; | |
3000 if ( v4 >= 1 ) | |
3001 result = v4; | |
3002 else | |
3003 result = 0; | |
3004 return result; | |
3005 } | |
3006 | |
3007 //----- (0048D1FE) -------------------------------------------------------- | |
3008 bool Player::CalculateRangedDamageTo(int a2) | |
3009 { | |
3010 Player *v2; // ebx@1 | |
3011 bool result; // eax@1 | |
3012 ItemGen *v4; // ebx@2 | |
3013 unsigned int v5; // edi@2 | |
3014 unsigned int v6; // esi@2 | |
3015 int v7; // edx@4 | |
3016 char v8; // zf@4 | |
3017 int v9; // esi@5 | |
3018 int v10; // ebx@6 | |
3019 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3020 unsigned __int16 v12; // ax@19 | |
3021 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3022 Player *v14; // [sp+4h] [bp-10h]@1 | |
3023 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3024 int v16; // [sp+Ch] [bp-8h]@3 | |
3025 int v17; // [sp+10h] [bp-4h]@1 | |
3026 | |
3027 v17 = 0; | |
3028 v2 = this; | |
3029 v14 = this; | |
3030 result = HasItemEquipped(EQUIP_BOW); | |
3031 if ( !result ) | |
3032 return result; | |
232 | 3033 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3034 v5 = v4->uItemID; |
3035 v6 = v4->uItemID; | |
3036 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3037 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3038 { | |
3039 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3040 do | |
3041 { | |
3042 v7 = rand() % v15; | |
3043 v8 = v16-- == 1; | |
3044 v17 += v7 + 1; | |
3045 } | |
3046 while ( !v8 ); | |
3047 } | |
3048 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3049 if ( a2 ) | |
3050 { | |
377 | 3051 v10 = v4->uSpecEnchantmentType; |
0 | 3052 if ( v10 == 64 ) |
3053 { | |
3054 v11 = (MONSTER_SUPERTYPE)1; | |
3055 goto LABEL_17; | |
3056 } | |
3057 if ( v10 == 39 || v5 == 508 ) | |
3058 { | |
3059 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3060 goto LABEL_16; | |
3061 } | |
3062 if ( v10 == 40 ) | |
3063 { | |
3064 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3065 goto LABEL_16; | |
3066 } | |
3067 if ( v10 == 63 || v5 == 517 ) | |
3068 { | |
3069 v13 = MONSTER_SUPERTYPE_ELF; | |
3070 LABEL_16: | |
3071 v11 = v13; | |
3072 LABEL_17: | |
3073 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3074 v9 *= 2; | |
3075 goto LABEL_19; | |
3076 } | |
3077 } | |
3078 LABEL_19: | |
3079 v12 = v14->pActiveSkills[5]; | |
3080 if ( v12 ) | |
3081 { | |
3082 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3083 v9 += v14->pActiveSkills[5] & 0x3F; | |
3084 } | |
3085 return v9; | |
3086 } | |
3087 | |
3088 //----- (0048D2EA) -------------------------------------------------------- | |
3089 char *Player::GetMeleeDamageString() | |
3090 { | |
3091 Player *v1; // esi@1 | |
3092 signed int v2; // eax@1 | |
3093 signed int v3; // edi@3 | |
3094 signed int v4; // eax@3 | |
3095 signed int v5; // ST0C_4@6 | |
3096 char *v6; // edi@6 | |
3097 signed int v7; // ST08_4@7 | |
3098 unsigned int v8; // eax@8 | |
3099 signed int v9; // esi@9 | |
3100 | |
3101 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3102 | |
3103 v1 = this; | |
232 | 3104 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3105 if ( v2 < 64 || v2 > 65 ) |
3106 { | |
3107 v3 = GetMeleeDamageMinimal(); | |
3108 v4 = GetMeleeDamageMaximal(); | |
3109 } | |
3110 else | |
3111 { | |
3112 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3113 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3114 } | |
3115 if ( v3 == v4 ) | |
3116 { | |
3117 v5 = v3; | |
3118 v6 = player__getmeleedamagestring_static_buff; | |
3119 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3120 } | |
3121 else | |
3122 { | |
3123 v7 = v3; | |
3124 v6 = player__getmeleedamagestring_static_buff; | |
3125 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3126 } | |
3127 v8 = v1->pEquipment.uMainHand; | |
3128 if ( v8 ) | |
3129 { | |
232 | 3130 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3131 if ( v9 >= 135 ) |
3132 { | |
3133 if ( v9 <= 159 ) | |
3134 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3135 } | |
3136 } | |
3137 return v6; | |
3138 } | |
3139 | |
3140 //----- (0048D396) -------------------------------------------------------- | |
3141 char *Player::GetRangedDamageString() | |
3142 { | |
3143 Player *v1; // esi@1 | |
3144 signed int v2; // eax@1 | |
3145 int v3; // edi@3 | |
3146 int v4; // eax@3 | |
3147 char *v5; // edi@6 | |
3148 int v6; // ST0C_4@8 | |
3149 int v7; // ST08_4@9 | |
3150 unsigned int v8; // eax@10 | |
3151 signed int v9; // esi@11 | |
3152 | |
3153 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3154 | |
3155 v1 = this; | |
232 | 3156 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3157 if ( v2 < 64 || v2 > 65 ) |
3158 { | |
3159 v3 = GetRangedDamageMin(); | |
3160 v4 = GetRangedDamageMax(); | |
3161 } | |
3162 else | |
3163 { | |
3164 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3165 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3166 } | |
3167 if ( v4 ) | |
3168 { | |
3169 if ( v3 == v4 ) | |
3170 { | |
3171 v6 = v3; | |
3172 v5 = player__getrangeddamagestring_static_buff; | |
3173 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3174 } | |
3175 else | |
3176 { | |
3177 v7 = v3; | |
3178 v5 = player__getrangeddamagestring_static_buff; | |
3179 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3180 } | |
3181 } | |
3182 else | |
3183 { | |
3184 v5 = player__getrangeddamagestring_static_buff; | |
3185 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3186 } | |
3187 v8 = v1->pEquipment.uMainHand; | |
3188 if ( v8 ) | |
3189 { | |
232 | 3190 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3191 if ( v9 >= 135 ) |
3192 { | |
3193 if ( v9 <= 159 ) | |
3194 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3195 } | |
3196 } | |
3197 return v5; | |
3198 } | |
3199 | |
3200 //----- (0048D45A) -------------------------------------------------------- | |
3201 bool Player::CanTrainToNextLevel() | |
3202 { | |
3203 int v1; // edx@1 | |
3204 int v2; // eax@1 | |
3205 int i; // esi@1 | |
3206 | |
3207 v1 = this->uLevel; | |
3208 v2 = 0; | |
3209 for ( i = 0; i < v1; ++i ) | |
3210 v2 += i + 1; | |
3211 return (signed __int64)this->uExperience >= 1000 * v2; | |
3212 } | |
3213 | |
3214 //----- (0048D498) -------------------------------------------------------- | |
3215 unsigned int Player::GetExperienceDisplayColor() | |
3216 { | |
3217 unsigned int result; // eax@2 | |
3218 | |
3219 if ( CanTrainToNextLevel() ) | |
3220 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
3221 else | |
3222 result = 0; | |
3223 return result; | |
3224 } | |
3225 | |
3226 //----- (0048D4B3) -------------------------------------------------------- | |
3227 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3228 { | |
3229 Player *v3; // esi@1 | |
3230 int v4; // edi@8 | |
3231 int v6; // eax@21 | |
3232 signed int v7; // ebx@21 | |
3233 int v8; // eax@22 | |
3234 signed int v9; // ebx@22 | |
3235 int v10; // eax@23 | |
3236 signed int v11; // ebx@23 | |
3237 int v12; // eax@24 | |
3238 signed int v13; // edi@24 | |
3239 unsigned int v14; // eax@27 | |
3240 int v15; // eax@29 | |
3241 double v16; // st7@32 | |
3242 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3243 signed int v18; // [sp+8h] [bp-4h]@17 | |
3244 | |
3245 v3 = this; | |
3246 if ( !resistance ) | |
3247 { | |
3248 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3249 goto LABEL_16; | |
3250 } | |
3251 if ( resistance == 1 ) | |
3252 { | |
3253 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3254 goto LABEL_16; | |
3255 } | |
3256 if ( resistance == 2 ) | |
3257 { | |
3258 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3259 goto LABEL_16; | |
3260 } | |
3261 if ( resistance == 3 ) | |
3262 { | |
3263 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3264 goto LABEL_16; | |
3265 } | |
3266 if ( resistance == 6 ) | |
3267 { | |
3268 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3269 goto LABEL_16; | |
3270 } | |
3271 if ( resistance == 7 ) | |
3272 { | |
3273 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3274 goto LABEL_16; | |
3275 } | |
3276 if ( resistance == 8 ) | |
3277 { | |
3278 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3279 LABEL_16: | |
3280 v4 = GetActualResistance(v17); | |
3281 goto LABEL_17; | |
3282 } | |
3283 v4 = 0; | |
3284 LABEL_17: | |
3285 v18 = type; | |
135 | 3286 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3287 return 0; |
3288 if ( v4 ) | |
3289 { | |
3290 v6 = GetActualLuck(); | |
3291 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3292 if ( rand() % v7 >= 30 ) | |
3293 { | |
3294 v18 = type >> 1; | |
3295 v8 = GetActualLuck(); | |
3296 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3297 if ( rand() % v9 >= 30 ) | |
3298 { | |
3299 v18 = type >> 2; | |
3300 v10 = GetActualLuck(); | |
3301 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3302 if ( rand() % v11 >= 30 ) | |
3303 { | |
3304 v18 = type >> 3; | |
3305 v12 = GetActualLuck(); | |
3306 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3307 if ( rand() % v13 >= 30 ) | |
3308 v18 = type >> 4; | |
3309 } | |
3310 } | |
3311 } | |
3312 } | |
3313 if ( resistance == 4 ) | |
3314 { | |
3315 v14 = v3->pEquipment.uBody; | |
3316 if ( v14 ) | |
3317 { | |
3318 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3319 { | |
3320 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3321 if ( v15 ) | |
3322 { | |
3323 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3324 return v18; | |
3325 v16 = (double)v18 * 0.5; | |
3326 return (signed __int64)v16; | |
3327 } | |
3328 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3329 { | |
3330 v16 = (double)v18 * 0.66670001; | |
3331 return (signed __int64)v16; | |
3332 } | |
3333 } | |
3334 } | |
3335 } | |
3336 return v18; | |
3337 } | |
3338 | |
3339 //----- (0048D62C) -------------------------------------------------------- | |
3340 int Player::GetEquippedItemEquipType(unsigned int uEquipSlot) | |
3341 { | |
288 | 3342 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot]-1].uItemID].uEquipType; |
0 | 3343 } |
3344 | |
3345 //----- (0048D651) -------------------------------------------------------- | |
3346 int Player::GetEquippedItemSkillType(enum ITEM_EQUIP_TYPE uEquipSlot) | |
3347 { | |
288 | 3348 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 3349 } |
3350 | |
3351 //----- (0048D676) -------------------------------------------------------- | |
3352 bool Player::IsUnarmed() | |
3353 { | |
3354 return HasItemEquipped(EQUIP_TWO_HANDED) != 1 | |
3355 && (HasItemEquipped(EQUIP_ONE_OR_TWO_HANDS) != 1 | |
3356 || GetEquippedItemEquipType(0) == EQUIP_SHIELD); | |
3357 } | |
3358 | |
3359 //----- (0048D6AA) -------------------------------------------------------- | |
3360 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3361 { | |
3362 auto i = pEquipment.pIndices[uEquipIndex]; | |
3363 if (i) | |
3364 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3365 else return false; | |
3366 } | |
3367 | |
3368 //----- (0048D6D0) -------------------------------------------------------- | |
3369 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3370 { | |
3371 for (uint i = 0; i < 16; ++i) | |
3372 { | |
3373 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3374 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3375 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3376 return true; | |
3377 } | |
3378 return false; | |
3379 } | |
3380 | |
3381 //----- (0048D709) -------------------------------------------------------- | |
3382 bool Player::WearsItem(int a1, signed int a2) | |
3383 { | |
3384 int v3; // edx@2 | |
3385 Player *v4; // ecx@2 | |
3386 int v6; // esi@5 | |
3387 int v7; // edx@6 | |
3388 | |
3389 if ( a2 >= 16 ) | |
3390 { | |
3391 v6 = 0; | |
3392 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
118 | 3393 || *(int *)&this->pInventoryItems[a2-1].uItemID != a1 ) |
0 | 3394 { |
3395 ++v6; | |
3396 if ( (signed int)v6 >= 16 ) | |
3397 return 0; | |
3398 } | |
3399 return 1; | |
3400 } | |
3401 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) | |
3402 && *(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(&v4->pEquipment.uOffHand + v3) + 5] == a1 ) | |
3403 return 1; | |
3404 return 0; | |
3405 } | |
3406 | |
3407 //----- (0048D76C) -------------------------------------------------------- | |
3408 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3409 { | |
3410 unsigned __int16 v6; // cx@8 | |
3411 int v7; // edi@8 | |
3412 unsigned int v8; // ebx@8 | |
3413 unsigned int v9; // esi@8 | |
3414 int v10; // eax@8 | |
3415 int v11; // edi@12 | |
3416 bool result; // eax@13 | |
3417 | |
3418 if ( !a2 | |
3419 || this->pConditions[16] | |
3420 || this->pConditions[14] | |
3421 || this->pConditions[15] | |
3422 || this->pConditions[4] | |
3423 || this->pConditions[13] | |
3424 || this->pConditions[2] ) | |
3425 { | |
3426 result = 0; | |
3427 } | |
3428 else | |
3429 { | |
3430 v6 = this->pActiveSkills[34]; | |
3431 v7 = v6 & 0x3F; | |
3432 v8 = SkillToMastery(v6); | |
3433 v9 = a2->GetValue(); | |
3434 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3435 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3436 v9 *= 3; | |
3437 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3438 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3439 if ( rand() % 100 >= 5 ) | |
3440 { | |
3441 if ( *a6 > v11 ) | |
3442 result = *a6 - v11 < 500; | |
3443 else | |
3444 result = 2; | |
3445 } | |
3446 else | |
3447 { | |
3448 result = 0; | |
3449 } | |
3450 } | |
3451 return result; | |
3452 } | |
3453 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3454 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3455 | |
3456 //----- (0048D88B) -------------------------------------------------------- | |
3457 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3458 { | |
3459 Player *v4; // esi@1 | |
3460 Actor *v5; // edi@1 | |
3461 unsigned __int16 v6; // cx@10 | |
3462 int v7; // ebx@10 | |
3463 unsigned int v8; // esi@10 | |
3464 int v9; // eax@10 | |
3465 int v10; // esi@10 | |
3466 int v11; // eax@13 | |
3467 signed int v12; // ebx@15 | |
3468 signed int v13; // edx@15 | |
3469 int v14; // ecx@15 | |
3470 unsigned __int16 v15; // si@21 | |
3471 unsigned int v16; // ebx@24 | |
3472 int v17; // esi@24 | |
3473 const void *v18; // eax@29 | |
3474 unsigned int v19; // esi@31 | |
3475 int v20; // eax@34 | |
3476 char v21; // zf@36 | |
3477 unsigned int v22; // ST0C_4@39 | |
3478 char *v23; // esi@39 | |
3479 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3480 int v26; // [sp-8h] [bp-44h]@40 | |
3481 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3482 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3483 int v29; // [sp+30h] [bp-Ch]@10 | |
3484 int v30; // [sp+34h] [bp-8h]@10 | |
3485 Player *v31; // [sp+38h] [bp-4h]@1 | |
3486 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3487 | |
3488 v4 = this; | |
3489 v5 = &pActors[uActorID]; | |
3490 v31 = this; | |
3491 if ( &pActors[uActorID] | |
3492 && !this->pConditions[16] | |
3493 && !this->pConditions[14] | |
3494 && !this->pConditions[15] | |
3495 && !this->pConditions[4] | |
3496 && !this->pConditions[13] | |
3497 && !this->pConditions[2] ) | |
3498 { | |
3499 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3500 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3501 v6 = v4->pActiveSkills[34]; | |
3502 v7 = v6 & 0x3F; | |
3503 v8 = SkillToMastery(v6); | |
3504 v9 = rand(); | |
3505 v28 = 4 * v8; | |
3506 v30 = dword_4EDEA0[v8]; | |
3507 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3508 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3509 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3510 { | |
322 | 3511 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3512 _steal_perma = 0; |
3513 v26 = (int)v31->pName; | |
3514 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3515 } | |
3516 else | |
3517 { | |
3518 v11 = rand(); | |
3519 if ( v11 % 100 >= 40 ) | |
3520 { | |
3521 if ( v11 % 100 >= 70 ) | |
3522 { | |
3523 v19 = 0; | |
3524 if ( v7 > 0 ) | |
3525 { | |
3526 do | |
3527 { | |
3528 --v7; | |
3529 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3530 } | |
3531 while ( v7 ); | |
3532 } | |
3533 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3534 return _steal_perma; | |
377 | 3535 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3536 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3537 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3538 v21 = *(int *)v20 == v19; |
3539 *(int *)v20 -= v19; | |
3540 if ( v21 ) | |
3541 v5->array_000234[3].uItemID = 0; | |
3542 if ( v19 ) | |
3543 { | |
3544 party_finds_gold(v19, 2); | |
3545 v22 = v19; | |
3546 v23 = pTmpBuf2; | |
3547 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3548 LABEL_43: | |
3549 ShowStatusBarString(v23, 2u); | |
3550 return _steal_perma; | |
3551 } | |
3552 } | |
3553 else | |
3554 { | |
3555 v27.Reset(); | |
3556 v12 = 0; | |
3557 v13 = 0; | |
3558 v14 = (int)v5->array_000234; | |
3559 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3560 { | |
3561 ++v13; | |
3562 v14 += 36; | |
3563 if ( v13 >= 4 ) | |
3564 goto LABEL_21; | |
3565 } | |
3566 v12 = 1; | |
3567 LABEL_21: | |
3568 v15 = v5->uCarriedItemID; | |
3569 if ( v15 || v12 ) | |
3570 { | |
3571 v27.Reset(); | |
3572 if ( v15 ) | |
3573 { | |
3574 v16 = (signed __int16)v15; | |
3575 v5->uCarriedItemID = 0; | |
3576 v27.uItemID = (signed __int16)v15; | |
3577 v17 = (signed __int16)v15; | |
3578 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3579 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3580 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3581 { | |
3582 if ( v16 != 220 ) | |
377 | 3583 v27.uEncantmentType = 2 * rand() % 4 + 2; |
0 | 3584 } |
3585 } | |
3586 else | |
3587 { | |
3588 v18 = &v5->array_000234[rand() % 4]; | |
3589 memcpy(&v27, v18, sizeof(v27)); | |
3590 ((ItemGen *)v18)->Reset(); | |
3591 v16 = v27.uItemID; | |
3592 } | |
3593 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3594 sprintf( | |
3595 pTmpBuf2, | |
3596 pGlobalTXT_LocalizationStrings[304], | |
3597 v31->pName, | |
3598 pItemsTable->pItems[v16].pUnidentifiedName); | |
3599 ShowStatusBarString(pTmpBuf2, 2u); | |
3600 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3601 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3602 pMouse->SetCursorBitmapFromItemID(v16); | |
3603 return _steal_perma; | |
3604 } | |
3605 } | |
3606 } | |
3607 v26 = (int)v31->pName; | |
3608 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3609 } | |
3610 v23 = pTmpBuf2; | |
3611 sprintf(pTmpBuf2, v25, v26); | |
3612 goto LABEL_43; | |
3613 } | |
3614 return 0; | |
3615 } | |
3616 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3617 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3618 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3619 | |
3620 //----- (0048DBB9) -------------------------------------------------------- | |
3621 void Player::Heal(int amount) | |
3622 { | |
3623 Player *v2; // esi@1 | |
3624 signed int v3; // eax@3 | |
3625 | |
3626 v2 = this; | |
3627 if ( !this->pConditions[16] && !this->pConditions[14] ) | |
3628 { | |
3629 v3 = GetMaxHealth(); | |
3630 if ( v2->pConditions[17] ) | |
3631 v3 /= 2; | |
3632 v2->sHealth += amount; | |
3633 if ( v2->sHealth > v3 ) | |
3634 v2->sHealth = v3; | |
3635 if ( v2->pConditions[13] ) | |
3636 { | |
3637 if ( v2->sHealth > 0 ) | |
3638 { | |
3639 LODWORD(v2->pConditions[13]) = 0; | |
3640 HIDWORD(v2->pConditions[13]) = 0; | |
3641 } | |
3642 } | |
3643 } | |
3644 } | |
3645 | |
3646 //----- (0048DC1E) -------------------------------------------------------- | |
3647 int Player::ReceiveDamage(signed int type, int resistance) | |
3648 { | |
3649 Player *v3; // esi@1 | |
3650 signed int v4; // eax@1 | |
3651 int v5; // eax@1 | |
3652 bool v6; // ebx@1 | |
3653 unsigned int v7; // eax@8 | |
3654 char *v8; // ecx@9 | |
3655 int v9; // eax@9 | |
187 | 3656 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3657 |
3658 v3 = this; | |
3659 this->pConditions[2] = 0i64; | |
3660 v4 = CalculateIncommingDamage(resistance, type); | |
3661 v3->sHealth -= v4; | |
187 | 3662 //typea = v4; |
0 | 3663 v5 = v3->sHealth; |
3664 v6 = v5 < -10; | |
3665 LOBYTE(v6) = v5 <= -10; | |
3666 if ( v5 < 1 ) | |
3667 { | |
3668 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3669 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) | |
3670 { | |
3671 SetCondition(0xDu, 0); | |
3672 } | |
3673 else | |
3674 { | |
3675 SetCondition(0xEu, 0); | |
3676 v6 = LODWORD(pParty->uTimePlayed); | |
3677 if ( v3->sHealth > 0 ) | |
3678 v3->sHealth = 0; | |
3679 } | |
3680 if ( v6 ) | |
3681 { | |
3682 v7 = v3->pEquipment.uBody; | |
3683 if ( v7 ) | |
3684 { | |
3685 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3686 v9 = *(int *)v8; | |
3687 if ( !(BYTE1(v9) & 2) ) | |
3688 { | |
3689 LOBYTE(v9) = v9 | 2; | |
3690 *(int *)v8 = v9; | |
3691 } | |
3692 } | |
3693 } | |
3694 } | |
187 | 3695 if ( v4 && CanAct() ) |
3696 PlaySound(SPEECH_24, 0); | |
3697 return v4; | |
0 | 3698 } |
3699 | |
3700 //----- (0048DCF6) -------------------------------------------------------- | |
3701 int Player::_48DCF6(int a2, Actor *pActor) | |
3702 { | |
3703 signed int v3; // edi@1 | |
3704 signed int v4; // ebx@1 | |
3705 Player *v5; // esi@1 | |
3706 int v6; // eax@2 | |
3707 int v7; // eax@5 | |
3708 int v8; // eax@8 | |
3709 int v9; // ebx@8 | |
3710 int v10; // eax@8 | |
3711 int v11; // ebx@8 | |
3712 signed int v12; // edx@9 | |
3713 ItemGen *v13; // eax@9 | |
3714 int v14; // edx@16 | |
3715 unsigned int v15; // edx@17 | |
3716 int v16; // edx@26 | |
3717 unsigned int v17; // edx@27 | |
3718 Player *v18; // ecx@32 | |
3719 signed int v19; // edx@38 | |
3720 int *v20; // ecx@38 | |
3721 signed int v21; // eax@40 | |
3722 int v22; // eax@49 | |
3723 signed int v23; // ebx@49 | |
3724 unsigned int v24; // eax@60 | |
3725 int v25; // ecx@61 | |
3726 int v26; // ebx@74 | |
3727 void *v27; // ecx@76 | |
3728 unsigned int v28; // ebx@78 | |
3729 signed int result; // eax@86 | |
3730 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3731 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3732 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3733 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3734 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3735 int v35; // [sp-Ch] [bp-ACh]@56 | |
3736 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3737 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3738 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3739 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3740 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3741 int v41; // [sp-4h] [bp-A4h]@51 | |
3742 int v42; // [sp-4h] [bp-A4h]@56 | |
3743 int v43; // [sp-4h] [bp-A4h]@57 | |
3744 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3745 int v45; // [sp-4h] [bp-A4h]@68 | |
3746 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3747 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3748 int v48; // [sp+9Ch] [bp-4h]@1 | |
3749 | |
3750 v3 = 0; | |
3751 v4 = 0; | |
3752 v5 = this; | |
3753 v47 = 0; | |
3754 v48 = 0; | |
3755 switch ( a2 ) | |
3756 { | |
3757 case 1: | |
3758 v6 = GetActualWillpower(); | |
3759 goto LABEL_46; | |
3760 case 2: | |
3761 case 3: | |
3762 case 4: | |
3763 case 9: | |
3764 case 10: | |
3765 case 11: | |
3766 case 13: | |
3767 case 21: | |
3768 v6 = GetActualEndurance(); | |
3769 goto LABEL_46; | |
3770 case 5: | |
3771 case 12: | |
3772 case 23: | |
3773 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3774 goto LABEL_5; | |
3775 case 15: | |
3776 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3777 goto LABEL_5; | |
3778 case 6: | |
3779 case 7: | |
3780 case 8: | |
3781 case 14: | |
3782 case 16: | |
3783 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3784 LABEL_5: | |
3785 v7 = GetActualResistance(v40); | |
3786 goto LABEL_47; | |
3787 case 22: | |
3788 v8 = GetActualWillpower(); | |
3789 v9 = _48EA1B_get_static_effect(v8); | |
3790 v10 = GetActualIntelligence(); | |
3791 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3792 break; | |
3793 case 17: | |
3794 v12 = 0; | |
3795 v13 = this->pInventoryItems; | |
3796 do | |
3797 { | |
315 | 3798 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3799 v46[v4++] = v12; |
3800 ++v12; | |
3801 ++v13; | |
3802 } | |
3803 while ( v12 < 138 ); | |
3804 goto LABEL_36; | |
3805 case 18: | |
3806 v14 = 0; | |
3807 do | |
3808 { | |
3809 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3810 { | |
3811 if ( v15 == 3 ) | |
3812 v46[v4++] = LOBYTE(v5->pEquipment.uBody) - 1; | |
3813 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType(v15) == 4 ) | |
3814 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v15) - 1; | |
3815 } | |
3816 v14 = v15 + 1; | |
3817 } | |
3818 while ( v14 < 16 ); | |
3819 goto LABEL_36; | |
3820 case 19: | |
3821 v16 = 0; | |
3822 do | |
3823 { | |
3824 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3825 { | |
3826 if ( v17 == 2 ) | |
3827 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3828 if ( (!v17 || v17 == 1) | |
3829 && (!GetEquippedItemEquipType(v17) || GetEquippedItemEquipType(v17) == 1) ) | |
3830 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v17) - 1; | |
3831 } | |
3832 v16 = v17 + 1; | |
3833 } | |
3834 while ( v16 < 16 ); | |
3835 LABEL_36: | |
3836 if ( !v4 ) | |
3837 goto LABEL_87; | |
3838 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3839 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3840 break; | |
3841 case 20: | |
3842 v19 = 0; | |
3843 v20 = this->pInventoryIndices; | |
3844 do | |
3845 { | |
3846 if ( *v20 > 0 ) | |
3847 { | |
232 | 3848 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3849 if ( v21 > 0 ) |
3850 { | |
3851 if ( v21 <= 134 ) | |
3852 v46[v4++] = v19; | |
3853 } | |
3854 } | |
3855 ++v19; | |
3856 ++v20; | |
3857 } | |
3858 while ( v19 < 126 ); | |
3859 if ( !v4 ) | |
3860 goto LABEL_87; | |
3861 v47 = (unsigned __int8)v46[rand() % v4]; | |
3862 v6 = GetActualAccuracy(); | |
3863 LABEL_46: | |
3864 v7 = _48EA1B_get_static_effect(v6); | |
3865 LABEL_47: | |
3866 v11 = v7; | |
3867 break; | |
3868 default: | |
3869 v11 = 0; | |
3870 break; | |
3871 } | |
3872 v22 = GetActualLuck(); | |
3873 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3874 if ( rand() % v23 >= 30 ) | |
3875 { | |
3876 LABEL_87: | |
3877 result = 0; | |
3878 } | |
3879 else | |
3880 { | |
3881 switch ( a2 ) | |
3882 { | |
3883 case 1: | |
3884 v41 = 1; | |
3885 v36 = 0; | |
3886 goto LABEL_56; | |
3887 case 2: | |
3888 v41 = 1; | |
3889 v36 = 1; | |
3890 goto LABEL_56; | |
3891 case 3: | |
3892 v41 = 1; | |
3893 v36 = 2; | |
3894 goto LABEL_56; | |
3895 case 23: | |
3896 v41 = 1; | |
3897 v36 = 3; | |
3898 goto LABEL_56; | |
3899 case 4: | |
3900 v41 = 1; | |
3901 v36 = 4; | |
3902 LABEL_56: | |
3903 SetCondition(v36, v41); | |
3904 v42 = 0; | |
3905 v37 = 0; | |
3906 v35 = 0; | |
3907 v34 = 0; | |
3908 v33 = -1; | |
3909 v32 = 0; | |
3910 v31 = 0; | |
3911 v30 = (SoundID)221; | |
3912 goto LABEL_83; | |
3913 case 5: | |
3914 v43 = 1; | |
3915 v38 = 5; | |
3916 goto LABEL_70; | |
3917 case 6: | |
3918 case 7: | |
3919 case 8: | |
3920 if ( a2 == 6 ) | |
3921 { | |
3922 v44 = 6; | |
3923 goto LABEL_60; | |
3924 } | |
3925 v25 = 2 * (a2 != 8) + 8; | |
3926 goto LABEL_65; | |
3927 case 9: | |
3928 if ( a2 == 6 ) | |
3929 { | |
3930 v44 = 7; | |
3931 LABEL_60: | |
3932 v24 = v44; | |
3933 } | |
3934 else | |
3935 { | |
3936 v25 = 2 * (a2 != 8) + 9; | |
3937 LABEL_65: | |
3938 v24 = v25; | |
3939 } | |
3940 SetCondition(v24, 1); | |
3941 v42 = 0; | |
3942 v37 = 0; | |
3943 v35 = 0; | |
3944 v34 = 0; | |
3945 v33 = -1; | |
3946 v32 = 0; | |
3947 v31 = 0; | |
3948 v30 = (SoundID)222; | |
3949 LABEL_83: | |
3950 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3951 do | |
3952 { | |
3953 LABEL_84: | |
3954 if ( v5 == pPlayers[v3 + 1] ) | |
3955 break; | |
3956 ++v3; | |
3957 } | |
3958 while ( v3 < 4 ); | |
3959 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3960 result = 1; | |
3961 break; | |
3962 case 12: | |
3963 v43 = 1; | |
3964 v38 = 12; | |
3965 goto LABEL_70; | |
3966 case 15: | |
3967 v45 = 1; | |
3968 v39 = 15; | |
3969 goto LABEL_73; | |
3970 case 13: | |
3971 v43 = 1; | |
3972 v38 = 13; | |
3973 LABEL_70: | |
3974 SetCondition(v38, v43); | |
3975 v42 = 0; | |
3976 v37 = 0; | |
3977 v35 = 0; | |
3978 v34 = 0; | |
3979 v33 = -1; | |
3980 v32 = 0; | |
3981 v31 = 0; | |
3982 v30 = (SoundID)224; | |
3983 goto LABEL_83; | |
3984 case 14: | |
3985 v45 = 1; | |
3986 v39 = 14; | |
3987 goto LABEL_73; | |
3988 case 16: | |
3989 v45 = 1; | |
3990 v39 = 16; | |
3991 LABEL_73: | |
3992 SetCondition(v39, v45); | |
3993 v42 = 0; | |
3994 v37 = 0; | |
3995 v35 = 0; | |
3996 v34 = 0; | |
3997 v33 = -1; | |
3998 v32 = 0; | |
3999 v31 = 0; | |
4000 v30 = (SoundID)225; | |
4001 goto LABEL_83; | |
4002 case 17: | |
4003 case 18: | |
4004 case 19: | |
4005 v26 = v48; | |
4006 if ( *(char *)(v48 + 21) & 2 ) | |
4007 goto LABEL_84; | |
187 | 4008 PlaySound(SPEECH_40, 0); |
0 | 4009 *(int *)(v26 + 20) |= 2u; |
4010 goto LABEL_79; | |
4011 case 20: | |
187 | 4012 PlaySound(SPEECH_40, 0); |
0 | 4013 v27 = pActor->array_000234; |
4014 if ( pActor->array_000234[0].uItemID ) | |
4015 { | |
4016 v27 = &pActor->array_000234[1]; | |
4017 if ( pActor->array_000234[1].uItemID ) | |
4018 goto LABEL_84; | |
4019 } | |
4020 v28 = v47; | |
4021 memcpy(v27, &v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pInventoryIndices[v47] + 5], 0x24u); | |
4022 RemoveItemAtInventoryIndex(v28); | |
4023 LABEL_79: | |
4024 v42 = 0; | |
4025 v37 = 0; | |
4026 v35 = 0; | |
4027 v34 = 0; | |
4028 v33 = -1; | |
4029 v32 = 0; | |
4030 v31 = 0; | |
4031 v30 = (SoundID)47; | |
4032 goto LABEL_83; | |
4033 case 21: | |
187 | 4034 PlaySound(SPEECH_42, 0); |
0 | 4035 ++v5->sAgeModifier; |
4036 goto LABEL_82; | |
4037 case 22: | |
187 | 4038 PlaySound(SPEECH_41, 0); |
0 | 4039 v5->sMana = 0; |
4040 LABEL_82: | |
4041 v42 = 0; | |
4042 v37 = 0; | |
4043 v35 = 0; | |
4044 v34 = 0; | |
4045 v33 = -1; | |
4046 v32 = 0; | |
4047 v31 = 0; | |
4048 v30 = (SoundID)226; | |
4049 goto LABEL_83; | |
4050 default: | |
4051 goto LABEL_87; | |
4052 } | |
4053 } | |
4054 return result; | |
4055 } | |
324 | 4056 |
0 | 4057 // 48DCF6: using guessed type char var_94[140]; |
4058 | |
4059 //----- (0048E1A3) -------------------------------------------------------- | |
4060 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4061 { | |
4062 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4063 } | |
4064 | |
4065 //----- (0048E1B5) -------------------------------------------------------- | |
4066 int Player::GetAttackRecoveryTime(int a2) | |
4067 { | |
4068 unsigned int v2; // ebx@1 | |
4069 char *v3; // edi@1 | |
4070 Player *v4; // esi@1 | |
4071 int v5; // eax@3 | |
4072 int v6; // eax@3 | |
4073 int v7; // eax@6 | |
4074 int v8; // eax@9 | |
4075 int v9; // eax@9 | |
4076 int v10; // eax@10 | |
4077 int v11; // edx@13 | |
4078 int v12; // ecx@14 | |
4079 int v13; // eax@15 | |
4080 int v14; // ebx@18 | |
4081 int v15; // eax@18 | |
4082 double v16; // st7@21 | |
4083 double v17; // st7@22 | |
4084 unsigned __int16 v18; // cx@27 | |
4085 Player *v19; // ecx@28 | |
4086 int v20; // eax@30 | |
4087 int v21; // eax@30 | |
4088 int v22; // eax@30 | |
4089 int v23; // ecx@30 | |
4090 unsigned int v24; // eax@30 | |
4091 int v25; // eax@31 | |
4092 int v26; // ebx@32 | |
4093 int v27; // eax@32 | |
4094 unsigned __int16 *v28; // ebx@36 | |
4095 int v29; // eax@42 | |
4096 int v30; // edi@43 | |
4097 signed int v31; // eax@49 | |
4098 int v32; // ecx@50 | |
4099 int result; // eax@54 | |
4100 float v34; // [sp+8h] [bp-38h]@27 | |
4101 float v35; // [sp+Ch] [bp-34h]@18 | |
4102 float v36; // [sp+10h] [bp-30h]@21 | |
4103 float v37; // [sp+14h] [bp-2Ch]@21 | |
4104 float v38; // [sp+18h] [bp-28h]@27 | |
4105 int v39; // [sp+1Ch] [bp-24h]@31 | |
4106 int v40; // [sp+20h] [bp-20h]@1 | |
4107 int v41; // [sp+24h] [bp-1Ch]@1 | |
4108 unsigned int v42; // [sp+28h] [bp-18h]@14 | |
4109 int v43; // [sp+2Ch] [bp-14h]@1 | |
4110 int v44; // [sp+30h] [bp-10h]@1 | |
4111 int v45; // [sp+34h] [bp-Ch]@1 | |
4112 int v46; // [sp+38h] [bp-8h]@1 | |
4113 int v47; // [sp+3Ch] [bp-4h]@1 | |
4114 | |
4115 v2 = 0; | |
4116 v3 = 0; | |
4117 v4 = this; | |
4118 v47 = (unsigned __int16)word_4EDED8[0]; | |
4119 v43 = 0; | |
4120 v45 = 0; | |
4121 v40 = 0; | |
4122 v41 = 0; | |
4123 v44 = 0; | |
4124 v46 = 0; | |
4125 if ( a2 ) | |
4126 { | |
4127 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4128 goto LABEL_17; | |
232 | 4129 v5 = (int)&v4->pInventoryItems[v4->pEquipment.uBow-1]; |
0 | 4130 v46 = v5; |
4131 v3 = (char *)&pItemsTable->pItems[*(int *)v5].pIconName; | |
4132 v6 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; | |
4133 goto LABEL_4; | |
4134 } | |
4135 if ( IsUnarmed() == 1 ) | |
4136 { | |
4137 LOBYTE(v7) = GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4138 if ( v7 ) | |
4139 { | |
4140 v6 = (unsigned __int16)word_4EDED8[1]; | |
4141 LABEL_4: | |
4142 v47 = v6; | |
4143 goto LABEL_17; | |
4144 } | |
4145 } | |
4146 if ( HasItemEquipped(EQUIP_TWO_HANDED) ) | |
4147 { | |
232 | 4148 v8 = (int)&v4->pInventoryItems[v4->pEquipment.uMainHand-1]; |
0 | 4149 v46 = v8; |
4150 v9 = *(int *)v8; | |
4151 v3 = (char *)&pItemsTable->pItems[v9].pIconName; | |
4152 if ( v3[28] == 12 ) | |
4153 v10 = *(&pSpellDatas[0].field_A + 10 * *((int *)&pSpellDatas[66].field_8 + v9)); | |
4154 else | |
4155 v10 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; | |
4156 v47 = v10; | |
4157 } | |
4158 if ( HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
4159 { | |
232 | 4160 v12 = (int)&v4->pInventoryItems[v4->pEquipment.uOffHand-1]; |
0 | 4161 v42 = (unsigned __int16)word_4EDED8[pItemsTable->pItems[*(int *)v12].uSkillType]; |
4162 if ( (signed int)v42 > v47 ) | |
4163 { | |
4164 v13 = *(int *)v12; | |
4165 v46 = v12; | |
4166 v3 = (char *)(v11 + 48 * v13); | |
4167 v47 = v42; | |
4168 } | |
4169 v2 = 0; | |
4170 } | |
4171 LABEL_17: | |
4172 if ( HasItemEquipped(EQUIP_ARMOUR) ) | |
4173 { | |
232 | 4174 v14 = pItemsTable->pItems[*(int *)&v4->pInventoryItems[v4->pEquipment.uBody-1]].uSkillType; |
0 | 4175 SkillToMastery(v4->pActiveSkills[9]); |
4176 v15 = (unsigned __int16)word_4EDED8[v14]; | |
4177 v35 = 1.0; | |
4178 v43 = v15; | |
4179 if ( v14 == 9 ) | |
4180 { | |
4181 v36 = 0.0; | |
4182 } | |
4183 else | |
4184 { | |
4185 if ( v14 != 10 ) | |
4186 { | |
4187 if ( v14 != 11 ) | |
4188 { | |
4189 v36 = 1.0; | |
4190 v37 = 1.0; | |
4191 v16 = 1.0; | |
4192 LABEL_27: | |
4193 v18 = v4->pActiveSkills[v14]; | |
4194 v38 = v16; | |
4195 v43 = (signed __int64)((double)v43 * *(&v34 + SkillToMastery(v18))); | |
4196 v2 = 0; | |
4197 goto LABEL_28; | |
4198 } | |
4199 v17 = 0.5; | |
4200 v36 = 0.5; | |
4201 LABEL_26: | |
4202 v37 = v17; | |
4203 v16 = 0.0; | |
4204 goto LABEL_27; | |
4205 } | |
4206 v36 = 0.5; | |
4207 } | |
4208 v17 = 0.0; | |
4209 goto LABEL_26; | |
4210 } | |
4211 LABEL_28: | |
4212 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v2) && v19->GetEquippedItemEquipType(v2) == 4 ) | |
4213 { | |
4214 v20 = 9 * v4->pEquipment.uOffHand; | |
4215 v35 = 1.0; | |
4216 v21 = 3 * *(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v20 + 5]; | |
4217 v36 = 0.0; | |
4218 v22 = pItemsTable->pItems[16 * v21 / 0x30u].uSkillType; | |
4219 v37 = 0.0; | |
4220 v23 = (unsigned __int16)word_4EDED8[v22]; | |
4221 v38 = 0.0; | |
4222 v45 = v23; | |
4223 v24 = SkillToMastery(v4->pActiveSkills[v22]); | |
4224 v45 = (signed __int64)((double)v45 * *(&v34 + v24)); | |
4225 } | |
4226 v25 = GetActualSpeed(); | |
4227 v39 = _48EA1B_get_static_effect(v25); | |
4228 v42 = v2; | |
4229 if ( v3 != (char *)v2 ) | |
4230 { | |
4231 v26 = (unsigned __int8)v3[29]; | |
4232 LOBYTE(v27) = GetActualSkillLevel((enum PLAYER_SKILL_TYPE)(unsigned __int8)v3[29]); | |
4233 if ( v27 && (v26 == 1 || v26 == 3 || v26 == 5) ) | |
4234 { | |
4235 v28 = &v4->pActiveSkills[v26]; | |
4236 if ( (signed int)SkillToMastery(*v28) >= 2 ) | |
4237 v40 = *(char *)v28 & 0x3F; | |
4238 } | |
4239 v2 = 0; | |
4240 if ( v3[29] == 7 ) | |
4241 v42 = 1; | |
4242 } | |
4243 if ( a2 == v2 ) | |
4244 { | |
4245 if ( v42 == v2 ) | |
4246 { | |
4247 LOBYTE(v29) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
4248 if ( v29 != v2 ) | |
4249 { | |
4250 v30 = v29 & 0x3F; | |
4251 v44 = v29 & 0x3F; | |
4252 if ( (signed int)SkillToMastery(v29) >= 4 ) | |
4253 v44 += v30; | |
4254 } | |
4255 } | |
4256 } | |
4257 if ( SHIDWORD(v4->pPlayerBuffs[7].uExpireTime) >= (signed int)v2 | |
4258 && (SHIDWORD(v4->pPlayerBuffs[7].uExpireTime) > (signed int)v2 || LODWORD(v4->pPlayerBuffs[7].uExpireTime) > v2) ) | |
4259 v41 = 25; | |
4260 v31 = 0; | |
4261 if ( v46 != v2 ) | |
4262 { | |
4263 v32 = *(int *)(v46 + 12); | |
4264 if ( v32 == 59 || v32 == 41 || *(int *)v46 == 500 ) | |
4265 v31 = 20; | |
4266 } | |
4267 result = v47 + v43 + v45 - v44 - v31 - v41 - v40 - v39; | |
4268 if ( result < 0 ) | |
4269 result = 0; | |
4270 return result; | |
4271 } | |
4272 | |
4273 //----- (0048E4F8) -------------------------------------------------------- | |
4274 int Player::GetMaxHealth() | |
4275 { | |
4276 int v3; // esi@1 | |
4277 int v4; // esi@1 | |
4278 int v6; // esi@1 | |
4279 | |
4280 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4281 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4282 v6 = uFullHealthBonus |
135 | 4283 + pBaseHealthByClass[classType / 4] |
0 | 4284 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4285 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4286 if (v6 <= 0) | |
4287 return 1; | |
4288 return v6; | |
4289 } | |
4290 | |
4291 //----- (0048E565) -------------------------------------------------------- | |
4292 int Player::GetMaxMana() | |
4293 { | |
4294 int v2; // eax@2 | |
4295 int v3; // esi@4 | |
4296 int v4; // eax@5 | |
4297 int v5; // esi@5 | |
4298 int v6; // eax@5 | |
4299 int v7; // esi@6 | |
4300 int v8; // esi@6 | |
4301 int v9; // esi@6 | |
4302 int result; // eax@7 | |
4303 | |
135 | 4304 switch (classType) |
0 | 4305 { |
4306 case 5u: | |
4307 case 6u: | |
4308 case 7u: | |
4309 case 0x10u: | |
4310 case 0x11u: | |
4311 case 0x12u: | |
4312 case 0x13u: | |
4313 case 0x20u: | |
4314 case 0x21u: | |
4315 case 0x22u: | |
4316 case 0x23u: | |
4317 v2 = GetActualIntelligence(); | |
4318 v3 = _48EA1B_get_static_effect(v2); | |
4319 goto LABEL_6; | |
4320 case 9u: | |
4321 case 0xAu: | |
4322 case 0xBu: | |
4323 case 0xCu: | |
4324 case 0xDu: | |
4325 case 0xEu: | |
4326 case 0xFu: | |
4327 case 0x18u: | |
4328 case 0x19u: | |
4329 case 0x1Au: | |
4330 case 0x1Bu: | |
4331 v2 = GetActualWillpower(); | |
4332 v3 = _48EA1B_get_static_effect(v2); | |
4333 goto LABEL_6; | |
4334 case 0x15u: | |
4335 case 0x16u: | |
4336 case 0x17u: | |
4337 case 0x1Cu: | |
4338 case 0x1Du: | |
4339 case 0x1Eu: | |
4340 case 0x1Fu: | |
4341 v4 = GetActualWillpower(); | |
4342 v5 = _48EA1B_get_static_effect(v4); | |
4343 v6 = GetActualIntelligence(); | |
4344 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4345 LABEL_6: | |
135 | 4346 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4347 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4348 v9 = uFullManaBonus | |
135 | 4349 + pBaseManaByClass[classType / 4] |
0 | 4350 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4351 + v8; | |
4352 if ( v9 < 1 ) | |
4353 goto LABEL_7; | |
4354 result = v9; | |
4355 break; | |
4356 default: | |
4357 LABEL_7: | |
4358 result = 0; | |
4359 break; | |
4360 } | |
4361 return result; | |
4362 } | |
4363 | |
4364 //----- (0048E656) -------------------------------------------------------- | |
4365 int Player::GetBaseAC() | |
4366 { | |
4367 Player *v1; // edi@1 | |
4368 int v2; // eax@1 | |
4369 int v3; // esi@1 | |
4370 int v4; // esi@1 | |
4371 int v5; // esi@1 | |
4372 int result; // eax@2 | |
4373 | |
4374 v1 = this; | |
4375 v2 = GetActualSpeed(); | |
4376 v3 = _48EA1B_get_static_effect(v2); | |
4377 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4378 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4379 if ( v5 >= 1 ) | |
4380 result = v5; | |
4381 else | |
4382 result = 0; | |
4383 return result; | |
4384 } | |
4385 | |
4386 //----- (0048E68F) -------------------------------------------------------- | |
4387 int Player::GetActualAC() | |
4388 { | |
4389 Player *v1; // edi@1 | |
4390 int v2; // eax@1 | |
4391 int v3; // esi@1 | |
4392 int v4; // esi@1 | |
4393 int v5; // esi@1 | |
4394 int v6; // esi@1 | |
4395 int result; // eax@2 | |
4396 | |
4397 v1 = this; | |
4398 v2 = GetActualSpeed(); | |
4399 v3 = _48EA1B_get_static_effect(v2); | |
4400 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4401 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4402 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4403 if ( v6 >= 1 ) | |
4404 result = v6; | |
4405 else | |
4406 result = 0; | |
4407 return result; | |
4408 } | |
4409 | |
4410 //----- (0048E6DC) -------------------------------------------------------- | |
4411 unsigned int Player::GetBaseAge() | |
4412 { | |
352 | 4413 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4414 } |
4415 | |
4416 //----- (0048E72C) -------------------------------------------------------- | |
4417 unsigned int Player::GetActualAge() | |
4418 { | |
4419 return this->sAgeModifier + GetBaseAge(); | |
4420 } | |
4421 | |
4422 //----- (0048E73F) -------------------------------------------------------- | |
4423 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4424 { | |
4425 Player *v2; // ebx@1 | |
4426 signed int v3; // esi@1 | |
4427 enum CHARACTER_RACE v4; // eax@1 | |
4428 signed int v5; // edi@8 | |
4429 char v6; // zf@9 | |
4430 int v7; // esi@20 | |
4431 int result; // eax@21 | |
4432 signed int v9; // [sp-4h] [bp-10h]@11 | |
4433 | |
4434 v2 = this; | |
4435 v3 = 0; | |
4436 v4 = GetRace(); | |
4437 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4438 { | |
4439 v5 = 0; | |
4440 goto LABEL_16; | |
4441 } | |
4442 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4443 { | |
4444 v5 = 1; | |
4445 LABEL_16: | |
4446 v6 = v4 == 2; | |
4447 goto LABEL_17; | |
4448 } | |
4449 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4450 { | |
4451 v6 = v4 == 3; | |
4452 v5 = 2; | |
4453 goto LABEL_17; | |
4454 } | |
4455 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4456 { | |
4457 v5 = 3; | |
4458 v6 = v4 == 3; | |
4459 goto LABEL_17; | |
4460 } | |
4461 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4462 { | |
4463 v5 = 7; | |
4464 if ( v4 != 1 ) | |
4465 goto LABEL_20; | |
4466 v9 = 10; | |
4467 LABEL_19: | |
4468 v3 = v9; | |
4469 goto LABEL_20; | |
4470 } | |
4471 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4472 { | |
4473 v5 = 8; | |
4474 v6 = v4 == 0; | |
4475 LABEL_17: | |
4476 if ( !v6 ) | |
4477 goto LABEL_20; | |
4478 v9 = 5; | |
4479 goto LABEL_19; | |
4480 } | |
4481 v5 = 0; | |
4482 LABEL_20: | |
4483 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4484 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4485 result = v7 + *(&v2->sResFireBase + v5); |
4486 return result; | |
4487 } | |
4488 | |
4489 //----- (0048E7D0) -------------------------------------------------------- | |
4490 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4491 { | |
4492 signed int v2; // edi@1 | |
4493 Player *v3; // esi@1 | |
4494 enum CHARACTER_RACE v4; // ebx@1 | |
4495 Player *v5; // ecx@8 | |
4496 char v6; // zf@18 | |
4497 int v7; // ebx@28 | |
4498 int result; // eax@28 | |
4499 signed int v9; // [sp+10h] [bp-8h]@1 | |
4500 signed int v10; // [sp+14h] [bp-4h]@1 | |
4501 | |
4502 v2 = 0; | |
4503 v3 = this; | |
4504 v10 = 0; | |
4505 v9 = 0; | |
4506 v4 = GetRace(); | |
4507 if ( CheckHiredNPCSpeciality(0x25u) ) | |
4508 v10 = 20; | |
4509 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4510 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4511 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4512 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4513 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4514 && HasItemEquipped(EQUIP_ARMOUR) | |
4515 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4516 v10 += v3->pActiveSkills[9] & 0x3F; | |
4517 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4518 goto LABEL_25; | |
4519 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4520 { | |
4521 v2 = 1; | |
4522 LABEL_25: | |
4523 v6 = v4 == 2; | |
4524 LABEL_26: | |
4525 if ( v6 ) | |
4526 v9 = 5; | |
4527 goto LABEL_28; | |
4528 } | |
4529 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4530 { | |
4531 v6 = v4 == 3; | |
4532 v2 = 2; | |
4533 goto LABEL_26; | |
4534 } | |
4535 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4536 { | |
4537 v2 = 3; | |
4538 if ( v4 == 3 ) | |
4539 v10 += 5; | |
4540 } | |
4541 else | |
4542 { | |
4543 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4544 { | |
4545 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4546 goto LABEL_28; | |
4547 v2 = 8; | |
4548 v6 = v4 == 0; | |
4549 goto LABEL_26; | |
4550 } | |
4551 v2 = 7; | |
4552 if ( v4 == 1 ) | |
4553 v9 = 10; | |
4554 } | |
4555 LABEL_28: | |
4556 v7 = GetItemsBonus(a2, 0); | |
4557 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4558 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4559 { |
4560 if ( result > 200 ) | |
4561 result = 200; | |
4562 } | |
4563 return result; | |
4564 } | |
4565 | |
4566 //----- (0048E8F5) -------------------------------------------------------- | |
4567 bool Player::Recover(signed int a2) | |
4568 { | |
4569 Player *v2; // esi@1 | |
4570 signed __int64 v3; // qax@1 | |
4571 bool result; // eax@4 | |
4572 | |
4573 v2 = this; | |
4574 v3 = (signed __int64)((double)(a2 * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)a2); | |
4575 if ( v2->uTimeToRecovery - (signed int)v3 > 0 ) | |
4576 { | |
4577 v2->uTimeToRecovery -= v3; | |
4578 result = 1; | |
4579 } | |
4580 else | |
4581 { | |
4582 v2->uTimeToRecovery = 0; | |
4583 viewparams->bRedrawGameUI = 1; | |
4584 if ( !uActiveCharacter ) | |
4585 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
4586 result = 0; | |
4587 } | |
4588 return result; | |
4589 } | |
4590 | |
4591 //----- (0048E96A) -------------------------------------------------------- | |
4592 void Player::SetRecoveryTime(signed int sRecoveryTime) | |
4593 { | |
4594 signed int v2; // edx@1 | |
4595 | |
4596 v2 = sRecoveryTime; | |
4597 if ( sRecoveryTime < 0 ) | |
4598 v2 = 0; | |
4599 if ( v2 > this->uTimeToRecovery ) | |
4600 this->uTimeToRecovery = v2; | |
4601 if ( pPlayers[uActiveCharacter] == this && !some_active_character ) | |
4602 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
4603 viewparams->bRedrawGameUI = 1; | |
4604 } | |
4605 // 50C0C4: using guessed type int some_active_character; | |
4606 | |
4607 //----- (0048E9B7) -------------------------------------------------------- | |
4608 void Player::RandomizeName() | |
4609 { | |
4610 if (!uExpressionTimePassed) | |
4611 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4612 } | |
4613 | |
4614 //----- (0048E9F4) -------------------------------------------------------- | |
4615 unsigned int Player::GetMajorConditionIdx() | |
4616 { | |
4617 for (uint i = 0; i < 18; ++i) | |
4618 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4619 return pConditionImportancyTable[i]; | |
4620 | |
4621 return 18; | |
4622 } | |
4623 | |
4624 //----- (0048EA1B) -------------------------------------------------------- | |
4625 int Player::_48EA1B_get_static_effect(int a2) | |
4626 { | |
4627 __int16 v2; // cx@1 | |
4628 int v3; // eax@1 | |
4629 | |
4630 v2 = word_4EDFFC[0]; | |
4631 v3 = 0; | |
4632 while ( a2 < v2 && v2 ) | |
4633 v2 = word_4EDFFC[v3++ + 1]; | |
4634 return player_stat_bonuses[v3]; | |
4635 } | |
4636 | |
4637 //----- (0048EA46) -------------------------------------------------------- | |
4638 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4639 { | |
4640 int v2; // edi@1 | |
4641 int v3; // esi@1 | |
4642 int v4; // edx@2 | |
4643 int v5; // eax@3 | |
4644 char *v6; // eax@4 | |
4645 | |
4646 v2 = 0; | |
4647 v3 = 0; | |
4648 while ( 1 ) | |
4649 { | |
4650 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4651 goto LABEL_11; | |
4652 v5 = pEquipment.uOffHand - 1; // BUG | |
4653 // v5 = _this->cEquippedItems.uOffHand - 1; | |
4654 if ( a2 != 17 ) | |
4655 break; | |
4656 v6 = (char *)this + 36 * v5; | |
4657 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4658 return 50; | |
4659 LABEL_11: | |
4660 ++v3; | |
4661 if ( (signed int)v3 >= 16 ) | |
4662 return v2; | |
4663 } | |
377 | 4664 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) |
0 | 4665 goto LABEL_11; |
4666 return 5; | |
4667 } | |
4668 | |
4669 //----- (0048EAAE) -------------------------------------------------------- | |
4670 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4671 { | |
4672 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4673 signed int v4; // eax@1 | |
4674 int v5; // edi@1 | |
4675 Player *v6; // ebx@1 | |
4676 Player *v8; // ecx@48 | |
4677 int v9; // eax@49 | |
4678 int v10; // edx@49 | |
4679 Player *v11; // ecx@55 | |
4680 int v12; // eax@56 | |
4681 int v13; // edx@56 | |
4682 int v14; // ecx@58 | |
4683 int v15; // eax@58 | |
4684 Player *v16; // ecx@61 | |
4685 int v17; // eax@62 | |
4686 Player *v18; // ecx@66 | |
4687 int v19; // eax@67 | |
4688 int v20; // eax@69 | |
4689 Player *v21; // ecx@75 | |
4690 int v22; // eax@76 | |
4691 int v23; // edx@76 | |
4692 int v24; // eax@79 | |
4693 int v25; // ecx@80 | |
4694 int v26; // edi@80 | |
4695 Player *v27; // ecx@84 | |
4696 int v28; // eax@85 | |
4697 int v29; // edx@85 | |
4698 Player *v30; // ecx@96 | |
4699 int v31; // ebp@97 | |
4700 int v32; // eax@98 | |
4701 unsigned int v33; // eax@100 | |
4702 int v34; // eax@103 | |
4703 char v35; // zf@104 | |
4704 char v36; // zf@107 | |
4705 unsigned __int8 v37; // zf@119 | |
4706 char v38; // sf@119 | |
4707 unsigned __int8 v39; // of@119 | |
4708 char v40; // zf@122 | |
4709 char v41; // zf@145 | |
4710 char v42; // zf@164 | |
4711 char v43; // zf@173 | |
4712 char v44; // zf@189 | |
4713 char v45; // zf@198 | |
4714 char v46; // zf@239 | |
4715 int v47; // eax@268 | |
4716 int v48; // eax@269 | |
4717 int v49; // eax@291 | |
4718 char v50; // zf@295 | |
4719 int v51; // eax@306 | |
4720 int v52; // eax@307 | |
4721 char v53; // zf@312 | |
4722 char v54; // zf@336 | |
4723 char v55; // zf@348 | |
4724 int v56; // eax@365 | |
4725 int v57; // ebx@368 | |
4726 signed int v58; // [sp-4h] [bp-20h]@10 | |
4727 signed int v59; // [sp-4h] [bp-20h]@71 | |
4728 signed int v60; // [sp-4h] [bp-20h]@347 | |
4729 int v61; // [sp+10h] [bp-Ch]@1 | |
4730 int v62; // [sp+14h] [bp-8h]@1 | |
4731 int v63; // [sp+18h] [bp-4h]@101 | |
4732 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4733 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4734 | |
4735 v3 = attr; | |
4736 v4 = 36; | |
4737 v5 = 0; | |
4738 v6 = this; | |
4739 v62 = 0; | |
4740 v61 = 0; | |
4741 | |
4742 switch (attr) | |
4743 { | |
4744 case CHARACTER_ATTRIBUTE_LEVEL: | |
4745 if (HasEnchantedItemEquipped(25)) | |
4746 return 5; | |
4747 return 0; | |
4748 }; | |
4749 | |
4750 if ( (signed int)attr > 36 ) | |
4751 { | |
4752 switch ( attr ) | |
4753 { | |
4754 case 37: | |
4755 v58 = 15; | |
4756 goto LABEL_35; | |
4757 case 38: | |
4758 v58 = 16; | |
4759 goto LABEL_35; | |
4760 case 39: | |
4761 v58 = 17; | |
4762 goto LABEL_35; | |
4763 case 40: | |
4764 v58 = 18; | |
4765 goto LABEL_35; | |
4766 case 41: | |
4767 v58 = 19; | |
4768 goto LABEL_35; | |
4769 case 42: | |
4770 v58 = 20; | |
4771 goto LABEL_35; | |
4772 case 43: | |
4773 v58 = 25; | |
4774 goto LABEL_35; | |
4775 case 44: | |
4776 v58 = 5; | |
4777 goto LABEL_35; | |
4778 case 45: | |
4779 v58 = 8; | |
4780 goto LABEL_35; | |
4781 case 46: | |
4782 goto LABEL_36; | |
4783 default: | |
4784 break; | |
4785 } | |
4786 } | |
4787 else | |
4788 { | |
4789 if ( attr == 36 ) | |
4790 { | |
4791 v58 = 14; | |
4792 } | |
4793 else | |
4794 { | |
4795 if ( (signed int)attr > 21 ) | |
4796 { | |
4797 switch ( attr ) | |
4798 { | |
4799 case 22: | |
4800 v58 = 30; | |
4801 break; | |
4802 case 23: | |
4803 v58 = 31; | |
4804 break; | |
4805 case 34: | |
4806 v58 = 12; | |
4807 break; | |
4808 default: | |
4809 if ( attr != 35 ) | |
4810 goto LABEL_38; | |
4811 v58 = 13; | |
4812 break; | |
4813 } | |
4814 } | |
4815 else | |
4816 { | |
4817 switch ( attr ) | |
4818 { | |
4819 case 21: | |
4820 v58 = 33; | |
4821 break; | |
4822 case 16: | |
4823 v58 = 35; | |
4824 break; | |
4825 case 17: | |
4826 v58 = 34; | |
4827 break; | |
4828 case 18: | |
4829 v58 = 29; | |
4830 break; | |
4831 case 19: | |
4832 v58 = 21; | |
4833 break; | |
4834 default: | |
4835 if ( attr != 20 ) | |
4836 goto LABEL_38; | |
4837 v58 = 32; | |
4838 break; | |
4839 } | |
4840 } | |
4841 } | |
4842 LABEL_35: | |
4843 v4 = v58; | |
4844 LABEL_36: | |
4845 if ( !this->pActiveSkills[v4] ) | |
4846 return 0; | |
4847 } | |
4848 LABEL_38: | |
4849 if ( (signed int)attr > 28 ) | |
4850 { | |
4851 if ( (signed int)attr < 29 ) | |
4852 return v5 + v62 + v61; | |
4853 if ( (signed int)attr <= 30 ) | |
4854 { | |
4855 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4856 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4857 return v5 + v62 + v61; |
4858 } | |
4859 if ( attr == 31 ) | |
4860 { | |
4861 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4862 return v5 + v62 + v61; | |
232 | 4863 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4864 v5 = pItemsTable->pItems[v57].uDamageMod; |
4865 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4866 goto LABEL_366; | |
4867 } | |
4868 if ( attr == 32 ) | |
4869 { | |
4870 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4871 return v5 + v62 + v61; | |
232 | 4872 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4873 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4874 LABEL_365: | |
4875 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4876 LABEL_366: | |
4877 v5 += v56; | |
4878 return v5 + v62 + v61; | |
4879 } | |
4880 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4881 return v5 + v62 + v61; | |
4882 LABEL_95: | |
4883 v65 = 0; | |
4884 while ( 1 ) | |
4885 { | |
4886 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4887 goto LABEL_361; | |
4888 v31 = *(&v6->pEquipment.uOffHand + v65) - 1; | |
4889 if ( v3 == 9 ) | |
4890 { | |
4891 v32 = GetEquippedItemEquipType(v65); | |
4892 if ( v32 >= 3 ) | |
4893 { | |
4894 if ( v32 <= 11 ) | |
4895 { | |
4896 v33 = v6->pInventoryItems[v31].uItemID; | |
4897 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4898 } | |
4899 } | |
4900 } | |
4901 v63 = (int)((char *)v6 + 36 * v31); | |
4902 attra = (ItemGen *)(v63 + 532); | |
377 | 4903 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4904 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4905 { |
4906 v34 = attra->uItemID; | |
4907 switch ( attra->uItemID ) | |
4908 { | |
4909 case 0x1F4u: | |
4910 v35 = v3 == 5; | |
4911 goto LABEL_105; | |
4912 case 0x1F5u: | |
4913 v36 = v3 == 0; | |
4914 goto LABEL_108; | |
4915 case 0x1F6u: | |
4916 if ( v3 == 21 ) | |
4917 v61 += 10; | |
4918 v36 = v3 == 2; | |
4919 goto LABEL_108; | |
4920 case 0x1F7u: | |
4921 if ( v3 == 17 ) | |
4922 v61 += 5; | |
4923 if ( v3 == 18 ) | |
4924 v61 += 5; | |
4925 v36 = v3 == 6; | |
4926 goto LABEL_108; | |
4927 case 0x1F8u: | |
4928 goto LABEL_118; | |
4929 case 0x1F9u: | |
4930 v40 = v3 == 3; | |
4931 goto LABEL_123; | |
4932 case 0x1FAu: | |
4933 v35 = v3 == 10; | |
4934 goto LABEL_105; | |
4935 case 0x1FEu: | |
4936 v35 = v3 == 4; | |
4937 goto LABEL_105; | |
4938 case 0x1FFu: | |
4939 if ( v3 == 23 ) | |
4940 v61 += 10; | |
4941 if ( v3 == 22 ) | |
4942 v61 += 10; | |
4943 goto LABEL_361; | |
4944 case 0x200u: | |
4945 if ( v3 == 36 ) | |
4946 { | |
4947 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4948 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4949 } | |
4950 v36 = v3 == 5; | |
4951 LABEL_108: | |
4952 if ( v36 ) | |
4953 v5 += 40; | |
4954 goto LABEL_361; | |
4955 case 0x201u: | |
4956 if ( v3 == 39 ) | |
4957 { | |
4958 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4959 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4960 v62 = v34; | |
4961 } | |
4962 goto LABEL_136; | |
4963 case 0x202u: | |
4964 if ( !v3 ) | |
4965 v5 += 150; | |
4966 if ( v3 == 1 ) | |
4967 v5 -= 40; | |
4968 if ( v3 == 2 ) | |
4969 v5 -= 40; | |
4970 goto LABEL_145; | |
4971 case 0x203u: | |
4972 if ( v3 == 42 ) | |
4973 { | |
4974 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4975 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4976 } | |
4977 if ( v3 == 43 ) | |
4978 v61 += 15; | |
4979 goto LABEL_361; | |
4980 case 0x204u: | |
4981 if ( v3 == 17 ) | |
4982 v61 += 5; | |
4983 if ( v3 == 18 ) | |
4984 v61 += 5; | |
4985 if ( v3 == 6 ) | |
4986 v5 += 50; | |
4987 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4988 goto LABEL_166; | |
4989 v42 = v3 == 15; | |
4990 goto LABEL_165; | |
4991 case 0x205u: | |
4992 if ( v3 == 18 ) | |
4993 v61 += 5; | |
4994 goto LABEL_361; | |
4995 case 0x206u: | |
4996 if ( !v3 ) | |
4997 v5 += 100; | |
4998 if ( v3 == 3 ) | |
4999 v5 += 100; | |
5000 v43 = v3 == 9; | |
5001 goto LABEL_174; | |
5002 case 0x207u: | |
5003 if ( v3 == 45 ) | |
5004 v61 += 5; | |
5005 if ( v3 == 15 ) | |
5006 v5 -= 10; | |
5007 v42 = v3 == 14; | |
5008 LABEL_165: | |
5009 if ( v42 ) | |
5010 LABEL_166: | |
5011 v5 -= 10; | |
5012 goto LABEL_361; | |
5013 case 0x208u: | |
5014 v35 = v3 == 3; | |
5015 goto LABEL_105; | |
5016 case 0x209u: | |
5017 if ( v3 == 2 ) | |
5018 v5 += 15; | |
5019 if ( !v3 ) | |
5020 v5 += 15; | |
5021 v41 = v3 == 6; | |
5022 goto LABEL_146; | |
5023 case 0x20Au: | |
5024 if ( v3 == 46 ) | |
5025 v61 += 15; | |
5026 v44 = v3 == 3; | |
5027 goto LABEL_190; | |
5028 case 0x20Bu: | |
5029 if ( v3 == 34 ) | |
5030 { | |
5031 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5032 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5033 } | |
5034 if ( v3 == 12 ) | |
5035 v5 += 50; | |
5036 if ( v3 == 2 ) | |
5037 v5 += 30; | |
5038 v45 = v3 == 9; | |
5039 goto LABEL_199; | |
5040 case 0x20Cu: | |
5041 if ( !v3 ) | |
5042 v5 += 75; | |
5043 goto LABEL_145; | |
5044 case 0x20Du: | |
5045 if ( v3 == 5 ) | |
5046 v5 += 50; | |
5047 if ( v3 == 6 ) | |
5048 v5 += 50; | |
5049 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5050 goto LABEL_374; | |
5051 v43 = v3 == 15; | |
5052 LABEL_174: | |
5053 if ( v43 ) | |
5054 LABEL_374: | |
5055 v5 -= 15; | |
5056 goto LABEL_361; | |
5057 case 0x20Eu: | |
5058 if ( v3 == 4 ) | |
5059 v5 += 150; | |
5060 if ( v3 == 44 ) | |
5061 v61 += 5; | |
5062 if ( v3 == 9 ) | |
5063 v5 -= 25; | |
5064 goto LABEL_361; | |
5065 case 0x20Fu: | |
5066 if ( v3 == 39 ) | |
5067 { | |
5068 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5069 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5070 v62 = v34; | |
5071 } | |
5072 if ( v3 == 40 ) | |
5073 { | |
5074 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5075 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5076 } | |
5077 LABEL_145: | |
5078 v41 = v3 == 5; | |
5079 LABEL_146: | |
5080 if ( v41 ) | |
5081 v5 -= 40; | |
5082 goto LABEL_361; | |
5083 case 0x210u: | |
5084 if ( v3 == 38 ) | |
5085 { | |
5086 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5087 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5088 } | |
5089 if ( !v3 ) | |
5090 v5 += 75; | |
5091 v44 = v3 == 11; | |
5092 LABEL_190: | |
5093 if ( v44 ) | |
5094 v5 -= 50; | |
5095 goto LABEL_361; | |
5096 case 0x211u: | |
5097 if ( v3 == 5 ) | |
5098 v5 += 100; | |
5099 if ( v3 == 4 ) | |
5100 v5 += 50; | |
5101 v35 = v3 == 11; | |
5102 LABEL_105: | |
5103 if ( v35 ) | |
5104 v5 += 50; | |
5105 goto LABEL_361; | |
5106 case 0x212u: | |
5107 if ( v3 == 1 ) | |
5108 v5 -= 20; | |
5109 v45 = v3 == 2; | |
5110 LABEL_199: | |
5111 if ( v45 ) | |
5112 v5 -= 20; | |
5113 goto LABEL_361; | |
5114 case 0x214u: | |
5115 if ( v3 == 1 ) | |
5116 v5 += 15; | |
5117 v46 = v3 == 2; | |
5118 goto LABEL_240; | |
5119 case 0x215u: | |
5120 if ( v3 == 5 ) | |
5121 v5 += 15; | |
5122 v46 = v3 == 4; | |
5123 goto LABEL_240; | |
5124 case 0x216u: | |
5125 if ( v3 == 10 ) | |
5126 v5 += 30; | |
5127 if ( !v3 ) | |
5128 v5 += 15; | |
5129 goto LABEL_315; | |
5130 case 0x217u: | |
5131 if ( v3 == 21 ) | |
5132 v61 += 5; | |
5133 if ( !v3 ) | |
5134 v5 += 15; | |
5135 goto LABEL_253; | |
5136 case 0x218u: | |
5137 goto LABEL_253; | |
5138 default: | |
5139 goto LABEL_361; | |
5140 } | |
5141 goto LABEL_361; | |
5142 } | |
5143 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5144 { | |
5145 if ( (signed int)v3 >= 0 ) | |
5146 { | |
5147 if ( (signed int)v3 <= 15 ) | |
5148 { | |
5149 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5150 } | |
5151 else | |
5152 { | |
5153 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5154 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5155 } | |
5156 } | |
5157 goto LABEL_361; | |
5158 } | |
5159 v34 = *(int *)(v63 + 544); | |
5160 if ( v34 > 48 ) | |
5161 { | |
5162 switch ( v34 ) | |
5163 { | |
5164 case 54: | |
5165 goto LABEL_315; | |
5166 case 49: | |
5167 if ( v3 == 6 ) | |
5168 goto LABEL_121; | |
5169 v50 = v3 == 1; | |
5170 goto LABEL_296; | |
5171 case 51: | |
5172 if ( v3 != 5 && v3 != 1 ) | |
5173 goto LABEL_309; | |
5174 goto LABEL_121; | |
5175 case 52: | |
5176 if ( v3 == 3 ) | |
5177 goto LABEL_121; | |
5178 v50 = v3 == 4; | |
5179 goto LABEL_296; | |
5180 case 53: | |
5181 if ( !v3 ) | |
5182 goto LABEL_121; | |
5183 v50 = v3 == 2; | |
5184 goto LABEL_296; | |
5185 case 55: | |
5186 v46 = v3 == 6; | |
5187 goto LABEL_240; | |
5188 case 56: | |
5189 if ( !v3 ) | |
5190 goto LABEL_351; | |
5191 v53 = v3 == 3; | |
5192 goto LABEL_350; | |
5193 case 57: | |
5194 if ( v3 == 1 ) | |
5195 goto LABEL_351; | |
5196 v53 = v3 == 2; | |
5197 goto LABEL_350; | |
5198 case 50: | |
5199 if ( v3 == 10 ) | |
5200 v5 += 30; | |
5201 goto LABEL_361; | |
5202 case 60: | |
5203 if ( v3 != 23 ) | |
5204 goto LABEL_336; | |
5205 if ( v5 >= 3 ) | |
5206 goto LABEL_361; | |
5207 v5 = 3; | |
5208 LABEL_336: | |
5209 v54 = v3 == 22; | |
5210 goto LABEL_345; | |
5211 case 61: | |
5212 if ( v3 != 17 ) | |
5213 goto LABEL_340; | |
5214 if ( v5 >= 3 ) | |
5215 goto LABEL_361; | |
5216 v5 = 3; | |
5217 LABEL_340: | |
5218 v54 = v3 == 18; | |
5219 goto LABEL_345; | |
5220 case 62: | |
5221 if ( v3 != 19 ) | |
5222 goto LABEL_344; | |
5223 if ( v5 >= 3 ) | |
5224 goto LABEL_361; | |
5225 v5 = 3; | |
5226 LABEL_344: | |
5227 v54 = v3 == 20; | |
5228 LABEL_345: | |
5229 if ( !v54 ) | |
5230 goto LABEL_361; | |
5231 if ( v5 >= 3 ) | |
5232 goto LABEL_361; | |
5233 v60 = 3; | |
5234 goto LABEL_360; | |
5235 case 67: | |
5236 v55 = v3 == 18; | |
5237 goto LABEL_357; | |
5238 case 68: | |
5239 v53 = v3 == 9; | |
5240 goto LABEL_350; | |
5241 case 69: | |
5242 if ( v3 == 11 ) | |
5243 v5 += 20; | |
5244 break; | |
5245 case 70: | |
5246 if ( v3 == 12 ) | |
5247 v5 += 10; | |
5248 v55 = v3 == 16; | |
5249 LABEL_357: | |
5250 if ( v55 && v5 < 2 ) | |
5251 { | |
5252 v60 = 2; | |
5253 LABEL_360: | |
5254 v5 = v60; | |
5255 } | |
5256 break; | |
5257 default: | |
5258 goto LABEL_361; | |
5259 } | |
5260 goto LABEL_361; | |
5261 } | |
5262 if ( v34 == 48 ) | |
5263 { | |
5264 if ( v3 == 9 ) | |
5265 v5 += 5; | |
5266 LABEL_315: | |
5267 v46 = v3 == 3; | |
5268 LABEL_240: | |
5269 if ( v46 ) | |
5270 v5 += 15; | |
5271 goto LABEL_361; | |
5272 } | |
5273 if ( v34 > 32 ) | |
5274 { | |
5275 if ( v34 > 44 ) | |
5276 { | |
5277 v51 = v34 - 45; | |
5278 if ( !v51 ) | |
5279 { | |
5280 if ( v3 == 5 ) | |
5281 goto LABEL_351; | |
5282 v53 = v3 == 4; | |
5283 LABEL_350: | |
5284 if ( v53 ) | |
5285 LABEL_351: | |
5286 v5 += 5; | |
5287 goto LABEL_361; | |
5288 } | |
5289 v52 = v51 - 1; | |
5290 if ( !v52 ) | |
5291 { | |
5292 v40 = v3 == 0; | |
5293 LABEL_123: | |
5294 if ( v40 ) | |
5295 v5 += 25; | |
5296 goto LABEL_361; | |
5297 } | |
5298 if ( v52 == 1 ) | |
5299 { | |
5300 LABEL_309: | |
5301 v50 = v3 == 8; | |
5302 goto LABEL_296; | |
5303 } | |
5304 } | |
5305 else | |
5306 { | |
5307 if ( v34 == 44 ) | |
5308 { | |
5309 v50 = v3 == 7; | |
5310 goto LABEL_296; | |
5311 } | |
5312 v34 -= 33; | |
5313 if ( !v34 ) | |
5314 { | |
5315 if ( v3 != 38 ) | |
5316 goto LABEL_361; | |
5317 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5318 goto LABEL_138; | |
5319 } | |
5320 --v34; | |
5321 if ( !v34 ) | |
5322 { | |
5323 if ( v3 != 36 ) | |
5324 goto LABEL_361; | |
5325 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5326 goto LABEL_138; | |
5327 } | |
5328 v49 = v34 - 8; | |
5329 if ( !v49 ) | |
5330 { | |
5331 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5332 ++v5; | |
5333 goto LABEL_361; | |
5334 } | |
5335 if ( v49 == 1 ) | |
5336 { | |
5337 if ( v3 != 3 && v3 != 7 ) | |
5338 { | |
5339 v50 = v3 == 9; | |
5340 LABEL_296: | |
5341 if ( !v50 ) | |
5342 goto LABEL_361; | |
5343 } | |
5344 LABEL_121: | |
5345 v5 += 10; | |
5346 goto LABEL_361; | |
5347 } | |
5348 } | |
5349 } | |
5350 else | |
5351 { | |
5352 if ( v34 == 32 ) | |
5353 { | |
5354 if ( v3 != 39 ) | |
5355 goto LABEL_361; | |
5356 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5357 goto LABEL_138; | |
5358 } | |
5359 if ( v34 > 28 ) | |
5360 { | |
5361 v34 -= 29; | |
5362 if ( v34 ) | |
5363 { | |
5364 --v34; | |
5365 if ( v34 ) | |
5366 { | |
5367 --v34; | |
5368 if ( v34 || v3 != 41 ) | |
5369 goto LABEL_361; | |
5370 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5371 } | |
5372 else | |
5373 { | |
5374 if ( v3 != 34 ) | |
5375 goto LABEL_361; | |
5376 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5377 } | |
5378 } | |
5379 else | |
5380 { | |
5381 if ( v3 != 37 ) | |
5382 goto LABEL_361; | |
5383 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5384 } | |
5385 goto LABEL_138; | |
5386 } | |
5387 if ( v34 == 28 ) | |
5388 { | |
5389 LABEL_136: | |
5390 if ( v3 == 42 ) | |
5391 { | |
5392 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5393 LABEL_138: | |
5394 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5395 goto LABEL_361; | |
5396 } | |
5397 } | |
5398 else | |
5399 { | |
5400 v47 = v34 - 1; | |
5401 if ( v47 ) | |
5402 { | |
5403 v48 = v47 - 1; | |
5404 if ( v48 ) | |
5405 { | |
5406 v34 = v48 - 24; | |
5407 if ( v34 ) | |
5408 { | |
5409 --v34; | |
5410 if ( v34 || v3 != 40 ) | |
5411 goto LABEL_361; | |
5412 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5413 } | |
5414 else | |
5415 { | |
5416 if ( v3 != 35 ) | |
5417 goto LABEL_361; | |
5418 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5419 } | |
5420 goto LABEL_138; | |
5421 } | |
5422 LABEL_118: | |
5423 if ( (signed int)v3 < 0 ) | |
5424 goto LABEL_361; | |
5425 v39 = __OFSUB__((int)v3, 6); | |
5426 v37 = v3 == 6; | |
5427 v38 = v3 - 6 < 0; | |
5428 } | |
5429 else | |
5430 { | |
5431 LABEL_253: | |
5432 if ( (signed int)v3 < 10 ) | |
5433 goto LABEL_361; | |
5434 v39 = __OFSUB__((int)v3, 15); | |
5435 v37 = v3 == 15; | |
5436 v38 = v3 - 15 < 0; | |
5437 } | |
5438 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5439 goto LABEL_121; | |
5440 } | |
5441 } | |
5442 LABEL_361: | |
5443 ++v65; | |
5444 if ( (signed int)v65 >= 16 ) | |
5445 return v5 + v62 + v61; | |
5446 } | |
5447 } | |
5448 if ( attr == 28 ) | |
5449 { | |
5450 if ( IsUnarmed() != 1 ) | |
5451 { | |
5452 if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) | |
5453 { | |
118 | 5454 v22 = this->GetEquippedItemEquipType(1u); |
0 | 5455 if ( v22 >= 0 ) |
5456 { | |
5457 if ( v22 <= 2 ) | |
5458 { | |
118 | 5459 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
5460 if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) | |
0 | 5461 { |
5462 v24 = v23; | |
5463 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5464 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5465 } | |
5466 else | |
5467 { | |
5468 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5469 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5470 } | |
5471 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5472 } | |
5473 } | |
5474 } | |
5475 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v28 = v27->GetEquippedItemEquipType(0), v28 < 0) || v28 > 2 ) | |
5476 return v5 + v62 + v61; | |
5477 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5478 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5479 goto LABEL_88; | |
5480 } | |
5481 v59 = 3; | |
5482 LABEL_74: | |
5483 v5 = v59; | |
5484 return v5 + v62 + v61; | |
5485 } | |
5486 if ( (signed int)attr < 0 ) | |
5487 return v5 + v62 + v61; | |
5488 if ( (signed int)attr <= 23 ) | |
5489 goto LABEL_95; | |
5490 if ( (signed int)attr <= 24 ) | |
5491 return v5 + v62 + v61; | |
5492 if ( (signed int)attr <= 26 ) | |
5493 { | |
5494 if ( IsUnarmed() == 1 ) | |
5495 { | |
5496 v5 = 0; | |
5497 return v5 + v62 + v61; | |
5498 } | |
5499 if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) | |
5500 { | |
118 | 5501 v17 = this->GetEquippedItemEquipType(1u); |
0 | 5502 if ( v17 >= 0 ) |
5503 { | |
5504 if ( v17 <= 2 ) | |
232 | 5505 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5506 } |
5507 } | |
5508 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 ) | |
5509 return v5 + v62 + v61; | |
232 | 5510 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1]; |
0 | 5511 goto LABEL_365; |
5512 } | |
5513 if ( attr == 27 ) | |
5514 { | |
5515 if ( IsUnarmed() == 1 ) | |
5516 { | |
5517 v5 = 1; | |
5518 return v5 + v62 + v61; | |
5519 } | |
5520 if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) | |
5521 { | |
118 | 5522 v9 = this->GetEquippedItemEquipType(1u); |
0 | 5523 if ( v9 >= 0 ) |
5524 { | |
5525 if ( v9 <= 2 ) | |
5526 { | |
118 | 5527 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
0 | 5528 if ( !v6->pEquipment.uOffHand ) |
5529 { | |
118 | 5530 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5531 ++v5; |
5532 } | |
5533 } | |
5534 } | |
5535 } | |
5536 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v12 = v11->GetEquippedItemEquipType(0), v12 < 0) || v12 > 2 ) | |
5537 return v5 + v62 + v61; | |
118 | 5538 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; |
5539 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; | |
0 | 5540 LABEL_88: |
5541 v5 += v15 + v14; | |
5542 } | |
5543 return v5 + v62 + v61; | |
5544 } | |
5545 | |
5546 //----- (0048F73C) -------------------------------------------------------- | |
5547 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5548 { | |
5549 int result; // eax@1 | |
5550 int v3; // eax@4 | |
5551 int v4; // ecx@5 | |
5552 | |
5553 switch (a2) | |
5554 { | |
5555 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5556 } | |
5557 | |
5558 result = 0; | |
5559 if ( (signed int)a2 > 10 ) | |
5560 { | |
5561 if ( (signed int)a2 <= 15 ) | |
5562 { | |
5563 switch ( a2 ) | |
5564 { | |
5565 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5566 v3 = this->pPlayerBuffs[2].uPower; | |
5567 v4 = pParty->pPartyBuffs[1].uPower; | |
5568 break; | |
5569 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5570 v3 = this->pPlayerBuffs[0].uPower; | |
5571 v4 = pParty->pPartyBuffs[0].uPower; | |
5572 break; | |
5573 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5574 v3 = this->pPlayerBuffs[22].uPower; | |
5575 v4 = pParty->pPartyBuffs[17].uPower; | |
5576 break; | |
5577 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5578 v3 = this->pPlayerBuffs[3].uPower; | |
5579 v4 = pParty->pPartyBuffs[4].uPower; | |
5580 break; | |
5581 default: | |
5582 if ( a2 != 14 ) | |
5583 return result; | |
5584 v3 = this->pPlayerBuffs[9].uPower; | |
5585 v4 = pParty->pPartyBuffs[12].uPower; | |
5586 break; | |
5587 } | |
5588 return v4 + v3; | |
5589 } | |
5590 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5591 { | |
5592 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5593 { | |
5594 v3 = this->pPlayerBuffs[8].uPower; | |
5595 v4 = pParty->pPartyBuffs[9].uPower; | |
5596 return v4 + v3; | |
5597 } | |
5598 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5599 return result; | |
5600 } | |
5601 return this->pPlayerBuffs[1].uPower; | |
5602 } | |
5603 if ( a2 == 10 ) | |
5604 { | |
5605 v3 = this->pPlayerBuffs[5].uPower; | |
5606 v4 = pParty->pPartyBuffs[6].uPower; | |
5607 return v4 + v3; | |
5608 } | |
5609 switch ( a2 ) | |
5610 { | |
5611 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5612 v3 = pPlayerBuffs[19].uPower; | |
5613 goto LABEL_5; | |
5614 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5615 v3 = pPlayerBuffs[17].uPower; | |
5616 goto LABEL_5; | |
5617 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5618 v3 = pPlayerBuffs[20].uPower; | |
5619 goto LABEL_5; | |
5620 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5621 v3 = pPlayerBuffs[16].uPower; | |
5622 goto LABEL_5; | |
5623 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5624 v3 = pPlayerBuffs[15].uPower; | |
5625 goto LABEL_5; | |
5626 case CHARACTER_ATTRIBUTE_SPEED: | |
5627 v3 = pPlayerBuffs[21].uPower; | |
5628 goto LABEL_5; | |
5629 case CHARACTER_ATTRIBUTE_LUCK: | |
5630 v3 = pPlayerBuffs[18].uPower; | |
5631 LABEL_5: | |
5632 v4 = pParty->pPartyBuffs[2].uPower; | |
5633 return v4 + v3; | |
5634 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5635 v3 = this->pPlayerBuffs[14].uPower; | |
5636 v4 = pParty->pPartyBuffs[15].uPower; | |
5637 return v4 + v3; | |
5638 default: | |
5639 return result; | |
5640 } | |
5641 return result; | |
5642 } | |
5643 | |
5644 //----- (0048F882) -------------------------------------------------------- | |
353 | 5645 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
0 | 5646 { |
5647 signed int v2; // esi@1 | |
5648 unsigned __int16 v3; // ax@126 | |
5649 char result; // al@127 | |
5650 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5651 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5652 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5653 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5654 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5655 | |
0 | 5656 v2 = 0; |
353 | 5657 switch (uSkillType) |
5658 { | |
5659 case PLAYER_SKILL_MONSTER_ID: | |
5660 { | |
5661 if ( CheckHiredNPCSpeciality(58) ) | |
5662 v2 = 6; | |
5663 if ( CheckHiredNPCSpeciality(57) ) | |
5664 v2 += 6; | |
5665 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5666 v2 += GetItemsBonus(v8, 0); | |
5667 } | |
5668 break; | |
5669 | |
5670 case PLAYER_SKILL_ARMSMASTER: | |
5671 { | |
5672 if ( CheckHiredNPCSpeciality(15) ) | |
0 | 5673 v2 = 2; |
353 | 5674 if ( CheckHiredNPCSpeciality(16) ) |
0 | 5675 v2 += 3; |
353 | 5676 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5677 v2 += GetItemsBonus(v8, 0); | |
5678 } | |
5679 break; | |
5680 | |
5681 case PLAYER_SKILL_STEALING: | |
5682 { | |
5683 if (CheckHiredNPCSpeciality(51)) | |
5684 v2 = 8; | |
5685 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5686 v2 += GetItemsBonus(v8, 0); | |
5687 } | |
5688 break; | |
5689 | |
5690 | |
5691 case PLAYER_SKILL_ALCHEMY: | |
5692 { | |
5693 if ( CheckHiredNPCSpeciality(23) ) | |
5694 v2 = 4; | |
5695 if ( CheckHiredNPCSpeciality(24) ) | |
5696 v2 += 8; | |
5697 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5698 v2 += GetItemsBonus(v8, 0); | |
5699 } | |
5700 break; | |
5701 | |
5702 case PLAYER_SKILL_LEARNING: | |
5703 { | |
5704 if ( CheckHiredNPCSpeciality(13) ) | |
5705 v2 = 10; | |
5706 if ( CheckHiredNPCSpeciality(14) ) | |
5707 v2 += 15; | |
5708 if ( CheckHiredNPCSpeciality(4) ) | |
5709 v2 += 5; | |
5710 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5711 v2 += GetItemsBonus(v8, 0); | |
5712 } | |
5713 break; | |
5714 | |
5715 case PLAYER_SKILL_UNARMED: | |
5716 { | |
5717 if (CheckHiredNPCSpeciality(56) ) | |
5718 v2 = 2; | |
5719 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5720 v2 += GetItemsBonus(v8, 0); | |
5721 } | |
5722 break; | |
5723 | |
5724 case PLAYER_SKILL_DODGE: | |
5725 { | |
5726 if ( CheckHiredNPCSpeciality(56) ) | |
5727 v2 = 2; | |
5728 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5729 v2 += GetItemsBonus(v8, 0); | |
5730 } | |
5731 break; | |
5732 | |
5733 case PLAYER_SKILL_BOW: | |
5734 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5735 v2 += GetItemsBonus(v8, 0); | |
5736 break; | |
5737 case PLAYER_SKILL_SHIELD: | |
5738 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5739 v2 += GetItemsBonus(v8, 0); | |
5740 break; | |
5741 | |
5742 case PLAYER_SKILL_EARTH: | |
5743 if ( CheckHiredNPCSpeciality(17) ) | |
5744 v2 = 2; | |
5745 if ( CheckHiredNPCSpeciality(18) ) | |
5746 v2 += 3; | |
5747 if ( CheckHiredNPCSpeciality(19) ) | |
5748 v2 += 4; | |
5749 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5750 v2 += 3; | |
5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5752 v2 += GetItemsBonus(v8, 0); | |
5753 break; | |
5754 case PLAYER_SKILL_FIRE: | |
5755 if ( CheckHiredNPCSpeciality(17) ) | |
5756 v2 = 2; | |
5757 if ( CheckHiredNPCSpeciality(18) ) | |
5758 v2 += 3; | |
5759 if ( CheckHiredNPCSpeciality(19) ) | |
5760 v2 += 4; | |
5761 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5762 v2 += 3; | |
5763 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5764 v2 += GetItemsBonus(v8, 0); | |
5765 break; | |
5766 case PLAYER_SKILL_AIR: | |
5767 if ( CheckHiredNPCSpeciality(17) ) | |
5768 v2 = 2; | |
5769 if ( CheckHiredNPCSpeciality(18) ) | |
5770 v2 += 3; | |
5771 if ( CheckHiredNPCSpeciality(19) ) | |
5772 v2 += 4; | |
5773 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5774 v2 += 3; | |
5775 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5776 v2 += GetItemsBonus(v8, 0); | |
5777 break; | |
5778 case PLAYER_SKILL_WATER: | |
5779 if ( CheckHiredNPCSpeciality(17) ) | |
5780 v2 = 2; | |
5781 if ( CheckHiredNPCSpeciality(18) ) | |
5782 v2 += 3; | |
5783 if ( CheckHiredNPCSpeciality(19) ) | |
5784 v2 += 4; | |
5785 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5786 v2 += 3; | |
5787 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5788 v2 += GetItemsBonus(v8, 0); | |
5789 break; | |
5790 case PLAYER_SKILL_SPIRIT: | |
5791 if ( CheckHiredNPCSpeciality(53) ) | |
5792 v2 = 2; | |
5793 if ( CheckHiredNPCSpeciality(54) ) | |
5794 v2 += 3; | |
5795 if ( CheckHiredNPCSpeciality(55) ) | |
5796 v2 += 4; | |
5797 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5798 v2 += GetItemsBonus(v8, 0); | |
5799 break; | |
5800 case PLAYER_SKILL_MIND: | |
5801 if ( CheckHiredNPCSpeciality(53) ) | |
5802 v2 = 2; | |
5803 if ( CheckHiredNPCSpeciality(54) ) | |
5804 v2 += 3; | |
5805 if ( CheckHiredNPCSpeciality(55) ) | |
5806 v2 += 4; | |
5807 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5808 v2 += GetItemsBonus(v8, 0); | |
5809 break; | |
5810 case PLAYER_SKILL_BODY: | |
5811 if ( CheckHiredNPCSpeciality(53) ) | |
5812 v2 = 2; | |
5813 if ( CheckHiredNPCSpeciality(54) ) | |
5814 v2 += 3; | |
5815 if ( CheckHiredNPCSpeciality(55) ) | |
5816 v2 += 4; | |
5817 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5818 v2 += GetItemsBonus(v8, 0); | |
5819 break; | |
5820 case PLAYER_SKILL_LIGHT: | |
5821 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5822 v2 += GetItemsBonus(v8, 0); | |
5823 break; | |
5824 case PLAYER_SKILL_DARK: | |
5825 { | |
5826 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5827 v2 += GetItemsBonus(v8, 0); | |
5828 } | |
5829 break; | |
5830 | |
5831 case PLAYER_SKILL_MERCHANT: | |
5832 { | |
5833 if ( CheckHiredNPCSpeciality(20) ) | |
5834 v2 = 4; | |
5835 if ( CheckHiredNPCSpeciality(21) ) | |
5836 v2 += 6; | |
5837 if ( CheckHiredNPCSpeciality(48) ) | |
5838 v2 += 3; | |
5839 if ( CheckHiredNPCSpeciality(50) ) | |
5840 v2 += 8; | |
5841 } | |
5842 break; | |
5843 | |
5844 case PLAYER_SKILL_PERCEPTION: | |
5845 { | |
5846 if ( CheckHiredNPCSpeciality(22) ) | |
5847 v2 = 6; | |
5848 if ( CheckHiredNPCSpeciality(47) ) | |
5849 v2 += 5; | |
5850 } | |
5851 break; | |
5852 | |
0 | 5853 case PLAYER_SKILL_ITEM_ID: |
5854 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5855 v2 += GetItemsBonus(v8, 0); |
0 | 5856 break; |
5857 case PLAYER_SKILL_MEDITATION: | |
5858 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5859 v2 += GetItemsBonus(v8, 0); |
5860 break; | |
0 | 5861 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5862 { |
5863 if ( CheckHiredNPCSpeciality(25) ) | |
5864 v2 = 4; | |
5865 if ( CheckHiredNPCSpeciality(26) ) | |
5866 v2 += 6; | |
5867 if ( CheckHiredNPCSpeciality(51) ) | |
5868 v2 += 8; | |
0 | 5869 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5870 v2 += GetItemsBonus(v8, 0); |
5871 } | |
5872 break; | |
5873 } | |
5874 | |
5875 v3 = pActiveSkills[uSkillType]; | |
5876 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
0 | 5877 result = v2 + v3; |
5878 else | |
5879 result = v3 & 0xFC | 0x3C; | |
5880 return result; | |
5881 } | |
5882 | |
5883 //----- (0048FC00) -------------------------------------------------------- | |
5884 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5885 { | |
5886 Player *v2; // esi@1 | |
5887 int v3; // eax@1 | |
5888 char v4; // di@1 | |
5889 signed int v5; // ebx@1 | |
5890 unsigned int v6; // eax@2 | |
5891 unsigned __int8 v7; // sf@5 | |
5892 unsigned __int8 v8; // of@5 | |
5893 PlayerEquipment *v9; // ebx@19 | |
5894 Player *v10; // ecx@20 | |
5895 enum PLAYER_SKILL_TYPE v11; // edi@21 | |
5896 int v12; // eax@21 | |
5897 int v13; // edi@21 | |
5898 char v14; // di@25 | |
5899 signed int v15; // esi@25 | |
5900 char v16; // al@32 | |
5901 int v18; // eax@36 | |
5902 unsigned int v19; // eax@37 | |
5903 ITEM_EQUIP_TYPE v20; // edi@40 | |
5904 int v21; // edx@41 | |
5905 int v22; // eax@42 | |
5906 enum PLAYER_SKILL_TYPE v23; // edi@45 | |
5907 unsigned __int16 v24; // ax@45 | |
5908 unsigned __int16 v25; // bx@45 | |
5909 unsigned int v26; // eax@45 | |
5910 unsigned __int8 v27; // sf@50 | |
5911 unsigned __int8 v28; // of@50 | |
5912 unsigned int v29; // eax@52 | |
5913 int v30; // eax@55 | |
5914 int v31; // eax@58 | |
5915 unsigned int v32; // eax@59 | |
5916 int v33; // eax@65 | |
5917 char v34; // si@65 | |
5918 ITEM_EQUIP_TYPE v35; // edi@69 | |
5919 int v36; // edx@70 | |
5920 int v37; // eax@71 | |
5921 enum PLAYER_SKILL_TYPE v38; // edi@74 | |
5922 int v39; // eax@74 | |
5923 int v40; // eax@89 | |
5924 char v41; // si@89 | |
5925 int v42; // eax@96 | |
5926 enum PLAYER_SKILL_TYPE v43; // edx@97 | |
5927 int v44; // eax@97 | |
5928 int v45; // eax@98 | |
5929 int v46; // eax@99 | |
5930 int v47; // eax@100 | |
5931 int v48; // eax@101 | |
5932 int v49; // eax@102 | |
5933 unsigned __int16 v50; // ax@113 | |
5934 char v51; // di@113 | |
5935 unsigned int v52; // eax@113 | |
5936 int v53; // edi@113 | |
5937 signed int i; // ecx@113 | |
5938 unsigned __int16 v55; // ax@118 | |
5939 char v56; // si@118 | |
5940 unsigned int v57; // eax@118 | |
5941 int v58; // esi@121 | |
5942 signed int j; // ecx@121 | |
5943 int v60; // edi@126 | |
5944 int v61; // eax@126 | |
5945 signed int v62; // [sp-4h] [bp-30h]@26 | |
5946 signed int v63; // [sp-4h] [bp-30h]@80 | |
5947 int v64; // [sp+Ch] [bp-20h]@104 | |
5948 int v65; // [sp+10h] [bp-1Ch]@104 | |
5949 int v66; // [sp+14h] [bp-18h]@104 | |
5950 int v67; // [sp+18h] [bp-14h]@104 | |
5951 int v68; // [sp+1Ch] [bp-10h]@69 | |
5952 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5953 int v70; // [sp+24h] [bp-8h]@1 | |
5954 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5955 int a1; // [sp+34h] [bp+8h]@21 | |
5956 int a1a; // [sp+34h] [bp+8h]@74 | |
5957 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5958 | |
5959 v2 = this; | |
5960 v70 = 0; | |
5961 v69 = 0; | |
5962 v71 = (ITEM_EQUIP_TYPE)0; | |
5963 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5964 v4 = v3; | |
5965 v5 = 1; | |
5966 if ( v3 ) | |
5967 { | |
5968 v6 = SkillToMastery(v3); | |
5969 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5970 { | |
5971 if ( (signed int)v6 >= 4 ) | |
5972 goto LABEL_4; | |
5973 v8 = __OFSUB__(v6, 3); | |
5974 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5975 } | |
5976 else | |
5977 { | |
5978 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5979 goto LABEL_11; | |
5980 if ( (signed int)v6 >= 4 ) | |
5981 { | |
5982 LABEL_4: | |
5983 v71 = (ITEM_EQUIP_TYPE)2; | |
5984 LABEL_11: | |
5985 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5986 goto LABEL_12; | |
5987 } | |
5988 v8 = __OFSUB__(v6, 2); | |
5989 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5990 } | |
5991 if ( !(v7 ^ v8) ) | |
5992 v71 = (ITEM_EQUIP_TYPE)1; | |
5993 goto LABEL_11; | |
5994 } | |
5995 LABEL_12: | |
5996 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5997 { | |
135 | 5998 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5999 v61 = v2->GetBodybuilding(); |
6000 return v60 * v61; | |
6001 } | |
6002 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
6003 { | |
135 | 6004 v60 = pBaseManaPerLevelByClass[v2->classType]; |
0 | 6005 v61 = v2->GetMediatation(); |
6006 return v60 * v61; | |
6007 } | |
6008 if ( a2 != 9 ) | |
6009 { | |
6010 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
6011 { | |
6012 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
6013 return v70; | |
6014 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
6015 { | |
6016 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
6017 return v70; | |
6018 v71 = (ITEM_EQUIP_TYPE)0; | |
6019 v9 = &v2->pEquipment; | |
6020 while ( 1 ) | |
6021 { | |
6022 if ( v2->HasItemEquipped(v71) ) | |
6023 { | |
118 | 6024 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
6025 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 6026 a1 = v12; |
6027 SkillToMastery(v12); | |
6028 v13 = v11 - 5; | |
6029 if ( !v13 ) | |
6030 return a1 & 0x3F; | |
6031 if ( v13 == 2 ) | |
6032 break; | |
6033 } | |
6034 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
6035 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
6036 if ( (signed int)v71 >= 16 ) | |
6037 return v70; | |
6038 } | |
6039 v14 = a1; | |
6040 v15 = 1; | |
6041 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
6042 { | |
6043 v62 = 5; | |
6044 goto LABEL_31; | |
6045 } | |
6046 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6047 { | |
6048 v62 = 3; | |
6049 goto LABEL_31; | |
6050 } | |
6051 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6052 goto LABEL_32; | |
6053 goto LABEL_30; | |
6054 } | |
6055 if ( v2->IsUnarmed() ) | |
6056 { | |
6057 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6058 v14 = v18; | |
6059 if ( !v18 ) | |
6060 return v70; | |
6061 v15 = 0; | |
6062 v19 = SkillToMastery(v18); | |
6063 if ( (signed int)v19 < 3 ) | |
6064 { | |
6065 if ( (signed int)v19 >= 2 ) | |
6066 v15 = 1; | |
6067 LABEL_32: | |
6068 v16 = v14; | |
6069 return v15 * (v16 & 0x3F); | |
6070 } | |
6071 LABEL_30: | |
6072 v62 = 2; | |
6073 LABEL_31: | |
6074 v15 = v62; | |
6075 goto LABEL_32; | |
6076 } | |
6077 v20 = (ITEM_EQUIP_TYPE)0; | |
6078 while ( 1 ) | |
6079 { | |
6080 if ( v2->HasItemEquipped(v20) ) | |
6081 { | |
118 | 6082 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6083 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6084 break; | |
6085 } | |
6086 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6087 if ( (signed int)v20 >= 16 ) | |
6088 return v70; | |
6089 } | |
6090 v71 = (ITEM_EQUIP_TYPE)0; | |
6091 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6092 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6093 v25 = v24; | |
6094 v26 = SkillToMastery(v24); | |
6095 if ( !v23 ) | |
6096 { | |
6097 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6098 { | |
6099 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6100 LOBYTE(v25) = v31; | |
6101 if ( v31 ) | |
6102 { | |
6103 v15 = 0; | |
6104 v32 = SkillToMastery(v31); | |
6105 if ( (signed int)v32 < 3 ) | |
6106 { | |
6107 if ( (signed int)v32 >= 2 ) | |
6108 v15 = 1; | |
6109 } | |
6110 else | |
6111 { | |
6112 v15 = 2; | |
6113 } | |
6114 v16 = v25; | |
6115 return v15 * (v16 & 0x3F); | |
6116 } | |
6117 } | |
6118 goto LABEL_55; | |
6119 } | |
6120 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6121 { | |
6122 v29 = SkillToMastery(v25); | |
6123 v28 = __OFSUB__(v29, 4); | |
6124 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6125 } | |
6126 else | |
6127 { | |
6128 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6129 goto LABEL_55; | |
6130 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6131 { | |
6132 if ( v23 == PLAYER_SKILL_MACE ) | |
6133 { | |
6134 v28 = __OFSUB__(v26, 2); | |
118 | 6135 v27 = v26 - 2 < 0; |
0 | 6136 goto LABEL_53; |
6137 } | |
6138 LABEL_55: | |
6139 v30 = v71 * (v25 & 0x3F); | |
6140 return (int)((char *)v69 + v30); | |
6141 } | |
6142 v28 = __OFSUB__(v26, 3); | |
118 | 6143 v27 = v26 - 3 < 0; |
0 | 6144 } |
6145 LABEL_53: | |
6146 if ( !(v27 ^ v28) ) | |
6147 v71 = (ITEM_EQUIP_TYPE)1; | |
6148 goto LABEL_55; | |
6149 } | |
6150 if ( v2->IsUnarmed() == 1 ) | |
6151 { | |
6152 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6153 v34 = v33; | |
6154 if ( !v33 ) | |
6155 return v70; | |
6156 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6157 v5 = 2; | |
6158 v30 = v5 * (v34 & 0x3F); | |
6159 return (int)((char *)v69 + v30); | |
6160 } | |
6161 v35 = (ITEM_EQUIP_TYPE)0; | |
6162 v68 = 0; | |
6163 while ( 1 ) | |
6164 { | |
6165 if ( v2->HasItemEquipped(v35) ) | |
6166 { | |
118 | 6167 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6168 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6169 break; | |
6170 } | |
6171 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6172 if ( (signed int)v35 >= 16 ) | |
6173 return v70; | |
6174 } | |
6175 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6176 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6177 a1a = v39; | |
6178 SkillToMastery(v39); | |
6179 v71 = (ITEM_EQUIP_TYPE)0; | |
6180 if ( v38 ) | |
6181 { | |
6182 if ( (signed int)v38 > 0 ) | |
6183 { | |
6184 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6185 { | |
6186 v71 = (ITEM_EQUIP_TYPE)1; | |
6187 } | |
6188 else | |
6189 { | |
6190 if ( v38 == 7 ) | |
6191 { | |
6192 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6193 { | |
6194 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6195 { | |
6196 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6197 return v5 * (a1a & 0x3F); | |
6198 v63 = 2; | |
6199 } | |
6200 else | |
6201 { | |
6202 v63 = 3; | |
6203 } | |
6204 } | |
6205 else | |
6206 { | |
6207 v63 = 5; | |
6208 } | |
6209 v5 = v63; | |
6210 return v5 * (a1a & 0x3F); | |
6211 } | |
6212 } | |
6213 } | |
6214 } | |
6215 else | |
6216 { | |
6217 v71 = (ITEM_EQUIP_TYPE)1; | |
6218 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6219 { | |
6220 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6221 v41 = v40; | |
6222 if ( v40 ) | |
6223 { | |
6224 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6225 v5 = 2; | |
6226 v68 = v5 * (v41 & 0x3F); | |
6227 } | |
6228 } | |
6229 } | |
6230 v30 = v68 + v71 * (a1a & 0x3F); | |
6231 return (int)((char *)v69 + v30); | |
6232 } | |
6233 a1b = 0; | |
6234 v71 = (ITEM_EQUIP_TYPE)0; | |
6235 v68 = 16; | |
6236 v69 = &v2->pEquipment; | |
6237 do | |
6238 { | |
6239 if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) | |
6240 goto LABEL_117; | |
6241 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6242 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6243 if ( !v44 ) | |
6244 { | |
6245 v64 = 0; | |
6246 v65 = 1; | |
6247 LABEL_111: | |
6248 v66 = 0; | |
6249 goto LABEL_112; | |
6250 } | |
6251 v45 = v44 - 1; | |
6252 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6253 { | |
6254 v64 = 0; | |
6255 v65 = 0; | |
6256 v66 = 0; | |
6257 v67 = 1; | |
6258 goto LABEL_113; | |
6259 } | |
6260 v47 = v46 - 4; | |
6261 if ( v47 ) | |
6262 { | |
6263 v48 = v47 - 1; | |
6264 if ( v48 ) | |
6265 { | |
6266 v49 = v48 - 1; | |
6267 if ( v49 ) | |
6268 { | |
6269 if ( v49 != 1 ) | |
6270 goto LABEL_117; | |
6271 a1b = 1; | |
6272 v64 = 1; | |
6273 v65 = 0; | |
6274 v66 = 0; | |
6275 v67 = 0; | |
6276 goto LABEL_113; | |
6277 } | |
6278 a1b = 1; | |
6279 v64 = 1; | |
6280 v65 = 0; | |
6281 goto LABEL_111; | |
6282 } | |
6283 v71 = (ITEM_EQUIP_TYPE)1; | |
6284 } | |
6285 else | |
6286 { | |
6287 a1b = 1; | |
6288 } | |
6289 v64 = 1; | |
6290 v65 = 0; | |
6291 v66 = 1; | |
6292 LABEL_112: | |
6293 v67 = 0; | |
6294 LABEL_113: | |
6295 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6296 v51 = v50; | |
6297 v52 = SkillToMastery(v50); | |
6298 v53 = v51 & 0x3F; | |
6299 for ( i = 0; i < (signed int)v52; ++i ) | |
6300 { | |
6301 if ( *(&v64 + i) ) | |
6302 v70 += v53; | |
6303 } | |
6304 LABEL_117: | |
6305 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6306 --v68; | |
6307 } | |
6308 while ( v68 ); | |
6309 v64 = 1; | |
6310 v65 = 1; | |
6311 v66 = 1; | |
6312 v67 = 0; | |
6313 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6314 v56 = v55; | |
6315 v57 = SkillToMastery(v55); | |
6316 if ( !a1b && (!v71 || v57 == 4) ) | |
6317 { | |
6318 v58 = v56 & 0x3F; | |
6319 for ( j = 0; j < (signed int)v57; ++j ) | |
6320 { | |
6321 if ( *(&v64 + j) ) | |
6322 v70 += v58; | |
6323 } | |
6324 } | |
6325 return v70; | |
6326 } | |
6327 | |
6328 //----- (00490109) -------------------------------------------------------- | |
6329 // faces are: 0 1 2 3 human males | |
6330 // 4 5 6 7 human females | |
6331 // 8 9 elf males | |
6332 // 10 11 elf females | |
6333 // 12 13 dwarf males | |
6334 // 14 15 dwarf females | |
6335 // 16 17 goblin males | |
6336 // 18 19 goblin females | |
6337 // 20 lich male | |
6338 // 21 lich female | |
6339 // 22 underwater suits (unused) | |
6340 // 23 zombie male | |
6341 // 24 zombie female | |
6342 enum CHARACTER_RACE Player::GetRace() | |
6343 { | |
6344 if ( uFace > 15 ) | |
6345 { | |
6346 if ( uFace >= 16 && uFace <= 19 ) | |
6347 return CHARACTER_RACE_GOBLIN; | |
6348 } | |
6349 else | |
6350 { | |
6351 if ( uFace >= 12 ) | |
6352 { | |
6353 return CHARACTER_RACE_DWARF; | |
6354 } | |
6355 else | |
6356 { | |
6357 if ( uFace >= 0 ) | |
6358 { | |
6359 if ( uFace <= 7 ) | |
6360 { | |
6361 return CHARACTER_RACE_HUMAN; | |
6362 } | |
6363 else | |
6364 { | |
6365 if ( uFace <= 11 ) | |
6366 return CHARACTER_RACE_ELF; | |
6367 } | |
6368 } | |
6369 } | |
6370 } | |
6371 return CHARACTER_RACE_HUMAN; | |
6372 } | |
6373 | |
6374 //----- (00490141) -------------------------------------------------------- | |
187 | 6375 PLAYER_SEX Player::GetSexByVoice() |
0 | 6376 { |
6377 signed int result; // eax@1 | |
6378 | |
6379 result = 0; | |
6380 switch ( this->uVoiceID ) | |
6381 { | |
6382 case 0u: | |
6383 case 1u: | |
6384 case 2u: | |
6385 case 3u: | |
6386 case 8u: | |
6387 case 9u: | |
6388 case 0xCu: | |
6389 case 0xDu: | |
6390 case 0x10u: | |
6391 case 0x11u: | |
6392 case 0x14u: | |
6393 case 0x17u: | |
187 | 6394 return SEX_MALE; |
6395 | |
0 | 6396 case 4u: |
6397 case 5u: | |
6398 case 6u: | |
6399 case 7u: | |
6400 case 0xAu: | |
6401 case 0xBu: | |
6402 case 0xEu: | |
6403 case 0xFu: | |
6404 case 0x12u: | |
6405 case 0x13u: | |
6406 case 0x15u: | |
6407 case 0x18u: | |
187 | 6408 return SEX_FEMALE; |
6409 | |
0 | 6410 default: |
187 | 6411 assert(false); |
6412 } | |
0 | 6413 } |
6414 | |
6415 //----- (00490188) -------------------------------------------------------- | |
6416 void Player::SetInitialStats() | |
6417 { | |
6418 auto v1 = GetRace(); | |
290 | 6419 uMight = StatTable[v1][0].uBaseValue; |
6420 uIntelligence = StatTable[v1][1].uBaseValue; | |
6421 uWillpower = StatTable[v1][2].uBaseValue; | |
6422 uEndurance = StatTable[v1][3].uBaseValue; | |
6423 uAccuracy = StatTable[v1][4].uBaseValue; | |
6424 uSpeed = StatTable[v1][5].uBaseValue; | |
6425 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6426 } |
6427 | |
6428 //----- (004901FC) -------------------------------------------------------- | |
6429 int Player::SetSexByVoice() | |
6430 { | |
6431 __int64 v1; // qax@1 | |
6432 | |
6433 v1 = this->uVoiceID; | |
6434 switch ( (int)v1 ) | |
6435 { | |
6436 case 0: | |
6437 case 1: | |
6438 case 2: | |
6439 case 3: | |
6440 case 8: | |
6441 case 9: | |
6442 case 0xC: | |
6443 case 0xD: | |
6444 case 0x10: | |
6445 case 0x11: | |
6446 case 0x14: | |
6447 case 0x17: | |
6448 BYTE4(v1) = 0; | |
6449 break; | |
6450 case 4: | |
6451 case 5: | |
6452 case 6: | |
6453 case 7: | |
6454 case 0xA: | |
6455 case 0xB: | |
6456 case 0xE: | |
6457 case 0xF: | |
6458 case 0x12: | |
6459 case 0x13: | |
6460 case 0x15: | |
6461 case 0x18: | |
6462 BYTE4(v1) = 1; | |
6463 break; | |
6464 default: | |
6465 break; | |
6466 } | |
6467 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6468 return v1; | |
6469 } | |
6470 | |
6471 //----- (0049024A) -------------------------------------------------------- | |
135 | 6472 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6473 { |
6474 sLevelModifier = 0; | |
6475 sAgeModifier = 0; | |
6476 | |
135 | 6477 classType = cls; |
0 | 6478 uLuckBonus = 0; |
6479 uSpeedBonus = 0; | |
6480 uAccuracyBonus = 0; | |
6481 uEnduranceBonus = 0; | |
6482 uWillpowerBonus = 0; | |
6483 uIntelligenceBonus = 0; | |
6484 uMightBonus = 0; | |
6485 uLevel = 1; | |
6486 uExperience = 251 + rand() % 100; | |
6487 uBirthYear = 1147 - rand() % 6; | |
6488 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6489 memset(_guilds_member_bits, 0, 64); |
0 | 6490 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6491 | |
6492 for (uint i = 0; i < 37; ++i) | |
6493 { | |
135 | 6494 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6495 continue; |
6496 | |
6497 pActiveSkills[i] = 1; | |
6498 | |
6499 switch (i) | |
6500 { | |
198 | 6501 case PLAYER_SKILL_FIRE: spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; break; |
6502 case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; break; | |
6503 case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; break; | |
6504 case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; break; | |
6505 case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break; | |
6506 case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; break; | |
6507 case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; break; | |
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) -------------------------------------------------------- | |
6518 enum PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) | |
6519 { | |
6520 enum PLAYER_SKILL_TYPE result; // eax@5 | |
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 void *result; // eax@1 | |
6762 | |
6763 v1 = this; | |
6764 this->sLevelModifier = 0; | |
6765 this->sACModifier = 0; | |
6766 this->uLuckBonus = 0; | |
6767 this->uAccuracyBonus = 0; | |
6768 this->uSpeedBonus = 0; | |
6769 this->uEnduranceBonus = 0; | |
6770 this->uWillpowerBonus = 0; | |
6771 this->uIntelligenceBonus = 0; | |
6772 this->uMightBonus = 0; | |
6773 this->field_100 = 0; | |
6774 this->field_FC = 0; | |
6775 this->field_F8 = 0; | |
6776 this->field_F4 = 0; | |
6777 this->field_F0 = 0; | |
6778 this->field_EC = 0; | |
6779 this->field_E8 = 0; | |
6780 this->field_E4 = 0; | |
6781 this->field_E0 = 0; | |
6782 result = memset(&this->sResFireBonus, 0, 0x16u); | |
6783 v1->field_1A97 = 0; | |
6784 v1->_ranged_dmg_bonus = 0; | |
6785 v1->field_1A95 = 0; | |
6786 v1->_ranged_atk_bonus = 0; | |
6787 v1->field_1A93 = 0; | |
6788 v1->_melee_dmg_bonus = 0; | |
6789 v1->field_1A91 = 0; | |
6790 v1->_some_attack_bonus = 0; | |
6791 v1->_mana_related = 0; | |
6792 v1->uFullManaBonus = 0; | |
6793 v1->_health_related = 0; | |
6794 v1->uFullHealthBonus = 0; | |
6795 } | |
6796 | |
6797 //----- (004907E7) -------------------------------------------------------- | |
299 | 6798 unsigned int Player::GetStatColor(int uStat) |
0 | 6799 { |
6800 __int16 uWhite; // si@1 | |
290 | 6801 int attribute_value; // edx@1 |
299 | 6802 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6803 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6804 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6805 | |
6806 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6807 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6808 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
299 | 6809 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6810 |
0 | 6811 switch (uStat) |
6812 { | |
6813 case 0: attribute_value = uMight; break; | |
6814 case 1: attribute_value = uIntelligence; break; | |
6815 case 2: attribute_value = uWillpower; break; | |
6816 case 3: attribute_value = uEndurance; break; | |
290 | 6817 case 4: attribute_value = uAccuracy; break; |
6818 case 5: attribute_value = uSpeed; break; | |
0 | 6819 case 6: attribute_value = uLuck; break; |
6820 }; | |
6821 | |
299 | 6822 if ( attribute_value == pBaseAttrValue ) |
290 | 6823 return uWhite; |
299 | 6824 else if ( attribute_value > pBaseAttrValue ) |
290 | 6825 return uGreen; |
0 | 6826 else |
290 | 6827 return uRed; |
0 | 6828 } |
6829 | |
6830 //----- (004908A8) -------------------------------------------------------- | |
6831 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6832 { | |
6833 unsigned __int64 *result; // eax@1 | |
6834 | |
6835 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6836 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6837 { | |
6838 *(int *)result = 0; | |
6839 *((int *)result + 1) = 0; | |
6840 LOBYTE(result) = 1; | |
6841 } | |
6842 else | |
6843 { | |
6844 LOBYTE(result) = 0; | |
6845 } | |
6846 return (bool)result; | |
6847 } | |
6848 | |
6849 //----- (004680ED) -------------------------------------------------------- | |
6850 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6851 { | |
6852 Player *v3; // esi@1 | |
6853 unsigned int v4; // ebx@4 | |
6854 signed int v5; // eax@17 | |
6855 unsigned int v6; // eax@26 | |
6856 unsigned __int8 v7; // cf@37 | |
6857 int v8; // edx@39 | |
6858 int v9; // edx@40 | |
6859 int v10; // edx@41 | |
6860 int v11; // edx@42 | |
6861 int v12; // edx@43 | |
6862 char *v13; // eax@45 | |
6863 AudioPlayer *v14; // ecx@62 | |
6864 signed int v15; // edi@68 | |
6865 int v16; // edx@73 | |
6866 unsigned __int16 *v17; // edi@73 | |
6867 unsigned int v18; // eax@73 | |
6868 int v19; // eax@74 | |
6869 int v20; // eax@75 | |
6870 signed int v21; // eax@81 | |
6871 const char *v22; // eax@84 | |
6872 char *v23; // ecx@90 | |
6873 int v24; // esi@96 | |
6874 int v25; // eax@109 | |
6875 int v26; // eax@113 | |
6876 char *v27; // edi@114 | |
6877 signed __int64 v28; // qax@120 | |
6878 char *v29; // ecx@120 | |
6879 int v30; // edi@137 | |
6880 int v31; // ST30_4@137 | |
6881 int v32; // ST3C_4@137 | |
6882 int v33; // ST40_4@137 | |
6883 int v34; // ST34_4@137 | |
6884 int v35; // ST38_4@137 | |
6885 unsigned __int8 v36; // al@173 | |
6886 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6887 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6888 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6889 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6890 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6891 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6892 signed int v43; // [sp-14h] [bp-40h]@18 | |
6893 signed int v44; // [sp-14h] [bp-40h]@174 | |
6894 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6895 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6896 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6897 int v48; // [sp-Ch] [bp-38h]@18 | |
6898 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6899 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6900 int v51; // [sp-Ch] [bp-38h]@174 | |
6901 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6902 char *v53; // [sp-8h] [bp-34h]@33 | |
6903 int v54; // [sp-8h] [bp-34h]@34 | |
6904 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6905 int v56; // [sp-8h] [bp-34h]@66 | |
6906 const char *v57; // [sp-8h] [bp-34h]@69 | |
6907 const char *v58; // [sp-8h] [bp-34h]@89 | |
6908 int v59; // [sp-8h] [bp-34h]@120 | |
6909 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6910 int v61; // [sp-4h] [bp-30h]@18 | |
6911 char *v62; // [sp-4h] [bp-30h]@33 | |
6912 char *v63; // [sp-4h] [bp-30h]@34 | |
6913 int v64; // [sp-4h] [bp-30h]@60 | |
6914 int v65; // [sp-4h] [bp-30h]@66 | |
6915 const char *v66; // [sp-4h] [bp-30h]@69 | |
6916 signed int v67; // [sp-4h] [bp-30h]@77 | |
6917 const char *v68; // [sp-4h] [bp-30h]@89 | |
6918 int v69; // [sp-4h] [bp-30h]@110 | |
6919 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6920 int v71; // [sp-4h] [bp-30h]@174 | |
6921 char *v72; // [sp+20h] [bp-Ch]@68 | |
6922 signed int v73; // [sp+24h] [bp-8h]@1 | |
6923 char *v74; // [sp+24h] [bp-8h]@23 | |
6924 int v75; // [sp+24h] [bp-8h]@73 | |
6925 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6926 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6927 | |
6928 thisb = this; | |
243 | 6929 v3 = &pParty->pPlayers[a2-1]; |
0 | 6930 v73 = 1; |
6931 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6932 return; | |
6933 v4 = 0; | |
6934 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6935 { | |
6936 if ( pParty->pPickedItem.uItemID != 160 ) | |
6937 { | |
6938 if ( pParty->pPickedItem.uItemID == 161 ) | |
6939 { | |
6940 v27 = (char *)&v3->sMana; | |
6941 *(int *)v27 += 2; | |
6942 LABEL_170: | |
6943 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6944 *(int *)v27 = v3->GetMaxMana(); | |
6945 } | |
6946 else | |
6947 { | |
6948 if ( pParty->pPickedItem.uItemID != 162 ) | |
6949 { | |
6950 LABEL_167: | |
6951 v68 = pParty->pPickedItem.GetDisplayName(); | |
6952 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6953 goto LABEL_90; | |
6954 } | |
6955 v69 = 2; | |
6956 LABEL_111: | |
243 | 6957 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6958 } |
6959 LABEL_112: | |
187 | 6960 v3->PlaySound(SPEECH_36, 0); |
0 | 6961 goto LABEL_173; |
6962 } | |
6963 LABEL_172: | |
100 | 6964 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6965 goto LABEL_173; |
6966 } | |
6967 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6968 { | |
6969 switch ( pParty->pPickedItem.uItemID ) | |
6970 { | |
6971 case 0xDEu: | |
377 | 6972 v25 = pParty->pPickedItem.uEncantmentType + 10; |
0 | 6973 goto LABEL_110; |
6974 case 0xDFu: | |
377 | 6975 v26 = pParty->pPickedItem.uEncantmentType + 10; |
0 | 6976 goto LABEL_114; |
6977 case 0xE0u: | |
6978 LODWORD(v3->pConditions[1]) = 0; | |
6979 HIDWORD(v3->pConditions[1]) = 0; | |
6980 goto LABEL_112; | |
6981 case 0xE1u: | |
6982 LODWORD(v3->pConditions[11]) = 0; | |
6983 HIDWORD(v3->pConditions[11]) = 0; | |
6984 LODWORD(v3->pConditions[9]) = 0; | |
6985 HIDWORD(v3->pConditions[9]) = 0; | |
6986 LODWORD(v3->pConditions[7]) = 0; | |
6987 HIDWORD(v3->pConditions[7]) = 0; | |
6988 goto LABEL_112; | |
6989 case 0xE2u: | |
6990 LODWORD(v3->pConditions[10]) = 0; | |
6991 HIDWORD(v3->pConditions[10]) = 0; | |
6992 LODWORD(v3->pConditions[8]) = 0; | |
6993 HIDWORD(v3->pConditions[8]) = 0; | |
6994 LODWORD(v3->pConditions[6]) = 0; | |
6995 HIDWORD(v3->pConditions[6]) = 0; | |
6996 goto LABEL_112; | |
6997 case 0xE3u: | |
6998 LODWORD(v3->pConditions[2]) = 0; | |
6999 HIDWORD(v3->pConditions[2]) = 0; | |
7000 goto LABEL_112; | |
7001 case 0xE4u: | |
7002 if ( v3->pConditions[1] ) | |
7003 goto LABEL_173; | |
7004 v70 = 0; | |
7005 v59 = 0; | |
7006 v50 = 5; | |
7007 v46 = 3; | |
377 | 7008 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7009 v29 = (char *)&v3->pPlayerBuffs[7]; |
7010 goto LABEL_147; | |
7011 case 0xE5u: | |
7012 v70 = 0; | |
7013 v59 = 0; | |
7014 v50 = 5; | |
7015 v46 = 3; | |
377 | 7016 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7017 v29 = (char *)&v3->pPlayerBuffs[8]; |
7018 goto LABEL_147; | |
7019 case 0xE6u: | |
7020 v70 = 0; | |
7021 v59 = 0; | |
7022 v50 = 5; | |
7023 v46 = 3; | |
377 | 7024 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7025 v29 = (char *)&v3->pPlayerBuffs[1]; |
7026 goto LABEL_147; | |
7027 case 0xE7u: | |
7028 v70 = 0; | |
7029 v59 = 0; | |
377 | 7030 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7031 v46 = 0; |
377 | 7032 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7033 v29 = (char *)&v3->pPlayerBuffs[11]; |
7034 goto LABEL_147; | |
7035 case 0xE8u: | |
7036 v70 = 0; | |
7037 v59 = 0; | |
377 | 7038 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7039 v46 = 0; |
377 | 7040 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7041 v29 = (char *)&v3->pPlayerBuffs[13]; |
7042 goto LABEL_147; | |
7043 case 0xEAu: | |
7044 v70 = 0; | |
7045 v59 = 0; | |
7046 v50 = 5; | |
7047 v46 = 3; | |
377 | 7048 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7049 v29 = (char *)&v3->pPlayerBuffs[14]; |
7050 goto LABEL_147; | |
7051 case 0xEBu: | |
7052 v3->pPlayerBuffs[23].Apply( | |
377 | 7053 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335), |
0 | 7054 3u, |
7055 5u, | |
7056 0, | |
7057 0); | |
7058 goto LABEL_173; | |
7059 case 0xEDu: | |
7060 LODWORD(v3->pConditions[3]) = 0; | |
7061 HIDWORD(v3->pConditions[3]) = 0; | |
7062 goto LABEL_112; | |
7063 case 0xEEu: | |
7064 LODWORD(v3->pConditions[0]) = 0; | |
7065 HIDWORD(v3->pConditions[0]) = 0; | |
7066 goto LABEL_112; | |
7067 case 0xEFu: | |
7068 LODWORD(v3->pConditions[5]) = 0; | |
7069 HIDWORD(v3->pConditions[5]) = 0; | |
7070 goto LABEL_112; | |
7071 case 0xF0u: | |
7072 v70 = 0; | |
7073 v59 = 0; | |
377 | 7074 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7075 v46 = 0; |
377 | 7076 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7077 v29 = (char *)&v3->pPlayerBuffs[19]; |
7078 goto LABEL_147; | |
7079 case 0xF1u: | |
7080 v70 = 0; | |
7081 v59 = 0; | |
377 | 7082 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7083 v46 = 0; |
377 | 7084 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7085 v29 = (char *)&v3->pPlayerBuffs[17]; |
7086 goto LABEL_147; | |
7087 case 0xF2u: | |
7088 v70 = 0; | |
7089 v59 = 0; | |
377 | 7090 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7091 v46 = 0; |
377 | 7092 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7093 v29 = (char *)&v3->pPlayerBuffs[20]; |
7094 goto LABEL_147; | |
7095 case 0xF3u: | |
7096 v70 = 0; | |
7097 v59 = 0; | |
377 | 7098 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7099 v46 = 0; |
377 | 7100 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7101 v29 = (char *)&v3->pPlayerBuffs[16]; |
7102 goto LABEL_147; | |
7103 case 0xF4u: | |
7104 v70 = 0; | |
7105 v59 = 0; | |
377 | 7106 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7107 v46 = 0; |
377 | 7108 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7109 v29 = (char *)&v3->pPlayerBuffs[21]; |
7110 goto LABEL_147; | |
7111 case 0xF5u: | |
7112 v70 = 0; | |
7113 v59 = 0; | |
377 | 7114 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7115 v46 = 0; |
377 | 7116 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7117 v29 = (char *)&v3->pPlayerBuffs[15]; |
7118 goto LABEL_147; | |
7119 case 0xFBu: | |
7120 LODWORD(v3->pConditions[12]) = 0; | |
7121 HIDWORD(v3->pConditions[12]) = 0; | |
7122 goto LABEL_112; | |
7123 case 0xFCu: | |
7124 v30 = LODWORD(v3->pConditions[14]); | |
7125 v31 = HIDWORD(v3->pConditions[14]); | |
7126 v32 = LODWORD(v3->pConditions[15]); | |
7127 v33 = HIDWORD(v3->pConditions[15]); | |
7128 v34 = LODWORD(v3->pConditions[16]); | |
7129 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7130 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7131 HIDWORD(v3->pConditions[14]) = v31; |
7132 LODWORD(v3->pConditions[15]) = v32; | |
7133 HIDWORD(v3->pConditions[15]) = v33; | |
7134 LODWORD(v3->pConditions[16]) = v34; | |
7135 LODWORD(v3->pConditions[14]) = v30; | |
7136 HIDWORD(v3->pConditions[16]) = v35; | |
7137 goto LABEL_112; | |
7138 case 0xFDu: | |
377 | 7139 v25 = 5 * pParty->pPickedItem.uEncantmentType; |
0 | 7140 LABEL_110: |
7141 v69 = v25; | |
7142 goto LABEL_111; | |
7143 case 0xFEu: | |
377 | 7144 v26 = 5 * pParty->pPickedItem.uEncantmentType; |
0 | 7145 LABEL_114: |
7146 v27 = (char *)&v3->sMana; | |
7147 *(int *)v27 += v26; | |
7148 goto LABEL_170; | |
7149 case 0xFFu: | |
7150 v70 = 0; | |
7151 v59 = 0; | |
377 | 7152 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7153 v46 = 0; |
377 | 7154 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7155 v29 = (char *)&v3->pPlayerBuffs[18]; |
7156 goto LABEL_147; | |
7157 case 0x100u: | |
7158 v70 = 0; | |
7159 v59 = 0; | |
377 | 7160 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7161 v46 = 0; |
377 | 7162 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7163 v29 = (char *)&v3->pPlayerBuffs[5]; |
7164 goto LABEL_147; | |
7165 case 0x101u: | |
7166 v70 = 0; | |
7167 v59 = 0; | |
377 | 7168 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7169 v46 = 0; |
377 | 7170 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7171 v29 = (char *)v3->pPlayerBuffs; |
7172 goto LABEL_147; | |
7173 case 0x102u: | |
7174 v70 = 0; | |
7175 v59 = 0; | |
377 | 7176 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7177 v46 = 0; |
377 | 7178 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7179 v29 = (char *)&v3->pPlayerBuffs[22]; |
7180 goto LABEL_147; | |
7181 case 0x103u: | |
7182 v70 = 0; | |
7183 v59 = 0; | |
377 | 7184 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7185 v46 = 0; |
377 | 7186 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7187 v29 = (char *)&v3->pPlayerBuffs[3]; |
7188 goto LABEL_147; | |
7189 case 0x104u: | |
7190 v70 = 0; | |
7191 v59 = 0; | |
377 | 7192 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7193 v46 = 0; |
377 | 7194 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7195 v29 = (char *)&v3->pPlayerBuffs[9]; |
7196 goto LABEL_147; | |
7197 case 0x105u: | |
7198 v70 = 0; | |
7199 v59 = 0; | |
377 | 7200 v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); |
0 | 7201 v46 = 0; |
377 | 7202 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); |
0 | 7203 v29 = (char *)&v3->pPlayerBuffs[2]; |
7204 LABEL_147: | |
7205 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7206 goto LABEL_112; | |
7207 case 0x106u: | |
7208 LODWORD(v3->pConditions[15]) = 0; | |
7209 HIDWORD(v3->pConditions[15]) = 0; | |
7210 goto LABEL_112; | |
7211 case 0x108u: | |
7212 if ( !*(int *)&v3->field_1F5[3] ) | |
7213 { | |
7214 v3->uLuck += 50; | |
7215 *(int *)&v3->field_1F5[3] = 1; | |
7216 } | |
7217 goto LABEL_112; | |
7218 case 0x109u: | |
7219 if ( !*(int *)&v3->field_1F5[7] ) | |
7220 { | |
7221 v3->uSpeed += 50; | |
7222 *(int *)&v3->field_1F5[7] = 1; | |
7223 } | |
7224 goto LABEL_112; | |
7225 case 0x10Au: | |
7226 if ( !*(int *)&v3->field_1F5[11] ) | |
7227 { | |
7228 v3->uIntelligence += 50; | |
7229 *(int *)&v3->field_1F5[11] = 1; | |
7230 } | |
7231 goto LABEL_112; | |
7232 case 0x10Bu: | |
7233 if ( !*(int *)&v3->field_1F5[15] ) | |
7234 { | |
7235 v3->uEndurance += 50; | |
7236 *(int *)&v3->field_1F5[15] = 1; | |
7237 } | |
7238 goto LABEL_112; | |
7239 case 0x10Cu: | |
7240 if ( !*(int *)&v3->field_1F5[19] ) | |
7241 { | |
7242 v3->uWillpower += 50; | |
7243 *(int *)&v3->field_1F5[19] = 1; | |
7244 } | |
7245 goto LABEL_112; | |
7246 case 0x10Du: | |
7247 if ( !*(int *)&v3->field_1F5[23] ) | |
7248 { | |
7249 v3->uAccuracy += 50; | |
7250 *(int *)&v3->field_1F5[23] = 1; | |
7251 } | |
7252 goto LABEL_112; | |
7253 case 0x10Eu: | |
7254 if ( !*(int *)&v3->field_1F5[27] ) | |
7255 { | |
7256 v3->uMight += 50; | |
7257 *(int *)&v3->field_1F5[27] = 1; | |
7258 } | |
7259 goto LABEL_112; | |
7260 case 0x10Fu: | |
7261 v3->sAgeModifier = 0; | |
7262 goto LABEL_112; | |
7263 default: | |
7264 goto LABEL_167; | |
7265 case 0xDDu: | |
7266 goto LABEL_172; | |
7267 } | |
7268 goto LABEL_172; | |
7269 } | |
7270 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7271 { | |
7272 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7273 { | |
7274 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7275 { | |
7276 if ( pParty->pPickedItem.uItemID == 616 ) | |
7277 { | |
7278 thisa = pParty->uCurrentMonthWeek + 1; | |
7279 if ( pParty->uCurrentMonth >= 7 ) | |
7280 v74 = 0; | |
7281 else | |
7282 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7283 switch ( pParty->uCurrentMonth ) | |
7284 { | |
7285 case 0u: | |
7286 v6 = pParty->uCurrentMonthWeek + 1; | |
7287 v3->uMight += thisa; | |
7288 goto LABEL_33; | |
7289 case 1u: | |
7290 v6 = pParty->uCurrentMonthWeek + 1; | |
7291 v3->uIntelligence += thisa; | |
7292 goto LABEL_33; | |
7293 case 2u: | |
7294 v6 = pParty->uCurrentMonthWeek + 1; | |
7295 v3->uWillpower += thisa; | |
7296 goto LABEL_33; | |
7297 case 3u: | |
7298 v6 = pParty->uCurrentMonthWeek + 1; | |
7299 v3->uEndurance += thisa; | |
7300 goto LABEL_33; | |
7301 case 4u: | |
7302 v6 = pParty->uCurrentMonthWeek + 1; | |
7303 v3->uAccuracy += thisa; | |
7304 goto LABEL_33; | |
7305 case 5u: | |
7306 v6 = pParty->uCurrentMonthWeek + 1; | |
7307 v3->uSpeed += thisa; | |
7308 goto LABEL_33; | |
7309 case 6u: | |
7310 v6 = pParty->uCurrentMonthWeek + 1; | |
7311 v3->uLuck += thisa; | |
7312 LABEL_33: | |
7313 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7314 v53 = v74; | |
7315 v49 = v6; | |
7316 goto LABEL_53; | |
7317 case 7u: | |
7318 party_finds_gold(1000 * thisa, 0); | |
7319 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7320 v54 = 1000 * thisa; | |
7321 goto LABEL_38; | |
7322 case 8u: | |
7323 Party::GiveFood(5 * thisa); | |
7324 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7325 v54 = 5 * thisa; | |
7326 goto LABEL_38; | |
7327 case 9u: | |
7328 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7329 v3->uSkillPoints += 2 * thisa; | |
7330 v54 = 2 * thisa; | |
7331 goto LABEL_38; | |
7332 case 0xAu: | |
7333 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7334 v54 = 2500 * thisa; | |
7335 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7336 LODWORD(v3->uExperience) += 2500 * thisa; | |
7337 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7338 LABEL_38: | |
7339 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7340 goto LABEL_54; | |
7341 case 0xBu: | |
7342 v8 = rand() % 6; | |
7343 if ( v8 ) | |
7344 { | |
7345 v9 = v8 - 1; | |
7346 if ( v9 ) | |
7347 { | |
7348 v10 = v9 - 1; | |
7349 if ( v10 ) | |
7350 { | |
7351 v11 = v10 - 1; | |
7352 if ( v11 ) | |
7353 { | |
7354 v12 = v11 - 1; | |
7355 if ( v12 ) | |
7356 { | |
7357 if ( v12 != 1 ) | |
7358 goto LABEL_52; | |
7359 v3->sResBodyBase += thisa; | |
7360 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7361 } | |
7362 else | |
7363 { | |
7364 v3->sResMindBase += thisa; | |
7365 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7366 } | |
7367 } | |
7368 else | |
7369 { | |
7370 v3->sResEarthBase += thisa; | |
7371 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7372 } | |
7373 } | |
7374 else | |
7375 { | |
7376 v3->sResWaterBase += thisa; | |
7377 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7378 } | |
7379 } | |
7380 else | |
7381 { | |
7382 v3->sResAirBase += thisa; | |
7383 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7384 } | |
7385 } | |
7386 else | |
7387 { | |
7388 v3->sResFireBase += thisa; | |
7389 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7390 } | |
7391 v74 = v13; | |
7392 LABEL_52: | |
7393 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7394 v53 = v74; | |
7395 v49 = thisa; | |
7396 LABEL_53: | |
7397 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7398 LABEL_54: | |
7399 ShowStatusBarString(pTmpBuf, 2u); | |
7400 pMouse->RemoveHoldingItem(); | |
7401 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7402 v3->PlaySound(SPEECH_93, 0); |
0 | 7403 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7404 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7405 { | |
7406 v64 = 0; | |
7407 v55 = 16; | |
7408 } | |
7409 else | |
7410 { | |
7411 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7412 { | |
7413 v64 = 0; | |
7414 v55 = 14; | |
7415 } | |
7416 else | |
7417 { | |
7418 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7419 return; | |
7420 v64 = 0; | |
7421 v55 = 15; | |
7422 } | |
7423 } | |
7424 v3->SetCondition(v55, v64); | |
7425 v61 = 0; | |
7426 v52 = 0; | |
7427 v48 = 0; | |
7428 v45 = 0; | |
7429 v43 = -1; | |
7430 v41 = 0; | |
7431 v39 = 0; | |
7432 v37 = (SoundID)215; | |
7433 v14 = pAudioPlayer; | |
7434 goto LABEL_63; | |
7435 default: | |
7436 goto LABEL_54; | |
7437 } | |
7438 } | |
7439 if ( pParty->pPickedItem.uItemID == 630 ) | |
7440 { | |
7441 Party::GiveFood(1u); | |
7442 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7443 } | |
7444 else | |
7445 { | |
7446 if ( pParty->pPickedItem.uItemID == 632 ) | |
7447 { | |
7448 v61 = 0; | |
7449 v52 = 0; | |
7450 v48 = 0; | |
7451 v45 = 0; | |
7452 v43 = -1; | |
7453 v41 = 0; | |
7454 v39 = 0; | |
7455 v37 = (SoundID)133; | |
7456 goto LABEL_93; | |
7457 } | |
7458 if ( pParty->pPickedItem.uItemID == 633 ) | |
7459 { | |
7460 v61 = 0; | |
7461 v52 = 0; | |
7462 v48 = 0; | |
7463 v45 = 0; | |
7464 v43 = -1; | |
7465 v41 = 0; | |
7466 v39 = 0; | |
7467 v37 = (SoundID)134; | |
7468 goto LABEL_93; | |
7469 } | |
7470 if ( pParty->pPickedItem.uItemID == 634 ) | |
7471 { | |
7472 v61 = 0; | |
7473 v52 = 0; | |
7474 v48 = 0; | |
7475 v45 = 0; | |
7476 v43 = -1; | |
7477 v41 = 0; | |
7478 v39 = 0; | |
7479 v37 = (SoundID)135; | |
7480 goto LABEL_93; | |
7481 } | |
7482 if ( pParty->pPickedItem.uItemID != 646 ) | |
7483 { | |
7484 if ( pParty->pPickedItem.uItemID == 650 ) | |
7485 { | |
7486 sub_44C28F_open_nwc_dungeon(); | |
7487 return; | |
7488 } | |
7489 goto LABEL_167; | |
7490 } | |
7491 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7492 v5 = 8 * a2 + 392; | |
7493 LOBYTE(v5) = (8 * a2 - 120) | 4; | |
7494 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); | |
7495 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7496 } | |
7497 LABEL_187: | |
7498 pMouse->RemoveHoldingItem(); | |
7499 return; | |
7500 } | |
243 | 7501 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7502 { |
7503 sub_467F48(pParty->pPickedItem.uItemID); | |
7504 v65 = 0; | |
187 | 7505 v56 = SPEECH_37; |
0 | 7506 LABEL_67: |
187 | 7507 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7508 return; |
7509 } | |
7510 LABEL_89: | |
7511 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7512 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7513 LABEL_90: | |
7514 sprintf(pTmpBuf, v58, v68); | |
7515 v23 = pTmpBuf; | |
7516 LABEL_91: | |
7517 ShowStatusBarString(v23, 2u); | |
7518 v4 = 0; | |
7519 goto LABEL_92; | |
7520 } | |
7521 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7522 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7523 if ( *v72 ) |
7524 { | |
7525 v66 = pParty->pPickedItem.GetDisplayName(); | |
7526 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7527 LABEL_72: | |
7528 sprintf(pTmpBuf, v57, v66); | |
7529 ShowStatusBarString(pTmpBuf, 2u); | |
7530 LABEL_92: | |
7531 v61 = v4; | |
7532 v52 = v4; | |
7533 v48 = v4; | |
7534 v45 = v4; | |
7535 v43 = -1; | |
7536 v41 = v4; | |
7537 v39 = v4; | |
7538 v37 = (SoundID)27; | |
7539 LABEL_93: | |
7540 v14 = pAudioPlayer; | |
7541 LABEL_63: | |
7542 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7543 return; | |
7544 } | |
243 | 7545 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7546 { |
7547 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7548 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7549 goto LABEL_72; | |
7550 } | |
7551 v16 = v15 % 11 + 1; | |
7552 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7553 v75 = v16; | |
7554 v18 = SkillToMastery(*v17) - 1; | |
7555 if ( v18 ) | |
7556 { | |
7557 v19 = v18 - 1; | |
7558 if ( v19 ) | |
7559 { | |
7560 v20 = v19 - 1; | |
7561 if ( v20 ) | |
7562 { | |
7563 if ( v20 != 1 ) | |
7564 { | |
7565 v21 = a2; | |
7566 LABEL_83: | |
7567 if ( v75 > v21 || !*v17 ) | |
7568 { | |
7569 v22 = pParty->pPickedItem.GetDisplayName(); | |
7570 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); | |
7571 ShowStatusBarString(pTmpBuf, 2u); | |
7572 v65 = 0; | |
7573 v56 = 20; | |
7574 goto LABEL_67; | |
7575 } | |
7576 *v72 = 1; | |
187 | 7577 v3->PlaySound(SPEECH_21, 0); |
0 | 7578 v73 = 0; |
7579 LABEL_173: | |
7580 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7581 if ( v36 == 14 ) | |
7582 { | |
7583 v71 = 0; | |
7584 v60 = 0; | |
7585 v51 = 0; | |
7586 v47 = 0; | |
7587 v44 = -1; | |
7588 v42 = 0; | |
7589 v40 = 0; | |
7590 v38 = (SoundID)210; | |
7591 } | |
7592 else | |
7593 { | |
7594 if ( v36 != 13 ) | |
7595 { | |
7596 LABEL_178: | |
7597 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7598 { | |
7599 if ( !v73 ) | |
7600 goto LABEL_187; | |
437 | 7601 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7602 { |
7603 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7604 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7605 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7606 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7607 }*/ |
7608 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7609 } |
7610 if ( v73 ) | |
7611 { | |
7612 if ( pParty->bTurnBasedModeOn ) | |
7613 { | |
7614 *(&pParty->field_16140 + a2) = 100; | |
7615 thisb->SetRecoveryTime(100); | |
7616 pTurnEngine->_40471C(); | |
7617 } | |
7618 else | |
7619 { | |
7620 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7621 } | |
7622 } | |
7623 goto LABEL_187; | |
7624 } | |
7625 v71 = 0; | |
7626 v60 = 0; | |
7627 v51 = 0; | |
7628 v47 = 0; | |
7629 v44 = -1; | |
7630 v42 = 0; | |
7631 v40 = 0; | |
7632 v38 = (SoundID)211; | |
7633 } | |
7634 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7635 goto LABEL_178; | |
7636 } | |
7637 v67 = 11; | |
7638 } | |
7639 else | |
7640 { | |
7641 v67 = 10; | |
7642 } | |
7643 } | |
7644 else | |
7645 { | |
7646 v67 = 7; | |
7647 } | |
7648 } | |
7649 else | |
7650 { | |
7651 v67 = 4; | |
7652 } | |
7653 v21 = v67; | |
7654 goto LABEL_83; | |
7655 } | |
151 | 7656 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7657 return; |
243 | 7658 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7659 goto LABEL_89; |
7660 if ( bUnderwater == 1 ) | |
7661 { | |
7662 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7663 goto LABEL_91; | |
7664 } | |
7665 dword_50C9AC = 1; | |
7666 v24 = pParty->pPickedItem.uItemID - 299; | |
7667 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7668 { | |
7669 pMouse->RemoveHoldingItem(); | |
7670 pGUIWindow_CurrentMenu->Release(); | |
7671 pIcons_LOD->_4114F2(); | |
151 | 7672 pCurrentScreen = SCREEN_GAME; |
0 | 7673 viewparams->bRedrawGameUI = 1; |
7674 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7675 } | |
7676 else | |
7677 { | |
7678 _720984_unused = pParty->pPickedItem.uItemID; | |
7679 pMouse->RemoveHoldingItem(); | |
7680 if ( dword_50C9E8 < 40 ) | |
7681 { | |
7682 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7683 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7684 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7685 ++dword_50C9E8; |
7686 } | |
7687 if ( pCurrentScreen | |
7688 && pGUIWindow_CurrentMenu | |
437 | 7689 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7690 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7691 { | |
7692 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
0 | 7693 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7694 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7695 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7696 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7697 } | |
7698 } | |
7699 } | |
0 | 7700 |
7701 | |
7702 | |
7703 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7704 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7705 { | |
0 | 7706 Player *v3; // esi@1 |
7707 signed int v4; // edi@1 | |
7708 unsigned int v5; // eax@8 | |
7709 int v6; // eax@9 | |
7710 enum CHARACTER_RACE v7; // eax@11 | |
7711 signed int v8; // eax@17 | |
7712 unsigned __int8 v9; // sf@17 | |
7713 unsigned __int8 v10; // of@17 | |
7714 int v11; // eax@19 | |
7715 unsigned int v12; // eax@20 | |
484 | 7716 unsigned int test_bit_value; // eax@25 |
7717 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7718 signed int v15; // ecx@28 |
7719 ItemGen *v16; // eax@28 | |
7720 char v17; // zf@31 | |
7721 int v18; // edi@90 | |
7722 DDM_DLV_Header *v19; // eax@122 | |
7723 char v20; // cl@124 | |
7724 DDM_DLV_Header *v21; // eax@126 | |
7725 unsigned int v22; // edi@129 | |
100 | 7726 Player *v23; // esi@134 |
0 | 7727 ItemGen *v24; // ecx@135 |
7728 signed int v25; // edx@135 | |
7729 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7730 char *v27; // edi@155 | |
7731 int v28; // ebx@161 | |
7732 int v29; // eax@161 | |
7733 | |
469 | 7734 v6 = 0; |
0 | 7735 v3 = this; |
7736 v4 = -1; | |
469 | 7737 if ( VarNum > VAR_AutoNotes ) |
7738 { | |
7739 switch ( VarNum ) | |
0 | 7740 { |
7741 case VAR_Invisible: | |
484 | 7742 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7743 return true; |
484 | 7744 return false; |
0 | 7745 case VAR_NumDeaths: |
7746 v4 = pParty->uNumDeaths; | |
469 | 7747 return v4 >= pValue; |
0 | 7748 case VAR_NumBounties: |
7749 v4 = pParty->uNumBountiesCollected; | |
469 | 7750 return v4 >= pValue; |
0 | 7751 case VAR_PrisonTerms: |
7752 v4 = pParty->uNumPrisonTerms; | |
469 | 7753 return v4 >= pValue; |
0 | 7754 case VAR_ArenaWinsPage: |
7755 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7756 return v4 >= pValue; |
0 | 7757 case VAR_ArenaWinsSquire: |
7758 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7759 return v4 >= pValue; |
0 | 7760 case VAR_ArenaWinsKnight: |
7761 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7762 return v4 >= pValue; |
0 | 7763 case VAR_ArenaWinsLord: |
7764 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7765 return v4 >= pValue; |
0 | 7766 case VAR_ReputationInCurrentLocation: |
7767 v19 = &pOutdoor->ddm; | |
7768 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7769 v19 = &pIndoor->dlv; | |
469 | 7770 v6 = v19->uReputation >= pValue; |
7771 return v6; | |
0 | 7772 case VAR_History_28|VAR_Sex: |
7773 v21 = &pOutdoor->ddm; | |
7774 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7775 v21 = &pIndoor->dlv; | |
469 | 7776 v6 = v21->field_C_alert == pValue; |
0 | 7777 return v6; |
7778 case VAR_MonthEquals2|VAR_Sex: | |
7779 case VAR_MonthEquals2|VAR_Class: | |
7780 case VAR_Counter1: | |
7781 case VAR_Counter2: | |
7782 case VAR_Counter3: | |
7783 case VAR_Counter4: | |
7784 case VAR_Counter5: | |
7785 case VAR_Counter6: | |
7786 case VAR_Counter7: | |
7787 case VAR_Counter8: | |
469 | 7788 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7789 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7790 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7791 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7792 return true; | |
7793 return false; | |
0 | 7794 case VAR_NumSkillPoints: |
7795 v4 = this->uSkillPoints; | |
469 | 7796 return v4 >= pValue; |
0 | 7797 case VAR_CircusPrises: |
7798 v4 = 0; | |
100 | 7799 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7800 do |
7801 { | |
469 | 7802 v24 = v23->pInventoryItems; |
0 | 7803 v25 = 138; |
7804 do | |
7805 { | |
7806 switch ( v24->uItemID ) | |
7807 { | |
7808 case 0x1D6u: | |
7809 ++v4; | |
7810 break; | |
7811 case 0x1D7u: | |
7812 v4 += 3; | |
7813 break; | |
7814 case 0x1DDu: | |
7815 v4 += 5; | |
7816 break; | |
7817 } | |
7818 ++v24; | |
7819 --v25; | |
7820 } | |
7821 while ( v25 ); | |
100 | 7822 ++v23; |
0 | 7823 } |
100 | 7824 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7825 return v4 >= pValue; |
0 | 7826 case VAR_MonthEquals2: |
469 | 7827 v6 = pParty->uCurrentMonth == pValue; |
7828 return v6; | |
0 | 7829 case VAR_IsFlying: |
7830 if ( pParty->bFlying | |
484 | 7831 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7832 return true; |
7833 return false; | |
0 | 7834 case VAR_HiredNPCHasSpeciality: |
469 | 7835 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7836 return v6; |
7837 case VAR_NPCs2: | |
469 | 7838 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7839 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7840 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7841 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7842 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7843 return v4 >= pValue; |
7844 v4 = pValue; | |
7845 return v4 >= pValue; | |
0 | 7846 case VAR_ItemEquipped: |
7847 v26 = (ITEM_EQUIP_TYPE)0; | |
7848 v27 = (char *)&this->pEquipment; | |
7849 break; | |
7850 case VAR_GoldInBank: | |
7851 v4 = pParty->uNumGoldInBank; | |
469 | 7852 return v4 >= pValue; |
0 | 7853 case VAR_ThieverySkill|0x80: |
7854 v28 = GetActualMight(); | |
7855 v29 = v3->GetBaseStrength(); | |
7856 goto LABEL_168; | |
7857 case VAR_DisarmTrapSkill|0x80: | |
7858 v28 = GetActualIntelligence(); | |
7859 v29 = v3->GetBaseIntelligence(); | |
7860 goto LABEL_168; | |
7861 case VAR_MonthEquals: | |
7862 v28 = GetActualWillpower(); | |
7863 v29 = v3->GetBaseWillpower(); | |
7864 goto LABEL_168; | |
7865 case VAR_MonthEquals|VAR_Sex: | |
7866 v28 = GetActualEndurance(); | |
7867 v29 = v3->GetBaseEndurance(); | |
7868 goto LABEL_168; | |
7869 case VAR_IdentifyMonsterSkill|0x80: | |
7870 v28 = GetActualSpeed(); | |
7871 v29 = v3->GetBaseSpeed(); | |
7872 goto LABEL_168; | |
7873 case VAR_ArmsmasterSkill|0x80: | |
7874 v28 = GetActualAccuracy(); | |
7875 v29 = v3->GetBaseAccuracy(); | |
7876 goto LABEL_168; | |
7877 case VAR_MonthEquals|VAR_MaxHP: | |
7878 v28 = GetActualLuck(); | |
7879 v29 = v3->GetBaseLuck(); | |
7880 LABEL_168: | |
7881 v10 = __OFSUB__(v28, v29); | |
7882 v9 = v28 - v29 < 0; | |
7883 LABEL_169: | |
7884 if ( v9 ^ v10 ) | |
469 | 7885 return v4 >= pValue; |
7886 return true; | |
0 | 7887 default: |
469 | 7888 return v4 >= pValue; |
0 | 7889 } |
7890 while ( !v3->HasItemEquipped(v26) | |
469 | 7891 || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != pValue ) |
0 | 7892 { |
7893 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7894 v27 += 4; | |
7895 if ( (signed int)v26 >= 16 ) | |
469 | 7896 return false; |
7897 } | |
7898 return true; | |
7899 } | |
7900 if ( VarNum == VAR_AutoNotes ) | |
0 | 7901 { |
484 | 7902 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7903 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7904 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7905 return false; | |
7906 return true; | |
469 | 7907 } |
7908 if ( VarNum <= VAR_BaseLuck ) | |
7909 { | |
7910 if ( VarNum != VAR_BaseLuck ) | |
7911 { | |
7912 switch ( VarNum ) | |
0 | 7913 { |
7914 case VAR_Hour: | |
469 | 7915 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7916 return true; | |
7917 return false; | |
0 | 7918 case VAR_DayOfYear: |
469 | 7919 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7920 v6 = v5 == pValue; | |
7921 return v6; | |
0 | 7922 case VAR_DayOfWeek: |
469 | 7923 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7924 v6 = v5 == pValue; | |
0 | 7925 return v6; |
7926 case VAR_Sex: | |
469 | 7927 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7928 return true; | |
7929 return v4 >= pValue; | |
0 | 7930 case VAR_Class: |
135 | 7931 v7 = (CHARACTER_RACE)this->classType; |
469 | 7932 if ( pValue == v7 ) |
7933 return true; | |
7934 return v4 >= pValue; | |
0 | 7935 case VAR_Race: |
7936 v7 = GetRace(); | |
469 | 7937 if ( pValue == v7 ) |
7938 return true; | |
7939 return v4 >= pValue; | |
0 | 7940 case VAR_CurrentHP: |
7941 v4 = this->sHealth; | |
469 | 7942 return v4 >= pValue; |
0 | 7943 case VAR_MaxHP: |
7944 v8 = GetMaxHealth(); | |
7945 v10 = __OFSUB__(v3->sHealth, v8); | |
7946 v9 = v3->sHealth - v8 < 0; | |
7947 goto LABEL_169; | |
7948 case VAR_CurrentSP: | |
7949 v4 = this->sMana; | |
469 | 7950 return v4 >= pValue; |
0 | 7951 case VAR_MaxSP: |
7952 v11 = GetMaxMana(); | |
7953 v10 = __OFSUB__(v3->sMana, v11); | |
7954 v9 = v3->sMana - v11 < 0; | |
7955 goto LABEL_169; | |
7956 case VAR_ActualAC: | |
7957 v12 = GetActualAC(); | |
7958 goto _j_cmp_against_arg; | |
7959 case VAR_ACModifier: | |
7960 v4 = this->sACModifier; | |
469 | 7961 return v4 >= pValue; |
0 | 7962 case VAR_BaseLevel: |
7963 v4 = this->uLevel; | |
469 | 7964 return v4 >= pValue; |
0 | 7965 case VAR_LevelModifier: |
7966 v4 = this->sLevelModifier; | |
469 | 7967 return v4 >= pValue; |
0 | 7968 case VAR_Age: |
7969 v12 = GetActualAge(); | |
7970 goto _j_cmp_against_arg; | |
7971 case VAR_Award: | |
484 | 7972 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7973 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7974 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7975 return true; | |
7976 return false; | |
0 | 7977 case VAR_Experience: |
7978 v4 = LODWORD(this->uExperience); | |
469 | 7979 return v4 >= pValue; |
0 | 7980 case VAR_QBits_QuestsDone: |
484 | 7981 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7982 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7983 if ( test_bit_value & our_bit_value ) | |
478 | 7984 return true; |
7985 return false; | |
0 | 7986 case VAR_PlayerItemInHands: |
7987 v15 = 0; | |
7988 v16 = v3->pInventoryItems; | |
7989 break; | |
7990 case VAR_FixedGold: | |
7991 v4 = pParty->uNumGold; | |
469 | 7992 return v4 >= pValue; |
0 | 7993 case VAR_MightBonus: |
7994 v4 = this->uMightBonus; | |
469 | 7995 return v4 >= pValue; |
0 | 7996 case VAR_IntellectBonus: |
7997 v4 = this->uIntelligenceBonus; | |
469 | 7998 return v4 >= pValue; |
0 | 7999 case VAR_PersonalityBonus: |
8000 v4 = this->uWillpowerBonus; | |
469 | 8001 return v4 >= pValue; |
0 | 8002 case VAR_EnduranceBonus: |
8003 v4 = this->uEnduranceBonus; | |
469 | 8004 return v4 >= pValue; |
0 | 8005 case VAR_SpeedBonus: |
8006 v4 = this->uSpeedBonus; | |
469 | 8007 return v4 >= pValue; |
0 | 8008 case VAR_AccuracyBonus: |
8009 v4 = this->uAccuracyBonus; | |
469 | 8010 return v4 >= pValue; |
0 | 8011 case VAR_LuckBonus: |
8012 v4 = this->uLuckBonus; | |
469 | 8013 return v4 >= pValue; |
0 | 8014 case VAR_BaseMight: |
8015 v4 = this->uMight; | |
469 | 8016 return v4 >= pValue; |
0 | 8017 case VAR_BaseIntellect: |
8018 v4 = this->uIntelligence; | |
469 | 8019 return v4 >= pValue; |
0 | 8020 case VAR_BasePersonality: |
8021 v4 = this->uWillpower; | |
469 | 8022 return v4 >= pValue; |
0 | 8023 case VAR_BaseEndurance: |
8024 v4 = this->uEndurance; | |
469 | 8025 return v4 >= pValue; |
0 | 8026 case VAR_BaseSpeed: |
8027 v4 = this->uSpeed; | |
469 | 8028 return v4 >= pValue; |
0 | 8029 case VAR_BaseAccuracy: |
8030 v4 = this->uAccuracy; | |
469 | 8031 return v4 >= pValue; |
0 | 8032 case VAR_FixedFood: |
8033 v4 = pParty->uNumFoodRations; | |
469 | 8034 return v4 >= pValue; |
0 | 8035 default: |
469 | 8036 return v4 >= pValue; |
8037 } | |
8038 while ( v16->uItemID != pValue ) | |
0 | 8039 { |
8040 ++v15; | |
8041 ++v16; | |
8042 if ( v15 >= 138 ) | |
8043 { | |
469 | 8044 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8045 return v6; |
8046 } | |
8047 } | |
469 | 8048 return true; |
0 | 8049 } |
8050 v4 = this->uLuck; | |
469 | 8051 return v4 >= pValue; |
8052 } | |
8053 if ( VarNum <= VAR_MagicResistance ) | |
8054 { | |
8055 if ( VarNum == VAR_MagicResistance ) | |
0 | 8056 { |
8057 v4 = this->sResMagicBase; | |
8058 } | |
8059 else | |
8060 { | |
469 | 8061 switch ( VarNum ) |
0 | 8062 { |
8063 case VAR_FireResistance: | |
8064 v4 = this->sResFireBase; | |
469 | 8065 return v4 >= pValue; |
0 | 8066 case VAR_AirResistance: |
8067 v4 = this->sResAirBase; | |
469 | 8068 return v4 >= pValue; |
0 | 8069 case VAR_WaterResistance: |
8070 v4 = this->sResWaterBase; | |
469 | 8071 return v4 >= pValue; |
0 | 8072 case VAR_EarthResistance: |
8073 v4 = this->sResEarthBase; | |
469 | 8074 return v4 >= pValue; |
0 | 8075 case VAR_SpiritResistance: |
8076 v4 = this->sResSpiritBase; | |
469 | 8077 return v4 >= pValue; |
0 | 8078 case VAR_MindResistance: |
8079 v4 = this->sResMindBase; | |
469 | 8080 return v4 >= pValue; |
0 | 8081 case VAR_BodyResistance: |
8082 v4 = this->sResBodyBase; | |
469 | 8083 return v4 >= pValue; |
0 | 8084 case VAR_LightResistance: |
8085 v4 = this->sResLightBase; | |
469 | 8086 return v4 >= pValue; |
0 | 8087 case VAR_DarkResistance: |
8088 v4 = this->sResDarkBase; | |
469 | 8089 return v4 >= pValue; |
0 | 8090 case VAR_ActualMight: |
8091 v12 = GetActualMight(); | |
8092 goto _j_cmp_against_arg; | |
8093 case VAR_ActualIntellect: | |
8094 v12 = GetActualIntelligence(); | |
8095 goto _j_cmp_against_arg; | |
8096 case VAR_ActualPersonality: | |
8097 v12 = GetActualWillpower(); | |
8098 goto _j_cmp_against_arg; | |
8099 case VAR_ActualEndurance: | |
8100 v12 = GetActualEndurance(); | |
8101 goto _j_cmp_against_arg; | |
8102 case VAR_ActualSpeed: | |
8103 v12 = GetActualSpeed(); | |
8104 goto _j_cmp_against_arg; | |
8105 case VAR_ActualAccuracy: | |
8106 v12 = GetActualAccuracy(); | |
8107 goto _j_cmp_against_arg; | |
8108 case VAR_ActualLuck: | |
8109 v12 = GetActualLuck(); | |
8110 _j_cmp_against_arg: | |
8111 v4 = v12; | |
8112 break; | |
8113 default: | |
469 | 8114 return v4 >= pValue; |
8115 } | |
8116 } | |
8117 return v4 >= pValue; | |
8118 } | |
8119 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8120 { | |
8121 if ( VarNum != VAR_DisarmTrapSkill ) | |
8122 { | |
8123 if ( VarNum <= VAR_MindResistanceBonus ) | |
8124 { | |
8125 switch ( VarNum ) | |
0 | 8126 { |
8127 case VAR_MindResistanceBonus: | |
8128 v4 = this->sResMindBonus; | |
8129 break; | |
8130 case VAR_FireResistanceBonus: | |
8131 v4 = this->sResFireBonus; | |
8132 break; | |
8133 case VAR_AirResistanceBonus: | |
8134 v4 = this->sResAirBonus; | |
8135 break; | |
8136 case VAR_WaterResistanceBonus: | |
8137 v4 = this->sResWaterBonus; | |
8138 break; | |
8139 case VAR_EarthResistanceBonus: | |
8140 v4 = this->sResEarthBonus; | |
8141 break; | |
8142 case VAR_SpiritResistanceBonus: | |
8143 v4 = this->sResSpiritBonus; | |
8144 break; | |
8145 } | |
469 | 8146 return v4 >= pValue; |
8147 } | |
8148 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8149 { |
8150 v4 = this->sResBodyBonus; | |
469 | 8151 return v4 >= pValue; |
8152 } | |
8153 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8154 { |
8155 v4 = this->sResLightBonus; | |
469 | 8156 return v4 >= pValue; |
8157 } | |
8158 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8159 { |
8160 v4 = this->sResDarkBonus; | |
469 | 8161 return v4 >= pValue; |
8162 } | |
8163 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8164 { |
8165 v4 = this->sResMagicBonus; | |
469 | 8166 return v4 >= pValue; |
8167 } | |
8168 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8169 return v4 >= pValue; | |
0 | 8170 } |
8171 LABEL_90: | |
469 | 8172 v18 = *((short *)&this->pConditions[16] + VarNum); |
8173 if ( pValue <= 63 ) | |
0 | 8174 v4 = v18 & 0x3F; |
8175 else | |
469 | 8176 v4 = pValue & v18; |
8177 return v4 >= pValue; | |
8178 } | |
8179 if ( VarNum == 104 ) | |
0 | 8180 goto LABEL_90; |
469 | 8181 if ( (signed int)VarNum <= 104 ) |
8182 return v4 >= pValue; | |
8183 if ( (signed int)VarNum > 0x79 ) | |
8184 { | |
8185 if ( VarNum != 122 ) | |
8186 { | |
8187 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8188 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8189 return v4 >= pValue; | |
0 | 8190 } |
8191 v4 = GetMajorConditionIdx(); | |
8192 if ( v4 != 18 ) | |
8193 { | |
469 | 8194 return v4 >= pValue; |
8195 } | |
8196 v4 = pValue; | |
8197 return v4 >= pValue; | |
8198 } | |
8199 return *((int *)this + 2 * VarNum - 210); | |
0 | 8200 } |
8201 | |
8202 | |
8203 //----- (0044A5CB) -------------------------------------------------------- | |
8204 void Player::SetVariable(enum VariableType var, signed int a3) | |
8205 { | |
8206 signed int v3; // ebx@1 | |
8207 Player *v4; // esi@1 | |
8208 unsigned int v5; // edi@1 | |
8209 unsigned int v6; // esi@13 | |
8210 unsigned int v7; // esi@14 | |
8211 signed int v8; // eax@17 | |
8212 ItemGen *v9; // ecx@17 | |
8213 int v10; // eax@21 | |
8214 signed int v11; // eax@30 | |
8215 Player *v12; // ecx@44 | |
8216 char *v13; // ecx@45 | |
8217 Player *v14; // ecx@49 | |
8218 int v15; // ecx@86 | |
8219 int v16; // esi@106 | |
8220 char v17; // al@106 | |
8221 int v18; // eax@107 | |
8222 Player *v19; // ecx@112 | |
8223 Player *v20; // ecx@127 | |
8224 int v21; // eax@127 | |
8225 int v22; // eax@145 | |
8226 char v23; // zf@146 | |
8227 DDM_DLV_Header *v24; // ecx@148 | |
8228 signed int v25; // eax@172 | |
8229 int v26; // [sp-8h] [bp-3Ch]@84 | |
8230 signed int v27; // [sp-4h] [bp-38h]@4 | |
8231 int v28; // [sp-4h] [bp-38h]@84 | |
8232 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8233 char v30; // [sp+32h] [bp-2h]@1 | |
8234 char v31; // [sp+33h] [bp-1h]@1 | |
8235 | |
8236 v3 = 0; | |
8237 v30 = 0; | |
8238 v31 = 0; | |
8239 v4 = this; | |
8240 v5 = 0; | |
8241 if ( this == pPlayers[2] ) | |
8242 { | |
8243 v3 = 1; | |
8244 goto LABEL_8; | |
8245 } | |
8246 if ( this == pPlayers[3] ) | |
8247 { | |
8248 v27 = 2; | |
8249 } | |
8250 else | |
8251 { | |
8252 if ( this != pPlayers[4] ) | |
8253 goto LABEL_8; | |
8254 v27 = 3; | |
8255 } | |
8256 v3 = v27; | |
8257 LABEL_8: | |
8258 if ( var > VAR_AutoNotes ) | |
8259 { | |
8260 if ( var <= VAR_GoldInBank ) | |
8261 { | |
8262 if ( var == VAR_GoldInBank ) | |
8263 { | |
8264 pParty->uNumGoldInBank = a3; | |
8265 return; | |
8266 } | |
8267 if ( var <= VAR_Counter8 ) | |
8268 { | |
310 | 8269 if ( (signed int)var >= 0xF5 ) |
0 | 8270 { |
8271 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); | |
8272 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); | |
8273 } | |
8274 else | |
8275 { | |
8276 switch ( var ) | |
8277 { | |
8278 case VAR_MonthEquals|VAR_CurrentSP: | |
8279 _449B7E_toggle_bit((unsigned char *)field_1A50, a3, 1u); | |
8280 break; | |
8281 case VAR_NPCs2: | |
8282 pParty->field_709 = 0; | |
8283 LOBYTE(pNPCStats->pNewNPCData[a3].uFlags) |= 0x80u; | |
8284 sub_44A56A(); | |
8285 viewparams->bRedrawGameUI = 1; | |
8286 break; | |
8287 case VAR_NumSkillPoints: | |
8288 this->uSkillPoints = a3; | |
8289 break; | |
8290 } | |
8291 } | |
8292 return; | |
8293 } | |
8294 if ( var < VAR_Counter9 ) | |
8295 return; | |
310 | 8296 if ( (signed int)var <= 0x112 ) |
0 | 8297 { |
8298 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); | |
8299 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); | |
8300 } | |
8301 else | |
8302 { | |
8303 if ( var == VAR_ReputationInCurrentLocation ) | |
8304 { | |
8305 v24 = &pOutdoor->ddm; | |
8306 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8307 v24 = &pIndoor->dlv; | |
8308 v24->uReputation = a3; | |
8309 if ( a3 > 10000 ) | |
8310 v24->uReputation = 10000; | |
8311 return; | |
8312 } | |
8313 if ( var <= VAR_ReputationInCurrentLocation | |
8314 || var > VAR_History_28 | |
8315 || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8316 || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8317 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
0 | 8318 pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
8319 v23) ) | |
8320 return; | |
8321 bFlashHistoryBook = 1; | |
8322 } | |
8323 LABEL_172: | |
8324 v25 = 8 * v3 + 400; | |
8325 LOBYTE(v25) = (8 * v3 - 112) | 4; | |
8326 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); | |
8327 return; | |
8328 } | |
8329 if ( var != 307 ) | |
8330 { | |
8331 switch ( var ) | |
8332 { | |
8333 case 308: | |
8334 pParty->uNumBountiesCollected = a3; | |
8335 break; | |
8336 case 309: | |
8337 pParty->uNumPrisonTerms = a3; | |
8338 break; | |
8339 case 310: | |
8340 pParty->uNumArenaPageWins = a3; | |
8341 break; | |
8342 case 311: | |
8343 pParty->uNumArenaSquireWins = a3; | |
8344 break; | |
8345 case 312: | |
8346 pParty->uNumArenaKnightWins = a3; | |
8347 break; | |
8348 case 313: | |
8349 pParty->uNumArenaLordWins = a3; | |
8350 break; | |
8351 } | |
8352 return; | |
8353 } | |
8354 pParty->uNumDeaths = a3; | |
8355 LABEL_168: | |
8356 if ( v30 != 1 ) | |
8357 { | |
8358 LABEL_170: | |
8359 if ( v31 != 1 ) | |
8360 return; | |
8361 v5 = 0; | |
8362 goto LABEL_172; | |
8363 } | |
8364 LABEL_169: | |
8365 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, v3); | |
8366 goto LABEL_170; | |
8367 } | |
8368 if ( var == VAR_AutoNotes ) | |
8369 { | |
8370 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3]) | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8371 //&& (&dword_723718_autonote_related)[8 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8372 && pAutonoteTxt[a3-1].pText ) |
0 | 8373 { |
8374 v20 = pPlayers[v3 + 1]; | |
8375 v30 = 1; | |
187 | 8376 v20->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8377 v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; |
0 | 8378 bFlashAutonotesBook = 1; |
8379 dword_506568 = v21; | |
8380 } | |
8381 _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); | |
8382 v31 = 1; | |
8383 goto LABEL_168; | |
8384 } | |
8385 if ( var <= VAR_ActualMight ) | |
8386 { | |
8387 if ( var != VAR_ActualMight ) | |
8388 { | |
8389 switch ( var ) | |
8390 { | |
8391 case VAR_RandomGold: | |
8392 v6 = rand() % a3 + 1; | |
8393 Party::SetGold(v6); | |
8394 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8395 ShowStatusBarString(pTmpBuf, 2u); | |
8396 GameUI_DrawFoodAndGold(); | |
8397 return; | |
8398 case VAR_RandomFood: | |
8399 v7 = rand() % a3 + 1; | |
8400 Party::SetFood(v7); | |
8401 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8402 ShowStatusBarString(pTmpBuf, 2u); | |
8403 GameUI_DrawFoodAndGold(); | |
8404 goto LABEL_124; | |
8405 case VAR_Sex: | |
8406 this->uSex = (PLAYER_SEX)a3; | |
8407 goto LABEL_124; | |
8408 case VAR_Class: | |
135 | 8409 this->classType = (PLAYER_CLASS_TYPE)a3; |
0 | 8410 if ( (char)a3 != 35 ) |
8411 goto LABEL_124; | |
8412 v8 = 0; | |
8413 v9 = this->pInventoryItems; | |
8414 break; | |
8415 case VAR_CurrentHP: | |
8416 this->sHealth = a3; | |
8417 goto LABEL_124; | |
8418 case VAR_MaxHP: | |
8419 this->sHealth = GetMaxHealth(); | |
8420 return; | |
8421 case VAR_CurrentSP: | |
8422 this->sMana = a3; | |
8423 goto LABEL_124; | |
8424 case VAR_MaxSP: | |
8425 this->sMana = GetMaxMana(); | |
8426 return; | |
8427 case VAR_ACModifier: | |
8428 this->sACModifier = (unsigned __int8)a3; | |
8429 goto LABEL_124; | |
8430 case VAR_BaseLevel: | |
8431 this->uLevel = (unsigned __int8)a3; | |
8432 goto LABEL_124; | |
8433 case VAR_LevelModifier: | |
8434 this->sLevelModifier = (unsigned __int8)a3; | |
8435 goto LABEL_124; | |
8436 case VAR_Age: | |
8437 this->sAgeModifier = a3; | |
8438 return; | |
8439 case VAR_Award: | |
484 | 8440 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->_guilds_member_bits[((signed __int16)a3 - 1) >> 3]) |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8441 //&& dword_723E80_award_related[2 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8442 && pAwards[a3-1].pText ) |
0 | 8443 { |
8444 v12 = pPlayers[v3 + 1]; | |
8445 v30 = 1; | |
8446 v31 = 1; | |
187 | 8447 v12->PlaySound(SPEECH_96, 0); |
0 | 8448 } |
484 | 8449 v13 = v4->_guilds_member_bits; |
0 | 8450 goto LABEL_51; |
8451 case VAR_Experience: | |
8452 this->uExperience = a3; | |
8453 goto LABEL_124; | |
8454 case VAR_QBits_QuestsDone: | |
484 | 8455 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_quest_bits[((signed __int16)a3 - 1) >> 3]) |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8456 // && (&dword_722F10)[4 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8457 && pQuestTable[a3-1] ) |
0 | 8458 { |
8459 v14 = pPlayers[v3 + 1]; | |
8460 bFlashQuestBook = 1; | |
8461 v30 = 1; | |
8462 v31 = 1; | |
187 | 8463 v14->PlaySound(SPEECH_93, 0); |
0 | 8464 } |
484 | 8465 v13 = (char *)pParty->_quest_bits; |
0 | 8466 LABEL_51: |
8467 _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); | |
8468 goto LABEL_168; | |
8469 case VAR_PlayerItemInHands: | |
8470 item.Reset(); | |
8471 item.Reset(); | |
8472 item.uItemID = a3; | |
8473 item.uAttributes = 1; | |
8474 pParty->SetHoldingItem(&item); | |
8475 if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8476 pParty->pIsArtifactFound[a3-500] = 1; |
0 | 8477 return; |
8478 case VAR_FixedGold: | |
8479 Party::SetGold(a3); | |
8480 return; | |
8481 case VAR_BaseMight: | |
8482 this->uMight = (unsigned __int8)a3; | |
8483 goto LABEL_84; | |
8484 case VAR_BaseIntellect: | |
8485 this->uIntelligence = (unsigned __int8)a3; | |
8486 goto LABEL_84; | |
8487 case VAR_BasePersonality: | |
8488 this->uWillpower = (unsigned __int8)a3; | |
8489 goto LABEL_84; | |
8490 case VAR_BaseEndurance: | |
8491 this->uEndurance = (unsigned __int8)a3; | |
8492 goto LABEL_84; | |
8493 case VAR_BaseSpeed: | |
8494 this->uSpeed = (unsigned __int8)a3; | |
8495 goto LABEL_84; | |
8496 case VAR_BaseAccuracy: | |
8497 this->uAccuracy = (unsigned __int8)a3; | |
8498 goto LABEL_84; | |
8499 case VAR_BaseLuck: | |
8500 this->uLuck = (unsigned __int8)a3; | |
8501 goto LABEL_84; | |
8502 case VAR_FixedFood: | |
8503 Party::SetFood(a3); | |
8504 goto LABEL_124; | |
8505 case VAR_MightBonus: | |
8506 goto LABEL_64; | |
8507 case VAR_IntellectBonus: | |
8508 goto LABEL_68; | |
8509 case VAR_PersonalityBonus: | |
8510 goto LABEL_69; | |
8511 case VAR_EnduranceBonus: | |
8512 goto LABEL_70; | |
8513 case VAR_SpeedBonus: | |
8514 goto LABEL_71; | |
8515 case VAR_AccuracyBonus: | |
8516 goto LABEL_72; | |
8517 case VAR_LuckBonus: | |
8518 goto LABEL_73; | |
8519 default: | |
8520 return; | |
8521 } | |
8522 while ( v9->uItemID != 615 ) | |
8523 { | |
8524 ++v8; | |
8525 ++v9; | |
8526 if ( v8 >= 138 ) | |
8527 goto LABEL_22; | |
8528 } | |
8529 v10 = (int)((char *)v4 + 36 * v8); | |
8530 *(int *)(v10 + 532) = 601; | |
8531 *(char *)(v10 + 558) = v3 + 1; | |
8532 LABEL_22: | |
8533 if ( v4->sResFireBase < 20 ) | |
8534 v4->sResFireBase = 20; | |
8535 if ( v4->sResAirBase < 20 ) | |
8536 v4->sResAirBase = 20; | |
8537 if ( v4->sResWaterBase < 20 ) | |
8538 v4->sResWaterBase = 20; | |
8539 if ( v4->sResEarthBase < 20 ) | |
8540 v4->sResEarthBase = 20; | |
8541 v4->sResMindBase = 200; | |
8542 v4->sResBodyBase = 200; | |
8543 v11 = v4->GetSexByVoice(); | |
8544 v4->field_1924 = v4->uVoiceID; | |
8545 v4->field_1928 = v4->uFace; | |
8546 if ( v11 ) | |
8547 { | |
8548 v4->uFace = 21; | |
8549 v4->uVoiceID = 21; | |
8550 } | |
8551 else | |
8552 { | |
8553 v4->uFace = 20; | |
8554 v4->uVoiceID = 20; | |
8555 } | |
8556 ReloadPlayerPortraits(v3, v4->uFace); | |
8557 goto LABEL_124; | |
8558 } | |
8559 LABEL_64: | |
8560 this->uMightBonus = (unsigned __int8)a3; | |
8561 LABEL_111: | |
8562 v28 = 0; | |
187 | 8563 v26 = SPEECH_91; |
0 | 8564 LABEL_112: |
8565 v19 = pPlayers[v3 + 1]; | |
8566 v31 = 1; | |
187 | 8567 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8568 goto LABEL_169; |
8569 } | |
8570 if ( var <= VAR_FireResistanceBonus ) | |
8571 { | |
8572 if ( var == VAR_FireResistanceBonus ) | |
8573 { | |
8574 this->sResFireBonus = (unsigned __int8)a3; | |
8575 goto LABEL_111; | |
8576 } | |
8577 switch ( var ) | |
8578 { | |
8579 case VAR_ActualIntellect: | |
8580 LABEL_68: | |
8581 this->uIntelligenceBonus = (unsigned __int8)a3; | |
8582 goto LABEL_111; | |
8583 case VAR_ActualPersonality: | |
8584 LABEL_69: | |
8585 this->uWillpowerBonus = (unsigned __int8)a3; | |
8586 goto LABEL_111; | |
8587 case VAR_ActualEndurance: | |
8588 LABEL_70: | |
8589 this->uEnduranceBonus = (unsigned __int8)a3; | |
8590 goto LABEL_111; | |
8591 case VAR_ActualSpeed: | |
8592 LABEL_71: | |
8593 this->uSpeedBonus = (unsigned __int8)a3; | |
8594 goto LABEL_111; | |
8595 case VAR_ActualAccuracy: | |
8596 LABEL_72: | |
8597 this->uAccuracyBonus = (unsigned __int8)a3; | |
8598 goto LABEL_111; | |
8599 case VAR_ActualLuck: | |
8600 LABEL_73: | |
8601 this->uLuckBonus = (unsigned __int8)a3; | |
8602 goto LABEL_111; | |
8603 case VAR_FireResistance: | |
8604 this->sResFireBase = (unsigned __int8)a3; | |
8605 goto LABEL_84; | |
8606 case VAR_AirResistance: | |
8607 this->sResAirBase = (unsigned __int8)a3; | |
8608 goto LABEL_84; | |
8609 case VAR_WaterResistance: | |
8610 this->sResWaterBase = (unsigned __int8)a3; | |
8611 goto LABEL_84; | |
8612 case VAR_EarthResistance: | |
8613 this->sResEarthBase = (unsigned __int8)a3; | |
8614 goto LABEL_84; | |
8615 case VAR_SpiritResistance: | |
8616 this->sResSpiritBase = (unsigned __int8)a3; | |
8617 goto LABEL_84; | |
8618 case VAR_MindResistance: | |
8619 this->sResMindBase = (unsigned __int8)a3; | |
8620 goto LABEL_84; | |
8621 case VAR_BodyResistance: | |
8622 this->sResBodyBase = (unsigned __int8)a3; | |
8623 goto LABEL_84; | |
8624 case VAR_LightResistance: | |
8625 this->sResLightBase = (unsigned __int8)a3; | |
8626 goto LABEL_84; | |
8627 case VAR_DarkResistance: | |
8628 this->sResDarkBase = (unsigned __int8)a3; | |
8629 goto LABEL_84; | |
8630 case VAR_MagicResistance: | |
8631 this->sResMagicBase = (unsigned __int8)a3; | |
8632 LABEL_84: | |
8633 v28 = 0; | |
8634 v26 = 92; | |
8635 goto LABEL_112; | |
8636 default: | |
8637 return; | |
8638 } | |
8639 return; | |
8640 } | |
8641 HIWORD(v15) = 0; | |
8642 if ( var > VAR_DisarmTrapSkill ) | |
8643 { | |
8644 if ( var != VAR_LearningSkill ) | |
8645 { | |
8646 if ( var <= VAR_LearningSkill ) | |
8647 return; | |
8648 if ( var <= VAR_Eradicated ) | |
8649 { | |
8650 v4->SetCondition(var - 105, 1); | |
8651 } | |
8652 else | |
8653 { | |
8654 if ( var != VAR_MajorCondition ) | |
8655 { | |
8656 if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) | |
8657 byte_5E4C15[var] = a3; | |
8658 return; | |
8659 } | |
8660 memset(v4, 0, 0xA0u); | |
8661 } | |
8662 LABEL_124: | |
8663 v31 = 1; | |
8664 goto LABEL_169; | |
8665 } | |
8666 LABEL_106: | |
8667 v16 = (int)((char *)&v4->pConditions[16] + 2 * var); | |
8668 v17 = *(char *)v16; | |
8669 if ( a3 <= VAR_BodyResistanceBonus ) | |
8670 { | |
8671 LOWORD(v15) = (unsigned __int8)a3; | |
8672 v18 = v15 | v17 & VAR_BodyResistanceBonus; | |
8673 } | |
8674 else | |
8675 { | |
8676 LOWORD(v18) = (unsigned __int8)(a3 | v17 & 0xC0); | |
8677 } | |
8678 *(short *)v16 = v18; | |
8679 goto LABEL_124; | |
8680 } | |
8681 if ( var == VAR_DisarmTrapSkill ) | |
8682 goto LABEL_106; | |
8683 if ( var <= VAR_BodyResistanceBonus ) | |
8684 { | |
8685 switch ( var ) | |
8686 { | |
8687 case VAR_BodyResistanceBonus: | |
8688 v4->sResBodyBonus = (unsigned __int8)a3; | |
8689 break; | |
8690 case VAR_AirResistanceBonus: | |
8691 v4->sResAirBonus = (unsigned __int8)a3; | |
8692 break; | |
8693 case VAR_WaterResistanceBonus: | |
8694 v4->sResWaterBonus = (unsigned __int8)a3; | |
8695 break; | |
8696 case VAR_EarthResistanceBonus: | |
8697 v4->sResEarthBonus = (unsigned __int8)a3; | |
8698 break; | |
8699 case VAR_SpiritResistanceBonus: | |
8700 v4->sResSpiritBonus = (unsigned __int8)a3; | |
8701 break; | |
8702 default: | |
8703 if ( var != 62 ) | |
8704 return; | |
8705 v4->sResMindBonus = (unsigned __int8)a3; | |
8706 break; | |
8707 } | |
8708 goto LABEL_111; | |
8709 } | |
8710 if ( var == VAR_LightResistanceBonus ) | |
8711 { | |
8712 v4->sResLightBonus = (unsigned __int8)a3; | |
8713 goto LABEL_111; | |
8714 } | |
8715 if ( var == VAR_DarkResistanceBonus ) | |
8716 { | |
8717 v4->sResDarkBonus = (unsigned __int8)a3; | |
8718 goto LABEL_111; | |
8719 } | |
8720 if ( var == VAR_MagicResistanceBonus ) | |
8721 { | |
8722 v4->sResMagicBonus = (unsigned __int8)a3; | |
8723 goto LABEL_111; | |
8724 } | |
8725 if ( var > VAR_MagicResistanceBonus && var <= VAR_DiplomacySkill ) | |
8726 goto LABEL_106; | |
8727 } | |
8728 | |
8729 | |
8730 | |
8731 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8732 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8733 { |
8734 char v3; // bl@1 | |
8735 Player *v4; // esi@1 | |
8736 signed int uPlayerIdx; // edi@1 | |
8737 int v6; // eax@15 | |
8738 unsigned int v7; // esi@18 | |
8739 int *v8; // ebx@21 | |
8740 int v9; // eax@22 | |
8741 signed int v10; // eax@24 | |
8742 int v11; // eax@27 | |
8743 __int16 *v12; // esi@28 | |
8744 Player *v13; // ecx@34 | |
8745 Player *v14; // ecx@36 | |
8746 char *v15; // ecx@37 | |
8747 unsigned __int8 v16; // cf@38 | |
8748 Player *v17; // ecx@42 | |
8749 __int16 *v18; // esi@53 | |
8750 __int16 *v19; // esi@62 | |
8751 char *v20; // esi@107 | |
8752 __int16 v21; // dx@107 | |
8753 int v22; // ecx@107 | |
8754 Player *v23; // ecx@132 | |
8755 int v24; // eax@132 | |
8756 int v25; // eax@150 | |
8757 char v26; // zf@151 | |
8758 DDM_DLV_Header *v27; // eax@153 | |
8759 signed int v28; // eax@176 | |
8760 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8761 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8762 int v31; // [sp-4h] [bp-3Ch]@84 |
8763 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8764 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8765 char v34; // [sp+37h] [bp-1h]@1 | |
8766 | |
8767 auto Dst = this; | |
8768 v3 = 0; | |
8769 v34 = 0; | |
8770 v4 = Dst; | |
8771 uPlayerIdx = 0; | |
8772 if ( Dst == pPlayers[2] ) | |
8773 uPlayerIdx = 1; | |
310 | 8774 else if ( Dst == pPlayers[3] ) |
8775 uPlayerIdx = 2; | |
8776 else if ( Dst == pPlayers[4] ) | |
8777 uPlayerIdx = 3; | |
8778 | |
8779 if ( var_type <= VAR_AutoNotes ) | |
8780 { | |
8781 if ( var_type != VAR_AutoNotes ) | |
8782 { | |
8783 if ( var_type <= VAR_ActualMight ) | |
8784 { | |
8785 if ( var_type != VAR_ActualMight ) | |
0 | 8786 { |
310 | 8787 switch ( var_type ) |
0 | 8788 { |
8789 case VAR_RandomGold: | |
8790 if ( !val ) | |
8791 val = 1; | |
8792 v6 = rand(); | |
8793 party_finds_gold(v6 % val + 1, 1); | |
8794 GameUI_DrawFoodAndGold(); | |
8795 return; | |
8796 case VAR_RandomFood: | |
8797 if ( !val ) | |
8798 val = 1; | |
8799 v7 = rand() % val + 1; | |
8800 Party::GiveFood(v7); | |
8801 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8802 ShowStatusBarString(pTmpBuf, 2u); | |
8803 GameUI_DrawFoodAndGold(); | |
8804 goto _play_sound; | |
8805 case VAR_Sex: | |
8806 Dst->uSex = (PLAYER_SEX)val; | |
8807 goto _play_anim_and_exit; | |
8808 case VAR_Class: | |
135 | 8809 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8810 goto _play_anim_and_exit; |
8811 case VAR_CurrentHP: | |
8812 v8 = &Dst->sHealth; | |
8813 *v8 += val; | |
8814 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8815 goto _play_anim_and_exit; | |
8816 v9 = v4->GetMaxHealth(); | |
8817 goto LABEL_23; | |
8818 case VAR_MaxHP: | |
8819 v10 = Dst->GetMaxHealth(); | |
8820 v4->_health_related = 0; | |
8821 v4->uFullHealthBonus = 0; | |
8822 v4->sHealth = v10; | |
8823 return; | |
8824 case VAR_CurrentSP: | |
8825 v8 = &Dst->sMana; | |
8826 *v8 += val; | |
8827 if ( Dst->sMana > GetMaxMana() ) | |
8828 { | |
8829 v9 = v4->GetMaxMana(); | |
8830 LABEL_23: | |
8831 *v8 = v9; | |
8832 } | |
8833 goto _play_anim_and_exit; | |
8834 case VAR_MaxSP: | |
8835 v11 = GetMaxMana(); | |
8836 v4->_mana_related = 0; | |
8837 v4->uFullManaBonus = 0; | |
8838 v4->sMana = v11; | |
8839 return; | |
8840 case VAR_ACModifier: | |
8841 v12 = &Dst->sACModifier; | |
8842 goto LABEL_29; | |
8843 case VAR_BaseLevel: | |
8844 v12 = (__int16 *)&Dst->uLevel; | |
8845 goto LABEL_29; | |
8846 case VAR_LevelModifier: | |
8847 v12 = &Dst->sLevelModifier; | |
8848 LABEL_29: | |
8849 *v12 += val; | |
8850 if ( *v12 > 255 ) | |
8851 *v12 = 255; | |
8852 goto _play_anim_and_exit; | |
8853 case VAR_Age: | |
8854 Dst->sAgeModifier += val; | |
8855 return; | |
8856 case VAR_Award: | |
8857 v13 = pPlayers[uPlayerIdx + 1]; | |
8858 v33 = 0x80u >> ((signed __int16)val - 1) % 8; | |
484 | 8859 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3]) |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8860 //&& dword_723E80_award_related[2 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8861 && pAwards[val-1].pText ) |
0 | 8862 { |
8863 v14 = pPlayers[uPlayerIdx + 1]; | |
8864 v34 = 1; | |
8865 v3 = 1; | |
187 | 8866 v14->PlaySound(SPEECH_96, 0); |
0 | 8867 } |
484 | 8868 v15 = v4->_guilds_member_bits; |
0 | 8869 goto LABEL_44; |
8870 case VAR_Experience: | |
8871 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8872 LODWORD(Dst->uExperience) += val; | |
8873 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8874 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8875 Dst->uExperience = 4000000000i64; | |
8876 goto _play_anim_and_exit; | |
8877 case VAR_QBits_QuestsDone: | |
484 | 8878 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
|
8879 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8880 && pQuestTable[val-1] ) |
0 | 8881 { |
8882 v17 = pPlayers[uPlayerIdx + 1]; | |
8883 bFlashQuestBook = 1; | |
8884 v34 = 1; | |
8885 v3 = 1; | |
187 | 8886 v17->PlaySound(SPEECH_93, 0); |
0 | 8887 } |
484 | 8888 v15 = (char *)pParty->_quest_bits; |
0 | 8889 LABEL_44: |
8890 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8891 goto LABEL_173; | |
8892 case VAR_PlayerItemInHands: | |
8893 item.Reset(); | |
8894 item.Reset(); | |
8895 item.uAttributes = 1; | |
8896 item.uItemID = val; | |
8897 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8898 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8899 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8900 { | |
8901 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8902 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8903 } | |
8904 pParty->SetHoldingItem(&item); | |
8905 return; | |
8906 case VAR_FixedGold: | |
8907 party_finds_gold(val, 1); | |
8908 return; | |
8909 case VAR_BaseMight: | |
8910 v18 = (__int16 *)&Dst->uMight; | |
8911 goto LABEL_82; | |
8912 case VAR_BaseIntellect: | |
8913 v18 = (__int16 *)&Dst->uIntelligence; | |
8914 goto LABEL_82; | |
8915 case VAR_BasePersonality: | |
8916 v18 = (__int16 *)&Dst->uWillpower; | |
8917 goto LABEL_82; | |
8918 case VAR_BaseEndurance: | |
8919 v18 = (__int16 *)&Dst->uEndurance; | |
8920 goto LABEL_82; | |
8921 case VAR_BaseSpeed: | |
8922 v18 = (__int16 *)&Dst->uSpeed; | |
8923 goto LABEL_82; | |
8924 case VAR_BaseAccuracy: | |
8925 v18 = (__int16 *)&Dst->uAccuracy; | |
8926 goto LABEL_82; | |
8927 case VAR_BaseLuck: | |
8928 v18 = (__int16 *)&Dst->uLuck; | |
8929 goto LABEL_82; | |
8930 case VAR_FixedFood: | |
8931 Party::GiveFood(val); | |
8932 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); | |
8933 ShowStatusBarString(pTmpBuf, 2u); | |
8934 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8935 Party::SetFood(0xFFFFu); | |
8936 goto _play_sound; | |
8937 case VAR_MightBonus: | |
8938 goto LABEL_62; | |
8939 case VAR_IntellectBonus: | |
8940 goto LABEL_66; | |
8941 case VAR_PersonalityBonus: | |
8942 goto LABEL_67; | |
8943 case VAR_EnduranceBonus: | |
8944 goto LABEL_68; | |
8945 case VAR_SpeedBonus: | |
8946 goto LABEL_69; | |
8947 case VAR_AccuracyBonus: | |
8948 goto LABEL_70; | |
8949 case VAR_LuckBonus: | |
8950 goto LABEL_71; | |
8951 default: | |
8952 return; | |
8953 } | |
8954 return; | |
8955 } | |
8956 LABEL_62: | |
8957 v19 = (__int16 *)&Dst->uMightBonus; | |
8958 goto LABEL_113; | |
8959 } | |
310 | 8960 if ( var_type <= VAR_FireResistanceBonus ) |
8961 { | |
8962 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8963 { |
310 | 8964 switch ( var_type ) |
0 | 8965 { |
8966 case VAR_ActualIntellect: | |
8967 LABEL_66: | |
8968 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8969 goto LABEL_113; | |
8970 case VAR_ActualPersonality: | |
8971 LABEL_67: | |
8972 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8973 goto LABEL_113; | |
8974 case VAR_ActualEndurance: | |
8975 LABEL_68: | |
8976 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8977 goto LABEL_113; | |
8978 case VAR_ActualSpeed: | |
8979 LABEL_69: | |
8980 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8981 goto LABEL_113; | |
8982 case VAR_ActualAccuracy: | |
8983 LABEL_70: | |
8984 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8985 goto LABEL_113; | |
8986 case VAR_ActualLuck: | |
8987 LABEL_71: | |
8988 v19 = (__int16 *)&Dst->uLuckBonus; | |
8989 goto LABEL_113; | |
8990 case VAR_FireResistance: | |
8991 v18 = &Dst->sResFireBase; | |
8992 goto LABEL_82; | |
8993 case VAR_AirResistance: | |
8994 v18 = &Dst->sResAirBase; | |
8995 goto LABEL_82; | |
8996 case VAR_WaterResistance: | |
8997 v18 = &Dst->sResWaterBase; | |
8998 goto LABEL_82; | |
8999 case VAR_EarthResistance: | |
9000 v18 = &Dst->sResEarthBase; | |
9001 goto LABEL_82; | |
9002 case VAR_SpiritResistance: | |
9003 v18 = &Dst->sResSpiritBase; | |
9004 goto LABEL_82; | |
9005 case VAR_MindResistance: | |
9006 v18 = &Dst->sResMindBase; | |
9007 goto LABEL_82; | |
9008 case VAR_BodyResistance: | |
9009 v18 = &Dst->sResBodyBase; | |
9010 goto LABEL_82; | |
9011 case VAR_LightResistance: | |
9012 v18 = &Dst->sResLightBase; | |
9013 goto LABEL_82; | |
9014 case VAR_DarkResistance: | |
9015 v18 = &Dst->sResDarkBase; | |
9016 goto LABEL_82; | |
9017 case VAR_MagicResistance: | |
9018 v18 = &Dst->sResMagicBase; | |
9019 LABEL_82: | |
9020 *v18 += val; | |
9021 if ( *v18 > 255 ) | |
9022 *v18 = 255; | |
9023 v31 = 0; | |
9024 v29 = 92; | |
9025 goto LABEL_116; | |
9026 default: | |
9027 return; | |
9028 } | |
9029 return; | |
9030 } | |
9031 v19 = &Dst->sResFireBonus; | |
9032 LABEL_113: | |
9033 *v19 += val; | |
9034 if ( *v19 > 255 ) | |
9035 *v19 = 255; | |
9036 v31 = 0; | |
187 | 9037 v29 = SPEECH_91; |
0 | 9038 LABEL_116: |
9039 v3 = 1; | |
187 | 9040 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9041 goto _play_anim_and_maybe_sound; |
9042 } | |
310 | 9043 if ( var_type <= VAR_DisarmTrapSkill ) |
9044 { | |
9045 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9046 { |
310 | 9047 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9048 { |
310 | 9049 switch ( var_type ) |
0 | 9050 { |
9051 case VAR_BodyResistanceBonus: | |
9052 v19 = &Dst->sResBodyBonus; | |
9053 break; | |
9054 case VAR_AirResistanceBonus: | |
9055 v19 = &Dst->sResAirBonus; | |
9056 break; | |
9057 case VAR_WaterResistanceBonus: | |
9058 v19 = &Dst->sResWaterBonus; | |
9059 break; | |
9060 case VAR_EarthResistanceBonus: | |
9061 v19 = &Dst->sResEarthBonus; | |
9062 break; | |
9063 case VAR_SpiritResistanceBonus: | |
9064 v19 = &Dst->sResSpiritBonus; | |
9065 break; | |
9066 default: | |
310 | 9067 if ( var_type != 62 ) |
0 | 9068 return; |
9069 v19 = &Dst->sResMindBonus; | |
9070 break; | |
9071 } | |
9072 goto LABEL_113; | |
9073 } | |
310 | 9074 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9075 { |
9076 v19 = &Dst->sResLightBonus; | |
9077 goto LABEL_113; | |
9078 } | |
310 | 9079 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9080 { |
9081 v19 = &Dst->sResDarkBonus; | |
9082 goto LABEL_113; | |
9083 } | |
310 | 9084 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9085 { |
9086 v19 = &Dst->sResMagicBonus; | |
9087 goto LABEL_113; | |
9088 } | |
310 | 9089 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9090 return; |
9091 } | |
9092 goto LABEL_106; | |
9093 } | |
310 | 9094 if ( var_type == VAR_LearningSkill ) |
0 | 9095 { |
9096 LABEL_106: | |
9097 if ( val <= VAR_BodyResistanceBonus ) | |
9098 { | |
310 | 9099 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9100 } |
9101 else | |
9102 { | |
310 | 9103 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9104 v21 = *(short *)v20; |
9105 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9106 if ( v22 > 60 ) | |
9107 LOWORD(v22) = 60; | |
9108 LOBYTE(v21) = v21 & 0xC0; | |
9109 *(short *)v20 = v22 | v21; | |
9110 } | |
9111 goto _play_anim_and_exit; | |
9112 } | |
310 | 9113 if ( var_type <= VAR_LearningSkill ) |
0 | 9114 return; |
310 | 9115 if ( var_type <= VAR_Eradicated ) |
9116 { | |
9117 Dst->SetCondition(var_type - 105, 0); | |
0 | 9118 } |
9119 else | |
9120 { | |
310 | 9121 if ( var_type != VAR_MajorCondition ) |
0 | 9122 { |
310 | 9123 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9124 { |
310 | 9125 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9126 byte_5E4C15[var_type] += val; | |
0 | 9127 else |
310 | 9128 byte_5E4C15[var_type] = -1; |
0 | 9129 } |
9130 return; | |
9131 } | |
9132 memset(Dst, 0, 0xA0u); | |
9133 } | |
9134 _play_anim_and_exit: | |
9135 v3 = 1; | |
9136 _play_anim_and_maybe_sound: | |
9137 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9138 _maybe_play_sound: | |
9139 if ( v3 != 1 ) | |
9140 return; | |
9141 goto _play_sound; | |
9142 } | |
9143 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
|
9144 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9145 && pAutonoteTxt[val-1].pText ) |
0 | 9146 { |
9147 v23 = pPlayers[uPlayerIdx + 1]; | |
9148 v34 = 1; | |
187 | 9149 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9150 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9151 bFlashAutonotesBook = 1; |
9152 dword_506568 = v24; | |
9153 } | |
9154 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9155 v3 = 1; | |
9156 LABEL_173: | |
9157 if ( v34 != 1 ) | |
9158 goto _maybe_play_sound; | |
9159 goto _play_anim_and_maybe_sound; | |
9160 } | |
310 | 9161 if ( var_type > VAR_GoldInBank ) |
9162 { | |
9163 if ( var_type == 307 ) | |
0 | 9164 { |
9165 pParty->uNumDeaths += val; | |
9166 goto LABEL_173; | |
9167 } | |
310 | 9168 switch ( var_type ) |
0 | 9169 { |
9170 case 308: | |
9171 pParty->uNumBountiesCollected += val; | |
9172 break; | |
9173 case 309: | |
9174 pParty->uNumPrisonTerms += val; | |
9175 break; | |
9176 case 310: | |
9177 pParty->uNumArenaPageWins += val; | |
9178 break; | |
9179 case 311: | |
9180 pParty->uNumArenaSquireWins += val; | |
9181 break; | |
9182 case 312: | |
9183 pParty->uNumArenaKnightWins += val; | |
9184 break; | |
9185 case 313: | |
9186 pParty->uNumArenaLordWins += val; | |
9187 break; | |
9188 } | |
9189 } | |
9190 else | |
9191 { | |
310 | 9192 if ( var_type == VAR_GoldInBank ) |
0 | 9193 { |
9194 pParty->uNumGoldInBank += val; | |
9195 return; | |
9196 } | |
310 | 9197 if ( var_type <= VAR_Counter8 ) |
9198 { | |
9199 if ( (signed int)var_type >= 245 ) | |
9200 { | |
9201 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9202 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9203 } |
9204 else | |
9205 { | |
310 | 9206 switch ( var_type ) |
0 | 9207 { |
9208 case VAR_MonthEquals|VAR_CurrentSP: | |
9209 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9210 break; | |
9211 case VAR_NPCs2: | |
9212 pParty->field_709 = 0; | |
9213 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
9214 sub_44A56A(); | |
9215 viewparams->bRedrawGameUI = 1; | |
9216 break; | |
9217 case VAR_NumSkillPoints: | |
9218 Dst->uSkillPoints += val; | |
9219 break; | |
9220 } | |
9221 } | |
9222 return; | |
9223 } | |
310 | 9224 if ( var_type < VAR_Counter9 ) |
0 | 9225 return; |
310 | 9226 if ( (signed int)var_type <= 274 ) |
9227 { | |
9228 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9229 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9230 goto _play_sound; |
9231 } | |
310 | 9232 if ( var_type != VAR_ReputationInCurrentLocation ) |
9233 { | |
9234 if ( var_type <= VAR_ReputationInCurrentLocation | |
9235 || var_type > VAR_History_28 | |
9236 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9237 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9238 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9239 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9240 v26) ) |
9241 return; | |
9242 bFlashHistoryBook = 1; | |
9243 _play_sound: | |
9244 v28 = 8 * uPlayerIdx + 400; | |
9245 LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; | |
9246 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); | |
9247 return; | |
9248 } | |
9249 v27 = &pOutdoor->ddm; | |
9250 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9251 v27 = &pIndoor->dlv; | |
9252 v27->uReputation += val; | |
9253 if ( v27->uReputation > 10000 ) | |
9254 v27->uReputation = 10000; | |
9255 } | |
9256 } | |
9257 // 506568: using guessed type int dword_506568; | |
9258 // 507948: using guessed type char bFlashHistoryBook; | |
9259 // 507949: using guessed type char bFlashAutonotesBook; | |
9260 // 50794A: using guessed type char bFlashQuestBook; | |
9261 // 72371C: using guessed type int dword_72371C[]; | |
9262 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9263 | |
9264 | |
9265 | |
9266 | |
9267 //----- (0044B9C4) -------------------------------------------------------- | |
9268 void Player::SubtractVariable(enum VariableType var, void *a3) | |
9269 { | |
9270 unsigned int v3; // ebx@1 | |
9271 signed int v4; // esi@1 | |
9272 enum VariableType v5; // eax@8 | |
9273 int v6; // esi@11 | |
9274 int v7; // edi@14 | |
9275 signed int v8; // eax@17 | |
9276 char *v9; // eax@20 | |
9277 char v10; // sf@20 | |
9278 char *v11; // ecx@26 | |
9279 char *v12; // ecx@27 | |
9280 __int64 v13; // qax@27 | |
9281 unsigned __int8 v14; // cf@27 | |
9282 char *v15; // edx@29 | |
9283 char *v16; // eax@90 | |
9284 char *v17; // ecx@94 | |
9285 void *v18; // esi@97 | |
9286 signed int v19; // edx@97 | |
9287 char *v20; // ecx@98 | |
9288 int v21; // eax@100 | |
9289 __int16 v22; // dx@112 | |
9290 int v23; // [sp-8h] [bp-14h]@45 | |
9291 signed int v24; // [sp-4h] [bp-10h]@4 | |
9292 int v25; // [sp-4h] [bp-10h]@45 | |
9293 | |
9294 v3 = 0; | |
9295 v4 = 0; | |
9296 if ( this == pPlayers[2] ) | |
9297 { | |
9298 v4 = 1; | |
9299 goto LABEL_8; | |
9300 } | |
9301 if ( this == pPlayers[3] ) | |
9302 { | |
9303 v24 = 2; | |
9304 } | |
9305 else | |
9306 { | |
9307 if ( this != pPlayers[4] ) | |
9308 goto LABEL_8; | |
9309 v24 = 3; | |
9310 } | |
9311 v4 = v24; | |
9312 LABEL_8: | |
9313 v5 = var; | |
9314 if ( (signed int)var > 222 ) | |
9315 { | |
9316 if ( (signed int)var <= 307 ) | |
9317 { | |
9318 if ( var == 307 ) | |
9319 { | |
9320 pParty->uNumDeaths -= (unsigned int)a3; | |
9321 return; | |
9322 } | |
9323 if ( var == 223 ) | |
9324 { | |
9325 v11 = (char *)pParty->_autonote_bits; | |
9326 v22 = (short)a3 - 1; | |
9327 } | |
9328 else | |
9329 { | |
9330 if ( var != 231 ) | |
9331 { | |
9332 switch ( var ) | |
9333 { | |
9334 case 232: | |
9335 var = (VariableType)0; | |
9336 GetNewNPCData(uDialogue_SpeakingActorNPC_ID, (int)&var); | |
9337 dword_5B65CC = 0; | |
9338 if ( (void *)var == a3 ) | |
9339 { | |
9340 dword_5B65CC = (int)a3; | |
9341 } | |
9342 else | |
9343 { | |
9344 pParty->field_709 = 0; | |
9345 LOBYTE(pNPCStats->pNewNPCData[(int)a3].uFlags) &= 0x7Fu; | |
9346 sub_44A56A(); | |
9347 viewparams->bRedrawGameUI = 1; | |
9348 } | |
9349 break; | |
9350 case 241: | |
9351 v18 = a3; | |
9352 v19 = 0; | |
9353 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9354 { | |
9355 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
9356 do | |
9357 { | |
9358 if ( *((void **)v20 + 4) == v18 ) | |
9359 { | |
9360 v21 = *(int *)v20; | |
9361 if ( (char)*(int *)v20 < 0 ) | |
9362 { | |
9363 LOBYTE(v21) = v21 & 0x7F; | |
9364 *(int *)v20 = v21; | |
9365 } | |
9366 } | |
9367 ++v19; | |
9368 v20 += 76; | |
9369 } | |
9370 while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); | |
9371 } | |
9372 if ( (void *)pParty->pHirelings[0].uProfession == v18 ) | |
9373 memset(pParty->pHirelings, 0, 0x4Cu); | |
9374 if ( (void *)pParty->pHirelings[1].uProfession == v18 ) | |
9375 memset(&pParty->pHirelings[1], 0, 0x4Cu); | |
9376 pParty->field_709 = 0; | |
9377 sub_44A56A(); | |
9378 break; | |
9379 case 243: | |
9380 v17 = (char *)&this->uSkillPoints; | |
9381 if ( (unsigned int)a3 <= *(int *)v17 ) | |
9382 *(int *)v17 -= (int)a3; | |
9383 else | |
9384 *(int *)v17 = 0; | |
9385 break; | |
9386 case 275: | |
9387 v16 = (char *)&pOutdoor->ddm; | |
9388 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9389 v16 = (char *)&pIndoor->dlv; | |
9390 *((int *)v16 + 2) -= (int)a3; | |
9391 if ( *((int *)v16 + 2) < -10000 ) | |
9392 *((int *)v16 + 2) = -10000; | |
9393 break; | |
9394 case 306: | |
9395 if ( (unsigned int)a3 <= pParty->uNumGoldInBank ) | |
9396 pParty->uNumGoldInBank -= (unsigned int)a3; | |
9397 else | |
9398 LABEL_88: | |
9399 dword_5B65C4 = 1; | |
9400 break; | |
9401 } | |
9402 return; | |
9403 } | |
9404 v11 = this->field_1A50; | |
9405 LABEL_112: | |
9406 v22 = (signed __int16)a3; | |
9407 } | |
9408 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
9409 return; | |
9410 } | |
9411 switch ( var ) | |
9412 { | |
9413 case 308: | |
9414 pParty->uNumBountiesCollected -= (unsigned int)a3; | |
9415 break; | |
9416 case 309: | |
9417 pParty->uNumPrisonTerms -= (int)a3; | |
9418 break; | |
9419 case 310: | |
9420 pParty->uNumArenaPageWins -= (char)a3; | |
9421 break; | |
9422 case 311: | |
9423 pParty->uNumArenaSquireWins -= (char)a3; | |
9424 break; | |
9425 case 312: | |
9426 pParty->uNumArenaKnightWins -= (char)a3; | |
9427 break; | |
9428 case 313: | |
9429 pParty->uNumArenaLordWins -= (char)a3; | |
9430 break; | |
9431 } | |
9432 } | |
9433 else | |
9434 { | |
9435 if ( (signed int)var >= 123 ) | |
9436 { | |
9437 byte_5E4C15[var] -= (char)a3; | |
9438 } | |
9439 else | |
9440 { | |
9441 switch ( var ) | |
9442 { | |
9443 case VAR_RandomGold: | |
9444 v6 = rand() % (signed int)a3 + 1; | |
9445 if ( v6 > pParty->uNumGold ) | |
9446 v6 = pParty->uNumGold; | |
9447 Party::TakeGold(v6); | |
9448 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
9449 ShowStatusBarString(pTmpBuf, 2u); | |
9450 GameUI_DrawFoodAndGold(); | |
9451 return; | |
9452 case VAR_RandomFood: | |
9453 v7 = rand() % (signed int)a3 + 1; | |
9454 if ( v7 > pParty->uNumFoodRations ) | |
9455 v7 = pParty->uNumFoodRations; | |
9456 Party::TakeFood(v7); | |
9457 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9458 ShowStatusBarString(pTmpBuf, 2u); | |
9459 GameUI_DrawFoodAndGold(); | |
9460 goto LABEL_17; | |
9461 default: | |
9462 return; | |
9463 case VAR_CurrentHP: | |
9464 ReceiveDamage((signed int)a3, 4); | |
9465 goto LABEL_17; | |
9466 case VAR_CurrentSP: | |
9467 v9 = (char *)&this->sMana; | |
9468 v10 = this->sMana - (signed int)a3 < 0; | |
9469 *(int *)v9 -= (int)a3; | |
9470 if ( v10 ) | |
9471 *(int *)v9 = 0; | |
9472 goto LABEL_17; | |
9473 case VAR_ACModifier: | |
9474 this->sACModifier -= (unsigned __int8)a3; | |
9475 goto LABEL_17; | |
9476 case VAR_BaseLevel: | |
9477 this->uLevel -= (unsigned __int8)a3; | |
9478 goto LABEL_17; | |
9479 case VAR_LevelModifier: | |
9480 this->sLevelModifier -= (unsigned __int8)a3; | |
9481 goto LABEL_17; | |
9482 case VAR_Age: | |
9483 this->sAgeModifier -= (signed __int16)a3; | |
9484 return; | |
9485 case VAR_Award: | |
484 | 9486 v11 = this->_guilds_member_bits; |
0 | 9487 goto LABEL_112; |
9488 case VAR_Experience: | |
9489 v12 = (char *)&this->uExperience; | |
9490 v13 = (signed int)a3; | |
9491 v14 = *(int *)v12 < (unsigned int)a3; | |
9492 *(int *)v12 -= (int)a3; | |
9493 *((int *)v12 + 1) -= v14 + HIDWORD(v13); | |
9494 goto LABEL_17; | |
9495 case VAR_QBits_QuestsDone: | |
484 | 9496 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)a3, 0); |
187 | 9497 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
0 | 9498 return; |
9499 case VAR_PlayerItemInHands: | |
9500 v15 = (char *)this->pInventoryIndices; | |
9501 break; | |
9502 case VAR_FixedGold: | |
9503 if ( (unsigned int)a3 > pParty->uNumGold ) | |
9504 goto LABEL_88; | |
9505 Party::TakeGold((unsigned int)a3); | |
9506 return; | |
9507 case VAR_MightBonus: | |
9508 case VAR_ActualMight: | |
9509 this->uMightBonus -= (unsigned __int16)a3; | |
9510 goto LABEL_72; | |
9511 case VAR_IntellectBonus: | |
9512 case VAR_ActualIntellect: | |
9513 this->uIntelligenceBonus -= (unsigned __int16)a3; | |
9514 goto LABEL_72; | |
9515 case VAR_PersonalityBonus: | |
9516 case VAR_ActualPersonality: | |
9517 this->uWillpowerBonus -= (unsigned __int16)a3; | |
9518 goto LABEL_72; | |
9519 case VAR_EnduranceBonus: | |
9520 case VAR_ActualEndurance: | |
9521 this->uEnduranceBonus -= (unsigned __int16)a3; | |
9522 goto LABEL_72; | |
9523 case VAR_SpeedBonus: | |
9524 case VAR_ActualSpeed: | |
9525 this->uSpeedBonus -= (unsigned __int16)a3; | |
9526 goto LABEL_72; | |
9527 case VAR_AccuracyBonus: | |
9528 case VAR_ActualAccuracy: | |
9529 this->uAccuracyBonus -= (unsigned __int16)a3; | |
9530 goto LABEL_72; | |
9531 case VAR_LuckBonus: | |
9532 case VAR_ActualLuck: | |
9533 this->uLuckBonus -= (unsigned __int16)a3; | |
9534 goto LABEL_72; | |
9535 case VAR_BaseMight: | |
9536 this->uMight -= (unsigned __int16)a3; | |
9537 goto LABEL_45; | |
9538 case VAR_BaseIntellect: | |
9539 this->uIntelligence -= (unsigned __int16)a3; | |
9540 goto LABEL_45; | |
9541 case VAR_BasePersonality: | |
9542 this->uWillpower -= (unsigned __int16)a3; | |
9543 goto LABEL_45; | |
9544 case VAR_BaseEndurance: | |
9545 this->uEndurance -= (unsigned __int16)a3; | |
9546 goto LABEL_45; | |
9547 case VAR_BaseSpeed: | |
9548 this->uSpeed -= (unsigned __int16)a3; | |
9549 goto LABEL_45; | |
9550 case VAR_BaseAccuracy: | |
9551 this->uAccuracy -= (unsigned __int16)a3; | |
9552 goto LABEL_45; | |
9553 case VAR_BaseLuck: | |
9554 this->uLuck -= (unsigned __int16)a3; | |
9555 goto LABEL_45; | |
9556 case VAR_FireResistance: | |
9557 this->sResFireBase -= (signed __int16)a3; | |
9558 goto LABEL_45; | |
9559 case VAR_AirResistance: | |
9560 this->sResAirBase -= (signed __int16)a3; | |
9561 goto LABEL_45; | |
9562 case VAR_WaterResistance: | |
9563 this->sResWaterBase -= (signed __int16)a3; | |
9564 goto LABEL_45; | |
9565 case VAR_EarthResistance: | |
9566 this->sResEarthBase -= (signed __int16)a3; | |
9567 goto LABEL_45; | |
9568 case VAR_SpiritResistance: | |
9569 this->sResSpiritBase -= (signed __int16)a3; | |
9570 goto LABEL_45; | |
9571 case VAR_MindResistance: | |
9572 this->sResMindBase -= (signed __int16)a3; | |
9573 goto LABEL_45; | |
9574 case VAR_BodyResistance: | |
9575 this->sResBodyBase -= (signed __int16)a3; | |
9576 goto LABEL_45; | |
9577 case VAR_LightResistance: | |
9578 this->sResLightBase -= (signed __int16)a3; | |
9579 goto LABEL_45; | |
9580 case VAR_DarkResistance: | |
9581 this->sResDarkBase -= (signed __int16)a3; | |
9582 goto LABEL_45; | |
9583 case VAR_MagicResistance: | |
9584 this->sResMagicBase -= (signed __int16)a3; | |
9585 goto LABEL_45; | |
9586 case VAR_FireResistanceBonus: | |
9587 this->sResFireBonus -= (signed __int16)a3; | |
9588 goto LABEL_45; | |
9589 case VAR_AirResistanceBonus: | |
9590 this->sResAirBonus -= (signed __int16)a3; | |
9591 LABEL_45: | |
9592 v25 = 0; | |
9593 v23 = 92; | |
9594 goto LABEL_73; | |
9595 case VAR_WaterResistanceBonus: | |
9596 this->sResWaterBonus -= (signed __int16)a3; | |
9597 goto LABEL_72; | |
9598 case VAR_EarthResistanceBonus: | |
9599 this->sResEarthBonus -= (signed __int16)a3; | |
9600 goto LABEL_72; | |
9601 case VAR_SpiritResistanceBonus: | |
9602 this->sResSpiritBonus -= (signed __int16)a3; | |
9603 goto LABEL_72; | |
9604 case VAR_MindResistanceBonus: | |
9605 this->sResMindBonus -= (signed __int16)a3; | |
9606 goto LABEL_72; | |
9607 case VAR_BodyResistanceBonus: | |
9608 this->sResBodyBonus -= (signed __int16)a3; | |
9609 goto LABEL_72; | |
9610 case VAR_LightResistanceBonus: | |
9611 this->sResLightBonus -= (signed __int16)a3; | |
9612 goto LABEL_72; | |
9613 case VAR_DarkResistanceBonus: | |
9614 this->sResDarkBonus -= (signed __int16)a3; | |
9615 goto LABEL_72; | |
9616 case VAR_MagicResistanceBonus: | |
9617 this->sResMagicBonus -= (signed __int16)a3; | |
9618 LABEL_72: | |
9619 v25 = 0; | |
187 | 9620 v23 = SPEECH_91; |
0 | 9621 LABEL_73: |
187 | 9622 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); |
0 | 9623 goto LABEL_17; |
9624 case VAR_FixedFood: | |
9625 Party::TakeFood((unsigned int)a3); | |
9626 goto LABEL_17; | |
9627 case VAR_StaffSkill: | |
9628 case VAR_SwordSkill: | |
9629 case VAR_DaggerSkill: | |
9630 case VAR_AxeSkill: | |
9631 case VAR_SpearSkill: | |
9632 case VAR_BowSkill: | |
9633 case VAR_MaceSkill: | |
9634 case VAR_BlasterSkill: | |
9635 case VAR_ShieldSkill: | |
9636 case VAR_LeatherSkill: | |
9637 case VAR_SkillChain: | |
9638 case VAR_PlateSkill: | |
9639 case VAR_FireSkill: | |
9640 case VAR_AirSkill: | |
9641 case VAR_WaterSkill: | |
9642 case VAR_EarthSkill: | |
9643 case VAR_SpiritSkill: | |
9644 case VAR_MindSkill: | |
9645 case VAR_BodySkill: | |
9646 case VAR_LightSkill: | |
9647 case VAR_DarkSkill: | |
9648 case VAR_IdentifyItemSkill: | |
9649 case VAR_MerchantSkill: | |
9650 case VAR_RepairSkill: | |
9651 case VAR_BodybuildingSkill: | |
9652 case VAR_MeditationSkill: | |
9653 case VAR_PerceptionSkill: | |
9654 case VAR_DiplomacySkill: | |
9655 case VAR_DisarmTrapSkill: | |
9656 case VAR_LearningSkill: | |
9657 *((short *)&this->pConditions[16] + var) -= (unsigned __int8)a3; | |
9658 goto LABEL_17; | |
9659 case VAR_Cursed: | |
9660 case VAR_Weak: | |
9661 case VAR_Asleep: | |
9662 case VAR_Afraid: | |
9663 case VAR_Drunk: | |
9664 case VAR_Insane: | |
9665 case VAR_PoisonedGreen: | |
9666 case VAR_DiseasedGreen: | |
9667 case VAR_PoisonedYellow: | |
9668 case VAR_DiseasedYellow: | |
9669 case VAR_PoisonedRed: | |
9670 case VAR_DiseasedRed: | |
9671 case VAR_Paralyzed: | |
9672 case VAR_Unconsious: | |
9673 case VAR_Dead: | |
9674 case VAR_Stoned: | |
9675 case VAR_Eradicated: | |
9676 *((int *)this + 2 * var - 210) = 0; | |
9677 *((int *)this + 2 * v5 - 209) = 0; | |
9678 LABEL_17: | |
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; | |
9684 } | |
9685 do | |
9686 { | |
9687 if ( *(void **)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v15 + 5] == a3 ) | |
9688 { | |
9689 RemoveItemAtInventoryIndex(v3); | |
9690 return; | |
9691 } | |
9692 ++v3; | |
9693 v15 += 4; | |
9694 } | |
9695 while ( (signed int)v3 < 126 ); | |
9696 if ( (void *)pParty->pPickedItem.uItemID == a3 ) | |
9697 pMouse->RemoveHoldingItem(); | |
9698 } | |
9699 } | |
9700 } | |
9701 // 5B65C4: using guessed type int dword_5B65C4; | |
9702 // 5B65CC: using guessed type int dword_5B65CC; |