Mercurial > mm7
annotate Player.cpp @ 994:3431f6abc786
GameUI clean
author | Nomad |
---|---|
date | Tue, 14 May 2013 12:35:06 +0200 |
parents | 087a9af8e0ec |
children | 5876a9cafa3e |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
0 | 3 #include "OSAPI.h" |
4 #include "Player.h" | |
5 #include "PlayerFrameTable.h" | |
6 #include "Texture.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Party.h" | |
816 | 9 #include "Log.h" |
0 | 10 #include "LOD.h" |
11 #include "Monsters.h" | |
12 #include "GUIWindow.h" | |
13 #include "Viewport.h" | |
14 #include "Actor.h" | |
15 #include "Game.h" | |
16 #include "Mouse.h" | |
17 #include "TurnEngine.h" | |
18 #include "Events.h" | |
19 #include "Events2D.h" | |
20 #include "Outdoor.h" | |
21 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Awards.h" |
189 | 24 #include "texts.h" |
816 | 25 |
0 | 26 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
27 #include "MM7.h" |
0 | 28 |
29 | |
30 | |
31 | |
32 | |
33 | |
34 /* 381 */ | |
35 #pragma pack(push, 1) | |
290 | 36 struct PlayerCreation_AttributeProps |
0 | 37 { |
38 unsigned __int8 uBaseValue; | |
39 char uMaxValue; | |
40 char uDroppedStep; | |
41 char uBaseStep; | |
42 }; | |
43 #pragma pack(pop) | |
44 | |
45 | |
46 #pragma pack(push, 1) | |
290 | 47 |
48 | |
49 | |
0 | 50 #pragma pack(pop) |
290 | 51 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
52 { | |
53 {{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},}, | |
54 {{ 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},}, | |
55 {{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},}, | |
56 {{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 | 57 }; |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 // available skills per class ( 9 classes X 37 skills ) | |
65 // 0 - not available | |
66 // 1 - available | |
67 // 2 - primary skill | |
68 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
69 { | |
70 {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}, | |
71 {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}, | |
72 {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}, | |
73 {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}, | |
74 {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}, | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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 | |
79 }; | |
80 | |
81 | |
82 | |
83 | |
84 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
85 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
86 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}; | |
87 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}; | |
88 | |
89 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
90 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
91 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
93 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
94 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
96 | |
97 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
98 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
99 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
101 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
102 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
104 | |
105 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
106 | |
107 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
108 | |
94 | 109 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 110 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 111 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 112 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 | 113 |
114 | |
115 | |
816 | 116 unsigned short base_recovery_times_per_weapon_type[12] = |
117 { | |
118 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
119 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
120 60, // PLAYER_SKILL_DAGGER | |
121 100, // PLAYER_SKILL_AXE | |
122 80, // PLAYER_SKILL_SPEAR | |
123 100, // PLAYER_SKILL_BOW | |
124 80, // PLAYER_SKILL_MACE | |
125 30, // PLAYER_SKILL_BLASTER | |
126 10, // PLAYER_SKILL_SHIELD | |
127 10, // PLAYER_SKILL_LEATHER | |
128 20, // PLAYER_SKILL_CHAIN | |
129 30 // PLAYER_SKILL_PLATE | |
130 }; | |
131 | |
132 | |
0 | 133 |
134 //----- (00490913) -------------------------------------------------------- | |
135 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
136 { | |
137 signed int v0; // edi@1 | |
138 signed int v1; // esi@1 | |
139 int v2; // ebx@2 | |
140 int v3; // ecx@17 | |
141 signed int v4; // eax@17 | |
142 int v5; // edx@18 | |
143 signed int v6; // ecx@18 | |
144 signed int v8; // [sp+Ch] [bp-8h]@1 | |
145 signed int v9; // [sp+10h] [bp-4h]@2 | |
146 | |
147 v8 = 50; | |
148 v0 = 50; | |
149 v1 = 0; | |
150 do | |
151 { | |
152 v9 = 0; | |
153 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
154 do | |
155 { | |
156 if ( v9 ) | |
157 { | |
158 switch ( v9 ) | |
159 { | |
160 case 1: | |
161 v0 = pParty->pPlayers[v1].uIntelligence; | |
162 break; | |
163 case 2: | |
164 v0 = pParty->pPlayers[v1].uWillpower; | |
165 break; | |
166 case 3: | |
167 v0 = pParty->pPlayers[v1].uEndurance; | |
168 break; | |
169 case 4: | |
170 v0 = pParty->pPlayers[v1].uAccuracy; | |
171 break; | |
172 case 5: | |
173 v0 = pParty->pPlayers[v1].uSpeed; | |
174 break; | |
175 case 6: | |
176 v0 = pParty->pPlayers[v1].uLuck; | |
177 break; | |
178 } | |
179 } | |
180 else | |
181 { | |
182 v0 = pParty->pPlayers[v1].uMight; | |
183 } | |
184 v3 = v2 + v9; | |
290 | 185 v4 = StatTable[0][v3].uBaseValue; |
0 | 186 if ( v0 >= v4 ) |
187 { | |
290 | 188 v5 = StatTable[0][v3].uDroppedStep; |
189 v6 = StatTable[0][v3].uBaseStep; | |
0 | 190 } |
191 else | |
192 { | |
290 | 193 v5 = StatTable[0][v3].uBaseStep; |
194 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 195 } |
196 v8 += v5 * (v4 - v0) / v6; | |
197 ++v9; | |
198 } | |
199 while ( v9 <= 6 ); | |
200 ++v1; | |
201 } | |
202 while ( v1 < 4 ); | |
203 return v8; | |
204 } | |
205 | |
206 | |
207 | |
208 //----- (00427730) -------------------------------------------------------- | |
209 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
210 { | |
488 | 211 if (sMana >= uRequiredMana) |
212 { | |
213 sMana -= uRequiredMana; | |
214 return true; | |
215 } | |
216 | |
217 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
218 return false; | |
0 | 219 } |
220 | |
221 | |
222 //----- (004BE2DD) -------------------------------------------------------- | |
886 | 223 void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx) |
0 | 224 { |
225 Player *v4; // edi@1 | |
226 char *v5; // esi@1 | |
227 float v6; // ST04_4@1 | |
228 signed int v7; // eax@1 | |
229 signed int v8; // ebx@1 | |
230 | |
231 auto a4 = _2devent_idx; | |
232 v4 = this; | |
233 v5 = (char *)this + 36 * a3; | |
234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
235 //v6 = p2DEvents_minus1__20[13 * a4]; | |
236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
917 | 237 v8 = GetPriceSell(v7, v6); |
0 | 238 if ( v5[552] & 2 ) |
239 v8 = 1; | |
240 if ( v8 < 1 ) | |
241 v8 = 1; | |
242 RemoveItemAtInventoryIndex(a2); | |
243 Party::SetGold(pParty->uNumGold + v8); | |
244 } | |
245 | |
246 | |
247 | |
248 //----- (0043EEF3) -------------------------------------------------------- | |
249 bool Player::_43EEF3() | |
250 { | |
251 signed int v1; // esi@1 | |
252 PlayerEquipment *v2; // edx@1 | |
253 bool result; // eax@2 | |
254 | |
255 v1 = 0; | |
256 v2 = &this->pEquipment; | |
257 while ( 1 ) | |
258 { | |
898 | 259 result = v2->uShield; |
260 if ( v2->uShield ) | |
0 | 261 { |
232 | 262 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 263 if ( result ) |
264 { | |
265 if ( result != 64 && result != 65 ) | |
266 break; | |
267 } | |
268 } | |
269 ++v1; | |
270 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
271 if ( v1 >= 16 ) | |
272 { | |
273 LOBYTE(result) = 1; | |
274 return result; | |
275 } | |
276 } | |
277 LOBYTE(result) = 0; | |
278 return result; | |
279 } | |
280 | |
281 | |
282 | |
283 //----- (004B8040) -------------------------------------------------------- | |
284 int Player::_4B8040_condition_time(unsigned int uCondition) | |
285 { | |
286 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
287 } | |
288 | |
289 //----- (004B807C) -------------------------------------------------------- | |
290 int Player::_4B807C(float a2) | |
291 { | |
292 Player *v2; // edi@1 | |
293 unsigned int v3; // eax@1 | |
294 int v4; // esi@1 | |
295 unsigned int v5; // ebx@7 | |
296 int v6; // eax@8 | |
297 signed __int64 v7; // qax@13 | |
298 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
299 signed int v10; // [sp+8h] [bp-8h]@4 | |
300 int v11; // [sp+Ch] [bp-4h]@6 | |
301 | |
302 v2 = this; | |
303 v3 = GetMajorConditionIdx(); | |
304 v4 = 0; | |
305 if ( (signed int)v3 >= 14 ) | |
306 { | |
307 if ( (signed int)v3 <= 15 ) | |
308 { | |
309 v10 = 5; | |
310 v9 = v3; | |
311 goto LABEL_6; | |
312 } | |
313 if ( v3 == 16 ) | |
314 { | |
315 v10 = 10; | |
316 v9 = 16; | |
317 LABEL_6: | |
318 v11 = _4B8040_condition_time(v9); | |
319 goto LABEL_13; | |
320 } | |
321 } | |
322 v10 = 1; | |
323 v5 = 0; | |
324 do | |
325 { | |
326 v6 = _4B8040_condition_time(v5); | |
327 if ( v6 > v4 ) | |
328 v4 = v6; | |
329 ++v5; | |
330 } | |
331 while ( (signed int)v5 <= 13 ); | |
332 v11 = v4; | |
333 if ( !v4 ) | |
334 v11 = 1; | |
335 LABEL_13: | |
336 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
337 if ( (signed int)v7 < 1 ) | |
338 LODWORD(v7) = 1; | |
339 return v7; | |
340 } | |
341 | |
342 //----- (004B8102) -------------------------------------------------------- | |
917 | 343 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 344 { |
345 signed int v3; // esi@1 | |
346 signed int result; // eax@3 | |
347 | |
917 | 348 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
349 if ( v3 > uRealValue ) | |
350 v3 = uRealValue; | |
0 | 351 result = 1; |
352 if ( v3 >= 1 ) | |
353 result = v3; | |
354 return result; | |
355 } | |
356 | |
357 //----- (004B8142) -------------------------------------------------------- | |
749 | 358 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
359 { | |
360 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
361 assert (price > 0); | |
362 | |
363 if (price < uRealValue) | |
364 price = uRealValue; | |
365 return price; | |
0 | 366 } |
367 | |
368 //----- (004B8179) -------------------------------------------------------- | |
916 | 369 int Player::GetPriceIdentification(float a2) |
0 | 370 { |
371 signed int v2; // esi@1 | |
372 int v3; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v2 = (signed __int64)(a2 * 50.0); | |
376 v3 = v2 * (100 - GetMerchant()) / 100; | |
377 if ( v3 < v2 / 3 ) | |
378 v3 = v2 / 3; | |
379 result = 1; | |
380 if ( v3 >= 1 ) | |
381 result = v3; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B81C3) -------------------------------------------------------- | |
916 | 386 int Player::GetPriceRepair(int a2, float a3) |
0 | 387 { |
388 signed int v3; // esi@1 | |
389 int v4; // ecx@1 | |
390 signed int result; // eax@3 | |
391 | |
392 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
393 v4 = v3 * (100 - GetMerchant()) / 100; | |
394 if ( v4 < v3 / 3 ) | |
395 v4 = v3 / 3; | |
396 result = 1; | |
397 if ( v4 >= 1 ) | |
398 result = v4; | |
399 return result; | |
400 } | |
401 | |
402 //----- (004B8213) -------------------------------------------------------- | |
403 int Player::_4B8213(int a2, float a3) | |
404 { | |
405 signed __int64 v3; // qax@1 | |
406 | |
407 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
408 if ( (signed int)v3 < 1 ) | |
409 LODWORD(v3) = 1; | |
410 return v3; | |
411 } | |
412 | |
413 //----- (004B8233) -------------------------------------------------------- | |
414 int Player::_4B8233(int a2, float a3) | |
415 { | |
416 signed __int64 v3; // qax@1 | |
417 | |
418 v3 = (signed __int64)((double)a2 * a3); | |
419 if ( (signed int)v3 < 1 ) | |
420 LODWORD(v3) = 1; | |
421 return v3; | |
422 } | |
423 | |
424 //----- (004B824B) -------------------------------------------------------- | |
425 int Player::_4B824B(float a2) | |
426 { | |
427 signed __int64 v2; // qax@1 | |
428 | |
429 v2 = (signed __int64)(a2 * 50.0); | |
430 if ( (signed int)v2 < 1 ) | |
431 LODWORD(v2) = 1; | |
432 return v2; | |
433 } | |
434 | |
435 //----- (004B8265) -------------------------------------------------------- | |
436 int Player::_4B8265(int a2, float a3) | |
437 { | |
438 signed __int64 v3; // qax@1 | |
439 | |
440 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
441 if ( (signed int)v3 < 1 ) | |
442 LODWORD(v3) = 1; | |
443 return v3; | |
444 } | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 //----- (004B6FF9) -------------------------------------------------------- | |
451 int Player::_4B6FF9() | |
452 { | |
453 Player *v1; // esi@1 | |
454 signed int v2; // eax@1 | |
455 char v3; // zf@4 | |
456 | |
457 v1 = this; | |
336 | 458 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 459 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
460 { | |
461 if ( GetMajorConditionIdx() == 18 ) | |
462 goto LABEL_6; | |
463 v3 = GetMajorConditionIdx() == 17; | |
464 } | |
465 else | |
466 { | |
467 v3 = GetMajorConditionIdx() == 18; | |
468 } | |
469 if ( !v3 ) | |
470 return 1; | |
471 LABEL_6: | |
472 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
473 return 1; | |
474 return 0; | |
475 } | |
476 | |
477 | |
478 | |
479 //----- (00421E75) -------------------------------------------------------- | |
480 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
481 { | |
482 int v2; // eax@1 | |
483 unsigned int result; // eax@3 | |
484 | |
485 v2 = *a2; | |
486 if ( *a2 >= 126 || v2 < 0 ) | |
487 { | |
488 result = 0; | |
489 } | |
490 else | |
491 { | |
492 result = this->pInventoryIndices[v2]; | |
493 if ( (result & 0x80000000u) != 0 ) | |
494 { | |
495 *a2 = -1 - result; | |
496 result = this->pInventoryIndices[-1 - result]; | |
497 } | |
498 } | |
499 return result; | |
500 } | |
501 | |
502 | |
503 | |
504 //----- (004160CA) -------------------------------------------------------- | |
505 char Player::_4160CA(int a2) | |
506 { | |
507 Player *v2; // esi@1 | |
508 signed int v3; // edx@1 | |
509 signed int v4; // ebx@1 | |
510 ItemGen *v5; // eax@1 | |
511 int v6; // edi@2 | |
512 signed int i; // edx@8 | |
513 ItemGen **v8; // ecx@9 | |
514 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
515 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
516 int v12; // [sp+120h] [bp-4h]@1 | |
517 | |
518 auto a1 = this; | |
519 | |
520 v12 = a2; | |
521 v2 = a1; | |
522 v3 = 0; | |
523 v10[0] = 0; | |
524 v4 = 0; | |
525 memset(&v10[1], 0, 0x110u); | |
526 v11 = 0; | |
527 v5 = a1->pInventoryItems; | |
528 do | |
529 { | |
530 v6 = 0; | |
531 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
532 v10[v4++] = v3; | |
533 ++v3; | |
534 ++v5; | |
535 } | |
536 while ( v3 < 138 ); | |
537 if ( v4 ) | |
538 { | |
539 if ( v12 ) | |
540 { | |
541 if ( v12 > 0 ) | |
542 { | |
543 do | |
544 { | |
545 LOWORD(v5) = 9 * v10[v6]; | |
546 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
547 { | |
548 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
549 v5->uItemID |= 2u; | |
550 } | |
551 ++v6; | |
552 } | |
553 while ( v6 < v12 ); | |
554 } | |
555 } | |
556 else | |
557 { | |
558 for ( i = 0; i < v4; ++i ) | |
559 { | |
560 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
561 v5 = *v8; | |
562 if ( !(BYTE1(v5) & 2) ) | |
563 { | |
564 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
565 *v8 = v5; | |
566 } | |
567 } | |
568 } | |
569 } | |
570 return (char)v5; | |
571 } | |
572 | |
573 //----- (004948B1) -------------------------------------------------------- | |
187 | 574 void Player::PlaySound(PlayerSpeech speech, int a3) |
575 { | |
576 //Player *pPlayer; // edi@1 | |
577 //int v4; // eax@4 | |
0 | 578 signed int v5; // esi@4 |
203 | 579 unsigned char *v6; // ebx@4 |
0 | 580 signed int v7; // ecx@5 |
581 unsigned __int8 v8; // al@6 | |
582 int v9; // eax@10 | |
187 | 583 //unsigned int pVoiceID; // ecx@10 |
0 | 584 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
585 //signed int v12; // eax@11 |
0 | 586 signed int v13; // esi@12 |
587 int v14; // eax@12 | |
187 | 588 //int v15; // eax@17 |
248 | 589 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 590 signed int v17; // ecx@19 |
591 char *pSoundID; // edi@20 | |
592 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 593 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 594 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
595 int pSoundId; // [sp+30h] [bp+8h]@4 | |
596 | |
187 | 597 //pPlayer = this; |
598 //pPlayer2 = this; | |
599 | |
0 | 600 pPlayerNum = 1; |
187 | 601 for (int i = 0; i < 4; ++i) |
602 if (&pParty->pPlayers[i] == this) | |
603 { | |
604 pPlayerNum = i + 1; | |
0 | 605 break; |
187 | 606 } |
607 | |
608 //v4 = a2;//102 | |
0 | 609 v5 = 0; |
610 pSoundId = 0; | |
203 | 611 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
612 if (uVoicesVolumeMultiplier) | |
0 | 613 { |
614 v7 = 0; | |
615 do | |
616 { | |
617 v8 = v6[v7]; | |
618 if ( v8 ) | |
619 v20[v5++] = v8; | |
620 ++v7; | |
621 } | |
622 while ( v7 < 2 ); | |
623 if ( v5 ) | |
624 { | |
625 v9 = rand(); | |
187 | 626 //pVoiceID = uVoiceID; |
0 | 627 v11 = v20[v9 % v5]; |
203 | 628 |
629 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
630 { | |
631 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
632 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 633 } |
634 } | |
635 } | |
203 | 636 |
0 | 637 v13 = 0; |
638 v14 = (int)(v6 + 3); | |
639 do | |
640 { | |
641 if ( *(char *)v14 ) | |
642 v20[v13++] = *(char *)v14; | |
643 ++v14; | |
644 } | |
645 while ( -3 - (signed int)v6 + v14 < 5 ); | |
646 if ( v13 ) | |
647 { | |
648 pPlayerNum = 0; | |
248 | 649 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
650 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 651 { |
652 v17 = 0; | |
764 | 653 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 654 { |
655 LABEL_23: | |
656 v17 = 0; | |
657 } | |
658 else | |
659 { | |
660 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
661 while ( *(int *)pSoundID != pSoundId ) | |
662 { | |
663 ++v17; | |
664 pSoundID += 120; | |
764 | 665 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 666 goto LABEL_23; |
667 } | |
668 } | |
669 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
670 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
671 } | |
248 | 672 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 673 } |
674 //return v14; | |
0 | 675 } |
676 // 4948B1: using guessed type int var_1C[5]; | |
677 | |
678 //----- (00494A25) -------------------------------------------------------- | |
187 | 679 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
680 { | |
681 //signed int v3; // eax@1 | |
682 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 683 signed int v5; // edi@15 |
684 PlayerFrame *v6; // esi@17 | |
685 signed int v7; // eax@20 | |
686 | |
187 | 687 //LOWORD(v3) = this->expression; |
688 //v4 = expr; | |
689 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
690 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
691 { | |
692 int v3 = (unsigned)expression; | |
0 | 693 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
694 { | |
695 if ( v3 <= 7 ) | |
696 goto LABEL_12; | |
697 if ( v3 > 8 ) | |
698 { | |
699 if ( v3 > 11 ) | |
700 { | |
187 | 701 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
702 return; | |
0 | 703 goto LABEL_15; |
704 } | |
705 LABEL_12: | |
187 | 706 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
707 return; | |
0 | 708 goto LABEL_15; |
709 } | |
710 } | |
711 } | |
712 LABEL_15: | |
187 | 713 //LOWORD(v3) = a3; |
0 | 714 v5 = 0; |
715 this->uExpressionTimeLength = a3; | |
716 this->uExpressionTimePassed = 0; | |
717 if ( !a3 ) | |
718 { | |
719 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
720 { | |
721 LABEL_20: | |
722 v7 = 0; | |
723 } | |
724 else | |
725 { | |
726 v6 = pPlayerFrameTable->pFrames; | |
187 | 727 while ( v6->expression != new_expression ) |
0 | 728 { |
729 ++v5; | |
730 ++v6; | |
731 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
732 goto LABEL_20; | |
733 } | |
734 v7 = v5; | |
735 } | |
187 | 736 //v4 = expr; |
737 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
738 } | |
739 expression = new_expression; | |
0 | 740 viewparams->bRedrawGameUI = 1; |
741 } | |
742 | |
743 //----- (0049327B) -------------------------------------------------------- | |
744 int Player::_49327B(unsigned int uClass, int a3) | |
745 { | |
746 Player *v3; // esi@1 | |
747 char v4; // zf@4 | |
748 __int16 v5; // dx@9 | |
749 signed int result; // eax@84 | |
750 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
751 int v8; // [sp-4h] [bp-Ch]@3 | |
752 | |
753 v3 = this; | |
135 | 754 if ( this->classType == uClass ) |
0 | 755 { |
756 LABEL_84: | |
757 result = 1; | |
758 } | |
759 else | |
760 { | |
761 switch ( uClass ) | |
762 { | |
763 case 0u: | |
764 v8 = a3; | |
765 v7 = 1; | |
766 goto LABEL_4; | |
767 case 1u: | |
484 | 768 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 769 || _49327B(2u, a3) ) |
770 goto LABEL_84; | |
771 v8 = a3; | |
772 v7 = 3; | |
773 goto LABEL_4; | |
774 case 2u: | |
775 v5 = 19; | |
776 goto LABEL_82; | |
777 case 3u: | |
778 v5 = 21; | |
779 goto LABEL_82; | |
780 case 4u: | |
781 v8 = a3; | |
782 v7 = 5; | |
783 goto LABEL_4; | |
784 case 5u: | |
484 | 785 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 786 || _49327B(6u, a3) ) |
787 goto LABEL_84; | |
788 v8 = a3; | |
789 v7 = 7; | |
790 goto LABEL_4; | |
791 case 6u: | |
792 if ( !a3 ) | |
793 break; | |
794 v5 = 13; | |
795 goto LABEL_82; | |
796 case 7u: | |
797 if ( !a3 ) | |
798 break; | |
799 v5 = 15; | |
800 goto LABEL_82; | |
801 case 8u: | |
802 v8 = a3; | |
803 v7 = 9; | |
804 goto LABEL_4; | |
805 case 9u: | |
484 | 806 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 807 || _49327B(0xAu, a3) ) |
808 goto LABEL_84; | |
809 v8 = a3; | |
810 v7 = 11; | |
811 goto LABEL_4; | |
812 case 0xAu: | |
813 if ( !a3 ) | |
814 break; | |
815 v5 = 25; | |
816 goto LABEL_82; | |
817 case 0xBu: | |
818 if ( !a3 ) | |
819 break; | |
820 v5 = 27; | |
821 goto LABEL_82; | |
822 case 0xCu: | |
823 v8 = a3; | |
824 v7 = 13; | |
825 goto LABEL_4; | |
826 case 0xDu: | |
484 | 827 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 828 || _49327B(0xEu, a3) ) |
829 goto LABEL_84; | |
830 v8 = a3; | |
831 v7 = 15; | |
832 goto LABEL_4; | |
833 case 0xEu: | |
834 if ( !a3 ) | |
835 break; | |
836 v5 = 43; | |
837 goto LABEL_82; | |
838 case 0xFu: | |
839 if ( !a3 ) | |
840 break; | |
841 v5 = 45; | |
842 goto LABEL_82; | |
843 case 0x10u: | |
844 v8 = a3; | |
845 v7 = 17; | |
846 goto LABEL_4; | |
847 case 0x11u: | |
484 | 848 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 849 || _49327B(0x12u, a3) ) |
850 goto LABEL_84; | |
851 v8 = a3; | |
852 v7 = 19; | |
853 goto LABEL_4; | |
854 case 0x12u: | |
855 if ( !a3 ) | |
856 break; | |
857 v5 = 37; | |
858 goto LABEL_82; | |
859 case 0x13u: | |
860 v5 = 39; | |
861 goto LABEL_82; | |
862 case 0x14u: | |
863 v8 = a3; | |
864 v7 = 21; | |
865 goto LABEL_4; | |
866 case 0x15u: | |
484 | 867 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 868 || _49327B(0x16u, a3) ) |
869 goto LABEL_84; | |
870 v8 = a3; | |
871 v7 = 23; | |
872 goto LABEL_4; | |
873 case 0x16u: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 31; | |
877 goto LABEL_82; | |
878 case 0x17u: | |
879 if ( !a3 ) | |
880 break; | |
881 v5 = 33; | |
882 goto LABEL_82; | |
883 case 0x18u: | |
884 if ( !_49327B(0x19u, a3) ) | |
885 goto LABEL_56; | |
886 break; | |
887 case 0x19u: | |
888 LABEL_56: | |
484 | 889 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 890 || _49327B(0x1Au, a3) ) |
891 goto LABEL_84; | |
892 v8 = a3; | |
893 v7 = 27; | |
894 goto LABEL_4; | |
895 case 0x1Au: | |
896 if ( !a3 ) | |
897 break; | |
898 v5 = 65; | |
899 goto LABEL_82; | |
900 case 0x1Bu: | |
901 if ( !a3 ) | |
902 break; | |
903 v5 = 67; | |
904 goto LABEL_82; | |
905 case 0x1Cu: | |
906 v8 = a3; | |
907 v7 = 29; | |
908 goto LABEL_4; | |
909 case 0x1Du: | |
484 | 910 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 911 || _49327B(0x1Eu, a3) ) |
912 goto LABEL_84; | |
913 v8 = a3; | |
914 v7 = 31; | |
915 goto LABEL_4; | |
916 case 0x1Eu: | |
917 if ( !a3 ) | |
918 break; | |
919 v5 = 71; | |
920 goto LABEL_82; | |
921 case 0x1Fu: | |
922 if ( !a3 ) | |
923 break; | |
924 v5 = 73; | |
925 goto LABEL_82; | |
926 case 0x20u: | |
927 v8 = a3; | |
928 v7 = 33; | |
929 goto LABEL_4; | |
930 case 0x21u: | |
484 | 931 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 932 || _49327B(0x22u, a3) ) |
933 goto LABEL_84; | |
934 v8 = a3; | |
935 v7 = 35; | |
936 LABEL_4: | |
937 v4 = _49327B(v7, v8) == 0; | |
938 goto LABEL_83; | |
939 case 0x22u: | |
940 if ( !a3 ) | |
941 break; | |
942 v5 = 77; | |
943 goto LABEL_82; | |
944 case 0x23u: | |
945 if ( a3 ) | |
946 { | |
947 v5 = 79; | |
948 LABEL_82: | |
484 | 949 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 950 LABEL_83: |
951 if ( !v4 ) | |
952 goto LABEL_84; | |
953 } | |
954 break; | |
955 default: | |
956 break; | |
957 } | |
958 result = 0; | |
959 } | |
960 return result; | |
961 } | |
962 | |
963 | |
964 //----- (00492C0B) -------------------------------------------------------- | |
965 bool Player::CanAct() | |
966 { | |
967 bool result; // eax@2 | |
968 | |
969 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
970 result = 0; | |
971 else | |
972 result = 1; | |
973 return result; | |
974 } | |
975 | |
976 //----- (00492C40) -------------------------------------------------------- | |
977 bool Player::CanSteal() | |
978 { | |
979 int v1; // eax@1 | |
980 | |
981 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
982 return v1 != 0; | |
983 } | |
984 | |
985 //----- (00492C4E) -------------------------------------------------------- | |
986 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
987 { | |
988 char v2; // zf@9 | |
989 __int16 v4; // dx@13 | |
990 char v5; // zf@15 | |
991 | |
992 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
993 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
994 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
995 { | |
996 if ( uItemID == 533 ) | |
997 { | |
998 v2 = GetRace() == 1; | |
999 } | |
1000 else | |
1001 { | |
1002 if ( uItemID != 534 ) | |
1003 { | |
1004 if ( uItemID == 535 ) // | |
1005 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
1006 { | |
1007 switch ( this->uVoiceID ) | |
1008 { | |
1009 default: | |
1010 return 1; | |
1011 case 4u: | |
1012 case 5u: | |
1013 case 6u: | |
1014 case 7u: | |
1015 case 0xAu: | |
1016 case 0xBu: | |
1017 case 0xEu: // | |
1018 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
1019 case 0xFu: | |
1020 case 0x12u: | |
1021 case 0x13u: | |
1022 case 0x15u: | |
1023 case 0x18u: | |
1024 return 0; | |
1025 } | |
1026 return 0; | |
1027 } | |
1028 if ( uItemID == 536 ) // | |
1029 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
1030 { | |
1031 switch ( this->uVoiceID ) | |
1032 { | |
1033 case 4u: | |
1034 case 5u: | |
1035 case 6u: | |
1036 case 7u: | |
1037 case 0xAu: | |
1038 case 0xBu: | |
1039 case 0xEu: | |
1040 case 0xFu: | |
1041 case 0x12u: | |
1042 case 0x13u: | |
1043 case 0x15u: | |
1044 case 0x18u: | |
1045 return 1; | |
1046 default: | |
1047 return 0; | |
1048 } | |
1049 return 0; | |
1050 } | |
1051 if ( uItemID != 604 ) // | |
1052 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1053 return 1; | |
1054 v5 = _43EEF3() == 0; | |
1055 goto LABEL_23; | |
1056 } | |
1057 v2 = GetRace() == 3; // | |
1058 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1059 } | |
1060 } | |
1061 else | |
1062 { | |
1063 if ( uItemID != 532 ) | |
1064 { | |
1065 if ( uItemID != 515 && uItemID != 517 ) // | |
1066 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1067 { | |
1068 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1069 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1070 { | |
1071 LABEL_13: | |
1072 v4 = 99; | |
1073 LABEL_15: | |
484 | 1074 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1075 LABEL_23: |
1076 if ( !v5 ) | |
1077 return 1; | |
1078 return 0; | |
1079 } | |
1080 if ( uItemID != 525 ) | |
1081 { | |
1082 if ( uItemID != 527 ) | |
1083 { | |
1084 if ( uItemID != 531 ) | |
1085 return 1; | |
1086 v2 = GetRace() == 2; | |
1087 goto LABEL_10; | |
1088 } | |
1089 goto LABEL_13; | |
1090 } | |
1091 } | |
1092 v4 = 100; | |
1093 goto LABEL_15; | |
1094 } | |
1095 v2 = GetRace() == 0; | |
1096 } | |
1097 LABEL_10: | |
1098 if ( v2 ) | |
1099 return 1; | |
1100 return 0; | |
1101 } | |
1102 | |
1103 //----- (00492D65) -------------------------------------------------------- | |
1104 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1105 { | |
1106 Player *v3; // esi@1 | |
1107 Player **v4; // ebx@2 | |
1108 Player *v5; // ecx@21 | |
1109 Player *v6; // ecx@22 | |
1110 Player *v7; // ecx@29 | |
1111 Player *v8; // ecx@30 | |
1112 Player *v9; // ecx@37 | |
1113 Player *v10; // ecx@38 | |
1114 Player *v11; // ecx@45 | |
1115 Player *v12; // ecx@46 | |
1116 char *v13; // eax@49 | |
1117 Player *v14; // ecx@58 | |
1118 Player *v15; // ecx@59 | |
1119 Player *v16; // ecx@60 | |
1120 signed int result; // eax@76 | |
1121 signed int v18; // ecx@77 | |
1122 int v19; // eax@77 | |
1123 char v20; // al@80 | |
1124 signed int v21; // ebx@82 | |
1125 signed int v22; // esi@82 | |
1126 int v23; // [sp-8h] [bp-1Ch]@7 | |
1127 int v24; // [sp-8h] [bp-1Ch]@15 | |
1128 int v25; // [sp-8h] [bp-1Ch]@53 | |
1129 int v26; // [sp-4h] [bp-18h]@7 | |
1130 signed int v27; // [sp-4h] [bp-18h]@15 | |
1131 int v28; // [sp-4h] [bp-18h]@53 | |
1132 char *v29; // [sp+Ch] [bp-8h]@1 | |
1133 int v30; // [sp+10h] [bp-4h]@2 | |
1134 int v31; // [sp+20h] [bp+Ch]@82 | |
1135 | |
1136 v3 = this; | |
1137 v29 = (char *)this + 8 * uConditionIdx; | |
1138 if ( *(_QWORD *)v29 ) | |
1139 { | |
1140 LABEL_76: | |
1141 result = 0; | |
1142 } | |
1143 else | |
1144 { | |
1145 v4 = &pPlayers[1]; | |
1146 v30 = 0; | |
1147 do | |
1148 { | |
1149 if ( (*v4)->CanAct() ) | |
1150 ++v30; | |
1151 ++v4; | |
1152 } | |
1153 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1154 switch ( uConditionIdx ) | |
1155 { | |
1156 case 0u: | |
1157 v26 = 0; | |
1158 v23 = 30; | |
1159 goto LABEL_81; | |
1160 case 1u: | |
1161 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1162 goto LABEL_10; | |
1163 v26 = 0; | |
1164 v23 = 25; | |
1165 goto LABEL_81; | |
1166 case 2u: | |
1167 if ( a3 != 1 ) | |
1168 goto LABEL_82; | |
1169 if ( v3->HasEnchantedItemEquipped(22) ) | |
1170 goto LABEL_76; | |
1171 v27 = 3; | |
1172 v24 = 505; | |
1173 goto LABEL_16; | |
1174 case 3u: | |
1175 v26 = 0; | |
1176 v23 = 26; | |
1177 goto LABEL_81; | |
1178 case 4u: | |
1179 v26 = 0; | |
1180 v23 = 31; | |
1181 goto LABEL_81; | |
1182 case 5u: | |
1183 if ( a3 == 1 | |
1184 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1185 goto LABEL_76; | |
1186 v26 = 0; | |
1187 v23 = 29; | |
1188 goto LABEL_81; | |
1189 case 6u: | |
1190 case 8u: | |
1191 case 0xAu: | |
1192 if ( a3 == 1 ) | |
1193 { | |
1194 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1195 { | |
1196 --pParty->pPartyBuffs[13].uPower; | |
1197 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1198 pParty->pPartyBuffs[13].Reset(); | |
1199 } | |
1200 if ( v3->HasEnchantedItemEquipped(21) | |
1201 || v7->WearsItem(505, 3) | |
1202 || v8->WearsItem(530, 6) ) | |
1203 goto LABEL_76; | |
1204 } | |
1205 v26 = 0; | |
1206 v23 = 27; | |
1207 goto LABEL_81; | |
1208 case 7u: | |
1209 case 9u: | |
1210 case 0xBu: | |
1211 if ( a3 != 1 ) | |
1212 goto LABEL_40; | |
1213 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1214 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1215 goto LABEL_10; | |
900 | 1216 if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) ) |
0 | 1217 goto LABEL_76; |
1218 LABEL_40: | |
1219 v26 = 0; | |
1220 v23 = 28; | |
1221 goto LABEL_81; | |
1222 case 0xCu: | |
1223 if ( a3 != 1 ) | |
1224 goto LABEL_82; | |
1225 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1226 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1227 goto LABEL_10; | |
1228 if ( v3->HasEnchantedItemEquipped(20) | |
1229 || v11->WearsItem(505, 3) | |
1230 || v12->WearsItem(507, 16) ) | |
1231 goto LABEL_76; | |
1232 v27 = 6; | |
1233 v24 = 530; | |
1234 LABEL_16: | |
1235 if ( v3->WearsItem(v24, v27) ) | |
1236 goto LABEL_76; | |
1237 goto LABEL_82; | |
1238 case 0xDu: | |
187 | 1239 v3->PlaySound(SPEECH_32, 0); |
0 | 1240 v13 = (char *)&v3->sHealth; |
1241 goto LABEL_70; | |
1242 case 0xEu: | |
1243 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1244 goto LABEL_10; | |
1245 v28 = 0; | |
1246 v25 = 33; | |
1247 goto LABEL_67; | |
1248 case 0xFu: | |
1249 if ( a3 == 1 | |
1250 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1252 || v3->HasEnchantedItemEquipped(23) | |
1253 || v14->WearsItem(520, 16) | |
1254 || v15->WearsItem(505, 3) | |
1255 || v16->WearsItem(530, 6)) ) | |
1256 goto LABEL_76; | |
1257 v26 = 0; | |
1258 v23 = 34; | |
1259 goto LABEL_81; | |
1260 case 0x10u: | |
1261 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1262 { | |
1263 LABEL_10: | |
1264 --pParty->pPartyBuffs[13].uPower; | |
1265 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1266 pParty->pPartyBuffs[13].Reset(); | |
1267 goto LABEL_76; | |
1268 } | |
1269 v28 = 0; | |
187 | 1270 v25 = SPEECH_35; |
0 | 1271 LABEL_67: |
187 | 1272 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1273 if ( v3->sHealth > 0 ) |
1274 v3->sHealth = 0; | |
1275 v13 = (char *)&v3->sMana; | |
1276 LABEL_70: | |
1277 if ( *(int *)v13 > 0 ) | |
1278 *(int *)v13 = 0; | |
1279 LABEL_82: | |
1280 v21 = 0; | |
1281 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1282 v31 = 0; | |
1283 v22 = 1; | |
1284 do | |
1285 { | |
1286 if ( pPlayers[v22]->CanAct() ) | |
1287 { | |
1288 ++v31; | |
1289 v21 = v22; | |
1290 } | |
1291 ++v22; | |
1292 } | |
1293 while ( v22 <= 4 ); | |
1294 if ( v30 == 2 ) | |
1295 { | |
1296 if ( v31 == 1 ) | |
187 | 1297 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1298 } |
1299 result = 1; | |
1300 break; | |
1301 case 0x11u: | |
135 | 1302 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1303 v3->Zombie() || !v3->Dead()) | |
0 | 1304 goto LABEL_76; |
1305 memset(v3, 0, 0xA0u); | |
1306 v3->sHealth = v3->GetMaxHealth(); | |
1307 v18 = 0; | |
1308 v3->field_1928 = v3->uFace; | |
1309 v19 = v3->uVoiceID; | |
1310 v3->sMana = 0; | |
1311 v3->field_1924 = v19; | |
1312 switch ( v19 ) | |
1313 { | |
1314 case 0: | |
1315 case 1: | |
1316 case 2: | |
1317 case 3: | |
1318 case 8: | |
1319 case 9: | |
1320 case 12: | |
1321 case 13: | |
1322 case 16: | |
1323 case 17: | |
1324 case 20: | |
1325 case 23: | |
1326 v18 = 0; | |
1327 break; | |
1328 case 4: | |
1329 case 5: | |
1330 case 6: | |
1331 case 7: | |
1332 case 10: | |
1333 case 11: | |
1334 case 14: | |
1335 case 15: | |
1336 case 18: | |
1337 case 19: | |
1338 case 21: | |
1339 case 24: | |
1340 v18 = 1; | |
1341 break; | |
1342 default: | |
1343 break; | |
1344 } | |
1345 v26 = 0; | |
1346 v20 = (v18 != 0) + 23; | |
187 | 1347 v23 = SPEECH_99; |
0 | 1348 v3->uFace = v20; |
1349 v3->uVoiceID = v20; | |
1350 LABEL_81: | |
187 | 1351 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1352 goto LABEL_82; |
1353 default: | |
1354 goto LABEL_82; | |
1355 } | |
1356 } | |
1357 return result; | |
1358 } | |
1359 | |
1360 //----- (00492528) -------------------------------------------------------- | |
1361 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1362 { | |
973 | 1363 //unsigned int v3; // eax@1 |
0 | 1364 Texture *v4; // esi@1 |
1365 unsigned int v5; // ebx@1 | |
1366 signed int v6; // edi@5 | |
1367 int *v7; // ecx@6 | |
1368 signed int v8; // edx@7 | |
1369 int *v9; // eax@8 | |
973 | 1370 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1371 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1372 | |
973 | 1373 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1374 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1375 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1376 if ( !areWeLoadingTexture ) | |
1377 { | |
1378 v4->Release(); | |
1379 pIcons_LOD->_40F9C5(); | |
1380 } | |
1381 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1382 { | |
1383 v6 = 0; | |
1384 if ( (signed int)uItemIDa <= 0 ) | |
1385 return 1; | |
973 | 1386 v7 = &pInventoryIndices[uSlot]; |
0 | 1387 while ( 1 ) |
1388 { | |
1389 v8 = 0; | |
1390 if ( (signed int)v5 > 0 ) | |
1391 break; | |
1392 LABEL_11: | |
1393 ++v6; | |
1394 v7 += 14; | |
1395 if ( v6 >= (signed int)uItemIDa ) | |
1396 return 1; | |
1397 } | |
1398 v9 = v7; | |
1399 while ( !*v9 ) | |
1400 { | |
1401 ++v8; | |
1402 ++v9; | |
1403 if ( v8 >= (signed int)v5 ) | |
1404 goto LABEL_11; | |
1405 } | |
1406 } | |
1407 return 0; | |
1408 } | |
1409 // 506128: using guessed type int areWeLoadingTexture; | |
1410 | |
1411 //----- (004925E6) -------------------------------------------------------- | |
1412 unsigned int Player::FindFreeInventorySlot() | |
1413 { | |
1414 unsigned int result; // eax@1 | |
1415 ItemGen *v2; // ecx@1 | |
1416 | |
1417 result = 0; | |
1418 v2 = this->pInventoryItems; | |
1419 while ( v2->uItemID ) | |
1420 { | |
1421 ++result; | |
1422 ++v2; | |
1423 if ( (signed int)result >= 126 ) | |
1424 return -1; | |
1425 } | |
1426 return result; | |
1427 } | |
1428 | |
1429 //----- (00492600) -------------------------------------------------------- | |
1430 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1431 { | |
1432 signed int v3; // edx@1 | |
1433 ItemGen *v4; // eax@1 | |
1434 int result; // eax@8 | |
1435 unsigned int v6; // ebx@10 | |
973 | 1436 //unsigned int v7; // eax@10 |
0 | 1437 Texture *v8; // esi@10 |
1438 void *v9; // esi@13 | |
1439 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1440 Player *v11; // [sp+4h] [bp-8h]@1 | |
1441 signed int v12; // [sp+8h] [bp-4h]@4 | |
1442 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1443 | |
1444 v11 = this; | |
1445 v3 = 0; | |
1446 v4 = this->pInventoryItems; | |
1447 while ( v4->uItemID ) | |
1448 { | |
1449 ++v3; | |
1450 ++v4; | |
1451 if ( v3 >= 126 ) | |
1452 { | |
1453 v12 = -1; | |
1454 goto LABEL_5; | |
1455 } | |
1456 } | |
1457 v12 = v3; | |
1458 LABEL_5: | |
1459 if ( v12 == -1 ) | |
1460 { | |
1461 if ( uActiveCharacter ) | |
201 | 1462 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1463 result = 0; |
1464 } | |
1465 else | |
1466 { | |
1467 v6 = uItemID; | |
973 | 1468 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1469 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1470 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1471 if ( !areWeLoadingTexture ) | |
1472 { | |
1473 v8->Release(); | |
1474 pIcons_LOD->_40F9C5(); | |
1475 } | |
1476 if ( (signed int)uItemIDa > 0 ) | |
1477 { | |
1478 v9 = &v11->pInventoryIndices[uSlot]; | |
1479 do | |
1480 { | |
1481 if ( (signed int)v10 > 0 ) | |
1482 memset32(v9, -1 - uSlot, v10); | |
1483 v9 = (char *)v9 + 56; | |
1484 --uItemIDa; | |
1485 } | |
1486 while ( uItemIDa ); | |
1487 } | |
1488 result = v12 + 1; | |
1489 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1490 v11->pInventoryItems[v12].uItemID = v6; | |
1491 } | |
1492 return result; | |
1493 } | |
1494 // 506128: using guessed type int areWeLoadingTexture; | |
1495 | |
1496 //----- (00492700) -------------------------------------------------------- | |
1497 int Player::HasSkill(unsigned int uSkillType) | |
1498 { | |
1499 signed int result; // eax@3 | |
1500 | |
1501 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1502 { | |
1503 result = 1; | |
1504 } | |
1505 else | |
1506 { | |
809 | 1507 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1508 ShowStatusBarString(pTmpBuf, 2u); |
1509 result = 0; | |
1510 } | |
1511 return result; | |
1512 } | |
1513 | |
1514 //----- (00492745) -------------------------------------------------------- | |
1515 int Player::WearItem(unsigned int uItemID) | |
1516 { | |
1517 signed int v2; // eax@1 | |
1518 ItemGen *v3; // edx@1 | |
1519 int v4; // edi@6 | |
1520 char *v5; // eax@6 | |
1521 char *v6; // esi@6 | |
1522 | |
973 | 1523 __debugbreak(); // sub is definetly broken |
1524 | |
0 | 1525 v2 = 0; |
1526 v3 = this->pInventoryItems; | |
1527 while ( v3->uItemID ) | |
1528 { | |
1529 ++v2; | |
1530 ++v3; | |
1531 if ( v2 >= 126 ) | |
1532 { | |
1533 v2 = -1; | |
1534 break; | |
1535 } | |
1536 } | |
1537 if ( v2 != -1 ) | |
1538 { | |
1539 v4 = v2 + 1; | |
1540 v5 = (char *)this + 36 * v2; | |
1541 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; | |
898 | 1542 *(&this->pEquipment.uShield + (unsigned __int8)*v6) = v4; |
0 | 1543 *((int *)v5 + 133) = uItemID; |
1544 v5[556] = *v6 + 1; | |
1545 } | |
1546 return 0; | |
1547 } | |
1548 | |
1549 //----- (004927A8) -------------------------------------------------------- | |
1550 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1551 { | |
1552 signed int v3; // ebx@2 | |
1553 signed int v4; // edi@3 | |
1554 unsigned int v5; // esi@3 | |
1555 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1556 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1557 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1558 | |
1559 thisa = this; | |
1560 if ( uSlot == -1 ) | |
1561 { | |
1562 v3 = 0; | |
1563 while ( 2 ) | |
1564 { | |
1565 v4 = 0; | |
1566 v5 = v3; | |
1567 do | |
1568 { | |
1569 if ( CanFitItem(v5, uItemID) ) | |
1570 { | |
1571 v8 = uItemID; | |
1572 v7 = v5; | |
1573 return CreateItemInInventory(v7, v8); | |
1574 } | |
1575 ++v4; | |
1576 v5 += 14; | |
1577 } | |
1578 while ( v4 < 9 ); | |
1579 ++v3; | |
1580 if ( v3 < 14 ) | |
1581 continue; | |
1582 break; | |
1583 } | |
1584 return 0; | |
1585 } | |
1586 if ( !CanFitItem(uSlot, uItemID) ) | |
1587 { | |
1588 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1589 return 0; | |
1590 } | |
1591 v8 = uItemID; | |
1592 v7 = uSlot; | |
1593 return CreateItemInInventory(v7, v8); | |
1594 } | |
1595 | |
1596 //----- (00492826) -------------------------------------------------------- | |
1597 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1598 { | |
1599 unsigned int v3; // ebx@1 | |
1600 unsigned int v4; // esi@3 | |
1601 signed int v5; // edi@3 | |
1602 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1603 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1604 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1605 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1606 | |
1607 thisa = this; | |
1608 v3 = Src->uItemID; | |
1609 pItemsTable->SetSpecialBonus(Src); | |
1610 if ( uSlot == -1 ) | |
1611 { | |
1612 uSlota = 0; | |
1613 while ( 2 ) | |
1614 { | |
1615 v4 = uSlota; | |
1616 v5 = 0; | |
1617 do | |
1618 { | |
1619 if ( CanFitItem(v4, v3) ) | |
1620 { | |
1621 v8 = Src; | |
1622 v7 = v4; | |
1623 return CreateItemInInventory2(v7, v8); | |
1624 } | |
1625 ++v5; | |
1626 v4 += 14; | |
1627 } | |
1628 while ( v5 < 14 ); | |
1629 ++uSlota; | |
1630 if ( uSlota < 9 ) | |
1631 continue; | |
1632 break; | |
1633 } | |
1634 return 0; | |
1635 } | |
1636 if ( !CanFitItem(uSlot, v3) ) | |
1637 return 0; | |
1638 v8 = Src; | |
1639 v7 = uSlot; | |
1640 return CreateItemInInventory2(v7, v8); | |
1641 } | |
1642 | |
1643 //----- (0049289C) -------------------------------------------------------- | |
1644 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1645 { | |
1646 signed int v3; // ebx@1 | |
1647 ItemGen *v4; // eax@1 | |
1648 int result; // eax@6 | |
973 | 1649 //unsigned int v6; // eax@7 |
0 | 1650 Texture *v7; // esi@7 |
1651 unsigned int v8; // edx@9 | |
1652 void *v9; // esi@10 | |
1653 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1654 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1655 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1656 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1657 | |
1658 v12 = this; | |
1659 v3 = 0; | |
1660 v4 = this->pInventoryItems; | |
1661 while ( v4->uItemID ) | |
1662 { | |
1663 ++v3; | |
1664 ++v4; | |
1665 if ( v3 >= 126 ) | |
1666 { | |
1667 v3 = -1; | |
1668 break; | |
1669 } | |
1670 } | |
1671 if ( v3 == -1 ) | |
1672 { | |
1673 result = 0; | |
1674 } | |
1675 else | |
1676 { | |
973 | 1677 v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1678 v10 = GetSizeInInventorySlots(v7->uTextureWidth); | |
0 | 1679 v11 = GetSizeInInventorySlots(v7->uTextureHeight); |
1680 if ( !areWeLoadingTexture ) | |
1681 { | |
1682 v7->Release(); | |
1683 pIcons_LOD->_40F9C5(); | |
1684 } | |
1685 v8 = uSlot; | |
1686 if ( (signed int)v11 > 0 ) | |
1687 { | |
1688 uSlota = v11; | |
1689 v9 = &v12->pInventoryIndices[v8]; | |
1690 do | |
1691 { | |
1692 if ( (signed int)v10 > 0 ) | |
1693 memset32(v9, -1 - v8, v10); | |
1694 v9 = (char *)v9 + 56; | |
1695 --uSlota; | |
1696 } | |
1697 while ( uSlota ); | |
1698 } | |
1699 v12->pInventoryIndices[v8] = v3 + 1; | |
1700 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1701 result = v3 + 1; | |
1702 } | |
1703 return result; | |
1704 } | |
1705 // 506128: using guessed type int areWeLoadingTexture; | |
1706 | |
1707 //----- (0049298B) -------------------------------------------------------- | |
1708 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1709 { | |
973 | 1710 //Player *v4; // ebx@1 |
1711 //unsigned int v5; // eax@1 | |
0 | 1712 Texture *v6; // esi@1 |
1713 void *v7; // esi@4 | |
1714 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1715 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1716 | |
973 | 1717 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1718 v9 = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1719 a2a = GetSizeInInventorySlots(v6->uTextureHeight); |
1720 if ( !areWeLoadingTexture ) | |
1721 { | |
1722 v6->Release(); | |
1723 pIcons_LOD->_40F9C5(); | |
1724 } | |
1725 if ( (signed int)a2a > 0 ) | |
1726 { | |
973 | 1727 v7 = &pInventoryIndices[a4]; |
0 | 1728 do |
1729 { | |
1730 if ( (signed int)v9 > 0 ) | |
1731 memset32(v7, -1 - a4, v9); | |
1732 v7 = (char *)v7 + 56; | |
1733 --a2a; | |
1734 } | |
1735 while ( a2a ); | |
1736 } | |
973 | 1737 pInventoryIndices[a4] = a3 + 1; |
0 | 1738 return 1; |
1739 } | |
278 | 1740 |
0 | 1741 // 506128: using guessed type int areWeLoadingTexture; |
1742 | |
1743 //----- (00492A36) -------------------------------------------------------- | |
1744 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) | |
1745 { | |
1746 int *pIndices; // edi@1 | |
1747 ItemGen *v3; // ecx@1 | |
1748 unsigned int v4; // esi@1 | |
973 | 1749 //unsigned int v5; // eax@1 |
0 | 1750 Texture *v6; // esi@1 |
1751 unsigned int result; // eax@1 | |
1752 unsigned int v8; // ebp@1 | |
1753 void *v9; // edx@4 | |
1754 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1755 | |
1756 pIndices = &this->pInventoryIndices[uSlot]; | |
232 | 1757 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1758 v4 = v3->uItemID; |
1759 v3->Reset(); | |
973 | 1760 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); |
1761 uSlota = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1762 result = GetSizeInInventorySlots(v6->uTextureHeight); |
1763 v8 = result; | |
1764 if ( !areWeLoadingTexture ) | |
1765 { | |
1766 v6->Release(); | |
1767 result = pIcons_LOD->_40F9C5(); | |
1768 } | |
1769 if ( (signed int)v8 > 0 ) | |
1770 { | |
1771 v9 = pIndices; | |
1772 do | |
1773 { | |
1774 if ( (signed int)uSlota > 0 ) | |
1775 { | |
1776 result = 0; | |
1777 memset(v9, 0, 4 * uSlota); | |
1778 } | |
1779 v9 = (char *)v9 + 56; | |
1780 --v8; | |
1781 } | |
1782 while ( v8 ); | |
1783 } | |
1784 return result; | |
1785 } | |
1786 // 506128: using guessed type int areWeLoadingTexture; | |
1787 | |
436 | 1788 //identf |
0 | 1789 //----- (00490EEE) -------------------------------------------------------- |
917 | 1790 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1791 { | |
1792 int pSkillLevel; // eax@1 | |
1793 int NotBuy; // eax@1 | |
1794 int result; | |
1795 signed int pEquipType; // esi@1 | |
1796 float *pPriceMultiplier; // esi@26 | |
1797 int pPriceItemService; // edi@26 | |
1798 | |
1799 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1800 NotBuy = 4; | |
1801 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1802 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1803 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1804 return 5; |
917 | 1805 if ( building_type == BildingType_WeaponShop ) |
1806 { | |
1807 if ( pEquipType > EQUIP_BOW ) | |
1808 return NotBuy; | |
1809 if (pItem->Stolen()) | |
1810 return 6; | |
1811 } | |
1812 if ( building_type == BildingType_ArmorShop ) | |
1813 { | |
1814 if ( pEquipType < 3 && pEquipType > 9 ) | |
1815 return NotBuy; | |
1816 if (pItem->Stolen()) | |
1817 return 6; | |
1818 } | |
1819 if ( building_type == BildingType_MagicShop ) | |
1820 { | |
1821 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1822 { | |
1823 if (pItem->Stolen()) | |
1824 return 6; | |
1825 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1826 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1827 if ( ShopMenuType == 3 )//Sell | |
1828 { | |
1829 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1830 if (!pItem->Broken()) | |
1831 { | |
1832 if ( pSkillLevel ) | |
1833 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1834 else | |
1835 result = 1; | |
1836 return result; | |
1837 } | |
1838 pPriceItemService = 1; | |
1839 if ( pSkillLevel ) | |
1840 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1841 else | |
1842 result = 1; | |
1843 return result; | |
1844 } | |
1845 if ( ShopMenuType == 4 )//Identify | |
1846 { | |
1847 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1848 if ( pSkillLevel ) | |
1849 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1850 else | |
1851 result = 1; | |
1852 return result; | |
1853 } | |
1854 if ( ShopMenuType == 5 )//Repair | |
1855 { | |
1856 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1857 if ( pSkillLevel ) | |
1858 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1859 else | |
1860 result = 1; | |
1861 return result; | |
1862 } | |
1863 if ( ShopMenuType != 6 )//Buy and ??? | |
1864 { | |
1865 if ( pSkillLevel ) | |
1866 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1867 else | |
1868 result = 1; | |
1869 return result; | |
1870 } | |
1871 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1872 if (pItem->Broken()) | |
1873 pPriceItemService = 1; | |
1874 if ( pPriceItemService >= 1 ) | |
1875 { | |
1876 if ( pSkillLevel ) | |
1877 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1878 else | |
1879 result = 1; | |
1880 return result; | |
1881 } | |
1882 pPriceItemService = 1; | |
1883 if ( pSkillLevel ) | |
1884 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1885 else | |
1886 result = 1; | |
0 | 1887 return result; |
917 | 1888 } |
1889 if ( pEquipType != EQUIP_BOOK ) | |
1890 return NotBuy; | |
1891 } | |
1892 if ( building_type == BildingType_AlchemistShop ) | |
1893 { | |
1894 if ( pEquipType < EQUIP_REAGENT ) | |
1895 return NotBuy; | |
1896 if ( pEquipType > EQUIP_POTION ) | |
1897 { | |
1898 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1899 return NotBuy; | |
1900 } | |
1901 if (pItem->Stolen()) | |
1902 return 6; | |
1903 } | |
1904 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1905 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1906 if ( ShopMenuType == 3 )//Sell | |
1907 { | |
1908 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1909 if (!pItem->Broken()) | |
1910 { | |
1911 if ( pSkillLevel ) | |
1912 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1913 else | |
1914 result = 1; | |
0 | 1915 return result; |
917 | 1916 } |
1917 pPriceItemService = 1; | |
1918 if ( pSkillLevel ) | |
1919 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1920 else | |
1921 result = 1; | |
1922 return result; | |
1923 } | |
1924 if ( ShopMenuType == 4 )//Identify | |
1925 { | |
1926 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1927 if ( pSkillLevel ) | |
1928 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1929 else | |
1930 result = 1; | |
1931 return result; | |
1932 } | |
1933 if ( ShopMenuType == 5 )//Repair | |
1934 { | |
1935 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1936 if ( pSkillLevel ) | |
1937 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1938 else | |
1939 result = 1; | |
1940 return result; | |
1941 } | |
1942 if ( ShopMenuType != 6 )//Buy and ??? | |
1943 { | |
1944 if ( pSkillLevel ) | |
1945 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1946 else | |
1947 result = 1; | |
1948 return result; | |
1949 } | |
1950 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1951 if (pItem->Broken()) |
917 | 1952 pPriceItemService = 1; |
1953 if ( pPriceItemService >= 1 ) | |
1954 { | |
1955 if ( pSkillLevel ) | |
1956 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1957 else | |
1958 result = 1; | |
1959 return result; | |
1960 } | |
1961 pPriceItemService = 1; | |
1962 if ( pSkillLevel ) | |
1963 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1964 else |
1965 result = 1; | |
1966 return result; | |
1967 } | |
1968 | |
1969 //----- (0049107D) -------------------------------------------------------- | |
1970 int Player::GetBodybuilding() | |
1971 { | |
1972 char v1; // al@1 | |
1973 int v2; // ecx@1 | |
1974 int v4; // eax@3 | |
1975 signed int v6; // [sp-4h] [bp-4h]@2 | |
1976 | |
1977 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1978 v2 = v1 & 0x3F; | |
1979 if ( v1 & 0x100 ) | |
1980 { | |
1981 v6 = 5; | |
1982 } | |
1983 else | |
1984 { | |
1985 if ( v1 >= 0 ) | |
1986 { | |
1987 v4 = ((v1 & 0x40) != 0) + 1; | |
1988 return v2 * v4; | |
1989 } | |
1990 v6 = 3; | |
1991 } | |
1992 v4 = v6; | |
1993 return v2 * v4; | |
1994 } | |
1995 | |
1996 //----- (004910A8) -------------------------------------------------------- | |
607 | 1997 int Player::GetMeditation() |
0 | 1998 { |
1999 char v1; // al@1 | |
2000 int v2; // ecx@1 | |
2001 int v4; // eax@3 | |
2002 signed int v6; // [sp-4h] [bp-4h]@2 | |
2003 | |
2004 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
2005 v2 = v1 & 0x3F; | |
2006 if ( v1 & 0x100 ) | |
2007 { | |
2008 v6 = 5; | |
2009 } | |
2010 else | |
2011 { | |
2012 if ( v1 >= 0 ) | |
2013 { | |
2014 v4 = ((v1 & 0x40) != 0) + 1; | |
2015 return v2 * v4; | |
2016 } | |
2017 v6 = 3; | |
2018 } | |
2019 v4 = v6; | |
2020 return v2 * v4; | |
2021 } | |
2022 | |
2023 //----- (004910D3) -------------------------------------------------------- | |
2024 int Player::CanIdentify(ItemGen *pItem) | |
2025 { | |
2026 unsigned __int16 v2; // ax@1 | |
2027 unsigned __int16 v3; // bx@1 | |
2028 int uSkillMult; // eax@3 | |
2029 int v5; // edi@7 | |
2030 signed int v6; // ebp@7 | |
2031 char *v7; // esi@7 | |
2032 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 2033 |
2034 if (CheckHiredNPCSpeciality(Scholar)) | |
2035 return true; | |
0 | 2036 |
179 | 2037 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 2038 v3 = v2; |
179 | 2039 if ( v2 & 1 ) |
0 | 2040 { |
2041 uSkillMultiplier = 5; | |
2042 } | |
2043 else | |
2044 { | |
2045 if ( (v2 & 0x80u) == 0 ) | |
2046 { | |
2047 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 2048 v5 = uSkillMult * (v3 & 0x3F); |
2049 v6 = 0; | |
2050 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2051 |
179 | 2052 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2053 v6 = 1; | |
2054 if ( v5 >= (unsigned __int8)v7[46] ) | |
2055 v6 = 1; | |
2056 return v6; | |
0 | 2057 } |
2058 uSkillMultiplier = 3; | |
2059 } | |
2060 uSkillMult = uSkillMultiplier; | |
2061 v5 = uSkillMult * (v3 & 0x3F); | |
2062 v6 = 0; | |
2063 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2064 |
0 | 2065 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2066 v6 = 1; | |
2067 if ( v5 >= (unsigned __int8)v7[46] ) | |
2068 v6 = 1; | |
2069 return v6; | |
2070 } | |
2071 | |
2072 //----- (00491151) -------------------------------------------------------- | |
2073 int Player::CanRepair(ItemGen *a2) | |
2074 { | |
2075 unsigned __int16 v2; // ax@1 | |
2076 unsigned __int16 v3; // bx@1 | |
2077 int v4; // eax@3 | |
2078 int v5; // edi@7 | |
2079 signed int v6; // ebp@7 | |
2080 char v8; // al@10 | |
2081 signed int v10; // [sp-4h] [bp-14h]@2 | |
2082 | |
652 | 2083 |
2084 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2085 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2086 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2087 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2088 return true; | |
2089 | |
0 | 2090 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
2091 v3 = v2; | |
2092 if ( HIBYTE(v2) & 1 ) | |
2093 { | |
2094 v10 = 5; | |
2095 } | |
2096 else | |
2097 { | |
2098 if ( (v2 & 0x80u) == 0 ) | |
2099 { | |
2100 v4 = ((v2 & 0x40) != 0) + 1; | |
2101 goto LABEL_7; | |
2102 } | |
2103 v10 = 3; | |
2104 } | |
2105 v4 = v10; | |
2106 LABEL_7: | |
2107 v5 = v4 * (v3 & 0x3F); | |
2108 v6 = 0; | |
2109 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2110 return true; | |
2111 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2112 { | |
2113 __debugbreak(); // really odd | |
2114 return true; | |
2115 } | |
2116 return false; | |
2117 } | |
2118 | |
2119 //----- (004911F3) -------------------------------------------------------- | |
2120 int Player::GetMerchant() | |
2121 { | |
2122 Player *v1; // edi@1 | |
2123 unsigned __int16 v2; // ax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // esi@1 | |
2126 int v5; // edi@1 | |
2127 int v7; // eax@3 | |
2128 int v8; // ecx@7 | |
2129 signed int v9; // [sp-4h] [bp-10h]@6 | |
2130 | |
2131 v1 = this; | |
607 | 2132 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 2133 v3 = v1->pActiveSkills[22]; |
607 | 2134 v4 = v2 & 0x003F; |
0 | 2135 v5 = v1->pActiveSkills[22] & 0x3F; |
2136 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2137 return 10000; | |
2138 v7 = GetPartyReputation(); | |
2139 if ( !v4 ) | |
2140 return -v7; | |
2141 if ( HIBYTE(v3) & 1 ) | |
2142 { | |
2143 v9 = 5; | |
2144 } | |
2145 else | |
2146 { | |
2147 if ( (v3 & 0x80u) == 0 ) | |
2148 { | |
2149 v8 = ((v3 & 0x40) != 0) + 1; | |
2150 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2151 } | |
2152 v9 = 3; | |
2153 } | |
2154 v8 = v9; | |
2155 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2156 } | |
2157 | |
2158 //----- (0049125A) -------------------------------------------------------- | |
2159 int Player::GetPerception() | |
2160 { | |
2161 Player *v1; // edi@1 | |
2162 unsigned __int16 v2; // ax@1 | |
2163 unsigned __int16 v3; // bx@1 | |
2164 int v4; // esi@1 | |
2165 int v5; // edi@1 | |
2166 int v7; // eax@5 | |
2167 signed int v8; // [sp-4h] [bp-10h]@4 | |
2168 | |
2169 v1 = this; | |
983 | 2170 v2 = (char)GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
0 | 2171 v3 = v1->pActiveSkills[26]; |
2172 v4 = v2 & 0x3F; | |
2173 v5 = v1->pActiveSkills[26] & 0x3F; | |
2174 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2175 return 10000; | |
2176 if ( HIBYTE(v3) & 1 ) | |
2177 { | |
2178 v8 = 5; | |
2179 } | |
2180 else | |
2181 { | |
2182 if ( (v3 & 0x80u) == 0 ) | |
2183 { | |
2184 v7 = ((v3 & 0x40) != 0) + 1; | |
2185 return v4 + v5 * (v7 - 1); | |
2186 } | |
2187 v8 = 3; | |
2188 } | |
2189 v7 = v8; | |
2190 return v4 + v5 * (v7 - 1); | |
2191 } | |
2192 | |
2193 //----- (004912B0) -------------------------------------------------------- | |
2194 int Player::GetDisarmTrap() | |
2195 { | |
2196 Player *v1; // ebp@1 | |
2197 unsigned __int16 v2; // ax@1 | |
2198 unsigned __int16 v3; // bx@1 | |
2199 int v4; // esi@1 | |
2200 int v5; // edi@1 | |
2201 int v7; // eax@7 | |
2202 signed int v8; // [sp-4h] [bp-14h]@6 | |
2203 | |
2204 v1 = this; | |
2205 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2206 v3 = v1->pActiveSkills[29]; | |
2207 v4 = v2 & 0x3F; | |
2208 v5 = v1->pActiveSkills[29] & 0x3F; | |
2209 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2210 return 10000; | |
2211 if ( HasEnchantedItemEquipped(35) ) | |
2212 v4 *= 2; | |
2213 if ( HIBYTE(v3) & 1 ) | |
2214 { | |
2215 v8 = 5; | |
2216 } | |
2217 else | |
2218 { | |
2219 if ( (v3 & 0x80u) == 0 ) | |
2220 { | |
2221 v7 = ((v3 & 0x40) != 0) + 1; | |
2222 return v4 + v5 * (v7 - 1); | |
2223 } | |
2224 v8 = 3; | |
2225 } | |
2226 v7 = v8; | |
2227 return v4 + v5 * (v7 - 1); | |
2228 } | |
2229 | |
2230 //----- (00491317) -------------------------------------------------------- | |
2231 char Player::GetLearningPercent() | |
2232 { | |
2233 Player *v1; // esi@1 | |
2234 int v2; // eax@1 | |
2235 unsigned __int16 v3; // bx@1 | |
2236 int v4; // ecx@1 | |
2237 int v5; // eax@4 | |
2238 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2239 | |
2240 v1 = this; | |
2241 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2242 v3 = v1->pActiveSkills[36]; | |
2243 v4 = v2 & 0x3F; | |
2244 if ( v2 ) | |
2245 { | |
2246 if ( HIBYTE(v3) & 1 ) | |
2247 { | |
2248 v7 = 5; | |
2249 } | |
2250 else | |
2251 { | |
2252 if ( (v3 & 0x80u) == 0 ) | |
2253 { | |
2254 v5 = ((v3 & 0x40) != 0) + 1; | |
2255 goto LABEL_8; | |
2256 } | |
2257 v7 = 3; | |
2258 } | |
2259 v5 = v7; | |
2260 LABEL_8: | |
2261 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2262 } | |
2263 return v2; | |
2264 } | |
2265 | |
2266 //----- (0048C6AF) -------------------------------------------------------- | |
2267 Player::Player() | |
2268 { | |
2269 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2270 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2271 for (uint i = 0; i < 126; ++i) | |
2272 pInventoryItems[i].Reset(); | |
2273 for (uint i = 0; i < 12; ++i) | |
2274 pEquippedItems[i].Reset(); | |
2275 | |
2276 | |
2277 for (uint i = 0; i < 24; ++i) | |
2278 { | |
2279 pPlayerBuffs[i].uSkill = 0; | |
2280 pPlayerBuffs[i].uSkill = 0; | |
2281 pPlayerBuffs[i].uPower = 0; | |
2282 pPlayerBuffs[i].uExpireTime = 0; | |
2283 pPlayerBuffs[i].uCaster = 0; | |
2284 pPlayerBuffs[i].uFlags = 0; | |
2285 } | |
2286 | |
2287 pName[0] = 0; | |
2288 uFace = 0; | |
2289 uVoiceID = 0; | |
2290 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2291 | |
2292 field_BB = 0; | |
2293 | |
2294 uMight = uMightBonus = 0; | |
2295 uIntelligence = uIntelligenceBonus = 0; | |
2296 uWillpower = uWillpowerBonus = 0; | |
2297 uEndurance = uEnduranceBonus = 0; | |
2298 uSpeed = uSpeedBonus = 0; | |
2299 uAccuracy = uAccuracyBonus = 0; | |
2300 uLuck = uLuckBonus = 0; | |
2301 uLevel = sLevelModifier = 0; | |
2302 sAgeModifier = 0; | |
2303 | |
2304 memset(field_1F5, 0, 30); | |
2305 | |
2306 sResFireBase = sResFireBonus = 0; | |
2307 sResAirBase = sResAirBonus = 0; | |
2308 sResWaterBase = sResWaterBonus = 0; | |
2309 sResEarthBase = sResEarthBonus = 0; | |
2310 sResMagicBase = sResMagicBonus = 0; | |
2311 sResSpiritBase = sResSpiritBonus = 0; | |
2312 sResMindBase = sResMindBonus = 0; | |
2313 sResBodyBase = sResBodyBonus = 0; | |
2314 sResLightBase = sResLightBonus = 0; | |
2315 sResDarkBase = sResDarkBonus = 0; | |
2316 | |
2317 uTimeToRecovery = 0; | |
2318 | |
2319 uSkillPoints = 0; | |
2320 | |
2321 sHealth = 0; | |
2322 uFullHealthBonus = 0; | |
2323 _health_related = 0; | |
2324 | |
2325 sMana = 0; | |
2326 uFullManaBonus = 0; | |
2327 _mana_related = 0; | |
2328 | |
2329 uQuickSpell = 0; | |
2330 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2331 | |
2332 _some_attack_bonus = 0; | |
2333 field_1A91 = 0; | |
2334 _melee_dmg_bonus = 0; | |
2335 field_1A93 = 0; | |
2336 _ranged_atk_bonus = 0; | |
2337 field_1A95 = 0; | |
2338 _ranged_dmg_bonus = 0; | |
2339 field_1A97 = 0; | |
2340 | |
130 | 2341 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2342 uExpressionTimePassed = 0; |
2343 uExpressionTimeLength = 0; | |
2344 | |
2345 uNumDivineInterventionCastsThisDay = 0; | |
2346 uNumArmageddonCasts = 0; | |
2347 uNumFireSpikeCasts = 0; | |
2348 | |
2349 memset(field_1988, 0, 49 * sizeof(int)); | |
2350 memset(field_1A50, 0, 64 * sizeof(char)); | |
2351 | |
2352 field_E0 = 0; | |
2353 field_E4 = 0; | |
2354 field_E8 = 0; | |
2355 field_EC = 0; | |
2356 field_F0 = 0; | |
2357 field_F4 = 0; | |
2358 field_F8 = 0; | |
2359 field_FC = 0; | |
2360 field_100 = 0; | |
2361 field_104 = 0; | |
198 | 2362 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2363 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2364 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2365 |
198 | 2366 lastOpenedSpellbookPage = 0; |
0 | 2367 } |
2368 | |
2369 //----- (0048C6F6) -------------------------------------------------------- | |
2370 bool Party::AddItem(ItemGen *pItem) | |
2371 { | |
2372 unsigned int v2; // eax@1 | |
2373 unsigned int v3; // ecx@4 | |
2374 signed int v4; // edx@4 | |
2375 char *v5; // eax@8 | |
973 | 2376 //unsigned int v6; // eax@10 |
0 | 2377 Texture *v7; // ebx@10 |
2378 signed int v8; // esi@10 | |
2379 Player *v9; // edi@11 | |
2380 int v10; // eax@11 | |
2381 bool result; // eax@15 | |
2382 std::string v12; // [sp-18h] [bp-40h]@9 | |
2383 const char *v13; // [sp-8h] [bp-30h]@9 | |
2384 int v14; // [sp-4h] [bp-2Ch]@9 | |
188 | 2385 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2386 //int v16; // [sp+10h] [bp-18h]@3 | |
2387 //int v17; // [sp+14h] [bp-14h]@3 | |
2388 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2389 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2390 Party *v20; // [sp+20h] [bp-8h]@1 | |
2391 int v21; // [sp+24h] [bp-4h]@10 | |
2392 | |
2393 auto thos = this; | |
2394 | |
2395 v20 = thos; | |
2396 v2 = pItem->uItemID; | |
222 | 2397 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2398 pItem->SetIdentified(); |
188 | 2399 ///v15 = 0; |
2400 //v16 = 1; | |
2401 //v18 = 3; | |
2402 //v17 = 2; | |
0 | 2403 if ( uActiveCharacter ) |
2404 { | |
2405 v3 = uActiveCharacter - 1; | |
2406 v4 = 0; | |
2407 do | |
2408 { | |
188 | 2409 v15[v4++] = v3++; |
0 | 2410 if ( (signed int)v3 >= 4 ) |
2411 v3 = 0; | |
2412 } | |
2413 while ( v4 < 4 ); | |
2414 } | |
2415 v5 = pItemsTable->pItems[v2].pIconName; | |
2416 if ( v5 ) | |
2417 { | |
973 | 2418 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2419 v21 = areWeLoadingTexture; |
2420 v8 = 0; | |
2421 while ( 1 ) | |
2422 { | |
188 | 2423 v9 = &v20->pPlayers[v15[v8]]; |
2424 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2425 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2426 if ( v10 ) | |
2427 break; | |
2428 ++v8; | |
2429 if ( v8 >= 4 ) | |
2430 { | |
2431 if ( !v21 ) | |
2432 { | |
2433 v7->Release(); | |
2434 pIcons_LOD->_40F9C5(); | |
2435 } | |
2436 goto LABEL_15; | |
2437 } | |
2438 } | |
232 | 2439 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2440 pItem->Reset(); |
2441 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2442 v19->PlaySound(SPEECH_60, 0); |
0 | 2443 if ( !v21 ) |
2444 { | |
2445 v7->Release(); | |
2446 pIcons_LOD->_40F9C5(); | |
2447 } | |
2448 result = 1; | |
2449 } | |
2450 else | |
2451 { | |
2452 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2453 LABEL_15: | |
2454 result = 0; | |
2455 } | |
2456 return result; | |
2457 } | |
2458 // 506128: using guessed type int areWeLoadingTexture; | |
2459 | |
2460 //----- (0048C855) -------------------------------------------------------- | |
2461 int Player::GetBaseStrength() | |
2462 { | |
2463 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2464 } | |
2465 | |
2466 //----- (0048C86C) -------------------------------------------------------- | |
2467 int Player::GetBaseIntelligence() | |
2468 { | |
2469 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2470 } | |
2471 | |
2472 //----- (0048C883) -------------------------------------------------------- | |
2473 int Player::GetBaseWillpower() | |
2474 { | |
2475 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2476 } | |
2477 | |
2478 //----- (0048C89A) -------------------------------------------------------- | |
2479 int Player::GetBaseEndurance() | |
2480 { | |
2481 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2482 } | |
2483 | |
2484 //----- (0048C8B1) -------------------------------------------------------- | |
2485 int Player::GetBaseAccuracy() | |
2486 { | |
2487 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2488 } | |
2489 | |
2490 //----- (0048C8C8) -------------------------------------------------------- | |
2491 int Player::GetBaseSpeed() | |
2492 { | |
2493 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2494 } | |
2495 | |
2496 //----- (0048C8DF) -------------------------------------------------------- | |
2497 int Player::GetBaseLuck() | |
2498 { | |
2499 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2500 } | |
2501 | |
2502 //----- (0048C8F6) -------------------------------------------------------- | |
2503 int Player::GetBaseLevel() | |
2504 { | |
2505 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2506 } | |
2507 | |
2508 //----- (0048C90D) -------------------------------------------------------- | |
2509 int Player::GetActualLevel() | |
2510 { | |
2511 return uLevel + sLevelModifier + | |
2512 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2513 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2514 } | |
2515 | |
2516 //----- (0048C93C) -------------------------------------------------------- | |
2517 int Player::GetActualMight() | |
2518 { | |
2519 Player *v1; // esi@1 | |
2520 unsigned int v2; // eax@1 | |
2521 signed int v3; // ecx@1 | |
2522 signed int v4; // ebx@4 | |
2523 int v5; // edi@5 | |
2524 int v6; // ST14_4@5 | |
2525 | |
2526 v1 = this; | |
2527 v2 = this->sAgeModifier + GetBaseAge(); | |
2528 v3 = 0; | |
2529 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2530 { | |
2531 ++v3; | |
2532 if ( v3 >= 4 ) | |
2533 { | |
2534 v4 = 100; | |
2535 goto LABEL_5; | |
2536 } | |
2537 } | |
2538 v4 = pAgeingStrengthMultiplier[v3]; | |
2539 LABEL_5: | |
2540 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2541 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2542 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2543 } | |
2544 | |
2545 //----- (0048C9C2) -------------------------------------------------------- | |
2546 int Player::GetActualIntelligence() | |
2547 { | |
2548 Player *v1; // esi@1 | |
2549 unsigned int sAge; // eax@1 | |
2550 signed int uAgeLevel; // ecx@1 | |
2551 signed int v4; // ebx@4 | |
2552 int v5; // edi@5 | |
2553 int v6; // ebp@5 | |
2554 | |
2555 v1 = this; | |
2556 sAge = this->sAgeModifier + GetBaseAge(); | |
2557 uAgeLevel = 0; | |
2558 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2559 { | |
2560 ++uAgeLevel; | |
2561 if ( uAgeLevel >= 4 ) | |
2562 { | |
2563 v4 = 100; | |
2564 goto LABEL_5; | |
2565 } | |
2566 } | |
2567 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2568 LABEL_5: | |
2569 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2570 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2571 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2572 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2573 + v6 | |
2574 + v1->uIntelligenceBonus; | |
2575 } | |
2576 | |
2577 //----- (0048CA3F) -------------------------------------------------------- | |
2578 int Player::GetActualWillpower() | |
2579 { | |
2580 int v5; // edi@5 | |
2581 | |
2582 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2583 uint uAgeingMultiplier = 100; | |
2584 for (uint i = 0; i < 4; ++i) | |
2585 if (uActualAge >= pAgeingTable[i]) | |
2586 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2587 else break; | |
2588 | |
2589 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2590 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2591 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2592 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2593 + uWillpowerBonus; | |
2594 } | |
2595 | |
2596 //----- (0048CABC) -------------------------------------------------------- | |
2597 int Player::GetActualEndurance() | |
2598 { | |
2599 int v6; // ebp@5 | |
2600 | |
2601 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2602 uint uAgeingMultiplier = 100; | |
2603 for (uint i = 0; i < 4; ++i) | |
2604 if (uActualAge >= pAgeingTable[i]) | |
2605 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2606 else break; | |
2607 | |
2608 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2609 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2610 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2611 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2612 + uItemBonus | |
2613 + uEnduranceBonus; | |
2614 } | |
2615 | |
2616 //----- (0048CB39) -------------------------------------------------------- | |
2617 int Player::GetActualAccuracy() | |
2618 { | |
2619 Player *v1; // esi@1 | |
2620 unsigned int v2; // eax@1 | |
2621 signed int v3; // ecx@1 | |
2622 signed int v4; // ebx@4 | |
2623 int v5; // edi@5 | |
2624 int v6; // ebp@5 | |
2625 | |
2626 v1 = this; | |
2627 v2 = this->sAgeModifier + GetBaseAge(); | |
2628 v3 = 0; | |
2629 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2630 { | |
2631 ++v3; | |
2632 if ( v3 >= 4 ) | |
2633 { | |
2634 v4 = 100; | |
2635 goto LABEL_5; | |
2636 } | |
2637 } | |
2638 v4 = pAgeingAccuracyMultiplier[v3]; | |
2639 LABEL_5: | |
2640 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2641 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2642 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2643 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2644 + v6 | |
2645 + v1->uAccuracyBonus; | |
2646 } | |
2647 | |
2648 //----- (0048CBB6) -------------------------------------------------------- | |
2649 int Player::GetActualSpeed() | |
2650 { | |
2651 Player *v1; // esi@1 | |
2652 unsigned int v2; // eax@1 | |
2653 signed int v3; // ecx@1 | |
2654 signed int v4; // ebx@4 | |
2655 int v5; // edi@5 | |
2656 int v6; // ebp@5 | |
2657 | |
2658 v1 = this; | |
2659 v2 = this->sAgeModifier + GetBaseAge(); | |
2660 v3 = 0; | |
2661 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2662 { | |
2663 ++v3; | |
2664 if ( v3 >= 4 ) | |
2665 { | |
2666 v4 = 100; | |
2667 goto LABEL_5; | |
2668 } | |
2669 } | |
2670 v4 = pAgeingSpeedMultiplier[v3]; | |
2671 LABEL_5: | |
2672 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2673 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2674 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2675 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2676 + v6 | |
2677 + v1->uSpeedBonus; | |
2678 } | |
2679 | |
2680 //----- (0048CC33) -------------------------------------------------------- | |
2681 int Player::GetActualLuck() | |
2682 { | |
2683 Player *v1; // esi@1 | |
2684 unsigned int v2; // eax@7 | |
2685 signed int v3; // ecx@7 | |
2686 signed int v4; // ebx@10 | |
2687 int v5; // edi@11 | |
2688 int v6; // ebp@11 | |
2689 signed int v8; // [sp+10h] [bp-4h]@1 | |
2690 | |
2691 v8 = 0; | |
2692 v1 = this; | |
652 | 2693 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2694 v8 = 5; |
652 | 2695 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2696 v8 += 20; |
652 | 2697 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2698 v8 += 10; |
2699 v2 = v1->sAgeModifier + GetBaseAge(); | |
2700 v3 = 0; | |
2701 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2702 { | |
2703 ++v3; | |
2704 if ( v3 >= 4 ) | |
2705 { | |
2706 v4 = 100; | |
2707 goto LABEL_11; | |
2708 } | |
2709 } | |
2710 v4 = pAgeingLuckMultiplier[v3]; | |
2711 LABEL_11: | |
2712 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2713 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2714 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2715 + v6 | |
2716 + v8 | |
2717 + v5 * v4 * v1->uLuck / 100 / 100 | |
2718 + v1->uLuckBonus; | |
2719 } | |
2720 | |
2721 //----- (0048CCF5) -------------------------------------------------------- | |
2722 int Player::GetActualAttack(int a2) | |
2723 { | |
2724 Player *v2; // esi@1 | |
2725 int v3; // eax@1 | |
2726 int v4; // edi@1 | |
2727 int v5; // ebx@1 | |
2728 int v6; // ebp@1 | |
2729 | |
2730 v2 = this; | |
2731 v3 = GetActualAccuracy(); | |
2732 v4 = _48EA1B_get_static_effect(v3); | |
2733 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2734 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2735 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2736 } | |
2737 | |
2738 //----- (0048CD45) -------------------------------------------------------- | |
2739 int Player::GetMeleeDamageMinimal() | |
2740 { | |
2741 Player *v1; // edi@1 | |
2742 int v2; // eax@1 | |
2743 int v3; // esi@1 | |
2744 int v4; // esi@1 | |
2745 int v5; // esi@1 | |
2746 int v6; // esi@1 | |
2747 signed int result; // eax@1 | |
2748 | |
2749 v1 = this; | |
2750 v2 = GetActualMight(); | |
2751 v3 = _48EA1B_get_static_effect(v2); | |
2752 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2753 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2754 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2755 result = 1; | |
2756 if ( v6 >= 1 ) | |
2757 result = v6; | |
2758 return result; | |
2759 } | |
2760 | |
2761 //----- (0048CD90) -------------------------------------------------------- | |
2762 int Player::GetMeleeDamageMaximal() | |
2763 { | |
2764 Player *v1; // edi@1 | |
2765 int v2; // eax@1 | |
2766 int v3; // esi@1 | |
2767 int v4; // esi@1 | |
2768 int v5; // esi@1 | |
2769 int v6; // esi@1 | |
2770 signed int result; // eax@1 | |
2771 | |
2772 v1 = this; | |
2773 v2 = GetActualMight(); | |
2774 v3 = _48EA1B_get_static_effect(v2); | |
2775 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2776 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2777 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2778 result = 1; | |
2779 if ( v6 >= 1 ) | |
2780 result = v6; | |
2781 return result; | |
2782 } | |
2783 | |
2784 //----- (0048CDDB) -------------------------------------------------------- | |
2785 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2786 { | |
2787 int v4; // esi@1 | |
2788 Player *v5; // edi@1 | |
2789 ItemGen *v6; // ebx@4 | |
2790 unsigned int v7; // ebp@4 | |
2791 unsigned int v8; // esi@4 | |
2792 int v9; // eax@4 | |
2793 int v10; // eax@9 | |
2794 char v11; // zf@9 | |
2795 int v12; // esi@10 | |
2796 int v13; // eax@11 | |
2797 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2798 ItemGen *v15; // ebx@35 | |
2799 unsigned int v16; // ebp@35 | |
2800 unsigned int v17; // esi@35 | |
2801 int v18; // edx@38 | |
2802 int v19; // eax@40 | |
2803 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2804 int v21; // esi@62 | |
2805 int v22; // eax@63 | |
2806 int v23; // ebx@63 | |
2807 int v24; // ebx@63 | |
2808 signed int result; // eax@64 | |
2809 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2810 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2811 int v28; // [sp+10h] [bp-10h]@1 | |
2812 int v29; // [sp+10h] [bp-10h]@33 | |
2813 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2814 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2815 int v32; // [sp+18h] [bp-8h]@1 | |
2816 int v33; // [sp+18h] [bp-8h]@8 | |
2817 int v34; // [sp+1Ch] [bp-4h]@1 | |
2818 int v35; // [sp+28h] [bp+8h]@37 | |
2819 | |
2820 v4 = 0; | |
2821 v5 = this; | |
2822 v34 = 0; | |
2823 v32 = 0; | |
2824 v28 = 0; | |
2825 if ( IsUnarmed() == 1 ) | |
2826 { | |
2827 v32 = rand() % 3 + 1; | |
2828 LABEL_61: | |
2829 v34 = v4; | |
2830 goto LABEL_62; | |
2831 } | |
816 | 2832 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2833 { |
232 | 2834 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2835 v7 = v6->uItemID; |
2836 v8 = v6->uItemID; | |
2837 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2838 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2839 ++v9; |
2840 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2841 if ( v9 > 0 ) | |
2842 { | |
2843 v33 = v9; | |
2844 do | |
2845 { | |
2846 v10 = rand(); | |
2847 v11 = v33-- == 1; | |
2848 v28 += v10 % v30 + 1; | |
2849 } | |
2850 while ( !v11 ); | |
2851 } | |
2852 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2853 if ( !uTargetActorID ) | |
2854 goto LABEL_28; | |
377 | 2855 v13 = v6->uSpecEnchantmentType; |
0 | 2856 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2857 { | |
2858 v14 = (MONSTER_SUPERTYPE)1; | |
2859 } | |
2860 else | |
2861 { | |
2862 if ( v13 == 39 ) | |
2863 { | |
2864 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2865 } | |
2866 else | |
2867 { | |
2868 if ( v13 == 40 ) | |
2869 { | |
2870 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2871 } | |
2872 else | |
2873 { | |
2874 if ( v13 == 63 || v7 == 517 ) | |
2875 { | |
2876 v26 = MONSTER_SUPERTYPE_ELF; | |
2877 } | |
2878 else | |
2879 { | |
2880 if ( v13 != 65 ) | |
2881 { | |
2882 LABEL_28: | |
2883 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2884 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2885 && rand() % 100 < 10 ) | |
2886 v12 *= 3; | |
2887 v32 = v12; | |
2888 goto LABEL_33; | |
2889 } | |
2890 v26 = MONSTER_SUPERTYPE_TITAN; | |
2891 } | |
2892 } | |
2893 } | |
2894 v14 = v26; | |
2895 } | |
2896 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2897 v12 *= 2; | |
2898 goto LABEL_28; | |
2899 } | |
2900 LABEL_33: | |
2901 v29 = 0; | |
2902 if ( !a3 ) | |
2903 { | |
2904 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2905 { | |
898 | 2906 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2907 v16 = v15->uItemID; |
2908 v17 = v15->uItemID; | |
2909 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2910 { | |
2911 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2912 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2913 { | |
2914 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2915 do | |
2916 { | |
2917 v18 = rand() % v31; | |
2918 v11 = v35-- == 1; | |
2919 v29 += v18 + 1; | |
2920 } | |
2921 while ( !v11 ); | |
2922 } | |
2923 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2924 if ( !uTargetActorID ) | |
2925 goto LABEL_57; | |
377 | 2926 v19 = v15->uSpecEnchantmentType; |
0 | 2927 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2928 { | |
2929 v20 = (MONSTER_SUPERTYPE)1; | |
2930 } | |
2931 else | |
2932 { | |
2933 if ( v19 == 39 ) | |
2934 { | |
2935 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2936 } | |
2937 else | |
2938 { | |
2939 if ( v19 == 40 ) | |
2940 { | |
2941 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2942 } | |
2943 else | |
2944 { | |
2945 if ( v19 == 63 || v16 == 517 ) | |
2946 { | |
2947 v27 = MONSTER_SUPERTYPE_ELF; | |
2948 } | |
2949 else | |
2950 { | |
2951 if ( v19 != 65 ) | |
2952 { | |
2953 LABEL_57: | |
2954 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2955 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2956 && rand() % 100 < 10 ) | |
2957 v4 *= 3; | |
2958 goto LABEL_61; | |
2959 } | |
2960 v27 = MONSTER_SUPERTYPE_TITAN; | |
2961 } | |
2962 } | |
2963 } | |
2964 v20 = v27; | |
2965 } | |
2966 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2967 v4 *= 2; | |
2968 goto LABEL_57; | |
2969 } | |
2970 } | |
2971 } | |
2972 LABEL_62: | |
2973 v21 = v32 + v34; | |
2974 if ( !a2 ) | |
2975 { | |
2976 v22 = GetActualMight(); | |
2977 v23 = _48EA1B_get_static_effect(v22); | |
2978 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2979 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2980 } | |
2981 result = 1; | |
2982 if ( v21 >= 1 ) | |
2983 result = v21; | |
2984 return result; | |
2985 } | |
2986 | |
2987 //----- (0048D0B9) -------------------------------------------------------- | |
2988 int Player::GetRangedAttack() | |
2989 { | |
2990 Player *v1; // esi@1 | |
2991 int v2; // eax@1 | |
2992 int v3; // edi@3 | |
2993 int v4; // eax@4 | |
2994 int v5; // edi@4 | |
2995 int v6; // edi@4 | |
2996 int v7; // edi@4 | |
2997 | |
2998 v1 = this; | |
232 | 2999 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3000 if ( v2 < 64 || v2 > 65 ) |
3001 { | |
3002 v4 = GetActualAccuracy(); | |
3003 v5 = _48EA1B_get_static_effect(v4); | |
3004 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
3005 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
3006 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
3007 } | |
3008 else | |
3009 { | |
3010 v3 = GetActualAttack(1); | |
3011 } | |
3012 return v3; | |
3013 } | |
3014 | |
3015 //----- (0048D124) -------------------------------------------------------- | |
3016 int Player::GetRangedDamageMin() | |
3017 { | |
3018 Player *v1; // esi@1 | |
3019 int v2; // edi@1 | |
3020 int v3; // edi@1 | |
3021 int v4; // edi@1 | |
3022 unsigned __int16 v5; // ax@1 | |
3023 int result; // eax@6 | |
3024 | |
3025 v1 = this; | |
3026 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
3027 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3028 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3029 v5 = v1->pActiveSkills[5]; | |
3030 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3031 v4 += v1->pActiveSkills[5] & 0x3F; | |
3032 if ( v4 >= 1 ) | |
3033 result = v4; | |
3034 else | |
3035 result = 0; | |
3036 return result; | |
3037 } | |
3038 | |
3039 //----- (0048D191) -------------------------------------------------------- | |
3040 int Player::GetRangedDamageMax() | |
3041 { | |
3042 Player *v1; // esi@1 | |
3043 int v2; // edi@1 | |
3044 int v3; // edi@1 | |
3045 int v4; // edi@1 | |
3046 unsigned __int16 v5; // ax@1 | |
3047 int result; // eax@6 | |
3048 | |
3049 v1 = this; | |
3050 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
3051 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3052 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3053 v5 = v1->pActiveSkills[5]; | |
3054 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3055 v4 += v1->pActiveSkills[5] & 0x3F; | |
3056 if ( v4 >= 1 ) | |
3057 result = v4; | |
3058 else | |
3059 result = 0; | |
3060 return result; | |
3061 } | |
3062 | |
3063 //----- (0048D1FE) -------------------------------------------------------- | |
3064 bool Player::CalculateRangedDamageTo(int a2) | |
3065 { | |
3066 Player *v2; // ebx@1 | |
3067 bool result; // eax@1 | |
3068 ItemGen *v4; // ebx@2 | |
3069 unsigned int v5; // edi@2 | |
3070 unsigned int v6; // esi@2 | |
3071 int v7; // edx@4 | |
3072 char v8; // zf@4 | |
3073 int v9; // esi@5 | |
3074 int v10; // ebx@6 | |
3075 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3076 unsigned __int16 v12; // ax@19 | |
3077 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3078 Player *v14; // [sp+4h] [bp-10h]@1 | |
3079 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3080 int v16; // [sp+Ch] [bp-8h]@3 | |
3081 int v17; // [sp+10h] [bp-4h]@1 | |
3082 | |
3083 v17 = 0; | |
3084 v2 = this; | |
3085 v14 = this; | |
3086 result = HasItemEquipped(EQUIP_BOW); | |
3087 if ( !result ) | |
3088 return result; | |
232 | 3089 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3090 v5 = v4->uItemID; |
3091 v6 = v4->uItemID; | |
3092 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3093 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3094 { | |
3095 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3096 do | |
3097 { | |
3098 v7 = rand() % v15; | |
3099 v8 = v16-- == 1; | |
3100 v17 += v7 + 1; | |
3101 } | |
3102 while ( !v8 ); | |
3103 } | |
3104 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3105 if ( a2 ) | |
3106 { | |
377 | 3107 v10 = v4->uSpecEnchantmentType; |
0 | 3108 if ( v10 == 64 ) |
3109 { | |
3110 v11 = (MONSTER_SUPERTYPE)1; | |
3111 goto LABEL_17; | |
3112 } | |
3113 if ( v10 == 39 || v5 == 508 ) | |
3114 { | |
3115 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3116 goto LABEL_16; | |
3117 } | |
3118 if ( v10 == 40 ) | |
3119 { | |
3120 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3121 goto LABEL_16; | |
3122 } | |
3123 if ( v10 == 63 || v5 == 517 ) | |
3124 { | |
3125 v13 = MONSTER_SUPERTYPE_ELF; | |
3126 LABEL_16: | |
3127 v11 = v13; | |
3128 LABEL_17: | |
3129 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3130 v9 *= 2; | |
3131 goto LABEL_19; | |
3132 } | |
3133 } | |
3134 LABEL_19: | |
3135 v12 = v14->pActiveSkills[5]; | |
3136 if ( v12 ) | |
3137 { | |
3138 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3139 v9 += v14->pActiveSkills[5] & 0x3F; | |
3140 } | |
3141 return v9; | |
3142 } | |
3143 | |
3144 //----- (0048D2EA) -------------------------------------------------------- | |
3145 char *Player::GetMeleeDamageString() | |
3146 { | |
3147 Player *v1; // esi@1 | |
3148 signed int v2; // eax@1 | |
3149 signed int v3; // edi@3 | |
3150 signed int v4; // eax@3 | |
3151 signed int v5; // ST0C_4@6 | |
3152 char *v6; // edi@6 | |
3153 signed int v7; // ST08_4@7 | |
3154 unsigned int v8; // eax@8 | |
3155 signed int v9; // esi@9 | |
3156 | |
3157 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3158 | |
3159 v1 = this; | |
232 | 3160 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3161 if ( v2 < 64 || v2 > 65 ) |
3162 { | |
3163 v3 = GetMeleeDamageMinimal(); | |
3164 v4 = GetMeleeDamageMaximal(); | |
3165 } | |
3166 else | |
3167 { | |
3168 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3169 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3170 } | |
3171 if ( v3 == v4 ) | |
3172 { | |
3173 v5 = v3; | |
3174 v6 = player__getmeleedamagestring_static_buff; | |
3175 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3176 } | |
3177 else | |
3178 { | |
3179 v7 = v3; | |
3180 v6 = player__getmeleedamagestring_static_buff; | |
3181 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3182 } | |
3183 v8 = v1->pEquipment.uMainHand; | |
3184 if ( v8 ) | |
3185 { | |
232 | 3186 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3187 if ( v9 >= 135 ) |
3188 { | |
3189 if ( v9 <= 159 ) | |
3190 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3191 } | |
3192 } | |
3193 return v6; | |
3194 } | |
3195 | |
3196 //----- (0048D396) -------------------------------------------------------- | |
3197 char *Player::GetRangedDamageString() | |
3198 { | |
3199 Player *v1; // esi@1 | |
3200 signed int v2; // eax@1 | |
3201 int v3; // edi@3 | |
3202 int v4; // eax@3 | |
3203 char *v5; // edi@6 | |
3204 int v6; // ST0C_4@8 | |
3205 int v7; // ST08_4@9 | |
3206 unsigned int v8; // eax@10 | |
3207 signed int v9; // esi@11 | |
3208 | |
3209 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3210 | |
3211 v1 = this; | |
232 | 3212 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3213 if ( v2 < 64 || v2 > 65 ) |
3214 { | |
3215 v3 = GetRangedDamageMin(); | |
3216 v4 = GetRangedDamageMax(); | |
3217 } | |
3218 else | |
3219 { | |
3220 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3221 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3222 } | |
3223 if ( v4 ) | |
3224 { | |
3225 if ( v3 == v4 ) | |
3226 { | |
3227 v6 = v3; | |
3228 v5 = player__getrangeddamagestring_static_buff; | |
3229 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3230 } | |
3231 else | |
3232 { | |
3233 v7 = v3; | |
3234 v5 = player__getrangeddamagestring_static_buff; | |
3235 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3236 } | |
3237 } | |
3238 else | |
3239 { | |
3240 v5 = player__getrangeddamagestring_static_buff; | |
3241 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3242 } | |
3243 v8 = v1->pEquipment.uMainHand; | |
3244 if ( v8 ) | |
3245 { | |
232 | 3246 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3247 if ( v9 >= 135 ) |
3248 { | |
3249 if ( v9 <= 159 ) | |
3250 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3251 } | |
3252 } | |
3253 return v5; | |
3254 } | |
3255 | |
3256 //----- (0048D45A) -------------------------------------------------------- | |
3257 bool Player::CanTrainToNextLevel() | |
3258 { | |
3259 int v1; // edx@1 | |
3260 int v2; // eax@1 | |
3261 int i; // esi@1 | |
3262 | |
3263 v1 = this->uLevel; | |
3264 v2 = 0; | |
3265 for ( i = 0; i < v1; ++i ) | |
3266 v2 += i + 1; | |
3267 return (signed __int64)this->uExperience >= 1000 * v2; | |
3268 } | |
3269 | |
3270 //----- (0048D498) -------------------------------------------------------- | |
3271 unsigned int Player::GetExperienceDisplayColor() | |
3272 { | |
3273 unsigned int result; // eax@2 | |
3274 | |
3275 if ( CanTrainToNextLevel() ) | |
994 | 3276 result = ui_color_text_bonus; |
0 | 3277 else |
994 | 3278 result = ui_color_text_default; |
0 | 3279 return result; |
3280 } | |
3281 | |
3282 //----- (0048D4B3) -------------------------------------------------------- | |
3283 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3284 { | |
3285 Player *v3; // esi@1 | |
3286 int v4; // edi@8 | |
3287 int v6; // eax@21 | |
3288 signed int v7; // ebx@21 | |
3289 int v8; // eax@22 | |
3290 signed int v9; // ebx@22 | |
3291 int v10; // eax@23 | |
3292 signed int v11; // ebx@23 | |
3293 int v12; // eax@24 | |
3294 signed int v13; // edi@24 | |
3295 unsigned int v14; // eax@27 | |
3296 int v15; // eax@29 | |
3297 double v16; // st7@32 | |
3298 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3299 signed int v18; // [sp+8h] [bp-4h]@17 | |
3300 | |
3301 v3 = this; | |
3302 if ( !resistance ) | |
3303 { | |
3304 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3305 goto LABEL_16; | |
3306 } | |
3307 if ( resistance == 1 ) | |
3308 { | |
3309 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3310 goto LABEL_16; | |
3311 } | |
3312 if ( resistance == 2 ) | |
3313 { | |
3314 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3315 goto LABEL_16; | |
3316 } | |
3317 if ( resistance == 3 ) | |
3318 { | |
3319 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3320 goto LABEL_16; | |
3321 } | |
3322 if ( resistance == 6 ) | |
3323 { | |
3324 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3325 goto LABEL_16; | |
3326 } | |
3327 if ( resistance == 7 ) | |
3328 { | |
3329 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3330 goto LABEL_16; | |
3331 } | |
3332 if ( resistance == 8 ) | |
3333 { | |
3334 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3335 LABEL_16: | |
3336 v4 = GetActualResistance(v17); | |
3337 goto LABEL_17; | |
3338 } | |
3339 v4 = 0; | |
3340 LABEL_17: | |
3341 v18 = type; | |
135 | 3342 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3343 return 0; |
3344 if ( v4 ) | |
3345 { | |
3346 v6 = GetActualLuck(); | |
3347 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3348 if ( rand() % v7 >= 30 ) | |
3349 { | |
3350 v18 = type >> 1; | |
3351 v8 = GetActualLuck(); | |
3352 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3353 if ( rand() % v9 >= 30 ) | |
3354 { | |
3355 v18 = type >> 2; | |
3356 v10 = GetActualLuck(); | |
3357 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3358 if ( rand() % v11 >= 30 ) | |
3359 { | |
3360 v18 = type >> 3; | |
3361 v12 = GetActualLuck(); | |
3362 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3363 if ( rand() % v13 >= 30 ) | |
3364 v18 = type >> 4; | |
3365 } | |
3366 } | |
3367 } | |
3368 } | |
3369 if ( resistance == 4 ) | |
3370 { | |
898 | 3371 v14 = v3->pEquipment.uArmor; |
0 | 3372 if ( v14 ) |
3373 { | |
3374 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3375 { | |
3376 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3377 if ( v15 ) | |
3378 { | |
3379 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3380 return v18; | |
3381 v16 = (double)v18 * 0.5; | |
3382 return (signed __int64)v16; | |
3383 } | |
3384 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3385 { | |
3386 v16 = (double)v18 * 0.66670001; | |
3387 return (signed __int64)v16; | |
3388 } | |
3389 } | |
3390 } | |
3391 } | |
3392 return v18; | |
3393 } | |
3394 | |
3395 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3396 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3397 { | |
3398 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3399 } |
3400 | |
3401 //----- (0048D651) -------------------------------------------------------- | |
816 | 3402 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3403 { | |
3404 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3405 } |
3406 | |
3407 //----- (0048D676) -------------------------------------------------------- | |
3408 bool Player::IsUnarmed() | |
3409 { | |
816 | 3410 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3411 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3412 } |
3413 | |
3414 //----- (0048D6AA) -------------------------------------------------------- | |
3415 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3416 { | |
3417 auto i = pEquipment.pIndices[uEquipIndex]; | |
3418 if (i) | |
3419 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3420 else return false; | |
3421 } | |
3422 | |
3423 //----- (0048D6D0) -------------------------------------------------------- | |
3424 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3425 { | |
3426 for (uint i = 0; i < 16; ++i) | |
3427 { | |
3428 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3429 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3430 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3431 return true; | |
3432 } | |
3433 return false; | |
3434 } | |
3435 | |
3436 //----- (0048D709) -------------------------------------------------------- | |
3437 bool Player::WearsItem(int a1, signed int a2) | |
3438 { | |
3439 int v3; // edx@2 | |
3440 Player *v4; // ecx@2 | |
3441 int v6; // esi@5 | |
3442 int v7; // edx@6 | |
3443 | |
3444 if ( a2 >= 16 ) | |
3445 { | |
3446 v6 = 0; | |
3447 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3448 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3449 { |
3450 ++v6; | |
3451 if ( (signed int)v6 >= 16 ) | |
3452 return 0; | |
3453 } | |
3454 return 1; | |
3455 } | |
727 | 3456 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3457 return 1; |
3458 return 0; | |
3459 } | |
3460 | |
3461 //----- (0048D76C) -------------------------------------------------------- | |
3462 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3463 { | |
3464 unsigned __int16 v6; // cx@8 | |
3465 int v7; // edi@8 | |
3466 unsigned int v8; // ebx@8 | |
3467 unsigned int v9; // esi@8 | |
3468 int v10; // eax@8 | |
3469 int v11; // edi@12 | |
3470 bool result; // eax@13 | |
3471 | |
3472 if ( !a2 | |
3473 || this->pConditions[16] | |
3474 || this->pConditions[14] | |
3475 || this->pConditions[15] | |
3476 || this->pConditions[4] | |
3477 || this->pConditions[13] | |
3478 || this->pConditions[2] ) | |
3479 { | |
3480 result = 0; | |
3481 } | |
3482 else | |
3483 { | |
3484 v6 = this->pActiveSkills[34]; | |
3485 v7 = v6 & 0x3F; | |
3486 v8 = SkillToMastery(v6); | |
3487 v9 = a2->GetValue(); | |
3488 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3489 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3490 v9 *= 3; | |
3491 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3492 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3493 if ( rand() % 100 >= 5 ) | |
3494 { | |
3495 if ( *a6 > v11 ) | |
3496 result = *a6 - v11 < 500; | |
3497 else | |
3498 result = 2; | |
3499 } | |
3500 else | |
3501 { | |
3502 result = 0; | |
3503 } | |
3504 } | |
3505 return result; | |
3506 } | |
3507 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3508 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3509 | |
3510 //----- (0048D88B) -------------------------------------------------------- | |
3511 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3512 { | |
3513 Player *v4; // esi@1 | |
3514 Actor *v5; // edi@1 | |
3515 unsigned __int16 v6; // cx@10 | |
3516 int v7; // ebx@10 | |
3517 unsigned int v8; // esi@10 | |
3518 int v9; // eax@10 | |
3519 int v10; // esi@10 | |
3520 int v11; // eax@13 | |
3521 signed int v12; // ebx@15 | |
3522 signed int v13; // edx@15 | |
3523 int v14; // ecx@15 | |
3524 unsigned __int16 v15; // si@21 | |
3525 unsigned int v16; // ebx@24 | |
3526 int v17; // esi@24 | |
3527 const void *v18; // eax@29 | |
3528 unsigned int v19; // esi@31 | |
3529 int v20; // eax@34 | |
3530 char v21; // zf@36 | |
3531 unsigned int v22; // ST0C_4@39 | |
3532 char *v23; // esi@39 | |
3533 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3534 int v26; // [sp-8h] [bp-44h]@40 | |
3535 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3536 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3537 int v29; // [sp+30h] [bp-Ch]@10 | |
3538 int v30; // [sp+34h] [bp-8h]@10 | |
3539 Player *v31; // [sp+38h] [bp-4h]@1 | |
3540 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3541 | |
3542 v4 = this; | |
3543 v5 = &pActors[uActorID]; | |
3544 v31 = this; | |
3545 if ( &pActors[uActorID] | |
3546 && !this->pConditions[16] | |
3547 && !this->pConditions[14] | |
3548 && !this->pConditions[15] | |
3549 && !this->pConditions[4] | |
3550 && !this->pConditions[13] | |
3551 && !this->pConditions[2] ) | |
3552 { | |
3553 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3554 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3555 v6 = v4->pActiveSkills[34]; | |
3556 v7 = v6 & 0x3F; | |
3557 v8 = SkillToMastery(v6); | |
3558 v9 = rand(); | |
3559 v28 = 4 * v8; | |
3560 v30 = dword_4EDEA0[v8]; | |
3561 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3562 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3563 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3564 { | |
322 | 3565 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3566 _steal_perma = 0; |
3567 v26 = (int)v31->pName; | |
3568 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3569 } | |
3570 else | |
3571 { | |
3572 v11 = rand(); | |
3573 if ( v11 % 100 >= 40 ) | |
3574 { | |
3575 if ( v11 % 100 >= 70 ) | |
3576 { | |
3577 v19 = 0; | |
3578 if ( v7 > 0 ) | |
3579 { | |
3580 do | |
3581 { | |
3582 --v7; | |
3583 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3584 } | |
3585 while ( v7 ); | |
3586 } | |
3587 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3588 return _steal_perma; | |
377 | 3589 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3590 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3591 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3592 v21 = *(int *)v20 == v19; |
3593 *(int *)v20 -= v19; | |
3594 if ( v21 ) | |
3595 v5->array_000234[3].uItemID = 0; | |
3596 if ( v19 ) | |
3597 { | |
3598 party_finds_gold(v19, 2); | |
3599 v22 = v19; | |
3600 v23 = pTmpBuf2; | |
3601 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3602 LABEL_43: | |
3603 ShowStatusBarString(v23, 2u); | |
3604 return _steal_perma; | |
3605 } | |
3606 } | |
3607 else | |
3608 { | |
3609 v27.Reset(); | |
3610 v12 = 0; | |
3611 v13 = 0; | |
3612 v14 = (int)v5->array_000234; | |
3613 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3614 { | |
3615 ++v13; | |
3616 v14 += 36; | |
3617 if ( v13 >= 4 ) | |
3618 goto LABEL_21; | |
3619 } | |
3620 v12 = 1; | |
3621 LABEL_21: | |
3622 v15 = v5->uCarriedItemID; | |
3623 if ( v15 || v12 ) | |
3624 { | |
3625 v27.Reset(); | |
3626 if ( v15 ) | |
3627 { | |
3628 v16 = (signed __int16)v15; | |
3629 v5->uCarriedItemID = 0; | |
3630 v27.uItemID = (signed __int16)v15; | |
3631 v17 = (signed __int16)v15; | |
3632 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3633 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3634 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3635 { | |
3636 if ( v16 != 220 ) | |
570 | 3637 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3638 } |
3639 } | |
3640 else | |
3641 { | |
3642 v18 = &v5->array_000234[rand() % 4]; | |
3643 memcpy(&v27, v18, sizeof(v27)); | |
3644 ((ItemGen *)v18)->Reset(); | |
3645 v16 = v27.uItemID; | |
3646 } | |
3647 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3648 sprintf( | |
3649 pTmpBuf2, | |
3650 pGlobalTXT_LocalizationStrings[304], | |
3651 v31->pName, | |
3652 pItemsTable->pItems[v16].pUnidentifiedName); | |
3653 ShowStatusBarString(pTmpBuf2, 2u); | |
3654 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3655 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3656 pMouse->SetCursorBitmapFromItemID(v16); | |
3657 return _steal_perma; | |
3658 } | |
3659 } | |
3660 } | |
3661 v26 = (int)v31->pName; | |
3662 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3663 } | |
3664 v23 = pTmpBuf2; | |
809 | 3665 sprintfex(pTmpBuf2, v25, v26); |
0 | 3666 goto LABEL_43; |
3667 } | |
3668 return 0; | |
3669 } | |
3670 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3671 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3672 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3673 | |
3674 //----- (0048DBB9) -------------------------------------------------------- | |
3675 void Player::Heal(int amount) | |
3676 { | |
3677 Player *v2; // esi@1 | |
3678 signed int v3; // eax@3 | |
3679 | |
3680 v2 = this; | |
3681 if ( !this->pConditions[16] && !this->pConditions[14] ) | |
3682 { | |
3683 v3 = GetMaxHealth(); | |
3684 if ( v2->pConditions[17] ) | |
3685 v3 /= 2; | |
3686 v2->sHealth += amount; | |
3687 if ( v2->sHealth > v3 ) | |
3688 v2->sHealth = v3; | |
3689 if ( v2->pConditions[13] ) | |
3690 { | |
3691 if ( v2->sHealth > 0 ) | |
3692 { | |
3693 LODWORD(v2->pConditions[13]) = 0; | |
3694 HIDWORD(v2->pConditions[13]) = 0; | |
3695 } | |
3696 } | |
3697 } | |
3698 } | |
3699 | |
3700 //----- (0048DC1E) -------------------------------------------------------- | |
3701 int Player::ReceiveDamage(signed int type, int resistance) | |
3702 { | |
3703 Player *v3; // esi@1 | |
3704 signed int v4; // eax@1 | |
3705 int v5; // eax@1 | |
3706 bool v6; // ebx@1 | |
3707 unsigned int v7; // eax@8 | |
3708 char *v8; // ecx@9 | |
3709 int v9; // eax@9 | |
187 | 3710 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3711 |
3712 v3 = this; | |
3713 this->pConditions[2] = 0i64; | |
3714 v4 = CalculateIncommingDamage(resistance, type); | |
3715 v3->sHealth -= v4; | |
187 | 3716 //typea = v4; |
0 | 3717 v5 = v3->sHealth; |
3718 v6 = v5 < -10; | |
3719 LOBYTE(v6) = v5 <= -10; | |
3720 if ( v5 < 1 ) | |
3721 { | |
3722 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3723 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) | |
3724 { | |
3725 SetCondition(0xDu, 0); | |
3726 } | |
3727 else | |
3728 { | |
3729 SetCondition(0xEu, 0); | |
3730 v6 = LODWORD(pParty->uTimePlayed); | |
3731 if ( v3->sHealth > 0 ) | |
3732 v3->sHealth = 0; | |
3733 } | |
3734 if ( v6 ) | |
3735 { | |
898 | 3736 v7 = v3->pEquipment.uArmor; |
0 | 3737 if ( v7 ) |
3738 { | |
3739 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3740 v9 = *(int *)v8; | |
3741 if ( !(BYTE1(v9) & 2) ) | |
3742 { | |
3743 LOBYTE(v9) = v9 | 2; | |
3744 *(int *)v8 = v9; | |
3745 } | |
3746 } | |
3747 } | |
3748 } | |
187 | 3749 if ( v4 && CanAct() ) |
3750 PlaySound(SPEECH_24, 0); | |
3751 return v4; | |
0 | 3752 } |
3753 | |
3754 //----- (0048DCF6) -------------------------------------------------------- | |
3755 int Player::_48DCF6(int a2, Actor *pActor) | |
3756 { | |
3757 signed int v3; // edi@1 | |
3758 signed int v4; // ebx@1 | |
3759 Player *v5; // esi@1 | |
3760 int v6; // eax@2 | |
3761 int v7; // eax@5 | |
3762 int v8; // eax@8 | |
3763 int v9; // ebx@8 | |
3764 int v10; // eax@8 | |
3765 int v11; // ebx@8 | |
3766 signed int v12; // edx@9 | |
3767 ItemGen *v13; // eax@9 | |
3768 int v14; // edx@16 | |
3769 unsigned int v15; // edx@17 | |
3770 int v16; // edx@26 | |
3771 unsigned int v17; // edx@27 | |
3772 Player *v18; // ecx@32 | |
3773 signed int v19; // edx@38 | |
3774 int *v20; // ecx@38 | |
3775 signed int v21; // eax@40 | |
3776 int v22; // eax@49 | |
3777 signed int v23; // ebx@49 | |
3778 unsigned int v24; // eax@60 | |
3779 int v25; // ecx@61 | |
3780 int v26; // ebx@74 | |
3781 void *v27; // ecx@76 | |
3782 unsigned int v28; // ebx@78 | |
3783 signed int result; // eax@86 | |
3784 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3785 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3786 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3787 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3788 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3789 int v35; // [sp-Ch] [bp-ACh]@56 | |
3790 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3791 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3792 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3793 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3794 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3795 int v41; // [sp-4h] [bp-A4h]@51 | |
3796 int v42; // [sp-4h] [bp-A4h]@56 | |
3797 int v43; // [sp-4h] [bp-A4h]@57 | |
3798 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3799 int v45; // [sp-4h] [bp-A4h]@68 | |
3800 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3801 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3802 int v48; // [sp+9Ch] [bp-4h]@1 | |
3803 | |
3804 v3 = 0; | |
3805 v4 = 0; | |
3806 v5 = this; | |
3807 v47 = 0; | |
3808 v48 = 0; | |
3809 switch ( a2 ) | |
3810 { | |
3811 case 1: | |
3812 v6 = GetActualWillpower(); | |
3813 goto LABEL_46; | |
3814 case 2: | |
3815 case 3: | |
3816 case 4: | |
3817 case 9: | |
3818 case 10: | |
3819 case 11: | |
3820 case 13: | |
3821 case 21: | |
3822 v6 = GetActualEndurance(); | |
3823 goto LABEL_46; | |
3824 case 5: | |
3825 case 12: | |
3826 case 23: | |
3827 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3828 goto LABEL_5; | |
3829 case 15: | |
3830 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3831 goto LABEL_5; | |
3832 case 6: | |
3833 case 7: | |
3834 case 8: | |
3835 case 14: | |
3836 case 16: | |
3837 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3838 LABEL_5: | |
3839 v7 = GetActualResistance(v40); | |
3840 goto LABEL_47; | |
3841 case 22: | |
3842 v8 = GetActualWillpower(); | |
3843 v9 = _48EA1B_get_static_effect(v8); | |
3844 v10 = GetActualIntelligence(); | |
3845 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3846 break; | |
3847 case 17: | |
3848 v12 = 0; | |
3849 v13 = this->pInventoryItems; | |
3850 do | |
3851 { | |
315 | 3852 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3853 v46[v4++] = v12; |
3854 ++v12; | |
3855 ++v13; | |
3856 } | |
3857 while ( v12 < 138 ); | |
3858 goto LABEL_36; | |
3859 case 18: | |
3860 v14 = 0; | |
3861 do | |
3862 { | |
3863 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3864 { | |
816 | 3865 if ( v15 == EQUIP_ARMOUR ) |
898 | 3866 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3867 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3868 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3869 } |
3870 v14 = v15 + 1; | |
3871 } | |
3872 while ( v14 < 16 ); | |
3873 goto LABEL_36; | |
3874 case 19: | |
3875 v16 = 0; | |
3876 do | |
3877 { | |
3878 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3879 { | |
3880 if ( v17 == 2 ) | |
3881 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3882 if ( (!v17 || v17 == 1) | |
816 | 3883 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3884 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3885 } |
3886 v16 = v17 + 1; | |
3887 } | |
3888 while ( v16 < 16 ); | |
3889 LABEL_36: | |
3890 if ( !v4 ) | |
3891 goto LABEL_87; | |
3892 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3893 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3894 break; | |
3895 case 20: | |
3896 v19 = 0; | |
3897 v20 = this->pInventoryIndices; | |
3898 do | |
3899 { | |
3900 if ( *v20 > 0 ) | |
3901 { | |
232 | 3902 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3903 if ( v21 > 0 ) |
3904 { | |
3905 if ( v21 <= 134 ) | |
3906 v46[v4++] = v19; | |
3907 } | |
3908 } | |
3909 ++v19; | |
3910 ++v20; | |
3911 } | |
3912 while ( v19 < 126 ); | |
3913 if ( !v4 ) | |
3914 goto LABEL_87; | |
3915 v47 = (unsigned __int8)v46[rand() % v4]; | |
3916 v6 = GetActualAccuracy(); | |
3917 LABEL_46: | |
3918 v7 = _48EA1B_get_static_effect(v6); | |
3919 LABEL_47: | |
3920 v11 = v7; | |
3921 break; | |
3922 default: | |
3923 v11 = 0; | |
3924 break; | |
3925 } | |
3926 v22 = GetActualLuck(); | |
3927 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3928 if ( rand() % v23 >= 30 ) | |
3929 { | |
3930 LABEL_87: | |
3931 result = 0; | |
3932 } | |
3933 else | |
3934 { | |
3935 switch ( a2 ) | |
3936 { | |
3937 case 1: | |
3938 v41 = 1; | |
3939 v36 = 0; | |
3940 goto LABEL_56; | |
3941 case 2: | |
3942 v41 = 1; | |
3943 v36 = 1; | |
3944 goto LABEL_56; | |
3945 case 3: | |
3946 v41 = 1; | |
3947 v36 = 2; | |
3948 goto LABEL_56; | |
3949 case 23: | |
3950 v41 = 1; | |
3951 v36 = 3; | |
3952 goto LABEL_56; | |
3953 case 4: | |
3954 v41 = 1; | |
3955 v36 = 4; | |
3956 LABEL_56: | |
3957 SetCondition(v36, v41); | |
3958 v42 = 0; | |
3959 v37 = 0; | |
3960 v35 = 0; | |
3961 v34 = 0; | |
3962 v33 = -1; | |
3963 v32 = 0; | |
3964 v31 = 0; | |
3965 v30 = (SoundID)221; | |
3966 goto LABEL_83; | |
3967 case 5: | |
3968 v43 = 1; | |
3969 v38 = 5; | |
3970 goto LABEL_70; | |
3971 case 6: | |
3972 case 7: | |
3973 case 8: | |
3974 if ( a2 == 6 ) | |
3975 { | |
3976 v44 = 6; | |
3977 goto LABEL_60; | |
3978 } | |
3979 v25 = 2 * (a2 != 8) + 8; | |
3980 goto LABEL_65; | |
3981 case 9: | |
3982 if ( a2 == 6 ) | |
3983 { | |
3984 v44 = 7; | |
3985 LABEL_60: | |
3986 v24 = v44; | |
3987 } | |
3988 else | |
3989 { | |
3990 v25 = 2 * (a2 != 8) + 9; | |
3991 LABEL_65: | |
3992 v24 = v25; | |
3993 } | |
3994 SetCondition(v24, 1); | |
3995 v42 = 0; | |
3996 v37 = 0; | |
3997 v35 = 0; | |
3998 v34 = 0; | |
3999 v33 = -1; | |
4000 v32 = 0; | |
4001 v31 = 0; | |
4002 v30 = (SoundID)222; | |
4003 LABEL_83: | |
4004 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
4005 do | |
4006 { | |
4007 LABEL_84: | |
4008 if ( v5 == pPlayers[v3 + 1] ) | |
4009 break; | |
4010 ++v3; | |
4011 } | |
4012 while ( v3 < 4 ); | |
4013 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
4014 result = 1; | |
4015 break; | |
4016 case 12: | |
4017 v43 = 1; | |
4018 v38 = 12; | |
4019 goto LABEL_70; | |
4020 case 15: | |
4021 v45 = 1; | |
4022 v39 = 15; | |
4023 goto LABEL_73; | |
4024 case 13: | |
4025 v43 = 1; | |
4026 v38 = 13; | |
4027 LABEL_70: | |
4028 SetCondition(v38, v43); | |
4029 v42 = 0; | |
4030 v37 = 0; | |
4031 v35 = 0; | |
4032 v34 = 0; | |
4033 v33 = -1; | |
4034 v32 = 0; | |
4035 v31 = 0; | |
4036 v30 = (SoundID)224; | |
4037 goto LABEL_83; | |
4038 case 14: | |
4039 v45 = 1; | |
4040 v39 = 14; | |
4041 goto LABEL_73; | |
4042 case 16: | |
4043 v45 = 1; | |
4044 v39 = 16; | |
4045 LABEL_73: | |
4046 SetCondition(v39, v45); | |
4047 v42 = 0; | |
4048 v37 = 0; | |
4049 v35 = 0; | |
4050 v34 = 0; | |
4051 v33 = -1; | |
4052 v32 = 0; | |
4053 v31 = 0; | |
4054 v30 = (SoundID)225; | |
4055 goto LABEL_83; | |
4056 case 17: | |
4057 case 18: | |
4058 case 19: | |
4059 v26 = v48; | |
4060 if ( *(char *)(v48 + 21) & 2 ) | |
4061 goto LABEL_84; | |
187 | 4062 PlaySound(SPEECH_40, 0); |
0 | 4063 *(int *)(v26 + 20) |= 2u; |
4064 goto LABEL_79; | |
4065 case 20: | |
187 | 4066 PlaySound(SPEECH_40, 0); |
0 | 4067 v27 = pActor->array_000234; |
4068 if ( pActor->array_000234[0].uItemID ) | |
4069 { | |
4070 v27 = &pActor->array_000234[1]; | |
4071 if ( pActor->array_000234[1].uItemID ) | |
4072 goto LABEL_84; | |
4073 } | |
4074 v28 = v47; | |
654 | 4075 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 4076 RemoveItemAtInventoryIndex(v28); |
4077 LABEL_79: | |
4078 v42 = 0; | |
4079 v37 = 0; | |
4080 v35 = 0; | |
4081 v34 = 0; | |
4082 v33 = -1; | |
4083 v32 = 0; | |
4084 v31 = 0; | |
4085 v30 = (SoundID)47; | |
4086 goto LABEL_83; | |
4087 case 21: | |
187 | 4088 PlaySound(SPEECH_42, 0); |
0 | 4089 ++v5->sAgeModifier; |
4090 goto LABEL_82; | |
4091 case 22: | |
187 | 4092 PlaySound(SPEECH_41, 0); |
0 | 4093 v5->sMana = 0; |
4094 LABEL_82: | |
4095 v42 = 0; | |
4096 v37 = 0; | |
4097 v35 = 0; | |
4098 v34 = 0; | |
4099 v33 = -1; | |
4100 v32 = 0; | |
4101 v31 = 0; | |
4102 v30 = (SoundID)226; | |
4103 goto LABEL_83; | |
4104 default: | |
4105 goto LABEL_87; | |
4106 } | |
4107 } | |
4108 return result; | |
4109 } | |
324 | 4110 |
0 | 4111 // 48DCF6: using guessed type char var_94[140]; |
4112 | |
4113 //----- (0048E1A3) -------------------------------------------------------- | |
4114 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4115 { | |
4116 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4117 } | |
4118 | |
4119 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4120 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4121 { | |
4122 ItemGen *weapon = nullptr; | |
4123 ItemDesc *weapon_desc = nullptr; | |
4124 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4125 if (bRangedAttack) | |
0 | 4126 { |
4127 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4128 goto LABEL_17; | |
816 | 4129 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4130 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4131 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4132 goto LABEL_17; | |
4133 } | |
4134 else if ( IsUnarmed() == 1 ) | |
4135 { | |
4136 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4137 { | |
4138 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4139 goto LABEL_17; |
4140 } | |
4141 } | |
816 | 4142 |
4143 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4144 { | |
4145 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4146 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4147 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4148 { | |
4149 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4150 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4151 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4152 } | |
0 | 4153 else |
816 | 4154 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4155 } | |
4156 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 | |
4157 { | |
898 | 4158 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4159 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4160 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4161 { | |
898 | 4162 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4163 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4164 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4165 } | |
4166 } | |
4167 | |
0 | 4168 LABEL_17: |
816 | 4169 uint armour_recovery = 0; |
0 | 4170 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4171 { | |
898 | 4172 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4173 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4174 | |
4175 float armour_recovery_multipliers[4]; | |
4176 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4177 { | |
4178 armour_recovery_multipliers[0] = 1.0f; | |
4179 armour_recovery_multipliers[1] = 0; | |
4180 armour_recovery_multipliers[2] = 0; | |
4181 armour_recovery_multipliers[3] = 0; | |
4182 } | |
4183 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4184 { | |
4185 armour_recovery_multipliers[0] = 1.0f; | |
4186 armour_recovery_multipliers[1] = 0.5f; | |
4187 armour_recovery_multipliers[2] = 0; | |
4188 armour_recovery_multipliers[3] = 0; | |
4189 } | |
4190 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4191 { | |
4192 armour_recovery_multipliers[0] = 1.0f; | |
4193 armour_recovery_multipliers[1] = 0.5f; | |
4194 armour_recovery_multipliers[2] = 0.5f; | |
4195 armour_recovery_multipliers[3] = 0; | |
0 | 4196 } |
4197 else | |
4198 { | |
816 | 4199 assert(false && "Unknown armour type"); // what kind of armour is that? |
4200 armour_recovery_multipliers[0] = 1.0f; | |
4201 armour_recovery_multipliers[1] = 1.0f; | |
4202 armour_recovery_multipliers[2] = 1.0f; | |
4203 armour_recovery_multipliers[3] = 1.0f; | |
4204 } | |
4205 | |
4206 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4207 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4208 } | |
4209 | |
4210 uint shield_recovery = 0; | |
4211 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4212 { | |
4213 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4214 | |
898 | 4215 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4216 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4217 | |
4218 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4219 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4220 } | |
4221 | |
4222 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4223 sword_axe_bow_recovery_reduction = 0; | |
4224 bool shooting_laser = false; | |
4225 if (weapon_desc) | |
4226 { | |
4227 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4228 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4229 { | |
4230 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4231 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4232 } | |
4233 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4234 shooting_laser = true; | |
4235 } | |
4236 | |
4237 uint armsmaster_recovery_reduction = 0; | |
4238 if (!bRangedAttack && !shooting_laser) | |
4239 { | |
4240 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4241 { | |
4242 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4243 if (SkillToMastery(armsmaster_level) >= 4) | |
4244 armsmaster_recovery_reduction *= 2; | |
4245 } | |
4246 } | |
4247 | |
4248 uint v41 = 0; | |
4249 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4250 v41 = 25; |
816 | 4251 |
4252 uint weapon_enchantment_recovery_reduction = 0; | |
4253 if ( weapon ) | |
4254 { | |
4255 if (weapon->uSpecEnchantmentType == 59 || | |
4256 weapon->uSpecEnchantmentType == 41 || | |
4257 weapon->uSpecEnchantmentType == 500) | |
4258 weapon_enchantment_recovery_reduction = 20; | |
4259 } | |
4260 | |
4261 | |
4262 int recovery = weapon_recovery + | |
4263 armour_recovery + | |
4264 shield_recovery | |
4265 - armsmaster_recovery_reduction | |
4266 - weapon_enchantment_recovery_reduction | |
4267 - v41 | |
4268 - sword_axe_bow_recovery_reduction | |
4269 - player_speed_recovery_reduction; | |
4270 | |
4271 if (recovery < 0) | |
4272 recovery = 0; | |
4273 return recovery; | |
0 | 4274 } |
4275 | |
4276 //----- (0048E4F8) -------------------------------------------------------- | |
4277 int Player::GetMaxHealth() | |
4278 { | |
4279 int v3; // esi@1 | |
4280 int v4; // esi@1 | |
4281 int v6; // esi@1 | |
4282 | |
4283 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4284 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4285 v6 = uFullHealthBonus |
135 | 4286 + pBaseHealthByClass[classType / 4] |
0 | 4287 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4288 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4289 if (v6 <= 0) | |
4290 return 1; | |
4291 return v6; | |
4292 } | |
4293 | |
4294 //----- (0048E565) -------------------------------------------------------- | |
4295 int Player::GetMaxMana() | |
4296 { | |
4297 int v2; // eax@2 | |
4298 int v3; // esi@4 | |
4299 int v4; // eax@5 | |
4300 int v5; // esi@5 | |
4301 int v6; // eax@5 | |
4302 int v7; // esi@6 | |
4303 int v8; // esi@6 | |
4304 int v9; // esi@6 | |
4305 int result; // eax@7 | |
4306 | |
135 | 4307 switch (classType) |
0 | 4308 { |
4309 case 5u: | |
4310 case 6u: | |
4311 case 7u: | |
4312 case 0x10u: | |
4313 case 0x11u: | |
4314 case 0x12u: | |
4315 case 0x13u: | |
4316 case 0x20u: | |
4317 case 0x21u: | |
4318 case 0x22u: | |
4319 case 0x23u: | |
4320 v2 = GetActualIntelligence(); | |
4321 v3 = _48EA1B_get_static_effect(v2); | |
4322 goto LABEL_6; | |
4323 case 9u: | |
4324 case 0xAu: | |
4325 case 0xBu: | |
4326 case 0xCu: | |
4327 case 0xDu: | |
4328 case 0xEu: | |
4329 case 0xFu: | |
4330 case 0x18u: | |
4331 case 0x19u: | |
4332 case 0x1Au: | |
4333 case 0x1Bu: | |
4334 v2 = GetActualWillpower(); | |
4335 v3 = _48EA1B_get_static_effect(v2); | |
4336 goto LABEL_6; | |
4337 case 0x15u: | |
4338 case 0x16u: | |
4339 case 0x17u: | |
4340 case 0x1Cu: | |
4341 case 0x1Du: | |
4342 case 0x1Eu: | |
4343 case 0x1Fu: | |
4344 v4 = GetActualWillpower(); | |
4345 v5 = _48EA1B_get_static_effect(v4); | |
4346 v6 = GetActualIntelligence(); | |
4347 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4348 LABEL_6: | |
135 | 4349 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4350 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4351 v9 = uFullManaBonus | |
135 | 4352 + pBaseManaByClass[classType / 4] |
0 | 4353 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4354 + v8; | |
4355 if ( v9 < 1 ) | |
4356 goto LABEL_7; | |
4357 result = v9; | |
4358 break; | |
4359 default: | |
4360 LABEL_7: | |
4361 result = 0; | |
4362 break; | |
4363 } | |
4364 return result; | |
4365 } | |
4366 | |
4367 //----- (0048E656) -------------------------------------------------------- | |
4368 int Player::GetBaseAC() | |
4369 { | |
4370 Player *v1; // edi@1 | |
4371 int v2; // eax@1 | |
4372 int v3; // esi@1 | |
4373 int v4; // esi@1 | |
4374 int v5; // esi@1 | |
4375 int result; // eax@2 | |
4376 | |
4377 v1 = this; | |
4378 v2 = GetActualSpeed(); | |
4379 v3 = _48EA1B_get_static_effect(v2); | |
4380 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4381 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4382 if ( v5 >= 1 ) | |
4383 result = v5; | |
4384 else | |
4385 result = 0; | |
4386 return result; | |
4387 } | |
4388 | |
4389 //----- (0048E68F) -------------------------------------------------------- | |
4390 int Player::GetActualAC() | |
4391 { | |
4392 Player *v1; // edi@1 | |
4393 int v2; // eax@1 | |
4394 int v3; // esi@1 | |
4395 int v4; // esi@1 | |
4396 int v5; // esi@1 | |
4397 int v6; // esi@1 | |
4398 int result; // eax@2 | |
4399 | |
4400 v1 = this; | |
4401 v2 = GetActualSpeed(); | |
4402 v3 = _48EA1B_get_static_effect(v2); | |
4403 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4404 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4405 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4406 if ( v6 >= 1 ) | |
4407 result = v6; | |
4408 else | |
4409 result = 0; | |
4410 return result; | |
4411 } | |
4412 | |
4413 //----- (0048E6DC) -------------------------------------------------------- | |
4414 unsigned int Player::GetBaseAge() | |
4415 { | |
352 | 4416 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4417 } |
4418 | |
4419 //----- (0048E72C) -------------------------------------------------------- | |
4420 unsigned int Player::GetActualAge() | |
4421 { | |
4422 return this->sAgeModifier + GetBaseAge(); | |
4423 } | |
4424 | |
4425 //----- (0048E73F) -------------------------------------------------------- | |
4426 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4427 { | |
4428 Player *v2; // ebx@1 | |
4429 signed int v3; // esi@1 | |
4430 enum CHARACTER_RACE v4; // eax@1 | |
4431 signed int v5; // edi@8 | |
4432 char v6; // zf@9 | |
4433 int v7; // esi@20 | |
4434 int result; // eax@21 | |
4435 signed int v9; // [sp-4h] [bp-10h]@11 | |
4436 | |
4437 v2 = this; | |
4438 v3 = 0; | |
4439 v4 = GetRace(); | |
4440 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4441 { | |
4442 v5 = 0; | |
4443 goto LABEL_16; | |
4444 } | |
4445 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4446 { | |
4447 v5 = 1; | |
4448 LABEL_16: | |
4449 v6 = v4 == 2; | |
4450 goto LABEL_17; | |
4451 } | |
4452 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4453 { | |
4454 v6 = v4 == 3; | |
4455 v5 = 2; | |
4456 goto LABEL_17; | |
4457 } | |
4458 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4459 { | |
4460 v5 = 3; | |
4461 v6 = v4 == 3; | |
4462 goto LABEL_17; | |
4463 } | |
4464 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4465 { | |
4466 v5 = 7; | |
4467 if ( v4 != 1 ) | |
4468 goto LABEL_20; | |
4469 v9 = 10; | |
4470 LABEL_19: | |
4471 v3 = v9; | |
4472 goto LABEL_20; | |
4473 } | |
4474 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4475 { | |
4476 v5 = 8; | |
4477 v6 = v4 == 0; | |
4478 LABEL_17: | |
4479 if ( !v6 ) | |
4480 goto LABEL_20; | |
4481 v9 = 5; | |
4482 goto LABEL_19; | |
4483 } | |
4484 v5 = 0; | |
4485 LABEL_20: | |
4486 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4487 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4488 result = v7 + *(&v2->sResFireBase + v5); |
4489 return result; | |
4490 } | |
4491 | |
4492 //----- (0048E7D0) -------------------------------------------------------- | |
4493 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4494 { | |
4495 signed int v2; // edi@1 | |
4496 Player *v3; // esi@1 | |
4497 enum CHARACTER_RACE v4; // ebx@1 | |
4498 Player *v5; // ecx@8 | |
4499 char v6; // zf@18 | |
4500 int v7; // ebx@28 | |
4501 int result; // eax@28 | |
4502 signed int v9; // [sp+10h] [bp-8h]@1 | |
4503 signed int v10; // [sp+14h] [bp-4h]@1 | |
4504 | |
4505 v2 = 0; | |
4506 v3 = this; | |
4507 v10 = 0; | |
4508 v9 = 0; | |
4509 v4 = GetRace(); | |
652 | 4510 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4511 v10 = 20; |
4512 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4513 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4514 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4515 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4516 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4517 && HasItemEquipped(EQUIP_ARMOUR) | |
4518 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4519 v10 += v3->pActiveSkills[9] & 0x3F; | |
4520 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4521 goto LABEL_25; | |
4522 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4523 { | |
4524 v2 = 1; | |
4525 LABEL_25: | |
4526 v6 = v4 == 2; | |
4527 LABEL_26: | |
4528 if ( v6 ) | |
4529 v9 = 5; | |
4530 goto LABEL_28; | |
4531 } | |
4532 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4533 { | |
4534 v6 = v4 == 3; | |
4535 v2 = 2; | |
4536 goto LABEL_26; | |
4537 } | |
4538 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4539 { | |
4540 v2 = 3; | |
4541 if ( v4 == 3 ) | |
4542 v10 += 5; | |
4543 } | |
4544 else | |
4545 { | |
4546 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4547 { | |
4548 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4549 goto LABEL_28; | |
4550 v2 = 8; | |
4551 v6 = v4 == 0; | |
4552 goto LABEL_26; | |
4553 } | |
4554 v2 = 7; | |
4555 if ( v4 == 1 ) | |
4556 v9 = 10; | |
4557 } | |
4558 LABEL_28: | |
4559 v7 = GetItemsBonus(a2, 0); | |
4560 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4561 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4562 { |
4563 if ( result > 200 ) | |
4564 result = 200; | |
4565 } | |
4566 return result; | |
4567 } | |
4568 | |
4569 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4570 bool Player::Recover(int dt) |
4571 { | |
4572 //Player *v2; // esi@1 | |
0 | 4573 signed __int64 v3; // qax@1 |
816 | 4574 //bool result; // eax@4 |
4575 | |
4576 //v2 = this; | |
4577 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4578 | |
4579 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4580 | |
4581 if (uTimeToRecovery > v3) | |
4582 { | |
4583 uTimeToRecovery -= v3; | |
4584 return true; | |
0 | 4585 } |
4586 else | |
4587 { | |
816 | 4588 uTimeToRecovery = 0; |
4589 viewparams->bRedrawGameUI = true; | |
4590 if (!uActiveCharacter) | |
0 | 4591 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4592 return false; |
4593 } | |
0 | 4594 } |
4595 | |
4596 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4597 void Player::SetRecoveryTime(signed int rec) |
4598 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4599 assert(rec >= 0); |
816 | 4600 |
4601 if (rec > uTimeToRecovery) | |
4602 uTimeToRecovery = rec; | |
4603 | |
4604 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4605 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4606 |
4607 viewparams->bRedrawGameUI = true; | |
0 | 4608 } |
4609 // 50C0C4: using guessed type int some_active_character; | |
4610 | |
4611 //----- (0048E9B7) -------------------------------------------------------- | |
4612 void Player::RandomizeName() | |
4613 { | |
4614 if (!uExpressionTimePassed) | |
4615 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4616 } | |
4617 | |
4618 //----- (0048E9F4) -------------------------------------------------------- | |
4619 unsigned int Player::GetMajorConditionIdx() | |
4620 { | |
4621 for (uint i = 0; i < 18; ++i) | |
4622 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4623 return pConditionImportancyTable[i]; | |
4624 | |
4625 return 18; | |
4626 } | |
4627 | |
4628 //----- (0048EA1B) -------------------------------------------------------- | |
4629 int Player::_48EA1B_get_static_effect(int a2) | |
4630 { | |
4631 __int16 v2; // cx@1 | |
4632 int v3; // eax@1 | |
4633 | |
4634 v2 = word_4EDFFC[0]; | |
4635 v3 = 0; | |
4636 while ( a2 < v2 && v2 ) | |
4637 v2 = word_4EDFFC[v3++ + 1]; | |
4638 return player_stat_bonuses[v3]; | |
4639 } | |
4640 | |
4641 //----- (0048EA46) -------------------------------------------------------- | |
4642 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4643 { | |
4644 int v3; // esi@1 | |
4645 int v4; // edx@2 | |
4646 int v5; // eax@3 | |
4647 char *v6; // eax@4 | |
4648 | |
4649 v3 = 0; | |
4650 while ( 1 ) | |
4651 { | |
4652 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4653 goto LABEL_11; | |
816 | 4654 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4655 if ( a2 != 17 ) |
816 | 4656 { |
4657 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4658 goto LABEL_11; | |
4659 return 5; | |
4660 } | |
0 | 4661 v6 = (char *)this + 36 * v5; |
4662 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4663 return 50; | |
4664 LABEL_11: | |
4665 ++v3; | |
4666 if ( (signed int)v3 >= 16 ) | |
816 | 4667 return 0; |
4668 } | |
0 | 4669 } |
4670 | |
4671 //----- (0048EAAE) -------------------------------------------------------- | |
4672 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4673 { | |
4674 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4675 signed int v4; // eax@1 | |
4676 int v5; // edi@1 | |
4677 Player *v6; // ebx@1 | |
4678 Player *v8; // ecx@48 | |
4679 int v9; // eax@49 | |
4680 int v10; // edx@49 | |
4681 Player *v11; // ecx@55 | |
4682 int v12; // eax@56 | |
4683 int v13; // edx@56 | |
4684 int v14; // ecx@58 | |
4685 int v15; // eax@58 | |
4686 Player *v16; // ecx@61 | |
4687 int v17; // eax@62 | |
4688 Player *v18; // ecx@66 | |
4689 int v19; // eax@67 | |
4690 int v20; // eax@69 | |
4691 Player *v21; // ecx@75 | |
4692 int v22; // eax@76 | |
4693 int v23; // edx@76 | |
4694 int v24; // eax@79 | |
4695 int v25; // ecx@80 | |
4696 int v26; // edi@80 | |
4697 Player *v27; // ecx@84 | |
4698 int v28; // eax@85 | |
4699 int v29; // edx@85 | |
4700 Player *v30; // ecx@96 | |
4701 int v31; // ebp@97 | |
4702 int v32; // eax@98 | |
4703 unsigned int v33; // eax@100 | |
4704 int v34; // eax@103 | |
4705 char v35; // zf@104 | |
4706 char v36; // zf@107 | |
4707 unsigned __int8 v37; // zf@119 | |
4708 char v38; // sf@119 | |
4709 unsigned __int8 v39; // of@119 | |
4710 char v40; // zf@122 | |
4711 char v41; // zf@145 | |
4712 char v42; // zf@164 | |
4713 char v43; // zf@173 | |
4714 char v44; // zf@189 | |
4715 char v45; // zf@198 | |
4716 char v46; // zf@239 | |
4717 int v47; // eax@268 | |
4718 int v48; // eax@269 | |
4719 int v49; // eax@291 | |
4720 char v50; // zf@295 | |
4721 int v51; // eax@306 | |
4722 int v52; // eax@307 | |
4723 char v53; // zf@312 | |
4724 char v54; // zf@336 | |
4725 char v55; // zf@348 | |
4726 int v56; // eax@365 | |
4727 int v57; // ebx@368 | |
4728 signed int v58; // [sp-4h] [bp-20h]@10 | |
4729 signed int v59; // [sp-4h] [bp-20h]@71 | |
4730 signed int v60; // [sp-4h] [bp-20h]@347 | |
4731 int v61; // [sp+10h] [bp-Ch]@1 | |
4732 int v62; // [sp+14h] [bp-8h]@1 | |
4733 int v63; // [sp+18h] [bp-4h]@101 | |
4734 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4735 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4736 | |
4737 v3 = attr; | |
4738 v4 = 36; | |
4739 v5 = 0; | |
4740 v6 = this; | |
4741 v62 = 0; | |
4742 v61 = 0; | |
4743 | |
4744 switch (attr) | |
4745 { | |
4746 case CHARACTER_ATTRIBUTE_LEVEL: | |
4747 if (HasEnchantedItemEquipped(25)) | |
4748 return 5; | |
4749 return 0; | |
4750 }; | |
4751 | |
4752 if ( (signed int)attr > 36 ) | |
4753 { | |
4754 switch ( attr ) | |
4755 { | |
4756 case 37: | |
4757 v58 = 15; | |
4758 goto LABEL_35; | |
4759 case 38: | |
4760 v58 = 16; | |
4761 goto LABEL_35; | |
4762 case 39: | |
4763 v58 = 17; | |
4764 goto LABEL_35; | |
4765 case 40: | |
4766 v58 = 18; | |
4767 goto LABEL_35; | |
4768 case 41: | |
4769 v58 = 19; | |
4770 goto LABEL_35; | |
4771 case 42: | |
4772 v58 = 20; | |
4773 goto LABEL_35; | |
4774 case 43: | |
4775 v58 = 25; | |
4776 goto LABEL_35; | |
4777 case 44: | |
4778 v58 = 5; | |
4779 goto LABEL_35; | |
4780 case 45: | |
4781 v58 = 8; | |
4782 goto LABEL_35; | |
4783 case 46: | |
4784 goto LABEL_36; | |
4785 default: | |
4786 break; | |
4787 } | |
4788 } | |
4789 else | |
4790 { | |
4791 if ( attr == 36 ) | |
4792 { | |
4793 v58 = 14; | |
4794 } | |
4795 else | |
4796 { | |
4797 if ( (signed int)attr > 21 ) | |
4798 { | |
4799 switch ( attr ) | |
4800 { | |
4801 case 22: | |
4802 v58 = 30; | |
4803 break; | |
4804 case 23: | |
4805 v58 = 31; | |
4806 break; | |
4807 case 34: | |
4808 v58 = 12; | |
4809 break; | |
4810 default: | |
4811 if ( attr != 35 ) | |
4812 goto LABEL_38; | |
4813 v58 = 13; | |
4814 break; | |
4815 } | |
4816 } | |
4817 else | |
4818 { | |
4819 switch ( attr ) | |
4820 { | |
4821 case 21: | |
4822 v58 = 33; | |
4823 break; | |
4824 case 16: | |
4825 v58 = 35; | |
4826 break; | |
4827 case 17: | |
4828 v58 = 34; | |
4829 break; | |
4830 case 18: | |
4831 v58 = 29; | |
4832 break; | |
4833 case 19: | |
4834 v58 = 21; | |
4835 break; | |
4836 default: | |
4837 if ( attr != 20 ) | |
4838 goto LABEL_38; | |
4839 v58 = 32; | |
4840 break; | |
4841 } | |
4842 } | |
4843 } | |
4844 LABEL_35: | |
4845 v4 = v58; | |
4846 LABEL_36: | |
4847 if ( !this->pActiveSkills[v4] ) | |
4848 return 0; | |
4849 } | |
4850 LABEL_38: | |
4851 if ( (signed int)attr > 28 ) | |
4852 { | |
4853 if ( (signed int)attr < 29 ) | |
4854 return v5 + v62 + v61; | |
4855 if ( (signed int)attr <= 30 ) | |
4856 { | |
4857 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4858 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4859 return v5 + v62 + v61; |
4860 } | |
4861 if ( attr == 31 ) | |
4862 { | |
4863 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4864 return v5 + v62 + v61; | |
232 | 4865 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4866 v5 = pItemsTable->pItems[v57].uDamageMod; |
4867 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4868 goto LABEL_366; | |
4869 } | |
4870 if ( attr == 32 ) | |
4871 { | |
4872 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4873 return v5 + v62 + v61; | |
232 | 4874 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4875 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4876 LABEL_365: | |
4877 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4878 LABEL_366: | |
4879 v5 += v56; | |
4880 return v5 + v62 + v61; | |
4881 } | |
4882 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4883 return v5 + v62 + v61; | |
4884 LABEL_95: | |
4885 v65 = 0; | |
4886 while ( 1 ) | |
4887 { | |
4888 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4889 goto LABEL_361; | |
898 | 4890 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4891 if ( v3 == 9 ) |
4892 { | |
816 | 4893 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4894 if ( v32 >= 3 ) |
4895 { | |
4896 if ( v32 <= 11 ) | |
4897 { | |
4898 v33 = v6->pInventoryItems[v31].uItemID; | |
4899 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4900 } | |
4901 } | |
4902 } | |
4903 v63 = (int)((char *)v6 + 36 * v31); | |
4904 attra = (ItemGen *)(v63 + 532); | |
377 | 4905 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4906 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4907 { |
4908 v34 = attra->uItemID; | |
4909 switch ( attra->uItemID ) | |
4910 { | |
4911 case 0x1F4u: | |
4912 v35 = v3 == 5; | |
4913 goto LABEL_105; | |
4914 case 0x1F5u: | |
4915 v36 = v3 == 0; | |
4916 goto LABEL_108; | |
4917 case 0x1F6u: | |
4918 if ( v3 == 21 ) | |
4919 v61 += 10; | |
4920 v36 = v3 == 2; | |
4921 goto LABEL_108; | |
4922 case 0x1F7u: | |
4923 if ( v3 == 17 ) | |
4924 v61 += 5; | |
4925 if ( v3 == 18 ) | |
4926 v61 += 5; | |
4927 v36 = v3 == 6; | |
4928 goto LABEL_108; | |
4929 case 0x1F8u: | |
4930 goto LABEL_118; | |
4931 case 0x1F9u: | |
4932 v40 = v3 == 3; | |
4933 goto LABEL_123; | |
4934 case 0x1FAu: | |
4935 v35 = v3 == 10; | |
4936 goto LABEL_105; | |
4937 case 0x1FEu: | |
4938 v35 = v3 == 4; | |
4939 goto LABEL_105; | |
4940 case 0x1FFu: | |
4941 if ( v3 == 23 ) | |
4942 v61 += 10; | |
4943 if ( v3 == 22 ) | |
4944 v61 += 10; | |
4945 goto LABEL_361; | |
4946 case 0x200u: | |
4947 if ( v3 == 36 ) | |
4948 { | |
4949 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4950 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4951 } | |
4952 v36 = v3 == 5; | |
4953 LABEL_108: | |
4954 if ( v36 ) | |
4955 v5 += 40; | |
4956 goto LABEL_361; | |
4957 case 0x201u: | |
4958 if ( v3 == 39 ) | |
4959 { | |
4960 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4961 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4962 v62 = v34; | |
4963 } | |
4964 goto LABEL_136; | |
4965 case 0x202u: | |
4966 if ( !v3 ) | |
4967 v5 += 150; | |
4968 if ( v3 == 1 ) | |
4969 v5 -= 40; | |
4970 if ( v3 == 2 ) | |
4971 v5 -= 40; | |
4972 goto LABEL_145; | |
4973 case 0x203u: | |
4974 if ( v3 == 42 ) | |
4975 { | |
4976 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4977 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4978 } | |
4979 if ( v3 == 43 ) | |
4980 v61 += 15; | |
4981 goto LABEL_361; | |
4982 case 0x204u: | |
4983 if ( v3 == 17 ) | |
4984 v61 += 5; | |
4985 if ( v3 == 18 ) | |
4986 v61 += 5; | |
4987 if ( v3 == 6 ) | |
4988 v5 += 50; | |
4989 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4990 goto LABEL_166; | |
4991 v42 = v3 == 15; | |
4992 goto LABEL_165; | |
4993 case 0x205u: | |
4994 if ( v3 == 18 ) | |
4995 v61 += 5; | |
4996 goto LABEL_361; | |
4997 case 0x206u: | |
4998 if ( !v3 ) | |
4999 v5 += 100; | |
5000 if ( v3 == 3 ) | |
5001 v5 += 100; | |
5002 v43 = v3 == 9; | |
5003 goto LABEL_174; | |
5004 case 0x207u: | |
5005 if ( v3 == 45 ) | |
5006 v61 += 5; | |
5007 if ( v3 == 15 ) | |
5008 v5 -= 10; | |
5009 v42 = v3 == 14; | |
5010 LABEL_165: | |
5011 if ( v42 ) | |
5012 LABEL_166: | |
5013 v5 -= 10; | |
5014 goto LABEL_361; | |
5015 case 0x208u: | |
5016 v35 = v3 == 3; | |
5017 goto LABEL_105; | |
5018 case 0x209u: | |
5019 if ( v3 == 2 ) | |
5020 v5 += 15; | |
5021 if ( !v3 ) | |
5022 v5 += 15; | |
5023 v41 = v3 == 6; | |
5024 goto LABEL_146; | |
5025 case 0x20Au: | |
5026 if ( v3 == 46 ) | |
5027 v61 += 15; | |
5028 v44 = v3 == 3; | |
5029 goto LABEL_190; | |
5030 case 0x20Bu: | |
5031 if ( v3 == 34 ) | |
5032 { | |
5033 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5034 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5035 } | |
5036 if ( v3 == 12 ) | |
5037 v5 += 50; | |
5038 if ( v3 == 2 ) | |
5039 v5 += 30; | |
5040 v45 = v3 == 9; | |
5041 goto LABEL_199; | |
5042 case 0x20Cu: | |
5043 if ( !v3 ) | |
5044 v5 += 75; | |
5045 goto LABEL_145; | |
5046 case 0x20Du: | |
5047 if ( v3 == 5 ) | |
5048 v5 += 50; | |
5049 if ( v3 == 6 ) | |
5050 v5 += 50; | |
5051 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5052 goto LABEL_374; | |
5053 v43 = v3 == 15; | |
5054 LABEL_174: | |
5055 if ( v43 ) | |
5056 LABEL_374: | |
5057 v5 -= 15; | |
5058 goto LABEL_361; | |
5059 case 0x20Eu: | |
5060 if ( v3 == 4 ) | |
5061 v5 += 150; | |
5062 if ( v3 == 44 ) | |
5063 v61 += 5; | |
5064 if ( v3 == 9 ) | |
5065 v5 -= 25; | |
5066 goto LABEL_361; | |
5067 case 0x20Fu: | |
5068 if ( v3 == 39 ) | |
5069 { | |
5070 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5071 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5072 v62 = v34; | |
5073 } | |
5074 if ( v3 == 40 ) | |
5075 { | |
5076 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5077 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5078 } | |
5079 LABEL_145: | |
5080 v41 = v3 == 5; | |
5081 LABEL_146: | |
5082 if ( v41 ) | |
5083 v5 -= 40; | |
5084 goto LABEL_361; | |
5085 case 0x210u: | |
5086 if ( v3 == 38 ) | |
5087 { | |
5088 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5089 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5090 } | |
5091 if ( !v3 ) | |
5092 v5 += 75; | |
5093 v44 = v3 == 11; | |
5094 LABEL_190: | |
5095 if ( v44 ) | |
5096 v5 -= 50; | |
5097 goto LABEL_361; | |
5098 case 0x211u: | |
5099 if ( v3 == 5 ) | |
5100 v5 += 100; | |
5101 if ( v3 == 4 ) | |
5102 v5 += 50; | |
5103 v35 = v3 == 11; | |
5104 LABEL_105: | |
5105 if ( v35 ) | |
5106 v5 += 50; | |
5107 goto LABEL_361; | |
5108 case 0x212u: | |
5109 if ( v3 == 1 ) | |
5110 v5 -= 20; | |
5111 v45 = v3 == 2; | |
5112 LABEL_199: | |
5113 if ( v45 ) | |
5114 v5 -= 20; | |
5115 goto LABEL_361; | |
5116 case 0x214u: | |
5117 if ( v3 == 1 ) | |
5118 v5 += 15; | |
5119 v46 = v3 == 2; | |
5120 goto LABEL_240; | |
5121 case 0x215u: | |
5122 if ( v3 == 5 ) | |
5123 v5 += 15; | |
5124 v46 = v3 == 4; | |
5125 goto LABEL_240; | |
5126 case 0x216u: | |
5127 if ( v3 == 10 ) | |
5128 v5 += 30; | |
5129 if ( !v3 ) | |
5130 v5 += 15; | |
5131 goto LABEL_315; | |
5132 case 0x217u: | |
5133 if ( v3 == 21 ) | |
5134 v61 += 5; | |
5135 if ( !v3 ) | |
5136 v5 += 15; | |
5137 goto LABEL_253; | |
5138 case 0x218u: | |
5139 goto LABEL_253; | |
5140 default: | |
5141 goto LABEL_361; | |
5142 } | |
5143 goto LABEL_361; | |
5144 } | |
5145 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5146 { | |
5147 if ( (signed int)v3 >= 0 ) | |
5148 { | |
5149 if ( (signed int)v3 <= 15 ) | |
5150 { | |
5151 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5152 } | |
5153 else | |
5154 { | |
5155 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5156 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5157 } | |
5158 } | |
5159 goto LABEL_361; | |
5160 } | |
5161 v34 = *(int *)(v63 + 544); | |
5162 if ( v34 > 48 ) | |
5163 { | |
5164 switch ( v34 ) | |
5165 { | |
5166 case 54: | |
5167 goto LABEL_315; | |
5168 case 49: | |
5169 if ( v3 == 6 ) | |
5170 goto LABEL_121; | |
5171 v50 = v3 == 1; | |
5172 goto LABEL_296; | |
5173 case 51: | |
5174 if ( v3 != 5 && v3 != 1 ) | |
5175 goto LABEL_309; | |
5176 goto LABEL_121; | |
5177 case 52: | |
5178 if ( v3 == 3 ) | |
5179 goto LABEL_121; | |
5180 v50 = v3 == 4; | |
5181 goto LABEL_296; | |
5182 case 53: | |
5183 if ( !v3 ) | |
5184 goto LABEL_121; | |
5185 v50 = v3 == 2; | |
5186 goto LABEL_296; | |
5187 case 55: | |
5188 v46 = v3 == 6; | |
5189 goto LABEL_240; | |
5190 case 56: | |
5191 if ( !v3 ) | |
5192 goto LABEL_351; | |
5193 v53 = v3 == 3; | |
5194 goto LABEL_350; | |
5195 case 57: | |
5196 if ( v3 == 1 ) | |
5197 goto LABEL_351; | |
5198 v53 = v3 == 2; | |
5199 goto LABEL_350; | |
5200 case 50: | |
5201 if ( v3 == 10 ) | |
5202 v5 += 30; | |
5203 goto LABEL_361; | |
5204 case 60: | |
5205 if ( v3 != 23 ) | |
5206 goto LABEL_336; | |
5207 if ( v5 >= 3 ) | |
5208 goto LABEL_361; | |
5209 v5 = 3; | |
5210 LABEL_336: | |
5211 v54 = v3 == 22; | |
5212 goto LABEL_345; | |
5213 case 61: | |
5214 if ( v3 != 17 ) | |
5215 goto LABEL_340; | |
5216 if ( v5 >= 3 ) | |
5217 goto LABEL_361; | |
5218 v5 = 3; | |
5219 LABEL_340: | |
5220 v54 = v3 == 18; | |
5221 goto LABEL_345; | |
5222 case 62: | |
5223 if ( v3 != 19 ) | |
5224 goto LABEL_344; | |
5225 if ( v5 >= 3 ) | |
5226 goto LABEL_361; | |
5227 v5 = 3; | |
5228 LABEL_344: | |
5229 v54 = v3 == 20; | |
5230 LABEL_345: | |
5231 if ( !v54 ) | |
5232 goto LABEL_361; | |
5233 if ( v5 >= 3 ) | |
5234 goto LABEL_361; | |
5235 v60 = 3; | |
5236 goto LABEL_360; | |
5237 case 67: | |
5238 v55 = v3 == 18; | |
5239 goto LABEL_357; | |
5240 case 68: | |
5241 v53 = v3 == 9; | |
5242 goto LABEL_350; | |
5243 case 69: | |
5244 if ( v3 == 11 ) | |
5245 v5 += 20; | |
5246 break; | |
5247 case 70: | |
5248 if ( v3 == 12 ) | |
5249 v5 += 10; | |
5250 v55 = v3 == 16; | |
5251 LABEL_357: | |
5252 if ( v55 && v5 < 2 ) | |
5253 { | |
5254 v60 = 2; | |
5255 LABEL_360: | |
5256 v5 = v60; | |
5257 } | |
5258 break; | |
5259 default: | |
5260 goto LABEL_361; | |
5261 } | |
5262 goto LABEL_361; | |
5263 } | |
5264 if ( v34 == 48 ) | |
5265 { | |
5266 if ( v3 == 9 ) | |
5267 v5 += 5; | |
5268 LABEL_315: | |
5269 v46 = v3 == 3; | |
5270 LABEL_240: | |
5271 if ( v46 ) | |
5272 v5 += 15; | |
5273 goto LABEL_361; | |
5274 } | |
5275 if ( v34 > 32 ) | |
5276 { | |
5277 if ( v34 > 44 ) | |
5278 { | |
5279 v51 = v34 - 45; | |
5280 if ( !v51 ) | |
5281 { | |
5282 if ( v3 == 5 ) | |
5283 goto LABEL_351; | |
5284 v53 = v3 == 4; | |
5285 LABEL_350: | |
5286 if ( v53 ) | |
5287 LABEL_351: | |
5288 v5 += 5; | |
5289 goto LABEL_361; | |
5290 } | |
5291 v52 = v51 - 1; | |
5292 if ( !v52 ) | |
5293 { | |
5294 v40 = v3 == 0; | |
5295 LABEL_123: | |
5296 if ( v40 ) | |
5297 v5 += 25; | |
5298 goto LABEL_361; | |
5299 } | |
5300 if ( v52 == 1 ) | |
5301 { | |
5302 LABEL_309: | |
5303 v50 = v3 == 8; | |
5304 goto LABEL_296; | |
5305 } | |
5306 } | |
5307 else | |
5308 { | |
5309 if ( v34 == 44 ) | |
5310 { | |
5311 v50 = v3 == 7; | |
5312 goto LABEL_296; | |
5313 } | |
5314 v34 -= 33; | |
5315 if ( !v34 ) | |
5316 { | |
5317 if ( v3 != 38 ) | |
5318 goto LABEL_361; | |
5319 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5320 goto LABEL_138; | |
5321 } | |
5322 --v34; | |
5323 if ( !v34 ) | |
5324 { | |
5325 if ( v3 != 36 ) | |
5326 goto LABEL_361; | |
5327 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5328 goto LABEL_138; | |
5329 } | |
5330 v49 = v34 - 8; | |
5331 if ( !v49 ) | |
5332 { | |
5333 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5334 ++v5; | |
5335 goto LABEL_361; | |
5336 } | |
5337 if ( v49 == 1 ) | |
5338 { | |
5339 if ( v3 != 3 && v3 != 7 ) | |
5340 { | |
5341 v50 = v3 == 9; | |
5342 LABEL_296: | |
5343 if ( !v50 ) | |
5344 goto LABEL_361; | |
5345 } | |
5346 LABEL_121: | |
5347 v5 += 10; | |
5348 goto LABEL_361; | |
5349 } | |
5350 } | |
5351 } | |
5352 else | |
5353 { | |
5354 if ( v34 == 32 ) | |
5355 { | |
5356 if ( v3 != 39 ) | |
5357 goto LABEL_361; | |
5358 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5359 goto LABEL_138; | |
5360 } | |
5361 if ( v34 > 28 ) | |
5362 { | |
5363 v34 -= 29; | |
5364 if ( v34 ) | |
5365 { | |
5366 --v34; | |
5367 if ( v34 ) | |
5368 { | |
5369 --v34; | |
5370 if ( v34 || v3 != 41 ) | |
5371 goto LABEL_361; | |
5372 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5373 } | |
5374 else | |
5375 { | |
5376 if ( v3 != 34 ) | |
5377 goto LABEL_361; | |
5378 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5379 } | |
5380 } | |
5381 else | |
5382 { | |
5383 if ( v3 != 37 ) | |
5384 goto LABEL_361; | |
5385 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5386 } | |
5387 goto LABEL_138; | |
5388 } | |
5389 if ( v34 == 28 ) | |
5390 { | |
5391 LABEL_136: | |
5392 if ( v3 == 42 ) | |
5393 { | |
5394 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5395 LABEL_138: | |
5396 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5397 goto LABEL_361; | |
5398 } | |
5399 } | |
5400 else | |
5401 { | |
5402 v47 = v34 - 1; | |
5403 if ( v47 ) | |
5404 { | |
5405 v48 = v47 - 1; | |
5406 if ( v48 ) | |
5407 { | |
5408 v34 = v48 - 24; | |
5409 if ( v34 ) | |
5410 { | |
5411 --v34; | |
5412 if ( v34 || v3 != 40 ) | |
5413 goto LABEL_361; | |
5414 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5415 } | |
5416 else | |
5417 { | |
5418 if ( v3 != 35 ) | |
5419 goto LABEL_361; | |
5420 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5421 } | |
5422 goto LABEL_138; | |
5423 } | |
5424 LABEL_118: | |
5425 if ( (signed int)v3 < 0 ) | |
5426 goto LABEL_361; | |
5427 v39 = __OFSUB__((int)v3, 6); | |
5428 v37 = v3 == 6; | |
5429 v38 = v3 - 6 < 0; | |
5430 } | |
5431 else | |
5432 { | |
5433 LABEL_253: | |
5434 if ( (signed int)v3 < 10 ) | |
5435 goto LABEL_361; | |
5436 v39 = __OFSUB__((int)v3, 15); | |
5437 v37 = v3 == 15; | |
5438 v38 = v3 - 15 < 0; | |
5439 } | |
5440 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5441 goto LABEL_121; | |
5442 } | |
5443 } | |
5444 LABEL_361: | |
5445 ++v65; | |
5446 if ( (signed int)v65 >= 16 ) | |
5447 return v5 + v62 + v61; | |
5448 } | |
5449 } | |
5450 if ( attr == 28 ) | |
5451 { | |
5452 if ( IsUnarmed() != 1 ) | |
5453 { | |
816 | 5454 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5455 { | |
5456 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5457 if ( v22 >= 0 ) |
5458 { | |
5459 if ( v22 <= 2 ) | |
5460 { | |
118 | 5461 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5462 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5463 { |
5464 v24 = v23; | |
5465 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5466 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5467 } | |
5468 else | |
5469 { | |
5470 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5471 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5472 } | |
5473 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5474 } | |
5475 } | |
5476 } | |
865 | 5477 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5478 return v5 + v62 + v61; |
5479 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5480 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5481 goto LABEL_88; | |
5482 } | |
5483 v59 = 3; | |
5484 LABEL_74: | |
5485 v5 = v59; | |
5486 return v5 + v62 + v61; | |
5487 } | |
5488 if ( (signed int)attr < 0 ) | |
5489 return v5 + v62 + v61; | |
5490 if ( (signed int)attr <= 23 ) | |
5491 goto LABEL_95; | |
5492 if ( (signed int)attr <= 24 ) | |
5493 return v5 + v62 + v61; | |
5494 if ( (signed int)attr <= 26 ) | |
5495 { | |
5496 if ( IsUnarmed() == 1 ) | |
5497 { | |
5498 v5 = 0; | |
5499 return v5 + v62 + v61; | |
5500 } | |
816 | 5501 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5502 { | |
5503 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5504 if ( v17 >= 0 ) |
5505 { | |
5506 if ( v17 <= 2 ) | |
232 | 5507 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5508 } |
5509 } | |
865 | 5510 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5511 return v5 + v62 + v61; |
898 | 5512 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5513 goto LABEL_365; |
5514 } | |
5515 if ( attr == 27 ) | |
5516 { | |
5517 if ( IsUnarmed() == 1 ) | |
5518 { | |
5519 v5 = 1; | |
5520 return v5 + v62 + v61; | |
5521 } | |
816 | 5522 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5523 { | |
5524 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5525 if ( v9 >= 0 ) |
5526 { | |
5527 if ( v9 <= 2 ) | |
5528 { | |
118 | 5529 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
898 | 5530 if ( !v6->pEquipment.uShield ) |
0 | 5531 { |
118 | 5532 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5533 ++v5; |
5534 } | |
5535 } | |
5536 } | |
5537 } | |
865 | 5538 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5539 return v5 + v62 + v61; |
898 | 5540 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5541 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5542 LABEL_88: |
5543 v5 += v15 + v14; | |
5544 } | |
5545 return v5 + v62 + v61; | |
5546 } | |
5547 | |
5548 //----- (0048F73C) -------------------------------------------------------- | |
5549 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5550 { | |
5551 int result; // eax@1 | |
5552 int v3; // eax@4 | |
5553 int v4; // ecx@5 | |
5554 | |
5555 switch (a2) | |
5556 { | |
5557 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5558 } | |
5559 | |
5560 result = 0; | |
5561 if ( (signed int)a2 > 10 ) | |
5562 { | |
5563 if ( (signed int)a2 <= 15 ) | |
5564 { | |
5565 switch ( a2 ) | |
5566 { | |
5567 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5568 v3 = this->pPlayerBuffs[2].uPower; | |
5569 v4 = pParty->pPartyBuffs[1].uPower; | |
5570 break; | |
5571 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5572 v3 = this->pPlayerBuffs[0].uPower; | |
5573 v4 = pParty->pPartyBuffs[0].uPower; | |
5574 break; | |
5575 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5576 v3 = this->pPlayerBuffs[22].uPower; | |
5577 v4 = pParty->pPartyBuffs[17].uPower; | |
5578 break; | |
5579 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5580 v3 = this->pPlayerBuffs[3].uPower; | |
5581 v4 = pParty->pPartyBuffs[4].uPower; | |
5582 break; | |
5583 default: | |
5584 if ( a2 != 14 ) | |
5585 return result; | |
5586 v3 = this->pPlayerBuffs[9].uPower; | |
5587 v4 = pParty->pPartyBuffs[12].uPower; | |
5588 break; | |
5589 } | |
5590 return v4 + v3; | |
5591 } | |
5592 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5593 { | |
5594 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5595 { | |
5596 v3 = this->pPlayerBuffs[8].uPower; | |
5597 v4 = pParty->pPartyBuffs[9].uPower; | |
5598 return v4 + v3; | |
5599 } | |
5600 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5601 return result; | |
5602 } | |
5603 return this->pPlayerBuffs[1].uPower; | |
5604 } | |
5605 if ( a2 == 10 ) | |
5606 { | |
5607 v3 = this->pPlayerBuffs[5].uPower; | |
5608 v4 = pParty->pPartyBuffs[6].uPower; | |
5609 return v4 + v3; | |
5610 } | |
5611 switch ( a2 ) | |
5612 { | |
5613 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5614 v3 = pPlayerBuffs[19].uPower; | |
5615 goto LABEL_5; | |
5616 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5617 v3 = pPlayerBuffs[17].uPower; | |
5618 goto LABEL_5; | |
5619 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5620 v3 = pPlayerBuffs[20].uPower; | |
5621 goto LABEL_5; | |
5622 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5623 v3 = pPlayerBuffs[16].uPower; | |
5624 goto LABEL_5; | |
5625 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5626 v3 = pPlayerBuffs[15].uPower; | |
5627 goto LABEL_5; | |
5628 case CHARACTER_ATTRIBUTE_SPEED: | |
5629 v3 = pPlayerBuffs[21].uPower; | |
5630 goto LABEL_5; | |
5631 case CHARACTER_ATTRIBUTE_LUCK: | |
5632 v3 = pPlayerBuffs[18].uPower; | |
5633 LABEL_5: | |
5634 v4 = pParty->pPartyBuffs[2].uPower; | |
5635 return v4 + v3; | |
5636 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5637 v3 = this->pPlayerBuffs[14].uPower; | |
5638 v4 = pParty->pPartyBuffs[15].uPower; | |
5639 return v4 + v3; | |
5640 default: | |
5641 return result; | |
5642 } | |
5643 return result; | |
5644 } | |
5645 | |
5646 //----- (0048F882) -------------------------------------------------------- | |
353 | 5647 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
0 | 5648 { |
5649 signed int v2; // esi@1 | |
5650 unsigned __int16 v3; // ax@126 | |
5651 char result; // al@127 | |
5652 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5653 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5654 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5655 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5656 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5657 | |
0 | 5658 v2 = 0; |
353 | 5659 switch (uSkillType) |
5660 { | |
5661 case PLAYER_SKILL_MONSTER_ID: | |
5662 { | |
652 | 5663 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5664 v2 = 6; |
652 | 5665 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5666 v2 += 6; |
5667 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5668 v2 += GetItemsBonus(v8, 0); | |
5669 } | |
5670 break; | |
5671 | |
5672 case PLAYER_SKILL_ARMSMASTER: | |
5673 { | |
652 | 5674 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5675 v2 = 2; |
652 | 5676 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5677 v2 += 3; |
353 | 5678 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5679 v2 += GetItemsBonus(v8, 0); | |
5680 } | |
5681 break; | |
5682 | |
5683 case PLAYER_SKILL_STEALING: | |
5684 { | |
652 | 5685 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5686 v2 = 8; |
5687 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5688 v2 += GetItemsBonus(v8, 0); | |
5689 } | |
5690 break; | |
5691 | |
5692 | |
5693 case PLAYER_SKILL_ALCHEMY: | |
5694 { | |
652 | 5695 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5696 v2 = 4; |
652 | 5697 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5698 v2 += 8; |
5699 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5700 v2 += GetItemsBonus(v8, 0); | |
5701 } | |
5702 break; | |
5703 | |
5704 case PLAYER_SKILL_LEARNING: | |
5705 { | |
652 | 5706 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5707 v2 = 10; |
652 | 5708 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5709 v2 += 15; |
652 | 5710 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5711 v2 += 5; |
5712 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5713 v2 += GetItemsBonus(v8, 0); | |
5714 } | |
5715 break; | |
5716 | |
5717 case PLAYER_SKILL_UNARMED: | |
5718 { | |
652 | 5719 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5720 v2 = 2; |
5721 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5722 v2 += GetItemsBonus(v8, 0); | |
5723 } | |
5724 break; | |
5725 | |
5726 case PLAYER_SKILL_DODGE: | |
5727 { | |
652 | 5728 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5729 v2 = 2; |
5730 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5731 v2 += GetItemsBonus(v8, 0); | |
5732 } | |
5733 break; | |
5734 | |
5735 case PLAYER_SKILL_BOW: | |
5736 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5737 v2 += GetItemsBonus(v8, 0); | |
5738 break; | |
5739 case PLAYER_SKILL_SHIELD: | |
5740 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5741 v2 += GetItemsBonus(v8, 0); | |
5742 break; | |
5743 | |
5744 case PLAYER_SKILL_EARTH: | |
652 | 5745 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5746 v2 = 2; |
652 | 5747 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5748 v2 += 3; |
652 | 5749 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5750 v2 += 4; |
5751 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5752 v2 += 3; | |
5753 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5754 v2 += GetItemsBonus(v8, 0); | |
5755 break; | |
5756 case PLAYER_SKILL_FIRE: | |
652 | 5757 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5758 v2 = 2; |
652 | 5759 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5760 v2 += 3; |
652 | 5761 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5762 v2 += 4; |
5763 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5764 v2 += 3; | |
5765 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5766 v2 += GetItemsBonus(v8, 0); | |
5767 break; | |
5768 case PLAYER_SKILL_AIR: | |
652 | 5769 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5770 v2 = 2; |
652 | 5771 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5772 v2 += 3; |
652 | 5773 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5774 v2 += 4; |
5775 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5776 v2 += 3; | |
5777 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5778 v2 += GetItemsBonus(v8, 0); | |
5779 break; | |
5780 case PLAYER_SKILL_WATER: | |
652 | 5781 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5782 v2 = 2; |
652 | 5783 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5784 v2 += 3; |
652 | 5785 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5786 v2 += 4; |
5787 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5788 v2 += 3; | |
5789 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5790 v2 += GetItemsBonus(v8, 0); | |
5791 break; | |
5792 case PLAYER_SKILL_SPIRIT: | |
652 | 5793 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5794 v2 = 2; |
652 | 5795 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5796 v2 += 3; |
652 | 5797 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5798 v2 += 4; |
5799 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5800 v2 += GetItemsBonus(v8, 0); | |
5801 break; | |
5802 case PLAYER_SKILL_MIND: | |
652 | 5803 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5804 v2 = 2; |
652 | 5805 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5806 v2 += 3; |
652 | 5807 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5808 v2 += 4; |
5809 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5810 v2 += GetItemsBonus(v8, 0); | |
5811 break; | |
5812 case PLAYER_SKILL_BODY: | |
652 | 5813 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5814 v2 = 2; |
652 | 5815 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5816 v2 += 3; |
652 | 5817 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5818 v2 += 4; |
5819 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5820 v2 += GetItemsBonus(v8, 0); | |
5821 break; | |
5822 case PLAYER_SKILL_LIGHT: | |
5823 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5824 v2 += GetItemsBonus(v8, 0); | |
5825 break; | |
5826 case PLAYER_SKILL_DARK: | |
5827 { | |
5828 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5829 v2 += GetItemsBonus(v8, 0); | |
5830 } | |
5831 break; | |
5832 | |
5833 case PLAYER_SKILL_MERCHANT: | |
5834 { | |
652 | 5835 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5836 v2 = 4; |
652 | 5837 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5838 v2 += 6; |
652 | 5839 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5840 v2 += 3; |
652 | 5841 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5842 v2 += 8; |
5843 } | |
5844 break; | |
5845 | |
5846 case PLAYER_SKILL_PERCEPTION: | |
5847 { | |
652 | 5848 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5849 v2 = 6; |
652 | 5850 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5851 v2 += 5; |
5852 } | |
5853 break; | |
5854 | |
0 | 5855 case PLAYER_SKILL_ITEM_ID: |
5856 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5857 v2 += GetItemsBonus(v8, 0); |
0 | 5858 break; |
5859 case PLAYER_SKILL_MEDITATION: | |
5860 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5861 v2 += GetItemsBonus(v8, 0); |
5862 break; | |
0 | 5863 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5864 { |
652 | 5865 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5866 v2 = 4; |
652 | 5867 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5868 v2 += 6; |
652 | 5869 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5870 v2 += 8; |
0 | 5871 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5872 v2 += GetItemsBonus(v8, 0); |
5873 } | |
5874 break; | |
5875 } | |
5876 | |
5877 v3 = pActiveSkills[uSkillType]; | |
5878 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
0 | 5879 result = v2 + v3; |
5880 else | |
5881 result = v3 & 0xFC | 0x3C; | |
5882 return result; | |
5883 } | |
5884 | |
5885 //----- (0048FC00) -------------------------------------------------------- | |
5886 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5887 { | |
5888 Player *v2; // esi@1 | |
5889 int v3; // eax@1 | |
5890 char v4; // di@1 | |
5891 signed int v5; // ebx@1 | |
5892 unsigned int v6; // eax@2 | |
5893 unsigned __int8 v7; // sf@5 | |
5894 unsigned __int8 v8; // of@5 | |
5895 PlayerEquipment *v9; // ebx@19 | |
5896 Player *v10; // ecx@20 | |
821 | 5897 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5898 int v12; // eax@21 |
5899 int v13; // edi@21 | |
5900 char v14; // di@25 | |
5901 signed int v15; // esi@25 | |
5902 char v16; // al@32 | |
5903 int v18; // eax@36 | |
5904 unsigned int v19; // eax@37 | |
5905 ITEM_EQUIP_TYPE v20; // edi@40 | |
5906 int v21; // edx@41 | |
5907 int v22; // eax@42 | |
821 | 5908 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5909 unsigned __int16 v24; // ax@45 |
5910 unsigned __int16 v25; // bx@45 | |
5911 unsigned int v26; // eax@45 | |
5912 unsigned __int8 v27; // sf@50 | |
5913 unsigned __int8 v28; // of@50 | |
5914 unsigned int v29; // eax@52 | |
5915 int v30; // eax@55 | |
5916 int v31; // eax@58 | |
5917 unsigned int v32; // eax@59 | |
5918 int v33; // eax@65 | |
5919 char v34; // si@65 | |
5920 ITEM_EQUIP_TYPE v35; // edi@69 | |
5921 int v36; // edx@70 | |
5922 int v37; // eax@71 | |
821 | 5923 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5924 int v39; // eax@74 |
5925 int v40; // eax@89 | |
5926 char v41; // si@89 | |
5927 int v42; // eax@96 | |
821 | 5928 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5929 int v44; // eax@97 |
5930 int v45; // eax@98 | |
5931 int v46; // eax@99 | |
5932 int v47; // eax@100 | |
5933 int v48; // eax@101 | |
5934 int v49; // eax@102 | |
5935 unsigned __int16 v50; // ax@113 | |
5936 char v51; // di@113 | |
5937 unsigned int v52; // eax@113 | |
5938 int v53; // edi@113 | |
5939 signed int i; // ecx@113 | |
5940 unsigned __int16 v55; // ax@118 | |
5941 char v56; // si@118 | |
5942 unsigned int v57; // eax@118 | |
5943 int v58; // esi@121 | |
5944 signed int j; // ecx@121 | |
5945 int v60; // edi@126 | |
5946 int v61; // eax@126 | |
5947 signed int v62; // [sp-4h] [bp-30h]@26 | |
5948 signed int v63; // [sp-4h] [bp-30h]@80 | |
5949 int v64; // [sp+Ch] [bp-20h]@104 | |
5950 int v65; // [sp+10h] [bp-1Ch]@104 | |
5951 int v66; // [sp+14h] [bp-18h]@104 | |
5952 int v67; // [sp+18h] [bp-14h]@104 | |
5953 int v68; // [sp+1Ch] [bp-10h]@69 | |
5954 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5955 int v70; // [sp+24h] [bp-8h]@1 | |
5956 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5957 int a1; // [sp+34h] [bp+8h]@21 | |
5958 int a1a; // [sp+34h] [bp+8h]@74 | |
5959 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5960 | |
5961 v2 = this; | |
5962 v70 = 0; | |
5963 v69 = 0; | |
5964 v71 = (ITEM_EQUIP_TYPE)0; | |
5965 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5966 v4 = v3; | |
5967 v5 = 1; | |
5968 if ( v3 ) | |
5969 { | |
5970 v6 = SkillToMastery(v3); | |
5971 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5972 { | |
5973 if ( (signed int)v6 >= 4 ) | |
5974 goto LABEL_4; | |
5975 v8 = __OFSUB__(v6, 3); | |
5976 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5977 } | |
5978 else | |
5979 { | |
5980 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5981 goto LABEL_11; | |
5982 if ( (signed int)v6 >= 4 ) | |
5983 { | |
5984 LABEL_4: | |
5985 v71 = (ITEM_EQUIP_TYPE)2; | |
5986 LABEL_11: | |
5987 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5988 goto LABEL_12; | |
5989 } | |
5990 v8 = __OFSUB__(v6, 2); | |
5991 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5992 } | |
5993 if ( !(v7 ^ v8) ) | |
5994 v71 = (ITEM_EQUIP_TYPE)1; | |
5995 goto LABEL_11; | |
5996 } | |
5997 LABEL_12: | |
5998 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5999 { | |
135 | 6000 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 6001 v61 = v2->GetBodybuilding(); |
6002 return v60 * v61; | |
6003 } | |
6004 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
6005 { | |
135 | 6006 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 6007 v61 = v2->GetMeditation(); |
0 | 6008 return v60 * v61; |
6009 } | |
6010 if ( a2 != 9 ) | |
6011 { | |
6012 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
6013 { | |
6014 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
6015 return v70; | |
6016 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
6017 { | |
6018 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
6019 return v70; | |
6020 v71 = (ITEM_EQUIP_TYPE)0; | |
6021 v9 = &v2->pEquipment; | |
6022 while ( 1 ) | |
6023 { | |
6024 if ( v2->HasItemEquipped(v71) ) | |
6025 { | |
118 | 6026 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
6027 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 6028 a1 = v12; |
6029 SkillToMastery(v12); | |
6030 v13 = v11 - 5; | |
6031 if ( !v13 ) | |
6032 return a1 & 0x3F; | |
6033 if ( v13 == 2 ) | |
6034 break; | |
6035 } | |
6036 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
6037 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
6038 if ( (signed int)v71 >= 16 ) | |
6039 return v70; | |
6040 } | |
6041 v14 = a1; | |
6042 v15 = 1; | |
6043 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
6044 { | |
6045 v62 = 5; | |
6046 goto LABEL_31; | |
6047 } | |
6048 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6049 { | |
6050 v62 = 3; | |
6051 goto LABEL_31; | |
6052 } | |
6053 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6054 goto LABEL_32; | |
6055 goto LABEL_30; | |
6056 } | |
6057 if ( v2->IsUnarmed() ) | |
6058 { | |
6059 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6060 v14 = v18; | |
6061 if ( !v18 ) | |
6062 return v70; | |
6063 v15 = 0; | |
6064 v19 = SkillToMastery(v18); | |
6065 if ( (signed int)v19 < 3 ) | |
6066 { | |
6067 if ( (signed int)v19 >= 2 ) | |
6068 v15 = 1; | |
6069 LABEL_32: | |
6070 v16 = v14; | |
6071 return v15 * (v16 & 0x3F); | |
6072 } | |
6073 LABEL_30: | |
6074 v62 = 2; | |
6075 LABEL_31: | |
6076 v15 = v62; | |
6077 goto LABEL_32; | |
6078 } | |
6079 v20 = (ITEM_EQUIP_TYPE)0; | |
6080 while ( 1 ) | |
6081 { | |
6082 if ( v2->HasItemEquipped(v20) ) | |
6083 { | |
118 | 6084 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6085 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6086 break; | |
6087 } | |
6088 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6089 if ( (signed int)v20 >= 16 ) | |
6090 return v70; | |
6091 } | |
6092 v71 = (ITEM_EQUIP_TYPE)0; | |
6093 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6094 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6095 v25 = v24; | |
6096 v26 = SkillToMastery(v24); | |
6097 if ( !v23 ) | |
6098 { | |
6099 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6100 { | |
6101 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6102 LOBYTE(v25) = v31; | |
6103 if ( v31 ) | |
6104 { | |
6105 v15 = 0; | |
6106 v32 = SkillToMastery(v31); | |
6107 if ( (signed int)v32 < 3 ) | |
6108 { | |
6109 if ( (signed int)v32 >= 2 ) | |
6110 v15 = 1; | |
6111 } | |
6112 else | |
6113 { | |
6114 v15 = 2; | |
6115 } | |
6116 v16 = v25; | |
6117 return v15 * (v16 & 0x3F); | |
6118 } | |
6119 } | |
6120 goto LABEL_55; | |
6121 } | |
6122 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6123 { | |
6124 v29 = SkillToMastery(v25); | |
6125 v28 = __OFSUB__(v29, 4); | |
6126 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6127 } | |
6128 else | |
6129 { | |
6130 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6131 goto LABEL_55; | |
6132 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6133 { | |
6134 if ( v23 == PLAYER_SKILL_MACE ) | |
6135 { | |
6136 v28 = __OFSUB__(v26, 2); | |
118 | 6137 v27 = v26 - 2 < 0; |
0 | 6138 goto LABEL_53; |
6139 } | |
6140 LABEL_55: | |
6141 v30 = v71 * (v25 & 0x3F); | |
6142 return (int)((char *)v69 + v30); | |
6143 } | |
6144 v28 = __OFSUB__(v26, 3); | |
118 | 6145 v27 = v26 - 3 < 0; |
0 | 6146 } |
6147 LABEL_53: | |
6148 if ( !(v27 ^ v28) ) | |
6149 v71 = (ITEM_EQUIP_TYPE)1; | |
6150 goto LABEL_55; | |
6151 } | |
6152 if ( v2->IsUnarmed() == 1 ) | |
6153 { | |
6154 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6155 v34 = v33; | |
6156 if ( !v33 ) | |
6157 return v70; | |
6158 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6159 v5 = 2; | |
6160 v30 = v5 * (v34 & 0x3F); | |
6161 return (int)((char *)v69 + v30); | |
6162 } | |
6163 v35 = (ITEM_EQUIP_TYPE)0; | |
6164 v68 = 0; | |
6165 while ( 1 ) | |
6166 { | |
6167 if ( v2->HasItemEquipped(v35) ) | |
6168 { | |
118 | 6169 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6170 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6171 break; | |
6172 } | |
6173 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6174 if ( (signed int)v35 >= 16 ) | |
6175 return v70; | |
6176 } | |
6177 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6178 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6179 a1a = v39; | |
6180 SkillToMastery(v39); | |
6181 v71 = (ITEM_EQUIP_TYPE)0; | |
6182 if ( v38 ) | |
6183 { | |
6184 if ( (signed int)v38 > 0 ) | |
6185 { | |
6186 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6187 { | |
6188 v71 = (ITEM_EQUIP_TYPE)1; | |
6189 } | |
6190 else | |
6191 { | |
6192 if ( v38 == 7 ) | |
6193 { | |
6194 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6195 { | |
6196 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6197 { | |
6198 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6199 return v5 * (a1a & 0x3F); | |
6200 v63 = 2; | |
6201 } | |
6202 else | |
6203 { | |
6204 v63 = 3; | |
6205 } | |
6206 } | |
6207 else | |
6208 { | |
6209 v63 = 5; | |
6210 } | |
6211 v5 = v63; | |
6212 return v5 * (a1a & 0x3F); | |
6213 } | |
6214 } | |
6215 } | |
6216 } | |
6217 else | |
6218 { | |
6219 v71 = (ITEM_EQUIP_TYPE)1; | |
6220 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6221 { | |
6222 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6223 v41 = v40; | |
6224 if ( v40 ) | |
6225 { | |
6226 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6227 v5 = 2; | |
6228 v68 = v5 * (v41 & 0x3F); | |
6229 } | |
6230 } | |
6231 } | |
6232 v30 = v68 + v71 * (a1a & 0x3F); | |
6233 return (int)((char *)v69 + v30); | |
6234 } | |
6235 a1b = 0; | |
6236 v71 = (ITEM_EQUIP_TYPE)0; | |
6237 v68 = 16; | |
6238 v69 = &v2->pEquipment; | |
6239 do | |
6240 { | |
898 | 6241 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6242 goto LABEL_117; |
6243 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6244 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6245 if ( !v44 ) | |
6246 { | |
6247 v64 = 0; | |
6248 v65 = 1; | |
6249 LABEL_111: | |
6250 v66 = 0; | |
6251 goto LABEL_112; | |
6252 } | |
6253 v45 = v44 - 1; | |
6254 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6255 { | |
6256 v64 = 0; | |
6257 v65 = 0; | |
6258 v66 = 0; | |
6259 v67 = 1; | |
6260 goto LABEL_113; | |
6261 } | |
6262 v47 = v46 - 4; | |
6263 if ( v47 ) | |
6264 { | |
6265 v48 = v47 - 1; | |
6266 if ( v48 ) | |
6267 { | |
6268 v49 = v48 - 1; | |
6269 if ( v49 ) | |
6270 { | |
6271 if ( v49 != 1 ) | |
6272 goto LABEL_117; | |
6273 a1b = 1; | |
6274 v64 = 1; | |
6275 v65 = 0; | |
6276 v66 = 0; | |
6277 v67 = 0; | |
6278 goto LABEL_113; | |
6279 } | |
6280 a1b = 1; | |
6281 v64 = 1; | |
6282 v65 = 0; | |
6283 goto LABEL_111; | |
6284 } | |
6285 v71 = (ITEM_EQUIP_TYPE)1; | |
6286 } | |
6287 else | |
6288 { | |
6289 a1b = 1; | |
6290 } | |
6291 v64 = 1; | |
6292 v65 = 0; | |
6293 v66 = 1; | |
6294 LABEL_112: | |
6295 v67 = 0; | |
6296 LABEL_113: | |
6297 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6298 v51 = v50; | |
6299 v52 = SkillToMastery(v50); | |
6300 v53 = v51 & 0x3F; | |
6301 for ( i = 0; i < (signed int)v52; ++i ) | |
6302 { | |
6303 if ( *(&v64 + i) ) | |
6304 v70 += v53; | |
6305 } | |
6306 LABEL_117: | |
6307 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6308 --v68; | |
6309 } | |
6310 while ( v68 ); | |
6311 v64 = 1; | |
6312 v65 = 1; | |
6313 v66 = 1; | |
6314 v67 = 0; | |
6315 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6316 v56 = v55; | |
6317 v57 = SkillToMastery(v55); | |
6318 if ( !a1b && (!v71 || v57 == 4) ) | |
6319 { | |
6320 v58 = v56 & 0x3F; | |
6321 for ( j = 0; j < (signed int)v57; ++j ) | |
6322 { | |
6323 if ( *(&v64 + j) ) | |
6324 v70 += v58; | |
6325 } | |
6326 } | |
6327 return v70; | |
6328 } | |
6329 | |
6330 //----- (00490109) -------------------------------------------------------- | |
6331 // faces are: 0 1 2 3 human males | |
6332 // 4 5 6 7 human females | |
6333 // 8 9 elf males | |
6334 // 10 11 elf females | |
6335 // 12 13 dwarf males | |
6336 // 14 15 dwarf females | |
6337 // 16 17 goblin males | |
6338 // 18 19 goblin females | |
6339 // 20 lich male | |
6340 // 21 lich female | |
6341 // 22 underwater suits (unused) | |
6342 // 23 zombie male | |
6343 // 24 zombie female | |
6344 enum CHARACTER_RACE Player::GetRace() | |
6345 { | |
6346 if ( uFace > 15 ) | |
6347 { | |
6348 if ( uFace >= 16 && uFace <= 19 ) | |
6349 return CHARACTER_RACE_GOBLIN; | |
6350 } | |
6351 else | |
6352 { | |
6353 if ( uFace >= 12 ) | |
6354 { | |
6355 return CHARACTER_RACE_DWARF; | |
6356 } | |
6357 else | |
6358 { | |
6359 if ( uFace >= 0 ) | |
6360 { | |
6361 if ( uFace <= 7 ) | |
6362 { | |
6363 return CHARACTER_RACE_HUMAN; | |
6364 } | |
6365 else | |
6366 { | |
6367 if ( uFace <= 11 ) | |
6368 return CHARACTER_RACE_ELF; | |
6369 } | |
6370 } | |
6371 } | |
6372 } | |
6373 return CHARACTER_RACE_HUMAN; | |
6374 } | |
6375 | |
6376 //----- (00490141) -------------------------------------------------------- | |
187 | 6377 PLAYER_SEX Player::GetSexByVoice() |
0 | 6378 { |
6379 signed int result; // eax@1 | |
6380 | |
6381 result = 0; | |
6382 switch ( this->uVoiceID ) | |
6383 { | |
6384 case 0u: | |
6385 case 1u: | |
6386 case 2u: | |
6387 case 3u: | |
6388 case 8u: | |
6389 case 9u: | |
6390 case 0xCu: | |
6391 case 0xDu: | |
6392 case 0x10u: | |
6393 case 0x11u: | |
6394 case 0x14u: | |
6395 case 0x17u: | |
187 | 6396 return SEX_MALE; |
6397 | |
0 | 6398 case 4u: |
6399 case 5u: | |
6400 case 6u: | |
6401 case 7u: | |
6402 case 0xAu: | |
6403 case 0xBu: | |
6404 case 0xEu: | |
6405 case 0xFu: | |
6406 case 0x12u: | |
6407 case 0x13u: | |
6408 case 0x15u: | |
6409 case 0x18u: | |
187 | 6410 return SEX_FEMALE; |
6411 | |
0 | 6412 default: |
187 | 6413 assert(false); |
6414 } | |
0 | 6415 } |
6416 | |
6417 //----- (00490188) -------------------------------------------------------- | |
6418 void Player::SetInitialStats() | |
6419 { | |
6420 auto v1 = GetRace(); | |
290 | 6421 uMight = StatTable[v1][0].uBaseValue; |
6422 uIntelligence = StatTable[v1][1].uBaseValue; | |
6423 uWillpower = StatTable[v1][2].uBaseValue; | |
6424 uEndurance = StatTable[v1][3].uBaseValue; | |
6425 uAccuracy = StatTable[v1][4].uBaseValue; | |
6426 uSpeed = StatTable[v1][5].uBaseValue; | |
6427 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6428 } |
6429 | |
6430 //----- (004901FC) -------------------------------------------------------- | |
6431 int Player::SetSexByVoice() | |
6432 { | |
6433 __int64 v1; // qax@1 | |
6434 | |
6435 v1 = this->uVoiceID; | |
6436 switch ( (int)v1 ) | |
6437 { | |
6438 case 0: | |
6439 case 1: | |
6440 case 2: | |
6441 case 3: | |
6442 case 8: | |
6443 case 9: | |
6444 case 0xC: | |
6445 case 0xD: | |
6446 case 0x10: | |
6447 case 0x11: | |
6448 case 0x14: | |
6449 case 0x17: | |
6450 BYTE4(v1) = 0; | |
6451 break; | |
6452 case 4: | |
6453 case 5: | |
6454 case 6: | |
6455 case 7: | |
6456 case 0xA: | |
6457 case 0xB: | |
6458 case 0xE: | |
6459 case 0xF: | |
6460 case 0x12: | |
6461 case 0x13: | |
6462 case 0x15: | |
6463 case 0x18: | |
6464 BYTE4(v1) = 1; | |
6465 break; | |
6466 default: | |
6467 break; | |
6468 } | |
6469 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6470 return v1; | |
6471 } | |
6472 | |
6473 //----- (0049024A) -------------------------------------------------------- | |
135 | 6474 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6475 { |
6476 sLevelModifier = 0; | |
6477 sAgeModifier = 0; | |
6478 | |
135 | 6479 classType = cls; |
0 | 6480 uLuckBonus = 0; |
6481 uSpeedBonus = 0; | |
6482 uAccuracyBonus = 0; | |
6483 uEnduranceBonus = 0; | |
6484 uWillpowerBonus = 0; | |
6485 uIntelligenceBonus = 0; | |
6486 uMightBonus = 0; | |
6487 uLevel = 1; | |
6488 uExperience = 251 + rand() % 100; | |
6489 uBirthYear = 1147 - rand() % 6; | |
6490 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6491 memset(_guilds_member_bits, 0, 64); |
0 | 6492 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6493 | |
6494 for (uint i = 0; i < 37; ++i) | |
6495 { | |
135 | 6496 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6497 continue; |
6498 | |
6499 pActiveSkills[i] = 1; | |
6500 | |
6501 switch (i) | |
6502 { | |
886 | 6503 case PLAYER_SKILL_FIRE: |
6504 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6505 |
6506 extern bool all_magic; | |
6507 if ( all_magic == true ) | |
6508 { | |
6509 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6510 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6511 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6512 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6513 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6514 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6515 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6516 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6517 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6518 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6519 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6520 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6521 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6522 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6523 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6524 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6525 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6526 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6527 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6528 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6529 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6530 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6531 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6532 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6533 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6534 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6535 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6536 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6537 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6538 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6539 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6540 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6541 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6542 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6543 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6544 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6545 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6546 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6547 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6548 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6549 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6550 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6551 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6552 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6553 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6554 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6555 } | |
486 | 6556 break; |
886 | 6557 case PLAYER_SKILL_AIR: |
6558 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6559 break; | |
6560 case PLAYER_SKILL_WATER: | |
6561 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6562 break; | |
6563 case PLAYER_SKILL_EARTH: | |
6564 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6565 break; | |
6566 case PLAYER_SKILL_SPIRIT: | |
6567 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6568 break; | |
6569 case PLAYER_SKILL_MIND: | |
6570 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6571 break; | |
6572 case PLAYER_SKILL_BODY: | |
6573 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6574 |
6575 if ( all_magic == true ) | |
6576 { | |
6577 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6578 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6579 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6580 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6581 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6582 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6583 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6584 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6585 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6586 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6587 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6588 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6589 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6590 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6591 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6592 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6593 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6594 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6595 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6596 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6597 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6598 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6599 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6600 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6601 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6602 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6603 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6604 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6605 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6606 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6607 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6608 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6609 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6610 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6611 } | |
569 | 6612 break; |
886 | 6613 case PLAYER_SKILL_LIGHT: |
6614 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6615 break; | |
6616 case PLAYER_SKILL_DARK: | |
6617 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6618 break; | |
0 | 6619 } |
6620 } | |
6621 | |
6622 sHealth = GetMaxHealth(); | |
6623 sMana = GetMaxMana(); | |
6624 } | |
6625 | |
6626 //----- (004903C9) -------------------------------------------------------- | |
821 | 6627 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6628 { | |
6629 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6630 int v3; // edx@5 |
6631 char *v4; // ecx@5 | |
6632 int v5; // esi@11 | |
6633 unsigned __int16 *v6; // edx@11 | |
6634 int v7; // esi@18 | |
6635 unsigned __int16 *pActiveSkill; // edx@18 | |
6636 | |
6637 if ( order >= 0 ) | |
6638 { | |
6639 if ( order <= 1 ) | |
6640 { | |
6641 result = (PLAYER_SKILL_TYPE)0; | |
6642 v7 = 0; | |
6643 pActiveSkill = this->pActiveSkills; | |
6644 do | |
6645 { | |
135 | 6646 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6647 { |
6648 if ( v7 == order ) | |
6649 return result; | |
6650 ++v7; | |
6651 } | |
6652 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6653 ++pActiveSkill; | |
6654 } | |
6655 while ( (signed int)result < 37 ); | |
6656 } | |
6657 else | |
6658 { | |
6659 if ( order <= 3 ) | |
6660 { | |
6661 result = (PLAYER_SKILL_TYPE)0; | |
6662 v5 = 0; | |
6663 pActiveSkill = this->pActiveSkills; | |
6664 do | |
6665 { | |
135 | 6666 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6667 { |
6668 if ( v5 == order - 2 ) | |
6669 return result; | |
6670 ++v5; | |
6671 } | |
6672 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6673 ++pActiveSkill; | |
6674 } | |
6675 while ( (signed int)result < 37 ); | |
6676 } | |
6677 else | |
6678 { | |
6679 if ( order <= 12 ) | |
6680 { | |
6681 result = (PLAYER_SKILL_TYPE)0; | |
6682 v3 = 0; | |
135 | 6683 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6684 do |
6685 { | |
6686 if ( *v4 == 1 ) | |
6687 { | |
6688 if ( v3 == order - 4 ) | |
6689 return result; | |
6690 ++v3; | |
6691 } | |
6692 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6693 ++v4; | |
6694 } | |
6695 while ( (signed int)result < 37 ); | |
6696 } | |
6697 } | |
6698 } | |
6699 } | |
6700 return (PLAYER_SKILL_TYPE)37; | |
6701 } | |
6702 | |
6703 | |
6704 | |
6705 //----- (0049048D) -------------------------------------------------------- | |
6706 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6707 void Player::DecreaseAttribute(int eAttribute) | |
6708 { | |
6709 int v2; // eax@1 | |
6710 int pBaseValue; // ecx@1 | |
6711 int pDroppedStep; // ebx@1 | |
6712 int pStep; // esi@1 | |
6713 unsigned __int16 result; // ax@7 | |
6714 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6715 | |
6716 v2 = eAttribute + 7 * GetRace(); | |
290 | 6717 pBaseValue = StatTable[0][v2].uBaseValue; |
6718 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6719 uMinValue = pBaseValue - 2; |
290 | 6720 pStep = StatTable[0][v2].uBaseStep; |
0 | 6721 switch ( eAttribute ) |
6722 { | |
6723 case CHARACTER_MIGHT: | |
6724 if ( this->uMight <= pBaseValue ) | |
6725 pStep = pDroppedStep; | |
6726 if ( this->uMight - pStep >= uMinValue ) | |
6727 this->uMight -= pStep; | |
6728 break; | |
6729 case CHARACTER_INTELLIGANCE: | |
6730 if ( this->uIntelligence <= pBaseValue ) | |
6731 pStep = pDroppedStep; | |
6732 if ( this->uIntelligence - pStep >= uMinValue ) | |
6733 this->uIntelligence -= pStep; | |
6734 break; | |
6735 case CHARACTER_WILLPOWER: | |
6736 if ( this->uWillpower <= pBaseValue ) | |
6737 pStep = pDroppedStep; | |
6738 if ( this->uWillpower - pStep >= uMinValue ) | |
6739 this->uWillpower -= pStep; | |
6740 break; | |
6741 case CHARACTER_ENDURANCE: | |
6742 if ( this->uEndurance <= pBaseValue ) | |
6743 pStep = pDroppedStep; | |
6744 if ( this->uEndurance - pStep >= uMinValue ) | |
6745 this->uEndurance -= pStep; | |
6746 break; | |
6747 case CHARACTER_ACCURACY: | |
6748 if ( this->uAccuracy <= pBaseValue ) | |
6749 pStep = pDroppedStep; | |
6750 if ( this->uAccuracy - pStep >= uMinValue ) | |
6751 this->uAccuracy -= pStep; | |
6752 break; | |
6753 case CHARACTER_SPEED: | |
6754 if ( this->uSpeed <= pBaseValue ) | |
6755 pStep = pDroppedStep; | |
6756 if ( this->uSpeed - pStep >= uMinValue ) | |
6757 this->uSpeed -= pStep; | |
6758 break; | |
6759 case CHARACTER_LUCK: | |
6760 if ( this->uLuck <= pBaseValue ) | |
6761 pStep = pDroppedStep; | |
6762 if ( this->uLuck - pStep >= uMinValue ) | |
6763 this->uLuck -= pStep; | |
6764 break; | |
6765 } | |
6766 } | |
6767 | |
6768 //----- (004905F5) -------------------------------------------------------- | |
6769 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6770 int Player::IncreaseAttribute(int eAttribute) | |
6771 { | |
6772 Player *v2; // esi@1 | |
6773 int v3; // eax@1 | |
6774 int v4; // ebx@1 | |
6775 signed int v5; // edi@1 | |
6776 int v6; // eax@8 | |
6777 signed int v7; // eax@17 | |
6778 signed int result; // eax@18 | |
6779 int v9; // [sp+Ch] [bp-8h]@1 | |
6780 signed int v10; // [sp+10h] [bp-4h]@1 | |
6781 | |
6782 v2 = this; | |
6783 v3 = eAttribute + 7 * GetRace(); | |
290 | 6784 v4 = StatTable[0][v3].uMaxValue; |
6785 v5 = StatTable[0][v3].uBaseStep; | |
6786 v9 = StatTable[0][v3].uBaseValue; | |
6787 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6788 PlayerCreation_ComputeAttributeBonus(); |
6789 if ( eAttribute ) | |
6790 { | |
6791 switch ( eAttribute ) | |
6792 { | |
6793 case 1: | |
6794 v6 = v2->uIntelligence; | |
6795 break; | |
6796 case 2: | |
6797 v6 = v2->uWillpower; | |
6798 break; | |
6799 case 3: | |
6800 v6 = v2->uEndurance; | |
6801 break; | |
6802 case 4: | |
6803 v6 = v2->uAccuracy; | |
6804 break; | |
6805 case 5: | |
6806 v6 = v2->uSpeed; | |
6807 break; | |
6808 case 6: | |
6809 v6 = v2->uLuck; | |
6810 break; | |
6811 default: | |
6812 v6 = eAttribute; | |
6813 break; | |
6814 } | |
6815 } | |
6816 else | |
6817 { | |
6818 v6 = v2->uMight; | |
6819 } | |
6820 if ( v6 < v9 ) | |
6821 { | |
6822 v7 = v5; | |
6823 v5 = v10; | |
6824 v10 = v7; | |
6825 } | |
6826 result = PlayerCreation_ComputeAttributeBonus(); | |
6827 if ( result >= v10 ) | |
6828 { | |
6829 if ( eAttribute ) | |
6830 { | |
6831 switch ( eAttribute ) | |
6832 { | |
6833 case 1: | |
6834 result = (signed int)&v2->uIntelligence; | |
6835 break; | |
6836 case 2: | |
6837 result = (signed int)&v2->uWillpower; | |
6838 break; | |
6839 case 3: | |
6840 result = (signed int)&v2->uEndurance; | |
6841 break; | |
6842 case 4: | |
6843 result = (signed int)&v2->uAccuracy; | |
6844 break; | |
6845 case 5: | |
6846 result = (signed int)&v2->uSpeed; | |
6847 break; | |
6848 default: | |
6849 result = eAttribute - 6; | |
6850 if ( eAttribute != 6 ) | |
6851 return result; | |
6852 result = (signed int)&v2->uLuck; | |
6853 break; | |
6854 } | |
6855 } | |
6856 else | |
6857 { | |
6858 result = (signed int)&v2->uMight; | |
6859 } | |
6860 if ( v5 + *(short *)result <= v4 ) | |
6861 *(short *)result += v5; | |
6862 } | |
6863 return result; | |
6864 } | |
6865 | |
6866 //----- (0049070F) -------------------------------------------------------- | |
6867 void Player::Zero() | |
6868 { | |
6869 Player *v1; // esi@1 | |
6870 | |
6871 v1 = this; | |
6872 this->sLevelModifier = 0; | |
6873 this->sACModifier = 0; | |
6874 this->uLuckBonus = 0; | |
6875 this->uAccuracyBonus = 0; | |
6876 this->uSpeedBonus = 0; | |
6877 this->uEnduranceBonus = 0; | |
6878 this->uWillpowerBonus = 0; | |
6879 this->uIntelligenceBonus = 0; | |
6880 this->uMightBonus = 0; | |
6881 this->field_100 = 0; | |
6882 this->field_FC = 0; | |
6883 this->field_F8 = 0; | |
6884 this->field_F4 = 0; | |
6885 this->field_F0 = 0; | |
6886 this->field_EC = 0; | |
6887 this->field_E8 = 0; | |
6888 this->field_E4 = 0; | |
6889 this->field_E0 = 0; | |
766 | 6890 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6891 v1->field_1A97 = 0; |
6892 v1->_ranged_dmg_bonus = 0; | |
6893 v1->field_1A95 = 0; | |
6894 v1->_ranged_atk_bonus = 0; | |
6895 v1->field_1A93 = 0; | |
6896 v1->_melee_dmg_bonus = 0; | |
6897 v1->field_1A91 = 0; | |
6898 v1->_some_attack_bonus = 0; | |
6899 v1->_mana_related = 0; | |
6900 v1->uFullManaBonus = 0; | |
6901 v1->_health_related = 0; | |
6902 v1->uFullHealthBonus = 0; | |
6903 } | |
6904 | |
6905 //----- (004907E7) -------------------------------------------------------- | |
299 | 6906 unsigned int Player::GetStatColor(int uStat) |
0 | 6907 { |
6908 __int16 uWhite; // si@1 | |
290 | 6909 int attribute_value; // edx@1 |
299 | 6910 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6911 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6912 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6913 | |
949 | 6914 uRed = TargetColor(0xFFu, 0x23u, 0); |
6915 uGreen = TargetColor(0, 0xFFu, 0); | |
6916 uWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
299 | 6917 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6918 |
0 | 6919 switch (uStat) |
6920 { | |
6921 case 0: attribute_value = uMight; break; | |
6922 case 1: attribute_value = uIntelligence; break; | |
6923 case 2: attribute_value = uWillpower; break; | |
6924 case 3: attribute_value = uEndurance; break; | |
290 | 6925 case 4: attribute_value = uAccuracy; break; |
6926 case 5: attribute_value = uSpeed; break; | |
0 | 6927 case 6: attribute_value = uLuck; break; |
6928 }; | |
6929 | |
299 | 6930 if ( attribute_value == pBaseAttrValue ) |
290 | 6931 return uWhite; |
299 | 6932 else if ( attribute_value > pBaseAttrValue ) |
290 | 6933 return uGreen; |
0 | 6934 else |
290 | 6935 return uRed; |
0 | 6936 } |
6937 | |
6938 //----- (004908A8) -------------------------------------------------------- | |
6939 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6940 { | |
6941 unsigned __int64 *result; // eax@1 | |
6942 | |
6943 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6944 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6945 { | |
6946 *(int *)result = 0; | |
6947 *((int *)result + 1) = 0; | |
6948 LOBYTE(result) = 1; | |
6949 } | |
6950 else | |
6951 { | |
6952 LOBYTE(result) = 0; | |
6953 } | |
6954 return (bool)result; | |
6955 } | |
6956 | |
6957 //----- (004680ED) -------------------------------------------------------- | |
6958 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6959 { | |
6960 Player *v3; // esi@1 | |
6961 unsigned int v4; // ebx@4 | |
6962 signed int v5; // eax@17 | |
6963 unsigned int v6; // eax@26 | |
6964 unsigned __int8 v7; // cf@37 | |
6965 int v8; // edx@39 | |
6966 int v9; // edx@40 | |
6967 int v10; // edx@41 | |
6968 int v11; // edx@42 | |
6969 int v12; // edx@43 | |
6970 char *v13; // eax@45 | |
6971 AudioPlayer *v14; // ecx@62 | |
6972 signed int v15; // edi@68 | |
6973 int v16; // edx@73 | |
6974 unsigned __int16 *v17; // edi@73 | |
6975 unsigned int v18; // eax@73 | |
6976 int v19; // eax@74 | |
6977 int v20; // eax@75 | |
6978 signed int v21; // eax@81 | |
6979 const char *v22; // eax@84 | |
6980 char *v23; // ecx@90 | |
6981 int v24; // esi@96 | |
6982 int v25; // eax@109 | |
6983 int v26; // eax@113 | |
6984 char *v27; // edi@114 | |
6985 signed __int64 v28; // qax@120 | |
6986 char *v29; // ecx@120 | |
6987 int v30; // edi@137 | |
6988 int v31; // ST30_4@137 | |
6989 int v32; // ST3C_4@137 | |
6990 int v33; // ST40_4@137 | |
6991 int v34; // ST34_4@137 | |
6992 int v35; // ST38_4@137 | |
6993 unsigned __int8 v36; // al@173 | |
6994 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6995 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6996 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6997 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6998 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6999 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
7000 signed int v43; // [sp-14h] [bp-40h]@18 | |
7001 signed int v44; // [sp-14h] [bp-40h]@174 | |
7002 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
7003 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
7004 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
7005 int v48; // [sp-Ch] [bp-38h]@18 | |
7006 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
7007 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
7008 int v51; // [sp-Ch] [bp-38h]@174 | |
7009 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
7010 char *v53; // [sp-8h] [bp-34h]@33 | |
7011 int v54; // [sp-8h] [bp-34h]@34 | |
7012 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
7013 int v56; // [sp-8h] [bp-34h]@66 | |
7014 const char *v57; // [sp-8h] [bp-34h]@69 | |
7015 const char *v58; // [sp-8h] [bp-34h]@89 | |
7016 int v59; // [sp-8h] [bp-34h]@120 | |
7017 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
7018 int v61; // [sp-4h] [bp-30h]@18 | |
7019 char *v62; // [sp-4h] [bp-30h]@33 | |
7020 char *v63; // [sp-4h] [bp-30h]@34 | |
7021 int v64; // [sp-4h] [bp-30h]@60 | |
7022 int v65; // [sp-4h] [bp-30h]@66 | |
7023 const char *v66; // [sp-4h] [bp-30h]@69 | |
7024 signed int v67; // [sp-4h] [bp-30h]@77 | |
7025 const char *v68; // [sp-4h] [bp-30h]@89 | |
7026 int v69; // [sp-4h] [bp-30h]@110 | |
7027 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
7028 int v71; // [sp-4h] [bp-30h]@174 | |
7029 char *v72; // [sp+20h] [bp-Ch]@68 | |
7030 signed int v73; // [sp+24h] [bp-8h]@1 | |
7031 char *v74; // [sp+24h] [bp-8h]@23 | |
7032 int v75; // [sp+24h] [bp-8h]@73 | |
7033 Player *thisb; // [sp+28h] [bp-4h]@1 | |
7034 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
7035 | |
7036 thisb = this; | |
243 | 7037 v3 = &pParty->pPlayers[a2-1]; |
0 | 7038 v73 = 1; |
7039 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
7040 return; | |
7041 v4 = 0; | |
7042 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
7043 { | |
7044 if ( pParty->pPickedItem.uItemID != 160 ) | |
7045 { | |
7046 if ( pParty->pPickedItem.uItemID == 161 ) | |
7047 { | |
7048 v27 = (char *)&v3->sMana; | |
7049 *(int *)v27 += 2; | |
7050 LABEL_170: | |
7051 if ( *(int *)v27 > v3->GetMaxMana() ) | |
7052 *(int *)v27 = v3->GetMaxMana(); | |
7053 } | |
7054 else | |
7055 { | |
7056 if ( pParty->pPickedItem.uItemID != 162 ) | |
7057 { | |
7058 LABEL_167: | |
7059 v68 = pParty->pPickedItem.GetDisplayName(); | |
7060 v58 = pGlobalTXT_LocalizationStrings[36]; | |
7061 goto LABEL_90; | |
7062 } | |
7063 v69 = 2; | |
7064 LABEL_111: | |
243 | 7065 pParty->pPlayers[a2-1].Heal(v69); |
0 | 7066 } |
7067 LABEL_112: | |
187 | 7068 v3->PlaySound(SPEECH_36, 0); |
0 | 7069 goto LABEL_173; |
7070 } | |
7071 LABEL_172: | |
100 | 7072 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 7073 goto LABEL_173; |
7074 } | |
7075 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
7076 { | |
7077 switch ( pParty->pPickedItem.uItemID ) | |
7078 { | |
7079 case 0xDEu: | |
570 | 7080 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7081 goto LABEL_110; |
7082 case 0xDFu: | |
570 | 7083 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7084 goto LABEL_114; |
7085 case 0xE0u: | |
7086 LODWORD(v3->pConditions[1]) = 0; | |
7087 HIDWORD(v3->pConditions[1]) = 0; | |
7088 goto LABEL_112; | |
7089 case 0xE1u: | |
7090 LODWORD(v3->pConditions[11]) = 0; | |
7091 HIDWORD(v3->pConditions[11]) = 0; | |
7092 LODWORD(v3->pConditions[9]) = 0; | |
7093 HIDWORD(v3->pConditions[9]) = 0; | |
7094 LODWORD(v3->pConditions[7]) = 0; | |
7095 HIDWORD(v3->pConditions[7]) = 0; | |
7096 goto LABEL_112; | |
7097 case 0xE2u: | |
7098 LODWORD(v3->pConditions[10]) = 0; | |
7099 HIDWORD(v3->pConditions[10]) = 0; | |
7100 LODWORD(v3->pConditions[8]) = 0; | |
7101 HIDWORD(v3->pConditions[8]) = 0; | |
7102 LODWORD(v3->pConditions[6]) = 0; | |
7103 HIDWORD(v3->pConditions[6]) = 0; | |
7104 goto LABEL_112; | |
7105 case 0xE3u: | |
7106 LODWORD(v3->pConditions[2]) = 0; | |
7107 HIDWORD(v3->pConditions[2]) = 0; | |
7108 goto LABEL_112; | |
7109 case 0xE4u: | |
7110 if ( v3->pConditions[1] ) | |
7111 goto LABEL_173; | |
7112 v70 = 0; | |
7113 v59 = 0; | |
7114 v50 = 5; | |
7115 v46 = 3; | |
570 | 7116 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7117 v29 = (char *)&v3->pPlayerBuffs[7]; |
7118 goto LABEL_147; | |
7119 case 0xE5u: | |
7120 v70 = 0; | |
7121 v59 = 0; | |
7122 v50 = 5; | |
7123 v46 = 3; | |
570 | 7124 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7125 v29 = (char *)&v3->pPlayerBuffs[8]; |
7126 goto LABEL_147; | |
7127 case 0xE6u: | |
7128 v70 = 0; | |
7129 v59 = 0; | |
7130 v50 = 5; | |
7131 v46 = 3; | |
570 | 7132 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7133 v29 = (char *)&v3->pPlayerBuffs[1]; |
7134 goto LABEL_147; | |
7135 case 0xE7u: | |
7136 v70 = 0; | |
7137 v59 = 0; | |
570 | 7138 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7139 v46 = 0; |
570 | 7140 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7141 v29 = (char *)&v3->pPlayerBuffs[11]; |
7142 goto LABEL_147; | |
7143 case 0xE8u: | |
7144 v70 = 0; | |
7145 v59 = 0; | |
570 | 7146 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7147 v46 = 0; |
570 | 7148 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7149 v29 = (char *)&v3->pPlayerBuffs[13]; |
7150 goto LABEL_147; | |
7151 case 0xEAu: | |
7152 v70 = 0; | |
7153 v59 = 0; | |
7154 v50 = 5; | |
7155 v46 = 3; | |
570 | 7156 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7157 v29 = (char *)&v3->pPlayerBuffs[14]; |
7158 goto LABEL_147; | |
7159 case 0xEBu: | |
7160 v3->pPlayerBuffs[23].Apply( | |
570 | 7161 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7162 3u, |
7163 5u, | |
7164 0, | |
7165 0); | |
7166 goto LABEL_173; | |
7167 case 0xEDu: | |
7168 LODWORD(v3->pConditions[3]) = 0; | |
7169 HIDWORD(v3->pConditions[3]) = 0; | |
7170 goto LABEL_112; | |
7171 case 0xEEu: | |
7172 LODWORD(v3->pConditions[0]) = 0; | |
7173 HIDWORD(v3->pConditions[0]) = 0; | |
7174 goto LABEL_112; | |
7175 case 0xEFu: | |
7176 LODWORD(v3->pConditions[5]) = 0; | |
7177 HIDWORD(v3->pConditions[5]) = 0; | |
7178 goto LABEL_112; | |
7179 case 0xF0u: | |
7180 v70 = 0; | |
7181 v59 = 0; | |
570 | 7182 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7183 v46 = 0; |
570 | 7184 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7185 v29 = (char *)&v3->pPlayerBuffs[19]; |
7186 goto LABEL_147; | |
7187 case 0xF1u: | |
7188 v70 = 0; | |
7189 v59 = 0; | |
570 | 7190 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7191 v46 = 0; |
570 | 7192 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7193 v29 = (char *)&v3->pPlayerBuffs[17]; |
7194 goto LABEL_147; | |
7195 case 0xF2u: | |
7196 v70 = 0; | |
7197 v59 = 0; | |
570 | 7198 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7199 v46 = 0; |
570 | 7200 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7201 v29 = (char *)&v3->pPlayerBuffs[20]; |
7202 goto LABEL_147; | |
7203 case 0xF3u: | |
7204 v70 = 0; | |
7205 v59 = 0; | |
570 | 7206 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7207 v46 = 0; |
570 | 7208 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7209 v29 = (char *)&v3->pPlayerBuffs[16]; |
7210 goto LABEL_147; | |
7211 case 0xF4u: | |
7212 v70 = 0; | |
7213 v59 = 0; | |
570 | 7214 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7215 v46 = 0; |
570 | 7216 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7217 v29 = (char *)&v3->pPlayerBuffs[21]; |
7218 goto LABEL_147; | |
7219 case 0xF5u: | |
7220 v70 = 0; | |
7221 v59 = 0; | |
570 | 7222 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7223 v46 = 0; |
570 | 7224 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7225 v29 = (char *)&v3->pPlayerBuffs[15]; |
7226 goto LABEL_147; | |
7227 case 0xFBu: | |
7228 LODWORD(v3->pConditions[12]) = 0; | |
7229 HIDWORD(v3->pConditions[12]) = 0; | |
7230 goto LABEL_112; | |
7231 case 0xFCu: | |
7232 v30 = LODWORD(v3->pConditions[14]); | |
7233 v31 = HIDWORD(v3->pConditions[14]); | |
7234 v32 = LODWORD(v3->pConditions[15]); | |
7235 v33 = HIDWORD(v3->pConditions[15]); | |
7236 v34 = LODWORD(v3->pConditions[16]); | |
7237 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7238 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7239 HIDWORD(v3->pConditions[14]) = v31; |
7240 LODWORD(v3->pConditions[15]) = v32; | |
7241 HIDWORD(v3->pConditions[15]) = v33; | |
7242 LODWORD(v3->pConditions[16]) = v34; | |
7243 LODWORD(v3->pConditions[14]) = v30; | |
7244 HIDWORD(v3->pConditions[16]) = v35; | |
7245 goto LABEL_112; | |
7246 case 0xFDu: | |
570 | 7247 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7248 LABEL_110: |
7249 v69 = v25; | |
7250 goto LABEL_111; | |
7251 case 0xFEu: | |
570 | 7252 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7253 LABEL_114: |
7254 v27 = (char *)&v3->sMana; | |
7255 *(int *)v27 += v26; | |
7256 goto LABEL_170; | |
7257 case 0xFFu: | |
7258 v70 = 0; | |
7259 v59 = 0; | |
570 | 7260 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7261 v46 = 0; |
570 | 7262 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7263 v29 = (char *)&v3->pPlayerBuffs[18]; |
7264 goto LABEL_147; | |
7265 case 0x100u: | |
7266 v70 = 0; | |
7267 v59 = 0; | |
570 | 7268 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7269 v46 = 0; |
570 | 7270 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7271 v29 = (char *)&v3->pPlayerBuffs[5]; |
7272 goto LABEL_147; | |
7273 case 0x101u: | |
7274 v70 = 0; | |
7275 v59 = 0; | |
570 | 7276 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7277 v46 = 0; |
570 | 7278 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7279 v29 = (char *)v3->pPlayerBuffs; |
7280 goto LABEL_147; | |
7281 case 0x102u: | |
7282 v70 = 0; | |
7283 v59 = 0; | |
570 | 7284 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7285 v46 = 0; |
570 | 7286 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7287 v29 = (char *)&v3->pPlayerBuffs[22]; |
7288 goto LABEL_147; | |
7289 case 0x103u: | |
7290 v70 = 0; | |
7291 v59 = 0; | |
570 | 7292 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7293 v46 = 0; |
570 | 7294 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7295 v29 = (char *)&v3->pPlayerBuffs[3]; |
7296 goto LABEL_147; | |
7297 case 0x104u: | |
7298 v70 = 0; | |
7299 v59 = 0; | |
570 | 7300 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7301 v46 = 0; |
570 | 7302 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7303 v29 = (char *)&v3->pPlayerBuffs[9]; |
7304 goto LABEL_147; | |
7305 case 0x105u: | |
7306 v70 = 0; | |
7307 v59 = 0; | |
570 | 7308 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7309 v46 = 0; |
570 | 7310 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7311 v29 = (char *)&v3->pPlayerBuffs[2]; |
7312 LABEL_147: | |
7313 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7314 goto LABEL_112; | |
7315 case 0x106u: | |
7316 LODWORD(v3->pConditions[15]) = 0; | |
7317 HIDWORD(v3->pConditions[15]) = 0; | |
7318 goto LABEL_112; | |
7319 case 0x108u: | |
7320 if ( !*(int *)&v3->field_1F5[3] ) | |
7321 { | |
7322 v3->uLuck += 50; | |
7323 *(int *)&v3->field_1F5[3] = 1; | |
7324 } | |
7325 goto LABEL_112; | |
7326 case 0x109u: | |
7327 if ( !*(int *)&v3->field_1F5[7] ) | |
7328 { | |
7329 v3->uSpeed += 50; | |
7330 *(int *)&v3->field_1F5[7] = 1; | |
7331 } | |
7332 goto LABEL_112; | |
7333 case 0x10Au: | |
7334 if ( !*(int *)&v3->field_1F5[11] ) | |
7335 { | |
7336 v3->uIntelligence += 50; | |
7337 *(int *)&v3->field_1F5[11] = 1; | |
7338 } | |
7339 goto LABEL_112; | |
7340 case 0x10Bu: | |
7341 if ( !*(int *)&v3->field_1F5[15] ) | |
7342 { | |
7343 v3->uEndurance += 50; | |
7344 *(int *)&v3->field_1F5[15] = 1; | |
7345 } | |
7346 goto LABEL_112; | |
7347 case 0x10Cu: | |
7348 if ( !*(int *)&v3->field_1F5[19] ) | |
7349 { | |
7350 v3->uWillpower += 50; | |
7351 *(int *)&v3->field_1F5[19] = 1; | |
7352 } | |
7353 goto LABEL_112; | |
7354 case 0x10Du: | |
7355 if ( !*(int *)&v3->field_1F5[23] ) | |
7356 { | |
7357 v3->uAccuracy += 50; | |
7358 *(int *)&v3->field_1F5[23] = 1; | |
7359 } | |
7360 goto LABEL_112; | |
7361 case 0x10Eu: | |
7362 if ( !*(int *)&v3->field_1F5[27] ) | |
7363 { | |
7364 v3->uMight += 50; | |
7365 *(int *)&v3->field_1F5[27] = 1; | |
7366 } | |
7367 goto LABEL_112; | |
7368 case 0x10Fu: | |
7369 v3->sAgeModifier = 0; | |
7370 goto LABEL_112; | |
809 | 7371 case 0xDDu: |
7372 goto LABEL_172; | |
0 | 7373 default: |
7374 goto LABEL_167; | |
7375 } | |
7376 goto LABEL_172; | |
7377 } | |
7378 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7379 { | |
7380 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7381 { | |
7382 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7383 { | |
7384 if ( pParty->pPickedItem.uItemID == 616 ) | |
7385 { | |
7386 thisa = pParty->uCurrentMonthWeek + 1; | |
7387 if ( pParty->uCurrentMonth >= 7 ) | |
7388 v74 = 0; | |
7389 else | |
7390 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7391 switch ( pParty->uCurrentMonth ) | |
7392 { | |
7393 case 0u: | |
7394 v6 = pParty->uCurrentMonthWeek + 1; | |
7395 v3->uMight += thisa; | |
7396 goto LABEL_33; | |
7397 case 1u: | |
7398 v6 = pParty->uCurrentMonthWeek + 1; | |
7399 v3->uIntelligence += thisa; | |
7400 goto LABEL_33; | |
7401 case 2u: | |
7402 v6 = pParty->uCurrentMonthWeek + 1; | |
7403 v3->uWillpower += thisa; | |
7404 goto LABEL_33; | |
7405 case 3u: | |
7406 v6 = pParty->uCurrentMonthWeek + 1; | |
7407 v3->uEndurance += thisa; | |
7408 goto LABEL_33; | |
7409 case 4u: | |
7410 v6 = pParty->uCurrentMonthWeek + 1; | |
7411 v3->uAccuracy += thisa; | |
7412 goto LABEL_33; | |
7413 case 5u: | |
7414 v6 = pParty->uCurrentMonthWeek + 1; | |
7415 v3->uSpeed += thisa; | |
7416 goto LABEL_33; | |
7417 case 6u: | |
7418 v6 = pParty->uCurrentMonthWeek + 1; | |
7419 v3->uLuck += thisa; | |
7420 LABEL_33: | |
7421 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7422 v53 = v74; | |
7423 v49 = v6; | |
7424 goto LABEL_53; | |
7425 case 7u: | |
7426 party_finds_gold(1000 * thisa, 0); | |
7427 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7428 v54 = 1000 * thisa; | |
7429 goto LABEL_38; | |
7430 case 8u: | |
7431 Party::GiveFood(5 * thisa); | |
7432 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7433 v54 = 5 * thisa; | |
7434 goto LABEL_38; | |
7435 case 9u: | |
7436 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7437 v3->uSkillPoints += 2 * thisa; | |
7438 v54 = 2 * thisa; | |
7439 goto LABEL_38; | |
7440 case 0xAu: | |
7441 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7442 v54 = 2500 * thisa; | |
7443 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7444 LODWORD(v3->uExperience) += 2500 * thisa; | |
7445 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7446 LABEL_38: | |
7447 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7448 goto LABEL_54; | |
7449 case 0xBu: | |
7450 v8 = rand() % 6; | |
7451 if ( v8 ) | |
7452 { | |
7453 v9 = v8 - 1; | |
7454 if ( v9 ) | |
7455 { | |
7456 v10 = v9 - 1; | |
7457 if ( v10 ) | |
7458 { | |
7459 v11 = v10 - 1; | |
7460 if ( v11 ) | |
7461 { | |
7462 v12 = v11 - 1; | |
7463 if ( v12 ) | |
7464 { | |
7465 if ( v12 != 1 ) | |
7466 goto LABEL_52; | |
7467 v3->sResBodyBase += thisa; | |
7468 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7469 } | |
7470 else | |
7471 { | |
7472 v3->sResMindBase += thisa; | |
7473 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7474 } | |
7475 } | |
7476 else | |
7477 { | |
7478 v3->sResEarthBase += thisa; | |
7479 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7480 } | |
7481 } | |
7482 else | |
7483 { | |
7484 v3->sResWaterBase += thisa; | |
7485 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7486 } | |
7487 } | |
7488 else | |
7489 { | |
7490 v3->sResAirBase += thisa; | |
7491 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7492 } | |
7493 } | |
7494 else | |
7495 { | |
7496 v3->sResFireBase += thisa; | |
7497 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7498 } | |
7499 v74 = v13; | |
7500 LABEL_52: | |
7501 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7502 v53 = v74; | |
7503 v49 = thisa; | |
7504 LABEL_53: | |
7505 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7506 LABEL_54: | |
7507 ShowStatusBarString(pTmpBuf, 2u); | |
7508 pMouse->RemoveHoldingItem(); | |
7509 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7510 v3->PlaySound(SPEECH_93, 0); |
0 | 7511 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7512 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7513 { | |
7514 v64 = 0; | |
7515 v55 = 16; | |
7516 } | |
7517 else | |
7518 { | |
7519 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7520 { | |
7521 v64 = 0; | |
7522 v55 = 14; | |
7523 } | |
7524 else | |
7525 { | |
7526 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7527 return; | |
7528 v64 = 0; | |
7529 v55 = 15; | |
7530 } | |
7531 } | |
7532 v3->SetCondition(v55, v64); | |
7533 v61 = 0; | |
7534 v52 = 0; | |
7535 v48 = 0; | |
7536 v45 = 0; | |
7537 v43 = -1; | |
7538 v41 = 0; | |
7539 v39 = 0; | |
7540 v37 = (SoundID)215; | |
7541 v14 = pAudioPlayer; | |
7542 goto LABEL_63; | |
7543 default: | |
7544 goto LABEL_54; | |
7545 } | |
7546 } | |
7547 if ( pParty->pPickedItem.uItemID == 630 ) | |
7548 { | |
7549 Party::GiveFood(1u); | |
7550 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7551 } | |
7552 else | |
7553 { | |
7554 if ( pParty->pPickedItem.uItemID == 632 ) | |
7555 { | |
7556 v61 = 0; | |
7557 v52 = 0; | |
7558 v48 = 0; | |
7559 v45 = 0; | |
7560 v43 = -1; | |
7561 v41 = 0; | |
7562 v39 = 0; | |
7563 v37 = (SoundID)133; | |
7564 goto LABEL_93; | |
7565 } | |
7566 if ( pParty->pPickedItem.uItemID == 633 ) | |
7567 { | |
7568 v61 = 0; | |
7569 v52 = 0; | |
7570 v48 = 0; | |
7571 v45 = 0; | |
7572 v43 = -1; | |
7573 v41 = 0; | |
7574 v39 = 0; | |
7575 v37 = (SoundID)134; | |
7576 goto LABEL_93; | |
7577 } | |
7578 if ( pParty->pPickedItem.uItemID == 634 ) | |
7579 { | |
7580 v61 = 0; | |
7581 v52 = 0; | |
7582 v48 = 0; | |
7583 v45 = 0; | |
7584 v43 = -1; | |
7585 v41 = 0; | |
7586 v39 = 0; | |
7587 v37 = (SoundID)135; | |
7588 goto LABEL_93; | |
7589 } | |
7590 if ( pParty->pPickedItem.uItemID != 646 ) | |
7591 { | |
7592 if ( pParty->pPickedItem.uItemID == 650 ) | |
7593 { | |
7594 sub_44C28F_open_nwc_dungeon(); | |
7595 return; | |
7596 } | |
7597 goto LABEL_167; | |
7598 } | |
7599 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7600 v5 = 8 * a2 + 392; | |
862 | 7601 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7602 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7603 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7604 } | |
7605 LABEL_187: | |
7606 pMouse->RemoveHoldingItem(); | |
7607 return; | |
7608 } | |
243 | 7609 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7610 { |
7611 sub_467F48(pParty->pPickedItem.uItemID); | |
7612 v65 = 0; | |
187 | 7613 v56 = SPEECH_37; |
0 | 7614 LABEL_67: |
187 | 7615 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7616 return; |
7617 } | |
7618 LABEL_89: | |
7619 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7620 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7621 LABEL_90: | |
809 | 7622 sprintfex(pTmpBuf, v58, v68); |
0 | 7623 v23 = pTmpBuf; |
7624 LABEL_91: | |
7625 ShowStatusBarString(v23, 2u); | |
7626 v4 = 0; | |
7627 goto LABEL_92; | |
7628 } | |
7629 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7630 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7631 if ( *v72 ) |
7632 { | |
7633 v66 = pParty->pPickedItem.GetDisplayName(); | |
7634 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7635 LABEL_72: | |
7636 sprintf(pTmpBuf, v57, v66); | |
7637 ShowStatusBarString(pTmpBuf, 2u); | |
7638 LABEL_92: | |
7639 v61 = v4; | |
7640 v52 = v4; | |
7641 v48 = v4; | |
7642 v45 = v4; | |
7643 v43 = -1; | |
7644 v41 = v4; | |
7645 v39 = v4; | |
7646 v37 = (SoundID)27; | |
7647 LABEL_93: | |
7648 v14 = pAudioPlayer; | |
7649 LABEL_63: | |
7650 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7651 return; | |
7652 } | |
243 | 7653 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7654 { |
7655 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7656 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7657 goto LABEL_72; | |
7658 } | |
7659 v16 = v15 % 11 + 1; | |
7660 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7661 v75 = v16; | |
7662 v18 = SkillToMastery(*v17) - 1; | |
7663 if ( v18 ) | |
7664 { | |
7665 v19 = v18 - 1; | |
7666 if ( v19 ) | |
7667 { | |
7668 v20 = v19 - 1; | |
7669 if ( v20 ) | |
7670 { | |
7671 if ( v20 != 1 ) | |
7672 { | |
7673 v21 = a2; | |
7674 LABEL_83: | |
7675 if ( v75 > v21 || !*v17 ) | |
7676 { | |
7677 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7678 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7679 ShowStatusBarString(pTmpBuf, 2u); |
7680 v65 = 0; | |
7681 v56 = 20; | |
7682 goto LABEL_67; | |
7683 } | |
7684 *v72 = 1; | |
187 | 7685 v3->PlaySound(SPEECH_21, 0); |
0 | 7686 v73 = 0; |
7687 LABEL_173: | |
7688 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7689 if ( v36 == 14 ) | |
7690 { | |
7691 v71 = 0; | |
7692 v60 = 0; | |
7693 v51 = 0; | |
7694 v47 = 0; | |
7695 v44 = -1; | |
7696 v42 = 0; | |
7697 v40 = 0; | |
7698 v38 = (SoundID)210; | |
7699 } | |
7700 else | |
7701 { | |
7702 if ( v36 != 13 ) | |
7703 { | |
7704 LABEL_178: | |
7705 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7706 { | |
7707 if ( !v73 ) | |
7708 goto LABEL_187; | |
437 | 7709 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7710 { |
990 | 7711 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7712 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7713 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7714 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7715 }*/ |
7716 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7717 } |
7718 if ( v73 ) | |
7719 { | |
7720 if ( pParty->bTurnBasedModeOn ) | |
7721 { | |
7722 *(&pParty->field_16140 + a2) = 100; | |
7723 thisb->SetRecoveryTime(100); | |
7724 pTurnEngine->_40471C(); | |
7725 } | |
7726 else | |
7727 { | |
7728 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7729 } | |
7730 } | |
7731 goto LABEL_187; | |
7732 } | |
7733 v71 = 0; | |
7734 v60 = 0; | |
7735 v51 = 0; | |
7736 v47 = 0; | |
7737 v44 = -1; | |
7738 v42 = 0; | |
7739 v40 = 0; | |
7740 v38 = (SoundID)211; | |
7741 } | |
7742 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7743 goto LABEL_178; | |
7744 } | |
7745 v67 = 11; | |
7746 } | |
7747 else | |
7748 { | |
7749 v67 = 10; | |
7750 } | |
7751 } | |
7752 else | |
7753 { | |
7754 v67 = 7; | |
7755 } | |
7756 } | |
7757 else | |
7758 { | |
7759 v67 = 4; | |
7760 } | |
7761 v21 = v67; | |
7762 goto LABEL_83; | |
7763 } | |
151 | 7764 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7765 return; |
243 | 7766 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7767 goto LABEL_89; |
7768 if ( bUnderwater == 1 ) | |
7769 { | |
7770 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7771 goto LABEL_91; | |
7772 } | |
7773 dword_50C9AC = 1; | |
7774 v24 = pParty->pPickedItem.uItemID - 299; | |
7775 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7776 { | |
7777 pMouse->RemoveHoldingItem(); | |
7778 pGUIWindow_CurrentMenu->Release(); | |
7779 pIcons_LOD->_4114F2(); | |
151 | 7780 pCurrentScreen = SCREEN_GAME; |
0 | 7781 viewparams->bRedrawGameUI = 1; |
7782 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7783 } | |
7784 else | |
7785 { | |
7786 _720984_unused = pParty->pPickedItem.uItemID; | |
7787 pMouse->RemoveHoldingItem(); | |
7788 if ( dword_50C9E8 < 40 ) | |
7789 { | |
7790 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7791 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7792 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7793 ++dword_50C9E8; |
7794 } | |
7795 if ( pCurrentScreen | |
7796 && pGUIWindow_CurrentMenu | |
437 | 7797 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7798 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7799 { | |
990 | 7800 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7801 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7802 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7803 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7804 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7805 } | |
7806 } | |
7807 } | |
0 | 7808 |
7809 | |
7810 | |
7811 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7812 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7813 { | |
0 | 7814 Player *v3; // esi@1 |
7815 signed int v4; // edi@1 | |
7816 unsigned int v5; // eax@8 | |
7817 int v6; // eax@9 | |
7818 enum CHARACTER_RACE v7; // eax@11 | |
7819 signed int v8; // eax@17 | |
7820 unsigned __int8 v9; // sf@17 | |
7821 unsigned __int8 v10; // of@17 | |
7822 int v11; // eax@19 | |
7823 unsigned int v12; // eax@20 | |
484 | 7824 unsigned int test_bit_value; // eax@25 |
7825 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7826 signed int v15; // ecx@28 |
7827 ItemGen *v16; // eax@28 | |
7828 char v17; // zf@31 | |
7829 int v18; // edi@90 | |
7830 DDM_DLV_Header *v19; // eax@122 | |
7831 char v20; // cl@124 | |
7832 DDM_DLV_Header *v21; // eax@126 | |
7833 unsigned int v22; // edi@129 | |
100 | 7834 Player *v23; // esi@134 |
0 | 7835 ItemGen *v24; // ecx@135 |
7836 signed int v25; // edx@135 | |
7837 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7838 char *v27; // edi@155 | |
7839 int v28; // ebx@161 | |
7840 int v29; // eax@161 | |
7841 | |
469 | 7842 v6 = 0; |
0 | 7843 v3 = this; |
7844 v4 = -1; | |
469 | 7845 if ( VarNum > VAR_AutoNotes ) |
7846 { | |
7847 switch ( VarNum ) | |
0 | 7848 { |
7849 case VAR_Invisible: | |
484 | 7850 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7851 return true; |
484 | 7852 return false; |
0 | 7853 case VAR_NumDeaths: |
7854 v4 = pParty->uNumDeaths; | |
469 | 7855 return v4 >= pValue; |
0 | 7856 case VAR_NumBounties: |
7857 v4 = pParty->uNumBountiesCollected; | |
469 | 7858 return v4 >= pValue; |
0 | 7859 case VAR_PrisonTerms: |
7860 v4 = pParty->uNumPrisonTerms; | |
469 | 7861 return v4 >= pValue; |
0 | 7862 case VAR_ArenaWinsPage: |
7863 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7864 return v4 >= pValue; |
0 | 7865 case VAR_ArenaWinsSquire: |
7866 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7867 return v4 >= pValue; |
0 | 7868 case VAR_ArenaWinsKnight: |
7869 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7870 return v4 >= pValue; |
0 | 7871 case VAR_ArenaWinsLord: |
7872 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7873 return v4 >= pValue; |
0 | 7874 case VAR_ReputationInCurrentLocation: |
7875 v19 = &pOutdoor->ddm; | |
7876 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7877 v19 = &pIndoor->dlv; | |
469 | 7878 v6 = v19->uReputation >= pValue; |
7879 return v6; | |
0 | 7880 case VAR_History_28|VAR_Sex: |
7881 v21 = &pOutdoor->ddm; | |
7882 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7883 v21 = &pIndoor->dlv; | |
469 | 7884 v6 = v21->field_C_alert == pValue; |
0 | 7885 return v6; |
7886 case VAR_MonthEquals2|VAR_Sex: | |
7887 case VAR_MonthEquals2|VAR_Class: | |
7888 case VAR_Counter1: | |
7889 case VAR_Counter2: | |
7890 case VAR_Counter3: | |
7891 case VAR_Counter4: | |
7892 case VAR_Counter5: | |
7893 case VAR_Counter6: | |
7894 case VAR_Counter7: | |
7895 case VAR_Counter8: | |
469 | 7896 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7897 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7898 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7899 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7900 return true; | |
7901 return false; | |
0 | 7902 case VAR_NumSkillPoints: |
7903 v4 = this->uSkillPoints; | |
469 | 7904 return v4 >= pValue; |
0 | 7905 case VAR_CircusPrises: |
7906 v4 = 0; | |
100 | 7907 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7908 do |
7909 { | |
469 | 7910 v24 = v23->pInventoryItems; |
0 | 7911 v25 = 138; |
7912 do | |
7913 { | |
7914 switch ( v24->uItemID ) | |
7915 { | |
7916 case 0x1D6u: | |
7917 ++v4; | |
7918 break; | |
7919 case 0x1D7u: | |
7920 v4 += 3; | |
7921 break; | |
7922 case 0x1DDu: | |
7923 v4 += 5; | |
7924 break; | |
7925 } | |
7926 ++v24; | |
7927 --v25; | |
7928 } | |
7929 while ( v25 ); | |
100 | 7930 ++v23; |
0 | 7931 } |
100 | 7932 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7933 return v4 >= pValue; |
0 | 7934 case VAR_MonthEquals2: |
469 | 7935 v6 = pParty->uCurrentMonth == pValue; |
7936 return v6; | |
0 | 7937 case VAR_IsFlying: |
7938 if ( pParty->bFlying | |
484 | 7939 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7940 return true; |
7941 return false; | |
0 | 7942 case VAR_HiredNPCHasSpeciality: |
469 | 7943 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7944 return v6; |
7945 case VAR_NPCs2: | |
469 | 7946 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7947 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7948 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7949 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7950 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7951 return v4 >= pValue; |
7952 v4 = pValue; | |
7953 return v4 >= pValue; | |
0 | 7954 case VAR_ItemEquipped: |
7955 v26 = (ITEM_EQUIP_TYPE)0; | |
7956 v27 = (char *)&this->pEquipment; | |
7957 break; | |
7958 case VAR_GoldInBank: | |
7959 v4 = pParty->uNumGoldInBank; | |
469 | 7960 return v4 >= pValue; |
0 | 7961 case VAR_ThieverySkill|0x80: |
7962 v28 = GetActualMight(); | |
7963 v29 = v3->GetBaseStrength(); | |
7964 goto LABEL_168; | |
7965 case VAR_DisarmTrapSkill|0x80: | |
7966 v28 = GetActualIntelligence(); | |
7967 v29 = v3->GetBaseIntelligence(); | |
7968 goto LABEL_168; | |
7969 case VAR_MonthEquals: | |
7970 v28 = GetActualWillpower(); | |
7971 v29 = v3->GetBaseWillpower(); | |
7972 goto LABEL_168; | |
7973 case VAR_MonthEquals|VAR_Sex: | |
7974 v28 = GetActualEndurance(); | |
7975 v29 = v3->GetBaseEndurance(); | |
7976 goto LABEL_168; | |
7977 case VAR_IdentifyMonsterSkill|0x80: | |
7978 v28 = GetActualSpeed(); | |
7979 v29 = v3->GetBaseSpeed(); | |
7980 goto LABEL_168; | |
7981 case VAR_ArmsmasterSkill|0x80: | |
7982 v28 = GetActualAccuracy(); | |
7983 v29 = v3->GetBaseAccuracy(); | |
7984 goto LABEL_168; | |
7985 case VAR_MonthEquals|VAR_MaxHP: | |
7986 v28 = GetActualLuck(); | |
7987 v29 = v3->GetBaseLuck(); | |
7988 LABEL_168: | |
7989 v10 = __OFSUB__(v28, v29); | |
7990 v9 = v28 - v29 < 0; | |
7991 LABEL_169: | |
7992 if ( v9 ^ v10 ) | |
469 | 7993 return v4 >= pValue; |
7994 return true; | |
0 | 7995 default: |
469 | 7996 return v4 >= pValue; |
0 | 7997 } |
7998 while ( !v3->HasItemEquipped(v26) | |
654 | 7999 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 8000 { |
8001 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
8002 v27 += 4; | |
8003 if ( (signed int)v26 >= 16 ) | |
469 | 8004 return false; |
8005 } | |
8006 return true; | |
8007 } | |
8008 if ( VarNum == VAR_AutoNotes ) | |
0 | 8009 { |
484 | 8010 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
8011 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
8012 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8013 return false; | |
8014 return true; | |
469 | 8015 } |
8016 if ( VarNum <= VAR_BaseLuck ) | |
8017 { | |
8018 if ( VarNum != VAR_BaseLuck ) | |
8019 { | |
8020 switch ( VarNum ) | |
0 | 8021 { |
8022 case VAR_Hour: | |
469 | 8023 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
8024 return true; | |
8025 return false; | |
0 | 8026 case VAR_DayOfYear: |
469 | 8027 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
8028 v6 = v5 == pValue; | |
8029 return v6; | |
0 | 8030 case VAR_DayOfWeek: |
469 | 8031 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
8032 v6 = v5 == pValue; | |
0 | 8033 return v6; |
8034 case VAR_Sex: | |
469 | 8035 if ( pValue == (CHARACTER_RACE)this->uSex ) |
8036 return true; | |
8037 return v4 >= pValue; | |
0 | 8038 case VAR_Class: |
135 | 8039 v7 = (CHARACTER_RACE)this->classType; |
469 | 8040 if ( pValue == v7 ) |
8041 return true; | |
8042 return v4 >= pValue; | |
0 | 8043 case VAR_Race: |
8044 v7 = GetRace(); | |
469 | 8045 if ( pValue == v7 ) |
8046 return true; | |
8047 return v4 >= pValue; | |
0 | 8048 case VAR_CurrentHP: |
8049 v4 = this->sHealth; | |
469 | 8050 return v4 >= pValue; |
0 | 8051 case VAR_MaxHP: |
8052 v8 = GetMaxHealth(); | |
8053 v10 = __OFSUB__(v3->sHealth, v8); | |
8054 v9 = v3->sHealth - v8 < 0; | |
8055 goto LABEL_169; | |
8056 case VAR_CurrentSP: | |
8057 v4 = this->sMana; | |
469 | 8058 return v4 >= pValue; |
0 | 8059 case VAR_MaxSP: |
8060 v11 = GetMaxMana(); | |
8061 v10 = __OFSUB__(v3->sMana, v11); | |
8062 v9 = v3->sMana - v11 < 0; | |
8063 goto LABEL_169; | |
8064 case VAR_ActualAC: | |
8065 v12 = GetActualAC(); | |
8066 goto _j_cmp_against_arg; | |
8067 case VAR_ACModifier: | |
8068 v4 = this->sACModifier; | |
469 | 8069 return v4 >= pValue; |
0 | 8070 case VAR_BaseLevel: |
8071 v4 = this->uLevel; | |
469 | 8072 return v4 >= pValue; |
0 | 8073 case VAR_LevelModifier: |
8074 v4 = this->sLevelModifier; | |
469 | 8075 return v4 >= pValue; |
0 | 8076 case VAR_Age: |
8077 v12 = GetActualAge(); | |
8078 goto _j_cmp_against_arg; | |
8079 case VAR_Award: | |
484 | 8080 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
8081 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
8082 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8083 return true; | |
8084 return false; | |
0 | 8085 case VAR_Experience: |
8086 v4 = LODWORD(this->uExperience); | |
469 | 8087 return v4 >= pValue; |
0 | 8088 case VAR_QBits_QuestsDone: |
484 | 8089 test_bit_value = 0x80u >> (pValue - 1) % 8; |
8090 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
8091 if ( test_bit_value & our_bit_value ) | |
478 | 8092 return true; |
8093 return false; | |
0 | 8094 case VAR_PlayerItemInHands: |
8095 v15 = 0; | |
8096 v16 = v3->pInventoryItems; | |
8097 break; | |
8098 case VAR_FixedGold: | |
8099 v4 = pParty->uNumGold; | |
469 | 8100 return v4 >= pValue; |
0 | 8101 case VAR_MightBonus: |
8102 v4 = this->uMightBonus; | |
469 | 8103 return v4 >= pValue; |
0 | 8104 case VAR_IntellectBonus: |
8105 v4 = this->uIntelligenceBonus; | |
469 | 8106 return v4 >= pValue; |
0 | 8107 case VAR_PersonalityBonus: |
8108 v4 = this->uWillpowerBonus; | |
469 | 8109 return v4 >= pValue; |
0 | 8110 case VAR_EnduranceBonus: |
8111 v4 = this->uEnduranceBonus; | |
469 | 8112 return v4 >= pValue; |
0 | 8113 case VAR_SpeedBonus: |
8114 v4 = this->uSpeedBonus; | |
469 | 8115 return v4 >= pValue; |
0 | 8116 case VAR_AccuracyBonus: |
8117 v4 = this->uAccuracyBonus; | |
469 | 8118 return v4 >= pValue; |
0 | 8119 case VAR_LuckBonus: |
8120 v4 = this->uLuckBonus; | |
469 | 8121 return v4 >= pValue; |
0 | 8122 case VAR_BaseMight: |
8123 v4 = this->uMight; | |
469 | 8124 return v4 >= pValue; |
0 | 8125 case VAR_BaseIntellect: |
8126 v4 = this->uIntelligence; | |
469 | 8127 return v4 >= pValue; |
0 | 8128 case VAR_BasePersonality: |
8129 v4 = this->uWillpower; | |
469 | 8130 return v4 >= pValue; |
0 | 8131 case VAR_BaseEndurance: |
8132 v4 = this->uEndurance; | |
469 | 8133 return v4 >= pValue; |
0 | 8134 case VAR_BaseSpeed: |
8135 v4 = this->uSpeed; | |
469 | 8136 return v4 >= pValue; |
0 | 8137 case VAR_BaseAccuracy: |
8138 v4 = this->uAccuracy; | |
469 | 8139 return v4 >= pValue; |
0 | 8140 case VAR_FixedFood: |
8141 v4 = pParty->uNumFoodRations; | |
469 | 8142 return v4 >= pValue; |
0 | 8143 default: |
469 | 8144 return v4 >= pValue; |
8145 } | |
8146 while ( v16->uItemID != pValue ) | |
0 | 8147 { |
8148 ++v15; | |
8149 ++v16; | |
8150 if ( v15 >= 138 ) | |
8151 { | |
469 | 8152 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8153 return v6; |
8154 } | |
8155 } | |
469 | 8156 return true; |
0 | 8157 } |
8158 v4 = this->uLuck; | |
469 | 8159 return v4 >= pValue; |
8160 } | |
8161 if ( VarNum <= VAR_MagicResistance ) | |
8162 { | |
8163 if ( VarNum == VAR_MagicResistance ) | |
0 | 8164 { |
8165 v4 = this->sResMagicBase; | |
8166 } | |
8167 else | |
8168 { | |
469 | 8169 switch ( VarNum ) |
0 | 8170 { |
8171 case VAR_FireResistance: | |
8172 v4 = this->sResFireBase; | |
469 | 8173 return v4 >= pValue; |
0 | 8174 case VAR_AirResistance: |
8175 v4 = this->sResAirBase; | |
469 | 8176 return v4 >= pValue; |
0 | 8177 case VAR_WaterResistance: |
8178 v4 = this->sResWaterBase; | |
469 | 8179 return v4 >= pValue; |
0 | 8180 case VAR_EarthResistance: |
8181 v4 = this->sResEarthBase; | |
469 | 8182 return v4 >= pValue; |
0 | 8183 case VAR_SpiritResistance: |
8184 v4 = this->sResSpiritBase; | |
469 | 8185 return v4 >= pValue; |
0 | 8186 case VAR_MindResistance: |
8187 v4 = this->sResMindBase; | |
469 | 8188 return v4 >= pValue; |
0 | 8189 case VAR_BodyResistance: |
8190 v4 = this->sResBodyBase; | |
469 | 8191 return v4 >= pValue; |
0 | 8192 case VAR_LightResistance: |
8193 v4 = this->sResLightBase; | |
469 | 8194 return v4 >= pValue; |
0 | 8195 case VAR_DarkResistance: |
8196 v4 = this->sResDarkBase; | |
469 | 8197 return v4 >= pValue; |
0 | 8198 case VAR_ActualMight: |
8199 v12 = GetActualMight(); | |
8200 goto _j_cmp_against_arg; | |
8201 case VAR_ActualIntellect: | |
8202 v12 = GetActualIntelligence(); | |
8203 goto _j_cmp_against_arg; | |
8204 case VAR_ActualPersonality: | |
8205 v12 = GetActualWillpower(); | |
8206 goto _j_cmp_against_arg; | |
8207 case VAR_ActualEndurance: | |
8208 v12 = GetActualEndurance(); | |
8209 goto _j_cmp_against_arg; | |
8210 case VAR_ActualSpeed: | |
8211 v12 = GetActualSpeed(); | |
8212 goto _j_cmp_against_arg; | |
8213 case VAR_ActualAccuracy: | |
8214 v12 = GetActualAccuracy(); | |
8215 goto _j_cmp_against_arg; | |
8216 case VAR_ActualLuck: | |
8217 v12 = GetActualLuck(); | |
8218 _j_cmp_against_arg: | |
8219 v4 = v12; | |
8220 break; | |
8221 default: | |
469 | 8222 return v4 >= pValue; |
8223 } | |
8224 } | |
8225 return v4 >= pValue; | |
8226 } | |
8227 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8228 { | |
8229 if ( VarNum != VAR_DisarmTrapSkill ) | |
8230 { | |
8231 if ( VarNum <= VAR_MindResistanceBonus ) | |
8232 { | |
8233 switch ( VarNum ) | |
0 | 8234 { |
8235 case VAR_MindResistanceBonus: | |
8236 v4 = this->sResMindBonus; | |
8237 break; | |
8238 case VAR_FireResistanceBonus: | |
8239 v4 = this->sResFireBonus; | |
8240 break; | |
8241 case VAR_AirResistanceBonus: | |
8242 v4 = this->sResAirBonus; | |
8243 break; | |
8244 case VAR_WaterResistanceBonus: | |
8245 v4 = this->sResWaterBonus; | |
8246 break; | |
8247 case VAR_EarthResistanceBonus: | |
8248 v4 = this->sResEarthBonus; | |
8249 break; | |
8250 case VAR_SpiritResistanceBonus: | |
8251 v4 = this->sResSpiritBonus; | |
8252 break; | |
8253 } | |
469 | 8254 return v4 >= pValue; |
8255 } | |
8256 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8257 { |
8258 v4 = this->sResBodyBonus; | |
469 | 8259 return v4 >= pValue; |
8260 } | |
8261 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8262 { |
8263 v4 = this->sResLightBonus; | |
469 | 8264 return v4 >= pValue; |
8265 } | |
8266 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8267 { |
8268 v4 = this->sResDarkBonus; | |
469 | 8269 return v4 >= pValue; |
8270 } | |
8271 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8272 { |
8273 v4 = this->sResMagicBonus; | |
469 | 8274 return v4 >= pValue; |
8275 } | |
8276 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8277 return v4 >= pValue; | |
0 | 8278 } |
8279 LABEL_90: | |
469 | 8280 v18 = *((short *)&this->pConditions[16] + VarNum); |
8281 if ( pValue <= 63 ) | |
0 | 8282 v4 = v18 & 0x3F; |
8283 else | |
469 | 8284 v4 = pValue & v18; |
8285 return v4 >= pValue; | |
8286 } | |
8287 if ( VarNum == 104 ) | |
0 | 8288 goto LABEL_90; |
469 | 8289 if ( (signed int)VarNum <= 104 ) |
8290 return v4 >= pValue; | |
8291 if ( (signed int)VarNum > 0x79 ) | |
8292 { | |
8293 if ( VarNum != 122 ) | |
8294 { | |
8295 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8296 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8297 return v4 >= pValue; | |
0 | 8298 } |
8299 v4 = GetMajorConditionIdx(); | |
8300 if ( v4 != 18 ) | |
8301 { | |
469 | 8302 return v4 >= pValue; |
8303 } | |
8304 v4 = pValue; | |
8305 return v4 >= pValue; | |
8306 } | |
8307 return *((int *)this + 2 * VarNum - 210); | |
0 | 8308 } |
8309 | |
8310 | |
8311 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8312 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8313 { | |
8314 signed int currPlayerId; // ebx@1 | |
0 | 8315 Player *v4; // esi@1 |
8316 unsigned int v5; // edi@1 | |
8317 unsigned int v6; // esi@13 | |
8318 unsigned int v7; // esi@14 | |
8319 signed int v8; // eax@17 | |
8320 ItemGen *v9; // ecx@17 | |
8321 int v10; // eax@21 | |
8322 signed int v11; // eax@30 | |
8323 Player *v12; // ecx@44 | |
8324 char *v13; // ecx@45 | |
8325 Player *v14; // ecx@49 | |
8326 int v15; // ecx@86 | |
8327 int v16; // esi@106 | |
8328 char v17; // al@106 | |
8329 int v18; // eax@107 | |
8330 Player *v19; // ecx@112 | |
8331 Player *v20; // ecx@127 | |
8332 int v21; // eax@127 | |
8333 int v22; // eax@145 | |
8334 char v23; // zf@146 | |
8335 DDM_DLV_Header *v24; // ecx@148 | |
8336 signed int v25; // eax@172 | |
8337 int v26; // [sp-8h] [bp-3Ch]@84 | |
8338 signed int v27; // [sp-4h] [bp-38h]@4 | |
8339 int v28; // [sp-4h] [bp-38h]@84 | |
8340 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8341 char v30; // [sp+32h] [bp-2h]@1 | |
8342 char v31; // [sp+33h] [bp-1h]@1 | |
8343 | |
492 | 8344 currPlayerId = 0; |
0 | 8345 v30 = 0; |
8346 v31 = 0; | |
8347 v4 = this; | |
8348 v5 = 0; | |
8349 if ( this == pPlayers[2] ) | |
492 | 8350 currPlayerId = 1; |
8351 else if ( this == pPlayers[3] ) | |
8352 currPlayerId = 2; | |
757 | 8353 else if ( this == pPlayers[4] ) |
492 | 8354 currPlayerId = 3; |
8355 if ( var_type > VAR_AutoNotes ) | |
8356 { | |
8357 if ( var_type <= VAR_GoldInBank ) | |
8358 { | |
8359 if ( var_type == VAR_GoldInBank ) | |
8360 { | |
8361 pParty->uNumGoldInBank = var_value; | |
0 | 8362 return; |
8363 } | |
492 | 8364 if ( var_type <= VAR_Counter8 ) |
8365 { | |
8366 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8367 { |
492 | 8368 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8369 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8370 } |
8371 else | |
8372 { | |
492 | 8373 switch ( var_type ) |
0 | 8374 { |
8375 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8376 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8377 break; |
8378 case VAR_NPCs2: | |
8379 pParty->field_709 = 0; | |
492 | 8380 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8381 Party__CountHirelings(); |
0 | 8382 viewparams->bRedrawGameUI = 1; |
8383 break; | |
8384 case VAR_NumSkillPoints: | |
492 | 8385 this->uSkillPoints = var_value; |
0 | 8386 break; |
8387 } | |
8388 } | |
8389 return; | |
8390 } | |
492 | 8391 if ( var_type < VAR_Counter9 ) |
0 | 8392 return; |
492 | 8393 if ( (signed int)var_type <= 0x112 ) |
8394 { | |
8395 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8396 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8397 } |
8398 else | |
8399 { | |
492 | 8400 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8401 { |
8402 v24 = &pOutdoor->ddm; | |
8403 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8404 v24 = &pIndoor->dlv; | |
492 | 8405 v24->uReputation = var_value; |
8406 if ( var_value > 10000 ) | |
0 | 8407 v24->uReputation = 10000; |
8408 return; | |
8409 } | |
492 | 8410 if ( var_type <= VAR_ReputationInCurrentLocation |
8411 || var_type > VAR_History_28 | |
8412 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8413 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8414 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8415 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8416 v23) ) |
8417 return; | |
8418 bFlashHistoryBook = 1; | |
8419 } | |
8420 LABEL_172: | |
492 | 8421 v25 = 8 * currPlayerId + 400; |
862 | 8422 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8423 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8424 return; | |
8425 } | |
492 | 8426 if ( var_type != 307 ) |
8427 { | |
8428 switch ( var_type ) | |
0 | 8429 { |
8430 case 308: | |
492 | 8431 pParty->uNumBountiesCollected = var_value; |
0 | 8432 break; |
8433 case 309: | |
492 | 8434 pParty->uNumPrisonTerms = var_value; |
0 | 8435 break; |
8436 case 310: | |
492 | 8437 pParty->uNumArenaPageWins = var_value; |
0 | 8438 break; |
8439 case 311: | |
492 | 8440 pParty->uNumArenaSquireWins = var_value; |
0 | 8441 break; |
8442 case 312: | |
492 | 8443 pParty->uNumArenaKnightWins = var_value; |
0 | 8444 break; |
8445 case 313: | |
492 | 8446 pParty->uNumArenaLordWins = var_value; |
0 | 8447 break; |
8448 } | |
8449 return; | |
8450 } | |
492 | 8451 pParty->uNumDeaths = var_value; |
0 | 8452 LABEL_168: |
8453 if ( v30 != 1 ) | |
8454 { | |
8455 LABEL_170: | |
8456 if ( v31 != 1 ) | |
8457 return; | |
8458 v5 = 0; | |
8459 goto LABEL_172; | |
8460 } | |
8461 LABEL_169: | |
492 | 8462 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8463 goto LABEL_170; |
8464 } | |
492 | 8465 if ( var_type == VAR_AutoNotes ) |
8466 { | |
8467 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
|
8468 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8469 && pAutonoteTxt[var_value-1].pText ) |
8470 { | |
8471 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8472 v30 = 1; |
187 | 8473 v20->PlaySound(SPEECH_96, 0); |
492 | 8474 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8475 bFlashAutonotesBook = 1; |
981 | 8476 _506568_autonote_type = v21; |
0 | 8477 } |
492 | 8478 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8479 v31 = 1; |
8480 goto LABEL_168; | |
8481 } | |
492 | 8482 if ( var_type <= VAR_ActualMight ) |
8483 { | |
8484 if ( var_type != VAR_ActualMight ) | |
8485 { | |
8486 switch ( var_type ) | |
0 | 8487 { |
8488 case VAR_RandomGold: | |
492 | 8489 v6 = rand() % var_value + 1; |
0 | 8490 Party::SetGold(v6); |
8491 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8492 ShowStatusBarString(pTmpBuf, 2u); | |
8493 GameUI_DrawFoodAndGold(); | |
8494 return; | |
8495 case VAR_RandomFood: | |
492 | 8496 v7 = rand() % var_value + 1; |
0 | 8497 Party::SetFood(v7); |
8498 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8499 ShowStatusBarString(pTmpBuf, 2u); | |
8500 GameUI_DrawFoodAndGold(); | |
8501 goto LABEL_124; | |
8502 case VAR_Sex: | |
492 | 8503 this->uSex = (PLAYER_SEX)var_value; |
0 | 8504 goto LABEL_124; |
8505 case VAR_Class: | |
492 | 8506 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8507 if ( (char)var_value != 35 ) | |
0 | 8508 goto LABEL_124; |
8509 v8 = 0; | |
8510 v9 = this->pInventoryItems; | |
8511 break; | |
8512 case VAR_CurrentHP: | |
492 | 8513 this->sHealth = var_value; |
0 | 8514 goto LABEL_124; |
8515 case VAR_MaxHP: | |
8516 this->sHealth = GetMaxHealth(); | |
8517 return; | |
8518 case VAR_CurrentSP: | |
492 | 8519 this->sMana = var_value; |
0 | 8520 goto LABEL_124; |
8521 case VAR_MaxSP: | |
8522 this->sMana = GetMaxMana(); | |
8523 return; | |
8524 case VAR_ACModifier: | |
492 | 8525 this->sACModifier = (unsigned __int8)var_value; |
0 | 8526 goto LABEL_124; |
8527 case VAR_BaseLevel: | |
492 | 8528 this->uLevel = (unsigned __int8)var_value; |
0 | 8529 goto LABEL_124; |
8530 case VAR_LevelModifier: | |
492 | 8531 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8532 goto LABEL_124; |
8533 case VAR_Age: | |
492 | 8534 this->sAgeModifier = var_value; |
0 | 8535 return; |
8536 case VAR_Award: | |
492 | 8537 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8538 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
|
8539 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8540 && pAwards[var_value].pText ) |
0 | 8541 { |
8542 v30 = 1; | |
8543 v31 = 1; | |
492 | 8544 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8545 } |
492 | 8546 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8547 goto LABEL_168; | |
0 | 8548 case VAR_Experience: |
492 | 8549 this->uExperience = var_value; |
0 | 8550 goto LABEL_124; |
8551 case VAR_QBits_QuestsDone: | |
492 | 8552 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
|
8553 // && (&dword_722F10)[4 * a3] ) |
492 | 8554 && pQuestTable[var_value-1] ) |
0 | 8555 { |
492 | 8556 v14 = pPlayers[currPlayerId + 1]; |
0 | 8557 bFlashQuestBook = 1; |
8558 v30 = 1; | |
8559 v31 = 1; | |
187 | 8560 v14->PlaySound(SPEECH_93, 0); |
0 | 8561 } |
484 | 8562 v13 = (char *)pParty->_quest_bits; |
0 | 8563 LABEL_51: |
492 | 8564 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8565 if (( v30 != 1 )&&( v31 != 1 )) | |
8566 return; | |
8567 else | |
8568 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8569 if ( v31 != 1 ) | |
8570 return; | |
8571 v25 = 8 * currPlayerId + 400; | |
862 | 8572 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8573 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8574 return; | |
0 | 8575 case VAR_PlayerItemInHands: |
8576 item.Reset(); | |
8577 item.Reset(); | |
492 | 8578 item.uItemID = var_value; |
0 | 8579 item.uAttributes = 1; |
8580 pParty->SetHoldingItem(&item); | |
492 | 8581 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8582 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8583 return; |
8584 case VAR_FixedGold: | |
492 | 8585 Party::SetGold(var_value); |
0 | 8586 return; |
8587 case VAR_BaseMight: | |
492 | 8588 this->uMight = (unsigned __int8)var_value; |
0 | 8589 goto LABEL_84; |
8590 case VAR_BaseIntellect: | |
492 | 8591 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8592 goto LABEL_84; |
8593 case VAR_BasePersonality: | |
492 | 8594 this->uWillpower = (unsigned __int8)var_value; |
0 | 8595 goto LABEL_84; |
8596 case VAR_BaseEndurance: | |
492 | 8597 this->uEndurance = (unsigned __int8)var_value; |
0 | 8598 goto LABEL_84; |
8599 case VAR_BaseSpeed: | |
492 | 8600 this->uSpeed = (unsigned __int8)var_value; |
0 | 8601 goto LABEL_84; |
8602 case VAR_BaseAccuracy: | |
492 | 8603 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8604 goto LABEL_84; |
8605 case VAR_BaseLuck: | |
492 | 8606 this->uLuck = (unsigned __int8)var_value; |
0 | 8607 goto LABEL_84; |
8608 case VAR_FixedFood: | |
492 | 8609 Party::SetFood(var_value); |
0 | 8610 goto LABEL_124; |
8611 case VAR_MightBonus: | |
8612 goto LABEL_64; | |
8613 case VAR_IntellectBonus: | |
8614 goto LABEL_68; | |
8615 case VAR_PersonalityBonus: | |
8616 goto LABEL_69; | |
8617 case VAR_EnduranceBonus: | |
8618 goto LABEL_70; | |
8619 case VAR_SpeedBonus: | |
8620 goto LABEL_71; | |
8621 case VAR_AccuracyBonus: | |
8622 goto LABEL_72; | |
8623 case VAR_LuckBonus: | |
8624 goto LABEL_73; | |
8625 default: | |
8626 return; | |
8627 } | |
8628 while ( v9->uItemID != 615 ) | |
8629 { | |
8630 ++v8; | |
8631 ++v9; | |
8632 if ( v8 >= 138 ) | |
8633 goto LABEL_22; | |
8634 } | |
8635 v10 = (int)((char *)v4 + 36 * v8); | |
8636 *(int *)(v10 + 532) = 601; | |
492 | 8637 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8638 LABEL_22: |
8639 if ( v4->sResFireBase < 20 ) | |
8640 v4->sResFireBase = 20; | |
8641 if ( v4->sResAirBase < 20 ) | |
8642 v4->sResAirBase = 20; | |
8643 if ( v4->sResWaterBase < 20 ) | |
8644 v4->sResWaterBase = 20; | |
8645 if ( v4->sResEarthBase < 20 ) | |
8646 v4->sResEarthBase = 20; | |
8647 v4->sResMindBase = 200; | |
8648 v4->sResBodyBase = 200; | |
8649 v11 = v4->GetSexByVoice(); | |
8650 v4->field_1924 = v4->uVoiceID; | |
8651 v4->field_1928 = v4->uFace; | |
8652 if ( v11 ) | |
8653 { | |
8654 v4->uFace = 21; | |
8655 v4->uVoiceID = 21; | |
8656 } | |
8657 else | |
8658 { | |
8659 v4->uFace = 20; | |
8660 v4->uVoiceID = 20; | |
8661 } | |
492 | 8662 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8663 goto LABEL_124; |
8664 } | |
8665 LABEL_64: | |
492 | 8666 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8667 LABEL_111: |
8668 v28 = 0; | |
187 | 8669 v26 = SPEECH_91; |
0 | 8670 LABEL_112: |
492 | 8671 v19 = pPlayers[currPlayerId + 1]; |
0 | 8672 v31 = 1; |
187 | 8673 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8674 goto LABEL_169; |
8675 } | |
492 | 8676 if ( var_type <= VAR_FireResistanceBonus ) |
8677 { | |
8678 if ( var_type == VAR_FireResistanceBonus ) | |
8679 { | |
8680 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8681 goto LABEL_111; |
8682 } | |
492 | 8683 switch ( var_type ) |
0 | 8684 { |
8685 case VAR_ActualIntellect: | |
8686 LABEL_68: | |
492 | 8687 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8688 goto LABEL_111; |
8689 case VAR_ActualPersonality: | |
8690 LABEL_69: | |
492 | 8691 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8692 goto LABEL_111; |
8693 case VAR_ActualEndurance: | |
8694 LABEL_70: | |
492 | 8695 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8696 goto LABEL_111; |
8697 case VAR_ActualSpeed: | |
8698 LABEL_71: | |
492 | 8699 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8700 goto LABEL_111; |
8701 case VAR_ActualAccuracy: | |
8702 LABEL_72: | |
492 | 8703 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8704 goto LABEL_111; |
8705 case VAR_ActualLuck: | |
8706 LABEL_73: | |
492 | 8707 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8708 goto LABEL_111; |
8709 case VAR_FireResistance: | |
492 | 8710 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8711 goto LABEL_84; |
8712 case VAR_AirResistance: | |
492 | 8713 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8714 goto LABEL_84; |
8715 case VAR_WaterResistance: | |
492 | 8716 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8717 goto LABEL_84; |
8718 case VAR_EarthResistance: | |
492 | 8719 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8720 goto LABEL_84; |
8721 case VAR_SpiritResistance: | |
492 | 8722 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8723 goto LABEL_84; |
8724 case VAR_MindResistance: | |
492 | 8725 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8726 goto LABEL_84; |
8727 case VAR_BodyResistance: | |
492 | 8728 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8729 goto LABEL_84; |
8730 case VAR_LightResistance: | |
492 | 8731 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8732 goto LABEL_84; |
8733 case VAR_DarkResistance: | |
492 | 8734 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8735 goto LABEL_84; |
8736 case VAR_MagicResistance: | |
492 | 8737 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8738 LABEL_84: |
8739 v28 = 0; | |
8740 v26 = 92; | |
8741 goto LABEL_112; | |
8742 default: | |
8743 return; | |
8744 } | |
8745 return; | |
8746 } | |
8747 HIWORD(v15) = 0; | |
492 | 8748 if ( var_type > VAR_DisarmTrapSkill ) |
8749 { | |
8750 if ( var_type != VAR_LearningSkill ) | |
8751 { | |
8752 if ( var_type <= VAR_LearningSkill ) | |
0 | 8753 return; |
492 | 8754 if ( var_type <= VAR_Eradicated ) |
8755 { | |
8756 v4->SetCondition(var_type - 105, 1); | |
0 | 8757 } |
8758 else | |
8759 { | |
492 | 8760 if ( var_type != VAR_MajorCondition ) |
0 | 8761 { |
492 | 8762 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8763 byte_5E4C15[var_type] = var_value; | |
0 | 8764 return; |
8765 } | |
8766 memset(v4, 0, 0xA0u); | |
8767 } | |
8768 LABEL_124: | |
8769 v31 = 1; | |
8770 goto LABEL_169; | |
8771 } | |
8772 LABEL_106: | |
492 | 8773 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8774 v17 = *(char *)v16; |
492 | 8775 if ( var_value <= VAR_BodyResistanceBonus ) |
8776 { | |
8777 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8778 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8779 } | |
8780 else | |
8781 { | |
492 | 8782 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8783 } |
8784 *(short *)v16 = v18; | |
8785 goto LABEL_124; | |
8786 } | |
492 | 8787 if ( var_type == VAR_DisarmTrapSkill ) |
8788 if ( v30 != 1 ) | |
8789 { | |
8790 if ( v31 != 1 ) | |
8791 return; | |
8792 v5 = 0; | |
8793 goto LABEL_172; | |
8794 } | |
8795 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8796 goto LABEL_170; | |
8797 if ( var_type <= VAR_BodyResistanceBonus ) | |
8798 { | |
8799 switch ( var_type ) | |
0 | 8800 { |
8801 case VAR_BodyResistanceBonus: | |
492 | 8802 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8803 break; |
8804 case VAR_AirResistanceBonus: | |
492 | 8805 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8806 break; |
8807 case VAR_WaterResistanceBonus: | |
492 | 8808 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8809 break; |
8810 case VAR_EarthResistanceBonus: | |
492 | 8811 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8812 break; |
8813 case VAR_SpiritResistanceBonus: | |
492 | 8814 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8815 break; |
8816 default: | |
492 | 8817 if ( var_type != 62 ) |
0 | 8818 return; |
492 | 8819 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8820 break; |
8821 } | |
8822 goto LABEL_111; | |
8823 } | |
492 | 8824 if ( var_type == VAR_LightResistanceBonus ) |
8825 { | |
8826 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8827 goto LABEL_111; |
8828 } | |
492 | 8829 if ( var_type == VAR_DarkResistanceBonus ) |
8830 { | |
8831 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8832 goto LABEL_111; | |
8833 } | |
8834 if ( var_type == VAR_MagicResistanceBonus ) | |
8835 { | |
8836 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8837 goto LABEL_111; |
8838 } | |
492 | 8839 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8840 if ( v30 != 1 ) | |
8841 { | |
8842 if ( v31 != 1 ) | |
8843 return; | |
8844 v5 = 0; | |
8845 v25 = 8 * currPlayerId + 400; | |
862 | 8846 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8847 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8848 return; | |
8849 } | |
8850 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8851 goto LABEL_170; | |
0 | 8852 } |
8853 | |
8854 | |
8855 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8856 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8857 { |
8858 char v3; // bl@1 | |
8859 Player *v4; // esi@1 | |
8860 signed int uPlayerIdx; // edi@1 | |
8861 int v6; // eax@15 | |
8862 unsigned int v7; // esi@18 | |
8863 int *v8; // ebx@21 | |
8864 int v9; // eax@22 | |
8865 signed int v10; // eax@24 | |
8866 int v11; // eax@27 | |
8867 __int16 *v12; // esi@28 | |
8868 Player *v13; // ecx@34 | |
8869 Player *v14; // ecx@36 | |
8870 char *v15; // ecx@37 | |
8871 unsigned __int8 v16; // cf@38 | |
8872 Player *v17; // ecx@42 | |
8873 __int16 *v18; // esi@53 | |
8874 __int16 *v19; // esi@62 | |
8875 char *v20; // esi@107 | |
8876 __int16 v21; // dx@107 | |
8877 int v22; // ecx@107 | |
8878 Player *v23; // ecx@132 | |
8879 int v24; // eax@132 | |
8880 int v25; // eax@150 | |
8881 char v26; // zf@151 | |
8882 DDM_DLV_Header *v27; // eax@153 | |
8883 signed int v28; // eax@176 | |
8884 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8885 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8886 int v31; // [sp-4h] [bp-3Ch]@84 |
8887 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8888 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8889 char v34; // [sp+37h] [bp-1h]@1 | |
8890 | |
8891 auto Dst = this; | |
8892 v3 = 0; | |
8893 v34 = 0; | |
8894 v4 = Dst; | |
8895 uPlayerIdx = 0; | |
8896 if ( Dst == pPlayers[2] ) | |
8897 uPlayerIdx = 1; | |
310 | 8898 else if ( Dst == pPlayers[3] ) |
8899 uPlayerIdx = 2; | |
8900 else if ( Dst == pPlayers[4] ) | |
8901 uPlayerIdx = 3; | |
8902 | |
8903 if ( var_type <= VAR_AutoNotes ) | |
8904 { | |
8905 if ( var_type != VAR_AutoNotes ) | |
8906 { | |
8907 if ( var_type <= VAR_ActualMight ) | |
8908 { | |
8909 if ( var_type != VAR_ActualMight ) | |
0 | 8910 { |
310 | 8911 switch ( var_type ) |
0 | 8912 { |
8913 case VAR_RandomGold: | |
8914 if ( !val ) | |
8915 val = 1; | |
8916 v6 = rand(); | |
8917 party_finds_gold(v6 % val + 1, 1); | |
8918 GameUI_DrawFoodAndGold(); | |
8919 return; | |
8920 case VAR_RandomFood: | |
8921 if ( !val ) | |
8922 val = 1; | |
8923 v7 = rand() % val + 1; | |
8924 Party::GiveFood(v7); | |
8925 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8926 ShowStatusBarString(pTmpBuf, 2u); | |
8927 GameUI_DrawFoodAndGold(); | |
8928 goto _play_sound; | |
8929 case VAR_Sex: | |
8930 Dst->uSex = (PLAYER_SEX)val; | |
8931 goto _play_anim_and_exit; | |
8932 case VAR_Class: | |
135 | 8933 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8934 goto _play_anim_and_exit; |
8935 case VAR_CurrentHP: | |
8936 v8 = &Dst->sHealth; | |
8937 *v8 += val; | |
8938 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8939 goto _play_anim_and_exit; | |
8940 v9 = v4->GetMaxHealth(); | |
8941 goto LABEL_23; | |
8942 case VAR_MaxHP: | |
8943 v10 = Dst->GetMaxHealth(); | |
8944 v4->_health_related = 0; | |
8945 v4->uFullHealthBonus = 0; | |
8946 v4->sHealth = v10; | |
8947 return; | |
8948 case VAR_CurrentSP: | |
8949 v8 = &Dst->sMana; | |
8950 *v8 += val; | |
8951 if ( Dst->sMana > GetMaxMana() ) | |
8952 { | |
8953 v9 = v4->GetMaxMana(); | |
8954 LABEL_23: | |
8955 *v8 = v9; | |
8956 } | |
8957 goto _play_anim_and_exit; | |
8958 case VAR_MaxSP: | |
8959 v11 = GetMaxMana(); | |
8960 v4->_mana_related = 0; | |
8961 v4->uFullManaBonus = 0; | |
8962 v4->sMana = v11; | |
8963 return; | |
8964 case VAR_ACModifier: | |
8965 v12 = &Dst->sACModifier; | |
8966 goto LABEL_29; | |
8967 case VAR_BaseLevel: | |
8968 v12 = (__int16 *)&Dst->uLevel; | |
8969 goto LABEL_29; | |
8970 case VAR_LevelModifier: | |
8971 v12 = &Dst->sLevelModifier; | |
8972 LABEL_29: | |
8973 *v12 += val; | |
8974 if ( *v12 > 255 ) | |
8975 *v12 = 255; | |
8976 goto _play_anim_and_exit; | |
8977 case VAR_Age: | |
8978 Dst->sAgeModifier += val; | |
8979 return; | |
8980 case VAR_Award: | |
8981 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8982 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8983 | |
492 | 8984 && pAwards[val].pText ) |
0 | 8985 { |
8986 v14 = pPlayers[uPlayerIdx + 1]; | |
8987 v34 = 1; | |
8988 v3 = 1; | |
187 | 8989 v14->PlaySound(SPEECH_96, 0); |
0 | 8990 } |
735 | 8991 v15 = (char *)v4->_guilds_member_bits; |
0 | 8992 goto LABEL_44; |
8993 case VAR_Experience: | |
8994 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8995 LODWORD(Dst->uExperience) += val; | |
8996 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8997 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8998 Dst->uExperience = 4000000000i64; | |
8999 goto _play_anim_and_exit; | |
9000 case VAR_QBits_QuestsDone: | |
484 | 9001 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
|
9002 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9003 && pQuestTable[val-1] ) |
0 | 9004 { |
501 | 9005 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 9006 bFlashQuestBook = 1; |
9007 v34 = 1; | |
9008 v3 = 1; | |
501 | 9009 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 9010 } |
484 | 9011 v15 = (char *)pParty->_quest_bits; |
0 | 9012 LABEL_44: |
9013 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
9014 goto LABEL_173; | |
9015 case VAR_PlayerItemInHands: | |
9016 item.Reset(); | |
9017 item.Reset(); | |
9018 item.uAttributes = 1; | |
9019 item.uItemID = val; | |
9020 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 9021 pParty->pIsArtifactFound[val-500] = 1; |
0 | 9022 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
9023 { | |
9024 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
9025 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
9026 } | |
9027 pParty->SetHoldingItem(&item); | |
9028 return; | |
9029 case VAR_FixedGold: | |
9030 party_finds_gold(val, 1); | |
9031 return; | |
9032 case VAR_BaseMight: | |
9033 v18 = (__int16 *)&Dst->uMight; | |
9034 goto LABEL_82; | |
9035 case VAR_BaseIntellect: | |
9036 v18 = (__int16 *)&Dst->uIntelligence; | |
9037 goto LABEL_82; | |
9038 case VAR_BasePersonality: | |
9039 v18 = (__int16 *)&Dst->uWillpower; | |
9040 goto LABEL_82; | |
9041 case VAR_BaseEndurance: | |
9042 v18 = (__int16 *)&Dst->uEndurance; | |
9043 goto LABEL_82; | |
9044 case VAR_BaseSpeed: | |
9045 v18 = (__int16 *)&Dst->uSpeed; | |
9046 goto LABEL_82; | |
9047 case VAR_BaseAccuracy: | |
9048 v18 = (__int16 *)&Dst->uAccuracy; | |
9049 goto LABEL_82; | |
9050 case VAR_BaseLuck: | |
9051 v18 = (__int16 *)&Dst->uLuck; | |
9052 goto LABEL_82; | |
9053 case VAR_FixedFood: | |
9054 Party::GiveFood(val); | |
715 | 9055 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 9056 ShowStatusBarString(pTmpBuf, 2u); |
9057 if ( pParty->uNumFoodRations > 0xFFFF ) | |
9058 Party::SetFood(0xFFFFu); | |
9059 goto _play_sound; | |
9060 case VAR_MightBonus: | |
9061 goto LABEL_62; | |
9062 case VAR_IntellectBonus: | |
9063 goto LABEL_66; | |
9064 case VAR_PersonalityBonus: | |
9065 goto LABEL_67; | |
9066 case VAR_EnduranceBonus: | |
9067 goto LABEL_68; | |
9068 case VAR_SpeedBonus: | |
9069 goto LABEL_69; | |
9070 case VAR_AccuracyBonus: | |
9071 goto LABEL_70; | |
9072 case VAR_LuckBonus: | |
9073 goto LABEL_71; | |
9074 default: | |
9075 return; | |
9076 } | |
9077 return; | |
9078 } | |
9079 LABEL_62: | |
9080 v19 = (__int16 *)&Dst->uMightBonus; | |
9081 goto LABEL_113; | |
9082 } | |
310 | 9083 if ( var_type <= VAR_FireResistanceBonus ) |
9084 { | |
9085 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 9086 { |
310 | 9087 switch ( var_type ) |
0 | 9088 { |
9089 case VAR_ActualIntellect: | |
9090 LABEL_66: | |
9091 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9092 goto LABEL_113; | |
9093 case VAR_ActualPersonality: | |
9094 LABEL_67: | |
9095 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9096 goto LABEL_113; | |
9097 case VAR_ActualEndurance: | |
9098 LABEL_68: | |
9099 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9100 goto LABEL_113; | |
9101 case VAR_ActualSpeed: | |
9102 LABEL_69: | |
9103 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9104 goto LABEL_113; | |
9105 case VAR_ActualAccuracy: | |
9106 LABEL_70: | |
9107 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9108 goto LABEL_113; | |
9109 case VAR_ActualLuck: | |
9110 LABEL_71: | |
9111 v19 = (__int16 *)&Dst->uLuckBonus; | |
9112 goto LABEL_113; | |
9113 case VAR_FireResistance: | |
9114 v18 = &Dst->sResFireBase; | |
9115 goto LABEL_82; | |
9116 case VAR_AirResistance: | |
9117 v18 = &Dst->sResAirBase; | |
9118 goto LABEL_82; | |
9119 case VAR_WaterResistance: | |
9120 v18 = &Dst->sResWaterBase; | |
9121 goto LABEL_82; | |
9122 case VAR_EarthResistance: | |
9123 v18 = &Dst->sResEarthBase; | |
9124 goto LABEL_82; | |
9125 case VAR_SpiritResistance: | |
9126 v18 = &Dst->sResSpiritBase; | |
9127 goto LABEL_82; | |
9128 case VAR_MindResistance: | |
9129 v18 = &Dst->sResMindBase; | |
9130 goto LABEL_82; | |
9131 case VAR_BodyResistance: | |
9132 v18 = &Dst->sResBodyBase; | |
9133 goto LABEL_82; | |
9134 case VAR_LightResistance: | |
9135 v18 = &Dst->sResLightBase; | |
9136 goto LABEL_82; | |
9137 case VAR_DarkResistance: | |
9138 v18 = &Dst->sResDarkBase; | |
9139 goto LABEL_82; | |
9140 case VAR_MagicResistance: | |
9141 v18 = &Dst->sResMagicBase; | |
9142 LABEL_82: | |
9143 *v18 += val; | |
9144 if ( *v18 > 255 ) | |
9145 *v18 = 255; | |
9146 v31 = 0; | |
9147 v29 = 92; | |
9148 goto LABEL_116; | |
9149 default: | |
9150 return; | |
9151 } | |
9152 return; | |
9153 } | |
9154 v19 = &Dst->sResFireBonus; | |
9155 LABEL_113: | |
9156 *v19 += val; | |
9157 if ( *v19 > 255 ) | |
9158 *v19 = 255; | |
9159 v31 = 0; | |
187 | 9160 v29 = SPEECH_91; |
0 | 9161 LABEL_116: |
9162 v3 = 1; | |
187 | 9163 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9164 goto _play_anim_and_maybe_sound; |
9165 } | |
310 | 9166 if ( var_type <= VAR_DisarmTrapSkill ) |
9167 { | |
9168 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9169 { |
310 | 9170 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9171 { |
310 | 9172 switch ( var_type ) |
0 | 9173 { |
9174 case VAR_BodyResistanceBonus: | |
9175 v19 = &Dst->sResBodyBonus; | |
9176 break; | |
9177 case VAR_AirResistanceBonus: | |
9178 v19 = &Dst->sResAirBonus; | |
9179 break; | |
9180 case VAR_WaterResistanceBonus: | |
9181 v19 = &Dst->sResWaterBonus; | |
9182 break; | |
9183 case VAR_EarthResistanceBonus: | |
9184 v19 = &Dst->sResEarthBonus; | |
9185 break; | |
9186 case VAR_SpiritResistanceBonus: | |
9187 v19 = &Dst->sResSpiritBonus; | |
9188 break; | |
9189 default: | |
310 | 9190 if ( var_type != 62 ) |
0 | 9191 return; |
9192 v19 = &Dst->sResMindBonus; | |
9193 break; | |
9194 } | |
9195 goto LABEL_113; | |
9196 } | |
310 | 9197 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9198 { |
9199 v19 = &Dst->sResLightBonus; | |
9200 goto LABEL_113; | |
9201 } | |
310 | 9202 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9203 { |
9204 v19 = &Dst->sResDarkBonus; | |
9205 goto LABEL_113; | |
9206 } | |
310 | 9207 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9208 { |
9209 v19 = &Dst->sResMagicBonus; | |
9210 goto LABEL_113; | |
9211 } | |
310 | 9212 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9213 return; |
9214 } | |
9215 goto LABEL_106; | |
9216 } | |
310 | 9217 if ( var_type == VAR_LearningSkill ) |
0 | 9218 { |
9219 LABEL_106: | |
9220 if ( val <= VAR_BodyResistanceBonus ) | |
9221 { | |
310 | 9222 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9223 } |
9224 else | |
9225 { | |
310 | 9226 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9227 v21 = *(short *)v20; |
9228 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9229 if ( v22 > 60 ) | |
9230 LOWORD(v22) = 60; | |
9231 LOBYTE(v21) = v21 & 0xC0; | |
9232 *(short *)v20 = v22 | v21; | |
9233 } | |
9234 goto _play_anim_and_exit; | |
9235 } | |
310 | 9236 if ( var_type <= VAR_LearningSkill ) |
0 | 9237 return; |
310 | 9238 if ( var_type <= VAR_Eradicated ) |
9239 { | |
9240 Dst->SetCondition(var_type - 105, 0); | |
0 | 9241 } |
9242 else | |
9243 { | |
310 | 9244 if ( var_type != VAR_MajorCondition ) |
0 | 9245 { |
310 | 9246 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9247 { |
310 | 9248 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9249 byte_5E4C15[var_type] += val; | |
0 | 9250 else |
310 | 9251 byte_5E4C15[var_type] = -1; |
0 | 9252 } |
9253 return; | |
9254 } | |
9255 memset(Dst, 0, 0xA0u); | |
9256 } | |
9257 _play_anim_and_exit: | |
9258 v3 = 1; | |
9259 _play_anim_and_maybe_sound: | |
9260 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9261 _maybe_play_sound: | |
9262 if ( v3 != 1 ) | |
9263 return; | |
9264 goto _play_sound; | |
9265 } | |
9266 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
|
9267 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9268 && pAutonoteTxt[val-1].pText ) |
0 | 9269 { |
9270 v23 = pPlayers[uPlayerIdx + 1]; | |
9271 v34 = 1; | |
187 | 9272 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9273 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9274 bFlashAutonotesBook = 1; |
981 | 9275 _506568_autonote_type = v24; |
0 | 9276 } |
9277 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9278 v3 = 1; | |
9279 LABEL_173: | |
9280 if ( v34 != 1 ) | |
9281 goto _maybe_play_sound; | |
9282 goto _play_anim_and_maybe_sound; | |
9283 } | |
310 | 9284 if ( var_type > VAR_GoldInBank ) |
9285 { | |
9286 if ( var_type == 307 ) | |
0 | 9287 { |
9288 pParty->uNumDeaths += val; | |
9289 goto LABEL_173; | |
9290 } | |
310 | 9291 switch ( var_type ) |
0 | 9292 { |
9293 case 308: | |
9294 pParty->uNumBountiesCollected += val; | |
9295 break; | |
9296 case 309: | |
9297 pParty->uNumPrisonTerms += val; | |
9298 break; | |
9299 case 310: | |
9300 pParty->uNumArenaPageWins += val; | |
9301 break; | |
9302 case 311: | |
9303 pParty->uNumArenaSquireWins += val; | |
9304 break; | |
9305 case 312: | |
9306 pParty->uNumArenaKnightWins += val; | |
9307 break; | |
9308 case 313: | |
9309 pParty->uNumArenaLordWins += val; | |
9310 break; | |
9311 } | |
9312 } | |
9313 else | |
9314 { | |
310 | 9315 if ( var_type == VAR_GoldInBank ) |
0 | 9316 { |
9317 pParty->uNumGoldInBank += val; | |
9318 return; | |
9319 } | |
310 | 9320 if ( var_type <= VAR_Counter8 ) |
9321 { | |
9322 if ( (signed int)var_type >= 245 ) | |
9323 { | |
9324 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9325 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9326 } |
9327 else | |
9328 { | |
310 | 9329 switch ( var_type ) |
0 | 9330 { |
9331 case VAR_MonthEquals|VAR_CurrentSP: | |
9332 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9333 break; | |
9334 case VAR_NPCs2: | |
9335 pParty->field_709 = 0; | |
9336 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9337 Party__CountHirelings(); |
0 | 9338 viewparams->bRedrawGameUI = 1; |
9339 break; | |
9340 case VAR_NumSkillPoints: | |
9341 Dst->uSkillPoints += val; | |
9342 break; | |
9343 } | |
9344 } | |
9345 return; | |
9346 } | |
310 | 9347 if ( var_type < VAR_Counter9 ) |
0 | 9348 return; |
310 | 9349 if ( (signed int)var_type <= 274 ) |
9350 { | |
9351 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9352 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9353 goto _play_sound; |
9354 } | |
310 | 9355 if ( var_type != VAR_ReputationInCurrentLocation ) |
9356 { | |
9357 if ( var_type <= VAR_ReputationInCurrentLocation | |
9358 || var_type > VAR_History_28 | |
9359 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9360 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9361 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9362 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9363 v26) ) |
9364 return; | |
9365 bFlashHistoryBook = 1; | |
9366 _play_sound: | |
9367 v28 = 8 * uPlayerIdx + 400; | |
862 | 9368 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9369 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9370 return; | |
9371 } | |
9372 v27 = &pOutdoor->ddm; | |
9373 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9374 v27 = &pIndoor->dlv; | |
9375 v27->uReputation += val; | |
9376 if ( v27->uReputation > 10000 ) | |
9377 v27->uReputation = 10000; | |
9378 } | |
9379 } | |
9380 // 506568: using guessed type int dword_506568; | |
9381 // 507948: using guessed type char bFlashHistoryBook; | |
9382 // 507949: using guessed type char bFlashAutonotesBook; | |
9383 // 50794A: using guessed type char bFlashQuestBook; | |
9384 // 72371C: using guessed type int dword_72371C[]; | |
9385 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9386 | |
9387 | |
9388 | |
9389 | |
9390 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9391 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9392 { |
9393 unsigned int v3; // ebx@1 | |
9394 signed int v4; // esi@1 | |
501 | 9395 bool result; // eax@8 |
0 | 9396 int v6; // esi@11 |
9397 int v7; // edi@14 | |
9398 signed int v8; // eax@17 | |
9399 char *v9; // eax@20 | |
9400 char v10; // sf@20 | |
9401 char *v11; // ecx@26 | |
9402 char *v12; // ecx@27 | |
9403 __int64 v13; // qax@27 | |
9404 unsigned __int8 v14; // cf@27 | |
501 | 9405 int *v15; // edx@29 |
0 | 9406 char *v16; // eax@90 |
9407 char *v17; // ecx@94 | |
501 | 9408 int v18; // esi@97 |
0 | 9409 signed int v19; // edx@97 |
9410 char *v20; // ecx@98 | |
9411 int v21; // eax@100 | |
9412 __int16 v22; // dx@112 | |
9413 int v23; // [sp-8h] [bp-14h]@45 | |
9414 signed int v24; // [sp-4h] [bp-10h]@4 | |
9415 int v25; // [sp-4h] [bp-10h]@45 | |
9416 | |
9417 v3 = 0; | |
605 | 9418 v4 = uActiveCharacter - 1; |
501 | 9419 result = false; |
9420 if ( (signed int)VarNum > 222 ) | |
9421 { | |
9422 if ( (signed int)VarNum <= 307 ) | |
9423 { | |
9424 if ( VarNum == 307 ) | |
9425 { | |
9426 pParty->uNumDeaths -= (unsigned int)pValue; | |
9427 return pValue; | |
9428 } | |
9429 if ( VarNum == 223 ) | |
0 | 9430 { |
9431 v11 = (char *)pParty->_autonote_bits; | |
501 | 9432 v22 = (short)pValue - 1; |
0 | 9433 } |
9434 else | |
9435 { | |
501 | 9436 if ( VarNum != 231 ) |
0 | 9437 { |
501 | 9438 switch ( VarNum ) |
0 | 9439 { |
9440 case 232: | |
501 | 9441 VarNum = (VariableType)0; |
602 | 9442 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9443 result = (bool) pValue; |
9444 dword_5B65CC = 0; | |
9445 if ( (int)VarNum == pValue ) | |
0 | 9446 { |
501 | 9447 dword_5B65CC = (int)pValue; |
0 | 9448 } |
9449 else | |
9450 { | |
9451 pParty->field_709 = 0; | |
501 | 9452 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9453 Party__CountHirelings(); |
0 | 9454 viewparams->bRedrawGameUI = 1; |
9455 } | |
9456 break; | |
9457 case 241: | |
9458 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9459 { | |
9460 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9461 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9462 { |
605 | 9463 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9464 { |
9465 v21 = *(int *)v20; | |
9466 if ( (char)*(int *)v20 < 0 ) | |
9467 { | |
9468 LOBYTE(v21) = v21 & 0x7F; | |
9469 *(int *)v20 = v21; | |
9470 } | |
9471 } | |
9472 v20 += 76; | |
9473 } | |
9474 } | |
605 | 9475 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9476 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9477 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9478 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9479 pParty->field_709 = 0; | |
659 | 9480 Party__CountHirelings(); |
0 | 9481 break; |
9482 case 243: | |
9483 v17 = (char *)&this->uSkillPoints; | |
501 | 9484 result = *v17; |
9485 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9486 { | |
9487 *(int *)v17 -= (int)pValue; | |
9488 result = v17; | |
9489 } | |
0 | 9490 else |
9491 *(int *)v17 = 0; | |
9492 break; | |
9493 case 275: | |
9494 v16 = (char *)&pOutdoor->ddm; | |
9495 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9496 v16 = (char *)&pIndoor->dlv; | |
501 | 9497 *((int *)v16 + 2) -= (int)pValue; |
0 | 9498 if ( *((int *)v16 + 2) < -10000 ) |
9499 *((int *)v16 + 2) = -10000; | |
9500 break; | |
9501 case 306: | |
501 | 9502 result = VarNum - 306; |
9503 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9504 { | |
9505 result = (bool)pValue; | |
9506 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9507 } |
0 | 9508 else |
9509 LABEL_88: | |
9510 dword_5B65C4 = 1; | |
9511 break; | |
9512 } | |
501 | 9513 return result; |
0 | 9514 } |
9515 v11 = this->field_1A50; | |
501 | 9516 v22 = (signed __int16)pValue; |
0 | 9517 } |
9518 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9519 return result; |
9520 } | |
9521 switch ( VarNum ) | |
0 | 9522 { |
9523 case 308: | |
501 | 9524 result = (bool)pValue; |
9525 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9526 break; |
9527 case 309: | |
501 | 9528 result = (bool)pValue; |
9529 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9530 break; |
9531 case 310: | |
501 | 9532 result = (bool)pValue; |
9533 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9534 break; |
9535 case 311: | |
501 | 9536 result = (bool)pValue; |
9537 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9538 break; |
9539 case 312: | |
501 | 9540 result = (bool)pValue; |
9541 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9542 break; |
9543 case 313: | |
501 | 9544 result = (bool)pValue; |
9545 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9546 break; |
9547 } | |
9548 } | |
9549 else | |
9550 { | |
501 | 9551 if ( (signed int)VarNum >= 123 ) |
9552 { | |
9553 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9554 } |
9555 else | |
9556 { | |
501 | 9557 switch ( VarNum ) |
0 | 9558 { |
9559 case VAR_RandomGold: | |
501 | 9560 v6 = rand() % (signed int)pValue + 1; |
0 | 9561 if ( v6 > pParty->uNumGold ) |
9562 v6 = pParty->uNumGold; | |
9563 Party::TakeGold(v6); | |
9564 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9565 ShowStatusBarString(pTmpBuf, 2); |
0 | 9566 GameUI_DrawFoodAndGold(); |
501 | 9567 return result; |
0 | 9568 case VAR_RandomFood: |
501 | 9569 v7 = rand() % (signed int)pValue + 1; |
0 | 9570 if ( v7 > pParty->uNumFoodRations ) |
9571 v7 = pParty->uNumFoodRations; | |
9572 Party::TakeFood(v7); | |
9573 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9574 ShowStatusBarString(pTmpBuf, 2u); | |
9575 GameUI_DrawFoodAndGold(); | |
605 | 9576 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9577 v8 = 8 * v4 + 400; | |
862 | 9578 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9579 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9580 return result; |
0 | 9581 case VAR_CurrentHP: |
501 | 9582 ReceiveDamage((signed int)pValue, 4); |
605 | 9583 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9584 v8 = 8 * v4 + 400; | |
862 | 9585 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9586 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9587 return result; | |
0 | 9588 case VAR_CurrentSP: |
9589 v9 = (char *)&this->sMana; | |
501 | 9590 v10 = this->sMana - (signed int)pValue < 0; |
9591 *(int *)v9 -= (int)pValue; | |
0 | 9592 if ( v10 ) |
9593 *(int *)v9 = 0; | |
605 | 9594 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9595 v8 = 8 * v4 + 400; | |
862 | 9596 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9597 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9598 return result; | |
0 | 9599 case VAR_ACModifier: |
501 | 9600 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9601 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9602 v8 = 8 * v4 + 400; | |
862 | 9603 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9604 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9605 return result; | |
0 | 9606 case VAR_BaseLevel: |
501 | 9607 this->uLevel -= (unsigned __int8)pValue; |
605 | 9608 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9609 v8 = 8 * v4 + 400; | |
862 | 9610 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9611 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9612 return result; | |
0 | 9613 case VAR_LevelModifier: |
501 | 9614 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9615 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9616 v8 = 8 * v4 + 400; | |
862 | 9617 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9618 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9619 return result; | |
0 | 9620 case VAR_Age: |
501 | 9621 this->sAgeModifier -= (signed __int16)pValue; |
9622 return result; | |
0 | 9623 case VAR_Award: |
605 | 9624 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9625 return result; | |
0 | 9626 case VAR_Experience: |
9627 v12 = (char *)&this->uExperience; | |
501 | 9628 v13 = (signed int)pValue; |
9629 v14 = *(int *)v12 < (unsigned int)pValue; | |
9630 *(int *)v12 -= (int)pValue; | |
0 | 9631 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9632 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9633 v8 = 8 * v4 + 400; | |
862 | 9634 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9635 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9636 return result; | |
0 | 9637 case VAR_QBits_QuestsDone: |
501 | 9638 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9639 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9640 return true; |
0 | 9641 case VAR_PlayerItemInHands: |
501 | 9642 v15 = this->pInventoryIndices; |
0 | 9643 break; |
9644 case VAR_FixedGold: | |
501 | 9645 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9646 goto LABEL_88; |
501 | 9647 Party::TakeGold((unsigned int)pValue); |
9648 return result; | |
0 | 9649 case VAR_MightBonus: |
9650 case VAR_ActualMight: | |
501 | 9651 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9652 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9653 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9654 v8 = 8 * v4 + 400; | |
862 | 9655 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9656 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9657 return result; | |
0 | 9658 case VAR_IntellectBonus: |
9659 case VAR_ActualIntellect: | |
501 | 9660 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9661 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9662 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9663 v8 = 8 * v4 + 400; | |
862 | 9664 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9665 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9666 return result; | |
0 | 9667 case VAR_PersonalityBonus: |
9668 case VAR_ActualPersonality: | |
501 | 9669 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9670 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9671 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9672 v8 = 8 * v4 + 400; | |
862 | 9673 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9674 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9675 return result; | |
0 | 9676 case VAR_EnduranceBonus: |
9677 case VAR_ActualEndurance: | |
501 | 9678 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9679 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9680 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9681 v8 = 8 * v4 + 400; | |
862 | 9682 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9683 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9684 return result; | |
0 | 9685 case VAR_SpeedBonus: |
9686 case VAR_ActualSpeed: | |
501 | 9687 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9688 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9689 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9690 v8 = 8 * v4 + 400; | |
862 | 9691 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9692 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9693 return result; | |
0 | 9694 case VAR_AccuracyBonus: |
9695 case VAR_ActualAccuracy: | |
501 | 9696 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9697 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9698 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9699 v8 = 8 * v4 + 400; | |
862 | 9700 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9701 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9702 return result; | |
0 | 9703 case VAR_LuckBonus: |
9704 case VAR_ActualLuck: | |
501 | 9705 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9706 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9707 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9708 v8 = 8 * v4 + 400; | |
862 | 9709 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9710 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9711 return result; | |
0 | 9712 case VAR_BaseMight: |
501 | 9713 this->uMight -= (unsigned __int16)pValue; |
605 | 9714 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9715 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9716 v8 = 8 * v4 + 400; | |
862 | 9717 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9718 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9719 return result; | |
0 | 9720 case VAR_BaseIntellect: |
501 | 9721 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9722 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9723 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9724 v8 = 8 * v4 + 400; | |
862 | 9725 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9726 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9727 return result; | |
0 | 9728 case VAR_BasePersonality: |
501 | 9729 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9730 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9731 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9732 v8 = 8 * v4 + 400; | |
862 | 9733 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9734 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9735 return result; | |
0 | 9736 case VAR_BaseEndurance: |
501 | 9737 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9738 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9739 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9740 v8 = 8 * v4 + 400; | |
862 | 9741 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9742 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9743 return result; | |
0 | 9744 case VAR_BaseSpeed: |
501 | 9745 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9746 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9747 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9748 v8 = 8 * v4 + 400; | |
862 | 9749 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9750 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9751 return result; | |
0 | 9752 case VAR_BaseAccuracy: |
501 | 9753 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9754 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9755 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9756 v8 = 8 * v4 + 400; | |
862 | 9757 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9758 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9759 return result; | |
0 | 9760 case VAR_BaseLuck: |
501 | 9761 this->uLuck -= (unsigned __int16)pValue; |
605 | 9762 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9763 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9764 v8 = 8 * v4 + 400; | |
862 | 9765 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9766 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9767 return result; | |
0 | 9768 case VAR_FireResistance: |
501 | 9769 this->sResFireBase -= (signed __int16)pValue; |
605 | 9770 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9771 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9772 v8 = 8 * v4 + 400; | |
862 | 9773 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9774 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9775 return result; | |
0 | 9776 case VAR_AirResistance: |
501 | 9777 this->sResAirBase -= (signed __int16)pValue; |
605 | 9778 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9779 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9780 v8 = 8 * v4 + 400; | |
862 | 9781 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9782 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9783 return result; | |
0 | 9784 case VAR_WaterResistance: |
501 | 9785 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9786 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9787 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9788 v8 = 8 * v4 + 400; | |
862 | 9789 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9790 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9791 return result; | |
0 | 9792 case VAR_EarthResistance: |
501 | 9793 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9794 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9795 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9796 v8 = 8 * v4 + 400; | |
862 | 9797 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9798 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9799 return result; | |
0 | 9800 case VAR_SpiritResistance: |
501 | 9801 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9802 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9803 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9804 v8 = 8 * v4 + 400; | |
862 | 9805 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9806 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9807 return result; | |
0 | 9808 case VAR_MindResistance: |
501 | 9809 this->sResMindBase -= (signed __int16)pValue; |
605 | 9810 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9811 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9812 v8 = 8 * v4 + 400; | |
862 | 9813 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9814 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9815 return result; | |
0 | 9816 case VAR_BodyResistance: |
501 | 9817 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9818 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9819 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9820 v8 = 8 * v4 + 400; | |
862 | 9821 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9822 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9823 return result; | |
0 | 9824 case VAR_LightResistance: |
501 | 9825 this->sResLightBase -= (signed __int16)pValue; |
605 | 9826 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9827 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9828 v8 = 8 * v4 + 400; | |
862 | 9829 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9830 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9831 return result; | |
0 | 9832 case VAR_DarkResistance: |
501 | 9833 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9834 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9835 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9836 v8 = 8 * v4 + 400; | |
862 | 9837 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9838 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9839 return result; | |
0 | 9840 case VAR_MagicResistance: |
501 | 9841 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9842 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9843 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9844 v8 = 8 * v4 + 400; | |
862 | 9845 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9846 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9847 return result; | |
0 | 9848 case VAR_FireResistanceBonus: |
501 | 9849 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9850 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9851 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9852 v8 = 8 * v4 + 400; | |
862 | 9853 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9854 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9855 return result; | |
0 | 9856 case VAR_AirResistanceBonus: |
501 | 9857 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9858 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9859 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9860 v8 = 8 * v4 + 400; | |
862 | 9861 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9862 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9863 return result; | |
0 | 9864 case VAR_WaterResistanceBonus: |
501 | 9865 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9866 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9867 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9868 v8 = 8 * v4 + 400; | |
862 | 9869 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9870 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9871 return result; | |
0 | 9872 case VAR_EarthResistanceBonus: |
501 | 9873 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9874 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9875 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9876 v8 = 8 * v4 + 400; | |
862 | 9877 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9878 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9879 return result; | |
0 | 9880 case VAR_SpiritResistanceBonus: |
501 | 9881 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9882 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9883 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9884 v8 = 8 * v4 + 400; | |
862 | 9885 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9886 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9887 return result; | |
0 | 9888 case VAR_MindResistanceBonus: |
501 | 9889 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9890 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9891 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9892 v8 = 8 * v4 + 400; | |
862 | 9893 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9894 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9895 return result; | |
0 | 9896 case VAR_BodyResistanceBonus: |
501 | 9897 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9898 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9899 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9900 v8 = 8 * v4 + 400; | |
862 | 9901 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9902 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9903 return result; | |
0 | 9904 case VAR_LightResistanceBonus: |
501 | 9905 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9906 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9907 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9908 v8 = 8 * v4 + 400; | |
862 | 9909 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9910 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9911 return result; | |
0 | 9912 case VAR_DarkResistanceBonus: |
501 | 9913 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9914 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9915 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9916 v8 = 8 * v4 + 400; | |
862 | 9917 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9918 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9919 return result; | |
0 | 9920 case VAR_MagicResistanceBonus: |
501 | 9921 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9922 v25 = 0; |
187 | 9923 v23 = SPEECH_91; |
9924 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9925 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9926 v8 = 8 * v4 + 400; | |
862 | 9927 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9928 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9929 return result; | |
0 | 9930 case VAR_FixedFood: |
501 | 9931 Party::TakeFood((unsigned int)pValue); |
605 | 9932 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9933 v8 = 8 * v4 + 400; | |
862 | 9934 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9935 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9936 return result; | |
0 | 9937 case VAR_StaffSkill: |
9938 case VAR_SwordSkill: | |
9939 case VAR_DaggerSkill: | |
9940 case VAR_AxeSkill: | |
9941 case VAR_SpearSkill: | |
9942 case VAR_BowSkill: | |
9943 case VAR_MaceSkill: | |
9944 case VAR_BlasterSkill: | |
9945 case VAR_ShieldSkill: | |
9946 case VAR_LeatherSkill: | |
9947 case VAR_SkillChain: | |
9948 case VAR_PlateSkill: | |
9949 case VAR_FireSkill: | |
9950 case VAR_AirSkill: | |
9951 case VAR_WaterSkill: | |
9952 case VAR_EarthSkill: | |
9953 case VAR_SpiritSkill: | |
9954 case VAR_MindSkill: | |
9955 case VAR_BodySkill: | |
9956 case VAR_LightSkill: | |
9957 case VAR_DarkSkill: | |
9958 case VAR_IdentifyItemSkill: | |
9959 case VAR_MerchantSkill: | |
9960 case VAR_RepairSkill: | |
9961 case VAR_BodybuildingSkill: | |
9962 case VAR_MeditationSkill: | |
9963 case VAR_PerceptionSkill: | |
9964 case VAR_DiplomacySkill: | |
9965 case VAR_DisarmTrapSkill: | |
9966 case VAR_LearningSkill: | |
501 | 9967 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9968 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9969 v8 = 8 * v4 + 400; | |
862 | 9970 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9971 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9972 return result; | |
0 | 9973 case VAR_Cursed: |
9974 case VAR_Weak: | |
9975 case VAR_Asleep: | |
9976 case VAR_Afraid: | |
9977 case VAR_Drunk: | |
9978 case VAR_Insane: | |
9979 case VAR_PoisonedGreen: | |
9980 case VAR_DiseasedGreen: | |
9981 case VAR_PoisonedYellow: | |
9982 case VAR_DiseasedYellow: | |
9983 case VAR_PoisonedRed: | |
9984 case VAR_DiseasedRed: | |
9985 case VAR_Paralyzed: | |
9986 case VAR_Unconsious: | |
9987 case VAR_Dead: | |
9988 case VAR_Stoned: | |
9989 case VAR_Eradicated: | |
501 | 9990 *((int *)this + 2 * VarNum - 210) = 0; |
9991 *((int *)this + 2 * result - 209) = 0; | |
0 | 9992 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9993 v8 = 8 * v4 + 400; | |
862 | 9994 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9995 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9996 return result; |
605 | 9997 default: |
9998 return result; | |
9999 } | |
10000 for (v3 = 1; v3 < 126; v3++) | |
10001 { | |
10002 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 10003 { |
605 | 10004 RemoveItemAtInventoryIndex(v3); |
501 | 10005 return true; |
0 | 10006 } |
605 | 10007 } |
501 | 10008 if ( pParty->pPickedItem.uItemID == pValue ) |
10009 { | |
605 | 10010 pMouse->RemoveHoldingItem(); |
10011 return true; | |
10012 } | |
10013 return false; | |
0 | 10014 } |
10015 } | |
10016 } | |
10017 // 5B65C4: using guessed type int dword_5B65C4; | |
10018 // 5B65CC: using guessed type int dword_5B65CC; |