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