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