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