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