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