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