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