Mercurial > mm7
annotate Player.cpp @ 1015:c8c5224164da
Merge
author | Gloval |
---|---|
date | Sun, 19 May 2013 20:39:45 +0400 |
parents | a704435d3285 |
children | 9ac94d00012e 32ec62bbaa2c |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
0 | 3 #include "OSAPI.h" |
4 #include "Player.h" | |
5 #include "PlayerFrameTable.h" | |
6 #include "Texture.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Party.h" | |
816 | 9 #include "Log.h" |
0 | 10 #include "LOD.h" |
11 #include "Monsters.h" | |
12 #include "GUIWindow.h" | |
13 #include "Viewport.h" | |
14 #include "Actor.h" | |
15 #include "Game.h" | |
16 #include "Mouse.h" | |
17 #include "TurnEngine.h" | |
18 #include "Events.h" | |
19 #include "Events2D.h" | |
20 #include "Outdoor.h" | |
21 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Awards.h" |
189 | 24 #include "texts.h" |
816 | 25 |
0 | 26 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
27 #include "MM7.h" |
0 | 28 |
29 | |
30 | |
31 | |
32 | |
33 | |
34 /* 381 */ | |
35 #pragma pack(push, 1) | |
290 | 36 struct PlayerCreation_AttributeProps |
0 | 37 { |
38 unsigned __int8 uBaseValue; | |
39 char uMaxValue; | |
40 char uDroppedStep; | |
41 char uBaseStep; | |
42 }; | |
43 #pragma pack(pop) | |
44 | |
45 | |
46 #pragma pack(push, 1) | |
290 | 47 |
48 | |
49 | |
0 | 50 #pragma pack(pop) |
290 | 51 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
52 { | |
53 {{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},}, | |
54 {{ 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},}, | |
55 {{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},}, | |
56 {{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 | 57 }; |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 // available skills per class ( 9 classes X 37 skills ) | |
65 // 0 - not available | |
66 // 1 - available | |
67 // 2 - primary skill | |
68 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
69 { | |
70 {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}, | |
71 {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}, | |
72 {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}, | |
73 {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}, | |
74 {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}, | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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 | |
79 }; | |
80 | |
81 | |
82 | |
83 | |
84 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
85 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
86 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}; | |
87 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}; | |
88 | |
89 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
90 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
91 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
93 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
94 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
96 | |
97 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
98 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
99 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
101 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
102 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
104 | |
105 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
106 | |
107 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
108 | |
94 | 109 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 110 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 111 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 112 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 113 |
114 | |
1010 | 115 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
116 | |
0 | 117 |
816 | 118 unsigned short base_recovery_times_per_weapon_type[12] = |
119 { | |
120 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
121 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
122 60, // PLAYER_SKILL_DAGGER | |
123 100, // PLAYER_SKILL_AXE | |
124 80, // PLAYER_SKILL_SPEAR | |
125 100, // PLAYER_SKILL_BOW | |
126 80, // PLAYER_SKILL_MACE | |
127 30, // PLAYER_SKILL_BLASTER | |
128 10, // PLAYER_SKILL_SHIELD | |
129 10, // PLAYER_SKILL_LEATHER | |
130 20, // PLAYER_SKILL_CHAIN | |
131 30 // PLAYER_SKILL_PLATE | |
132 }; | |
133 | |
134 | |
0 | 135 |
136 //----- (00490913) -------------------------------------------------------- | |
137 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
138 { | |
139 signed int v0; // edi@1 | |
140 signed int v1; // esi@1 | |
141 int v2; // ebx@2 | |
142 int v3; // ecx@17 | |
143 signed int v4; // eax@17 | |
144 int v5; // edx@18 | |
145 signed int v6; // ecx@18 | |
146 signed int v8; // [sp+Ch] [bp-8h]@1 | |
147 signed int v9; // [sp+10h] [bp-4h]@2 | |
148 | |
149 v8 = 50; | |
150 v0 = 50; | |
151 v1 = 0; | |
152 do | |
153 { | |
154 v9 = 0; | |
155 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
156 do | |
157 { | |
158 if ( v9 ) | |
159 { | |
160 switch ( v9 ) | |
161 { | |
162 case 1: | |
163 v0 = pParty->pPlayers[v1].uIntelligence; | |
164 break; | |
165 case 2: | |
166 v0 = pParty->pPlayers[v1].uWillpower; | |
167 break; | |
168 case 3: | |
169 v0 = pParty->pPlayers[v1].uEndurance; | |
170 break; | |
171 case 4: | |
172 v0 = pParty->pPlayers[v1].uAccuracy; | |
173 break; | |
174 case 5: | |
175 v0 = pParty->pPlayers[v1].uSpeed; | |
176 break; | |
177 case 6: | |
178 v0 = pParty->pPlayers[v1].uLuck; | |
179 break; | |
180 } | |
181 } | |
182 else | |
183 { | |
184 v0 = pParty->pPlayers[v1].uMight; | |
185 } | |
186 v3 = v2 + v9; | |
290 | 187 v4 = StatTable[0][v3].uBaseValue; |
0 | 188 if ( v0 >= v4 ) |
189 { | |
290 | 190 v5 = StatTable[0][v3].uDroppedStep; |
191 v6 = StatTable[0][v3].uBaseStep; | |
0 | 192 } |
193 else | |
194 { | |
290 | 195 v5 = StatTable[0][v3].uBaseStep; |
196 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 197 } |
198 v8 += v5 * (v4 - v0) / v6; | |
199 ++v9; | |
200 } | |
201 while ( v9 <= 6 ); | |
202 ++v1; | |
203 } | |
204 while ( v1 < 4 ); | |
205 return v8; | |
206 } | |
207 | |
208 | |
209 | |
210 //----- (00427730) -------------------------------------------------------- | |
211 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
212 { | |
488 | 213 if (sMana >= uRequiredMana) |
214 { | |
215 sMana -= uRequiredMana; | |
216 return true; | |
217 } | |
218 | |
219 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
220 return false; | |
0 | 221 } |
222 | |
223 | |
224 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 225 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
226 { | |
0 | 227 float v6; // ST04_4@1 |
1014 | 228 signed int item_value; // eax@1 |
229 signed int sell_price; // ebx@1 | |
230 | |
231 item_value =pOwnItems[item_index].GetValue(); | |
232 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
233 sell_price = GetPriceSell(item_value, v6); | |
234 if ( pOwnItems[item_index].Broken() ) | |
235 sell_price = 1; | |
236 if ( sell_price < 1 ) | |
237 sell_price = 1; | |
238 RemoveItemAtInventoryIndex(inventory_idnx); | |
239 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 240 } |
241 | |
242 | |
243 | |
244 //----- (0043EEF3) -------------------------------------------------------- | |
245 bool Player::_43EEF3() | |
246 { | |
1014 | 247 signed int item_idx; // esi@1 |
248 signed int item_id; // esi@1 | |
249 for (int i=0; i<16;++i) | |
250 { | |
251 item_idx=pEquipment.pIndices[i]; | |
252 if (item_idx) | |
253 { | |
254 item_id=pOwnItems[item_idx-1].uItemID; | |
255 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
256 return false; | |
257 } | |
258 } | |
259 return true; | |
260 } | |
261 | |
0 | 262 |
263 | |
264 | |
265 //----- (004B8040) -------------------------------------------------------- | |
266 int Player::_4B8040_condition_time(unsigned int uCondition) | |
267 { | |
268 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
269 } | |
270 | |
271 //----- (004B807C) -------------------------------------------------------- | |
272 int Player::_4B807C(float a2) | |
273 { | |
274 Player *v2; // edi@1 | |
275 unsigned int v3; // eax@1 | |
276 int v4; // esi@1 | |
277 unsigned int v5; // ebx@7 | |
278 int v6; // eax@8 | |
279 signed __int64 v7; // qax@13 | |
280 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
281 signed int v10; // [sp+8h] [bp-8h]@4 | |
282 int v11; // [sp+Ch] [bp-4h]@6 | |
283 | |
284 v2 = this; | |
285 v3 = GetMajorConditionIdx(); | |
286 v4 = 0; | |
287 if ( (signed int)v3 >= 14 ) | |
288 { | |
289 if ( (signed int)v3 <= 15 ) | |
290 { | |
291 v10 = 5; | |
292 v9 = v3; | |
293 goto LABEL_6; | |
294 } | |
295 if ( v3 == 16 ) | |
296 { | |
297 v10 = 10; | |
298 v9 = 16; | |
299 LABEL_6: | |
300 v11 = _4B8040_condition_time(v9); | |
301 goto LABEL_13; | |
302 } | |
303 } | |
304 v10 = 1; | |
305 v5 = 0; | |
306 do | |
307 { | |
308 v6 = _4B8040_condition_time(v5); | |
309 if ( v6 > v4 ) | |
310 v4 = v6; | |
311 ++v5; | |
312 } | |
313 while ( (signed int)v5 <= 13 ); | |
314 v11 = v4; | |
315 if ( !v4 ) | |
316 v11 = 1; | |
317 LABEL_13: | |
318 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
319 if ( (signed int)v7 < 1 ) | |
320 LODWORD(v7) = 1; | |
321 return v7; | |
322 } | |
323 | |
324 //----- (004B8102) -------------------------------------------------------- | |
917 | 325 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 326 { |
327 signed int v3; // esi@1 | |
328 signed int result; // eax@3 | |
329 | |
917 | 330 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
331 if ( v3 > uRealValue ) | |
332 v3 = uRealValue; | |
0 | 333 result = 1; |
334 if ( v3 >= 1 ) | |
335 result = v3; | |
336 return result; | |
337 } | |
338 | |
339 //----- (004B8142) -------------------------------------------------------- | |
749 | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
341 { | |
342 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
343 assert (price > 0); | |
344 | |
345 if (price < uRealValue) | |
346 price = uRealValue; | |
347 return price; | |
0 | 348 } |
349 | |
350 //----- (004B8179) -------------------------------------------------------- | |
916 | 351 int Player::GetPriceIdentification(float a2) |
0 | 352 { |
353 signed int v2; // esi@1 | |
354 int v3; // ecx@1 | |
355 signed int result; // eax@3 | |
356 | |
357 v2 = (signed __int64)(a2 * 50.0); | |
358 v3 = v2 * (100 - GetMerchant()) / 100; | |
359 if ( v3 < v2 / 3 ) | |
360 v3 = v2 / 3; | |
361 result = 1; | |
362 if ( v3 >= 1 ) | |
363 result = v3; | |
364 return result; | |
365 } | |
366 | |
367 //----- (004B81C3) -------------------------------------------------------- | |
916 | 368 int Player::GetPriceRepair(int a2, float a3) |
0 | 369 { |
370 signed int v3; // esi@1 | |
371 int v4; // ecx@1 | |
372 signed int result; // eax@3 | |
373 | |
374 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
375 v4 = v3 * (100 - GetMerchant()) / 100; | |
376 if ( v4 < v3 / 3 ) | |
377 v4 = v3 / 3; | |
378 result = 1; | |
379 if ( v4 >= 1 ) | |
380 result = v4; | |
381 return result; | |
382 } | |
383 | |
384 //----- (004B8213) -------------------------------------------------------- | |
385 int Player::_4B8213(int a2, float a3) | |
386 { | |
387 signed __int64 v3; // qax@1 | |
388 | |
389 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
390 if ( (signed int)v3 < 1 ) | |
391 LODWORD(v3) = 1; | |
392 return v3; | |
393 } | |
394 | |
395 //----- (004B8233) -------------------------------------------------------- | |
396 int Player::_4B8233(int a2, float a3) | |
397 { | |
398 signed __int64 v3; // qax@1 | |
399 | |
400 v3 = (signed __int64)((double)a2 * a3); | |
401 if ( (signed int)v3 < 1 ) | |
402 LODWORD(v3) = 1; | |
403 return v3; | |
404 } | |
405 | |
406 //----- (004B824B) -------------------------------------------------------- | |
407 int Player::_4B824B(float a2) | |
408 { | |
409 signed __int64 v2; // qax@1 | |
410 | |
411 v2 = (signed __int64)(a2 * 50.0); | |
412 if ( (signed int)v2 < 1 ) | |
413 LODWORD(v2) = 1; | |
414 return v2; | |
415 } | |
416 | |
417 //----- (004B8265) -------------------------------------------------------- | |
418 int Player::_4B8265(int a2, float a3) | |
419 { | |
420 signed __int64 v3; // qax@1 | |
421 | |
422 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
423 if ( (signed int)v3 < 1 ) | |
424 LODWORD(v3) = 1; | |
425 return v3; | |
426 } | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 //----- (004B6FF9) -------------------------------------------------------- | |
433 int Player::_4B6FF9() | |
434 { | |
435 Player *v1; // esi@1 | |
436 signed int v2; // eax@1 | |
437 char v3; // zf@4 | |
438 | |
439 v1 = this; | |
336 | 440 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 441 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 442 { |
443 if ( GetMajorConditionIdx() == 18 ) | |
444 goto LABEL_6; | |
445 v3 = GetMajorConditionIdx() == 17; | |
446 } | |
447 else | |
448 { | |
449 v3 = GetMajorConditionIdx() == 18; | |
450 } | |
451 if ( !v3 ) | |
452 return 1; | |
453 LABEL_6: | |
454 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
455 return 1; | |
456 return 0; | |
457 } | |
458 | |
459 | |
460 | |
461 //----- (00421E75) -------------------------------------------------------- | |
1012 | 462 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
463 { | |
464 int item_idx; // eax@1 | |
465 int inv_index; // eax@3 | |
466 | |
467 item_idx = *pitem_index; | |
468 if ( item_idx >125 || item_idx < 0 ) | |
469 { | |
470 return 0; | |
471 } | |
472 | |
473 inv_index = this->pInventoryIndices[item_idx]; | |
474 if ( inv_index < 0 ) | |
475 { | |
476 *pitem_index = -1 - inv_index; | |
477 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
478 } | |
479 | |
480 return inv_index; | |
0 | 481 } |
482 | |
483 | |
484 | |
485 //----- (004160CA) -------------------------------------------------------- | |
1012 | 486 void Player::ItemsEnchant( int enchant_count ) |
487 { | |
488 int avalible_items; // ebx@1 | |
489 int i; // edx@8 | |
490 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
491 | |
492 avalible_items = 0; | |
493 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
494 | |
495 for (i=0; i<138; ++i) | |
496 { | |
497 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
498 item_index_tabl[avalible_items++] = i; | |
499 } | |
500 | |
501 if ( avalible_items ) | |
502 { | |
503 if ( enchant_count ) | |
504 { | |
505 for ( i = 0; i < enchant_count; ++i ) | |
0 | 506 { |
1012 | 507 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
508 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 509 } |
1012 | 510 |
0 | 511 } |
512 else | |
513 { | |
1012 | 514 for ( i = 0; i < avalible_items; ++i ) |
515 { | |
516 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
517 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
518 } | |
519 } | |
520 } | |
521 ; | |
0 | 522 } |
523 | |
524 //----- (004948B1) -------------------------------------------------------- | |
187 | 525 void Player::PlaySound(PlayerSpeech speech, int a3) |
526 { | |
527 //Player *pPlayer; // edi@1 | |
528 //int v4; // eax@4 | |
0 | 529 signed int v5; // esi@4 |
203 | 530 unsigned char *v6; // ebx@4 |
0 | 531 signed int v7; // ecx@5 |
532 unsigned __int8 v8; // al@6 | |
533 int v9; // eax@10 | |
187 | 534 //unsigned int pVoiceID; // ecx@10 |
0 | 535 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
536 //signed int v12; // eax@11 |
0 | 537 signed int v13; // esi@12 |
538 int v14; // eax@12 | |
187 | 539 //int v15; // eax@17 |
248 | 540 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 541 signed int v17; // ecx@19 |
542 char *pSoundID; // edi@20 | |
543 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 544 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 545 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
546 int pSoundId; // [sp+30h] [bp+8h]@4 | |
547 | |
187 | 548 //pPlayer = this; |
549 //pPlayer2 = this; | |
550 | |
0 | 551 pPlayerNum = 1; |
187 | 552 for (int i = 0; i < 4; ++i) |
553 if (&pParty->pPlayers[i] == this) | |
554 { | |
555 pPlayerNum = i + 1; | |
0 | 556 break; |
187 | 557 } |
558 | |
559 //v4 = a2;//102 | |
0 | 560 v5 = 0; |
561 pSoundId = 0; | |
203 | 562 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
563 if (uVoicesVolumeMultiplier) | |
0 | 564 { |
565 v7 = 0; | |
566 do | |
567 { | |
568 v8 = v6[v7]; | |
569 if ( v8 ) | |
570 v20[v5++] = v8; | |
571 ++v7; | |
572 } | |
573 while ( v7 < 2 ); | |
574 if ( v5 ) | |
575 { | |
576 v9 = rand(); | |
187 | 577 //pVoiceID = uVoiceID; |
0 | 578 v11 = v20[v9 % v5]; |
203 | 579 |
580 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
581 { | |
582 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
583 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 584 } |
585 } | |
586 } | |
203 | 587 |
0 | 588 v13 = 0; |
589 v14 = (int)(v6 + 3); | |
590 do | |
591 { | |
592 if ( *(char *)v14 ) | |
593 v20[v13++] = *(char *)v14; | |
594 ++v14; | |
595 } | |
596 while ( -3 - (signed int)v6 + v14 < 5 ); | |
597 if ( v13 ) | |
598 { | |
599 pPlayerNum = 0; | |
248 | 600 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
601 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 602 { |
603 v17 = 0; | |
764 | 604 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 605 { |
606 LABEL_23: | |
607 v17 = 0; | |
608 } | |
609 else | |
610 { | |
611 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
612 while ( *(int *)pSoundID != pSoundId ) | |
613 { | |
614 ++v17; | |
615 pSoundID += 120; | |
764 | 616 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 617 goto LABEL_23; |
618 } | |
619 } | |
620 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
621 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
622 } | |
248 | 623 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 624 } |
625 //return v14; | |
0 | 626 } |
627 // 4948B1: using guessed type int var_1C[5]; | |
628 | |
629 //----- (00494A25) -------------------------------------------------------- | |
187 | 630 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
631 { | |
632 //signed int v3; // eax@1 | |
633 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 634 signed int v5; // edi@15 |
635 PlayerFrame *v6; // esi@17 | |
636 signed int v7; // eax@20 | |
637 | |
187 | 638 //LOWORD(v3) = this->expression; |
639 //v4 = expr; | |
640 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
641 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
642 { | |
643 int v3 = (unsigned)expression; | |
0 | 644 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
645 { | |
646 if ( v3 <= 7 ) | |
647 goto LABEL_12; | |
648 if ( v3 > 8 ) | |
649 { | |
650 if ( v3 > 11 ) | |
651 { | |
1014 | 652 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 653 return; |
0 | 654 goto LABEL_15; |
655 } | |
656 LABEL_12: | |
187 | 657 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
658 return; | |
0 | 659 goto LABEL_15; |
660 } | |
661 } | |
662 } | |
663 LABEL_15: | |
187 | 664 //LOWORD(v3) = a3; |
0 | 665 v5 = 0; |
666 this->uExpressionTimeLength = a3; | |
667 this->uExpressionTimePassed = 0; | |
668 if ( !a3 ) | |
669 { | |
670 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
671 { | |
672 LABEL_20: | |
673 v7 = 0; | |
674 } | |
675 else | |
676 { | |
677 v6 = pPlayerFrameTable->pFrames; | |
187 | 678 while ( v6->expression != new_expression ) |
0 | 679 { |
680 ++v5; | |
681 ++v6; | |
682 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
683 goto LABEL_20; | |
684 } | |
685 v7 = v5; | |
686 } | |
187 | 687 //v4 = expr; |
688 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
689 } | |
690 expression = new_expression; | |
0 | 691 viewparams->bRedrawGameUI = 1; |
692 } | |
693 | |
694 //----- (0049327B) -------------------------------------------------------- | |
695 int Player::_49327B(unsigned int uClass, int a3) | |
696 { | |
697 Player *v3; // esi@1 | |
698 char v4; // zf@4 | |
699 __int16 v5; // dx@9 | |
700 signed int result; // eax@84 | |
701 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
702 int v8; // [sp-4h] [bp-Ch]@3 | |
703 | |
704 v3 = this; | |
135 | 705 if ( this->classType == uClass ) |
0 | 706 { |
707 LABEL_84: | |
708 result = 1; | |
709 } | |
710 else | |
711 { | |
712 switch ( uClass ) | |
713 { | |
714 case 0u: | |
715 v8 = a3; | |
716 v7 = 1; | |
717 goto LABEL_4; | |
718 case 1u: | |
484 | 719 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 720 || _49327B(2u, a3) ) |
721 goto LABEL_84; | |
722 v8 = a3; | |
723 v7 = 3; | |
724 goto LABEL_4; | |
725 case 2u: | |
726 v5 = 19; | |
727 goto LABEL_82; | |
728 case 3u: | |
729 v5 = 21; | |
730 goto LABEL_82; | |
731 case 4u: | |
732 v8 = a3; | |
733 v7 = 5; | |
734 goto LABEL_4; | |
735 case 5u: | |
484 | 736 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 737 || _49327B(6u, a3) ) |
738 goto LABEL_84; | |
739 v8 = a3; | |
740 v7 = 7; | |
741 goto LABEL_4; | |
742 case 6u: | |
743 if ( !a3 ) | |
744 break; | |
745 v5 = 13; | |
746 goto LABEL_82; | |
747 case 7u: | |
748 if ( !a3 ) | |
749 break; | |
750 v5 = 15; | |
751 goto LABEL_82; | |
752 case 8u: | |
753 v8 = a3; | |
754 v7 = 9; | |
755 goto LABEL_4; | |
756 case 9u: | |
484 | 757 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 758 || _49327B(0xAu, a3) ) |
759 goto LABEL_84; | |
760 v8 = a3; | |
761 v7 = 11; | |
762 goto LABEL_4; | |
763 case 0xAu: | |
764 if ( !a3 ) | |
765 break; | |
766 v5 = 25; | |
767 goto LABEL_82; | |
768 case 0xBu: | |
769 if ( !a3 ) | |
770 break; | |
771 v5 = 27; | |
772 goto LABEL_82; | |
773 case 0xCu: | |
774 v8 = a3; | |
775 v7 = 13; | |
776 goto LABEL_4; | |
777 case 0xDu: | |
484 | 778 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 779 || _49327B(0xEu, a3) ) |
780 goto LABEL_84; | |
781 v8 = a3; | |
782 v7 = 15; | |
783 goto LABEL_4; | |
784 case 0xEu: | |
785 if ( !a3 ) | |
786 break; | |
787 v5 = 43; | |
788 goto LABEL_82; | |
789 case 0xFu: | |
790 if ( !a3 ) | |
791 break; | |
792 v5 = 45; | |
793 goto LABEL_82; | |
794 case 0x10u: | |
795 v8 = a3; | |
796 v7 = 17; | |
797 goto LABEL_4; | |
798 case 0x11u: | |
484 | 799 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 800 || _49327B(0x12u, a3) ) |
801 goto LABEL_84; | |
802 v8 = a3; | |
803 v7 = 19; | |
804 goto LABEL_4; | |
805 case 0x12u: | |
806 if ( !a3 ) | |
807 break; | |
808 v5 = 37; | |
809 goto LABEL_82; | |
810 case 0x13u: | |
811 v5 = 39; | |
812 goto LABEL_82; | |
813 case 0x14u: | |
814 v8 = a3; | |
815 v7 = 21; | |
816 goto LABEL_4; | |
817 case 0x15u: | |
484 | 818 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 819 || _49327B(0x16u, a3) ) |
820 goto LABEL_84; | |
821 v8 = a3; | |
822 v7 = 23; | |
823 goto LABEL_4; | |
824 case 0x16u: | |
825 if ( !a3 ) | |
826 break; | |
827 v5 = 31; | |
828 goto LABEL_82; | |
829 case 0x17u: | |
830 if ( !a3 ) | |
831 break; | |
832 v5 = 33; | |
833 goto LABEL_82; | |
834 case 0x18u: | |
835 if ( !_49327B(0x19u, a3) ) | |
836 goto LABEL_56; | |
837 break; | |
838 case 0x19u: | |
839 LABEL_56: | |
484 | 840 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 841 || _49327B(0x1Au, a3) ) |
842 goto LABEL_84; | |
843 v8 = a3; | |
844 v7 = 27; | |
845 goto LABEL_4; | |
846 case 0x1Au: | |
847 if ( !a3 ) | |
848 break; | |
849 v5 = 65; | |
850 goto LABEL_82; | |
851 case 0x1Bu: | |
852 if ( !a3 ) | |
853 break; | |
854 v5 = 67; | |
855 goto LABEL_82; | |
856 case 0x1Cu: | |
857 v8 = a3; | |
858 v7 = 29; | |
859 goto LABEL_4; | |
860 case 0x1Du: | |
484 | 861 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 862 || _49327B(0x1Eu, a3) ) |
863 goto LABEL_84; | |
864 v8 = a3; | |
865 v7 = 31; | |
866 goto LABEL_4; | |
867 case 0x1Eu: | |
868 if ( !a3 ) | |
869 break; | |
870 v5 = 71; | |
871 goto LABEL_82; | |
872 case 0x1Fu: | |
873 if ( !a3 ) | |
874 break; | |
875 v5 = 73; | |
876 goto LABEL_82; | |
877 case 0x20u: | |
878 v8 = a3; | |
879 v7 = 33; | |
880 goto LABEL_4; | |
881 case 0x21u: | |
484 | 882 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 883 || _49327B(0x22u, a3) ) |
884 goto LABEL_84; | |
885 v8 = a3; | |
886 v7 = 35; | |
887 LABEL_4: | |
888 v4 = _49327B(v7, v8) == 0; | |
889 goto LABEL_83; | |
890 case 0x22u: | |
891 if ( !a3 ) | |
892 break; | |
893 v5 = 77; | |
894 goto LABEL_82; | |
895 case 0x23u: | |
896 if ( a3 ) | |
897 { | |
898 v5 = 79; | |
899 LABEL_82: | |
484 | 900 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 901 LABEL_83: |
902 if ( !v4 ) | |
903 goto LABEL_84; | |
904 } | |
905 break; | |
906 default: | |
907 break; | |
908 } | |
909 result = 0; | |
910 } | |
911 return result; | |
912 } | |
913 | |
914 | |
915 //----- (00492C0B) -------------------------------------------------------- | |
916 bool Player::CanAct() | |
917 { | |
918 bool result; // eax@2 | |
919 | |
920 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
921 result = 0; | |
922 else | |
923 result = 1; | |
924 return result; | |
925 } | |
926 | |
927 //----- (00492C40) -------------------------------------------------------- | |
928 bool Player::CanSteal() | |
929 { | |
930 int v1; // eax@1 | |
931 | |
932 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
933 return v1 != 0; | |
934 } | |
935 | |
936 //----- (00492C4E) -------------------------------------------------------- | |
937 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
938 { | |
939 char v2; // zf@9 | |
940 __int16 v4; // dx@13 | |
941 char v5; // zf@15 | |
942 | |
943 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
944 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
945 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
946 { | |
947 if ( uItemID == 533 ) | |
948 { | |
949 v2 = GetRace() == 1; | |
950 } | |
951 else | |
952 { | |
953 if ( uItemID != 534 ) | |
954 { | |
955 if ( uItemID == 535 ) // | |
956 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
957 { | |
958 switch ( this->uVoiceID ) | |
959 { | |
960 default: | |
961 return 1; | |
962 case 4u: | |
963 case 5u: | |
964 case 6u: | |
965 case 7u: | |
966 case 0xAu: | |
967 case 0xBu: | |
968 case 0xEu: // | |
969 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
970 case 0xFu: | |
971 case 0x12u: | |
972 case 0x13u: | |
973 case 0x15u: | |
974 case 0x18u: | |
975 return 0; | |
976 } | |
977 return 0; | |
978 } | |
979 if ( uItemID == 536 ) // | |
980 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
981 { | |
982 switch ( this->uVoiceID ) | |
983 { | |
984 case 4u: | |
985 case 5u: | |
986 case 6u: | |
987 case 7u: | |
988 case 0xAu: | |
989 case 0xBu: | |
990 case 0xEu: | |
991 case 0xFu: | |
992 case 0x12u: | |
993 case 0x13u: | |
994 case 0x15u: | |
995 case 0x18u: | |
996 return 1; | |
997 default: | |
998 return 0; | |
999 } | |
1000 return 0; | |
1001 } | |
1002 if ( uItemID != 604 ) // | |
1003 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1004 return 1; | |
1005 v5 = _43EEF3() == 0; | |
1006 goto LABEL_23; | |
1007 } | |
1008 v2 = GetRace() == 3; // | |
1009 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1010 } | |
1011 } | |
1012 else | |
1013 { | |
1014 if ( uItemID != 532 ) | |
1015 { | |
1016 if ( uItemID != 515 && uItemID != 517 ) // | |
1017 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1018 { | |
1019 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1020 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1021 { | |
1022 LABEL_13: | |
1023 v4 = 99; | |
1024 LABEL_15: | |
484 | 1025 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1026 LABEL_23: |
1027 if ( !v5 ) | |
1028 return 1; | |
1029 return 0; | |
1030 } | |
1031 if ( uItemID != 525 ) | |
1032 { | |
1033 if ( uItemID != 527 ) | |
1034 { | |
1035 if ( uItemID != 531 ) | |
1036 return 1; | |
1037 v2 = GetRace() == 2; | |
1038 goto LABEL_10; | |
1039 } | |
1040 goto LABEL_13; | |
1041 } | |
1042 } | |
1043 v4 = 100; | |
1044 goto LABEL_15; | |
1045 } | |
1046 v2 = GetRace() == 0; | |
1047 } | |
1048 LABEL_10: | |
1049 if ( v2 ) | |
1050 return 1; | |
1051 return 0; | |
1052 } | |
1053 | |
1054 //----- (00492D65) -------------------------------------------------------- | |
1055 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1056 { |
1057 | |
1058 signed int player_sex; // ecx@77 | |
1059 char zombi_face; // al@80 | |
1060 signed int remainig_player; // ebx@82 | |
1061 int players_before; // [sp+10h] [bp-4h]@2 | |
1062 int players_after; // [sp+20h] [bp+Ch]@82 | |
1063 | |
1064 if ( pConditions[uConditionIdx] ) | |
1065 return 0; | |
1066 players_before = 0; | |
1067 for (int i=1;i<5;++i) | |
1068 if ( pPlayers[i]->CanAct() ) | |
1069 ++players_before; | |
1070 | |
0 | 1071 switch ( uConditionIdx ) |
1014 | 1072 { |
1073 case Condition_Cursed: | |
1074 PlaySound((PlayerSpeech)30, 0); | |
1075 break; | |
1076 case Condition_Weak: | |
0 | 1077 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) |
1014 | 1078 {--pParty->pPartyBuffs[13].uPower; |
1079 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1080 pParty->pPartyBuffs[13].Reset(); | |
1081 return 0; | |
1082 } | |
1083 | |
1084 PlaySound((PlayerSpeech)25, 0); | |
1085 break; | |
1086 case Condition_Sleep: | |
1087 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) | |
1088 return 0; | |
1089 break; | |
1090 | |
1091 case Condition_Fear: | |
1092 PlaySound((PlayerSpeech)26, 0); | |
1093 break; | |
1094 case Condition_Drunk: | |
1095 PlaySound((PlayerSpeech)31, 0); | |
1096 break; | |
1097 | |
1098 case Condition_Insane: | |
0 | 1099 if ( a3 == 1 |
1014 | 1100 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) |
1101 return 0; | |
1102 | |
1103 PlaySound((PlayerSpeech)29, 0); | |
1104 break; | |
1105 case Condition_Poison1: | |
1106 case Condition_Poison2: | |
1107 case Condition_Poison3: | |
1108 if ( a3 == 1 ) | |
1109 { | |
1110 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1111 { | |
1112 --pParty->pPartyBuffs[13].uPower; | |
1113 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1114 pParty->pPartyBuffs[13].Reset(); | |
1115 } | |
1116 if ( HasEnchantedItemEquipped(21) | |
1117 || WearsItem(505, 3) | |
1118 || WearsItem(530, 6) ) | |
1119 //goto LABEL_76; | |
1120 return 0; | |
1121 } | |
1122 | |
1123 //v23 = 27; | |
1124 PlaySound((PlayerSpeech)27, 0); | |
1125 break; | |
1126 | |
1127 case Condition_Disease1: | |
1128 case Condition_Disease2: | |
1129 case Condition_Disease3: | |
0 | 1130 if ( a3 == 1 ) |
1014 | 1131 { |
1132 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1133 { | |
1134 --pParty->pPartyBuffs[13].uPower; | |
1135 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1136 pParty->pPartyBuffs[13].Reset(); | |
1137 return 0; | |
1138 } | |
1139 | |
1140 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) | |
1141 return 0; | |
1142 } | |
1143 PlaySound((PlayerSpeech)28, 0); | |
1144 break; | |
1145 case Condition_Paralyzed: | |
1146 if ( a3 == 1 ) | |
1147 { | |
1148 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1149 { | |
1150 --pParty->pPartyBuffs[13].uPower; | |
1151 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1152 pParty->pPartyBuffs[13].Reset(); | |
1153 return 0; | |
1154 } | |
1155 | |
1156 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) | |
1157 return 0; | |
1158 } | |
1159 break; | |
1160 case Condition_Unconcious: | |
1161 PlaySound(SPEECH_32, 0); | |
1162 if ( sHealth > 0 ) | |
1163 sHealth = 0; | |
1164 break; | |
1165 case Condition_Dead: | |
1166 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1167 { | |
0 | 1168 --pParty->pPartyBuffs[13].uPower; |
1169 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1014 | 1170 pParty->pPartyBuffs[13].Reset(); |
1171 } | |
1172 | |
1173 PlaySound((PlayerSpeech)33, 0); | |
1174 if ( sHealth > 0 ) | |
1175 sHealth = 0; | |
1176 if ( sMana > 0 ) | |
1177 sMana = 0; | |
1178 break; | |
1179 case Condition_Pertified: | |
0 | 1180 if ( a3 == 1 |
1014 | 1181 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) |
1182 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) | |
1183 | |
1184 return 0; | |
1185 PlaySound((PlayerSpeech)34, 0); | |
1186 break; | |
1187 case Condition_Eradicated: | |
1188 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u )) | |
1189 { | |
1190 --pParty->pPartyBuffs[13].uPower; | |
1191 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1192 pParty->pPartyBuffs[13].Reset(); | |
1193 return 0; | |
1194 } | |
1195 PlaySound(SPEECH_35, 0); | |
1196 if (sHealth > 0 ) | |
1197 sHealth = 0; | |
1198 if ( sMana > 0 ) | |
1199 sMana = 0; | |
1200 break; | |
1201 case Condition_Zombie: | |
1202 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1203 return 0; | |
1204 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1205 sHealth = GetMaxHealth(); | |
1206 sMana = 0; | |
1207 player_sex = 0; | |
1208 uPrevFace = uCurrentFace; | |
1209 uPrevVoiceID = uVoiceID; | |
1210 switch ( uVoiceID ) | |
1211 { | |
1212 case 0: | |
1213 case 1: | |
1214 case 2: | |
1215 case 3: | |
1216 case 8: | |
1217 case 9: | |
1218 case 12: | |
1219 case 13: | |
1220 case 16: | |
1221 case 17: | |
1222 case 20: | |
1223 case 23: | |
1224 player_sex = 0; | |
1225 break; | |
1226 case 4: | |
1227 case 5: | |
1228 case 6: | |
1229 case 7: | |
1230 case 10: | |
1231 case 11: | |
1232 case 14: | |
1233 case 15: | |
1234 case 18: | |
1235 case 19: | |
1236 case 21: | |
1237 case 24: | |
1238 player_sex = 1; | |
1239 break; | |
1240 default: | |
1241 break; | |
1242 } | |
1243 | |
1244 zombi_face = (player_sex != 0) + 23; | |
1245 uCurrentFace = zombi_face; | |
1246 uVoiceID = zombi_face; | |
1247 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1248 break; | |
0 | 1249 } |
1014 | 1250 |
1251 remainig_player = 0; | |
1252 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1253 players_after = 0; | |
1254 for (int i=1;i<5;++i) | |
0 | 1255 { |
1014 | 1256 |
1257 | |
1258 if ( pPlayers[i]->CanAct() ) | |
1259 { | |
1260 remainig_player=i; | |
1261 ++players_after; | |
1262 } | |
0 | 1263 } |
1014 | 1264 if (( players_before == 2 )&&( players_after == 1 )) |
1265 { | |
1266 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1267 } | |
1268 return 1; | |
1269 } | |
0 | 1270 |
1271 //----- (00492528) -------------------------------------------------------- | |
1272 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1273 { | |
973 | 1274 //unsigned int v3; // eax@1 |
0 | 1275 Texture *v4; // esi@1 |
1276 unsigned int v5; // ebx@1 | |
1277 signed int v6; // edi@5 | |
1278 int *v7; // ecx@6 | |
1279 signed int v8; // edx@7 | |
1280 int *v9; // eax@8 | |
973 | 1281 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1282 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1283 | |
973 | 1284 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1285 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1286 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1287 if ( !areWeLoadingTexture ) | |
1288 { | |
1289 v4->Release(); | |
1006 | 1290 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1291 } |
1292 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1293 { | |
1294 v6 = 0; | |
1295 if ( (signed int)uItemIDa <= 0 ) | |
1296 return 1; | |
973 | 1297 v7 = &pInventoryIndices[uSlot]; |
0 | 1298 while ( 1 ) |
1299 { | |
1300 v8 = 0; | |
1301 if ( (signed int)v5 > 0 ) | |
1302 break; | |
1303 LABEL_11: | |
1304 ++v6; | |
1305 v7 += 14; | |
1306 if ( v6 >= (signed int)uItemIDa ) | |
1307 return 1; | |
1308 } | |
1309 v9 = v7; | |
1310 while ( !*v9 ) | |
1311 { | |
1312 ++v8; | |
1313 ++v9; | |
1314 if ( v8 >= (signed int)v5 ) | |
1315 goto LABEL_11; | |
1316 } | |
1317 } | |
1318 return 0; | |
1319 } | |
1320 // 506128: using guessed type int areWeLoadingTexture; | |
1321 | |
1322 //----- (004925E6) -------------------------------------------------------- | |
1323 unsigned int Player::FindFreeInventorySlot() | |
1324 { | |
1325 unsigned int result; // eax@1 | |
1326 ItemGen *v2; // ecx@1 | |
1327 | |
1328 result = 0; | |
1329 v2 = this->pInventoryItems; | |
1330 while ( v2->uItemID ) | |
1331 { | |
1332 ++result; | |
1333 ++v2; | |
1334 if ( (signed int)result >= 126 ) | |
1335 return -1; | |
1336 } | |
1337 return result; | |
1338 } | |
1339 | |
1340 //----- (00492600) -------------------------------------------------------- | |
1341 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1342 { | |
1343 signed int v3; // edx@1 | |
1344 ItemGen *v4; // eax@1 | |
1345 int result; // eax@8 | |
1346 unsigned int v6; // ebx@10 | |
973 | 1347 //unsigned int v7; // eax@10 |
0 | 1348 Texture *v8; // esi@10 |
1349 void *v9; // esi@13 | |
1350 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1351 Player *v11; // [sp+4h] [bp-8h]@1 | |
1352 signed int v12; // [sp+8h] [bp-4h]@4 | |
1353 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1354 | |
1355 v11 = this; | |
1356 v3 = 0; | |
1357 v4 = this->pInventoryItems; | |
1358 while ( v4->uItemID ) | |
1359 { | |
1360 ++v3; | |
1361 ++v4; | |
1362 if ( v3 >= 126 ) | |
1363 { | |
1364 v12 = -1; | |
1365 goto LABEL_5; | |
1366 } | |
1367 } | |
1368 v12 = v3; | |
1369 LABEL_5: | |
1370 if ( v12 == -1 ) | |
1371 { | |
1372 if ( uActiveCharacter ) | |
201 | 1373 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1374 result = 0; |
1375 } | |
1376 else | |
1377 { | |
1378 v6 = uItemID; | |
973 | 1379 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1380 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1381 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1382 if ( !areWeLoadingTexture ) | |
1383 { | |
1384 v8->Release(); | |
1006 | 1385 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1386 } |
1387 if ( (signed int)uItemIDa > 0 ) | |
1388 { | |
1389 v9 = &v11->pInventoryIndices[uSlot]; | |
1390 do | |
1391 { | |
1392 if ( (signed int)v10 > 0 ) | |
1393 memset32(v9, -1 - uSlot, v10); | |
1394 v9 = (char *)v9 + 56; | |
1395 --uItemIDa; | |
1396 } | |
1397 while ( uItemIDa ); | |
1398 } | |
1399 result = v12 + 1; | |
1400 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1401 v11->pInventoryItems[v12].uItemID = v6; | |
1402 } | |
1403 return result; | |
1404 } | |
1405 // 506128: using guessed type int areWeLoadingTexture; | |
1406 | |
1407 //----- (00492700) -------------------------------------------------------- | |
1408 int Player::HasSkill(unsigned int uSkillType) | |
1409 { | |
1410 signed int result; // eax@3 | |
1411 | |
1412 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1413 { | |
1414 result = 1; | |
1415 } | |
1416 else | |
1417 { | |
809 | 1418 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1419 ShowStatusBarString(pTmpBuf, 2u); |
1420 result = 0; | |
1421 } | |
1422 return result; | |
1423 } | |
1424 | |
1425 //----- (00492745) -------------------------------------------------------- | |
1426 int Player::WearItem(unsigned int uItemID) | |
1427 { | |
1010 | 1428 int item_body_anch; // edi@6 |
1429 int item_indx; | |
1430 //find empty slot | |
1431 for(item_indx=0;item_indx<126;++item_indx) | |
1432 if (pInventoryItems[item_indx].uItemID==0) | |
1433 break; | |
1434 if (item_indx==126) //not found | |
1435 item_indx=-1; | |
1436 | |
1437 if ( item_indx != -1 ) | |
1438 { | |
1439 | |
1440 pInventoryItems[item_indx].uItemID=uItemID; | |
1441 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1442 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1443 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1444 | |
0 | 1445 } |
1446 return 0; | |
1447 } | |
1448 | |
1449 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1450 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1451 { |
1452 signed int v3; // ebx@2 | |
1453 signed int v4; // edi@3 | |
1454 unsigned int v5; // esi@3 | |
1455 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1456 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1457 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1458 | |
1459 thisa = this; | |
1460 if ( uSlot == -1 ) | |
1461 { | |
1462 v3 = 0; | |
1014 | 1463 while ( true ) |
0 | 1464 { |
1465 v4 = 0; | |
1466 v5 = v3; | |
1467 do | |
1468 { | |
1469 if ( CanFitItem(v5, uItemID) ) | |
1470 { | |
1471 v8 = uItemID; | |
1472 v7 = v5; | |
1473 return CreateItemInInventory(v7, v8); | |
1474 } | |
1475 ++v4; | |
1476 v5 += 14; | |
1477 } | |
1478 while ( v4 < 9 ); | |
1479 ++v3; | |
1480 if ( v3 < 14 ) | |
1481 continue; | |
1482 break; | |
1483 } | |
1484 return 0; | |
1485 } | |
1486 if ( !CanFitItem(uSlot, uItemID) ) | |
1487 { | |
1488 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1489 return 0; | |
1490 } | |
1491 v8 = uItemID; | |
1492 v7 = uSlot; | |
1493 return CreateItemInInventory(v7, v8); | |
1494 } | |
1495 | |
1496 //----- (00492826) -------------------------------------------------------- | |
1014 | 1497 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1498 { |
1499 unsigned int v3; // ebx@1 | |
1500 unsigned int v4; // esi@3 | |
1501 signed int v5; // edi@3 | |
1502 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1503 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1504 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1505 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1506 | |
1507 thisa = this; | |
1508 v3 = Src->uItemID; | |
1509 pItemsTable->SetSpecialBonus(Src); | |
1510 if ( uSlot == -1 ) | |
1511 { | |
1512 uSlota = 0; | |
1014 | 1513 while ( true ) |
0 | 1514 { |
1515 v4 = uSlota; | |
1516 v5 = 0; | |
1517 do | |
1518 { | |
1519 if ( CanFitItem(v4, v3) ) | |
1520 { | |
1521 v8 = Src; | |
1522 v7 = v4; | |
1523 return CreateItemInInventory2(v7, v8); | |
1524 } | |
1525 ++v5; | |
1526 v4 += 14; | |
1527 } | |
1528 while ( v5 < 14 ); | |
1529 ++uSlota; | |
1530 if ( uSlota < 9 ) | |
1531 continue; | |
1532 break; | |
1533 } | |
1534 return 0; | |
1535 } | |
1536 if ( !CanFitItem(uSlot, v3) ) | |
1537 return 0; | |
1538 v8 = Src; | |
1539 v7 = uSlot; | |
1540 return CreateItemInInventory2(v7, v8); | |
1541 } | |
1542 | |
1543 //----- (0049289C) -------------------------------------------------------- | |
1544 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1545 { | |
1546 signed int v3; // ebx@1 | |
1547 ItemGen *v4; // eax@1 | |
1548 int result; // eax@6 | |
973 | 1549 //unsigned int v6; // eax@7 |
1014 | 1550 Texture *item_texture; // esi@7 |
0 | 1551 unsigned int v8; // edx@9 |
1014 | 1552 int *pInvPos; // esi@10 |
1553 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1554 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1555 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1556 |
0 | 1557 |
1558 v12 = this; | |
1559 v3 = 0; | |
1560 v4 = this->pInventoryItems; | |
1561 while ( v4->uItemID ) | |
1562 { | |
1563 ++v3; | |
1564 ++v4; | |
1565 if ( v3 >= 126 ) | |
1566 { | |
1567 v3 = -1; | |
1568 break; | |
1569 } | |
1570 } | |
1571 if ( v3 == -1 ) | |
1572 { | |
1573 result = 0; | |
1574 } | |
1575 else | |
1576 { | |
1014 | 1577 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1578 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1579 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1580 if ( !areWeLoadingTexture ) |
1581 { | |
1014 | 1582 item_texture->Release(); |
1006 | 1583 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1584 } |
1014 | 1585 if ( slot_height > 0 ) |
1586 { | |
1587 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1588 do |
1589 { | |
1014 | 1590 if ( slot_width > 0 ) |
1591 memset32(pInvPos, -1 - uSlot, slot_width); | |
1592 pInvPos +=14; | |
1593 --slot_height; | |
1594 } | |
1595 while ( slot_height ); | |
1596 } | |
1597 pInventoryIndices[uSlot] = v3 + 1; | |
1598 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1599 result = v3 + 1; |
1600 } | |
1601 return result; | |
1602 } | |
1603 // 506128: using guessed type int areWeLoadingTexture; | |
1604 | |
1605 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1606 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1607 { | |
973 | 1608 //Player *v4; // ebx@1 |
1609 //unsigned int v5; // eax@1 | |
1014 | 1610 Texture *item_texture; // esi@1 |
1611 int *pInvPos; // esi@4 | |
1612 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1613 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1614 | |
1615 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1616 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1617 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1618 if ( !areWeLoadingTexture ) |
1619 { | |
1014 | 1620 item_texture->Release(); |
1006 | 1621 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1622 } |
1014 | 1623 if ( (signed int)slot_height > 0 ) |
1624 { | |
1625 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1626 do |
1627 { | |
1014 | 1628 if ( (signed int)slot_width > 0 ) |
1629 memset32(pInvPos, -1 - uSlot, slot_width); | |
1630 pInvPos +=14; | |
1631 --slot_height; | |
1632 } | |
1633 while ( slot_height ); | |
1634 } | |
1635 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1636 return 1; |
1637 } | |
278 | 1638 |
0 | 1639 // 506128: using guessed type int areWeLoadingTexture; |
1640 | |
1641 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1642 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1643 { | |
1014 | 1644 |
1645 ItemGen *item_in_slot; // ecx@1 | |
1646 Texture *item_texture; // esi@1 | |
1647 unsigned int slot_height; // ebp@1 | |
1648 int *pInvPos; // edx@4 | |
1649 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1650 | |
1651 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1652 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1653 item_in_slot->Reset(); | |
1654 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1655 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1656 if ( !areWeLoadingTexture ) |
1657 { | |
1014 | 1658 item_texture->Release(); |
1006 | 1659 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1660 } |
1014 | 1661 if ( slot_height > 0 ) |
1662 { | |
1663 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1664 do |
1665 { | |
1014 | 1666 if (slot_width > 0 ) |
1667 memset32(pInvPos, 0, slot_width); | |
1668 pInvPos += 14; | |
1669 --slot_height; | |
1670 } | |
1671 while ( slot_height ); | |
0 | 1672 } |
1006 | 1673 |
0 | 1674 } |
1675 // 506128: using guessed type int areWeLoadingTexture; | |
1676 | |
436 | 1677 //identf |
0 | 1678 //----- (00490EEE) -------------------------------------------------------- |
917 | 1679 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1680 { | |
1681 int pSkillLevel; // eax@1 | |
1682 int NotBuy; // eax@1 | |
1683 int result; | |
1684 signed int pEquipType; // esi@1 | |
1685 float *pPriceMultiplier; // esi@26 | |
1686 int pPriceItemService; // edi@26 | |
1687 | |
1688 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1689 NotBuy = 4; | |
1690 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1691 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1692 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1693 return 5; |
917 | 1694 if ( building_type == BildingType_WeaponShop ) |
1695 { | |
1696 if ( pEquipType > EQUIP_BOW ) | |
1697 return NotBuy; | |
1698 if (pItem->Stolen()) | |
1699 return 6; | |
1700 } | |
1701 if ( building_type == BildingType_ArmorShop ) | |
1702 { | |
1703 if ( pEquipType < 3 && pEquipType > 9 ) | |
1704 return NotBuy; | |
1705 if (pItem->Stolen()) | |
1706 return 6; | |
1707 } | |
1708 if ( building_type == BildingType_MagicShop ) | |
1709 { | |
1710 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1711 { | |
1712 if (pItem->Stolen()) | |
1713 return 6; | |
1714 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1715 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1716 if ( ShopMenuType == 3 )//Sell | |
1717 { | |
1718 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1719 if (!pItem->Broken()) | |
1720 { | |
1721 if ( pSkillLevel ) | |
1722 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1723 else | |
1724 result = 1; | |
1725 return result; | |
1726 } | |
1727 pPriceItemService = 1; | |
1728 if ( pSkillLevel ) | |
1729 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1730 else | |
1731 result = 1; | |
1732 return result; | |
1733 } | |
1734 if ( ShopMenuType == 4 )//Identify | |
1735 { | |
1736 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1737 if ( pSkillLevel ) | |
1738 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1739 else | |
1740 result = 1; | |
1741 return result; | |
1742 } | |
1743 if ( ShopMenuType == 5 )//Repair | |
1744 { | |
1745 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1746 if ( pSkillLevel ) | |
1747 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1748 else | |
1749 result = 1; | |
1750 return result; | |
1751 } | |
1752 if ( ShopMenuType != 6 )//Buy and ??? | |
1753 { | |
1754 if ( pSkillLevel ) | |
1755 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1756 else | |
1757 result = 1; | |
1758 return result; | |
1759 } | |
1760 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1761 if (pItem->Broken()) | |
1762 pPriceItemService = 1; | |
1763 if ( pPriceItemService >= 1 ) | |
1764 { | |
1765 if ( pSkillLevel ) | |
1766 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1767 else | |
1768 result = 1; | |
1769 return result; | |
1770 } | |
1771 pPriceItemService = 1; | |
1772 if ( pSkillLevel ) | |
1773 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1774 else | |
1775 result = 1; | |
0 | 1776 return result; |
917 | 1777 } |
1778 if ( pEquipType != EQUIP_BOOK ) | |
1779 return NotBuy; | |
1780 } | |
1781 if ( building_type == BildingType_AlchemistShop ) | |
1782 { | |
1783 if ( pEquipType < EQUIP_REAGENT ) | |
1784 return NotBuy; | |
1785 if ( pEquipType > EQUIP_POTION ) | |
1786 { | |
1787 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1788 return NotBuy; | |
1789 } | |
1790 if (pItem->Stolen()) | |
1791 return 6; | |
1792 } | |
1793 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1794 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1795 if ( ShopMenuType == 3 )//Sell | |
1796 { | |
1797 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1798 if (!pItem->Broken()) | |
1799 { | |
1800 if ( pSkillLevel ) | |
1801 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1802 else | |
1803 result = 1; | |
0 | 1804 return result; |
917 | 1805 } |
1806 pPriceItemService = 1; | |
1807 if ( pSkillLevel ) | |
1808 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1809 else | |
1810 result = 1; | |
1811 return result; | |
1812 } | |
1813 if ( ShopMenuType == 4 )//Identify | |
1814 { | |
1815 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1816 if ( pSkillLevel ) | |
1817 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1818 else | |
1819 result = 1; | |
1820 return result; | |
1821 } | |
1822 if ( ShopMenuType == 5 )//Repair | |
1823 { | |
1824 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1825 if ( pSkillLevel ) | |
1826 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1827 else | |
1828 result = 1; | |
1829 return result; | |
1830 } | |
1831 if ( ShopMenuType != 6 )//Buy and ??? | |
1832 { | |
1833 if ( pSkillLevel ) | |
1834 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1835 else | |
1836 result = 1; | |
1837 return result; | |
1838 } | |
1839 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1840 if (pItem->Broken()) |
917 | 1841 pPriceItemService = 1; |
1842 if ( pPriceItemService >= 1 ) | |
1843 { | |
1844 if ( pSkillLevel ) | |
1845 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1846 else | |
1847 result = 1; | |
1848 return result; | |
1849 } | |
1850 pPriceItemService = 1; | |
1851 if ( pSkillLevel ) | |
1852 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1853 else |
1854 result = 1; | |
1855 return result; | |
1856 } | |
1857 | |
1858 //----- (0049107D) -------------------------------------------------------- | |
1859 int Player::GetBodybuilding() | |
1860 { | |
1010 | 1861 int v1; // al@1 |
0 | 1862 int v2; // ecx@1 |
1863 int v4; // eax@3 | |
1864 signed int v6; // [sp-4h] [bp-4h]@2 | |
1865 | |
1866 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1867 v2 = v1 & 0x3F; | |
1868 if ( v1 & 0x100 ) | |
1869 { | |
1870 v6 = 5; | |
1871 } | |
1872 else | |
1873 { | |
1008 | 1874 if ( (v1&0xFF) >= 0 ) |
0 | 1875 { |
1876 v4 = ((v1 & 0x40) != 0) + 1; | |
1877 return v2 * v4; | |
1878 } | |
1879 v6 = 3; | |
1880 } | |
1881 v4 = v6; | |
1882 return v2 * v4; | |
1883 } | |
1884 | |
1885 //----- (004910A8) -------------------------------------------------------- | |
607 | 1886 int Player::GetMeditation() |
0 | 1887 { |
1010 | 1888 int v1; // al@1 |
1008 | 1889 int base_level; // ecx@1 |
0 | 1890 int v4; // eax@3 |
1891 signed int v6; // [sp-4h] [bp-4h]@2 | |
1892 | |
1893 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1894 base_level = v1 & 0x3F; |
0 | 1895 if ( v1 & 0x100 ) |
1896 { | |
1897 v6 = 5; | |
1898 } | |
1899 else | |
1900 { | |
1008 | 1901 if ( (v1&0xFF) >= 0 ) |
0 | 1902 { |
1903 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1904 return base_level * v4; |
0 | 1905 } |
1906 v6 = 3; | |
1907 } | |
1908 v4 = v6; | |
1008 | 1909 return base_level * v4; |
0 | 1910 } |
1911 | |
1912 //----- (004910D3) -------------------------------------------------------- | |
1913 int Player::CanIdentify(ItemGen *pItem) | |
1914 { | |
1915 unsigned __int16 v2; // ax@1 | |
1916 unsigned __int16 v3; // bx@1 | |
1917 int uSkillMult; // eax@3 | |
1918 int v5; // edi@7 | |
1919 signed int v6; // ebp@7 | |
1920 char *v7; // esi@7 | |
1921 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1922 |
1923 if (CheckHiredNPCSpeciality(Scholar)) | |
1924 return true; | |
0 | 1925 |
179 | 1926 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1927 v3 = v2; |
179 | 1928 if ( v2 & 1 ) |
0 | 1929 { |
1930 uSkillMultiplier = 5; | |
1931 } | |
1932 else | |
1933 { | |
1934 if ( (v2 & 0x80u) == 0 ) | |
1935 { | |
1936 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1937 v5 = uSkillMult * (v3 & 0x3F); |
1938 v6 = 0; | |
1939 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1940 |
179 | 1941 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1942 v6 = 1; | |
1943 if ( v5 >= (unsigned __int8)v7[46] ) | |
1944 v6 = 1; | |
1945 return v6; | |
0 | 1946 } |
1947 uSkillMultiplier = 3; | |
1948 } | |
1949 uSkillMult = uSkillMultiplier; | |
1950 v5 = uSkillMult * (v3 & 0x3F); | |
1951 v6 = 0; | |
1952 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1953 |
0 | 1954 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1955 v6 = 1; | |
1956 if ( v5 >= (unsigned __int8)v7[46] ) | |
1957 v6 = 1; | |
1958 return v6; | |
1959 } | |
1960 | |
1961 //----- (00491151) -------------------------------------------------------- | |
1962 int Player::CanRepair(ItemGen *a2) | |
1963 { | |
1964 unsigned __int16 v2; // ax@1 | |
1965 unsigned __int16 v3; // bx@1 | |
1966 int v4; // eax@3 | |
1967 int v5; // edi@7 | |
1968 signed int v6; // ebp@7 | |
1969 signed int v10; // [sp-4h] [bp-14h]@2 | |
1970 | |
652 | 1971 |
1972 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1973 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1974 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1975 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1976 return true; | |
1977 | |
1010 | 1978 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1979 v3 = v2; |
1010 | 1980 if (v2 & 0x100 ) |
0 | 1981 { |
1982 v10 = 5; | |
1983 } | |
1984 else | |
1985 { | |
1986 if ( (v2 & 0x80u) == 0 ) | |
1987 { | |
1988 v4 = ((v2 & 0x40) != 0) + 1; | |
1989 goto LABEL_7; | |
1990 } | |
1991 v10 = 3; | |
1992 } | |
1993 v4 = v10; | |
1994 LABEL_7: | |
1995 v5 = v4 * (v3 & 0x3F); | |
1996 v6 = 0; | |
1997 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1998 return true; | |
1999 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2000 { | |
2001 __debugbreak(); // really odd | |
2002 return true; | |
2003 } | |
2004 return false; | |
2005 } | |
2006 | |
2007 //----- (004911F3) -------------------------------------------------------- | |
2008 int Player::GetMerchant() | |
2009 { | |
2010 Player *v1; // edi@1 | |
2011 unsigned __int16 v2; // ax@1 | |
2012 unsigned __int16 v3; // bx@1 | |
2013 int v4; // esi@1 | |
2014 int v5; // edi@1 | |
2015 int v7; // eax@3 | |
2016 int v8; // ecx@7 | |
2017 signed int v9; // [sp-4h] [bp-10h]@6 | |
2018 | |
2019 v1 = this; | |
607 | 2020 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2021 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2022 v4 = v2 & 0x003F; |
1010 | 2023 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2024 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2025 return 10000; | |
2026 v7 = GetPartyReputation(); | |
2027 if ( !v4 ) | |
2028 return -v7; | |
1010 | 2029 if ( v3 & 0x100 ) |
0 | 2030 { |
2031 v9 = 5; | |
2032 } | |
2033 else | |
2034 { | |
2035 if ( (v3 & 0x80u) == 0 ) | |
2036 { | |
2037 v8 = ((v3 & 0x40) != 0) + 1; | |
2038 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2039 } | |
2040 v9 = 3; | |
2041 } | |
2042 v8 = v9; | |
2043 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2044 } | |
2045 | |
2046 //----- (0049125A) -------------------------------------------------------- | |
2047 int Player::GetPerception() | |
2048 { | |
2049 Player *v1; // edi@1 | |
2050 unsigned __int16 v2; // ax@1 | |
2051 unsigned __int16 v3; // bx@1 | |
2052 int v4; // esi@1 | |
2053 int v5; // edi@1 | |
2054 int v7; // eax@5 | |
2055 signed int v8; // [sp-4h] [bp-10h]@4 | |
2056 | |
2057 v1 = this; | |
1010 | 2058 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2059 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2060 v4 = v2 & 0x3F; |
1010 | 2061 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2062 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2063 return 10000; | |
1010 | 2064 if ( v3 & 0x100 ) |
0 | 2065 { |
2066 v8 = 5; | |
2067 } | |
2068 else | |
2069 { | |
2070 if ( (v3 & 0x80u) == 0 ) | |
2071 { | |
2072 v7 = ((v3 & 0x40) != 0) + 1; | |
2073 return v4 + v5 * (v7 - 1); | |
2074 } | |
2075 v8 = 3; | |
2076 } | |
2077 v7 = v8; | |
2078 return v4 + v5 * (v7 - 1); | |
2079 } | |
2080 | |
2081 //----- (004912B0) -------------------------------------------------------- | |
2082 int Player::GetDisarmTrap() | |
2083 { | |
2084 Player *v1; // ebp@1 | |
2085 unsigned __int16 v2; // ax@1 | |
2086 unsigned __int16 v3; // bx@1 | |
2087 int v4; // esi@1 | |
2088 int v5; // edi@1 | |
2089 int v7; // eax@7 | |
2090 signed int v8; // [sp-4h] [bp-14h]@6 | |
2091 | |
2092 v1 = this; | |
1010 | 2093 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2094 v3 = v1->pActiveSkills[29]; |
2095 v4 = v2 & 0x3F; | |
2096 v5 = v1->pActiveSkills[29] & 0x3F; | |
2097 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2098 return 10000; | |
2099 if ( HasEnchantedItemEquipped(35) ) | |
2100 v4 *= 2; | |
1010 | 2101 if ( v3 & 0x100 ) |
0 | 2102 { |
2103 v8 = 5; | |
2104 } | |
2105 else | |
2106 { | |
2107 if ( (v3 & 0x80u) == 0 ) | |
2108 { | |
2109 v7 = ((v3 & 0x40) != 0) + 1; | |
2110 return v4 + v5 * (v7 - 1); | |
2111 } | |
2112 v8 = 3; | |
2113 } | |
2114 v7 = v8; | |
2115 return v4 + v5 * (v7 - 1); | |
2116 } | |
2117 | |
2118 //----- (00491317) -------------------------------------------------------- | |
2119 char Player::GetLearningPercent() | |
2120 { | |
2121 Player *v1; // esi@1 | |
2122 int v2; // eax@1 | |
2123 unsigned __int16 v3; // bx@1 | |
2124 int v4; // ecx@1 | |
2125 int v5; // eax@4 | |
2126 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2127 | |
2128 v1 = this; | |
1010 | 2129 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2130 v3 = v1->pActiveSkills[36]; |
2131 v4 = v2 & 0x3F; | |
2132 if ( v2 ) | |
2133 { | |
1010 | 2134 if (v3 & 0x100 ) |
0 | 2135 { |
2136 v7 = 5; | |
2137 } | |
2138 else | |
2139 { | |
2140 if ( (v3 & 0x80u) == 0 ) | |
2141 { | |
2142 v5 = ((v3 & 0x40) != 0) + 1; | |
2143 goto LABEL_8; | |
2144 } | |
2145 v7 = 3; | |
2146 } | |
2147 v5 = v7; | |
2148 LABEL_8: | |
2149 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2150 } | |
2151 return v2; | |
2152 } | |
2153 | |
2154 //----- (0048C6AF) -------------------------------------------------------- | |
2155 Player::Player() | |
2156 { | |
2157 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2158 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2159 for (uint i = 0; i < 126; ++i) | |
2160 pInventoryItems[i].Reset(); | |
2161 for (uint i = 0; i < 12; ++i) | |
2162 pEquippedItems[i].Reset(); | |
2163 | |
2164 | |
2165 for (uint i = 0; i < 24; ++i) | |
2166 { | |
2167 pPlayerBuffs[i].uSkill = 0; | |
2168 pPlayerBuffs[i].uSkill = 0; | |
2169 pPlayerBuffs[i].uPower = 0; | |
2170 pPlayerBuffs[i].uExpireTime = 0; | |
2171 pPlayerBuffs[i].uCaster = 0; | |
2172 pPlayerBuffs[i].uFlags = 0; | |
2173 } | |
2174 | |
2175 pName[0] = 0; | |
1014 | 2176 uCurrentFace = 0; |
0 | 2177 uVoiceID = 0; |
2178 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2179 | |
2180 field_BB = 0; | |
2181 | |
2182 uMight = uMightBonus = 0; | |
2183 uIntelligence = uIntelligenceBonus = 0; | |
2184 uWillpower = uWillpowerBonus = 0; | |
2185 uEndurance = uEnduranceBonus = 0; | |
2186 uSpeed = uSpeedBonus = 0; | |
2187 uAccuracy = uAccuracyBonus = 0; | |
2188 uLuck = uLuckBonus = 0; | |
2189 uLevel = sLevelModifier = 0; | |
2190 sAgeModifier = 0; | |
2191 | |
2192 memset(field_1F5, 0, 30); | |
2193 | |
2194 sResFireBase = sResFireBonus = 0; | |
2195 sResAirBase = sResAirBonus = 0; | |
2196 sResWaterBase = sResWaterBonus = 0; | |
2197 sResEarthBase = sResEarthBonus = 0; | |
2198 sResMagicBase = sResMagicBonus = 0; | |
2199 sResSpiritBase = sResSpiritBonus = 0; | |
2200 sResMindBase = sResMindBonus = 0; | |
2201 sResBodyBase = sResBodyBonus = 0; | |
2202 sResLightBase = sResLightBonus = 0; | |
2203 sResDarkBase = sResDarkBonus = 0; | |
2204 | |
2205 uTimeToRecovery = 0; | |
2206 | |
2207 uSkillPoints = 0; | |
2208 | |
2209 sHealth = 0; | |
2210 uFullHealthBonus = 0; | |
2211 _health_related = 0; | |
2212 | |
2213 sMana = 0; | |
2214 uFullManaBonus = 0; | |
2215 _mana_related = 0; | |
2216 | |
2217 uQuickSpell = 0; | |
2218 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2219 | |
2220 _some_attack_bonus = 0; | |
2221 field_1A91 = 0; | |
2222 _melee_dmg_bonus = 0; | |
2223 field_1A93 = 0; | |
2224 _ranged_atk_bonus = 0; | |
2225 field_1A95 = 0; | |
2226 _ranged_dmg_bonus = 0; | |
2227 field_1A97 = 0; | |
2228 | |
130 | 2229 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2230 uExpressionTimePassed = 0; |
2231 uExpressionTimeLength = 0; | |
2232 | |
2233 uNumDivineInterventionCastsThisDay = 0; | |
2234 uNumArmageddonCasts = 0; | |
2235 uNumFireSpikeCasts = 0; | |
2236 | |
2237 memset(field_1988, 0, 49 * sizeof(int)); | |
2238 memset(field_1A50, 0, 64 * sizeof(char)); | |
2239 | |
2240 field_E0 = 0; | |
2241 field_E4 = 0; | |
2242 field_E8 = 0; | |
2243 field_EC = 0; | |
2244 field_F0 = 0; | |
2245 field_F4 = 0; | |
2246 field_F8 = 0; | |
2247 field_FC = 0; | |
2248 field_100 = 0; | |
2249 field_104 = 0; | |
198 | 2250 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2251 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2252 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2253 |
198 | 2254 lastOpenedSpellbookPage = 0; |
0 | 2255 } |
2256 | |
2257 //----- (0048C6F6) -------------------------------------------------------- | |
2258 bool Party::AddItem(ItemGen *pItem) | |
2259 { | |
2260 unsigned int v2; // eax@1 | |
2261 unsigned int v3; // ecx@4 | |
2262 signed int v4; // edx@4 | |
2263 char *v5; // eax@8 | |
973 | 2264 //unsigned int v6; // eax@10 |
0 | 2265 Texture *v7; // ebx@10 |
2266 signed int v8; // esi@10 | |
2267 Player *v9; // edi@11 | |
2268 int v10; // eax@11 | |
2269 bool result; // eax@15 | |
2270 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2271 |
2272 | |
188 | 2273 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2274 //int v16; // [sp+10h] [bp-18h]@3 | |
2275 //int v17; // [sp+14h] [bp-14h]@3 | |
2276 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2277 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2278 Party *v20; // [sp+20h] [bp-8h]@1 | |
2279 int v21; // [sp+24h] [bp-4h]@10 | |
2280 | |
2281 auto thos = this; | |
2282 | |
2283 v20 = thos; | |
2284 v2 = pItem->uItemID; | |
222 | 2285 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2286 pItem->SetIdentified(); |
188 | 2287 ///v15 = 0; |
2288 //v16 = 1; | |
2289 //v18 = 3; | |
2290 //v17 = 2; | |
0 | 2291 if ( uActiveCharacter ) |
2292 { | |
2293 v3 = uActiveCharacter - 1; | |
2294 v4 = 0; | |
2295 do | |
2296 { | |
188 | 2297 v15[v4++] = v3++; |
0 | 2298 if ( (signed int)v3 >= 4 ) |
2299 v3 = 0; | |
2300 } | |
2301 while ( v4 < 4 ); | |
2302 } | |
2303 v5 = pItemsTable->pItems[v2].pIconName; | |
2304 if ( v5 ) | |
2305 { | |
973 | 2306 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2307 v21 = areWeLoadingTexture; |
2308 v8 = 0; | |
2309 while ( 1 ) | |
2310 { | |
188 | 2311 v9 = &v20->pPlayers[v15[v8]]; |
2312 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2313 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2314 if ( v10 ) |
2315 break; | |
2316 ++v8; | |
2317 if ( v8 >= 4 ) | |
2318 { | |
2319 if ( !v21 ) | |
2320 { | |
2321 v7->Release(); | |
1006 | 2322 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2323 } |
2324 goto LABEL_15; | |
2325 } | |
2326 } | |
232 | 2327 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2328 pItem->Reset(); |
2329 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2330 v19->PlaySound(SPEECH_60, 0); |
0 | 2331 if ( !v21 ) |
2332 { | |
2333 v7->Release(); | |
1006 | 2334 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2335 } |
2336 result = 1; | |
2337 } | |
2338 else | |
2339 { | |
2340 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2341 LABEL_15: | |
2342 result = 0; | |
2343 } | |
2344 return result; | |
2345 } | |
2346 // 506128: using guessed type int areWeLoadingTexture; | |
2347 | |
2348 //----- (0048C855) -------------------------------------------------------- | |
2349 int Player::GetBaseStrength() | |
2350 { | |
2351 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2352 } | |
2353 | |
2354 //----- (0048C86C) -------------------------------------------------------- | |
2355 int Player::GetBaseIntelligence() | |
2356 { | |
2357 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2358 } | |
2359 | |
2360 //----- (0048C883) -------------------------------------------------------- | |
2361 int Player::GetBaseWillpower() | |
2362 { | |
2363 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2364 } | |
2365 | |
2366 //----- (0048C89A) -------------------------------------------------------- | |
2367 int Player::GetBaseEndurance() | |
2368 { | |
2369 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2370 } | |
2371 | |
2372 //----- (0048C8B1) -------------------------------------------------------- | |
2373 int Player::GetBaseAccuracy() | |
2374 { | |
2375 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2376 } | |
2377 | |
2378 //----- (0048C8C8) -------------------------------------------------------- | |
2379 int Player::GetBaseSpeed() | |
2380 { | |
2381 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2382 } | |
2383 | |
2384 //----- (0048C8DF) -------------------------------------------------------- | |
2385 int Player::GetBaseLuck() | |
2386 { | |
2387 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2388 } | |
2389 | |
2390 //----- (0048C8F6) -------------------------------------------------------- | |
2391 int Player::GetBaseLevel() | |
2392 { | |
2393 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2394 } | |
2395 | |
2396 //----- (0048C90D) -------------------------------------------------------- | |
2397 int Player::GetActualLevel() | |
2398 { | |
2399 return uLevel + sLevelModifier + | |
2400 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2401 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2402 } | |
2403 | |
2404 //----- (0048C93C) -------------------------------------------------------- | |
2405 int Player::GetActualMight() | |
2406 { | |
2407 Player *v1; // esi@1 | |
2408 unsigned int v2; // eax@1 | |
2409 signed int v3; // ecx@1 | |
2410 signed int v4; // ebx@4 | |
2411 int v5; // edi@5 | |
2412 int v6; // ST14_4@5 | |
2413 | |
2414 v1 = this; | |
2415 v2 = this->sAgeModifier + GetBaseAge(); | |
2416 v3 = 0; | |
2417 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2418 { | |
2419 ++v3; | |
2420 if ( v3 >= 4 ) | |
2421 { | |
2422 v4 = 100; | |
2423 goto LABEL_5; | |
2424 } | |
2425 } | |
2426 v4 = pAgeingStrengthMultiplier[v3]; | |
2427 LABEL_5: | |
2428 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2429 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2430 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2431 } | |
2432 | |
2433 //----- (0048C9C2) -------------------------------------------------------- | |
2434 int Player::GetActualIntelligence() | |
2435 { | |
2436 Player *v1; // esi@1 | |
2437 unsigned int sAge; // eax@1 | |
2438 signed int uAgeLevel; // ecx@1 | |
2439 signed int v4; // ebx@4 | |
2440 int v5; // edi@5 | |
2441 int v6; // ebp@5 | |
2442 | |
2443 v1 = this; | |
2444 sAge = this->sAgeModifier + GetBaseAge(); | |
2445 uAgeLevel = 0; | |
2446 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2447 { | |
2448 ++uAgeLevel; | |
2449 if ( uAgeLevel >= 4 ) | |
2450 { | |
2451 v4 = 100; | |
2452 goto LABEL_5; | |
2453 } | |
2454 } | |
2455 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2456 LABEL_5: | |
2457 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2458 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2459 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2460 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2461 + v6 | |
2462 + v1->uIntelligenceBonus; | |
2463 } | |
2464 | |
2465 //----- (0048CA3F) -------------------------------------------------------- | |
2466 int Player::GetActualWillpower() | |
2467 { | |
2468 int v5; // edi@5 | |
2469 | |
2470 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2471 uint uAgeingMultiplier = 100; | |
2472 for (uint i = 0; i < 4; ++i) | |
2473 if (uActualAge >= pAgeingTable[i]) | |
2474 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2475 else break; | |
2476 | |
2477 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2478 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2479 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2480 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2481 + uWillpowerBonus; | |
2482 } | |
2483 | |
2484 //----- (0048CABC) -------------------------------------------------------- | |
2485 int Player::GetActualEndurance() | |
2486 { | |
2487 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2488 uint uAgeingMultiplier = 100; | |
2489 for (uint i = 0; i < 4; ++i) | |
2490 if (uActualAge >= pAgeingTable[i]) | |
2491 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2492 else break; | |
2493 | |
2494 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2495 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2496 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2497 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2498 + uItemBonus | |
2499 + uEnduranceBonus; | |
2500 } | |
2501 | |
2502 //----- (0048CB39) -------------------------------------------------------- | |
2503 int Player::GetActualAccuracy() | |
2504 { | |
2505 Player *v1; // esi@1 | |
2506 unsigned int v2; // eax@1 | |
2507 signed int v3; // ecx@1 | |
2508 signed int v4; // ebx@4 | |
2509 int v5; // edi@5 | |
2510 int v6; // ebp@5 | |
2511 | |
2512 v1 = this; | |
2513 v2 = this->sAgeModifier + GetBaseAge(); | |
2514 v3 = 0; | |
2515 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2516 { | |
2517 ++v3; | |
2518 if ( v3 >= 4 ) | |
2519 { | |
2520 v4 = 100; | |
2521 goto LABEL_5; | |
2522 } | |
2523 } | |
2524 v4 = pAgeingAccuracyMultiplier[v3]; | |
2525 LABEL_5: | |
2526 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2527 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2528 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2529 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2530 + v6 | |
2531 + v1->uAccuracyBonus; | |
2532 } | |
2533 | |
2534 //----- (0048CBB6) -------------------------------------------------------- | |
2535 int Player::GetActualSpeed() | |
2536 { | |
2537 Player *v1; // esi@1 | |
2538 unsigned int v2; // eax@1 | |
2539 signed int v3; // ecx@1 | |
2540 signed int v4; // ebx@4 | |
2541 int v5; // edi@5 | |
2542 int v6; // ebp@5 | |
2543 | |
2544 v1 = this; | |
2545 v2 = this->sAgeModifier + GetBaseAge(); | |
2546 v3 = 0; | |
2547 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2548 { | |
2549 ++v3; | |
2550 if ( v3 >= 4 ) | |
2551 { | |
2552 v4 = 100; | |
2553 goto LABEL_5; | |
2554 } | |
2555 } | |
2556 v4 = pAgeingSpeedMultiplier[v3]; | |
2557 LABEL_5: | |
2558 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2559 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2560 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2561 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2562 + v6 | |
2563 + v1->uSpeedBonus; | |
2564 } | |
2565 | |
2566 //----- (0048CC33) -------------------------------------------------------- | |
2567 int Player::GetActualLuck() | |
2568 { | |
2569 Player *v1; // esi@1 | |
2570 unsigned int v2; // eax@7 | |
2571 signed int v3; // ecx@7 | |
2572 signed int v4; // ebx@10 | |
2573 int v5; // edi@11 | |
2574 int v6; // ebp@11 | |
2575 signed int v8; // [sp+10h] [bp-4h]@1 | |
2576 | |
2577 v8 = 0; | |
2578 v1 = this; | |
652 | 2579 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2580 v8 = 5; |
652 | 2581 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2582 v8 += 20; |
652 | 2583 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2584 v8 += 10; |
2585 v2 = v1->sAgeModifier + GetBaseAge(); | |
2586 v3 = 0; | |
2587 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2588 { | |
2589 ++v3; | |
2590 if ( v3 >= 4 ) | |
2591 { | |
2592 v4 = 100; | |
2593 goto LABEL_11; | |
2594 } | |
2595 } | |
2596 v4 = pAgeingLuckMultiplier[v3]; | |
2597 LABEL_11: | |
2598 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2599 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2600 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2601 + v6 | |
2602 + v8 | |
2603 + v5 * v4 * v1->uLuck / 100 / 100 | |
2604 + v1->uLuckBonus; | |
2605 } | |
2606 | |
2607 //----- (0048CCF5) -------------------------------------------------------- | |
2608 int Player::GetActualAttack(int a2) | |
2609 { | |
2610 Player *v2; // esi@1 | |
2611 int v3; // eax@1 | |
2612 int v4; // edi@1 | |
2613 int v5; // ebx@1 | |
2614 int v6; // ebp@1 | |
2615 | |
2616 v2 = this; | |
2617 v3 = GetActualAccuracy(); | |
2618 v4 = _48EA1B_get_static_effect(v3); | |
2619 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2620 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2621 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2622 } | |
2623 | |
2624 //----- (0048CD45) -------------------------------------------------------- | |
2625 int Player::GetMeleeDamageMinimal() | |
2626 { | |
2627 Player *v1; // edi@1 | |
2628 int v2; // eax@1 | |
2629 int v3; // esi@1 | |
2630 int v4; // esi@1 | |
2631 int v5; // esi@1 | |
2632 int v6; // esi@1 | |
2633 signed int result; // eax@1 | |
2634 | |
2635 v1 = this; | |
2636 v2 = GetActualMight(); | |
2637 v3 = _48EA1B_get_static_effect(v2); | |
2638 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2639 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2640 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2641 result = 1; | |
2642 if ( v6 >= 1 ) | |
2643 result = v6; | |
2644 return result; | |
2645 } | |
2646 | |
2647 //----- (0048CD90) -------------------------------------------------------- | |
2648 int Player::GetMeleeDamageMaximal() | |
2649 { | |
2650 Player *v1; // edi@1 | |
2651 int v2; // eax@1 | |
2652 int v3; // esi@1 | |
2653 int v4; // esi@1 | |
2654 int v5; // esi@1 | |
2655 int v6; // esi@1 | |
2656 signed int result; // eax@1 | |
2657 | |
2658 v1 = this; | |
2659 v2 = GetActualMight(); | |
2660 v3 = _48EA1B_get_static_effect(v2); | |
2661 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2662 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2663 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2664 result = 1; | |
2665 if ( v6 >= 1 ) | |
2666 result = v6; | |
2667 return result; | |
2668 } | |
2669 | |
2670 //----- (0048CDDB) -------------------------------------------------------- | |
2671 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2672 { | |
2673 int v4; // esi@1 | |
2674 Player *v5; // edi@1 | |
2675 ItemGen *v6; // ebx@4 | |
2676 unsigned int v7; // ebp@4 | |
2677 unsigned int v8; // esi@4 | |
2678 int v9; // eax@4 | |
2679 int v10; // eax@9 | |
2680 char v11; // zf@9 | |
2681 int v12; // esi@10 | |
2682 int v13; // eax@11 | |
2683 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2684 ItemGen *v15; // ebx@35 | |
2685 unsigned int v16; // ebp@35 | |
2686 unsigned int v17; // esi@35 | |
2687 int v18; // edx@38 | |
2688 int v19; // eax@40 | |
2689 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2690 int v21; // esi@62 | |
2691 int v22; // eax@63 | |
2692 int v23; // ebx@63 | |
2693 int v24; // ebx@63 | |
2694 signed int result; // eax@64 | |
2695 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2696 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2697 int v28; // [sp+10h] [bp-10h]@1 | |
2698 int v29; // [sp+10h] [bp-10h]@33 | |
2699 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2700 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2701 int v32; // [sp+18h] [bp-8h]@1 | |
2702 int v33; // [sp+18h] [bp-8h]@8 | |
2703 int v34; // [sp+1Ch] [bp-4h]@1 | |
2704 int v35; // [sp+28h] [bp+8h]@37 | |
2705 | |
2706 v4 = 0; | |
2707 v5 = this; | |
2708 v34 = 0; | |
2709 v32 = 0; | |
2710 v28 = 0; | |
2711 if ( IsUnarmed() == 1 ) | |
2712 { | |
2713 v32 = rand() % 3 + 1; | |
2714 LABEL_61: | |
2715 v34 = v4; | |
2716 goto LABEL_62; | |
2717 } | |
816 | 2718 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2719 { |
232 | 2720 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2721 v7 = v6->uItemID; |
2722 v8 = v6->uItemID; | |
2723 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2724 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2725 ++v9; |
2726 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2727 if ( v9 > 0 ) | |
2728 { | |
2729 v33 = v9; | |
2730 do | |
2731 { | |
2732 v10 = rand(); | |
2733 v11 = v33-- == 1; | |
2734 v28 += v10 % v30 + 1; | |
2735 } | |
2736 while ( !v11 ); | |
2737 } | |
2738 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2739 if ( !uTargetActorID ) | |
2740 goto LABEL_28; | |
377 | 2741 v13 = v6->uSpecEnchantmentType; |
0 | 2742 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2743 { | |
2744 v14 = (MONSTER_SUPERTYPE)1; | |
2745 } | |
2746 else | |
2747 { | |
2748 if ( v13 == 39 ) | |
2749 { | |
2750 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2751 } | |
2752 else | |
2753 { | |
2754 if ( v13 == 40 ) | |
2755 { | |
2756 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2757 } | |
2758 else | |
2759 { | |
2760 if ( v13 == 63 || v7 == 517 ) | |
2761 { | |
2762 v26 = MONSTER_SUPERTYPE_ELF; | |
2763 } | |
2764 else | |
2765 { | |
2766 if ( v13 != 65 ) | |
2767 { | |
2768 LABEL_28: | |
2769 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2770 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2771 && rand() % 100 < 10 ) | |
2772 v12 *= 3; | |
2773 v32 = v12; | |
2774 goto LABEL_33; | |
2775 } | |
2776 v26 = MONSTER_SUPERTYPE_TITAN; | |
2777 } | |
2778 } | |
2779 } | |
2780 v14 = v26; | |
2781 } | |
2782 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2783 v12 *= 2; | |
2784 goto LABEL_28; | |
2785 } | |
2786 LABEL_33: | |
2787 v29 = 0; | |
2788 if ( !a3 ) | |
2789 { | |
2790 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2791 { | |
898 | 2792 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2793 v16 = v15->uItemID; |
2794 v17 = v15->uItemID; | |
2795 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2796 { | |
2797 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2798 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2799 { | |
2800 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2801 do | |
2802 { | |
2803 v18 = rand() % v31; | |
2804 v11 = v35-- == 1; | |
2805 v29 += v18 + 1; | |
2806 } | |
2807 while ( !v11 ); | |
2808 } | |
2809 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2810 if ( !uTargetActorID ) | |
2811 goto LABEL_57; | |
377 | 2812 v19 = v15->uSpecEnchantmentType; |
0 | 2813 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2814 { | |
2815 v20 = (MONSTER_SUPERTYPE)1; | |
2816 } | |
2817 else | |
2818 { | |
2819 if ( v19 == 39 ) | |
2820 { | |
2821 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2822 } | |
2823 else | |
2824 { | |
2825 if ( v19 == 40 ) | |
2826 { | |
2827 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2828 } | |
2829 else | |
2830 { | |
2831 if ( v19 == 63 || v16 == 517 ) | |
2832 { | |
2833 v27 = MONSTER_SUPERTYPE_ELF; | |
2834 } | |
2835 else | |
2836 { | |
2837 if ( v19 != 65 ) | |
2838 { | |
2839 LABEL_57: | |
2840 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2841 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2842 && rand() % 100 < 10 ) | |
2843 v4 *= 3; | |
2844 goto LABEL_61; | |
2845 } | |
2846 v27 = MONSTER_SUPERTYPE_TITAN; | |
2847 } | |
2848 } | |
2849 } | |
2850 v20 = v27; | |
2851 } | |
2852 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2853 v4 *= 2; | |
2854 goto LABEL_57; | |
2855 } | |
2856 } | |
2857 } | |
2858 LABEL_62: | |
2859 v21 = v32 + v34; | |
2860 if ( !a2 ) | |
2861 { | |
2862 v22 = GetActualMight(); | |
2863 v23 = _48EA1B_get_static_effect(v22); | |
2864 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2865 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2866 } | |
2867 result = 1; | |
2868 if ( v21 >= 1 ) | |
2869 result = v21; | |
2870 return result; | |
2871 } | |
2872 | |
2873 //----- (0048D0B9) -------------------------------------------------------- | |
2874 int Player::GetRangedAttack() | |
2875 { | |
2876 Player *v1; // esi@1 | |
2877 int v2; // eax@1 | |
2878 int v3; // edi@3 | |
2879 int v4; // eax@4 | |
2880 int v5; // edi@4 | |
2881 int v6; // edi@4 | |
2882 int v7; // edi@4 | |
2883 | |
2884 v1 = this; | |
232 | 2885 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2886 if ( v2 < 64 || v2 > 65 ) |
2887 { | |
2888 v4 = GetActualAccuracy(); | |
2889 v5 = _48EA1B_get_static_effect(v4); | |
2890 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2891 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2892 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2893 } | |
2894 else | |
2895 { | |
2896 v3 = GetActualAttack(1); | |
2897 } | |
2898 return v3; | |
2899 } | |
2900 | |
2901 //----- (0048D124) -------------------------------------------------------- | |
2902 int Player::GetRangedDamageMin() | |
2903 { | |
2904 Player *v1; // esi@1 | |
2905 int v2; // edi@1 | |
2906 int v3; // edi@1 | |
2907 int v4; // edi@1 | |
2908 unsigned __int16 v5; // ax@1 | |
2909 int result; // eax@6 | |
2910 | |
2911 v1 = this; | |
2912 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2913 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2914 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2915 v5 = v1->pActiveSkills[5]; | |
2916 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2917 v4 += v1->pActiveSkills[5] & 0x3F; | |
2918 if ( v4 >= 1 ) | |
2919 result = v4; | |
2920 else | |
2921 result = 0; | |
2922 return result; | |
2923 } | |
2924 | |
2925 //----- (0048D191) -------------------------------------------------------- | |
2926 int Player::GetRangedDamageMax() | |
2927 { | |
2928 Player *v1; // esi@1 | |
2929 int v2; // edi@1 | |
2930 int v3; // edi@1 | |
2931 int v4; // edi@1 | |
2932 unsigned __int16 v5; // ax@1 | |
2933 int result; // eax@6 | |
2934 | |
2935 v1 = this; | |
2936 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
2937 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2938 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2939 v5 = v1->pActiveSkills[5]; | |
2940 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2941 v4 += v1->pActiveSkills[5] & 0x3F; | |
2942 if ( v4 >= 1 ) | |
2943 result = v4; | |
2944 else | |
2945 result = 0; | |
2946 return result; | |
2947 } | |
2948 | |
2949 //----- (0048D1FE) -------------------------------------------------------- | |
2950 bool Player::CalculateRangedDamageTo(int a2) | |
2951 { | |
2952 Player *v2; // ebx@1 | |
2953 bool result; // eax@1 | |
2954 ItemGen *v4; // ebx@2 | |
2955 unsigned int v5; // edi@2 | |
2956 unsigned int v6; // esi@2 | |
2957 int v7; // edx@4 | |
2958 char v8; // zf@4 | |
2959 int v9; // esi@5 | |
2960 int v10; // ebx@6 | |
2961 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2962 unsigned __int16 v12; // ax@19 | |
2963 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2964 Player *v14; // [sp+4h] [bp-10h]@1 | |
2965 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2966 int v16; // [sp+Ch] [bp-8h]@3 | |
2967 int v17; // [sp+10h] [bp-4h]@1 | |
2968 | |
2969 v17 = 0; | |
2970 v2 = this; | |
2971 v14 = this; | |
2972 result = HasItemEquipped(EQUIP_BOW); | |
2973 if ( !result ) | |
2974 return result; | |
232 | 2975 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2976 v5 = v4->uItemID; |
2977 v6 = v4->uItemID; | |
2978 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2979 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2980 { | |
2981 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2982 do | |
2983 { | |
2984 v7 = rand() % v15; | |
2985 v8 = v16-- == 1; | |
2986 v17 += v7 + 1; | |
2987 } | |
2988 while ( !v8 ); | |
2989 } | |
2990 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2991 if ( a2 ) | |
2992 { | |
377 | 2993 v10 = v4->uSpecEnchantmentType; |
0 | 2994 if ( v10 == 64 ) |
2995 { | |
2996 v11 = (MONSTER_SUPERTYPE)1; | |
2997 goto LABEL_17; | |
2998 } | |
2999 if ( v10 == 39 || v5 == 508 ) | |
3000 { | |
3001 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3002 goto LABEL_16; | |
3003 } | |
3004 if ( v10 == 40 ) | |
3005 { | |
3006 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3007 goto LABEL_16; | |
3008 } | |
3009 if ( v10 == 63 || v5 == 517 ) | |
3010 { | |
3011 v13 = MONSTER_SUPERTYPE_ELF; | |
3012 LABEL_16: | |
3013 v11 = v13; | |
3014 LABEL_17: | |
3015 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3016 v9 *= 2; | |
3017 goto LABEL_19; | |
3018 } | |
3019 } | |
3020 LABEL_19: | |
3021 v12 = v14->pActiveSkills[5]; | |
3022 if ( v12 ) | |
3023 { | |
3024 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3025 v9 += v14->pActiveSkills[5] & 0x3F; | |
3026 } | |
3027 return v9; | |
3028 } | |
3029 | |
3030 //----- (0048D2EA) -------------------------------------------------------- | |
3031 char *Player::GetMeleeDamageString() | |
3032 { | |
3033 Player *v1; // esi@1 | |
3034 signed int v2; // eax@1 | |
3035 signed int v3; // edi@3 | |
3036 signed int v4; // eax@3 | |
3037 signed int v5; // ST0C_4@6 | |
3038 char *v6; // edi@6 | |
3039 signed int v7; // ST08_4@7 | |
3040 unsigned int v8; // eax@8 | |
3041 signed int v9; // esi@9 | |
3042 | |
3043 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3044 | |
3045 v1 = this; | |
232 | 3046 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3047 if ( v2 < 64 || v2 > 65 ) |
3048 { | |
3049 v3 = GetMeleeDamageMinimal(); | |
3050 v4 = GetMeleeDamageMaximal(); | |
3051 } | |
3052 else | |
3053 { | |
3054 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3055 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3056 } | |
3057 if ( v3 == v4 ) | |
3058 { | |
3059 v5 = v3; | |
3060 v6 = player__getmeleedamagestring_static_buff; | |
3061 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3062 } | |
3063 else | |
3064 { | |
3065 v7 = v3; | |
3066 v6 = player__getmeleedamagestring_static_buff; | |
3067 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3068 } | |
3069 v8 = v1->pEquipment.uMainHand; | |
3070 if ( v8 ) | |
3071 { | |
232 | 3072 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3073 if ( v9 >= 135 ) |
3074 { | |
3075 if ( v9 <= 159 ) | |
3076 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3077 } | |
3078 } | |
3079 return v6; | |
3080 } | |
3081 | |
3082 //----- (0048D396) -------------------------------------------------------- | |
3083 char *Player::GetRangedDamageString() | |
3084 { | |
3085 Player *v1; // esi@1 | |
3086 signed int v2; // eax@1 | |
3087 int v3; // edi@3 | |
3088 int v4; // eax@3 | |
3089 char *v5; // edi@6 | |
3090 int v6; // ST0C_4@8 | |
3091 int v7; // ST08_4@9 | |
3092 unsigned int v8; // eax@10 | |
3093 signed int v9; // esi@11 | |
3094 | |
3095 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3096 | |
3097 v1 = this; | |
232 | 3098 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3099 if ( v2 < 64 || v2 > 65 ) |
3100 { | |
3101 v3 = GetRangedDamageMin(); | |
3102 v4 = GetRangedDamageMax(); | |
3103 } | |
3104 else | |
3105 { | |
3106 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3107 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3108 } | |
3109 if ( v4 ) | |
3110 { | |
3111 if ( v3 == v4 ) | |
3112 { | |
3113 v6 = v3; | |
3114 v5 = player__getrangeddamagestring_static_buff; | |
3115 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3116 } | |
3117 else | |
3118 { | |
3119 v7 = v3; | |
3120 v5 = player__getrangeddamagestring_static_buff; | |
3121 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3122 } | |
3123 } | |
3124 else | |
3125 { | |
3126 v5 = player__getrangeddamagestring_static_buff; | |
3127 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3128 } | |
3129 v8 = v1->pEquipment.uMainHand; | |
3130 if ( v8 ) | |
3131 { | |
232 | 3132 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3133 if ( v9 >= 135 ) |
3134 { | |
3135 if ( v9 <= 159 ) | |
3136 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3137 } | |
3138 } | |
3139 return v5; | |
3140 } | |
3141 | |
3142 //----- (0048D45A) -------------------------------------------------------- | |
3143 bool Player::CanTrainToNextLevel() | |
3144 { | |
3145 int v1; // edx@1 | |
3146 int v2; // eax@1 | |
3147 int i; // esi@1 | |
3148 | |
3149 v1 = this->uLevel; | |
3150 v2 = 0; | |
3151 for ( i = 0; i < v1; ++i ) | |
3152 v2 += i + 1; | |
3153 return (signed __int64)this->uExperience >= 1000 * v2; | |
3154 } | |
3155 | |
3156 //----- (0048D498) -------------------------------------------------------- | |
3157 unsigned int Player::GetExperienceDisplayColor() | |
3158 { | |
3159 unsigned int result; // eax@2 | |
3160 | |
3161 if ( CanTrainToNextLevel() ) | |
995 | 3162 result = ui_character_bonus_text_color; |
0 | 3163 else |
995 | 3164 result = ui_character_default_text_color; |
0 | 3165 return result; |
3166 } | |
3167 | |
3168 //----- (0048D4B3) -------------------------------------------------------- | |
3169 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3170 { | |
3171 Player *v3; // esi@1 | |
3172 int v4; // edi@8 | |
3173 int v6; // eax@21 | |
3174 signed int v7; // ebx@21 | |
3175 int v8; // eax@22 | |
3176 signed int v9; // ebx@22 | |
3177 int v10; // eax@23 | |
3178 signed int v11; // ebx@23 | |
3179 int v12; // eax@24 | |
3180 signed int v13; // edi@24 | |
3181 unsigned int v14; // eax@27 | |
3182 int v15; // eax@29 | |
3183 double v16; // st7@32 | |
3184 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3185 signed int v18; // [sp+8h] [bp-4h]@17 | |
3186 | |
3187 v3 = this; | |
3188 if ( !resistance ) | |
3189 { | |
3190 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3191 goto LABEL_16; | |
3192 } | |
3193 if ( resistance == 1 ) | |
3194 { | |
3195 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3196 goto LABEL_16; | |
3197 } | |
3198 if ( resistance == 2 ) | |
3199 { | |
3200 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3201 goto LABEL_16; | |
3202 } | |
3203 if ( resistance == 3 ) | |
3204 { | |
3205 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3206 goto LABEL_16; | |
3207 } | |
3208 if ( resistance == 6 ) | |
3209 { | |
3210 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3211 goto LABEL_16; | |
3212 } | |
3213 if ( resistance == 7 ) | |
3214 { | |
3215 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3216 goto LABEL_16; | |
3217 } | |
3218 if ( resistance == 8 ) | |
3219 { | |
3220 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3221 LABEL_16: | |
3222 v4 = GetActualResistance(v17); | |
3223 goto LABEL_17; | |
3224 } | |
3225 v4 = 0; | |
3226 LABEL_17: | |
3227 v18 = type; | |
135 | 3228 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3229 return 0; |
3230 if ( v4 ) | |
3231 { | |
3232 v6 = GetActualLuck(); | |
3233 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3234 if ( rand() % v7 >= 30 ) | |
3235 { | |
3236 v18 = type >> 1; | |
3237 v8 = GetActualLuck(); | |
3238 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3239 if ( rand() % v9 >= 30 ) | |
3240 { | |
3241 v18 = type >> 2; | |
3242 v10 = GetActualLuck(); | |
3243 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3244 if ( rand() % v11 >= 30 ) | |
3245 { | |
3246 v18 = type >> 3; | |
3247 v12 = GetActualLuck(); | |
3248 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3249 if ( rand() % v13 >= 30 ) | |
3250 v18 = type >> 4; | |
3251 } | |
3252 } | |
3253 } | |
3254 } | |
3255 if ( resistance == 4 ) | |
3256 { | |
898 | 3257 v14 = v3->pEquipment.uArmor; |
0 | 3258 if ( v14 ) |
3259 { | |
3260 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3261 { | |
3262 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3263 if ( v15 ) | |
3264 { | |
3265 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3266 return v18; | |
3267 v16 = (double)v18 * 0.5; | |
3268 return (signed __int64)v16; | |
3269 } | |
3270 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3271 { | |
3272 v16 = (double)v18 * 0.66670001; | |
3273 return (signed __int64)v16; | |
3274 } | |
3275 } | |
3276 } | |
3277 } | |
3278 return v18; | |
3279 } | |
3280 | |
3281 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3282 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3283 { | |
3284 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3285 } |
3286 | |
3287 //----- (0048D651) -------------------------------------------------------- | |
816 | 3288 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3289 { | |
3290 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3291 } |
3292 | |
3293 //----- (0048D676) -------------------------------------------------------- | |
3294 bool Player::IsUnarmed() | |
3295 { | |
816 | 3296 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3297 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3298 } |
3299 | |
3300 //----- (0048D6AA) -------------------------------------------------------- | |
3301 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3302 { | |
3303 auto i = pEquipment.pIndices[uEquipIndex]; | |
3304 if (i) | |
3305 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3306 else return false; | |
3307 } | |
3308 | |
3309 //----- (0048D6D0) -------------------------------------------------------- | |
3310 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3311 { | |
3312 for (uint i = 0; i < 16; ++i) | |
3313 { | |
3314 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3315 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3316 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3317 return true; | |
3318 } | |
3319 return false; | |
3320 } | |
3321 | |
3322 //----- (0048D709) -------------------------------------------------------- | |
3323 bool Player::WearsItem(int a1, signed int a2) | |
3324 { | |
1010 | 3325 |
0 | 3326 int v6; // esi@5 |
3327 | |
3328 if ( a2 >= 16 ) | |
3329 { | |
3330 v6 = 0; | |
3331 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3332 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3333 { |
3334 ++v6; | |
3335 if ( (signed int)v6 >= 16 ) | |
3336 return 0; | |
3337 } | |
3338 return 1; | |
3339 } | |
727 | 3340 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3341 return 1; |
3342 return 0; | |
3343 } | |
3344 | |
3345 //----- (0048D76C) -------------------------------------------------------- | |
3346 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3347 { | |
3348 unsigned __int16 v6; // cx@8 | |
3349 int v7; // edi@8 | |
3350 unsigned int v8; // ebx@8 | |
3351 unsigned int v9; // esi@8 | |
3352 int v10; // eax@8 | |
3353 int v11; // edi@12 | |
3354 bool result; // eax@13 | |
3355 | |
3356 if ( !a2 | |
3357 || this->pConditions[16] | |
3358 || this->pConditions[14] | |
3359 || this->pConditions[15] | |
3360 || this->pConditions[4] | |
3361 || this->pConditions[13] | |
3362 || this->pConditions[2] ) | |
3363 { | |
3364 result = 0; | |
3365 } | |
3366 else | |
3367 { | |
3368 v6 = this->pActiveSkills[34]; | |
3369 v7 = v6 & 0x3F; | |
3370 v8 = SkillToMastery(v6); | |
3371 v9 = a2->GetValue(); | |
3372 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3373 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3374 v9 *= 3; | |
3375 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3376 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3377 if ( rand() % 100 >= 5 ) | |
3378 { | |
3379 if ( *a6 > v11 ) | |
3380 result = *a6 - v11 < 500; | |
3381 else | |
3382 result = 2; | |
3383 } | |
3384 else | |
3385 { | |
3386 result = 0; | |
3387 } | |
3388 } | |
3389 return result; | |
3390 } | |
3391 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3392 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3393 | |
3394 //----- (0048D88B) -------------------------------------------------------- | |
3395 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3396 { | |
3397 Player *v4; // esi@1 | |
3398 Actor *v5; // edi@1 | |
3399 unsigned __int16 v6; // cx@10 | |
3400 int v7; // ebx@10 | |
3401 unsigned int v8; // esi@10 | |
3402 int v9; // eax@10 | |
3403 int v10; // esi@10 | |
3404 int v11; // eax@13 | |
3405 signed int v12; // ebx@15 | |
3406 signed int v13; // edx@15 | |
3407 int v14; // ecx@15 | |
3408 unsigned __int16 v15; // si@21 | |
3409 unsigned int v16; // ebx@24 | |
3410 int v17; // esi@24 | |
3411 const void *v18; // eax@29 | |
3412 unsigned int v19; // esi@31 | |
3413 int v20; // eax@34 | |
3414 char v21; // zf@36 | |
3415 unsigned int v22; // ST0C_4@39 | |
3416 char *v23; // esi@39 | |
3417 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3418 int v26; // [sp-8h] [bp-44h]@40 | |
3419 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3420 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3421 int v29; // [sp+30h] [bp-Ch]@10 | |
3422 int v30; // [sp+34h] [bp-8h]@10 | |
3423 Player *v31; // [sp+38h] [bp-4h]@1 | |
3424 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3425 | |
3426 v4 = this; | |
3427 v5 = &pActors[uActorID]; | |
3428 v31 = this; | |
3429 if ( &pActors[uActorID] | |
3430 && !this->pConditions[16] | |
3431 && !this->pConditions[14] | |
3432 && !this->pConditions[15] | |
3433 && !this->pConditions[4] | |
3434 && !this->pConditions[13] | |
3435 && !this->pConditions[2] ) | |
3436 { | |
3437 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3438 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3439 v6 = v4->pActiveSkills[34]; | |
3440 v7 = v6 & 0x3F; | |
3441 v8 = SkillToMastery(v6); | |
3442 v9 = rand(); | |
3443 v28 = 4 * v8; | |
3444 v30 = dword_4EDEA0[v8]; | |
3445 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3446 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3447 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3448 { | |
322 | 3449 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3450 _steal_perma = 0; |
3451 v26 = (int)v31->pName; | |
3452 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3453 } | |
3454 else | |
3455 { | |
3456 v11 = rand(); | |
3457 if ( v11 % 100 >= 40 ) | |
3458 { | |
3459 if ( v11 % 100 >= 70 ) | |
3460 { | |
3461 v19 = 0; | |
3462 if ( v7 > 0 ) | |
3463 { | |
3464 do | |
3465 { | |
3466 --v7; | |
3467 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3468 } | |
3469 while ( v7 ); | |
3470 } | |
3471 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3472 return _steal_perma; | |
377 | 3473 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3474 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3475 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3476 v21 = *(int *)v20 == v19; |
3477 *(int *)v20 -= v19; | |
3478 if ( v21 ) | |
3479 v5->array_000234[3].uItemID = 0; | |
3480 if ( v19 ) | |
3481 { | |
3482 party_finds_gold(v19, 2); | |
3483 v22 = v19; | |
3484 v23 = pTmpBuf2; | |
3485 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3486 LABEL_43: | |
3487 ShowStatusBarString(v23, 2u); | |
3488 return _steal_perma; | |
3489 } | |
3490 } | |
3491 else | |
3492 { | |
3493 v27.Reset(); | |
3494 v12 = 0; | |
3495 v13 = 0; | |
3496 v14 = (int)v5->array_000234; | |
3497 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3498 { | |
3499 ++v13; | |
3500 v14 += 36; | |
3501 if ( v13 >= 4 ) | |
3502 goto LABEL_21; | |
3503 } | |
3504 v12 = 1; | |
3505 LABEL_21: | |
3506 v15 = v5->uCarriedItemID; | |
3507 if ( v15 || v12 ) | |
3508 { | |
3509 v27.Reset(); | |
3510 if ( v15 ) | |
3511 { | |
3512 v16 = (signed __int16)v15; | |
3513 v5->uCarriedItemID = 0; | |
3514 v27.uItemID = (signed __int16)v15; | |
3515 v17 = (signed __int16)v15; | |
3516 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3517 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3518 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3519 { | |
3520 if ( v16 != 220 ) | |
570 | 3521 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3522 } |
3523 } | |
3524 else | |
3525 { | |
3526 v18 = &v5->array_000234[rand() % 4]; | |
3527 memcpy(&v27, v18, sizeof(v27)); | |
3528 ((ItemGen *)v18)->Reset(); | |
3529 v16 = v27.uItemID; | |
3530 } | |
3531 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3532 sprintf( | |
3533 pTmpBuf2, | |
3534 pGlobalTXT_LocalizationStrings[304], | |
3535 v31->pName, | |
3536 pItemsTable->pItems[v16].pUnidentifiedName); | |
3537 ShowStatusBarString(pTmpBuf2, 2u); | |
3538 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3539 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3540 pMouse->SetCursorBitmapFromItemID(v16); | |
3541 return _steal_perma; | |
3542 } | |
3543 } | |
3544 } | |
3545 v26 = (int)v31->pName; | |
3546 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3547 } | |
3548 v23 = pTmpBuf2; | |
809 | 3549 sprintfex(pTmpBuf2, v25, v26); |
0 | 3550 goto LABEL_43; |
3551 } | |
3552 return 0; | |
3553 } | |
3554 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3555 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3556 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3557 | |
3558 //----- (0048DBB9) -------------------------------------------------------- | |
3559 void Player::Heal(int amount) | |
3560 { | |
1010 | 3561 signed int max_health; // eax@3 |
3562 | |
3563 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3564 { | |
3565 max_health = GetMaxHealth(); | |
3566 if ( pConditions[Condition_Zombie] ) | |
3567 max_health /= 2; | |
3568 sHealth += amount; | |
3569 if ( sHealth > max_health ) | |
3570 sHealth = max_health; | |
3571 if ( pConditions[Condition_Unconcious] ) | |
3572 { | |
3573 if ( sHealth > 0 ) | |
3574 { | |
3575 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3576 } |
3577 } | |
3578 } | |
3579 } | |
3580 | |
3581 //----- (0048DC1E) -------------------------------------------------------- | |
3582 int Player::ReceiveDamage(signed int type, int resistance) | |
3583 { | |
3584 Player *v3; // esi@1 | |
3585 signed int v4; // eax@1 | |
3586 int v5; // eax@1 | |
3587 bool v6; // ebx@1 | |
3588 unsigned int v7; // eax@8 | |
3589 char *v8; // ecx@9 | |
3590 int v9; // eax@9 | |
187 | 3591 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3592 |
3593 v3 = this; | |
1010 | 3594 this->pConditions[Condition_Sleep] = 0i64; |
0 | 3595 v4 = CalculateIncommingDamage(resistance, type); |
3596 v3->sHealth -= v4; | |
187 | 3597 //typea = v4; |
0 | 3598 v5 = v3->sHealth; |
3599 v6 = v5 < -10; | |
3600 LOBYTE(v6) = v5 <= -10; | |
3601 if ( v5 < 1 ) | |
3602 { | |
3603 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
1010 | 3604 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
0 | 3605 { |
3606 SetCondition(0xDu, 0); | |
3607 } | |
3608 else | |
3609 { | |
3610 SetCondition(0xEu, 0); | |
3611 v6 = LODWORD(pParty->uTimePlayed); | |
3612 if ( v3->sHealth > 0 ) | |
3613 v3->sHealth = 0; | |
3614 } | |
3615 if ( v6 ) | |
3616 { | |
898 | 3617 v7 = v3->pEquipment.uArmor; |
0 | 3618 if ( v7 ) |
3619 { | |
3620 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3621 v9 = *(int *)v8; | |
3622 if ( !(BYTE1(v9) & 2) ) | |
3623 { | |
3624 LOBYTE(v9) = v9 | 2; | |
3625 *(int *)v8 = v9; | |
3626 } | |
3627 } | |
3628 } | |
3629 } | |
187 | 3630 if ( v4 && CanAct() ) |
3631 PlaySound(SPEECH_24, 0); | |
3632 return v4; | |
0 | 3633 } |
3634 | |
3635 //----- (0048DCF6) -------------------------------------------------------- | |
3636 int Player::_48DCF6(int a2, Actor *pActor) | |
3637 { | |
3638 signed int v3; // edi@1 | |
3639 signed int v4; // ebx@1 | |
3640 Player *v5; // esi@1 | |
3641 int v6; // eax@2 | |
3642 int v7; // eax@5 | |
3643 int v8; // eax@8 | |
3644 int v9; // ebx@8 | |
3645 int v10; // eax@8 | |
3646 int v11; // ebx@8 | |
3647 signed int v12; // edx@9 | |
3648 ItemGen *v13; // eax@9 | |
3649 int v14; // edx@16 | |
3650 unsigned int v15; // edx@17 | |
3651 int v16; // edx@26 | |
3652 unsigned int v17; // edx@27 | |
3653 signed int v19; // edx@38 | |
3654 int *v20; // ecx@38 | |
3655 signed int v21; // eax@40 | |
3656 int v22; // eax@49 | |
3657 signed int v23; // ebx@49 | |
3658 unsigned int v24; // eax@60 | |
3659 int v25; // ecx@61 | |
3660 int v26; // ebx@74 | |
3661 void *v27; // ecx@76 | |
3662 unsigned int v28; // ebx@78 | |
3663 signed int result; // eax@86 | |
3664 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3665 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3666 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3667 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3668 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3669 int v35; // [sp-Ch] [bp-ACh]@56 | |
3670 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3671 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3672 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3673 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3674 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3675 int v41; // [sp-4h] [bp-A4h]@51 | |
3676 int v42; // [sp-4h] [bp-A4h]@56 | |
3677 int v43; // [sp-4h] [bp-A4h]@57 | |
3678 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3679 int v45; // [sp-4h] [bp-A4h]@68 | |
3680 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3681 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3682 int v48; // [sp+9Ch] [bp-4h]@1 | |
3683 | |
3684 v3 = 0; | |
3685 v4 = 0; | |
3686 v5 = this; | |
3687 v47 = 0; | |
3688 v48 = 0; | |
3689 switch ( a2 ) | |
3690 { | |
3691 case 1: | |
3692 v6 = GetActualWillpower(); | |
3693 goto LABEL_46; | |
3694 case 2: | |
3695 case 3: | |
3696 case 4: | |
3697 case 9: | |
3698 case 10: | |
3699 case 11: | |
3700 case 13: | |
3701 case 21: | |
3702 v6 = GetActualEndurance(); | |
3703 goto LABEL_46; | |
3704 case 5: | |
3705 case 12: | |
3706 case 23: | |
3707 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3708 goto LABEL_5; | |
3709 case 15: | |
3710 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3711 goto LABEL_5; | |
3712 case 6: | |
3713 case 7: | |
3714 case 8: | |
3715 case 14: | |
3716 case 16: | |
3717 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3718 LABEL_5: | |
3719 v7 = GetActualResistance(v40); | |
3720 goto LABEL_47; | |
3721 case 22: | |
3722 v8 = GetActualWillpower(); | |
3723 v9 = _48EA1B_get_static_effect(v8); | |
3724 v10 = GetActualIntelligence(); | |
3725 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3726 break; | |
3727 case 17: | |
3728 v12 = 0; | |
3729 v13 = this->pInventoryItems; | |
3730 do | |
3731 { | |
315 | 3732 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3733 v46[v4++] = v12; |
3734 ++v12; | |
3735 ++v13; | |
3736 } | |
3737 while ( v12 < 138 ); | |
3738 goto LABEL_36; | |
3739 case 18: | |
3740 v14 = 0; | |
3741 do | |
3742 { | |
3743 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3744 { | |
816 | 3745 if ( v15 == EQUIP_ARMOUR ) |
898 | 3746 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3747 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3748 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3749 } |
3750 v14 = v15 + 1; | |
3751 } | |
3752 while ( v14 < 16 ); | |
3753 goto LABEL_36; | |
3754 case 19: | |
3755 v16 = 0; | |
3756 do | |
3757 { | |
3758 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3759 { | |
3760 if ( v17 == 2 ) | |
3761 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3762 if ( (!v17 || v17 == 1) | |
816 | 3763 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3764 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3765 } |
3766 v16 = v17 + 1; | |
3767 } | |
3768 while ( v16 < 16 ); | |
3769 LABEL_36: | |
3770 if ( !v4 ) | |
3771 goto LABEL_87; | |
3772 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3773 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3774 break; | |
3775 case 20: | |
3776 v19 = 0; | |
3777 v20 = this->pInventoryIndices; | |
3778 do | |
3779 { | |
3780 if ( *v20 > 0 ) | |
3781 { | |
232 | 3782 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3783 if ( v21 > 0 ) |
3784 { | |
3785 if ( v21 <= 134 ) | |
3786 v46[v4++] = v19; | |
3787 } | |
3788 } | |
3789 ++v19; | |
3790 ++v20; | |
3791 } | |
3792 while ( v19 < 126 ); | |
3793 if ( !v4 ) | |
3794 goto LABEL_87; | |
3795 v47 = (unsigned __int8)v46[rand() % v4]; | |
3796 v6 = GetActualAccuracy(); | |
3797 LABEL_46: | |
3798 v7 = _48EA1B_get_static_effect(v6); | |
3799 LABEL_47: | |
3800 v11 = v7; | |
3801 break; | |
3802 default: | |
3803 v11 = 0; | |
3804 break; | |
3805 } | |
3806 v22 = GetActualLuck(); | |
3807 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3808 if ( rand() % v23 >= 30 ) | |
3809 { | |
3810 LABEL_87: | |
3811 result = 0; | |
3812 } | |
3813 else | |
3814 { | |
3815 switch ( a2 ) | |
3816 { | |
3817 case 1: | |
3818 v41 = 1; | |
3819 v36 = 0; | |
3820 goto LABEL_56; | |
3821 case 2: | |
3822 v41 = 1; | |
3823 v36 = 1; | |
3824 goto LABEL_56; | |
3825 case 3: | |
3826 v41 = 1; | |
3827 v36 = 2; | |
3828 goto LABEL_56; | |
3829 case 23: | |
3830 v41 = 1; | |
3831 v36 = 3; | |
3832 goto LABEL_56; | |
3833 case 4: | |
3834 v41 = 1; | |
3835 v36 = 4; | |
3836 LABEL_56: | |
3837 SetCondition(v36, v41); | |
3838 v42 = 0; | |
3839 v37 = 0; | |
3840 v35 = 0; | |
3841 v34 = 0; | |
3842 v33 = -1; | |
3843 v32 = 0; | |
3844 v31 = 0; | |
3845 v30 = (SoundID)221; | |
3846 goto LABEL_83; | |
3847 case 5: | |
3848 v43 = 1; | |
3849 v38 = 5; | |
3850 goto LABEL_70; | |
3851 case 6: | |
3852 case 7: | |
3853 case 8: | |
3854 if ( a2 == 6 ) | |
3855 { | |
3856 v44 = 6; | |
3857 goto LABEL_60; | |
3858 } | |
3859 v25 = 2 * (a2 != 8) + 8; | |
3860 goto LABEL_65; | |
3861 case 9: | |
3862 if ( a2 == 6 ) | |
3863 { | |
3864 v44 = 7; | |
3865 LABEL_60: | |
3866 v24 = v44; | |
3867 } | |
3868 else | |
3869 { | |
3870 v25 = 2 * (a2 != 8) + 9; | |
3871 LABEL_65: | |
3872 v24 = v25; | |
3873 } | |
3874 SetCondition(v24, 1); | |
3875 v42 = 0; | |
3876 v37 = 0; | |
3877 v35 = 0; | |
3878 v34 = 0; | |
3879 v33 = -1; | |
3880 v32 = 0; | |
3881 v31 = 0; | |
3882 v30 = (SoundID)222; | |
3883 LABEL_83: | |
3884 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3885 do | |
3886 { | |
3887 LABEL_84: | |
3888 if ( v5 == pPlayers[v3 + 1] ) | |
3889 break; | |
3890 ++v3; | |
3891 } | |
3892 while ( v3 < 4 ); | |
3893 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3894 result = 1; | |
3895 break; | |
3896 case 12: | |
3897 v43 = 1; | |
3898 v38 = 12; | |
3899 goto LABEL_70; | |
3900 case 15: | |
3901 v45 = 1; | |
3902 v39 = 15; | |
3903 goto LABEL_73; | |
3904 case 13: | |
3905 v43 = 1; | |
3906 v38 = 13; | |
3907 LABEL_70: | |
3908 SetCondition(v38, v43); | |
3909 v42 = 0; | |
3910 v37 = 0; | |
3911 v35 = 0; | |
3912 v34 = 0; | |
3913 v33 = -1; | |
3914 v32 = 0; | |
3915 v31 = 0; | |
3916 v30 = (SoundID)224; | |
3917 goto LABEL_83; | |
3918 case 14: | |
3919 v45 = 1; | |
3920 v39 = 14; | |
3921 goto LABEL_73; | |
3922 case 16: | |
3923 v45 = 1; | |
3924 v39 = 16; | |
3925 LABEL_73: | |
3926 SetCondition(v39, v45); | |
3927 v42 = 0; | |
3928 v37 = 0; | |
3929 v35 = 0; | |
3930 v34 = 0; | |
3931 v33 = -1; | |
3932 v32 = 0; | |
3933 v31 = 0; | |
3934 v30 = (SoundID)225; | |
3935 goto LABEL_83; | |
3936 case 17: | |
3937 case 18: | |
3938 case 19: | |
3939 v26 = v48; | |
3940 if ( *(char *)(v48 + 21) & 2 ) | |
3941 goto LABEL_84; | |
187 | 3942 PlaySound(SPEECH_40, 0); |
0 | 3943 *(int *)(v26 + 20) |= 2u; |
3944 goto LABEL_79; | |
3945 case 20: | |
187 | 3946 PlaySound(SPEECH_40, 0); |
0 | 3947 v27 = pActor->array_000234; |
3948 if ( pActor->array_000234[0].uItemID ) | |
3949 { | |
3950 v27 = &pActor->array_000234[1]; | |
3951 if ( pActor->array_000234[1].uItemID ) | |
3952 goto LABEL_84; | |
3953 } | |
3954 v28 = v47; | |
654 | 3955 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3956 RemoveItemAtInventoryIndex(v28); |
3957 LABEL_79: | |
3958 v42 = 0; | |
3959 v37 = 0; | |
3960 v35 = 0; | |
3961 v34 = 0; | |
3962 v33 = -1; | |
3963 v32 = 0; | |
3964 v31 = 0; | |
3965 v30 = (SoundID)47; | |
3966 goto LABEL_83; | |
3967 case 21: | |
187 | 3968 PlaySound(SPEECH_42, 0); |
0 | 3969 ++v5->sAgeModifier; |
3970 goto LABEL_82; | |
3971 case 22: | |
187 | 3972 PlaySound(SPEECH_41, 0); |
0 | 3973 v5->sMana = 0; |
3974 LABEL_82: | |
3975 v42 = 0; | |
3976 v37 = 0; | |
3977 v35 = 0; | |
3978 v34 = 0; | |
3979 v33 = -1; | |
3980 v32 = 0; | |
3981 v31 = 0; | |
3982 v30 = (SoundID)226; | |
3983 goto LABEL_83; | |
3984 default: | |
3985 goto LABEL_87; | |
3986 } | |
3987 } | |
3988 return result; | |
3989 } | |
324 | 3990 |
0 | 3991 // 48DCF6: using guessed type char var_94[140]; |
3992 | |
3993 //----- (0048E1A3) -------------------------------------------------------- | |
3994 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3995 { | |
3996 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
3997 } | |
3998 | |
3999 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4000 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4001 { | |
4002 ItemGen *weapon = nullptr; | |
4003 ItemDesc *weapon_desc = nullptr; | |
4004 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4005 if (bRangedAttack) | |
0 | 4006 { |
4007 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4008 goto LABEL_17; | |
816 | 4009 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4010 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4011 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4012 goto LABEL_17; | |
4013 } | |
4014 else if ( IsUnarmed() == 1 ) | |
4015 { | |
4016 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4017 { | |
4018 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4019 goto LABEL_17; |
4020 } | |
4021 } | |
816 | 4022 |
4023 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4024 { | |
4025 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4026 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4027 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4028 { | |
4029 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4030 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4031 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4032 } | |
0 | 4033 else |
816 | 4034 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4035 } | |
1010 | 4036 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
4037 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 4038 { |
898 | 4039 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4040 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
4041 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4042 { | |
898 | 4043 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4044 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
4045 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4046 } | |
4047 } | |
4048 | |
0 | 4049 LABEL_17: |
816 | 4050 uint armour_recovery = 0; |
0 | 4051 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4052 { | |
898 | 4053 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4054 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4055 | |
4056 float armour_recovery_multipliers[4]; | |
4057 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4058 { | |
4059 armour_recovery_multipliers[0] = 1.0f; | |
4060 armour_recovery_multipliers[1] = 0; | |
4061 armour_recovery_multipliers[2] = 0; | |
4062 armour_recovery_multipliers[3] = 0; | |
4063 } | |
4064 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4065 { | |
4066 armour_recovery_multipliers[0] = 1.0f; | |
4067 armour_recovery_multipliers[1] = 0.5f; | |
4068 armour_recovery_multipliers[2] = 0; | |
4069 armour_recovery_multipliers[3] = 0; | |
4070 } | |
4071 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4072 { | |
4073 armour_recovery_multipliers[0] = 1.0f; | |
4074 armour_recovery_multipliers[1] = 0.5f; | |
4075 armour_recovery_multipliers[2] = 0.5f; | |
4076 armour_recovery_multipliers[3] = 0; | |
0 | 4077 } |
4078 else | |
4079 { | |
816 | 4080 assert(false && "Unknown armour type"); // what kind of armour is that? |
4081 armour_recovery_multipliers[0] = 1.0f; | |
4082 armour_recovery_multipliers[1] = 1.0f; | |
4083 armour_recovery_multipliers[2] = 1.0f; | |
4084 armour_recovery_multipliers[3] = 1.0f; | |
4085 } | |
4086 | |
4087 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4088 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4089 } | |
4090 | |
4091 uint shield_recovery = 0; | |
4092 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4093 { | |
4094 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4095 | |
898 | 4096 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4097 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4098 | |
4099 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4100 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4101 } | |
4102 | |
4103 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4104 sword_axe_bow_recovery_reduction = 0; | |
4105 bool shooting_laser = false; | |
4106 if (weapon_desc) | |
4107 { | |
4108 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4109 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4110 { | |
4111 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4112 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4113 } | |
4114 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4115 shooting_laser = true; | |
4116 } | |
4117 | |
4118 uint armsmaster_recovery_reduction = 0; | |
4119 if (!bRangedAttack && !shooting_laser) | |
4120 { | |
4121 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4122 { | |
4123 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4124 if (SkillToMastery(armsmaster_level) >= 4) | |
4125 armsmaster_recovery_reduction *= 2; | |
4126 } | |
4127 } | |
4128 | |
4129 uint v41 = 0; | |
4130 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4131 v41 = 25; |
816 | 4132 |
4133 uint weapon_enchantment_recovery_reduction = 0; | |
4134 if ( weapon ) | |
4135 { | |
4136 if (weapon->uSpecEnchantmentType == 59 || | |
4137 weapon->uSpecEnchantmentType == 41 || | |
4138 weapon->uSpecEnchantmentType == 500) | |
4139 weapon_enchantment_recovery_reduction = 20; | |
4140 } | |
4141 | |
4142 | |
4143 int recovery = weapon_recovery + | |
4144 armour_recovery + | |
4145 shield_recovery | |
4146 - armsmaster_recovery_reduction | |
4147 - weapon_enchantment_recovery_reduction | |
4148 - v41 | |
4149 - sword_axe_bow_recovery_reduction | |
4150 - player_speed_recovery_reduction; | |
4151 | |
4152 if (recovery < 0) | |
4153 recovery = 0; | |
4154 return recovery; | |
0 | 4155 } |
4156 | |
4157 //----- (0048E4F8) -------------------------------------------------------- | |
4158 int Player::GetMaxHealth() | |
4159 { | |
4160 int v3; // esi@1 | |
4161 int v4; // esi@1 | |
4162 int v6; // esi@1 | |
4163 | |
4164 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4165 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4166 v6 = uFullHealthBonus |
135 | 4167 + pBaseHealthByClass[classType / 4] |
0 | 4168 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4169 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4170 if (v6 <= 0) | |
4171 return 1; | |
4172 return v6; | |
4173 } | |
4174 | |
4175 //----- (0048E565) -------------------------------------------------------- | |
4176 int Player::GetMaxMana() | |
4177 { | |
4178 int v2; // eax@2 | |
4179 int v3; // esi@4 | |
4180 int v4; // eax@5 | |
4181 int v5; // esi@5 | |
4182 int v6; // eax@5 | |
4183 int v7; // esi@6 | |
4184 int v8; // esi@6 | |
4185 int v9; // esi@6 | |
4186 int result; // eax@7 | |
4187 | |
135 | 4188 switch (classType) |
0 | 4189 { |
4190 case 5u: | |
4191 case 6u: | |
4192 case 7u: | |
4193 case 0x10u: | |
4194 case 0x11u: | |
4195 case 0x12u: | |
4196 case 0x13u: | |
4197 case 0x20u: | |
4198 case 0x21u: | |
4199 case 0x22u: | |
4200 case 0x23u: | |
4201 v2 = GetActualIntelligence(); | |
4202 v3 = _48EA1B_get_static_effect(v2); | |
4203 goto LABEL_6; | |
4204 case 9u: | |
4205 case 0xAu: | |
4206 case 0xBu: | |
4207 case 0xCu: | |
4208 case 0xDu: | |
4209 case 0xEu: | |
4210 case 0xFu: | |
4211 case 0x18u: | |
4212 case 0x19u: | |
4213 case 0x1Au: | |
4214 case 0x1Bu: | |
4215 v2 = GetActualWillpower(); | |
4216 v3 = _48EA1B_get_static_effect(v2); | |
4217 goto LABEL_6; | |
4218 case 0x15u: | |
4219 case 0x16u: | |
4220 case 0x17u: | |
4221 case 0x1Cu: | |
4222 case 0x1Du: | |
4223 case 0x1Eu: | |
4224 case 0x1Fu: | |
4225 v4 = GetActualWillpower(); | |
4226 v5 = _48EA1B_get_static_effect(v4); | |
4227 v6 = GetActualIntelligence(); | |
4228 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4229 LABEL_6: | |
135 | 4230 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4231 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4232 v9 = uFullManaBonus | |
135 | 4233 + pBaseManaByClass[classType / 4] |
0 | 4234 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4235 + v8; | |
4236 if ( v9 < 1 ) | |
4237 goto LABEL_7; | |
4238 result = v9; | |
4239 break; | |
4240 default: | |
4241 LABEL_7: | |
4242 result = 0; | |
4243 break; | |
4244 } | |
4245 return result; | |
4246 } | |
4247 | |
4248 //----- (0048E656) -------------------------------------------------------- | |
4249 int Player::GetBaseAC() | |
4250 { | |
4251 Player *v1; // edi@1 | |
4252 int v2; // eax@1 | |
4253 int v3; // esi@1 | |
4254 int v4; // esi@1 | |
4255 int v5; // esi@1 | |
4256 int result; // eax@2 | |
4257 | |
4258 v1 = this; | |
4259 v2 = GetActualSpeed(); | |
4260 v3 = _48EA1B_get_static_effect(v2); | |
4261 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4262 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4263 if ( v5 >= 1 ) | |
4264 result = v5; | |
4265 else | |
4266 result = 0; | |
4267 return result; | |
4268 } | |
4269 | |
4270 //----- (0048E68F) -------------------------------------------------------- | |
4271 int Player::GetActualAC() | |
4272 { | |
4273 Player *v1; // edi@1 | |
4274 int v2; // eax@1 | |
4275 int v3; // esi@1 | |
4276 int v4; // esi@1 | |
4277 int v5; // esi@1 | |
4278 int v6; // esi@1 | |
4279 int result; // eax@2 | |
4280 | |
4281 v1 = this; | |
4282 v2 = GetActualSpeed(); | |
4283 v3 = _48EA1B_get_static_effect(v2); | |
4284 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4285 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4286 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4287 if ( v6 >= 1 ) | |
4288 result = v6; | |
4289 else | |
4290 result = 0; | |
4291 return result; | |
4292 } | |
4293 | |
4294 //----- (0048E6DC) -------------------------------------------------------- | |
4295 unsigned int Player::GetBaseAge() | |
4296 { | |
352 | 4297 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4298 } |
4299 | |
4300 //----- (0048E72C) -------------------------------------------------------- | |
4301 unsigned int Player::GetActualAge() | |
4302 { | |
4303 return this->sAgeModifier + GetBaseAge(); | |
4304 } | |
4305 | |
4306 //----- (0048E73F) -------------------------------------------------------- | |
4307 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4308 { | |
4309 Player *v2; // ebx@1 | |
4310 signed int v3; // esi@1 | |
4311 enum CHARACTER_RACE v4; // eax@1 | |
4312 signed int v5; // edi@8 | |
4313 char v6; // zf@9 | |
4314 int v7; // esi@20 | |
4315 int result; // eax@21 | |
4316 signed int v9; // [sp-4h] [bp-10h]@11 | |
4317 | |
4318 v2 = this; | |
4319 v3 = 0; | |
4320 v4 = GetRace(); | |
4321 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4322 { | |
4323 v5 = 0; | |
4324 goto LABEL_16; | |
4325 } | |
4326 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4327 { | |
4328 v5 = 1; | |
4329 LABEL_16: | |
4330 v6 = v4 == 2; | |
4331 goto LABEL_17; | |
4332 } | |
4333 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4334 { | |
4335 v6 = v4 == 3; | |
4336 v5 = 2; | |
4337 goto LABEL_17; | |
4338 } | |
4339 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4340 { | |
4341 v5 = 3; | |
4342 v6 = v4 == 3; | |
4343 goto LABEL_17; | |
4344 } | |
4345 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4346 { | |
4347 v5 = 7; | |
4348 if ( v4 != 1 ) | |
4349 goto LABEL_20; | |
4350 v9 = 10; | |
4351 LABEL_19: | |
4352 v3 = v9; | |
4353 goto LABEL_20; | |
4354 } | |
4355 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4356 { | |
4357 v5 = 8; | |
4358 v6 = v4 == 0; | |
4359 LABEL_17: | |
4360 if ( !v6 ) | |
4361 goto LABEL_20; | |
4362 v9 = 5; | |
4363 goto LABEL_19; | |
4364 } | |
4365 v5 = 0; | |
4366 LABEL_20: | |
4367 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4368 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4369 result = v7 + *(&v2->sResFireBase + v5); |
4370 return result; | |
4371 } | |
4372 | |
4373 //----- (0048E7D0) -------------------------------------------------------- | |
4374 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4375 { | |
4376 signed int v2; // edi@1 | |
4377 Player *v3; // esi@1 | |
4378 enum CHARACTER_RACE v4; // ebx@1 | |
4379 char v6; // zf@18 | |
4380 int v7; // ebx@28 | |
4381 int result; // eax@28 | |
4382 signed int v9; // [sp+10h] [bp-8h]@1 | |
4383 signed int v10; // [sp+14h] [bp-4h]@1 | |
4384 | |
4385 v2 = 0; | |
4386 v3 = this; | |
4387 v10 = 0; | |
4388 v9 = 0; | |
4389 v4 = GetRace(); | |
652 | 4390 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4391 v10 = 20; |
4392 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4393 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4394 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4395 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4396 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4397 && HasItemEquipped(EQUIP_ARMOUR) | |
4398 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4399 v10 += v3->pActiveSkills[9] & 0x3F; | |
4400 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4401 goto LABEL_25; | |
4402 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4403 { | |
4404 v2 = 1; | |
4405 LABEL_25: | |
4406 v6 = v4 == 2; | |
4407 LABEL_26: | |
4408 if ( v6 ) | |
4409 v9 = 5; | |
4410 goto LABEL_28; | |
4411 } | |
4412 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4413 { | |
4414 v6 = v4 == 3; | |
4415 v2 = 2; | |
4416 goto LABEL_26; | |
4417 } | |
4418 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4419 { | |
4420 v2 = 3; | |
4421 if ( v4 == 3 ) | |
4422 v10 += 5; | |
4423 } | |
4424 else | |
4425 { | |
4426 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4427 { | |
4428 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4429 goto LABEL_28; | |
4430 v2 = 8; | |
4431 v6 = v4 == 0; | |
4432 goto LABEL_26; | |
4433 } | |
4434 v2 = 7; | |
4435 if ( v4 == 1 ) | |
4436 v9 = 10; | |
4437 } | |
4438 LABEL_28: | |
4439 v7 = GetItemsBonus(a2, 0); | |
4440 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4441 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4442 { |
4443 if ( result > 200 ) | |
4444 result = 200; | |
4445 } | |
4446 return result; | |
4447 } | |
4448 | |
4449 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4450 bool Player::Recover(int dt) |
4451 { | |
4452 //Player *v2; // esi@1 | |
0 | 4453 signed __int64 v3; // qax@1 |
816 | 4454 //bool result; // eax@4 |
4455 | |
4456 //v2 = this; | |
4457 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4458 | |
4459 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4460 | |
4461 if (uTimeToRecovery > v3) | |
4462 { | |
4463 uTimeToRecovery -= v3; | |
4464 return true; | |
0 | 4465 } |
4466 else | |
4467 { | |
816 | 4468 uTimeToRecovery = 0; |
4469 viewparams->bRedrawGameUI = true; | |
4470 if (!uActiveCharacter) | |
0 | 4471 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4472 return false; |
4473 } | |
0 | 4474 } |
4475 | |
4476 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4477 void Player::SetRecoveryTime(signed int rec) |
4478 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4479 assert(rec >= 0); |
816 | 4480 |
4481 if (rec > uTimeToRecovery) | |
4482 uTimeToRecovery = rec; | |
4483 | |
4484 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4485 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4486 |
4487 viewparams->bRedrawGameUI = true; | |
0 | 4488 } |
4489 // 50C0C4: using guessed type int some_active_character; | |
4490 | |
4491 //----- (0048E9B7) -------------------------------------------------------- | |
4492 void Player::RandomizeName() | |
4493 { | |
4494 if (!uExpressionTimePassed) | |
4495 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4496 } | |
4497 | |
4498 //----- (0048E9F4) -------------------------------------------------------- | |
4499 unsigned int Player::GetMajorConditionIdx() | |
4500 { | |
4501 for (uint i = 0; i < 18; ++i) | |
4502 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4503 return pConditionImportancyTable[i]; | |
4504 | |
4505 return 18; | |
4506 } | |
4507 | |
4508 //----- (0048EA1B) -------------------------------------------------------- | |
4509 int Player::_48EA1B_get_static_effect(int a2) | |
4510 { | |
4511 __int16 v2; // cx@1 | |
4512 int v3; // eax@1 | |
4513 | |
4514 v2 = word_4EDFFC[0]; | |
4515 v3 = 0; | |
4516 while ( a2 < v2 && v2 ) | |
4517 v2 = word_4EDFFC[v3++ + 1]; | |
4518 return player_stat_bonuses[v3]; | |
4519 } | |
4520 | |
4521 //----- (0048EA46) -------------------------------------------------------- | |
4522 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4523 { | |
4524 int v3; // esi@1 | |
4525 int v4; // edx@2 | |
4526 int v5; // eax@3 | |
4527 char *v6; // eax@4 | |
4528 | |
4529 v3 = 0; | |
4530 while ( 1 ) | |
4531 { | |
4532 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4533 goto LABEL_11; | |
816 | 4534 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4535 if ( a2 != 17 ) |
816 | 4536 { |
4537 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4538 goto LABEL_11; | |
4539 return 5; | |
4540 } | |
0 | 4541 v6 = (char *)this + 36 * v5; |
4542 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4543 return 50; | |
4544 LABEL_11: | |
4545 ++v3; | |
4546 if ( (signed int)v3 >= 16 ) | |
816 | 4547 return 0; |
4548 } | |
0 | 4549 } |
4550 | |
4551 //----- (0048EAAE) -------------------------------------------------------- | |
4552 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4553 { | |
4554 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4555 signed int v4; // eax@1 | |
4556 int v5; // edi@1 | |
4557 Player *v6; // ebx@1 | |
4558 Player *v8; // ecx@48 | |
4559 int v9; // eax@49 | |
4560 int v10; // edx@49 | |
4561 Player *v11; // ecx@55 | |
4562 int v12; // eax@56 | |
4563 int v13; // edx@56 | |
4564 int v14; // ecx@58 | |
4565 int v15; // eax@58 | |
4566 Player *v16; // ecx@61 | |
4567 int v17; // eax@62 | |
4568 Player *v18; // ecx@66 | |
4569 int v19; // eax@67 | |
4570 int v20; // eax@69 | |
4571 Player *v21; // ecx@75 | |
4572 int v22; // eax@76 | |
4573 int v23; // edx@76 | |
4574 int v24; // eax@79 | |
4575 int v25; // ecx@80 | |
4576 int v26; // edi@80 | |
4577 Player *v27; // ecx@84 | |
4578 int v28; // eax@85 | |
4579 int v29; // edx@85 | |
4580 Player *v30; // ecx@96 | |
4581 int v31; // ebp@97 | |
4582 int v32; // eax@98 | |
4583 unsigned int v33; // eax@100 | |
4584 int v34; // eax@103 | |
4585 char v35; // zf@104 | |
4586 char v36; // zf@107 | |
4587 unsigned __int8 v37; // zf@119 | |
4588 char v38; // sf@119 | |
4589 unsigned __int8 v39; // of@119 | |
4590 char v40; // zf@122 | |
4591 char v41; // zf@145 | |
4592 char v42; // zf@164 | |
4593 char v43; // zf@173 | |
4594 char v44; // zf@189 | |
4595 char v45; // zf@198 | |
4596 char v46; // zf@239 | |
4597 int v47; // eax@268 | |
4598 int v48; // eax@269 | |
4599 int v49; // eax@291 | |
4600 char v50; // zf@295 | |
4601 int v51; // eax@306 | |
4602 int v52; // eax@307 | |
4603 char v53; // zf@312 | |
4604 char v54; // zf@336 | |
4605 char v55; // zf@348 | |
4606 int v56; // eax@365 | |
4607 int v57; // ebx@368 | |
4608 signed int v58; // [sp-4h] [bp-20h]@10 | |
4609 signed int v59; // [sp-4h] [bp-20h]@71 | |
4610 signed int v60; // [sp-4h] [bp-20h]@347 | |
4611 int v61; // [sp+10h] [bp-Ch]@1 | |
4612 int v62; // [sp+14h] [bp-8h]@1 | |
4613 int v63; // [sp+18h] [bp-4h]@101 | |
4614 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4615 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4616 | |
4617 v3 = attr; | |
4618 v4 = 36; | |
4619 v5 = 0; | |
4620 v6 = this; | |
4621 v62 = 0; | |
4622 v61 = 0; | |
4623 | |
4624 switch (attr) | |
4625 { | |
4626 case CHARACTER_ATTRIBUTE_LEVEL: | |
4627 if (HasEnchantedItemEquipped(25)) | |
4628 return 5; | |
4629 return 0; | |
4630 }; | |
4631 | |
4632 if ( (signed int)attr > 36 ) | |
4633 { | |
4634 switch ( attr ) | |
4635 { | |
4636 case 37: | |
4637 v58 = 15; | |
4638 goto LABEL_35; | |
4639 case 38: | |
4640 v58 = 16; | |
4641 goto LABEL_35; | |
4642 case 39: | |
4643 v58 = 17; | |
4644 goto LABEL_35; | |
4645 case 40: | |
4646 v58 = 18; | |
4647 goto LABEL_35; | |
4648 case 41: | |
4649 v58 = 19; | |
4650 goto LABEL_35; | |
4651 case 42: | |
4652 v58 = 20; | |
4653 goto LABEL_35; | |
4654 case 43: | |
4655 v58 = 25; | |
4656 goto LABEL_35; | |
4657 case 44: | |
4658 v58 = 5; | |
4659 goto LABEL_35; | |
4660 case 45: | |
4661 v58 = 8; | |
4662 goto LABEL_35; | |
4663 case 46: | |
4664 goto LABEL_36; | |
4665 default: | |
4666 break; | |
4667 } | |
4668 } | |
4669 else | |
4670 { | |
4671 if ( attr == 36 ) | |
4672 { | |
4673 v58 = 14; | |
4674 } | |
4675 else | |
4676 { | |
4677 if ( (signed int)attr > 21 ) | |
4678 { | |
4679 switch ( attr ) | |
4680 { | |
4681 case 22: | |
4682 v58 = 30; | |
4683 break; | |
4684 case 23: | |
4685 v58 = 31; | |
4686 break; | |
4687 case 34: | |
4688 v58 = 12; | |
4689 break; | |
4690 default: | |
4691 if ( attr != 35 ) | |
4692 goto LABEL_38; | |
4693 v58 = 13; | |
4694 break; | |
4695 } | |
4696 } | |
4697 else | |
4698 { | |
4699 switch ( attr ) | |
4700 { | |
4701 case 21: | |
4702 v58 = 33; | |
4703 break; | |
4704 case 16: | |
4705 v58 = 35; | |
4706 break; | |
4707 case 17: | |
4708 v58 = 34; | |
4709 break; | |
4710 case 18: | |
4711 v58 = 29; | |
4712 break; | |
4713 case 19: | |
4714 v58 = 21; | |
4715 break; | |
4716 default: | |
4717 if ( attr != 20 ) | |
4718 goto LABEL_38; | |
4719 v58 = 32; | |
4720 break; | |
4721 } | |
4722 } | |
4723 } | |
4724 LABEL_35: | |
4725 v4 = v58; | |
4726 LABEL_36: | |
4727 if ( !this->pActiveSkills[v4] ) | |
4728 return 0; | |
4729 } | |
4730 LABEL_38: | |
4731 if ( (signed int)attr > 28 ) | |
4732 { | |
4733 if ( (signed int)attr < 29 ) | |
4734 return v5 + v62 + v61; | |
4735 if ( (signed int)attr <= 30 ) | |
4736 { | |
4737 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4738 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4739 return v5 + v62 + v61; |
4740 } | |
4741 if ( attr == 31 ) | |
4742 { | |
4743 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4744 return v5 + v62 + v61; | |
232 | 4745 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4746 v5 = pItemsTable->pItems[v57].uDamageMod; |
4747 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4748 goto LABEL_366; | |
4749 } | |
4750 if ( attr == 32 ) | |
4751 { | |
4752 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4753 return v5 + v62 + v61; | |
232 | 4754 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4755 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4756 LABEL_365: | |
4757 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4758 LABEL_366: | |
4759 v5 += v56; | |
4760 return v5 + v62 + v61; | |
4761 } | |
4762 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4763 return v5 + v62 + v61; | |
4764 LABEL_95: | |
4765 v65 = 0; | |
4766 while ( 1 ) | |
4767 { | |
4768 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4769 goto LABEL_361; | |
898 | 4770 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4771 if ( v3 == 9 ) |
4772 { | |
816 | 4773 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4774 if ( v32 >= 3 ) |
4775 { | |
4776 if ( v32 <= 11 ) | |
4777 { | |
4778 v33 = v6->pInventoryItems[v31].uItemID; | |
4779 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4780 } | |
4781 } | |
4782 } | |
4783 v63 = (int)((char *)v6 + 36 * v31); | |
4784 attra = (ItemGen *)(v63 + 532); | |
377 | 4785 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4786 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4787 { |
4788 v34 = attra->uItemID; | |
4789 switch ( attra->uItemID ) | |
4790 { | |
4791 case 0x1F4u: | |
4792 v35 = v3 == 5; | |
4793 goto LABEL_105; | |
4794 case 0x1F5u: | |
4795 v36 = v3 == 0; | |
4796 goto LABEL_108; | |
4797 case 0x1F6u: | |
4798 if ( v3 == 21 ) | |
4799 v61 += 10; | |
4800 v36 = v3 == 2; | |
4801 goto LABEL_108; | |
4802 case 0x1F7u: | |
4803 if ( v3 == 17 ) | |
4804 v61 += 5; | |
4805 if ( v3 == 18 ) | |
4806 v61 += 5; | |
4807 v36 = v3 == 6; | |
4808 goto LABEL_108; | |
4809 case 0x1F8u: | |
4810 goto LABEL_118; | |
4811 case 0x1F9u: | |
4812 v40 = v3 == 3; | |
4813 goto LABEL_123; | |
4814 case 0x1FAu: | |
4815 v35 = v3 == 10; | |
4816 goto LABEL_105; | |
4817 case 0x1FEu: | |
4818 v35 = v3 == 4; | |
4819 goto LABEL_105; | |
4820 case 0x1FFu: | |
4821 if ( v3 == 23 ) | |
4822 v61 += 10; | |
4823 if ( v3 == 22 ) | |
4824 v61 += 10; | |
4825 goto LABEL_361; | |
4826 case 0x200u: | |
4827 if ( v3 == 36 ) | |
4828 { | |
4829 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4830 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4831 } | |
4832 v36 = v3 == 5; | |
4833 LABEL_108: | |
4834 if ( v36 ) | |
4835 v5 += 40; | |
4836 goto LABEL_361; | |
4837 case 0x201u: | |
4838 if ( v3 == 39 ) | |
4839 { | |
4840 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4841 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4842 v62 = v34; | |
4843 } | |
4844 goto LABEL_136; | |
4845 case 0x202u: | |
4846 if ( !v3 ) | |
4847 v5 += 150; | |
4848 if ( v3 == 1 ) | |
4849 v5 -= 40; | |
4850 if ( v3 == 2 ) | |
4851 v5 -= 40; | |
4852 goto LABEL_145; | |
4853 case 0x203u: | |
4854 if ( v3 == 42 ) | |
4855 { | |
4856 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4857 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4858 } | |
4859 if ( v3 == 43 ) | |
4860 v61 += 15; | |
4861 goto LABEL_361; | |
4862 case 0x204u: | |
4863 if ( v3 == 17 ) | |
4864 v61 += 5; | |
4865 if ( v3 == 18 ) | |
4866 v61 += 5; | |
4867 if ( v3 == 6 ) | |
4868 v5 += 50; | |
4869 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4870 goto LABEL_166; | |
4871 v42 = v3 == 15; | |
4872 goto LABEL_165; | |
4873 case 0x205u: | |
4874 if ( v3 == 18 ) | |
4875 v61 += 5; | |
4876 goto LABEL_361; | |
4877 case 0x206u: | |
4878 if ( !v3 ) | |
4879 v5 += 100; | |
4880 if ( v3 == 3 ) | |
4881 v5 += 100; | |
4882 v43 = v3 == 9; | |
4883 goto LABEL_174; | |
4884 case 0x207u: | |
4885 if ( v3 == 45 ) | |
4886 v61 += 5; | |
4887 if ( v3 == 15 ) | |
4888 v5 -= 10; | |
4889 v42 = v3 == 14; | |
4890 LABEL_165: | |
4891 if ( v42 ) | |
4892 LABEL_166: | |
4893 v5 -= 10; | |
4894 goto LABEL_361; | |
4895 case 0x208u: | |
4896 v35 = v3 == 3; | |
4897 goto LABEL_105; | |
4898 case 0x209u: | |
4899 if ( v3 == 2 ) | |
4900 v5 += 15; | |
4901 if ( !v3 ) | |
4902 v5 += 15; | |
4903 v41 = v3 == 6; | |
4904 goto LABEL_146; | |
4905 case 0x20Au: | |
4906 if ( v3 == 46 ) | |
4907 v61 += 15; | |
4908 v44 = v3 == 3; | |
4909 goto LABEL_190; | |
4910 case 0x20Bu: | |
4911 if ( v3 == 34 ) | |
4912 { | |
4913 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4914 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4915 } | |
4916 if ( v3 == 12 ) | |
4917 v5 += 50; | |
4918 if ( v3 == 2 ) | |
4919 v5 += 30; | |
4920 v45 = v3 == 9; | |
4921 goto LABEL_199; | |
4922 case 0x20Cu: | |
4923 if ( !v3 ) | |
4924 v5 += 75; | |
4925 goto LABEL_145; | |
4926 case 0x20Du: | |
4927 if ( v3 == 5 ) | |
4928 v5 += 50; | |
4929 if ( v3 == 6 ) | |
4930 v5 += 50; | |
4931 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4932 goto LABEL_374; | |
4933 v43 = v3 == 15; | |
4934 LABEL_174: | |
4935 if ( v43 ) | |
4936 LABEL_374: | |
4937 v5 -= 15; | |
4938 goto LABEL_361; | |
4939 case 0x20Eu: | |
4940 if ( v3 == 4 ) | |
4941 v5 += 150; | |
4942 if ( v3 == 44 ) | |
4943 v61 += 5; | |
4944 if ( v3 == 9 ) | |
4945 v5 -= 25; | |
4946 goto LABEL_361; | |
4947 case 0x20Fu: | |
4948 if ( v3 == 39 ) | |
4949 { | |
4950 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4951 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4952 v62 = v34; | |
4953 } | |
4954 if ( v3 == 40 ) | |
4955 { | |
4956 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4957 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4958 } | |
4959 LABEL_145: | |
4960 v41 = v3 == 5; | |
4961 LABEL_146: | |
4962 if ( v41 ) | |
4963 v5 -= 40; | |
4964 goto LABEL_361; | |
4965 case 0x210u: | |
4966 if ( v3 == 38 ) | |
4967 { | |
4968 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4969 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4970 } | |
4971 if ( !v3 ) | |
4972 v5 += 75; | |
4973 v44 = v3 == 11; | |
4974 LABEL_190: | |
4975 if ( v44 ) | |
4976 v5 -= 50; | |
4977 goto LABEL_361; | |
4978 case 0x211u: | |
4979 if ( v3 == 5 ) | |
4980 v5 += 100; | |
4981 if ( v3 == 4 ) | |
4982 v5 += 50; | |
4983 v35 = v3 == 11; | |
4984 LABEL_105: | |
4985 if ( v35 ) | |
4986 v5 += 50; | |
4987 goto LABEL_361; | |
4988 case 0x212u: | |
4989 if ( v3 == 1 ) | |
4990 v5 -= 20; | |
4991 v45 = v3 == 2; | |
4992 LABEL_199: | |
4993 if ( v45 ) | |
4994 v5 -= 20; | |
4995 goto LABEL_361; | |
4996 case 0x214u: | |
4997 if ( v3 == 1 ) | |
4998 v5 += 15; | |
4999 v46 = v3 == 2; | |
5000 goto LABEL_240; | |
5001 case 0x215u: | |
5002 if ( v3 == 5 ) | |
5003 v5 += 15; | |
5004 v46 = v3 == 4; | |
5005 goto LABEL_240; | |
5006 case 0x216u: | |
5007 if ( v3 == 10 ) | |
5008 v5 += 30; | |
5009 if ( !v3 ) | |
5010 v5 += 15; | |
5011 goto LABEL_315; | |
5012 case 0x217u: | |
5013 if ( v3 == 21 ) | |
5014 v61 += 5; | |
5015 if ( !v3 ) | |
5016 v5 += 15; | |
5017 goto LABEL_253; | |
5018 case 0x218u: | |
5019 goto LABEL_253; | |
5020 default: | |
5021 goto LABEL_361; | |
5022 } | |
5023 goto LABEL_361; | |
5024 } | |
5025 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5026 { | |
5027 if ( (signed int)v3 >= 0 ) | |
5028 { | |
5029 if ( (signed int)v3 <= 15 ) | |
5030 { | |
5031 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5032 } | |
5033 else | |
5034 { | |
5035 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5036 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5037 } | |
5038 } | |
5039 goto LABEL_361; | |
5040 } | |
5041 v34 = *(int *)(v63 + 544); | |
5042 if ( v34 > 48 ) | |
5043 { | |
5044 switch ( v34 ) | |
5045 { | |
5046 case 54: | |
5047 goto LABEL_315; | |
5048 case 49: | |
5049 if ( v3 == 6 ) | |
5050 goto LABEL_121; | |
5051 v50 = v3 == 1; | |
5052 goto LABEL_296; | |
5053 case 51: | |
5054 if ( v3 != 5 && v3 != 1 ) | |
5055 goto LABEL_309; | |
5056 goto LABEL_121; | |
5057 case 52: | |
5058 if ( v3 == 3 ) | |
5059 goto LABEL_121; | |
5060 v50 = v3 == 4; | |
5061 goto LABEL_296; | |
5062 case 53: | |
5063 if ( !v3 ) | |
5064 goto LABEL_121; | |
5065 v50 = v3 == 2; | |
5066 goto LABEL_296; | |
5067 case 55: | |
5068 v46 = v3 == 6; | |
5069 goto LABEL_240; | |
5070 case 56: | |
5071 if ( !v3 ) | |
5072 goto LABEL_351; | |
5073 v53 = v3 == 3; | |
5074 goto LABEL_350; | |
5075 case 57: | |
5076 if ( v3 == 1 ) | |
5077 goto LABEL_351; | |
5078 v53 = v3 == 2; | |
5079 goto LABEL_350; | |
5080 case 50: | |
5081 if ( v3 == 10 ) | |
5082 v5 += 30; | |
5083 goto LABEL_361; | |
5084 case 60: | |
5085 if ( v3 != 23 ) | |
5086 goto LABEL_336; | |
5087 if ( v5 >= 3 ) | |
5088 goto LABEL_361; | |
5089 v5 = 3; | |
5090 LABEL_336: | |
5091 v54 = v3 == 22; | |
5092 goto LABEL_345; | |
5093 case 61: | |
5094 if ( v3 != 17 ) | |
5095 goto LABEL_340; | |
5096 if ( v5 >= 3 ) | |
5097 goto LABEL_361; | |
5098 v5 = 3; | |
5099 LABEL_340: | |
5100 v54 = v3 == 18; | |
5101 goto LABEL_345; | |
5102 case 62: | |
5103 if ( v3 != 19 ) | |
5104 goto LABEL_344; | |
5105 if ( v5 >= 3 ) | |
5106 goto LABEL_361; | |
5107 v5 = 3; | |
5108 LABEL_344: | |
5109 v54 = v3 == 20; | |
5110 LABEL_345: | |
5111 if ( !v54 ) | |
5112 goto LABEL_361; | |
5113 if ( v5 >= 3 ) | |
5114 goto LABEL_361; | |
5115 v60 = 3; | |
5116 goto LABEL_360; | |
5117 case 67: | |
5118 v55 = v3 == 18; | |
5119 goto LABEL_357; | |
5120 case 68: | |
5121 v53 = v3 == 9; | |
5122 goto LABEL_350; | |
5123 case 69: | |
5124 if ( v3 == 11 ) | |
5125 v5 += 20; | |
5126 break; | |
5127 case 70: | |
5128 if ( v3 == 12 ) | |
5129 v5 += 10; | |
5130 v55 = v3 == 16; | |
5131 LABEL_357: | |
5132 if ( v55 && v5 < 2 ) | |
5133 { | |
5134 v60 = 2; | |
5135 LABEL_360: | |
5136 v5 = v60; | |
5137 } | |
5138 break; | |
5139 default: | |
5140 goto LABEL_361; | |
5141 } | |
5142 goto LABEL_361; | |
5143 } | |
5144 if ( v34 == 48 ) | |
5145 { | |
5146 if ( v3 == 9 ) | |
5147 v5 += 5; | |
5148 LABEL_315: | |
5149 v46 = v3 == 3; | |
5150 LABEL_240: | |
5151 if ( v46 ) | |
5152 v5 += 15; | |
5153 goto LABEL_361; | |
5154 } | |
5155 if ( v34 > 32 ) | |
5156 { | |
5157 if ( v34 > 44 ) | |
5158 { | |
5159 v51 = v34 - 45; | |
5160 if ( !v51 ) | |
5161 { | |
5162 if ( v3 == 5 ) | |
5163 goto LABEL_351; | |
5164 v53 = v3 == 4; | |
5165 LABEL_350: | |
5166 if ( v53 ) | |
5167 LABEL_351: | |
5168 v5 += 5; | |
5169 goto LABEL_361; | |
5170 } | |
5171 v52 = v51 - 1; | |
5172 if ( !v52 ) | |
5173 { | |
5174 v40 = v3 == 0; | |
5175 LABEL_123: | |
5176 if ( v40 ) | |
5177 v5 += 25; | |
5178 goto LABEL_361; | |
5179 } | |
5180 if ( v52 == 1 ) | |
5181 { | |
5182 LABEL_309: | |
5183 v50 = v3 == 8; | |
5184 goto LABEL_296; | |
5185 } | |
5186 } | |
5187 else | |
5188 { | |
5189 if ( v34 == 44 ) | |
5190 { | |
5191 v50 = v3 == 7; | |
5192 goto LABEL_296; | |
5193 } | |
5194 v34 -= 33; | |
5195 if ( !v34 ) | |
5196 { | |
5197 if ( v3 != 38 ) | |
5198 goto LABEL_361; | |
5199 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5200 goto LABEL_138; | |
5201 } | |
5202 --v34; | |
5203 if ( !v34 ) | |
5204 { | |
5205 if ( v3 != 36 ) | |
5206 goto LABEL_361; | |
5207 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5208 goto LABEL_138; | |
5209 } | |
5210 v49 = v34 - 8; | |
5211 if ( !v49 ) | |
5212 { | |
5213 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5214 ++v5; | |
5215 goto LABEL_361; | |
5216 } | |
5217 if ( v49 == 1 ) | |
5218 { | |
5219 if ( v3 != 3 && v3 != 7 ) | |
5220 { | |
5221 v50 = v3 == 9; | |
5222 LABEL_296: | |
5223 if ( !v50 ) | |
5224 goto LABEL_361; | |
5225 } | |
5226 LABEL_121: | |
5227 v5 += 10; | |
5228 goto LABEL_361; | |
5229 } | |
5230 } | |
5231 } | |
5232 else | |
5233 { | |
5234 if ( v34 == 32 ) | |
5235 { | |
5236 if ( v3 != 39 ) | |
5237 goto LABEL_361; | |
5238 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5239 goto LABEL_138; | |
5240 } | |
5241 if ( v34 > 28 ) | |
5242 { | |
5243 v34 -= 29; | |
5244 if ( v34 ) | |
5245 { | |
5246 --v34; | |
5247 if ( v34 ) | |
5248 { | |
5249 --v34; | |
5250 if ( v34 || v3 != 41 ) | |
5251 goto LABEL_361; | |
5252 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5253 } | |
5254 else | |
5255 { | |
5256 if ( v3 != 34 ) | |
5257 goto LABEL_361; | |
5258 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5259 } | |
5260 } | |
5261 else | |
5262 { | |
5263 if ( v3 != 37 ) | |
5264 goto LABEL_361; | |
5265 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5266 } | |
5267 goto LABEL_138; | |
5268 } | |
5269 if ( v34 == 28 ) | |
5270 { | |
5271 LABEL_136: | |
5272 if ( v3 == 42 ) | |
5273 { | |
5274 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5275 LABEL_138: | |
5276 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5277 goto LABEL_361; | |
5278 } | |
5279 } | |
5280 else | |
5281 { | |
5282 v47 = v34 - 1; | |
5283 if ( v47 ) | |
5284 { | |
5285 v48 = v47 - 1; | |
5286 if ( v48 ) | |
5287 { | |
5288 v34 = v48 - 24; | |
5289 if ( v34 ) | |
5290 { | |
5291 --v34; | |
5292 if ( v34 || v3 != 40 ) | |
5293 goto LABEL_361; | |
5294 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5295 } | |
5296 else | |
5297 { | |
5298 if ( v3 != 35 ) | |
5299 goto LABEL_361; | |
5300 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5301 } | |
5302 goto LABEL_138; | |
5303 } | |
5304 LABEL_118: | |
5305 if ( (signed int)v3 < 0 ) | |
5306 goto LABEL_361; | |
5307 v39 = __OFSUB__((int)v3, 6); | |
5308 v37 = v3 == 6; | |
5309 v38 = v3 - 6 < 0; | |
5310 } | |
5311 else | |
5312 { | |
5313 LABEL_253: | |
5314 if ( (signed int)v3 < 10 ) | |
5315 goto LABEL_361; | |
5316 v39 = __OFSUB__((int)v3, 15); | |
5317 v37 = v3 == 15; | |
5318 v38 = v3 - 15 < 0; | |
5319 } | |
5320 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5321 goto LABEL_121; | |
5322 } | |
5323 } | |
5324 LABEL_361: | |
5325 ++v65; | |
5326 if ( (signed int)v65 >= 16 ) | |
5327 return v5 + v62 + v61; | |
5328 } | |
5329 } | |
5330 if ( attr == 28 ) | |
5331 { | |
5332 if ( IsUnarmed() != 1 ) | |
5333 { | |
816 | 5334 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5335 { | |
5336 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5337 if ( v22 >= 0 ) |
5338 { | |
5339 if ( v22 <= 2 ) | |
5340 { | |
118 | 5341 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5342 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5343 { |
5344 v24 = v23; | |
5345 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5346 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5347 } | |
5348 else | |
5349 { | |
5350 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5351 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5352 } | |
5353 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5354 } | |
5355 } | |
5356 } | |
865 | 5357 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5358 return v5 + v62 + v61; |
5359 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5360 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5361 goto LABEL_88; | |
5362 } | |
5363 v59 = 3; | |
5364 LABEL_74: | |
5365 v5 = v59; | |
5366 return v5 + v62 + v61; | |
5367 } | |
5368 if ( (signed int)attr < 0 ) | |
5369 return v5 + v62 + v61; | |
5370 if ( (signed int)attr <= 23 ) | |
5371 goto LABEL_95; | |
5372 if ( (signed int)attr <= 24 ) | |
5373 return v5 + v62 + v61; | |
5374 if ( (signed int)attr <= 26 ) | |
5375 { | |
5376 if ( IsUnarmed() == 1 ) | |
5377 { | |
5378 v5 = 0; | |
5379 return v5 + v62 + v61; | |
5380 } | |
816 | 5381 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5382 { | |
5383 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5384 if ( v17 >= 0 ) |
5385 { | |
5386 if ( v17 <= 2 ) | |
232 | 5387 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5388 } |
5389 } | |
865 | 5390 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5391 return v5 + v62 + v61; |
898 | 5392 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5393 goto LABEL_365; |
5394 } | |
5395 if ( attr == 27 ) | |
5396 { | |
5397 if ( IsUnarmed() == 1 ) | |
5398 { | |
5399 v5 = 1; | |
5400 return v5 + v62 + v61; | |
5401 } | |
816 | 5402 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5403 { | |
5404 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5405 if ( v9 >= 0 ) |
5406 { | |
5407 if ( v9 <= 2 ) | |
5408 { | |
118 | 5409 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
898 | 5410 if ( !v6->pEquipment.uShield ) |
0 | 5411 { |
118 | 5412 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5413 ++v5; |
5414 } | |
5415 } | |
5416 } | |
5417 } | |
865 | 5418 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5419 return v5 + v62 + v61; |
898 | 5420 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5421 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5422 LABEL_88: |
5423 v5 += v15 + v14; | |
5424 } | |
5425 return v5 + v62 + v61; | |
5426 } | |
5427 | |
5428 //----- (0048F73C) -------------------------------------------------------- | |
5429 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5430 { | |
5431 int result; // eax@1 | |
5432 int v3; // eax@4 | |
5433 int v4; // ecx@5 | |
5434 | |
5435 switch (a2) | |
5436 { | |
5437 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5438 } | |
5439 | |
5440 result = 0; | |
5441 if ( (signed int)a2 > 10 ) | |
5442 { | |
5443 if ( (signed int)a2 <= 15 ) | |
5444 { | |
5445 switch ( a2 ) | |
5446 { | |
5447 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5448 v3 = this->pPlayerBuffs[2].uPower; | |
5449 v4 = pParty->pPartyBuffs[1].uPower; | |
5450 break; | |
5451 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5452 v3 = this->pPlayerBuffs[0].uPower; | |
5453 v4 = pParty->pPartyBuffs[0].uPower; | |
5454 break; | |
5455 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5456 v3 = this->pPlayerBuffs[22].uPower; | |
5457 v4 = pParty->pPartyBuffs[17].uPower; | |
5458 break; | |
5459 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5460 v3 = this->pPlayerBuffs[3].uPower; | |
5461 v4 = pParty->pPartyBuffs[4].uPower; | |
5462 break; | |
5463 default: | |
5464 if ( a2 != 14 ) | |
5465 return result; | |
5466 v3 = this->pPlayerBuffs[9].uPower; | |
5467 v4 = pParty->pPartyBuffs[12].uPower; | |
5468 break; | |
5469 } | |
5470 return v4 + v3; | |
5471 } | |
5472 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5473 { | |
5474 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5475 { | |
5476 v3 = this->pPlayerBuffs[8].uPower; | |
5477 v4 = pParty->pPartyBuffs[9].uPower; | |
5478 return v4 + v3; | |
5479 } | |
5480 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5481 return result; | |
5482 } | |
5483 return this->pPlayerBuffs[1].uPower; | |
5484 } | |
5485 if ( a2 == 10 ) | |
5486 { | |
5487 v3 = this->pPlayerBuffs[5].uPower; | |
5488 v4 = pParty->pPartyBuffs[6].uPower; | |
5489 return v4 + v3; | |
5490 } | |
5491 switch ( a2 ) | |
5492 { | |
5493 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5494 v3 = pPlayerBuffs[19].uPower; | |
5495 goto LABEL_5; | |
5496 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5497 v3 = pPlayerBuffs[17].uPower; | |
5498 goto LABEL_5; | |
5499 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5500 v3 = pPlayerBuffs[20].uPower; | |
5501 goto LABEL_5; | |
5502 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5503 v3 = pPlayerBuffs[16].uPower; | |
5504 goto LABEL_5; | |
5505 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5506 v3 = pPlayerBuffs[15].uPower; | |
5507 goto LABEL_5; | |
5508 case CHARACTER_ATTRIBUTE_SPEED: | |
5509 v3 = pPlayerBuffs[21].uPower; | |
5510 goto LABEL_5; | |
5511 case CHARACTER_ATTRIBUTE_LUCK: | |
5512 v3 = pPlayerBuffs[18].uPower; | |
5513 LABEL_5: | |
5514 v4 = pParty->pPartyBuffs[2].uPower; | |
5515 return v4 + v3; | |
5516 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5517 v3 = this->pPlayerBuffs[14].uPower; | |
5518 v4 = pParty->pPartyBuffs[15].uPower; | |
5519 return v4 + v3; | |
5520 default: | |
5521 return result; | |
5522 } | |
5523 return result; | |
5524 } | |
5525 | |
5526 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5527 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5528 { | |
0 | 5529 signed int v2; // esi@1 |
5530 unsigned __int16 v3; // ax@126 | |
5531 char result; // al@127 | |
5532 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5533 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5534 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5535 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5536 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5537 | |
0 | 5538 v2 = 0; |
353 | 5539 switch (uSkillType) |
5540 { | |
5541 case PLAYER_SKILL_MONSTER_ID: | |
5542 { | |
652 | 5543 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5544 v2 = 6; |
652 | 5545 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5546 v2 += 6; |
5547 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5548 v2 += GetItemsBonus(v8, 0); | |
5549 } | |
5550 break; | |
5551 | |
5552 case PLAYER_SKILL_ARMSMASTER: | |
5553 { | |
652 | 5554 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5555 v2 = 2; |
652 | 5556 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5557 v2 += 3; |
353 | 5558 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5559 v2 += GetItemsBonus(v8, 0); | |
5560 } | |
5561 break; | |
5562 | |
5563 case PLAYER_SKILL_STEALING: | |
5564 { | |
652 | 5565 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5566 v2 = 8; |
5567 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5568 v2 += GetItemsBonus(v8, 0); | |
5569 } | |
5570 break; | |
5571 | |
5572 | |
5573 case PLAYER_SKILL_ALCHEMY: | |
5574 { | |
652 | 5575 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5576 v2 = 4; |
652 | 5577 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5578 v2 += 8; |
5579 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5580 v2 += GetItemsBonus(v8, 0); | |
5581 } | |
5582 break; | |
5583 | |
5584 case PLAYER_SKILL_LEARNING: | |
5585 { | |
652 | 5586 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5587 v2 = 10; |
652 | 5588 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5589 v2 += 15; |
652 | 5590 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5591 v2 += 5; |
5592 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5593 v2 += GetItemsBonus(v8, 0); | |
5594 } | |
5595 break; | |
5596 | |
5597 case PLAYER_SKILL_UNARMED: | |
5598 { | |
652 | 5599 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5600 v2 = 2; |
5601 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5602 v2 += GetItemsBonus(v8, 0); | |
5603 } | |
5604 break; | |
5605 | |
5606 case PLAYER_SKILL_DODGE: | |
5607 { | |
652 | 5608 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5609 v2 = 2; |
5610 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5611 v2 += GetItemsBonus(v8, 0); | |
5612 } | |
5613 break; | |
5614 | |
5615 case PLAYER_SKILL_BOW: | |
5616 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5617 v2 += GetItemsBonus(v8, 0); | |
5618 break; | |
5619 case PLAYER_SKILL_SHIELD: | |
5620 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5621 v2 += GetItemsBonus(v8, 0); | |
5622 break; | |
5623 | |
5624 case PLAYER_SKILL_EARTH: | |
652 | 5625 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5626 v2 = 2; |
652 | 5627 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5628 v2 += 3; |
652 | 5629 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5630 v2 += 4; |
5631 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5632 v2 += 3; | |
5633 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5634 v2 += GetItemsBonus(v8, 0); | |
5635 break; | |
5636 case PLAYER_SKILL_FIRE: | |
652 | 5637 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5638 v2 = 2; |
652 | 5639 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5640 v2 += 3; |
652 | 5641 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5642 v2 += 4; |
5643 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5644 v2 += 3; | |
5645 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5646 v2 += GetItemsBonus(v8, 0); | |
5647 break; | |
5648 case PLAYER_SKILL_AIR: | |
652 | 5649 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5650 v2 = 2; |
652 | 5651 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5652 v2 += 3; |
652 | 5653 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5654 v2 += 4; |
5655 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5656 v2 += 3; | |
5657 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5658 v2 += GetItemsBonus(v8, 0); | |
5659 break; | |
5660 case PLAYER_SKILL_WATER: | |
652 | 5661 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5662 v2 = 2; |
652 | 5663 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5664 v2 += 3; |
652 | 5665 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5666 v2 += 4; |
5667 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5668 v2 += 3; | |
5669 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5670 v2 += GetItemsBonus(v8, 0); | |
5671 break; | |
5672 case PLAYER_SKILL_SPIRIT: | |
652 | 5673 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5674 v2 = 2; |
652 | 5675 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5676 v2 += 3; |
652 | 5677 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5678 v2 += 4; |
5679 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5680 v2 += GetItemsBonus(v8, 0); | |
5681 break; | |
5682 case PLAYER_SKILL_MIND: | |
652 | 5683 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5684 v2 = 2; |
652 | 5685 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5686 v2 += 3; |
652 | 5687 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5688 v2 += 4; |
5689 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5690 v2 += GetItemsBonus(v8, 0); | |
5691 break; | |
5692 case PLAYER_SKILL_BODY: | |
652 | 5693 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5694 v2 = 2; |
652 | 5695 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5696 v2 += 3; |
652 | 5697 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5698 v2 += 4; |
5699 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5700 v2 += GetItemsBonus(v8, 0); | |
5701 break; | |
5702 case PLAYER_SKILL_LIGHT: | |
5703 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5704 v2 += GetItemsBonus(v8, 0); | |
5705 break; | |
5706 case PLAYER_SKILL_DARK: | |
5707 { | |
5708 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5709 v2 += GetItemsBonus(v8, 0); | |
5710 } | |
5711 break; | |
5712 | |
5713 case PLAYER_SKILL_MERCHANT: | |
5714 { | |
652 | 5715 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5716 v2 = 4; |
652 | 5717 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5718 v2 += 6; |
652 | 5719 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5720 v2 += 3; |
652 | 5721 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5722 v2 += 8; |
5723 } | |
5724 break; | |
5725 | |
5726 case PLAYER_SKILL_PERCEPTION: | |
5727 { | |
652 | 5728 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5729 v2 = 6; |
652 | 5730 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5731 v2 += 5; |
5732 } | |
5733 break; | |
5734 | |
0 | 5735 case PLAYER_SKILL_ITEM_ID: |
5736 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5737 v2 += GetItemsBonus(v8, 0); |
0 | 5738 break; |
5739 case PLAYER_SKILL_MEDITATION: | |
5740 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5741 v2 += GetItemsBonus(v8, 0); |
5742 break; | |
0 | 5743 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5744 { |
652 | 5745 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5746 v2 = 4; |
652 | 5747 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5748 v2 += 6; |
652 | 5749 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5750 v2 += 8; |
0 | 5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5752 v2 += GetItemsBonus(v8, 0); |
5753 } | |
5754 break; | |
5755 } | |
5756 | |
5757 v3 = pActiveSkills[uSkillType]; | |
1008 | 5758 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5759 result = v2 + v3; |
5760 else | |
1008 | 5761 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5762 return result; |
5763 } | |
5764 | |
5765 //----- (0048FC00) -------------------------------------------------------- | |
5766 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5767 { | |
5768 Player *v2; // esi@1 | |
5769 int v3; // eax@1 | |
5770 char v4; // di@1 | |
5771 signed int v5; // ebx@1 | |
5772 unsigned int v6; // eax@2 | |
5773 unsigned __int8 v7; // sf@5 | |
5774 unsigned __int8 v8; // of@5 | |
5775 PlayerEquipment *v9; // ebx@19 | |
5776 Player *v10; // ecx@20 | |
821 | 5777 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5778 int v12; // eax@21 |
5779 int v13; // edi@21 | |
5780 char v14; // di@25 | |
5781 signed int v15; // esi@25 | |
5782 char v16; // al@32 | |
5783 int v18; // eax@36 | |
5784 unsigned int v19; // eax@37 | |
5785 ITEM_EQUIP_TYPE v20; // edi@40 | |
5786 int v21; // edx@41 | |
5787 int v22; // eax@42 | |
821 | 5788 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5789 unsigned __int16 v24; // ax@45 |
5790 unsigned __int16 v25; // bx@45 | |
5791 unsigned int v26; // eax@45 | |
5792 unsigned __int8 v27; // sf@50 | |
5793 unsigned __int8 v28; // of@50 | |
5794 unsigned int v29; // eax@52 | |
5795 int v30; // eax@55 | |
5796 int v31; // eax@58 | |
5797 unsigned int v32; // eax@59 | |
5798 int v33; // eax@65 | |
5799 char v34; // si@65 | |
5800 ITEM_EQUIP_TYPE v35; // edi@69 | |
5801 int v36; // edx@70 | |
5802 int v37; // eax@71 | |
821 | 5803 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5804 int v39; // eax@74 |
5805 int v40; // eax@89 | |
5806 char v41; // si@89 | |
5807 int v42; // eax@96 | |
821 | 5808 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5809 int v44; // eax@97 |
5810 int v45; // eax@98 | |
5811 int v46; // eax@99 | |
5812 int v47; // eax@100 | |
5813 int v48; // eax@101 | |
5814 int v49; // eax@102 | |
5815 unsigned __int16 v50; // ax@113 | |
5816 char v51; // di@113 | |
5817 unsigned int v52; // eax@113 | |
5818 int v53; // edi@113 | |
5819 signed int i; // ecx@113 | |
5820 unsigned __int16 v55; // ax@118 | |
5821 char v56; // si@118 | |
5822 unsigned int v57; // eax@118 | |
5823 int v58; // esi@121 | |
5824 signed int j; // ecx@121 | |
5825 int v60; // edi@126 | |
5826 int v61; // eax@126 | |
5827 signed int v62; // [sp-4h] [bp-30h]@26 | |
5828 signed int v63; // [sp-4h] [bp-30h]@80 | |
5829 int v64; // [sp+Ch] [bp-20h]@104 | |
5830 int v65; // [sp+10h] [bp-1Ch]@104 | |
5831 int v66; // [sp+14h] [bp-18h]@104 | |
5832 int v67; // [sp+18h] [bp-14h]@104 | |
5833 int v68; // [sp+1Ch] [bp-10h]@69 | |
5834 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5835 int v70; // [sp+24h] [bp-8h]@1 | |
5836 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5837 int a1; // [sp+34h] [bp+8h]@21 | |
5838 int a1a; // [sp+34h] [bp+8h]@74 | |
5839 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5840 | |
5841 v2 = this; | |
5842 v70 = 0; | |
5843 v69 = 0; | |
5844 v71 = (ITEM_EQUIP_TYPE)0; | |
5845 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5846 v4 = v3; | |
5847 v5 = 1; | |
5848 if ( v3 ) | |
5849 { | |
5850 v6 = SkillToMastery(v3); | |
5851 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5852 { | |
5853 if ( (signed int)v6 >= 4 ) | |
5854 goto LABEL_4; | |
5855 v8 = __OFSUB__(v6, 3); | |
5856 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5857 } | |
5858 else | |
5859 { | |
5860 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5861 goto LABEL_11; | |
5862 if ( (signed int)v6 >= 4 ) | |
5863 { | |
5864 LABEL_4: | |
5865 v71 = (ITEM_EQUIP_TYPE)2; | |
5866 LABEL_11: | |
5867 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5868 goto LABEL_12; | |
5869 } | |
5870 v8 = __OFSUB__(v6, 2); | |
5871 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5872 } | |
5873 if ( !(v7 ^ v8) ) | |
5874 v71 = (ITEM_EQUIP_TYPE)1; | |
5875 goto LABEL_11; | |
5876 } | |
5877 LABEL_12: | |
5878 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5879 { | |
135 | 5880 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5881 v61 = v2->GetBodybuilding(); |
5882 return v60 * v61; | |
5883 } | |
5884 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5885 { | |
135 | 5886 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5887 v61 = v2->GetMeditation(); |
0 | 5888 return v60 * v61; |
5889 } | |
5890 if ( a2 != 9 ) | |
5891 { | |
5892 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5893 { | |
5894 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5895 return v70; | |
5896 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5897 { | |
5898 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5899 return v70; | |
5900 v71 = (ITEM_EQUIP_TYPE)0; | |
5901 v9 = &v2->pEquipment; | |
5902 while ( 1 ) | |
5903 { | |
5904 if ( v2->HasItemEquipped(v71) ) | |
5905 { | |
118 | 5906 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5907 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5908 a1 = v12; |
5909 SkillToMastery(v12); | |
5910 v13 = v11 - 5; | |
5911 if ( !v13 ) | |
5912 return a1 & 0x3F; | |
5913 if ( v13 == 2 ) | |
5914 break; | |
5915 } | |
5916 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5917 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5918 if ( (signed int)v71 >= 16 ) | |
5919 return v70; | |
5920 } | |
5921 v14 = a1; | |
5922 v15 = 1; | |
5923 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5924 { | |
5925 v62 = 5; | |
5926 goto LABEL_31; | |
5927 } | |
5928 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5929 { | |
5930 v62 = 3; | |
5931 goto LABEL_31; | |
5932 } | |
5933 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5934 goto LABEL_32; | |
5935 goto LABEL_30; | |
5936 } | |
5937 if ( v2->IsUnarmed() ) | |
5938 { | |
5939 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5940 v14 = v18; | |
5941 if ( !v18 ) | |
5942 return v70; | |
5943 v15 = 0; | |
5944 v19 = SkillToMastery(v18); | |
5945 if ( (signed int)v19 < 3 ) | |
5946 { | |
5947 if ( (signed int)v19 >= 2 ) | |
5948 v15 = 1; | |
5949 LABEL_32: | |
5950 v16 = v14; | |
5951 return v15 * (v16 & 0x3F); | |
5952 } | |
5953 LABEL_30: | |
5954 v62 = 2; | |
5955 LABEL_31: | |
5956 v15 = v62; | |
5957 goto LABEL_32; | |
5958 } | |
5959 v20 = (ITEM_EQUIP_TYPE)0; | |
5960 while ( 1 ) | |
5961 { | |
5962 if ( v2->HasItemEquipped(v20) ) | |
5963 { | |
118 | 5964 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5965 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5966 break; | |
5967 } | |
5968 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5969 if ( (signed int)v20 >= 16 ) | |
5970 return v70; | |
5971 } | |
5972 v71 = (ITEM_EQUIP_TYPE)0; | |
5973 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5974 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5975 v25 = v24; | |
5976 v26 = SkillToMastery(v24); | |
5977 if ( !v23 ) | |
5978 { | |
5979 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5980 { | |
5981 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5982 LOBYTE(v25) = v31; | |
5983 if ( v31 ) | |
5984 { | |
5985 v15 = 0; | |
5986 v32 = SkillToMastery(v31); | |
5987 if ( (signed int)v32 < 3 ) | |
5988 { | |
5989 if ( (signed int)v32 >= 2 ) | |
5990 v15 = 1; | |
5991 } | |
5992 else | |
5993 { | |
5994 v15 = 2; | |
5995 } | |
5996 v16 = v25; | |
5997 return v15 * (v16 & 0x3F); | |
5998 } | |
5999 } | |
6000 goto LABEL_55; | |
6001 } | |
6002 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6003 { | |
6004 v29 = SkillToMastery(v25); | |
6005 v28 = __OFSUB__(v29, 4); | |
6006 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6007 } | |
6008 else | |
6009 { | |
6010 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6011 goto LABEL_55; | |
6012 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6013 { | |
6014 if ( v23 == PLAYER_SKILL_MACE ) | |
6015 { | |
6016 v28 = __OFSUB__(v26, 2); | |
118 | 6017 v27 = v26 - 2 < 0; |
0 | 6018 goto LABEL_53; |
6019 } | |
6020 LABEL_55: | |
6021 v30 = v71 * (v25 & 0x3F); | |
6022 return (int)((char *)v69 + v30); | |
6023 } | |
6024 v28 = __OFSUB__(v26, 3); | |
118 | 6025 v27 = v26 - 3 < 0; |
0 | 6026 } |
6027 LABEL_53: | |
6028 if ( !(v27 ^ v28) ) | |
6029 v71 = (ITEM_EQUIP_TYPE)1; | |
6030 goto LABEL_55; | |
6031 } | |
6032 if ( v2->IsUnarmed() == 1 ) | |
6033 { | |
6034 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6035 v34 = v33; | |
6036 if ( !v33 ) | |
6037 return v70; | |
6038 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6039 v5 = 2; | |
6040 v30 = v5 * (v34 & 0x3F); | |
6041 return (int)((char *)v69 + v30); | |
6042 } | |
6043 v35 = (ITEM_EQUIP_TYPE)0; | |
6044 v68 = 0; | |
6045 while ( 1 ) | |
6046 { | |
6047 if ( v2->HasItemEquipped(v35) ) | |
6048 { | |
118 | 6049 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6050 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6051 break; | |
6052 } | |
6053 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6054 if ( (signed int)v35 >= 16 ) | |
6055 return v70; | |
6056 } | |
6057 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6058 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6059 a1a = v39; | |
6060 SkillToMastery(v39); | |
6061 v71 = (ITEM_EQUIP_TYPE)0; | |
6062 if ( v38 ) | |
6063 { | |
6064 if ( (signed int)v38 > 0 ) | |
6065 { | |
6066 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6067 { | |
6068 v71 = (ITEM_EQUIP_TYPE)1; | |
6069 } | |
6070 else | |
6071 { | |
6072 if ( v38 == 7 ) | |
6073 { | |
6074 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6075 { | |
6076 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6077 { | |
6078 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6079 return v5 * (a1a & 0x3F); | |
6080 v63 = 2; | |
6081 } | |
6082 else | |
6083 { | |
6084 v63 = 3; | |
6085 } | |
6086 } | |
6087 else | |
6088 { | |
6089 v63 = 5; | |
6090 } | |
6091 v5 = v63; | |
6092 return v5 * (a1a & 0x3F); | |
6093 } | |
6094 } | |
6095 } | |
6096 } | |
6097 else | |
6098 { | |
6099 v71 = (ITEM_EQUIP_TYPE)1; | |
6100 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6101 { | |
6102 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6103 v41 = v40; | |
6104 if ( v40 ) | |
6105 { | |
6106 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6107 v5 = 2; | |
6108 v68 = v5 * (v41 & 0x3F); | |
6109 } | |
6110 } | |
6111 } | |
6112 v30 = v68 + v71 * (a1a & 0x3F); | |
6113 return (int)((char *)v69 + v30); | |
6114 } | |
6115 a1b = 0; | |
6116 v71 = (ITEM_EQUIP_TYPE)0; | |
6117 v68 = 16; | |
6118 v69 = &v2->pEquipment; | |
6119 do | |
6120 { | |
898 | 6121 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6122 goto LABEL_117; |
6123 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6124 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6125 if ( !v44 ) | |
6126 { | |
6127 v64 = 0; | |
6128 v65 = 1; | |
6129 LABEL_111: | |
6130 v66 = 0; | |
6131 goto LABEL_112; | |
6132 } | |
6133 v45 = v44 - 1; | |
6134 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6135 { | |
6136 v64 = 0; | |
6137 v65 = 0; | |
6138 v66 = 0; | |
6139 v67 = 1; | |
6140 goto LABEL_113; | |
6141 } | |
6142 v47 = v46 - 4; | |
6143 if ( v47 ) | |
6144 { | |
6145 v48 = v47 - 1; | |
6146 if ( v48 ) | |
6147 { | |
6148 v49 = v48 - 1; | |
6149 if ( v49 ) | |
6150 { | |
6151 if ( v49 != 1 ) | |
6152 goto LABEL_117; | |
6153 a1b = 1; | |
6154 v64 = 1; | |
6155 v65 = 0; | |
6156 v66 = 0; | |
6157 v67 = 0; | |
6158 goto LABEL_113; | |
6159 } | |
6160 a1b = 1; | |
6161 v64 = 1; | |
6162 v65 = 0; | |
6163 goto LABEL_111; | |
6164 } | |
6165 v71 = (ITEM_EQUIP_TYPE)1; | |
6166 } | |
6167 else | |
6168 { | |
6169 a1b = 1; | |
6170 } | |
6171 v64 = 1; | |
6172 v65 = 0; | |
6173 v66 = 1; | |
6174 LABEL_112: | |
6175 v67 = 0; | |
6176 LABEL_113: | |
6177 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6178 v51 = v50; | |
6179 v52 = SkillToMastery(v50); | |
6180 v53 = v51 & 0x3F; | |
6181 for ( i = 0; i < (signed int)v52; ++i ) | |
6182 { | |
6183 if ( *(&v64 + i) ) | |
6184 v70 += v53; | |
6185 } | |
6186 LABEL_117: | |
6187 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6188 --v68; | |
6189 } | |
6190 while ( v68 ); | |
6191 v64 = 1; | |
6192 v65 = 1; | |
6193 v66 = 1; | |
6194 v67 = 0; | |
6195 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6196 v56 = v55; | |
6197 v57 = SkillToMastery(v55); | |
6198 if ( !a1b && (!v71 || v57 == 4) ) | |
6199 { | |
6200 v58 = v56 & 0x3F; | |
6201 for ( j = 0; j < (signed int)v57; ++j ) | |
6202 { | |
6203 if ( *(&v64 + j) ) | |
6204 v70 += v58; | |
6205 } | |
6206 } | |
6207 return v70; | |
6208 } | |
6209 | |
6210 //----- (00490109) -------------------------------------------------------- | |
6211 // faces are: 0 1 2 3 human males | |
6212 // 4 5 6 7 human females | |
6213 // 8 9 elf males | |
6214 // 10 11 elf females | |
6215 // 12 13 dwarf males | |
6216 // 14 15 dwarf females | |
6217 // 16 17 goblin males | |
6218 // 18 19 goblin females | |
6219 // 20 lich male | |
6220 // 21 lich female | |
6221 // 22 underwater suits (unused) | |
6222 // 23 zombie male | |
6223 // 24 zombie female | |
6224 enum CHARACTER_RACE Player::GetRace() | |
6225 { | |
1014 | 6226 if ( uCurrentFace > 15 ) |
6227 { | |
6228 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6229 return CHARACTER_RACE_GOBLIN; |
6230 } | |
6231 else | |
6232 { | |
1014 | 6233 if ( uCurrentFace >= 12 ) |
0 | 6234 { |
6235 return CHARACTER_RACE_DWARF; | |
6236 } | |
6237 else | |
6238 { | |
1014 | 6239 |
6240 if ( uCurrentFace <= 7 ) | |
0 | 6241 { |
6242 return CHARACTER_RACE_HUMAN; | |
6243 } | |
6244 else | |
6245 { | |
1014 | 6246 if ( uCurrentFace <= 11 ) |
0 | 6247 return CHARACTER_RACE_ELF; |
6248 } | |
6249 } | |
6250 } | |
6251 return CHARACTER_RACE_HUMAN; | |
6252 } | |
6253 | |
6254 //----- (00490141) -------------------------------------------------------- | |
187 | 6255 PLAYER_SEX Player::GetSexByVoice() |
0 | 6256 { |
6257 signed int result; // eax@1 | |
6258 | |
6259 result = 0; | |
6260 switch ( this->uVoiceID ) | |
6261 { | |
6262 case 0u: | |
6263 case 1u: | |
6264 case 2u: | |
6265 case 3u: | |
6266 case 8u: | |
6267 case 9u: | |
6268 case 0xCu: | |
6269 case 0xDu: | |
6270 case 0x10u: | |
6271 case 0x11u: | |
6272 case 0x14u: | |
6273 case 0x17u: | |
187 | 6274 return SEX_MALE; |
6275 | |
0 | 6276 case 4u: |
6277 case 5u: | |
6278 case 6u: | |
6279 case 7u: | |
6280 case 0xAu: | |
6281 case 0xBu: | |
6282 case 0xEu: | |
6283 case 0xFu: | |
6284 case 0x12u: | |
6285 case 0x13u: | |
6286 case 0x15u: | |
6287 case 0x18u: | |
187 | 6288 return SEX_FEMALE; |
6289 | |
0 | 6290 default: |
187 | 6291 assert(false); |
6292 } | |
0 | 6293 } |
6294 | |
6295 //----- (00490188) -------------------------------------------------------- | |
6296 void Player::SetInitialStats() | |
6297 { | |
6298 auto v1 = GetRace(); | |
290 | 6299 uMight = StatTable[v1][0].uBaseValue; |
6300 uIntelligence = StatTable[v1][1].uBaseValue; | |
6301 uWillpower = StatTable[v1][2].uBaseValue; | |
6302 uEndurance = StatTable[v1][3].uBaseValue; | |
6303 uAccuracy = StatTable[v1][4].uBaseValue; | |
6304 uSpeed = StatTable[v1][5].uBaseValue; | |
6305 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6306 } |
6307 | |
6308 //----- (004901FC) -------------------------------------------------------- | |
6309 int Player::SetSexByVoice() | |
6310 { | |
6311 __int64 v1; // qax@1 | |
6312 | |
6313 v1 = this->uVoiceID; | |
6314 switch ( (int)v1 ) | |
6315 { | |
6316 case 0: | |
6317 case 1: | |
6318 case 2: | |
6319 case 3: | |
6320 case 8: | |
6321 case 9: | |
6322 case 0xC: | |
6323 case 0xD: | |
6324 case 0x10: | |
6325 case 0x11: | |
6326 case 0x14: | |
6327 case 0x17: | |
6328 BYTE4(v1) = 0; | |
6329 break; | |
6330 case 4: | |
6331 case 5: | |
6332 case 6: | |
6333 case 7: | |
6334 case 0xA: | |
6335 case 0xB: | |
6336 case 0xE: | |
6337 case 0xF: | |
6338 case 0x12: | |
6339 case 0x13: | |
6340 case 0x15: | |
6341 case 0x18: | |
6342 BYTE4(v1) = 1; | |
6343 break; | |
6344 default: | |
6345 break; | |
6346 } | |
6347 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6348 return v1; | |
6349 } | |
6350 | |
6351 //----- (0049024A) -------------------------------------------------------- | |
135 | 6352 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6353 { |
6354 sLevelModifier = 0; | |
6355 sAgeModifier = 0; | |
6356 | |
135 | 6357 classType = cls; |
0 | 6358 uLuckBonus = 0; |
6359 uSpeedBonus = 0; | |
6360 uAccuracyBonus = 0; | |
6361 uEnduranceBonus = 0; | |
6362 uWillpowerBonus = 0; | |
6363 uIntelligenceBonus = 0; | |
6364 uMightBonus = 0; | |
6365 uLevel = 1; | |
6366 uExperience = 251 + rand() % 100; | |
6367 uBirthYear = 1147 - rand() % 6; | |
6368 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6369 memset(_guilds_member_bits, 0, 64); |
0 | 6370 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6371 | |
6372 for (uint i = 0; i < 37; ++i) | |
6373 { | |
135 | 6374 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6375 continue; |
6376 | |
6377 pActiveSkills[i] = 1; | |
6378 | |
6379 switch (i) | |
6380 { | |
886 | 6381 case PLAYER_SKILL_FIRE: |
6382 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6383 |
6384 extern bool all_magic; | |
6385 if ( all_magic == true ) | |
6386 { | |
6387 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6388 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6389 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6390 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6391 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6392 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6393 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6394 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6395 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6396 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6397 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6398 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6399 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6400 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6401 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6402 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6403 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6404 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6405 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6406 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6407 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6408 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6409 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6410 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6411 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6412 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6413 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6414 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6415 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6416 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6417 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6418 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6419 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6420 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6421 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6422 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6423 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6424 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6425 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6426 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6427 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6428 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6429 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6430 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6431 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6432 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6433 } | |
486 | 6434 break; |
886 | 6435 case PLAYER_SKILL_AIR: |
6436 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6437 break; | |
6438 case PLAYER_SKILL_WATER: | |
6439 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6440 break; | |
6441 case PLAYER_SKILL_EARTH: | |
6442 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6443 break; | |
6444 case PLAYER_SKILL_SPIRIT: | |
6445 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6446 break; | |
6447 case PLAYER_SKILL_MIND: | |
6448 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6449 break; | |
6450 case PLAYER_SKILL_BODY: | |
6451 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6452 |
6453 if ( all_magic == true ) | |
6454 { | |
6455 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6456 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6457 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6458 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6459 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6460 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6461 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6462 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6463 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6464 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6465 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6466 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6467 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6468 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6469 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6470 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6471 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6472 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6473 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6474 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6475 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6476 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6477 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6478 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6479 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6480 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6481 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6482 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6483 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6484 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6485 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6486 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6487 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6488 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6489 } | |
569 | 6490 break; |
886 | 6491 case PLAYER_SKILL_LIGHT: |
6492 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6493 break; | |
6494 case PLAYER_SKILL_DARK: | |
6495 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6496 break; | |
0 | 6497 } |
6498 } | |
6499 | |
6500 sHealth = GetMaxHealth(); | |
6501 sMana = GetMaxMana(); | |
6502 } | |
6503 | |
6504 //----- (004903C9) -------------------------------------------------------- | |
821 | 6505 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6506 { | |
6507 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6508 int v3; // edx@5 |
6509 char *v4; // ecx@5 | |
6510 int v5; // esi@11 | |
6511 unsigned __int16 *v6; // edx@11 | |
6512 int v7; // esi@18 | |
6513 unsigned __int16 *pActiveSkill; // edx@18 | |
6514 | |
6515 if ( order >= 0 ) | |
6516 { | |
6517 if ( order <= 1 ) | |
6518 { | |
6519 result = (PLAYER_SKILL_TYPE)0; | |
6520 v7 = 0; | |
6521 pActiveSkill = this->pActiveSkills; | |
6522 do | |
6523 { | |
135 | 6524 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6525 { |
6526 if ( v7 == order ) | |
6527 return result; | |
6528 ++v7; | |
6529 } | |
6530 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6531 ++pActiveSkill; | |
6532 } | |
6533 while ( (signed int)result < 37 ); | |
6534 } | |
6535 else | |
6536 { | |
6537 if ( order <= 3 ) | |
6538 { | |
6539 result = (PLAYER_SKILL_TYPE)0; | |
6540 v5 = 0; | |
6541 pActiveSkill = this->pActiveSkills; | |
6542 do | |
6543 { | |
135 | 6544 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6545 { |
6546 if ( v5 == order - 2 ) | |
6547 return result; | |
6548 ++v5; | |
6549 } | |
6550 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6551 ++pActiveSkill; | |
6552 } | |
6553 while ( (signed int)result < 37 ); | |
6554 } | |
6555 else | |
6556 { | |
6557 if ( order <= 12 ) | |
6558 { | |
6559 result = (PLAYER_SKILL_TYPE)0; | |
6560 v3 = 0; | |
135 | 6561 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6562 do |
6563 { | |
6564 if ( *v4 == 1 ) | |
6565 { | |
6566 if ( v3 == order - 4 ) | |
6567 return result; | |
6568 ++v3; | |
6569 } | |
6570 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6571 ++v4; | |
6572 } | |
6573 while ( (signed int)result < 37 ); | |
6574 } | |
6575 } | |
6576 } | |
6577 } | |
6578 return (PLAYER_SKILL_TYPE)37; | |
6579 } | |
6580 | |
6581 | |
6582 | |
6583 //----- (0049048D) -------------------------------------------------------- | |
6584 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6585 void Player::DecreaseAttribute(int eAttribute) | |
6586 { | |
6587 int v2; // eax@1 | |
6588 int pBaseValue; // ecx@1 | |
6589 int pDroppedStep; // ebx@1 | |
6590 int pStep; // esi@1 | |
6591 unsigned __int16 result; // ax@7 | |
6592 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6593 | |
6594 v2 = eAttribute + 7 * GetRace(); | |
290 | 6595 pBaseValue = StatTable[0][v2].uBaseValue; |
6596 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6597 uMinValue = pBaseValue - 2; |
290 | 6598 pStep = StatTable[0][v2].uBaseStep; |
0 | 6599 switch ( eAttribute ) |
6600 { | |
6601 case CHARACTER_MIGHT: | |
6602 if ( this->uMight <= pBaseValue ) | |
6603 pStep = pDroppedStep; | |
6604 if ( this->uMight - pStep >= uMinValue ) | |
6605 this->uMight -= pStep; | |
6606 break; | |
6607 case CHARACTER_INTELLIGANCE: | |
6608 if ( this->uIntelligence <= pBaseValue ) | |
6609 pStep = pDroppedStep; | |
6610 if ( this->uIntelligence - pStep >= uMinValue ) | |
6611 this->uIntelligence -= pStep; | |
6612 break; | |
6613 case CHARACTER_WILLPOWER: | |
6614 if ( this->uWillpower <= pBaseValue ) | |
6615 pStep = pDroppedStep; | |
6616 if ( this->uWillpower - pStep >= uMinValue ) | |
6617 this->uWillpower -= pStep; | |
6618 break; | |
6619 case CHARACTER_ENDURANCE: | |
6620 if ( this->uEndurance <= pBaseValue ) | |
6621 pStep = pDroppedStep; | |
6622 if ( this->uEndurance - pStep >= uMinValue ) | |
6623 this->uEndurance -= pStep; | |
6624 break; | |
6625 case CHARACTER_ACCURACY: | |
6626 if ( this->uAccuracy <= pBaseValue ) | |
6627 pStep = pDroppedStep; | |
6628 if ( this->uAccuracy - pStep >= uMinValue ) | |
6629 this->uAccuracy -= pStep; | |
6630 break; | |
6631 case CHARACTER_SPEED: | |
6632 if ( this->uSpeed <= pBaseValue ) | |
6633 pStep = pDroppedStep; | |
6634 if ( this->uSpeed - pStep >= uMinValue ) | |
6635 this->uSpeed -= pStep; | |
6636 break; | |
6637 case CHARACTER_LUCK: | |
6638 if ( this->uLuck <= pBaseValue ) | |
6639 pStep = pDroppedStep; | |
6640 if ( this->uLuck - pStep >= uMinValue ) | |
6641 this->uLuck -= pStep; | |
6642 break; | |
6643 } | |
6644 } | |
6645 | |
6646 //----- (004905F5) -------------------------------------------------------- | |
6647 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6648 int Player::IncreaseAttribute(int eAttribute) | |
6649 { | |
6650 Player *v2; // esi@1 | |
6651 int v3; // eax@1 | |
6652 int v4; // ebx@1 | |
6653 signed int v5; // edi@1 | |
6654 int v6; // eax@8 | |
6655 signed int v7; // eax@17 | |
6656 signed int result; // eax@18 | |
6657 int v9; // [sp+Ch] [bp-8h]@1 | |
6658 signed int v10; // [sp+10h] [bp-4h]@1 | |
6659 | |
6660 v2 = this; | |
6661 v3 = eAttribute + 7 * GetRace(); | |
290 | 6662 v4 = StatTable[0][v3].uMaxValue; |
6663 v5 = StatTable[0][v3].uBaseStep; | |
6664 v9 = StatTable[0][v3].uBaseValue; | |
6665 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6666 PlayerCreation_ComputeAttributeBonus(); |
6667 if ( eAttribute ) | |
6668 { | |
6669 switch ( eAttribute ) | |
6670 { | |
6671 case 1: | |
6672 v6 = v2->uIntelligence; | |
6673 break; | |
6674 case 2: | |
6675 v6 = v2->uWillpower; | |
6676 break; | |
6677 case 3: | |
6678 v6 = v2->uEndurance; | |
6679 break; | |
6680 case 4: | |
6681 v6 = v2->uAccuracy; | |
6682 break; | |
6683 case 5: | |
6684 v6 = v2->uSpeed; | |
6685 break; | |
6686 case 6: | |
6687 v6 = v2->uLuck; | |
6688 break; | |
6689 default: | |
6690 v6 = eAttribute; | |
6691 break; | |
6692 } | |
6693 } | |
6694 else | |
6695 { | |
6696 v6 = v2->uMight; | |
6697 } | |
6698 if ( v6 < v9 ) | |
6699 { | |
6700 v7 = v5; | |
6701 v5 = v10; | |
6702 v10 = v7; | |
6703 } | |
6704 result = PlayerCreation_ComputeAttributeBonus(); | |
6705 if ( result >= v10 ) | |
6706 { | |
6707 if ( eAttribute ) | |
6708 { | |
6709 switch ( eAttribute ) | |
6710 { | |
6711 case 1: | |
6712 result = (signed int)&v2->uIntelligence; | |
6713 break; | |
6714 case 2: | |
6715 result = (signed int)&v2->uWillpower; | |
6716 break; | |
6717 case 3: | |
6718 result = (signed int)&v2->uEndurance; | |
6719 break; | |
6720 case 4: | |
6721 result = (signed int)&v2->uAccuracy; | |
6722 break; | |
6723 case 5: | |
6724 result = (signed int)&v2->uSpeed; | |
6725 break; | |
6726 default: | |
6727 result = eAttribute - 6; | |
6728 if ( eAttribute != 6 ) | |
6729 return result; | |
6730 result = (signed int)&v2->uLuck; | |
6731 break; | |
6732 } | |
6733 } | |
6734 else | |
6735 { | |
6736 result = (signed int)&v2->uMight; | |
6737 } | |
6738 if ( v5 + *(short *)result <= v4 ) | |
6739 *(short *)result += v5; | |
6740 } | |
6741 return result; | |
6742 } | |
6743 | |
6744 //----- (0049070F) -------------------------------------------------------- | |
6745 void Player::Zero() | |
6746 { | |
6747 Player *v1; // esi@1 | |
6748 | |
6749 v1 = this; | |
6750 this->sLevelModifier = 0; | |
6751 this->sACModifier = 0; | |
6752 this->uLuckBonus = 0; | |
6753 this->uAccuracyBonus = 0; | |
6754 this->uSpeedBonus = 0; | |
6755 this->uEnduranceBonus = 0; | |
6756 this->uWillpowerBonus = 0; | |
6757 this->uIntelligenceBonus = 0; | |
6758 this->uMightBonus = 0; | |
6759 this->field_100 = 0; | |
6760 this->field_FC = 0; | |
6761 this->field_F8 = 0; | |
6762 this->field_F4 = 0; | |
6763 this->field_F0 = 0; | |
6764 this->field_EC = 0; | |
6765 this->field_E8 = 0; | |
6766 this->field_E4 = 0; | |
6767 this->field_E0 = 0; | |
766 | 6768 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6769 v1->field_1A97 = 0; |
6770 v1->_ranged_dmg_bonus = 0; | |
6771 v1->field_1A95 = 0; | |
6772 v1->_ranged_atk_bonus = 0; | |
6773 v1->field_1A93 = 0; | |
6774 v1->_melee_dmg_bonus = 0; | |
6775 v1->field_1A91 = 0; | |
6776 v1->_some_attack_bonus = 0; | |
6777 v1->_mana_related = 0; | |
6778 v1->uFullManaBonus = 0; | |
6779 v1->_health_related = 0; | |
6780 v1->uFullHealthBonus = 0; | |
6781 } | |
6782 | |
6783 //----- (004907E7) -------------------------------------------------------- | |
299 | 6784 unsigned int Player::GetStatColor(int uStat) |
0 | 6785 { |
6786 __int16 uWhite; // si@1 | |
290 | 6787 int attribute_value; // edx@1 |
299 | 6788 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6789 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6790 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6791 | |
1014 | 6792 uRed = TargetColor(255, 35, 0); |
6793 uGreen = TargetColor(0, 255, 0); | |
6794 uWhite = TargetColor(255, 255, 255); | |
299 | 6795 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6796 |
0 | 6797 switch (uStat) |
6798 { | |
6799 case 0: attribute_value = uMight; break; | |
6800 case 1: attribute_value = uIntelligence; break; | |
6801 case 2: attribute_value = uWillpower; break; | |
6802 case 3: attribute_value = uEndurance; break; | |
290 | 6803 case 4: attribute_value = uAccuracy; break; |
6804 case 5: attribute_value = uSpeed; break; | |
0 | 6805 case 6: attribute_value = uLuck; break; |
6806 }; | |
6807 | |
299 | 6808 if ( attribute_value == pBaseAttrValue ) |
290 | 6809 return uWhite; |
299 | 6810 else if ( attribute_value > pBaseAttrValue ) |
290 | 6811 return uGreen; |
0 | 6812 else |
290 | 6813 return uRed; |
0 | 6814 } |
6815 | |
6816 //----- (004908A8) -------------------------------------------------------- | |
6817 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6818 { | |
1014 | 6819 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6820 { | |
6821 pConditions[uCondition]=0i64; | |
6822 return true; | |
0 | 6823 } |
6824 else | |
1014 | 6825 return false; |
0 | 6826 } |
6827 | |
6828 //----- (004680ED) -------------------------------------------------------- | |
6829 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6830 { | |
6831 Player *v3; // esi@1 | |
6832 unsigned int v4; // ebx@4 | |
6833 signed int v5; // eax@17 | |
6834 unsigned int v6; // eax@26 | |
6835 unsigned __int8 v7; // cf@37 | |
6836 int v8; // edx@39 | |
6837 int v9; // edx@40 | |
6838 int v10; // edx@41 | |
6839 int v11; // edx@42 | |
6840 int v12; // edx@43 | |
6841 char *v13; // eax@45 | |
6842 AudioPlayer *v14; // ecx@62 | |
6843 signed int v15; // edi@68 | |
6844 int v16; // edx@73 | |
6845 unsigned __int16 *v17; // edi@73 | |
6846 unsigned int v18; // eax@73 | |
6847 int v19; // eax@74 | |
6848 int v20; // eax@75 | |
6849 signed int v21; // eax@81 | |
6850 const char *v22; // eax@84 | |
6851 char *v23; // ecx@90 | |
6852 int v24; // esi@96 | |
6853 int v25; // eax@109 | |
6854 int v26; // eax@113 | |
6855 char *v27; // edi@114 | |
6856 signed __int64 v28; // qax@120 | |
6857 char *v29; // ecx@120 | |
6858 int v30; // edi@137 | |
6859 int v31; // ST30_4@137 | |
6860 int v32; // ST3C_4@137 | |
6861 int v33; // ST40_4@137 | |
6862 int v34; // ST34_4@137 | |
6863 int v35; // ST38_4@137 | |
6864 unsigned __int8 v36; // al@173 | |
6865 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6866 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6867 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6868 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6869 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6870 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6871 signed int v43; // [sp-14h] [bp-40h]@18 | |
6872 signed int v44; // [sp-14h] [bp-40h]@174 | |
6873 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6874 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6875 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6876 int v48; // [sp-Ch] [bp-38h]@18 | |
6877 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6878 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6879 int v51; // [sp-Ch] [bp-38h]@174 | |
6880 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6881 char *v53; // [sp-8h] [bp-34h]@33 | |
6882 int v54; // [sp-8h] [bp-34h]@34 | |
6883 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6884 int v56; // [sp-8h] [bp-34h]@66 | |
6885 const char *v57; // [sp-8h] [bp-34h]@69 | |
6886 const char *v58; // [sp-8h] [bp-34h]@89 | |
6887 int v59; // [sp-8h] [bp-34h]@120 | |
6888 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6889 int v61; // [sp-4h] [bp-30h]@18 | |
6890 char *v62; // [sp-4h] [bp-30h]@33 | |
6891 char *v63; // [sp-4h] [bp-30h]@34 | |
6892 int v64; // [sp-4h] [bp-30h]@60 | |
6893 int v65; // [sp-4h] [bp-30h]@66 | |
6894 const char *v66; // [sp-4h] [bp-30h]@69 | |
6895 signed int v67; // [sp-4h] [bp-30h]@77 | |
6896 const char *v68; // [sp-4h] [bp-30h]@89 | |
6897 int v69; // [sp-4h] [bp-30h]@110 | |
6898 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6899 int v71; // [sp-4h] [bp-30h]@174 | |
6900 char *v72; // [sp+20h] [bp-Ch]@68 | |
6901 signed int v73; // [sp+24h] [bp-8h]@1 | |
6902 char *v74; // [sp+24h] [bp-8h]@23 | |
6903 int v75; // [sp+24h] [bp-8h]@73 | |
6904 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6905 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6906 | |
6907 thisb = this; | |
243 | 6908 v3 = &pParty->pPlayers[a2-1]; |
0 | 6909 v73 = 1; |
6910 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6911 return; | |
6912 v4 = 0; | |
6913 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6914 { | |
6915 if ( pParty->pPickedItem.uItemID != 160 ) | |
6916 { | |
6917 if ( pParty->pPickedItem.uItemID == 161 ) | |
6918 { | |
6919 v27 = (char *)&v3->sMana; | |
6920 *(int *)v27 += 2; | |
6921 LABEL_170: | |
6922 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6923 *(int *)v27 = v3->GetMaxMana(); | |
6924 } | |
6925 else | |
6926 { | |
6927 if ( pParty->pPickedItem.uItemID != 162 ) | |
6928 { | |
6929 LABEL_167: | |
6930 v68 = pParty->pPickedItem.GetDisplayName(); | |
6931 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6932 goto LABEL_90; | |
6933 } | |
6934 v69 = 2; | |
6935 LABEL_111: | |
243 | 6936 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6937 } |
6938 LABEL_112: | |
187 | 6939 v3->PlaySound(SPEECH_36, 0); |
0 | 6940 goto LABEL_173; |
6941 } | |
6942 LABEL_172: | |
100 | 6943 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6944 goto LABEL_173; |
6945 } | |
6946 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6947 { | |
6948 switch ( pParty->pPickedItem.uItemID ) | |
6949 { | |
6950 case 0xDEu: | |
570 | 6951 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6952 goto LABEL_110; |
6953 case 0xDFu: | |
570 | 6954 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6955 goto LABEL_114; |
6956 case 0xE0u: | |
6957 LODWORD(v3->pConditions[1]) = 0; | |
6958 HIDWORD(v3->pConditions[1]) = 0; | |
6959 goto LABEL_112; | |
6960 case 0xE1u: | |
6961 LODWORD(v3->pConditions[11]) = 0; | |
6962 HIDWORD(v3->pConditions[11]) = 0; | |
6963 LODWORD(v3->pConditions[9]) = 0; | |
6964 HIDWORD(v3->pConditions[9]) = 0; | |
6965 LODWORD(v3->pConditions[7]) = 0; | |
6966 HIDWORD(v3->pConditions[7]) = 0; | |
6967 goto LABEL_112; | |
6968 case 0xE2u: | |
6969 LODWORD(v3->pConditions[10]) = 0; | |
6970 HIDWORD(v3->pConditions[10]) = 0; | |
6971 LODWORD(v3->pConditions[8]) = 0; | |
6972 HIDWORD(v3->pConditions[8]) = 0; | |
6973 LODWORD(v3->pConditions[6]) = 0; | |
6974 HIDWORD(v3->pConditions[6]) = 0; | |
6975 goto LABEL_112; | |
6976 case 0xE3u: | |
6977 LODWORD(v3->pConditions[2]) = 0; | |
6978 HIDWORD(v3->pConditions[2]) = 0; | |
6979 goto LABEL_112; | |
6980 case 0xE4u: | |
6981 if ( v3->pConditions[1] ) | |
6982 goto LABEL_173; | |
6983 v70 = 0; | |
6984 v59 = 0; | |
6985 v50 = 5; | |
6986 v46 = 3; | |
570 | 6987 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 6988 v29 = (char *)&v3->pPlayerBuffs[7]; |
6989 goto LABEL_147; | |
6990 case 0xE5u: | |
6991 v70 = 0; | |
6992 v59 = 0; | |
6993 v50 = 5; | |
6994 v46 = 3; | |
570 | 6995 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 6996 v29 = (char *)&v3->pPlayerBuffs[8]; |
6997 goto LABEL_147; | |
6998 case 0xE6u: | |
6999 v70 = 0; | |
7000 v59 = 0; | |
7001 v50 = 5; | |
7002 v46 = 3; | |
570 | 7003 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7004 v29 = (char *)&v3->pPlayerBuffs[1]; |
7005 goto LABEL_147; | |
7006 case 0xE7u: | |
7007 v70 = 0; | |
7008 v59 = 0; | |
570 | 7009 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7010 v46 = 0; |
570 | 7011 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7012 v29 = (char *)&v3->pPlayerBuffs[11]; |
7013 goto LABEL_147; | |
7014 case 0xE8u: | |
7015 v70 = 0; | |
7016 v59 = 0; | |
570 | 7017 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7018 v46 = 0; |
570 | 7019 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7020 v29 = (char *)&v3->pPlayerBuffs[13]; |
7021 goto LABEL_147; | |
7022 case 0xEAu: | |
7023 v70 = 0; | |
7024 v59 = 0; | |
7025 v50 = 5; | |
7026 v46 = 3; | |
570 | 7027 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7028 v29 = (char *)&v3->pPlayerBuffs[14]; |
7029 goto LABEL_147; | |
7030 case 0xEBu: | |
7031 v3->pPlayerBuffs[23].Apply( | |
570 | 7032 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7033 3u, |
7034 5u, | |
7035 0, | |
7036 0); | |
7037 goto LABEL_173; | |
7038 case 0xEDu: | |
7039 LODWORD(v3->pConditions[3]) = 0; | |
7040 HIDWORD(v3->pConditions[3]) = 0; | |
7041 goto LABEL_112; | |
7042 case 0xEEu: | |
7043 LODWORD(v3->pConditions[0]) = 0; | |
7044 HIDWORD(v3->pConditions[0]) = 0; | |
7045 goto LABEL_112; | |
7046 case 0xEFu: | |
7047 LODWORD(v3->pConditions[5]) = 0; | |
7048 HIDWORD(v3->pConditions[5]) = 0; | |
7049 goto LABEL_112; | |
7050 case 0xF0u: | |
7051 v70 = 0; | |
7052 v59 = 0; | |
570 | 7053 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7054 v46 = 0; |
570 | 7055 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7056 v29 = (char *)&v3->pPlayerBuffs[19]; |
7057 goto LABEL_147; | |
7058 case 0xF1u: | |
7059 v70 = 0; | |
7060 v59 = 0; | |
570 | 7061 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7062 v46 = 0; |
570 | 7063 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7064 v29 = (char *)&v3->pPlayerBuffs[17]; |
7065 goto LABEL_147; | |
7066 case 0xF2u: | |
7067 v70 = 0; | |
7068 v59 = 0; | |
570 | 7069 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7070 v46 = 0; |
570 | 7071 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7072 v29 = (char *)&v3->pPlayerBuffs[20]; |
7073 goto LABEL_147; | |
7074 case 0xF3u: | |
7075 v70 = 0; | |
7076 v59 = 0; | |
570 | 7077 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7078 v46 = 0; |
570 | 7079 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7080 v29 = (char *)&v3->pPlayerBuffs[16]; |
7081 goto LABEL_147; | |
7082 case 0xF4u: | |
7083 v70 = 0; | |
7084 v59 = 0; | |
570 | 7085 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7086 v46 = 0; |
570 | 7087 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7088 v29 = (char *)&v3->pPlayerBuffs[21]; |
7089 goto LABEL_147; | |
7090 case 0xF5u: | |
7091 v70 = 0; | |
7092 v59 = 0; | |
570 | 7093 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7094 v46 = 0; |
570 | 7095 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7096 v29 = (char *)&v3->pPlayerBuffs[15]; |
7097 goto LABEL_147; | |
7098 case 0xFBu: | |
7099 LODWORD(v3->pConditions[12]) = 0; | |
7100 HIDWORD(v3->pConditions[12]) = 0; | |
7101 goto LABEL_112; | |
7102 case 0xFCu: | |
7103 v30 = LODWORD(v3->pConditions[14]); | |
7104 v31 = HIDWORD(v3->pConditions[14]); | |
7105 v32 = LODWORD(v3->pConditions[15]); | |
7106 v33 = HIDWORD(v3->pConditions[15]); | |
7107 v34 = LODWORD(v3->pConditions[16]); | |
7108 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7109 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7110 HIDWORD(v3->pConditions[14]) = v31; |
7111 LODWORD(v3->pConditions[15]) = v32; | |
7112 HIDWORD(v3->pConditions[15]) = v33; | |
7113 LODWORD(v3->pConditions[16]) = v34; | |
7114 LODWORD(v3->pConditions[14]) = v30; | |
7115 HIDWORD(v3->pConditions[16]) = v35; | |
7116 goto LABEL_112; | |
7117 case 0xFDu: | |
570 | 7118 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7119 LABEL_110: |
7120 v69 = v25; | |
7121 goto LABEL_111; | |
7122 case 0xFEu: | |
570 | 7123 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7124 LABEL_114: |
7125 v27 = (char *)&v3->sMana; | |
7126 *(int *)v27 += v26; | |
7127 goto LABEL_170; | |
7128 case 0xFFu: | |
7129 v70 = 0; | |
7130 v59 = 0; | |
570 | 7131 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7132 v46 = 0; |
570 | 7133 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7134 v29 = (char *)&v3->pPlayerBuffs[18]; |
7135 goto LABEL_147; | |
7136 case 0x100u: | |
7137 v70 = 0; | |
7138 v59 = 0; | |
570 | 7139 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7140 v46 = 0; |
570 | 7141 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7142 v29 = (char *)&v3->pPlayerBuffs[5]; |
7143 goto LABEL_147; | |
7144 case 0x101u: | |
7145 v70 = 0; | |
7146 v59 = 0; | |
570 | 7147 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7148 v46 = 0; |
570 | 7149 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7150 v29 = (char *)v3->pPlayerBuffs; |
7151 goto LABEL_147; | |
7152 case 0x102u: | |
7153 v70 = 0; | |
7154 v59 = 0; | |
570 | 7155 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7156 v46 = 0; |
570 | 7157 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7158 v29 = (char *)&v3->pPlayerBuffs[22]; |
7159 goto LABEL_147; | |
7160 case 0x103u: | |
7161 v70 = 0; | |
7162 v59 = 0; | |
570 | 7163 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7164 v46 = 0; |
570 | 7165 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7166 v29 = (char *)&v3->pPlayerBuffs[3]; |
7167 goto LABEL_147; | |
7168 case 0x104u: | |
7169 v70 = 0; | |
7170 v59 = 0; | |
570 | 7171 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7172 v46 = 0; |
570 | 7173 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7174 v29 = (char *)&v3->pPlayerBuffs[9]; |
7175 goto LABEL_147; | |
7176 case 0x105u: | |
7177 v70 = 0; | |
7178 v59 = 0; | |
570 | 7179 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7180 v46 = 0; |
570 | 7181 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7182 v29 = (char *)&v3->pPlayerBuffs[2]; |
7183 LABEL_147: | |
7184 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7185 goto LABEL_112; | |
7186 case 0x106u: | |
7187 LODWORD(v3->pConditions[15]) = 0; | |
7188 HIDWORD(v3->pConditions[15]) = 0; | |
7189 goto LABEL_112; | |
7190 case 0x108u: | |
7191 if ( !*(int *)&v3->field_1F5[3] ) | |
7192 { | |
7193 v3->uLuck += 50; | |
7194 *(int *)&v3->field_1F5[3] = 1; | |
7195 } | |
7196 goto LABEL_112; | |
7197 case 0x109u: | |
7198 if ( !*(int *)&v3->field_1F5[7] ) | |
7199 { | |
7200 v3->uSpeed += 50; | |
7201 *(int *)&v3->field_1F5[7] = 1; | |
7202 } | |
7203 goto LABEL_112; | |
7204 case 0x10Au: | |
7205 if ( !*(int *)&v3->field_1F5[11] ) | |
7206 { | |
7207 v3->uIntelligence += 50; | |
7208 *(int *)&v3->field_1F5[11] = 1; | |
7209 } | |
7210 goto LABEL_112; | |
7211 case 0x10Bu: | |
7212 if ( !*(int *)&v3->field_1F5[15] ) | |
7213 { | |
7214 v3->uEndurance += 50; | |
7215 *(int *)&v3->field_1F5[15] = 1; | |
7216 } | |
7217 goto LABEL_112; | |
7218 case 0x10Cu: | |
7219 if ( !*(int *)&v3->field_1F5[19] ) | |
7220 { | |
7221 v3->uWillpower += 50; | |
7222 *(int *)&v3->field_1F5[19] = 1; | |
7223 } | |
7224 goto LABEL_112; | |
7225 case 0x10Du: | |
7226 if ( !*(int *)&v3->field_1F5[23] ) | |
7227 { | |
7228 v3->uAccuracy += 50; | |
7229 *(int *)&v3->field_1F5[23] = 1; | |
7230 } | |
7231 goto LABEL_112; | |
7232 case 0x10Eu: | |
7233 if ( !*(int *)&v3->field_1F5[27] ) | |
7234 { | |
7235 v3->uMight += 50; | |
7236 *(int *)&v3->field_1F5[27] = 1; | |
7237 } | |
7238 goto LABEL_112; | |
7239 case 0x10Fu: | |
7240 v3->sAgeModifier = 0; | |
7241 goto LABEL_112; | |
809 | 7242 case 0xDDu: |
7243 goto LABEL_172; | |
0 | 7244 default: |
7245 goto LABEL_167; | |
7246 } | |
7247 goto LABEL_172; | |
7248 } | |
7249 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7250 { | |
7251 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7252 { | |
7253 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7254 { | |
7255 if ( pParty->pPickedItem.uItemID == 616 ) | |
7256 { | |
7257 thisa = pParty->uCurrentMonthWeek + 1; | |
7258 if ( pParty->uCurrentMonth >= 7 ) | |
7259 v74 = 0; | |
7260 else | |
7261 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7262 switch ( pParty->uCurrentMonth ) | |
7263 { | |
7264 case 0u: | |
7265 v6 = pParty->uCurrentMonthWeek + 1; | |
7266 v3->uMight += thisa; | |
7267 goto LABEL_33; | |
7268 case 1u: | |
7269 v6 = pParty->uCurrentMonthWeek + 1; | |
7270 v3->uIntelligence += thisa; | |
7271 goto LABEL_33; | |
7272 case 2u: | |
7273 v6 = pParty->uCurrentMonthWeek + 1; | |
7274 v3->uWillpower += thisa; | |
7275 goto LABEL_33; | |
7276 case 3u: | |
7277 v6 = pParty->uCurrentMonthWeek + 1; | |
7278 v3->uEndurance += thisa; | |
7279 goto LABEL_33; | |
7280 case 4u: | |
7281 v6 = pParty->uCurrentMonthWeek + 1; | |
7282 v3->uAccuracy += thisa; | |
7283 goto LABEL_33; | |
7284 case 5u: | |
7285 v6 = pParty->uCurrentMonthWeek + 1; | |
7286 v3->uSpeed += thisa; | |
7287 goto LABEL_33; | |
7288 case 6u: | |
7289 v6 = pParty->uCurrentMonthWeek + 1; | |
7290 v3->uLuck += thisa; | |
7291 LABEL_33: | |
7292 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7293 v53 = v74; | |
7294 v49 = v6; | |
7295 goto LABEL_53; | |
7296 case 7u: | |
7297 party_finds_gold(1000 * thisa, 0); | |
7298 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7299 v54 = 1000 * thisa; | |
7300 goto LABEL_38; | |
7301 case 8u: | |
7302 Party::GiveFood(5 * thisa); | |
7303 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7304 v54 = 5 * thisa; | |
7305 goto LABEL_38; | |
7306 case 9u: | |
7307 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7308 v3->uSkillPoints += 2 * thisa; | |
7309 v54 = 2 * thisa; | |
7310 goto LABEL_38; | |
7311 case 0xAu: | |
7312 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7313 v54 = 2500 * thisa; | |
7314 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7315 LODWORD(v3->uExperience) += 2500 * thisa; | |
7316 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7317 LABEL_38: | |
7318 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7319 goto LABEL_54; | |
7320 case 0xBu: | |
7321 v8 = rand() % 6; | |
7322 if ( v8 ) | |
7323 { | |
7324 v9 = v8 - 1; | |
7325 if ( v9 ) | |
7326 { | |
7327 v10 = v9 - 1; | |
7328 if ( v10 ) | |
7329 { | |
7330 v11 = v10 - 1; | |
7331 if ( v11 ) | |
7332 { | |
7333 v12 = v11 - 1; | |
7334 if ( v12 ) | |
7335 { | |
7336 if ( v12 != 1 ) | |
7337 goto LABEL_52; | |
7338 v3->sResBodyBase += thisa; | |
7339 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7340 } | |
7341 else | |
7342 { | |
7343 v3->sResMindBase += thisa; | |
7344 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7345 } | |
7346 } | |
7347 else | |
7348 { | |
7349 v3->sResEarthBase += thisa; | |
7350 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7351 } | |
7352 } | |
7353 else | |
7354 { | |
7355 v3->sResWaterBase += thisa; | |
7356 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7357 } | |
7358 } | |
7359 else | |
7360 { | |
7361 v3->sResAirBase += thisa; | |
7362 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7363 } | |
7364 } | |
7365 else | |
7366 { | |
7367 v3->sResFireBase += thisa; | |
7368 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7369 } | |
7370 v74 = v13; | |
7371 LABEL_52: | |
7372 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7373 v53 = v74; | |
7374 v49 = thisa; | |
7375 LABEL_53: | |
7376 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7377 LABEL_54: | |
7378 ShowStatusBarString(pTmpBuf, 2u); | |
7379 pMouse->RemoveHoldingItem(); | |
7380 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7381 v3->PlaySound(SPEECH_93, 0); |
0 | 7382 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7383 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7384 { | |
7385 v64 = 0; | |
7386 v55 = 16; | |
7387 } | |
7388 else | |
7389 { | |
7390 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7391 { | |
7392 v64 = 0; | |
7393 v55 = 14; | |
7394 } | |
7395 else | |
7396 { | |
7397 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7398 return; | |
7399 v64 = 0; | |
7400 v55 = 15; | |
7401 } | |
7402 } | |
7403 v3->SetCondition(v55, v64); | |
7404 v61 = 0; | |
7405 v52 = 0; | |
7406 v48 = 0; | |
7407 v45 = 0; | |
7408 v43 = -1; | |
7409 v41 = 0; | |
7410 v39 = 0; | |
7411 v37 = (SoundID)215; | |
7412 v14 = pAudioPlayer; | |
7413 goto LABEL_63; | |
7414 default: | |
7415 goto LABEL_54; | |
7416 } | |
7417 } | |
7418 if ( pParty->pPickedItem.uItemID == 630 ) | |
7419 { | |
7420 Party::GiveFood(1u); | |
7421 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7422 } | |
7423 else | |
7424 { | |
7425 if ( pParty->pPickedItem.uItemID == 632 ) | |
7426 { | |
7427 v61 = 0; | |
7428 v52 = 0; | |
7429 v48 = 0; | |
7430 v45 = 0; | |
7431 v43 = -1; | |
7432 v41 = 0; | |
7433 v39 = 0; | |
7434 v37 = (SoundID)133; | |
7435 goto LABEL_93; | |
7436 } | |
7437 if ( pParty->pPickedItem.uItemID == 633 ) | |
7438 { | |
7439 v61 = 0; | |
7440 v52 = 0; | |
7441 v48 = 0; | |
7442 v45 = 0; | |
7443 v43 = -1; | |
7444 v41 = 0; | |
7445 v39 = 0; | |
7446 v37 = (SoundID)134; | |
7447 goto LABEL_93; | |
7448 } | |
7449 if ( pParty->pPickedItem.uItemID == 634 ) | |
7450 { | |
7451 v61 = 0; | |
7452 v52 = 0; | |
7453 v48 = 0; | |
7454 v45 = 0; | |
7455 v43 = -1; | |
7456 v41 = 0; | |
7457 v39 = 0; | |
7458 v37 = (SoundID)135; | |
7459 goto LABEL_93; | |
7460 } | |
7461 if ( pParty->pPickedItem.uItemID != 646 ) | |
7462 { | |
7463 if ( pParty->pPickedItem.uItemID == 650 ) | |
7464 { | |
7465 sub_44C28F_open_nwc_dungeon(); | |
7466 return; | |
7467 } | |
7468 goto LABEL_167; | |
7469 } | |
7470 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7471 v5 = 8 * a2 + 392; | |
862 | 7472 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7473 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7474 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7475 } | |
7476 LABEL_187: | |
7477 pMouse->RemoveHoldingItem(); | |
7478 return; | |
7479 } | |
243 | 7480 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7481 { |
7482 sub_467F48(pParty->pPickedItem.uItemID); | |
7483 v65 = 0; | |
187 | 7484 v56 = SPEECH_37; |
0 | 7485 LABEL_67: |
187 | 7486 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7487 return; |
7488 } | |
7489 LABEL_89: | |
7490 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7491 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7492 LABEL_90: | |
809 | 7493 sprintfex(pTmpBuf, v58, v68); |
0 | 7494 v23 = pTmpBuf; |
7495 LABEL_91: | |
7496 ShowStatusBarString(v23, 2u); | |
7497 v4 = 0; | |
7498 goto LABEL_92; | |
7499 } | |
7500 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7501 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7502 if ( *v72 ) |
7503 { | |
7504 v66 = pParty->pPickedItem.GetDisplayName(); | |
7505 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7506 LABEL_72: | |
7507 sprintf(pTmpBuf, v57, v66); | |
7508 ShowStatusBarString(pTmpBuf, 2u); | |
7509 LABEL_92: | |
7510 v61 = v4; | |
7511 v52 = v4; | |
7512 v48 = v4; | |
7513 v45 = v4; | |
7514 v43 = -1; | |
7515 v41 = v4; | |
7516 v39 = v4; | |
7517 v37 = (SoundID)27; | |
7518 LABEL_93: | |
7519 v14 = pAudioPlayer; | |
7520 LABEL_63: | |
7521 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7522 return; | |
7523 } | |
243 | 7524 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7525 { |
7526 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7527 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7528 goto LABEL_72; | |
7529 } | |
7530 v16 = v15 % 11 + 1; | |
7531 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7532 v75 = v16; | |
7533 v18 = SkillToMastery(*v17) - 1; | |
7534 if ( v18 ) | |
7535 { | |
7536 v19 = v18 - 1; | |
7537 if ( v19 ) | |
7538 { | |
7539 v20 = v19 - 1; | |
7540 if ( v20 ) | |
7541 { | |
7542 if ( v20 != 1 ) | |
7543 { | |
7544 v21 = a2; | |
7545 LABEL_83: | |
7546 if ( v75 > v21 || !*v17 ) | |
7547 { | |
7548 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7549 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7550 ShowStatusBarString(pTmpBuf, 2u); |
7551 v65 = 0; | |
7552 v56 = 20; | |
7553 goto LABEL_67; | |
7554 } | |
7555 *v72 = 1; | |
187 | 7556 v3->PlaySound(SPEECH_21, 0); |
0 | 7557 v73 = 0; |
7558 LABEL_173: | |
7559 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7560 if ( v36 == 14 ) | |
7561 { | |
7562 v71 = 0; | |
7563 v60 = 0; | |
7564 v51 = 0; | |
7565 v47 = 0; | |
7566 v44 = -1; | |
7567 v42 = 0; | |
7568 v40 = 0; | |
7569 v38 = (SoundID)210; | |
7570 } | |
7571 else | |
7572 { | |
7573 if ( v36 != 13 ) | |
7574 { | |
7575 LABEL_178: | |
7576 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7577 { | |
7578 if ( !v73 ) | |
7579 goto LABEL_187; | |
437 | 7580 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7581 { |
990 | 7582 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7584 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7585 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7586 }*/ |
7587 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7588 } |
7589 if ( v73 ) | |
7590 { | |
7591 if ( pParty->bTurnBasedModeOn ) | |
7592 { | |
7593 *(&pParty->field_16140 + a2) = 100; | |
7594 thisb->SetRecoveryTime(100); | |
7595 pTurnEngine->_40471C(); | |
7596 } | |
7597 else | |
7598 { | |
7599 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7600 } | |
7601 } | |
7602 goto LABEL_187; | |
7603 } | |
7604 v71 = 0; | |
7605 v60 = 0; | |
7606 v51 = 0; | |
7607 v47 = 0; | |
7608 v44 = -1; | |
7609 v42 = 0; | |
7610 v40 = 0; | |
7611 v38 = (SoundID)211; | |
7612 } | |
7613 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7614 goto LABEL_178; | |
7615 } | |
7616 v67 = 11; | |
7617 } | |
7618 else | |
7619 { | |
7620 v67 = 10; | |
7621 } | |
7622 } | |
7623 else | |
7624 { | |
7625 v67 = 7; | |
7626 } | |
7627 } | |
7628 else | |
7629 { | |
7630 v67 = 4; | |
7631 } | |
7632 v21 = v67; | |
7633 goto LABEL_83; | |
7634 } | |
151 | 7635 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7636 return; |
243 | 7637 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7638 goto LABEL_89; |
7639 if ( bUnderwater == 1 ) | |
7640 { | |
7641 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7642 goto LABEL_91; | |
7643 } | |
7644 dword_50C9AC = 1; | |
7645 v24 = pParty->pPickedItem.uItemID - 299; | |
7646 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7647 { | |
7648 pMouse->RemoveHoldingItem(); | |
7649 pGUIWindow_CurrentMenu->Release(); | |
7650 pIcons_LOD->_4114F2(); | |
151 | 7651 pCurrentScreen = SCREEN_GAME; |
0 | 7652 viewparams->bRedrawGameUI = 1; |
7653 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7654 } | |
7655 else | |
7656 { | |
7657 _720984_unused = pParty->pPickedItem.uItemID; | |
7658 pMouse->RemoveHoldingItem(); | |
998 | 7659 /*if ( dword_50C9E8 < 40 ) |
0 | 7660 { |
7661 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7662 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7663 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7664 ++dword_50C9E8; |
998 | 7665 }*/ |
1012 | 7666 pMessageQueue_50C9E8->AddMessage(UIMSG_92, v24, a2 - 1); |
0 | 7667 if ( pCurrentScreen |
7668 && pGUIWindow_CurrentMenu | |
437 | 7669 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7670 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7671 { | |
990 | 7672 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7673 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7674 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7675 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7676 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7677 } | |
7678 } | |
7679 } | |
0 | 7680 |
7681 | |
7682 | |
7683 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7684 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7685 { | |
0 | 7686 Player *v3; // esi@1 |
7687 signed int v4; // edi@1 | |
7688 unsigned int v5; // eax@8 | |
7689 int v6; // eax@9 | |
7690 enum CHARACTER_RACE v7; // eax@11 | |
7691 signed int v8; // eax@17 | |
7692 unsigned __int8 v9; // sf@17 | |
7693 unsigned __int8 v10; // of@17 | |
7694 int v11; // eax@19 | |
7695 unsigned int v12; // eax@20 | |
484 | 7696 unsigned int test_bit_value; // eax@25 |
7697 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7698 signed int v15; // ecx@28 |
7699 ItemGen *v16; // eax@28 | |
7700 char v17; // zf@31 | |
7701 int v18; // edi@90 | |
7702 DDM_DLV_Header *v19; // eax@122 | |
7703 char v20; // cl@124 | |
7704 DDM_DLV_Header *v21; // eax@126 | |
7705 unsigned int v22; // edi@129 | |
100 | 7706 Player *v23; // esi@134 |
0 | 7707 ItemGen *v24; // ecx@135 |
7708 signed int v25; // edx@135 | |
7709 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7710 char *v27; // edi@155 | |
7711 int v28; // ebx@161 | |
7712 int v29; // eax@161 | |
7713 | |
469 | 7714 v6 = 0; |
0 | 7715 v3 = this; |
7716 v4 = -1; | |
469 | 7717 if ( VarNum > VAR_AutoNotes ) |
7718 { | |
7719 switch ( VarNum ) | |
0 | 7720 { |
7721 case VAR_Invisible: | |
484 | 7722 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7723 return true; |
484 | 7724 return false; |
0 | 7725 case VAR_NumDeaths: |
7726 v4 = pParty->uNumDeaths; | |
469 | 7727 return v4 >= pValue; |
0 | 7728 case VAR_NumBounties: |
7729 v4 = pParty->uNumBountiesCollected; | |
469 | 7730 return v4 >= pValue; |
0 | 7731 case VAR_PrisonTerms: |
7732 v4 = pParty->uNumPrisonTerms; | |
469 | 7733 return v4 >= pValue; |
0 | 7734 case VAR_ArenaWinsPage: |
7735 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7736 return v4 >= pValue; |
0 | 7737 case VAR_ArenaWinsSquire: |
7738 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7739 return v4 >= pValue; |
0 | 7740 case VAR_ArenaWinsKnight: |
7741 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7742 return v4 >= pValue; |
0 | 7743 case VAR_ArenaWinsLord: |
7744 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7745 return v4 >= pValue; |
0 | 7746 case VAR_ReputationInCurrentLocation: |
7747 v19 = &pOutdoor->ddm; | |
7748 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7749 v19 = &pIndoor->dlv; | |
469 | 7750 v6 = v19->uReputation >= pValue; |
7751 return v6; | |
0 | 7752 case VAR_History_28|VAR_Sex: |
7753 v21 = &pOutdoor->ddm; | |
7754 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7755 v21 = &pIndoor->dlv; | |
469 | 7756 v6 = v21->field_C_alert == pValue; |
0 | 7757 return v6; |
7758 case VAR_MonthEquals2|VAR_Sex: | |
7759 case VAR_MonthEquals2|VAR_Class: | |
7760 case VAR_Counter1: | |
7761 case VAR_Counter2: | |
7762 case VAR_Counter3: | |
7763 case VAR_Counter4: | |
7764 case VAR_Counter5: | |
7765 case VAR_Counter6: | |
7766 case VAR_Counter7: | |
7767 case VAR_Counter8: | |
469 | 7768 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7769 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7770 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7771 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7772 return true; | |
7773 return false; | |
0 | 7774 case VAR_NumSkillPoints: |
7775 v4 = this->uSkillPoints; | |
469 | 7776 return v4 >= pValue; |
0 | 7777 case VAR_CircusPrises: |
7778 v4 = 0; | |
100 | 7779 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7780 do |
7781 { | |
469 | 7782 v24 = v23->pInventoryItems; |
0 | 7783 v25 = 138; |
7784 do | |
7785 { | |
7786 switch ( v24->uItemID ) | |
7787 { | |
7788 case 0x1D6u: | |
7789 ++v4; | |
7790 break; | |
7791 case 0x1D7u: | |
7792 v4 += 3; | |
7793 break; | |
7794 case 0x1DDu: | |
7795 v4 += 5; | |
7796 break; | |
7797 } | |
7798 ++v24; | |
7799 --v25; | |
7800 } | |
7801 while ( v25 ); | |
100 | 7802 ++v23; |
0 | 7803 } |
100 | 7804 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7805 return v4 >= pValue; |
0 | 7806 case VAR_MonthEquals2: |
469 | 7807 v6 = pParty->uCurrentMonth == pValue; |
7808 return v6; | |
0 | 7809 case VAR_IsFlying: |
7810 if ( pParty->bFlying | |
484 | 7811 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7812 return true; |
7813 return false; | |
0 | 7814 case VAR_HiredNPCHasSpeciality: |
469 | 7815 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7816 return v6; |
7817 case VAR_NPCs2: | |
469 | 7818 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7819 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7820 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7821 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7822 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7823 return v4 >= pValue; |
7824 v4 = pValue; | |
7825 return v4 >= pValue; | |
0 | 7826 case VAR_ItemEquipped: |
7827 v26 = (ITEM_EQUIP_TYPE)0; | |
7828 v27 = (char *)&this->pEquipment; | |
7829 break; | |
7830 case VAR_GoldInBank: | |
7831 v4 = pParty->uNumGoldInBank; | |
469 | 7832 return v4 >= pValue; |
0 | 7833 case VAR_ThieverySkill|0x80: |
7834 v28 = GetActualMight(); | |
7835 v29 = v3->GetBaseStrength(); | |
7836 goto LABEL_168; | |
7837 case VAR_DisarmTrapSkill|0x80: | |
7838 v28 = GetActualIntelligence(); | |
7839 v29 = v3->GetBaseIntelligence(); | |
7840 goto LABEL_168; | |
7841 case VAR_MonthEquals: | |
7842 v28 = GetActualWillpower(); | |
7843 v29 = v3->GetBaseWillpower(); | |
7844 goto LABEL_168; | |
7845 case VAR_MonthEquals|VAR_Sex: | |
7846 v28 = GetActualEndurance(); | |
7847 v29 = v3->GetBaseEndurance(); | |
7848 goto LABEL_168; | |
7849 case VAR_IdentifyMonsterSkill|0x80: | |
7850 v28 = GetActualSpeed(); | |
7851 v29 = v3->GetBaseSpeed(); | |
7852 goto LABEL_168; | |
7853 case VAR_ArmsmasterSkill|0x80: | |
7854 v28 = GetActualAccuracy(); | |
7855 v29 = v3->GetBaseAccuracy(); | |
7856 goto LABEL_168; | |
7857 case VAR_MonthEquals|VAR_MaxHP: | |
7858 v28 = GetActualLuck(); | |
7859 v29 = v3->GetBaseLuck(); | |
7860 LABEL_168: | |
7861 v10 = __OFSUB__(v28, v29); | |
7862 v9 = v28 - v29 < 0; | |
7863 LABEL_169: | |
7864 if ( v9 ^ v10 ) | |
469 | 7865 return v4 >= pValue; |
7866 return true; | |
0 | 7867 default: |
469 | 7868 return v4 >= pValue; |
0 | 7869 } |
7870 while ( !v3->HasItemEquipped(v26) | |
654 | 7871 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7872 { |
7873 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7874 v27 += 4; | |
7875 if ( (signed int)v26 >= 16 ) | |
469 | 7876 return false; |
7877 } | |
7878 return true; | |
7879 } | |
7880 if ( VarNum == VAR_AutoNotes ) | |
0 | 7881 { |
484 | 7882 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7883 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7884 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7885 return false; | |
7886 return true; | |
469 | 7887 } |
7888 if ( VarNum <= VAR_BaseLuck ) | |
7889 { | |
7890 if ( VarNum != VAR_BaseLuck ) | |
7891 { | |
7892 switch ( VarNum ) | |
0 | 7893 { |
7894 case VAR_Hour: | |
469 | 7895 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7896 return true; | |
7897 return false; | |
0 | 7898 case VAR_DayOfYear: |
469 | 7899 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7900 v6 = v5 == pValue; | |
7901 return v6; | |
0 | 7902 case VAR_DayOfWeek: |
469 | 7903 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7904 v6 = v5 == pValue; | |
0 | 7905 return v6; |
7906 case VAR_Sex: | |
469 | 7907 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7908 return true; | |
7909 return v4 >= pValue; | |
0 | 7910 case VAR_Class: |
135 | 7911 v7 = (CHARACTER_RACE)this->classType; |
469 | 7912 if ( pValue == v7 ) |
7913 return true; | |
7914 return v4 >= pValue; | |
0 | 7915 case VAR_Race: |
7916 v7 = GetRace(); | |
469 | 7917 if ( pValue == v7 ) |
7918 return true; | |
7919 return v4 >= pValue; | |
0 | 7920 case VAR_CurrentHP: |
7921 v4 = this->sHealth; | |
469 | 7922 return v4 >= pValue; |
0 | 7923 case VAR_MaxHP: |
7924 v8 = GetMaxHealth(); | |
7925 v10 = __OFSUB__(v3->sHealth, v8); | |
7926 v9 = v3->sHealth - v8 < 0; | |
7927 goto LABEL_169; | |
7928 case VAR_CurrentSP: | |
7929 v4 = this->sMana; | |
469 | 7930 return v4 >= pValue; |
0 | 7931 case VAR_MaxSP: |
7932 v11 = GetMaxMana(); | |
7933 v10 = __OFSUB__(v3->sMana, v11); | |
7934 v9 = v3->sMana - v11 < 0; | |
7935 goto LABEL_169; | |
7936 case VAR_ActualAC: | |
7937 v12 = GetActualAC(); | |
7938 goto _j_cmp_against_arg; | |
7939 case VAR_ACModifier: | |
7940 v4 = this->sACModifier; | |
469 | 7941 return v4 >= pValue; |
0 | 7942 case VAR_BaseLevel: |
7943 v4 = this->uLevel; | |
469 | 7944 return v4 >= pValue; |
0 | 7945 case VAR_LevelModifier: |
7946 v4 = this->sLevelModifier; | |
469 | 7947 return v4 >= pValue; |
0 | 7948 case VAR_Age: |
7949 v12 = GetActualAge(); | |
7950 goto _j_cmp_against_arg; | |
7951 case VAR_Award: | |
484 | 7952 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7953 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7954 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7955 return true; | |
7956 return false; | |
0 | 7957 case VAR_Experience: |
7958 v4 = LODWORD(this->uExperience); | |
469 | 7959 return v4 >= pValue; |
0 | 7960 case VAR_QBits_QuestsDone: |
484 | 7961 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7962 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7963 if ( test_bit_value & our_bit_value ) | |
478 | 7964 return true; |
7965 return false; | |
0 | 7966 case VAR_PlayerItemInHands: |
7967 v15 = 0; | |
7968 v16 = v3->pInventoryItems; | |
7969 break; | |
7970 case VAR_FixedGold: | |
7971 v4 = pParty->uNumGold; | |
469 | 7972 return v4 >= pValue; |
0 | 7973 case VAR_MightBonus: |
7974 v4 = this->uMightBonus; | |
469 | 7975 return v4 >= pValue; |
0 | 7976 case VAR_IntellectBonus: |
7977 v4 = this->uIntelligenceBonus; | |
469 | 7978 return v4 >= pValue; |
0 | 7979 case VAR_PersonalityBonus: |
7980 v4 = this->uWillpowerBonus; | |
469 | 7981 return v4 >= pValue; |
0 | 7982 case VAR_EnduranceBonus: |
7983 v4 = this->uEnduranceBonus; | |
469 | 7984 return v4 >= pValue; |
0 | 7985 case VAR_SpeedBonus: |
7986 v4 = this->uSpeedBonus; | |
469 | 7987 return v4 >= pValue; |
0 | 7988 case VAR_AccuracyBonus: |
7989 v4 = this->uAccuracyBonus; | |
469 | 7990 return v4 >= pValue; |
0 | 7991 case VAR_LuckBonus: |
7992 v4 = this->uLuckBonus; | |
469 | 7993 return v4 >= pValue; |
0 | 7994 case VAR_BaseMight: |
7995 v4 = this->uMight; | |
469 | 7996 return v4 >= pValue; |
0 | 7997 case VAR_BaseIntellect: |
7998 v4 = this->uIntelligence; | |
469 | 7999 return v4 >= pValue; |
0 | 8000 case VAR_BasePersonality: |
8001 v4 = this->uWillpower; | |
469 | 8002 return v4 >= pValue; |
0 | 8003 case VAR_BaseEndurance: |
8004 v4 = this->uEndurance; | |
469 | 8005 return v4 >= pValue; |
0 | 8006 case VAR_BaseSpeed: |
8007 v4 = this->uSpeed; | |
469 | 8008 return v4 >= pValue; |
0 | 8009 case VAR_BaseAccuracy: |
8010 v4 = this->uAccuracy; | |
469 | 8011 return v4 >= pValue; |
0 | 8012 case VAR_FixedFood: |
8013 v4 = pParty->uNumFoodRations; | |
469 | 8014 return v4 >= pValue; |
0 | 8015 default: |
469 | 8016 return v4 >= pValue; |
8017 } | |
8018 while ( v16->uItemID != pValue ) | |
0 | 8019 { |
8020 ++v15; | |
8021 ++v16; | |
8022 if ( v15 >= 138 ) | |
8023 { | |
469 | 8024 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8025 return v6; |
8026 } | |
8027 } | |
469 | 8028 return true; |
0 | 8029 } |
8030 v4 = this->uLuck; | |
469 | 8031 return v4 >= pValue; |
8032 } | |
8033 if ( VarNum <= VAR_MagicResistance ) | |
8034 { | |
8035 if ( VarNum == VAR_MagicResistance ) | |
0 | 8036 { |
8037 v4 = this->sResMagicBase; | |
8038 } | |
8039 else | |
8040 { | |
469 | 8041 switch ( VarNum ) |
0 | 8042 { |
8043 case VAR_FireResistance: | |
8044 v4 = this->sResFireBase; | |
469 | 8045 return v4 >= pValue; |
0 | 8046 case VAR_AirResistance: |
8047 v4 = this->sResAirBase; | |
469 | 8048 return v4 >= pValue; |
0 | 8049 case VAR_WaterResistance: |
8050 v4 = this->sResWaterBase; | |
469 | 8051 return v4 >= pValue; |
0 | 8052 case VAR_EarthResistance: |
8053 v4 = this->sResEarthBase; | |
469 | 8054 return v4 >= pValue; |
0 | 8055 case VAR_SpiritResistance: |
8056 v4 = this->sResSpiritBase; | |
469 | 8057 return v4 >= pValue; |
0 | 8058 case VAR_MindResistance: |
8059 v4 = this->sResMindBase; | |
469 | 8060 return v4 >= pValue; |
0 | 8061 case VAR_BodyResistance: |
8062 v4 = this->sResBodyBase; | |
469 | 8063 return v4 >= pValue; |
0 | 8064 case VAR_LightResistance: |
8065 v4 = this->sResLightBase; | |
469 | 8066 return v4 >= pValue; |
0 | 8067 case VAR_DarkResistance: |
8068 v4 = this->sResDarkBase; | |
469 | 8069 return v4 >= pValue; |
0 | 8070 case VAR_ActualMight: |
8071 v12 = GetActualMight(); | |
8072 goto _j_cmp_against_arg; | |
8073 case VAR_ActualIntellect: | |
8074 v12 = GetActualIntelligence(); | |
8075 goto _j_cmp_against_arg; | |
8076 case VAR_ActualPersonality: | |
8077 v12 = GetActualWillpower(); | |
8078 goto _j_cmp_against_arg; | |
8079 case VAR_ActualEndurance: | |
8080 v12 = GetActualEndurance(); | |
8081 goto _j_cmp_against_arg; | |
8082 case VAR_ActualSpeed: | |
8083 v12 = GetActualSpeed(); | |
8084 goto _j_cmp_against_arg; | |
8085 case VAR_ActualAccuracy: | |
8086 v12 = GetActualAccuracy(); | |
8087 goto _j_cmp_against_arg; | |
8088 case VAR_ActualLuck: | |
8089 v12 = GetActualLuck(); | |
8090 _j_cmp_against_arg: | |
8091 v4 = v12; | |
8092 break; | |
8093 default: | |
469 | 8094 return v4 >= pValue; |
8095 } | |
8096 } | |
8097 return v4 >= pValue; | |
8098 } | |
8099 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8100 { | |
8101 if ( VarNum != VAR_DisarmTrapSkill ) | |
8102 { | |
8103 if ( VarNum <= VAR_MindResistanceBonus ) | |
8104 { | |
8105 switch ( VarNum ) | |
0 | 8106 { |
8107 case VAR_MindResistanceBonus: | |
8108 v4 = this->sResMindBonus; | |
8109 break; | |
8110 case VAR_FireResistanceBonus: | |
8111 v4 = this->sResFireBonus; | |
8112 break; | |
8113 case VAR_AirResistanceBonus: | |
8114 v4 = this->sResAirBonus; | |
8115 break; | |
8116 case VAR_WaterResistanceBonus: | |
8117 v4 = this->sResWaterBonus; | |
8118 break; | |
8119 case VAR_EarthResistanceBonus: | |
8120 v4 = this->sResEarthBonus; | |
8121 break; | |
8122 case VAR_SpiritResistanceBonus: | |
8123 v4 = this->sResSpiritBonus; | |
8124 break; | |
8125 } | |
469 | 8126 return v4 >= pValue; |
8127 } | |
8128 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8129 { |
8130 v4 = this->sResBodyBonus; | |
469 | 8131 return v4 >= pValue; |
8132 } | |
8133 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8134 { |
8135 v4 = this->sResLightBonus; | |
469 | 8136 return v4 >= pValue; |
8137 } | |
8138 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8139 { |
8140 v4 = this->sResDarkBonus; | |
469 | 8141 return v4 >= pValue; |
8142 } | |
8143 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8144 { |
8145 v4 = this->sResMagicBonus; | |
469 | 8146 return v4 >= pValue; |
8147 } | |
8148 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8149 return v4 >= pValue; | |
0 | 8150 } |
8151 LABEL_90: | |
469 | 8152 v18 = *((short *)&this->pConditions[16] + VarNum); |
8153 if ( pValue <= 63 ) | |
0 | 8154 v4 = v18 & 0x3F; |
8155 else | |
469 | 8156 v4 = pValue & v18; |
8157 return v4 >= pValue; | |
8158 } | |
8159 if ( VarNum == 104 ) | |
0 | 8160 goto LABEL_90; |
469 | 8161 if ( (signed int)VarNum <= 104 ) |
8162 return v4 >= pValue; | |
8163 if ( (signed int)VarNum > 0x79 ) | |
8164 { | |
8165 if ( VarNum != 122 ) | |
8166 { | |
8167 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8168 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8169 return v4 >= pValue; | |
0 | 8170 } |
8171 v4 = GetMajorConditionIdx(); | |
8172 if ( v4 != 18 ) | |
8173 { | |
469 | 8174 return v4 >= pValue; |
8175 } | |
8176 v4 = pValue; | |
8177 return v4 >= pValue; | |
8178 } | |
8179 return *((int *)this + 2 * VarNum - 210); | |
0 | 8180 } |
8181 | |
8182 | |
8183 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8184 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8185 { | |
8186 signed int currPlayerId; // ebx@1 | |
0 | 8187 Player *v4; // esi@1 |
8188 unsigned int v5; // edi@1 | |
8189 unsigned int v6; // esi@13 | |
8190 unsigned int v7; // esi@14 | |
8191 signed int v8; // eax@17 | |
8192 ItemGen *v9; // ecx@17 | |
8193 int v10; // eax@21 | |
8194 signed int v11; // eax@30 | |
8195 Player *v12; // ecx@44 | |
8196 char *v13; // ecx@45 | |
8197 Player *v14; // ecx@49 | |
8198 int v15; // ecx@86 | |
8199 int v16; // esi@106 | |
8200 char v17; // al@106 | |
8201 int v18; // eax@107 | |
8202 Player *v19; // ecx@112 | |
8203 Player *v20; // ecx@127 | |
8204 int v21; // eax@127 | |
8205 int v22; // eax@145 | |
8206 char v23; // zf@146 | |
8207 DDM_DLV_Header *v24; // ecx@148 | |
8208 signed int v25; // eax@172 | |
8209 int v26; // [sp-8h] [bp-3Ch]@84 | |
8210 signed int v27; // [sp-4h] [bp-38h]@4 | |
8211 int v28; // [sp-4h] [bp-38h]@84 | |
8212 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8213 char v30; // [sp+32h] [bp-2h]@1 | |
8214 char v31; // [sp+33h] [bp-1h]@1 | |
8215 | |
492 | 8216 currPlayerId = 0; |
0 | 8217 v30 = 0; |
8218 v31 = 0; | |
8219 v4 = this; | |
8220 v5 = 0; | |
8221 if ( this == pPlayers[2] ) | |
492 | 8222 currPlayerId = 1; |
8223 else if ( this == pPlayers[3] ) | |
8224 currPlayerId = 2; | |
757 | 8225 else if ( this == pPlayers[4] ) |
492 | 8226 currPlayerId = 3; |
8227 if ( var_type > VAR_AutoNotes ) | |
8228 { | |
8229 if ( var_type <= VAR_GoldInBank ) | |
8230 { | |
8231 if ( var_type == VAR_GoldInBank ) | |
8232 { | |
8233 pParty->uNumGoldInBank = var_value; | |
0 | 8234 return; |
8235 } | |
492 | 8236 if ( var_type <= VAR_Counter8 ) |
8237 { | |
8238 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8239 { |
492 | 8240 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8241 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8242 } |
8243 else | |
8244 { | |
492 | 8245 switch ( var_type ) |
0 | 8246 { |
8247 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8248 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8249 break; |
8250 case VAR_NPCs2: | |
8251 pParty->field_709 = 0; | |
492 | 8252 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8253 Party__CountHirelings(); |
0 | 8254 viewparams->bRedrawGameUI = 1; |
8255 break; | |
8256 case VAR_NumSkillPoints: | |
492 | 8257 this->uSkillPoints = var_value; |
0 | 8258 break; |
8259 } | |
8260 } | |
8261 return; | |
8262 } | |
492 | 8263 if ( var_type < VAR_Counter9 ) |
0 | 8264 return; |
492 | 8265 if ( (signed int)var_type <= 0x112 ) |
8266 { | |
8267 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8268 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8269 } |
8270 else | |
8271 { | |
492 | 8272 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8273 { |
8274 v24 = &pOutdoor->ddm; | |
8275 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8276 v24 = &pIndoor->dlv; | |
492 | 8277 v24->uReputation = var_value; |
8278 if ( var_value > 10000 ) | |
0 | 8279 v24->uReputation = 10000; |
8280 return; | |
8281 } | |
492 | 8282 if ( var_type <= VAR_ReputationInCurrentLocation |
8283 || var_type > VAR_History_28 | |
8284 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8285 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8286 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8287 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8288 v23) ) |
8289 return; | |
8290 bFlashHistoryBook = 1; | |
8291 } | |
8292 LABEL_172: | |
492 | 8293 v25 = 8 * currPlayerId + 400; |
862 | 8294 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8295 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8296 return; | |
8297 } | |
492 | 8298 if ( var_type != 307 ) |
8299 { | |
8300 switch ( var_type ) | |
0 | 8301 { |
8302 case 308: | |
492 | 8303 pParty->uNumBountiesCollected = var_value; |
0 | 8304 break; |
8305 case 309: | |
492 | 8306 pParty->uNumPrisonTerms = var_value; |
0 | 8307 break; |
8308 case 310: | |
492 | 8309 pParty->uNumArenaPageWins = var_value; |
0 | 8310 break; |
8311 case 311: | |
492 | 8312 pParty->uNumArenaSquireWins = var_value; |
0 | 8313 break; |
8314 case 312: | |
492 | 8315 pParty->uNumArenaKnightWins = var_value; |
0 | 8316 break; |
8317 case 313: | |
492 | 8318 pParty->uNumArenaLordWins = var_value; |
0 | 8319 break; |
8320 } | |
8321 return; | |
8322 } | |
492 | 8323 pParty->uNumDeaths = var_value; |
0 | 8324 LABEL_168: |
8325 if ( v30 != 1 ) | |
8326 { | |
8327 LABEL_170: | |
8328 if ( v31 != 1 ) | |
8329 return; | |
8330 v5 = 0; | |
8331 goto LABEL_172; | |
8332 } | |
8333 LABEL_169: | |
492 | 8334 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8335 goto LABEL_170; |
8336 } | |
492 | 8337 if ( var_type == VAR_AutoNotes ) |
8338 { | |
8339 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
|
8340 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8341 && pAutonoteTxt[var_value-1].pText ) |
8342 { | |
8343 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8344 v30 = 1; |
187 | 8345 v20->PlaySound(SPEECH_96, 0); |
492 | 8346 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8347 bFlashAutonotesBook = 1; |
981 | 8348 _506568_autonote_type = v21; |
0 | 8349 } |
492 | 8350 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8351 v31 = 1; |
8352 goto LABEL_168; | |
8353 } | |
492 | 8354 if ( var_type <= VAR_ActualMight ) |
8355 { | |
8356 if ( var_type != VAR_ActualMight ) | |
8357 { | |
8358 switch ( var_type ) | |
0 | 8359 { |
8360 case VAR_RandomGold: | |
492 | 8361 v6 = rand() % var_value + 1; |
0 | 8362 Party::SetGold(v6); |
8363 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8364 ShowStatusBarString(pTmpBuf, 2u); | |
8365 GameUI_DrawFoodAndGold(); | |
8366 return; | |
8367 case VAR_RandomFood: | |
492 | 8368 v7 = rand() % var_value + 1; |
0 | 8369 Party::SetFood(v7); |
8370 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8371 ShowStatusBarString(pTmpBuf, 2u); | |
8372 GameUI_DrawFoodAndGold(); | |
8373 goto LABEL_124; | |
8374 case VAR_Sex: | |
492 | 8375 this->uSex = (PLAYER_SEX)var_value; |
0 | 8376 goto LABEL_124; |
8377 case VAR_Class: | |
492 | 8378 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8379 if ( (char)var_value != 35 ) | |
0 | 8380 goto LABEL_124; |
8381 v8 = 0; | |
8382 v9 = this->pInventoryItems; | |
8383 break; | |
8384 case VAR_CurrentHP: | |
492 | 8385 this->sHealth = var_value; |
0 | 8386 goto LABEL_124; |
8387 case VAR_MaxHP: | |
8388 this->sHealth = GetMaxHealth(); | |
8389 return; | |
8390 case VAR_CurrentSP: | |
492 | 8391 this->sMana = var_value; |
0 | 8392 goto LABEL_124; |
8393 case VAR_MaxSP: | |
8394 this->sMana = GetMaxMana(); | |
8395 return; | |
8396 case VAR_ACModifier: | |
492 | 8397 this->sACModifier = (unsigned __int8)var_value; |
0 | 8398 goto LABEL_124; |
8399 case VAR_BaseLevel: | |
492 | 8400 this->uLevel = (unsigned __int8)var_value; |
0 | 8401 goto LABEL_124; |
8402 case VAR_LevelModifier: | |
492 | 8403 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8404 goto LABEL_124; |
8405 case VAR_Age: | |
492 | 8406 this->sAgeModifier = var_value; |
0 | 8407 return; |
8408 case VAR_Award: | |
492 | 8409 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8410 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
|
8411 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8412 && pAwards[var_value].pText ) |
0 | 8413 { |
8414 v30 = 1; | |
8415 v31 = 1; | |
492 | 8416 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8417 } |
492 | 8418 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8419 goto LABEL_168; | |
0 | 8420 case VAR_Experience: |
492 | 8421 this->uExperience = var_value; |
0 | 8422 goto LABEL_124; |
8423 case VAR_QBits_QuestsDone: | |
492 | 8424 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
|
8425 // && (&dword_722F10)[4 * a3] ) |
492 | 8426 && pQuestTable[var_value-1] ) |
0 | 8427 { |
492 | 8428 v14 = pPlayers[currPlayerId + 1]; |
0 | 8429 bFlashQuestBook = 1; |
8430 v30 = 1; | |
8431 v31 = 1; | |
187 | 8432 v14->PlaySound(SPEECH_93, 0); |
0 | 8433 } |
484 | 8434 v13 = (char *)pParty->_quest_bits; |
0 | 8435 LABEL_51: |
492 | 8436 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8437 if (( v30 != 1 )&&( v31 != 1 )) | |
8438 return; | |
8439 else | |
8440 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8441 if ( v31 != 1 ) | |
8442 return; | |
8443 v25 = 8 * currPlayerId + 400; | |
862 | 8444 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8445 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8446 return; | |
0 | 8447 case VAR_PlayerItemInHands: |
8448 item.Reset(); | |
8449 item.Reset(); | |
492 | 8450 item.uItemID = var_value; |
0 | 8451 item.uAttributes = 1; |
8452 pParty->SetHoldingItem(&item); | |
492 | 8453 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8454 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8455 return; |
8456 case VAR_FixedGold: | |
492 | 8457 Party::SetGold(var_value); |
0 | 8458 return; |
8459 case VAR_BaseMight: | |
492 | 8460 this->uMight = (unsigned __int8)var_value; |
0 | 8461 goto LABEL_84; |
8462 case VAR_BaseIntellect: | |
492 | 8463 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8464 goto LABEL_84; |
8465 case VAR_BasePersonality: | |
492 | 8466 this->uWillpower = (unsigned __int8)var_value; |
0 | 8467 goto LABEL_84; |
8468 case VAR_BaseEndurance: | |
492 | 8469 this->uEndurance = (unsigned __int8)var_value; |
0 | 8470 goto LABEL_84; |
8471 case VAR_BaseSpeed: | |
492 | 8472 this->uSpeed = (unsigned __int8)var_value; |
0 | 8473 goto LABEL_84; |
8474 case VAR_BaseAccuracy: | |
492 | 8475 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8476 goto LABEL_84; |
8477 case VAR_BaseLuck: | |
492 | 8478 this->uLuck = (unsigned __int8)var_value; |
0 | 8479 goto LABEL_84; |
8480 case VAR_FixedFood: | |
492 | 8481 Party::SetFood(var_value); |
0 | 8482 goto LABEL_124; |
8483 case VAR_MightBonus: | |
8484 goto LABEL_64; | |
8485 case VAR_IntellectBonus: | |
8486 goto LABEL_68; | |
8487 case VAR_PersonalityBonus: | |
8488 goto LABEL_69; | |
8489 case VAR_EnduranceBonus: | |
8490 goto LABEL_70; | |
8491 case VAR_SpeedBonus: | |
8492 goto LABEL_71; | |
8493 case VAR_AccuracyBonus: | |
8494 goto LABEL_72; | |
8495 case VAR_LuckBonus: | |
8496 goto LABEL_73; | |
8497 default: | |
8498 return; | |
8499 } | |
8500 while ( v9->uItemID != 615 ) | |
8501 { | |
8502 ++v8; | |
8503 ++v9; | |
8504 if ( v8 >= 138 ) | |
8505 goto LABEL_22; | |
8506 } | |
8507 v10 = (int)((char *)v4 + 36 * v8); | |
8508 *(int *)(v10 + 532) = 601; | |
492 | 8509 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8510 LABEL_22: |
8511 if ( v4->sResFireBase < 20 ) | |
8512 v4->sResFireBase = 20; | |
8513 if ( v4->sResAirBase < 20 ) | |
8514 v4->sResAirBase = 20; | |
8515 if ( v4->sResWaterBase < 20 ) | |
8516 v4->sResWaterBase = 20; | |
8517 if ( v4->sResEarthBase < 20 ) | |
8518 v4->sResEarthBase = 20; | |
8519 v4->sResMindBase = 200; | |
8520 v4->sResBodyBase = 200; | |
8521 v11 = v4->GetSexByVoice(); | |
1014 | 8522 v4->uPrevVoiceID = v4->uVoiceID; |
8523 v4->uPrevFace = v4->uCurrentFace; | |
0 | 8524 if ( v11 ) |
8525 { | |
1014 | 8526 v4->uCurrentFace = 21; |
0 | 8527 v4->uVoiceID = 21; |
8528 } | |
8529 else | |
8530 { | |
1014 | 8531 v4->uCurrentFace = 20; |
0 | 8532 v4->uVoiceID = 20; |
8533 } | |
1014 | 8534 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
0 | 8535 goto LABEL_124; |
8536 } | |
8537 LABEL_64: | |
492 | 8538 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8539 LABEL_111: |
8540 v28 = 0; | |
187 | 8541 v26 = SPEECH_91; |
0 | 8542 LABEL_112: |
492 | 8543 v19 = pPlayers[currPlayerId + 1]; |
0 | 8544 v31 = 1; |
187 | 8545 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8546 goto LABEL_169; |
8547 } | |
492 | 8548 if ( var_type <= VAR_FireResistanceBonus ) |
8549 { | |
8550 if ( var_type == VAR_FireResistanceBonus ) | |
8551 { | |
8552 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8553 goto LABEL_111; |
8554 } | |
492 | 8555 switch ( var_type ) |
0 | 8556 { |
8557 case VAR_ActualIntellect: | |
8558 LABEL_68: | |
492 | 8559 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8560 goto LABEL_111; |
8561 case VAR_ActualPersonality: | |
8562 LABEL_69: | |
492 | 8563 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8564 goto LABEL_111; |
8565 case VAR_ActualEndurance: | |
8566 LABEL_70: | |
492 | 8567 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8568 goto LABEL_111; |
8569 case VAR_ActualSpeed: | |
8570 LABEL_71: | |
492 | 8571 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8572 goto LABEL_111; |
8573 case VAR_ActualAccuracy: | |
8574 LABEL_72: | |
492 | 8575 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8576 goto LABEL_111; |
8577 case VAR_ActualLuck: | |
8578 LABEL_73: | |
492 | 8579 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8580 goto LABEL_111; |
8581 case VAR_FireResistance: | |
492 | 8582 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8583 goto LABEL_84; |
8584 case VAR_AirResistance: | |
492 | 8585 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8586 goto LABEL_84; |
8587 case VAR_WaterResistance: | |
492 | 8588 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8589 goto LABEL_84; |
8590 case VAR_EarthResistance: | |
492 | 8591 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8592 goto LABEL_84; |
8593 case VAR_SpiritResistance: | |
492 | 8594 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8595 goto LABEL_84; |
8596 case VAR_MindResistance: | |
492 | 8597 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8598 goto LABEL_84; |
8599 case VAR_BodyResistance: | |
492 | 8600 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8601 goto LABEL_84; |
8602 case VAR_LightResistance: | |
492 | 8603 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8604 goto LABEL_84; |
8605 case VAR_DarkResistance: | |
492 | 8606 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8607 goto LABEL_84; |
8608 case VAR_MagicResistance: | |
492 | 8609 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8610 LABEL_84: |
8611 v28 = 0; | |
8612 v26 = 92; | |
8613 goto LABEL_112; | |
8614 default: | |
8615 return; | |
8616 } | |
8617 return; | |
8618 } | |
8619 HIWORD(v15) = 0; | |
492 | 8620 if ( var_type > VAR_DisarmTrapSkill ) |
8621 { | |
8622 if ( var_type != VAR_LearningSkill ) | |
8623 { | |
8624 if ( var_type <= VAR_LearningSkill ) | |
0 | 8625 return; |
492 | 8626 if ( var_type <= VAR_Eradicated ) |
8627 { | |
8628 v4->SetCondition(var_type - 105, 1); | |
0 | 8629 } |
8630 else | |
8631 { | |
492 | 8632 if ( var_type != VAR_MajorCondition ) |
0 | 8633 { |
492 | 8634 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8635 byte_5E4C15[var_type] = var_value; | |
0 | 8636 return; |
8637 } | |
8638 memset(v4, 0, 0xA0u); | |
8639 } | |
8640 LABEL_124: | |
8641 v31 = 1; | |
8642 goto LABEL_169; | |
8643 } | |
8644 LABEL_106: | |
492 | 8645 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8646 v17 = *(char *)v16; |
492 | 8647 if ( var_value <= VAR_BodyResistanceBonus ) |
8648 { | |
8649 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8650 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8651 } | |
8652 else | |
8653 { | |
492 | 8654 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8655 } |
8656 *(short *)v16 = v18; | |
8657 goto LABEL_124; | |
8658 } | |
492 | 8659 if ( var_type == VAR_DisarmTrapSkill ) |
8660 if ( v30 != 1 ) | |
8661 { | |
8662 if ( v31 != 1 ) | |
8663 return; | |
8664 v5 = 0; | |
8665 goto LABEL_172; | |
8666 } | |
8667 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8668 goto LABEL_170; | |
8669 if ( var_type <= VAR_BodyResistanceBonus ) | |
8670 { | |
8671 switch ( var_type ) | |
0 | 8672 { |
8673 case VAR_BodyResistanceBonus: | |
492 | 8674 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8675 break; |
8676 case VAR_AirResistanceBonus: | |
492 | 8677 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8678 break; |
8679 case VAR_WaterResistanceBonus: | |
492 | 8680 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8681 break; |
8682 case VAR_EarthResistanceBonus: | |
492 | 8683 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8684 break; |
8685 case VAR_SpiritResistanceBonus: | |
492 | 8686 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8687 break; |
8688 default: | |
492 | 8689 if ( var_type != 62 ) |
0 | 8690 return; |
492 | 8691 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8692 break; |
8693 } | |
8694 goto LABEL_111; | |
8695 } | |
492 | 8696 if ( var_type == VAR_LightResistanceBonus ) |
8697 { | |
8698 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8699 goto LABEL_111; |
8700 } | |
492 | 8701 if ( var_type == VAR_DarkResistanceBonus ) |
8702 { | |
8703 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8704 goto LABEL_111; | |
8705 } | |
8706 if ( var_type == VAR_MagicResistanceBonus ) | |
8707 { | |
8708 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8709 goto LABEL_111; |
8710 } | |
492 | 8711 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8712 if ( v30 != 1 ) | |
8713 { | |
8714 if ( v31 != 1 ) | |
8715 return; | |
8716 v5 = 0; | |
8717 v25 = 8 * currPlayerId + 400; | |
862 | 8718 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8719 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8720 return; | |
8721 } | |
8722 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8723 goto LABEL_170; | |
0 | 8724 } |
8725 | |
8726 | |
8727 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8728 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8729 { |
8730 char v3; // bl@1 | |
8731 Player *v4; // esi@1 | |
8732 signed int uPlayerIdx; // edi@1 | |
8733 int v6; // eax@15 | |
8734 unsigned int v7; // esi@18 | |
8735 int *v8; // ebx@21 | |
8736 int v9; // eax@22 | |
8737 signed int v10; // eax@24 | |
8738 int v11; // eax@27 | |
8739 __int16 *v12; // esi@28 | |
8740 Player *v13; // ecx@34 | |
8741 Player *v14; // ecx@36 | |
8742 char *v15; // ecx@37 | |
8743 unsigned __int8 v16; // cf@38 | |
8744 Player *v17; // ecx@42 | |
8745 __int16 *v18; // esi@53 | |
8746 __int16 *v19; // esi@62 | |
8747 char *v20; // esi@107 | |
8748 __int16 v21; // dx@107 | |
8749 int v22; // ecx@107 | |
8750 Player *v23; // ecx@132 | |
8751 int v24; // eax@132 | |
8752 int v25; // eax@150 | |
8753 char v26; // zf@151 | |
8754 DDM_DLV_Header *v27; // eax@153 | |
8755 signed int v28; // eax@176 | |
8756 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8757 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8758 int v31; // [sp-4h] [bp-3Ch]@84 |
8759 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8760 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8761 char v34; // [sp+37h] [bp-1h]@1 | |
8762 | |
8763 auto Dst = this; | |
8764 v3 = 0; | |
8765 v34 = 0; | |
8766 v4 = Dst; | |
8767 uPlayerIdx = 0; | |
8768 if ( Dst == pPlayers[2] ) | |
8769 uPlayerIdx = 1; | |
310 | 8770 else if ( Dst == pPlayers[3] ) |
8771 uPlayerIdx = 2; | |
8772 else if ( Dst == pPlayers[4] ) | |
8773 uPlayerIdx = 3; | |
8774 | |
8775 if ( var_type <= VAR_AutoNotes ) | |
8776 { | |
8777 if ( var_type != VAR_AutoNotes ) | |
8778 { | |
8779 if ( var_type <= VAR_ActualMight ) | |
8780 { | |
8781 if ( var_type != VAR_ActualMight ) | |
0 | 8782 { |
310 | 8783 switch ( var_type ) |
0 | 8784 { |
8785 case VAR_RandomGold: | |
8786 if ( !val ) | |
8787 val = 1; | |
8788 v6 = rand(); | |
8789 party_finds_gold(v6 % val + 1, 1); | |
8790 GameUI_DrawFoodAndGold(); | |
8791 return; | |
8792 case VAR_RandomFood: | |
8793 if ( !val ) | |
8794 val = 1; | |
8795 v7 = rand() % val + 1; | |
8796 Party::GiveFood(v7); | |
8797 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8798 ShowStatusBarString(pTmpBuf, 2u); | |
8799 GameUI_DrawFoodAndGold(); | |
8800 goto _play_sound; | |
8801 case VAR_Sex: | |
8802 Dst->uSex = (PLAYER_SEX)val; | |
8803 goto _play_anim_and_exit; | |
8804 case VAR_Class: | |
135 | 8805 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8806 goto _play_anim_and_exit; |
8807 case VAR_CurrentHP: | |
8808 v8 = &Dst->sHealth; | |
8809 *v8 += val; | |
8810 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8811 goto _play_anim_and_exit; | |
8812 v9 = v4->GetMaxHealth(); | |
8813 goto LABEL_23; | |
8814 case VAR_MaxHP: | |
8815 v10 = Dst->GetMaxHealth(); | |
8816 v4->_health_related = 0; | |
8817 v4->uFullHealthBonus = 0; | |
8818 v4->sHealth = v10; | |
8819 return; | |
8820 case VAR_CurrentSP: | |
8821 v8 = &Dst->sMana; | |
8822 *v8 += val; | |
8823 if ( Dst->sMana > GetMaxMana() ) | |
8824 { | |
8825 v9 = v4->GetMaxMana(); | |
8826 LABEL_23: | |
8827 *v8 = v9; | |
8828 } | |
8829 goto _play_anim_and_exit; | |
8830 case VAR_MaxSP: | |
8831 v11 = GetMaxMana(); | |
8832 v4->_mana_related = 0; | |
8833 v4->uFullManaBonus = 0; | |
8834 v4->sMana = v11; | |
8835 return; | |
8836 case VAR_ACModifier: | |
8837 v12 = &Dst->sACModifier; | |
8838 goto LABEL_29; | |
8839 case VAR_BaseLevel: | |
8840 v12 = (__int16 *)&Dst->uLevel; | |
8841 goto LABEL_29; | |
8842 case VAR_LevelModifier: | |
8843 v12 = &Dst->sLevelModifier; | |
8844 LABEL_29: | |
8845 *v12 += val; | |
8846 if ( *v12 > 255 ) | |
8847 *v12 = 255; | |
8848 goto _play_anim_and_exit; | |
8849 case VAR_Age: | |
8850 Dst->sAgeModifier += val; | |
8851 return; | |
8852 case VAR_Award: | |
8853 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8854 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8855 | |
492 | 8856 && pAwards[val].pText ) |
0 | 8857 { |
8858 v14 = pPlayers[uPlayerIdx + 1]; | |
8859 v34 = 1; | |
8860 v3 = 1; | |
187 | 8861 v14->PlaySound(SPEECH_96, 0); |
0 | 8862 } |
735 | 8863 v15 = (char *)v4->_guilds_member_bits; |
0 | 8864 goto LABEL_44; |
8865 case VAR_Experience: | |
8866 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8867 LODWORD(Dst->uExperience) += val; | |
8868 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8869 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8870 Dst->uExperience = 4000000000i64; | |
8871 goto _play_anim_and_exit; | |
8872 case VAR_QBits_QuestsDone: | |
484 | 8873 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
|
8874 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8875 && pQuestTable[val-1] ) |
0 | 8876 { |
501 | 8877 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8878 bFlashQuestBook = 1; |
8879 v34 = 1; | |
8880 v3 = 1; | |
501 | 8881 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8882 } |
484 | 8883 v15 = (char *)pParty->_quest_bits; |
0 | 8884 LABEL_44: |
8885 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8886 goto LABEL_173; | |
8887 case VAR_PlayerItemInHands: | |
8888 item.Reset(); | |
8889 item.Reset(); | |
8890 item.uAttributes = 1; | |
8891 item.uItemID = val; | |
8892 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8893 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8894 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8895 { | |
8896 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8897 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8898 } | |
8899 pParty->SetHoldingItem(&item); | |
8900 return; | |
8901 case VAR_FixedGold: | |
8902 party_finds_gold(val, 1); | |
8903 return; | |
8904 case VAR_BaseMight: | |
8905 v18 = (__int16 *)&Dst->uMight; | |
8906 goto LABEL_82; | |
8907 case VAR_BaseIntellect: | |
8908 v18 = (__int16 *)&Dst->uIntelligence; | |
8909 goto LABEL_82; | |
8910 case VAR_BasePersonality: | |
8911 v18 = (__int16 *)&Dst->uWillpower; | |
8912 goto LABEL_82; | |
8913 case VAR_BaseEndurance: | |
8914 v18 = (__int16 *)&Dst->uEndurance; | |
8915 goto LABEL_82; | |
8916 case VAR_BaseSpeed: | |
8917 v18 = (__int16 *)&Dst->uSpeed; | |
8918 goto LABEL_82; | |
8919 case VAR_BaseAccuracy: | |
8920 v18 = (__int16 *)&Dst->uAccuracy; | |
8921 goto LABEL_82; | |
8922 case VAR_BaseLuck: | |
8923 v18 = (__int16 *)&Dst->uLuck; | |
8924 goto LABEL_82; | |
8925 case VAR_FixedFood: | |
8926 Party::GiveFood(val); | |
715 | 8927 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8928 ShowStatusBarString(pTmpBuf, 2u); |
8929 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8930 Party::SetFood(0xFFFFu); | |
8931 goto _play_sound; | |
8932 case VAR_MightBonus: | |
8933 goto LABEL_62; | |
8934 case VAR_IntellectBonus: | |
8935 goto LABEL_66; | |
8936 case VAR_PersonalityBonus: | |
8937 goto LABEL_67; | |
8938 case VAR_EnduranceBonus: | |
8939 goto LABEL_68; | |
8940 case VAR_SpeedBonus: | |
8941 goto LABEL_69; | |
8942 case VAR_AccuracyBonus: | |
8943 goto LABEL_70; | |
8944 case VAR_LuckBonus: | |
8945 goto LABEL_71; | |
8946 default: | |
8947 return; | |
8948 } | |
8949 return; | |
8950 } | |
8951 LABEL_62: | |
8952 v19 = (__int16 *)&Dst->uMightBonus; | |
8953 goto LABEL_113; | |
8954 } | |
310 | 8955 if ( var_type <= VAR_FireResistanceBonus ) |
8956 { | |
8957 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8958 { |
310 | 8959 switch ( var_type ) |
0 | 8960 { |
8961 case VAR_ActualIntellect: | |
8962 LABEL_66: | |
8963 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8964 goto LABEL_113; | |
8965 case VAR_ActualPersonality: | |
8966 LABEL_67: | |
8967 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8968 goto LABEL_113; | |
8969 case VAR_ActualEndurance: | |
8970 LABEL_68: | |
8971 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8972 goto LABEL_113; | |
8973 case VAR_ActualSpeed: | |
8974 LABEL_69: | |
8975 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8976 goto LABEL_113; | |
8977 case VAR_ActualAccuracy: | |
8978 LABEL_70: | |
8979 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8980 goto LABEL_113; | |
8981 case VAR_ActualLuck: | |
8982 LABEL_71: | |
8983 v19 = (__int16 *)&Dst->uLuckBonus; | |
8984 goto LABEL_113; | |
8985 case VAR_FireResistance: | |
8986 v18 = &Dst->sResFireBase; | |
8987 goto LABEL_82; | |
8988 case VAR_AirResistance: | |
8989 v18 = &Dst->sResAirBase; | |
8990 goto LABEL_82; | |
8991 case VAR_WaterResistance: | |
8992 v18 = &Dst->sResWaterBase; | |
8993 goto LABEL_82; | |
8994 case VAR_EarthResistance: | |
8995 v18 = &Dst->sResEarthBase; | |
8996 goto LABEL_82; | |
8997 case VAR_SpiritResistance: | |
8998 v18 = &Dst->sResSpiritBase; | |
8999 goto LABEL_82; | |
9000 case VAR_MindResistance: | |
9001 v18 = &Dst->sResMindBase; | |
9002 goto LABEL_82; | |
9003 case VAR_BodyResistance: | |
9004 v18 = &Dst->sResBodyBase; | |
9005 goto LABEL_82; | |
9006 case VAR_LightResistance: | |
9007 v18 = &Dst->sResLightBase; | |
9008 goto LABEL_82; | |
9009 case VAR_DarkResistance: | |
9010 v18 = &Dst->sResDarkBase; | |
9011 goto LABEL_82; | |
9012 case VAR_MagicResistance: | |
9013 v18 = &Dst->sResMagicBase; | |
9014 LABEL_82: | |
9015 *v18 += val; | |
9016 if ( *v18 > 255 ) | |
9017 *v18 = 255; | |
9018 v31 = 0; | |
9019 v29 = 92; | |
9020 goto LABEL_116; | |
9021 default: | |
9022 return; | |
9023 } | |
9024 return; | |
9025 } | |
9026 v19 = &Dst->sResFireBonus; | |
9027 LABEL_113: | |
9028 *v19 += val; | |
9029 if ( *v19 > 255 ) | |
9030 *v19 = 255; | |
9031 v31 = 0; | |
187 | 9032 v29 = SPEECH_91; |
0 | 9033 LABEL_116: |
9034 v3 = 1; | |
187 | 9035 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9036 goto _play_anim_and_maybe_sound; |
9037 } | |
310 | 9038 if ( var_type <= VAR_DisarmTrapSkill ) |
9039 { | |
9040 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9041 { |
310 | 9042 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9043 { |
310 | 9044 switch ( var_type ) |
0 | 9045 { |
9046 case VAR_BodyResistanceBonus: | |
9047 v19 = &Dst->sResBodyBonus; | |
9048 break; | |
9049 case VAR_AirResistanceBonus: | |
9050 v19 = &Dst->sResAirBonus; | |
9051 break; | |
9052 case VAR_WaterResistanceBonus: | |
9053 v19 = &Dst->sResWaterBonus; | |
9054 break; | |
9055 case VAR_EarthResistanceBonus: | |
9056 v19 = &Dst->sResEarthBonus; | |
9057 break; | |
9058 case VAR_SpiritResistanceBonus: | |
9059 v19 = &Dst->sResSpiritBonus; | |
9060 break; | |
9061 default: | |
310 | 9062 if ( var_type != 62 ) |
0 | 9063 return; |
9064 v19 = &Dst->sResMindBonus; | |
9065 break; | |
9066 } | |
9067 goto LABEL_113; | |
9068 } | |
310 | 9069 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9070 { |
9071 v19 = &Dst->sResLightBonus; | |
9072 goto LABEL_113; | |
9073 } | |
310 | 9074 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9075 { |
9076 v19 = &Dst->sResDarkBonus; | |
9077 goto LABEL_113; | |
9078 } | |
310 | 9079 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9080 { |
9081 v19 = &Dst->sResMagicBonus; | |
9082 goto LABEL_113; | |
9083 } | |
310 | 9084 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9085 return; |
9086 } | |
9087 goto LABEL_106; | |
9088 } | |
310 | 9089 if ( var_type == VAR_LearningSkill ) |
0 | 9090 { |
9091 LABEL_106: | |
9092 if ( val <= VAR_BodyResistanceBonus ) | |
9093 { | |
310 | 9094 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9095 } |
9096 else | |
9097 { | |
310 | 9098 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9099 v21 = *(short *)v20; |
9100 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9101 if ( v22 > 60 ) | |
9102 LOWORD(v22) = 60; | |
9103 LOBYTE(v21) = v21 & 0xC0; | |
9104 *(short *)v20 = v22 | v21; | |
9105 } | |
9106 goto _play_anim_and_exit; | |
9107 } | |
310 | 9108 if ( var_type <= VAR_LearningSkill ) |
0 | 9109 return; |
310 | 9110 if ( var_type <= VAR_Eradicated ) |
9111 { | |
9112 Dst->SetCondition(var_type - 105, 0); | |
0 | 9113 } |
9114 else | |
9115 { | |
310 | 9116 if ( var_type != VAR_MajorCondition ) |
0 | 9117 { |
310 | 9118 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9119 { |
310 | 9120 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9121 byte_5E4C15[var_type] += val; | |
0 | 9122 else |
310 | 9123 byte_5E4C15[var_type] = -1; |
0 | 9124 } |
9125 return; | |
9126 } | |
9127 memset(Dst, 0, 0xA0u); | |
9128 } | |
9129 _play_anim_and_exit: | |
9130 v3 = 1; | |
9131 _play_anim_and_maybe_sound: | |
9132 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9133 _maybe_play_sound: | |
9134 if ( v3 != 1 ) | |
9135 return; | |
9136 goto _play_sound; | |
9137 } | |
9138 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
|
9139 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9140 && pAutonoteTxt[val-1].pText ) |
0 | 9141 { |
9142 v23 = pPlayers[uPlayerIdx + 1]; | |
9143 v34 = 1; | |
187 | 9144 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9145 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9146 bFlashAutonotesBook = 1; |
981 | 9147 _506568_autonote_type = v24; |
0 | 9148 } |
9149 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9150 v3 = 1; | |
9151 LABEL_173: | |
9152 if ( v34 != 1 ) | |
9153 goto _maybe_play_sound; | |
9154 goto _play_anim_and_maybe_sound; | |
9155 } | |
310 | 9156 if ( var_type > VAR_GoldInBank ) |
9157 { | |
9158 if ( var_type == 307 ) | |
0 | 9159 { |
9160 pParty->uNumDeaths += val; | |
9161 goto LABEL_173; | |
9162 } | |
310 | 9163 switch ( var_type ) |
0 | 9164 { |
9165 case 308: | |
9166 pParty->uNumBountiesCollected += val; | |
9167 break; | |
9168 case 309: | |
9169 pParty->uNumPrisonTerms += val; | |
9170 break; | |
9171 case 310: | |
9172 pParty->uNumArenaPageWins += val; | |
9173 break; | |
9174 case 311: | |
9175 pParty->uNumArenaSquireWins += val; | |
9176 break; | |
9177 case 312: | |
9178 pParty->uNumArenaKnightWins += val; | |
9179 break; | |
9180 case 313: | |
9181 pParty->uNumArenaLordWins += val; | |
9182 break; | |
9183 } | |
9184 } | |
9185 else | |
9186 { | |
310 | 9187 if ( var_type == VAR_GoldInBank ) |
0 | 9188 { |
9189 pParty->uNumGoldInBank += val; | |
9190 return; | |
9191 } | |
310 | 9192 if ( var_type <= VAR_Counter8 ) |
9193 { | |
9194 if ( (signed int)var_type >= 245 ) | |
9195 { | |
9196 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9197 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9198 } |
9199 else | |
9200 { | |
310 | 9201 switch ( var_type ) |
0 | 9202 { |
9203 case VAR_MonthEquals|VAR_CurrentSP: | |
9204 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9205 break; | |
9206 case VAR_NPCs2: | |
9207 pParty->field_709 = 0; | |
9208 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9209 Party__CountHirelings(); |
0 | 9210 viewparams->bRedrawGameUI = 1; |
9211 break; | |
9212 case VAR_NumSkillPoints: | |
9213 Dst->uSkillPoints += val; | |
9214 break; | |
9215 } | |
9216 } | |
9217 return; | |
9218 } | |
310 | 9219 if ( var_type < VAR_Counter9 ) |
0 | 9220 return; |
310 | 9221 if ( (signed int)var_type <= 274 ) |
9222 { | |
9223 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9224 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9225 goto _play_sound; |
9226 } | |
310 | 9227 if ( var_type != VAR_ReputationInCurrentLocation ) |
9228 { | |
9229 if ( var_type <= VAR_ReputationInCurrentLocation | |
9230 || var_type > VAR_History_28 | |
9231 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9232 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9233 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9234 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9235 v26) ) |
9236 return; | |
9237 bFlashHistoryBook = 1; | |
9238 _play_sound: | |
9239 v28 = 8 * uPlayerIdx + 400; | |
862 | 9240 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9241 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9242 return; | |
9243 } | |
9244 v27 = &pOutdoor->ddm; | |
9245 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9246 v27 = &pIndoor->dlv; | |
9247 v27->uReputation += val; | |
9248 if ( v27->uReputation > 10000 ) | |
9249 v27->uReputation = 10000; | |
9250 } | |
9251 } | |
9252 // 506568: using guessed type int dword_506568; | |
9253 // 507948: using guessed type char bFlashHistoryBook; | |
9254 // 507949: using guessed type char bFlashAutonotesBook; | |
9255 // 50794A: using guessed type char bFlashQuestBook; | |
9256 // 72371C: using guessed type int dword_72371C[]; | |
9257 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9258 | |
9259 | |
9260 | |
9261 | |
9262 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9263 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9264 { |
9265 unsigned int v3; // ebx@1 | |
9266 signed int v4; // esi@1 | |
501 | 9267 bool result; // eax@8 |
0 | 9268 int v6; // esi@11 |
9269 int v7; // edi@14 | |
9270 signed int v8; // eax@17 | |
9271 char *v9; // eax@20 | |
9272 char v10; // sf@20 | |
9273 char *v11; // ecx@26 | |
9274 char *v12; // ecx@27 | |
9275 __int64 v13; // qax@27 | |
9276 unsigned __int8 v14; // cf@27 | |
501 | 9277 int *v15; // edx@29 |
0 | 9278 char *v16; // eax@90 |
9279 char *v17; // ecx@94 | |
501 | 9280 int v18; // esi@97 |
0 | 9281 signed int v19; // edx@97 |
9282 char *v20; // ecx@98 | |
9283 int v21; // eax@100 | |
9284 __int16 v22; // dx@112 | |
9285 int v23; // [sp-8h] [bp-14h]@45 | |
9286 signed int v24; // [sp-4h] [bp-10h]@4 | |
9287 int v25; // [sp-4h] [bp-10h]@45 | |
9288 | |
9289 v3 = 0; | |
605 | 9290 v4 = uActiveCharacter - 1; |
501 | 9291 result = false; |
9292 if ( (signed int)VarNum > 222 ) | |
9293 { | |
9294 if ( (signed int)VarNum <= 307 ) | |
9295 { | |
9296 if ( VarNum == 307 ) | |
9297 { | |
9298 pParty->uNumDeaths -= (unsigned int)pValue; | |
9299 return pValue; | |
9300 } | |
9301 if ( VarNum == 223 ) | |
0 | 9302 { |
9303 v11 = (char *)pParty->_autonote_bits; | |
501 | 9304 v22 = (short)pValue - 1; |
0 | 9305 } |
9306 else | |
9307 { | |
501 | 9308 if ( VarNum != 231 ) |
0 | 9309 { |
501 | 9310 switch ( VarNum ) |
0 | 9311 { |
9312 case 232: | |
501 | 9313 VarNum = (VariableType)0; |
602 | 9314 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9315 result = (bool) pValue; |
9316 dword_5B65CC = 0; | |
9317 if ( (int)VarNum == pValue ) | |
0 | 9318 { |
501 | 9319 dword_5B65CC = (int)pValue; |
0 | 9320 } |
9321 else | |
9322 { | |
9323 pParty->field_709 = 0; | |
501 | 9324 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9325 Party__CountHirelings(); |
0 | 9326 viewparams->bRedrawGameUI = 1; |
9327 } | |
9328 break; | |
9329 case 241: | |
9330 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9331 { | |
9332 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9333 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9334 { |
605 | 9335 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9336 { |
9337 v21 = *(int *)v20; | |
9338 if ( (char)*(int *)v20 < 0 ) | |
9339 { | |
9340 LOBYTE(v21) = v21 & 0x7F; | |
9341 *(int *)v20 = v21; | |
9342 } | |
9343 } | |
9344 v20 += 76; | |
9345 } | |
9346 } | |
605 | 9347 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9348 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9349 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9350 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9351 pParty->field_709 = 0; | |
659 | 9352 Party__CountHirelings(); |
0 | 9353 break; |
9354 case 243: | |
9355 v17 = (char *)&this->uSkillPoints; | |
501 | 9356 result = *v17; |
9357 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9358 { | |
9359 *(int *)v17 -= (int)pValue; | |
9360 result = v17; | |
9361 } | |
0 | 9362 else |
9363 *(int *)v17 = 0; | |
9364 break; | |
9365 case 275: | |
9366 v16 = (char *)&pOutdoor->ddm; | |
9367 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9368 v16 = (char *)&pIndoor->dlv; | |
501 | 9369 *((int *)v16 + 2) -= (int)pValue; |
0 | 9370 if ( *((int *)v16 + 2) < -10000 ) |
9371 *((int *)v16 + 2) = -10000; | |
9372 break; | |
9373 case 306: | |
501 | 9374 result = VarNum - 306; |
9375 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9376 { | |
9377 result = (bool)pValue; | |
9378 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9379 } |
0 | 9380 else |
9381 LABEL_88: | |
9382 dword_5B65C4 = 1; | |
9383 break; | |
9384 } | |
501 | 9385 return result; |
0 | 9386 } |
9387 v11 = this->field_1A50; | |
501 | 9388 v22 = (signed __int16)pValue; |
0 | 9389 } |
9390 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9391 return result; |
9392 } | |
9393 switch ( VarNum ) | |
0 | 9394 { |
9395 case 308: | |
501 | 9396 result = (bool)pValue; |
9397 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9398 break; |
9399 case 309: | |
501 | 9400 result = (bool)pValue; |
9401 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9402 break; |
9403 case 310: | |
501 | 9404 result = (bool)pValue; |
9405 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9406 break; |
9407 case 311: | |
501 | 9408 result = (bool)pValue; |
9409 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9410 break; |
9411 case 312: | |
501 | 9412 result = (bool)pValue; |
9413 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9414 break; |
9415 case 313: | |
501 | 9416 result = (bool)pValue; |
9417 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9418 break; |
9419 } | |
9420 } | |
9421 else | |
9422 { | |
501 | 9423 if ( (signed int)VarNum >= 123 ) |
9424 { | |
9425 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9426 } |
9427 else | |
9428 { | |
501 | 9429 switch ( VarNum ) |
0 | 9430 { |
9431 case VAR_RandomGold: | |
501 | 9432 v6 = rand() % (signed int)pValue + 1; |
0 | 9433 if ( v6 > pParty->uNumGold ) |
9434 v6 = pParty->uNumGold; | |
9435 Party::TakeGold(v6); | |
9436 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9437 ShowStatusBarString(pTmpBuf, 2); |
0 | 9438 GameUI_DrawFoodAndGold(); |
501 | 9439 return result; |
0 | 9440 case VAR_RandomFood: |
501 | 9441 v7 = rand() % (signed int)pValue + 1; |
0 | 9442 if ( v7 > pParty->uNumFoodRations ) |
9443 v7 = pParty->uNumFoodRations; | |
9444 Party::TakeFood(v7); | |
9445 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9446 ShowStatusBarString(pTmpBuf, 2u); | |
9447 GameUI_DrawFoodAndGold(); | |
605 | 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); |
501 | 9452 return result; |
0 | 9453 case VAR_CurrentHP: |
501 | 9454 ReceiveDamage((signed int)pValue, 4); |
605 | 9455 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9456 v8 = 8 * v4 + 400; | |
862 | 9457 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9458 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9459 return result; | |
0 | 9460 case VAR_CurrentSP: |
9461 v9 = (char *)&this->sMana; | |
501 | 9462 v10 = this->sMana - (signed int)pValue < 0; |
9463 *(int *)v9 -= (int)pValue; | |
0 | 9464 if ( v10 ) |
9465 *(int *)v9 = 0; | |
605 | 9466 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9467 v8 = 8 * v4 + 400; | |
862 | 9468 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9469 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9470 return result; | |
0 | 9471 case VAR_ACModifier: |
501 | 9472 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9473 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9474 v8 = 8 * v4 + 400; | |
862 | 9475 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9476 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9477 return result; | |
0 | 9478 case VAR_BaseLevel: |
501 | 9479 this->uLevel -= (unsigned __int8)pValue; |
605 | 9480 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9481 v8 = 8 * v4 + 400; | |
862 | 9482 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9483 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9484 return result; | |
0 | 9485 case VAR_LevelModifier: |
501 | 9486 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9487 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9488 v8 = 8 * v4 + 400; | |
862 | 9489 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9490 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9491 return result; | |
0 | 9492 case VAR_Age: |
501 | 9493 this->sAgeModifier -= (signed __int16)pValue; |
9494 return result; | |
0 | 9495 case VAR_Award: |
605 | 9496 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9497 return result; | |
0 | 9498 case VAR_Experience: |
9499 v12 = (char *)&this->uExperience; | |
501 | 9500 v13 = (signed int)pValue; |
9501 v14 = *(int *)v12 < (unsigned int)pValue; | |
9502 *(int *)v12 -= (int)pValue; | |
0 | 9503 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9504 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9505 v8 = 8 * v4 + 400; | |
862 | 9506 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9507 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9508 return result; | |
0 | 9509 case VAR_QBits_QuestsDone: |
501 | 9510 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9511 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9512 return true; |
0 | 9513 case VAR_PlayerItemInHands: |
501 | 9514 v15 = this->pInventoryIndices; |
0 | 9515 break; |
9516 case VAR_FixedGold: | |
501 | 9517 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9518 goto LABEL_88; |
501 | 9519 Party::TakeGold((unsigned int)pValue); |
9520 return result; | |
0 | 9521 case VAR_MightBonus: |
9522 case VAR_ActualMight: | |
501 | 9523 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9524 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9525 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9526 v8 = 8 * v4 + 400; | |
862 | 9527 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9528 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9529 return result; | |
0 | 9530 case VAR_IntellectBonus: |
9531 case VAR_ActualIntellect: | |
501 | 9532 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9533 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9534 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9535 v8 = 8 * v4 + 400; | |
862 | 9536 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9537 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9538 return result; | |
0 | 9539 case VAR_PersonalityBonus: |
9540 case VAR_ActualPersonality: | |
501 | 9541 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9542 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9543 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9544 v8 = 8 * v4 + 400; | |
862 | 9545 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9546 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9547 return result; | |
0 | 9548 case VAR_EnduranceBonus: |
9549 case VAR_ActualEndurance: | |
501 | 9550 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9551 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9552 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9553 v8 = 8 * v4 + 400; | |
862 | 9554 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9555 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9556 return result; | |
0 | 9557 case VAR_SpeedBonus: |
9558 case VAR_ActualSpeed: | |
501 | 9559 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9560 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9561 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9562 v8 = 8 * v4 + 400; | |
862 | 9563 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9564 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9565 return result; | |
0 | 9566 case VAR_AccuracyBonus: |
9567 case VAR_ActualAccuracy: | |
501 | 9568 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9569 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9570 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9571 v8 = 8 * v4 + 400; | |
862 | 9572 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9573 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9574 return result; | |
0 | 9575 case VAR_LuckBonus: |
9576 case VAR_ActualLuck: | |
501 | 9577 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9578 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9579 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9580 v8 = 8 * v4 + 400; | |
862 | 9581 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9582 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9583 return result; | |
0 | 9584 case VAR_BaseMight: |
501 | 9585 this->uMight -= (unsigned __int16)pValue; |
605 | 9586 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9587 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9588 v8 = 8 * v4 + 400; | |
862 | 9589 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9590 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9591 return result; | |
0 | 9592 case VAR_BaseIntellect: |
501 | 9593 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9594 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9595 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9596 v8 = 8 * v4 + 400; | |
862 | 9597 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9598 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9599 return result; | |
0 | 9600 case VAR_BasePersonality: |
501 | 9601 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9602 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9603 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9604 v8 = 8 * v4 + 400; | |
862 | 9605 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9606 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9607 return result; | |
0 | 9608 case VAR_BaseEndurance: |
501 | 9609 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9610 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9611 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9612 v8 = 8 * v4 + 400; | |
862 | 9613 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9614 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9615 return result; | |
0 | 9616 case VAR_BaseSpeed: |
501 | 9617 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9618 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9619 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9620 v8 = 8 * v4 + 400; | |
862 | 9621 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9622 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9623 return result; | |
0 | 9624 case VAR_BaseAccuracy: |
501 | 9625 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9626 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9627 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9628 v8 = 8 * v4 + 400; | |
862 | 9629 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9630 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9631 return result; | |
0 | 9632 case VAR_BaseLuck: |
501 | 9633 this->uLuck -= (unsigned __int16)pValue; |
605 | 9634 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9635 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9636 v8 = 8 * v4 + 400; | |
862 | 9637 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9638 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9639 return result; | |
0 | 9640 case VAR_FireResistance: |
501 | 9641 this->sResFireBase -= (signed __int16)pValue; |
605 | 9642 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9643 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9644 v8 = 8 * v4 + 400; | |
862 | 9645 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9646 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9647 return result; | |
0 | 9648 case VAR_AirResistance: |
501 | 9649 this->sResAirBase -= (signed __int16)pValue; |
605 | 9650 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9651 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9652 v8 = 8 * v4 + 400; | |
862 | 9653 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9654 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9655 return result; | |
0 | 9656 case VAR_WaterResistance: |
501 | 9657 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9658 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9659 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9660 v8 = 8 * v4 + 400; | |
862 | 9661 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9662 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9663 return result; | |
0 | 9664 case VAR_EarthResistance: |
501 | 9665 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9666 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9667 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9668 v8 = 8 * v4 + 400; | |
862 | 9669 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9670 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9671 return result; | |
0 | 9672 case VAR_SpiritResistance: |
501 | 9673 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9674 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9675 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9676 v8 = 8 * v4 + 400; | |
862 | 9677 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9678 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9679 return result; | |
0 | 9680 case VAR_MindResistance: |
501 | 9681 this->sResMindBase -= (signed __int16)pValue; |
605 | 9682 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9683 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9684 v8 = 8 * v4 + 400; | |
862 | 9685 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9686 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9687 return result; | |
0 | 9688 case VAR_BodyResistance: |
501 | 9689 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9690 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9691 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9692 v8 = 8 * v4 + 400; | |
862 | 9693 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9694 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9695 return result; | |
0 | 9696 case VAR_LightResistance: |
501 | 9697 this->sResLightBase -= (signed __int16)pValue; |
605 | 9698 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9699 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9700 v8 = 8 * v4 + 400; | |
862 | 9701 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9702 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9703 return result; | |
0 | 9704 case VAR_DarkResistance: |
501 | 9705 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9706 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9707 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9708 v8 = 8 * v4 + 400; | |
862 | 9709 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9710 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9711 return result; | |
0 | 9712 case VAR_MagicResistance: |
501 | 9713 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9714 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9715 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9716 v8 = 8 * v4 + 400; | |
862 | 9717 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9718 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9719 return result; | |
0 | 9720 case VAR_FireResistanceBonus: |
501 | 9721 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9722 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9723 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9724 v8 = 8 * v4 + 400; | |
862 | 9725 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9726 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9727 return result; | |
0 | 9728 case VAR_AirResistanceBonus: |
501 | 9729 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9730 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9731 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9732 v8 = 8 * v4 + 400; | |
862 | 9733 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9734 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9735 return result; | |
0 | 9736 case VAR_WaterResistanceBonus: |
501 | 9737 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9738 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9739 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9740 v8 = 8 * v4 + 400; | |
862 | 9741 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9742 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9743 return result; | |
0 | 9744 case VAR_EarthResistanceBonus: |
501 | 9745 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9746 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9747 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9748 v8 = 8 * v4 + 400; | |
862 | 9749 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9750 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9751 return result; | |
0 | 9752 case VAR_SpiritResistanceBonus: |
501 | 9753 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9754 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9755 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9756 v8 = 8 * v4 + 400; | |
862 | 9757 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9758 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9759 return result; | |
0 | 9760 case VAR_MindResistanceBonus: |
501 | 9761 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9762 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9763 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9764 v8 = 8 * v4 + 400; | |
862 | 9765 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9766 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9767 return result; | |
0 | 9768 case VAR_BodyResistanceBonus: |
501 | 9769 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9770 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9771 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9772 v8 = 8 * v4 + 400; | |
862 | 9773 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9774 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9775 return result; | |
0 | 9776 case VAR_LightResistanceBonus: |
501 | 9777 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9778 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9779 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9780 v8 = 8 * v4 + 400; | |
862 | 9781 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9782 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9783 return result; | |
0 | 9784 case VAR_DarkResistanceBonus: |
501 | 9785 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9786 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9787 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9788 v8 = 8 * v4 + 400; | |
862 | 9789 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9790 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9791 return result; | |
0 | 9792 case VAR_MagicResistanceBonus: |
501 | 9793 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9794 v25 = 0; |
187 | 9795 v23 = SPEECH_91; |
9796 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9797 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9798 v8 = 8 * v4 + 400; | |
862 | 9799 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9800 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9801 return result; | |
0 | 9802 case VAR_FixedFood: |
501 | 9803 Party::TakeFood((unsigned int)pValue); |
605 | 9804 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9805 v8 = 8 * v4 + 400; | |
862 | 9806 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9807 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9808 return result; | |
0 | 9809 case VAR_StaffSkill: |
9810 case VAR_SwordSkill: | |
9811 case VAR_DaggerSkill: | |
9812 case VAR_AxeSkill: | |
9813 case VAR_SpearSkill: | |
9814 case VAR_BowSkill: | |
9815 case VAR_MaceSkill: | |
9816 case VAR_BlasterSkill: | |
9817 case VAR_ShieldSkill: | |
9818 case VAR_LeatherSkill: | |
9819 case VAR_SkillChain: | |
9820 case VAR_PlateSkill: | |
9821 case VAR_FireSkill: | |
9822 case VAR_AirSkill: | |
9823 case VAR_WaterSkill: | |
9824 case VAR_EarthSkill: | |
9825 case VAR_SpiritSkill: | |
9826 case VAR_MindSkill: | |
9827 case VAR_BodySkill: | |
9828 case VAR_LightSkill: | |
9829 case VAR_DarkSkill: | |
9830 case VAR_IdentifyItemSkill: | |
9831 case VAR_MerchantSkill: | |
9832 case VAR_RepairSkill: | |
9833 case VAR_BodybuildingSkill: | |
9834 case VAR_MeditationSkill: | |
9835 case VAR_PerceptionSkill: | |
9836 case VAR_DiplomacySkill: | |
9837 case VAR_DisarmTrapSkill: | |
9838 case VAR_LearningSkill: | |
501 | 9839 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9840 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9841 v8 = 8 * v4 + 400; | |
862 | 9842 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9843 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9844 return result; | |
0 | 9845 case VAR_Cursed: |
9846 case VAR_Weak: | |
9847 case VAR_Asleep: | |
9848 case VAR_Afraid: | |
9849 case VAR_Drunk: | |
9850 case VAR_Insane: | |
9851 case VAR_PoisonedGreen: | |
9852 case VAR_DiseasedGreen: | |
9853 case VAR_PoisonedYellow: | |
9854 case VAR_DiseasedYellow: | |
9855 case VAR_PoisonedRed: | |
9856 case VAR_DiseasedRed: | |
9857 case VAR_Paralyzed: | |
9858 case VAR_Unconsious: | |
9859 case VAR_Dead: | |
9860 case VAR_Stoned: | |
9861 case VAR_Eradicated: | |
501 | 9862 *((int *)this + 2 * VarNum - 210) = 0; |
9863 *((int *)this + 2 * result - 209) = 0; | |
0 | 9864 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9865 v8 = 8 * v4 + 400; | |
862 | 9866 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9867 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9868 return result; |
605 | 9869 default: |
9870 return result; | |
9871 } | |
9872 for (v3 = 1; v3 < 126; v3++) | |
9873 { | |
9874 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9875 { |
605 | 9876 RemoveItemAtInventoryIndex(v3); |
501 | 9877 return true; |
0 | 9878 } |
605 | 9879 } |
501 | 9880 if ( pParty->pPickedItem.uItemID == pValue ) |
9881 { | |
605 | 9882 pMouse->RemoveHoldingItem(); |
9883 return true; | |
9884 } | |
9885 return false; | |
0 | 9886 } |
9887 } | |
9888 } | |
9889 // 5B65C4: using guessed type int dword_5B65C4; | |
9890 // 5B65CC: using guessed type int dword_5B65CC; |