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