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