Mercurial > mm7
annotate Player.cpp @ 998:e4383e6dfbef
ProcessInput
author | Ritor1 |
---|---|
date | Tue, 14 May 2013 17:37:24 +0600 |
parents | 087a9af8e0ec |
children | dcdfbb6eede9 |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
0 | 3 #include "OSAPI.h" |
4 #include "Player.h" | |
5 #include "PlayerFrameTable.h" | |
6 #include "Texture.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Party.h" | |
816 | 9 #include "Log.h" |
0 | 10 #include "LOD.h" |
11 #include "Monsters.h" | |
12 #include "GUIWindow.h" | |
13 #include "Viewport.h" | |
14 #include "Actor.h" | |
15 #include "Game.h" | |
16 #include "Mouse.h" | |
17 #include "TurnEngine.h" | |
18 #include "Events.h" | |
19 #include "Events2D.h" | |
20 #include "Outdoor.h" | |
21 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Awards.h" |
189 | 24 #include "texts.h" |
816 | 25 |
0 | 26 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
27 #include "MM7.h" |
0 | 28 |
29 | |
30 | |
31 | |
32 | |
33 | |
34 /* 381 */ | |
35 #pragma pack(push, 1) | |
290 | 36 struct PlayerCreation_AttributeProps |
0 | 37 { |
38 unsigned __int8 uBaseValue; | |
39 char uMaxValue; | |
40 char uDroppedStep; | |
41 char uBaseStep; | |
42 }; | |
43 #pragma pack(pop) | |
44 | |
45 | |
46 #pragma pack(push, 1) | |
290 | 47 |
48 | |
49 | |
0 | 50 #pragma pack(pop) |
290 | 51 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
52 { | |
53 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
54 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
55 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
56 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 57 }; |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 // available skills per class ( 9 classes X 37 skills ) | |
65 // 0 - not available | |
66 // 1 - available | |
67 // 2 - primary skill | |
68 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
69 { | |
70 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
71 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
72 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
73 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
74 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
75 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
76 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
77 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
78 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
79 }; | |
80 | |
81 | |
82 | |
83 | |
84 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
85 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
86 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
87 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
88 | |
89 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
90 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
91 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
93 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
94 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
96 | |
97 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
98 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
99 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
101 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
102 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
104 | |
105 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
106 | |
107 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
108 | |
94 | 109 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 110 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 111 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 112 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 113 |
114 | |
115 | |
816 | 116 unsigned short base_recovery_times_per_weapon_type[12] = |
117 { | |
118 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
119 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
120 60, // PLAYER_SKILL_DAGGER | |
121 100, // PLAYER_SKILL_AXE | |
122 80, // PLAYER_SKILL_SPEAR | |
123 100, // PLAYER_SKILL_BOW | |
124 80, // PLAYER_SKILL_MACE | |
125 30, // PLAYER_SKILL_BLASTER | |
126 10, // PLAYER_SKILL_SHIELD | |
127 10, // PLAYER_SKILL_LEATHER | |
128 20, // PLAYER_SKILL_CHAIN | |
129 30 // PLAYER_SKILL_PLATE | |
130 }; | |
131 | |
132 | |
0 | 133 |
134 //----- (00490913) -------------------------------------------------------- | |
135 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
136 { | |
137 signed int v0; // edi@1 | |
138 signed int v1; // esi@1 | |
139 int v2; // ebx@2 | |
140 int v3; // ecx@17 | |
141 signed int v4; // eax@17 | |
142 int v5; // edx@18 | |
143 signed int v6; // ecx@18 | |
144 signed int v8; // [sp+Ch] [bp-8h]@1 | |
145 signed int v9; // [sp+10h] [bp-4h]@2 | |
146 | |
147 v8 = 50; | |
148 v0 = 50; | |
149 v1 = 0; | |
150 do | |
151 { | |
152 v9 = 0; | |
153 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
154 do | |
155 { | |
156 if ( v9 ) | |
157 { | |
158 switch ( v9 ) | |
159 { | |
160 case 1: | |
161 v0 = pParty->pPlayers[v1].uIntelligence; | |
162 break; | |
163 case 2: | |
164 v0 = pParty->pPlayers[v1].uWillpower; | |
165 break; | |
166 case 3: | |
167 v0 = pParty->pPlayers[v1].uEndurance; | |
168 break; | |
169 case 4: | |
170 v0 = pParty->pPlayers[v1].uAccuracy; | |
171 break; | |
172 case 5: | |
173 v0 = pParty->pPlayers[v1].uSpeed; | |
174 break; | |
175 case 6: | |
176 v0 = pParty->pPlayers[v1].uLuck; | |
177 break; | |
178 } | |
179 } | |
180 else | |
181 { | |
182 v0 = pParty->pPlayers[v1].uMight; | |
183 } | |
184 v3 = v2 + v9; | |
290 | 185 v4 = StatTable[0][v3].uBaseValue; |
0 | 186 if ( v0 >= v4 ) |
187 { | |
290 | 188 v5 = StatTable[0][v3].uDroppedStep; |
189 v6 = StatTable[0][v3].uBaseStep; | |
0 | 190 } |
191 else | |
192 { | |
290 | 193 v5 = StatTable[0][v3].uBaseStep; |
194 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 195 } |
196 v8 += v5 * (v4 - v0) / v6; | |
197 ++v9; | |
198 } | |
199 while ( v9 <= 6 ); | |
200 ++v1; | |
201 } | |
202 while ( v1 < 4 ); | |
203 return v8; | |
204 } | |
205 | |
206 | |
207 | |
208 //----- (00427730) -------------------------------------------------------- | |
209 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
210 { | |
488 | 211 if (sMana >= uRequiredMana) |
212 { | |
213 sMana -= uRequiredMana; | |
214 return true; | |
215 } | |
216 | |
217 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
218 return false; | |
0 | 219 } |
220 | |
221 | |
222 //----- (004BE2DD) -------------------------------------------------------- | |
886 | 223 void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx) |
0 | 224 { |
225 Player *v4; // edi@1 | |
226 char *v5; // esi@1 | |
227 float v6; // ST04_4@1 | |
228 signed int v7; // eax@1 | |
229 signed int v8; // ebx@1 | |
230 | |
231 auto a4 = _2devent_idx; | |
232 v4 = this; | |
233 v5 = (char *)this + 36 * a3; | |
234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
235 //v6 = p2DEvents_minus1__20[13 * a4]; | |
236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
917 | 237 v8 = GetPriceSell(v7, v6); |
0 | 238 if ( v5[552] & 2 ) |
239 v8 = 1; | |
240 if ( v8 < 1 ) | |
241 v8 = 1; | |
242 RemoveItemAtInventoryIndex(a2); | |
243 Party::SetGold(pParty->uNumGold + v8); | |
244 } | |
245 | |
246 | |
247 | |
248 //----- (0043EEF3) -------------------------------------------------------- | |
249 bool Player::_43EEF3() | |
250 { | |
251 signed int v1; // esi@1 | |
252 PlayerEquipment *v2; // edx@1 | |
253 bool result; // eax@2 | |
254 | |
255 v1 = 0; | |
256 v2 = &this->pEquipment; | |
257 while ( 1 ) | |
258 { | |
898 | 259 result = v2->uShield; |
260 if ( v2->uShield ) | |
0 | 261 { |
232 | 262 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 263 if ( result ) |
264 { | |
265 if ( result != 64 && result != 65 ) | |
266 break; | |
267 } | |
268 } | |
269 ++v1; | |
270 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
271 if ( v1 >= 16 ) | |
272 { | |
273 LOBYTE(result) = 1; | |
274 return result; | |
275 } | |
276 } | |
277 LOBYTE(result) = 0; | |
278 return result; | |
279 } | |
280 | |
281 | |
282 | |
283 //----- (004B8040) -------------------------------------------------------- | |
284 int Player::_4B8040_condition_time(unsigned int uCondition) | |
285 { | |
286 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
287 } | |
288 | |
289 //----- (004B807C) -------------------------------------------------------- | |
290 int Player::_4B807C(float a2) | |
291 { | |
292 Player *v2; // edi@1 | |
293 unsigned int v3; // eax@1 | |
294 int v4; // esi@1 | |
295 unsigned int v5; // ebx@7 | |
296 int v6; // eax@8 | |
297 signed __int64 v7; // qax@13 | |
298 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
299 signed int v10; // [sp+8h] [bp-8h]@4 | |
300 int v11; // [sp+Ch] [bp-4h]@6 | |
301 | |
302 v2 = this; | |
303 v3 = GetMajorConditionIdx(); | |
304 v4 = 0; | |
305 if ( (signed int)v3 >= 14 ) | |
306 { | |
307 if ( (signed int)v3 <= 15 ) | |
308 { | |
309 v10 = 5; | |
310 v9 = v3; | |
311 goto LABEL_6; | |
312 } | |
313 if ( v3 == 16 ) | |
314 { | |
315 v10 = 10; | |
316 v9 = 16; | |
317 LABEL_6: | |
318 v11 = _4B8040_condition_time(v9); | |
319 goto LABEL_13; | |
320 } | |
321 } | |
322 v10 = 1; | |
323 v5 = 0; | |
324 do | |
325 { | |
326 v6 = _4B8040_condition_time(v5); | |
327 if ( v6 > v4 ) | |
328 v4 = v6; | |
329 ++v5; | |
330 } | |
331 while ( (signed int)v5 <= 13 ); | |
332 v11 = v4; | |
333 if ( !v4 ) | |
334 v11 = 1; | |
335 LABEL_13: | |
336 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
337 if ( (signed int)v7 < 1 ) | |
338 LODWORD(v7) = 1; | |
339 return v7; | |
340 } | |
341 | |
342 //----- (004B8102) -------------------------------------------------------- | |
917 | 343 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 344 { |
345 signed int v3; // esi@1 | |
346 signed int result; // eax@3 | |
347 | |
917 | 348 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
349 if ( v3 > uRealValue ) | |
350 v3 = uRealValue; | |
0 | 351 result = 1; |
352 if ( v3 >= 1 ) | |
353 result = v3; | |
354 return result; | |
355 } | |
356 | |
357 //----- (004B8142) -------------------------------------------------------- | |
749 | 358 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
359 { | |
360 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
361 assert (price > 0); | |
362 | |
363 if (price < uRealValue) | |
364 price = uRealValue; | |
365 return price; | |
0 | 366 } |
367 | |
368 //----- (004B8179) -------------------------------------------------------- | |
916 | 369 int Player::GetPriceIdentification(float a2) |
0 | 370 { |
371 signed int v2; // esi@1 | |
372 int v3; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v2 = (signed __int64)(a2 * 50.0); | |
376 v3 = v2 * (100 - GetMerchant()) / 100; | |
377 if ( v3 < v2 / 3 ) | |
378 v3 = v2 / 3; | |
379 result = 1; | |
380 if ( v3 >= 1 ) | |
381 result = v3; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B81C3) -------------------------------------------------------- | |
916 | 386 int Player::GetPriceRepair(int a2, float a3) |
0 | 387 { |
388 signed int v3; // esi@1 | |
389 int v4; // ecx@1 | |
390 signed int result; // eax@3 | |
391 | |
392 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
393 v4 = v3 * (100 - GetMerchant()) / 100; | |
394 if ( v4 < v3 / 3 ) | |
395 v4 = v3 / 3; | |
396 result = 1; | |
397 if ( v4 >= 1 ) | |
398 result = v4; | |
399 return result; | |
400 } | |
401 | |
402 //----- (004B8213) -------------------------------------------------------- | |
403 int Player::_4B8213(int a2, float a3) | |
404 { | |
405 signed __int64 v3; // qax@1 | |
406 | |
407 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
408 if ( (signed int)v3 < 1 ) | |
409 LODWORD(v3) = 1; | |
410 return v3; | |
411 } | |
412 | |
413 //----- (004B8233) -------------------------------------------------------- | |
414 int Player::_4B8233(int a2, float a3) | |
415 { | |
416 signed __int64 v3; // qax@1 | |
417 | |
418 v3 = (signed __int64)((double)a2 * a3); | |
419 if ( (signed int)v3 < 1 ) | |
420 LODWORD(v3) = 1; | |
421 return v3; | |
422 } | |
423 | |
424 //----- (004B824B) -------------------------------------------------------- | |
425 int Player::_4B824B(float a2) | |
426 { | |
427 signed __int64 v2; // qax@1 | |
428 | |
429 v2 = (signed __int64)(a2 * 50.0); | |
430 if ( (signed int)v2 < 1 ) | |
431 LODWORD(v2) = 1; | |
432 return v2; | |
433 } | |
434 | |
435 //----- (004B8265) -------------------------------------------------------- | |
436 int Player::_4B8265(int a2, float a3) | |
437 { | |
438 signed __int64 v3; // qax@1 | |
439 | |
440 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
441 if ( (signed int)v3 < 1 ) | |
442 LODWORD(v3) = 1; | |
443 return v3; | |
444 } | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 //----- (004B6FF9) -------------------------------------------------------- | |
451 int Player::_4B6FF9() | |
452 { | |
453 Player *v1; // esi@1 | |
454 signed int v2; // eax@1 | |
455 char v3; // zf@4 | |
456 | |
457 v1 = this; | |
336 | 458 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 459 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
460 { | |
461 if ( GetMajorConditionIdx() == 18 ) | |
462 goto LABEL_6; | |
463 v3 = GetMajorConditionIdx() == 17; | |
464 } | |
465 else | |
466 { | |
467 v3 = GetMajorConditionIdx() == 18; | |
468 } | |
469 if ( !v3 ) | |
470 return 1; | |
471 LABEL_6: | |
472 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
473 return 1; | |
474 return 0; | |
475 } | |
476 | |
477 | |
478 | |
479 //----- (00421E75) -------------------------------------------------------- | |
480 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
481 { | |
482 int v2; // eax@1 | |
483 unsigned int result; // eax@3 | |
484 | |
485 v2 = *a2; | |
486 if ( *a2 >= 126 || v2 < 0 ) | |
487 { | |
488 result = 0; | |
489 } | |
490 else | |
491 { | |
492 result = this->pInventoryIndices[v2]; | |
493 if ( (result & 0x80000000u) != 0 ) | |
494 { | |
495 *a2 = -1 - result; | |
496 result = this->pInventoryIndices[-1 - result]; | |
497 } | |
498 } | |
499 return result; | |
500 } | |
501 | |
502 | |
503 | |
504 //----- (004160CA) -------------------------------------------------------- | |
505 char Player::_4160CA(int a2) | |
506 { | |
507 Player *v2; // esi@1 | |
508 signed int v3; // edx@1 | |
509 signed int v4; // ebx@1 | |
510 ItemGen *v5; // eax@1 | |
511 int v6; // edi@2 | |
512 signed int i; // edx@8 | |
513 ItemGen **v8; // ecx@9 | |
514 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
515 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
516 int v12; // [sp+120h] [bp-4h]@1 | |
517 | |
518 auto a1 = this; | |
519 | |
520 v12 = a2; | |
521 v2 = a1; | |
522 v3 = 0; | |
523 v10[0] = 0; | |
524 v4 = 0; | |
525 memset(&v10[1], 0, 0x110u); | |
526 v11 = 0; | |
527 v5 = a1->pInventoryItems; | |
528 do | |
529 { | |
530 v6 = 0; | |
531 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
532 v10[v4++] = v3; | |
533 ++v3; | |
534 ++v5; | |
535 } | |
536 while ( v3 < 138 ); | |
537 if ( v4 ) | |
538 { | |
539 if ( v12 ) | |
540 { | |
541 if ( v12 > 0 ) | |
542 { | |
543 do | |
544 { | |
545 LOWORD(v5) = 9 * v10[v6]; | |
546 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
547 { | |
548 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
549 v5->uItemID |= 2u; | |
550 } | |
551 ++v6; | |
552 } | |
553 while ( v6 < v12 ); | |
554 } | |
555 } | |
556 else | |
557 { | |
558 for ( i = 0; i < v4; ++i ) | |
559 { | |
560 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
561 v5 = *v8; | |
562 if ( !(BYTE1(v5) & 2) ) | |
563 { | |
564 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
565 *v8 = v5; | |
566 } | |
567 } | |
568 } | |
569 } | |
570 return (char)v5; | |
571 } | |
572 | |
573 //----- (004948B1) -------------------------------------------------------- | |
187 | 574 void Player::PlaySound(PlayerSpeech speech, int a3) |
575 { | |
576 //Player *pPlayer; // edi@1 | |
577 //int v4; // eax@4 | |
0 | 578 signed int v5; // esi@4 |
203 | 579 unsigned char *v6; // ebx@4 |
0 | 580 signed int v7; // ecx@5 |
581 unsigned __int8 v8; // al@6 | |
582 int v9; // eax@10 | |
187 | 583 //unsigned int pVoiceID; // ecx@10 |
0 | 584 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
585 //signed int v12; // eax@11 |
0 | 586 signed int v13; // esi@12 |
587 int v14; // eax@12 | |
187 | 588 //int v15; // eax@17 |
248 | 589 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 590 signed int v17; // ecx@19 |
591 char *pSoundID; // edi@20 | |
592 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 593 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 594 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
595 int pSoundId; // [sp+30h] [bp+8h]@4 | |
596 | |
187 | 597 //pPlayer = this; |
598 //pPlayer2 = this; | |
599 | |
0 | 600 pPlayerNum = 1; |
187 | 601 for (int i = 0; i < 4; ++i) |
602 if (&pParty->pPlayers[i] == this) | |
603 { | |
604 pPlayerNum = i + 1; | |
0 | 605 break; |
187 | 606 } |
607 | |
608 //v4 = a2;//102 | |
0 | 609 v5 = 0; |
610 pSoundId = 0; | |
203 | 611 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
612 if (uVoicesVolumeMultiplier) | |
0 | 613 { |
614 v7 = 0; | |
615 do | |
616 { | |
617 v8 = v6[v7]; | |
618 if ( v8 ) | |
619 v20[v5++] = v8; | |
620 ++v7; | |
621 } | |
622 while ( v7 < 2 ); | |
623 if ( v5 ) | |
624 { | |
625 v9 = rand(); | |
187 | 626 //pVoiceID = uVoiceID; |
0 | 627 v11 = v20[v9 % v5]; |
203 | 628 |
629 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
630 { | |
631 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
632 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 633 } |
634 } | |
635 } | |
203 | 636 |
0 | 637 v13 = 0; |
638 v14 = (int)(v6 + 3); | |
639 do | |
640 { | |
641 if ( *(char *)v14 ) | |
642 v20[v13++] = *(char *)v14; | |
643 ++v14; | |
644 } | |
645 while ( -3 - (signed int)v6 + v14 < 5 ); | |
646 if ( v13 ) | |
647 { | |
648 pPlayerNum = 0; | |
248 | 649 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
650 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 651 { |
652 v17 = 0; | |
764 | 653 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 654 { |
655 LABEL_23: | |
656 v17 = 0; | |
657 } | |
658 else | |
659 { | |
660 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
661 while ( *(int *)pSoundID != pSoundId ) | |
662 { | |
663 ++v17; | |
664 pSoundID += 120; | |
764 | 665 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 666 goto LABEL_23; |
667 } | |
668 } | |
669 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
670 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
671 } | |
248 | 672 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 673 } |
674 //return v14; | |
0 | 675 } |
676 // 4948B1: using guessed type int var_1C[5]; | |
677 | |
678 //----- (00494A25) -------------------------------------------------------- | |
187 | 679 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
680 { | |
681 //signed int v3; // eax@1 | |
682 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 683 signed int v5; // edi@15 |
684 PlayerFrame *v6; // esi@17 | |
685 signed int v7; // eax@20 | |
686 | |
187 | 687 //LOWORD(v3) = this->expression; |
688 //v4 = expr; | |
689 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
690 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
691 { | |
692 int v3 = (unsigned)expression; | |
0 | 693 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
694 { | |
695 if ( v3 <= 7 ) | |
696 goto LABEL_12; | |
697 if ( v3 > 8 ) | |
698 { | |
699 if ( v3 > 11 ) | |
700 { | |
187 | 701 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
702 return; | |
0 | 703 goto LABEL_15; |
704 } | |
705 LABEL_12: | |
187 | 706 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
707 return; | |
0 | 708 goto LABEL_15; |
709 } | |
710 } | |
711 } | |
712 LABEL_15: | |
187 | 713 //LOWORD(v3) = a3; |
0 | 714 v5 = 0; |
715 this->uExpressionTimeLength = a3; | |
716 this->uExpressionTimePassed = 0; | |
717 if ( !a3 ) | |
718 { | |
719 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
720 { | |
721 LABEL_20: | |
722 v7 = 0; | |
723 } | |
724 else | |
725 { | |
726 v6 = pPlayerFrameTable->pFrames; | |
187 | 727 while ( v6->expression != new_expression ) |
0 | 728 { |
729 ++v5; | |
730 ++v6; | |
731 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
732 goto LABEL_20; | |
733 } | |
734 v7 = v5; | |
735 } | |
187 | 736 //v4 = expr; |
737 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
738 } | |
739 expression = new_expression; | |
0 | 740 viewparams->bRedrawGameUI = 1; |
741 } | |
742 | |
743 //----- (0049327B) -------------------------------------------------------- | |
744 int Player::_49327B(unsigned int uClass, int a3) | |
745 { | |
746 Player *v3; // esi@1 | |
747 char v4; // zf@4 | |
748 __int16 v5; // dx@9 | |
749 signed int result; // eax@84 | |
750 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
751 int v8; // [sp-4h] [bp-Ch]@3 | |
752 | |
753 v3 = this; | |
135 | 754 if ( this->classType == uClass ) |
0 | 755 { |
756 LABEL_84: | |
757 result = 1; | |
758 } | |
759 else | |
760 { | |
761 switch ( uClass ) | |
762 { | |
763 case 0u: | |
764 v8 = a3; | |
765 v7 = 1; | |
766 goto LABEL_4; | |
767 case 1u: | |
484 | 768 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 769 || _49327B(2u, a3) ) |
770 goto LABEL_84; | |
771 v8 = a3; | |
772 v7 = 3; | |
773 goto LABEL_4; | |
774 case 2u: | |
775 v5 = 19; | |
776 goto LABEL_82; | |
777 case 3u: | |
778 v5 = 21; | |
779 goto LABEL_82; | |
780 case 4u: | |
781 v8 = a3; | |
782 v7 = 5; | |
783 goto LABEL_4; | |
784 case 5u: | |
484 | 785 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 786 || _49327B(6u, a3) ) |
787 goto LABEL_84; | |
788 v8 = a3; | |
789 v7 = 7; | |
790 goto LABEL_4; | |
791 case 6u: | |
792 if ( !a3 ) | |
793 break; | |
794 v5 = 13; | |
795 goto LABEL_82; | |
796 case 7u: | |
797 if ( !a3 ) | |
798 break; | |
799 v5 = 15; | |
800 goto LABEL_82; | |
801 case 8u: | |
802 v8 = a3; | |
803 v7 = 9; | |
804 goto LABEL_4; | |
805 case 9u: | |
484 | 806 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 807 || _49327B(0xAu, a3) ) |
808 goto LABEL_84; | |
809 v8 = a3; | |
810 v7 = 11; | |
811 goto LABEL_4; | |
812 case 0xAu: | |
813 if ( !a3 ) | |
814 break; | |
815 v5 = 25; | |
816 goto LABEL_82; | |
817 case 0xBu: | |
818 if ( !a3 ) | |
819 break; | |
820 v5 = 27; | |
821 goto LABEL_82; | |
822 case 0xCu: | |
823 v8 = a3; | |
824 v7 = 13; | |
825 goto LABEL_4; | |
826 case 0xDu: | |
484 | 827 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 828 || _49327B(0xEu, a3) ) |
829 goto LABEL_84; | |
830 v8 = a3; | |
831 v7 = 15; | |
832 goto LABEL_4; | |
833 case 0xEu: | |
834 if ( !a3 ) | |
835 break; | |
836 v5 = 43; | |
837 goto LABEL_82; | |
838 case 0xFu: | |
839 if ( !a3 ) | |
840 break; | |
841 v5 = 45; | |
842 goto LABEL_82; | |
843 case 0x10u: | |
844 v8 = a3; | |
845 v7 = 17; | |
846 goto LABEL_4; | |
847 case 0x11u: | |
484 | 848 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 849 || _49327B(0x12u, a3) ) |
850 goto LABEL_84; | |
851 v8 = a3; | |
852 v7 = 19; | |
853 goto LABEL_4; | |
854 case 0x12u: | |
855 if ( !a3 ) | |
856 break; | |
857 v5 = 37; | |
858 goto LABEL_82; | |
859 case 0x13u: | |
860 v5 = 39; | |
861 goto LABEL_82; | |
862 case 0x14u: | |
863 v8 = a3; | |
864 v7 = 21; | |
865 goto LABEL_4; | |
866 case 0x15u: | |
484 | 867 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 868 || _49327B(0x16u, a3) ) |
869 goto LABEL_84; | |
870 v8 = a3; | |
871 v7 = 23; | |
872 goto LABEL_4; | |
873 case 0x16u: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 31; | |
877 goto LABEL_82; | |
878 case 0x17u: | |
879 if ( !a3 ) | |
880 break; | |
881 v5 = 33; | |
882 goto LABEL_82; | |
883 case 0x18u: | |
884 if ( !_49327B(0x19u, a3) ) | |
885 goto LABEL_56; | |
886 break; | |
887 case 0x19u: | |
888 LABEL_56: | |
484 | 889 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 890 || _49327B(0x1Au, a3) ) |
891 goto LABEL_84; | |
892 v8 = a3; | |
893 v7 = 27; | |
894 goto LABEL_4; | |
895 case 0x1Au: | |
896 if ( !a3 ) | |
897 break; | |
898 v5 = 65; | |
899 goto LABEL_82; | |
900 case 0x1Bu: | |
901 if ( !a3 ) | |
902 break; | |
903 v5 = 67; | |
904 goto LABEL_82; | |
905 case 0x1Cu: | |
906 v8 = a3; | |
907 v7 = 29; | |
908 goto LABEL_4; | |
909 case 0x1Du: | |
484 | 910 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 911 || _49327B(0x1Eu, a3) ) |
912 goto LABEL_84; | |
913 v8 = a3; | |
914 v7 = 31; | |
915 goto LABEL_4; | |
916 case 0x1Eu: | |
917 if ( !a3 ) | |
918 break; | |
919 v5 = 71; | |
920 goto LABEL_82; | |
921 case 0x1Fu: | |
922 if ( !a3 ) | |
923 break; | |
924 v5 = 73; | |
925 goto LABEL_82; | |
926 case 0x20u: | |
927 v8 = a3; | |
928 v7 = 33; | |
929 goto LABEL_4; | |
930 case 0x21u: | |
484 | 931 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 932 || _49327B(0x22u, a3) ) |
933 goto LABEL_84; | |
934 v8 = a3; | |
935 v7 = 35; | |
936 LABEL_4: | |
937 v4 = _49327B(v7, v8) == 0; | |
938 goto LABEL_83; | |
939 case 0x22u: | |
940 if ( !a3 ) | |
941 break; | |
942 v5 = 77; | |
943 goto LABEL_82; | |
944 case 0x23u: | |
945 if ( a3 ) | |
946 { | |
947 v5 = 79; | |
948 LABEL_82: | |
484 | 949 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 950 LABEL_83: |
951 if ( !v4 ) | |
952 goto LABEL_84; | |
953 } | |
954 break; | |
955 default: | |
956 break; | |
957 } | |
958 result = 0; | |
959 } | |
960 return result; | |
961 } | |
962 | |
963 | |
964 //----- (00492C0B) -------------------------------------------------------- | |
965 bool Player::CanAct() | |
966 { | |
967 bool result; // eax@2 | |
968 | |
969 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
970 result = 0; | |
971 else | |
972 result = 1; | |
973 return result; | |
974 } | |
975 | |
976 //----- (00492C40) -------------------------------------------------------- | |
977 bool Player::CanSteal() | |
978 { | |
979 int v1; // eax@1 | |
980 | |
981 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
982 return v1 != 0; | |
983 } | |
984 | |
985 //----- (00492C4E) -------------------------------------------------------- | |
986 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
987 { | |
988 char v2; // zf@9 | |
989 __int16 v4; // dx@13 | |
990 char v5; // zf@15 | |
991 | |
992 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
993 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
994 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
995 { | |
996 if ( uItemID == 533 ) | |
997 { | |
998 v2 = GetRace() == 1; | |
999 } | |
1000 else | |
1001 { | |
1002 if ( uItemID != 534 ) | |
1003 { | |
1004 if ( uItemID == 535 ) // | |
1005 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
1006 { | |
1007 switch ( this->uVoiceID ) | |
1008 { | |
1009 default: | |
1010 return 1; | |
1011 case 4u: | |
1012 case 5u: | |
1013 case 6u: | |
1014 case 7u: | |
1015 case 0xAu: | |
1016 case 0xBu: | |
1017 case 0xEu: // | |
1018 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
1019 case 0xFu: | |
1020 case 0x12u: | |
1021 case 0x13u: | |
1022 case 0x15u: | |
1023 case 0x18u: | |
1024 return 0; | |
1025 } | |
1026 return 0; | |
1027 } | |
1028 if ( uItemID == 536 ) // | |
1029 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
1030 { | |
1031 switch ( this->uVoiceID ) | |
1032 { | |
1033 case 4u: | |
1034 case 5u: | |
1035 case 6u: | |
1036 case 7u: | |
1037 case 0xAu: | |
1038 case 0xBu: | |
1039 case 0xEu: | |
1040 case 0xFu: | |
1041 case 0x12u: | |
1042 case 0x13u: | |
1043 case 0x15u: | |
1044 case 0x18u: | |
1045 return 1; | |
1046 default: | |
1047 return 0; | |
1048 } | |
1049 return 0; | |
1050 } | |
1051 if ( uItemID != 604 ) // | |
1052 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1053 return 1; | |
1054 v5 = _43EEF3() == 0; | |
1055 goto LABEL_23; | |
1056 } | |
1057 v2 = GetRace() == 3; // | |
1058 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1059 } | |
1060 } | |
1061 else | |
1062 { | |
1063 if ( uItemID != 532 ) | |
1064 { | |
1065 if ( uItemID != 515 && uItemID != 517 ) // | |
1066 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1067 { | |
1068 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1069 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1070 { | |
1071 LABEL_13: | |
1072 v4 = 99; | |
1073 LABEL_15: | |
484 | 1074 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1075 LABEL_23: |
1076 if ( !v5 ) | |
1077 return 1; | |
1078 return 0; | |
1079 } | |
1080 if ( uItemID != 525 ) | |
1081 { | |
1082 if ( uItemID != 527 ) | |
1083 { | |
1084 if ( uItemID != 531 ) | |
1085 return 1; | |
1086 v2 = GetRace() == 2; | |
1087 goto LABEL_10; | |
1088 } | |
1089 goto LABEL_13; | |
1090 } | |
1091 } | |
1092 v4 = 100; | |
1093 goto LABEL_15; | |
1094 } | |
1095 v2 = GetRace() == 0; | |
1096 } | |
1097 LABEL_10: | |
1098 if ( v2 ) | |
1099 return 1; | |
1100 return 0; | |
1101 } | |
1102 | |
1103 //----- (00492D65) -------------------------------------------------------- | |
1104 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1105 { | |
1106 Player *v3; // esi@1 | |
1107 Player **v4; // ebx@2 | |
1108 Player *v5; // ecx@21 | |
1109 Player *v6; // ecx@22 | |
1110 Player *v7; // ecx@29 | |
1111 Player *v8; // ecx@30 | |
1112 Player *v9; // ecx@37 | |
1113 Player *v10; // ecx@38 | |
1114 Player *v11; // ecx@45 | |
1115 Player *v12; // ecx@46 | |
1116 char *v13; // eax@49 | |
1117 Player *v14; // ecx@58 | |
1118 Player *v15; // ecx@59 | |
1119 Player *v16; // ecx@60 | |
1120 signed int result; // eax@76 | |
1121 signed int v18; // ecx@77 | |
1122 int v19; // eax@77 | |
1123 char v20; // al@80 | |
1124 signed int v21; // ebx@82 | |
1125 signed int v22; // esi@82 | |
1126 int v23; // [sp-8h] [bp-1Ch]@7 | |
1127 int v24; // [sp-8h] [bp-1Ch]@15 | |
1128 int v25; // [sp-8h] [bp-1Ch]@53 | |
1129 int v26; // [sp-4h] [bp-18h]@7 | |
1130 signed int v27; // [sp-4h] [bp-18h]@15 | |
1131 int v28; // [sp-4h] [bp-18h]@53 | |
1132 char *v29; // [sp+Ch] [bp-8h]@1 | |
1133 int v30; // [sp+10h] [bp-4h]@2 | |
1134 int v31; // [sp+20h] [bp+Ch]@82 | |
1135 | |
1136 v3 = this; | |
1137 v29 = (char *)this + 8 * uConditionIdx; | |
1138 if ( *(_QWORD *)v29 ) | |
1139 { | |
1140 LABEL_76: | |
1141 result = 0; | |
1142 } | |
1143 else | |
1144 { | |
1145 v4 = &pPlayers[1]; | |
1146 v30 = 0; | |
1147 do | |
1148 { | |
1149 if ( (*v4)->CanAct() ) | |
1150 ++v30; | |
1151 ++v4; | |
1152 } | |
1153 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1154 switch ( uConditionIdx ) | |
1155 { | |
1156 case 0u: | |
1157 v26 = 0; | |
1158 v23 = 30; | |
1159 goto LABEL_81; | |
1160 case 1u: | |
1161 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1162 goto LABEL_10; | |
1163 v26 = 0; | |
1164 v23 = 25; | |
1165 goto LABEL_81; | |
1166 case 2u: | |
1167 if ( a3 != 1 ) | |
1168 goto LABEL_82; | |
1169 if ( v3->HasEnchantedItemEquipped(22) ) | |
1170 goto LABEL_76; | |
1171 v27 = 3; | |
1172 v24 = 505; | |
1173 goto LABEL_16; | |
1174 case 3u: | |
1175 v26 = 0; | |
1176 v23 = 26; | |
1177 goto LABEL_81; | |
1178 case 4u: | |
1179 v26 = 0; | |
1180 v23 = 31; | |
1181 goto LABEL_81; | |
1182 case 5u: | |
1183 if ( a3 == 1 | |
1184 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1185 goto LABEL_76; | |
1186 v26 = 0; | |
1187 v23 = 29; | |
1188 goto LABEL_81; | |
1189 case 6u: | |
1190 case 8u: | |
1191 case 0xAu: | |
1192 if ( a3 == 1 ) | |
1193 { | |
1194 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1195 { | |
1196 --pParty->pPartyBuffs[13].uPower; | |
1197 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1198 pParty->pPartyBuffs[13].Reset(); | |
1199 } | |
1200 if ( v3->HasEnchantedItemEquipped(21) | |
1201 || v7->WearsItem(505, 3) | |
1202 || v8->WearsItem(530, 6) ) | |
1203 goto LABEL_76; | |
1204 } | |
1205 v26 = 0; | |
1206 v23 = 27; | |
1207 goto LABEL_81; | |
1208 case 7u: | |
1209 case 9u: | |
1210 case 0xBu: | |
1211 if ( a3 != 1 ) | |
1212 goto LABEL_40; | |
1213 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1214 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1215 goto LABEL_10; | |
900 | 1216 if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) ) |
0 | 1217 goto LABEL_76; |
1218 LABEL_40: | |
1219 v26 = 0; | |
1220 v23 = 28; | |
1221 goto LABEL_81; | |
1222 case 0xCu: | |
1223 if ( a3 != 1 ) | |
1224 goto LABEL_82; | |
1225 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1226 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1227 goto LABEL_10; | |
1228 if ( v3->HasEnchantedItemEquipped(20) | |
1229 || v11->WearsItem(505, 3) | |
1230 || v12->WearsItem(507, 16) ) | |
1231 goto LABEL_76; | |
1232 v27 = 6; | |
1233 v24 = 530; | |
1234 LABEL_16: | |
1235 if ( v3->WearsItem(v24, v27) ) | |
1236 goto LABEL_76; | |
1237 goto LABEL_82; | |
1238 case 0xDu: | |
187 | 1239 v3->PlaySound(SPEECH_32, 0); |
0 | 1240 v13 = (char *)&v3->sHealth; |
1241 goto LABEL_70; | |
1242 case 0xEu: | |
1243 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1244 goto LABEL_10; | |
1245 v28 = 0; | |
1246 v25 = 33; | |
1247 goto LABEL_67; | |
1248 case 0xFu: | |
1249 if ( a3 == 1 | |
1250 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1252 || v3->HasEnchantedItemEquipped(23) | |
1253 || v14->WearsItem(520, 16) | |
1254 || v15->WearsItem(505, 3) | |
1255 || v16->WearsItem(530, 6)) ) | |
1256 goto LABEL_76; | |
1257 v26 = 0; | |
1258 v23 = 34; | |
1259 goto LABEL_81; | |
1260 case 0x10u: | |
1261 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1262 { | |
1263 LABEL_10: | |
1264 --pParty->pPartyBuffs[13].uPower; | |
1265 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1266 pParty->pPartyBuffs[13].Reset(); | |
1267 goto LABEL_76; | |
1268 } | |
1269 v28 = 0; | |
187 | 1270 v25 = SPEECH_35; |
0 | 1271 LABEL_67: |
187 | 1272 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1273 if ( v3->sHealth > 0 ) |
1274 v3->sHealth = 0; | |
1275 v13 = (char *)&v3->sMana; | |
1276 LABEL_70: | |
1277 if ( *(int *)v13 > 0 ) | |
1278 *(int *)v13 = 0; | |
1279 LABEL_82: | |
1280 v21 = 0; | |
1281 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1282 v31 = 0; | |
1283 v22 = 1; | |
1284 do | |
1285 { | |
1286 if ( pPlayers[v22]->CanAct() ) | |
1287 { | |
1288 ++v31; | |
1289 v21 = v22; | |
1290 } | |
1291 ++v22; | |
1292 } | |
1293 while ( v22 <= 4 ); | |
1294 if ( v30 == 2 ) | |
1295 { | |
1296 if ( v31 == 1 ) | |
187 | 1297 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1298 } |
1299 result = 1; | |
1300 break; | |
1301 case 0x11u: | |
135 | 1302 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1303 v3->Zombie() || !v3->Dead()) | |
0 | 1304 goto LABEL_76; |
1305 memset(v3, 0, 0xA0u); | |
1306 v3->sHealth = v3->GetMaxHealth(); | |
1307 v18 = 0; | |
1308 v3->field_1928 = v3->uFace; | |
1309 v19 = v3->uVoiceID; | |
1310 v3->sMana = 0; | |
1311 v3->field_1924 = v19; | |
1312 switch ( v19 ) | |
1313 { | |
1314 case 0: | |
1315 case 1: | |
1316 case 2: | |
1317 case 3: | |
1318 case 8: | |
1319 case 9: | |
1320 case 12: | |
1321 case 13: | |
1322 case 16: | |
1323 case 17: | |
1324 case 20: | |
1325 case 23: | |
1326 v18 = 0; | |
1327 break; | |
1328 case 4: | |
1329 case 5: | |
1330 case 6: | |
1331 case 7: | |
1332 case 10: | |
1333 case 11: | |
1334 case 14: | |
1335 case 15: | |
1336 case 18: | |
1337 case 19: | |
1338 case 21: | |
1339 case 24: | |
1340 v18 = 1; | |
1341 break; | |
1342 default: | |
1343 break; | |
1344 } | |
1345 v26 = 0; | |
1346 v20 = (v18 != 0) + 23; | |
187 | 1347 v23 = SPEECH_99; |
0 | 1348 v3->uFace = v20; |
1349 v3->uVoiceID = v20; | |
1350 LABEL_81: | |
187 | 1351 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1352 goto LABEL_82; |
1353 default: | |
1354 goto LABEL_82; | |
1355 } | |
1356 } | |
1357 return result; | |
1358 } | |
1359 | |
1360 //----- (00492528) -------------------------------------------------------- | |
1361 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1362 { | |
973 | 1363 //unsigned int v3; // eax@1 |
0 | 1364 Texture *v4; // esi@1 |
1365 unsigned int v5; // ebx@1 | |
1366 signed int v6; // edi@5 | |
1367 int *v7; // ecx@6 | |
1368 signed int v8; // edx@7 | |
1369 int *v9; // eax@8 | |
973 | 1370 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1371 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1372 | |
973 | 1373 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1374 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1375 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1376 if ( !areWeLoadingTexture ) | |
1377 { | |
1378 v4->Release(); | |
1379 pIcons_LOD->_40F9C5(); | |
1380 } | |
1381 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1382 { | |
1383 v6 = 0; | |
1384 if ( (signed int)uItemIDa <= 0 ) | |
1385 return 1; | |
973 | 1386 v7 = &pInventoryIndices[uSlot]; |
0 | 1387 while ( 1 ) |
1388 { | |
1389 v8 = 0; | |
1390 if ( (signed int)v5 > 0 ) | |
1391 break; | |
1392 LABEL_11: | |
1393 ++v6; | |
1394 v7 += 14; | |
1395 if ( v6 >= (signed int)uItemIDa ) | |
1396 return 1; | |
1397 } | |
1398 v9 = v7; | |
1399 while ( !*v9 ) | |
1400 { | |
1401 ++v8; | |
1402 ++v9; | |
1403 if ( v8 >= (signed int)v5 ) | |
1404 goto LABEL_11; | |
1405 } | |
1406 } | |
1407 return 0; | |
1408 } | |
1409 // 506128: using guessed type int areWeLoadingTexture; | |
1410 | |
1411 //----- (004925E6) -------------------------------------------------------- | |
1412 unsigned int Player::FindFreeInventorySlot() | |
1413 { | |
1414 unsigned int result; // eax@1 | |
1415 ItemGen *v2; // ecx@1 | |
1416 | |
1417 result = 0; | |
1418 v2 = this->pInventoryItems; | |
1419 while ( v2->uItemID ) | |
1420 { | |
1421 ++result; | |
1422 ++v2; | |
1423 if ( (signed int)result >= 126 ) | |
1424 return -1; | |
1425 } | |
1426 return result; | |
1427 } | |
1428 | |
1429 //----- (00492600) -------------------------------------------------------- | |
1430 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1431 { | |
1432 signed int v3; // edx@1 | |
1433 ItemGen *v4; // eax@1 | |
1434 int result; // eax@8 | |
1435 unsigned int v6; // ebx@10 | |
973 | 1436 //unsigned int v7; // eax@10 |
0 | 1437 Texture *v8; // esi@10 |
1438 void *v9; // esi@13 | |
1439 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1440 Player *v11; // [sp+4h] [bp-8h]@1 | |
1441 signed int v12; // [sp+8h] [bp-4h]@4 | |
1442 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1443 | |
1444 v11 = this; | |
1445 v3 = 0; | |
1446 v4 = this->pInventoryItems; | |
1447 while ( v4->uItemID ) | |
1448 { | |
1449 ++v3; | |
1450 ++v4; | |
1451 if ( v3 >= 126 ) | |
1452 { | |
1453 v12 = -1; | |
1454 goto LABEL_5; | |
1455 } | |
1456 } | |
1457 v12 = v3; | |
1458 LABEL_5: | |
1459 if ( v12 == -1 ) | |
1460 { | |
1461 if ( uActiveCharacter ) | |
201 | 1462 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1463 result = 0; |
1464 } | |
1465 else | |
1466 { | |
1467 v6 = uItemID; | |
973 | 1468 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1469 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1470 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1471 if ( !areWeLoadingTexture ) | |
1472 { | |
1473 v8->Release(); | |
1474 pIcons_LOD->_40F9C5(); | |
1475 } | |
1476 if ( (signed int)uItemIDa > 0 ) | |
1477 { | |
1478 v9 = &v11->pInventoryIndices[uSlot]; | |
1479 do | |
1480 { | |
1481 if ( (signed int)v10 > 0 ) | |
1482 memset32(v9, -1 - uSlot, v10); | |
1483 v9 = (char *)v9 + 56; | |
1484 --uItemIDa; | |
1485 } | |
1486 while ( uItemIDa ); | |
1487 } | |
1488 result = v12 + 1; | |
1489 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1490 v11->pInventoryItems[v12].uItemID = v6; | |
1491 } | |
1492 return result; | |
1493 } | |
1494 // 506128: using guessed type int areWeLoadingTexture; | |
1495 | |
1496 //----- (00492700) -------------------------------------------------------- | |
1497 int Player::HasSkill(unsigned int uSkillType) | |
1498 { | |
1499 signed int result; // eax@3 | |
1500 | |
1501 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1502 { | |
1503 result = 1; | |
1504 } | |
1505 else | |
1506 { | |
809 | 1507 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1508 ShowStatusBarString(pTmpBuf, 2u); |
1509 result = 0; | |
1510 } | |
1511 return result; | |
1512 } | |
1513 | |
1514 //----- (00492745) -------------------------------------------------------- | |
1515 int Player::WearItem(unsigned int uItemID) | |
1516 { | |
1517 signed int v2; // eax@1 | |
1518 ItemGen *v3; // edx@1 | |
1519 int v4; // edi@6 | |
1520 char *v5; // eax@6 | |
1521 char *v6; // esi@6 | |
1522 | |
973 | 1523 __debugbreak(); // sub is definetly broken |
1524 | |
0 | 1525 v2 = 0; |
1526 v3 = this->pInventoryItems; | |
1527 while ( v3->uItemID ) | |
1528 { | |
1529 ++v2; | |
1530 ++v3; | |
1531 if ( v2 >= 126 ) | |
1532 { | |
1533 v2 = -1; | |
1534 break; | |
1535 } | |
1536 } | |
1537 if ( v2 != -1 ) | |
1538 { | |
1539 v4 = v2 + 1; | |
1540 v5 = (char *)this + 36 * v2; | |
1541 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; | |
898 | 1542 *(&this->pEquipment.uShield + (unsigned __int8)*v6) = v4; |
0 | 1543 *((int *)v5 + 133) = uItemID; |
1544 v5[556] = *v6 + 1; | |
1545 } | |
1546 return 0; | |
1547 } | |
1548 | |
1549 //----- (004927A8) -------------------------------------------------------- | |
1550 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1551 { | |
1552 signed int v3; // ebx@2 | |
1553 signed int v4; // edi@3 | |
1554 unsigned int v5; // esi@3 | |
1555 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1556 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1557 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1558 | |
1559 thisa = this; | |
1560 if ( uSlot == -1 ) | |
1561 { | |
1562 v3 = 0; | |
1563 while ( 2 ) | |
1564 { | |
1565 v4 = 0; | |
1566 v5 = v3; | |
1567 do | |
1568 { | |
1569 if ( CanFitItem(v5, uItemID) ) | |
1570 { | |
1571 v8 = uItemID; | |
1572 v7 = v5; | |
1573 return CreateItemInInventory(v7, v8); | |
1574 } | |
1575 ++v4; | |
1576 v5 += 14; | |
1577 } | |
1578 while ( v4 < 9 ); | |
1579 ++v3; | |
1580 if ( v3 < 14 ) | |
1581 continue; | |
1582 break; | |
1583 } | |
1584 return 0; | |
1585 } | |
1586 if ( !CanFitItem(uSlot, uItemID) ) | |
1587 { | |
1588 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1589 return 0; | |
1590 } | |
1591 v8 = uItemID; | |
1592 v7 = uSlot; | |
1593 return CreateItemInInventory(v7, v8); | |
1594 } | |
1595 | |
1596 //----- (00492826) -------------------------------------------------------- | |
1597 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1598 { | |
1599 unsigned int v3; // ebx@1 | |
1600 unsigned int v4; // esi@3 | |
1601 signed int v5; // edi@3 | |
1602 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1603 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1604 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1605 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1606 | |
1607 thisa = this; | |
1608 v3 = Src->uItemID; | |
1609 pItemsTable->SetSpecialBonus(Src); | |
1610 if ( uSlot == -1 ) | |
1611 { | |
1612 uSlota = 0; | |
1613 while ( 2 ) | |
1614 { | |
1615 v4 = uSlota; | |
1616 v5 = 0; | |
1617 do | |
1618 { | |
1619 if ( CanFitItem(v4, v3) ) | |
1620 { | |
1621 v8 = Src; | |
1622 v7 = v4; | |
1623 return CreateItemInInventory2(v7, v8); | |
1624 } | |
1625 ++v5; | |
1626 v4 += 14; | |
1627 } | |
1628 while ( v5 < 14 ); | |
1629 ++uSlota; | |
1630 if ( uSlota < 9 ) | |
1631 continue; | |
1632 break; | |
1633 } | |
1634 return 0; | |
1635 } | |
1636 if ( !CanFitItem(uSlot, v3) ) | |
1637 return 0; | |
1638 v8 = Src; | |
1639 v7 = uSlot; | |
1640 return CreateItemInInventory2(v7, v8); | |
1641 } | |
1642 | |
1643 //----- (0049289C) -------------------------------------------------------- | |
1644 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1645 { | |
1646 signed int v3; // ebx@1 | |
1647 ItemGen *v4; // eax@1 | |
1648 int result; // eax@6 | |
973 | 1649 //unsigned int v6; // eax@7 |
0 | 1650 Texture *v7; // esi@7 |
1651 unsigned int v8; // edx@9 | |
1652 void *v9; // esi@10 | |
1653 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1654 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1655 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1656 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1657 | |
1658 v12 = this; | |
1659 v3 = 0; | |
1660 v4 = this->pInventoryItems; | |
1661 while ( v4->uItemID ) | |
1662 { | |
1663 ++v3; | |
1664 ++v4; | |
1665 if ( v3 >= 126 ) | |
1666 { | |
1667 v3 = -1; | |
1668 break; | |
1669 } | |
1670 } | |
1671 if ( v3 == -1 ) | |
1672 { | |
1673 result = 0; | |
1674 } | |
1675 else | |
1676 { | |
973 | 1677 v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1678 v10 = GetSizeInInventorySlots(v7->uTextureWidth); | |
0 | 1679 v11 = GetSizeInInventorySlots(v7->uTextureHeight); |
1680 if ( !areWeLoadingTexture ) | |
1681 { | |
1682 v7->Release(); | |
1683 pIcons_LOD->_40F9C5(); | |
1684 } | |
1685 v8 = uSlot; | |
1686 if ( (signed int)v11 > 0 ) | |
1687 { | |
1688 uSlota = v11; | |
1689 v9 = &v12->pInventoryIndices[v8]; | |
1690 do | |
1691 { | |
1692 if ( (signed int)v10 > 0 ) | |
1693 memset32(v9, -1 - v8, v10); | |
1694 v9 = (char *)v9 + 56; | |
1695 --uSlota; | |
1696 } | |
1697 while ( uSlota ); | |
1698 } | |
1699 v12->pInventoryIndices[v8] = v3 + 1; | |
1700 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1701 result = v3 + 1; | |
1702 } | |
1703 return result; | |
1704 } | |
1705 // 506128: using guessed type int areWeLoadingTexture; | |
1706 | |
1707 //----- (0049298B) -------------------------------------------------------- | |
1708 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1709 { | |
973 | 1710 //Player *v4; // ebx@1 |
1711 //unsigned int v5; // eax@1 | |
0 | 1712 Texture *v6; // esi@1 |
1713 void *v7; // esi@4 | |
1714 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1715 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1716 | |
973 | 1717 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1718 v9 = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1719 a2a = GetSizeInInventorySlots(v6->uTextureHeight); |
1720 if ( !areWeLoadingTexture ) | |
1721 { | |
1722 v6->Release(); | |
1723 pIcons_LOD->_40F9C5(); | |
1724 } | |
1725 if ( (signed int)a2a > 0 ) | |
1726 { | |
973 | 1727 v7 = &pInventoryIndices[a4]; |
0 | 1728 do |
1729 { | |
1730 if ( (signed int)v9 > 0 ) | |
1731 memset32(v7, -1 - a4, v9); | |
1732 v7 = (char *)v7 + 56; | |
1733 --a2a; | |
1734 } | |
1735 while ( a2a ); | |
1736 } | |
973 | 1737 pInventoryIndices[a4] = a3 + 1; |
0 | 1738 return 1; |
1739 } | |
278 | 1740 |
0 | 1741 // 506128: using guessed type int areWeLoadingTexture; |
1742 | |
1743 //----- (00492A36) -------------------------------------------------------- | |
1744 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) | |
1745 { | |
1746 int *pIndices; // edi@1 | |
1747 ItemGen *v3; // ecx@1 | |
1748 unsigned int v4; // esi@1 | |
973 | 1749 //unsigned int v5; // eax@1 |
0 | 1750 Texture *v6; // esi@1 |
1751 unsigned int result; // eax@1 | |
1752 unsigned int v8; // ebp@1 | |
1753 void *v9; // edx@4 | |
1754 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1755 | |
1756 pIndices = &this->pInventoryIndices[uSlot]; | |
232 | 1757 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1758 v4 = v3->uItemID; |
1759 v3->Reset(); | |
973 | 1760 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); |
1761 uSlota = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1762 result = GetSizeInInventorySlots(v6->uTextureHeight); |
1763 v8 = result; | |
1764 if ( !areWeLoadingTexture ) | |
1765 { | |
1766 v6->Release(); | |
1767 result = pIcons_LOD->_40F9C5(); | |
1768 } | |
1769 if ( (signed int)v8 > 0 ) | |
1770 { | |
1771 v9 = pIndices; | |
1772 do | |
1773 { | |
1774 if ( (signed int)uSlota > 0 ) | |
1775 { | |
1776 result = 0; | |
1777 memset(v9, 0, 4 * uSlota); | |
1778 } | |
1779 v9 = (char *)v9 + 56; | |
1780 --v8; | |
1781 } | |
1782 while ( v8 ); | |
1783 } | |
1784 return result; | |
1785 } | |
1786 // 506128: using guessed type int areWeLoadingTexture; | |
1787 | |
436 | 1788 //identf |
0 | 1789 //----- (00490EEE) -------------------------------------------------------- |
917 | 1790 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1791 { | |
1792 int pSkillLevel; // eax@1 | |
1793 int NotBuy; // eax@1 | |
1794 int result; | |
1795 signed int pEquipType; // esi@1 | |
1796 float *pPriceMultiplier; // esi@26 | |
1797 int pPriceItemService; // edi@26 | |
1798 | |
1799 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1800 NotBuy = 4; | |
1801 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1802 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1803 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1804 return 5; |
917 | 1805 if ( building_type == BildingType_WeaponShop ) |
1806 { | |
1807 if ( pEquipType > EQUIP_BOW ) | |
1808 return NotBuy; | |
1809 if (pItem->Stolen()) | |
1810 return 6; | |
1811 } | |
1812 if ( building_type == BildingType_ArmorShop ) | |
1813 { | |
1814 if ( pEquipType < 3 && pEquipType > 9 ) | |
1815 return NotBuy; | |
1816 if (pItem->Stolen()) | |
1817 return 6; | |
1818 } | |
1819 if ( building_type == BildingType_MagicShop ) | |
1820 { | |
1821 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1822 { | |
1823 if (pItem->Stolen()) | |
1824 return 6; | |
1825 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1826 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1827 if ( ShopMenuType == 3 )//Sell | |
1828 { | |
1829 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1830 if (!pItem->Broken()) | |
1831 { | |
1832 if ( pSkillLevel ) | |
1833 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1834 else | |
1835 result = 1; | |
1836 return result; | |
1837 } | |
1838 pPriceItemService = 1; | |
1839 if ( pSkillLevel ) | |
1840 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1841 else | |
1842 result = 1; | |
1843 return result; | |
1844 } | |
1845 if ( ShopMenuType == 4 )//Identify | |
1846 { | |
1847 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1848 if ( pSkillLevel ) | |
1849 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1850 else | |
1851 result = 1; | |
1852 return result; | |
1853 } | |
1854 if ( ShopMenuType == 5 )//Repair | |
1855 { | |
1856 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1857 if ( pSkillLevel ) | |
1858 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1859 else | |
1860 result = 1; | |
1861 return result; | |
1862 } | |
1863 if ( ShopMenuType != 6 )//Buy and ??? | |
1864 { | |
1865 if ( pSkillLevel ) | |
1866 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1867 else | |
1868 result = 1; | |
1869 return result; | |
1870 } | |
1871 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1872 if (pItem->Broken()) | |
1873 pPriceItemService = 1; | |
1874 if ( pPriceItemService >= 1 ) | |
1875 { | |
1876 if ( pSkillLevel ) | |
1877 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1878 else | |
1879 result = 1; | |
1880 return result; | |
1881 } | |
1882 pPriceItemService = 1; | |
1883 if ( pSkillLevel ) | |
1884 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1885 else | |
1886 result = 1; | |
0 | 1887 return result; |
917 | 1888 } |
1889 if ( pEquipType != EQUIP_BOOK ) | |
1890 return NotBuy; | |
1891 } | |
1892 if ( building_type == BildingType_AlchemistShop ) | |
1893 { | |
1894 if ( pEquipType < EQUIP_REAGENT ) | |
1895 return NotBuy; | |
1896 if ( pEquipType > EQUIP_POTION ) | |
1897 { | |
1898 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1899 return NotBuy; | |
1900 } | |
1901 if (pItem->Stolen()) | |
1902 return 6; | |
1903 } | |
1904 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1905 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1906 if ( ShopMenuType == 3 )//Sell | |
1907 { | |
1908 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1909 if (!pItem->Broken()) | |
1910 { | |
1911 if ( pSkillLevel ) | |
1912 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1913 else | |
1914 result = 1; | |
0 | 1915 return result; |
917 | 1916 } |
1917 pPriceItemService = 1; | |
1918 if ( pSkillLevel ) | |
1919 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1920 else | |
1921 result = 1; | |
1922 return result; | |
1923 } | |
1924 if ( ShopMenuType == 4 )//Identify | |
1925 { | |
1926 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1927 if ( pSkillLevel ) | |
1928 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1929 else | |
1930 result = 1; | |
1931 return result; | |
1932 } | |
1933 if ( ShopMenuType == 5 )//Repair | |
1934 { | |
1935 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1936 if ( pSkillLevel ) | |
1937 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1938 else | |
1939 result = 1; | |
1940 return result; | |
1941 } | |
1942 if ( ShopMenuType != 6 )//Buy and ??? | |
1943 { | |
1944 if ( pSkillLevel ) | |
1945 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1946 else | |
1947 result = 1; | |
1948 return result; | |
1949 } | |
1950 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1951 if (pItem->Broken()) |
917 | 1952 pPriceItemService = 1; |
1953 if ( pPriceItemService >= 1 ) | |
1954 { | |
1955 if ( pSkillLevel ) | |
1956 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1957 else | |
1958 result = 1; | |
1959 return result; | |
1960 } | |
1961 pPriceItemService = 1; | |
1962 if ( pSkillLevel ) | |
1963 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1964 else |
1965 result = 1; | |
1966 return result; | |
1967 } | |
1968 | |
1969 //----- (0049107D) -------------------------------------------------------- | |
1970 int Player::GetBodybuilding() | |
1971 { | |
1972 char v1; // al@1 | |
1973 int v2; // ecx@1 | |
1974 int v4; // eax@3 | |
1975 signed int v6; // [sp-4h] [bp-4h]@2 | |
1976 | |
1977 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1978 v2 = v1 & 0x3F; | |
1979 if ( v1 & 0x100 ) | |
1980 { | |
1981 v6 = 5; | |
1982 } | |
1983 else | |
1984 { | |
1985 if ( v1 >= 0 ) | |
1986 { | |
1987 v4 = ((v1 & 0x40) != 0) + 1; | |
1988 return v2 * v4; | |
1989 } | |
1990 v6 = 3; | |
1991 } | |
1992 v4 = v6; | |
1993 return v2 * v4; | |
1994 } | |
1995 | |
1996 //----- (004910A8) -------------------------------------------------------- | |
607 | 1997 int Player::GetMeditation() |
0 | 1998 { |
1999 char v1; // al@1 | |
2000 int v2; // ecx@1 | |
2001 int v4; // eax@3 | |
2002 signed int v6; // [sp-4h] [bp-4h]@2 | |
2003 | |
2004 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
2005 v2 = v1 & 0x3F; | |
2006 if ( v1 & 0x100 ) | |
2007 { | |
2008 v6 = 5; | |
2009 } | |
2010 else | |
2011 { | |
2012 if ( v1 >= 0 ) | |
2013 { | |
2014 v4 = ((v1 & 0x40) != 0) + 1; | |
2015 return v2 * v4; | |
2016 } | |
2017 v6 = 3; | |
2018 } | |
2019 v4 = v6; | |
2020 return v2 * v4; | |
2021 } | |
2022 | |
2023 //----- (004910D3) -------------------------------------------------------- | |
2024 int Player::CanIdentify(ItemGen *pItem) | |
2025 { | |
2026 unsigned __int16 v2; // ax@1 | |
2027 unsigned __int16 v3; // bx@1 | |
2028 int uSkillMult; // eax@3 | |
2029 int v5; // edi@7 | |
2030 signed int v6; // ebp@7 | |
2031 char *v7; // esi@7 | |
2032 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 2033 |
2034 if (CheckHiredNPCSpeciality(Scholar)) | |
2035 return true; | |
0 | 2036 |
179 | 2037 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 2038 v3 = v2; |
179 | 2039 if ( v2 & 1 ) |
0 | 2040 { |
2041 uSkillMultiplier = 5; | |
2042 } | |
2043 else | |
2044 { | |
2045 if ( (v2 & 0x80u) == 0 ) | |
2046 { | |
2047 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 2048 v5 = uSkillMult * (v3 & 0x3F); |
2049 v6 = 0; | |
2050 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2051 |
179 | 2052 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2053 v6 = 1; | |
2054 if ( v5 >= (unsigned __int8)v7[46] ) | |
2055 v6 = 1; | |
2056 return v6; | |
0 | 2057 } |
2058 uSkillMultiplier = 3; | |
2059 } | |
2060 uSkillMult = uSkillMultiplier; | |
2061 v5 = uSkillMult * (v3 & 0x3F); | |
2062 v6 = 0; | |
2063 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2064 |
0 | 2065 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2066 v6 = 1; | |
2067 if ( v5 >= (unsigned __int8)v7[46] ) | |
2068 v6 = 1; | |
2069 return v6; | |
2070 } | |
2071 | |
2072 //----- (00491151) -------------------------------------------------------- | |
2073 int Player::CanRepair(ItemGen *a2) | |
2074 { | |
2075 unsigned __int16 v2; // ax@1 | |
2076 unsigned __int16 v3; // bx@1 | |
2077 int v4; // eax@3 | |
2078 int v5; // edi@7 | |
2079 signed int v6; // ebp@7 | |
2080 char v8; // al@10 | |
2081 signed int v10; // [sp-4h] [bp-14h]@2 | |
2082 | |
652 | 2083 |
2084 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2085 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2086 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2087 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2088 return true; | |
2089 | |
0 | 2090 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
2091 v3 = v2; | |
2092 if ( HIBYTE(v2) & 1 ) | |
2093 { | |
2094 v10 = 5; | |
2095 } | |
2096 else | |
2097 { | |
2098 if ( (v2 & 0x80u) == 0 ) | |
2099 { | |
2100 v4 = ((v2 & 0x40) != 0) + 1; | |
2101 goto LABEL_7; | |
2102 } | |
2103 v10 = 3; | |
2104 } | |
2105 v4 = v10; | |
2106 LABEL_7: | |
2107 v5 = v4 * (v3 & 0x3F); | |
2108 v6 = 0; | |
2109 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2110 return true; | |
2111 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2112 { | |
2113 __debugbreak(); // really odd | |
2114 return true; | |
2115 } | |
2116 return false; | |
2117 } | |
2118 | |
2119 //----- (004911F3) -------------------------------------------------------- | |
2120 int Player::GetMerchant() | |
2121 { | |
2122 Player *v1; // edi@1 | |
2123 unsigned __int16 v2; // ax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // esi@1 | |
2126 int v5; // edi@1 | |
2127 int v7; // eax@3 | |
2128 int v8; // ecx@7 | |
2129 signed int v9; // [sp-4h] [bp-10h]@6 | |
2130 | |
2131 v1 = this; | |
607 | 2132 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 2133 v3 = v1->pActiveSkills[22]; |
607 | 2134 v4 = v2 & 0x003F; |
0 | 2135 v5 = v1->pActiveSkills[22] & 0x3F; |
2136 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2137 return 10000; | |
2138 v7 = GetPartyReputation(); | |
2139 if ( !v4 ) | |
2140 return -v7; | |
2141 if ( HIBYTE(v3) & 1 ) | |
2142 { | |
2143 v9 = 5; | |
2144 } | |
2145 else | |
2146 { | |
2147 if ( (v3 & 0x80u) == 0 ) | |
2148 { | |
2149 v8 = ((v3 & 0x40) != 0) + 1; | |
2150 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2151 } | |
2152 v9 = 3; | |
2153 } | |
2154 v8 = v9; | |
2155 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2156 } | |
2157 | |
2158 //----- (0049125A) -------------------------------------------------------- | |
2159 int Player::GetPerception() | |
2160 { | |
2161 Player *v1; // edi@1 | |
2162 unsigned __int16 v2; // ax@1 | |
2163 unsigned __int16 v3; // bx@1 | |
2164 int v4; // esi@1 | |
2165 int v5; // edi@1 | |
2166 int v7; // eax@5 | |
2167 signed int v8; // [sp-4h] [bp-10h]@4 | |
2168 | |
2169 v1 = this; | |
983 | 2170 v2 = (char)GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
0 | 2171 v3 = v1->pActiveSkills[26]; |
2172 v4 = v2 & 0x3F; | |
2173 v5 = v1->pActiveSkills[26] & 0x3F; | |
2174 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2175 return 10000; | |
2176 if ( HIBYTE(v3) & 1 ) | |
2177 { | |
2178 v8 = 5; | |
2179 } | |
2180 else | |
2181 { | |
2182 if ( (v3 & 0x80u) == 0 ) | |
2183 { | |
2184 v7 = ((v3 & 0x40) != 0) + 1; | |
2185 return v4 + v5 * (v7 - 1); | |
2186 } | |
2187 v8 = 3; | |
2188 } | |
2189 v7 = v8; | |
2190 return v4 + v5 * (v7 - 1); | |
2191 } | |
2192 | |
2193 //----- (004912B0) -------------------------------------------------------- | |
2194 int Player::GetDisarmTrap() | |
2195 { | |
2196 Player *v1; // ebp@1 | |
2197 unsigned __int16 v2; // ax@1 | |
2198 unsigned __int16 v3; // bx@1 | |
2199 int v4; // esi@1 | |
2200 int v5; // edi@1 | |
2201 int v7; // eax@7 | |
2202 signed int v8; // [sp-4h] [bp-14h]@6 | |
2203 | |
2204 v1 = this; | |
2205 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2206 v3 = v1->pActiveSkills[29]; | |
2207 v4 = v2 & 0x3F; | |
2208 v5 = v1->pActiveSkills[29] & 0x3F; | |
2209 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2210 return 10000; | |
2211 if ( HasEnchantedItemEquipped(35) ) | |
2212 v4 *= 2; | |
2213 if ( HIBYTE(v3) & 1 ) | |
2214 { | |
2215 v8 = 5; | |
2216 } | |
2217 else | |
2218 { | |
2219 if ( (v3 & 0x80u) == 0 ) | |
2220 { | |
2221 v7 = ((v3 & 0x40) != 0) + 1; | |
2222 return v4 + v5 * (v7 - 1); | |
2223 } | |
2224 v8 = 3; | |
2225 } | |
2226 v7 = v8; | |
2227 return v4 + v5 * (v7 - 1); | |
2228 } | |
2229 | |
2230 //----- (00491317) -------------------------------------------------------- | |
2231 char Player::GetLearningPercent() | |
2232 { | |
2233 Player *v1; // esi@1 | |
2234 int v2; // eax@1 | |
2235 unsigned __int16 v3; // bx@1 | |
2236 int v4; // ecx@1 | |
2237 int v5; // eax@4 | |
2238 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2239 | |
2240 v1 = this; | |
2241 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2242 v3 = v1->pActiveSkills[36]; | |
2243 v4 = v2 & 0x3F; | |
2244 if ( v2 ) | |
2245 { | |
2246 if ( HIBYTE(v3) & 1 ) | |
2247 { | |
2248 v7 = 5; | |
2249 } | |
2250 else | |
2251 { | |
2252 if ( (v3 & 0x80u) == 0 ) | |
2253 { | |
2254 v5 = ((v3 & 0x40) != 0) + 1; | |
2255 goto LABEL_8; | |
2256 } | |
2257 v7 = 3; | |
2258 } | |
2259 v5 = v7; | |
2260 LABEL_8: | |
2261 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2262 } | |
2263 return v2; | |
2264 } | |
2265 | |
2266 //----- (0048C6AF) -------------------------------------------------------- | |
2267 Player::Player() | |
2268 { | |
2269 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2270 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2271 for (uint i = 0; i < 126; ++i) | |
2272 pInventoryItems[i].Reset(); | |
2273 for (uint i = 0; i < 12; ++i) | |
2274 pEquippedItems[i].Reset(); | |
2275 | |
2276 | |
2277 for (uint i = 0; i < 24; ++i) | |
2278 { | |
2279 pPlayerBuffs[i].uSkill = 0; | |
2280 pPlayerBuffs[i].uSkill = 0; | |
2281 pPlayerBuffs[i].uPower = 0; | |
2282 pPlayerBuffs[i].uExpireTime = 0; | |
2283 pPlayerBuffs[i].uCaster = 0; | |
2284 pPlayerBuffs[i].uFlags = 0; | |
2285 } | |
2286 | |
2287 pName[0] = 0; | |
2288 uFace = 0; | |
2289 uVoiceID = 0; | |
2290 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2291 | |
2292 field_BB = 0; | |
2293 | |
2294 uMight = uMightBonus = 0; | |
2295 uIntelligence = uIntelligenceBonus = 0; | |
2296 uWillpower = uWillpowerBonus = 0; | |
2297 uEndurance = uEnduranceBonus = 0; | |
2298 uSpeed = uSpeedBonus = 0; | |
2299 uAccuracy = uAccuracyBonus = 0; | |
2300 uLuck = uLuckBonus = 0; | |
2301 uLevel = sLevelModifier = 0; | |
2302 sAgeModifier = 0; | |
2303 | |
2304 memset(field_1F5, 0, 30); | |
2305 | |
2306 sResFireBase = sResFireBonus = 0; | |
2307 sResAirBase = sResAirBonus = 0; | |
2308 sResWaterBase = sResWaterBonus = 0; | |
2309 sResEarthBase = sResEarthBonus = 0; | |
2310 sResMagicBase = sResMagicBonus = 0; | |
2311 sResSpiritBase = sResSpiritBonus = 0; | |
2312 sResMindBase = sResMindBonus = 0; | |
2313 sResBodyBase = sResBodyBonus = 0; | |
2314 sResLightBase = sResLightBonus = 0; | |
2315 sResDarkBase = sResDarkBonus = 0; | |
2316 | |
2317 uTimeToRecovery = 0; | |
2318 | |
2319 uSkillPoints = 0; | |
2320 | |
2321 sHealth = 0; | |
2322 uFullHealthBonus = 0; | |
2323 _health_related = 0; | |
2324 | |
2325 sMana = 0; | |
2326 uFullManaBonus = 0; | |
2327 _mana_related = 0; | |
2328 | |
2329 uQuickSpell = 0; | |
2330 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2331 | |
2332 _some_attack_bonus = 0; | |
2333 field_1A91 = 0; | |
2334 _melee_dmg_bonus = 0; | |
2335 field_1A93 = 0; | |
2336 _ranged_atk_bonus = 0; | |
2337 field_1A95 = 0; | |
2338 _ranged_dmg_bonus = 0; | |
2339 field_1A97 = 0; | |
2340 | |
130 | 2341 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2342 uExpressionTimePassed = 0; |
2343 uExpressionTimeLength = 0; | |
2344 | |
2345 uNumDivineInterventionCastsThisDay = 0; | |
2346 uNumArmageddonCasts = 0; | |
2347 uNumFireSpikeCasts = 0; | |
2348 | |
2349 memset(field_1988, 0, 49 * sizeof(int)); | |
2350 memset(field_1A50, 0, 64 * sizeof(char)); | |
2351 | |
2352 field_E0 = 0; | |
2353 field_E4 = 0; | |
2354 field_E8 = 0; | |
2355 field_EC = 0; | |
2356 field_F0 = 0; | |
2357 field_F4 = 0; | |
2358 field_F8 = 0; | |
2359 field_FC = 0; | |
2360 field_100 = 0; | |
2361 field_104 = 0; | |
198 | 2362 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2363 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2364 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2365 |
198 | 2366 lastOpenedSpellbookPage = 0; |
0 | 2367 } |
2368 | |
2369 //----- (0048C6F6) -------------------------------------------------------- | |
2370 bool Party::AddItem(ItemGen *pItem) | |
2371 { | |
2372 unsigned int v2; // eax@1 | |
2373 unsigned int v3; // ecx@4 | |
2374 signed int v4; // edx@4 | |
2375 char *v5; // eax@8 | |
973 | 2376 //unsigned int v6; // eax@10 |
0 | 2377 Texture *v7; // ebx@10 |
2378 signed int v8; // esi@10 | |
2379 Player *v9; // edi@11 | |
2380 int v10; // eax@11 | |
2381 bool result; // eax@15 | |
2382 std::string v12; // [sp-18h] [bp-40h]@9 | |
2383 const char *v13; // [sp-8h] [bp-30h]@9 | |
2384 int v14; // [sp-4h] [bp-2Ch]@9 | |
188 | 2385 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2386 //int v16; // [sp+10h] [bp-18h]@3 | |
2387 //int v17; // [sp+14h] [bp-14h]@3 | |
2388 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2389 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2390 Party *v20; // [sp+20h] [bp-8h]@1 | |
2391 int v21; // [sp+24h] [bp-4h]@10 | |
2392 | |
2393 auto thos = this; | |
2394 | |
2395 v20 = thos; | |
2396 v2 = pItem->uItemID; | |
222 | 2397 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2398 pItem->SetIdentified(); |
188 | 2399 ///v15 = 0; |
2400 //v16 = 1; | |
2401 //v18 = 3; | |
2402 //v17 = 2; | |
0 | 2403 if ( uActiveCharacter ) |
2404 { | |
2405 v3 = uActiveCharacter - 1; | |
2406 v4 = 0; | |
2407 do | |
2408 { | |
188 | 2409 v15[v4++] = v3++; |
0 | 2410 if ( (signed int)v3 >= 4 ) |
2411 v3 = 0; | |
2412 } | |
2413 while ( v4 < 4 ); | |
2414 } | |
2415 v5 = pItemsTable->pItems[v2].pIconName; | |
2416 if ( v5 ) | |
2417 { | |
973 | 2418 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2419 v21 = areWeLoadingTexture; |
2420 v8 = 0; | |
2421 while ( 1 ) | |
2422 { | |
188 | 2423 v9 = &v20->pPlayers[v15[v8]]; |
2424 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2425 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2426 if ( v10 ) | |
2427 break; | |
2428 ++v8; | |
2429 if ( v8 >= 4 ) | |
2430 { | |
2431 if ( !v21 ) | |
2432 { | |
2433 v7->Release(); | |
2434 pIcons_LOD->_40F9C5(); | |
2435 } | |
2436 goto LABEL_15; | |
2437 } | |
2438 } | |
232 | 2439 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2440 pItem->Reset(); |
2441 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2442 v19->PlaySound(SPEECH_60, 0); |
0 | 2443 if ( !v21 ) |
2444 { | |
2445 v7->Release(); | |
2446 pIcons_LOD->_40F9C5(); | |
2447 } | |
2448 result = 1; | |
2449 } | |
2450 else | |
2451 { | |
2452 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2453 LABEL_15: | |
2454 result = 0; | |
2455 } | |
2456 return result; | |
2457 } | |
2458 // 506128: using guessed type int areWeLoadingTexture; | |
2459 | |
2460 //----- (0048C855) -------------------------------------------------------- | |
2461 int Player::GetBaseStrength() | |
2462 { | |
2463 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2464 } | |
2465 | |
2466 //----- (0048C86C) -------------------------------------------------------- | |
2467 int Player::GetBaseIntelligence() | |
2468 { | |
2469 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2470 } | |
2471 | |
2472 //----- (0048C883) -------------------------------------------------------- | |
2473 int Player::GetBaseWillpower() | |
2474 { | |
2475 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2476 } | |
2477 | |
2478 //----- (0048C89A) -------------------------------------------------------- | |
2479 int Player::GetBaseEndurance() | |
2480 { | |
2481 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2482 } | |
2483 | |
2484 //----- (0048C8B1) -------------------------------------------------------- | |
2485 int Player::GetBaseAccuracy() | |
2486 { | |
2487 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2488 } | |
2489 | |
2490 //----- (0048C8C8) -------------------------------------------------------- | |
2491 int Player::GetBaseSpeed() | |
2492 { | |
2493 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2494 } | |
2495 | |
2496 //----- (0048C8DF) -------------------------------------------------------- | |
2497 int Player::GetBaseLuck() | |
2498 { | |
2499 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2500 } | |
2501 | |
2502 //----- (0048C8F6) -------------------------------------------------------- | |
2503 int Player::GetBaseLevel() | |
2504 { | |
2505 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2506 } | |
2507 | |
2508 //----- (0048C90D) -------------------------------------------------------- | |
2509 int Player::GetActualLevel() | |
2510 { | |
2511 return uLevel + sLevelModifier + | |
2512 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2513 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2514 } | |
2515 | |
2516 //----- (0048C93C) -------------------------------------------------------- | |
2517 int Player::GetActualMight() | |
2518 { | |
2519 Player *v1; // esi@1 | |
2520 unsigned int v2; // eax@1 | |
2521 signed int v3; // ecx@1 | |
2522 signed int v4; // ebx@4 | |
2523 int v5; // edi@5 | |
2524 int v6; // ST14_4@5 | |
2525 | |
2526 v1 = this; | |
2527 v2 = this->sAgeModifier + GetBaseAge(); | |
2528 v3 = 0; | |
2529 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2530 { | |
2531 ++v3; | |
2532 if ( v3 >= 4 ) | |
2533 { | |
2534 v4 = 100; | |
2535 goto LABEL_5; | |
2536 } | |
2537 } | |
2538 v4 = pAgeingStrengthMultiplier[v3]; | |
2539 LABEL_5: | |
2540 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2541 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2542 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2543 } | |
2544 | |
2545 //----- (0048C9C2) -------------------------------------------------------- | |
2546 int Player::GetActualIntelligence() | |
2547 { | |
2548 Player *v1; // esi@1 | |
2549 unsigned int sAge; // eax@1 | |
2550 signed int uAgeLevel; // ecx@1 | |
2551 signed int v4; // ebx@4 | |
2552 int v5; // edi@5 | |
2553 int v6; // ebp@5 | |
2554 | |
2555 v1 = this; | |
2556 sAge = this->sAgeModifier + GetBaseAge(); | |
2557 uAgeLevel = 0; | |
2558 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2559 { | |
2560 ++uAgeLevel; | |
2561 if ( uAgeLevel >= 4 ) | |
2562 { | |
2563 v4 = 100; | |
2564 goto LABEL_5; | |
2565 } | |
2566 } | |
2567 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2568 LABEL_5: | |
2569 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2570 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2571 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2572 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2573 + v6 | |
2574 + v1->uIntelligenceBonus; | |
2575 } | |
2576 | |
2577 //----- (0048CA3F) -------------------------------------------------------- | |
2578 int Player::GetActualWillpower() | |
2579 { | |
2580 int v5; // edi@5 | |
2581 | |
2582 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2583 uint uAgeingMultiplier = 100; | |
2584 for (uint i = 0; i < 4; ++i) | |
2585 if (uActualAge >= pAgeingTable[i]) | |
2586 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2587 else break; | |
2588 | |
2589 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2590 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2591 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2592 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2593 + uWillpowerBonus; | |
2594 } | |
2595 | |
2596 //----- (0048CABC) -------------------------------------------------------- | |
2597 int Player::GetActualEndurance() | |
2598 { | |
2599 int v6; // ebp@5 | |
2600 | |
2601 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2602 uint uAgeingMultiplier = 100; | |
2603 for (uint i = 0; i < 4; ++i) | |
2604 if (uActualAge >= pAgeingTable[i]) | |
2605 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2606 else break; | |
2607 | |
2608 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2609 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2610 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2611 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2612 + uItemBonus | |
2613 + uEnduranceBonus; | |
2614 } | |
2615 | |
2616 //----- (0048CB39) -------------------------------------------------------- | |
2617 int Player::GetActualAccuracy() | |
2618 { | |
2619 Player *v1; // esi@1 | |
2620 unsigned int v2; // eax@1 | |
2621 signed int v3; // ecx@1 | |
2622 signed int v4; // ebx@4 | |
2623 int v5; // edi@5 | |
2624 int v6; // ebp@5 | |
2625 | |
2626 v1 = this; | |
2627 v2 = this->sAgeModifier + GetBaseAge(); | |
2628 v3 = 0; | |
2629 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2630 { | |
2631 ++v3; | |
2632 if ( v3 >= 4 ) | |
2633 { | |
2634 v4 = 100; | |
2635 goto LABEL_5; | |
2636 } | |
2637 } | |
2638 v4 = pAgeingAccuracyMultiplier[v3]; | |
2639 LABEL_5: | |
2640 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2641 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2642 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2643 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2644 + v6 | |
2645 + v1->uAccuracyBonus; | |
2646 } | |
2647 | |
2648 //----- (0048CBB6) -------------------------------------------------------- | |
2649 int Player::GetActualSpeed() | |
2650 { | |
2651 Player *v1; // esi@1 | |
2652 unsigned int v2; // eax@1 | |
2653 signed int v3; // ecx@1 | |
2654 signed int v4; // ebx@4 | |
2655 int v5; // edi@5 | |
2656 int v6; // ebp@5 | |
2657 | |
2658 v1 = this; | |
2659 v2 = this->sAgeModifier + GetBaseAge(); | |
2660 v3 = 0; | |
2661 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2662 { | |
2663 ++v3; | |
2664 if ( v3 >= 4 ) | |
2665 { | |
2666 v4 = 100; | |
2667 goto LABEL_5; | |
2668 } | |
2669 } | |
2670 v4 = pAgeingSpeedMultiplier[v3]; | |
2671 LABEL_5: | |
2672 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2673 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2674 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2675 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2676 + v6 | |
2677 + v1->uSpeedBonus; | |
2678 } | |
2679 | |
2680 //----- (0048CC33) -------------------------------------------------------- | |
2681 int Player::GetActualLuck() | |
2682 { | |
2683 Player *v1; // esi@1 | |
2684 unsigned int v2; // eax@7 | |
2685 signed int v3; // ecx@7 | |
2686 signed int v4; // ebx@10 | |
2687 int v5; // edi@11 | |
2688 int v6; // ebp@11 | |
2689 signed int v8; // [sp+10h] [bp-4h]@1 | |
2690 | |
2691 v8 = 0; | |
2692 v1 = this; | |
652 | 2693 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2694 v8 = 5; |
652 | 2695 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2696 v8 += 20; |
652 | 2697 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2698 v8 += 10; |
2699 v2 = v1->sAgeModifier + GetBaseAge(); | |
2700 v3 = 0; | |
2701 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2702 { | |
2703 ++v3; | |
2704 if ( v3 >= 4 ) | |
2705 { | |
2706 v4 = 100; | |
2707 goto LABEL_11; | |
2708 } | |
2709 } | |
2710 v4 = pAgeingLuckMultiplier[v3]; | |
2711 LABEL_11: | |
2712 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2713 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2714 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2715 + v6 | |
2716 + v8 | |
2717 + v5 * v4 * v1->uLuck / 100 / 100 | |
2718 + v1->uLuckBonus; | |
2719 } | |
2720 | |
2721 //----- (0048CCF5) -------------------------------------------------------- | |
2722 int Player::GetActualAttack(int a2) | |
2723 { | |
2724 Player *v2; // esi@1 | |
2725 int v3; // eax@1 | |
2726 int v4; // edi@1 | |
2727 int v5; // ebx@1 | |
2728 int v6; // ebp@1 | |
2729 | |
2730 v2 = this; | |
2731 v3 = GetActualAccuracy(); | |
2732 v4 = _48EA1B_get_static_effect(v3); | |
2733 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2734 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2735 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2736 } | |
2737 | |
2738 //----- (0048CD45) -------------------------------------------------------- | |
2739 int Player::GetMeleeDamageMinimal() | |
2740 { | |
2741 Player *v1; // edi@1 | |
2742 int v2; // eax@1 | |
2743 int v3; // esi@1 | |
2744 int v4; // esi@1 | |
2745 int v5; // esi@1 | |
2746 int v6; // esi@1 | |
2747 signed int result; // eax@1 | |
2748 | |
2749 v1 = this; | |
2750 v2 = GetActualMight(); | |
2751 v3 = _48EA1B_get_static_effect(v2); | |
2752 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2753 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2754 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2755 result = 1; | |
2756 if ( v6 >= 1 ) | |
2757 result = v6; | |
2758 return result; | |
2759 } | |
2760 | |
2761 //----- (0048CD90) -------------------------------------------------------- | |
2762 int Player::GetMeleeDamageMaximal() | |
2763 { | |
2764 Player *v1; // edi@1 | |
2765 int v2; // eax@1 | |
2766 int v3; // esi@1 | |
2767 int v4; // esi@1 | |
2768 int v5; // esi@1 | |
2769 int v6; // esi@1 | |
2770 signed int result; // eax@1 | |
2771 | |
2772 v1 = this; | |
2773 v2 = GetActualMight(); | |
2774 v3 = _48EA1B_get_static_effect(v2); | |
2775 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2776 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2777 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2778 result = 1; | |
2779 if ( v6 >= 1 ) | |
2780 result = v6; | |
2781 return result; | |
2782 } | |
2783 | |
2784 //----- (0048CDDB) -------------------------------------------------------- | |
2785 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2786 { | |
2787 int v4; // esi@1 | |
2788 Player *v5; // edi@1 | |
2789 ItemGen *v6; // ebx@4 | |
2790 unsigned int v7; // ebp@4 | |
2791 unsigned int v8; // esi@4 | |
2792 int v9; // eax@4 | |
2793 int v10; // eax@9 | |
2794 char v11; // zf@9 | |
2795 int v12; // esi@10 | |
2796 int v13; // eax@11 | |
2797 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2798 ItemGen *v15; // ebx@35 | |
2799 unsigned int v16; // ebp@35 | |
2800 unsigned int v17; // esi@35 | |
2801 int v18; // edx@38 | |
2802 int v19; // eax@40 | |
2803 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2804 int v21; // esi@62 | |
2805 int v22; // eax@63 | |
2806 int v23; // ebx@63 | |
2807 int v24; // ebx@63 | |
2808 signed int result; // eax@64 | |
2809 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2810 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2811 int v28; // [sp+10h] [bp-10h]@1 | |
2812 int v29; // [sp+10h] [bp-10h]@33 | |
2813 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2814 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2815 int v32; // [sp+18h] [bp-8h]@1 | |
2816 int v33; // [sp+18h] [bp-8h]@8 | |
2817 int v34; // [sp+1Ch] [bp-4h]@1 | |
2818 int v35; // [sp+28h] [bp+8h]@37 | |
2819 | |
2820 v4 = 0; | |
2821 v5 = this; | |
2822 v34 = 0; | |
2823 v32 = 0; | |
2824 v28 = 0; | |
2825 if ( IsUnarmed() == 1 ) | |
2826 { | |
2827 v32 = rand() % 3 + 1; | |
2828 LABEL_61: | |
2829 v34 = v4; | |
2830 goto LABEL_62; | |
2831 } | |
816 | 2832 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2833 { |
232 | 2834 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2835 v7 = v6->uItemID; |
2836 v8 = v6->uItemID; | |
2837 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2838 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2839 ++v9; |
2840 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2841 if ( v9 > 0 ) | |
2842 { | |
2843 v33 = v9; | |
2844 do | |
2845 { | |
2846 v10 = rand(); | |
2847 v11 = v33-- == 1; | |
2848 v28 += v10 % v30 + 1; | |
2849 } | |
2850 while ( !v11 ); | |
2851 } | |
2852 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2853 if ( !uTargetActorID ) | |
2854 goto LABEL_28; | |
377 | 2855 v13 = v6->uSpecEnchantmentType; |
0 | 2856 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2857 { | |
2858 v14 = (MONSTER_SUPERTYPE)1; | |
2859 } | |
2860 else | |
2861 { | |
2862 if ( v13 == 39 ) | |
2863 { | |
2864 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2865 } | |
2866 else | |
2867 { | |
2868 if ( v13 == 40 ) | |
2869 { | |
2870 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2871 } | |
2872 else | |
2873 { | |
2874 if ( v13 == 63 || v7 == 517 ) | |
2875 { | |
2876 v26 = MONSTER_SUPERTYPE_ELF; | |
2877 } | |
2878 else | |
2879 { | |
2880 if ( v13 != 65 ) | |
2881 { | |
2882 LABEL_28: | |
2883 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2884 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2885 && rand() % 100 < 10 ) | |
2886 v12 *= 3; | |
2887 v32 = v12; | |
2888 goto LABEL_33; | |
2889 } | |
2890 v26 = MONSTER_SUPERTYPE_TITAN; | |
2891 } | |
2892 } | |
2893 } | |
2894 v14 = v26; | |
2895 } | |
2896 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2897 v12 *= 2; | |
2898 goto LABEL_28; | |
2899 } | |
2900 LABEL_33: | |
2901 v29 = 0; | |
2902 if ( !a3 ) | |
2903 { | |
2904 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2905 { | |
898 | 2906 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2907 v16 = v15->uItemID; |
2908 v17 = v15->uItemID; | |
2909 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2910 { | |
2911 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2912 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2913 { | |
2914 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2915 do | |
2916 { | |
2917 v18 = rand() % v31; | |
2918 v11 = v35-- == 1; | |
2919 v29 += v18 + 1; | |
2920 } | |
2921 while ( !v11 ); | |
2922 } | |
2923 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2924 if ( !uTargetActorID ) | |
2925 goto LABEL_57; | |
377 | 2926 v19 = v15->uSpecEnchantmentType; |
0 | 2927 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2928 { | |
2929 v20 = (MONSTER_SUPERTYPE)1; | |
2930 } | |
2931 else | |
2932 { | |
2933 if ( v19 == 39 ) | |
2934 { | |
2935 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2936 } | |
2937 else | |
2938 { | |
2939 if ( v19 == 40 ) | |
2940 { | |
2941 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2942 } | |
2943 else | |
2944 { | |
2945 if ( v19 == 63 || v16 == 517 ) | |
2946 { | |
2947 v27 = MONSTER_SUPERTYPE_ELF; | |
2948 } | |
2949 else | |
2950 { | |
2951 if ( v19 != 65 ) | |
2952 { | |
2953 LABEL_57: | |
2954 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2955 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2956 && rand() % 100 < 10 ) | |
2957 v4 *= 3; | |
2958 goto LABEL_61; | |
2959 } | |
2960 v27 = MONSTER_SUPERTYPE_TITAN; | |
2961 } | |
2962 } | |
2963 } | |
2964 v20 = v27; | |
2965 } | |
2966 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2967 v4 *= 2; | |
2968 goto LABEL_57; | |
2969 } | |
2970 } | |
2971 } | |
2972 LABEL_62: | |
2973 v21 = v32 + v34; | |
2974 if ( !a2 ) | |
2975 { | |
2976 v22 = GetActualMight(); | |
2977 v23 = _48EA1B_get_static_effect(v22); | |
2978 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2979 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2980 } | |
2981 result = 1; | |
2982 if ( v21 >= 1 ) | |
2983 result = v21; | |
2984 return result; | |
2985 } | |
2986 | |
2987 //----- (0048D0B9) -------------------------------------------------------- | |
2988 int Player::GetRangedAttack() | |
2989 { | |
2990 Player *v1; // esi@1 | |
2991 int v2; // eax@1 | |
2992 int v3; // edi@3 | |
2993 int v4; // eax@4 | |
2994 int v5; // edi@4 | |
2995 int v6; // edi@4 | |
2996 int v7; // edi@4 | |
2997 | |
2998 v1 = this; | |
232 | 2999 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3000 if ( v2 < 64 || v2 > 65 ) |
3001 { | |
3002 v4 = GetActualAccuracy(); | |
3003 v5 = _48EA1B_get_static_effect(v4); | |
3004 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
3005 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
3006 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
3007 } | |
3008 else | |
3009 { | |
3010 v3 = GetActualAttack(1); | |
3011 } | |
3012 return v3; | |
3013 } | |
3014 | |
3015 //----- (0048D124) -------------------------------------------------------- | |
3016 int Player::GetRangedDamageMin() | |
3017 { | |
3018 Player *v1; // esi@1 | |
3019 int v2; // edi@1 | |
3020 int v3; // edi@1 | |
3021 int v4; // edi@1 | |
3022 unsigned __int16 v5; // ax@1 | |
3023 int result; // eax@6 | |
3024 | |
3025 v1 = this; | |
3026 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
3027 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3028 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3029 v5 = v1->pActiveSkills[5]; | |
3030 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3031 v4 += v1->pActiveSkills[5] & 0x3F; | |
3032 if ( v4 >= 1 ) | |
3033 result = v4; | |
3034 else | |
3035 result = 0; | |
3036 return result; | |
3037 } | |
3038 | |
3039 //----- (0048D191) -------------------------------------------------------- | |
3040 int Player::GetRangedDamageMax() | |
3041 { | |
3042 Player *v1; // esi@1 | |
3043 int v2; // edi@1 | |
3044 int v3; // edi@1 | |
3045 int v4; // edi@1 | |
3046 unsigned __int16 v5; // ax@1 | |
3047 int result; // eax@6 | |
3048 | |
3049 v1 = this; | |
3050 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
3051 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3052 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3053 v5 = v1->pActiveSkills[5]; | |
3054 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3055 v4 += v1->pActiveSkills[5] & 0x3F; | |
3056 if ( v4 >= 1 ) | |
3057 result = v4; | |
3058 else | |
3059 result = 0; | |
3060 return result; | |
3061 } | |
3062 | |
3063 //----- (0048D1FE) -------------------------------------------------------- | |
3064 bool Player::CalculateRangedDamageTo(int a2) | |
3065 { | |
3066 Player *v2; // ebx@1 | |
3067 bool result; // eax@1 | |
3068 ItemGen *v4; // ebx@2 | |
3069 unsigned int v5; // edi@2 | |
3070 unsigned int v6; // esi@2 | |
3071 int v7; // edx@4 | |
3072 char v8; // zf@4 | |
3073 int v9; // esi@5 | |
3074 int v10; // ebx@6 | |
3075 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3076 unsigned __int16 v12; // ax@19 | |
3077 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3078 Player *v14; // [sp+4h] [bp-10h]@1 | |
3079 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3080 int v16; // [sp+Ch] [bp-8h]@3 | |
3081 int v17; // [sp+10h] [bp-4h]@1 | |
3082 | |
3083 v17 = 0; | |
3084 v2 = this; | |
3085 v14 = this; | |
3086 result = HasItemEquipped(EQUIP_BOW); | |
3087 if ( !result ) | |
3088 return result; | |
232 | 3089 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3090 v5 = v4->uItemID; |
3091 v6 = v4->uItemID; | |
3092 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3093 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3094 { | |
3095 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3096 do | |
3097 { | |
3098 v7 = rand() % v15; | |
3099 v8 = v16-- == 1; | |
3100 v17 += v7 + 1; | |
3101 } | |
3102 while ( !v8 ); | |
3103 } | |
3104 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3105 if ( a2 ) | |
3106 { | |
377 | 3107 v10 = v4->uSpecEnchantmentType; |
0 | 3108 if ( v10 == 64 ) |
3109 { | |
3110 v11 = (MONSTER_SUPERTYPE)1; | |
3111 goto LABEL_17; | |
3112 } | |
3113 if ( v10 == 39 || v5 == 508 ) | |
3114 { | |
3115 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3116 goto LABEL_16; | |
3117 } | |
3118 if ( v10 == 40 ) | |
3119 { | |
3120 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3121 goto LABEL_16; | |
3122 } | |
3123 if ( v10 == 63 || v5 == 517 ) | |
3124 { | |
3125 v13 = MONSTER_SUPERTYPE_ELF; | |
3126 LABEL_16: | |
3127 v11 = v13; | |
3128 LABEL_17: | |
3129 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3130 v9 *= 2; | |
3131 goto LABEL_19; | |
3132 } | |
3133 } | |
3134 LABEL_19: | |
3135 v12 = v14->pActiveSkills[5]; | |
3136 if ( v12 ) | |
3137 { | |
3138 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3139 v9 += v14->pActiveSkills[5] & 0x3F; | |
3140 } | |
3141 return v9; | |
3142 } | |
3143 | |
3144 //----- (0048D2EA) -------------------------------------------------------- | |
3145 char *Player::GetMeleeDamageString() | |
3146 { | |
3147 Player *v1; // esi@1 | |
3148 signed int v2; // eax@1 | |
3149 signed int v3; // edi@3 | |
3150 signed int v4; // eax@3 | |
3151 signed int v5; // ST0C_4@6 | |
3152 char *v6; // edi@6 | |
3153 signed int v7; // ST08_4@7 | |
3154 unsigned int v8; // eax@8 | |
3155 signed int v9; // esi@9 | |
3156 | |
3157 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3158 | |
3159 v1 = this; | |
232 | 3160 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3161 if ( v2 < 64 || v2 > 65 ) |
3162 { | |
3163 v3 = GetMeleeDamageMinimal(); | |
3164 v4 = GetMeleeDamageMaximal(); | |
3165 } | |
3166 else | |
3167 { | |
3168 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3169 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3170 } | |
3171 if ( v3 == v4 ) | |
3172 { | |
3173 v5 = v3; | |
3174 v6 = player__getmeleedamagestring_static_buff; | |
3175 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3176 } | |
3177 else | |
3178 { | |
3179 v7 = v3; | |
3180 v6 = player__getmeleedamagestring_static_buff; | |
3181 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3182 } | |
3183 v8 = v1->pEquipment.uMainHand; | |
3184 if ( v8 ) | |
3185 { | |
232 | 3186 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3187 if ( v9 >= 135 ) |
3188 { | |
3189 if ( v9 <= 159 ) | |
3190 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3191 } | |
3192 } | |
3193 return v6; | |
3194 } | |
3195 | |
3196 //----- (0048D396) -------------------------------------------------------- | |
3197 char *Player::GetRangedDamageString() | |
3198 { | |
3199 Player *v1; // esi@1 | |
3200 signed int v2; // eax@1 | |
3201 int v3; // edi@3 | |
3202 int v4; // eax@3 | |
3203 char *v5; // edi@6 | |
3204 int v6; // ST0C_4@8 | |
3205 int v7; // ST08_4@9 | |
3206 unsigned int v8; // eax@10 | |
3207 signed int v9; // esi@11 | |
3208 | |
3209 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3210 | |
3211 v1 = this; | |
232 | 3212 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3213 if ( v2 < 64 || v2 > 65 ) |
3214 { | |
3215 v3 = GetRangedDamageMin(); | |
3216 v4 = GetRangedDamageMax(); | |
3217 } | |
3218 else | |
3219 { | |
3220 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3221 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3222 } | |
3223 if ( v4 ) | |
3224 { | |
3225 if ( v3 == v4 ) | |
3226 { | |
3227 v6 = v3; | |
3228 v5 = player__getrangeddamagestring_static_buff; | |
3229 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3230 } | |
3231 else | |
3232 { | |
3233 v7 = v3; | |
3234 v5 = player__getrangeddamagestring_static_buff; | |
3235 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3236 } | |
3237 } | |
3238 else | |
3239 { | |
3240 v5 = player__getrangeddamagestring_static_buff; | |
3241 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3242 } | |
3243 v8 = v1->pEquipment.uMainHand; | |
3244 if ( v8 ) | |
3245 { | |
232 | 3246 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3247 if ( v9 >= 135 ) |
3248 { | |
3249 if ( v9 <= 159 ) | |
3250 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3251 } | |
3252 } | |
3253 return v5; | |
3254 } | |
3255 | |
3256 //----- (0048D45A) -------------------------------------------------------- | |
3257 bool Player::CanTrainToNextLevel() | |
3258 { | |
3259 int v1; // edx@1 | |
3260 int v2; // eax@1 | |
3261 int i; // esi@1 | |
3262 | |
3263 v1 = this->uLevel; | |
3264 v2 = 0; | |
3265 for ( i = 0; i < v1; ++i ) | |
3266 v2 += i + 1; | |
3267 return (signed __int64)this->uExperience >= 1000 * v2; | |
3268 } | |
3269 | |
3270 //----- (0048D498) -------------------------------------------------------- | |
3271 unsigned int Player::GetExperienceDisplayColor() | |
3272 { | |
3273 unsigned int result; // eax@2 | |
3274 | |
3275 if ( CanTrainToNextLevel() ) | |
949 | 3276 result = TargetColor(0, 0xFFu, 0); |
0 | 3277 else |
3278 result = 0; | |
3279 return result; | |
3280 } | |
3281 | |
3282 //----- (0048D4B3) -------------------------------------------------------- | |
3283 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3284 { | |
3285 Player *v3; // esi@1 | |
3286 int v4; // edi@8 | |
3287 int v6; // eax@21 | |
3288 signed int v7; // ebx@21 | |
3289 int v8; // eax@22 | |
3290 signed int v9; // ebx@22 | |
3291 int v10; // eax@23 | |
3292 signed int v11; // ebx@23 | |
3293 int v12; // eax@24 | |
3294 signed int v13; // edi@24 | |
3295 unsigned int v14; // eax@27 | |
3296 int v15; // eax@29 | |
3297 double v16; // st7@32 | |
3298 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3299 signed int v18; // [sp+8h] [bp-4h]@17 | |
3300 | |
3301 v3 = this; | |
3302 if ( !resistance ) | |
3303 { | |
3304 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3305 goto LABEL_16; | |
3306 } | |
3307 if ( resistance == 1 ) | |
3308 { | |
3309 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3310 goto LABEL_16; | |
3311 } | |
3312 if ( resistance == 2 ) | |
3313 { | |
3314 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3315 goto LABEL_16; | |
3316 } | |
3317 if ( resistance == 3 ) | |
3318 { | |
3319 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3320 goto LABEL_16; | |
3321 } | |
3322 if ( resistance == 6 ) | |
3323 { | |
3324 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3325 goto LABEL_16; | |
3326 } | |
3327 if ( resistance == 7 ) | |
3328 { | |
3329 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3330 goto LABEL_16; | |
3331 } | |
3332 if ( resistance == 8 ) | |
3333 { | |
3334 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3335 LABEL_16: | |
3336 v4 = GetActualResistance(v17); | |
3337 goto LABEL_17; | |
3338 } | |
3339 v4 = 0; | |
3340 LABEL_17: | |
3341 v18 = type; | |
135 | 3342 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3343 return 0; |
3344 if ( v4 ) | |
3345 { | |
3346 v6 = GetActualLuck(); | |
3347 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3348 if ( rand() % v7 >= 30 ) | |
3349 { | |
3350 v18 = type >> 1; | |
3351 v8 = GetActualLuck(); | |
3352 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3353 if ( rand() % v9 >= 30 ) | |
3354 { | |
3355 v18 = type >> 2; | |
3356 v10 = GetActualLuck(); | |
3357 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3358 if ( rand() % v11 >= 30 ) | |
3359 { | |
3360 v18 = type >> 3; | |
3361 v12 = GetActualLuck(); | |
3362 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3363 if ( rand() % v13 >= 30 ) | |
3364 v18 = type >> 4; | |
3365 } | |
3366 } | |
3367 } | |
3368 } | |
3369 if ( resistance == 4 ) | |
3370 { | |
898 | 3371 v14 = v3->pEquipment.uArmor; |
0 | 3372 if ( v14 ) |
3373 { | |
3374 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3375 { | |
3376 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3377 if ( v15 ) | |
3378 { | |
3379 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3380 return v18; | |
3381 v16 = (double)v18 * 0.5; | |
3382 return (signed __int64)v16; | |
3383 } | |
3384 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3385 { | |
3386 v16 = (double)v18 * 0.66670001; | |
3387 return (signed __int64)v16; | |
3388 } | |
3389 } | |
3390 } | |
3391 } | |
3392 return v18; | |
3393 } | |
3394 | |
3395 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3396 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3397 { | |
3398 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3399 } |
3400 | |
3401 //----- (0048D651) -------------------------------------------------------- | |
816 | 3402 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3403 { | |
3404 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3405 } |
3406 | |
3407 //----- (0048D676) -------------------------------------------------------- | |
3408 bool Player::IsUnarmed() | |
3409 { | |
816 | 3410 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3411 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3412 } |
3413 | |
3414 //----- (0048D6AA) -------------------------------------------------------- | |
3415 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3416 { | |
3417 auto i = pEquipment.pIndices[uEquipIndex]; | |
3418 if (i) | |
3419 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3420 else return false; | |
3421 } | |
3422 | |
3423 //----- (0048D6D0) -------------------------------------------------------- | |
3424 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3425 { | |
3426 for (uint i = 0; i < 16; ++i) | |
3427 { | |
3428 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3429 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3430 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3431 return true; | |
3432 } | |
3433 return false; | |
3434 } | |
3435 | |
3436 //----- (0048D709) -------------------------------------------------------- | |
3437 bool Player::WearsItem(int a1, signed int a2) | |
3438 { | |
3439 int v3; // edx@2 | |
3440 Player *v4; // ecx@2 | |
3441 int v6; // esi@5 | |
3442 int v7; // edx@6 | |
3443 | |
3444 if ( a2 >= 16 ) | |
3445 { | |
3446 v6 = 0; | |
3447 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3448 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3449 { |
3450 ++v6; | |
3451 if ( (signed int)v6 >= 16 ) | |
3452 return 0; | |
3453 } | |
3454 return 1; | |
3455 } | |
727 | 3456 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3457 return 1; |
3458 return 0; | |
3459 } | |
3460 | |
3461 //----- (0048D76C) -------------------------------------------------------- | |
3462 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3463 { | |
3464 unsigned __int16 v6; // cx@8 | |
3465 int v7; // edi@8 | |
3466 unsigned int v8; // ebx@8 | |
3467 unsigned int v9; // esi@8 | |
3468 int v10; // eax@8 | |
3469 int v11; // edi@12 | |
3470 bool result; // eax@13 | |
3471 | |
3472 if ( !a2 | |
3473 || this->pConditions[16] | |
3474 || this->pConditions[14] | |
3475 || this->pConditions[15] | |
3476 || this->pConditions[4] | |
3477 || this->pConditions[13] | |
3478 || this->pConditions[2] ) | |
3479 { | |
3480 result = 0; | |
3481 } | |
3482 else | |
3483 { | |
3484 v6 = this->pActiveSkills[34]; | |
3485 v7 = v6 & 0x3F; | |
3486 v8 = SkillToMastery(v6); | |
3487 v9 = a2->GetValue(); | |
3488 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3489 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3490 v9 *= 3; | |
3491 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3492 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3493 if ( rand() % 100 >= 5 ) | |
3494 { | |
3495 if ( *a6 > v11 ) | |
3496 result = *a6 - v11 < 500; | |
3497 else | |
3498 result = 2; | |
3499 } | |
3500 else | |
3501 { | |
3502 result = 0; | |
3503 } | |
3504 } | |
3505 return result; | |
3506 } | |
3507 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3508 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3509 | |
3510 //----- (0048D88B) -------------------------------------------------------- | |
3511 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3512 { | |
3513 Player *v4; // esi@1 | |
3514 Actor *v5; // edi@1 | |
3515 unsigned __int16 v6; // cx@10 | |
3516 int v7; // ebx@10 | |
3517 unsigned int v8; // esi@10 | |
3518 int v9; // eax@10 | |
3519 int v10; // esi@10 | |
3520 int v11; // eax@13 | |
3521 signed int v12; // ebx@15 | |
3522 signed int v13; // edx@15 | |
3523 int v14; // ecx@15 | |
3524 unsigned __int16 v15; // si@21 | |
3525 unsigned int v16; // ebx@24 | |
3526 int v17; // esi@24 | |
3527 const void *v18; // eax@29 | |
3528 unsigned int v19; // esi@31 | |
3529 int v20; // eax@34 | |
3530 char v21; // zf@36 | |
3531 unsigned int v22; // ST0C_4@39 | |
3532 char *v23; // esi@39 | |
3533 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3534 int v26; // [sp-8h] [bp-44h]@40 | |
3535 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3536 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3537 int v29; // [sp+30h] [bp-Ch]@10 | |
3538 int v30; // [sp+34h] [bp-8h]@10 | |
3539 Player *v31; // [sp+38h] [bp-4h]@1 | |
3540 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3541 | |
3542 v4 = this; | |
3543 v5 = &pActors[uActorID]; | |
3544 v31 = this; | |
3545 if ( &pActors[uActorID] | |
3546 && !this->pConditions[16] | |
3547 && !this->pConditions[14] | |
3548 && !this->pConditions[15] | |
3549 && !this->pConditions[4] | |
3550 && !this->pConditions[13] | |
3551 && !this->pConditions[2] ) | |
3552 { | |
3553 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3554 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3555 v6 = v4->pActiveSkills[34]; | |
3556 v7 = v6 & 0x3F; | |
3557 v8 = SkillToMastery(v6); | |
3558 v9 = rand(); | |
3559 v28 = 4 * v8; | |
3560 v30 = dword_4EDEA0[v8]; | |
3561 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3562 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3563 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3564 { | |
322 | 3565 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3566 _steal_perma = 0; |
3567 v26 = (int)v31->pName; | |
3568 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3569 } | |
3570 else | |
3571 { | |
3572 v11 = rand(); | |
3573 if ( v11 % 100 >= 40 ) | |
3574 { | |
3575 if ( v11 % 100 >= 70 ) | |
3576 { | |
3577 v19 = 0; | |
3578 if ( v7 > 0 ) | |
3579 { | |
3580 do | |
3581 { | |
3582 --v7; | |
3583 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3584 } | |
3585 while ( v7 ); | |
3586 } | |
3587 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3588 return _steal_perma; | |
377 | 3589 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3590 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3591 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3592 v21 = *(int *)v20 == v19; |
3593 *(int *)v20 -= v19; | |
3594 if ( v21 ) | |
3595 v5->array_000234[3].uItemID = 0; | |
3596 if ( v19 ) | |
3597 { | |
3598 party_finds_gold(v19, 2); | |
3599 v22 = v19; | |
3600 v23 = pTmpBuf2; | |
3601 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3602 LABEL_43: | |
3603 ShowStatusBarString(v23, 2u); | |
3604 return _steal_perma; | |
3605 } | |
3606 } | |
3607 else | |
3608 { | |
3609 v27.Reset(); | |
3610 v12 = 0; | |
3611 v13 = 0; | |
3612 v14 = (int)v5->array_000234; | |
3613 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3614 { | |
3615 ++v13; | |
3616 v14 += 36; | |
3617 if ( v13 >= 4 ) | |
3618 goto LABEL_21; | |
3619 } | |
3620 v12 = 1; | |
3621 LABEL_21: | |
3622 v15 = v5->uCarriedItemID; | |
3623 if ( v15 || v12 ) | |
3624 { | |
3625 v27.Reset(); | |
3626 if ( v15 ) | |
3627 { | |
3628 v16 = (signed __int16)v15; | |
3629 v5->uCarriedItemID = 0; | |
3630 v27.uItemID = (signed __int16)v15; | |
3631 v17 = (signed __int16)v15; | |
3632 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3633 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3634 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3635 { | |
3636 if ( v16 != 220 ) | |
570 | 3637 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3638 } |
3639 } | |
3640 else | |
3641 { | |
3642 v18 = &v5->array_000234[rand() % 4]; | |
3643 memcpy(&v27, v18, sizeof(v27)); | |
3644 ((ItemGen *)v18)->Reset(); | |
3645 v16 = v27.uItemID; | |
3646 } | |
3647 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3648 sprintf( | |
3649 pTmpBuf2, | |
3650 pGlobalTXT_LocalizationStrings[304], | |
3651 v31->pName, | |
3652 pItemsTable->pItems[v16].pUnidentifiedName); | |
3653 ShowStatusBarString(pTmpBuf2, 2u); | |
3654 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3655 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3656 pMouse->SetCursorBitmapFromItemID(v16); | |
3657 return _steal_perma; | |
3658 } | |
3659 } | |
3660 } | |
3661 v26 = (int)v31->pName; | |
3662 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3663 } | |
3664 v23 = pTmpBuf2; | |
809 | 3665 sprintfex(pTmpBuf2, v25, v26); |
0 | 3666 goto LABEL_43; |
3667 } | |
3668 return 0; | |
3669 } | |
3670 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3671 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3672 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3673 | |
3674 //----- (0048DBB9) -------------------------------------------------------- | |
3675 void Player::Heal(int amount) | |
3676 { | |
3677 Player *v2; // esi@1 | |
3678 signed int v3; // eax@3 | |
3679 | |
3680 v2 = this; | |
3681 if ( !this->pConditions[16] && !this->pConditions[14] ) | |
3682 { | |
3683 v3 = GetMaxHealth(); | |
3684 if ( v2->pConditions[17] ) | |
3685 v3 /= 2; | |
3686 v2->sHealth += amount; | |
3687 if ( v2->sHealth > v3 ) | |
3688 v2->sHealth = v3; | |
3689 if ( v2->pConditions[13] ) | |
3690 { | |
3691 if ( v2->sHealth > 0 ) | |
3692 { | |
3693 LODWORD(v2->pConditions[13]) = 0; | |
3694 HIDWORD(v2->pConditions[13]) = 0; | |
3695 } | |
3696 } | |
3697 } | |
3698 } | |
3699 | |
3700 //----- (0048DC1E) -------------------------------------------------------- | |
3701 int Player::ReceiveDamage(signed int type, int resistance) | |
3702 { | |
3703 Player *v3; // esi@1 | |
3704 signed int v4; // eax@1 | |
3705 int v5; // eax@1 | |
3706 bool v6; // ebx@1 | |
3707 unsigned int v7; // eax@8 | |
3708 char *v8; // ecx@9 | |
3709 int v9; // eax@9 | |
187 | 3710 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3711 |
3712 v3 = this; | |
3713 this->pConditions[2] = 0i64; | |
3714 v4 = CalculateIncommingDamage(resistance, type); | |
3715 v3->sHealth -= v4; | |
187 | 3716 //typea = v4; |
0 | 3717 v5 = v3->sHealth; |
3718 v6 = v5 < -10; | |
3719 LOBYTE(v6) = v5 <= -10; | |
3720 if ( v5 < 1 ) | |
3721 { | |
3722 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3723 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) | |
3724 { | |
3725 SetCondition(0xDu, 0); | |
3726 } | |
3727 else | |
3728 { | |
3729 SetCondition(0xEu, 0); | |
3730 v6 = LODWORD(pParty->uTimePlayed); | |
3731 if ( v3->sHealth > 0 ) | |
3732 v3->sHealth = 0; | |
3733 } | |
3734 if ( v6 ) | |
3735 { | |
898 | 3736 v7 = v3->pEquipment.uArmor; |
0 | 3737 if ( v7 ) |
3738 { | |
3739 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3740 v9 = *(int *)v8; | |
3741 if ( !(BYTE1(v9) & 2) ) | |
3742 { | |
3743 LOBYTE(v9) = v9 | 2; | |
3744 *(int *)v8 = v9; | |
3745 } | |
3746 } | |
3747 } | |
3748 } | |
187 | 3749 if ( v4 && CanAct() ) |
3750 PlaySound(SPEECH_24, 0); | |
3751 return v4; | |
0 | 3752 } |
3753 | |
3754 //----- (0048DCF6) -------------------------------------------------------- | |
3755 int Player::_48DCF6(int a2, Actor *pActor) | |
3756 { | |
3757 signed int v3; // edi@1 | |
3758 signed int v4; // ebx@1 | |
3759 Player *v5; // esi@1 | |
3760 int v6; // eax@2 | |
3761 int v7; // eax@5 | |
3762 int v8; // eax@8 | |
3763 int v9; // ebx@8 | |
3764 int v10; // eax@8 | |
3765 int v11; // ebx@8 | |
3766 signed int v12; // edx@9 | |
3767 ItemGen *v13; // eax@9 | |
3768 int v14; // edx@16 | |
3769 unsigned int v15; // edx@17 | |
3770 int v16; // edx@26 | |
3771 unsigned int v17; // edx@27 | |
3772 Player *v18; // ecx@32 | |
3773 signed int v19; // edx@38 | |
3774 int *v20; // ecx@38 | |
3775 signed int v21; // eax@40 | |
3776 int v22; // eax@49 | |
3777 signed int v23; // ebx@49 | |
3778 unsigned int v24; // eax@60 | |
3779 int v25; // ecx@61 | |
3780 int v26; // ebx@74 | |
3781 void *v27; // ecx@76 | |
3782 unsigned int v28; // ebx@78 | |
3783 signed int result; // eax@86 | |
3784 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3785 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3786 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3787 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3788 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3789 int v35; // [sp-Ch] [bp-ACh]@56 | |
3790 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3791 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3792 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3793 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3794 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3795 int v41; // [sp-4h] [bp-A4h]@51 | |
3796 int v42; // [sp-4h] [bp-A4h]@56 | |
3797 int v43; // [sp-4h] [bp-A4h]@57 | |
3798 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3799 int v45; // [sp-4h] [bp-A4h]@68 | |
3800 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3801 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3802 int v48; // [sp+9Ch] [bp-4h]@1 | |
3803 | |
3804 v3 = 0; | |
3805 v4 = 0; | |
3806 v5 = this; | |
3807 v47 = 0; | |
3808 v48 = 0; | |
3809 switch ( a2 ) | |
3810 { | |
3811 case 1: | |
3812 v6 = GetActualWillpower(); | |
3813 goto LABEL_46; | |
3814 case 2: | |
3815 case 3: | |
3816 case 4: | |
3817 case 9: | |
3818 case 10: | |
3819 case 11: | |
3820 case 13: | |
3821 case 21: | |
3822 v6 = GetActualEndurance(); | |
3823 goto LABEL_46; | |
3824 case 5: | |
3825 case 12: | |
3826 case 23: | |
3827 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3828 goto LABEL_5; | |
3829 case 15: | |
3830 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3831 goto LABEL_5; | |
3832 case 6: | |
3833 case 7: | |
3834 case 8: | |
3835 case 14: | |
3836 case 16: | |
3837 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3838 LABEL_5: | |
3839 v7 = GetActualResistance(v40); | |
3840 goto LABEL_47; | |
3841 case 22: | |
3842 v8 = GetActualWillpower(); | |
3843 v9 = _48EA1B_get_static_effect(v8); | |
3844 v10 = GetActualIntelligence(); | |
3845 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3846 break; | |
3847 case 17: | |
3848 v12 = 0; | |
3849 v13 = this->pInventoryItems; | |
3850 do | |
3851 { | |
315 | 3852 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3853 v46[v4++] = v12; |
3854 ++v12; | |
3855 ++v13; | |
3856 } | |
3857 while ( v12 < 138 ); | |
3858 goto LABEL_36; | |
3859 case 18: | |
3860 v14 = 0; | |
3861 do | |
3862 { | |
3863 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3864 { | |
816 | 3865 if ( v15 == EQUIP_ARMOUR ) |
898 | 3866 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3867 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3868 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3869 } |
3870 v14 = v15 + 1; | |
3871 } | |
3872 while ( v14 < 16 ); | |
3873 goto LABEL_36; | |
3874 case 19: | |
3875 v16 = 0; | |
3876 do | |
3877 { | |
3878 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3879 { | |
3880 if ( v17 == 2 ) | |
3881 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3882 if ( (!v17 || v17 == 1) | |
816 | 3883 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3884 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3885 } |
3886 v16 = v17 + 1; | |
3887 } | |
3888 while ( v16 < 16 ); | |
3889 LABEL_36: | |
3890 if ( !v4 ) | |
3891 goto LABEL_87; | |
3892 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3893 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3894 break; | |
3895 case 20: | |
3896 v19 = 0; | |
3897 v20 = this->pInventoryIndices; | |
3898 do | |
3899 { | |
3900 if ( *v20 > 0 ) | |
3901 { | |
232 | 3902 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3903 if ( v21 > 0 ) |
3904 { | |
3905 if ( v21 <= 134 ) | |
3906 v46[v4++] = v19; | |
3907 } | |
3908 } | |
3909 ++v19; | |
3910 ++v20; | |
3911 } | |
3912 while ( v19 < 126 ); | |
3913 if ( !v4 ) | |
3914 goto LABEL_87; | |
3915 v47 = (unsigned __int8)v46[rand() % v4]; | |
3916 v6 = GetActualAccuracy(); | |
3917 LABEL_46: | |
3918 v7 = _48EA1B_get_static_effect(v6); | |
3919 LABEL_47: | |
3920 v11 = v7; | |
3921 break; | |
3922 default: | |
3923 v11 = 0; | |
3924 break; | |
3925 } | |
3926 v22 = GetActualLuck(); | |
3927 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3928 if ( rand() % v23 >= 30 ) | |
3929 { | |
3930 LABEL_87: | |
3931 result = 0; | |
3932 } | |
3933 else | |
3934 { | |
3935 switch ( a2 ) | |
3936 { | |
3937 case 1: | |
3938 v41 = 1; | |
3939 v36 = 0; | |
3940 goto LABEL_56; | |
3941 case 2: | |
3942 v41 = 1; | |
3943 v36 = 1; | |
3944 goto LABEL_56; | |
3945 case 3: | |
3946 v41 = 1; | |
3947 v36 = 2; | |
3948 goto LABEL_56; | |
3949 case 23: | |
3950 v41 = 1; | |
3951 v36 = 3; | |
3952 goto LABEL_56; | |
3953 case 4: | |
3954 v41 = 1; | |
3955 v36 = 4; | |
3956 LABEL_56: | |
3957 SetCondition(v36, v41); | |
3958 v42 = 0; | |
3959 v37 = 0; | |
3960 v35 = 0; | |
3961 v34 = 0; | |
3962 v33 = -1; | |
3963 v32 = 0; | |
3964 v31 = 0; | |
3965 v30 = (SoundID)221; | |
3966 goto LABEL_83; | |
3967 case 5: | |
3968 v43 = 1; | |
3969 v38 = 5; | |
3970 goto LABEL_70; | |
3971 case 6: | |
3972 case 7: | |
3973 case 8: | |
3974 if ( a2 == 6 ) | |
3975 { | |
3976 v44 = 6; | |
3977 goto LABEL_60; | |
3978 } | |
3979 v25 = 2 * (a2 != 8) + 8; | |
3980 goto LABEL_65; | |
3981 case 9: | |
3982 if ( a2 == 6 ) | |
3983 { | |
3984 v44 = 7; | |
3985 LABEL_60: | |
3986 v24 = v44; | |
3987 } | |
3988 else | |
3989 { | |
3990 v25 = 2 * (a2 != 8) + 9; | |
3991 LABEL_65: | |
3992 v24 = v25; | |
3993 } | |
3994 SetCondition(v24, 1); | |
3995 v42 = 0; | |
3996 v37 = 0; | |
3997 v35 = 0; | |
3998 v34 = 0; | |
3999 v33 = -1; | |
4000 v32 = 0; | |
4001 v31 = 0; | |
4002 v30 = (SoundID)222; | |
4003 LABEL_83: | |
4004 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
4005 do | |
4006 { | |
4007 LABEL_84: | |
4008 if ( v5 == pPlayers[v3 + 1] ) | |
4009 break; | |
4010 ++v3; | |
4011 } | |
4012 while ( v3 < 4 ); | |
4013 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
4014 result = 1; | |
4015 break; | |
4016 case 12: | |
4017 v43 = 1; | |
4018 v38 = 12; | |
4019 goto LABEL_70; | |
4020 case 15: | |
4021 v45 = 1; | |
4022 v39 = 15; | |
4023 goto LABEL_73; | |
4024 case 13: | |
4025 v43 = 1; | |
4026 v38 = 13; | |
4027 LABEL_70: | |
4028 SetCondition(v38, v43); | |
4029 v42 = 0; | |
4030 v37 = 0; | |
4031 v35 = 0; | |
4032 v34 = 0; | |
4033 v33 = -1; | |
4034 v32 = 0; | |
4035 v31 = 0; | |
4036 v30 = (SoundID)224; | |
4037 goto LABEL_83; | |
4038 case 14: | |
4039 v45 = 1; | |
4040 v39 = 14; | |
4041 goto LABEL_73; | |
4042 case 16: | |
4043 v45 = 1; | |
4044 v39 = 16; | |
4045 LABEL_73: | |
4046 SetCondition(v39, v45); | |
4047 v42 = 0; | |
4048 v37 = 0; | |
4049 v35 = 0; | |
4050 v34 = 0; | |
4051 v33 = -1; | |
4052 v32 = 0; | |
4053 v31 = 0; | |
4054 v30 = (SoundID)225; | |
4055 goto LABEL_83; | |
4056 case 17: | |
4057 case 18: | |
4058 case 19: | |
4059 v26 = v48; | |
4060 if ( *(char *)(v48 + 21) & 2 ) | |
4061 goto LABEL_84; | |
187 | 4062 PlaySound(SPEECH_40, 0); |
0 | 4063 *(int *)(v26 + 20) |= 2u; |
4064 goto LABEL_79; | |
4065 case 20: | |
187 | 4066 PlaySound(SPEECH_40, 0); |
0 | 4067 v27 = pActor->array_000234; |
4068 if ( pActor->array_000234[0].uItemID ) | |
4069 { | |
4070 v27 = &pActor->array_000234[1]; | |
4071 if ( pActor->array_000234[1].uItemID ) | |
4072 goto LABEL_84; | |
4073 } | |
4074 v28 = v47; | |
654 | 4075 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 4076 RemoveItemAtInventoryIndex(v28); |
4077 LABEL_79: | |
4078 v42 = 0; | |
4079 v37 = 0; | |
4080 v35 = 0; | |
4081 v34 = 0; | |
4082 v33 = -1; | |
4083 v32 = 0; | |
4084 v31 = 0; | |
4085 v30 = (SoundID)47; | |
4086 goto LABEL_83; | |
4087 case 21: | |
187 | 4088 PlaySound(SPEECH_42, 0); |
0 | 4089 ++v5->sAgeModifier; |
4090 goto LABEL_82; | |
4091 case 22: | |
187 | 4092 PlaySound(SPEECH_41, 0); |
0 | 4093 v5->sMana = 0; |
4094 LABEL_82: | |
4095 v42 = 0; | |
4096 v37 = 0; | |
4097 v35 = 0; | |
4098 v34 = 0; | |
4099 v33 = -1; | |
4100 v32 = 0; | |
4101 v31 = 0; | |
4102 v30 = (SoundID)226; | |
4103 goto LABEL_83; | |
4104 default: | |
4105 goto LABEL_87; | |
4106 } | |
4107 } | |
4108 return result; | |
4109 } | |
324 | 4110 |
0 | 4111 // 48DCF6: using guessed type char var_94[140]; |
4112 | |
4113 //----- (0048E1A3) -------------------------------------------------------- | |
4114 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4115 { | |
4116 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4117 } | |
4118 | |
4119 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4120 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4121 { | |
4122 ItemGen *weapon = nullptr; | |
4123 ItemDesc *weapon_desc = nullptr; | |
4124 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4125 if (bRangedAttack) | |
0 | 4126 { |
4127 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4128 goto LABEL_17; | |
816 | 4129 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4130 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4131 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4132 goto LABEL_17; | |
4133 } | |
4134 else if ( IsUnarmed() == 1 ) | |
4135 { | |
4136 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4137 { | |
4138 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4139 goto LABEL_17; |
4140 } | |
4141 } | |
816 | 4142 |
4143 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4144 { | |
4145 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4146 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4147 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4148 { | |
4149 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4150 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4151 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4152 } | |
0 | 4153 else |
816 | 4154 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4155 } | |
4156 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
4157 { | |
898 | 4158 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4159 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4160 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4161 { | |
898 | 4162 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4163 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4164 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4165 } | |
4166 } | |
4167 | |
0 | 4168 LABEL_17: |
816 | 4169 uint armour_recovery = 0; |
0 | 4170 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4171 { | |
898 | 4172 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4173 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4174 | |
4175 float armour_recovery_multipliers[4]; | |
4176 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4177 { | |
4178 armour_recovery_multipliers[0] = 1.0f; | |
4179 armour_recovery_multipliers[1] = 0; | |
4180 armour_recovery_multipliers[2] = 0; | |
4181 armour_recovery_multipliers[3] = 0; | |
4182 } | |
4183 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4184 { | |
4185 armour_recovery_multipliers[0] = 1.0f; | |
4186 armour_recovery_multipliers[1] = 0.5f; | |
4187 armour_recovery_multipliers[2] = 0; | |
4188 armour_recovery_multipliers[3] = 0; | |
4189 } | |
4190 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4191 { | |
4192 armour_recovery_multipliers[0] = 1.0f; | |
4193 armour_recovery_multipliers[1] = 0.5f; | |
4194 armour_recovery_multipliers[2] = 0.5f; | |
4195 armour_recovery_multipliers[3] = 0; | |
0 | 4196 } |
4197 else | |
4198 { | |
816 | 4199 assert(false && "Unknown armour type"); // what kind of armour is that? |
4200 armour_recovery_multipliers[0] = 1.0f; | |
4201 armour_recovery_multipliers[1] = 1.0f; | |
4202 armour_recovery_multipliers[2] = 1.0f; | |
4203 armour_recovery_multipliers[3] = 1.0f; | |
4204 } | |
4205 | |
4206 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4207 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4208 } | |
4209 | |
4210 uint shield_recovery = 0; | |
4211 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4212 { | |
4213 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4214 | |
898 | 4215 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4216 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4217 | |
4218 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4219 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4220 } | |
4221 | |
4222 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4223 sword_axe_bow_recovery_reduction = 0; | |
4224 bool shooting_laser = false; | |
4225 if (weapon_desc) | |
4226 { | |
4227 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4228 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4229 { | |
4230 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4231 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4232 } | |
4233 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4234 shooting_laser = true; | |
4235 } | |
4236 | |
4237 uint armsmaster_recovery_reduction = 0; | |
4238 if (!bRangedAttack && !shooting_laser) | |
4239 { | |
4240 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4241 { | |
4242 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4243 if (SkillToMastery(armsmaster_level) >= 4) | |
4244 armsmaster_recovery_reduction *= 2; | |
4245 } | |
4246 } | |
4247 | |
4248 uint v41 = 0; | |
4249 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4250 v41 = 25; |
816 | 4251 |
4252 uint weapon_enchantment_recovery_reduction = 0; | |
4253 if ( weapon ) | |
4254 { | |
4255 if (weapon->uSpecEnchantmentType == 59 || | |
4256 weapon->uSpecEnchantmentType == 41 || | |
4257 weapon->uSpecEnchantmentType == 500) | |
4258 weapon_enchantment_recovery_reduction = 20; | |
4259 } | |
4260 | |
4261 | |
4262 int recovery = weapon_recovery + | |
4263 armour_recovery + | |
4264 shield_recovery | |
4265 - armsmaster_recovery_reduction | |
4266 - weapon_enchantment_recovery_reduction | |
4267 - v41 | |
4268 - sword_axe_bow_recovery_reduction | |
4269 - player_speed_recovery_reduction; | |
4270 | |
4271 if (recovery < 0) | |
4272 recovery = 0; | |
4273 return recovery; | |
0 | 4274 } |
4275 | |
4276 //----- (0048E4F8) -------------------------------------------------------- | |
4277 int Player::GetMaxHealth() | |
4278 { | |
4279 int v3; // esi@1 | |
4280 int v4; // esi@1 | |
4281 int v6; // esi@1 | |
4282 | |
4283 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4284 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4285 v6 = uFullHealthBonus |
135 | 4286 + pBaseHealthByClass[classType / 4] |
0 | 4287 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4288 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4289 if (v6 <= 0) | |
4290 return 1; | |
4291 return v6; | |
4292 } | |
4293 | |
4294 //----- (0048E565) -------------------------------------------------------- | |
4295 int Player::GetMaxMana() | |
4296 { | |
4297 int v2; // eax@2 | |
4298 int v3; // esi@4 | |
4299 int v4; // eax@5 | |
4300 int v5; // esi@5 | |
4301 int v6; // eax@5 | |
4302 int v7; // esi@6 | |
4303 int v8; // esi@6 | |
4304 int v9; // esi@6 | |
4305 int result; // eax@7 | |
4306 | |
135 | 4307 switch (classType) |
0 | 4308 { |
4309 case 5u: | |
4310 case 6u: | |
4311 case 7u: | |
4312 case 0x10u: | |
4313 case 0x11u: | |
4314 case 0x12u: | |
4315 case 0x13u: | |
4316 case 0x20u: | |
4317 case 0x21u: | |
4318 case 0x22u: | |
4319 case 0x23u: | |
4320 v2 = GetActualIntelligence(); | |
4321 v3 = _48EA1B_get_static_effect(v2); | |
4322 goto LABEL_6; | |
4323 case 9u: | |
4324 case 0xAu: | |
4325 case 0xBu: | |
4326 case 0xCu: | |
4327 case 0xDu: | |
4328 case 0xEu: | |
4329 case 0xFu: | |
4330 case 0x18u: | |
4331 case 0x19u: | |
4332 case 0x1Au: | |
4333 case 0x1Bu: | |
4334 v2 = GetActualWillpower(); | |
4335 v3 = _48EA1B_get_static_effect(v2); | |
4336 goto LABEL_6; | |
4337 case 0x15u: | |
4338 case 0x16u: | |
4339 case 0x17u: | |
4340 case 0x1Cu: | |
4341 case 0x1Du: | |
4342 case 0x1Eu: | |
4343 case 0x1Fu: | |
4344 v4 = GetActualWillpower(); | |
4345 v5 = _48EA1B_get_static_effect(v4); | |
4346 v6 = GetActualIntelligence(); | |
4347 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4348 LABEL_6: | |
135 | 4349 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4350 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4351 v9 = uFullManaBonus | |
135 | 4352 + pBaseManaByClass[classType / 4] |
0 | 4353 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4354 + v8; | |
4355 if ( v9 < 1 ) | |
4356 goto LABEL_7; | |
4357 result = v9; | |
4358 break; | |
4359 default: | |
4360 LABEL_7: | |
4361 result = 0; | |
4362 break; | |
4363 } | |
4364 return result; | |
4365 } | |
4366 | |
4367 //----- (0048E656) -------------------------------------------------------- | |
4368 int Player::GetBaseAC() | |
4369 { | |
4370 Player *v1; // edi@1 | |
4371 int v2; // eax@1 | |
4372 int v3; // esi@1 | |
4373 int v4; // esi@1 | |
4374 int v5; // esi@1 | |
4375 int result; // eax@2 | |
4376 | |
4377 v1 = this; | |
4378 v2 = GetActualSpeed(); | |
4379 v3 = _48EA1B_get_static_effect(v2); | |
4380 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4381 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4382 if ( v5 >= 1 ) | |
4383 result = v5; | |
4384 else | |
4385 result = 0; | |
4386 return result; | |
4387 } | |
4388 | |
4389 //----- (0048E68F) -------------------------------------------------------- | |
4390 int Player::GetActualAC() | |
4391 { | |
4392 Player *v1; // edi@1 | |
4393 int v2; // eax@1 | |
4394 int v3; // esi@1 | |
4395 int v4; // esi@1 | |
4396 int v5; // esi@1 | |
4397 int v6; // esi@1 | |
4398 int result; // eax@2 | |
4399 | |
4400 v1 = this; | |
4401 v2 = GetActualSpeed(); | |
4402 v3 = _48EA1B_get_static_effect(v2); | |
4403 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4404 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4405 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4406 if ( v6 >= 1 ) | |
4407 result = v6; | |
4408 else | |
4409 result = 0; | |
4410 return result; | |
4411 } | |
4412 | |
4413 //----- (0048E6DC) -------------------------------------------------------- | |
4414 unsigned int Player::GetBaseAge() | |
4415 { | |
352 | 4416 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4417 } |
4418 | |
4419 //----- (0048E72C) -------------------------------------------------------- | |
4420 unsigned int Player::GetActualAge() | |
4421 { | |
4422 return this->sAgeModifier + GetBaseAge(); | |
4423 } | |
4424 | |
4425 //----- (0048E73F) -------------------------------------------------------- | |
4426 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4427 { | |
4428 Player *v2; // ebx@1 | |
4429 signed int v3; // esi@1 | |
4430 enum CHARACTER_RACE v4; // eax@1 | |
4431 signed int v5; // edi@8 | |
4432 char v6; // zf@9 | |
4433 int v7; // esi@20 | |
4434 int result; // eax@21 | |
4435 signed int v9; // [sp-4h] [bp-10h]@11 | |
4436 | |
4437 v2 = this; | |
4438 v3 = 0; | |
4439 v4 = GetRace(); | |
4440 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4441 { | |
4442 v5 = 0; | |
4443 goto LABEL_16; | |
4444 } | |
4445 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4446 { | |
4447 v5 = 1; | |
4448 LABEL_16: | |
4449 v6 = v4 == 2; | |
4450 goto LABEL_17; | |
4451 } | |
4452 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4453 { | |
4454 v6 = v4 == 3; | |
4455 v5 = 2; | |
4456 goto LABEL_17; | |
4457 } | |
4458 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4459 { | |
4460 v5 = 3; | |
4461 v6 = v4 == 3; | |
4462 goto LABEL_17; | |
4463 } | |
4464 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4465 { | |
4466 v5 = 7; | |
4467 if ( v4 != 1 ) | |
4468 goto LABEL_20; | |
4469 v9 = 10; | |
4470 LABEL_19: | |
4471 v3 = v9; | |
4472 goto LABEL_20; | |
4473 } | |
4474 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4475 { | |
4476 v5 = 8; | |
4477 v6 = v4 == 0; | |
4478 LABEL_17: | |
4479 if ( !v6 ) | |
4480 goto LABEL_20; | |
4481 v9 = 5; | |
4482 goto LABEL_19; | |
4483 } | |
4484 v5 = 0; | |
4485 LABEL_20: | |
4486 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4487 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4488 result = v7 + *(&v2->sResFireBase + v5); |
4489 return result; | |
4490 } | |
4491 | |
4492 //----- (0048E7D0) -------------------------------------------------------- | |
4493 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4494 { | |
4495 signed int v2; // edi@1 | |
4496 Player *v3; // esi@1 | |
4497 enum CHARACTER_RACE v4; // ebx@1 | |
4498 Player *v5; // ecx@8 | |
4499 char v6; // zf@18 | |
4500 int v7; // ebx@28 | |
4501 int result; // eax@28 | |
4502 signed int v9; // [sp+10h] [bp-8h]@1 | |
4503 signed int v10; // [sp+14h] [bp-4h]@1 | |
4504 | |
4505 v2 = 0; | |
4506 v3 = this; | |
4507 v10 = 0; | |
4508 v9 = 0; | |
4509 v4 = GetRace(); | |
652 | 4510 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4511 v10 = 20; |
4512 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4513 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4514 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4515 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4516 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4517 && HasItemEquipped(EQUIP_ARMOUR) | |
4518 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4519 v10 += v3->pActiveSkills[9] & 0x3F; | |
4520 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4521 goto LABEL_25; | |
4522 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4523 { | |
4524 v2 = 1; | |
4525 LABEL_25: | |
4526 v6 = v4 == 2; | |
4527 LABEL_26: | |
4528 if ( v6 ) | |
4529 v9 = 5; | |
4530 goto LABEL_28; | |
4531 } | |
4532 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4533 { | |
4534 v6 = v4 == 3; | |
4535 v2 = 2; | |
4536 goto LABEL_26; | |
4537 } | |
4538 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4539 { | |
4540 v2 = 3; | |
4541 if ( v4 == 3 ) | |
4542 v10 += 5; | |
4543 } | |
4544 else | |
4545 { | |
4546 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4547 { | |
4548 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4549 goto LABEL_28; | |
4550 v2 = 8; | |
4551 v6 = v4 == 0; | |
4552 goto LABEL_26; | |
4553 } | |
4554 v2 = 7; | |
4555 if ( v4 == 1 ) | |
4556 v9 = 10; | |
4557 } | |
4558 LABEL_28: | |
4559 v7 = GetItemsBonus(a2, 0); | |
4560 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4561 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4562 { |
4563 if ( result > 200 ) | |
4564 result = 200; | |
4565 } | |
4566 return result; | |
4567 } | |
4568 | |
4569 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4570 bool Player::Recover(int dt) |
4571 { | |
4572 //Player *v2; // esi@1 | |
0 | 4573 signed __int64 v3; // qax@1 |
816 | 4574 //bool result; // eax@4 |
4575 | |
4576 //v2 = this; | |
4577 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4578 | |
4579 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4580 | |
4581 if (uTimeToRecovery > v3) | |
4582 { | |
4583 uTimeToRecovery -= v3; | |
4584 return true; | |
0 | 4585 } |
4586 else | |
4587 { | |
816 | 4588 uTimeToRecovery = 0; |
4589 viewparams->bRedrawGameUI = true; | |
4590 if (!uActiveCharacter) | |
0 | 4591 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4592 return false; |
4593 } | |
0 | 4594 } |
4595 | |
4596 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4597 void Player::SetRecoveryTime(signed int rec) |
4598 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4599 assert(rec >= 0); |
816 | 4600 |
4601 if (rec > uTimeToRecovery) | |
4602 uTimeToRecovery = rec; | |
4603 | |
4604 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4605 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4606 |
4607 viewparams->bRedrawGameUI = true; | |
0 | 4608 } |
4609 // 50C0C4: using guessed type int some_active_character; | |
4610 | |
4611 //----- (0048E9B7) -------------------------------------------------------- | |
4612 void Player::RandomizeName() | |
4613 { | |
4614 if (!uExpressionTimePassed) | |
4615 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4616 } | |
4617 | |
4618 //----- (0048E9F4) -------------------------------------------------------- | |
4619 unsigned int Player::GetMajorConditionIdx() | |
4620 { | |
4621 for (uint i = 0; i < 18; ++i) | |
4622 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4623 return pConditionImportancyTable[i]; | |
4624 | |
4625 return 18; | |
4626 } | |
4627 | |
4628 //----- (0048EA1B) -------------------------------------------------------- | |
4629 int Player::_48EA1B_get_static_effect(int a2) | |
4630 { | |
4631 __int16 v2; // cx@1 | |
4632 int v3; // eax@1 | |
4633 | |
4634 v2 = word_4EDFFC[0]; | |
4635 v3 = 0; | |
4636 while ( a2 < v2 && v2 ) | |
4637 v2 = word_4EDFFC[v3++ + 1]; | |
4638 return player_stat_bonuses[v3]; | |
4639 } | |
4640 | |
4641 //----- (0048EA46) -------------------------------------------------------- | |
4642 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4643 { | |
4644 int v3; // esi@1 | |
4645 int v4; // edx@2 | |
4646 int v5; // eax@3 | |
4647 char *v6; // eax@4 | |
4648 | |
4649 v3 = 0; | |
4650 while ( 1 ) | |
4651 { | |
4652 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4653 goto LABEL_11; | |
816 | 4654 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4655 if ( a2 != 17 ) |
816 | 4656 { |
4657 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4658 goto LABEL_11; | |
4659 return 5; | |
4660 } | |
0 | 4661 v6 = (char *)this + 36 * v5; |
4662 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4663 return 50; | |
4664 LABEL_11: | |
4665 ++v3; | |
4666 if ( (signed int)v3 >= 16 ) | |
816 | 4667 return 0; |
4668 } | |
0 | 4669 } |
4670 | |
4671 //----- (0048EAAE) -------------------------------------------------------- | |
4672 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4673 { | |
4674 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4675 signed int v4; // eax@1 | |
4676 int v5; // edi@1 | |
4677 Player *v6; // ebx@1 | |
4678 Player *v8; // ecx@48 | |
4679 int v9; // eax@49 | |
4680 int v10; // edx@49 | |
4681 Player *v11; // ecx@55 | |
4682 int v12; // eax@56 | |
4683 int v13; // edx@56 | |
4684 int v14; // ecx@58 | |
4685 int v15; // eax@58 | |
4686 Player *v16; // ecx@61 | |
4687 int v17; // eax@62 | |
4688 Player *v18; // ecx@66 | |
4689 int v19; // eax@67 | |
4690 int v20; // eax@69 | |
4691 Player *v21; // ecx@75 | |
4692 int v22; // eax@76 | |
4693 int v23; // edx@76 | |
4694 int v24; // eax@79 | |
4695 int v25; // ecx@80 | |
4696 int v26; // edi@80 | |
4697 Player *v27; // ecx@84 | |
4698 int v28; // eax@85 | |
4699 int v29; // edx@85 | |
4700 Player *v30; // ecx@96 | |
4701 int v31; // ebp@97 | |
4702 int v32; // eax@98 | |
4703 unsigned int v33; // eax@100 | |
4704 int v34; // eax@103 | |
4705 char v35; // zf@104 | |
4706 char v36; // zf@107 | |
4707 unsigned __int8 v37; // zf@119 | |
4708 char v38; // sf@119 | |
4709 unsigned __int8 v39; // of@119 | |
4710 char v40; // zf@122 | |
4711 char v41; // zf@145 | |
4712 char v42; // zf@164 | |
4713 char v43; // zf@173 | |
4714 char v44; // zf@189 | |
4715 char v45; // zf@198 | |
4716 char v46; // zf@239 | |
4717 int v47; // eax@268 | |
4718 int v48; // eax@269 | |
4719 int v49; // eax@291 | |
4720 char v50; // zf@295 | |
4721 int v51; // eax@306 | |
4722 int v52; // eax@307 | |
4723 char v53; // zf@312 | |
4724 char v54; // zf@336 | |
4725 char v55; // zf@348 | |
4726 int v56; // eax@365 | |
4727 int v57; // ebx@368 | |
4728 signed int v58; // [sp-4h] [bp-20h]@10 | |
4729 signed int v59; // [sp-4h] [bp-20h]@71 | |
4730 signed int v60; // [sp-4h] [bp-20h]@347 | |
4731 int v61; // [sp+10h] [bp-Ch]@1 | |
4732 int v62; // [sp+14h] [bp-8h]@1 | |
4733 int v63; // [sp+18h] [bp-4h]@101 | |
4734 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4735 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4736 | |
4737 v3 = attr; | |
4738 v4 = 36; | |
4739 v5 = 0; | |
4740 v6 = this; | |
4741 v62 = 0; | |
4742 v61 = 0; | |
4743 | |
4744 switch (attr) | |
4745 { | |
4746 case CHARACTER_ATTRIBUTE_LEVEL: | |
4747 if (HasEnchantedItemEquipped(25)) | |
4748 return 5; | |
4749 return 0; | |
4750 }; | |
4751 | |
4752 if ( (signed int)attr > 36 ) | |
4753 { | |
4754 switch ( attr ) | |
4755 { | |
4756 case 37: | |
4757 v58 = 15; | |
4758 goto LABEL_35; | |
4759 case 38: | |
4760 v58 = 16; | |
4761 goto LABEL_35; | |
4762 case 39: | |
4763 v58 = 17; | |
4764 goto LABEL_35; | |
4765 case 40: | |
4766 v58 = 18; | |
4767 goto LABEL_35; | |
4768 case 41: | |
4769 v58 = 19; | |
4770 goto LABEL_35; | |
4771 case 42: | |
4772 v58 = 20; | |
4773 goto LABEL_35; | |
4774 case 43: | |
4775 v58 = 25; | |
4776 goto LABEL_35; | |
4777 case 44: | |
4778 v58 = 5; | |
4779 goto LABEL_35; | |
4780 case 45: | |
4781 v58 = 8; | |
4782 goto LABEL_35; | |
4783 case 46: | |
4784 goto LABEL_36; | |
4785 default: | |
4786 break; | |
4787 } | |
4788 } | |
4789 else | |
4790 { | |
4791 if ( attr == 36 ) | |
4792 { | |
4793 v58 = 14; | |
4794 } | |
4795 else | |
4796 { | |
4797 if ( (signed int)attr > 21 ) | |
4798 { | |
4799 switch ( attr ) | |
4800 { | |
4801 case 22: | |
4802 v58 = 30; | |
4803 break; | |
4804 case 23: | |
4805 v58 = 31; | |
4806 break; | |
4807 case 34: | |
4808 v58 = 12; | |
4809 break; | |
4810 default: | |
4811 if ( attr != 35 ) | |
4812 goto LABEL_38; | |
4813 v58 = 13; | |
4814 break; | |
4815 } | |
4816 } | |
4817 else | |
4818 { | |
4819 switch ( attr ) | |
4820 { | |
4821 case 21: | |
4822 v58 = 33; | |
4823 break; | |
4824 case 16: | |
4825 v58 = 35; | |
4826 break; | |
4827 case 17: | |
4828 v58 = 34; | |
4829 break; | |
4830 case 18: | |
4831 v58 = 29; | |
4832 break; | |
4833 case 19: | |
4834 v58 = 21; | |
4835 break; | |
4836 default: | |
4837 if ( attr != 20 ) | |
4838 goto LABEL_38; | |
4839 v58 = 32; | |
4840 break; | |
4841 } | |
4842 } | |
4843 } | |
4844 LABEL_35: | |
4845 v4 = v58; | |
4846 LABEL_36: | |
4847 if ( !this->pActiveSkills[v4] ) | |
4848 return 0; | |
4849 } | |
4850 LABEL_38: | |
4851 if ( (signed int)attr > 28 ) | |
4852 { | |
4853 if ( (signed int)attr < 29 ) | |
4854 return v5 + v62 + v61; | |
4855 if ( (signed int)attr <= 30 ) | |
4856 { | |
4857 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4858 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4859 return v5 + v62 + v61; |
4860 } | |
4861 if ( attr == 31 ) | |
4862 { | |
4863 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4864 return v5 + v62 + v61; | |
232 | 4865 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4866 v5 = pItemsTable->pItems[v57].uDamageMod; |
4867 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4868 goto LABEL_366; | |
4869 } | |
4870 if ( attr == 32 ) | |
4871 { | |
4872 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4873 return v5 + v62 + v61; | |
232 | 4874 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4875 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4876 LABEL_365: | |
4877 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4878 LABEL_366: | |
4879 v5 += v56; | |
4880 return v5 + v62 + v61; | |
4881 } | |
4882 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4883 return v5 + v62 + v61; | |
4884 LABEL_95: | |
4885 v65 = 0; | |
4886 while ( 1 ) | |
4887 { | |
4888 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4889 goto LABEL_361; | |
898 | 4890 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4891 if ( v3 == 9 ) |
4892 { | |
816 | 4893 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4894 if ( v32 >= 3 ) |
4895 { | |
4896 if ( v32 <= 11 ) | |
4897 { | |
4898 v33 = v6->pInventoryItems[v31].uItemID; | |
4899 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4900 } | |
4901 } | |
4902 } | |
4903 v63 = (int)((char *)v6 + 36 * v31); | |
4904 attra = (ItemGen *)(v63 + 532); | |
377 | 4905 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4906 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4907 { |
4908 v34 = attra->uItemID; | |
4909 switch ( attra->uItemID ) | |
4910 { | |
4911 case 0x1F4u: | |
4912 v35 = v3 == 5; | |
4913 goto LABEL_105; | |
4914 case 0x1F5u: | |
4915 v36 = v3 == 0; | |
4916 goto LABEL_108; | |
4917 case 0x1F6u: | |
4918 if ( v3 == 21 ) | |
4919 v61 += 10; | |
4920 v36 = v3 == 2; | |
4921 goto LABEL_108; | |
4922 case 0x1F7u: | |
4923 if ( v3 == 17 ) | |
4924 v61 += 5; | |
4925 if ( v3 == 18 ) | |
4926 v61 += 5; | |
4927 v36 = v3 == 6; | |
4928 goto LABEL_108; | |
4929 case 0x1F8u: | |
4930 goto LABEL_118; | |
4931 case 0x1F9u: | |
4932 v40 = v3 == 3; | |
4933 goto LABEL_123; | |
4934 case 0x1FAu: | |
4935 v35 = v3 == 10; | |
4936 goto LABEL_105; | |
4937 case 0x1FEu: | |
4938 v35 = v3 == 4; | |
4939 goto LABEL_105; | |
4940 case 0x1FFu: | |
4941 if ( v3 == 23 ) | |
4942 v61 += 10; | |
4943 if ( v3 == 22 ) | |
4944 v61 += 10; | |
4945 goto LABEL_361; | |
4946 case 0x200u: | |
4947 if ( v3 == 36 ) | |
4948 { | |
4949 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4950 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4951 } | |
4952 v36 = v3 == 5; | |
4953 LABEL_108: | |
4954 if ( v36 ) | |
4955 v5 += 40; | |
4956 goto LABEL_361; | |
4957 case 0x201u: | |
4958 if ( v3 == 39 ) | |
4959 { | |
4960 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4961 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4962 v62 = v34; | |
4963 } | |
4964 goto LABEL_136; | |
4965 case 0x202u: | |
4966 if ( !v3 ) | |
4967 v5 += 150; | |
4968 if ( v3 == 1 ) | |
4969 v5 -= 40; | |
4970 if ( v3 == 2 ) | |
4971 v5 -= 40; | |
4972 goto LABEL_145; | |
4973 case 0x203u: | |
4974 if ( v3 == 42 ) | |
4975 { | |
4976 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4977 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4978 } | |
4979 if ( v3 == 43 ) | |
4980 v61 += 15; | |
4981 goto LABEL_361; | |
4982 case 0x204u: | |
4983 if ( v3 == 17 ) | |
4984 v61 += 5; | |
4985 if ( v3 == 18 ) | |
4986 v61 += 5; | |
4987 if ( v3 == 6 ) | |
4988 v5 += 50; | |
4989 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4990 goto LABEL_166; | |
4991 v42 = v3 == 15; | |
4992 goto LABEL_165; | |
4993 case 0x205u: | |
4994 if ( v3 == 18 ) | |
4995 v61 += 5; | |
4996 goto LABEL_361; | |
4997 case 0x206u: | |
4998 if ( !v3 ) | |
4999 v5 += 100; | |
5000 if ( v3 == 3 ) | |
5001 v5 += 100; | |
5002 v43 = v3 == 9; | |
5003 goto LABEL_174; | |
5004 case 0x207u: | |
5005 if ( v3 == 45 ) | |
5006 v61 += 5; | |
5007 if ( v3 == 15 ) | |
5008 v5 -= 10; | |
5009 v42 = v3 == 14; | |
5010 LABEL_165: | |
5011 if ( v42 ) | |
5012 LABEL_166: | |
5013 v5 -= 10; | |
5014 goto LABEL_361; | |
5015 case 0x208u: | |
5016 v35 = v3 == 3; | |
5017 goto LABEL_105; | |
5018 case 0x209u: | |
5019 if ( v3 == 2 ) | |
5020 v5 += 15; | |
5021 if ( !v3 ) | |
5022 v5 += 15; | |
5023 v41 = v3 == 6; | |
5024 goto LABEL_146; | |
5025 case 0x20Au: | |
5026 if ( v3 == 46 ) | |
5027 v61 += 15; | |
5028 v44 = v3 == 3; | |
5029 goto LABEL_190; | |
5030 case 0x20Bu: | |
5031 if ( v3 == 34 ) | |
5032 { | |
5033 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5034 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5035 } | |
5036 if ( v3 == 12 ) | |
5037 v5 += 50; | |
5038 if ( v3 == 2 ) | |
5039 v5 += 30; | |
5040 v45 = v3 == 9; | |
5041 goto LABEL_199; | |
5042 case 0x20Cu: | |
5043 if ( !v3 ) | |
5044 v5 += 75; | |
5045 goto LABEL_145; | |
5046 case 0x20Du: | |
5047 if ( v3 == 5 ) | |
5048 v5 += 50; | |
5049 if ( v3 == 6 ) | |
5050 v5 += 50; | |
5051 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5052 goto LABEL_374; | |
5053 v43 = v3 == 15; | |
5054 LABEL_174: | |
5055 if ( v43 ) | |
5056 LABEL_374: | |
5057 v5 -= 15; | |
5058 goto LABEL_361; | |
5059 case 0x20Eu: | |
5060 if ( v3 == 4 ) | |
5061 v5 += 150; | |
5062 if ( v3 == 44 ) | |
5063 v61 += 5; | |
5064 if ( v3 == 9 ) | |
5065 v5 -= 25; | |
5066 goto LABEL_361; | |
5067 case 0x20Fu: | |
5068 if ( v3 == 39 ) | |
5069 { | |
5070 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5071 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5072 v62 = v34; | |
5073 } | |
5074 if ( v3 == 40 ) | |
5075 { | |
5076 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5077 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5078 } | |
5079 LABEL_145: | |
5080 v41 = v3 == 5; | |
5081 LABEL_146: | |
5082 if ( v41 ) | |
5083 v5 -= 40; | |
5084 goto LABEL_361; | |
5085 case 0x210u: | |
5086 if ( v3 == 38 ) | |
5087 { | |
5088 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5089 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5090 } | |
5091 if ( !v3 ) | |
5092 v5 += 75; | |
5093 v44 = v3 == 11; | |
5094 LABEL_190: | |
5095 if ( v44 ) | |
5096 v5 -= 50; | |
5097 goto LABEL_361; | |
5098 case 0x211u: | |
5099 if ( v3 == 5 ) | |
5100 v5 += 100; | |
5101 if ( v3 == 4 ) | |
5102 v5 += 50; | |
5103 v35 = v3 == 11; | |
5104 LABEL_105: | |
5105 if ( v35 ) | |
5106 v5 += 50; | |
5107 goto LABEL_361; | |
5108 case 0x212u: | |
5109 if ( v3 == 1 ) | |
5110 v5 -= 20; | |
5111 v45 = v3 == 2; | |
5112 LABEL_199: | |
5113 if ( v45 ) | |
5114 v5 -= 20; | |
5115 goto LABEL_361; | |
5116 case 0x214u: | |
5117 if ( v3 == 1 ) | |
5118 v5 += 15; | |
5119 v46 = v3 == 2; | |
5120 goto LABEL_240; | |
5121 case 0x215u: | |
5122 if ( v3 == 5 ) | |
5123 v5 += 15; | |
5124 v46 = v3 == 4; | |
5125 goto LABEL_240; | |
5126 case 0x216u: | |
5127 if ( v3 == 10 ) | |
5128 v5 += 30; | |
5129 if ( !v3 ) | |
5130 v5 += 15; | |
5131 goto LABEL_315; | |
5132 case 0x217u: | |
5133 if ( v3 == 21 ) | |
5134 v61 += 5; | |
5135 if ( !v3 ) | |
5136 v5 += 15; | |
5137 goto LABEL_253; | |
5138 case 0x218u: | |
5139 goto LABEL_253; | |
5140 default: | |
5141 goto LABEL_361; | |
5142 } | |
5143 goto LABEL_361; | |
5144 } | |
5145 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5146 { | |
5147 if ( (signed int)v3 >= 0 ) | |
5148 { | |
5149 if ( (signed int)v3 <= 15 ) | |
5150 { | |
5151 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5152 } | |
5153 else | |
5154 { | |
5155 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5156 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5157 } | |
5158 } | |
5159 goto LABEL_361; | |
5160 } | |
5161 v34 = *(int *)(v63 + 544); | |
5162 if ( v34 > 48 ) | |
5163 { | |
5164 switch ( v34 ) | |
5165 { | |
5166 case 54: | |
5167 goto LABEL_315; | |
5168 case 49: | |
5169 if ( v3 == 6 ) | |
5170 goto LABEL_121; | |
5171 v50 = v3 == 1; | |
5172 goto LABEL_296; | |
5173 case 51: | |
5174 if ( v3 != 5 && v3 != 1 ) | |
5175 goto LABEL_309; | |
5176 goto LABEL_121; | |
5177 case 52: | |
5178 if ( v3 == 3 ) | |
5179 goto LABEL_121; | |
5180 v50 = v3 == 4; | |
5181 goto LABEL_296; | |
5182 case 53: | |
5183 if ( !v3 ) | |
5184 goto LABEL_121; | |
5185 v50 = v3 == 2; | |
5186 goto LABEL_296; | |
5187 case 55: | |
5188 v46 = v3 == 6; | |
5189 goto LABEL_240; | |
5190 case 56: | |
5191 if ( !v3 ) | |
5192 goto LABEL_351; | |
5193 v53 = v3 == 3; | |
5194 goto LABEL_350; | |
5195 case 57: | |
5196 if ( v3 == 1 ) | |
5197 goto LABEL_351; | |
5198 v53 = v3 == 2; | |
5199 goto LABEL_350; | |
5200 case 50: | |
5201 if ( v3 == 10 ) | |
5202 v5 += 30; | |
5203 goto LABEL_361; | |
5204 case 60: | |
5205 if ( v3 != 23 ) | |
5206 goto LABEL_336; | |
5207 if ( v5 >= 3 ) | |
5208 goto LABEL_361; | |
5209 v5 = 3; | |
5210 LABEL_336: | |
5211 v54 = v3 == 22; | |
5212 goto LABEL_345; | |
5213 case 61: | |
5214 if ( v3 != 17 ) | |
5215 goto LABEL_340; | |
5216 if ( v5 >= 3 ) | |
5217 goto LABEL_361; | |
5218 v5 = 3; | |
5219 LABEL_340: | |
5220 v54 = v3 == 18; | |
5221 goto LABEL_345; | |
5222 case 62: | |
5223 if ( v3 != 19 ) | |
5224 goto LABEL_344; | |
5225 if ( v5 >= 3 ) | |
5226 goto LABEL_361; | |
5227 v5 = 3; | |
5228 LABEL_344: | |
5229 v54 = v3 == 20; | |
5230 LABEL_345: | |
5231 if ( !v54 ) | |
5232 goto LABEL_361; | |
5233 if ( v5 >= 3 ) | |
5234 goto LABEL_361; | |
5235 v60 = 3; | |
5236 goto LABEL_360; | |
5237 case 67: | |
5238 v55 = v3 == 18; | |
5239 goto LABEL_357; | |
5240 case 68: | |
5241 v53 = v3 == 9; | |
5242 goto LABEL_350; | |
5243 case 69: | |
5244 if ( v3 == 11 ) | |
5245 v5 += 20; | |
5246 break; | |
5247 case 70: | |
5248 if ( v3 == 12 ) | |
5249 v5 += 10; | |
5250 v55 = v3 == 16; | |
5251 LABEL_357: | |
5252 if ( v55 && v5 < 2 ) | |
5253 { | |
5254 v60 = 2; | |
5255 LABEL_360: | |
5256 v5 = v60; | |
5257 } | |
5258 break; | |
5259 default: | |
5260 goto LABEL_361; | |
5261 } | |
5262 goto LABEL_361; | |
5263 } | |
5264 if ( v34 == 48 ) | |
5265 { | |
5266 if ( v3 == 9 ) | |
5267 v5 += 5; | |
5268 LABEL_315: | |
5269 v46 = v3 == 3; | |
5270 LABEL_240: | |
5271 if ( v46 ) | |
5272 v5 += 15; | |
5273 goto LABEL_361; | |
5274 } | |
5275 if ( v34 > 32 ) | |
5276 { | |
5277 if ( v34 > 44 ) | |
5278 { | |
5279 v51 = v34 - 45; | |
5280 if ( !v51 ) | |
5281 { | |
5282 if ( v3 == 5 ) | |
5283 goto LABEL_351; | |
5284 v53 = v3 == 4; | |
5285 LABEL_350: | |
5286 if ( v53 ) | |
5287 LABEL_351: | |
5288 v5 += 5; | |
5289 goto LABEL_361; | |
5290 } | |
5291 v52 = v51 - 1; | |
5292 if ( !v52 ) | |
5293 { | |
5294 v40 = v3 == 0; | |
5295 LABEL_123: | |
5296 if ( v40 ) | |
5297 v5 += 25; | |
5298 goto LABEL_361; | |
5299 } | |
5300 if ( v52 == 1 ) | |
5301 { | |
5302 LABEL_309: | |
5303 v50 = v3 == 8; | |
5304 goto LABEL_296; | |
5305 } | |
5306 } | |
5307 else | |
5308 { | |
5309 if ( v34 == 44 ) | |
5310 { | |
5311 v50 = v3 == 7; | |
5312 goto LABEL_296; | |
5313 } | |
5314 v34 -= 33; | |
5315 if ( !v34 ) | |
5316 { | |
5317 if ( v3 != 38 ) | |
5318 goto LABEL_361; | |
5319 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5320 goto LABEL_138; | |
5321 } | |
5322 --v34; | |
5323 if ( !v34 ) | |
5324 { | |
5325 if ( v3 != 36 ) | |
5326 goto LABEL_361; | |
5327 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5328 goto LABEL_138; | |
5329 } | |
5330 v49 = v34 - 8; | |
5331 if ( !v49 ) | |
5332 { | |
5333 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5334 ++v5; | |
5335 goto LABEL_361; | |
5336 } | |
5337 if ( v49 == 1 ) | |
5338 { | |
5339 if ( v3 != 3 && v3 != 7 ) | |
5340 { | |
5341 v50 = v3 == 9; | |
5342 LABEL_296: | |
5343 if ( !v50 ) | |
5344 goto LABEL_361; | |
5345 } | |
5346 LABEL_121: | |
5347 v5 += 10; | |
5348 goto LABEL_361; | |
5349 } | |
5350 } | |
5351 } | |
5352 else | |
5353 { | |
5354 if ( v34 == 32 ) | |
5355 { | |
5356 if ( v3 != 39 ) | |
5357 goto LABEL_361; | |
5358 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5359 goto LABEL_138; | |
5360 } | |
5361 if ( v34 > 28 ) | |
5362 { | |
5363 v34 -= 29; | |
5364 if ( v34 ) | |
5365 { | |
5366 --v34; | |
5367 if ( v34 ) | |
5368 { | |
5369 --v34; | |
5370 if ( v34 || v3 != 41 ) | |
5371 goto LABEL_361; | |
5372 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5373 } | |
5374 else | |
5375 { | |
5376 if ( v3 != 34 ) | |
5377 goto LABEL_361; | |
5378 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5379 } | |
5380 } | |
5381 else | |
5382 { | |
5383 if ( v3 != 37 ) | |
5384 goto LABEL_361; | |
5385 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5386 } | |
5387 goto LABEL_138; | |
5388 } | |
5389 if ( v34 == 28 ) | |
5390 { | |
5391 LABEL_136: | |
5392 if ( v3 == 42 ) | |
5393 { | |
5394 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5395 LABEL_138: | |
5396 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5397 goto LABEL_361; | |
5398 } | |
5399 } | |
5400 else | |
5401 { | |
5402 v47 = v34 - 1; | |
5403 if ( v47 ) | |
5404 { | |
5405 v48 = v47 - 1; | |
5406 if ( v48 ) | |
5407 { | |
5408 v34 = v48 - 24; | |
5409 if ( v34 ) | |
5410 { | |
5411 --v34; | |
5412 if ( v34 || v3 != 40 ) | |
5413 goto LABEL_361; | |
5414 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5415 } | |
5416 else | |
5417 { | |
5418 if ( v3 != 35 ) | |
5419 goto LABEL_361; | |
5420 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5421 } | |
5422 goto LABEL_138; | |
5423 } | |
5424 LABEL_118: | |
5425 if ( (signed int)v3 < 0 ) | |
5426 goto LABEL_361; | |
5427 v39 = __OFSUB__((int)v3, 6); | |
5428 v37 = v3 == 6; | |
5429 v38 = v3 - 6 < 0; | |
5430 } | |
5431 else | |
5432 { | |
5433 LABEL_253: | |
5434 if ( (signed int)v3 < 10 ) | |
5435 goto LABEL_361; | |
5436 v39 = __OFSUB__((int)v3, 15); | |
5437 v37 = v3 == 15; | |
5438 v38 = v3 - 15 < 0; | |
5439 } | |
5440 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5441 goto LABEL_121; | |
5442 } | |
5443 } | |
5444 LABEL_361: | |
5445 ++v65; | |
5446 if ( (signed int)v65 >= 16 ) | |
5447 return v5 + v62 + v61; | |
5448 } | |
5449 } | |
5450 if ( attr == 28 ) | |
5451 { | |
5452 if ( IsUnarmed() != 1 ) | |
5453 { | |
816 | 5454 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5455 { | |
5456 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5457 if ( v22 >= 0 ) |
5458 { | |
5459 if ( v22 <= 2 ) | |
5460 { | |
118 | 5461 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5462 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5463 { |
5464 v24 = v23; | |
5465 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5466 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5467 } | |
5468 else | |
5469 { | |
5470 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5471 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5472 } | |
5473 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5474 } | |
5475 } | |
5476 } | |
865 | 5477 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5478 return v5 + v62 + v61; |
5479 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5480 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5481 goto LABEL_88; | |
5482 } | |
5483 v59 = 3; | |
5484 LABEL_74: | |
5485 v5 = v59; | |
5486 return v5 + v62 + v61; | |
5487 } | |
5488 if ( (signed int)attr < 0 ) | |
5489 return v5 + v62 + v61; | |
5490 if ( (signed int)attr <= 23 ) | |
5491 goto LABEL_95; | |
5492 if ( (signed int)attr <= 24 ) | |
5493 return v5 + v62 + v61; | |
5494 if ( (signed int)attr <= 26 ) | |
5495 { | |
5496 if ( IsUnarmed() == 1 ) | |
5497 { | |
5498 v5 = 0; | |
5499 return v5 + v62 + v61; | |
5500 } | |
816 | 5501 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5502 { | |
5503 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5504 if ( v17 >= 0 ) |
5505 { | |
5506 if ( v17 <= 2 ) | |
232 | 5507 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5508 } |
5509 } | |
865 | 5510 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5511 return v5 + v62 + v61; |
898 | 5512 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5513 goto LABEL_365; |
5514 } | |
5515 if ( attr == 27 ) | |
5516 { | |
5517 if ( IsUnarmed() == 1 ) | |
5518 { | |
5519 v5 = 1; | |
5520 return v5 + v62 + v61; | |
5521 } | |
816 | 5522 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5523 { | |
5524 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5525 if ( v9 >= 0 ) |
5526 { | |
5527 if ( v9 <= 2 ) | |
5528 { | |
118 | 5529 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
898 | 5530 if ( !v6->pEquipment.uShield ) |
0 | 5531 { |
118 | 5532 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5533 ++v5; |
5534 } | |
5535 } | |
5536 } | |
5537 } | |
865 | 5538 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5539 return v5 + v62 + v61; |
898 | 5540 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5541 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5542 LABEL_88: |
5543 v5 += v15 + v14; | |
5544 } | |
5545 return v5 + v62 + v61; | |
5546 } | |
5547 | |
5548 //----- (0048F73C) -------------------------------------------------------- | |
5549 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5550 { | |
5551 int result; // eax@1 | |
5552 int v3; // eax@4 | |
5553 int v4; // ecx@5 | |
5554 | |
5555 switch (a2) | |
5556 { | |
5557 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5558 } | |
5559 | |
5560 result = 0; | |
5561 if ( (signed int)a2 > 10 ) | |
5562 { | |
5563 if ( (signed int)a2 <= 15 ) | |
5564 { | |
5565 switch ( a2 ) | |
5566 { | |
5567 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5568 v3 = this->pPlayerBuffs[2].uPower; | |
5569 v4 = pParty->pPartyBuffs[1].uPower; | |
5570 break; | |
5571 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5572 v3 = this->pPlayerBuffs[0].uPower; | |
5573 v4 = pParty->pPartyBuffs[0].uPower; | |
5574 break; | |
5575 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5576 v3 = this->pPlayerBuffs[22].uPower; | |
5577 v4 = pParty->pPartyBuffs[17].uPower; | |
5578 break; | |
5579 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5580 v3 = this->pPlayerBuffs[3].uPower; | |
5581 v4 = pParty->pPartyBuffs[4].uPower; | |
5582 break; | |
5583 default: | |
5584 if ( a2 != 14 ) | |
5585 return result; | |
5586 v3 = this->pPlayerBuffs[9].uPower; | |
5587 v4 = pParty->pPartyBuffs[12].uPower; | |
5588 break; | |
5589 } | |
5590 return v4 + v3; | |
5591 } | |
5592 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5593 { | |
5594 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5595 { | |
5596 v3 = this->pPlayerBuffs[8].uPower; | |
5597 v4 = pParty->pPartyBuffs[9].uPower; | |
5598 return v4 + v3; | |
5599 } | |
5600 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5601 return result; | |
5602 } | |
5603 return this->pPlayerBuffs[1].uPower; | |
5604 } | |
5605 if ( a2 == 10 ) | |
5606 { | |
5607 v3 = this->pPlayerBuffs[5].uPower; | |
5608 v4 = pParty->pPartyBuffs[6].uPower; | |
5609 return v4 + v3; | |
5610 } | |
5611 switch ( a2 ) | |
5612 { | |
5613 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5614 v3 = pPlayerBuffs[19].uPower; | |
5615 goto LABEL_5; | |
5616 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5617 v3 = pPlayerBuffs[17].uPower; | |
5618 goto LABEL_5; | |
5619 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5620 v3 = pPlayerBuffs[20].uPower; | |
5621 goto LABEL_5; | |
5622 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5623 v3 = pPlayerBuffs[16].uPower; | |
5624 goto LABEL_5; | |
5625 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5626 v3 = pPlayerBuffs[15].uPower; | |
5627 goto LABEL_5; | |
5628 case CHARACTER_ATTRIBUTE_SPEED: | |
5629 v3 = pPlayerBuffs[21].uPower; | |
5630 goto LABEL_5; | |
5631 case CHARACTER_ATTRIBUTE_LUCK: | |
5632 v3 = pPlayerBuffs[18].uPower; | |
5633 LABEL_5: | |
5634 v4 = pParty->pPartyBuffs[2].uPower; | |
5635 return v4 + v3; | |
5636 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5637 v3 = this->pPlayerBuffs[14].uPower; | |
5638 v4 = pParty->pPartyBuffs[15].uPower; | |
5639 return v4 + v3; | |
5640 default: | |
5641 return result; | |
5642 } | |
5643 return result; | |
5644 } | |
5645 | |
5646 //----- (0048F882) -------------------------------------------------------- | |
353 | 5647 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
0 | 5648 { |
5649 signed int v2; // esi@1 | |
5650 unsigned __int16 v3; // ax@126 | |
5651 char result; // al@127 | |
5652 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5653 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5654 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5655 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5656 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5657 | |
0 | 5658 v2 = 0; |
353 | 5659 switch (uSkillType) |
5660 { | |
5661 case PLAYER_SKILL_MONSTER_ID: | |
5662 { | |
652 | 5663 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5664 v2 = 6; |
652 | 5665 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5666 v2 += 6; |
5667 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5668 v2 += GetItemsBonus(v8, 0); | |
5669 } | |
5670 break; | |
5671 | |
5672 case PLAYER_SKILL_ARMSMASTER: | |
5673 { | |
652 | 5674 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5675 v2 = 2; |
652 | 5676 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5677 v2 += 3; |
353 | 5678 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5679 v2 += GetItemsBonus(v8, 0); | |
5680 } | |
5681 break; | |
5682 | |
5683 case PLAYER_SKILL_STEALING: | |
5684 { | |
652 | 5685 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5686 v2 = 8; |
5687 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5688 v2 += GetItemsBonus(v8, 0); | |
5689 } | |
5690 break; | |
5691 | |
5692 | |
5693 case PLAYER_SKILL_ALCHEMY: | |
5694 { | |
652 | 5695 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5696 v2 = 4; |
652 | 5697 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5698 v2 += 8; |
5699 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5700 v2 += GetItemsBonus(v8, 0); | |
5701 } | |
5702 break; | |
5703 | |
5704 case PLAYER_SKILL_LEARNING: | |
5705 { | |
652 | 5706 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5707 v2 = 10; |
652 | 5708 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5709 v2 += 15; |
652 | 5710 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5711 v2 += 5; |
5712 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5713 v2 += GetItemsBonus(v8, 0); | |
5714 } | |
5715 break; | |
5716 | |
5717 case PLAYER_SKILL_UNARMED: | |
5718 { | |
652 | 5719 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5720 v2 = 2; |
5721 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5722 v2 += GetItemsBonus(v8, 0); | |
5723 } | |
5724 break; | |
5725 | |
5726 case PLAYER_SKILL_DODGE: | |
5727 { | |
652 | 5728 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5729 v2 = 2; |
5730 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5731 v2 += GetItemsBonus(v8, 0); | |
5732 } | |
5733 break; | |
5734 | |
5735 case PLAYER_SKILL_BOW: | |
5736 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5737 v2 += GetItemsBonus(v8, 0); | |
5738 break; | |
5739 case PLAYER_SKILL_SHIELD: | |
5740 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5741 v2 += GetItemsBonus(v8, 0); | |
5742 break; | |
5743 | |
5744 case PLAYER_SKILL_EARTH: | |
652 | 5745 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5746 v2 = 2; |
652 | 5747 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5748 v2 += 3; |
652 | 5749 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5750 v2 += 4; |
5751 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5752 v2 += 3; | |
5753 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5754 v2 += GetItemsBonus(v8, 0); | |
5755 break; | |
5756 case PLAYER_SKILL_FIRE: | |
652 | 5757 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5758 v2 = 2; |
652 | 5759 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5760 v2 += 3; |
652 | 5761 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5762 v2 += 4; |
5763 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5764 v2 += 3; | |
5765 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5766 v2 += GetItemsBonus(v8, 0); | |
5767 break; | |
5768 case PLAYER_SKILL_AIR: | |
652 | 5769 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5770 v2 = 2; |
652 | 5771 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5772 v2 += 3; |
652 | 5773 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5774 v2 += 4; |
5775 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5776 v2 += 3; | |
5777 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5778 v2 += GetItemsBonus(v8, 0); | |
5779 break; | |
5780 case PLAYER_SKILL_WATER: | |
652 | 5781 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5782 v2 = 2; |
652 | 5783 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5784 v2 += 3; |
652 | 5785 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5786 v2 += 4; |
5787 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5788 v2 += 3; | |
5789 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5790 v2 += GetItemsBonus(v8, 0); | |
5791 break; | |
5792 case PLAYER_SKILL_SPIRIT: | |
652 | 5793 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5794 v2 = 2; |
652 | 5795 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5796 v2 += 3; |
652 | 5797 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5798 v2 += 4; |
5799 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5800 v2 += GetItemsBonus(v8, 0); | |
5801 break; | |
5802 case PLAYER_SKILL_MIND: | |
652 | 5803 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5804 v2 = 2; |
652 | 5805 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5806 v2 += 3; |
652 | 5807 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5808 v2 += 4; |
5809 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5810 v2 += GetItemsBonus(v8, 0); | |
5811 break; | |
5812 case PLAYER_SKILL_BODY: | |
652 | 5813 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5814 v2 = 2; |
652 | 5815 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5816 v2 += 3; |
652 | 5817 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5818 v2 += 4; |
5819 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5820 v2 += GetItemsBonus(v8, 0); | |
5821 break; | |
5822 case PLAYER_SKILL_LIGHT: | |
5823 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5824 v2 += GetItemsBonus(v8, 0); | |
5825 break; | |
5826 case PLAYER_SKILL_DARK: | |
5827 { | |
5828 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5829 v2 += GetItemsBonus(v8, 0); | |
5830 } | |
5831 break; | |
5832 | |
5833 case PLAYER_SKILL_MERCHANT: | |
5834 { | |
652 | 5835 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5836 v2 = 4; |
652 | 5837 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5838 v2 += 6; |
652 | 5839 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5840 v2 += 3; |
652 | 5841 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5842 v2 += 8; |
5843 } | |
5844 break; | |
5845 | |
5846 case PLAYER_SKILL_PERCEPTION: | |
5847 { | |
652 | 5848 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5849 v2 = 6; |
652 | 5850 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5851 v2 += 5; |
5852 } | |
5853 break; | |
5854 | |
0 | 5855 case PLAYER_SKILL_ITEM_ID: |
5856 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5857 v2 += GetItemsBonus(v8, 0); |
0 | 5858 break; |
5859 case PLAYER_SKILL_MEDITATION: | |
5860 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5861 v2 += GetItemsBonus(v8, 0); |
5862 break; | |
0 | 5863 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5864 { |
652 | 5865 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5866 v2 = 4; |
652 | 5867 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5868 v2 += 6; |
652 | 5869 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5870 v2 += 8; |
0 | 5871 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5872 v2 += GetItemsBonus(v8, 0); |
5873 } | |
5874 break; | |
5875 } | |
5876 | |
5877 v3 = pActiveSkills[uSkillType]; | |
5878 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
0 | 5879 result = v2 + v3; |
5880 else | |
5881 result = v3 & 0xFC | 0x3C; | |
5882 return result; | |
5883 } | |
5884 | |
5885 //----- (0048FC00) -------------------------------------------------------- | |
5886 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5887 { | |
5888 Player *v2; // esi@1 | |
5889 int v3; // eax@1 | |
5890 char v4; // di@1 | |
5891 signed int v5; // ebx@1 | |
5892 unsigned int v6; // eax@2 | |
5893 unsigned __int8 v7; // sf@5 | |
5894 unsigned __int8 v8; // of@5 | |
5895 PlayerEquipment *v9; // ebx@19 | |
5896 Player *v10; // ecx@20 | |
821 | 5897 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5898 int v12; // eax@21 |
5899 int v13; // edi@21 | |
5900 char v14; // di@25 | |
5901 signed int v15; // esi@25 | |
5902 char v16; // al@32 | |
5903 int v18; // eax@36 | |
5904 unsigned int v19; // eax@37 | |
5905 ITEM_EQUIP_TYPE v20; // edi@40 | |
5906 int v21; // edx@41 | |
5907 int v22; // eax@42 | |
821 | 5908 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5909 unsigned __int16 v24; // ax@45 |
5910 unsigned __int16 v25; // bx@45 | |
5911 unsigned int v26; // eax@45 | |
5912 unsigned __int8 v27; // sf@50 | |
5913 unsigned __int8 v28; // of@50 | |
5914 unsigned int v29; // eax@52 | |
5915 int v30; // eax@55 | |
5916 int v31; // eax@58 | |
5917 unsigned int v32; // eax@59 | |
5918 int v33; // eax@65 | |
5919 char v34; // si@65 | |
5920 ITEM_EQUIP_TYPE v35; // edi@69 | |
5921 int v36; // edx@70 | |
5922 int v37; // eax@71 | |
821 | 5923 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5924 int v39; // eax@74 |
5925 int v40; // eax@89 | |
5926 char v41; // si@89 | |
5927 int v42; // eax@96 | |
821 | 5928 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5929 int v44; // eax@97 |
5930 int v45; // eax@98 | |
5931 int v46; // eax@99 | |
5932 int v47; // eax@100 | |
5933 int v48; // eax@101 | |
5934 int v49; // eax@102 | |
5935 unsigned __int16 v50; // ax@113 | |
5936 char v51; // di@113 | |
5937 unsigned int v52; // eax@113 | |
5938 int v53; // edi@113 | |
5939 signed int i; // ecx@113 | |
5940 unsigned __int16 v55; // ax@118 | |
5941 char v56; // si@118 | |
5942 unsigned int v57; // eax@118 | |
5943 int v58; // esi@121 | |
5944 signed int j; // ecx@121 | |
5945 int v60; // edi@126 | |
5946 int v61; // eax@126 | |
5947 signed int v62; // [sp-4h] [bp-30h]@26 | |
5948 signed int v63; // [sp-4h] [bp-30h]@80 | |
5949 int v64; // [sp+Ch] [bp-20h]@104 | |
5950 int v65; // [sp+10h] [bp-1Ch]@104 | |
5951 int v66; // [sp+14h] [bp-18h]@104 | |
5952 int v67; // [sp+18h] [bp-14h]@104 | |
5953 int v68; // [sp+1Ch] [bp-10h]@69 | |
5954 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5955 int v70; // [sp+24h] [bp-8h]@1 | |
5956 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5957 int a1; // [sp+34h] [bp+8h]@21 | |
5958 int a1a; // [sp+34h] [bp+8h]@74 | |
5959 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5960 | |
5961 v2 = this; | |
5962 v70 = 0; | |
5963 v69 = 0; | |
5964 v71 = (ITEM_EQUIP_TYPE)0; | |
5965 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5966 v4 = v3; | |
5967 v5 = 1; | |
5968 if ( v3 ) | |
5969 { | |
5970 v6 = SkillToMastery(v3); | |
5971 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5972 { | |
5973 if ( (signed int)v6 >= 4 ) | |
5974 goto LABEL_4; | |
5975 v8 = __OFSUB__(v6, 3); | |
5976 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5977 } | |
5978 else | |
5979 { | |
5980 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5981 goto LABEL_11; | |
5982 if ( (signed int)v6 >= 4 ) | |
5983 { | |
5984 LABEL_4: | |
5985 v71 = (ITEM_EQUIP_TYPE)2; | |
5986 LABEL_11: | |
5987 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5988 goto LABEL_12; | |
5989 } | |
5990 v8 = __OFSUB__(v6, 2); | |
5991 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5992 } | |
5993 if ( !(v7 ^ v8) ) | |
5994 v71 = (ITEM_EQUIP_TYPE)1; | |
5995 goto LABEL_11; | |
5996 } | |
5997 LABEL_12: | |
5998 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5999 { | |
135 | 6000 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 6001 v61 = v2->GetBodybuilding(); |
6002 return v60 * v61; | |
6003 } | |
6004 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
6005 { | |
135 | 6006 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 6007 v61 = v2->GetMeditation(); |
0 | 6008 return v60 * v61; |
6009 } | |
6010 if ( a2 != 9 ) | |
6011 { | |
6012 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
6013 { | |
6014 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
6015 return v70; | |
6016 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
6017 { | |
6018 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
6019 return v70; | |
6020 v71 = (ITEM_EQUIP_TYPE)0; | |
6021 v9 = &v2->pEquipment; | |
6022 while ( 1 ) | |
6023 { | |
6024 if ( v2->HasItemEquipped(v71) ) | |
6025 { | |
118 | 6026 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
6027 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 6028 a1 = v12; |
6029 SkillToMastery(v12); | |
6030 v13 = v11 - 5; | |
6031 if ( !v13 ) | |
6032 return a1 & 0x3F; | |
6033 if ( v13 == 2 ) | |
6034 break; | |
6035 } | |
6036 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
6037 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
6038 if ( (signed int)v71 >= 16 ) | |
6039 return v70; | |
6040 } | |
6041 v14 = a1; | |
6042 v15 = 1; | |
6043 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
6044 { | |
6045 v62 = 5; | |
6046 goto LABEL_31; | |
6047 } | |
6048 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6049 { | |
6050 v62 = 3; | |
6051 goto LABEL_31; | |
6052 } | |
6053 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6054 goto LABEL_32; | |
6055 goto LABEL_30; | |
6056 } | |
6057 if ( v2->IsUnarmed() ) | |
6058 { | |
6059 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6060 v14 = v18; | |
6061 if ( !v18 ) | |
6062 return v70; | |
6063 v15 = 0; | |
6064 v19 = SkillToMastery(v18); | |
6065 if ( (signed int)v19 < 3 ) | |
6066 { | |
6067 if ( (signed int)v19 >= 2 ) | |
6068 v15 = 1; | |
6069 LABEL_32: | |
6070 v16 = v14; | |
6071 return v15 * (v16 & 0x3F); | |
6072 } | |
6073 LABEL_30: | |
6074 v62 = 2; | |
6075 LABEL_31: | |
6076 v15 = v62; | |
6077 goto LABEL_32; | |
6078 } | |
6079 v20 = (ITEM_EQUIP_TYPE)0; | |
6080 while ( 1 ) | |
6081 { | |
6082 if ( v2->HasItemEquipped(v20) ) | |
6083 { | |
118 | 6084 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6085 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6086 break; | |
6087 } | |
6088 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6089 if ( (signed int)v20 >= 16 ) | |
6090 return v70; | |
6091 } | |
6092 v71 = (ITEM_EQUIP_TYPE)0; | |
6093 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6094 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6095 v25 = v24; | |
6096 v26 = SkillToMastery(v24); | |
6097 if ( !v23 ) | |
6098 { | |
6099 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6100 { | |
6101 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6102 LOBYTE(v25) = v31; | |
6103 if ( v31 ) | |
6104 { | |
6105 v15 = 0; | |
6106 v32 = SkillToMastery(v31); | |
6107 if ( (signed int)v32 < 3 ) | |
6108 { | |
6109 if ( (signed int)v32 >= 2 ) | |
6110 v15 = 1; | |
6111 } | |
6112 else | |
6113 { | |
6114 v15 = 2; | |
6115 } | |
6116 v16 = v25; | |
6117 return v15 * (v16 & 0x3F); | |
6118 } | |
6119 } | |
6120 goto LABEL_55; | |
6121 } | |
6122 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6123 { | |
6124 v29 = SkillToMastery(v25); | |
6125 v28 = __OFSUB__(v29, 4); | |
6126 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6127 } | |
6128 else | |
6129 { | |
6130 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6131 goto LABEL_55; | |
6132 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6133 { | |
6134 if ( v23 == PLAYER_SKILL_MACE ) | |
6135 { | |
6136 v28 = __OFSUB__(v26, 2); | |
118 | 6137 v27 = v26 - 2 < 0; |
0 | 6138 goto LABEL_53; |
6139 } | |
6140 LABEL_55: | |
6141 v30 = v71 * (v25 & 0x3F); | |
6142 return (int)((char *)v69 + v30); | |
6143 } | |
6144 v28 = __OFSUB__(v26, 3); | |
118 | 6145 v27 = v26 - 3 < 0; |
0 | 6146 } |
6147 LABEL_53: | |
6148 if ( !(v27 ^ v28) ) | |
6149 v71 = (ITEM_EQUIP_TYPE)1; | |
6150 goto LABEL_55; | |
6151 } | |
6152 if ( v2->IsUnarmed() == 1 ) | |
6153 { | |
6154 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6155 v34 = v33; | |
6156 if ( !v33 ) | |
6157 return v70; | |
6158 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6159 v5 = 2; | |
6160 v30 = v5 * (v34 & 0x3F); | |
6161 return (int)((char *)v69 + v30); | |
6162 } | |
6163 v35 = (ITEM_EQUIP_TYPE)0; | |
6164 v68 = 0; | |
6165 while ( 1 ) | |
6166 { | |
6167 if ( v2->HasItemEquipped(v35) ) | |
6168 { | |
118 | 6169 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6170 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6171 break; | |
6172 } | |
6173 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6174 if ( (signed int)v35 >= 16 ) | |
6175 return v70; | |
6176 } | |
6177 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6178 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6179 a1a = v39; | |
6180 SkillToMastery(v39); | |
6181 v71 = (ITEM_EQUIP_TYPE)0; | |
6182 if ( v38 ) | |
6183 { | |
6184 if ( (signed int)v38 > 0 ) | |
6185 { | |
6186 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6187 { | |
6188 v71 = (ITEM_EQUIP_TYPE)1; | |
6189 } | |
6190 else | |
6191 { | |
6192 if ( v38 == 7 ) | |
6193 { | |
6194 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6195 { | |
6196 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6197 { | |
6198 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6199 return v5 * (a1a & 0x3F); | |
6200 v63 = 2; | |
6201 } | |
6202 else | |
6203 { | |
6204 v63 = 3; | |
6205 } | |
6206 } | |
6207 else | |
6208 { | |
6209 v63 = 5; | |
6210 } | |
6211 v5 = v63; | |
6212 return v5 * (a1a & 0x3F); | |
6213 } | |
6214 } | |
6215 } | |
6216 } | |
6217 else | |
6218 { | |
6219 v71 = (ITEM_EQUIP_TYPE)1; | |
6220 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6221 { | |
6222 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6223 v41 = v40; | |
6224 if ( v40 ) | |
6225 { | |
6226 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6227 v5 = 2; | |
6228 v68 = v5 * (v41 & 0x3F); | |
6229 } | |
6230 } | |
6231 } | |
6232 v30 = v68 + v71 * (a1a & 0x3F); | |
6233 return (int)((char *)v69 + v30); | |
6234 } | |
6235 a1b = 0; | |
6236 v71 = (ITEM_EQUIP_TYPE)0; | |
6237 v68 = 16; | |
6238 v69 = &v2->pEquipment; | |
6239 do | |
6240 { | |
898 | 6241 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6242 goto LABEL_117; |
6243 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6244 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6245 if ( !v44 ) | |
6246 { | |
6247 v64 = 0; | |
6248 v65 = 1; | |
6249 LABEL_111: | |
6250 v66 = 0; | |
6251 goto LABEL_112; | |
6252 } | |
6253 v45 = v44 - 1; | |
6254 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6255 { | |
6256 v64 = 0; | |
6257 v65 = 0; | |
6258 v66 = 0; | |
6259 v67 = 1; | |
6260 goto LABEL_113; | |
6261 } | |
6262 v47 = v46 - 4; | |
6263 if ( v47 ) | |
6264 { | |
6265 v48 = v47 - 1; | |
6266 if ( v48 ) | |
6267 { | |
6268 v49 = v48 - 1; | |
6269 if ( v49 ) | |
6270 { | |
6271 if ( v49 != 1 ) | |
6272 goto LABEL_117; | |
6273 a1b = 1; | |
6274 v64 = 1; | |
6275 v65 = 0; | |
6276 v66 = 0; | |
6277 v67 = 0; | |
6278 goto LABEL_113; | |
6279 } | |
6280 a1b = 1; | |
6281 v64 = 1; | |
6282 v65 = 0; | |
6283 goto LABEL_111; | |
6284 } | |
6285 v71 = (ITEM_EQUIP_TYPE)1; | |
6286 } | |
6287 else | |
6288 { | |
6289 a1b = 1; | |
6290 } | |
6291 v64 = 1; | |
6292 v65 = 0; | |
6293 v66 = 1; | |
6294 LABEL_112: | |
6295 v67 = 0; | |
6296 LABEL_113: | |
6297 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6298 v51 = v50; | |
6299 v52 = SkillToMastery(v50); | |
6300 v53 = v51 & 0x3F; | |
6301 for ( i = 0; i < (signed int)v52; ++i ) | |
6302 { | |
6303 if ( *(&v64 + i) ) | |
6304 v70 += v53; | |
6305 } | |
6306 LABEL_117: | |
6307 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6308 --v68; | |
6309 } | |
6310 while ( v68 ); | |
6311 v64 = 1; | |
6312 v65 = 1; | |
6313 v66 = 1; | |
6314 v67 = 0; | |
6315 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6316 v56 = v55; | |
6317 v57 = SkillToMastery(v55); | |
6318 if ( !a1b && (!v71 || v57 == 4) ) | |
6319 { | |
6320 v58 = v56 & 0x3F; | |
6321 for ( j = 0; j < (signed int)v57; ++j ) | |
6322 { | |
6323 if ( *(&v64 + j) ) | |
6324 v70 += v58; | |
6325 } | |
6326 } | |
6327 return v70; | |
6328 } | |
6329 | |
6330 //----- (00490109) -------------------------------------------------------- | |
6331 // faces are: 0 1 2 3 human males | |
6332 // 4 5 6 7 human females | |
6333 // 8 9 elf males | |
6334 // 10 11 elf females | |
6335 // 12 13 dwarf males | |
6336 // 14 15 dwarf females | |
6337 // 16 17 goblin males | |
6338 // 18 19 goblin females | |
6339 // 20 lich male | |
6340 // 21 lich female | |
6341 // 22 underwater suits (unused) | |
6342 // 23 zombie male | |
6343 // 24 zombie female | |
6344 enum CHARACTER_RACE Player::GetRace() | |
6345 { | |
6346 if ( uFace > 15 ) | |
6347 { | |
6348 if ( uFace >= 16 && uFace <= 19 ) | |
6349 return CHARACTER_RACE_GOBLIN; | |
6350 } | |
6351 else | |
6352 { | |
6353 if ( uFace >= 12 ) | |
6354 { | |
6355 return CHARACTER_RACE_DWARF; | |
6356 } | |
6357 else | |
6358 { | |
6359 if ( uFace >= 0 ) | |
6360 { | |
6361 if ( uFace <= 7 ) | |
6362 { | |
6363 return CHARACTER_RACE_HUMAN; | |
6364 } | |
6365 else | |
6366 { | |
6367 if ( uFace <= 11 ) | |
6368 return CHARACTER_RACE_ELF; | |
6369 } | |
6370 } | |
6371 } | |
6372 } | |
6373 return CHARACTER_RACE_HUMAN; | |
6374 } | |
6375 | |
6376 //----- (00490141) -------------------------------------------------------- | |
187 | 6377 PLAYER_SEX Player::GetSexByVoice() |
0 | 6378 { |
6379 signed int result; // eax@1 | |
6380 | |
6381 result = 0; | |
6382 switch ( this->uVoiceID ) | |
6383 { | |
6384 case 0u: | |
6385 case 1u: | |
6386 case 2u: | |
6387 case 3u: | |
6388 case 8u: | |
6389 case 9u: | |
6390 case 0xCu: | |
6391 case 0xDu: | |
6392 case 0x10u: | |
6393 case 0x11u: | |
6394 case 0x14u: | |
6395 case 0x17u: | |
187 | 6396 return SEX_MALE; |
6397 | |
0 | 6398 case 4u: |
6399 case 5u: | |
6400 case 6u: | |
6401 case 7u: | |
6402 case 0xAu: | |
6403 case 0xBu: | |
6404 case 0xEu: | |
6405 case 0xFu: | |
6406 case 0x12u: | |
6407 case 0x13u: | |
6408 case 0x15u: | |
6409 case 0x18u: | |
187 | 6410 return SEX_FEMALE; |
6411 | |
0 | 6412 default: |
187 | 6413 assert(false); |
6414 } | |
0 | 6415 } |
6416 | |
6417 //----- (00490188) -------------------------------------------------------- | |
6418 void Player::SetInitialStats() | |
6419 { | |
6420 auto v1 = GetRace(); | |
290 | 6421 uMight = StatTable[v1][0].uBaseValue; |
6422 uIntelligence = StatTable[v1][1].uBaseValue; | |
6423 uWillpower = StatTable[v1][2].uBaseValue; | |
6424 uEndurance = StatTable[v1][3].uBaseValue; | |
6425 uAccuracy = StatTable[v1][4].uBaseValue; | |
6426 uSpeed = StatTable[v1][5].uBaseValue; | |
6427 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6428 } |
6429 | |
6430 //----- (004901FC) -------------------------------------------------------- | |
6431 int Player::SetSexByVoice() | |
6432 { | |
6433 __int64 v1; // qax@1 | |
6434 | |
6435 v1 = this->uVoiceID; | |
6436 switch ( (int)v1 ) | |
6437 { | |
6438 case 0: | |
6439 case 1: | |
6440 case 2: | |
6441 case 3: | |
6442 case 8: | |
6443 case 9: | |
6444 case 0xC: | |
6445 case 0xD: | |
6446 case 0x10: | |
6447 case 0x11: | |
6448 case 0x14: | |
6449 case 0x17: | |
6450 BYTE4(v1) = 0; | |
6451 break; | |
6452 case 4: | |
6453 case 5: | |
6454 case 6: | |
6455 case 7: | |
6456 case 0xA: | |
6457 case 0xB: | |
6458 case 0xE: | |
6459 case 0xF: | |
6460 case 0x12: | |
6461 case 0x13: | |
6462 case 0x15: | |
6463 case 0x18: | |
6464 BYTE4(v1) = 1; | |
6465 break; | |
6466 default: | |
6467 break; | |
6468 } | |
6469 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6470 return v1; | |
6471 } | |
6472 | |
6473 //----- (0049024A) -------------------------------------------------------- | |
135 | 6474 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6475 { |
6476 sLevelModifier = 0; | |
6477 sAgeModifier = 0; | |
6478 | |
135 | 6479 classType = cls; |
0 | 6480 uLuckBonus = 0; |
6481 uSpeedBonus = 0; | |
6482 uAccuracyBonus = 0; | |
6483 uEnduranceBonus = 0; | |
6484 uWillpowerBonus = 0; | |
6485 uIntelligenceBonus = 0; | |
6486 uMightBonus = 0; | |
6487 uLevel = 1; | |
6488 uExperience = 251 + rand() % 100; | |
6489 uBirthYear = 1147 - rand() % 6; | |
6490 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6491 memset(_guilds_member_bits, 0, 64); |
0 | 6492 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6493 | |
6494 for (uint i = 0; i < 37; ++i) | |
6495 { | |
135 | 6496 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6497 continue; |
6498 | |
6499 pActiveSkills[i] = 1; | |
6500 | |
6501 switch (i) | |
6502 { | |
886 | 6503 case PLAYER_SKILL_FIRE: |
6504 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6505 |
6506 extern bool all_magic; | |
6507 if ( all_magic == true ) | |
6508 { | |
6509 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6510 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6511 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6512 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6513 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6514 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6515 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6516 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6517 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6518 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6519 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6520 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6521 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6522 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6523 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6524 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6525 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6526 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6527 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6528 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6529 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6530 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6531 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6532 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6533 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6534 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6535 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6536 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6537 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6538 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6539 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6540 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6541 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6542 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6543 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6544 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6545 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6546 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6547 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6548 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6549 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6550 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6551 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6552 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6553 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6554 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6555 } | |
486 | 6556 break; |
886 | 6557 case PLAYER_SKILL_AIR: |
6558 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6559 break; | |
6560 case PLAYER_SKILL_WATER: | |
6561 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6562 break; | |
6563 case PLAYER_SKILL_EARTH: | |
6564 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6565 break; | |
6566 case PLAYER_SKILL_SPIRIT: | |
6567 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6568 break; | |
6569 case PLAYER_SKILL_MIND: | |
6570 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6571 break; | |
6572 case PLAYER_SKILL_BODY: | |
6573 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6574 |
6575 if ( all_magic == true ) | |
6576 { | |
6577 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6578 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6579 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6580 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6581 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6582 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6583 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6584 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6585 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6586 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6587 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6588 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6589 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6590 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6591 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6592 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6593 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6594 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6595 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6596 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6597 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6598 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6599 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6600 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6601 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6602 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6603 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6604 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6605 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6606 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6607 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6608 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6609 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6610 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6611 } | |
569 | 6612 break; |
886 | 6613 case PLAYER_SKILL_LIGHT: |
6614 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6615 break; | |
6616 case PLAYER_SKILL_DARK: | |
6617 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6618 break; | |
0 | 6619 } |
6620 } | |
6621 | |
6622 sHealth = GetMaxHealth(); | |
6623 sMana = GetMaxMana(); | |
6624 } | |
6625 | |
6626 //----- (004903C9) -------------------------------------------------------- | |
821 | 6627 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6628 { | |
6629 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6630 int v3; // edx@5 |
6631 char *v4; // ecx@5 | |
6632 int v5; // esi@11 | |
6633 unsigned __int16 *v6; // edx@11 | |
6634 int v7; // esi@18 | |
6635 unsigned __int16 *pActiveSkill; // edx@18 | |
6636 | |
6637 if ( order >= 0 ) | |
6638 { | |
6639 if ( order <= 1 ) | |
6640 { | |
6641 result = (PLAYER_SKILL_TYPE)0; | |
6642 v7 = 0; | |
6643 pActiveSkill = this->pActiveSkills; | |
6644 do | |
6645 { | |
135 | 6646 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6647 { |
6648 if ( v7 == order ) | |
6649 return result; | |
6650 ++v7; | |
6651 } | |
6652 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6653 ++pActiveSkill; | |
6654 } | |
6655 while ( (signed int)result < 37 ); | |
6656 } | |
6657 else | |
6658 { | |
6659 if ( order <= 3 ) | |
6660 { | |
6661 result = (PLAYER_SKILL_TYPE)0; | |
6662 v5 = 0; | |
6663 pActiveSkill = this->pActiveSkills; | |
6664 do | |
6665 { | |
135 | 6666 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6667 { |
6668 if ( v5 == order - 2 ) | |
6669 return result; | |
6670 ++v5; | |
6671 } | |
6672 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6673 ++pActiveSkill; | |
6674 } | |
6675 while ( (signed int)result < 37 ); | |
6676 } | |
6677 else | |
6678 { | |
6679 if ( order <= 12 ) | |
6680 { | |
6681 result = (PLAYER_SKILL_TYPE)0; | |
6682 v3 = 0; | |
135 | 6683 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6684 do |
6685 { | |
6686 if ( *v4 == 1 ) | |
6687 { | |
6688 if ( v3 == order - 4 ) | |
6689 return result; | |
6690 ++v3; | |
6691 } | |
6692 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6693 ++v4; | |
6694 } | |
6695 while ( (signed int)result < 37 ); | |
6696 } | |
6697 } | |
6698 } | |
6699 } | |
6700 return (PLAYER_SKILL_TYPE)37; | |
6701 } | |
6702 | |
6703 | |
6704 | |
6705 //----- (0049048D) -------------------------------------------------------- | |
6706 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6707 void Player::DecreaseAttribute(int eAttribute) | |
6708 { | |
6709 int v2; // eax@1 | |
6710 int pBaseValue; // ecx@1 | |
6711 int pDroppedStep; // ebx@1 | |
6712 int pStep; // esi@1 | |
6713 unsigned __int16 result; // ax@7 | |
6714 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6715 | |
6716 v2 = eAttribute + 7 * GetRace(); | |
290 | 6717 pBaseValue = StatTable[0][v2].uBaseValue; |
6718 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6719 uMinValue = pBaseValue - 2; |
290 | 6720 pStep = StatTable[0][v2].uBaseStep; |
0 | 6721 switch ( eAttribute ) |
6722 { | |
6723 case CHARACTER_MIGHT: | |
6724 if ( this->uMight <= pBaseValue ) | |
6725 pStep = pDroppedStep; | |
6726 if ( this->uMight - pStep >= uMinValue ) | |
6727 this->uMight -= pStep; | |
6728 break; | |
6729 case CHARACTER_INTELLIGANCE: | |
6730 if ( this->uIntelligence <= pBaseValue ) | |
6731 pStep = pDroppedStep; | |
6732 if ( this->uIntelligence - pStep >= uMinValue ) | |
6733 this->uIntelligence -= pStep; | |
6734 break; | |
6735 case CHARACTER_WILLPOWER: | |
6736 if ( this->uWillpower <= pBaseValue ) | |
6737 pStep = pDroppedStep; | |
6738 if ( this->uWillpower - pStep >= uMinValue ) | |
6739 this->uWillpower -= pStep; | |
6740 break; | |
6741 case CHARACTER_ENDURANCE: | |
6742 if ( this->uEndurance <= pBaseValue ) | |
6743 pStep = pDroppedStep; | |
6744 if ( this->uEndurance - pStep >= uMinValue ) | |
6745 this->uEndurance -= pStep; | |
6746 break; | |
6747 case CHARACTER_ACCURACY: | |
6748 if ( this->uAccuracy <= pBaseValue ) | |
6749 pStep = pDroppedStep; | |
6750 if ( this->uAccuracy - pStep >= uMinValue ) | |
6751 this->uAccuracy -= pStep; | |
6752 break; | |
6753 case CHARACTER_SPEED: | |
6754 if ( this->uSpeed <= pBaseValue ) | |
6755 pStep = pDroppedStep; | |
6756 if ( this->uSpeed - pStep >= uMinValue ) | |
6757 this->uSpeed -= pStep; | |
6758 break; | |
6759 case CHARACTER_LUCK: | |
6760 if ( this->uLuck <= pBaseValue ) | |
6761 pStep = pDroppedStep; | |
6762 if ( this->uLuck - pStep >= uMinValue ) | |
6763 this->uLuck -= pStep; | |
6764 break; | |
6765 } | |
6766 } | |
6767 | |
6768 //----- (004905F5) -------------------------------------------------------- | |
6769 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6770 int Player::IncreaseAttribute(int eAttribute) | |
6771 { | |
6772 Player *v2; // esi@1 | |
6773 int v3; // eax@1 | |
6774 int v4; // ebx@1 | |
6775 signed int v5; // edi@1 | |
6776 int v6; // eax@8 | |
6777 signed int v7; // eax@17 | |
6778 signed int result; // eax@18 | |
6779 int v9; // [sp+Ch] [bp-8h]@1 | |
6780 signed int v10; // [sp+10h] [bp-4h]@1 | |
6781 | |
6782 v2 = this; | |
6783 v3 = eAttribute + 7 * GetRace(); | |
290 | 6784 v4 = StatTable[0][v3].uMaxValue; |
6785 v5 = StatTable[0][v3].uBaseStep; | |
6786 v9 = StatTable[0][v3].uBaseValue; | |
6787 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6788 PlayerCreation_ComputeAttributeBonus(); |
6789 if ( eAttribute ) | |
6790 { | |
6791 switch ( eAttribute ) | |
6792 { | |
6793 case 1: | |
6794 v6 = v2->uIntelligence; | |
6795 break; | |
6796 case 2: | |
6797 v6 = v2->uWillpower; | |
6798 break; | |
6799 case 3: | |
6800 v6 = v2->uEndurance; | |
6801 break; | |
6802 case 4: | |
6803 v6 = v2->uAccuracy; | |
6804 break; | |
6805 case 5: | |
6806 v6 = v2->uSpeed; | |
6807 break; | |
6808 case 6: | |
6809 v6 = v2->uLuck; | |
6810 break; | |
6811 default: | |
6812 v6 = eAttribute; | |
6813 break; | |
6814 } | |
6815 } | |
6816 else | |
6817 { | |
6818 v6 = v2->uMight; | |
6819 } | |
6820 if ( v6 < v9 ) | |
6821 { | |
6822 v7 = v5; | |
6823 v5 = v10; | |
6824 v10 = v7; | |
6825 } | |
6826 result = PlayerCreation_ComputeAttributeBonus(); | |
6827 if ( result >= v10 ) | |
6828 { | |
6829 if ( eAttribute ) | |
6830 { | |
6831 switch ( eAttribute ) | |
6832 { | |
6833 case 1: | |
6834 result = (signed int)&v2->uIntelligence; | |
6835 break; | |
6836 case 2: | |
6837 result = (signed int)&v2->uWillpower; | |
6838 break; | |
6839 case 3: | |
6840 result = (signed int)&v2->uEndurance; | |
6841 break; | |
6842 case 4: | |
6843 result = (signed int)&v2->uAccuracy; | |
6844 break; | |
6845 case 5: | |
6846 result = (signed int)&v2->uSpeed; | |
6847 break; | |
6848 default: | |
6849 result = eAttribute - 6; | |
6850 if ( eAttribute != 6 ) | |
6851 return result; | |
6852 result = (signed int)&v2->uLuck; | |
6853 break; | |
6854 } | |
6855 } | |
6856 else | |
6857 { | |
6858 result = (signed int)&v2->uMight; | |
6859 } | |
6860 if ( v5 + *(short *)result <= v4 ) | |
6861 *(short *)result += v5; | |
6862 } | |
6863 return result; | |
6864 } | |
6865 | |
6866 //----- (0049070F) -------------------------------------------------------- | |
6867 void Player::Zero() | |
6868 { | |
6869 Player *v1; // esi@1 | |
6870 | |
6871 v1 = this; | |
6872 this->sLevelModifier = 0; | |
6873 this->sACModifier = 0; | |
6874 this->uLuckBonus = 0; | |
6875 this->uAccuracyBonus = 0; | |
6876 this->uSpeedBonus = 0; | |
6877 this->uEnduranceBonus = 0; | |
6878 this->uWillpowerBonus = 0; | |
6879 this->uIntelligenceBonus = 0; | |
6880 this->uMightBonus = 0; | |
6881 this->field_100 = 0; | |
6882 this->field_FC = 0; | |
6883 this->field_F8 = 0; | |
6884 this->field_F4 = 0; | |
6885 this->field_F0 = 0; | |
6886 this->field_EC = 0; | |
6887 this->field_E8 = 0; | |
6888 this->field_E4 = 0; | |
6889 this->field_E0 = 0; | |
766 | 6890 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6891 v1->field_1A97 = 0; |
6892 v1->_ranged_dmg_bonus = 0; | |
6893 v1->field_1A95 = 0; | |
6894 v1->_ranged_atk_bonus = 0; | |
6895 v1->field_1A93 = 0; | |
6896 v1->_melee_dmg_bonus = 0; | |
6897 v1->field_1A91 = 0; | |
6898 v1->_some_attack_bonus = 0; | |
6899 v1->_mana_related = 0; | |
6900 v1->uFullManaBonus = 0; | |
6901 v1->_health_related = 0; | |
6902 v1->uFullHealthBonus = 0; | |
6903 } | |
6904 | |
6905 //----- (004907E7) -------------------------------------------------------- | |
299 | 6906 unsigned int Player::GetStatColor(int uStat) |
0 | 6907 { |
6908 __int16 uWhite; // si@1 | |
290 | 6909 int attribute_value; // edx@1 |
299 | 6910 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6911 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6912 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6913 | |
949 | 6914 uRed = TargetColor(0xFFu, 0x23u, 0); |
6915 uGreen = TargetColor(0, 0xFFu, 0); | |
6916 uWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
299 | 6917 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6918 |
0 | 6919 switch (uStat) |
6920 { | |
6921 case 0: attribute_value = uMight; break; | |
6922 case 1: attribute_value = uIntelligence; break; | |
6923 case 2: attribute_value = uWillpower; break; | |
6924 case 3: attribute_value = uEndurance; break; | |
290 | 6925 case 4: attribute_value = uAccuracy; break; |
6926 case 5: attribute_value = uSpeed; break; | |
0 | 6927 case 6: attribute_value = uLuck; break; |
6928 }; | |
6929 | |
299 | 6930 if ( attribute_value == pBaseAttrValue ) |
290 | 6931 return uWhite; |
299 | 6932 else if ( attribute_value > pBaseAttrValue ) |
290 | 6933 return uGreen; |
0 | 6934 else |
290 | 6935 return uRed; |
0 | 6936 } |
6937 | |
6938 //----- (004908A8) -------------------------------------------------------- | |
6939 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6940 { | |
6941 unsigned __int64 *result; // eax@1 | |
6942 | |
6943 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6944 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6945 { | |
6946 *(int *)result = 0; | |
6947 *((int *)result + 1) = 0; | |
6948 LOBYTE(result) = 1; | |
6949 } | |
6950 else | |
6951 { | |
6952 LOBYTE(result) = 0; | |
6953 } | |
6954 return (bool)result; | |
6955 } | |
6956 | |
6957 //----- (004680ED) -------------------------------------------------------- | |
6958 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6959 { | |
6960 Player *v3; // esi@1 | |
6961 unsigned int v4; // ebx@4 | |
6962 signed int v5; // eax@17 | |
6963 unsigned int v6; // eax@26 | |
6964 unsigned __int8 v7; // cf@37 | |
6965 int v8; // edx@39 | |
6966 int v9; // edx@40 | |
6967 int v10; // edx@41 | |
6968 int v11; // edx@42 | |
6969 int v12; // edx@43 | |
6970 char *v13; // eax@45 | |
6971 AudioPlayer *v14; // ecx@62 | |
6972 signed int v15; // edi@68 | |
6973 int v16; // edx@73 | |
6974 unsigned __int16 *v17; // edi@73 | |
6975 unsigned int v18; // eax@73 | |
6976 int v19; // eax@74 | |
6977 int v20; // eax@75 | |
6978 signed int v21; // eax@81 | |
6979 const char *v22; // eax@84 | |
6980 char *v23; // ecx@90 | |
6981 int v24; // esi@96 | |
6982 int v25; // eax@109 | |
6983 int v26; // eax@113 | |
6984 char *v27; // edi@114 | |
6985 signed __int64 v28; // qax@120 | |
6986 char *v29; // ecx@120 | |
6987 int v30; // edi@137 | |
6988 int v31; // ST30_4@137 | |
6989 int v32; // ST3C_4@137 | |
6990 int v33; // ST40_4@137 | |
6991 int v34; // ST34_4@137 | |
6992 int v35; // ST38_4@137 | |
6993 unsigned __int8 v36; // al@173 | |
6994 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6995 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6996 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6997 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6998 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6999 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
7000 signed int v43; // [sp-14h] [bp-40h]@18 | |
7001 signed int v44; // [sp-14h] [bp-40h]@174 | |
7002 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
7003 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
7004 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
7005 int v48; // [sp-Ch] [bp-38h]@18 | |
7006 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
7007 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
7008 int v51; // [sp-Ch] [bp-38h]@174 | |
7009 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
7010 char *v53; // [sp-8h] [bp-34h]@33 | |
7011 int v54; // [sp-8h] [bp-34h]@34 | |
7012 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
7013 int v56; // [sp-8h] [bp-34h]@66 | |
7014 const char *v57; // [sp-8h] [bp-34h]@69 | |
7015 const char *v58; // [sp-8h] [bp-34h]@89 | |
7016 int v59; // [sp-8h] [bp-34h]@120 | |
7017 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
7018 int v61; // [sp-4h] [bp-30h]@18 | |
7019 char *v62; // [sp-4h] [bp-30h]@33 | |
7020 char *v63; // [sp-4h] [bp-30h]@34 | |
7021 int v64; // [sp-4h] [bp-30h]@60 | |
7022 int v65; // [sp-4h] [bp-30h]@66 | |
7023 const char *v66; // [sp-4h] [bp-30h]@69 | |
7024 signed int v67; // [sp-4h] [bp-30h]@77 | |
7025 const char *v68; // [sp-4h] [bp-30h]@89 | |
7026 int v69; // [sp-4h] [bp-30h]@110 | |
7027 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
7028 int v71; // [sp-4h] [bp-30h]@174 | |
7029 char *v72; // [sp+20h] [bp-Ch]@68 | |
7030 signed int v73; // [sp+24h] [bp-8h]@1 | |
7031 char *v74; // [sp+24h] [bp-8h]@23 | |
7032 int v75; // [sp+24h] [bp-8h]@73 | |
7033 Player *thisb; // [sp+28h] [bp-4h]@1 | |
7034 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
7035 | |
7036 thisb = this; | |
243 | 7037 v3 = &pParty->pPlayers[a2-1]; |
0 | 7038 v73 = 1; |
7039 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
7040 return; | |
7041 v4 = 0; | |
7042 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
7043 { | |
7044 if ( pParty->pPickedItem.uItemID != 160 ) | |
7045 { | |
7046 if ( pParty->pPickedItem.uItemID == 161 ) | |
7047 { | |
7048 v27 = (char *)&v3->sMana; | |
7049 *(int *)v27 += 2; | |
7050 LABEL_170: | |
7051 if ( *(int *)v27 > v3->GetMaxMana() ) | |
7052 *(int *)v27 = v3->GetMaxMana(); | |
7053 } | |
7054 else | |
7055 { | |
7056 if ( pParty->pPickedItem.uItemID != 162 ) | |
7057 { | |
7058 LABEL_167: | |
7059 v68 = pParty->pPickedItem.GetDisplayName(); | |
7060 v58 = pGlobalTXT_LocalizationStrings[36]; | |
7061 goto LABEL_90; | |
7062 } | |
7063 v69 = 2; | |
7064 LABEL_111: | |
243 | 7065 pParty->pPlayers[a2-1].Heal(v69); |
0 | 7066 } |
7067 LABEL_112: | |
187 | 7068 v3->PlaySound(SPEECH_36, 0); |
0 | 7069 goto LABEL_173; |
7070 } | |
7071 LABEL_172: | |
100 | 7072 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 7073 goto LABEL_173; |
7074 } | |
7075 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
7076 { | |
7077 switch ( pParty->pPickedItem.uItemID ) | |
7078 { | |
7079 case 0xDEu: | |
570 | 7080 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7081 goto LABEL_110; |
7082 case 0xDFu: | |
570 | 7083 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7084 goto LABEL_114; |
7085 case 0xE0u: | |
7086 LODWORD(v3->pConditions[1]) = 0; | |
7087 HIDWORD(v3->pConditions[1]) = 0; | |
7088 goto LABEL_112; | |
7089 case 0xE1u: | |
7090 LODWORD(v3->pConditions[11]) = 0; | |
7091 HIDWORD(v3->pConditions[11]) = 0; | |
7092 LODWORD(v3->pConditions[9]) = 0; | |
7093 HIDWORD(v3->pConditions[9]) = 0; | |
7094 LODWORD(v3->pConditions[7]) = 0; | |
7095 HIDWORD(v3->pConditions[7]) = 0; | |
7096 goto LABEL_112; | |
7097 case 0xE2u: | |
7098 LODWORD(v3->pConditions[10]) = 0; | |
7099 HIDWORD(v3->pConditions[10]) = 0; | |
7100 LODWORD(v3->pConditions[8]) = 0; | |
7101 HIDWORD(v3->pConditions[8]) = 0; | |
7102 LODWORD(v3->pConditions[6]) = 0; | |
7103 HIDWORD(v3->pConditions[6]) = 0; | |
7104 goto LABEL_112; | |
7105 case 0xE3u: | |
7106 LODWORD(v3->pConditions[2]) = 0; | |
7107 HIDWORD(v3->pConditions[2]) = 0; | |
7108 goto LABEL_112; | |
7109 case 0xE4u: | |
7110 if ( v3->pConditions[1] ) | |
7111 goto LABEL_173; | |
7112 v70 = 0; | |
7113 v59 = 0; | |
7114 v50 = 5; | |
7115 v46 = 3; | |
570 | 7116 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7117 v29 = (char *)&v3->pPlayerBuffs[7]; |
7118 goto LABEL_147; | |
7119 case 0xE5u: | |
7120 v70 = 0; | |
7121 v59 = 0; | |
7122 v50 = 5; | |
7123 v46 = 3; | |
570 | 7124 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7125 v29 = (char *)&v3->pPlayerBuffs[8]; |
7126 goto LABEL_147; | |
7127 case 0xE6u: | |
7128 v70 = 0; | |
7129 v59 = 0; | |
7130 v50 = 5; | |
7131 v46 = 3; | |
570 | 7132 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7133 v29 = (char *)&v3->pPlayerBuffs[1]; |
7134 goto LABEL_147; | |
7135 case 0xE7u: | |
7136 v70 = 0; | |
7137 v59 = 0; | |
570 | 7138 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7139 v46 = 0; |
570 | 7140 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7141 v29 = (char *)&v3->pPlayerBuffs[11]; |
7142 goto LABEL_147; | |
7143 case 0xE8u: | |
7144 v70 = 0; | |
7145 v59 = 0; | |
570 | 7146 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7147 v46 = 0; |
570 | 7148 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7149 v29 = (char *)&v3->pPlayerBuffs[13]; |
7150 goto LABEL_147; | |
7151 case 0xEAu: | |
7152 v70 = 0; | |
7153 v59 = 0; | |
7154 v50 = 5; | |
7155 v46 = 3; | |
570 | 7156 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7157 v29 = (char *)&v3->pPlayerBuffs[14]; |
7158 goto LABEL_147; | |
7159 case 0xEBu: | |
7160 v3->pPlayerBuffs[23].Apply( | |
570 | 7161 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7162 3u, |
7163 5u, | |
7164 0, | |
7165 0); | |
7166 goto LABEL_173; | |
7167 case 0xEDu: | |
7168 LODWORD(v3->pConditions[3]) = 0; | |
7169 HIDWORD(v3->pConditions[3]) = 0; | |
7170 goto LABEL_112; | |
7171 case 0xEEu: | |
7172 LODWORD(v3->pConditions[0]) = 0; | |
7173 HIDWORD(v3->pConditions[0]) = 0; | |
7174 goto LABEL_112; | |
7175 case 0xEFu: | |
7176 LODWORD(v3->pConditions[5]) = 0; | |
7177 HIDWORD(v3->pConditions[5]) = 0; | |
7178 goto LABEL_112; | |
7179 case 0xF0u: | |
7180 v70 = 0; | |
7181 v59 = 0; | |
570 | 7182 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7183 v46 = 0; |
570 | 7184 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7185 v29 = (char *)&v3->pPlayerBuffs[19]; |
7186 goto LABEL_147; | |
7187 case 0xF1u: | |
7188 v70 = 0; | |
7189 v59 = 0; | |
570 | 7190 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7191 v46 = 0; |
570 | 7192 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7193 v29 = (char *)&v3->pPlayerBuffs[17]; |
7194 goto LABEL_147; | |
7195 case 0xF2u: | |
7196 v70 = 0; | |
7197 v59 = 0; | |
570 | 7198 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7199 v46 = 0; |
570 | 7200 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7201 v29 = (char *)&v3->pPlayerBuffs[20]; |
7202 goto LABEL_147; | |
7203 case 0xF3u: | |
7204 v70 = 0; | |
7205 v59 = 0; | |
570 | 7206 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7207 v46 = 0; |
570 | 7208 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7209 v29 = (char *)&v3->pPlayerBuffs[16]; |
7210 goto LABEL_147; | |
7211 case 0xF4u: | |
7212 v70 = 0; | |
7213 v59 = 0; | |
570 | 7214 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7215 v46 = 0; |
570 | 7216 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7217 v29 = (char *)&v3->pPlayerBuffs[21]; |
7218 goto LABEL_147; | |
7219 case 0xF5u: | |
7220 v70 = 0; | |
7221 v59 = 0; | |
570 | 7222 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7223 v46 = 0; |
570 | 7224 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7225 v29 = (char *)&v3->pPlayerBuffs[15]; |
7226 goto LABEL_147; | |
7227 case 0xFBu: | |
7228 LODWORD(v3->pConditions[12]) = 0; | |
7229 HIDWORD(v3->pConditions[12]) = 0; | |
7230 goto LABEL_112; | |
7231 case 0xFCu: | |
7232 v30 = LODWORD(v3->pConditions[14]); | |
7233 v31 = HIDWORD(v3->pConditions[14]); | |
7234 v32 = LODWORD(v3->pConditions[15]); | |
7235 v33 = HIDWORD(v3->pConditions[15]); | |
7236 v34 = LODWORD(v3->pConditions[16]); | |
7237 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7238 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7239 HIDWORD(v3->pConditions[14]) = v31; |
7240 LODWORD(v3->pConditions[15]) = v32; | |
7241 HIDWORD(v3->pConditions[15]) = v33; | |
7242 LODWORD(v3->pConditions[16]) = v34; | |
7243 LODWORD(v3->pConditions[14]) = v30; | |
7244 HIDWORD(v3->pConditions[16]) = v35; | |
7245 goto LABEL_112; | |
7246 case 0xFDu: | |
570 | 7247 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7248 LABEL_110: |
7249 v69 = v25; | |
7250 goto LABEL_111; | |
7251 case 0xFEu: | |
570 | 7252 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7253 LABEL_114: |
7254 v27 = (char *)&v3->sMana; | |
7255 *(int *)v27 += v26; | |
7256 goto LABEL_170; | |
7257 case 0xFFu: | |
7258 v70 = 0; | |
7259 v59 = 0; | |
570 | 7260 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7261 v46 = 0; |
570 | 7262 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7263 v29 = (char *)&v3->pPlayerBuffs[18]; |
7264 goto LABEL_147; | |
7265 case 0x100u: | |
7266 v70 = 0; | |
7267 v59 = 0; | |
570 | 7268 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7269 v46 = 0; |
570 | 7270 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7271 v29 = (char *)&v3->pPlayerBuffs[5]; |
7272 goto LABEL_147; | |
7273 case 0x101u: | |
7274 v70 = 0; | |
7275 v59 = 0; | |
570 | 7276 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7277 v46 = 0; |
570 | 7278 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7279 v29 = (char *)v3->pPlayerBuffs; |
7280 goto LABEL_147; | |
7281 case 0x102u: | |
7282 v70 = 0; | |
7283 v59 = 0; | |
570 | 7284 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7285 v46 = 0; |
570 | 7286 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7287 v29 = (char *)&v3->pPlayerBuffs[22]; |
7288 goto LABEL_147; | |
7289 case 0x103u: | |
7290 v70 = 0; | |
7291 v59 = 0; | |
570 | 7292 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7293 v46 = 0; |
570 | 7294 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7295 v29 = (char *)&v3->pPlayerBuffs[3]; |
7296 goto LABEL_147; | |
7297 case 0x104u: | |
7298 v70 = 0; | |
7299 v59 = 0; | |
570 | 7300 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7301 v46 = 0; |
570 | 7302 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7303 v29 = (char *)&v3->pPlayerBuffs[9]; |
7304 goto LABEL_147; | |
7305 case 0x105u: | |
7306 v70 = 0; | |
7307 v59 = 0; | |
570 | 7308 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7309 v46 = 0; |
570 | 7310 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7311 v29 = (char *)&v3->pPlayerBuffs[2]; |
7312 LABEL_147: | |
7313 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7314 goto LABEL_112; | |
7315 case 0x106u: | |
7316 LODWORD(v3->pConditions[15]) = 0; | |
7317 HIDWORD(v3->pConditions[15]) = 0; | |
7318 goto LABEL_112; | |
7319 case 0x108u: | |
7320 if ( !*(int *)&v3->field_1F5[3] ) | |
7321 { | |
7322 v3->uLuck += 50; | |
7323 *(int *)&v3->field_1F5[3] = 1; | |
7324 } | |
7325 goto LABEL_112; | |
7326 case 0x109u: | |
7327 if ( !*(int *)&v3->field_1F5[7] ) | |
7328 { | |
7329 v3->uSpeed += 50; | |
7330 *(int *)&v3->field_1F5[7] = 1; | |
7331 } | |
7332 goto LABEL_112; | |
7333 case 0x10Au: | |
7334 if ( !*(int *)&v3->field_1F5[11] ) | |
7335 { | |
7336 v3->uIntelligence += 50; | |
7337 *(int *)&v3->field_1F5[11] = 1; | |
7338 } | |
7339 goto LABEL_112; | |
7340 case 0x10Bu: | |
7341 if ( !*(int *)&v3->field_1F5[15] ) | |
7342 { | |
7343 v3->uEndurance += 50; | |
7344 *(int *)&v3->field_1F5[15] = 1; | |
7345 } | |
7346 goto LABEL_112; | |
7347 case 0x10Cu: | |
7348 if ( !*(int *)&v3->field_1F5[19] ) | |
7349 { | |
7350 v3->uWillpower += 50; | |
7351 *(int *)&v3->field_1F5[19] = 1; | |
7352 } | |
7353 goto LABEL_112; | |
7354 case 0x10Du: | |
7355 if ( !*(int *)&v3->field_1F5[23] ) | |
7356 { | |
7357 v3->uAccuracy += 50; | |
7358 *(int *)&v3->field_1F5[23] = 1; | |
7359 } | |
7360 goto LABEL_112; | |
7361 case 0x10Eu: | |
7362 if ( !*(int *)&v3->field_1F5[27] ) | |
7363 { | |
7364 v3->uMight += 50; | |
7365 *(int *)&v3->field_1F5[27] = 1; | |
7366 } | |
7367 goto LABEL_112; | |
7368 case 0x10Fu: | |
7369 v3->sAgeModifier = 0; | |
7370 goto LABEL_112; | |
809 | 7371 case 0xDDu: |
7372 goto LABEL_172; | |
0 | 7373 default: |
7374 goto LABEL_167; | |
7375 } | |
7376 goto LABEL_172; | |
7377 } | |
7378 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7379 { | |
7380 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7381 { | |
7382 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7383 { | |
7384 if ( pParty->pPickedItem.uItemID == 616 ) | |
7385 { | |
7386 thisa = pParty->uCurrentMonthWeek + 1; | |
7387 if ( pParty->uCurrentMonth >= 7 ) | |
7388 v74 = 0; | |
7389 else | |
7390 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7391 switch ( pParty->uCurrentMonth ) | |
7392 { | |
7393 case 0u: | |
7394 v6 = pParty->uCurrentMonthWeek + 1; | |
7395 v3->uMight += thisa; | |
7396 goto LABEL_33; | |
7397 case 1u: | |
7398 v6 = pParty->uCurrentMonthWeek + 1; | |
7399 v3->uIntelligence += thisa; | |
7400 goto LABEL_33; | |
7401 case 2u: | |
7402 v6 = pParty->uCurrentMonthWeek + 1; | |
7403 v3->uWillpower += thisa; | |
7404 goto LABEL_33; | |
7405 case 3u: | |
7406 v6 = pParty->uCurrentMonthWeek + 1; | |
7407 v3->uEndurance += thisa; | |
7408 goto LABEL_33; | |
7409 case 4u: | |
7410 v6 = pParty->uCurrentMonthWeek + 1; | |
7411 v3->uAccuracy += thisa; | |
7412 goto LABEL_33; | |
7413 case 5u: | |
7414 v6 = pParty->uCurrentMonthWeek + 1; | |
7415 v3->uSpeed += thisa; | |
7416 goto LABEL_33; | |
7417 case 6u: | |
7418 v6 = pParty->uCurrentMonthWeek + 1; | |
7419 v3->uLuck += thisa; | |
7420 LABEL_33: | |
7421 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7422 v53 = v74; | |
7423 v49 = v6; | |
7424 goto LABEL_53; | |
7425 case 7u: | |
7426 party_finds_gold(1000 * thisa, 0); | |
7427 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7428 v54 = 1000 * thisa; | |
7429 goto LABEL_38; | |
7430 case 8u: | |
7431 Party::GiveFood(5 * thisa); | |
7432 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7433 v54 = 5 * thisa; | |
7434 goto LABEL_38; | |
7435 case 9u: | |
7436 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7437 v3->uSkillPoints += 2 * thisa; | |
7438 v54 = 2 * thisa; | |
7439 goto LABEL_38; | |
7440 case 0xAu: | |
7441 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7442 v54 = 2500 * thisa; | |
7443 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7444 LODWORD(v3->uExperience) += 2500 * thisa; | |
7445 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7446 LABEL_38: | |
7447 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7448 goto LABEL_54; | |
7449 case 0xBu: | |
7450 v8 = rand() % 6; | |
7451 if ( v8 ) | |
7452 { | |
7453 v9 = v8 - 1; | |
7454 if ( v9 ) | |
7455 { | |
7456 v10 = v9 - 1; | |
7457 if ( v10 ) | |
7458 { | |
7459 v11 = v10 - 1; | |
7460 if ( v11 ) | |
7461 { | |
7462 v12 = v11 - 1; | |
7463 if ( v12 ) | |
7464 { | |
7465 if ( v12 != 1 ) | |
7466 goto LABEL_52; | |
7467 v3->sResBodyBase += thisa; | |
7468 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7469 } | |
7470 else | |
7471 { | |
7472 v3->sResMindBase += thisa; | |
7473 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7474 } | |
7475 } | |
7476 else | |
7477 { | |
7478 v3->sResEarthBase += thisa; | |
7479 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7480 } | |
7481 } | |
7482 else | |
7483 { | |
7484 v3->sResWaterBase += thisa; | |
7485 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7486 } | |
7487 } | |
7488 else | |
7489 { | |
7490 v3->sResAirBase += thisa; | |
7491 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7492 } | |
7493 } | |
7494 else | |
7495 { | |
7496 v3->sResFireBase += thisa; | |
7497 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7498 } | |
7499 v74 = v13; | |
7500 LABEL_52: | |
7501 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7502 v53 = v74; | |
7503 v49 = thisa; | |
7504 LABEL_53: | |
7505 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7506 LABEL_54: | |
7507 ShowStatusBarString(pTmpBuf, 2u); | |
7508 pMouse->RemoveHoldingItem(); | |
7509 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7510 v3->PlaySound(SPEECH_93, 0); |
0 | 7511 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7512 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7513 { | |
7514 v64 = 0; | |
7515 v55 = 16; | |
7516 } | |
7517 else | |
7518 { | |
7519 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7520 { | |
7521 v64 = 0; | |
7522 v55 = 14; | |
7523 } | |
7524 else | |
7525 { | |
7526 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7527 return; | |
7528 v64 = 0; | |
7529 v55 = 15; | |
7530 } | |
7531 } | |
7532 v3->SetCondition(v55, v64); | |
7533 v61 = 0; | |
7534 v52 = 0; | |
7535 v48 = 0; | |
7536 v45 = 0; | |
7537 v43 = -1; | |
7538 v41 = 0; | |
7539 v39 = 0; | |
7540 v37 = (SoundID)215; | |
7541 v14 = pAudioPlayer; | |
7542 goto LABEL_63; | |
7543 default: | |
7544 goto LABEL_54; | |
7545 } | |
7546 } | |
7547 if ( pParty->pPickedItem.uItemID == 630 ) | |
7548 { | |
7549 Party::GiveFood(1u); | |
7550 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7551 } | |
7552 else | |
7553 { | |
7554 if ( pParty->pPickedItem.uItemID == 632 ) | |
7555 { | |
7556 v61 = 0; | |
7557 v52 = 0; | |
7558 v48 = 0; | |
7559 v45 = 0; | |
7560 v43 = -1; | |
7561 v41 = 0; | |
7562 v39 = 0; | |
7563 v37 = (SoundID)133; | |
7564 goto LABEL_93; | |
7565 } | |
7566 if ( pParty->pPickedItem.uItemID == 633 ) | |
7567 { | |
7568 v61 = 0; | |
7569 v52 = 0; | |
7570 v48 = 0; | |
7571 v45 = 0; | |
7572 v43 = -1; | |
7573 v41 = 0; | |
7574 v39 = 0; | |
7575 v37 = (SoundID)134; | |
7576 goto LABEL_93; | |
7577 } | |
7578 if ( pParty->pPickedItem.uItemID == 634 ) | |
7579 { | |
7580 v61 = 0; | |
7581 v52 = 0; | |
7582 v48 = 0; | |
7583 v45 = 0; | |
7584 v43 = -1; | |
7585 v41 = 0; | |
7586 v39 = 0; | |
7587 v37 = (SoundID)135; | |
7588 goto LABEL_93; | |
7589 } | |
7590 if ( pParty->pPickedItem.uItemID != 646 ) | |
7591 { | |
7592 if ( pParty->pPickedItem.uItemID == 650 ) | |
7593 { | |
7594 sub_44C28F_open_nwc_dungeon(); | |
7595 return; | |
7596 } | |
7597 goto LABEL_167; | |
7598 } | |
7599 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7600 v5 = 8 * a2 + 392; | |
862 | 7601 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7602 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7603 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7604 } | |
7605 LABEL_187: | |
7606 pMouse->RemoveHoldingItem(); | |
7607 return; | |
7608 } | |
243 | 7609 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7610 { |
7611 sub_467F48(pParty->pPickedItem.uItemID); | |
7612 v65 = 0; | |
187 | 7613 v56 = SPEECH_37; |
0 | 7614 LABEL_67: |
187 | 7615 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7616 return; |
7617 } | |
7618 LABEL_89: | |
7619 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7620 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7621 LABEL_90: | |
809 | 7622 sprintfex(pTmpBuf, v58, v68); |
0 | 7623 v23 = pTmpBuf; |
7624 LABEL_91: | |
7625 ShowStatusBarString(v23, 2u); | |
7626 v4 = 0; | |
7627 goto LABEL_92; | |
7628 } | |
7629 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7630 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7631 if ( *v72 ) |
7632 { | |
7633 v66 = pParty->pPickedItem.GetDisplayName(); | |
7634 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7635 LABEL_72: | |
7636 sprintf(pTmpBuf, v57, v66); | |
7637 ShowStatusBarString(pTmpBuf, 2u); | |
7638 LABEL_92: | |
7639 v61 = v4; | |
7640 v52 = v4; | |
7641 v48 = v4; | |
7642 v45 = v4; | |
7643 v43 = -1; | |
7644 v41 = v4; | |
7645 v39 = v4; | |
7646 v37 = (SoundID)27; | |
7647 LABEL_93: | |
7648 v14 = pAudioPlayer; | |
7649 LABEL_63: | |
7650 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7651 return; | |
7652 } | |
243 | 7653 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7654 { |
7655 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7656 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7657 goto LABEL_72; | |
7658 } | |
7659 v16 = v15 % 11 + 1; | |
7660 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7661 v75 = v16; | |
7662 v18 = SkillToMastery(*v17) - 1; | |
7663 if ( v18 ) | |
7664 { | |
7665 v19 = v18 - 1; | |
7666 if ( v19 ) | |
7667 { | |
7668 v20 = v19 - 1; | |
7669 if ( v20 ) | |
7670 { | |
7671 if ( v20 != 1 ) | |
7672 { | |
7673 v21 = a2; | |
7674 LABEL_83: | |
7675 if ( v75 > v21 || !*v17 ) | |
7676 { | |
7677 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7678 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7679 ShowStatusBarString(pTmpBuf, 2u); |
7680 v65 = 0; | |
7681 v56 = 20; | |
7682 goto LABEL_67; | |
7683 } | |
7684 *v72 = 1; | |
187 | 7685 v3->PlaySound(SPEECH_21, 0); |
0 | 7686 v73 = 0; |
7687 LABEL_173: | |
7688 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7689 if ( v36 == 14 ) | |
7690 { | |
7691 v71 = 0; | |
7692 v60 = 0; | |
7693 v51 = 0; | |
7694 v47 = 0; | |
7695 v44 = -1; | |
7696 v42 = 0; | |
7697 v40 = 0; | |
7698 v38 = (SoundID)210; | |
7699 } | |
7700 else | |
7701 { | |
7702 if ( v36 != 13 ) | |
7703 { | |
7704 LABEL_178: | |
7705 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7706 { | |
7707 if ( !v73 ) | |
7708 goto LABEL_187; | |
437 | 7709 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7710 { |
990 | 7711 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7712 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7713 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7714 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7715 }*/ |
7716 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7717 } |
7718 if ( v73 ) | |
7719 { | |
7720 if ( pParty->bTurnBasedModeOn ) | |
7721 { | |
7722 *(&pParty->field_16140 + a2) = 100; | |
7723 thisb->SetRecoveryTime(100); | |
7724 pTurnEngine->_40471C(); | |
7725 } | |
7726 else | |
7727 { | |
7728 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7729 } | |
7730 } | |
7731 goto LABEL_187; | |
7732 } | |
7733 v71 = 0; | |
7734 v60 = 0; | |
7735 v51 = 0; | |
7736 v47 = 0; | |
7737 v44 = -1; | |
7738 v42 = 0; | |
7739 v40 = 0; | |
7740 v38 = (SoundID)211; | |
7741 } | |
7742 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7743 goto LABEL_178; | |
7744 } | |
7745 v67 = 11; | |
7746 } | |
7747 else | |
7748 { | |
7749 v67 = 10; | |
7750 } | |
7751 } | |
7752 else | |
7753 { | |
7754 v67 = 7; | |
7755 } | |
7756 } | |
7757 else | |
7758 { | |
7759 v67 = 4; | |
7760 } | |
7761 v21 = v67; | |
7762 goto LABEL_83; | |
7763 } | |
151 | 7764 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7765 return; |
243 | 7766 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7767 goto LABEL_89; |
7768 if ( bUnderwater == 1 ) | |
7769 { | |
7770 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7771 goto LABEL_91; | |
7772 } | |
7773 dword_50C9AC = 1; | |
7774 v24 = pParty->pPickedItem.uItemID - 299; | |
7775 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7776 { | |
7777 pMouse->RemoveHoldingItem(); | |
7778 pGUIWindow_CurrentMenu->Release(); | |
7779 pIcons_LOD->_4114F2(); | |
151 | 7780 pCurrentScreen = SCREEN_GAME; |
0 | 7781 viewparams->bRedrawGameUI = 1; |
7782 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7783 } | |
7784 else | |
7785 { | |
7786 _720984_unused = pParty->pPickedItem.uItemID; | |
7787 pMouse->RemoveHoldingItem(); | |
998 | 7788 /*if ( dword_50C9E8 < 40 ) |
0 | 7789 { |
7790 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7791 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7792 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7793 ++dword_50C9E8; |
998 | 7794 }*/ |
7795 pMessageQueue_50CBD0->AddMessage(UIMSG_92, 0, 0); | |
0 | 7796 if ( pCurrentScreen |
7797 && pGUIWindow_CurrentMenu | |
437 | 7798 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7799 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7800 { | |
990 | 7801 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7802 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7803 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7804 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7805 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7806 } | |
7807 } | |
7808 } | |
0 | 7809 |
7810 | |
7811 | |
7812 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7813 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7814 { | |
0 | 7815 Player *v3; // esi@1 |
7816 signed int v4; // edi@1 | |
7817 unsigned int v5; // eax@8 | |
7818 int v6; // eax@9 | |
7819 enum CHARACTER_RACE v7; // eax@11 | |
7820 signed int v8; // eax@17 | |
7821 unsigned __int8 v9; // sf@17 | |
7822 unsigned __int8 v10; // of@17 | |
7823 int v11; // eax@19 | |
7824 unsigned int v12; // eax@20 | |
484 | 7825 unsigned int test_bit_value; // eax@25 |
7826 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7827 signed int v15; // ecx@28 |
7828 ItemGen *v16; // eax@28 | |
7829 char v17; // zf@31 | |
7830 int v18; // edi@90 | |
7831 DDM_DLV_Header *v19; // eax@122 | |
7832 char v20; // cl@124 | |
7833 DDM_DLV_Header *v21; // eax@126 | |
7834 unsigned int v22; // edi@129 | |
100 | 7835 Player *v23; // esi@134 |
0 | 7836 ItemGen *v24; // ecx@135 |
7837 signed int v25; // edx@135 | |
7838 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7839 char *v27; // edi@155 | |
7840 int v28; // ebx@161 | |
7841 int v29; // eax@161 | |
7842 | |
469 | 7843 v6 = 0; |
0 | 7844 v3 = this; |
7845 v4 = -1; | |
469 | 7846 if ( VarNum > VAR_AutoNotes ) |
7847 { | |
7848 switch ( VarNum ) | |
0 | 7849 { |
7850 case VAR_Invisible: | |
484 | 7851 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7852 return true; |
484 | 7853 return false; |
0 | 7854 case VAR_NumDeaths: |
7855 v4 = pParty->uNumDeaths; | |
469 | 7856 return v4 >= pValue; |
0 | 7857 case VAR_NumBounties: |
7858 v4 = pParty->uNumBountiesCollected; | |
469 | 7859 return v4 >= pValue; |
0 | 7860 case VAR_PrisonTerms: |
7861 v4 = pParty->uNumPrisonTerms; | |
469 | 7862 return v4 >= pValue; |
0 | 7863 case VAR_ArenaWinsPage: |
7864 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7865 return v4 >= pValue; |
0 | 7866 case VAR_ArenaWinsSquire: |
7867 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7868 return v4 >= pValue; |
0 | 7869 case VAR_ArenaWinsKnight: |
7870 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7871 return v4 >= pValue; |
0 | 7872 case VAR_ArenaWinsLord: |
7873 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7874 return v4 >= pValue; |
0 | 7875 case VAR_ReputationInCurrentLocation: |
7876 v19 = &pOutdoor->ddm; | |
7877 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7878 v19 = &pIndoor->dlv; | |
469 | 7879 v6 = v19->uReputation >= pValue; |
7880 return v6; | |
0 | 7881 case VAR_History_28|VAR_Sex: |
7882 v21 = &pOutdoor->ddm; | |
7883 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7884 v21 = &pIndoor->dlv; | |
469 | 7885 v6 = v21->field_C_alert == pValue; |
0 | 7886 return v6; |
7887 case VAR_MonthEquals2|VAR_Sex: | |
7888 case VAR_MonthEquals2|VAR_Class: | |
7889 case VAR_Counter1: | |
7890 case VAR_Counter2: | |
7891 case VAR_Counter3: | |
7892 case VAR_Counter4: | |
7893 case VAR_Counter5: | |
7894 case VAR_Counter6: | |
7895 case VAR_Counter7: | |
7896 case VAR_Counter8: | |
469 | 7897 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7898 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7899 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7900 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7901 return true; | |
7902 return false; | |
0 | 7903 case VAR_NumSkillPoints: |
7904 v4 = this->uSkillPoints; | |
469 | 7905 return v4 >= pValue; |
0 | 7906 case VAR_CircusPrises: |
7907 v4 = 0; | |
100 | 7908 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7909 do |
7910 { | |
469 | 7911 v24 = v23->pInventoryItems; |
0 | 7912 v25 = 138; |
7913 do | |
7914 { | |
7915 switch ( v24->uItemID ) | |
7916 { | |
7917 case 0x1D6u: | |
7918 ++v4; | |
7919 break; | |
7920 case 0x1D7u: | |
7921 v4 += 3; | |
7922 break; | |
7923 case 0x1DDu: | |
7924 v4 += 5; | |
7925 break; | |
7926 } | |
7927 ++v24; | |
7928 --v25; | |
7929 } | |
7930 while ( v25 ); | |
100 | 7931 ++v23; |
0 | 7932 } |
100 | 7933 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7934 return v4 >= pValue; |
0 | 7935 case VAR_MonthEquals2: |
469 | 7936 v6 = pParty->uCurrentMonth == pValue; |
7937 return v6; | |
0 | 7938 case VAR_IsFlying: |
7939 if ( pParty->bFlying | |
484 | 7940 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7941 return true; |
7942 return false; | |
0 | 7943 case VAR_HiredNPCHasSpeciality: |
469 | 7944 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7945 return v6; |
7946 case VAR_NPCs2: | |
469 | 7947 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7948 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7949 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7950 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7951 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7952 return v4 >= pValue; |
7953 v4 = pValue; | |
7954 return v4 >= pValue; | |
0 | 7955 case VAR_ItemEquipped: |
7956 v26 = (ITEM_EQUIP_TYPE)0; | |
7957 v27 = (char *)&this->pEquipment; | |
7958 break; | |
7959 case VAR_GoldInBank: | |
7960 v4 = pParty->uNumGoldInBank; | |
469 | 7961 return v4 >= pValue; |
0 | 7962 case VAR_ThieverySkill|0x80: |
7963 v28 = GetActualMight(); | |
7964 v29 = v3->GetBaseStrength(); | |
7965 goto LABEL_168; | |
7966 case VAR_DisarmTrapSkill|0x80: | |
7967 v28 = GetActualIntelligence(); | |
7968 v29 = v3->GetBaseIntelligence(); | |
7969 goto LABEL_168; | |
7970 case VAR_MonthEquals: | |
7971 v28 = GetActualWillpower(); | |
7972 v29 = v3->GetBaseWillpower(); | |
7973 goto LABEL_168; | |
7974 case VAR_MonthEquals|VAR_Sex: | |
7975 v28 = GetActualEndurance(); | |
7976 v29 = v3->GetBaseEndurance(); | |
7977 goto LABEL_168; | |
7978 case VAR_IdentifyMonsterSkill|0x80: | |
7979 v28 = GetActualSpeed(); | |
7980 v29 = v3->GetBaseSpeed(); | |
7981 goto LABEL_168; | |
7982 case VAR_ArmsmasterSkill|0x80: | |
7983 v28 = GetActualAccuracy(); | |
7984 v29 = v3->GetBaseAccuracy(); | |
7985 goto LABEL_168; | |
7986 case VAR_MonthEquals|VAR_MaxHP: | |
7987 v28 = GetActualLuck(); | |
7988 v29 = v3->GetBaseLuck(); | |
7989 LABEL_168: | |
7990 v10 = __OFSUB__(v28, v29); | |
7991 v9 = v28 - v29 < 0; | |
7992 LABEL_169: | |
7993 if ( v9 ^ v10 ) | |
469 | 7994 return v4 >= pValue; |
7995 return true; | |
0 | 7996 default: |
469 | 7997 return v4 >= pValue; |
0 | 7998 } |
7999 while ( !v3->HasItemEquipped(v26) | |
654 | 8000 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 8001 { |
8002 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
8003 v27 += 4; | |
8004 if ( (signed int)v26 >= 16 ) | |
469 | 8005 return false; |
8006 } | |
8007 return true; | |
8008 } | |
8009 if ( VarNum == VAR_AutoNotes ) | |
0 | 8010 { |
484 | 8011 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
8012 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
8013 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8014 return false; | |
8015 return true; | |
469 | 8016 } |
8017 if ( VarNum <= VAR_BaseLuck ) | |
8018 { | |
8019 if ( VarNum != VAR_BaseLuck ) | |
8020 { | |
8021 switch ( VarNum ) | |
0 | 8022 { |
8023 case VAR_Hour: | |
469 | 8024 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
8025 return true; | |
8026 return false; | |
0 | 8027 case VAR_DayOfYear: |
469 | 8028 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
8029 v6 = v5 == pValue; | |
8030 return v6; | |
0 | 8031 case VAR_DayOfWeek: |
469 | 8032 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
8033 v6 = v5 == pValue; | |
0 | 8034 return v6; |
8035 case VAR_Sex: | |
469 | 8036 if ( pValue == (CHARACTER_RACE)this->uSex ) |
8037 return true; | |
8038 return v4 >= pValue; | |
0 | 8039 case VAR_Class: |
135 | 8040 v7 = (CHARACTER_RACE)this->classType; |
469 | 8041 if ( pValue == v7 ) |
8042 return true; | |
8043 return v4 >= pValue; | |
0 | 8044 case VAR_Race: |
8045 v7 = GetRace(); | |
469 | 8046 if ( pValue == v7 ) |
8047 return true; | |
8048 return v4 >= pValue; | |
0 | 8049 case VAR_CurrentHP: |
8050 v4 = this->sHealth; | |
469 | 8051 return v4 >= pValue; |
0 | 8052 case VAR_MaxHP: |
8053 v8 = GetMaxHealth(); | |
8054 v10 = __OFSUB__(v3->sHealth, v8); | |
8055 v9 = v3->sHealth - v8 < 0; | |
8056 goto LABEL_169; | |
8057 case VAR_CurrentSP: | |
8058 v4 = this->sMana; | |
469 | 8059 return v4 >= pValue; |
0 | 8060 case VAR_MaxSP: |
8061 v11 = GetMaxMana(); | |
8062 v10 = __OFSUB__(v3->sMana, v11); | |
8063 v9 = v3->sMana - v11 < 0; | |
8064 goto LABEL_169; | |
8065 case VAR_ActualAC: | |
8066 v12 = GetActualAC(); | |
8067 goto _j_cmp_against_arg; | |
8068 case VAR_ACModifier: | |
8069 v4 = this->sACModifier; | |
469 | 8070 return v4 >= pValue; |
0 | 8071 case VAR_BaseLevel: |
8072 v4 = this->uLevel; | |
469 | 8073 return v4 >= pValue; |
0 | 8074 case VAR_LevelModifier: |
8075 v4 = this->sLevelModifier; | |
469 | 8076 return v4 >= pValue; |
0 | 8077 case VAR_Age: |
8078 v12 = GetActualAge(); | |
8079 goto _j_cmp_against_arg; | |
8080 case VAR_Award: | |
484 | 8081 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
8082 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
8083 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8084 return true; | |
8085 return false; | |
0 | 8086 case VAR_Experience: |
8087 v4 = LODWORD(this->uExperience); | |
469 | 8088 return v4 >= pValue; |
0 | 8089 case VAR_QBits_QuestsDone: |
484 | 8090 test_bit_value = 0x80u >> (pValue - 1) % 8; |
8091 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
8092 if ( test_bit_value & our_bit_value ) | |
478 | 8093 return true; |
8094 return false; | |
0 | 8095 case VAR_PlayerItemInHands: |
8096 v15 = 0; | |
8097 v16 = v3->pInventoryItems; | |
8098 break; | |
8099 case VAR_FixedGold: | |
8100 v4 = pParty->uNumGold; | |
469 | 8101 return v4 >= pValue; |
0 | 8102 case VAR_MightBonus: |
8103 v4 = this->uMightBonus; | |
469 | 8104 return v4 >= pValue; |
0 | 8105 case VAR_IntellectBonus: |
8106 v4 = this->uIntelligenceBonus; | |
469 | 8107 return v4 >= pValue; |
0 | 8108 case VAR_PersonalityBonus: |
8109 v4 = this->uWillpowerBonus; | |
469 | 8110 return v4 >= pValue; |
0 | 8111 case VAR_EnduranceBonus: |
8112 v4 = this->uEnduranceBonus; | |
469 | 8113 return v4 >= pValue; |
0 | 8114 case VAR_SpeedBonus: |
8115 v4 = this->uSpeedBonus; | |
469 | 8116 return v4 >= pValue; |
0 | 8117 case VAR_AccuracyBonus: |
8118 v4 = this->uAccuracyBonus; | |
469 | 8119 return v4 >= pValue; |
0 | 8120 case VAR_LuckBonus: |
8121 v4 = this->uLuckBonus; | |
469 | 8122 return v4 >= pValue; |
0 | 8123 case VAR_BaseMight: |
8124 v4 = this->uMight; | |
469 | 8125 return v4 >= pValue; |
0 | 8126 case VAR_BaseIntellect: |
8127 v4 = this->uIntelligence; | |
469 | 8128 return v4 >= pValue; |
0 | 8129 case VAR_BasePersonality: |
8130 v4 = this->uWillpower; | |
469 | 8131 return v4 >= pValue; |
0 | 8132 case VAR_BaseEndurance: |
8133 v4 = this->uEndurance; | |
469 | 8134 return v4 >= pValue; |
0 | 8135 case VAR_BaseSpeed: |
8136 v4 = this->uSpeed; | |
469 | 8137 return v4 >= pValue; |
0 | 8138 case VAR_BaseAccuracy: |
8139 v4 = this->uAccuracy; | |
469 | 8140 return v4 >= pValue; |
0 | 8141 case VAR_FixedFood: |
8142 v4 = pParty->uNumFoodRations; | |
469 | 8143 return v4 >= pValue; |
0 | 8144 default: |
469 | 8145 return v4 >= pValue; |
8146 } | |
8147 while ( v16->uItemID != pValue ) | |
0 | 8148 { |
8149 ++v15; | |
8150 ++v16; | |
8151 if ( v15 >= 138 ) | |
8152 { | |
469 | 8153 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8154 return v6; |
8155 } | |
8156 } | |
469 | 8157 return true; |
0 | 8158 } |
8159 v4 = this->uLuck; | |
469 | 8160 return v4 >= pValue; |
8161 } | |
8162 if ( VarNum <= VAR_MagicResistance ) | |
8163 { | |
8164 if ( VarNum == VAR_MagicResistance ) | |
0 | 8165 { |
8166 v4 = this->sResMagicBase; | |
8167 } | |
8168 else | |
8169 { | |
469 | 8170 switch ( VarNum ) |
0 | 8171 { |
8172 case VAR_FireResistance: | |
8173 v4 = this->sResFireBase; | |
469 | 8174 return v4 >= pValue; |
0 | 8175 case VAR_AirResistance: |
8176 v4 = this->sResAirBase; | |
469 | 8177 return v4 >= pValue; |
0 | 8178 case VAR_WaterResistance: |
8179 v4 = this->sResWaterBase; | |
469 | 8180 return v4 >= pValue; |
0 | 8181 case VAR_EarthResistance: |
8182 v4 = this->sResEarthBase; | |
469 | 8183 return v4 >= pValue; |
0 | 8184 case VAR_SpiritResistance: |
8185 v4 = this->sResSpiritBase; | |
469 | 8186 return v4 >= pValue; |
0 | 8187 case VAR_MindResistance: |
8188 v4 = this->sResMindBase; | |
469 | 8189 return v4 >= pValue; |
0 | 8190 case VAR_BodyResistance: |
8191 v4 = this->sResBodyBase; | |
469 | 8192 return v4 >= pValue; |
0 | 8193 case VAR_LightResistance: |
8194 v4 = this->sResLightBase; | |
469 | 8195 return v4 >= pValue; |
0 | 8196 case VAR_DarkResistance: |
8197 v4 = this->sResDarkBase; | |
469 | 8198 return v4 >= pValue; |
0 | 8199 case VAR_ActualMight: |
8200 v12 = GetActualMight(); | |
8201 goto _j_cmp_against_arg; | |
8202 case VAR_ActualIntellect: | |
8203 v12 = GetActualIntelligence(); | |
8204 goto _j_cmp_against_arg; | |
8205 case VAR_ActualPersonality: | |
8206 v12 = GetActualWillpower(); | |
8207 goto _j_cmp_against_arg; | |
8208 case VAR_ActualEndurance: | |
8209 v12 = GetActualEndurance(); | |
8210 goto _j_cmp_against_arg; | |
8211 case VAR_ActualSpeed: | |
8212 v12 = GetActualSpeed(); | |
8213 goto _j_cmp_against_arg; | |
8214 case VAR_ActualAccuracy: | |
8215 v12 = GetActualAccuracy(); | |
8216 goto _j_cmp_against_arg; | |
8217 case VAR_ActualLuck: | |
8218 v12 = GetActualLuck(); | |
8219 _j_cmp_against_arg: | |
8220 v4 = v12; | |
8221 break; | |
8222 default: | |
469 | 8223 return v4 >= pValue; |
8224 } | |
8225 } | |
8226 return v4 >= pValue; | |
8227 } | |
8228 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8229 { | |
8230 if ( VarNum != VAR_DisarmTrapSkill ) | |
8231 { | |
8232 if ( VarNum <= VAR_MindResistanceBonus ) | |
8233 { | |
8234 switch ( VarNum ) | |
0 | 8235 { |
8236 case VAR_MindResistanceBonus: | |
8237 v4 = this->sResMindBonus; | |
8238 break; | |
8239 case VAR_FireResistanceBonus: | |
8240 v4 = this->sResFireBonus; | |
8241 break; | |
8242 case VAR_AirResistanceBonus: | |
8243 v4 = this->sResAirBonus; | |
8244 break; | |
8245 case VAR_WaterResistanceBonus: | |
8246 v4 = this->sResWaterBonus; | |
8247 break; | |
8248 case VAR_EarthResistanceBonus: | |
8249 v4 = this->sResEarthBonus; | |
8250 break; | |
8251 case VAR_SpiritResistanceBonus: | |
8252 v4 = this->sResSpiritBonus; | |
8253 break; | |
8254 } | |
469 | 8255 return v4 >= pValue; |
8256 } | |
8257 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8258 { |
8259 v4 = this->sResBodyBonus; | |
469 | 8260 return v4 >= pValue; |
8261 } | |
8262 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8263 { |
8264 v4 = this->sResLightBonus; | |
469 | 8265 return v4 >= pValue; |
8266 } | |
8267 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8268 { |
8269 v4 = this->sResDarkBonus; | |
469 | 8270 return v4 >= pValue; |
8271 } | |
8272 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8273 { |
8274 v4 = this->sResMagicBonus; | |
469 | 8275 return v4 >= pValue; |
8276 } | |
8277 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8278 return v4 >= pValue; | |
0 | 8279 } |
8280 LABEL_90: | |
469 | 8281 v18 = *((short *)&this->pConditions[16] + VarNum); |
8282 if ( pValue <= 63 ) | |
0 | 8283 v4 = v18 & 0x3F; |
8284 else | |
469 | 8285 v4 = pValue & v18; |
8286 return v4 >= pValue; | |
8287 } | |
8288 if ( VarNum == 104 ) | |
0 | 8289 goto LABEL_90; |
469 | 8290 if ( (signed int)VarNum <= 104 ) |
8291 return v4 >= pValue; | |
8292 if ( (signed int)VarNum > 0x79 ) | |
8293 { | |
8294 if ( VarNum != 122 ) | |
8295 { | |
8296 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8297 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8298 return v4 >= pValue; | |
0 | 8299 } |
8300 v4 = GetMajorConditionIdx(); | |
8301 if ( v4 != 18 ) | |
8302 { | |
469 | 8303 return v4 >= pValue; |
8304 } | |
8305 v4 = pValue; | |
8306 return v4 >= pValue; | |
8307 } | |
8308 return *((int *)this + 2 * VarNum - 210); | |
0 | 8309 } |
8310 | |
8311 | |
8312 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8313 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8314 { | |
8315 signed int currPlayerId; // ebx@1 | |
0 | 8316 Player *v4; // esi@1 |
8317 unsigned int v5; // edi@1 | |
8318 unsigned int v6; // esi@13 | |
8319 unsigned int v7; // esi@14 | |
8320 signed int v8; // eax@17 | |
8321 ItemGen *v9; // ecx@17 | |
8322 int v10; // eax@21 | |
8323 signed int v11; // eax@30 | |
8324 Player *v12; // ecx@44 | |
8325 char *v13; // ecx@45 | |
8326 Player *v14; // ecx@49 | |
8327 int v15; // ecx@86 | |
8328 int v16; // esi@106 | |
8329 char v17; // al@106 | |
8330 int v18; // eax@107 | |
8331 Player *v19; // ecx@112 | |
8332 Player *v20; // ecx@127 | |
8333 int v21; // eax@127 | |
8334 int v22; // eax@145 | |
8335 char v23; // zf@146 | |
8336 DDM_DLV_Header *v24; // ecx@148 | |
8337 signed int v25; // eax@172 | |
8338 int v26; // [sp-8h] [bp-3Ch]@84 | |
8339 signed int v27; // [sp-4h] [bp-38h]@4 | |
8340 int v28; // [sp-4h] [bp-38h]@84 | |
8341 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8342 char v30; // [sp+32h] [bp-2h]@1 | |
8343 char v31; // [sp+33h] [bp-1h]@1 | |
8344 | |
492 | 8345 currPlayerId = 0; |
0 | 8346 v30 = 0; |
8347 v31 = 0; | |
8348 v4 = this; | |
8349 v5 = 0; | |
8350 if ( this == pPlayers[2] ) | |
492 | 8351 currPlayerId = 1; |
8352 else if ( this == pPlayers[3] ) | |
8353 currPlayerId = 2; | |
757 | 8354 else if ( this == pPlayers[4] ) |
492 | 8355 currPlayerId = 3; |
8356 if ( var_type > VAR_AutoNotes ) | |
8357 { | |
8358 if ( var_type <= VAR_GoldInBank ) | |
8359 { | |
8360 if ( var_type == VAR_GoldInBank ) | |
8361 { | |
8362 pParty->uNumGoldInBank = var_value; | |
0 | 8363 return; |
8364 } | |
492 | 8365 if ( var_type <= VAR_Counter8 ) |
8366 { | |
8367 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8368 { |
492 | 8369 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8370 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8371 } |
8372 else | |
8373 { | |
492 | 8374 switch ( var_type ) |
0 | 8375 { |
8376 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8377 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8378 break; |
8379 case VAR_NPCs2: | |
8380 pParty->field_709 = 0; | |
492 | 8381 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8382 Party__CountHirelings(); |
0 | 8383 viewparams->bRedrawGameUI = 1; |
8384 break; | |
8385 case VAR_NumSkillPoints: | |
492 | 8386 this->uSkillPoints = var_value; |
0 | 8387 break; |
8388 } | |
8389 } | |
8390 return; | |
8391 } | |
492 | 8392 if ( var_type < VAR_Counter9 ) |
0 | 8393 return; |
492 | 8394 if ( (signed int)var_type <= 0x112 ) |
8395 { | |
8396 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8397 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8398 } |
8399 else | |
8400 { | |
492 | 8401 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8402 { |
8403 v24 = &pOutdoor->ddm; | |
8404 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8405 v24 = &pIndoor->dlv; | |
492 | 8406 v24->uReputation = var_value; |
8407 if ( var_value > 10000 ) | |
0 | 8408 v24->uReputation = 10000; |
8409 return; | |
8410 } | |
492 | 8411 if ( var_type <= VAR_ReputationInCurrentLocation |
8412 || var_type > VAR_History_28 | |
8413 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8414 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8415 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8416 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8417 v23) ) |
8418 return; | |
8419 bFlashHistoryBook = 1; | |
8420 } | |
8421 LABEL_172: | |
492 | 8422 v25 = 8 * currPlayerId + 400; |
862 | 8423 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8424 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8425 return; | |
8426 } | |
492 | 8427 if ( var_type != 307 ) |
8428 { | |
8429 switch ( var_type ) | |
0 | 8430 { |
8431 case 308: | |
492 | 8432 pParty->uNumBountiesCollected = var_value; |
0 | 8433 break; |
8434 case 309: | |
492 | 8435 pParty->uNumPrisonTerms = var_value; |
0 | 8436 break; |
8437 case 310: | |
492 | 8438 pParty->uNumArenaPageWins = var_value; |
0 | 8439 break; |
8440 case 311: | |
492 | 8441 pParty->uNumArenaSquireWins = var_value; |
0 | 8442 break; |
8443 case 312: | |
492 | 8444 pParty->uNumArenaKnightWins = var_value; |
0 | 8445 break; |
8446 case 313: | |
492 | 8447 pParty->uNumArenaLordWins = var_value; |
0 | 8448 break; |
8449 } | |
8450 return; | |
8451 } | |
492 | 8452 pParty->uNumDeaths = var_value; |
0 | 8453 LABEL_168: |
8454 if ( v30 != 1 ) | |
8455 { | |
8456 LABEL_170: | |
8457 if ( v31 != 1 ) | |
8458 return; | |
8459 v5 = 0; | |
8460 goto LABEL_172; | |
8461 } | |
8462 LABEL_169: | |
492 | 8463 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8464 goto LABEL_170; |
8465 } | |
492 | 8466 if ( var_type == VAR_AutoNotes ) |
8467 { | |
8468 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
|
8469 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8470 && pAutonoteTxt[var_value-1].pText ) |
8471 { | |
8472 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8473 v30 = 1; |
187 | 8474 v20->PlaySound(SPEECH_96, 0); |
492 | 8475 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8476 bFlashAutonotesBook = 1; |
981 | 8477 _506568_autonote_type = v21; |
0 | 8478 } |
492 | 8479 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8480 v31 = 1; |
8481 goto LABEL_168; | |
8482 } | |
492 | 8483 if ( var_type <= VAR_ActualMight ) |
8484 { | |
8485 if ( var_type != VAR_ActualMight ) | |
8486 { | |
8487 switch ( var_type ) | |
0 | 8488 { |
8489 case VAR_RandomGold: | |
492 | 8490 v6 = rand() % var_value + 1; |
0 | 8491 Party::SetGold(v6); |
8492 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8493 ShowStatusBarString(pTmpBuf, 2u); | |
8494 GameUI_DrawFoodAndGold(); | |
8495 return; | |
8496 case VAR_RandomFood: | |
492 | 8497 v7 = rand() % var_value + 1; |
0 | 8498 Party::SetFood(v7); |
8499 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8500 ShowStatusBarString(pTmpBuf, 2u); | |
8501 GameUI_DrawFoodAndGold(); | |
8502 goto LABEL_124; | |
8503 case VAR_Sex: | |
492 | 8504 this->uSex = (PLAYER_SEX)var_value; |
0 | 8505 goto LABEL_124; |
8506 case VAR_Class: | |
492 | 8507 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8508 if ( (char)var_value != 35 ) | |
0 | 8509 goto LABEL_124; |
8510 v8 = 0; | |
8511 v9 = this->pInventoryItems; | |
8512 break; | |
8513 case VAR_CurrentHP: | |
492 | 8514 this->sHealth = var_value; |
0 | 8515 goto LABEL_124; |
8516 case VAR_MaxHP: | |
8517 this->sHealth = GetMaxHealth(); | |
8518 return; | |
8519 case VAR_CurrentSP: | |
492 | 8520 this->sMana = var_value; |
0 | 8521 goto LABEL_124; |
8522 case VAR_MaxSP: | |
8523 this->sMana = GetMaxMana(); | |
8524 return; | |
8525 case VAR_ACModifier: | |
492 | 8526 this->sACModifier = (unsigned __int8)var_value; |
0 | 8527 goto LABEL_124; |
8528 case VAR_BaseLevel: | |
492 | 8529 this->uLevel = (unsigned __int8)var_value; |
0 | 8530 goto LABEL_124; |
8531 case VAR_LevelModifier: | |
492 | 8532 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8533 goto LABEL_124; |
8534 case VAR_Age: | |
492 | 8535 this->sAgeModifier = var_value; |
0 | 8536 return; |
8537 case VAR_Award: | |
492 | 8538 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8539 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
|
8540 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8541 && pAwards[var_value].pText ) |
0 | 8542 { |
8543 v30 = 1; | |
8544 v31 = 1; | |
492 | 8545 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8546 } |
492 | 8547 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8548 goto LABEL_168; | |
0 | 8549 case VAR_Experience: |
492 | 8550 this->uExperience = var_value; |
0 | 8551 goto LABEL_124; |
8552 case VAR_QBits_QuestsDone: | |
492 | 8553 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
|
8554 // && (&dword_722F10)[4 * a3] ) |
492 | 8555 && pQuestTable[var_value-1] ) |
0 | 8556 { |
492 | 8557 v14 = pPlayers[currPlayerId + 1]; |
0 | 8558 bFlashQuestBook = 1; |
8559 v30 = 1; | |
8560 v31 = 1; | |
187 | 8561 v14->PlaySound(SPEECH_93, 0); |
0 | 8562 } |
484 | 8563 v13 = (char *)pParty->_quest_bits; |
0 | 8564 LABEL_51: |
492 | 8565 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8566 if (( v30 != 1 )&&( v31 != 1 )) | |
8567 return; | |
8568 else | |
8569 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8570 if ( v31 != 1 ) | |
8571 return; | |
8572 v25 = 8 * currPlayerId + 400; | |
862 | 8573 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8574 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8575 return; | |
0 | 8576 case VAR_PlayerItemInHands: |
8577 item.Reset(); | |
8578 item.Reset(); | |
492 | 8579 item.uItemID = var_value; |
0 | 8580 item.uAttributes = 1; |
8581 pParty->SetHoldingItem(&item); | |
492 | 8582 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8583 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8584 return; |
8585 case VAR_FixedGold: | |
492 | 8586 Party::SetGold(var_value); |
0 | 8587 return; |
8588 case VAR_BaseMight: | |
492 | 8589 this->uMight = (unsigned __int8)var_value; |
0 | 8590 goto LABEL_84; |
8591 case VAR_BaseIntellect: | |
492 | 8592 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8593 goto LABEL_84; |
8594 case VAR_BasePersonality: | |
492 | 8595 this->uWillpower = (unsigned __int8)var_value; |
0 | 8596 goto LABEL_84; |
8597 case VAR_BaseEndurance: | |
492 | 8598 this->uEndurance = (unsigned __int8)var_value; |
0 | 8599 goto LABEL_84; |
8600 case VAR_BaseSpeed: | |
492 | 8601 this->uSpeed = (unsigned __int8)var_value; |
0 | 8602 goto LABEL_84; |
8603 case VAR_BaseAccuracy: | |
492 | 8604 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8605 goto LABEL_84; |
8606 case VAR_BaseLuck: | |
492 | 8607 this->uLuck = (unsigned __int8)var_value; |
0 | 8608 goto LABEL_84; |
8609 case VAR_FixedFood: | |
492 | 8610 Party::SetFood(var_value); |
0 | 8611 goto LABEL_124; |
8612 case VAR_MightBonus: | |
8613 goto LABEL_64; | |
8614 case VAR_IntellectBonus: | |
8615 goto LABEL_68; | |
8616 case VAR_PersonalityBonus: | |
8617 goto LABEL_69; | |
8618 case VAR_EnduranceBonus: | |
8619 goto LABEL_70; | |
8620 case VAR_SpeedBonus: | |
8621 goto LABEL_71; | |
8622 case VAR_AccuracyBonus: | |
8623 goto LABEL_72; | |
8624 case VAR_LuckBonus: | |
8625 goto LABEL_73; | |
8626 default: | |
8627 return; | |
8628 } | |
8629 while ( v9->uItemID != 615 ) | |
8630 { | |
8631 ++v8; | |
8632 ++v9; | |
8633 if ( v8 >= 138 ) | |
8634 goto LABEL_22; | |
8635 } | |
8636 v10 = (int)((char *)v4 + 36 * v8); | |
8637 *(int *)(v10 + 532) = 601; | |
492 | 8638 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8639 LABEL_22: |
8640 if ( v4->sResFireBase < 20 ) | |
8641 v4->sResFireBase = 20; | |
8642 if ( v4->sResAirBase < 20 ) | |
8643 v4->sResAirBase = 20; | |
8644 if ( v4->sResWaterBase < 20 ) | |
8645 v4->sResWaterBase = 20; | |
8646 if ( v4->sResEarthBase < 20 ) | |
8647 v4->sResEarthBase = 20; | |
8648 v4->sResMindBase = 200; | |
8649 v4->sResBodyBase = 200; | |
8650 v11 = v4->GetSexByVoice(); | |
8651 v4->field_1924 = v4->uVoiceID; | |
8652 v4->field_1928 = v4->uFace; | |
8653 if ( v11 ) | |
8654 { | |
8655 v4->uFace = 21; | |
8656 v4->uVoiceID = 21; | |
8657 } | |
8658 else | |
8659 { | |
8660 v4->uFace = 20; | |
8661 v4->uVoiceID = 20; | |
8662 } | |
492 | 8663 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8664 goto LABEL_124; |
8665 } | |
8666 LABEL_64: | |
492 | 8667 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8668 LABEL_111: |
8669 v28 = 0; | |
187 | 8670 v26 = SPEECH_91; |
0 | 8671 LABEL_112: |
492 | 8672 v19 = pPlayers[currPlayerId + 1]; |
0 | 8673 v31 = 1; |
187 | 8674 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8675 goto LABEL_169; |
8676 } | |
492 | 8677 if ( var_type <= VAR_FireResistanceBonus ) |
8678 { | |
8679 if ( var_type == VAR_FireResistanceBonus ) | |
8680 { | |
8681 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8682 goto LABEL_111; |
8683 } | |
492 | 8684 switch ( var_type ) |
0 | 8685 { |
8686 case VAR_ActualIntellect: | |
8687 LABEL_68: | |
492 | 8688 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8689 goto LABEL_111; |
8690 case VAR_ActualPersonality: | |
8691 LABEL_69: | |
492 | 8692 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8693 goto LABEL_111; |
8694 case VAR_ActualEndurance: | |
8695 LABEL_70: | |
492 | 8696 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8697 goto LABEL_111; |
8698 case VAR_ActualSpeed: | |
8699 LABEL_71: | |
492 | 8700 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8701 goto LABEL_111; |
8702 case VAR_ActualAccuracy: | |
8703 LABEL_72: | |
492 | 8704 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8705 goto LABEL_111; |
8706 case VAR_ActualLuck: | |
8707 LABEL_73: | |
492 | 8708 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8709 goto LABEL_111; |
8710 case VAR_FireResistance: | |
492 | 8711 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8712 goto LABEL_84; |
8713 case VAR_AirResistance: | |
492 | 8714 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8715 goto LABEL_84; |
8716 case VAR_WaterResistance: | |
492 | 8717 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8718 goto LABEL_84; |
8719 case VAR_EarthResistance: | |
492 | 8720 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8721 goto LABEL_84; |
8722 case VAR_SpiritResistance: | |
492 | 8723 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8724 goto LABEL_84; |
8725 case VAR_MindResistance: | |
492 | 8726 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8727 goto LABEL_84; |
8728 case VAR_BodyResistance: | |
492 | 8729 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8730 goto LABEL_84; |
8731 case VAR_LightResistance: | |
492 | 8732 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8733 goto LABEL_84; |
8734 case VAR_DarkResistance: | |
492 | 8735 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8736 goto LABEL_84; |
8737 case VAR_MagicResistance: | |
492 | 8738 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8739 LABEL_84: |
8740 v28 = 0; | |
8741 v26 = 92; | |
8742 goto LABEL_112; | |
8743 default: | |
8744 return; | |
8745 } | |
8746 return; | |
8747 } | |
8748 HIWORD(v15) = 0; | |
492 | 8749 if ( var_type > VAR_DisarmTrapSkill ) |
8750 { | |
8751 if ( var_type != VAR_LearningSkill ) | |
8752 { | |
8753 if ( var_type <= VAR_LearningSkill ) | |
0 | 8754 return; |
492 | 8755 if ( var_type <= VAR_Eradicated ) |
8756 { | |
8757 v4->SetCondition(var_type - 105, 1); | |
0 | 8758 } |
8759 else | |
8760 { | |
492 | 8761 if ( var_type != VAR_MajorCondition ) |
0 | 8762 { |
492 | 8763 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8764 byte_5E4C15[var_type] = var_value; | |
0 | 8765 return; |
8766 } | |
8767 memset(v4, 0, 0xA0u); | |
8768 } | |
8769 LABEL_124: | |
8770 v31 = 1; | |
8771 goto LABEL_169; | |
8772 } | |
8773 LABEL_106: | |
492 | 8774 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8775 v17 = *(char *)v16; |
492 | 8776 if ( var_value <= VAR_BodyResistanceBonus ) |
8777 { | |
8778 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8779 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8780 } | |
8781 else | |
8782 { | |
492 | 8783 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8784 } |
8785 *(short *)v16 = v18; | |
8786 goto LABEL_124; | |
8787 } | |
492 | 8788 if ( var_type == VAR_DisarmTrapSkill ) |
8789 if ( v30 != 1 ) | |
8790 { | |
8791 if ( v31 != 1 ) | |
8792 return; | |
8793 v5 = 0; | |
8794 goto LABEL_172; | |
8795 } | |
8796 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8797 goto LABEL_170; | |
8798 if ( var_type <= VAR_BodyResistanceBonus ) | |
8799 { | |
8800 switch ( var_type ) | |
0 | 8801 { |
8802 case VAR_BodyResistanceBonus: | |
492 | 8803 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8804 break; |
8805 case VAR_AirResistanceBonus: | |
492 | 8806 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8807 break; |
8808 case VAR_WaterResistanceBonus: | |
492 | 8809 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8810 break; |
8811 case VAR_EarthResistanceBonus: | |
492 | 8812 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8813 break; |
8814 case VAR_SpiritResistanceBonus: | |
492 | 8815 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8816 break; |
8817 default: | |
492 | 8818 if ( var_type != 62 ) |
0 | 8819 return; |
492 | 8820 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8821 break; |
8822 } | |
8823 goto LABEL_111; | |
8824 } | |
492 | 8825 if ( var_type == VAR_LightResistanceBonus ) |
8826 { | |
8827 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8828 goto LABEL_111; |
8829 } | |
492 | 8830 if ( var_type == VAR_DarkResistanceBonus ) |
8831 { | |
8832 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8833 goto LABEL_111; | |
8834 } | |
8835 if ( var_type == VAR_MagicResistanceBonus ) | |
8836 { | |
8837 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8838 goto LABEL_111; |
8839 } | |
492 | 8840 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8841 if ( v30 != 1 ) | |
8842 { | |
8843 if ( v31 != 1 ) | |
8844 return; | |
8845 v5 = 0; | |
8846 v25 = 8 * currPlayerId + 400; | |
862 | 8847 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8848 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8849 return; | |
8850 } | |
8851 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8852 goto LABEL_170; | |
0 | 8853 } |
8854 | |
8855 | |
8856 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8857 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8858 { |
8859 char v3; // bl@1 | |
8860 Player *v4; // esi@1 | |
8861 signed int uPlayerIdx; // edi@1 | |
8862 int v6; // eax@15 | |
8863 unsigned int v7; // esi@18 | |
8864 int *v8; // ebx@21 | |
8865 int v9; // eax@22 | |
8866 signed int v10; // eax@24 | |
8867 int v11; // eax@27 | |
8868 __int16 *v12; // esi@28 | |
8869 Player *v13; // ecx@34 | |
8870 Player *v14; // ecx@36 | |
8871 char *v15; // ecx@37 | |
8872 unsigned __int8 v16; // cf@38 | |
8873 Player *v17; // ecx@42 | |
8874 __int16 *v18; // esi@53 | |
8875 __int16 *v19; // esi@62 | |
8876 char *v20; // esi@107 | |
8877 __int16 v21; // dx@107 | |
8878 int v22; // ecx@107 | |
8879 Player *v23; // ecx@132 | |
8880 int v24; // eax@132 | |
8881 int v25; // eax@150 | |
8882 char v26; // zf@151 | |
8883 DDM_DLV_Header *v27; // eax@153 | |
8884 signed int v28; // eax@176 | |
8885 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8886 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8887 int v31; // [sp-4h] [bp-3Ch]@84 |
8888 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8889 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8890 char v34; // [sp+37h] [bp-1h]@1 | |
8891 | |
8892 auto Dst = this; | |
8893 v3 = 0; | |
8894 v34 = 0; | |
8895 v4 = Dst; | |
8896 uPlayerIdx = 0; | |
8897 if ( Dst == pPlayers[2] ) | |
8898 uPlayerIdx = 1; | |
310 | 8899 else if ( Dst == pPlayers[3] ) |
8900 uPlayerIdx = 2; | |
8901 else if ( Dst == pPlayers[4] ) | |
8902 uPlayerIdx = 3; | |
8903 | |
8904 if ( var_type <= VAR_AutoNotes ) | |
8905 { | |
8906 if ( var_type != VAR_AutoNotes ) | |
8907 { | |
8908 if ( var_type <= VAR_ActualMight ) | |
8909 { | |
8910 if ( var_type != VAR_ActualMight ) | |
0 | 8911 { |
310 | 8912 switch ( var_type ) |
0 | 8913 { |
8914 case VAR_RandomGold: | |
8915 if ( !val ) | |
8916 val = 1; | |
8917 v6 = rand(); | |
8918 party_finds_gold(v6 % val + 1, 1); | |
8919 GameUI_DrawFoodAndGold(); | |
8920 return; | |
8921 case VAR_RandomFood: | |
8922 if ( !val ) | |
8923 val = 1; | |
8924 v7 = rand() % val + 1; | |
8925 Party::GiveFood(v7); | |
8926 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8927 ShowStatusBarString(pTmpBuf, 2u); | |
8928 GameUI_DrawFoodAndGold(); | |
8929 goto _play_sound; | |
8930 case VAR_Sex: | |
8931 Dst->uSex = (PLAYER_SEX)val; | |
8932 goto _play_anim_and_exit; | |
8933 case VAR_Class: | |
135 | 8934 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8935 goto _play_anim_and_exit; |
8936 case VAR_CurrentHP: | |
8937 v8 = &Dst->sHealth; | |
8938 *v8 += val; | |
8939 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8940 goto _play_anim_and_exit; | |
8941 v9 = v4->GetMaxHealth(); | |
8942 goto LABEL_23; | |
8943 case VAR_MaxHP: | |
8944 v10 = Dst->GetMaxHealth(); | |
8945 v4->_health_related = 0; | |
8946 v4->uFullHealthBonus = 0; | |
8947 v4->sHealth = v10; | |
8948 return; | |
8949 case VAR_CurrentSP: | |
8950 v8 = &Dst->sMana; | |
8951 *v8 += val; | |
8952 if ( Dst->sMana > GetMaxMana() ) | |
8953 { | |
8954 v9 = v4->GetMaxMana(); | |
8955 LABEL_23: | |
8956 *v8 = v9; | |
8957 } | |
8958 goto _play_anim_and_exit; | |
8959 case VAR_MaxSP: | |
8960 v11 = GetMaxMana(); | |
8961 v4->_mana_related = 0; | |
8962 v4->uFullManaBonus = 0; | |
8963 v4->sMana = v11; | |
8964 return; | |
8965 case VAR_ACModifier: | |
8966 v12 = &Dst->sACModifier; | |
8967 goto LABEL_29; | |
8968 case VAR_BaseLevel: | |
8969 v12 = (__int16 *)&Dst->uLevel; | |
8970 goto LABEL_29; | |
8971 case VAR_LevelModifier: | |
8972 v12 = &Dst->sLevelModifier; | |
8973 LABEL_29: | |
8974 *v12 += val; | |
8975 if ( *v12 > 255 ) | |
8976 *v12 = 255; | |
8977 goto _play_anim_and_exit; | |
8978 case VAR_Age: | |
8979 Dst->sAgeModifier += val; | |
8980 return; | |
8981 case VAR_Award: | |
8982 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8983 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8984 | |
492 | 8985 && pAwards[val].pText ) |
0 | 8986 { |
8987 v14 = pPlayers[uPlayerIdx + 1]; | |
8988 v34 = 1; | |
8989 v3 = 1; | |
187 | 8990 v14->PlaySound(SPEECH_96, 0); |
0 | 8991 } |
735 | 8992 v15 = (char *)v4->_guilds_member_bits; |
0 | 8993 goto LABEL_44; |
8994 case VAR_Experience: | |
8995 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8996 LODWORD(Dst->uExperience) += val; | |
8997 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8998 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8999 Dst->uExperience = 4000000000i64; | |
9000 goto _play_anim_and_exit; | |
9001 case VAR_QBits_QuestsDone: | |
484 | 9002 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
|
9003 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9004 && pQuestTable[val-1] ) |
0 | 9005 { |
501 | 9006 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 9007 bFlashQuestBook = 1; |
9008 v34 = 1; | |
9009 v3 = 1; | |
501 | 9010 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 9011 } |
484 | 9012 v15 = (char *)pParty->_quest_bits; |
0 | 9013 LABEL_44: |
9014 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
9015 goto LABEL_173; | |
9016 case VAR_PlayerItemInHands: | |
9017 item.Reset(); | |
9018 item.Reset(); | |
9019 item.uAttributes = 1; | |
9020 item.uItemID = val; | |
9021 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 9022 pParty->pIsArtifactFound[val-500] = 1; |
0 | 9023 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
9024 { | |
9025 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
9026 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
9027 } | |
9028 pParty->SetHoldingItem(&item); | |
9029 return; | |
9030 case VAR_FixedGold: | |
9031 party_finds_gold(val, 1); | |
9032 return; | |
9033 case VAR_BaseMight: | |
9034 v18 = (__int16 *)&Dst->uMight; | |
9035 goto LABEL_82; | |
9036 case VAR_BaseIntellect: | |
9037 v18 = (__int16 *)&Dst->uIntelligence; | |
9038 goto LABEL_82; | |
9039 case VAR_BasePersonality: | |
9040 v18 = (__int16 *)&Dst->uWillpower; | |
9041 goto LABEL_82; | |
9042 case VAR_BaseEndurance: | |
9043 v18 = (__int16 *)&Dst->uEndurance; | |
9044 goto LABEL_82; | |
9045 case VAR_BaseSpeed: | |
9046 v18 = (__int16 *)&Dst->uSpeed; | |
9047 goto LABEL_82; | |
9048 case VAR_BaseAccuracy: | |
9049 v18 = (__int16 *)&Dst->uAccuracy; | |
9050 goto LABEL_82; | |
9051 case VAR_BaseLuck: | |
9052 v18 = (__int16 *)&Dst->uLuck; | |
9053 goto LABEL_82; | |
9054 case VAR_FixedFood: | |
9055 Party::GiveFood(val); | |
715 | 9056 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 9057 ShowStatusBarString(pTmpBuf, 2u); |
9058 if ( pParty->uNumFoodRations > 0xFFFF ) | |
9059 Party::SetFood(0xFFFFu); | |
9060 goto _play_sound; | |
9061 case VAR_MightBonus: | |
9062 goto LABEL_62; | |
9063 case VAR_IntellectBonus: | |
9064 goto LABEL_66; | |
9065 case VAR_PersonalityBonus: | |
9066 goto LABEL_67; | |
9067 case VAR_EnduranceBonus: | |
9068 goto LABEL_68; | |
9069 case VAR_SpeedBonus: | |
9070 goto LABEL_69; | |
9071 case VAR_AccuracyBonus: | |
9072 goto LABEL_70; | |
9073 case VAR_LuckBonus: | |
9074 goto LABEL_71; | |
9075 default: | |
9076 return; | |
9077 } | |
9078 return; | |
9079 } | |
9080 LABEL_62: | |
9081 v19 = (__int16 *)&Dst->uMightBonus; | |
9082 goto LABEL_113; | |
9083 } | |
310 | 9084 if ( var_type <= VAR_FireResistanceBonus ) |
9085 { | |
9086 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 9087 { |
310 | 9088 switch ( var_type ) |
0 | 9089 { |
9090 case VAR_ActualIntellect: | |
9091 LABEL_66: | |
9092 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9093 goto LABEL_113; | |
9094 case VAR_ActualPersonality: | |
9095 LABEL_67: | |
9096 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9097 goto LABEL_113; | |
9098 case VAR_ActualEndurance: | |
9099 LABEL_68: | |
9100 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9101 goto LABEL_113; | |
9102 case VAR_ActualSpeed: | |
9103 LABEL_69: | |
9104 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9105 goto LABEL_113; | |
9106 case VAR_ActualAccuracy: | |
9107 LABEL_70: | |
9108 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9109 goto LABEL_113; | |
9110 case VAR_ActualLuck: | |
9111 LABEL_71: | |
9112 v19 = (__int16 *)&Dst->uLuckBonus; | |
9113 goto LABEL_113; | |
9114 case VAR_FireResistance: | |
9115 v18 = &Dst->sResFireBase; | |
9116 goto LABEL_82; | |
9117 case VAR_AirResistance: | |
9118 v18 = &Dst->sResAirBase; | |
9119 goto LABEL_82; | |
9120 case VAR_WaterResistance: | |
9121 v18 = &Dst->sResWaterBase; | |
9122 goto LABEL_82; | |
9123 case VAR_EarthResistance: | |
9124 v18 = &Dst->sResEarthBase; | |
9125 goto LABEL_82; | |
9126 case VAR_SpiritResistance: | |
9127 v18 = &Dst->sResSpiritBase; | |
9128 goto LABEL_82; | |
9129 case VAR_MindResistance: | |
9130 v18 = &Dst->sResMindBase; | |
9131 goto LABEL_82; | |
9132 case VAR_BodyResistance: | |
9133 v18 = &Dst->sResBodyBase; | |
9134 goto LABEL_82; | |
9135 case VAR_LightResistance: | |
9136 v18 = &Dst->sResLightBase; | |
9137 goto LABEL_82; | |
9138 case VAR_DarkResistance: | |
9139 v18 = &Dst->sResDarkBase; | |
9140 goto LABEL_82; | |
9141 case VAR_MagicResistance: | |
9142 v18 = &Dst->sResMagicBase; | |
9143 LABEL_82: | |
9144 *v18 += val; | |
9145 if ( *v18 > 255 ) | |
9146 *v18 = 255; | |
9147 v31 = 0; | |
9148 v29 = 92; | |
9149 goto LABEL_116; | |
9150 default: | |
9151 return; | |
9152 } | |
9153 return; | |
9154 } | |
9155 v19 = &Dst->sResFireBonus; | |
9156 LABEL_113: | |
9157 *v19 += val; | |
9158 if ( *v19 > 255 ) | |
9159 *v19 = 255; | |
9160 v31 = 0; | |
187 | 9161 v29 = SPEECH_91; |
0 | 9162 LABEL_116: |
9163 v3 = 1; | |
187 | 9164 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9165 goto _play_anim_and_maybe_sound; |
9166 } | |
310 | 9167 if ( var_type <= VAR_DisarmTrapSkill ) |
9168 { | |
9169 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9170 { |
310 | 9171 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9172 { |
310 | 9173 switch ( var_type ) |
0 | 9174 { |
9175 case VAR_BodyResistanceBonus: | |
9176 v19 = &Dst->sResBodyBonus; | |
9177 break; | |
9178 case VAR_AirResistanceBonus: | |
9179 v19 = &Dst->sResAirBonus; | |
9180 break; | |
9181 case VAR_WaterResistanceBonus: | |
9182 v19 = &Dst->sResWaterBonus; | |
9183 break; | |
9184 case VAR_EarthResistanceBonus: | |
9185 v19 = &Dst->sResEarthBonus; | |
9186 break; | |
9187 case VAR_SpiritResistanceBonus: | |
9188 v19 = &Dst->sResSpiritBonus; | |
9189 break; | |
9190 default: | |
310 | 9191 if ( var_type != 62 ) |
0 | 9192 return; |
9193 v19 = &Dst->sResMindBonus; | |
9194 break; | |
9195 } | |
9196 goto LABEL_113; | |
9197 } | |
310 | 9198 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9199 { |
9200 v19 = &Dst->sResLightBonus; | |
9201 goto LABEL_113; | |
9202 } | |
310 | 9203 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9204 { |
9205 v19 = &Dst->sResDarkBonus; | |
9206 goto LABEL_113; | |
9207 } | |
310 | 9208 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9209 { |
9210 v19 = &Dst->sResMagicBonus; | |
9211 goto LABEL_113; | |
9212 } | |
310 | 9213 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9214 return; |
9215 } | |
9216 goto LABEL_106; | |
9217 } | |
310 | 9218 if ( var_type == VAR_LearningSkill ) |
0 | 9219 { |
9220 LABEL_106: | |
9221 if ( val <= VAR_BodyResistanceBonus ) | |
9222 { | |
310 | 9223 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9224 } |
9225 else | |
9226 { | |
310 | 9227 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9228 v21 = *(short *)v20; |
9229 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9230 if ( v22 > 60 ) | |
9231 LOWORD(v22) = 60; | |
9232 LOBYTE(v21) = v21 & 0xC0; | |
9233 *(short *)v20 = v22 | v21; | |
9234 } | |
9235 goto _play_anim_and_exit; | |
9236 } | |
310 | 9237 if ( var_type <= VAR_LearningSkill ) |
0 | 9238 return; |
310 | 9239 if ( var_type <= VAR_Eradicated ) |
9240 { | |
9241 Dst->SetCondition(var_type - 105, 0); | |
0 | 9242 } |
9243 else | |
9244 { | |
310 | 9245 if ( var_type != VAR_MajorCondition ) |
0 | 9246 { |
310 | 9247 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9248 { |
310 | 9249 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9250 byte_5E4C15[var_type] += val; | |
0 | 9251 else |
310 | 9252 byte_5E4C15[var_type] = -1; |
0 | 9253 } |
9254 return; | |
9255 } | |
9256 memset(Dst, 0, 0xA0u); | |
9257 } | |
9258 _play_anim_and_exit: | |
9259 v3 = 1; | |
9260 _play_anim_and_maybe_sound: | |
9261 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9262 _maybe_play_sound: | |
9263 if ( v3 != 1 ) | |
9264 return; | |
9265 goto _play_sound; | |
9266 } | |
9267 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
|
9268 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9269 && pAutonoteTxt[val-1].pText ) |
0 | 9270 { |
9271 v23 = pPlayers[uPlayerIdx + 1]; | |
9272 v34 = 1; | |
187 | 9273 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9274 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9275 bFlashAutonotesBook = 1; |
981 | 9276 _506568_autonote_type = v24; |
0 | 9277 } |
9278 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9279 v3 = 1; | |
9280 LABEL_173: | |
9281 if ( v34 != 1 ) | |
9282 goto _maybe_play_sound; | |
9283 goto _play_anim_and_maybe_sound; | |
9284 } | |
310 | 9285 if ( var_type > VAR_GoldInBank ) |
9286 { | |
9287 if ( var_type == 307 ) | |
0 | 9288 { |
9289 pParty->uNumDeaths += val; | |
9290 goto LABEL_173; | |
9291 } | |
310 | 9292 switch ( var_type ) |
0 | 9293 { |
9294 case 308: | |
9295 pParty->uNumBountiesCollected += val; | |
9296 break; | |
9297 case 309: | |
9298 pParty->uNumPrisonTerms += val; | |
9299 break; | |
9300 case 310: | |
9301 pParty->uNumArenaPageWins += val; | |
9302 break; | |
9303 case 311: | |
9304 pParty->uNumArenaSquireWins += val; | |
9305 break; | |
9306 case 312: | |
9307 pParty->uNumArenaKnightWins += val; | |
9308 break; | |
9309 case 313: | |
9310 pParty->uNumArenaLordWins += val; | |
9311 break; | |
9312 } | |
9313 } | |
9314 else | |
9315 { | |
310 | 9316 if ( var_type == VAR_GoldInBank ) |
0 | 9317 { |
9318 pParty->uNumGoldInBank += val; | |
9319 return; | |
9320 } | |
310 | 9321 if ( var_type <= VAR_Counter8 ) |
9322 { | |
9323 if ( (signed int)var_type >= 245 ) | |
9324 { | |
9325 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9326 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9327 } |
9328 else | |
9329 { | |
310 | 9330 switch ( var_type ) |
0 | 9331 { |
9332 case VAR_MonthEquals|VAR_CurrentSP: | |
9333 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9334 break; | |
9335 case VAR_NPCs2: | |
9336 pParty->field_709 = 0; | |
9337 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9338 Party__CountHirelings(); |
0 | 9339 viewparams->bRedrawGameUI = 1; |
9340 break; | |
9341 case VAR_NumSkillPoints: | |
9342 Dst->uSkillPoints += val; | |
9343 break; | |
9344 } | |
9345 } | |
9346 return; | |
9347 } | |
310 | 9348 if ( var_type < VAR_Counter9 ) |
0 | 9349 return; |
310 | 9350 if ( (signed int)var_type <= 274 ) |
9351 { | |
9352 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9353 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9354 goto _play_sound; |
9355 } | |
310 | 9356 if ( var_type != VAR_ReputationInCurrentLocation ) |
9357 { | |
9358 if ( var_type <= VAR_ReputationInCurrentLocation | |
9359 || var_type > VAR_History_28 | |
9360 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9361 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9362 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9363 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9364 v26) ) |
9365 return; | |
9366 bFlashHistoryBook = 1; | |
9367 _play_sound: | |
9368 v28 = 8 * uPlayerIdx + 400; | |
862 | 9369 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9370 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9371 return; | |
9372 } | |
9373 v27 = &pOutdoor->ddm; | |
9374 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9375 v27 = &pIndoor->dlv; | |
9376 v27->uReputation += val; | |
9377 if ( v27->uReputation > 10000 ) | |
9378 v27->uReputation = 10000; | |
9379 } | |
9380 } | |
9381 // 506568: using guessed type int dword_506568; | |
9382 // 507948: using guessed type char bFlashHistoryBook; | |
9383 // 507949: using guessed type char bFlashAutonotesBook; | |
9384 // 50794A: using guessed type char bFlashQuestBook; | |
9385 // 72371C: using guessed type int dword_72371C[]; | |
9386 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9387 | |
9388 | |
9389 | |
9390 | |
9391 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9392 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9393 { |
9394 unsigned int v3; // ebx@1 | |
9395 signed int v4; // esi@1 | |
501 | 9396 bool result; // eax@8 |
0 | 9397 int v6; // esi@11 |
9398 int v7; // edi@14 | |
9399 signed int v8; // eax@17 | |
9400 char *v9; // eax@20 | |
9401 char v10; // sf@20 | |
9402 char *v11; // ecx@26 | |
9403 char *v12; // ecx@27 | |
9404 __int64 v13; // qax@27 | |
9405 unsigned __int8 v14; // cf@27 | |
501 | 9406 int *v15; // edx@29 |
0 | 9407 char *v16; // eax@90 |
9408 char *v17; // ecx@94 | |
501 | 9409 int v18; // esi@97 |
0 | 9410 signed int v19; // edx@97 |
9411 char *v20; // ecx@98 | |
9412 int v21; // eax@100 | |
9413 __int16 v22; // dx@112 | |
9414 int v23; // [sp-8h] [bp-14h]@45 | |
9415 signed int v24; // [sp-4h] [bp-10h]@4 | |
9416 int v25; // [sp-4h] [bp-10h]@45 | |
9417 | |
9418 v3 = 0; | |
605 | 9419 v4 = uActiveCharacter - 1; |
501 | 9420 result = false; |
9421 if ( (signed int)VarNum > 222 ) | |
9422 { | |
9423 if ( (signed int)VarNum <= 307 ) | |
9424 { | |
9425 if ( VarNum == 307 ) | |
9426 { | |
9427 pParty->uNumDeaths -= (unsigned int)pValue; | |
9428 return pValue; | |
9429 } | |
9430 if ( VarNum == 223 ) | |
0 | 9431 { |
9432 v11 = (char *)pParty->_autonote_bits; | |
501 | 9433 v22 = (short)pValue - 1; |
0 | 9434 } |
9435 else | |
9436 { | |
501 | 9437 if ( VarNum != 231 ) |
0 | 9438 { |
501 | 9439 switch ( VarNum ) |
0 | 9440 { |
9441 case 232: | |
501 | 9442 VarNum = (VariableType)0; |
602 | 9443 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9444 result = (bool) pValue; |
9445 dword_5B65CC = 0; | |
9446 if ( (int)VarNum == pValue ) | |
0 | 9447 { |
501 | 9448 dword_5B65CC = (int)pValue; |
0 | 9449 } |
9450 else | |
9451 { | |
9452 pParty->field_709 = 0; | |
501 | 9453 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9454 Party__CountHirelings(); |
0 | 9455 viewparams->bRedrawGameUI = 1; |
9456 } | |
9457 break; | |
9458 case 241: | |
9459 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9460 { | |
9461 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9462 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9463 { |
605 | 9464 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9465 { |
9466 v21 = *(int *)v20; | |
9467 if ( (char)*(int *)v20 < 0 ) | |
9468 { | |
9469 LOBYTE(v21) = v21 & 0x7F; | |
9470 *(int *)v20 = v21; | |
9471 } | |
9472 } | |
9473 v20 += 76; | |
9474 } | |
9475 } | |
605 | 9476 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9477 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9478 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9479 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9480 pParty->field_709 = 0; | |
659 | 9481 Party__CountHirelings(); |
0 | 9482 break; |
9483 case 243: | |
9484 v17 = (char *)&this->uSkillPoints; | |
501 | 9485 result = *v17; |
9486 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9487 { | |
9488 *(int *)v17 -= (int)pValue; | |
9489 result = v17; | |
9490 } | |
0 | 9491 else |
9492 *(int *)v17 = 0; | |
9493 break; | |
9494 case 275: | |
9495 v16 = (char *)&pOutdoor->ddm; | |
9496 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9497 v16 = (char *)&pIndoor->dlv; | |
501 | 9498 *((int *)v16 + 2) -= (int)pValue; |
0 | 9499 if ( *((int *)v16 + 2) < -10000 ) |
9500 *((int *)v16 + 2) = -10000; | |
9501 break; | |
9502 case 306: | |
501 | 9503 result = VarNum - 306; |
9504 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9505 { | |
9506 result = (bool)pValue; | |
9507 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9508 } |
0 | 9509 else |
9510 LABEL_88: | |
9511 dword_5B65C4 = 1; | |
9512 break; | |
9513 } | |
501 | 9514 return result; |
0 | 9515 } |
9516 v11 = this->field_1A50; | |
501 | 9517 v22 = (signed __int16)pValue; |
0 | 9518 } |
9519 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9520 return result; |
9521 } | |
9522 switch ( VarNum ) | |
0 | 9523 { |
9524 case 308: | |
501 | 9525 result = (bool)pValue; |
9526 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9527 break; |
9528 case 309: | |
501 | 9529 result = (bool)pValue; |
9530 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9531 break; |
9532 case 310: | |
501 | 9533 result = (bool)pValue; |
9534 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9535 break; |
9536 case 311: | |
501 | 9537 result = (bool)pValue; |
9538 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9539 break; |
9540 case 312: | |
501 | 9541 result = (bool)pValue; |
9542 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9543 break; |
9544 case 313: | |
501 | 9545 result = (bool)pValue; |
9546 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9547 break; |
9548 } | |
9549 } | |
9550 else | |
9551 { | |
501 | 9552 if ( (signed int)VarNum >= 123 ) |
9553 { | |
9554 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9555 } |
9556 else | |
9557 { | |
501 | 9558 switch ( VarNum ) |
0 | 9559 { |
9560 case VAR_RandomGold: | |
501 | 9561 v6 = rand() % (signed int)pValue + 1; |
0 | 9562 if ( v6 > pParty->uNumGold ) |
9563 v6 = pParty->uNumGold; | |
9564 Party::TakeGold(v6); | |
9565 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9566 ShowStatusBarString(pTmpBuf, 2); |
0 | 9567 GameUI_DrawFoodAndGold(); |
501 | 9568 return result; |
0 | 9569 case VAR_RandomFood: |
501 | 9570 v7 = rand() % (signed int)pValue + 1; |
0 | 9571 if ( v7 > pParty->uNumFoodRations ) |
9572 v7 = pParty->uNumFoodRations; | |
9573 Party::TakeFood(v7); | |
9574 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9575 ShowStatusBarString(pTmpBuf, 2u); | |
9576 GameUI_DrawFoodAndGold(); | |
605 | 9577 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9578 v8 = 8 * v4 + 400; | |
862 | 9579 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9580 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9581 return result; |
0 | 9582 case VAR_CurrentHP: |
501 | 9583 ReceiveDamage((signed int)pValue, 4); |
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); |
9588 return result; | |
0 | 9589 case VAR_CurrentSP: |
9590 v9 = (char *)&this->sMana; | |
501 | 9591 v10 = this->sMana - (signed int)pValue < 0; |
9592 *(int *)v9 -= (int)pValue; | |
0 | 9593 if ( v10 ) |
9594 *(int *)v9 = 0; | |
605 | 9595 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9596 v8 = 8 * v4 + 400; | |
862 | 9597 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9598 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9599 return result; | |
0 | 9600 case VAR_ACModifier: |
501 | 9601 this->sACModifier -= (unsigned __int8)pValue; |
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_BaseLevel: |
501 | 9608 this->uLevel -= (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_LevelModifier: |
501 | 9615 this->sLevelModifier -= (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_Age: |
501 | 9622 this->sAgeModifier -= (signed __int16)pValue; |
9623 return result; | |
0 | 9624 case VAR_Award: |
605 | 9625 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9626 return result; | |
0 | 9627 case VAR_Experience: |
9628 v12 = (char *)&this->uExperience; | |
501 | 9629 v13 = (signed int)pValue; |
9630 v14 = *(int *)v12 < (unsigned int)pValue; | |
9631 *(int *)v12 -= (int)pValue; | |
0 | 9632 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9633 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9634 v8 = 8 * v4 + 400; | |
862 | 9635 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9636 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9637 return result; | |
0 | 9638 case VAR_QBits_QuestsDone: |
501 | 9639 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9640 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9641 return true; |
0 | 9642 case VAR_PlayerItemInHands: |
501 | 9643 v15 = this->pInventoryIndices; |
0 | 9644 break; |
9645 case VAR_FixedGold: | |
501 | 9646 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9647 goto LABEL_88; |
501 | 9648 Party::TakeGold((unsigned int)pValue); |
9649 return result; | |
0 | 9650 case VAR_MightBonus: |
9651 case VAR_ActualMight: | |
501 | 9652 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9653 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9654 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9655 v8 = 8 * v4 + 400; | |
862 | 9656 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9657 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9658 return result; | |
0 | 9659 case VAR_IntellectBonus: |
9660 case VAR_ActualIntellect: | |
501 | 9661 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9662 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9663 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9664 v8 = 8 * v4 + 400; | |
862 | 9665 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9666 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9667 return result; | |
0 | 9668 case VAR_PersonalityBonus: |
9669 case VAR_ActualPersonality: | |
501 | 9670 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9671 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9672 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9673 v8 = 8 * v4 + 400; | |
862 | 9674 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9675 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9676 return result; | |
0 | 9677 case VAR_EnduranceBonus: |
9678 case VAR_ActualEndurance: | |
501 | 9679 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9680 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9681 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9682 v8 = 8 * v4 + 400; | |
862 | 9683 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9684 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9685 return result; | |
0 | 9686 case VAR_SpeedBonus: |
9687 case VAR_ActualSpeed: | |
501 | 9688 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9689 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9690 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9691 v8 = 8 * v4 + 400; | |
862 | 9692 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9693 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9694 return result; | |
0 | 9695 case VAR_AccuracyBonus: |
9696 case VAR_ActualAccuracy: | |
501 | 9697 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9698 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9699 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9700 v8 = 8 * v4 + 400; | |
862 | 9701 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9702 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9703 return result; | |
0 | 9704 case VAR_LuckBonus: |
9705 case VAR_ActualLuck: | |
501 | 9706 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9707 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9708 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9709 v8 = 8 * v4 + 400; | |
862 | 9710 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9711 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9712 return result; | |
0 | 9713 case VAR_BaseMight: |
501 | 9714 this->uMight -= (unsigned __int16)pValue; |
605 | 9715 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9716 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9717 v8 = 8 * v4 + 400; | |
862 | 9718 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9719 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9720 return result; | |
0 | 9721 case VAR_BaseIntellect: |
501 | 9722 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9723 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9724 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9725 v8 = 8 * v4 + 400; | |
862 | 9726 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9727 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9728 return result; | |
0 | 9729 case VAR_BasePersonality: |
501 | 9730 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9731 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9732 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9733 v8 = 8 * v4 + 400; | |
862 | 9734 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9735 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9736 return result; | |
0 | 9737 case VAR_BaseEndurance: |
501 | 9738 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9739 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9740 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9741 v8 = 8 * v4 + 400; | |
862 | 9742 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9743 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9744 return result; | |
0 | 9745 case VAR_BaseSpeed: |
501 | 9746 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9747 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9748 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9749 v8 = 8 * v4 + 400; | |
862 | 9750 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9751 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9752 return result; | |
0 | 9753 case VAR_BaseAccuracy: |
501 | 9754 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9755 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9756 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9757 v8 = 8 * v4 + 400; | |
862 | 9758 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9759 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9760 return result; | |
0 | 9761 case VAR_BaseLuck: |
501 | 9762 this->uLuck -= (unsigned __int16)pValue; |
605 | 9763 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9764 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9765 v8 = 8 * v4 + 400; | |
862 | 9766 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9767 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9768 return result; | |
0 | 9769 case VAR_FireResistance: |
501 | 9770 this->sResFireBase -= (signed __int16)pValue; |
605 | 9771 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9772 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9773 v8 = 8 * v4 + 400; | |
862 | 9774 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9775 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9776 return result; | |
0 | 9777 case VAR_AirResistance: |
501 | 9778 this->sResAirBase -= (signed __int16)pValue; |
605 | 9779 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9780 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9781 v8 = 8 * v4 + 400; | |
862 | 9782 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9783 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9784 return result; | |
0 | 9785 case VAR_WaterResistance: |
501 | 9786 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9787 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9788 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9789 v8 = 8 * v4 + 400; | |
862 | 9790 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9791 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9792 return result; | |
0 | 9793 case VAR_EarthResistance: |
501 | 9794 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9795 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9796 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9797 v8 = 8 * v4 + 400; | |
862 | 9798 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9799 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9800 return result; | |
0 | 9801 case VAR_SpiritResistance: |
501 | 9802 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9803 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9804 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9805 v8 = 8 * v4 + 400; | |
862 | 9806 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9807 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9808 return result; | |
0 | 9809 case VAR_MindResistance: |
501 | 9810 this->sResMindBase -= (signed __int16)pValue; |
605 | 9811 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9812 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9813 v8 = 8 * v4 + 400; | |
862 | 9814 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9815 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9816 return result; | |
0 | 9817 case VAR_BodyResistance: |
501 | 9818 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9819 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9820 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9821 v8 = 8 * v4 + 400; | |
862 | 9822 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9823 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9824 return result; | |
0 | 9825 case VAR_LightResistance: |
501 | 9826 this->sResLightBase -= (signed __int16)pValue; |
605 | 9827 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9828 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9829 v8 = 8 * v4 + 400; | |
862 | 9830 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9831 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9832 return result; | |
0 | 9833 case VAR_DarkResistance: |
501 | 9834 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9835 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9836 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9837 v8 = 8 * v4 + 400; | |
862 | 9838 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9839 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9840 return result; | |
0 | 9841 case VAR_MagicResistance: |
501 | 9842 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9843 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9844 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9845 v8 = 8 * v4 + 400; | |
862 | 9846 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9847 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9848 return result; | |
0 | 9849 case VAR_FireResistanceBonus: |
501 | 9850 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9851 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9852 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9853 v8 = 8 * v4 + 400; | |
862 | 9854 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9855 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9856 return result; | |
0 | 9857 case VAR_AirResistanceBonus: |
501 | 9858 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9859 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9860 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9861 v8 = 8 * v4 + 400; | |
862 | 9862 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9863 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9864 return result; | |
0 | 9865 case VAR_WaterResistanceBonus: |
501 | 9866 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9867 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9868 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9869 v8 = 8 * v4 + 400; | |
862 | 9870 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9871 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9872 return result; | |
0 | 9873 case VAR_EarthResistanceBonus: |
501 | 9874 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9875 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9876 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9877 v8 = 8 * v4 + 400; | |
862 | 9878 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9879 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9880 return result; | |
0 | 9881 case VAR_SpiritResistanceBonus: |
501 | 9882 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9883 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9884 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9885 v8 = 8 * v4 + 400; | |
862 | 9886 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9887 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9888 return result; | |
0 | 9889 case VAR_MindResistanceBonus: |
501 | 9890 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9891 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9892 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9893 v8 = 8 * v4 + 400; | |
862 | 9894 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9895 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9896 return result; | |
0 | 9897 case VAR_BodyResistanceBonus: |
501 | 9898 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9899 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9900 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9901 v8 = 8 * v4 + 400; | |
862 | 9902 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9903 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9904 return result; | |
0 | 9905 case VAR_LightResistanceBonus: |
501 | 9906 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9907 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9908 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9909 v8 = 8 * v4 + 400; | |
862 | 9910 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9911 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9912 return result; | |
0 | 9913 case VAR_DarkResistanceBonus: |
501 | 9914 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9915 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9916 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9917 v8 = 8 * v4 + 400; | |
862 | 9918 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9919 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9920 return result; | |
0 | 9921 case VAR_MagicResistanceBonus: |
501 | 9922 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9923 v25 = 0; |
187 | 9924 v23 = SPEECH_91; |
9925 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9926 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9927 v8 = 8 * v4 + 400; | |
862 | 9928 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9929 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9930 return result; | |
0 | 9931 case VAR_FixedFood: |
501 | 9932 Party::TakeFood((unsigned int)pValue); |
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_StaffSkill: |
9939 case VAR_SwordSkill: | |
9940 case VAR_DaggerSkill: | |
9941 case VAR_AxeSkill: | |
9942 case VAR_SpearSkill: | |
9943 case VAR_BowSkill: | |
9944 case VAR_MaceSkill: | |
9945 case VAR_BlasterSkill: | |
9946 case VAR_ShieldSkill: | |
9947 case VAR_LeatherSkill: | |
9948 case VAR_SkillChain: | |
9949 case VAR_PlateSkill: | |
9950 case VAR_FireSkill: | |
9951 case VAR_AirSkill: | |
9952 case VAR_WaterSkill: | |
9953 case VAR_EarthSkill: | |
9954 case VAR_SpiritSkill: | |
9955 case VAR_MindSkill: | |
9956 case VAR_BodySkill: | |
9957 case VAR_LightSkill: | |
9958 case VAR_DarkSkill: | |
9959 case VAR_IdentifyItemSkill: | |
9960 case VAR_MerchantSkill: | |
9961 case VAR_RepairSkill: | |
9962 case VAR_BodybuildingSkill: | |
9963 case VAR_MeditationSkill: | |
9964 case VAR_PerceptionSkill: | |
9965 case VAR_DiplomacySkill: | |
9966 case VAR_DisarmTrapSkill: | |
9967 case VAR_LearningSkill: | |
501 | 9968 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9969 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9970 v8 = 8 * v4 + 400; | |
862 | 9971 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9972 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9973 return result; | |
0 | 9974 case VAR_Cursed: |
9975 case VAR_Weak: | |
9976 case VAR_Asleep: | |
9977 case VAR_Afraid: | |
9978 case VAR_Drunk: | |
9979 case VAR_Insane: | |
9980 case VAR_PoisonedGreen: | |
9981 case VAR_DiseasedGreen: | |
9982 case VAR_PoisonedYellow: | |
9983 case VAR_DiseasedYellow: | |
9984 case VAR_PoisonedRed: | |
9985 case VAR_DiseasedRed: | |
9986 case VAR_Paralyzed: | |
9987 case VAR_Unconsious: | |
9988 case VAR_Dead: | |
9989 case VAR_Stoned: | |
9990 case VAR_Eradicated: | |
501 | 9991 *((int *)this + 2 * VarNum - 210) = 0; |
9992 *((int *)this + 2 * result - 209) = 0; | |
0 | 9993 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9994 v8 = 8 * v4 + 400; | |
862 | 9995 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9996 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9997 return result; |
605 | 9998 default: |
9999 return result; | |
10000 } | |
10001 for (v3 = 1; v3 < 126; v3++) | |
10002 { | |
10003 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 10004 { |
605 | 10005 RemoveItemAtInventoryIndex(v3); |
501 | 10006 return true; |
0 | 10007 } |
605 | 10008 } |
501 | 10009 if ( pParty->pPickedItem.uItemID == pValue ) |
10010 { | |
605 | 10011 pMouse->RemoveHoldingItem(); |
10012 return true; | |
10013 } | |
10014 return false; | |
0 | 10015 } |
10016 } | |
10017 } | |
10018 // 5B65C4: using guessed type int dword_5B65C4; | |
10019 // 5B65CC: using guessed type int dword_5B65CC; |