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