Mercurial > mm7
annotate Player.cpp @ 1010:f73e1a219d38
player wear_item fix
author | Gloval |
---|---|
date | Sun, 19 May 2013 10:15:48 +0400 |
parents | 446175a32a15 |
children | 9e823ad5eaa6 |
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 | |
1010 | 115 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
116 | |
0 | 117 |
816 | 118 unsigned short base_recovery_times_per_weapon_type[12] = |
119 { | |
120 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
121 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
122 60, // PLAYER_SKILL_DAGGER | |
123 100, // PLAYER_SKILL_AXE | |
124 80, // PLAYER_SKILL_SPEAR | |
125 100, // PLAYER_SKILL_BOW | |
126 80, // PLAYER_SKILL_MACE | |
127 30, // PLAYER_SKILL_BLASTER | |
128 10, // PLAYER_SKILL_SHIELD | |
129 10, // PLAYER_SKILL_LEATHER | |
130 20, // PLAYER_SKILL_CHAIN | |
131 30 // PLAYER_SKILL_PLATE | |
132 }; | |
133 | |
134 | |
0 | 135 |
136 //----- (00490913) -------------------------------------------------------- | |
137 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
138 { | |
139 signed int v0; // edi@1 | |
140 signed int v1; // esi@1 | |
141 int v2; // ebx@2 | |
142 int v3; // ecx@17 | |
143 signed int v4; // eax@17 | |
144 int v5; // edx@18 | |
145 signed int v6; // ecx@18 | |
146 signed int v8; // [sp+Ch] [bp-8h]@1 | |
147 signed int v9; // [sp+10h] [bp-4h]@2 | |
148 | |
149 v8 = 50; | |
150 v0 = 50; | |
151 v1 = 0; | |
152 do | |
153 { | |
154 v9 = 0; | |
155 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
156 do | |
157 { | |
158 if ( v9 ) | |
159 { | |
160 switch ( v9 ) | |
161 { | |
162 case 1: | |
163 v0 = pParty->pPlayers[v1].uIntelligence; | |
164 break; | |
165 case 2: | |
166 v0 = pParty->pPlayers[v1].uWillpower; | |
167 break; | |
168 case 3: | |
169 v0 = pParty->pPlayers[v1].uEndurance; | |
170 break; | |
171 case 4: | |
172 v0 = pParty->pPlayers[v1].uAccuracy; | |
173 break; | |
174 case 5: | |
175 v0 = pParty->pPlayers[v1].uSpeed; | |
176 break; | |
177 case 6: | |
178 v0 = pParty->pPlayers[v1].uLuck; | |
179 break; | |
180 } | |
181 } | |
182 else | |
183 { | |
184 v0 = pParty->pPlayers[v1].uMight; | |
185 } | |
186 v3 = v2 + v9; | |
290 | 187 v4 = StatTable[0][v3].uBaseValue; |
0 | 188 if ( v0 >= v4 ) |
189 { | |
290 | 190 v5 = StatTable[0][v3].uDroppedStep; |
191 v6 = StatTable[0][v3].uBaseStep; | |
0 | 192 } |
193 else | |
194 { | |
290 | 195 v5 = StatTable[0][v3].uBaseStep; |
196 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 197 } |
198 v8 += v5 * (v4 - v0) / v6; | |
199 ++v9; | |
200 } | |
201 while ( v9 <= 6 ); | |
202 ++v1; | |
203 } | |
204 while ( v1 < 4 ); | |
205 return v8; | |
206 } | |
207 | |
208 | |
209 | |
210 //----- (00427730) -------------------------------------------------------- | |
211 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
212 { | |
488 | 213 if (sMana >= uRequiredMana) |
214 { | |
215 sMana -= uRequiredMana; | |
216 return true; | |
217 } | |
218 | |
219 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
220 return false; | |
0 | 221 } |
222 | |
223 | |
224 //----- (004BE2DD) -------------------------------------------------------- | |
886 | 225 void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx) |
0 | 226 { |
227 Player *v4; // edi@1 | |
228 char *v5; // esi@1 | |
229 float v6; // ST04_4@1 | |
230 signed int v7; // eax@1 | |
231 signed int v8; // ebx@1 | |
232 | |
233 auto a4 = _2devent_idx; | |
234 v4 = this; | |
235 v5 = (char *)this + 36 * a3; | |
236 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
237 //v6 = p2DEvents_minus1__20[13 * a4]; | |
238 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
917 | 239 v8 = GetPriceSell(v7, v6); |
0 | 240 if ( v5[552] & 2 ) |
241 v8 = 1; | |
242 if ( v8 < 1 ) | |
243 v8 = 1; | |
244 RemoveItemAtInventoryIndex(a2); | |
245 Party::SetGold(pParty->uNumGold + v8); | |
246 } | |
247 | |
248 | |
249 | |
250 //----- (0043EEF3) -------------------------------------------------------- | |
251 bool Player::_43EEF3() | |
252 { | |
253 signed int v1; // esi@1 | |
254 PlayerEquipment *v2; // edx@1 | |
255 bool result; // eax@2 | |
256 | |
257 v1 = 0; | |
258 v2 = &this->pEquipment; | |
259 while ( 1 ) | |
260 { | |
898 | 261 result = v2->uShield; |
262 if ( v2->uShield ) | |
0 | 263 { |
232 | 264 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 265 if ( result ) |
266 { | |
267 if ( result != 64 && result != 65 ) | |
268 break; | |
269 } | |
270 } | |
271 ++v1; | |
272 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
273 if ( v1 >= 16 ) | |
274 { | |
275 LOBYTE(result) = 1; | |
276 return result; | |
277 } | |
278 } | |
279 LOBYTE(result) = 0; | |
280 return result; | |
281 } | |
282 | |
283 | |
284 | |
285 //----- (004B8040) -------------------------------------------------------- | |
286 int Player::_4B8040_condition_time(unsigned int uCondition) | |
287 { | |
288 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
289 } | |
290 | |
291 //----- (004B807C) -------------------------------------------------------- | |
292 int Player::_4B807C(float a2) | |
293 { | |
294 Player *v2; // edi@1 | |
295 unsigned int v3; // eax@1 | |
296 int v4; // esi@1 | |
297 unsigned int v5; // ebx@7 | |
298 int v6; // eax@8 | |
299 signed __int64 v7; // qax@13 | |
300 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
301 signed int v10; // [sp+8h] [bp-8h]@4 | |
302 int v11; // [sp+Ch] [bp-4h]@6 | |
303 | |
304 v2 = this; | |
305 v3 = GetMajorConditionIdx(); | |
306 v4 = 0; | |
307 if ( (signed int)v3 >= 14 ) | |
308 { | |
309 if ( (signed int)v3 <= 15 ) | |
310 { | |
311 v10 = 5; | |
312 v9 = v3; | |
313 goto LABEL_6; | |
314 } | |
315 if ( v3 == 16 ) | |
316 { | |
317 v10 = 10; | |
318 v9 = 16; | |
319 LABEL_6: | |
320 v11 = _4B8040_condition_time(v9); | |
321 goto LABEL_13; | |
322 } | |
323 } | |
324 v10 = 1; | |
325 v5 = 0; | |
326 do | |
327 { | |
328 v6 = _4B8040_condition_time(v5); | |
329 if ( v6 > v4 ) | |
330 v4 = v6; | |
331 ++v5; | |
332 } | |
333 while ( (signed int)v5 <= 13 ); | |
334 v11 = v4; | |
335 if ( !v4 ) | |
336 v11 = 1; | |
337 LABEL_13: | |
338 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
339 if ( (signed int)v7 < 1 ) | |
340 LODWORD(v7) = 1; | |
341 return v7; | |
342 } | |
343 | |
344 //----- (004B8102) -------------------------------------------------------- | |
917 | 345 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 346 { |
347 signed int v3; // esi@1 | |
348 signed int result; // eax@3 | |
349 | |
917 | 350 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
351 if ( v3 > uRealValue ) | |
352 v3 = uRealValue; | |
0 | 353 result = 1; |
354 if ( v3 >= 1 ) | |
355 result = v3; | |
356 return result; | |
357 } | |
358 | |
359 //----- (004B8142) -------------------------------------------------------- | |
749 | 360 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
361 { | |
362 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
363 assert (price > 0); | |
364 | |
365 if (price < uRealValue) | |
366 price = uRealValue; | |
367 return price; | |
0 | 368 } |
369 | |
370 //----- (004B8179) -------------------------------------------------------- | |
916 | 371 int Player::GetPriceIdentification(float a2) |
0 | 372 { |
373 signed int v2; // esi@1 | |
374 int v3; // ecx@1 | |
375 signed int result; // eax@3 | |
376 | |
377 v2 = (signed __int64)(a2 * 50.0); | |
378 v3 = v2 * (100 - GetMerchant()) / 100; | |
379 if ( v3 < v2 / 3 ) | |
380 v3 = v2 / 3; | |
381 result = 1; | |
382 if ( v3 >= 1 ) | |
383 result = v3; | |
384 return result; | |
385 } | |
386 | |
387 //----- (004B81C3) -------------------------------------------------------- | |
916 | 388 int Player::GetPriceRepair(int a2, float a3) |
0 | 389 { |
390 signed int v3; // esi@1 | |
391 int v4; // ecx@1 | |
392 signed int result; // eax@3 | |
393 | |
394 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
395 v4 = v3 * (100 - GetMerchant()) / 100; | |
396 if ( v4 < v3 / 3 ) | |
397 v4 = v3 / 3; | |
398 result = 1; | |
399 if ( v4 >= 1 ) | |
400 result = v4; | |
401 return result; | |
402 } | |
403 | |
404 //----- (004B8213) -------------------------------------------------------- | |
405 int Player::_4B8213(int a2, float a3) | |
406 { | |
407 signed __int64 v3; // qax@1 | |
408 | |
409 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
410 if ( (signed int)v3 < 1 ) | |
411 LODWORD(v3) = 1; | |
412 return v3; | |
413 } | |
414 | |
415 //----- (004B8233) -------------------------------------------------------- | |
416 int Player::_4B8233(int a2, float a3) | |
417 { | |
418 signed __int64 v3; // qax@1 | |
419 | |
420 v3 = (signed __int64)((double)a2 * a3); | |
421 if ( (signed int)v3 < 1 ) | |
422 LODWORD(v3) = 1; | |
423 return v3; | |
424 } | |
425 | |
426 //----- (004B824B) -------------------------------------------------------- | |
427 int Player::_4B824B(float a2) | |
428 { | |
429 signed __int64 v2; // qax@1 | |
430 | |
431 v2 = (signed __int64)(a2 * 50.0); | |
432 if ( (signed int)v2 < 1 ) | |
433 LODWORD(v2) = 1; | |
434 return v2; | |
435 } | |
436 | |
437 //----- (004B8265) -------------------------------------------------------- | |
438 int Player::_4B8265(int a2, float a3) | |
439 { | |
440 signed __int64 v3; // qax@1 | |
441 | |
442 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
443 if ( (signed int)v3 < 1 ) | |
444 LODWORD(v3) = 1; | |
445 return v3; | |
446 } | |
447 | |
448 | |
449 | |
450 | |
451 | |
452 //----- (004B6FF9) -------------------------------------------------------- | |
453 int Player::_4B6FF9() | |
454 { | |
455 Player *v1; // esi@1 | |
456 signed int v2; // eax@1 | |
457 char v3; // zf@4 | |
458 | |
459 v1 = this; | |
336 | 460 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 461 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
462 { | |
463 if ( GetMajorConditionIdx() == 18 ) | |
464 goto LABEL_6; | |
465 v3 = GetMajorConditionIdx() == 17; | |
466 } | |
467 else | |
468 { | |
469 v3 = GetMajorConditionIdx() == 18; | |
470 } | |
471 if ( !v3 ) | |
472 return 1; | |
473 LABEL_6: | |
474 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
475 return 1; | |
476 return 0; | |
477 } | |
478 | |
479 | |
480 | |
481 //----- (00421E75) -------------------------------------------------------- | |
482 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
483 { | |
484 int v2; // eax@1 | |
485 unsigned int result; // eax@3 | |
486 | |
487 v2 = *a2; | |
488 if ( *a2 >= 126 || v2 < 0 ) | |
489 { | |
490 result = 0; | |
491 } | |
492 else | |
493 { | |
494 result = this->pInventoryIndices[v2]; | |
495 if ( (result & 0x80000000u) != 0 ) | |
496 { | |
497 *a2 = -1 - result; | |
498 result = this->pInventoryIndices[-1 - result]; | |
499 } | |
500 } | |
501 return result; | |
502 } | |
503 | |
504 | |
505 | |
506 //----- (004160CA) -------------------------------------------------------- | |
507 char Player::_4160CA(int a2) | |
508 { | |
509 Player *v2; // esi@1 | |
510 signed int v3; // edx@1 | |
511 signed int v4; // ebx@1 | |
512 ItemGen *v5; // eax@1 | |
513 int v6; // edi@2 | |
514 signed int i; // edx@8 | |
515 ItemGen **v8; // ecx@9 | |
516 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
517 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
518 int v12; // [sp+120h] [bp-4h]@1 | |
519 | |
520 auto a1 = this; | |
521 | |
522 v12 = a2; | |
523 v2 = a1; | |
524 v3 = 0; | |
525 v10[0] = 0; | |
526 v4 = 0; | |
527 memset(&v10[1], 0, 0x110u); | |
528 v11 = 0; | |
529 v5 = a1->pInventoryItems; | |
530 do | |
531 { | |
532 v6 = 0; | |
533 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
534 v10[v4++] = v3; | |
535 ++v3; | |
536 ++v5; | |
537 } | |
538 while ( v3 < 138 ); | |
539 if ( v4 ) | |
540 { | |
541 if ( v12 ) | |
542 { | |
543 if ( v12 > 0 ) | |
544 { | |
545 do | |
546 { | |
547 LOWORD(v5) = 9 * v10[v6]; | |
548 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
549 { | |
550 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
551 v5->uItemID |= 2u; | |
552 } | |
553 ++v6; | |
554 } | |
555 while ( v6 < v12 ); | |
556 } | |
557 } | |
558 else | |
559 { | |
560 for ( i = 0; i < v4; ++i ) | |
561 { | |
562 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
563 v5 = *v8; | |
564 if ( !(BYTE1(v5) & 2) ) | |
565 { | |
566 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
567 *v8 = v5; | |
568 } | |
569 } | |
570 } | |
571 } | |
572 return (char)v5; | |
573 } | |
574 | |
575 //----- (004948B1) -------------------------------------------------------- | |
187 | 576 void Player::PlaySound(PlayerSpeech speech, int a3) |
577 { | |
578 //Player *pPlayer; // edi@1 | |
579 //int v4; // eax@4 | |
0 | 580 signed int v5; // esi@4 |
203 | 581 unsigned char *v6; // ebx@4 |
0 | 582 signed int v7; // ecx@5 |
583 unsigned __int8 v8; // al@6 | |
584 int v9; // eax@10 | |
187 | 585 //unsigned int pVoiceID; // ecx@10 |
0 | 586 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
587 //signed int v12; // eax@11 |
0 | 588 signed int v13; // esi@12 |
589 int v14; // eax@12 | |
187 | 590 //int v15; // eax@17 |
248 | 591 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 592 signed int v17; // ecx@19 |
593 char *pSoundID; // edi@20 | |
594 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 595 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 596 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
597 int pSoundId; // [sp+30h] [bp+8h]@4 | |
598 | |
187 | 599 //pPlayer = this; |
600 //pPlayer2 = this; | |
601 | |
0 | 602 pPlayerNum = 1; |
187 | 603 for (int i = 0; i < 4; ++i) |
604 if (&pParty->pPlayers[i] == this) | |
605 { | |
606 pPlayerNum = i + 1; | |
0 | 607 break; |
187 | 608 } |
609 | |
610 //v4 = a2;//102 | |
0 | 611 v5 = 0; |
612 pSoundId = 0; | |
203 | 613 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
614 if (uVoicesVolumeMultiplier) | |
0 | 615 { |
616 v7 = 0; | |
617 do | |
618 { | |
619 v8 = v6[v7]; | |
620 if ( v8 ) | |
621 v20[v5++] = v8; | |
622 ++v7; | |
623 } | |
624 while ( v7 < 2 ); | |
625 if ( v5 ) | |
626 { | |
627 v9 = rand(); | |
187 | 628 //pVoiceID = uVoiceID; |
0 | 629 v11 = v20[v9 % v5]; |
203 | 630 |
631 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
632 { | |
633 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
634 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 635 } |
636 } | |
637 } | |
203 | 638 |
0 | 639 v13 = 0; |
640 v14 = (int)(v6 + 3); | |
641 do | |
642 { | |
643 if ( *(char *)v14 ) | |
644 v20[v13++] = *(char *)v14; | |
645 ++v14; | |
646 } | |
647 while ( -3 - (signed int)v6 + v14 < 5 ); | |
648 if ( v13 ) | |
649 { | |
650 pPlayerNum = 0; | |
248 | 651 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
652 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 653 { |
654 v17 = 0; | |
764 | 655 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 656 { |
657 LABEL_23: | |
658 v17 = 0; | |
659 } | |
660 else | |
661 { | |
662 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
663 while ( *(int *)pSoundID != pSoundId ) | |
664 { | |
665 ++v17; | |
666 pSoundID += 120; | |
764 | 667 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 668 goto LABEL_23; |
669 } | |
670 } | |
671 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
672 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
673 } | |
248 | 674 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 675 } |
676 //return v14; | |
0 | 677 } |
678 // 4948B1: using guessed type int var_1C[5]; | |
679 | |
680 //----- (00494A25) -------------------------------------------------------- | |
187 | 681 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
682 { | |
683 //signed int v3; // eax@1 | |
684 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 685 signed int v5; // edi@15 |
686 PlayerFrame *v6; // esi@17 | |
687 signed int v7; // eax@20 | |
688 | |
187 | 689 //LOWORD(v3) = this->expression; |
690 //v4 = expr; | |
691 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
692 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
693 { | |
694 int v3 = (unsigned)expression; | |
0 | 695 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
696 { | |
697 if ( v3 <= 7 ) | |
698 goto LABEL_12; | |
699 if ( v3 > 8 ) | |
700 { | |
701 if ( v3 > 11 ) | |
702 { | |
187 | 703 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
704 return; | |
0 | 705 goto LABEL_15; |
706 } | |
707 LABEL_12: | |
187 | 708 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
709 return; | |
0 | 710 goto LABEL_15; |
711 } | |
712 } | |
713 } | |
714 LABEL_15: | |
187 | 715 //LOWORD(v3) = a3; |
0 | 716 v5 = 0; |
717 this->uExpressionTimeLength = a3; | |
718 this->uExpressionTimePassed = 0; | |
719 if ( !a3 ) | |
720 { | |
721 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
722 { | |
723 LABEL_20: | |
724 v7 = 0; | |
725 } | |
726 else | |
727 { | |
728 v6 = pPlayerFrameTable->pFrames; | |
187 | 729 while ( v6->expression != new_expression ) |
0 | 730 { |
731 ++v5; | |
732 ++v6; | |
733 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
734 goto LABEL_20; | |
735 } | |
736 v7 = v5; | |
737 } | |
187 | 738 //v4 = expr; |
739 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
740 } | |
741 expression = new_expression; | |
0 | 742 viewparams->bRedrawGameUI = 1; |
743 } | |
744 | |
745 //----- (0049327B) -------------------------------------------------------- | |
746 int Player::_49327B(unsigned int uClass, int a3) | |
747 { | |
748 Player *v3; // esi@1 | |
749 char v4; // zf@4 | |
750 __int16 v5; // dx@9 | |
751 signed int result; // eax@84 | |
752 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
753 int v8; // [sp-4h] [bp-Ch]@3 | |
754 | |
755 v3 = this; | |
135 | 756 if ( this->classType == uClass ) |
0 | 757 { |
758 LABEL_84: | |
759 result = 1; | |
760 } | |
761 else | |
762 { | |
763 switch ( uClass ) | |
764 { | |
765 case 0u: | |
766 v8 = a3; | |
767 v7 = 1; | |
768 goto LABEL_4; | |
769 case 1u: | |
484 | 770 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 771 || _49327B(2u, a3) ) |
772 goto LABEL_84; | |
773 v8 = a3; | |
774 v7 = 3; | |
775 goto LABEL_4; | |
776 case 2u: | |
777 v5 = 19; | |
778 goto LABEL_82; | |
779 case 3u: | |
780 v5 = 21; | |
781 goto LABEL_82; | |
782 case 4u: | |
783 v8 = a3; | |
784 v7 = 5; | |
785 goto LABEL_4; | |
786 case 5u: | |
484 | 787 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 788 || _49327B(6u, a3) ) |
789 goto LABEL_84; | |
790 v8 = a3; | |
791 v7 = 7; | |
792 goto LABEL_4; | |
793 case 6u: | |
794 if ( !a3 ) | |
795 break; | |
796 v5 = 13; | |
797 goto LABEL_82; | |
798 case 7u: | |
799 if ( !a3 ) | |
800 break; | |
801 v5 = 15; | |
802 goto LABEL_82; | |
803 case 8u: | |
804 v8 = a3; | |
805 v7 = 9; | |
806 goto LABEL_4; | |
807 case 9u: | |
484 | 808 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 809 || _49327B(0xAu, a3) ) |
810 goto LABEL_84; | |
811 v8 = a3; | |
812 v7 = 11; | |
813 goto LABEL_4; | |
814 case 0xAu: | |
815 if ( !a3 ) | |
816 break; | |
817 v5 = 25; | |
818 goto LABEL_82; | |
819 case 0xBu: | |
820 if ( !a3 ) | |
821 break; | |
822 v5 = 27; | |
823 goto LABEL_82; | |
824 case 0xCu: | |
825 v8 = a3; | |
826 v7 = 13; | |
827 goto LABEL_4; | |
828 case 0xDu: | |
484 | 829 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 830 || _49327B(0xEu, a3) ) |
831 goto LABEL_84; | |
832 v8 = a3; | |
833 v7 = 15; | |
834 goto LABEL_4; | |
835 case 0xEu: | |
836 if ( !a3 ) | |
837 break; | |
838 v5 = 43; | |
839 goto LABEL_82; | |
840 case 0xFu: | |
841 if ( !a3 ) | |
842 break; | |
843 v5 = 45; | |
844 goto LABEL_82; | |
845 case 0x10u: | |
846 v8 = a3; | |
847 v7 = 17; | |
848 goto LABEL_4; | |
849 case 0x11u: | |
484 | 850 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 851 || _49327B(0x12u, a3) ) |
852 goto LABEL_84; | |
853 v8 = a3; | |
854 v7 = 19; | |
855 goto LABEL_4; | |
856 case 0x12u: | |
857 if ( !a3 ) | |
858 break; | |
859 v5 = 37; | |
860 goto LABEL_82; | |
861 case 0x13u: | |
862 v5 = 39; | |
863 goto LABEL_82; | |
864 case 0x14u: | |
865 v8 = a3; | |
866 v7 = 21; | |
867 goto LABEL_4; | |
868 case 0x15u: | |
484 | 869 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 870 || _49327B(0x16u, a3) ) |
871 goto LABEL_84; | |
872 v8 = a3; | |
873 v7 = 23; | |
874 goto LABEL_4; | |
875 case 0x16u: | |
876 if ( !a3 ) | |
877 break; | |
878 v5 = 31; | |
879 goto LABEL_82; | |
880 case 0x17u: | |
881 if ( !a3 ) | |
882 break; | |
883 v5 = 33; | |
884 goto LABEL_82; | |
885 case 0x18u: | |
886 if ( !_49327B(0x19u, a3) ) | |
887 goto LABEL_56; | |
888 break; | |
889 case 0x19u: | |
890 LABEL_56: | |
484 | 891 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 892 || _49327B(0x1Au, a3) ) |
893 goto LABEL_84; | |
894 v8 = a3; | |
895 v7 = 27; | |
896 goto LABEL_4; | |
897 case 0x1Au: | |
898 if ( !a3 ) | |
899 break; | |
900 v5 = 65; | |
901 goto LABEL_82; | |
902 case 0x1Bu: | |
903 if ( !a3 ) | |
904 break; | |
905 v5 = 67; | |
906 goto LABEL_82; | |
907 case 0x1Cu: | |
908 v8 = a3; | |
909 v7 = 29; | |
910 goto LABEL_4; | |
911 case 0x1Du: | |
484 | 912 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 913 || _49327B(0x1Eu, a3) ) |
914 goto LABEL_84; | |
915 v8 = a3; | |
916 v7 = 31; | |
917 goto LABEL_4; | |
918 case 0x1Eu: | |
919 if ( !a3 ) | |
920 break; | |
921 v5 = 71; | |
922 goto LABEL_82; | |
923 case 0x1Fu: | |
924 if ( !a3 ) | |
925 break; | |
926 v5 = 73; | |
927 goto LABEL_82; | |
928 case 0x20u: | |
929 v8 = a3; | |
930 v7 = 33; | |
931 goto LABEL_4; | |
932 case 0x21u: | |
484 | 933 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 934 || _49327B(0x22u, a3) ) |
935 goto LABEL_84; | |
936 v8 = a3; | |
937 v7 = 35; | |
938 LABEL_4: | |
939 v4 = _49327B(v7, v8) == 0; | |
940 goto LABEL_83; | |
941 case 0x22u: | |
942 if ( !a3 ) | |
943 break; | |
944 v5 = 77; | |
945 goto LABEL_82; | |
946 case 0x23u: | |
947 if ( a3 ) | |
948 { | |
949 v5 = 79; | |
950 LABEL_82: | |
484 | 951 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 952 LABEL_83: |
953 if ( !v4 ) | |
954 goto LABEL_84; | |
955 } | |
956 break; | |
957 default: | |
958 break; | |
959 } | |
960 result = 0; | |
961 } | |
962 return result; | |
963 } | |
964 | |
965 | |
966 //----- (00492C0B) -------------------------------------------------------- | |
967 bool Player::CanAct() | |
968 { | |
969 bool result; // eax@2 | |
970 | |
971 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
972 result = 0; | |
973 else | |
974 result = 1; | |
975 return result; | |
976 } | |
977 | |
978 //----- (00492C40) -------------------------------------------------------- | |
979 bool Player::CanSteal() | |
980 { | |
981 int v1; // eax@1 | |
982 | |
983 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
984 return v1 != 0; | |
985 } | |
986 | |
987 //----- (00492C4E) -------------------------------------------------------- | |
988 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
989 { | |
990 char v2; // zf@9 | |
991 __int16 v4; // dx@13 | |
992 char v5; // zf@15 | |
993 | |
994 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
995 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
996 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
997 { | |
998 if ( uItemID == 533 ) | |
999 { | |
1000 v2 = GetRace() == 1; | |
1001 } | |
1002 else | |
1003 { | |
1004 if ( uItemID != 534 ) | |
1005 { | |
1006 if ( uItemID == 535 ) // | |
1007 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
1008 { | |
1009 switch ( this->uVoiceID ) | |
1010 { | |
1011 default: | |
1012 return 1; | |
1013 case 4u: | |
1014 case 5u: | |
1015 case 6u: | |
1016 case 7u: | |
1017 case 0xAu: | |
1018 case 0xBu: | |
1019 case 0xEu: // | |
1020 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
1021 case 0xFu: | |
1022 case 0x12u: | |
1023 case 0x13u: | |
1024 case 0x15u: | |
1025 case 0x18u: | |
1026 return 0; | |
1027 } | |
1028 return 0; | |
1029 } | |
1030 if ( uItemID == 536 ) // | |
1031 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
1032 { | |
1033 switch ( this->uVoiceID ) | |
1034 { | |
1035 case 4u: | |
1036 case 5u: | |
1037 case 6u: | |
1038 case 7u: | |
1039 case 0xAu: | |
1040 case 0xBu: | |
1041 case 0xEu: | |
1042 case 0xFu: | |
1043 case 0x12u: | |
1044 case 0x13u: | |
1045 case 0x15u: | |
1046 case 0x18u: | |
1047 return 1; | |
1048 default: | |
1049 return 0; | |
1050 } | |
1051 return 0; | |
1052 } | |
1053 if ( uItemID != 604 ) // | |
1054 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1055 return 1; | |
1056 v5 = _43EEF3() == 0; | |
1057 goto LABEL_23; | |
1058 } | |
1059 v2 = GetRace() == 3; // | |
1060 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1061 } | |
1062 } | |
1063 else | |
1064 { | |
1065 if ( uItemID != 532 ) | |
1066 { | |
1067 if ( uItemID != 515 && uItemID != 517 ) // | |
1068 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1069 { | |
1070 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1071 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1072 { | |
1073 LABEL_13: | |
1074 v4 = 99; | |
1075 LABEL_15: | |
484 | 1076 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1077 LABEL_23: |
1078 if ( !v5 ) | |
1079 return 1; | |
1080 return 0; | |
1081 } | |
1082 if ( uItemID != 525 ) | |
1083 { | |
1084 if ( uItemID != 527 ) | |
1085 { | |
1086 if ( uItemID != 531 ) | |
1087 return 1; | |
1088 v2 = GetRace() == 2; | |
1089 goto LABEL_10; | |
1090 } | |
1091 goto LABEL_13; | |
1092 } | |
1093 } | |
1094 v4 = 100; | |
1095 goto LABEL_15; | |
1096 } | |
1097 v2 = GetRace() == 0; | |
1098 } | |
1099 LABEL_10: | |
1100 if ( v2 ) | |
1101 return 1; | |
1102 return 0; | |
1103 } | |
1104 | |
1105 //----- (00492D65) -------------------------------------------------------- | |
1106 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1107 { | |
1108 Player *v3; // esi@1 | |
1109 Player **v4; // ebx@2 | |
1110 Player *v5; // ecx@21 | |
1111 Player *v6; // ecx@22 | |
1112 Player *v7; // ecx@29 | |
1010 | 1113 Player *v8; // ecx@29 |
1114 | |
0 | 1115 Player *v11; // ecx@45 |
1116 Player *v12; // ecx@46 | |
1117 char *v13; // eax@49 | |
1118 Player *v14; // ecx@58 | |
1119 Player *v15; // ecx@59 | |
1120 Player *v16; // ecx@60 | |
1121 signed int result; // eax@76 | |
1122 signed int v18; // ecx@77 | |
1123 int v19; // eax@77 | |
1124 char v20; // al@80 | |
1125 signed int v21; // ebx@82 | |
1126 signed int v22; // esi@82 | |
1127 int v23; // [sp-8h] [bp-1Ch]@7 | |
1128 int v24; // [sp-8h] [bp-1Ch]@15 | |
1129 int v25; // [sp-8h] [bp-1Ch]@53 | |
1130 int v26; // [sp-4h] [bp-18h]@7 | |
1131 signed int v27; // [sp-4h] [bp-18h]@15 | |
1132 int v28; // [sp-4h] [bp-18h]@53 | |
1133 char *v29; // [sp+Ch] [bp-8h]@1 | |
1134 int v30; // [sp+10h] [bp-4h]@2 | |
1135 int v31; // [sp+20h] [bp+Ch]@82 | |
1136 | |
1137 v3 = this; | |
1138 v29 = (char *)this + 8 * uConditionIdx; | |
1139 if ( *(_QWORD *)v29 ) | |
1140 { | |
1141 LABEL_76: | |
1142 result = 0; | |
1143 } | |
1144 else | |
1145 { | |
1146 v4 = &pPlayers[1]; | |
1147 v30 = 0; | |
1148 do | |
1149 { | |
1150 if ( (*v4)->CanAct() ) | |
1151 ++v30; | |
1152 ++v4; | |
1153 } | |
1154 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1155 switch ( uConditionIdx ) | |
1156 { | |
1157 case 0u: | |
1158 v26 = 0; | |
1159 v23 = 30; | |
1160 goto LABEL_81; | |
1161 case 1u: | |
1162 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1163 goto LABEL_10; | |
1164 v26 = 0; | |
1165 v23 = 25; | |
1166 goto LABEL_81; | |
1167 case 2u: | |
1168 if ( a3 != 1 ) | |
1169 goto LABEL_82; | |
1170 if ( v3->HasEnchantedItemEquipped(22) ) | |
1171 goto LABEL_76; | |
1172 v27 = 3; | |
1173 v24 = 505; | |
1174 goto LABEL_16; | |
1175 case 3u: | |
1176 v26 = 0; | |
1177 v23 = 26; | |
1178 goto LABEL_81; | |
1179 case 4u: | |
1180 v26 = 0; | |
1181 v23 = 31; | |
1182 goto LABEL_81; | |
1183 case 5u: | |
1184 if ( a3 == 1 | |
1185 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1186 goto LABEL_76; | |
1187 v26 = 0; | |
1188 v23 = 29; | |
1189 goto LABEL_81; | |
1190 case 6u: | |
1191 case 8u: | |
1192 case 0xAu: | |
1193 if ( a3 == 1 ) | |
1194 { | |
1195 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1196 { | |
1197 --pParty->pPartyBuffs[13].uPower; | |
1198 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1199 pParty->pPartyBuffs[13].Reset(); | |
1200 } | |
1201 if ( v3->HasEnchantedItemEquipped(21) | |
1202 || v7->WearsItem(505, 3) | |
1203 || v8->WearsItem(530, 6) ) | |
1204 goto LABEL_76; | |
1205 } | |
1206 v26 = 0; | |
1207 v23 = 27; | |
1208 goto LABEL_81; | |
1209 case 7u: | |
1210 case 9u: | |
1211 case 0xBu: | |
1212 if ( a3 != 1 ) | |
1213 goto LABEL_40; | |
1214 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1215 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1216 goto LABEL_10; | |
900 | 1217 if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) ) |
0 | 1218 goto LABEL_76; |
1219 LABEL_40: | |
1220 v26 = 0; | |
1221 v23 = 28; | |
1222 goto LABEL_81; | |
1223 case 0xCu: | |
1224 if ( a3 != 1 ) | |
1225 goto LABEL_82; | |
1226 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1227 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1228 goto LABEL_10; | |
1229 if ( v3->HasEnchantedItemEquipped(20) | |
1230 || v11->WearsItem(505, 3) | |
1231 || v12->WearsItem(507, 16) ) | |
1232 goto LABEL_76; | |
1233 v27 = 6; | |
1234 v24 = 530; | |
1235 LABEL_16: | |
1236 if ( v3->WearsItem(v24, v27) ) | |
1237 goto LABEL_76; | |
1238 goto LABEL_82; | |
1239 case 0xDu: | |
187 | 1240 v3->PlaySound(SPEECH_32, 0); |
0 | 1241 v13 = (char *)&v3->sHealth; |
1242 goto LABEL_70; | |
1243 case 0xEu: | |
1244 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1245 goto LABEL_10; | |
1246 v28 = 0; | |
1247 v25 = 33; | |
1248 goto LABEL_67; | |
1249 case 0xFu: | |
1250 if ( a3 == 1 | |
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1252 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1253 || v3->HasEnchantedItemEquipped(23) | |
1254 || v14->WearsItem(520, 16) | |
1255 || v15->WearsItem(505, 3) | |
1256 || v16->WearsItem(530, 6)) ) | |
1257 goto LABEL_76; | |
1258 v26 = 0; | |
1259 v23 = 34; | |
1260 goto LABEL_81; | |
1261 case 0x10u: | |
1262 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1263 { | |
1264 LABEL_10: | |
1265 --pParty->pPartyBuffs[13].uPower; | |
1266 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1267 pParty->pPartyBuffs[13].Reset(); | |
1268 goto LABEL_76; | |
1269 } | |
1270 v28 = 0; | |
187 | 1271 v25 = SPEECH_35; |
0 | 1272 LABEL_67: |
187 | 1273 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1274 if ( v3->sHealth > 0 ) |
1275 v3->sHealth = 0; | |
1276 v13 = (char *)&v3->sMana; | |
1277 LABEL_70: | |
1278 if ( *(int *)v13 > 0 ) | |
1279 *(int *)v13 = 0; | |
1280 LABEL_82: | |
1281 v21 = 0; | |
1282 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1283 v31 = 0; | |
1284 v22 = 1; | |
1285 do | |
1286 { | |
1287 if ( pPlayers[v22]->CanAct() ) | |
1288 { | |
1289 ++v31; | |
1290 v21 = v22; | |
1291 } | |
1292 ++v22; | |
1293 } | |
1294 while ( v22 <= 4 ); | |
1295 if ( v30 == 2 ) | |
1296 { | |
1297 if ( v31 == 1 ) | |
187 | 1298 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1299 } |
1300 result = 1; | |
1301 break; | |
1302 case 0x11u: | |
135 | 1303 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1304 v3->Zombie() || !v3->Dead()) | |
0 | 1305 goto LABEL_76; |
1306 memset(v3, 0, 0xA0u); | |
1307 v3->sHealth = v3->GetMaxHealth(); | |
1308 v18 = 0; | |
1309 v3->field_1928 = v3->uFace; | |
1310 v19 = v3->uVoiceID; | |
1311 v3->sMana = 0; | |
1312 v3->field_1924 = v19; | |
1313 switch ( v19 ) | |
1314 { | |
1315 case 0: | |
1316 case 1: | |
1317 case 2: | |
1318 case 3: | |
1319 case 8: | |
1320 case 9: | |
1321 case 12: | |
1322 case 13: | |
1323 case 16: | |
1324 case 17: | |
1325 case 20: | |
1326 case 23: | |
1327 v18 = 0; | |
1328 break; | |
1329 case 4: | |
1330 case 5: | |
1331 case 6: | |
1332 case 7: | |
1333 case 10: | |
1334 case 11: | |
1335 case 14: | |
1336 case 15: | |
1337 case 18: | |
1338 case 19: | |
1339 case 21: | |
1340 case 24: | |
1341 v18 = 1; | |
1342 break; | |
1343 default: | |
1344 break; | |
1345 } | |
1346 v26 = 0; | |
1347 v20 = (v18 != 0) + 23; | |
187 | 1348 v23 = SPEECH_99; |
0 | 1349 v3->uFace = v20; |
1350 v3->uVoiceID = v20; | |
1351 LABEL_81: | |
187 | 1352 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1353 goto LABEL_82; |
1354 default: | |
1355 goto LABEL_82; | |
1356 } | |
1357 } | |
1358 return result; | |
1359 } | |
1360 | |
1361 //----- (00492528) -------------------------------------------------------- | |
1362 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1363 { | |
973 | 1364 //unsigned int v3; // eax@1 |
0 | 1365 Texture *v4; // esi@1 |
1366 unsigned int v5; // ebx@1 | |
1367 signed int v6; // edi@5 | |
1368 int *v7; // ecx@6 | |
1369 signed int v8; // edx@7 | |
1370 int *v9; // eax@8 | |
973 | 1371 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1372 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1373 | |
973 | 1374 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1375 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1376 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1377 if ( !areWeLoadingTexture ) | |
1378 { | |
1379 v4->Release(); | |
1006 | 1380 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1381 } |
1382 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1383 { | |
1384 v6 = 0; | |
1385 if ( (signed int)uItemIDa <= 0 ) | |
1386 return 1; | |
973 | 1387 v7 = &pInventoryIndices[uSlot]; |
0 | 1388 while ( 1 ) |
1389 { | |
1390 v8 = 0; | |
1391 if ( (signed int)v5 > 0 ) | |
1392 break; | |
1393 LABEL_11: | |
1394 ++v6; | |
1395 v7 += 14; | |
1396 if ( v6 >= (signed int)uItemIDa ) | |
1397 return 1; | |
1398 } | |
1399 v9 = v7; | |
1400 while ( !*v9 ) | |
1401 { | |
1402 ++v8; | |
1403 ++v9; | |
1404 if ( v8 >= (signed int)v5 ) | |
1405 goto LABEL_11; | |
1406 } | |
1407 } | |
1408 return 0; | |
1409 } | |
1410 // 506128: using guessed type int areWeLoadingTexture; | |
1411 | |
1412 //----- (004925E6) -------------------------------------------------------- | |
1413 unsigned int Player::FindFreeInventorySlot() | |
1414 { | |
1415 unsigned int result; // eax@1 | |
1416 ItemGen *v2; // ecx@1 | |
1417 | |
1418 result = 0; | |
1419 v2 = this->pInventoryItems; | |
1420 while ( v2->uItemID ) | |
1421 { | |
1422 ++result; | |
1423 ++v2; | |
1424 if ( (signed int)result >= 126 ) | |
1425 return -1; | |
1426 } | |
1427 return result; | |
1428 } | |
1429 | |
1430 //----- (00492600) -------------------------------------------------------- | |
1431 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1432 { | |
1433 signed int v3; // edx@1 | |
1434 ItemGen *v4; // eax@1 | |
1435 int result; // eax@8 | |
1436 unsigned int v6; // ebx@10 | |
973 | 1437 //unsigned int v7; // eax@10 |
0 | 1438 Texture *v8; // esi@10 |
1439 void *v9; // esi@13 | |
1440 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1441 Player *v11; // [sp+4h] [bp-8h]@1 | |
1442 signed int v12; // [sp+8h] [bp-4h]@4 | |
1443 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1444 | |
1445 v11 = this; | |
1446 v3 = 0; | |
1447 v4 = this->pInventoryItems; | |
1448 while ( v4->uItemID ) | |
1449 { | |
1450 ++v3; | |
1451 ++v4; | |
1452 if ( v3 >= 126 ) | |
1453 { | |
1454 v12 = -1; | |
1455 goto LABEL_5; | |
1456 } | |
1457 } | |
1458 v12 = v3; | |
1459 LABEL_5: | |
1460 if ( v12 == -1 ) | |
1461 { | |
1462 if ( uActiveCharacter ) | |
201 | 1463 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1464 result = 0; |
1465 } | |
1466 else | |
1467 { | |
1468 v6 = uItemID; | |
973 | 1469 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1470 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1471 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1472 if ( !areWeLoadingTexture ) | |
1473 { | |
1474 v8->Release(); | |
1006 | 1475 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1476 } |
1477 if ( (signed int)uItemIDa > 0 ) | |
1478 { | |
1479 v9 = &v11->pInventoryIndices[uSlot]; | |
1480 do | |
1481 { | |
1482 if ( (signed int)v10 > 0 ) | |
1483 memset32(v9, -1 - uSlot, v10); | |
1484 v9 = (char *)v9 + 56; | |
1485 --uItemIDa; | |
1486 } | |
1487 while ( uItemIDa ); | |
1488 } | |
1489 result = v12 + 1; | |
1490 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1491 v11->pInventoryItems[v12].uItemID = v6; | |
1492 } | |
1493 return result; | |
1494 } | |
1495 // 506128: using guessed type int areWeLoadingTexture; | |
1496 | |
1497 //----- (00492700) -------------------------------------------------------- | |
1498 int Player::HasSkill(unsigned int uSkillType) | |
1499 { | |
1500 signed int result; // eax@3 | |
1501 | |
1502 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1503 { | |
1504 result = 1; | |
1505 } | |
1506 else | |
1507 { | |
809 | 1508 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1509 ShowStatusBarString(pTmpBuf, 2u); |
1510 result = 0; | |
1511 } | |
1512 return result; | |
1513 } | |
1514 | |
1515 //----- (00492745) -------------------------------------------------------- | |
1516 int Player::WearItem(unsigned int uItemID) | |
1517 { | |
1010 | 1518 int item_body_anch; // edi@6 |
1519 int item_indx; | |
1520 //find empty slot | |
1521 for(item_indx=0;item_indx<126;++item_indx) | |
1522 if (pInventoryItems[item_indx].uItemID==0) | |
1523 break; | |
1524 if (item_indx==126) //not found | |
1525 item_indx=-1; | |
1526 | |
1527 if ( item_indx != -1 ) | |
1528 { | |
1529 | |
1530 pInventoryItems[item_indx].uItemID=uItemID; | |
1531 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1532 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1533 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1534 | |
0 | 1535 } |
1536 return 0; | |
1537 } | |
1538 | |
1539 //----- (004927A8) -------------------------------------------------------- | |
1540 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1541 { | |
1542 signed int v3; // ebx@2 | |
1543 signed int v4; // edi@3 | |
1544 unsigned int v5; // esi@3 | |
1545 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1546 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1547 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1548 | |
1549 thisa = this; | |
1550 if ( uSlot == -1 ) | |
1551 { | |
1552 v3 = 0; | |
1553 while ( 2 ) | |
1554 { | |
1555 v4 = 0; | |
1556 v5 = v3; | |
1557 do | |
1558 { | |
1559 if ( CanFitItem(v5, uItemID) ) | |
1560 { | |
1561 v8 = uItemID; | |
1562 v7 = v5; | |
1563 return CreateItemInInventory(v7, v8); | |
1564 } | |
1565 ++v4; | |
1566 v5 += 14; | |
1567 } | |
1568 while ( v4 < 9 ); | |
1569 ++v3; | |
1570 if ( v3 < 14 ) | |
1571 continue; | |
1572 break; | |
1573 } | |
1574 return 0; | |
1575 } | |
1576 if ( !CanFitItem(uSlot, uItemID) ) | |
1577 { | |
1578 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1579 return 0; | |
1580 } | |
1581 v8 = uItemID; | |
1582 v7 = uSlot; | |
1583 return CreateItemInInventory(v7, v8); | |
1584 } | |
1585 | |
1586 //----- (00492826) -------------------------------------------------------- | |
1587 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1588 { | |
1589 unsigned int v3; // ebx@1 | |
1590 unsigned int v4; // esi@3 | |
1591 signed int v5; // edi@3 | |
1592 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1593 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1594 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1595 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1596 | |
1597 thisa = this; | |
1598 v3 = Src->uItemID; | |
1599 pItemsTable->SetSpecialBonus(Src); | |
1600 if ( uSlot == -1 ) | |
1601 { | |
1602 uSlota = 0; | |
1603 while ( 2 ) | |
1604 { | |
1605 v4 = uSlota; | |
1606 v5 = 0; | |
1607 do | |
1608 { | |
1609 if ( CanFitItem(v4, v3) ) | |
1610 { | |
1611 v8 = Src; | |
1612 v7 = v4; | |
1613 return CreateItemInInventory2(v7, v8); | |
1614 } | |
1615 ++v5; | |
1616 v4 += 14; | |
1617 } | |
1618 while ( v5 < 14 ); | |
1619 ++uSlota; | |
1620 if ( uSlota < 9 ) | |
1621 continue; | |
1622 break; | |
1623 } | |
1624 return 0; | |
1625 } | |
1626 if ( !CanFitItem(uSlot, v3) ) | |
1627 return 0; | |
1628 v8 = Src; | |
1629 v7 = uSlot; | |
1630 return CreateItemInInventory2(v7, v8); | |
1631 } | |
1632 | |
1633 //----- (0049289C) -------------------------------------------------------- | |
1634 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1635 { | |
1636 signed int v3; // ebx@1 | |
1637 ItemGen *v4; // eax@1 | |
1638 int result; // eax@6 | |
973 | 1639 //unsigned int v6; // eax@7 |
0 | 1640 Texture *v7; // esi@7 |
1641 unsigned int v8; // edx@9 | |
1642 void *v9; // esi@10 | |
1643 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1644 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1645 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1646 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1647 | |
1648 v12 = this; | |
1649 v3 = 0; | |
1650 v4 = this->pInventoryItems; | |
1651 while ( v4->uItemID ) | |
1652 { | |
1653 ++v3; | |
1654 ++v4; | |
1655 if ( v3 >= 126 ) | |
1656 { | |
1657 v3 = -1; | |
1658 break; | |
1659 } | |
1660 } | |
1661 if ( v3 == -1 ) | |
1662 { | |
1663 result = 0; | |
1664 } | |
1665 else | |
1666 { | |
973 | 1667 v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1668 v10 = GetSizeInInventorySlots(v7->uTextureWidth); | |
0 | 1669 v11 = GetSizeInInventorySlots(v7->uTextureHeight); |
1670 if ( !areWeLoadingTexture ) | |
1671 { | |
1672 v7->Release(); | |
1006 | 1673 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1674 } |
1675 v8 = uSlot; | |
1676 if ( (signed int)v11 > 0 ) | |
1677 { | |
1678 uSlota = v11; | |
1679 v9 = &v12->pInventoryIndices[v8]; | |
1680 do | |
1681 { | |
1682 if ( (signed int)v10 > 0 ) | |
1683 memset32(v9, -1 - v8, v10); | |
1684 v9 = (char *)v9 + 56; | |
1685 --uSlota; | |
1686 } | |
1687 while ( uSlota ); | |
1688 } | |
1689 v12->pInventoryIndices[v8] = v3 + 1; | |
1690 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1691 result = v3 + 1; | |
1692 } | |
1693 return result; | |
1694 } | |
1695 // 506128: using guessed type int areWeLoadingTexture; | |
1696 | |
1697 //----- (0049298B) -------------------------------------------------------- | |
1698 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1699 { | |
973 | 1700 //Player *v4; // ebx@1 |
1701 //unsigned int v5; // eax@1 | |
0 | 1702 Texture *v6; // esi@1 |
1703 void *v7; // esi@4 | |
1704 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1705 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1706 | |
973 | 1707 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1708 v9 = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1709 a2a = GetSizeInInventorySlots(v6->uTextureHeight); |
1710 if ( !areWeLoadingTexture ) | |
1711 { | |
1712 v6->Release(); | |
1006 | 1713 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1714 } |
1715 if ( (signed int)a2a > 0 ) | |
1716 { | |
973 | 1717 v7 = &pInventoryIndices[a4]; |
0 | 1718 do |
1719 { | |
1720 if ( (signed int)v9 > 0 ) | |
1721 memset32(v7, -1 - a4, v9); | |
1722 v7 = (char *)v7 + 56; | |
1723 --a2a; | |
1724 } | |
1725 while ( a2a ); | |
1726 } | |
973 | 1727 pInventoryIndices[a4] = a3 + 1; |
0 | 1728 return 1; |
1729 } | |
278 | 1730 |
0 | 1731 // 506128: using guessed type int areWeLoadingTexture; |
1732 | |
1733 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1734 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1735 { | |
0 | 1736 int *pIndices; // edi@1 |
1737 ItemGen *v3; // ecx@1 | |
1738 unsigned int v4; // esi@1 | |
973 | 1739 //unsigned int v5; // eax@1 |
0 | 1740 Texture *v6; // esi@1 |
1741 unsigned int result; // eax@1 | |
1742 unsigned int v8; // ebp@1 | |
1743 void *v9; // edx@4 | |
1744 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1745 | |
1746 pIndices = &this->pInventoryIndices[uSlot]; | |
232 | 1747 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1748 v4 = v3->uItemID; |
1749 v3->Reset(); | |
973 | 1750 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); |
1751 uSlota = GetSizeInInventorySlots(v6->uTextureWidth); | |
0 | 1752 result = GetSizeInInventorySlots(v6->uTextureHeight); |
1753 v8 = result; | |
1754 if ( !areWeLoadingTexture ) | |
1755 { | |
1756 v6->Release(); | |
1006 | 1757 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1758 } |
1759 if ( (signed int)v8 > 0 ) | |
1760 { | |
1761 v9 = pIndices; | |
1762 do | |
1763 { | |
1764 if ( (signed int)uSlota > 0 ) | |
1765 { | |
1766 result = 0; | |
1767 memset(v9, 0, 4 * uSlota); | |
1768 } | |
1769 v9 = (char *)v9 + 56; | |
1770 --v8; | |
1771 } | |
1772 while ( v8 ); | |
1773 } | |
1006 | 1774 |
0 | 1775 } |
1776 // 506128: using guessed type int areWeLoadingTexture; | |
1777 | |
436 | 1778 //identf |
0 | 1779 //----- (00490EEE) -------------------------------------------------------- |
917 | 1780 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1781 { | |
1782 int pSkillLevel; // eax@1 | |
1783 int NotBuy; // eax@1 | |
1784 int result; | |
1785 signed int pEquipType; // esi@1 | |
1786 float *pPriceMultiplier; // esi@26 | |
1787 int pPriceItemService; // edi@26 | |
1788 | |
1789 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1790 NotBuy = 4; | |
1791 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1792 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1793 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1794 return 5; |
917 | 1795 if ( building_type == BildingType_WeaponShop ) |
1796 { | |
1797 if ( pEquipType > EQUIP_BOW ) | |
1798 return NotBuy; | |
1799 if (pItem->Stolen()) | |
1800 return 6; | |
1801 } | |
1802 if ( building_type == BildingType_ArmorShop ) | |
1803 { | |
1804 if ( pEquipType < 3 && pEquipType > 9 ) | |
1805 return NotBuy; | |
1806 if (pItem->Stolen()) | |
1807 return 6; | |
1808 } | |
1809 if ( building_type == BildingType_MagicShop ) | |
1810 { | |
1811 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1812 { | |
1813 if (pItem->Stolen()) | |
1814 return 6; | |
1815 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1816 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1817 if ( ShopMenuType == 3 )//Sell | |
1818 { | |
1819 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1820 if (!pItem->Broken()) | |
1821 { | |
1822 if ( pSkillLevel ) | |
1823 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1824 else | |
1825 result = 1; | |
1826 return result; | |
1827 } | |
1828 pPriceItemService = 1; | |
1829 if ( pSkillLevel ) | |
1830 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1831 else | |
1832 result = 1; | |
1833 return result; | |
1834 } | |
1835 if ( ShopMenuType == 4 )//Identify | |
1836 { | |
1837 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1838 if ( pSkillLevel ) | |
1839 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1840 else | |
1841 result = 1; | |
1842 return result; | |
1843 } | |
1844 if ( ShopMenuType == 5 )//Repair | |
1845 { | |
1846 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1847 if ( pSkillLevel ) | |
1848 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1849 else | |
1850 result = 1; | |
1851 return result; | |
1852 } | |
1853 if ( ShopMenuType != 6 )//Buy and ??? | |
1854 { | |
1855 if ( pSkillLevel ) | |
1856 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1857 else | |
1858 result = 1; | |
1859 return result; | |
1860 } | |
1861 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1862 if (pItem->Broken()) | |
1863 pPriceItemService = 1; | |
1864 if ( pPriceItemService >= 1 ) | |
1865 { | |
1866 if ( pSkillLevel ) | |
1867 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1868 else | |
1869 result = 1; | |
1870 return result; | |
1871 } | |
1872 pPriceItemService = 1; | |
1873 if ( pSkillLevel ) | |
1874 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1875 else | |
1876 result = 1; | |
0 | 1877 return result; |
917 | 1878 } |
1879 if ( pEquipType != EQUIP_BOOK ) | |
1880 return NotBuy; | |
1881 } | |
1882 if ( building_type == BildingType_AlchemistShop ) | |
1883 { | |
1884 if ( pEquipType < EQUIP_REAGENT ) | |
1885 return NotBuy; | |
1886 if ( pEquipType > EQUIP_POTION ) | |
1887 { | |
1888 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1889 return NotBuy; | |
1890 } | |
1891 if (pItem->Stolen()) | |
1892 return 6; | |
1893 } | |
1894 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1895 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1896 if ( ShopMenuType == 3 )//Sell | |
1897 { | |
1898 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1899 if (!pItem->Broken()) | |
1900 { | |
1901 if ( pSkillLevel ) | |
1902 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1903 else | |
1904 result = 1; | |
0 | 1905 return result; |
917 | 1906 } |
1907 pPriceItemService = 1; | |
1908 if ( pSkillLevel ) | |
1909 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1910 else | |
1911 result = 1; | |
1912 return result; | |
1913 } | |
1914 if ( ShopMenuType == 4 )//Identify | |
1915 { | |
1916 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1917 if ( pSkillLevel ) | |
1918 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1919 else | |
1920 result = 1; | |
1921 return result; | |
1922 } | |
1923 if ( ShopMenuType == 5 )//Repair | |
1924 { | |
1925 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1926 if ( pSkillLevel ) | |
1927 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1928 else | |
1929 result = 1; | |
1930 return result; | |
1931 } | |
1932 if ( ShopMenuType != 6 )//Buy and ??? | |
1933 { | |
1934 if ( pSkillLevel ) | |
1935 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1936 else | |
1937 result = 1; | |
1938 return result; | |
1939 } | |
1940 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1941 if (pItem->Broken()) |
917 | 1942 pPriceItemService = 1; |
1943 if ( pPriceItemService >= 1 ) | |
1944 { | |
1945 if ( pSkillLevel ) | |
1946 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1947 else | |
1948 result = 1; | |
1949 return result; | |
1950 } | |
1951 pPriceItemService = 1; | |
1952 if ( pSkillLevel ) | |
1953 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1954 else |
1955 result = 1; | |
1956 return result; | |
1957 } | |
1958 | |
1959 //----- (0049107D) -------------------------------------------------------- | |
1960 int Player::GetBodybuilding() | |
1961 { | |
1010 | 1962 int v1; // al@1 |
0 | 1963 int v2; // ecx@1 |
1964 int v4; // eax@3 | |
1965 signed int v6; // [sp-4h] [bp-4h]@2 | |
1966 | |
1967 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1968 v2 = v1 & 0x3F; | |
1969 if ( v1 & 0x100 ) | |
1970 { | |
1971 v6 = 5; | |
1972 } | |
1973 else | |
1974 { | |
1008 | 1975 if ( (v1&0xFF) >= 0 ) |
0 | 1976 { |
1977 v4 = ((v1 & 0x40) != 0) + 1; | |
1978 return v2 * v4; | |
1979 } | |
1980 v6 = 3; | |
1981 } | |
1982 v4 = v6; | |
1983 return v2 * v4; | |
1984 } | |
1985 | |
1986 //----- (004910A8) -------------------------------------------------------- | |
607 | 1987 int Player::GetMeditation() |
0 | 1988 { |
1010 | 1989 int v1; // al@1 |
1008 | 1990 int base_level; // ecx@1 |
0 | 1991 int v4; // eax@3 |
1992 signed int v6; // [sp-4h] [bp-4h]@2 | |
1993 | |
1994 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1995 base_level = v1 & 0x3F; |
0 | 1996 if ( v1 & 0x100 ) |
1997 { | |
1998 v6 = 5; | |
1999 } | |
2000 else | |
2001 { | |
1008 | 2002 if ( (v1&0xFF) >= 0 ) |
0 | 2003 { |
2004 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 2005 return base_level * v4; |
0 | 2006 } |
2007 v6 = 3; | |
2008 } | |
2009 v4 = v6; | |
1008 | 2010 return base_level * v4; |
0 | 2011 } |
2012 | |
2013 //----- (004910D3) -------------------------------------------------------- | |
2014 int Player::CanIdentify(ItemGen *pItem) | |
2015 { | |
2016 unsigned __int16 v2; // ax@1 | |
2017 unsigned __int16 v3; // bx@1 | |
2018 int uSkillMult; // eax@3 | |
2019 int v5; // edi@7 | |
2020 signed int v6; // ebp@7 | |
2021 char *v7; // esi@7 | |
2022 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 2023 |
2024 if (CheckHiredNPCSpeciality(Scholar)) | |
2025 return true; | |
0 | 2026 |
179 | 2027 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 2028 v3 = v2; |
179 | 2029 if ( v2 & 1 ) |
0 | 2030 { |
2031 uSkillMultiplier = 5; | |
2032 } | |
2033 else | |
2034 { | |
2035 if ( (v2 & 0x80u) == 0 ) | |
2036 { | |
2037 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 2038 v5 = uSkillMult * (v3 & 0x3F); |
2039 v6 = 0; | |
2040 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2041 |
179 | 2042 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2043 v6 = 1; | |
2044 if ( v5 >= (unsigned __int8)v7[46] ) | |
2045 v6 = 1; | |
2046 return v6; | |
0 | 2047 } |
2048 uSkillMultiplier = 3; | |
2049 } | |
2050 uSkillMult = uSkillMultiplier; | |
2051 v5 = uSkillMult * (v3 & 0x3F); | |
2052 v6 = 0; | |
2053 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2054 |
0 | 2055 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2056 v6 = 1; | |
2057 if ( v5 >= (unsigned __int8)v7[46] ) | |
2058 v6 = 1; | |
2059 return v6; | |
2060 } | |
2061 | |
2062 //----- (00491151) -------------------------------------------------------- | |
2063 int Player::CanRepair(ItemGen *a2) | |
2064 { | |
2065 unsigned __int16 v2; // ax@1 | |
2066 unsigned __int16 v3; // bx@1 | |
2067 int v4; // eax@3 | |
2068 int v5; // edi@7 | |
2069 signed int v6; // ebp@7 | |
2070 char v8; // al@10 | |
2071 signed int v10; // [sp-4h] [bp-14h]@2 | |
2072 | |
652 | 2073 |
2074 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2075 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2076 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2077 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2078 return true; | |
2079 | |
1010 | 2080 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 2081 v3 = v2; |
1010 | 2082 if (v2 & 0x100 ) |
0 | 2083 { |
2084 v10 = 5; | |
2085 } | |
2086 else | |
2087 { | |
2088 if ( (v2 & 0x80u) == 0 ) | |
2089 { | |
2090 v4 = ((v2 & 0x40) != 0) + 1; | |
2091 goto LABEL_7; | |
2092 } | |
2093 v10 = 3; | |
2094 } | |
2095 v4 = v10; | |
2096 LABEL_7: | |
2097 v5 = v4 * (v3 & 0x3F); | |
2098 v6 = 0; | |
2099 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2100 return true; | |
2101 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2102 { | |
2103 __debugbreak(); // really odd | |
2104 return true; | |
2105 } | |
2106 return false; | |
2107 } | |
2108 | |
2109 //----- (004911F3) -------------------------------------------------------- | |
2110 int Player::GetMerchant() | |
2111 { | |
2112 Player *v1; // edi@1 | |
2113 unsigned __int16 v2; // ax@1 | |
2114 unsigned __int16 v3; // bx@1 | |
2115 int v4; // esi@1 | |
2116 int v5; // edi@1 | |
2117 int v7; // eax@3 | |
2118 int v8; // ecx@7 | |
2119 signed int v9; // [sp-4h] [bp-10h]@6 | |
2120 | |
2121 v1 = this; | |
607 | 2122 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2123 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2124 v4 = v2 & 0x003F; |
1010 | 2125 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2126 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2127 return 10000; | |
2128 v7 = GetPartyReputation(); | |
2129 if ( !v4 ) | |
2130 return -v7; | |
1010 | 2131 if ( v3 & 0x100 ) |
0 | 2132 { |
2133 v9 = 5; | |
2134 } | |
2135 else | |
2136 { | |
2137 if ( (v3 & 0x80u) == 0 ) | |
2138 { | |
2139 v8 = ((v3 & 0x40) != 0) + 1; | |
2140 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2141 } | |
2142 v9 = 3; | |
2143 } | |
2144 v8 = v9; | |
2145 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2146 } | |
2147 | |
2148 //----- (0049125A) -------------------------------------------------------- | |
2149 int Player::GetPerception() | |
2150 { | |
2151 Player *v1; // edi@1 | |
2152 unsigned __int16 v2; // ax@1 | |
2153 unsigned __int16 v3; // bx@1 | |
2154 int v4; // esi@1 | |
2155 int v5; // edi@1 | |
2156 int v7; // eax@5 | |
2157 signed int v8; // [sp-4h] [bp-10h]@4 | |
2158 | |
2159 v1 = this; | |
1010 | 2160 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2161 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2162 v4 = v2 & 0x3F; |
1010 | 2163 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2164 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2165 return 10000; | |
1010 | 2166 if ( v3 & 0x100 ) |
0 | 2167 { |
2168 v8 = 5; | |
2169 } | |
2170 else | |
2171 { | |
2172 if ( (v3 & 0x80u) == 0 ) | |
2173 { | |
2174 v7 = ((v3 & 0x40) != 0) + 1; | |
2175 return v4 + v5 * (v7 - 1); | |
2176 } | |
2177 v8 = 3; | |
2178 } | |
2179 v7 = v8; | |
2180 return v4 + v5 * (v7 - 1); | |
2181 } | |
2182 | |
2183 //----- (004912B0) -------------------------------------------------------- | |
2184 int Player::GetDisarmTrap() | |
2185 { | |
2186 Player *v1; // ebp@1 | |
2187 unsigned __int16 v2; // ax@1 | |
2188 unsigned __int16 v3; // bx@1 | |
2189 int v4; // esi@1 | |
2190 int v5; // edi@1 | |
2191 int v7; // eax@7 | |
2192 signed int v8; // [sp-4h] [bp-14h]@6 | |
2193 | |
2194 v1 = this; | |
1010 | 2195 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2196 v3 = v1->pActiveSkills[29]; |
2197 v4 = v2 & 0x3F; | |
2198 v5 = v1->pActiveSkills[29] & 0x3F; | |
2199 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2200 return 10000; | |
2201 if ( HasEnchantedItemEquipped(35) ) | |
2202 v4 *= 2; | |
1010 | 2203 if ( v3 & 0x100 ) |
0 | 2204 { |
2205 v8 = 5; | |
2206 } | |
2207 else | |
2208 { | |
2209 if ( (v3 & 0x80u) == 0 ) | |
2210 { | |
2211 v7 = ((v3 & 0x40) != 0) + 1; | |
2212 return v4 + v5 * (v7 - 1); | |
2213 } | |
2214 v8 = 3; | |
2215 } | |
2216 v7 = v8; | |
2217 return v4 + v5 * (v7 - 1); | |
2218 } | |
2219 | |
2220 //----- (00491317) -------------------------------------------------------- | |
2221 char Player::GetLearningPercent() | |
2222 { | |
2223 Player *v1; // esi@1 | |
2224 int v2; // eax@1 | |
2225 unsigned __int16 v3; // bx@1 | |
2226 int v4; // ecx@1 | |
2227 int v5; // eax@4 | |
2228 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2229 | |
2230 v1 = this; | |
1010 | 2231 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2232 v3 = v1->pActiveSkills[36]; |
2233 v4 = v2 & 0x3F; | |
2234 if ( v2 ) | |
2235 { | |
1010 | 2236 if (v3 & 0x100 ) |
0 | 2237 { |
2238 v7 = 5; | |
2239 } | |
2240 else | |
2241 { | |
2242 if ( (v3 & 0x80u) == 0 ) | |
2243 { | |
2244 v5 = ((v3 & 0x40) != 0) + 1; | |
2245 goto LABEL_8; | |
2246 } | |
2247 v7 = 3; | |
2248 } | |
2249 v5 = v7; | |
2250 LABEL_8: | |
2251 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2252 } | |
2253 return v2; | |
2254 } | |
2255 | |
2256 //----- (0048C6AF) -------------------------------------------------------- | |
2257 Player::Player() | |
2258 { | |
2259 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2260 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2261 for (uint i = 0; i < 126; ++i) | |
2262 pInventoryItems[i].Reset(); | |
2263 for (uint i = 0; i < 12; ++i) | |
2264 pEquippedItems[i].Reset(); | |
2265 | |
2266 | |
2267 for (uint i = 0; i < 24; ++i) | |
2268 { | |
2269 pPlayerBuffs[i].uSkill = 0; | |
2270 pPlayerBuffs[i].uSkill = 0; | |
2271 pPlayerBuffs[i].uPower = 0; | |
2272 pPlayerBuffs[i].uExpireTime = 0; | |
2273 pPlayerBuffs[i].uCaster = 0; | |
2274 pPlayerBuffs[i].uFlags = 0; | |
2275 } | |
2276 | |
2277 pName[0] = 0; | |
2278 uFace = 0; | |
2279 uVoiceID = 0; | |
2280 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2281 | |
2282 field_BB = 0; | |
2283 | |
2284 uMight = uMightBonus = 0; | |
2285 uIntelligence = uIntelligenceBonus = 0; | |
2286 uWillpower = uWillpowerBonus = 0; | |
2287 uEndurance = uEnduranceBonus = 0; | |
2288 uSpeed = uSpeedBonus = 0; | |
2289 uAccuracy = uAccuracyBonus = 0; | |
2290 uLuck = uLuckBonus = 0; | |
2291 uLevel = sLevelModifier = 0; | |
2292 sAgeModifier = 0; | |
2293 | |
2294 memset(field_1F5, 0, 30); | |
2295 | |
2296 sResFireBase = sResFireBonus = 0; | |
2297 sResAirBase = sResAirBonus = 0; | |
2298 sResWaterBase = sResWaterBonus = 0; | |
2299 sResEarthBase = sResEarthBonus = 0; | |
2300 sResMagicBase = sResMagicBonus = 0; | |
2301 sResSpiritBase = sResSpiritBonus = 0; | |
2302 sResMindBase = sResMindBonus = 0; | |
2303 sResBodyBase = sResBodyBonus = 0; | |
2304 sResLightBase = sResLightBonus = 0; | |
2305 sResDarkBase = sResDarkBonus = 0; | |
2306 | |
2307 uTimeToRecovery = 0; | |
2308 | |
2309 uSkillPoints = 0; | |
2310 | |
2311 sHealth = 0; | |
2312 uFullHealthBonus = 0; | |
2313 _health_related = 0; | |
2314 | |
2315 sMana = 0; | |
2316 uFullManaBonus = 0; | |
2317 _mana_related = 0; | |
2318 | |
2319 uQuickSpell = 0; | |
2320 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2321 | |
2322 _some_attack_bonus = 0; | |
2323 field_1A91 = 0; | |
2324 _melee_dmg_bonus = 0; | |
2325 field_1A93 = 0; | |
2326 _ranged_atk_bonus = 0; | |
2327 field_1A95 = 0; | |
2328 _ranged_dmg_bonus = 0; | |
2329 field_1A97 = 0; | |
2330 | |
130 | 2331 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2332 uExpressionTimePassed = 0; |
2333 uExpressionTimeLength = 0; | |
2334 | |
2335 uNumDivineInterventionCastsThisDay = 0; | |
2336 uNumArmageddonCasts = 0; | |
2337 uNumFireSpikeCasts = 0; | |
2338 | |
2339 memset(field_1988, 0, 49 * sizeof(int)); | |
2340 memset(field_1A50, 0, 64 * sizeof(char)); | |
2341 | |
2342 field_E0 = 0; | |
2343 field_E4 = 0; | |
2344 field_E8 = 0; | |
2345 field_EC = 0; | |
2346 field_F0 = 0; | |
2347 field_F4 = 0; | |
2348 field_F8 = 0; | |
2349 field_FC = 0; | |
2350 field_100 = 0; | |
2351 field_104 = 0; | |
198 | 2352 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2353 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2354 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2355 |
198 | 2356 lastOpenedSpellbookPage = 0; |
0 | 2357 } |
2358 | |
2359 //----- (0048C6F6) -------------------------------------------------------- | |
2360 bool Party::AddItem(ItemGen *pItem) | |
2361 { | |
2362 unsigned int v2; // eax@1 | |
2363 unsigned int v3; // ecx@4 | |
2364 signed int v4; // edx@4 | |
2365 char *v5; // eax@8 | |
973 | 2366 //unsigned int v6; // eax@10 |
0 | 2367 Texture *v7; // ebx@10 |
2368 signed int v8; // esi@10 | |
2369 Player *v9; // edi@11 | |
2370 int v10; // eax@11 | |
2371 bool result; // eax@15 | |
2372 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2373 |
2374 | |
188 | 2375 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2376 //int v16; // [sp+10h] [bp-18h]@3 | |
2377 //int v17; // [sp+14h] [bp-14h]@3 | |
2378 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2379 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2380 Party *v20; // [sp+20h] [bp-8h]@1 | |
2381 int v21; // [sp+24h] [bp-4h]@10 | |
2382 | |
2383 auto thos = this; | |
2384 | |
2385 v20 = thos; | |
2386 v2 = pItem->uItemID; | |
222 | 2387 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2388 pItem->SetIdentified(); |
188 | 2389 ///v15 = 0; |
2390 //v16 = 1; | |
2391 //v18 = 3; | |
2392 //v17 = 2; | |
0 | 2393 if ( uActiveCharacter ) |
2394 { | |
2395 v3 = uActiveCharacter - 1; | |
2396 v4 = 0; | |
2397 do | |
2398 { | |
188 | 2399 v15[v4++] = v3++; |
0 | 2400 if ( (signed int)v3 >= 4 ) |
2401 v3 = 0; | |
2402 } | |
2403 while ( v4 < 4 ); | |
2404 } | |
2405 v5 = pItemsTable->pItems[v2].pIconName; | |
2406 if ( v5 ) | |
2407 { | |
973 | 2408 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2409 v21 = areWeLoadingTexture; |
2410 v8 = 0; | |
2411 while ( 1 ) | |
2412 { | |
188 | 2413 v9 = &v20->pPlayers[v15[v8]]; |
2414 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2415 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2416 if ( v10 ) | |
2417 break; | |
2418 ++v8; | |
2419 if ( v8 >= 4 ) | |
2420 { | |
2421 if ( !v21 ) | |
2422 { | |
2423 v7->Release(); | |
1006 | 2424 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2425 } |
2426 goto LABEL_15; | |
2427 } | |
2428 } | |
232 | 2429 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2430 pItem->Reset(); |
2431 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2432 v19->PlaySound(SPEECH_60, 0); |
0 | 2433 if ( !v21 ) |
2434 { | |
2435 v7->Release(); | |
1006 | 2436 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2437 } |
2438 result = 1; | |
2439 } | |
2440 else | |
2441 { | |
2442 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2443 LABEL_15: | |
2444 result = 0; | |
2445 } | |
2446 return result; | |
2447 } | |
2448 // 506128: using guessed type int areWeLoadingTexture; | |
2449 | |
2450 //----- (0048C855) -------------------------------------------------------- | |
2451 int Player::GetBaseStrength() | |
2452 { | |
2453 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2454 } | |
2455 | |
2456 //----- (0048C86C) -------------------------------------------------------- | |
2457 int Player::GetBaseIntelligence() | |
2458 { | |
2459 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2460 } | |
2461 | |
2462 //----- (0048C883) -------------------------------------------------------- | |
2463 int Player::GetBaseWillpower() | |
2464 { | |
2465 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2466 } | |
2467 | |
2468 //----- (0048C89A) -------------------------------------------------------- | |
2469 int Player::GetBaseEndurance() | |
2470 { | |
2471 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2472 } | |
2473 | |
2474 //----- (0048C8B1) -------------------------------------------------------- | |
2475 int Player::GetBaseAccuracy() | |
2476 { | |
2477 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2478 } | |
2479 | |
2480 //----- (0048C8C8) -------------------------------------------------------- | |
2481 int Player::GetBaseSpeed() | |
2482 { | |
2483 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2484 } | |
2485 | |
2486 //----- (0048C8DF) -------------------------------------------------------- | |
2487 int Player::GetBaseLuck() | |
2488 { | |
2489 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2490 } | |
2491 | |
2492 //----- (0048C8F6) -------------------------------------------------------- | |
2493 int Player::GetBaseLevel() | |
2494 { | |
2495 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2496 } | |
2497 | |
2498 //----- (0048C90D) -------------------------------------------------------- | |
2499 int Player::GetActualLevel() | |
2500 { | |
2501 return uLevel + sLevelModifier + | |
2502 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2503 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2504 } | |
2505 | |
2506 //----- (0048C93C) -------------------------------------------------------- | |
2507 int Player::GetActualMight() | |
2508 { | |
2509 Player *v1; // esi@1 | |
2510 unsigned int v2; // eax@1 | |
2511 signed int v3; // ecx@1 | |
2512 signed int v4; // ebx@4 | |
2513 int v5; // edi@5 | |
2514 int v6; // ST14_4@5 | |
2515 | |
2516 v1 = this; | |
2517 v2 = this->sAgeModifier + GetBaseAge(); | |
2518 v3 = 0; | |
2519 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2520 { | |
2521 ++v3; | |
2522 if ( v3 >= 4 ) | |
2523 { | |
2524 v4 = 100; | |
2525 goto LABEL_5; | |
2526 } | |
2527 } | |
2528 v4 = pAgeingStrengthMultiplier[v3]; | |
2529 LABEL_5: | |
2530 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2531 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2532 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2533 } | |
2534 | |
2535 //----- (0048C9C2) -------------------------------------------------------- | |
2536 int Player::GetActualIntelligence() | |
2537 { | |
2538 Player *v1; // esi@1 | |
2539 unsigned int sAge; // eax@1 | |
2540 signed int uAgeLevel; // ecx@1 | |
2541 signed int v4; // ebx@4 | |
2542 int v5; // edi@5 | |
2543 int v6; // ebp@5 | |
2544 | |
2545 v1 = this; | |
2546 sAge = this->sAgeModifier + GetBaseAge(); | |
2547 uAgeLevel = 0; | |
2548 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2549 { | |
2550 ++uAgeLevel; | |
2551 if ( uAgeLevel >= 4 ) | |
2552 { | |
2553 v4 = 100; | |
2554 goto LABEL_5; | |
2555 } | |
2556 } | |
2557 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2558 LABEL_5: | |
2559 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2560 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2561 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2562 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2563 + v6 | |
2564 + v1->uIntelligenceBonus; | |
2565 } | |
2566 | |
2567 //----- (0048CA3F) -------------------------------------------------------- | |
2568 int Player::GetActualWillpower() | |
2569 { | |
2570 int v5; // edi@5 | |
2571 | |
2572 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2573 uint uAgeingMultiplier = 100; | |
2574 for (uint i = 0; i < 4; ++i) | |
2575 if (uActualAge >= pAgeingTable[i]) | |
2576 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2577 else break; | |
2578 | |
2579 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2580 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2581 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2582 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2583 + uWillpowerBonus; | |
2584 } | |
2585 | |
2586 //----- (0048CABC) -------------------------------------------------------- | |
2587 int Player::GetActualEndurance() | |
2588 { | |
2589 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2590 uint uAgeingMultiplier = 100; | |
2591 for (uint i = 0; i < 4; ++i) | |
2592 if (uActualAge >= pAgeingTable[i]) | |
2593 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2594 else break; | |
2595 | |
2596 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2597 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2598 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2599 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2600 + uItemBonus | |
2601 + uEnduranceBonus; | |
2602 } | |
2603 | |
2604 //----- (0048CB39) -------------------------------------------------------- | |
2605 int Player::GetActualAccuracy() | |
2606 { | |
2607 Player *v1; // esi@1 | |
2608 unsigned int v2; // eax@1 | |
2609 signed int v3; // ecx@1 | |
2610 signed int v4; // ebx@4 | |
2611 int v5; // edi@5 | |
2612 int v6; // ebp@5 | |
2613 | |
2614 v1 = this; | |
2615 v2 = this->sAgeModifier + GetBaseAge(); | |
2616 v3 = 0; | |
2617 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2618 { | |
2619 ++v3; | |
2620 if ( v3 >= 4 ) | |
2621 { | |
2622 v4 = 100; | |
2623 goto LABEL_5; | |
2624 } | |
2625 } | |
2626 v4 = pAgeingAccuracyMultiplier[v3]; | |
2627 LABEL_5: | |
2628 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2629 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2630 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2631 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2632 + v6 | |
2633 + v1->uAccuracyBonus; | |
2634 } | |
2635 | |
2636 //----- (0048CBB6) -------------------------------------------------------- | |
2637 int Player::GetActualSpeed() | |
2638 { | |
2639 Player *v1; // esi@1 | |
2640 unsigned int v2; // eax@1 | |
2641 signed int v3; // ecx@1 | |
2642 signed int v4; // ebx@4 | |
2643 int v5; // edi@5 | |
2644 int v6; // ebp@5 | |
2645 | |
2646 v1 = this; | |
2647 v2 = this->sAgeModifier + GetBaseAge(); | |
2648 v3 = 0; | |
2649 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2650 { | |
2651 ++v3; | |
2652 if ( v3 >= 4 ) | |
2653 { | |
2654 v4 = 100; | |
2655 goto LABEL_5; | |
2656 } | |
2657 } | |
2658 v4 = pAgeingSpeedMultiplier[v3]; | |
2659 LABEL_5: | |
2660 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2661 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2662 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2663 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2664 + v6 | |
2665 + v1->uSpeedBonus; | |
2666 } | |
2667 | |
2668 //----- (0048CC33) -------------------------------------------------------- | |
2669 int Player::GetActualLuck() | |
2670 { | |
2671 Player *v1; // esi@1 | |
2672 unsigned int v2; // eax@7 | |
2673 signed int v3; // ecx@7 | |
2674 signed int v4; // ebx@10 | |
2675 int v5; // edi@11 | |
2676 int v6; // ebp@11 | |
2677 signed int v8; // [sp+10h] [bp-4h]@1 | |
2678 | |
2679 v8 = 0; | |
2680 v1 = this; | |
652 | 2681 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2682 v8 = 5; |
652 | 2683 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2684 v8 += 20; |
652 | 2685 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2686 v8 += 10; |
2687 v2 = v1->sAgeModifier + GetBaseAge(); | |
2688 v3 = 0; | |
2689 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2690 { | |
2691 ++v3; | |
2692 if ( v3 >= 4 ) | |
2693 { | |
2694 v4 = 100; | |
2695 goto LABEL_11; | |
2696 } | |
2697 } | |
2698 v4 = pAgeingLuckMultiplier[v3]; | |
2699 LABEL_11: | |
2700 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2701 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2702 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2703 + v6 | |
2704 + v8 | |
2705 + v5 * v4 * v1->uLuck / 100 / 100 | |
2706 + v1->uLuckBonus; | |
2707 } | |
2708 | |
2709 //----- (0048CCF5) -------------------------------------------------------- | |
2710 int Player::GetActualAttack(int a2) | |
2711 { | |
2712 Player *v2; // esi@1 | |
2713 int v3; // eax@1 | |
2714 int v4; // edi@1 | |
2715 int v5; // ebx@1 | |
2716 int v6; // ebp@1 | |
2717 | |
2718 v2 = this; | |
2719 v3 = GetActualAccuracy(); | |
2720 v4 = _48EA1B_get_static_effect(v3); | |
2721 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2722 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2723 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2724 } | |
2725 | |
2726 //----- (0048CD45) -------------------------------------------------------- | |
2727 int Player::GetMeleeDamageMinimal() | |
2728 { | |
2729 Player *v1; // edi@1 | |
2730 int v2; // eax@1 | |
2731 int v3; // esi@1 | |
2732 int v4; // esi@1 | |
2733 int v5; // esi@1 | |
2734 int v6; // esi@1 | |
2735 signed int result; // eax@1 | |
2736 | |
2737 v1 = this; | |
2738 v2 = GetActualMight(); | |
2739 v3 = _48EA1B_get_static_effect(v2); | |
2740 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2741 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2742 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2743 result = 1; | |
2744 if ( v6 >= 1 ) | |
2745 result = v6; | |
2746 return result; | |
2747 } | |
2748 | |
2749 //----- (0048CD90) -------------------------------------------------------- | |
2750 int Player::GetMeleeDamageMaximal() | |
2751 { | |
2752 Player *v1; // edi@1 | |
2753 int v2; // eax@1 | |
2754 int v3; // esi@1 | |
2755 int v4; // esi@1 | |
2756 int v5; // esi@1 | |
2757 int v6; // esi@1 | |
2758 signed int result; // eax@1 | |
2759 | |
2760 v1 = this; | |
2761 v2 = GetActualMight(); | |
2762 v3 = _48EA1B_get_static_effect(v2); | |
2763 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2764 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2765 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2766 result = 1; | |
2767 if ( v6 >= 1 ) | |
2768 result = v6; | |
2769 return result; | |
2770 } | |
2771 | |
2772 //----- (0048CDDB) -------------------------------------------------------- | |
2773 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2774 { | |
2775 int v4; // esi@1 | |
2776 Player *v5; // edi@1 | |
2777 ItemGen *v6; // ebx@4 | |
2778 unsigned int v7; // ebp@4 | |
2779 unsigned int v8; // esi@4 | |
2780 int v9; // eax@4 | |
2781 int v10; // eax@9 | |
2782 char v11; // zf@9 | |
2783 int v12; // esi@10 | |
2784 int v13; // eax@11 | |
2785 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2786 ItemGen *v15; // ebx@35 | |
2787 unsigned int v16; // ebp@35 | |
2788 unsigned int v17; // esi@35 | |
2789 int v18; // edx@38 | |
2790 int v19; // eax@40 | |
2791 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2792 int v21; // esi@62 | |
2793 int v22; // eax@63 | |
2794 int v23; // ebx@63 | |
2795 int v24; // ebx@63 | |
2796 signed int result; // eax@64 | |
2797 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2798 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2799 int v28; // [sp+10h] [bp-10h]@1 | |
2800 int v29; // [sp+10h] [bp-10h]@33 | |
2801 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2802 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2803 int v32; // [sp+18h] [bp-8h]@1 | |
2804 int v33; // [sp+18h] [bp-8h]@8 | |
2805 int v34; // [sp+1Ch] [bp-4h]@1 | |
2806 int v35; // [sp+28h] [bp+8h]@37 | |
2807 | |
2808 v4 = 0; | |
2809 v5 = this; | |
2810 v34 = 0; | |
2811 v32 = 0; | |
2812 v28 = 0; | |
2813 if ( IsUnarmed() == 1 ) | |
2814 { | |
2815 v32 = rand() % 3 + 1; | |
2816 LABEL_61: | |
2817 v34 = v4; | |
2818 goto LABEL_62; | |
2819 } | |
816 | 2820 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2821 { |
232 | 2822 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2823 v7 = v6->uItemID; |
2824 v8 = v6->uItemID; | |
2825 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2826 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2827 ++v9; |
2828 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2829 if ( v9 > 0 ) | |
2830 { | |
2831 v33 = v9; | |
2832 do | |
2833 { | |
2834 v10 = rand(); | |
2835 v11 = v33-- == 1; | |
2836 v28 += v10 % v30 + 1; | |
2837 } | |
2838 while ( !v11 ); | |
2839 } | |
2840 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2841 if ( !uTargetActorID ) | |
2842 goto LABEL_28; | |
377 | 2843 v13 = v6->uSpecEnchantmentType; |
0 | 2844 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2845 { | |
2846 v14 = (MONSTER_SUPERTYPE)1; | |
2847 } | |
2848 else | |
2849 { | |
2850 if ( v13 == 39 ) | |
2851 { | |
2852 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2853 } | |
2854 else | |
2855 { | |
2856 if ( v13 == 40 ) | |
2857 { | |
2858 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2859 } | |
2860 else | |
2861 { | |
2862 if ( v13 == 63 || v7 == 517 ) | |
2863 { | |
2864 v26 = MONSTER_SUPERTYPE_ELF; | |
2865 } | |
2866 else | |
2867 { | |
2868 if ( v13 != 65 ) | |
2869 { | |
2870 LABEL_28: | |
2871 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2872 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2873 && rand() % 100 < 10 ) | |
2874 v12 *= 3; | |
2875 v32 = v12; | |
2876 goto LABEL_33; | |
2877 } | |
2878 v26 = MONSTER_SUPERTYPE_TITAN; | |
2879 } | |
2880 } | |
2881 } | |
2882 v14 = v26; | |
2883 } | |
2884 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2885 v12 *= 2; | |
2886 goto LABEL_28; | |
2887 } | |
2888 LABEL_33: | |
2889 v29 = 0; | |
2890 if ( !a3 ) | |
2891 { | |
2892 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2893 { | |
898 | 2894 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2895 v16 = v15->uItemID; |
2896 v17 = v15->uItemID; | |
2897 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2898 { | |
2899 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2900 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2901 { | |
2902 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2903 do | |
2904 { | |
2905 v18 = rand() % v31; | |
2906 v11 = v35-- == 1; | |
2907 v29 += v18 + 1; | |
2908 } | |
2909 while ( !v11 ); | |
2910 } | |
2911 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2912 if ( !uTargetActorID ) | |
2913 goto LABEL_57; | |
377 | 2914 v19 = v15->uSpecEnchantmentType; |
0 | 2915 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2916 { | |
2917 v20 = (MONSTER_SUPERTYPE)1; | |
2918 } | |
2919 else | |
2920 { | |
2921 if ( v19 == 39 ) | |
2922 { | |
2923 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2924 } | |
2925 else | |
2926 { | |
2927 if ( v19 == 40 ) | |
2928 { | |
2929 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2930 } | |
2931 else | |
2932 { | |
2933 if ( v19 == 63 || v16 == 517 ) | |
2934 { | |
2935 v27 = MONSTER_SUPERTYPE_ELF; | |
2936 } | |
2937 else | |
2938 { | |
2939 if ( v19 != 65 ) | |
2940 { | |
2941 LABEL_57: | |
2942 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2943 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2944 && rand() % 100 < 10 ) | |
2945 v4 *= 3; | |
2946 goto LABEL_61; | |
2947 } | |
2948 v27 = MONSTER_SUPERTYPE_TITAN; | |
2949 } | |
2950 } | |
2951 } | |
2952 v20 = v27; | |
2953 } | |
2954 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2955 v4 *= 2; | |
2956 goto LABEL_57; | |
2957 } | |
2958 } | |
2959 } | |
2960 LABEL_62: | |
2961 v21 = v32 + v34; | |
2962 if ( !a2 ) | |
2963 { | |
2964 v22 = GetActualMight(); | |
2965 v23 = _48EA1B_get_static_effect(v22); | |
2966 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2967 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2968 } | |
2969 result = 1; | |
2970 if ( v21 >= 1 ) | |
2971 result = v21; | |
2972 return result; | |
2973 } | |
2974 | |
2975 //----- (0048D0B9) -------------------------------------------------------- | |
2976 int Player::GetRangedAttack() | |
2977 { | |
2978 Player *v1; // esi@1 | |
2979 int v2; // eax@1 | |
2980 int v3; // edi@3 | |
2981 int v4; // eax@4 | |
2982 int v5; // edi@4 | |
2983 int v6; // edi@4 | |
2984 int v7; // edi@4 | |
2985 | |
2986 v1 = this; | |
232 | 2987 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2988 if ( v2 < 64 || v2 > 65 ) |
2989 { | |
2990 v4 = GetActualAccuracy(); | |
2991 v5 = _48EA1B_get_static_effect(v4); | |
2992 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2993 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2994 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2995 } | |
2996 else | |
2997 { | |
2998 v3 = GetActualAttack(1); | |
2999 } | |
3000 return v3; | |
3001 } | |
3002 | |
3003 //----- (0048D124) -------------------------------------------------------- | |
3004 int Player::GetRangedDamageMin() | |
3005 { | |
3006 Player *v1; // esi@1 | |
3007 int v2; // edi@1 | |
3008 int v3; // edi@1 | |
3009 int v4; // edi@1 | |
3010 unsigned __int16 v5; // ax@1 | |
3011 int result; // eax@6 | |
3012 | |
3013 v1 = this; | |
3014 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
3015 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3016 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3017 v5 = v1->pActiveSkills[5]; | |
3018 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3019 v4 += v1->pActiveSkills[5] & 0x3F; | |
3020 if ( v4 >= 1 ) | |
3021 result = v4; | |
3022 else | |
3023 result = 0; | |
3024 return result; | |
3025 } | |
3026 | |
3027 //----- (0048D191) -------------------------------------------------------- | |
3028 int Player::GetRangedDamageMax() | |
3029 { | |
3030 Player *v1; // esi@1 | |
3031 int v2; // edi@1 | |
3032 int v3; // edi@1 | |
3033 int v4; // edi@1 | |
3034 unsigned __int16 v5; // ax@1 | |
3035 int result; // eax@6 | |
3036 | |
3037 v1 = this; | |
3038 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
3039 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3040 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3041 v5 = v1->pActiveSkills[5]; | |
3042 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3043 v4 += v1->pActiveSkills[5] & 0x3F; | |
3044 if ( v4 >= 1 ) | |
3045 result = v4; | |
3046 else | |
3047 result = 0; | |
3048 return result; | |
3049 } | |
3050 | |
3051 //----- (0048D1FE) -------------------------------------------------------- | |
3052 bool Player::CalculateRangedDamageTo(int a2) | |
3053 { | |
3054 Player *v2; // ebx@1 | |
3055 bool result; // eax@1 | |
3056 ItemGen *v4; // ebx@2 | |
3057 unsigned int v5; // edi@2 | |
3058 unsigned int v6; // esi@2 | |
3059 int v7; // edx@4 | |
3060 char v8; // zf@4 | |
3061 int v9; // esi@5 | |
3062 int v10; // ebx@6 | |
3063 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3064 unsigned __int16 v12; // ax@19 | |
3065 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3066 Player *v14; // [sp+4h] [bp-10h]@1 | |
3067 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3068 int v16; // [sp+Ch] [bp-8h]@3 | |
3069 int v17; // [sp+10h] [bp-4h]@1 | |
3070 | |
3071 v17 = 0; | |
3072 v2 = this; | |
3073 v14 = this; | |
3074 result = HasItemEquipped(EQUIP_BOW); | |
3075 if ( !result ) | |
3076 return result; | |
232 | 3077 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3078 v5 = v4->uItemID; |
3079 v6 = v4->uItemID; | |
3080 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3081 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3082 { | |
3083 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3084 do | |
3085 { | |
3086 v7 = rand() % v15; | |
3087 v8 = v16-- == 1; | |
3088 v17 += v7 + 1; | |
3089 } | |
3090 while ( !v8 ); | |
3091 } | |
3092 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3093 if ( a2 ) | |
3094 { | |
377 | 3095 v10 = v4->uSpecEnchantmentType; |
0 | 3096 if ( v10 == 64 ) |
3097 { | |
3098 v11 = (MONSTER_SUPERTYPE)1; | |
3099 goto LABEL_17; | |
3100 } | |
3101 if ( v10 == 39 || v5 == 508 ) | |
3102 { | |
3103 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3104 goto LABEL_16; | |
3105 } | |
3106 if ( v10 == 40 ) | |
3107 { | |
3108 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3109 goto LABEL_16; | |
3110 } | |
3111 if ( v10 == 63 || v5 == 517 ) | |
3112 { | |
3113 v13 = MONSTER_SUPERTYPE_ELF; | |
3114 LABEL_16: | |
3115 v11 = v13; | |
3116 LABEL_17: | |
3117 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3118 v9 *= 2; | |
3119 goto LABEL_19; | |
3120 } | |
3121 } | |
3122 LABEL_19: | |
3123 v12 = v14->pActiveSkills[5]; | |
3124 if ( v12 ) | |
3125 { | |
3126 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3127 v9 += v14->pActiveSkills[5] & 0x3F; | |
3128 } | |
3129 return v9; | |
3130 } | |
3131 | |
3132 //----- (0048D2EA) -------------------------------------------------------- | |
3133 char *Player::GetMeleeDamageString() | |
3134 { | |
3135 Player *v1; // esi@1 | |
3136 signed int v2; // eax@1 | |
3137 signed int v3; // edi@3 | |
3138 signed int v4; // eax@3 | |
3139 signed int v5; // ST0C_4@6 | |
3140 char *v6; // edi@6 | |
3141 signed int v7; // ST08_4@7 | |
3142 unsigned int v8; // eax@8 | |
3143 signed int v9; // esi@9 | |
3144 | |
3145 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3146 | |
3147 v1 = this; | |
232 | 3148 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3149 if ( v2 < 64 || v2 > 65 ) |
3150 { | |
3151 v3 = GetMeleeDamageMinimal(); | |
3152 v4 = GetMeleeDamageMaximal(); | |
3153 } | |
3154 else | |
3155 { | |
3156 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3157 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3158 } | |
3159 if ( v3 == v4 ) | |
3160 { | |
3161 v5 = v3; | |
3162 v6 = player__getmeleedamagestring_static_buff; | |
3163 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3164 } | |
3165 else | |
3166 { | |
3167 v7 = v3; | |
3168 v6 = player__getmeleedamagestring_static_buff; | |
3169 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3170 } | |
3171 v8 = v1->pEquipment.uMainHand; | |
3172 if ( v8 ) | |
3173 { | |
232 | 3174 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3175 if ( v9 >= 135 ) |
3176 { | |
3177 if ( v9 <= 159 ) | |
3178 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3179 } | |
3180 } | |
3181 return v6; | |
3182 } | |
3183 | |
3184 //----- (0048D396) -------------------------------------------------------- | |
3185 char *Player::GetRangedDamageString() | |
3186 { | |
3187 Player *v1; // esi@1 | |
3188 signed int v2; // eax@1 | |
3189 int v3; // edi@3 | |
3190 int v4; // eax@3 | |
3191 char *v5; // edi@6 | |
3192 int v6; // ST0C_4@8 | |
3193 int v7; // ST08_4@9 | |
3194 unsigned int v8; // eax@10 | |
3195 signed int v9; // esi@11 | |
3196 | |
3197 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3198 | |
3199 v1 = this; | |
232 | 3200 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3201 if ( v2 < 64 || v2 > 65 ) |
3202 { | |
3203 v3 = GetRangedDamageMin(); | |
3204 v4 = GetRangedDamageMax(); | |
3205 } | |
3206 else | |
3207 { | |
3208 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3209 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3210 } | |
3211 if ( v4 ) | |
3212 { | |
3213 if ( v3 == v4 ) | |
3214 { | |
3215 v6 = v3; | |
3216 v5 = player__getrangeddamagestring_static_buff; | |
3217 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3218 } | |
3219 else | |
3220 { | |
3221 v7 = v3; | |
3222 v5 = player__getrangeddamagestring_static_buff; | |
3223 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3224 } | |
3225 } | |
3226 else | |
3227 { | |
3228 v5 = player__getrangeddamagestring_static_buff; | |
3229 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3230 } | |
3231 v8 = v1->pEquipment.uMainHand; | |
3232 if ( v8 ) | |
3233 { | |
232 | 3234 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3235 if ( v9 >= 135 ) |
3236 { | |
3237 if ( v9 <= 159 ) | |
3238 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3239 } | |
3240 } | |
3241 return v5; | |
3242 } | |
3243 | |
3244 //----- (0048D45A) -------------------------------------------------------- | |
3245 bool Player::CanTrainToNextLevel() | |
3246 { | |
3247 int v1; // edx@1 | |
3248 int v2; // eax@1 | |
3249 int i; // esi@1 | |
3250 | |
3251 v1 = this->uLevel; | |
3252 v2 = 0; | |
3253 for ( i = 0; i < v1; ++i ) | |
3254 v2 += i + 1; | |
3255 return (signed __int64)this->uExperience >= 1000 * v2; | |
3256 } | |
3257 | |
3258 //----- (0048D498) -------------------------------------------------------- | |
3259 unsigned int Player::GetExperienceDisplayColor() | |
3260 { | |
3261 unsigned int result; // eax@2 | |
3262 | |
3263 if ( CanTrainToNextLevel() ) | |
995 | 3264 result = ui_character_bonus_text_color; |
0 | 3265 else |
995 | 3266 result = ui_character_default_text_color; |
0 | 3267 return result; |
3268 } | |
3269 | |
3270 //----- (0048D4B3) -------------------------------------------------------- | |
3271 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3272 { | |
3273 Player *v3; // esi@1 | |
3274 int v4; // edi@8 | |
3275 int v6; // eax@21 | |
3276 signed int v7; // ebx@21 | |
3277 int v8; // eax@22 | |
3278 signed int v9; // ebx@22 | |
3279 int v10; // eax@23 | |
3280 signed int v11; // ebx@23 | |
3281 int v12; // eax@24 | |
3282 signed int v13; // edi@24 | |
3283 unsigned int v14; // eax@27 | |
3284 int v15; // eax@29 | |
3285 double v16; // st7@32 | |
3286 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3287 signed int v18; // [sp+8h] [bp-4h]@17 | |
3288 | |
3289 v3 = this; | |
3290 if ( !resistance ) | |
3291 { | |
3292 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3293 goto LABEL_16; | |
3294 } | |
3295 if ( resistance == 1 ) | |
3296 { | |
3297 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3298 goto LABEL_16; | |
3299 } | |
3300 if ( resistance == 2 ) | |
3301 { | |
3302 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3303 goto LABEL_16; | |
3304 } | |
3305 if ( resistance == 3 ) | |
3306 { | |
3307 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3308 goto LABEL_16; | |
3309 } | |
3310 if ( resistance == 6 ) | |
3311 { | |
3312 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3313 goto LABEL_16; | |
3314 } | |
3315 if ( resistance == 7 ) | |
3316 { | |
3317 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3318 goto LABEL_16; | |
3319 } | |
3320 if ( resistance == 8 ) | |
3321 { | |
3322 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3323 LABEL_16: | |
3324 v4 = GetActualResistance(v17); | |
3325 goto LABEL_17; | |
3326 } | |
3327 v4 = 0; | |
3328 LABEL_17: | |
3329 v18 = type; | |
135 | 3330 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3331 return 0; |
3332 if ( v4 ) | |
3333 { | |
3334 v6 = GetActualLuck(); | |
3335 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3336 if ( rand() % v7 >= 30 ) | |
3337 { | |
3338 v18 = type >> 1; | |
3339 v8 = GetActualLuck(); | |
3340 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3341 if ( rand() % v9 >= 30 ) | |
3342 { | |
3343 v18 = type >> 2; | |
3344 v10 = GetActualLuck(); | |
3345 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3346 if ( rand() % v11 >= 30 ) | |
3347 { | |
3348 v18 = type >> 3; | |
3349 v12 = GetActualLuck(); | |
3350 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3351 if ( rand() % v13 >= 30 ) | |
3352 v18 = type >> 4; | |
3353 } | |
3354 } | |
3355 } | |
3356 } | |
3357 if ( resistance == 4 ) | |
3358 { | |
898 | 3359 v14 = v3->pEquipment.uArmor; |
0 | 3360 if ( v14 ) |
3361 { | |
3362 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3363 { | |
3364 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3365 if ( v15 ) | |
3366 { | |
3367 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3368 return v18; | |
3369 v16 = (double)v18 * 0.5; | |
3370 return (signed __int64)v16; | |
3371 } | |
3372 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3373 { | |
3374 v16 = (double)v18 * 0.66670001; | |
3375 return (signed __int64)v16; | |
3376 } | |
3377 } | |
3378 } | |
3379 } | |
3380 return v18; | |
3381 } | |
3382 | |
3383 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3384 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3385 { | |
3386 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3387 } |
3388 | |
3389 //----- (0048D651) -------------------------------------------------------- | |
816 | 3390 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3391 { | |
3392 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3393 } |
3394 | |
3395 //----- (0048D676) -------------------------------------------------------- | |
3396 bool Player::IsUnarmed() | |
3397 { | |
816 | 3398 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3399 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3400 } |
3401 | |
3402 //----- (0048D6AA) -------------------------------------------------------- | |
3403 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3404 { | |
3405 auto i = pEquipment.pIndices[uEquipIndex]; | |
3406 if (i) | |
3407 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3408 else return false; | |
3409 } | |
3410 | |
3411 //----- (0048D6D0) -------------------------------------------------------- | |
3412 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3413 { | |
3414 for (uint i = 0; i < 16; ++i) | |
3415 { | |
3416 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3417 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3418 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3419 return true; | |
3420 } | |
3421 return false; | |
3422 } | |
3423 | |
3424 //----- (0048D709) -------------------------------------------------------- | |
3425 bool Player::WearsItem(int a1, signed int a2) | |
3426 { | |
1010 | 3427 |
0 | 3428 int v6; // esi@5 |
3429 | |
3430 if ( a2 >= 16 ) | |
3431 { | |
3432 v6 = 0; | |
3433 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3434 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3435 { |
3436 ++v6; | |
3437 if ( (signed int)v6 >= 16 ) | |
3438 return 0; | |
3439 } | |
3440 return 1; | |
3441 } | |
727 | 3442 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3443 return 1; |
3444 return 0; | |
3445 } | |
3446 | |
3447 //----- (0048D76C) -------------------------------------------------------- | |
3448 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3449 { | |
3450 unsigned __int16 v6; // cx@8 | |
3451 int v7; // edi@8 | |
3452 unsigned int v8; // ebx@8 | |
3453 unsigned int v9; // esi@8 | |
3454 int v10; // eax@8 | |
3455 int v11; // edi@12 | |
3456 bool result; // eax@13 | |
3457 | |
3458 if ( !a2 | |
3459 || this->pConditions[16] | |
3460 || this->pConditions[14] | |
3461 || this->pConditions[15] | |
3462 || this->pConditions[4] | |
3463 || this->pConditions[13] | |
3464 || this->pConditions[2] ) | |
3465 { | |
3466 result = 0; | |
3467 } | |
3468 else | |
3469 { | |
3470 v6 = this->pActiveSkills[34]; | |
3471 v7 = v6 & 0x3F; | |
3472 v8 = SkillToMastery(v6); | |
3473 v9 = a2->GetValue(); | |
3474 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3475 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3476 v9 *= 3; | |
3477 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3478 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3479 if ( rand() % 100 >= 5 ) | |
3480 { | |
3481 if ( *a6 > v11 ) | |
3482 result = *a6 - v11 < 500; | |
3483 else | |
3484 result = 2; | |
3485 } | |
3486 else | |
3487 { | |
3488 result = 0; | |
3489 } | |
3490 } | |
3491 return result; | |
3492 } | |
3493 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3494 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3495 | |
3496 //----- (0048D88B) -------------------------------------------------------- | |
3497 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3498 { | |
3499 Player *v4; // esi@1 | |
3500 Actor *v5; // edi@1 | |
3501 unsigned __int16 v6; // cx@10 | |
3502 int v7; // ebx@10 | |
3503 unsigned int v8; // esi@10 | |
3504 int v9; // eax@10 | |
3505 int v10; // esi@10 | |
3506 int v11; // eax@13 | |
3507 signed int v12; // ebx@15 | |
3508 signed int v13; // edx@15 | |
3509 int v14; // ecx@15 | |
3510 unsigned __int16 v15; // si@21 | |
3511 unsigned int v16; // ebx@24 | |
3512 int v17; // esi@24 | |
3513 const void *v18; // eax@29 | |
3514 unsigned int v19; // esi@31 | |
3515 int v20; // eax@34 | |
3516 char v21; // zf@36 | |
3517 unsigned int v22; // ST0C_4@39 | |
3518 char *v23; // esi@39 | |
3519 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3520 int v26; // [sp-8h] [bp-44h]@40 | |
3521 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3522 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3523 int v29; // [sp+30h] [bp-Ch]@10 | |
3524 int v30; // [sp+34h] [bp-8h]@10 | |
3525 Player *v31; // [sp+38h] [bp-4h]@1 | |
3526 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3527 | |
3528 v4 = this; | |
3529 v5 = &pActors[uActorID]; | |
3530 v31 = this; | |
3531 if ( &pActors[uActorID] | |
3532 && !this->pConditions[16] | |
3533 && !this->pConditions[14] | |
3534 && !this->pConditions[15] | |
3535 && !this->pConditions[4] | |
3536 && !this->pConditions[13] | |
3537 && !this->pConditions[2] ) | |
3538 { | |
3539 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3540 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3541 v6 = v4->pActiveSkills[34]; | |
3542 v7 = v6 & 0x3F; | |
3543 v8 = SkillToMastery(v6); | |
3544 v9 = rand(); | |
3545 v28 = 4 * v8; | |
3546 v30 = dword_4EDEA0[v8]; | |
3547 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3548 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3549 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3550 { | |
322 | 3551 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3552 _steal_perma = 0; |
3553 v26 = (int)v31->pName; | |
3554 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3555 } | |
3556 else | |
3557 { | |
3558 v11 = rand(); | |
3559 if ( v11 % 100 >= 40 ) | |
3560 { | |
3561 if ( v11 % 100 >= 70 ) | |
3562 { | |
3563 v19 = 0; | |
3564 if ( v7 > 0 ) | |
3565 { | |
3566 do | |
3567 { | |
3568 --v7; | |
3569 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3570 } | |
3571 while ( v7 ); | |
3572 } | |
3573 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3574 return _steal_perma; | |
377 | 3575 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3576 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3577 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3578 v21 = *(int *)v20 == v19; |
3579 *(int *)v20 -= v19; | |
3580 if ( v21 ) | |
3581 v5->array_000234[3].uItemID = 0; | |
3582 if ( v19 ) | |
3583 { | |
3584 party_finds_gold(v19, 2); | |
3585 v22 = v19; | |
3586 v23 = pTmpBuf2; | |
3587 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3588 LABEL_43: | |
3589 ShowStatusBarString(v23, 2u); | |
3590 return _steal_perma; | |
3591 } | |
3592 } | |
3593 else | |
3594 { | |
3595 v27.Reset(); | |
3596 v12 = 0; | |
3597 v13 = 0; | |
3598 v14 = (int)v5->array_000234; | |
3599 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3600 { | |
3601 ++v13; | |
3602 v14 += 36; | |
3603 if ( v13 >= 4 ) | |
3604 goto LABEL_21; | |
3605 } | |
3606 v12 = 1; | |
3607 LABEL_21: | |
3608 v15 = v5->uCarriedItemID; | |
3609 if ( v15 || v12 ) | |
3610 { | |
3611 v27.Reset(); | |
3612 if ( v15 ) | |
3613 { | |
3614 v16 = (signed __int16)v15; | |
3615 v5->uCarriedItemID = 0; | |
3616 v27.uItemID = (signed __int16)v15; | |
3617 v17 = (signed __int16)v15; | |
3618 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3619 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3620 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3621 { | |
3622 if ( v16 != 220 ) | |
570 | 3623 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3624 } |
3625 } | |
3626 else | |
3627 { | |
3628 v18 = &v5->array_000234[rand() % 4]; | |
3629 memcpy(&v27, v18, sizeof(v27)); | |
3630 ((ItemGen *)v18)->Reset(); | |
3631 v16 = v27.uItemID; | |
3632 } | |
3633 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3634 sprintf( | |
3635 pTmpBuf2, | |
3636 pGlobalTXT_LocalizationStrings[304], | |
3637 v31->pName, | |
3638 pItemsTable->pItems[v16].pUnidentifiedName); | |
3639 ShowStatusBarString(pTmpBuf2, 2u); | |
3640 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3641 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3642 pMouse->SetCursorBitmapFromItemID(v16); | |
3643 return _steal_perma; | |
3644 } | |
3645 } | |
3646 } | |
3647 v26 = (int)v31->pName; | |
3648 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3649 } | |
3650 v23 = pTmpBuf2; | |
809 | 3651 sprintfex(pTmpBuf2, v25, v26); |
0 | 3652 goto LABEL_43; |
3653 } | |
3654 return 0; | |
3655 } | |
3656 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3657 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3658 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3659 | |
3660 //----- (0048DBB9) -------------------------------------------------------- | |
3661 void Player::Heal(int amount) | |
3662 { | |
1010 | 3663 signed int max_health; // eax@3 |
3664 | |
3665 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3666 { | |
3667 max_health = GetMaxHealth(); | |
3668 if ( pConditions[Condition_Zombie] ) | |
3669 max_health /= 2; | |
3670 sHealth += amount; | |
3671 if ( sHealth > max_health ) | |
3672 sHealth = max_health; | |
3673 if ( pConditions[Condition_Unconcious] ) | |
3674 { | |
3675 if ( sHealth > 0 ) | |
3676 { | |
3677 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3678 } |
3679 } | |
3680 } | |
3681 } | |
3682 | |
3683 //----- (0048DC1E) -------------------------------------------------------- | |
3684 int Player::ReceiveDamage(signed int type, int resistance) | |
3685 { | |
3686 Player *v3; // esi@1 | |
3687 signed int v4; // eax@1 | |
3688 int v5; // eax@1 | |
3689 bool v6; // ebx@1 | |
3690 unsigned int v7; // eax@8 | |
3691 char *v8; // ecx@9 | |
3692 int v9; // eax@9 | |
187 | 3693 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3694 |
3695 v3 = this; | |
1010 | 3696 this->pConditions[Condition_Sleep] = 0i64; |
0 | 3697 v4 = CalculateIncommingDamage(resistance, type); |
3698 v3->sHealth -= v4; | |
187 | 3699 //typea = v4; |
0 | 3700 v5 = v3->sHealth; |
3701 v6 = v5 < -10; | |
3702 LOBYTE(v6) = v5 <= -10; | |
3703 if ( v5 < 1 ) | |
3704 { | |
3705 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
1010 | 3706 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
0 | 3707 { |
3708 SetCondition(0xDu, 0); | |
3709 } | |
3710 else | |
3711 { | |
3712 SetCondition(0xEu, 0); | |
3713 v6 = LODWORD(pParty->uTimePlayed); | |
3714 if ( v3->sHealth > 0 ) | |
3715 v3->sHealth = 0; | |
3716 } | |
3717 if ( v6 ) | |
3718 { | |
898 | 3719 v7 = v3->pEquipment.uArmor; |
0 | 3720 if ( v7 ) |
3721 { | |
3722 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3723 v9 = *(int *)v8; | |
3724 if ( !(BYTE1(v9) & 2) ) | |
3725 { | |
3726 LOBYTE(v9) = v9 | 2; | |
3727 *(int *)v8 = v9; | |
3728 } | |
3729 } | |
3730 } | |
3731 } | |
187 | 3732 if ( v4 && CanAct() ) |
3733 PlaySound(SPEECH_24, 0); | |
3734 return v4; | |
0 | 3735 } |
3736 | |
3737 //----- (0048DCF6) -------------------------------------------------------- | |
3738 int Player::_48DCF6(int a2, Actor *pActor) | |
3739 { | |
3740 signed int v3; // edi@1 | |
3741 signed int v4; // ebx@1 | |
3742 Player *v5; // esi@1 | |
3743 int v6; // eax@2 | |
3744 int v7; // eax@5 | |
3745 int v8; // eax@8 | |
3746 int v9; // ebx@8 | |
3747 int v10; // eax@8 | |
3748 int v11; // ebx@8 | |
3749 signed int v12; // edx@9 | |
3750 ItemGen *v13; // eax@9 | |
3751 int v14; // edx@16 | |
3752 unsigned int v15; // edx@17 | |
3753 int v16; // edx@26 | |
3754 unsigned int v17; // edx@27 | |
3755 signed int v19; // edx@38 | |
3756 int *v20; // ecx@38 | |
3757 signed int v21; // eax@40 | |
3758 int v22; // eax@49 | |
3759 signed int v23; // ebx@49 | |
3760 unsigned int v24; // eax@60 | |
3761 int v25; // ecx@61 | |
3762 int v26; // ebx@74 | |
3763 void *v27; // ecx@76 | |
3764 unsigned int v28; // ebx@78 | |
3765 signed int result; // eax@86 | |
3766 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3767 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3768 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3769 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3770 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3771 int v35; // [sp-Ch] [bp-ACh]@56 | |
3772 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3773 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3774 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3775 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3776 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3777 int v41; // [sp-4h] [bp-A4h]@51 | |
3778 int v42; // [sp-4h] [bp-A4h]@56 | |
3779 int v43; // [sp-4h] [bp-A4h]@57 | |
3780 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3781 int v45; // [sp-4h] [bp-A4h]@68 | |
3782 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3783 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3784 int v48; // [sp+9Ch] [bp-4h]@1 | |
3785 | |
3786 v3 = 0; | |
3787 v4 = 0; | |
3788 v5 = this; | |
3789 v47 = 0; | |
3790 v48 = 0; | |
3791 switch ( a2 ) | |
3792 { | |
3793 case 1: | |
3794 v6 = GetActualWillpower(); | |
3795 goto LABEL_46; | |
3796 case 2: | |
3797 case 3: | |
3798 case 4: | |
3799 case 9: | |
3800 case 10: | |
3801 case 11: | |
3802 case 13: | |
3803 case 21: | |
3804 v6 = GetActualEndurance(); | |
3805 goto LABEL_46; | |
3806 case 5: | |
3807 case 12: | |
3808 case 23: | |
3809 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3810 goto LABEL_5; | |
3811 case 15: | |
3812 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3813 goto LABEL_5; | |
3814 case 6: | |
3815 case 7: | |
3816 case 8: | |
3817 case 14: | |
3818 case 16: | |
3819 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3820 LABEL_5: | |
3821 v7 = GetActualResistance(v40); | |
3822 goto LABEL_47; | |
3823 case 22: | |
3824 v8 = GetActualWillpower(); | |
3825 v9 = _48EA1B_get_static_effect(v8); | |
3826 v10 = GetActualIntelligence(); | |
3827 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3828 break; | |
3829 case 17: | |
3830 v12 = 0; | |
3831 v13 = this->pInventoryItems; | |
3832 do | |
3833 { | |
315 | 3834 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3835 v46[v4++] = v12; |
3836 ++v12; | |
3837 ++v13; | |
3838 } | |
3839 while ( v12 < 138 ); | |
3840 goto LABEL_36; | |
3841 case 18: | |
3842 v14 = 0; | |
3843 do | |
3844 { | |
3845 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3846 { | |
816 | 3847 if ( v15 == EQUIP_ARMOUR ) |
898 | 3848 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3849 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3850 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3851 } |
3852 v14 = v15 + 1; | |
3853 } | |
3854 while ( v14 < 16 ); | |
3855 goto LABEL_36; | |
3856 case 19: | |
3857 v16 = 0; | |
3858 do | |
3859 { | |
3860 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3861 { | |
3862 if ( v17 == 2 ) | |
3863 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3864 if ( (!v17 || v17 == 1) | |
816 | 3865 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3866 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3867 } |
3868 v16 = v17 + 1; | |
3869 } | |
3870 while ( v16 < 16 ); | |
3871 LABEL_36: | |
3872 if ( !v4 ) | |
3873 goto LABEL_87; | |
3874 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3875 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3876 break; | |
3877 case 20: | |
3878 v19 = 0; | |
3879 v20 = this->pInventoryIndices; | |
3880 do | |
3881 { | |
3882 if ( *v20 > 0 ) | |
3883 { | |
232 | 3884 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3885 if ( v21 > 0 ) |
3886 { | |
3887 if ( v21 <= 134 ) | |
3888 v46[v4++] = v19; | |
3889 } | |
3890 } | |
3891 ++v19; | |
3892 ++v20; | |
3893 } | |
3894 while ( v19 < 126 ); | |
3895 if ( !v4 ) | |
3896 goto LABEL_87; | |
3897 v47 = (unsigned __int8)v46[rand() % v4]; | |
3898 v6 = GetActualAccuracy(); | |
3899 LABEL_46: | |
3900 v7 = _48EA1B_get_static_effect(v6); | |
3901 LABEL_47: | |
3902 v11 = v7; | |
3903 break; | |
3904 default: | |
3905 v11 = 0; | |
3906 break; | |
3907 } | |
3908 v22 = GetActualLuck(); | |
3909 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3910 if ( rand() % v23 >= 30 ) | |
3911 { | |
3912 LABEL_87: | |
3913 result = 0; | |
3914 } | |
3915 else | |
3916 { | |
3917 switch ( a2 ) | |
3918 { | |
3919 case 1: | |
3920 v41 = 1; | |
3921 v36 = 0; | |
3922 goto LABEL_56; | |
3923 case 2: | |
3924 v41 = 1; | |
3925 v36 = 1; | |
3926 goto LABEL_56; | |
3927 case 3: | |
3928 v41 = 1; | |
3929 v36 = 2; | |
3930 goto LABEL_56; | |
3931 case 23: | |
3932 v41 = 1; | |
3933 v36 = 3; | |
3934 goto LABEL_56; | |
3935 case 4: | |
3936 v41 = 1; | |
3937 v36 = 4; | |
3938 LABEL_56: | |
3939 SetCondition(v36, v41); | |
3940 v42 = 0; | |
3941 v37 = 0; | |
3942 v35 = 0; | |
3943 v34 = 0; | |
3944 v33 = -1; | |
3945 v32 = 0; | |
3946 v31 = 0; | |
3947 v30 = (SoundID)221; | |
3948 goto LABEL_83; | |
3949 case 5: | |
3950 v43 = 1; | |
3951 v38 = 5; | |
3952 goto LABEL_70; | |
3953 case 6: | |
3954 case 7: | |
3955 case 8: | |
3956 if ( a2 == 6 ) | |
3957 { | |
3958 v44 = 6; | |
3959 goto LABEL_60; | |
3960 } | |
3961 v25 = 2 * (a2 != 8) + 8; | |
3962 goto LABEL_65; | |
3963 case 9: | |
3964 if ( a2 == 6 ) | |
3965 { | |
3966 v44 = 7; | |
3967 LABEL_60: | |
3968 v24 = v44; | |
3969 } | |
3970 else | |
3971 { | |
3972 v25 = 2 * (a2 != 8) + 9; | |
3973 LABEL_65: | |
3974 v24 = v25; | |
3975 } | |
3976 SetCondition(v24, 1); | |
3977 v42 = 0; | |
3978 v37 = 0; | |
3979 v35 = 0; | |
3980 v34 = 0; | |
3981 v33 = -1; | |
3982 v32 = 0; | |
3983 v31 = 0; | |
3984 v30 = (SoundID)222; | |
3985 LABEL_83: | |
3986 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3987 do | |
3988 { | |
3989 LABEL_84: | |
3990 if ( v5 == pPlayers[v3 + 1] ) | |
3991 break; | |
3992 ++v3; | |
3993 } | |
3994 while ( v3 < 4 ); | |
3995 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3996 result = 1; | |
3997 break; | |
3998 case 12: | |
3999 v43 = 1; | |
4000 v38 = 12; | |
4001 goto LABEL_70; | |
4002 case 15: | |
4003 v45 = 1; | |
4004 v39 = 15; | |
4005 goto LABEL_73; | |
4006 case 13: | |
4007 v43 = 1; | |
4008 v38 = 13; | |
4009 LABEL_70: | |
4010 SetCondition(v38, v43); | |
4011 v42 = 0; | |
4012 v37 = 0; | |
4013 v35 = 0; | |
4014 v34 = 0; | |
4015 v33 = -1; | |
4016 v32 = 0; | |
4017 v31 = 0; | |
4018 v30 = (SoundID)224; | |
4019 goto LABEL_83; | |
4020 case 14: | |
4021 v45 = 1; | |
4022 v39 = 14; | |
4023 goto LABEL_73; | |
4024 case 16: | |
4025 v45 = 1; | |
4026 v39 = 16; | |
4027 LABEL_73: | |
4028 SetCondition(v39, v45); | |
4029 v42 = 0; | |
4030 v37 = 0; | |
4031 v35 = 0; | |
4032 v34 = 0; | |
4033 v33 = -1; | |
4034 v32 = 0; | |
4035 v31 = 0; | |
4036 v30 = (SoundID)225; | |
4037 goto LABEL_83; | |
4038 case 17: | |
4039 case 18: | |
4040 case 19: | |
4041 v26 = v48; | |
4042 if ( *(char *)(v48 + 21) & 2 ) | |
4043 goto LABEL_84; | |
187 | 4044 PlaySound(SPEECH_40, 0); |
0 | 4045 *(int *)(v26 + 20) |= 2u; |
4046 goto LABEL_79; | |
4047 case 20: | |
187 | 4048 PlaySound(SPEECH_40, 0); |
0 | 4049 v27 = pActor->array_000234; |
4050 if ( pActor->array_000234[0].uItemID ) | |
4051 { | |
4052 v27 = &pActor->array_000234[1]; | |
4053 if ( pActor->array_000234[1].uItemID ) | |
4054 goto LABEL_84; | |
4055 } | |
4056 v28 = v47; | |
654 | 4057 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 4058 RemoveItemAtInventoryIndex(v28); |
4059 LABEL_79: | |
4060 v42 = 0; | |
4061 v37 = 0; | |
4062 v35 = 0; | |
4063 v34 = 0; | |
4064 v33 = -1; | |
4065 v32 = 0; | |
4066 v31 = 0; | |
4067 v30 = (SoundID)47; | |
4068 goto LABEL_83; | |
4069 case 21: | |
187 | 4070 PlaySound(SPEECH_42, 0); |
0 | 4071 ++v5->sAgeModifier; |
4072 goto LABEL_82; | |
4073 case 22: | |
187 | 4074 PlaySound(SPEECH_41, 0); |
0 | 4075 v5->sMana = 0; |
4076 LABEL_82: | |
4077 v42 = 0; | |
4078 v37 = 0; | |
4079 v35 = 0; | |
4080 v34 = 0; | |
4081 v33 = -1; | |
4082 v32 = 0; | |
4083 v31 = 0; | |
4084 v30 = (SoundID)226; | |
4085 goto LABEL_83; | |
4086 default: | |
4087 goto LABEL_87; | |
4088 } | |
4089 } | |
4090 return result; | |
4091 } | |
324 | 4092 |
0 | 4093 // 48DCF6: using guessed type char var_94[140]; |
4094 | |
4095 //----- (0048E1A3) -------------------------------------------------------- | |
4096 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4097 { | |
4098 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4099 } | |
4100 | |
4101 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4102 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4103 { | |
4104 ItemGen *weapon = nullptr; | |
4105 ItemDesc *weapon_desc = nullptr; | |
4106 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4107 if (bRangedAttack) | |
0 | 4108 { |
4109 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4110 goto LABEL_17; | |
816 | 4111 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4112 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4113 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4114 goto LABEL_17; | |
4115 } | |
4116 else if ( IsUnarmed() == 1 ) | |
4117 { | |
4118 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4119 { | |
4120 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4121 goto LABEL_17; |
4122 } | |
4123 } | |
816 | 4124 |
4125 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4126 { | |
4127 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4128 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4129 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4130 { | |
4131 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4132 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4133 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4134 } | |
0 | 4135 else |
816 | 4136 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4137 } | |
1010 | 4138 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
4139 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 4140 { |
898 | 4141 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4142 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4143 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4144 { | |
898 | 4145 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4146 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4147 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4148 } | |
4149 } | |
4150 | |
0 | 4151 LABEL_17: |
816 | 4152 uint armour_recovery = 0; |
0 | 4153 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4154 { | |
898 | 4155 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4156 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4157 | |
4158 float armour_recovery_multipliers[4]; | |
4159 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4160 { | |
4161 armour_recovery_multipliers[0] = 1.0f; | |
4162 armour_recovery_multipliers[1] = 0; | |
4163 armour_recovery_multipliers[2] = 0; | |
4164 armour_recovery_multipliers[3] = 0; | |
4165 } | |
4166 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4167 { | |
4168 armour_recovery_multipliers[0] = 1.0f; | |
4169 armour_recovery_multipliers[1] = 0.5f; | |
4170 armour_recovery_multipliers[2] = 0; | |
4171 armour_recovery_multipliers[3] = 0; | |
4172 } | |
4173 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4174 { | |
4175 armour_recovery_multipliers[0] = 1.0f; | |
4176 armour_recovery_multipliers[1] = 0.5f; | |
4177 armour_recovery_multipliers[2] = 0.5f; | |
4178 armour_recovery_multipliers[3] = 0; | |
0 | 4179 } |
4180 else | |
4181 { | |
816 | 4182 assert(false && "Unknown armour type"); // what kind of armour is that? |
4183 armour_recovery_multipliers[0] = 1.0f; | |
4184 armour_recovery_multipliers[1] = 1.0f; | |
4185 armour_recovery_multipliers[2] = 1.0f; | |
4186 armour_recovery_multipliers[3] = 1.0f; | |
4187 } | |
4188 | |
4189 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4190 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4191 } | |
4192 | |
4193 uint shield_recovery = 0; | |
4194 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4195 { | |
4196 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4197 | |
898 | 4198 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4199 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4200 | |
4201 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4202 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4203 } | |
4204 | |
4205 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4206 sword_axe_bow_recovery_reduction = 0; | |
4207 bool shooting_laser = false; | |
4208 if (weapon_desc) | |
4209 { | |
4210 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4211 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4212 { | |
4213 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4214 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4215 } | |
4216 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4217 shooting_laser = true; | |
4218 } | |
4219 | |
4220 uint armsmaster_recovery_reduction = 0; | |
4221 if (!bRangedAttack && !shooting_laser) | |
4222 { | |
4223 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4224 { | |
4225 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4226 if (SkillToMastery(armsmaster_level) >= 4) | |
4227 armsmaster_recovery_reduction *= 2; | |
4228 } | |
4229 } | |
4230 | |
4231 uint v41 = 0; | |
4232 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4233 v41 = 25; |
816 | 4234 |
4235 uint weapon_enchantment_recovery_reduction = 0; | |
4236 if ( weapon ) | |
4237 { | |
4238 if (weapon->uSpecEnchantmentType == 59 || | |
4239 weapon->uSpecEnchantmentType == 41 || | |
4240 weapon->uSpecEnchantmentType == 500) | |
4241 weapon_enchantment_recovery_reduction = 20; | |
4242 } | |
4243 | |
4244 | |
4245 int recovery = weapon_recovery + | |
4246 armour_recovery + | |
4247 shield_recovery | |
4248 - armsmaster_recovery_reduction | |
4249 - weapon_enchantment_recovery_reduction | |
4250 - v41 | |
4251 - sword_axe_bow_recovery_reduction | |
4252 - player_speed_recovery_reduction; | |
4253 | |
4254 if (recovery < 0) | |
4255 recovery = 0; | |
4256 return recovery; | |
0 | 4257 } |
4258 | |
4259 //----- (0048E4F8) -------------------------------------------------------- | |
4260 int Player::GetMaxHealth() | |
4261 { | |
4262 int v3; // esi@1 | |
4263 int v4; // esi@1 | |
4264 int v6; // esi@1 | |
4265 | |
4266 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4267 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4268 v6 = uFullHealthBonus |
135 | 4269 + pBaseHealthByClass[classType / 4] |
0 | 4270 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4271 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4272 if (v6 <= 0) | |
4273 return 1; | |
4274 return v6; | |
4275 } | |
4276 | |
4277 //----- (0048E565) -------------------------------------------------------- | |
4278 int Player::GetMaxMana() | |
4279 { | |
4280 int v2; // eax@2 | |
4281 int v3; // esi@4 | |
4282 int v4; // eax@5 | |
4283 int v5; // esi@5 | |
4284 int v6; // eax@5 | |
4285 int v7; // esi@6 | |
4286 int v8; // esi@6 | |
4287 int v9; // esi@6 | |
4288 int result; // eax@7 | |
4289 | |
135 | 4290 switch (classType) |
0 | 4291 { |
4292 case 5u: | |
4293 case 6u: | |
4294 case 7u: | |
4295 case 0x10u: | |
4296 case 0x11u: | |
4297 case 0x12u: | |
4298 case 0x13u: | |
4299 case 0x20u: | |
4300 case 0x21u: | |
4301 case 0x22u: | |
4302 case 0x23u: | |
4303 v2 = GetActualIntelligence(); | |
4304 v3 = _48EA1B_get_static_effect(v2); | |
4305 goto LABEL_6; | |
4306 case 9u: | |
4307 case 0xAu: | |
4308 case 0xBu: | |
4309 case 0xCu: | |
4310 case 0xDu: | |
4311 case 0xEu: | |
4312 case 0xFu: | |
4313 case 0x18u: | |
4314 case 0x19u: | |
4315 case 0x1Au: | |
4316 case 0x1Bu: | |
4317 v2 = GetActualWillpower(); | |
4318 v3 = _48EA1B_get_static_effect(v2); | |
4319 goto LABEL_6; | |
4320 case 0x15u: | |
4321 case 0x16u: | |
4322 case 0x17u: | |
4323 case 0x1Cu: | |
4324 case 0x1Du: | |
4325 case 0x1Eu: | |
4326 case 0x1Fu: | |
4327 v4 = GetActualWillpower(); | |
4328 v5 = _48EA1B_get_static_effect(v4); | |
4329 v6 = GetActualIntelligence(); | |
4330 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4331 LABEL_6: | |
135 | 4332 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4333 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4334 v9 = uFullManaBonus | |
135 | 4335 + pBaseManaByClass[classType / 4] |
0 | 4336 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4337 + v8; | |
4338 if ( v9 < 1 ) | |
4339 goto LABEL_7; | |
4340 result = v9; | |
4341 break; | |
4342 default: | |
4343 LABEL_7: | |
4344 result = 0; | |
4345 break; | |
4346 } | |
4347 return result; | |
4348 } | |
4349 | |
4350 //----- (0048E656) -------------------------------------------------------- | |
4351 int Player::GetBaseAC() | |
4352 { | |
4353 Player *v1; // edi@1 | |
4354 int v2; // eax@1 | |
4355 int v3; // esi@1 | |
4356 int v4; // esi@1 | |
4357 int v5; // esi@1 | |
4358 int result; // eax@2 | |
4359 | |
4360 v1 = this; | |
4361 v2 = GetActualSpeed(); | |
4362 v3 = _48EA1B_get_static_effect(v2); | |
4363 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4364 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4365 if ( v5 >= 1 ) | |
4366 result = v5; | |
4367 else | |
4368 result = 0; | |
4369 return result; | |
4370 } | |
4371 | |
4372 //----- (0048E68F) -------------------------------------------------------- | |
4373 int Player::GetActualAC() | |
4374 { | |
4375 Player *v1; // edi@1 | |
4376 int v2; // eax@1 | |
4377 int v3; // esi@1 | |
4378 int v4; // esi@1 | |
4379 int v5; // esi@1 | |
4380 int v6; // esi@1 | |
4381 int result; // eax@2 | |
4382 | |
4383 v1 = this; | |
4384 v2 = GetActualSpeed(); | |
4385 v3 = _48EA1B_get_static_effect(v2); | |
4386 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4387 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4388 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4389 if ( v6 >= 1 ) | |
4390 result = v6; | |
4391 else | |
4392 result = 0; | |
4393 return result; | |
4394 } | |
4395 | |
4396 //----- (0048E6DC) -------------------------------------------------------- | |
4397 unsigned int Player::GetBaseAge() | |
4398 { | |
352 | 4399 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4400 } |
4401 | |
4402 //----- (0048E72C) -------------------------------------------------------- | |
4403 unsigned int Player::GetActualAge() | |
4404 { | |
4405 return this->sAgeModifier + GetBaseAge(); | |
4406 } | |
4407 | |
4408 //----- (0048E73F) -------------------------------------------------------- | |
4409 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4410 { | |
4411 Player *v2; // ebx@1 | |
4412 signed int v3; // esi@1 | |
4413 enum CHARACTER_RACE v4; // eax@1 | |
4414 signed int v5; // edi@8 | |
4415 char v6; // zf@9 | |
4416 int v7; // esi@20 | |
4417 int result; // eax@21 | |
4418 signed int v9; // [sp-4h] [bp-10h]@11 | |
4419 | |
4420 v2 = this; | |
4421 v3 = 0; | |
4422 v4 = GetRace(); | |
4423 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4424 { | |
4425 v5 = 0; | |
4426 goto LABEL_16; | |
4427 } | |
4428 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4429 { | |
4430 v5 = 1; | |
4431 LABEL_16: | |
4432 v6 = v4 == 2; | |
4433 goto LABEL_17; | |
4434 } | |
4435 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4436 { | |
4437 v6 = v4 == 3; | |
4438 v5 = 2; | |
4439 goto LABEL_17; | |
4440 } | |
4441 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4442 { | |
4443 v5 = 3; | |
4444 v6 = v4 == 3; | |
4445 goto LABEL_17; | |
4446 } | |
4447 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4448 { | |
4449 v5 = 7; | |
4450 if ( v4 != 1 ) | |
4451 goto LABEL_20; | |
4452 v9 = 10; | |
4453 LABEL_19: | |
4454 v3 = v9; | |
4455 goto LABEL_20; | |
4456 } | |
4457 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4458 { | |
4459 v5 = 8; | |
4460 v6 = v4 == 0; | |
4461 LABEL_17: | |
4462 if ( !v6 ) | |
4463 goto LABEL_20; | |
4464 v9 = 5; | |
4465 goto LABEL_19; | |
4466 } | |
4467 v5 = 0; | |
4468 LABEL_20: | |
4469 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4470 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4471 result = v7 + *(&v2->sResFireBase + v5); |
4472 return result; | |
4473 } | |
4474 | |
4475 //----- (0048E7D0) -------------------------------------------------------- | |
4476 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4477 { | |
4478 signed int v2; // edi@1 | |
4479 Player *v3; // esi@1 | |
4480 enum CHARACTER_RACE v4; // ebx@1 | |
4481 Player *v5; // ecx@8 | |
4482 char v6; // zf@18 | |
4483 int v7; // ebx@28 | |
4484 int result; // eax@28 | |
4485 signed int v9; // [sp+10h] [bp-8h]@1 | |
4486 signed int v10; // [sp+14h] [bp-4h]@1 | |
4487 | |
4488 v2 = 0; | |
4489 v3 = this; | |
4490 v10 = 0; | |
4491 v9 = 0; | |
4492 v4 = GetRace(); | |
652 | 4493 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4494 v10 = 20; |
4495 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4496 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4497 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4498 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4499 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4500 && HasItemEquipped(EQUIP_ARMOUR) | |
4501 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4502 v10 += v3->pActiveSkills[9] & 0x3F; | |
4503 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4504 goto LABEL_25; | |
4505 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4506 { | |
4507 v2 = 1; | |
4508 LABEL_25: | |
4509 v6 = v4 == 2; | |
4510 LABEL_26: | |
4511 if ( v6 ) | |
4512 v9 = 5; | |
4513 goto LABEL_28; | |
4514 } | |
4515 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4516 { | |
4517 v6 = v4 == 3; | |
4518 v2 = 2; | |
4519 goto LABEL_26; | |
4520 } | |
4521 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4522 { | |
4523 v2 = 3; | |
4524 if ( v4 == 3 ) | |
4525 v10 += 5; | |
4526 } | |
4527 else | |
4528 { | |
4529 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4530 { | |
4531 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4532 goto LABEL_28; | |
4533 v2 = 8; | |
4534 v6 = v4 == 0; | |
4535 goto LABEL_26; | |
4536 } | |
4537 v2 = 7; | |
4538 if ( v4 == 1 ) | |
4539 v9 = 10; | |
4540 } | |
4541 LABEL_28: | |
4542 v7 = GetItemsBonus(a2, 0); | |
4543 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4544 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4545 { |
4546 if ( result > 200 ) | |
4547 result = 200; | |
4548 } | |
4549 return result; | |
4550 } | |
4551 | |
4552 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4553 bool Player::Recover(int dt) |
4554 { | |
4555 //Player *v2; // esi@1 | |
0 | 4556 signed __int64 v3; // qax@1 |
816 | 4557 //bool result; // eax@4 |
4558 | |
4559 //v2 = this; | |
4560 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4561 | |
4562 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4563 | |
4564 if (uTimeToRecovery > v3) | |
4565 { | |
4566 uTimeToRecovery -= v3; | |
4567 return true; | |
0 | 4568 } |
4569 else | |
4570 { | |
816 | 4571 uTimeToRecovery = 0; |
4572 viewparams->bRedrawGameUI = true; | |
4573 if (!uActiveCharacter) | |
0 | 4574 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4575 return false; |
4576 } | |
0 | 4577 } |
4578 | |
4579 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4580 void Player::SetRecoveryTime(signed int rec) |
4581 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4582 assert(rec >= 0); |
816 | 4583 |
4584 if (rec > uTimeToRecovery) | |
4585 uTimeToRecovery = rec; | |
4586 | |
4587 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4588 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4589 |
4590 viewparams->bRedrawGameUI = true; | |
0 | 4591 } |
4592 // 50C0C4: using guessed type int some_active_character; | |
4593 | |
4594 //----- (0048E9B7) -------------------------------------------------------- | |
4595 void Player::RandomizeName() | |
4596 { | |
4597 if (!uExpressionTimePassed) | |
4598 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4599 } | |
4600 | |
4601 //----- (0048E9F4) -------------------------------------------------------- | |
4602 unsigned int Player::GetMajorConditionIdx() | |
4603 { | |
4604 for (uint i = 0; i < 18; ++i) | |
4605 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4606 return pConditionImportancyTable[i]; | |
4607 | |
4608 return 18; | |
4609 } | |
4610 | |
4611 //----- (0048EA1B) -------------------------------------------------------- | |
4612 int Player::_48EA1B_get_static_effect(int a2) | |
4613 { | |
4614 __int16 v2; // cx@1 | |
4615 int v3; // eax@1 | |
4616 | |
4617 v2 = word_4EDFFC[0]; | |
4618 v3 = 0; | |
4619 while ( a2 < v2 && v2 ) | |
4620 v2 = word_4EDFFC[v3++ + 1]; | |
4621 return player_stat_bonuses[v3]; | |
4622 } | |
4623 | |
4624 //----- (0048EA46) -------------------------------------------------------- | |
4625 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4626 { | |
4627 int v3; // esi@1 | |
4628 int v4; // edx@2 | |
4629 int v5; // eax@3 | |
4630 char *v6; // eax@4 | |
4631 | |
4632 v3 = 0; | |
4633 while ( 1 ) | |
4634 { | |
4635 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4636 goto LABEL_11; | |
816 | 4637 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4638 if ( a2 != 17 ) |
816 | 4639 { |
4640 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4641 goto LABEL_11; | |
4642 return 5; | |
4643 } | |
0 | 4644 v6 = (char *)this + 36 * v5; |
4645 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4646 return 50; | |
4647 LABEL_11: | |
4648 ++v3; | |
4649 if ( (signed int)v3 >= 16 ) | |
816 | 4650 return 0; |
4651 } | |
0 | 4652 } |
4653 | |
4654 //----- (0048EAAE) -------------------------------------------------------- | |
4655 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4656 { | |
4657 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4658 signed int v4; // eax@1 | |
4659 int v5; // edi@1 | |
4660 Player *v6; // ebx@1 | |
4661 Player *v8; // ecx@48 | |
4662 int v9; // eax@49 | |
4663 int v10; // edx@49 | |
4664 Player *v11; // ecx@55 | |
4665 int v12; // eax@56 | |
4666 int v13; // edx@56 | |
4667 int v14; // ecx@58 | |
4668 int v15; // eax@58 | |
4669 Player *v16; // ecx@61 | |
4670 int v17; // eax@62 | |
4671 Player *v18; // ecx@66 | |
4672 int v19; // eax@67 | |
4673 int v20; // eax@69 | |
4674 Player *v21; // ecx@75 | |
4675 int v22; // eax@76 | |
4676 int v23; // edx@76 | |
4677 int v24; // eax@79 | |
4678 int v25; // ecx@80 | |
4679 int v26; // edi@80 | |
4680 Player *v27; // ecx@84 | |
4681 int v28; // eax@85 | |
4682 int v29; // edx@85 | |
4683 Player *v30; // ecx@96 | |
4684 int v31; // ebp@97 | |
4685 int v32; // eax@98 | |
4686 unsigned int v33; // eax@100 | |
4687 int v34; // eax@103 | |
4688 char v35; // zf@104 | |
4689 char v36; // zf@107 | |
4690 unsigned __int8 v37; // zf@119 | |
4691 char v38; // sf@119 | |
4692 unsigned __int8 v39; // of@119 | |
4693 char v40; // zf@122 | |
4694 char v41; // zf@145 | |
4695 char v42; // zf@164 | |
4696 char v43; // zf@173 | |
4697 char v44; // zf@189 | |
4698 char v45; // zf@198 | |
4699 char v46; // zf@239 | |
4700 int v47; // eax@268 | |
4701 int v48; // eax@269 | |
4702 int v49; // eax@291 | |
4703 char v50; // zf@295 | |
4704 int v51; // eax@306 | |
4705 int v52; // eax@307 | |
4706 char v53; // zf@312 | |
4707 char v54; // zf@336 | |
4708 char v55; // zf@348 | |
4709 int v56; // eax@365 | |
4710 int v57; // ebx@368 | |
4711 signed int v58; // [sp-4h] [bp-20h]@10 | |
4712 signed int v59; // [sp-4h] [bp-20h]@71 | |
4713 signed int v60; // [sp-4h] [bp-20h]@347 | |
4714 int v61; // [sp+10h] [bp-Ch]@1 | |
4715 int v62; // [sp+14h] [bp-8h]@1 | |
4716 int v63; // [sp+18h] [bp-4h]@101 | |
4717 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4718 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4719 | |
4720 v3 = attr; | |
4721 v4 = 36; | |
4722 v5 = 0; | |
4723 v6 = this; | |
4724 v62 = 0; | |
4725 v61 = 0; | |
4726 | |
4727 switch (attr) | |
4728 { | |
4729 case CHARACTER_ATTRIBUTE_LEVEL: | |
4730 if (HasEnchantedItemEquipped(25)) | |
4731 return 5; | |
4732 return 0; | |
4733 }; | |
4734 | |
4735 if ( (signed int)attr > 36 ) | |
4736 { | |
4737 switch ( attr ) | |
4738 { | |
4739 case 37: | |
4740 v58 = 15; | |
4741 goto LABEL_35; | |
4742 case 38: | |
4743 v58 = 16; | |
4744 goto LABEL_35; | |
4745 case 39: | |
4746 v58 = 17; | |
4747 goto LABEL_35; | |
4748 case 40: | |
4749 v58 = 18; | |
4750 goto LABEL_35; | |
4751 case 41: | |
4752 v58 = 19; | |
4753 goto LABEL_35; | |
4754 case 42: | |
4755 v58 = 20; | |
4756 goto LABEL_35; | |
4757 case 43: | |
4758 v58 = 25; | |
4759 goto LABEL_35; | |
4760 case 44: | |
4761 v58 = 5; | |
4762 goto LABEL_35; | |
4763 case 45: | |
4764 v58 = 8; | |
4765 goto LABEL_35; | |
4766 case 46: | |
4767 goto LABEL_36; | |
4768 default: | |
4769 break; | |
4770 } | |
4771 } | |
4772 else | |
4773 { | |
4774 if ( attr == 36 ) | |
4775 { | |
4776 v58 = 14; | |
4777 } | |
4778 else | |
4779 { | |
4780 if ( (signed int)attr > 21 ) | |
4781 { | |
4782 switch ( attr ) | |
4783 { | |
4784 case 22: | |
4785 v58 = 30; | |
4786 break; | |
4787 case 23: | |
4788 v58 = 31; | |
4789 break; | |
4790 case 34: | |
4791 v58 = 12; | |
4792 break; | |
4793 default: | |
4794 if ( attr != 35 ) | |
4795 goto LABEL_38; | |
4796 v58 = 13; | |
4797 break; | |
4798 } | |
4799 } | |
4800 else | |
4801 { | |
4802 switch ( attr ) | |
4803 { | |
4804 case 21: | |
4805 v58 = 33; | |
4806 break; | |
4807 case 16: | |
4808 v58 = 35; | |
4809 break; | |
4810 case 17: | |
4811 v58 = 34; | |
4812 break; | |
4813 case 18: | |
4814 v58 = 29; | |
4815 break; | |
4816 case 19: | |
4817 v58 = 21; | |
4818 break; | |
4819 default: | |
4820 if ( attr != 20 ) | |
4821 goto LABEL_38; | |
4822 v58 = 32; | |
4823 break; | |
4824 } | |
4825 } | |
4826 } | |
4827 LABEL_35: | |
4828 v4 = v58; | |
4829 LABEL_36: | |
4830 if ( !this->pActiveSkills[v4] ) | |
4831 return 0; | |
4832 } | |
4833 LABEL_38: | |
4834 if ( (signed int)attr > 28 ) | |
4835 { | |
4836 if ( (signed int)attr < 29 ) | |
4837 return v5 + v62 + v61; | |
4838 if ( (signed int)attr <= 30 ) | |
4839 { | |
4840 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4841 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4842 return v5 + v62 + v61; |
4843 } | |
4844 if ( attr == 31 ) | |
4845 { | |
4846 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4847 return v5 + v62 + v61; | |
232 | 4848 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4849 v5 = pItemsTable->pItems[v57].uDamageMod; |
4850 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4851 goto LABEL_366; | |
4852 } | |
4853 if ( attr == 32 ) | |
4854 { | |
4855 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4856 return v5 + v62 + v61; | |
232 | 4857 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4858 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4859 LABEL_365: | |
4860 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4861 LABEL_366: | |
4862 v5 += v56; | |
4863 return v5 + v62 + v61; | |
4864 } | |
4865 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4866 return v5 + v62 + v61; | |
4867 LABEL_95: | |
4868 v65 = 0; | |
4869 while ( 1 ) | |
4870 { | |
4871 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4872 goto LABEL_361; | |
898 | 4873 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4874 if ( v3 == 9 ) |
4875 { | |
816 | 4876 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4877 if ( v32 >= 3 ) |
4878 { | |
4879 if ( v32 <= 11 ) | |
4880 { | |
4881 v33 = v6->pInventoryItems[v31].uItemID; | |
4882 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4883 } | |
4884 } | |
4885 } | |
4886 v63 = (int)((char *)v6 + 36 * v31); | |
4887 attra = (ItemGen *)(v63 + 532); | |
377 | 4888 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4889 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4890 { |
4891 v34 = attra->uItemID; | |
4892 switch ( attra->uItemID ) | |
4893 { | |
4894 case 0x1F4u: | |
4895 v35 = v3 == 5; | |
4896 goto LABEL_105; | |
4897 case 0x1F5u: | |
4898 v36 = v3 == 0; | |
4899 goto LABEL_108; | |
4900 case 0x1F6u: | |
4901 if ( v3 == 21 ) | |
4902 v61 += 10; | |
4903 v36 = v3 == 2; | |
4904 goto LABEL_108; | |
4905 case 0x1F7u: | |
4906 if ( v3 == 17 ) | |
4907 v61 += 5; | |
4908 if ( v3 == 18 ) | |
4909 v61 += 5; | |
4910 v36 = v3 == 6; | |
4911 goto LABEL_108; | |
4912 case 0x1F8u: | |
4913 goto LABEL_118; | |
4914 case 0x1F9u: | |
4915 v40 = v3 == 3; | |
4916 goto LABEL_123; | |
4917 case 0x1FAu: | |
4918 v35 = v3 == 10; | |
4919 goto LABEL_105; | |
4920 case 0x1FEu: | |
4921 v35 = v3 == 4; | |
4922 goto LABEL_105; | |
4923 case 0x1FFu: | |
4924 if ( v3 == 23 ) | |
4925 v61 += 10; | |
4926 if ( v3 == 22 ) | |
4927 v61 += 10; | |
4928 goto LABEL_361; | |
4929 case 0x200u: | |
4930 if ( v3 == 36 ) | |
4931 { | |
4932 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4933 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4934 } | |
4935 v36 = v3 == 5; | |
4936 LABEL_108: | |
4937 if ( v36 ) | |
4938 v5 += 40; | |
4939 goto LABEL_361; | |
4940 case 0x201u: | |
4941 if ( v3 == 39 ) | |
4942 { | |
4943 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4944 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4945 v62 = v34; | |
4946 } | |
4947 goto LABEL_136; | |
4948 case 0x202u: | |
4949 if ( !v3 ) | |
4950 v5 += 150; | |
4951 if ( v3 == 1 ) | |
4952 v5 -= 40; | |
4953 if ( v3 == 2 ) | |
4954 v5 -= 40; | |
4955 goto LABEL_145; | |
4956 case 0x203u: | |
4957 if ( v3 == 42 ) | |
4958 { | |
4959 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4960 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4961 } | |
4962 if ( v3 == 43 ) | |
4963 v61 += 15; | |
4964 goto LABEL_361; | |
4965 case 0x204u: | |
4966 if ( v3 == 17 ) | |
4967 v61 += 5; | |
4968 if ( v3 == 18 ) | |
4969 v61 += 5; | |
4970 if ( v3 == 6 ) | |
4971 v5 += 50; | |
4972 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4973 goto LABEL_166; | |
4974 v42 = v3 == 15; | |
4975 goto LABEL_165; | |
4976 case 0x205u: | |
4977 if ( v3 == 18 ) | |
4978 v61 += 5; | |
4979 goto LABEL_361; | |
4980 case 0x206u: | |
4981 if ( !v3 ) | |
4982 v5 += 100; | |
4983 if ( v3 == 3 ) | |
4984 v5 += 100; | |
4985 v43 = v3 == 9; | |
4986 goto LABEL_174; | |
4987 case 0x207u: | |
4988 if ( v3 == 45 ) | |
4989 v61 += 5; | |
4990 if ( v3 == 15 ) | |
4991 v5 -= 10; | |
4992 v42 = v3 == 14; | |
4993 LABEL_165: | |
4994 if ( v42 ) | |
4995 LABEL_166: | |
4996 v5 -= 10; | |
4997 goto LABEL_361; | |
4998 case 0x208u: | |
4999 v35 = v3 == 3; | |
5000 goto LABEL_105; | |
5001 case 0x209u: | |
5002 if ( v3 == 2 ) | |
5003 v5 += 15; | |
5004 if ( !v3 ) | |
5005 v5 += 15; | |
5006 v41 = v3 == 6; | |
5007 goto LABEL_146; | |
5008 case 0x20Au: | |
5009 if ( v3 == 46 ) | |
5010 v61 += 15; | |
5011 v44 = v3 == 3; | |
5012 goto LABEL_190; | |
5013 case 0x20Bu: | |
5014 if ( v3 == 34 ) | |
5015 { | |
5016 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5017 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5018 } | |
5019 if ( v3 == 12 ) | |
5020 v5 += 50; | |
5021 if ( v3 == 2 ) | |
5022 v5 += 30; | |
5023 v45 = v3 == 9; | |
5024 goto LABEL_199; | |
5025 case 0x20Cu: | |
5026 if ( !v3 ) | |
5027 v5 += 75; | |
5028 goto LABEL_145; | |
5029 case 0x20Du: | |
5030 if ( v3 == 5 ) | |
5031 v5 += 50; | |
5032 if ( v3 == 6 ) | |
5033 v5 += 50; | |
5034 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5035 goto LABEL_374; | |
5036 v43 = v3 == 15; | |
5037 LABEL_174: | |
5038 if ( v43 ) | |
5039 LABEL_374: | |
5040 v5 -= 15; | |
5041 goto LABEL_361; | |
5042 case 0x20Eu: | |
5043 if ( v3 == 4 ) | |
5044 v5 += 150; | |
5045 if ( v3 == 44 ) | |
5046 v61 += 5; | |
5047 if ( v3 == 9 ) | |
5048 v5 -= 25; | |
5049 goto LABEL_361; | |
5050 case 0x20Fu: | |
5051 if ( v3 == 39 ) | |
5052 { | |
5053 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5054 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5055 v62 = v34; | |
5056 } | |
5057 if ( v3 == 40 ) | |
5058 { | |
5059 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5060 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5061 } | |
5062 LABEL_145: | |
5063 v41 = v3 == 5; | |
5064 LABEL_146: | |
5065 if ( v41 ) | |
5066 v5 -= 40; | |
5067 goto LABEL_361; | |
5068 case 0x210u: | |
5069 if ( v3 == 38 ) | |
5070 { | |
5071 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5072 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5073 } | |
5074 if ( !v3 ) | |
5075 v5 += 75; | |
5076 v44 = v3 == 11; | |
5077 LABEL_190: | |
5078 if ( v44 ) | |
5079 v5 -= 50; | |
5080 goto LABEL_361; | |
5081 case 0x211u: | |
5082 if ( v3 == 5 ) | |
5083 v5 += 100; | |
5084 if ( v3 == 4 ) | |
5085 v5 += 50; | |
5086 v35 = v3 == 11; | |
5087 LABEL_105: | |
5088 if ( v35 ) | |
5089 v5 += 50; | |
5090 goto LABEL_361; | |
5091 case 0x212u: | |
5092 if ( v3 == 1 ) | |
5093 v5 -= 20; | |
5094 v45 = v3 == 2; | |
5095 LABEL_199: | |
5096 if ( v45 ) | |
5097 v5 -= 20; | |
5098 goto LABEL_361; | |
5099 case 0x214u: | |
5100 if ( v3 == 1 ) | |
5101 v5 += 15; | |
5102 v46 = v3 == 2; | |
5103 goto LABEL_240; | |
5104 case 0x215u: | |
5105 if ( v3 == 5 ) | |
5106 v5 += 15; | |
5107 v46 = v3 == 4; | |
5108 goto LABEL_240; | |
5109 case 0x216u: | |
5110 if ( v3 == 10 ) | |
5111 v5 += 30; | |
5112 if ( !v3 ) | |
5113 v5 += 15; | |
5114 goto LABEL_315; | |
5115 case 0x217u: | |
5116 if ( v3 == 21 ) | |
5117 v61 += 5; | |
5118 if ( !v3 ) | |
5119 v5 += 15; | |
5120 goto LABEL_253; | |
5121 case 0x218u: | |
5122 goto LABEL_253; | |
5123 default: | |
5124 goto LABEL_361; | |
5125 } | |
5126 goto LABEL_361; | |
5127 } | |
5128 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5129 { | |
5130 if ( (signed int)v3 >= 0 ) | |
5131 { | |
5132 if ( (signed int)v3 <= 15 ) | |
5133 { | |
5134 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5135 } | |
5136 else | |
5137 { | |
5138 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5139 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5140 } | |
5141 } | |
5142 goto LABEL_361; | |
5143 } | |
5144 v34 = *(int *)(v63 + 544); | |
5145 if ( v34 > 48 ) | |
5146 { | |
5147 switch ( v34 ) | |
5148 { | |
5149 case 54: | |
5150 goto LABEL_315; | |
5151 case 49: | |
5152 if ( v3 == 6 ) | |
5153 goto LABEL_121; | |
5154 v50 = v3 == 1; | |
5155 goto LABEL_296; | |
5156 case 51: | |
5157 if ( v3 != 5 && v3 != 1 ) | |
5158 goto LABEL_309; | |
5159 goto LABEL_121; | |
5160 case 52: | |
5161 if ( v3 == 3 ) | |
5162 goto LABEL_121; | |
5163 v50 = v3 == 4; | |
5164 goto LABEL_296; | |
5165 case 53: | |
5166 if ( !v3 ) | |
5167 goto LABEL_121; | |
5168 v50 = v3 == 2; | |
5169 goto LABEL_296; | |
5170 case 55: | |
5171 v46 = v3 == 6; | |
5172 goto LABEL_240; | |
5173 case 56: | |
5174 if ( !v3 ) | |
5175 goto LABEL_351; | |
5176 v53 = v3 == 3; | |
5177 goto LABEL_350; | |
5178 case 57: | |
5179 if ( v3 == 1 ) | |
5180 goto LABEL_351; | |
5181 v53 = v3 == 2; | |
5182 goto LABEL_350; | |
5183 case 50: | |
5184 if ( v3 == 10 ) | |
5185 v5 += 30; | |
5186 goto LABEL_361; | |
5187 case 60: | |
5188 if ( v3 != 23 ) | |
5189 goto LABEL_336; | |
5190 if ( v5 >= 3 ) | |
5191 goto LABEL_361; | |
5192 v5 = 3; | |
5193 LABEL_336: | |
5194 v54 = v3 == 22; | |
5195 goto LABEL_345; | |
5196 case 61: | |
5197 if ( v3 != 17 ) | |
5198 goto LABEL_340; | |
5199 if ( v5 >= 3 ) | |
5200 goto LABEL_361; | |
5201 v5 = 3; | |
5202 LABEL_340: | |
5203 v54 = v3 == 18; | |
5204 goto LABEL_345; | |
5205 case 62: | |
5206 if ( v3 != 19 ) | |
5207 goto LABEL_344; | |
5208 if ( v5 >= 3 ) | |
5209 goto LABEL_361; | |
5210 v5 = 3; | |
5211 LABEL_344: | |
5212 v54 = v3 == 20; | |
5213 LABEL_345: | |
5214 if ( !v54 ) | |
5215 goto LABEL_361; | |
5216 if ( v5 >= 3 ) | |
5217 goto LABEL_361; | |
5218 v60 = 3; | |
5219 goto LABEL_360; | |
5220 case 67: | |
5221 v55 = v3 == 18; | |
5222 goto LABEL_357; | |
5223 case 68: | |
5224 v53 = v3 == 9; | |
5225 goto LABEL_350; | |
5226 case 69: | |
5227 if ( v3 == 11 ) | |
5228 v5 += 20; | |
5229 break; | |
5230 case 70: | |
5231 if ( v3 == 12 ) | |
5232 v5 += 10; | |
5233 v55 = v3 == 16; | |
5234 LABEL_357: | |
5235 if ( v55 && v5 < 2 ) | |
5236 { | |
5237 v60 = 2; | |
5238 LABEL_360: | |
5239 v5 = v60; | |
5240 } | |
5241 break; | |
5242 default: | |
5243 goto LABEL_361; | |
5244 } | |
5245 goto LABEL_361; | |
5246 } | |
5247 if ( v34 == 48 ) | |
5248 { | |
5249 if ( v3 == 9 ) | |
5250 v5 += 5; | |
5251 LABEL_315: | |
5252 v46 = v3 == 3; | |
5253 LABEL_240: | |
5254 if ( v46 ) | |
5255 v5 += 15; | |
5256 goto LABEL_361; | |
5257 } | |
5258 if ( v34 > 32 ) | |
5259 { | |
5260 if ( v34 > 44 ) | |
5261 { | |
5262 v51 = v34 - 45; | |
5263 if ( !v51 ) | |
5264 { | |
5265 if ( v3 == 5 ) | |
5266 goto LABEL_351; | |
5267 v53 = v3 == 4; | |
5268 LABEL_350: | |
5269 if ( v53 ) | |
5270 LABEL_351: | |
5271 v5 += 5; | |
5272 goto LABEL_361; | |
5273 } | |
5274 v52 = v51 - 1; | |
5275 if ( !v52 ) | |
5276 { | |
5277 v40 = v3 == 0; | |
5278 LABEL_123: | |
5279 if ( v40 ) | |
5280 v5 += 25; | |
5281 goto LABEL_361; | |
5282 } | |
5283 if ( v52 == 1 ) | |
5284 { | |
5285 LABEL_309: | |
5286 v50 = v3 == 8; | |
5287 goto LABEL_296; | |
5288 } | |
5289 } | |
5290 else | |
5291 { | |
5292 if ( v34 == 44 ) | |
5293 { | |
5294 v50 = v3 == 7; | |
5295 goto LABEL_296; | |
5296 } | |
5297 v34 -= 33; | |
5298 if ( !v34 ) | |
5299 { | |
5300 if ( v3 != 38 ) | |
5301 goto LABEL_361; | |
5302 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5303 goto LABEL_138; | |
5304 } | |
5305 --v34; | |
5306 if ( !v34 ) | |
5307 { | |
5308 if ( v3 != 36 ) | |
5309 goto LABEL_361; | |
5310 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5311 goto LABEL_138; | |
5312 } | |
5313 v49 = v34 - 8; | |
5314 if ( !v49 ) | |
5315 { | |
5316 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5317 ++v5; | |
5318 goto LABEL_361; | |
5319 } | |
5320 if ( v49 == 1 ) | |
5321 { | |
5322 if ( v3 != 3 && v3 != 7 ) | |
5323 { | |
5324 v50 = v3 == 9; | |
5325 LABEL_296: | |
5326 if ( !v50 ) | |
5327 goto LABEL_361; | |
5328 } | |
5329 LABEL_121: | |
5330 v5 += 10; | |
5331 goto LABEL_361; | |
5332 } | |
5333 } | |
5334 } | |
5335 else | |
5336 { | |
5337 if ( v34 == 32 ) | |
5338 { | |
5339 if ( v3 != 39 ) | |
5340 goto LABEL_361; | |
5341 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5342 goto LABEL_138; | |
5343 } | |
5344 if ( v34 > 28 ) | |
5345 { | |
5346 v34 -= 29; | |
5347 if ( v34 ) | |
5348 { | |
5349 --v34; | |
5350 if ( v34 ) | |
5351 { | |
5352 --v34; | |
5353 if ( v34 || v3 != 41 ) | |
5354 goto LABEL_361; | |
5355 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5356 } | |
5357 else | |
5358 { | |
5359 if ( v3 != 34 ) | |
5360 goto LABEL_361; | |
5361 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5362 } | |
5363 } | |
5364 else | |
5365 { | |
5366 if ( v3 != 37 ) | |
5367 goto LABEL_361; | |
5368 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5369 } | |
5370 goto LABEL_138; | |
5371 } | |
5372 if ( v34 == 28 ) | |
5373 { | |
5374 LABEL_136: | |
5375 if ( v3 == 42 ) | |
5376 { | |
5377 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5378 LABEL_138: | |
5379 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5380 goto LABEL_361; | |
5381 } | |
5382 } | |
5383 else | |
5384 { | |
5385 v47 = v34 - 1; | |
5386 if ( v47 ) | |
5387 { | |
5388 v48 = v47 - 1; | |
5389 if ( v48 ) | |
5390 { | |
5391 v34 = v48 - 24; | |
5392 if ( v34 ) | |
5393 { | |
5394 --v34; | |
5395 if ( v34 || v3 != 40 ) | |
5396 goto LABEL_361; | |
5397 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5398 } | |
5399 else | |
5400 { | |
5401 if ( v3 != 35 ) | |
5402 goto LABEL_361; | |
5403 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5404 } | |
5405 goto LABEL_138; | |
5406 } | |
5407 LABEL_118: | |
5408 if ( (signed int)v3 < 0 ) | |
5409 goto LABEL_361; | |
5410 v39 = __OFSUB__((int)v3, 6); | |
5411 v37 = v3 == 6; | |
5412 v38 = v3 - 6 < 0; | |
5413 } | |
5414 else | |
5415 { | |
5416 LABEL_253: | |
5417 if ( (signed int)v3 < 10 ) | |
5418 goto LABEL_361; | |
5419 v39 = __OFSUB__((int)v3, 15); | |
5420 v37 = v3 == 15; | |
5421 v38 = v3 - 15 < 0; | |
5422 } | |
5423 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5424 goto LABEL_121; | |
5425 } | |
5426 } | |
5427 LABEL_361: | |
5428 ++v65; | |
5429 if ( (signed int)v65 >= 16 ) | |
5430 return v5 + v62 + v61; | |
5431 } | |
5432 } | |
5433 if ( attr == 28 ) | |
5434 { | |
5435 if ( IsUnarmed() != 1 ) | |
5436 { | |
816 | 5437 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5438 { | |
5439 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5440 if ( v22 >= 0 ) |
5441 { | |
5442 if ( v22 <= 2 ) | |
5443 { | |
118 | 5444 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5445 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5446 { |
5447 v24 = v23; | |
5448 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5449 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5450 } | |
5451 else | |
5452 { | |
5453 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5454 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5455 } | |
5456 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5457 } | |
5458 } | |
5459 } | |
865 | 5460 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5461 return v5 + v62 + v61; |
5462 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5463 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5464 goto LABEL_88; | |
5465 } | |
5466 v59 = 3; | |
5467 LABEL_74: | |
5468 v5 = v59; | |
5469 return v5 + v62 + v61; | |
5470 } | |
5471 if ( (signed int)attr < 0 ) | |
5472 return v5 + v62 + v61; | |
5473 if ( (signed int)attr <= 23 ) | |
5474 goto LABEL_95; | |
5475 if ( (signed int)attr <= 24 ) | |
5476 return v5 + v62 + v61; | |
5477 if ( (signed int)attr <= 26 ) | |
5478 { | |
5479 if ( IsUnarmed() == 1 ) | |
5480 { | |
5481 v5 = 0; | |
5482 return v5 + v62 + v61; | |
5483 } | |
816 | 5484 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5485 { | |
5486 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5487 if ( v17 >= 0 ) |
5488 { | |
5489 if ( v17 <= 2 ) | |
232 | 5490 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5491 } |
5492 } | |
865 | 5493 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5494 return v5 + v62 + v61; |
898 | 5495 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5496 goto LABEL_365; |
5497 } | |
5498 if ( attr == 27 ) | |
5499 { | |
5500 if ( IsUnarmed() == 1 ) | |
5501 { | |
5502 v5 = 1; | |
5503 return v5 + v62 + v61; | |
5504 } | |
816 | 5505 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5506 { | |
5507 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5508 if ( v9 >= 0 ) |
5509 { | |
5510 if ( v9 <= 2 ) | |
5511 { | |
118 | 5512 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
898 | 5513 if ( !v6->pEquipment.uShield ) |
0 | 5514 { |
118 | 5515 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5516 ++v5; |
5517 } | |
5518 } | |
5519 } | |
5520 } | |
865 | 5521 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5522 return v5 + v62 + v61; |
898 | 5523 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5524 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5525 LABEL_88: |
5526 v5 += v15 + v14; | |
5527 } | |
5528 return v5 + v62 + v61; | |
5529 } | |
5530 | |
5531 //----- (0048F73C) -------------------------------------------------------- | |
5532 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5533 { | |
5534 int result; // eax@1 | |
5535 int v3; // eax@4 | |
5536 int v4; // ecx@5 | |
5537 | |
5538 switch (a2) | |
5539 { | |
5540 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5541 } | |
5542 | |
5543 result = 0; | |
5544 if ( (signed int)a2 > 10 ) | |
5545 { | |
5546 if ( (signed int)a2 <= 15 ) | |
5547 { | |
5548 switch ( a2 ) | |
5549 { | |
5550 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5551 v3 = this->pPlayerBuffs[2].uPower; | |
5552 v4 = pParty->pPartyBuffs[1].uPower; | |
5553 break; | |
5554 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5555 v3 = this->pPlayerBuffs[0].uPower; | |
5556 v4 = pParty->pPartyBuffs[0].uPower; | |
5557 break; | |
5558 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5559 v3 = this->pPlayerBuffs[22].uPower; | |
5560 v4 = pParty->pPartyBuffs[17].uPower; | |
5561 break; | |
5562 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5563 v3 = this->pPlayerBuffs[3].uPower; | |
5564 v4 = pParty->pPartyBuffs[4].uPower; | |
5565 break; | |
5566 default: | |
5567 if ( a2 != 14 ) | |
5568 return result; | |
5569 v3 = this->pPlayerBuffs[9].uPower; | |
5570 v4 = pParty->pPartyBuffs[12].uPower; | |
5571 break; | |
5572 } | |
5573 return v4 + v3; | |
5574 } | |
5575 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5576 { | |
5577 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5578 { | |
5579 v3 = this->pPlayerBuffs[8].uPower; | |
5580 v4 = pParty->pPartyBuffs[9].uPower; | |
5581 return v4 + v3; | |
5582 } | |
5583 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5584 return result; | |
5585 } | |
5586 return this->pPlayerBuffs[1].uPower; | |
5587 } | |
5588 if ( a2 == 10 ) | |
5589 { | |
5590 v3 = this->pPlayerBuffs[5].uPower; | |
5591 v4 = pParty->pPartyBuffs[6].uPower; | |
5592 return v4 + v3; | |
5593 } | |
5594 switch ( a2 ) | |
5595 { | |
5596 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5597 v3 = pPlayerBuffs[19].uPower; | |
5598 goto LABEL_5; | |
5599 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5600 v3 = pPlayerBuffs[17].uPower; | |
5601 goto LABEL_5; | |
5602 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5603 v3 = pPlayerBuffs[20].uPower; | |
5604 goto LABEL_5; | |
5605 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5606 v3 = pPlayerBuffs[16].uPower; | |
5607 goto LABEL_5; | |
5608 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5609 v3 = pPlayerBuffs[15].uPower; | |
5610 goto LABEL_5; | |
5611 case CHARACTER_ATTRIBUTE_SPEED: | |
5612 v3 = pPlayerBuffs[21].uPower; | |
5613 goto LABEL_5; | |
5614 case CHARACTER_ATTRIBUTE_LUCK: | |
5615 v3 = pPlayerBuffs[18].uPower; | |
5616 LABEL_5: | |
5617 v4 = pParty->pPartyBuffs[2].uPower; | |
5618 return v4 + v3; | |
5619 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5620 v3 = this->pPlayerBuffs[14].uPower; | |
5621 v4 = pParty->pPartyBuffs[15].uPower; | |
5622 return v4 + v3; | |
5623 default: | |
5624 return result; | |
5625 } | |
5626 return result; | |
5627 } | |
5628 | |
5629 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5630 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5631 { | |
0 | 5632 signed int v2; // esi@1 |
5633 unsigned __int16 v3; // ax@126 | |
5634 char result; // al@127 | |
5635 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5636 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5637 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5638 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5639 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5640 | |
0 | 5641 v2 = 0; |
353 | 5642 switch (uSkillType) |
5643 { | |
5644 case PLAYER_SKILL_MONSTER_ID: | |
5645 { | |
652 | 5646 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5647 v2 = 6; |
652 | 5648 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5649 v2 += 6; |
5650 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5651 v2 += GetItemsBonus(v8, 0); | |
5652 } | |
5653 break; | |
5654 | |
5655 case PLAYER_SKILL_ARMSMASTER: | |
5656 { | |
652 | 5657 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5658 v2 = 2; |
652 | 5659 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5660 v2 += 3; |
353 | 5661 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5662 v2 += GetItemsBonus(v8, 0); | |
5663 } | |
5664 break; | |
5665 | |
5666 case PLAYER_SKILL_STEALING: | |
5667 { | |
652 | 5668 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5669 v2 = 8; |
5670 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5671 v2 += GetItemsBonus(v8, 0); | |
5672 } | |
5673 break; | |
5674 | |
5675 | |
5676 case PLAYER_SKILL_ALCHEMY: | |
5677 { | |
652 | 5678 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5679 v2 = 4; |
652 | 5680 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5681 v2 += 8; |
5682 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5683 v2 += GetItemsBonus(v8, 0); | |
5684 } | |
5685 break; | |
5686 | |
5687 case PLAYER_SKILL_LEARNING: | |
5688 { | |
652 | 5689 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5690 v2 = 10; |
652 | 5691 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5692 v2 += 15; |
652 | 5693 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5694 v2 += 5; |
5695 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5696 v2 += GetItemsBonus(v8, 0); | |
5697 } | |
5698 break; | |
5699 | |
5700 case PLAYER_SKILL_UNARMED: | |
5701 { | |
652 | 5702 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5703 v2 = 2; |
5704 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5705 v2 += GetItemsBonus(v8, 0); | |
5706 } | |
5707 break; | |
5708 | |
5709 case PLAYER_SKILL_DODGE: | |
5710 { | |
652 | 5711 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5712 v2 = 2; |
5713 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5714 v2 += GetItemsBonus(v8, 0); | |
5715 } | |
5716 break; | |
5717 | |
5718 case PLAYER_SKILL_BOW: | |
5719 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5720 v2 += GetItemsBonus(v8, 0); | |
5721 break; | |
5722 case PLAYER_SKILL_SHIELD: | |
5723 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5724 v2 += GetItemsBonus(v8, 0); | |
5725 break; | |
5726 | |
5727 case PLAYER_SKILL_EARTH: | |
652 | 5728 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5729 v2 = 2; |
652 | 5730 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5731 v2 += 3; |
652 | 5732 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5733 v2 += 4; |
5734 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5735 v2 += 3; | |
5736 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5737 v2 += GetItemsBonus(v8, 0); | |
5738 break; | |
5739 case PLAYER_SKILL_FIRE: | |
652 | 5740 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5741 v2 = 2; |
652 | 5742 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5743 v2 += 3; |
652 | 5744 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5745 v2 += 4; |
5746 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5747 v2 += 3; | |
5748 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5749 v2 += GetItemsBonus(v8, 0); | |
5750 break; | |
5751 case PLAYER_SKILL_AIR: | |
652 | 5752 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5753 v2 = 2; |
652 | 5754 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5755 v2 += 3; |
652 | 5756 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5757 v2 += 4; |
5758 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5759 v2 += 3; | |
5760 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5761 v2 += GetItemsBonus(v8, 0); | |
5762 break; | |
5763 case PLAYER_SKILL_WATER: | |
652 | 5764 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5765 v2 = 2; |
652 | 5766 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5767 v2 += 3; |
652 | 5768 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5769 v2 += 4; |
5770 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5771 v2 += 3; | |
5772 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5773 v2 += GetItemsBonus(v8, 0); | |
5774 break; | |
5775 case PLAYER_SKILL_SPIRIT: | |
652 | 5776 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5777 v2 = 2; |
652 | 5778 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5779 v2 += 3; |
652 | 5780 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5781 v2 += 4; |
5782 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5783 v2 += GetItemsBonus(v8, 0); | |
5784 break; | |
5785 case PLAYER_SKILL_MIND: | |
652 | 5786 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5787 v2 = 2; |
652 | 5788 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5789 v2 += 3; |
652 | 5790 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5791 v2 += 4; |
5792 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5793 v2 += GetItemsBonus(v8, 0); | |
5794 break; | |
5795 case PLAYER_SKILL_BODY: | |
652 | 5796 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5797 v2 = 2; |
652 | 5798 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5799 v2 += 3; |
652 | 5800 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5801 v2 += 4; |
5802 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5803 v2 += GetItemsBonus(v8, 0); | |
5804 break; | |
5805 case PLAYER_SKILL_LIGHT: | |
5806 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5807 v2 += GetItemsBonus(v8, 0); | |
5808 break; | |
5809 case PLAYER_SKILL_DARK: | |
5810 { | |
5811 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5812 v2 += GetItemsBonus(v8, 0); | |
5813 } | |
5814 break; | |
5815 | |
5816 case PLAYER_SKILL_MERCHANT: | |
5817 { | |
652 | 5818 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5819 v2 = 4; |
652 | 5820 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5821 v2 += 6; |
652 | 5822 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5823 v2 += 3; |
652 | 5824 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5825 v2 += 8; |
5826 } | |
5827 break; | |
5828 | |
5829 case PLAYER_SKILL_PERCEPTION: | |
5830 { | |
652 | 5831 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5832 v2 = 6; |
652 | 5833 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5834 v2 += 5; |
5835 } | |
5836 break; | |
5837 | |
0 | 5838 case PLAYER_SKILL_ITEM_ID: |
5839 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5840 v2 += GetItemsBonus(v8, 0); |
0 | 5841 break; |
5842 case PLAYER_SKILL_MEDITATION: | |
5843 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5844 v2 += GetItemsBonus(v8, 0); |
5845 break; | |
0 | 5846 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5847 { |
652 | 5848 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5849 v2 = 4; |
652 | 5850 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5851 v2 += 6; |
652 | 5852 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5853 v2 += 8; |
0 | 5854 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5855 v2 += GetItemsBonus(v8, 0); |
5856 } | |
5857 break; | |
5858 } | |
5859 | |
5860 v3 = pActiveSkills[uSkillType]; | |
1008 | 5861 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5862 result = v2 + v3; |
5863 else | |
1008 | 5864 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5865 return result; |
5866 } | |
5867 | |
5868 //----- (0048FC00) -------------------------------------------------------- | |
5869 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5870 { | |
5871 Player *v2; // esi@1 | |
5872 int v3; // eax@1 | |
5873 char v4; // di@1 | |
5874 signed int v5; // ebx@1 | |
5875 unsigned int v6; // eax@2 | |
5876 unsigned __int8 v7; // sf@5 | |
5877 unsigned __int8 v8; // of@5 | |
5878 PlayerEquipment *v9; // ebx@19 | |
5879 Player *v10; // ecx@20 | |
821 | 5880 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5881 int v12; // eax@21 |
5882 int v13; // edi@21 | |
5883 char v14; // di@25 | |
5884 signed int v15; // esi@25 | |
5885 char v16; // al@32 | |
5886 int v18; // eax@36 | |
5887 unsigned int v19; // eax@37 | |
5888 ITEM_EQUIP_TYPE v20; // edi@40 | |
5889 int v21; // edx@41 | |
5890 int v22; // eax@42 | |
821 | 5891 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5892 unsigned __int16 v24; // ax@45 |
5893 unsigned __int16 v25; // bx@45 | |
5894 unsigned int v26; // eax@45 | |
5895 unsigned __int8 v27; // sf@50 | |
5896 unsigned __int8 v28; // of@50 | |
5897 unsigned int v29; // eax@52 | |
5898 int v30; // eax@55 | |
5899 int v31; // eax@58 | |
5900 unsigned int v32; // eax@59 | |
5901 int v33; // eax@65 | |
5902 char v34; // si@65 | |
5903 ITEM_EQUIP_TYPE v35; // edi@69 | |
5904 int v36; // edx@70 | |
5905 int v37; // eax@71 | |
821 | 5906 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5907 int v39; // eax@74 |
5908 int v40; // eax@89 | |
5909 char v41; // si@89 | |
5910 int v42; // eax@96 | |
821 | 5911 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5912 int v44; // eax@97 |
5913 int v45; // eax@98 | |
5914 int v46; // eax@99 | |
5915 int v47; // eax@100 | |
5916 int v48; // eax@101 | |
5917 int v49; // eax@102 | |
5918 unsigned __int16 v50; // ax@113 | |
5919 char v51; // di@113 | |
5920 unsigned int v52; // eax@113 | |
5921 int v53; // edi@113 | |
5922 signed int i; // ecx@113 | |
5923 unsigned __int16 v55; // ax@118 | |
5924 char v56; // si@118 | |
5925 unsigned int v57; // eax@118 | |
5926 int v58; // esi@121 | |
5927 signed int j; // ecx@121 | |
5928 int v60; // edi@126 | |
5929 int v61; // eax@126 | |
5930 signed int v62; // [sp-4h] [bp-30h]@26 | |
5931 signed int v63; // [sp-4h] [bp-30h]@80 | |
5932 int v64; // [sp+Ch] [bp-20h]@104 | |
5933 int v65; // [sp+10h] [bp-1Ch]@104 | |
5934 int v66; // [sp+14h] [bp-18h]@104 | |
5935 int v67; // [sp+18h] [bp-14h]@104 | |
5936 int v68; // [sp+1Ch] [bp-10h]@69 | |
5937 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5938 int v70; // [sp+24h] [bp-8h]@1 | |
5939 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5940 int a1; // [sp+34h] [bp+8h]@21 | |
5941 int a1a; // [sp+34h] [bp+8h]@74 | |
5942 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5943 | |
5944 v2 = this; | |
5945 v70 = 0; | |
5946 v69 = 0; | |
5947 v71 = (ITEM_EQUIP_TYPE)0; | |
5948 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5949 v4 = v3; | |
5950 v5 = 1; | |
5951 if ( v3 ) | |
5952 { | |
5953 v6 = SkillToMastery(v3); | |
5954 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5955 { | |
5956 if ( (signed int)v6 >= 4 ) | |
5957 goto LABEL_4; | |
5958 v8 = __OFSUB__(v6, 3); | |
5959 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5960 } | |
5961 else | |
5962 { | |
5963 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5964 goto LABEL_11; | |
5965 if ( (signed int)v6 >= 4 ) | |
5966 { | |
5967 LABEL_4: | |
5968 v71 = (ITEM_EQUIP_TYPE)2; | |
5969 LABEL_11: | |
5970 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5971 goto LABEL_12; | |
5972 } | |
5973 v8 = __OFSUB__(v6, 2); | |
5974 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5975 } | |
5976 if ( !(v7 ^ v8) ) | |
5977 v71 = (ITEM_EQUIP_TYPE)1; | |
5978 goto LABEL_11; | |
5979 } | |
5980 LABEL_12: | |
5981 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5982 { | |
135 | 5983 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5984 v61 = v2->GetBodybuilding(); |
5985 return v60 * v61; | |
5986 } | |
5987 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5988 { | |
135 | 5989 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5990 v61 = v2->GetMeditation(); |
0 | 5991 return v60 * v61; |
5992 } | |
5993 if ( a2 != 9 ) | |
5994 { | |
5995 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5996 { | |
5997 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5998 return v70; | |
5999 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
6000 { | |
6001 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
6002 return v70; | |
6003 v71 = (ITEM_EQUIP_TYPE)0; | |
6004 v9 = &v2->pEquipment; | |
6005 while ( 1 ) | |
6006 { | |
6007 if ( v2->HasItemEquipped(v71) ) | |
6008 { | |
118 | 6009 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
6010 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 6011 a1 = v12; |
6012 SkillToMastery(v12); | |
6013 v13 = v11 - 5; | |
6014 if ( !v13 ) | |
6015 return a1 & 0x3F; | |
6016 if ( v13 == 2 ) | |
6017 break; | |
6018 } | |
6019 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
6020 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
6021 if ( (signed int)v71 >= 16 ) | |
6022 return v70; | |
6023 } | |
6024 v14 = a1; | |
6025 v15 = 1; | |
6026 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
6027 { | |
6028 v62 = 5; | |
6029 goto LABEL_31; | |
6030 } | |
6031 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6032 { | |
6033 v62 = 3; | |
6034 goto LABEL_31; | |
6035 } | |
6036 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6037 goto LABEL_32; | |
6038 goto LABEL_30; | |
6039 } | |
6040 if ( v2->IsUnarmed() ) | |
6041 { | |
6042 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6043 v14 = v18; | |
6044 if ( !v18 ) | |
6045 return v70; | |
6046 v15 = 0; | |
6047 v19 = SkillToMastery(v18); | |
6048 if ( (signed int)v19 < 3 ) | |
6049 { | |
6050 if ( (signed int)v19 >= 2 ) | |
6051 v15 = 1; | |
6052 LABEL_32: | |
6053 v16 = v14; | |
6054 return v15 * (v16 & 0x3F); | |
6055 } | |
6056 LABEL_30: | |
6057 v62 = 2; | |
6058 LABEL_31: | |
6059 v15 = v62; | |
6060 goto LABEL_32; | |
6061 } | |
6062 v20 = (ITEM_EQUIP_TYPE)0; | |
6063 while ( 1 ) | |
6064 { | |
6065 if ( v2->HasItemEquipped(v20) ) | |
6066 { | |
118 | 6067 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6068 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6069 break; | |
6070 } | |
6071 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6072 if ( (signed int)v20 >= 16 ) | |
6073 return v70; | |
6074 } | |
6075 v71 = (ITEM_EQUIP_TYPE)0; | |
6076 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6077 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6078 v25 = v24; | |
6079 v26 = SkillToMastery(v24); | |
6080 if ( !v23 ) | |
6081 { | |
6082 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6083 { | |
6084 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6085 LOBYTE(v25) = v31; | |
6086 if ( v31 ) | |
6087 { | |
6088 v15 = 0; | |
6089 v32 = SkillToMastery(v31); | |
6090 if ( (signed int)v32 < 3 ) | |
6091 { | |
6092 if ( (signed int)v32 >= 2 ) | |
6093 v15 = 1; | |
6094 } | |
6095 else | |
6096 { | |
6097 v15 = 2; | |
6098 } | |
6099 v16 = v25; | |
6100 return v15 * (v16 & 0x3F); | |
6101 } | |
6102 } | |
6103 goto LABEL_55; | |
6104 } | |
6105 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6106 { | |
6107 v29 = SkillToMastery(v25); | |
6108 v28 = __OFSUB__(v29, 4); | |
6109 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6110 } | |
6111 else | |
6112 { | |
6113 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6114 goto LABEL_55; | |
6115 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6116 { | |
6117 if ( v23 == PLAYER_SKILL_MACE ) | |
6118 { | |
6119 v28 = __OFSUB__(v26, 2); | |
118 | 6120 v27 = v26 - 2 < 0; |
0 | 6121 goto LABEL_53; |
6122 } | |
6123 LABEL_55: | |
6124 v30 = v71 * (v25 & 0x3F); | |
6125 return (int)((char *)v69 + v30); | |
6126 } | |
6127 v28 = __OFSUB__(v26, 3); | |
118 | 6128 v27 = v26 - 3 < 0; |
0 | 6129 } |
6130 LABEL_53: | |
6131 if ( !(v27 ^ v28) ) | |
6132 v71 = (ITEM_EQUIP_TYPE)1; | |
6133 goto LABEL_55; | |
6134 } | |
6135 if ( v2->IsUnarmed() == 1 ) | |
6136 { | |
6137 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6138 v34 = v33; | |
6139 if ( !v33 ) | |
6140 return v70; | |
6141 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6142 v5 = 2; | |
6143 v30 = v5 * (v34 & 0x3F); | |
6144 return (int)((char *)v69 + v30); | |
6145 } | |
6146 v35 = (ITEM_EQUIP_TYPE)0; | |
6147 v68 = 0; | |
6148 while ( 1 ) | |
6149 { | |
6150 if ( v2->HasItemEquipped(v35) ) | |
6151 { | |
118 | 6152 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6153 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6154 break; | |
6155 } | |
6156 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6157 if ( (signed int)v35 >= 16 ) | |
6158 return v70; | |
6159 } | |
6160 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6161 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6162 a1a = v39; | |
6163 SkillToMastery(v39); | |
6164 v71 = (ITEM_EQUIP_TYPE)0; | |
6165 if ( v38 ) | |
6166 { | |
6167 if ( (signed int)v38 > 0 ) | |
6168 { | |
6169 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6170 { | |
6171 v71 = (ITEM_EQUIP_TYPE)1; | |
6172 } | |
6173 else | |
6174 { | |
6175 if ( v38 == 7 ) | |
6176 { | |
6177 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6178 { | |
6179 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6180 { | |
6181 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6182 return v5 * (a1a & 0x3F); | |
6183 v63 = 2; | |
6184 } | |
6185 else | |
6186 { | |
6187 v63 = 3; | |
6188 } | |
6189 } | |
6190 else | |
6191 { | |
6192 v63 = 5; | |
6193 } | |
6194 v5 = v63; | |
6195 return v5 * (a1a & 0x3F); | |
6196 } | |
6197 } | |
6198 } | |
6199 } | |
6200 else | |
6201 { | |
6202 v71 = (ITEM_EQUIP_TYPE)1; | |
6203 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6204 { | |
6205 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6206 v41 = v40; | |
6207 if ( v40 ) | |
6208 { | |
6209 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6210 v5 = 2; | |
6211 v68 = v5 * (v41 & 0x3F); | |
6212 } | |
6213 } | |
6214 } | |
6215 v30 = v68 + v71 * (a1a & 0x3F); | |
6216 return (int)((char *)v69 + v30); | |
6217 } | |
6218 a1b = 0; | |
6219 v71 = (ITEM_EQUIP_TYPE)0; | |
6220 v68 = 16; | |
6221 v69 = &v2->pEquipment; | |
6222 do | |
6223 { | |
898 | 6224 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6225 goto LABEL_117; |
6226 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6227 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6228 if ( !v44 ) | |
6229 { | |
6230 v64 = 0; | |
6231 v65 = 1; | |
6232 LABEL_111: | |
6233 v66 = 0; | |
6234 goto LABEL_112; | |
6235 } | |
6236 v45 = v44 - 1; | |
6237 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6238 { | |
6239 v64 = 0; | |
6240 v65 = 0; | |
6241 v66 = 0; | |
6242 v67 = 1; | |
6243 goto LABEL_113; | |
6244 } | |
6245 v47 = v46 - 4; | |
6246 if ( v47 ) | |
6247 { | |
6248 v48 = v47 - 1; | |
6249 if ( v48 ) | |
6250 { | |
6251 v49 = v48 - 1; | |
6252 if ( v49 ) | |
6253 { | |
6254 if ( v49 != 1 ) | |
6255 goto LABEL_117; | |
6256 a1b = 1; | |
6257 v64 = 1; | |
6258 v65 = 0; | |
6259 v66 = 0; | |
6260 v67 = 0; | |
6261 goto LABEL_113; | |
6262 } | |
6263 a1b = 1; | |
6264 v64 = 1; | |
6265 v65 = 0; | |
6266 goto LABEL_111; | |
6267 } | |
6268 v71 = (ITEM_EQUIP_TYPE)1; | |
6269 } | |
6270 else | |
6271 { | |
6272 a1b = 1; | |
6273 } | |
6274 v64 = 1; | |
6275 v65 = 0; | |
6276 v66 = 1; | |
6277 LABEL_112: | |
6278 v67 = 0; | |
6279 LABEL_113: | |
6280 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6281 v51 = v50; | |
6282 v52 = SkillToMastery(v50); | |
6283 v53 = v51 & 0x3F; | |
6284 for ( i = 0; i < (signed int)v52; ++i ) | |
6285 { | |
6286 if ( *(&v64 + i) ) | |
6287 v70 += v53; | |
6288 } | |
6289 LABEL_117: | |
6290 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6291 --v68; | |
6292 } | |
6293 while ( v68 ); | |
6294 v64 = 1; | |
6295 v65 = 1; | |
6296 v66 = 1; | |
6297 v67 = 0; | |
6298 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6299 v56 = v55; | |
6300 v57 = SkillToMastery(v55); | |
6301 if ( !a1b && (!v71 || v57 == 4) ) | |
6302 { | |
6303 v58 = v56 & 0x3F; | |
6304 for ( j = 0; j < (signed int)v57; ++j ) | |
6305 { | |
6306 if ( *(&v64 + j) ) | |
6307 v70 += v58; | |
6308 } | |
6309 } | |
6310 return v70; | |
6311 } | |
6312 | |
6313 //----- (00490109) -------------------------------------------------------- | |
6314 // faces are: 0 1 2 3 human males | |
6315 // 4 5 6 7 human females | |
6316 // 8 9 elf males | |
6317 // 10 11 elf females | |
6318 // 12 13 dwarf males | |
6319 // 14 15 dwarf females | |
6320 // 16 17 goblin males | |
6321 // 18 19 goblin females | |
6322 // 20 lich male | |
6323 // 21 lich female | |
6324 // 22 underwater suits (unused) | |
6325 // 23 zombie male | |
6326 // 24 zombie female | |
6327 enum CHARACTER_RACE Player::GetRace() | |
6328 { | |
6329 if ( uFace > 15 ) | |
6330 { | |
6331 if ( uFace >= 16 && uFace <= 19 ) | |
6332 return CHARACTER_RACE_GOBLIN; | |
6333 } | |
6334 else | |
6335 { | |
6336 if ( uFace >= 12 ) | |
6337 { | |
6338 return CHARACTER_RACE_DWARF; | |
6339 } | |
6340 else | |
6341 { | |
6342 if ( uFace >= 0 ) | |
6343 { | |
6344 if ( uFace <= 7 ) | |
6345 { | |
6346 return CHARACTER_RACE_HUMAN; | |
6347 } | |
6348 else | |
6349 { | |
6350 if ( uFace <= 11 ) | |
6351 return CHARACTER_RACE_ELF; | |
6352 } | |
6353 } | |
6354 } | |
6355 } | |
6356 return CHARACTER_RACE_HUMAN; | |
6357 } | |
6358 | |
6359 //----- (00490141) -------------------------------------------------------- | |
187 | 6360 PLAYER_SEX Player::GetSexByVoice() |
0 | 6361 { |
6362 signed int result; // eax@1 | |
6363 | |
6364 result = 0; | |
6365 switch ( this->uVoiceID ) | |
6366 { | |
6367 case 0u: | |
6368 case 1u: | |
6369 case 2u: | |
6370 case 3u: | |
6371 case 8u: | |
6372 case 9u: | |
6373 case 0xCu: | |
6374 case 0xDu: | |
6375 case 0x10u: | |
6376 case 0x11u: | |
6377 case 0x14u: | |
6378 case 0x17u: | |
187 | 6379 return SEX_MALE; |
6380 | |
0 | 6381 case 4u: |
6382 case 5u: | |
6383 case 6u: | |
6384 case 7u: | |
6385 case 0xAu: | |
6386 case 0xBu: | |
6387 case 0xEu: | |
6388 case 0xFu: | |
6389 case 0x12u: | |
6390 case 0x13u: | |
6391 case 0x15u: | |
6392 case 0x18u: | |
187 | 6393 return SEX_FEMALE; |
6394 | |
0 | 6395 default: |
187 | 6396 assert(false); |
6397 } | |
0 | 6398 } |
6399 | |
6400 //----- (00490188) -------------------------------------------------------- | |
6401 void Player::SetInitialStats() | |
6402 { | |
6403 auto v1 = GetRace(); | |
290 | 6404 uMight = StatTable[v1][0].uBaseValue; |
6405 uIntelligence = StatTable[v1][1].uBaseValue; | |
6406 uWillpower = StatTable[v1][2].uBaseValue; | |
6407 uEndurance = StatTable[v1][3].uBaseValue; | |
6408 uAccuracy = StatTable[v1][4].uBaseValue; | |
6409 uSpeed = StatTable[v1][5].uBaseValue; | |
6410 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6411 } |
6412 | |
6413 //----- (004901FC) -------------------------------------------------------- | |
6414 int Player::SetSexByVoice() | |
6415 { | |
6416 __int64 v1; // qax@1 | |
6417 | |
6418 v1 = this->uVoiceID; | |
6419 switch ( (int)v1 ) | |
6420 { | |
6421 case 0: | |
6422 case 1: | |
6423 case 2: | |
6424 case 3: | |
6425 case 8: | |
6426 case 9: | |
6427 case 0xC: | |
6428 case 0xD: | |
6429 case 0x10: | |
6430 case 0x11: | |
6431 case 0x14: | |
6432 case 0x17: | |
6433 BYTE4(v1) = 0; | |
6434 break; | |
6435 case 4: | |
6436 case 5: | |
6437 case 6: | |
6438 case 7: | |
6439 case 0xA: | |
6440 case 0xB: | |
6441 case 0xE: | |
6442 case 0xF: | |
6443 case 0x12: | |
6444 case 0x13: | |
6445 case 0x15: | |
6446 case 0x18: | |
6447 BYTE4(v1) = 1; | |
6448 break; | |
6449 default: | |
6450 break; | |
6451 } | |
6452 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6453 return v1; | |
6454 } | |
6455 | |
6456 //----- (0049024A) -------------------------------------------------------- | |
135 | 6457 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6458 { |
6459 sLevelModifier = 0; | |
6460 sAgeModifier = 0; | |
6461 | |
135 | 6462 classType = cls; |
0 | 6463 uLuckBonus = 0; |
6464 uSpeedBonus = 0; | |
6465 uAccuracyBonus = 0; | |
6466 uEnduranceBonus = 0; | |
6467 uWillpowerBonus = 0; | |
6468 uIntelligenceBonus = 0; | |
6469 uMightBonus = 0; | |
6470 uLevel = 1; | |
6471 uExperience = 251 + rand() % 100; | |
6472 uBirthYear = 1147 - rand() % 6; | |
6473 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6474 memset(_guilds_member_bits, 0, 64); |
0 | 6475 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6476 | |
6477 for (uint i = 0; i < 37; ++i) | |
6478 { | |
135 | 6479 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6480 continue; |
6481 | |
6482 pActiveSkills[i] = 1; | |
6483 | |
6484 switch (i) | |
6485 { | |
886 | 6486 case PLAYER_SKILL_FIRE: |
6487 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6488 |
6489 extern bool all_magic; | |
6490 if ( all_magic == true ) | |
6491 { | |
6492 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6493 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6494 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6495 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6496 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6497 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6498 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6499 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6500 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6501 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6502 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6503 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6504 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6505 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6506 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6507 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6508 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6509 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6510 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6511 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6512 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6513 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6514 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6515 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6516 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6517 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6518 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6519 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6520 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6521 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6522 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6523 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6524 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6525 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6526 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6527 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6528 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6529 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6530 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6531 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6532 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6533 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6534 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6535 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6536 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6537 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6538 } | |
486 | 6539 break; |
886 | 6540 case PLAYER_SKILL_AIR: |
6541 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6542 break; | |
6543 case PLAYER_SKILL_WATER: | |
6544 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6545 break; | |
6546 case PLAYER_SKILL_EARTH: | |
6547 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6548 break; | |
6549 case PLAYER_SKILL_SPIRIT: | |
6550 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6551 break; | |
6552 case PLAYER_SKILL_MIND: | |
6553 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6554 break; | |
6555 case PLAYER_SKILL_BODY: | |
6556 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6557 |
6558 if ( all_magic == true ) | |
6559 { | |
6560 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6561 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6562 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6563 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6564 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6565 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6566 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6567 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6568 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6569 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6570 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6571 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6572 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6573 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6574 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6575 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6576 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6577 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6578 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6579 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6580 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6581 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6582 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6583 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6584 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6585 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6586 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6587 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6588 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6589 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6590 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6591 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6592 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6593 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6594 } | |
569 | 6595 break; |
886 | 6596 case PLAYER_SKILL_LIGHT: |
6597 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6598 break; | |
6599 case PLAYER_SKILL_DARK: | |
6600 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6601 break; | |
0 | 6602 } |
6603 } | |
6604 | |
6605 sHealth = GetMaxHealth(); | |
6606 sMana = GetMaxMana(); | |
6607 } | |
6608 | |
6609 //----- (004903C9) -------------------------------------------------------- | |
821 | 6610 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6611 { | |
6612 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6613 int v3; // edx@5 |
6614 char *v4; // ecx@5 | |
6615 int v5; // esi@11 | |
6616 unsigned __int16 *v6; // edx@11 | |
6617 int v7; // esi@18 | |
6618 unsigned __int16 *pActiveSkill; // edx@18 | |
6619 | |
6620 if ( order >= 0 ) | |
6621 { | |
6622 if ( order <= 1 ) | |
6623 { | |
6624 result = (PLAYER_SKILL_TYPE)0; | |
6625 v7 = 0; | |
6626 pActiveSkill = this->pActiveSkills; | |
6627 do | |
6628 { | |
135 | 6629 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6630 { |
6631 if ( v7 == order ) | |
6632 return result; | |
6633 ++v7; | |
6634 } | |
6635 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6636 ++pActiveSkill; | |
6637 } | |
6638 while ( (signed int)result < 37 ); | |
6639 } | |
6640 else | |
6641 { | |
6642 if ( order <= 3 ) | |
6643 { | |
6644 result = (PLAYER_SKILL_TYPE)0; | |
6645 v5 = 0; | |
6646 pActiveSkill = this->pActiveSkills; | |
6647 do | |
6648 { | |
135 | 6649 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6650 { |
6651 if ( v5 == order - 2 ) | |
6652 return result; | |
6653 ++v5; | |
6654 } | |
6655 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6656 ++pActiveSkill; | |
6657 } | |
6658 while ( (signed int)result < 37 ); | |
6659 } | |
6660 else | |
6661 { | |
6662 if ( order <= 12 ) | |
6663 { | |
6664 result = (PLAYER_SKILL_TYPE)0; | |
6665 v3 = 0; | |
135 | 6666 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6667 do |
6668 { | |
6669 if ( *v4 == 1 ) | |
6670 { | |
6671 if ( v3 == order - 4 ) | |
6672 return result; | |
6673 ++v3; | |
6674 } | |
6675 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6676 ++v4; | |
6677 } | |
6678 while ( (signed int)result < 37 ); | |
6679 } | |
6680 } | |
6681 } | |
6682 } | |
6683 return (PLAYER_SKILL_TYPE)37; | |
6684 } | |
6685 | |
6686 | |
6687 | |
6688 //----- (0049048D) -------------------------------------------------------- | |
6689 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6690 void Player::DecreaseAttribute(int eAttribute) | |
6691 { | |
6692 int v2; // eax@1 | |
6693 int pBaseValue; // ecx@1 | |
6694 int pDroppedStep; // ebx@1 | |
6695 int pStep; // esi@1 | |
6696 unsigned __int16 result; // ax@7 | |
6697 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6698 | |
6699 v2 = eAttribute + 7 * GetRace(); | |
290 | 6700 pBaseValue = StatTable[0][v2].uBaseValue; |
6701 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6702 uMinValue = pBaseValue - 2; |
290 | 6703 pStep = StatTable[0][v2].uBaseStep; |
0 | 6704 switch ( eAttribute ) |
6705 { | |
6706 case CHARACTER_MIGHT: | |
6707 if ( this->uMight <= pBaseValue ) | |
6708 pStep = pDroppedStep; | |
6709 if ( this->uMight - pStep >= uMinValue ) | |
6710 this->uMight -= pStep; | |
6711 break; | |
6712 case CHARACTER_INTELLIGANCE: | |
6713 if ( this->uIntelligence <= pBaseValue ) | |
6714 pStep = pDroppedStep; | |
6715 if ( this->uIntelligence - pStep >= uMinValue ) | |
6716 this->uIntelligence -= pStep; | |
6717 break; | |
6718 case CHARACTER_WILLPOWER: | |
6719 if ( this->uWillpower <= pBaseValue ) | |
6720 pStep = pDroppedStep; | |
6721 if ( this->uWillpower - pStep >= uMinValue ) | |
6722 this->uWillpower -= pStep; | |
6723 break; | |
6724 case CHARACTER_ENDURANCE: | |
6725 if ( this->uEndurance <= pBaseValue ) | |
6726 pStep = pDroppedStep; | |
6727 if ( this->uEndurance - pStep >= uMinValue ) | |
6728 this->uEndurance -= pStep; | |
6729 break; | |
6730 case CHARACTER_ACCURACY: | |
6731 if ( this->uAccuracy <= pBaseValue ) | |
6732 pStep = pDroppedStep; | |
6733 if ( this->uAccuracy - pStep >= uMinValue ) | |
6734 this->uAccuracy -= pStep; | |
6735 break; | |
6736 case CHARACTER_SPEED: | |
6737 if ( this->uSpeed <= pBaseValue ) | |
6738 pStep = pDroppedStep; | |
6739 if ( this->uSpeed - pStep >= uMinValue ) | |
6740 this->uSpeed -= pStep; | |
6741 break; | |
6742 case CHARACTER_LUCK: | |
6743 if ( this->uLuck <= pBaseValue ) | |
6744 pStep = pDroppedStep; | |
6745 if ( this->uLuck - pStep >= uMinValue ) | |
6746 this->uLuck -= pStep; | |
6747 break; | |
6748 } | |
6749 } | |
6750 | |
6751 //----- (004905F5) -------------------------------------------------------- | |
6752 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6753 int Player::IncreaseAttribute(int eAttribute) | |
6754 { | |
6755 Player *v2; // esi@1 | |
6756 int v3; // eax@1 | |
6757 int v4; // ebx@1 | |
6758 signed int v5; // edi@1 | |
6759 int v6; // eax@8 | |
6760 signed int v7; // eax@17 | |
6761 signed int result; // eax@18 | |
6762 int v9; // [sp+Ch] [bp-8h]@1 | |
6763 signed int v10; // [sp+10h] [bp-4h]@1 | |
6764 | |
6765 v2 = this; | |
6766 v3 = eAttribute + 7 * GetRace(); | |
290 | 6767 v4 = StatTable[0][v3].uMaxValue; |
6768 v5 = StatTable[0][v3].uBaseStep; | |
6769 v9 = StatTable[0][v3].uBaseValue; | |
6770 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6771 PlayerCreation_ComputeAttributeBonus(); |
6772 if ( eAttribute ) | |
6773 { | |
6774 switch ( eAttribute ) | |
6775 { | |
6776 case 1: | |
6777 v6 = v2->uIntelligence; | |
6778 break; | |
6779 case 2: | |
6780 v6 = v2->uWillpower; | |
6781 break; | |
6782 case 3: | |
6783 v6 = v2->uEndurance; | |
6784 break; | |
6785 case 4: | |
6786 v6 = v2->uAccuracy; | |
6787 break; | |
6788 case 5: | |
6789 v6 = v2->uSpeed; | |
6790 break; | |
6791 case 6: | |
6792 v6 = v2->uLuck; | |
6793 break; | |
6794 default: | |
6795 v6 = eAttribute; | |
6796 break; | |
6797 } | |
6798 } | |
6799 else | |
6800 { | |
6801 v6 = v2->uMight; | |
6802 } | |
6803 if ( v6 < v9 ) | |
6804 { | |
6805 v7 = v5; | |
6806 v5 = v10; | |
6807 v10 = v7; | |
6808 } | |
6809 result = PlayerCreation_ComputeAttributeBonus(); | |
6810 if ( result >= v10 ) | |
6811 { | |
6812 if ( eAttribute ) | |
6813 { | |
6814 switch ( eAttribute ) | |
6815 { | |
6816 case 1: | |
6817 result = (signed int)&v2->uIntelligence; | |
6818 break; | |
6819 case 2: | |
6820 result = (signed int)&v2->uWillpower; | |
6821 break; | |
6822 case 3: | |
6823 result = (signed int)&v2->uEndurance; | |
6824 break; | |
6825 case 4: | |
6826 result = (signed int)&v2->uAccuracy; | |
6827 break; | |
6828 case 5: | |
6829 result = (signed int)&v2->uSpeed; | |
6830 break; | |
6831 default: | |
6832 result = eAttribute - 6; | |
6833 if ( eAttribute != 6 ) | |
6834 return result; | |
6835 result = (signed int)&v2->uLuck; | |
6836 break; | |
6837 } | |
6838 } | |
6839 else | |
6840 { | |
6841 result = (signed int)&v2->uMight; | |
6842 } | |
6843 if ( v5 + *(short *)result <= v4 ) | |
6844 *(short *)result += v5; | |
6845 } | |
6846 return result; | |
6847 } | |
6848 | |
6849 //----- (0049070F) -------------------------------------------------------- | |
6850 void Player::Zero() | |
6851 { | |
6852 Player *v1; // esi@1 | |
6853 | |
6854 v1 = this; | |
6855 this->sLevelModifier = 0; | |
6856 this->sACModifier = 0; | |
6857 this->uLuckBonus = 0; | |
6858 this->uAccuracyBonus = 0; | |
6859 this->uSpeedBonus = 0; | |
6860 this->uEnduranceBonus = 0; | |
6861 this->uWillpowerBonus = 0; | |
6862 this->uIntelligenceBonus = 0; | |
6863 this->uMightBonus = 0; | |
6864 this->field_100 = 0; | |
6865 this->field_FC = 0; | |
6866 this->field_F8 = 0; | |
6867 this->field_F4 = 0; | |
6868 this->field_F0 = 0; | |
6869 this->field_EC = 0; | |
6870 this->field_E8 = 0; | |
6871 this->field_E4 = 0; | |
6872 this->field_E0 = 0; | |
766 | 6873 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6874 v1->field_1A97 = 0; |
6875 v1->_ranged_dmg_bonus = 0; | |
6876 v1->field_1A95 = 0; | |
6877 v1->_ranged_atk_bonus = 0; | |
6878 v1->field_1A93 = 0; | |
6879 v1->_melee_dmg_bonus = 0; | |
6880 v1->field_1A91 = 0; | |
6881 v1->_some_attack_bonus = 0; | |
6882 v1->_mana_related = 0; | |
6883 v1->uFullManaBonus = 0; | |
6884 v1->_health_related = 0; | |
6885 v1->uFullHealthBonus = 0; | |
6886 } | |
6887 | |
6888 //----- (004907E7) -------------------------------------------------------- | |
299 | 6889 unsigned int Player::GetStatColor(int uStat) |
0 | 6890 { |
6891 __int16 uWhite; // si@1 | |
290 | 6892 int attribute_value; // edx@1 |
299 | 6893 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6894 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6895 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6896 | |
949 | 6897 uRed = TargetColor(0xFFu, 0x23u, 0); |
6898 uGreen = TargetColor(0, 0xFFu, 0); | |
6899 uWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
299 | 6900 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6901 |
0 | 6902 switch (uStat) |
6903 { | |
6904 case 0: attribute_value = uMight; break; | |
6905 case 1: attribute_value = uIntelligence; break; | |
6906 case 2: attribute_value = uWillpower; break; | |
6907 case 3: attribute_value = uEndurance; break; | |
290 | 6908 case 4: attribute_value = uAccuracy; break; |
6909 case 5: attribute_value = uSpeed; break; | |
0 | 6910 case 6: attribute_value = uLuck; break; |
6911 }; | |
6912 | |
299 | 6913 if ( attribute_value == pBaseAttrValue ) |
290 | 6914 return uWhite; |
299 | 6915 else if ( attribute_value > pBaseAttrValue ) |
290 | 6916 return uGreen; |
0 | 6917 else |
290 | 6918 return uRed; |
0 | 6919 } |
6920 | |
6921 //----- (004908A8) -------------------------------------------------------- | |
6922 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6923 { | |
6924 unsigned __int64 *result; // eax@1 | |
6925 | |
6926 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6927 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6928 { | |
6929 *(int *)result = 0; | |
6930 *((int *)result + 1) = 0; | |
6931 LOBYTE(result) = 1; | |
6932 } | |
6933 else | |
6934 { | |
6935 LOBYTE(result) = 0; | |
6936 } | |
6937 return (bool)result; | |
6938 } | |
6939 | |
6940 //----- (004680ED) -------------------------------------------------------- | |
6941 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6942 { | |
6943 Player *v3; // esi@1 | |
6944 unsigned int v4; // ebx@4 | |
6945 signed int v5; // eax@17 | |
6946 unsigned int v6; // eax@26 | |
6947 unsigned __int8 v7; // cf@37 | |
6948 int v8; // edx@39 | |
6949 int v9; // edx@40 | |
6950 int v10; // edx@41 | |
6951 int v11; // edx@42 | |
6952 int v12; // edx@43 | |
6953 char *v13; // eax@45 | |
6954 AudioPlayer *v14; // ecx@62 | |
6955 signed int v15; // edi@68 | |
6956 int v16; // edx@73 | |
6957 unsigned __int16 *v17; // edi@73 | |
6958 unsigned int v18; // eax@73 | |
6959 int v19; // eax@74 | |
6960 int v20; // eax@75 | |
6961 signed int v21; // eax@81 | |
6962 const char *v22; // eax@84 | |
6963 char *v23; // ecx@90 | |
6964 int v24; // esi@96 | |
6965 int v25; // eax@109 | |
6966 int v26; // eax@113 | |
6967 char *v27; // edi@114 | |
6968 signed __int64 v28; // qax@120 | |
6969 char *v29; // ecx@120 | |
6970 int v30; // edi@137 | |
6971 int v31; // ST30_4@137 | |
6972 int v32; // ST3C_4@137 | |
6973 int v33; // ST40_4@137 | |
6974 int v34; // ST34_4@137 | |
6975 int v35; // ST38_4@137 | |
6976 unsigned __int8 v36; // al@173 | |
6977 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6978 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6979 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6980 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6981 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6982 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6983 signed int v43; // [sp-14h] [bp-40h]@18 | |
6984 signed int v44; // [sp-14h] [bp-40h]@174 | |
6985 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6986 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6987 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6988 int v48; // [sp-Ch] [bp-38h]@18 | |
6989 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6990 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6991 int v51; // [sp-Ch] [bp-38h]@174 | |
6992 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6993 char *v53; // [sp-8h] [bp-34h]@33 | |
6994 int v54; // [sp-8h] [bp-34h]@34 | |
6995 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6996 int v56; // [sp-8h] [bp-34h]@66 | |
6997 const char *v57; // [sp-8h] [bp-34h]@69 | |
6998 const char *v58; // [sp-8h] [bp-34h]@89 | |
6999 int v59; // [sp-8h] [bp-34h]@120 | |
7000 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
7001 int v61; // [sp-4h] [bp-30h]@18 | |
7002 char *v62; // [sp-4h] [bp-30h]@33 | |
7003 char *v63; // [sp-4h] [bp-30h]@34 | |
7004 int v64; // [sp-4h] [bp-30h]@60 | |
7005 int v65; // [sp-4h] [bp-30h]@66 | |
7006 const char *v66; // [sp-4h] [bp-30h]@69 | |
7007 signed int v67; // [sp-4h] [bp-30h]@77 | |
7008 const char *v68; // [sp-4h] [bp-30h]@89 | |
7009 int v69; // [sp-4h] [bp-30h]@110 | |
7010 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
7011 int v71; // [sp-4h] [bp-30h]@174 | |
7012 char *v72; // [sp+20h] [bp-Ch]@68 | |
7013 signed int v73; // [sp+24h] [bp-8h]@1 | |
7014 char *v74; // [sp+24h] [bp-8h]@23 | |
7015 int v75; // [sp+24h] [bp-8h]@73 | |
7016 Player *thisb; // [sp+28h] [bp-4h]@1 | |
7017 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
7018 | |
7019 thisb = this; | |
243 | 7020 v3 = &pParty->pPlayers[a2-1]; |
0 | 7021 v73 = 1; |
7022 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
7023 return; | |
7024 v4 = 0; | |
7025 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
7026 { | |
7027 if ( pParty->pPickedItem.uItemID != 160 ) | |
7028 { | |
7029 if ( pParty->pPickedItem.uItemID == 161 ) | |
7030 { | |
7031 v27 = (char *)&v3->sMana; | |
7032 *(int *)v27 += 2; | |
7033 LABEL_170: | |
7034 if ( *(int *)v27 > v3->GetMaxMana() ) | |
7035 *(int *)v27 = v3->GetMaxMana(); | |
7036 } | |
7037 else | |
7038 { | |
7039 if ( pParty->pPickedItem.uItemID != 162 ) | |
7040 { | |
7041 LABEL_167: | |
7042 v68 = pParty->pPickedItem.GetDisplayName(); | |
7043 v58 = pGlobalTXT_LocalizationStrings[36]; | |
7044 goto LABEL_90; | |
7045 } | |
7046 v69 = 2; | |
7047 LABEL_111: | |
243 | 7048 pParty->pPlayers[a2-1].Heal(v69); |
0 | 7049 } |
7050 LABEL_112: | |
187 | 7051 v3->PlaySound(SPEECH_36, 0); |
0 | 7052 goto LABEL_173; |
7053 } | |
7054 LABEL_172: | |
100 | 7055 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 7056 goto LABEL_173; |
7057 } | |
7058 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
7059 { | |
7060 switch ( pParty->pPickedItem.uItemID ) | |
7061 { | |
7062 case 0xDEu: | |
570 | 7063 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7064 goto LABEL_110; |
7065 case 0xDFu: | |
570 | 7066 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7067 goto LABEL_114; |
7068 case 0xE0u: | |
7069 LODWORD(v3->pConditions[1]) = 0; | |
7070 HIDWORD(v3->pConditions[1]) = 0; | |
7071 goto LABEL_112; | |
7072 case 0xE1u: | |
7073 LODWORD(v3->pConditions[11]) = 0; | |
7074 HIDWORD(v3->pConditions[11]) = 0; | |
7075 LODWORD(v3->pConditions[9]) = 0; | |
7076 HIDWORD(v3->pConditions[9]) = 0; | |
7077 LODWORD(v3->pConditions[7]) = 0; | |
7078 HIDWORD(v3->pConditions[7]) = 0; | |
7079 goto LABEL_112; | |
7080 case 0xE2u: | |
7081 LODWORD(v3->pConditions[10]) = 0; | |
7082 HIDWORD(v3->pConditions[10]) = 0; | |
7083 LODWORD(v3->pConditions[8]) = 0; | |
7084 HIDWORD(v3->pConditions[8]) = 0; | |
7085 LODWORD(v3->pConditions[6]) = 0; | |
7086 HIDWORD(v3->pConditions[6]) = 0; | |
7087 goto LABEL_112; | |
7088 case 0xE3u: | |
7089 LODWORD(v3->pConditions[2]) = 0; | |
7090 HIDWORD(v3->pConditions[2]) = 0; | |
7091 goto LABEL_112; | |
7092 case 0xE4u: | |
7093 if ( v3->pConditions[1] ) | |
7094 goto LABEL_173; | |
7095 v70 = 0; | |
7096 v59 = 0; | |
7097 v50 = 5; | |
7098 v46 = 3; | |
570 | 7099 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7100 v29 = (char *)&v3->pPlayerBuffs[7]; |
7101 goto LABEL_147; | |
7102 case 0xE5u: | |
7103 v70 = 0; | |
7104 v59 = 0; | |
7105 v50 = 5; | |
7106 v46 = 3; | |
570 | 7107 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7108 v29 = (char *)&v3->pPlayerBuffs[8]; |
7109 goto LABEL_147; | |
7110 case 0xE6u: | |
7111 v70 = 0; | |
7112 v59 = 0; | |
7113 v50 = 5; | |
7114 v46 = 3; | |
570 | 7115 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7116 v29 = (char *)&v3->pPlayerBuffs[1]; |
7117 goto LABEL_147; | |
7118 case 0xE7u: | |
7119 v70 = 0; | |
7120 v59 = 0; | |
570 | 7121 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7122 v46 = 0; |
570 | 7123 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7124 v29 = (char *)&v3->pPlayerBuffs[11]; |
7125 goto LABEL_147; | |
7126 case 0xE8u: | |
7127 v70 = 0; | |
7128 v59 = 0; | |
570 | 7129 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7130 v46 = 0; |
570 | 7131 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7132 v29 = (char *)&v3->pPlayerBuffs[13]; |
7133 goto LABEL_147; | |
7134 case 0xEAu: | |
7135 v70 = 0; | |
7136 v59 = 0; | |
7137 v50 = 5; | |
7138 v46 = 3; | |
570 | 7139 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7140 v29 = (char *)&v3->pPlayerBuffs[14]; |
7141 goto LABEL_147; | |
7142 case 0xEBu: | |
7143 v3->pPlayerBuffs[23].Apply( | |
570 | 7144 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7145 3u, |
7146 5u, | |
7147 0, | |
7148 0); | |
7149 goto LABEL_173; | |
7150 case 0xEDu: | |
7151 LODWORD(v3->pConditions[3]) = 0; | |
7152 HIDWORD(v3->pConditions[3]) = 0; | |
7153 goto LABEL_112; | |
7154 case 0xEEu: | |
7155 LODWORD(v3->pConditions[0]) = 0; | |
7156 HIDWORD(v3->pConditions[0]) = 0; | |
7157 goto LABEL_112; | |
7158 case 0xEFu: | |
7159 LODWORD(v3->pConditions[5]) = 0; | |
7160 HIDWORD(v3->pConditions[5]) = 0; | |
7161 goto LABEL_112; | |
7162 case 0xF0u: | |
7163 v70 = 0; | |
7164 v59 = 0; | |
570 | 7165 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7166 v46 = 0; |
570 | 7167 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7168 v29 = (char *)&v3->pPlayerBuffs[19]; |
7169 goto LABEL_147; | |
7170 case 0xF1u: | |
7171 v70 = 0; | |
7172 v59 = 0; | |
570 | 7173 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7174 v46 = 0; |
570 | 7175 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7176 v29 = (char *)&v3->pPlayerBuffs[17]; |
7177 goto LABEL_147; | |
7178 case 0xF2u: | |
7179 v70 = 0; | |
7180 v59 = 0; | |
570 | 7181 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7182 v46 = 0; |
570 | 7183 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7184 v29 = (char *)&v3->pPlayerBuffs[20]; |
7185 goto LABEL_147; | |
7186 case 0xF3u: | |
7187 v70 = 0; | |
7188 v59 = 0; | |
570 | 7189 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7190 v46 = 0; |
570 | 7191 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7192 v29 = (char *)&v3->pPlayerBuffs[16]; |
7193 goto LABEL_147; | |
7194 case 0xF4u: | |
7195 v70 = 0; | |
7196 v59 = 0; | |
570 | 7197 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7198 v46 = 0; |
570 | 7199 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7200 v29 = (char *)&v3->pPlayerBuffs[21]; |
7201 goto LABEL_147; | |
7202 case 0xF5u: | |
7203 v70 = 0; | |
7204 v59 = 0; | |
570 | 7205 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7206 v46 = 0; |
570 | 7207 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7208 v29 = (char *)&v3->pPlayerBuffs[15]; |
7209 goto LABEL_147; | |
7210 case 0xFBu: | |
7211 LODWORD(v3->pConditions[12]) = 0; | |
7212 HIDWORD(v3->pConditions[12]) = 0; | |
7213 goto LABEL_112; | |
7214 case 0xFCu: | |
7215 v30 = LODWORD(v3->pConditions[14]); | |
7216 v31 = HIDWORD(v3->pConditions[14]); | |
7217 v32 = LODWORD(v3->pConditions[15]); | |
7218 v33 = HIDWORD(v3->pConditions[15]); | |
7219 v34 = LODWORD(v3->pConditions[16]); | |
7220 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7221 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7222 HIDWORD(v3->pConditions[14]) = v31; |
7223 LODWORD(v3->pConditions[15]) = v32; | |
7224 HIDWORD(v3->pConditions[15]) = v33; | |
7225 LODWORD(v3->pConditions[16]) = v34; | |
7226 LODWORD(v3->pConditions[14]) = v30; | |
7227 HIDWORD(v3->pConditions[16]) = v35; | |
7228 goto LABEL_112; | |
7229 case 0xFDu: | |
570 | 7230 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7231 LABEL_110: |
7232 v69 = v25; | |
7233 goto LABEL_111; | |
7234 case 0xFEu: | |
570 | 7235 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7236 LABEL_114: |
7237 v27 = (char *)&v3->sMana; | |
7238 *(int *)v27 += v26; | |
7239 goto LABEL_170; | |
7240 case 0xFFu: | |
7241 v70 = 0; | |
7242 v59 = 0; | |
570 | 7243 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7244 v46 = 0; |
570 | 7245 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7246 v29 = (char *)&v3->pPlayerBuffs[18]; |
7247 goto LABEL_147; | |
7248 case 0x100u: | |
7249 v70 = 0; | |
7250 v59 = 0; | |
570 | 7251 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7252 v46 = 0; |
570 | 7253 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7254 v29 = (char *)&v3->pPlayerBuffs[5]; |
7255 goto LABEL_147; | |
7256 case 0x101u: | |
7257 v70 = 0; | |
7258 v59 = 0; | |
570 | 7259 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7260 v46 = 0; |
570 | 7261 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7262 v29 = (char *)v3->pPlayerBuffs; |
7263 goto LABEL_147; | |
7264 case 0x102u: | |
7265 v70 = 0; | |
7266 v59 = 0; | |
570 | 7267 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7268 v46 = 0; |
570 | 7269 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7270 v29 = (char *)&v3->pPlayerBuffs[22]; |
7271 goto LABEL_147; | |
7272 case 0x103u: | |
7273 v70 = 0; | |
7274 v59 = 0; | |
570 | 7275 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7276 v46 = 0; |
570 | 7277 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7278 v29 = (char *)&v3->pPlayerBuffs[3]; |
7279 goto LABEL_147; | |
7280 case 0x104u: | |
7281 v70 = 0; | |
7282 v59 = 0; | |
570 | 7283 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7284 v46 = 0; |
570 | 7285 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7286 v29 = (char *)&v3->pPlayerBuffs[9]; |
7287 goto LABEL_147; | |
7288 case 0x105u: | |
7289 v70 = 0; | |
7290 v59 = 0; | |
570 | 7291 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7292 v46 = 0; |
570 | 7293 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7294 v29 = (char *)&v3->pPlayerBuffs[2]; |
7295 LABEL_147: | |
7296 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7297 goto LABEL_112; | |
7298 case 0x106u: | |
7299 LODWORD(v3->pConditions[15]) = 0; | |
7300 HIDWORD(v3->pConditions[15]) = 0; | |
7301 goto LABEL_112; | |
7302 case 0x108u: | |
7303 if ( !*(int *)&v3->field_1F5[3] ) | |
7304 { | |
7305 v3->uLuck += 50; | |
7306 *(int *)&v3->field_1F5[3] = 1; | |
7307 } | |
7308 goto LABEL_112; | |
7309 case 0x109u: | |
7310 if ( !*(int *)&v3->field_1F5[7] ) | |
7311 { | |
7312 v3->uSpeed += 50; | |
7313 *(int *)&v3->field_1F5[7] = 1; | |
7314 } | |
7315 goto LABEL_112; | |
7316 case 0x10Au: | |
7317 if ( !*(int *)&v3->field_1F5[11] ) | |
7318 { | |
7319 v3->uIntelligence += 50; | |
7320 *(int *)&v3->field_1F5[11] = 1; | |
7321 } | |
7322 goto LABEL_112; | |
7323 case 0x10Bu: | |
7324 if ( !*(int *)&v3->field_1F5[15] ) | |
7325 { | |
7326 v3->uEndurance += 50; | |
7327 *(int *)&v3->field_1F5[15] = 1; | |
7328 } | |
7329 goto LABEL_112; | |
7330 case 0x10Cu: | |
7331 if ( !*(int *)&v3->field_1F5[19] ) | |
7332 { | |
7333 v3->uWillpower += 50; | |
7334 *(int *)&v3->field_1F5[19] = 1; | |
7335 } | |
7336 goto LABEL_112; | |
7337 case 0x10Du: | |
7338 if ( !*(int *)&v3->field_1F5[23] ) | |
7339 { | |
7340 v3->uAccuracy += 50; | |
7341 *(int *)&v3->field_1F5[23] = 1; | |
7342 } | |
7343 goto LABEL_112; | |
7344 case 0x10Eu: | |
7345 if ( !*(int *)&v3->field_1F5[27] ) | |
7346 { | |
7347 v3->uMight += 50; | |
7348 *(int *)&v3->field_1F5[27] = 1; | |
7349 } | |
7350 goto LABEL_112; | |
7351 case 0x10Fu: | |
7352 v3->sAgeModifier = 0; | |
7353 goto LABEL_112; | |
809 | 7354 case 0xDDu: |
7355 goto LABEL_172; | |
0 | 7356 default: |
7357 goto LABEL_167; | |
7358 } | |
7359 goto LABEL_172; | |
7360 } | |
7361 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7362 { | |
7363 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7364 { | |
7365 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7366 { | |
7367 if ( pParty->pPickedItem.uItemID == 616 ) | |
7368 { | |
7369 thisa = pParty->uCurrentMonthWeek + 1; | |
7370 if ( pParty->uCurrentMonth >= 7 ) | |
7371 v74 = 0; | |
7372 else | |
7373 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7374 switch ( pParty->uCurrentMonth ) | |
7375 { | |
7376 case 0u: | |
7377 v6 = pParty->uCurrentMonthWeek + 1; | |
7378 v3->uMight += thisa; | |
7379 goto LABEL_33; | |
7380 case 1u: | |
7381 v6 = pParty->uCurrentMonthWeek + 1; | |
7382 v3->uIntelligence += thisa; | |
7383 goto LABEL_33; | |
7384 case 2u: | |
7385 v6 = pParty->uCurrentMonthWeek + 1; | |
7386 v3->uWillpower += thisa; | |
7387 goto LABEL_33; | |
7388 case 3u: | |
7389 v6 = pParty->uCurrentMonthWeek + 1; | |
7390 v3->uEndurance += thisa; | |
7391 goto LABEL_33; | |
7392 case 4u: | |
7393 v6 = pParty->uCurrentMonthWeek + 1; | |
7394 v3->uAccuracy += thisa; | |
7395 goto LABEL_33; | |
7396 case 5u: | |
7397 v6 = pParty->uCurrentMonthWeek + 1; | |
7398 v3->uSpeed += thisa; | |
7399 goto LABEL_33; | |
7400 case 6u: | |
7401 v6 = pParty->uCurrentMonthWeek + 1; | |
7402 v3->uLuck += thisa; | |
7403 LABEL_33: | |
7404 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7405 v53 = v74; | |
7406 v49 = v6; | |
7407 goto LABEL_53; | |
7408 case 7u: | |
7409 party_finds_gold(1000 * thisa, 0); | |
7410 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7411 v54 = 1000 * thisa; | |
7412 goto LABEL_38; | |
7413 case 8u: | |
7414 Party::GiveFood(5 * thisa); | |
7415 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7416 v54 = 5 * thisa; | |
7417 goto LABEL_38; | |
7418 case 9u: | |
7419 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7420 v3->uSkillPoints += 2 * thisa; | |
7421 v54 = 2 * thisa; | |
7422 goto LABEL_38; | |
7423 case 0xAu: | |
7424 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7425 v54 = 2500 * thisa; | |
7426 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7427 LODWORD(v3->uExperience) += 2500 * thisa; | |
7428 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7429 LABEL_38: | |
7430 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7431 goto LABEL_54; | |
7432 case 0xBu: | |
7433 v8 = rand() % 6; | |
7434 if ( v8 ) | |
7435 { | |
7436 v9 = v8 - 1; | |
7437 if ( v9 ) | |
7438 { | |
7439 v10 = v9 - 1; | |
7440 if ( v10 ) | |
7441 { | |
7442 v11 = v10 - 1; | |
7443 if ( v11 ) | |
7444 { | |
7445 v12 = v11 - 1; | |
7446 if ( v12 ) | |
7447 { | |
7448 if ( v12 != 1 ) | |
7449 goto LABEL_52; | |
7450 v3->sResBodyBase += thisa; | |
7451 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7452 } | |
7453 else | |
7454 { | |
7455 v3->sResMindBase += thisa; | |
7456 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7457 } | |
7458 } | |
7459 else | |
7460 { | |
7461 v3->sResEarthBase += thisa; | |
7462 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7463 } | |
7464 } | |
7465 else | |
7466 { | |
7467 v3->sResWaterBase += thisa; | |
7468 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7469 } | |
7470 } | |
7471 else | |
7472 { | |
7473 v3->sResAirBase += thisa; | |
7474 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7475 } | |
7476 } | |
7477 else | |
7478 { | |
7479 v3->sResFireBase += thisa; | |
7480 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7481 } | |
7482 v74 = v13; | |
7483 LABEL_52: | |
7484 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7485 v53 = v74; | |
7486 v49 = thisa; | |
7487 LABEL_53: | |
7488 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7489 LABEL_54: | |
7490 ShowStatusBarString(pTmpBuf, 2u); | |
7491 pMouse->RemoveHoldingItem(); | |
7492 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7493 v3->PlaySound(SPEECH_93, 0); |
0 | 7494 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7495 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7496 { | |
7497 v64 = 0; | |
7498 v55 = 16; | |
7499 } | |
7500 else | |
7501 { | |
7502 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7503 { | |
7504 v64 = 0; | |
7505 v55 = 14; | |
7506 } | |
7507 else | |
7508 { | |
7509 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7510 return; | |
7511 v64 = 0; | |
7512 v55 = 15; | |
7513 } | |
7514 } | |
7515 v3->SetCondition(v55, v64); | |
7516 v61 = 0; | |
7517 v52 = 0; | |
7518 v48 = 0; | |
7519 v45 = 0; | |
7520 v43 = -1; | |
7521 v41 = 0; | |
7522 v39 = 0; | |
7523 v37 = (SoundID)215; | |
7524 v14 = pAudioPlayer; | |
7525 goto LABEL_63; | |
7526 default: | |
7527 goto LABEL_54; | |
7528 } | |
7529 } | |
7530 if ( pParty->pPickedItem.uItemID == 630 ) | |
7531 { | |
7532 Party::GiveFood(1u); | |
7533 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7534 } | |
7535 else | |
7536 { | |
7537 if ( pParty->pPickedItem.uItemID == 632 ) | |
7538 { | |
7539 v61 = 0; | |
7540 v52 = 0; | |
7541 v48 = 0; | |
7542 v45 = 0; | |
7543 v43 = -1; | |
7544 v41 = 0; | |
7545 v39 = 0; | |
7546 v37 = (SoundID)133; | |
7547 goto LABEL_93; | |
7548 } | |
7549 if ( pParty->pPickedItem.uItemID == 633 ) | |
7550 { | |
7551 v61 = 0; | |
7552 v52 = 0; | |
7553 v48 = 0; | |
7554 v45 = 0; | |
7555 v43 = -1; | |
7556 v41 = 0; | |
7557 v39 = 0; | |
7558 v37 = (SoundID)134; | |
7559 goto LABEL_93; | |
7560 } | |
7561 if ( pParty->pPickedItem.uItemID == 634 ) | |
7562 { | |
7563 v61 = 0; | |
7564 v52 = 0; | |
7565 v48 = 0; | |
7566 v45 = 0; | |
7567 v43 = -1; | |
7568 v41 = 0; | |
7569 v39 = 0; | |
7570 v37 = (SoundID)135; | |
7571 goto LABEL_93; | |
7572 } | |
7573 if ( pParty->pPickedItem.uItemID != 646 ) | |
7574 { | |
7575 if ( pParty->pPickedItem.uItemID == 650 ) | |
7576 { | |
7577 sub_44C28F_open_nwc_dungeon(); | |
7578 return; | |
7579 } | |
7580 goto LABEL_167; | |
7581 } | |
7582 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7583 v5 = 8 * a2 + 392; | |
862 | 7584 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7585 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7586 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7587 } | |
7588 LABEL_187: | |
7589 pMouse->RemoveHoldingItem(); | |
7590 return; | |
7591 } | |
243 | 7592 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7593 { |
7594 sub_467F48(pParty->pPickedItem.uItemID); | |
7595 v65 = 0; | |
187 | 7596 v56 = SPEECH_37; |
0 | 7597 LABEL_67: |
187 | 7598 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7599 return; |
7600 } | |
7601 LABEL_89: | |
7602 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7603 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7604 LABEL_90: | |
809 | 7605 sprintfex(pTmpBuf, v58, v68); |
0 | 7606 v23 = pTmpBuf; |
7607 LABEL_91: | |
7608 ShowStatusBarString(v23, 2u); | |
7609 v4 = 0; | |
7610 goto LABEL_92; | |
7611 } | |
7612 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7613 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7614 if ( *v72 ) |
7615 { | |
7616 v66 = pParty->pPickedItem.GetDisplayName(); | |
7617 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7618 LABEL_72: | |
7619 sprintf(pTmpBuf, v57, v66); | |
7620 ShowStatusBarString(pTmpBuf, 2u); | |
7621 LABEL_92: | |
7622 v61 = v4; | |
7623 v52 = v4; | |
7624 v48 = v4; | |
7625 v45 = v4; | |
7626 v43 = -1; | |
7627 v41 = v4; | |
7628 v39 = v4; | |
7629 v37 = (SoundID)27; | |
7630 LABEL_93: | |
7631 v14 = pAudioPlayer; | |
7632 LABEL_63: | |
7633 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7634 return; | |
7635 } | |
243 | 7636 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7637 { |
7638 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7639 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7640 goto LABEL_72; | |
7641 } | |
7642 v16 = v15 % 11 + 1; | |
7643 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7644 v75 = v16; | |
7645 v18 = SkillToMastery(*v17) - 1; | |
7646 if ( v18 ) | |
7647 { | |
7648 v19 = v18 - 1; | |
7649 if ( v19 ) | |
7650 { | |
7651 v20 = v19 - 1; | |
7652 if ( v20 ) | |
7653 { | |
7654 if ( v20 != 1 ) | |
7655 { | |
7656 v21 = a2; | |
7657 LABEL_83: | |
7658 if ( v75 > v21 || !*v17 ) | |
7659 { | |
7660 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7661 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7662 ShowStatusBarString(pTmpBuf, 2u); |
7663 v65 = 0; | |
7664 v56 = 20; | |
7665 goto LABEL_67; | |
7666 } | |
7667 *v72 = 1; | |
187 | 7668 v3->PlaySound(SPEECH_21, 0); |
0 | 7669 v73 = 0; |
7670 LABEL_173: | |
7671 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7672 if ( v36 == 14 ) | |
7673 { | |
7674 v71 = 0; | |
7675 v60 = 0; | |
7676 v51 = 0; | |
7677 v47 = 0; | |
7678 v44 = -1; | |
7679 v42 = 0; | |
7680 v40 = 0; | |
7681 v38 = (SoundID)210; | |
7682 } | |
7683 else | |
7684 { | |
7685 if ( v36 != 13 ) | |
7686 { | |
7687 LABEL_178: | |
7688 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7689 { | |
7690 if ( !v73 ) | |
7691 goto LABEL_187; | |
437 | 7692 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7693 { |
990 | 7694 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7695 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7696 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7697 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7698 }*/ |
7699 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7700 } |
7701 if ( v73 ) | |
7702 { | |
7703 if ( pParty->bTurnBasedModeOn ) | |
7704 { | |
7705 *(&pParty->field_16140 + a2) = 100; | |
7706 thisb->SetRecoveryTime(100); | |
7707 pTurnEngine->_40471C(); | |
7708 } | |
7709 else | |
7710 { | |
7711 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7712 } | |
7713 } | |
7714 goto LABEL_187; | |
7715 } | |
7716 v71 = 0; | |
7717 v60 = 0; | |
7718 v51 = 0; | |
7719 v47 = 0; | |
7720 v44 = -1; | |
7721 v42 = 0; | |
7722 v40 = 0; | |
7723 v38 = (SoundID)211; | |
7724 } | |
7725 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7726 goto LABEL_178; | |
7727 } | |
7728 v67 = 11; | |
7729 } | |
7730 else | |
7731 { | |
7732 v67 = 10; | |
7733 } | |
7734 } | |
7735 else | |
7736 { | |
7737 v67 = 7; | |
7738 } | |
7739 } | |
7740 else | |
7741 { | |
7742 v67 = 4; | |
7743 } | |
7744 v21 = v67; | |
7745 goto LABEL_83; | |
7746 } | |
151 | 7747 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7748 return; |
243 | 7749 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7750 goto LABEL_89; |
7751 if ( bUnderwater == 1 ) | |
7752 { | |
7753 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7754 goto LABEL_91; | |
7755 } | |
7756 dword_50C9AC = 1; | |
7757 v24 = pParty->pPickedItem.uItemID - 299; | |
7758 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7759 { | |
7760 pMouse->RemoveHoldingItem(); | |
7761 pGUIWindow_CurrentMenu->Release(); | |
7762 pIcons_LOD->_4114F2(); | |
151 | 7763 pCurrentScreen = SCREEN_GAME; |
0 | 7764 viewparams->bRedrawGameUI = 1; |
7765 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7766 } | |
7767 else | |
7768 { | |
7769 _720984_unused = pParty->pPickedItem.uItemID; | |
7770 pMouse->RemoveHoldingItem(); | |
998 | 7771 /*if ( dword_50C9E8 < 40 ) |
0 | 7772 { |
7773 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7774 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7775 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7776 ++dword_50C9E8; |
998 | 7777 }*/ |
7778 pMessageQueue_50CBD0->AddMessage(UIMSG_92, 0, 0); | |
0 | 7779 if ( pCurrentScreen |
7780 && pGUIWindow_CurrentMenu | |
437 | 7781 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7782 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7783 { | |
990 | 7784 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7785 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7786 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7787 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7788 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7789 } | |
7790 } | |
7791 } | |
0 | 7792 |
7793 | |
7794 | |
7795 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7796 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7797 { | |
0 | 7798 Player *v3; // esi@1 |
7799 signed int v4; // edi@1 | |
7800 unsigned int v5; // eax@8 | |
7801 int v6; // eax@9 | |
7802 enum CHARACTER_RACE v7; // eax@11 | |
7803 signed int v8; // eax@17 | |
7804 unsigned __int8 v9; // sf@17 | |
7805 unsigned __int8 v10; // of@17 | |
7806 int v11; // eax@19 | |
7807 unsigned int v12; // eax@20 | |
484 | 7808 unsigned int test_bit_value; // eax@25 |
7809 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7810 signed int v15; // ecx@28 |
7811 ItemGen *v16; // eax@28 | |
7812 char v17; // zf@31 | |
7813 int v18; // edi@90 | |
7814 DDM_DLV_Header *v19; // eax@122 | |
7815 char v20; // cl@124 | |
7816 DDM_DLV_Header *v21; // eax@126 | |
7817 unsigned int v22; // edi@129 | |
100 | 7818 Player *v23; // esi@134 |
0 | 7819 ItemGen *v24; // ecx@135 |
7820 signed int v25; // edx@135 | |
7821 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7822 char *v27; // edi@155 | |
7823 int v28; // ebx@161 | |
7824 int v29; // eax@161 | |
7825 | |
469 | 7826 v6 = 0; |
0 | 7827 v3 = this; |
7828 v4 = -1; | |
469 | 7829 if ( VarNum > VAR_AutoNotes ) |
7830 { | |
7831 switch ( VarNum ) | |
0 | 7832 { |
7833 case VAR_Invisible: | |
484 | 7834 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7835 return true; |
484 | 7836 return false; |
0 | 7837 case VAR_NumDeaths: |
7838 v4 = pParty->uNumDeaths; | |
469 | 7839 return v4 >= pValue; |
0 | 7840 case VAR_NumBounties: |
7841 v4 = pParty->uNumBountiesCollected; | |
469 | 7842 return v4 >= pValue; |
0 | 7843 case VAR_PrisonTerms: |
7844 v4 = pParty->uNumPrisonTerms; | |
469 | 7845 return v4 >= pValue; |
0 | 7846 case VAR_ArenaWinsPage: |
7847 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7848 return v4 >= pValue; |
0 | 7849 case VAR_ArenaWinsSquire: |
7850 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7851 return v4 >= pValue; |
0 | 7852 case VAR_ArenaWinsKnight: |
7853 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7854 return v4 >= pValue; |
0 | 7855 case VAR_ArenaWinsLord: |
7856 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7857 return v4 >= pValue; |
0 | 7858 case VAR_ReputationInCurrentLocation: |
7859 v19 = &pOutdoor->ddm; | |
7860 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7861 v19 = &pIndoor->dlv; | |
469 | 7862 v6 = v19->uReputation >= pValue; |
7863 return v6; | |
0 | 7864 case VAR_History_28|VAR_Sex: |
7865 v21 = &pOutdoor->ddm; | |
7866 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7867 v21 = &pIndoor->dlv; | |
469 | 7868 v6 = v21->field_C_alert == pValue; |
0 | 7869 return v6; |
7870 case VAR_MonthEquals2|VAR_Sex: | |
7871 case VAR_MonthEquals2|VAR_Class: | |
7872 case VAR_Counter1: | |
7873 case VAR_Counter2: | |
7874 case VAR_Counter3: | |
7875 case VAR_Counter4: | |
7876 case VAR_Counter5: | |
7877 case VAR_Counter6: | |
7878 case VAR_Counter7: | |
7879 case VAR_Counter8: | |
469 | 7880 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7881 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7882 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7883 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7884 return true; | |
7885 return false; | |
0 | 7886 case VAR_NumSkillPoints: |
7887 v4 = this->uSkillPoints; | |
469 | 7888 return v4 >= pValue; |
0 | 7889 case VAR_CircusPrises: |
7890 v4 = 0; | |
100 | 7891 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7892 do |
7893 { | |
469 | 7894 v24 = v23->pInventoryItems; |
0 | 7895 v25 = 138; |
7896 do | |
7897 { | |
7898 switch ( v24->uItemID ) | |
7899 { | |
7900 case 0x1D6u: | |
7901 ++v4; | |
7902 break; | |
7903 case 0x1D7u: | |
7904 v4 += 3; | |
7905 break; | |
7906 case 0x1DDu: | |
7907 v4 += 5; | |
7908 break; | |
7909 } | |
7910 ++v24; | |
7911 --v25; | |
7912 } | |
7913 while ( v25 ); | |
100 | 7914 ++v23; |
0 | 7915 } |
100 | 7916 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7917 return v4 >= pValue; |
0 | 7918 case VAR_MonthEquals2: |
469 | 7919 v6 = pParty->uCurrentMonth == pValue; |
7920 return v6; | |
0 | 7921 case VAR_IsFlying: |
7922 if ( pParty->bFlying | |
484 | 7923 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7924 return true; |
7925 return false; | |
0 | 7926 case VAR_HiredNPCHasSpeciality: |
469 | 7927 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7928 return v6; |
7929 case VAR_NPCs2: | |
469 | 7930 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7931 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7932 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7933 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7934 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7935 return v4 >= pValue; |
7936 v4 = pValue; | |
7937 return v4 >= pValue; | |
0 | 7938 case VAR_ItemEquipped: |
7939 v26 = (ITEM_EQUIP_TYPE)0; | |
7940 v27 = (char *)&this->pEquipment; | |
7941 break; | |
7942 case VAR_GoldInBank: | |
7943 v4 = pParty->uNumGoldInBank; | |
469 | 7944 return v4 >= pValue; |
0 | 7945 case VAR_ThieverySkill|0x80: |
7946 v28 = GetActualMight(); | |
7947 v29 = v3->GetBaseStrength(); | |
7948 goto LABEL_168; | |
7949 case VAR_DisarmTrapSkill|0x80: | |
7950 v28 = GetActualIntelligence(); | |
7951 v29 = v3->GetBaseIntelligence(); | |
7952 goto LABEL_168; | |
7953 case VAR_MonthEquals: | |
7954 v28 = GetActualWillpower(); | |
7955 v29 = v3->GetBaseWillpower(); | |
7956 goto LABEL_168; | |
7957 case VAR_MonthEquals|VAR_Sex: | |
7958 v28 = GetActualEndurance(); | |
7959 v29 = v3->GetBaseEndurance(); | |
7960 goto LABEL_168; | |
7961 case VAR_IdentifyMonsterSkill|0x80: | |
7962 v28 = GetActualSpeed(); | |
7963 v29 = v3->GetBaseSpeed(); | |
7964 goto LABEL_168; | |
7965 case VAR_ArmsmasterSkill|0x80: | |
7966 v28 = GetActualAccuracy(); | |
7967 v29 = v3->GetBaseAccuracy(); | |
7968 goto LABEL_168; | |
7969 case VAR_MonthEquals|VAR_MaxHP: | |
7970 v28 = GetActualLuck(); | |
7971 v29 = v3->GetBaseLuck(); | |
7972 LABEL_168: | |
7973 v10 = __OFSUB__(v28, v29); | |
7974 v9 = v28 - v29 < 0; | |
7975 LABEL_169: | |
7976 if ( v9 ^ v10 ) | |
469 | 7977 return v4 >= pValue; |
7978 return true; | |
0 | 7979 default: |
469 | 7980 return v4 >= pValue; |
0 | 7981 } |
7982 while ( !v3->HasItemEquipped(v26) | |
654 | 7983 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7984 { |
7985 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7986 v27 += 4; | |
7987 if ( (signed int)v26 >= 16 ) | |
469 | 7988 return false; |
7989 } | |
7990 return true; | |
7991 } | |
7992 if ( VarNum == VAR_AutoNotes ) | |
0 | 7993 { |
484 | 7994 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7995 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7996 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7997 return false; | |
7998 return true; | |
469 | 7999 } |
8000 if ( VarNum <= VAR_BaseLuck ) | |
8001 { | |
8002 if ( VarNum != VAR_BaseLuck ) | |
8003 { | |
8004 switch ( VarNum ) | |
0 | 8005 { |
8006 case VAR_Hour: | |
469 | 8007 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
8008 return true; | |
8009 return false; | |
0 | 8010 case VAR_DayOfYear: |
469 | 8011 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
8012 v6 = v5 == pValue; | |
8013 return v6; | |
0 | 8014 case VAR_DayOfWeek: |
469 | 8015 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
8016 v6 = v5 == pValue; | |
0 | 8017 return v6; |
8018 case VAR_Sex: | |
469 | 8019 if ( pValue == (CHARACTER_RACE)this->uSex ) |
8020 return true; | |
8021 return v4 >= pValue; | |
0 | 8022 case VAR_Class: |
135 | 8023 v7 = (CHARACTER_RACE)this->classType; |
469 | 8024 if ( pValue == v7 ) |
8025 return true; | |
8026 return v4 >= pValue; | |
0 | 8027 case VAR_Race: |
8028 v7 = GetRace(); | |
469 | 8029 if ( pValue == v7 ) |
8030 return true; | |
8031 return v4 >= pValue; | |
0 | 8032 case VAR_CurrentHP: |
8033 v4 = this->sHealth; | |
469 | 8034 return v4 >= pValue; |
0 | 8035 case VAR_MaxHP: |
8036 v8 = GetMaxHealth(); | |
8037 v10 = __OFSUB__(v3->sHealth, v8); | |
8038 v9 = v3->sHealth - v8 < 0; | |
8039 goto LABEL_169; | |
8040 case VAR_CurrentSP: | |
8041 v4 = this->sMana; | |
469 | 8042 return v4 >= pValue; |
0 | 8043 case VAR_MaxSP: |
8044 v11 = GetMaxMana(); | |
8045 v10 = __OFSUB__(v3->sMana, v11); | |
8046 v9 = v3->sMana - v11 < 0; | |
8047 goto LABEL_169; | |
8048 case VAR_ActualAC: | |
8049 v12 = GetActualAC(); | |
8050 goto _j_cmp_against_arg; | |
8051 case VAR_ACModifier: | |
8052 v4 = this->sACModifier; | |
469 | 8053 return v4 >= pValue; |
0 | 8054 case VAR_BaseLevel: |
8055 v4 = this->uLevel; | |
469 | 8056 return v4 >= pValue; |
0 | 8057 case VAR_LevelModifier: |
8058 v4 = this->sLevelModifier; | |
469 | 8059 return v4 >= pValue; |
0 | 8060 case VAR_Age: |
8061 v12 = GetActualAge(); | |
8062 goto _j_cmp_against_arg; | |
8063 case VAR_Award: | |
484 | 8064 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
8065 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
8066 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8067 return true; | |
8068 return false; | |
0 | 8069 case VAR_Experience: |
8070 v4 = LODWORD(this->uExperience); | |
469 | 8071 return v4 >= pValue; |
0 | 8072 case VAR_QBits_QuestsDone: |
484 | 8073 test_bit_value = 0x80u >> (pValue - 1) % 8; |
8074 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
8075 if ( test_bit_value & our_bit_value ) | |
478 | 8076 return true; |
8077 return false; | |
0 | 8078 case VAR_PlayerItemInHands: |
8079 v15 = 0; | |
8080 v16 = v3->pInventoryItems; | |
8081 break; | |
8082 case VAR_FixedGold: | |
8083 v4 = pParty->uNumGold; | |
469 | 8084 return v4 >= pValue; |
0 | 8085 case VAR_MightBonus: |
8086 v4 = this->uMightBonus; | |
469 | 8087 return v4 >= pValue; |
0 | 8088 case VAR_IntellectBonus: |
8089 v4 = this->uIntelligenceBonus; | |
469 | 8090 return v4 >= pValue; |
0 | 8091 case VAR_PersonalityBonus: |
8092 v4 = this->uWillpowerBonus; | |
469 | 8093 return v4 >= pValue; |
0 | 8094 case VAR_EnduranceBonus: |
8095 v4 = this->uEnduranceBonus; | |
469 | 8096 return v4 >= pValue; |
0 | 8097 case VAR_SpeedBonus: |
8098 v4 = this->uSpeedBonus; | |
469 | 8099 return v4 >= pValue; |
0 | 8100 case VAR_AccuracyBonus: |
8101 v4 = this->uAccuracyBonus; | |
469 | 8102 return v4 >= pValue; |
0 | 8103 case VAR_LuckBonus: |
8104 v4 = this->uLuckBonus; | |
469 | 8105 return v4 >= pValue; |
0 | 8106 case VAR_BaseMight: |
8107 v4 = this->uMight; | |
469 | 8108 return v4 >= pValue; |
0 | 8109 case VAR_BaseIntellect: |
8110 v4 = this->uIntelligence; | |
469 | 8111 return v4 >= pValue; |
0 | 8112 case VAR_BasePersonality: |
8113 v4 = this->uWillpower; | |
469 | 8114 return v4 >= pValue; |
0 | 8115 case VAR_BaseEndurance: |
8116 v4 = this->uEndurance; | |
469 | 8117 return v4 >= pValue; |
0 | 8118 case VAR_BaseSpeed: |
8119 v4 = this->uSpeed; | |
469 | 8120 return v4 >= pValue; |
0 | 8121 case VAR_BaseAccuracy: |
8122 v4 = this->uAccuracy; | |
469 | 8123 return v4 >= pValue; |
0 | 8124 case VAR_FixedFood: |
8125 v4 = pParty->uNumFoodRations; | |
469 | 8126 return v4 >= pValue; |
0 | 8127 default: |
469 | 8128 return v4 >= pValue; |
8129 } | |
8130 while ( v16->uItemID != pValue ) | |
0 | 8131 { |
8132 ++v15; | |
8133 ++v16; | |
8134 if ( v15 >= 138 ) | |
8135 { | |
469 | 8136 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8137 return v6; |
8138 } | |
8139 } | |
469 | 8140 return true; |
0 | 8141 } |
8142 v4 = this->uLuck; | |
469 | 8143 return v4 >= pValue; |
8144 } | |
8145 if ( VarNum <= VAR_MagicResistance ) | |
8146 { | |
8147 if ( VarNum == VAR_MagicResistance ) | |
0 | 8148 { |
8149 v4 = this->sResMagicBase; | |
8150 } | |
8151 else | |
8152 { | |
469 | 8153 switch ( VarNum ) |
0 | 8154 { |
8155 case VAR_FireResistance: | |
8156 v4 = this->sResFireBase; | |
469 | 8157 return v4 >= pValue; |
0 | 8158 case VAR_AirResistance: |
8159 v4 = this->sResAirBase; | |
469 | 8160 return v4 >= pValue; |
0 | 8161 case VAR_WaterResistance: |
8162 v4 = this->sResWaterBase; | |
469 | 8163 return v4 >= pValue; |
0 | 8164 case VAR_EarthResistance: |
8165 v4 = this->sResEarthBase; | |
469 | 8166 return v4 >= pValue; |
0 | 8167 case VAR_SpiritResistance: |
8168 v4 = this->sResSpiritBase; | |
469 | 8169 return v4 >= pValue; |
0 | 8170 case VAR_MindResistance: |
8171 v4 = this->sResMindBase; | |
469 | 8172 return v4 >= pValue; |
0 | 8173 case VAR_BodyResistance: |
8174 v4 = this->sResBodyBase; | |
469 | 8175 return v4 >= pValue; |
0 | 8176 case VAR_LightResistance: |
8177 v4 = this->sResLightBase; | |
469 | 8178 return v4 >= pValue; |
0 | 8179 case VAR_DarkResistance: |
8180 v4 = this->sResDarkBase; | |
469 | 8181 return v4 >= pValue; |
0 | 8182 case VAR_ActualMight: |
8183 v12 = GetActualMight(); | |
8184 goto _j_cmp_against_arg; | |
8185 case VAR_ActualIntellect: | |
8186 v12 = GetActualIntelligence(); | |
8187 goto _j_cmp_against_arg; | |
8188 case VAR_ActualPersonality: | |
8189 v12 = GetActualWillpower(); | |
8190 goto _j_cmp_against_arg; | |
8191 case VAR_ActualEndurance: | |
8192 v12 = GetActualEndurance(); | |
8193 goto _j_cmp_against_arg; | |
8194 case VAR_ActualSpeed: | |
8195 v12 = GetActualSpeed(); | |
8196 goto _j_cmp_against_arg; | |
8197 case VAR_ActualAccuracy: | |
8198 v12 = GetActualAccuracy(); | |
8199 goto _j_cmp_against_arg; | |
8200 case VAR_ActualLuck: | |
8201 v12 = GetActualLuck(); | |
8202 _j_cmp_against_arg: | |
8203 v4 = v12; | |
8204 break; | |
8205 default: | |
469 | 8206 return v4 >= pValue; |
8207 } | |
8208 } | |
8209 return v4 >= pValue; | |
8210 } | |
8211 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8212 { | |
8213 if ( VarNum != VAR_DisarmTrapSkill ) | |
8214 { | |
8215 if ( VarNum <= VAR_MindResistanceBonus ) | |
8216 { | |
8217 switch ( VarNum ) | |
0 | 8218 { |
8219 case VAR_MindResistanceBonus: | |
8220 v4 = this->sResMindBonus; | |
8221 break; | |
8222 case VAR_FireResistanceBonus: | |
8223 v4 = this->sResFireBonus; | |
8224 break; | |
8225 case VAR_AirResistanceBonus: | |
8226 v4 = this->sResAirBonus; | |
8227 break; | |
8228 case VAR_WaterResistanceBonus: | |
8229 v4 = this->sResWaterBonus; | |
8230 break; | |
8231 case VAR_EarthResistanceBonus: | |
8232 v4 = this->sResEarthBonus; | |
8233 break; | |
8234 case VAR_SpiritResistanceBonus: | |
8235 v4 = this->sResSpiritBonus; | |
8236 break; | |
8237 } | |
469 | 8238 return v4 >= pValue; |
8239 } | |
8240 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8241 { |
8242 v4 = this->sResBodyBonus; | |
469 | 8243 return v4 >= pValue; |
8244 } | |
8245 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8246 { |
8247 v4 = this->sResLightBonus; | |
469 | 8248 return v4 >= pValue; |
8249 } | |
8250 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8251 { |
8252 v4 = this->sResDarkBonus; | |
469 | 8253 return v4 >= pValue; |
8254 } | |
8255 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8256 { |
8257 v4 = this->sResMagicBonus; | |
469 | 8258 return v4 >= pValue; |
8259 } | |
8260 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8261 return v4 >= pValue; | |
0 | 8262 } |
8263 LABEL_90: | |
469 | 8264 v18 = *((short *)&this->pConditions[16] + VarNum); |
8265 if ( pValue <= 63 ) | |
0 | 8266 v4 = v18 & 0x3F; |
8267 else | |
469 | 8268 v4 = pValue & v18; |
8269 return v4 >= pValue; | |
8270 } | |
8271 if ( VarNum == 104 ) | |
0 | 8272 goto LABEL_90; |
469 | 8273 if ( (signed int)VarNum <= 104 ) |
8274 return v4 >= pValue; | |
8275 if ( (signed int)VarNum > 0x79 ) | |
8276 { | |
8277 if ( VarNum != 122 ) | |
8278 { | |
8279 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8280 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8281 return v4 >= pValue; | |
0 | 8282 } |
8283 v4 = GetMajorConditionIdx(); | |
8284 if ( v4 != 18 ) | |
8285 { | |
469 | 8286 return v4 >= pValue; |
8287 } | |
8288 v4 = pValue; | |
8289 return v4 >= pValue; | |
8290 } | |
8291 return *((int *)this + 2 * VarNum - 210); | |
0 | 8292 } |
8293 | |
8294 | |
8295 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8296 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8297 { | |
8298 signed int currPlayerId; // ebx@1 | |
0 | 8299 Player *v4; // esi@1 |
8300 unsigned int v5; // edi@1 | |
8301 unsigned int v6; // esi@13 | |
8302 unsigned int v7; // esi@14 | |
8303 signed int v8; // eax@17 | |
8304 ItemGen *v9; // ecx@17 | |
8305 int v10; // eax@21 | |
8306 signed int v11; // eax@30 | |
8307 Player *v12; // ecx@44 | |
8308 char *v13; // ecx@45 | |
8309 Player *v14; // ecx@49 | |
8310 int v15; // ecx@86 | |
8311 int v16; // esi@106 | |
8312 char v17; // al@106 | |
8313 int v18; // eax@107 | |
8314 Player *v19; // ecx@112 | |
8315 Player *v20; // ecx@127 | |
8316 int v21; // eax@127 | |
8317 int v22; // eax@145 | |
8318 char v23; // zf@146 | |
8319 DDM_DLV_Header *v24; // ecx@148 | |
8320 signed int v25; // eax@172 | |
8321 int v26; // [sp-8h] [bp-3Ch]@84 | |
8322 signed int v27; // [sp-4h] [bp-38h]@4 | |
8323 int v28; // [sp-4h] [bp-38h]@84 | |
8324 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8325 char v30; // [sp+32h] [bp-2h]@1 | |
8326 char v31; // [sp+33h] [bp-1h]@1 | |
8327 | |
492 | 8328 currPlayerId = 0; |
0 | 8329 v30 = 0; |
8330 v31 = 0; | |
8331 v4 = this; | |
8332 v5 = 0; | |
8333 if ( this == pPlayers[2] ) | |
492 | 8334 currPlayerId = 1; |
8335 else if ( this == pPlayers[3] ) | |
8336 currPlayerId = 2; | |
757 | 8337 else if ( this == pPlayers[4] ) |
492 | 8338 currPlayerId = 3; |
8339 if ( var_type > VAR_AutoNotes ) | |
8340 { | |
8341 if ( var_type <= VAR_GoldInBank ) | |
8342 { | |
8343 if ( var_type == VAR_GoldInBank ) | |
8344 { | |
8345 pParty->uNumGoldInBank = var_value; | |
0 | 8346 return; |
8347 } | |
492 | 8348 if ( var_type <= VAR_Counter8 ) |
8349 { | |
8350 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8351 { |
492 | 8352 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8353 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8354 } |
8355 else | |
8356 { | |
492 | 8357 switch ( var_type ) |
0 | 8358 { |
8359 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8360 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8361 break; |
8362 case VAR_NPCs2: | |
8363 pParty->field_709 = 0; | |
492 | 8364 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8365 Party__CountHirelings(); |
0 | 8366 viewparams->bRedrawGameUI = 1; |
8367 break; | |
8368 case VAR_NumSkillPoints: | |
492 | 8369 this->uSkillPoints = var_value; |
0 | 8370 break; |
8371 } | |
8372 } | |
8373 return; | |
8374 } | |
492 | 8375 if ( var_type < VAR_Counter9 ) |
0 | 8376 return; |
492 | 8377 if ( (signed int)var_type <= 0x112 ) |
8378 { | |
8379 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8380 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8381 } |
8382 else | |
8383 { | |
492 | 8384 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8385 { |
8386 v24 = &pOutdoor->ddm; | |
8387 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8388 v24 = &pIndoor->dlv; | |
492 | 8389 v24->uReputation = var_value; |
8390 if ( var_value > 10000 ) | |
0 | 8391 v24->uReputation = 10000; |
8392 return; | |
8393 } | |
492 | 8394 if ( var_type <= VAR_ReputationInCurrentLocation |
8395 || var_type > VAR_History_28 | |
8396 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8397 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8398 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8399 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8400 v23) ) |
8401 return; | |
8402 bFlashHistoryBook = 1; | |
8403 } | |
8404 LABEL_172: | |
492 | 8405 v25 = 8 * currPlayerId + 400; |
862 | 8406 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8407 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8408 return; | |
8409 } | |
492 | 8410 if ( var_type != 307 ) |
8411 { | |
8412 switch ( var_type ) | |
0 | 8413 { |
8414 case 308: | |
492 | 8415 pParty->uNumBountiesCollected = var_value; |
0 | 8416 break; |
8417 case 309: | |
492 | 8418 pParty->uNumPrisonTerms = var_value; |
0 | 8419 break; |
8420 case 310: | |
492 | 8421 pParty->uNumArenaPageWins = var_value; |
0 | 8422 break; |
8423 case 311: | |
492 | 8424 pParty->uNumArenaSquireWins = var_value; |
0 | 8425 break; |
8426 case 312: | |
492 | 8427 pParty->uNumArenaKnightWins = var_value; |
0 | 8428 break; |
8429 case 313: | |
492 | 8430 pParty->uNumArenaLordWins = var_value; |
0 | 8431 break; |
8432 } | |
8433 return; | |
8434 } | |
492 | 8435 pParty->uNumDeaths = var_value; |
0 | 8436 LABEL_168: |
8437 if ( v30 != 1 ) | |
8438 { | |
8439 LABEL_170: | |
8440 if ( v31 != 1 ) | |
8441 return; | |
8442 v5 = 0; | |
8443 goto LABEL_172; | |
8444 } | |
8445 LABEL_169: | |
492 | 8446 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8447 goto LABEL_170; |
8448 } | |
492 | 8449 if ( var_type == VAR_AutoNotes ) |
8450 { | |
8451 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
|
8452 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8453 && pAutonoteTxt[var_value-1].pText ) |
8454 { | |
8455 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8456 v30 = 1; |
187 | 8457 v20->PlaySound(SPEECH_96, 0); |
492 | 8458 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8459 bFlashAutonotesBook = 1; |
981 | 8460 _506568_autonote_type = v21; |
0 | 8461 } |
492 | 8462 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8463 v31 = 1; |
8464 goto LABEL_168; | |
8465 } | |
492 | 8466 if ( var_type <= VAR_ActualMight ) |
8467 { | |
8468 if ( var_type != VAR_ActualMight ) | |
8469 { | |
8470 switch ( var_type ) | |
0 | 8471 { |
8472 case VAR_RandomGold: | |
492 | 8473 v6 = rand() % var_value + 1; |
0 | 8474 Party::SetGold(v6); |
8475 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8476 ShowStatusBarString(pTmpBuf, 2u); | |
8477 GameUI_DrawFoodAndGold(); | |
8478 return; | |
8479 case VAR_RandomFood: | |
492 | 8480 v7 = rand() % var_value + 1; |
0 | 8481 Party::SetFood(v7); |
8482 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8483 ShowStatusBarString(pTmpBuf, 2u); | |
8484 GameUI_DrawFoodAndGold(); | |
8485 goto LABEL_124; | |
8486 case VAR_Sex: | |
492 | 8487 this->uSex = (PLAYER_SEX)var_value; |
0 | 8488 goto LABEL_124; |
8489 case VAR_Class: | |
492 | 8490 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8491 if ( (char)var_value != 35 ) | |
0 | 8492 goto LABEL_124; |
8493 v8 = 0; | |
8494 v9 = this->pInventoryItems; | |
8495 break; | |
8496 case VAR_CurrentHP: | |
492 | 8497 this->sHealth = var_value; |
0 | 8498 goto LABEL_124; |
8499 case VAR_MaxHP: | |
8500 this->sHealth = GetMaxHealth(); | |
8501 return; | |
8502 case VAR_CurrentSP: | |
492 | 8503 this->sMana = var_value; |
0 | 8504 goto LABEL_124; |
8505 case VAR_MaxSP: | |
8506 this->sMana = GetMaxMana(); | |
8507 return; | |
8508 case VAR_ACModifier: | |
492 | 8509 this->sACModifier = (unsigned __int8)var_value; |
0 | 8510 goto LABEL_124; |
8511 case VAR_BaseLevel: | |
492 | 8512 this->uLevel = (unsigned __int8)var_value; |
0 | 8513 goto LABEL_124; |
8514 case VAR_LevelModifier: | |
492 | 8515 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8516 goto LABEL_124; |
8517 case VAR_Age: | |
492 | 8518 this->sAgeModifier = var_value; |
0 | 8519 return; |
8520 case VAR_Award: | |
492 | 8521 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8522 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
|
8523 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8524 && pAwards[var_value].pText ) |
0 | 8525 { |
8526 v30 = 1; | |
8527 v31 = 1; | |
492 | 8528 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8529 } |
492 | 8530 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8531 goto LABEL_168; | |
0 | 8532 case VAR_Experience: |
492 | 8533 this->uExperience = var_value; |
0 | 8534 goto LABEL_124; |
8535 case VAR_QBits_QuestsDone: | |
492 | 8536 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
|
8537 // && (&dword_722F10)[4 * a3] ) |
492 | 8538 && pQuestTable[var_value-1] ) |
0 | 8539 { |
492 | 8540 v14 = pPlayers[currPlayerId + 1]; |
0 | 8541 bFlashQuestBook = 1; |
8542 v30 = 1; | |
8543 v31 = 1; | |
187 | 8544 v14->PlaySound(SPEECH_93, 0); |
0 | 8545 } |
484 | 8546 v13 = (char *)pParty->_quest_bits; |
0 | 8547 LABEL_51: |
492 | 8548 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8549 if (( v30 != 1 )&&( v31 != 1 )) | |
8550 return; | |
8551 else | |
8552 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8553 if ( v31 != 1 ) | |
8554 return; | |
8555 v25 = 8 * currPlayerId + 400; | |
862 | 8556 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8557 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8558 return; | |
0 | 8559 case VAR_PlayerItemInHands: |
8560 item.Reset(); | |
8561 item.Reset(); | |
492 | 8562 item.uItemID = var_value; |
0 | 8563 item.uAttributes = 1; |
8564 pParty->SetHoldingItem(&item); | |
492 | 8565 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8566 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8567 return; |
8568 case VAR_FixedGold: | |
492 | 8569 Party::SetGold(var_value); |
0 | 8570 return; |
8571 case VAR_BaseMight: | |
492 | 8572 this->uMight = (unsigned __int8)var_value; |
0 | 8573 goto LABEL_84; |
8574 case VAR_BaseIntellect: | |
492 | 8575 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8576 goto LABEL_84; |
8577 case VAR_BasePersonality: | |
492 | 8578 this->uWillpower = (unsigned __int8)var_value; |
0 | 8579 goto LABEL_84; |
8580 case VAR_BaseEndurance: | |
492 | 8581 this->uEndurance = (unsigned __int8)var_value; |
0 | 8582 goto LABEL_84; |
8583 case VAR_BaseSpeed: | |
492 | 8584 this->uSpeed = (unsigned __int8)var_value; |
0 | 8585 goto LABEL_84; |
8586 case VAR_BaseAccuracy: | |
492 | 8587 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8588 goto LABEL_84; |
8589 case VAR_BaseLuck: | |
492 | 8590 this->uLuck = (unsigned __int8)var_value; |
0 | 8591 goto LABEL_84; |
8592 case VAR_FixedFood: | |
492 | 8593 Party::SetFood(var_value); |
0 | 8594 goto LABEL_124; |
8595 case VAR_MightBonus: | |
8596 goto LABEL_64; | |
8597 case VAR_IntellectBonus: | |
8598 goto LABEL_68; | |
8599 case VAR_PersonalityBonus: | |
8600 goto LABEL_69; | |
8601 case VAR_EnduranceBonus: | |
8602 goto LABEL_70; | |
8603 case VAR_SpeedBonus: | |
8604 goto LABEL_71; | |
8605 case VAR_AccuracyBonus: | |
8606 goto LABEL_72; | |
8607 case VAR_LuckBonus: | |
8608 goto LABEL_73; | |
8609 default: | |
8610 return; | |
8611 } | |
8612 while ( v9->uItemID != 615 ) | |
8613 { | |
8614 ++v8; | |
8615 ++v9; | |
8616 if ( v8 >= 138 ) | |
8617 goto LABEL_22; | |
8618 } | |
8619 v10 = (int)((char *)v4 + 36 * v8); | |
8620 *(int *)(v10 + 532) = 601; | |
492 | 8621 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8622 LABEL_22: |
8623 if ( v4->sResFireBase < 20 ) | |
8624 v4->sResFireBase = 20; | |
8625 if ( v4->sResAirBase < 20 ) | |
8626 v4->sResAirBase = 20; | |
8627 if ( v4->sResWaterBase < 20 ) | |
8628 v4->sResWaterBase = 20; | |
8629 if ( v4->sResEarthBase < 20 ) | |
8630 v4->sResEarthBase = 20; | |
8631 v4->sResMindBase = 200; | |
8632 v4->sResBodyBase = 200; | |
8633 v11 = v4->GetSexByVoice(); | |
8634 v4->field_1924 = v4->uVoiceID; | |
8635 v4->field_1928 = v4->uFace; | |
8636 if ( v11 ) | |
8637 { | |
8638 v4->uFace = 21; | |
8639 v4->uVoiceID = 21; | |
8640 } | |
8641 else | |
8642 { | |
8643 v4->uFace = 20; | |
8644 v4->uVoiceID = 20; | |
8645 } | |
492 | 8646 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8647 goto LABEL_124; |
8648 } | |
8649 LABEL_64: | |
492 | 8650 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8651 LABEL_111: |
8652 v28 = 0; | |
187 | 8653 v26 = SPEECH_91; |
0 | 8654 LABEL_112: |
492 | 8655 v19 = pPlayers[currPlayerId + 1]; |
0 | 8656 v31 = 1; |
187 | 8657 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8658 goto LABEL_169; |
8659 } | |
492 | 8660 if ( var_type <= VAR_FireResistanceBonus ) |
8661 { | |
8662 if ( var_type == VAR_FireResistanceBonus ) | |
8663 { | |
8664 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8665 goto LABEL_111; |
8666 } | |
492 | 8667 switch ( var_type ) |
0 | 8668 { |
8669 case VAR_ActualIntellect: | |
8670 LABEL_68: | |
492 | 8671 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8672 goto LABEL_111; |
8673 case VAR_ActualPersonality: | |
8674 LABEL_69: | |
492 | 8675 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8676 goto LABEL_111; |
8677 case VAR_ActualEndurance: | |
8678 LABEL_70: | |
492 | 8679 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8680 goto LABEL_111; |
8681 case VAR_ActualSpeed: | |
8682 LABEL_71: | |
492 | 8683 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8684 goto LABEL_111; |
8685 case VAR_ActualAccuracy: | |
8686 LABEL_72: | |
492 | 8687 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8688 goto LABEL_111; |
8689 case VAR_ActualLuck: | |
8690 LABEL_73: | |
492 | 8691 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8692 goto LABEL_111; |
8693 case VAR_FireResistance: | |
492 | 8694 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8695 goto LABEL_84; |
8696 case VAR_AirResistance: | |
492 | 8697 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8698 goto LABEL_84; |
8699 case VAR_WaterResistance: | |
492 | 8700 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8701 goto LABEL_84; |
8702 case VAR_EarthResistance: | |
492 | 8703 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8704 goto LABEL_84; |
8705 case VAR_SpiritResistance: | |
492 | 8706 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8707 goto LABEL_84; |
8708 case VAR_MindResistance: | |
492 | 8709 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8710 goto LABEL_84; |
8711 case VAR_BodyResistance: | |
492 | 8712 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8713 goto LABEL_84; |
8714 case VAR_LightResistance: | |
492 | 8715 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8716 goto LABEL_84; |
8717 case VAR_DarkResistance: | |
492 | 8718 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8719 goto LABEL_84; |
8720 case VAR_MagicResistance: | |
492 | 8721 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8722 LABEL_84: |
8723 v28 = 0; | |
8724 v26 = 92; | |
8725 goto LABEL_112; | |
8726 default: | |
8727 return; | |
8728 } | |
8729 return; | |
8730 } | |
8731 HIWORD(v15) = 0; | |
492 | 8732 if ( var_type > VAR_DisarmTrapSkill ) |
8733 { | |
8734 if ( var_type != VAR_LearningSkill ) | |
8735 { | |
8736 if ( var_type <= VAR_LearningSkill ) | |
0 | 8737 return; |
492 | 8738 if ( var_type <= VAR_Eradicated ) |
8739 { | |
8740 v4->SetCondition(var_type - 105, 1); | |
0 | 8741 } |
8742 else | |
8743 { | |
492 | 8744 if ( var_type != VAR_MajorCondition ) |
0 | 8745 { |
492 | 8746 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8747 byte_5E4C15[var_type] = var_value; | |
0 | 8748 return; |
8749 } | |
8750 memset(v4, 0, 0xA0u); | |
8751 } | |
8752 LABEL_124: | |
8753 v31 = 1; | |
8754 goto LABEL_169; | |
8755 } | |
8756 LABEL_106: | |
492 | 8757 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8758 v17 = *(char *)v16; |
492 | 8759 if ( var_value <= VAR_BodyResistanceBonus ) |
8760 { | |
8761 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8762 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8763 } | |
8764 else | |
8765 { | |
492 | 8766 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8767 } |
8768 *(short *)v16 = v18; | |
8769 goto LABEL_124; | |
8770 } | |
492 | 8771 if ( var_type == VAR_DisarmTrapSkill ) |
8772 if ( v30 != 1 ) | |
8773 { | |
8774 if ( v31 != 1 ) | |
8775 return; | |
8776 v5 = 0; | |
8777 goto LABEL_172; | |
8778 } | |
8779 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8780 goto LABEL_170; | |
8781 if ( var_type <= VAR_BodyResistanceBonus ) | |
8782 { | |
8783 switch ( var_type ) | |
0 | 8784 { |
8785 case VAR_BodyResistanceBonus: | |
492 | 8786 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8787 break; |
8788 case VAR_AirResistanceBonus: | |
492 | 8789 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8790 break; |
8791 case VAR_WaterResistanceBonus: | |
492 | 8792 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8793 break; |
8794 case VAR_EarthResistanceBonus: | |
492 | 8795 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8796 break; |
8797 case VAR_SpiritResistanceBonus: | |
492 | 8798 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8799 break; |
8800 default: | |
492 | 8801 if ( var_type != 62 ) |
0 | 8802 return; |
492 | 8803 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8804 break; |
8805 } | |
8806 goto LABEL_111; | |
8807 } | |
492 | 8808 if ( var_type == VAR_LightResistanceBonus ) |
8809 { | |
8810 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8811 goto LABEL_111; |
8812 } | |
492 | 8813 if ( var_type == VAR_DarkResistanceBonus ) |
8814 { | |
8815 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8816 goto LABEL_111; | |
8817 } | |
8818 if ( var_type == VAR_MagicResistanceBonus ) | |
8819 { | |
8820 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8821 goto LABEL_111; |
8822 } | |
492 | 8823 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8824 if ( v30 != 1 ) | |
8825 { | |
8826 if ( v31 != 1 ) | |
8827 return; | |
8828 v5 = 0; | |
8829 v25 = 8 * currPlayerId + 400; | |
862 | 8830 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8831 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8832 return; | |
8833 } | |
8834 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8835 goto LABEL_170; | |
0 | 8836 } |
8837 | |
8838 | |
8839 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8840 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8841 { |
8842 char v3; // bl@1 | |
8843 Player *v4; // esi@1 | |
8844 signed int uPlayerIdx; // edi@1 | |
8845 int v6; // eax@15 | |
8846 unsigned int v7; // esi@18 | |
8847 int *v8; // ebx@21 | |
8848 int v9; // eax@22 | |
8849 signed int v10; // eax@24 | |
8850 int v11; // eax@27 | |
8851 __int16 *v12; // esi@28 | |
8852 Player *v13; // ecx@34 | |
8853 Player *v14; // ecx@36 | |
8854 char *v15; // ecx@37 | |
8855 unsigned __int8 v16; // cf@38 | |
8856 Player *v17; // ecx@42 | |
8857 __int16 *v18; // esi@53 | |
8858 __int16 *v19; // esi@62 | |
8859 char *v20; // esi@107 | |
8860 __int16 v21; // dx@107 | |
8861 int v22; // ecx@107 | |
8862 Player *v23; // ecx@132 | |
8863 int v24; // eax@132 | |
8864 int v25; // eax@150 | |
8865 char v26; // zf@151 | |
8866 DDM_DLV_Header *v27; // eax@153 | |
8867 signed int v28; // eax@176 | |
8868 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8869 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8870 int v31; // [sp-4h] [bp-3Ch]@84 |
8871 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8872 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8873 char v34; // [sp+37h] [bp-1h]@1 | |
8874 | |
8875 auto Dst = this; | |
8876 v3 = 0; | |
8877 v34 = 0; | |
8878 v4 = Dst; | |
8879 uPlayerIdx = 0; | |
8880 if ( Dst == pPlayers[2] ) | |
8881 uPlayerIdx = 1; | |
310 | 8882 else if ( Dst == pPlayers[3] ) |
8883 uPlayerIdx = 2; | |
8884 else if ( Dst == pPlayers[4] ) | |
8885 uPlayerIdx = 3; | |
8886 | |
8887 if ( var_type <= VAR_AutoNotes ) | |
8888 { | |
8889 if ( var_type != VAR_AutoNotes ) | |
8890 { | |
8891 if ( var_type <= VAR_ActualMight ) | |
8892 { | |
8893 if ( var_type != VAR_ActualMight ) | |
0 | 8894 { |
310 | 8895 switch ( var_type ) |
0 | 8896 { |
8897 case VAR_RandomGold: | |
8898 if ( !val ) | |
8899 val = 1; | |
8900 v6 = rand(); | |
8901 party_finds_gold(v6 % val + 1, 1); | |
8902 GameUI_DrawFoodAndGold(); | |
8903 return; | |
8904 case VAR_RandomFood: | |
8905 if ( !val ) | |
8906 val = 1; | |
8907 v7 = rand() % val + 1; | |
8908 Party::GiveFood(v7); | |
8909 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8910 ShowStatusBarString(pTmpBuf, 2u); | |
8911 GameUI_DrawFoodAndGold(); | |
8912 goto _play_sound; | |
8913 case VAR_Sex: | |
8914 Dst->uSex = (PLAYER_SEX)val; | |
8915 goto _play_anim_and_exit; | |
8916 case VAR_Class: | |
135 | 8917 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8918 goto _play_anim_and_exit; |
8919 case VAR_CurrentHP: | |
8920 v8 = &Dst->sHealth; | |
8921 *v8 += val; | |
8922 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8923 goto _play_anim_and_exit; | |
8924 v9 = v4->GetMaxHealth(); | |
8925 goto LABEL_23; | |
8926 case VAR_MaxHP: | |
8927 v10 = Dst->GetMaxHealth(); | |
8928 v4->_health_related = 0; | |
8929 v4->uFullHealthBonus = 0; | |
8930 v4->sHealth = v10; | |
8931 return; | |
8932 case VAR_CurrentSP: | |
8933 v8 = &Dst->sMana; | |
8934 *v8 += val; | |
8935 if ( Dst->sMana > GetMaxMana() ) | |
8936 { | |
8937 v9 = v4->GetMaxMana(); | |
8938 LABEL_23: | |
8939 *v8 = v9; | |
8940 } | |
8941 goto _play_anim_and_exit; | |
8942 case VAR_MaxSP: | |
8943 v11 = GetMaxMana(); | |
8944 v4->_mana_related = 0; | |
8945 v4->uFullManaBonus = 0; | |
8946 v4->sMana = v11; | |
8947 return; | |
8948 case VAR_ACModifier: | |
8949 v12 = &Dst->sACModifier; | |
8950 goto LABEL_29; | |
8951 case VAR_BaseLevel: | |
8952 v12 = (__int16 *)&Dst->uLevel; | |
8953 goto LABEL_29; | |
8954 case VAR_LevelModifier: | |
8955 v12 = &Dst->sLevelModifier; | |
8956 LABEL_29: | |
8957 *v12 += val; | |
8958 if ( *v12 > 255 ) | |
8959 *v12 = 255; | |
8960 goto _play_anim_and_exit; | |
8961 case VAR_Age: | |
8962 Dst->sAgeModifier += val; | |
8963 return; | |
8964 case VAR_Award: | |
8965 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8966 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8967 | |
492 | 8968 && pAwards[val].pText ) |
0 | 8969 { |
8970 v14 = pPlayers[uPlayerIdx + 1]; | |
8971 v34 = 1; | |
8972 v3 = 1; | |
187 | 8973 v14->PlaySound(SPEECH_96, 0); |
0 | 8974 } |
735 | 8975 v15 = (char *)v4->_guilds_member_bits; |
0 | 8976 goto LABEL_44; |
8977 case VAR_Experience: | |
8978 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8979 LODWORD(Dst->uExperience) += val; | |
8980 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8981 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8982 Dst->uExperience = 4000000000i64; | |
8983 goto _play_anim_and_exit; | |
8984 case VAR_QBits_QuestsDone: | |
484 | 8985 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
|
8986 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8987 && pQuestTable[val-1] ) |
0 | 8988 { |
501 | 8989 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8990 bFlashQuestBook = 1; |
8991 v34 = 1; | |
8992 v3 = 1; | |
501 | 8993 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8994 } |
484 | 8995 v15 = (char *)pParty->_quest_bits; |
0 | 8996 LABEL_44: |
8997 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8998 goto LABEL_173; | |
8999 case VAR_PlayerItemInHands: | |
9000 item.Reset(); | |
9001 item.Reset(); | |
9002 item.uAttributes = 1; | |
9003 item.uItemID = val; | |
9004 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 9005 pParty->pIsArtifactFound[val-500] = 1; |
0 | 9006 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
9007 { | |
9008 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
9009 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
9010 } | |
9011 pParty->SetHoldingItem(&item); | |
9012 return; | |
9013 case VAR_FixedGold: | |
9014 party_finds_gold(val, 1); | |
9015 return; | |
9016 case VAR_BaseMight: | |
9017 v18 = (__int16 *)&Dst->uMight; | |
9018 goto LABEL_82; | |
9019 case VAR_BaseIntellect: | |
9020 v18 = (__int16 *)&Dst->uIntelligence; | |
9021 goto LABEL_82; | |
9022 case VAR_BasePersonality: | |
9023 v18 = (__int16 *)&Dst->uWillpower; | |
9024 goto LABEL_82; | |
9025 case VAR_BaseEndurance: | |
9026 v18 = (__int16 *)&Dst->uEndurance; | |
9027 goto LABEL_82; | |
9028 case VAR_BaseSpeed: | |
9029 v18 = (__int16 *)&Dst->uSpeed; | |
9030 goto LABEL_82; | |
9031 case VAR_BaseAccuracy: | |
9032 v18 = (__int16 *)&Dst->uAccuracy; | |
9033 goto LABEL_82; | |
9034 case VAR_BaseLuck: | |
9035 v18 = (__int16 *)&Dst->uLuck; | |
9036 goto LABEL_82; | |
9037 case VAR_FixedFood: | |
9038 Party::GiveFood(val); | |
715 | 9039 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 9040 ShowStatusBarString(pTmpBuf, 2u); |
9041 if ( pParty->uNumFoodRations > 0xFFFF ) | |
9042 Party::SetFood(0xFFFFu); | |
9043 goto _play_sound; | |
9044 case VAR_MightBonus: | |
9045 goto LABEL_62; | |
9046 case VAR_IntellectBonus: | |
9047 goto LABEL_66; | |
9048 case VAR_PersonalityBonus: | |
9049 goto LABEL_67; | |
9050 case VAR_EnduranceBonus: | |
9051 goto LABEL_68; | |
9052 case VAR_SpeedBonus: | |
9053 goto LABEL_69; | |
9054 case VAR_AccuracyBonus: | |
9055 goto LABEL_70; | |
9056 case VAR_LuckBonus: | |
9057 goto LABEL_71; | |
9058 default: | |
9059 return; | |
9060 } | |
9061 return; | |
9062 } | |
9063 LABEL_62: | |
9064 v19 = (__int16 *)&Dst->uMightBonus; | |
9065 goto LABEL_113; | |
9066 } | |
310 | 9067 if ( var_type <= VAR_FireResistanceBonus ) |
9068 { | |
9069 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 9070 { |
310 | 9071 switch ( var_type ) |
0 | 9072 { |
9073 case VAR_ActualIntellect: | |
9074 LABEL_66: | |
9075 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9076 goto LABEL_113; | |
9077 case VAR_ActualPersonality: | |
9078 LABEL_67: | |
9079 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9080 goto LABEL_113; | |
9081 case VAR_ActualEndurance: | |
9082 LABEL_68: | |
9083 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9084 goto LABEL_113; | |
9085 case VAR_ActualSpeed: | |
9086 LABEL_69: | |
9087 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9088 goto LABEL_113; | |
9089 case VAR_ActualAccuracy: | |
9090 LABEL_70: | |
9091 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9092 goto LABEL_113; | |
9093 case VAR_ActualLuck: | |
9094 LABEL_71: | |
9095 v19 = (__int16 *)&Dst->uLuckBonus; | |
9096 goto LABEL_113; | |
9097 case VAR_FireResistance: | |
9098 v18 = &Dst->sResFireBase; | |
9099 goto LABEL_82; | |
9100 case VAR_AirResistance: | |
9101 v18 = &Dst->sResAirBase; | |
9102 goto LABEL_82; | |
9103 case VAR_WaterResistance: | |
9104 v18 = &Dst->sResWaterBase; | |
9105 goto LABEL_82; | |
9106 case VAR_EarthResistance: | |
9107 v18 = &Dst->sResEarthBase; | |
9108 goto LABEL_82; | |
9109 case VAR_SpiritResistance: | |
9110 v18 = &Dst->sResSpiritBase; | |
9111 goto LABEL_82; | |
9112 case VAR_MindResistance: | |
9113 v18 = &Dst->sResMindBase; | |
9114 goto LABEL_82; | |
9115 case VAR_BodyResistance: | |
9116 v18 = &Dst->sResBodyBase; | |
9117 goto LABEL_82; | |
9118 case VAR_LightResistance: | |
9119 v18 = &Dst->sResLightBase; | |
9120 goto LABEL_82; | |
9121 case VAR_DarkResistance: | |
9122 v18 = &Dst->sResDarkBase; | |
9123 goto LABEL_82; | |
9124 case VAR_MagicResistance: | |
9125 v18 = &Dst->sResMagicBase; | |
9126 LABEL_82: | |
9127 *v18 += val; | |
9128 if ( *v18 > 255 ) | |
9129 *v18 = 255; | |
9130 v31 = 0; | |
9131 v29 = 92; | |
9132 goto LABEL_116; | |
9133 default: | |
9134 return; | |
9135 } | |
9136 return; | |
9137 } | |
9138 v19 = &Dst->sResFireBonus; | |
9139 LABEL_113: | |
9140 *v19 += val; | |
9141 if ( *v19 > 255 ) | |
9142 *v19 = 255; | |
9143 v31 = 0; | |
187 | 9144 v29 = SPEECH_91; |
0 | 9145 LABEL_116: |
9146 v3 = 1; | |
187 | 9147 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9148 goto _play_anim_and_maybe_sound; |
9149 } | |
310 | 9150 if ( var_type <= VAR_DisarmTrapSkill ) |
9151 { | |
9152 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9153 { |
310 | 9154 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9155 { |
310 | 9156 switch ( var_type ) |
0 | 9157 { |
9158 case VAR_BodyResistanceBonus: | |
9159 v19 = &Dst->sResBodyBonus; | |
9160 break; | |
9161 case VAR_AirResistanceBonus: | |
9162 v19 = &Dst->sResAirBonus; | |
9163 break; | |
9164 case VAR_WaterResistanceBonus: | |
9165 v19 = &Dst->sResWaterBonus; | |
9166 break; | |
9167 case VAR_EarthResistanceBonus: | |
9168 v19 = &Dst->sResEarthBonus; | |
9169 break; | |
9170 case VAR_SpiritResistanceBonus: | |
9171 v19 = &Dst->sResSpiritBonus; | |
9172 break; | |
9173 default: | |
310 | 9174 if ( var_type != 62 ) |
0 | 9175 return; |
9176 v19 = &Dst->sResMindBonus; | |
9177 break; | |
9178 } | |
9179 goto LABEL_113; | |
9180 } | |
310 | 9181 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9182 { |
9183 v19 = &Dst->sResLightBonus; | |
9184 goto LABEL_113; | |
9185 } | |
310 | 9186 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9187 { |
9188 v19 = &Dst->sResDarkBonus; | |
9189 goto LABEL_113; | |
9190 } | |
310 | 9191 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9192 { |
9193 v19 = &Dst->sResMagicBonus; | |
9194 goto LABEL_113; | |
9195 } | |
310 | 9196 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9197 return; |
9198 } | |
9199 goto LABEL_106; | |
9200 } | |
310 | 9201 if ( var_type == VAR_LearningSkill ) |
0 | 9202 { |
9203 LABEL_106: | |
9204 if ( val <= VAR_BodyResistanceBonus ) | |
9205 { | |
310 | 9206 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9207 } |
9208 else | |
9209 { | |
310 | 9210 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9211 v21 = *(short *)v20; |
9212 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9213 if ( v22 > 60 ) | |
9214 LOWORD(v22) = 60; | |
9215 LOBYTE(v21) = v21 & 0xC0; | |
9216 *(short *)v20 = v22 | v21; | |
9217 } | |
9218 goto _play_anim_and_exit; | |
9219 } | |
310 | 9220 if ( var_type <= VAR_LearningSkill ) |
0 | 9221 return; |
310 | 9222 if ( var_type <= VAR_Eradicated ) |
9223 { | |
9224 Dst->SetCondition(var_type - 105, 0); | |
0 | 9225 } |
9226 else | |
9227 { | |
310 | 9228 if ( var_type != VAR_MajorCondition ) |
0 | 9229 { |
310 | 9230 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9231 { |
310 | 9232 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9233 byte_5E4C15[var_type] += val; | |
0 | 9234 else |
310 | 9235 byte_5E4C15[var_type] = -1; |
0 | 9236 } |
9237 return; | |
9238 } | |
9239 memset(Dst, 0, 0xA0u); | |
9240 } | |
9241 _play_anim_and_exit: | |
9242 v3 = 1; | |
9243 _play_anim_and_maybe_sound: | |
9244 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9245 _maybe_play_sound: | |
9246 if ( v3 != 1 ) | |
9247 return; | |
9248 goto _play_sound; | |
9249 } | |
9250 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
|
9251 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9252 && pAutonoteTxt[val-1].pText ) |
0 | 9253 { |
9254 v23 = pPlayers[uPlayerIdx + 1]; | |
9255 v34 = 1; | |
187 | 9256 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9257 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9258 bFlashAutonotesBook = 1; |
981 | 9259 _506568_autonote_type = v24; |
0 | 9260 } |
9261 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9262 v3 = 1; | |
9263 LABEL_173: | |
9264 if ( v34 != 1 ) | |
9265 goto _maybe_play_sound; | |
9266 goto _play_anim_and_maybe_sound; | |
9267 } | |
310 | 9268 if ( var_type > VAR_GoldInBank ) |
9269 { | |
9270 if ( var_type == 307 ) | |
0 | 9271 { |
9272 pParty->uNumDeaths += val; | |
9273 goto LABEL_173; | |
9274 } | |
310 | 9275 switch ( var_type ) |
0 | 9276 { |
9277 case 308: | |
9278 pParty->uNumBountiesCollected += val; | |
9279 break; | |
9280 case 309: | |
9281 pParty->uNumPrisonTerms += val; | |
9282 break; | |
9283 case 310: | |
9284 pParty->uNumArenaPageWins += val; | |
9285 break; | |
9286 case 311: | |
9287 pParty->uNumArenaSquireWins += val; | |
9288 break; | |
9289 case 312: | |
9290 pParty->uNumArenaKnightWins += val; | |
9291 break; | |
9292 case 313: | |
9293 pParty->uNumArenaLordWins += val; | |
9294 break; | |
9295 } | |
9296 } | |
9297 else | |
9298 { | |
310 | 9299 if ( var_type == VAR_GoldInBank ) |
0 | 9300 { |
9301 pParty->uNumGoldInBank += val; | |
9302 return; | |
9303 } | |
310 | 9304 if ( var_type <= VAR_Counter8 ) |
9305 { | |
9306 if ( (signed int)var_type >= 245 ) | |
9307 { | |
9308 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9309 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9310 } |
9311 else | |
9312 { | |
310 | 9313 switch ( var_type ) |
0 | 9314 { |
9315 case VAR_MonthEquals|VAR_CurrentSP: | |
9316 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9317 break; | |
9318 case VAR_NPCs2: | |
9319 pParty->field_709 = 0; | |
9320 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9321 Party__CountHirelings(); |
0 | 9322 viewparams->bRedrawGameUI = 1; |
9323 break; | |
9324 case VAR_NumSkillPoints: | |
9325 Dst->uSkillPoints += val; | |
9326 break; | |
9327 } | |
9328 } | |
9329 return; | |
9330 } | |
310 | 9331 if ( var_type < VAR_Counter9 ) |
0 | 9332 return; |
310 | 9333 if ( (signed int)var_type <= 274 ) |
9334 { | |
9335 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9336 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9337 goto _play_sound; |
9338 } | |
310 | 9339 if ( var_type != VAR_ReputationInCurrentLocation ) |
9340 { | |
9341 if ( var_type <= VAR_ReputationInCurrentLocation | |
9342 || var_type > VAR_History_28 | |
9343 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9344 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9345 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9346 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9347 v26) ) |
9348 return; | |
9349 bFlashHistoryBook = 1; | |
9350 _play_sound: | |
9351 v28 = 8 * uPlayerIdx + 400; | |
862 | 9352 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9353 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9354 return; | |
9355 } | |
9356 v27 = &pOutdoor->ddm; | |
9357 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9358 v27 = &pIndoor->dlv; | |
9359 v27->uReputation += val; | |
9360 if ( v27->uReputation > 10000 ) | |
9361 v27->uReputation = 10000; | |
9362 } | |
9363 } | |
9364 // 506568: using guessed type int dword_506568; | |
9365 // 507948: using guessed type char bFlashHistoryBook; | |
9366 // 507949: using guessed type char bFlashAutonotesBook; | |
9367 // 50794A: using guessed type char bFlashQuestBook; | |
9368 // 72371C: using guessed type int dword_72371C[]; | |
9369 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9370 | |
9371 | |
9372 | |
9373 | |
9374 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9375 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9376 { |
9377 unsigned int v3; // ebx@1 | |
9378 signed int v4; // esi@1 | |
501 | 9379 bool result; // eax@8 |
0 | 9380 int v6; // esi@11 |
9381 int v7; // edi@14 | |
9382 signed int v8; // eax@17 | |
9383 char *v9; // eax@20 | |
9384 char v10; // sf@20 | |
9385 char *v11; // ecx@26 | |
9386 char *v12; // ecx@27 | |
9387 __int64 v13; // qax@27 | |
9388 unsigned __int8 v14; // cf@27 | |
501 | 9389 int *v15; // edx@29 |
0 | 9390 char *v16; // eax@90 |
9391 char *v17; // ecx@94 | |
501 | 9392 int v18; // esi@97 |
0 | 9393 signed int v19; // edx@97 |
9394 char *v20; // ecx@98 | |
9395 int v21; // eax@100 | |
9396 __int16 v22; // dx@112 | |
9397 int v23; // [sp-8h] [bp-14h]@45 | |
9398 signed int v24; // [sp-4h] [bp-10h]@4 | |
9399 int v25; // [sp-4h] [bp-10h]@45 | |
9400 | |
9401 v3 = 0; | |
605 | 9402 v4 = uActiveCharacter - 1; |
501 | 9403 result = false; |
9404 if ( (signed int)VarNum > 222 ) | |
9405 { | |
9406 if ( (signed int)VarNum <= 307 ) | |
9407 { | |
9408 if ( VarNum == 307 ) | |
9409 { | |
9410 pParty->uNumDeaths -= (unsigned int)pValue; | |
9411 return pValue; | |
9412 } | |
9413 if ( VarNum == 223 ) | |
0 | 9414 { |
9415 v11 = (char *)pParty->_autonote_bits; | |
501 | 9416 v22 = (short)pValue - 1; |
0 | 9417 } |
9418 else | |
9419 { | |
501 | 9420 if ( VarNum != 231 ) |
0 | 9421 { |
501 | 9422 switch ( VarNum ) |
0 | 9423 { |
9424 case 232: | |
501 | 9425 VarNum = (VariableType)0; |
602 | 9426 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9427 result = (bool) pValue; |
9428 dword_5B65CC = 0; | |
9429 if ( (int)VarNum == pValue ) | |
0 | 9430 { |
501 | 9431 dword_5B65CC = (int)pValue; |
0 | 9432 } |
9433 else | |
9434 { | |
9435 pParty->field_709 = 0; | |
501 | 9436 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9437 Party__CountHirelings(); |
0 | 9438 viewparams->bRedrawGameUI = 1; |
9439 } | |
9440 break; | |
9441 case 241: | |
9442 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9443 { | |
9444 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9445 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9446 { |
605 | 9447 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9448 { |
9449 v21 = *(int *)v20; | |
9450 if ( (char)*(int *)v20 < 0 ) | |
9451 { | |
9452 LOBYTE(v21) = v21 & 0x7F; | |
9453 *(int *)v20 = v21; | |
9454 } | |
9455 } | |
9456 v20 += 76; | |
9457 } | |
9458 } | |
605 | 9459 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9460 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9461 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9462 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9463 pParty->field_709 = 0; | |
659 | 9464 Party__CountHirelings(); |
0 | 9465 break; |
9466 case 243: | |
9467 v17 = (char *)&this->uSkillPoints; | |
501 | 9468 result = *v17; |
9469 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9470 { | |
9471 *(int *)v17 -= (int)pValue; | |
9472 result = v17; | |
9473 } | |
0 | 9474 else |
9475 *(int *)v17 = 0; | |
9476 break; | |
9477 case 275: | |
9478 v16 = (char *)&pOutdoor->ddm; | |
9479 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9480 v16 = (char *)&pIndoor->dlv; | |
501 | 9481 *((int *)v16 + 2) -= (int)pValue; |
0 | 9482 if ( *((int *)v16 + 2) < -10000 ) |
9483 *((int *)v16 + 2) = -10000; | |
9484 break; | |
9485 case 306: | |
501 | 9486 result = VarNum - 306; |
9487 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9488 { | |
9489 result = (bool)pValue; | |
9490 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9491 } |
0 | 9492 else |
9493 LABEL_88: | |
9494 dword_5B65C4 = 1; | |
9495 break; | |
9496 } | |
501 | 9497 return result; |
0 | 9498 } |
9499 v11 = this->field_1A50; | |
501 | 9500 v22 = (signed __int16)pValue; |
0 | 9501 } |
9502 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9503 return result; |
9504 } | |
9505 switch ( VarNum ) | |
0 | 9506 { |
9507 case 308: | |
501 | 9508 result = (bool)pValue; |
9509 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9510 break; |
9511 case 309: | |
501 | 9512 result = (bool)pValue; |
9513 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9514 break; |
9515 case 310: | |
501 | 9516 result = (bool)pValue; |
9517 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9518 break; |
9519 case 311: | |
501 | 9520 result = (bool)pValue; |
9521 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9522 break; |
9523 case 312: | |
501 | 9524 result = (bool)pValue; |
9525 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9526 break; |
9527 case 313: | |
501 | 9528 result = (bool)pValue; |
9529 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9530 break; |
9531 } | |
9532 } | |
9533 else | |
9534 { | |
501 | 9535 if ( (signed int)VarNum >= 123 ) |
9536 { | |
9537 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9538 } |
9539 else | |
9540 { | |
501 | 9541 switch ( VarNum ) |
0 | 9542 { |
9543 case VAR_RandomGold: | |
501 | 9544 v6 = rand() % (signed int)pValue + 1; |
0 | 9545 if ( v6 > pParty->uNumGold ) |
9546 v6 = pParty->uNumGold; | |
9547 Party::TakeGold(v6); | |
9548 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9549 ShowStatusBarString(pTmpBuf, 2); |
0 | 9550 GameUI_DrawFoodAndGold(); |
501 | 9551 return result; |
0 | 9552 case VAR_RandomFood: |
501 | 9553 v7 = rand() % (signed int)pValue + 1; |
0 | 9554 if ( v7 > pParty->uNumFoodRations ) |
9555 v7 = pParty->uNumFoodRations; | |
9556 Party::TakeFood(v7); | |
9557 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9558 ShowStatusBarString(pTmpBuf, 2u); | |
9559 GameUI_DrawFoodAndGold(); | |
605 | 9560 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9561 v8 = 8 * v4 + 400; | |
862 | 9562 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9563 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9564 return result; |
0 | 9565 case VAR_CurrentHP: |
501 | 9566 ReceiveDamage((signed int)pValue, 4); |
605 | 9567 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9568 v8 = 8 * v4 + 400; | |
862 | 9569 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9570 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9571 return result; | |
0 | 9572 case VAR_CurrentSP: |
9573 v9 = (char *)&this->sMana; | |
501 | 9574 v10 = this->sMana - (signed int)pValue < 0; |
9575 *(int *)v9 -= (int)pValue; | |
0 | 9576 if ( v10 ) |
9577 *(int *)v9 = 0; | |
605 | 9578 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9579 v8 = 8 * v4 + 400; | |
862 | 9580 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9581 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9582 return result; | |
0 | 9583 case VAR_ACModifier: |
501 | 9584 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9585 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9586 v8 = 8 * v4 + 400; | |
862 | 9587 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9588 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9589 return result; | |
0 | 9590 case VAR_BaseLevel: |
501 | 9591 this->uLevel -= (unsigned __int8)pValue; |
605 | 9592 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9593 v8 = 8 * v4 + 400; | |
862 | 9594 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9595 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9596 return result; | |
0 | 9597 case VAR_LevelModifier: |
501 | 9598 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9599 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9600 v8 = 8 * v4 + 400; | |
862 | 9601 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9602 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9603 return result; | |
0 | 9604 case VAR_Age: |
501 | 9605 this->sAgeModifier -= (signed __int16)pValue; |
9606 return result; | |
0 | 9607 case VAR_Award: |
605 | 9608 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9609 return result; | |
0 | 9610 case VAR_Experience: |
9611 v12 = (char *)&this->uExperience; | |
501 | 9612 v13 = (signed int)pValue; |
9613 v14 = *(int *)v12 < (unsigned int)pValue; | |
9614 *(int *)v12 -= (int)pValue; | |
0 | 9615 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
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_QBits_QuestsDone: |
501 | 9622 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9623 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9624 return true; |
0 | 9625 case VAR_PlayerItemInHands: |
501 | 9626 v15 = this->pInventoryIndices; |
0 | 9627 break; |
9628 case VAR_FixedGold: | |
501 | 9629 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9630 goto LABEL_88; |
501 | 9631 Party::TakeGold((unsigned int)pValue); |
9632 return result; | |
0 | 9633 case VAR_MightBonus: |
9634 case VAR_ActualMight: | |
501 | 9635 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9636 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9637 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9638 v8 = 8 * v4 + 400; | |
862 | 9639 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9640 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9641 return result; | |
0 | 9642 case VAR_IntellectBonus: |
9643 case VAR_ActualIntellect: | |
501 | 9644 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9645 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9646 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9647 v8 = 8 * v4 + 400; | |
862 | 9648 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9649 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9650 return result; | |
0 | 9651 case VAR_PersonalityBonus: |
9652 case VAR_ActualPersonality: | |
501 | 9653 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9654 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9655 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9656 v8 = 8 * v4 + 400; | |
862 | 9657 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9658 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9659 return result; | |
0 | 9660 case VAR_EnduranceBonus: |
9661 case VAR_ActualEndurance: | |
501 | 9662 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9663 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9664 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9665 v8 = 8 * v4 + 400; | |
862 | 9666 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9667 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9668 return result; | |
0 | 9669 case VAR_SpeedBonus: |
9670 case VAR_ActualSpeed: | |
501 | 9671 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9672 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9673 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9674 v8 = 8 * v4 + 400; | |
862 | 9675 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9676 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9677 return result; | |
0 | 9678 case VAR_AccuracyBonus: |
9679 case VAR_ActualAccuracy: | |
501 | 9680 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9681 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9682 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9683 v8 = 8 * v4 + 400; | |
862 | 9684 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9685 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9686 return result; | |
0 | 9687 case VAR_LuckBonus: |
9688 case VAR_ActualLuck: | |
501 | 9689 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9690 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9691 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9692 v8 = 8 * v4 + 400; | |
862 | 9693 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9694 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9695 return result; | |
0 | 9696 case VAR_BaseMight: |
501 | 9697 this->uMight -= (unsigned __int16)pValue; |
605 | 9698 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_BaseIntellect: |
501 | 9705 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9706 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9707 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9708 v8 = 8 * v4 + 400; | |
862 | 9709 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9710 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9711 return result; | |
0 | 9712 case VAR_BasePersonality: |
501 | 9713 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9714 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9715 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9716 v8 = 8 * v4 + 400; | |
862 | 9717 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9718 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9719 return result; | |
0 | 9720 case VAR_BaseEndurance: |
501 | 9721 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9722 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9723 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9724 v8 = 8 * v4 + 400; | |
862 | 9725 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9726 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9727 return result; | |
0 | 9728 case VAR_BaseSpeed: |
501 | 9729 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9730 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9731 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9732 v8 = 8 * v4 + 400; | |
862 | 9733 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9734 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9735 return result; | |
0 | 9736 case VAR_BaseAccuracy: |
501 | 9737 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9738 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9739 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9740 v8 = 8 * v4 + 400; | |
862 | 9741 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9742 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9743 return result; | |
0 | 9744 case VAR_BaseLuck: |
501 | 9745 this->uLuck -= (unsigned __int16)pValue; |
605 | 9746 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9747 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9748 v8 = 8 * v4 + 400; | |
862 | 9749 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9750 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9751 return result; | |
0 | 9752 case VAR_FireResistance: |
501 | 9753 this->sResFireBase -= (signed __int16)pValue; |
605 | 9754 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9755 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9756 v8 = 8 * v4 + 400; | |
862 | 9757 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9758 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9759 return result; | |
0 | 9760 case VAR_AirResistance: |
501 | 9761 this->sResAirBase -= (signed __int16)pValue; |
605 | 9762 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9763 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9764 v8 = 8 * v4 + 400; | |
862 | 9765 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9766 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9767 return result; | |
0 | 9768 case VAR_WaterResistance: |
501 | 9769 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9770 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9771 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9772 v8 = 8 * v4 + 400; | |
862 | 9773 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9774 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9775 return result; | |
0 | 9776 case VAR_EarthResistance: |
501 | 9777 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9778 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9779 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9780 v8 = 8 * v4 + 400; | |
862 | 9781 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9782 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9783 return result; | |
0 | 9784 case VAR_SpiritResistance: |
501 | 9785 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9786 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9787 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9788 v8 = 8 * v4 + 400; | |
862 | 9789 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9790 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9791 return result; | |
0 | 9792 case VAR_MindResistance: |
501 | 9793 this->sResMindBase -= (signed __int16)pValue; |
605 | 9794 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9795 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9796 v8 = 8 * v4 + 400; | |
862 | 9797 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9798 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9799 return result; | |
0 | 9800 case VAR_BodyResistance: |
501 | 9801 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9802 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9803 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9804 v8 = 8 * v4 + 400; | |
862 | 9805 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9806 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9807 return result; | |
0 | 9808 case VAR_LightResistance: |
501 | 9809 this->sResLightBase -= (signed __int16)pValue; |
605 | 9810 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9811 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9812 v8 = 8 * v4 + 400; | |
862 | 9813 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9814 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9815 return result; | |
0 | 9816 case VAR_DarkResistance: |
501 | 9817 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9818 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9819 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9820 v8 = 8 * v4 + 400; | |
862 | 9821 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9822 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9823 return result; | |
0 | 9824 case VAR_MagicResistance: |
501 | 9825 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9826 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9827 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9828 v8 = 8 * v4 + 400; | |
862 | 9829 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9830 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9831 return result; | |
0 | 9832 case VAR_FireResistanceBonus: |
501 | 9833 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9834 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9835 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9836 v8 = 8 * v4 + 400; | |
862 | 9837 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9838 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9839 return result; | |
0 | 9840 case VAR_AirResistanceBonus: |
501 | 9841 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9842 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9843 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9844 v8 = 8 * v4 + 400; | |
862 | 9845 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9846 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9847 return result; | |
0 | 9848 case VAR_WaterResistanceBonus: |
501 | 9849 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9850 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9851 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9852 v8 = 8 * v4 + 400; | |
862 | 9853 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9854 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9855 return result; | |
0 | 9856 case VAR_EarthResistanceBonus: |
501 | 9857 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9858 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9859 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9860 v8 = 8 * v4 + 400; | |
862 | 9861 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9862 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9863 return result; | |
0 | 9864 case VAR_SpiritResistanceBonus: |
501 | 9865 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9866 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9867 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9868 v8 = 8 * v4 + 400; | |
862 | 9869 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9870 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9871 return result; | |
0 | 9872 case VAR_MindResistanceBonus: |
501 | 9873 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9874 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9875 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9876 v8 = 8 * v4 + 400; | |
862 | 9877 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9878 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9879 return result; | |
0 | 9880 case VAR_BodyResistanceBonus: |
501 | 9881 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9882 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9883 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9884 v8 = 8 * v4 + 400; | |
862 | 9885 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9886 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9887 return result; | |
0 | 9888 case VAR_LightResistanceBonus: |
501 | 9889 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9890 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9891 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9892 v8 = 8 * v4 + 400; | |
862 | 9893 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9894 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9895 return result; | |
0 | 9896 case VAR_DarkResistanceBonus: |
501 | 9897 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9898 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9899 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9900 v8 = 8 * v4 + 400; | |
862 | 9901 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9902 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9903 return result; | |
0 | 9904 case VAR_MagicResistanceBonus: |
501 | 9905 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9906 v25 = 0; |
187 | 9907 v23 = SPEECH_91; |
9908 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9909 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9910 v8 = 8 * v4 + 400; | |
862 | 9911 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9912 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9913 return result; | |
0 | 9914 case VAR_FixedFood: |
501 | 9915 Party::TakeFood((unsigned int)pValue); |
605 | 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_StaffSkill: |
9922 case VAR_SwordSkill: | |
9923 case VAR_DaggerSkill: | |
9924 case VAR_AxeSkill: | |
9925 case VAR_SpearSkill: | |
9926 case VAR_BowSkill: | |
9927 case VAR_MaceSkill: | |
9928 case VAR_BlasterSkill: | |
9929 case VAR_ShieldSkill: | |
9930 case VAR_LeatherSkill: | |
9931 case VAR_SkillChain: | |
9932 case VAR_PlateSkill: | |
9933 case VAR_FireSkill: | |
9934 case VAR_AirSkill: | |
9935 case VAR_WaterSkill: | |
9936 case VAR_EarthSkill: | |
9937 case VAR_SpiritSkill: | |
9938 case VAR_MindSkill: | |
9939 case VAR_BodySkill: | |
9940 case VAR_LightSkill: | |
9941 case VAR_DarkSkill: | |
9942 case VAR_IdentifyItemSkill: | |
9943 case VAR_MerchantSkill: | |
9944 case VAR_RepairSkill: | |
9945 case VAR_BodybuildingSkill: | |
9946 case VAR_MeditationSkill: | |
9947 case VAR_PerceptionSkill: | |
9948 case VAR_DiplomacySkill: | |
9949 case VAR_DisarmTrapSkill: | |
9950 case VAR_LearningSkill: | |
501 | 9951 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9952 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9953 v8 = 8 * v4 + 400; | |
862 | 9954 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9955 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9956 return result; | |
0 | 9957 case VAR_Cursed: |
9958 case VAR_Weak: | |
9959 case VAR_Asleep: | |
9960 case VAR_Afraid: | |
9961 case VAR_Drunk: | |
9962 case VAR_Insane: | |
9963 case VAR_PoisonedGreen: | |
9964 case VAR_DiseasedGreen: | |
9965 case VAR_PoisonedYellow: | |
9966 case VAR_DiseasedYellow: | |
9967 case VAR_PoisonedRed: | |
9968 case VAR_DiseasedRed: | |
9969 case VAR_Paralyzed: | |
9970 case VAR_Unconsious: | |
9971 case VAR_Dead: | |
9972 case VAR_Stoned: | |
9973 case VAR_Eradicated: | |
501 | 9974 *((int *)this + 2 * VarNum - 210) = 0; |
9975 *((int *)this + 2 * result - 209) = 0; | |
0 | 9976 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9977 v8 = 8 * v4 + 400; | |
862 | 9978 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9979 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9980 return result; |
605 | 9981 default: |
9982 return result; | |
9983 } | |
9984 for (v3 = 1; v3 < 126; v3++) | |
9985 { | |
9986 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9987 { |
605 | 9988 RemoveItemAtInventoryIndex(v3); |
501 | 9989 return true; |
0 | 9990 } |
605 | 9991 } |
501 | 9992 if ( pParty->pPickedItem.uItemID == pValue ) |
9993 { | |
605 | 9994 pMouse->RemoveHoldingItem(); |
9995 return true; | |
9996 } | |
9997 return false; | |
0 | 9998 } |
9999 } | |
10000 } | |
10001 // 5B65C4: using guessed type int dword_5B65C4; | |
10002 // 5B65CC: using guessed type int dword_5B65CC; |