Mercurial > mm7
annotate Player.cpp @ 130:1c471f3629fb
Party expressions update
author | Nomad |
---|---|
date | Mon, 11 Feb 2013 19:40:49 +0200 |
parents | acff5a5d563b |
children | 9b0d651821f1 |
rev | line source |
---|---|
0 | 1 #include "OSAPI.h" |
2 | |
3 #include "Player.h" | |
4 #include "PlayerFrameTable.h" | |
5 #include "Texture.h" | |
6 #include "AudioPlayer.h" | |
7 #include "Party.h" | |
8 #include "GUIButton.h" | |
9 #include "LOD.h" | |
10 #include "Monsters.h" | |
11 #include "GUIWindow.h" | |
12 #include "Viewport.h" | |
13 #include "Actor.h" | |
14 #include "Game.h" | |
15 #include "Mouse.h" | |
16 #include "TurnEngine.h" | |
17 #include "Events.h" | |
18 #include "Events2D.h" | |
19 #include "Outdoor.h" | |
20 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
21 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Awards.h" |
0 | 23 #include "mm7_data.h" |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 /* 381 */ | |
31 #pragma pack(push, 1) | |
32 struct PlayerCreation_AttributeProp | |
33 { | |
34 unsigned __int8 uBaseValue; | |
35 char uMaxValue; | |
36 char uDroppedStep; | |
37 char uBaseStep; | |
38 }; | |
39 #pragma pack(pop) | |
40 | |
41 | |
42 #pragma pack(push, 1) | |
43 struct PlayerCreation_AttributePropsByRace | |
44 { | |
45 PlayerCreation_AttributeProp attr[7]; | |
46 }; | |
47 | |
48 struct PlayerCreation_AttributeProps | |
49 { | |
50 union | |
51 { | |
52 unsigned __int8 _[4][7][4]; | |
53 PlayerCreation_AttributePropsByRace race[4]; | |
54 }; | |
55 }; | |
56 #pragma pack(pop) | |
57 PlayerCreation_AttributeProps stru_4ED7B0 = | |
58 { | |
59 11, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, | |
60 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 9, 20, 1, 1, | |
61 14, 30, 1, 2, 7, 15, 2, 1, 7, 15, 2, 1, 11, 25, 1, 1, 11, 25, 1, 1, 14, 30, 1, 2, 9, 20, 1, 1, | |
62 14, 30, 1, 2, 11, 25, 1, 1, 11, 25, 1, 1, 14, 30, 1, 2, 7, 15, 2, 1, 7, 15, 2, 1, 9, 20, 1, 1 | |
63 }; | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 // available skills per class ( 9 classes X 37 skills ) | |
71 // 0 - not available | |
72 // 1 - available | |
73 // 2 - primary skill | |
74 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
75 { | |
76 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
77 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
78 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
79 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
80 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
81 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
82 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
83 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
84 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
85 }; | |
86 | |
87 | |
88 | |
89 | |
90 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
91 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
92 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
93 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
94 | |
95 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
96 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
97 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
98 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
99 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
100 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
101 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
102 | |
103 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
104 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
105 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
106 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
107 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
108 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
109 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
110 | |
111 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
112 | |
113 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
114 | |
94 | 115 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 116 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 117 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 118 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 119 |
120 | |
121 | |
122 | |
123 //----- (00490913) -------------------------------------------------------- | |
124 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
125 { | |
126 signed int v0; // edi@1 | |
127 signed int v1; // esi@1 | |
128 int v2; // ebx@2 | |
129 int v3; // ecx@17 | |
130 signed int v4; // eax@17 | |
131 int v5; // edx@18 | |
132 signed int v6; // ecx@18 | |
133 signed int v8; // [sp+Ch] [bp-8h]@1 | |
134 signed int v9; // [sp+10h] [bp-4h]@2 | |
135 | |
136 v8 = 50; | |
137 v0 = 50; | |
138 v1 = 0; | |
139 do | |
140 { | |
141 v9 = 0; | |
142 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
143 do | |
144 { | |
145 if ( v9 ) | |
146 { | |
147 switch ( v9 ) | |
148 { | |
149 case 1: | |
150 v0 = pParty->pPlayers[v1].uIntelligence; | |
151 break; | |
152 case 2: | |
153 v0 = pParty->pPlayers[v1].uWillpower; | |
154 break; | |
155 case 3: | |
156 v0 = pParty->pPlayers[v1].uEndurance; | |
157 break; | |
158 case 4: | |
159 v0 = pParty->pPlayers[v1].uAccuracy; | |
160 break; | |
161 case 5: | |
162 v0 = pParty->pPlayers[v1].uSpeed; | |
163 break; | |
164 case 6: | |
165 v0 = pParty->pPlayers[v1].uLuck; | |
166 break; | |
167 } | |
168 } | |
169 else | |
170 { | |
171 v0 = pParty->pPlayers[v1].uMight; | |
172 } | |
173 v3 = v2 + v9; | |
174 v4 = stru_4ED7B0.race[0].attr[v3].uBaseValue; | |
175 if ( v0 >= v4 ) | |
176 { | |
177 v5 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | |
178 v6 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | |
179 } | |
180 else | |
181 { | |
182 v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | |
183 v6 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | |
184 } | |
185 v8 += v5 * (v4 - v0) / v6; | |
186 ++v9; | |
187 } | |
188 while ( v9 <= 6 ); | |
189 ++v1; | |
190 } | |
191 while ( v1 < 4 ); | |
192 return v8; | |
193 } | |
194 | |
195 | |
196 | |
197 //----- (00427730) -------------------------------------------------------- | |
198 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
199 { | |
200 int v2; // eax@1 | |
201 bool result; // eax@2 | |
202 | |
203 v2 = this->sMana; | |
204 if ( v2 >= (signed int)uRequiredMana ) | |
205 { | |
206 this->sMana = v2 - uRequiredMana; | |
207 result = 1; | |
208 } | |
209 else | |
210 { | |
211 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
212 result = 0; | |
213 } | |
214 return result; | |
215 } | |
216 | |
217 | |
218 //----- (004BE2DD) -------------------------------------------------------- | |
219 void Player::_4BE2DD(unsigned int a2, int a3, int _2devent_idx) | |
220 { | |
221 Player *v4; // edi@1 | |
222 char *v5; // esi@1 | |
223 float v6; // ST04_4@1 | |
224 signed int v7; // eax@1 | |
225 signed int v8; // ebx@1 | |
226 | |
227 auto a4 = _2devent_idx; | |
228 v4 = this; | |
229 v5 = (char *)this + 36 * a3; | |
230 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
231 //v6 = p2DEvents_minus1__20[13 * a4]; | |
232 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
233 v8 = _4B8102(v7, v6); | |
234 if ( v5[552] & 2 ) | |
235 v8 = 1; | |
236 if ( v8 < 1 ) | |
237 v8 = 1; | |
238 RemoveItemAtInventoryIndex(a2); | |
239 Party::SetGold(pParty->uNumGold + v8); | |
240 } | |
241 | |
242 | |
243 | |
244 //----- (0043EEF3) -------------------------------------------------------- | |
245 bool Player::_43EEF3() | |
246 { | |
247 signed int v1; // esi@1 | |
248 PlayerEquipment *v2; // edx@1 | |
249 bool result; // eax@2 | |
250 | |
251 v1 = 0; | |
252 v2 = &this->pEquipment; | |
253 while ( 1 ) | |
254 { | |
255 result = v2->uOffHand; | |
256 if ( v2->uOffHand ) | |
257 { | |
258 result = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * result + 5]; | |
259 if ( result ) | |
260 { | |
261 if ( result != 64 && result != 65 ) | |
262 break; | |
263 } | |
264 } | |
265 ++v1; | |
266 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
267 if ( v1 >= 16 ) | |
268 { | |
269 LOBYTE(result) = 1; | |
270 return result; | |
271 } | |
272 } | |
273 LOBYTE(result) = 0; | |
274 return result; | |
275 } | |
276 | |
277 | |
278 | |
279 //----- (004B8040) -------------------------------------------------------- | |
280 int Player::_4B8040_condition_time(unsigned int uCondition) | |
281 { | |
282 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
283 } | |
284 | |
285 //----- (004B807C) -------------------------------------------------------- | |
286 int Player::_4B807C(float a2) | |
287 { | |
288 Player *v2; // edi@1 | |
289 unsigned int v3; // eax@1 | |
290 int v4; // esi@1 | |
291 unsigned int v5; // ebx@7 | |
292 int v6; // eax@8 | |
293 signed __int64 v7; // qax@13 | |
294 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
295 signed int v10; // [sp+8h] [bp-8h]@4 | |
296 int v11; // [sp+Ch] [bp-4h]@6 | |
297 | |
298 v2 = this; | |
299 v3 = GetMajorConditionIdx(); | |
300 v4 = 0; | |
301 if ( (signed int)v3 >= 14 ) | |
302 { | |
303 if ( (signed int)v3 <= 15 ) | |
304 { | |
305 v10 = 5; | |
306 v9 = v3; | |
307 goto LABEL_6; | |
308 } | |
309 if ( v3 == 16 ) | |
310 { | |
311 v10 = 10; | |
312 v9 = 16; | |
313 LABEL_6: | |
314 v11 = _4B8040_condition_time(v9); | |
315 goto LABEL_13; | |
316 } | |
317 } | |
318 v10 = 1; | |
319 v5 = 0; | |
320 do | |
321 { | |
322 v6 = _4B8040_condition_time(v5); | |
323 if ( v6 > v4 ) | |
324 v4 = v6; | |
325 ++v5; | |
326 } | |
327 while ( (signed int)v5 <= 13 ); | |
328 v11 = v4; | |
329 if ( !v4 ) | |
330 v11 = 1; | |
331 LABEL_13: | |
332 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
333 if ( (signed int)v7 < 1 ) | |
334 LODWORD(v7) = 1; | |
335 return v7; | |
336 } | |
337 | |
338 //----- (004B8102) -------------------------------------------------------- | |
339 int Player::_4B8102(int a2, float a3) | |
340 { | |
341 signed int v3; // esi@1 | |
342 signed int result; // eax@3 | |
343 | |
344 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; | |
345 if ( v3 > a2 ) | |
346 v3 = a2; | |
347 result = 1; | |
348 if ( v3 >= 1 ) | |
349 result = v3; | |
350 return result; | |
351 } | |
352 | |
353 //----- (004B8142) -------------------------------------------------------- | |
354 int Player::_4B8142(int a2, float a3) | |
355 { | |
356 int result; // eax@1 | |
357 | |
358 result = (int)((100 - GetMerchant()) * (unsigned __int64)(signed __int64)((double)a2 * a3)) / 100; | |
359 if ( result < a2 ) | |
360 result = a2; | |
361 if ( result < 1 ) | |
362 result = 1; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B8179) -------------------------------------------------------- | |
367 int Player::_4B8179(float a2) | |
368 { | |
369 signed int v2; // esi@1 | |
370 int v3; // ecx@1 | |
371 signed int result; // eax@3 | |
372 | |
373 v2 = (signed __int64)(a2 * 50.0); | |
374 v3 = v2 * (100 - GetMerchant()) / 100; | |
375 if ( v3 < v2 / 3 ) | |
376 v3 = v2 / 3; | |
377 result = 1; | |
378 if ( v3 >= 1 ) | |
379 result = v3; | |
380 return result; | |
381 } | |
382 | |
383 //----- (004B81C3) -------------------------------------------------------- | |
384 int Player::_4B81C3(int a2, float a3) | |
385 { | |
386 signed int v3; // esi@1 | |
387 int v4; // ecx@1 | |
388 signed int result; // eax@3 | |
389 | |
390 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
391 v4 = v3 * (100 - GetMerchant()) / 100; | |
392 if ( v4 < v3 / 3 ) | |
393 v4 = v3 / 3; | |
394 result = 1; | |
395 if ( v4 >= 1 ) | |
396 result = v4; | |
397 return result; | |
398 } | |
399 | |
400 //----- (004B8213) -------------------------------------------------------- | |
401 int Player::_4B8213(int a2, float a3) | |
402 { | |
403 signed __int64 v3; // qax@1 | |
404 | |
405 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
406 if ( (signed int)v3 < 1 ) | |
407 LODWORD(v3) = 1; | |
408 return v3; | |
409 } | |
410 | |
411 //----- (004B8233) -------------------------------------------------------- | |
412 int Player::_4B8233(int a2, float a3) | |
413 { | |
414 signed __int64 v3; // qax@1 | |
415 | |
416 v3 = (signed __int64)((double)a2 * a3); | |
417 if ( (signed int)v3 < 1 ) | |
418 LODWORD(v3) = 1; | |
419 return v3; | |
420 } | |
421 | |
422 //----- (004B824B) -------------------------------------------------------- | |
423 int Player::_4B824B(float a2) | |
424 { | |
425 signed __int64 v2; // qax@1 | |
426 | |
427 v2 = (signed __int64)(a2 * 50.0); | |
428 if ( (signed int)v2 < 1 ) | |
429 LODWORD(v2) = 1; | |
430 return v2; | |
431 } | |
432 | |
433 //----- (004B8265) -------------------------------------------------------- | |
434 int Player::_4B8265(int a2, float a3) | |
435 { | |
436 signed __int64 v3; // qax@1 | |
437 | |
438 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
439 if ( (signed int)v3 < 1 ) | |
440 LODWORD(v3) = 1; | |
441 return v3; | |
442 } | |
443 | |
444 | |
445 | |
446 | |
447 | |
448 //----- (004B6FF9) -------------------------------------------------------- | |
449 int Player::_4B6FF9() | |
450 { | |
451 Player *v1; // esi@1 | |
452 signed int v2; // eax@1 | |
453 char v3; // zf@4 | |
454 | |
455 v1 = this; | |
456 v2 = (signed int)ptr_507BC0->ptr_1C; | |
457 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) | |
458 { | |
459 if ( GetMajorConditionIdx() == 18 ) | |
460 goto LABEL_6; | |
461 v3 = GetMajorConditionIdx() == 17; | |
462 } | |
463 else | |
464 { | |
465 v3 = GetMajorConditionIdx() == 18; | |
466 } | |
467 if ( !v3 ) | |
468 return 1; | |
469 LABEL_6: | |
470 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
471 return 1; | |
472 return 0; | |
473 } | |
474 | |
475 | |
476 | |
477 //----- (00421E75) -------------------------------------------------------- | |
478 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
479 { | |
480 int v2; // eax@1 | |
481 unsigned int result; // eax@3 | |
482 | |
483 v2 = *a2; | |
484 if ( *a2 >= 126 || v2 < 0 ) | |
485 { | |
486 result = 0; | |
487 } | |
488 else | |
489 { | |
490 result = this->pInventoryIndices[v2]; | |
491 if ( (result & 0x80000000u) != 0 ) | |
492 { | |
493 *a2 = -1 - result; | |
494 result = this->pInventoryIndices[-1 - result]; | |
495 } | |
496 } | |
497 return result; | |
498 } | |
499 | |
500 | |
501 | |
502 //----- (004160CA) -------------------------------------------------------- | |
503 char Player::_4160CA(int a2) | |
504 { | |
505 Player *v2; // esi@1 | |
506 signed int v3; // edx@1 | |
507 signed int v4; // ebx@1 | |
508 ItemGen *v5; // eax@1 | |
509 int v6; // edi@2 | |
510 signed int i; // edx@8 | |
511 ItemGen **v8; // ecx@9 | |
512 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
513 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
514 int v12; // [sp+120h] [bp-4h]@1 | |
515 | |
516 auto a1 = this; | |
517 | |
518 v12 = a2; | |
519 v2 = a1; | |
520 v3 = 0; | |
521 v10[0] = 0; | |
522 v4 = 0; | |
523 memset(&v10[1], 0, 0x110u); | |
524 v11 = 0; | |
525 v5 = a1->pInventoryItems; | |
526 do | |
527 { | |
528 v6 = 0; | |
529 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
530 v10[v4++] = v3; | |
531 ++v3; | |
532 ++v5; | |
533 } | |
534 while ( v3 < 138 ); | |
535 if ( v4 ) | |
536 { | |
537 if ( v12 ) | |
538 { | |
539 if ( v12 > 0 ) | |
540 { | |
541 do | |
542 { | |
543 LOWORD(v5) = 9 * v10[v6]; | |
544 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
545 { | |
546 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
547 v5->uItemID |= 2u; | |
548 } | |
549 ++v6; | |
550 } | |
551 while ( v6 < v12 ); | |
552 } | |
553 } | |
554 else | |
555 { | |
556 for ( i = 0; i < v4; ++i ) | |
557 { | |
558 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
559 v5 = *v8; | |
560 if ( !(BYTE1(v5) & 2) ) | |
561 { | |
562 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
563 *v8 = v5; | |
564 } | |
565 } | |
566 } | |
567 } | |
568 return (char)v5; | |
569 } | |
570 | |
571 //----- (004948B1) -------------------------------------------------------- | |
572 __int16 Player::PlaySound(int a2, int a3) | |
573 { | |
574 Player *pPlayer; // edi@1 | |
575 int v4; // eax@4 | |
576 signed int v5; // esi@4 | |
577 short *v6; // ebx@4 | |
578 signed int v7; // ecx@5 | |
579 unsigned __int8 v8; // al@6 | |
580 int v9; // eax@10 | |
581 unsigned int pVoiceID; // ecx@10 | |
582 int v11; // esi@10 | |
583 signed int v12; // eax@11 | |
584 signed int v13; // esi@12 | |
585 int v14; // eax@12 | |
586 int v15; // eax@17 | |
587 int pExpression; // ebx@17 | |
588 signed int v17; // ecx@19 | |
589 char *pSoundID; // edi@20 | |
590 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
591 Player *pPlayer2; // [sp+20h] [bp-8h]@1 | |
592 int pPlayerNum; // [sp+24h] [bp-4h]@1 | |
593 int pSoundId; // [sp+30h] [bp+8h]@4 | |
594 | |
595 pPlayer = this; | |
596 pPlayer2 = this; | |
597 pPlayerNum = 1; | |
598 do | |
599 { | |
600 if ( this == pPlayers[pPlayerNum] ) | |
601 break; | |
602 ++pPlayerNum; | |
603 } | |
604 while ( pPlayerNum <= 4 ); | |
605 v4 = a2;//102 | |
606 v5 = 0; | |
607 pSoundId = 0; | |
44 | 608 v6 = &SoundSetAction[8 * v4];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
0 | 609 if ( uVoicesVolumeMultiplier ) |
610 { | |
611 v7 = 0; | |
612 do | |
613 { | |
614 v8 = v6[v7]; | |
615 if ( v8 ) | |
616 v20[v5++] = v8; | |
617 ++v7; | |
618 } | |
619 while ( v7 < 2 ); | |
620 if ( v5 ) | |
621 { | |
622 v9 = rand(); | |
623 pVoiceID = pPlayer->uVoiceID; | |
624 v11 = v20[v9 % v5]; | |
625 if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) ) | |
626 { | |
627 pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) | |
628 + 2 * (v11 + 50 * pPlayer2->uVoiceID) | |
629 + 4998; | |
630 v12 = 8 * pPlayerNum + 312; | |
631 LOBYTE(v12) = v12 | 4; | |
24 | 632 pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); |
0 | 633 } |
634 } | |
635 } | |
636 v13 = 0; | |
637 v14 = (int)(v6 + 3); | |
638 do | |
639 { | |
640 if ( *(char *)v14 ) | |
641 v20[v13++] = *(char *)v14; | |
642 ++v14; | |
643 } | |
644 while ( -3 - (signed int)v6 + v14 < 5 ); | |
645 if ( v13 ) | |
646 { | |
647 v15 = rand(); | |
648 pPlayerNum = 0; | |
649 pExpression = v20[v15 % v13]; | |
650 if ( pExpression == 21 && pSoundId ) | |
651 { | |
652 v17 = 0; | |
653 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
654 { | |
655 LABEL_23: | |
656 v17 = 0; | |
657 } | |
658 else | |
659 { | |
660 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
661 while ( *(int *)pSoundID != pSoundId ) | |
662 { | |
663 ++v17; | |
664 pSoundID += 120; | |
665 if ( v17 >= (signed int)pSoundList->uNumSounds ) | |
666 goto LABEL_23; | |
667 } | |
668 } | |
669 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
670 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
671 } | |
130 | 672 LOWORD(v14) = pPlayer2->PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); |
0 | 673 } |
674 return v14; | |
675 } | |
676 // 4948B1: using guessed type int var_1C[5]; | |
677 | |
678 //----- (00494A25) -------------------------------------------------------- | |
130 | 679 __int16 Player::PlayEmotion(CHARACTER_EXPRESSION_ID expr, int a3) |
0 | 680 { |
681 signed int v3; // eax@1 | |
130 | 682 CHARACTER_EXPRESSION_ID v4; // dx@1 |
0 | 683 signed int v5; // edi@15 |
684 PlayerFrame *v6; // esi@17 | |
685 signed int v7; // eax@20 | |
686 | |
130 | 687 LOWORD(v3) = this->expression; |
688 v4 = expr; | |
689 if ( (short)v3 != 4 && (short)v3 != 12 || expr != 58 ) | |
0 | 690 { |
691 v3 = (unsigned __int16)v3; | |
692 if ( (signed int)(unsigned __int16)v3 >= 2 ) | |
693 { | |
694 if ( v3 <= 7 ) | |
695 goto LABEL_12; | |
696 if ( v3 > 8 ) | |
697 { | |
698 if ( v3 > 11 ) | |
699 { | |
700 if ( v3 == 12 || v3 > 97 && v3 <= 99 ) | |
701 return v3; | |
702 goto LABEL_15; | |
703 } | |
704 LABEL_12: | |
130 | 705 if ( expr != 34 && expr != 35 && expr != 36 ) |
0 | 706 return v3; |
707 goto LABEL_15; | |
708 } | |
709 } | |
710 } | |
711 LABEL_15: | |
712 LOWORD(v3) = a3; | |
713 v5 = 0; | |
714 this->uExpressionTimeLength = a3; | |
715 this->uExpressionTimePassed = 0; | |
716 if ( !a3 ) | |
717 { | |
718 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
719 { | |
720 LABEL_20: | |
721 v7 = 0; | |
722 } | |
723 else | |
724 { | |
725 v6 = pPlayerFrameTable->pFrames; | |
130 | 726 while ( v6->expression != expr ) |
0 | 727 { |
728 ++v5; | |
729 ++v6; | |
730 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
731 goto LABEL_20; | |
732 } | |
733 v7 = v5; | |
734 } | |
130 | 735 v4 = expr; |
0 | 736 LOWORD(v3) = 8 * pPlayerFrameTable->pFrames[v3].uAnimLength; |
737 this->uExpressionTimeLength = v3; | |
738 } | |
130 | 739 this->expression = v4; |
0 | 740 viewparams->bRedrawGameUI = 1; |
741 return v3; | |
742 } | |
743 | |
744 //----- (0049327B) -------------------------------------------------------- | |
745 int Player::_49327B(unsigned int uClass, int a3) | |
746 { | |
747 Player *v3; // esi@1 | |
748 char v4; // zf@4 | |
749 __int16 v5; // dx@9 | |
750 signed int result; // eax@84 | |
751 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
752 int v8; // [sp-4h] [bp-Ch]@3 | |
753 | |
754 v3 = this; | |
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 | |
130 | 2282 expression = CHARACTER_EXPRESSION_INVALID; |
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) | |
118 | 3392 || *(int *)&this->pInventoryItems[a2-1].uItemID != a1 ) |
0 | 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 { | |
118 | 5453 v22 = this->GetEquippedItemEquipType(1u); |
0 | 5454 if ( v22 >= 0 ) |
5455 { | |
5456 if ( v22 <= 2 ) | |
5457 { | |
118 | 5458 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
5459 if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) | |
0 | 5460 { |
5461 v24 = v23; | |
5462 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5463 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5464 } | |
5465 else | |
5466 { | |
5467 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5468 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5469 } | |
5470 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5471 } | |
5472 } | |
5473 } | |
5474 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v28 = v27->GetEquippedItemEquipType(0), v28 < 0) || v28 > 2 ) | |
5475 return v5 + v62 + v61; | |
5476 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5477 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5478 goto LABEL_88; | |
5479 } | |
5480 v59 = 3; | |
5481 LABEL_74: | |
5482 v5 = v59; | |
5483 return v5 + v62 + v61; | |
5484 } | |
5485 if ( (signed int)attr < 0 ) | |
5486 return v5 + v62 + v61; | |
5487 if ( (signed int)attr <= 23 ) | |
5488 goto LABEL_95; | |
5489 if ( (signed int)attr <= 24 ) | |
5490 return v5 + v62 + v61; | |
5491 if ( (signed int)attr <= 26 ) | |
5492 { | |
5493 if ( IsUnarmed() == 1 ) | |
5494 { | |
5495 v5 = 0; | |
5496 return v5 + v62 + v61; | |
5497 } | |
5498 if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) | |
5499 { | |
118 | 5500 v17 = this->GetEquippedItemEquipType(1u); |
0 | 5501 if ( v17 >= 0 ) |
5502 { | |
5503 if ( v17 <= 2 ) | |
5504 v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uMainHand + 5]].uDamageMod; | |
5505 } | |
5506 } | |
5507 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 ) | |
5508 return v5 + v62 + v61; | |
5509 v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uOffHand + 5]; | |
5510 goto LABEL_365; | |
5511 } | |
5512 if ( attr == 27 ) | |
5513 { | |
5514 if ( IsUnarmed() == 1 ) | |
5515 { | |
5516 v5 = 1; | |
5517 return v5 + v62 + v61; | |
5518 } | |
5519 if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) | |
5520 { | |
118 | 5521 v9 = this->GetEquippedItemEquipType(1u); |
0 | 5522 if ( v9 >= 0 ) |
5523 { | |
5524 if ( v9 <= 2 ) | |
5525 { | |
118 | 5526 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
0 | 5527 if ( !v6->pEquipment.uOffHand ) |
5528 { | |
118 | 5529 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5530 ++v5; |
5531 } | |
5532 } | |
5533 } | |
5534 } | |
5535 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v12 = v11->GetEquippedItemEquipType(0), v12 < 0) || v12 > 2 ) | |
5536 return v5 + v62 + v61; | |
118 | 5537 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; |
5538 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; | |
0 | 5539 LABEL_88: |
5540 v5 += v15 + v14; | |
5541 } | |
5542 return v5 + v62 + v61; | |
5543 } | |
5544 | |
5545 //----- (0048F73C) -------------------------------------------------------- | |
5546 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5547 { | |
5548 int result; // eax@1 | |
5549 int v3; // eax@4 | |
5550 int v4; // ecx@5 | |
5551 | |
5552 switch (a2) | |
5553 { | |
5554 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5555 } | |
5556 | |
5557 result = 0; | |
5558 if ( (signed int)a2 > 10 ) | |
5559 { | |
5560 if ( (signed int)a2 <= 15 ) | |
5561 { | |
5562 switch ( a2 ) | |
5563 { | |
5564 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5565 v3 = this->pPlayerBuffs[2].uPower; | |
5566 v4 = pParty->pPartyBuffs[1].uPower; | |
5567 break; | |
5568 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5569 v3 = this->pPlayerBuffs[0].uPower; | |
5570 v4 = pParty->pPartyBuffs[0].uPower; | |
5571 break; | |
5572 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5573 v3 = this->pPlayerBuffs[22].uPower; | |
5574 v4 = pParty->pPartyBuffs[17].uPower; | |
5575 break; | |
5576 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5577 v3 = this->pPlayerBuffs[3].uPower; | |
5578 v4 = pParty->pPartyBuffs[4].uPower; | |
5579 break; | |
5580 default: | |
5581 if ( a2 != 14 ) | |
5582 return result; | |
5583 v3 = this->pPlayerBuffs[9].uPower; | |
5584 v4 = pParty->pPartyBuffs[12].uPower; | |
5585 break; | |
5586 } | |
5587 return v4 + v3; | |
5588 } | |
5589 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5590 { | |
5591 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5592 { | |
5593 v3 = this->pPlayerBuffs[8].uPower; | |
5594 v4 = pParty->pPartyBuffs[9].uPower; | |
5595 return v4 + v3; | |
5596 } | |
5597 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5598 return result; | |
5599 } | |
5600 return this->pPlayerBuffs[1].uPower; | |
5601 } | |
5602 if ( a2 == 10 ) | |
5603 { | |
5604 v3 = this->pPlayerBuffs[5].uPower; | |
5605 v4 = pParty->pPartyBuffs[6].uPower; | |
5606 return v4 + v3; | |
5607 } | |
5608 switch ( a2 ) | |
5609 { | |
5610 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5611 v3 = pPlayerBuffs[19].uPower; | |
5612 goto LABEL_5; | |
5613 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5614 v3 = pPlayerBuffs[17].uPower; | |
5615 goto LABEL_5; | |
5616 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5617 v3 = pPlayerBuffs[20].uPower; | |
5618 goto LABEL_5; | |
5619 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5620 v3 = pPlayerBuffs[16].uPower; | |
5621 goto LABEL_5; | |
5622 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5623 v3 = pPlayerBuffs[15].uPower; | |
5624 goto LABEL_5; | |
5625 case CHARACTER_ATTRIBUTE_SPEED: | |
5626 v3 = pPlayerBuffs[21].uPower; | |
5627 goto LABEL_5; | |
5628 case CHARACTER_ATTRIBUTE_LUCK: | |
5629 v3 = pPlayerBuffs[18].uPower; | |
5630 LABEL_5: | |
5631 v4 = pParty->pPartyBuffs[2].uPower; | |
5632 return v4 + v3; | |
5633 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5634 v3 = this->pPlayerBuffs[14].uPower; | |
5635 v4 = pParty->pPartyBuffs[15].uPower; | |
5636 return v4 + v3; | |
5637 default: | |
5638 return result; | |
5639 } | |
5640 return result; | |
5641 } | |
5642 | |
5643 //----- (0048F882) -------------------------------------------------------- | |
5644 char Player::GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType) | |
5645 { | |
5646 signed int v2; // esi@1 | |
5647 unsigned __int16 v3; // ax@126 | |
5648 char result; // al@127 | |
5649 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5650 signed int v6; // [sp-4h] [bp-14h]@27 | |
5651 unsigned int v7; // [sp-4h] [bp-14h]@35 | |
5652 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 | |
5653 Player *v9; // [sp+Ch] [bp-4h]@1 | |
5654 | |
5655 v2 = 0; | |
5656 v9 = this; | |
5657 if ( uSkillType > PLAYER_SKILL_DODGE ) | |
5658 { | |
5659 if ( uSkillType != PLAYER_SKILL_UNARMED ) | |
5660 { | |
5661 if ( uSkillType == PLAYER_SKILL_MONSTER_ID ) | |
5662 { | |
5663 if ( CheckHiredNPCSpeciality(0x3Au) ) | |
5664 v2 = 6; | |
5665 if ( CheckHiredNPCSpeciality(0x39u) ) | |
5666 v2 += 6; | |
5667 goto LABEL_83; | |
5668 } | |
5669 if ( uSkillType == PLAYER_SKILL_ARMSMASTER ) | |
5670 { | |
5671 if ( CheckHiredNPCSpeciality(0xFu) ) | |
5672 v2 = 2; | |
5673 if ( CheckHiredNPCSpeciality(0x10u) ) | |
5674 v2 += 3; | |
5675 goto LABEL_64; | |
5676 } | |
5677 if ( uSkillType == PLAYER_SKILL_STEALING ) | |
5678 { | |
5679 if ( CheckHiredNPCSpeciality(0x33u) ) | |
5680 v2 = 8; | |
5681 goto LABEL_64; | |
5682 } | |
5683 if ( uSkillType == PLAYER_SKILL_ALCHEMY ) | |
5684 { | |
5685 if ( CheckHiredNPCSpeciality(0x17u) ) | |
5686 v2 = 4; | |
5687 if ( CheckHiredNPCSpeciality(0x18u) ) | |
5688 v2 += 8; | |
5689 goto LABEL_64; | |
5690 } | |
5691 if ( uSkillType == 36 ) // learning | |
5692 { | |
5693 if ( CheckHiredNPCSpeciality(0xDu) ) | |
5694 v2 = 10; | |
5695 if ( CheckHiredNPCSpeciality(0xEu) ) | |
5696 v2 += 15; | |
5697 if ( CheckHiredNPCSpeciality(4u) ) | |
5698 v2 += 5; | |
5699 goto LABEL_64; | |
5700 } | |
5701 goto LABEL_86; | |
5702 } | |
5703 if ( !CheckHiredNPCSpeciality(0x38u) ) | |
5704 goto LABEL_112; | |
5705 LABEL_85: | |
5706 v2 = 2; | |
5707 goto LABEL_86; | |
5708 } | |
5709 if ( uSkillType == PLAYER_SKILL_DODGE ) | |
5710 { | |
5711 if ( !CheckHiredNPCSpeciality(0x38u) ) | |
5712 goto LABEL_112; | |
5713 v6 = 2; | |
5714 goto LABEL_51; | |
5715 } | |
5716 if ( uSkillType <= PLAYER_SKILL_ITEM_ID ) | |
5717 { | |
5718 if ( uSkillType != PLAYER_SKILL_ITEM_ID ) | |
5719 { | |
5720 if ( (signed int)uSkillType < 0 ) | |
5721 goto LABEL_86; | |
5722 if ( uSkillType > PLAYER_SKILL_PLATE ) | |
5723 { | |
5724 if ( uSkillType <= PLAYER_SKILL_EARTH ) | |
5725 { | |
5726 if ( CheckHiredNPCSpeciality(0x11u) ) | |
5727 v2 = 2; | |
5728 if ( CheckHiredNPCSpeciality(0x12u) ) | |
5729 v2 += 3; | |
5730 v5 = 19; | |
5731 } | |
5732 else | |
5733 { | |
5734 if ( uSkillType > PLAYER_SKILL_BODY ) | |
5735 goto LABEL_86; | |
5736 if ( CheckHiredNPCSpeciality(0x35u) ) | |
5737 v2 = 2; | |
5738 if ( CheckHiredNPCSpeciality(0x36u) ) | |
5739 v2 += 3; | |
5740 v5 = 55; | |
5741 } | |
5742 if ( CheckHiredNPCSpeciality(v5) ) | |
5743 v2 += 4; | |
5744 if ( v9->uClass == 31 && sub_476387() ) | |
5745 v2 += 3; | |
5746 LABEL_86: | |
5747 if ( uSkillType <= PLAYER_SKILL_DARK ) | |
5748 { | |
5749 if ( uSkillType == PLAYER_SKILL_DARK ) | |
5750 { | |
5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5752 } | |
5753 else | |
5754 { | |
5755 if ( uSkillType > PLAYER_SKILL_EARTH ) | |
5756 { | |
5757 switch ( uSkillType ) | |
5758 { | |
5759 case 16: | |
5760 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5761 break; | |
5762 case 17: | |
5763 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5764 break; | |
5765 case 18: | |
5766 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5767 break; | |
5768 default: | |
5769 if ( uSkillType != 19 ) | |
5770 goto LABEL_126; | |
5771 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5772 break; | |
5773 } | |
5774 } | |
5775 else | |
5776 { | |
5777 switch ( uSkillType ) | |
5778 { | |
5779 case PLAYER_SKILL_EARTH: | |
5780 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5781 break; | |
5782 case PLAYER_SKILL_BOW: | |
5783 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5784 break; | |
5785 case PLAYER_SKILL_SHIELD: | |
5786 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5787 break; | |
5788 case PLAYER_SKILL_FIRE: | |
5789 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5790 break; | |
5791 case PLAYER_SKILL_AIR: | |
5792 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5793 break; | |
5794 default: | |
5795 if ( uSkillType != 14 ) | |
5796 goto LABEL_126; | |
5797 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5798 break; | |
5799 } | |
5800 } | |
5801 } | |
5802 goto LABEL_125; | |
5803 } | |
5804 if ( uSkillType <= PLAYER_SKILL_MONSTER_ID ) | |
5805 { | |
5806 if ( uSkillType != PLAYER_SKILL_MONSTER_ID ) | |
5807 goto LABEL_112; | |
5808 LABEL_83: | |
5809 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5810 goto LABEL_125; | |
5811 } | |
5812 LABEL_64: | |
5813 switch ( uSkillType ) | |
5814 { | |
5815 case PLAYER_SKILL_ARMSMASTER: | |
5816 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; | |
5817 break; | |
5818 case PLAYER_SKILL_STEALING: | |
5819 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5820 break; | |
5821 case PLAYER_SKILL_ALCHEMY: | |
5822 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5823 break; | |
5824 default: | |
5825 if ( uSkillType != 36 ) | |
5826 goto LABEL_126; | |
5827 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5828 break; | |
5829 } | |
5830 goto LABEL_125; | |
5831 } | |
5832 if ( !CheckHiredNPCSpeciality(0x2Eu) ) | |
5833 goto LABEL_86; | |
5834 goto LABEL_85; | |
5835 } | |
5836 if ( !CheckHiredNPCSpeciality(0x39u) ) | |
5837 goto LABEL_112; | |
5838 v6 = 6; | |
5839 LABEL_51: | |
5840 v2 = v6; | |
5841 goto LABEL_112; | |
5842 } | |
5843 if ( uSkillType == PLAYER_SKILL_MERCHANT ) | |
5844 { | |
5845 if ( CheckHiredNPCSpeciality(0x14u) ) | |
5846 v2 = 4; | |
5847 if ( CheckHiredNPCSpeciality(0x15u) ) | |
5848 v2 += 6; | |
5849 if ( CheckHiredNPCSpeciality(0x30u) ) | |
5850 v2 += 3; | |
5851 v7 = 50; | |
5852 LABEL_47: | |
5853 if ( CheckHiredNPCSpeciality(v7) ) | |
5854 v2 += 8; | |
5855 goto LABEL_112; | |
5856 } | |
5857 if ( uSkillType != PLAYER_SKILL_PERCEPTION ) | |
5858 { | |
5859 if ( uSkillType != PLAYER_SKILL_TRAP_DISARM ) | |
5860 goto LABEL_86; | |
5861 if ( CheckHiredNPCSpeciality(0x19u) ) | |
5862 v2 = 4; | |
5863 if ( CheckHiredNPCSpeciality(0x1Au) ) | |
5864 v2 += 6; | |
5865 v7 = 51; | |
5866 goto LABEL_47; | |
5867 } | |
5868 if ( CheckHiredNPCSpeciality(0x16u) ) | |
5869 v2 = 6; | |
5870 if ( CheckHiredNPCSpeciality(0x2Fu) ) | |
5871 v2 += 5; | |
5872 LABEL_112: | |
5873 switch ( uSkillType ) | |
5874 { | |
5875 case PLAYER_SKILL_ITEM_ID: | |
5876 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
5877 break; | |
5878 case PLAYER_SKILL_MEDITATION: | |
5879 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
5880 break; | |
5881 case PLAYER_SKILL_TRAP_DISARM: | |
5882 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; | |
5883 break; | |
5884 case PLAYER_SKILL_DODGE: | |
5885 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5886 break; | |
5887 default: | |
5888 if ( uSkillType != 31 ) | |
5889 goto LABEL_126; | |
5890 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5891 break; | |
5892 } | |
5893 LABEL_125: | |
5894 v2 += v9->GetItemsBonus(v8, 0); | |
5895 LABEL_126: | |
5896 v3 = v9->pActiveSkills[uSkillType]; | |
5897 if ( v2 + (v9->pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
5898 result = v2 + v3; | |
5899 else | |
5900 result = v3 & 0xFC | 0x3C; | |
5901 return result; | |
5902 } | |
5903 | |
5904 //----- (0048FC00) -------------------------------------------------------- | |
5905 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5906 { | |
5907 Player *v2; // esi@1 | |
5908 int v3; // eax@1 | |
5909 char v4; // di@1 | |
5910 signed int v5; // ebx@1 | |
5911 unsigned int v6; // eax@2 | |
5912 unsigned __int8 v7; // sf@5 | |
5913 unsigned __int8 v8; // of@5 | |
5914 PlayerEquipment *v9; // ebx@19 | |
5915 Player *v10; // ecx@20 | |
5916 enum PLAYER_SKILL_TYPE v11; // edi@21 | |
5917 int v12; // eax@21 | |
5918 int v13; // edi@21 | |
5919 char v14; // di@25 | |
5920 signed int v15; // esi@25 | |
5921 char v16; // al@32 | |
5922 int v18; // eax@36 | |
5923 unsigned int v19; // eax@37 | |
5924 ITEM_EQUIP_TYPE v20; // edi@40 | |
5925 int v21; // edx@41 | |
5926 int v22; // eax@42 | |
5927 enum PLAYER_SKILL_TYPE v23; // edi@45 | |
5928 unsigned __int16 v24; // ax@45 | |
5929 unsigned __int16 v25; // bx@45 | |
5930 unsigned int v26; // eax@45 | |
5931 unsigned __int8 v27; // sf@50 | |
5932 unsigned __int8 v28; // of@50 | |
5933 unsigned int v29; // eax@52 | |
5934 int v30; // eax@55 | |
5935 int v31; // eax@58 | |
5936 unsigned int v32; // eax@59 | |
5937 int v33; // eax@65 | |
5938 char v34; // si@65 | |
5939 ITEM_EQUIP_TYPE v35; // edi@69 | |
5940 int v36; // edx@70 | |
5941 int v37; // eax@71 | |
5942 enum PLAYER_SKILL_TYPE v38; // edi@74 | |
5943 int v39; // eax@74 | |
5944 int v40; // eax@89 | |
5945 char v41; // si@89 | |
5946 int v42; // eax@96 | |
5947 enum PLAYER_SKILL_TYPE v43; // edx@97 | |
5948 int v44; // eax@97 | |
5949 int v45; // eax@98 | |
5950 int v46; // eax@99 | |
5951 int v47; // eax@100 | |
5952 int v48; // eax@101 | |
5953 int v49; // eax@102 | |
5954 unsigned __int16 v50; // ax@113 | |
5955 char v51; // di@113 | |
5956 unsigned int v52; // eax@113 | |
5957 int v53; // edi@113 | |
5958 signed int i; // ecx@113 | |
5959 unsigned __int16 v55; // ax@118 | |
5960 char v56; // si@118 | |
5961 unsigned int v57; // eax@118 | |
5962 int v58; // esi@121 | |
5963 signed int j; // ecx@121 | |
5964 int v60; // edi@126 | |
5965 int v61; // eax@126 | |
5966 signed int v62; // [sp-4h] [bp-30h]@26 | |
5967 signed int v63; // [sp-4h] [bp-30h]@80 | |
5968 int v64; // [sp+Ch] [bp-20h]@104 | |
5969 int v65; // [sp+10h] [bp-1Ch]@104 | |
5970 int v66; // [sp+14h] [bp-18h]@104 | |
5971 int v67; // [sp+18h] [bp-14h]@104 | |
5972 int v68; // [sp+1Ch] [bp-10h]@69 | |
5973 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5974 int v70; // [sp+24h] [bp-8h]@1 | |
5975 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5976 int a1; // [sp+34h] [bp+8h]@21 | |
5977 int a1a; // [sp+34h] [bp+8h]@74 | |
5978 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5979 | |
5980 v2 = this; | |
5981 v70 = 0; | |
5982 v69 = 0; | |
5983 v71 = (ITEM_EQUIP_TYPE)0; | |
5984 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5985 v4 = v3; | |
5986 v5 = 1; | |
5987 if ( v3 ) | |
5988 { | |
5989 v6 = SkillToMastery(v3); | |
5990 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5991 { | |
5992 if ( (signed int)v6 >= 4 ) | |
5993 goto LABEL_4; | |
5994 v8 = __OFSUB__(v6, 3); | |
5995 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5996 } | |
5997 else | |
5998 { | |
5999 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
6000 goto LABEL_11; | |
6001 if ( (signed int)v6 >= 4 ) | |
6002 { | |
6003 LABEL_4: | |
6004 v71 = (ITEM_EQUIP_TYPE)2; | |
6005 LABEL_11: | |
6006 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
6007 goto LABEL_12; | |
6008 } | |
6009 v8 = __OFSUB__(v6, 2); | |
6010 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
6011 } | |
6012 if ( !(v7 ^ v8) ) | |
6013 v71 = (ITEM_EQUIP_TYPE)1; | |
6014 goto LABEL_11; | |
6015 } | |
6016 LABEL_12: | |
6017 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
6018 { | |
6019 v60 = pBaseHealthPerLevelByClass[v2->uClass]; | |
6020 v61 = v2->GetBodybuilding(); | |
6021 return v60 * v61; | |
6022 } | |
6023 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
6024 { | |
6025 v60 = pBaseManaPerLevelByClass[v2->uClass]; | |
6026 v61 = v2->GetMediatation(); | |
6027 return v60 * v61; | |
6028 } | |
6029 if ( a2 != 9 ) | |
6030 { | |
6031 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
6032 { | |
6033 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
6034 return v70; | |
6035 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
6036 { | |
6037 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
6038 return v70; | |
6039 v71 = (ITEM_EQUIP_TYPE)0; | |
6040 v9 = &v2->pEquipment; | |
6041 while ( 1 ) | |
6042 { | |
6043 if ( v2->HasItemEquipped(v71) ) | |
6044 { | |
118 | 6045 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
6046 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 6047 a1 = v12; |
6048 SkillToMastery(v12); | |
6049 v13 = v11 - 5; | |
6050 if ( !v13 ) | |
6051 return a1 & 0x3F; | |
6052 if ( v13 == 2 ) | |
6053 break; | |
6054 } | |
6055 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
6056 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
6057 if ( (signed int)v71 >= 16 ) | |
6058 return v70; | |
6059 } | |
6060 v14 = a1; | |
6061 v15 = 1; | |
6062 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
6063 { | |
6064 v62 = 5; | |
6065 goto LABEL_31; | |
6066 } | |
6067 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6068 { | |
6069 v62 = 3; | |
6070 goto LABEL_31; | |
6071 } | |
6072 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6073 goto LABEL_32; | |
6074 goto LABEL_30; | |
6075 } | |
6076 if ( v2->IsUnarmed() ) | |
6077 { | |
6078 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6079 v14 = v18; | |
6080 if ( !v18 ) | |
6081 return v70; | |
6082 v15 = 0; | |
6083 v19 = SkillToMastery(v18); | |
6084 if ( (signed int)v19 < 3 ) | |
6085 { | |
6086 if ( (signed int)v19 >= 2 ) | |
6087 v15 = 1; | |
6088 LABEL_32: | |
6089 v16 = v14; | |
6090 return v15 * (v16 & 0x3F); | |
6091 } | |
6092 LABEL_30: | |
6093 v62 = 2; | |
6094 LABEL_31: | |
6095 v15 = v62; | |
6096 goto LABEL_32; | |
6097 } | |
6098 v20 = (ITEM_EQUIP_TYPE)0; | |
6099 while ( 1 ) | |
6100 { | |
6101 if ( v2->HasItemEquipped(v20) ) | |
6102 { | |
118 | 6103 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6104 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6105 break; | |
6106 } | |
6107 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6108 if ( (signed int)v20 >= 16 ) | |
6109 return v70; | |
6110 } | |
6111 v71 = (ITEM_EQUIP_TYPE)0; | |
6112 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6113 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6114 v25 = v24; | |
6115 v26 = SkillToMastery(v24); | |
6116 if ( !v23 ) | |
6117 { | |
6118 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6119 { | |
6120 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6121 LOBYTE(v25) = v31; | |
6122 if ( v31 ) | |
6123 { | |
6124 v15 = 0; | |
6125 v32 = SkillToMastery(v31); | |
6126 if ( (signed int)v32 < 3 ) | |
6127 { | |
6128 if ( (signed int)v32 >= 2 ) | |
6129 v15 = 1; | |
6130 } | |
6131 else | |
6132 { | |
6133 v15 = 2; | |
6134 } | |
6135 v16 = v25; | |
6136 return v15 * (v16 & 0x3F); | |
6137 } | |
6138 } | |
6139 goto LABEL_55; | |
6140 } | |
6141 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6142 { | |
6143 v29 = SkillToMastery(v25); | |
6144 v28 = __OFSUB__(v29, 4); | |
6145 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6146 } | |
6147 else | |
6148 { | |
6149 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6150 goto LABEL_55; | |
6151 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6152 { | |
6153 if ( v23 == PLAYER_SKILL_MACE ) | |
6154 { | |
6155 v28 = __OFSUB__(v26, 2); | |
118 | 6156 v27 = v26 - 2 < 0; |
0 | 6157 goto LABEL_53; |
6158 } | |
6159 LABEL_55: | |
6160 v30 = v71 * (v25 & 0x3F); | |
6161 return (int)((char *)v69 + v30); | |
6162 } | |
6163 v28 = __OFSUB__(v26, 3); | |
118 | 6164 v27 = v26 - 3 < 0; |
0 | 6165 } |
6166 LABEL_53: | |
6167 if ( !(v27 ^ v28) ) | |
6168 v71 = (ITEM_EQUIP_TYPE)1; | |
6169 goto LABEL_55; | |
6170 } | |
6171 if ( v2->IsUnarmed() == 1 ) | |
6172 { | |
6173 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6174 v34 = v33; | |
6175 if ( !v33 ) | |
6176 return v70; | |
6177 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6178 v5 = 2; | |
6179 v30 = v5 * (v34 & 0x3F); | |
6180 return (int)((char *)v69 + v30); | |
6181 } | |
6182 v35 = (ITEM_EQUIP_TYPE)0; | |
6183 v68 = 0; | |
6184 while ( 1 ) | |
6185 { | |
6186 if ( v2->HasItemEquipped(v35) ) | |
6187 { | |
118 | 6188 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6189 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6190 break; | |
6191 } | |
6192 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6193 if ( (signed int)v35 >= 16 ) | |
6194 return v70; | |
6195 } | |
6196 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6197 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6198 a1a = v39; | |
6199 SkillToMastery(v39); | |
6200 v71 = (ITEM_EQUIP_TYPE)0; | |
6201 if ( v38 ) | |
6202 { | |
6203 if ( (signed int)v38 > 0 ) | |
6204 { | |
6205 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6206 { | |
6207 v71 = (ITEM_EQUIP_TYPE)1; | |
6208 } | |
6209 else | |
6210 { | |
6211 if ( v38 == 7 ) | |
6212 { | |
6213 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6214 { | |
6215 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6216 { | |
6217 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6218 return v5 * (a1a & 0x3F); | |
6219 v63 = 2; | |
6220 } | |
6221 else | |
6222 { | |
6223 v63 = 3; | |
6224 } | |
6225 } | |
6226 else | |
6227 { | |
6228 v63 = 5; | |
6229 } | |
6230 v5 = v63; | |
6231 return v5 * (a1a & 0x3F); | |
6232 } | |
6233 } | |
6234 } | |
6235 } | |
6236 else | |
6237 { | |
6238 v71 = (ITEM_EQUIP_TYPE)1; | |
6239 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6240 { | |
6241 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6242 v41 = v40; | |
6243 if ( v40 ) | |
6244 { | |
6245 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6246 v5 = 2; | |
6247 v68 = v5 * (v41 & 0x3F); | |
6248 } | |
6249 } | |
6250 } | |
6251 v30 = v68 + v71 * (a1a & 0x3F); | |
6252 return (int)((char *)v69 + v30); | |
6253 } | |
6254 a1b = 0; | |
6255 v71 = (ITEM_EQUIP_TYPE)0; | |
6256 v68 = 16; | |
6257 v69 = &v2->pEquipment; | |
6258 do | |
6259 { | |
6260 if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) | |
6261 goto LABEL_117; | |
6262 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6263 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6264 if ( !v44 ) | |
6265 { | |
6266 v64 = 0; | |
6267 v65 = 1; | |
6268 LABEL_111: | |
6269 v66 = 0; | |
6270 goto LABEL_112; | |
6271 } | |
6272 v45 = v44 - 1; | |
6273 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6274 { | |
6275 v64 = 0; | |
6276 v65 = 0; | |
6277 v66 = 0; | |
6278 v67 = 1; | |
6279 goto LABEL_113; | |
6280 } | |
6281 v47 = v46 - 4; | |
6282 if ( v47 ) | |
6283 { | |
6284 v48 = v47 - 1; | |
6285 if ( v48 ) | |
6286 { | |
6287 v49 = v48 - 1; | |
6288 if ( v49 ) | |
6289 { | |
6290 if ( v49 != 1 ) | |
6291 goto LABEL_117; | |
6292 a1b = 1; | |
6293 v64 = 1; | |
6294 v65 = 0; | |
6295 v66 = 0; | |
6296 v67 = 0; | |
6297 goto LABEL_113; | |
6298 } | |
6299 a1b = 1; | |
6300 v64 = 1; | |
6301 v65 = 0; | |
6302 goto LABEL_111; | |
6303 } | |
6304 v71 = (ITEM_EQUIP_TYPE)1; | |
6305 } | |
6306 else | |
6307 { | |
6308 a1b = 1; | |
6309 } | |
6310 v64 = 1; | |
6311 v65 = 0; | |
6312 v66 = 1; | |
6313 LABEL_112: | |
6314 v67 = 0; | |
6315 LABEL_113: | |
6316 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6317 v51 = v50; | |
6318 v52 = SkillToMastery(v50); | |
6319 v53 = v51 & 0x3F; | |
6320 for ( i = 0; i < (signed int)v52; ++i ) | |
6321 { | |
6322 if ( *(&v64 + i) ) | |
6323 v70 += v53; | |
6324 } | |
6325 LABEL_117: | |
6326 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6327 --v68; | |
6328 } | |
6329 while ( v68 ); | |
6330 v64 = 1; | |
6331 v65 = 1; | |
6332 v66 = 1; | |
6333 v67 = 0; | |
6334 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6335 v56 = v55; | |
6336 v57 = SkillToMastery(v55); | |
6337 if ( !a1b && (!v71 || v57 == 4) ) | |
6338 { | |
6339 v58 = v56 & 0x3F; | |
6340 for ( j = 0; j < (signed int)v57; ++j ) | |
6341 { | |
6342 if ( *(&v64 + j) ) | |
6343 v70 += v58; | |
6344 } | |
6345 } | |
6346 return v70; | |
6347 } | |
6348 | |
6349 //----- (00490109) -------------------------------------------------------- | |
6350 // faces are: 0 1 2 3 human males | |
6351 // 4 5 6 7 human females | |
6352 // 8 9 elf males | |
6353 // 10 11 elf females | |
6354 // 12 13 dwarf males | |
6355 // 14 15 dwarf females | |
6356 // 16 17 goblin males | |
6357 // 18 19 goblin females | |
6358 // 20 lich male | |
6359 // 21 lich female | |
6360 // 22 underwater suits (unused) | |
6361 // 23 zombie male | |
6362 // 24 zombie female | |
6363 enum CHARACTER_RACE Player::GetRace() | |
6364 { | |
6365 if ( uFace > 15 ) | |
6366 { | |
6367 if ( uFace >= 16 && uFace <= 19 ) | |
6368 return CHARACTER_RACE_GOBLIN; | |
6369 } | |
6370 else | |
6371 { | |
6372 if ( uFace >= 12 ) | |
6373 { | |
6374 return CHARACTER_RACE_DWARF; | |
6375 } | |
6376 else | |
6377 { | |
6378 if ( uFace >= 0 ) | |
6379 { | |
6380 if ( uFace <= 7 ) | |
6381 { | |
6382 return CHARACTER_RACE_HUMAN; | |
6383 } | |
6384 else | |
6385 { | |
6386 if ( uFace <= 11 ) | |
6387 return CHARACTER_RACE_ELF; | |
6388 } | |
6389 } | |
6390 } | |
6391 } | |
6392 return CHARACTER_RACE_HUMAN; | |
6393 } | |
6394 | |
6395 //----- (00490141) -------------------------------------------------------- | |
6396 int Player::GetSexByVoice() | |
6397 { | |
6398 signed int result; // eax@1 | |
6399 | |
6400 result = 0; | |
6401 switch ( this->uVoiceID ) | |
6402 { | |
6403 case 0u: | |
6404 case 1u: | |
6405 case 2u: | |
6406 case 3u: | |
6407 case 8u: | |
6408 case 9u: | |
6409 case 0xCu: | |
6410 case 0xDu: | |
6411 case 0x10u: | |
6412 case 0x11u: | |
6413 case 0x14u: | |
6414 case 0x17u: | |
6415 result = 0; | |
6416 break; | |
6417 case 4u: | |
6418 case 5u: | |
6419 case 6u: | |
6420 case 7u: | |
6421 case 0xAu: | |
6422 case 0xBu: | |
6423 case 0xEu: | |
6424 case 0xFu: | |
6425 case 0x12u: | |
6426 case 0x13u: | |
6427 case 0x15u: | |
6428 case 0x18u: | |
6429 result = 1; | |
6430 break; | |
6431 default: | |
6432 return result; | |
6433 } | |
6434 return result; | |
6435 } | |
6436 | |
6437 //----- (00490188) -------------------------------------------------------- | |
6438 void Player::SetInitialStats() | |
6439 { | |
6440 auto v1 = GetRace(); | |
6441 uMight = stru_4ED7B0.race[v1].attr[0].uBaseValue; | |
6442 uIntelligence = stru_4ED7B0.race[v1].attr[1].uBaseValue; | |
6443 uWillpower = stru_4ED7B0.race[v1].attr[2].uBaseValue; | |
6444 uEndurance = stru_4ED7B0.race[v1].attr[3].uBaseValue; | |
6445 uAccuracy = stru_4ED7B0.race[v1].attr[4].uBaseValue; | |
6446 uSpeed = stru_4ED7B0.race[v1].attr[5].uBaseValue; | |
6447 uLuck = stru_4ED7B0.race[v1].attr[6].uBaseValue; | |
6448 } | |
6449 | |
6450 //----- (004901FC) -------------------------------------------------------- | |
6451 int Player::SetSexByVoice() | |
6452 { | |
6453 __int64 v1; // qax@1 | |
6454 | |
6455 v1 = this->uVoiceID; | |
6456 switch ( (int)v1 ) | |
6457 { | |
6458 case 0: | |
6459 case 1: | |
6460 case 2: | |
6461 case 3: | |
6462 case 8: | |
6463 case 9: | |
6464 case 0xC: | |
6465 case 0xD: | |
6466 case 0x10: | |
6467 case 0x11: | |
6468 case 0x14: | |
6469 case 0x17: | |
6470 BYTE4(v1) = 0; | |
6471 break; | |
6472 case 4: | |
6473 case 5: | |
6474 case 6: | |
6475 case 7: | |
6476 case 0xA: | |
6477 case 0xB: | |
6478 case 0xE: | |
6479 case 0xF: | |
6480 case 0x12: | |
6481 case 0x13: | |
6482 case 0x15: | |
6483 case 0x18: | |
6484 BYTE4(v1) = 1; | |
6485 break; | |
6486 default: | |
6487 break; | |
6488 } | |
6489 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6490 return v1; | |
6491 } | |
6492 | |
6493 //----- (0049024A) -------------------------------------------------------- | |
6494 void Player::Reset(unsigned __int8 classID) | |
6495 { | |
6496 sLevelModifier = 0; | |
6497 sAgeModifier = 0; | |
6498 | |
6499 uClass = classID; | |
6500 uLuckBonus = 0; | |
6501 uSpeedBonus = 0; | |
6502 uAccuracyBonus = 0; | |
6503 uEnduranceBonus = 0; | |
6504 uWillpowerBonus = 0; | |
6505 uIntelligenceBonus = 0; | |
6506 uMightBonus = 0; | |
6507 uLevel = 1; | |
6508 uExperience = 251 + rand() % 100; | |
6509 uBirthYear = 1147 - rand() % 6; | |
6510 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
6511 memset(field_152, 0, 64); | |
6512 memset(&spellbook, 0, sizeof(PlayerSpells)); | |
6513 | |
6514 for (uint i = 0; i < 37; ++i) | |
6515 { | |
6516 if (pSkillAvailabilityPerClass[uClass / 4][i] != 2) | |
6517 continue; | |
6518 | |
6519 pActiveSkills[i] = 1; | |
6520 | |
6521 switch (i) | |
6522 { | |
6523 case PLAYER_SKILL_FIRE: spellbook.pFireSpellbook.bIsSpellbookAvailable = true; break; | |
6524 case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellbookAvailable = true; break; | |
6525 case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellbookAvailable = true; break; | |
6526 case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellbookAvailable = true; break; | |
6527 case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellbookAvailable = true; break; | |
6528 case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellbookAvailable = 1; break; | |
6529 case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellbookAvailable = 1; break; | |
6530 case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellbookAvailable = 1; break; | |
6531 case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellbookAvailable = 1; break; | |
6532 } | |
6533 } | |
6534 | |
6535 sHealth = GetMaxHealth(); | |
6536 sMana = GetMaxMana(); | |
6537 } | |
6538 | |
6539 //----- (004903C9) -------------------------------------------------------- | |
6540 enum PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) | |
6541 { | |
6542 enum PLAYER_SKILL_TYPE result; // eax@5 | |
6543 int v3; // edx@5 | |
6544 char *v4; // ecx@5 | |
6545 int v5; // esi@11 | |
6546 unsigned __int16 *v6; // edx@11 | |
6547 int v7; // esi@18 | |
6548 unsigned __int16 *pActiveSkill; // edx@18 | |
6549 | |
6550 if ( order >= 0 ) | |
6551 { | |
6552 if ( order <= 1 ) | |
6553 { | |
6554 result = (PLAYER_SKILL_TYPE)0; | |
6555 v7 = 0; | |
6556 pActiveSkill = this->pActiveSkills; | |
6557 do | |
6558 { | |
6559 if ( *pActiveSkill && pSkillAvailabilityPerClass[uClass / 4][result] == 2 ) | |
6560 { | |
6561 if ( v7 == order ) | |
6562 return result; | |
6563 ++v7; | |
6564 } | |
6565 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6566 ++pActiveSkill; | |
6567 } | |
6568 while ( (signed int)result < 37 ); | |
6569 } | |
6570 else | |
6571 { | |
6572 if ( order <= 3 ) | |
6573 { | |
6574 result = (PLAYER_SKILL_TYPE)0; | |
6575 v5 = 0; | |
6576 pActiveSkill = this->pActiveSkills; | |
6577 do | |
6578 { | |
6579 if ( *pActiveSkill && pSkillAvailabilityPerClass[uClass / 4][result] == 1 ) | |
6580 { | |
6581 if ( v5 == order - 2 ) | |
6582 return result; | |
6583 ++v5; | |
6584 } | |
6585 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6586 ++pActiveSkill; | |
6587 } | |
6588 while ( (signed int)result < 37 ); | |
6589 } | |
6590 else | |
6591 { | |
6592 if ( order <= 12 ) | |
6593 { | |
6594 result = (PLAYER_SKILL_TYPE)0; | |
6595 v3 = 0; | |
6596 v4 = (char *)pSkillAvailabilityPerClass[uClass / 4]; | |
6597 do | |
6598 { | |
6599 if ( *v4 == 1 ) | |
6600 { | |
6601 if ( v3 == order - 4 ) | |
6602 return result; | |
6603 ++v3; | |
6604 } | |
6605 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6606 ++v4; | |
6607 } | |
6608 while ( (signed int)result < 37 ); | |
6609 } | |
6610 } | |
6611 } | |
6612 } | |
6613 return (PLAYER_SKILL_TYPE)37; | |
6614 } | |
6615 | |
6616 | |
6617 | |
6618 //----- (0049048D) -------------------------------------------------------- | |
6619 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6620 void Player::DecreaseAttribute(int eAttribute) | |
6621 { | |
6622 int v2; // eax@1 | |
6623 int pBaseValue; // ecx@1 | |
6624 int pDroppedStep; // ebx@1 | |
6625 int pStep; // esi@1 | |
6626 unsigned __int16 result; // ax@7 | |
6627 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6628 | |
6629 v2 = eAttribute + 7 * GetRace(); | |
6630 pBaseValue = stru_4ED7B0.race[0].attr[v2].uBaseValue; | |
6631 pDroppedStep = stru_4ED7B0.race[0].attr[v2].uDroppedStep; | |
6632 uMinValue = pBaseValue - 2; | |
6633 pStep = stru_4ED7B0.race[0].attr[v2].uBaseStep; | |
6634 switch ( eAttribute ) | |
6635 { | |
6636 case CHARACTER_MIGHT: | |
6637 if ( this->uMight <= pBaseValue ) | |
6638 pStep = pDroppedStep; | |
6639 if ( this->uMight - pStep >= uMinValue ) | |
6640 this->uMight -= pStep; | |
6641 break; | |
6642 case CHARACTER_INTELLIGANCE: | |
6643 if ( this->uIntelligence <= pBaseValue ) | |
6644 pStep = pDroppedStep; | |
6645 if ( this->uIntelligence - pStep >= uMinValue ) | |
6646 this->uIntelligence -= pStep; | |
6647 break; | |
6648 case CHARACTER_WILLPOWER: | |
6649 if ( this->uWillpower <= pBaseValue ) | |
6650 pStep = pDroppedStep; | |
6651 if ( this->uWillpower - pStep >= uMinValue ) | |
6652 this->uWillpower -= pStep; | |
6653 break; | |
6654 case CHARACTER_ENDURANCE: | |
6655 if ( this->uEndurance <= pBaseValue ) | |
6656 pStep = pDroppedStep; | |
6657 if ( this->uEndurance - pStep >= uMinValue ) | |
6658 this->uEndurance -= pStep; | |
6659 break; | |
6660 case CHARACTER_ACCURACY: | |
6661 if ( this->uAccuracy <= pBaseValue ) | |
6662 pStep = pDroppedStep; | |
6663 if ( this->uAccuracy - pStep >= uMinValue ) | |
6664 this->uAccuracy -= pStep; | |
6665 break; | |
6666 case CHARACTER_SPEED: | |
6667 if ( this->uSpeed <= pBaseValue ) | |
6668 pStep = pDroppedStep; | |
6669 if ( this->uSpeed - pStep >= uMinValue ) | |
6670 this->uSpeed -= pStep; | |
6671 break; | |
6672 case CHARACTER_LUCK: | |
6673 if ( this->uLuck <= pBaseValue ) | |
6674 pStep = pDroppedStep; | |
6675 if ( this->uLuck - pStep >= uMinValue ) | |
6676 this->uLuck -= pStep; | |
6677 break; | |
6678 } | |
6679 } | |
6680 | |
6681 //----- (004905F5) -------------------------------------------------------- | |
6682 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6683 int Player::IncreaseAttribute(int eAttribute) | |
6684 { | |
6685 Player *v2; // esi@1 | |
6686 int v3; // eax@1 | |
6687 int v4; // ebx@1 | |
6688 signed int v5; // edi@1 | |
6689 int v6; // eax@8 | |
6690 signed int v7; // eax@17 | |
6691 signed int result; // eax@18 | |
6692 int v9; // [sp+Ch] [bp-8h]@1 | |
6693 signed int v10; // [sp+10h] [bp-4h]@1 | |
6694 | |
6695 v2 = this; | |
6696 v3 = eAttribute + 7 * GetRace(); | |
6697 v4 = stru_4ED7B0.race[0].attr[v3].uMaxValue; | |
6698 v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | |
6699 v9 = stru_4ED7B0.race[0].attr[v3].uBaseValue; | |
6700 v10 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | |
6701 PlayerCreation_ComputeAttributeBonus(); | |
6702 if ( eAttribute ) | |
6703 { | |
6704 switch ( eAttribute ) | |
6705 { | |
6706 case 1: | |
6707 v6 = v2->uIntelligence; | |
6708 break; | |
6709 case 2: | |
6710 v6 = v2->uWillpower; | |
6711 break; | |
6712 case 3: | |
6713 v6 = v2->uEndurance; | |
6714 break; | |
6715 case 4: | |
6716 v6 = v2->uAccuracy; | |
6717 break; | |
6718 case 5: | |
6719 v6 = v2->uSpeed; | |
6720 break; | |
6721 case 6: | |
6722 v6 = v2->uLuck; | |
6723 break; | |
6724 default: | |
6725 v6 = eAttribute; | |
6726 break; | |
6727 } | |
6728 } | |
6729 else | |
6730 { | |
6731 v6 = v2->uMight; | |
6732 } | |
6733 if ( v6 < v9 ) | |
6734 { | |
6735 v7 = v5; | |
6736 v5 = v10; | |
6737 v10 = v7; | |
6738 } | |
6739 result = PlayerCreation_ComputeAttributeBonus(); | |
6740 if ( result >= v10 ) | |
6741 { | |
6742 if ( eAttribute ) | |
6743 { | |
6744 switch ( eAttribute ) | |
6745 { | |
6746 case 1: | |
6747 result = (signed int)&v2->uIntelligence; | |
6748 break; | |
6749 case 2: | |
6750 result = (signed int)&v2->uWillpower; | |
6751 break; | |
6752 case 3: | |
6753 result = (signed int)&v2->uEndurance; | |
6754 break; | |
6755 case 4: | |
6756 result = (signed int)&v2->uAccuracy; | |
6757 break; | |
6758 case 5: | |
6759 result = (signed int)&v2->uSpeed; | |
6760 break; | |
6761 default: | |
6762 result = eAttribute - 6; | |
6763 if ( eAttribute != 6 ) | |
6764 return result; | |
6765 result = (signed int)&v2->uLuck; | |
6766 break; | |
6767 } | |
6768 } | |
6769 else | |
6770 { | |
6771 result = (signed int)&v2->uMight; | |
6772 } | |
6773 if ( v5 + *(short *)result <= v4 ) | |
6774 *(short *)result += v5; | |
6775 } | |
6776 return result; | |
6777 } | |
6778 | |
6779 //----- (0049070F) -------------------------------------------------------- | |
6780 void Player::Zero() | |
6781 { | |
6782 Player *v1; // esi@1 | |
6783 void *result; // eax@1 | |
6784 | |
6785 v1 = this; | |
6786 this->sLevelModifier = 0; | |
6787 this->sACModifier = 0; | |
6788 this->uLuckBonus = 0; | |
6789 this->uAccuracyBonus = 0; | |
6790 this->uSpeedBonus = 0; | |
6791 this->uEnduranceBonus = 0; | |
6792 this->uWillpowerBonus = 0; | |
6793 this->uIntelligenceBonus = 0; | |
6794 this->uMightBonus = 0; | |
6795 this->field_100 = 0; | |
6796 this->field_FC = 0; | |
6797 this->field_F8 = 0; | |
6798 this->field_F4 = 0; | |
6799 this->field_F0 = 0; | |
6800 this->field_EC = 0; | |
6801 this->field_E8 = 0; | |
6802 this->field_E4 = 0; | |
6803 this->field_E0 = 0; | |
6804 result = memset(&this->sResFireBonus, 0, 0x16u); | |
6805 v1->field_1A97 = 0; | |
6806 v1->_ranged_dmg_bonus = 0; | |
6807 v1->field_1A95 = 0; | |
6808 v1->_ranged_atk_bonus = 0; | |
6809 v1->field_1A93 = 0; | |
6810 v1->_melee_dmg_bonus = 0; | |
6811 v1->field_1A91 = 0; | |
6812 v1->_some_attack_bonus = 0; | |
6813 v1->_mana_related = 0; | |
6814 v1->uFullManaBonus = 0; | |
6815 v1->_health_related = 0; | |
6816 v1->uFullHealthBonus = 0; | |
6817 } | |
6818 | |
6819 //----- (004907E7) -------------------------------------------------------- | |
6820 __int16 Player::GetStatColor(unsigned int uStat) | |
6821 { | |
6822 Player *v2; // edi@1 | |
6823 __int16 uWhite; // si@1 | |
6824 // int uStartingHP; // eax@1 | |
6825 int v5; // edx@1 | |
6826 // unsigned __int8 v6; // zf@1 | |
6827 // char v7; // sf@1 | |
6828 unsigned __int8 v8; // of@1 | |
6829 __int16 result; // ax@2 | |
6830 __int16 uGreen; // [sp+8h] [bp-8h]@1 | |
6831 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6832 | |
6833 v2 = this; | |
6834 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6835 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6836 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
6837 v8 = stru_4ED7B0.race[GetRace()].attr[uStat].uBaseValue; | |
6838 | |
6839 int attribute_value = 0; | |
6840 switch (uStat) | |
6841 { | |
6842 case 0: attribute_value = uMight; break; | |
6843 case 1: attribute_value = uIntelligence; break; | |
6844 case 2: attribute_value = uWillpower; break; | |
6845 case 3: attribute_value = uEndurance; break; | |
6846 case 4: attribute_value = uSpeed; break; | |
6847 case 5: attribute_value = uAccuracy; break; | |
6848 case 6: attribute_value = uLuck; break; | |
6849 }; | |
6850 | |
6851 v5 = attribute_value; | |
6852 if ( v5 >= v8 ) | |
6853 { | |
6854 result = uGreen; | |
6855 if ( v5 == v8 ) | |
6856 result = uWhite; | |
6857 } | |
6858 else | |
6859 { | |
6860 result = uRed; | |
6861 } | |
6862 return result; | |
6863 } | |
6864 | |
6865 //----- (004908A8) -------------------------------------------------------- | |
6866 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6867 { | |
6868 unsigned __int64 *result; // eax@1 | |
6869 | |
6870 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6871 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6872 { | |
6873 *(int *)result = 0; | |
6874 *((int *)result + 1) = 0; | |
6875 LOBYTE(result) = 1; | |
6876 } | |
6877 else | |
6878 { | |
6879 LOBYTE(result) = 0; | |
6880 } | |
6881 return (bool)result; | |
6882 } | |
6883 | |
6884 //----- (004680ED) -------------------------------------------------------- | |
6885 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6886 { | |
6887 Player *v3; // esi@1 | |
6888 unsigned int v4; // ebx@4 | |
6889 signed int v5; // eax@17 | |
6890 unsigned int v6; // eax@26 | |
6891 unsigned __int8 v7; // cf@37 | |
6892 int v8; // edx@39 | |
6893 int v9; // edx@40 | |
6894 int v10; // edx@41 | |
6895 int v11; // edx@42 | |
6896 int v12; // edx@43 | |
6897 char *v13; // eax@45 | |
6898 AudioPlayer *v14; // ecx@62 | |
6899 signed int v15; // edi@68 | |
6900 int v16; // edx@73 | |
6901 unsigned __int16 *v17; // edi@73 | |
6902 unsigned int v18; // eax@73 | |
6903 int v19; // eax@74 | |
6904 int v20; // eax@75 | |
6905 signed int v21; // eax@81 | |
6906 const char *v22; // eax@84 | |
6907 char *v23; // ecx@90 | |
6908 int v24; // esi@96 | |
6909 int v25; // eax@109 | |
6910 int v26; // eax@113 | |
6911 char *v27; // edi@114 | |
6912 signed __int64 v28; // qax@120 | |
6913 char *v29; // ecx@120 | |
6914 int v30; // edi@137 | |
6915 int v31; // ST30_4@137 | |
6916 int v32; // ST3C_4@137 | |
6917 int v33; // ST40_4@137 | |
6918 int v34; // ST34_4@137 | |
6919 int v35; // ST38_4@137 | |
6920 unsigned __int8 v36; // al@173 | |
6921 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6922 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6923 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6924 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6925 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6926 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6927 signed int v43; // [sp-14h] [bp-40h]@18 | |
6928 signed int v44; // [sp-14h] [bp-40h]@174 | |
6929 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6930 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6931 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6932 int v48; // [sp-Ch] [bp-38h]@18 | |
6933 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6934 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6935 int v51; // [sp-Ch] [bp-38h]@174 | |
6936 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6937 char *v53; // [sp-8h] [bp-34h]@33 | |
6938 int v54; // [sp-8h] [bp-34h]@34 | |
6939 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6940 int v56; // [sp-8h] [bp-34h]@66 | |
6941 const char *v57; // [sp-8h] [bp-34h]@69 | |
6942 const char *v58; // [sp-8h] [bp-34h]@89 | |
6943 int v59; // [sp-8h] [bp-34h]@120 | |
6944 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6945 int v61; // [sp-4h] [bp-30h]@18 | |
6946 char *v62; // [sp-4h] [bp-30h]@33 | |
6947 char *v63; // [sp-4h] [bp-30h]@34 | |
6948 int v64; // [sp-4h] [bp-30h]@60 | |
6949 int v65; // [sp-4h] [bp-30h]@66 | |
6950 const char *v66; // [sp-4h] [bp-30h]@69 | |
6951 signed int v67; // [sp-4h] [bp-30h]@77 | |
6952 const char *v68; // [sp-4h] [bp-30h]@89 | |
6953 int v69; // [sp-4h] [bp-30h]@110 | |
6954 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6955 int v71; // [sp-4h] [bp-30h]@174 | |
6956 char *v72; // [sp+20h] [bp-Ch]@68 | |
6957 signed int v73; // [sp+24h] [bp-8h]@1 | |
6958 char *v74; // [sp+24h] [bp-8h]@23 | |
6959 int v75; // [sp+24h] [bp-8h]@73 | |
6960 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6961 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6962 | |
6963 thisb = this; | |
42 | 6964 v3 = &pParty->pPlayers[a2-1];//(Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552]; |
0 | 6965 v73 = 1; |
6966 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6967 return; | |
6968 v4 = 0; | |
6969 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6970 { | |
6971 if ( pParty->pPickedItem.uItemID != 160 ) | |
6972 { | |
6973 if ( pParty->pPickedItem.uItemID == 161 ) | |
6974 { | |
6975 v27 = (char *)&v3->sMana; | |
6976 *(int *)v27 += 2; | |
6977 LABEL_170: | |
6978 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6979 *(int *)v27 = v3->GetMaxMana(); | |
6980 } | |
6981 else | |
6982 { | |
6983 if ( pParty->pPickedItem.uItemID != 162 ) | |
6984 { | |
6985 LABEL_167: | |
6986 v68 = pParty->pPickedItem.GetDisplayName(); | |
6987 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6988 goto LABEL_90; | |
6989 } | |
6990 v69 = 2; | |
6991 LABEL_111: | |
42 | 6992 pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); |
0 | 6993 } |
6994 LABEL_112: | |
6995 v3->PlaySound(36, 0); | |
6996 goto LABEL_173; | |
6997 } | |
6998 LABEL_172: | |
100 | 6999 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 7000 goto LABEL_173; |
7001 } | |
7002 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
7003 { | |
7004 switch ( pParty->pPickedItem.uItemID ) | |
7005 { | |
7006 case 0xDEu: | |
7007 v25 = pParty->pPickedItem._bonus_type + 10; | |
7008 goto LABEL_110; | |
7009 case 0xDFu: | |
7010 v26 = pParty->pPickedItem._bonus_type + 10; | |
7011 goto LABEL_114; | |
7012 case 0xE0u: | |
7013 LODWORD(v3->pConditions[1]) = 0; | |
7014 HIDWORD(v3->pConditions[1]) = 0; | |
7015 goto LABEL_112; | |
7016 case 0xE1u: | |
7017 LODWORD(v3->pConditions[11]) = 0; | |
7018 HIDWORD(v3->pConditions[11]) = 0; | |
7019 LODWORD(v3->pConditions[9]) = 0; | |
7020 HIDWORD(v3->pConditions[9]) = 0; | |
7021 LODWORD(v3->pConditions[7]) = 0; | |
7022 HIDWORD(v3->pConditions[7]) = 0; | |
7023 goto LABEL_112; | |
7024 case 0xE2u: | |
7025 LODWORD(v3->pConditions[10]) = 0; | |
7026 HIDWORD(v3->pConditions[10]) = 0; | |
7027 LODWORD(v3->pConditions[8]) = 0; | |
7028 HIDWORD(v3->pConditions[8]) = 0; | |
7029 LODWORD(v3->pConditions[6]) = 0; | |
7030 HIDWORD(v3->pConditions[6]) = 0; | |
7031 goto LABEL_112; | |
7032 case 0xE3u: | |
7033 LODWORD(v3->pConditions[2]) = 0; | |
7034 HIDWORD(v3->pConditions[2]) = 0; | |
7035 goto LABEL_112; | |
7036 case 0xE4u: | |
7037 if ( v3->pConditions[1] ) | |
7038 goto LABEL_173; | |
7039 v70 = 0; | |
7040 v59 = 0; | |
7041 v50 = 5; | |
7042 v46 = 3; | |
7043 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7044 v29 = (char *)&v3->pPlayerBuffs[7]; | |
7045 goto LABEL_147; | |
7046 case 0xE5u: | |
7047 v70 = 0; | |
7048 v59 = 0; | |
7049 v50 = 5; | |
7050 v46 = 3; | |
7051 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7052 v29 = (char *)&v3->pPlayerBuffs[8]; | |
7053 goto LABEL_147; | |
7054 case 0xE6u: | |
7055 v70 = 0; | |
7056 v59 = 0; | |
7057 v50 = 5; | |
7058 v46 = 3; | |
7059 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7060 v29 = (char *)&v3->pPlayerBuffs[1]; | |
7061 goto LABEL_147; | |
7062 case 0xE7u: | |
7063 v70 = 0; | |
7064 v59 = 0; | |
7065 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7066 v46 = 0; | |
7067 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7068 v29 = (char *)&v3->pPlayerBuffs[11]; | |
7069 goto LABEL_147; | |
7070 case 0xE8u: | |
7071 v70 = 0; | |
7072 v59 = 0; | |
7073 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7074 v46 = 0; | |
7075 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7076 v29 = (char *)&v3->pPlayerBuffs[13]; | |
7077 goto LABEL_147; | |
7078 case 0xEAu: | |
7079 v70 = 0; | |
7080 v59 = 0; | |
7081 v50 = 5; | |
7082 v46 = 3; | |
7083 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7084 v29 = (char *)&v3->pPlayerBuffs[14]; | |
7085 goto LABEL_147; | |
7086 case 0xEBu: | |
7087 v3->pPlayerBuffs[23].Apply( | |
7088 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335), | |
7089 3u, | |
7090 5u, | |
7091 0, | |
7092 0); | |
7093 goto LABEL_173; | |
7094 case 0xEDu: | |
7095 LODWORD(v3->pConditions[3]) = 0; | |
7096 HIDWORD(v3->pConditions[3]) = 0; | |
7097 goto LABEL_112; | |
7098 case 0xEEu: | |
7099 LODWORD(v3->pConditions[0]) = 0; | |
7100 HIDWORD(v3->pConditions[0]) = 0; | |
7101 goto LABEL_112; | |
7102 case 0xEFu: | |
7103 LODWORD(v3->pConditions[5]) = 0; | |
7104 HIDWORD(v3->pConditions[5]) = 0; | |
7105 goto LABEL_112; | |
7106 case 0xF0u: | |
7107 v70 = 0; | |
7108 v59 = 0; | |
7109 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7110 v46 = 0; | |
7111 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7112 v29 = (char *)&v3->pPlayerBuffs[19]; | |
7113 goto LABEL_147; | |
7114 case 0xF1u: | |
7115 v70 = 0; | |
7116 v59 = 0; | |
7117 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7118 v46 = 0; | |
7119 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7120 v29 = (char *)&v3->pPlayerBuffs[17]; | |
7121 goto LABEL_147; | |
7122 case 0xF2u: | |
7123 v70 = 0; | |
7124 v59 = 0; | |
7125 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7126 v46 = 0; | |
7127 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7128 v29 = (char *)&v3->pPlayerBuffs[20]; | |
7129 goto LABEL_147; | |
7130 case 0xF3u: | |
7131 v70 = 0; | |
7132 v59 = 0; | |
7133 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7134 v46 = 0; | |
7135 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7136 v29 = (char *)&v3->pPlayerBuffs[16]; | |
7137 goto LABEL_147; | |
7138 case 0xF4u: | |
7139 v70 = 0; | |
7140 v59 = 0; | |
7141 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7142 v46 = 0; | |
7143 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7144 v29 = (char *)&v3->pPlayerBuffs[21]; | |
7145 goto LABEL_147; | |
7146 case 0xF5u: | |
7147 v70 = 0; | |
7148 v59 = 0; | |
7149 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7150 v46 = 0; | |
7151 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7152 v29 = (char *)&v3->pPlayerBuffs[15]; | |
7153 goto LABEL_147; | |
7154 case 0xFBu: | |
7155 LODWORD(v3->pConditions[12]) = 0; | |
7156 HIDWORD(v3->pConditions[12]) = 0; | |
7157 goto LABEL_112; | |
7158 case 0xFCu: | |
7159 v30 = LODWORD(v3->pConditions[14]); | |
7160 v31 = HIDWORD(v3->pConditions[14]); | |
7161 v32 = LODWORD(v3->pConditions[15]); | |
7162 v33 = HIDWORD(v3->pConditions[15]); | |
7163 v34 = LODWORD(v3->pConditions[16]); | |
7164 v35 = HIDWORD(v3->pConditions[16]); | |
42 | 7165 memset(&pParty->pPlayers[a2-1],0,0xA0u);//memset(&stru_AA1058[3].pSounds[6972 * a2 + 40552], 0, 0xA0u); |
0 | 7166 HIDWORD(v3->pConditions[14]) = v31; |
7167 LODWORD(v3->pConditions[15]) = v32; | |
7168 HIDWORD(v3->pConditions[15]) = v33; | |
7169 LODWORD(v3->pConditions[16]) = v34; | |
7170 LODWORD(v3->pConditions[14]) = v30; | |
7171 HIDWORD(v3->pConditions[16]) = v35; | |
7172 goto LABEL_112; | |
7173 case 0xFDu: | |
7174 v25 = 5 * pParty->pPickedItem._bonus_type; | |
7175 LABEL_110: | |
7176 v69 = v25; | |
7177 goto LABEL_111; | |
7178 case 0xFEu: | |
7179 v26 = 5 * pParty->pPickedItem._bonus_type; | |
7180 LABEL_114: | |
7181 v27 = (char *)&v3->sMana; | |
7182 *(int *)v27 += v26; | |
7183 goto LABEL_170; | |
7184 case 0xFFu: | |
7185 v70 = 0; | |
7186 v59 = 0; | |
7187 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7188 v46 = 0; | |
7189 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7190 v29 = (char *)&v3->pPlayerBuffs[18]; | |
7191 goto LABEL_147; | |
7192 case 0x100u: | |
7193 v70 = 0; | |
7194 v59 = 0; | |
7195 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7196 v46 = 0; | |
7197 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7198 v29 = (char *)&v3->pPlayerBuffs[5]; | |
7199 goto LABEL_147; | |
7200 case 0x101u: | |
7201 v70 = 0; | |
7202 v59 = 0; | |
7203 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7204 v46 = 0; | |
7205 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7206 v29 = (char *)v3->pPlayerBuffs; | |
7207 goto LABEL_147; | |
7208 case 0x102u: | |
7209 v70 = 0; | |
7210 v59 = 0; | |
7211 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7212 v46 = 0; | |
7213 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7214 v29 = (char *)&v3->pPlayerBuffs[22]; | |
7215 goto LABEL_147; | |
7216 case 0x103u: | |
7217 v70 = 0; | |
7218 v59 = 0; | |
7219 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7220 v46 = 0; | |
7221 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7222 v29 = (char *)&v3->pPlayerBuffs[3]; | |
7223 goto LABEL_147; | |
7224 case 0x104u: | |
7225 v70 = 0; | |
7226 v59 = 0; | |
7227 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7228 v46 = 0; | |
7229 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7230 v29 = (char *)&v3->pPlayerBuffs[9]; | |
7231 goto LABEL_147; | |
7232 case 0x105u: | |
7233 v70 = 0; | |
7234 v59 = 0; | |
7235 v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); | |
7236 v46 = 0; | |
7237 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); | |
7238 v29 = (char *)&v3->pPlayerBuffs[2]; | |
7239 LABEL_147: | |
7240 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7241 goto LABEL_112; | |
7242 case 0x106u: | |
7243 LODWORD(v3->pConditions[15]) = 0; | |
7244 HIDWORD(v3->pConditions[15]) = 0; | |
7245 goto LABEL_112; | |
7246 case 0x108u: | |
7247 if ( !*(int *)&v3->field_1F5[3] ) | |
7248 { | |
7249 v3->uLuck += 50; | |
7250 *(int *)&v3->field_1F5[3] = 1; | |
7251 } | |
7252 goto LABEL_112; | |
7253 case 0x109u: | |
7254 if ( !*(int *)&v3->field_1F5[7] ) | |
7255 { | |
7256 v3->uSpeed += 50; | |
7257 *(int *)&v3->field_1F5[7] = 1; | |
7258 } | |
7259 goto LABEL_112; | |
7260 case 0x10Au: | |
7261 if ( !*(int *)&v3->field_1F5[11] ) | |
7262 { | |
7263 v3->uIntelligence += 50; | |
7264 *(int *)&v3->field_1F5[11] = 1; | |
7265 } | |
7266 goto LABEL_112; | |
7267 case 0x10Bu: | |
7268 if ( !*(int *)&v3->field_1F5[15] ) | |
7269 { | |
7270 v3->uEndurance += 50; | |
7271 *(int *)&v3->field_1F5[15] = 1; | |
7272 } | |
7273 goto LABEL_112; | |
7274 case 0x10Cu: | |
7275 if ( !*(int *)&v3->field_1F5[19] ) | |
7276 { | |
7277 v3->uWillpower += 50; | |
7278 *(int *)&v3->field_1F5[19] = 1; | |
7279 } | |
7280 goto LABEL_112; | |
7281 case 0x10Du: | |
7282 if ( !*(int *)&v3->field_1F5[23] ) | |
7283 { | |
7284 v3->uAccuracy += 50; | |
7285 *(int *)&v3->field_1F5[23] = 1; | |
7286 } | |
7287 goto LABEL_112; | |
7288 case 0x10Eu: | |
7289 if ( !*(int *)&v3->field_1F5[27] ) | |
7290 { | |
7291 v3->uMight += 50; | |
7292 *(int *)&v3->field_1F5[27] = 1; | |
7293 } | |
7294 goto LABEL_112; | |
7295 case 0x10Fu: | |
7296 v3->sAgeModifier = 0; | |
7297 goto LABEL_112; | |
7298 default: | |
7299 goto LABEL_167; | |
7300 case 0xDDu: | |
7301 goto LABEL_172; | |
7302 } | |
7303 goto LABEL_172; | |
7304 } | |
7305 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7306 { | |
7307 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7308 { | |
7309 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7310 { | |
7311 if ( pParty->pPickedItem.uItemID == 616 ) | |
7312 { | |
7313 thisa = pParty->uCurrentMonthWeek + 1; | |
7314 if ( pParty->uCurrentMonth >= 7 ) | |
7315 v74 = 0; | |
7316 else | |
7317 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7318 switch ( pParty->uCurrentMonth ) | |
7319 { | |
7320 case 0u: | |
7321 v6 = pParty->uCurrentMonthWeek + 1; | |
7322 v3->uMight += thisa; | |
7323 goto LABEL_33; | |
7324 case 1u: | |
7325 v6 = pParty->uCurrentMonthWeek + 1; | |
7326 v3->uIntelligence += thisa; | |
7327 goto LABEL_33; | |
7328 case 2u: | |
7329 v6 = pParty->uCurrentMonthWeek + 1; | |
7330 v3->uWillpower += thisa; | |
7331 goto LABEL_33; | |
7332 case 3u: | |
7333 v6 = pParty->uCurrentMonthWeek + 1; | |
7334 v3->uEndurance += thisa; | |
7335 goto LABEL_33; | |
7336 case 4u: | |
7337 v6 = pParty->uCurrentMonthWeek + 1; | |
7338 v3->uAccuracy += thisa; | |
7339 goto LABEL_33; | |
7340 case 5u: | |
7341 v6 = pParty->uCurrentMonthWeek + 1; | |
7342 v3->uSpeed += thisa; | |
7343 goto LABEL_33; | |
7344 case 6u: | |
7345 v6 = pParty->uCurrentMonthWeek + 1; | |
7346 v3->uLuck += thisa; | |
7347 LABEL_33: | |
7348 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7349 v53 = v74; | |
7350 v49 = v6; | |
7351 goto LABEL_53; | |
7352 case 7u: | |
7353 party_finds_gold(1000 * thisa, 0); | |
7354 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7355 v54 = 1000 * thisa; | |
7356 goto LABEL_38; | |
7357 case 8u: | |
7358 Party::GiveFood(5 * thisa); | |
7359 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7360 v54 = 5 * thisa; | |
7361 goto LABEL_38; | |
7362 case 9u: | |
7363 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7364 v3->uSkillPoints += 2 * thisa; | |
7365 v54 = 2 * thisa; | |
7366 goto LABEL_38; | |
7367 case 0xAu: | |
7368 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7369 v54 = 2500 * thisa; | |
7370 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7371 LODWORD(v3->uExperience) += 2500 * thisa; | |
7372 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7373 LABEL_38: | |
7374 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7375 goto LABEL_54; | |
7376 case 0xBu: | |
7377 v8 = rand() % 6; | |
7378 if ( v8 ) | |
7379 { | |
7380 v9 = v8 - 1; | |
7381 if ( v9 ) | |
7382 { | |
7383 v10 = v9 - 1; | |
7384 if ( v10 ) | |
7385 { | |
7386 v11 = v10 - 1; | |
7387 if ( v11 ) | |
7388 { | |
7389 v12 = v11 - 1; | |
7390 if ( v12 ) | |
7391 { | |
7392 if ( v12 != 1 ) | |
7393 goto LABEL_52; | |
7394 v3->sResBodyBase += thisa; | |
7395 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7396 } | |
7397 else | |
7398 { | |
7399 v3->sResMindBase += thisa; | |
7400 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7401 } | |
7402 } | |
7403 else | |
7404 { | |
7405 v3->sResEarthBase += thisa; | |
7406 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7407 } | |
7408 } | |
7409 else | |
7410 { | |
7411 v3->sResWaterBase += thisa; | |
7412 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7413 } | |
7414 } | |
7415 else | |
7416 { | |
7417 v3->sResAirBase += thisa; | |
7418 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7419 } | |
7420 } | |
7421 else | |
7422 { | |
7423 v3->sResFireBase += thisa; | |
7424 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7425 } | |
7426 v74 = v13; | |
7427 LABEL_52: | |
7428 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7429 v53 = v74; | |
7430 v49 = thisa; | |
7431 LABEL_53: | |
7432 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7433 LABEL_54: | |
7434 ShowStatusBarString(pTmpBuf, 2u); | |
7435 pMouse->RemoveHoldingItem(); | |
7436 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7437 v3->PlaySound(93, 0); | |
7438 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7439 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7440 { | |
7441 v64 = 0; | |
7442 v55 = 16; | |
7443 } | |
7444 else | |
7445 { | |
7446 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7447 { | |
7448 v64 = 0; | |
7449 v55 = 14; | |
7450 } | |
7451 else | |
7452 { | |
7453 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7454 return; | |
7455 v64 = 0; | |
7456 v55 = 15; | |
7457 } | |
7458 } | |
7459 v3->SetCondition(v55, v64); | |
7460 v61 = 0; | |
7461 v52 = 0; | |
7462 v48 = 0; | |
7463 v45 = 0; | |
7464 v43 = -1; | |
7465 v41 = 0; | |
7466 v39 = 0; | |
7467 v37 = (SoundID)215; | |
7468 v14 = pAudioPlayer; | |
7469 goto LABEL_63; | |
7470 default: | |
7471 goto LABEL_54; | |
7472 } | |
7473 } | |
7474 if ( pParty->pPickedItem.uItemID == 630 ) | |
7475 { | |
7476 Party::GiveFood(1u); | |
7477 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7478 } | |
7479 else | |
7480 { | |
7481 if ( pParty->pPickedItem.uItemID == 632 ) | |
7482 { | |
7483 v61 = 0; | |
7484 v52 = 0; | |
7485 v48 = 0; | |
7486 v45 = 0; | |
7487 v43 = -1; | |
7488 v41 = 0; | |
7489 v39 = 0; | |
7490 v37 = (SoundID)133; | |
7491 goto LABEL_93; | |
7492 } | |
7493 if ( pParty->pPickedItem.uItemID == 633 ) | |
7494 { | |
7495 v61 = 0; | |
7496 v52 = 0; | |
7497 v48 = 0; | |
7498 v45 = 0; | |
7499 v43 = -1; | |
7500 v41 = 0; | |
7501 v39 = 0; | |
7502 v37 = (SoundID)134; | |
7503 goto LABEL_93; | |
7504 } | |
7505 if ( pParty->pPickedItem.uItemID == 634 ) | |
7506 { | |
7507 v61 = 0; | |
7508 v52 = 0; | |
7509 v48 = 0; | |
7510 v45 = 0; | |
7511 v43 = -1; | |
7512 v41 = 0; | |
7513 v39 = 0; | |
7514 v37 = (SoundID)135; | |
7515 goto LABEL_93; | |
7516 } | |
7517 if ( pParty->pPickedItem.uItemID != 646 ) | |
7518 { | |
7519 if ( pParty->pPickedItem.uItemID == 650 ) | |
7520 { | |
7521 sub_44C28F_open_nwc_dungeon(); | |
7522 return; | |
7523 } | |
7524 goto LABEL_167; | |
7525 } | |
7526 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7527 v5 = 8 * a2 + 392; | |
7528 LOBYTE(v5) = (8 * a2 - 120) | 4; | |
7529 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); | |
7530 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7531 } | |
7532 LABEL_187: | |
7533 pMouse->RemoveHoldingItem(); | |
7534 return; | |
7535 } | |
42 | 7536 if ( pParty->pPlayers[a2-1].CanAct() )//if ( ((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) |
0 | 7537 { |
7538 sub_467F48(pParty->pPickedItem.uItemID); | |
7539 v65 = 0; | |
7540 v56 = 37; | |
7541 LABEL_67: | |
7542 v3->PlaySound(v56, v65); | |
7543 return; | |
7544 } | |
7545 LABEL_89: | |
7546 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7547 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7548 LABEL_90: | |
7549 sprintf(pTmpBuf, v58, v68); | |
7550 v23 = pTmpBuf; | |
7551 LABEL_91: | |
7552 ShowStatusBarString(v23, 2u); | |
7553 v4 = 0; | |
7554 goto LABEL_92; | |
7555 } | |
7556 v15 = pParty->pPickedItem.uItemID - 400; | |
7557 v72 = (char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7558 if ( *v72 ) | |
7559 { | |
7560 v66 = pParty->pPickedItem.GetDisplayName(); | |
7561 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7562 LABEL_72: | |
7563 sprintf(pTmpBuf, v57, v66); | |
7564 ShowStatusBarString(pTmpBuf, 2u); | |
7565 LABEL_92: | |
7566 v61 = v4; | |
7567 v52 = v4; | |
7568 v48 = v4; | |
7569 v45 = v4; | |
7570 v43 = -1; | |
7571 v41 = v4; | |
7572 v39 = v4; | |
7573 v37 = (SoundID)27; | |
7574 LABEL_93: | |
7575 v14 = pAudioPlayer; | |
7576 LABEL_63: | |
7577 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7578 return; | |
7579 } | |
42 | 7580 if ( !pParty->pPlayers[a2-1].CanAct() )//if ( !((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) |
0 | 7581 { |
7582 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7583 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7584 goto LABEL_72; | |
7585 } | |
7586 v16 = v15 % 11 + 1; | |
7587 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7588 v75 = v16; | |
7589 v18 = SkillToMastery(*v17) - 1; | |
7590 if ( v18 ) | |
7591 { | |
7592 v19 = v18 - 1; | |
7593 if ( v19 ) | |
7594 { | |
7595 v20 = v19 - 1; | |
7596 if ( v20 ) | |
7597 { | |
7598 if ( v20 != 1 ) | |
7599 { | |
7600 v21 = a2; | |
7601 LABEL_83: | |
7602 if ( v75 > v21 || !*v17 ) | |
7603 { | |
7604 v22 = pParty->pPickedItem.GetDisplayName(); | |
7605 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); | |
7606 ShowStatusBarString(pTmpBuf, 2u); | |
7607 v65 = 0; | |
7608 v56 = 20; | |
7609 goto LABEL_67; | |
7610 } | |
7611 *v72 = 1; | |
7612 v3->PlaySound(21, 0); | |
7613 v73 = 0; | |
7614 LABEL_173: | |
7615 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7616 if ( v36 == 14 ) | |
7617 { | |
7618 v71 = 0; | |
7619 v60 = 0; | |
7620 v51 = 0; | |
7621 v47 = 0; | |
7622 v44 = -1; | |
7623 v42 = 0; | |
7624 v40 = 0; | |
7625 v38 = (SoundID)210; | |
7626 } | |
7627 else | |
7628 { | |
7629 if ( v36 != 13 ) | |
7630 { | |
7631 LABEL_178: | |
7632 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7633 { | |
7634 if ( !v73 ) | |
7635 goto LABEL_187; | |
7636 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7637 { | |
7638 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7639 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7640 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7641 ++pMessageQueue_50CBD0->uNumMessages; | |
7642 } | |
7643 } | |
7644 if ( v73 ) | |
7645 { | |
7646 if ( pParty->bTurnBasedModeOn ) | |
7647 { | |
7648 *(&pParty->field_16140 + a2) = 100; | |
7649 thisb->SetRecoveryTime(100); | |
7650 pTurnEngine->_40471C(); | |
7651 } | |
7652 else | |
7653 { | |
7654 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7655 } | |
7656 } | |
7657 goto LABEL_187; | |
7658 } | |
7659 v71 = 0; | |
7660 v60 = 0; | |
7661 v51 = 0; | |
7662 v47 = 0; | |
7663 v44 = -1; | |
7664 v42 = 0; | |
7665 v40 = 0; | |
7666 v38 = (SoundID)211; | |
7667 } | |
7668 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7669 goto LABEL_178; | |
7670 } | |
7671 v67 = 11; | |
7672 } | |
7673 else | |
7674 { | |
7675 v67 = 10; | |
7676 } | |
7677 } | |
7678 else | |
7679 { | |
7680 v67 = 7; | |
7681 } | |
7682 } | |
7683 else | |
7684 { | |
7685 v67 = 4; | |
7686 } | |
7687 v21 = v67; | |
7688 goto LABEL_83; | |
7689 } | |
7690 if ( pCurrentScreen == 23 ) | |
7691 return; | |
42 | 7692 if ( !pParty->pPlayers[a2-1].CanAct() )//if ( !((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) |
0 | 7693 goto LABEL_89; |
7694 if ( bUnderwater == 1 ) | |
7695 { | |
7696 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7697 goto LABEL_91; | |
7698 } | |
7699 dword_50C9AC = 1; | |
7700 v24 = pParty->pPickedItem.uItemID - 299; | |
7701 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7702 { | |
7703 pMouse->RemoveHoldingItem(); | |
7704 pGUIWindow_CurrentMenu->Release(); | |
7705 pIcons_LOD->_4114F2(); | |
7706 pCurrentScreen = 0; | |
7707 viewparams->bRedrawGameUI = 1; | |
7708 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7709 } | |
7710 else | |
7711 { | |
7712 _720984_unused = pParty->pPickedItem.uItemID; | |
7713 pMouse->RemoveHoldingItem(); | |
7714 if ( dword_50C9E8 < 40 ) | |
7715 { | |
7716 dword_50C9EC[3 * dword_50C9E8] = 146; | |
7717 dword_50C9F0[3 * dword_50C9E8] = v24; | |
7718 *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = a2 - 1; | |
7719 ++dword_50C9E8; | |
7720 } | |
7721 if ( pCurrentScreen | |
7722 && pGUIWindow_CurrentMenu | |
7723 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null | |
7724 && (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7725 { | |
7726 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7727 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7728 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7729 ++pMessageQueue_50CBD0->uNumMessages; | |
7730 } | |
7731 } | |
7732 } | |
7733 // 4E28F8: using guessed type int pCurrentScreen; | |
7734 // 50C9AC: using guessed type int dword_50C9AC; | |
7735 // 50C9EC: using guessed type int dword_50C9EC[]; | |
7736 // 6BE3C4: using guessed type char bUnderwater; | |
7737 // 720984: using guessed type int 720984_unused; | |
7738 | |
7739 | |
7740 | |
7741 //----- (00449BB4) -------------------------------------------------------- | |
7742 char Player::CompareVariable(enum VariableType var, signed int a1) | |
7743 { | |
7744 Player *v3; // esi@1 | |
7745 signed int v4; // edi@1 | |
7746 unsigned int v5; // eax@8 | |
7747 int v6; // eax@9 | |
7748 enum CHARACTER_RACE v7; // eax@11 | |
7749 signed int v8; // eax@17 | |
7750 unsigned __int8 v9; // sf@17 | |
7751 unsigned __int8 v10; // of@17 | |
7752 int v11; // eax@19 | |
7753 unsigned int v12; // eax@20 | |
7754 unsigned int v13; // eax@25 | |
7755 unsigned __int8 v14; // cl@25 | |
7756 signed int v15; // ecx@28 | |
7757 ItemGen *v16; // eax@28 | |
7758 char v17; // zf@31 | |
7759 int v18; // edi@90 | |
7760 DDM_DLV_Header *v19; // eax@122 | |
7761 char v20; // cl@124 | |
7762 DDM_DLV_Header *v21; // eax@126 | |
7763 unsigned int v22; // edi@129 | |
100 | 7764 Player *v23; // esi@134 |
0 | 7765 ItemGen *v24; // ecx@135 |
7766 signed int v25; // edx@135 | |
7767 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7768 char *v27; // edi@155 | |
7769 int v28; // ebx@161 | |
7770 int v29; // eax@161 | |
7771 | |
7772 v3 = this; | |
7773 v4 = -1; | |
7774 if ( var > VAR_AutoNotes ) | |
7775 { | |
7776 switch ( var ) | |
7777 { | |
7778 case VAR_Invisible: | |
7779 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 | |
7780 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) | |
7781 goto _return_true; | |
7782 goto _cmp_against_arg; | |
7783 case VAR_NumDeaths: | |
7784 v4 = pParty->uNumDeaths; | |
7785 goto _cmp_against_arg; | |
7786 case VAR_NumBounties: | |
7787 v4 = pParty->uNumBountiesCollected; | |
7788 goto _cmp_against_arg; | |
7789 case VAR_PrisonTerms: | |
7790 v4 = pParty->uNumPrisonTerms; | |
7791 goto _cmp_against_arg; | |
7792 case VAR_ArenaWinsPage: | |
7793 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
7794 goto _cmp_against_arg; | |
7795 case VAR_ArenaWinsSquire: | |
7796 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
7797 goto _cmp_against_arg; | |
7798 case VAR_ArenaWinsKnight: | |
7799 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
7800 goto _cmp_against_arg; | |
7801 case VAR_ArenaWinsLord: | |
7802 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
7803 goto _cmp_against_arg; | |
7804 case VAR_ReputationInCurrentLocation: | |
7805 v19 = &pOutdoor->ddm; | |
7806 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7807 v19 = &pIndoor->dlv; | |
7808 v20 = v19->uReputation >= a1; | |
7809 goto _return; | |
7810 case VAR_History_28|VAR_Sex: | |
7811 v21 = &pOutdoor->ddm; | |
7812 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7813 v21 = &pIndoor->dlv; | |
7814 v20 = v21->field_C_alert == a1; | |
7815 _return: | |
7816 LOBYTE(v6) = v20; | |
7817 return v6; | |
7818 case VAR_MonthEquals2|VAR_Sex: | |
7819 case VAR_MonthEquals2|VAR_Class: | |
7820 case VAR_Counter1: | |
7821 case VAR_Counter2: | |
7822 case VAR_Counter3: | |
7823 case VAR_Counter4: | |
7824 case VAR_Counter5: | |
7825 case VAR_Counter6: | |
7826 case VAR_Counter7: | |
7827 case VAR_Counter8: | |
7828 v22 = *(int *)&stru_AA1058[3].pSounds[8 * var + 44304]; | |
7829 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] | |
7830 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * var + 44300]) | |
7831 + (signed __int64)((double)(460800 * a1) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7832 goto _return_true; | |
7833 goto _return_false; | |
7834 case VAR_NumSkillPoints: | |
7835 v4 = this->uSkillPoints; | |
7836 goto _cmp_against_arg; | |
7837 case VAR_CircusPrises: | |
7838 v4 = 0; | |
100 | 7839 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7840 do |
7841 { | |
100 | 7842 v24 = v23->pInventoryItems; |
0 | 7843 v25 = 138; |
7844 do | |
7845 { | |
7846 switch ( v24->uItemID ) | |
7847 { | |
7848 case 0x1D6u: | |
7849 ++v4; | |
7850 break; | |
7851 case 0x1D7u: | |
7852 v4 += 3; | |
7853 break; | |
7854 case 0x1DDu: | |
7855 v4 += 5; | |
7856 break; | |
7857 } | |
7858 ++v24; | |
7859 --v25; | |
7860 } | |
7861 while ( v25 ); | |
100 | 7862 ++v23; |
0 | 7863 } |
100 | 7864 while ( v23 <= &pParty->pPlayers[3] ); |
0 | 7865 goto _cmp_against_arg; |
7866 case VAR_MonthEquals2: | |
7867 v17 = pParty->uCurrentMonth == a1; | |
7868 goto _return2; | |
7869 case VAR_IsFlying: | |
7870 if ( pParty->bFlying | |
7871 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 | |
7872 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) ) | |
7873 goto _return_true; | |
7874 goto _return_false; | |
7875 case VAR_HiredNPCHasSpeciality: | |
7876 LOBYTE(v6) = CheckHiredNPCSpeciality(a1); | |
7877 return v6; | |
7878 case VAR_NPCs2: | |
7879 return pNPCStats->pNewNPCData[a1].uFlags & 0x80; | |
7880 case VAR_MonthEquals|VAR_CurrentSP: | |
7881 v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; | |
7882 v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3]; | |
7883 goto LABEL_108; | |
7884 case VAR_ItemEquipped: | |
7885 v26 = (ITEM_EQUIP_TYPE)0; | |
7886 v27 = (char *)&this->pEquipment; | |
7887 break; | |
7888 case VAR_GoldInBank: | |
7889 v4 = pParty->uNumGoldInBank; | |
7890 goto _cmp_against_arg; | |
7891 case VAR_ThieverySkill|0x80: | |
7892 v28 = GetActualMight(); | |
7893 v29 = v3->GetBaseStrength(); | |
7894 goto LABEL_168; | |
7895 case VAR_DisarmTrapSkill|0x80: | |
7896 v28 = GetActualIntelligence(); | |
7897 v29 = v3->GetBaseIntelligence(); | |
7898 goto LABEL_168; | |
7899 case VAR_MonthEquals: | |
7900 v28 = GetActualWillpower(); | |
7901 v29 = v3->GetBaseWillpower(); | |
7902 goto LABEL_168; | |
7903 case VAR_MonthEquals|VAR_Sex: | |
7904 v28 = GetActualEndurance(); | |
7905 v29 = v3->GetBaseEndurance(); | |
7906 goto LABEL_168; | |
7907 case VAR_IdentifyMonsterSkill|0x80: | |
7908 v28 = GetActualSpeed(); | |
7909 v29 = v3->GetBaseSpeed(); | |
7910 goto LABEL_168; | |
7911 case VAR_ArmsmasterSkill|0x80: | |
7912 v28 = GetActualAccuracy(); | |
7913 v29 = v3->GetBaseAccuracy(); | |
7914 goto LABEL_168; | |
7915 case VAR_MonthEquals|VAR_MaxHP: | |
7916 v28 = GetActualLuck(); | |
7917 v29 = v3->GetBaseLuck(); | |
7918 LABEL_168: | |
7919 v10 = __OFSUB__(v28, v29); | |
7920 v9 = v28 - v29 < 0; | |
7921 LABEL_169: | |
7922 if ( v9 ^ v10 ) | |
7923 goto _cmp_against_arg; | |
7924 goto _return_true; | |
7925 default: | |
7926 goto _cmp_against_arg; | |
7927 } | |
7928 while ( !v3->HasItemEquipped(v26) | |
7929 || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != a1 ) | |
7930 { | |
7931 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7932 v27 += 4; | |
7933 if ( (signed int)v26 >= 16 ) | |
7934 { | |
7935 _return_false: | |
7936 LOBYTE(v6) = 0; | |
7937 return v6; | |
7938 } | |
7939 } | |
7940 goto _return_true; | |
7941 } | |
7942 if ( var == VAR_AutoNotes ) | |
7943 { | |
7944 v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; | |
7945 v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3]; | |
7946 LABEL_108: | |
7947 if ( !((unsigned __int8)v13 & v14) ) | |
7948 goto _cmp_against_arg; | |
7949 goto LABEL_109; | |
7950 } | |
7951 if ( var <= VAR_BaseLuck ) | |
7952 { | |
7953 if ( var != VAR_BaseLuck ) | |
7954 { | |
7955 switch ( var ) | |
7956 { | |
7957 case VAR_Hour: | |
7958 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == a1 ) | |
7959 goto _return_true; | |
7960 goto _return_false; | |
7961 case VAR_DayOfYear: | |
7962 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 | |
7963 % 0x150 | |
7964 + 1; | |
7965 goto LABEL_9; | |
7966 case VAR_DayOfWeek: | |
7967 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 | |
7968 % 7; | |
7969 LABEL_9: | |
7970 LOBYTE(v6) = v5 == a1; | |
7971 return v6; | |
7972 case VAR_Sex: | |
7973 v7 = (CHARACTER_RACE)this->uSex; | |
7974 goto _cmp_against_arg2; | |
7975 case VAR_Class: | |
7976 v7 = (CHARACTER_RACE)this->uClass; | |
7977 goto _cmp_against_arg2; | |
7978 case VAR_Race: | |
7979 v7 = GetRace(); | |
7980 _cmp_against_arg2: | |
7981 if ( a1 == v7 ) | |
7982 goto _return_true; | |
7983 goto _cmp_against_arg; | |
7984 case VAR_CurrentHP: | |
7985 v4 = this->sHealth; | |
7986 goto _cmp_against_arg; | |
7987 case VAR_MaxHP: | |
7988 v8 = GetMaxHealth(); | |
7989 v10 = __OFSUB__(v3->sHealth, v8); | |
7990 v9 = v3->sHealth - v8 < 0; | |
7991 goto LABEL_169; | |
7992 case VAR_CurrentSP: | |
7993 v4 = this->sMana; | |
7994 goto _cmp_against_arg; | |
7995 case VAR_MaxSP: | |
7996 v11 = GetMaxMana(); | |
7997 v10 = __OFSUB__(v3->sMana, v11); | |
7998 v9 = v3->sMana - v11 < 0; | |
7999 goto LABEL_169; | |
8000 case VAR_ActualAC: | |
8001 v12 = GetActualAC(); | |
8002 goto _j_cmp_against_arg; | |
8003 case VAR_ACModifier: | |
8004 v4 = this->sACModifier; | |
8005 goto _cmp_against_arg; | |
8006 case VAR_BaseLevel: | |
8007 v4 = this->uLevel; | |
8008 goto _cmp_against_arg; | |
8009 case VAR_LevelModifier: | |
8010 v4 = this->sLevelModifier; | |
8011 goto _cmp_against_arg; | |
8012 case VAR_Age: | |
8013 v12 = GetActualAge(); | |
8014 goto _j_cmp_against_arg; | |
8015 case VAR_Award: | |
8016 v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; | |
8017 v14 = this->field_152[((signed __int16)a1 - 1) >> 3]; | |
8018 goto LABEL_108; | |
8019 case VAR_Experience: | |
8020 v4 = LODWORD(this->uExperience); | |
8021 goto _cmp_against_arg; | |
8022 case VAR_QBits_QuestsDone: | |
8023 v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; | |
8024 v14 = pParty->_award_bits[((signed __int16)a1 - 1) >> 3]; | |
8025 goto LABEL_108; | |
8026 case VAR_PlayerItemInHands: | |
8027 v15 = 0; | |
8028 v16 = v3->pInventoryItems; | |
8029 break; | |
8030 case VAR_FixedGold: | |
8031 v4 = pParty->uNumGold; | |
8032 goto _cmp_against_arg; | |
8033 case VAR_MightBonus: | |
8034 v4 = this->uMightBonus; | |
8035 goto _cmp_against_arg; | |
8036 case VAR_IntellectBonus: | |
8037 v4 = this->uIntelligenceBonus; | |
8038 goto _cmp_against_arg; | |
8039 case VAR_PersonalityBonus: | |
8040 v4 = this->uWillpowerBonus; | |
8041 goto _cmp_against_arg; | |
8042 case VAR_EnduranceBonus: | |
8043 v4 = this->uEnduranceBonus; | |
8044 goto _cmp_against_arg; | |
8045 case VAR_SpeedBonus: | |
8046 v4 = this->uSpeedBonus; | |
8047 goto _cmp_against_arg; | |
8048 case VAR_AccuracyBonus: | |
8049 v4 = this->uAccuracyBonus; | |
8050 goto _cmp_against_arg; | |
8051 case VAR_LuckBonus: | |
8052 v4 = this->uLuckBonus; | |
8053 goto _cmp_against_arg; | |
8054 case VAR_BaseMight: | |
8055 v4 = this->uMight; | |
8056 goto _cmp_against_arg; | |
8057 case VAR_BaseIntellect: | |
8058 v4 = this->uIntelligence; | |
8059 goto _cmp_against_arg; | |
8060 case VAR_BasePersonality: | |
8061 v4 = this->uWillpower; | |
8062 goto _cmp_against_arg; | |
8063 case VAR_BaseEndurance: | |
8064 v4 = this->uEndurance; | |
8065 goto _cmp_against_arg; | |
8066 case VAR_BaseSpeed: | |
8067 v4 = this->uSpeed; | |
8068 goto _cmp_against_arg; | |
8069 case VAR_BaseAccuracy: | |
8070 v4 = this->uAccuracy; | |
8071 goto _cmp_against_arg; | |
8072 case VAR_FixedFood: | |
8073 v4 = pParty->uNumFoodRations; | |
8074 goto _cmp_against_arg; | |
8075 default: | |
8076 goto _cmp_against_arg; | |
8077 } | |
8078 while ( v16->uItemID != a1 ) | |
8079 { | |
8080 ++v15; | |
8081 ++v16; | |
8082 if ( v15 >= 138 ) | |
8083 { | |
8084 v17 = pParty->pPickedItem.uItemID == a1; | |
8085 _return2: | |
8086 LOBYTE(v6) = v17; | |
8087 return v6; | |
8088 } | |
8089 } | |
8090 _return_true: | |
8091 LOBYTE(v6) = 1; | |
8092 return v6; | |
8093 } | |
8094 v4 = this->uLuck; | |
8095 goto _cmp_against_arg; | |
8096 } | |
8097 if ( var <= VAR_MagicResistance ) | |
8098 { | |
8099 if ( var == VAR_MagicResistance ) | |
8100 { | |
8101 v4 = this->sResMagicBase; | |
8102 } | |
8103 else | |
8104 { | |
8105 switch ( var ) | |
8106 { | |
8107 case VAR_FireResistance: | |
8108 v4 = this->sResFireBase; | |
8109 goto _cmp_against_arg; | |
8110 case VAR_AirResistance: | |
8111 v4 = this->sResAirBase; | |
8112 goto _cmp_against_arg; | |
8113 case VAR_WaterResistance: | |
8114 v4 = this->sResWaterBase; | |
8115 goto _cmp_against_arg; | |
8116 case VAR_EarthResistance: | |
8117 v4 = this->sResEarthBase; | |
8118 goto _cmp_against_arg; | |
8119 case VAR_SpiritResistance: | |
8120 v4 = this->sResSpiritBase; | |
8121 goto _cmp_against_arg; | |
8122 case VAR_MindResistance: | |
8123 v4 = this->sResMindBase; | |
8124 goto _cmp_against_arg; | |
8125 case VAR_BodyResistance: | |
8126 v4 = this->sResBodyBase; | |
8127 goto _cmp_against_arg; | |
8128 case VAR_LightResistance: | |
8129 v4 = this->sResLightBase; | |
8130 goto _cmp_against_arg; | |
8131 case VAR_DarkResistance: | |
8132 v4 = this->sResDarkBase; | |
8133 goto _cmp_against_arg; | |
8134 case VAR_ActualMight: | |
8135 v12 = GetActualMight(); | |
8136 goto _j_cmp_against_arg; | |
8137 case VAR_ActualIntellect: | |
8138 v12 = GetActualIntelligence(); | |
8139 goto _j_cmp_against_arg; | |
8140 case VAR_ActualPersonality: | |
8141 v12 = GetActualWillpower(); | |
8142 goto _j_cmp_against_arg; | |
8143 case VAR_ActualEndurance: | |
8144 v12 = GetActualEndurance(); | |
8145 goto _j_cmp_against_arg; | |
8146 case VAR_ActualSpeed: | |
8147 v12 = GetActualSpeed(); | |
8148 goto _j_cmp_against_arg; | |
8149 case VAR_ActualAccuracy: | |
8150 v12 = GetActualAccuracy(); | |
8151 goto _j_cmp_against_arg; | |
8152 case VAR_ActualLuck: | |
8153 v12 = GetActualLuck(); | |
8154 _j_cmp_against_arg: | |
8155 v4 = v12; | |
8156 break; | |
8157 default: | |
8158 goto _cmp_against_arg; | |
8159 } | |
8160 } | |
8161 goto _cmp_against_arg; | |
8162 } | |
8163 if ( var <= VAR_DisarmTrapSkill ) | |
8164 { | |
8165 if ( var != VAR_DisarmTrapSkill ) | |
8166 { | |
8167 if ( var <= VAR_MindResistanceBonus ) | |
8168 { | |
8169 switch ( var ) | |
8170 { | |
8171 case VAR_MindResistanceBonus: | |
8172 v4 = this->sResMindBonus; | |
8173 break; | |
8174 case VAR_FireResistanceBonus: | |
8175 v4 = this->sResFireBonus; | |
8176 break; | |
8177 case VAR_AirResistanceBonus: | |
8178 v4 = this->sResAirBonus; | |
8179 break; | |
8180 case VAR_WaterResistanceBonus: | |
8181 v4 = this->sResWaterBonus; | |
8182 break; | |
8183 case VAR_EarthResistanceBonus: | |
8184 v4 = this->sResEarthBonus; | |
8185 break; | |
8186 case VAR_SpiritResistanceBonus: | |
8187 v4 = this->sResSpiritBonus; | |
8188 break; | |
8189 } | |
8190 goto _cmp_against_arg; | |
8191 } | |
8192 if ( var == VAR_BodyResistanceBonus ) | |
8193 { | |
8194 v4 = this->sResBodyBonus; | |
8195 goto _cmp_against_arg; | |
8196 } | |
8197 if ( var == VAR_LightResistanceBonus ) | |
8198 { | |
8199 v4 = this->sResLightBonus; | |
8200 goto _cmp_against_arg; | |
8201 } | |
8202 if ( var == VAR_DarkResistanceBonus ) | |
8203 { | |
8204 v4 = this->sResDarkBonus; | |
8205 goto _cmp_against_arg; | |
8206 } | |
8207 if ( var == VAR_MagicResistanceBonus ) | |
8208 { | |
8209 v4 = this->sResMagicBonus; | |
8210 goto _cmp_against_arg; | |
8211 } | |
8212 if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) | |
8213 goto _cmp_against_arg; | |
8214 } | |
8215 LABEL_90: | |
8216 v18 = *((short *)&this->pConditions[16] + var); | |
8217 if ( a1 <= 63 ) | |
8218 v4 = v18 & 0x3F; | |
8219 else | |
8220 v4 = a1 & v18; | |
8221 goto _cmp_against_arg; | |
8222 } | |
8223 if ( var == 104 ) | |
8224 goto LABEL_90; | |
8225 if ( (signed int)var <= 104 ) | |
8226 goto _cmp_against_arg; | |
8227 if ( (signed int)var > 0x79 ) | |
8228 { | |
8229 if ( var != 122 ) | |
8230 { | |
8231 if ( (signed int)var > 122 && var <= VAR_ActiveSpells ) | |
8232 v4 = (unsigned __int8)byte_5E4C15[var]; | |
8233 goto _cmp_against_arg; | |
8234 } | |
8235 v4 = GetMajorConditionIdx(); | |
8236 if ( v4 != 18 ) | |
8237 { | |
8238 _cmp_against_arg: | |
8239 LOBYTE(v6) = v4 >= a1; | |
8240 return v6; | |
8241 } | |
8242 LABEL_109: | |
8243 v4 = a1; | |
8244 goto _cmp_against_arg; | |
8245 } | |
8246 return *((int *)this + 2 * var - 210); | |
8247 } | |
8248 | |
8249 | |
8250 //----- (0044A5CB) -------------------------------------------------------- | |
8251 void Player::SetVariable(enum VariableType var, signed int a3) | |
8252 { | |
8253 signed int v3; // ebx@1 | |
8254 Player *v4; // esi@1 | |
8255 unsigned int v5; // edi@1 | |
8256 unsigned int v6; // esi@13 | |
8257 unsigned int v7; // esi@14 | |
8258 signed int v8; // eax@17 | |
8259 ItemGen *v9; // ecx@17 | |
8260 int v10; // eax@21 | |
8261 signed int v11; // eax@30 | |
8262 Player *v12; // ecx@44 | |
8263 char *v13; // ecx@45 | |
8264 Player *v14; // ecx@49 | |
8265 int v15; // ecx@86 | |
8266 int v16; // esi@106 | |
8267 char v17; // al@106 | |
8268 int v18; // eax@107 | |
8269 Player *v19; // ecx@112 | |
8270 Player *v20; // ecx@127 | |
8271 int v21; // eax@127 | |
8272 int v22; // eax@145 | |
8273 char v23; // zf@146 | |
8274 DDM_DLV_Header *v24; // ecx@148 | |
8275 signed int v25; // eax@172 | |
8276 int v26; // [sp-8h] [bp-3Ch]@84 | |
8277 signed int v27; // [sp-4h] [bp-38h]@4 | |
8278 int v28; // [sp-4h] [bp-38h]@84 | |
8279 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8280 char v30; // [sp+32h] [bp-2h]@1 | |
8281 char v31; // [sp+33h] [bp-1h]@1 | |
8282 | |
8283 v3 = 0; | |
8284 v30 = 0; | |
8285 v31 = 0; | |
8286 v4 = this; | |
8287 v5 = 0; | |
8288 if ( this == pPlayers[2] ) | |
8289 { | |
8290 v3 = 1; | |
8291 goto LABEL_8; | |
8292 } | |
8293 if ( this == pPlayers[3] ) | |
8294 { | |
8295 v27 = 2; | |
8296 } | |
8297 else | |
8298 { | |
8299 if ( this != pPlayers[4] ) | |
8300 goto LABEL_8; | |
8301 v27 = 3; | |
8302 } | |
8303 v3 = v27; | |
8304 LABEL_8: | |
8305 if ( var > VAR_AutoNotes ) | |
8306 { | |
8307 if ( var <= VAR_GoldInBank ) | |
8308 { | |
8309 if ( var == VAR_GoldInBank ) | |
8310 { | |
8311 pParty->uNumGoldInBank = a3; | |
8312 return; | |
8313 } | |
8314 if ( var <= VAR_Counter8 ) | |
8315 { | |
8316 if ( (signed int)var >= 245 ) | |
8317 { | |
8318 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); | |
8319 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); | |
8320 } | |
8321 else | |
8322 { | |
8323 switch ( var ) | |
8324 { | |
8325 case VAR_MonthEquals|VAR_CurrentSP: | |
8326 _449B7E_toggle_bit((unsigned char *)field_1A50, a3, 1u); | |
8327 break; | |
8328 case VAR_NPCs2: | |
8329 pParty->field_709 = 0; | |
8330 LOBYTE(pNPCStats->pNewNPCData[a3].uFlags) |= 0x80u; | |
8331 sub_44A56A(); | |
8332 viewparams->bRedrawGameUI = 1; | |
8333 break; | |
8334 case VAR_NumSkillPoints: | |
8335 this->uSkillPoints = a3; | |
8336 break; | |
8337 } | |
8338 } | |
8339 return; | |
8340 } | |
8341 if ( var < VAR_Counter9 ) | |
8342 return; | |
8343 if ( (signed int)var <= 274 ) | |
8344 { | |
8345 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); | |
8346 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); | |
8347 } | |
8348 else | |
8349 { | |
8350 if ( var == VAR_ReputationInCurrentLocation ) | |
8351 { | |
8352 v24 = &pOutdoor->ddm; | |
8353 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8354 v24 = &pIndoor->dlv; | |
8355 v24->uReputation = a3; | |
8356 if ( a3 > 10000 ) | |
8357 v24->uReputation = 10000; | |
8358 return; | |
8359 } | |
8360 if ( var <= VAR_ReputationInCurrentLocation | |
8361 || var > VAR_History_28 | |
8362 || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8363 || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), | |
8364 v23 = *(&pStorylineText->field_0 + 3 * v22) == 0, | |
8365 pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), | |
8366 v23) ) | |
8367 return; | |
8368 bFlashHistoryBook = 1; | |
8369 } | |
8370 LABEL_172: | |
8371 v25 = 8 * v3 + 400; | |
8372 LOBYTE(v25) = (8 * v3 - 112) | 4; | |
8373 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); | |
8374 return; | |
8375 } | |
8376 if ( var != 307 ) | |
8377 { | |
8378 switch ( var ) | |
8379 { | |
8380 case 308: | |
8381 pParty->uNumBountiesCollected = a3; | |
8382 break; | |
8383 case 309: | |
8384 pParty->uNumPrisonTerms = a3; | |
8385 break; | |
8386 case 310: | |
8387 pParty->uNumArenaPageWins = a3; | |
8388 break; | |
8389 case 311: | |
8390 pParty->uNumArenaSquireWins = a3; | |
8391 break; | |
8392 case 312: | |
8393 pParty->uNumArenaKnightWins = a3; | |
8394 break; | |
8395 case 313: | |
8396 pParty->uNumArenaLordWins = a3; | |
8397 break; | |
8398 } | |
8399 return; | |
8400 } | |
8401 pParty->uNumDeaths = a3; | |
8402 LABEL_168: | |
8403 if ( v30 != 1 ) | |
8404 { | |
8405 LABEL_170: | |
8406 if ( v31 != 1 ) | |
8407 return; | |
8408 v5 = 0; | |
8409 goto LABEL_172; | |
8410 } | |
8411 LABEL_169: | |
8412 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, v3); | |
8413 goto LABEL_170; | |
8414 } | |
8415 if ( var == VAR_AutoNotes ) | |
8416 { | |
8417 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
|
8418 //&& (&dword_723718_autonote_related)[8 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8419 && pAutonoteTxt[a3-1].pText ) |
0 | 8420 { |
8421 v20 = pPlayers[v3 + 1]; | |
8422 v30 = 1; | |
8423 v20->PlaySound(96, 0); | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8424 v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; |
0 | 8425 bFlashAutonotesBook = 1; |
8426 dword_506568 = v21; | |
8427 } | |
8428 _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); | |
8429 v31 = 1; | |
8430 goto LABEL_168; | |
8431 } | |
8432 if ( var <= VAR_ActualMight ) | |
8433 { | |
8434 if ( var != VAR_ActualMight ) | |
8435 { | |
8436 switch ( var ) | |
8437 { | |
8438 case VAR_RandomGold: | |
8439 v6 = rand() % a3 + 1; | |
8440 Party::SetGold(v6); | |
8441 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8442 ShowStatusBarString(pTmpBuf, 2u); | |
8443 GameUI_DrawFoodAndGold(); | |
8444 return; | |
8445 case VAR_RandomFood: | |
8446 v7 = rand() % a3 + 1; | |
8447 Party::SetFood(v7); | |
8448 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8449 ShowStatusBarString(pTmpBuf, 2u); | |
8450 GameUI_DrawFoodAndGold(); | |
8451 goto LABEL_124; | |
8452 case VAR_Sex: | |
8453 this->uSex = (PLAYER_SEX)a3; | |
8454 goto LABEL_124; | |
8455 case VAR_Class: | |
8456 this->uClass = a3; | |
8457 if ( (char)a3 != 35 ) | |
8458 goto LABEL_124; | |
8459 v8 = 0; | |
8460 v9 = this->pInventoryItems; | |
8461 break; | |
8462 case VAR_CurrentHP: | |
8463 this->sHealth = a3; | |
8464 goto LABEL_124; | |
8465 case VAR_MaxHP: | |
8466 this->sHealth = GetMaxHealth(); | |
8467 return; | |
8468 case VAR_CurrentSP: | |
8469 this->sMana = a3; | |
8470 goto LABEL_124; | |
8471 case VAR_MaxSP: | |
8472 this->sMana = GetMaxMana(); | |
8473 return; | |
8474 case VAR_ACModifier: | |
8475 this->sACModifier = (unsigned __int8)a3; | |
8476 goto LABEL_124; | |
8477 case VAR_BaseLevel: | |
8478 this->uLevel = (unsigned __int8)a3; | |
8479 goto LABEL_124; | |
8480 case VAR_LevelModifier: | |
8481 this->sLevelModifier = (unsigned __int8)a3; | |
8482 goto LABEL_124; | |
8483 case VAR_Age: | |
8484 this->sAgeModifier = a3; | |
8485 return; | |
8486 case VAR_Award: | |
8487 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
|
8488 //&& dword_723E80_award_related[2 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8489 && pAwards[a3-1].pText ) |
0 | 8490 { |
8491 v12 = pPlayers[v3 + 1]; | |
8492 v30 = 1; | |
8493 v31 = 1; | |
8494 v12->PlaySound(96, 0); | |
8495 } | |
8496 v13 = v4->field_152; | |
8497 goto LABEL_51; | |
8498 case VAR_Experience: | |
8499 this->uExperience = a3; | |
8500 goto LABEL_124; | |
8501 case VAR_QBits_QuestsDone: | |
8502 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
|
8503 // && (&dword_722F10)[4 * a3] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8504 && pQuestTable[a3-1] ) |
0 | 8505 { |
8506 v14 = pPlayers[v3 + 1]; | |
8507 bFlashQuestBook = 1; | |
8508 v30 = 1; | |
8509 v31 = 1; | |
8510 v14->PlaySound(93, 0); | |
8511 } | |
8512 v13 = (char *)pParty->_award_bits; | |
8513 LABEL_51: | |
8514 _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); | |
8515 goto LABEL_168; | |
8516 case VAR_PlayerItemInHands: | |
8517 item.Reset(); | |
8518 item.Reset(); | |
8519 item.uItemID = a3; | |
8520 item.uAttributes = 1; | |
8521 pParty->SetHoldingItem(&item); | |
8522 if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
8523 pParty->field_3C.pIsArtifactFound[a3] = 1; | |
8524 return; | |
8525 case VAR_FixedGold: | |
8526 Party::SetGold(a3); | |
8527 return; | |
8528 case VAR_BaseMight: | |
8529 this->uMight = (unsigned __int8)a3; | |
8530 goto LABEL_84; | |
8531 case VAR_BaseIntellect: | |
8532 this->uIntelligence = (unsigned __int8)a3; | |
8533 goto LABEL_84; | |
8534 case VAR_BasePersonality: | |
8535 this->uWillpower = (unsigned __int8)a3; | |
8536 goto LABEL_84; | |
8537 case VAR_BaseEndurance: | |
8538 this->uEndurance = (unsigned __int8)a3; | |
8539 goto LABEL_84; | |
8540 case VAR_BaseSpeed: | |
8541 this->uSpeed = (unsigned __int8)a3; | |
8542 goto LABEL_84; | |
8543 case VAR_BaseAccuracy: | |
8544 this->uAccuracy = (unsigned __int8)a3; | |
8545 goto LABEL_84; | |
8546 case VAR_BaseLuck: | |
8547 this->uLuck = (unsigned __int8)a3; | |
8548 goto LABEL_84; | |
8549 case VAR_FixedFood: | |
8550 Party::SetFood(a3); | |
8551 goto LABEL_124; | |
8552 case VAR_MightBonus: | |
8553 goto LABEL_64; | |
8554 case VAR_IntellectBonus: | |
8555 goto LABEL_68; | |
8556 case VAR_PersonalityBonus: | |
8557 goto LABEL_69; | |
8558 case VAR_EnduranceBonus: | |
8559 goto LABEL_70; | |
8560 case VAR_SpeedBonus: | |
8561 goto LABEL_71; | |
8562 case VAR_AccuracyBonus: | |
8563 goto LABEL_72; | |
8564 case VAR_LuckBonus: | |
8565 goto LABEL_73; | |
8566 default: | |
8567 return; | |
8568 } | |
8569 while ( v9->uItemID != 615 ) | |
8570 { | |
8571 ++v8; | |
8572 ++v9; | |
8573 if ( v8 >= 138 ) | |
8574 goto LABEL_22; | |
8575 } | |
8576 v10 = (int)((char *)v4 + 36 * v8); | |
8577 *(int *)(v10 + 532) = 601; | |
8578 *(char *)(v10 + 558) = v3 + 1; | |
8579 LABEL_22: | |
8580 if ( v4->sResFireBase < 20 ) | |
8581 v4->sResFireBase = 20; | |
8582 if ( v4->sResAirBase < 20 ) | |
8583 v4->sResAirBase = 20; | |
8584 if ( v4->sResWaterBase < 20 ) | |
8585 v4->sResWaterBase = 20; | |
8586 if ( v4->sResEarthBase < 20 ) | |
8587 v4->sResEarthBase = 20; | |
8588 v4->sResMindBase = 200; | |
8589 v4->sResBodyBase = 200; | |
8590 v11 = v4->GetSexByVoice(); | |
8591 v4->field_1924 = v4->uVoiceID; | |
8592 v4->field_1928 = v4->uFace; | |
8593 if ( v11 ) | |
8594 { | |
8595 v4->uFace = 21; | |
8596 v4->uVoiceID = 21; | |
8597 } | |
8598 else | |
8599 { | |
8600 v4->uFace = 20; | |
8601 v4->uVoiceID = 20; | |
8602 } | |
8603 ReloadPlayerPortraits(v3, v4->uFace); | |
8604 goto LABEL_124; | |
8605 } | |
8606 LABEL_64: | |
8607 this->uMightBonus = (unsigned __int8)a3; | |
8608 LABEL_111: | |
8609 v28 = 0; | |
8610 v26 = 91; | |
8611 LABEL_112: | |
8612 v19 = pPlayers[v3 + 1]; | |
8613 v31 = 1; | |
8614 v19->PlaySound(v26, v28); | |
8615 goto LABEL_169; | |
8616 } | |
8617 if ( var <= VAR_FireResistanceBonus ) | |
8618 { | |
8619 if ( var == VAR_FireResistanceBonus ) | |
8620 { | |
8621 this->sResFireBonus = (unsigned __int8)a3; | |
8622 goto LABEL_111; | |
8623 } | |
8624 switch ( var ) | |
8625 { | |
8626 case VAR_ActualIntellect: | |
8627 LABEL_68: | |
8628 this->uIntelligenceBonus = (unsigned __int8)a3; | |
8629 goto LABEL_111; | |
8630 case VAR_ActualPersonality: | |
8631 LABEL_69: | |
8632 this->uWillpowerBonus = (unsigned __int8)a3; | |
8633 goto LABEL_111; | |
8634 case VAR_ActualEndurance: | |
8635 LABEL_70: | |
8636 this->uEnduranceBonus = (unsigned __int8)a3; | |
8637 goto LABEL_111; | |
8638 case VAR_ActualSpeed: | |
8639 LABEL_71: | |
8640 this->uSpeedBonus = (unsigned __int8)a3; | |
8641 goto LABEL_111; | |
8642 case VAR_ActualAccuracy: | |
8643 LABEL_72: | |
8644 this->uAccuracyBonus = (unsigned __int8)a3; | |
8645 goto LABEL_111; | |
8646 case VAR_ActualLuck: | |
8647 LABEL_73: | |
8648 this->uLuckBonus = (unsigned __int8)a3; | |
8649 goto LABEL_111; | |
8650 case VAR_FireResistance: | |
8651 this->sResFireBase = (unsigned __int8)a3; | |
8652 goto LABEL_84; | |
8653 case VAR_AirResistance: | |
8654 this->sResAirBase = (unsigned __int8)a3; | |
8655 goto LABEL_84; | |
8656 case VAR_WaterResistance: | |
8657 this->sResWaterBase = (unsigned __int8)a3; | |
8658 goto LABEL_84; | |
8659 case VAR_EarthResistance: | |
8660 this->sResEarthBase = (unsigned __int8)a3; | |
8661 goto LABEL_84; | |
8662 case VAR_SpiritResistance: | |
8663 this->sResSpiritBase = (unsigned __int8)a3; | |
8664 goto LABEL_84; | |
8665 case VAR_MindResistance: | |
8666 this->sResMindBase = (unsigned __int8)a3; | |
8667 goto LABEL_84; | |
8668 case VAR_BodyResistance: | |
8669 this->sResBodyBase = (unsigned __int8)a3; | |
8670 goto LABEL_84; | |
8671 case VAR_LightResistance: | |
8672 this->sResLightBase = (unsigned __int8)a3; | |
8673 goto LABEL_84; | |
8674 case VAR_DarkResistance: | |
8675 this->sResDarkBase = (unsigned __int8)a3; | |
8676 goto LABEL_84; | |
8677 case VAR_MagicResistance: | |
8678 this->sResMagicBase = (unsigned __int8)a3; | |
8679 LABEL_84: | |
8680 v28 = 0; | |
8681 v26 = 92; | |
8682 goto LABEL_112; | |
8683 default: | |
8684 return; | |
8685 } | |
8686 return; | |
8687 } | |
8688 HIWORD(v15) = 0; | |
8689 if ( var > VAR_DisarmTrapSkill ) | |
8690 { | |
8691 if ( var != VAR_LearningSkill ) | |
8692 { | |
8693 if ( var <= VAR_LearningSkill ) | |
8694 return; | |
8695 if ( var <= VAR_Eradicated ) | |
8696 { | |
8697 v4->SetCondition(var - 105, 1); | |
8698 } | |
8699 else | |
8700 { | |
8701 if ( var != VAR_MajorCondition ) | |
8702 { | |
8703 if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) | |
8704 byte_5E4C15[var] = a3; | |
8705 return; | |
8706 } | |
8707 memset(v4, 0, 0xA0u); | |
8708 } | |
8709 LABEL_124: | |
8710 v31 = 1; | |
8711 goto LABEL_169; | |
8712 } | |
8713 LABEL_106: | |
8714 v16 = (int)((char *)&v4->pConditions[16] + 2 * var); | |
8715 v17 = *(char *)v16; | |
8716 if ( a3 <= VAR_BodyResistanceBonus ) | |
8717 { | |
8718 LOWORD(v15) = (unsigned __int8)a3; | |
8719 v18 = v15 | v17 & VAR_BodyResistanceBonus; | |
8720 } | |
8721 else | |
8722 { | |
8723 LOWORD(v18) = (unsigned __int8)(a3 | v17 & 0xC0); | |
8724 } | |
8725 *(short *)v16 = v18; | |
8726 goto LABEL_124; | |
8727 } | |
8728 if ( var == VAR_DisarmTrapSkill ) | |
8729 goto LABEL_106; | |
8730 if ( var <= VAR_BodyResistanceBonus ) | |
8731 { | |
8732 switch ( var ) | |
8733 { | |
8734 case VAR_BodyResistanceBonus: | |
8735 v4->sResBodyBonus = (unsigned __int8)a3; | |
8736 break; | |
8737 case VAR_AirResistanceBonus: | |
8738 v4->sResAirBonus = (unsigned __int8)a3; | |
8739 break; | |
8740 case VAR_WaterResistanceBonus: | |
8741 v4->sResWaterBonus = (unsigned __int8)a3; | |
8742 break; | |
8743 case VAR_EarthResistanceBonus: | |
8744 v4->sResEarthBonus = (unsigned __int8)a3; | |
8745 break; | |
8746 case VAR_SpiritResistanceBonus: | |
8747 v4->sResSpiritBonus = (unsigned __int8)a3; | |
8748 break; | |
8749 default: | |
8750 if ( var != 62 ) | |
8751 return; | |
8752 v4->sResMindBonus = (unsigned __int8)a3; | |
8753 break; | |
8754 } | |
8755 goto LABEL_111; | |
8756 } | |
8757 if ( var == VAR_LightResistanceBonus ) | |
8758 { | |
8759 v4->sResLightBonus = (unsigned __int8)a3; | |
8760 goto LABEL_111; | |
8761 } | |
8762 if ( var == VAR_DarkResistanceBonus ) | |
8763 { | |
8764 v4->sResDarkBonus = (unsigned __int8)a3; | |
8765 goto LABEL_111; | |
8766 } | |
8767 if ( var == VAR_MagicResistanceBonus ) | |
8768 { | |
8769 v4->sResMagicBonus = (unsigned __int8)a3; | |
8770 goto LABEL_111; | |
8771 } | |
8772 if ( var > VAR_MagicResistanceBonus && var <= VAR_DiplomacySkill ) | |
8773 goto LABEL_106; | |
8774 } | |
8775 | |
8776 | |
8777 | |
8778 //----- (0044AFFB) -------------------------------------------------------- | |
8779 void Player::AddVariable(enum VariableType var, signed int val) | |
8780 { | |
8781 char v3; // bl@1 | |
8782 Player *v4; // esi@1 | |
8783 signed int uPlayerIdx; // edi@1 | |
8784 int v6; // eax@15 | |
8785 unsigned int v7; // esi@18 | |
8786 int *v8; // ebx@21 | |
8787 int v9; // eax@22 | |
8788 signed int v10; // eax@24 | |
8789 int v11; // eax@27 | |
8790 __int16 *v12; // esi@28 | |
8791 Player *v13; // ecx@34 | |
8792 Player *v14; // ecx@36 | |
8793 char *v15; // ecx@37 | |
8794 unsigned __int8 v16; // cf@38 | |
8795 Player *v17; // ecx@42 | |
8796 __int16 *v18; // esi@53 | |
8797 __int16 *v19; // esi@62 | |
8798 char *v20; // esi@107 | |
8799 __int16 v21; // dx@107 | |
8800 int v22; // ecx@107 | |
8801 Player *v23; // ecx@132 | |
8802 int v24; // eax@132 | |
8803 int v25; // eax@150 | |
8804 char v26; // zf@151 | |
8805 DDM_DLV_Header *v27; // eax@153 | |
8806 signed int v28; // eax@176 | |
8807 int v29; // [sp-8h] [bp-40h]@84 | |
8808 signed int v30; // [sp-4h] [bp-3Ch]@4 | |
8809 int v31; // [sp-4h] [bp-3Ch]@84 | |
8810 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8811 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8812 char v34; // [sp+37h] [bp-1h]@1 | |
8813 | |
8814 auto Dst = this; | |
8815 v3 = 0; | |
8816 v34 = 0; | |
8817 v4 = Dst; | |
8818 uPlayerIdx = 0; | |
8819 if ( Dst == pPlayers[2] ) | |
8820 { | |
8821 uPlayerIdx = 1; | |
8822 goto LABEL_8; | |
8823 } | |
8824 if ( Dst == pPlayers[3] ) | |
8825 { | |
8826 v30 = 2; | |
8827 } | |
8828 else | |
8829 { | |
8830 if ( Dst != pPlayers[4] ) | |
8831 goto LABEL_8; | |
8832 v30 = 3; | |
8833 } | |
8834 uPlayerIdx = v30; | |
8835 LABEL_8: | |
8836 if ( var <= VAR_AutoNotes ) | |
8837 { | |
8838 if ( var != VAR_AutoNotes ) | |
8839 { | |
8840 if ( var <= VAR_ActualMight ) | |
8841 { | |
8842 if ( var != VAR_ActualMight ) | |
8843 { | |
8844 switch ( var ) | |
8845 { | |
8846 case VAR_RandomGold: | |
8847 if ( !val ) | |
8848 val = 1; | |
8849 v6 = rand(); | |
8850 party_finds_gold(v6 % val + 1, 1); | |
8851 GameUI_DrawFoodAndGold(); | |
8852 return; | |
8853 case VAR_RandomFood: | |
8854 if ( !val ) | |
8855 val = 1; | |
8856 v7 = rand() % val + 1; | |
8857 Party::GiveFood(v7); | |
8858 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8859 ShowStatusBarString(pTmpBuf, 2u); | |
8860 GameUI_DrawFoodAndGold(); | |
8861 goto _play_sound; | |
8862 case VAR_Sex: | |
8863 Dst->uSex = (PLAYER_SEX)val; | |
8864 goto _play_anim_and_exit; | |
8865 case VAR_Class: | |
8866 Dst->uClass = val; | |
8867 goto _play_anim_and_exit; | |
8868 case VAR_CurrentHP: | |
8869 v8 = &Dst->sHealth; | |
8870 *v8 += val; | |
8871 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8872 goto _play_anim_and_exit; | |
8873 v9 = v4->GetMaxHealth(); | |
8874 goto LABEL_23; | |
8875 case VAR_MaxHP: | |
8876 v10 = Dst->GetMaxHealth(); | |
8877 v4->_health_related = 0; | |
8878 v4->uFullHealthBonus = 0; | |
8879 v4->sHealth = v10; | |
8880 return; | |
8881 case VAR_CurrentSP: | |
8882 v8 = &Dst->sMana; | |
8883 *v8 += val; | |
8884 if ( Dst->sMana > GetMaxMana() ) | |
8885 { | |
8886 v9 = v4->GetMaxMana(); | |
8887 LABEL_23: | |
8888 *v8 = v9; | |
8889 } | |
8890 goto _play_anim_and_exit; | |
8891 case VAR_MaxSP: | |
8892 v11 = GetMaxMana(); | |
8893 v4->_mana_related = 0; | |
8894 v4->uFullManaBonus = 0; | |
8895 v4->sMana = v11; | |
8896 return; | |
8897 case VAR_ACModifier: | |
8898 v12 = &Dst->sACModifier; | |
8899 goto LABEL_29; | |
8900 case VAR_BaseLevel: | |
8901 v12 = (__int16 *)&Dst->uLevel; | |
8902 goto LABEL_29; | |
8903 case VAR_LevelModifier: | |
8904 v12 = &Dst->sLevelModifier; | |
8905 LABEL_29: | |
8906 *v12 += val; | |
8907 if ( *v12 > 255 ) | |
8908 *v12 = 255; | |
8909 goto _play_anim_and_exit; | |
8910 case VAR_Age: | |
8911 Dst->sAgeModifier += val; | |
8912 return; | |
8913 case VAR_Award: | |
8914 v13 = pPlayers[uPlayerIdx + 1]; | |
8915 v33 = 0x80u >> ((signed __int16)val - 1) % 8; | |
8916 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
|
8917 //&& dword_723E80_award_related[2 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8918 && pAwards[val-1].pText ) |
0 | 8919 { |
8920 v14 = pPlayers[uPlayerIdx + 1]; | |
8921 v34 = 1; | |
8922 v3 = 1; | |
8923 v14->PlaySound(96, 0); | |
8924 } | |
8925 v15 = v4->field_152; | |
8926 goto LABEL_44; | |
8927 case VAR_Experience: | |
8928 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8929 LODWORD(Dst->uExperience) += val; | |
8930 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8931 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8932 Dst->uExperience = 4000000000i64; | |
8933 goto _play_anim_and_exit; | |
8934 case VAR_QBits_QuestsDone: | |
8935 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
|
8936 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8937 && pQuestTable[val-1] ) |
0 | 8938 { |
8939 v17 = pPlayers[uPlayerIdx + 1]; | |
8940 bFlashQuestBook = 1; | |
8941 v34 = 1; | |
8942 v3 = 1; | |
8943 v17->PlaySound(93, 0); | |
8944 } | |
8945 v15 = (char *)pParty->_award_bits; | |
8946 LABEL_44: | |
8947 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8948 goto LABEL_173; | |
8949 case VAR_PlayerItemInHands: | |
8950 item.Reset(); | |
8951 item.Reset(); | |
8952 item.uAttributes = 1; | |
8953 item.uItemID = val; | |
8954 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
8955 pParty->field_3C.pIsArtifactFound[val] = 1; | |
8956 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) | |
8957 { | |
8958 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8959 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8960 } | |
8961 pParty->SetHoldingItem(&item); | |
8962 return; | |
8963 case VAR_FixedGold: | |
8964 party_finds_gold(val, 1); | |
8965 return; | |
8966 case VAR_BaseMight: | |
8967 v18 = (__int16 *)&Dst->uMight; | |
8968 goto LABEL_82; | |
8969 case VAR_BaseIntellect: | |
8970 v18 = (__int16 *)&Dst->uIntelligence; | |
8971 goto LABEL_82; | |
8972 case VAR_BasePersonality: | |
8973 v18 = (__int16 *)&Dst->uWillpower; | |
8974 goto LABEL_82; | |
8975 case VAR_BaseEndurance: | |
8976 v18 = (__int16 *)&Dst->uEndurance; | |
8977 goto LABEL_82; | |
8978 case VAR_BaseSpeed: | |
8979 v18 = (__int16 *)&Dst->uSpeed; | |
8980 goto LABEL_82; | |
8981 case VAR_BaseAccuracy: | |
8982 v18 = (__int16 *)&Dst->uAccuracy; | |
8983 goto LABEL_82; | |
8984 case VAR_BaseLuck: | |
8985 v18 = (__int16 *)&Dst->uLuck; | |
8986 goto LABEL_82; | |
8987 case VAR_FixedFood: | |
8988 Party::GiveFood(val); | |
8989 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); | |
8990 ShowStatusBarString(pTmpBuf, 2u); | |
8991 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8992 Party::SetFood(0xFFFFu); | |
8993 goto _play_sound; | |
8994 case VAR_MightBonus: | |
8995 goto LABEL_62; | |
8996 case VAR_IntellectBonus: | |
8997 goto LABEL_66; | |
8998 case VAR_PersonalityBonus: | |
8999 goto LABEL_67; | |
9000 case VAR_EnduranceBonus: | |
9001 goto LABEL_68; | |
9002 case VAR_SpeedBonus: | |
9003 goto LABEL_69; | |
9004 case VAR_AccuracyBonus: | |
9005 goto LABEL_70; | |
9006 case VAR_LuckBonus: | |
9007 goto LABEL_71; | |
9008 default: | |
9009 return; | |
9010 } | |
9011 return; | |
9012 } | |
9013 LABEL_62: | |
9014 v19 = (__int16 *)&Dst->uMightBonus; | |
9015 goto LABEL_113; | |
9016 } | |
9017 if ( var <= VAR_FireResistanceBonus ) | |
9018 { | |
9019 if ( var != VAR_FireResistanceBonus ) | |
9020 { | |
9021 switch ( var ) | |
9022 { | |
9023 case VAR_ActualIntellect: | |
9024 LABEL_66: | |
9025 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9026 goto LABEL_113; | |
9027 case VAR_ActualPersonality: | |
9028 LABEL_67: | |
9029 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9030 goto LABEL_113; | |
9031 case VAR_ActualEndurance: | |
9032 LABEL_68: | |
9033 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9034 goto LABEL_113; | |
9035 case VAR_ActualSpeed: | |
9036 LABEL_69: | |
9037 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9038 goto LABEL_113; | |
9039 case VAR_ActualAccuracy: | |
9040 LABEL_70: | |
9041 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9042 goto LABEL_113; | |
9043 case VAR_ActualLuck: | |
9044 LABEL_71: | |
9045 v19 = (__int16 *)&Dst->uLuckBonus; | |
9046 goto LABEL_113; | |
9047 case VAR_FireResistance: | |
9048 v18 = &Dst->sResFireBase; | |
9049 goto LABEL_82; | |
9050 case VAR_AirResistance: | |
9051 v18 = &Dst->sResAirBase; | |
9052 goto LABEL_82; | |
9053 case VAR_WaterResistance: | |
9054 v18 = &Dst->sResWaterBase; | |
9055 goto LABEL_82; | |
9056 case VAR_EarthResistance: | |
9057 v18 = &Dst->sResEarthBase; | |
9058 goto LABEL_82; | |
9059 case VAR_SpiritResistance: | |
9060 v18 = &Dst->sResSpiritBase; | |
9061 goto LABEL_82; | |
9062 case VAR_MindResistance: | |
9063 v18 = &Dst->sResMindBase; | |
9064 goto LABEL_82; | |
9065 case VAR_BodyResistance: | |
9066 v18 = &Dst->sResBodyBase; | |
9067 goto LABEL_82; | |
9068 case VAR_LightResistance: | |
9069 v18 = &Dst->sResLightBase; | |
9070 goto LABEL_82; | |
9071 case VAR_DarkResistance: | |
9072 v18 = &Dst->sResDarkBase; | |
9073 goto LABEL_82; | |
9074 case VAR_MagicResistance: | |
9075 v18 = &Dst->sResMagicBase; | |
9076 LABEL_82: | |
9077 *v18 += val; | |
9078 if ( *v18 > 255 ) | |
9079 *v18 = 255; | |
9080 v31 = 0; | |
9081 v29 = 92; | |
9082 goto LABEL_116; | |
9083 default: | |
9084 return; | |
9085 } | |
9086 return; | |
9087 } | |
9088 v19 = &Dst->sResFireBonus; | |
9089 LABEL_113: | |
9090 *v19 += val; | |
9091 if ( *v19 > 255 ) | |
9092 *v19 = 255; | |
9093 v31 = 0; | |
9094 v29 = 91; | |
9095 LABEL_116: | |
9096 v3 = 1; | |
9097 pPlayers[uPlayerIdx + 1]->PlaySound(v29, v31); | |
9098 goto _play_anim_and_maybe_sound; | |
9099 } | |
9100 if ( var <= VAR_DisarmTrapSkill ) | |
9101 { | |
9102 if ( var != VAR_DisarmTrapSkill ) | |
9103 { | |
9104 if ( var <= VAR_BodyResistanceBonus ) | |
9105 { | |
9106 switch ( var ) | |
9107 { | |
9108 case VAR_BodyResistanceBonus: | |
9109 v19 = &Dst->sResBodyBonus; | |
9110 break; | |
9111 case VAR_AirResistanceBonus: | |
9112 v19 = &Dst->sResAirBonus; | |
9113 break; | |
9114 case VAR_WaterResistanceBonus: | |
9115 v19 = &Dst->sResWaterBonus; | |
9116 break; | |
9117 case VAR_EarthResistanceBonus: | |
9118 v19 = &Dst->sResEarthBonus; | |
9119 break; | |
9120 case VAR_SpiritResistanceBonus: | |
9121 v19 = &Dst->sResSpiritBonus; | |
9122 break; | |
9123 default: | |
9124 if ( var != 62 ) | |
9125 return; | |
9126 v19 = &Dst->sResMindBonus; | |
9127 break; | |
9128 } | |
9129 goto LABEL_113; | |
9130 } | |
9131 if ( var == VAR_LightResistanceBonus ) | |
9132 { | |
9133 v19 = &Dst->sResLightBonus; | |
9134 goto LABEL_113; | |
9135 } | |
9136 if ( var == VAR_DarkResistanceBonus ) | |
9137 { | |
9138 v19 = &Dst->sResDarkBonus; | |
9139 goto LABEL_113; | |
9140 } | |
9141 if ( var == VAR_MagicResistanceBonus ) | |
9142 { | |
9143 v19 = &Dst->sResMagicBonus; | |
9144 goto LABEL_113; | |
9145 } | |
9146 if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) | |
9147 return; | |
9148 } | |
9149 goto LABEL_106; | |
9150 } | |
9151 if ( var == VAR_LearningSkill ) | |
9152 { | |
9153 LABEL_106: | |
9154 if ( val <= VAR_BodyResistanceBonus ) | |
9155 { | |
9156 *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus; | |
9157 } | |
9158 else | |
9159 { | |
9160 v20 = (char *)&Dst->pConditions[16] + 2 * var; | |
9161 v21 = *(short *)v20; | |
9162 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9163 if ( v22 > 60 ) | |
9164 LOWORD(v22) = 60; | |
9165 LOBYTE(v21) = v21 & 0xC0; | |
9166 *(short *)v20 = v22 | v21; | |
9167 } | |
9168 goto _play_anim_and_exit; | |
9169 } | |
9170 if ( var <= VAR_LearningSkill ) | |
9171 return; | |
9172 if ( var <= VAR_Eradicated ) | |
9173 { | |
9174 Dst->SetCondition(var - 105, 0); | |
9175 } | |
9176 else | |
9177 { | |
9178 if ( var != VAR_MajorCondition ) | |
9179 { | |
9180 if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) | |
9181 { | |
9182 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 ) | |
9183 byte_5E4C15[var] += val; | |
9184 else | |
9185 byte_5E4C15[var] = -1; | |
9186 } | |
9187 return; | |
9188 } | |
9189 memset(Dst, 0, 0xA0u); | |
9190 } | |
9191 _play_anim_and_exit: | |
9192 v3 = 1; | |
9193 _play_anim_and_maybe_sound: | |
9194 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9195 _maybe_play_sound: | |
9196 if ( v3 != 1 ) | |
9197 return; | |
9198 goto _play_sound; | |
9199 } | |
9200 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
|
9201 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9202 && pAutonoteTxt[val-1].pText ) |
0 | 9203 { |
9204 v23 = pPlayers[uPlayerIdx + 1]; | |
9205 v34 = 1; | |
9206 v23->PlaySound(96, 0); | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9207 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9208 bFlashAutonotesBook = 1; |
9209 dword_506568 = v24; | |
9210 } | |
9211 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9212 v3 = 1; | |
9213 LABEL_173: | |
9214 if ( v34 != 1 ) | |
9215 goto _maybe_play_sound; | |
9216 goto _play_anim_and_maybe_sound; | |
9217 } | |
9218 if ( var > VAR_GoldInBank ) | |
9219 { | |
9220 if ( var == 307 ) | |
9221 { | |
9222 pParty->uNumDeaths += val; | |
9223 goto LABEL_173; | |
9224 } | |
9225 switch ( var ) | |
9226 { | |
9227 case 308: | |
9228 pParty->uNumBountiesCollected += val; | |
9229 break; | |
9230 case 309: | |
9231 pParty->uNumPrisonTerms += val; | |
9232 break; | |
9233 case 310: | |
9234 pParty->uNumArenaPageWins += val; | |
9235 break; | |
9236 case 311: | |
9237 pParty->uNumArenaSquireWins += val; | |
9238 break; | |
9239 case 312: | |
9240 pParty->uNumArenaKnightWins += val; | |
9241 break; | |
9242 case 313: | |
9243 pParty->uNumArenaLordWins += val; | |
9244 break; | |
9245 } | |
9246 } | |
9247 else | |
9248 { | |
9249 if ( var == VAR_GoldInBank ) | |
9250 { | |
9251 pParty->uNumGoldInBank += val; | |
9252 return; | |
9253 } | |
9254 if ( var <= VAR_Counter8 ) | |
9255 { | |
9256 if ( (signed int)var >= 245 ) | |
9257 { | |
9258 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); | |
9259 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); | |
9260 } | |
9261 else | |
9262 { | |
9263 switch ( var ) | |
9264 { | |
9265 case VAR_MonthEquals|VAR_CurrentSP: | |
9266 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9267 break; | |
9268 case VAR_NPCs2: | |
9269 pParty->field_709 = 0; | |
9270 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
9271 sub_44A56A(); | |
9272 viewparams->bRedrawGameUI = 1; | |
9273 break; | |
9274 case VAR_NumSkillPoints: | |
9275 Dst->uSkillPoints += val; | |
9276 break; | |
9277 } | |
9278 } | |
9279 return; | |
9280 } | |
9281 if ( var < VAR_Counter9 ) | |
9282 return; | |
9283 if ( (signed int)var <= 274 ) | |
9284 { | |
9285 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); | |
9286 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); | |
9287 goto _play_sound; | |
9288 } | |
9289 if ( var != VAR_ReputationInCurrentLocation ) | |
9290 { | |
9291 if ( var <= VAR_ReputationInCurrentLocation | |
9292 || var > VAR_History_28 | |
9293 || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9294 || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), | |
9295 v26 = *(&pStorylineText->field_0 + 3 * v25) == 0, | |
9296 pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), | |
9297 v26) ) | |
9298 return; | |
9299 bFlashHistoryBook = 1; | |
9300 _play_sound: | |
9301 v28 = 8 * uPlayerIdx + 400; | |
9302 LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; | |
9303 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); | |
9304 return; | |
9305 } | |
9306 v27 = &pOutdoor->ddm; | |
9307 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9308 v27 = &pIndoor->dlv; | |
9309 v27->uReputation += val; | |
9310 if ( v27->uReputation > 10000 ) | |
9311 v27->uReputation = 10000; | |
9312 } | |
9313 } | |
9314 // 506568: using guessed type int dword_506568; | |
9315 // 507948: using guessed type char bFlashHistoryBook; | |
9316 // 507949: using guessed type char bFlashAutonotesBook; | |
9317 // 50794A: using guessed type char bFlashQuestBook; | |
9318 // 72371C: using guessed type int dword_72371C[]; | |
9319 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9320 | |
9321 | |
9322 | |
9323 | |
9324 //----- (0044B9C4) -------------------------------------------------------- | |
9325 void Player::SubtractVariable(enum VariableType var, void *a3) | |
9326 { | |
9327 unsigned int v3; // ebx@1 | |
9328 signed int v4; // esi@1 | |
9329 enum VariableType v5; // eax@8 | |
9330 int v6; // esi@11 | |
9331 int v7; // edi@14 | |
9332 signed int v8; // eax@17 | |
9333 char *v9; // eax@20 | |
9334 char v10; // sf@20 | |
9335 char *v11; // ecx@26 | |
9336 char *v12; // ecx@27 | |
9337 __int64 v13; // qax@27 | |
9338 unsigned __int8 v14; // cf@27 | |
9339 char *v15; // edx@29 | |
9340 char *v16; // eax@90 | |
9341 char *v17; // ecx@94 | |
9342 void *v18; // esi@97 | |
9343 signed int v19; // edx@97 | |
9344 char *v20; // ecx@98 | |
9345 int v21; // eax@100 | |
9346 __int16 v22; // dx@112 | |
9347 int v23; // [sp-8h] [bp-14h]@45 | |
9348 signed int v24; // [sp-4h] [bp-10h]@4 | |
9349 int v25; // [sp-4h] [bp-10h]@45 | |
9350 | |
9351 v3 = 0; | |
9352 v4 = 0; | |
9353 if ( this == pPlayers[2] ) | |
9354 { | |
9355 v4 = 1; | |
9356 goto LABEL_8; | |
9357 } | |
9358 if ( this == pPlayers[3] ) | |
9359 { | |
9360 v24 = 2; | |
9361 } | |
9362 else | |
9363 { | |
9364 if ( this != pPlayers[4] ) | |
9365 goto LABEL_8; | |
9366 v24 = 3; | |
9367 } | |
9368 v4 = v24; | |
9369 LABEL_8: | |
9370 v5 = var; | |
9371 if ( (signed int)var > 222 ) | |
9372 { | |
9373 if ( (signed int)var <= 307 ) | |
9374 { | |
9375 if ( var == 307 ) | |
9376 { | |
9377 pParty->uNumDeaths -= (unsigned int)a3; | |
9378 return; | |
9379 } | |
9380 if ( var == 223 ) | |
9381 { | |
9382 v11 = (char *)pParty->_autonote_bits; | |
9383 v22 = (short)a3 - 1; | |
9384 } | |
9385 else | |
9386 { | |
9387 if ( var != 231 ) | |
9388 { | |
9389 switch ( var ) | |
9390 { | |
9391 case 232: | |
9392 var = (VariableType)0; | |
9393 GetNewNPCData(uDialogue_SpeakingActorNPC_ID, (int)&var); | |
9394 dword_5B65CC = 0; | |
9395 if ( (void *)var == a3 ) | |
9396 { | |
9397 dword_5B65CC = (int)a3; | |
9398 } | |
9399 else | |
9400 { | |
9401 pParty->field_709 = 0; | |
9402 LOBYTE(pNPCStats->pNewNPCData[(int)a3].uFlags) &= 0x7Fu; | |
9403 sub_44A56A(); | |
9404 viewparams->bRedrawGameUI = 1; | |
9405 } | |
9406 break; | |
9407 case 241: | |
9408 v18 = a3; | |
9409 v19 = 0; | |
9410 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9411 { | |
9412 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
9413 do | |
9414 { | |
9415 if ( *((void **)v20 + 4) == v18 ) | |
9416 { | |
9417 v21 = *(int *)v20; | |
9418 if ( (char)*(int *)v20 < 0 ) | |
9419 { | |
9420 LOBYTE(v21) = v21 & 0x7F; | |
9421 *(int *)v20 = v21; | |
9422 } | |
9423 } | |
9424 ++v19; | |
9425 v20 += 76; | |
9426 } | |
9427 while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); | |
9428 } | |
9429 if ( (void *)pParty->pHirelings[0].uProfession == v18 ) | |
9430 memset(pParty->pHirelings, 0, 0x4Cu); | |
9431 if ( (void *)pParty->pHirelings[1].uProfession == v18 ) | |
9432 memset(&pParty->pHirelings[1], 0, 0x4Cu); | |
9433 pParty->field_709 = 0; | |
9434 sub_44A56A(); | |
9435 break; | |
9436 case 243: | |
9437 v17 = (char *)&this->uSkillPoints; | |
9438 if ( (unsigned int)a3 <= *(int *)v17 ) | |
9439 *(int *)v17 -= (int)a3; | |
9440 else | |
9441 *(int *)v17 = 0; | |
9442 break; | |
9443 case 275: | |
9444 v16 = (char *)&pOutdoor->ddm; | |
9445 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9446 v16 = (char *)&pIndoor->dlv; | |
9447 *((int *)v16 + 2) -= (int)a3; | |
9448 if ( *((int *)v16 + 2) < -10000 ) | |
9449 *((int *)v16 + 2) = -10000; | |
9450 break; | |
9451 case 306: | |
9452 if ( (unsigned int)a3 <= pParty->uNumGoldInBank ) | |
9453 pParty->uNumGoldInBank -= (unsigned int)a3; | |
9454 else | |
9455 LABEL_88: | |
9456 dword_5B65C4 = 1; | |
9457 break; | |
9458 } | |
9459 return; | |
9460 } | |
9461 v11 = this->field_1A50; | |
9462 LABEL_112: | |
9463 v22 = (signed __int16)a3; | |
9464 } | |
9465 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
9466 return; | |
9467 } | |
9468 switch ( var ) | |
9469 { | |
9470 case 308: | |
9471 pParty->uNumBountiesCollected -= (unsigned int)a3; | |
9472 break; | |
9473 case 309: | |
9474 pParty->uNumPrisonTerms -= (int)a3; | |
9475 break; | |
9476 case 310: | |
9477 pParty->uNumArenaPageWins -= (char)a3; | |
9478 break; | |
9479 case 311: | |
9480 pParty->uNumArenaSquireWins -= (char)a3; | |
9481 break; | |
9482 case 312: | |
9483 pParty->uNumArenaKnightWins -= (char)a3; | |
9484 break; | |
9485 case 313: | |
9486 pParty->uNumArenaLordWins -= (char)a3; | |
9487 break; | |
9488 } | |
9489 } | |
9490 else | |
9491 { | |
9492 if ( (signed int)var >= 123 ) | |
9493 { | |
9494 byte_5E4C15[var] -= (char)a3; | |
9495 } | |
9496 else | |
9497 { | |
9498 switch ( var ) | |
9499 { | |
9500 case VAR_RandomGold: | |
9501 v6 = rand() % (signed int)a3 + 1; | |
9502 if ( v6 > pParty->uNumGold ) | |
9503 v6 = pParty->uNumGold; | |
9504 Party::TakeGold(v6); | |
9505 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
9506 ShowStatusBarString(pTmpBuf, 2u); | |
9507 GameUI_DrawFoodAndGold(); | |
9508 return; | |
9509 case VAR_RandomFood: | |
9510 v7 = rand() % (signed int)a3 + 1; | |
9511 if ( v7 > pParty->uNumFoodRations ) | |
9512 v7 = pParty->uNumFoodRations; | |
9513 Party::TakeFood(v7); | |
9514 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9515 ShowStatusBarString(pTmpBuf, 2u); | |
9516 GameUI_DrawFoodAndGold(); | |
9517 goto LABEL_17; | |
9518 default: | |
9519 return; | |
9520 case VAR_CurrentHP: | |
9521 ReceiveDamage((signed int)a3, 4); | |
9522 goto LABEL_17; | |
9523 case VAR_CurrentSP: | |
9524 v9 = (char *)&this->sMana; | |
9525 v10 = this->sMana - (signed int)a3 < 0; | |
9526 *(int *)v9 -= (int)a3; | |
9527 if ( v10 ) | |
9528 *(int *)v9 = 0; | |
9529 goto LABEL_17; | |
9530 case VAR_ACModifier: | |
9531 this->sACModifier -= (unsigned __int8)a3; | |
9532 goto LABEL_17; | |
9533 case VAR_BaseLevel: | |
9534 this->uLevel -= (unsigned __int8)a3; | |
9535 goto LABEL_17; | |
9536 case VAR_LevelModifier: | |
9537 this->sLevelModifier -= (unsigned __int8)a3; | |
9538 goto LABEL_17; | |
9539 case VAR_Age: | |
9540 this->sAgeModifier -= (signed __int16)a3; | |
9541 return; | |
9542 case VAR_Award: | |
9543 v11 = this->field_152; | |
9544 goto LABEL_112; | |
9545 case VAR_Experience: | |
9546 v12 = (char *)&this->uExperience; | |
9547 v13 = (signed int)a3; | |
9548 v14 = *(int *)v12 < (unsigned int)a3; | |
9549 *(int *)v12 -= (int)a3; | |
9550 *((int *)v12 + 1) -= v14 + HIDWORD(v13); | |
9551 goto LABEL_17; | |
9552 case VAR_QBits_QuestsDone: | |
9553 _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); | |
9554 pPlayers[v4 + 1]->PlaySound(96, 0); | |
9555 return; | |
9556 case VAR_PlayerItemInHands: | |
9557 v15 = (char *)this->pInventoryIndices; | |
9558 break; | |
9559 case VAR_FixedGold: | |
9560 if ( (unsigned int)a3 > pParty->uNumGold ) | |
9561 goto LABEL_88; | |
9562 Party::TakeGold((unsigned int)a3); | |
9563 return; | |
9564 case VAR_MightBonus: | |
9565 case VAR_ActualMight: | |
9566 this->uMightBonus -= (unsigned __int16)a3; | |
9567 goto LABEL_72; | |
9568 case VAR_IntellectBonus: | |
9569 case VAR_ActualIntellect: | |
9570 this->uIntelligenceBonus -= (unsigned __int16)a3; | |
9571 goto LABEL_72; | |
9572 case VAR_PersonalityBonus: | |
9573 case VAR_ActualPersonality: | |
9574 this->uWillpowerBonus -= (unsigned __int16)a3; | |
9575 goto LABEL_72; | |
9576 case VAR_EnduranceBonus: | |
9577 case VAR_ActualEndurance: | |
9578 this->uEnduranceBonus -= (unsigned __int16)a3; | |
9579 goto LABEL_72; | |
9580 case VAR_SpeedBonus: | |
9581 case VAR_ActualSpeed: | |
9582 this->uSpeedBonus -= (unsigned __int16)a3; | |
9583 goto LABEL_72; | |
9584 case VAR_AccuracyBonus: | |
9585 case VAR_ActualAccuracy: | |
9586 this->uAccuracyBonus -= (unsigned __int16)a3; | |
9587 goto LABEL_72; | |
9588 case VAR_LuckBonus: | |
9589 case VAR_ActualLuck: | |
9590 this->uLuckBonus -= (unsigned __int16)a3; | |
9591 goto LABEL_72; | |
9592 case VAR_BaseMight: | |
9593 this->uMight -= (unsigned __int16)a3; | |
9594 goto LABEL_45; | |
9595 case VAR_BaseIntellect: | |
9596 this->uIntelligence -= (unsigned __int16)a3; | |
9597 goto LABEL_45; | |
9598 case VAR_BasePersonality: | |
9599 this->uWillpower -= (unsigned __int16)a3; | |
9600 goto LABEL_45; | |
9601 case VAR_BaseEndurance: | |
9602 this->uEndurance -= (unsigned __int16)a3; | |
9603 goto LABEL_45; | |
9604 case VAR_BaseSpeed: | |
9605 this->uSpeed -= (unsigned __int16)a3; | |
9606 goto LABEL_45; | |
9607 case VAR_BaseAccuracy: | |
9608 this->uAccuracy -= (unsigned __int16)a3; | |
9609 goto LABEL_45; | |
9610 case VAR_BaseLuck: | |
9611 this->uLuck -= (unsigned __int16)a3; | |
9612 goto LABEL_45; | |
9613 case VAR_FireResistance: | |
9614 this->sResFireBase -= (signed __int16)a3; | |
9615 goto LABEL_45; | |
9616 case VAR_AirResistance: | |
9617 this->sResAirBase -= (signed __int16)a3; | |
9618 goto LABEL_45; | |
9619 case VAR_WaterResistance: | |
9620 this->sResWaterBase -= (signed __int16)a3; | |
9621 goto LABEL_45; | |
9622 case VAR_EarthResistance: | |
9623 this->sResEarthBase -= (signed __int16)a3; | |
9624 goto LABEL_45; | |
9625 case VAR_SpiritResistance: | |
9626 this->sResSpiritBase -= (signed __int16)a3; | |
9627 goto LABEL_45; | |
9628 case VAR_MindResistance: | |
9629 this->sResMindBase -= (signed __int16)a3; | |
9630 goto LABEL_45; | |
9631 case VAR_BodyResistance: | |
9632 this->sResBodyBase -= (signed __int16)a3; | |
9633 goto LABEL_45; | |
9634 case VAR_LightResistance: | |
9635 this->sResLightBase -= (signed __int16)a3; | |
9636 goto LABEL_45; | |
9637 case VAR_DarkResistance: | |
9638 this->sResDarkBase -= (signed __int16)a3; | |
9639 goto LABEL_45; | |
9640 case VAR_MagicResistance: | |
9641 this->sResMagicBase -= (signed __int16)a3; | |
9642 goto LABEL_45; | |
9643 case VAR_FireResistanceBonus: | |
9644 this->sResFireBonus -= (signed __int16)a3; | |
9645 goto LABEL_45; | |
9646 case VAR_AirResistanceBonus: | |
9647 this->sResAirBonus -= (signed __int16)a3; | |
9648 LABEL_45: | |
9649 v25 = 0; | |
9650 v23 = 92; | |
9651 goto LABEL_73; | |
9652 case VAR_WaterResistanceBonus: | |
9653 this->sResWaterBonus -= (signed __int16)a3; | |
9654 goto LABEL_72; | |
9655 case VAR_EarthResistanceBonus: | |
9656 this->sResEarthBonus -= (signed __int16)a3; | |
9657 goto LABEL_72; | |
9658 case VAR_SpiritResistanceBonus: | |
9659 this->sResSpiritBonus -= (signed __int16)a3; | |
9660 goto LABEL_72; | |
9661 case VAR_MindResistanceBonus: | |
9662 this->sResMindBonus -= (signed __int16)a3; | |
9663 goto LABEL_72; | |
9664 case VAR_BodyResistanceBonus: | |
9665 this->sResBodyBonus -= (signed __int16)a3; | |
9666 goto LABEL_72; | |
9667 case VAR_LightResistanceBonus: | |
9668 this->sResLightBonus -= (signed __int16)a3; | |
9669 goto LABEL_72; | |
9670 case VAR_DarkResistanceBonus: | |
9671 this->sResDarkBonus -= (signed __int16)a3; | |
9672 goto LABEL_72; | |
9673 case VAR_MagicResistanceBonus: | |
9674 this->sResMagicBonus -= (signed __int16)a3; | |
9675 LABEL_72: | |
9676 v25 = 0; | |
9677 v23 = 91; | |
9678 LABEL_73: | |
9679 pPlayers[v4 + 1]->PlaySound(v23, v25); | |
9680 goto LABEL_17; | |
9681 case VAR_FixedFood: | |
9682 Party::TakeFood((unsigned int)a3); | |
9683 goto LABEL_17; | |
9684 case VAR_StaffSkill: | |
9685 case VAR_SwordSkill: | |
9686 case VAR_DaggerSkill: | |
9687 case VAR_AxeSkill: | |
9688 case VAR_SpearSkill: | |
9689 case VAR_BowSkill: | |
9690 case VAR_MaceSkill: | |
9691 case VAR_BlasterSkill: | |
9692 case VAR_ShieldSkill: | |
9693 case VAR_LeatherSkill: | |
9694 case VAR_SkillChain: | |
9695 case VAR_PlateSkill: | |
9696 case VAR_FireSkill: | |
9697 case VAR_AirSkill: | |
9698 case VAR_WaterSkill: | |
9699 case VAR_EarthSkill: | |
9700 case VAR_SpiritSkill: | |
9701 case VAR_MindSkill: | |
9702 case VAR_BodySkill: | |
9703 case VAR_LightSkill: | |
9704 case VAR_DarkSkill: | |
9705 case VAR_IdentifyItemSkill: | |
9706 case VAR_MerchantSkill: | |
9707 case VAR_RepairSkill: | |
9708 case VAR_BodybuildingSkill: | |
9709 case VAR_MeditationSkill: | |
9710 case VAR_PerceptionSkill: | |
9711 case VAR_DiplomacySkill: | |
9712 case VAR_DisarmTrapSkill: | |
9713 case VAR_LearningSkill: | |
9714 *((short *)&this->pConditions[16] + var) -= (unsigned __int8)a3; | |
9715 goto LABEL_17; | |
9716 case VAR_Cursed: | |
9717 case VAR_Weak: | |
9718 case VAR_Asleep: | |
9719 case VAR_Afraid: | |
9720 case VAR_Drunk: | |
9721 case VAR_Insane: | |
9722 case VAR_PoisonedGreen: | |
9723 case VAR_DiseasedGreen: | |
9724 case VAR_PoisonedYellow: | |
9725 case VAR_DiseasedYellow: | |
9726 case VAR_PoisonedRed: | |
9727 case VAR_DiseasedRed: | |
9728 case VAR_Paralyzed: | |
9729 case VAR_Unconsious: | |
9730 case VAR_Dead: | |
9731 case VAR_Stoned: | |
9732 case VAR_Eradicated: | |
9733 *((int *)this + 2 * var - 210) = 0; | |
9734 *((int *)this + 2 * v5 - 209) = 0; | |
9735 LABEL_17: | |
9736 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9737 v8 = 8 * v4 + 400; | |
9738 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9739 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9740 return; | |
9741 } | |
9742 do | |
9743 { | |
9744 if ( *(void **)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v15 + 5] == a3 ) | |
9745 { | |
9746 RemoveItemAtInventoryIndex(v3); | |
9747 return; | |
9748 } | |
9749 ++v3; | |
9750 v15 += 4; | |
9751 } | |
9752 while ( (signed int)v3 < 126 ); | |
9753 if ( (void *)pParty->pPickedItem.uItemID == a3 ) | |
9754 pMouse->RemoveHoldingItem(); | |
9755 } | |
9756 } | |
9757 } | |
9758 // 5B65C4: using guessed type int dword_5B65C4; | |
9759 // 5B65CC: using guessed type int dword_5B65CC; |