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