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