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