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