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