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