Mercurial > mm7
annotate Player.cpp @ 671:2bb0e9da8302
Merge
author | Gloval |
---|---|
date | Fri, 15 Mar 2013 01:52:18 +0400 |
parents | 8c6c41037c39 |
children | 735dab8d3c9a 277c05c3a89f |
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; | |
607 | 1807 v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 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) -------------------------------------------------------- | |
607 | 1932 int Player::GetMeditation() |
0 | 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 | |
652 | 1968 |
1969 if (CheckHiredNPCSpeciality(Scholar)) | |
1970 return true; | |
0 | 1971 |
179 | 1972 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1973 v3 = v2; |
179 | 1974 if ( v2 & 1 ) |
0 | 1975 { |
1976 uSkillMultiplier = 5; | |
1977 } | |
1978 else | |
1979 { | |
1980 if ( (v2 & 0x80u) == 0 ) | |
1981 { | |
1982 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1983 v5 = uSkillMult * (v3 & 0x3F); |
1984 v6 = 0; | |
1985 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1986 |
179 | 1987 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1988 v6 = 1; | |
1989 if ( v5 >= (unsigned __int8)v7[46] ) | |
1990 v6 = 1; | |
1991 return v6; | |
0 | 1992 } |
1993 uSkillMultiplier = 3; | |
1994 } | |
1995 uSkillMult = uSkillMultiplier; | |
1996 v5 = uSkillMult * (v3 & 0x3F); | |
1997 v6 = 0; | |
1998 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1999 |
0 | 2000 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2001 v6 = 1; | |
2002 if ( v5 >= (unsigned __int8)v7[46] ) | |
2003 v6 = 1; | |
2004 return v6; | |
2005 } | |
2006 | |
2007 //----- (00491151) -------------------------------------------------------- | |
2008 int Player::CanRepair(ItemGen *a2) | |
2009 { | |
2010 unsigned __int16 v2; // ax@1 | |
2011 unsigned __int16 v3; // bx@1 | |
2012 int v4; // eax@3 | |
2013 int v5; // edi@7 | |
2014 signed int v6; // ebp@7 | |
2015 char v8; // al@10 | |
2016 signed int v10; // [sp-4h] [bp-14h]@2 | |
2017 | |
652 | 2018 |
2019 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2020 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2021 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2022 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2023 return true; | |
2024 | |
0 | 2025 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
2026 v3 = v2; | |
2027 if ( HIBYTE(v2) & 1 ) | |
2028 { | |
2029 v10 = 5; | |
2030 } | |
2031 else | |
2032 { | |
2033 if ( (v2 & 0x80u) == 0 ) | |
2034 { | |
2035 v4 = ((v2 & 0x40) != 0) + 1; | |
2036 goto LABEL_7; | |
2037 } | |
2038 v10 = 3; | |
2039 } | |
2040 v4 = v10; | |
2041 LABEL_7: | |
2042 v5 = v4 * (v3 & 0x3F); | |
2043 v6 = 0; | |
2044 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2045 return true; | |
2046 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2047 { | |
2048 __debugbreak(); // really odd | |
2049 return true; | |
2050 } | |
2051 return false; | |
2052 } | |
2053 | |
2054 //----- (004911F3) -------------------------------------------------------- | |
2055 int Player::GetMerchant() | |
2056 { | |
2057 Player *v1; // edi@1 | |
2058 unsigned __int16 v2; // ax@1 | |
2059 unsigned __int16 v3; // bx@1 | |
2060 int v4; // esi@1 | |
2061 int v5; // edi@1 | |
2062 int v7; // eax@3 | |
2063 int v8; // ecx@7 | |
2064 signed int v9; // [sp-4h] [bp-10h]@6 | |
2065 | |
2066 v1 = this; | |
607 | 2067 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 2068 v3 = v1->pActiveSkills[22]; |
607 | 2069 v4 = v2 & 0x003F; |
0 | 2070 v5 = v1->pActiveSkills[22] & 0x3F; |
2071 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2072 return 10000; | |
2073 v7 = GetPartyReputation(); | |
2074 if ( !v4 ) | |
2075 return -v7; | |
2076 if ( HIBYTE(v3) & 1 ) | |
2077 { | |
2078 v9 = 5; | |
2079 } | |
2080 else | |
2081 { | |
2082 if ( (v3 & 0x80u) == 0 ) | |
2083 { | |
2084 v8 = ((v3 & 0x40) != 0) + 1; | |
2085 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2086 } | |
2087 v9 = 3; | |
2088 } | |
2089 v8 = v9; | |
2090 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2091 } | |
2092 | |
2093 //----- (0049125A) -------------------------------------------------------- | |
2094 int Player::GetPerception() | |
2095 { | |
2096 Player *v1; // edi@1 | |
2097 unsigned __int16 v2; // ax@1 | |
2098 unsigned __int16 v3; // bx@1 | |
2099 int v4; // esi@1 | |
2100 int v5; // edi@1 | |
2101 int v7; // eax@5 | |
2102 signed int v8; // [sp-4h] [bp-10h]@4 | |
2103 | |
2104 v1 = this; | |
2105 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); | |
2106 v3 = v1->pActiveSkills[26]; | |
2107 v4 = v2 & 0x3F; | |
2108 v5 = v1->pActiveSkills[26] & 0x3F; | |
2109 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2110 return 10000; | |
2111 if ( HIBYTE(v3) & 1 ) | |
2112 { | |
2113 v8 = 5; | |
2114 } | |
2115 else | |
2116 { | |
2117 if ( (v3 & 0x80u) == 0 ) | |
2118 { | |
2119 v7 = ((v3 & 0x40) != 0) + 1; | |
2120 return v4 + v5 * (v7 - 1); | |
2121 } | |
2122 v8 = 3; | |
2123 } | |
2124 v7 = v8; | |
2125 return v4 + v5 * (v7 - 1); | |
2126 } | |
2127 | |
2128 //----- (004912B0) -------------------------------------------------------- | |
2129 int Player::GetDisarmTrap() | |
2130 { | |
2131 Player *v1; // ebp@1 | |
2132 unsigned __int16 v2; // ax@1 | |
2133 unsigned __int16 v3; // bx@1 | |
2134 int v4; // esi@1 | |
2135 int v5; // edi@1 | |
2136 int v7; // eax@7 | |
2137 signed int v8; // [sp-4h] [bp-14h]@6 | |
2138 | |
2139 v1 = this; | |
2140 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2141 v3 = v1->pActiveSkills[29]; | |
2142 v4 = v2 & 0x3F; | |
2143 v5 = v1->pActiveSkills[29] & 0x3F; | |
2144 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2145 return 10000; | |
2146 if ( HasEnchantedItemEquipped(35) ) | |
2147 v4 *= 2; | |
2148 if ( HIBYTE(v3) & 1 ) | |
2149 { | |
2150 v8 = 5; | |
2151 } | |
2152 else | |
2153 { | |
2154 if ( (v3 & 0x80u) == 0 ) | |
2155 { | |
2156 v7 = ((v3 & 0x40) != 0) + 1; | |
2157 return v4 + v5 * (v7 - 1); | |
2158 } | |
2159 v8 = 3; | |
2160 } | |
2161 v7 = v8; | |
2162 return v4 + v5 * (v7 - 1); | |
2163 } | |
2164 | |
2165 //----- (00491317) -------------------------------------------------------- | |
2166 char Player::GetLearningPercent() | |
2167 { | |
2168 Player *v1; // esi@1 | |
2169 int v2; // eax@1 | |
2170 unsigned __int16 v3; // bx@1 | |
2171 int v4; // ecx@1 | |
2172 int v5; // eax@4 | |
2173 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2174 | |
2175 v1 = this; | |
2176 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2177 v3 = v1->pActiveSkills[36]; | |
2178 v4 = v2 & 0x3F; | |
2179 if ( v2 ) | |
2180 { | |
2181 if ( HIBYTE(v3) & 1 ) | |
2182 { | |
2183 v7 = 5; | |
2184 } | |
2185 else | |
2186 { | |
2187 if ( (v3 & 0x80u) == 0 ) | |
2188 { | |
2189 v5 = ((v3 & 0x40) != 0) + 1; | |
2190 goto LABEL_8; | |
2191 } | |
2192 v7 = 3; | |
2193 } | |
2194 v5 = v7; | |
2195 LABEL_8: | |
2196 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2197 } | |
2198 return v2; | |
2199 } | |
2200 | |
2201 //----- (0048C6AF) -------------------------------------------------------- | |
2202 Player::Player() | |
2203 { | |
2204 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2205 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2206 for (uint i = 0; i < 126; ++i) | |
2207 pInventoryItems[i].Reset(); | |
2208 for (uint i = 0; i < 12; ++i) | |
2209 pEquippedItems[i].Reset(); | |
2210 | |
2211 | |
2212 for (uint i = 0; i < 24; ++i) | |
2213 { | |
2214 pPlayerBuffs[i].uSkill = 0; | |
2215 pPlayerBuffs[i].uSkill = 0; | |
2216 pPlayerBuffs[i].uPower = 0; | |
2217 pPlayerBuffs[i].uExpireTime = 0; | |
2218 pPlayerBuffs[i].uCaster = 0; | |
2219 pPlayerBuffs[i].uFlags = 0; | |
2220 } | |
2221 | |
2222 pName[0] = 0; | |
2223 uFace = 0; | |
2224 uVoiceID = 0; | |
2225 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2226 | |
2227 field_BB = 0; | |
2228 | |
2229 uMight = uMightBonus = 0; | |
2230 uIntelligence = uIntelligenceBonus = 0; | |
2231 uWillpower = uWillpowerBonus = 0; | |
2232 uEndurance = uEnduranceBonus = 0; | |
2233 uSpeed = uSpeedBonus = 0; | |
2234 uAccuracy = uAccuracyBonus = 0; | |
2235 uLuck = uLuckBonus = 0; | |
2236 uLevel = sLevelModifier = 0; | |
2237 sAgeModifier = 0; | |
2238 | |
2239 memset(field_1F5, 0, 30); | |
2240 | |
2241 sResFireBase = sResFireBonus = 0; | |
2242 sResAirBase = sResAirBonus = 0; | |
2243 sResWaterBase = sResWaterBonus = 0; | |
2244 sResEarthBase = sResEarthBonus = 0; | |
2245 sResMagicBase = sResMagicBonus = 0; | |
2246 sResSpiritBase = sResSpiritBonus = 0; | |
2247 sResMindBase = sResMindBonus = 0; | |
2248 sResBodyBase = sResBodyBonus = 0; | |
2249 sResLightBase = sResLightBonus = 0; | |
2250 sResDarkBase = sResDarkBonus = 0; | |
2251 | |
2252 uTimeToRecovery = 0; | |
2253 | |
2254 uSkillPoints = 0; | |
2255 | |
2256 sHealth = 0; | |
2257 uFullHealthBonus = 0; | |
2258 _health_related = 0; | |
2259 | |
2260 sMana = 0; | |
2261 uFullManaBonus = 0; | |
2262 _mana_related = 0; | |
2263 | |
2264 uQuickSpell = 0; | |
2265 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2266 | |
2267 _some_attack_bonus = 0; | |
2268 field_1A91 = 0; | |
2269 _melee_dmg_bonus = 0; | |
2270 field_1A93 = 0; | |
2271 _ranged_atk_bonus = 0; | |
2272 field_1A95 = 0; | |
2273 _ranged_dmg_bonus = 0; | |
2274 field_1A97 = 0; | |
2275 | |
130 | 2276 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2277 uExpressionTimePassed = 0; |
2278 uExpressionTimeLength = 0; | |
2279 | |
2280 uNumDivineInterventionCastsThisDay = 0; | |
2281 uNumArmageddonCasts = 0; | |
2282 uNumFireSpikeCasts = 0; | |
2283 | |
2284 memset(field_1988, 0, 49 * sizeof(int)); | |
2285 memset(field_1A50, 0, 64 * sizeof(char)); | |
2286 | |
2287 field_E0 = 0; | |
2288 field_E4 = 0; | |
2289 field_E8 = 0; | |
2290 field_EC = 0; | |
2291 field_F0 = 0; | |
2292 field_F4 = 0; | |
2293 field_F8 = 0; | |
2294 field_FC = 0; | |
2295 field_100 = 0; | |
2296 field_104 = 0; | |
198 | 2297 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2298 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2299 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2300 |
198 | 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; | |
652 | 2629 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2630 v8 = 5; |
652 | 2631 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2632 v8 += 20; |
652 | 2633 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 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) | |
667 | 3394 && *(int *)&this->pInventoryItems[*(&this->pEquipment.uOffHand + v3)-1] == a1 ) |
0 | 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 ) | |
570 | 3575 v27.uEnchantmentType = 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; | |
654 | 4013 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 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(); | |
652 | 4499 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 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 { | |
652 | 5653 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5654 v2 = 6; |
652 | 5655 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5656 v2 += 6; |
5657 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5658 v2 += GetItemsBonus(v8, 0); | |
5659 } | |
5660 break; | |
5661 | |
5662 case PLAYER_SKILL_ARMSMASTER: | |
5663 { | |
652 | 5664 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5665 v2 = 2; |
652 | 5666 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
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 { | |
652 | 5675 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 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 { | |
652 | 5685 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5686 v2 = 4; |
652 | 5687 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5688 v2 += 8; |
5689 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5690 v2 += GetItemsBonus(v8, 0); | |
5691 } | |
5692 break; | |
5693 | |
5694 case PLAYER_SKILL_LEARNING: | |
5695 { | |
652 | 5696 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5697 v2 = 10; |
652 | 5698 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5699 v2 += 15; |
652 | 5700 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5701 v2 += 5; |
5702 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5703 v2 += GetItemsBonus(v8, 0); | |
5704 } | |
5705 break; | |
5706 | |
5707 case PLAYER_SKILL_UNARMED: | |
5708 { | |
652 | 5709 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5710 v2 = 2; |
5711 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5712 v2 += GetItemsBonus(v8, 0); | |
5713 } | |
5714 break; | |
5715 | |
5716 case PLAYER_SKILL_DODGE: | |
5717 { | |
652 | 5718 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 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: | |
652 | 5735 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5736 v2 = 2; |
652 | 5737 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5738 v2 += 3; |
652 | 5739 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 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: | |
652 | 5747 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5748 v2 = 2; |
652 | 5749 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5750 v2 += 3; |
652 | 5751 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 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: | |
652 | 5759 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5760 v2 = 2; |
652 | 5761 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5762 v2 += 3; |
652 | 5763 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 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: | |
652 | 5771 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5772 v2 = 2; |
652 | 5773 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5774 v2 += 3; |
652 | 5775 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 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: | |
652 | 5783 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5784 v2 = 2; |
652 | 5785 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5786 v2 += 3; |
652 | 5787 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5788 v2 += 4; |
5789 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5790 v2 += GetItemsBonus(v8, 0); | |
5791 break; | |
5792 case PLAYER_SKILL_MIND: | |
652 | 5793 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5794 v2 = 2; |
652 | 5795 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5796 v2 += 3; |
652 | 5797 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5798 v2 += 4; |
5799 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5800 v2 += GetItemsBonus(v8, 0); | |
5801 break; | |
5802 case PLAYER_SKILL_BODY: | |
652 | 5803 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5804 v2 = 2; |
652 | 5805 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5806 v2 += 3; |
652 | 5807 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 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 { | |
652 | 5825 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5826 v2 = 4; |
652 | 5827 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5828 v2 += 6; |
652 | 5829 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5830 v2 += 3; |
652 | 5831 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5832 v2 += 8; |
5833 } | |
5834 break; | |
5835 | |
5836 case PLAYER_SKILL_PERCEPTION: | |
5837 { | |
652 | 5838 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5839 v2 = 6; |
652 | 5840 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 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 { |
652 | 5855 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5856 v2 = 4; |
652 | 5857 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5858 v2 += 6; |
652 | 5859 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 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]; |
607 | 5997 v61 = v2->GetMeditation(); |
0 | 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; | |
569 | 6497 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; |
6498 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6499 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6500 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6501 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; | |
6502 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6503 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6504 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6505 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6506 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6507 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6508 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6509 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6510 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6511 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6512 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6513 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6514 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6515 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6516 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6517 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
486 | 6518 break; |
198 | 6519 case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; break; |
6520 case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; break; | |
6521 case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; break; | |
6522 case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break; | |
6523 case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; break; | |
569 | 6524 case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; |
6525 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6526 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6527 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6528 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6529 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6530 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6531 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6532 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6533 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6534 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6535 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; | |
6536 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6537 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6538 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6539 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6540 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6541 break; | |
198 | 6542 case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; break; |
6543 case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; break; | |
0 | 6544 } |
6545 } | |
6546 | |
6547 sHealth = GetMaxHealth(); | |
6548 sMana = GetMaxMana(); | |
6549 } | |
6550 | |
6551 //----- (004903C9) -------------------------------------------------------- | |
6552 enum PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) | |
6553 { | |
6554 enum PLAYER_SKILL_TYPE result; // eax@5 | |
6555 int v3; // edx@5 | |
6556 char *v4; // ecx@5 | |
6557 int v5; // esi@11 | |
6558 unsigned __int16 *v6; // edx@11 | |
6559 int v7; // esi@18 | |
6560 unsigned __int16 *pActiveSkill; // edx@18 | |
6561 | |
6562 if ( order >= 0 ) | |
6563 { | |
6564 if ( order <= 1 ) | |
6565 { | |
6566 result = (PLAYER_SKILL_TYPE)0; | |
6567 v7 = 0; | |
6568 pActiveSkill = this->pActiveSkills; | |
6569 do | |
6570 { | |
135 | 6571 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6572 { |
6573 if ( v7 == order ) | |
6574 return result; | |
6575 ++v7; | |
6576 } | |
6577 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6578 ++pActiveSkill; | |
6579 } | |
6580 while ( (signed int)result < 37 ); | |
6581 } | |
6582 else | |
6583 { | |
6584 if ( order <= 3 ) | |
6585 { | |
6586 result = (PLAYER_SKILL_TYPE)0; | |
6587 v5 = 0; | |
6588 pActiveSkill = this->pActiveSkills; | |
6589 do | |
6590 { | |
135 | 6591 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6592 { |
6593 if ( v5 == order - 2 ) | |
6594 return result; | |
6595 ++v5; | |
6596 } | |
6597 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6598 ++pActiveSkill; | |
6599 } | |
6600 while ( (signed int)result < 37 ); | |
6601 } | |
6602 else | |
6603 { | |
6604 if ( order <= 12 ) | |
6605 { | |
6606 result = (PLAYER_SKILL_TYPE)0; | |
6607 v3 = 0; | |
135 | 6608 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6609 do |
6610 { | |
6611 if ( *v4 == 1 ) | |
6612 { | |
6613 if ( v3 == order - 4 ) | |
6614 return result; | |
6615 ++v3; | |
6616 } | |
6617 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6618 ++v4; | |
6619 } | |
6620 while ( (signed int)result < 37 ); | |
6621 } | |
6622 } | |
6623 } | |
6624 } | |
6625 return (PLAYER_SKILL_TYPE)37; | |
6626 } | |
6627 | |
6628 | |
6629 | |
6630 //----- (0049048D) -------------------------------------------------------- | |
6631 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6632 void Player::DecreaseAttribute(int eAttribute) | |
6633 { | |
6634 int v2; // eax@1 | |
6635 int pBaseValue; // ecx@1 | |
6636 int pDroppedStep; // ebx@1 | |
6637 int pStep; // esi@1 | |
6638 unsigned __int16 result; // ax@7 | |
6639 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6640 | |
6641 v2 = eAttribute + 7 * GetRace(); | |
290 | 6642 pBaseValue = StatTable[0][v2].uBaseValue; |
6643 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6644 uMinValue = pBaseValue - 2; |
290 | 6645 pStep = StatTable[0][v2].uBaseStep; |
0 | 6646 switch ( eAttribute ) |
6647 { | |
6648 case CHARACTER_MIGHT: | |
6649 if ( this->uMight <= pBaseValue ) | |
6650 pStep = pDroppedStep; | |
6651 if ( this->uMight - pStep >= uMinValue ) | |
6652 this->uMight -= pStep; | |
6653 break; | |
6654 case CHARACTER_INTELLIGANCE: | |
6655 if ( this->uIntelligence <= pBaseValue ) | |
6656 pStep = pDroppedStep; | |
6657 if ( this->uIntelligence - pStep >= uMinValue ) | |
6658 this->uIntelligence -= pStep; | |
6659 break; | |
6660 case CHARACTER_WILLPOWER: | |
6661 if ( this->uWillpower <= pBaseValue ) | |
6662 pStep = pDroppedStep; | |
6663 if ( this->uWillpower - pStep >= uMinValue ) | |
6664 this->uWillpower -= pStep; | |
6665 break; | |
6666 case CHARACTER_ENDURANCE: | |
6667 if ( this->uEndurance <= pBaseValue ) | |
6668 pStep = pDroppedStep; | |
6669 if ( this->uEndurance - pStep >= uMinValue ) | |
6670 this->uEndurance -= pStep; | |
6671 break; | |
6672 case CHARACTER_ACCURACY: | |
6673 if ( this->uAccuracy <= pBaseValue ) | |
6674 pStep = pDroppedStep; | |
6675 if ( this->uAccuracy - pStep >= uMinValue ) | |
6676 this->uAccuracy -= pStep; | |
6677 break; | |
6678 case CHARACTER_SPEED: | |
6679 if ( this->uSpeed <= pBaseValue ) | |
6680 pStep = pDroppedStep; | |
6681 if ( this->uSpeed - pStep >= uMinValue ) | |
6682 this->uSpeed -= pStep; | |
6683 break; | |
6684 case CHARACTER_LUCK: | |
6685 if ( this->uLuck <= pBaseValue ) | |
6686 pStep = pDroppedStep; | |
6687 if ( this->uLuck - pStep >= uMinValue ) | |
6688 this->uLuck -= pStep; | |
6689 break; | |
6690 } | |
6691 } | |
6692 | |
6693 //----- (004905F5) -------------------------------------------------------- | |
6694 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6695 int Player::IncreaseAttribute(int eAttribute) | |
6696 { | |
6697 Player *v2; // esi@1 | |
6698 int v3; // eax@1 | |
6699 int v4; // ebx@1 | |
6700 signed int v5; // edi@1 | |
6701 int v6; // eax@8 | |
6702 signed int v7; // eax@17 | |
6703 signed int result; // eax@18 | |
6704 int v9; // [sp+Ch] [bp-8h]@1 | |
6705 signed int v10; // [sp+10h] [bp-4h]@1 | |
6706 | |
6707 v2 = this; | |
6708 v3 = eAttribute + 7 * GetRace(); | |
290 | 6709 v4 = StatTable[0][v3].uMaxValue; |
6710 v5 = StatTable[0][v3].uBaseStep; | |
6711 v9 = StatTable[0][v3].uBaseValue; | |
6712 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6713 PlayerCreation_ComputeAttributeBonus(); |
6714 if ( eAttribute ) | |
6715 { | |
6716 switch ( eAttribute ) | |
6717 { | |
6718 case 1: | |
6719 v6 = v2->uIntelligence; | |
6720 break; | |
6721 case 2: | |
6722 v6 = v2->uWillpower; | |
6723 break; | |
6724 case 3: | |
6725 v6 = v2->uEndurance; | |
6726 break; | |
6727 case 4: | |
6728 v6 = v2->uAccuracy; | |
6729 break; | |
6730 case 5: | |
6731 v6 = v2->uSpeed; | |
6732 break; | |
6733 case 6: | |
6734 v6 = v2->uLuck; | |
6735 break; | |
6736 default: | |
6737 v6 = eAttribute; | |
6738 break; | |
6739 } | |
6740 } | |
6741 else | |
6742 { | |
6743 v6 = v2->uMight; | |
6744 } | |
6745 if ( v6 < v9 ) | |
6746 { | |
6747 v7 = v5; | |
6748 v5 = v10; | |
6749 v10 = v7; | |
6750 } | |
6751 result = PlayerCreation_ComputeAttributeBonus(); | |
6752 if ( result >= v10 ) | |
6753 { | |
6754 if ( eAttribute ) | |
6755 { | |
6756 switch ( eAttribute ) | |
6757 { | |
6758 case 1: | |
6759 result = (signed int)&v2->uIntelligence; | |
6760 break; | |
6761 case 2: | |
6762 result = (signed int)&v2->uWillpower; | |
6763 break; | |
6764 case 3: | |
6765 result = (signed int)&v2->uEndurance; | |
6766 break; | |
6767 case 4: | |
6768 result = (signed int)&v2->uAccuracy; | |
6769 break; | |
6770 case 5: | |
6771 result = (signed int)&v2->uSpeed; | |
6772 break; | |
6773 default: | |
6774 result = eAttribute - 6; | |
6775 if ( eAttribute != 6 ) | |
6776 return result; | |
6777 result = (signed int)&v2->uLuck; | |
6778 break; | |
6779 } | |
6780 } | |
6781 else | |
6782 { | |
6783 result = (signed int)&v2->uMight; | |
6784 } | |
6785 if ( v5 + *(short *)result <= v4 ) | |
6786 *(short *)result += v5; | |
6787 } | |
6788 return result; | |
6789 } | |
6790 | |
6791 //----- (0049070F) -------------------------------------------------------- | |
6792 void Player::Zero() | |
6793 { | |
6794 Player *v1; // esi@1 | |
6795 void *result; // eax@1 | |
6796 | |
6797 v1 = this; | |
6798 this->sLevelModifier = 0; | |
6799 this->sACModifier = 0; | |
6800 this->uLuckBonus = 0; | |
6801 this->uAccuracyBonus = 0; | |
6802 this->uSpeedBonus = 0; | |
6803 this->uEnduranceBonus = 0; | |
6804 this->uWillpowerBonus = 0; | |
6805 this->uIntelligenceBonus = 0; | |
6806 this->uMightBonus = 0; | |
6807 this->field_100 = 0; | |
6808 this->field_FC = 0; | |
6809 this->field_F8 = 0; | |
6810 this->field_F4 = 0; | |
6811 this->field_F0 = 0; | |
6812 this->field_EC = 0; | |
6813 this->field_E8 = 0; | |
6814 this->field_E4 = 0; | |
6815 this->field_E0 = 0; | |
6816 result = memset(&this->sResFireBonus, 0, 0x16u); | |
6817 v1->field_1A97 = 0; | |
6818 v1->_ranged_dmg_bonus = 0; | |
6819 v1->field_1A95 = 0; | |
6820 v1->_ranged_atk_bonus = 0; | |
6821 v1->field_1A93 = 0; | |
6822 v1->_melee_dmg_bonus = 0; | |
6823 v1->field_1A91 = 0; | |
6824 v1->_some_attack_bonus = 0; | |
6825 v1->_mana_related = 0; | |
6826 v1->uFullManaBonus = 0; | |
6827 v1->_health_related = 0; | |
6828 v1->uFullHealthBonus = 0; | |
6829 } | |
6830 | |
6831 //----- (004907E7) -------------------------------------------------------- | |
299 | 6832 unsigned int Player::GetStatColor(int uStat) |
0 | 6833 { |
6834 __int16 uWhite; // si@1 | |
290 | 6835 int attribute_value; // edx@1 |
299 | 6836 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6837 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6838 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6839 | |
6840 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6841 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6842 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
299 | 6843 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6844 |
0 | 6845 switch (uStat) |
6846 { | |
6847 case 0: attribute_value = uMight; break; | |
6848 case 1: attribute_value = uIntelligence; break; | |
6849 case 2: attribute_value = uWillpower; break; | |
6850 case 3: attribute_value = uEndurance; break; | |
290 | 6851 case 4: attribute_value = uAccuracy; break; |
6852 case 5: attribute_value = uSpeed; break; | |
0 | 6853 case 6: attribute_value = uLuck; break; |
6854 }; | |
6855 | |
299 | 6856 if ( attribute_value == pBaseAttrValue ) |
290 | 6857 return uWhite; |
299 | 6858 else if ( attribute_value > pBaseAttrValue ) |
290 | 6859 return uGreen; |
0 | 6860 else |
290 | 6861 return uRed; |
0 | 6862 } |
6863 | |
6864 //----- (004908A8) -------------------------------------------------------- | |
6865 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6866 { | |
6867 unsigned __int64 *result; // eax@1 | |
6868 | |
6869 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6870 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6871 { | |
6872 *(int *)result = 0; | |
6873 *((int *)result + 1) = 0; | |
6874 LOBYTE(result) = 1; | |
6875 } | |
6876 else | |
6877 { | |
6878 LOBYTE(result) = 0; | |
6879 } | |
6880 return (bool)result; | |
6881 } | |
6882 | |
6883 //----- (004680ED) -------------------------------------------------------- | |
6884 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6885 { | |
6886 Player *v3; // esi@1 | |
6887 unsigned int v4; // ebx@4 | |
6888 signed int v5; // eax@17 | |
6889 unsigned int v6; // eax@26 | |
6890 unsigned __int8 v7; // cf@37 | |
6891 int v8; // edx@39 | |
6892 int v9; // edx@40 | |
6893 int v10; // edx@41 | |
6894 int v11; // edx@42 | |
6895 int v12; // edx@43 | |
6896 char *v13; // eax@45 | |
6897 AudioPlayer *v14; // ecx@62 | |
6898 signed int v15; // edi@68 | |
6899 int v16; // edx@73 | |
6900 unsigned __int16 *v17; // edi@73 | |
6901 unsigned int v18; // eax@73 | |
6902 int v19; // eax@74 | |
6903 int v20; // eax@75 | |
6904 signed int v21; // eax@81 | |
6905 const char *v22; // eax@84 | |
6906 char *v23; // ecx@90 | |
6907 int v24; // esi@96 | |
6908 int v25; // eax@109 | |
6909 int v26; // eax@113 | |
6910 char *v27; // edi@114 | |
6911 signed __int64 v28; // qax@120 | |
6912 char *v29; // ecx@120 | |
6913 int v30; // edi@137 | |
6914 int v31; // ST30_4@137 | |
6915 int v32; // ST3C_4@137 | |
6916 int v33; // ST40_4@137 | |
6917 int v34; // ST34_4@137 | |
6918 int v35; // ST38_4@137 | |
6919 unsigned __int8 v36; // al@173 | |
6920 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6921 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6922 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6923 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6924 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6925 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6926 signed int v43; // [sp-14h] [bp-40h]@18 | |
6927 signed int v44; // [sp-14h] [bp-40h]@174 | |
6928 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6929 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6930 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6931 int v48; // [sp-Ch] [bp-38h]@18 | |
6932 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6933 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6934 int v51; // [sp-Ch] [bp-38h]@174 | |
6935 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6936 char *v53; // [sp-8h] [bp-34h]@33 | |
6937 int v54; // [sp-8h] [bp-34h]@34 | |
6938 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6939 int v56; // [sp-8h] [bp-34h]@66 | |
6940 const char *v57; // [sp-8h] [bp-34h]@69 | |
6941 const char *v58; // [sp-8h] [bp-34h]@89 | |
6942 int v59; // [sp-8h] [bp-34h]@120 | |
6943 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6944 int v61; // [sp-4h] [bp-30h]@18 | |
6945 char *v62; // [sp-4h] [bp-30h]@33 | |
6946 char *v63; // [sp-4h] [bp-30h]@34 | |
6947 int v64; // [sp-4h] [bp-30h]@60 | |
6948 int v65; // [sp-4h] [bp-30h]@66 | |
6949 const char *v66; // [sp-4h] [bp-30h]@69 | |
6950 signed int v67; // [sp-4h] [bp-30h]@77 | |
6951 const char *v68; // [sp-4h] [bp-30h]@89 | |
6952 int v69; // [sp-4h] [bp-30h]@110 | |
6953 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6954 int v71; // [sp-4h] [bp-30h]@174 | |
6955 char *v72; // [sp+20h] [bp-Ch]@68 | |
6956 signed int v73; // [sp+24h] [bp-8h]@1 | |
6957 char *v74; // [sp+24h] [bp-8h]@23 | |
6958 int v75; // [sp+24h] [bp-8h]@73 | |
6959 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6960 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6961 | |
6962 thisb = this; | |
243 | 6963 v3 = &pParty->pPlayers[a2-1]; |
0 | 6964 v73 = 1; |
6965 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6966 return; | |
6967 v4 = 0; | |
6968 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6969 { | |
6970 if ( pParty->pPickedItem.uItemID != 160 ) | |
6971 { | |
6972 if ( pParty->pPickedItem.uItemID == 161 ) | |
6973 { | |
6974 v27 = (char *)&v3->sMana; | |
6975 *(int *)v27 += 2; | |
6976 LABEL_170: | |
6977 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6978 *(int *)v27 = v3->GetMaxMana(); | |
6979 } | |
6980 else | |
6981 { | |
6982 if ( pParty->pPickedItem.uItemID != 162 ) | |
6983 { | |
6984 LABEL_167: | |
6985 v68 = pParty->pPickedItem.GetDisplayName(); | |
6986 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6987 goto LABEL_90; | |
6988 } | |
6989 v69 = 2; | |
6990 LABEL_111: | |
243 | 6991 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6992 } |
6993 LABEL_112: | |
187 | 6994 v3->PlaySound(SPEECH_36, 0); |
0 | 6995 goto LABEL_173; |
6996 } | |
6997 LABEL_172: | |
100 | 6998 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6999 goto LABEL_173; |
7000 } | |
7001 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
7002 { | |
7003 switch ( pParty->pPickedItem.uItemID ) | |
7004 { | |
7005 case 0xDEu: | |
570 | 7006 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7007 goto LABEL_110; |
7008 case 0xDFu: | |
570 | 7009 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7010 goto LABEL_114; |
7011 case 0xE0u: | |
7012 LODWORD(v3->pConditions[1]) = 0; | |
7013 HIDWORD(v3->pConditions[1]) = 0; | |
7014 goto LABEL_112; | |
7015 case 0xE1u: | |
7016 LODWORD(v3->pConditions[11]) = 0; | |
7017 HIDWORD(v3->pConditions[11]) = 0; | |
7018 LODWORD(v3->pConditions[9]) = 0; | |
7019 HIDWORD(v3->pConditions[9]) = 0; | |
7020 LODWORD(v3->pConditions[7]) = 0; | |
7021 HIDWORD(v3->pConditions[7]) = 0; | |
7022 goto LABEL_112; | |
7023 case 0xE2u: | |
7024 LODWORD(v3->pConditions[10]) = 0; | |
7025 HIDWORD(v3->pConditions[10]) = 0; | |
7026 LODWORD(v3->pConditions[8]) = 0; | |
7027 HIDWORD(v3->pConditions[8]) = 0; | |
7028 LODWORD(v3->pConditions[6]) = 0; | |
7029 HIDWORD(v3->pConditions[6]) = 0; | |
7030 goto LABEL_112; | |
7031 case 0xE3u: | |
7032 LODWORD(v3->pConditions[2]) = 0; | |
7033 HIDWORD(v3->pConditions[2]) = 0; | |
7034 goto LABEL_112; | |
7035 case 0xE4u: | |
7036 if ( v3->pConditions[1] ) | |
7037 goto LABEL_173; | |
7038 v70 = 0; | |
7039 v59 = 0; | |
7040 v50 = 5; | |
7041 v46 = 3; | |
570 | 7042 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7043 v29 = (char *)&v3->pPlayerBuffs[7]; |
7044 goto LABEL_147; | |
7045 case 0xE5u: | |
7046 v70 = 0; | |
7047 v59 = 0; | |
7048 v50 = 5; | |
7049 v46 = 3; | |
570 | 7050 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7051 v29 = (char *)&v3->pPlayerBuffs[8]; |
7052 goto LABEL_147; | |
7053 case 0xE6u: | |
7054 v70 = 0; | |
7055 v59 = 0; | |
7056 v50 = 5; | |
7057 v46 = 3; | |
570 | 7058 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7059 v29 = (char *)&v3->pPlayerBuffs[1]; |
7060 goto LABEL_147; | |
7061 case 0xE7u: | |
7062 v70 = 0; | |
7063 v59 = 0; | |
570 | 7064 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7065 v46 = 0; |
570 | 7066 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7067 v29 = (char *)&v3->pPlayerBuffs[11]; |
7068 goto LABEL_147; | |
7069 case 0xE8u: | |
7070 v70 = 0; | |
7071 v59 = 0; | |
570 | 7072 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7073 v46 = 0; |
570 | 7074 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7075 v29 = (char *)&v3->pPlayerBuffs[13]; |
7076 goto LABEL_147; | |
7077 case 0xEAu: | |
7078 v70 = 0; | |
7079 v59 = 0; | |
7080 v50 = 5; | |
7081 v46 = 3; | |
570 | 7082 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7083 v29 = (char *)&v3->pPlayerBuffs[14]; |
7084 goto LABEL_147; | |
7085 case 0xEBu: | |
7086 v3->pPlayerBuffs[23].Apply( | |
570 | 7087 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7088 3u, |
7089 5u, | |
7090 0, | |
7091 0); | |
7092 goto LABEL_173; | |
7093 case 0xEDu: | |
7094 LODWORD(v3->pConditions[3]) = 0; | |
7095 HIDWORD(v3->pConditions[3]) = 0; | |
7096 goto LABEL_112; | |
7097 case 0xEEu: | |
7098 LODWORD(v3->pConditions[0]) = 0; | |
7099 HIDWORD(v3->pConditions[0]) = 0; | |
7100 goto LABEL_112; | |
7101 case 0xEFu: | |
7102 LODWORD(v3->pConditions[5]) = 0; | |
7103 HIDWORD(v3->pConditions[5]) = 0; | |
7104 goto LABEL_112; | |
7105 case 0xF0u: | |
7106 v70 = 0; | |
7107 v59 = 0; | |
570 | 7108 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7109 v46 = 0; |
570 | 7110 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7111 v29 = (char *)&v3->pPlayerBuffs[19]; |
7112 goto LABEL_147; | |
7113 case 0xF1u: | |
7114 v70 = 0; | |
7115 v59 = 0; | |
570 | 7116 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7117 v46 = 0; |
570 | 7118 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7119 v29 = (char *)&v3->pPlayerBuffs[17]; |
7120 goto LABEL_147; | |
7121 case 0xF2u: | |
7122 v70 = 0; | |
7123 v59 = 0; | |
570 | 7124 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7125 v46 = 0; |
570 | 7126 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7127 v29 = (char *)&v3->pPlayerBuffs[20]; |
7128 goto LABEL_147; | |
7129 case 0xF3u: | |
7130 v70 = 0; | |
7131 v59 = 0; | |
570 | 7132 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7133 v46 = 0; |
570 | 7134 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7135 v29 = (char *)&v3->pPlayerBuffs[16]; |
7136 goto LABEL_147; | |
7137 case 0xF4u: | |
7138 v70 = 0; | |
7139 v59 = 0; | |
570 | 7140 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7141 v46 = 0; |
570 | 7142 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7143 v29 = (char *)&v3->pPlayerBuffs[21]; |
7144 goto LABEL_147; | |
7145 case 0xF5u: | |
7146 v70 = 0; | |
7147 v59 = 0; | |
570 | 7148 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7149 v46 = 0; |
570 | 7150 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7151 v29 = (char *)&v3->pPlayerBuffs[15]; |
7152 goto LABEL_147; | |
7153 case 0xFBu: | |
7154 LODWORD(v3->pConditions[12]) = 0; | |
7155 HIDWORD(v3->pConditions[12]) = 0; | |
7156 goto LABEL_112; | |
7157 case 0xFCu: | |
7158 v30 = LODWORD(v3->pConditions[14]); | |
7159 v31 = HIDWORD(v3->pConditions[14]); | |
7160 v32 = LODWORD(v3->pConditions[15]); | |
7161 v33 = HIDWORD(v3->pConditions[15]); | |
7162 v34 = LODWORD(v3->pConditions[16]); | |
7163 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7164 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7165 HIDWORD(v3->pConditions[14]) = v31; |
7166 LODWORD(v3->pConditions[15]) = v32; | |
7167 HIDWORD(v3->pConditions[15]) = v33; | |
7168 LODWORD(v3->pConditions[16]) = v34; | |
7169 LODWORD(v3->pConditions[14]) = v30; | |
7170 HIDWORD(v3->pConditions[16]) = v35; | |
7171 goto LABEL_112; | |
7172 case 0xFDu: | |
570 | 7173 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7174 LABEL_110: |
7175 v69 = v25; | |
7176 goto LABEL_111; | |
7177 case 0xFEu: | |
570 | 7178 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7179 LABEL_114: |
7180 v27 = (char *)&v3->sMana; | |
7181 *(int *)v27 += v26; | |
7182 goto LABEL_170; | |
7183 case 0xFFu: | |
7184 v70 = 0; | |
7185 v59 = 0; | |
570 | 7186 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7187 v46 = 0; |
570 | 7188 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7189 v29 = (char *)&v3->pPlayerBuffs[18]; |
7190 goto LABEL_147; | |
7191 case 0x100u: | |
7192 v70 = 0; | |
7193 v59 = 0; | |
570 | 7194 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7195 v46 = 0; |
570 | 7196 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7197 v29 = (char *)&v3->pPlayerBuffs[5]; |
7198 goto LABEL_147; | |
7199 case 0x101u: | |
7200 v70 = 0; | |
7201 v59 = 0; | |
570 | 7202 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7203 v46 = 0; |
570 | 7204 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7205 v29 = (char *)v3->pPlayerBuffs; |
7206 goto LABEL_147; | |
7207 case 0x102u: | |
7208 v70 = 0; | |
7209 v59 = 0; | |
570 | 7210 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7211 v46 = 0; |
570 | 7212 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7213 v29 = (char *)&v3->pPlayerBuffs[22]; |
7214 goto LABEL_147; | |
7215 case 0x103u: | |
7216 v70 = 0; | |
7217 v59 = 0; | |
570 | 7218 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7219 v46 = 0; |
570 | 7220 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7221 v29 = (char *)&v3->pPlayerBuffs[3]; |
7222 goto LABEL_147; | |
7223 case 0x104u: | |
7224 v70 = 0; | |
7225 v59 = 0; | |
570 | 7226 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7227 v46 = 0; |
570 | 7228 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7229 v29 = (char *)&v3->pPlayerBuffs[9]; |
7230 goto LABEL_147; | |
7231 case 0x105u: | |
7232 v70 = 0; | |
7233 v59 = 0; | |
570 | 7234 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7235 v46 = 0; |
570 | 7236 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7237 v29 = (char *)&v3->pPlayerBuffs[2]; |
7238 LABEL_147: | |
7239 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7240 goto LABEL_112; | |
7241 case 0x106u: | |
7242 LODWORD(v3->pConditions[15]) = 0; | |
7243 HIDWORD(v3->pConditions[15]) = 0; | |
7244 goto LABEL_112; | |
7245 case 0x108u: | |
7246 if ( !*(int *)&v3->field_1F5[3] ) | |
7247 { | |
7248 v3->uLuck += 50; | |
7249 *(int *)&v3->field_1F5[3] = 1; | |
7250 } | |
7251 goto LABEL_112; | |
7252 case 0x109u: | |
7253 if ( !*(int *)&v3->field_1F5[7] ) | |
7254 { | |
7255 v3->uSpeed += 50; | |
7256 *(int *)&v3->field_1F5[7] = 1; | |
7257 } | |
7258 goto LABEL_112; | |
7259 case 0x10Au: | |
7260 if ( !*(int *)&v3->field_1F5[11] ) | |
7261 { | |
7262 v3->uIntelligence += 50; | |
7263 *(int *)&v3->field_1F5[11] = 1; | |
7264 } | |
7265 goto LABEL_112; | |
7266 case 0x10Bu: | |
7267 if ( !*(int *)&v3->field_1F5[15] ) | |
7268 { | |
7269 v3->uEndurance += 50; | |
7270 *(int *)&v3->field_1F5[15] = 1; | |
7271 } | |
7272 goto LABEL_112; | |
7273 case 0x10Cu: | |
7274 if ( !*(int *)&v3->field_1F5[19] ) | |
7275 { | |
7276 v3->uWillpower += 50; | |
7277 *(int *)&v3->field_1F5[19] = 1; | |
7278 } | |
7279 goto LABEL_112; | |
7280 case 0x10Du: | |
7281 if ( !*(int *)&v3->field_1F5[23] ) | |
7282 { | |
7283 v3->uAccuracy += 50; | |
7284 *(int *)&v3->field_1F5[23] = 1; | |
7285 } | |
7286 goto LABEL_112; | |
7287 case 0x10Eu: | |
7288 if ( !*(int *)&v3->field_1F5[27] ) | |
7289 { | |
7290 v3->uMight += 50; | |
7291 *(int *)&v3->field_1F5[27] = 1; | |
7292 } | |
7293 goto LABEL_112; | |
7294 case 0x10Fu: | |
7295 v3->sAgeModifier = 0; | |
7296 goto LABEL_112; | |
7297 default: | |
7298 goto LABEL_167; | |
7299 case 0xDDu: | |
7300 goto LABEL_172; | |
7301 } | |
7302 goto LABEL_172; | |
7303 } | |
7304 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7305 { | |
7306 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7307 { | |
7308 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7309 { | |
7310 if ( pParty->pPickedItem.uItemID == 616 ) | |
7311 { | |
7312 thisa = pParty->uCurrentMonthWeek + 1; | |
7313 if ( pParty->uCurrentMonth >= 7 ) | |
7314 v74 = 0; | |
7315 else | |
7316 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7317 switch ( pParty->uCurrentMonth ) | |
7318 { | |
7319 case 0u: | |
7320 v6 = pParty->uCurrentMonthWeek + 1; | |
7321 v3->uMight += thisa; | |
7322 goto LABEL_33; | |
7323 case 1u: | |
7324 v6 = pParty->uCurrentMonthWeek + 1; | |
7325 v3->uIntelligence += thisa; | |
7326 goto LABEL_33; | |
7327 case 2u: | |
7328 v6 = pParty->uCurrentMonthWeek + 1; | |
7329 v3->uWillpower += thisa; | |
7330 goto LABEL_33; | |
7331 case 3u: | |
7332 v6 = pParty->uCurrentMonthWeek + 1; | |
7333 v3->uEndurance += thisa; | |
7334 goto LABEL_33; | |
7335 case 4u: | |
7336 v6 = pParty->uCurrentMonthWeek + 1; | |
7337 v3->uAccuracy += thisa; | |
7338 goto LABEL_33; | |
7339 case 5u: | |
7340 v6 = pParty->uCurrentMonthWeek + 1; | |
7341 v3->uSpeed += thisa; | |
7342 goto LABEL_33; | |
7343 case 6u: | |
7344 v6 = pParty->uCurrentMonthWeek + 1; | |
7345 v3->uLuck += thisa; | |
7346 LABEL_33: | |
7347 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7348 v53 = v74; | |
7349 v49 = v6; | |
7350 goto LABEL_53; | |
7351 case 7u: | |
7352 party_finds_gold(1000 * thisa, 0); | |
7353 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7354 v54 = 1000 * thisa; | |
7355 goto LABEL_38; | |
7356 case 8u: | |
7357 Party::GiveFood(5 * thisa); | |
7358 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7359 v54 = 5 * thisa; | |
7360 goto LABEL_38; | |
7361 case 9u: | |
7362 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7363 v3->uSkillPoints += 2 * thisa; | |
7364 v54 = 2 * thisa; | |
7365 goto LABEL_38; | |
7366 case 0xAu: | |
7367 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7368 v54 = 2500 * thisa; | |
7369 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7370 LODWORD(v3->uExperience) += 2500 * thisa; | |
7371 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7372 LABEL_38: | |
7373 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7374 goto LABEL_54; | |
7375 case 0xBu: | |
7376 v8 = rand() % 6; | |
7377 if ( v8 ) | |
7378 { | |
7379 v9 = v8 - 1; | |
7380 if ( v9 ) | |
7381 { | |
7382 v10 = v9 - 1; | |
7383 if ( v10 ) | |
7384 { | |
7385 v11 = v10 - 1; | |
7386 if ( v11 ) | |
7387 { | |
7388 v12 = v11 - 1; | |
7389 if ( v12 ) | |
7390 { | |
7391 if ( v12 != 1 ) | |
7392 goto LABEL_52; | |
7393 v3->sResBodyBase += thisa; | |
7394 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7395 } | |
7396 else | |
7397 { | |
7398 v3->sResMindBase += thisa; | |
7399 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7400 } | |
7401 } | |
7402 else | |
7403 { | |
7404 v3->sResEarthBase += thisa; | |
7405 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7406 } | |
7407 } | |
7408 else | |
7409 { | |
7410 v3->sResWaterBase += thisa; | |
7411 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7412 } | |
7413 } | |
7414 else | |
7415 { | |
7416 v3->sResAirBase += thisa; | |
7417 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7418 } | |
7419 } | |
7420 else | |
7421 { | |
7422 v3->sResFireBase += thisa; | |
7423 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7424 } | |
7425 v74 = v13; | |
7426 LABEL_52: | |
7427 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7428 v53 = v74; | |
7429 v49 = thisa; | |
7430 LABEL_53: | |
7431 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7432 LABEL_54: | |
7433 ShowStatusBarString(pTmpBuf, 2u); | |
7434 pMouse->RemoveHoldingItem(); | |
7435 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7436 v3->PlaySound(SPEECH_93, 0); |
0 | 7437 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7438 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7439 { | |
7440 v64 = 0; | |
7441 v55 = 16; | |
7442 } | |
7443 else | |
7444 { | |
7445 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7446 { | |
7447 v64 = 0; | |
7448 v55 = 14; | |
7449 } | |
7450 else | |
7451 { | |
7452 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7453 return; | |
7454 v64 = 0; | |
7455 v55 = 15; | |
7456 } | |
7457 } | |
7458 v3->SetCondition(v55, v64); | |
7459 v61 = 0; | |
7460 v52 = 0; | |
7461 v48 = 0; | |
7462 v45 = 0; | |
7463 v43 = -1; | |
7464 v41 = 0; | |
7465 v39 = 0; | |
7466 v37 = (SoundID)215; | |
7467 v14 = pAudioPlayer; | |
7468 goto LABEL_63; | |
7469 default: | |
7470 goto LABEL_54; | |
7471 } | |
7472 } | |
7473 if ( pParty->pPickedItem.uItemID == 630 ) | |
7474 { | |
7475 Party::GiveFood(1u); | |
7476 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7477 } | |
7478 else | |
7479 { | |
7480 if ( pParty->pPickedItem.uItemID == 632 ) | |
7481 { | |
7482 v61 = 0; | |
7483 v52 = 0; | |
7484 v48 = 0; | |
7485 v45 = 0; | |
7486 v43 = -1; | |
7487 v41 = 0; | |
7488 v39 = 0; | |
7489 v37 = (SoundID)133; | |
7490 goto LABEL_93; | |
7491 } | |
7492 if ( pParty->pPickedItem.uItemID == 633 ) | |
7493 { | |
7494 v61 = 0; | |
7495 v52 = 0; | |
7496 v48 = 0; | |
7497 v45 = 0; | |
7498 v43 = -1; | |
7499 v41 = 0; | |
7500 v39 = 0; | |
7501 v37 = (SoundID)134; | |
7502 goto LABEL_93; | |
7503 } | |
7504 if ( pParty->pPickedItem.uItemID == 634 ) | |
7505 { | |
7506 v61 = 0; | |
7507 v52 = 0; | |
7508 v48 = 0; | |
7509 v45 = 0; | |
7510 v43 = -1; | |
7511 v41 = 0; | |
7512 v39 = 0; | |
7513 v37 = (SoundID)135; | |
7514 goto LABEL_93; | |
7515 } | |
7516 if ( pParty->pPickedItem.uItemID != 646 ) | |
7517 { | |
7518 if ( pParty->pPickedItem.uItemID == 650 ) | |
7519 { | |
7520 sub_44C28F_open_nwc_dungeon(); | |
7521 return; | |
7522 } | |
7523 goto LABEL_167; | |
7524 } | |
7525 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7526 v5 = 8 * a2 + 392; | |
7527 LOBYTE(v5) = (8 * a2 - 120) | 4; | |
7528 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); | |
7529 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7530 } | |
7531 LABEL_187: | |
7532 pMouse->RemoveHoldingItem(); | |
7533 return; | |
7534 } | |
243 | 7535 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7536 { |
7537 sub_467F48(pParty->pPickedItem.uItemID); | |
7538 v65 = 0; | |
187 | 7539 v56 = SPEECH_37; |
0 | 7540 LABEL_67: |
187 | 7541 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7542 return; |
7543 } | |
7544 LABEL_89: | |
7545 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7546 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7547 LABEL_90: | |
7548 sprintf(pTmpBuf, v58, v68); | |
7549 v23 = pTmpBuf; | |
7550 LABEL_91: | |
7551 ShowStatusBarString(v23, 2u); | |
7552 v4 = 0; | |
7553 goto LABEL_92; | |
7554 } | |
7555 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7556 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7557 if ( *v72 ) |
7558 { | |
7559 v66 = pParty->pPickedItem.GetDisplayName(); | |
7560 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7561 LABEL_72: | |
7562 sprintf(pTmpBuf, v57, v66); | |
7563 ShowStatusBarString(pTmpBuf, 2u); | |
7564 LABEL_92: | |
7565 v61 = v4; | |
7566 v52 = v4; | |
7567 v48 = v4; | |
7568 v45 = v4; | |
7569 v43 = -1; | |
7570 v41 = v4; | |
7571 v39 = v4; | |
7572 v37 = (SoundID)27; | |
7573 LABEL_93: | |
7574 v14 = pAudioPlayer; | |
7575 LABEL_63: | |
7576 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7577 return; | |
7578 } | |
243 | 7579 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7580 { |
7581 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7582 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7583 goto LABEL_72; | |
7584 } | |
7585 v16 = v15 % 11 + 1; | |
7586 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7587 v75 = v16; | |
7588 v18 = SkillToMastery(*v17) - 1; | |
7589 if ( v18 ) | |
7590 { | |
7591 v19 = v18 - 1; | |
7592 if ( v19 ) | |
7593 { | |
7594 v20 = v19 - 1; | |
7595 if ( v20 ) | |
7596 { | |
7597 if ( v20 != 1 ) | |
7598 { | |
7599 v21 = a2; | |
7600 LABEL_83: | |
7601 if ( v75 > v21 || !*v17 ) | |
7602 { | |
7603 v22 = pParty->pPickedItem.GetDisplayName(); | |
7604 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); | |
7605 ShowStatusBarString(pTmpBuf, 2u); | |
7606 v65 = 0; | |
7607 v56 = 20; | |
7608 goto LABEL_67; | |
7609 } | |
7610 *v72 = 1; | |
187 | 7611 v3->PlaySound(SPEECH_21, 0); |
0 | 7612 v73 = 0; |
7613 LABEL_173: | |
7614 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7615 if ( v36 == 14 ) | |
7616 { | |
7617 v71 = 0; | |
7618 v60 = 0; | |
7619 v51 = 0; | |
7620 v47 = 0; | |
7621 v44 = -1; | |
7622 v42 = 0; | |
7623 v40 = 0; | |
7624 v38 = (SoundID)210; | |
7625 } | |
7626 else | |
7627 { | |
7628 if ( v36 != 13 ) | |
7629 { | |
7630 LABEL_178: | |
7631 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7632 { | |
7633 if ( !v73 ) | |
7634 goto LABEL_187; | |
437 | 7635 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7636 { |
7637 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7638 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7639 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7640 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7641 }*/ |
7642 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7643 } |
7644 if ( v73 ) | |
7645 { | |
7646 if ( pParty->bTurnBasedModeOn ) | |
7647 { | |
7648 *(&pParty->field_16140 + a2) = 100; | |
7649 thisb->SetRecoveryTime(100); | |
7650 pTurnEngine->_40471C(); | |
7651 } | |
7652 else | |
7653 { | |
7654 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7655 } | |
7656 } | |
7657 goto LABEL_187; | |
7658 } | |
7659 v71 = 0; | |
7660 v60 = 0; | |
7661 v51 = 0; | |
7662 v47 = 0; | |
7663 v44 = -1; | |
7664 v42 = 0; | |
7665 v40 = 0; | |
7666 v38 = (SoundID)211; | |
7667 } | |
7668 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7669 goto LABEL_178; | |
7670 } | |
7671 v67 = 11; | |
7672 } | |
7673 else | |
7674 { | |
7675 v67 = 10; | |
7676 } | |
7677 } | |
7678 else | |
7679 { | |
7680 v67 = 7; | |
7681 } | |
7682 } | |
7683 else | |
7684 { | |
7685 v67 = 4; | |
7686 } | |
7687 v21 = v67; | |
7688 goto LABEL_83; | |
7689 } | |
151 | 7690 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7691 return; |
243 | 7692 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7693 goto LABEL_89; |
7694 if ( bUnderwater == 1 ) | |
7695 { | |
7696 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7697 goto LABEL_91; | |
7698 } | |
7699 dword_50C9AC = 1; | |
7700 v24 = pParty->pPickedItem.uItemID - 299; | |
7701 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7702 { | |
7703 pMouse->RemoveHoldingItem(); | |
7704 pGUIWindow_CurrentMenu->Release(); | |
7705 pIcons_LOD->_4114F2(); | |
151 | 7706 pCurrentScreen = SCREEN_GAME; |
0 | 7707 viewparams->bRedrawGameUI = 1; |
7708 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7709 } | |
7710 else | |
7711 { | |
7712 _720984_unused = pParty->pPickedItem.uItemID; | |
7713 pMouse->RemoveHoldingItem(); | |
7714 if ( dword_50C9E8 < 40 ) | |
7715 { | |
7716 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7717 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7718 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7719 ++dword_50C9E8; |
7720 } | |
7721 if ( pCurrentScreen | |
7722 && pGUIWindow_CurrentMenu | |
437 | 7723 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7724 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7725 { | |
7726 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
0 | 7727 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7728 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7729 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7730 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7731 } | |
7732 } | |
7733 } | |
0 | 7734 |
7735 | |
7736 | |
7737 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7738 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7739 { | |
0 | 7740 Player *v3; // esi@1 |
7741 signed int v4; // edi@1 | |
7742 unsigned int v5; // eax@8 | |
7743 int v6; // eax@9 | |
7744 enum CHARACTER_RACE v7; // eax@11 | |
7745 signed int v8; // eax@17 | |
7746 unsigned __int8 v9; // sf@17 | |
7747 unsigned __int8 v10; // of@17 | |
7748 int v11; // eax@19 | |
7749 unsigned int v12; // eax@20 | |
484 | 7750 unsigned int test_bit_value; // eax@25 |
7751 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7752 signed int v15; // ecx@28 |
7753 ItemGen *v16; // eax@28 | |
7754 char v17; // zf@31 | |
7755 int v18; // edi@90 | |
7756 DDM_DLV_Header *v19; // eax@122 | |
7757 char v20; // cl@124 | |
7758 DDM_DLV_Header *v21; // eax@126 | |
7759 unsigned int v22; // edi@129 | |
100 | 7760 Player *v23; // esi@134 |
0 | 7761 ItemGen *v24; // ecx@135 |
7762 signed int v25; // edx@135 | |
7763 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7764 char *v27; // edi@155 | |
7765 int v28; // ebx@161 | |
7766 int v29; // eax@161 | |
7767 | |
469 | 7768 v6 = 0; |
0 | 7769 v3 = this; |
7770 v4 = -1; | |
469 | 7771 if ( VarNum > VAR_AutoNotes ) |
7772 { | |
7773 switch ( VarNum ) | |
0 | 7774 { |
7775 case VAR_Invisible: | |
484 | 7776 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7777 return true; |
484 | 7778 return false; |
0 | 7779 case VAR_NumDeaths: |
7780 v4 = pParty->uNumDeaths; | |
469 | 7781 return v4 >= pValue; |
0 | 7782 case VAR_NumBounties: |
7783 v4 = pParty->uNumBountiesCollected; | |
469 | 7784 return v4 >= pValue; |
0 | 7785 case VAR_PrisonTerms: |
7786 v4 = pParty->uNumPrisonTerms; | |
469 | 7787 return v4 >= pValue; |
0 | 7788 case VAR_ArenaWinsPage: |
7789 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7790 return v4 >= pValue; |
0 | 7791 case VAR_ArenaWinsSquire: |
7792 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7793 return v4 >= pValue; |
0 | 7794 case VAR_ArenaWinsKnight: |
7795 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7796 return v4 >= pValue; |
0 | 7797 case VAR_ArenaWinsLord: |
7798 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7799 return v4 >= pValue; |
0 | 7800 case VAR_ReputationInCurrentLocation: |
7801 v19 = &pOutdoor->ddm; | |
7802 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7803 v19 = &pIndoor->dlv; | |
469 | 7804 v6 = v19->uReputation >= pValue; |
7805 return v6; | |
0 | 7806 case VAR_History_28|VAR_Sex: |
7807 v21 = &pOutdoor->ddm; | |
7808 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7809 v21 = &pIndoor->dlv; | |
469 | 7810 v6 = v21->field_C_alert == pValue; |
0 | 7811 return v6; |
7812 case VAR_MonthEquals2|VAR_Sex: | |
7813 case VAR_MonthEquals2|VAR_Class: | |
7814 case VAR_Counter1: | |
7815 case VAR_Counter2: | |
7816 case VAR_Counter3: | |
7817 case VAR_Counter4: | |
7818 case VAR_Counter5: | |
7819 case VAR_Counter6: | |
7820 case VAR_Counter7: | |
7821 case VAR_Counter8: | |
469 | 7822 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7823 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7824 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7825 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7826 return true; | |
7827 return false; | |
0 | 7828 case VAR_NumSkillPoints: |
7829 v4 = this->uSkillPoints; | |
469 | 7830 return v4 >= pValue; |
0 | 7831 case VAR_CircusPrises: |
7832 v4 = 0; | |
100 | 7833 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7834 do |
7835 { | |
469 | 7836 v24 = v23->pInventoryItems; |
0 | 7837 v25 = 138; |
7838 do | |
7839 { | |
7840 switch ( v24->uItemID ) | |
7841 { | |
7842 case 0x1D6u: | |
7843 ++v4; | |
7844 break; | |
7845 case 0x1D7u: | |
7846 v4 += 3; | |
7847 break; | |
7848 case 0x1DDu: | |
7849 v4 += 5; | |
7850 break; | |
7851 } | |
7852 ++v24; | |
7853 --v25; | |
7854 } | |
7855 while ( v25 ); | |
100 | 7856 ++v23; |
0 | 7857 } |
100 | 7858 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7859 return v4 >= pValue; |
0 | 7860 case VAR_MonthEquals2: |
469 | 7861 v6 = pParty->uCurrentMonth == pValue; |
7862 return v6; | |
0 | 7863 case VAR_IsFlying: |
7864 if ( pParty->bFlying | |
484 | 7865 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7866 return true; |
7867 return false; | |
0 | 7868 case VAR_HiredNPCHasSpeciality: |
469 | 7869 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7870 return v6; |
7871 case VAR_NPCs2: | |
469 | 7872 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7873 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7874 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7875 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7876 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7877 return v4 >= pValue; |
7878 v4 = pValue; | |
7879 return v4 >= pValue; | |
0 | 7880 case VAR_ItemEquipped: |
7881 v26 = (ITEM_EQUIP_TYPE)0; | |
7882 v27 = (char *)&this->pEquipment; | |
7883 break; | |
7884 case VAR_GoldInBank: | |
7885 v4 = pParty->uNumGoldInBank; | |
469 | 7886 return v4 >= pValue; |
0 | 7887 case VAR_ThieverySkill|0x80: |
7888 v28 = GetActualMight(); | |
7889 v29 = v3->GetBaseStrength(); | |
7890 goto LABEL_168; | |
7891 case VAR_DisarmTrapSkill|0x80: | |
7892 v28 = GetActualIntelligence(); | |
7893 v29 = v3->GetBaseIntelligence(); | |
7894 goto LABEL_168; | |
7895 case VAR_MonthEquals: | |
7896 v28 = GetActualWillpower(); | |
7897 v29 = v3->GetBaseWillpower(); | |
7898 goto LABEL_168; | |
7899 case VAR_MonthEquals|VAR_Sex: | |
7900 v28 = GetActualEndurance(); | |
7901 v29 = v3->GetBaseEndurance(); | |
7902 goto LABEL_168; | |
7903 case VAR_IdentifyMonsterSkill|0x80: | |
7904 v28 = GetActualSpeed(); | |
7905 v29 = v3->GetBaseSpeed(); | |
7906 goto LABEL_168; | |
7907 case VAR_ArmsmasterSkill|0x80: | |
7908 v28 = GetActualAccuracy(); | |
7909 v29 = v3->GetBaseAccuracy(); | |
7910 goto LABEL_168; | |
7911 case VAR_MonthEquals|VAR_MaxHP: | |
7912 v28 = GetActualLuck(); | |
7913 v29 = v3->GetBaseLuck(); | |
7914 LABEL_168: | |
7915 v10 = __OFSUB__(v28, v29); | |
7916 v9 = v28 - v29 < 0; | |
7917 LABEL_169: | |
7918 if ( v9 ^ v10 ) | |
469 | 7919 return v4 >= pValue; |
7920 return true; | |
0 | 7921 default: |
469 | 7922 return v4 >= pValue; |
0 | 7923 } |
7924 while ( !v3->HasItemEquipped(v26) | |
654 | 7925 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7926 { |
7927 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7928 v27 += 4; | |
7929 if ( (signed int)v26 >= 16 ) | |
469 | 7930 return false; |
7931 } | |
7932 return true; | |
7933 } | |
7934 if ( VarNum == VAR_AutoNotes ) | |
0 | 7935 { |
484 | 7936 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7937 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7938 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7939 return false; | |
7940 return true; | |
469 | 7941 } |
7942 if ( VarNum <= VAR_BaseLuck ) | |
7943 { | |
7944 if ( VarNum != VAR_BaseLuck ) | |
7945 { | |
7946 switch ( VarNum ) | |
0 | 7947 { |
7948 case VAR_Hour: | |
469 | 7949 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7950 return true; | |
7951 return false; | |
0 | 7952 case VAR_DayOfYear: |
469 | 7953 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7954 v6 = v5 == pValue; | |
7955 return v6; | |
0 | 7956 case VAR_DayOfWeek: |
469 | 7957 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7958 v6 = v5 == pValue; | |
0 | 7959 return v6; |
7960 case VAR_Sex: | |
469 | 7961 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7962 return true; | |
7963 return v4 >= pValue; | |
0 | 7964 case VAR_Class: |
135 | 7965 v7 = (CHARACTER_RACE)this->classType; |
469 | 7966 if ( pValue == v7 ) |
7967 return true; | |
7968 return v4 >= pValue; | |
0 | 7969 case VAR_Race: |
7970 v7 = GetRace(); | |
469 | 7971 if ( pValue == v7 ) |
7972 return true; | |
7973 return v4 >= pValue; | |
0 | 7974 case VAR_CurrentHP: |
7975 v4 = this->sHealth; | |
469 | 7976 return v4 >= pValue; |
0 | 7977 case VAR_MaxHP: |
7978 v8 = GetMaxHealth(); | |
7979 v10 = __OFSUB__(v3->sHealth, v8); | |
7980 v9 = v3->sHealth - v8 < 0; | |
7981 goto LABEL_169; | |
7982 case VAR_CurrentSP: | |
7983 v4 = this->sMana; | |
469 | 7984 return v4 >= pValue; |
0 | 7985 case VAR_MaxSP: |
7986 v11 = GetMaxMana(); | |
7987 v10 = __OFSUB__(v3->sMana, v11); | |
7988 v9 = v3->sMana - v11 < 0; | |
7989 goto LABEL_169; | |
7990 case VAR_ActualAC: | |
7991 v12 = GetActualAC(); | |
7992 goto _j_cmp_against_arg; | |
7993 case VAR_ACModifier: | |
7994 v4 = this->sACModifier; | |
469 | 7995 return v4 >= pValue; |
0 | 7996 case VAR_BaseLevel: |
7997 v4 = this->uLevel; | |
469 | 7998 return v4 >= pValue; |
0 | 7999 case VAR_LevelModifier: |
8000 v4 = this->sLevelModifier; | |
469 | 8001 return v4 >= pValue; |
0 | 8002 case VAR_Age: |
8003 v12 = GetActualAge(); | |
8004 goto _j_cmp_against_arg; | |
8005 case VAR_Award: | |
484 | 8006 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
8007 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
8008 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8009 return true; | |
8010 return false; | |
0 | 8011 case VAR_Experience: |
8012 v4 = LODWORD(this->uExperience); | |
469 | 8013 return v4 >= pValue; |
0 | 8014 case VAR_QBits_QuestsDone: |
484 | 8015 test_bit_value = 0x80u >> (pValue - 1) % 8; |
8016 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
8017 if ( test_bit_value & our_bit_value ) | |
478 | 8018 return true; |
8019 return false; | |
0 | 8020 case VAR_PlayerItemInHands: |
8021 v15 = 0; | |
8022 v16 = v3->pInventoryItems; | |
8023 break; | |
8024 case VAR_FixedGold: | |
8025 v4 = pParty->uNumGold; | |
469 | 8026 return v4 >= pValue; |
0 | 8027 case VAR_MightBonus: |
8028 v4 = this->uMightBonus; | |
469 | 8029 return v4 >= pValue; |
0 | 8030 case VAR_IntellectBonus: |
8031 v4 = this->uIntelligenceBonus; | |
469 | 8032 return v4 >= pValue; |
0 | 8033 case VAR_PersonalityBonus: |
8034 v4 = this->uWillpowerBonus; | |
469 | 8035 return v4 >= pValue; |
0 | 8036 case VAR_EnduranceBonus: |
8037 v4 = this->uEnduranceBonus; | |
469 | 8038 return v4 >= pValue; |
0 | 8039 case VAR_SpeedBonus: |
8040 v4 = this->uSpeedBonus; | |
469 | 8041 return v4 >= pValue; |
0 | 8042 case VAR_AccuracyBonus: |
8043 v4 = this->uAccuracyBonus; | |
469 | 8044 return v4 >= pValue; |
0 | 8045 case VAR_LuckBonus: |
8046 v4 = this->uLuckBonus; | |
469 | 8047 return v4 >= pValue; |
0 | 8048 case VAR_BaseMight: |
8049 v4 = this->uMight; | |
469 | 8050 return v4 >= pValue; |
0 | 8051 case VAR_BaseIntellect: |
8052 v4 = this->uIntelligence; | |
469 | 8053 return v4 >= pValue; |
0 | 8054 case VAR_BasePersonality: |
8055 v4 = this->uWillpower; | |
469 | 8056 return v4 >= pValue; |
0 | 8057 case VAR_BaseEndurance: |
8058 v4 = this->uEndurance; | |
469 | 8059 return v4 >= pValue; |
0 | 8060 case VAR_BaseSpeed: |
8061 v4 = this->uSpeed; | |
469 | 8062 return v4 >= pValue; |
0 | 8063 case VAR_BaseAccuracy: |
8064 v4 = this->uAccuracy; | |
469 | 8065 return v4 >= pValue; |
0 | 8066 case VAR_FixedFood: |
8067 v4 = pParty->uNumFoodRations; | |
469 | 8068 return v4 >= pValue; |
0 | 8069 default: |
469 | 8070 return v4 >= pValue; |
8071 } | |
8072 while ( v16->uItemID != pValue ) | |
0 | 8073 { |
8074 ++v15; | |
8075 ++v16; | |
8076 if ( v15 >= 138 ) | |
8077 { | |
469 | 8078 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8079 return v6; |
8080 } | |
8081 } | |
469 | 8082 return true; |
0 | 8083 } |
8084 v4 = this->uLuck; | |
469 | 8085 return v4 >= pValue; |
8086 } | |
8087 if ( VarNum <= VAR_MagicResistance ) | |
8088 { | |
8089 if ( VarNum == VAR_MagicResistance ) | |
0 | 8090 { |
8091 v4 = this->sResMagicBase; | |
8092 } | |
8093 else | |
8094 { | |
469 | 8095 switch ( VarNum ) |
0 | 8096 { |
8097 case VAR_FireResistance: | |
8098 v4 = this->sResFireBase; | |
469 | 8099 return v4 >= pValue; |
0 | 8100 case VAR_AirResistance: |
8101 v4 = this->sResAirBase; | |
469 | 8102 return v4 >= pValue; |
0 | 8103 case VAR_WaterResistance: |
8104 v4 = this->sResWaterBase; | |
469 | 8105 return v4 >= pValue; |
0 | 8106 case VAR_EarthResistance: |
8107 v4 = this->sResEarthBase; | |
469 | 8108 return v4 >= pValue; |
0 | 8109 case VAR_SpiritResistance: |
8110 v4 = this->sResSpiritBase; | |
469 | 8111 return v4 >= pValue; |
0 | 8112 case VAR_MindResistance: |
8113 v4 = this->sResMindBase; | |
469 | 8114 return v4 >= pValue; |
0 | 8115 case VAR_BodyResistance: |
8116 v4 = this->sResBodyBase; | |
469 | 8117 return v4 >= pValue; |
0 | 8118 case VAR_LightResistance: |
8119 v4 = this->sResLightBase; | |
469 | 8120 return v4 >= pValue; |
0 | 8121 case VAR_DarkResistance: |
8122 v4 = this->sResDarkBase; | |
469 | 8123 return v4 >= pValue; |
0 | 8124 case VAR_ActualMight: |
8125 v12 = GetActualMight(); | |
8126 goto _j_cmp_against_arg; | |
8127 case VAR_ActualIntellect: | |
8128 v12 = GetActualIntelligence(); | |
8129 goto _j_cmp_against_arg; | |
8130 case VAR_ActualPersonality: | |
8131 v12 = GetActualWillpower(); | |
8132 goto _j_cmp_against_arg; | |
8133 case VAR_ActualEndurance: | |
8134 v12 = GetActualEndurance(); | |
8135 goto _j_cmp_against_arg; | |
8136 case VAR_ActualSpeed: | |
8137 v12 = GetActualSpeed(); | |
8138 goto _j_cmp_against_arg; | |
8139 case VAR_ActualAccuracy: | |
8140 v12 = GetActualAccuracy(); | |
8141 goto _j_cmp_against_arg; | |
8142 case VAR_ActualLuck: | |
8143 v12 = GetActualLuck(); | |
8144 _j_cmp_against_arg: | |
8145 v4 = v12; | |
8146 break; | |
8147 default: | |
469 | 8148 return v4 >= pValue; |
8149 } | |
8150 } | |
8151 return v4 >= pValue; | |
8152 } | |
8153 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8154 { | |
8155 if ( VarNum != VAR_DisarmTrapSkill ) | |
8156 { | |
8157 if ( VarNum <= VAR_MindResistanceBonus ) | |
8158 { | |
8159 switch ( VarNum ) | |
0 | 8160 { |
8161 case VAR_MindResistanceBonus: | |
8162 v4 = this->sResMindBonus; | |
8163 break; | |
8164 case VAR_FireResistanceBonus: | |
8165 v4 = this->sResFireBonus; | |
8166 break; | |
8167 case VAR_AirResistanceBonus: | |
8168 v4 = this->sResAirBonus; | |
8169 break; | |
8170 case VAR_WaterResistanceBonus: | |
8171 v4 = this->sResWaterBonus; | |
8172 break; | |
8173 case VAR_EarthResistanceBonus: | |
8174 v4 = this->sResEarthBonus; | |
8175 break; | |
8176 case VAR_SpiritResistanceBonus: | |
8177 v4 = this->sResSpiritBonus; | |
8178 break; | |
8179 } | |
469 | 8180 return v4 >= pValue; |
8181 } | |
8182 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8183 { |
8184 v4 = this->sResBodyBonus; | |
469 | 8185 return v4 >= pValue; |
8186 } | |
8187 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8188 { |
8189 v4 = this->sResLightBonus; | |
469 | 8190 return v4 >= pValue; |
8191 } | |
8192 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8193 { |
8194 v4 = this->sResDarkBonus; | |
469 | 8195 return v4 >= pValue; |
8196 } | |
8197 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8198 { |
8199 v4 = this->sResMagicBonus; | |
469 | 8200 return v4 >= pValue; |
8201 } | |
8202 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8203 return v4 >= pValue; | |
0 | 8204 } |
8205 LABEL_90: | |
469 | 8206 v18 = *((short *)&this->pConditions[16] + VarNum); |
8207 if ( pValue <= 63 ) | |
0 | 8208 v4 = v18 & 0x3F; |
8209 else | |
469 | 8210 v4 = pValue & v18; |
8211 return v4 >= pValue; | |
8212 } | |
8213 if ( VarNum == 104 ) | |
0 | 8214 goto LABEL_90; |
469 | 8215 if ( (signed int)VarNum <= 104 ) |
8216 return v4 >= pValue; | |
8217 if ( (signed int)VarNum > 0x79 ) | |
8218 { | |
8219 if ( VarNum != 122 ) | |
8220 { | |
8221 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8222 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8223 return v4 >= pValue; | |
0 | 8224 } |
8225 v4 = GetMajorConditionIdx(); | |
8226 if ( v4 != 18 ) | |
8227 { | |
469 | 8228 return v4 >= pValue; |
8229 } | |
8230 v4 = pValue; | |
8231 return v4 >= pValue; | |
8232 } | |
8233 return *((int *)this + 2 * VarNum - 210); | |
0 | 8234 } |
8235 | |
8236 | |
8237 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8238 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8239 { | |
8240 signed int currPlayerId; // ebx@1 | |
0 | 8241 Player *v4; // esi@1 |
8242 unsigned int v5; // edi@1 | |
8243 unsigned int v6; // esi@13 | |
8244 unsigned int v7; // esi@14 | |
8245 signed int v8; // eax@17 | |
8246 ItemGen *v9; // ecx@17 | |
8247 int v10; // eax@21 | |
8248 signed int v11; // eax@30 | |
8249 Player *v12; // ecx@44 | |
8250 char *v13; // ecx@45 | |
8251 Player *v14; // ecx@49 | |
8252 int v15; // ecx@86 | |
8253 int v16; // esi@106 | |
8254 char v17; // al@106 | |
8255 int v18; // eax@107 | |
8256 Player *v19; // ecx@112 | |
8257 Player *v20; // ecx@127 | |
8258 int v21; // eax@127 | |
8259 int v22; // eax@145 | |
8260 char v23; // zf@146 | |
8261 DDM_DLV_Header *v24; // ecx@148 | |
8262 signed int v25; // eax@172 | |
8263 int v26; // [sp-8h] [bp-3Ch]@84 | |
8264 signed int v27; // [sp-4h] [bp-38h]@4 | |
8265 int v28; // [sp-4h] [bp-38h]@84 | |
8266 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8267 char v30; // [sp+32h] [bp-2h]@1 | |
8268 char v31; // [sp+33h] [bp-1h]@1 | |
8269 | |
492 | 8270 currPlayerId = 0; |
0 | 8271 v30 = 0; |
8272 v31 = 0; | |
8273 v4 = this; | |
8274 v5 = 0; | |
8275 if ( this == pPlayers[2] ) | |
492 | 8276 currPlayerId = 1; |
8277 else if ( this == pPlayers[3] ) | |
8278 currPlayerId = 2; | |
8279 else if ( this == pPlayers[4] ); | |
8280 currPlayerId = 3; | |
8281 if ( var_type > VAR_AutoNotes ) | |
8282 { | |
8283 if ( var_type <= VAR_GoldInBank ) | |
8284 { | |
8285 if ( var_type == VAR_GoldInBank ) | |
8286 { | |
8287 pParty->uNumGoldInBank = var_value; | |
0 | 8288 return; |
8289 } | |
492 | 8290 if ( var_type <= VAR_Counter8 ) |
8291 { | |
8292 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8293 { |
492 | 8294 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8295 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8296 } |
8297 else | |
8298 { | |
492 | 8299 switch ( var_type ) |
0 | 8300 { |
8301 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8302 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8303 break; |
8304 case VAR_NPCs2: | |
8305 pParty->field_709 = 0; | |
492 | 8306 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8307 Party__CountHirelings(); |
0 | 8308 viewparams->bRedrawGameUI = 1; |
8309 break; | |
8310 case VAR_NumSkillPoints: | |
492 | 8311 this->uSkillPoints = var_value; |
0 | 8312 break; |
8313 } | |
8314 } | |
8315 return; | |
8316 } | |
492 | 8317 if ( var_type < VAR_Counter9 ) |
0 | 8318 return; |
492 | 8319 if ( (signed int)var_type <= 0x112 ) |
8320 { | |
8321 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8322 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8323 } |
8324 else | |
8325 { | |
492 | 8326 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8327 { |
8328 v24 = &pOutdoor->ddm; | |
8329 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8330 v24 = &pIndoor->dlv; | |
492 | 8331 v24->uReputation = var_value; |
8332 if ( var_value > 10000 ) | |
0 | 8333 v24->uReputation = 10000; |
8334 return; | |
8335 } | |
492 | 8336 if ( var_type <= VAR_ReputationInCurrentLocation |
8337 || var_type > VAR_History_28 | |
8338 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8339 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8340 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8341 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8342 v23) ) |
8343 return; | |
8344 bFlashHistoryBook = 1; | |
8345 } | |
8346 LABEL_172: | |
492 | 8347 v25 = 8 * currPlayerId + 400; |
8348 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
0 | 8349 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8350 return; | |
8351 } | |
492 | 8352 if ( var_type != 307 ) |
8353 { | |
8354 switch ( var_type ) | |
0 | 8355 { |
8356 case 308: | |
492 | 8357 pParty->uNumBountiesCollected = var_value; |
0 | 8358 break; |
8359 case 309: | |
492 | 8360 pParty->uNumPrisonTerms = var_value; |
0 | 8361 break; |
8362 case 310: | |
492 | 8363 pParty->uNumArenaPageWins = var_value; |
0 | 8364 break; |
8365 case 311: | |
492 | 8366 pParty->uNumArenaSquireWins = var_value; |
0 | 8367 break; |
8368 case 312: | |
492 | 8369 pParty->uNumArenaKnightWins = var_value; |
0 | 8370 break; |
8371 case 313: | |
492 | 8372 pParty->uNumArenaLordWins = var_value; |
0 | 8373 break; |
8374 } | |
8375 return; | |
8376 } | |
492 | 8377 pParty->uNumDeaths = var_value; |
0 | 8378 LABEL_168: |
8379 if ( v30 != 1 ) | |
8380 { | |
8381 LABEL_170: | |
8382 if ( v31 != 1 ) | |
8383 return; | |
8384 v5 = 0; | |
8385 goto LABEL_172; | |
8386 } | |
8387 LABEL_169: | |
492 | 8388 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8389 goto LABEL_170; |
8390 } | |
492 | 8391 if ( var_type == VAR_AutoNotes ) |
8392 { | |
8393 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
|
8394 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8395 && pAutonoteTxt[var_value-1].pText ) |
8396 { | |
8397 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8398 v30 = 1; |
187 | 8399 v20->PlaySound(SPEECH_96, 0); |
492 | 8400 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8401 bFlashAutonotesBook = 1; |
8402 dword_506568 = v21; | |
8403 } | |
492 | 8404 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8405 v31 = 1; |
8406 goto LABEL_168; | |
8407 } | |
492 | 8408 if ( var_type <= VAR_ActualMight ) |
8409 { | |
8410 if ( var_type != VAR_ActualMight ) | |
8411 { | |
8412 switch ( var_type ) | |
0 | 8413 { |
8414 case VAR_RandomGold: | |
492 | 8415 v6 = rand() % var_value + 1; |
0 | 8416 Party::SetGold(v6); |
8417 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8418 ShowStatusBarString(pTmpBuf, 2u); | |
8419 GameUI_DrawFoodAndGold(); | |
8420 return; | |
8421 case VAR_RandomFood: | |
492 | 8422 v7 = rand() % var_value + 1; |
0 | 8423 Party::SetFood(v7); |
8424 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8425 ShowStatusBarString(pTmpBuf, 2u); | |
8426 GameUI_DrawFoodAndGold(); | |
8427 goto LABEL_124; | |
8428 case VAR_Sex: | |
492 | 8429 this->uSex = (PLAYER_SEX)var_value; |
0 | 8430 goto LABEL_124; |
8431 case VAR_Class: | |
492 | 8432 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8433 if ( (char)var_value != 35 ) | |
0 | 8434 goto LABEL_124; |
8435 v8 = 0; | |
8436 v9 = this->pInventoryItems; | |
8437 break; | |
8438 case VAR_CurrentHP: | |
492 | 8439 this->sHealth = var_value; |
0 | 8440 goto LABEL_124; |
8441 case VAR_MaxHP: | |
8442 this->sHealth = GetMaxHealth(); | |
8443 return; | |
8444 case VAR_CurrentSP: | |
492 | 8445 this->sMana = var_value; |
0 | 8446 goto LABEL_124; |
8447 case VAR_MaxSP: | |
8448 this->sMana = GetMaxMana(); | |
8449 return; | |
8450 case VAR_ACModifier: | |
492 | 8451 this->sACModifier = (unsigned __int8)var_value; |
0 | 8452 goto LABEL_124; |
8453 case VAR_BaseLevel: | |
492 | 8454 this->uLevel = (unsigned __int8)var_value; |
0 | 8455 goto LABEL_124; |
8456 case VAR_LevelModifier: | |
492 | 8457 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8458 goto LABEL_124; |
8459 case VAR_Age: | |
492 | 8460 this->sAgeModifier = var_value; |
0 | 8461 return; |
8462 case VAR_Award: | |
492 | 8463 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8464 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
|
8465 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8466 && pAwards[var_value].pText ) |
0 | 8467 { |
8468 v30 = 1; | |
8469 v31 = 1; | |
492 | 8470 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8471 } |
492 | 8472 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8473 goto LABEL_168; | |
0 | 8474 case VAR_Experience: |
492 | 8475 this->uExperience = var_value; |
0 | 8476 goto LABEL_124; |
8477 case VAR_QBits_QuestsDone: | |
492 | 8478 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
|
8479 // && (&dword_722F10)[4 * a3] ) |
492 | 8480 && pQuestTable[var_value-1] ) |
0 | 8481 { |
492 | 8482 v14 = pPlayers[currPlayerId + 1]; |
0 | 8483 bFlashQuestBook = 1; |
8484 v30 = 1; | |
8485 v31 = 1; | |
187 | 8486 v14->PlaySound(SPEECH_93, 0); |
0 | 8487 } |
484 | 8488 v13 = (char *)pParty->_quest_bits; |
0 | 8489 LABEL_51: |
492 | 8490 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8491 if (( v30 != 1 )&&( v31 != 1 )) | |
8492 return; | |
8493 else | |
8494 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8495 if ( v31 != 1 ) | |
8496 return; | |
8497 v25 = 8 * currPlayerId + 400; | |
8498 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
8499 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | |
8500 return; | |
0 | 8501 case VAR_PlayerItemInHands: |
8502 item.Reset(); | |
8503 item.Reset(); | |
492 | 8504 item.uItemID = var_value; |
0 | 8505 item.uAttributes = 1; |
8506 pParty->SetHoldingItem(&item); | |
492 | 8507 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8508 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8509 return; |
8510 case VAR_FixedGold: | |
492 | 8511 Party::SetGold(var_value); |
0 | 8512 return; |
8513 case VAR_BaseMight: | |
492 | 8514 this->uMight = (unsigned __int8)var_value; |
0 | 8515 goto LABEL_84; |
8516 case VAR_BaseIntellect: | |
492 | 8517 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8518 goto LABEL_84; |
8519 case VAR_BasePersonality: | |
492 | 8520 this->uWillpower = (unsigned __int8)var_value; |
0 | 8521 goto LABEL_84; |
8522 case VAR_BaseEndurance: | |
492 | 8523 this->uEndurance = (unsigned __int8)var_value; |
0 | 8524 goto LABEL_84; |
8525 case VAR_BaseSpeed: | |
492 | 8526 this->uSpeed = (unsigned __int8)var_value; |
0 | 8527 goto LABEL_84; |
8528 case VAR_BaseAccuracy: | |
492 | 8529 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8530 goto LABEL_84; |
8531 case VAR_BaseLuck: | |
492 | 8532 this->uLuck = (unsigned __int8)var_value; |
0 | 8533 goto LABEL_84; |
8534 case VAR_FixedFood: | |
492 | 8535 Party::SetFood(var_value); |
0 | 8536 goto LABEL_124; |
8537 case VAR_MightBonus: | |
8538 goto LABEL_64; | |
8539 case VAR_IntellectBonus: | |
8540 goto LABEL_68; | |
8541 case VAR_PersonalityBonus: | |
8542 goto LABEL_69; | |
8543 case VAR_EnduranceBonus: | |
8544 goto LABEL_70; | |
8545 case VAR_SpeedBonus: | |
8546 goto LABEL_71; | |
8547 case VAR_AccuracyBonus: | |
8548 goto LABEL_72; | |
8549 case VAR_LuckBonus: | |
8550 goto LABEL_73; | |
8551 default: | |
8552 return; | |
8553 } | |
8554 while ( v9->uItemID != 615 ) | |
8555 { | |
8556 ++v8; | |
8557 ++v9; | |
8558 if ( v8 >= 138 ) | |
8559 goto LABEL_22; | |
8560 } | |
8561 v10 = (int)((char *)v4 + 36 * v8); | |
8562 *(int *)(v10 + 532) = 601; | |
492 | 8563 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8564 LABEL_22: |
8565 if ( v4->sResFireBase < 20 ) | |
8566 v4->sResFireBase = 20; | |
8567 if ( v4->sResAirBase < 20 ) | |
8568 v4->sResAirBase = 20; | |
8569 if ( v4->sResWaterBase < 20 ) | |
8570 v4->sResWaterBase = 20; | |
8571 if ( v4->sResEarthBase < 20 ) | |
8572 v4->sResEarthBase = 20; | |
8573 v4->sResMindBase = 200; | |
8574 v4->sResBodyBase = 200; | |
8575 v11 = v4->GetSexByVoice(); | |
8576 v4->field_1924 = v4->uVoiceID; | |
8577 v4->field_1928 = v4->uFace; | |
8578 if ( v11 ) | |
8579 { | |
8580 v4->uFace = 21; | |
8581 v4->uVoiceID = 21; | |
8582 } | |
8583 else | |
8584 { | |
8585 v4->uFace = 20; | |
8586 v4->uVoiceID = 20; | |
8587 } | |
492 | 8588 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8589 goto LABEL_124; |
8590 } | |
8591 LABEL_64: | |
492 | 8592 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8593 LABEL_111: |
8594 v28 = 0; | |
187 | 8595 v26 = SPEECH_91; |
0 | 8596 LABEL_112: |
492 | 8597 v19 = pPlayers[currPlayerId + 1]; |
0 | 8598 v31 = 1; |
187 | 8599 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8600 goto LABEL_169; |
8601 } | |
492 | 8602 if ( var_type <= VAR_FireResistanceBonus ) |
8603 { | |
8604 if ( var_type == VAR_FireResistanceBonus ) | |
8605 { | |
8606 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8607 goto LABEL_111; |
8608 } | |
492 | 8609 switch ( var_type ) |
0 | 8610 { |
8611 case VAR_ActualIntellect: | |
8612 LABEL_68: | |
492 | 8613 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8614 goto LABEL_111; |
8615 case VAR_ActualPersonality: | |
8616 LABEL_69: | |
492 | 8617 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8618 goto LABEL_111; |
8619 case VAR_ActualEndurance: | |
8620 LABEL_70: | |
492 | 8621 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8622 goto LABEL_111; |
8623 case VAR_ActualSpeed: | |
8624 LABEL_71: | |
492 | 8625 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8626 goto LABEL_111; |
8627 case VAR_ActualAccuracy: | |
8628 LABEL_72: | |
492 | 8629 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8630 goto LABEL_111; |
8631 case VAR_ActualLuck: | |
8632 LABEL_73: | |
492 | 8633 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8634 goto LABEL_111; |
8635 case VAR_FireResistance: | |
492 | 8636 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8637 goto LABEL_84; |
8638 case VAR_AirResistance: | |
492 | 8639 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8640 goto LABEL_84; |
8641 case VAR_WaterResistance: | |
492 | 8642 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8643 goto LABEL_84; |
8644 case VAR_EarthResistance: | |
492 | 8645 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8646 goto LABEL_84; |
8647 case VAR_SpiritResistance: | |
492 | 8648 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8649 goto LABEL_84; |
8650 case VAR_MindResistance: | |
492 | 8651 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8652 goto LABEL_84; |
8653 case VAR_BodyResistance: | |
492 | 8654 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8655 goto LABEL_84; |
8656 case VAR_LightResistance: | |
492 | 8657 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8658 goto LABEL_84; |
8659 case VAR_DarkResistance: | |
492 | 8660 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8661 goto LABEL_84; |
8662 case VAR_MagicResistance: | |
492 | 8663 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8664 LABEL_84: |
8665 v28 = 0; | |
8666 v26 = 92; | |
8667 goto LABEL_112; | |
8668 default: | |
8669 return; | |
8670 } | |
8671 return; | |
8672 } | |
8673 HIWORD(v15) = 0; | |
492 | 8674 if ( var_type > VAR_DisarmTrapSkill ) |
8675 { | |
8676 if ( var_type != VAR_LearningSkill ) | |
8677 { | |
8678 if ( var_type <= VAR_LearningSkill ) | |
0 | 8679 return; |
492 | 8680 if ( var_type <= VAR_Eradicated ) |
8681 { | |
8682 v4->SetCondition(var_type - 105, 1); | |
0 | 8683 } |
8684 else | |
8685 { | |
492 | 8686 if ( var_type != VAR_MajorCondition ) |
0 | 8687 { |
492 | 8688 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8689 byte_5E4C15[var_type] = var_value; | |
0 | 8690 return; |
8691 } | |
8692 memset(v4, 0, 0xA0u); | |
8693 } | |
8694 LABEL_124: | |
8695 v31 = 1; | |
8696 goto LABEL_169; | |
8697 } | |
8698 LABEL_106: | |
492 | 8699 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8700 v17 = *(char *)v16; |
492 | 8701 if ( var_value <= VAR_BodyResistanceBonus ) |
8702 { | |
8703 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8704 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8705 } | |
8706 else | |
8707 { | |
492 | 8708 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8709 } |
8710 *(short *)v16 = v18; | |
8711 goto LABEL_124; | |
8712 } | |
492 | 8713 if ( var_type == VAR_DisarmTrapSkill ) |
8714 if ( v30 != 1 ) | |
8715 { | |
8716 if ( v31 != 1 ) | |
8717 return; | |
8718 v5 = 0; | |
8719 goto LABEL_172; | |
8720 } | |
8721 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8722 goto LABEL_170; | |
8723 if ( var_type <= VAR_BodyResistanceBonus ) | |
8724 { | |
8725 switch ( var_type ) | |
0 | 8726 { |
8727 case VAR_BodyResistanceBonus: | |
492 | 8728 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8729 break; |
8730 case VAR_AirResistanceBonus: | |
492 | 8731 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8732 break; |
8733 case VAR_WaterResistanceBonus: | |
492 | 8734 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8735 break; |
8736 case VAR_EarthResistanceBonus: | |
492 | 8737 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8738 break; |
8739 case VAR_SpiritResistanceBonus: | |
492 | 8740 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8741 break; |
8742 default: | |
492 | 8743 if ( var_type != 62 ) |
0 | 8744 return; |
492 | 8745 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8746 break; |
8747 } | |
8748 goto LABEL_111; | |
8749 } | |
492 | 8750 if ( var_type == VAR_LightResistanceBonus ) |
8751 { | |
8752 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8753 goto LABEL_111; |
8754 } | |
492 | 8755 if ( var_type == VAR_DarkResistanceBonus ) |
8756 { | |
8757 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8758 goto LABEL_111; | |
8759 } | |
8760 if ( var_type == VAR_MagicResistanceBonus ) | |
8761 { | |
8762 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8763 goto LABEL_111; |
8764 } | |
492 | 8765 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8766 if ( v30 != 1 ) | |
8767 { | |
8768 if ( v31 != 1 ) | |
8769 return; | |
8770 v5 = 0; | |
8771 v25 = 8 * currPlayerId + 400; | |
8772 LOBYTE(v25) = (8 * currPlayerId - 112) | 4; | |
8773 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | |
8774 return; | |
8775 } | |
8776 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8777 goto LABEL_170; | |
0 | 8778 } |
8779 | |
8780 | |
8781 | |
8782 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8783 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8784 { |
8785 char v3; // bl@1 | |
8786 Player *v4; // esi@1 | |
8787 signed int uPlayerIdx; // edi@1 | |
8788 int v6; // eax@15 | |
8789 unsigned int v7; // esi@18 | |
8790 int *v8; // ebx@21 | |
8791 int v9; // eax@22 | |
8792 signed int v10; // eax@24 | |
8793 int v11; // eax@27 | |
8794 __int16 *v12; // esi@28 | |
8795 Player *v13; // ecx@34 | |
8796 Player *v14; // ecx@36 | |
8797 char *v15; // ecx@37 | |
8798 unsigned __int8 v16; // cf@38 | |
8799 Player *v17; // ecx@42 | |
8800 __int16 *v18; // esi@53 | |
8801 __int16 *v19; // esi@62 | |
8802 char *v20; // esi@107 | |
8803 __int16 v21; // dx@107 | |
8804 int v22; // ecx@107 | |
8805 Player *v23; // ecx@132 | |
8806 int v24; // eax@132 | |
8807 int v25; // eax@150 | |
8808 char v26; // zf@151 | |
8809 DDM_DLV_Header *v27; // eax@153 | |
8810 signed int v28; // eax@176 | |
8811 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8812 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8813 int v31; // [sp-4h] [bp-3Ch]@84 |
8814 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8815 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8816 char v34; // [sp+37h] [bp-1h]@1 | |
8817 | |
8818 auto Dst = this; | |
8819 v3 = 0; | |
8820 v34 = 0; | |
8821 v4 = Dst; | |
8822 uPlayerIdx = 0; | |
8823 if ( Dst == pPlayers[2] ) | |
8824 uPlayerIdx = 1; | |
310 | 8825 else if ( Dst == pPlayers[3] ) |
8826 uPlayerIdx = 2; | |
8827 else if ( Dst == pPlayers[4] ) | |
8828 uPlayerIdx = 3; | |
8829 | |
8830 if ( var_type <= VAR_AutoNotes ) | |
8831 { | |
8832 if ( var_type != VAR_AutoNotes ) | |
8833 { | |
8834 if ( var_type <= VAR_ActualMight ) | |
8835 { | |
8836 if ( var_type != VAR_ActualMight ) | |
0 | 8837 { |
310 | 8838 switch ( var_type ) |
0 | 8839 { |
8840 case VAR_RandomGold: | |
8841 if ( !val ) | |
8842 val = 1; | |
8843 v6 = rand(); | |
8844 party_finds_gold(v6 % val + 1, 1); | |
8845 GameUI_DrawFoodAndGold(); | |
8846 return; | |
8847 case VAR_RandomFood: | |
8848 if ( !val ) | |
8849 val = 1; | |
8850 v7 = rand() % val + 1; | |
8851 Party::GiveFood(v7); | |
8852 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8853 ShowStatusBarString(pTmpBuf, 2u); | |
8854 GameUI_DrawFoodAndGold(); | |
8855 goto _play_sound; | |
8856 case VAR_Sex: | |
8857 Dst->uSex = (PLAYER_SEX)val; | |
8858 goto _play_anim_and_exit; | |
8859 case VAR_Class: | |
135 | 8860 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8861 goto _play_anim_and_exit; |
8862 case VAR_CurrentHP: | |
8863 v8 = &Dst->sHealth; | |
8864 *v8 += val; | |
8865 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8866 goto _play_anim_and_exit; | |
8867 v9 = v4->GetMaxHealth(); | |
8868 goto LABEL_23; | |
8869 case VAR_MaxHP: | |
8870 v10 = Dst->GetMaxHealth(); | |
8871 v4->_health_related = 0; | |
8872 v4->uFullHealthBonus = 0; | |
8873 v4->sHealth = v10; | |
8874 return; | |
8875 case VAR_CurrentSP: | |
8876 v8 = &Dst->sMana; | |
8877 *v8 += val; | |
8878 if ( Dst->sMana > GetMaxMana() ) | |
8879 { | |
8880 v9 = v4->GetMaxMana(); | |
8881 LABEL_23: | |
8882 *v8 = v9; | |
8883 } | |
8884 goto _play_anim_and_exit; | |
8885 case VAR_MaxSP: | |
8886 v11 = GetMaxMana(); | |
8887 v4->_mana_related = 0; | |
8888 v4->uFullManaBonus = 0; | |
8889 v4->sMana = v11; | |
8890 return; | |
8891 case VAR_ACModifier: | |
8892 v12 = &Dst->sACModifier; | |
8893 goto LABEL_29; | |
8894 case VAR_BaseLevel: | |
8895 v12 = (__int16 *)&Dst->uLevel; | |
8896 goto LABEL_29; | |
8897 case VAR_LevelModifier: | |
8898 v12 = &Dst->sLevelModifier; | |
8899 LABEL_29: | |
8900 *v12 += val; | |
8901 if ( *v12 > 255 ) | |
8902 *v12 = 255; | |
8903 goto _play_anim_and_exit; | |
8904 case VAR_Age: | |
8905 Dst->sAgeModifier += val; | |
8906 return; | |
8907 case VAR_Award: | |
8908 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8909 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8910 | |
492 | 8911 && pAwards[val].pText ) |
0 | 8912 { |
8913 v14 = pPlayers[uPlayerIdx + 1]; | |
8914 v34 = 1; | |
8915 v3 = 1; | |
187 | 8916 v14->PlaySound(SPEECH_96, 0); |
0 | 8917 } |
484 | 8918 v15 = v4->_guilds_member_bits; |
0 | 8919 goto LABEL_44; |
8920 case VAR_Experience: | |
8921 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8922 LODWORD(Dst->uExperience) += val; | |
8923 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8924 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8925 Dst->uExperience = 4000000000i64; | |
8926 goto _play_anim_and_exit; | |
8927 case VAR_QBits_QuestsDone: | |
484 | 8928 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
|
8929 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8930 && pQuestTable[val-1] ) |
0 | 8931 { |
501 | 8932 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8933 bFlashQuestBook = 1; |
8934 v34 = 1; | |
8935 v3 = 1; | |
501 | 8936 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8937 } |
484 | 8938 v15 = (char *)pParty->_quest_bits; |
0 | 8939 LABEL_44: |
8940 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8941 goto LABEL_173; | |
8942 case VAR_PlayerItemInHands: | |
8943 item.Reset(); | |
8944 item.Reset(); | |
8945 item.uAttributes = 1; | |
8946 item.uItemID = val; | |
8947 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8948 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8949 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8950 { | |
8951 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8952 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8953 } | |
8954 pParty->SetHoldingItem(&item); | |
8955 return; | |
8956 case VAR_FixedGold: | |
8957 party_finds_gold(val, 1); | |
8958 return; | |
8959 case VAR_BaseMight: | |
8960 v18 = (__int16 *)&Dst->uMight; | |
8961 goto LABEL_82; | |
8962 case VAR_BaseIntellect: | |
8963 v18 = (__int16 *)&Dst->uIntelligence; | |
8964 goto LABEL_82; | |
8965 case VAR_BasePersonality: | |
8966 v18 = (__int16 *)&Dst->uWillpower; | |
8967 goto LABEL_82; | |
8968 case VAR_BaseEndurance: | |
8969 v18 = (__int16 *)&Dst->uEndurance; | |
8970 goto LABEL_82; | |
8971 case VAR_BaseSpeed: | |
8972 v18 = (__int16 *)&Dst->uSpeed; | |
8973 goto LABEL_82; | |
8974 case VAR_BaseAccuracy: | |
8975 v18 = (__int16 *)&Dst->uAccuracy; | |
8976 goto LABEL_82; | |
8977 case VAR_BaseLuck: | |
8978 v18 = (__int16 *)&Dst->uLuck; | |
8979 goto LABEL_82; | |
8980 case VAR_FixedFood: | |
8981 Party::GiveFood(val); | |
8982 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); | |
8983 ShowStatusBarString(pTmpBuf, 2u); | |
8984 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8985 Party::SetFood(0xFFFFu); | |
8986 goto _play_sound; | |
8987 case VAR_MightBonus: | |
8988 goto LABEL_62; | |
8989 case VAR_IntellectBonus: | |
8990 goto LABEL_66; | |
8991 case VAR_PersonalityBonus: | |
8992 goto LABEL_67; | |
8993 case VAR_EnduranceBonus: | |
8994 goto LABEL_68; | |
8995 case VAR_SpeedBonus: | |
8996 goto LABEL_69; | |
8997 case VAR_AccuracyBonus: | |
8998 goto LABEL_70; | |
8999 case VAR_LuckBonus: | |
9000 goto LABEL_71; | |
9001 default: | |
9002 return; | |
9003 } | |
9004 return; | |
9005 } | |
9006 LABEL_62: | |
9007 v19 = (__int16 *)&Dst->uMightBonus; | |
9008 goto LABEL_113; | |
9009 } | |
310 | 9010 if ( var_type <= VAR_FireResistanceBonus ) |
9011 { | |
9012 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 9013 { |
310 | 9014 switch ( var_type ) |
0 | 9015 { |
9016 case VAR_ActualIntellect: | |
9017 LABEL_66: | |
9018 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9019 goto LABEL_113; | |
9020 case VAR_ActualPersonality: | |
9021 LABEL_67: | |
9022 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9023 goto LABEL_113; | |
9024 case VAR_ActualEndurance: | |
9025 LABEL_68: | |
9026 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9027 goto LABEL_113; | |
9028 case VAR_ActualSpeed: | |
9029 LABEL_69: | |
9030 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9031 goto LABEL_113; | |
9032 case VAR_ActualAccuracy: | |
9033 LABEL_70: | |
9034 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9035 goto LABEL_113; | |
9036 case VAR_ActualLuck: | |
9037 LABEL_71: | |
9038 v19 = (__int16 *)&Dst->uLuckBonus; | |
9039 goto LABEL_113; | |
9040 case VAR_FireResistance: | |
9041 v18 = &Dst->sResFireBase; | |
9042 goto LABEL_82; | |
9043 case VAR_AirResistance: | |
9044 v18 = &Dst->sResAirBase; | |
9045 goto LABEL_82; | |
9046 case VAR_WaterResistance: | |
9047 v18 = &Dst->sResWaterBase; | |
9048 goto LABEL_82; | |
9049 case VAR_EarthResistance: | |
9050 v18 = &Dst->sResEarthBase; | |
9051 goto LABEL_82; | |
9052 case VAR_SpiritResistance: | |
9053 v18 = &Dst->sResSpiritBase; | |
9054 goto LABEL_82; | |
9055 case VAR_MindResistance: | |
9056 v18 = &Dst->sResMindBase; | |
9057 goto LABEL_82; | |
9058 case VAR_BodyResistance: | |
9059 v18 = &Dst->sResBodyBase; | |
9060 goto LABEL_82; | |
9061 case VAR_LightResistance: | |
9062 v18 = &Dst->sResLightBase; | |
9063 goto LABEL_82; | |
9064 case VAR_DarkResistance: | |
9065 v18 = &Dst->sResDarkBase; | |
9066 goto LABEL_82; | |
9067 case VAR_MagicResistance: | |
9068 v18 = &Dst->sResMagicBase; | |
9069 LABEL_82: | |
9070 *v18 += val; | |
9071 if ( *v18 > 255 ) | |
9072 *v18 = 255; | |
9073 v31 = 0; | |
9074 v29 = 92; | |
9075 goto LABEL_116; | |
9076 default: | |
9077 return; | |
9078 } | |
9079 return; | |
9080 } | |
9081 v19 = &Dst->sResFireBonus; | |
9082 LABEL_113: | |
9083 *v19 += val; | |
9084 if ( *v19 > 255 ) | |
9085 *v19 = 255; | |
9086 v31 = 0; | |
187 | 9087 v29 = SPEECH_91; |
0 | 9088 LABEL_116: |
9089 v3 = 1; | |
187 | 9090 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9091 goto _play_anim_and_maybe_sound; |
9092 } | |
310 | 9093 if ( var_type <= VAR_DisarmTrapSkill ) |
9094 { | |
9095 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9096 { |
310 | 9097 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9098 { |
310 | 9099 switch ( var_type ) |
0 | 9100 { |
9101 case VAR_BodyResistanceBonus: | |
9102 v19 = &Dst->sResBodyBonus; | |
9103 break; | |
9104 case VAR_AirResistanceBonus: | |
9105 v19 = &Dst->sResAirBonus; | |
9106 break; | |
9107 case VAR_WaterResistanceBonus: | |
9108 v19 = &Dst->sResWaterBonus; | |
9109 break; | |
9110 case VAR_EarthResistanceBonus: | |
9111 v19 = &Dst->sResEarthBonus; | |
9112 break; | |
9113 case VAR_SpiritResistanceBonus: | |
9114 v19 = &Dst->sResSpiritBonus; | |
9115 break; | |
9116 default: | |
310 | 9117 if ( var_type != 62 ) |
0 | 9118 return; |
9119 v19 = &Dst->sResMindBonus; | |
9120 break; | |
9121 } | |
9122 goto LABEL_113; | |
9123 } | |
310 | 9124 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9125 { |
9126 v19 = &Dst->sResLightBonus; | |
9127 goto LABEL_113; | |
9128 } | |
310 | 9129 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9130 { |
9131 v19 = &Dst->sResDarkBonus; | |
9132 goto LABEL_113; | |
9133 } | |
310 | 9134 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9135 { |
9136 v19 = &Dst->sResMagicBonus; | |
9137 goto LABEL_113; | |
9138 } | |
310 | 9139 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9140 return; |
9141 } | |
9142 goto LABEL_106; | |
9143 } | |
310 | 9144 if ( var_type == VAR_LearningSkill ) |
0 | 9145 { |
9146 LABEL_106: | |
9147 if ( val <= VAR_BodyResistanceBonus ) | |
9148 { | |
310 | 9149 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9150 } |
9151 else | |
9152 { | |
310 | 9153 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9154 v21 = *(short *)v20; |
9155 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9156 if ( v22 > 60 ) | |
9157 LOWORD(v22) = 60; | |
9158 LOBYTE(v21) = v21 & 0xC0; | |
9159 *(short *)v20 = v22 | v21; | |
9160 } | |
9161 goto _play_anim_and_exit; | |
9162 } | |
310 | 9163 if ( var_type <= VAR_LearningSkill ) |
0 | 9164 return; |
310 | 9165 if ( var_type <= VAR_Eradicated ) |
9166 { | |
9167 Dst->SetCondition(var_type - 105, 0); | |
0 | 9168 } |
9169 else | |
9170 { | |
310 | 9171 if ( var_type != VAR_MajorCondition ) |
0 | 9172 { |
310 | 9173 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9174 { |
310 | 9175 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9176 byte_5E4C15[var_type] += val; | |
0 | 9177 else |
310 | 9178 byte_5E4C15[var_type] = -1; |
0 | 9179 } |
9180 return; | |
9181 } | |
9182 memset(Dst, 0, 0xA0u); | |
9183 } | |
9184 _play_anim_and_exit: | |
9185 v3 = 1; | |
9186 _play_anim_and_maybe_sound: | |
9187 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9188 _maybe_play_sound: | |
9189 if ( v3 != 1 ) | |
9190 return; | |
9191 goto _play_sound; | |
9192 } | |
9193 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3]) | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9194 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9195 && pAutonoteTxt[val-1].pText ) |
0 | 9196 { |
9197 v23 = pPlayers[uPlayerIdx + 1]; | |
9198 v34 = 1; | |
187 | 9199 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9200 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9201 bFlashAutonotesBook = 1; |
9202 dword_506568 = v24; | |
9203 } | |
9204 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9205 v3 = 1; | |
9206 LABEL_173: | |
9207 if ( v34 != 1 ) | |
9208 goto _maybe_play_sound; | |
9209 goto _play_anim_and_maybe_sound; | |
9210 } | |
310 | 9211 if ( var_type > VAR_GoldInBank ) |
9212 { | |
9213 if ( var_type == 307 ) | |
0 | 9214 { |
9215 pParty->uNumDeaths += val; | |
9216 goto LABEL_173; | |
9217 } | |
310 | 9218 switch ( var_type ) |
0 | 9219 { |
9220 case 308: | |
9221 pParty->uNumBountiesCollected += val; | |
9222 break; | |
9223 case 309: | |
9224 pParty->uNumPrisonTerms += val; | |
9225 break; | |
9226 case 310: | |
9227 pParty->uNumArenaPageWins += val; | |
9228 break; | |
9229 case 311: | |
9230 pParty->uNumArenaSquireWins += val; | |
9231 break; | |
9232 case 312: | |
9233 pParty->uNumArenaKnightWins += val; | |
9234 break; | |
9235 case 313: | |
9236 pParty->uNumArenaLordWins += val; | |
9237 break; | |
9238 } | |
9239 } | |
9240 else | |
9241 { | |
310 | 9242 if ( var_type == VAR_GoldInBank ) |
0 | 9243 { |
9244 pParty->uNumGoldInBank += val; | |
9245 return; | |
9246 } | |
310 | 9247 if ( var_type <= VAR_Counter8 ) |
9248 { | |
9249 if ( (signed int)var_type >= 245 ) | |
9250 { | |
9251 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9252 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9253 } |
9254 else | |
9255 { | |
310 | 9256 switch ( var_type ) |
0 | 9257 { |
9258 case VAR_MonthEquals|VAR_CurrentSP: | |
9259 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9260 break; | |
9261 case VAR_NPCs2: | |
9262 pParty->field_709 = 0; | |
9263 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9264 Party__CountHirelings(); |
0 | 9265 viewparams->bRedrawGameUI = 1; |
9266 break; | |
9267 case VAR_NumSkillPoints: | |
9268 Dst->uSkillPoints += val; | |
9269 break; | |
9270 } | |
9271 } | |
9272 return; | |
9273 } | |
310 | 9274 if ( var_type < VAR_Counter9 ) |
0 | 9275 return; |
310 | 9276 if ( (signed int)var_type <= 274 ) |
9277 { | |
9278 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9279 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9280 goto _play_sound; |
9281 } | |
310 | 9282 if ( var_type != VAR_ReputationInCurrentLocation ) |
9283 { | |
9284 if ( var_type <= VAR_ReputationInCurrentLocation | |
9285 || var_type > VAR_History_28 | |
9286 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9287 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9288 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9289 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9290 v26) ) |
9291 return; | |
9292 bFlashHistoryBook = 1; | |
9293 _play_sound: | |
9294 v28 = 8 * uPlayerIdx + 400; | |
9295 LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; | |
9296 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); | |
9297 return; | |
9298 } | |
9299 v27 = &pOutdoor->ddm; | |
9300 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9301 v27 = &pIndoor->dlv; | |
9302 v27->uReputation += val; | |
9303 if ( v27->uReputation > 10000 ) | |
9304 v27->uReputation = 10000; | |
9305 } | |
9306 } | |
9307 // 506568: using guessed type int dword_506568; | |
9308 // 507948: using guessed type char bFlashHistoryBook; | |
9309 // 507949: using guessed type char bFlashAutonotesBook; | |
9310 // 50794A: using guessed type char bFlashQuestBook; | |
9311 // 72371C: using guessed type int dword_72371C[]; | |
9312 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9313 | |
9314 | |
9315 | |
9316 | |
9317 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9318 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9319 { |
9320 unsigned int v3; // ebx@1 | |
9321 signed int v4; // esi@1 | |
501 | 9322 bool result; // eax@8 |
0 | 9323 int v6; // esi@11 |
9324 int v7; // edi@14 | |
9325 signed int v8; // eax@17 | |
9326 char *v9; // eax@20 | |
9327 char v10; // sf@20 | |
9328 char *v11; // ecx@26 | |
9329 char *v12; // ecx@27 | |
9330 __int64 v13; // qax@27 | |
9331 unsigned __int8 v14; // cf@27 | |
501 | 9332 int *v15; // edx@29 |
0 | 9333 char *v16; // eax@90 |
9334 char *v17; // ecx@94 | |
501 | 9335 int v18; // esi@97 |
0 | 9336 signed int v19; // edx@97 |
9337 char *v20; // ecx@98 | |
9338 int v21; // eax@100 | |
9339 __int16 v22; // dx@112 | |
9340 int v23; // [sp-8h] [bp-14h]@45 | |
9341 signed int v24; // [sp-4h] [bp-10h]@4 | |
9342 int v25; // [sp-4h] [bp-10h]@45 | |
9343 | |
9344 v3 = 0; | |
605 | 9345 v4 = uActiveCharacter - 1; |
501 | 9346 result = false; |
9347 if ( (signed int)VarNum > 222 ) | |
9348 { | |
9349 if ( (signed int)VarNum <= 307 ) | |
9350 { | |
9351 if ( VarNum == 307 ) | |
9352 { | |
9353 pParty->uNumDeaths -= (unsigned int)pValue; | |
9354 return pValue; | |
9355 } | |
9356 if ( VarNum == 223 ) | |
0 | 9357 { |
9358 v11 = (char *)pParty->_autonote_bits; | |
501 | 9359 v22 = (short)pValue - 1; |
0 | 9360 } |
9361 else | |
9362 { | |
501 | 9363 if ( VarNum != 231 ) |
0 | 9364 { |
501 | 9365 switch ( VarNum ) |
0 | 9366 { |
9367 case 232: | |
501 | 9368 VarNum = (VariableType)0; |
602 | 9369 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9370 result = (bool) pValue; |
9371 dword_5B65CC = 0; | |
9372 if ( (int)VarNum == pValue ) | |
0 | 9373 { |
501 | 9374 dword_5B65CC = (int)pValue; |
0 | 9375 } |
9376 else | |
9377 { | |
9378 pParty->field_709 = 0; | |
501 | 9379 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9380 Party__CountHirelings(); |
0 | 9381 viewparams->bRedrawGameUI = 1; |
9382 } | |
9383 break; | |
9384 case 241: | |
9385 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9386 { | |
9387 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9388 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9389 { |
605 | 9390 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9391 { |
9392 v21 = *(int *)v20; | |
9393 if ( (char)*(int *)v20 < 0 ) | |
9394 { | |
9395 LOBYTE(v21) = v21 & 0x7F; | |
9396 *(int *)v20 = v21; | |
9397 } | |
9398 } | |
9399 v20 += 76; | |
9400 } | |
9401 } | |
605 | 9402 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9403 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9404 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9405 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9406 pParty->field_709 = 0; | |
659 | 9407 Party__CountHirelings(); |
0 | 9408 break; |
9409 case 243: | |
9410 v17 = (char *)&this->uSkillPoints; | |
501 | 9411 result = *v17; |
9412 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9413 { | |
9414 *(int *)v17 -= (int)pValue; | |
9415 result = v17; | |
9416 } | |
0 | 9417 else |
9418 *(int *)v17 = 0; | |
9419 break; | |
9420 case 275: | |
9421 v16 = (char *)&pOutdoor->ddm; | |
9422 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9423 v16 = (char *)&pIndoor->dlv; | |
501 | 9424 *((int *)v16 + 2) -= (int)pValue; |
0 | 9425 if ( *((int *)v16 + 2) < -10000 ) |
9426 *((int *)v16 + 2) = -10000; | |
9427 break; | |
9428 case 306: | |
501 | 9429 result = VarNum - 306; |
9430 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9431 { | |
9432 result = (bool)pValue; | |
9433 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9434 } |
0 | 9435 else |
9436 LABEL_88: | |
9437 dword_5B65C4 = 1; | |
9438 break; | |
9439 } | |
501 | 9440 return result; |
0 | 9441 } |
9442 v11 = this->field_1A50; | |
501 | 9443 v22 = (signed __int16)pValue; |
0 | 9444 } |
9445 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9446 return result; |
9447 } | |
9448 switch ( VarNum ) | |
0 | 9449 { |
9450 case 308: | |
501 | 9451 result = (bool)pValue; |
9452 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9453 break; |
9454 case 309: | |
501 | 9455 result = (bool)pValue; |
9456 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9457 break; |
9458 case 310: | |
501 | 9459 result = (bool)pValue; |
9460 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9461 break; |
9462 case 311: | |
501 | 9463 result = (bool)pValue; |
9464 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9465 break; |
9466 case 312: | |
501 | 9467 result = (bool)pValue; |
9468 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9469 break; |
9470 case 313: | |
501 | 9471 result = (bool)pValue; |
9472 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9473 break; |
9474 } | |
9475 } | |
9476 else | |
9477 { | |
501 | 9478 if ( (signed int)VarNum >= 123 ) |
9479 { | |
9480 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9481 } |
9482 else | |
9483 { | |
501 | 9484 switch ( VarNum ) |
0 | 9485 { |
9486 case VAR_RandomGold: | |
501 | 9487 v6 = rand() % (signed int)pValue + 1; |
0 | 9488 if ( v6 > pParty->uNumGold ) |
9489 v6 = pParty->uNumGold; | |
9490 Party::TakeGold(v6); | |
9491 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9492 ShowStatusBarString(pTmpBuf, 2); |
0 | 9493 GameUI_DrawFoodAndGold(); |
501 | 9494 return result; |
0 | 9495 case VAR_RandomFood: |
501 | 9496 v7 = rand() % (signed int)pValue + 1; |
0 | 9497 if ( v7 > pParty->uNumFoodRations ) |
9498 v7 = pParty->uNumFoodRations; | |
9499 Party::TakeFood(v7); | |
9500 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9501 ShowStatusBarString(pTmpBuf, 2u); | |
9502 GameUI_DrawFoodAndGold(); | |
605 | 9503 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9504 v8 = 8 * v4 + 400; | |
9505 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9506 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
501 | 9507 return result; |
0 | 9508 case VAR_CurrentHP: |
501 | 9509 ReceiveDamage((signed int)pValue, 4); |
605 | 9510 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9511 v8 = 8 * v4 + 400; | |
9512 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9513 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9514 return result; | |
0 | 9515 case VAR_CurrentSP: |
9516 v9 = (char *)&this->sMana; | |
501 | 9517 v10 = this->sMana - (signed int)pValue < 0; |
9518 *(int *)v9 -= (int)pValue; | |
0 | 9519 if ( v10 ) |
9520 *(int *)v9 = 0; | |
605 | 9521 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9522 v8 = 8 * v4 + 400; | |
9523 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9524 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9525 return result; | |
0 | 9526 case VAR_ACModifier: |
501 | 9527 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9528 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9529 v8 = 8 * v4 + 400; | |
9530 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9531 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9532 return result; | |
0 | 9533 case VAR_BaseLevel: |
501 | 9534 this->uLevel -= (unsigned __int8)pValue; |
605 | 9535 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9536 v8 = 8 * v4 + 400; | |
9537 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9538 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9539 return result; | |
0 | 9540 case VAR_LevelModifier: |
501 | 9541 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9542 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9543 v8 = 8 * v4 + 400; | |
9544 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9545 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9546 return result; | |
0 | 9547 case VAR_Age: |
501 | 9548 this->sAgeModifier -= (signed __int16)pValue; |
9549 return result; | |
0 | 9550 case VAR_Award: |
605 | 9551 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9552 return result; | |
0 | 9553 case VAR_Experience: |
9554 v12 = (char *)&this->uExperience; | |
501 | 9555 v13 = (signed int)pValue; |
9556 v14 = *(int *)v12 < (unsigned int)pValue; | |
9557 *(int *)v12 -= (int)pValue; | |
0 | 9558 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9559 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9560 v8 = 8 * v4 + 400; | |
9561 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9562 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9563 return result; | |
0 | 9564 case VAR_QBits_QuestsDone: |
501 | 9565 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9566 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9567 return true; |
0 | 9568 case VAR_PlayerItemInHands: |
501 | 9569 v15 = this->pInventoryIndices; |
0 | 9570 break; |
9571 case VAR_FixedGold: | |
501 | 9572 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9573 goto LABEL_88; |
501 | 9574 Party::TakeGold((unsigned int)pValue); |
9575 return result; | |
0 | 9576 case VAR_MightBonus: |
9577 case VAR_ActualMight: | |
501 | 9578 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9579 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9580 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9581 v8 = 8 * v4 + 400; | |
9582 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9583 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9584 return result; | |
0 | 9585 case VAR_IntellectBonus: |
9586 case VAR_ActualIntellect: | |
501 | 9587 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9588 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9589 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9590 v8 = 8 * v4 + 400; | |
9591 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9592 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9593 return result; | |
0 | 9594 case VAR_PersonalityBonus: |
9595 case VAR_ActualPersonality: | |
501 | 9596 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9597 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9598 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9599 v8 = 8 * v4 + 400; | |
9600 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9601 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9602 return result; | |
0 | 9603 case VAR_EnduranceBonus: |
9604 case VAR_ActualEndurance: | |
501 | 9605 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9606 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9607 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9608 v8 = 8 * v4 + 400; | |
9609 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9610 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9611 return result; | |
0 | 9612 case VAR_SpeedBonus: |
9613 case VAR_ActualSpeed: | |
501 | 9614 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9615 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9616 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9617 v8 = 8 * v4 + 400; | |
9618 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9619 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9620 return result; | |
0 | 9621 case VAR_AccuracyBonus: |
9622 case VAR_ActualAccuracy: | |
501 | 9623 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9624 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9625 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9626 v8 = 8 * v4 + 400; | |
9627 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9628 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9629 return result; | |
0 | 9630 case VAR_LuckBonus: |
9631 case VAR_ActualLuck: | |
501 | 9632 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9633 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9634 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9635 v8 = 8 * v4 + 400; | |
9636 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9637 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9638 return result; | |
0 | 9639 case VAR_BaseMight: |
501 | 9640 this->uMight -= (unsigned __int16)pValue; |
605 | 9641 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9642 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9643 v8 = 8 * v4 + 400; | |
9644 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9645 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9646 return result; | |
0 | 9647 case VAR_BaseIntellect: |
501 | 9648 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9649 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9650 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9651 v8 = 8 * v4 + 400; | |
9652 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9653 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9654 return result; | |
0 | 9655 case VAR_BasePersonality: |
501 | 9656 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9657 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9658 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9659 v8 = 8 * v4 + 400; | |
9660 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9661 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9662 return result; | |
0 | 9663 case VAR_BaseEndurance: |
501 | 9664 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9665 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9666 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9667 v8 = 8 * v4 + 400; | |
9668 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9669 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9670 return result; | |
0 | 9671 case VAR_BaseSpeed: |
501 | 9672 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9673 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9674 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9675 v8 = 8 * v4 + 400; | |
9676 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9677 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9678 return result; | |
0 | 9679 case VAR_BaseAccuracy: |
501 | 9680 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9681 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9682 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9683 v8 = 8 * v4 + 400; | |
9684 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9685 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9686 return result; | |
0 | 9687 case VAR_BaseLuck: |
501 | 9688 this->uLuck -= (unsigned __int16)pValue; |
605 | 9689 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9690 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9691 v8 = 8 * v4 + 400; | |
9692 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9693 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9694 return result; | |
0 | 9695 case VAR_FireResistance: |
501 | 9696 this->sResFireBase -= (signed __int16)pValue; |
605 | 9697 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9698 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9699 v8 = 8 * v4 + 400; | |
9700 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9701 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9702 return result; | |
0 | 9703 case VAR_AirResistance: |
501 | 9704 this->sResAirBase -= (signed __int16)pValue; |
605 | 9705 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9706 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9707 v8 = 8 * v4 + 400; | |
9708 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9709 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9710 return result; | |
0 | 9711 case VAR_WaterResistance: |
501 | 9712 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9713 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9714 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9715 v8 = 8 * v4 + 400; | |
9716 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9717 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9718 return result; | |
0 | 9719 case VAR_EarthResistance: |
501 | 9720 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9721 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9722 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9723 v8 = 8 * v4 + 400; | |
9724 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9725 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9726 return result; | |
0 | 9727 case VAR_SpiritResistance: |
501 | 9728 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9729 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9730 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9731 v8 = 8 * v4 + 400; | |
9732 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9733 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9734 return result; | |
0 | 9735 case VAR_MindResistance: |
501 | 9736 this->sResMindBase -= (signed __int16)pValue; |
605 | 9737 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9738 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9739 v8 = 8 * v4 + 400; | |
9740 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9741 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9742 return result; | |
0 | 9743 case VAR_BodyResistance: |
501 | 9744 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9745 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9746 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9747 v8 = 8 * v4 + 400; | |
9748 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9749 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9750 return result; | |
0 | 9751 case VAR_LightResistance: |
501 | 9752 this->sResLightBase -= (signed __int16)pValue; |
605 | 9753 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9754 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9755 v8 = 8 * v4 + 400; | |
9756 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9757 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9758 return result; | |
0 | 9759 case VAR_DarkResistance: |
501 | 9760 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9761 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9762 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9763 v8 = 8 * v4 + 400; | |
9764 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9765 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9766 return result; | |
0 | 9767 case VAR_MagicResistance: |
501 | 9768 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9769 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9770 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9771 v8 = 8 * v4 + 400; | |
9772 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9773 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9774 return result; | |
0 | 9775 case VAR_FireResistanceBonus: |
501 | 9776 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9777 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9778 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9779 v8 = 8 * v4 + 400; | |
9780 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9781 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9782 return result; | |
0 | 9783 case VAR_AirResistanceBonus: |
501 | 9784 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9785 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9786 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9787 v8 = 8 * v4 + 400; | |
9788 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9789 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9790 return result; | |
0 | 9791 case VAR_WaterResistanceBonus: |
501 | 9792 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9793 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9794 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9795 v8 = 8 * v4 + 400; | |
9796 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9797 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9798 return result; | |
0 | 9799 case VAR_EarthResistanceBonus: |
501 | 9800 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9801 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9802 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9803 v8 = 8 * v4 + 400; | |
9804 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9805 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9806 return result; | |
0 | 9807 case VAR_SpiritResistanceBonus: |
501 | 9808 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9809 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9810 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9811 v8 = 8 * v4 + 400; | |
9812 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9813 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9814 return result; | |
0 | 9815 case VAR_MindResistanceBonus: |
501 | 9816 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9817 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9818 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9819 v8 = 8 * v4 + 400; | |
9820 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9821 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9822 return result; | |
0 | 9823 case VAR_BodyResistanceBonus: |
501 | 9824 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9825 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9826 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9827 v8 = 8 * v4 + 400; | |
9828 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9829 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9830 return result; | |
0 | 9831 case VAR_LightResistanceBonus: |
501 | 9832 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9833 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9834 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9835 v8 = 8 * v4 + 400; | |
9836 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9837 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9838 return result; | |
0 | 9839 case VAR_DarkResistanceBonus: |
501 | 9840 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9841 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9842 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9843 v8 = 8 * v4 + 400; | |
9844 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9845 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9846 return result; | |
0 | 9847 case VAR_MagicResistanceBonus: |
501 | 9848 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9849 v25 = 0; |
187 | 9850 v23 = SPEECH_91; |
9851 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9852 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9853 v8 = 8 * v4 + 400; | |
9854 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9855 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9856 return result; | |
0 | 9857 case VAR_FixedFood: |
501 | 9858 Party::TakeFood((unsigned int)pValue); |
605 | 9859 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9860 v8 = 8 * v4 + 400; | |
9861 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9862 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9863 return result; | |
0 | 9864 case VAR_StaffSkill: |
9865 case VAR_SwordSkill: | |
9866 case VAR_DaggerSkill: | |
9867 case VAR_AxeSkill: | |
9868 case VAR_SpearSkill: | |
9869 case VAR_BowSkill: | |
9870 case VAR_MaceSkill: | |
9871 case VAR_BlasterSkill: | |
9872 case VAR_ShieldSkill: | |
9873 case VAR_LeatherSkill: | |
9874 case VAR_SkillChain: | |
9875 case VAR_PlateSkill: | |
9876 case VAR_FireSkill: | |
9877 case VAR_AirSkill: | |
9878 case VAR_WaterSkill: | |
9879 case VAR_EarthSkill: | |
9880 case VAR_SpiritSkill: | |
9881 case VAR_MindSkill: | |
9882 case VAR_BodySkill: | |
9883 case VAR_LightSkill: | |
9884 case VAR_DarkSkill: | |
9885 case VAR_IdentifyItemSkill: | |
9886 case VAR_MerchantSkill: | |
9887 case VAR_RepairSkill: | |
9888 case VAR_BodybuildingSkill: | |
9889 case VAR_MeditationSkill: | |
9890 case VAR_PerceptionSkill: | |
9891 case VAR_DiplomacySkill: | |
9892 case VAR_DisarmTrapSkill: | |
9893 case VAR_LearningSkill: | |
501 | 9894 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9895 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9896 v8 = 8 * v4 + 400; | |
9897 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9898 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
9899 return result; | |
0 | 9900 case VAR_Cursed: |
9901 case VAR_Weak: | |
9902 case VAR_Asleep: | |
9903 case VAR_Afraid: | |
9904 case VAR_Drunk: | |
9905 case VAR_Insane: | |
9906 case VAR_PoisonedGreen: | |
9907 case VAR_DiseasedGreen: | |
9908 case VAR_PoisonedYellow: | |
9909 case VAR_DiseasedYellow: | |
9910 case VAR_PoisonedRed: | |
9911 case VAR_DiseasedRed: | |
9912 case VAR_Paralyzed: | |
9913 case VAR_Unconsious: | |
9914 case VAR_Dead: | |
9915 case VAR_Stoned: | |
9916 case VAR_Eradicated: | |
501 | 9917 *((int *)this + 2 * VarNum - 210) = 0; |
9918 *((int *)this + 2 * result - 209) = 0; | |
0 | 9919 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9920 v8 = 8 * v4 + 400; | |
9921 LOBYTE(v8) = (8 * v4 - 112) | 4; | |
9922 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); | |
501 | 9923 return result; |
605 | 9924 default: |
9925 return result; | |
9926 } | |
9927 for (v3 = 1; v3 < 126; v3++) | |
9928 { | |
9929 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9930 { |
605 | 9931 RemoveItemAtInventoryIndex(v3); |
501 | 9932 return true; |
0 | 9933 } |
605 | 9934 } |
501 | 9935 if ( pParty->pPickedItem.uItemID == pValue ) |
9936 { | |
605 | 9937 pMouse->RemoveHoldingItem(); |
9938 return true; | |
9939 } | |
9940 return false; | |
0 | 9941 } |
9942 } | |
9943 } | |
9944 // 5B65C4: using guessed type int dword_5B65C4; | |
9945 // 5B65CC: using guessed type int dword_5B65CC; |