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