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