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