Mercurial > mm7
annotate Player.cpp @ 1021:67e33708d815
player use item continue cleanup
author | Gloval |
---|---|
date | Tue, 21 May 2013 08:53:43 +0400 |
parents | 3413ad40cc88 |
children | 9408f98f4929 3a5c8df8381d b725a9cdec0c |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
1016 | 3 #include "stru6.h" |
4 | |
5 | |
0 | 6 #include "OSAPI.h" |
7 #include "Player.h" | |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
0 | 29 |
30 | |
31 | |
32 | |
33 | |
34 | |
35 /* 381 */ | |
36 #pragma pack(push, 1) | |
290 | 37 struct PlayerCreation_AttributeProps |
0 | 38 { |
39 unsigned __int8 uBaseValue; | |
40 char uMaxValue; | |
41 char uDroppedStep; | |
42 char uBaseStep; | |
43 }; | |
44 #pragma pack(pop) | |
45 | |
46 | |
47 #pragma pack(push, 1) | |
290 | 48 |
49 | |
50 | |
0 | 51 #pragma pack(pop) |
290 | 52 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
53 { | |
54 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
55 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
56 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
57 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 58 }; |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 // available skills per class ( 9 classes X 37 skills ) | |
66 // 0 - not available | |
67 // 1 - available | |
68 // 2 - primary skill | |
69 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
70 { | |
71 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
72 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
73 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
74 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
75 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
76 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
77 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
78 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
79 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
80 }; | |
81 | |
82 | |
83 | |
84 | |
85 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
86 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
87 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
88 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
89 | |
90 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
91 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
93 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
94 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
96 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
97 | |
98 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
99 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
101 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
102 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
104 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
105 | |
106 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
107 | |
108 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
109 | |
94 | 110 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 113 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 114 |
115 | |
1010 | 116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
117 | |
0 | 118 |
816 | 119 unsigned short base_recovery_times_per_weapon_type[12] = |
120 { | |
121 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
122 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
123 60, // PLAYER_SKILL_DAGGER | |
124 100, // PLAYER_SKILL_AXE | |
125 80, // PLAYER_SKILL_SPEAR | |
126 100, // PLAYER_SKILL_BOW | |
127 80, // PLAYER_SKILL_MACE | |
128 30, // PLAYER_SKILL_BLASTER | |
129 10, // PLAYER_SKILL_SHIELD | |
130 10, // PLAYER_SKILL_LEATHER | |
131 20, // PLAYER_SKILL_CHAIN | |
132 30 // PLAYER_SKILL_PLATE | |
133 }; | |
134 | |
135 | |
0 | 136 |
137 //----- (00490913) -------------------------------------------------------- | |
138 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
139 { | |
140 signed int v0; // edi@1 | |
141 signed int v1; // esi@1 | |
142 int v2; // ebx@2 | |
143 int v3; // ecx@17 | |
144 signed int v4; // eax@17 | |
145 int v5; // edx@18 | |
146 signed int v6; // ecx@18 | |
147 signed int v8; // [sp+Ch] [bp-8h]@1 | |
148 signed int v9; // [sp+10h] [bp-4h]@2 | |
149 | |
150 v8 = 50; | |
151 v0 = 50; | |
152 v1 = 0; | |
153 do | |
154 { | |
155 v9 = 0; | |
156 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
157 do | |
158 { | |
159 if ( v9 ) | |
160 { | |
161 switch ( v9 ) | |
162 { | |
163 case 1: | |
164 v0 = pParty->pPlayers[v1].uIntelligence; | |
165 break; | |
166 case 2: | |
167 v0 = pParty->pPlayers[v1].uWillpower; | |
168 break; | |
169 case 3: | |
170 v0 = pParty->pPlayers[v1].uEndurance; | |
171 break; | |
172 case 4: | |
173 v0 = pParty->pPlayers[v1].uAccuracy; | |
174 break; | |
175 case 5: | |
176 v0 = pParty->pPlayers[v1].uSpeed; | |
177 break; | |
178 case 6: | |
179 v0 = pParty->pPlayers[v1].uLuck; | |
180 break; | |
181 } | |
182 } | |
183 else | |
184 { | |
185 v0 = pParty->pPlayers[v1].uMight; | |
186 } | |
187 v3 = v2 + v9; | |
290 | 188 v4 = StatTable[0][v3].uBaseValue; |
0 | 189 if ( v0 >= v4 ) |
190 { | |
290 | 191 v5 = StatTable[0][v3].uDroppedStep; |
192 v6 = StatTable[0][v3].uBaseStep; | |
0 | 193 } |
194 else | |
195 { | |
290 | 196 v5 = StatTable[0][v3].uBaseStep; |
197 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 198 } |
199 v8 += v5 * (v4 - v0) / v6; | |
200 ++v9; | |
201 } | |
202 while ( v9 <= 6 ); | |
203 ++v1; | |
204 } | |
205 while ( v1 < 4 ); | |
206 return v8; | |
207 } | |
208 | |
209 | |
210 | |
211 //----- (00427730) -------------------------------------------------------- | |
212 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
213 { | |
488 | 214 if (sMana >= uRequiredMana) |
215 { | |
216 sMana -= uRequiredMana; | |
217 return true; | |
218 } | |
219 | |
220 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
221 return false; | |
0 | 222 } |
223 | |
224 | |
225 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 226 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
227 { | |
0 | 228 float v6; // ST04_4@1 |
1014 | 229 signed int item_value; // eax@1 |
230 signed int sell_price; // ebx@1 | |
231 | |
232 item_value =pOwnItems[item_index].GetValue(); | |
233 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
234 sell_price = GetPriceSell(item_value, v6); | |
235 if ( pOwnItems[item_index].Broken() ) | |
236 sell_price = 1; | |
237 if ( sell_price < 1 ) | |
238 sell_price = 1; | |
239 RemoveItemAtInventoryIndex(inventory_idnx); | |
240 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 241 } |
242 | |
243 | |
244 | |
245 //----- (0043EEF3) -------------------------------------------------------- | |
246 bool Player::_43EEF3() | |
247 { | |
1014 | 248 signed int item_idx; // esi@1 |
249 signed int item_id; // esi@1 | |
250 for (int i=0; i<16;++i) | |
251 { | |
252 item_idx=pEquipment.pIndices[i]; | |
253 if (item_idx) | |
254 { | |
255 item_id=pOwnItems[item_idx-1].uItemID; | |
256 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
257 return false; | |
258 } | |
259 } | |
260 return true; | |
261 } | |
262 | |
0 | 263 |
264 | |
265 | |
266 //----- (004B8040) -------------------------------------------------------- | |
267 int Player::_4B8040_condition_time(unsigned int uCondition) | |
268 { | |
269 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
270 } | |
271 | |
272 //----- (004B807C) -------------------------------------------------------- | |
273 int Player::_4B807C(float a2) | |
274 { | |
275 Player *v2; // edi@1 | |
276 unsigned int v3; // eax@1 | |
277 int v4; // esi@1 | |
278 unsigned int v5; // ebx@7 | |
279 int v6; // eax@8 | |
280 signed __int64 v7; // qax@13 | |
281 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
282 signed int v10; // [sp+8h] [bp-8h]@4 | |
283 int v11; // [sp+Ch] [bp-4h]@6 | |
284 | |
285 v2 = this; | |
286 v3 = GetMajorConditionIdx(); | |
287 v4 = 0; | |
288 if ( (signed int)v3 >= 14 ) | |
289 { | |
290 if ( (signed int)v3 <= 15 ) | |
291 { | |
292 v10 = 5; | |
293 v9 = v3; | |
294 goto LABEL_6; | |
295 } | |
296 if ( v3 == 16 ) | |
297 { | |
298 v10 = 10; | |
299 v9 = 16; | |
300 LABEL_6: | |
301 v11 = _4B8040_condition_time(v9); | |
302 goto LABEL_13; | |
303 } | |
304 } | |
305 v10 = 1; | |
306 v5 = 0; | |
307 do | |
308 { | |
309 v6 = _4B8040_condition_time(v5); | |
310 if ( v6 > v4 ) | |
311 v4 = v6; | |
312 ++v5; | |
313 } | |
314 while ( (signed int)v5 <= 13 ); | |
315 v11 = v4; | |
316 if ( !v4 ) | |
317 v11 = 1; | |
318 LABEL_13: | |
319 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
320 if ( (signed int)v7 < 1 ) | |
321 LODWORD(v7) = 1; | |
322 return v7; | |
323 } | |
324 | |
325 //----- (004B8102) -------------------------------------------------------- | |
917 | 326 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 327 { |
328 signed int v3; // esi@1 | |
329 signed int result; // eax@3 | |
330 | |
917 | 331 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
332 if ( v3 > uRealValue ) | |
333 v3 = uRealValue; | |
0 | 334 result = 1; |
335 if ( v3 >= 1 ) | |
336 result = v3; | |
337 return result; | |
338 } | |
339 | |
340 //----- (004B8142) -------------------------------------------------------- | |
749 | 341 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
342 { | |
343 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
344 assert (price > 0); | |
345 | |
346 if (price < uRealValue) | |
347 price = uRealValue; | |
348 return price; | |
0 | 349 } |
350 | |
351 //----- (004B8179) -------------------------------------------------------- | |
916 | 352 int Player::GetPriceIdentification(float a2) |
0 | 353 { |
354 signed int v2; // esi@1 | |
355 int v3; // ecx@1 | |
356 signed int result; // eax@3 | |
357 | |
358 v2 = (signed __int64)(a2 * 50.0); | |
359 v3 = v2 * (100 - GetMerchant()) / 100; | |
360 if ( v3 < v2 / 3 ) | |
361 v3 = v2 / 3; | |
362 result = 1; | |
363 if ( v3 >= 1 ) | |
364 result = v3; | |
365 return result; | |
366 } | |
367 | |
368 //----- (004B81C3) -------------------------------------------------------- | |
916 | 369 int Player::GetPriceRepair(int a2, float a3) |
0 | 370 { |
371 signed int v3; // esi@1 | |
372 int v4; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
376 v4 = v3 * (100 - GetMerchant()) / 100; | |
377 if ( v4 < v3 / 3 ) | |
378 v4 = v3 / 3; | |
379 result = 1; | |
380 if ( v4 >= 1 ) | |
381 result = v4; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B8213) -------------------------------------------------------- | |
386 int Player::_4B8213(int a2, float a3) | |
387 { | |
388 signed __int64 v3; // qax@1 | |
389 | |
390 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
391 if ( (signed int)v3 < 1 ) | |
392 LODWORD(v3) = 1; | |
393 return v3; | |
394 } | |
395 | |
396 //----- (004B8233) -------------------------------------------------------- | |
397 int Player::_4B8233(int a2, float a3) | |
398 { | |
399 signed __int64 v3; // qax@1 | |
400 | |
401 v3 = (signed __int64)((double)a2 * a3); | |
402 if ( (signed int)v3 < 1 ) | |
403 LODWORD(v3) = 1; | |
404 return v3; | |
405 } | |
406 | |
407 //----- (004B824B) -------------------------------------------------------- | |
408 int Player::_4B824B(float a2) | |
409 { | |
410 signed __int64 v2; // qax@1 | |
411 | |
412 v2 = (signed __int64)(a2 * 50.0); | |
413 if ( (signed int)v2 < 1 ) | |
414 LODWORD(v2) = 1; | |
415 return v2; | |
416 } | |
417 | |
418 //----- (004B8265) -------------------------------------------------------- | |
419 int Player::_4B8265(int a2, float a3) | |
420 { | |
421 signed __int64 v3; // qax@1 | |
422 | |
423 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
424 if ( (signed int)v3 < 1 ) | |
425 LODWORD(v3) = 1; | |
426 return v3; | |
427 } | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 //----- (004B6FF9) -------------------------------------------------------- | |
434 int Player::_4B6FF9() | |
435 { | |
436 Player *v1; // esi@1 | |
437 signed int v2; // eax@1 | |
438 char v3; // zf@4 | |
439 | |
440 v1 = this; | |
336 | 441 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 442 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 443 { |
444 if ( GetMajorConditionIdx() == 18 ) | |
445 goto LABEL_6; | |
446 v3 = GetMajorConditionIdx() == 17; | |
447 } | |
448 else | |
449 { | |
450 v3 = GetMajorConditionIdx() == 18; | |
451 } | |
452 if ( !v3 ) | |
453 return 1; | |
454 LABEL_6: | |
455 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
456 return 1; | |
457 return 0; | |
458 } | |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
468 item_idx = *pitem_index; | |
469 if ( item_idx >125 || item_idx < 0 ) | |
470 { | |
471 return 0; | |
472 } | |
473 | |
474 inv_index = this->pInventoryIndices[item_idx]; | |
475 if ( inv_index < 0 ) | |
476 { | |
477 *pitem_index = -1 - inv_index; | |
478 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
479 } | |
480 | |
481 return inv_index; | |
0 | 482 } |
483 | |
484 | |
485 | |
486 //----- (004160CA) -------------------------------------------------------- | |
1012 | 487 void Player::ItemsEnchant( int enchant_count ) |
488 { | |
489 int avalible_items; // ebx@1 | |
490 int i; // edx@8 | |
491 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
492 | |
493 avalible_items = 0; | |
494 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
495 | |
496 for (i=0; i<138; ++i) | |
497 { | |
498 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
499 item_index_tabl[avalible_items++] = i; | |
500 } | |
501 | |
502 if ( avalible_items ) | |
503 { | |
504 if ( enchant_count ) | |
505 { | |
506 for ( i = 0; i < enchant_count; ++i ) | |
0 | 507 { |
1012 | 508 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
509 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 510 } |
1012 | 511 |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
517 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
518 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
519 } | |
520 } | |
521 } | |
522 ; | |
0 | 523 } |
524 | |
525 //----- (004948B1) -------------------------------------------------------- | |
187 | 526 void Player::PlaySound(PlayerSpeech speech, int a3) |
527 { | |
528 //Player *pPlayer; // edi@1 | |
529 //int v4; // eax@4 | |
0 | 530 signed int v5; // esi@4 |
203 | 531 unsigned char *v6; // ebx@4 |
0 | 532 signed int v7; // ecx@5 |
533 unsigned __int8 v8; // al@6 | |
534 int v9; // eax@10 | |
187 | 535 //unsigned int pVoiceID; // ecx@10 |
0 | 536 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
537 //signed int v12; // eax@11 |
0 | 538 signed int v13; // esi@12 |
539 int v14; // eax@12 | |
187 | 540 //int v15; // eax@17 |
248 | 541 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 542 signed int v17; // ecx@19 |
543 char *pSoundID; // edi@20 | |
544 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 545 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 546 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
547 int pSoundId; // [sp+30h] [bp+8h]@4 | |
548 | |
187 | 549 //pPlayer = this; |
550 //pPlayer2 = this; | |
551 | |
0 | 552 pPlayerNum = 1; |
187 | 553 for (int i = 0; i < 4; ++i) |
554 if (&pParty->pPlayers[i] == this) | |
555 { | |
556 pPlayerNum = i + 1; | |
0 | 557 break; |
187 | 558 } |
559 | |
560 //v4 = a2;//102 | |
0 | 561 v5 = 0; |
562 pSoundId = 0; | |
203 | 563 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
564 if (uVoicesVolumeMultiplier) | |
0 | 565 { |
566 v7 = 0; | |
567 do | |
568 { | |
569 v8 = v6[v7]; | |
570 if ( v8 ) | |
571 v20[v5++] = v8; | |
572 ++v7; | |
573 } | |
574 while ( v7 < 2 ); | |
575 if ( v5 ) | |
576 { | |
577 v9 = rand(); | |
187 | 578 //pVoiceID = uVoiceID; |
0 | 579 v11 = v20[v9 % v5]; |
203 | 580 |
581 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
582 { | |
583 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
584 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 585 } |
586 } | |
587 } | |
203 | 588 |
0 | 589 v13 = 0; |
590 v14 = (int)(v6 + 3); | |
591 do | |
592 { | |
593 if ( *(char *)v14 ) | |
594 v20[v13++] = *(char *)v14; | |
595 ++v14; | |
596 } | |
597 while ( -3 - (signed int)v6 + v14 < 5 ); | |
598 if ( v13 ) | |
599 { | |
600 pPlayerNum = 0; | |
248 | 601 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
602 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 603 { |
604 v17 = 0; | |
764 | 605 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 606 { |
607 LABEL_23: | |
608 v17 = 0; | |
609 } | |
610 else | |
611 { | |
612 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
613 while ( *(int *)pSoundID != pSoundId ) | |
614 { | |
615 ++v17; | |
616 pSoundID += 120; | |
764 | 617 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 618 goto LABEL_23; |
619 } | |
620 } | |
621 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
622 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
623 } | |
248 | 624 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 625 } |
626 //return v14; | |
0 | 627 } |
628 // 4948B1: using guessed type int var_1C[5]; | |
629 | |
630 //----- (00494A25) -------------------------------------------------------- | |
187 | 631 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
632 { | |
633 //signed int v3; // eax@1 | |
634 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 635 signed int v5; // edi@15 |
636 PlayerFrame *v6; // esi@17 | |
637 signed int v7; // eax@20 | |
638 | |
187 | 639 //LOWORD(v3) = this->expression; |
640 //v4 = expr; | |
641 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
642 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
643 { | |
644 int v3 = (unsigned)expression; | |
0 | 645 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
646 { | |
647 if ( v3 <= 7 ) | |
648 goto LABEL_12; | |
649 if ( v3 > 8 ) | |
650 { | |
651 if ( v3 > 11 ) | |
652 { | |
1014 | 653 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 654 return; |
0 | 655 goto LABEL_15; |
656 } | |
657 LABEL_12: | |
187 | 658 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
659 return; | |
0 | 660 goto LABEL_15; |
661 } | |
662 } | |
663 } | |
664 LABEL_15: | |
187 | 665 //LOWORD(v3) = a3; |
0 | 666 v5 = 0; |
667 this->uExpressionTimeLength = a3; | |
668 this->uExpressionTimePassed = 0; | |
669 if ( !a3 ) | |
670 { | |
671 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
672 { | |
673 LABEL_20: | |
674 v7 = 0; | |
675 } | |
676 else | |
677 { | |
678 v6 = pPlayerFrameTable->pFrames; | |
187 | 679 while ( v6->expression != new_expression ) |
0 | 680 { |
681 ++v5; | |
682 ++v6; | |
683 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
684 goto LABEL_20; | |
685 } | |
686 v7 = v5; | |
687 } | |
187 | 688 //v4 = expr; |
689 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
690 } | |
691 expression = new_expression; | |
0 | 692 viewparams->bRedrawGameUI = 1; |
693 } | |
694 | |
695 //----- (0049327B) -------------------------------------------------------- | |
696 int Player::_49327B(unsigned int uClass, int a3) | |
697 { | |
698 Player *v3; // esi@1 | |
699 char v4; // zf@4 | |
700 __int16 v5; // dx@9 | |
701 signed int result; // eax@84 | |
702 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
703 int v8; // [sp-4h] [bp-Ch]@3 | |
704 | |
705 v3 = this; | |
135 | 706 if ( this->classType == uClass ) |
0 | 707 { |
708 LABEL_84: | |
709 result = 1; | |
710 } | |
711 else | |
712 { | |
713 switch ( uClass ) | |
714 { | |
715 case 0u: | |
716 v8 = a3; | |
717 v7 = 1; | |
718 goto LABEL_4; | |
719 case 1u: | |
484 | 720 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 721 || _49327B(2u, a3) ) |
722 goto LABEL_84; | |
723 v8 = a3; | |
724 v7 = 3; | |
725 goto LABEL_4; | |
726 case 2u: | |
727 v5 = 19; | |
728 goto LABEL_82; | |
729 case 3u: | |
730 v5 = 21; | |
731 goto LABEL_82; | |
732 case 4u: | |
733 v8 = a3; | |
734 v7 = 5; | |
735 goto LABEL_4; | |
736 case 5u: | |
484 | 737 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 738 || _49327B(6u, a3) ) |
739 goto LABEL_84; | |
740 v8 = a3; | |
741 v7 = 7; | |
742 goto LABEL_4; | |
743 case 6u: | |
744 if ( !a3 ) | |
745 break; | |
746 v5 = 13; | |
747 goto LABEL_82; | |
748 case 7u: | |
749 if ( !a3 ) | |
750 break; | |
751 v5 = 15; | |
752 goto LABEL_82; | |
753 case 8u: | |
754 v8 = a3; | |
755 v7 = 9; | |
756 goto LABEL_4; | |
757 case 9u: | |
484 | 758 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 759 || _49327B(0xAu, a3) ) |
760 goto LABEL_84; | |
761 v8 = a3; | |
762 v7 = 11; | |
763 goto LABEL_4; | |
764 case 0xAu: | |
765 if ( !a3 ) | |
766 break; | |
767 v5 = 25; | |
768 goto LABEL_82; | |
769 case 0xBu: | |
770 if ( !a3 ) | |
771 break; | |
772 v5 = 27; | |
773 goto LABEL_82; | |
774 case 0xCu: | |
775 v8 = a3; | |
776 v7 = 13; | |
777 goto LABEL_4; | |
778 case 0xDu: | |
484 | 779 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 780 || _49327B(0xEu, a3) ) |
781 goto LABEL_84; | |
782 v8 = a3; | |
783 v7 = 15; | |
784 goto LABEL_4; | |
785 case 0xEu: | |
786 if ( !a3 ) | |
787 break; | |
788 v5 = 43; | |
789 goto LABEL_82; | |
790 case 0xFu: | |
791 if ( !a3 ) | |
792 break; | |
793 v5 = 45; | |
794 goto LABEL_82; | |
795 case 0x10u: | |
796 v8 = a3; | |
797 v7 = 17; | |
798 goto LABEL_4; | |
799 case 0x11u: | |
484 | 800 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 801 || _49327B(0x12u, a3) ) |
802 goto LABEL_84; | |
803 v8 = a3; | |
804 v7 = 19; | |
805 goto LABEL_4; | |
806 case 0x12u: | |
807 if ( !a3 ) | |
808 break; | |
809 v5 = 37; | |
810 goto LABEL_82; | |
811 case 0x13u: | |
812 v5 = 39; | |
813 goto LABEL_82; | |
814 case 0x14u: | |
815 v8 = a3; | |
816 v7 = 21; | |
817 goto LABEL_4; | |
818 case 0x15u: | |
484 | 819 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 820 || _49327B(0x16u, a3) ) |
821 goto LABEL_84; | |
822 v8 = a3; | |
823 v7 = 23; | |
824 goto LABEL_4; | |
825 case 0x16u: | |
826 if ( !a3 ) | |
827 break; | |
828 v5 = 31; | |
829 goto LABEL_82; | |
830 case 0x17u: | |
831 if ( !a3 ) | |
832 break; | |
833 v5 = 33; | |
834 goto LABEL_82; | |
835 case 0x18u: | |
836 if ( !_49327B(0x19u, a3) ) | |
837 goto LABEL_56; | |
838 break; | |
839 case 0x19u: | |
840 LABEL_56: | |
484 | 841 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 842 || _49327B(0x1Au, a3) ) |
843 goto LABEL_84; | |
844 v8 = a3; | |
845 v7 = 27; | |
846 goto LABEL_4; | |
847 case 0x1Au: | |
848 if ( !a3 ) | |
849 break; | |
850 v5 = 65; | |
851 goto LABEL_82; | |
852 case 0x1Bu: | |
853 if ( !a3 ) | |
854 break; | |
855 v5 = 67; | |
856 goto LABEL_82; | |
857 case 0x1Cu: | |
858 v8 = a3; | |
859 v7 = 29; | |
860 goto LABEL_4; | |
861 case 0x1Du: | |
484 | 862 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 863 || _49327B(0x1Eu, a3) ) |
864 goto LABEL_84; | |
865 v8 = a3; | |
866 v7 = 31; | |
867 goto LABEL_4; | |
868 case 0x1Eu: | |
869 if ( !a3 ) | |
870 break; | |
871 v5 = 71; | |
872 goto LABEL_82; | |
873 case 0x1Fu: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 73; | |
877 goto LABEL_82; | |
878 case 0x20u: | |
879 v8 = a3; | |
880 v7 = 33; | |
881 goto LABEL_4; | |
882 case 0x21u: | |
484 | 883 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 884 || _49327B(0x22u, a3) ) |
885 goto LABEL_84; | |
886 v8 = a3; | |
887 v7 = 35; | |
888 LABEL_4: | |
889 v4 = _49327B(v7, v8) == 0; | |
890 goto LABEL_83; | |
891 case 0x22u: | |
892 if ( !a3 ) | |
893 break; | |
894 v5 = 77; | |
895 goto LABEL_82; | |
896 case 0x23u: | |
897 if ( a3 ) | |
898 { | |
899 v5 = 79; | |
900 LABEL_82: | |
484 | 901 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 902 LABEL_83: |
903 if ( !v4 ) | |
904 goto LABEL_84; | |
905 } | |
906 break; | |
907 default: | |
908 break; | |
909 } | |
910 result = 0; | |
911 } | |
912 return result; | |
913 } | |
914 | |
915 | |
916 //----- (00492C0B) -------------------------------------------------------- | |
917 bool Player::CanAct() | |
918 { | |
919 bool result; // eax@2 | |
920 | |
921 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
922 result = 0; | |
923 else | |
924 result = 1; | |
925 return result; | |
926 } | |
927 | |
928 //----- (00492C40) -------------------------------------------------------- | |
929 bool Player::CanSteal() | |
930 { | |
931 int v1; // eax@1 | |
932 | |
933 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
934 return v1 != 0; | |
935 } | |
936 | |
937 //----- (00492C4E) -------------------------------------------------------- | |
938 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
939 { | |
940 char v2; // zf@9 | |
941 __int16 v4; // dx@13 | |
942 char v5; // zf@15 | |
943 | |
944 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
945 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
946 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
947 { | |
948 if ( uItemID == 533 ) | |
949 { | |
950 v2 = GetRace() == 1; | |
951 } | |
952 else | |
953 { | |
954 if ( uItemID != 534 ) | |
955 { | |
956 if ( uItemID == 535 ) // | |
957 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
958 { | |
959 switch ( this->uVoiceID ) | |
960 { | |
961 default: | |
962 return 1; | |
963 case 4u: | |
964 case 5u: | |
965 case 6u: | |
966 case 7u: | |
967 case 0xAu: | |
968 case 0xBu: | |
969 case 0xEu: // | |
970 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
971 case 0xFu: | |
972 case 0x12u: | |
973 case 0x13u: | |
974 case 0x15u: | |
975 case 0x18u: | |
976 return 0; | |
977 } | |
978 return 0; | |
979 } | |
980 if ( uItemID == 536 ) // | |
981 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
982 { | |
983 switch ( this->uVoiceID ) | |
984 { | |
985 case 4u: | |
986 case 5u: | |
987 case 6u: | |
988 case 7u: | |
989 case 0xAu: | |
990 case 0xBu: | |
991 case 0xEu: | |
992 case 0xFu: | |
993 case 0x12u: | |
994 case 0x13u: | |
995 case 0x15u: | |
996 case 0x18u: | |
997 return 1; | |
998 default: | |
999 return 0; | |
1000 } | |
1001 return 0; | |
1002 } | |
1003 if ( uItemID != 604 ) // | |
1004 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1005 return 1; | |
1006 v5 = _43EEF3() == 0; | |
1007 goto LABEL_23; | |
1008 } | |
1009 v2 = GetRace() == 3; // | |
1010 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1011 } | |
1012 } | |
1013 else | |
1014 { | |
1015 if ( uItemID != 532 ) | |
1016 { | |
1017 if ( uItemID != 515 && uItemID != 517 ) // | |
1018 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1019 { | |
1020 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1021 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1022 { | |
1023 LABEL_13: | |
1024 v4 = 99; | |
1025 LABEL_15: | |
484 | 1026 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1027 LABEL_23: |
1028 if ( !v5 ) | |
1029 return 1; | |
1030 return 0; | |
1031 } | |
1032 if ( uItemID != 525 ) | |
1033 { | |
1034 if ( uItemID != 527 ) | |
1035 { | |
1036 if ( uItemID != 531 ) | |
1037 return 1; | |
1038 v2 = GetRace() == 2; | |
1039 goto LABEL_10; | |
1040 } | |
1041 goto LABEL_13; | |
1042 } | |
1043 } | |
1044 v4 = 100; | |
1045 goto LABEL_15; | |
1046 } | |
1047 v2 = GetRace() == 0; | |
1048 } | |
1049 LABEL_10: | |
1050 if ( v2 ) | |
1051 return 1; | |
1052 return 0; | |
1053 } | |
1054 | |
1055 //----- (00492D65) -------------------------------------------------------- | |
1056 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1057 { |
1058 | |
1059 signed int player_sex; // ecx@77 | |
1060 char zombi_face; // al@80 | |
1061 signed int remainig_player; // ebx@82 | |
1062 int players_before; // [sp+10h] [bp-4h]@2 | |
1063 int players_after; // [sp+20h] [bp+Ch]@82 | |
1064 | |
1065 if ( pConditions[uConditionIdx] ) | |
1066 return 0; | |
1067 players_before = 0; | |
1068 for (int i=1;i<5;++i) | |
1069 if ( pPlayers[i]->CanAct() ) | |
1070 ++players_before; | |
1071 | |
0 | 1072 switch ( uConditionIdx ) |
1014 | 1073 { |
1074 case Condition_Cursed: | |
1075 PlaySound((PlayerSpeech)30, 0); | |
1076 break; | |
1077 case Condition_Weak: | |
0 | 1078 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) |
1014 | 1079 {--pParty->pPartyBuffs[13].uPower; |
1080 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1081 pParty->pPartyBuffs[13].Reset(); | |
1082 return 0; | |
1083 } | |
1084 | |
1085 PlaySound((PlayerSpeech)25, 0); | |
1086 break; | |
1087 case Condition_Sleep: | |
1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) | |
1089 return 0; | |
1090 break; | |
1091 | |
1092 case Condition_Fear: | |
1093 PlaySound((PlayerSpeech)26, 0); | |
1094 break; | |
1095 case Condition_Drunk: | |
1096 PlaySound((PlayerSpeech)31, 0); | |
1097 break; | |
1098 | |
1099 case Condition_Insane: | |
0 | 1100 if ( a3 == 1 |
1014 | 1101 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) |
1102 return 0; | |
1103 | |
1104 PlaySound((PlayerSpeech)29, 0); | |
1105 break; | |
1106 case Condition_Poison1: | |
1107 case Condition_Poison2: | |
1108 case Condition_Poison3: | |
1109 if ( a3 == 1 ) | |
1110 { | |
1111 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1112 { | |
1113 --pParty->pPartyBuffs[13].uPower; | |
1114 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1115 pParty->pPartyBuffs[13].Reset(); | |
1116 } | |
1117 if ( HasEnchantedItemEquipped(21) | |
1118 || WearsItem(505, 3) | |
1119 || WearsItem(530, 6) ) | |
1120 //goto LABEL_76; | |
1121 return 0; | |
1122 } | |
1123 | |
1124 //v23 = 27; | |
1125 PlaySound((PlayerSpeech)27, 0); | |
1126 break; | |
1127 | |
1128 case Condition_Disease1: | |
1129 case Condition_Disease2: | |
1130 case Condition_Disease3: | |
0 | 1131 if ( a3 == 1 ) |
1014 | 1132 { |
1133 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1134 { | |
1135 --pParty->pPartyBuffs[13].uPower; | |
1136 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1137 pParty->pPartyBuffs[13].Reset(); | |
1138 return 0; | |
1139 } | |
1140 | |
1141 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) | |
1142 return 0; | |
1143 } | |
1144 PlaySound((PlayerSpeech)28, 0); | |
1145 break; | |
1146 case Condition_Paralyzed: | |
1147 if ( a3 == 1 ) | |
1148 { | |
1149 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1150 { | |
1151 --pParty->pPartyBuffs[13].uPower; | |
1152 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1153 pParty->pPartyBuffs[13].Reset(); | |
1154 return 0; | |
1155 } | |
1156 | |
1157 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) | |
1158 return 0; | |
1159 } | |
1160 break; | |
1161 case Condition_Unconcious: | |
1162 PlaySound(SPEECH_32, 0); | |
1163 if ( sHealth > 0 ) | |
1164 sHealth = 0; | |
1165 break; | |
1166 case Condition_Dead: | |
1167 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1168 { | |
0 | 1169 --pParty->pPartyBuffs[13].uPower; |
1170 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1014 | 1171 pParty->pPartyBuffs[13].Reset(); |
1172 } | |
1173 | |
1174 PlaySound((PlayerSpeech)33, 0); | |
1175 if ( sHealth > 0 ) | |
1176 sHealth = 0; | |
1177 if ( sMana > 0 ) | |
1178 sMana = 0; | |
1179 break; | |
1180 case Condition_Pertified: | |
0 | 1181 if ( a3 == 1 |
1014 | 1182 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) |
1183 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) | |
1184 | |
1185 return 0; | |
1186 PlaySound((PlayerSpeech)34, 0); | |
1187 break; | |
1188 case Condition_Eradicated: | |
1189 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u )) | |
1190 { | |
1191 --pParty->pPartyBuffs[13].uPower; | |
1192 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1193 pParty->pPartyBuffs[13].Reset(); | |
1194 return 0; | |
1195 } | |
1196 PlaySound(SPEECH_35, 0); | |
1197 if (sHealth > 0 ) | |
1198 sHealth = 0; | |
1199 if ( sMana > 0 ) | |
1200 sMana = 0; | |
1201 break; | |
1202 case Condition_Zombie: | |
1203 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1204 return 0; | |
1205 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1206 sHealth = GetMaxHealth(); | |
1207 sMana = 0; | |
1208 player_sex = 0; | |
1209 uPrevFace = uCurrentFace; | |
1210 uPrevVoiceID = uVoiceID; | |
1211 switch ( uVoiceID ) | |
1212 { | |
1213 case 0: | |
1214 case 1: | |
1215 case 2: | |
1216 case 3: | |
1217 case 8: | |
1218 case 9: | |
1219 case 12: | |
1220 case 13: | |
1221 case 16: | |
1222 case 17: | |
1223 case 20: | |
1224 case 23: | |
1225 player_sex = 0; | |
1226 break; | |
1227 case 4: | |
1228 case 5: | |
1229 case 6: | |
1230 case 7: | |
1231 case 10: | |
1232 case 11: | |
1233 case 14: | |
1234 case 15: | |
1235 case 18: | |
1236 case 19: | |
1237 case 21: | |
1238 case 24: | |
1239 player_sex = 1; | |
1240 break; | |
1241 default: | |
1242 break; | |
1243 } | |
1244 | |
1245 zombi_face = (player_sex != 0) + 23; | |
1246 uCurrentFace = zombi_face; | |
1247 uVoiceID = zombi_face; | |
1248 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1249 break; | |
0 | 1250 } |
1014 | 1251 |
1252 remainig_player = 0; | |
1253 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1254 players_after = 0; | |
1255 for (int i=1;i<5;++i) | |
0 | 1256 { |
1014 | 1257 |
1258 | |
1259 if ( pPlayers[i]->CanAct() ) | |
1260 { | |
1261 remainig_player=i; | |
1262 ++players_after; | |
1263 } | |
0 | 1264 } |
1014 | 1265 if (( players_before == 2 )&&( players_after == 1 )) |
1266 { | |
1267 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1268 } | |
1269 return 1; | |
1270 } | |
0 | 1271 |
1272 //----- (00492528) -------------------------------------------------------- | |
1273 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1274 { | |
973 | 1275 //unsigned int v3; // eax@1 |
0 | 1276 Texture *v4; // esi@1 |
1277 unsigned int v5; // ebx@1 | |
1278 signed int v6; // edi@5 | |
1279 int *v7; // ecx@6 | |
1280 signed int v8; // edx@7 | |
1281 int *v9; // eax@8 | |
973 | 1282 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1283 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1284 | |
973 | 1285 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1286 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1287 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1288 if ( !areWeLoadingTexture ) | |
1289 { | |
1290 v4->Release(); | |
1006 | 1291 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1292 } |
1293 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1294 { | |
1295 v6 = 0; | |
1296 if ( (signed int)uItemIDa <= 0 ) | |
1297 return 1; | |
973 | 1298 v7 = &pInventoryIndices[uSlot]; |
0 | 1299 while ( 1 ) |
1300 { | |
1301 v8 = 0; | |
1302 if ( (signed int)v5 > 0 ) | |
1303 break; | |
1304 LABEL_11: | |
1305 ++v6; | |
1306 v7 += 14; | |
1307 if ( v6 >= (signed int)uItemIDa ) | |
1308 return 1; | |
1309 } | |
1310 v9 = v7; | |
1311 while ( !*v9 ) | |
1312 { | |
1313 ++v8; | |
1314 ++v9; | |
1315 if ( v8 >= (signed int)v5 ) | |
1316 goto LABEL_11; | |
1317 } | |
1318 } | |
1319 return 0; | |
1320 } | |
1321 // 506128: using guessed type int areWeLoadingTexture; | |
1322 | |
1323 //----- (004925E6) -------------------------------------------------------- | |
1324 unsigned int Player::FindFreeInventorySlot() | |
1325 { | |
1326 unsigned int result; // eax@1 | |
1327 ItemGen *v2; // ecx@1 | |
1328 | |
1329 result = 0; | |
1330 v2 = this->pInventoryItems; | |
1331 while ( v2->uItemID ) | |
1332 { | |
1333 ++result; | |
1334 ++v2; | |
1335 if ( (signed int)result >= 126 ) | |
1336 return -1; | |
1337 } | |
1338 return result; | |
1339 } | |
1340 | |
1341 //----- (00492600) -------------------------------------------------------- | |
1342 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1343 { | |
1344 signed int v3; // edx@1 | |
1345 ItemGen *v4; // eax@1 | |
1346 int result; // eax@8 | |
1347 unsigned int v6; // ebx@10 | |
973 | 1348 //unsigned int v7; // eax@10 |
0 | 1349 Texture *v8; // esi@10 |
1350 void *v9; // esi@13 | |
1351 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1352 Player *v11; // [sp+4h] [bp-8h]@1 | |
1353 signed int v12; // [sp+8h] [bp-4h]@4 | |
1354 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1355 | |
1356 v11 = this; | |
1357 v3 = 0; | |
1358 v4 = this->pInventoryItems; | |
1359 while ( v4->uItemID ) | |
1360 { | |
1361 ++v3; | |
1362 ++v4; | |
1363 if ( v3 >= 126 ) | |
1364 { | |
1365 v12 = -1; | |
1366 goto LABEL_5; | |
1367 } | |
1368 } | |
1369 v12 = v3; | |
1370 LABEL_5: | |
1371 if ( v12 == -1 ) | |
1372 { | |
1373 if ( uActiveCharacter ) | |
201 | 1374 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1375 result = 0; |
1376 } | |
1377 else | |
1378 { | |
1379 v6 = uItemID; | |
973 | 1380 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1381 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1382 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1383 if ( !areWeLoadingTexture ) | |
1384 { | |
1385 v8->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1388 if ( (signed int)uItemIDa > 0 ) | |
1389 { | |
1390 v9 = &v11->pInventoryIndices[uSlot]; | |
1391 do | |
1392 { | |
1393 if ( (signed int)v10 > 0 ) | |
1394 memset32(v9, -1 - uSlot, v10); | |
1395 v9 = (char *)v9 + 56; | |
1396 --uItemIDa; | |
1397 } | |
1398 while ( uItemIDa ); | |
1399 } | |
1400 result = v12 + 1; | |
1401 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1402 v11->pInventoryItems[v12].uItemID = v6; | |
1403 } | |
1404 return result; | |
1405 } | |
1406 // 506128: using guessed type int areWeLoadingTexture; | |
1407 | |
1408 //----- (00492700) -------------------------------------------------------- | |
1409 int Player::HasSkill(unsigned int uSkillType) | |
1410 { | |
1411 signed int result; // eax@3 | |
1412 | |
1413 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1414 { | |
1415 result = 1; | |
1416 } | |
1417 else | |
1418 { | |
809 | 1419 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1420 ShowStatusBarString(pTmpBuf, 2u); |
1421 result = 0; | |
1422 } | |
1423 return result; | |
1424 } | |
1425 | |
1426 //----- (00492745) -------------------------------------------------------- | |
1427 int Player::WearItem(unsigned int uItemID) | |
1428 { | |
1010 | 1429 int item_body_anch; // edi@6 |
1430 int item_indx; | |
1431 //find empty slot | |
1432 for(item_indx=0;item_indx<126;++item_indx) | |
1433 if (pInventoryItems[item_indx].uItemID==0) | |
1434 break; | |
1435 if (item_indx==126) //not found | |
1436 item_indx=-1; | |
1437 | |
1438 if ( item_indx != -1 ) | |
1439 { | |
1440 | |
1441 pInventoryItems[item_indx].uItemID=uItemID; | |
1442 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1443 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1444 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1445 | |
0 | 1446 } |
1447 return 0; | |
1448 } | |
1449 | |
1450 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1451 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1452 { |
1453 signed int v3; // ebx@2 | |
1454 signed int v4; // edi@3 | |
1455 unsigned int v5; // esi@3 | |
1456 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1457 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1458 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1459 | |
1460 thisa = this; | |
1461 if ( uSlot == -1 ) | |
1462 { | |
1463 v3 = 0; | |
1014 | 1464 while ( true ) |
0 | 1465 { |
1466 v4 = 0; | |
1467 v5 = v3; | |
1468 do | |
1469 { | |
1470 if ( CanFitItem(v5, uItemID) ) | |
1471 { | |
1472 v8 = uItemID; | |
1473 v7 = v5; | |
1474 return CreateItemInInventory(v7, v8); | |
1475 } | |
1476 ++v4; | |
1477 v5 += 14; | |
1478 } | |
1479 while ( v4 < 9 ); | |
1480 ++v3; | |
1481 if ( v3 < 14 ) | |
1482 continue; | |
1483 break; | |
1484 } | |
1485 return 0; | |
1486 } | |
1487 if ( !CanFitItem(uSlot, uItemID) ) | |
1488 { | |
1489 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1490 return 0; | |
1491 } | |
1492 v8 = uItemID; | |
1493 v7 = uSlot; | |
1494 return CreateItemInInventory(v7, v8); | |
1495 } | |
1496 | |
1497 //----- (00492826) -------------------------------------------------------- | |
1014 | 1498 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1499 { |
1500 unsigned int v3; // ebx@1 | |
1501 unsigned int v4; // esi@3 | |
1502 signed int v5; // edi@3 | |
1503 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1504 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1505 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1506 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1507 | |
1508 thisa = this; | |
1509 v3 = Src->uItemID; | |
1510 pItemsTable->SetSpecialBonus(Src); | |
1511 if ( uSlot == -1 ) | |
1512 { | |
1513 uSlota = 0; | |
1014 | 1514 while ( true ) |
0 | 1515 { |
1516 v4 = uSlota; | |
1517 v5 = 0; | |
1518 do | |
1519 { | |
1520 if ( CanFitItem(v4, v3) ) | |
1521 { | |
1522 v8 = Src; | |
1523 v7 = v4; | |
1524 return CreateItemInInventory2(v7, v8); | |
1525 } | |
1526 ++v5; | |
1527 v4 += 14; | |
1528 } | |
1529 while ( v5 < 14 ); | |
1530 ++uSlota; | |
1531 if ( uSlota < 9 ) | |
1532 continue; | |
1533 break; | |
1534 } | |
1535 return 0; | |
1536 } | |
1537 if ( !CanFitItem(uSlot, v3) ) | |
1538 return 0; | |
1539 v8 = Src; | |
1540 v7 = uSlot; | |
1541 return CreateItemInInventory2(v7, v8); | |
1542 } | |
1543 | |
1544 //----- (0049289C) -------------------------------------------------------- | |
1545 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1546 { | |
1547 signed int v3; // ebx@1 | |
1548 ItemGen *v4; // eax@1 | |
1549 int result; // eax@6 | |
973 | 1550 //unsigned int v6; // eax@7 |
1014 | 1551 Texture *item_texture; // esi@7 |
0 | 1552 unsigned int v8; // edx@9 |
1014 | 1553 int *pInvPos; // esi@10 |
1554 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1555 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1556 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1557 |
0 | 1558 |
1559 v12 = this; | |
1560 v3 = 0; | |
1561 v4 = this->pInventoryItems; | |
1562 while ( v4->uItemID ) | |
1563 { | |
1564 ++v3; | |
1565 ++v4; | |
1566 if ( v3 >= 126 ) | |
1567 { | |
1568 v3 = -1; | |
1569 break; | |
1570 } | |
1571 } | |
1572 if ( v3 == -1 ) | |
1573 { | |
1574 result = 0; | |
1575 } | |
1576 else | |
1577 { | |
1014 | 1578 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1579 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1580 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1581 if ( !areWeLoadingTexture ) |
1582 { | |
1014 | 1583 item_texture->Release(); |
1006 | 1584 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1585 } |
1014 | 1586 if ( slot_height > 0 ) |
1587 { | |
1588 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1589 do |
1590 { | |
1014 | 1591 if ( slot_width > 0 ) |
1592 memset32(pInvPos, -1 - uSlot, slot_width); | |
1593 pInvPos +=14; | |
1594 --slot_height; | |
1595 } | |
1596 while ( slot_height ); | |
1597 } | |
1598 pInventoryIndices[uSlot] = v3 + 1; | |
1599 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1600 result = v3 + 1; |
1601 } | |
1602 return result; | |
1603 } | |
1604 // 506128: using guessed type int areWeLoadingTexture; | |
1605 | |
1606 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1607 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1608 { | |
973 | 1609 //Player *v4; // ebx@1 |
1610 //unsigned int v5; // eax@1 | |
1014 | 1611 Texture *item_texture; // esi@1 |
1612 int *pInvPos; // esi@4 | |
1613 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1614 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1615 | |
1616 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1617 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1618 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1619 if ( !areWeLoadingTexture ) |
1620 { | |
1014 | 1621 item_texture->Release(); |
1006 | 1622 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1623 } |
1014 | 1624 if ( (signed int)slot_height > 0 ) |
1625 { | |
1626 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1627 do |
1628 { | |
1014 | 1629 if ( (signed int)slot_width > 0 ) |
1630 memset32(pInvPos, -1 - uSlot, slot_width); | |
1631 pInvPos +=14; | |
1632 --slot_height; | |
1633 } | |
1634 while ( slot_height ); | |
1635 } | |
1636 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1637 return 1; |
1638 } | |
278 | 1639 |
0 | 1640 // 506128: using guessed type int areWeLoadingTexture; |
1641 | |
1642 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1643 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1644 { | |
1014 | 1645 |
1646 ItemGen *item_in_slot; // ecx@1 | |
1647 Texture *item_texture; // esi@1 | |
1648 unsigned int slot_height; // ebp@1 | |
1649 int *pInvPos; // edx@4 | |
1650 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1651 | |
1652 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1653 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1654 item_in_slot->Reset(); | |
1655 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1656 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1657 if ( !areWeLoadingTexture ) |
1658 { | |
1014 | 1659 item_texture->Release(); |
1006 | 1660 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1661 } |
1014 | 1662 if ( slot_height > 0 ) |
1663 { | |
1664 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1665 do |
1666 { | |
1014 | 1667 if (slot_width > 0 ) |
1668 memset32(pInvPos, 0, slot_width); | |
1669 pInvPos += 14; | |
1670 --slot_height; | |
1671 } | |
1672 while ( slot_height ); | |
0 | 1673 } |
1006 | 1674 |
0 | 1675 } |
1676 // 506128: using guessed type int areWeLoadingTexture; | |
1677 | |
436 | 1678 //identf |
0 | 1679 //----- (00490EEE) -------------------------------------------------------- |
917 | 1680 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1681 { | |
1682 int pSkillLevel; // eax@1 | |
1683 int NotBuy; // eax@1 | |
1684 int result; | |
1685 signed int pEquipType; // esi@1 | |
1686 float *pPriceMultiplier; // esi@26 | |
1687 int pPriceItemService; // edi@26 | |
1688 | |
1689 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1690 NotBuy = 4; | |
1691 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1692 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1693 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1694 return 5; |
917 | 1695 if ( building_type == BildingType_WeaponShop ) |
1696 { | |
1697 if ( pEquipType > EQUIP_BOW ) | |
1698 return NotBuy; | |
1699 if (pItem->Stolen()) | |
1700 return 6; | |
1701 } | |
1702 if ( building_type == BildingType_ArmorShop ) | |
1703 { | |
1704 if ( pEquipType < 3 && pEquipType > 9 ) | |
1705 return NotBuy; | |
1706 if (pItem->Stolen()) | |
1707 return 6; | |
1708 } | |
1709 if ( building_type == BildingType_MagicShop ) | |
1710 { | |
1711 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1712 { | |
1713 if (pItem->Stolen()) | |
1714 return 6; | |
1715 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1716 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1717 if ( ShopMenuType == 3 )//Sell | |
1718 { | |
1719 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1720 if (!pItem->Broken()) | |
1721 { | |
1722 if ( pSkillLevel ) | |
1723 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1724 else | |
1725 result = 1; | |
1726 return result; | |
1727 } | |
1728 pPriceItemService = 1; | |
1729 if ( pSkillLevel ) | |
1730 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1731 else | |
1732 result = 1; | |
1733 return result; | |
1734 } | |
1735 if ( ShopMenuType == 4 )//Identify | |
1736 { | |
1737 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1738 if ( pSkillLevel ) | |
1739 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1740 else | |
1741 result = 1; | |
1742 return result; | |
1743 } | |
1744 if ( ShopMenuType == 5 )//Repair | |
1745 { | |
1746 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1747 if ( pSkillLevel ) | |
1748 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1749 else | |
1750 result = 1; | |
1751 return result; | |
1752 } | |
1753 if ( ShopMenuType != 6 )//Buy and ??? | |
1754 { | |
1755 if ( pSkillLevel ) | |
1756 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1757 else | |
1758 result = 1; | |
1759 return result; | |
1760 } | |
1761 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1762 if (pItem->Broken()) | |
1763 pPriceItemService = 1; | |
1764 if ( pPriceItemService >= 1 ) | |
1765 { | |
1766 if ( pSkillLevel ) | |
1767 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1768 else | |
1769 result = 1; | |
1770 return result; | |
1771 } | |
1772 pPriceItemService = 1; | |
1773 if ( pSkillLevel ) | |
1774 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1775 else | |
1776 result = 1; | |
0 | 1777 return result; |
917 | 1778 } |
1779 if ( pEquipType != EQUIP_BOOK ) | |
1780 return NotBuy; | |
1781 } | |
1782 if ( building_type == BildingType_AlchemistShop ) | |
1783 { | |
1784 if ( pEquipType < EQUIP_REAGENT ) | |
1785 return NotBuy; | |
1786 if ( pEquipType > EQUIP_POTION ) | |
1787 { | |
1788 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1789 return NotBuy; | |
1790 } | |
1791 if (pItem->Stolen()) | |
1792 return 6; | |
1793 } | |
1794 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1795 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1796 if ( ShopMenuType == 3 )//Sell | |
1797 { | |
1798 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1799 if (!pItem->Broken()) | |
1800 { | |
1801 if ( pSkillLevel ) | |
1802 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1803 else | |
1804 result = 1; | |
0 | 1805 return result; |
917 | 1806 } |
1807 pPriceItemService = 1; | |
1808 if ( pSkillLevel ) | |
1809 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1810 else | |
1811 result = 1; | |
1812 return result; | |
1813 } | |
1814 if ( ShopMenuType == 4 )//Identify | |
1815 { | |
1816 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1817 if ( pSkillLevel ) | |
1818 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1819 else | |
1820 result = 1; | |
1821 return result; | |
1822 } | |
1823 if ( ShopMenuType == 5 )//Repair | |
1824 { | |
1825 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1826 if ( pSkillLevel ) | |
1827 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1828 else | |
1829 result = 1; | |
1830 return result; | |
1831 } | |
1832 if ( ShopMenuType != 6 )//Buy and ??? | |
1833 { | |
1834 if ( pSkillLevel ) | |
1835 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1836 else | |
1837 result = 1; | |
1838 return result; | |
1839 } | |
1840 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1841 if (pItem->Broken()) |
917 | 1842 pPriceItemService = 1; |
1843 if ( pPriceItemService >= 1 ) | |
1844 { | |
1845 if ( pSkillLevel ) | |
1846 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1847 else | |
1848 result = 1; | |
1849 return result; | |
1850 } | |
1851 pPriceItemService = 1; | |
1852 if ( pSkillLevel ) | |
1853 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1854 else |
1855 result = 1; | |
1856 return result; | |
1857 } | |
1858 | |
1859 //----- (0049107D) -------------------------------------------------------- | |
1860 int Player::GetBodybuilding() | |
1861 { | |
1010 | 1862 int v1; // al@1 |
0 | 1863 int v2; // ecx@1 |
1864 int v4; // eax@3 | |
1865 signed int v6; // [sp-4h] [bp-4h]@2 | |
1866 | |
1867 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1868 v2 = v1 & 0x3F; | |
1869 if ( v1 & 0x100 ) | |
1870 { | |
1871 v6 = 5; | |
1872 } | |
1873 else | |
1874 { | |
1008 | 1875 if ( (v1&0xFF) >= 0 ) |
0 | 1876 { |
1877 v4 = ((v1 & 0x40) != 0) + 1; | |
1878 return v2 * v4; | |
1879 } | |
1880 v6 = 3; | |
1881 } | |
1882 v4 = v6; | |
1883 return v2 * v4; | |
1884 } | |
1885 | |
1886 //----- (004910A8) -------------------------------------------------------- | |
607 | 1887 int Player::GetMeditation() |
0 | 1888 { |
1010 | 1889 int v1; // al@1 |
1008 | 1890 int base_level; // ecx@1 |
0 | 1891 int v4; // eax@3 |
1892 signed int v6; // [sp-4h] [bp-4h]@2 | |
1893 | |
1894 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1895 base_level = v1 & 0x3F; |
0 | 1896 if ( v1 & 0x100 ) |
1897 { | |
1898 v6 = 5; | |
1899 } | |
1900 else | |
1901 { | |
1008 | 1902 if ( (v1&0xFF) >= 0 ) |
0 | 1903 { |
1904 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1905 return base_level * v4; |
0 | 1906 } |
1907 v6 = 3; | |
1908 } | |
1909 v4 = v6; | |
1008 | 1910 return base_level * v4; |
0 | 1911 } |
1912 | |
1913 //----- (004910D3) -------------------------------------------------------- | |
1914 int Player::CanIdentify(ItemGen *pItem) | |
1915 { | |
1916 unsigned __int16 v2; // ax@1 | |
1917 unsigned __int16 v3; // bx@1 | |
1918 int uSkillMult; // eax@3 | |
1919 int v5; // edi@7 | |
1920 signed int v6; // ebp@7 | |
1921 char *v7; // esi@7 | |
1922 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1923 |
1924 if (CheckHiredNPCSpeciality(Scholar)) | |
1925 return true; | |
0 | 1926 |
179 | 1927 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1928 v3 = v2; |
179 | 1929 if ( v2 & 1 ) |
0 | 1930 { |
1931 uSkillMultiplier = 5; | |
1932 } | |
1933 else | |
1934 { | |
1935 if ( (v2 & 0x80u) == 0 ) | |
1936 { | |
1937 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1938 v5 = uSkillMult * (v3 & 0x3F); |
1939 v6 = 0; | |
1940 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1941 |
179 | 1942 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1943 v6 = 1; | |
1944 if ( v5 >= (unsigned __int8)v7[46] ) | |
1945 v6 = 1; | |
1946 return v6; | |
0 | 1947 } |
1948 uSkillMultiplier = 3; | |
1949 } | |
1950 uSkillMult = uSkillMultiplier; | |
1951 v5 = uSkillMult * (v3 & 0x3F); | |
1952 v6 = 0; | |
1953 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1954 |
0 | 1955 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1956 v6 = 1; | |
1957 if ( v5 >= (unsigned __int8)v7[46] ) | |
1958 v6 = 1; | |
1959 return v6; | |
1960 } | |
1961 | |
1962 //----- (00491151) -------------------------------------------------------- | |
1963 int Player::CanRepair(ItemGen *a2) | |
1964 { | |
1965 unsigned __int16 v2; // ax@1 | |
1966 unsigned __int16 v3; // bx@1 | |
1967 int v4; // eax@3 | |
1968 int v5; // edi@7 | |
1969 signed int v6; // ebp@7 | |
1970 signed int v10; // [sp-4h] [bp-14h]@2 | |
1971 | |
652 | 1972 |
1973 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1974 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1975 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1976 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1977 return true; | |
1978 | |
1010 | 1979 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1980 v3 = v2; |
1010 | 1981 if (v2 & 0x100 ) |
0 | 1982 { |
1983 v10 = 5; | |
1984 } | |
1985 else | |
1986 { | |
1987 if ( (v2 & 0x80u) == 0 ) | |
1988 { | |
1989 v4 = ((v2 & 0x40) != 0) + 1; | |
1990 goto LABEL_7; | |
1991 } | |
1992 v10 = 3; | |
1993 } | |
1994 v4 = v10; | |
1995 LABEL_7: | |
1996 v5 = v4 * (v3 & 0x3F); | |
1997 v6 = 0; | |
1998 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1999 return true; | |
2000 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2001 { | |
2002 __debugbreak(); // really odd | |
2003 return true; | |
2004 } | |
2005 return false; | |
2006 } | |
2007 | |
2008 //----- (004911F3) -------------------------------------------------------- | |
2009 int Player::GetMerchant() | |
2010 { | |
2011 Player *v1; // edi@1 | |
2012 unsigned __int16 v2; // ax@1 | |
2013 unsigned __int16 v3; // bx@1 | |
2014 int v4; // esi@1 | |
2015 int v5; // edi@1 | |
2016 int v7; // eax@3 | |
2017 int v8; // ecx@7 | |
2018 signed int v9; // [sp-4h] [bp-10h]@6 | |
2019 | |
2020 v1 = this; | |
607 | 2021 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2022 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2023 v4 = v2 & 0x003F; |
1010 | 2024 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2025 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2026 return 10000; | |
2027 v7 = GetPartyReputation(); | |
2028 if ( !v4 ) | |
2029 return -v7; | |
1010 | 2030 if ( v3 & 0x100 ) |
0 | 2031 { |
2032 v9 = 5; | |
2033 } | |
2034 else | |
2035 { | |
2036 if ( (v3 & 0x80u) == 0 ) | |
2037 { | |
2038 v8 = ((v3 & 0x40) != 0) + 1; | |
2039 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2040 } | |
2041 v9 = 3; | |
2042 } | |
2043 v8 = v9; | |
2044 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2045 } | |
2046 | |
2047 //----- (0049125A) -------------------------------------------------------- | |
2048 int Player::GetPerception() | |
2049 { | |
2050 Player *v1; // edi@1 | |
2051 unsigned __int16 v2; // ax@1 | |
2052 unsigned __int16 v3; // bx@1 | |
2053 int v4; // esi@1 | |
2054 int v5; // edi@1 | |
2055 int v7; // eax@5 | |
2056 signed int v8; // [sp-4h] [bp-10h]@4 | |
2057 | |
2058 v1 = this; | |
1010 | 2059 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2060 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2061 v4 = v2 & 0x3F; |
1010 | 2062 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2063 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2064 return 10000; | |
1010 | 2065 if ( v3 & 0x100 ) |
0 | 2066 { |
2067 v8 = 5; | |
2068 } | |
2069 else | |
2070 { | |
2071 if ( (v3 & 0x80u) == 0 ) | |
2072 { | |
2073 v7 = ((v3 & 0x40) != 0) + 1; | |
2074 return v4 + v5 * (v7 - 1); | |
2075 } | |
2076 v8 = 3; | |
2077 } | |
2078 v7 = v8; | |
2079 return v4 + v5 * (v7 - 1); | |
2080 } | |
2081 | |
2082 //----- (004912B0) -------------------------------------------------------- | |
2083 int Player::GetDisarmTrap() | |
2084 { | |
2085 Player *v1; // ebp@1 | |
2086 unsigned __int16 v2; // ax@1 | |
2087 unsigned __int16 v3; // bx@1 | |
2088 int v4; // esi@1 | |
2089 int v5; // edi@1 | |
2090 int v7; // eax@7 | |
2091 signed int v8; // [sp-4h] [bp-14h]@6 | |
2092 | |
2093 v1 = this; | |
1010 | 2094 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2095 v3 = v1->pActiveSkills[29]; |
2096 v4 = v2 & 0x3F; | |
2097 v5 = v1->pActiveSkills[29] & 0x3F; | |
2098 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2099 return 10000; | |
2100 if ( HasEnchantedItemEquipped(35) ) | |
2101 v4 *= 2; | |
1010 | 2102 if ( v3 & 0x100 ) |
0 | 2103 { |
2104 v8 = 5; | |
2105 } | |
2106 else | |
2107 { | |
2108 if ( (v3 & 0x80u) == 0 ) | |
2109 { | |
2110 v7 = ((v3 & 0x40) != 0) + 1; | |
2111 return v4 + v5 * (v7 - 1); | |
2112 } | |
2113 v8 = 3; | |
2114 } | |
2115 v7 = v8; | |
2116 return v4 + v5 * (v7 - 1); | |
2117 } | |
2118 | |
2119 //----- (00491317) -------------------------------------------------------- | |
2120 char Player::GetLearningPercent() | |
2121 { | |
2122 Player *v1; // esi@1 | |
2123 int v2; // eax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // ecx@1 | |
2126 int v5; // eax@4 | |
2127 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2128 | |
2129 v1 = this; | |
1010 | 2130 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2131 v3 = v1->pActiveSkills[36]; |
2132 v4 = v2 & 0x3F; | |
2133 if ( v2 ) | |
2134 { | |
1010 | 2135 if (v3 & 0x100 ) |
0 | 2136 { |
2137 v7 = 5; | |
2138 } | |
2139 else | |
2140 { | |
2141 if ( (v3 & 0x80u) == 0 ) | |
2142 { | |
2143 v5 = ((v3 & 0x40) != 0) + 1; | |
2144 goto LABEL_8; | |
2145 } | |
2146 v7 = 3; | |
2147 } | |
2148 v5 = v7; | |
2149 LABEL_8: | |
2150 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2151 } | |
2152 return v2; | |
2153 } | |
2154 | |
2155 //----- (0048C6AF) -------------------------------------------------------- | |
2156 Player::Player() | |
2157 { | |
2158 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2159 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2160 for (uint i = 0; i < 126; ++i) | |
2161 pInventoryItems[i].Reset(); | |
2162 for (uint i = 0; i < 12; ++i) | |
2163 pEquippedItems[i].Reset(); | |
2164 | |
2165 | |
2166 for (uint i = 0; i < 24; ++i) | |
2167 { | |
2168 pPlayerBuffs[i].uSkill = 0; | |
2169 pPlayerBuffs[i].uSkill = 0; | |
2170 pPlayerBuffs[i].uPower = 0; | |
2171 pPlayerBuffs[i].uExpireTime = 0; | |
2172 pPlayerBuffs[i].uCaster = 0; | |
2173 pPlayerBuffs[i].uFlags = 0; | |
2174 } | |
2175 | |
2176 pName[0] = 0; | |
1014 | 2177 uCurrentFace = 0; |
0 | 2178 uVoiceID = 0; |
2179 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2180 | |
2181 field_BB = 0; | |
2182 | |
2183 uMight = uMightBonus = 0; | |
2184 uIntelligence = uIntelligenceBonus = 0; | |
2185 uWillpower = uWillpowerBonus = 0; | |
2186 uEndurance = uEnduranceBonus = 0; | |
2187 uSpeed = uSpeedBonus = 0; | |
2188 uAccuracy = uAccuracyBonus = 0; | |
2189 uLuck = uLuckBonus = 0; | |
2190 uLevel = sLevelModifier = 0; | |
2191 sAgeModifier = 0; | |
2192 | |
1019 | 2193 // memset(field_1F5, 0, 30); |
2194 pure_luck_used=0; | |
2195 pure_speed_used=0; | |
2196 pure_intellect_used=0; | |
2197 pure_endurance_used=0; | |
2198 pure_willpower_used=0; | |
2199 pure_accuracy_used=0; | |
2200 pure_might_used=0; | |
0 | 2201 |
2202 sResFireBase = sResFireBonus = 0; | |
2203 sResAirBase = sResAirBonus = 0; | |
2204 sResWaterBase = sResWaterBonus = 0; | |
2205 sResEarthBase = sResEarthBonus = 0; | |
2206 sResMagicBase = sResMagicBonus = 0; | |
2207 sResSpiritBase = sResSpiritBonus = 0; | |
2208 sResMindBase = sResMindBonus = 0; | |
2209 sResBodyBase = sResBodyBonus = 0; | |
2210 sResLightBase = sResLightBonus = 0; | |
2211 sResDarkBase = sResDarkBonus = 0; | |
2212 | |
2213 uTimeToRecovery = 0; | |
2214 | |
2215 uSkillPoints = 0; | |
2216 | |
2217 sHealth = 0; | |
2218 uFullHealthBonus = 0; | |
2219 _health_related = 0; | |
2220 | |
2221 sMana = 0; | |
2222 uFullManaBonus = 0; | |
2223 _mana_related = 0; | |
2224 | |
2225 uQuickSpell = 0; | |
2226 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2227 | |
2228 _some_attack_bonus = 0; | |
2229 field_1A91 = 0; | |
2230 _melee_dmg_bonus = 0; | |
2231 field_1A93 = 0; | |
2232 _ranged_atk_bonus = 0; | |
2233 field_1A95 = 0; | |
2234 _ranged_dmg_bonus = 0; | |
2235 field_1A97 = 0; | |
2236 | |
130 | 2237 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2238 uExpressionTimePassed = 0; |
2239 uExpressionTimeLength = 0; | |
2240 | |
2241 uNumDivineInterventionCastsThisDay = 0; | |
2242 uNumArmageddonCasts = 0; | |
2243 uNumFireSpikeCasts = 0; | |
2244 | |
2245 memset(field_1988, 0, 49 * sizeof(int)); | |
2246 memset(field_1A50, 0, 64 * sizeof(char)); | |
2247 | |
2248 field_E0 = 0; | |
2249 field_E4 = 0; | |
2250 field_E8 = 0; | |
2251 field_EC = 0; | |
2252 field_F0 = 0; | |
2253 field_F4 = 0; | |
2254 field_F8 = 0; | |
2255 field_FC = 0; | |
2256 field_100 = 0; | |
2257 field_104 = 0; | |
198 | 2258 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2259 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2260 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2261 |
198 | 2262 lastOpenedSpellbookPage = 0; |
0 | 2263 } |
2264 | |
2265 //----- (0048C6F6) -------------------------------------------------------- | |
2266 bool Party::AddItem(ItemGen *pItem) | |
2267 { | |
2268 unsigned int v2; // eax@1 | |
2269 unsigned int v3; // ecx@4 | |
2270 signed int v4; // edx@4 | |
2271 char *v5; // eax@8 | |
973 | 2272 //unsigned int v6; // eax@10 |
0 | 2273 Texture *v7; // ebx@10 |
2274 signed int v8; // esi@10 | |
2275 Player *v9; // edi@11 | |
2276 int v10; // eax@11 | |
2277 bool result; // eax@15 | |
2278 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2279 |
2280 | |
188 | 2281 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2282 //int v16; // [sp+10h] [bp-18h]@3 | |
2283 //int v17; // [sp+14h] [bp-14h]@3 | |
2284 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2285 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2286 Party *v20; // [sp+20h] [bp-8h]@1 | |
2287 int v21; // [sp+24h] [bp-4h]@10 | |
2288 | |
2289 auto thos = this; | |
2290 | |
2291 v20 = thos; | |
2292 v2 = pItem->uItemID; | |
222 | 2293 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2294 pItem->SetIdentified(); |
188 | 2295 ///v15 = 0; |
2296 //v16 = 1; | |
2297 //v18 = 3; | |
2298 //v17 = 2; | |
0 | 2299 if ( uActiveCharacter ) |
2300 { | |
2301 v3 = uActiveCharacter - 1; | |
2302 v4 = 0; | |
2303 do | |
2304 { | |
188 | 2305 v15[v4++] = v3++; |
0 | 2306 if ( (signed int)v3 >= 4 ) |
2307 v3 = 0; | |
2308 } | |
2309 while ( v4 < 4 ); | |
2310 } | |
2311 v5 = pItemsTable->pItems[v2].pIconName; | |
2312 if ( v5 ) | |
2313 { | |
973 | 2314 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2315 v21 = areWeLoadingTexture; |
2316 v8 = 0; | |
2317 while ( 1 ) | |
2318 { | |
188 | 2319 v9 = &v20->pPlayers[v15[v8]]; |
2320 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2321 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2322 if ( v10 ) |
2323 break; | |
2324 ++v8; | |
2325 if ( v8 >= 4 ) | |
2326 { | |
2327 if ( !v21 ) | |
2328 { | |
2329 v7->Release(); | |
1006 | 2330 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2331 } |
2332 goto LABEL_15; | |
2333 } | |
2334 } | |
232 | 2335 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2336 pItem->Reset(); |
2337 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2338 v19->PlaySound(SPEECH_60, 0); |
0 | 2339 if ( !v21 ) |
2340 { | |
2341 v7->Release(); | |
1006 | 2342 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2343 } |
2344 result = 1; | |
2345 } | |
2346 else | |
2347 { | |
2348 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2349 LABEL_15: | |
2350 result = 0; | |
2351 } | |
2352 return result; | |
2353 } | |
2354 // 506128: using guessed type int areWeLoadingTexture; | |
2355 | |
2356 //----- (0048C855) -------------------------------------------------------- | |
2357 int Player::GetBaseStrength() | |
2358 { | |
2359 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2360 } | |
2361 | |
2362 //----- (0048C86C) -------------------------------------------------------- | |
2363 int Player::GetBaseIntelligence() | |
2364 { | |
2365 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2366 } | |
2367 | |
2368 //----- (0048C883) -------------------------------------------------------- | |
2369 int Player::GetBaseWillpower() | |
2370 { | |
2371 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2372 } | |
2373 | |
2374 //----- (0048C89A) -------------------------------------------------------- | |
2375 int Player::GetBaseEndurance() | |
2376 { | |
2377 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2378 } | |
2379 | |
2380 //----- (0048C8B1) -------------------------------------------------------- | |
2381 int Player::GetBaseAccuracy() | |
2382 { | |
2383 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2384 } | |
2385 | |
2386 //----- (0048C8C8) -------------------------------------------------------- | |
2387 int Player::GetBaseSpeed() | |
2388 { | |
2389 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2390 } | |
2391 | |
2392 //----- (0048C8DF) -------------------------------------------------------- | |
2393 int Player::GetBaseLuck() | |
2394 { | |
2395 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2396 } | |
2397 | |
2398 //----- (0048C8F6) -------------------------------------------------------- | |
2399 int Player::GetBaseLevel() | |
2400 { | |
2401 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2402 } | |
2403 | |
2404 //----- (0048C90D) -------------------------------------------------------- | |
2405 int Player::GetActualLevel() | |
2406 { | |
2407 return uLevel + sLevelModifier + | |
2408 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2409 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2410 } | |
2411 | |
2412 //----- (0048C93C) -------------------------------------------------------- | |
2413 int Player::GetActualMight() | |
2414 { | |
2415 Player *v1; // esi@1 | |
2416 unsigned int v2; // eax@1 | |
2417 signed int v3; // ecx@1 | |
2418 signed int v4; // ebx@4 | |
2419 int v5; // edi@5 | |
2420 int v6; // ST14_4@5 | |
2421 | |
2422 v1 = this; | |
2423 v2 = this->sAgeModifier + GetBaseAge(); | |
2424 v3 = 0; | |
2425 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2426 { | |
2427 ++v3; | |
2428 if ( v3 >= 4 ) | |
2429 { | |
2430 v4 = 100; | |
2431 goto LABEL_5; | |
2432 } | |
2433 } | |
2434 v4 = pAgeingStrengthMultiplier[v3]; | |
2435 LABEL_5: | |
2436 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2437 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2438 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2439 } | |
2440 | |
2441 //----- (0048C9C2) -------------------------------------------------------- | |
2442 int Player::GetActualIntelligence() | |
2443 { | |
2444 Player *v1; // esi@1 | |
2445 unsigned int sAge; // eax@1 | |
2446 signed int uAgeLevel; // ecx@1 | |
2447 signed int v4; // ebx@4 | |
2448 int v5; // edi@5 | |
2449 int v6; // ebp@5 | |
2450 | |
2451 v1 = this; | |
2452 sAge = this->sAgeModifier + GetBaseAge(); | |
2453 uAgeLevel = 0; | |
2454 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2455 { | |
2456 ++uAgeLevel; | |
2457 if ( uAgeLevel >= 4 ) | |
2458 { | |
2459 v4 = 100; | |
2460 goto LABEL_5; | |
2461 } | |
2462 } | |
2463 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2464 LABEL_5: | |
2465 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2466 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2467 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2468 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2469 + v6 | |
2470 + v1->uIntelligenceBonus; | |
2471 } | |
2472 | |
2473 //----- (0048CA3F) -------------------------------------------------------- | |
2474 int Player::GetActualWillpower() | |
2475 { | |
2476 int v5; // edi@5 | |
2477 | |
2478 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2479 uint uAgeingMultiplier = 100; | |
2480 for (uint i = 0; i < 4; ++i) | |
2481 if (uActualAge >= pAgeingTable[i]) | |
2482 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2483 else break; | |
2484 | |
2485 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2486 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2487 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2488 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2489 + uWillpowerBonus; | |
2490 } | |
2491 | |
2492 //----- (0048CABC) -------------------------------------------------------- | |
2493 int Player::GetActualEndurance() | |
2494 { | |
2495 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2496 uint uAgeingMultiplier = 100; | |
2497 for (uint i = 0; i < 4; ++i) | |
2498 if (uActualAge >= pAgeingTable[i]) | |
2499 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2500 else break; | |
2501 | |
2502 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2503 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2504 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2505 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2506 + uItemBonus | |
2507 + uEnduranceBonus; | |
2508 } | |
2509 | |
2510 //----- (0048CB39) -------------------------------------------------------- | |
2511 int Player::GetActualAccuracy() | |
2512 { | |
2513 Player *v1; // esi@1 | |
2514 unsigned int v2; // eax@1 | |
2515 signed int v3; // ecx@1 | |
2516 signed int v4; // ebx@4 | |
2517 int v5; // edi@5 | |
2518 int v6; // ebp@5 | |
2519 | |
2520 v1 = this; | |
2521 v2 = this->sAgeModifier + GetBaseAge(); | |
2522 v3 = 0; | |
2523 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2524 { | |
2525 ++v3; | |
2526 if ( v3 >= 4 ) | |
2527 { | |
2528 v4 = 100; | |
2529 goto LABEL_5; | |
2530 } | |
2531 } | |
2532 v4 = pAgeingAccuracyMultiplier[v3]; | |
2533 LABEL_5: | |
2534 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2535 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2536 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2537 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2538 + v6 | |
2539 + v1->uAccuracyBonus; | |
2540 } | |
2541 | |
2542 //----- (0048CBB6) -------------------------------------------------------- | |
2543 int Player::GetActualSpeed() | |
2544 { | |
2545 Player *v1; // esi@1 | |
2546 unsigned int v2; // eax@1 | |
2547 signed int v3; // ecx@1 | |
2548 signed int v4; // ebx@4 | |
2549 int v5; // edi@5 | |
2550 int v6; // ebp@5 | |
2551 | |
2552 v1 = this; | |
2553 v2 = this->sAgeModifier + GetBaseAge(); | |
2554 v3 = 0; | |
2555 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2556 { | |
2557 ++v3; | |
2558 if ( v3 >= 4 ) | |
2559 { | |
2560 v4 = 100; | |
2561 goto LABEL_5; | |
2562 } | |
2563 } | |
2564 v4 = pAgeingSpeedMultiplier[v3]; | |
2565 LABEL_5: | |
2566 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2567 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2568 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2569 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2570 + v6 | |
2571 + v1->uSpeedBonus; | |
2572 } | |
2573 | |
2574 //----- (0048CC33) -------------------------------------------------------- | |
2575 int Player::GetActualLuck() | |
2576 { | |
2577 Player *v1; // esi@1 | |
2578 unsigned int v2; // eax@7 | |
2579 signed int v3; // ecx@7 | |
2580 signed int v4; // ebx@10 | |
2581 int v5; // edi@11 | |
2582 int v6; // ebp@11 | |
2583 signed int v8; // [sp+10h] [bp-4h]@1 | |
2584 | |
2585 v8 = 0; | |
2586 v1 = this; | |
652 | 2587 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2588 v8 = 5; |
652 | 2589 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2590 v8 += 20; |
652 | 2591 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2592 v8 += 10; |
2593 v2 = v1->sAgeModifier + GetBaseAge(); | |
2594 v3 = 0; | |
2595 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2596 { | |
2597 ++v3; | |
2598 if ( v3 >= 4 ) | |
2599 { | |
2600 v4 = 100; | |
2601 goto LABEL_11; | |
2602 } | |
2603 } | |
2604 v4 = pAgeingLuckMultiplier[v3]; | |
2605 LABEL_11: | |
2606 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2607 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2608 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2609 + v6 | |
2610 + v8 | |
2611 + v5 * v4 * v1->uLuck / 100 / 100 | |
2612 + v1->uLuckBonus; | |
2613 } | |
2614 | |
2615 //----- (0048CCF5) -------------------------------------------------------- | |
2616 int Player::GetActualAttack(int a2) | |
2617 { | |
2618 Player *v2; // esi@1 | |
2619 int v3; // eax@1 | |
2620 int v4; // edi@1 | |
2621 int v5; // ebx@1 | |
2622 int v6; // ebp@1 | |
2623 | |
2624 v2 = this; | |
2625 v3 = GetActualAccuracy(); | |
2626 v4 = _48EA1B_get_static_effect(v3); | |
2627 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2628 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2629 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2630 } | |
2631 | |
2632 //----- (0048CD45) -------------------------------------------------------- | |
2633 int Player::GetMeleeDamageMinimal() | |
2634 { | |
2635 Player *v1; // edi@1 | |
2636 int v2; // eax@1 | |
2637 int v3; // esi@1 | |
2638 int v4; // esi@1 | |
2639 int v5; // esi@1 | |
2640 int v6; // esi@1 | |
2641 signed int result; // eax@1 | |
2642 | |
2643 v1 = this; | |
2644 v2 = GetActualMight(); | |
2645 v3 = _48EA1B_get_static_effect(v2); | |
2646 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2647 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2648 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2649 result = 1; | |
2650 if ( v6 >= 1 ) | |
2651 result = v6; | |
2652 return result; | |
2653 } | |
2654 | |
2655 //----- (0048CD90) -------------------------------------------------------- | |
2656 int Player::GetMeleeDamageMaximal() | |
2657 { | |
2658 Player *v1; // edi@1 | |
2659 int v2; // eax@1 | |
2660 int v3; // esi@1 | |
2661 int v4; // esi@1 | |
2662 int v5; // esi@1 | |
2663 int v6; // esi@1 | |
2664 signed int result; // eax@1 | |
2665 | |
2666 v1 = this; | |
2667 v2 = GetActualMight(); | |
2668 v3 = _48EA1B_get_static_effect(v2); | |
2669 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2670 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2671 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2672 result = 1; | |
2673 if ( v6 >= 1 ) | |
2674 result = v6; | |
2675 return result; | |
2676 } | |
2677 | |
2678 //----- (0048CDDB) -------------------------------------------------------- | |
2679 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2680 { | |
2681 int v4; // esi@1 | |
2682 Player *v5; // edi@1 | |
2683 ItemGen *v6; // ebx@4 | |
2684 unsigned int v7; // ebp@4 | |
2685 unsigned int v8; // esi@4 | |
2686 int v9; // eax@4 | |
2687 int v10; // eax@9 | |
2688 char v11; // zf@9 | |
2689 int v12; // esi@10 | |
2690 int v13; // eax@11 | |
2691 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2692 ItemGen *v15; // ebx@35 | |
2693 unsigned int v16; // ebp@35 | |
2694 unsigned int v17; // esi@35 | |
2695 int v18; // edx@38 | |
2696 int v19; // eax@40 | |
2697 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2698 int v21; // esi@62 | |
2699 int v22; // eax@63 | |
2700 int v23; // ebx@63 | |
2701 int v24; // ebx@63 | |
2702 signed int result; // eax@64 | |
2703 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2704 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2705 int v28; // [sp+10h] [bp-10h]@1 | |
2706 int v29; // [sp+10h] [bp-10h]@33 | |
2707 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2708 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2709 int v32; // [sp+18h] [bp-8h]@1 | |
2710 int v33; // [sp+18h] [bp-8h]@8 | |
2711 int v34; // [sp+1Ch] [bp-4h]@1 | |
2712 int v35; // [sp+28h] [bp+8h]@37 | |
2713 | |
2714 v4 = 0; | |
2715 v5 = this; | |
2716 v34 = 0; | |
2717 v32 = 0; | |
2718 v28 = 0; | |
2719 if ( IsUnarmed() == 1 ) | |
2720 { | |
2721 v32 = rand() % 3 + 1; | |
2722 LABEL_61: | |
2723 v34 = v4; | |
2724 goto LABEL_62; | |
2725 } | |
816 | 2726 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2727 { |
232 | 2728 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2729 v7 = v6->uItemID; |
2730 v8 = v6->uItemID; | |
2731 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2732 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2733 ++v9; |
2734 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2735 if ( v9 > 0 ) | |
2736 { | |
2737 v33 = v9; | |
2738 do | |
2739 { | |
2740 v10 = rand(); | |
2741 v11 = v33-- == 1; | |
2742 v28 += v10 % v30 + 1; | |
2743 } | |
2744 while ( !v11 ); | |
2745 } | |
2746 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2747 if ( !uTargetActorID ) | |
2748 goto LABEL_28; | |
377 | 2749 v13 = v6->uSpecEnchantmentType; |
0 | 2750 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2751 { | |
2752 v14 = (MONSTER_SUPERTYPE)1; | |
2753 } | |
2754 else | |
2755 { | |
2756 if ( v13 == 39 ) | |
2757 { | |
2758 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2759 } | |
2760 else | |
2761 { | |
2762 if ( v13 == 40 ) | |
2763 { | |
2764 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2765 } | |
2766 else | |
2767 { | |
2768 if ( v13 == 63 || v7 == 517 ) | |
2769 { | |
2770 v26 = MONSTER_SUPERTYPE_ELF; | |
2771 } | |
2772 else | |
2773 { | |
2774 if ( v13 != 65 ) | |
2775 { | |
2776 LABEL_28: | |
2777 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2778 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2779 && rand() % 100 < 10 ) | |
2780 v12 *= 3; | |
2781 v32 = v12; | |
2782 goto LABEL_33; | |
2783 } | |
2784 v26 = MONSTER_SUPERTYPE_TITAN; | |
2785 } | |
2786 } | |
2787 } | |
2788 v14 = v26; | |
2789 } | |
2790 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2791 v12 *= 2; | |
2792 goto LABEL_28; | |
2793 } | |
2794 LABEL_33: | |
2795 v29 = 0; | |
2796 if ( !a3 ) | |
2797 { | |
2798 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2799 { | |
898 | 2800 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2801 v16 = v15->uItemID; |
2802 v17 = v15->uItemID; | |
2803 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2804 { | |
2805 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2806 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2807 { | |
2808 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2809 do | |
2810 { | |
2811 v18 = rand() % v31; | |
2812 v11 = v35-- == 1; | |
2813 v29 += v18 + 1; | |
2814 } | |
2815 while ( !v11 ); | |
2816 } | |
2817 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2818 if ( !uTargetActorID ) | |
2819 goto LABEL_57; | |
377 | 2820 v19 = v15->uSpecEnchantmentType; |
0 | 2821 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2822 { | |
2823 v20 = (MONSTER_SUPERTYPE)1; | |
2824 } | |
2825 else | |
2826 { | |
2827 if ( v19 == 39 ) | |
2828 { | |
2829 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2830 } | |
2831 else | |
2832 { | |
2833 if ( v19 == 40 ) | |
2834 { | |
2835 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2836 } | |
2837 else | |
2838 { | |
2839 if ( v19 == 63 || v16 == 517 ) | |
2840 { | |
2841 v27 = MONSTER_SUPERTYPE_ELF; | |
2842 } | |
2843 else | |
2844 { | |
2845 if ( v19 != 65 ) | |
2846 { | |
2847 LABEL_57: | |
2848 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2849 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2850 && rand() % 100 < 10 ) | |
2851 v4 *= 3; | |
2852 goto LABEL_61; | |
2853 } | |
2854 v27 = MONSTER_SUPERTYPE_TITAN; | |
2855 } | |
2856 } | |
2857 } | |
2858 v20 = v27; | |
2859 } | |
2860 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2861 v4 *= 2; | |
2862 goto LABEL_57; | |
2863 } | |
2864 } | |
2865 } | |
2866 LABEL_62: | |
2867 v21 = v32 + v34; | |
2868 if ( !a2 ) | |
2869 { | |
2870 v22 = GetActualMight(); | |
2871 v23 = _48EA1B_get_static_effect(v22); | |
2872 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2873 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2874 } | |
2875 result = 1; | |
2876 if ( v21 >= 1 ) | |
2877 result = v21; | |
2878 return result; | |
2879 } | |
2880 | |
2881 //----- (0048D0B9) -------------------------------------------------------- | |
2882 int Player::GetRangedAttack() | |
2883 { | |
2884 Player *v1; // esi@1 | |
2885 int v2; // eax@1 | |
2886 int v3; // edi@3 | |
2887 int v4; // eax@4 | |
2888 int v5; // edi@4 | |
2889 int v6; // edi@4 | |
2890 int v7; // edi@4 | |
2891 | |
2892 v1 = this; | |
232 | 2893 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2894 if ( v2 < 64 || v2 > 65 ) |
2895 { | |
2896 v4 = GetActualAccuracy(); | |
2897 v5 = _48EA1B_get_static_effect(v4); | |
2898 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2899 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2900 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2901 } | |
2902 else | |
2903 { | |
2904 v3 = GetActualAttack(1); | |
2905 } | |
2906 return v3; | |
2907 } | |
2908 | |
2909 //----- (0048D124) -------------------------------------------------------- | |
2910 int Player::GetRangedDamageMin() | |
2911 { | |
2912 Player *v1; // esi@1 | |
2913 int v2; // edi@1 | |
2914 int v3; // edi@1 | |
2915 int v4; // edi@1 | |
2916 unsigned __int16 v5; // ax@1 | |
2917 int result; // eax@6 | |
2918 | |
2919 v1 = this; | |
2920 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2921 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2922 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2923 v5 = v1->pActiveSkills[5]; | |
2924 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2925 v4 += v1->pActiveSkills[5] & 0x3F; | |
2926 if ( v4 >= 1 ) | |
2927 result = v4; | |
2928 else | |
2929 result = 0; | |
2930 return result; | |
2931 } | |
2932 | |
2933 //----- (0048D191) -------------------------------------------------------- | |
2934 int Player::GetRangedDamageMax() | |
2935 { | |
2936 Player *v1; // esi@1 | |
2937 int v2; // edi@1 | |
2938 int v3; // edi@1 | |
2939 int v4; // edi@1 | |
2940 unsigned __int16 v5; // ax@1 | |
2941 int result; // eax@6 | |
2942 | |
2943 v1 = this; | |
2944 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
2945 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2946 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2947 v5 = v1->pActiveSkills[5]; | |
2948 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2949 v4 += v1->pActiveSkills[5] & 0x3F; | |
2950 if ( v4 >= 1 ) | |
2951 result = v4; | |
2952 else | |
2953 result = 0; | |
2954 return result; | |
2955 } | |
2956 | |
2957 //----- (0048D1FE) -------------------------------------------------------- | |
2958 bool Player::CalculateRangedDamageTo(int a2) | |
2959 { | |
2960 Player *v2; // ebx@1 | |
2961 bool result; // eax@1 | |
2962 ItemGen *v4; // ebx@2 | |
2963 unsigned int v5; // edi@2 | |
2964 unsigned int v6; // esi@2 | |
2965 int v7; // edx@4 | |
2966 char v8; // zf@4 | |
2967 int v9; // esi@5 | |
2968 int v10; // ebx@6 | |
2969 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2970 unsigned __int16 v12; // ax@19 | |
2971 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2972 Player *v14; // [sp+4h] [bp-10h]@1 | |
2973 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2974 int v16; // [sp+Ch] [bp-8h]@3 | |
2975 int v17; // [sp+10h] [bp-4h]@1 | |
2976 | |
2977 v17 = 0; | |
2978 v2 = this; | |
2979 v14 = this; | |
2980 result = HasItemEquipped(EQUIP_BOW); | |
2981 if ( !result ) | |
2982 return result; | |
232 | 2983 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2984 v5 = v4->uItemID; |
2985 v6 = v4->uItemID; | |
2986 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2987 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2988 { | |
2989 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2990 do | |
2991 { | |
2992 v7 = rand() % v15; | |
2993 v8 = v16-- == 1; | |
2994 v17 += v7 + 1; | |
2995 } | |
2996 while ( !v8 ); | |
2997 } | |
2998 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2999 if ( a2 ) | |
3000 { | |
377 | 3001 v10 = v4->uSpecEnchantmentType; |
0 | 3002 if ( v10 == 64 ) |
3003 { | |
3004 v11 = (MONSTER_SUPERTYPE)1; | |
3005 goto LABEL_17; | |
3006 } | |
3007 if ( v10 == 39 || v5 == 508 ) | |
3008 { | |
3009 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3010 goto LABEL_16; | |
3011 } | |
3012 if ( v10 == 40 ) | |
3013 { | |
3014 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3015 goto LABEL_16; | |
3016 } | |
3017 if ( v10 == 63 || v5 == 517 ) | |
3018 { | |
3019 v13 = MONSTER_SUPERTYPE_ELF; | |
3020 LABEL_16: | |
3021 v11 = v13; | |
3022 LABEL_17: | |
3023 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3024 v9 *= 2; | |
3025 goto LABEL_19; | |
3026 } | |
3027 } | |
3028 LABEL_19: | |
3029 v12 = v14->pActiveSkills[5]; | |
3030 if ( v12 ) | |
3031 { | |
3032 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3033 v9 += v14->pActiveSkills[5] & 0x3F; | |
3034 } | |
3035 return v9; | |
3036 } | |
3037 | |
3038 //----- (0048D2EA) -------------------------------------------------------- | |
3039 char *Player::GetMeleeDamageString() | |
3040 { | |
3041 Player *v1; // esi@1 | |
3042 signed int v2; // eax@1 | |
3043 signed int v3; // edi@3 | |
3044 signed int v4; // eax@3 | |
3045 signed int v5; // ST0C_4@6 | |
3046 char *v6; // edi@6 | |
3047 signed int v7; // ST08_4@7 | |
3048 unsigned int v8; // eax@8 | |
3049 signed int v9; // esi@9 | |
3050 | |
3051 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3052 | |
3053 v1 = this; | |
232 | 3054 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3055 if ( v2 < 64 || v2 > 65 ) |
3056 { | |
3057 v3 = GetMeleeDamageMinimal(); | |
3058 v4 = GetMeleeDamageMaximal(); | |
3059 } | |
3060 else | |
3061 { | |
3062 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3063 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3064 } | |
3065 if ( v3 == v4 ) | |
3066 { | |
3067 v5 = v3; | |
3068 v6 = player__getmeleedamagestring_static_buff; | |
3069 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3070 } | |
3071 else | |
3072 { | |
3073 v7 = v3; | |
3074 v6 = player__getmeleedamagestring_static_buff; | |
3075 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3076 } | |
3077 v8 = v1->pEquipment.uMainHand; | |
3078 if ( v8 ) | |
3079 { | |
232 | 3080 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3081 if ( v9 >= 135 ) |
3082 { | |
3083 if ( v9 <= 159 ) | |
3084 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3085 } | |
3086 } | |
3087 return v6; | |
3088 } | |
3089 | |
3090 //----- (0048D396) -------------------------------------------------------- | |
3091 char *Player::GetRangedDamageString() | |
3092 { | |
3093 Player *v1; // esi@1 | |
3094 signed int v2; // eax@1 | |
3095 int v3; // edi@3 | |
3096 int v4; // eax@3 | |
3097 char *v5; // edi@6 | |
3098 int v6; // ST0C_4@8 | |
3099 int v7; // ST08_4@9 | |
3100 unsigned int v8; // eax@10 | |
3101 signed int v9; // esi@11 | |
3102 | |
3103 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3104 | |
3105 v1 = this; | |
232 | 3106 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3107 if ( v2 < 64 || v2 > 65 ) |
3108 { | |
3109 v3 = GetRangedDamageMin(); | |
3110 v4 = GetRangedDamageMax(); | |
3111 } | |
3112 else | |
3113 { | |
3114 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3115 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3116 } | |
3117 if ( v4 ) | |
3118 { | |
3119 if ( v3 == v4 ) | |
3120 { | |
3121 v6 = v3; | |
3122 v5 = player__getrangeddamagestring_static_buff; | |
3123 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3124 } | |
3125 else | |
3126 { | |
3127 v7 = v3; | |
3128 v5 = player__getrangeddamagestring_static_buff; | |
3129 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3130 } | |
3131 } | |
3132 else | |
3133 { | |
3134 v5 = player__getrangeddamagestring_static_buff; | |
3135 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3136 } | |
3137 v8 = v1->pEquipment.uMainHand; | |
3138 if ( v8 ) | |
3139 { | |
232 | 3140 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3141 if ( v9 >= 135 ) |
3142 { | |
3143 if ( v9 <= 159 ) | |
3144 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3145 } | |
3146 } | |
3147 return v5; | |
3148 } | |
3149 | |
3150 //----- (0048D45A) -------------------------------------------------------- | |
3151 bool Player::CanTrainToNextLevel() | |
3152 { | |
3153 int v1; // edx@1 | |
3154 int v2; // eax@1 | |
3155 int i; // esi@1 | |
3156 | |
3157 v1 = this->uLevel; | |
3158 v2 = 0; | |
3159 for ( i = 0; i < v1; ++i ) | |
3160 v2 += i + 1; | |
3161 return (signed __int64)this->uExperience >= 1000 * v2; | |
3162 } | |
3163 | |
3164 //----- (0048D498) -------------------------------------------------------- | |
3165 unsigned int Player::GetExperienceDisplayColor() | |
3166 { | |
3167 unsigned int result; // eax@2 | |
3168 | |
3169 if ( CanTrainToNextLevel() ) | |
995 | 3170 result = ui_character_bonus_text_color; |
0 | 3171 else |
995 | 3172 result = ui_character_default_text_color; |
0 | 3173 return result; |
3174 } | |
3175 | |
3176 //----- (0048D4B3) -------------------------------------------------------- | |
3177 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3178 { | |
3179 Player *v3; // esi@1 | |
3180 int v4; // edi@8 | |
3181 int v6; // eax@21 | |
3182 signed int v7; // ebx@21 | |
3183 int v8; // eax@22 | |
3184 signed int v9; // ebx@22 | |
3185 int v10; // eax@23 | |
3186 signed int v11; // ebx@23 | |
3187 int v12; // eax@24 | |
3188 signed int v13; // edi@24 | |
3189 unsigned int v14; // eax@27 | |
3190 int v15; // eax@29 | |
3191 double v16; // st7@32 | |
3192 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3193 signed int v18; // [sp+8h] [bp-4h]@17 | |
3194 | |
3195 v3 = this; | |
3196 if ( !resistance ) | |
3197 { | |
3198 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3199 goto LABEL_16; | |
3200 } | |
3201 if ( resistance == 1 ) | |
3202 { | |
3203 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3204 goto LABEL_16; | |
3205 } | |
3206 if ( resistance == 2 ) | |
3207 { | |
3208 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3209 goto LABEL_16; | |
3210 } | |
3211 if ( resistance == 3 ) | |
3212 { | |
3213 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3214 goto LABEL_16; | |
3215 } | |
3216 if ( resistance == 6 ) | |
3217 { | |
3218 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3219 goto LABEL_16; | |
3220 } | |
3221 if ( resistance == 7 ) | |
3222 { | |
3223 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3224 goto LABEL_16; | |
3225 } | |
3226 if ( resistance == 8 ) | |
3227 { | |
3228 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3229 LABEL_16: | |
3230 v4 = GetActualResistance(v17); | |
3231 goto LABEL_17; | |
3232 } | |
3233 v4 = 0; | |
3234 LABEL_17: | |
3235 v18 = type; | |
135 | 3236 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3237 return 0; |
3238 if ( v4 ) | |
3239 { | |
3240 v6 = GetActualLuck(); | |
3241 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3242 if ( rand() % v7 >= 30 ) | |
3243 { | |
3244 v18 = type >> 1; | |
3245 v8 = GetActualLuck(); | |
3246 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3247 if ( rand() % v9 >= 30 ) | |
3248 { | |
3249 v18 = type >> 2; | |
3250 v10 = GetActualLuck(); | |
3251 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3252 if ( rand() % v11 >= 30 ) | |
3253 { | |
3254 v18 = type >> 3; | |
3255 v12 = GetActualLuck(); | |
3256 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3257 if ( rand() % v13 >= 30 ) | |
3258 v18 = type >> 4; | |
3259 } | |
3260 } | |
3261 } | |
3262 } | |
3263 if ( resistance == 4 ) | |
3264 { | |
898 | 3265 v14 = v3->pEquipment.uArmor; |
0 | 3266 if ( v14 ) |
3267 { | |
1019 | 3268 // if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) |
3269 if (v3->pOwnItems[v14-1].uAttributes&2) | |
0 | 3270 { |
3271 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3272 if ( v15 ) | |
3273 { | |
3274 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3275 return v18; | |
3276 v16 = (double)v18 * 0.5; | |
3277 return (signed __int64)v16; | |
3278 } | |
3279 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3280 { | |
3281 v16 = (double)v18 * 0.66670001; | |
3282 return (signed __int64)v16; | |
3283 } | |
3284 } | |
3285 } | |
3286 } | |
3287 return v18; | |
3288 } | |
3289 | |
3290 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3291 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3292 { | |
3293 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3294 } |
3295 | |
3296 //----- (0048D651) -------------------------------------------------------- | |
816 | 3297 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3298 { | |
3299 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3300 } |
3301 | |
3302 //----- (0048D676) -------------------------------------------------------- | |
3303 bool Player::IsUnarmed() | |
3304 { | |
816 | 3305 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3306 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3307 } |
3308 | |
3309 //----- (0048D6AA) -------------------------------------------------------- | |
3310 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3311 { | |
3312 auto i = pEquipment.pIndices[uEquipIndex]; | |
3313 if (i) | |
3314 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3315 else return false; | |
3316 } | |
3317 | |
3318 //----- (0048D6D0) -------------------------------------------------------- | |
3319 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3320 { | |
3321 for (uint i = 0; i < 16; ++i) | |
3322 { | |
3323 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3324 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3325 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3326 return true; | |
3327 } | |
3328 return false; | |
3329 } | |
3330 | |
3331 //----- (0048D709) -------------------------------------------------------- | |
3332 bool Player::WearsItem(int a1, signed int a2) | |
3333 { | |
1010 | 3334 |
0 | 3335 int v6; // esi@5 |
3336 | |
3337 if ( a2 >= 16 ) | |
3338 { | |
3339 v6 = 0; | |
3340 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3341 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3342 { |
3343 ++v6; | |
3344 if ( (signed int)v6 >= 16 ) | |
3345 return 0; | |
3346 } | |
3347 return 1; | |
3348 } | |
727 | 3349 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3350 return 1; |
3351 return 0; | |
3352 } | |
3353 | |
3354 //----- (0048D76C) -------------------------------------------------------- | |
3355 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3356 { | |
3357 unsigned __int16 v6; // cx@8 | |
3358 int v7; // edi@8 | |
3359 unsigned int v8; // ebx@8 | |
3360 unsigned int v9; // esi@8 | |
3361 int v10; // eax@8 | |
3362 int v11; // edi@12 | |
3363 bool result; // eax@13 | |
3364 | |
3365 if ( !a2 | |
3366 || this->pConditions[16] | |
3367 || this->pConditions[14] | |
3368 || this->pConditions[15] | |
3369 || this->pConditions[4] | |
3370 || this->pConditions[13] | |
3371 || this->pConditions[2] ) | |
3372 { | |
3373 result = 0; | |
3374 } | |
3375 else | |
3376 { | |
3377 v6 = this->pActiveSkills[34]; | |
3378 v7 = v6 & 0x3F; | |
3379 v8 = SkillToMastery(v6); | |
3380 v9 = a2->GetValue(); | |
3381 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3382 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3383 v9 *= 3; | |
3384 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3385 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3386 if ( rand() % 100 >= 5 ) | |
3387 { | |
3388 if ( *a6 > v11 ) | |
3389 result = *a6 - v11 < 500; | |
3390 else | |
3391 result = 2; | |
3392 } | |
3393 else | |
3394 { | |
3395 result = 0; | |
3396 } | |
3397 } | |
3398 return result; | |
3399 } | |
3400 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3401 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3402 | |
3403 //----- (0048D88B) -------------------------------------------------------- | |
3404 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3405 { | |
3406 Player *v4; // esi@1 | |
3407 Actor *v5; // edi@1 | |
3408 unsigned __int16 v6; // cx@10 | |
3409 int v7; // ebx@10 | |
3410 unsigned int v8; // esi@10 | |
3411 int v9; // eax@10 | |
3412 int v10; // esi@10 | |
3413 int v11; // eax@13 | |
3414 signed int v12; // ebx@15 | |
3415 signed int v13; // edx@15 | |
3416 int v14; // ecx@15 | |
3417 unsigned __int16 v15; // si@21 | |
3418 unsigned int v16; // ebx@24 | |
3419 int v17; // esi@24 | |
3420 const void *v18; // eax@29 | |
3421 unsigned int v19; // esi@31 | |
3422 int v20; // eax@34 | |
3423 char v21; // zf@36 | |
3424 unsigned int v22; // ST0C_4@39 | |
3425 char *v23; // esi@39 | |
3426 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3427 int v26; // [sp-8h] [bp-44h]@40 | |
3428 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3429 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3430 int v29; // [sp+30h] [bp-Ch]@10 | |
3431 int v30; // [sp+34h] [bp-8h]@10 | |
3432 Player *v31; // [sp+38h] [bp-4h]@1 | |
3433 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3434 | |
3435 v4 = this; | |
3436 v5 = &pActors[uActorID]; | |
3437 v31 = this; | |
3438 if ( &pActors[uActorID] | |
3439 && !this->pConditions[16] | |
3440 && !this->pConditions[14] | |
3441 && !this->pConditions[15] | |
3442 && !this->pConditions[4] | |
3443 && !this->pConditions[13] | |
3444 && !this->pConditions[2] ) | |
3445 { | |
3446 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3447 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3448 v6 = v4->pActiveSkills[34]; | |
3449 v7 = v6 & 0x3F; | |
3450 v8 = SkillToMastery(v6); | |
3451 v9 = rand(); | |
3452 v28 = 4 * v8; | |
3453 v30 = dword_4EDEA0[v8]; | |
3454 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3455 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3456 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3457 { | |
322 | 3458 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3459 _steal_perma = 0; |
3460 v26 = (int)v31->pName; | |
3461 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3462 } | |
3463 else | |
3464 { | |
3465 v11 = rand(); | |
3466 if ( v11 % 100 >= 40 ) | |
3467 { | |
3468 if ( v11 % 100 >= 70 ) | |
3469 { | |
3470 v19 = 0; | |
3471 if ( v7 > 0 ) | |
3472 { | |
3473 do | |
3474 { | |
3475 --v7; | |
3476 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3477 } | |
3478 while ( v7 ); | |
3479 } | |
3480 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3481 return _steal_perma; | |
377 | 3482 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3483 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3484 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3485 v21 = *(int *)v20 == v19; |
3486 *(int *)v20 -= v19; | |
3487 if ( v21 ) | |
3488 v5->array_000234[3].uItemID = 0; | |
3489 if ( v19 ) | |
3490 { | |
3491 party_finds_gold(v19, 2); | |
3492 v22 = v19; | |
3493 v23 = pTmpBuf2; | |
3494 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3495 LABEL_43: | |
3496 ShowStatusBarString(v23, 2u); | |
3497 return _steal_perma; | |
3498 } | |
3499 } | |
3500 else | |
3501 { | |
3502 v27.Reset(); | |
3503 v12 = 0; | |
3504 v13 = 0; | |
3505 v14 = (int)v5->array_000234; | |
3506 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3507 { | |
3508 ++v13; | |
3509 v14 += 36; | |
3510 if ( v13 >= 4 ) | |
3511 goto LABEL_21; | |
3512 } | |
3513 v12 = 1; | |
3514 LABEL_21: | |
3515 v15 = v5->uCarriedItemID; | |
3516 if ( v15 || v12 ) | |
3517 { | |
3518 v27.Reset(); | |
3519 if ( v15 ) | |
3520 { | |
3521 v16 = (signed __int16)v15; | |
3522 v5->uCarriedItemID = 0; | |
3523 v27.uItemID = (signed __int16)v15; | |
3524 v17 = (signed __int16)v15; | |
3525 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3526 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3527 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3528 { | |
3529 if ( v16 != 220 ) | |
570 | 3530 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3531 } |
3532 } | |
3533 else | |
3534 { | |
3535 v18 = &v5->array_000234[rand() % 4]; | |
3536 memcpy(&v27, v18, sizeof(v27)); | |
3537 ((ItemGen *)v18)->Reset(); | |
3538 v16 = v27.uItemID; | |
3539 } | |
3540 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3541 sprintf( | |
3542 pTmpBuf2, | |
3543 pGlobalTXT_LocalizationStrings[304], | |
3544 v31->pName, | |
3545 pItemsTable->pItems[v16].pUnidentifiedName); | |
3546 ShowStatusBarString(pTmpBuf2, 2u); | |
3547 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3548 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3549 pMouse->SetCursorBitmapFromItemID(v16); | |
3550 return _steal_perma; | |
3551 } | |
3552 } | |
3553 } | |
3554 v26 = (int)v31->pName; | |
3555 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3556 } | |
3557 v23 = pTmpBuf2; | |
809 | 3558 sprintfex(pTmpBuf2, v25, v26); |
0 | 3559 goto LABEL_43; |
3560 } | |
3561 return 0; | |
3562 } | |
3563 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3564 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3565 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3566 | |
3567 //----- (0048DBB9) -------------------------------------------------------- | |
3568 void Player::Heal(int amount) | |
3569 { | |
1010 | 3570 signed int max_health; // eax@3 |
3571 | |
3572 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3573 { | |
3574 max_health = GetMaxHealth(); | |
3575 if ( pConditions[Condition_Zombie] ) | |
3576 max_health /= 2; | |
3577 sHealth += amount; | |
3578 if ( sHealth > max_health ) | |
3579 sHealth = max_health; | |
3580 if ( pConditions[Condition_Unconcious] ) | |
3581 { | |
3582 if ( sHealth > 0 ) | |
3583 { | |
3584 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3585 } |
3586 } | |
3587 } | |
3588 } | |
3589 | |
3590 //----- (0048DC1E) -------------------------------------------------------- | |
3591 int Player::ReceiveDamage(signed int type, int resistance) | |
3592 { | |
3593 Player *v3; // esi@1 | |
3594 signed int v4; // eax@1 | |
3595 int v5; // eax@1 | |
3596 bool v6; // ebx@1 | |
3597 unsigned int v7; // eax@8 | |
3598 char *v8; // ecx@9 | |
3599 int v9; // eax@9 | |
187 | 3600 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3601 |
3602 v3 = this; | |
1010 | 3603 this->pConditions[Condition_Sleep] = 0i64; |
0 | 3604 v4 = CalculateIncommingDamage(resistance, type); |
3605 v3->sHealth -= v4; | |
187 | 3606 //typea = v4; |
0 | 3607 v5 = v3->sHealth; |
3608 v6 = v5 < -10; | |
3609 LOBYTE(v6) = v5 <= -10; | |
3610 if ( v5 < 1 ) | |
3611 { | |
3612 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
1010 | 3613 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
0 | 3614 { |
1019 | 3615 SetCondition(Condition_Unconcious, 0); |
0 | 3616 } |
3617 else | |
3618 { | |
1019 | 3619 SetCondition(Condition_Dead, 0); |
0 | 3620 v6 = LODWORD(pParty->uTimePlayed); |
3621 if ( v3->sHealth > 0 ) | |
3622 v3->sHealth = 0; | |
3623 } | |
3624 if ( v6 ) | |
3625 { | |
898 | 3626 v7 = v3->pEquipment.uArmor; |
0 | 3627 if ( v7 ) |
3628 { | |
1019 | 3629 // v8 = &v3->field_1F5[36 * v7 + 15]; |
3630 v8=(char*)&v3->pOwnItems[v7-1].uAttributes; | |
0 | 3631 v9 = *(int *)v8; |
3632 if ( !(BYTE1(v9) & 2) ) | |
3633 { | |
3634 LOBYTE(v9) = v9 | 2; | |
3635 *(int *)v8 = v9; | |
3636 } | |
3637 } | |
3638 } | |
3639 } | |
187 | 3640 if ( v4 && CanAct() ) |
3641 PlaySound(SPEECH_24, 0); | |
3642 return v4; | |
0 | 3643 } |
3644 | |
3645 //----- (0048DCF6) -------------------------------------------------------- | |
3646 int Player::_48DCF6(int a2, Actor *pActor) | |
3647 { | |
3648 signed int v3; // edi@1 | |
3649 signed int v4; // ebx@1 | |
3650 Player *v5; // esi@1 | |
3651 int v6; // eax@2 | |
3652 int v7; // eax@5 | |
3653 int v8; // eax@8 | |
3654 int v9; // ebx@8 | |
3655 int v10; // eax@8 | |
3656 int v11; // ebx@8 | |
3657 signed int v12; // edx@9 | |
3658 ItemGen *v13; // eax@9 | |
3659 int v14; // edx@16 | |
3660 unsigned int v15; // edx@17 | |
3661 int v16; // edx@26 | |
3662 unsigned int v17; // edx@27 | |
3663 signed int v19; // edx@38 | |
3664 int *v20; // ecx@38 | |
3665 signed int v21; // eax@40 | |
3666 int v22; // eax@49 | |
3667 signed int v23; // ebx@49 | |
3668 unsigned int v24; // eax@60 | |
3669 int v25; // ecx@61 | |
3670 int v26; // ebx@74 | |
3671 void *v27; // ecx@76 | |
3672 unsigned int v28; // ebx@78 | |
3673 signed int result; // eax@86 | |
3674 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3675 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3676 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3677 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3678 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3679 int v35; // [sp-Ch] [bp-ACh]@56 | |
3680 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3681 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3682 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3683 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3684 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3685 int v41; // [sp-4h] [bp-A4h]@51 | |
3686 int v42; // [sp-4h] [bp-A4h]@56 | |
3687 int v43; // [sp-4h] [bp-A4h]@57 | |
3688 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3689 int v45; // [sp-4h] [bp-A4h]@68 | |
3690 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3691 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3692 int v48; // [sp+9Ch] [bp-4h]@1 | |
3693 | |
3694 v3 = 0; | |
3695 v4 = 0; | |
3696 v5 = this; | |
3697 v47 = 0; | |
3698 v48 = 0; | |
3699 switch ( a2 ) | |
3700 { | |
3701 case 1: | |
3702 v6 = GetActualWillpower(); | |
3703 goto LABEL_46; | |
3704 case 2: | |
3705 case 3: | |
3706 case 4: | |
3707 case 9: | |
3708 case 10: | |
3709 case 11: | |
3710 case 13: | |
3711 case 21: | |
3712 v6 = GetActualEndurance(); | |
3713 goto LABEL_46; | |
3714 case 5: | |
3715 case 12: | |
3716 case 23: | |
3717 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3718 goto LABEL_5; | |
3719 case 15: | |
3720 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3721 goto LABEL_5; | |
3722 case 6: | |
3723 case 7: | |
3724 case 8: | |
3725 case 14: | |
3726 case 16: | |
3727 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3728 LABEL_5: | |
3729 v7 = GetActualResistance(v40); | |
3730 goto LABEL_47; | |
3731 case 22: | |
3732 v8 = GetActualWillpower(); | |
3733 v9 = _48EA1B_get_static_effect(v8); | |
3734 v10 = GetActualIntelligence(); | |
3735 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3736 break; | |
3737 case 17: | |
3738 v12 = 0; | |
3739 v13 = this->pInventoryItems; | |
3740 do | |
3741 { | |
315 | 3742 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3743 v46[v4++] = v12; |
3744 ++v12; | |
3745 ++v13; | |
3746 } | |
3747 while ( v12 < 138 ); | |
3748 goto LABEL_36; | |
3749 case 18: | |
3750 v14 = 0; | |
3751 do | |
3752 { | |
3753 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3754 { | |
816 | 3755 if ( v15 == EQUIP_ARMOUR ) |
898 | 3756 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3757 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3758 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3759 } |
3760 v14 = v15 + 1; | |
3761 } | |
3762 while ( v14 < 16 ); | |
3763 goto LABEL_36; | |
3764 case 19: | |
3765 v16 = 0; | |
3766 do | |
3767 { | |
3768 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3769 { | |
3770 if ( v17 == 2 ) | |
3771 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3772 if ( (!v17 || v17 == 1) | |
816 | 3773 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3774 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3775 } |
3776 v16 = v17 + 1; | |
3777 } | |
3778 while ( v16 < 16 ); | |
3779 LABEL_36: | |
3780 if ( !v4 ) | |
3781 goto LABEL_87; | |
3782 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3783 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3784 break; | |
3785 case 20: | |
3786 v19 = 0; | |
3787 v20 = this->pInventoryIndices; | |
3788 do | |
3789 { | |
3790 if ( *v20 > 0 ) | |
3791 { | |
232 | 3792 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3793 if ( v21 > 0 ) |
3794 { | |
3795 if ( v21 <= 134 ) | |
3796 v46[v4++] = v19; | |
3797 } | |
3798 } | |
3799 ++v19; | |
3800 ++v20; | |
3801 } | |
3802 while ( v19 < 126 ); | |
3803 if ( !v4 ) | |
3804 goto LABEL_87; | |
3805 v47 = (unsigned __int8)v46[rand() % v4]; | |
3806 v6 = GetActualAccuracy(); | |
3807 LABEL_46: | |
3808 v7 = _48EA1B_get_static_effect(v6); | |
3809 LABEL_47: | |
3810 v11 = v7; | |
3811 break; | |
3812 default: | |
3813 v11 = 0; | |
3814 break; | |
3815 } | |
3816 v22 = GetActualLuck(); | |
3817 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3818 if ( rand() % v23 >= 30 ) | |
3819 { | |
3820 LABEL_87: | |
3821 result = 0; | |
3822 } | |
3823 else | |
3824 { | |
3825 switch ( a2 ) | |
3826 { | |
3827 case 1: | |
3828 v41 = 1; | |
3829 v36 = 0; | |
3830 goto LABEL_56; | |
3831 case 2: | |
3832 v41 = 1; | |
3833 v36 = 1; | |
3834 goto LABEL_56; | |
3835 case 3: | |
3836 v41 = 1; | |
3837 v36 = 2; | |
3838 goto LABEL_56; | |
3839 case 23: | |
3840 v41 = 1; | |
3841 v36 = 3; | |
3842 goto LABEL_56; | |
3843 case 4: | |
3844 v41 = 1; | |
3845 v36 = 4; | |
3846 LABEL_56: | |
3847 SetCondition(v36, v41); | |
3848 v42 = 0; | |
3849 v37 = 0; | |
3850 v35 = 0; | |
3851 v34 = 0; | |
3852 v33 = -1; | |
3853 v32 = 0; | |
3854 v31 = 0; | |
3855 v30 = (SoundID)221; | |
3856 goto LABEL_83; | |
3857 case 5: | |
3858 v43 = 1; | |
3859 v38 = 5; | |
3860 goto LABEL_70; | |
3861 case 6: | |
3862 case 7: | |
3863 case 8: | |
3864 if ( a2 == 6 ) | |
3865 { | |
3866 v44 = 6; | |
3867 goto LABEL_60; | |
3868 } | |
3869 v25 = 2 * (a2 != 8) + 8; | |
3870 goto LABEL_65; | |
3871 case 9: | |
3872 if ( a2 == 6 ) | |
3873 { | |
3874 v44 = 7; | |
3875 LABEL_60: | |
3876 v24 = v44; | |
3877 } | |
3878 else | |
3879 { | |
3880 v25 = 2 * (a2 != 8) + 9; | |
3881 LABEL_65: | |
3882 v24 = v25; | |
3883 } | |
3884 SetCondition(v24, 1); | |
3885 v42 = 0; | |
3886 v37 = 0; | |
3887 v35 = 0; | |
3888 v34 = 0; | |
3889 v33 = -1; | |
3890 v32 = 0; | |
3891 v31 = 0; | |
3892 v30 = (SoundID)222; | |
3893 LABEL_83: | |
3894 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3895 do | |
3896 { | |
3897 LABEL_84: | |
3898 if ( v5 == pPlayers[v3 + 1] ) | |
3899 break; | |
3900 ++v3; | |
3901 } | |
3902 while ( v3 < 4 ); | |
3903 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3904 result = 1; | |
3905 break; | |
3906 case 12: | |
3907 v43 = 1; | |
3908 v38 = 12; | |
3909 goto LABEL_70; | |
3910 case 15: | |
3911 v45 = 1; | |
3912 v39 = 15; | |
3913 goto LABEL_73; | |
3914 case 13: | |
3915 v43 = 1; | |
3916 v38 = 13; | |
3917 LABEL_70: | |
3918 SetCondition(v38, v43); | |
3919 v42 = 0; | |
3920 v37 = 0; | |
3921 v35 = 0; | |
3922 v34 = 0; | |
3923 v33 = -1; | |
3924 v32 = 0; | |
3925 v31 = 0; | |
3926 v30 = (SoundID)224; | |
3927 goto LABEL_83; | |
3928 case 14: | |
3929 v45 = 1; | |
3930 v39 = 14; | |
3931 goto LABEL_73; | |
3932 case 16: | |
3933 v45 = 1; | |
3934 v39 = 16; | |
3935 LABEL_73: | |
3936 SetCondition(v39, v45); | |
3937 v42 = 0; | |
3938 v37 = 0; | |
3939 v35 = 0; | |
3940 v34 = 0; | |
3941 v33 = -1; | |
3942 v32 = 0; | |
3943 v31 = 0; | |
3944 v30 = (SoundID)225; | |
3945 goto LABEL_83; | |
3946 case 17: | |
3947 case 18: | |
3948 case 19: | |
3949 v26 = v48; | |
3950 if ( *(char *)(v48 + 21) & 2 ) | |
3951 goto LABEL_84; | |
187 | 3952 PlaySound(SPEECH_40, 0); |
0 | 3953 *(int *)(v26 + 20) |= 2u; |
3954 goto LABEL_79; | |
3955 case 20: | |
187 | 3956 PlaySound(SPEECH_40, 0); |
0 | 3957 v27 = pActor->array_000234; |
3958 if ( pActor->array_000234[0].uItemID ) | |
3959 { | |
3960 v27 = &pActor->array_000234[1]; | |
3961 if ( pActor->array_000234[1].uItemID ) | |
3962 goto LABEL_84; | |
3963 } | |
3964 v28 = v47; | |
654 | 3965 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3966 RemoveItemAtInventoryIndex(v28); |
3967 LABEL_79: | |
3968 v42 = 0; | |
3969 v37 = 0; | |
3970 v35 = 0; | |
3971 v34 = 0; | |
3972 v33 = -1; | |
3973 v32 = 0; | |
3974 v31 = 0; | |
3975 v30 = (SoundID)47; | |
3976 goto LABEL_83; | |
3977 case 21: | |
187 | 3978 PlaySound(SPEECH_42, 0); |
0 | 3979 ++v5->sAgeModifier; |
3980 goto LABEL_82; | |
3981 case 22: | |
187 | 3982 PlaySound(SPEECH_41, 0); |
0 | 3983 v5->sMana = 0; |
3984 LABEL_82: | |
3985 v42 = 0; | |
3986 v37 = 0; | |
3987 v35 = 0; | |
3988 v34 = 0; | |
3989 v33 = -1; | |
3990 v32 = 0; | |
3991 v31 = 0; | |
3992 v30 = (SoundID)226; | |
3993 goto LABEL_83; | |
3994 default: | |
3995 goto LABEL_87; | |
3996 } | |
3997 } | |
3998 return result; | |
3999 } | |
324 | 4000 |
0 | 4001 // 48DCF6: using guessed type char var_94[140]; |
4002 | |
4003 //----- (0048E1A3) -------------------------------------------------------- | |
4004 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4005 { | |
4006 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4007 } | |
4008 | |
4009 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4010 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4011 { | |
4012 ItemGen *weapon = nullptr; | |
4013 ItemDesc *weapon_desc = nullptr; | |
4014 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4015 if (bRangedAttack) | |
0 | 4016 { |
4017 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4018 goto LABEL_17; | |
816 | 4019 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4020 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4021 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4022 goto LABEL_17; | |
4023 } | |
4024 else if ( IsUnarmed() == 1 ) | |
4025 { | |
4026 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4027 { | |
4028 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4029 goto LABEL_17; |
4030 } | |
4031 } | |
816 | 4032 |
4033 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4034 { | |
4035 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4036 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4037 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4038 { | |
4039 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4040 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4041 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4042 } | |
0 | 4043 else |
816 | 4044 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4045 } | |
1010 | 4046 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
4047 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 4048 { |
898 | 4049 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4050 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4051 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4052 { | |
898 | 4053 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4054 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4055 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4056 } | |
4057 } | |
4058 | |
0 | 4059 LABEL_17: |
816 | 4060 uint armour_recovery = 0; |
0 | 4061 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4062 { | |
898 | 4063 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4064 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4065 | |
4066 float armour_recovery_multipliers[4]; | |
4067 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4068 { | |
4069 armour_recovery_multipliers[0] = 1.0f; | |
4070 armour_recovery_multipliers[1] = 0; | |
4071 armour_recovery_multipliers[2] = 0; | |
4072 armour_recovery_multipliers[3] = 0; | |
4073 } | |
4074 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4075 { | |
4076 armour_recovery_multipliers[0] = 1.0f; | |
4077 armour_recovery_multipliers[1] = 0.5f; | |
4078 armour_recovery_multipliers[2] = 0; | |
4079 armour_recovery_multipliers[3] = 0; | |
4080 } | |
4081 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4082 { | |
4083 armour_recovery_multipliers[0] = 1.0f; | |
4084 armour_recovery_multipliers[1] = 0.5f; | |
4085 armour_recovery_multipliers[2] = 0.5f; | |
4086 armour_recovery_multipliers[3] = 0; | |
0 | 4087 } |
4088 else | |
4089 { | |
816 | 4090 assert(false && "Unknown armour type"); // what kind of armour is that? |
4091 armour_recovery_multipliers[0] = 1.0f; | |
4092 armour_recovery_multipliers[1] = 1.0f; | |
4093 armour_recovery_multipliers[2] = 1.0f; | |
4094 armour_recovery_multipliers[3] = 1.0f; | |
4095 } | |
4096 | |
4097 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4098 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4099 } | |
4100 | |
4101 uint shield_recovery = 0; | |
4102 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4103 { | |
4104 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4105 | |
898 | 4106 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4107 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4108 | |
4109 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4110 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4111 } | |
4112 | |
4113 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4114 sword_axe_bow_recovery_reduction = 0; | |
4115 bool shooting_laser = false; | |
4116 if (weapon_desc) | |
4117 { | |
4118 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4119 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4120 { | |
4121 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4122 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4123 } | |
4124 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4125 shooting_laser = true; | |
4126 } | |
4127 | |
4128 uint armsmaster_recovery_reduction = 0; | |
4129 if (!bRangedAttack && !shooting_laser) | |
4130 { | |
4131 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4132 { | |
4133 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4134 if (SkillToMastery(armsmaster_level) >= 4) | |
4135 armsmaster_recovery_reduction *= 2; | |
4136 } | |
4137 } | |
4138 | |
4139 uint v41 = 0; | |
4140 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4141 v41 = 25; |
816 | 4142 |
4143 uint weapon_enchantment_recovery_reduction = 0; | |
4144 if ( weapon ) | |
4145 { | |
4146 if (weapon->uSpecEnchantmentType == 59 || | |
4147 weapon->uSpecEnchantmentType == 41 || | |
4148 weapon->uSpecEnchantmentType == 500) | |
4149 weapon_enchantment_recovery_reduction = 20; | |
4150 } | |
4151 | |
4152 | |
4153 int recovery = weapon_recovery + | |
4154 armour_recovery + | |
4155 shield_recovery | |
4156 - armsmaster_recovery_reduction | |
4157 - weapon_enchantment_recovery_reduction | |
4158 - v41 | |
4159 - sword_axe_bow_recovery_reduction | |
4160 - player_speed_recovery_reduction; | |
4161 | |
4162 if (recovery < 0) | |
4163 recovery = 0; | |
4164 return recovery; | |
0 | 4165 } |
4166 | |
4167 //----- (0048E4F8) -------------------------------------------------------- | |
4168 int Player::GetMaxHealth() | |
4169 { | |
4170 int v3; // esi@1 | |
4171 int v4; // esi@1 | |
4172 int v6; // esi@1 | |
4173 | |
4174 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4175 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4176 v6 = uFullHealthBonus |
135 | 4177 + pBaseHealthByClass[classType / 4] |
0 | 4178 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4179 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4180 if (v6 <= 0) | |
4181 return 1; | |
4182 return v6; | |
4183 } | |
4184 | |
4185 //----- (0048E565) -------------------------------------------------------- | |
4186 int Player::GetMaxMana() | |
4187 { | |
4188 int v2; // eax@2 | |
4189 int v3; // esi@4 | |
4190 int v4; // eax@5 | |
4191 int v5; // esi@5 | |
4192 int v6; // eax@5 | |
4193 int v7; // esi@6 | |
4194 int v8; // esi@6 | |
4195 int v9; // esi@6 | |
4196 int result; // eax@7 | |
4197 | |
135 | 4198 switch (classType) |
0 | 4199 { |
4200 case 5u: | |
4201 case 6u: | |
4202 case 7u: | |
4203 case 0x10u: | |
4204 case 0x11u: | |
4205 case 0x12u: | |
4206 case 0x13u: | |
4207 case 0x20u: | |
4208 case 0x21u: | |
4209 case 0x22u: | |
4210 case 0x23u: | |
4211 v2 = GetActualIntelligence(); | |
4212 v3 = _48EA1B_get_static_effect(v2); | |
4213 goto LABEL_6; | |
4214 case 9u: | |
4215 case 0xAu: | |
4216 case 0xBu: | |
4217 case 0xCu: | |
4218 case 0xDu: | |
4219 case 0xEu: | |
4220 case 0xFu: | |
4221 case 0x18u: | |
4222 case 0x19u: | |
4223 case 0x1Au: | |
4224 case 0x1Bu: | |
4225 v2 = GetActualWillpower(); | |
4226 v3 = _48EA1B_get_static_effect(v2); | |
4227 goto LABEL_6; | |
4228 case 0x15u: | |
4229 case 0x16u: | |
4230 case 0x17u: | |
4231 case 0x1Cu: | |
4232 case 0x1Du: | |
4233 case 0x1Eu: | |
4234 case 0x1Fu: | |
4235 v4 = GetActualWillpower(); | |
4236 v5 = _48EA1B_get_static_effect(v4); | |
4237 v6 = GetActualIntelligence(); | |
4238 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4239 LABEL_6: | |
135 | 4240 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4241 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4242 v9 = uFullManaBonus | |
135 | 4243 + pBaseManaByClass[classType / 4] |
0 | 4244 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4245 + v8; | |
4246 if ( v9 < 1 ) | |
4247 goto LABEL_7; | |
4248 result = v9; | |
4249 break; | |
4250 default: | |
4251 LABEL_7: | |
4252 result = 0; | |
4253 break; | |
4254 } | |
4255 return result; | |
4256 } | |
4257 | |
4258 //----- (0048E656) -------------------------------------------------------- | |
4259 int Player::GetBaseAC() | |
4260 { | |
4261 Player *v1; // edi@1 | |
4262 int v2; // eax@1 | |
4263 int v3; // esi@1 | |
4264 int v4; // esi@1 | |
4265 int v5; // esi@1 | |
4266 int result; // eax@2 | |
4267 | |
4268 v1 = this; | |
4269 v2 = GetActualSpeed(); | |
4270 v3 = _48EA1B_get_static_effect(v2); | |
4271 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4272 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4273 if ( v5 >= 1 ) | |
4274 result = v5; | |
4275 else | |
4276 result = 0; | |
4277 return result; | |
4278 } | |
4279 | |
4280 //----- (0048E68F) -------------------------------------------------------- | |
4281 int Player::GetActualAC() | |
4282 { | |
4283 Player *v1; // edi@1 | |
4284 int v2; // eax@1 | |
4285 int v3; // esi@1 | |
4286 int v4; // esi@1 | |
4287 int v5; // esi@1 | |
4288 int v6; // esi@1 | |
4289 int result; // eax@2 | |
4290 | |
4291 v1 = this; | |
4292 v2 = GetActualSpeed(); | |
4293 v3 = _48EA1B_get_static_effect(v2); | |
4294 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4295 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4296 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4297 if ( v6 >= 1 ) | |
4298 result = v6; | |
4299 else | |
4300 result = 0; | |
4301 return result; | |
4302 } | |
4303 | |
4304 //----- (0048E6DC) -------------------------------------------------------- | |
4305 unsigned int Player::GetBaseAge() | |
4306 { | |
352 | 4307 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4308 } |
4309 | |
4310 //----- (0048E72C) -------------------------------------------------------- | |
4311 unsigned int Player::GetActualAge() | |
4312 { | |
4313 return this->sAgeModifier + GetBaseAge(); | |
4314 } | |
4315 | |
4316 //----- (0048E73F) -------------------------------------------------------- | |
4317 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4318 { | |
4319 Player *v2; // ebx@1 | |
4320 signed int v3; // esi@1 | |
4321 enum CHARACTER_RACE v4; // eax@1 | |
4322 signed int v5; // edi@8 | |
4323 char v6; // zf@9 | |
4324 int v7; // esi@20 | |
4325 int result; // eax@21 | |
4326 signed int v9; // [sp-4h] [bp-10h]@11 | |
4327 | |
4328 v2 = this; | |
4329 v3 = 0; | |
4330 v4 = GetRace(); | |
4331 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4332 { | |
4333 v5 = 0; | |
4334 goto LABEL_16; | |
4335 } | |
4336 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4337 { | |
4338 v5 = 1; | |
4339 LABEL_16: | |
4340 v6 = v4 == 2; | |
4341 goto LABEL_17; | |
4342 } | |
4343 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4344 { | |
4345 v6 = v4 == 3; | |
4346 v5 = 2; | |
4347 goto LABEL_17; | |
4348 } | |
4349 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4350 { | |
4351 v5 = 3; | |
4352 v6 = v4 == 3; | |
4353 goto LABEL_17; | |
4354 } | |
4355 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4356 { | |
4357 v5 = 7; | |
4358 if ( v4 != 1 ) | |
4359 goto LABEL_20; | |
4360 v9 = 10; | |
4361 LABEL_19: | |
4362 v3 = v9; | |
4363 goto LABEL_20; | |
4364 } | |
4365 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4366 { | |
4367 v5 = 8; | |
4368 v6 = v4 == 0; | |
4369 LABEL_17: | |
4370 if ( !v6 ) | |
4371 goto LABEL_20; | |
4372 v9 = 5; | |
4373 goto LABEL_19; | |
4374 } | |
4375 v5 = 0; | |
4376 LABEL_20: | |
4377 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4378 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4379 result = v7 + *(&v2->sResFireBase + v5); |
4380 return result; | |
4381 } | |
4382 | |
4383 //----- (0048E7D0) -------------------------------------------------------- | |
4384 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4385 { | |
4386 signed int v2; // edi@1 | |
4387 Player *v3; // esi@1 | |
4388 enum CHARACTER_RACE v4; // ebx@1 | |
4389 char v6; // zf@18 | |
4390 int v7; // ebx@28 | |
4391 int result; // eax@28 | |
4392 signed int v9; // [sp+10h] [bp-8h]@1 | |
4393 signed int v10; // [sp+14h] [bp-4h]@1 | |
4394 | |
4395 v2 = 0; | |
4396 v3 = this; | |
4397 v10 = 0; | |
4398 v9 = 0; | |
4399 v4 = GetRace(); | |
652 | 4400 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4401 v10 = 20; |
4402 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4403 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4404 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4405 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4406 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4407 && HasItemEquipped(EQUIP_ARMOUR) | |
4408 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4409 v10 += v3->pActiveSkills[9] & 0x3F; | |
4410 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4411 goto LABEL_25; | |
4412 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4413 { | |
4414 v2 = 1; | |
4415 LABEL_25: | |
4416 v6 = v4 == 2; | |
4417 LABEL_26: | |
4418 if ( v6 ) | |
4419 v9 = 5; | |
4420 goto LABEL_28; | |
4421 } | |
4422 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4423 { | |
4424 v6 = v4 == 3; | |
4425 v2 = 2; | |
4426 goto LABEL_26; | |
4427 } | |
4428 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4429 { | |
4430 v2 = 3; | |
4431 if ( v4 == 3 ) | |
4432 v10 += 5; | |
4433 } | |
4434 else | |
4435 { | |
4436 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4437 { | |
4438 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4439 goto LABEL_28; | |
4440 v2 = 8; | |
4441 v6 = v4 == 0; | |
4442 goto LABEL_26; | |
4443 } | |
4444 v2 = 7; | |
4445 if ( v4 == 1 ) | |
4446 v9 = 10; | |
4447 } | |
4448 LABEL_28: | |
4449 v7 = GetItemsBonus(a2, 0); | |
4450 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4451 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4452 { |
4453 if ( result > 200 ) | |
4454 result = 200; | |
4455 } | |
4456 return result; | |
4457 } | |
4458 | |
4459 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4460 bool Player::Recover(int dt) |
4461 { | |
4462 //Player *v2; // esi@1 | |
0 | 4463 signed __int64 v3; // qax@1 |
816 | 4464 //bool result; // eax@4 |
4465 | |
4466 //v2 = this; | |
4467 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4468 | |
4469 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4470 | |
4471 if (uTimeToRecovery > v3) | |
4472 { | |
4473 uTimeToRecovery -= v3; | |
4474 return true; | |
0 | 4475 } |
4476 else | |
4477 { | |
816 | 4478 uTimeToRecovery = 0; |
4479 viewparams->bRedrawGameUI = true; | |
4480 if (!uActiveCharacter) | |
0 | 4481 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4482 return false; |
4483 } | |
0 | 4484 } |
4485 | |
4486 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4487 void Player::SetRecoveryTime(signed int rec) |
4488 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4489 assert(rec >= 0); |
816 | 4490 |
4491 if (rec > uTimeToRecovery) | |
4492 uTimeToRecovery = rec; | |
4493 | |
4494 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4495 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4496 |
4497 viewparams->bRedrawGameUI = true; | |
0 | 4498 } |
4499 // 50C0C4: using guessed type int some_active_character; | |
4500 | |
4501 //----- (0048E9B7) -------------------------------------------------------- | |
4502 void Player::RandomizeName() | |
4503 { | |
4504 if (!uExpressionTimePassed) | |
4505 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4506 } | |
4507 | |
4508 //----- (0048E9F4) -------------------------------------------------------- | |
4509 unsigned int Player::GetMajorConditionIdx() | |
4510 { | |
4511 for (uint i = 0; i < 18; ++i) | |
4512 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4513 return pConditionImportancyTable[i]; | |
4514 | |
4515 return 18; | |
4516 } | |
4517 | |
4518 //----- (0048EA1B) -------------------------------------------------------- | |
4519 int Player::_48EA1B_get_static_effect(int a2) | |
4520 { | |
4521 __int16 v2; // cx@1 | |
4522 int v3; // eax@1 | |
4523 | |
4524 v2 = word_4EDFFC[0]; | |
4525 v3 = 0; | |
4526 while ( a2 < v2 && v2 ) | |
4527 v2 = word_4EDFFC[v3++ + 1]; | |
4528 return player_stat_bonuses[v3]; | |
4529 } | |
4530 | |
4531 //----- (0048EA46) -------------------------------------------------------- | |
4532 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4533 { | |
4534 int v3; // esi@1 | |
4535 int v4; // edx@2 | |
4536 int v5; // eax@3 | |
4537 char *v6; // eax@4 | |
4538 | |
4539 v3 = 0; | |
4540 while ( 1 ) | |
4541 { | |
4542 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4543 goto LABEL_11; | |
816 | 4544 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4545 if ( a2 != 17 ) |
816 | 4546 { |
4547 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4548 goto LABEL_11; | |
4549 return 5; | |
4550 } | |
0 | 4551 v6 = (char *)this + 36 * v5; |
4552 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4553 return 50; | |
4554 LABEL_11: | |
4555 ++v3; | |
4556 if ( (signed int)v3 >= 16 ) | |
816 | 4557 return 0; |
4558 } | |
0 | 4559 } |
4560 | |
4561 //----- (0048EAAE) -------------------------------------------------------- | |
4562 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4563 { | |
4564 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4565 signed int v4; // eax@1 | |
4566 int v5; // edi@1 | |
4567 Player *v6; // ebx@1 | |
4568 Player *v8; // ecx@48 | |
4569 int v9; // eax@49 | |
4570 int v10; // edx@49 | |
4571 Player *v11; // ecx@55 | |
4572 int v12; // eax@56 | |
4573 int v13; // edx@56 | |
4574 int v14; // ecx@58 | |
4575 int v15; // eax@58 | |
4576 Player *v16; // ecx@61 | |
4577 int v17; // eax@62 | |
4578 Player *v18; // ecx@66 | |
4579 int v19; // eax@67 | |
4580 int v20; // eax@69 | |
4581 Player *v21; // ecx@75 | |
4582 int v22; // eax@76 | |
4583 int v23; // edx@76 | |
4584 int v24; // eax@79 | |
4585 int v25; // ecx@80 | |
4586 int v26; // edi@80 | |
4587 Player *v27; // ecx@84 | |
4588 int v28; // eax@85 | |
4589 int v29; // edx@85 | |
4590 Player *v30; // ecx@96 | |
4591 int v31; // ebp@97 | |
4592 int v32; // eax@98 | |
4593 unsigned int v33; // eax@100 | |
4594 int v34; // eax@103 | |
4595 char v35; // zf@104 | |
4596 char v36; // zf@107 | |
4597 unsigned __int8 v37; // zf@119 | |
4598 char v38; // sf@119 | |
4599 unsigned __int8 v39; // of@119 | |
4600 char v40; // zf@122 | |
4601 char v41; // zf@145 | |
4602 char v42; // zf@164 | |
4603 char v43; // zf@173 | |
4604 char v44; // zf@189 | |
4605 char v45; // zf@198 | |
4606 char v46; // zf@239 | |
4607 int v47; // eax@268 | |
4608 int v48; // eax@269 | |
4609 int v49; // eax@291 | |
4610 char v50; // zf@295 | |
4611 int v51; // eax@306 | |
4612 int v52; // eax@307 | |
4613 char v53; // zf@312 | |
4614 char v54; // zf@336 | |
4615 char v55; // zf@348 | |
4616 int v56; // eax@365 | |
4617 int v57; // ebx@368 | |
4618 signed int v58; // [sp-4h] [bp-20h]@10 | |
4619 signed int v59; // [sp-4h] [bp-20h]@71 | |
4620 signed int v60; // [sp-4h] [bp-20h]@347 | |
4621 int v61; // [sp+10h] [bp-Ch]@1 | |
4622 int v62; // [sp+14h] [bp-8h]@1 | |
4623 int v63; // [sp+18h] [bp-4h]@101 | |
4624 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4625 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4626 | |
4627 v3 = attr; | |
4628 v4 = 36; | |
4629 v5 = 0; | |
4630 v6 = this; | |
4631 v62 = 0; | |
4632 v61 = 0; | |
4633 | |
4634 switch (attr) | |
4635 { | |
4636 case CHARACTER_ATTRIBUTE_LEVEL: | |
4637 if (HasEnchantedItemEquipped(25)) | |
4638 return 5; | |
4639 return 0; | |
4640 }; | |
4641 | |
4642 if ( (signed int)attr > 36 ) | |
4643 { | |
4644 switch ( attr ) | |
4645 { | |
4646 case 37: | |
4647 v58 = 15; | |
4648 goto LABEL_35; | |
4649 case 38: | |
4650 v58 = 16; | |
4651 goto LABEL_35; | |
4652 case 39: | |
4653 v58 = 17; | |
4654 goto LABEL_35; | |
4655 case 40: | |
4656 v58 = 18; | |
4657 goto LABEL_35; | |
4658 case 41: | |
4659 v58 = 19; | |
4660 goto LABEL_35; | |
4661 case 42: | |
4662 v58 = 20; | |
4663 goto LABEL_35; | |
4664 case 43: | |
4665 v58 = 25; | |
4666 goto LABEL_35; | |
4667 case 44: | |
4668 v58 = 5; | |
4669 goto LABEL_35; | |
4670 case 45: | |
4671 v58 = 8; | |
4672 goto LABEL_35; | |
4673 case 46: | |
4674 goto LABEL_36; | |
4675 default: | |
4676 break; | |
4677 } | |
4678 } | |
4679 else | |
4680 { | |
4681 if ( attr == 36 ) | |
4682 { | |
4683 v58 = 14; | |
4684 } | |
4685 else | |
4686 { | |
4687 if ( (signed int)attr > 21 ) | |
4688 { | |
4689 switch ( attr ) | |
4690 { | |
4691 case 22: | |
4692 v58 = 30; | |
4693 break; | |
4694 case 23: | |
4695 v58 = 31; | |
4696 break; | |
4697 case 34: | |
4698 v58 = 12; | |
4699 break; | |
4700 default: | |
4701 if ( attr != 35 ) | |
4702 goto LABEL_38; | |
4703 v58 = 13; | |
4704 break; | |
4705 } | |
4706 } | |
4707 else | |
4708 { | |
4709 switch ( attr ) | |
4710 { | |
4711 case 21: | |
4712 v58 = 33; | |
4713 break; | |
4714 case 16: | |
4715 v58 = 35; | |
4716 break; | |
4717 case 17: | |
4718 v58 = 34; | |
4719 break; | |
4720 case 18: | |
4721 v58 = 29; | |
4722 break; | |
4723 case 19: | |
4724 v58 = 21; | |
4725 break; | |
4726 default: | |
4727 if ( attr != 20 ) | |
4728 goto LABEL_38; | |
4729 v58 = 32; | |
4730 break; | |
4731 } | |
4732 } | |
4733 } | |
4734 LABEL_35: | |
4735 v4 = v58; | |
4736 LABEL_36: | |
4737 if ( !this->pActiveSkills[v4] ) | |
4738 return 0; | |
4739 } | |
4740 LABEL_38: | |
4741 if ( (signed int)attr > 28 ) | |
4742 { | |
4743 if ( (signed int)attr < 29 ) | |
4744 return v5 + v62 + v61; | |
4745 if ( (signed int)attr <= 30 ) | |
4746 { | |
4747 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4748 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4749 return v5 + v62 + v61; |
4750 } | |
4751 if ( attr == 31 ) | |
4752 { | |
4753 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4754 return v5 + v62 + v61; | |
232 | 4755 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4756 v5 = pItemsTable->pItems[v57].uDamageMod; |
4757 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4758 goto LABEL_366; | |
4759 } | |
4760 if ( attr == 32 ) | |
4761 { | |
4762 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4763 return v5 + v62 + v61; | |
232 | 4764 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4765 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4766 LABEL_365: | |
4767 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4768 LABEL_366: | |
4769 v5 += v56; | |
4770 return v5 + v62 + v61; | |
4771 } | |
4772 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4773 return v5 + v62 + v61; | |
4774 LABEL_95: | |
4775 v65 = 0; | |
4776 while ( 1 ) | |
4777 { | |
4778 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4779 goto LABEL_361; | |
898 | 4780 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4781 if ( v3 == 9 ) |
4782 { | |
816 | 4783 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4784 if ( v32 >= 3 ) |
4785 { | |
4786 if ( v32 <= 11 ) | |
4787 { | |
4788 v33 = v6->pInventoryItems[v31].uItemID; | |
4789 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4790 } | |
4791 } | |
4792 } | |
4793 v63 = (int)((char *)v6 + 36 * v31); | |
4794 attra = (ItemGen *)(v63 + 532); | |
377 | 4795 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4796 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4797 { |
4798 v34 = attra->uItemID; | |
4799 switch ( attra->uItemID ) | |
4800 { | |
4801 case 0x1F4u: | |
4802 v35 = v3 == 5; | |
4803 goto LABEL_105; | |
4804 case 0x1F5u: | |
4805 v36 = v3 == 0; | |
4806 goto LABEL_108; | |
4807 case 0x1F6u: | |
4808 if ( v3 == 21 ) | |
4809 v61 += 10; | |
4810 v36 = v3 == 2; | |
4811 goto LABEL_108; | |
4812 case 0x1F7u: | |
4813 if ( v3 == 17 ) | |
4814 v61 += 5; | |
4815 if ( v3 == 18 ) | |
4816 v61 += 5; | |
4817 v36 = v3 == 6; | |
4818 goto LABEL_108; | |
4819 case 0x1F8u: | |
4820 goto LABEL_118; | |
4821 case 0x1F9u: | |
4822 v40 = v3 == 3; | |
4823 goto LABEL_123; | |
4824 case 0x1FAu: | |
4825 v35 = v3 == 10; | |
4826 goto LABEL_105; | |
4827 case 0x1FEu: | |
4828 v35 = v3 == 4; | |
4829 goto LABEL_105; | |
4830 case 0x1FFu: | |
4831 if ( v3 == 23 ) | |
4832 v61 += 10; | |
4833 if ( v3 == 22 ) | |
4834 v61 += 10; | |
4835 goto LABEL_361; | |
4836 case 0x200u: | |
4837 if ( v3 == 36 ) | |
4838 { | |
4839 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4840 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4841 } | |
4842 v36 = v3 == 5; | |
4843 LABEL_108: | |
4844 if ( v36 ) | |
4845 v5 += 40; | |
4846 goto LABEL_361; | |
4847 case 0x201u: | |
4848 if ( v3 == 39 ) | |
4849 { | |
4850 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4851 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4852 v62 = v34; | |
4853 } | |
4854 goto LABEL_136; | |
4855 case 0x202u: | |
4856 if ( !v3 ) | |
4857 v5 += 150; | |
4858 if ( v3 == 1 ) | |
4859 v5 -= 40; | |
4860 if ( v3 == 2 ) | |
4861 v5 -= 40; | |
4862 goto LABEL_145; | |
4863 case 0x203u: | |
4864 if ( v3 == 42 ) | |
4865 { | |
4866 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4867 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4868 } | |
4869 if ( v3 == 43 ) | |
4870 v61 += 15; | |
4871 goto LABEL_361; | |
4872 case 0x204u: | |
4873 if ( v3 == 17 ) | |
4874 v61 += 5; | |
4875 if ( v3 == 18 ) | |
4876 v61 += 5; | |
4877 if ( v3 == 6 ) | |
4878 v5 += 50; | |
4879 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4880 goto LABEL_166; | |
4881 v42 = v3 == 15; | |
4882 goto LABEL_165; | |
4883 case 0x205u: | |
4884 if ( v3 == 18 ) | |
4885 v61 += 5; | |
4886 goto LABEL_361; | |
4887 case 0x206u: | |
4888 if ( !v3 ) | |
4889 v5 += 100; | |
4890 if ( v3 == 3 ) | |
4891 v5 += 100; | |
4892 v43 = v3 == 9; | |
4893 goto LABEL_174; | |
4894 case 0x207u: | |
4895 if ( v3 == 45 ) | |
4896 v61 += 5; | |
4897 if ( v3 == 15 ) | |
4898 v5 -= 10; | |
4899 v42 = v3 == 14; | |
4900 LABEL_165: | |
4901 if ( v42 ) | |
4902 LABEL_166: | |
4903 v5 -= 10; | |
4904 goto LABEL_361; | |
4905 case 0x208u: | |
4906 v35 = v3 == 3; | |
4907 goto LABEL_105; | |
4908 case 0x209u: | |
4909 if ( v3 == 2 ) | |
4910 v5 += 15; | |
4911 if ( !v3 ) | |
4912 v5 += 15; | |
4913 v41 = v3 == 6; | |
4914 goto LABEL_146; | |
4915 case 0x20Au: | |
4916 if ( v3 == 46 ) | |
4917 v61 += 15; | |
4918 v44 = v3 == 3; | |
4919 goto LABEL_190; | |
4920 case 0x20Bu: | |
4921 if ( v3 == 34 ) | |
4922 { | |
4923 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4924 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4925 } | |
4926 if ( v3 == 12 ) | |
4927 v5 += 50; | |
4928 if ( v3 == 2 ) | |
4929 v5 += 30; | |
4930 v45 = v3 == 9; | |
4931 goto LABEL_199; | |
4932 case 0x20Cu: | |
4933 if ( !v3 ) | |
4934 v5 += 75; | |
4935 goto LABEL_145; | |
4936 case 0x20Du: | |
4937 if ( v3 == 5 ) | |
4938 v5 += 50; | |
4939 if ( v3 == 6 ) | |
4940 v5 += 50; | |
4941 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4942 goto LABEL_374; | |
4943 v43 = v3 == 15; | |
4944 LABEL_174: | |
4945 if ( v43 ) | |
4946 LABEL_374: | |
4947 v5 -= 15; | |
4948 goto LABEL_361; | |
4949 case 0x20Eu: | |
4950 if ( v3 == 4 ) | |
4951 v5 += 150; | |
4952 if ( v3 == 44 ) | |
4953 v61 += 5; | |
4954 if ( v3 == 9 ) | |
4955 v5 -= 25; | |
4956 goto LABEL_361; | |
4957 case 0x20Fu: | |
4958 if ( v3 == 39 ) | |
4959 { | |
4960 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4961 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4962 v62 = v34; | |
4963 } | |
4964 if ( v3 == 40 ) | |
4965 { | |
4966 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4967 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4968 } | |
4969 LABEL_145: | |
4970 v41 = v3 == 5; | |
4971 LABEL_146: | |
4972 if ( v41 ) | |
4973 v5 -= 40; | |
4974 goto LABEL_361; | |
4975 case 0x210u: | |
4976 if ( v3 == 38 ) | |
4977 { | |
4978 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4979 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4980 } | |
4981 if ( !v3 ) | |
4982 v5 += 75; | |
4983 v44 = v3 == 11; | |
4984 LABEL_190: | |
4985 if ( v44 ) | |
4986 v5 -= 50; | |
4987 goto LABEL_361; | |
4988 case 0x211u: | |
4989 if ( v3 == 5 ) | |
4990 v5 += 100; | |
4991 if ( v3 == 4 ) | |
4992 v5 += 50; | |
4993 v35 = v3 == 11; | |
4994 LABEL_105: | |
4995 if ( v35 ) | |
4996 v5 += 50; | |
4997 goto LABEL_361; | |
4998 case 0x212u: | |
4999 if ( v3 == 1 ) | |
5000 v5 -= 20; | |
5001 v45 = v3 == 2; | |
5002 LABEL_199: | |
5003 if ( v45 ) | |
5004 v5 -= 20; | |
5005 goto LABEL_361; | |
5006 case 0x214u: | |
5007 if ( v3 == 1 ) | |
5008 v5 += 15; | |
5009 v46 = v3 == 2; | |
5010 goto LABEL_240; | |
5011 case 0x215u: | |
5012 if ( v3 == 5 ) | |
5013 v5 += 15; | |
5014 v46 = v3 == 4; | |
5015 goto LABEL_240; | |
5016 case 0x216u: | |
5017 if ( v3 == 10 ) | |
5018 v5 += 30; | |
5019 if ( !v3 ) | |
5020 v5 += 15; | |
5021 goto LABEL_315; | |
5022 case 0x217u: | |
5023 if ( v3 == 21 ) | |
5024 v61 += 5; | |
5025 if ( !v3 ) | |
5026 v5 += 15; | |
5027 goto LABEL_253; | |
5028 case 0x218u: | |
5029 goto LABEL_253; | |
5030 default: | |
5031 goto LABEL_361; | |
5032 } | |
5033 goto LABEL_361; | |
5034 } | |
5035 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5036 { | |
5037 if ( (signed int)v3 >= 0 ) | |
5038 { | |
5039 if ( (signed int)v3 <= 15 ) | |
5040 { | |
5041 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5042 } | |
5043 else | |
5044 { | |
5045 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5046 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5047 } | |
5048 } | |
5049 goto LABEL_361; | |
5050 } | |
5051 v34 = *(int *)(v63 + 544); | |
5052 if ( v34 > 48 ) | |
5053 { | |
5054 switch ( v34 ) | |
5055 { | |
5056 case 54: | |
5057 goto LABEL_315; | |
5058 case 49: | |
5059 if ( v3 == 6 ) | |
5060 goto LABEL_121; | |
5061 v50 = v3 == 1; | |
5062 goto LABEL_296; | |
5063 case 51: | |
5064 if ( v3 != 5 && v3 != 1 ) | |
5065 goto LABEL_309; | |
5066 goto LABEL_121; | |
5067 case 52: | |
5068 if ( v3 == 3 ) | |
5069 goto LABEL_121; | |
5070 v50 = v3 == 4; | |
5071 goto LABEL_296; | |
5072 case 53: | |
5073 if ( !v3 ) | |
5074 goto LABEL_121; | |
5075 v50 = v3 == 2; | |
5076 goto LABEL_296; | |
5077 case 55: | |
5078 v46 = v3 == 6; | |
5079 goto LABEL_240; | |
5080 case 56: | |
5081 if ( !v3 ) | |
5082 goto LABEL_351; | |
5083 v53 = v3 == 3; | |
5084 goto LABEL_350; | |
5085 case 57: | |
5086 if ( v3 == 1 ) | |
5087 goto LABEL_351; | |
5088 v53 = v3 == 2; | |
5089 goto LABEL_350; | |
5090 case 50: | |
5091 if ( v3 == 10 ) | |
5092 v5 += 30; | |
5093 goto LABEL_361; | |
5094 case 60: | |
5095 if ( v3 != 23 ) | |
5096 goto LABEL_336; | |
5097 if ( v5 >= 3 ) | |
5098 goto LABEL_361; | |
5099 v5 = 3; | |
5100 LABEL_336: | |
5101 v54 = v3 == 22; | |
5102 goto LABEL_345; | |
5103 case 61: | |
5104 if ( v3 != 17 ) | |
5105 goto LABEL_340; | |
5106 if ( v5 >= 3 ) | |
5107 goto LABEL_361; | |
5108 v5 = 3; | |
5109 LABEL_340: | |
5110 v54 = v3 == 18; | |
5111 goto LABEL_345; | |
5112 case 62: | |
5113 if ( v3 != 19 ) | |
5114 goto LABEL_344; | |
5115 if ( v5 >= 3 ) | |
5116 goto LABEL_361; | |
5117 v5 = 3; | |
5118 LABEL_344: | |
5119 v54 = v3 == 20; | |
5120 LABEL_345: | |
5121 if ( !v54 ) | |
5122 goto LABEL_361; | |
5123 if ( v5 >= 3 ) | |
5124 goto LABEL_361; | |
5125 v60 = 3; | |
5126 goto LABEL_360; | |
5127 case 67: | |
5128 v55 = v3 == 18; | |
5129 goto LABEL_357; | |
5130 case 68: | |
5131 v53 = v3 == 9; | |
5132 goto LABEL_350; | |
5133 case 69: | |
5134 if ( v3 == 11 ) | |
5135 v5 += 20; | |
5136 break; | |
5137 case 70: | |
5138 if ( v3 == 12 ) | |
5139 v5 += 10; | |
5140 v55 = v3 == 16; | |
5141 LABEL_357: | |
5142 if ( v55 && v5 < 2 ) | |
5143 { | |
5144 v60 = 2; | |
5145 LABEL_360: | |
5146 v5 = v60; | |
5147 } | |
5148 break; | |
5149 default: | |
5150 goto LABEL_361; | |
5151 } | |
5152 goto LABEL_361; | |
5153 } | |
5154 if ( v34 == 48 ) | |
5155 { | |
5156 if ( v3 == 9 ) | |
5157 v5 += 5; | |
5158 LABEL_315: | |
5159 v46 = v3 == 3; | |
5160 LABEL_240: | |
5161 if ( v46 ) | |
5162 v5 += 15; | |
5163 goto LABEL_361; | |
5164 } | |
5165 if ( v34 > 32 ) | |
5166 { | |
5167 if ( v34 > 44 ) | |
5168 { | |
5169 v51 = v34 - 45; | |
5170 if ( !v51 ) | |
5171 { | |
5172 if ( v3 == 5 ) | |
5173 goto LABEL_351; | |
5174 v53 = v3 == 4; | |
5175 LABEL_350: | |
5176 if ( v53 ) | |
5177 LABEL_351: | |
5178 v5 += 5; | |
5179 goto LABEL_361; | |
5180 } | |
5181 v52 = v51 - 1; | |
5182 if ( !v52 ) | |
5183 { | |
5184 v40 = v3 == 0; | |
5185 LABEL_123: | |
5186 if ( v40 ) | |
5187 v5 += 25; | |
5188 goto LABEL_361; | |
5189 } | |
5190 if ( v52 == 1 ) | |
5191 { | |
5192 LABEL_309: | |
5193 v50 = v3 == 8; | |
5194 goto LABEL_296; | |
5195 } | |
5196 } | |
5197 else | |
5198 { | |
5199 if ( v34 == 44 ) | |
5200 { | |
5201 v50 = v3 == 7; | |
5202 goto LABEL_296; | |
5203 } | |
5204 v34 -= 33; | |
5205 if ( !v34 ) | |
5206 { | |
5207 if ( v3 != 38 ) | |
5208 goto LABEL_361; | |
5209 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5210 goto LABEL_138; | |
5211 } | |
5212 --v34; | |
5213 if ( !v34 ) | |
5214 { | |
5215 if ( v3 != 36 ) | |
5216 goto LABEL_361; | |
5217 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5218 goto LABEL_138; | |
5219 } | |
5220 v49 = v34 - 8; | |
5221 if ( !v49 ) | |
5222 { | |
5223 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5224 ++v5; | |
5225 goto LABEL_361; | |
5226 } | |
5227 if ( v49 == 1 ) | |
5228 { | |
5229 if ( v3 != 3 && v3 != 7 ) | |
5230 { | |
5231 v50 = v3 == 9; | |
5232 LABEL_296: | |
5233 if ( !v50 ) | |
5234 goto LABEL_361; | |
5235 } | |
5236 LABEL_121: | |
5237 v5 += 10; | |
5238 goto LABEL_361; | |
5239 } | |
5240 } | |
5241 } | |
5242 else | |
5243 { | |
5244 if ( v34 == 32 ) | |
5245 { | |
5246 if ( v3 != 39 ) | |
5247 goto LABEL_361; | |
5248 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5249 goto LABEL_138; | |
5250 } | |
5251 if ( v34 > 28 ) | |
5252 { | |
5253 v34 -= 29; | |
5254 if ( v34 ) | |
5255 { | |
5256 --v34; | |
5257 if ( v34 ) | |
5258 { | |
5259 --v34; | |
5260 if ( v34 || v3 != 41 ) | |
5261 goto LABEL_361; | |
5262 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5263 } | |
5264 else | |
5265 { | |
5266 if ( v3 != 34 ) | |
5267 goto LABEL_361; | |
5268 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5269 } | |
5270 } | |
5271 else | |
5272 { | |
5273 if ( v3 != 37 ) | |
5274 goto LABEL_361; | |
5275 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5276 } | |
5277 goto LABEL_138; | |
5278 } | |
5279 if ( v34 == 28 ) | |
5280 { | |
5281 LABEL_136: | |
5282 if ( v3 == 42 ) | |
5283 { | |
5284 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5285 LABEL_138: | |
5286 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5287 goto LABEL_361; | |
5288 } | |
5289 } | |
5290 else | |
5291 { | |
5292 v47 = v34 - 1; | |
5293 if ( v47 ) | |
5294 { | |
5295 v48 = v47 - 1; | |
5296 if ( v48 ) | |
5297 { | |
5298 v34 = v48 - 24; | |
5299 if ( v34 ) | |
5300 { | |
5301 --v34; | |
5302 if ( v34 || v3 != 40 ) | |
5303 goto LABEL_361; | |
5304 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5305 } | |
5306 else | |
5307 { | |
5308 if ( v3 != 35 ) | |
5309 goto LABEL_361; | |
5310 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5311 } | |
5312 goto LABEL_138; | |
5313 } | |
5314 LABEL_118: | |
5315 if ( (signed int)v3 < 0 ) | |
5316 goto LABEL_361; | |
5317 v39 = __OFSUB__((int)v3, 6); | |
5318 v37 = v3 == 6; | |
5319 v38 = v3 - 6 < 0; | |
5320 } | |
5321 else | |
5322 { | |
5323 LABEL_253: | |
5324 if ( (signed int)v3 < 10 ) | |
5325 goto LABEL_361; | |
5326 v39 = __OFSUB__((int)v3, 15); | |
5327 v37 = v3 == 15; | |
5328 v38 = v3 - 15 < 0; | |
5329 } | |
5330 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5331 goto LABEL_121; | |
5332 } | |
5333 } | |
5334 LABEL_361: | |
5335 ++v65; | |
5336 if ( (signed int)v65 >= 16 ) | |
5337 return v5 + v62 + v61; | |
5338 } | |
5339 } | |
5340 if ( attr == 28 ) | |
5341 { | |
5342 if ( IsUnarmed() != 1 ) | |
5343 { | |
816 | 5344 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5345 { | |
5346 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5347 if ( v22 >= 0 ) |
5348 { | |
5349 if ( v22 <= 2 ) | |
5350 { | |
118 | 5351 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5352 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5353 { |
5354 v24 = v23; | |
5355 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5356 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5357 } | |
5358 else | |
5359 { | |
5360 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5361 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5362 } | |
5363 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5364 } | |
5365 } | |
5366 } | |
865 | 5367 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5368 return v5 + v62 + v61; |
5369 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5370 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5371 goto LABEL_88; | |
5372 } | |
5373 v59 = 3; | |
5374 LABEL_74: | |
5375 v5 = v59; | |
5376 return v5 + v62 + v61; | |
5377 } | |
5378 if ( (signed int)attr < 0 ) | |
5379 return v5 + v62 + v61; | |
5380 if ( (signed int)attr <= 23 ) | |
5381 goto LABEL_95; | |
5382 if ( (signed int)attr <= 24 ) | |
5383 return v5 + v62 + v61; | |
5384 if ( (signed int)attr <= 26 ) | |
5385 { | |
5386 if ( IsUnarmed() == 1 ) | |
5387 { | |
5388 v5 = 0; | |
5389 return v5 + v62 + v61; | |
5390 } | |
816 | 5391 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5392 { | |
5393 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5394 if ( v17 >= 0 ) |
5395 { | |
5396 if ( v17 <= 2 ) | |
232 | 5397 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5398 } |
5399 } | |
865 | 5400 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5401 return v5 + v62 + v61; |
898 | 5402 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5403 goto LABEL_365; |
5404 } | |
5405 if ( attr == 27 ) | |
5406 { | |
5407 if ( IsUnarmed() == 1 ) | |
5408 { | |
5409 v5 = 1; | |
5410 return v5 + v62 + v61; | |
5411 } | |
816 | 5412 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5413 { | |
5414 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5415 if ( v9 >= 0 ) |
5416 { | |
5417 if ( v9 <= 2 ) | |
5418 { | |
1021 | 5419 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5420 pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5421 if ( !v6->pEquipment.uShield ) |
0 | 5422 { |
118 | 5423 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5424 ++v5; |
5425 } | |
5426 } | |
5427 } | |
5428 } | |
865 | 5429 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5430 return v5 + v62 + v61; |
898 | 5431 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5432 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5433 LABEL_88: |
5434 v5 += v15 + v14; | |
5435 } | |
5436 return v5 + v62 + v61; | |
5437 } | |
5438 | |
5439 //----- (0048F73C) -------------------------------------------------------- | |
5440 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5441 { | |
5442 int result; // eax@1 | |
5443 int v3; // eax@4 | |
5444 int v4; // ecx@5 | |
5445 | |
5446 switch (a2) | |
5447 { | |
5448 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5449 } | |
5450 | |
5451 result = 0; | |
5452 if ( (signed int)a2 > 10 ) | |
5453 { | |
5454 if ( (signed int)a2 <= 15 ) | |
5455 { | |
5456 switch ( a2 ) | |
5457 { | |
5458 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5459 v3 = this->pPlayerBuffs[2].uPower; | |
5460 v4 = pParty->pPartyBuffs[1].uPower; | |
5461 break; | |
5462 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5463 v3 = this->pPlayerBuffs[0].uPower; | |
5464 v4 = pParty->pPartyBuffs[0].uPower; | |
5465 break; | |
5466 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5467 v3 = this->pPlayerBuffs[22].uPower; | |
5468 v4 = pParty->pPartyBuffs[17].uPower; | |
5469 break; | |
5470 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5471 v3 = this->pPlayerBuffs[3].uPower; | |
5472 v4 = pParty->pPartyBuffs[4].uPower; | |
5473 break; | |
5474 default: | |
5475 if ( a2 != 14 ) | |
5476 return result; | |
5477 v3 = this->pPlayerBuffs[9].uPower; | |
5478 v4 = pParty->pPartyBuffs[12].uPower; | |
5479 break; | |
5480 } | |
5481 return v4 + v3; | |
5482 } | |
5483 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5484 { | |
5485 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5486 { | |
5487 v3 = this->pPlayerBuffs[8].uPower; | |
5488 v4 = pParty->pPartyBuffs[9].uPower; | |
5489 return v4 + v3; | |
5490 } | |
5491 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5492 return result; | |
5493 } | |
5494 return this->pPlayerBuffs[1].uPower; | |
5495 } | |
5496 if ( a2 == 10 ) | |
5497 { | |
5498 v3 = this->pPlayerBuffs[5].uPower; | |
5499 v4 = pParty->pPartyBuffs[6].uPower; | |
5500 return v4 + v3; | |
5501 } | |
5502 switch ( a2 ) | |
5503 { | |
5504 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5505 v3 = pPlayerBuffs[19].uPower; | |
5506 goto LABEL_5; | |
5507 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5508 v3 = pPlayerBuffs[17].uPower; | |
5509 goto LABEL_5; | |
5510 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5511 v3 = pPlayerBuffs[20].uPower; | |
5512 goto LABEL_5; | |
5513 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5514 v3 = pPlayerBuffs[16].uPower; | |
5515 goto LABEL_5; | |
5516 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5517 v3 = pPlayerBuffs[15].uPower; | |
5518 goto LABEL_5; | |
5519 case CHARACTER_ATTRIBUTE_SPEED: | |
5520 v3 = pPlayerBuffs[21].uPower; | |
5521 goto LABEL_5; | |
5522 case CHARACTER_ATTRIBUTE_LUCK: | |
5523 v3 = pPlayerBuffs[18].uPower; | |
5524 LABEL_5: | |
5525 v4 = pParty->pPartyBuffs[2].uPower; | |
5526 return v4 + v3; | |
5527 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5528 v3 = this->pPlayerBuffs[14].uPower; | |
5529 v4 = pParty->pPartyBuffs[15].uPower; | |
5530 return v4 + v3; | |
5531 default: | |
5532 return result; | |
5533 } | |
5534 return result; | |
5535 } | |
5536 | |
5537 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5538 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5539 { | |
0 | 5540 signed int v2; // esi@1 |
5541 unsigned __int16 v3; // ax@126 | |
5542 char result; // al@127 | |
5543 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5544 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5545 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5546 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5547 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5548 | |
0 | 5549 v2 = 0; |
353 | 5550 switch (uSkillType) |
5551 { | |
5552 case PLAYER_SKILL_MONSTER_ID: | |
5553 { | |
652 | 5554 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5555 v2 = 6; |
652 | 5556 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5557 v2 += 6; |
5558 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5559 v2 += GetItemsBonus(v8, 0); | |
5560 } | |
5561 break; | |
5562 | |
5563 case PLAYER_SKILL_ARMSMASTER: | |
5564 { | |
652 | 5565 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5566 v2 = 2; |
652 | 5567 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5568 v2 += 3; |
353 | 5569 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5570 v2 += GetItemsBonus(v8, 0); | |
5571 } | |
5572 break; | |
5573 | |
5574 case PLAYER_SKILL_STEALING: | |
5575 { | |
652 | 5576 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5577 v2 = 8; |
5578 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5579 v2 += GetItemsBonus(v8, 0); | |
5580 } | |
5581 break; | |
5582 | |
5583 | |
5584 case PLAYER_SKILL_ALCHEMY: | |
5585 { | |
652 | 5586 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5587 v2 = 4; |
652 | 5588 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5589 v2 += 8; |
5590 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5591 v2 += GetItemsBonus(v8, 0); | |
5592 } | |
5593 break; | |
5594 | |
5595 case PLAYER_SKILL_LEARNING: | |
5596 { | |
652 | 5597 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5598 v2 = 10; |
652 | 5599 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5600 v2 += 15; |
652 | 5601 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5602 v2 += 5; |
5603 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5604 v2 += GetItemsBonus(v8, 0); | |
5605 } | |
5606 break; | |
5607 | |
5608 case PLAYER_SKILL_UNARMED: | |
5609 { | |
652 | 5610 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5611 v2 = 2; |
5612 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5613 v2 += GetItemsBonus(v8, 0); | |
5614 } | |
5615 break; | |
5616 | |
5617 case PLAYER_SKILL_DODGE: | |
5618 { | |
652 | 5619 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5620 v2 = 2; |
5621 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5622 v2 += GetItemsBonus(v8, 0); | |
5623 } | |
5624 break; | |
5625 | |
5626 case PLAYER_SKILL_BOW: | |
5627 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5628 v2 += GetItemsBonus(v8, 0); | |
5629 break; | |
5630 case PLAYER_SKILL_SHIELD: | |
5631 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5632 v2 += GetItemsBonus(v8, 0); | |
5633 break; | |
5634 | |
5635 case PLAYER_SKILL_EARTH: | |
652 | 5636 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5637 v2 = 2; |
652 | 5638 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5639 v2 += 3; |
652 | 5640 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5641 v2 += 4; |
5642 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5643 v2 += 3; | |
5644 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5645 v2 += GetItemsBonus(v8, 0); | |
5646 break; | |
5647 case PLAYER_SKILL_FIRE: | |
652 | 5648 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5649 v2 = 2; |
652 | 5650 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5651 v2 += 3; |
652 | 5652 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5653 v2 += 4; |
5654 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5655 v2 += 3; | |
5656 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5657 v2 += GetItemsBonus(v8, 0); | |
5658 break; | |
5659 case PLAYER_SKILL_AIR: | |
652 | 5660 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5661 v2 = 2; |
652 | 5662 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5663 v2 += 3; |
652 | 5664 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5665 v2 += 4; |
5666 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5667 v2 += 3; | |
5668 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5669 v2 += GetItemsBonus(v8, 0); | |
5670 break; | |
5671 case PLAYER_SKILL_WATER: | |
652 | 5672 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5673 v2 = 2; |
652 | 5674 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5675 v2 += 3; |
652 | 5676 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5677 v2 += 4; |
5678 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5679 v2 += 3; | |
5680 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5681 v2 += GetItemsBonus(v8, 0); | |
5682 break; | |
5683 case PLAYER_SKILL_SPIRIT: | |
652 | 5684 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5685 v2 = 2; |
652 | 5686 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5687 v2 += 3; |
652 | 5688 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5689 v2 += 4; |
5690 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5691 v2 += GetItemsBonus(v8, 0); | |
5692 break; | |
5693 case PLAYER_SKILL_MIND: | |
652 | 5694 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5695 v2 = 2; |
652 | 5696 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5697 v2 += 3; |
652 | 5698 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5699 v2 += 4; |
5700 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5701 v2 += GetItemsBonus(v8, 0); | |
5702 break; | |
5703 case PLAYER_SKILL_BODY: | |
652 | 5704 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5705 v2 = 2; |
652 | 5706 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5707 v2 += 3; |
652 | 5708 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5709 v2 += 4; |
5710 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5711 v2 += GetItemsBonus(v8, 0); | |
5712 break; | |
5713 case PLAYER_SKILL_LIGHT: | |
5714 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5715 v2 += GetItemsBonus(v8, 0); | |
5716 break; | |
5717 case PLAYER_SKILL_DARK: | |
5718 { | |
5719 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5720 v2 += GetItemsBonus(v8, 0); | |
5721 } | |
5722 break; | |
5723 | |
5724 case PLAYER_SKILL_MERCHANT: | |
5725 { | |
652 | 5726 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5727 v2 = 4; |
652 | 5728 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5729 v2 += 6; |
652 | 5730 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5731 v2 += 3; |
652 | 5732 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5733 v2 += 8; |
5734 } | |
5735 break; | |
5736 | |
5737 case PLAYER_SKILL_PERCEPTION: | |
5738 { | |
652 | 5739 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5740 v2 = 6; |
652 | 5741 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5742 v2 += 5; |
5743 } | |
5744 break; | |
5745 | |
0 | 5746 case PLAYER_SKILL_ITEM_ID: |
5747 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5748 v2 += GetItemsBonus(v8, 0); |
0 | 5749 break; |
5750 case PLAYER_SKILL_MEDITATION: | |
5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5752 v2 += GetItemsBonus(v8, 0); |
5753 break; | |
0 | 5754 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5755 { |
652 | 5756 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5757 v2 = 4; |
652 | 5758 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5759 v2 += 6; |
652 | 5760 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5761 v2 += 8; |
0 | 5762 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5763 v2 += GetItemsBonus(v8, 0); |
5764 } | |
5765 break; | |
5766 } | |
5767 | |
5768 v3 = pActiveSkills[uSkillType]; | |
1008 | 5769 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5770 result = v2 + v3; |
5771 else | |
1008 | 5772 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5773 return result; |
5774 } | |
5775 | |
5776 //----- (0048FC00) -------------------------------------------------------- | |
5777 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5778 { | |
5779 Player *v2; // esi@1 | |
5780 int v3; // eax@1 | |
5781 char v4; // di@1 | |
5782 signed int v5; // ebx@1 | |
5783 unsigned int v6; // eax@2 | |
5784 unsigned __int8 v7; // sf@5 | |
5785 unsigned __int8 v8; // of@5 | |
5786 PlayerEquipment *v9; // ebx@19 | |
5787 Player *v10; // ecx@20 | |
821 | 5788 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5789 int v12; // eax@21 |
5790 int v13; // edi@21 | |
5791 char v14; // di@25 | |
5792 signed int v15; // esi@25 | |
5793 char v16; // al@32 | |
5794 int v18; // eax@36 | |
5795 unsigned int v19; // eax@37 | |
5796 ITEM_EQUIP_TYPE v20; // edi@40 | |
5797 int v21; // edx@41 | |
5798 int v22; // eax@42 | |
821 | 5799 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5800 unsigned __int16 v24; // ax@45 |
5801 unsigned __int16 v25; // bx@45 | |
5802 unsigned int v26; // eax@45 | |
5803 unsigned __int8 v27; // sf@50 | |
5804 unsigned __int8 v28; // of@50 | |
5805 unsigned int v29; // eax@52 | |
5806 int v30; // eax@55 | |
5807 int v31; // eax@58 | |
5808 unsigned int v32; // eax@59 | |
5809 int v33; // eax@65 | |
5810 char v34; // si@65 | |
5811 ITEM_EQUIP_TYPE v35; // edi@69 | |
5812 int v36; // edx@70 | |
5813 int v37; // eax@71 | |
821 | 5814 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5815 int v39; // eax@74 |
5816 int v40; // eax@89 | |
5817 char v41; // si@89 | |
5818 int v42; // eax@96 | |
821 | 5819 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5820 int v44; // eax@97 |
5821 int v45; // eax@98 | |
5822 int v46; // eax@99 | |
5823 int v47; // eax@100 | |
5824 int v48; // eax@101 | |
5825 int v49; // eax@102 | |
5826 unsigned __int16 v50; // ax@113 | |
5827 char v51; // di@113 | |
5828 unsigned int v52; // eax@113 | |
5829 int v53; // edi@113 | |
5830 signed int i; // ecx@113 | |
5831 unsigned __int16 v55; // ax@118 | |
5832 char v56; // si@118 | |
5833 unsigned int v57; // eax@118 | |
5834 int v58; // esi@121 | |
5835 signed int j; // ecx@121 | |
5836 int v60; // edi@126 | |
5837 int v61; // eax@126 | |
5838 signed int v62; // [sp-4h] [bp-30h]@26 | |
5839 signed int v63; // [sp-4h] [bp-30h]@80 | |
5840 int v64; // [sp+Ch] [bp-20h]@104 | |
5841 int v65; // [sp+10h] [bp-1Ch]@104 | |
5842 int v66; // [sp+14h] [bp-18h]@104 | |
5843 int v67; // [sp+18h] [bp-14h]@104 | |
5844 int v68; // [sp+1Ch] [bp-10h]@69 | |
5845 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5846 int v70; // [sp+24h] [bp-8h]@1 | |
5847 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5848 int a1; // [sp+34h] [bp+8h]@21 | |
5849 int a1a; // [sp+34h] [bp+8h]@74 | |
5850 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5851 | |
5852 v2 = this; | |
5853 v70 = 0; | |
5854 v69 = 0; | |
5855 v71 = (ITEM_EQUIP_TYPE)0; | |
5856 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5857 v4 = v3; | |
5858 v5 = 1; | |
5859 if ( v3 ) | |
5860 { | |
5861 v6 = SkillToMastery(v3); | |
5862 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5863 { | |
5864 if ( (signed int)v6 >= 4 ) | |
5865 goto LABEL_4; | |
5866 v8 = __OFSUB__(v6, 3); | |
5867 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5868 } | |
5869 else | |
5870 { | |
5871 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5872 goto LABEL_11; | |
5873 if ( (signed int)v6 >= 4 ) | |
5874 { | |
5875 LABEL_4: | |
5876 v71 = (ITEM_EQUIP_TYPE)2; | |
5877 LABEL_11: | |
5878 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5879 goto LABEL_12; | |
5880 } | |
5881 v8 = __OFSUB__(v6, 2); | |
5882 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5883 } | |
5884 if ( !(v7 ^ v8) ) | |
5885 v71 = (ITEM_EQUIP_TYPE)1; | |
5886 goto LABEL_11; | |
5887 } | |
5888 LABEL_12: | |
5889 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5890 { | |
135 | 5891 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5892 v61 = v2->GetBodybuilding(); |
5893 return v60 * v61; | |
5894 } | |
5895 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5896 { | |
135 | 5897 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5898 v61 = v2->GetMeditation(); |
0 | 5899 return v60 * v61; |
5900 } | |
5901 if ( a2 != 9 ) | |
5902 { | |
5903 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5904 { | |
5905 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5906 return v70; | |
5907 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5908 { | |
5909 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5910 return v70; | |
5911 v71 = (ITEM_EQUIP_TYPE)0; | |
5912 v9 = &v2->pEquipment; | |
5913 while ( 1 ) | |
5914 { | |
5915 if ( v2->HasItemEquipped(v71) ) | |
5916 { | |
118 | 5917 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5918 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5919 a1 = v12; |
5920 SkillToMastery(v12); | |
5921 v13 = v11 - 5; | |
5922 if ( !v13 ) | |
5923 return a1 & 0x3F; | |
5924 if ( v13 == 2 ) | |
5925 break; | |
5926 } | |
5927 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5928 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5929 if ( (signed int)v71 >= 16 ) | |
5930 return v70; | |
5931 } | |
5932 v14 = a1; | |
5933 v15 = 1; | |
5934 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5935 { | |
5936 v62 = 5; | |
5937 goto LABEL_31; | |
5938 } | |
5939 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5940 { | |
5941 v62 = 3; | |
5942 goto LABEL_31; | |
5943 } | |
5944 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5945 goto LABEL_32; | |
5946 goto LABEL_30; | |
5947 } | |
5948 if ( v2->IsUnarmed() ) | |
5949 { | |
5950 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5951 v14 = v18; | |
5952 if ( !v18 ) | |
5953 return v70; | |
5954 v15 = 0; | |
5955 v19 = SkillToMastery(v18); | |
5956 if ( (signed int)v19 < 3 ) | |
5957 { | |
5958 if ( (signed int)v19 >= 2 ) | |
5959 v15 = 1; | |
5960 LABEL_32: | |
5961 v16 = v14; | |
5962 return v15 * (v16 & 0x3F); | |
5963 } | |
5964 LABEL_30: | |
5965 v62 = 2; | |
5966 LABEL_31: | |
5967 v15 = v62; | |
5968 goto LABEL_32; | |
5969 } | |
5970 v20 = (ITEM_EQUIP_TYPE)0; | |
5971 while ( 1 ) | |
5972 { | |
5973 if ( v2->HasItemEquipped(v20) ) | |
5974 { | |
118 | 5975 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5976 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5977 break; | |
5978 } | |
5979 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5980 if ( (signed int)v20 >= 16 ) | |
5981 return v70; | |
5982 } | |
5983 v71 = (ITEM_EQUIP_TYPE)0; | |
5984 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5985 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5986 v25 = v24; | |
5987 v26 = SkillToMastery(v24); | |
5988 if ( !v23 ) | |
5989 { | |
5990 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5991 { | |
5992 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5993 LOBYTE(v25) = v31; | |
5994 if ( v31 ) | |
5995 { | |
5996 v15 = 0; | |
5997 v32 = SkillToMastery(v31); | |
5998 if ( (signed int)v32 < 3 ) | |
5999 { | |
6000 if ( (signed int)v32 >= 2 ) | |
6001 v15 = 1; | |
6002 } | |
6003 else | |
6004 { | |
6005 v15 = 2; | |
6006 } | |
6007 v16 = v25; | |
6008 return v15 * (v16 & 0x3F); | |
6009 } | |
6010 } | |
6011 goto LABEL_55; | |
6012 } | |
6013 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6014 { | |
6015 v29 = SkillToMastery(v25); | |
6016 v28 = __OFSUB__(v29, 4); | |
6017 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6018 } | |
6019 else | |
6020 { | |
6021 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6022 goto LABEL_55; | |
6023 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6024 { | |
6025 if ( v23 == PLAYER_SKILL_MACE ) | |
6026 { | |
6027 v28 = __OFSUB__(v26, 2); | |
118 | 6028 v27 = v26 - 2 < 0; |
0 | 6029 goto LABEL_53; |
6030 } | |
6031 LABEL_55: | |
6032 v30 = v71 * (v25 & 0x3F); | |
6033 return (int)((char *)v69 + v30); | |
6034 } | |
6035 v28 = __OFSUB__(v26, 3); | |
118 | 6036 v27 = v26 - 3 < 0; |
0 | 6037 } |
6038 LABEL_53: | |
6039 if ( !(v27 ^ v28) ) | |
6040 v71 = (ITEM_EQUIP_TYPE)1; | |
6041 goto LABEL_55; | |
6042 } | |
6043 if ( v2->IsUnarmed() == 1 ) | |
6044 { | |
6045 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6046 v34 = v33; | |
6047 if ( !v33 ) | |
6048 return v70; | |
6049 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6050 v5 = 2; | |
6051 v30 = v5 * (v34 & 0x3F); | |
6052 return (int)((char *)v69 + v30); | |
6053 } | |
6054 v35 = (ITEM_EQUIP_TYPE)0; | |
6055 v68 = 0; | |
6056 while ( 1 ) | |
6057 { | |
6058 if ( v2->HasItemEquipped(v35) ) | |
6059 { | |
118 | 6060 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6061 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6062 break; | |
6063 } | |
6064 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6065 if ( (signed int)v35 >= 16 ) | |
6066 return v70; | |
6067 } | |
6068 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6069 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6070 a1a = v39; | |
6071 SkillToMastery(v39); | |
6072 v71 = (ITEM_EQUIP_TYPE)0; | |
6073 if ( v38 ) | |
6074 { | |
6075 if ( (signed int)v38 > 0 ) | |
6076 { | |
6077 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6078 { | |
6079 v71 = (ITEM_EQUIP_TYPE)1; | |
6080 } | |
6081 else | |
6082 { | |
6083 if ( v38 == 7 ) | |
6084 { | |
6085 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6086 { | |
6087 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6088 { | |
6089 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6090 return v5 * (a1a & 0x3F); | |
6091 v63 = 2; | |
6092 } | |
6093 else | |
6094 { | |
6095 v63 = 3; | |
6096 } | |
6097 } | |
6098 else | |
6099 { | |
6100 v63 = 5; | |
6101 } | |
6102 v5 = v63; | |
6103 return v5 * (a1a & 0x3F); | |
6104 } | |
6105 } | |
6106 } | |
6107 } | |
6108 else | |
6109 { | |
6110 v71 = (ITEM_EQUIP_TYPE)1; | |
6111 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6112 { | |
6113 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6114 v41 = v40; | |
6115 if ( v40 ) | |
6116 { | |
6117 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6118 v5 = 2; | |
6119 v68 = v5 * (v41 & 0x3F); | |
6120 } | |
6121 } | |
6122 } | |
6123 v30 = v68 + v71 * (a1a & 0x3F); | |
6124 return (int)((char *)v69 + v30); | |
6125 } | |
6126 a1b = 0; | |
6127 v71 = (ITEM_EQUIP_TYPE)0; | |
6128 v68 = 16; | |
6129 v69 = &v2->pEquipment; | |
6130 do | |
6131 { | |
898 | 6132 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6133 goto LABEL_117; |
6134 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6135 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6136 if ( !v44 ) | |
6137 { | |
6138 v64 = 0; | |
6139 v65 = 1; | |
6140 LABEL_111: | |
6141 v66 = 0; | |
6142 goto LABEL_112; | |
6143 } | |
6144 v45 = v44 - 1; | |
6145 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6146 { | |
6147 v64 = 0; | |
6148 v65 = 0; | |
6149 v66 = 0; | |
6150 v67 = 1; | |
6151 goto LABEL_113; | |
6152 } | |
6153 v47 = v46 - 4; | |
6154 if ( v47 ) | |
6155 { | |
6156 v48 = v47 - 1; | |
6157 if ( v48 ) | |
6158 { | |
6159 v49 = v48 - 1; | |
6160 if ( v49 ) | |
6161 { | |
6162 if ( v49 != 1 ) | |
6163 goto LABEL_117; | |
6164 a1b = 1; | |
6165 v64 = 1; | |
6166 v65 = 0; | |
6167 v66 = 0; | |
6168 v67 = 0; | |
6169 goto LABEL_113; | |
6170 } | |
6171 a1b = 1; | |
6172 v64 = 1; | |
6173 v65 = 0; | |
6174 goto LABEL_111; | |
6175 } | |
6176 v71 = (ITEM_EQUIP_TYPE)1; | |
6177 } | |
6178 else | |
6179 { | |
6180 a1b = 1; | |
6181 } | |
6182 v64 = 1; | |
6183 v65 = 0; | |
6184 v66 = 1; | |
6185 LABEL_112: | |
6186 v67 = 0; | |
6187 LABEL_113: | |
6188 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6189 v51 = v50; | |
6190 v52 = SkillToMastery(v50); | |
6191 v53 = v51 & 0x3F; | |
6192 for ( i = 0; i < (signed int)v52; ++i ) | |
6193 { | |
6194 if ( *(&v64 + i) ) | |
6195 v70 += v53; | |
6196 } | |
6197 LABEL_117: | |
6198 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6199 --v68; | |
6200 } | |
6201 while ( v68 ); | |
6202 v64 = 1; | |
6203 v65 = 1; | |
6204 v66 = 1; | |
6205 v67 = 0; | |
6206 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6207 v56 = v55; | |
6208 v57 = SkillToMastery(v55); | |
6209 if ( !a1b && (!v71 || v57 == 4) ) | |
6210 { | |
6211 v58 = v56 & 0x3F; | |
6212 for ( j = 0; j < (signed int)v57; ++j ) | |
6213 { | |
6214 if ( *(&v64 + j) ) | |
6215 v70 += v58; | |
6216 } | |
6217 } | |
6218 return v70; | |
6219 } | |
6220 | |
6221 //----- (00490109) -------------------------------------------------------- | |
6222 // faces are: 0 1 2 3 human males | |
6223 // 4 5 6 7 human females | |
6224 // 8 9 elf males | |
6225 // 10 11 elf females | |
6226 // 12 13 dwarf males | |
6227 // 14 15 dwarf females | |
6228 // 16 17 goblin males | |
6229 // 18 19 goblin females | |
6230 // 20 lich male | |
6231 // 21 lich female | |
6232 // 22 underwater suits (unused) | |
6233 // 23 zombie male | |
6234 // 24 zombie female | |
6235 enum CHARACTER_RACE Player::GetRace() | |
6236 { | |
1014 | 6237 if ( uCurrentFace > 15 ) |
6238 { | |
6239 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6240 return CHARACTER_RACE_GOBLIN; |
6241 } | |
6242 else | |
6243 { | |
1014 | 6244 if ( uCurrentFace >= 12 ) |
0 | 6245 { |
6246 return CHARACTER_RACE_DWARF; | |
6247 } | |
6248 else | |
6249 { | |
1014 | 6250 |
6251 if ( uCurrentFace <= 7 ) | |
0 | 6252 { |
6253 return CHARACTER_RACE_HUMAN; | |
6254 } | |
6255 else | |
6256 { | |
1014 | 6257 if ( uCurrentFace <= 11 ) |
0 | 6258 return CHARACTER_RACE_ELF; |
6259 } | |
6260 } | |
6261 } | |
6262 return CHARACTER_RACE_HUMAN; | |
6263 } | |
6264 | |
6265 //----- (00490141) -------------------------------------------------------- | |
187 | 6266 PLAYER_SEX Player::GetSexByVoice() |
0 | 6267 { |
6268 signed int result; // eax@1 | |
6269 | |
6270 result = 0; | |
6271 switch ( this->uVoiceID ) | |
6272 { | |
6273 case 0u: | |
6274 case 1u: | |
6275 case 2u: | |
6276 case 3u: | |
6277 case 8u: | |
6278 case 9u: | |
6279 case 0xCu: | |
6280 case 0xDu: | |
6281 case 0x10u: | |
6282 case 0x11u: | |
6283 case 0x14u: | |
6284 case 0x17u: | |
187 | 6285 return SEX_MALE; |
6286 | |
0 | 6287 case 4u: |
6288 case 5u: | |
6289 case 6u: | |
6290 case 7u: | |
6291 case 0xAu: | |
6292 case 0xBu: | |
6293 case 0xEu: | |
6294 case 0xFu: | |
6295 case 0x12u: | |
6296 case 0x13u: | |
6297 case 0x15u: | |
6298 case 0x18u: | |
187 | 6299 return SEX_FEMALE; |
6300 | |
0 | 6301 default: |
187 | 6302 assert(false); |
6303 } | |
0 | 6304 } |
6305 | |
6306 //----- (00490188) -------------------------------------------------------- | |
6307 void Player::SetInitialStats() | |
6308 { | |
6309 auto v1 = GetRace(); | |
290 | 6310 uMight = StatTable[v1][0].uBaseValue; |
6311 uIntelligence = StatTable[v1][1].uBaseValue; | |
6312 uWillpower = StatTable[v1][2].uBaseValue; | |
6313 uEndurance = StatTable[v1][3].uBaseValue; | |
6314 uAccuracy = StatTable[v1][4].uBaseValue; | |
6315 uSpeed = StatTable[v1][5].uBaseValue; | |
6316 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6317 } |
6318 | |
6319 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6320 void Player::SetSexByVoice() |
6321 { | |
6322 switch ( this->uVoiceID) | |
0 | 6323 { |
6324 case 0: | |
6325 case 1: | |
6326 case 2: | |
6327 case 3: | |
6328 case 8: | |
6329 case 9: | |
6330 case 0xC: | |
6331 case 0xD: | |
6332 case 0x10: | |
6333 case 0x11: | |
6334 case 0x14: | |
6335 case 0x17: | |
1021 | 6336 this->uSex = SEX_MALE; |
0 | 6337 break; |
6338 case 4: | |
6339 case 5: | |
6340 case 6: | |
6341 case 7: | |
6342 case 0xA: | |
6343 case 0xB: | |
6344 case 0xE: | |
6345 case 0xF: | |
6346 case 0x12: | |
6347 case 0x13: | |
6348 case 0x15: | |
6349 case 0x18: | |
1021 | 6350 this->uSex = SEX_FEMALE; |
0 | 6351 break; |
6352 default: | |
6353 break; | |
6354 } | |
1021 | 6355 |
0 | 6356 } |
6357 | |
6358 //----- (0049024A) -------------------------------------------------------- | |
135 | 6359 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6360 { |
6361 sLevelModifier = 0; | |
6362 sAgeModifier = 0; | |
6363 | |
135 | 6364 classType = cls; |
0 | 6365 uLuckBonus = 0; |
6366 uSpeedBonus = 0; | |
6367 uAccuracyBonus = 0; | |
6368 uEnduranceBonus = 0; | |
6369 uWillpowerBonus = 0; | |
6370 uIntelligenceBonus = 0; | |
6371 uMightBonus = 0; | |
6372 uLevel = 1; | |
6373 uExperience = 251 + rand() % 100; | |
6374 uBirthYear = 1147 - rand() % 6; | |
6375 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6376 memset(_guilds_member_bits, 0, 64); |
0 | 6377 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6378 | |
6379 for (uint i = 0; i < 37; ++i) | |
6380 { | |
135 | 6381 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6382 continue; |
6383 | |
6384 pActiveSkills[i] = 1; | |
6385 | |
6386 switch (i) | |
6387 { | |
886 | 6388 case PLAYER_SKILL_FIRE: |
6389 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6390 |
6391 extern bool all_magic; | |
6392 if ( all_magic == true ) | |
6393 { | |
6394 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6395 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6396 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6397 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6398 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6399 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6400 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6401 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6402 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6403 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6404 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6405 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6406 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6407 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6408 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6409 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6410 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6411 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6412 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6413 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6414 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6415 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6416 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6417 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6418 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6419 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6420 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6421 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6422 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6423 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6424 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6425 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6426 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6427 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6428 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6429 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6430 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6431 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6432 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6433 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6434 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6435 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6436 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6437 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6438 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6439 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6440 } | |
486 | 6441 break; |
886 | 6442 case PLAYER_SKILL_AIR: |
6443 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6444 break; | |
6445 case PLAYER_SKILL_WATER: | |
6446 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6447 break; | |
6448 case PLAYER_SKILL_EARTH: | |
6449 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6450 break; | |
6451 case PLAYER_SKILL_SPIRIT: | |
6452 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6453 break; | |
6454 case PLAYER_SKILL_MIND: | |
6455 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6456 break; | |
6457 case PLAYER_SKILL_BODY: | |
6458 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6459 |
6460 if ( all_magic == true ) | |
6461 { | |
6462 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6463 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6464 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6465 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6466 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6467 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6468 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6469 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6470 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6471 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6472 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6473 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6474 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6475 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6476 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6477 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6478 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6479 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6480 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6481 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6482 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6483 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6484 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6485 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6486 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6487 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6488 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6489 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6490 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6491 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6492 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6493 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6494 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6495 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6496 } | |
569 | 6497 break; |
886 | 6498 case PLAYER_SKILL_LIGHT: |
6499 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6500 break; | |
6501 case PLAYER_SKILL_DARK: | |
6502 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6503 break; | |
0 | 6504 } |
6505 } | |
6506 | |
6507 sHealth = GetMaxHealth(); | |
6508 sMana = GetMaxMana(); | |
6509 } | |
6510 | |
6511 //----- (004903C9) -------------------------------------------------------- | |
821 | 6512 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6513 { | |
6514 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6515 int v3; // edx@5 |
6516 char *v4; // ecx@5 | |
6517 int v5; // esi@11 | |
6518 unsigned __int16 *v6; // edx@11 | |
6519 int v7; // esi@18 | |
6520 unsigned __int16 *pActiveSkill; // edx@18 | |
6521 | |
6522 if ( order >= 0 ) | |
6523 { | |
6524 if ( order <= 1 ) | |
6525 { | |
6526 result = (PLAYER_SKILL_TYPE)0; | |
6527 v7 = 0; | |
6528 pActiveSkill = this->pActiveSkills; | |
6529 do | |
6530 { | |
135 | 6531 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6532 { |
6533 if ( v7 == order ) | |
6534 return result; | |
6535 ++v7; | |
6536 } | |
6537 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6538 ++pActiveSkill; | |
6539 } | |
6540 while ( (signed int)result < 37 ); | |
6541 } | |
6542 else | |
6543 { | |
6544 if ( order <= 3 ) | |
6545 { | |
6546 result = (PLAYER_SKILL_TYPE)0; | |
6547 v5 = 0; | |
6548 pActiveSkill = this->pActiveSkills; | |
6549 do | |
6550 { | |
135 | 6551 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6552 { |
6553 if ( v5 == order - 2 ) | |
6554 return result; | |
6555 ++v5; | |
6556 } | |
6557 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6558 ++pActiveSkill; | |
6559 } | |
6560 while ( (signed int)result < 37 ); | |
6561 } | |
6562 else | |
6563 { | |
6564 if ( order <= 12 ) | |
6565 { | |
6566 result = (PLAYER_SKILL_TYPE)0; | |
6567 v3 = 0; | |
135 | 6568 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6569 do |
6570 { | |
6571 if ( *v4 == 1 ) | |
6572 { | |
6573 if ( v3 == order - 4 ) | |
6574 return result; | |
6575 ++v3; | |
6576 } | |
6577 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6578 ++v4; | |
6579 } | |
6580 while ( (signed int)result < 37 ); | |
6581 } | |
6582 } | |
6583 } | |
6584 } | |
6585 return (PLAYER_SKILL_TYPE)37; | |
6586 } | |
6587 | |
6588 | |
6589 | |
6590 //----- (0049048D) -------------------------------------------------------- | |
6591 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6592 void Player::DecreaseAttribute(int eAttribute) | |
6593 { | |
6594 int v2; // eax@1 | |
6595 int pBaseValue; // ecx@1 | |
6596 int pDroppedStep; // ebx@1 | |
6597 int pStep; // esi@1 | |
6598 unsigned __int16 result; // ax@7 | |
6599 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6600 | |
6601 v2 = eAttribute + 7 * GetRace(); | |
290 | 6602 pBaseValue = StatTable[0][v2].uBaseValue; |
6603 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6604 uMinValue = pBaseValue - 2; |
290 | 6605 pStep = StatTable[0][v2].uBaseStep; |
0 | 6606 switch ( eAttribute ) |
6607 { | |
6608 case CHARACTER_MIGHT: | |
6609 if ( this->uMight <= pBaseValue ) | |
6610 pStep = pDroppedStep; | |
6611 if ( this->uMight - pStep >= uMinValue ) | |
6612 this->uMight -= pStep; | |
6613 break; | |
6614 case CHARACTER_INTELLIGANCE: | |
6615 if ( this->uIntelligence <= pBaseValue ) | |
6616 pStep = pDroppedStep; | |
6617 if ( this->uIntelligence - pStep >= uMinValue ) | |
6618 this->uIntelligence -= pStep; | |
6619 break; | |
6620 case CHARACTER_WILLPOWER: | |
6621 if ( this->uWillpower <= pBaseValue ) | |
6622 pStep = pDroppedStep; | |
6623 if ( this->uWillpower - pStep >= uMinValue ) | |
6624 this->uWillpower -= pStep; | |
6625 break; | |
6626 case CHARACTER_ENDURANCE: | |
6627 if ( this->uEndurance <= pBaseValue ) | |
6628 pStep = pDroppedStep; | |
6629 if ( this->uEndurance - pStep >= uMinValue ) | |
6630 this->uEndurance -= pStep; | |
6631 break; | |
6632 case CHARACTER_ACCURACY: | |
6633 if ( this->uAccuracy <= pBaseValue ) | |
6634 pStep = pDroppedStep; | |
6635 if ( this->uAccuracy - pStep >= uMinValue ) | |
6636 this->uAccuracy -= pStep; | |
6637 break; | |
6638 case CHARACTER_SPEED: | |
6639 if ( this->uSpeed <= pBaseValue ) | |
6640 pStep = pDroppedStep; | |
6641 if ( this->uSpeed - pStep >= uMinValue ) | |
6642 this->uSpeed -= pStep; | |
6643 break; | |
6644 case CHARACTER_LUCK: | |
6645 if ( this->uLuck <= pBaseValue ) | |
6646 pStep = pDroppedStep; | |
6647 if ( this->uLuck - pStep >= uMinValue ) | |
6648 this->uLuck -= pStep; | |
6649 break; | |
6650 } | |
6651 } | |
6652 | |
6653 //----- (004905F5) -------------------------------------------------------- | |
6654 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6655 int Player::IncreaseAttribute(int eAttribute) | |
6656 { | |
6657 Player *v2; // esi@1 | |
6658 int v3; // eax@1 | |
6659 int v4; // ebx@1 | |
6660 signed int v5; // edi@1 | |
6661 int v6; // eax@8 | |
6662 signed int v7; // eax@17 | |
6663 signed int result; // eax@18 | |
6664 int v9; // [sp+Ch] [bp-8h]@1 | |
6665 signed int v10; // [sp+10h] [bp-4h]@1 | |
6666 | |
6667 v2 = this; | |
6668 v3 = eAttribute + 7 * GetRace(); | |
290 | 6669 v4 = StatTable[0][v3].uMaxValue; |
6670 v5 = StatTable[0][v3].uBaseStep; | |
6671 v9 = StatTable[0][v3].uBaseValue; | |
6672 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6673 PlayerCreation_ComputeAttributeBonus(); |
6674 if ( eAttribute ) | |
6675 { | |
6676 switch ( eAttribute ) | |
6677 { | |
6678 case 1: | |
6679 v6 = v2->uIntelligence; | |
6680 break; | |
6681 case 2: | |
6682 v6 = v2->uWillpower; | |
6683 break; | |
6684 case 3: | |
6685 v6 = v2->uEndurance; | |
6686 break; | |
6687 case 4: | |
6688 v6 = v2->uAccuracy; | |
6689 break; | |
6690 case 5: | |
6691 v6 = v2->uSpeed; | |
6692 break; | |
6693 case 6: | |
6694 v6 = v2->uLuck; | |
6695 break; | |
6696 default: | |
6697 v6 = eAttribute; | |
6698 break; | |
6699 } | |
6700 } | |
6701 else | |
6702 { | |
6703 v6 = v2->uMight; | |
6704 } | |
6705 if ( v6 < v9 ) | |
6706 { | |
6707 v7 = v5; | |
6708 v5 = v10; | |
6709 v10 = v7; | |
6710 } | |
6711 result = PlayerCreation_ComputeAttributeBonus(); | |
6712 if ( result >= v10 ) | |
6713 { | |
6714 if ( eAttribute ) | |
6715 { | |
6716 switch ( eAttribute ) | |
6717 { | |
6718 case 1: | |
6719 result = (signed int)&v2->uIntelligence; | |
6720 break; | |
6721 case 2: | |
6722 result = (signed int)&v2->uWillpower; | |
6723 break; | |
6724 case 3: | |
6725 result = (signed int)&v2->uEndurance; | |
6726 break; | |
6727 case 4: | |
6728 result = (signed int)&v2->uAccuracy; | |
6729 break; | |
6730 case 5: | |
6731 result = (signed int)&v2->uSpeed; | |
6732 break; | |
6733 default: | |
6734 result = eAttribute - 6; | |
6735 if ( eAttribute != 6 ) | |
6736 return result; | |
6737 result = (signed int)&v2->uLuck; | |
6738 break; | |
6739 } | |
6740 } | |
6741 else | |
6742 { | |
6743 result = (signed int)&v2->uMight; | |
6744 } | |
6745 if ( v5 + *(short *)result <= v4 ) | |
6746 *(short *)result += v5; | |
6747 } | |
6748 return result; | |
6749 } | |
6750 | |
6751 //----- (0049070F) -------------------------------------------------------- | |
6752 void Player::Zero() | |
6753 { | |
6754 Player *v1; // esi@1 | |
6755 | |
6756 v1 = this; | |
6757 this->sLevelModifier = 0; | |
6758 this->sACModifier = 0; | |
6759 this->uLuckBonus = 0; | |
6760 this->uAccuracyBonus = 0; | |
6761 this->uSpeedBonus = 0; | |
6762 this->uEnduranceBonus = 0; | |
6763 this->uWillpowerBonus = 0; | |
6764 this->uIntelligenceBonus = 0; | |
6765 this->uMightBonus = 0; | |
6766 this->field_100 = 0; | |
6767 this->field_FC = 0; | |
6768 this->field_F8 = 0; | |
6769 this->field_F4 = 0; | |
6770 this->field_F0 = 0; | |
6771 this->field_EC = 0; | |
6772 this->field_E8 = 0; | |
6773 this->field_E4 = 0; | |
6774 this->field_E0 = 0; | |
766 | 6775 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6776 v1->field_1A97 = 0; |
6777 v1->_ranged_dmg_bonus = 0; | |
6778 v1->field_1A95 = 0; | |
6779 v1->_ranged_atk_bonus = 0; | |
6780 v1->field_1A93 = 0; | |
6781 v1->_melee_dmg_bonus = 0; | |
6782 v1->field_1A91 = 0; | |
6783 v1->_some_attack_bonus = 0; | |
6784 v1->_mana_related = 0; | |
6785 v1->uFullManaBonus = 0; | |
6786 v1->_health_related = 0; | |
6787 v1->uFullHealthBonus = 0; | |
6788 } | |
6789 | |
6790 //----- (004907E7) -------------------------------------------------------- | |
299 | 6791 unsigned int Player::GetStatColor(int uStat) |
0 | 6792 { |
6793 __int16 uWhite; // si@1 | |
290 | 6794 int attribute_value; // edx@1 |
299 | 6795 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6796 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6797 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6798 | |
1014 | 6799 uRed = TargetColor(255, 35, 0); |
6800 uGreen = TargetColor(0, 255, 0); | |
6801 uWhite = TargetColor(255, 255, 255); | |
299 | 6802 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6803 |
0 | 6804 switch (uStat) |
6805 { | |
6806 case 0: attribute_value = uMight; break; | |
6807 case 1: attribute_value = uIntelligence; break; | |
6808 case 2: attribute_value = uWillpower; break; | |
6809 case 3: attribute_value = uEndurance; break; | |
290 | 6810 case 4: attribute_value = uAccuracy; break; |
6811 case 5: attribute_value = uSpeed; break; | |
0 | 6812 case 6: attribute_value = uLuck; break; |
6813 }; | |
6814 | |
299 | 6815 if ( attribute_value == pBaseAttrValue ) |
290 | 6816 return uWhite; |
299 | 6817 else if ( attribute_value > pBaseAttrValue ) |
290 | 6818 return uGreen; |
0 | 6819 else |
290 | 6820 return uRed; |
0 | 6821 } |
6822 | |
6823 //----- (004908A8) -------------------------------------------------------- | |
6824 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6825 { | |
1014 | 6826 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6827 { | |
6828 pConditions[uCondition]=0i64; | |
6829 return true; | |
0 | 6830 } |
6831 else | |
1014 | 6832 return false; |
0 | 6833 } |
6834 | |
6835 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6836 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6837 { |
6838 Player *v3; // esi@1 | |
6839 unsigned int v4; // ebx@4 | |
6840 signed int v5; // eax@17 | |
6841 unsigned int v6; // eax@26 | |
6842 unsigned __int8 v7; // cf@37 | |
6843 int v8; // edx@39 | |
6844 int v9; // edx@40 | |
6845 int v10; // edx@41 | |
6846 int v11; // edx@42 | |
6847 int v12; // edx@43 | |
6848 char *v13; // eax@45 | |
6849 AudioPlayer *v14; // ecx@62 | |
6850 signed int v15; // edi@68 | |
6851 int v16; // edx@73 | |
6852 unsigned __int16 v17; // edi@73 | |
6853 unsigned int v18; // eax@73 | |
6854 int v19; // eax@74 | |
6855 int v20; // eax@75 | |
6856 signed int v21; // eax@81 | |
6857 const char *v22; // eax@84 | |
6858 char *v23; // ecx@90 | |
6859 int scroll_id; // esi@96 | |
6860 int v25; // eax@109 | |
6861 int v26; // eax@113 | |
6862 int new_mana_val; // edi@114 | |
6863 signed __int64 v28; // qax@120 | |
6864 char *v29; // ecx@120 | |
6865 __int64 v30; // edi@137 | |
6866 int v31; // ST30_4@137 | |
6867 __int64 v32; // ST3C_4@137 | |
6868 int v33; // ST40_4@137 | |
6869 __int64 v34; // ST34_4@137 | |
6870 int v35; // ST38_4@137 | |
6871 unsigned __int8 v36; // al@173 | |
6872 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6873 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6874 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6875 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6876 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6877 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6878 signed int v43; // [sp-14h] [bp-40h]@18 | |
6879 signed int v44; // [sp-14h] [bp-40h]@174 | |
6880 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6881 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6882 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6883 int v48; // [sp-Ch] [bp-38h]@18 | |
6884 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6885 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6886 int v51; // [sp-Ch] [bp-38h]@174 | |
6887 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6888 char *v53; // [sp-8h] [bp-34h]@33 | |
6889 int v54; // [sp-8h] [bp-34h]@34 | |
6890 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6891 int v56; // [sp-8h] [bp-34h]@66 | |
6892 const char *v57; // [sp-8h] [bp-34h]@69 | |
6893 const char *v58; // [sp-8h] [bp-34h]@89 | |
6894 int v59; // [sp-8h] [bp-34h]@120 | |
6895 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6896 int v61; // [sp-4h] [bp-30h]@18 | |
6897 char *v62; // [sp-4h] [bp-30h]@33 | |
6898 char *v63; // [sp-4h] [bp-30h]@34 | |
6899 int v64; // [sp-4h] [bp-30h]@60 | |
6900 int v65; // [sp-4h] [bp-30h]@66 | |
6901 const char *v66; // [sp-4h] [bp-30h]@69 | |
6902 signed int v67; // [sp-4h] [bp-30h]@77 | |
6903 const char *v68; // [sp-4h] [bp-30h]@89 | |
6904 int v69; // [sp-4h] [bp-30h]@110 | |
6905 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6906 int v71; // [sp-4h] [bp-30h]@174 | |
6907 char v72; // [sp+20h] [bp-Ch]@68 | |
6908 signed int v73; // [sp+24h] [bp-8h]@1 | |
6909 char *v74; // [sp+24h] [bp-8h]@23 | |
6910 int v75; // [sp+24h] [bp-8h]@73 | |
6911 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6912 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6913 | |
6914 thisb = this; | |
6915 v3 = &pParty->pPlayers[player_num-1]; | |
6916 v73 = 1; | |
6917 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6918 return; | |
6919 v4 = 0; | |
6920 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6921 { |
1021 | 6922 if ( pParty->pPickedItem.uItemID == 160 ) |
6923 { | |
6924 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6925 } | |
6926 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6927 { |
1021 | 6928 new_mana_val = v3->sMana; |
6929 new_mana_val += 2; | |
6930 if ( new_mana_val > v3->GetMaxMana() ) | |
6931 new_mana_val = v3->GetMaxMana(); | |
6932 v3->PlaySound(SPEECH_36, 0); | |
6933 } | |
6934 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6935 { | |
6936 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6937 v3->PlaySound(SPEECH_36, 0); |
1021 | 6938 |
6939 } | |
6940 else | |
6941 { | |
6942 v68 = pParty->pPickedItem.GetDisplayName(); | |
6943 v58 = pGlobalTXT_LocalizationStrings[36];//"%s can not be used that way" | |
6944 sprintfex(pTmpBuf, v58, v68); | |
6945 ShowStatusBarString(pTmpBuf, 2); | |
6946 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
6947 return; | |
1019 | 6948 } |
6949 goto LABEL_173; | |
1021 | 6950 |
6951 } | |
6952 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6953 { |
1021 | 6954 switch ( pParty->pPickedItem.uItemID ) |
6955 { | |
6956 case 221: //Catalyst | |
6957 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6958 break; | |
6959 case 222: //Cure Wounds | |
6960 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6961 pParty->pPlayers[player_num-1].Heal(v25); | |
6962 v3->PlaySound(SPEECH_36, 0); | |
6963 break; | |
6964 case 223: //Magic Potion | |
6965 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6966 new_mana_val = v3->sMana; | |
6967 new_mana_val += v26; | |
6968 if ( new_mana_val > v3->GetMaxMana() ) | |
6969 new_mana_val = v3->GetMaxMana(); | |
6970 v3->PlaySound(SPEECH_36, 0); | |
6971 break; | |
6972 case 224: //Cure Weakness | |
6973 v3->pConditions[Condition_Weak] = 0i64; | |
6974 v3->PlaySound(SPEECH_36, 0); | |
6975 break; | |
6976 case 225: //Cure Disease | |
6977 v3->pConditions[Condition_Disease3] = 0i64; | |
6978 v3->pConditions[Condition_Disease2] = 0i64; | |
6979 v3->pConditions[Condition_Disease1] = 0i64; | |
6980 v3->PlaySound(SPEECH_36, 0); | |
6981 break; | |
6982 case 226: //Cure Poison | |
6983 v3->pConditions[Condition_Poison3] = 0i64; | |
6984 v3->pConditions[Condition_Poison2] = 0i64; | |
6985 v3->pConditions[Condition_Poison1] = 0i64; | |
6986 v3->PlaySound(SPEECH_36, 0); | |
6987 break; | |
6988 case 227: //Awaken | |
6989 v3->pConditions[Condition_Sleep] = 0i64; | |
6990 v3->PlaySound(SPEECH_36, 0); | |
6991 break; | |
6992 case 228: //Haste | |
6993 if ( !v3->pConditions[Condition_Weak] ) | |
6994 { | |
6995 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6996 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6997 v3->PlaySound(SPEECH_36, 0); | |
6998 } | |
6999 break; | |
7000 case 229: //Heroism | |
7001 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7002 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
7003 v3->PlaySound(SPEECH_36, 0); | |
7004 break; | |
7005 case 230: //Bless | |
7006 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7007 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
7008 v3->PlaySound(SPEECH_36, 0); | |
7009 break; | |
7010 case 231: //Preservation | |
7011 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7012 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7013 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7014 v3->PlaySound(SPEECH_36, 0); | |
7015 break; | |
7016 case 232: //Shield | |
7017 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7018 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7019 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7020 v3->PlaySound(SPEECH_36, 0); | |
7021 break; | |
7022 case 234: //Stoneskin | |
7023 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7024 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
7025 v3->PlaySound(SPEECH_36, 0); | |
7026 break; | |
7027 case 235: //Water Breathing | |
7028 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
7029 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
7030 break; | |
7031 case 237: //Remove Fear | |
7032 v3->pConditions[Condition_Fear] = 0i64; | |
7033 v3->PlaySound(SPEECH_36, 0); | |
7034 break; | |
7035 case 238: //Remove Curse | |
7036 v3->pConditions[Condition_Cursed] = 0i64; | |
7037 v3->PlaySound(SPEECH_36, 0); | |
7038 break; | |
7039 case 239: //Cure Insanity | |
7040 v3->pConditions[Condition_Insane] = 0i64; | |
7041 v3->PlaySound(SPEECH_36, 0); | |
7042 break; | |
7043 case 240: //Might Boost | |
7044 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7045 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7046 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7047 v3->PlaySound(SPEECH_36, 0); | |
7048 break; | |
7049 case 241: //Intellect Boost | |
7050 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7051 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7052 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7053 v3->PlaySound(SPEECH_36, 0); | |
7054 break; | |
7055 case 242: //Personality Boost | |
7056 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7057 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7058 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7059 v3->PlaySound(SPEECH_36, 0); | |
7060 break; | |
7061 case 243://Endurance Boost | |
7062 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7063 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7064 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7065 v3->PlaySound(SPEECH_36, 0); | |
7066 break; | |
7067 case 244: //Speed Boost | |
7068 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7069 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7070 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7071 v3->PlaySound(SPEECH_36, 0); | |
7072 break; | |
7073 case 245: //Accuracy Boost | |
7074 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7075 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7076 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7077 v3->PlaySound(SPEECH_36, 0); | |
7078 break; | |
7079 case 251: //Cure Paralysis | |
7080 v3->pConditions[Condition_Paralyzed] = 0i64; | |
7081 v3->PlaySound(SPEECH_36, 0); | |
7082 break; | |
7083 case 252://Divine Restoration | |
7084 v30 = v3->pConditions[Condition_Dead]; | |
7085 v32 = v3->pConditions[Condition_Pertified]; | |
7086 v34 = v3->pConditions[Condition_Eradicated]; | |
7087 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
7088 v3->pConditions[Condition_Dead] = v30; | |
7089 v3->pConditions[Condition_Pertified] = v32; | |
7090 v3->pConditions[Condition_Eradicated] = v34; | |
7091 v3->PlaySound(SPEECH_36, 0); | |
7092 break; | |
7093 case 253: //Divine Cure | |
7094 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
7095 pParty->pPlayers[player_num-1].Heal(v25); | |
7096 v3->PlaySound(SPEECH_36, 0); | |
7097 break; | |
7098 case 254: //Divine Power | |
7099 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
7100 new_mana_val = v3->sMana; | |
7101 new_mana_val += v26; | |
7102 if ( new_mana_val > v3->GetMaxMana() ) | |
7103 new_mana_val = v3->GetMaxMana(); | |
7104 v3->PlaySound(SPEECH_36, 0); | |
7105 break; | |
7106 case 255: //Luck Boost | |
7107 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7108 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7109 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7110 v3->PlaySound(SPEECH_36, 0); | |
7111 break; | |
7112 case 256: //Fire Resistance | |
7113 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7114 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7115 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7116 v3->PlaySound(SPEECH_36, 0); | |
7117 goto LABEL_173; | |
7118 case 257: //Air Resistance | |
7119 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7120 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7121 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7122 v3->PlaySound(SPEECH_36, 0); | |
7123 break; | |
7124 case 258: //Water Resistance | |
7125 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7126 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7127 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7128 v3->PlaySound(SPEECH_36, 0); | |
7129 break; | |
7130 case 259: //Earth Resistance | |
7131 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7132 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7133 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7134 v3->PlaySound(SPEECH_36, 0); | |
7135 break; | |
7136 case 260: //Mind Resistance | |
7137 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7138 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7139 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7140 v3->PlaySound(SPEECH_36, 0); | |
7141 break; | |
7142 case 261: //Body Resistance | |
7143 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); | |
7144 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
7145 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7146 v3->PlaySound(SPEECH_36, 0); | |
7147 break; | |
7148 case 262: //Stone to Flesh | |
7149 v3->pConditions[Condition_Pertified] = 0i64; | |
7150 v3->PlaySound(SPEECH_36, 0); | |
7151 break; | |
7152 case 264: //Pure Luck | |
7153 if ( !v3->pure_luck_used ) | |
7154 { | |
7155 v3->uLuck += 50; | |
7156 v3->pure_luck_used = 1; | |
7157 } | |
7158 v3->PlaySound(SPEECH_36, 0); | |
7159 break; | |
7160 case 265: //Pure Speed | |
7161 if ( !v3->pure_speed_used ) | |
7162 { | |
7163 v3->uSpeed += 50; | |
7164 v3->pure_speed_used = 1; | |
7165 } | |
7166 v3->PlaySound(SPEECH_36, 0); | |
7167 break; | |
7168 case 266: //Pure Intellect | |
7169 if ( !v3->pure_intellect_used ) | |
7170 { | |
7171 v3->uIntelligence += 50; | |
7172 v3->pure_intellect_used = 1; | |
7173 } | |
7174 v3->PlaySound(SPEECH_36, 0); | |
7175 break; | |
7176 case 267: //Pure Endurance | |
7177 if ( !v3->pure_endurance_used ) | |
7178 { | |
7179 v3->uEndurance += 50; | |
7180 v3->pure_endurance_used = 1; | |
7181 } | |
7182 v3->PlaySound(SPEECH_36, 0); | |
7183 break; | |
7184 case 268: //Pure Personality | |
7185 if ( !v3->pure_willpower_used ) | |
7186 { | |
7187 v3->uWillpower += 50; | |
7188 v3->pure_willpower_used = 1; | |
7189 } | |
7190 v3->PlaySound(SPEECH_36, 0); | |
7191 break; | |
7192 case 269: //Pure Accuracy | |
7193 if ( !v3->pure_accuracy_used ) | |
7194 { | |
7195 v3->uAccuracy += 50; | |
7196 v3->pure_accuracy_used = 1; | |
7197 } | |
7198 v3->PlaySound(SPEECH_36, 0); | |
7199 break; | |
7200 case 270: //Pure Might | |
7201 if ( !v3->pure_might_used ) | |
7202 { | |
7203 v3->uMight += 50; | |
7204 v3->pure_might_used = 1; | |
7205 } | |
7206 v3->PlaySound(SPEECH_36, 0); | |
7207 break; | |
7208 case 271: //Rejuvenation | |
7209 v3->sAgeModifier = 0; | |
7210 v3->PlaySound(SPEECH_36, 0); | |
7211 break; | |
7212 | |
7213 default: | |
7214 v68 = pParty->pPickedItem.GetDisplayName(); | |
7215 v58 = pGlobalTXT_LocalizationStrings[36]; //"%s can not be used that way" | |
7216 sprintfex(pTmpBuf, v58, v68); | |
7217 ShowStatusBarString(pTmpBuf, 2u); | |
7218 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
7219 return; | |
7220 | |
7221 } | |
7222 // pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
1019 | 7223 goto LABEL_173; |
1021 | 7224 } |
7225 | |
7226 | |
7227 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
7228 { | |
7229 | |
7230 | |
7231 if ( pCurrentScreen == SCREEN_CASTING ) | |
7232 return; | |
7233 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7234 { | |
7235 | |
7236 | |
7237 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7238 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7239 sprintfex(pTmpBuf, v58, v68); | |
7240 v23 = pTmpBuf; | |
7241 | |
7242 ShowStatusBarString(v23, 2u); | |
7243 v4 = 0; | |
7244 v61 = v4; | |
7245 v52 = v4; | |
7246 v48 = v4; | |
7247 v45 = v4; | |
7248 v43 = -1; | |
7249 v41 = v4; | |
7250 v39 = v4; | |
7251 v37 = (SoundID)27; | |
7252 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7253 return; | |
7254 } | |
7255 if ( bUnderwater == 1 ) | |
7256 { | |
7257 v23 = pGlobalTXT_LocalizationStrings[652]; //"You can not do that while you are underwater!" | |
7258 ShowStatusBarString(v23, 2u); | |
7259 v4 = 0; | |
7260 v61 = v4; | |
7261 v52 = v4; | |
7262 v48 = v4; | |
7263 v45 = v4; | |
7264 v43 = -1; | |
7265 v41 = v4; | |
7266 v39 = v4; | |
7267 v37 = (SoundID)27; | |
7268 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7269 return; | |
7270 } | |
7271 dword_50C9AC = 1; | |
7272 scroll_id = pParty->pPickedItem.uItemID - 299; | |
7273 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
7274 { | |
7275 pMouse->RemoveHoldingItem(); | |
7276 pGUIWindow_CurrentMenu->Release(); | |
7277 pIcons_LOD->_4114F2(); | |
7278 pCurrentScreen = SCREEN_GAME; | |
7279 viewparams->bRedrawGameUI = 1; | |
7280 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7281 } | |
7282 else | |
7283 { | |
7284 _720984_unused = pParty->pPickedItem.uItemID; | |
7285 pMouse->RemoveHoldingItem(); | |
7286 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7287 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7288 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7289 { | |
7290 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7291 } | |
7292 } | |
7293 return; | |
7294 } | |
7295 | |
7296 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7297 | |
7298 { | |
7299 v15 = pParty->pPickedItem.uItemID - 400; | |
7300 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7301 if ( v72 ) | |
7302 { | |
7303 v66 = pParty->pPickedItem.GetDisplayName(); | |
7304 v57 = pGlobalTXT_LocalizationStrings[380];//"You already know the %s spell" | |
7305 LABEL_72: | |
7306 sprintf(pTmpBuf, v57, v66); | |
7307 ShowStatusBarString(pTmpBuf, 2u); | |
7308 LABEL_92: | |
7309 v61 = v4; | |
7310 v52 = v4; | |
7311 v48 = v4; | |
7312 v45 = v4; | |
7313 v43 = -1; | |
7314 v41 = v4; | |
7315 v39 = v4; | |
7316 v37 = (SoundID)27; | |
7317 LABEL_93: | |
7318 v14 = pAudioPlayer; | |
7319 LABEL_63: | |
7320 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7321 return; | |
7322 } | |
7323 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7324 { | |
7325 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7326 v57 = pGlobalTXT_LocalizationStrings[382];//"That player is %s" | |
7327 sprintf(pTmpBuf, v57, v66); | |
7328 ShowStatusBarString(pTmpBuf, 2u); | |
7329 v61 = v4; | |
7330 v52 = v4; | |
7331 v48 = v4; | |
7332 v45 = v4; | |
7333 v43 = -1; | |
7334 v41 = v4; | |
7335 v39 = v4; | |
7336 v37 = (SoundID)27; | |
7337 v14 = pAudioPlayer; | |
7338 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7339 return; | |
7340 } | |
7341 v16 = v15 % 11 + 1; | |
7342 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7343 v75 = v16; | |
7344 v18 = SkillToMastery(v17) - 1; | |
7345 if ( v18 ) | |
7346 { | |
7347 v19 = v18 - 1; | |
7348 if ( v19 ) | |
7349 { | |
7350 v20 = v19 - 1; | |
7351 if ( v20 ) | |
7352 { | |
7353 if ( v20 != 1 ) | |
7354 { | |
7355 v21 = player_num; | |
7356 LABEL_83: | |
7357 if ( v75 > v21 || !v17 ) | |
7358 { | |
7359 v22 = pParty->pPickedItem.GetDisplayName(); | |
7360 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); | |
7361 ShowStatusBarString(pTmpBuf, 2u); | |
7362 v3->PlaySound((PlayerSpeech)20, 0); | |
7363 return; | |
7364 } | |
7365 v72 = 1; | |
7366 v3->PlaySound(SPEECH_21, 0); | |
7367 v73 = 0; | |
7368 LABEL_173: | |
7369 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7370 if ( v36 == EQUIP_POTION ) | |
7371 { | |
7372 v71 = 0; | |
7373 v60 = 0; | |
7374 v51 = 0; | |
7375 v47 = 0; | |
7376 v44 = -1; | |
7377 v42 = 0; | |
7378 v40 = 0; | |
7379 v38 = (SoundID)210; | |
7380 } | |
7381 else | |
7382 { | |
7383 if ( v36 != EQUIP_REAGENT ) | |
7384 { | |
7385 LABEL_178: | |
7386 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7387 { | |
7388 if ( !v73 ) | |
7389 { | |
7390 pMouse->RemoveHoldingItem(); | |
7391 return; | |
7392 } | |
7393 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7394 } | |
7395 if ( v73 ) | |
7396 { | |
7397 if ( pParty->bTurnBasedModeOn ) | |
7398 { | |
7399 *(&pParty->field_16140 + player_num) = 100; | |
7400 thisb->SetRecoveryTime(100); | |
7401 pTurnEngine->_40471C(); | |
7402 } | |
7403 else | |
7404 { | |
7405 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7406 } | |
7407 } | |
7408 pMouse->RemoveHoldingItem(); | |
7409 return; | |
7410 } | |
7411 v71 = 0; | |
7412 v60 = 0; | |
7413 v51 = 0; | |
7414 v47 = 0; | |
7415 v44 = -1; | |
7416 v42 = 0; | |
7417 v40 = 0; | |
7418 v38 = (SoundID)211; | |
7419 } | |
7420 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7421 goto LABEL_178; | |
7422 } | |
7423 v67 = 11; | |
7424 } | |
7425 else | |
7426 { | |
7427 v67 = 10; | |
7428 } | |
7429 } | |
7430 else | |
7431 { | |
7432 v67 = 7; | |
7433 } | |
7434 } | |
7435 else | |
7436 { | |
7437 v67 = 4; | |
7438 } | |
7439 v21 = v67; | |
7440 goto LABEL_83; | |
7441 } | |
7442 | |
7443 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7444 | |
7445 { | |
7446 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7447 { | |
7448 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
7449 v65 = 0; | |
7450 v56 = SPEECH_37; | |
7451 LABEL_67: | |
7452 v3->PlaySound((PlayerSpeech)v56, v65); | |
7453 return; | |
7454 } | |
7455 LABEL_89: | |
7456 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7457 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7458 LABEL_90: | |
7459 sprintfex(pTmpBuf, v58, v68); | |
7460 v23 = pTmpBuf; | |
7461 LABEL_91: | |
7462 ShowStatusBarString(v23, 2u); | |
7463 v4 = 0; | |
7464 v61 = v4; | |
7465 v52 = v4; | |
7466 v48 = v4; | |
7467 v45 = v4; | |
7468 v43 = -1; | |
7469 v41 = v4; | |
7470 v39 = v4; | |
7471 v37 = (SoundID)27; | |
7472 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7473 return; | |
7474 } | |
7475 else | |
7476 { | |
1019 | 7477 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7478 { |
7479 thisa = pParty->uCurrentMonthWeek + 1; | |
7480 if ( pParty->uCurrentMonth >= 7 ) | |
7481 v74 = 0; | |
7482 else | |
7483 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7484 switch ( pParty->uCurrentMonth ) | |
7485 { | |
1019 | 7486 case 0: |
1021 | 7487 v6 = pParty->uCurrentMonthWeek + 1; |
7488 v3->uMight += thisa; | |
7489 v62 = pGlobalTXT_LocalizationStrings[121]; //"Permanent" | |
7490 v53 = v74; | |
7491 v49 = v6; | |
7492 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7493 break; | |
1019 | 7494 case 1: |
1021 | 7495 v6 = pParty->uCurrentMonthWeek + 1; |
7496 v3->uIntelligence += thisa; | |
7497 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7498 v53 = v74; | |
7499 v49 = v6; | |
7500 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7501 break; | |
1019 | 7502 case 2: |
1021 | 7503 v6 = pParty->uCurrentMonthWeek + 1; |
7504 v3->uWillpower += thisa; | |
7505 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7506 v53 = v74; | |
7507 v49 = v6; | |
7508 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7509 break; | |
1019 | 7510 case 3: |
1021 | 7511 v6 = pParty->uCurrentMonthWeek + 1; |
7512 v3->uEndurance += thisa; | |
7513 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7514 v53 = v74; | |
7515 v49 = v6; | |
7516 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7517 break; | |
1019 | 7518 case 4: |
1021 | 7519 v6 = pParty->uCurrentMonthWeek + 1; |
7520 v3->uAccuracy += thisa; | |
7521 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7522 v53 = v74; | |
7523 v49 = v6; | |
7524 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7525 break; | |
1019 | 7526 case 5: |
1021 | 7527 v6 = pParty->uCurrentMonthWeek + 1; |
7528 v3->uSpeed += thisa; | |
7529 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7530 v53 = v74; | |
7531 v49 = v6; | |
7532 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7533 break; | |
1019 | 7534 case 6: |
1021 | 7535 v6 = pParty->uCurrentMonthWeek + 1; |
7536 v3->uLuck += thisa; | |
7537 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7538 v53 = v74; | |
7539 v49 = v6; | |
7540 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7541 break; | |
1019 | 7542 case 7: |
1021 | 7543 party_finds_gold(1000 * thisa, 0); |
7544 v63 = pGlobalTXT_LocalizationStrings[97];//"Gold" | |
7545 v54 = 1000 * thisa; | |
7546 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7547 break; | |
1019 | 7548 case 8: |
1021 | 7549 Party::GiveFood(5 * thisa); |
7550 v63 = pGlobalTXT_LocalizationStrings[653]; //"Food" | |
7551 v54 = 5 * thisa; | |
7552 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7553 break; | |
0 | 7554 case 9u: |
1021 | 7555 v63 = pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]; |
7556 v3->uSkillPoints += 2 * thisa; | |
7557 v54 = 2 * thisa; | |
7558 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7559 break; | |
1019 | 7560 case 10: |
1021 | 7561 v63 = pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]; |
7562 v54 = 2500 * thisa; | |
7563 v3->uExperience += 2500 * thisa; | |
7564 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7565 break; | |
1019 | 7566 case 11: |
1021 | 7567 v8 = rand() % 6; |
7568 switch (v8) | |
7569 { | |
7570 case 0: | |
7571 v3->sResFireBase += thisa; | |
7572 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7573 break; | |
7574 case 1: | |
7575 v3->sResAirBase += thisa; | |
7576 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7577 break; | |
7578 case 2: | |
7579 v3->sResWaterBase += thisa; | |
7580 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7581 break; | |
7582 case 3: | |
7583 v3->sResEarthBase += thisa; | |
7584 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7585 break; | |
7586 case 4: | |
7587 v3->sResMindBase += thisa; | |
7588 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7589 break; | |
7590 case 5: | |
7591 v3->sResBodyBase += thisa; | |
7592 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7593 break; |
1021 | 7594 } |
7595 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7596 v53 = v13; | |
7597 v49 = thisa; | |
7598 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7599 break; | |
7600 | |
7601 } | |
7602 ShowStatusBarString(pTmpBuf, 2u); | |
7603 pMouse->RemoveHoldingItem(); | |
7604 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7605 v3->PlaySound(SPEECH_93, 0); | |
7606 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7607 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
0 | 7608 { |
1021 | 7609 v3->SetCondition(Condition_Eradicated, 0); |
7610 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7611 } |
1021 | 7612 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7613 { | |
7614 v3->SetCondition(Condition_Dead, 0); | |
7615 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7616 } | |
7617 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7618 { | |
7619 v3->SetCondition(Condition_Pertified, 0); | |
7620 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7621 } | |
1019 | 7622 return; |
1021 | 7623 } |
7624 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7625 { | |
7626 Party::GiveFood(1u); | |
7627 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7628 | |
7629 } | |
7630 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7631 { | |
7632 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7633 return; | |
7634 } | |
7635 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7636 { | |
7637 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7638 return; | |
7639 } | |
7640 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7641 { | |
7642 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7643 return; | |
7644 } | |
7645 else if ( pParty->pPickedItem.uItemID == 646 ) | |
7646 { | |
7647 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7648 v5 = 8 * player_num + 392; | |
7649 LOBYTE(v5) = PID(OBJECT_Player,player_num - 120); | |
7650 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); | |
7651 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7652 } | |
7653 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7654 { | |
7655 sub_44C28F_open_nwc_dungeon(); | |
7656 return; | |
7657 } | |
0 | 7658 else |
1021 | 7659 { |
7660 | |
7661 v68 = pParty->pPickedItem.GetDisplayName(); | |
7662 v58 = pGlobalTXT_LocalizationStrings[36]; | |
7663 sprintfex(pTmpBuf, v58, v68); | |
7664 v23 = pTmpBuf; | |
7665 ShowStatusBarString(v23, 2u); | |
7666 v4 = 0; | |
7667 v61 = v4; | |
7668 v52 = v4; | |
7669 v48 = v4; | |
7670 v45 = v4; | |
7671 v43 = -1; | |
7672 v41 = v4; | |
7673 v39 = v4; | |
7674 v37 = (SoundID)27; | |
7675 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7676 return; | |
7677 } | |
7678 | |
0 | 7679 LABEL_187: |
7680 pMouse->RemoveHoldingItem(); | |
7681 return; | |
7682 } | |
1021 | 7683 |
7684 } | |
0 | 7685 |
7686 | |
7687 | |
7688 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7689 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7690 { | |
0 | 7691 Player *v3; // esi@1 |
7692 signed int v4; // edi@1 | |
7693 unsigned int v5; // eax@8 | |
7694 int v6; // eax@9 | |
7695 enum CHARACTER_RACE v7; // eax@11 | |
7696 signed int v8; // eax@17 | |
7697 unsigned __int8 v9; // sf@17 | |
7698 unsigned __int8 v10; // of@17 | |
7699 int v11; // eax@19 | |
7700 unsigned int v12; // eax@20 | |
484 | 7701 unsigned int test_bit_value; // eax@25 |
7702 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7703 signed int v15; // ecx@28 |
7704 ItemGen *v16; // eax@28 | |
7705 char v17; // zf@31 | |
7706 int v18; // edi@90 | |
7707 DDM_DLV_Header *v19; // eax@122 | |
7708 char v20; // cl@124 | |
7709 DDM_DLV_Header *v21; // eax@126 | |
7710 unsigned int v22; // edi@129 | |
100 | 7711 Player *v23; // esi@134 |
0 | 7712 ItemGen *v24; // ecx@135 |
7713 signed int v25; // edx@135 | |
7714 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7715 char *v27; // edi@155 | |
7716 int v28; // ebx@161 | |
7717 int v29; // eax@161 | |
7718 | |
469 | 7719 v6 = 0; |
0 | 7720 v3 = this; |
7721 v4 = -1; | |
469 | 7722 if ( VarNum > VAR_AutoNotes ) |
7723 { | |
7724 switch ( VarNum ) | |
0 | 7725 { |
7726 case VAR_Invisible: | |
484 | 7727 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7728 return true; |
484 | 7729 return false; |
0 | 7730 case VAR_NumDeaths: |
7731 v4 = pParty->uNumDeaths; | |
469 | 7732 return v4 >= pValue; |
0 | 7733 case VAR_NumBounties: |
7734 v4 = pParty->uNumBountiesCollected; | |
469 | 7735 return v4 >= pValue; |
0 | 7736 case VAR_PrisonTerms: |
7737 v4 = pParty->uNumPrisonTerms; | |
469 | 7738 return v4 >= pValue; |
0 | 7739 case VAR_ArenaWinsPage: |
7740 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7741 return v4 >= pValue; |
0 | 7742 case VAR_ArenaWinsSquire: |
7743 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7744 return v4 >= pValue; |
0 | 7745 case VAR_ArenaWinsKnight: |
7746 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7747 return v4 >= pValue; |
0 | 7748 case VAR_ArenaWinsLord: |
7749 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7750 return v4 >= pValue; |
0 | 7751 case VAR_ReputationInCurrentLocation: |
7752 v19 = &pOutdoor->ddm; | |
7753 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7754 v19 = &pIndoor->dlv; | |
469 | 7755 v6 = v19->uReputation >= pValue; |
7756 return v6; | |
0 | 7757 case VAR_History_28|VAR_Sex: |
7758 v21 = &pOutdoor->ddm; | |
7759 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7760 v21 = &pIndoor->dlv; | |
469 | 7761 v6 = v21->field_C_alert == pValue; |
0 | 7762 return v6; |
7763 case VAR_MonthEquals2|VAR_Sex: | |
7764 case VAR_MonthEquals2|VAR_Class: | |
7765 case VAR_Counter1: | |
7766 case VAR_Counter2: | |
7767 case VAR_Counter3: | |
7768 case VAR_Counter4: | |
7769 case VAR_Counter5: | |
7770 case VAR_Counter6: | |
7771 case VAR_Counter7: | |
7772 case VAR_Counter8: | |
469 | 7773 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7774 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7775 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7776 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7777 return true; | |
7778 return false; | |
0 | 7779 case VAR_NumSkillPoints: |
7780 v4 = this->uSkillPoints; | |
469 | 7781 return v4 >= pValue; |
0 | 7782 case VAR_CircusPrises: |
7783 v4 = 0; | |
100 | 7784 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7785 do |
7786 { | |
469 | 7787 v24 = v23->pInventoryItems; |
0 | 7788 v25 = 138; |
7789 do | |
7790 { | |
7791 switch ( v24->uItemID ) | |
7792 { | |
7793 case 0x1D6u: | |
7794 ++v4; | |
7795 break; | |
7796 case 0x1D7u: | |
7797 v4 += 3; | |
7798 break; | |
7799 case 0x1DDu: | |
7800 v4 += 5; | |
7801 break; | |
7802 } | |
7803 ++v24; | |
7804 --v25; | |
7805 } | |
7806 while ( v25 ); | |
100 | 7807 ++v23; |
0 | 7808 } |
100 | 7809 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7810 return v4 >= pValue; |
0 | 7811 case VAR_MonthEquals2: |
469 | 7812 v6 = pParty->uCurrentMonth == pValue; |
7813 return v6; | |
0 | 7814 case VAR_IsFlying: |
7815 if ( pParty->bFlying | |
484 | 7816 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7817 return true; |
7818 return false; | |
0 | 7819 case VAR_HiredNPCHasSpeciality: |
469 | 7820 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7821 return v6; |
7822 case VAR_NPCs2: | |
469 | 7823 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7824 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7825 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7826 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7827 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7828 return v4 >= pValue; |
7829 v4 = pValue; | |
7830 return v4 >= pValue; | |
0 | 7831 case VAR_ItemEquipped: |
7832 v26 = (ITEM_EQUIP_TYPE)0; | |
7833 v27 = (char *)&this->pEquipment; | |
7834 break; | |
7835 case VAR_GoldInBank: | |
7836 v4 = pParty->uNumGoldInBank; | |
469 | 7837 return v4 >= pValue; |
0 | 7838 case VAR_ThieverySkill|0x80: |
7839 v28 = GetActualMight(); | |
7840 v29 = v3->GetBaseStrength(); | |
7841 goto LABEL_168; | |
7842 case VAR_DisarmTrapSkill|0x80: | |
7843 v28 = GetActualIntelligence(); | |
7844 v29 = v3->GetBaseIntelligence(); | |
7845 goto LABEL_168; | |
7846 case VAR_MonthEquals: | |
7847 v28 = GetActualWillpower(); | |
7848 v29 = v3->GetBaseWillpower(); | |
7849 goto LABEL_168; | |
7850 case VAR_MonthEquals|VAR_Sex: | |
7851 v28 = GetActualEndurance(); | |
7852 v29 = v3->GetBaseEndurance(); | |
7853 goto LABEL_168; | |
7854 case VAR_IdentifyMonsterSkill|0x80: | |
7855 v28 = GetActualSpeed(); | |
7856 v29 = v3->GetBaseSpeed(); | |
7857 goto LABEL_168; | |
7858 case VAR_ArmsmasterSkill|0x80: | |
7859 v28 = GetActualAccuracy(); | |
7860 v29 = v3->GetBaseAccuracy(); | |
7861 goto LABEL_168; | |
7862 case VAR_MonthEquals|VAR_MaxHP: | |
7863 v28 = GetActualLuck(); | |
7864 v29 = v3->GetBaseLuck(); | |
7865 LABEL_168: | |
7866 v10 = __OFSUB__(v28, v29); | |
7867 v9 = v28 - v29 < 0; | |
7868 LABEL_169: | |
7869 if ( v9 ^ v10 ) | |
469 | 7870 return v4 >= pValue; |
7871 return true; | |
0 | 7872 default: |
469 | 7873 return v4 >= pValue; |
0 | 7874 } |
7875 while ( !v3->HasItemEquipped(v26) | |
654 | 7876 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7877 { |
7878 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7879 v27 += 4; | |
7880 if ( (signed int)v26 >= 16 ) | |
469 | 7881 return false; |
7882 } | |
7883 return true; | |
7884 } | |
7885 if ( VarNum == VAR_AutoNotes ) | |
0 | 7886 { |
484 | 7887 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7888 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7889 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7890 return false; | |
7891 return true; | |
469 | 7892 } |
7893 if ( VarNum <= VAR_BaseLuck ) | |
7894 { | |
7895 if ( VarNum != VAR_BaseLuck ) | |
7896 { | |
7897 switch ( VarNum ) | |
0 | 7898 { |
7899 case VAR_Hour: | |
469 | 7900 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7901 return true; | |
7902 return false; | |
0 | 7903 case VAR_DayOfYear: |
469 | 7904 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7905 v6 = v5 == pValue; | |
7906 return v6; | |
0 | 7907 case VAR_DayOfWeek: |
469 | 7908 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7909 v6 = v5 == pValue; | |
0 | 7910 return v6; |
7911 case VAR_Sex: | |
469 | 7912 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7913 return true; | |
7914 return v4 >= pValue; | |
0 | 7915 case VAR_Class: |
135 | 7916 v7 = (CHARACTER_RACE)this->classType; |
469 | 7917 if ( pValue == v7 ) |
7918 return true; | |
7919 return v4 >= pValue; | |
0 | 7920 case VAR_Race: |
7921 v7 = GetRace(); | |
469 | 7922 if ( pValue == v7 ) |
7923 return true; | |
7924 return v4 >= pValue; | |
0 | 7925 case VAR_CurrentHP: |
7926 v4 = this->sHealth; | |
469 | 7927 return v4 >= pValue; |
0 | 7928 case VAR_MaxHP: |
7929 v8 = GetMaxHealth(); | |
7930 v10 = __OFSUB__(v3->sHealth, v8); | |
7931 v9 = v3->sHealth - v8 < 0; | |
7932 goto LABEL_169; | |
7933 case VAR_CurrentSP: | |
7934 v4 = this->sMana; | |
469 | 7935 return v4 >= pValue; |
0 | 7936 case VAR_MaxSP: |
7937 v11 = GetMaxMana(); | |
7938 v10 = __OFSUB__(v3->sMana, v11); | |
7939 v9 = v3->sMana - v11 < 0; | |
7940 goto LABEL_169; | |
7941 case VAR_ActualAC: | |
7942 v12 = GetActualAC(); | |
7943 goto _j_cmp_against_arg; | |
7944 case VAR_ACModifier: | |
7945 v4 = this->sACModifier; | |
469 | 7946 return v4 >= pValue; |
0 | 7947 case VAR_BaseLevel: |
7948 v4 = this->uLevel; | |
469 | 7949 return v4 >= pValue; |
0 | 7950 case VAR_LevelModifier: |
7951 v4 = this->sLevelModifier; | |
469 | 7952 return v4 >= pValue; |
0 | 7953 case VAR_Age: |
7954 v12 = GetActualAge(); | |
7955 goto _j_cmp_against_arg; | |
7956 case VAR_Award: | |
484 | 7957 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7958 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7959 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7960 return true; | |
7961 return false; | |
0 | 7962 case VAR_Experience: |
7963 v4 = LODWORD(this->uExperience); | |
469 | 7964 return v4 >= pValue; |
0 | 7965 case VAR_QBits_QuestsDone: |
484 | 7966 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7967 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7968 if ( test_bit_value & our_bit_value ) | |
478 | 7969 return true; |
7970 return false; | |
0 | 7971 case VAR_PlayerItemInHands: |
7972 v15 = 0; | |
7973 v16 = v3->pInventoryItems; | |
7974 break; | |
7975 case VAR_FixedGold: | |
7976 v4 = pParty->uNumGold; | |
469 | 7977 return v4 >= pValue; |
0 | 7978 case VAR_MightBonus: |
7979 v4 = this->uMightBonus; | |
469 | 7980 return v4 >= pValue; |
0 | 7981 case VAR_IntellectBonus: |
7982 v4 = this->uIntelligenceBonus; | |
469 | 7983 return v4 >= pValue; |
0 | 7984 case VAR_PersonalityBonus: |
7985 v4 = this->uWillpowerBonus; | |
469 | 7986 return v4 >= pValue; |
0 | 7987 case VAR_EnduranceBonus: |
7988 v4 = this->uEnduranceBonus; | |
469 | 7989 return v4 >= pValue; |
0 | 7990 case VAR_SpeedBonus: |
7991 v4 = this->uSpeedBonus; | |
469 | 7992 return v4 >= pValue; |
0 | 7993 case VAR_AccuracyBonus: |
7994 v4 = this->uAccuracyBonus; | |
469 | 7995 return v4 >= pValue; |
0 | 7996 case VAR_LuckBonus: |
7997 v4 = this->uLuckBonus; | |
469 | 7998 return v4 >= pValue; |
0 | 7999 case VAR_BaseMight: |
8000 v4 = this->uMight; | |
469 | 8001 return v4 >= pValue; |
0 | 8002 case VAR_BaseIntellect: |
8003 v4 = this->uIntelligence; | |
469 | 8004 return v4 >= pValue; |
0 | 8005 case VAR_BasePersonality: |
8006 v4 = this->uWillpower; | |
469 | 8007 return v4 >= pValue; |
0 | 8008 case VAR_BaseEndurance: |
8009 v4 = this->uEndurance; | |
469 | 8010 return v4 >= pValue; |
0 | 8011 case VAR_BaseSpeed: |
8012 v4 = this->uSpeed; | |
469 | 8013 return v4 >= pValue; |
0 | 8014 case VAR_BaseAccuracy: |
8015 v4 = this->uAccuracy; | |
469 | 8016 return v4 >= pValue; |
0 | 8017 case VAR_FixedFood: |
8018 v4 = pParty->uNumFoodRations; | |
469 | 8019 return v4 >= pValue; |
0 | 8020 default: |
469 | 8021 return v4 >= pValue; |
8022 } | |
8023 while ( v16->uItemID != pValue ) | |
0 | 8024 { |
8025 ++v15; | |
8026 ++v16; | |
8027 if ( v15 >= 138 ) | |
8028 { | |
469 | 8029 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8030 return v6; |
8031 } | |
8032 } | |
469 | 8033 return true; |
0 | 8034 } |
8035 v4 = this->uLuck; | |
469 | 8036 return v4 >= pValue; |
8037 } | |
8038 if ( VarNum <= VAR_MagicResistance ) | |
8039 { | |
8040 if ( VarNum == VAR_MagicResistance ) | |
0 | 8041 { |
8042 v4 = this->sResMagicBase; | |
8043 } | |
8044 else | |
8045 { | |
469 | 8046 switch ( VarNum ) |
0 | 8047 { |
8048 case VAR_FireResistance: | |
8049 v4 = this->sResFireBase; | |
469 | 8050 return v4 >= pValue; |
0 | 8051 case VAR_AirResistance: |
8052 v4 = this->sResAirBase; | |
469 | 8053 return v4 >= pValue; |
0 | 8054 case VAR_WaterResistance: |
8055 v4 = this->sResWaterBase; | |
469 | 8056 return v4 >= pValue; |
0 | 8057 case VAR_EarthResistance: |
8058 v4 = this->sResEarthBase; | |
469 | 8059 return v4 >= pValue; |
0 | 8060 case VAR_SpiritResistance: |
8061 v4 = this->sResSpiritBase; | |
469 | 8062 return v4 >= pValue; |
0 | 8063 case VAR_MindResistance: |
8064 v4 = this->sResMindBase; | |
469 | 8065 return v4 >= pValue; |
0 | 8066 case VAR_BodyResistance: |
8067 v4 = this->sResBodyBase; | |
469 | 8068 return v4 >= pValue; |
0 | 8069 case VAR_LightResistance: |
8070 v4 = this->sResLightBase; | |
469 | 8071 return v4 >= pValue; |
0 | 8072 case VAR_DarkResistance: |
8073 v4 = this->sResDarkBase; | |
469 | 8074 return v4 >= pValue; |
0 | 8075 case VAR_ActualMight: |
8076 v12 = GetActualMight(); | |
8077 goto _j_cmp_against_arg; | |
8078 case VAR_ActualIntellect: | |
8079 v12 = GetActualIntelligence(); | |
8080 goto _j_cmp_against_arg; | |
8081 case VAR_ActualPersonality: | |
8082 v12 = GetActualWillpower(); | |
8083 goto _j_cmp_against_arg; | |
8084 case VAR_ActualEndurance: | |
8085 v12 = GetActualEndurance(); | |
8086 goto _j_cmp_against_arg; | |
8087 case VAR_ActualSpeed: | |
8088 v12 = GetActualSpeed(); | |
8089 goto _j_cmp_against_arg; | |
8090 case VAR_ActualAccuracy: | |
8091 v12 = GetActualAccuracy(); | |
8092 goto _j_cmp_against_arg; | |
8093 case VAR_ActualLuck: | |
8094 v12 = GetActualLuck(); | |
8095 _j_cmp_against_arg: | |
8096 v4 = v12; | |
8097 break; | |
8098 default: | |
469 | 8099 return v4 >= pValue; |
8100 } | |
8101 } | |
8102 return v4 >= pValue; | |
8103 } | |
8104 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8105 { | |
8106 if ( VarNum != VAR_DisarmTrapSkill ) | |
8107 { | |
8108 if ( VarNum <= VAR_MindResistanceBonus ) | |
8109 { | |
8110 switch ( VarNum ) | |
0 | 8111 { |
8112 case VAR_MindResistanceBonus: | |
8113 v4 = this->sResMindBonus; | |
8114 break; | |
8115 case VAR_FireResistanceBonus: | |
8116 v4 = this->sResFireBonus; | |
8117 break; | |
8118 case VAR_AirResistanceBonus: | |
8119 v4 = this->sResAirBonus; | |
8120 break; | |
8121 case VAR_WaterResistanceBonus: | |
8122 v4 = this->sResWaterBonus; | |
8123 break; | |
8124 case VAR_EarthResistanceBonus: | |
8125 v4 = this->sResEarthBonus; | |
8126 break; | |
8127 case VAR_SpiritResistanceBonus: | |
8128 v4 = this->sResSpiritBonus; | |
8129 break; | |
8130 } | |
469 | 8131 return v4 >= pValue; |
8132 } | |
8133 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8134 { |
8135 v4 = this->sResBodyBonus; | |
469 | 8136 return v4 >= pValue; |
8137 } | |
8138 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8139 { |
8140 v4 = this->sResLightBonus; | |
469 | 8141 return v4 >= pValue; |
8142 } | |
8143 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8144 { |
8145 v4 = this->sResDarkBonus; | |
469 | 8146 return v4 >= pValue; |
8147 } | |
8148 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8149 { |
8150 v4 = this->sResMagicBonus; | |
469 | 8151 return v4 >= pValue; |
8152 } | |
8153 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8154 return v4 >= pValue; | |
0 | 8155 } |
8156 LABEL_90: | |
469 | 8157 v18 = *((short *)&this->pConditions[16] + VarNum); |
8158 if ( pValue <= 63 ) | |
0 | 8159 v4 = v18 & 0x3F; |
8160 else | |
469 | 8161 v4 = pValue & v18; |
8162 return v4 >= pValue; | |
8163 } | |
8164 if ( VarNum == 104 ) | |
0 | 8165 goto LABEL_90; |
469 | 8166 if ( (signed int)VarNum <= 104 ) |
8167 return v4 >= pValue; | |
8168 if ( (signed int)VarNum > 0x79 ) | |
8169 { | |
8170 if ( VarNum != 122 ) | |
8171 { | |
8172 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8173 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8174 return v4 >= pValue; | |
0 | 8175 } |
8176 v4 = GetMajorConditionIdx(); | |
8177 if ( v4 != 18 ) | |
8178 { | |
469 | 8179 return v4 >= pValue; |
8180 } | |
8181 v4 = pValue; | |
8182 return v4 >= pValue; | |
8183 } | |
8184 return *((int *)this + 2 * VarNum - 210); | |
0 | 8185 } |
8186 | |
8187 | |
8188 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8189 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8190 { | |
8191 signed int currPlayerId; // ebx@1 | |
0 | 8192 Player *v4; // esi@1 |
8193 unsigned int v5; // edi@1 | |
8194 unsigned int v6; // esi@13 | |
8195 unsigned int v7; // esi@14 | |
8196 signed int v8; // eax@17 | |
8197 ItemGen *v9; // ecx@17 | |
8198 int v10; // eax@21 | |
8199 signed int v11; // eax@30 | |
8200 Player *v12; // ecx@44 | |
8201 char *v13; // ecx@45 | |
8202 Player *v14; // ecx@49 | |
8203 int v15; // ecx@86 | |
8204 int v16; // esi@106 | |
8205 char v17; // al@106 | |
8206 int v18; // eax@107 | |
8207 Player *v19; // ecx@112 | |
8208 Player *v20; // ecx@127 | |
8209 int v21; // eax@127 | |
8210 int v22; // eax@145 | |
8211 char v23; // zf@146 | |
8212 DDM_DLV_Header *v24; // ecx@148 | |
8213 signed int v25; // eax@172 | |
8214 int v26; // [sp-8h] [bp-3Ch]@84 | |
8215 signed int v27; // [sp-4h] [bp-38h]@4 | |
8216 int v28; // [sp-4h] [bp-38h]@84 | |
8217 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8218 char v30; // [sp+32h] [bp-2h]@1 | |
8219 char v31; // [sp+33h] [bp-1h]@1 | |
8220 | |
492 | 8221 currPlayerId = 0; |
0 | 8222 v30 = 0; |
8223 v31 = 0; | |
8224 v4 = this; | |
8225 v5 = 0; | |
8226 if ( this == pPlayers[2] ) | |
492 | 8227 currPlayerId = 1; |
8228 else if ( this == pPlayers[3] ) | |
8229 currPlayerId = 2; | |
757 | 8230 else if ( this == pPlayers[4] ) |
492 | 8231 currPlayerId = 3; |
8232 if ( var_type > VAR_AutoNotes ) | |
8233 { | |
8234 if ( var_type <= VAR_GoldInBank ) | |
8235 { | |
8236 if ( var_type == VAR_GoldInBank ) | |
8237 { | |
8238 pParty->uNumGoldInBank = var_value; | |
0 | 8239 return; |
8240 } | |
492 | 8241 if ( var_type <= VAR_Counter8 ) |
8242 { | |
8243 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8244 { |
492 | 8245 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8246 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8247 } |
8248 else | |
8249 { | |
492 | 8250 switch ( var_type ) |
0 | 8251 { |
8252 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8253 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8254 break; |
8255 case VAR_NPCs2: | |
8256 pParty->field_709 = 0; | |
492 | 8257 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8258 Party__CountHirelings(); |
0 | 8259 viewparams->bRedrawGameUI = 1; |
8260 break; | |
8261 case VAR_NumSkillPoints: | |
492 | 8262 this->uSkillPoints = var_value; |
0 | 8263 break; |
8264 } | |
8265 } | |
8266 return; | |
8267 } | |
492 | 8268 if ( var_type < VAR_Counter9 ) |
0 | 8269 return; |
492 | 8270 if ( (signed int)var_type <= 0x112 ) |
8271 { | |
8272 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8273 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8274 } |
8275 else | |
8276 { | |
492 | 8277 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8278 { |
8279 v24 = &pOutdoor->ddm; | |
8280 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8281 v24 = &pIndoor->dlv; | |
492 | 8282 v24->uReputation = var_value; |
8283 if ( var_value > 10000 ) | |
0 | 8284 v24->uReputation = 10000; |
8285 return; | |
8286 } | |
492 | 8287 if ( var_type <= VAR_ReputationInCurrentLocation |
8288 || var_type > VAR_History_28 | |
8289 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8290 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8291 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8292 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8293 v23) ) |
8294 return; | |
8295 bFlashHistoryBook = 1; | |
8296 } | |
8297 LABEL_172: | |
492 | 8298 v25 = 8 * currPlayerId + 400; |
862 | 8299 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8300 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8301 return; | |
8302 } | |
492 | 8303 if ( var_type != 307 ) |
8304 { | |
8305 switch ( var_type ) | |
0 | 8306 { |
8307 case 308: | |
492 | 8308 pParty->uNumBountiesCollected = var_value; |
0 | 8309 break; |
8310 case 309: | |
492 | 8311 pParty->uNumPrisonTerms = var_value; |
0 | 8312 break; |
8313 case 310: | |
492 | 8314 pParty->uNumArenaPageWins = var_value; |
0 | 8315 break; |
8316 case 311: | |
492 | 8317 pParty->uNumArenaSquireWins = var_value; |
0 | 8318 break; |
8319 case 312: | |
492 | 8320 pParty->uNumArenaKnightWins = var_value; |
0 | 8321 break; |
8322 case 313: | |
492 | 8323 pParty->uNumArenaLordWins = var_value; |
0 | 8324 break; |
8325 } | |
8326 return; | |
8327 } | |
492 | 8328 pParty->uNumDeaths = var_value; |
0 | 8329 LABEL_168: |
8330 if ( v30 != 1 ) | |
8331 { | |
8332 LABEL_170: | |
8333 if ( v31 != 1 ) | |
8334 return; | |
8335 v5 = 0; | |
8336 goto LABEL_172; | |
8337 } | |
8338 LABEL_169: | |
492 | 8339 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8340 goto LABEL_170; |
8341 } | |
492 | 8342 if ( var_type == VAR_AutoNotes ) |
8343 { | |
8344 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
|
8345 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8346 && pAutonoteTxt[var_value-1].pText ) |
8347 { | |
8348 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8349 v30 = 1; |
187 | 8350 v20->PlaySound(SPEECH_96, 0); |
492 | 8351 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8352 bFlashAutonotesBook = 1; |
981 | 8353 _506568_autonote_type = v21; |
0 | 8354 } |
492 | 8355 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8356 v31 = 1; |
8357 goto LABEL_168; | |
8358 } | |
492 | 8359 if ( var_type <= VAR_ActualMight ) |
8360 { | |
8361 if ( var_type != VAR_ActualMight ) | |
8362 { | |
8363 switch ( var_type ) | |
0 | 8364 { |
8365 case VAR_RandomGold: | |
492 | 8366 v6 = rand() % var_value + 1; |
0 | 8367 Party::SetGold(v6); |
8368 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8369 ShowStatusBarString(pTmpBuf, 2u); | |
8370 GameUI_DrawFoodAndGold(); | |
8371 return; | |
8372 case VAR_RandomFood: | |
492 | 8373 v7 = rand() % var_value + 1; |
0 | 8374 Party::SetFood(v7); |
8375 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8376 ShowStatusBarString(pTmpBuf, 2u); | |
8377 GameUI_DrawFoodAndGold(); | |
8378 goto LABEL_124; | |
8379 case VAR_Sex: | |
492 | 8380 this->uSex = (PLAYER_SEX)var_value; |
0 | 8381 goto LABEL_124; |
8382 case VAR_Class: | |
492 | 8383 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8384 if ( (char)var_value != 35 ) | |
0 | 8385 goto LABEL_124; |
8386 v8 = 0; | |
8387 v9 = this->pInventoryItems; | |
8388 break; | |
8389 case VAR_CurrentHP: | |
492 | 8390 this->sHealth = var_value; |
0 | 8391 goto LABEL_124; |
8392 case VAR_MaxHP: | |
8393 this->sHealth = GetMaxHealth(); | |
8394 return; | |
8395 case VAR_CurrentSP: | |
492 | 8396 this->sMana = var_value; |
0 | 8397 goto LABEL_124; |
8398 case VAR_MaxSP: | |
8399 this->sMana = GetMaxMana(); | |
8400 return; | |
8401 case VAR_ACModifier: | |
492 | 8402 this->sACModifier = (unsigned __int8)var_value; |
0 | 8403 goto LABEL_124; |
8404 case VAR_BaseLevel: | |
492 | 8405 this->uLevel = (unsigned __int8)var_value; |
0 | 8406 goto LABEL_124; |
8407 case VAR_LevelModifier: | |
492 | 8408 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8409 goto LABEL_124; |
8410 case VAR_Age: | |
492 | 8411 this->sAgeModifier = var_value; |
0 | 8412 return; |
8413 case VAR_Award: | |
492 | 8414 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8415 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
|
8416 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8417 && pAwards[var_value].pText ) |
0 | 8418 { |
8419 v30 = 1; | |
8420 v31 = 1; | |
492 | 8421 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8422 } |
492 | 8423 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8424 goto LABEL_168; | |
0 | 8425 case VAR_Experience: |
492 | 8426 this->uExperience = var_value; |
0 | 8427 goto LABEL_124; |
8428 case VAR_QBits_QuestsDone: | |
492 | 8429 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
|
8430 // && (&dword_722F10)[4 * a3] ) |
492 | 8431 && pQuestTable[var_value-1] ) |
0 | 8432 { |
492 | 8433 v14 = pPlayers[currPlayerId + 1]; |
0 | 8434 bFlashQuestBook = 1; |
8435 v30 = 1; | |
8436 v31 = 1; | |
187 | 8437 v14->PlaySound(SPEECH_93, 0); |
0 | 8438 } |
484 | 8439 v13 = (char *)pParty->_quest_bits; |
0 | 8440 LABEL_51: |
492 | 8441 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8442 if (( v30 != 1 )&&( v31 != 1 )) | |
8443 return; | |
8444 else | |
8445 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8446 if ( v31 != 1 ) | |
8447 return; | |
8448 v25 = 8 * currPlayerId + 400; | |
862 | 8449 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8450 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8451 return; | |
0 | 8452 case VAR_PlayerItemInHands: |
8453 item.Reset(); | |
8454 item.Reset(); | |
492 | 8455 item.uItemID = var_value; |
0 | 8456 item.uAttributes = 1; |
8457 pParty->SetHoldingItem(&item); | |
492 | 8458 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8459 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8460 return; |
8461 case VAR_FixedGold: | |
492 | 8462 Party::SetGold(var_value); |
0 | 8463 return; |
8464 case VAR_BaseMight: | |
492 | 8465 this->uMight = (unsigned __int8)var_value; |
0 | 8466 goto LABEL_84; |
8467 case VAR_BaseIntellect: | |
492 | 8468 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8469 goto LABEL_84; |
8470 case VAR_BasePersonality: | |
492 | 8471 this->uWillpower = (unsigned __int8)var_value; |
0 | 8472 goto LABEL_84; |
8473 case VAR_BaseEndurance: | |
492 | 8474 this->uEndurance = (unsigned __int8)var_value; |
0 | 8475 goto LABEL_84; |
8476 case VAR_BaseSpeed: | |
492 | 8477 this->uSpeed = (unsigned __int8)var_value; |
0 | 8478 goto LABEL_84; |
8479 case VAR_BaseAccuracy: | |
492 | 8480 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8481 goto LABEL_84; |
8482 case VAR_BaseLuck: | |
492 | 8483 this->uLuck = (unsigned __int8)var_value; |
0 | 8484 goto LABEL_84; |
8485 case VAR_FixedFood: | |
492 | 8486 Party::SetFood(var_value); |
0 | 8487 goto LABEL_124; |
8488 case VAR_MightBonus: | |
8489 goto LABEL_64; | |
8490 case VAR_IntellectBonus: | |
8491 goto LABEL_68; | |
8492 case VAR_PersonalityBonus: | |
8493 goto LABEL_69; | |
8494 case VAR_EnduranceBonus: | |
8495 goto LABEL_70; | |
8496 case VAR_SpeedBonus: | |
8497 goto LABEL_71; | |
8498 case VAR_AccuracyBonus: | |
8499 goto LABEL_72; | |
8500 case VAR_LuckBonus: | |
8501 goto LABEL_73; | |
8502 default: | |
8503 return; | |
8504 } | |
8505 while ( v9->uItemID != 615 ) | |
8506 { | |
8507 ++v8; | |
8508 ++v9; | |
8509 if ( v8 >= 138 ) | |
8510 goto LABEL_22; | |
8511 } | |
8512 v10 = (int)((char *)v4 + 36 * v8); | |
8513 *(int *)(v10 + 532) = 601; | |
492 | 8514 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8515 LABEL_22: |
8516 if ( v4->sResFireBase < 20 ) | |
8517 v4->sResFireBase = 20; | |
8518 if ( v4->sResAirBase < 20 ) | |
8519 v4->sResAirBase = 20; | |
8520 if ( v4->sResWaterBase < 20 ) | |
8521 v4->sResWaterBase = 20; | |
8522 if ( v4->sResEarthBase < 20 ) | |
8523 v4->sResEarthBase = 20; | |
8524 v4->sResMindBase = 200; | |
8525 v4->sResBodyBase = 200; | |
8526 v11 = v4->GetSexByVoice(); | |
1014 | 8527 v4->uPrevVoiceID = v4->uVoiceID; |
8528 v4->uPrevFace = v4->uCurrentFace; | |
0 | 8529 if ( v11 ) |
8530 { | |
1014 | 8531 v4->uCurrentFace = 21; |
0 | 8532 v4->uVoiceID = 21; |
8533 } | |
8534 else | |
8535 { | |
1014 | 8536 v4->uCurrentFace = 20; |
0 | 8537 v4->uVoiceID = 20; |
8538 } | |
1014 | 8539 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
0 | 8540 goto LABEL_124; |
8541 } | |
8542 LABEL_64: | |
492 | 8543 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8544 LABEL_111: |
8545 v28 = 0; | |
187 | 8546 v26 = SPEECH_91; |
0 | 8547 LABEL_112: |
492 | 8548 v19 = pPlayers[currPlayerId + 1]; |
0 | 8549 v31 = 1; |
187 | 8550 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8551 goto LABEL_169; |
8552 } | |
492 | 8553 if ( var_type <= VAR_FireResistanceBonus ) |
8554 { | |
8555 if ( var_type == VAR_FireResistanceBonus ) | |
8556 { | |
8557 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8558 goto LABEL_111; |
8559 } | |
492 | 8560 switch ( var_type ) |
0 | 8561 { |
8562 case VAR_ActualIntellect: | |
8563 LABEL_68: | |
492 | 8564 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8565 goto LABEL_111; |
8566 case VAR_ActualPersonality: | |
8567 LABEL_69: | |
492 | 8568 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8569 goto LABEL_111; |
8570 case VAR_ActualEndurance: | |
8571 LABEL_70: | |
492 | 8572 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8573 goto LABEL_111; |
8574 case VAR_ActualSpeed: | |
8575 LABEL_71: | |
492 | 8576 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8577 goto LABEL_111; |
8578 case VAR_ActualAccuracy: | |
8579 LABEL_72: | |
492 | 8580 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8581 goto LABEL_111; |
8582 case VAR_ActualLuck: | |
8583 LABEL_73: | |
492 | 8584 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8585 goto LABEL_111; |
8586 case VAR_FireResistance: | |
492 | 8587 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8588 goto LABEL_84; |
8589 case VAR_AirResistance: | |
492 | 8590 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8591 goto LABEL_84; |
8592 case VAR_WaterResistance: | |
492 | 8593 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8594 goto LABEL_84; |
8595 case VAR_EarthResistance: | |
492 | 8596 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8597 goto LABEL_84; |
8598 case VAR_SpiritResistance: | |
492 | 8599 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8600 goto LABEL_84; |
8601 case VAR_MindResistance: | |
492 | 8602 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8603 goto LABEL_84; |
8604 case VAR_BodyResistance: | |
492 | 8605 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8606 goto LABEL_84; |
8607 case VAR_LightResistance: | |
492 | 8608 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8609 goto LABEL_84; |
8610 case VAR_DarkResistance: | |
492 | 8611 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8612 goto LABEL_84; |
8613 case VAR_MagicResistance: | |
492 | 8614 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8615 LABEL_84: |
8616 v28 = 0; | |
8617 v26 = 92; | |
8618 goto LABEL_112; | |
8619 default: | |
8620 return; | |
8621 } | |
8622 return; | |
8623 } | |
8624 HIWORD(v15) = 0; | |
492 | 8625 if ( var_type > VAR_DisarmTrapSkill ) |
8626 { | |
8627 if ( var_type != VAR_LearningSkill ) | |
8628 { | |
8629 if ( var_type <= VAR_LearningSkill ) | |
0 | 8630 return; |
492 | 8631 if ( var_type <= VAR_Eradicated ) |
8632 { | |
8633 v4->SetCondition(var_type - 105, 1); | |
0 | 8634 } |
8635 else | |
8636 { | |
492 | 8637 if ( var_type != VAR_MajorCondition ) |
0 | 8638 { |
492 | 8639 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8640 byte_5E4C15[var_type] = var_value; | |
0 | 8641 return; |
8642 } | |
8643 memset(v4, 0, 0xA0u); | |
8644 } | |
8645 LABEL_124: | |
8646 v31 = 1; | |
8647 goto LABEL_169; | |
8648 } | |
8649 LABEL_106: | |
492 | 8650 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8651 v17 = *(char *)v16; |
492 | 8652 if ( var_value <= VAR_BodyResistanceBonus ) |
8653 { | |
8654 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8655 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8656 } | |
8657 else | |
8658 { | |
492 | 8659 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8660 } |
8661 *(short *)v16 = v18; | |
8662 goto LABEL_124; | |
8663 } | |
492 | 8664 if ( var_type == VAR_DisarmTrapSkill ) |
8665 if ( v30 != 1 ) | |
8666 { | |
8667 if ( v31 != 1 ) | |
8668 return; | |
8669 v5 = 0; | |
8670 goto LABEL_172; | |
8671 } | |
8672 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8673 goto LABEL_170; | |
8674 if ( var_type <= VAR_BodyResistanceBonus ) | |
8675 { | |
8676 switch ( var_type ) | |
0 | 8677 { |
8678 case VAR_BodyResistanceBonus: | |
492 | 8679 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8680 break; |
8681 case VAR_AirResistanceBonus: | |
492 | 8682 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8683 break; |
8684 case VAR_WaterResistanceBonus: | |
492 | 8685 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8686 break; |
8687 case VAR_EarthResistanceBonus: | |
492 | 8688 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8689 break; |
8690 case VAR_SpiritResistanceBonus: | |
492 | 8691 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8692 break; |
8693 default: | |
492 | 8694 if ( var_type != 62 ) |
0 | 8695 return; |
492 | 8696 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8697 break; |
8698 } | |
8699 goto LABEL_111; | |
8700 } | |
492 | 8701 if ( var_type == VAR_LightResistanceBonus ) |
8702 { | |
8703 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8704 goto LABEL_111; |
8705 } | |
492 | 8706 if ( var_type == VAR_DarkResistanceBonus ) |
8707 { | |
8708 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8709 goto LABEL_111; | |
8710 } | |
8711 if ( var_type == VAR_MagicResistanceBonus ) | |
8712 { | |
8713 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8714 goto LABEL_111; |
8715 } | |
492 | 8716 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8717 if ( v30 != 1 ) | |
8718 { | |
8719 if ( v31 != 1 ) | |
8720 return; | |
8721 v5 = 0; | |
8722 v25 = 8 * currPlayerId + 400; | |
862 | 8723 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8724 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8725 return; | |
8726 } | |
8727 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8728 goto LABEL_170; | |
0 | 8729 } |
8730 | |
8731 | |
8732 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8733 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8734 { |
8735 char v3; // bl@1 | |
8736 Player *v4; // esi@1 | |
8737 signed int uPlayerIdx; // edi@1 | |
8738 int v6; // eax@15 | |
8739 unsigned int v7; // esi@18 | |
8740 int *v8; // ebx@21 | |
8741 int v9; // eax@22 | |
8742 signed int v10; // eax@24 | |
8743 int v11; // eax@27 | |
8744 __int16 *v12; // esi@28 | |
8745 Player *v13; // ecx@34 | |
8746 Player *v14; // ecx@36 | |
8747 char *v15; // ecx@37 | |
8748 unsigned __int8 v16; // cf@38 | |
8749 Player *v17; // ecx@42 | |
8750 __int16 *v18; // esi@53 | |
8751 __int16 *v19; // esi@62 | |
8752 char *v20; // esi@107 | |
8753 __int16 v21; // dx@107 | |
8754 int v22; // ecx@107 | |
8755 Player *v23; // ecx@132 | |
8756 int v24; // eax@132 | |
8757 int v25; // eax@150 | |
8758 char v26; // zf@151 | |
8759 DDM_DLV_Header *v27; // eax@153 | |
8760 signed int v28; // eax@176 | |
8761 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8762 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8763 int v31; // [sp-4h] [bp-3Ch]@84 |
8764 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8765 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8766 char v34; // [sp+37h] [bp-1h]@1 | |
8767 | |
8768 auto Dst = this; | |
8769 v3 = 0; | |
8770 v34 = 0; | |
8771 v4 = Dst; | |
8772 uPlayerIdx = 0; | |
8773 if ( Dst == pPlayers[2] ) | |
8774 uPlayerIdx = 1; | |
310 | 8775 else if ( Dst == pPlayers[3] ) |
8776 uPlayerIdx = 2; | |
8777 else if ( Dst == pPlayers[4] ) | |
8778 uPlayerIdx = 3; | |
8779 | |
8780 if ( var_type <= VAR_AutoNotes ) | |
8781 { | |
8782 if ( var_type != VAR_AutoNotes ) | |
8783 { | |
8784 if ( var_type <= VAR_ActualMight ) | |
8785 { | |
8786 if ( var_type != VAR_ActualMight ) | |
0 | 8787 { |
310 | 8788 switch ( var_type ) |
0 | 8789 { |
8790 case VAR_RandomGold: | |
8791 if ( !val ) | |
8792 val = 1; | |
8793 v6 = rand(); | |
8794 party_finds_gold(v6 % val + 1, 1); | |
8795 GameUI_DrawFoodAndGold(); | |
8796 return; | |
8797 case VAR_RandomFood: | |
8798 if ( !val ) | |
8799 val = 1; | |
8800 v7 = rand() % val + 1; | |
8801 Party::GiveFood(v7); | |
8802 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8803 ShowStatusBarString(pTmpBuf, 2u); | |
8804 GameUI_DrawFoodAndGold(); | |
8805 goto _play_sound; | |
8806 case VAR_Sex: | |
8807 Dst->uSex = (PLAYER_SEX)val; | |
8808 goto _play_anim_and_exit; | |
8809 case VAR_Class: | |
135 | 8810 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8811 goto _play_anim_and_exit; |
8812 case VAR_CurrentHP: | |
8813 v8 = &Dst->sHealth; | |
8814 *v8 += val; | |
8815 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8816 goto _play_anim_and_exit; | |
8817 v9 = v4->GetMaxHealth(); | |
8818 goto LABEL_23; | |
8819 case VAR_MaxHP: | |
8820 v10 = Dst->GetMaxHealth(); | |
8821 v4->_health_related = 0; | |
8822 v4->uFullHealthBonus = 0; | |
8823 v4->sHealth = v10; | |
8824 return; | |
8825 case VAR_CurrentSP: | |
8826 v8 = &Dst->sMana; | |
8827 *v8 += val; | |
8828 if ( Dst->sMana > GetMaxMana() ) | |
8829 { | |
8830 v9 = v4->GetMaxMana(); | |
8831 LABEL_23: | |
8832 *v8 = v9; | |
8833 } | |
8834 goto _play_anim_and_exit; | |
8835 case VAR_MaxSP: | |
8836 v11 = GetMaxMana(); | |
8837 v4->_mana_related = 0; | |
8838 v4->uFullManaBonus = 0; | |
8839 v4->sMana = v11; | |
8840 return; | |
8841 case VAR_ACModifier: | |
8842 v12 = &Dst->sACModifier; | |
8843 goto LABEL_29; | |
8844 case VAR_BaseLevel: | |
8845 v12 = (__int16 *)&Dst->uLevel; | |
8846 goto LABEL_29; | |
8847 case VAR_LevelModifier: | |
8848 v12 = &Dst->sLevelModifier; | |
8849 LABEL_29: | |
8850 *v12 += val; | |
8851 if ( *v12 > 255 ) | |
8852 *v12 = 255; | |
8853 goto _play_anim_and_exit; | |
8854 case VAR_Age: | |
8855 Dst->sAgeModifier += val; | |
8856 return; | |
8857 case VAR_Award: | |
8858 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8859 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8860 | |
492 | 8861 && pAwards[val].pText ) |
0 | 8862 { |
8863 v14 = pPlayers[uPlayerIdx + 1]; | |
8864 v34 = 1; | |
8865 v3 = 1; | |
187 | 8866 v14->PlaySound(SPEECH_96, 0); |
0 | 8867 } |
735 | 8868 v15 = (char *)v4->_guilds_member_bits; |
0 | 8869 goto LABEL_44; |
8870 case VAR_Experience: | |
8871 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8872 LODWORD(Dst->uExperience) += val; | |
8873 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8874 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8875 Dst->uExperience = 4000000000i64; | |
8876 goto _play_anim_and_exit; | |
8877 case VAR_QBits_QuestsDone: | |
484 | 8878 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
|
8879 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8880 && pQuestTable[val-1] ) |
0 | 8881 { |
501 | 8882 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8883 bFlashQuestBook = 1; |
8884 v34 = 1; | |
8885 v3 = 1; | |
501 | 8886 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8887 } |
484 | 8888 v15 = (char *)pParty->_quest_bits; |
0 | 8889 LABEL_44: |
8890 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8891 goto LABEL_173; | |
8892 case VAR_PlayerItemInHands: | |
8893 item.Reset(); | |
8894 item.Reset(); | |
8895 item.uAttributes = 1; | |
8896 item.uItemID = val; | |
8897 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8898 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8899 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8900 { | |
8901 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8902 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8903 } | |
8904 pParty->SetHoldingItem(&item); | |
8905 return; | |
8906 case VAR_FixedGold: | |
8907 party_finds_gold(val, 1); | |
8908 return; | |
8909 case VAR_BaseMight: | |
8910 v18 = (__int16 *)&Dst->uMight; | |
8911 goto LABEL_82; | |
8912 case VAR_BaseIntellect: | |
8913 v18 = (__int16 *)&Dst->uIntelligence; | |
8914 goto LABEL_82; | |
8915 case VAR_BasePersonality: | |
8916 v18 = (__int16 *)&Dst->uWillpower; | |
8917 goto LABEL_82; | |
8918 case VAR_BaseEndurance: | |
8919 v18 = (__int16 *)&Dst->uEndurance; | |
8920 goto LABEL_82; | |
8921 case VAR_BaseSpeed: | |
8922 v18 = (__int16 *)&Dst->uSpeed; | |
8923 goto LABEL_82; | |
8924 case VAR_BaseAccuracy: | |
8925 v18 = (__int16 *)&Dst->uAccuracy; | |
8926 goto LABEL_82; | |
8927 case VAR_BaseLuck: | |
8928 v18 = (__int16 *)&Dst->uLuck; | |
8929 goto LABEL_82; | |
8930 case VAR_FixedFood: | |
8931 Party::GiveFood(val); | |
715 | 8932 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8933 ShowStatusBarString(pTmpBuf, 2u); |
8934 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8935 Party::SetFood(0xFFFFu); | |
8936 goto _play_sound; | |
8937 case VAR_MightBonus: | |
8938 goto LABEL_62; | |
8939 case VAR_IntellectBonus: | |
8940 goto LABEL_66; | |
8941 case VAR_PersonalityBonus: | |
8942 goto LABEL_67; | |
8943 case VAR_EnduranceBonus: | |
8944 goto LABEL_68; | |
8945 case VAR_SpeedBonus: | |
8946 goto LABEL_69; | |
8947 case VAR_AccuracyBonus: | |
8948 goto LABEL_70; | |
8949 case VAR_LuckBonus: | |
8950 goto LABEL_71; | |
8951 default: | |
8952 return; | |
8953 } | |
8954 return; | |
8955 } | |
8956 LABEL_62: | |
8957 v19 = (__int16 *)&Dst->uMightBonus; | |
8958 goto LABEL_113; | |
8959 } | |
310 | 8960 if ( var_type <= VAR_FireResistanceBonus ) |
8961 { | |
8962 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8963 { |
310 | 8964 switch ( var_type ) |
0 | 8965 { |
8966 case VAR_ActualIntellect: | |
8967 LABEL_66: | |
8968 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8969 goto LABEL_113; | |
8970 case VAR_ActualPersonality: | |
8971 LABEL_67: | |
8972 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8973 goto LABEL_113; | |
8974 case VAR_ActualEndurance: | |
8975 LABEL_68: | |
8976 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8977 goto LABEL_113; | |
8978 case VAR_ActualSpeed: | |
8979 LABEL_69: | |
8980 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8981 goto LABEL_113; | |
8982 case VAR_ActualAccuracy: | |
8983 LABEL_70: | |
8984 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8985 goto LABEL_113; | |
8986 case VAR_ActualLuck: | |
8987 LABEL_71: | |
8988 v19 = (__int16 *)&Dst->uLuckBonus; | |
8989 goto LABEL_113; | |
8990 case VAR_FireResistance: | |
8991 v18 = &Dst->sResFireBase; | |
8992 goto LABEL_82; | |
8993 case VAR_AirResistance: | |
8994 v18 = &Dst->sResAirBase; | |
8995 goto LABEL_82; | |
8996 case VAR_WaterResistance: | |
8997 v18 = &Dst->sResWaterBase; | |
8998 goto LABEL_82; | |
8999 case VAR_EarthResistance: | |
9000 v18 = &Dst->sResEarthBase; | |
9001 goto LABEL_82; | |
9002 case VAR_SpiritResistance: | |
9003 v18 = &Dst->sResSpiritBase; | |
9004 goto LABEL_82; | |
9005 case VAR_MindResistance: | |
9006 v18 = &Dst->sResMindBase; | |
9007 goto LABEL_82; | |
9008 case VAR_BodyResistance: | |
9009 v18 = &Dst->sResBodyBase; | |
9010 goto LABEL_82; | |
9011 case VAR_LightResistance: | |
9012 v18 = &Dst->sResLightBase; | |
9013 goto LABEL_82; | |
9014 case VAR_DarkResistance: | |
9015 v18 = &Dst->sResDarkBase; | |
9016 goto LABEL_82; | |
9017 case VAR_MagicResistance: | |
9018 v18 = &Dst->sResMagicBase; | |
9019 LABEL_82: | |
9020 *v18 += val; | |
9021 if ( *v18 > 255 ) | |
9022 *v18 = 255; | |
9023 v31 = 0; | |
9024 v29 = 92; | |
9025 goto LABEL_116; | |
9026 default: | |
9027 return; | |
9028 } | |
9029 return; | |
9030 } | |
9031 v19 = &Dst->sResFireBonus; | |
9032 LABEL_113: | |
9033 *v19 += val; | |
9034 if ( *v19 > 255 ) | |
9035 *v19 = 255; | |
9036 v31 = 0; | |
187 | 9037 v29 = SPEECH_91; |
0 | 9038 LABEL_116: |
9039 v3 = 1; | |
187 | 9040 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9041 goto _play_anim_and_maybe_sound; |
9042 } | |
310 | 9043 if ( var_type <= VAR_DisarmTrapSkill ) |
9044 { | |
9045 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9046 { |
310 | 9047 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9048 { |
310 | 9049 switch ( var_type ) |
0 | 9050 { |
9051 case VAR_BodyResistanceBonus: | |
9052 v19 = &Dst->sResBodyBonus; | |
9053 break; | |
9054 case VAR_AirResistanceBonus: | |
9055 v19 = &Dst->sResAirBonus; | |
9056 break; | |
9057 case VAR_WaterResistanceBonus: | |
9058 v19 = &Dst->sResWaterBonus; | |
9059 break; | |
9060 case VAR_EarthResistanceBonus: | |
9061 v19 = &Dst->sResEarthBonus; | |
9062 break; | |
9063 case VAR_SpiritResistanceBonus: | |
9064 v19 = &Dst->sResSpiritBonus; | |
9065 break; | |
9066 default: | |
310 | 9067 if ( var_type != 62 ) |
0 | 9068 return; |
9069 v19 = &Dst->sResMindBonus; | |
9070 break; | |
9071 } | |
9072 goto LABEL_113; | |
9073 } | |
310 | 9074 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9075 { |
9076 v19 = &Dst->sResLightBonus; | |
9077 goto LABEL_113; | |
9078 } | |
310 | 9079 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9080 { |
9081 v19 = &Dst->sResDarkBonus; | |
9082 goto LABEL_113; | |
9083 } | |
310 | 9084 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9085 { |
9086 v19 = &Dst->sResMagicBonus; | |
9087 goto LABEL_113; | |
9088 } | |
310 | 9089 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9090 return; |
9091 } | |
9092 goto LABEL_106; | |
9093 } | |
310 | 9094 if ( var_type == VAR_LearningSkill ) |
0 | 9095 { |
9096 LABEL_106: | |
9097 if ( val <= VAR_BodyResistanceBonus ) | |
9098 { | |
310 | 9099 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9100 } |
9101 else | |
9102 { | |
310 | 9103 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9104 v21 = *(short *)v20; |
9105 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9106 if ( v22 > 60 ) | |
9107 LOWORD(v22) = 60; | |
9108 LOBYTE(v21) = v21 & 0xC0; | |
9109 *(short *)v20 = v22 | v21; | |
9110 } | |
9111 goto _play_anim_and_exit; | |
9112 } | |
310 | 9113 if ( var_type <= VAR_LearningSkill ) |
0 | 9114 return; |
310 | 9115 if ( var_type <= VAR_Eradicated ) |
9116 { | |
9117 Dst->SetCondition(var_type - 105, 0); | |
0 | 9118 } |
9119 else | |
9120 { | |
310 | 9121 if ( var_type != VAR_MajorCondition ) |
0 | 9122 { |
310 | 9123 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9124 { |
310 | 9125 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9126 byte_5E4C15[var_type] += val; | |
0 | 9127 else |
310 | 9128 byte_5E4C15[var_type] = -1; |
0 | 9129 } |
9130 return; | |
9131 } | |
9132 memset(Dst, 0, 0xA0u); | |
9133 } | |
9134 _play_anim_and_exit: | |
9135 v3 = 1; | |
9136 _play_anim_and_maybe_sound: | |
9137 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9138 _maybe_play_sound: | |
9139 if ( v3 != 1 ) | |
9140 return; | |
9141 goto _play_sound; | |
9142 } | |
9143 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
|
9144 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9145 && pAutonoteTxt[val-1].pText ) |
0 | 9146 { |
9147 v23 = pPlayers[uPlayerIdx + 1]; | |
9148 v34 = 1; | |
187 | 9149 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9150 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9151 bFlashAutonotesBook = 1; |
981 | 9152 _506568_autonote_type = v24; |
0 | 9153 } |
9154 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9155 v3 = 1; | |
9156 LABEL_173: | |
9157 if ( v34 != 1 ) | |
9158 goto _maybe_play_sound; | |
9159 goto _play_anim_and_maybe_sound; | |
9160 } | |
310 | 9161 if ( var_type > VAR_GoldInBank ) |
9162 { | |
9163 if ( var_type == 307 ) | |
0 | 9164 { |
9165 pParty->uNumDeaths += val; | |
9166 goto LABEL_173; | |
9167 } | |
310 | 9168 switch ( var_type ) |
0 | 9169 { |
9170 case 308: | |
9171 pParty->uNumBountiesCollected += val; | |
9172 break; | |
9173 case 309: | |
9174 pParty->uNumPrisonTerms += val; | |
9175 break; | |
9176 case 310: | |
9177 pParty->uNumArenaPageWins += val; | |
9178 break; | |
9179 case 311: | |
9180 pParty->uNumArenaSquireWins += val; | |
9181 break; | |
9182 case 312: | |
9183 pParty->uNumArenaKnightWins += val; | |
9184 break; | |
9185 case 313: | |
9186 pParty->uNumArenaLordWins += val; | |
9187 break; | |
9188 } | |
9189 } | |
9190 else | |
9191 { | |
310 | 9192 if ( var_type == VAR_GoldInBank ) |
0 | 9193 { |
9194 pParty->uNumGoldInBank += val; | |
9195 return; | |
9196 } | |
310 | 9197 if ( var_type <= VAR_Counter8 ) |
9198 { | |
9199 if ( (signed int)var_type >= 245 ) | |
9200 { | |
9201 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9202 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9203 } |
9204 else | |
9205 { | |
310 | 9206 switch ( var_type ) |
0 | 9207 { |
9208 case VAR_MonthEquals|VAR_CurrentSP: | |
9209 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9210 break; | |
9211 case VAR_NPCs2: | |
9212 pParty->field_709 = 0; | |
9213 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9214 Party__CountHirelings(); |
0 | 9215 viewparams->bRedrawGameUI = 1; |
9216 break; | |
9217 case VAR_NumSkillPoints: | |
9218 Dst->uSkillPoints += val; | |
9219 break; | |
9220 } | |
9221 } | |
9222 return; | |
9223 } | |
310 | 9224 if ( var_type < VAR_Counter9 ) |
0 | 9225 return; |
310 | 9226 if ( (signed int)var_type <= 274 ) |
9227 { | |
9228 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9229 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9230 goto _play_sound; |
9231 } | |
310 | 9232 if ( var_type != VAR_ReputationInCurrentLocation ) |
9233 { | |
9234 if ( var_type <= VAR_ReputationInCurrentLocation | |
9235 || var_type > VAR_History_28 | |
9236 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9237 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9238 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9239 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9240 v26) ) |
9241 return; | |
9242 bFlashHistoryBook = 1; | |
9243 _play_sound: | |
9244 v28 = 8 * uPlayerIdx + 400; | |
862 | 9245 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9246 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9247 return; | |
9248 } | |
9249 v27 = &pOutdoor->ddm; | |
9250 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9251 v27 = &pIndoor->dlv; | |
9252 v27->uReputation += val; | |
9253 if ( v27->uReputation > 10000 ) | |
9254 v27->uReputation = 10000; | |
9255 } | |
9256 } | |
9257 // 506568: using guessed type int dword_506568; | |
9258 // 507948: using guessed type char bFlashHistoryBook; | |
9259 // 507949: using guessed type char bFlashAutonotesBook; | |
9260 // 50794A: using guessed type char bFlashQuestBook; | |
9261 // 72371C: using guessed type int dword_72371C[]; | |
9262 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9263 | |
9264 | |
9265 | |
9266 | |
9267 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9268 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9269 { |
9270 unsigned int v3; // ebx@1 | |
9271 signed int v4; // esi@1 | |
501 | 9272 bool result; // eax@8 |
0 | 9273 int v6; // esi@11 |
9274 int v7; // edi@14 | |
9275 signed int v8; // eax@17 | |
9276 char *v9; // eax@20 | |
9277 char v10; // sf@20 | |
9278 char *v11; // ecx@26 | |
9279 char *v12; // ecx@27 | |
9280 __int64 v13; // qax@27 | |
9281 unsigned __int8 v14; // cf@27 | |
501 | 9282 int *v15; // edx@29 |
0 | 9283 char *v16; // eax@90 |
9284 char *v17; // ecx@94 | |
501 | 9285 int v18; // esi@97 |
0 | 9286 signed int v19; // edx@97 |
9287 char *v20; // ecx@98 | |
9288 int v21; // eax@100 | |
9289 __int16 v22; // dx@112 | |
9290 int v23; // [sp-8h] [bp-14h]@45 | |
9291 signed int v24; // [sp-4h] [bp-10h]@4 | |
9292 int v25; // [sp-4h] [bp-10h]@45 | |
9293 | |
9294 v3 = 0; | |
605 | 9295 v4 = uActiveCharacter - 1; |
501 | 9296 result = false; |
9297 if ( (signed int)VarNum > 222 ) | |
9298 { | |
9299 if ( (signed int)VarNum <= 307 ) | |
9300 { | |
9301 if ( VarNum == 307 ) | |
9302 { | |
9303 pParty->uNumDeaths -= (unsigned int)pValue; | |
9304 return pValue; | |
9305 } | |
9306 if ( VarNum == 223 ) | |
0 | 9307 { |
9308 v11 = (char *)pParty->_autonote_bits; | |
501 | 9309 v22 = (short)pValue - 1; |
0 | 9310 } |
9311 else | |
9312 { | |
501 | 9313 if ( VarNum != 231 ) |
0 | 9314 { |
501 | 9315 switch ( VarNum ) |
0 | 9316 { |
9317 case 232: | |
501 | 9318 VarNum = (VariableType)0; |
602 | 9319 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9320 result = (bool) pValue; |
9321 dword_5B65CC = 0; | |
9322 if ( (int)VarNum == pValue ) | |
0 | 9323 { |
501 | 9324 dword_5B65CC = (int)pValue; |
0 | 9325 } |
9326 else | |
9327 { | |
9328 pParty->field_709 = 0; | |
501 | 9329 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9330 Party__CountHirelings(); |
0 | 9331 viewparams->bRedrawGameUI = 1; |
9332 } | |
9333 break; | |
9334 case 241: | |
9335 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9336 { | |
9337 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9338 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9339 { |
605 | 9340 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9341 { |
9342 v21 = *(int *)v20; | |
9343 if ( (char)*(int *)v20 < 0 ) | |
9344 { | |
9345 LOBYTE(v21) = v21 & 0x7F; | |
9346 *(int *)v20 = v21; | |
9347 } | |
9348 } | |
9349 v20 += 76; | |
9350 } | |
9351 } | |
605 | 9352 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9353 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9354 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9355 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9356 pParty->field_709 = 0; | |
659 | 9357 Party__CountHirelings(); |
0 | 9358 break; |
9359 case 243: | |
9360 v17 = (char *)&this->uSkillPoints; | |
501 | 9361 result = *v17; |
9362 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9363 { | |
9364 *(int *)v17 -= (int)pValue; | |
9365 result = v17; | |
9366 } | |
0 | 9367 else |
9368 *(int *)v17 = 0; | |
9369 break; | |
9370 case 275: | |
9371 v16 = (char *)&pOutdoor->ddm; | |
9372 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9373 v16 = (char *)&pIndoor->dlv; | |
501 | 9374 *((int *)v16 + 2) -= (int)pValue; |
0 | 9375 if ( *((int *)v16 + 2) < -10000 ) |
9376 *((int *)v16 + 2) = -10000; | |
9377 break; | |
9378 case 306: | |
501 | 9379 result = VarNum - 306; |
9380 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9381 { | |
9382 result = (bool)pValue; | |
9383 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9384 } |
0 | 9385 else |
9386 LABEL_88: | |
9387 dword_5B65C4 = 1; | |
9388 break; | |
9389 } | |
501 | 9390 return result; |
0 | 9391 } |
9392 v11 = this->field_1A50; | |
501 | 9393 v22 = (signed __int16)pValue; |
0 | 9394 } |
9395 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9396 return result; |
9397 } | |
9398 switch ( VarNum ) | |
0 | 9399 { |
9400 case 308: | |
501 | 9401 result = (bool)pValue; |
9402 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9403 break; |
9404 case 309: | |
501 | 9405 result = (bool)pValue; |
9406 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9407 break; |
9408 case 310: | |
501 | 9409 result = (bool)pValue; |
9410 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9411 break; |
9412 case 311: | |
501 | 9413 result = (bool)pValue; |
9414 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9415 break; |
9416 case 312: | |
501 | 9417 result = (bool)pValue; |
9418 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9419 break; |
9420 case 313: | |
501 | 9421 result = (bool)pValue; |
9422 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9423 break; |
9424 } | |
9425 } | |
9426 else | |
9427 { | |
501 | 9428 if ( (signed int)VarNum >= 123 ) |
9429 { | |
9430 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9431 } |
9432 else | |
9433 { | |
501 | 9434 switch ( VarNum ) |
0 | 9435 { |
9436 case VAR_RandomGold: | |
501 | 9437 v6 = rand() % (signed int)pValue + 1; |
0 | 9438 if ( v6 > pParty->uNumGold ) |
9439 v6 = pParty->uNumGold; | |
9440 Party::TakeGold(v6); | |
9441 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9442 ShowStatusBarString(pTmpBuf, 2); |
0 | 9443 GameUI_DrawFoodAndGold(); |
501 | 9444 return result; |
0 | 9445 case VAR_RandomFood: |
501 | 9446 v7 = rand() % (signed int)pValue + 1; |
0 | 9447 if ( v7 > pParty->uNumFoodRations ) |
9448 v7 = pParty->uNumFoodRations; | |
9449 Party::TakeFood(v7); | |
9450 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9451 ShowStatusBarString(pTmpBuf, 2u); | |
9452 GameUI_DrawFoodAndGold(); | |
605 | 9453 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9454 v8 = 8 * v4 + 400; | |
862 | 9455 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9456 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9457 return result; |
0 | 9458 case VAR_CurrentHP: |
501 | 9459 ReceiveDamage((signed int)pValue, 4); |
605 | 9460 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9461 v8 = 8 * v4 + 400; | |
862 | 9462 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9463 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9464 return result; | |
0 | 9465 case VAR_CurrentSP: |
9466 v9 = (char *)&this->sMana; | |
501 | 9467 v10 = this->sMana - (signed int)pValue < 0; |
9468 *(int *)v9 -= (int)pValue; | |
0 | 9469 if ( v10 ) |
9470 *(int *)v9 = 0; | |
605 | 9471 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9472 v8 = 8 * v4 + 400; | |
862 | 9473 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9474 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9475 return result; | |
0 | 9476 case VAR_ACModifier: |
501 | 9477 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9478 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9479 v8 = 8 * v4 + 400; | |
862 | 9480 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9481 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9482 return result; | |
0 | 9483 case VAR_BaseLevel: |
501 | 9484 this->uLevel -= (unsigned __int8)pValue; |
605 | 9485 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9486 v8 = 8 * v4 + 400; | |
862 | 9487 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9488 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9489 return result; | |
0 | 9490 case VAR_LevelModifier: |
501 | 9491 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9492 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9493 v8 = 8 * v4 + 400; | |
862 | 9494 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9495 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9496 return result; | |
0 | 9497 case VAR_Age: |
501 | 9498 this->sAgeModifier -= (signed __int16)pValue; |
9499 return result; | |
0 | 9500 case VAR_Award: |
605 | 9501 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9502 return result; | |
0 | 9503 case VAR_Experience: |
9504 v12 = (char *)&this->uExperience; | |
501 | 9505 v13 = (signed int)pValue; |
9506 v14 = *(int *)v12 < (unsigned int)pValue; | |
9507 *(int *)v12 -= (int)pValue; | |
0 | 9508 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9509 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9510 v8 = 8 * v4 + 400; | |
862 | 9511 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9512 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9513 return result; | |
0 | 9514 case VAR_QBits_QuestsDone: |
501 | 9515 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9516 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9517 return true; |
0 | 9518 case VAR_PlayerItemInHands: |
501 | 9519 v15 = this->pInventoryIndices; |
0 | 9520 break; |
9521 case VAR_FixedGold: | |
501 | 9522 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9523 goto LABEL_88; |
501 | 9524 Party::TakeGold((unsigned int)pValue); |
9525 return result; | |
0 | 9526 case VAR_MightBonus: |
9527 case VAR_ActualMight: | |
501 | 9528 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9529 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9530 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9531 v8 = 8 * v4 + 400; | |
862 | 9532 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9533 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9534 return result; | |
0 | 9535 case VAR_IntellectBonus: |
9536 case VAR_ActualIntellect: | |
501 | 9537 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9538 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9539 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9540 v8 = 8 * v4 + 400; | |
862 | 9541 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9542 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9543 return result; | |
0 | 9544 case VAR_PersonalityBonus: |
9545 case VAR_ActualPersonality: | |
501 | 9546 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9547 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9548 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9549 v8 = 8 * v4 + 400; | |
862 | 9550 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9551 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9552 return result; | |
0 | 9553 case VAR_EnduranceBonus: |
9554 case VAR_ActualEndurance: | |
501 | 9555 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9556 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9557 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9558 v8 = 8 * v4 + 400; | |
862 | 9559 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9560 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9561 return result; | |
0 | 9562 case VAR_SpeedBonus: |
9563 case VAR_ActualSpeed: | |
501 | 9564 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9565 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9566 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9567 v8 = 8 * v4 + 400; | |
862 | 9568 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9569 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9570 return result; | |
0 | 9571 case VAR_AccuracyBonus: |
9572 case VAR_ActualAccuracy: | |
501 | 9573 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9574 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9575 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9576 v8 = 8 * v4 + 400; | |
862 | 9577 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9578 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9579 return result; | |
0 | 9580 case VAR_LuckBonus: |
9581 case VAR_ActualLuck: | |
501 | 9582 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9583 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9584 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9585 v8 = 8 * v4 + 400; | |
862 | 9586 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9587 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9588 return result; | |
0 | 9589 case VAR_BaseMight: |
501 | 9590 this->uMight -= (unsigned __int16)pValue; |
605 | 9591 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_BaseIntellect: |
501 | 9598 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9599 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9600 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9601 v8 = 8 * v4 + 400; | |
862 | 9602 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9603 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9604 return result; | |
0 | 9605 case VAR_BasePersonality: |
501 | 9606 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9607 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9608 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9609 v8 = 8 * v4 + 400; | |
862 | 9610 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9611 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9612 return result; | |
0 | 9613 case VAR_BaseEndurance: |
501 | 9614 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9615 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_BaseSpeed: |
501 | 9622 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9623 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9624 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9625 v8 = 8 * v4 + 400; | |
862 | 9626 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9627 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9628 return result; | |
0 | 9629 case VAR_BaseAccuracy: |
501 | 9630 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9631 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9632 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9633 v8 = 8 * v4 + 400; | |
862 | 9634 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9635 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9636 return result; | |
0 | 9637 case VAR_BaseLuck: |
501 | 9638 this->uLuck -= (unsigned __int16)pValue; |
605 | 9639 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9640 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9641 v8 = 8 * v4 + 400; | |
862 | 9642 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9643 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9644 return result; | |
0 | 9645 case VAR_FireResistance: |
501 | 9646 this->sResFireBase -= (signed __int16)pValue; |
605 | 9647 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9648 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9649 v8 = 8 * v4 + 400; | |
862 | 9650 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9651 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9652 return result; | |
0 | 9653 case VAR_AirResistance: |
501 | 9654 this->sResAirBase -= (signed __int16)pValue; |
605 | 9655 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9656 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9657 v8 = 8 * v4 + 400; | |
862 | 9658 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9659 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9660 return result; | |
0 | 9661 case VAR_WaterResistance: |
501 | 9662 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9663 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_EarthResistance: |
501 | 9670 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9671 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9672 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9673 v8 = 8 * v4 + 400; | |
862 | 9674 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9675 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9676 return result; | |
0 | 9677 case VAR_SpiritResistance: |
501 | 9678 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9679 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9680 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9681 v8 = 8 * v4 + 400; | |
862 | 9682 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9683 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9684 return result; | |
0 | 9685 case VAR_MindResistance: |
501 | 9686 this->sResMindBase -= (signed __int16)pValue; |
605 | 9687 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9688 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9689 v8 = 8 * v4 + 400; | |
862 | 9690 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9691 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9692 return result; | |
0 | 9693 case VAR_BodyResistance: |
501 | 9694 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9695 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9696 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9697 v8 = 8 * v4 + 400; | |
862 | 9698 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9699 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9700 return result; | |
0 | 9701 case VAR_LightResistance: |
501 | 9702 this->sResLightBase -= (signed __int16)pValue; |
605 | 9703 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9704 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9705 v8 = 8 * v4 + 400; | |
862 | 9706 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9707 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9708 return result; | |
0 | 9709 case VAR_DarkResistance: |
501 | 9710 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9711 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9712 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9713 v8 = 8 * v4 + 400; | |
862 | 9714 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9715 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9716 return result; | |
0 | 9717 case VAR_MagicResistance: |
501 | 9718 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9719 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9720 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9721 v8 = 8 * v4 + 400; | |
862 | 9722 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9723 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9724 return result; | |
0 | 9725 case VAR_FireResistanceBonus: |
501 | 9726 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9727 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9728 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9729 v8 = 8 * v4 + 400; | |
862 | 9730 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9731 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9732 return result; | |
0 | 9733 case VAR_AirResistanceBonus: |
501 | 9734 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9735 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9736 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9737 v8 = 8 * v4 + 400; | |
862 | 9738 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9739 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9740 return result; | |
0 | 9741 case VAR_WaterResistanceBonus: |
501 | 9742 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9743 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9744 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9745 v8 = 8 * v4 + 400; | |
862 | 9746 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9747 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9748 return result; | |
0 | 9749 case VAR_EarthResistanceBonus: |
501 | 9750 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9751 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9752 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9753 v8 = 8 * v4 + 400; | |
862 | 9754 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9755 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9756 return result; | |
0 | 9757 case VAR_SpiritResistanceBonus: |
501 | 9758 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9759 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9760 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9761 v8 = 8 * v4 + 400; | |
862 | 9762 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9763 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9764 return result; | |
0 | 9765 case VAR_MindResistanceBonus: |
501 | 9766 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9767 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9768 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9769 v8 = 8 * v4 + 400; | |
862 | 9770 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9771 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9772 return result; | |
0 | 9773 case VAR_BodyResistanceBonus: |
501 | 9774 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9775 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9776 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9777 v8 = 8 * v4 + 400; | |
862 | 9778 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9779 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9780 return result; | |
0 | 9781 case VAR_LightResistanceBonus: |
501 | 9782 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9783 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9784 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9785 v8 = 8 * v4 + 400; | |
862 | 9786 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9787 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9788 return result; | |
0 | 9789 case VAR_DarkResistanceBonus: |
501 | 9790 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9791 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9792 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9793 v8 = 8 * v4 + 400; | |
862 | 9794 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9795 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9796 return result; | |
0 | 9797 case VAR_MagicResistanceBonus: |
501 | 9798 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9799 v25 = 0; |
187 | 9800 v23 = SPEECH_91; |
9801 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9802 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9803 v8 = 8 * v4 + 400; | |
862 | 9804 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9805 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9806 return result; | |
0 | 9807 case VAR_FixedFood: |
501 | 9808 Party::TakeFood((unsigned int)pValue); |
605 | 9809 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9810 v8 = 8 * v4 + 400; | |
862 | 9811 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9812 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9813 return result; | |
0 | 9814 case VAR_StaffSkill: |
9815 case VAR_SwordSkill: | |
9816 case VAR_DaggerSkill: | |
9817 case VAR_AxeSkill: | |
9818 case VAR_SpearSkill: | |
9819 case VAR_BowSkill: | |
9820 case VAR_MaceSkill: | |
9821 case VAR_BlasterSkill: | |
9822 case VAR_ShieldSkill: | |
9823 case VAR_LeatherSkill: | |
9824 case VAR_SkillChain: | |
9825 case VAR_PlateSkill: | |
9826 case VAR_FireSkill: | |
9827 case VAR_AirSkill: | |
9828 case VAR_WaterSkill: | |
9829 case VAR_EarthSkill: | |
9830 case VAR_SpiritSkill: | |
9831 case VAR_MindSkill: | |
9832 case VAR_BodySkill: | |
9833 case VAR_LightSkill: | |
9834 case VAR_DarkSkill: | |
9835 case VAR_IdentifyItemSkill: | |
9836 case VAR_MerchantSkill: | |
9837 case VAR_RepairSkill: | |
9838 case VAR_BodybuildingSkill: | |
9839 case VAR_MeditationSkill: | |
9840 case VAR_PerceptionSkill: | |
9841 case VAR_DiplomacySkill: | |
9842 case VAR_DisarmTrapSkill: | |
9843 case VAR_LearningSkill: | |
501 | 9844 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9845 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9846 v8 = 8 * v4 + 400; | |
862 | 9847 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9848 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9849 return result; | |
0 | 9850 case VAR_Cursed: |
9851 case VAR_Weak: | |
9852 case VAR_Asleep: | |
9853 case VAR_Afraid: | |
9854 case VAR_Drunk: | |
9855 case VAR_Insane: | |
9856 case VAR_PoisonedGreen: | |
9857 case VAR_DiseasedGreen: | |
9858 case VAR_PoisonedYellow: | |
9859 case VAR_DiseasedYellow: | |
9860 case VAR_PoisonedRed: | |
9861 case VAR_DiseasedRed: | |
9862 case VAR_Paralyzed: | |
9863 case VAR_Unconsious: | |
9864 case VAR_Dead: | |
9865 case VAR_Stoned: | |
9866 case VAR_Eradicated: | |
501 | 9867 *((int *)this + 2 * VarNum - 210) = 0; |
9868 *((int *)this + 2 * result - 209) = 0; | |
0 | 9869 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9870 v8 = 8 * v4 + 400; | |
862 | 9871 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9872 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9873 return result; |
605 | 9874 default: |
9875 return result; | |
9876 } | |
9877 for (v3 = 1; v3 < 126; v3++) | |
9878 { | |
9879 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9880 { |
605 | 9881 RemoveItemAtInventoryIndex(v3); |
501 | 9882 return true; |
0 | 9883 } |
605 | 9884 } |
501 | 9885 if ( pParty->pPickedItem.uItemID == pValue ) |
9886 { | |
605 | 9887 pMouse->RemoveHoldingItem(); |
9888 return true; | |
9889 } | |
9890 return false; | |
0 | 9891 } |
9892 } | |
9893 } | |
9894 // 5B65C4: using guessed type int dword_5B65C4; | |
9895 // 5B65CC: using guessed type int dword_5B65CC; |