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