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