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