Mercurial > mm7
annotate Player.cpp @ 1034:aa848c90181f
Merge
author | Nomad |
---|---|
date | Tue, 21 May 2013 23:45:26 +0200 |
parents | 3a5c8df8381d 9408f98f4929 |
children | 306ec23b37df 7f8be9f9769e |
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 { | |
1032 | 4534 int inv_indx; // eax@3 |
4535 | |
4536 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
4537 { | |
4538 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4539 continue; | |
4540 inv_indx = pEquipment.pIndices[i] - 1; | |
4541 if (a2==17) | |
4542 { | |
4543 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID=533)) //Elven Chainmail+Increases rate of Recovery | |
4544 return 50; | |
4545 } | |
4546 if (a2==24) | |
4547 { | |
4548 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. | |
4549 return 5; | |
4550 } | |
4551 } | |
4552 return 0; | |
0 | 4553 } |
4554 | |
4555 //----- (0048EAAE) -------------------------------------------------------- | |
4556 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4557 { | |
4558 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4559 signed int v4; // eax@1 | |
4560 int v5; // edi@1 | |
4561 Player *v6; // ebx@1 | |
4562 Player *v8; // ecx@48 | |
4563 int v9; // eax@49 | |
4564 int v10; // edx@49 | |
4565 Player *v11; // ecx@55 | |
4566 int v12; // eax@56 | |
4567 int v13; // edx@56 | |
4568 int v14; // ecx@58 | |
4569 int v15; // eax@58 | |
4570 Player *v16; // ecx@61 | |
4571 int v17; // eax@62 | |
4572 Player *v18; // ecx@66 | |
4573 int v19; // eax@67 | |
4574 int v20; // eax@69 | |
4575 Player *v21; // ecx@75 | |
4576 int v22; // eax@76 | |
4577 int v23; // edx@76 | |
4578 int v24; // eax@79 | |
4579 int v25; // ecx@80 | |
4580 int v26; // edi@80 | |
4581 Player *v27; // ecx@84 | |
4582 int v28; // eax@85 | |
4583 int v29; // edx@85 | |
4584 Player *v30; // ecx@96 | |
4585 int v31; // ebp@97 | |
4586 int v32; // eax@98 | |
4587 unsigned int v33; // eax@100 | |
4588 int v34; // eax@103 | |
4589 char v35; // zf@104 | |
4590 char v36; // zf@107 | |
4591 unsigned __int8 v37; // zf@119 | |
4592 char v38; // sf@119 | |
4593 unsigned __int8 v39; // of@119 | |
4594 char v40; // zf@122 | |
4595 char v41; // zf@145 | |
4596 char v42; // zf@164 | |
4597 char v43; // zf@173 | |
4598 char v44; // zf@189 | |
4599 char v45; // zf@198 | |
4600 char v46; // zf@239 | |
4601 int v47; // eax@268 | |
4602 int v48; // eax@269 | |
4603 int v49; // eax@291 | |
4604 char v50; // zf@295 | |
4605 int v51; // eax@306 | |
4606 int v52; // eax@307 | |
4607 char v53; // zf@312 | |
4608 char v54; // zf@336 | |
4609 char v55; // zf@348 | |
4610 int v56; // eax@365 | |
4611 int v57; // ebx@368 | |
4612 signed int v58; // [sp-4h] [bp-20h]@10 | |
4613 signed int v59; // [sp-4h] [bp-20h]@71 | |
4614 signed int v60; // [sp-4h] [bp-20h]@347 | |
4615 int v61; // [sp+10h] [bp-Ch]@1 | |
4616 int v62; // [sp+14h] [bp-8h]@1 | |
4617 int v63; // [sp+18h] [bp-4h]@101 | |
4618 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4619 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4620 | |
4621 v3 = attr; | |
4622 v4 = 36; | |
4623 v5 = 0; | |
4624 v6 = this; | |
4625 v62 = 0; | |
4626 v61 = 0; | |
4627 | |
4628 switch (attr) | |
4629 { | |
4630 case CHARACTER_ATTRIBUTE_LEVEL: | |
4631 if (HasEnchantedItemEquipped(25)) | |
4632 return 5; | |
4633 return 0; | |
4634 }; | |
4635 | |
4636 if ( (signed int)attr > 36 ) | |
4637 { | |
4638 switch ( attr ) | |
4639 { | |
4640 case 37: | |
4641 v58 = 15; | |
4642 goto LABEL_35; | |
4643 case 38: | |
4644 v58 = 16; | |
4645 goto LABEL_35; | |
4646 case 39: | |
4647 v58 = 17; | |
4648 goto LABEL_35; | |
4649 case 40: | |
4650 v58 = 18; | |
4651 goto LABEL_35; | |
4652 case 41: | |
4653 v58 = 19; | |
4654 goto LABEL_35; | |
4655 case 42: | |
4656 v58 = 20; | |
4657 goto LABEL_35; | |
4658 case 43: | |
4659 v58 = 25; | |
4660 goto LABEL_35; | |
4661 case 44: | |
4662 v58 = 5; | |
4663 goto LABEL_35; | |
4664 case 45: | |
4665 v58 = 8; | |
4666 goto LABEL_35; | |
4667 case 46: | |
4668 goto LABEL_36; | |
4669 default: | |
4670 break; | |
4671 } | |
4672 } | |
4673 else | |
4674 { | |
4675 if ( attr == 36 ) | |
4676 { | |
4677 v58 = 14; | |
4678 } | |
4679 else | |
4680 { | |
4681 if ( (signed int)attr > 21 ) | |
4682 { | |
4683 switch ( attr ) | |
4684 { | |
4685 case 22: | |
4686 v58 = 30; | |
4687 break; | |
4688 case 23: | |
4689 v58 = 31; | |
4690 break; | |
4691 case 34: | |
4692 v58 = 12; | |
4693 break; | |
4694 default: | |
4695 if ( attr != 35 ) | |
4696 goto LABEL_38; | |
4697 v58 = 13; | |
4698 break; | |
4699 } | |
4700 } | |
4701 else | |
4702 { | |
4703 switch ( attr ) | |
4704 { | |
4705 case 21: | |
4706 v58 = 33; | |
4707 break; | |
4708 case 16: | |
4709 v58 = 35; | |
4710 break; | |
4711 case 17: | |
4712 v58 = 34; | |
4713 break; | |
4714 case 18: | |
4715 v58 = 29; | |
4716 break; | |
4717 case 19: | |
4718 v58 = 21; | |
4719 break; | |
4720 default: | |
4721 if ( attr != 20 ) | |
4722 goto LABEL_38; | |
4723 v58 = 32; | |
4724 break; | |
4725 } | |
4726 } | |
4727 } | |
4728 LABEL_35: | |
4729 v4 = v58; | |
4730 LABEL_36: | |
4731 if ( !this->pActiveSkills[v4] ) | |
4732 return 0; | |
4733 } | |
4734 LABEL_38: | |
4735 if ( (signed int)attr > 28 ) | |
4736 { | |
4737 if ( (signed int)attr < 29 ) | |
4738 return v5 + v62 + v61; | |
4739 if ( (signed int)attr <= 30 ) | |
4740 { | |
4741 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4742 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4743 return v5 + v62 + v61; |
4744 } | |
4745 if ( attr == 31 ) | |
4746 { | |
4747 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4748 return v5 + v62 + v61; | |
232 | 4749 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4750 v5 = pItemsTable->pItems[v57].uDamageMod; |
4751 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4752 goto LABEL_366; | |
4753 } | |
4754 if ( attr == 32 ) | |
4755 { | |
4756 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4757 return v5 + v62 + v61; | |
232 | 4758 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4759 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4760 LABEL_365: | |
4761 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4762 LABEL_366: | |
4763 v5 += v56; | |
4764 return v5 + v62 + v61; | |
4765 } | |
4766 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4767 return v5 + v62 + v61; | |
4768 LABEL_95: | |
4769 v65 = 0; | |
4770 while ( 1 ) | |
4771 { | |
4772 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4773 goto LABEL_361; | |
898 | 4774 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4775 if ( v3 == 9 ) |
4776 { | |
816 | 4777 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4778 if ( v32 >= 3 ) |
4779 { | |
4780 if ( v32 <= 11 ) | |
4781 { | |
4782 v33 = v6->pInventoryItems[v31].uItemID; | |
4783 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4784 } | |
4785 } | |
4786 } | |
4787 v63 = (int)((char *)v6 + 36 * v31); | |
4788 attra = (ItemGen *)(v63 + 532); | |
377 | 4789 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4790 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4791 { |
4792 v34 = attra->uItemID; | |
4793 switch ( attra->uItemID ) | |
4794 { | |
4795 case 0x1F4u: | |
4796 v35 = v3 == 5; | |
4797 goto LABEL_105; | |
4798 case 0x1F5u: | |
4799 v36 = v3 == 0; | |
4800 goto LABEL_108; | |
4801 case 0x1F6u: | |
4802 if ( v3 == 21 ) | |
4803 v61 += 10; | |
4804 v36 = v3 == 2; | |
4805 goto LABEL_108; | |
4806 case 0x1F7u: | |
4807 if ( v3 == 17 ) | |
4808 v61 += 5; | |
4809 if ( v3 == 18 ) | |
4810 v61 += 5; | |
4811 v36 = v3 == 6; | |
4812 goto LABEL_108; | |
4813 case 0x1F8u: | |
4814 goto LABEL_118; | |
4815 case 0x1F9u: | |
4816 v40 = v3 == 3; | |
4817 goto LABEL_123; | |
4818 case 0x1FAu: | |
4819 v35 = v3 == 10; | |
4820 goto LABEL_105; | |
4821 case 0x1FEu: | |
4822 v35 = v3 == 4; | |
4823 goto LABEL_105; | |
4824 case 0x1FFu: | |
4825 if ( v3 == 23 ) | |
4826 v61 += 10; | |
4827 if ( v3 == 22 ) | |
4828 v61 += 10; | |
4829 goto LABEL_361; | |
4830 case 0x200u: | |
4831 if ( v3 == 36 ) | |
4832 { | |
4833 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4834 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4835 } | |
4836 v36 = v3 == 5; | |
4837 LABEL_108: | |
4838 if ( v36 ) | |
4839 v5 += 40; | |
4840 goto LABEL_361; | |
4841 case 0x201u: | |
4842 if ( v3 == 39 ) | |
4843 { | |
4844 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4845 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4846 v62 = v34; | |
4847 } | |
4848 goto LABEL_136; | |
4849 case 0x202u: | |
4850 if ( !v3 ) | |
4851 v5 += 150; | |
4852 if ( v3 == 1 ) | |
4853 v5 -= 40; | |
4854 if ( v3 == 2 ) | |
4855 v5 -= 40; | |
4856 goto LABEL_145; | |
4857 case 0x203u: | |
4858 if ( v3 == 42 ) | |
4859 { | |
4860 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4861 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4862 } | |
4863 if ( v3 == 43 ) | |
4864 v61 += 15; | |
4865 goto LABEL_361; | |
4866 case 0x204u: | |
4867 if ( v3 == 17 ) | |
4868 v61 += 5; | |
4869 if ( v3 == 18 ) | |
4870 v61 += 5; | |
4871 if ( v3 == 6 ) | |
4872 v5 += 50; | |
4873 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4874 goto LABEL_166; | |
4875 v42 = v3 == 15; | |
4876 goto LABEL_165; | |
4877 case 0x205u: | |
4878 if ( v3 == 18 ) | |
4879 v61 += 5; | |
4880 goto LABEL_361; | |
4881 case 0x206u: | |
4882 if ( !v3 ) | |
4883 v5 += 100; | |
4884 if ( v3 == 3 ) | |
4885 v5 += 100; | |
4886 v43 = v3 == 9; | |
4887 goto LABEL_174; | |
4888 case 0x207u: | |
4889 if ( v3 == 45 ) | |
4890 v61 += 5; | |
4891 if ( v3 == 15 ) | |
4892 v5 -= 10; | |
4893 v42 = v3 == 14; | |
4894 LABEL_165: | |
4895 if ( v42 ) | |
4896 LABEL_166: | |
4897 v5 -= 10; | |
4898 goto LABEL_361; | |
4899 case 0x208u: | |
4900 v35 = v3 == 3; | |
4901 goto LABEL_105; | |
4902 case 0x209u: | |
4903 if ( v3 == 2 ) | |
4904 v5 += 15; | |
4905 if ( !v3 ) | |
4906 v5 += 15; | |
4907 v41 = v3 == 6; | |
4908 goto LABEL_146; | |
4909 case 0x20Au: | |
4910 if ( v3 == 46 ) | |
4911 v61 += 15; | |
4912 v44 = v3 == 3; | |
4913 goto LABEL_190; | |
4914 case 0x20Bu: | |
4915 if ( v3 == 34 ) | |
4916 { | |
4917 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4918 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4919 } | |
4920 if ( v3 == 12 ) | |
4921 v5 += 50; | |
4922 if ( v3 == 2 ) | |
4923 v5 += 30; | |
4924 v45 = v3 == 9; | |
4925 goto LABEL_199; | |
4926 case 0x20Cu: | |
4927 if ( !v3 ) | |
4928 v5 += 75; | |
4929 goto LABEL_145; | |
4930 case 0x20Du: | |
4931 if ( v3 == 5 ) | |
4932 v5 += 50; | |
4933 if ( v3 == 6 ) | |
4934 v5 += 50; | |
4935 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4936 goto LABEL_374; | |
4937 v43 = v3 == 15; | |
4938 LABEL_174: | |
4939 if ( v43 ) | |
4940 LABEL_374: | |
4941 v5 -= 15; | |
4942 goto LABEL_361; | |
4943 case 0x20Eu: | |
4944 if ( v3 == 4 ) | |
4945 v5 += 150; | |
4946 if ( v3 == 44 ) | |
4947 v61 += 5; | |
4948 if ( v3 == 9 ) | |
4949 v5 -= 25; | |
4950 goto LABEL_361; | |
4951 case 0x20Fu: | |
4952 if ( v3 == 39 ) | |
4953 { | |
4954 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4955 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4956 v62 = v34; | |
4957 } | |
4958 if ( v3 == 40 ) | |
4959 { | |
4960 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4961 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4962 } | |
4963 LABEL_145: | |
4964 v41 = v3 == 5; | |
4965 LABEL_146: | |
4966 if ( v41 ) | |
4967 v5 -= 40; | |
4968 goto LABEL_361; | |
4969 case 0x210u: | |
4970 if ( v3 == 38 ) | |
4971 { | |
4972 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4973 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4974 } | |
4975 if ( !v3 ) | |
4976 v5 += 75; | |
4977 v44 = v3 == 11; | |
4978 LABEL_190: | |
4979 if ( v44 ) | |
4980 v5 -= 50; | |
4981 goto LABEL_361; | |
4982 case 0x211u: | |
4983 if ( v3 == 5 ) | |
4984 v5 += 100; | |
4985 if ( v3 == 4 ) | |
4986 v5 += 50; | |
4987 v35 = v3 == 11; | |
4988 LABEL_105: | |
4989 if ( v35 ) | |
4990 v5 += 50; | |
4991 goto LABEL_361; | |
4992 case 0x212u: | |
4993 if ( v3 == 1 ) | |
4994 v5 -= 20; | |
4995 v45 = v3 == 2; | |
4996 LABEL_199: | |
4997 if ( v45 ) | |
4998 v5 -= 20; | |
4999 goto LABEL_361; | |
5000 case 0x214u: | |
5001 if ( v3 == 1 ) | |
5002 v5 += 15; | |
5003 v46 = v3 == 2; | |
5004 goto LABEL_240; | |
5005 case 0x215u: | |
5006 if ( v3 == 5 ) | |
5007 v5 += 15; | |
5008 v46 = v3 == 4; | |
5009 goto LABEL_240; | |
5010 case 0x216u: | |
5011 if ( v3 == 10 ) | |
5012 v5 += 30; | |
5013 if ( !v3 ) | |
5014 v5 += 15; | |
5015 goto LABEL_315; | |
5016 case 0x217u: | |
5017 if ( v3 == 21 ) | |
5018 v61 += 5; | |
5019 if ( !v3 ) | |
5020 v5 += 15; | |
5021 goto LABEL_253; | |
5022 case 0x218u: | |
5023 goto LABEL_253; | |
5024 default: | |
5025 goto LABEL_361; | |
5026 } | |
5027 goto LABEL_361; | |
5028 } | |
5029 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5030 { | |
5031 if ( (signed int)v3 >= 0 ) | |
5032 { | |
5033 if ( (signed int)v3 <= 15 ) | |
5034 { | |
5035 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5036 } | |
5037 else | |
5038 { | |
5039 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5040 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5041 } | |
5042 } | |
5043 goto LABEL_361; | |
5044 } | |
5045 v34 = *(int *)(v63 + 544); | |
5046 if ( v34 > 48 ) | |
5047 { | |
5048 switch ( v34 ) | |
5049 { | |
5050 case 54: | |
5051 goto LABEL_315; | |
5052 case 49: | |
5053 if ( v3 == 6 ) | |
5054 goto LABEL_121; | |
5055 v50 = v3 == 1; | |
5056 goto LABEL_296; | |
5057 case 51: | |
5058 if ( v3 != 5 && v3 != 1 ) | |
5059 goto LABEL_309; | |
5060 goto LABEL_121; | |
5061 case 52: | |
5062 if ( v3 == 3 ) | |
5063 goto LABEL_121; | |
5064 v50 = v3 == 4; | |
5065 goto LABEL_296; | |
5066 case 53: | |
5067 if ( !v3 ) | |
5068 goto LABEL_121; | |
5069 v50 = v3 == 2; | |
5070 goto LABEL_296; | |
5071 case 55: | |
5072 v46 = v3 == 6; | |
5073 goto LABEL_240; | |
5074 case 56: | |
5075 if ( !v3 ) | |
5076 goto LABEL_351; | |
5077 v53 = v3 == 3; | |
5078 goto LABEL_350; | |
5079 case 57: | |
5080 if ( v3 == 1 ) | |
5081 goto LABEL_351; | |
5082 v53 = v3 == 2; | |
5083 goto LABEL_350; | |
5084 case 50: | |
5085 if ( v3 == 10 ) | |
5086 v5 += 30; | |
5087 goto LABEL_361; | |
5088 case 60: | |
5089 if ( v3 != 23 ) | |
5090 goto LABEL_336; | |
5091 if ( v5 >= 3 ) | |
5092 goto LABEL_361; | |
5093 v5 = 3; | |
5094 LABEL_336: | |
5095 v54 = v3 == 22; | |
5096 goto LABEL_345; | |
5097 case 61: | |
5098 if ( v3 != 17 ) | |
5099 goto LABEL_340; | |
5100 if ( v5 >= 3 ) | |
5101 goto LABEL_361; | |
5102 v5 = 3; | |
5103 LABEL_340: | |
5104 v54 = v3 == 18; | |
5105 goto LABEL_345; | |
5106 case 62: | |
5107 if ( v3 != 19 ) | |
5108 goto LABEL_344; | |
5109 if ( v5 >= 3 ) | |
5110 goto LABEL_361; | |
5111 v5 = 3; | |
5112 LABEL_344: | |
5113 v54 = v3 == 20; | |
5114 LABEL_345: | |
5115 if ( !v54 ) | |
5116 goto LABEL_361; | |
5117 if ( v5 >= 3 ) | |
5118 goto LABEL_361; | |
5119 v60 = 3; | |
5120 goto LABEL_360; | |
5121 case 67: | |
5122 v55 = v3 == 18; | |
5123 goto LABEL_357; | |
5124 case 68: | |
5125 v53 = v3 == 9; | |
5126 goto LABEL_350; | |
5127 case 69: | |
5128 if ( v3 == 11 ) | |
5129 v5 += 20; | |
5130 break; | |
5131 case 70: | |
5132 if ( v3 == 12 ) | |
5133 v5 += 10; | |
5134 v55 = v3 == 16; | |
5135 LABEL_357: | |
5136 if ( v55 && v5 < 2 ) | |
5137 { | |
5138 v60 = 2; | |
5139 LABEL_360: | |
5140 v5 = v60; | |
5141 } | |
5142 break; | |
5143 default: | |
5144 goto LABEL_361; | |
5145 } | |
5146 goto LABEL_361; | |
5147 } | |
5148 if ( v34 == 48 ) | |
5149 { | |
5150 if ( v3 == 9 ) | |
5151 v5 += 5; | |
5152 LABEL_315: | |
5153 v46 = v3 == 3; | |
5154 LABEL_240: | |
5155 if ( v46 ) | |
5156 v5 += 15; | |
5157 goto LABEL_361; | |
5158 } | |
5159 if ( v34 > 32 ) | |
5160 { | |
5161 if ( v34 > 44 ) | |
5162 { | |
5163 v51 = v34 - 45; | |
5164 if ( !v51 ) | |
5165 { | |
5166 if ( v3 == 5 ) | |
5167 goto LABEL_351; | |
5168 v53 = v3 == 4; | |
5169 LABEL_350: | |
5170 if ( v53 ) | |
5171 LABEL_351: | |
5172 v5 += 5; | |
5173 goto LABEL_361; | |
5174 } | |
5175 v52 = v51 - 1; | |
5176 if ( !v52 ) | |
5177 { | |
5178 v40 = v3 == 0; | |
5179 LABEL_123: | |
5180 if ( v40 ) | |
5181 v5 += 25; | |
5182 goto LABEL_361; | |
5183 } | |
5184 if ( v52 == 1 ) | |
5185 { | |
5186 LABEL_309: | |
5187 v50 = v3 == 8; | |
5188 goto LABEL_296; | |
5189 } | |
5190 } | |
5191 else | |
5192 { | |
5193 if ( v34 == 44 ) | |
5194 { | |
5195 v50 = v3 == 7; | |
5196 goto LABEL_296; | |
5197 } | |
5198 v34 -= 33; | |
5199 if ( !v34 ) | |
5200 { | |
5201 if ( v3 != 38 ) | |
5202 goto LABEL_361; | |
5203 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5204 goto LABEL_138; | |
5205 } | |
5206 --v34; | |
5207 if ( !v34 ) | |
5208 { | |
5209 if ( v3 != 36 ) | |
5210 goto LABEL_361; | |
5211 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5212 goto LABEL_138; | |
5213 } | |
5214 v49 = v34 - 8; | |
5215 if ( !v49 ) | |
5216 { | |
5217 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5218 ++v5; | |
5219 goto LABEL_361; | |
5220 } | |
5221 if ( v49 == 1 ) | |
5222 { | |
5223 if ( v3 != 3 && v3 != 7 ) | |
5224 { | |
5225 v50 = v3 == 9; | |
5226 LABEL_296: | |
5227 if ( !v50 ) | |
5228 goto LABEL_361; | |
5229 } | |
5230 LABEL_121: | |
5231 v5 += 10; | |
5232 goto LABEL_361; | |
5233 } | |
5234 } | |
5235 } | |
5236 else | |
5237 { | |
5238 if ( v34 == 32 ) | |
5239 { | |
5240 if ( v3 != 39 ) | |
5241 goto LABEL_361; | |
5242 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5243 goto LABEL_138; | |
5244 } | |
5245 if ( v34 > 28 ) | |
5246 { | |
5247 v34 -= 29; | |
5248 if ( v34 ) | |
5249 { | |
5250 --v34; | |
5251 if ( v34 ) | |
5252 { | |
5253 --v34; | |
5254 if ( v34 || v3 != 41 ) | |
5255 goto LABEL_361; | |
5256 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5257 } | |
5258 else | |
5259 { | |
5260 if ( v3 != 34 ) | |
5261 goto LABEL_361; | |
5262 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5263 } | |
5264 } | |
5265 else | |
5266 { | |
5267 if ( v3 != 37 ) | |
5268 goto LABEL_361; | |
5269 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5270 } | |
5271 goto LABEL_138; | |
5272 } | |
5273 if ( v34 == 28 ) | |
5274 { | |
5275 LABEL_136: | |
5276 if ( v3 == 42 ) | |
5277 { | |
5278 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5279 LABEL_138: | |
5280 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5281 goto LABEL_361; | |
5282 } | |
5283 } | |
5284 else | |
5285 { | |
5286 v47 = v34 - 1; | |
5287 if ( v47 ) | |
5288 { | |
5289 v48 = v47 - 1; | |
5290 if ( v48 ) | |
5291 { | |
5292 v34 = v48 - 24; | |
5293 if ( v34 ) | |
5294 { | |
5295 --v34; | |
5296 if ( v34 || v3 != 40 ) | |
5297 goto LABEL_361; | |
5298 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5299 } | |
5300 else | |
5301 { | |
5302 if ( v3 != 35 ) | |
5303 goto LABEL_361; | |
5304 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5305 } | |
5306 goto LABEL_138; | |
5307 } | |
5308 LABEL_118: | |
5309 if ( (signed int)v3 < 0 ) | |
5310 goto LABEL_361; | |
5311 v39 = __OFSUB__((int)v3, 6); | |
5312 v37 = v3 == 6; | |
5313 v38 = v3 - 6 < 0; | |
5314 } | |
5315 else | |
5316 { | |
5317 LABEL_253: | |
5318 if ( (signed int)v3 < 10 ) | |
5319 goto LABEL_361; | |
5320 v39 = __OFSUB__((int)v3, 15); | |
5321 v37 = v3 == 15; | |
5322 v38 = v3 - 15 < 0; | |
5323 } | |
5324 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5325 goto LABEL_121; | |
5326 } | |
5327 } | |
5328 LABEL_361: | |
5329 ++v65; | |
5330 if ( (signed int)v65 >= 16 ) | |
5331 return v5 + v62 + v61; | |
5332 } | |
5333 } | |
5334 if ( attr == 28 ) | |
5335 { | |
5336 if ( IsUnarmed() != 1 ) | |
5337 { | |
816 | 5338 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5339 { | |
5340 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5341 if ( v22 >= 0 ) |
5342 { | |
5343 if ( v22 <= 2 ) | |
5344 { | |
118 | 5345 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5346 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5347 { |
5348 v24 = v23; | |
5349 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5350 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5351 } | |
5352 else | |
5353 { | |
5354 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5355 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5356 } | |
5357 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5358 } | |
5359 } | |
5360 } | |
865 | 5361 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5362 return v5 + v62 + v61; |
5363 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5364 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5365 goto LABEL_88; | |
5366 } | |
5367 v59 = 3; | |
5368 LABEL_74: | |
5369 v5 = v59; | |
5370 return v5 + v62 + v61; | |
5371 } | |
5372 if ( (signed int)attr < 0 ) | |
5373 return v5 + v62 + v61; | |
5374 if ( (signed int)attr <= 23 ) | |
5375 goto LABEL_95; | |
5376 if ( (signed int)attr <= 24 ) | |
5377 return v5 + v62 + v61; | |
5378 if ( (signed int)attr <= 26 ) | |
5379 { | |
5380 if ( IsUnarmed() == 1 ) | |
5381 { | |
5382 v5 = 0; | |
5383 return v5 + v62 + v61; | |
5384 } | |
816 | 5385 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5386 { | |
5387 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5388 if ( v17 >= 0 ) |
5389 { | |
5390 if ( v17 <= 2 ) | |
232 | 5391 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5392 } |
5393 } | |
865 | 5394 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5395 return v5 + v62 + v61; |
898 | 5396 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5397 goto LABEL_365; |
5398 } | |
5399 if ( attr == 27 ) | |
5400 { | |
5401 if ( IsUnarmed() == 1 ) | |
5402 { | |
5403 v5 = 1; | |
5404 return v5 + v62 + v61; | |
5405 } | |
816 | 5406 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5407 { | |
5408 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5409 if ( v9 >= 0 ) |
5410 { | |
5411 if ( v9 <= 2 ) | |
5412 { | |
1021 | 5413 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5414 pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5415 if ( !v6->pEquipment.uShield ) |
0 | 5416 { |
118 | 5417 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5418 ++v5; |
5419 } | |
5420 } | |
5421 } | |
5422 } | |
865 | 5423 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5424 return v5 + v62 + v61; |
898 | 5425 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5426 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5427 LABEL_88: |
5428 v5 += v15 + v14; | |
5429 } | |
5430 return v5 + v62 + v61; | |
5431 } | |
5432 | |
5433 //----- (0048F73C) -------------------------------------------------------- | |
5434 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5435 { | |
5436 int result; // eax@1 | |
5437 int v3; // eax@4 | |
5438 int v4; // ecx@5 | |
5439 | |
5440 switch (a2) | |
5441 { | |
5442 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5443 } | |
5444 | |
5445 result = 0; | |
5446 if ( (signed int)a2 > 10 ) | |
5447 { | |
5448 if ( (signed int)a2 <= 15 ) | |
5449 { | |
5450 switch ( a2 ) | |
5451 { | |
5452 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5453 v3 = this->pPlayerBuffs[2].uPower; | |
5454 v4 = pParty->pPartyBuffs[1].uPower; | |
5455 break; | |
5456 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5457 v3 = this->pPlayerBuffs[0].uPower; | |
5458 v4 = pParty->pPartyBuffs[0].uPower; | |
5459 break; | |
5460 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5461 v3 = this->pPlayerBuffs[22].uPower; | |
5462 v4 = pParty->pPartyBuffs[17].uPower; | |
5463 break; | |
5464 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5465 v3 = this->pPlayerBuffs[3].uPower; | |
5466 v4 = pParty->pPartyBuffs[4].uPower; | |
5467 break; | |
5468 default: | |
5469 if ( a2 != 14 ) | |
5470 return result; | |
5471 v3 = this->pPlayerBuffs[9].uPower; | |
5472 v4 = pParty->pPartyBuffs[12].uPower; | |
5473 break; | |
5474 } | |
5475 return v4 + v3; | |
5476 } | |
5477 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5478 { | |
5479 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5480 { | |
5481 v3 = this->pPlayerBuffs[8].uPower; | |
5482 v4 = pParty->pPartyBuffs[9].uPower; | |
5483 return v4 + v3; | |
5484 } | |
5485 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5486 return result; | |
5487 } | |
5488 return this->pPlayerBuffs[1].uPower; | |
5489 } | |
5490 if ( a2 == 10 ) | |
5491 { | |
5492 v3 = this->pPlayerBuffs[5].uPower; | |
5493 v4 = pParty->pPartyBuffs[6].uPower; | |
5494 return v4 + v3; | |
5495 } | |
5496 switch ( a2 ) | |
5497 { | |
5498 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5499 v3 = pPlayerBuffs[19].uPower; | |
5500 goto LABEL_5; | |
5501 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5502 v3 = pPlayerBuffs[17].uPower; | |
5503 goto LABEL_5; | |
5504 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5505 v3 = pPlayerBuffs[20].uPower; | |
5506 goto LABEL_5; | |
5507 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5508 v3 = pPlayerBuffs[16].uPower; | |
5509 goto LABEL_5; | |
5510 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5511 v3 = pPlayerBuffs[15].uPower; | |
5512 goto LABEL_5; | |
5513 case CHARACTER_ATTRIBUTE_SPEED: | |
5514 v3 = pPlayerBuffs[21].uPower; | |
5515 goto LABEL_5; | |
5516 case CHARACTER_ATTRIBUTE_LUCK: | |
5517 v3 = pPlayerBuffs[18].uPower; | |
5518 LABEL_5: | |
5519 v4 = pParty->pPartyBuffs[2].uPower; | |
5520 return v4 + v3; | |
5521 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5522 v3 = this->pPlayerBuffs[14].uPower; | |
5523 v4 = pParty->pPartyBuffs[15].uPower; | |
5524 return v4 + v3; | |
5525 default: | |
5526 return result; | |
5527 } | |
5528 return result; | |
5529 } | |
5530 | |
5531 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5532 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5533 { | |
0 | 5534 signed int v2; // esi@1 |
5535 unsigned __int16 v3; // ax@126 | |
5536 char result; // al@127 | |
5537 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5538 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5539 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5540 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5541 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5542 | |
0 | 5543 v2 = 0; |
353 | 5544 switch (uSkillType) |
5545 { | |
5546 case PLAYER_SKILL_MONSTER_ID: | |
5547 { | |
652 | 5548 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5549 v2 = 6; |
652 | 5550 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5551 v2 += 6; |
5552 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5553 v2 += GetItemsBonus(v8, 0); | |
5554 } | |
5555 break; | |
5556 | |
5557 case PLAYER_SKILL_ARMSMASTER: | |
5558 { | |
652 | 5559 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5560 v2 = 2; |
652 | 5561 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5562 v2 += 3; |
353 | 5563 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5564 v2 += GetItemsBonus(v8, 0); | |
5565 } | |
5566 break; | |
5567 | |
5568 case PLAYER_SKILL_STEALING: | |
5569 { | |
652 | 5570 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5571 v2 = 8; |
5572 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5573 v2 += GetItemsBonus(v8, 0); | |
5574 } | |
5575 break; | |
5576 | |
5577 | |
5578 case PLAYER_SKILL_ALCHEMY: | |
5579 { | |
652 | 5580 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5581 v2 = 4; |
652 | 5582 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5583 v2 += 8; |
5584 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5585 v2 += GetItemsBonus(v8, 0); | |
5586 } | |
5587 break; | |
5588 | |
5589 case PLAYER_SKILL_LEARNING: | |
5590 { | |
652 | 5591 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5592 v2 = 10; |
652 | 5593 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5594 v2 += 15; |
652 | 5595 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5596 v2 += 5; |
5597 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5598 v2 += GetItemsBonus(v8, 0); | |
5599 } | |
5600 break; | |
5601 | |
5602 case PLAYER_SKILL_UNARMED: | |
5603 { | |
652 | 5604 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5605 v2 = 2; |
5606 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5607 v2 += GetItemsBonus(v8, 0); | |
5608 } | |
5609 break; | |
5610 | |
5611 case PLAYER_SKILL_DODGE: | |
5612 { | |
652 | 5613 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5614 v2 = 2; |
5615 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5616 v2 += GetItemsBonus(v8, 0); | |
5617 } | |
5618 break; | |
5619 | |
5620 case PLAYER_SKILL_BOW: | |
5621 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5622 v2 += GetItemsBonus(v8, 0); | |
5623 break; | |
5624 case PLAYER_SKILL_SHIELD: | |
5625 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5626 v2 += GetItemsBonus(v8, 0); | |
5627 break; | |
5628 | |
5629 case PLAYER_SKILL_EARTH: | |
652 | 5630 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5631 v2 = 2; |
652 | 5632 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5633 v2 += 3; |
652 | 5634 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5635 v2 += 4; |
5636 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5637 v2 += 3; | |
5638 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5639 v2 += GetItemsBonus(v8, 0); | |
5640 break; | |
5641 case PLAYER_SKILL_FIRE: | |
652 | 5642 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5643 v2 = 2; |
652 | 5644 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5645 v2 += 3; |
652 | 5646 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5647 v2 += 4; |
5648 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5649 v2 += 3; | |
5650 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5651 v2 += GetItemsBonus(v8, 0); | |
5652 break; | |
5653 case PLAYER_SKILL_AIR: | |
652 | 5654 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5655 v2 = 2; |
652 | 5656 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5657 v2 += 3; |
652 | 5658 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5659 v2 += 4; |
5660 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5661 v2 += 3; | |
5662 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5663 v2 += GetItemsBonus(v8, 0); | |
5664 break; | |
5665 case PLAYER_SKILL_WATER: | |
652 | 5666 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5667 v2 = 2; |
652 | 5668 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5669 v2 += 3; |
652 | 5670 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5671 v2 += 4; |
5672 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5673 v2 += 3; | |
5674 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5675 v2 += GetItemsBonus(v8, 0); | |
5676 break; | |
5677 case PLAYER_SKILL_SPIRIT: | |
652 | 5678 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5679 v2 = 2; |
652 | 5680 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5681 v2 += 3; |
652 | 5682 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5683 v2 += 4; |
5684 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5685 v2 += GetItemsBonus(v8, 0); | |
5686 break; | |
5687 case PLAYER_SKILL_MIND: | |
652 | 5688 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5689 v2 = 2; |
652 | 5690 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5691 v2 += 3; |
652 | 5692 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5693 v2 += 4; |
5694 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5695 v2 += GetItemsBonus(v8, 0); | |
5696 break; | |
5697 case PLAYER_SKILL_BODY: | |
652 | 5698 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5699 v2 = 2; |
652 | 5700 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5701 v2 += 3; |
652 | 5702 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5703 v2 += 4; |
5704 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5705 v2 += GetItemsBonus(v8, 0); | |
5706 break; | |
5707 case PLAYER_SKILL_LIGHT: | |
5708 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5709 v2 += GetItemsBonus(v8, 0); | |
5710 break; | |
5711 case PLAYER_SKILL_DARK: | |
5712 { | |
5713 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5714 v2 += GetItemsBonus(v8, 0); | |
5715 } | |
5716 break; | |
5717 | |
5718 case PLAYER_SKILL_MERCHANT: | |
5719 { | |
652 | 5720 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5721 v2 = 4; |
652 | 5722 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5723 v2 += 6; |
652 | 5724 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5725 v2 += 3; |
652 | 5726 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5727 v2 += 8; |
5728 } | |
5729 break; | |
5730 | |
5731 case PLAYER_SKILL_PERCEPTION: | |
5732 { | |
652 | 5733 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5734 v2 = 6; |
652 | 5735 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5736 v2 += 5; |
5737 } | |
5738 break; | |
5739 | |
0 | 5740 case PLAYER_SKILL_ITEM_ID: |
5741 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5742 v2 += GetItemsBonus(v8, 0); |
0 | 5743 break; |
5744 case PLAYER_SKILL_MEDITATION: | |
5745 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5746 v2 += GetItemsBonus(v8, 0); |
5747 break; | |
0 | 5748 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5749 { |
652 | 5750 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5751 v2 = 4; |
652 | 5752 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5753 v2 += 6; |
652 | 5754 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5755 v2 += 8; |
0 | 5756 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5757 v2 += GetItemsBonus(v8, 0); |
5758 } | |
5759 break; | |
5760 } | |
5761 | |
5762 v3 = pActiveSkills[uSkillType]; | |
1008 | 5763 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5764 result = v2 + v3; |
5765 else | |
1008 | 5766 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5767 return result; |
5768 } | |
5769 | |
5770 //----- (0048FC00) -------------------------------------------------------- | |
5771 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5772 { | |
5773 Player *v2; // esi@1 | |
5774 int v3; // eax@1 | |
5775 char v4; // di@1 | |
5776 signed int v5; // ebx@1 | |
5777 unsigned int v6; // eax@2 | |
5778 unsigned __int8 v7; // sf@5 | |
5779 unsigned __int8 v8; // of@5 | |
5780 PlayerEquipment *v9; // ebx@19 | |
5781 Player *v10; // ecx@20 | |
821 | 5782 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5783 int v12; // eax@21 |
5784 int v13; // edi@21 | |
5785 char v14; // di@25 | |
5786 signed int v15; // esi@25 | |
5787 char v16; // al@32 | |
5788 int v18; // eax@36 | |
5789 unsigned int v19; // eax@37 | |
5790 ITEM_EQUIP_TYPE v20; // edi@40 | |
5791 int v21; // edx@41 | |
5792 int v22; // eax@42 | |
821 | 5793 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5794 unsigned __int16 v24; // ax@45 |
5795 unsigned __int16 v25; // bx@45 | |
5796 unsigned int v26; // eax@45 | |
5797 unsigned __int8 v27; // sf@50 | |
5798 unsigned __int8 v28; // of@50 | |
5799 unsigned int v29; // eax@52 | |
5800 int v30; // eax@55 | |
5801 int v31; // eax@58 | |
5802 unsigned int v32; // eax@59 | |
5803 int v33; // eax@65 | |
5804 char v34; // si@65 | |
5805 ITEM_EQUIP_TYPE v35; // edi@69 | |
5806 int v36; // edx@70 | |
5807 int v37; // eax@71 | |
821 | 5808 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5809 int v39; // eax@74 |
5810 int v40; // eax@89 | |
5811 char v41; // si@89 | |
5812 int v42; // eax@96 | |
821 | 5813 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5814 int v44; // eax@97 |
5815 int v45; // eax@98 | |
5816 int v46; // eax@99 | |
5817 int v47; // eax@100 | |
5818 int v48; // eax@101 | |
5819 int v49; // eax@102 | |
5820 unsigned __int16 v50; // ax@113 | |
5821 char v51; // di@113 | |
5822 unsigned int v52; // eax@113 | |
5823 int v53; // edi@113 | |
5824 signed int i; // ecx@113 | |
5825 unsigned __int16 v55; // ax@118 | |
5826 char v56; // si@118 | |
5827 unsigned int v57; // eax@118 | |
5828 int v58; // esi@121 | |
5829 signed int j; // ecx@121 | |
5830 int v60; // edi@126 | |
5831 int v61; // eax@126 | |
5832 signed int v62; // [sp-4h] [bp-30h]@26 | |
5833 signed int v63; // [sp-4h] [bp-30h]@80 | |
5834 int v64; // [sp+Ch] [bp-20h]@104 | |
5835 int v65; // [sp+10h] [bp-1Ch]@104 | |
5836 int v66; // [sp+14h] [bp-18h]@104 | |
5837 int v67; // [sp+18h] [bp-14h]@104 | |
5838 int v68; // [sp+1Ch] [bp-10h]@69 | |
5839 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5840 int v70; // [sp+24h] [bp-8h]@1 | |
5841 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5842 int a1; // [sp+34h] [bp+8h]@21 | |
5843 int a1a; // [sp+34h] [bp+8h]@74 | |
5844 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5845 | |
5846 v2 = this; | |
5847 v70 = 0; | |
5848 v69 = 0; | |
5849 v71 = (ITEM_EQUIP_TYPE)0; | |
5850 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5851 v4 = v3; | |
5852 v5 = 1; | |
5853 if ( v3 ) | |
5854 { | |
5855 v6 = SkillToMastery(v3); | |
5856 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5857 { | |
5858 if ( (signed int)v6 >= 4 ) | |
5859 goto LABEL_4; | |
5860 v8 = __OFSUB__(v6, 3); | |
5861 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5862 } | |
5863 else | |
5864 { | |
5865 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5866 goto LABEL_11; | |
5867 if ( (signed int)v6 >= 4 ) | |
5868 { | |
5869 LABEL_4: | |
5870 v71 = (ITEM_EQUIP_TYPE)2; | |
5871 LABEL_11: | |
5872 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5873 goto LABEL_12; | |
5874 } | |
5875 v8 = __OFSUB__(v6, 2); | |
5876 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5877 } | |
5878 if ( !(v7 ^ v8) ) | |
5879 v71 = (ITEM_EQUIP_TYPE)1; | |
5880 goto LABEL_11; | |
5881 } | |
5882 LABEL_12: | |
5883 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5884 { | |
135 | 5885 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5886 v61 = v2->GetBodybuilding(); |
5887 return v60 * v61; | |
5888 } | |
5889 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5890 { | |
135 | 5891 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5892 v61 = v2->GetMeditation(); |
0 | 5893 return v60 * v61; |
5894 } | |
5895 if ( a2 != 9 ) | |
5896 { | |
5897 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5898 { | |
5899 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5900 return v70; | |
5901 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5902 { | |
5903 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5904 return v70; | |
5905 v71 = (ITEM_EQUIP_TYPE)0; | |
5906 v9 = &v2->pEquipment; | |
5907 while ( 1 ) | |
5908 { | |
5909 if ( v2->HasItemEquipped(v71) ) | |
5910 { | |
118 | 5911 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5912 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5913 a1 = v12; |
5914 SkillToMastery(v12); | |
5915 v13 = v11 - 5; | |
5916 if ( !v13 ) | |
5917 return a1 & 0x3F; | |
5918 if ( v13 == 2 ) | |
5919 break; | |
5920 } | |
5921 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5922 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5923 if ( (signed int)v71 >= 16 ) | |
5924 return v70; | |
5925 } | |
5926 v14 = a1; | |
5927 v15 = 1; | |
5928 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5929 { | |
5930 v62 = 5; | |
5931 goto LABEL_31; | |
5932 } | |
5933 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5934 { | |
5935 v62 = 3; | |
5936 goto LABEL_31; | |
5937 } | |
5938 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5939 goto LABEL_32; | |
5940 goto LABEL_30; | |
5941 } | |
5942 if ( v2->IsUnarmed() ) | |
5943 { | |
5944 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5945 v14 = v18; | |
5946 if ( !v18 ) | |
5947 return v70; | |
5948 v15 = 0; | |
5949 v19 = SkillToMastery(v18); | |
5950 if ( (signed int)v19 < 3 ) | |
5951 { | |
5952 if ( (signed int)v19 >= 2 ) | |
5953 v15 = 1; | |
5954 LABEL_32: | |
5955 v16 = v14; | |
5956 return v15 * (v16 & 0x3F); | |
5957 } | |
5958 LABEL_30: | |
5959 v62 = 2; | |
5960 LABEL_31: | |
5961 v15 = v62; | |
5962 goto LABEL_32; | |
5963 } | |
5964 v20 = (ITEM_EQUIP_TYPE)0; | |
5965 while ( 1 ) | |
5966 { | |
5967 if ( v2->HasItemEquipped(v20) ) | |
5968 { | |
118 | 5969 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5970 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5971 break; | |
5972 } | |
5973 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5974 if ( (signed int)v20 >= 16 ) | |
5975 return v70; | |
5976 } | |
5977 v71 = (ITEM_EQUIP_TYPE)0; | |
5978 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5979 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5980 v25 = v24; | |
5981 v26 = SkillToMastery(v24); | |
5982 if ( !v23 ) | |
5983 { | |
5984 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5985 { | |
5986 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5987 LOBYTE(v25) = v31; | |
5988 if ( v31 ) | |
5989 { | |
5990 v15 = 0; | |
5991 v32 = SkillToMastery(v31); | |
5992 if ( (signed int)v32 < 3 ) | |
5993 { | |
5994 if ( (signed int)v32 >= 2 ) | |
5995 v15 = 1; | |
5996 } | |
5997 else | |
5998 { | |
5999 v15 = 2; | |
6000 } | |
6001 v16 = v25; | |
6002 return v15 * (v16 & 0x3F); | |
6003 } | |
6004 } | |
6005 goto LABEL_55; | |
6006 } | |
6007 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6008 { | |
6009 v29 = SkillToMastery(v25); | |
6010 v28 = __OFSUB__(v29, 4); | |
6011 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6012 } | |
6013 else | |
6014 { | |
6015 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6016 goto LABEL_55; | |
6017 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6018 { | |
6019 if ( v23 == PLAYER_SKILL_MACE ) | |
6020 { | |
6021 v28 = __OFSUB__(v26, 2); | |
118 | 6022 v27 = v26 - 2 < 0; |
0 | 6023 goto LABEL_53; |
6024 } | |
6025 LABEL_55: | |
6026 v30 = v71 * (v25 & 0x3F); | |
6027 return (int)((char *)v69 + v30); | |
6028 } | |
6029 v28 = __OFSUB__(v26, 3); | |
118 | 6030 v27 = v26 - 3 < 0; |
0 | 6031 } |
6032 LABEL_53: | |
6033 if ( !(v27 ^ v28) ) | |
6034 v71 = (ITEM_EQUIP_TYPE)1; | |
6035 goto LABEL_55; | |
6036 } | |
6037 if ( v2->IsUnarmed() == 1 ) | |
6038 { | |
6039 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6040 v34 = v33; | |
6041 if ( !v33 ) | |
6042 return v70; | |
6043 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6044 v5 = 2; | |
6045 v30 = v5 * (v34 & 0x3F); | |
6046 return (int)((char *)v69 + v30); | |
6047 } | |
6048 v35 = (ITEM_EQUIP_TYPE)0; | |
6049 v68 = 0; | |
6050 while ( 1 ) | |
6051 { | |
6052 if ( v2->HasItemEquipped(v35) ) | |
6053 { | |
118 | 6054 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6055 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6056 break; | |
6057 } | |
6058 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6059 if ( (signed int)v35 >= 16 ) | |
6060 return v70; | |
6061 } | |
6062 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6063 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6064 a1a = v39; | |
6065 SkillToMastery(v39); | |
6066 v71 = (ITEM_EQUIP_TYPE)0; | |
6067 if ( v38 ) | |
6068 { | |
6069 if ( (signed int)v38 > 0 ) | |
6070 { | |
6071 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6072 { | |
6073 v71 = (ITEM_EQUIP_TYPE)1; | |
6074 } | |
6075 else | |
6076 { | |
6077 if ( v38 == 7 ) | |
6078 { | |
6079 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6080 { | |
6081 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6082 { | |
6083 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6084 return v5 * (a1a & 0x3F); | |
6085 v63 = 2; | |
6086 } | |
6087 else | |
6088 { | |
6089 v63 = 3; | |
6090 } | |
6091 } | |
6092 else | |
6093 { | |
6094 v63 = 5; | |
6095 } | |
6096 v5 = v63; | |
6097 return v5 * (a1a & 0x3F); | |
6098 } | |
6099 } | |
6100 } | |
6101 } | |
6102 else | |
6103 { | |
6104 v71 = (ITEM_EQUIP_TYPE)1; | |
6105 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6106 { | |
6107 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6108 v41 = v40; | |
6109 if ( v40 ) | |
6110 { | |
6111 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6112 v5 = 2; | |
6113 v68 = v5 * (v41 & 0x3F); | |
6114 } | |
6115 } | |
6116 } | |
6117 v30 = v68 + v71 * (a1a & 0x3F); | |
6118 return (int)((char *)v69 + v30); | |
6119 } | |
6120 a1b = 0; | |
6121 v71 = (ITEM_EQUIP_TYPE)0; | |
6122 v68 = 16; | |
6123 v69 = &v2->pEquipment; | |
6124 do | |
6125 { | |
898 | 6126 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6127 goto LABEL_117; |
6128 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6129 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6130 if ( !v44 ) | |
6131 { | |
6132 v64 = 0; | |
6133 v65 = 1; | |
6134 LABEL_111: | |
6135 v66 = 0; | |
6136 goto LABEL_112; | |
6137 } | |
6138 v45 = v44 - 1; | |
6139 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6140 { | |
6141 v64 = 0; | |
6142 v65 = 0; | |
6143 v66 = 0; | |
6144 v67 = 1; | |
6145 goto LABEL_113; | |
6146 } | |
6147 v47 = v46 - 4; | |
6148 if ( v47 ) | |
6149 { | |
6150 v48 = v47 - 1; | |
6151 if ( v48 ) | |
6152 { | |
6153 v49 = v48 - 1; | |
6154 if ( v49 ) | |
6155 { | |
6156 if ( v49 != 1 ) | |
6157 goto LABEL_117; | |
6158 a1b = 1; | |
6159 v64 = 1; | |
6160 v65 = 0; | |
6161 v66 = 0; | |
6162 v67 = 0; | |
6163 goto LABEL_113; | |
6164 } | |
6165 a1b = 1; | |
6166 v64 = 1; | |
6167 v65 = 0; | |
6168 goto LABEL_111; | |
6169 } | |
6170 v71 = (ITEM_EQUIP_TYPE)1; | |
6171 } | |
6172 else | |
6173 { | |
6174 a1b = 1; | |
6175 } | |
6176 v64 = 1; | |
6177 v65 = 0; | |
6178 v66 = 1; | |
6179 LABEL_112: | |
6180 v67 = 0; | |
6181 LABEL_113: | |
6182 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6183 v51 = v50; | |
6184 v52 = SkillToMastery(v50); | |
6185 v53 = v51 & 0x3F; | |
6186 for ( i = 0; i < (signed int)v52; ++i ) | |
6187 { | |
6188 if ( *(&v64 + i) ) | |
6189 v70 += v53; | |
6190 } | |
6191 LABEL_117: | |
6192 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6193 --v68; | |
6194 } | |
6195 while ( v68 ); | |
6196 v64 = 1; | |
6197 v65 = 1; | |
6198 v66 = 1; | |
6199 v67 = 0; | |
6200 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6201 v56 = v55; | |
6202 v57 = SkillToMastery(v55); | |
6203 if ( !a1b && (!v71 || v57 == 4) ) | |
6204 { | |
6205 v58 = v56 & 0x3F; | |
6206 for ( j = 0; j < (signed int)v57; ++j ) | |
6207 { | |
6208 if ( *(&v64 + j) ) | |
6209 v70 += v58; | |
6210 } | |
6211 } | |
6212 return v70; | |
6213 } | |
6214 | |
6215 //----- (00490109) -------------------------------------------------------- | |
6216 // faces are: 0 1 2 3 human males | |
6217 // 4 5 6 7 human females | |
6218 // 8 9 elf males | |
6219 // 10 11 elf females | |
6220 // 12 13 dwarf males | |
6221 // 14 15 dwarf females | |
6222 // 16 17 goblin males | |
6223 // 18 19 goblin females | |
6224 // 20 lich male | |
6225 // 21 lich female | |
6226 // 22 underwater suits (unused) | |
6227 // 23 zombie male | |
6228 // 24 zombie female | |
6229 enum CHARACTER_RACE Player::GetRace() | |
6230 { | |
1014 | 6231 if ( uCurrentFace > 15 ) |
6232 { | |
6233 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6234 return CHARACTER_RACE_GOBLIN; |
6235 } | |
6236 else | |
6237 { | |
1014 | 6238 if ( uCurrentFace >= 12 ) |
0 | 6239 { |
6240 return CHARACTER_RACE_DWARF; | |
6241 } | |
6242 else | |
6243 { | |
1014 | 6244 |
6245 if ( uCurrentFace <= 7 ) | |
0 | 6246 { |
6247 return CHARACTER_RACE_HUMAN; | |
6248 } | |
6249 else | |
6250 { | |
1014 | 6251 if ( uCurrentFace <= 11 ) |
0 | 6252 return CHARACTER_RACE_ELF; |
6253 } | |
6254 } | |
6255 } | |
6256 return CHARACTER_RACE_HUMAN; | |
6257 } | |
6258 | |
6259 //----- (00490141) -------------------------------------------------------- | |
187 | 6260 PLAYER_SEX Player::GetSexByVoice() |
0 | 6261 { |
6262 signed int result; // eax@1 | |
6263 | |
6264 result = 0; | |
6265 switch ( this->uVoiceID ) | |
6266 { | |
6267 case 0u: | |
6268 case 1u: | |
6269 case 2u: | |
6270 case 3u: | |
6271 case 8u: | |
6272 case 9u: | |
6273 case 0xCu: | |
6274 case 0xDu: | |
6275 case 0x10u: | |
6276 case 0x11u: | |
6277 case 0x14u: | |
6278 case 0x17u: | |
187 | 6279 return SEX_MALE; |
6280 | |
0 | 6281 case 4u: |
6282 case 5u: | |
6283 case 6u: | |
6284 case 7u: | |
6285 case 0xAu: | |
6286 case 0xBu: | |
6287 case 0xEu: | |
6288 case 0xFu: | |
6289 case 0x12u: | |
6290 case 0x13u: | |
6291 case 0x15u: | |
6292 case 0x18u: | |
187 | 6293 return SEX_FEMALE; |
6294 | |
0 | 6295 default: |
187 | 6296 assert(false); |
6297 } | |
0 | 6298 } |
6299 | |
6300 //----- (00490188) -------------------------------------------------------- | |
6301 void Player::SetInitialStats() | |
6302 { | |
6303 auto v1 = GetRace(); | |
290 | 6304 uMight = StatTable[v1][0].uBaseValue; |
6305 uIntelligence = StatTable[v1][1].uBaseValue; | |
6306 uWillpower = StatTable[v1][2].uBaseValue; | |
6307 uEndurance = StatTable[v1][3].uBaseValue; | |
6308 uAccuracy = StatTable[v1][4].uBaseValue; | |
6309 uSpeed = StatTable[v1][5].uBaseValue; | |
6310 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6311 } |
6312 | |
6313 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6314 void Player::SetSexByVoice() |
6315 { | |
6316 switch ( this->uVoiceID) | |
0 | 6317 { |
6318 case 0: | |
6319 case 1: | |
6320 case 2: | |
6321 case 3: | |
6322 case 8: | |
6323 case 9: | |
6324 case 0xC: | |
6325 case 0xD: | |
6326 case 0x10: | |
6327 case 0x11: | |
6328 case 0x14: | |
6329 case 0x17: | |
1021 | 6330 this->uSex = SEX_MALE; |
0 | 6331 break; |
6332 case 4: | |
6333 case 5: | |
6334 case 6: | |
6335 case 7: | |
6336 case 0xA: | |
6337 case 0xB: | |
6338 case 0xE: | |
6339 case 0xF: | |
6340 case 0x12: | |
6341 case 0x13: | |
6342 case 0x15: | |
6343 case 0x18: | |
1021 | 6344 this->uSex = SEX_FEMALE; |
0 | 6345 break; |
6346 default: | |
6347 break; | |
6348 } | |
1021 | 6349 |
0 | 6350 } |
6351 | |
6352 //----- (0049024A) -------------------------------------------------------- | |
135 | 6353 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6354 { |
6355 sLevelModifier = 0; | |
6356 sAgeModifier = 0; | |
6357 | |
135 | 6358 classType = cls; |
0 | 6359 uLuckBonus = 0; |
6360 uSpeedBonus = 0; | |
6361 uAccuracyBonus = 0; | |
6362 uEnduranceBonus = 0; | |
6363 uWillpowerBonus = 0; | |
6364 uIntelligenceBonus = 0; | |
6365 uMightBonus = 0; | |
6366 uLevel = 1; | |
6367 uExperience = 251 + rand() % 100; | |
6368 uBirthYear = 1147 - rand() % 6; | |
6369 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6370 memset(_guilds_member_bits, 0, 64); |
0 | 6371 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6372 | |
6373 for (uint i = 0; i < 37; ++i) | |
6374 { | |
135 | 6375 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6376 continue; |
6377 | |
6378 pActiveSkills[i] = 1; | |
6379 | |
6380 switch (i) | |
6381 { | |
886 | 6382 case PLAYER_SKILL_FIRE: |
6383 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6384 |
6385 extern bool all_magic; | |
6386 if ( all_magic == true ) | |
6387 { | |
6388 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6389 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6390 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6391 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6392 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6393 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6394 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6395 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6396 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6397 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6398 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6399 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6400 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6401 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6402 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6403 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6404 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6405 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6406 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6407 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6408 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6409 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6410 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6411 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6412 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6413 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6414 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6415 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6416 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6417 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6418 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6419 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6420 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6421 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6422 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6423 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6424 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6425 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6426 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6427 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6428 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6429 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6430 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6431 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6432 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6433 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6434 } | |
486 | 6435 break; |
886 | 6436 case PLAYER_SKILL_AIR: |
6437 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6438 break; | |
6439 case PLAYER_SKILL_WATER: | |
6440 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6441 break; | |
6442 case PLAYER_SKILL_EARTH: | |
6443 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6444 break; | |
6445 case PLAYER_SKILL_SPIRIT: | |
6446 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6447 break; | |
6448 case PLAYER_SKILL_MIND: | |
6449 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6450 break; | |
6451 case PLAYER_SKILL_BODY: | |
6452 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6453 |
6454 if ( all_magic == true ) | |
6455 { | |
6456 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6457 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6458 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6459 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6460 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6461 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6462 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6463 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6464 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6465 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6466 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6467 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6468 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6469 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6470 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6471 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6472 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6473 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6474 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6475 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6476 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6477 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6478 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6479 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6480 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6481 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6482 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6483 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6484 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6485 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6486 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6487 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6488 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6489 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6490 } | |
569 | 6491 break; |
886 | 6492 case PLAYER_SKILL_LIGHT: |
6493 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6494 break; | |
6495 case PLAYER_SKILL_DARK: | |
6496 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6497 break; | |
0 | 6498 } |
6499 } | |
6500 | |
6501 sHealth = GetMaxHealth(); | |
6502 sMana = GetMaxMana(); | |
6503 } | |
6504 | |
6505 //----- (004903C9) -------------------------------------------------------- | |
821 | 6506 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6507 { | |
6508 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6509 int v3; // edx@5 |
6510 char *v4; // ecx@5 | |
6511 int v5; // esi@11 | |
6512 unsigned __int16 *v6; // edx@11 | |
6513 int v7; // esi@18 | |
6514 unsigned __int16 *pActiveSkill; // edx@18 | |
6515 | |
6516 if ( order >= 0 ) | |
6517 { | |
6518 if ( order <= 1 ) | |
6519 { | |
6520 result = (PLAYER_SKILL_TYPE)0; | |
6521 v7 = 0; | |
6522 pActiveSkill = this->pActiveSkills; | |
6523 do | |
6524 { | |
135 | 6525 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6526 { |
6527 if ( v7 == order ) | |
6528 return result; | |
6529 ++v7; | |
6530 } | |
6531 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6532 ++pActiveSkill; | |
6533 } | |
6534 while ( (signed int)result < 37 ); | |
6535 } | |
6536 else | |
6537 { | |
6538 if ( order <= 3 ) | |
6539 { | |
6540 result = (PLAYER_SKILL_TYPE)0; | |
6541 v5 = 0; | |
6542 pActiveSkill = this->pActiveSkills; | |
6543 do | |
6544 { | |
135 | 6545 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6546 { |
6547 if ( v5 == order - 2 ) | |
6548 return result; | |
6549 ++v5; | |
6550 } | |
6551 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6552 ++pActiveSkill; | |
6553 } | |
6554 while ( (signed int)result < 37 ); | |
6555 } | |
6556 else | |
6557 { | |
6558 if ( order <= 12 ) | |
6559 { | |
6560 result = (PLAYER_SKILL_TYPE)0; | |
6561 v3 = 0; | |
135 | 6562 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6563 do |
6564 { | |
6565 if ( *v4 == 1 ) | |
6566 { | |
6567 if ( v3 == order - 4 ) | |
6568 return result; | |
6569 ++v3; | |
6570 } | |
6571 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6572 ++v4; | |
6573 } | |
6574 while ( (signed int)result < 37 ); | |
6575 } | |
6576 } | |
6577 } | |
6578 } | |
6579 return (PLAYER_SKILL_TYPE)37; | |
6580 } | |
6581 | |
6582 | |
6583 | |
6584 //----- (0049048D) -------------------------------------------------------- | |
6585 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6586 void Player::DecreaseAttribute(int eAttribute) | |
6587 { | |
6588 int v2; // eax@1 | |
6589 int pBaseValue; // ecx@1 | |
6590 int pDroppedStep; // ebx@1 | |
6591 int pStep; // esi@1 | |
6592 unsigned __int16 result; // ax@7 | |
6593 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6594 | |
6595 v2 = eAttribute + 7 * GetRace(); | |
290 | 6596 pBaseValue = StatTable[0][v2].uBaseValue; |
6597 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6598 uMinValue = pBaseValue - 2; |
290 | 6599 pStep = StatTable[0][v2].uBaseStep; |
0 | 6600 switch ( eAttribute ) |
6601 { | |
6602 case CHARACTER_MIGHT: | |
6603 if ( this->uMight <= pBaseValue ) | |
6604 pStep = pDroppedStep; | |
6605 if ( this->uMight - pStep >= uMinValue ) | |
6606 this->uMight -= pStep; | |
6607 break; | |
6608 case CHARACTER_INTELLIGANCE: | |
6609 if ( this->uIntelligence <= pBaseValue ) | |
6610 pStep = pDroppedStep; | |
6611 if ( this->uIntelligence - pStep >= uMinValue ) | |
6612 this->uIntelligence -= pStep; | |
6613 break; | |
6614 case CHARACTER_WILLPOWER: | |
6615 if ( this->uWillpower <= pBaseValue ) | |
6616 pStep = pDroppedStep; | |
6617 if ( this->uWillpower - pStep >= uMinValue ) | |
6618 this->uWillpower -= pStep; | |
6619 break; | |
6620 case CHARACTER_ENDURANCE: | |
6621 if ( this->uEndurance <= pBaseValue ) | |
6622 pStep = pDroppedStep; | |
6623 if ( this->uEndurance - pStep >= uMinValue ) | |
6624 this->uEndurance -= pStep; | |
6625 break; | |
6626 case CHARACTER_ACCURACY: | |
6627 if ( this->uAccuracy <= pBaseValue ) | |
6628 pStep = pDroppedStep; | |
6629 if ( this->uAccuracy - pStep >= uMinValue ) | |
6630 this->uAccuracy -= pStep; | |
6631 break; | |
6632 case CHARACTER_SPEED: | |
6633 if ( this->uSpeed <= pBaseValue ) | |
6634 pStep = pDroppedStep; | |
6635 if ( this->uSpeed - pStep >= uMinValue ) | |
6636 this->uSpeed -= pStep; | |
6637 break; | |
6638 case CHARACTER_LUCK: | |
6639 if ( this->uLuck <= pBaseValue ) | |
6640 pStep = pDroppedStep; | |
6641 if ( this->uLuck - pStep >= uMinValue ) | |
6642 this->uLuck -= pStep; | |
6643 break; | |
6644 } | |
6645 } | |
6646 | |
6647 //----- (004905F5) -------------------------------------------------------- | |
6648 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6649 int Player::IncreaseAttribute(int eAttribute) | |
6650 { | |
6651 Player *v2; // esi@1 | |
6652 int v3; // eax@1 | |
6653 int v4; // ebx@1 | |
6654 signed int v5; // edi@1 | |
6655 int v6; // eax@8 | |
6656 signed int v7; // eax@17 | |
6657 signed int result; // eax@18 | |
6658 int v9; // [sp+Ch] [bp-8h]@1 | |
6659 signed int v10; // [sp+10h] [bp-4h]@1 | |
6660 | |
6661 v2 = this; | |
6662 v3 = eAttribute + 7 * GetRace(); | |
290 | 6663 v4 = StatTable[0][v3].uMaxValue; |
6664 v5 = StatTable[0][v3].uBaseStep; | |
6665 v9 = StatTable[0][v3].uBaseValue; | |
6666 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6667 PlayerCreation_ComputeAttributeBonus(); |
6668 if ( eAttribute ) | |
6669 { | |
6670 switch ( eAttribute ) | |
6671 { | |
6672 case 1: | |
6673 v6 = v2->uIntelligence; | |
6674 break; | |
6675 case 2: | |
6676 v6 = v2->uWillpower; | |
6677 break; | |
6678 case 3: | |
6679 v6 = v2->uEndurance; | |
6680 break; | |
6681 case 4: | |
6682 v6 = v2->uAccuracy; | |
6683 break; | |
6684 case 5: | |
6685 v6 = v2->uSpeed; | |
6686 break; | |
6687 case 6: | |
6688 v6 = v2->uLuck; | |
6689 break; | |
6690 default: | |
6691 v6 = eAttribute; | |
6692 break; | |
6693 } | |
6694 } | |
6695 else | |
6696 { | |
6697 v6 = v2->uMight; | |
6698 } | |
6699 if ( v6 < v9 ) | |
6700 { | |
6701 v7 = v5; | |
6702 v5 = v10; | |
6703 v10 = v7; | |
6704 } | |
6705 result = PlayerCreation_ComputeAttributeBonus(); | |
6706 if ( result >= v10 ) | |
6707 { | |
6708 if ( eAttribute ) | |
6709 { | |
6710 switch ( eAttribute ) | |
6711 { | |
6712 case 1: | |
6713 result = (signed int)&v2->uIntelligence; | |
6714 break; | |
6715 case 2: | |
6716 result = (signed int)&v2->uWillpower; | |
6717 break; | |
6718 case 3: | |
6719 result = (signed int)&v2->uEndurance; | |
6720 break; | |
6721 case 4: | |
6722 result = (signed int)&v2->uAccuracy; | |
6723 break; | |
6724 case 5: | |
6725 result = (signed int)&v2->uSpeed; | |
6726 break; | |
6727 default: | |
6728 result = eAttribute - 6; | |
6729 if ( eAttribute != 6 ) | |
6730 return result; | |
6731 result = (signed int)&v2->uLuck; | |
6732 break; | |
6733 } | |
6734 } | |
6735 else | |
6736 { | |
6737 result = (signed int)&v2->uMight; | |
6738 } | |
6739 if ( v5 + *(short *)result <= v4 ) | |
6740 *(short *)result += v5; | |
6741 } | |
6742 return result; | |
6743 } | |
6744 | |
6745 //----- (0049070F) -------------------------------------------------------- | |
6746 void Player::Zero() | |
6747 { | |
6748 Player *v1; // esi@1 | |
6749 | |
6750 v1 = this; | |
6751 this->sLevelModifier = 0; | |
6752 this->sACModifier = 0; | |
6753 this->uLuckBonus = 0; | |
6754 this->uAccuracyBonus = 0; | |
6755 this->uSpeedBonus = 0; | |
6756 this->uEnduranceBonus = 0; | |
6757 this->uWillpowerBonus = 0; | |
6758 this->uIntelligenceBonus = 0; | |
6759 this->uMightBonus = 0; | |
6760 this->field_100 = 0; | |
6761 this->field_FC = 0; | |
6762 this->field_F8 = 0; | |
6763 this->field_F4 = 0; | |
6764 this->field_F0 = 0; | |
6765 this->field_EC = 0; | |
6766 this->field_E8 = 0; | |
6767 this->field_E4 = 0; | |
6768 this->field_E0 = 0; | |
766 | 6769 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6770 v1->field_1A97 = 0; |
6771 v1->_ranged_dmg_bonus = 0; | |
6772 v1->field_1A95 = 0; | |
6773 v1->_ranged_atk_bonus = 0; | |
6774 v1->field_1A93 = 0; | |
6775 v1->_melee_dmg_bonus = 0; | |
6776 v1->field_1A91 = 0; | |
6777 v1->_some_attack_bonus = 0; | |
6778 v1->_mana_related = 0; | |
6779 v1->uFullManaBonus = 0; | |
6780 v1->_health_related = 0; | |
6781 v1->uFullHealthBonus = 0; | |
6782 } | |
6783 | |
6784 //----- (004907E7) -------------------------------------------------------- | |
299 | 6785 unsigned int Player::GetStatColor(int uStat) |
0 | 6786 { |
6787 __int16 uWhite; // si@1 | |
290 | 6788 int attribute_value; // edx@1 |
299 | 6789 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6790 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6791 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6792 | |
1014 | 6793 uRed = TargetColor(255, 35, 0); |
6794 uGreen = TargetColor(0, 255, 0); | |
6795 uWhite = TargetColor(255, 255, 255); | |
299 | 6796 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6797 |
0 | 6798 switch (uStat) |
6799 { | |
6800 case 0: attribute_value = uMight; break; | |
6801 case 1: attribute_value = uIntelligence; break; | |
6802 case 2: attribute_value = uWillpower; break; | |
6803 case 3: attribute_value = uEndurance; break; | |
290 | 6804 case 4: attribute_value = uAccuracy; break; |
6805 case 5: attribute_value = uSpeed; break; | |
0 | 6806 case 6: attribute_value = uLuck; break; |
6807 }; | |
6808 | |
299 | 6809 if ( attribute_value == pBaseAttrValue ) |
290 | 6810 return uWhite; |
299 | 6811 else if ( attribute_value > pBaseAttrValue ) |
290 | 6812 return uGreen; |
0 | 6813 else |
290 | 6814 return uRed; |
0 | 6815 } |
6816 | |
6817 //----- (004908A8) -------------------------------------------------------- | |
6818 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6819 { | |
1014 | 6820 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6821 { | |
6822 pConditions[uCondition]=0i64; | |
6823 return true; | |
0 | 6824 } |
6825 else | |
1014 | 6826 return false; |
0 | 6827 } |
6828 | |
6829 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6830 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6831 { |
6832 Player *v3; // esi@1 | |
6833 signed int v5; // eax@17 | |
6834 int v8; // edx@39 | |
6835 char *v13; // eax@45 | |
6836 signed int v15; // edi@68 | |
6837 int v16; // edx@73 | |
6838 unsigned __int16 v17; // edi@73 | |
6839 unsigned int v18; // eax@73 | |
6840 const char *v22; // eax@84 | |
6841 int scroll_id; // esi@96 | |
6842 int v25; // eax@109 | |
6843 int v26; // eax@113 | |
6844 int new_mana_val; // edi@114 | |
6845 signed __int64 v28; // qax@120 | |
6846 __int64 v30; // edi@137 | |
6847 __int64 v32; // ST3C_4@137 | |
6848 __int64 v34; // ST34_4@137 | |
6849 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6850 const char *v66; // [sp-4h] [bp-30h]@69 | |
6851 signed int v67; // [sp-4h] [bp-30h]@77 | |
6852 const char *v68; // [sp-4h] [bp-30h]@89 | |
6853 char v72; // [sp+20h] [bp-Ch]@68 | |
6854 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6855 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6856 Player *thisb; // [sp+28h] [bp-4h]@1 |
6857 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6858 | |
6859 thisb = this; | |
6860 v3 = &pParty->pPlayers[player_num-1]; | |
6861 v73 = 1; | |
6862 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6863 return; | |
6864 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6865 { |
1021 | 6866 if ( pParty->pPickedItem.uItemID == 160 ) |
6867 { | |
6868 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6869 } | |
6870 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6871 { |
1021 | 6872 new_mana_val = v3->sMana; |
6873 new_mana_val += 2; | |
6874 if ( new_mana_val > v3->GetMaxMana() ) | |
6875 new_mana_val = v3->GetMaxMana(); | |
6876 v3->PlaySound(SPEECH_36, 0); | |
6877 } | |
6878 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6879 { | |
6880 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6881 v3->PlaySound(SPEECH_36, 0); |
1021 | 6882 |
6883 } | |
6884 else | |
6885 { | |
6886 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 6887 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
1021 | 6888 ShowStatusBarString(pTmpBuf, 2); |
6889 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
6890 return; | |
1019 | 6891 } |
1032 | 6892 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6893 | |
6894 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6895 { | |
6896 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6897 } | |
6898 if ( v73 ) | |
6899 { | |
6900 if ( pParty->bTurnBasedModeOn ) | |
6901 { | |
6902 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6903 thisb->SetRecoveryTime(100); | |
6904 pTurnEngine->_40471C(); | |
6905 } | |
6906 else | |
6907 { | |
6908 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6909 } | |
6910 } | |
6911 pMouse->RemoveHoldingItem(); | |
6912 return; | |
6913 | |
1021 | 6914 |
6915 } | |
6916 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6917 { |
1021 | 6918 switch ( pParty->pPickedItem.uItemID ) |
6919 { | |
6920 case 221: //Catalyst | |
6921 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6922 break; | |
6923 case 222: //Cure Wounds | |
6924 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6925 pParty->pPlayers[player_num-1].Heal(v25); | |
6926 v3->PlaySound(SPEECH_36, 0); | |
6927 break; | |
6928 case 223: //Magic Potion | |
6929 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6930 new_mana_val = v3->sMana; | |
6931 new_mana_val += v26; | |
6932 if ( new_mana_val > v3->GetMaxMana() ) | |
6933 new_mana_val = v3->GetMaxMana(); | |
6934 v3->PlaySound(SPEECH_36, 0); | |
6935 break; | |
6936 case 224: //Cure Weakness | |
6937 v3->pConditions[Condition_Weak] = 0i64; | |
6938 v3->PlaySound(SPEECH_36, 0); | |
6939 break; | |
6940 case 225: //Cure Disease | |
6941 v3->pConditions[Condition_Disease3] = 0i64; | |
6942 v3->pConditions[Condition_Disease2] = 0i64; | |
6943 v3->pConditions[Condition_Disease1] = 0i64; | |
6944 v3->PlaySound(SPEECH_36, 0); | |
6945 break; | |
6946 case 226: //Cure Poison | |
6947 v3->pConditions[Condition_Poison3] = 0i64; | |
6948 v3->pConditions[Condition_Poison2] = 0i64; | |
6949 v3->pConditions[Condition_Poison1] = 0i64; | |
6950 v3->PlaySound(SPEECH_36, 0); | |
6951 break; | |
6952 case 227: //Awaken | |
6953 v3->pConditions[Condition_Sleep] = 0i64; | |
6954 v3->PlaySound(SPEECH_36, 0); | |
6955 break; | |
6956 case 228: //Haste | |
6957 if ( !v3->pConditions[Condition_Weak] ) | |
6958 { | |
6959 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6960 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6961 v3->PlaySound(SPEECH_36, 0); | |
6962 } | |
6963 break; | |
6964 case 229: //Heroism | |
6965 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6966 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6967 v3->PlaySound(SPEECH_36, 0); | |
6968 break; | |
6969 case 230: //Bless | |
6970 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6971 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6972 v3->PlaySound(SPEECH_36, 0); | |
6973 break; | |
6974 case 231: //Preservation | |
1032 | 6975 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6976 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6977 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6978 v3->PlaySound(SPEECH_36, 0); | |
6979 break; | |
6980 case 232: //Shield | |
1032 | 6981 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6982 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6983 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6984 v3->PlaySound(SPEECH_36, 0); | |
6985 break; | |
6986 case 234: //Stoneskin | |
6987 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6988 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6989 v3->PlaySound(SPEECH_36, 0); | |
6990 break; | |
6991 case 235: //Water Breathing | |
6992 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6993 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6994 break; | |
6995 case 237: //Remove Fear | |
6996 v3->pConditions[Condition_Fear] = 0i64; | |
6997 v3->PlaySound(SPEECH_36, 0); | |
6998 break; | |
6999 case 238: //Remove Curse | |
7000 v3->pConditions[Condition_Cursed] = 0i64; | |
7001 v3->PlaySound(SPEECH_36, 0); | |
7002 break; | |
7003 case 239: //Cure Insanity | |
7004 v3->pConditions[Condition_Insane] = 0i64; | |
7005 v3->PlaySound(SPEECH_36, 0); | |
7006 break; | |
7007 case 240: //Might Boost | |
1032 | 7008 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7009 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7010 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7011 v3->PlaySound(SPEECH_36, 0); | |
7012 break; | |
7013 case 241: //Intellect Boost | |
1032 | 7014 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7015 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7016 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7017 v3->PlaySound(SPEECH_36, 0); | |
7018 break; | |
7019 case 242: //Personality Boost | |
1032 | 7020 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7021 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7022 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7023 v3->PlaySound(SPEECH_36, 0); | |
7024 break; | |
7025 case 243://Endurance Boost | |
1032 | 7026 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7027 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7028 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7029 v3->PlaySound(SPEECH_36, 0); | |
7030 break; | |
7031 case 244: //Speed Boost | |
1032 | 7032 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7033 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7034 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7035 v3->PlaySound(SPEECH_36, 0); | |
7036 break; | |
7037 case 245: //Accuracy Boost | |
1032 | 7038 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7039 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7040 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7041 v3->PlaySound(SPEECH_36, 0); | |
7042 break; | |
7043 case 251: //Cure Paralysis | |
7044 v3->pConditions[Condition_Paralyzed] = 0i64; | |
7045 v3->PlaySound(SPEECH_36, 0); | |
7046 break; | |
7047 case 252://Divine Restoration | |
7048 v30 = v3->pConditions[Condition_Dead]; | |
7049 v32 = v3->pConditions[Condition_Pertified]; | |
7050 v34 = v3->pConditions[Condition_Eradicated]; | |
7051 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
7052 v3->pConditions[Condition_Dead] = v30; | |
7053 v3->pConditions[Condition_Pertified] = v32; | |
7054 v3->pConditions[Condition_Eradicated] = v34; | |
7055 v3->PlaySound(SPEECH_36, 0); | |
7056 break; | |
7057 case 253: //Divine Cure | |
7058 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
7059 pParty->pPlayers[player_num-1].Heal(v25); | |
7060 v3->PlaySound(SPEECH_36, 0); | |
7061 break; | |
7062 case 254: //Divine Power | |
7063 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
7064 new_mana_val = v3->sMana; | |
7065 new_mana_val += v26; | |
7066 if ( new_mana_val > v3->GetMaxMana() ) | |
7067 new_mana_val = v3->GetMaxMana(); | |
7068 v3->PlaySound(SPEECH_36, 0); | |
7069 break; | |
7070 case 255: //Luck Boost | |
1032 | 7071 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7072 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7073 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7074 v3->PlaySound(SPEECH_36, 0); | |
7075 break; | |
7076 case 256: //Fire Resistance | |
1032 | 7077 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7078 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7079 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7080 v3->PlaySound(SPEECH_36, 0); | |
1032 | 7081 break; |
1021 | 7082 case 257: //Air Resistance |
1032 | 7083 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7084 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7085 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7086 v3->PlaySound(SPEECH_36, 0); | |
7087 break; | |
7088 case 258: //Water Resistance | |
1032 | 7089 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7090 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7091 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7092 v3->PlaySound(SPEECH_36, 0); | |
7093 break; | |
7094 case 259: //Earth Resistance | |
1032 | 7095 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7096 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7097 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7098 v3->PlaySound(SPEECH_36, 0); | |
7099 break; | |
7100 case 260: //Mind Resistance | |
1032 | 7101 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7102 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7103 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7104 v3->PlaySound(SPEECH_36, 0); | |
7105 break; | |
7106 case 261: //Body Resistance | |
1032 | 7107 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7108 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7109 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7110 v3->PlaySound(SPEECH_36, 0); | |
7111 break; | |
7112 case 262: //Stone to Flesh | |
7113 v3->pConditions[Condition_Pertified] = 0i64; | |
7114 v3->PlaySound(SPEECH_36, 0); | |
7115 break; | |
7116 case 264: //Pure Luck | |
7117 if ( !v3->pure_luck_used ) | |
7118 { | |
7119 v3->uLuck += 50; | |
7120 v3->pure_luck_used = 1; | |
7121 } | |
7122 v3->PlaySound(SPEECH_36, 0); | |
7123 break; | |
7124 case 265: //Pure Speed | |
7125 if ( !v3->pure_speed_used ) | |
7126 { | |
7127 v3->uSpeed += 50; | |
7128 v3->pure_speed_used = 1; | |
7129 } | |
7130 v3->PlaySound(SPEECH_36, 0); | |
7131 break; | |
7132 case 266: //Pure Intellect | |
7133 if ( !v3->pure_intellect_used ) | |
7134 { | |
7135 v3->uIntelligence += 50; | |
7136 v3->pure_intellect_used = 1; | |
7137 } | |
7138 v3->PlaySound(SPEECH_36, 0); | |
7139 break; | |
7140 case 267: //Pure Endurance | |
7141 if ( !v3->pure_endurance_used ) | |
7142 { | |
7143 v3->uEndurance += 50; | |
7144 v3->pure_endurance_used = 1; | |
7145 } | |
7146 v3->PlaySound(SPEECH_36, 0); | |
7147 break; | |
7148 case 268: //Pure Personality | |
7149 if ( !v3->pure_willpower_used ) | |
7150 { | |
7151 v3->uWillpower += 50; | |
7152 v3->pure_willpower_used = 1; | |
7153 } | |
7154 v3->PlaySound(SPEECH_36, 0); | |
7155 break; | |
7156 case 269: //Pure Accuracy | |
7157 if ( !v3->pure_accuracy_used ) | |
7158 { | |
7159 v3->uAccuracy += 50; | |
7160 v3->pure_accuracy_used = 1; | |
7161 } | |
7162 v3->PlaySound(SPEECH_36, 0); | |
7163 break; | |
7164 case 270: //Pure Might | |
7165 if ( !v3->pure_might_used ) | |
7166 { | |
7167 v3->uMight += 50; | |
7168 v3->pure_might_used = 1; | |
7169 } | |
7170 v3->PlaySound(SPEECH_36, 0); | |
7171 break; | |
7172 case 271: //Rejuvenation | |
7173 v3->sAgeModifier = 0; | |
7174 v3->PlaySound(SPEECH_36, 0); | |
7175 break; | |
7176 | |
7177 default: | |
7178 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7179 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
1021 | 7180 ShowStatusBarString(pTmpBuf, 2u); |
7181 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
7182 return; | |
1032 | 7183 } |
7184 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
7185 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7186 { | |
7187 if ( !v73 ) | |
7188 { | |
7189 pMouse->RemoveHoldingItem(); | |
7190 return; | |
7191 } | |
7192 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 7193 } |
1032 | 7194 if ( v73 ) |
7195 { | |
7196 if ( pParty->bTurnBasedModeOn ) | |
7197 { | |
7198 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7199 thisb->SetRecoveryTime(100); | |
7200 pTurnEngine->_40471C(); | |
7201 } | |
7202 else | |
7203 { | |
7204 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7205 } | |
7206 } | |
7207 pMouse->RemoveHoldingItem(); | |
7208 return; | |
7209 | |
1021 | 7210 } |
7211 | |
7212 | |
7213 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
7214 { | |
7215 | |
7216 | |
7217 if ( pCurrentScreen == SCREEN_CASTING ) | |
7218 return; | |
7219 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7220 { | |
7221 | |
7222 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7223 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); |
7224 ShowStatusBarString(pTmpBuf, 2u); | |
7225 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7226 return; |
7227 } | |
7228 if ( bUnderwater == 1 ) | |
7229 { | |
1032 | 7230 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
7231 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7232 return; |
7233 } | |
7234 dword_50C9AC = 1; | |
7235 scroll_id = pParty->pPickedItem.uItemID - 299; | |
7236 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
7237 { | |
7238 pMouse->RemoveHoldingItem(); | |
7239 pGUIWindow_CurrentMenu->Release(); | |
7240 pIcons_LOD->_4114F2(); | |
7241 pCurrentScreen = SCREEN_GAME; | |
7242 viewparams->bRedrawGameUI = 1; | |
7243 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7244 } | |
7245 else | |
7246 { | |
7247 _720984_unused = pParty->pPickedItem.uItemID; | |
7248 pMouse->RemoveHoldingItem(); | |
7249 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7250 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7251 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7252 { | |
7253 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7254 } | |
7255 } | |
7256 return; | |
7257 } | |
7258 | |
7259 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7260 | |
7261 { | |
7262 v15 = pParty->pPickedItem.uItemID - 400; | |
7263 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7264 if ( v72 ) | |
7265 { | |
7266 v66 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7267 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell" |
1021 | 7268 ShowStatusBarString(pTmpBuf, 2u); |
1032 | 7269 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7270 return; |
7271 } | |
7272 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7273 { | |
7274 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7275 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s" |
1021 | 7276 ShowStatusBarString(pTmpBuf, 2u); |
1032 | 7277 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7278 return; |
7279 } | |
7280 v16 = v15 % 11 + 1; | |
7281 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7282 v18 = SkillToMastery(v17) - 1; | |
1032 | 7283 switch (v18) |
7284 { | |
7285 case 0: v67 = 4; break; | |
7286 case 1: v67 = 7; break; | |
7287 case 2: v67 = 10; break; | |
7288 case 3: v67 = 11; break; | |
7289 default: | |
7290 v67 = player_num; | |
7291 } | |
7292 | |
7293 if ( v16 > v67 || !v17 ) | |
1021 | 7294 { |
1032 | 7295 v22 = pParty->pPickedItem.GetDisplayName(); |
7296 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s" | |
7297 ShowStatusBarString(pTmpBuf, 2u); | |
7298 v3->PlaySound((PlayerSpeech)20, 0); | |
7299 return; | |
7300 } | |
7301 // v72 = 1; | |
7302 v3->PlaySound(SPEECH_21, 0); | |
7303 v73 = 0; | |
7304 | |
7305 | |
7306 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7307 { | |
7308 if ( !v73 ) | |
1021 | 7309 { |
1032 | 7310 pMouse->RemoveHoldingItem(); |
7311 return; | |
7312 } | |
7313 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7314 } | |
7315 if ( v73 ) | |
7316 { | |
7317 if ( pParty->bTurnBasedModeOn ) | |
7318 { | |
7319 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7320 thisb->SetRecoveryTime(100); | |
7321 pTurnEngine->_40471C(); | |
1021 | 7322 } |
7323 else | |
7324 { | |
1032 | 7325 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7326 } |
7327 } | |
1032 | 7328 pMouse->RemoveHoldingItem(); |
7329 return; | |
7330 | |
1021 | 7331 } |
7332 | |
7333 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7334 | |
7335 { | |
7336 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7337 { | |
7338 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7339 v3->PlaySound(SPEECH_37, 0); |
1021 | 7340 return; |
7341 } | |
7342 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7343 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); |
7344 ShowStatusBarString(pTmpBuf, 2u); | |
7345 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7346 return; |
7347 } | |
7348 else | |
7349 { | |
1019 | 7350 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7351 { |
7352 thisa = pParty->uCurrentMonthWeek + 1; | |
7353 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7354 v74 = NULL; |
1021 | 7355 else |
7356 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7357 switch ( pParty->uCurrentMonth ) | |
7358 { | |
1019 | 7359 case 0: |
1021 | 7360 v3->uMight += thisa; |
1032 | 7361 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7362 break; |
1019 | 7363 case 1: |
1021 | 7364 v3->uIntelligence += thisa; |
1032 | 7365 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7366 break; |
1019 | 7367 case 2: |
1021 | 7368 v3->uWillpower += thisa; |
1032 | 7369 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7370 break; |
1019 | 7371 case 3: |
1021 | 7372 v3->uEndurance += thisa; |
1032 | 7373 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7374 break; |
1019 | 7375 case 4: |
1021 | 7376 v3->uAccuracy += thisa; |
1032 | 7377 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7378 break; |
1019 | 7379 case 5: |
1021 | 7380 v3->uSpeed += thisa; |
1032 | 7381 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7382 break; |
1019 | 7383 case 6: |
1021 | 7384 v3->uLuck += thisa; |
1032 | 7385 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7386 break; |
1019 | 7387 case 7: |
1021 | 7388 party_finds_gold(1000 * thisa, 0); |
1032 | 7389 sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7390 break; |
1019 | 7391 case 8: |
1021 | 7392 Party::GiveFood(5 * thisa); |
1032 | 7393 sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7394 break; |
0 | 7395 case 9u: |
1021 | 7396 v3->uSkillPoints += 2 * thisa; |
1032 | 7397 sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7398 break; |
1019 | 7399 case 10: |
1021 | 7400 v3->uExperience += 2500 * thisa; |
1032 | 7401 sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7402 break; |
1019 | 7403 case 11: |
1021 | 7404 v8 = rand() % 6; |
7405 switch (v8) | |
7406 { | |
7407 case 0: | |
7408 v3->sResFireBase += thisa; | |
7409 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7410 break; | |
7411 case 1: | |
7412 v3->sResAirBase += thisa; | |
7413 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7414 break; | |
7415 case 2: | |
7416 v3->sResWaterBase += thisa; | |
7417 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7418 break; | |
7419 case 3: | |
7420 v3->sResEarthBase += thisa; | |
7421 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7422 break; | |
7423 case 4: | |
7424 v3->sResMindBase += thisa; | |
7425 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7426 break; | |
7427 case 5: | |
7428 v3->sResBodyBase += thisa; | |
7429 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7430 break; |
1021 | 7431 } |
1032 | 7432 sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7433 break; |
7434 | |
7435 } | |
7436 ShowStatusBarString(pTmpBuf, 2u); | |
7437 pMouse->RemoveHoldingItem(); | |
7438 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7439 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7440 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7441 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7442 { |
1021 | 7443 v3->SetCondition(Condition_Eradicated, 0); |
7444 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7445 } |
1021 | 7446 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7447 { | |
7448 v3->SetCondition(Condition_Dead, 0); | |
7449 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7450 } | |
7451 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7452 { | |
7453 v3->SetCondition(Condition_Pertified, 0); | |
7454 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7455 } | |
1019 | 7456 return; |
1021 | 7457 } |
7458 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7459 { | |
7460 Party::GiveFood(1u); | |
7461 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7462 | |
7463 } | |
7464 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7465 { | |
7466 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7467 return; | |
7468 } | |
7469 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7470 { | |
7471 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7472 return; | |
7473 } | |
7474 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7475 { | |
7476 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7477 return; | |
7478 } | |
1032 | 7479 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7480 { |
7481 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7482 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7483 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7484 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7485 } | |
7486 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7487 { | |
7488 sub_44C28F_open_nwc_dungeon(); | |
7489 return; | |
7490 } | |
0 | 7491 else |
1021 | 7492 { |
7493 | |
7494 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7495 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way" |
7496 ShowStatusBarString(pTmpBuf, 2u); | |
7497 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7498 return; |
7499 } | |
1032 | 7500 |
0 | 7501 pMouse->RemoveHoldingItem(); |
7502 return; | |
7503 } | |
1021 | 7504 |
7505 } | |
0 | 7506 |
7507 | |
7508 | |
7509 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7510 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7511 { |
0 | 7512 Player *v3; // esi@1 |
7513 signed int v4; // edi@1 | |
7514 unsigned int v5; // eax@8 | |
7515 int v6; // eax@9 | |
7516 enum CHARACTER_RACE v7; // eax@11 | |
7517 signed int v8; // eax@17 | |
7518 unsigned __int8 v9; // sf@17 | |
7519 unsigned __int8 v10; // of@17 | |
7520 int v11; // eax@19 | |
7521 unsigned int v12; // eax@20 | |
484 | 7522 unsigned int test_bit_value; // eax@25 |
7523 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7524 signed int v15; // ecx@28 |
7525 ItemGen *v16; // eax@28 | |
7526 char v17; // zf@31 | |
7527 int v18; // edi@90 | |
7528 DDM_DLV_Header *v19; // eax@122 | |
7529 char v20; // cl@124 | |
7530 DDM_DLV_Header *v21; // eax@126 | |
7531 unsigned int v22; // edi@129 | |
100 | 7532 Player *v23; // esi@134 |
0 | 7533 ItemGen *v24; // ecx@135 |
7534 signed int v25; // edx@135 | |
7535 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7536 char *v27; // edi@155 | |
7537 int v28; // ebx@161 | |
7538 int v29; // eax@161 | |
7539 | |
469 | 7540 v6 = 0; |
0 | 7541 v3 = this; |
7542 v4 = -1; | |
469 | 7543 if ( VarNum > VAR_AutoNotes ) |
7544 { | |
7545 switch ( VarNum ) | |
0 | 7546 { |
7547 case VAR_Invisible: | |
484 | 7548 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7549 return true; |
484 | 7550 return false; |
0 | 7551 case VAR_NumDeaths: |
7552 v4 = pParty->uNumDeaths; | |
469 | 7553 return v4 >= pValue; |
0 | 7554 case VAR_NumBounties: |
7555 v4 = pParty->uNumBountiesCollected; | |
469 | 7556 return v4 >= pValue; |
0 | 7557 case VAR_PrisonTerms: |
7558 v4 = pParty->uNumPrisonTerms; | |
469 | 7559 return v4 >= pValue; |
0 | 7560 case VAR_ArenaWinsPage: |
7561 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7562 return v4 >= pValue; |
0 | 7563 case VAR_ArenaWinsSquire: |
7564 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7565 return v4 >= pValue; |
0 | 7566 case VAR_ArenaWinsKnight: |
7567 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7568 return v4 >= pValue; |
0 | 7569 case VAR_ArenaWinsLord: |
7570 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7571 return v4 >= pValue; |
0 | 7572 case VAR_ReputationInCurrentLocation: |
7573 v19 = &pOutdoor->ddm; | |
7574 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7575 v19 = &pIndoor->dlv; | |
469 | 7576 v6 = v19->uReputation >= pValue; |
7577 return v6; | |
0 | 7578 case VAR_History_28|VAR_Sex: |
7579 v21 = &pOutdoor->ddm; | |
7580 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7581 v21 = &pIndoor->dlv; | |
469 | 7582 v6 = v21->field_C_alert == pValue; |
0 | 7583 return v6; |
7584 case VAR_MonthEquals2|VAR_Sex: | |
7585 case VAR_MonthEquals2|VAR_Class: | |
7586 case VAR_Counter1: | |
7587 case VAR_Counter2: | |
7588 case VAR_Counter3: | |
7589 case VAR_Counter4: | |
7590 case VAR_Counter5: | |
7591 case VAR_Counter6: | |
7592 case VAR_Counter7: | |
7593 case VAR_Counter8: | |
469 | 7594 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7595 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7596 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7597 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7598 return true; | |
7599 return false; | |
0 | 7600 case VAR_NumSkillPoints: |
7601 v4 = this->uSkillPoints; | |
469 | 7602 return v4 >= pValue; |
0 | 7603 case VAR_CircusPrises: |
7604 v4 = 0; | |
100 | 7605 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7606 do |
7607 { | |
469 | 7608 v24 = v23->pInventoryItems; |
0 | 7609 v25 = 138; |
7610 do | |
7611 { | |
7612 switch ( v24->uItemID ) | |
7613 { | |
7614 case 0x1D6u: | |
7615 ++v4; | |
7616 break; | |
7617 case 0x1D7u: | |
7618 v4 += 3; | |
7619 break; | |
7620 case 0x1DDu: | |
7621 v4 += 5; | |
7622 break; | |
7623 } | |
7624 ++v24; | |
7625 --v25; | |
7626 } | |
7627 while ( v25 ); | |
100 | 7628 ++v23; |
0 | 7629 } |
100 | 7630 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7631 return v4 >= pValue; |
0 | 7632 case VAR_MonthEquals2: |
469 | 7633 v6 = pParty->uCurrentMonth == pValue; |
7634 return v6; | |
0 | 7635 case VAR_IsFlying: |
7636 if ( pParty->bFlying | |
484 | 7637 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7638 return true; |
7639 return false; | |
0 | 7640 case VAR_HiredNPCHasSpeciality: |
469 | 7641 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7642 return v6; |
7643 case VAR_NPCs2: | |
469 | 7644 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7645 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7646 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7647 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7648 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7649 return v4 >= pValue; |
7650 v4 = pValue; | |
7651 return v4 >= pValue; | |
0 | 7652 case VAR_ItemEquipped: |
7653 v26 = (ITEM_EQUIP_TYPE)0; | |
7654 v27 = (char *)&this->pEquipment; | |
7655 break; | |
7656 case VAR_GoldInBank: | |
7657 v4 = pParty->uNumGoldInBank; | |
469 | 7658 return v4 >= pValue; |
0 | 7659 case VAR_ThieverySkill|0x80: |
7660 v28 = GetActualMight(); | |
7661 v29 = v3->GetBaseStrength(); | |
7662 goto LABEL_168; | |
7663 case VAR_DisarmTrapSkill|0x80: | |
7664 v28 = GetActualIntelligence(); | |
7665 v29 = v3->GetBaseIntelligence(); | |
7666 goto LABEL_168; | |
7667 case VAR_MonthEquals: | |
7668 v28 = GetActualWillpower(); | |
7669 v29 = v3->GetBaseWillpower(); | |
7670 goto LABEL_168; | |
7671 case VAR_MonthEquals|VAR_Sex: | |
7672 v28 = GetActualEndurance(); | |
7673 v29 = v3->GetBaseEndurance(); | |
7674 goto LABEL_168; | |
7675 case VAR_IdentifyMonsterSkill|0x80: | |
7676 v28 = GetActualSpeed(); | |
7677 v29 = v3->GetBaseSpeed(); | |
7678 goto LABEL_168; | |
7679 case VAR_ArmsmasterSkill|0x80: | |
7680 v28 = GetActualAccuracy(); | |
7681 v29 = v3->GetBaseAccuracy(); | |
7682 goto LABEL_168; | |
7683 case VAR_MonthEquals|VAR_MaxHP: | |
7684 v28 = GetActualLuck(); | |
7685 v29 = v3->GetBaseLuck(); | |
7686 LABEL_168: | |
7687 v10 = __OFSUB__(v28, v29); | |
7688 v9 = v28 - v29 < 0; | |
7689 LABEL_169: | |
7690 if ( v9 ^ v10 ) | |
469 | 7691 return v4 >= pValue; |
7692 return true; | |
0 | 7693 default: |
469 | 7694 return v4 >= pValue; |
0 | 7695 } |
7696 while ( !v3->HasItemEquipped(v26) | |
654 | 7697 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7698 { |
7699 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7700 v27 += 4; | |
7701 if ( (signed int)v26 >= 16 ) | |
469 | 7702 return false; |
7703 } | |
7704 return true; | |
7705 } | |
7706 if ( VarNum == VAR_AutoNotes ) | |
0 | 7707 { |
1033 | 7708 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7709 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7710 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7711 return false; | |
7712 return true; | |
469 | 7713 } |
7714 if ( VarNum <= VAR_BaseLuck ) | |
7715 { | |
7716 if ( VarNum != VAR_BaseLuck ) | |
7717 { | |
7718 switch ( VarNum ) | |
0 | 7719 { |
7720 case VAR_Hour: | |
469 | 7721 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7722 return true; | |
7723 return false; | |
0 | 7724 case VAR_DayOfYear: |
469 | 7725 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7726 v6 = v5 == pValue; | |
7727 return v6; | |
0 | 7728 case VAR_DayOfWeek: |
469 | 7729 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7730 v6 = v5 == pValue; | |
0 | 7731 return v6; |
7732 case VAR_Sex: | |
469 | 7733 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7734 return true; | |
7735 return v4 >= pValue; | |
0 | 7736 case VAR_Class: |
135 | 7737 v7 = (CHARACTER_RACE)this->classType; |
469 | 7738 if ( pValue == v7 ) |
7739 return true; | |
7740 return v4 >= pValue; | |
0 | 7741 case VAR_Race: |
7742 v7 = GetRace(); | |
469 | 7743 if ( pValue == v7 ) |
7744 return true; | |
7745 return v4 >= pValue; | |
0 | 7746 case VAR_CurrentHP: |
7747 v4 = this->sHealth; | |
469 | 7748 return v4 >= pValue; |
0 | 7749 case VAR_MaxHP: |
7750 v8 = GetMaxHealth(); | |
7751 v10 = __OFSUB__(v3->sHealth, v8); | |
7752 v9 = v3->sHealth - v8 < 0; | |
7753 goto LABEL_169; | |
7754 case VAR_CurrentSP: | |
7755 v4 = this->sMana; | |
469 | 7756 return v4 >= pValue; |
0 | 7757 case VAR_MaxSP: |
7758 v11 = GetMaxMana(); | |
7759 v10 = __OFSUB__(v3->sMana, v11); | |
7760 v9 = v3->sMana - v11 < 0; | |
7761 goto LABEL_169; | |
7762 case VAR_ActualAC: | |
7763 v12 = GetActualAC(); | |
7764 goto _j_cmp_against_arg; | |
7765 case VAR_ACModifier: | |
7766 v4 = this->sACModifier; | |
469 | 7767 return v4 >= pValue; |
0 | 7768 case VAR_BaseLevel: |
7769 v4 = this->uLevel; | |
469 | 7770 return v4 >= pValue; |
0 | 7771 case VAR_LevelModifier: |
7772 v4 = this->sLevelModifier; | |
469 | 7773 return v4 >= pValue; |
0 | 7774 case VAR_Age: |
7775 v12 = GetActualAge(); | |
7776 goto _j_cmp_against_arg; | |
7777 case VAR_Award: | |
1033 | 7778 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7779 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7780 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7781 return true; | |
7782 return false; | |
0 | 7783 case VAR_Experience: |
7784 v4 = LODWORD(this->uExperience); | |
469 | 7785 return v4 >= pValue; |
0 | 7786 case VAR_QBits_QuestsDone: |
484 | 7787 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7788 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7789 if ( test_bit_value & our_bit_value ) | |
478 | 7790 return true; |
7791 return false; | |
0 | 7792 case VAR_PlayerItemInHands: |
7793 v15 = 0; | |
7794 v16 = v3->pInventoryItems; | |
7795 break; | |
7796 case VAR_FixedGold: | |
7797 v4 = pParty->uNumGold; | |
469 | 7798 return v4 >= pValue; |
0 | 7799 case VAR_MightBonus: |
7800 v4 = this->uMightBonus; | |
469 | 7801 return v4 >= pValue; |
0 | 7802 case VAR_IntellectBonus: |
7803 v4 = this->uIntelligenceBonus; | |
469 | 7804 return v4 >= pValue; |
0 | 7805 case VAR_PersonalityBonus: |
7806 v4 = this->uWillpowerBonus; | |
469 | 7807 return v4 >= pValue; |
0 | 7808 case VAR_EnduranceBonus: |
7809 v4 = this->uEnduranceBonus; | |
469 | 7810 return v4 >= pValue; |
0 | 7811 case VAR_SpeedBonus: |
7812 v4 = this->uSpeedBonus; | |
469 | 7813 return v4 >= pValue; |
0 | 7814 case VAR_AccuracyBonus: |
7815 v4 = this->uAccuracyBonus; | |
469 | 7816 return v4 >= pValue; |
0 | 7817 case VAR_LuckBonus: |
7818 v4 = this->uLuckBonus; | |
469 | 7819 return v4 >= pValue; |
0 | 7820 case VAR_BaseMight: |
7821 v4 = this->uMight; | |
469 | 7822 return v4 >= pValue; |
0 | 7823 case VAR_BaseIntellect: |
7824 v4 = this->uIntelligence; | |
469 | 7825 return v4 >= pValue; |
0 | 7826 case VAR_BasePersonality: |
7827 v4 = this->uWillpower; | |
469 | 7828 return v4 >= pValue; |
0 | 7829 case VAR_BaseEndurance: |
7830 v4 = this->uEndurance; | |
469 | 7831 return v4 >= pValue; |
0 | 7832 case VAR_BaseSpeed: |
7833 v4 = this->uSpeed; | |
469 | 7834 return v4 >= pValue; |
0 | 7835 case VAR_BaseAccuracy: |
7836 v4 = this->uAccuracy; | |
469 | 7837 return v4 >= pValue; |
0 | 7838 case VAR_FixedFood: |
7839 v4 = pParty->uNumFoodRations; | |
469 | 7840 return v4 >= pValue; |
0 | 7841 default: |
469 | 7842 return v4 >= pValue; |
7843 } | |
7844 while ( v16->uItemID != pValue ) | |
0 | 7845 { |
7846 ++v15; | |
7847 ++v16; | |
7848 if ( v15 >= 138 ) | |
7849 { | |
469 | 7850 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7851 return v6; |
7852 } | |
7853 } | |
469 | 7854 return true; |
0 | 7855 } |
7856 v4 = this->uLuck; | |
469 | 7857 return v4 >= pValue; |
7858 } | |
7859 if ( VarNum <= VAR_MagicResistance ) | |
7860 { | |
7861 if ( VarNum == VAR_MagicResistance ) | |
0 | 7862 { |
7863 v4 = this->sResMagicBase; | |
7864 } | |
7865 else | |
7866 { | |
469 | 7867 switch ( VarNum ) |
0 | 7868 { |
7869 case VAR_FireResistance: | |
7870 v4 = this->sResFireBase; | |
469 | 7871 return v4 >= pValue; |
0 | 7872 case VAR_AirResistance: |
7873 v4 = this->sResAirBase; | |
469 | 7874 return v4 >= pValue; |
0 | 7875 case VAR_WaterResistance: |
7876 v4 = this->sResWaterBase; | |
469 | 7877 return v4 >= pValue; |
0 | 7878 case VAR_EarthResistance: |
7879 v4 = this->sResEarthBase; | |
469 | 7880 return v4 >= pValue; |
0 | 7881 case VAR_SpiritResistance: |
7882 v4 = this->sResSpiritBase; | |
469 | 7883 return v4 >= pValue; |
0 | 7884 case VAR_MindResistance: |
7885 v4 = this->sResMindBase; | |
469 | 7886 return v4 >= pValue; |
0 | 7887 case VAR_BodyResistance: |
7888 v4 = this->sResBodyBase; | |
469 | 7889 return v4 >= pValue; |
0 | 7890 case VAR_LightResistance: |
7891 v4 = this->sResLightBase; | |
469 | 7892 return v4 >= pValue; |
0 | 7893 case VAR_DarkResistance: |
7894 v4 = this->sResDarkBase; | |
469 | 7895 return v4 >= pValue; |
0 | 7896 case VAR_ActualMight: |
7897 v12 = GetActualMight(); | |
7898 goto _j_cmp_against_arg; | |
7899 case VAR_ActualIntellect: | |
7900 v12 = GetActualIntelligence(); | |
7901 goto _j_cmp_against_arg; | |
7902 case VAR_ActualPersonality: | |
7903 v12 = GetActualWillpower(); | |
7904 goto _j_cmp_against_arg; | |
7905 case VAR_ActualEndurance: | |
7906 v12 = GetActualEndurance(); | |
7907 goto _j_cmp_against_arg; | |
7908 case VAR_ActualSpeed: | |
7909 v12 = GetActualSpeed(); | |
7910 goto _j_cmp_against_arg; | |
7911 case VAR_ActualAccuracy: | |
7912 v12 = GetActualAccuracy(); | |
7913 goto _j_cmp_against_arg; | |
7914 case VAR_ActualLuck: | |
7915 v12 = GetActualLuck(); | |
7916 _j_cmp_against_arg: | |
7917 v4 = v12; | |
7918 break; | |
7919 default: | |
469 | 7920 return v4 >= pValue; |
7921 } | |
7922 } | |
7923 return v4 >= pValue; | |
7924 } | |
7925 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7926 { | |
7927 if ( VarNum != VAR_DisarmTrapSkill ) | |
7928 { | |
7929 if ( VarNum <= VAR_MindResistanceBonus ) | |
7930 { | |
7931 switch ( VarNum ) | |
0 | 7932 { |
7933 case VAR_MindResistanceBonus: | |
7934 v4 = this->sResMindBonus; | |
7935 break; | |
7936 case VAR_FireResistanceBonus: | |
7937 v4 = this->sResFireBonus; | |
7938 break; | |
7939 case VAR_AirResistanceBonus: | |
7940 v4 = this->sResAirBonus; | |
7941 break; | |
7942 case VAR_WaterResistanceBonus: | |
7943 v4 = this->sResWaterBonus; | |
7944 break; | |
7945 case VAR_EarthResistanceBonus: | |
7946 v4 = this->sResEarthBonus; | |
7947 break; | |
7948 case VAR_SpiritResistanceBonus: | |
7949 v4 = this->sResSpiritBonus; | |
7950 break; | |
7951 } | |
469 | 7952 return v4 >= pValue; |
7953 } | |
7954 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7955 { |
7956 v4 = this->sResBodyBonus; | |
469 | 7957 return v4 >= pValue; |
7958 } | |
7959 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7960 { |
7961 v4 = this->sResLightBonus; | |
469 | 7962 return v4 >= pValue; |
7963 } | |
7964 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7965 { |
7966 v4 = this->sResDarkBonus; | |
469 | 7967 return v4 >= pValue; |
7968 } | |
7969 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7970 { |
7971 v4 = this->sResMagicBonus; | |
469 | 7972 return v4 >= pValue; |
7973 } | |
7974 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7975 return v4 >= pValue; | |
0 | 7976 } |
7977 LABEL_90: | |
469 | 7978 v18 = *((short *)&this->pConditions[16] + VarNum); |
7979 if ( pValue <= 63 ) | |
0 | 7980 v4 = v18 & 0x3F; |
7981 else | |
469 | 7982 v4 = pValue & v18; |
7983 return v4 >= pValue; | |
7984 } | |
7985 if ( VarNum == 104 ) | |
0 | 7986 goto LABEL_90; |
469 | 7987 if ( (signed int)VarNum <= 104 ) |
7988 return v4 >= pValue; | |
7989 if ( (signed int)VarNum > 0x79 ) | |
7990 { | |
7991 if ( VarNum != 122 ) | |
7992 { | |
7993 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7994 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7995 return v4 >= pValue; | |
0 | 7996 } |
7997 v4 = GetMajorConditionIdx(); | |
7998 if ( v4 != 18 ) | |
7999 { | |
469 | 8000 return v4 >= pValue; |
8001 } | |
8002 v4 = pValue; | |
8003 return v4 >= pValue; | |
8004 } | |
8005 return *((int *)this + 2 * VarNum - 210); | |
0 | 8006 } |
8007 | |
8008 | |
8009 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8010 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8011 { | |
8012 signed int currPlayerId; // ebx@1 | |
0 | 8013 Player *v4; // esi@1 |
8014 unsigned int v5; // edi@1 | |
8015 unsigned int v6; // esi@13 | |
8016 unsigned int v7; // esi@14 | |
8017 signed int v8; // eax@17 | |
8018 ItemGen *v9; // ecx@17 | |
8019 int v10; // eax@21 | |
8020 signed int v11; // eax@30 | |
8021 Player *v12; // ecx@44 | |
8022 char *v13; // ecx@45 | |
8023 Player *v14; // ecx@49 | |
8024 int v15; // ecx@86 | |
8025 int v16; // esi@106 | |
8026 char v17; // al@106 | |
8027 int v18; // eax@107 | |
8028 Player *v19; // ecx@112 | |
8029 Player *v20; // ecx@127 | |
8030 int v21; // eax@127 | |
8031 int v22; // eax@145 | |
8032 char v23; // zf@146 | |
8033 DDM_DLV_Header *v24; // ecx@148 | |
8034 signed int v25; // eax@172 | |
8035 int v26; // [sp-8h] [bp-3Ch]@84 | |
8036 signed int v27; // [sp-4h] [bp-38h]@4 | |
8037 int v28; // [sp-4h] [bp-38h]@84 | |
8038 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8039 char v30; // [sp+32h] [bp-2h]@1 | |
8040 char v31; // [sp+33h] [bp-1h]@1 | |
8041 | |
492 | 8042 currPlayerId = 0; |
0 | 8043 v30 = 0; |
8044 v31 = 0; | |
8045 v4 = this; | |
8046 v5 = 0; | |
8047 if ( this == pPlayers[2] ) | |
492 | 8048 currPlayerId = 1; |
8049 else if ( this == pPlayers[3] ) | |
8050 currPlayerId = 2; | |
757 | 8051 else if ( this == pPlayers[4] ) |
492 | 8052 currPlayerId = 3; |
8053 if ( var_type > VAR_AutoNotes ) | |
8054 { | |
8055 if ( var_type <= VAR_GoldInBank ) | |
8056 { | |
8057 if ( var_type == VAR_GoldInBank ) | |
8058 { | |
8059 pParty->uNumGoldInBank = var_value; | |
0 | 8060 return; |
8061 } | |
492 | 8062 if ( var_type <= VAR_Counter8 ) |
8063 { | |
8064 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8065 { |
492 | 8066 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8067 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8068 } |
8069 else | |
8070 { | |
492 | 8071 switch ( var_type ) |
0 | 8072 { |
8073 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8074 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8075 break; |
8076 case VAR_NPCs2: | |
8077 pParty->field_709 = 0; | |
492 | 8078 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8079 Party__CountHirelings(); |
0 | 8080 viewparams->bRedrawGameUI = 1; |
8081 break; | |
8082 case VAR_NumSkillPoints: | |
492 | 8083 this->uSkillPoints = var_value; |
0 | 8084 break; |
8085 } | |
8086 } | |
8087 return; | |
8088 } | |
492 | 8089 if ( var_type < VAR_Counter9 ) |
0 | 8090 return; |
492 | 8091 if ( (signed int)var_type <= 0x112 ) |
8092 { | |
8093 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8094 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8095 } |
8096 else | |
8097 { | |
492 | 8098 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8099 { |
8100 v24 = &pOutdoor->ddm; | |
8101 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8102 v24 = &pIndoor->dlv; | |
492 | 8103 v24->uReputation = var_value; |
8104 if ( var_value > 10000 ) | |
0 | 8105 v24->uReputation = 10000; |
8106 return; | |
8107 } | |
492 | 8108 if ( var_type <= VAR_ReputationInCurrentLocation |
8109 || var_type > VAR_History_28 | |
8110 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8111 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8112 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8113 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8114 v23) ) |
8115 return; | |
8116 bFlashHistoryBook = 1; | |
8117 } | |
8118 LABEL_172: | |
492 | 8119 v25 = 8 * currPlayerId + 400; |
862 | 8120 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8121 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8122 return; | |
8123 } | |
492 | 8124 if ( var_type != 307 ) |
8125 { | |
8126 switch ( var_type ) | |
0 | 8127 { |
8128 case 308: | |
492 | 8129 pParty->uNumBountiesCollected = var_value; |
0 | 8130 break; |
8131 case 309: | |
492 | 8132 pParty->uNumPrisonTerms = var_value; |
0 | 8133 break; |
8134 case 310: | |
492 | 8135 pParty->uNumArenaPageWins = var_value; |
0 | 8136 break; |
8137 case 311: | |
492 | 8138 pParty->uNumArenaSquireWins = var_value; |
0 | 8139 break; |
8140 case 312: | |
492 | 8141 pParty->uNumArenaKnightWins = var_value; |
0 | 8142 break; |
8143 case 313: | |
492 | 8144 pParty->uNumArenaLordWins = var_value; |
0 | 8145 break; |
8146 } | |
8147 return; | |
8148 } | |
492 | 8149 pParty->uNumDeaths = var_value; |
0 | 8150 LABEL_168: |
8151 if ( v30 != 1 ) | |
8152 { | |
8153 LABEL_170: | |
8154 if ( v31 != 1 ) | |
8155 return; | |
8156 v5 = 0; | |
8157 goto LABEL_172; | |
8158 } | |
8159 LABEL_169: | |
492 | 8160 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8161 goto LABEL_170; |
8162 } | |
492 | 8163 if ( var_type == VAR_AutoNotes ) |
8164 { | |
8165 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
|
8166 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8167 && pAutonoteTxt[var_value-1].pText ) |
8168 { | |
8169 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8170 v30 = 1; |
187 | 8171 v20->PlaySound(SPEECH_96, 0); |
492 | 8172 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8173 bFlashAutonotesBook = 1; |
981 | 8174 _506568_autonote_type = v21; |
0 | 8175 } |
492 | 8176 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8177 v31 = 1; |
8178 goto LABEL_168; | |
8179 } | |
492 | 8180 if ( var_type <= VAR_ActualMight ) |
8181 { | |
8182 if ( var_type != VAR_ActualMight ) | |
8183 { | |
8184 switch ( var_type ) | |
0 | 8185 { |
8186 case VAR_RandomGold: | |
492 | 8187 v6 = rand() % var_value + 1; |
0 | 8188 Party::SetGold(v6); |
8189 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8190 ShowStatusBarString(pTmpBuf, 2u); | |
8191 GameUI_DrawFoodAndGold(); | |
8192 return; | |
8193 case VAR_RandomFood: | |
492 | 8194 v7 = rand() % var_value + 1; |
0 | 8195 Party::SetFood(v7); |
8196 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8197 ShowStatusBarString(pTmpBuf, 2u); | |
8198 GameUI_DrawFoodAndGold(); | |
8199 goto LABEL_124; | |
8200 case VAR_Sex: | |
492 | 8201 this->uSex = (PLAYER_SEX)var_value; |
0 | 8202 goto LABEL_124; |
8203 case VAR_Class: | |
492 | 8204 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8205 if ( (char)var_value != 35 ) | |
0 | 8206 goto LABEL_124; |
8207 v8 = 0; | |
8208 v9 = this->pInventoryItems; | |
8209 break; | |
8210 case VAR_CurrentHP: | |
492 | 8211 this->sHealth = var_value; |
0 | 8212 goto LABEL_124; |
8213 case VAR_MaxHP: | |
8214 this->sHealth = GetMaxHealth(); | |
8215 return; | |
8216 case VAR_CurrentSP: | |
492 | 8217 this->sMana = var_value; |
0 | 8218 goto LABEL_124; |
8219 case VAR_MaxSP: | |
8220 this->sMana = GetMaxMana(); | |
8221 return; | |
8222 case VAR_ACModifier: | |
492 | 8223 this->sACModifier = (unsigned __int8)var_value; |
0 | 8224 goto LABEL_124; |
8225 case VAR_BaseLevel: | |
492 | 8226 this->uLevel = (unsigned __int8)var_value; |
0 | 8227 goto LABEL_124; |
8228 case VAR_LevelModifier: | |
492 | 8229 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8230 goto LABEL_124; |
8231 case VAR_Age: | |
492 | 8232 this->sAgeModifier = var_value; |
0 | 8233 return; |
8234 case VAR_Award: | |
492 | 8235 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8236 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
|
8237 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8238 && pAwards[var_value].pText ) |
0 | 8239 { |
8240 v30 = 1; | |
8241 v31 = 1; | |
492 | 8242 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8243 } |
492 | 8244 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8245 goto LABEL_168; | |
0 | 8246 case VAR_Experience: |
492 | 8247 this->uExperience = var_value; |
0 | 8248 goto LABEL_124; |
8249 case VAR_QBits_QuestsDone: | |
492 | 8250 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
|
8251 // && (&dword_722F10)[4 * a3] ) |
492 | 8252 && pQuestTable[var_value-1] ) |
0 | 8253 { |
492 | 8254 v14 = pPlayers[currPlayerId + 1]; |
0 | 8255 bFlashQuestBook = 1; |
8256 v30 = 1; | |
8257 v31 = 1; | |
187 | 8258 v14->PlaySound(SPEECH_93, 0); |
0 | 8259 } |
484 | 8260 v13 = (char *)pParty->_quest_bits; |
0 | 8261 LABEL_51: |
492 | 8262 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8263 if (( v30 != 1 )&&( v31 != 1 )) | |
8264 return; | |
8265 else | |
8266 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8267 if ( v31 != 1 ) | |
8268 return; | |
8269 v25 = 8 * currPlayerId + 400; | |
862 | 8270 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8271 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8272 return; | |
0 | 8273 case VAR_PlayerItemInHands: |
8274 item.Reset(); | |
8275 item.Reset(); | |
492 | 8276 item.uItemID = var_value; |
0 | 8277 item.uAttributes = 1; |
8278 pParty->SetHoldingItem(&item); | |
492 | 8279 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8280 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8281 return; |
8282 case VAR_FixedGold: | |
492 | 8283 Party::SetGold(var_value); |
0 | 8284 return; |
8285 case VAR_BaseMight: | |
492 | 8286 this->uMight = (unsigned __int8)var_value; |
0 | 8287 goto LABEL_84; |
8288 case VAR_BaseIntellect: | |
492 | 8289 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8290 goto LABEL_84; |
8291 case VAR_BasePersonality: | |
492 | 8292 this->uWillpower = (unsigned __int8)var_value; |
0 | 8293 goto LABEL_84; |
8294 case VAR_BaseEndurance: | |
492 | 8295 this->uEndurance = (unsigned __int8)var_value; |
0 | 8296 goto LABEL_84; |
8297 case VAR_BaseSpeed: | |
492 | 8298 this->uSpeed = (unsigned __int8)var_value; |
0 | 8299 goto LABEL_84; |
8300 case VAR_BaseAccuracy: | |
492 | 8301 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8302 goto LABEL_84; |
8303 case VAR_BaseLuck: | |
492 | 8304 this->uLuck = (unsigned __int8)var_value; |
0 | 8305 goto LABEL_84; |
8306 case VAR_FixedFood: | |
492 | 8307 Party::SetFood(var_value); |
0 | 8308 goto LABEL_124; |
8309 case VAR_MightBonus: | |
8310 goto LABEL_64; | |
8311 case VAR_IntellectBonus: | |
8312 goto LABEL_68; | |
8313 case VAR_PersonalityBonus: | |
8314 goto LABEL_69; | |
8315 case VAR_EnduranceBonus: | |
8316 goto LABEL_70; | |
8317 case VAR_SpeedBonus: | |
8318 goto LABEL_71; | |
8319 case VAR_AccuracyBonus: | |
8320 goto LABEL_72; | |
8321 case VAR_LuckBonus: | |
8322 goto LABEL_73; | |
8323 default: | |
8324 return; | |
8325 } | |
8326 while ( v9->uItemID != 615 ) | |
8327 { | |
8328 ++v8; | |
8329 ++v9; | |
8330 if ( v8 >= 138 ) | |
8331 goto LABEL_22; | |
8332 } | |
8333 v10 = (int)((char *)v4 + 36 * v8); | |
8334 *(int *)(v10 + 532) = 601; | |
492 | 8335 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8336 LABEL_22: |
8337 if ( v4->sResFireBase < 20 ) | |
8338 v4->sResFireBase = 20; | |
8339 if ( v4->sResAirBase < 20 ) | |
8340 v4->sResAirBase = 20; | |
8341 if ( v4->sResWaterBase < 20 ) | |
8342 v4->sResWaterBase = 20; | |
8343 if ( v4->sResEarthBase < 20 ) | |
8344 v4->sResEarthBase = 20; | |
8345 v4->sResMindBase = 200; | |
8346 v4->sResBodyBase = 200; | |
8347 v11 = v4->GetSexByVoice(); | |
1014 | 8348 v4->uPrevVoiceID = v4->uVoiceID; |
8349 v4->uPrevFace = v4->uCurrentFace; | |
0 | 8350 if ( v11 ) |
8351 { | |
1014 | 8352 v4->uCurrentFace = 21; |
0 | 8353 v4->uVoiceID = 21; |
8354 } | |
8355 else | |
8356 { | |
1014 | 8357 v4->uCurrentFace = 20; |
0 | 8358 v4->uVoiceID = 20; |
8359 } | |
1014 | 8360 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
0 | 8361 goto LABEL_124; |
8362 } | |
8363 LABEL_64: | |
492 | 8364 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8365 LABEL_111: |
8366 v28 = 0; | |
187 | 8367 v26 = SPEECH_91; |
0 | 8368 LABEL_112: |
492 | 8369 v19 = pPlayers[currPlayerId + 1]; |
0 | 8370 v31 = 1; |
187 | 8371 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8372 goto LABEL_169; |
8373 } | |
492 | 8374 if ( var_type <= VAR_FireResistanceBonus ) |
8375 { | |
8376 if ( var_type == VAR_FireResistanceBonus ) | |
8377 { | |
8378 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8379 goto LABEL_111; |
8380 } | |
492 | 8381 switch ( var_type ) |
0 | 8382 { |
8383 case VAR_ActualIntellect: | |
8384 LABEL_68: | |
492 | 8385 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8386 goto LABEL_111; |
8387 case VAR_ActualPersonality: | |
8388 LABEL_69: | |
492 | 8389 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8390 goto LABEL_111; |
8391 case VAR_ActualEndurance: | |
8392 LABEL_70: | |
492 | 8393 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8394 goto LABEL_111; |
8395 case VAR_ActualSpeed: | |
8396 LABEL_71: | |
492 | 8397 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8398 goto LABEL_111; |
8399 case VAR_ActualAccuracy: | |
8400 LABEL_72: | |
492 | 8401 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8402 goto LABEL_111; |
8403 case VAR_ActualLuck: | |
8404 LABEL_73: | |
492 | 8405 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8406 goto LABEL_111; |
8407 case VAR_FireResistance: | |
492 | 8408 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8409 goto LABEL_84; |
8410 case VAR_AirResistance: | |
492 | 8411 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8412 goto LABEL_84; |
8413 case VAR_WaterResistance: | |
492 | 8414 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8415 goto LABEL_84; |
8416 case VAR_EarthResistance: | |
492 | 8417 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8418 goto LABEL_84; |
8419 case VAR_SpiritResistance: | |
492 | 8420 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8421 goto LABEL_84; |
8422 case VAR_MindResistance: | |
492 | 8423 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8424 goto LABEL_84; |
8425 case VAR_BodyResistance: | |
492 | 8426 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8427 goto LABEL_84; |
8428 case VAR_LightResistance: | |
492 | 8429 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8430 goto LABEL_84; |
8431 case VAR_DarkResistance: | |
492 | 8432 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8433 goto LABEL_84; |
8434 case VAR_MagicResistance: | |
492 | 8435 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8436 LABEL_84: |
8437 v28 = 0; | |
8438 v26 = 92; | |
8439 goto LABEL_112; | |
8440 default: | |
8441 return; | |
8442 } | |
8443 return; | |
8444 } | |
8445 HIWORD(v15) = 0; | |
492 | 8446 if ( var_type > VAR_DisarmTrapSkill ) |
8447 { | |
8448 if ( var_type != VAR_LearningSkill ) | |
8449 { | |
8450 if ( var_type <= VAR_LearningSkill ) | |
0 | 8451 return; |
492 | 8452 if ( var_type <= VAR_Eradicated ) |
8453 { | |
8454 v4->SetCondition(var_type - 105, 1); | |
0 | 8455 } |
8456 else | |
8457 { | |
492 | 8458 if ( var_type != VAR_MajorCondition ) |
0 | 8459 { |
492 | 8460 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8461 byte_5E4C15[var_type] = var_value; | |
0 | 8462 return; |
8463 } | |
8464 memset(v4, 0, 0xA0u); | |
8465 } | |
8466 LABEL_124: | |
8467 v31 = 1; | |
8468 goto LABEL_169; | |
8469 } | |
8470 LABEL_106: | |
492 | 8471 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8472 v17 = *(char *)v16; |
492 | 8473 if ( var_value <= VAR_BodyResistanceBonus ) |
8474 { | |
8475 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8476 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8477 } | |
8478 else | |
8479 { | |
492 | 8480 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8481 } |
8482 *(short *)v16 = v18; | |
8483 goto LABEL_124; | |
8484 } | |
492 | 8485 if ( var_type == VAR_DisarmTrapSkill ) |
8486 if ( v30 != 1 ) | |
8487 { | |
8488 if ( v31 != 1 ) | |
8489 return; | |
8490 v5 = 0; | |
8491 goto LABEL_172; | |
8492 } | |
8493 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8494 goto LABEL_170; | |
8495 if ( var_type <= VAR_BodyResistanceBonus ) | |
8496 { | |
8497 switch ( var_type ) | |
0 | 8498 { |
8499 case VAR_BodyResistanceBonus: | |
492 | 8500 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8501 break; |
8502 case VAR_AirResistanceBonus: | |
492 | 8503 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8504 break; |
8505 case VAR_WaterResistanceBonus: | |
492 | 8506 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8507 break; |
8508 case VAR_EarthResistanceBonus: | |
492 | 8509 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8510 break; |
8511 case VAR_SpiritResistanceBonus: | |
492 | 8512 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8513 break; |
8514 default: | |
492 | 8515 if ( var_type != 62 ) |
0 | 8516 return; |
492 | 8517 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8518 break; |
8519 } | |
8520 goto LABEL_111; | |
8521 } | |
492 | 8522 if ( var_type == VAR_LightResistanceBonus ) |
8523 { | |
8524 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8525 goto LABEL_111; |
8526 } | |
492 | 8527 if ( var_type == VAR_DarkResistanceBonus ) |
8528 { | |
8529 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8530 goto LABEL_111; | |
8531 } | |
8532 if ( var_type == VAR_MagicResistanceBonus ) | |
8533 { | |
8534 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8535 goto LABEL_111; |
8536 } | |
492 | 8537 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8538 if ( v30 != 1 ) | |
8539 { | |
8540 if ( v31 != 1 ) | |
8541 return; | |
8542 v5 = 0; | |
8543 v25 = 8 * currPlayerId + 400; | |
862 | 8544 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8545 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8546 return; | |
8547 } | |
8548 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8549 goto LABEL_170; | |
0 | 8550 } |
8551 | |
8552 | |
8553 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8554 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8555 { |
8556 char v3; // bl@1 | |
8557 Player *v4; // esi@1 | |
8558 signed int uPlayerIdx; // edi@1 | |
8559 int v6; // eax@15 | |
8560 unsigned int v7; // esi@18 | |
8561 int *v8; // ebx@21 | |
8562 int v9; // eax@22 | |
8563 signed int v10; // eax@24 | |
8564 int v11; // eax@27 | |
8565 __int16 *v12; // esi@28 | |
8566 Player *v13; // ecx@34 | |
8567 Player *v14; // ecx@36 | |
8568 char *v15; // ecx@37 | |
8569 unsigned __int8 v16; // cf@38 | |
8570 Player *v17; // ecx@42 | |
8571 __int16 *v18; // esi@53 | |
8572 __int16 *v19; // esi@62 | |
8573 char *v20; // esi@107 | |
8574 __int16 v21; // dx@107 | |
8575 int v22; // ecx@107 | |
8576 Player *v23; // ecx@132 | |
8577 int v24; // eax@132 | |
8578 int v25; // eax@150 | |
8579 char v26; // zf@151 | |
8580 DDM_DLV_Header *v27; // eax@153 | |
8581 signed int v28; // eax@176 | |
8582 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8583 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8584 int v31; // [sp-4h] [bp-3Ch]@84 |
8585 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8586 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8587 char v34; // [sp+37h] [bp-1h]@1 | |
8588 | |
8589 auto Dst = this; | |
8590 v3 = 0; | |
8591 v34 = 0; | |
8592 v4 = Dst; | |
8593 uPlayerIdx = 0; | |
8594 if ( Dst == pPlayers[2] ) | |
8595 uPlayerIdx = 1; | |
310 | 8596 else if ( Dst == pPlayers[3] ) |
8597 uPlayerIdx = 2; | |
8598 else if ( Dst == pPlayers[4] ) | |
8599 uPlayerIdx = 3; | |
8600 | |
8601 if ( var_type <= VAR_AutoNotes ) | |
8602 { | |
8603 if ( var_type != VAR_AutoNotes ) | |
8604 { | |
8605 if ( var_type <= VAR_ActualMight ) | |
8606 { | |
8607 if ( var_type != VAR_ActualMight ) | |
0 | 8608 { |
310 | 8609 switch ( var_type ) |
0 | 8610 { |
8611 case VAR_RandomGold: | |
8612 if ( !val ) | |
8613 val = 1; | |
8614 v6 = rand(); | |
8615 party_finds_gold(v6 % val + 1, 1); | |
8616 GameUI_DrawFoodAndGold(); | |
8617 return; | |
8618 case VAR_RandomFood: | |
8619 if ( !val ) | |
8620 val = 1; | |
8621 v7 = rand() % val + 1; | |
8622 Party::GiveFood(v7); | |
8623 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8624 ShowStatusBarString(pTmpBuf, 2u); | |
8625 GameUI_DrawFoodAndGold(); | |
8626 goto _play_sound; | |
8627 case VAR_Sex: | |
8628 Dst->uSex = (PLAYER_SEX)val; | |
8629 goto _play_anim_and_exit; | |
8630 case VAR_Class: | |
135 | 8631 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8632 goto _play_anim_and_exit; |
8633 case VAR_CurrentHP: | |
8634 v8 = &Dst->sHealth; | |
8635 *v8 += val; | |
8636 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8637 goto _play_anim_and_exit; | |
8638 v9 = v4->GetMaxHealth(); | |
8639 goto LABEL_23; | |
8640 case VAR_MaxHP: | |
8641 v10 = Dst->GetMaxHealth(); | |
8642 v4->_health_related = 0; | |
8643 v4->uFullHealthBonus = 0; | |
8644 v4->sHealth = v10; | |
8645 return; | |
8646 case VAR_CurrentSP: | |
8647 v8 = &Dst->sMana; | |
8648 *v8 += val; | |
8649 if ( Dst->sMana > GetMaxMana() ) | |
8650 { | |
8651 v9 = v4->GetMaxMana(); | |
8652 LABEL_23: | |
8653 *v8 = v9; | |
8654 } | |
8655 goto _play_anim_and_exit; | |
8656 case VAR_MaxSP: | |
8657 v11 = GetMaxMana(); | |
8658 v4->_mana_related = 0; | |
8659 v4->uFullManaBonus = 0; | |
8660 v4->sMana = v11; | |
8661 return; | |
8662 case VAR_ACModifier: | |
8663 v12 = &Dst->sACModifier; | |
8664 goto LABEL_29; | |
8665 case VAR_BaseLevel: | |
8666 v12 = (__int16 *)&Dst->uLevel; | |
8667 goto LABEL_29; | |
8668 case VAR_LevelModifier: | |
8669 v12 = &Dst->sLevelModifier; | |
8670 LABEL_29: | |
8671 *v12 += val; | |
8672 if ( *v12 > 255 ) | |
8673 *v12 = 255; | |
8674 goto _play_anim_and_exit; | |
8675 case VAR_Age: | |
8676 Dst->sAgeModifier += val; | |
8677 return; | |
8678 case VAR_Award: | |
8679 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8680 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8681 | |
492 | 8682 && pAwards[val].pText ) |
0 | 8683 { |
8684 v14 = pPlayers[uPlayerIdx + 1]; | |
8685 v34 = 1; | |
8686 v3 = 1; | |
187 | 8687 v14->PlaySound(SPEECH_96, 0); |
0 | 8688 } |
735 | 8689 v15 = (char *)v4->_guilds_member_bits; |
0 | 8690 goto LABEL_44; |
8691 case VAR_Experience: | |
8692 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8693 LODWORD(Dst->uExperience) += val; | |
8694 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8695 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8696 Dst->uExperience = 4000000000i64; | |
8697 goto _play_anim_and_exit; | |
8698 case VAR_QBits_QuestsDone: | |
484 | 8699 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
|
8700 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8701 && pQuestTable[val-1] ) |
0 | 8702 { |
501 | 8703 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8704 bFlashQuestBook = 1; |
8705 v34 = 1; | |
8706 v3 = 1; | |
501 | 8707 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8708 } |
484 | 8709 v15 = (char *)pParty->_quest_bits; |
0 | 8710 LABEL_44: |
8711 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8712 goto LABEL_173; | |
8713 case VAR_PlayerItemInHands: | |
8714 item.Reset(); | |
8715 item.Reset(); | |
8716 item.uAttributes = 1; | |
8717 item.uItemID = val; | |
8718 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8719 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8720 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8721 { | |
8722 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8723 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8724 } | |
8725 pParty->SetHoldingItem(&item); | |
8726 return; | |
8727 case VAR_FixedGold: | |
8728 party_finds_gold(val, 1); | |
8729 return; | |
8730 case VAR_BaseMight: | |
8731 v18 = (__int16 *)&Dst->uMight; | |
8732 goto LABEL_82; | |
8733 case VAR_BaseIntellect: | |
8734 v18 = (__int16 *)&Dst->uIntelligence; | |
8735 goto LABEL_82; | |
8736 case VAR_BasePersonality: | |
8737 v18 = (__int16 *)&Dst->uWillpower; | |
8738 goto LABEL_82; | |
8739 case VAR_BaseEndurance: | |
8740 v18 = (__int16 *)&Dst->uEndurance; | |
8741 goto LABEL_82; | |
8742 case VAR_BaseSpeed: | |
8743 v18 = (__int16 *)&Dst->uSpeed; | |
8744 goto LABEL_82; | |
8745 case VAR_BaseAccuracy: | |
8746 v18 = (__int16 *)&Dst->uAccuracy; | |
8747 goto LABEL_82; | |
8748 case VAR_BaseLuck: | |
8749 v18 = (__int16 *)&Dst->uLuck; | |
8750 goto LABEL_82; | |
8751 case VAR_FixedFood: | |
8752 Party::GiveFood(val); | |
715 | 8753 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8754 ShowStatusBarString(pTmpBuf, 2u); |
8755 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8756 Party::SetFood(0xFFFFu); | |
8757 goto _play_sound; | |
8758 case VAR_MightBonus: | |
8759 goto LABEL_62; | |
8760 case VAR_IntellectBonus: | |
8761 goto LABEL_66; | |
8762 case VAR_PersonalityBonus: | |
8763 goto LABEL_67; | |
8764 case VAR_EnduranceBonus: | |
8765 goto LABEL_68; | |
8766 case VAR_SpeedBonus: | |
8767 goto LABEL_69; | |
8768 case VAR_AccuracyBonus: | |
8769 goto LABEL_70; | |
8770 case VAR_LuckBonus: | |
8771 goto LABEL_71; | |
8772 default: | |
8773 return; | |
8774 } | |
8775 return; | |
8776 } | |
8777 LABEL_62: | |
8778 v19 = (__int16 *)&Dst->uMightBonus; | |
8779 goto LABEL_113; | |
8780 } | |
310 | 8781 if ( var_type <= VAR_FireResistanceBonus ) |
8782 { | |
8783 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8784 { |
310 | 8785 switch ( var_type ) |
0 | 8786 { |
8787 case VAR_ActualIntellect: | |
8788 LABEL_66: | |
8789 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8790 goto LABEL_113; | |
8791 case VAR_ActualPersonality: | |
8792 LABEL_67: | |
8793 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8794 goto LABEL_113; | |
8795 case VAR_ActualEndurance: | |
8796 LABEL_68: | |
8797 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8798 goto LABEL_113; | |
8799 case VAR_ActualSpeed: | |
8800 LABEL_69: | |
8801 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8802 goto LABEL_113; | |
8803 case VAR_ActualAccuracy: | |
8804 LABEL_70: | |
8805 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8806 goto LABEL_113; | |
8807 case VAR_ActualLuck: | |
8808 LABEL_71: | |
8809 v19 = (__int16 *)&Dst->uLuckBonus; | |
8810 goto LABEL_113; | |
8811 case VAR_FireResistance: | |
8812 v18 = &Dst->sResFireBase; | |
8813 goto LABEL_82; | |
8814 case VAR_AirResistance: | |
8815 v18 = &Dst->sResAirBase; | |
8816 goto LABEL_82; | |
8817 case VAR_WaterResistance: | |
8818 v18 = &Dst->sResWaterBase; | |
8819 goto LABEL_82; | |
8820 case VAR_EarthResistance: | |
8821 v18 = &Dst->sResEarthBase; | |
8822 goto LABEL_82; | |
8823 case VAR_SpiritResistance: | |
8824 v18 = &Dst->sResSpiritBase; | |
8825 goto LABEL_82; | |
8826 case VAR_MindResistance: | |
8827 v18 = &Dst->sResMindBase; | |
8828 goto LABEL_82; | |
8829 case VAR_BodyResistance: | |
8830 v18 = &Dst->sResBodyBase; | |
8831 goto LABEL_82; | |
8832 case VAR_LightResistance: | |
8833 v18 = &Dst->sResLightBase; | |
8834 goto LABEL_82; | |
8835 case VAR_DarkResistance: | |
8836 v18 = &Dst->sResDarkBase; | |
8837 goto LABEL_82; | |
8838 case VAR_MagicResistance: | |
8839 v18 = &Dst->sResMagicBase; | |
8840 LABEL_82: | |
8841 *v18 += val; | |
8842 if ( *v18 > 255 ) | |
8843 *v18 = 255; | |
8844 v31 = 0; | |
8845 v29 = 92; | |
8846 goto LABEL_116; | |
8847 default: | |
8848 return; | |
8849 } | |
8850 return; | |
8851 } | |
8852 v19 = &Dst->sResFireBonus; | |
8853 LABEL_113: | |
8854 *v19 += val; | |
8855 if ( *v19 > 255 ) | |
8856 *v19 = 255; | |
8857 v31 = 0; | |
187 | 8858 v29 = SPEECH_91; |
0 | 8859 LABEL_116: |
8860 v3 = 1; | |
187 | 8861 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8862 goto _play_anim_and_maybe_sound; |
8863 } | |
310 | 8864 if ( var_type <= VAR_DisarmTrapSkill ) |
8865 { | |
8866 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8867 { |
310 | 8868 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8869 { |
310 | 8870 switch ( var_type ) |
0 | 8871 { |
8872 case VAR_BodyResistanceBonus: | |
8873 v19 = &Dst->sResBodyBonus; | |
8874 break; | |
8875 case VAR_AirResistanceBonus: | |
8876 v19 = &Dst->sResAirBonus; | |
8877 break; | |
8878 case VAR_WaterResistanceBonus: | |
8879 v19 = &Dst->sResWaterBonus; | |
8880 break; | |
8881 case VAR_EarthResistanceBonus: | |
8882 v19 = &Dst->sResEarthBonus; | |
8883 break; | |
8884 case VAR_SpiritResistanceBonus: | |
8885 v19 = &Dst->sResSpiritBonus; | |
8886 break; | |
8887 default: | |
310 | 8888 if ( var_type != 62 ) |
0 | 8889 return; |
8890 v19 = &Dst->sResMindBonus; | |
8891 break; | |
8892 } | |
8893 goto LABEL_113; | |
8894 } | |
310 | 8895 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8896 { |
8897 v19 = &Dst->sResLightBonus; | |
8898 goto LABEL_113; | |
8899 } | |
310 | 8900 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8901 { |
8902 v19 = &Dst->sResDarkBonus; | |
8903 goto LABEL_113; | |
8904 } | |
310 | 8905 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8906 { |
8907 v19 = &Dst->sResMagicBonus; | |
8908 goto LABEL_113; | |
8909 } | |
310 | 8910 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8911 return; |
8912 } | |
8913 goto LABEL_106; | |
8914 } | |
310 | 8915 if ( var_type == VAR_LearningSkill ) |
0 | 8916 { |
8917 LABEL_106: | |
8918 if ( val <= VAR_BodyResistanceBonus ) | |
8919 { | |
310 | 8920 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8921 } |
8922 else | |
8923 { | |
310 | 8924 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8925 v21 = *(short *)v20; |
8926 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8927 if ( v22 > 60 ) | |
8928 LOWORD(v22) = 60; | |
8929 LOBYTE(v21) = v21 & 0xC0; | |
8930 *(short *)v20 = v22 | v21; | |
8931 } | |
8932 goto _play_anim_and_exit; | |
8933 } | |
310 | 8934 if ( var_type <= VAR_LearningSkill ) |
0 | 8935 return; |
310 | 8936 if ( var_type <= VAR_Eradicated ) |
8937 { | |
8938 Dst->SetCondition(var_type - 105, 0); | |
0 | 8939 } |
8940 else | |
8941 { | |
310 | 8942 if ( var_type != VAR_MajorCondition ) |
0 | 8943 { |
310 | 8944 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8945 { |
310 | 8946 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8947 byte_5E4C15[var_type] += val; | |
0 | 8948 else |
310 | 8949 byte_5E4C15[var_type] = -1; |
0 | 8950 } |
8951 return; | |
8952 } | |
8953 memset(Dst, 0, 0xA0u); | |
8954 } | |
8955 _play_anim_and_exit: | |
8956 v3 = 1; | |
8957 _play_anim_and_maybe_sound: | |
8958 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8959 _maybe_play_sound: | |
8960 if ( v3 != 1 ) | |
8961 return; | |
8962 goto _play_sound; | |
8963 } | |
8964 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
|
8965 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8966 && pAutonoteTxt[val-1].pText ) |
0 | 8967 { |
8968 v23 = pPlayers[uPlayerIdx + 1]; | |
8969 v34 = 1; | |
187 | 8970 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8971 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8972 bFlashAutonotesBook = 1; |
981 | 8973 _506568_autonote_type = v24; |
0 | 8974 } |
8975 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8976 v3 = 1; | |
8977 LABEL_173: | |
8978 if ( v34 != 1 ) | |
8979 goto _maybe_play_sound; | |
8980 goto _play_anim_and_maybe_sound; | |
8981 } | |
310 | 8982 if ( var_type > VAR_GoldInBank ) |
8983 { | |
8984 if ( var_type == 307 ) | |
0 | 8985 { |
8986 pParty->uNumDeaths += val; | |
8987 goto LABEL_173; | |
8988 } | |
310 | 8989 switch ( var_type ) |
0 | 8990 { |
8991 case 308: | |
8992 pParty->uNumBountiesCollected += val; | |
8993 break; | |
8994 case 309: | |
8995 pParty->uNumPrisonTerms += val; | |
8996 break; | |
8997 case 310: | |
8998 pParty->uNumArenaPageWins += val; | |
8999 break; | |
9000 case 311: | |
9001 pParty->uNumArenaSquireWins += val; | |
9002 break; | |
9003 case 312: | |
9004 pParty->uNumArenaKnightWins += val; | |
9005 break; | |
9006 case 313: | |
9007 pParty->uNumArenaLordWins += val; | |
9008 break; | |
9009 } | |
9010 } | |
9011 else | |
9012 { | |
310 | 9013 if ( var_type == VAR_GoldInBank ) |
0 | 9014 { |
9015 pParty->uNumGoldInBank += val; | |
9016 return; | |
9017 } | |
310 | 9018 if ( var_type <= VAR_Counter8 ) |
9019 { | |
9020 if ( (signed int)var_type >= 245 ) | |
9021 { | |
9022 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9023 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9024 } |
9025 else | |
9026 { | |
310 | 9027 switch ( var_type ) |
0 | 9028 { |
9029 case VAR_MonthEquals|VAR_CurrentSP: | |
9030 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9031 break; | |
9032 case VAR_NPCs2: | |
9033 pParty->field_709 = 0; | |
9034 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9035 Party__CountHirelings(); |
0 | 9036 viewparams->bRedrawGameUI = 1; |
9037 break; | |
9038 case VAR_NumSkillPoints: | |
9039 Dst->uSkillPoints += val; | |
9040 break; | |
9041 } | |
9042 } | |
9043 return; | |
9044 } | |
310 | 9045 if ( var_type < VAR_Counter9 ) |
0 | 9046 return; |
310 | 9047 if ( (signed int)var_type <= 274 ) |
9048 { | |
9049 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9050 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9051 goto _play_sound; |
9052 } | |
310 | 9053 if ( var_type != VAR_ReputationInCurrentLocation ) |
9054 { | |
9055 if ( var_type <= VAR_ReputationInCurrentLocation | |
9056 || var_type > VAR_History_28 | |
9057 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9058 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9059 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9060 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9061 v26) ) |
9062 return; | |
9063 bFlashHistoryBook = 1; | |
9064 _play_sound: | |
9065 v28 = 8 * uPlayerIdx + 400; | |
862 | 9066 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9067 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9068 return; | |
9069 } | |
9070 v27 = &pOutdoor->ddm; | |
9071 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9072 v27 = &pIndoor->dlv; | |
9073 v27->uReputation += val; | |
9074 if ( v27->uReputation > 10000 ) | |
9075 v27->uReputation = 10000; | |
9076 } | |
9077 } | |
9078 // 506568: using guessed type int dword_506568; | |
9079 // 507948: using guessed type char bFlashHistoryBook; | |
9080 // 507949: using guessed type char bFlashAutonotesBook; | |
9081 // 50794A: using guessed type char bFlashQuestBook; | |
9082 // 72371C: using guessed type int dword_72371C[]; | |
9083 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9084 | |
9085 | |
9086 | |
9087 | |
9088 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9089 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9090 { |
9091 unsigned int v3; // ebx@1 | |
9092 signed int v4; // esi@1 | |
501 | 9093 bool result; // eax@8 |
0 | 9094 int v6; // esi@11 |
9095 int v7; // edi@14 | |
9096 signed int v8; // eax@17 | |
9097 char *v9; // eax@20 | |
9098 char v10; // sf@20 | |
9099 char *v11; // ecx@26 | |
9100 char *v12; // ecx@27 | |
9101 __int64 v13; // qax@27 | |
9102 unsigned __int8 v14; // cf@27 | |
501 | 9103 int *v15; // edx@29 |
0 | 9104 char *v16; // eax@90 |
9105 char *v17; // ecx@94 | |
501 | 9106 int v18; // esi@97 |
0 | 9107 signed int v19; // edx@97 |
9108 char *v20; // ecx@98 | |
9109 int v21; // eax@100 | |
9110 __int16 v22; // dx@112 | |
9111 int v23; // [sp-8h] [bp-14h]@45 | |
9112 signed int v24; // [sp-4h] [bp-10h]@4 | |
9113 int v25; // [sp-4h] [bp-10h]@45 | |
9114 | |
9115 v3 = 0; | |
605 | 9116 v4 = uActiveCharacter - 1; |
501 | 9117 result = false; |
9118 if ( (signed int)VarNum > 222 ) | |
9119 { | |
9120 if ( (signed int)VarNum <= 307 ) | |
9121 { | |
9122 if ( VarNum == 307 ) | |
9123 { | |
9124 pParty->uNumDeaths -= (unsigned int)pValue; | |
9125 return pValue; | |
9126 } | |
9127 if ( VarNum == 223 ) | |
0 | 9128 { |
9129 v11 = (char *)pParty->_autonote_bits; | |
501 | 9130 v22 = (short)pValue - 1; |
0 | 9131 } |
9132 else | |
9133 { | |
501 | 9134 if ( VarNum != 231 ) |
0 | 9135 { |
501 | 9136 switch ( VarNum ) |
0 | 9137 { |
9138 case 232: | |
501 | 9139 VarNum = (VariableType)0; |
602 | 9140 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9141 result = (bool) pValue; |
9142 dword_5B65CC = 0; | |
9143 if ( (int)VarNum == pValue ) | |
0 | 9144 { |
501 | 9145 dword_5B65CC = (int)pValue; |
0 | 9146 } |
9147 else | |
9148 { | |
9149 pParty->field_709 = 0; | |
501 | 9150 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9151 Party__CountHirelings(); |
0 | 9152 viewparams->bRedrawGameUI = 1; |
9153 } | |
9154 break; | |
9155 case 241: | |
9156 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9157 { | |
9158 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9159 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9160 { |
605 | 9161 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9162 { |
9163 v21 = *(int *)v20; | |
9164 if ( (char)*(int *)v20 < 0 ) | |
9165 { | |
9166 LOBYTE(v21) = v21 & 0x7F; | |
9167 *(int *)v20 = v21; | |
9168 } | |
9169 } | |
9170 v20 += 76; | |
9171 } | |
9172 } | |
605 | 9173 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9174 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9175 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9176 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9177 pParty->field_709 = 0; | |
659 | 9178 Party__CountHirelings(); |
0 | 9179 break; |
9180 case 243: | |
9181 v17 = (char *)&this->uSkillPoints; | |
501 | 9182 result = *v17; |
9183 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9184 { | |
9185 *(int *)v17 -= (int)pValue; | |
9186 result = v17; | |
9187 } | |
0 | 9188 else |
9189 *(int *)v17 = 0; | |
9190 break; | |
9191 case 275: | |
9192 v16 = (char *)&pOutdoor->ddm; | |
9193 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9194 v16 = (char *)&pIndoor->dlv; | |
501 | 9195 *((int *)v16 + 2) -= (int)pValue; |
0 | 9196 if ( *((int *)v16 + 2) < -10000 ) |
9197 *((int *)v16 + 2) = -10000; | |
9198 break; | |
9199 case 306: | |
501 | 9200 result = VarNum - 306; |
9201 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9202 { | |
9203 result = (bool)pValue; | |
9204 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9205 } |
0 | 9206 else |
9207 LABEL_88: | |
9208 dword_5B65C4 = 1; | |
9209 break; | |
9210 } | |
501 | 9211 return result; |
0 | 9212 } |
9213 v11 = this->field_1A50; | |
501 | 9214 v22 = (signed __int16)pValue; |
0 | 9215 } |
9216 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9217 return result; |
9218 } | |
9219 switch ( VarNum ) | |
0 | 9220 { |
9221 case 308: | |
501 | 9222 result = (bool)pValue; |
9223 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9224 break; |
9225 case 309: | |
501 | 9226 result = (bool)pValue; |
9227 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9228 break; |
9229 case 310: | |
501 | 9230 result = (bool)pValue; |
9231 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9232 break; |
9233 case 311: | |
501 | 9234 result = (bool)pValue; |
9235 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9236 break; |
9237 case 312: | |
501 | 9238 result = (bool)pValue; |
9239 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9240 break; |
9241 case 313: | |
501 | 9242 result = (bool)pValue; |
9243 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9244 break; |
9245 } | |
9246 } | |
9247 else | |
9248 { | |
501 | 9249 if ( (signed int)VarNum >= 123 ) |
9250 { | |
9251 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9252 } |
9253 else | |
9254 { | |
501 | 9255 switch ( VarNum ) |
0 | 9256 { |
9257 case VAR_RandomGold: | |
501 | 9258 v6 = rand() % (signed int)pValue + 1; |
0 | 9259 if ( v6 > pParty->uNumGold ) |
9260 v6 = pParty->uNumGold; | |
9261 Party::TakeGold(v6); | |
9262 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9263 ShowStatusBarString(pTmpBuf, 2); |
0 | 9264 GameUI_DrawFoodAndGold(); |
501 | 9265 return result; |
0 | 9266 case VAR_RandomFood: |
501 | 9267 v7 = rand() % (signed int)pValue + 1; |
0 | 9268 if ( v7 > pParty->uNumFoodRations ) |
9269 v7 = pParty->uNumFoodRations; | |
9270 Party::TakeFood(v7); | |
9271 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9272 ShowStatusBarString(pTmpBuf, 2u); | |
9273 GameUI_DrawFoodAndGold(); | |
605 | 9274 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9275 v8 = 8 * v4 + 400; | |
862 | 9276 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9277 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9278 return result; |
0 | 9279 case VAR_CurrentHP: |
501 | 9280 ReceiveDamage((signed int)pValue, 4); |
605 | 9281 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9282 v8 = 8 * v4 + 400; | |
862 | 9283 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9284 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9285 return result; | |
0 | 9286 case VAR_CurrentSP: |
9287 v9 = (char *)&this->sMana; | |
501 | 9288 v10 = this->sMana - (signed int)pValue < 0; |
9289 *(int *)v9 -= (int)pValue; | |
0 | 9290 if ( v10 ) |
9291 *(int *)v9 = 0; | |
605 | 9292 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9293 v8 = 8 * v4 + 400; | |
862 | 9294 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9295 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9296 return result; | |
0 | 9297 case VAR_ACModifier: |
501 | 9298 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9299 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9300 v8 = 8 * v4 + 400; | |
862 | 9301 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9302 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9303 return result; | |
0 | 9304 case VAR_BaseLevel: |
501 | 9305 this->uLevel -= (unsigned __int8)pValue; |
605 | 9306 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9307 v8 = 8 * v4 + 400; | |
862 | 9308 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9309 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9310 return result; | |
0 | 9311 case VAR_LevelModifier: |
501 | 9312 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9313 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9314 v8 = 8 * v4 + 400; | |
862 | 9315 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9316 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9317 return result; | |
0 | 9318 case VAR_Age: |
501 | 9319 this->sAgeModifier -= (signed __int16)pValue; |
9320 return result; | |
0 | 9321 case VAR_Award: |
605 | 9322 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9323 return result; | |
0 | 9324 case VAR_Experience: |
9325 v12 = (char *)&this->uExperience; | |
501 | 9326 v13 = (signed int)pValue; |
9327 v14 = *(int *)v12 < (unsigned int)pValue; | |
9328 *(int *)v12 -= (int)pValue; | |
0 | 9329 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9330 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9331 v8 = 8 * v4 + 400; | |
862 | 9332 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9333 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9334 return result; | |
0 | 9335 case VAR_QBits_QuestsDone: |
501 | 9336 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9337 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9338 return true; |
0 | 9339 case VAR_PlayerItemInHands: |
501 | 9340 v15 = this->pInventoryIndices; |
0 | 9341 break; |
9342 case VAR_FixedGold: | |
501 | 9343 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9344 goto LABEL_88; |
501 | 9345 Party::TakeGold((unsigned int)pValue); |
9346 return result; | |
0 | 9347 case VAR_MightBonus: |
9348 case VAR_ActualMight: | |
501 | 9349 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9350 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9351 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9352 v8 = 8 * v4 + 400; | |
862 | 9353 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9354 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9355 return result; | |
0 | 9356 case VAR_IntellectBonus: |
9357 case VAR_ActualIntellect: | |
501 | 9358 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9359 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9360 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9361 v8 = 8 * v4 + 400; | |
862 | 9362 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9363 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9364 return result; | |
0 | 9365 case VAR_PersonalityBonus: |
9366 case VAR_ActualPersonality: | |
501 | 9367 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9368 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9369 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9370 v8 = 8 * v4 + 400; | |
862 | 9371 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9372 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9373 return result; | |
0 | 9374 case VAR_EnduranceBonus: |
9375 case VAR_ActualEndurance: | |
501 | 9376 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9377 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9378 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9379 v8 = 8 * v4 + 400; | |
862 | 9380 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9381 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9382 return result; | |
0 | 9383 case VAR_SpeedBonus: |
9384 case VAR_ActualSpeed: | |
501 | 9385 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9386 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9387 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9388 v8 = 8 * v4 + 400; | |
862 | 9389 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9390 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9391 return result; | |
0 | 9392 case VAR_AccuracyBonus: |
9393 case VAR_ActualAccuracy: | |
501 | 9394 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9395 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9396 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9397 v8 = 8 * v4 + 400; | |
862 | 9398 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9399 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9400 return result; | |
0 | 9401 case VAR_LuckBonus: |
9402 case VAR_ActualLuck: | |
501 | 9403 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9404 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9405 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9406 v8 = 8 * v4 + 400; | |
862 | 9407 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9408 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9409 return result; | |
0 | 9410 case VAR_BaseMight: |
501 | 9411 this->uMight -= (unsigned __int16)pValue; |
605 | 9412 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9413 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9414 v8 = 8 * v4 + 400; | |
862 | 9415 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9416 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9417 return result; | |
0 | 9418 case VAR_BaseIntellect: |
501 | 9419 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9420 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9421 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9422 v8 = 8 * v4 + 400; | |
862 | 9423 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9424 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9425 return result; | |
0 | 9426 case VAR_BasePersonality: |
501 | 9427 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9428 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9429 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9430 v8 = 8 * v4 + 400; | |
862 | 9431 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9432 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9433 return result; | |
0 | 9434 case VAR_BaseEndurance: |
501 | 9435 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9436 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9437 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9438 v8 = 8 * v4 + 400; | |
862 | 9439 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9440 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9441 return result; | |
0 | 9442 case VAR_BaseSpeed: |
501 | 9443 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9444 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9445 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9446 v8 = 8 * v4 + 400; | |
862 | 9447 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9448 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9449 return result; | |
0 | 9450 case VAR_BaseAccuracy: |
501 | 9451 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9452 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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); |
9457 return result; | |
0 | 9458 case VAR_BaseLuck: |
501 | 9459 this->uLuck -= (unsigned __int16)pValue; |
605 | 9460 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9461 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9462 v8 = 8 * v4 + 400; | |
862 | 9463 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9464 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9465 return result; | |
0 | 9466 case VAR_FireResistance: |
501 | 9467 this->sResFireBase -= (signed __int16)pValue; |
605 | 9468 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9469 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9470 v8 = 8 * v4 + 400; | |
862 | 9471 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9472 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9473 return result; | |
0 | 9474 case VAR_AirResistance: |
501 | 9475 this->sResAirBase -= (signed __int16)pValue; |
605 | 9476 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9477 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9478 v8 = 8 * v4 + 400; | |
862 | 9479 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9480 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9481 return result; | |
0 | 9482 case VAR_WaterResistance: |
501 | 9483 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9484 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_EarthResistance: |
501 | 9491 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9492 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9493 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9494 v8 = 8 * v4 + 400; | |
862 | 9495 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9496 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9497 return result; | |
0 | 9498 case VAR_SpiritResistance: |
501 | 9499 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9500 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9501 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9502 v8 = 8 * v4 + 400; | |
862 | 9503 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9504 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9505 return result; | |
0 | 9506 case VAR_MindResistance: |
501 | 9507 this->sResMindBase -= (signed __int16)pValue; |
605 | 9508 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_BodyResistance: |
501 | 9515 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9516 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9517 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9518 v8 = 8 * v4 + 400; | |
862 | 9519 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9520 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9521 return result; | |
0 | 9522 case VAR_LightResistance: |
501 | 9523 this->sResLightBase -= (signed __int16)pValue; |
605 | 9524 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9525 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9526 v8 = 8 * v4 + 400; | |
862 | 9527 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9528 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9529 return result; | |
0 | 9530 case VAR_DarkResistance: |
501 | 9531 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9532 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9533 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9534 v8 = 8 * v4 + 400; | |
862 | 9535 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9536 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9537 return result; | |
0 | 9538 case VAR_MagicResistance: |
501 | 9539 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9540 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9541 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9542 v8 = 8 * v4 + 400; | |
862 | 9543 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9544 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9545 return result; | |
0 | 9546 case VAR_FireResistanceBonus: |
501 | 9547 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9548 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9549 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9550 v8 = 8 * v4 + 400; | |
862 | 9551 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9552 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9553 return result; | |
0 | 9554 case VAR_AirResistanceBonus: |
501 | 9555 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9556 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_WaterResistanceBonus: |
501 | 9563 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9564 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9565 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9566 v8 = 8 * v4 + 400; | |
862 | 9567 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9568 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9569 return result; | |
0 | 9570 case VAR_EarthResistanceBonus: |
501 | 9571 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9572 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9573 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9574 v8 = 8 * v4 + 400; | |
862 | 9575 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9576 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9577 return result; | |
0 | 9578 case VAR_SpiritResistanceBonus: |
501 | 9579 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9580 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9581 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9582 v8 = 8 * v4 + 400; | |
862 | 9583 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9584 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9585 return result; | |
0 | 9586 case VAR_MindResistanceBonus: |
501 | 9587 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9588 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9589 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9590 v8 = 8 * v4 + 400; | |
862 | 9591 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9592 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9593 return result; | |
0 | 9594 case VAR_BodyResistanceBonus: |
501 | 9595 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9596 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9597 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9598 v8 = 8 * v4 + 400; | |
862 | 9599 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9600 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9601 return result; | |
0 | 9602 case VAR_LightResistanceBonus: |
501 | 9603 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9604 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9605 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9606 v8 = 8 * v4 + 400; | |
862 | 9607 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9608 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9609 return result; | |
0 | 9610 case VAR_DarkResistanceBonus: |
501 | 9611 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9612 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9613 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9614 v8 = 8 * v4 + 400; | |
862 | 9615 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9616 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9617 return result; | |
0 | 9618 case VAR_MagicResistanceBonus: |
501 | 9619 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9620 v25 = 0; |
187 | 9621 v23 = SPEECH_91; |
9622 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9623 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9624 v8 = 8 * v4 + 400; | |
862 | 9625 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9626 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9627 return result; | |
0 | 9628 case VAR_FixedFood: |
501 | 9629 Party::TakeFood((unsigned int)pValue); |
605 | 9630 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9631 v8 = 8 * v4 + 400; | |
862 | 9632 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9633 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9634 return result; | |
0 | 9635 case VAR_StaffSkill: |
9636 case VAR_SwordSkill: | |
9637 case VAR_DaggerSkill: | |
9638 case VAR_AxeSkill: | |
9639 case VAR_SpearSkill: | |
9640 case VAR_BowSkill: | |
9641 case VAR_MaceSkill: | |
9642 case VAR_BlasterSkill: | |
9643 case VAR_ShieldSkill: | |
9644 case VAR_LeatherSkill: | |
9645 case VAR_SkillChain: | |
9646 case VAR_PlateSkill: | |
9647 case VAR_FireSkill: | |
9648 case VAR_AirSkill: | |
9649 case VAR_WaterSkill: | |
9650 case VAR_EarthSkill: | |
9651 case VAR_SpiritSkill: | |
9652 case VAR_MindSkill: | |
9653 case VAR_BodySkill: | |
9654 case VAR_LightSkill: | |
9655 case VAR_DarkSkill: | |
9656 case VAR_IdentifyItemSkill: | |
9657 case VAR_MerchantSkill: | |
9658 case VAR_RepairSkill: | |
9659 case VAR_BodybuildingSkill: | |
9660 case VAR_MeditationSkill: | |
9661 case VAR_PerceptionSkill: | |
9662 case VAR_DiplomacySkill: | |
9663 case VAR_DisarmTrapSkill: | |
9664 case VAR_LearningSkill: | |
501 | 9665 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9666 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9667 v8 = 8 * v4 + 400; | |
862 | 9668 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9669 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9670 return result; | |
0 | 9671 case VAR_Cursed: |
9672 case VAR_Weak: | |
9673 case VAR_Asleep: | |
9674 case VAR_Afraid: | |
9675 case VAR_Drunk: | |
9676 case VAR_Insane: | |
9677 case VAR_PoisonedGreen: | |
9678 case VAR_DiseasedGreen: | |
9679 case VAR_PoisonedYellow: | |
9680 case VAR_DiseasedYellow: | |
9681 case VAR_PoisonedRed: | |
9682 case VAR_DiseasedRed: | |
9683 case VAR_Paralyzed: | |
9684 case VAR_Unconsious: | |
9685 case VAR_Dead: | |
9686 case VAR_Stoned: | |
9687 case VAR_Eradicated: | |
501 | 9688 *((int *)this + 2 * VarNum - 210) = 0; |
9689 *((int *)this + 2 * result - 209) = 0; | |
0 | 9690 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9691 v8 = 8 * v4 + 400; | |
862 | 9692 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9693 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9694 return result; |
605 | 9695 default: |
9696 return result; | |
9697 } | |
9698 for (v3 = 1; v3 < 126; v3++) | |
9699 { | |
9700 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9701 { |
605 | 9702 RemoveItemAtInventoryIndex(v3); |
501 | 9703 return true; |
0 | 9704 } |
605 | 9705 } |
501 | 9706 if ( pParty->pPickedItem.uItemID == pValue ) |
9707 { | |
605 | 9708 pMouse->RemoveHoldingItem(); |
9709 return true; | |
9710 } | |
9711 return false; | |
0 | 9712 } |
9713 } | |
9714 } | |
9715 // 5B65C4: using guessed type int dword_5B65C4; | |
9716 // 5B65CC: using guessed type int dword_5B65CC; |