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