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