Mercurial > mm7
annotate Player.cpp @ 1036:7f8be9f9769e
player recieve damage
author | Gloval |
---|---|
date | Wed, 22 May 2013 22:25:44 +0400 |
parents | aa848c90181f |
children | ff2d888f8033 |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
1016 | 3 #include "stru6.h" |
4 | |
5 | |
0 | 6 #include "OSAPI.h" |
7 #include "Player.h" | |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
0 | 29 |
30 | |
31 | |
32 | |
33 | |
34 | |
35 /* 381 */ | |
36 #pragma pack(push, 1) | |
290 | 37 struct PlayerCreation_AttributeProps |
0 | 38 { |
39 unsigned __int8 uBaseValue; | |
40 char uMaxValue; | |
41 char uDroppedStep; | |
42 char uBaseStep; | |
43 }; | |
44 #pragma pack(pop) | |
45 | |
46 | |
47 #pragma pack(push, 1) | |
290 | 48 |
49 | |
50 | |
0 | 51 #pragma pack(pop) |
290 | 52 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
53 { | |
54 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
55 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
56 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
57 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 58 }; |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 // available skills per class ( 9 classes X 37 skills ) | |
66 // 0 - not available | |
67 // 1 - available | |
68 // 2 - primary skill | |
69 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
70 { | |
71 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
72 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
73 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
74 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
75 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
76 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
77 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
78 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
79 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
80 }; | |
81 | |
82 | |
83 | |
84 | |
85 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
86 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
87 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
88 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
89 | |
90 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
91 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
93 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
94 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
96 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
97 | |
98 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
99 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
101 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
102 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
104 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
105 | |
1036 | 106 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 107 |
108 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
109 | |
1036 | 110 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
113 signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6}; | |
0 | 114 |
115 | |
1010 | 116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
117 | |
0 | 118 |
816 | 119 unsigned short base_recovery_times_per_weapon_type[12] = |
120 { | |
121 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
122 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
123 60, // PLAYER_SKILL_DAGGER | |
124 100, // PLAYER_SKILL_AXE | |
125 80, // PLAYER_SKILL_SPEAR | |
126 100, // PLAYER_SKILL_BOW | |
127 80, // PLAYER_SKILL_MACE | |
128 30, // PLAYER_SKILL_BLASTER | |
129 10, // PLAYER_SKILL_SHIELD | |
130 10, // PLAYER_SKILL_LEATHER | |
131 20, // PLAYER_SKILL_CHAIN | |
132 30 // PLAYER_SKILL_PLATE | |
133 }; | |
134 | |
135 | |
0 | 136 |
137 //----- (00490913) -------------------------------------------------------- | |
138 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
139 { | |
140 signed int v0; // edi@1 | |
141 signed int v1; // esi@1 | |
142 int v2; // ebx@2 | |
143 int v3; // ecx@17 | |
144 signed int v4; // eax@17 | |
145 int v5; // edx@18 | |
146 signed int v6; // ecx@18 | |
147 signed int v8; // [sp+Ch] [bp-8h]@1 | |
148 signed int v9; // [sp+10h] [bp-4h]@2 | |
149 | |
150 v8 = 50; | |
151 v0 = 50; | |
152 v1 = 0; | |
153 do | |
154 { | |
155 v9 = 0; | |
156 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
157 do | |
158 { | |
159 if ( v9 ) | |
160 { | |
161 switch ( v9 ) | |
162 { | |
163 case 1: | |
164 v0 = pParty->pPlayers[v1].uIntelligence; | |
165 break; | |
166 case 2: | |
167 v0 = pParty->pPlayers[v1].uWillpower; | |
168 break; | |
169 case 3: | |
170 v0 = pParty->pPlayers[v1].uEndurance; | |
171 break; | |
172 case 4: | |
173 v0 = pParty->pPlayers[v1].uAccuracy; | |
174 break; | |
175 case 5: | |
176 v0 = pParty->pPlayers[v1].uSpeed; | |
177 break; | |
178 case 6: | |
179 v0 = pParty->pPlayers[v1].uLuck; | |
180 break; | |
181 } | |
182 } | |
183 else | |
184 { | |
185 v0 = pParty->pPlayers[v1].uMight; | |
186 } | |
187 v3 = v2 + v9; | |
290 | 188 v4 = StatTable[0][v3].uBaseValue; |
0 | 189 if ( v0 >= v4 ) |
190 { | |
290 | 191 v5 = StatTable[0][v3].uDroppedStep; |
192 v6 = StatTable[0][v3].uBaseStep; | |
0 | 193 } |
194 else | |
195 { | |
290 | 196 v5 = StatTable[0][v3].uBaseStep; |
197 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 198 } |
199 v8 += v5 * (v4 - v0) / v6; | |
200 ++v9; | |
201 } | |
202 while ( v9 <= 6 ); | |
203 ++v1; | |
204 } | |
205 while ( v1 < 4 ); | |
206 return v8; | |
207 } | |
208 | |
209 | |
210 | |
211 //----- (00427730) -------------------------------------------------------- | |
212 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
213 { | |
488 | 214 if (sMana >= uRequiredMana) |
215 { | |
216 sMana -= uRequiredMana; | |
217 return true; | |
218 } | |
219 | |
220 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
221 return false; | |
0 | 222 } |
223 | |
224 | |
225 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 226 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
227 { | |
0 | 228 float v6; // ST04_4@1 |
1014 | 229 signed int item_value; // eax@1 |
230 signed int sell_price; // ebx@1 | |
231 | |
232 item_value =pOwnItems[item_index].GetValue(); | |
233 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
234 sell_price = GetPriceSell(item_value, v6); | |
235 if ( pOwnItems[item_index].Broken() ) | |
236 sell_price = 1; | |
237 if ( sell_price < 1 ) | |
238 sell_price = 1; | |
239 RemoveItemAtInventoryIndex(inventory_idnx); | |
240 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 241 } |
242 | |
243 | |
244 | |
245 //----- (0043EEF3) -------------------------------------------------------- | |
246 bool Player::_43EEF3() | |
247 { | |
1014 | 248 signed int item_idx; // esi@1 |
249 signed int item_id; // esi@1 | |
250 for (int i=0; i<16;++i) | |
251 { | |
252 item_idx=pEquipment.pIndices[i]; | |
253 if (item_idx) | |
254 { | |
255 item_id=pOwnItems[item_idx-1].uItemID; | |
256 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
257 return false; | |
258 } | |
259 } | |
260 return true; | |
261 } | |
262 | |
0 | 263 |
264 | |
265 | |
266 //----- (004B8040) -------------------------------------------------------- | |
1036 | 267 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
268 { | |
269 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 270 } |
271 | |
272 //----- (004B807C) -------------------------------------------------------- | |
273 int Player::_4B807C(float a2) | |
274 { | |
275 Player *v2; // edi@1 | |
276 unsigned int v3; // eax@1 | |
277 int v4; // esi@1 | |
278 unsigned int v5; // ebx@7 | |
279 int v6; // eax@8 | |
280 signed __int64 v7; // qax@13 | |
281 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
282 signed int v10; // [sp+8h] [bp-8h]@4 | |
283 int v11; // [sp+Ch] [bp-4h]@6 | |
284 | |
285 v2 = this; | |
286 v3 = GetMajorConditionIdx(); | |
287 v4 = 0; | |
288 if ( (signed int)v3 >= 14 ) | |
289 { | |
290 if ( (signed int)v3 <= 15 ) | |
291 { | |
292 v10 = 5; | |
293 v9 = v3; | |
294 goto LABEL_6; | |
295 } | |
296 if ( v3 == 16 ) | |
297 { | |
298 v10 = 10; | |
299 v9 = 16; | |
300 LABEL_6: | |
1036 | 301 v11 = GetConditionDayOfWeek(v9); |
0 | 302 goto LABEL_13; |
303 } | |
304 } | |
305 v10 = 1; | |
306 v5 = 0; | |
307 do | |
308 { | |
1036 | 309 v6 = GetConditionDayOfWeek(v5); |
0 | 310 if ( v6 > v4 ) |
311 v4 = v6; | |
312 ++v5; | |
313 } | |
314 while ( (signed int)v5 <= 13 ); | |
315 v11 = v4; | |
316 if ( !v4 ) | |
317 v11 = 1; | |
318 LABEL_13: | |
319 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
320 if ( (signed int)v7 < 1 ) | |
321 LODWORD(v7) = 1; | |
322 return v7; | |
323 } | |
324 | |
325 //----- (004B8102) -------------------------------------------------------- | |
917 | 326 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 327 { |
328 signed int v3; // esi@1 | |
329 signed int result; // eax@3 | |
330 | |
917 | 331 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
332 if ( v3 > uRealValue ) | |
333 v3 = uRealValue; | |
0 | 334 result = 1; |
335 if ( v3 >= 1 ) | |
336 result = v3; | |
337 return result; | |
338 } | |
339 | |
340 //----- (004B8142) -------------------------------------------------------- | |
749 | 341 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
342 { | |
343 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
344 assert (price > 0); | |
345 | |
346 if (price < uRealValue) | |
347 price = uRealValue; | |
348 return price; | |
0 | 349 } |
350 | |
351 //----- (004B8179) -------------------------------------------------------- | |
916 | 352 int Player::GetPriceIdentification(float a2) |
0 | 353 { |
354 signed int v2; // esi@1 | |
355 int v3; // ecx@1 | |
356 signed int result; // eax@3 | |
357 | |
358 v2 = (signed __int64)(a2 * 50.0); | |
359 v3 = v2 * (100 - GetMerchant()) / 100; | |
360 if ( v3 < v2 / 3 ) | |
361 v3 = v2 / 3; | |
362 result = 1; | |
363 if ( v3 >= 1 ) | |
364 result = v3; | |
365 return result; | |
366 } | |
367 | |
368 //----- (004B81C3) -------------------------------------------------------- | |
916 | 369 int Player::GetPriceRepair(int a2, float a3) |
0 | 370 { |
371 signed int v3; // esi@1 | |
372 int v4; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
376 v4 = v3 * (100 - GetMerchant()) / 100; | |
377 if ( v4 < v3 / 3 ) | |
378 v4 = v3 / 3; | |
379 result = 1; | |
380 if ( v4 >= 1 ) | |
381 result = v4; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B8213) -------------------------------------------------------- | |
386 int Player::_4B8213(int a2, float a3) | |
387 { | |
388 signed __int64 v3; // qax@1 | |
389 | |
390 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
391 if ( (signed int)v3 < 1 ) | |
392 LODWORD(v3) = 1; | |
393 return v3; | |
394 } | |
395 | |
396 //----- (004B8233) -------------------------------------------------------- | |
397 int Player::_4B8233(int a2, float a3) | |
398 { | |
399 signed __int64 v3; // qax@1 | |
400 | |
401 v3 = (signed __int64)((double)a2 * a3); | |
402 if ( (signed int)v3 < 1 ) | |
403 LODWORD(v3) = 1; | |
404 return v3; | |
405 } | |
406 | |
407 //----- (004B824B) -------------------------------------------------------- | |
408 int Player::_4B824B(float a2) | |
409 { | |
410 signed __int64 v2; // qax@1 | |
411 | |
412 v2 = (signed __int64)(a2 * 50.0); | |
413 if ( (signed int)v2 < 1 ) | |
414 LODWORD(v2) = 1; | |
415 return v2; | |
416 } | |
417 | |
418 //----- (004B8265) -------------------------------------------------------- | |
419 int Player::_4B8265(int a2, float a3) | |
420 { | |
421 signed __int64 v3; // qax@1 | |
422 | |
423 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
424 if ( (signed int)v3 < 1 ) | |
425 LODWORD(v3) = 1; | |
426 return v3; | |
427 } | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 //----- (004B6FF9) -------------------------------------------------------- | |
434 int Player::_4B6FF9() | |
435 { | |
436 Player *v1; // esi@1 | |
437 signed int v2; // eax@1 | |
438 char v3; // zf@4 | |
439 | |
440 v1 = this; | |
336 | 441 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 442 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 443 { |
444 if ( GetMajorConditionIdx() == 18 ) | |
445 goto LABEL_6; | |
446 v3 = GetMajorConditionIdx() == 17; | |
447 } | |
448 else | |
449 { | |
450 v3 = GetMajorConditionIdx() == 18; | |
451 } | |
452 if ( !v3 ) | |
453 return 1; | |
454 LABEL_6: | |
455 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
456 return 1; | |
457 return 0; | |
458 } | |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
468 item_idx = *pitem_index; | |
469 if ( item_idx >125 || item_idx < 0 ) | |
470 { | |
471 return 0; | |
472 } | |
473 | |
474 inv_index = this->pInventoryIndices[item_idx]; | |
475 if ( inv_index < 0 ) | |
476 { | |
477 *pitem_index = -1 - inv_index; | |
478 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
479 } | |
480 | |
481 return inv_index; | |
0 | 482 } |
483 | |
484 | |
485 | |
486 //----- (004160CA) -------------------------------------------------------- | |
1012 | 487 void Player::ItemsEnchant( int enchant_count ) |
488 { | |
489 int avalible_items; // ebx@1 | |
490 int i; // edx@8 | |
491 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
492 | |
493 avalible_items = 0; | |
494 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
495 | |
496 for (i=0; i<138; ++i) | |
497 { | |
498 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
499 item_index_tabl[avalible_items++] = i; | |
500 } | |
501 | |
502 if ( avalible_items ) | |
503 { | |
504 if ( enchant_count ) | |
505 { | |
506 for ( i = 0; i < enchant_count; ++i ) | |
0 | 507 { |
1012 | 508 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
509 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 510 } |
1012 | 511 |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
517 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
518 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
519 } | |
520 } | |
521 } | |
522 ; | |
0 | 523 } |
524 | |
525 //----- (004948B1) -------------------------------------------------------- | |
187 | 526 void Player::PlaySound(PlayerSpeech speech, int a3) |
527 { | |
528 //Player *pPlayer; // edi@1 | |
529 //int v4; // eax@4 | |
0 | 530 signed int v5; // esi@4 |
203 | 531 unsigned char *v6; // ebx@4 |
0 | 532 signed int v7; // ecx@5 |
533 unsigned __int8 v8; // al@6 | |
534 int v9; // eax@10 | |
187 | 535 //unsigned int pVoiceID; // ecx@10 |
0 | 536 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
537 //signed int v12; // eax@11 |
0 | 538 signed int v13; // esi@12 |
539 int v14; // eax@12 | |
187 | 540 //int v15; // eax@17 |
248 | 541 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 542 signed int v17; // ecx@19 |
543 char *pSoundID; // edi@20 | |
544 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 545 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 546 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
547 int pSoundId; // [sp+30h] [bp+8h]@4 | |
548 | |
187 | 549 //pPlayer = this; |
550 //pPlayer2 = this; | |
551 | |
0 | 552 pPlayerNum = 1; |
187 | 553 for (int i = 0; i < 4; ++i) |
554 if (&pParty->pPlayers[i] == this) | |
555 { | |
556 pPlayerNum = i + 1; | |
0 | 557 break; |
187 | 558 } |
559 | |
560 //v4 = a2;//102 | |
0 | 561 v5 = 0; |
562 pSoundId = 0; | |
203 | 563 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
564 if (uVoicesVolumeMultiplier) | |
0 | 565 { |
566 v7 = 0; | |
567 do | |
568 { | |
569 v8 = v6[v7]; | |
570 if ( v8 ) | |
571 v20[v5++] = v8; | |
572 ++v7; | |
573 } | |
574 while ( v7 < 2 ); | |
575 if ( v5 ) | |
576 { | |
577 v9 = rand(); | |
187 | 578 //pVoiceID = uVoiceID; |
0 | 579 v11 = v20[v9 % v5]; |
203 | 580 |
581 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
582 { | |
583 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
584 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 585 } |
586 } | |
587 } | |
203 | 588 |
0 | 589 v13 = 0; |
590 v14 = (int)(v6 + 3); | |
591 do | |
592 { | |
593 if ( *(char *)v14 ) | |
594 v20[v13++] = *(char *)v14; | |
595 ++v14; | |
596 } | |
597 while ( -3 - (signed int)v6 + v14 < 5 ); | |
598 if ( v13 ) | |
599 { | |
600 pPlayerNum = 0; | |
248 | 601 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
602 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 603 { |
604 v17 = 0; | |
764 | 605 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 606 { |
607 LABEL_23: | |
608 v17 = 0; | |
609 } | |
610 else | |
611 { | |
612 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
613 while ( *(int *)pSoundID != pSoundId ) | |
614 { | |
615 ++v17; | |
616 pSoundID += 120; | |
764 | 617 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 618 goto LABEL_23; |
619 } | |
620 } | |
621 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
622 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
623 } | |
248 | 624 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 625 } |
626 //return v14; | |
0 | 627 } |
628 // 4948B1: using guessed type int var_1C[5]; | |
629 | |
630 //----- (00494A25) -------------------------------------------------------- | |
187 | 631 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
632 { | |
633 //signed int v3; // eax@1 | |
634 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 635 signed int v5; // edi@15 |
636 PlayerFrame *v6; // esi@17 | |
637 signed int v7; // eax@20 | |
638 | |
187 | 639 //LOWORD(v3) = this->expression; |
640 //v4 = expr; | |
641 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
642 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
643 { | |
644 int v3 = (unsigned)expression; | |
0 | 645 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
646 { | |
647 if ( v3 <= 7 ) | |
648 goto LABEL_12; | |
649 if ( v3 > 8 ) | |
650 { | |
651 if ( v3 > 11 ) | |
652 { | |
1014 | 653 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 654 return; |
0 | 655 goto LABEL_15; |
656 } | |
657 LABEL_12: | |
187 | 658 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
659 return; | |
0 | 660 goto LABEL_15; |
661 } | |
662 } | |
663 } | |
664 LABEL_15: | |
187 | 665 //LOWORD(v3) = a3; |
0 | 666 v5 = 0; |
667 this->uExpressionTimeLength = a3; | |
668 this->uExpressionTimePassed = 0; | |
669 if ( !a3 ) | |
670 { | |
671 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
672 { | |
673 LABEL_20: | |
674 v7 = 0; | |
675 } | |
676 else | |
677 { | |
678 v6 = pPlayerFrameTable->pFrames; | |
187 | 679 while ( v6->expression != new_expression ) |
0 | 680 { |
681 ++v5; | |
682 ++v6; | |
683 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
684 goto LABEL_20; | |
685 } | |
686 v7 = v5; | |
687 } | |
187 | 688 //v4 = expr; |
689 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
690 } | |
691 expression = new_expression; | |
0 | 692 viewparams->bRedrawGameUI = 1; |
693 } | |
694 | |
695 //----- (0049327B) -------------------------------------------------------- | |
696 int Player::_49327B(unsigned int uClass, int a3) | |
697 { | |
698 Player *v3; // esi@1 | |
699 char v4; // zf@4 | |
700 __int16 v5; // dx@9 | |
701 signed int result; // eax@84 | |
702 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
703 int v8; // [sp-4h] [bp-Ch]@3 | |
704 | |
705 v3 = this; | |
135 | 706 if ( this->classType == uClass ) |
0 | 707 { |
708 LABEL_84: | |
709 result = 1; | |
710 } | |
711 else | |
712 { | |
713 switch ( uClass ) | |
714 { | |
715 case 0u: | |
716 v8 = a3; | |
717 v7 = 1; | |
718 goto LABEL_4; | |
719 case 1u: | |
484 | 720 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 721 || _49327B(2u, a3) ) |
722 goto LABEL_84; | |
723 v8 = a3; | |
724 v7 = 3; | |
725 goto LABEL_4; | |
726 case 2u: | |
727 v5 = 19; | |
728 goto LABEL_82; | |
729 case 3u: | |
730 v5 = 21; | |
731 goto LABEL_82; | |
732 case 4u: | |
733 v8 = a3; | |
734 v7 = 5; | |
735 goto LABEL_4; | |
736 case 5u: | |
484 | 737 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 738 || _49327B(6u, a3) ) |
739 goto LABEL_84; | |
740 v8 = a3; | |
741 v7 = 7; | |
742 goto LABEL_4; | |
743 case 6u: | |
744 if ( !a3 ) | |
745 break; | |
746 v5 = 13; | |
747 goto LABEL_82; | |
748 case 7u: | |
749 if ( !a3 ) | |
750 break; | |
751 v5 = 15; | |
752 goto LABEL_82; | |
753 case 8u: | |
754 v8 = a3; | |
755 v7 = 9; | |
756 goto LABEL_4; | |
757 case 9u: | |
484 | 758 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 759 || _49327B(0xAu, a3) ) |
760 goto LABEL_84; | |
761 v8 = a3; | |
762 v7 = 11; | |
763 goto LABEL_4; | |
764 case 0xAu: | |
765 if ( !a3 ) | |
766 break; | |
767 v5 = 25; | |
768 goto LABEL_82; | |
769 case 0xBu: | |
770 if ( !a3 ) | |
771 break; | |
772 v5 = 27; | |
773 goto LABEL_82; | |
774 case 0xCu: | |
775 v8 = a3; | |
776 v7 = 13; | |
777 goto LABEL_4; | |
778 case 0xDu: | |
484 | 779 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 780 || _49327B(0xEu, a3) ) |
781 goto LABEL_84; | |
782 v8 = a3; | |
783 v7 = 15; | |
784 goto LABEL_4; | |
785 case 0xEu: | |
786 if ( !a3 ) | |
787 break; | |
788 v5 = 43; | |
789 goto LABEL_82; | |
790 case 0xFu: | |
791 if ( !a3 ) | |
792 break; | |
793 v5 = 45; | |
794 goto LABEL_82; | |
795 case 0x10u: | |
796 v8 = a3; | |
797 v7 = 17; | |
798 goto LABEL_4; | |
799 case 0x11u: | |
484 | 800 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 801 || _49327B(0x12u, a3) ) |
802 goto LABEL_84; | |
803 v8 = a3; | |
804 v7 = 19; | |
805 goto LABEL_4; | |
806 case 0x12u: | |
807 if ( !a3 ) | |
808 break; | |
809 v5 = 37; | |
810 goto LABEL_82; | |
811 case 0x13u: | |
812 v5 = 39; | |
813 goto LABEL_82; | |
814 case 0x14u: | |
815 v8 = a3; | |
816 v7 = 21; | |
817 goto LABEL_4; | |
818 case 0x15u: | |
484 | 819 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 820 || _49327B(0x16u, a3) ) |
821 goto LABEL_84; | |
822 v8 = a3; | |
823 v7 = 23; | |
824 goto LABEL_4; | |
825 case 0x16u: | |
826 if ( !a3 ) | |
827 break; | |
828 v5 = 31; | |
829 goto LABEL_82; | |
830 case 0x17u: | |
831 if ( !a3 ) | |
832 break; | |
833 v5 = 33; | |
834 goto LABEL_82; | |
835 case 0x18u: | |
836 if ( !_49327B(0x19u, a3) ) | |
837 goto LABEL_56; | |
838 break; | |
839 case 0x19u: | |
840 LABEL_56: | |
484 | 841 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 842 || _49327B(0x1Au, a3) ) |
843 goto LABEL_84; | |
844 v8 = a3; | |
845 v7 = 27; | |
846 goto LABEL_4; | |
847 case 0x1Au: | |
848 if ( !a3 ) | |
849 break; | |
850 v5 = 65; | |
851 goto LABEL_82; | |
852 case 0x1Bu: | |
853 if ( !a3 ) | |
854 break; | |
855 v5 = 67; | |
856 goto LABEL_82; | |
857 case 0x1Cu: | |
858 v8 = a3; | |
859 v7 = 29; | |
860 goto LABEL_4; | |
861 case 0x1Du: | |
484 | 862 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 863 || _49327B(0x1Eu, a3) ) |
864 goto LABEL_84; | |
865 v8 = a3; | |
866 v7 = 31; | |
867 goto LABEL_4; | |
868 case 0x1Eu: | |
869 if ( !a3 ) | |
870 break; | |
871 v5 = 71; | |
872 goto LABEL_82; | |
873 case 0x1Fu: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 73; | |
877 goto LABEL_82; | |
878 case 0x20u: | |
879 v8 = a3; | |
880 v7 = 33; | |
881 goto LABEL_4; | |
882 case 0x21u: | |
484 | 883 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 884 || _49327B(0x22u, a3) ) |
885 goto LABEL_84; | |
886 v8 = a3; | |
887 v7 = 35; | |
888 LABEL_4: | |
889 v4 = _49327B(v7, v8) == 0; | |
890 goto LABEL_83; | |
891 case 0x22u: | |
892 if ( !a3 ) | |
893 break; | |
894 v5 = 77; | |
895 goto LABEL_82; | |
896 case 0x23u: | |
897 if ( a3 ) | |
898 { | |
899 v5 = 79; | |
900 LABEL_82: | |
484 | 901 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 902 LABEL_83: |
903 if ( !v4 ) | |
904 goto LABEL_84; | |
905 } | |
906 break; | |
907 default: | |
908 break; | |
909 } | |
910 result = 0; | |
911 } | |
912 return result; | |
913 } | |
914 | |
915 | |
916 //----- (00492C0B) -------------------------------------------------------- | |
917 bool Player::CanAct() | |
918 { | |
919 bool result; // eax@2 | |
920 | |
921 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
922 result = 0; | |
923 else | |
924 result = 1; | |
925 return result; | |
926 } | |
927 | |
928 //----- (00492C40) -------------------------------------------------------- | |
929 bool Player::CanSteal() | |
930 { | |
931 int v1; // eax@1 | |
932 | |
933 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
934 return v1 != 0; | |
935 } | |
936 | |
937 //----- (00492C4E) -------------------------------------------------------- | |
938 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
939 { | |
940 char v2; // zf@9 | |
941 __int16 v4; // dx@13 | |
942 char v5; // zf@15 | |
943 | |
944 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
945 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
946 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
947 { | |
948 if ( uItemID == 533 ) | |
949 { | |
950 v2 = GetRace() == 1; | |
951 } | |
952 else | |
953 { | |
954 if ( uItemID != 534 ) | |
955 { | |
956 if ( uItemID == 535 ) // | |
957 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
958 { | |
959 switch ( this->uVoiceID ) | |
960 { | |
961 default: | |
962 return 1; | |
963 case 4u: | |
964 case 5u: | |
965 case 6u: | |
966 case 7u: | |
967 case 0xAu: | |
968 case 0xBu: | |
969 case 0xEu: // | |
970 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
971 case 0xFu: | |
972 case 0x12u: | |
973 case 0x13u: | |
974 case 0x15u: | |
975 case 0x18u: | |
976 return 0; | |
977 } | |
978 return 0; | |
979 } | |
980 if ( uItemID == 536 ) // | |
981 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
982 { | |
983 switch ( this->uVoiceID ) | |
984 { | |
985 case 4u: | |
986 case 5u: | |
987 case 6u: | |
988 case 7u: | |
989 case 0xAu: | |
990 case 0xBu: | |
991 case 0xEu: | |
992 case 0xFu: | |
993 case 0x12u: | |
994 case 0x13u: | |
995 case 0x15u: | |
996 case 0x18u: | |
997 return 1; | |
998 default: | |
999 return 0; | |
1000 } | |
1001 return 0; | |
1002 } | |
1003 if ( uItemID != 604 ) // | |
1004 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1005 return 1; | |
1006 v5 = _43EEF3() == 0; | |
1007 goto LABEL_23; | |
1008 } | |
1009 v2 = GetRace() == 3; // | |
1010 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1011 } | |
1012 } | |
1013 else | |
1014 { | |
1015 if ( uItemID != 532 ) | |
1016 { | |
1017 if ( uItemID != 515 && uItemID != 517 ) // | |
1018 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1019 { | |
1020 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1021 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1022 { | |
1023 LABEL_13: | |
1024 v4 = 99; | |
1025 LABEL_15: | |
484 | 1026 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1027 LABEL_23: |
1028 if ( !v5 ) | |
1029 return 1; | |
1030 return 0; | |
1031 } | |
1032 if ( uItemID != 525 ) | |
1033 { | |
1034 if ( uItemID != 527 ) | |
1035 { | |
1036 if ( uItemID != 531 ) | |
1037 return 1; | |
1038 v2 = GetRace() == 2; | |
1039 goto LABEL_10; | |
1040 } | |
1041 goto LABEL_13; | |
1042 } | |
1043 } | |
1044 v4 = 100; | |
1045 goto LABEL_15; | |
1046 } | |
1047 v2 = GetRace() == 0; | |
1048 } | |
1049 LABEL_10: | |
1050 if ( v2 ) | |
1051 return 1; | |
1052 return 0; | |
1053 } | |
1054 | |
1055 //----- (00492D65) -------------------------------------------------------- | |
1056 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1057 { |
1058 | |
1059 signed int player_sex; // ecx@77 | |
1060 char zombi_face; // al@80 | |
1061 signed int remainig_player; // ebx@82 | |
1062 int players_before; // [sp+10h] [bp-4h]@2 | |
1063 int players_after; // [sp+20h] [bp+Ch]@82 | |
1064 | |
1065 if ( pConditions[uConditionIdx] ) | |
1066 return 0; | |
1067 players_before = 0; | |
1068 for (int i=1;i<5;++i) | |
1069 if ( pPlayers[i]->CanAct() ) | |
1070 ++players_before; | |
1071 | |
0 | 1072 switch ( uConditionIdx ) |
1014 | 1073 { |
1074 case Condition_Cursed: | |
1075 PlaySound((PlayerSpeech)30, 0); | |
1076 break; | |
1077 case Condition_Weak: | |
0 | 1078 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) |
1014 | 1079 {--pParty->pPartyBuffs[13].uPower; |
1080 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1081 pParty->pPartyBuffs[13].Reset(); | |
1082 return 0; | |
1083 } | |
1084 | |
1085 PlaySound((PlayerSpeech)25, 0); | |
1086 break; | |
1087 case Condition_Sleep: | |
1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) | |
1089 return 0; | |
1090 break; | |
1091 | |
1092 case Condition_Fear: | |
1093 PlaySound((PlayerSpeech)26, 0); | |
1094 break; | |
1095 case Condition_Drunk: | |
1096 PlaySound((PlayerSpeech)31, 0); | |
1097 break; | |
1098 | |
1099 case Condition_Insane: | |
0 | 1100 if ( a3 == 1 |
1014 | 1101 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) |
1102 return 0; | |
1103 | |
1104 PlaySound((PlayerSpeech)29, 0); | |
1105 break; | |
1106 case Condition_Poison1: | |
1107 case Condition_Poison2: | |
1108 case Condition_Poison3: | |
1109 if ( a3 == 1 ) | |
1110 { | |
1111 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1112 { | |
1113 --pParty->pPartyBuffs[13].uPower; | |
1114 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1115 pParty->pPartyBuffs[13].Reset(); | |
1116 } | |
1117 if ( HasEnchantedItemEquipped(21) | |
1118 || WearsItem(505, 3) | |
1119 || WearsItem(530, 6) ) | |
1120 //goto LABEL_76; | |
1121 return 0; | |
1122 } | |
1123 | |
1124 //v23 = 27; | |
1125 PlaySound((PlayerSpeech)27, 0); | |
1126 break; | |
1127 | |
1128 case Condition_Disease1: | |
1129 case Condition_Disease2: | |
1130 case Condition_Disease3: | |
0 | 1131 if ( a3 == 1 ) |
1014 | 1132 { |
1133 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1134 { | |
1135 --pParty->pPartyBuffs[13].uPower; | |
1136 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1137 pParty->pPartyBuffs[13].Reset(); | |
1138 return 0; | |
1139 } | |
1140 | |
1141 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) | |
1142 return 0; | |
1143 } | |
1144 PlaySound((PlayerSpeech)28, 0); | |
1145 break; | |
1146 case Condition_Paralyzed: | |
1147 if ( a3 == 1 ) | |
1148 { | |
1149 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 ) | |
1150 { | |
1151 --pParty->pPartyBuffs[13].uPower; | |
1152 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1153 pParty->pPartyBuffs[13].Reset(); | |
1154 return 0; | |
1155 } | |
1156 | |
1157 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) | |
1158 return 0; | |
1159 } | |
1160 break; | |
1161 case Condition_Unconcious: | |
1162 PlaySound(SPEECH_32, 0); | |
1163 if ( sHealth > 0 ) | |
1164 sHealth = 0; | |
1165 break; | |
1166 case Condition_Dead: | |
1167 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1168 { | |
0 | 1169 --pParty->pPartyBuffs[13].uPower; |
1170 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1014 | 1171 pParty->pPartyBuffs[13].Reset(); |
1172 } | |
1173 | |
1174 PlaySound((PlayerSpeech)33, 0); | |
1175 if ( sHealth > 0 ) | |
1176 sHealth = 0; | |
1177 if ( sMana > 0 ) | |
1178 sMana = 0; | |
1179 break; | |
1180 case Condition_Pertified: | |
0 | 1181 if ( a3 == 1 |
1014 | 1182 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) |
1183 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) | |
1184 | |
1185 return 0; | |
1186 PlaySound((PlayerSpeech)34, 0); | |
1187 break; | |
1188 case Condition_Eradicated: | |
1189 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u )) | |
1190 { | |
1191 --pParty->pPartyBuffs[13].uPower; | |
1192 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1193 pParty->pPartyBuffs[13].Reset(); | |
1194 return 0; | |
1195 } | |
1196 PlaySound(SPEECH_35, 0); | |
1197 if (sHealth > 0 ) | |
1198 sHealth = 0; | |
1199 if ( sMana > 0 ) | |
1200 sMana = 0; | |
1201 break; | |
1202 case Condition_Zombie: | |
1203 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1204 return 0; | |
1205 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1206 sHealth = GetMaxHealth(); | |
1207 sMana = 0; | |
1208 player_sex = 0; | |
1209 uPrevFace = uCurrentFace; | |
1210 uPrevVoiceID = uVoiceID; | |
1211 switch ( uVoiceID ) | |
1212 { | |
1213 case 0: | |
1214 case 1: | |
1215 case 2: | |
1216 case 3: | |
1217 case 8: | |
1218 case 9: | |
1219 case 12: | |
1220 case 13: | |
1221 case 16: | |
1222 case 17: | |
1223 case 20: | |
1224 case 23: | |
1225 player_sex = 0; | |
1226 break; | |
1227 case 4: | |
1228 case 5: | |
1229 case 6: | |
1230 case 7: | |
1231 case 10: | |
1232 case 11: | |
1233 case 14: | |
1234 case 15: | |
1235 case 18: | |
1236 case 19: | |
1237 case 21: | |
1238 case 24: | |
1239 player_sex = 1; | |
1240 break; | |
1241 default: | |
1242 break; | |
1243 } | |
1244 | |
1245 zombi_face = (player_sex != 0) + 23; | |
1246 uCurrentFace = zombi_face; | |
1247 uVoiceID = zombi_face; | |
1248 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1249 break; | |
0 | 1250 } |
1014 | 1251 |
1252 remainig_player = 0; | |
1253 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1254 players_after = 0; | |
1255 for (int i=1;i<5;++i) | |
0 | 1256 { |
1014 | 1257 |
1258 | |
1259 if ( pPlayers[i]->CanAct() ) | |
1260 { | |
1261 remainig_player=i; | |
1262 ++players_after; | |
1263 } | |
0 | 1264 } |
1014 | 1265 if (( players_before == 2 )&&( players_after == 1 )) |
1266 { | |
1267 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1268 } | |
1269 return 1; | |
1270 } | |
0 | 1271 |
1272 //----- (00492528) -------------------------------------------------------- | |
1273 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1274 { | |
973 | 1275 //unsigned int v3; // eax@1 |
0 | 1276 Texture *v4; // esi@1 |
1277 unsigned int v5; // ebx@1 | |
1278 signed int v6; // edi@5 | |
1279 int *v7; // ecx@6 | |
1280 signed int v8; // edx@7 | |
1281 int *v9; // eax@8 | |
973 | 1282 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1283 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1284 | |
973 | 1285 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1286 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1287 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1288 if ( !areWeLoadingTexture ) | |
1289 { | |
1290 v4->Release(); | |
1006 | 1291 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1292 } |
1293 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1294 { | |
1295 v6 = 0; | |
1296 if ( (signed int)uItemIDa <= 0 ) | |
1297 return 1; | |
973 | 1298 v7 = &pInventoryIndices[uSlot]; |
0 | 1299 while ( 1 ) |
1300 { | |
1301 v8 = 0; | |
1302 if ( (signed int)v5 > 0 ) | |
1303 break; | |
1304 LABEL_11: | |
1305 ++v6; | |
1306 v7 += 14; | |
1307 if ( v6 >= (signed int)uItemIDa ) | |
1308 return 1; | |
1309 } | |
1310 v9 = v7; | |
1311 while ( !*v9 ) | |
1312 { | |
1313 ++v8; | |
1314 ++v9; | |
1315 if ( v8 >= (signed int)v5 ) | |
1316 goto LABEL_11; | |
1317 } | |
1318 } | |
1319 return 0; | |
1320 } | |
1321 // 506128: using guessed type int areWeLoadingTexture; | |
1322 | |
1323 //----- (004925E6) -------------------------------------------------------- | |
1324 unsigned int Player::FindFreeInventorySlot() | |
1325 { | |
1326 unsigned int result; // eax@1 | |
1327 ItemGen *v2; // ecx@1 | |
1328 | |
1329 result = 0; | |
1330 v2 = this->pInventoryItems; | |
1331 while ( v2->uItemID ) | |
1332 { | |
1333 ++result; | |
1334 ++v2; | |
1335 if ( (signed int)result >= 126 ) | |
1336 return -1; | |
1337 } | |
1338 return result; | |
1339 } | |
1340 | |
1341 //----- (00492600) -------------------------------------------------------- | |
1342 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1343 { | |
1344 signed int v3; // edx@1 | |
1345 ItemGen *v4; // eax@1 | |
1346 int result; // eax@8 | |
1347 unsigned int v6; // ebx@10 | |
973 | 1348 //unsigned int v7; // eax@10 |
0 | 1349 Texture *v8; // esi@10 |
1350 void *v9; // esi@13 | |
1351 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1352 Player *v11; // [sp+4h] [bp-8h]@1 | |
1353 signed int v12; // [sp+8h] [bp-4h]@4 | |
1354 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1355 | |
1356 v11 = this; | |
1357 v3 = 0; | |
1358 v4 = this->pInventoryItems; | |
1359 while ( v4->uItemID ) | |
1360 { | |
1361 ++v3; | |
1362 ++v4; | |
1363 if ( v3 >= 126 ) | |
1364 { | |
1365 v12 = -1; | |
1366 goto LABEL_5; | |
1367 } | |
1368 } | |
1369 v12 = v3; | |
1370 LABEL_5: | |
1371 if ( v12 == -1 ) | |
1372 { | |
1373 if ( uActiveCharacter ) | |
201 | 1374 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1375 result = 0; |
1376 } | |
1377 else | |
1378 { | |
1379 v6 = uItemID; | |
973 | 1380 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1381 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1382 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1383 if ( !areWeLoadingTexture ) | |
1384 { | |
1385 v8->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1388 if ( (signed int)uItemIDa > 0 ) | |
1389 { | |
1390 v9 = &v11->pInventoryIndices[uSlot]; | |
1391 do | |
1392 { | |
1393 if ( (signed int)v10 > 0 ) | |
1394 memset32(v9, -1 - uSlot, v10); | |
1395 v9 = (char *)v9 + 56; | |
1396 --uItemIDa; | |
1397 } | |
1398 while ( uItemIDa ); | |
1399 } | |
1400 result = v12 + 1; | |
1401 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1402 v11->pInventoryItems[v12].uItemID = v6; | |
1403 } | |
1404 return result; | |
1405 } | |
1406 // 506128: using guessed type int areWeLoadingTexture; | |
1407 | |
1408 //----- (00492700) -------------------------------------------------------- | |
1409 int Player::HasSkill(unsigned int uSkillType) | |
1410 { | |
1411 signed int result; // eax@3 | |
1412 | |
1413 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1414 { | |
1415 result = 1; | |
1416 } | |
1417 else | |
1418 { | |
809 | 1419 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1420 ShowStatusBarString(pTmpBuf, 2u); |
1421 result = 0; | |
1422 } | |
1423 return result; | |
1424 } | |
1425 | |
1426 //----- (00492745) -------------------------------------------------------- | |
1427 int Player::WearItem(unsigned int uItemID) | |
1428 { | |
1010 | 1429 int item_body_anch; // edi@6 |
1430 int item_indx; | |
1431 //find empty slot | |
1432 for(item_indx=0;item_indx<126;++item_indx) | |
1433 if (pInventoryItems[item_indx].uItemID==0) | |
1434 break; | |
1435 if (item_indx==126) //not found | |
1436 item_indx=-1; | |
1437 | |
1438 if ( item_indx != -1 ) | |
1439 { | |
1440 | |
1441 pInventoryItems[item_indx].uItemID=uItemID; | |
1442 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1443 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1444 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1445 | |
0 | 1446 } |
1447 return 0; | |
1448 } | |
1449 | |
1450 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1451 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1452 { |
1453 signed int v3; // ebx@2 | |
1454 signed int v4; // edi@3 | |
1455 unsigned int v5; // esi@3 | |
1456 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1457 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1458 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1459 | |
1460 thisa = this; | |
1461 if ( uSlot == -1 ) | |
1462 { | |
1463 v3 = 0; | |
1014 | 1464 while ( true ) |
0 | 1465 { |
1466 v4 = 0; | |
1467 v5 = v3; | |
1468 do | |
1469 { | |
1470 if ( CanFitItem(v5, uItemID) ) | |
1471 { | |
1472 v8 = uItemID; | |
1473 v7 = v5; | |
1474 return CreateItemInInventory(v7, v8); | |
1475 } | |
1476 ++v4; | |
1477 v5 += 14; | |
1478 } | |
1479 while ( v4 < 9 ); | |
1480 ++v3; | |
1481 if ( v3 < 14 ) | |
1482 continue; | |
1483 break; | |
1484 } | |
1485 return 0; | |
1486 } | |
1487 if ( !CanFitItem(uSlot, uItemID) ) | |
1488 { | |
1489 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1490 return 0; | |
1491 } | |
1492 v8 = uItemID; | |
1493 v7 = uSlot; | |
1494 return CreateItemInInventory(v7, v8); | |
1495 } | |
1496 | |
1497 //----- (00492826) -------------------------------------------------------- | |
1014 | 1498 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1499 { |
1500 unsigned int v3; // ebx@1 | |
1501 unsigned int v4; // esi@3 | |
1502 signed int v5; // edi@3 | |
1503 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1504 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1505 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1506 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1507 | |
1508 thisa = this; | |
1509 v3 = Src->uItemID; | |
1510 pItemsTable->SetSpecialBonus(Src); | |
1511 if ( uSlot == -1 ) | |
1512 { | |
1513 uSlota = 0; | |
1014 | 1514 while ( true ) |
0 | 1515 { |
1516 v4 = uSlota; | |
1517 v5 = 0; | |
1518 do | |
1519 { | |
1520 if ( CanFitItem(v4, v3) ) | |
1521 { | |
1522 v8 = Src; | |
1523 v7 = v4; | |
1524 return CreateItemInInventory2(v7, v8); | |
1525 } | |
1526 ++v5; | |
1527 v4 += 14; | |
1528 } | |
1529 while ( v5 < 14 ); | |
1530 ++uSlota; | |
1531 if ( uSlota < 9 ) | |
1532 continue; | |
1533 break; | |
1534 } | |
1535 return 0; | |
1536 } | |
1537 if ( !CanFitItem(uSlot, v3) ) | |
1538 return 0; | |
1539 v8 = Src; | |
1540 v7 = uSlot; | |
1541 return CreateItemInInventory2(v7, v8); | |
1542 } | |
1543 | |
1544 //----- (0049289C) -------------------------------------------------------- | |
1545 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1546 { | |
1547 signed int v3; // ebx@1 | |
1548 ItemGen *v4; // eax@1 | |
1549 int result; // eax@6 | |
973 | 1550 //unsigned int v6; // eax@7 |
1014 | 1551 Texture *item_texture; // esi@7 |
0 | 1552 unsigned int v8; // edx@9 |
1014 | 1553 int *pInvPos; // esi@10 |
1554 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1555 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1556 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1557 |
0 | 1558 |
1559 v12 = this; | |
1560 v3 = 0; | |
1561 v4 = this->pInventoryItems; | |
1562 while ( v4->uItemID ) | |
1563 { | |
1564 ++v3; | |
1565 ++v4; | |
1566 if ( v3 >= 126 ) | |
1567 { | |
1568 v3 = -1; | |
1569 break; | |
1570 } | |
1571 } | |
1572 if ( v3 == -1 ) | |
1573 { | |
1574 result = 0; | |
1575 } | |
1576 else | |
1577 { | |
1014 | 1578 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1579 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1580 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1581 if ( !areWeLoadingTexture ) |
1582 { | |
1014 | 1583 item_texture->Release(); |
1006 | 1584 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1585 } |
1014 | 1586 if ( slot_height > 0 ) |
1587 { | |
1588 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1589 do |
1590 { | |
1014 | 1591 if ( slot_width > 0 ) |
1592 memset32(pInvPos, -1 - uSlot, slot_width); | |
1593 pInvPos +=14; | |
1594 --slot_height; | |
1595 } | |
1596 while ( slot_height ); | |
1597 } | |
1598 pInventoryIndices[uSlot] = v3 + 1; | |
1599 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1600 result = v3 + 1; |
1601 } | |
1602 return result; | |
1603 } | |
1604 // 506128: using guessed type int areWeLoadingTexture; | |
1605 | |
1606 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1607 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1608 { | |
973 | 1609 //Player *v4; // ebx@1 |
1610 //unsigned int v5; // eax@1 | |
1014 | 1611 Texture *item_texture; // esi@1 |
1612 int *pInvPos; // esi@4 | |
1613 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1614 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1615 | |
1616 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1617 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1618 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1619 if ( !areWeLoadingTexture ) |
1620 { | |
1014 | 1621 item_texture->Release(); |
1006 | 1622 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1623 } |
1014 | 1624 if ( (signed int)slot_height > 0 ) |
1625 { | |
1626 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1627 do |
1628 { | |
1014 | 1629 if ( (signed int)slot_width > 0 ) |
1630 memset32(pInvPos, -1 - uSlot, slot_width); | |
1631 pInvPos +=14; | |
1632 --slot_height; | |
1633 } | |
1634 while ( slot_height ); | |
1635 } | |
1636 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1637 return 1; |
1638 } | |
278 | 1639 |
0 | 1640 // 506128: using guessed type int areWeLoadingTexture; |
1641 | |
1642 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1643 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1644 { | |
1014 | 1645 |
1646 ItemGen *item_in_slot; // ecx@1 | |
1647 Texture *item_texture; // esi@1 | |
1648 unsigned int slot_height; // ebp@1 | |
1649 int *pInvPos; // edx@4 | |
1650 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1651 | |
1652 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1653 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1654 item_in_slot->Reset(); | |
1655 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1656 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1657 if ( !areWeLoadingTexture ) |
1658 { | |
1014 | 1659 item_texture->Release(); |
1006 | 1660 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1661 } |
1014 | 1662 if ( slot_height > 0 ) |
1663 { | |
1664 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1665 do |
1666 { | |
1014 | 1667 if (slot_width > 0 ) |
1668 memset32(pInvPos, 0, slot_width); | |
1669 pInvPos += 14; | |
1670 --slot_height; | |
1671 } | |
1672 while ( slot_height ); | |
0 | 1673 } |
1006 | 1674 |
0 | 1675 } |
1676 // 506128: using guessed type int areWeLoadingTexture; | |
1677 | |
436 | 1678 //identf |
0 | 1679 //----- (00490EEE) -------------------------------------------------------- |
917 | 1680 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1681 { | |
1682 int pSkillLevel; // eax@1 | |
1683 int NotBuy; // eax@1 | |
1684 int result; | |
1685 signed int pEquipType; // esi@1 | |
1686 float *pPriceMultiplier; // esi@26 | |
1687 int pPriceItemService; // edi@26 | |
1688 | |
1689 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1690 NotBuy = 4; | |
1691 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1692 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1693 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1694 return 5; |
917 | 1695 if ( building_type == BildingType_WeaponShop ) |
1696 { | |
1697 if ( pEquipType > EQUIP_BOW ) | |
1698 return NotBuy; | |
1699 if (pItem->Stolen()) | |
1700 return 6; | |
1701 } | |
1702 if ( building_type == BildingType_ArmorShop ) | |
1703 { | |
1704 if ( pEquipType < 3 && pEquipType > 9 ) | |
1705 return NotBuy; | |
1706 if (pItem->Stolen()) | |
1707 return 6; | |
1708 } | |
1709 if ( building_type == BildingType_MagicShop ) | |
1710 { | |
1711 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1712 { | |
1713 if (pItem->Stolen()) | |
1714 return 6; | |
1715 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1716 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1717 if ( ShopMenuType == 3 )//Sell | |
1718 { | |
1719 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1720 if (!pItem->Broken()) | |
1721 { | |
1722 if ( pSkillLevel ) | |
1723 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1724 else | |
1725 result = 1; | |
1726 return result; | |
1727 } | |
1728 pPriceItemService = 1; | |
1729 if ( pSkillLevel ) | |
1730 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1731 else | |
1732 result = 1; | |
1733 return result; | |
1734 } | |
1735 if ( ShopMenuType == 4 )//Identify | |
1736 { | |
1737 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1738 if ( pSkillLevel ) | |
1739 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1740 else | |
1741 result = 1; | |
1742 return result; | |
1743 } | |
1744 if ( ShopMenuType == 5 )//Repair | |
1745 { | |
1746 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1747 if ( pSkillLevel ) | |
1748 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1749 else | |
1750 result = 1; | |
1751 return result; | |
1752 } | |
1753 if ( ShopMenuType != 6 )//Buy and ??? | |
1754 { | |
1755 if ( pSkillLevel ) | |
1756 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1757 else | |
1758 result = 1; | |
1759 return result; | |
1760 } | |
1761 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1762 if (pItem->Broken()) | |
1763 pPriceItemService = 1; | |
1764 if ( pPriceItemService >= 1 ) | |
1765 { | |
1766 if ( pSkillLevel ) | |
1767 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1768 else | |
1769 result = 1; | |
1770 return result; | |
1771 } | |
1772 pPriceItemService = 1; | |
1773 if ( pSkillLevel ) | |
1774 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1775 else | |
1776 result = 1; | |
0 | 1777 return result; |
917 | 1778 } |
1779 if ( pEquipType != EQUIP_BOOK ) | |
1780 return NotBuy; | |
1781 } | |
1782 if ( building_type == BildingType_AlchemistShop ) | |
1783 { | |
1784 if ( pEquipType < EQUIP_REAGENT ) | |
1785 return NotBuy; | |
1786 if ( pEquipType > EQUIP_POTION ) | |
1787 { | |
1788 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1789 return NotBuy; | |
1790 } | |
1791 if (pItem->Stolen()) | |
1792 return 6; | |
1793 } | |
1794 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1795 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1796 if ( ShopMenuType == 3 )//Sell | |
1797 { | |
1798 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1799 if (!pItem->Broken()) | |
1800 { | |
1801 if ( pSkillLevel ) | |
1802 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1803 else | |
1804 result = 1; | |
0 | 1805 return result; |
917 | 1806 } |
1807 pPriceItemService = 1; | |
1808 if ( pSkillLevel ) | |
1809 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1810 else | |
1811 result = 1; | |
1812 return result; | |
1813 } | |
1814 if ( ShopMenuType == 4 )//Identify | |
1815 { | |
1816 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1817 if ( pSkillLevel ) | |
1818 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1819 else | |
1820 result = 1; | |
1821 return result; | |
1822 } | |
1823 if ( ShopMenuType == 5 )//Repair | |
1824 { | |
1825 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1826 if ( pSkillLevel ) | |
1827 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1828 else | |
1829 result = 1; | |
1830 return result; | |
1831 } | |
1832 if ( ShopMenuType != 6 )//Buy and ??? | |
1833 { | |
1834 if ( pSkillLevel ) | |
1835 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1836 else | |
1837 result = 1; | |
1838 return result; | |
1839 } | |
1840 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1841 if (pItem->Broken()) |
917 | 1842 pPriceItemService = 1; |
1843 if ( pPriceItemService >= 1 ) | |
1844 { | |
1845 if ( pSkillLevel ) | |
1846 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1847 else | |
1848 result = 1; | |
1849 return result; | |
1850 } | |
1851 pPriceItemService = 1; | |
1852 if ( pSkillLevel ) | |
1853 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1854 else |
1855 result = 1; | |
1856 return result; | |
1857 } | |
1858 | |
1859 //----- (0049107D) -------------------------------------------------------- | |
1860 int Player::GetBodybuilding() | |
1861 { | |
1010 | 1862 int v1; // al@1 |
0 | 1863 int v2; // ecx@1 |
1864 int v4; // eax@3 | |
1865 signed int v6; // [sp-4h] [bp-4h]@2 | |
1866 | |
1867 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1868 v2 = v1 & 0x3F; | |
1869 if ( v1 & 0x100 ) | |
1870 { | |
1871 v6 = 5; | |
1872 } | |
1873 else | |
1874 { | |
1008 | 1875 if ( (v1&0xFF) >= 0 ) |
0 | 1876 { |
1877 v4 = ((v1 & 0x40) != 0) + 1; | |
1878 return v2 * v4; | |
1879 } | |
1880 v6 = 3; | |
1881 } | |
1882 v4 = v6; | |
1883 return v2 * v4; | |
1884 } | |
1885 | |
1886 //----- (004910A8) -------------------------------------------------------- | |
607 | 1887 int Player::GetMeditation() |
0 | 1888 { |
1010 | 1889 int v1; // al@1 |
1008 | 1890 int base_level; // ecx@1 |
0 | 1891 int v4; // eax@3 |
1892 signed int v6; // [sp-4h] [bp-4h]@2 | |
1893 | |
1894 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1895 base_level = v1 & 0x3F; |
0 | 1896 if ( v1 & 0x100 ) |
1897 { | |
1898 v6 = 5; | |
1899 } | |
1900 else | |
1901 { | |
1008 | 1902 if ( (v1&0xFF) >= 0 ) |
0 | 1903 { |
1904 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1905 return base_level * v4; |
0 | 1906 } |
1907 v6 = 3; | |
1908 } | |
1909 v4 = v6; | |
1008 | 1910 return base_level * v4; |
0 | 1911 } |
1912 | |
1913 //----- (004910D3) -------------------------------------------------------- | |
1914 int Player::CanIdentify(ItemGen *pItem) | |
1915 { | |
1916 unsigned __int16 v2; // ax@1 | |
1917 unsigned __int16 v3; // bx@1 | |
1918 int uSkillMult; // eax@3 | |
1919 int v5; // edi@7 | |
1920 signed int v6; // ebp@7 | |
1921 char *v7; // esi@7 | |
1922 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1923 |
1924 if (CheckHiredNPCSpeciality(Scholar)) | |
1925 return true; | |
0 | 1926 |
179 | 1927 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1928 v3 = v2; |
179 | 1929 if ( v2 & 1 ) |
0 | 1930 { |
1931 uSkillMultiplier = 5; | |
1932 } | |
1933 else | |
1934 { | |
1935 if ( (v2 & 0x80u) == 0 ) | |
1936 { | |
1937 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1938 v5 = uSkillMult * (v3 & 0x3F); |
1939 v6 = 0; | |
1940 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1941 |
179 | 1942 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1943 v6 = 1; | |
1944 if ( v5 >= (unsigned __int8)v7[46] ) | |
1945 v6 = 1; | |
1946 return v6; | |
0 | 1947 } |
1948 uSkillMultiplier = 3; | |
1949 } | |
1950 uSkillMult = uSkillMultiplier; | |
1951 v5 = uSkillMult * (v3 & 0x3F); | |
1952 v6 = 0; | |
1953 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1954 |
0 | 1955 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1956 v6 = 1; | |
1957 if ( v5 >= (unsigned __int8)v7[46] ) | |
1958 v6 = 1; | |
1959 return v6; | |
1960 } | |
1961 | |
1962 //----- (00491151) -------------------------------------------------------- | |
1963 int Player::CanRepair(ItemGen *a2) | |
1964 { | |
1965 unsigned __int16 v2; // ax@1 | |
1966 unsigned __int16 v3; // bx@1 | |
1967 int v4; // eax@3 | |
1968 int v5; // edi@7 | |
1969 signed int v6; // ebp@7 | |
1970 signed int v10; // [sp-4h] [bp-14h]@2 | |
1971 | |
652 | 1972 |
1973 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1974 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1975 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1976 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1977 return true; | |
1978 | |
1010 | 1979 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1980 v3 = v2; |
1010 | 1981 if (v2 & 0x100 ) |
0 | 1982 { |
1983 v10 = 5; | |
1984 } | |
1985 else | |
1986 { | |
1987 if ( (v2 & 0x80u) == 0 ) | |
1988 { | |
1989 v4 = ((v2 & 0x40) != 0) + 1; | |
1990 goto LABEL_7; | |
1991 } | |
1992 v10 = 3; | |
1993 } | |
1994 v4 = v10; | |
1995 LABEL_7: | |
1996 v5 = v4 * (v3 & 0x3F); | |
1997 v6 = 0; | |
1998 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1999 return true; | |
2000 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2001 { | |
2002 __debugbreak(); // really odd | |
2003 return true; | |
2004 } | |
2005 return false; | |
2006 } | |
2007 | |
2008 //----- (004911F3) -------------------------------------------------------- | |
2009 int Player::GetMerchant() | |
2010 { | |
2011 Player *v1; // edi@1 | |
2012 unsigned __int16 v2; // ax@1 | |
2013 unsigned __int16 v3; // bx@1 | |
2014 int v4; // esi@1 | |
2015 int v5; // edi@1 | |
2016 int v7; // eax@3 | |
2017 int v8; // ecx@7 | |
2018 signed int v9; // [sp-4h] [bp-10h]@6 | |
2019 | |
2020 v1 = this; | |
607 | 2021 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2022 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2023 v4 = v2 & 0x003F; |
1010 | 2024 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2025 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2026 return 10000; | |
2027 v7 = GetPartyReputation(); | |
2028 if ( !v4 ) | |
2029 return -v7; | |
1010 | 2030 if ( v3 & 0x100 ) |
0 | 2031 { |
2032 v9 = 5; | |
2033 } | |
2034 else | |
2035 { | |
2036 if ( (v3 & 0x80u) == 0 ) | |
2037 { | |
2038 v8 = ((v3 & 0x40) != 0) + 1; | |
2039 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2040 } | |
2041 v9 = 3; | |
2042 } | |
2043 v8 = v9; | |
2044 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2045 } | |
2046 | |
2047 //----- (0049125A) -------------------------------------------------------- | |
2048 int Player::GetPerception() | |
2049 { | |
2050 Player *v1; // edi@1 | |
2051 unsigned __int16 v2; // ax@1 | |
2052 unsigned __int16 v3; // bx@1 | |
2053 int v4; // esi@1 | |
2054 int v5; // edi@1 | |
2055 int v7; // eax@5 | |
2056 signed int v8; // [sp-4h] [bp-10h]@4 | |
2057 | |
2058 v1 = this; | |
1010 | 2059 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2060 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2061 v4 = v2 & 0x3F; |
1010 | 2062 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2063 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2064 return 10000; | |
1010 | 2065 if ( v3 & 0x100 ) |
0 | 2066 { |
2067 v8 = 5; | |
2068 } | |
2069 else | |
2070 { | |
2071 if ( (v3 & 0x80u) == 0 ) | |
2072 { | |
2073 v7 = ((v3 & 0x40) != 0) + 1; | |
2074 return v4 + v5 * (v7 - 1); | |
2075 } | |
2076 v8 = 3; | |
2077 } | |
2078 v7 = v8; | |
2079 return v4 + v5 * (v7 - 1); | |
2080 } | |
2081 | |
2082 //----- (004912B0) -------------------------------------------------------- | |
2083 int Player::GetDisarmTrap() | |
2084 { | |
2085 Player *v1; // ebp@1 | |
2086 unsigned __int16 v2; // ax@1 | |
2087 unsigned __int16 v3; // bx@1 | |
2088 int v4; // esi@1 | |
2089 int v5; // edi@1 | |
2090 int v7; // eax@7 | |
2091 signed int v8; // [sp-4h] [bp-14h]@6 | |
2092 | |
2093 v1 = this; | |
1010 | 2094 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2095 v3 = v1->pActiveSkills[29]; |
2096 v4 = v2 & 0x3F; | |
2097 v5 = v1->pActiveSkills[29] & 0x3F; | |
2098 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2099 return 10000; | |
2100 if ( HasEnchantedItemEquipped(35) ) | |
2101 v4 *= 2; | |
1010 | 2102 if ( v3 & 0x100 ) |
0 | 2103 { |
2104 v8 = 5; | |
2105 } | |
2106 else | |
2107 { | |
2108 if ( (v3 & 0x80u) == 0 ) | |
2109 { | |
2110 v7 = ((v3 & 0x40) != 0) + 1; | |
2111 return v4 + v5 * (v7 - 1); | |
2112 } | |
2113 v8 = 3; | |
2114 } | |
2115 v7 = v8; | |
2116 return v4 + v5 * (v7 - 1); | |
2117 } | |
2118 | |
2119 //----- (00491317) -------------------------------------------------------- | |
2120 char Player::GetLearningPercent() | |
2121 { | |
2122 Player *v1; // esi@1 | |
2123 int v2; // eax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // ecx@1 | |
2126 int v5; // eax@4 | |
2127 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2128 | |
2129 v1 = this; | |
1010 | 2130 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2131 v3 = v1->pActiveSkills[36]; |
2132 v4 = v2 & 0x3F; | |
2133 if ( v2 ) | |
2134 { | |
1010 | 2135 if (v3 & 0x100 ) |
0 | 2136 { |
2137 v7 = 5; | |
2138 } | |
2139 else | |
2140 { | |
2141 if ( (v3 & 0x80u) == 0 ) | |
2142 { | |
2143 v5 = ((v3 & 0x40) != 0) + 1; | |
2144 goto LABEL_8; | |
2145 } | |
2146 v7 = 3; | |
2147 } | |
2148 v5 = v7; | |
2149 LABEL_8: | |
2150 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2151 } | |
2152 return v2; | |
2153 } | |
2154 | |
2155 //----- (0048C6AF) -------------------------------------------------------- | |
2156 Player::Player() | |
2157 { | |
2158 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2159 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2160 for (uint i = 0; i < 126; ++i) | |
2161 pInventoryItems[i].Reset(); | |
2162 for (uint i = 0; i < 12; ++i) | |
2163 pEquippedItems[i].Reset(); | |
2164 | |
2165 | |
2166 for (uint i = 0; i < 24; ++i) | |
2167 { | |
2168 pPlayerBuffs[i].uSkill = 0; | |
2169 pPlayerBuffs[i].uSkill = 0; | |
2170 pPlayerBuffs[i].uPower = 0; | |
2171 pPlayerBuffs[i].uExpireTime = 0; | |
2172 pPlayerBuffs[i].uCaster = 0; | |
2173 pPlayerBuffs[i].uFlags = 0; | |
2174 } | |
2175 | |
2176 pName[0] = 0; | |
1014 | 2177 uCurrentFace = 0; |
0 | 2178 uVoiceID = 0; |
2179 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2180 | |
2181 field_BB = 0; | |
2182 | |
2183 uMight = uMightBonus = 0; | |
2184 uIntelligence = uIntelligenceBonus = 0; | |
2185 uWillpower = uWillpowerBonus = 0; | |
2186 uEndurance = uEnduranceBonus = 0; | |
2187 uSpeed = uSpeedBonus = 0; | |
2188 uAccuracy = uAccuracyBonus = 0; | |
2189 uLuck = uLuckBonus = 0; | |
2190 uLevel = sLevelModifier = 0; | |
2191 sAgeModifier = 0; | |
2192 | |
1019 | 2193 // memset(field_1F5, 0, 30); |
2194 pure_luck_used=0; | |
2195 pure_speed_used=0; | |
2196 pure_intellect_used=0; | |
2197 pure_endurance_used=0; | |
2198 pure_willpower_used=0; | |
2199 pure_accuracy_used=0; | |
2200 pure_might_used=0; | |
0 | 2201 |
2202 sResFireBase = sResFireBonus = 0; | |
2203 sResAirBase = sResAirBonus = 0; | |
2204 sResWaterBase = sResWaterBonus = 0; | |
2205 sResEarthBase = sResEarthBonus = 0; | |
2206 sResMagicBase = sResMagicBonus = 0; | |
2207 sResSpiritBase = sResSpiritBonus = 0; | |
2208 sResMindBase = sResMindBonus = 0; | |
2209 sResBodyBase = sResBodyBonus = 0; | |
2210 sResLightBase = sResLightBonus = 0; | |
2211 sResDarkBase = sResDarkBonus = 0; | |
2212 | |
2213 uTimeToRecovery = 0; | |
2214 | |
2215 uSkillPoints = 0; | |
2216 | |
2217 sHealth = 0; | |
2218 uFullHealthBonus = 0; | |
2219 _health_related = 0; | |
2220 | |
2221 sMana = 0; | |
2222 uFullManaBonus = 0; | |
2223 _mana_related = 0; | |
2224 | |
2225 uQuickSpell = 0; | |
2226 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2227 | |
2228 _some_attack_bonus = 0; | |
2229 field_1A91 = 0; | |
2230 _melee_dmg_bonus = 0; | |
2231 field_1A93 = 0; | |
2232 _ranged_atk_bonus = 0; | |
2233 field_1A95 = 0; | |
2234 _ranged_dmg_bonus = 0; | |
2235 field_1A97 = 0; | |
2236 | |
130 | 2237 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2238 uExpressionTimePassed = 0; |
2239 uExpressionTimeLength = 0; | |
2240 | |
2241 uNumDivineInterventionCastsThisDay = 0; | |
2242 uNumArmageddonCasts = 0; | |
2243 uNumFireSpikeCasts = 0; | |
2244 | |
2245 memset(field_1988, 0, 49 * sizeof(int)); | |
2246 memset(field_1A50, 0, 64 * sizeof(char)); | |
2247 | |
2248 field_E0 = 0; | |
2249 field_E4 = 0; | |
2250 field_E8 = 0; | |
2251 field_EC = 0; | |
2252 field_F0 = 0; | |
2253 field_F4 = 0; | |
2254 field_F8 = 0; | |
2255 field_FC = 0; | |
2256 field_100 = 0; | |
2257 field_104 = 0; | |
198 | 2258 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2259 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2260 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2261 |
198 | 2262 lastOpenedSpellbookPage = 0; |
0 | 2263 } |
2264 | |
2265 //----- (0048C6F6) -------------------------------------------------------- | |
2266 bool Party::AddItem(ItemGen *pItem) | |
2267 { | |
2268 unsigned int v2; // eax@1 | |
2269 unsigned int v3; // ecx@4 | |
2270 signed int v4; // edx@4 | |
2271 char *v5; // eax@8 | |
973 | 2272 //unsigned int v6; // eax@10 |
0 | 2273 Texture *v7; // ebx@10 |
2274 signed int v8; // esi@10 | |
2275 Player *v9; // edi@11 | |
2276 int v10; // eax@11 | |
2277 bool result; // eax@15 | |
2278 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2279 |
2280 | |
188 | 2281 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2282 //int v16; // [sp+10h] [bp-18h]@3 | |
2283 //int v17; // [sp+14h] [bp-14h]@3 | |
2284 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2285 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2286 Party *v20; // [sp+20h] [bp-8h]@1 | |
2287 int v21; // [sp+24h] [bp-4h]@10 | |
2288 | |
2289 auto thos = this; | |
2290 | |
2291 v20 = thos; | |
2292 v2 = pItem->uItemID; | |
222 | 2293 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2294 pItem->SetIdentified(); |
188 | 2295 ///v15 = 0; |
2296 //v16 = 1; | |
2297 //v18 = 3; | |
2298 //v17 = 2; | |
0 | 2299 if ( uActiveCharacter ) |
2300 { | |
2301 v3 = uActiveCharacter - 1; | |
2302 v4 = 0; | |
2303 do | |
2304 { | |
188 | 2305 v15[v4++] = v3++; |
0 | 2306 if ( (signed int)v3 >= 4 ) |
2307 v3 = 0; | |
2308 } | |
2309 while ( v4 < 4 ); | |
2310 } | |
2311 v5 = pItemsTable->pItems[v2].pIconName; | |
2312 if ( v5 ) | |
2313 { | |
973 | 2314 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2315 v21 = areWeLoadingTexture; |
2316 v8 = 0; | |
2317 while ( 1 ) | |
2318 { | |
188 | 2319 v9 = &v20->pPlayers[v15[v8]]; |
2320 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2321 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2322 if ( v10 ) |
2323 break; | |
2324 ++v8; | |
2325 if ( v8 >= 4 ) | |
2326 { | |
2327 if ( !v21 ) | |
2328 { | |
2329 v7->Release(); | |
1006 | 2330 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2331 } |
2332 goto LABEL_15; | |
2333 } | |
2334 } | |
232 | 2335 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2336 pItem->Reset(); |
2337 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2338 v19->PlaySound(SPEECH_60, 0); |
0 | 2339 if ( !v21 ) |
2340 { | |
2341 v7->Release(); | |
1006 | 2342 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2343 } |
2344 result = 1; | |
2345 } | |
2346 else | |
2347 { | |
2348 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2349 LABEL_15: | |
2350 result = 0; | |
2351 } | |
2352 return result; | |
2353 } | |
2354 // 506128: using guessed type int areWeLoadingTexture; | |
2355 | |
2356 //----- (0048C855) -------------------------------------------------------- | |
2357 int Player::GetBaseStrength() | |
2358 { | |
2359 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2360 } | |
2361 | |
2362 //----- (0048C86C) -------------------------------------------------------- | |
2363 int Player::GetBaseIntelligence() | |
2364 { | |
2365 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2366 } | |
2367 | |
2368 //----- (0048C883) -------------------------------------------------------- | |
2369 int Player::GetBaseWillpower() | |
2370 { | |
2371 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2372 } | |
2373 | |
2374 //----- (0048C89A) -------------------------------------------------------- | |
2375 int Player::GetBaseEndurance() | |
2376 { | |
2377 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2378 } | |
2379 | |
2380 //----- (0048C8B1) -------------------------------------------------------- | |
2381 int Player::GetBaseAccuracy() | |
2382 { | |
2383 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2384 } | |
2385 | |
2386 //----- (0048C8C8) -------------------------------------------------------- | |
2387 int Player::GetBaseSpeed() | |
2388 { | |
2389 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2390 } | |
2391 | |
2392 //----- (0048C8DF) -------------------------------------------------------- | |
2393 int Player::GetBaseLuck() | |
2394 { | |
2395 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2396 } | |
2397 | |
2398 //----- (0048C8F6) -------------------------------------------------------- | |
2399 int Player::GetBaseLevel() | |
2400 { | |
2401 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2402 } | |
2403 | |
2404 //----- (0048C90D) -------------------------------------------------------- | |
2405 int Player::GetActualLevel() | |
2406 { | |
2407 return uLevel + sLevelModifier + | |
2408 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2409 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2410 } | |
2411 | |
2412 //----- (0048C93C) -------------------------------------------------------- | |
2413 int Player::GetActualMight() | |
2414 { | |
2415 Player *v1; // esi@1 | |
2416 unsigned int v2; // eax@1 | |
2417 signed int v3; // ecx@1 | |
2418 signed int v4; // ebx@4 | |
2419 int v5; // edi@5 | |
2420 int v6; // ST14_4@5 | |
2421 | |
2422 v1 = this; | |
2423 v2 = this->sAgeModifier + GetBaseAge(); | |
2424 v3 = 0; | |
2425 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2426 { | |
2427 ++v3; | |
2428 if ( v3 >= 4 ) | |
2429 { | |
2430 v4 = 100; | |
2431 goto LABEL_5; | |
2432 } | |
2433 } | |
2434 v4 = pAgeingStrengthMultiplier[v3]; | |
2435 LABEL_5: | |
2436 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2437 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2438 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2439 } | |
2440 | |
2441 //----- (0048C9C2) -------------------------------------------------------- | |
2442 int Player::GetActualIntelligence() | |
2443 { | |
2444 Player *v1; // esi@1 | |
2445 unsigned int sAge; // eax@1 | |
2446 signed int uAgeLevel; // ecx@1 | |
2447 signed int v4; // ebx@4 | |
2448 int v5; // edi@5 | |
2449 int v6; // ebp@5 | |
2450 | |
2451 v1 = this; | |
2452 sAge = this->sAgeModifier + GetBaseAge(); | |
2453 uAgeLevel = 0; | |
2454 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2455 { | |
2456 ++uAgeLevel; | |
2457 if ( uAgeLevel >= 4 ) | |
2458 { | |
2459 v4 = 100; | |
2460 goto LABEL_5; | |
2461 } | |
2462 } | |
2463 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2464 LABEL_5: | |
2465 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2466 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2467 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2468 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2469 + v6 | |
2470 + v1->uIntelligenceBonus; | |
2471 } | |
2472 | |
2473 //----- (0048CA3F) -------------------------------------------------------- | |
2474 int Player::GetActualWillpower() | |
2475 { | |
2476 int v5; // edi@5 | |
2477 | |
2478 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2479 uint uAgeingMultiplier = 100; | |
2480 for (uint i = 0; i < 4; ++i) | |
2481 if (uActualAge >= pAgeingTable[i]) | |
2482 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2483 else break; | |
2484 | |
2485 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2486 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2487 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2488 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2489 + uWillpowerBonus; | |
2490 } | |
2491 | |
2492 //----- (0048CABC) -------------------------------------------------------- | |
2493 int Player::GetActualEndurance() | |
2494 { | |
2495 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2496 uint uAgeingMultiplier = 100; | |
2497 for (uint i = 0; i < 4; ++i) | |
2498 if (uActualAge >= pAgeingTable[i]) | |
2499 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2500 else break; | |
2501 | |
2502 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2503 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2504 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2505 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2506 + uItemBonus | |
2507 + uEnduranceBonus; | |
2508 } | |
2509 | |
2510 //----- (0048CB39) -------------------------------------------------------- | |
2511 int Player::GetActualAccuracy() | |
2512 { | |
2513 Player *v1; // esi@1 | |
2514 unsigned int v2; // eax@1 | |
2515 signed int v3; // ecx@1 | |
2516 signed int v4; // ebx@4 | |
2517 int v5; // edi@5 | |
2518 int v6; // ebp@5 | |
2519 | |
2520 v1 = this; | |
2521 v2 = this->sAgeModifier + GetBaseAge(); | |
2522 v3 = 0; | |
2523 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2524 { | |
2525 ++v3; | |
2526 if ( v3 >= 4 ) | |
2527 { | |
2528 v4 = 100; | |
2529 goto LABEL_5; | |
2530 } | |
2531 } | |
2532 v4 = pAgeingAccuracyMultiplier[v3]; | |
2533 LABEL_5: | |
2534 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2535 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2536 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2537 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2538 + v6 | |
2539 + v1->uAccuracyBonus; | |
2540 } | |
2541 | |
2542 //----- (0048CBB6) -------------------------------------------------------- | |
2543 int Player::GetActualSpeed() | |
2544 { | |
2545 Player *v1; // esi@1 | |
2546 unsigned int v2; // eax@1 | |
2547 signed int v3; // ecx@1 | |
2548 signed int v4; // ebx@4 | |
2549 int v5; // edi@5 | |
2550 int v6; // ebp@5 | |
2551 | |
2552 v1 = this; | |
2553 v2 = this->sAgeModifier + GetBaseAge(); | |
2554 v3 = 0; | |
2555 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2556 { | |
2557 ++v3; | |
2558 if ( v3 >= 4 ) | |
2559 { | |
2560 v4 = 100; | |
2561 goto LABEL_5; | |
2562 } | |
2563 } | |
2564 v4 = pAgeingSpeedMultiplier[v3]; | |
2565 LABEL_5: | |
2566 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2567 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2568 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2569 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2570 + v6 | |
2571 + v1->uSpeedBonus; | |
2572 } | |
2573 | |
2574 //----- (0048CC33) -------------------------------------------------------- | |
2575 int Player::GetActualLuck() | |
2576 { | |
1036 | 2577 signed int curr_age; // eax@7 |
2578 signed int i; // ecx@7 | |
2579 signed int age_luck_pc; // ebx@10 | |
2580 int condition_luck_pc; // edi@11 | |
2581 int items_luck_bonus; // ebp@11 | |
2582 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2583 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2584 int full_luck; | |
2585 | |
2586 npc_luck_bonus = 0; | |
652 | 2587 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 2588 npc_luck_bonus = 5; |
652 | 2589 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 2590 npc_luck_bonus += 20; |
652 | 2591 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 2592 npc_luck_bonus += 10; |
2593 curr_age = sAgeModifier + GetBaseAge(); | |
2594 i = 0; | |
2595 while ( curr_age >= pAgeingTable[i] ) | |
2596 { | |
2597 ++i; | |
2598 if ( i >= 4 ) | |
2599 break; | |
2600 } | |
2601 if (i < 4) | |
2602 age_luck_pc = pAgeingLuckMultiplier[i]; | |
2603 else | |
2604 age_luck_pc = 100; | |
2605 | |
2606 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2607 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2608 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); | |
2609 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus | |
2610 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; | |
2611 return full_luck; | |
0 | 2612 } |
2613 | |
2614 //----- (0048CCF5) -------------------------------------------------------- | |
2615 int Player::GetActualAttack(int a2) | |
2616 { | |
2617 Player *v2; // esi@1 | |
2618 int v3; // eax@1 | |
2619 int v4; // edi@1 | |
2620 int v5; // ebx@1 | |
2621 int v6; // ebp@1 | |
2622 | |
2623 v2 = this; | |
2624 v3 = GetActualAccuracy(); | |
1036 | 2625 v4 = GetParameterBonus(v3); |
0 | 2626 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
2627 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2628 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2629 } | |
2630 | |
2631 //----- (0048CD45) -------------------------------------------------------- | |
2632 int Player::GetMeleeDamageMinimal() | |
2633 { | |
2634 Player *v1; // edi@1 | |
2635 int v2; // eax@1 | |
2636 int v3; // esi@1 | |
2637 int v4; // esi@1 | |
2638 int v5; // esi@1 | |
2639 int v6; // esi@1 | |
2640 signed int result; // eax@1 | |
2641 | |
1036 | 2642 |
0 | 2643 v2 = GetActualMight(); |
1036 | 2644 v3 = GetParameterBonus(v2); |
0 | 2645 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
2646 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 2647 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
2648 if ( result < 1 ) | |
2649 result = 1; | |
0 | 2650 return result; |
2651 } | |
2652 | |
2653 //----- (0048CD90) -------------------------------------------------------- | |
2654 int Player::GetMeleeDamageMaximal() | |
2655 { | |
2656 Player *v1; // edi@1 | |
2657 int v2; // eax@1 | |
2658 int v3; // esi@1 | |
2659 int v4; // esi@1 | |
2660 int v5; // esi@1 | |
2661 int v6; // esi@1 | |
2662 signed int result; // eax@1 | |
2663 | |
2664 v1 = this; | |
2665 v2 = GetActualMight(); | |
1036 | 2666 v3 = GetParameterBonus(v2); |
0 | 2667 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
2668 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2669 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2670 result = 1; | |
2671 if ( v6 >= 1 ) | |
2672 result = v6; | |
2673 return result; | |
2674 } | |
2675 | |
2676 //----- (0048CDDB) -------------------------------------------------------- | |
2677 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2678 { | |
2679 int v4; // esi@1 | |
2680 Player *v5; // edi@1 | |
2681 ItemGen *v6; // ebx@4 | |
2682 unsigned int v7; // ebp@4 | |
2683 unsigned int v8; // esi@4 | |
2684 int v9; // eax@4 | |
2685 int v10; // eax@9 | |
2686 char v11; // zf@9 | |
2687 int v12; // esi@10 | |
2688 int v13; // eax@11 | |
2689 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2690 ItemGen *v15; // ebx@35 | |
2691 unsigned int v16; // ebp@35 | |
2692 unsigned int v17; // esi@35 | |
2693 int v18; // edx@38 | |
2694 int v19; // eax@40 | |
2695 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2696 int v21; // esi@62 | |
2697 int v22; // eax@63 | |
2698 int v23; // ebx@63 | |
2699 int v24; // ebx@63 | |
2700 signed int result; // eax@64 | |
2701 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2702 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2703 int v28; // [sp+10h] [bp-10h]@1 | |
2704 int v29; // [sp+10h] [bp-10h]@33 | |
2705 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2706 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2707 int v32; // [sp+18h] [bp-8h]@1 | |
2708 int v33; // [sp+18h] [bp-8h]@8 | |
2709 int v34; // [sp+1Ch] [bp-4h]@1 | |
2710 int v35; // [sp+28h] [bp+8h]@37 | |
2711 | |
2712 v4 = 0; | |
2713 v5 = this; | |
2714 v34 = 0; | |
2715 v32 = 0; | |
2716 v28 = 0; | |
2717 if ( IsUnarmed() == 1 ) | |
2718 { | |
2719 v32 = rand() % 3 + 1; | |
2720 LABEL_61: | |
2721 v34 = v4; | |
2722 goto LABEL_62; | |
2723 } | |
816 | 2724 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2725 { |
232 | 2726 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2727 v7 = v6->uItemID; |
2728 v8 = v6->uItemID; | |
2729 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2730 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2731 ++v9; |
2732 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2733 if ( v9 > 0 ) | |
2734 { | |
2735 v33 = v9; | |
2736 do | |
2737 { | |
2738 v10 = rand(); | |
2739 v11 = v33-- == 1; | |
2740 v28 += v10 % v30 + 1; | |
2741 } | |
2742 while ( !v11 ); | |
2743 } | |
2744 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2745 if ( !uTargetActorID ) | |
2746 goto LABEL_28; | |
377 | 2747 v13 = v6->uSpecEnchantmentType; |
0 | 2748 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2749 { | |
2750 v14 = (MONSTER_SUPERTYPE)1; | |
2751 } | |
2752 else | |
2753 { | |
2754 if ( v13 == 39 ) | |
2755 { | |
2756 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2757 } | |
2758 else | |
2759 { | |
2760 if ( v13 == 40 ) | |
2761 { | |
2762 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2763 } | |
2764 else | |
2765 { | |
2766 if ( v13 == 63 || v7 == 517 ) | |
2767 { | |
2768 v26 = MONSTER_SUPERTYPE_ELF; | |
2769 } | |
2770 else | |
2771 { | |
2772 if ( v13 != 65 ) | |
2773 { | |
2774 LABEL_28: | |
2775 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2776 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2777 && rand() % 100 < 10 ) | |
2778 v12 *= 3; | |
2779 v32 = v12; | |
2780 goto LABEL_33; | |
2781 } | |
2782 v26 = MONSTER_SUPERTYPE_TITAN; | |
2783 } | |
2784 } | |
2785 } | |
2786 v14 = v26; | |
2787 } | |
2788 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2789 v12 *= 2; | |
2790 goto LABEL_28; | |
2791 } | |
2792 LABEL_33: | |
2793 v29 = 0; | |
2794 if ( !a3 ) | |
2795 { | |
2796 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2797 { | |
898 | 2798 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2799 v16 = v15->uItemID; |
2800 v17 = v15->uItemID; | |
2801 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2802 { | |
2803 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2804 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2805 { | |
2806 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2807 do | |
2808 { | |
2809 v18 = rand() % v31; | |
2810 v11 = v35-- == 1; | |
2811 v29 += v18 + 1; | |
2812 } | |
2813 while ( !v11 ); | |
2814 } | |
2815 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2816 if ( !uTargetActorID ) | |
2817 goto LABEL_57; | |
377 | 2818 v19 = v15->uSpecEnchantmentType; |
0 | 2819 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2820 { | |
2821 v20 = (MONSTER_SUPERTYPE)1; | |
2822 } | |
2823 else | |
2824 { | |
2825 if ( v19 == 39 ) | |
2826 { | |
2827 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2828 } | |
2829 else | |
2830 { | |
2831 if ( v19 == 40 ) | |
2832 { | |
2833 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2834 } | |
2835 else | |
2836 { | |
2837 if ( v19 == 63 || v16 == 517 ) | |
2838 { | |
2839 v27 = MONSTER_SUPERTYPE_ELF; | |
2840 } | |
2841 else | |
2842 { | |
2843 if ( v19 != 65 ) | |
2844 { | |
2845 LABEL_57: | |
2846 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2847 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2848 && rand() % 100 < 10 ) | |
2849 v4 *= 3; | |
2850 goto LABEL_61; | |
2851 } | |
2852 v27 = MONSTER_SUPERTYPE_TITAN; | |
2853 } | |
2854 } | |
2855 } | |
2856 v20 = v27; | |
2857 } | |
2858 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2859 v4 *= 2; | |
2860 goto LABEL_57; | |
2861 } | |
2862 } | |
2863 } | |
2864 LABEL_62: | |
2865 v21 = v32 + v34; | |
2866 if ( !a2 ) | |
2867 { | |
2868 v22 = GetActualMight(); | |
1036 | 2869 v23 = GetParameterBonus(v22); |
0 | 2870 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; |
2871 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2872 } | |
2873 result = 1; | |
2874 if ( v21 >= 1 ) | |
2875 result = v21; | |
2876 return result; | |
2877 } | |
2878 | |
2879 //----- (0048D0B9) -------------------------------------------------------- | |
2880 int Player::GetRangedAttack() | |
2881 { | |
2882 Player *v1; // esi@1 | |
2883 int v2; // eax@1 | |
2884 int v3; // edi@3 | |
2885 int v4; // eax@4 | |
2886 int v5; // edi@4 | |
2887 int v6; // edi@4 | |
2888 int v7; // edi@4 | |
2889 | |
2890 v1 = this; | |
232 | 2891 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2892 if ( v2 < 64 || v2 > 65 ) |
2893 { | |
2894 v4 = GetActualAccuracy(); | |
1036 | 2895 v5 = GetParameterBonus(v4); |
0 | 2896 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
2897 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2898 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2899 } | |
2900 else | |
2901 { | |
2902 v3 = GetActualAttack(1); | |
2903 } | |
2904 return v3; | |
2905 } | |
2906 | |
2907 //----- (0048D124) -------------------------------------------------------- | |
2908 int Player::GetRangedDamageMin() | |
2909 { | |
2910 Player *v1; // esi@1 | |
2911 int v2; // edi@1 | |
2912 int v3; // edi@1 | |
2913 int v4; // edi@1 | |
2914 unsigned __int16 v5; // ax@1 | |
2915 int result; // eax@6 | |
2916 | |
2917 v1 = this; | |
2918 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2919 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2920 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2921 v5 = v1->pActiveSkills[5]; | |
2922 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2923 v4 += v1->pActiveSkills[5] & 0x3F; | |
2924 if ( v4 >= 1 ) | |
2925 result = v4; | |
2926 else | |
2927 result = 0; | |
2928 return result; | |
2929 } | |
2930 | |
2931 //----- (0048D191) -------------------------------------------------------- | |
2932 int Player::GetRangedDamageMax() | |
2933 { | |
2934 Player *v1; // esi@1 | |
2935 int v2; // edi@1 | |
2936 int v3; // edi@1 | |
2937 int v4; // edi@1 | |
2938 unsigned __int16 v5; // ax@1 | |
2939 int result; // eax@6 | |
2940 | |
2941 v1 = this; | |
2942 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
2943 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2944 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2945 v5 = v1->pActiveSkills[5]; | |
2946 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2947 v4 += v1->pActiveSkills[5] & 0x3F; | |
2948 if ( v4 >= 1 ) | |
2949 result = v4; | |
2950 else | |
2951 result = 0; | |
2952 return result; | |
2953 } | |
2954 | |
2955 //----- (0048D1FE) -------------------------------------------------------- | |
2956 bool Player::CalculateRangedDamageTo(int a2) | |
2957 { | |
2958 Player *v2; // ebx@1 | |
2959 bool result; // eax@1 | |
2960 ItemGen *v4; // ebx@2 | |
2961 unsigned int v5; // edi@2 | |
2962 unsigned int v6; // esi@2 | |
2963 int v7; // edx@4 | |
2964 char v8; // zf@4 | |
2965 int v9; // esi@5 | |
2966 int v10; // ebx@6 | |
2967 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2968 unsigned __int16 v12; // ax@19 | |
2969 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2970 Player *v14; // [sp+4h] [bp-10h]@1 | |
2971 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2972 int v16; // [sp+Ch] [bp-8h]@3 | |
2973 int v17; // [sp+10h] [bp-4h]@1 | |
2974 | |
2975 v17 = 0; | |
2976 v2 = this; | |
2977 v14 = this; | |
2978 result = HasItemEquipped(EQUIP_BOW); | |
2979 if ( !result ) | |
2980 return result; | |
232 | 2981 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2982 v5 = v4->uItemID; |
2983 v6 = v4->uItemID; | |
2984 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2985 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2986 { | |
2987 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2988 do | |
2989 { | |
2990 v7 = rand() % v15; | |
2991 v8 = v16-- == 1; | |
2992 v17 += v7 + 1; | |
2993 } | |
2994 while ( !v8 ); | |
2995 } | |
2996 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2997 if ( a2 ) | |
2998 { | |
377 | 2999 v10 = v4->uSpecEnchantmentType; |
0 | 3000 if ( v10 == 64 ) |
3001 { | |
3002 v11 = (MONSTER_SUPERTYPE)1; | |
3003 goto LABEL_17; | |
3004 } | |
3005 if ( v10 == 39 || v5 == 508 ) | |
3006 { | |
3007 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3008 goto LABEL_16; | |
3009 } | |
3010 if ( v10 == 40 ) | |
3011 { | |
3012 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3013 goto LABEL_16; | |
3014 } | |
3015 if ( v10 == 63 || v5 == 517 ) | |
3016 { | |
3017 v13 = MONSTER_SUPERTYPE_ELF; | |
3018 LABEL_16: | |
3019 v11 = v13; | |
3020 LABEL_17: | |
3021 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3022 v9 *= 2; | |
3023 goto LABEL_19; | |
3024 } | |
3025 } | |
3026 LABEL_19: | |
3027 v12 = v14->pActiveSkills[5]; | |
3028 if ( v12 ) | |
3029 { | |
3030 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3031 v9 += v14->pActiveSkills[5] & 0x3F; | |
3032 } | |
3033 return v9; | |
3034 } | |
3035 | |
3036 //----- (0048D2EA) -------------------------------------------------------- | |
3037 char *Player::GetMeleeDamageString() | |
3038 { | |
1036 | 3039 signed int itemid; // eax@1 |
3040 int min_damage; // edi@3 | |
3041 int max_damage; // eax@3 | |
0 | 3042 |
3043 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3044 | |
1036 | 3045 if ( pEquipment.uMainHand) |
3046 { | |
3047 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3048 if ( itemid < 64 || itemid > 65 ) //blasters | |
3049 { | |
3050 min_damage = GetMeleeDamageMinimal(); | |
3051 max_damage = GetMeleeDamageMaximal(); | |
3052 } | |
3053 else | |
3054 { //for blasters | |
3055 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3056 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3057 } | |
3058 if ( max_damage ) | |
3059 { | |
3060 if ( min_damage == max_damage ) | |
3061 { | |
3062 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
3063 } | |
3064 else | |
3065 { | |
3066 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3067 } | |
3068 } | |
3069 else | |
3070 { | |
3071 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
3072 } | |
3073 | |
3074 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3075 { | |
3076 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3077 } | |
3078 } | |
0 | 3079 else |
1036 | 3080 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
3081 return player__getmeleedamagestring_static_buff; | |
0 | 3082 } |
3083 | |
3084 //----- (0048D396) -------------------------------------------------------- | |
3085 char *Player::GetRangedDamageString() | |
1036 | 3086 { |
3087 signed int itemid; // eax@1 | |
3088 int min_damage; // edi@3 | |
3089 int max_damage; // eax@3 | |
3090 | |
3091 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3092 if ( pEquipment.uMainHand) | |
3093 { | |
3094 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3095 if ( itemid < 64 || itemid > 65 ) //blasters | |
3096 { | |
3097 min_damage = GetRangedDamageMin(); | |
3098 max_damage = GetRangedDamageMax(); | |
3099 } | |
3100 else | |
3101 { //for blasters | |
3102 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3103 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3104 } | |
3105 if ( max_damage ) | |
3106 { | |
3107 if ( min_damage == max_damage ) | |
3108 { | |
3109 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); | |
3110 } | |
3111 else | |
3112 { | |
3113 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3114 } | |
3115 } | |
3116 else | |
3117 { | |
3118 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3119 } | |
3120 | |
3121 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3122 { | |
3123 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3124 } | |
3125 } | |
0 | 3126 else |
1036 | 3127 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
3128 return player__getrangeddamagestring_static_buff; | |
3129 } | |
0 | 3130 |
3131 //----- (0048D45A) -------------------------------------------------------- | |
3132 bool Player::CanTrainToNextLevel() | |
3133 { | |
3134 int v1; // edx@1 | |
3135 int v2; // eax@1 | |
3136 int i; // esi@1 | |
3137 | |
3138 v1 = this->uLevel; | |
3139 v2 = 0; | |
3140 for ( i = 0; i < v1; ++i ) | |
3141 v2 += i + 1; | |
3142 return (signed __int64)this->uExperience >= 1000 * v2; | |
3143 } | |
3144 | |
3145 //----- (0048D498) -------------------------------------------------------- | |
3146 unsigned int Player::GetExperienceDisplayColor() | |
3147 { | |
3148 unsigned int result; // eax@2 | |
3149 | |
3150 if ( CanTrainToNextLevel() ) | |
995 | 3151 result = ui_character_bonus_text_color; |
0 | 3152 else |
995 | 3153 result = ui_character_default_text_color; |
0 | 3154 return result; |
3155 } | |
3156 | |
3157 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 3158 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
3159 { | |
3160 | |
3161 int resist_value; // edi@8 | |
3162 int player_luck; // eax@21 | |
3163 signed int res_rand_divider; // ebx@2 | |
3164 int armor_skill; // eax@29 | |
3165 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
3166 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
3167 | |
3168 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
3169 switch(dmg_type) | |
3170 { | |
3171 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
3172 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
3173 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
3174 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
3175 | |
3176 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
3177 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
3178 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
3179 } | |
3180 if (player_resist) | |
3181 resist_value = GetActualResistance(player_resist); | |
3182 else | |
3183 resist_value = 0; | |
3184 | |
3185 result_amount_dmg = amount; | |
3186 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 3187 return 0; |
1036 | 3188 player_luck = GetActualLuck(); |
3189 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
3190 | |
3191 if ( resist_value ) | |
3192 { | |
3193 if ( rand() % res_rand_divider >= 30 ) | |
3194 { | |
3195 result_amount_dmg = amount >> 1; | |
3196 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3197 { |
1036 | 3198 result_amount_dmg = amount >> 2; |
3199 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3200 { |
1036 | 3201 result_amount_dmg = amount >> 3; |
3202 if ( rand() % res_rand_divider >= 30 ) | |
3203 result_amount_dmg = amount >> 4; | |
0 | 3204 } |
3205 } | |
3206 } | |
3207 } | |
1036 | 3208 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
3209 { | |
3210 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 3211 { |
1036 | 3212 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
3213 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 3214 { |
1036 | 3215 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
3216 return (int)(double)result_amount_dmg * 0.5; | |
0 | 3217 } |
1036 | 3218 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 3219 { |
1036 | 3220 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
3221 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 3222 } |
3223 } | |
1036 | 3224 } |
3225 return result_amount_dmg; | |
0 | 3226 } |
3227 | |
3228 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3229 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3230 { | |
3231 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3232 } |
3233 | |
3234 //----- (0048D651) -------------------------------------------------------- | |
816 | 3235 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3236 { | |
3237 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3238 } |
3239 | |
3240 //----- (0048D676) -------------------------------------------------------- | |
3241 bool Player::IsUnarmed() | |
3242 { | |
816 | 3243 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3244 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3245 } |
3246 | |
3247 //----- (0048D6AA) -------------------------------------------------------- | |
3248 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3249 { | |
3250 auto i = pEquipment.pIndices[uEquipIndex]; | |
3251 if (i) | |
1036 | 3252 return ~(pInventoryItems[i - 1].uAttributes & ITEM_BROKEN); |
3253 else | |
3254 return false; | |
0 | 3255 } |
3256 | |
3257 //----- (0048D6D0) -------------------------------------------------------- | |
3258 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3259 { | |
3260 for (uint i = 0; i < 16; ++i) | |
3261 { | |
3262 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3263 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3264 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3265 return true; | |
3266 } | |
3267 return false; | |
3268 } | |
3269 | |
3270 //----- (0048D709) -------------------------------------------------------- | |
3271 bool Player::WearsItem(int a1, signed int a2) | |
3272 { | |
1010 | 3273 |
0 | 3274 int v6; // esi@5 |
3275 | |
3276 if ( a2 >= 16 ) | |
3277 { | |
3278 v6 = 0; | |
3279 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3280 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3281 { |
3282 ++v6; | |
3283 if ( (signed int)v6 >= 16 ) | |
3284 return 0; | |
3285 } | |
3286 return 1; | |
3287 } | |
727 | 3288 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3289 return 1; |
3290 return 0; | |
3291 } | |
3292 | |
3293 //----- (0048D76C) -------------------------------------------------------- | |
3294 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3295 { | |
3296 unsigned __int16 v6; // cx@8 | |
3297 int v7; // edi@8 | |
3298 unsigned int v8; // ebx@8 | |
3299 unsigned int v9; // esi@8 | |
3300 int v10; // eax@8 | |
3301 int v11; // edi@12 | |
3302 bool result; // eax@13 | |
3303 | |
3304 if ( !a2 | |
3305 || this->pConditions[16] | |
3306 || this->pConditions[14] | |
3307 || this->pConditions[15] | |
3308 || this->pConditions[4] | |
3309 || this->pConditions[13] | |
3310 || this->pConditions[2] ) | |
3311 { | |
3312 result = 0; | |
3313 } | |
3314 else | |
3315 { | |
3316 v6 = this->pActiveSkills[34]; | |
3317 v7 = v6 & 0x3F; | |
3318 v8 = SkillToMastery(v6); | |
3319 v9 = a2->GetValue(); | |
3320 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3321 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3322 v9 *= 3; | |
3323 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3324 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3325 if ( rand() % 100 >= 5 ) | |
3326 { | |
3327 if ( *a6 > v11 ) | |
3328 result = *a6 - v11 < 500; | |
3329 else | |
3330 result = 2; | |
3331 } | |
3332 else | |
3333 { | |
3334 result = 0; | |
3335 } | |
3336 } | |
3337 return result; | |
3338 } | |
3339 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3340 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3341 | |
3342 //----- (0048D88B) -------------------------------------------------------- | |
3343 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3344 { | |
3345 Player *v4; // esi@1 | |
3346 Actor *v5; // edi@1 | |
3347 unsigned __int16 v6; // cx@10 | |
3348 int v7; // ebx@10 | |
3349 unsigned int v8; // esi@10 | |
3350 int v9; // eax@10 | |
3351 int v10; // esi@10 | |
3352 int v11; // eax@13 | |
3353 signed int v12; // ebx@15 | |
3354 signed int v13; // edx@15 | |
3355 int v14; // ecx@15 | |
3356 unsigned __int16 v15; // si@21 | |
3357 unsigned int v16; // ebx@24 | |
3358 int v17; // esi@24 | |
3359 const void *v18; // eax@29 | |
3360 unsigned int v19; // esi@31 | |
3361 int v20; // eax@34 | |
3362 char v21; // zf@36 | |
3363 unsigned int v22; // ST0C_4@39 | |
3364 char *v23; // esi@39 | |
3365 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3366 int v26; // [sp-8h] [bp-44h]@40 | |
3367 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3368 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3369 int v29; // [sp+30h] [bp-Ch]@10 | |
3370 int v30; // [sp+34h] [bp-8h]@10 | |
3371 Player *v31; // [sp+38h] [bp-4h]@1 | |
3372 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3373 | |
3374 v4 = this; | |
3375 v5 = &pActors[uActorID]; | |
3376 v31 = this; | |
3377 if ( &pActors[uActorID] | |
3378 && !this->pConditions[16] | |
3379 && !this->pConditions[14] | |
3380 && !this->pConditions[15] | |
3381 && !this->pConditions[4] | |
3382 && !this->pConditions[13] | |
3383 && !this->pConditions[2] ) | |
3384 { | |
3385 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3386 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3387 v6 = v4->pActiveSkills[34]; | |
3388 v7 = v6 & 0x3F; | |
3389 v8 = SkillToMastery(v6); | |
3390 v9 = rand(); | |
3391 v28 = 4 * v8; | |
3392 v30 = dword_4EDEA0[v8]; | |
3393 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3394 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3395 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3396 { | |
322 | 3397 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3398 _steal_perma = 0; |
3399 v26 = (int)v31->pName; | |
3400 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3401 } | |
3402 else | |
3403 { | |
3404 v11 = rand(); | |
3405 if ( v11 % 100 >= 40 ) | |
3406 { | |
3407 if ( v11 % 100 >= 70 ) | |
3408 { | |
3409 v19 = 0; | |
3410 if ( v7 > 0 ) | |
3411 { | |
3412 do | |
3413 { | |
3414 --v7; | |
3415 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3416 } | |
3417 while ( v7 ); | |
3418 } | |
3419 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3420 return _steal_perma; | |
377 | 3421 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3422 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3423 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3424 v21 = *(int *)v20 == v19; |
3425 *(int *)v20 -= v19; | |
3426 if ( v21 ) | |
3427 v5->array_000234[3].uItemID = 0; | |
3428 if ( v19 ) | |
3429 { | |
3430 party_finds_gold(v19, 2); | |
3431 v22 = v19; | |
3432 v23 = pTmpBuf2; | |
3433 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3434 LABEL_43: | |
3435 ShowStatusBarString(v23, 2u); | |
3436 return _steal_perma; | |
3437 } | |
3438 } | |
3439 else | |
3440 { | |
3441 v27.Reset(); | |
3442 v12 = 0; | |
3443 v13 = 0; | |
3444 v14 = (int)v5->array_000234; | |
3445 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3446 { | |
3447 ++v13; | |
3448 v14 += 36; | |
3449 if ( v13 >= 4 ) | |
3450 goto LABEL_21; | |
3451 } | |
3452 v12 = 1; | |
3453 LABEL_21: | |
3454 v15 = v5->uCarriedItemID; | |
3455 if ( v15 || v12 ) | |
3456 { | |
3457 v27.Reset(); | |
3458 if ( v15 ) | |
3459 { | |
3460 v16 = (signed __int16)v15; | |
3461 v5->uCarriedItemID = 0; | |
3462 v27.uItemID = (signed __int16)v15; | |
3463 v17 = (signed __int16)v15; | |
3464 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3465 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3466 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3467 { | |
3468 if ( v16 != 220 ) | |
570 | 3469 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3470 } |
3471 } | |
3472 else | |
3473 { | |
3474 v18 = &v5->array_000234[rand() % 4]; | |
3475 memcpy(&v27, v18, sizeof(v27)); | |
3476 ((ItemGen *)v18)->Reset(); | |
3477 v16 = v27.uItemID; | |
3478 } | |
3479 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3480 sprintf( | |
3481 pTmpBuf2, | |
3482 pGlobalTXT_LocalizationStrings[304], | |
3483 v31->pName, | |
3484 pItemsTable->pItems[v16].pUnidentifiedName); | |
3485 ShowStatusBarString(pTmpBuf2, 2u); | |
3486 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3487 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3488 pMouse->SetCursorBitmapFromItemID(v16); | |
3489 return _steal_perma; | |
3490 } | |
3491 } | |
3492 } | |
3493 v26 = (int)v31->pName; | |
3494 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3495 } | |
3496 v23 = pTmpBuf2; | |
809 | 3497 sprintfex(pTmpBuf2, v25, v26); |
0 | 3498 goto LABEL_43; |
3499 } | |
3500 return 0; | |
3501 } | |
3502 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3503 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3504 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3505 | |
3506 //----- (0048DBB9) -------------------------------------------------------- | |
3507 void Player::Heal(int amount) | |
3508 { | |
1010 | 3509 signed int max_health; // eax@3 |
3510 | |
3511 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3512 { | |
3513 max_health = GetMaxHealth(); | |
3514 if ( pConditions[Condition_Zombie] ) | |
3515 max_health /= 2; | |
3516 sHealth += amount; | |
3517 if ( sHealth > max_health ) | |
3518 sHealth = max_health; | |
3519 if ( pConditions[Condition_Unconcious] ) | |
3520 { | |
3521 if ( sHealth > 0 ) | |
3522 { | |
3523 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3524 } |
3525 } | |
3526 } | |
3527 } | |
3528 | |
3529 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 3530 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
3531 { | |
3532 signed int recieved_dmg; // eax@1 | |
3533 unsigned int armor_indx; // eax@8 | |
3534 bool broke_armor; | |
3535 | |
3536 pConditions[Condition_Sleep] = 0i64; | |
3537 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
3538 sHealth -= recieved_dmg; | |
3539 broke_armor = sHealth <= -10; | |
3540 if ( sHealth < 1 ) // | |
3541 { | |
3542 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
3543 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 3544 { |
1019 | 3545 SetCondition(Condition_Unconcious, 0); |
0 | 3546 } |
3547 else | |
3548 { | |
1019 | 3549 SetCondition(Condition_Dead, 0); |
1036 | 3550 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
3551 if ( sHealth > 0 ) | |
3552 sHealth = 0; | |
3553 } | |
3554 if (broke_armor ) | |
3555 { | |
3556 armor_indx = pEquipment.uArmor; | |
3557 if ( armor_indx ) | |
0 | 3558 { |
1036 | 3559 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 3560 { |
1036 | 3561 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 3562 } |
3563 } | |
3564 } | |
3565 } | |
1036 | 3566 if ( recieved_dmg && CanAct() ) |
187 | 3567 PlaySound(SPEECH_24, 0); |
1036 | 3568 return recieved_dmg; |
0 | 3569 } |
3570 | |
3571 //----- (0048DCF6) -------------------------------------------------------- | |
3572 int Player::_48DCF6(int a2, Actor *pActor) | |
3573 { | |
3574 signed int v3; // edi@1 | |
3575 signed int v4; // ebx@1 | |
3576 Player *v5; // esi@1 | |
3577 int v6; // eax@2 | |
3578 int v7; // eax@5 | |
3579 int v8; // eax@8 | |
3580 int v9; // ebx@8 | |
3581 int v10; // eax@8 | |
3582 int v11; // ebx@8 | |
3583 signed int v12; // edx@9 | |
3584 ItemGen *v13; // eax@9 | |
3585 int v14; // edx@16 | |
3586 unsigned int v15; // edx@17 | |
3587 int v16; // edx@26 | |
3588 unsigned int v17; // edx@27 | |
3589 signed int v19; // edx@38 | |
3590 int *v20; // ecx@38 | |
3591 signed int v21; // eax@40 | |
3592 int v22; // eax@49 | |
3593 signed int v23; // ebx@49 | |
3594 unsigned int v24; // eax@60 | |
3595 int v25; // ecx@61 | |
3596 int v26; // ebx@74 | |
3597 void *v27; // ecx@76 | |
3598 unsigned int v28; // ebx@78 | |
3599 signed int result; // eax@86 | |
3600 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3601 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3602 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3603 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3604 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3605 int v35; // [sp-Ch] [bp-ACh]@56 | |
3606 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3607 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3608 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3609 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3610 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3611 int v41; // [sp-4h] [bp-A4h]@51 | |
3612 int v42; // [sp-4h] [bp-A4h]@56 | |
3613 int v43; // [sp-4h] [bp-A4h]@57 | |
3614 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3615 int v45; // [sp-4h] [bp-A4h]@68 | |
3616 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3617 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3618 int v48; // [sp+9Ch] [bp-4h]@1 | |
3619 | |
3620 v3 = 0; | |
3621 v4 = 0; | |
3622 v5 = this; | |
3623 v47 = 0; | |
3624 v48 = 0; | |
3625 switch ( a2 ) | |
3626 { | |
3627 case 1: | |
3628 v6 = GetActualWillpower(); | |
3629 goto LABEL_46; | |
3630 case 2: | |
3631 case 3: | |
3632 case 4: | |
3633 case 9: | |
3634 case 10: | |
3635 case 11: | |
3636 case 13: | |
3637 case 21: | |
3638 v6 = GetActualEndurance(); | |
3639 goto LABEL_46; | |
3640 case 5: | |
3641 case 12: | |
3642 case 23: | |
3643 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3644 goto LABEL_5; | |
3645 case 15: | |
3646 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3647 goto LABEL_5; | |
3648 case 6: | |
3649 case 7: | |
3650 case 8: | |
3651 case 14: | |
3652 case 16: | |
3653 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3654 LABEL_5: | |
3655 v7 = GetActualResistance(v40); | |
3656 goto LABEL_47; | |
3657 case 22: | |
3658 v8 = GetActualWillpower(); | |
1036 | 3659 v9 = GetParameterBonus(v8); |
0 | 3660 v10 = GetActualIntelligence(); |
1036 | 3661 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 3662 break; |
3663 case 17: | |
3664 v12 = 0; | |
3665 v13 = this->pInventoryItems; | |
3666 do | |
3667 { | |
315 | 3668 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3669 v46[v4++] = v12; |
3670 ++v12; | |
3671 ++v13; | |
3672 } | |
3673 while ( v12 < 138 ); | |
3674 goto LABEL_36; | |
3675 case 18: | |
3676 v14 = 0; | |
3677 do | |
3678 { | |
3679 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3680 { | |
816 | 3681 if ( v15 == EQUIP_ARMOUR ) |
898 | 3682 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3683 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3684 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3685 } |
3686 v14 = v15 + 1; | |
3687 } | |
3688 while ( v14 < 16 ); | |
3689 goto LABEL_36; | |
3690 case 19: | |
3691 v16 = 0; | |
3692 do | |
3693 { | |
3694 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3695 { | |
3696 if ( v17 == 2 ) | |
3697 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3698 if ( (!v17 || v17 == 1) | |
816 | 3699 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3700 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3701 } |
3702 v16 = v17 + 1; | |
3703 } | |
3704 while ( v16 < 16 ); | |
3705 LABEL_36: | |
3706 if ( !v4 ) | |
3707 goto LABEL_87; | |
3708 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3709 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3710 break; | |
3711 case 20: | |
3712 v19 = 0; | |
3713 v20 = this->pInventoryIndices; | |
3714 do | |
3715 { | |
3716 if ( *v20 > 0 ) | |
3717 { | |
232 | 3718 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3719 if ( v21 > 0 ) |
3720 { | |
3721 if ( v21 <= 134 ) | |
3722 v46[v4++] = v19; | |
3723 } | |
3724 } | |
3725 ++v19; | |
3726 ++v20; | |
3727 } | |
3728 while ( v19 < 126 ); | |
3729 if ( !v4 ) | |
3730 goto LABEL_87; | |
3731 v47 = (unsigned __int8)v46[rand() % v4]; | |
3732 v6 = GetActualAccuracy(); | |
3733 LABEL_46: | |
1036 | 3734 v7 = GetParameterBonus(v6); |
0 | 3735 LABEL_47: |
3736 v11 = v7; | |
3737 break; | |
3738 default: | |
3739 v11 = 0; | |
3740 break; | |
3741 } | |
3742 v22 = GetActualLuck(); | |
1036 | 3743 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 3744 if ( rand() % v23 >= 30 ) |
3745 { | |
3746 LABEL_87: | |
3747 result = 0; | |
3748 } | |
3749 else | |
3750 { | |
3751 switch ( a2 ) | |
3752 { | |
3753 case 1: | |
3754 v41 = 1; | |
3755 v36 = 0; | |
3756 goto LABEL_56; | |
3757 case 2: | |
3758 v41 = 1; | |
3759 v36 = 1; | |
3760 goto LABEL_56; | |
3761 case 3: | |
3762 v41 = 1; | |
3763 v36 = 2; | |
3764 goto LABEL_56; | |
3765 case 23: | |
3766 v41 = 1; | |
3767 v36 = 3; | |
3768 goto LABEL_56; | |
3769 case 4: | |
3770 v41 = 1; | |
3771 v36 = 4; | |
3772 LABEL_56: | |
3773 SetCondition(v36, v41); | |
3774 v42 = 0; | |
3775 v37 = 0; | |
3776 v35 = 0; | |
3777 v34 = 0; | |
3778 v33 = -1; | |
3779 v32 = 0; | |
3780 v31 = 0; | |
3781 v30 = (SoundID)221; | |
3782 goto LABEL_83; | |
3783 case 5: | |
3784 v43 = 1; | |
3785 v38 = 5; | |
3786 goto LABEL_70; | |
3787 case 6: | |
3788 case 7: | |
3789 case 8: | |
3790 if ( a2 == 6 ) | |
3791 { | |
3792 v44 = 6; | |
3793 goto LABEL_60; | |
3794 } | |
3795 v25 = 2 * (a2 != 8) + 8; | |
3796 goto LABEL_65; | |
3797 case 9: | |
3798 if ( a2 == 6 ) | |
3799 { | |
3800 v44 = 7; | |
3801 LABEL_60: | |
3802 v24 = v44; | |
3803 } | |
3804 else | |
3805 { | |
3806 v25 = 2 * (a2 != 8) + 9; | |
3807 LABEL_65: | |
3808 v24 = v25; | |
3809 } | |
3810 SetCondition(v24, 1); | |
3811 v42 = 0; | |
3812 v37 = 0; | |
3813 v35 = 0; | |
3814 v34 = 0; | |
3815 v33 = -1; | |
3816 v32 = 0; | |
3817 v31 = 0; | |
3818 v30 = (SoundID)222; | |
3819 LABEL_83: | |
3820 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3821 do | |
3822 { | |
3823 LABEL_84: | |
3824 if ( v5 == pPlayers[v3 + 1] ) | |
3825 break; | |
3826 ++v3; | |
3827 } | |
3828 while ( v3 < 4 ); | |
3829 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3830 result = 1; | |
3831 break; | |
3832 case 12: | |
3833 v43 = 1; | |
3834 v38 = 12; | |
3835 goto LABEL_70; | |
3836 case 15: | |
3837 v45 = 1; | |
3838 v39 = 15; | |
3839 goto LABEL_73; | |
3840 case 13: | |
3841 v43 = 1; | |
3842 v38 = 13; | |
3843 LABEL_70: | |
3844 SetCondition(v38, v43); | |
3845 v42 = 0; | |
3846 v37 = 0; | |
3847 v35 = 0; | |
3848 v34 = 0; | |
3849 v33 = -1; | |
3850 v32 = 0; | |
3851 v31 = 0; | |
3852 v30 = (SoundID)224; | |
3853 goto LABEL_83; | |
3854 case 14: | |
3855 v45 = 1; | |
3856 v39 = 14; | |
3857 goto LABEL_73; | |
3858 case 16: | |
3859 v45 = 1; | |
3860 v39 = 16; | |
3861 LABEL_73: | |
3862 SetCondition(v39, v45); | |
3863 v42 = 0; | |
3864 v37 = 0; | |
3865 v35 = 0; | |
3866 v34 = 0; | |
3867 v33 = -1; | |
3868 v32 = 0; | |
3869 v31 = 0; | |
3870 v30 = (SoundID)225; | |
3871 goto LABEL_83; | |
3872 case 17: | |
3873 case 18: | |
3874 case 19: | |
3875 v26 = v48; | |
3876 if ( *(char *)(v48 + 21) & 2 ) | |
3877 goto LABEL_84; | |
187 | 3878 PlaySound(SPEECH_40, 0); |
0 | 3879 *(int *)(v26 + 20) |= 2u; |
3880 goto LABEL_79; | |
3881 case 20: | |
187 | 3882 PlaySound(SPEECH_40, 0); |
0 | 3883 v27 = pActor->array_000234; |
3884 if ( pActor->array_000234[0].uItemID ) | |
3885 { | |
3886 v27 = &pActor->array_000234[1]; | |
3887 if ( pActor->array_000234[1].uItemID ) | |
3888 goto LABEL_84; | |
3889 } | |
3890 v28 = v47; | |
654 | 3891 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3892 RemoveItemAtInventoryIndex(v28); |
3893 LABEL_79: | |
3894 v42 = 0; | |
3895 v37 = 0; | |
3896 v35 = 0; | |
3897 v34 = 0; | |
3898 v33 = -1; | |
3899 v32 = 0; | |
3900 v31 = 0; | |
3901 v30 = (SoundID)47; | |
3902 goto LABEL_83; | |
3903 case 21: | |
187 | 3904 PlaySound(SPEECH_42, 0); |
0 | 3905 ++v5->sAgeModifier; |
3906 goto LABEL_82; | |
3907 case 22: | |
187 | 3908 PlaySound(SPEECH_41, 0); |
0 | 3909 v5->sMana = 0; |
3910 LABEL_82: | |
3911 v42 = 0; | |
3912 v37 = 0; | |
3913 v35 = 0; | |
3914 v34 = 0; | |
3915 v33 = -1; | |
3916 v32 = 0; | |
3917 v31 = 0; | |
3918 v30 = (SoundID)226; | |
3919 goto LABEL_83; | |
3920 default: | |
3921 goto LABEL_87; | |
3922 } | |
3923 } | |
3924 return result; | |
3925 } | |
324 | 3926 |
0 | 3927 // 48DCF6: using guessed type char var_94[140]; |
3928 | |
3929 //----- (0048E1A3) -------------------------------------------------------- | |
3930 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3931 { | |
3932 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
3933 } | |
3934 | |
3935 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 3936 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
3937 { | |
3938 ItemGen *weapon = nullptr; | |
3939 ItemDesc *weapon_desc = nullptr; | |
3940 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
3941 if (bRangedAttack) | |
0 | 3942 { |
3943 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3944 goto LABEL_17; | |
816 | 3945 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
3946 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3947 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
3948 goto LABEL_17; | |
3949 } | |
3950 else if ( IsUnarmed() == 1 ) | |
3951 { | |
3952 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
3953 { | |
3954 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 3955 goto LABEL_17; |
3956 } | |
3957 } | |
816 | 3958 |
3959 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
3960 { | |
3961 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
3962 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3963 if (weapon_desc->uEquipType == EQUIP_WAND) | |
3964 { | |
3965 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
3966 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
3967 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
3968 } | |
0 | 3969 else |
816 | 3970 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
3971 } | |
1010 | 3972 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
3973 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 3974 { |
898 | 3975 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3976 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
3977 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
3978 { | |
898 | 3979 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3980 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3981 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
3982 } | |
3983 } | |
3984 | |
0 | 3985 LABEL_17: |
816 | 3986 uint armour_recovery = 0; |
0 | 3987 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
3988 { | |
898 | 3989 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 3990 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
3991 | |
3992 float armour_recovery_multipliers[4]; | |
3993 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
3994 { | |
3995 armour_recovery_multipliers[0] = 1.0f; | |
3996 armour_recovery_multipliers[1] = 0; | |
3997 armour_recovery_multipliers[2] = 0; | |
3998 armour_recovery_multipliers[3] = 0; | |
3999 } | |
4000 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4001 { | |
4002 armour_recovery_multipliers[0] = 1.0f; | |
4003 armour_recovery_multipliers[1] = 0.5f; | |
4004 armour_recovery_multipliers[2] = 0; | |
4005 armour_recovery_multipliers[3] = 0; | |
4006 } | |
4007 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4008 { | |
4009 armour_recovery_multipliers[0] = 1.0f; | |
4010 armour_recovery_multipliers[1] = 0.5f; | |
4011 armour_recovery_multipliers[2] = 0.5f; | |
4012 armour_recovery_multipliers[3] = 0; | |
0 | 4013 } |
4014 else | |
4015 { | |
816 | 4016 assert(false && "Unknown armour type"); // what kind of armour is that? |
4017 armour_recovery_multipliers[0] = 1.0f; | |
4018 armour_recovery_multipliers[1] = 1.0f; | |
4019 armour_recovery_multipliers[2] = 1.0f; | |
4020 armour_recovery_multipliers[3] = 1.0f; | |
4021 } | |
4022 | |
4023 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4024 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4025 } | |
4026 | |
4027 uint shield_recovery = 0; | |
4028 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4029 { | |
4030 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4031 | |
898 | 4032 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4033 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4034 | |
4035 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4036 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4037 } | |
4038 | |
1036 | 4039 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 4040 sword_axe_bow_recovery_reduction = 0; |
4041 bool shooting_laser = false; | |
4042 if (weapon_desc) | |
4043 { | |
4044 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4045 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4046 { | |
4047 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4048 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4049 } | |
4050 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4051 shooting_laser = true; | |
4052 } | |
4053 | |
4054 uint armsmaster_recovery_reduction = 0; | |
4055 if (!bRangedAttack && !shooting_laser) | |
4056 { | |
4057 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4058 { | |
4059 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4060 if (SkillToMastery(armsmaster_level) >= 4) | |
4061 armsmaster_recovery_reduction *= 2; | |
4062 } | |
4063 } | |
4064 | |
4065 uint v41 = 0; | |
4066 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4067 v41 = 25; |
816 | 4068 |
4069 uint weapon_enchantment_recovery_reduction = 0; | |
4070 if ( weapon ) | |
4071 { | |
4072 if (weapon->uSpecEnchantmentType == 59 || | |
4073 weapon->uSpecEnchantmentType == 41 || | |
4074 weapon->uSpecEnchantmentType == 500) | |
4075 weapon_enchantment_recovery_reduction = 20; | |
4076 } | |
4077 | |
4078 | |
4079 int recovery = weapon_recovery + | |
4080 armour_recovery + | |
4081 shield_recovery | |
4082 - armsmaster_recovery_reduction | |
4083 - weapon_enchantment_recovery_reduction | |
4084 - v41 | |
4085 - sword_axe_bow_recovery_reduction | |
4086 - player_speed_recovery_reduction; | |
4087 | |
4088 if (recovery < 0) | |
4089 recovery = 0; | |
4090 return recovery; | |
0 | 4091 } |
4092 | |
4093 //----- (0048E4F8) -------------------------------------------------------- | |
4094 int Player::GetMaxHealth() | |
4095 { | |
4096 int v3; // esi@1 | |
4097 int v4; // esi@1 | |
4098 int v6; // esi@1 | |
4099 | |
1036 | 4100 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 4101 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4102 v6 = uFullHealthBonus |
135 | 4103 + pBaseHealthByClass[classType / 4] |
0 | 4104 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4105 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4106 if (v6 <= 0) | |
4107 return 1; | |
4108 return v6; | |
4109 } | |
4110 | |
4111 //----- (0048E565) -------------------------------------------------------- | |
4112 int Player::GetMaxMana() | |
4113 { | |
4114 int v2; // eax@2 | |
4115 int v3; // esi@4 | |
4116 int v4; // eax@5 | |
4117 int v5; // esi@5 | |
4118 int v6; // eax@5 | |
4119 int v7; // esi@6 | |
4120 int v8; // esi@6 | |
4121 int v9; // esi@6 | |
4122 int result; // eax@7 | |
4123 | |
135 | 4124 switch (classType) |
0 | 4125 { |
4126 case 5u: | |
4127 case 6u: | |
4128 case 7u: | |
4129 case 0x10u: | |
4130 case 0x11u: | |
4131 case 0x12u: | |
4132 case 0x13u: | |
4133 case 0x20u: | |
4134 case 0x21u: | |
4135 case 0x22u: | |
4136 case 0x23u: | |
4137 v2 = GetActualIntelligence(); | |
1036 | 4138 v3 = GetParameterBonus(v2); |
0 | 4139 goto LABEL_6; |
4140 case 9u: | |
4141 case 0xAu: | |
4142 case 0xBu: | |
4143 case 0xCu: | |
4144 case 0xDu: | |
4145 case 0xEu: | |
4146 case 0xFu: | |
4147 case 0x18u: | |
4148 case 0x19u: | |
4149 case 0x1Au: | |
4150 case 0x1Bu: | |
4151 v2 = GetActualWillpower(); | |
1036 | 4152 v3 = GetParameterBonus(v2); |
0 | 4153 goto LABEL_6; |
4154 case 0x15u: | |
4155 case 0x16u: | |
4156 case 0x17u: | |
4157 case 0x1Cu: | |
4158 case 0x1Du: | |
4159 case 0x1Eu: | |
4160 case 0x1Fu: | |
4161 v4 = GetActualWillpower(); | |
1036 | 4162 v5 = GetParameterBonus(v4); |
0 | 4163 v6 = GetActualIntelligence(); |
1036 | 4164 v3 = GetParameterBonus(v6) + v5; |
0 | 4165 LABEL_6: |
135 | 4166 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4167 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4168 v9 = uFullManaBonus | |
135 | 4169 + pBaseManaByClass[classType / 4] |
0 | 4170 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4171 + v8; | |
4172 if ( v9 < 1 ) | |
4173 goto LABEL_7; | |
4174 result = v9; | |
4175 break; | |
4176 default: | |
4177 LABEL_7: | |
4178 result = 0; | |
4179 break; | |
4180 } | |
4181 return result; | |
4182 } | |
4183 | |
4184 //----- (0048E656) -------------------------------------------------------- | |
4185 int Player::GetBaseAC() | |
4186 { | |
4187 Player *v1; // edi@1 | |
4188 int v2; // eax@1 | |
4189 int v3; // esi@1 | |
4190 int v4; // esi@1 | |
4191 int v5; // esi@1 | |
4192 int result; // eax@2 | |
4193 | |
4194 v1 = this; | |
4195 v2 = GetActualSpeed(); | |
1036 | 4196 v3 = GetParameterBonus(v2); |
0 | 4197 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4198 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4199 if ( v5 >= 1 ) | |
4200 result = v5; | |
4201 else | |
4202 result = 0; | |
4203 return result; | |
4204 } | |
4205 | |
4206 //----- (0048E68F) -------------------------------------------------------- | |
4207 int Player::GetActualAC() | |
4208 { | |
4209 Player *v1; // edi@1 | |
4210 int v2; // eax@1 | |
4211 int v3; // esi@1 | |
4212 int v4; // esi@1 | |
4213 int v5; // esi@1 | |
4214 int v6; // esi@1 | |
4215 int result; // eax@2 | |
4216 | |
4217 v1 = this; | |
4218 v2 = GetActualSpeed(); | |
1036 | 4219 v3 = GetParameterBonus(v2); |
0 | 4220 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4221 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4222 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4223 if ( v6 >= 1 ) | |
4224 result = v6; | |
4225 else | |
4226 result = 0; | |
4227 return result; | |
4228 } | |
4229 | |
4230 //----- (0048E6DC) -------------------------------------------------------- | |
4231 unsigned int Player::GetBaseAge() | |
4232 { | |
352 | 4233 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4234 } |
4235 | |
4236 //----- (0048E72C) -------------------------------------------------------- | |
4237 unsigned int Player::GetActualAge() | |
4238 { | |
4239 return this->sAgeModifier + GetBaseAge(); | |
4240 } | |
4241 | |
4242 //----- (0048E73F) -------------------------------------------------------- | |
4243 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4244 { | |
4245 Player *v2; // ebx@1 | |
4246 signed int v3; // esi@1 | |
4247 enum CHARACTER_RACE v4; // eax@1 | |
4248 signed int v5; // edi@8 | |
4249 char v6; // zf@9 | |
4250 int v7; // esi@20 | |
4251 int result; // eax@21 | |
4252 signed int v9; // [sp-4h] [bp-10h]@11 | |
4253 | |
4254 v2 = this; | |
4255 v3 = 0; | |
4256 v4 = GetRace(); | |
4257 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4258 { | |
4259 v5 = 0; | |
4260 goto LABEL_16; | |
4261 } | |
4262 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4263 { | |
4264 v5 = 1; | |
4265 LABEL_16: | |
4266 v6 = v4 == 2; | |
4267 goto LABEL_17; | |
4268 } | |
4269 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4270 { | |
4271 v6 = v4 == 3; | |
4272 v5 = 2; | |
4273 goto LABEL_17; | |
4274 } | |
4275 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4276 { | |
4277 v5 = 3; | |
4278 v6 = v4 == 3; | |
4279 goto LABEL_17; | |
4280 } | |
4281 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4282 { | |
4283 v5 = 7; | |
4284 if ( v4 != 1 ) | |
4285 goto LABEL_20; | |
4286 v9 = 10; | |
4287 LABEL_19: | |
4288 v3 = v9; | |
4289 goto LABEL_20; | |
4290 } | |
4291 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4292 { | |
4293 v5 = 8; | |
4294 v6 = v4 == 0; | |
4295 LABEL_17: | |
4296 if ( !v6 ) | |
4297 goto LABEL_20; | |
4298 v9 = 5; | |
4299 goto LABEL_19; | |
4300 } | |
4301 v5 = 0; | |
4302 LABEL_20: | |
4303 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4304 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4305 result = v7 + *(&v2->sResFireBase + v5); |
4306 return result; | |
4307 } | |
4308 | |
4309 //----- (0048E7D0) -------------------------------------------------------- | |
4310 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4311 { | |
4312 signed int v2; // edi@1 | |
4313 Player *v3; // esi@1 | |
4314 enum CHARACTER_RACE v4; // ebx@1 | |
4315 char v6; // zf@18 | |
4316 int v7; // ebx@28 | |
4317 int result; // eax@28 | |
4318 signed int v9; // [sp+10h] [bp-8h]@1 | |
4319 signed int v10; // [sp+14h] [bp-4h]@1 | |
4320 | |
4321 v2 = 0; | |
4322 v3 = this; | |
4323 v10 = 0; | |
4324 v9 = 0; | |
4325 v4 = GetRace(); | |
652 | 4326 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4327 v10 = 20; |
4328 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4329 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4330 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4331 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4332 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4333 && HasItemEquipped(EQUIP_ARMOUR) | |
4334 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4335 v10 += v3->pActiveSkills[9] & 0x3F; | |
4336 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4337 goto LABEL_25; | |
4338 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4339 { | |
4340 v2 = 1; | |
4341 LABEL_25: | |
4342 v6 = v4 == 2; | |
4343 LABEL_26: | |
4344 if ( v6 ) | |
4345 v9 = 5; | |
4346 goto LABEL_28; | |
4347 } | |
4348 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4349 { | |
4350 v6 = v4 == 3; | |
4351 v2 = 2; | |
4352 goto LABEL_26; | |
4353 } | |
4354 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4355 { | |
4356 v2 = 3; | |
4357 if ( v4 == 3 ) | |
4358 v10 += 5; | |
4359 } | |
4360 else | |
4361 { | |
4362 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4363 { | |
4364 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4365 goto LABEL_28; | |
4366 v2 = 8; | |
4367 v6 = v4 == 0; | |
4368 goto LABEL_26; | |
4369 } | |
4370 v2 = 7; | |
4371 if ( v4 == 1 ) | |
4372 v9 = 10; | |
4373 } | |
4374 LABEL_28: | |
4375 v7 = GetItemsBonus(a2, 0); | |
4376 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4377 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4378 { |
4379 if ( result > 200 ) | |
4380 result = 200; | |
4381 } | |
4382 return result; | |
4383 } | |
4384 | |
4385 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4386 bool Player::Recover(int dt) |
4387 { | |
4388 //Player *v2; // esi@1 | |
0 | 4389 signed __int64 v3; // qax@1 |
816 | 4390 //bool result; // eax@4 |
4391 | |
4392 //v2 = this; | |
4393 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4394 | |
4395 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4396 | |
4397 if (uTimeToRecovery > v3) | |
4398 { | |
4399 uTimeToRecovery -= v3; | |
4400 return true; | |
0 | 4401 } |
4402 else | |
4403 { | |
816 | 4404 uTimeToRecovery = 0; |
4405 viewparams->bRedrawGameUI = true; | |
4406 if (!uActiveCharacter) | |
0 | 4407 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4408 return false; |
4409 } | |
0 | 4410 } |
4411 | |
4412 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4413 void Player::SetRecoveryTime(signed int rec) |
4414 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4415 assert(rec >= 0); |
816 | 4416 |
4417 if (rec > uTimeToRecovery) | |
4418 uTimeToRecovery = rec; | |
4419 | |
4420 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4421 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4422 |
4423 viewparams->bRedrawGameUI = true; | |
0 | 4424 } |
4425 // 50C0C4: using guessed type int some_active_character; | |
4426 | |
4427 //----- (0048E9B7) -------------------------------------------------------- | |
4428 void Player::RandomizeName() | |
4429 { | |
4430 if (!uExpressionTimePassed) | |
4431 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4432 } | |
4433 | |
4434 //----- (0048E9F4) -------------------------------------------------------- | |
4435 unsigned int Player::GetMajorConditionIdx() | |
4436 { | |
4437 for (uint i = 0; i < 18; ++i) | |
4438 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4439 return pConditionImportancyTable[i]; | |
4440 | |
4441 return 18; | |
4442 } | |
4443 | |
4444 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 4445 int Player::GetParameterBonus( int player_parameter ) |
4446 { | |
4447 int i; // eax@1 | |
4448 i = 0; | |
4449 while (param_to_bonus_table[i]) | |
4450 { | |
4451 if (player_parameter >= param_to_bonus_table[i]) | |
4452 break; | |
4453 ++i; | |
4454 } | |
4455 return parameter_to_bonus_value[i]; | |
0 | 4456 } |
4457 | |
4458 //----- (0048EA46) -------------------------------------------------------- | |
4459 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4460 { | |
1032 | 4461 int inv_indx; // eax@3 |
4462 | |
4463 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
4464 { | |
4465 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4466 continue; | |
4467 inv_indx = pEquipment.pIndices[i] - 1; | |
4468 if (a2==17) | |
4469 { | |
4470 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID=533)) //Elven Chainmail+Increases rate of Recovery | |
4471 return 50; | |
4472 } | |
4473 if (a2==24) | |
4474 { | |
4475 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. | |
4476 return 5; | |
4477 } | |
4478 } | |
4479 return 0; | |
0 | 4480 } |
4481 | |
4482 //----- (0048EAAE) -------------------------------------------------------- | |
4483 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4484 { | |
4485 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4486 signed int v4; // eax@1 | |
4487 int v5; // edi@1 | |
4488 Player *v6; // ebx@1 | |
4489 Player *v8; // ecx@48 | |
4490 int v9; // eax@49 | |
4491 int v10; // edx@49 | |
4492 Player *v11; // ecx@55 | |
4493 int v12; // eax@56 | |
4494 int v13; // edx@56 | |
4495 int v14; // ecx@58 | |
4496 int v15; // eax@58 | |
4497 Player *v16; // ecx@61 | |
4498 int v17; // eax@62 | |
4499 Player *v18; // ecx@66 | |
4500 int v19; // eax@67 | |
4501 int v20; // eax@69 | |
4502 Player *v21; // ecx@75 | |
4503 int v22; // eax@76 | |
4504 int v23; // edx@76 | |
4505 int v24; // eax@79 | |
4506 int v25; // ecx@80 | |
4507 int v26; // edi@80 | |
4508 Player *v27; // ecx@84 | |
4509 int v28; // eax@85 | |
4510 int v29; // edx@85 | |
4511 Player *v30; // ecx@96 | |
4512 int v31; // ebp@97 | |
4513 int v32; // eax@98 | |
4514 unsigned int v33; // eax@100 | |
4515 int v34; // eax@103 | |
4516 char v35; // zf@104 | |
4517 char v36; // zf@107 | |
4518 unsigned __int8 v37; // zf@119 | |
4519 char v38; // sf@119 | |
4520 unsigned __int8 v39; // of@119 | |
4521 char v40; // zf@122 | |
4522 char v41; // zf@145 | |
4523 char v42; // zf@164 | |
4524 char v43; // zf@173 | |
4525 char v44; // zf@189 | |
4526 char v45; // zf@198 | |
4527 char v46; // zf@239 | |
4528 int v47; // eax@268 | |
4529 int v48; // eax@269 | |
4530 int v49; // eax@291 | |
4531 char v50; // zf@295 | |
4532 int v51; // eax@306 | |
4533 int v52; // eax@307 | |
4534 char v53; // zf@312 | |
4535 char v54; // zf@336 | |
4536 char v55; // zf@348 | |
4537 int v56; // eax@365 | |
4538 int v57; // ebx@368 | |
4539 signed int v58; // [sp-4h] [bp-20h]@10 | |
4540 signed int v59; // [sp-4h] [bp-20h]@71 | |
4541 signed int v60; // [sp-4h] [bp-20h]@347 | |
4542 int v61; // [sp+10h] [bp-Ch]@1 | |
4543 int v62; // [sp+14h] [bp-8h]@1 | |
4544 int v63; // [sp+18h] [bp-4h]@101 | |
4545 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4546 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4547 | |
4548 v3 = attr; | |
4549 v4 = 36; | |
4550 v5 = 0; | |
4551 v6 = this; | |
4552 v62 = 0; | |
4553 v61 = 0; | |
4554 | |
4555 switch (attr) | |
4556 { | |
4557 case CHARACTER_ATTRIBUTE_LEVEL: | |
4558 if (HasEnchantedItemEquipped(25)) | |
4559 return 5; | |
4560 return 0; | |
4561 }; | |
4562 | |
4563 if ( (signed int)attr > 36 ) | |
4564 { | |
4565 switch ( attr ) | |
4566 { | |
4567 case 37: | |
4568 v58 = 15; | |
4569 goto LABEL_35; | |
4570 case 38: | |
4571 v58 = 16; | |
4572 goto LABEL_35; | |
4573 case 39: | |
4574 v58 = 17; | |
4575 goto LABEL_35; | |
4576 case 40: | |
4577 v58 = 18; | |
4578 goto LABEL_35; | |
4579 case 41: | |
4580 v58 = 19; | |
4581 goto LABEL_35; | |
4582 case 42: | |
4583 v58 = 20; | |
4584 goto LABEL_35; | |
4585 case 43: | |
4586 v58 = 25; | |
4587 goto LABEL_35; | |
4588 case 44: | |
4589 v58 = 5; | |
4590 goto LABEL_35; | |
4591 case 45: | |
4592 v58 = 8; | |
4593 goto LABEL_35; | |
4594 case 46: | |
4595 goto LABEL_36; | |
4596 default: | |
4597 break; | |
4598 } | |
4599 } | |
4600 else | |
4601 { | |
4602 if ( attr == 36 ) | |
4603 { | |
4604 v58 = 14; | |
4605 } | |
4606 else | |
4607 { | |
4608 if ( (signed int)attr > 21 ) | |
4609 { | |
4610 switch ( attr ) | |
4611 { | |
4612 case 22: | |
4613 v58 = 30; | |
4614 break; | |
4615 case 23: | |
4616 v58 = 31; | |
4617 break; | |
4618 case 34: | |
4619 v58 = 12; | |
4620 break; | |
4621 default: | |
4622 if ( attr != 35 ) | |
4623 goto LABEL_38; | |
4624 v58 = 13; | |
4625 break; | |
4626 } | |
4627 } | |
4628 else | |
4629 { | |
4630 switch ( attr ) | |
4631 { | |
4632 case 21: | |
4633 v58 = 33; | |
4634 break; | |
4635 case 16: | |
4636 v58 = 35; | |
4637 break; | |
4638 case 17: | |
4639 v58 = 34; | |
4640 break; | |
4641 case 18: | |
4642 v58 = 29; | |
4643 break; | |
4644 case 19: | |
4645 v58 = 21; | |
4646 break; | |
4647 default: | |
4648 if ( attr != 20 ) | |
4649 goto LABEL_38; | |
4650 v58 = 32; | |
4651 break; | |
4652 } | |
4653 } | |
4654 } | |
4655 LABEL_35: | |
4656 v4 = v58; | |
4657 LABEL_36: | |
4658 if ( !this->pActiveSkills[v4] ) | |
4659 return 0; | |
4660 } | |
4661 LABEL_38: | |
4662 if ( (signed int)attr > 28 ) | |
4663 { | |
4664 if ( (signed int)attr < 29 ) | |
4665 return v5 + v62 + v61; | |
4666 if ( (signed int)attr <= 30 ) | |
4667 { | |
4668 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4669 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4670 return v5 + v62 + v61; |
4671 } | |
4672 if ( attr == 31 ) | |
4673 { | |
4674 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4675 return v5 + v62 + v61; | |
232 | 4676 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4677 v5 = pItemsTable->pItems[v57].uDamageMod; |
4678 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4679 goto LABEL_366; | |
4680 } | |
4681 if ( attr == 32 ) | |
4682 { | |
4683 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4684 return v5 + v62 + v61; | |
232 | 4685 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4686 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4687 LABEL_365: | |
4688 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4689 LABEL_366: | |
4690 v5 += v56; | |
4691 return v5 + v62 + v61; | |
4692 } | |
4693 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4694 return v5 + v62 + v61; | |
4695 LABEL_95: | |
4696 v65 = 0; | |
4697 while ( 1 ) | |
4698 { | |
4699 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4700 goto LABEL_361; | |
898 | 4701 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4702 if ( v3 == 9 ) |
4703 { | |
816 | 4704 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4705 if ( v32 >= 3 ) |
4706 { | |
4707 if ( v32 <= 11 ) | |
4708 { | |
4709 v33 = v6->pInventoryItems[v31].uItemID; | |
4710 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4711 } | |
4712 } | |
4713 } | |
4714 v63 = (int)((char *)v6 + 36 * v31); | |
4715 attra = (ItemGen *)(v63 + 532); | |
377 | 4716 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4717 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4718 { |
4719 v34 = attra->uItemID; | |
4720 switch ( attra->uItemID ) | |
4721 { | |
4722 case 0x1F4u: | |
4723 v35 = v3 == 5; | |
4724 goto LABEL_105; | |
4725 case 0x1F5u: | |
4726 v36 = v3 == 0; | |
4727 goto LABEL_108; | |
4728 case 0x1F6u: | |
4729 if ( v3 == 21 ) | |
4730 v61 += 10; | |
4731 v36 = v3 == 2; | |
4732 goto LABEL_108; | |
4733 case 0x1F7u: | |
4734 if ( v3 == 17 ) | |
4735 v61 += 5; | |
4736 if ( v3 == 18 ) | |
4737 v61 += 5; | |
4738 v36 = v3 == 6; | |
4739 goto LABEL_108; | |
4740 case 0x1F8u: | |
4741 goto LABEL_118; | |
4742 case 0x1F9u: | |
4743 v40 = v3 == 3; | |
4744 goto LABEL_123; | |
4745 case 0x1FAu: | |
4746 v35 = v3 == 10; | |
4747 goto LABEL_105; | |
4748 case 0x1FEu: | |
4749 v35 = v3 == 4; | |
4750 goto LABEL_105; | |
4751 case 0x1FFu: | |
4752 if ( v3 == 23 ) | |
4753 v61 += 10; | |
4754 if ( v3 == 22 ) | |
4755 v61 += 10; | |
4756 goto LABEL_361; | |
4757 case 0x200u: | |
4758 if ( v3 == 36 ) | |
4759 { | |
4760 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4761 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4762 } | |
4763 v36 = v3 == 5; | |
4764 LABEL_108: | |
4765 if ( v36 ) | |
4766 v5 += 40; | |
4767 goto LABEL_361; | |
4768 case 0x201u: | |
4769 if ( v3 == 39 ) | |
4770 { | |
4771 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4772 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4773 v62 = v34; | |
4774 } | |
4775 goto LABEL_136; | |
4776 case 0x202u: | |
4777 if ( !v3 ) | |
4778 v5 += 150; | |
4779 if ( v3 == 1 ) | |
4780 v5 -= 40; | |
4781 if ( v3 == 2 ) | |
4782 v5 -= 40; | |
4783 goto LABEL_145; | |
4784 case 0x203u: | |
4785 if ( v3 == 42 ) | |
4786 { | |
4787 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4788 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4789 } | |
4790 if ( v3 == 43 ) | |
4791 v61 += 15; | |
4792 goto LABEL_361; | |
4793 case 0x204u: | |
4794 if ( v3 == 17 ) | |
4795 v61 += 5; | |
4796 if ( v3 == 18 ) | |
4797 v61 += 5; | |
4798 if ( v3 == 6 ) | |
4799 v5 += 50; | |
4800 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4801 goto LABEL_166; | |
4802 v42 = v3 == 15; | |
4803 goto LABEL_165; | |
4804 case 0x205u: | |
4805 if ( v3 == 18 ) | |
4806 v61 += 5; | |
4807 goto LABEL_361; | |
4808 case 0x206u: | |
4809 if ( !v3 ) | |
4810 v5 += 100; | |
4811 if ( v3 == 3 ) | |
4812 v5 += 100; | |
4813 v43 = v3 == 9; | |
4814 goto LABEL_174; | |
4815 case 0x207u: | |
4816 if ( v3 == 45 ) | |
4817 v61 += 5; | |
4818 if ( v3 == 15 ) | |
4819 v5 -= 10; | |
4820 v42 = v3 == 14; | |
4821 LABEL_165: | |
4822 if ( v42 ) | |
4823 LABEL_166: | |
4824 v5 -= 10; | |
4825 goto LABEL_361; | |
4826 case 0x208u: | |
4827 v35 = v3 == 3; | |
4828 goto LABEL_105; | |
4829 case 0x209u: | |
4830 if ( v3 == 2 ) | |
4831 v5 += 15; | |
4832 if ( !v3 ) | |
4833 v5 += 15; | |
4834 v41 = v3 == 6; | |
4835 goto LABEL_146; | |
4836 case 0x20Au: | |
4837 if ( v3 == 46 ) | |
4838 v61 += 15; | |
4839 v44 = v3 == 3; | |
4840 goto LABEL_190; | |
4841 case 0x20Bu: | |
4842 if ( v3 == 34 ) | |
4843 { | |
4844 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4845 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4846 } | |
4847 if ( v3 == 12 ) | |
4848 v5 += 50; | |
4849 if ( v3 == 2 ) | |
4850 v5 += 30; | |
4851 v45 = v3 == 9; | |
4852 goto LABEL_199; | |
4853 case 0x20Cu: | |
4854 if ( !v3 ) | |
4855 v5 += 75; | |
4856 goto LABEL_145; | |
4857 case 0x20Du: | |
4858 if ( v3 == 5 ) | |
4859 v5 += 50; | |
4860 if ( v3 == 6 ) | |
4861 v5 += 50; | |
4862 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4863 goto LABEL_374; | |
4864 v43 = v3 == 15; | |
4865 LABEL_174: | |
4866 if ( v43 ) | |
4867 LABEL_374: | |
4868 v5 -= 15; | |
4869 goto LABEL_361; | |
4870 case 0x20Eu: | |
4871 if ( v3 == 4 ) | |
4872 v5 += 150; | |
4873 if ( v3 == 44 ) | |
4874 v61 += 5; | |
4875 if ( v3 == 9 ) | |
4876 v5 -= 25; | |
4877 goto LABEL_361; | |
4878 case 0x20Fu: | |
4879 if ( v3 == 39 ) | |
4880 { | |
4881 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4882 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4883 v62 = v34; | |
4884 } | |
4885 if ( v3 == 40 ) | |
4886 { | |
4887 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4888 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4889 } | |
4890 LABEL_145: | |
4891 v41 = v3 == 5; | |
4892 LABEL_146: | |
4893 if ( v41 ) | |
4894 v5 -= 40; | |
4895 goto LABEL_361; | |
4896 case 0x210u: | |
4897 if ( v3 == 38 ) | |
4898 { | |
4899 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4900 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4901 } | |
4902 if ( !v3 ) | |
4903 v5 += 75; | |
4904 v44 = v3 == 11; | |
4905 LABEL_190: | |
4906 if ( v44 ) | |
4907 v5 -= 50; | |
4908 goto LABEL_361; | |
4909 case 0x211u: | |
4910 if ( v3 == 5 ) | |
4911 v5 += 100; | |
4912 if ( v3 == 4 ) | |
4913 v5 += 50; | |
4914 v35 = v3 == 11; | |
4915 LABEL_105: | |
4916 if ( v35 ) | |
4917 v5 += 50; | |
4918 goto LABEL_361; | |
4919 case 0x212u: | |
4920 if ( v3 == 1 ) | |
4921 v5 -= 20; | |
4922 v45 = v3 == 2; | |
4923 LABEL_199: | |
4924 if ( v45 ) | |
4925 v5 -= 20; | |
4926 goto LABEL_361; | |
4927 case 0x214u: | |
4928 if ( v3 == 1 ) | |
4929 v5 += 15; | |
4930 v46 = v3 == 2; | |
4931 goto LABEL_240; | |
4932 case 0x215u: | |
4933 if ( v3 == 5 ) | |
4934 v5 += 15; | |
4935 v46 = v3 == 4; | |
4936 goto LABEL_240; | |
4937 case 0x216u: | |
4938 if ( v3 == 10 ) | |
4939 v5 += 30; | |
4940 if ( !v3 ) | |
4941 v5 += 15; | |
4942 goto LABEL_315; | |
4943 case 0x217u: | |
4944 if ( v3 == 21 ) | |
4945 v61 += 5; | |
4946 if ( !v3 ) | |
4947 v5 += 15; | |
4948 goto LABEL_253; | |
4949 case 0x218u: | |
4950 goto LABEL_253; | |
4951 default: | |
4952 goto LABEL_361; | |
4953 } | |
4954 goto LABEL_361; | |
4955 } | |
4956 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
4957 { | |
4958 if ( (signed int)v3 >= 0 ) | |
4959 { | |
4960 if ( (signed int)v3 <= 15 ) | |
4961 { | |
4962 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
4963 } | |
4964 else | |
4965 { | |
4966 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
4967 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
4968 } | |
4969 } | |
4970 goto LABEL_361; | |
4971 } | |
4972 v34 = *(int *)(v63 + 544); | |
4973 if ( v34 > 48 ) | |
4974 { | |
4975 switch ( v34 ) | |
4976 { | |
4977 case 54: | |
4978 goto LABEL_315; | |
4979 case 49: | |
4980 if ( v3 == 6 ) | |
4981 goto LABEL_121; | |
4982 v50 = v3 == 1; | |
4983 goto LABEL_296; | |
4984 case 51: | |
4985 if ( v3 != 5 && v3 != 1 ) | |
4986 goto LABEL_309; | |
4987 goto LABEL_121; | |
4988 case 52: | |
4989 if ( v3 == 3 ) | |
4990 goto LABEL_121; | |
4991 v50 = v3 == 4; | |
4992 goto LABEL_296; | |
4993 case 53: | |
4994 if ( !v3 ) | |
4995 goto LABEL_121; | |
4996 v50 = v3 == 2; | |
4997 goto LABEL_296; | |
4998 case 55: | |
4999 v46 = v3 == 6; | |
5000 goto LABEL_240; | |
5001 case 56: | |
5002 if ( !v3 ) | |
5003 goto LABEL_351; | |
5004 v53 = v3 == 3; | |
5005 goto LABEL_350; | |
5006 case 57: | |
5007 if ( v3 == 1 ) | |
5008 goto LABEL_351; | |
5009 v53 = v3 == 2; | |
5010 goto LABEL_350; | |
5011 case 50: | |
5012 if ( v3 == 10 ) | |
5013 v5 += 30; | |
5014 goto LABEL_361; | |
5015 case 60: | |
5016 if ( v3 != 23 ) | |
5017 goto LABEL_336; | |
5018 if ( v5 >= 3 ) | |
5019 goto LABEL_361; | |
5020 v5 = 3; | |
5021 LABEL_336: | |
5022 v54 = v3 == 22; | |
5023 goto LABEL_345; | |
5024 case 61: | |
5025 if ( v3 != 17 ) | |
5026 goto LABEL_340; | |
5027 if ( v5 >= 3 ) | |
5028 goto LABEL_361; | |
5029 v5 = 3; | |
5030 LABEL_340: | |
5031 v54 = v3 == 18; | |
5032 goto LABEL_345; | |
5033 case 62: | |
5034 if ( v3 != 19 ) | |
5035 goto LABEL_344; | |
5036 if ( v5 >= 3 ) | |
5037 goto LABEL_361; | |
5038 v5 = 3; | |
5039 LABEL_344: | |
5040 v54 = v3 == 20; | |
5041 LABEL_345: | |
5042 if ( !v54 ) | |
5043 goto LABEL_361; | |
5044 if ( v5 >= 3 ) | |
5045 goto LABEL_361; | |
5046 v60 = 3; | |
5047 goto LABEL_360; | |
5048 case 67: | |
5049 v55 = v3 == 18; | |
5050 goto LABEL_357; | |
5051 case 68: | |
5052 v53 = v3 == 9; | |
5053 goto LABEL_350; | |
5054 case 69: | |
5055 if ( v3 == 11 ) | |
5056 v5 += 20; | |
5057 break; | |
5058 case 70: | |
5059 if ( v3 == 12 ) | |
5060 v5 += 10; | |
5061 v55 = v3 == 16; | |
5062 LABEL_357: | |
5063 if ( v55 && v5 < 2 ) | |
5064 { | |
5065 v60 = 2; | |
5066 LABEL_360: | |
5067 v5 = v60; | |
5068 } | |
5069 break; | |
5070 default: | |
5071 goto LABEL_361; | |
5072 } | |
5073 goto LABEL_361; | |
5074 } | |
5075 if ( v34 == 48 ) | |
5076 { | |
5077 if ( v3 == 9 ) | |
5078 v5 += 5; | |
5079 LABEL_315: | |
5080 v46 = v3 == 3; | |
5081 LABEL_240: | |
5082 if ( v46 ) | |
5083 v5 += 15; | |
5084 goto LABEL_361; | |
5085 } | |
5086 if ( v34 > 32 ) | |
5087 { | |
5088 if ( v34 > 44 ) | |
5089 { | |
5090 v51 = v34 - 45; | |
5091 if ( !v51 ) | |
5092 { | |
5093 if ( v3 == 5 ) | |
5094 goto LABEL_351; | |
5095 v53 = v3 == 4; | |
5096 LABEL_350: | |
5097 if ( v53 ) | |
5098 LABEL_351: | |
5099 v5 += 5; | |
5100 goto LABEL_361; | |
5101 } | |
5102 v52 = v51 - 1; | |
5103 if ( !v52 ) | |
5104 { | |
5105 v40 = v3 == 0; | |
5106 LABEL_123: | |
5107 if ( v40 ) | |
5108 v5 += 25; | |
5109 goto LABEL_361; | |
5110 } | |
5111 if ( v52 == 1 ) | |
5112 { | |
5113 LABEL_309: | |
5114 v50 = v3 == 8; | |
5115 goto LABEL_296; | |
5116 } | |
5117 } | |
5118 else | |
5119 { | |
5120 if ( v34 == 44 ) | |
5121 { | |
5122 v50 = v3 == 7; | |
5123 goto LABEL_296; | |
5124 } | |
5125 v34 -= 33; | |
5126 if ( !v34 ) | |
5127 { | |
5128 if ( v3 != 38 ) | |
5129 goto LABEL_361; | |
5130 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5131 goto LABEL_138; | |
5132 } | |
5133 --v34; | |
5134 if ( !v34 ) | |
5135 { | |
5136 if ( v3 != 36 ) | |
5137 goto LABEL_361; | |
5138 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5139 goto LABEL_138; | |
5140 } | |
5141 v49 = v34 - 8; | |
5142 if ( !v49 ) | |
5143 { | |
5144 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5145 ++v5; | |
5146 goto LABEL_361; | |
5147 } | |
5148 if ( v49 == 1 ) | |
5149 { | |
5150 if ( v3 != 3 && v3 != 7 ) | |
5151 { | |
5152 v50 = v3 == 9; | |
5153 LABEL_296: | |
5154 if ( !v50 ) | |
5155 goto LABEL_361; | |
5156 } | |
5157 LABEL_121: | |
5158 v5 += 10; | |
5159 goto LABEL_361; | |
5160 } | |
5161 } | |
5162 } | |
5163 else | |
5164 { | |
5165 if ( v34 == 32 ) | |
5166 { | |
5167 if ( v3 != 39 ) | |
5168 goto LABEL_361; | |
5169 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5170 goto LABEL_138; | |
5171 } | |
5172 if ( v34 > 28 ) | |
5173 { | |
5174 v34 -= 29; | |
5175 if ( v34 ) | |
5176 { | |
5177 --v34; | |
5178 if ( v34 ) | |
5179 { | |
5180 --v34; | |
5181 if ( v34 || v3 != 41 ) | |
5182 goto LABEL_361; | |
5183 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5184 } | |
5185 else | |
5186 { | |
5187 if ( v3 != 34 ) | |
5188 goto LABEL_361; | |
5189 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5190 } | |
5191 } | |
5192 else | |
5193 { | |
5194 if ( v3 != 37 ) | |
5195 goto LABEL_361; | |
5196 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5197 } | |
5198 goto LABEL_138; | |
5199 } | |
5200 if ( v34 == 28 ) | |
5201 { | |
5202 LABEL_136: | |
5203 if ( v3 == 42 ) | |
5204 { | |
5205 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5206 LABEL_138: | |
5207 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5208 goto LABEL_361; | |
5209 } | |
5210 } | |
5211 else | |
5212 { | |
5213 v47 = v34 - 1; | |
5214 if ( v47 ) | |
5215 { | |
5216 v48 = v47 - 1; | |
5217 if ( v48 ) | |
5218 { | |
5219 v34 = v48 - 24; | |
5220 if ( v34 ) | |
5221 { | |
5222 --v34; | |
5223 if ( v34 || v3 != 40 ) | |
5224 goto LABEL_361; | |
5225 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5226 } | |
5227 else | |
5228 { | |
5229 if ( v3 != 35 ) | |
5230 goto LABEL_361; | |
5231 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5232 } | |
5233 goto LABEL_138; | |
5234 } | |
5235 LABEL_118: | |
5236 if ( (signed int)v3 < 0 ) | |
5237 goto LABEL_361; | |
5238 v39 = __OFSUB__((int)v3, 6); | |
5239 v37 = v3 == 6; | |
5240 v38 = v3 - 6 < 0; | |
5241 } | |
5242 else | |
5243 { | |
5244 LABEL_253: | |
5245 if ( (signed int)v3 < 10 ) | |
5246 goto LABEL_361; | |
5247 v39 = __OFSUB__((int)v3, 15); | |
5248 v37 = v3 == 15; | |
5249 v38 = v3 - 15 < 0; | |
5250 } | |
5251 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5252 goto LABEL_121; | |
5253 } | |
5254 } | |
5255 LABEL_361: | |
5256 ++v65; | |
5257 if ( (signed int)v65 >= 16 ) | |
5258 return v5 + v62 + v61; | |
5259 } | |
5260 } | |
5261 if ( attr == 28 ) | |
5262 { | |
5263 if ( IsUnarmed() != 1 ) | |
5264 { | |
816 | 5265 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5266 { | |
5267 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5268 if ( v22 >= 0 ) |
5269 { | |
5270 if ( v22 <= 2 ) | |
5271 { | |
118 | 5272 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
898 | 5273 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5274 { |
5275 v24 = v23; | |
5276 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5277 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5278 } | |
5279 else | |
5280 { | |
5281 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5282 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5283 } | |
5284 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5285 } | |
5286 } | |
5287 } | |
865 | 5288 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5289 return v5 + v62 + v61; |
5290 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5291 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5292 goto LABEL_88; | |
5293 } | |
5294 v59 = 3; | |
5295 LABEL_74: | |
5296 v5 = v59; | |
5297 return v5 + v62 + v61; | |
5298 } | |
5299 if ( (signed int)attr < 0 ) | |
5300 return v5 + v62 + v61; | |
5301 if ( (signed int)attr <= 23 ) | |
5302 goto LABEL_95; | |
5303 if ( (signed int)attr <= 24 ) | |
5304 return v5 + v62 + v61; | |
5305 if ( (signed int)attr <= 26 ) | |
5306 { | |
5307 if ( IsUnarmed() == 1 ) | |
5308 { | |
5309 v5 = 0; | |
5310 return v5 + v62 + v61; | |
5311 } | |
816 | 5312 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5313 { | |
5314 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5315 if ( v17 >= 0 ) |
5316 { | |
5317 if ( v17 <= 2 ) | |
232 | 5318 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5319 } |
5320 } | |
865 | 5321 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5322 return v5 + v62 + v61; |
898 | 5323 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; |
0 | 5324 goto LABEL_365; |
5325 } | |
5326 if ( attr == 27 ) | |
5327 { | |
5328 if ( IsUnarmed() == 1 ) | |
5329 { | |
5330 v5 = 1; | |
5331 return v5 + v62 + v61; | |
5332 } | |
816 | 5333 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5334 { | |
5335 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5336 if ( v9 >= 0 ) |
5337 { | |
5338 if ( v9 <= 2 ) | |
5339 { | |
1021 | 5340 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5341 pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5342 if ( !v6->pEquipment.uShield ) |
0 | 5343 { |
118 | 5344 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5345 ++v5; |
5346 } | |
5347 } | |
5348 } | |
5349 } | |
865 | 5350 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5351 return v5 + v62 + v61; |
898 | 5352 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; |
5353 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5354 LABEL_88: |
5355 v5 += v15 + v14; | |
5356 } | |
5357 return v5 + v62 + v61; | |
5358 } | |
5359 | |
5360 //----- (0048F73C) -------------------------------------------------------- | |
5361 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5362 { | |
5363 int result; // eax@1 | |
5364 int v3; // eax@4 | |
5365 int v4; // ecx@5 | |
5366 | |
5367 switch (a2) | |
5368 { | |
5369 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5370 } | |
5371 | |
5372 result = 0; | |
5373 if ( (signed int)a2 > 10 ) | |
5374 { | |
5375 if ( (signed int)a2 <= 15 ) | |
5376 { | |
5377 switch ( a2 ) | |
5378 { | |
5379 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5380 v3 = this->pPlayerBuffs[2].uPower; | |
5381 v4 = pParty->pPartyBuffs[1].uPower; | |
5382 break; | |
5383 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5384 v3 = this->pPlayerBuffs[0].uPower; | |
5385 v4 = pParty->pPartyBuffs[0].uPower; | |
5386 break; | |
5387 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5388 v3 = this->pPlayerBuffs[22].uPower; | |
5389 v4 = pParty->pPartyBuffs[17].uPower; | |
5390 break; | |
5391 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5392 v3 = this->pPlayerBuffs[3].uPower; | |
5393 v4 = pParty->pPartyBuffs[4].uPower; | |
5394 break; | |
5395 default: | |
5396 if ( a2 != 14 ) | |
5397 return result; | |
5398 v3 = this->pPlayerBuffs[9].uPower; | |
5399 v4 = pParty->pPartyBuffs[12].uPower; | |
5400 break; | |
5401 } | |
5402 return v4 + v3; | |
5403 } | |
5404 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5405 { | |
5406 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5407 { | |
5408 v3 = this->pPlayerBuffs[8].uPower; | |
5409 v4 = pParty->pPartyBuffs[9].uPower; | |
5410 return v4 + v3; | |
5411 } | |
5412 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5413 return result; | |
5414 } | |
5415 return this->pPlayerBuffs[1].uPower; | |
5416 } | |
5417 if ( a2 == 10 ) | |
5418 { | |
5419 v3 = this->pPlayerBuffs[5].uPower; | |
5420 v4 = pParty->pPartyBuffs[6].uPower; | |
5421 return v4 + v3; | |
5422 } | |
5423 switch ( a2 ) | |
5424 { | |
5425 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5426 v3 = pPlayerBuffs[19].uPower; | |
5427 goto LABEL_5; | |
5428 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5429 v3 = pPlayerBuffs[17].uPower; | |
5430 goto LABEL_5; | |
5431 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5432 v3 = pPlayerBuffs[20].uPower; | |
5433 goto LABEL_5; | |
5434 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5435 v3 = pPlayerBuffs[16].uPower; | |
5436 goto LABEL_5; | |
5437 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5438 v3 = pPlayerBuffs[15].uPower; | |
5439 goto LABEL_5; | |
5440 case CHARACTER_ATTRIBUTE_SPEED: | |
5441 v3 = pPlayerBuffs[21].uPower; | |
5442 goto LABEL_5; | |
5443 case CHARACTER_ATTRIBUTE_LUCK: | |
5444 v3 = pPlayerBuffs[18].uPower; | |
5445 LABEL_5: | |
5446 v4 = pParty->pPartyBuffs[2].uPower; | |
5447 return v4 + v3; | |
5448 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5449 v3 = this->pPlayerBuffs[14].uPower; | |
5450 v4 = pParty->pPartyBuffs[15].uPower; | |
5451 return v4 + v3; | |
5452 default: | |
5453 return result; | |
5454 } | |
5455 return result; | |
5456 } | |
5457 | |
5458 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5459 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5460 { | |
0 | 5461 signed int v2; // esi@1 |
5462 unsigned __int16 v3; // ax@126 | |
5463 char result; // al@127 | |
5464 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5465 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5466 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5467 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5468 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5469 | |
0 | 5470 v2 = 0; |
353 | 5471 switch (uSkillType) |
5472 { | |
5473 case PLAYER_SKILL_MONSTER_ID: | |
5474 { | |
652 | 5475 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5476 v2 = 6; |
652 | 5477 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5478 v2 += 6; |
5479 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5480 v2 += GetItemsBonus(v8, 0); | |
5481 } | |
5482 break; | |
5483 | |
5484 case PLAYER_SKILL_ARMSMASTER: | |
5485 { | |
652 | 5486 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5487 v2 = 2; |
652 | 5488 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5489 v2 += 3; |
353 | 5490 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5491 v2 += GetItemsBonus(v8, 0); | |
5492 } | |
5493 break; | |
5494 | |
5495 case PLAYER_SKILL_STEALING: | |
5496 { | |
652 | 5497 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5498 v2 = 8; |
5499 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5500 v2 += GetItemsBonus(v8, 0); | |
5501 } | |
5502 break; | |
5503 | |
5504 | |
5505 case PLAYER_SKILL_ALCHEMY: | |
5506 { | |
652 | 5507 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5508 v2 = 4; |
652 | 5509 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5510 v2 += 8; |
5511 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5512 v2 += GetItemsBonus(v8, 0); | |
5513 } | |
5514 break; | |
5515 | |
5516 case PLAYER_SKILL_LEARNING: | |
5517 { | |
652 | 5518 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5519 v2 = 10; |
652 | 5520 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5521 v2 += 15; |
652 | 5522 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5523 v2 += 5; |
5524 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5525 v2 += GetItemsBonus(v8, 0); | |
5526 } | |
5527 break; | |
5528 | |
5529 case PLAYER_SKILL_UNARMED: | |
5530 { | |
652 | 5531 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5532 v2 = 2; |
5533 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5534 v2 += GetItemsBonus(v8, 0); | |
5535 } | |
5536 break; | |
5537 | |
5538 case PLAYER_SKILL_DODGE: | |
5539 { | |
652 | 5540 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5541 v2 = 2; |
5542 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5543 v2 += GetItemsBonus(v8, 0); | |
5544 } | |
5545 break; | |
5546 | |
5547 case PLAYER_SKILL_BOW: | |
5548 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5549 v2 += GetItemsBonus(v8, 0); | |
5550 break; | |
5551 case PLAYER_SKILL_SHIELD: | |
5552 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5553 v2 += GetItemsBonus(v8, 0); | |
5554 break; | |
5555 | |
5556 case PLAYER_SKILL_EARTH: | |
652 | 5557 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5558 v2 = 2; |
652 | 5559 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5560 v2 += 3; |
652 | 5561 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5562 v2 += 4; |
5563 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5564 v2 += 3; | |
5565 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5566 v2 += GetItemsBonus(v8, 0); | |
5567 break; | |
5568 case PLAYER_SKILL_FIRE: | |
652 | 5569 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5570 v2 = 2; |
652 | 5571 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5572 v2 += 3; |
652 | 5573 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5574 v2 += 4; |
5575 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5576 v2 += 3; | |
5577 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5578 v2 += GetItemsBonus(v8, 0); | |
5579 break; | |
5580 case PLAYER_SKILL_AIR: | |
652 | 5581 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5582 v2 = 2; |
652 | 5583 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5584 v2 += 3; |
652 | 5585 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5586 v2 += 4; |
5587 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5588 v2 += 3; | |
5589 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5590 v2 += GetItemsBonus(v8, 0); | |
5591 break; | |
5592 case PLAYER_SKILL_WATER: | |
652 | 5593 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5594 v2 = 2; |
652 | 5595 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5596 v2 += 3; |
652 | 5597 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5598 v2 += 4; |
5599 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5600 v2 += 3; | |
5601 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5602 v2 += GetItemsBonus(v8, 0); | |
5603 break; | |
5604 case PLAYER_SKILL_SPIRIT: | |
652 | 5605 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5606 v2 = 2; |
652 | 5607 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5608 v2 += 3; |
652 | 5609 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5610 v2 += 4; |
5611 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5612 v2 += GetItemsBonus(v8, 0); | |
5613 break; | |
5614 case PLAYER_SKILL_MIND: | |
652 | 5615 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5616 v2 = 2; |
652 | 5617 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5618 v2 += 3; |
652 | 5619 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5620 v2 += 4; |
5621 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5622 v2 += GetItemsBonus(v8, 0); | |
5623 break; | |
5624 case PLAYER_SKILL_BODY: | |
652 | 5625 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5626 v2 = 2; |
652 | 5627 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5628 v2 += 3; |
652 | 5629 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5630 v2 += 4; |
5631 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5632 v2 += GetItemsBonus(v8, 0); | |
5633 break; | |
5634 case PLAYER_SKILL_LIGHT: | |
5635 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5636 v2 += GetItemsBonus(v8, 0); | |
5637 break; | |
5638 case PLAYER_SKILL_DARK: | |
5639 { | |
5640 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5641 v2 += GetItemsBonus(v8, 0); | |
5642 } | |
5643 break; | |
5644 | |
5645 case PLAYER_SKILL_MERCHANT: | |
5646 { | |
652 | 5647 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5648 v2 = 4; |
652 | 5649 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5650 v2 += 6; |
652 | 5651 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5652 v2 += 3; |
652 | 5653 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5654 v2 += 8; |
5655 } | |
5656 break; | |
5657 | |
5658 case PLAYER_SKILL_PERCEPTION: | |
5659 { | |
652 | 5660 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5661 v2 = 6; |
652 | 5662 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5663 v2 += 5; |
5664 } | |
5665 break; | |
5666 | |
0 | 5667 case PLAYER_SKILL_ITEM_ID: |
5668 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5669 v2 += GetItemsBonus(v8, 0); |
0 | 5670 break; |
5671 case PLAYER_SKILL_MEDITATION: | |
5672 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5673 v2 += GetItemsBonus(v8, 0); |
5674 break; | |
0 | 5675 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5676 { |
652 | 5677 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5678 v2 = 4; |
652 | 5679 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5680 v2 += 6; |
652 | 5681 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5682 v2 += 8; |
0 | 5683 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5684 v2 += GetItemsBonus(v8, 0); |
5685 } | |
5686 break; | |
5687 } | |
5688 | |
5689 v3 = pActiveSkills[uSkillType]; | |
1008 | 5690 if ( v2 + (v3 & 0x3F) < 60 ) |
0 | 5691 result = v2 + v3; |
5692 else | |
1008 | 5693 result = v3 & 0xFFFC | 0x3C; //al |
0 | 5694 return result; |
5695 } | |
5696 | |
5697 //----- (0048FC00) -------------------------------------------------------- | |
5698 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5699 { | |
5700 Player *v2; // esi@1 | |
5701 int v3; // eax@1 | |
5702 char v4; // di@1 | |
5703 signed int v5; // ebx@1 | |
5704 unsigned int v6; // eax@2 | |
5705 unsigned __int8 v7; // sf@5 | |
5706 unsigned __int8 v8; // of@5 | |
5707 PlayerEquipment *v9; // ebx@19 | |
5708 Player *v10; // ecx@20 | |
821 | 5709 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5710 int v12; // eax@21 |
5711 int v13; // edi@21 | |
5712 char v14; // di@25 | |
5713 signed int v15; // esi@25 | |
5714 char v16; // al@32 | |
5715 int v18; // eax@36 | |
5716 unsigned int v19; // eax@37 | |
5717 ITEM_EQUIP_TYPE v20; // edi@40 | |
5718 int v21; // edx@41 | |
5719 int v22; // eax@42 | |
821 | 5720 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5721 unsigned __int16 v24; // ax@45 |
5722 unsigned __int16 v25; // bx@45 | |
5723 unsigned int v26; // eax@45 | |
5724 unsigned __int8 v27; // sf@50 | |
5725 unsigned __int8 v28; // of@50 | |
5726 unsigned int v29; // eax@52 | |
5727 int v30; // eax@55 | |
5728 int v31; // eax@58 | |
5729 unsigned int v32; // eax@59 | |
5730 int v33; // eax@65 | |
5731 char v34; // si@65 | |
5732 ITEM_EQUIP_TYPE v35; // edi@69 | |
5733 int v36; // edx@70 | |
5734 int v37; // eax@71 | |
821 | 5735 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5736 int v39; // eax@74 |
5737 int v40; // eax@89 | |
5738 char v41; // si@89 | |
5739 int v42; // eax@96 | |
821 | 5740 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5741 int v44; // eax@97 |
5742 int v45; // eax@98 | |
5743 int v46; // eax@99 | |
5744 int v47; // eax@100 | |
5745 int v48; // eax@101 | |
5746 int v49; // eax@102 | |
5747 unsigned __int16 v50; // ax@113 | |
5748 char v51; // di@113 | |
5749 unsigned int v52; // eax@113 | |
5750 int v53; // edi@113 | |
5751 signed int i; // ecx@113 | |
5752 unsigned __int16 v55; // ax@118 | |
5753 char v56; // si@118 | |
5754 unsigned int v57; // eax@118 | |
5755 int v58; // esi@121 | |
5756 signed int j; // ecx@121 | |
5757 int v60; // edi@126 | |
5758 int v61; // eax@126 | |
5759 signed int v62; // [sp-4h] [bp-30h]@26 | |
5760 signed int v63; // [sp-4h] [bp-30h]@80 | |
5761 int v64; // [sp+Ch] [bp-20h]@104 | |
5762 int v65; // [sp+10h] [bp-1Ch]@104 | |
5763 int v66; // [sp+14h] [bp-18h]@104 | |
5764 int v67; // [sp+18h] [bp-14h]@104 | |
5765 int v68; // [sp+1Ch] [bp-10h]@69 | |
5766 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5767 int v70; // [sp+24h] [bp-8h]@1 | |
5768 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5769 int a1; // [sp+34h] [bp+8h]@21 | |
5770 int a1a; // [sp+34h] [bp+8h]@74 | |
5771 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5772 | |
5773 v2 = this; | |
5774 v70 = 0; | |
5775 v69 = 0; | |
5776 v71 = (ITEM_EQUIP_TYPE)0; | |
5777 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5778 v4 = v3; | |
5779 v5 = 1; | |
5780 if ( v3 ) | |
5781 { | |
5782 v6 = SkillToMastery(v3); | |
5783 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5784 { | |
5785 if ( (signed int)v6 >= 4 ) | |
5786 goto LABEL_4; | |
5787 v8 = __OFSUB__(v6, 3); | |
5788 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5789 } | |
5790 else | |
5791 { | |
5792 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5793 goto LABEL_11; | |
5794 if ( (signed int)v6 >= 4 ) | |
5795 { | |
5796 LABEL_4: | |
5797 v71 = (ITEM_EQUIP_TYPE)2; | |
5798 LABEL_11: | |
5799 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5800 goto LABEL_12; | |
5801 } | |
5802 v8 = __OFSUB__(v6, 2); | |
5803 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5804 } | |
5805 if ( !(v7 ^ v8) ) | |
5806 v71 = (ITEM_EQUIP_TYPE)1; | |
5807 goto LABEL_11; | |
5808 } | |
5809 LABEL_12: | |
5810 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5811 { | |
135 | 5812 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5813 v61 = v2->GetBodybuilding(); |
5814 return v60 * v61; | |
5815 } | |
5816 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5817 { | |
135 | 5818 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5819 v61 = v2->GetMeditation(); |
0 | 5820 return v60 * v61; |
5821 } | |
5822 if ( a2 != 9 ) | |
5823 { | |
5824 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5825 { | |
5826 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5827 return v70; | |
5828 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5829 { | |
5830 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5831 return v70; | |
5832 v71 = (ITEM_EQUIP_TYPE)0; | |
5833 v9 = &v2->pEquipment; | |
5834 while ( 1 ) | |
5835 { | |
5836 if ( v2->HasItemEquipped(v71) ) | |
5837 { | |
118 | 5838 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5839 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5840 a1 = v12; |
5841 SkillToMastery(v12); | |
5842 v13 = v11 - 5; | |
5843 if ( !v13 ) | |
5844 return a1 & 0x3F; | |
5845 if ( v13 == 2 ) | |
5846 break; | |
5847 } | |
5848 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5849 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5850 if ( (signed int)v71 >= 16 ) | |
5851 return v70; | |
5852 } | |
5853 v14 = a1; | |
5854 v15 = 1; | |
5855 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5856 { | |
5857 v62 = 5; | |
5858 goto LABEL_31; | |
5859 } | |
5860 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5861 { | |
5862 v62 = 3; | |
5863 goto LABEL_31; | |
5864 } | |
5865 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5866 goto LABEL_32; | |
5867 goto LABEL_30; | |
5868 } | |
5869 if ( v2->IsUnarmed() ) | |
5870 { | |
5871 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5872 v14 = v18; | |
5873 if ( !v18 ) | |
5874 return v70; | |
5875 v15 = 0; | |
5876 v19 = SkillToMastery(v18); | |
5877 if ( (signed int)v19 < 3 ) | |
5878 { | |
5879 if ( (signed int)v19 >= 2 ) | |
5880 v15 = 1; | |
5881 LABEL_32: | |
5882 v16 = v14; | |
5883 return v15 * (v16 & 0x3F); | |
5884 } | |
5885 LABEL_30: | |
5886 v62 = 2; | |
5887 LABEL_31: | |
5888 v15 = v62; | |
5889 goto LABEL_32; | |
5890 } | |
5891 v20 = (ITEM_EQUIP_TYPE)0; | |
5892 while ( 1 ) | |
5893 { | |
5894 if ( v2->HasItemEquipped(v20) ) | |
5895 { | |
118 | 5896 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5897 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5898 break; | |
5899 } | |
5900 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5901 if ( (signed int)v20 >= 16 ) | |
5902 return v70; | |
5903 } | |
5904 v71 = (ITEM_EQUIP_TYPE)0; | |
5905 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5906 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5907 v25 = v24; | |
5908 v26 = SkillToMastery(v24); | |
5909 if ( !v23 ) | |
5910 { | |
5911 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5912 { | |
5913 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5914 LOBYTE(v25) = v31; | |
5915 if ( v31 ) | |
5916 { | |
5917 v15 = 0; | |
5918 v32 = SkillToMastery(v31); | |
5919 if ( (signed int)v32 < 3 ) | |
5920 { | |
5921 if ( (signed int)v32 >= 2 ) | |
5922 v15 = 1; | |
5923 } | |
5924 else | |
5925 { | |
5926 v15 = 2; | |
5927 } | |
5928 v16 = v25; | |
5929 return v15 * (v16 & 0x3F); | |
5930 } | |
5931 } | |
5932 goto LABEL_55; | |
5933 } | |
5934 if ( v23 == PLAYER_SKILL_DAGGER ) | |
5935 { | |
5936 v29 = SkillToMastery(v25); | |
5937 v28 = __OFSUB__(v29, 4); | |
5938 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
5939 } | |
5940 else | |
5941 { | |
5942 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
5943 goto LABEL_55; | |
5944 if ( v23 > PLAYER_SKILL_SPEAR ) | |
5945 { | |
5946 if ( v23 == PLAYER_SKILL_MACE ) | |
5947 { | |
5948 v28 = __OFSUB__(v26, 2); | |
118 | 5949 v27 = v26 - 2 < 0; |
0 | 5950 goto LABEL_53; |
5951 } | |
5952 LABEL_55: | |
5953 v30 = v71 * (v25 & 0x3F); | |
5954 return (int)((char *)v69 + v30); | |
5955 } | |
5956 v28 = __OFSUB__(v26, 3); | |
118 | 5957 v27 = v26 - 3 < 0; |
0 | 5958 } |
5959 LABEL_53: | |
5960 if ( !(v27 ^ v28) ) | |
5961 v71 = (ITEM_EQUIP_TYPE)1; | |
5962 goto LABEL_55; | |
5963 } | |
5964 if ( v2->IsUnarmed() == 1 ) | |
5965 { | |
5966 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5967 v34 = v33; | |
5968 if ( !v33 ) | |
5969 return v70; | |
5970 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
5971 v5 = 2; | |
5972 v30 = v5 * (v34 & 0x3F); | |
5973 return (int)((char *)v69 + v30); | |
5974 } | |
5975 v35 = (ITEM_EQUIP_TYPE)0; | |
5976 v68 = 0; | |
5977 while ( 1 ) | |
5978 { | |
5979 if ( v2->HasItemEquipped(v35) ) | |
5980 { | |
118 | 5981 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 5982 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
5983 break; | |
5984 } | |
5985 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
5986 if ( (signed int)v35 >= 16 ) | |
5987 return v70; | |
5988 } | |
5989 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5990 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
5991 a1a = v39; | |
5992 SkillToMastery(v39); | |
5993 v71 = (ITEM_EQUIP_TYPE)0; | |
5994 if ( v38 ) | |
5995 { | |
5996 if ( (signed int)v38 > 0 ) | |
5997 { | |
5998 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
5999 { | |
6000 v71 = (ITEM_EQUIP_TYPE)1; | |
6001 } | |
6002 else | |
6003 { | |
6004 if ( v38 == 7 ) | |
6005 { | |
6006 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6007 { | |
6008 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6009 { | |
6010 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6011 return v5 * (a1a & 0x3F); | |
6012 v63 = 2; | |
6013 } | |
6014 else | |
6015 { | |
6016 v63 = 3; | |
6017 } | |
6018 } | |
6019 else | |
6020 { | |
6021 v63 = 5; | |
6022 } | |
6023 v5 = v63; | |
6024 return v5 * (a1a & 0x3F); | |
6025 } | |
6026 } | |
6027 } | |
6028 } | |
6029 else | |
6030 { | |
6031 v71 = (ITEM_EQUIP_TYPE)1; | |
6032 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6033 { | |
6034 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6035 v41 = v40; | |
6036 if ( v40 ) | |
6037 { | |
6038 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6039 v5 = 2; | |
6040 v68 = v5 * (v41 & 0x3F); | |
6041 } | |
6042 } | |
6043 } | |
6044 v30 = v68 + v71 * (a1a & 0x3F); | |
6045 return (int)((char *)v69 + v30); | |
6046 } | |
6047 a1b = 0; | |
6048 v71 = (ITEM_EQUIP_TYPE)0; | |
6049 v68 = 16; | |
6050 v69 = &v2->pEquipment; | |
6051 do | |
6052 { | |
898 | 6053 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) |
0 | 6054 goto LABEL_117; |
6055 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6056 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6057 if ( !v44 ) | |
6058 { | |
6059 v64 = 0; | |
6060 v65 = 1; | |
6061 LABEL_111: | |
6062 v66 = 0; | |
6063 goto LABEL_112; | |
6064 } | |
6065 v45 = v44 - 1; | |
6066 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6067 { | |
6068 v64 = 0; | |
6069 v65 = 0; | |
6070 v66 = 0; | |
6071 v67 = 1; | |
6072 goto LABEL_113; | |
6073 } | |
6074 v47 = v46 - 4; | |
6075 if ( v47 ) | |
6076 { | |
6077 v48 = v47 - 1; | |
6078 if ( v48 ) | |
6079 { | |
6080 v49 = v48 - 1; | |
6081 if ( v49 ) | |
6082 { | |
6083 if ( v49 != 1 ) | |
6084 goto LABEL_117; | |
6085 a1b = 1; | |
6086 v64 = 1; | |
6087 v65 = 0; | |
6088 v66 = 0; | |
6089 v67 = 0; | |
6090 goto LABEL_113; | |
6091 } | |
6092 a1b = 1; | |
6093 v64 = 1; | |
6094 v65 = 0; | |
6095 goto LABEL_111; | |
6096 } | |
6097 v71 = (ITEM_EQUIP_TYPE)1; | |
6098 } | |
6099 else | |
6100 { | |
6101 a1b = 1; | |
6102 } | |
6103 v64 = 1; | |
6104 v65 = 0; | |
6105 v66 = 1; | |
6106 LABEL_112: | |
6107 v67 = 0; | |
6108 LABEL_113: | |
6109 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6110 v51 = v50; | |
6111 v52 = SkillToMastery(v50); | |
6112 v53 = v51 & 0x3F; | |
6113 for ( i = 0; i < (signed int)v52; ++i ) | |
6114 { | |
6115 if ( *(&v64 + i) ) | |
6116 v70 += v53; | |
6117 } | |
6118 LABEL_117: | |
6119 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6120 --v68; | |
6121 } | |
6122 while ( v68 ); | |
6123 v64 = 1; | |
6124 v65 = 1; | |
6125 v66 = 1; | |
6126 v67 = 0; | |
6127 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6128 v56 = v55; | |
6129 v57 = SkillToMastery(v55); | |
6130 if ( !a1b && (!v71 || v57 == 4) ) | |
6131 { | |
6132 v58 = v56 & 0x3F; | |
6133 for ( j = 0; j < (signed int)v57; ++j ) | |
6134 { | |
6135 if ( *(&v64 + j) ) | |
6136 v70 += v58; | |
6137 } | |
6138 } | |
6139 return v70; | |
6140 } | |
6141 | |
6142 //----- (00490109) -------------------------------------------------------- | |
6143 // faces are: 0 1 2 3 human males | |
6144 // 4 5 6 7 human females | |
6145 // 8 9 elf males | |
6146 // 10 11 elf females | |
6147 // 12 13 dwarf males | |
6148 // 14 15 dwarf females | |
6149 // 16 17 goblin males | |
6150 // 18 19 goblin females | |
6151 // 20 lich male | |
6152 // 21 lich female | |
6153 // 22 underwater suits (unused) | |
6154 // 23 zombie male | |
6155 // 24 zombie female | |
6156 enum CHARACTER_RACE Player::GetRace() | |
6157 { | |
1014 | 6158 if ( uCurrentFace > 15 ) |
6159 { | |
6160 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6161 return CHARACTER_RACE_GOBLIN; |
6162 } | |
6163 else | |
6164 { | |
1014 | 6165 if ( uCurrentFace >= 12 ) |
0 | 6166 { |
6167 return CHARACTER_RACE_DWARF; | |
6168 } | |
6169 else | |
6170 { | |
1014 | 6171 |
6172 if ( uCurrentFace <= 7 ) | |
0 | 6173 { |
6174 return CHARACTER_RACE_HUMAN; | |
6175 } | |
6176 else | |
6177 { | |
1014 | 6178 if ( uCurrentFace <= 11 ) |
0 | 6179 return CHARACTER_RACE_ELF; |
6180 } | |
6181 } | |
6182 } | |
6183 return CHARACTER_RACE_HUMAN; | |
6184 } | |
6185 | |
6186 //----- (00490141) -------------------------------------------------------- | |
187 | 6187 PLAYER_SEX Player::GetSexByVoice() |
0 | 6188 { |
6189 signed int result; // eax@1 | |
6190 | |
6191 result = 0; | |
6192 switch ( this->uVoiceID ) | |
6193 { | |
6194 case 0u: | |
6195 case 1u: | |
6196 case 2u: | |
6197 case 3u: | |
6198 case 8u: | |
6199 case 9u: | |
6200 case 0xCu: | |
6201 case 0xDu: | |
6202 case 0x10u: | |
6203 case 0x11u: | |
6204 case 0x14u: | |
6205 case 0x17u: | |
187 | 6206 return SEX_MALE; |
6207 | |
0 | 6208 case 4u: |
6209 case 5u: | |
6210 case 6u: | |
6211 case 7u: | |
6212 case 0xAu: | |
6213 case 0xBu: | |
6214 case 0xEu: | |
6215 case 0xFu: | |
6216 case 0x12u: | |
6217 case 0x13u: | |
6218 case 0x15u: | |
6219 case 0x18u: | |
187 | 6220 return SEX_FEMALE; |
6221 | |
0 | 6222 default: |
187 | 6223 assert(false); |
6224 } | |
0 | 6225 } |
6226 | |
6227 //----- (00490188) -------------------------------------------------------- | |
6228 void Player::SetInitialStats() | |
6229 { | |
6230 auto v1 = GetRace(); | |
290 | 6231 uMight = StatTable[v1][0].uBaseValue; |
6232 uIntelligence = StatTable[v1][1].uBaseValue; | |
6233 uWillpower = StatTable[v1][2].uBaseValue; | |
6234 uEndurance = StatTable[v1][3].uBaseValue; | |
6235 uAccuracy = StatTable[v1][4].uBaseValue; | |
6236 uSpeed = StatTable[v1][5].uBaseValue; | |
6237 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6238 } |
6239 | |
6240 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6241 void Player::SetSexByVoice() |
6242 { | |
6243 switch ( this->uVoiceID) | |
0 | 6244 { |
6245 case 0: | |
6246 case 1: | |
6247 case 2: | |
6248 case 3: | |
6249 case 8: | |
6250 case 9: | |
6251 case 0xC: | |
6252 case 0xD: | |
6253 case 0x10: | |
6254 case 0x11: | |
6255 case 0x14: | |
6256 case 0x17: | |
1021 | 6257 this->uSex = SEX_MALE; |
0 | 6258 break; |
6259 case 4: | |
6260 case 5: | |
6261 case 6: | |
6262 case 7: | |
6263 case 0xA: | |
6264 case 0xB: | |
6265 case 0xE: | |
6266 case 0xF: | |
6267 case 0x12: | |
6268 case 0x13: | |
6269 case 0x15: | |
6270 case 0x18: | |
1021 | 6271 this->uSex = SEX_FEMALE; |
0 | 6272 break; |
6273 default: | |
6274 break; | |
6275 } | |
1021 | 6276 |
0 | 6277 } |
6278 | |
6279 //----- (0049024A) -------------------------------------------------------- | |
135 | 6280 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6281 { |
6282 sLevelModifier = 0; | |
6283 sAgeModifier = 0; | |
6284 | |
135 | 6285 classType = cls; |
0 | 6286 uLuckBonus = 0; |
6287 uSpeedBonus = 0; | |
6288 uAccuracyBonus = 0; | |
6289 uEnduranceBonus = 0; | |
6290 uWillpowerBonus = 0; | |
6291 uIntelligenceBonus = 0; | |
6292 uMightBonus = 0; | |
6293 uLevel = 1; | |
6294 uExperience = 251 + rand() % 100; | |
6295 uBirthYear = 1147 - rand() % 6; | |
6296 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6297 memset(_guilds_member_bits, 0, 64); |
0 | 6298 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6299 | |
6300 for (uint i = 0; i < 37; ++i) | |
6301 { | |
135 | 6302 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6303 continue; |
6304 | |
6305 pActiveSkills[i] = 1; | |
6306 | |
6307 switch (i) | |
6308 { | |
886 | 6309 case PLAYER_SKILL_FIRE: |
6310 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6311 |
6312 extern bool all_magic; | |
6313 if ( all_magic == true ) | |
6314 { | |
6315 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6316 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6317 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6318 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6319 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6320 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6321 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6322 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6323 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6324 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6325 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6326 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6327 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6328 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6329 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6330 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6331 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6332 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6333 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6334 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6335 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6336 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6337 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6338 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6339 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6340 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6341 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6342 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6343 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6344 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6345 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6346 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6347 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6348 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6349 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6350 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6351 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6352 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6353 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6354 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6355 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6356 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6357 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6358 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6359 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6360 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6361 } | |
486 | 6362 break; |
886 | 6363 case PLAYER_SKILL_AIR: |
6364 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6365 break; | |
6366 case PLAYER_SKILL_WATER: | |
6367 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6368 break; | |
6369 case PLAYER_SKILL_EARTH: | |
6370 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6371 break; | |
6372 case PLAYER_SKILL_SPIRIT: | |
6373 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6374 break; | |
6375 case PLAYER_SKILL_MIND: | |
6376 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6377 break; | |
6378 case PLAYER_SKILL_BODY: | |
6379 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6380 |
6381 if ( all_magic == true ) | |
6382 { | |
6383 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6384 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6385 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6386 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6387 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6388 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6389 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6390 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6391 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6392 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6393 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6394 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6395 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6396 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6397 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6398 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6399 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6400 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6401 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6402 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6403 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6404 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6405 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6406 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6407 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6408 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6409 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6410 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6411 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6412 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6413 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6414 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6415 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6416 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6417 } | |
569 | 6418 break; |
886 | 6419 case PLAYER_SKILL_LIGHT: |
6420 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6421 break; | |
6422 case PLAYER_SKILL_DARK: | |
6423 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6424 break; | |
0 | 6425 } |
6426 } | |
6427 | |
6428 sHealth = GetMaxHealth(); | |
6429 sMana = GetMaxMana(); | |
6430 } | |
6431 | |
6432 //----- (004903C9) -------------------------------------------------------- | |
821 | 6433 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6434 { | |
6435 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6436 int v3; // edx@5 |
6437 char *v4; // ecx@5 | |
6438 int v5; // esi@11 | |
6439 unsigned __int16 *v6; // edx@11 | |
6440 int v7; // esi@18 | |
6441 unsigned __int16 *pActiveSkill; // edx@18 | |
6442 | |
6443 if ( order >= 0 ) | |
6444 { | |
6445 if ( order <= 1 ) | |
6446 { | |
6447 result = (PLAYER_SKILL_TYPE)0; | |
6448 v7 = 0; | |
6449 pActiveSkill = this->pActiveSkills; | |
6450 do | |
6451 { | |
135 | 6452 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6453 { |
6454 if ( v7 == order ) | |
6455 return result; | |
6456 ++v7; | |
6457 } | |
6458 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6459 ++pActiveSkill; | |
6460 } | |
6461 while ( (signed int)result < 37 ); | |
6462 } | |
6463 else | |
6464 { | |
6465 if ( order <= 3 ) | |
6466 { | |
6467 result = (PLAYER_SKILL_TYPE)0; | |
6468 v5 = 0; | |
6469 pActiveSkill = this->pActiveSkills; | |
6470 do | |
6471 { | |
135 | 6472 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6473 { |
6474 if ( v5 == order - 2 ) | |
6475 return result; | |
6476 ++v5; | |
6477 } | |
6478 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6479 ++pActiveSkill; | |
6480 } | |
6481 while ( (signed int)result < 37 ); | |
6482 } | |
6483 else | |
6484 { | |
6485 if ( order <= 12 ) | |
6486 { | |
6487 result = (PLAYER_SKILL_TYPE)0; | |
6488 v3 = 0; | |
135 | 6489 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6490 do |
6491 { | |
6492 if ( *v4 == 1 ) | |
6493 { | |
6494 if ( v3 == order - 4 ) | |
6495 return result; | |
6496 ++v3; | |
6497 } | |
6498 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6499 ++v4; | |
6500 } | |
6501 while ( (signed int)result < 37 ); | |
6502 } | |
6503 } | |
6504 } | |
6505 } | |
6506 return (PLAYER_SKILL_TYPE)37; | |
6507 } | |
6508 | |
6509 | |
6510 | |
6511 //----- (0049048D) -------------------------------------------------------- | |
6512 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6513 void Player::DecreaseAttribute(int eAttribute) | |
6514 { | |
6515 int v2; // eax@1 | |
6516 int pBaseValue; // ecx@1 | |
6517 int pDroppedStep; // ebx@1 | |
6518 int pStep; // esi@1 | |
6519 unsigned __int16 result; // ax@7 | |
6520 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6521 | |
6522 v2 = eAttribute + 7 * GetRace(); | |
290 | 6523 pBaseValue = StatTable[0][v2].uBaseValue; |
6524 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6525 uMinValue = pBaseValue - 2; |
290 | 6526 pStep = StatTable[0][v2].uBaseStep; |
0 | 6527 switch ( eAttribute ) |
6528 { | |
6529 case CHARACTER_MIGHT: | |
6530 if ( this->uMight <= pBaseValue ) | |
6531 pStep = pDroppedStep; | |
6532 if ( this->uMight - pStep >= uMinValue ) | |
6533 this->uMight -= pStep; | |
6534 break; | |
6535 case CHARACTER_INTELLIGANCE: | |
6536 if ( this->uIntelligence <= pBaseValue ) | |
6537 pStep = pDroppedStep; | |
6538 if ( this->uIntelligence - pStep >= uMinValue ) | |
6539 this->uIntelligence -= pStep; | |
6540 break; | |
6541 case CHARACTER_WILLPOWER: | |
6542 if ( this->uWillpower <= pBaseValue ) | |
6543 pStep = pDroppedStep; | |
6544 if ( this->uWillpower - pStep >= uMinValue ) | |
6545 this->uWillpower -= pStep; | |
6546 break; | |
6547 case CHARACTER_ENDURANCE: | |
6548 if ( this->uEndurance <= pBaseValue ) | |
6549 pStep = pDroppedStep; | |
6550 if ( this->uEndurance - pStep >= uMinValue ) | |
6551 this->uEndurance -= pStep; | |
6552 break; | |
6553 case CHARACTER_ACCURACY: | |
6554 if ( this->uAccuracy <= pBaseValue ) | |
6555 pStep = pDroppedStep; | |
6556 if ( this->uAccuracy - pStep >= uMinValue ) | |
6557 this->uAccuracy -= pStep; | |
6558 break; | |
6559 case CHARACTER_SPEED: | |
6560 if ( this->uSpeed <= pBaseValue ) | |
6561 pStep = pDroppedStep; | |
6562 if ( this->uSpeed - pStep >= uMinValue ) | |
6563 this->uSpeed -= pStep; | |
6564 break; | |
6565 case CHARACTER_LUCK: | |
6566 if ( this->uLuck <= pBaseValue ) | |
6567 pStep = pDroppedStep; | |
6568 if ( this->uLuck - pStep >= uMinValue ) | |
6569 this->uLuck -= pStep; | |
6570 break; | |
6571 } | |
6572 } | |
6573 | |
6574 //----- (004905F5) -------------------------------------------------------- | |
6575 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6576 int Player::IncreaseAttribute(int eAttribute) | |
6577 { | |
6578 Player *v2; // esi@1 | |
6579 int v3; // eax@1 | |
6580 int v4; // ebx@1 | |
6581 signed int v5; // edi@1 | |
6582 int v6; // eax@8 | |
6583 signed int v7; // eax@17 | |
6584 signed int result; // eax@18 | |
6585 int v9; // [sp+Ch] [bp-8h]@1 | |
6586 signed int v10; // [sp+10h] [bp-4h]@1 | |
6587 | |
6588 v2 = this; | |
6589 v3 = eAttribute + 7 * GetRace(); | |
290 | 6590 v4 = StatTable[0][v3].uMaxValue; |
6591 v5 = StatTable[0][v3].uBaseStep; | |
6592 v9 = StatTable[0][v3].uBaseValue; | |
6593 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6594 PlayerCreation_ComputeAttributeBonus(); |
6595 if ( eAttribute ) | |
6596 { | |
6597 switch ( eAttribute ) | |
6598 { | |
6599 case 1: | |
6600 v6 = v2->uIntelligence; | |
6601 break; | |
6602 case 2: | |
6603 v6 = v2->uWillpower; | |
6604 break; | |
6605 case 3: | |
6606 v6 = v2->uEndurance; | |
6607 break; | |
6608 case 4: | |
6609 v6 = v2->uAccuracy; | |
6610 break; | |
6611 case 5: | |
6612 v6 = v2->uSpeed; | |
6613 break; | |
6614 case 6: | |
6615 v6 = v2->uLuck; | |
6616 break; | |
6617 default: | |
6618 v6 = eAttribute; | |
6619 break; | |
6620 } | |
6621 } | |
6622 else | |
6623 { | |
6624 v6 = v2->uMight; | |
6625 } | |
6626 if ( v6 < v9 ) | |
6627 { | |
6628 v7 = v5; | |
6629 v5 = v10; | |
6630 v10 = v7; | |
6631 } | |
6632 result = PlayerCreation_ComputeAttributeBonus(); | |
6633 if ( result >= v10 ) | |
6634 { | |
6635 if ( eAttribute ) | |
6636 { | |
6637 switch ( eAttribute ) | |
6638 { | |
6639 case 1: | |
6640 result = (signed int)&v2->uIntelligence; | |
6641 break; | |
6642 case 2: | |
6643 result = (signed int)&v2->uWillpower; | |
6644 break; | |
6645 case 3: | |
6646 result = (signed int)&v2->uEndurance; | |
6647 break; | |
6648 case 4: | |
6649 result = (signed int)&v2->uAccuracy; | |
6650 break; | |
6651 case 5: | |
6652 result = (signed int)&v2->uSpeed; | |
6653 break; | |
6654 default: | |
6655 result = eAttribute - 6; | |
6656 if ( eAttribute != 6 ) | |
6657 return result; | |
6658 result = (signed int)&v2->uLuck; | |
6659 break; | |
6660 } | |
6661 } | |
6662 else | |
6663 { | |
6664 result = (signed int)&v2->uMight; | |
6665 } | |
6666 if ( v5 + *(short *)result <= v4 ) | |
6667 *(short *)result += v5; | |
6668 } | |
6669 return result; | |
6670 } | |
6671 | |
6672 //----- (0049070F) -------------------------------------------------------- | |
6673 void Player::Zero() | |
6674 { | |
6675 Player *v1; // esi@1 | |
6676 | |
6677 v1 = this; | |
6678 this->sLevelModifier = 0; | |
6679 this->sACModifier = 0; | |
6680 this->uLuckBonus = 0; | |
6681 this->uAccuracyBonus = 0; | |
6682 this->uSpeedBonus = 0; | |
6683 this->uEnduranceBonus = 0; | |
6684 this->uWillpowerBonus = 0; | |
6685 this->uIntelligenceBonus = 0; | |
6686 this->uMightBonus = 0; | |
6687 this->field_100 = 0; | |
6688 this->field_FC = 0; | |
6689 this->field_F8 = 0; | |
6690 this->field_F4 = 0; | |
6691 this->field_F0 = 0; | |
6692 this->field_EC = 0; | |
6693 this->field_E8 = 0; | |
6694 this->field_E4 = 0; | |
6695 this->field_E0 = 0; | |
766 | 6696 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6697 v1->field_1A97 = 0; |
6698 v1->_ranged_dmg_bonus = 0; | |
6699 v1->field_1A95 = 0; | |
6700 v1->_ranged_atk_bonus = 0; | |
6701 v1->field_1A93 = 0; | |
6702 v1->_melee_dmg_bonus = 0; | |
6703 v1->field_1A91 = 0; | |
6704 v1->_some_attack_bonus = 0; | |
6705 v1->_mana_related = 0; | |
6706 v1->uFullManaBonus = 0; | |
6707 v1->_health_related = 0; | |
6708 v1->uFullHealthBonus = 0; | |
6709 } | |
6710 | |
6711 //----- (004907E7) -------------------------------------------------------- | |
299 | 6712 unsigned int Player::GetStatColor(int uStat) |
0 | 6713 { |
6714 __int16 uWhite; // si@1 | |
290 | 6715 int attribute_value; // edx@1 |
299 | 6716 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6717 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6718 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6719 | |
1014 | 6720 uRed = TargetColor(255, 35, 0); |
6721 uGreen = TargetColor(0, 255, 0); | |
6722 uWhite = TargetColor(255, 255, 255); | |
299 | 6723 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6724 |
0 | 6725 switch (uStat) |
6726 { | |
6727 case 0: attribute_value = uMight; break; | |
6728 case 1: attribute_value = uIntelligence; break; | |
6729 case 2: attribute_value = uWillpower; break; | |
6730 case 3: attribute_value = uEndurance; break; | |
290 | 6731 case 4: attribute_value = uAccuracy; break; |
6732 case 5: attribute_value = uSpeed; break; | |
0 | 6733 case 6: attribute_value = uLuck; break; |
6734 }; | |
6735 | |
299 | 6736 if ( attribute_value == pBaseAttrValue ) |
290 | 6737 return uWhite; |
299 | 6738 else if ( attribute_value > pBaseAttrValue ) |
290 | 6739 return uGreen; |
0 | 6740 else |
290 | 6741 return uRed; |
0 | 6742 } |
6743 | |
6744 //----- (004908A8) -------------------------------------------------------- | |
6745 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6746 { | |
1014 | 6747 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6748 { | |
6749 pConditions[uCondition]=0i64; | |
6750 return true; | |
0 | 6751 } |
6752 else | |
1014 | 6753 return false; |
0 | 6754 } |
6755 | |
6756 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6757 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6758 { |
6759 Player *v3; // esi@1 | |
6760 signed int v5; // eax@17 | |
6761 int v8; // edx@39 | |
6762 char *v13; // eax@45 | |
6763 signed int v15; // edi@68 | |
6764 int v16; // edx@73 | |
6765 unsigned __int16 v17; // edi@73 | |
6766 unsigned int v18; // eax@73 | |
6767 const char *v22; // eax@84 | |
6768 int scroll_id; // esi@96 | |
6769 int v25; // eax@109 | |
6770 int v26; // eax@113 | |
6771 int new_mana_val; // edi@114 | |
6772 signed __int64 v28; // qax@120 | |
6773 __int64 v30; // edi@137 | |
6774 __int64 v32; // ST3C_4@137 | |
6775 __int64 v34; // ST34_4@137 | |
6776 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6777 const char *v66; // [sp-4h] [bp-30h]@69 | |
6778 signed int v67; // [sp-4h] [bp-30h]@77 | |
6779 const char *v68; // [sp-4h] [bp-30h]@89 | |
6780 char v72; // [sp+20h] [bp-Ch]@68 | |
6781 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6782 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6783 Player *thisb; // [sp+28h] [bp-4h]@1 |
6784 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6785 | |
6786 thisb = this; | |
6787 v3 = &pParty->pPlayers[player_num-1]; | |
6788 v73 = 1; | |
6789 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6790 return; | |
6791 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6792 { |
1021 | 6793 if ( pParty->pPickedItem.uItemID == 160 ) |
6794 { | |
6795 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6796 } | |
6797 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6798 { |
1021 | 6799 new_mana_val = v3->sMana; |
6800 new_mana_val += 2; | |
6801 if ( new_mana_val > v3->GetMaxMana() ) | |
6802 new_mana_val = v3->GetMaxMana(); | |
6803 v3->PlaySound(SPEECH_36, 0); | |
6804 } | |
6805 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6806 { | |
6807 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6808 v3->PlaySound(SPEECH_36, 0); |
1021 | 6809 |
6810 } | |
6811 else | |
6812 { | |
6813 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 6814 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
1021 | 6815 ShowStatusBarString(pTmpBuf, 2); |
6816 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
6817 return; | |
1019 | 6818 } |
1032 | 6819 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6820 | |
6821 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6822 { | |
6823 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6824 } | |
6825 if ( v73 ) | |
6826 { | |
6827 if ( pParty->bTurnBasedModeOn ) | |
6828 { | |
6829 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6830 thisb->SetRecoveryTime(100); | |
6831 pTurnEngine->_40471C(); | |
6832 } | |
6833 else | |
6834 { | |
6835 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6836 } | |
6837 } | |
6838 pMouse->RemoveHoldingItem(); | |
6839 return; | |
6840 | |
1021 | 6841 |
6842 } | |
6843 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6844 { |
1021 | 6845 switch ( pParty->pPickedItem.uItemID ) |
6846 { | |
6847 case 221: //Catalyst | |
6848 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6849 break; | |
6850 case 222: //Cure Wounds | |
6851 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6852 pParty->pPlayers[player_num-1].Heal(v25); | |
6853 v3->PlaySound(SPEECH_36, 0); | |
6854 break; | |
6855 case 223: //Magic Potion | |
6856 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6857 new_mana_val = v3->sMana; | |
6858 new_mana_val += v26; | |
6859 if ( new_mana_val > v3->GetMaxMana() ) | |
6860 new_mana_val = v3->GetMaxMana(); | |
6861 v3->PlaySound(SPEECH_36, 0); | |
6862 break; | |
6863 case 224: //Cure Weakness | |
6864 v3->pConditions[Condition_Weak] = 0i64; | |
6865 v3->PlaySound(SPEECH_36, 0); | |
6866 break; | |
6867 case 225: //Cure Disease | |
6868 v3->pConditions[Condition_Disease3] = 0i64; | |
6869 v3->pConditions[Condition_Disease2] = 0i64; | |
6870 v3->pConditions[Condition_Disease1] = 0i64; | |
6871 v3->PlaySound(SPEECH_36, 0); | |
6872 break; | |
6873 case 226: //Cure Poison | |
6874 v3->pConditions[Condition_Poison3] = 0i64; | |
6875 v3->pConditions[Condition_Poison2] = 0i64; | |
6876 v3->pConditions[Condition_Poison1] = 0i64; | |
6877 v3->PlaySound(SPEECH_36, 0); | |
6878 break; | |
6879 case 227: //Awaken | |
6880 v3->pConditions[Condition_Sleep] = 0i64; | |
6881 v3->PlaySound(SPEECH_36, 0); | |
6882 break; | |
6883 case 228: //Haste | |
6884 if ( !v3->pConditions[Condition_Weak] ) | |
6885 { | |
6886 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6887 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6888 v3->PlaySound(SPEECH_36, 0); | |
6889 } | |
6890 break; | |
6891 case 229: //Heroism | |
6892 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6893 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6894 v3->PlaySound(SPEECH_36, 0); | |
6895 break; | |
6896 case 230: //Bless | |
6897 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6898 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6899 v3->PlaySound(SPEECH_36, 0); | |
6900 break; | |
6901 case 231: //Preservation | |
1032 | 6902 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6903 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6904 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6905 v3->PlaySound(SPEECH_36, 0); | |
6906 break; | |
6907 case 232: //Shield | |
1032 | 6908 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6909 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6910 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6911 v3->PlaySound(SPEECH_36, 0); | |
6912 break; | |
6913 case 234: //Stoneskin | |
6914 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6915 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6916 v3->PlaySound(SPEECH_36, 0); | |
6917 break; | |
6918 case 235: //Water Breathing | |
6919 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6920 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6921 break; | |
6922 case 237: //Remove Fear | |
6923 v3->pConditions[Condition_Fear] = 0i64; | |
6924 v3->PlaySound(SPEECH_36, 0); | |
6925 break; | |
6926 case 238: //Remove Curse | |
6927 v3->pConditions[Condition_Cursed] = 0i64; | |
6928 v3->PlaySound(SPEECH_36, 0); | |
6929 break; | |
6930 case 239: //Cure Insanity | |
6931 v3->pConditions[Condition_Insane] = 0i64; | |
6932 v3->PlaySound(SPEECH_36, 0); | |
6933 break; | |
6934 case 240: //Might Boost | |
1032 | 6935 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6936 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6937 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6938 v3->PlaySound(SPEECH_36, 0); | |
6939 break; | |
6940 case 241: //Intellect Boost | |
1032 | 6941 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6942 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6943 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6944 v3->PlaySound(SPEECH_36, 0); | |
6945 break; | |
6946 case 242: //Personality Boost | |
1032 | 6947 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6948 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6949 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6950 v3->PlaySound(SPEECH_36, 0); | |
6951 break; | |
6952 case 243://Endurance Boost | |
1032 | 6953 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6954 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6955 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6956 v3->PlaySound(SPEECH_36, 0); | |
6957 break; | |
6958 case 244: //Speed Boost | |
1032 | 6959 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6960 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6961 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6962 v3->PlaySound(SPEECH_36, 0); | |
6963 break; | |
6964 case 245: //Accuracy Boost | |
1032 | 6965 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6966 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6967 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6968 v3->PlaySound(SPEECH_36, 0); | |
6969 break; | |
6970 case 251: //Cure Paralysis | |
6971 v3->pConditions[Condition_Paralyzed] = 0i64; | |
6972 v3->PlaySound(SPEECH_36, 0); | |
6973 break; | |
6974 case 252://Divine Restoration | |
6975 v30 = v3->pConditions[Condition_Dead]; | |
6976 v32 = v3->pConditions[Condition_Pertified]; | |
6977 v34 = v3->pConditions[Condition_Eradicated]; | |
6978 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
6979 v3->pConditions[Condition_Dead] = v30; | |
6980 v3->pConditions[Condition_Pertified] = v32; | |
6981 v3->pConditions[Condition_Eradicated] = v34; | |
6982 v3->PlaySound(SPEECH_36, 0); | |
6983 break; | |
6984 case 253: //Divine Cure | |
6985 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6986 pParty->pPlayers[player_num-1].Heal(v25); | |
6987 v3->PlaySound(SPEECH_36, 0); | |
6988 break; | |
6989 case 254: //Divine Power | |
6990 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6991 new_mana_val = v3->sMana; | |
6992 new_mana_val += v26; | |
6993 if ( new_mana_val > v3->GetMaxMana() ) | |
6994 new_mana_val = v3->GetMaxMana(); | |
6995 v3->PlaySound(SPEECH_36, 0); | |
6996 break; | |
6997 case 255: //Luck Boost | |
1032 | 6998 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6999 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7000 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7001 v3->PlaySound(SPEECH_36, 0); | |
7002 break; | |
7003 case 256: //Fire Resistance | |
1032 | 7004 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7005 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7006 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7007 v3->PlaySound(SPEECH_36, 0); | |
1032 | 7008 break; |
1021 | 7009 case 257: //Air Resistance |
1032 | 7010 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7011 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7012 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7013 v3->PlaySound(SPEECH_36, 0); | |
7014 break; | |
7015 case 258: //Water Resistance | |
1032 | 7016 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7017 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7018 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7019 v3->PlaySound(SPEECH_36, 0); | |
7020 break; | |
7021 case 259: //Earth Resistance | |
1032 | 7022 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7023 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7024 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7025 v3->PlaySound(SPEECH_36, 0); | |
7026 break; | |
7027 case 260: //Mind Resistance | |
1032 | 7028 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7029 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7030 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7031 v3->PlaySound(SPEECH_36, 0); | |
7032 break; | |
7033 case 261: //Body Resistance | |
1032 | 7034 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 7035 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
7036 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
7037 v3->PlaySound(SPEECH_36, 0); | |
7038 break; | |
7039 case 262: //Stone to Flesh | |
7040 v3->pConditions[Condition_Pertified] = 0i64; | |
7041 v3->PlaySound(SPEECH_36, 0); | |
7042 break; | |
7043 case 264: //Pure Luck | |
7044 if ( !v3->pure_luck_used ) | |
7045 { | |
7046 v3->uLuck += 50; | |
7047 v3->pure_luck_used = 1; | |
7048 } | |
7049 v3->PlaySound(SPEECH_36, 0); | |
7050 break; | |
7051 case 265: //Pure Speed | |
7052 if ( !v3->pure_speed_used ) | |
7053 { | |
7054 v3->uSpeed += 50; | |
7055 v3->pure_speed_used = 1; | |
7056 } | |
7057 v3->PlaySound(SPEECH_36, 0); | |
7058 break; | |
7059 case 266: //Pure Intellect | |
7060 if ( !v3->pure_intellect_used ) | |
7061 { | |
7062 v3->uIntelligence += 50; | |
7063 v3->pure_intellect_used = 1; | |
7064 } | |
7065 v3->PlaySound(SPEECH_36, 0); | |
7066 break; | |
7067 case 267: //Pure Endurance | |
7068 if ( !v3->pure_endurance_used ) | |
7069 { | |
7070 v3->uEndurance += 50; | |
7071 v3->pure_endurance_used = 1; | |
7072 } | |
7073 v3->PlaySound(SPEECH_36, 0); | |
7074 break; | |
7075 case 268: //Pure Personality | |
7076 if ( !v3->pure_willpower_used ) | |
7077 { | |
7078 v3->uWillpower += 50; | |
7079 v3->pure_willpower_used = 1; | |
7080 } | |
7081 v3->PlaySound(SPEECH_36, 0); | |
7082 break; | |
7083 case 269: //Pure Accuracy | |
7084 if ( !v3->pure_accuracy_used ) | |
7085 { | |
7086 v3->uAccuracy += 50; | |
7087 v3->pure_accuracy_used = 1; | |
7088 } | |
7089 v3->PlaySound(SPEECH_36, 0); | |
7090 break; | |
7091 case 270: //Pure Might | |
7092 if ( !v3->pure_might_used ) | |
7093 { | |
7094 v3->uMight += 50; | |
7095 v3->pure_might_used = 1; | |
7096 } | |
7097 v3->PlaySound(SPEECH_36, 0); | |
7098 break; | |
7099 case 271: //Rejuvenation | |
7100 v3->sAgeModifier = 0; | |
7101 v3->PlaySound(SPEECH_36, 0); | |
7102 break; | |
7103 | |
7104 default: | |
7105 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7106 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
1021 | 7107 ShowStatusBarString(pTmpBuf, 2u); |
7108 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
7109 return; | |
1032 | 7110 } |
7111 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
7112 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7113 { | |
7114 if ( !v73 ) | |
7115 { | |
7116 pMouse->RemoveHoldingItem(); | |
7117 return; | |
7118 } | |
7119 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 7120 } |
1032 | 7121 if ( v73 ) |
7122 { | |
7123 if ( pParty->bTurnBasedModeOn ) | |
7124 { | |
7125 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7126 thisb->SetRecoveryTime(100); | |
7127 pTurnEngine->_40471C(); | |
7128 } | |
7129 else | |
7130 { | |
7131 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7132 } | |
7133 } | |
7134 pMouse->RemoveHoldingItem(); | |
7135 return; | |
7136 | |
1021 | 7137 } |
7138 | |
7139 | |
7140 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
7141 { | |
7142 | |
7143 | |
7144 if ( pCurrentScreen == SCREEN_CASTING ) | |
7145 return; | |
7146 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7147 { | |
7148 | |
7149 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7150 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); |
7151 ShowStatusBarString(pTmpBuf, 2u); | |
7152 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7153 return; |
7154 } | |
7155 if ( bUnderwater == 1 ) | |
7156 { | |
1032 | 7157 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
7158 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7159 return; |
7160 } | |
7161 dword_50C9AC = 1; | |
7162 scroll_id = pParty->pPickedItem.uItemID - 299; | |
7163 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
7164 { | |
7165 pMouse->RemoveHoldingItem(); | |
7166 pGUIWindow_CurrentMenu->Release(); | |
7167 pIcons_LOD->_4114F2(); | |
7168 pCurrentScreen = SCREEN_GAME; | |
7169 viewparams->bRedrawGameUI = 1; | |
7170 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7171 } | |
7172 else | |
7173 { | |
7174 _720984_unused = pParty->pPickedItem.uItemID; | |
7175 pMouse->RemoveHoldingItem(); | |
7176 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7177 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7178 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7179 { | |
7180 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7181 } | |
7182 } | |
7183 return; | |
7184 } | |
7185 | |
7186 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7187 | |
7188 { | |
7189 v15 = pParty->pPickedItem.uItemID - 400; | |
7190 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7191 if ( v72 ) | |
7192 { | |
7193 v66 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7194 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell" |
1021 | 7195 ShowStatusBarString(pTmpBuf, 2u); |
1032 | 7196 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7197 return; |
7198 } | |
7199 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7200 { | |
7201 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7202 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s" |
1021 | 7203 ShowStatusBarString(pTmpBuf, 2u); |
1032 | 7204 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7205 return; |
7206 } | |
7207 v16 = v15 % 11 + 1; | |
7208 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7209 v18 = SkillToMastery(v17) - 1; | |
1032 | 7210 switch (v18) |
7211 { | |
7212 case 0: v67 = 4; break; | |
7213 case 1: v67 = 7; break; | |
7214 case 2: v67 = 10; break; | |
7215 case 3: v67 = 11; break; | |
7216 default: | |
7217 v67 = player_num; | |
7218 } | |
7219 | |
7220 if ( v16 > v67 || !v17 ) | |
1021 | 7221 { |
1032 | 7222 v22 = pParty->pPickedItem.GetDisplayName(); |
7223 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s" | |
7224 ShowStatusBarString(pTmpBuf, 2u); | |
7225 v3->PlaySound((PlayerSpeech)20, 0); | |
7226 return; | |
7227 } | |
7228 // v72 = 1; | |
7229 v3->PlaySound(SPEECH_21, 0); | |
7230 v73 = 0; | |
7231 | |
7232 | |
7233 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7234 { | |
7235 if ( !v73 ) | |
1021 | 7236 { |
1032 | 7237 pMouse->RemoveHoldingItem(); |
7238 return; | |
7239 } | |
7240 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7241 } | |
7242 if ( v73 ) | |
7243 { | |
7244 if ( pParty->bTurnBasedModeOn ) | |
7245 { | |
7246 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7247 thisb->SetRecoveryTime(100); | |
7248 pTurnEngine->_40471C(); | |
1021 | 7249 } |
7250 else | |
7251 { | |
1032 | 7252 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7253 } |
7254 } | |
1032 | 7255 pMouse->RemoveHoldingItem(); |
7256 return; | |
7257 | |
1021 | 7258 } |
7259 | |
7260 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7261 | |
7262 { | |
7263 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7264 { | |
7265 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7266 v3->PlaySound(SPEECH_37, 0); |
1021 | 7267 return; |
7268 } | |
7269 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1032 | 7270 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); |
7271 ShowStatusBarString(pTmpBuf, 2u); | |
7272 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7273 return; |
7274 } | |
7275 else | |
7276 { | |
1019 | 7277 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7278 { |
7279 thisa = pParty->uCurrentMonthWeek + 1; | |
7280 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7281 v74 = NULL; |
1021 | 7282 else |
7283 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7284 switch ( pParty->uCurrentMonth ) | |
7285 { | |
1019 | 7286 case 0: |
1021 | 7287 v3->uMight += thisa; |
1032 | 7288 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7289 break; |
1019 | 7290 case 1: |
1021 | 7291 v3->uIntelligence += thisa; |
1032 | 7292 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7293 break; |
1019 | 7294 case 2: |
1021 | 7295 v3->uWillpower += thisa; |
1032 | 7296 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7297 break; |
1019 | 7298 case 3: |
1021 | 7299 v3->uEndurance += thisa; |
1032 | 7300 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7301 break; |
1019 | 7302 case 4: |
1021 | 7303 v3->uAccuracy += thisa; |
1032 | 7304 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7305 break; |
1019 | 7306 case 5: |
1021 | 7307 v3->uSpeed += thisa; |
1032 | 7308 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7309 break; |
1019 | 7310 case 6: |
1021 | 7311 v3->uLuck += thisa; |
1032 | 7312 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7313 break; |
1019 | 7314 case 7: |
1021 | 7315 party_finds_gold(1000 * thisa, 0); |
1032 | 7316 sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7317 break; |
1019 | 7318 case 8: |
1021 | 7319 Party::GiveFood(5 * thisa); |
1032 | 7320 sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7321 break; |
0 | 7322 case 9u: |
1021 | 7323 v3->uSkillPoints += 2 * thisa; |
1032 | 7324 sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7325 break; |
1019 | 7326 case 10: |
1021 | 7327 v3->uExperience += 2500 * thisa; |
1032 | 7328 sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7329 break; |
1019 | 7330 case 11: |
1021 | 7331 v8 = rand() % 6; |
7332 switch (v8) | |
7333 { | |
7334 case 0: | |
7335 v3->sResFireBase += thisa; | |
7336 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7337 break; | |
7338 case 1: | |
7339 v3->sResAirBase += thisa; | |
7340 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7341 break; | |
7342 case 2: | |
7343 v3->sResWaterBase += thisa; | |
7344 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7345 break; | |
7346 case 3: | |
7347 v3->sResEarthBase += thisa; | |
7348 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7349 break; | |
7350 case 4: | |
7351 v3->sResMindBase += thisa; | |
7352 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7353 break; | |
7354 case 5: | |
7355 v3->sResBodyBase += thisa; | |
7356 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7357 break; |
1021 | 7358 } |
1032 | 7359 sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7360 break; |
7361 | |
7362 } | |
7363 ShowStatusBarString(pTmpBuf, 2u); | |
7364 pMouse->RemoveHoldingItem(); | |
7365 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7366 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7367 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7368 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7369 { |
1021 | 7370 v3->SetCondition(Condition_Eradicated, 0); |
7371 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7372 } |
1021 | 7373 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7374 { | |
7375 v3->SetCondition(Condition_Dead, 0); | |
7376 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7377 } | |
7378 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7379 { | |
7380 v3->SetCondition(Condition_Pertified, 0); | |
7381 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7382 } | |
1019 | 7383 return; |
1021 | 7384 } |
7385 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7386 { | |
7387 Party::GiveFood(1u); | |
7388 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7389 | |
7390 } | |
7391 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7392 { | |
7393 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7394 return; | |
7395 } | |
7396 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7397 { | |
7398 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7399 return; | |
7400 } | |
7401 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7402 { | |
7403 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7404 return; | |
7405 } | |
1032 | 7406 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7407 { |
7408 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7409 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7410 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7411 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7412 } | |
7413 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7414 { | |
7415 sub_44C28F_open_nwc_dungeon(); | |
7416 return; | |
7417 } | |
0 | 7418 else |
1021 | 7419 { |
7420 | |
7421 v68 = pParty->pPickedItem.GetDisplayName(); | |
1032 | 7422 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way" |
7423 ShowStatusBarString(pTmpBuf, 2u); | |
7424 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7425 return; |
7426 } | |
1032 | 7427 |
0 | 7428 pMouse->RemoveHoldingItem(); |
7429 return; | |
7430 } | |
1021 | 7431 |
7432 } | |
0 | 7433 |
7434 | |
7435 | |
7436 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7437 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7438 { |
0 | 7439 Player *v3; // esi@1 |
7440 signed int v4; // edi@1 | |
7441 unsigned int v5; // eax@8 | |
7442 int v6; // eax@9 | |
7443 enum CHARACTER_RACE v7; // eax@11 | |
7444 signed int v8; // eax@17 | |
7445 unsigned __int8 v9; // sf@17 | |
7446 unsigned __int8 v10; // of@17 | |
7447 int v11; // eax@19 | |
7448 unsigned int v12; // eax@20 | |
484 | 7449 unsigned int test_bit_value; // eax@25 |
7450 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7451 signed int v15; // ecx@28 |
7452 ItemGen *v16; // eax@28 | |
7453 char v17; // zf@31 | |
7454 int v18; // edi@90 | |
7455 DDM_DLV_Header *v19; // eax@122 | |
7456 char v20; // cl@124 | |
7457 DDM_DLV_Header *v21; // eax@126 | |
7458 unsigned int v22; // edi@129 | |
100 | 7459 Player *v23; // esi@134 |
0 | 7460 ItemGen *v24; // ecx@135 |
7461 signed int v25; // edx@135 | |
7462 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7463 char *v27; // edi@155 | |
7464 int v28; // ebx@161 | |
7465 int v29; // eax@161 | |
7466 | |
469 | 7467 v6 = 0; |
0 | 7468 v3 = this; |
7469 v4 = -1; | |
469 | 7470 if ( VarNum > VAR_AutoNotes ) |
7471 { | |
7472 switch ( VarNum ) | |
0 | 7473 { |
7474 case VAR_Invisible: | |
484 | 7475 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7476 return true; |
484 | 7477 return false; |
0 | 7478 case VAR_NumDeaths: |
7479 v4 = pParty->uNumDeaths; | |
469 | 7480 return v4 >= pValue; |
0 | 7481 case VAR_NumBounties: |
7482 v4 = pParty->uNumBountiesCollected; | |
469 | 7483 return v4 >= pValue; |
0 | 7484 case VAR_PrisonTerms: |
7485 v4 = pParty->uNumPrisonTerms; | |
469 | 7486 return v4 >= pValue; |
0 | 7487 case VAR_ArenaWinsPage: |
7488 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7489 return v4 >= pValue; |
0 | 7490 case VAR_ArenaWinsSquire: |
7491 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7492 return v4 >= pValue; |
0 | 7493 case VAR_ArenaWinsKnight: |
7494 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7495 return v4 >= pValue; |
0 | 7496 case VAR_ArenaWinsLord: |
7497 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7498 return v4 >= pValue; |
0 | 7499 case VAR_ReputationInCurrentLocation: |
7500 v19 = &pOutdoor->ddm; | |
7501 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7502 v19 = &pIndoor->dlv; | |
469 | 7503 v6 = v19->uReputation >= pValue; |
7504 return v6; | |
0 | 7505 case VAR_History_28|VAR_Sex: |
7506 v21 = &pOutdoor->ddm; | |
7507 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7508 v21 = &pIndoor->dlv; | |
469 | 7509 v6 = v21->field_C_alert == pValue; |
0 | 7510 return v6; |
7511 case VAR_MonthEquals2|VAR_Sex: | |
7512 case VAR_MonthEquals2|VAR_Class: | |
7513 case VAR_Counter1: | |
7514 case VAR_Counter2: | |
7515 case VAR_Counter3: | |
7516 case VAR_Counter4: | |
7517 case VAR_Counter5: | |
7518 case VAR_Counter6: | |
7519 case VAR_Counter7: | |
7520 case VAR_Counter8: | |
469 | 7521 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7522 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7523 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7524 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7525 return true; | |
7526 return false; | |
0 | 7527 case VAR_NumSkillPoints: |
7528 v4 = this->uSkillPoints; | |
469 | 7529 return v4 >= pValue; |
0 | 7530 case VAR_CircusPrises: |
7531 v4 = 0; | |
100 | 7532 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7533 do |
7534 { | |
469 | 7535 v24 = v23->pInventoryItems; |
0 | 7536 v25 = 138; |
7537 do | |
7538 { | |
7539 switch ( v24->uItemID ) | |
7540 { | |
7541 case 0x1D6u: | |
7542 ++v4; | |
7543 break; | |
7544 case 0x1D7u: | |
7545 v4 += 3; | |
7546 break; | |
7547 case 0x1DDu: | |
7548 v4 += 5; | |
7549 break; | |
7550 } | |
7551 ++v24; | |
7552 --v25; | |
7553 } | |
7554 while ( v25 ); | |
100 | 7555 ++v23; |
0 | 7556 } |
100 | 7557 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7558 return v4 >= pValue; |
0 | 7559 case VAR_MonthEquals2: |
469 | 7560 v6 = pParty->uCurrentMonth == pValue; |
7561 return v6; | |
0 | 7562 case VAR_IsFlying: |
7563 if ( pParty->bFlying | |
484 | 7564 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7565 return true; |
7566 return false; | |
0 | 7567 case VAR_HiredNPCHasSpeciality: |
469 | 7568 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7569 return v6; |
7570 case VAR_NPCs2: | |
469 | 7571 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7572 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7573 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7574 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7575 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7576 return v4 >= pValue; |
7577 v4 = pValue; | |
7578 return v4 >= pValue; | |
0 | 7579 case VAR_ItemEquipped: |
7580 v26 = (ITEM_EQUIP_TYPE)0; | |
7581 v27 = (char *)&this->pEquipment; | |
7582 break; | |
7583 case VAR_GoldInBank: | |
7584 v4 = pParty->uNumGoldInBank; | |
469 | 7585 return v4 >= pValue; |
0 | 7586 case VAR_ThieverySkill|0x80: |
7587 v28 = GetActualMight(); | |
7588 v29 = v3->GetBaseStrength(); | |
7589 goto LABEL_168; | |
7590 case VAR_DisarmTrapSkill|0x80: | |
7591 v28 = GetActualIntelligence(); | |
7592 v29 = v3->GetBaseIntelligence(); | |
7593 goto LABEL_168; | |
7594 case VAR_MonthEquals: | |
7595 v28 = GetActualWillpower(); | |
7596 v29 = v3->GetBaseWillpower(); | |
7597 goto LABEL_168; | |
7598 case VAR_MonthEquals|VAR_Sex: | |
7599 v28 = GetActualEndurance(); | |
7600 v29 = v3->GetBaseEndurance(); | |
7601 goto LABEL_168; | |
7602 case VAR_IdentifyMonsterSkill|0x80: | |
7603 v28 = GetActualSpeed(); | |
7604 v29 = v3->GetBaseSpeed(); | |
7605 goto LABEL_168; | |
7606 case VAR_ArmsmasterSkill|0x80: | |
7607 v28 = GetActualAccuracy(); | |
7608 v29 = v3->GetBaseAccuracy(); | |
7609 goto LABEL_168; | |
7610 case VAR_MonthEquals|VAR_MaxHP: | |
7611 v28 = GetActualLuck(); | |
7612 v29 = v3->GetBaseLuck(); | |
7613 LABEL_168: | |
7614 v10 = __OFSUB__(v28, v29); | |
7615 v9 = v28 - v29 < 0; | |
7616 LABEL_169: | |
7617 if ( v9 ^ v10 ) | |
469 | 7618 return v4 >= pValue; |
7619 return true; | |
0 | 7620 default: |
469 | 7621 return v4 >= pValue; |
0 | 7622 } |
7623 while ( !v3->HasItemEquipped(v26) | |
654 | 7624 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7625 { |
7626 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7627 v27 += 4; | |
7628 if ( (signed int)v26 >= 16 ) | |
469 | 7629 return false; |
7630 } | |
7631 return true; | |
7632 } | |
7633 if ( VarNum == VAR_AutoNotes ) | |
0 | 7634 { |
1033 | 7635 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7636 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7637 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7638 return false; | |
7639 return true; | |
469 | 7640 } |
7641 if ( VarNum <= VAR_BaseLuck ) | |
7642 { | |
7643 if ( VarNum != VAR_BaseLuck ) | |
7644 { | |
7645 switch ( VarNum ) | |
0 | 7646 { |
7647 case VAR_Hour: | |
469 | 7648 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7649 return true; | |
7650 return false; | |
0 | 7651 case VAR_DayOfYear: |
469 | 7652 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7653 v6 = v5 == pValue; | |
7654 return v6; | |
0 | 7655 case VAR_DayOfWeek: |
469 | 7656 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7657 v6 = v5 == pValue; | |
0 | 7658 return v6; |
7659 case VAR_Sex: | |
469 | 7660 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7661 return true; | |
7662 return v4 >= pValue; | |
0 | 7663 case VAR_Class: |
135 | 7664 v7 = (CHARACTER_RACE)this->classType; |
469 | 7665 if ( pValue == v7 ) |
7666 return true; | |
7667 return v4 >= pValue; | |
0 | 7668 case VAR_Race: |
7669 v7 = GetRace(); | |
469 | 7670 if ( pValue == v7 ) |
7671 return true; | |
7672 return v4 >= pValue; | |
0 | 7673 case VAR_CurrentHP: |
7674 v4 = this->sHealth; | |
469 | 7675 return v4 >= pValue; |
0 | 7676 case VAR_MaxHP: |
7677 v8 = GetMaxHealth(); | |
7678 v10 = __OFSUB__(v3->sHealth, v8); | |
7679 v9 = v3->sHealth - v8 < 0; | |
7680 goto LABEL_169; | |
7681 case VAR_CurrentSP: | |
7682 v4 = this->sMana; | |
469 | 7683 return v4 >= pValue; |
0 | 7684 case VAR_MaxSP: |
7685 v11 = GetMaxMana(); | |
7686 v10 = __OFSUB__(v3->sMana, v11); | |
7687 v9 = v3->sMana - v11 < 0; | |
7688 goto LABEL_169; | |
7689 case VAR_ActualAC: | |
7690 v12 = GetActualAC(); | |
7691 goto _j_cmp_against_arg; | |
7692 case VAR_ACModifier: | |
7693 v4 = this->sACModifier; | |
469 | 7694 return v4 >= pValue; |
0 | 7695 case VAR_BaseLevel: |
7696 v4 = this->uLevel; | |
469 | 7697 return v4 >= pValue; |
0 | 7698 case VAR_LevelModifier: |
7699 v4 = this->sLevelModifier; | |
469 | 7700 return v4 >= pValue; |
0 | 7701 case VAR_Age: |
7702 v12 = GetActualAge(); | |
7703 goto _j_cmp_against_arg; | |
7704 case VAR_Award: | |
1033 | 7705 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7706 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7707 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7708 return true; | |
7709 return false; | |
0 | 7710 case VAR_Experience: |
7711 v4 = LODWORD(this->uExperience); | |
469 | 7712 return v4 >= pValue; |
0 | 7713 case VAR_QBits_QuestsDone: |
484 | 7714 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7715 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7716 if ( test_bit_value & our_bit_value ) | |
478 | 7717 return true; |
7718 return false; | |
0 | 7719 case VAR_PlayerItemInHands: |
7720 v15 = 0; | |
7721 v16 = v3->pInventoryItems; | |
7722 break; | |
7723 case VAR_FixedGold: | |
7724 v4 = pParty->uNumGold; | |
469 | 7725 return v4 >= pValue; |
0 | 7726 case VAR_MightBonus: |
7727 v4 = this->uMightBonus; | |
469 | 7728 return v4 >= pValue; |
0 | 7729 case VAR_IntellectBonus: |
7730 v4 = this->uIntelligenceBonus; | |
469 | 7731 return v4 >= pValue; |
0 | 7732 case VAR_PersonalityBonus: |
7733 v4 = this->uWillpowerBonus; | |
469 | 7734 return v4 >= pValue; |
0 | 7735 case VAR_EnduranceBonus: |
7736 v4 = this->uEnduranceBonus; | |
469 | 7737 return v4 >= pValue; |
0 | 7738 case VAR_SpeedBonus: |
7739 v4 = this->uSpeedBonus; | |
469 | 7740 return v4 >= pValue; |
0 | 7741 case VAR_AccuracyBonus: |
7742 v4 = this->uAccuracyBonus; | |
469 | 7743 return v4 >= pValue; |
0 | 7744 case VAR_LuckBonus: |
7745 v4 = this->uLuckBonus; | |
469 | 7746 return v4 >= pValue; |
0 | 7747 case VAR_BaseMight: |
7748 v4 = this->uMight; | |
469 | 7749 return v4 >= pValue; |
0 | 7750 case VAR_BaseIntellect: |
7751 v4 = this->uIntelligence; | |
469 | 7752 return v4 >= pValue; |
0 | 7753 case VAR_BasePersonality: |
7754 v4 = this->uWillpower; | |
469 | 7755 return v4 >= pValue; |
0 | 7756 case VAR_BaseEndurance: |
7757 v4 = this->uEndurance; | |
469 | 7758 return v4 >= pValue; |
0 | 7759 case VAR_BaseSpeed: |
7760 v4 = this->uSpeed; | |
469 | 7761 return v4 >= pValue; |
0 | 7762 case VAR_BaseAccuracy: |
7763 v4 = this->uAccuracy; | |
469 | 7764 return v4 >= pValue; |
0 | 7765 case VAR_FixedFood: |
7766 v4 = pParty->uNumFoodRations; | |
469 | 7767 return v4 >= pValue; |
0 | 7768 default: |
469 | 7769 return v4 >= pValue; |
7770 } | |
7771 while ( v16->uItemID != pValue ) | |
0 | 7772 { |
7773 ++v15; | |
7774 ++v16; | |
7775 if ( v15 >= 138 ) | |
7776 { | |
469 | 7777 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7778 return v6; |
7779 } | |
7780 } | |
469 | 7781 return true; |
0 | 7782 } |
7783 v4 = this->uLuck; | |
469 | 7784 return v4 >= pValue; |
7785 } | |
7786 if ( VarNum <= VAR_MagicResistance ) | |
7787 { | |
7788 if ( VarNum == VAR_MagicResistance ) | |
0 | 7789 { |
7790 v4 = this->sResMagicBase; | |
7791 } | |
7792 else | |
7793 { | |
469 | 7794 switch ( VarNum ) |
0 | 7795 { |
7796 case VAR_FireResistance: | |
7797 v4 = this->sResFireBase; | |
469 | 7798 return v4 >= pValue; |
0 | 7799 case VAR_AirResistance: |
7800 v4 = this->sResAirBase; | |
469 | 7801 return v4 >= pValue; |
0 | 7802 case VAR_WaterResistance: |
7803 v4 = this->sResWaterBase; | |
469 | 7804 return v4 >= pValue; |
0 | 7805 case VAR_EarthResistance: |
7806 v4 = this->sResEarthBase; | |
469 | 7807 return v4 >= pValue; |
0 | 7808 case VAR_SpiritResistance: |
7809 v4 = this->sResSpiritBase; | |
469 | 7810 return v4 >= pValue; |
0 | 7811 case VAR_MindResistance: |
7812 v4 = this->sResMindBase; | |
469 | 7813 return v4 >= pValue; |
0 | 7814 case VAR_BodyResistance: |
7815 v4 = this->sResBodyBase; | |
469 | 7816 return v4 >= pValue; |
0 | 7817 case VAR_LightResistance: |
7818 v4 = this->sResLightBase; | |
469 | 7819 return v4 >= pValue; |
0 | 7820 case VAR_DarkResistance: |
7821 v4 = this->sResDarkBase; | |
469 | 7822 return v4 >= pValue; |
0 | 7823 case VAR_ActualMight: |
7824 v12 = GetActualMight(); | |
7825 goto _j_cmp_against_arg; | |
7826 case VAR_ActualIntellect: | |
7827 v12 = GetActualIntelligence(); | |
7828 goto _j_cmp_against_arg; | |
7829 case VAR_ActualPersonality: | |
7830 v12 = GetActualWillpower(); | |
7831 goto _j_cmp_against_arg; | |
7832 case VAR_ActualEndurance: | |
7833 v12 = GetActualEndurance(); | |
7834 goto _j_cmp_against_arg; | |
7835 case VAR_ActualSpeed: | |
7836 v12 = GetActualSpeed(); | |
7837 goto _j_cmp_against_arg; | |
7838 case VAR_ActualAccuracy: | |
7839 v12 = GetActualAccuracy(); | |
7840 goto _j_cmp_against_arg; | |
7841 case VAR_ActualLuck: | |
7842 v12 = GetActualLuck(); | |
7843 _j_cmp_against_arg: | |
7844 v4 = v12; | |
7845 break; | |
7846 default: | |
469 | 7847 return v4 >= pValue; |
7848 } | |
7849 } | |
7850 return v4 >= pValue; | |
7851 } | |
7852 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7853 { | |
7854 if ( VarNum != VAR_DisarmTrapSkill ) | |
7855 { | |
7856 if ( VarNum <= VAR_MindResistanceBonus ) | |
7857 { | |
7858 switch ( VarNum ) | |
0 | 7859 { |
7860 case VAR_MindResistanceBonus: | |
7861 v4 = this->sResMindBonus; | |
7862 break; | |
7863 case VAR_FireResistanceBonus: | |
7864 v4 = this->sResFireBonus; | |
7865 break; | |
7866 case VAR_AirResistanceBonus: | |
7867 v4 = this->sResAirBonus; | |
7868 break; | |
7869 case VAR_WaterResistanceBonus: | |
7870 v4 = this->sResWaterBonus; | |
7871 break; | |
7872 case VAR_EarthResistanceBonus: | |
7873 v4 = this->sResEarthBonus; | |
7874 break; | |
7875 case VAR_SpiritResistanceBonus: | |
7876 v4 = this->sResSpiritBonus; | |
7877 break; | |
7878 } | |
469 | 7879 return v4 >= pValue; |
7880 } | |
7881 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7882 { |
7883 v4 = this->sResBodyBonus; | |
469 | 7884 return v4 >= pValue; |
7885 } | |
7886 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7887 { |
7888 v4 = this->sResLightBonus; | |
469 | 7889 return v4 >= pValue; |
7890 } | |
7891 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7892 { |
7893 v4 = this->sResDarkBonus; | |
469 | 7894 return v4 >= pValue; |
7895 } | |
7896 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7897 { |
7898 v4 = this->sResMagicBonus; | |
469 | 7899 return v4 >= pValue; |
7900 } | |
7901 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7902 return v4 >= pValue; | |
0 | 7903 } |
7904 LABEL_90: | |
469 | 7905 v18 = *((short *)&this->pConditions[16] + VarNum); |
7906 if ( pValue <= 63 ) | |
0 | 7907 v4 = v18 & 0x3F; |
7908 else | |
469 | 7909 v4 = pValue & v18; |
7910 return v4 >= pValue; | |
7911 } | |
7912 if ( VarNum == 104 ) | |
0 | 7913 goto LABEL_90; |
469 | 7914 if ( (signed int)VarNum <= 104 ) |
7915 return v4 >= pValue; | |
7916 if ( (signed int)VarNum > 0x79 ) | |
7917 { | |
7918 if ( VarNum != 122 ) | |
7919 { | |
7920 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7921 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7922 return v4 >= pValue; | |
0 | 7923 } |
7924 v4 = GetMajorConditionIdx(); | |
7925 if ( v4 != 18 ) | |
7926 { | |
469 | 7927 return v4 >= pValue; |
7928 } | |
7929 v4 = pValue; | |
7930 return v4 >= pValue; | |
7931 } | |
7932 return *((int *)this + 2 * VarNum - 210); | |
0 | 7933 } |
7934 | |
7935 | |
7936 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 7937 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7938 { | |
7939 signed int currPlayerId; // ebx@1 | |
0 | 7940 Player *v4; // esi@1 |
7941 unsigned int v5; // edi@1 | |
7942 unsigned int v6; // esi@13 | |
7943 unsigned int v7; // esi@14 | |
7944 signed int v8; // eax@17 | |
7945 ItemGen *v9; // ecx@17 | |
7946 int v10; // eax@21 | |
7947 signed int v11; // eax@30 | |
7948 Player *v12; // ecx@44 | |
7949 char *v13; // ecx@45 | |
7950 Player *v14; // ecx@49 | |
7951 int v15; // ecx@86 | |
7952 int v16; // esi@106 | |
7953 char v17; // al@106 | |
7954 int v18; // eax@107 | |
7955 Player *v19; // ecx@112 | |
7956 Player *v20; // ecx@127 | |
7957 int v21; // eax@127 | |
7958 int v22; // eax@145 | |
7959 char v23; // zf@146 | |
7960 DDM_DLV_Header *v24; // ecx@148 | |
7961 signed int v25; // eax@172 | |
7962 int v26; // [sp-8h] [bp-3Ch]@84 | |
7963 signed int v27; // [sp-4h] [bp-38h]@4 | |
7964 int v28; // [sp-4h] [bp-38h]@84 | |
7965 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
7966 char v30; // [sp+32h] [bp-2h]@1 | |
7967 char v31; // [sp+33h] [bp-1h]@1 | |
7968 | |
492 | 7969 currPlayerId = 0; |
0 | 7970 v30 = 0; |
7971 v31 = 0; | |
7972 v4 = this; | |
7973 v5 = 0; | |
7974 if ( this == pPlayers[2] ) | |
492 | 7975 currPlayerId = 1; |
7976 else if ( this == pPlayers[3] ) | |
7977 currPlayerId = 2; | |
757 | 7978 else if ( this == pPlayers[4] ) |
492 | 7979 currPlayerId = 3; |
7980 if ( var_type > VAR_AutoNotes ) | |
7981 { | |
7982 if ( var_type <= VAR_GoldInBank ) | |
7983 { | |
7984 if ( var_type == VAR_GoldInBank ) | |
7985 { | |
7986 pParty->uNumGoldInBank = var_value; | |
0 | 7987 return; |
7988 } | |
492 | 7989 if ( var_type <= VAR_Counter8 ) |
7990 { | |
7991 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7992 { |
492 | 7993 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7994 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7995 } |
7996 else | |
7997 { | |
492 | 7998 switch ( var_type ) |
0 | 7999 { |
8000 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8001 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8002 break; |
8003 case VAR_NPCs2: | |
8004 pParty->field_709 = 0; | |
492 | 8005 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8006 Party__CountHirelings(); |
0 | 8007 viewparams->bRedrawGameUI = 1; |
8008 break; | |
8009 case VAR_NumSkillPoints: | |
492 | 8010 this->uSkillPoints = var_value; |
0 | 8011 break; |
8012 } | |
8013 } | |
8014 return; | |
8015 } | |
492 | 8016 if ( var_type < VAR_Counter9 ) |
0 | 8017 return; |
492 | 8018 if ( (signed int)var_type <= 0x112 ) |
8019 { | |
8020 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8021 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8022 } |
8023 else | |
8024 { | |
492 | 8025 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8026 { |
8027 v24 = &pOutdoor->ddm; | |
8028 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8029 v24 = &pIndoor->dlv; | |
492 | 8030 v24->uReputation = var_value; |
8031 if ( var_value > 10000 ) | |
0 | 8032 v24->uReputation = 10000; |
8033 return; | |
8034 } | |
492 | 8035 if ( var_type <= VAR_ReputationInCurrentLocation |
8036 || var_type > VAR_History_28 | |
8037 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8038 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8039 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8040 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8041 v23) ) |
8042 return; | |
8043 bFlashHistoryBook = 1; | |
8044 } | |
8045 LABEL_172: | |
492 | 8046 v25 = 8 * currPlayerId + 400; |
862 | 8047 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8048 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8049 return; | |
8050 } | |
492 | 8051 if ( var_type != 307 ) |
8052 { | |
8053 switch ( var_type ) | |
0 | 8054 { |
8055 case 308: | |
492 | 8056 pParty->uNumBountiesCollected = var_value; |
0 | 8057 break; |
8058 case 309: | |
492 | 8059 pParty->uNumPrisonTerms = var_value; |
0 | 8060 break; |
8061 case 310: | |
492 | 8062 pParty->uNumArenaPageWins = var_value; |
0 | 8063 break; |
8064 case 311: | |
492 | 8065 pParty->uNumArenaSquireWins = var_value; |
0 | 8066 break; |
8067 case 312: | |
492 | 8068 pParty->uNumArenaKnightWins = var_value; |
0 | 8069 break; |
8070 case 313: | |
492 | 8071 pParty->uNumArenaLordWins = var_value; |
0 | 8072 break; |
8073 } | |
8074 return; | |
8075 } | |
492 | 8076 pParty->uNumDeaths = var_value; |
0 | 8077 LABEL_168: |
8078 if ( v30 != 1 ) | |
8079 { | |
8080 LABEL_170: | |
8081 if ( v31 != 1 ) | |
8082 return; | |
8083 v5 = 0; | |
8084 goto LABEL_172; | |
8085 } | |
8086 LABEL_169: | |
492 | 8087 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8088 goto LABEL_170; |
8089 } | |
492 | 8090 if ( var_type == VAR_AutoNotes ) |
8091 { | |
8092 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
|
8093 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8094 && pAutonoteTxt[var_value-1].pText ) |
8095 { | |
8096 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8097 v30 = 1; |
187 | 8098 v20->PlaySound(SPEECH_96, 0); |
492 | 8099 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8100 bFlashAutonotesBook = 1; |
981 | 8101 _506568_autonote_type = v21; |
0 | 8102 } |
492 | 8103 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8104 v31 = 1; |
8105 goto LABEL_168; | |
8106 } | |
492 | 8107 if ( var_type <= VAR_ActualMight ) |
8108 { | |
8109 if ( var_type != VAR_ActualMight ) | |
8110 { | |
8111 switch ( var_type ) | |
0 | 8112 { |
8113 case VAR_RandomGold: | |
492 | 8114 v6 = rand() % var_value + 1; |
0 | 8115 Party::SetGold(v6); |
8116 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8117 ShowStatusBarString(pTmpBuf, 2u); | |
8118 GameUI_DrawFoodAndGold(); | |
8119 return; | |
8120 case VAR_RandomFood: | |
492 | 8121 v7 = rand() % var_value + 1; |
0 | 8122 Party::SetFood(v7); |
8123 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8124 ShowStatusBarString(pTmpBuf, 2u); | |
8125 GameUI_DrawFoodAndGold(); | |
8126 goto LABEL_124; | |
8127 case VAR_Sex: | |
492 | 8128 this->uSex = (PLAYER_SEX)var_value; |
0 | 8129 goto LABEL_124; |
8130 case VAR_Class: | |
492 | 8131 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8132 if ( (char)var_value != 35 ) | |
0 | 8133 goto LABEL_124; |
8134 v8 = 0; | |
8135 v9 = this->pInventoryItems; | |
8136 break; | |
8137 case VAR_CurrentHP: | |
492 | 8138 this->sHealth = var_value; |
0 | 8139 goto LABEL_124; |
8140 case VAR_MaxHP: | |
8141 this->sHealth = GetMaxHealth(); | |
8142 return; | |
8143 case VAR_CurrentSP: | |
492 | 8144 this->sMana = var_value; |
0 | 8145 goto LABEL_124; |
8146 case VAR_MaxSP: | |
8147 this->sMana = GetMaxMana(); | |
8148 return; | |
8149 case VAR_ACModifier: | |
492 | 8150 this->sACModifier = (unsigned __int8)var_value; |
0 | 8151 goto LABEL_124; |
8152 case VAR_BaseLevel: | |
492 | 8153 this->uLevel = (unsigned __int8)var_value; |
0 | 8154 goto LABEL_124; |
8155 case VAR_LevelModifier: | |
492 | 8156 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8157 goto LABEL_124; |
8158 case VAR_Age: | |
492 | 8159 this->sAgeModifier = var_value; |
0 | 8160 return; |
8161 case VAR_Award: | |
492 | 8162 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8163 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
|
8164 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8165 && pAwards[var_value].pText ) |
0 | 8166 { |
8167 v30 = 1; | |
8168 v31 = 1; | |
492 | 8169 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8170 } |
492 | 8171 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8172 goto LABEL_168; | |
0 | 8173 case VAR_Experience: |
492 | 8174 this->uExperience = var_value; |
0 | 8175 goto LABEL_124; |
8176 case VAR_QBits_QuestsDone: | |
492 | 8177 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
|
8178 // && (&dword_722F10)[4 * a3] ) |
492 | 8179 && pQuestTable[var_value-1] ) |
0 | 8180 { |
492 | 8181 v14 = pPlayers[currPlayerId + 1]; |
0 | 8182 bFlashQuestBook = 1; |
8183 v30 = 1; | |
8184 v31 = 1; | |
187 | 8185 v14->PlaySound(SPEECH_93, 0); |
0 | 8186 } |
484 | 8187 v13 = (char *)pParty->_quest_bits; |
0 | 8188 LABEL_51: |
492 | 8189 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8190 if (( v30 != 1 )&&( v31 != 1 )) | |
8191 return; | |
8192 else | |
8193 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8194 if ( v31 != 1 ) | |
8195 return; | |
8196 v25 = 8 * currPlayerId + 400; | |
862 | 8197 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8198 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8199 return; | |
0 | 8200 case VAR_PlayerItemInHands: |
8201 item.Reset(); | |
8202 item.Reset(); | |
492 | 8203 item.uItemID = var_value; |
0 | 8204 item.uAttributes = 1; |
8205 pParty->SetHoldingItem(&item); | |
492 | 8206 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8207 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8208 return; |
8209 case VAR_FixedGold: | |
492 | 8210 Party::SetGold(var_value); |
0 | 8211 return; |
8212 case VAR_BaseMight: | |
492 | 8213 this->uMight = (unsigned __int8)var_value; |
0 | 8214 goto LABEL_84; |
8215 case VAR_BaseIntellect: | |
492 | 8216 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8217 goto LABEL_84; |
8218 case VAR_BasePersonality: | |
492 | 8219 this->uWillpower = (unsigned __int8)var_value; |
0 | 8220 goto LABEL_84; |
8221 case VAR_BaseEndurance: | |
492 | 8222 this->uEndurance = (unsigned __int8)var_value; |
0 | 8223 goto LABEL_84; |
8224 case VAR_BaseSpeed: | |
492 | 8225 this->uSpeed = (unsigned __int8)var_value; |
0 | 8226 goto LABEL_84; |
8227 case VAR_BaseAccuracy: | |
492 | 8228 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8229 goto LABEL_84; |
8230 case VAR_BaseLuck: | |
492 | 8231 this->uLuck = (unsigned __int8)var_value; |
0 | 8232 goto LABEL_84; |
8233 case VAR_FixedFood: | |
492 | 8234 Party::SetFood(var_value); |
0 | 8235 goto LABEL_124; |
8236 case VAR_MightBonus: | |
8237 goto LABEL_64; | |
8238 case VAR_IntellectBonus: | |
8239 goto LABEL_68; | |
8240 case VAR_PersonalityBonus: | |
8241 goto LABEL_69; | |
8242 case VAR_EnduranceBonus: | |
8243 goto LABEL_70; | |
8244 case VAR_SpeedBonus: | |
8245 goto LABEL_71; | |
8246 case VAR_AccuracyBonus: | |
8247 goto LABEL_72; | |
8248 case VAR_LuckBonus: | |
8249 goto LABEL_73; | |
8250 default: | |
8251 return; | |
8252 } | |
8253 while ( v9->uItemID != 615 ) | |
8254 { | |
8255 ++v8; | |
8256 ++v9; | |
8257 if ( v8 >= 138 ) | |
8258 goto LABEL_22; | |
8259 } | |
8260 v10 = (int)((char *)v4 + 36 * v8); | |
8261 *(int *)(v10 + 532) = 601; | |
492 | 8262 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8263 LABEL_22: |
8264 if ( v4->sResFireBase < 20 ) | |
8265 v4->sResFireBase = 20; | |
8266 if ( v4->sResAirBase < 20 ) | |
8267 v4->sResAirBase = 20; | |
8268 if ( v4->sResWaterBase < 20 ) | |
8269 v4->sResWaterBase = 20; | |
8270 if ( v4->sResEarthBase < 20 ) | |
8271 v4->sResEarthBase = 20; | |
8272 v4->sResMindBase = 200; | |
8273 v4->sResBodyBase = 200; | |
8274 v11 = v4->GetSexByVoice(); | |
1014 | 8275 v4->uPrevVoiceID = v4->uVoiceID; |
8276 v4->uPrevFace = v4->uCurrentFace; | |
0 | 8277 if ( v11 ) |
8278 { | |
1014 | 8279 v4->uCurrentFace = 21; |
0 | 8280 v4->uVoiceID = 21; |
8281 } | |
8282 else | |
8283 { | |
1014 | 8284 v4->uCurrentFace = 20; |
0 | 8285 v4->uVoiceID = 20; |
8286 } | |
1014 | 8287 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
0 | 8288 goto LABEL_124; |
8289 } | |
8290 LABEL_64: | |
492 | 8291 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8292 LABEL_111: |
8293 v28 = 0; | |
187 | 8294 v26 = SPEECH_91; |
0 | 8295 LABEL_112: |
492 | 8296 v19 = pPlayers[currPlayerId + 1]; |
0 | 8297 v31 = 1; |
187 | 8298 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8299 goto LABEL_169; |
8300 } | |
492 | 8301 if ( var_type <= VAR_FireResistanceBonus ) |
8302 { | |
8303 if ( var_type == VAR_FireResistanceBonus ) | |
8304 { | |
8305 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8306 goto LABEL_111; |
8307 } | |
492 | 8308 switch ( var_type ) |
0 | 8309 { |
8310 case VAR_ActualIntellect: | |
8311 LABEL_68: | |
492 | 8312 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8313 goto LABEL_111; |
8314 case VAR_ActualPersonality: | |
8315 LABEL_69: | |
492 | 8316 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8317 goto LABEL_111; |
8318 case VAR_ActualEndurance: | |
8319 LABEL_70: | |
492 | 8320 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8321 goto LABEL_111; |
8322 case VAR_ActualSpeed: | |
8323 LABEL_71: | |
492 | 8324 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8325 goto LABEL_111; |
8326 case VAR_ActualAccuracy: | |
8327 LABEL_72: | |
492 | 8328 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8329 goto LABEL_111; |
8330 case VAR_ActualLuck: | |
8331 LABEL_73: | |
492 | 8332 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8333 goto LABEL_111; |
8334 case VAR_FireResistance: | |
492 | 8335 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8336 goto LABEL_84; |
8337 case VAR_AirResistance: | |
492 | 8338 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8339 goto LABEL_84; |
8340 case VAR_WaterResistance: | |
492 | 8341 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8342 goto LABEL_84; |
8343 case VAR_EarthResistance: | |
492 | 8344 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8345 goto LABEL_84; |
8346 case VAR_SpiritResistance: | |
492 | 8347 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8348 goto LABEL_84; |
8349 case VAR_MindResistance: | |
492 | 8350 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8351 goto LABEL_84; |
8352 case VAR_BodyResistance: | |
492 | 8353 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8354 goto LABEL_84; |
8355 case VAR_LightResistance: | |
492 | 8356 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8357 goto LABEL_84; |
8358 case VAR_DarkResistance: | |
492 | 8359 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8360 goto LABEL_84; |
8361 case VAR_MagicResistance: | |
492 | 8362 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8363 LABEL_84: |
8364 v28 = 0; | |
8365 v26 = 92; | |
8366 goto LABEL_112; | |
8367 default: | |
8368 return; | |
8369 } | |
8370 return; | |
8371 } | |
8372 HIWORD(v15) = 0; | |
492 | 8373 if ( var_type > VAR_DisarmTrapSkill ) |
8374 { | |
8375 if ( var_type != VAR_LearningSkill ) | |
8376 { | |
8377 if ( var_type <= VAR_LearningSkill ) | |
0 | 8378 return; |
492 | 8379 if ( var_type <= VAR_Eradicated ) |
8380 { | |
8381 v4->SetCondition(var_type - 105, 1); | |
0 | 8382 } |
8383 else | |
8384 { | |
492 | 8385 if ( var_type != VAR_MajorCondition ) |
0 | 8386 { |
492 | 8387 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8388 byte_5E4C15[var_type] = var_value; | |
0 | 8389 return; |
8390 } | |
8391 memset(v4, 0, 0xA0u); | |
8392 } | |
8393 LABEL_124: | |
8394 v31 = 1; | |
8395 goto LABEL_169; | |
8396 } | |
8397 LABEL_106: | |
492 | 8398 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8399 v17 = *(char *)v16; |
492 | 8400 if ( var_value <= VAR_BodyResistanceBonus ) |
8401 { | |
8402 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8403 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8404 } | |
8405 else | |
8406 { | |
492 | 8407 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8408 } |
8409 *(short *)v16 = v18; | |
8410 goto LABEL_124; | |
8411 } | |
492 | 8412 if ( var_type == VAR_DisarmTrapSkill ) |
8413 if ( v30 != 1 ) | |
8414 { | |
8415 if ( v31 != 1 ) | |
8416 return; | |
8417 v5 = 0; | |
8418 goto LABEL_172; | |
8419 } | |
8420 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8421 goto LABEL_170; | |
8422 if ( var_type <= VAR_BodyResistanceBonus ) | |
8423 { | |
8424 switch ( var_type ) | |
0 | 8425 { |
8426 case VAR_BodyResistanceBonus: | |
492 | 8427 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8428 break; |
8429 case VAR_AirResistanceBonus: | |
492 | 8430 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8431 break; |
8432 case VAR_WaterResistanceBonus: | |
492 | 8433 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8434 break; |
8435 case VAR_EarthResistanceBonus: | |
492 | 8436 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8437 break; |
8438 case VAR_SpiritResistanceBonus: | |
492 | 8439 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8440 break; |
8441 default: | |
492 | 8442 if ( var_type != 62 ) |
0 | 8443 return; |
492 | 8444 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8445 break; |
8446 } | |
8447 goto LABEL_111; | |
8448 } | |
492 | 8449 if ( var_type == VAR_LightResistanceBonus ) |
8450 { | |
8451 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8452 goto LABEL_111; |
8453 } | |
492 | 8454 if ( var_type == VAR_DarkResistanceBonus ) |
8455 { | |
8456 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8457 goto LABEL_111; | |
8458 } | |
8459 if ( var_type == VAR_MagicResistanceBonus ) | |
8460 { | |
8461 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8462 goto LABEL_111; |
8463 } | |
492 | 8464 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8465 if ( v30 != 1 ) | |
8466 { | |
8467 if ( v31 != 1 ) | |
8468 return; | |
8469 v5 = 0; | |
8470 v25 = 8 * currPlayerId + 400; | |
862 | 8471 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8472 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8473 return; | |
8474 } | |
8475 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8476 goto LABEL_170; | |
0 | 8477 } |
8478 | |
8479 | |
8480 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8481 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8482 { |
8483 char v3; // bl@1 | |
8484 Player *v4; // esi@1 | |
8485 signed int uPlayerIdx; // edi@1 | |
8486 int v6; // eax@15 | |
8487 unsigned int v7; // esi@18 | |
8488 int *v8; // ebx@21 | |
8489 int v9; // eax@22 | |
8490 signed int v10; // eax@24 | |
8491 int v11; // eax@27 | |
8492 __int16 *v12; // esi@28 | |
8493 Player *v13; // ecx@34 | |
8494 Player *v14; // ecx@36 | |
8495 char *v15; // ecx@37 | |
8496 unsigned __int8 v16; // cf@38 | |
8497 Player *v17; // ecx@42 | |
8498 __int16 *v18; // esi@53 | |
8499 __int16 *v19; // esi@62 | |
8500 char *v20; // esi@107 | |
8501 __int16 v21; // dx@107 | |
8502 int v22; // ecx@107 | |
8503 Player *v23; // ecx@132 | |
8504 int v24; // eax@132 | |
8505 int v25; // eax@150 | |
8506 char v26; // zf@151 | |
8507 DDM_DLV_Header *v27; // eax@153 | |
8508 signed int v28; // eax@176 | |
8509 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8510 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8511 int v31; // [sp-4h] [bp-3Ch]@84 |
8512 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8513 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8514 char v34; // [sp+37h] [bp-1h]@1 | |
8515 | |
8516 auto Dst = this; | |
8517 v3 = 0; | |
8518 v34 = 0; | |
8519 v4 = Dst; | |
8520 uPlayerIdx = 0; | |
8521 if ( Dst == pPlayers[2] ) | |
8522 uPlayerIdx = 1; | |
310 | 8523 else if ( Dst == pPlayers[3] ) |
8524 uPlayerIdx = 2; | |
8525 else if ( Dst == pPlayers[4] ) | |
8526 uPlayerIdx = 3; | |
8527 | |
8528 if ( var_type <= VAR_AutoNotes ) | |
8529 { | |
8530 if ( var_type != VAR_AutoNotes ) | |
8531 { | |
8532 if ( var_type <= VAR_ActualMight ) | |
8533 { | |
8534 if ( var_type != VAR_ActualMight ) | |
0 | 8535 { |
310 | 8536 switch ( var_type ) |
0 | 8537 { |
8538 case VAR_RandomGold: | |
8539 if ( !val ) | |
8540 val = 1; | |
8541 v6 = rand(); | |
8542 party_finds_gold(v6 % val + 1, 1); | |
8543 GameUI_DrawFoodAndGold(); | |
8544 return; | |
8545 case VAR_RandomFood: | |
8546 if ( !val ) | |
8547 val = 1; | |
8548 v7 = rand() % val + 1; | |
8549 Party::GiveFood(v7); | |
8550 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8551 ShowStatusBarString(pTmpBuf, 2u); | |
8552 GameUI_DrawFoodAndGold(); | |
8553 goto _play_sound; | |
8554 case VAR_Sex: | |
8555 Dst->uSex = (PLAYER_SEX)val; | |
8556 goto _play_anim_and_exit; | |
8557 case VAR_Class: | |
135 | 8558 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8559 goto _play_anim_and_exit; |
8560 case VAR_CurrentHP: | |
8561 v8 = &Dst->sHealth; | |
8562 *v8 += val; | |
8563 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8564 goto _play_anim_and_exit; | |
8565 v9 = v4->GetMaxHealth(); | |
8566 goto LABEL_23; | |
8567 case VAR_MaxHP: | |
8568 v10 = Dst->GetMaxHealth(); | |
8569 v4->_health_related = 0; | |
8570 v4->uFullHealthBonus = 0; | |
8571 v4->sHealth = v10; | |
8572 return; | |
8573 case VAR_CurrentSP: | |
8574 v8 = &Dst->sMana; | |
8575 *v8 += val; | |
8576 if ( Dst->sMana > GetMaxMana() ) | |
8577 { | |
8578 v9 = v4->GetMaxMana(); | |
8579 LABEL_23: | |
8580 *v8 = v9; | |
8581 } | |
8582 goto _play_anim_and_exit; | |
8583 case VAR_MaxSP: | |
8584 v11 = GetMaxMana(); | |
8585 v4->_mana_related = 0; | |
8586 v4->uFullManaBonus = 0; | |
8587 v4->sMana = v11; | |
8588 return; | |
8589 case VAR_ACModifier: | |
8590 v12 = &Dst->sACModifier; | |
8591 goto LABEL_29; | |
8592 case VAR_BaseLevel: | |
8593 v12 = (__int16 *)&Dst->uLevel; | |
8594 goto LABEL_29; | |
8595 case VAR_LevelModifier: | |
8596 v12 = &Dst->sLevelModifier; | |
8597 LABEL_29: | |
8598 *v12 += val; | |
8599 if ( *v12 > 255 ) | |
8600 *v12 = 255; | |
8601 goto _play_anim_and_exit; | |
8602 case VAR_Age: | |
8603 Dst->sAgeModifier += val; | |
8604 return; | |
8605 case VAR_Award: | |
8606 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8607 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8608 | |
492 | 8609 && pAwards[val].pText ) |
0 | 8610 { |
8611 v14 = pPlayers[uPlayerIdx + 1]; | |
8612 v34 = 1; | |
8613 v3 = 1; | |
187 | 8614 v14->PlaySound(SPEECH_96, 0); |
0 | 8615 } |
735 | 8616 v15 = (char *)v4->_guilds_member_bits; |
0 | 8617 goto LABEL_44; |
8618 case VAR_Experience: | |
8619 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8620 LODWORD(Dst->uExperience) += val; | |
8621 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8622 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8623 Dst->uExperience = 4000000000i64; | |
8624 goto _play_anim_and_exit; | |
8625 case VAR_QBits_QuestsDone: | |
484 | 8626 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
|
8627 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8628 && pQuestTable[val-1] ) |
0 | 8629 { |
501 | 8630 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8631 bFlashQuestBook = 1; |
8632 v34 = 1; | |
8633 v3 = 1; | |
501 | 8634 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8635 } |
484 | 8636 v15 = (char *)pParty->_quest_bits; |
0 | 8637 LABEL_44: |
8638 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8639 goto LABEL_173; | |
8640 case VAR_PlayerItemInHands: | |
8641 item.Reset(); | |
8642 item.Reset(); | |
8643 item.uAttributes = 1; | |
8644 item.uItemID = val; | |
8645 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8646 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8647 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8648 { | |
8649 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8650 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8651 } | |
8652 pParty->SetHoldingItem(&item); | |
8653 return; | |
8654 case VAR_FixedGold: | |
8655 party_finds_gold(val, 1); | |
8656 return; | |
8657 case VAR_BaseMight: | |
8658 v18 = (__int16 *)&Dst->uMight; | |
8659 goto LABEL_82; | |
8660 case VAR_BaseIntellect: | |
8661 v18 = (__int16 *)&Dst->uIntelligence; | |
8662 goto LABEL_82; | |
8663 case VAR_BasePersonality: | |
8664 v18 = (__int16 *)&Dst->uWillpower; | |
8665 goto LABEL_82; | |
8666 case VAR_BaseEndurance: | |
8667 v18 = (__int16 *)&Dst->uEndurance; | |
8668 goto LABEL_82; | |
8669 case VAR_BaseSpeed: | |
8670 v18 = (__int16 *)&Dst->uSpeed; | |
8671 goto LABEL_82; | |
8672 case VAR_BaseAccuracy: | |
8673 v18 = (__int16 *)&Dst->uAccuracy; | |
8674 goto LABEL_82; | |
8675 case VAR_BaseLuck: | |
8676 v18 = (__int16 *)&Dst->uLuck; | |
8677 goto LABEL_82; | |
8678 case VAR_FixedFood: | |
8679 Party::GiveFood(val); | |
715 | 8680 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8681 ShowStatusBarString(pTmpBuf, 2u); |
8682 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8683 Party::SetFood(0xFFFFu); | |
8684 goto _play_sound; | |
8685 case VAR_MightBonus: | |
8686 goto LABEL_62; | |
8687 case VAR_IntellectBonus: | |
8688 goto LABEL_66; | |
8689 case VAR_PersonalityBonus: | |
8690 goto LABEL_67; | |
8691 case VAR_EnduranceBonus: | |
8692 goto LABEL_68; | |
8693 case VAR_SpeedBonus: | |
8694 goto LABEL_69; | |
8695 case VAR_AccuracyBonus: | |
8696 goto LABEL_70; | |
8697 case VAR_LuckBonus: | |
8698 goto LABEL_71; | |
8699 default: | |
8700 return; | |
8701 } | |
8702 return; | |
8703 } | |
8704 LABEL_62: | |
8705 v19 = (__int16 *)&Dst->uMightBonus; | |
8706 goto LABEL_113; | |
8707 } | |
310 | 8708 if ( var_type <= VAR_FireResistanceBonus ) |
8709 { | |
8710 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8711 { |
310 | 8712 switch ( var_type ) |
0 | 8713 { |
8714 case VAR_ActualIntellect: | |
8715 LABEL_66: | |
8716 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8717 goto LABEL_113; | |
8718 case VAR_ActualPersonality: | |
8719 LABEL_67: | |
8720 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8721 goto LABEL_113; | |
8722 case VAR_ActualEndurance: | |
8723 LABEL_68: | |
8724 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8725 goto LABEL_113; | |
8726 case VAR_ActualSpeed: | |
8727 LABEL_69: | |
8728 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8729 goto LABEL_113; | |
8730 case VAR_ActualAccuracy: | |
8731 LABEL_70: | |
8732 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8733 goto LABEL_113; | |
8734 case VAR_ActualLuck: | |
8735 LABEL_71: | |
8736 v19 = (__int16 *)&Dst->uLuckBonus; | |
8737 goto LABEL_113; | |
8738 case VAR_FireResistance: | |
8739 v18 = &Dst->sResFireBase; | |
8740 goto LABEL_82; | |
8741 case VAR_AirResistance: | |
8742 v18 = &Dst->sResAirBase; | |
8743 goto LABEL_82; | |
8744 case VAR_WaterResistance: | |
8745 v18 = &Dst->sResWaterBase; | |
8746 goto LABEL_82; | |
8747 case VAR_EarthResistance: | |
8748 v18 = &Dst->sResEarthBase; | |
8749 goto LABEL_82; | |
8750 case VAR_SpiritResistance: | |
8751 v18 = &Dst->sResSpiritBase; | |
8752 goto LABEL_82; | |
8753 case VAR_MindResistance: | |
8754 v18 = &Dst->sResMindBase; | |
8755 goto LABEL_82; | |
8756 case VAR_BodyResistance: | |
8757 v18 = &Dst->sResBodyBase; | |
8758 goto LABEL_82; | |
8759 case VAR_LightResistance: | |
8760 v18 = &Dst->sResLightBase; | |
8761 goto LABEL_82; | |
8762 case VAR_DarkResistance: | |
8763 v18 = &Dst->sResDarkBase; | |
8764 goto LABEL_82; | |
8765 case VAR_MagicResistance: | |
8766 v18 = &Dst->sResMagicBase; | |
8767 LABEL_82: | |
8768 *v18 += val; | |
8769 if ( *v18 > 255 ) | |
8770 *v18 = 255; | |
8771 v31 = 0; | |
8772 v29 = 92; | |
8773 goto LABEL_116; | |
8774 default: | |
8775 return; | |
8776 } | |
8777 return; | |
8778 } | |
8779 v19 = &Dst->sResFireBonus; | |
8780 LABEL_113: | |
8781 *v19 += val; | |
8782 if ( *v19 > 255 ) | |
8783 *v19 = 255; | |
8784 v31 = 0; | |
187 | 8785 v29 = SPEECH_91; |
0 | 8786 LABEL_116: |
8787 v3 = 1; | |
187 | 8788 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8789 goto _play_anim_and_maybe_sound; |
8790 } | |
310 | 8791 if ( var_type <= VAR_DisarmTrapSkill ) |
8792 { | |
8793 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8794 { |
310 | 8795 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8796 { |
310 | 8797 switch ( var_type ) |
0 | 8798 { |
8799 case VAR_BodyResistanceBonus: | |
8800 v19 = &Dst->sResBodyBonus; | |
8801 break; | |
8802 case VAR_AirResistanceBonus: | |
8803 v19 = &Dst->sResAirBonus; | |
8804 break; | |
8805 case VAR_WaterResistanceBonus: | |
8806 v19 = &Dst->sResWaterBonus; | |
8807 break; | |
8808 case VAR_EarthResistanceBonus: | |
8809 v19 = &Dst->sResEarthBonus; | |
8810 break; | |
8811 case VAR_SpiritResistanceBonus: | |
8812 v19 = &Dst->sResSpiritBonus; | |
8813 break; | |
8814 default: | |
310 | 8815 if ( var_type != 62 ) |
0 | 8816 return; |
8817 v19 = &Dst->sResMindBonus; | |
8818 break; | |
8819 } | |
8820 goto LABEL_113; | |
8821 } | |
310 | 8822 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8823 { |
8824 v19 = &Dst->sResLightBonus; | |
8825 goto LABEL_113; | |
8826 } | |
310 | 8827 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8828 { |
8829 v19 = &Dst->sResDarkBonus; | |
8830 goto LABEL_113; | |
8831 } | |
310 | 8832 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8833 { |
8834 v19 = &Dst->sResMagicBonus; | |
8835 goto LABEL_113; | |
8836 } | |
310 | 8837 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8838 return; |
8839 } | |
8840 goto LABEL_106; | |
8841 } | |
310 | 8842 if ( var_type == VAR_LearningSkill ) |
0 | 8843 { |
8844 LABEL_106: | |
8845 if ( val <= VAR_BodyResistanceBonus ) | |
8846 { | |
310 | 8847 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8848 } |
8849 else | |
8850 { | |
310 | 8851 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8852 v21 = *(short *)v20; |
8853 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8854 if ( v22 > 60 ) | |
8855 LOWORD(v22) = 60; | |
8856 LOBYTE(v21) = v21 & 0xC0; | |
8857 *(short *)v20 = v22 | v21; | |
8858 } | |
8859 goto _play_anim_and_exit; | |
8860 } | |
310 | 8861 if ( var_type <= VAR_LearningSkill ) |
0 | 8862 return; |
310 | 8863 if ( var_type <= VAR_Eradicated ) |
8864 { | |
8865 Dst->SetCondition(var_type - 105, 0); | |
0 | 8866 } |
8867 else | |
8868 { | |
310 | 8869 if ( var_type != VAR_MajorCondition ) |
0 | 8870 { |
310 | 8871 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8872 { |
310 | 8873 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8874 byte_5E4C15[var_type] += val; | |
0 | 8875 else |
310 | 8876 byte_5E4C15[var_type] = -1; |
0 | 8877 } |
8878 return; | |
8879 } | |
8880 memset(Dst, 0, 0xA0u); | |
8881 } | |
8882 _play_anim_and_exit: | |
8883 v3 = 1; | |
8884 _play_anim_and_maybe_sound: | |
8885 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8886 _maybe_play_sound: | |
8887 if ( v3 != 1 ) | |
8888 return; | |
8889 goto _play_sound; | |
8890 } | |
8891 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
|
8892 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8893 && pAutonoteTxt[val-1].pText ) |
0 | 8894 { |
8895 v23 = pPlayers[uPlayerIdx + 1]; | |
8896 v34 = 1; | |
187 | 8897 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8898 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8899 bFlashAutonotesBook = 1; |
981 | 8900 _506568_autonote_type = v24; |
0 | 8901 } |
8902 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8903 v3 = 1; | |
8904 LABEL_173: | |
8905 if ( v34 != 1 ) | |
8906 goto _maybe_play_sound; | |
8907 goto _play_anim_and_maybe_sound; | |
8908 } | |
310 | 8909 if ( var_type > VAR_GoldInBank ) |
8910 { | |
8911 if ( var_type == 307 ) | |
0 | 8912 { |
8913 pParty->uNumDeaths += val; | |
8914 goto LABEL_173; | |
8915 } | |
310 | 8916 switch ( var_type ) |
0 | 8917 { |
8918 case 308: | |
8919 pParty->uNumBountiesCollected += val; | |
8920 break; | |
8921 case 309: | |
8922 pParty->uNumPrisonTerms += val; | |
8923 break; | |
8924 case 310: | |
8925 pParty->uNumArenaPageWins += val; | |
8926 break; | |
8927 case 311: | |
8928 pParty->uNumArenaSquireWins += val; | |
8929 break; | |
8930 case 312: | |
8931 pParty->uNumArenaKnightWins += val; | |
8932 break; | |
8933 case 313: | |
8934 pParty->uNumArenaLordWins += val; | |
8935 break; | |
8936 } | |
8937 } | |
8938 else | |
8939 { | |
310 | 8940 if ( var_type == VAR_GoldInBank ) |
0 | 8941 { |
8942 pParty->uNumGoldInBank += val; | |
8943 return; | |
8944 } | |
310 | 8945 if ( var_type <= VAR_Counter8 ) |
8946 { | |
8947 if ( (signed int)var_type >= 245 ) | |
8948 { | |
8949 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
8950 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8951 } |
8952 else | |
8953 { | |
310 | 8954 switch ( var_type ) |
0 | 8955 { |
8956 case VAR_MonthEquals|VAR_CurrentSP: | |
8957 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
8958 break; | |
8959 case VAR_NPCs2: | |
8960 pParty->field_709 = 0; | |
8961 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 8962 Party__CountHirelings(); |
0 | 8963 viewparams->bRedrawGameUI = 1; |
8964 break; | |
8965 case VAR_NumSkillPoints: | |
8966 Dst->uSkillPoints += val; | |
8967 break; | |
8968 } | |
8969 } | |
8970 return; | |
8971 } | |
310 | 8972 if ( var_type < VAR_Counter9 ) |
0 | 8973 return; |
310 | 8974 if ( (signed int)var_type <= 274 ) |
8975 { | |
8976 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8977 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8978 goto _play_sound; |
8979 } | |
310 | 8980 if ( var_type != VAR_ReputationInCurrentLocation ) |
8981 { | |
8982 if ( var_type <= VAR_ReputationInCurrentLocation | |
8983 || var_type > VAR_History_28 | |
8984 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
8985 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8986 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 8987 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8988 v26) ) |
8989 return; | |
8990 bFlashHistoryBook = 1; | |
8991 _play_sound: | |
8992 v28 = 8 * uPlayerIdx + 400; | |
862 | 8993 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 8994 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
8995 return; | |
8996 } | |
8997 v27 = &pOutdoor->ddm; | |
8998 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8999 v27 = &pIndoor->dlv; | |
9000 v27->uReputation += val; | |
9001 if ( v27->uReputation > 10000 ) | |
9002 v27->uReputation = 10000; | |
9003 } | |
9004 } | |
9005 // 506568: using guessed type int dword_506568; | |
9006 // 507948: using guessed type char bFlashHistoryBook; | |
9007 // 507949: using guessed type char bFlashAutonotesBook; | |
9008 // 50794A: using guessed type char bFlashQuestBook; | |
9009 // 72371C: using guessed type int dword_72371C[]; | |
9010 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9011 | |
9012 | |
9013 | |
9014 | |
9015 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9016 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9017 { |
9018 unsigned int v3; // ebx@1 | |
9019 signed int v4; // esi@1 | |
501 | 9020 bool result; // eax@8 |
0 | 9021 int v6; // esi@11 |
9022 int v7; // edi@14 | |
9023 signed int v8; // eax@17 | |
9024 char *v9; // eax@20 | |
9025 char v10; // sf@20 | |
9026 char *v11; // ecx@26 | |
9027 char *v12; // ecx@27 | |
9028 __int64 v13; // qax@27 | |
9029 unsigned __int8 v14; // cf@27 | |
501 | 9030 int *v15; // edx@29 |
0 | 9031 char *v16; // eax@90 |
9032 char *v17; // ecx@94 | |
501 | 9033 int v18; // esi@97 |
0 | 9034 signed int v19; // edx@97 |
9035 char *v20; // ecx@98 | |
9036 int v21; // eax@100 | |
9037 __int16 v22; // dx@112 | |
9038 int v23; // [sp-8h] [bp-14h]@45 | |
9039 signed int v24; // [sp-4h] [bp-10h]@4 | |
9040 int v25; // [sp-4h] [bp-10h]@45 | |
9041 | |
9042 v3 = 0; | |
605 | 9043 v4 = uActiveCharacter - 1; |
501 | 9044 result = false; |
9045 if ( (signed int)VarNum > 222 ) | |
9046 { | |
9047 if ( (signed int)VarNum <= 307 ) | |
9048 { | |
9049 if ( VarNum == 307 ) | |
9050 { | |
9051 pParty->uNumDeaths -= (unsigned int)pValue; | |
9052 return pValue; | |
9053 } | |
9054 if ( VarNum == 223 ) | |
0 | 9055 { |
9056 v11 = (char *)pParty->_autonote_bits; | |
501 | 9057 v22 = (short)pValue - 1; |
0 | 9058 } |
9059 else | |
9060 { | |
501 | 9061 if ( VarNum != 231 ) |
0 | 9062 { |
501 | 9063 switch ( VarNum ) |
0 | 9064 { |
9065 case 232: | |
501 | 9066 VarNum = (VariableType)0; |
602 | 9067 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9068 result = (bool) pValue; |
9069 dword_5B65CC = 0; | |
9070 if ( (int)VarNum == pValue ) | |
0 | 9071 { |
501 | 9072 dword_5B65CC = (int)pValue; |
0 | 9073 } |
9074 else | |
9075 { | |
9076 pParty->field_709 = 0; | |
501 | 9077 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9078 Party__CountHirelings(); |
0 | 9079 viewparams->bRedrawGameUI = 1; |
9080 } | |
9081 break; | |
9082 case 241: | |
9083 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9084 { | |
9085 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9086 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9087 { |
605 | 9088 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9089 { |
9090 v21 = *(int *)v20; | |
9091 if ( (char)*(int *)v20 < 0 ) | |
9092 { | |
9093 LOBYTE(v21) = v21 & 0x7F; | |
9094 *(int *)v20 = v21; | |
9095 } | |
9096 } | |
9097 v20 += 76; | |
9098 } | |
9099 } | |
605 | 9100 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9101 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9102 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9103 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9104 pParty->field_709 = 0; | |
659 | 9105 Party__CountHirelings(); |
0 | 9106 break; |
9107 case 243: | |
9108 v17 = (char *)&this->uSkillPoints; | |
501 | 9109 result = *v17; |
9110 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9111 { | |
9112 *(int *)v17 -= (int)pValue; | |
9113 result = v17; | |
9114 } | |
0 | 9115 else |
9116 *(int *)v17 = 0; | |
9117 break; | |
9118 case 275: | |
9119 v16 = (char *)&pOutdoor->ddm; | |
9120 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9121 v16 = (char *)&pIndoor->dlv; | |
501 | 9122 *((int *)v16 + 2) -= (int)pValue; |
0 | 9123 if ( *((int *)v16 + 2) < -10000 ) |
9124 *((int *)v16 + 2) = -10000; | |
9125 break; | |
9126 case 306: | |
501 | 9127 result = VarNum - 306; |
9128 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9129 { | |
9130 result = (bool)pValue; | |
9131 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9132 } |
0 | 9133 else |
9134 LABEL_88: | |
9135 dword_5B65C4 = 1; | |
9136 break; | |
9137 } | |
501 | 9138 return result; |
0 | 9139 } |
9140 v11 = this->field_1A50; | |
501 | 9141 v22 = (signed __int16)pValue; |
0 | 9142 } |
9143 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9144 return result; |
9145 } | |
9146 switch ( VarNum ) | |
0 | 9147 { |
9148 case 308: | |
501 | 9149 result = (bool)pValue; |
9150 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9151 break; |
9152 case 309: | |
501 | 9153 result = (bool)pValue; |
9154 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9155 break; |
9156 case 310: | |
501 | 9157 result = (bool)pValue; |
9158 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9159 break; |
9160 case 311: | |
501 | 9161 result = (bool)pValue; |
9162 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9163 break; |
9164 case 312: | |
501 | 9165 result = (bool)pValue; |
9166 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9167 break; |
9168 case 313: | |
501 | 9169 result = (bool)pValue; |
9170 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9171 break; |
9172 } | |
9173 } | |
9174 else | |
9175 { | |
501 | 9176 if ( (signed int)VarNum >= 123 ) |
9177 { | |
9178 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9179 } |
9180 else | |
9181 { | |
501 | 9182 switch ( VarNum ) |
0 | 9183 { |
9184 case VAR_RandomGold: | |
501 | 9185 v6 = rand() % (signed int)pValue + 1; |
0 | 9186 if ( v6 > pParty->uNumGold ) |
9187 v6 = pParty->uNumGold; | |
9188 Party::TakeGold(v6); | |
9189 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9190 ShowStatusBarString(pTmpBuf, 2); |
0 | 9191 GameUI_DrawFoodAndGold(); |
501 | 9192 return result; |
0 | 9193 case VAR_RandomFood: |
501 | 9194 v7 = rand() % (signed int)pValue + 1; |
0 | 9195 if ( v7 > pParty->uNumFoodRations ) |
9196 v7 = pParty->uNumFoodRations; | |
9197 Party::TakeFood(v7); | |
9198 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9199 ShowStatusBarString(pTmpBuf, 2u); | |
9200 GameUI_DrawFoodAndGold(); | |
605 | 9201 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9202 v8 = 8 * v4 + 400; | |
862 | 9203 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9204 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9205 return result; |
0 | 9206 case VAR_CurrentHP: |
1036 | 9207 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 9208 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9209 v8 = 8 * v4 + 400; | |
862 | 9210 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9211 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9212 return result; | |
0 | 9213 case VAR_CurrentSP: |
9214 v9 = (char *)&this->sMana; | |
501 | 9215 v10 = this->sMana - (signed int)pValue < 0; |
9216 *(int *)v9 -= (int)pValue; | |
0 | 9217 if ( v10 ) |
9218 *(int *)v9 = 0; | |
605 | 9219 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9220 v8 = 8 * v4 + 400; | |
862 | 9221 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9222 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9223 return result; | |
0 | 9224 case VAR_ACModifier: |
501 | 9225 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9226 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9227 v8 = 8 * v4 + 400; | |
862 | 9228 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9229 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9230 return result; | |
0 | 9231 case VAR_BaseLevel: |
501 | 9232 this->uLevel -= (unsigned __int8)pValue; |
605 | 9233 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9234 v8 = 8 * v4 + 400; | |
862 | 9235 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9236 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9237 return result; | |
0 | 9238 case VAR_LevelModifier: |
501 | 9239 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9240 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9241 v8 = 8 * v4 + 400; | |
862 | 9242 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9243 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9244 return result; | |
0 | 9245 case VAR_Age: |
501 | 9246 this->sAgeModifier -= (signed __int16)pValue; |
9247 return result; | |
0 | 9248 case VAR_Award: |
605 | 9249 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9250 return result; | |
0 | 9251 case VAR_Experience: |
9252 v12 = (char *)&this->uExperience; | |
501 | 9253 v13 = (signed int)pValue; |
9254 v14 = *(int *)v12 < (unsigned int)pValue; | |
9255 *(int *)v12 -= (int)pValue; | |
0 | 9256 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9257 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9258 v8 = 8 * v4 + 400; | |
862 | 9259 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9260 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9261 return result; | |
0 | 9262 case VAR_QBits_QuestsDone: |
501 | 9263 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9264 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9265 return true; |
0 | 9266 case VAR_PlayerItemInHands: |
501 | 9267 v15 = this->pInventoryIndices; |
0 | 9268 break; |
9269 case VAR_FixedGold: | |
501 | 9270 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9271 goto LABEL_88; |
501 | 9272 Party::TakeGold((unsigned int)pValue); |
9273 return result; | |
0 | 9274 case VAR_MightBonus: |
9275 case VAR_ActualMight: | |
501 | 9276 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9277 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9278 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9279 v8 = 8 * v4 + 400; | |
862 | 9280 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9281 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9282 return result; | |
0 | 9283 case VAR_IntellectBonus: |
9284 case VAR_ActualIntellect: | |
501 | 9285 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9286 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9287 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9288 v8 = 8 * v4 + 400; | |
862 | 9289 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9290 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9291 return result; | |
0 | 9292 case VAR_PersonalityBonus: |
9293 case VAR_ActualPersonality: | |
501 | 9294 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9295 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9296 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9297 v8 = 8 * v4 + 400; | |
862 | 9298 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9299 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9300 return result; | |
0 | 9301 case VAR_EnduranceBonus: |
9302 case VAR_ActualEndurance: | |
501 | 9303 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9304 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9305 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9306 v8 = 8 * v4 + 400; | |
862 | 9307 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9308 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9309 return result; | |
0 | 9310 case VAR_SpeedBonus: |
9311 case VAR_ActualSpeed: | |
501 | 9312 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9313 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9314 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9315 v8 = 8 * v4 + 400; | |
862 | 9316 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9317 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9318 return result; | |
0 | 9319 case VAR_AccuracyBonus: |
9320 case VAR_ActualAccuracy: | |
501 | 9321 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9322 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9323 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9324 v8 = 8 * v4 + 400; | |
862 | 9325 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9326 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9327 return result; | |
0 | 9328 case VAR_LuckBonus: |
9329 case VAR_ActualLuck: | |
501 | 9330 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9331 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9332 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9333 v8 = 8 * v4 + 400; | |
862 | 9334 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9335 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9336 return result; | |
0 | 9337 case VAR_BaseMight: |
501 | 9338 this->uMight -= (unsigned __int16)pValue; |
605 | 9339 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9340 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9341 v8 = 8 * v4 + 400; | |
862 | 9342 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9343 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9344 return result; | |
0 | 9345 case VAR_BaseIntellect: |
501 | 9346 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9347 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9348 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9349 v8 = 8 * v4 + 400; | |
862 | 9350 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9351 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9352 return result; | |
0 | 9353 case VAR_BasePersonality: |
501 | 9354 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9355 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9356 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9357 v8 = 8 * v4 + 400; | |
862 | 9358 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9359 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9360 return result; | |
0 | 9361 case VAR_BaseEndurance: |
501 | 9362 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9363 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9364 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9365 v8 = 8 * v4 + 400; | |
862 | 9366 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9367 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9368 return result; | |
0 | 9369 case VAR_BaseSpeed: |
501 | 9370 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9371 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9372 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9373 v8 = 8 * v4 + 400; | |
862 | 9374 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9375 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9376 return result; | |
0 | 9377 case VAR_BaseAccuracy: |
501 | 9378 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9379 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9380 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9381 v8 = 8 * v4 + 400; | |
862 | 9382 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9383 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9384 return result; | |
0 | 9385 case VAR_BaseLuck: |
501 | 9386 this->uLuck -= (unsigned __int16)pValue; |
605 | 9387 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9388 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9389 v8 = 8 * v4 + 400; | |
862 | 9390 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9391 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9392 return result; | |
0 | 9393 case VAR_FireResistance: |
501 | 9394 this->sResFireBase -= (signed __int16)pValue; |
605 | 9395 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9396 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9397 v8 = 8 * v4 + 400; | |
862 | 9398 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9399 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9400 return result; | |
0 | 9401 case VAR_AirResistance: |
501 | 9402 this->sResAirBase -= (signed __int16)pValue; |
605 | 9403 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9404 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9405 v8 = 8 * v4 + 400; | |
862 | 9406 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9407 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9408 return result; | |
0 | 9409 case VAR_WaterResistance: |
501 | 9410 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9411 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9412 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9413 v8 = 8 * v4 + 400; | |
862 | 9414 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9415 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9416 return result; | |
0 | 9417 case VAR_EarthResistance: |
501 | 9418 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9419 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9420 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9421 v8 = 8 * v4 + 400; | |
862 | 9422 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9423 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9424 return result; | |
0 | 9425 case VAR_SpiritResistance: |
501 | 9426 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9427 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9428 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9429 v8 = 8 * v4 + 400; | |
862 | 9430 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9431 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9432 return result; | |
0 | 9433 case VAR_MindResistance: |
501 | 9434 this->sResMindBase -= (signed __int16)pValue; |
605 | 9435 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9436 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9437 v8 = 8 * v4 + 400; | |
862 | 9438 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9439 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9440 return result; | |
0 | 9441 case VAR_BodyResistance: |
501 | 9442 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9443 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9444 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9445 v8 = 8 * v4 + 400; | |
862 | 9446 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9447 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9448 return result; | |
0 | 9449 case VAR_LightResistance: |
501 | 9450 this->sResLightBase -= (signed __int16)pValue; |
605 | 9451 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9452 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9453 v8 = 8 * v4 + 400; | |
862 | 9454 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9455 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9456 return result; | |
0 | 9457 case VAR_DarkResistance: |
501 | 9458 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9459 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9460 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9461 v8 = 8 * v4 + 400; | |
862 | 9462 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9463 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9464 return result; | |
0 | 9465 case VAR_MagicResistance: |
501 | 9466 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9467 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9468 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9469 v8 = 8 * v4 + 400; | |
862 | 9470 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9471 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9472 return result; | |
0 | 9473 case VAR_FireResistanceBonus: |
501 | 9474 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9475 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9476 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9477 v8 = 8 * v4 + 400; | |
862 | 9478 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9479 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9480 return result; | |
0 | 9481 case VAR_AirResistanceBonus: |
501 | 9482 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9483 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9484 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9485 v8 = 8 * v4 + 400; | |
862 | 9486 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9487 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9488 return result; | |
0 | 9489 case VAR_WaterResistanceBonus: |
501 | 9490 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9491 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9492 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9493 v8 = 8 * v4 + 400; | |
862 | 9494 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9495 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9496 return result; | |
0 | 9497 case VAR_EarthResistanceBonus: |
501 | 9498 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9499 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9500 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9501 v8 = 8 * v4 + 400; | |
862 | 9502 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9503 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9504 return result; | |
0 | 9505 case VAR_SpiritResistanceBonus: |
501 | 9506 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9507 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9508 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9509 v8 = 8 * v4 + 400; | |
862 | 9510 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9511 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9512 return result; | |
0 | 9513 case VAR_MindResistanceBonus: |
501 | 9514 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9515 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9516 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9517 v8 = 8 * v4 + 400; | |
862 | 9518 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9519 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9520 return result; | |
0 | 9521 case VAR_BodyResistanceBonus: |
501 | 9522 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9523 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9524 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9525 v8 = 8 * v4 + 400; | |
862 | 9526 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9527 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9528 return result; | |
0 | 9529 case VAR_LightResistanceBonus: |
501 | 9530 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9531 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9532 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9533 v8 = 8 * v4 + 400; | |
862 | 9534 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9535 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9536 return result; | |
0 | 9537 case VAR_DarkResistanceBonus: |
501 | 9538 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9539 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9540 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9541 v8 = 8 * v4 + 400; | |
862 | 9542 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9543 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9544 return result; | |
0 | 9545 case VAR_MagicResistanceBonus: |
501 | 9546 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9547 v25 = 0; |
187 | 9548 v23 = SPEECH_91; |
9549 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9550 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9551 v8 = 8 * v4 + 400; | |
862 | 9552 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9553 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9554 return result; | |
0 | 9555 case VAR_FixedFood: |
501 | 9556 Party::TakeFood((unsigned int)pValue); |
605 | 9557 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9558 v8 = 8 * v4 + 400; | |
862 | 9559 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9560 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9561 return result; | |
0 | 9562 case VAR_StaffSkill: |
9563 case VAR_SwordSkill: | |
9564 case VAR_DaggerSkill: | |
9565 case VAR_AxeSkill: | |
9566 case VAR_SpearSkill: | |
9567 case VAR_BowSkill: | |
9568 case VAR_MaceSkill: | |
9569 case VAR_BlasterSkill: | |
9570 case VAR_ShieldSkill: | |
9571 case VAR_LeatherSkill: | |
9572 case VAR_SkillChain: | |
9573 case VAR_PlateSkill: | |
9574 case VAR_FireSkill: | |
9575 case VAR_AirSkill: | |
9576 case VAR_WaterSkill: | |
9577 case VAR_EarthSkill: | |
9578 case VAR_SpiritSkill: | |
9579 case VAR_MindSkill: | |
9580 case VAR_BodySkill: | |
9581 case VAR_LightSkill: | |
9582 case VAR_DarkSkill: | |
9583 case VAR_IdentifyItemSkill: | |
9584 case VAR_MerchantSkill: | |
9585 case VAR_RepairSkill: | |
9586 case VAR_BodybuildingSkill: | |
9587 case VAR_MeditationSkill: | |
9588 case VAR_PerceptionSkill: | |
9589 case VAR_DiplomacySkill: | |
9590 case VAR_DisarmTrapSkill: | |
9591 case VAR_LearningSkill: | |
501 | 9592 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9593 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9594 v8 = 8 * v4 + 400; | |
862 | 9595 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9596 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9597 return result; | |
0 | 9598 case VAR_Cursed: |
9599 case VAR_Weak: | |
9600 case VAR_Asleep: | |
9601 case VAR_Afraid: | |
9602 case VAR_Drunk: | |
9603 case VAR_Insane: | |
9604 case VAR_PoisonedGreen: | |
9605 case VAR_DiseasedGreen: | |
9606 case VAR_PoisonedYellow: | |
9607 case VAR_DiseasedYellow: | |
9608 case VAR_PoisonedRed: | |
9609 case VAR_DiseasedRed: | |
9610 case VAR_Paralyzed: | |
9611 case VAR_Unconsious: | |
9612 case VAR_Dead: | |
9613 case VAR_Stoned: | |
9614 case VAR_Eradicated: | |
501 | 9615 *((int *)this + 2 * VarNum - 210) = 0; |
9616 *((int *)this + 2 * result - 209) = 0; | |
0 | 9617 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9618 v8 = 8 * v4 + 400; | |
862 | 9619 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9620 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9621 return result; |
605 | 9622 default: |
9623 return result; | |
9624 } | |
9625 for (v3 = 1; v3 < 126; v3++) | |
9626 { | |
9627 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9628 { |
605 | 9629 RemoveItemAtInventoryIndex(v3); |
501 | 9630 return true; |
0 | 9631 } |
605 | 9632 } |
501 | 9633 if ( pParty->pPickedItem.uItemID == pValue ) |
9634 { | |
605 | 9635 pMouse->RemoveHoldingItem(); |
9636 return true; | |
9637 } | |
9638 return false; | |
0 | 9639 } |
9640 } | |
9641 } | |
9642 // 5B65C4: using guessed type int dword_5B65C4; | |
9643 // 5B65CC: using guessed type int dword_5B65CC; |