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